From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8885CA0FF0 for ; Fri, 29 Aug 2025 08:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=429KrglbdOzTTTKTq54BtH2XfiqudlQvONPdY0q1JlE=; b=mQyXOTelvr0+QJurnw/+Ky+OGn iEFDp+dDQ7i6ffs85F9oIDhN1SCWSGGz+bND/6bVKydgw++GG+RUSE25/mvT6vlepcbSR+9zi7FdX 6/ToKVPTQYXuRLiP64wvTs3jWQUhgivOKpBtanbouZOk2qFToPOhW8yHWlfQiBgQSVNVmTMhB/mK0 j4fVxjbpjzfV2w3JO4EODw1JdCUTOW+XM9kltCKg6aSezlRFOCO9Q/eKy0G3xkCE2n5oelyyYAL7y /UHzmBoLYqXLTnntMKzmShpIlXDW5nMOofYm1mYet3BeP42F4H83bVuthzD7FY9cfF63iZAMhEDl+ kUWZJNvg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uruuw-000000053Bd-0fUc; Fri, 29 Aug 2025 08:57:06 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uruEf-00000004v0f-1Sio for linux-arm-kernel@lists.infradead.org; Fri, 29 Aug 2025 08:13:26 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 7FB4541A08; Fri, 29 Aug 2025 08:13:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F3FAC4AF0C; Fri, 29 Aug 2025 08:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756455204; bh=/QgTUEjLJvtCEweoaKMR9FxAwI+j6T0k2tHXf4ZR0Eg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=UzeNfyN3XArG9qZPSsv2vifCNAeRvS4LtVpDC5aJPlAXVwBQ+A9LcqvimiMW6QJW6 oSL8p9/R1OTR8cb1l4qRMVjlaC5Vsho3FAMP237y45wzs/ysoIGJaLy0xe77nd4B55 x+60NqUy1U2iq6/Zbkmxz2X+FmaAkIGlZgHKwnyBs9LGEcXwx9f6Gu9WfOUKsDTd6s YHsiuDSIl3N+A3xl9EWiD8b/CmuNd0ql6okQfcxY1HGbRr1I6h1MhKdZmGZ8EMceH8 4XpuPptslKwglXnr5x8MoarWXaueUdi/aWHfZF4LVwvQOtrCBRLaqH03eMcQtIz7Y4 KG5wBTg2JHrvw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1uruEb-00000001W2M-3xiw; Fri, 29 Aug 2025 08:13:22 +0000 Date: Fri, 29 Aug 2025 09:13:20 +0100 Message-ID: <867bymeean.wl-maz@kernel.org> From: Marc Zyngier To: Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Oliver Upton , Mark Brown , Ryan Roberts , kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2 2/2] arm64/sysreg: Replace TCR_EL1 field macros In-Reply-To: <20250829060215.1086792-3-anshuman.khandual@arm.com> References: <20250829060215.1086792-1-anshuman.khandual@arm.com> <20250829060215.1086792-3-anshuman.khandual@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: anshuman.khandual@arm.com, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, broonie@kernel.org, ryan.roberts@arm.com, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250829_011325_427596_E8F1A066 X-CRM114-Status: GOOD ( 22.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 29 Aug 2025 07:02:15 +0100, Anshuman Khandual wrote: > > This just replaces all used TCR_EL1 field macros with tools sysreg variant > based fields and subsequently drops them from the header (pgtable-hwdef.h) > and moves them into KVM header (asm/kvm_arm.h) for continued usage in KVM. > > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Marc Zyngier > Cc: Mark Brown > Cc: kvmarm@lists.linux.dev > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual > --- > Changes in V2: > > - Dropped all TCR_EL1 replacements from KVM code > - Moved existing TCR_XXX macros from (asm/pgtable-hwdef.h) into KVM header > (asm/kvm_arm.h) for their continued usage > > arch/arm64/include/asm/assembler.h | 6 +- > arch/arm64/include/asm/cputype.h | 2 +- > arch/arm64/include/asm/kvm_arm.h | 92 +++++++++++++++++++++++ > arch/arm64/include/asm/mmu_context.h | 4 +- > arch/arm64/include/asm/pgtable-hwdef.h | 100 +------------------------ > arch/arm64/include/asm/pgtable-prot.h | 2 +- > arch/arm64/kernel/cpufeature.c | 4 +- > arch/arm64/kernel/pi/map_kernel.c | 8 +- > arch/arm64/kernel/vmcore_info.c | 2 +- > arch/arm64/mm/proc.S | 36 +++++---- > tools/arch/arm64/include/asm/cputype.h | 2 +- > 11 files changed, 134 insertions(+), 124 deletions(-) > [...] > diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h > index 1da290aeedce..ad3c305c6374 100644 > --- a/arch/arm64/include/asm/kvm_arm.h > +++ b/arch/arm64/include/asm/kvm_arm.h > @@ -107,6 +107,98 @@ > > #define MPAMHCR_HOST_FLAGS 0 > > +#define TCR_T0SZ_OFFSET 0 > +#define TCR_T1SZ_OFFSET 16 These are unused by KVM. > +#define TCR_TxSZ(x) (TCR_T0SZ(x) | TCR_T1SZ(x)) > +#define TCR_TxSZ_WIDTH 6 > +#define TCR_T0SZ_MASK (((UL(1) << TCR_TxSZ_WIDTH) - 1) << TCR_T0SZ_OFFSET) > +#define TCR_T1SZ_MASK (((UL(1) << TCR_TxSZ_WIDTH) - 1) << TCR_T1SZ_OFFSET) [eyeroll] Why do you need to repeat all of this, while you just introduced new definitions? Surely you can write a script that express one in term of the other, and add that to KVM, instead of just blindly moving stuff around? M. -- Without deviation from the norm, progress is not possible.