[PATCH 2/2] KVM: arm64: Reenable MTE tag checking on exit from guest when running VHE
Marc Zyngier
maz at kernel.org
Mon Oct 26 01:23:05 PDT 2026
Once we're back from running a guest, it is important to set TCO to
zero so that MTE is functional again.
Signed-off-by: Marc Zyngier <maz at kernel.org>
---
arch/arm64/kvm/hyp/vhe/switch.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm64/kvm/hyp/vhe/switch.c b/arch/arm64/kvm/hyp/vhe/switch.c
index 4c965f9b1e1de..73c2dd61e6c69 100644
--- a/arch/arm64/kvm/hyp/vhe/switch.c
+++ b/arch/arm64/kvm/hyp/vhe/switch.c
@@ -193,6 +193,13 @@ static void __deactivate_traps(struct kvm_vcpu *vcpu)
if (!arm64_kernel_unmapped_at_el0())
host_vectors = __this_cpu_read(this_cpu_vector);
write_sysreg(host_vectors, vbar_el1);
+
+ /*
+ * We're now able to take MTE exceptions, make sure the VBAR_EL2 is
+ * set to the correct value.
+ */
+ if (mte_disable_tco_entry(current))
+ isb();
}
NOKPROBE_SYMBOL(__deactivate_traps);
--
2.47.3
More information about the linux-arm-kernel
mailing list