Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1058596pxy; Wed, 28 Apr 2021 21:44:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6jtyVQ80J7ROh4R98SwbUZexRegPAwBQPUL7H7sUMrWkFS+E3hLj2d4FYFkd42eYgfl38 X-Received: by 2002:a17:90a:8906:: with SMTP id u6mr36785429pjn.162.1619671452110; Wed, 28 Apr 2021 21:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619671452; cv=none; d=google.com; s=arc-20160816; b=SX7pzsgBZWBa1vhuPIGFWQXkIQt7QkVWUGiDauyO1YuBsxr42HM78f5hDh+H8QUHEb q9ercO9BuMN9D7LyJVYgOL2sg2q62OIx/MeHsIbv6Zy7wE6kwxVtJi5R051a5N3GRDN/ C757YnkdeTFchUVbakXsCe3c7nEUp/GwgJe08EkGiMIpf5JdBmBpgyS6SFqTkxQWDRgZ FfPTn9MeUsdfMZGt7CwL2a6NuPMPxIn0PiN6RLvx5Zu2juKdg7dSzY7fJ6H3xyCkBNM6 gzUwdEYLSkMy85Al4zuASa5fWMW5vDQKgKVzq4oA9PCS+65s3Qi0dyfo1hAyTwCwIkX8 /ivA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:cc:content-transfer-encoding :mime-version:message-id:date:subject:dkim-signature; bh=dYuU5G7Tok7W7dteeCw6ZMzwcEHLOIU+TkutgZ/lpVQ=; b=1DJRgncvMOffT933wJgUkkLmgsS+eimNRY19ffK4RLu4c5NSVT2tUx5tdJLbDaAAVG ItiF2LPzNgRalNEEX43Ex5UO9iMNPWxFapYi3ZEB6dN94B5gdVscX5EzdQVLxUEnUvll l1V0cjtPFCLebvJMfB3sKLcT+7ls+iWmE57lF/iq2b8qgqWQZCdjtZANRsYSdbog2WmE LETyp7oY34UbElVgHr9PJrhxhCzowSHg7MJUtc56KW26534cOqziIc6YQ5k/wS6sN54g bvroV2WsOAydUiyWRa9rY0BRCilJKPtyhAMXYGoMI0fJxEz1TXOtTjwk1/uP3vgaGoaI blkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=oZYFFE+B; 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 j126si2041167pgc.463.2021.04.28.21.43.56; Wed, 28 Apr 2021 21:44:12 -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=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=oZYFFE+B; 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 S231161AbhD2EoG (ORCPT + 99 others); Thu, 29 Apr 2021 00:44:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229814AbhD2EoF (ORCPT ); Thu, 29 Apr 2021 00:44:05 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D76AC06138B for ; Wed, 28 Apr 2021 21:43:19 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id y1so18437762plg.11 for ; Wed, 28 Apr 2021 21:43:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20150623.gappssmtp.com; s=20150623; h=subject:date:message-id:mime-version:content-transfer-encoding:cc :from:to; bh=dYuU5G7Tok7W7dteeCw6ZMzwcEHLOIU+TkutgZ/lpVQ=; b=oZYFFE+Bkk/IeFoxxL5IEGMza6qcQMtcphBKKgOPvFRBJ/A/UxQOUgWqXISyL47oq0 QJxhycOwaHu3xPeTTTnxbH5il2GAr+OGBa3hZDXqRTZJKuyvMZCP9h64a+zTQVM0YuLj f7kuAgnv3Z9xrKYYPdHKxM3PVXKG0brumHKSaL1EiSRfjJFZ31hqb97KLubg17FnRb+j JW5sQBv/5TdAEf17pYJ2LHxb9IaR9B3PfncY4vjzjFa7tjRhoHUYsz3uiTHIA5NeZFT+ ijyhmjmPzJyl320tohcGYOvmLZ2n7FHXUpHQdMH7GuyeLU9AmP3bKlOtgWJeYNAABdwC 2ubA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:mime-version :content-transfer-encoding:cc:from:to; bh=dYuU5G7Tok7W7dteeCw6ZMzwcEHLOIU+TkutgZ/lpVQ=; b=a6d8i+iinGM+p99T5feeczTuwysLb+bK89ItjYBPpqf/anYqzRGhmbgatgzjqCYpnT 0H0GVHPIH2Wrn55IR4pqcM+DXBWqYDYda7Lr3GrmGQCf51UMmbKW6oKZwXyPrqJla0Cz 3t3I8ua9BYv88xIjKpaQ45G4Y1AUnFrVWQ20A0HLu26roTPlyEkdqH/2bIne73O1Ge3G taD6gK6TAJG1O+sUywVnoo0v38F76sq9lnPXzq2M3KQ2/wcQ9iUUQ1WQiJuPC3Ldtbc1 rre9DiK2D3o23nyQog/uaJ65Q+5kpKuMu0ajobFLBSNkrB7KV8i0LG2qtz6oF6/jV2gw 01EA== X-Gm-Message-State: AOAM531SiiAXrjbblN3vqLSDpBChYgXjZTywObmJ7a9S+zVfrm7aqLaH DvfBMjnZIvXVt2/3hHDuPLyVlA== X-Received: by 2002:a17:90b:78d:: with SMTP id l13mr7789191pjz.182.1619671398668; Wed, 28 Apr 2021 21:43:18 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id gm17sm898788pjb.11.2021.04.28.21.43.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 21:43:18 -0700 (PDT) Subject: [PATCH v2] RISC-V: Always define XIP_FIXUP Date: Wed, 28 Apr 2021 14:45:12 -0700 Message-Id: <20210428214512.551153-1-palmer@dabbelt.com> X-Mailer: git-send-email 2.31.1.498.g6c1eba8ee3d-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Paul Walmsley , Palmer Dabbelt , aou@eecs.berkeley.edu, Atish Patra , akpm@linux-foundation.org, rppt@kernel.org, Anup Patel , wangkefeng.wang@huawei.com, vitaly.wool@konsulko.com, alex@ghiti.fr, greentime.hu@sifive.com, 0x7f454c46@gmail.com, chenhuang5@huawei.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-team@android.com, Palmer Dabbelt , Guenter Roeck From: Palmer Dabbelt To: linux-riscv@lists.infradead.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Palmer Dabbelt XIP depends on MMU, but XIP_FIXUP is used throughout the kernel in order to avoid excessive ifdefs. This just makes sure to always define XIP_FIXUP, which will fix MMU=n builds. XIP_OFFSET is used by assembly but XIP_FIXUP is C-only, so they're split. Fixes: 44c922572952 ("RISC-V: enable XIP") Reported-by: Guenter Roeck Signed-off-by: Palmer Dabbelt --- Changes since v1: * Clean up the commit text. * Define XIP_OFFSET for assembly. --- arch/riscv/include/asm/pgtable.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 2f1384e14e31..9469f464e71a 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -73,18 +73,10 @@ #endif #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) +#endif + #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 +93,17 @@ #include #endif /* CONFIG_64BIT */ +#ifdef CONFIG_XIP_KERNEL +#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)) -- 2.31.1.498.g6c1eba8ee3d-goog