Skip to content

Commit

Permalink
ANDROID: KVM: arm64: Only unpin a vCPU SVE state if set
Browse files Browse the repository at this point in the history
This avoid unpinning NULL state.

Bug: 256125458
Signed-off-by: Fuad Tabba <[email protected]>
Change-Id: I9d346e0705a69b69704fd30ab09635548763229e
  • Loading branch information
Fuad Tabba committed Nov 1, 2022
1 parent 559e670 commit 14c8176
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions arch/arm64/kvm/hyp/nvhe/pkvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,14 @@ static void unpin_host_vcpus(struct shadow_vcpu_state *shadow_vcpus, int nr_vcpu
for (i = 0; i < nr_vcpus; i++) {
struct kvm_vcpu *host_vcpu = shadow_vcpus[i].vcpu.arch.pkvm.host_vcpu;
struct kvm_vcpu *shadow_vcpu = &shadow_vcpus[i].vcpu;
void *sve_state = shadow_vcpu->arch.sve_state;
size_t sve_state_size;
void *sve_state;

hyp_unpin_shared_mem(host_vcpu, host_vcpu + 1);

if (!test_bit(KVM_ARM_VCPU_SVE, shadow_vcpu->arch.features))
if (!sve_state)
continue;

sve_state = shadow_vcpu->arch.sve_state;
sve_state = kern_hyp_va(sve_state);
sve_state_size = vcpu_sve_state_size(shadow_vcpu);
hyp_unpin_shared_mem(sve_state, sve_state + sve_state_size);
Expand Down

0 comments on commit 14c8176

Please sign in to comment.