Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2442187rdb; Fri, 8 Dec 2023 08:13:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHiL3S6qWprKZQEYMJXsrpSU8lmC9bK9d3MfCRBaVz2JOZrAIJ1EMMEGzTzfuQ1KREU0ouW X-Received: by 2002:a05:6a00:4e4c:b0:6ce:3260:c47b with SMTP id gu12-20020a056a004e4c00b006ce3260c47bmr247466pfb.46.1702052015359; Fri, 08 Dec 2023 08:13:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702052015; cv=none; d=google.com; s=arc-20160816; b=WGT64U6Z9IXZYFb805tHz+tEpUd4n2VwTl4th4T9pdC1uLXCbM4WdUNHJIXEsKx1tj BXTmDfW2gk2uJCDIF4Jmsl4ZMc6/Qlc5/Jh6tpWWkHdYv0PHPxkFbeQRozYD0wK7NZOk Uo7QvNh+zEuYr37shRS6ir+oZQhZzlxlwLEf/cZqm0NvbARLZMcVzXazOl2C+S0tAq4Q J4jA8fFPDa96naMWIQXRtYznHf0AnvslNg4gA+xHw3xbT6V4BeHOHLUXCHF+xGjmHqhk M1tuT9sCbkb7XpnuVb18ntOtVczLTjjDqw3/z4eADajf965dVO2KnHBsEef2wElUGTlR eVLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FGnu+pKltHatitWmpZe2slSLwq2YMSEGW5QMPSmCvCw=; fh=jshYI2NwtEb4RFDet1CibhjijWOL1JdxV9n387woDuM=; b=sxpmiWs6A1HqDfIkE3xHobWqlDQ8Kttscwf00B2AQJqsYLCd6O5Y2t/T//m7JCk5TU oSp4K4xAN86+yzGby2gg4MMOtG98Vfrd06SN++kxiWbHofimwBTol5RfdP1Z1eL/Z2G7 HbpBynm9mLFLkbAP9QUUru45UecRVBFPo/ccYziKn63kPF9UMBlyQCFe+K6NF1VOGNZi 3lGys7ZF7pC89auQGRAxctomLoKbVscc6F3QACZKXyHtu/veiGxHyxdZT8zx24+WlfUu EMJX3xzxir+TG3UbQxqZ12TBp8U1Q2dXBYGhCdZfhDfXhkFcS1K1Bxt2LxlJ17XDFhoA jeuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="LJ/mIuxr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id p27-20020a056a000a1b00b006b905fe37b7si1801614pfh.221.2023.12.08.08.13.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 08:13:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="LJ/mIuxr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 115C3813557F; Fri, 8 Dec 2023 08:13:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574083AbjLHQNB (ORCPT + 99 others); Fri, 8 Dec 2023 11:13:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573881AbjLHQMw (ORCPT ); Fri, 8 Dec 2023 11:12:52 -0500 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::223]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0537F1997; Fri, 8 Dec 2023 08:12:57 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id A9B636000B; Fri, 8 Dec 2023 16:12:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1702051976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FGnu+pKltHatitWmpZe2slSLwq2YMSEGW5QMPSmCvCw=; b=LJ/mIuxr6qHAYUk6svKj9Twgg97pdvMlzT3YnIlrYdWe0JAA4FoaNYNElfpvRP9zg6lnXi Tn1WlWjY8dP3RJ5UK1+K4XpVTK1Rbop72PNOcPzIpdceNrBsf7hNk6e/rxClxvso1KHbRY 2cd61JWOc4mJq9/wgD79Z+aRPHMSRCvygC5SPK2vzNX5HmEzUFxGZpUtMyXaPXFxzLc4XR 53r8dv0QFCOD3o/U3xB/Tb1n9/Gx8V1aoUTM1AVBe0LFxRP2XnZlyZhMwRo4XhmUqZHN/u wJbTFTVlmOS6bA92h33a8fePoGa4K0ETaVD3Bw34Y3xn7a6eqxngzchJgbniIA== From: Gregory CLEMENT To: Paul Burton , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Jiaxun Yang , Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vladimir Kondratiev , Tawfik Bayouk , Alexandre Belloni , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Thomas Petazzoni , Gregory CLEMENT Subject: [PATCH v4 03/22] MIPS: spaces: Define a couple of handy macros Date: Fri, 8 Dec 2023 17:12:19 +0100 Message-ID: <20231208161249.1827174-4-gregory.clement@bootlin.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231208161249.1827174-1-gregory.clement@bootlin.com> References: <20231208161249.1827174-1-gregory.clement@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: gregory.clement@bootlin.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 08 Dec 2023 08:13:31 -0800 (PST) KSEGX_SIZE is defined to size of each KSEG segment. TO_CAC and TO_UNCAC are defined for 32bits builds and point to KSEG 0 and KSEG1. TO_PHYS remains to be 64bits only as we want people to use __pa to avoid mixup compat address space. Co-developed-by: Jiaxun Yang Signed-off-by: Gregory CLEMENT --- arch/mips/include/asm/addrspace.h | 5 +++++ arch/mips/include/asm/mach-generic/spaces.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/arch/mips/include/asm/addrspace.h b/arch/mips/include/asm/addrspace.h index 59a48c60a065c..03a5e2c8b5dc9 100644 --- a/arch/mips/include/asm/addrspace.h +++ b/arch/mips/include/asm/addrspace.h @@ -47,6 +47,11 @@ */ #define KSEGX(a) ((_ACAST32_(a)) & _ACAST32_(0xe0000000)) +/* + * Gives the size of each kernel segment + */ +#define KSEGX_SIZE 0x20000000 + /* * Returns the physical address of a CKSEGx / XKPHYS address */ diff --git a/arch/mips/include/asm/mach-generic/spaces.h b/arch/mips/include/asm/mach-generic/spaces.h index b247575c5e699..c502bdd98aad0 100644 --- a/arch/mips/include/asm/mach-generic/spaces.h +++ b/arch/mips/include/asm/mach-generic/spaces.h @@ -49,6 +49,8 @@ #define HIGHMEM_START _AC(0x20000000, UL) #endif +#define TO_UNCAC(x) CKSEG1ADDR(x) +#define TO_CAC(x) CKSEG0ADDR(x) #endif /* CONFIG_32BIT */ #ifdef CONFIG_64BIT -- 2.42.0