* [PATCH] KVM: arm64: Fix propagation of TLBI level in kvm_pgtable_stage2_relax_perms()
@ 2026-07-07 16:29 Marc Zyngier
2026-07-07 16:44 ` Marc Zyngier
0 siblings, 1 reply; 2+ messages in thread
From: Marc Zyngier @ 2026-07-07 16:29 UTC (permalink / raw)
To: kvm, linux-arm-kernel
Cc: Steffen Eiden, Joey Gouly, Suzuki K Poulose, Oliver Upton,
Zenghui Yu, Mark Brown
Assigning the invalidation level (an s8 value) with TLBI_TTL_UNKNOWN
(a 32bit signed value) is not ideal, to say the least. Instead of
this, only pass TLBI_TTL_UNKNOWN to __kvm_tlb_flush_vmid_ipa_nsh()
when we know for sure that we don't have a provided level.
Fixes: 100baf0184896 ("KVM: arm64: Ensure level is always initialized when relaxing perms")
Reported-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Oliver Upton <oupton@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/akztC7H2IsEKaq4i@sirena.org.uk
---
arch/arm64/kvm/hyp/pgtable.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
index 8754c99c22f2f..70dceb20dfada 100644
--- a/arch/arm64/kvm/hyp/pgtable.c
+++ b/arch/arm64/kvm/hyp/pgtable.c
@@ -1356,7 +1356,7 @@ int kvm_pgtable_stage2_relax_perms(struct kvm_pgtable *pgt, u64 addr,
enum kvm_pgtable_prot prot, enum kvm_pgtable_walk_flags flags)
{
kvm_pte_t xn = 0, set = 0, clr = 0;
- s8 level = TLBI_TTL_UNKNOWN;
+ s8 level;
int ret;
if (prot & KVM_PTE_LEAF_ATTR_HI_SW)
@@ -1379,7 +1379,8 @@ int kvm_pgtable_stage2_relax_perms(struct kvm_pgtable *pgt, u64 addr,
ret = stage2_update_leaf_attrs(pgt, addr, 1, set, clr, NULL, &level, flags);
if (!ret || ret == -EAGAIN)
- kvm_call_hyp(__kvm_tlb_flush_vmid_ipa_nsh, pgt->mmu, addr, level);
+ kvm_call_hyp(__kvm_tlb_flush_vmid_ipa_nsh, pgt->mmu, addr,
+ (ret == -EAGAIN) ? TLBI_TTL_UNKNOWN : level);
return ret;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: arm64: Fix propagation of TLBI level in kvm_pgtable_stage2_relax_perms()
2026-07-07 16:29 [PATCH] KVM: arm64: Fix propagation of TLBI level in kvm_pgtable_stage2_relax_perms() Marc Zyngier
@ 2026-07-07 16:44 ` Marc Zyngier
0 siblings, 0 replies; 2+ messages in thread
From: Marc Zyngier @ 2026-07-07 16:44 UTC (permalink / raw)
To: kvm, linux-arm-kernel, Marc Zyngier
Cc: Steffen Eiden, Joey Gouly, Suzuki K Poulose, Oliver Upton,
Zenghui Yu, Mark Brown
On Tue, 07 Jul 2026 17:29:35 +0100, Marc Zyngier wrote:
> Assigning the invalidation level (an s8 value) with TLBI_TTL_UNKNOWN
> (a 32bit signed value) is not ideal, to say the least. Instead of
> this, only pass TLBI_TTL_UNKNOWN to __kvm_tlb_flush_vmid_ipa_nsh()
> when we know for sure that we don't have a provided level.
>
>
Applied to fixes, thanks!
[1/1] KVM: arm64: Fix propagation of TLBI level in kvm_pgtable_stage2_relax_perms()
commit: 8d187d4b33c262c0f3e44842553521151d8629e8
Cheers,
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-07 16:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-07 16:29 [PATCH] KVM: arm64: Fix propagation of TLBI level in kvm_pgtable_stage2_relax_perms() Marc Zyngier
2026-07-07 16:44 ` Marc Zyngier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.