Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp160203pxy; Wed, 28 Apr 2021 01:26:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVaRI+XKzchY5znvKnziRh4BIBgaxUmubKRb2gi70klCaUXpdrDmLtbBw/OSVbtVD3CgQo X-Received: by 2002:a62:a515:0:b029:263:214f:27ff with SMTP id v21-20020a62a5150000b0290263214f27ffmr27211727pfm.4.1619598415862; Wed, 28 Apr 2021 01:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619598415; cv=none; d=google.com; s=arc-20160816; b=LOncZnJyjDzH3u0JuupE5g8pPrTlE0DVMp0UXFQR1jIMj6qbZhZXSzjbZZjbGAGOsx zAJRnkCLaqzWlzb9aQG45oILWXdBkGoUkvDvYTSdrFQyzoG6o1pf1vEPLSUE/meq7/gj z4GkeGHUsqU4UFYy2FQmnvCVCFlamIUjOthKIaHy7/REorHXLrG8TVmpLCookOs15hww 7jApmC49SsBbR8W07p3Wph8rnN9OP+6Lovpjlx6+sx9H+GfVGxRoHutGgKK0LfOHYjIO IIKCXyy2P21nIb21Ml04mjdCeqk9yl3GPSDDfw/Q6W/Xk1N//f5q1l+JgRH6/zcDVqsd IfKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=BEIEqQltKGJ2T5aysBIQPHjzU36PvWqfEPDZRTORM5k=; b=S43ihKktkT0HUwIrluxP2oQJNP3enzxQG6cgXB7Q4ILQ554Yvm1xqaiyNKU5SPZdNw kgrF9jiXnvccAwczwWHD8bCsrkpsX9hkS/9IcI1BTS1i1wllVKZ704vPktjwe0M5z15D uIRY8B2Mx28/jOOKl96M8UOsWySyxkfaxCKWi/G2E+FhEb6HUThMbjLAN8owkbsk854J iyseUax3BIB0hWWm8Coht5VLzGJ26k9m2AXVHl5953PGfvSeNEbBQ7dchBDBivg+jQd5 rYM9+UCZwrnqN0o3OYL0/0zcCDFu6EuZiV3E9ZM/4MEfAbVcTPL+ViOlcposVS7wdnxF Q6jw== ARC-Authentication-Results: i=1; mx.google.com; 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 g24si2828168pgj.554.2021.04.28.01.26.43; Wed, 28 Apr 2021 01:26:55 -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; 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 S237187AbhD1I0u (ORCPT + 99 others); Wed, 28 Apr 2021 04:26:50 -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