Skip to content

KVM: arm64: Fixes for the host SMCs that pKVM forwards to firmware

Fuad Tabba kvmarm linux-arm-kernel lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest2 patches 0 repliesNew

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2KVM: arm64: Don't forward the host's SDEI calls to firmwarearch/arm64/kvm/hyp/nvhe/hyp-main.c+9 -20 replies
2/2KVM: arm64: Don't run a pVM with firmware Spectre-v4 mitigation disabledarch/arm64/include/asm/kvm_host.h arch/arm64/kvm/hyp/nvhe/hyp-main.c+20 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] KVM: arm64: Fixes for the host SMCs that pKVM forwards to firmware

Hi folks,

Changes since v1 [1]:
- New patch 1, which stops forwarding the host's SDEI calls.
- Don't run a protected vCPU on a CPU where the firmware Spectre-v4 mitigation is disabled, instead of re-enabling it from EL2. (Marc)
- Track the host's ARCH_WORKAROUND_2 calls with a kvm_host_data flag instead of a new per-CPU variable. (Marc)
- Handle the calls in default_host_smc_handler(). (Marc)

Two fixes for the host SMCs that EL2 forwards in protected mode, which reach firmware as calls from EL2.

The first stops forwarding the host's SDEI calls. With TF-A, the host could otherwise register an event handler that runs at EL2.

The second is the v1 fix, redone as Marc suggested. It tracks the firmware Spectre-v4 mitigation state from the host's ARCH_WORKAROUND_2 calls, and relies on the first patch because firmware restores that state when an SDEI event completes.

Tested on QEMU with TF-A v2.15 and test-only host changes. When SDEI is built into TF-A, the host's SDEI calls succeed without the first patch and get NOT_SUPPORTED with it. With TF-A patched to advertise the dynamic Spectre-v4 workaround on the Cortex-A57 that QEMU models, a protected vCPU runs with the mitigation disabled, and the second patch stops it from running.

Based on Linux 7.4-rc2 (7475ea8b58616; also applies to Linux 7.4-rc3 aebb727447640).

Cheers,
/fuad

[1] https://lore.kernel.org/all/[email protected]/

Fuad Tabba (2):
KVM: arm64: Don't forward the host's SDEI calls to firmware
KVM: arm64: Don't run a pVM with firmware Spectre-v4 mitigation
disabled

 arch/arm64/include/asm/kvm_host.h  |  1 +
 arch/arm64/kvm/hyp/nvhe/hyp-main.c | 30 ++++++++++++++++++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)

base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb

Signature · 1 line
2.47.3