From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84AF7C4743C for ; Wed, 23 Jun 2021 12:39:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 60FAF6113B for ; Wed, 23 Jun 2021 12:39:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230182AbhFWMld (ORCPT ); Wed, 23 Jun 2021 08:41:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230019AbhFWMlY (ORCPT ); Wed, 23 Jun 2021 08:41:24 -0400 Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F65FC061574 for ; Wed, 23 Jun 2021 05:39:04 -0700 (PDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4G92rN21WRz9sVm; Wed, 23 Jun 2021 22:39:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1624451940; bh=YcB/9YcVFOV23ikLx+fO1is/rA8AMgT7lbS0KblGDX8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=IhO3VnSPInKOmgJ6xl4x8k54oh3tBUpey7qr5Q7eNwHTBl2lb+wc84ShJMY/WAY/K Mf3fEPIYKb3zE8VEsJfhtQmdlUee/tzIJiVDyLy0gmyLnGOgxAjH7vJhMCQ4uHZhWu W81cskQH6XGtFSVcCh8SA0hJI2OKKbCFWvi3N8e7FnronJq9UGfYBDX1fkpahhoFHI iqat3Wq9TfysA1b4mQxUtjoTNN9ibGFxM0WmPUg7GSJ42OlTfGqQVoQ/gCMvgUeyo8 rfO4bflS7/cXYJNR7I3dzzmod5PUit/W81ScqFEO6ZpPMf3yfDTVqkY9pc5IUZ6onN pWR/q2zD7CEOw== From: Michael Ellerman To: Daniel Axtens , Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH 2/3] powerpc: Define swapper_pg_dir[] in C In-Reply-To: <871r8siyqm.fsf@dja-thinkpad.axtens.net> References: <5838caffa269e0957c5a50cc85477876220298b0.1623063174.git.christophe.leroy@csgroup.eu> <5e3f1b8a4695c33ccc80aa3870e016bef32b85e1.1623063174.git.christophe.leroy@csgroup.eu> <871r8siyqm.fsf@dja-thinkpad.axtens.net> Date: Wed, 23 Jun 2021 22:38:58 +1000 Message-ID: <87czsc21st.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Daniel Axtens writes: > Hi Christophe, > > This breaks booting a radix KVM guest with 4k pages for me: > > make pseries_le_defconfig > scripts/config -d CONFIG_PPC_64K_PAGES > scripts/config -e CONFIG_PPC_4K_PAGES > make vmlinux > sudo qemu-system-ppc64 -enable-kvm -M pseries -m 1G -nographic -vga none -smp 4 -cpu host -kernel vmlinux > > Boot hangs after printing 'Booting Linux via __start()' and qemu's 'info > registers' reports that it's stuck at the instruction fetch exception. > > My host is Power9, 64k page size radix, and > gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34 > ... >> diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S >> index 730838c7ca39..79f2d1e61abd 100644 >> --- a/arch/powerpc/kernel/head_64.S >> +++ b/arch/powerpc/kernel/head_64.S >> @@ -997,18 +997,3 @@ start_here_common: >> 0: trap >> EMIT_BUG_ENTRY 0b, __FILE__, __LINE__, 0 >> .previous >> - >> -/* >> - * We put a few things here that have to be page-aligned. >> - * This stuff goes at the beginning of the bss, which is page-aligned. >> - */ >> - .section ".bss" >> -/* >> - * pgd dir should be aligned to PGD_TABLE_SIZE which is 64K. >> - * We will need to find a better way to fix this >> - */ >> - .align 16 >> - >> - .globl swapper_pg_dir >> -swapper_pg_dir: >> - .space PGD_TABLE_SIZE This is now 4K aligned whereas it used to be 64K. This fixes it and is not completely ugly? diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c index 1707ab580ee2..298469beaa90 100644 --- a/arch/powerpc/mm/pgtable.c +++ b/arch/powerpc/mm/pgtable.c @@ -28,7 +28,13 @@ #include #include -pgd_t swapper_pg_dir[MAX_PTRS_PER_PGD] __page_aligned_bss; +#ifdef CONFIG_PPC64 +#define PGD_ALIGN 0x10000 +#else +#define PGD_ALIGN PAGE_SIZE +#endif + +pgd_t swapper_pg_dir[MAX_PTRS_PER_PGD] __section(".bss..page_aligned") __aligned(PGD_ALIGN); static inline int is_exec_fault(void) { cheers