summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuad Tabba <fuad.tabba@linux.dev>2026-08-25 09:59:47 +0100
committerOliver Upton <oupton@kernel.org>2026-09-15 15:09:56 -0700
commit0d62fbf34d8fe7a3ff56692d39fbb8e6e9bf15fb (patch)
tree24554ac5e683105baef1b37932af58395c83c273
parenta1b3c788ad31837e348075e93dbba3f447492776 (diff)
downloadlinux-next-0d62fbf34d8fe7a3ff56692d39fbb8e6e9bf15fb.tar.gz
linux-next-0d62fbf34d8fe7a3ff56692d39fbb8e6e9bf15fb.zip
KVM: arm64: Key unpin_host_sve_state() on the state it unpins
unpin_host_sve_state() gates on the VM's SVE feature bit, but what it unpins is the state pkvm_vcpu_init_sve() pinned. A vCPU that completed init has sve_state set exactly when that bit is set, so the two agree. Gate on sve_state, which is what is being unpinned. Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260825085948.1674721-4-fuad.tabba@linux.dev Signed-off-by: Oliver Upton <oupton@kernel.org>
-rw-r--r--arch/arm64/kvm/hyp/nvhe/pkvm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm64/kvm/hyp/nvhe/pkvm.c b/arch/arm64/kvm/hyp/nvhe/pkvm.c
index 4857a11d4292..453d3fa4a420 100644
--- a/arch/arm64/kvm/hyp/nvhe/pkvm.c
+++ b/arch/arm64/kvm/hyp/nvhe/pkvm.c
@@ -398,10 +398,10 @@ static void unpin_host_sve_state(struct pkvm_hyp_vcpu *hyp_vcpu)
{
void *sve_state;
- if (!vcpu_has_feature(&hyp_vcpu->vcpu, KVM_ARM_VCPU_SVE))
+ sve_state = hyp_vcpu->vcpu.arch.sve_state;
+ if (!sve_state)
return;
- sve_state = hyp_vcpu->vcpu.arch.sve_state;
hyp_unpin_shared_mem(sve_state,
sve_state + vcpu_sve_state_size(&hyp_vcpu->vcpu));
}