From patchwork Mon Feb 5 15:34:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory CLEMENT X-Patchwork-Id: 196903 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp971770dyb; Mon, 5 Feb 2024 08:05:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IFUKKaOAz/XsAkJgu9thduZWx4bhzLHI8ucJeqo0rKP5iRSZqCCJG4Cdr3ZgNk7F077aBA0 X-Received: by 2002:a05:6a00:80d2:b0:6e0:4556:4a1a with SMTP id ei18-20020a056a0080d200b006e045564a1amr2657730pfb.33.1707149102684; Mon, 05 Feb 2024 08:05:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707149102; cv=pass; d=google.com; s=arc-20160816; b=RYwI5aVl7FtRoun+FBNqcfjWv5ktLWc7TXyRoeLv6gCXXZsOP+Yhv4nGu8NxM6x50F tHkJHN+fBFqGxeRS9aNJnR2vRkgVphqc4O98kgmCE6Lh4PaOgwfGjDUBI9mRb+DsaLEI XLNkFjiCIfbSduTOQECNCUFf6FM/JSvCPZ4YFlI60k/rZqNySB9ocH6ajBoRDkiEucPP RPCITwv3I7PEQdPq9KjfVS9FcAGgfCp0G88A1vM80meyxj4HBTfjPVDW+ytMWzSXo1vW AsmeuCXkemYdvsQ3Bj+1ggoA+UWds8mbKFeenci3R7owzYpwml7n77SxYjEUXWO3XZG/ R13g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5JyLWvT61W6ZBIjMo4xtHJF4yqj1qVU6xtbzha7IAjk=; fh=ykcclr3PWrZ1h74fcmjwlIKD5E8QXrb8vKWeEv0MZYc=; b=efQW0WWkLDQDNDH6EAGv/syXo83IYJsGK+uhQlGDC097lUevJiuK5ed08Ue5ZcynQr g3WMPzJwFD12+hEG7Cu/fveXoE8yhvH0i2ogM8csfpLek61GP6PDrfenF638S1JvtXI6 n12VhQ5Nuj/u0bJvfy5qO5uXMVz4/XNvVIOCilf/VsvwjrfOS1pwan4Ylz3rqX+aKKEj RMt81XDiymAFLzfmerwjCiu0th8AsWF+r6db881JlT6vnRXGxN+YExiNjX/a1A7x2x29 g3FtoJUWHTlOqeg8IPnsRQ64ejx9cMbSdtbh7ScKkBTwViJAH+nZjS/TW70f1TD7ycRK k7qQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="dC/wt3/u"; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-52923-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52923-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com X-Forwarded-Encrypted: i=1; AJvYcCXkroZKu3xpNgPgjdkT2hU1IU7tFUzxVqq1M0AjJU0eXi61AvOJkBgxi/hHfZA+OWN7RZiIWj+BBobDqGipHeJov32rOQ== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s2-20020a62e702000000b006e033a518fcsi4574pfh.115.2024.02.05.08.05.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 08:05:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52923-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="dC/wt3/u"; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-52923-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52923-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1121FB2926E for ; Mon, 5 Feb 2024 15:36:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE44E3EA9C; Mon, 5 Feb 2024 15:35:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="dC/wt3/u" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A95D92E63C; Mon, 5 Feb 2024 15:35:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707147312; cv=none; b=Smg+KHJcbGwQRBC8C77yN9AK3lM19mUsTQw8+ZKB72Cv0iPoJfu6sxwvTAJI64KTYbEzFrOXDVqvSX4XXj9f81KRFgp/9/mrILhU0lpdOtfINqk5V1RPAEZ1piGtDkaFYGKgnPuEsNpI94BizvhV/uRRjoXszNB8CBlzyu+Y2TU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707147312; c=relaxed/simple; bh=CaXBWxsO+R6feKBnilzrnxufzQ2BLnDif1KfoyMON+g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NhhAMsfnPuR+MLGkbFjy6diM9BzollDvwQ/mnTtnifWhKDSosbQfO2as7TE6dwL+1J13pxoOMqxajfyDcZ69Xz988flsg7nqZXaJ1Lu4cq71fK5zCnLq+c9dGDdC1soeHs1V0k8xMtYuTYk/xAu51vPqsymWbsBeeRDVeBqhtPo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=dC/wt3/u; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 430F81BF206; Mon, 5 Feb 2024 15:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1707147307; 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=5JyLWvT61W6ZBIjMo4xtHJF4yqj1qVU6xtbzha7IAjk=; b=dC/wt3/ujt8P+jtn7s/fQM6YzkfK7oECQ1q/Oq27Hk0C9IitLAeKbchmOBvHpaS0sKRjjb w/zGECBhtoZfBoknbB/awF+NzwKvT9jn9yaJS3y2V/UdMenhe7lnV1PJsR2bpjcjdBGSE2 WnOGqZBdfWM36DKCaaTD6GyEXIjfqbmOiT2Dgzd9pz9uKHqiKmNGFxliDeTKx4NbywNip2 +YPxWG4LTpjYclxV17ySWB8BCcado1pJGvKkMyXbvbvkgC9iI3eF06RVTS8KMHZrH4G+eE VdrmUDpyl40LX9SehAJ+OjHSMZ1FydHEMJNg+yi2MSgSCO9uYat04sQ5xWlVsw== 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_Lebr?= =?utf-8?q?un?= , Thomas Petazzoni , Gregory CLEMENT Subject: [PATCH v7 01/14] MIPS: spaces: Define a couple of handy macros Date: Mon, 5 Feb 2024 16:34:47 +0100 Message-ID: <20240205153503.574468-2-gregory.clement@bootlin.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240205153503.574468-1-gregory.clement@bootlin.com> References: <20240205153503.574468-1-gregory.clement@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-GND-Sasl: gregory.clement@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790075577695493916 X-GMAIL-MSGID: 1790075577695493916 Define KSEGX_SIZE to represent the size of each KSEG segment. Introduce CKSEG0ADDR_OR_64BIT and CKSEG1ADDR_OR_64BIT to get an XPHYS address in 64bits and CKSEG[01]ADDR() in 32 bits mode. 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 | 4 ++++ 2 files changed, 9 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..f8783d339fb0d 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 CKSEG0ADDR_OR_64BIT(x) CKSEG0ADDR(x) +#define CKSEG1ADDR_OR_64BIT(x) CKSEG1ADDR(x) #endif /* CONFIG_32BIT */ #ifdef CONFIG_64BIT @@ -82,6 +84,8 @@ #define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK)) #define TO_UNCAC(x) (UNCAC_BASE | ((x) & TO_PHYS_MASK)) +#define CKSEG0ADDR_OR_64BIT(x) TO_CAC(x) +#define CKSEG1ADDR_OR_64BIT(x) TO_UNCAC(x) #endif /* CONFIG_64BIT */ /*