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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 CE555C433ED for ; Wed, 28 Apr 2021 08:26:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9574261423 for ; Wed, 28 Apr 2021 08:26:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237230AbhD1I0v (ORCPT ); Wed, 28 Apr 2021 04:26:51 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:38707 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236730AbhD1I0t (ORCPT ); Wed, 28 Apr 2021 04:26:49 -0400 X-Originating-IP: 2.7.49.219 Received: from [192.168.1.100] (lfbn-lyo-1-457-219.w2-7.abo.wanadoo.fr [2.7.49.219]) (Authenticated sender: alex@ghiti.fr) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 519A91C000E; Wed, 28 Apr 2021 08:25:55 +0000 (UTC) Subject: Re: [PATCH] RISC-V: Always define XIP_FIXUP To: Palmer Dabbelt , linux-riscv@lists.infradead.org Cc: Paul Walmsley , aou@eecs.berkeley.edu, akpm@linux-foundation.org, Atish Patra , Anup Patel , wangkefeng.wang@huawei.com, rppt@kernel.org, vitaly.wool@konsulko.com, greentime.hu@sifive.com, 0x7f454c46@gmail.com, chenhuang5@huawei.com, linux-kernel@vger.kernel.org, kernel-team@android.com, Palmer Dabbelt , Guenter Roeck References: <20210428033415.107756-1-palmer@dabbelt.com> From: Alex Ghiti Message-ID: Date: Wed, 28 Apr 2021 04:25:55 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <20210428033415.107756-1-palmer@dabbelt.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 4/27/21 à 11:34 PM, Palmer Dabbelt a écrit : > From: Palmer Dabbelt > > XIP depends on MMU, but XIP_FIXUP is defined throughout the kernel in > order to avoid excessive ifdefs. This just makes sure to always define > XIP_FIXIP, which will fix MMU=n builds. A small typo here. > > Fixes: 44c922572952 ("RISC-V: enable XIP") > Reported-by: Guenter Roeck > Signed-off-by: Palmer Dabbelt > --- > arch/riscv/include/asm/pgtable.h | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > > diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h > index 2f1384e14e31..fd749351f432 100644 > --- a/arch/riscv/include/asm/pgtable.h > +++ b/arch/riscv/include/asm/pgtable.h > @@ -73,18 +73,6 @@ > #endif > #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) > > -#ifdef CONFIG_XIP_KERNEL > -#define XIP_OFFSET SZ_8M > -#define XIP_FIXUP(addr) ({ \ > - uintptr_t __a = (uintptr_t)(addr); \ > - (__a >= CONFIG_XIP_PHYS_ADDR && __a < CONFIG_XIP_PHYS_ADDR + SZ_16M) ? \ > - __a - CONFIG_XIP_PHYS_ADDR + CONFIG_PHYS_RAM_BASE - XIP_OFFSET :\ > - __a; \ > - }) > -#else > -#define XIP_FIXUP(addr) (addr) > -#endif /* CONFIG_XIP_KERNEL */ > - > #endif > > #ifndef __ASSEMBLY__ > @@ -101,6 +89,18 @@ > #include > #endif /* CONFIG_64BIT */ > > +#ifdef CONFIG_XIP_KERNEL > +#define XIP_OFFSET SZ_8M XIP_OFFSET is used in head.S and then this breaks XIP_KERNEL. XIP_OFFSET must live outside the ifndef __ASSEMBLY__. > +#define XIP_FIXUP(addr) ({ \ > + uintptr_t __a = (uintptr_t)(addr); \ > + (__a >= CONFIG_XIP_PHYS_ADDR && __a < CONFIG_XIP_PHYS_ADDR + SZ_16M) ? \ > + __a - CONFIG_XIP_PHYS_ADDR + CONFIG_PHYS_RAM_BASE - XIP_OFFSET :\ > + __a; \ > + }) > +#else > +#define XIP_FIXUP(addr) (addr) > +#endif /* CONFIG_XIP_KERNEL */ > + > #ifdef CONFIG_MMU > /* Number of entries in the page global directory */ > #define PTRS_PER_PGD (PAGE_SIZE / sizeof(pgd_t)) > Thank you for doing that! Alex