From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.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 D7DB42D321F; Fri, 29 Aug 2025 08:13:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756455204; cv=none; b=SxloxrWb6jWvQUvO3EI6YO6FIkad/guziUXp83pEOb967FQW/la97weQBrqo6+OjgfhnSmdpCM+aVdLOM8hGcKRfbY/vg+c2KKKUPFQV5OD340KCoGEGi6JcqXB4Dm9So9HsjRQd9fNX77ds5aJIwbOxhvGBrbthMxuvu0JxEYg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756455204; c=relaxed/simple; bh=/QgTUEjLJvtCEweoaKMR9FxAwI+j6T0k2tHXf4ZR0Eg=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=c7kLDXOC2+dQ54meaOuXIlBX5oRUowAXDIacnIz8SJq92XAfbna8X/+6yhsLQe0f+8Vpr0qJBlA4ABSJOWOFWjmMhkCri2cCxXNC5l4b8Ujh/UgIuGcZEGnh8MpOs75eRLiOqW6GXaOUkAXVkK/Ng8KZYEEkv4gvd5/r0cdR0c8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UzeNfyN3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UzeNfyN3" 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) Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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 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.