Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4761102rdb; Tue, 12 Dec 2023 08:36:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IFYBdpOfN8SyeLsCbSuLiMGy0n/YhL+s8CtKbmEP7G39xOwSmBqFhkTxxYIn4mcpEFhtZZ9 X-Received: by 2002:a17:902:e5c5:b0:1d1:cd8b:8bc2 with SMTP id u5-20020a170902e5c500b001d1cd8b8bc2mr7259144plf.33.1702398967557; Tue, 12 Dec 2023 08:36:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702398967; cv=none; d=google.com; s=arc-20160816; b=Xc27Vk4kis3+TR+CdsPBkbppPUKtInHK43RVFQMIjnjYDPjjWBdq2FEd81sWVS5rOV ZNyQrv0nKbNprnNHWH7a0lVdA4bQZeWZIKOjqbBr8WPRZZ+FFqyedpfe/GpgAV+TGWtJ N4rdfugCVyQM1Nehe8VaMXnNwD/+uJ+oSmkb9rgSn2PTQCQ9Haadtc8VPIC1S7+Yp/ST /POXjk0dsAkhchSJe7MTfP9SYoRtIyqApgvsgscfEvxsN359YI4eoFpscvsCR1y1PJeQ WgxmA9Y8Dyk+uWg+8cS6XSbAkbE5hX1EwbNixSg55XOqJOAJ77uiz2ZLhpvTwJRXhpcb G4CQ== 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=lKcme3eaH65euvc/e2P73RSdLcgnsk0eRcbckWPUCdg=; fh=jshYI2NwtEb4RFDet1CibhjijWOL1JdxV9n387woDuM=; b=UFZ/DDUEnXSbfOwqjOLqpyQbp/BB2Dj2vXY5DnqyshNdBpLbaYdlBfE/M8naXEBG/X D9yYrYBet88sG/myJ9Qast/e1C016D3+HQfsQr6dnYlkZOy+w8a58vYMku/Oog2cgRUH XQxzFrSudXWXjrF+gq2amkdNN7kjxKiqNu6Jyc2gRPNG/vgcZDyQ31NhfALu3xhXrz7B PjacqDF8KCux2tvo/DIMNNrOdfn5ddqd1aRvoWpxQJ6k09iR+SoAlSZ0eCXwwXluM5/A OoII/NiDihrNhNT8pcCKWddJBdWVre6HmKDi+NBUhhztFtoeT3NO/t9REtY56ETZo0OU RAdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=hV61DdsZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id b12-20020a63eb4c000000b005be1ee5be76si7835464pgk.373.2023.12.12.08.36.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 08:36:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=hV61DdsZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 0EB8280A7F31; Tue, 12 Dec 2023 08:36:05 -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 S1346696AbjLLQfo (ORCPT + 99 others); Tue, 12 Dec 2023 11:35:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232988AbjLLQfZ (ORCPT ); Tue, 12 Dec 2023 11:35:25 -0500 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63CB7CF; Tue, 12 Dec 2023 08:35:28 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id EC60D1BF206; Tue, 12 Dec 2023 16:35:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1702398926; 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=lKcme3eaH65euvc/e2P73RSdLcgnsk0eRcbckWPUCdg=; b=hV61DdsZAAj98ndi9omfMHJ64OQ103h1zci1b7xPMPI1LEe6X2UpwRXzSwRTP/3K71WgTO 4xbWq2ONnAmjcVGBPXj8Ed3viBxklngetrxWiKpw3UpPk1GG262+vfczvzm4jeAj14H5FK cg/ZVreDQSR7LUJ+457DJdUb6m9Sm8PEMrTrULk3xsBQ0OqFDaXd8wCwPcGX4mn7riw6JP rcSkchf6mhbGT9zrClx1kSOVargaobSp0kX9ciKayh2lW/t1HQtlwZd13tBauicNAC7QzA RZ9fT/zbzPwTfbpvNhw6XmMgi6aoy89132BttBKG0Wt9FXXKyezjYx15F9UMfQ== 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 v5 03/22] MIPS: spaces: Define a couple of handy macros Date: Tue, 12 Dec 2023 17:34:35 +0100 Message-ID: <20231212163459.1923041-4-gregory.clement@bootlin.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231212163459.1923041-1-gregory.clement@bootlin.com> References: <20231212163459.1923041-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]); Tue, 12 Dec 2023 08:36:05 -0800 (PST) Define KSEGX_SIZE to represent the size of each KSEG segment. Introduce TO_CAC and TO_UNCAC specifically for 32-bit builds, pointing to KSEG0 and KSEG1. TO_PHYS remains exclusive to 64-bit builds to encourage the use of __pa and prevent compatibility address space confusion. KSEGX_SIZE is defined to size of each KSEG segment. 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