Skip to content

Commit feb84f6

Browse files
committed
KVM: selftests: document the default implementation of vm_vaddr_populate_bitmap
Explain the meaning of the bit manipulations of vm_vaddr_populate_bitmap. These correspond to the "canonical addresses" of x86 and other architectures, but that is not obvious. Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 2f5213b commit feb84f6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tools/testing/selftests/kvm/lib/kvm_util.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,15 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = {
186186
_Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES,
187187
"Missing new mode params?");
188188

189+
/*
190+
* Initializes vm->vpages_valid to match the canonical VA space of the
191+
* architecture.
192+
*
193+
* The default implementation is valid for architectures which split the
194+
* range addressed by a single page table into a low and high region
195+
* based on the MSB of the VA. On architectures with this behavior
196+
* the VA region spans [0, 2^(va_bits - 1)), [-(2^(va_bits - 1), -1].
197+
*/
189198
__weak void vm_vaddr_populate_bitmap(struct kvm_vm *vm)
190199
{
191200
sparsebit_set_num(vm->vpages_valid,

0 commit comments

Comments
 (0)