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 657DF38FA3; Thu, 11 Dec 2025 14:30:56 +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=1765463456; cv=none; b=osMzPwPu42C+fnUTCdaeWBv/RS1LiEkSpkOoPKTNeMSU+WepWPaDk0rhKtrb5aIdF0kh+08k9XqhAaF+k7EkvIxrJoPuAA6BayzoSjMhHAE0mfPwZAlOVwUSS6Mn+V/XIwyDsdiPi9B1kQNv+C5AkZXbvUS2QmI+u3Tua9BIlZM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765463456; c=relaxed/simple; bh=4XrbaxjUbL2DYRiS5YvFYiLwpypPxRsxDxeb2gTntoI=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=jCIbpay3ug1oGEXYUQ0b4DiDMzkwojNCisp0kmWte14ACvrt5+5IROpBRGgNrLDmhH03CERHBNe1IjjhxDAckqG36AcMKUSACl3k4Khdmd+yE+fyZQVqvUIxVMXLcVKm0TfiaS1wcvTDB5LZ/k0wZhIzNb0ges2AhPjRhNO5a18= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fRTx8ByO; 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="fRTx8ByO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7A93C4CEF7; Thu, 11 Dec 2025 14:30:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765463456; bh=4XrbaxjUbL2DYRiS5YvFYiLwpypPxRsxDxeb2gTntoI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=fRTx8ByO++BzI32CtLFa2G61ueIh7JMPfUuzT3VyIt38+H98w+1ELDkcMNhvkDxFo 0S1zAsL89YlhFsVO7yUZyyiKj1RMi3ynJ8I4PeUUljBAGml04An5lmlfefynOzo3+q 3jdHo2rdGAwJa7eX59R55YpR0PQ7ClCv86YDlURjizCS65kWn8hqGZwz36aoKlTEK/ /NY4HyeNxD/ULq3vvFIebe2td0q+FXZilXdwgBfRowiF8Xq8MV4wEnTHH/Pzuozch4 Kflj+DkllpTfERJbfb8QPxkhiup/p7A/GJYXmWO2HnFZkVfHwKsoTBM+/OBftR+QDT MTyU+ZttIrsIA== 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 1vThgz-0000000C1Rg-2FKf; Thu, 11 Dec 2025 14:30:53 +0000 Date: Thu, 11 Dec 2025 14:30:53 +0000 Message-ID: <86v7idnl9e.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Joey Gouly , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Alexandru Elisei , Sascha Bischoff , Quentin Perret , Sebastian Ene Subject: Re: [PATCH v2 1/6] KVM: arm64: Fix EL2 S1 XN handling for hVHE setups In-Reply-To: References: <20251210173024.561160-1-maz@kernel.org> <20251210173024.561160-2-maz@kernel.org> 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: kvm@vger.kernel.org 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: tabba@google.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com, oupton@kernel.org, yuzenghui@huawei.com, alexandru.elisei@arm.com, Sascha.Bischoff@arm.com, qperret@google.com, sebastianene@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Thu, 11 Dec 2025 13:37:50 +0000, Fuad Tabba wrote: > > Hi Marc, > > > On Wed, 10 Dec 2025 at 17:30, Marc Zyngier wrote: > > > > The current XN implementation is tied to the EL2 translation regime, > > and fall flat on its face with the EL2&0 one that is used for hVHE, > > as the permission bit for privileged execution is a different one. > > > > Fixes: 6537565fd9b7f ("KVM: arm64: Adjust EL2 stage-1 leaf AP bits when ARM64_KVM_HVHE is set") > > Signed-off-by: Marc Zyngier > > --- > > arch/arm64/include/asm/kvm_pgtable.h | 10 +++++++++- > > 1 file changed, 9 insertions(+), 1 deletion(-) > > > > diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h > > index fc02de43c68dd..be68b89692065 100644 > > --- a/arch/arm64/include/asm/kvm_pgtable.h > > +++ b/arch/arm64/include/asm/kvm_pgtable.h > > @@ -87,7 +87,15 @@ typedef u64 kvm_pte_t; > > > > #define KVM_PTE_LEAF_ATTR_HI_SW GENMASK(58, 55) > > > > -#define KVM_PTE_LEAF_ATTR_HI_S1_XN BIT(54) > > +#define __KVM_PTE_LEAF_ATTR_HI_S1_XN BIT(54) > > +#define __KVM_PTE_LEAF_ATTR_HI_S1_UXN BIT(54) > > +#define __KVM_PTE_LEAF_ATTR_HI_S1_PXN BIT(53) > > + > > +#define KVM_PTE_LEAF_ATTR_HI_S1_XN \ > > + ({ cpus_have_final_cap(ARM64_KVM_HVHE) ? \ > > + (__KVM_PTE_LEAF_ATTR_HI_S1_UXN | \ > > + __KVM_PTE_LEAF_ATTR_HI_S1_PXN) : \ > > + __KVM_PTE_LEAF_ATTR_HI_S1_XN; }) > > > > #define KVM_PTE_LEAF_ATTR_HI_S2_XN GENMASK(54, 53) > > I was just wondering, is this patch really necessary, considering > patch 6/6 redos the whole thing and fixes the bug? I want this one to be in a state where it can be backported, without having to deal with the NV-induced FEAT_XNX support. This is why it is a standalone patch. > That said: > Reviewed-by: Fuad Tabba Thanks! M. -- Without deviation from the norm, progress is not possible.