From: Vincent Donnefort <vdonnefort@google.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
Will Deacon <will@kernel.org>, Marc Zyngier <maz@kernel.org>,
Oliver Upton <oupton@kernel.org>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Sudeep Holla <sudeep.holla@kernel.org>,
James Morse <james.morse@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Mark Brown <broonie@kernel.org>,
kvmarm@lists.linux.dev
Subject: Re: [PATCH v3 5/5] KVM: arm64: Add SMC hook for SME dvmsync erratum
Date: Tue, 24 Mar 2026 10:14:40 +0000 [thread overview]
Message-ID: <acJkEEXKt_GunFLQ@google.com> (raw)
In-Reply-To: <20260323162408.4163113-6-catalin.marinas@arm.com>
On Mon, Mar 23, 2026 at 04:24:05PM +0000, Catalin Marinas wrote:
> From: James Morse <james.morse@arm.com>
>
> C1-Pro cores with SME have an erratum where TLBI+DSB does not complete
> all outstanding SME accesses. Instead a DSB needs to be executed on the
> affecteed CPUs. The implication is pages cannot be unmapped from the
> host stage2 then provided to the guest. Host SME accesses may occur
> after this point.
>
> This erratum breaks pKVM's guarantees, and the workaround is hard to
> implement as EL2 and EL1 share a security state meaning EL1 can mask
> IPI sent by EL2, leading to interrupt blackouts.
>
> Instead, do this in EL3. This has the advantage of a separate security
> state, meaning lower EL cannot mask the IPI. It is also simpler for EL3
> to know about CPUs that are off or in PSCI's CPU_SUSPEND.
>
> Add the needed hook.
>
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Marc Zyngier <maz@kernel.org>
> Cc: Oliver Upton <oupton@kernel.org>
> Cc: Will Deacon <will@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>
> Cc: Sudeep Holla <sudeep.holla@kernel.org>
In case this goes in before Will's p-guest series and with just a small comment
below:
Reviewed-by: Vincent Donnefort <vdonnefort@google.com>
> ---
> arch/arm64/kvm/hyp/nvhe/mem_protect.c | 17 +++++++++++++++++
> include/linux/arm-smccc.h | 6 ++++++
> 2 files changed, 23 insertions(+)
>
> diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> index 38f66a56a766..ef8afbdd421b 100644
> --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> @@ -5,6 +5,8 @@
> */
>
> #include <linux/kvm_host.h>
> +#include <linux/arm-smccc.h>
> +
> #include <asm/kvm_emulate.h>
> #include <asm/kvm_hyp.h>
> #include <asm/kvm_mmu.h>
> @@ -28,6 +30,15 @@ static struct hyp_pool host_s2_pool;
> static DEFINE_PER_CPU(struct pkvm_hyp_vm *, __current_vm);
> #define current_vm (*this_cpu_ptr(&__current_vm))
>
> +static void pkvm_sme_dvmsync_fw_call(void)
> +{
> + if (alternative_has_cap_unlikely(ARM64_WORKAROUND_4193714)) {
> + struct arm_smccc_res res;
> +
> + arm_smccc_1_1_smc(ARM_SMCCC_CPU_WORKAROUND_4193714, &res);
With hyp tracing in kvmarm/next, this should be hyp_smccc_1_1_smc().
> + }
> +}
> +
> static void guest_lock_component(struct pkvm_hyp_vm *vm)
> {
> hyp_spin_lock(&vm->lock);
> @@ -553,6 +564,12 @@ int host_stage2_set_owner_locked(phys_addr_t addr, u64 size, u8 owner_id)
> if (ret)
> return ret;
>
> + /*
> + * After stage2 maintenance has happened, but before the page owner has
> + * changed.
> + */
> + pkvm_sme_dvmsync_fw_call();
> +
> /* Don't forget to update the vmemmap tracking for the host */
> if (owner_id == PKVM_ID_HOST)
> __host_update_page_state(addr, size, PKVM_PAGE_OWNED);
> diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
> index 50b47eba7d01..e7195750d21b 100644
> --- a/include/linux/arm-smccc.h
> +++ b/include/linux/arm-smccc.h
> @@ -105,6 +105,12 @@
> ARM_SMCCC_SMC_32, \
> 0, 0x3fff)
>
> +/* C1-Pro erratum 4193714: SME DVMSync early acknowledgement */
> +#define ARM_SMCCC_CPU_WORKAROUND_4193714 \
> + ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
> + ARM_SMCCC_SMC_32, \
> + ARM_SMCCC_OWNER_CPU, 0x10)
> +
> #define ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID \
> ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
> ARM_SMCCC_SMC_32, \
>
next prev parent reply other threads:[~2026-03-24 10:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 16:24 [PATCH v3 0/5] arm64: Work around C1-Pro erratum 4193714 (CVE-2026-0995) Catalin Marinas
2026-03-23 16:24 ` [PATCH v3 1/5] arm64: tlb: Introduce __tlbi_sync_s1ish_{kernel,batch}() for TLB maintenance Catalin Marinas
2026-03-23 16:24 ` [PATCH v3 2/5] arm64: tlb: Pass the corresponding mm to __tlbi_sync_s1ish() Catalin Marinas
2026-03-23 16:24 ` [PATCH v3 3/5] arm64: cputype: Add C1-Pro definitions Catalin Marinas
2026-03-23 16:24 ` [PATCH v3 4/5] arm64: errata: Work around early CME DVMSync acknowledgement Catalin Marinas
2026-03-27 19:15 ` Catalin Marinas
2026-03-23 16:24 ` [PATCH v3 5/5] KVM: arm64: Add SMC hook for SME dvmsync erratum Catalin Marinas
2026-03-24 10:14 ` Vincent Donnefort [this message]
2026-03-24 12:56 ` Catalin Marinas
2026-03-23 17:53 ` [PATCH v3 0/5] arm64: Work around C1-Pro erratum 4193714 (CVE-2026-0995) Mark Rutland
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=acJkEEXKt_GunFLQ@google.com \
--to=vdonnefort@google.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=lpieralisi@kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sudeep.holla@kernel.org \
--cc=will@kernel.org \
/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 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.