1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * tools/testing/selftests/kvm/lib/kvm_util_internal.h
5 * Copyright (C) 2018, Google LLC.
8 #ifndef SELFTEST_KVM_UTIL_INTERNAL_H
9 #define SELFTEST_KVM_UTIL_INTERNAL_H
11 #include "sparsebit.h"
13 #define KVM_DEV_PATH "/dev/kvm"
15 struct userspace_mem_region {
16 struct kvm_userspace_memory_region region;
17 struct sparsebit *unused_phy_pages;
23 struct list_head list;
27 struct list_head list;
30 struct kvm_run *state;
38 unsigned int pgtable_levels;
39 unsigned int page_size;
40 unsigned int page_shift;
44 struct list_head vcpus;
45 struct list_head userspace_mem_regions;
46 struct sparsebit *vpages_valid;
47 struct sparsebit *vpages_mapped;
55 struct vcpu *vcpu_find(struct kvm_vm *vm, uint32_t vcpuid);
58 * Virtual Translation Tables Dump
61 * stream - Output FILE stream
62 * vm - Virtual Machine
63 * indent - Left margin indent amount
69 * Dumps to the FILE stream given by @stream, the contents of all the
70 * virtual translation tables for the VM given by @vm.
72 void virt_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent);
78 * stream - Output FILE stream
80 * indent - Left margin indent amount
86 * Dumps the state of the registers given by @regs, to the FILE stream
89 void regs_dump(FILE *stream, struct kvm_regs *regs, uint8_t indent);
92 * System Register Dump
95 * stream - Output FILE stream
96 * sregs - System registers
97 * indent - Left margin indent amount
103 * Dumps the state of the system registers given by @sregs, to the FILE stream
106 void sregs_dump(FILE *stream, struct kvm_sregs *sregs, uint8_t indent);
108 struct userspace_mem_region *
109 memslot2region(struct kvm_vm *vm, uint32_t memslot);
111 #endif /* SELFTEST_KVM_UTIL_INTERNAL_H */