Skip to content

Commit

Permalink
KVM: selftests: Fill in vm->vpages_mapped bitmap in virt_map() too
Browse files Browse the repository at this point in the history
Similar to vm_vaddr_alloc(), virt_map() needs to reflect the mapping
in vm->vpages_mapped.

While on it, remove unneeded code wrapping in vm_vaddr_alloc().

Reviewed-by: Andrew Jones <[email protected]>
Reviewed-by: Sean Christopherson <[email protected]>
Signed-off-by: Vitaly Kuznetsov <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
vittyvk authored and bonzini committed Nov 18, 2022
1 parent 9984892 commit 56fc773
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/testing/selftests/kvm/lib/kvm_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1319,8 +1319,7 @@ vm_vaddr_t vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min)

virt_pg_map(vm, vaddr, paddr);

sparsebit_set(vm->vpages_mapped,
vaddr >> vm->page_shift);
sparsebit_set(vm->vpages_mapped, vaddr >> vm->page_shift);
}

return vaddr_start;
Expand Down Expand Up @@ -1393,6 +1392,8 @@ void virt_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr,
virt_pg_map(vm, vaddr, paddr);
vaddr += page_size;
paddr += page_size;

sparsebit_set(vm->vpages_mapped, vaddr >> vm->page_shift);
}
}

Expand Down

0 comments on commit 56fc773

Please sign in to comment.