Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org
Cc: Steffen Eiden <seiden@linux.ibm.com>,
	Joey Gouly <joey.gouly@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Oliver Upton <oupton@kernel.org>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Fuad Tabba <fuad.tabba@linux.dev>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>
Subject: [PATCH 2/2] KVM: arm64: Reenable MTE tag checking on exit from guest when running VHE
Date: Mon, 26 Oct 2026 08:23:05 +0000	[thread overview]
Message-ID: <20261026082305.2515705-3-maz@kernel.org> (raw)
In-Reply-To: <20261026082305.2515705-1-maz@kernel.org>

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@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



  parent reply	other threads:[~2026-10-26  8:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26  8:23 [PATCH 0/2] KVM: arm64: Reenable MTE on VHE guest exit Marc Zyngier
2026-10-26  8:23 ` [PATCH 1/2] arm64: Add return value to mte_disable_tco_entry() Marc Zyngier
2026-10-26  8:23 ` Marc Zyngier [this message]
2026-10-26 14:06 ` [PATCH 0/2] KVM: arm64: Reenable MTE on VHE guest exit Fuad Tabba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261026082305.2515705-3-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=fuad.tabba@linux.dev \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=oupton@kernel.org \
    --cc=seiden@linux.ibm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox