From patchwork Fri Feb 16 17:42:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory CLEMENT X-Patchwork-Id: 202269 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp674273dyb; Fri, 16 Feb 2024 09:43:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVwbO2RpxrF7a7BrV/VGHyOf3yxzjq9s3UrVy2Ee4wnL26rO3/gH+UNxBRYg+MOCvlR0FJQKhUDptAewUYIbKeqYvakpg== X-Google-Smtp-Source: AGHT+IE5pMav9SxHhlKlRVxFllu9l7UMSgmYNBeXtx0ZRRD05MkDZ69UClpP6UUjJQ++ni8AJHn4 X-Received: by 2002:aa7:8c10:0:b0:6e0:6bc7:15ec with SMTP id c16-20020aa78c10000000b006e06bc715ecmr5218260pfd.30.1708105388439; Fri, 16 Feb 2024 09:43:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708105388; cv=pass; d=google.com; s=arc-20160816; b=qSl5IhBGv7l4Hdx0H3V5pa0Dp/5GYd5TQ+JEgI25Elve6jaIMwU7v1rFYkuJpLXoH4 VoJrBf7a9oaAG25GoaqQ2xO8ySSUceCF59nfFJ8wHkk2JD5MORUPk7hOV9EBQVStghzP 2pQUV1tUEObPnKnBd0LHaerwZn+5hU3HvhAWov8a4RoDEJJyBY7hwo5uYvZzHkimJVBb IOhJ2MRHhSo3w+xvcoUxlI8D2qq3RaTSsYgLg/a4Nev06NCbZWfyxZ/7c/hxiCbgAaS8 nK1s67rERrAoWRn3JwBTHablrfBj4MFB27MGbIohUc3Pzs1jRWn9lh2RJSwjzgZEPLVF i+Eg== 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=Axj8HIASMHBgR5o6/moj3w8Gd2MoT6J/01JlLIK6CjU=; fh=jshYI2NwtEb4RFDet1CibhjijWOL1JdxV9n387woDuM=; b=H2Ry2w1kQciPuVODNfTSickSho+ND3FDI+/RJeX9wwxvnDmOM/9rxO3XPvg6ACf4YZ d7AMnu0BfXyxaY1qRvDTaMuGh4a4iIKa45oODW8iewrVOaiLTfsEhaeLS7wppsVsZ18T TXB/3uJnhzw1vNKnTMvV24Y1p8UbKtP1hq80Z7KeGehegVGan7YqKPCsUZuhUQfSMhIi irRcS/mxP86IDLzCG1z9p/bK9RANbUlZ5c/6VEfm4zDDNFuejGlCnoWUUXI8JCtdq4Uj qBFxzV9VFhBB+imoF8PB9CHmlVjA0hxWj4qJZ2s6OZw7xvivc8GOlU5Va1XQOxb/s72U 6ixA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=LCeO7g3c; 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-69085-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69085-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id f30-20020a63381e000000b005dc8a8b13b8si215806pga.178.2024.02.16.09.43.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 09:43:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69085-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=LCeO7g3c; 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-69085-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69085-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4565A284D05 for ; Fri, 16 Feb 2024 17:43:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04B3513341F; Fri, 16 Feb 2024 17:42:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="LCeO7g3c" Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (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 94D68131E5D; Fri, 16 Feb 2024 17:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708105356; cv=none; b=sFrbaJdL1qJrWrJOnjacWmzwQUmebq+ohDF8T5psi/OLDCogq3vih1W83031cEQsxXiH8wW9n5YjJdVmACQQb9WbIYYVx55NZFRHnHyMaejZilz0v3RyD69bAPb/iUFd5GzYYF2YL5hJGOH+R+2gDTOzsMt7BmpL7L3k2GjO3UQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708105356; c=relaxed/simple; bh=BOyUr0UPDVUOYNogVV+QAoPG/ry4w9cdTDK057dLQUY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y+JdZvPe9rs5890OCh1+Soqs7jZJ4JAZc19RoDR3CsgHt84Q4yfEdaoORTj8yPF/9HeF0cFnxnTaLDldHzDY7IlNArSO9cJJBMEjMtal+n2w7XFSGY9IuC0rnSjUZbQ915DT1XlfkmFwtPHe8Toq97PJOh/c8pYyIkmT8HdJt2k= 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=LCeO7g3c; arc=none smtp.client-ip=217.70.183.196 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 EAD5FE000B; Fri, 16 Feb 2024 17:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708105351; 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=Axj8HIASMHBgR5o6/moj3w8Gd2MoT6J/01JlLIK6CjU=; b=LCeO7g3cmQ8ws+ptQzzKkby+O9joy+f78CNxM51dRmhL13QhNRpzDpdv5ekU9BAHgaL4OY ampfuviabKpB7YgS8wqMILqJWjbhQ3ff977UU/SM/qcp801fEgJ4vnvvvMiJVqZrIs8JKh rK8AjsJhvQnbHRKW8iVQGiILDQ6tijpkNNEgP+W0E4JlIyE6xF6DkZ412alLOZ7q95HYfa 7eNvYHd5qg8/XCNC8ghUuiAHoQ7lUb5zprRVI5ZIAXppw8fsuHtnaK+FYj+CfArct+U/DO 9+QlL/FsEssu1cnw7tA3gH2au+VIriC+rO3+8Zv/KQuQIBWSVpJPqXLbiY9/0w== 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 v8 01/14] MIPS: spaces: Define a couple of handy macros Date: Fri, 16 Feb 2024 18:42:10 +0100 Message-ID: <20240216174227.409400-2-gregory.clement@bootlin.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240216174227.409400-1-gregory.clement@bootlin.com> References: <20240216174227.409400-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: 1791078315658080798 X-GMAIL-MSGID: 1791078315658080798 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..7e9ef01cb182b 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 CSEGX_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 */ /*