Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5625197pxj; Wed, 23 Jun 2021 05:40:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnTiPi4WBHpDuVAtKqKR7/x0gh/VKFMsV1gCmclxuDmO1pZVc0wwO1v3HNNgrpoSO9Fav1 X-Received: by 2002:a05:6402:26c7:: with SMTP id x7mr12034272edd.383.1624452036128; Wed, 23 Jun 2021 05:40:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624452036; cv=none; d=google.com; s=arc-20160816; b=EsBl5Na61eGMH/0SaQmFGSgsWteF3L1lZgTYqg+uvxLDFPMFc51cBSQEWDXUzCsoq5 8eIqAZvmoE7y47QjabKUEyh/sH0rB0KNe2hoj+cOywkXAmk/n1jsTYUAGP71GOF/qeMN fOEnmy1Y8xqG8XLJq26jvcMs13pEyFVVOT5SqXaSQ1ATFDSIJ/oWRE8uvq4YGA4+vWMG eCNAONridC/8tZLCaXs/2jQ0n9BplcOBCmZ/l/y1J911ZK7K8mnJzlN7dPgK+r2hryNb jqU00myOB/wkShtMoi1d4+QLDNUcgo9rXM002/5JQ1zDxIN/UubqSjCSvMiKEYaXhFF8 Jdqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=WEkI5oofMFdmg/VLniwoF2QYrqAXoyxhdru+XrBTGMI=; b=OarJw9G+LbhSPTGhYDUZ1bm0zcpZdyQgEKjI9D3w3z7XL6ugZiuwFSgXtSKZzNOpCR o6fDfkVxc0ksFSBEpjdhHPPwITRVe+56FKuachcE2c8JCkZmX/LQeAEtXnW7ih2ZBCwI wPxIXshX0LHrN2qQX24nQw5hxGakq+CryKW1bgYu2YUcs5gtnjO7lz2EhpovB3TAbkEi EUXPb3XzmvXbtiw8vhRMqENSXirPm+kjZP7i5bIR6sTAG5/5K5cF2igYiQjQN+OE9/MU ExY6Ka3/CK3BYxuDs4Mb88unsu0iQsQc+wIvd1fkqSvpJH6uTHWxgG62LjAxUWZuY/EC 47dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=IhO3VnSP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz7si17038357ejc.650.2021.06.23.05.40.13; Wed, 23 Jun 2021 05:40:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=IhO3VnSP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230302AbhFWMlb (ORCPT + 99 others); Wed, 23 Jun 2021 08:41:31 -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