mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 19:13:47 +02:00
KVM: selftests: Use gva_t instead of vm_vaddr_t
Replace all occurrences of vm_vaddr_t with gva_t to align with KVM code and with the conversion helpers (e.g. addr_gva2hva()). This commit was generated with the following command: git ls-files tools/testing/selftests/kvm | xargs sed -i 's/vm_vaddr_/gva_/g' Then by manually adjusting whitespace to make checkpatch.pl happy, and dropping renames of functions that allocate memory within a given VM. No functional change intended. Signed-off-by: David Matlack <dmatlack@google.com> [sean: drop renames of allocator APIs] Link: https://patch.msgid.link/20260420212004.3938325-2-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
parent
6b80203187
commit
5567fc9dcd
|
|
@ -731,7 +731,7 @@ static void kvm_inject_get_call(struct kvm_vm *vm, struct ucall *uc,
|
|||
struct kvm_inject_args *args)
|
||||
{
|
||||
struct kvm_inject_args *kvm_args_hva;
|
||||
vm_vaddr_t kvm_args_gva;
|
||||
gva_t kvm_args_gva;
|
||||
|
||||
kvm_args_gva = uc->args[1];
|
||||
kvm_args_hva = (struct kvm_inject_args *)addr_gva2hva(vm, kvm_args_gva);
|
||||
|
|
@ -752,7 +752,7 @@ static void test_vgic(uint32_t nr_irqs, bool level_sensitive, bool eoi_split)
|
|||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
struct kvm_inject_args inject_args;
|
||||
vm_vaddr_t args_gva;
|
||||
gva_t args_gva;
|
||||
|
||||
struct test_args args = {
|
||||
.nr_irqs = nr_irqs,
|
||||
|
|
@ -986,7 +986,7 @@ static void test_vgic_two_cpus(void *gcode)
|
|||
struct kvm_vcpu *vcpus[2];
|
||||
struct test_args args = {};
|
||||
struct kvm_vm *vm;
|
||||
vm_vaddr_t args_gva;
|
||||
gva_t args_gva;
|
||||
int gic_fd, ret;
|
||||
|
||||
vm = vm_create_with_vcpus(2, gcode, vcpus);
|
||||
|
|
|
|||
|
|
@ -179,8 +179,8 @@ void vm_install_exception_handler(struct kvm_vm *vm,
|
|||
void vm_install_sync_handler(struct kvm_vm *vm,
|
||||
int vector, int ec, handler_fn handler);
|
||||
|
||||
uint64_t *virt_get_pte_hva_at_level(struct kvm_vm *vm, vm_vaddr_t gva, int level);
|
||||
uint64_t *virt_get_pte_hva(struct kvm_vm *vm, vm_vaddr_t gva);
|
||||
uint64_t *virt_get_pte_hva_at_level(struct kvm_vm *vm, gva_t gva, int level);
|
||||
uint64_t *virt_get_pte_hva(struct kvm_vm *vm, gva_t gva);
|
||||
|
||||
static inline void cpu_relax(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
* ucall_exit_mmio_addr holds per-VM values (global data is duplicated by each
|
||||
* VM), it must not be accessed from host code.
|
||||
*/
|
||||
extern vm_vaddr_t *ucall_exit_mmio_addr;
|
||||
extern gva_t *ucall_exit_mmio_addr;
|
||||
|
||||
static inline void ucall_arch_do_ucall(vm_vaddr_t uc)
|
||||
static inline void ucall_arch_do_ucall(gva_t uc)
|
||||
{
|
||||
WRITE_ONCE(*ucall_exit_mmio_addr, uc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ struct kvm_vm {
|
|||
struct sparsebit *vpages_mapped;
|
||||
bool has_irqchip;
|
||||
vm_paddr_t ucall_mmio_addr;
|
||||
vm_vaddr_t handlers;
|
||||
gva_t handlers;
|
||||
uint32_t dirty_ring_size;
|
||||
uint64_t gpa_tag_mask;
|
||||
|
||||
|
|
@ -716,22 +716,20 @@ void vm_mem_region_move(struct kvm_vm *vm, uint32_t slot, uint64_t new_gpa);
|
|||
void vm_mem_region_delete(struct kvm_vm *vm, uint32_t slot);
|
||||
struct kvm_vcpu *__vm_vcpu_add(struct kvm_vm *vm, uint32_t vcpu_id);
|
||||
void vm_populate_vaddr_bitmap(struct kvm_vm *vm);
|
||||
vm_vaddr_t vm_vaddr_unused_gap(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min);
|
||||
vm_vaddr_t vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min);
|
||||
vm_vaddr_t __vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min,
|
||||
gva_t vm_vaddr_unused_gap(struct kvm_vm *vm, size_t sz, gva_t vaddr_min);
|
||||
gva_t vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, gva_t vaddr_min);
|
||||
gva_t __vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, gva_t vaddr_min,
|
||||
enum kvm_mem_region_type type);
|
||||
gva_t vm_vaddr_alloc_shared(struct kvm_vm *vm, size_t sz, gva_t vaddr_min,
|
||||
enum kvm_mem_region_type type);
|
||||
vm_vaddr_t vm_vaddr_alloc_shared(struct kvm_vm *vm, size_t sz,
|
||||
vm_vaddr_t vaddr_min,
|
||||
enum kvm_mem_region_type type);
|
||||
vm_vaddr_t vm_vaddr_alloc_pages(struct kvm_vm *vm, int nr_pages);
|
||||
vm_vaddr_t __vm_vaddr_alloc_page(struct kvm_vm *vm,
|
||||
enum kvm_mem_region_type type);
|
||||
vm_vaddr_t vm_vaddr_alloc_page(struct kvm_vm *vm);
|
||||
gva_t vm_vaddr_alloc_pages(struct kvm_vm *vm, int nr_pages);
|
||||
gva_t __vm_vaddr_alloc_page(struct kvm_vm *vm, enum kvm_mem_region_type type);
|
||||
gva_t vm_vaddr_alloc_page(struct kvm_vm *vm);
|
||||
|
||||
void virt_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr,
|
||||
unsigned int npages);
|
||||
void *addr_gpa2hva(struct kvm_vm *vm, vm_paddr_t gpa);
|
||||
void *addr_gva2hva(struct kvm_vm *vm, vm_vaddr_t gva);
|
||||
void *addr_gva2hva(struct kvm_vm *vm, gva_t gva);
|
||||
vm_paddr_t addr_hva2gpa(struct kvm_vm *vm, void *hva);
|
||||
void *addr_gpa2alias(struct kvm_vm *vm, vm_paddr_t gpa);
|
||||
|
||||
|
|
@ -1131,12 +1129,12 @@ vm_adjust_num_guest_pages(enum vm_guest_mode mode, unsigned int num_guest_pages)
|
|||
}
|
||||
|
||||
#define sync_global_to_guest(vm, g) ({ \
|
||||
typeof(g) *_p = addr_gva2hva(vm, (vm_vaddr_t)&(g)); \
|
||||
typeof(g) *_p = addr_gva2hva(vm, (gva_t)&(g)); \
|
||||
memcpy(_p, &(g), sizeof(g)); \
|
||||
})
|
||||
|
||||
#define sync_global_from_guest(vm, g) ({ \
|
||||
typeof(g) *_p = addr_gva2hva(vm, (vm_vaddr_t)&(g)); \
|
||||
typeof(g) *_p = addr_gva2hva(vm, (gva_t)&(g)); \
|
||||
memcpy(&(g), _p, sizeof(g)); \
|
||||
})
|
||||
|
||||
|
|
@ -1147,7 +1145,7 @@ vm_adjust_num_guest_pages(enum vm_guest_mode mode, unsigned int num_guest_pages)
|
|||
* undesirable to change the host's copy of the global.
|
||||
*/
|
||||
#define write_guest_global(vm, g, val) ({ \
|
||||
typeof(g) *_p = addr_gva2hva(vm, (vm_vaddr_t)&(g)); \
|
||||
typeof(g) *_p = addr_gva2hva(vm, (gva_t)&(g)); \
|
||||
typeof(g) _val = val; \
|
||||
\
|
||||
memcpy(_p, &(_val), sizeof(g)); \
|
||||
|
|
@ -1242,9 +1240,9 @@ static inline void virt_pg_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr
|
|||
* Returns the VM physical address of the translated VM virtual
|
||||
* address given by @gva.
|
||||
*/
|
||||
vm_paddr_t addr_arch_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva);
|
||||
vm_paddr_t addr_arch_gva2gpa(struct kvm_vm *vm, gva_t gva);
|
||||
|
||||
static inline vm_paddr_t addr_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva)
|
||||
static inline vm_paddr_t addr_gva2gpa(struct kvm_vm *vm, gva_t gva)
|
||||
{
|
||||
return addr_arch_gva2gpa(vm, gva);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#define kvm_static_assert(expr, ...) __kvm_static_assert(expr, ##__VA_ARGS__, #expr)
|
||||
|
||||
typedef uint64_t vm_paddr_t; /* Virtual Machine (Guest) physical address */
|
||||
typedef uint64_t vm_vaddr_t; /* Virtual Machine (Guest) virtual address */
|
||||
typedef uint64_t gva_t; /* Virtual Machine (Guest) virtual address */
|
||||
|
||||
#define INVALID_GPA (~(uint64_t)0)
|
||||
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
* ucall_exit_mmio_addr holds per-VM values (global data is duplicated by each
|
||||
* VM), it must not be accessed from host code.
|
||||
*/
|
||||
extern vm_vaddr_t *ucall_exit_mmio_addr;
|
||||
extern gva_t *ucall_exit_mmio_addr;
|
||||
|
||||
static inline void ucall_arch_do_ucall(vm_vaddr_t uc)
|
||||
static inline void ucall_arch_do_ucall(gva_t uc)
|
||||
{
|
||||
WRITE_ONCE(*ucall_exit_mmio_addr, uc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ static inline void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa)
|
|||
{
|
||||
}
|
||||
|
||||
static inline void ucall_arch_do_ucall(vm_vaddr_t uc)
|
||||
static inline void ucall_arch_do_ucall(gva_t uc)
|
||||
{
|
||||
sbi_ecall(KVM_RISCV_SELFTESTS_SBI_EXT,
|
||||
KVM_RISCV_SELFTESTS_SBI_UCALL,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ static inline void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa)
|
|||
{
|
||||
}
|
||||
|
||||
static inline void ucall_arch_do_ucall(vm_vaddr_t uc)
|
||||
static inline void ucall_arch_do_ucall(gva_t uc)
|
||||
{
|
||||
/* Exit via DIAGNOSE 0x501 (normally used for breakpoints) */
|
||||
asm volatile ("diag 0,%0,0x501" : : "a"(uc) : "memory");
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ struct ucall {
|
|||
};
|
||||
|
||||
void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa);
|
||||
void ucall_arch_do_ucall(vm_vaddr_t uc);
|
||||
void ucall_arch_do_ucall(gva_t uc);
|
||||
void *ucall_arch_get_ucall(struct kvm_vcpu *vcpu);
|
||||
|
||||
void ucall(uint64_t cmd, int nargs, ...);
|
||||
|
|
@ -48,7 +48,7 @@ int ucall_nr_pages_required(uint64_t page_size);
|
|||
* the full ucall() are problematic and/or unwanted. Note, this will come out
|
||||
* as UCALL_NONE on the backend.
|
||||
*/
|
||||
#define GUEST_UCALL_NONE() ucall_arch_do_ucall((vm_vaddr_t)NULL)
|
||||
#define GUEST_UCALL_NONE() ucall_arch_do_ucall((gva_t)NULL)
|
||||
|
||||
#define GUEST_SYNC_ARGS(stage, arg1, arg2, arg3, arg4) \
|
||||
ucall(UCALL_SYNC, 6, "hello", stage, arg1, arg2, arg3, arg4)
|
||||
|
|
|
|||
|
|
@ -254,8 +254,8 @@
|
|||
* Issue a Hyper-V hypercall. Returns exception vector raised or 0, 'hv_status'
|
||||
* is set to the hypercall status (if no exception occurred).
|
||||
*/
|
||||
static inline uint8_t __hyperv_hypercall(u64 control, vm_vaddr_t input_address,
|
||||
vm_vaddr_t output_address,
|
||||
static inline uint8_t __hyperv_hypercall(u64 control, gva_t input_address,
|
||||
gva_t output_address,
|
||||
uint64_t *hv_status)
|
||||
{
|
||||
uint64_t error_code;
|
||||
|
|
@ -274,8 +274,8 @@ static inline uint8_t __hyperv_hypercall(u64 control, vm_vaddr_t input_address,
|
|||
}
|
||||
|
||||
/* Issue a Hyper-V hypercall and assert that it succeeded. */
|
||||
static inline void hyperv_hypercall(u64 control, vm_vaddr_t input_address,
|
||||
vm_vaddr_t output_address)
|
||||
static inline void hyperv_hypercall(u64 control, gva_t input_address,
|
||||
gva_t output_address)
|
||||
{
|
||||
uint64_t hv_status;
|
||||
uint8_t vector;
|
||||
|
|
@ -347,7 +347,7 @@ struct hyperv_test_pages {
|
|||
};
|
||||
|
||||
struct hyperv_test_pages *vcpu_alloc_hyperv_test_pages(struct kvm_vm *vm,
|
||||
vm_vaddr_t *p_hv_pages_gva);
|
||||
gva_t *p_hv_pages_gva);
|
||||
|
||||
/* HV_X64_MSR_TSC_INVARIANT_CONTROL bits */
|
||||
#define HV_INVARIANT_TSC_EXPOSED BIT_ULL(0)
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ struct kvm_mmu_arch {
|
|||
struct kvm_mmu;
|
||||
|
||||
struct kvm_vm_arch {
|
||||
vm_vaddr_t gdt;
|
||||
vm_vaddr_t tss;
|
||||
vm_vaddr_t idt;
|
||||
gva_t gdt;
|
||||
gva_t tss;
|
||||
gva_t idt;
|
||||
|
||||
uint64_t c_bit;
|
||||
uint64_t s_bit;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ static inline void vmmcall(void)
|
|||
"clgi\n" \
|
||||
)
|
||||
|
||||
struct svm_test_data *vcpu_alloc_svm(struct kvm_vm *vm, vm_vaddr_t *p_svm_gva);
|
||||
struct svm_test_data *vcpu_alloc_svm(struct kvm_vm *vm, gva_t *p_svm_gva);
|
||||
void generic_svm_setup(struct svm_test_data *svm, void *guest_rip, void *guest_rsp);
|
||||
void run_guest(struct vmcb *vmcb, uint64_t vmcb_gpa);
|
||||
|
||||
|
|
|
|||
|
|
@ -550,7 +550,7 @@ union vmx_ctrl_msr {
|
|||
};
|
||||
};
|
||||
|
||||
struct vmx_pages *vcpu_alloc_vmx(struct kvm_vm *vm, vm_vaddr_t *p_vmx_gva);
|
||||
struct vmx_pages *vcpu_alloc_vmx(struct kvm_vm *vm, gva_t *p_vmx_gva);
|
||||
bool prepare_for_vmx_operation(struct vmx_pages *vmx);
|
||||
void prepare_vmcs(struct vmx_pages *vmx, void *guest_rip, void *guest_rsp);
|
||||
bool load_vmcs(struct vmx_pages *vmx);
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ static struct kvm_vm *pre_init_before_test(enum vm_guest_mode mode, void *arg)
|
|||
ret = sem_init(&test_stage_completed, 0, 0);
|
||||
TEST_ASSERT(ret == 0, "Error in sem_init");
|
||||
|
||||
current_stage = addr_gva2hva(vm, (vm_vaddr_t)(&guest_test_stage));
|
||||
current_stage = addr_gva2hva(vm, (gva_t)(&guest_test_stage));
|
||||
*current_stage = NUM_TEST_STAGES;
|
||||
|
||||
pr_info("Testing guest mode: %s\n", vm_guest_mode_string(mode));
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@
|
|||
|
||||
#define DEFAULT_ARM64_GUEST_STACK_VADDR_MIN 0xac0000
|
||||
|
||||
static vm_vaddr_t exception_handlers;
|
||||
static gva_t exception_handlers;
|
||||
|
||||
static uint64_t pgd_index(struct kvm_vm *vm, vm_vaddr_t gva)
|
||||
static uint64_t pgd_index(struct kvm_vm *vm, gva_t gva)
|
||||
{
|
||||
unsigned int shift = (vm->mmu.pgtable_levels - 1) * (vm->page_shift - 3) + vm->page_shift;
|
||||
uint64_t mask = (1UL << (vm->va_bits - shift)) - 1;
|
||||
|
|
@ -29,7 +29,7 @@ static uint64_t pgd_index(struct kvm_vm *vm, vm_vaddr_t gva)
|
|||
return (gva >> shift) & mask;
|
||||
}
|
||||
|
||||
static uint64_t pud_index(struct kvm_vm *vm, vm_vaddr_t gva)
|
||||
static uint64_t pud_index(struct kvm_vm *vm, gva_t gva)
|
||||
{
|
||||
unsigned int shift = 2 * (vm->page_shift - 3) + vm->page_shift;
|
||||
uint64_t mask = (1UL << (vm->page_shift - 3)) - 1;
|
||||
|
|
@ -40,7 +40,7 @@ static uint64_t pud_index(struct kvm_vm *vm, vm_vaddr_t gva)
|
|||
return (gva >> shift) & mask;
|
||||
}
|
||||
|
||||
static uint64_t pmd_index(struct kvm_vm *vm, vm_vaddr_t gva)
|
||||
static uint64_t pmd_index(struct kvm_vm *vm, gva_t gva)
|
||||
{
|
||||
unsigned int shift = (vm->page_shift - 3) + vm->page_shift;
|
||||
uint64_t mask = (1UL << (vm->page_shift - 3)) - 1;
|
||||
|
|
@ -51,7 +51,7 @@ static uint64_t pmd_index(struct kvm_vm *vm, vm_vaddr_t gva)
|
|||
return (gva >> shift) & mask;
|
||||
}
|
||||
|
||||
static uint64_t pte_index(struct kvm_vm *vm, vm_vaddr_t gva)
|
||||
static uint64_t pte_index(struct kvm_vm *vm, gva_t gva)
|
||||
{
|
||||
uint64_t mask = (1UL << (vm->page_shift - 3)) - 1;
|
||||
return (gva >> vm->page_shift) & mask;
|
||||
|
|
@ -181,7 +181,7 @@ void virt_arch_pg_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr)
|
|||
_virt_pg_map(vm, vaddr, paddr, attr_idx);
|
||||
}
|
||||
|
||||
uint64_t *virt_get_pte_hva_at_level(struct kvm_vm *vm, vm_vaddr_t gva, int level)
|
||||
uint64_t *virt_get_pte_hva_at_level(struct kvm_vm *vm, gva_t gva, int level)
|
||||
{
|
||||
uint64_t *ptep;
|
||||
|
||||
|
|
@ -225,12 +225,12 @@ uint64_t *virt_get_pte_hva_at_level(struct kvm_vm *vm, vm_vaddr_t gva, int level
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
uint64_t *virt_get_pte_hva(struct kvm_vm *vm, vm_vaddr_t gva)
|
||||
uint64_t *virt_get_pte_hva(struct kvm_vm *vm, gva_t gva)
|
||||
{
|
||||
return virt_get_pte_hva_at_level(vm, gva, 3);
|
||||
}
|
||||
|
||||
vm_paddr_t addr_arch_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva)
|
||||
vm_paddr_t addr_arch_gva2gpa(struct kvm_vm *vm, gva_t gva)
|
||||
{
|
||||
uint64_t *ptep = virt_get_pte_hva(vm, gva);
|
||||
|
||||
|
|
@ -539,7 +539,7 @@ void vm_init_descriptor_tables(struct kvm_vm *vm)
|
|||
vm->handlers = __vm_vaddr_alloc(vm, sizeof(struct handlers),
|
||||
vm->page_size, MEM_REGION_DATA);
|
||||
|
||||
*(vm_vaddr_t *)addr_gva2hva(vm, (vm_vaddr_t)(&exception_handlers)) = vm->handlers;
|
||||
*(gva_t *)addr_gva2hva(vm, (gva_t)(&exception_handlers)) = vm->handlers;
|
||||
}
|
||||
|
||||
void vm_install_sync_handler(struct kvm_vm *vm, int vector, int ec,
|
||||
|
|
|
|||
|
|
@ -6,17 +6,17 @@
|
|||
*/
|
||||
#include "kvm_util.h"
|
||||
|
||||
vm_vaddr_t *ucall_exit_mmio_addr;
|
||||
gva_t *ucall_exit_mmio_addr;
|
||||
|
||||
void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa)
|
||||
{
|
||||
vm_vaddr_t mmio_gva = vm_vaddr_unused_gap(vm, vm->page_size, KVM_UTIL_MIN_VADDR);
|
||||
gva_t mmio_gva = vm_vaddr_unused_gap(vm, vm->page_size, KVM_UTIL_MIN_VADDR);
|
||||
|
||||
virt_map(vm, mmio_gva, mmio_gpa, 1);
|
||||
|
||||
vm->ucall_mmio_addr = mmio_gpa;
|
||||
|
||||
write_guest_global(vm, ucall_exit_mmio_addr, (vm_vaddr_t *)mmio_gva);
|
||||
write_guest_global(vm, ucall_exit_mmio_addr, (gva_t *)mmio_gva);
|
||||
}
|
||||
|
||||
void *ucall_arch_get_ucall(struct kvm_vcpu *vcpu)
|
||||
|
|
|
|||
|
|
@ -157,12 +157,12 @@ void kvm_vm_elf_load(struct kvm_vm *vm, const char *filename)
|
|||
"memsize of 0,\n"
|
||||
" phdr index: %u p_memsz: 0x%" PRIx64,
|
||||
n1, (uint64_t) phdr.p_memsz);
|
||||
vm_vaddr_t seg_vstart = align_down(phdr.p_vaddr, vm->page_size);
|
||||
vm_vaddr_t seg_vend = phdr.p_vaddr + phdr.p_memsz - 1;
|
||||
gva_t seg_vstart = align_down(phdr.p_vaddr, vm->page_size);
|
||||
gva_t seg_vend = phdr.p_vaddr + phdr.p_memsz - 1;
|
||||
seg_vend |= vm->page_size - 1;
|
||||
size_t seg_size = seg_vend - seg_vstart + 1;
|
||||
|
||||
vm_vaddr_t vaddr = __vm_vaddr_alloc(vm, seg_size, seg_vstart,
|
||||
gva_t vaddr = __vm_vaddr_alloc(vm, seg_size, seg_vstart,
|
||||
MEM_REGION_CODE);
|
||||
TEST_ASSERT(vaddr == seg_vstart, "Unable to allocate "
|
||||
"virtual memory for segment at requested min addr,\n"
|
||||
|
|
|
|||
|
|
@ -1386,8 +1386,7 @@ struct kvm_vcpu *__vm_vcpu_add(struct kvm_vm *vm, uint32_t vcpu_id)
|
|||
* TEST_ASSERT failure occurs for invalid input or no area of at least
|
||||
* sz unallocated bytes >= vaddr_min is available.
|
||||
*/
|
||||
vm_vaddr_t vm_vaddr_unused_gap(struct kvm_vm *vm, size_t sz,
|
||||
vm_vaddr_t vaddr_min)
|
||||
gva_t vm_vaddr_unused_gap(struct kvm_vm *vm, size_t sz, gva_t vaddr_min)
|
||||
{
|
||||
uint64_t pages = (sz + vm->page_size - 1) >> vm->page_shift;
|
||||
|
||||
|
|
@ -1452,10 +1451,8 @@ vm_vaddr_t vm_vaddr_unused_gap(struct kvm_vm *vm, size_t sz,
|
|||
return pgidx_start * vm->page_size;
|
||||
}
|
||||
|
||||
static vm_vaddr_t ____vm_vaddr_alloc(struct kvm_vm *vm, size_t sz,
|
||||
vm_vaddr_t vaddr_min,
|
||||
enum kvm_mem_region_type type,
|
||||
bool protected)
|
||||
static gva_t ____vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, gva_t vaddr_min,
|
||||
enum kvm_mem_region_type type, bool protected)
|
||||
{
|
||||
uint64_t pages = (sz >> vm->page_shift) + ((sz % vm->page_size) != 0);
|
||||
|
||||
|
|
@ -1468,10 +1465,10 @@ static vm_vaddr_t ____vm_vaddr_alloc(struct kvm_vm *vm, size_t sz,
|
|||
* Find an unused range of virtual page addresses of at least
|
||||
* pages in length.
|
||||
*/
|
||||
vm_vaddr_t vaddr_start = vm_vaddr_unused_gap(vm, sz, vaddr_min);
|
||||
gva_t vaddr_start = vm_vaddr_unused_gap(vm, sz, vaddr_min);
|
||||
|
||||
/* Map the virtual pages. */
|
||||
for (vm_vaddr_t vaddr = vaddr_start; pages > 0;
|
||||
for (gva_t vaddr = vaddr_start; pages > 0;
|
||||
pages--, vaddr += vm->page_size, paddr += vm->page_size) {
|
||||
|
||||
virt_pg_map(vm, vaddr, paddr);
|
||||
|
|
@ -1480,16 +1477,15 @@ static vm_vaddr_t ____vm_vaddr_alloc(struct kvm_vm *vm, size_t sz,
|
|||
return vaddr_start;
|
||||
}
|
||||
|
||||
vm_vaddr_t __vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min,
|
||||
enum kvm_mem_region_type type)
|
||||
gva_t __vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, gva_t vaddr_min,
|
||||
enum kvm_mem_region_type type)
|
||||
{
|
||||
return ____vm_vaddr_alloc(vm, sz, vaddr_min, type,
|
||||
vm_arch_has_protected_memory(vm));
|
||||
}
|
||||
|
||||
vm_vaddr_t vm_vaddr_alloc_shared(struct kvm_vm *vm, size_t sz,
|
||||
vm_vaddr_t vaddr_min,
|
||||
enum kvm_mem_region_type type)
|
||||
gva_t vm_vaddr_alloc_shared(struct kvm_vm *vm, size_t sz, gva_t vaddr_min,
|
||||
enum kvm_mem_region_type type)
|
||||
{
|
||||
return ____vm_vaddr_alloc(vm, sz, vaddr_min, type, false);
|
||||
}
|
||||
|
|
@ -1513,7 +1509,7 @@ vm_vaddr_t vm_vaddr_alloc_shared(struct kvm_vm *vm, size_t sz,
|
|||
* a unique set of pages, with the minimum real allocation being at least
|
||||
* a page. The allocated physical space comes from the TEST_DATA memory region.
|
||||
*/
|
||||
vm_vaddr_t vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min)
|
||||
gva_t vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, gva_t vaddr_min)
|
||||
{
|
||||
return __vm_vaddr_alloc(vm, sz, vaddr_min, MEM_REGION_TEST_DATA);
|
||||
}
|
||||
|
|
@ -1532,12 +1528,12 @@ vm_vaddr_t vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min)
|
|||
* Allocates at least N system pages worth of bytes within the virtual address
|
||||
* space of the vm.
|
||||
*/
|
||||
vm_vaddr_t vm_vaddr_alloc_pages(struct kvm_vm *vm, int nr_pages)
|
||||
gva_t vm_vaddr_alloc_pages(struct kvm_vm *vm, int nr_pages)
|
||||
{
|
||||
return vm_vaddr_alloc(vm, nr_pages * getpagesize(), KVM_UTIL_MIN_VADDR);
|
||||
}
|
||||
|
||||
vm_vaddr_t __vm_vaddr_alloc_page(struct kvm_vm *vm, enum kvm_mem_region_type type)
|
||||
gva_t __vm_vaddr_alloc_page(struct kvm_vm *vm, enum kvm_mem_region_type type)
|
||||
{
|
||||
return __vm_vaddr_alloc(vm, getpagesize(), KVM_UTIL_MIN_VADDR, type);
|
||||
}
|
||||
|
|
@ -1556,7 +1552,7 @@ vm_vaddr_t __vm_vaddr_alloc_page(struct kvm_vm *vm, enum kvm_mem_region_type typ
|
|||
* Allocates at least one system page worth of bytes within the virtual address
|
||||
* space of the vm.
|
||||
*/
|
||||
vm_vaddr_t vm_vaddr_alloc_page(struct kvm_vm *vm)
|
||||
gva_t vm_vaddr_alloc_page(struct kvm_vm *vm)
|
||||
{
|
||||
return vm_vaddr_alloc_pages(vm, 1);
|
||||
}
|
||||
|
|
@ -2161,7 +2157,7 @@ vm_paddr_t vm_alloc_page_table(struct kvm_vm *vm)
|
|||
* Return:
|
||||
* Equivalent host virtual address
|
||||
*/
|
||||
void *addr_gva2hva(struct kvm_vm *vm, vm_vaddr_t gva)
|
||||
void *addr_gva2hva(struct kvm_vm *vm, gva_t gva)
|
||||
{
|
||||
return addr_gpa2hva(vm, addr_gva2gpa(vm, gva));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@
|
|||
#define LOONGARCH_GUEST_STACK_VADDR_MIN 0x200000
|
||||
|
||||
static vm_paddr_t invalid_pgtable[4];
|
||||
static vm_vaddr_t exception_handlers;
|
||||
static gva_t exception_handlers;
|
||||
|
||||
static uint64_t virt_pte_index(struct kvm_vm *vm, vm_vaddr_t gva, int level)
|
||||
static uint64_t virt_pte_index(struct kvm_vm *vm, gva_t gva, int level)
|
||||
{
|
||||
unsigned int shift;
|
||||
uint64_t mask;
|
||||
|
|
@ -72,7 +72,7 @@ static int virt_pte_none(uint64_t *ptep, int level)
|
|||
return *ptep == invalid_pgtable[level];
|
||||
}
|
||||
|
||||
static uint64_t *virt_populate_pte(struct kvm_vm *vm, vm_vaddr_t gva, int alloc)
|
||||
static uint64_t *virt_populate_pte(struct kvm_vm *vm, gva_t gva, int alloc)
|
||||
{
|
||||
int level;
|
||||
uint64_t *ptep;
|
||||
|
|
@ -106,7 +106,7 @@ static uint64_t *virt_populate_pte(struct kvm_vm *vm, vm_vaddr_t gva, int alloc)
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
vm_paddr_t addr_arch_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva)
|
||||
vm_paddr_t addr_arch_gva2gpa(struct kvm_vm *vm, gva_t gva)
|
||||
{
|
||||
uint64_t *ptep;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,17 +9,17 @@
|
|||
* ucall_exit_mmio_addr holds per-VM values (global data is duplicated by each
|
||||
* VM), it must not be accessed from host code.
|
||||
*/
|
||||
vm_vaddr_t *ucall_exit_mmio_addr;
|
||||
gva_t *ucall_exit_mmio_addr;
|
||||
|
||||
void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa)
|
||||
{
|
||||
vm_vaddr_t mmio_gva = vm_vaddr_unused_gap(vm, vm->page_size, KVM_UTIL_MIN_VADDR);
|
||||
gva_t mmio_gva = vm_vaddr_unused_gap(vm, vm->page_size, KVM_UTIL_MIN_VADDR);
|
||||
|
||||
virt_map(vm, mmio_gva, mmio_gpa, 1);
|
||||
|
||||
vm->ucall_mmio_addr = mmio_gpa;
|
||||
|
||||
write_guest_global(vm, ucall_exit_mmio_addr, (vm_vaddr_t *)mmio_gva);
|
||||
write_guest_global(vm, ucall_exit_mmio_addr, (gva_t *)mmio_gva);
|
||||
}
|
||||
|
||||
void *ucall_arch_get_ucall(struct kvm_vcpu *vcpu)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#define DEFAULT_RISCV_GUEST_STACK_VADDR_MIN 0xac0000
|
||||
|
||||
static vm_vaddr_t exception_handlers;
|
||||
static gva_t exception_handlers;
|
||||
|
||||
bool __vcpu_has_ext(struct kvm_vcpu *vcpu, uint64_t ext)
|
||||
{
|
||||
|
|
@ -52,7 +52,7 @@ static uint32_t pte_index_shift[] = {
|
|||
PGTBL_L3_INDEX_SHIFT,
|
||||
};
|
||||
|
||||
static uint64_t pte_index(struct kvm_vm *vm, vm_vaddr_t gva, int level)
|
||||
static uint64_t pte_index(struct kvm_vm *vm, gva_t gva, int level)
|
||||
{
|
||||
TEST_ASSERT(level > -1,
|
||||
"Negative page table level (%d) not possible", level);
|
||||
|
|
@ -119,7 +119,7 @@ void virt_arch_pg_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr)
|
|||
PGTBL_PTE_PERM_MASK | PGTBL_PTE_VALID_MASK;
|
||||
}
|
||||
|
||||
vm_paddr_t addr_arch_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva)
|
||||
vm_paddr_t addr_arch_gva2gpa(struct kvm_vm *vm, gva_t gva)
|
||||
{
|
||||
uint64_t *ptep;
|
||||
int level = vm->mmu.pgtable_levels - 1;
|
||||
|
|
@ -452,7 +452,7 @@ void vm_init_vector_tables(struct kvm_vm *vm)
|
|||
vm->handlers = __vm_vaddr_alloc(vm, sizeof(struct handlers),
|
||||
vm->page_size, MEM_REGION_DATA);
|
||||
|
||||
*(vm_vaddr_t *)addr_gva2hva(vm, (vm_vaddr_t)(&exception_handlers)) = vm->handlers;
|
||||
*(gva_t *)addr_gva2hva(vm, (gva_t)(&exception_handlers)) = vm->handlers;
|
||||
}
|
||||
|
||||
void vm_install_exception_handler(struct kvm_vm *vm, int vector, exception_handler_fn handler)
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ void virt_arch_pg_map(struct kvm_vm *vm, uint64_t gva, uint64_t gpa)
|
|||
entry[idx] = gpa;
|
||||
}
|
||||
|
||||
vm_paddr_t addr_arch_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva)
|
||||
vm_paddr_t addr_arch_gva2gpa(struct kvm_vm *vm, gva_t gva)
|
||||
{
|
||||
int ri, idx;
|
||||
uint64_t *entry;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ void ucall_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa)
|
|||
{
|
||||
struct ucall_header *hdr;
|
||||
struct ucall *uc;
|
||||
vm_vaddr_t vaddr;
|
||||
gva_t vaddr;
|
||||
int i;
|
||||
|
||||
vaddr = vm_vaddr_alloc_shared(vm, sizeof(*hdr), KVM_UTIL_MIN_VADDR,
|
||||
|
|
@ -96,7 +96,7 @@ void ucall_assert(uint64_t cmd, const char *exp, const char *file,
|
|||
guest_vsnprintf(uc->buffer, UCALL_BUFFER_LEN, fmt, va);
|
||||
va_end(va);
|
||||
|
||||
ucall_arch_do_ucall((vm_vaddr_t)uc->hva);
|
||||
ucall_arch_do_ucall((gva_t)uc->hva);
|
||||
|
||||
ucall_free(uc);
|
||||
}
|
||||
|
|
@ -113,7 +113,7 @@ void ucall_fmt(uint64_t cmd, const char *fmt, ...)
|
|||
guest_vsnprintf(uc->buffer, UCALL_BUFFER_LEN, fmt, va);
|
||||
va_end(va);
|
||||
|
||||
ucall_arch_do_ucall((vm_vaddr_t)uc->hva);
|
||||
ucall_arch_do_ucall((gva_t)uc->hva);
|
||||
|
||||
ucall_free(uc);
|
||||
}
|
||||
|
|
@ -135,7 +135,7 @@ void ucall(uint64_t cmd, int nargs, ...)
|
|||
WRITE_ONCE(uc->args[i], va_arg(va, uint64_t));
|
||||
va_end(va);
|
||||
|
||||
ucall_arch_do_ucall((vm_vaddr_t)uc->hva);
|
||||
ucall_arch_do_ucall((gva_t)uc->hva);
|
||||
|
||||
ucall_free(uc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,9 +76,9 @@ bool kvm_hv_cpu_has(struct kvm_x86_cpu_feature feature)
|
|||
}
|
||||
|
||||
struct hyperv_test_pages *vcpu_alloc_hyperv_test_pages(struct kvm_vm *vm,
|
||||
vm_vaddr_t *p_hv_pages_gva)
|
||||
gva_t *p_hv_pages_gva)
|
||||
{
|
||||
vm_vaddr_t hv_pages_gva = vm_vaddr_alloc_page(vm);
|
||||
gva_t hv_pages_gva = vm_vaddr_alloc_page(vm);
|
||||
struct hyperv_test_pages *hv = addr_gva2hva(vm, hv_pages_gva);
|
||||
|
||||
/* Setup of a region of guest memory for the VP Assist page. */
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ static void memstress_setup_ept_mappings(struct kvm_vm *vm)
|
|||
void memstress_setup_nested(struct kvm_vm *vm, int nr_vcpus, struct kvm_vcpu *vcpus[])
|
||||
{
|
||||
struct kvm_regs regs;
|
||||
vm_vaddr_t nested_gva;
|
||||
gva_t nested_gva;
|
||||
int vcpu_id;
|
||||
|
||||
TEST_REQUIRE(kvm_cpu_has_tdp());
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define KERNEL_DS 0x10
|
||||
#define KERNEL_TSS 0x18
|
||||
|
||||
vm_vaddr_t exception_handlers;
|
||||
gva_t exception_handlers;
|
||||
bool host_cpu_is_amd;
|
||||
bool host_cpu_is_intel;
|
||||
bool host_cpu_is_hygon;
|
||||
|
|
@ -618,7 +618,7 @@ static void kvm_seg_set_kernel_data_64bit(struct kvm_segment *segp)
|
|||
segp->present = true;
|
||||
}
|
||||
|
||||
vm_paddr_t addr_arch_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva)
|
||||
vm_paddr_t addr_arch_gva2gpa(struct kvm_vm *vm, gva_t gva)
|
||||
{
|
||||
int level = PG_LEVEL_NONE;
|
||||
uint64_t *pte = __vm_get_page_table_entry(vm, &vm->mmu, gva, &level);
|
||||
|
|
@ -633,7 +633,7 @@ vm_paddr_t addr_arch_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva)
|
|||
return vm_untag_gpa(vm, PTE_GET_PA(*pte)) | (gva & ~HUGEPAGE_MASK(level));
|
||||
}
|
||||
|
||||
static void kvm_seg_set_tss_64bit(vm_vaddr_t base, struct kvm_segment *segp)
|
||||
static void kvm_seg_set_tss_64bit(gva_t base, struct kvm_segment *segp)
|
||||
{
|
||||
memset(segp, 0, sizeof(*segp));
|
||||
segp->base = base;
|
||||
|
|
@ -755,7 +755,7 @@ static void vm_init_descriptor_tables(struct kvm_vm *vm)
|
|||
for (i = 0; i < NUM_INTERRUPTS; i++)
|
||||
set_idt_entry(vm, i, (unsigned long)(&idt_handlers)[i], 0, KERNEL_CS);
|
||||
|
||||
*(vm_vaddr_t *)addr_gva2hva(vm, (vm_vaddr_t)(&exception_handlers)) = vm->handlers;
|
||||
*(gva_t *)addr_gva2hva(vm, (gva_t)(&exception_handlers)) = vm->handlers;
|
||||
|
||||
kvm_seg_set_kernel_code_64bit(&seg);
|
||||
kvm_seg_fill_gdt_64bit(vm, &seg);
|
||||
|
|
@ -770,9 +770,9 @@ static void vm_init_descriptor_tables(struct kvm_vm *vm)
|
|||
void vm_install_exception_handler(struct kvm_vm *vm, int vector,
|
||||
void (*handler)(struct ex_regs *))
|
||||
{
|
||||
vm_vaddr_t *handlers = (vm_vaddr_t *)addr_gva2hva(vm, vm->handlers);
|
||||
gva_t *handlers = (gva_t *)addr_gva2hva(vm, vm->handlers);
|
||||
|
||||
handlers[vector] = (vm_vaddr_t)handler;
|
||||
handlers[vector] = (gva_t)handler;
|
||||
}
|
||||
|
||||
void assert_on_unhandled_exception(struct kvm_vcpu *vcpu)
|
||||
|
|
@ -825,7 +825,7 @@ struct kvm_vcpu *vm_arch_vcpu_add(struct kvm_vm *vm, uint32_t vcpu_id)
|
|||
{
|
||||
struct kvm_mp_state mp_state;
|
||||
struct kvm_regs regs;
|
||||
vm_vaddr_t stack_vaddr;
|
||||
gva_t stack_vaddr;
|
||||
struct kvm_vcpu *vcpu;
|
||||
|
||||
stack_vaddr = __vm_vaddr_alloc(vm, DEFAULT_STACK_PGS * getpagesize(),
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ u64 rflags;
|
|||
* Pointer to structure with the addresses of the SVM areas.
|
||||
*/
|
||||
struct svm_test_data *
|
||||
vcpu_alloc_svm(struct kvm_vm *vm, vm_vaddr_t *p_svm_gva)
|
||||
vcpu_alloc_svm(struct kvm_vm *vm, gva_t *p_svm_gva)
|
||||
{
|
||||
vm_vaddr_t svm_gva = vm_vaddr_alloc_page(vm);
|
||||
gva_t svm_gva = vm_vaddr_alloc_page(vm);
|
||||
struct svm_test_data *svm = addr_gva2hva(vm, svm_gva);
|
||||
|
||||
svm->vmcb = (void *)vm_vaddr_alloc_page(vm);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#define UCALL_PIO_PORT ((uint16_t)0x1000)
|
||||
|
||||
void ucall_arch_do_ucall(vm_vaddr_t uc)
|
||||
void ucall_arch_do_ucall(gva_t uc)
|
||||
{
|
||||
/*
|
||||
* FIXME: Revert this hack (the entire commit that added it) once nVMX
|
||||
|
|
|
|||
|
|
@ -79,9 +79,9 @@ void vm_enable_ept(struct kvm_vm *vm)
|
|||
* Pointer to structure with the addresses of the VMX areas.
|
||||
*/
|
||||
struct vmx_pages *
|
||||
vcpu_alloc_vmx(struct kvm_vm *vm, vm_vaddr_t *p_vmx_gva)
|
||||
vcpu_alloc_vmx(struct kvm_vm *vm, gva_t *p_vmx_gva)
|
||||
{
|
||||
vm_vaddr_t vmx_gva = vm_vaddr_alloc_page(vm);
|
||||
gva_t vmx_gva = vm_vaddr_alloc_page(vm);
|
||||
struct vmx_pages *vmx = addr_gva2hva(vm, vmx_gva);
|
||||
|
||||
/* Setup of a region of guest memory for the vmxon region. */
|
||||
|
|
|
|||
|
|
@ -610,7 +610,7 @@ static void test_vm_setup_snapshot_mem(struct kvm_vm *vm, struct kvm_vcpu *vcpu)
|
|||
virt_map(vm, PMU_SNAPSHOT_GPA_BASE, PMU_SNAPSHOT_GPA_BASE, 1);
|
||||
|
||||
snapshot_gva = (void *)(PMU_SNAPSHOT_GPA_BASE);
|
||||
snapshot_gpa = addr_gva2gpa(vcpu->vm, (vm_vaddr_t)snapshot_gva);
|
||||
snapshot_gpa = addr_gva2gpa(vcpu->vm, (gva_t)snapshot_gva);
|
||||
sync_global_to_guest(vcpu->vm, snapshot_gva);
|
||||
sync_global_to_guest(vcpu->vm, snapshot_gpa);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -878,7 +878,7 @@ static void guest_copy_key_fetch_prot_override(void)
|
|||
static void test_copy_key_fetch_prot_override(void)
|
||||
{
|
||||
struct test_default t = test_default_init(guest_copy_key_fetch_prot_override);
|
||||
vm_vaddr_t guest_0_page, guest_last_page;
|
||||
gva_t guest_0_page, guest_last_page;
|
||||
|
||||
guest_0_page = vm_vaddr_alloc(t.kvm_vm, PAGE_SIZE, 0);
|
||||
guest_last_page = vm_vaddr_alloc(t.kvm_vm, PAGE_SIZE, last_page_addr);
|
||||
|
|
@ -917,7 +917,7 @@ static void test_copy_key_fetch_prot_override(void)
|
|||
static void test_errors_key_fetch_prot_override_not_enabled(void)
|
||||
{
|
||||
struct test_default t = test_default_init(guest_copy_key_fetch_prot_override);
|
||||
vm_vaddr_t guest_0_page, guest_last_page;
|
||||
gva_t guest_0_page, guest_last_page;
|
||||
|
||||
guest_0_page = vm_vaddr_alloc(t.kvm_vm, PAGE_SIZE, 0);
|
||||
guest_last_page = vm_vaddr_alloc(t.kvm_vm, PAGE_SIZE, last_page_addr);
|
||||
|
|
@ -938,7 +938,7 @@ static void test_errors_key_fetch_prot_override_not_enabled(void)
|
|||
static void test_errors_key_fetch_prot_override_enabled(void)
|
||||
{
|
||||
struct test_default t = test_default_init(guest_copy_key_fetch_prot_override);
|
||||
vm_vaddr_t guest_0_page, guest_last_page;
|
||||
gva_t guest_0_page, guest_last_page;
|
||||
|
||||
guest_0_page = vm_vaddr_alloc(t.kvm_vm, PAGE_SIZE, 0);
|
||||
guest_last_page = vm_vaddr_alloc(t.kvm_vm, PAGE_SIZE, last_page_addr);
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ int main(int argc, char *argv[])
|
|||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
struct kvm_run *run;
|
||||
vm_vaddr_t guest_0_page;
|
||||
gva_t guest_0_page;
|
||||
|
||||
ksft_print_header();
|
||||
ksft_set_plan(STAGE_END);
|
||||
|
|
@ -216,7 +216,7 @@ int main(int argc, char *argv[])
|
|||
run = vcpu->run;
|
||||
|
||||
HOST_SYNC(vcpu, STAGE_INIT_SIMPLE);
|
||||
mprotect(addr_gva2hva(vm, (vm_vaddr_t)pages), PAGE_SIZE * 2, PROT_READ);
|
||||
mprotect(addr_gva2hva(vm, (gva_t)pages), PAGE_SIZE * 2, PROT_READ);
|
||||
HOST_SYNC(vcpu, TEST_SIMPLE);
|
||||
|
||||
guest_0_page = vm_vaddr_alloc(vm, PAGE_SIZE, 0);
|
||||
|
|
@ -229,7 +229,7 @@ int main(int argc, char *argv[])
|
|||
HOST_SYNC(vcpu, STAGE_INIT_FETCH_PROT_OVERRIDE);
|
||||
}
|
||||
if (guest_0_page == 0)
|
||||
mprotect(addr_gva2hva(vm, (vm_vaddr_t)0), PAGE_SIZE, PROT_READ);
|
||||
mprotect(addr_gva2hva(vm, (gva_t)0), PAGE_SIZE, PROT_READ);
|
||||
run->s.regs.crs[0] |= CR0_FETCH_PROTECTION_OVERRIDE;
|
||||
run->kvm_dirty_regs = KVM_SYNC_CRS;
|
||||
HOST_SYNC(vcpu, TEST_FETCH_PROT_OVERRIDE);
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ static void steal_time_init(struct kvm_vcpu *vcpu, uint32_t i)
|
|||
{
|
||||
/* ST_GPA_BASE is identity mapped */
|
||||
st_gva[i] = (void *)(ST_GPA_BASE + i * STEAL_TIME_SIZE);
|
||||
st_gpa[i] = addr_gva2gpa(vcpu->vm, (vm_vaddr_t)st_gva[i]);
|
||||
st_gpa[i] = addr_gva2gpa(vcpu->vm, (gva_t)st_gva[i]);
|
||||
sync_global_to_guest(vcpu->vm, st_gva[i]);
|
||||
sync_global_to_guest(vcpu->vm, st_gpa[i]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ int main(int argc, char *argv[])
|
|||
struct kvm_x86_state *state;
|
||||
struct kvm_x86_state *tile_state = NULL;
|
||||
int xsave_restore_size;
|
||||
vm_vaddr_t amx_cfg, tiledata, xstate;
|
||||
gva_t amx_cfg, tiledata, xstate;
|
||||
struct ucall uc;
|
||||
int ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
const bool has_nested = kvm_cpu_has(X86_FEATURE_SVM) || kvm_cpu_has(X86_FEATURE_VMX);
|
||||
uint64_t host_aperf_before, host_mperf_before;
|
||||
vm_vaddr_t nested_test_data_gva;
|
||||
gva_t nested_test_data_gva;
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
int msr_fd, cpu, i;
|
||||
|
|
|
|||
|
|
@ -140,10 +140,10 @@ static void run_vcpu(struct kvm_vcpu *vcpu, int stage)
|
|||
}
|
||||
}
|
||||
|
||||
struct kvm_cpuid2 *vcpu_alloc_cpuid(struct kvm_vm *vm, vm_vaddr_t *p_gva, struct kvm_cpuid2 *cpuid)
|
||||
struct kvm_cpuid2 *vcpu_alloc_cpuid(struct kvm_vm *vm, gva_t *p_gva, struct kvm_cpuid2 *cpuid)
|
||||
{
|
||||
int size = sizeof(*cpuid) + cpuid->nent * sizeof(cpuid->entries[0]);
|
||||
vm_vaddr_t gva = vm_vaddr_alloc(vm, size, KVM_UTIL_MIN_VADDR);
|
||||
gva_t gva = vm_vaddr_alloc(vm, size, KVM_UTIL_MIN_VADDR);
|
||||
struct kvm_cpuid2 *guest_cpuids = addr_gva2hva(vm, gva);
|
||||
|
||||
memcpy(guest_cpuids, cpuid, size);
|
||||
|
|
@ -217,7 +217,7 @@ static void test_get_cpuid2(struct kvm_vcpu *vcpu)
|
|||
int main(void)
|
||||
{
|
||||
struct kvm_vcpu *vcpu;
|
||||
vm_vaddr_t cpuid_gva;
|
||||
gva_t cpuid_gva;
|
||||
struct kvm_vm *vm;
|
||||
int stage;
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ static void guest_code(struct vmx_pages *vmx_pages,
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
vm_vaddr_t vmx_pages_gva = 0, hv_pages_gva = 0;
|
||||
gva_t vmx_pages_gva = 0, hv_pages_gva = 0;
|
||||
struct hyperv_test_pages *hv;
|
||||
struct hv_enlightened_vmcs *evmcs;
|
||||
struct kvm_vcpu *vcpu;
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ int main(void)
|
|||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
struct ucall uc;
|
||||
vm_vaddr_t tsc_page_gva;
|
||||
gva_t tsc_page_gva;
|
||||
int stage;
|
||||
|
||||
TEST_REQUIRE(kvm_has_cap(KVM_CAP_HYPERV_TIME));
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ void l2_guest_code(void)
|
|||
}
|
||||
|
||||
void guest_code(struct vmx_pages *vmx_pages, struct hyperv_test_pages *hv_pages,
|
||||
vm_vaddr_t hv_hcall_page_gpa)
|
||||
gva_t hv_hcall_page_gpa)
|
||||
{
|
||||
#define L2_GUEST_STACK_SIZE 64
|
||||
unsigned long l2_guest_stack[L2_GUEST_STACK_SIZE];
|
||||
|
|
@ -231,8 +231,8 @@ static struct kvm_vcpu *save_restore_vm(struct kvm_vm *vm,
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
vm_vaddr_t vmx_pages_gva = 0, hv_pages_gva = 0;
|
||||
vm_vaddr_t hcall_page;
|
||||
gva_t vmx_pages_gva = 0, hv_pages_gva = 0;
|
||||
gva_t hcall_page;
|
||||
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#define EXT_CAPABILITIES 0xbull
|
||||
|
||||
static void guest_code(vm_paddr_t in_pg_gpa, vm_paddr_t out_pg_gpa,
|
||||
vm_vaddr_t out_pg_gva)
|
||||
gva_t out_pg_gva)
|
||||
{
|
||||
uint64_t *output_gva;
|
||||
|
||||
|
|
@ -35,8 +35,8 @@ static void guest_code(vm_paddr_t in_pg_gpa, vm_paddr_t out_pg_gpa,
|
|||
|
||||
int main(void)
|
||||
{
|
||||
vm_vaddr_t hcall_out_page;
|
||||
vm_vaddr_t hcall_in_page;
|
||||
gva_t hcall_out_page;
|
||||
gva_t hcall_in_page;
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_run *run;
|
||||
struct kvm_vm *vm;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ static void guest_msr(struct msr_data *msr)
|
|||
GUEST_DONE();
|
||||
}
|
||||
|
||||
static void guest_hcall(vm_vaddr_t pgs_gpa, struct hcall_data *hcall)
|
||||
static void guest_hcall(gva_t pgs_gpa, struct hcall_data *hcall)
|
||||
{
|
||||
u64 res, input, output;
|
||||
uint8_t vector;
|
||||
|
|
@ -134,7 +134,7 @@ static void guest_test_msrs_access(void)
|
|||
struct kvm_vm *vm;
|
||||
struct ucall uc;
|
||||
int stage = 0;
|
||||
vm_vaddr_t msr_gva;
|
||||
gva_t msr_gva;
|
||||
struct msr_data *msr;
|
||||
bool has_invtsc = kvm_cpu_has(X86_FEATURE_INVTSC);
|
||||
|
||||
|
|
@ -523,7 +523,7 @@ static void guest_test_hcalls_access(void)
|
|||
struct kvm_vm *vm;
|
||||
struct ucall uc;
|
||||
int stage = 0;
|
||||
vm_vaddr_t hcall_page, hcall_params;
|
||||
gva_t hcall_page, hcall_params;
|
||||
struct hcall_data *hcall;
|
||||
|
||||
while (true) {
|
||||
|
|
|
|||
|
|
@ -45,13 +45,13 @@ struct hv_send_ipi_ex {
|
|||
struct hv_vpset vp_set;
|
||||
};
|
||||
|
||||
static inline void hv_init(vm_vaddr_t pgs_gpa)
|
||||
static inline void hv_init(gva_t pgs_gpa)
|
||||
{
|
||||
wrmsr(HV_X64_MSR_GUEST_OS_ID, HYPERV_LINUX_OS_ID);
|
||||
wrmsr(HV_X64_MSR_HYPERCALL, pgs_gpa);
|
||||
}
|
||||
|
||||
static void receiver_code(void *hcall_page, vm_vaddr_t pgs_gpa)
|
||||
static void receiver_code(void *hcall_page, gva_t pgs_gpa)
|
||||
{
|
||||
u32 vcpu_id;
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ static inline void nop_loop(void)
|
|||
asm volatile("nop");
|
||||
}
|
||||
|
||||
static void sender_guest_code(void *hcall_page, vm_vaddr_t pgs_gpa)
|
||||
static void sender_guest_code(void *hcall_page, gva_t pgs_gpa)
|
||||
{
|
||||
struct hv_send_ipi *ipi = (struct hv_send_ipi *)hcall_page;
|
||||
struct hv_send_ipi_ex *ipi_ex = (struct hv_send_ipi_ex *)hcall_page;
|
||||
|
|
@ -243,7 +243,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
struct kvm_vm *vm;
|
||||
struct kvm_vcpu *vcpu[3];
|
||||
vm_vaddr_t hcall_page;
|
||||
gva_t hcall_page;
|
||||
pthread_t threads[2];
|
||||
int stage = 1, r;
|
||||
struct ucall uc;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ void l2_guest_code(void)
|
|||
|
||||
static void __attribute__((__flatten__)) guest_code(struct svm_test_data *svm,
|
||||
struct hyperv_test_pages *hv_pages,
|
||||
vm_vaddr_t pgs_gpa)
|
||||
gva_t pgs_gpa)
|
||||
{
|
||||
unsigned long l2_guest_stack[L2_GUEST_STACK_SIZE];
|
||||
struct vmcb *vmcb = svm->vmcb;
|
||||
|
|
@ -149,8 +149,8 @@ static void __attribute__((__flatten__)) guest_code(struct svm_test_data *svm,
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
vm_vaddr_t nested_gva = 0, hv_pages_gva = 0;
|
||||
vm_vaddr_t hcall_page;
|
||||
gva_t nested_gva = 0, hv_pages_gva = 0;
|
||||
gva_t hcall_page;
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
struct ucall uc;
|
||||
|
|
|
|||
|
|
@ -61,14 +61,14 @@ struct hv_tlb_flush_ex {
|
|||
* - GVAs of the test pages' PTEs
|
||||
*/
|
||||
struct test_data {
|
||||
vm_vaddr_t hcall_gva;
|
||||
gva_t hcall_gva;
|
||||
vm_paddr_t hcall_gpa;
|
||||
vm_vaddr_t test_pages;
|
||||
vm_vaddr_t test_pages_pte[NTEST_PAGES];
|
||||
gva_t test_pages;
|
||||
gva_t test_pages_pte[NTEST_PAGES];
|
||||
};
|
||||
|
||||
/* 'Worker' vCPU code checking the contents of the test page */
|
||||
static void worker_guest_code(vm_vaddr_t test_data)
|
||||
static void worker_guest_code(gva_t test_data)
|
||||
{
|
||||
struct test_data *data = (struct test_data *)test_data;
|
||||
u32 vcpu_id = rdmsr(HV_X64_MSR_VP_INDEX);
|
||||
|
|
@ -196,7 +196,7 @@ static inline void post_test(struct test_data *data, u64 exp1, u64 exp2)
|
|||
#define TESTVAL2 0x0202020202020202
|
||||
|
||||
/* Main vCPU doing the test */
|
||||
static void sender_guest_code(vm_vaddr_t test_data)
|
||||
static void sender_guest_code(gva_t test_data)
|
||||
{
|
||||
struct test_data *data = (struct test_data *)test_data;
|
||||
struct hv_tlb_flush *flush = (struct hv_tlb_flush *)data->hcall_gva;
|
||||
|
|
@ -581,7 +581,7 @@ int main(int argc, char *argv[])
|
|||
struct kvm_vm *vm;
|
||||
struct kvm_vcpu *vcpu[3];
|
||||
pthread_t threads[2];
|
||||
vm_vaddr_t test_data_page, gva;
|
||||
gva_t test_data_page, gva;
|
||||
vm_paddr_t gpa;
|
||||
uint64_t *pte;
|
||||
struct test_data *data;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ static void guest_code(void *test_data)
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
const bool has_nested = kvm_cpu_has(X86_FEATURE_SVM) || kvm_cpu_has(X86_FEATURE_VMX);
|
||||
vm_vaddr_t nested_test_data_gva;
|
||||
gva_t nested_test_data_gva;
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_run *run;
|
||||
struct kvm_vm *vm;
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ static void enter_guest(struct kvm_vcpu *vcpu)
|
|||
int main(void)
|
||||
{
|
||||
struct kvm_vcpu *vcpu;
|
||||
vm_vaddr_t pvti_gva;
|
||||
gva_t pvti_gva;
|
||||
vm_paddr_t pvti_gpa;
|
||||
struct kvm_vm *vm;
|
||||
int flags;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ static void l1_guest_code(void *data)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
vm_vaddr_t guest_gva;
|
||||
gva_t guest_gva;
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@
|
|||
#define TEST_SYNC_WRITE_FAULT BIT(1)
|
||||
#define TEST_SYNC_NO_FAULT BIT(2)
|
||||
|
||||
static void l2_guest_code(vm_vaddr_t base)
|
||||
static void l2_guest_code(gva_t base)
|
||||
{
|
||||
vm_vaddr_t page0 = TEST_GUEST_ADDR(base, 0);
|
||||
vm_vaddr_t page1 = TEST_GUEST_ADDR(base, 1);
|
||||
gva_t page0 = TEST_GUEST_ADDR(base, 0);
|
||||
gva_t page1 = TEST_GUEST_ADDR(base, 1);
|
||||
|
||||
READ_ONCE(*(u64 *)page0);
|
||||
GUEST_SYNC(page0 | TEST_SYNC_READ_FAULT);
|
||||
|
|
@ -143,7 +143,7 @@ static void l1_guest_code(void *data)
|
|||
static void test_handle_ucall_sync(struct kvm_vm *vm, u64 arg,
|
||||
unsigned long *bmap)
|
||||
{
|
||||
vm_vaddr_t gva = arg & ~(PAGE_SIZE - 1);
|
||||
gva_t gva = arg & ~(PAGE_SIZE - 1);
|
||||
int page_nr, i;
|
||||
|
||||
/*
|
||||
|
|
@ -198,7 +198,7 @@ static void test_handle_ucall_sync(struct kvm_vm *vm, u64 arg,
|
|||
|
||||
static void test_dirty_log(bool nested_tdp)
|
||||
{
|
||||
vm_vaddr_t nested_gva = 0;
|
||||
gva_t nested_gva = 0;
|
||||
unsigned long *bmap;
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ static void guest_code(void *test_data)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
vm_vaddr_t nested_test_data_gva;
|
||||
gva_t nested_test_data_gva;
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ static void queue_ss_exception(struct kvm_vcpu *vcpu, bool inject)
|
|||
*/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
vm_vaddr_t nested_test_data_gva;
|
||||
gva_t nested_test_data_gva;
|
||||
struct kvm_vcpu_events events;
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
vm_vaddr_t guest_gva = 0;
|
||||
gva_t guest_gva = 0;
|
||||
|
||||
TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_VMX) ||
|
||||
kvm_cpu_has(X86_FEATURE_SVM));
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ static void report(int64_t val)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
vm_vaddr_t nested_gva;
|
||||
gva_t nested_gva;
|
||||
struct kvm_vcpu *vcpu;
|
||||
|
||||
TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_VMX) ||
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
vm_vaddr_t guest_gva = 0;
|
||||
gva_t guest_gva = 0;
|
||||
|
||||
uint64_t tsc_start, tsc_end;
|
||||
uint64_t tsc_khz;
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ static void l1_guest_code(struct svm_test_data *svm)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
vm_vaddr_t nested_gva = 0;
|
||||
gva_t nested_gva = 0;
|
||||
struct vmcb *test_vmcb[2];
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ static void test_sync_vmsa(uint32_t type, uint64_t policy)
|
|||
{
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
vm_vaddr_t gva;
|
||||
gva_t gva;
|
||||
void *hva;
|
||||
|
||||
double x87val = M_PI;
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ static void guest_code(void *arg)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
vm_vaddr_t nested_gva = 0;
|
||||
gva_t nested_gva = 0;
|
||||
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_regs regs;
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ void check_nested_state(int stage, struct kvm_x86_state *state)
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
uint64_t *xstate_bv, saved_xstate_bv;
|
||||
vm_vaddr_t nested_gva = 0;
|
||||
gva_t nested_gva = 0;
|
||||
struct kvm_cpuid2 empty_cpuid = {};
|
||||
struct kvm_regs regs1, regs2;
|
||||
struct kvm_vcpu *vcpu, *vcpuN;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ static void l1_guest_code(struct svm_test_data *svm)
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct kvm_vcpu *vcpu;
|
||||
vm_vaddr_t svm_gva;
|
||||
gva_t svm_gva;
|
||||
struct kvm_vm *vm;
|
||||
struct ucall uc;
|
||||
|
||||
|
|
|
|||
|
|
@ -97,9 +97,9 @@ void test_lbrv_nested_state(bool nested_lbrv)
|
|||
{
|
||||
struct kvm_x86_state *state = NULL;
|
||||
struct kvm_vcpu *vcpu;
|
||||
vm_vaddr_t svm_gva;
|
||||
struct kvm_vm *vm;
|
||||
struct ucall uc;
|
||||
gva_t svm_gva;
|
||||
|
||||
pr_info("Testing with nested LBRV %s\n", nested_lbrv ? "enabled" : "disabled");
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
vm_vaddr_t nested_gva = 0;
|
||||
gva_t nested_gva = 0;
|
||||
|
||||
TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_SVM));
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ static void l1_guest_code(struct svm_test_data *svm, struct idt_entry *idt)
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct kvm_vcpu *vcpu;
|
||||
vm_vaddr_t svm_gva;
|
||||
gva_t svm_gva;
|
||||
struct kvm_vm *vm;
|
||||
|
||||
TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_SVM));
|
||||
|
|
|
|||
|
|
@ -144,8 +144,8 @@ static void run_test(bool is_nmi)
|
|||
{
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
vm_vaddr_t svm_gva;
|
||||
vm_vaddr_t idt_alt_vm;
|
||||
gva_t svm_gva;
|
||||
gva_t idt_alt_vm;
|
||||
struct kvm_guest_debug debug;
|
||||
|
||||
pr_info("Running %s test\n", is_nmi ? "NMI" : "soft int");
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ static u64 unmappable_gpa(struct kvm_vcpu *vcpu)
|
|||
|
||||
static void test_invalid_vmcb12(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
vm_vaddr_t nested_gva = 0;
|
||||
gva_t nested_gva = 0;
|
||||
struct ucall uc;
|
||||
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ static void test_invalid_vmcb12(struct kvm_vcpu *vcpu)
|
|||
|
||||
static void test_unmappable_vmcb12(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
vm_vaddr_t nested_gva = 0;
|
||||
gva_t nested_gva = 0;
|
||||
|
||||
vcpu_alloc_svm(vcpu->vm, &nested_gva);
|
||||
vcpu_args_set(vcpu, 2, nested_gva, unmappable_gpa(vcpu));
|
||||
|
|
@ -103,7 +103,7 @@ static void test_unmappable_vmcb12(struct kvm_vcpu *vcpu)
|
|||
static void test_unmappable_vmcb12_vmexit(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
struct kvm_x86_state *state;
|
||||
vm_vaddr_t nested_gva = 0;
|
||||
gva_t nested_gva = 0;
|
||||
struct ucall uc;
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ static void l1_guest_code(struct svm_test_data *svm)
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct kvm_vcpu *vcpu;
|
||||
vm_vaddr_t svm_gva;
|
||||
gva_t svm_gva;
|
||||
struct kvm_vm *vm;
|
||||
|
||||
TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_SVM));
|
||||
|
|
|
|||
|
|
@ -72,13 +72,13 @@ int main(void)
|
|||
|
||||
|
||||
if (has_vmx) {
|
||||
vm_vaddr_t vmx_pages_gva;
|
||||
gva_t vmx_pages_gva;
|
||||
|
||||
vm = vm_create_with_one_vcpu(&vcpu, l1_guest_code_vmx);
|
||||
vcpu_alloc_vmx(vm, &vmx_pages_gva);
|
||||
vcpu_args_set(vcpu, 1, vmx_pages_gva);
|
||||
} else {
|
||||
vm_vaddr_t svm_gva;
|
||||
gva_t svm_gva;
|
||||
|
||||
vm = vm_create_with_one_vcpu(&vcpu, l1_guest_code_svm);
|
||||
vcpu_alloc_svm(vm, &svm_gva);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ static void l1_guest_code(struct vmx_pages *vmx_pages, unsigned long high_gpa)
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
unsigned long apic_access_addr = ~0ul;
|
||||
vm_vaddr_t vmx_pages_gva;
|
||||
gva_t vmx_pages_gva;
|
||||
unsigned long high_gpa;
|
||||
struct vmx_pages *vmx;
|
||||
bool done = false;
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ static void l1_guest_code(struct vmx_pages *vmx_pages)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
vm_vaddr_t vmx_pages_gva;
|
||||
gva_t vmx_pages_gva;
|
||||
struct vmx_pages *vmx;
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_vm *vm;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ static void l1_guest_code(struct vmx_pages *vmx_pages)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
vm_vaddr_t vmx_pages_gva;
|
||||
gva_t vmx_pages_gva;
|
||||
struct kvm_sregs sregs;
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_run *run;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ void guest_code(struct vmx_pages *vmx_pages)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
vm_vaddr_t vmx_pages_gva = 0;
|
||||
gva_t vmx_pages_gva = 0;
|
||||
struct kvm_vm *vm;
|
||||
struct kvm_vcpu *vcpu;
|
||||
struct kvm_x86_state *state;
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ void guest_code(struct vmx_pages *vmx_pages)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
vm_vaddr_t vmx_pages_gva = 0;
|
||||
gva_t vmx_pages_gva = 0;
|
||||
|
||||
struct kvm_regs regs1, regs2;
|
||||
struct kvm_vm *vm;
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ int main(int argc, char *argv[])
|
|||
int run_secs = 0;
|
||||
int delay_usecs = 0;
|
||||
struct test_data_page *data;
|
||||
vm_vaddr_t test_data_page_vaddr;
|
||||
gva_t test_data_page_vaddr;
|
||||
bool migrate = false;
|
||||
pthread_t threads[2];
|
||||
struct thread_params params[2];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user