KVM: selftests: Convert to kernel-style types
cover KVM: selftests: Convert to kernel-style types
This series renames types across all KVM selftests to more align with types used in the kernel:
vm_vaddr_t -> gva_t
vm_paddr_t -> gpa_t
uint64_t -> u64
uint32_t -> u32
uint16_t -> u16
uint8_t -> u8
int64_t -> s64
int32_t -> s32
int16_t -> s16
int8_t -> s8
The goal of this series is to make the KVM selftests code more concise (the new type names are shorter) and more similar to the kernel, since selftests are developed by kernel developers.
I know broad changes like this series can be difficult to merge and also muddies up the git-blame history, so if there isn't appetite for this we can drop it. But if there is I would be happy to help with rebasing and resolving merge conflicts to get it in.
Most of the commits in this series are auto-generated with a single command (see commit messages), aside from whitespace fixes, so rebasing onto a different base isn't terrible.
David Matlack (10):
KVM: selftests: Use gva_t instead of vm_vaddr_t
KVM: selftests: Use gpa_t instead of vm_paddr_t
KVM: selftests: Use gpa_t for GPAs in Hyper-V selftests
KVM: selftests: Use u64 instead of uint64_t
KVM: selftests: Use s64 instead of int64_t
KVM: selftests: Use u32 instead of uint32_t
KVM: selftests: Use s32 instead of int32_t
KVM: selftests: Use u16 instead of uint16_t
KVM: selftests: Use s16 instead of int16_t
KVM: selftests: Use u8 instead of uint8_t
.../selftests/kvm/access_tracking_perf_test.c | 40 +-- tools/testing/selftests/kvm/arch_timer.c | 6 +- .../selftests/kvm/arm64/aarch32_id_regs.c | 14 +- .../testing/selftests/kvm/arm64/arch_timer.c | 8 +- .../kvm/arm64/arch_timer_edge_cases.c | 159 +++++---- .../selftests/kvm/arm64/debug-exceptions.c | 73 ++-- .../testing/selftests/kvm/arm64/hypercalls.c | 24 +- .../testing/selftests/kvm/arm64/no-vgic-v3.c | 6 +- .../selftests/kvm/arm64/page_fault_test.c | 82 ++--- tools/testing/selftests/kvm/arm64/psci_test.c | 26 +- .../testing/selftests/kvm/arm64/set_id_regs.c | 58 ++-- .../selftests/kvm/arm64/smccc_filter.c | 10 +- tools/testing/selftests/kvm/arm64/vgic_init.c | 56 ++-- tools/testing/selftests/kvm/arm64/vgic_irq.c | 116 +++---- .../selftests/kvm/arm64/vgic_lpi_stress.c | 20 +- .../selftests/kvm/arm64/vpmu_counter_access.c | 62 ++-- .../testing/selftests/kvm/coalesced_io_test.c | 38 +-- .../selftests/kvm/demand_paging_test.c | 10 +- .../selftests/kvm/dirty_log_perf_test.c | 14 +- tools/testing/selftests/kvm/dirty_log_test.c | 82 ++--- tools/testing/selftests/kvm/get-reg-list.c | 2 +- .../testing/selftests/kvm/guest_memfd_test.c | 2 +- .../testing/selftests/kvm/guest_print_test.c | 22 +- .../selftests/kvm/hardware_disable_test.c | 6 +- .../selftests/kvm/include/arm64/arch_timer.h | 30 +- .../selftests/kvm/include/arm64/delay.h | 4 +- .../testing/selftests/kvm/include/arm64/gic.h | 8 +- .../selftests/kvm/include/arm64/gic_v3_its.h | 8 +- .../selftests/kvm/include/arm64/processor.h | 20 +- .../selftests/kvm/include/arm64/ucall.h | 4 +- .../selftests/kvm/include/arm64/vgic.h | 20 +- .../testing/selftests/kvm/include/kvm_util.h | 311 +++++++++--------- .../selftests/kvm/include/kvm_util_types.h | 4 +- .../testing/selftests/kvm/include/memstress.h | 30 +- .../selftests/kvm/include/riscv/arch_timer.h | 22 +- .../selftests/kvm/include/riscv/processor.h | 9 +- .../selftests/kvm/include/riscv/ucall.h | 4 +- .../kvm/include/s390/diag318_test_handler.h | 2 +- .../selftests/kvm/include/s390/facility.h | 4 +- .../selftests/kvm/include/s390/ucall.h | 4 +- .../testing/selftests/kvm/include/sparsebit.h | 6 +- .../testing/selftests/kvm/include/test_util.h | 40 +-- .../selftests/kvm/include/timer_test.h | 18 +- .../selftests/kvm/include/ucall_common.h | 22 +- .../selftests/kvm/include/userfaultfd_util.h | 6 +- .../testing/selftests/kvm/include/x86/apic.h | 22 +- .../testing/selftests/kvm/include/x86/evmcs.h | 22 +- .../selftests/kvm/include/x86/hyperv.h | 28 +- .../selftests/kvm/include/x86/kvm_util_arch.h | 12 +- tools/testing/selftests/kvm/include/x86/pmu.h | 6 +- .../selftests/kvm/include/x86/processor.h | 272 ++++++++------- tools/testing/selftests/kvm/include/x86/sev.h | 14 +- .../selftests/kvm/include/x86/svm_util.h | 10 +- .../testing/selftests/kvm/include/x86/ucall.h | 2 +- tools/testing/selftests/kvm/include/x86/vmx.h | 80 ++--- .../selftests/kvm/kvm_page_table_test.c | 54 +-- tools/testing/selftests/kvm/lib/arm64/gic.c | 6 +- .../selftests/kvm/lib/arm64/gic_private.h | 24 +- .../testing/selftests/kvm/lib/arm64/gic_v3.c | 84 ++--- .../selftests/kvm/lib/arm64/gic_v3_its.c | 12 +- .../selftests/kvm/lib/arm64/processor.c | 126 +++---- tools/testing/selftests/kvm/lib/arm64/ucall.c | 12 +- tools/testing/selftests/kvm/lib/arm64/vgic.c | 38 +-- tools/testing/selftests/kvm/lib/elf.c | 8 +- tools/testing/selftests/kvm/lib/guest_modes.c | 2 +- .../testing/selftests/kvm/lib/guest_sprintf.c | 18 +- tools/testing/selftests/kvm/lib/kvm_util.c | 222 +++++++------ tools/testing/selftests/kvm/lib/memstress.c | 38 +-- .../selftests/kvm/lib/riscv/processor.c | 56 ++-- .../kvm/lib/s390/diag318_test_handler.c | 12 +- .../testing/selftests/kvm/lib/s390/facility.c | 2 +- .../selftests/kvm/lib/s390/processor.c | 42 +-- tools/testing/selftests/kvm/lib/sparsebit.c | 18 +- tools/testing/selftests/kvm/lib/test_util.c | 30 +- .../testing/selftests/kvm/lib/ucall_common.c | 30 +- .../selftests/kvm/lib/userfaultfd_util.c | 14 +- tools/testing/selftests/kvm/lib/x86/apic.c | 2 +- tools/testing/selftests/kvm/lib/x86/hyperv.c | 14 +- .../testing/selftests/kvm/lib/x86/memstress.c | 10 +- tools/testing/selftests/kvm/lib/x86/pmu.c | 4 +- .../testing/selftests/kvm/lib/x86/processor.c | 178 +++++----- tools/testing/selftests/kvm/lib/x86/sev.c | 14 +- tools/testing/selftests/kvm/lib/x86/svm.c | 16 +- tools/testing/selftests/kvm/lib/x86/ucall.c | 4 +- tools/testing/selftests/kvm/lib/x86/vmx.c | 108 +++--- .../kvm/memslot_modification_stress_test.c | 10 +- .../testing/selftests/kvm/memslot_perf_test.c | 164 ++++----- tools/testing/selftests/kvm/mmu_stress_test.c | 28 +- .../selftests/kvm/pre_fault_memory_test.c | 12 +- .../testing/selftests/kvm/riscv/arch_timer.c | 8 +- .../testing/selftests/kvm/riscv/ebreak_test.c | 6 +- .../selftests/kvm/riscv/get-reg-list.c | 2 +- .../selftests/kvm/riscv/sbi_pmu_test.c | 8 +- tools/testing/selftests/kvm/s390/debug_test.c | 8 +- tools/testing/selftests/kvm/s390/memop.c | 94 +++--- tools/testing/selftests/kvm/s390/resets.c | 6 +- .../selftests/kvm/s390/shared_zeropage_test.c | 2 +- tools/testing/selftests/kvm/s390/tprot.c | 24 +- .../selftests/kvm/s390/ucontrol_test.c | 2 +- .../selftests/kvm/set_memory_region_test.c | 40 +-- tools/testing/selftests/kvm/steal_time.c | 52 +-- .../kvm/system_counter_offset_test.c | 12 +- tools/testing/selftests/kvm/x86/amx_test.c | 14 +- .../selftests/kvm/x86/apic_bus_clock_test.c | 24 +- tools/testing/selftests/kvm/x86/cpuid_test.c | 6 +- tools/testing/selftests/kvm/x86/debug_regs.c | 4 +- .../kvm/x86/dirty_log_page_splitting_test.c | 16 +- .../selftests/kvm/x86/feature_msrs_test.c | 12 +- .../selftests/kvm/x86/fix_hypercall_test.c | 20 +- .../selftests/kvm/x86/flds_emulation.h | 6 +- .../testing/selftests/kvm/x86/hwcr_msr_test.c | 10 +- .../testing/selftests/kvm/x86/hyperv_clock.c | 6 +- .../testing/selftests/kvm/x86/hyperv_evmcs.c | 10 +- .../kvm/x86/hyperv_extended_hypercalls.c | 20 +- .../selftests/kvm/x86/hyperv_features.c | 26 +- tools/testing/selftests/kvm/x86/hyperv_ipi.c | 12 +- .../selftests/kvm/x86/hyperv_svm_test.c | 10 +- .../selftests/kvm/x86/hyperv_tlb_flush.c | 36 +- .../selftests/kvm/x86/kvm_clock_test.c | 14 +- tools/testing/selftests/kvm/x86/kvm_pv_test.c | 10 +- .../selftests/kvm/x86/monitor_mwait_test.c | 2 +- .../selftests/kvm/x86/nested_emulation_test.c | 20 +- .../kvm/x86/nested_exceptions_test.c | 6 +- .../selftests/kvm/x86/nx_huge_pages_test.c | 18 +- .../selftests/kvm/x86/platform_info_test.c | 6 +- .../selftests/kvm/x86/pmu_counters_test.c | 108 +++--- .../selftests/kvm/x86/pmu_event_filter_test.c | 102 +++--- .../kvm/x86/private_mem_conversions_test.c | 78 ++--- .../kvm/x86/private_mem_kvm_exits_test.c | 14 +- .../selftests/kvm/x86/set_boot_cpu_id.c | 6 +- .../selftests/kvm/x86/set_sregs_test.c | 6 +- .../selftests/kvm/x86/sev_init2_tests.c | 6 +- .../selftests/kvm/x86/sev_smoke_test.c | 14 +- .../x86/smaller_maxphyaddr_emulation_test.c | 10 +- tools/testing/selftests/kvm/x86/smm_test.c | 8 +- tools/testing/selftests/kvm/x86/state_test.c | 14 +- .../selftests/kvm/x86/svm_int_ctl_test.c | 2 +- .../kvm/x86/svm_nested_shutdown_test.c | 2 +- .../kvm/x86/svm_nested_soft_inject_test.c | 10 +- .../selftests/kvm/x86/svm_vmcall_test.c | 2 +- .../selftests/kvm/x86/sync_regs_test.c | 2 +- .../kvm/x86/triple_fault_event_test.c | 4 +- .../testing/selftests/kvm/x86/tsc_msrs_test.c | 2 +- .../selftests/kvm/x86/tsc_scaling_sync.c | 4 +- .../selftests/kvm/x86/ucna_injection_test.c | 45 +-- .../selftests/kvm/x86/userspace_io_test.c | 4 +- .../kvm/x86/userspace_msr_exit_test.c | 58 ++-- .../selftests/kvm/x86/vmx_apic_access_test.c | 4 +- .../kvm/x86/vmx_close_while_nested_test.c | 2 +- .../selftests/kvm/x86/vmx_dirty_log_test.c | 4 +- .../kvm/x86/vmx_invalid_nested_guest_state.c | 2 +- .../testing/selftests/kvm/x86/vmx_msrs_test.c | 22 +- .../kvm/x86/vmx_nested_tsc_scaling_test.c | 26 +- .../selftests/kvm/x86/vmx_pmu_caps_test.c | 12 +- .../kvm/x86/vmx_preemption_timer_test.c | 2 +- .../selftests/kvm/x86/vmx_tsc_adjust_test.c | 12 +- .../selftests/kvm/x86/xapic_ipi_test.c | 58 ++-- .../selftests/kvm/x86/xapic_state_test.c | 20 +- .../selftests/kvm/x86/xcr0_cpuid_test.c | 8 +- .../selftests/kvm/x86/xen_shinfo_test.c | 22 +- .../testing/selftests/kvm/x86/xss_msr_test.c | 2 +- 161 files changed, 2323 insertions(+), 2338 deletions(-)
base-commit: 45eb29140e68ffe8e93a5471006858a018480a45
prerequisite-patch-id: 3bae97c9e1093148763235f47a84fa040b512d04
Signature · 1 line
2.49.0.906.g1f30a19c02-goog
PATCH 1/10 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()). Also replace vm_vaddr in function names with gva to align with the new type name.
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.
No functional change intended.
--- tools/testing/selftests/kvm/arm64/vgic_irq.c | 6 +-- .../selftests/kvm/include/arm64/processor.h | 2 +- .../selftests/kvm/include/arm64/ucall.h | 4 +- .../testing/selftests/kvm/include/kvm_util.h | 36 ++++++------- .../selftests/kvm/include/kvm_util_types.h | 2 +- .../selftests/kvm/include/riscv/ucall.h | 2 +- .../selftests/kvm/include/s390/ucall.h | 2 +- .../selftests/kvm/include/ucall_common.h | 4 +- .../selftests/kvm/include/x86/hyperv.h | 10 ++-- .../selftests/kvm/include/x86/kvm_util_arch.h | 6 +-- .../selftests/kvm/include/x86/svm_util.h | 2 +- tools/testing/selftests/kvm/include/x86/vmx.h | 2 +- .../selftests/kvm/kvm_page_table_test.c | 2 +- .../selftests/kvm/lib/arm64/processor.c | 28 +++++----- tools/testing/selftests/kvm/lib/arm64/ucall.c | 6 +-- tools/testing/selftests/kvm/lib/elf.c | 6 +-- tools/testing/selftests/kvm/lib/kvm_util.c | 51 +++++++++---------- .../selftests/kvm/lib/riscv/processor.c | 16 +++--- .../selftests/kvm/lib/s390/processor.c | 8 +-- .../testing/selftests/kvm/lib/ucall_common.c | 12 ++--- tools/testing/selftests/kvm/lib/x86/hyperv.c | 10 ++-- .../testing/selftests/kvm/lib/x86/memstress.c | 2 +- .../testing/selftests/kvm/lib/x86/processor.c | 30 +++++------ tools/testing/selftests/kvm/lib/x86/svm.c | 10 ++-- tools/testing/selftests/kvm/lib/x86/ucall.c | 2 +- tools/testing/selftests/kvm/lib/x86/vmx.c | 20 ++++---- .../selftests/kvm/riscv/sbi_pmu_test.c | 2 +- tools/testing/selftests/kvm/s390/memop.c | 18 +++---- tools/testing/selftests/kvm/s390/tprot.c | 10 ++-- tools/testing/selftests/kvm/steal_time.c | 2 +- tools/testing/selftests/kvm/x86/amx_test.c | 8 +-- tools/testing/selftests/kvm/x86/cpuid_test.c | 6 +-- .../testing/selftests/kvm/x86/hyperv_clock.c | 4 +- .../testing/selftests/kvm/x86/hyperv_evmcs.c | 8 +-- .../kvm/x86/hyperv_extended_hypercalls.c | 10 ++-- .../selftests/kvm/x86/hyperv_features.c | 12 ++--- tools/testing/selftests/kvm/x86/hyperv_ipi.c | 10 ++-- .../selftests/kvm/x86/hyperv_svm_test.c | 8 +-- .../selftests/kvm/x86/hyperv_tlb_flush.c | 20 ++++---- .../selftests/kvm/x86/kvm_clock_test.c | 4 +- .../selftests/kvm/x86/nested_emulation_test.c | 2 +- .../kvm/x86/nested_exceptions_test.c | 2 +- .../selftests/kvm/x86/sev_smoke_test.c | 6 +-- tools/testing/selftests/kvm/x86/smm_test.c | 2 +- tools/testing/selftests/kvm/x86/state_test.c | 2 +- .../selftests/kvm/x86/svm_int_ctl_test.c | 2 +- .../kvm/x86/svm_nested_shutdown_test.c | 2 +- .../kvm/x86/svm_nested_soft_inject_test.c | 6 +-- .../selftests/kvm/x86/svm_vmcall_test.c | 2 +- .../kvm/x86/triple_fault_event_test.c | 4 +- .../selftests/kvm/x86/vmx_apic_access_test.c | 2 +- .../kvm/x86/vmx_close_while_nested_test.c | 2 +- .../selftests/kvm/x86/vmx_dirty_log_test.c | 2 +- .../kvm/x86/vmx_invalid_nested_guest_state.c | 2 +- .../kvm/x86/vmx_nested_tsc_scaling_test.c | 2 +- .../kvm/x86/vmx_preemption_timer_test.c | 2 +- .../selftests/kvm/x86/vmx_tsc_adjust_test.c | 2 +- .../selftests/kvm/x86/xapic_ipi_test.c | 4 +- 58 files changed, 225 insertions(+), 226 deletions(-)
tools/testing/selftests/kvm/arm64/vgic_irq.c +3 -3
@@ -714,7 +714,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);
@@ -735,7 +735,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,
@@ -753,7 +753,7 @@ static void test_vgic(uint32_t nr_irqs, bool level_sensitive, bool eoi_split)vcpu_init_descriptor_tables (vcpu);/* Setup the guest args page (so it gets the args). */ - args_gva =vm_vaddr_alloc_page (vm); + args_gva =gva_alloc_page (vm);memcpy (addr_gva2hva (vm, args_gva), &args,sizeof (args));vcpu_args_set (vcpu,1 , args_gva);
tools/testing/selftests/kvm/include/arm64/processor.h +1 -1
@@ -175,7 +175,7 @@ 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 (struct kvm_vm *vm,vm_vaddr_t gva); +uint64_t *virt_get_pte_hva (struct kvm_vm *vm,gva_t gva);static inline void cpu_relax (void ) {
tools/testing/selftests/kvm/include/arm64/ucall.h +2 -2
@@ -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); }
tools/testing/selftests/kvm/include/kvm_util.h +18 -18
@@ -100,7 +100,7 @@ struct kvm_vm {bool pgd_created;vm_paddr_t ucall_mmio_addr;vm_paddr_t pgd; -vm_vaddr_t handlers; +gva_t handlers;uint32_t dirty_ring_size;uint64_t gpa_tag_mask;
@@ -602,22 +602,22 @@ 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, -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 gva_unused_gap (struct kvm_vm *vm,size_t sz,gva_t vaddr_min); +gva_t gva_alloc (struct kvm_vm *vm,size_t sz,gva_t vaddr_min); +gva_t __gva_alloc (struct kvm_vm *vm,size_t sz,gva_t vaddr_min, +enum kvm_mem_region_type type); +gva_t gva_alloc_shared (struct kvm_vm *vm,size_t sz, +gva_t vaddr_min, +enum kvm_mem_region_type type); +gva_t gva_alloc_pages (struct kvm_vm *vm,int nr_pages); +gva_t __gva_alloc_page (struct kvm_vm *vm, +enum kvm_mem_region_type type); +gva_t gva_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);
@@ -994,12 +994,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)); \ })
@@ -1010,7 +1010,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)); \
@@ -1104,9 +1104,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); }
tools/testing/selftests/kvm/include/kvm_util_types.h +1 -1
@@ -15,6 +15,6 @@#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 */ #endif /* SELFTEST_KVM_UTIL_TYPES_H */
tools/testing/selftests/kvm/include/riscv/ucall.h +1 -1
@@ -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,
tools/testing/selftests/kvm/include/s390/ucall.h +1 -1
@@ -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) */ asmvolatile ("diag 0,%0,0x501" : :"a" (uc) :"memory" );
tools/testing/selftests/kvm/include/ucall_common.h +2 -2
@@ -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)
tools/testing/selftests/kvm/include/x86/hyperv.h +5 -5
@@ -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)
tools/testing/selftests/kvm/include/x86/kvm_util_arch.h +3 -3
@@ -11,9 +11,9 @@extern bool is_forced_emulation_enabled;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;
tools/testing/selftests/kvm/include/x86/svm_util.h +1 -1
@@ -53,7 +53,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);
tools/testing/selftests/kvm/include/x86/vmx.h +1 -1
@@ -552,7 +552,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);
tools/testing/selftests/kvm/kvm_page_table_test.c +1 -1
@@ -295,7 +295,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));
tools/testing/selftests/kvm/lib/arm64/processor.c +14 -14
@@ -18,14 +18,14 @@#define DEFAULT_ARM64_GUEST_STACK_VADDR_MIN 0xac0000 -static vm_vaddr_t exception_handlers; +static gva_t exception_handlers;static uint64_t page_align (struct kvm_vm *vm,uint64_t v) {return (v + vm->page_size) & ~(vm->page_size -1 ); } -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->pgtable_levels -1 ) * (vm->page_shift -3 ) + vm->page_shift;uint64_t mask = (1UL << (vm->va_bits - shift)) -1 ;
@@ -33,7 +33,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 ;
@@ -44,7 +44,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 ;
@@ -55,7 +55,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;
@@ -185,7 +185,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 (struct kvm_vm *vm,vm_vaddr_t gva) +uint64_t *virt_get_pte_hva (struct kvm_vm *vm,gva_t gva) {uint64_t *ptep;
@@ -223,7 +223,7 @@ uint64_t *virt_get_pte_hva(struct kvm_vm *vm, vm_vaddr_t gva)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 =virt_get_pte_hva (vm, gva);
@@ -389,9 +389,9 @@ static struct kvm_vcpu *__aarch64_vcpu_add(struct kvm_vm *vm, uint32_t vcpu_id, stack_size = vm->page_size ==4096 ?DEFAULT_STACK_PGS * vm->page_size : vm->page_size; - stack_vaddr =__vm_vaddr_alloc (vm, stack_size, -DEFAULT_ARM64_GUEST_STACK_VADDR_MIN , -MEM_REGION_DATA ); + stack_vaddr =__gva_alloc (vm, stack_size, +DEFAULT_ARM64_GUEST_STACK_VADDR_MIN , +MEM_REGION_DATA );aarch64_vcpu_setup (vcpu, init);
@@ -503,10 +503,10 @@ void route_exception(struct ex_regs *regs, int vector)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->handlers =__gva_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,
@@ -638,7 +638,7 @@ void kvm_selftest_arch_init(void)guest_modes_append_default (); } -void vm_vaddr_populate_bitmap (struct kvm_vm *vm) +void gva_populate_bitmap (struct kvm_vm *vm) {/* * arm64 selftests use only TTBR0_EL1, meaning that the valid VA space
tools/testing/selftests/kvm/lib/arm64/ucall.c +3 -3
@@ -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 =gva_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)
tools/testing/selftests/kvm/lib/elf.c +3 -3
@@ -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 =__gva_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"
tools/testing/selftests/kvm/lib/kvm_util.c +25 -26
124 lines not on this page · raw message
tools/testing/selftests/kvm/lib/riscv/processor.c +8 -8
@@ -14,7 +14,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) {
@@ -56,7 +56,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);
@@ -123,7 +123,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->pgtable_levels -1 ;
@@ -306,9 +306,9 @@ struct kvm_vcpu *vm_arch_vcpu_add(struct kvm_vm *vm, uint32_t vcpu_id) stack_size = vm->page_size ==4096 ?DEFAULT_STACK_PGS * vm->page_size : vm->page_size; - stack_vaddr =__vm_vaddr_alloc (vm, stack_size, -DEFAULT_RISCV_GUEST_STACK_VADDR_MIN , -MEM_REGION_DATA ); + stack_vaddr =__gva_alloc (vm, stack_size, +DEFAULT_RISCV_GUEST_STACK_VADDR_MIN , +MEM_REGION_DATA ); vcpu =__vm_vcpu_add (vm, vcpu_id);riscv_vcpu_mmu_setup (vcpu);
@@ -433,10 +433,10 @@ void vcpu_init_vector_tables(struct kvm_vcpu *vcpu)void vm_init_vector_tables (struct kvm_vm *vm) { - vm->handlers =__vm_vaddr_alloc (vm,sizeof (struct handlers ), + vm->handlers =__gva_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)
tools/testing/selftests/kvm/lib/s390/processor.c +4 -4
@@ -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;
@@ -171,9 +171,9 @@ struct kvm_vcpu *vm_arch_vcpu_add(struct kvm_vm *vm, uint32_t vcpu_id)TEST_ASSERT (vm->page_size ==PAGE_SIZE ,"Unsupported page size: 0x%x" , vm->page_size); - stack_vaddr =__vm_vaddr_alloc (vm, stack_size, -DEFAULT_GUEST_STACK_VADDR_MIN , -MEM_REGION_DATA ); + stack_vaddr =__gva_alloc (vm, stack_size, +DEFAULT_GUEST_STACK_VADDR_MIN , +MEM_REGION_DATA ); vcpu =__vm_vcpu_add (vm, vcpu_id);
tools/testing/selftests/kvm/lib/ucall_common.c +6 -6
@@ -29,11 +29,11 @@ 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 , -MEM_REGION_DATA ); + vaddr =gva_alloc_shared (vm,sizeof (*hdr),KVM_UTIL_MIN_VADDR , +MEM_REGION_DATA ); hdr = (struct ucall_header *)addr_gva2hva (vm, vaddr);memset (hdr,0 ,sizeof (*hdr));
@@ -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); }
tools/testing/selftests/kvm/lib/x86/hyperv.c +5 -5
@@ -76,23 +76,23 @@ 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 =gva_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. */ - hv->vp_assist = (void *)vm_vaddr_alloc_page (vm); + hv->vp_assist = (void *)gva_alloc_page (vm); hv->vp_assist_hva =addr_gva2hva (vm, (uintptr_t )hv->vp_assist); hv->vp_assist_gpa =addr_gva2gpa (vm, (uintptr_t )hv->vp_assist);/* Setup of a region of guest memory for the partition assist page. */ - hv->partition_assist = (void *)vm_vaddr_alloc_page (vm); + hv->partition_assist = (void *)gva_alloc_page (vm); hv->partition_assist_hva =addr_gva2hva (vm, (uintptr_t )hv->partition_assist); hv->partition_assist_gpa =addr_gva2gpa (vm, (uintptr_t )hv->partition_assist);/* Setup of a region of guest memory for the enlightened VMCS. */ - hv->enlightened_vmcs = (void *)vm_vaddr_alloc_page (vm); + hv->enlightened_vmcs = (void *)gva_alloc_page (vm); hv->enlightened_vmcs_hva =addr_gva2hva (vm, (uintptr_t )hv->enlightened_vmcs); hv->enlightened_vmcs_gpa =addr_gva2gpa (vm, (uintptr_t )hv->enlightened_vmcs);
tools/testing/selftests/kvm/lib/x86/memstress.c +1 -1
@@ -81,7 +81,7 @@ void memstress_setup_nested(struct kvm_vm *vm, int nr_vcpus, struct kvm_vcpu *vc {struct vmx_pages *vmx, *vmx0 =NULL ;struct kvm_regs regs; -vm_vaddr_t vmx_gva; +gva_t vmx_gva;int vcpu_id;TEST_REQUIRE (kvm_cpu_has (X86_FEATURE_VMX ));
tools/testing/selftests/kvm/lib/x86/processor.c +15 -15
@@ -17,7 +17,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 is_forced_emulation_enabled;
@@ -463,7 +463,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, gva, &level);
@@ -478,7 +478,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;
@@ -588,16 +588,16 @@ static void vm_init_descriptor_tables(struct kvm_vm *vm)struct kvm_segment seg;int i; - vm->arch.gdt =__vm_vaddr_alloc_page (vm,MEM_REGION_DATA ); - vm->arch.idt =__vm_vaddr_alloc_page (vm,MEM_REGION_DATA ); - vm->handlers =__vm_vaddr_alloc_page (vm,MEM_REGION_DATA ); - vm->arch.tss =__vm_vaddr_alloc_page (vm,MEM_REGION_DATA ); + vm->arch.gdt =__gva_alloc_page (vm,MEM_REGION_DATA ); + vm->arch.idt =__gva_alloc_page (vm,MEM_REGION_DATA ); + vm->handlers =__gva_alloc_page (vm,MEM_REGION_DATA ); + vm->arch.tss =__gva_alloc_page (vm,MEM_REGION_DATA );/* Handlers have the same address in both address spaces.*/ 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);
@@ -612,9 +612,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)
@@ -664,12 +664,12 @@ 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 (), -DEFAULT_GUEST_STACK_VADDR_MIN , -MEM_REGION_DATA ); + stack_vaddr =__gva_alloc (vm,DEFAULT_STACK_PGS *getpagesize (), +DEFAULT_GUEST_STACK_VADDR_MIN , +MEM_REGION_DATA ); stack_vaddr +=DEFAULT_STACK_PGS *getpagesize ();
@@ -683,7 +683,7 @@ struct kvm_vcpu *vm_arch_vcpu_add(struct kvm_vm *vm, uint32_t vcpu_id)* may need to subtract 4 bytes instead of 8 bytes. */ TEST_ASSERT (IS_ALIGNED (stack_vaddr,PAGE_SIZE ), -"__vm_vaddr_alloc() did not provide a page-aligned address" ); +"__gva_alloc() did not provide a page-aligned address" ); stack_vaddr -=8 ; vcpu =__vm_vcpu_add (vm, vcpu_id);
tools/testing/selftests/kvm/lib/x86/svm.c +5 -5
@@ -28,20 +28,20 @@ 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 =gva_alloc_page (vm);struct svm_test_data *svm =addr_gva2hva (vm, svm_gva); - svm->vmcb = (void *)vm_vaddr_alloc_page (vm); + svm->vmcb = (void *)gva_alloc_page (vm); svm->vmcb_hva =addr_gva2hva (vm, (uintptr_t )svm->vmcb); svm->vmcb_gpa =addr_gva2gpa (vm, (uintptr_t )svm->vmcb); - svm->save_area = (void *)vm_vaddr_alloc_page (vm); + svm->save_area = (void *)gva_alloc_page (vm); svm->save_area_hva =addr_gva2hva (vm, (uintptr_t )svm->save_area); svm->save_area_gpa =addr_gva2gpa (vm, (uintptr_t )svm->save_area); - svm->msr = (void *)vm_vaddr_alloc_page (vm); + svm->msr = (void *)gva_alloc_page (vm); svm->msr_hva =addr_gva2hva (vm, (uintptr_t )svm->msr); svm->msr_gpa =addr_gva2gpa (vm, (uintptr_t )svm->msr);memset (svm->msr_hva,0 ,getpagesize ());
tools/testing/selftests/kvm/lib/x86/ucall.c +1 -1
@@ -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
tools/testing/selftests/kvm/lib/x86/vmx.c +10 -10
@@ -70,39 +70,39 @@ int vcpu_enable_evmcs(struct kvm_vcpu *vcpu)* 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 =gva_alloc_page (vm);struct vmx_pages *vmx =addr_gva2hva (vm, vmx_gva);/* Setup of a region of guest memory for the vmxon region. */ - vmx->vmxon = (void *)vm_vaddr_alloc_page (vm); + vmx->vmxon = (void *)gva_alloc_page (vm); vmx->vmxon_hva =addr_gva2hva (vm, (uintptr_t )vmx->vmxon); vmx->vmxon_gpa =addr_gva2gpa (vm, (uintptr_t )vmx->vmxon);/* Setup of a region of guest memory for a vmcs. */ - vmx->vmcs = (void *)vm_vaddr_alloc_page (vm); + vmx->vmcs = (void *)gva_alloc_page (vm); vmx->vmcs_hva =addr_gva2hva (vm, (uintptr_t )vmx->vmcs); vmx->vmcs_gpa =addr_gva2gpa (vm, (uintptr_t )vmx->vmcs);/* Setup of a region of guest memory for the MSR bitmap. */ - vmx->msr = (void *)vm_vaddr_alloc_page (vm); + vmx->msr = (void *)gva_alloc_page (vm); vmx->msr_hva =addr_gva2hva (vm, (uintptr_t )vmx->msr); vmx->msr_gpa =addr_gva2gpa (vm, (uintptr_t )vmx->msr);memset (vmx->msr_hva,0 ,getpagesize ());/* Setup of a region of guest memory for the shadow VMCS. */ - vmx->shadow_vmcs = (void *)vm_vaddr_alloc_page (vm); + vmx->shadow_vmcs = (void *)gva_alloc_page (vm); vmx->shadow_vmcs_hva =addr_gva2hva (vm, (uintptr_t )vmx->shadow_vmcs); vmx->shadow_vmcs_gpa =addr_gva2gpa (vm, (uintptr_t )vmx->shadow_vmcs);/* Setup of a region of guest memory for the VMREAD and VMWRITE bitmaps. */ - vmx->vmread = (void *)vm_vaddr_alloc_page (vm); + vmx->vmread = (void *)gva_alloc_page (vm); vmx->vmread_hva =addr_gva2hva (vm, (uintptr_t )vmx->vmread); vmx->vmread_gpa =addr_gva2gpa (vm, (uintptr_t )vmx->vmread);memset (vmx->vmread_hva,0 ,getpagesize ()); - vmx->vmwrite = (void *)vm_vaddr_alloc_page (vm); + vmx->vmwrite = (void *)gva_alloc_page (vm); vmx->vmwrite_hva =addr_gva2hva (vm, (uintptr_t )vmx->vmwrite); vmx->vmwrite_gpa =addr_gva2gpa (vm, (uintptr_t )vmx->vmwrite);memset (vmx->vmwrite_hva,0 ,getpagesize ());
@@ -539,14 +539,14 @@ void prepare_eptp(struct vmx_pages *vmx, struct kvm_vm *vm, {TEST_ASSERT (kvm_cpu_has_ept (),"KVM doesn't support nested EPT" ); - vmx->eptp = (void *)vm_vaddr_alloc_page (vm); + vmx->eptp = (void *)gva_alloc_page (vm); vmx->eptp_hva =addr_gva2hva (vm, (uintptr_t )vmx->eptp); vmx->eptp_gpa =addr_gva2gpa (vm, (uintptr_t )vmx->eptp); }void prepare_virtualize_apic_accesses (struct vmx_pages *vmx,struct kvm_vm *vm) { - vmx->apic_access = (void *)vm_vaddr_alloc_page (vm); + vmx->apic_access = (void *)gva_alloc_page (vm); vmx->apic_access_hva =addr_gva2hva (vm, (uintptr_t )vmx->apic_access); vmx->apic_access_gpa =addr_gva2gpa (vm, (uintptr_t )vmx->apic_access); }
tools/testing/selftests/kvm/riscv/sbi_pmu_test.c +1 -1
@@ -574,7 +574,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); }
tools/testing/selftests/kvm/s390/memop.c +9 -9
@@ -878,10 +878,10 @@ 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); + guest_0_page =gva_alloc (t.kvm_vm,PAGE_SIZE ,0 ); + guest_last_page =gva_alloc (t.kvm_vm,PAGE_SIZE , last_page_addr);if (guest_0_page !=0 || guest_last_page != last_page_addr) {print_skip ("did not allocate guest pages at required positions" ); goto out;
@@ -917,10 +917,10 @@ 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); + guest_0_page =gva_alloc (t.kvm_vm,PAGE_SIZE ,0 ); + guest_last_page =gva_alloc (t.kvm_vm,PAGE_SIZE , last_page_addr);if (guest_0_page !=0 || guest_last_page != last_page_addr) {print_skip ("did not allocate guest pages at required positions" ); goto out;
@@ -938,10 +938,10 @@ 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); + guest_0_page =gva_alloc (t.kvm_vm,PAGE_SIZE ,0 ); + guest_last_page =gva_alloc (t.kvm_vm,PAGE_SIZE , last_page_addr);if (guest_0_page !=0 || guest_last_page != last_page_addr) {print_skip ("did not allocate guest pages at required positions" ); goto out;
tools/testing/selftests/kvm/s390/tprot.c +5 -5
@@ -146,7 +146,7 @@ static enum stage perform_next_stage(int *i, bool mapped_0)/* * Some fetch protection override tests require that page 0 * be mapped, however, when the hosts tries to map that page via -* vm_vaddr_alloc, it may happen that some other page gets mapped +* gva_alloc, it may happen that some other page gets mapped * instead. * In order to skip these tests we detect this inside the guest */
@@ -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,10 +216,10 @@ 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 ); + guest_0_page =gva_alloc (vm,PAGE_SIZE ,0 );if (guest_0_page !=0 ) {/* Use NO_TAP so we don't get a PASS print */ HOST_SYNC_NO_TAP (vcpu,STAGE_INIT_FETCH_PROT_OVERRIDE );
@@ -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 );
tools/testing/selftests/kvm/steal_time.c +1 -1
@@ -280,7 +280,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]); }
tools/testing/selftests/kvm/x86/amx_test.c +4 -4
@@ -201,7 +201,7 @@ int main(int argc, char *argv[])struct kvm_vm *vm;struct kvm_x86_state *state;int xsave_restore_size; -vm_vaddr_t amx_cfg, tiledata, xstate; +gva_t amx_cfg, tiledata, xstate;struct ucall uc;u32 amx_offset;int ret;
@@ -232,15 +232,15 @@ int main(int argc, char *argv[])vm_install_exception_handler (vm,NM_VECTOR , guest_nm_handler);/* amx cfg for guest_code */ - amx_cfg =vm_vaddr_alloc_page (vm); + amx_cfg =gva_alloc_page (vm);memset (addr_gva2hva (vm, amx_cfg),0x0 ,getpagesize ());/* amx tiledata for guest_code */ - tiledata =vm_vaddr_alloc_pages (vm,2 ); + tiledata =gva_alloc_pages (vm,2 );memset (addr_gva2hva (vm, tiledata),rand () |1 ,2 *getpagesize ());/* XSAVE state for guest_code */ - xstate =vm_vaddr_alloc_pages (vm,DIV_ROUND_UP (XSAVE_SIZE ,PAGE_SIZE )); + xstate =gva_alloc_pages (vm,DIV_ROUND_UP (XSAVE_SIZE ,PAGE_SIZE ));memset (addr_gva2hva (vm, xstate),0 ,PAGE_SIZE *DIV_ROUND_UP (XSAVE_SIZE ,PAGE_SIZE ));vcpu_args_set (vcpu,3 , amx_cfg, tiledata, xstate);
tools/testing/selftests/kvm/x86/cpuid_test.c +3 -3
@@ -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 =gva_alloc (vm, size,KVM_UTIL_MIN_VADDR );struct kvm_cpuid2 *guest_cpuids =addr_gva2hva (vm, gva);memcpy (guest_cpuids, cpuid, size);
@@ -202,7 +202,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;
tools/testing/selftests/kvm/x86/hyperv_clock.c +2 -2
@@ -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 ));
@@ -218,7 +218,7 @@ int main(void)vcpu_set_hv_cpuid (vcpu); - tsc_page_gva =vm_vaddr_alloc_page (vm); + tsc_page_gva =gva_alloc_page (vm);memset (addr_gva2hva (vm, tsc_page_gva),0x0 ,getpagesize ());TEST_ASSERT ((addr_gva2gpa (vm, tsc_page_gva) & (getpagesize () -1 )) ==0 ,"TSC page has to be page aligned" );
tools/testing/selftests/kvm/x86/hyperv_evmcs.c +4 -4
@@ -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 64unsigned 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;
@@ -246,7 +246,7 @@ int main(int argc, char *argv[]) vm =vm_create_with_one_vcpu (&vcpu, guest_code); - hcall_page =vm_vaddr_alloc_pages (vm,1 ); + hcall_page =gva_alloc_pages (vm,1 );memset (addr_gva2hva (vm, hcall_page),0x0 ,getpagesize ());vcpu_set_hv_cpuid (vcpu);
tools/testing/selftests/kvm/x86/hyperv_extended_hypercalls.c +5 -5
@@ -16,7 +16,7 @@#define EXT_CAPABILITIES 0xbullstatic 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;
@@ -57,11 +57,11 @@ int main(void)vcpu_set_hv_cpuid (vcpu);/* Hypercall input */ - hcall_in_page =vm_vaddr_alloc_pages (vm,1 ); + hcall_in_page =gva_alloc_pages (vm,1 );memset (addr_gva2hva (vm, hcall_in_page),0x0 , vm->page_size);/* Hypercall output */ - hcall_out_page =vm_vaddr_alloc_pages (vm,1 ); + hcall_out_page =gva_alloc_pages (vm,1 );memset (addr_gva2hva (vm, hcall_out_page),0x0 , vm->page_size); vcpu_args_set(vcpu, 3, addr_gva2gpa(vm, hcall_in_page),
tools/testing/selftests/kvm/x86/hyperv_features.c +6 -6
@@ -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,14 +134,14 @@ 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 );while (true) { vm =vm_create_with_one_vcpu (&vcpu, guest_msr); - msr_gva =vm_vaddr_alloc_page (vm); + msr_gva =gva_alloc_page (vm);memset (addr_gva2hva (vm, msr_gva),0x0 ,getpagesize ()); msr =addr_gva2hva (vm, msr_gva);
@@ -523,17 +523,17 @@ 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) { vm =vm_create_with_one_vcpu (&vcpu, guest_hcall);/* Hypercall input/output */ - hcall_page =vm_vaddr_alloc_pages (vm,2 ); + hcall_page =gva_alloc_pages (vm,2 );memset (addr_gva2hva (vm, hcall_page),0x0 ,2 *getpagesize ()); - hcall_params =vm_vaddr_alloc_page (vm); + hcall_params =gva_alloc_page (vm);memset (addr_gva2hva (vm, hcall_params),0x0 ,getpagesize ()); hcall =addr_gva2hva (vm, hcall_params);
tools/testing/selftests/kvm/x86/hyperv_ipi.c +5 -5
@@ -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) asmvolatile ("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;
@@ -253,7 +253,7 @@ int main(int argc, char *argv[]) vm =vm_create_with_one_vcpu (&vcpu[0 ], sender_guest_code);/* Hypercall input/output */ - hcall_page =vm_vaddr_alloc_pages (vm,2 ); + hcall_page =gva_alloc_pages (vm,2 );memset (addr_gva2hva (vm, hcall_page),0x0 ,2 *getpagesize ());
tools/testing/selftests/kvm/x86/hyperv_svm_test.c +4 -4
@@ -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;
@@ -165,7 +165,7 @@ int main(int argc, char *argv[])vcpu_alloc_svm (vm, &nested_gva);vcpu_alloc_hyperv_test_pages (vm, &hv_pages_gva); - hcall_page =vm_vaddr_alloc_pages (vm,1 ); + hcall_page =gva_alloc_pages (vm,1 );memset (addr_gva2hva (vm, hcall_page),0x0 ,getpagesize ());vcpu_args_set (vcpu,3 , nested_gva, hv_pages_gva,addr_gva2gpa (vm, hcall_page));
tools/testing/selftests/kvm/x86/hyperv_tlb_flush.c +10 -10
@@ -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;
@@ -593,11 +593,11 @@ int main(int argc, char *argv[]) vm =vm_create_with_one_vcpu (&vcpu[0 ], sender_guest_code);/* Test data page */ - test_data_page =vm_vaddr_alloc_page (vm); + test_data_page =gva_alloc_page (vm); data = (struct test_data *)addr_gva2hva (vm, test_data_page);/* Hypercall input/output */ - data->hcall_gva =vm_vaddr_alloc_pages (vm,2 ); + data->hcall_gva =gva_alloc_pages (vm,2 ); data->hcall_gpa =addr_gva2gpa (vm, data->hcall_gva);memset (addr_gva2hva (vm, data->hcall_gva),0x0 ,2 *PAGE_SIZE );
@@ -606,7 +606,7 @@ int main(int argc, char *argv[])* and the test will swap their mappings. The third page keeps the indication * about the current state of mappings. */ - data->test_pages =vm_vaddr_alloc_pages (vm,NTEST_PAGES +1 ); + data->test_pages =gva_alloc_pages (vm,NTEST_PAGES +1 );for (i =0 ; i <NTEST_PAGES ; i++)memset (addr_gva2hva (vm, data->test_pages +PAGE_SIZE * i), (u8)(i +1 ),PAGE_SIZE );
@@ -617,7 +617,7 @@ int main(int argc, char *argv[])* Get PTE pointers for test pages and map them inside the guest. * Use separate page for each PTE for simplicity. */ - gva =vm_vaddr_unused_gap (vm,NTEST_PAGES *PAGE_SIZE ,KVM_UTIL_MIN_VADDR ); + gva =gva_unused_gap (vm,NTEST_PAGES *PAGE_SIZE ,KVM_UTIL_MIN_VADDR );for (i =0 ; i <NTEST_PAGES ; i++) { pte =vm_get_page_table_entry (vm, data->test_pages + i *PAGE_SIZE ); gpa =addr_hva2gpa (vm, pte);
tools/testing/selftests/kvm/x86/kvm_clock_test.c +2 -2
@@ -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;
@@ -147,7 +147,7 @@ int main(void) vm =vm_create_with_one_vcpu (&vcpu, guest_main); - pvti_gva =vm_vaddr_alloc (vm,getpagesize (),0x10000 ); + pvti_gva =gva_alloc (vm,getpagesize (),0x10000 ); pvti_gpa =addr_gva2gpa (vm, pvti_gva);vcpu_args_set (vcpu,2 , pvti_gpa, pvti_gva);
tools/testing/selftests/kvm/x86/nested_emulation_test.c +1 -1
@@ -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;
tools/testing/selftests/kvm/x86/nested_exceptions_test.c +1 -1
@@ -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;
tools/testing/selftests/kvm/x86/sev_smoke_test.c +3 -3
@@ -66,15 +66,15 @@ static void test_sync_vmsa(uint32_t policy) {struct kvm_vcpu *vcpu;struct kvm_vm *vm; -vm_vaddr_t gva; +gva_t gva;void *hva;double x87val =M_PI ;struct kvm_xsave __attribute__((aligned (64 ))) xsave = {0 }; vm =vm_sev_create_with_one_vcpu (KVM_X86_SEV_ES_VM , guest_code_xsave, &vcpu); - gva =vm_vaddr_alloc_shared (vm,PAGE_SIZE ,KVM_UTIL_MIN_VADDR , -MEM_REGION_TEST_DATA ); + gva =gva_alloc_shared (vm,PAGE_SIZE ,KVM_UTIL_MIN_VADDR , +MEM_REGION_TEST_DATA ); hva =addr_gva2hva (vm, gva);vcpu_args_set (vcpu,1 , gva);
tools/testing/selftests/kvm/x86/smm_test.c +1 -1
@@ -127,7 +127,7 @@ void inject_smi(struct kvm_vcpu *vcpu)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;
tools/testing/selftests/kvm/x86/state_test.c +1 -1
@@ -225,7 +225,7 @@ static void __attribute__((__flatten__)) guest_code(void *arg)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;
tools/testing/selftests/kvm/x86/svm_int_ctl_test.c +1 -1
@@ -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;
tools/testing/selftests/kvm/x86/svm_nested_shutdown_test.c +1 -1
@@ -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 ));
tools/testing/selftests/kvm/x86/svm_nested_soft_inject_test.c +3 -3
@@ -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" );
@@ -161,7 +161,7 @@ static void run_test(bool is_nmi)if (!is_nmi) {void *idt, *idt_alt; - idt_alt_vm =vm_vaddr_alloc_page (vm); + idt_alt_vm =gva_alloc_page (vm); idt_alt =addr_gva2hva (vm, idt_alt_vm); idt =addr_gva2hva (vm, vm->arch.idt);memcpy (idt_alt, idt,getpagesize ());
tools/testing/selftests/kvm/x86/svm_vmcall_test.c +1 -1
@@ -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 ));
tools/testing/selftests/kvm/x86/triple_fault_event_test.c +2 -2
@@ -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);
tools/testing/selftests/kvm/x86/vmx_apic_access_test.c +1 -1
@@ -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;
tools/testing/selftests/kvm/x86/vmx_close_while_nested_test.c +1 -1
@@ -47,7 +47,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_vcpu *vcpu;struct kvm_vm *vm;
tools/testing/selftests/kvm/x86/vmx_dirty_log_test.c +1 -1
@@ -79,7 +79,7 @@ void l1_guest_code(struct vmx_pages *vmx)static void test_vmx_dirty_log (bool enable_ept) { -vm_vaddr_t vmx_pages_gva =0 ; +gva_t vmx_pages_gva =0 ;struct vmx_pages *vmx;unsigned long *bmap;uint64_t *host_test_mem;
tools/testing/selftests/kvm/x86/vmx_invalid_nested_guest_state.c +1 -1
@@ -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;
tools/testing/selftests/kvm/x86/vmx_nested_tsc_scaling_test.c +1 -1
@@ -120,7 +120,7 @@ int main(int argc, char *argv[]) {struct kvm_vcpu *vcpu;struct kvm_vm *vm; -vm_vaddr_t vmx_pages_gva; +gva_t vmx_pages_gva;uint64_t tsc_start, tsc_end;uint64_t tsc_khz;
tools/testing/selftests/kvm/x86/vmx_preemption_timer_test.c +1 -1
@@ -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;
tools/testing/selftests/kvm/x86/vmx_tsc_adjust_test.c +1 -1
@@ -119,7 +119,7 @@ static void report(int64_t val)int main (int argc,char *argv[]) { -vm_vaddr_t vmx_pages_gva; +gva_t vmx_pages_gva;struct kvm_vcpu *vcpu;TEST_REQUIRE (kvm_cpu_has (X86_FEATURE_VMX ));
tools/testing/selftests/kvm/x86/xapic_ipi_test.c +2 -2
@@ -394,7 +394,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 ];
@@ -415,7 +415,7 @@ int main(int argc, char *argv[]) params[1 ].vcpu =vm_vcpu_add (vm,1 , sender_guest_code); - test_data_page_vaddr =vm_vaddr_alloc_page (vm); + test_data_page_vaddr =gva_alloc_page (vm); data =addr_gva2hva (vm, test_data_page_vaddr);memset (data,0 ,sizeof (*data)); params[0 ].data = data;
Signature · 1 line
2.49.0.906.g1f30a19c02-goog
PATCH 2/10 KVM: selftests: Use gpa_t instead of vm_paddr_t
In reply to David MatlackReplace all occurrences of vm_paddr_t with gpa_t to align with KVM code and with the conversion helpers (e.g. addr_hva2gpa()). Also replace vm_paddr in function names with gpa to align with the new type name.
This commit was generated with the following command:
git ls-files tools/testing/selftests/kvm | \
xargs sed -i 's/vm_paddr_/gpa_/g'Then by manually adjusting whitespace to make checkpatch.pl happy.
No functional change intended.
--- .../selftests/kvm/arm64/vgic_lpi_stress.c | 20 +++++------ tools/testing/selftests/kvm/dirty_log_test.c | 2 +- .../testing/selftests/kvm/include/arm64/gic.h | 4 +-- .../selftests/kvm/include/arm64/gic_v3_its.h | 8 ++--- .../testing/selftests/kvm/include/kvm_util.h | 33 +++++++++---------- .../selftests/kvm/include/kvm_util_types.h | 2 +- .../selftests/kvm/include/riscv/ucall.h | 2 +- .../selftests/kvm/include/s390/ucall.h | 2 +- .../selftests/kvm/include/ucall_common.h | 4 +-- tools/testing/selftests/kvm/include/x86/sev.h | 2 +- .../testing/selftests/kvm/include/x86/ucall.h | 2 +- .../selftests/kvm/kvm_page_table_test.c | 2 +- .../testing/selftests/kvm/lib/arm64/gic_v3.c | 4 +-- .../selftests/kvm/lib/arm64/gic_v3_its.c | 12 +++---- .../selftests/kvm/lib/arm64/processor.c | 2 +- tools/testing/selftests/kvm/lib/arm64/ucall.c | 2 +- tools/testing/selftests/kvm/lib/kvm_util.c | 23 +++++++------ tools/testing/selftests/kvm/lib/memstress.c | 2 +- .../selftests/kvm/lib/riscv/processor.c | 2 +- .../selftests/kvm/lib/s390/processor.c | 4 +-- .../testing/selftests/kvm/lib/ucall_common.c | 2 +- .../testing/selftests/kvm/lib/x86/processor.c | 2 +- tools/testing/selftests/kvm/lib/x86/sev.c | 2 +- .../selftests/kvm/riscv/sbi_pmu_test.c | 4 +-- .../selftests/kvm/s390/ucontrol_test.c | 2 +- tools/testing/selftests/kvm/steal_time.c | 4 +-- .../testing/selftests/kvm/x86/hyperv_clock.c | 2 +- .../kvm/x86/hyperv_extended_hypercalls.c | 2 +- .../selftests/kvm/x86/hyperv_tlb_flush.c | 8 ++--- .../selftests/kvm/x86/kvm_clock_test.c | 4 +-- 30 files changed, 82 insertions(+), 84 deletions(-)
tools/testing/selftests/kvm/arm64/vgic_lpi_stress.c +10 -10
@@ -23,7 +23,7 @@#define GIC_LPI_OFFSET 8192static size_t nr_iterations =1000 ; -static vm_paddr_t gpa_base; +static gpa_t gpa_base;static struct kvm_vm *vm;static struct kvm_vcpu **vcpus;
@@ -35,14 +35,14 @@ static struct test_data {u32 nr_devices;u32 nr_event_ids; -vm_paddr_t device_table; -vm_paddr_t collection_table; -vm_paddr_t cmdq_base; +gpa_t device_table; +gpa_t collection_table; +gpa_t cmdq_base;void *cmdq_base_va; -vm_paddr_t itt_tables; +gpa_t itt_tables; -vm_paddr_t lpi_prop_table; -vm_paddr_t lpi_pend_tables; +gpa_t lpi_prop_table; +gpa_t lpi_pend_tables; } test_data = { .nr_cpus = 1, .nr_devices = 1,
@@ -73,7 +73,7 @@ static void guest_setup_its_mappings(void)/* Round-robin the LPIs to all of the vCPUs in the VM */ coll_id =0 ;for (device_id =0 ; device_id < nr_devices; device_id++) { -vm_paddr_t itt_base = test_data.itt_tables + (device_id *SZ_64K ); +gpa_t itt_base = test_data.itt_tables + (device_id *SZ_64K );its_send_mapd_cmd (test_data.cmdq_base_va, device_id, itt_base,SZ_64K , true);
@@ -183,7 +183,7 @@ static void setup_test_data(void)size_t pages_per_64k =vm_calc_num_guest_pages (vm->mode,SZ_64K );u32 nr_devices = test_data.nr_devices;u32 nr_cpus = test_data.nr_cpus; -vm_paddr_t cmdq_base; +gpa_t cmdq_base; test_data.device_table = vm_phy_pages_alloc(vm, pages_per_64k, gpa_base,
@@ -222,7 +222,7 @@ static void setup_gic(void)static void signal_lpi (u32 device_id,u32 event_id) { -vm_paddr_t db_addr =GITS_BASE_GPA +GITS_TRANSLATER ; +gpa_t db_addr =GITS_BASE_GPA +GITS_TRANSLATER ;struct kvm_msi msi = { .address_lo = db_addr,
tools/testing/selftests/kvm/dirty_log_test.c +1 -1
@@ -669,7 +669,7 @@ static void run_test(enum vm_guest_mode mode, void *arg)virt_map (vm, guest_test_virt_mem, guest_test_phys_mem, guest_num_pages);/* Cache the HVA pointer of the region */ - host_test_mem =addr_gpa2hva (vm, (vm_paddr_t )guest_test_phys_mem); + host_test_mem =addr_gpa2hva (vm, (gpa_t )guest_test_phys_mem);/* Export the shared variables to the guest */ sync_global_to_guest (vm, host_page_size);
tools/testing/selftests/kvm/include/arm64/gic.h +2 -2
@@ -58,7 +58,7 @@ void gic_irq_clear_pending(unsigned int intid);bool gic_irq_get_pending (unsigned int intid);void gic_irq_set_config (unsigned int intid,bool is_edge); -void gic_rdist_enable_lpis (vm_paddr_t cfg_table,size_t cfg_table_size, -vm_paddr_t pend_table); +void gic_rdist_enable_lpis (gpa_t cfg_table,size_t cfg_table_size, +gpa_t pend_table);#endif /* SELFTEST_KVM_GIC_H */
tools/testing/selftests/kvm/include/arm64/gic_v3_its.h +4 -4
@@ -5,11 +5,11 @@#include <linux/sizes.h> -void its_init (vm_paddr_t coll_tbl,size_t coll_tbl_sz, -vm_paddr_t device_tbl,size_t device_tbl_sz, -vm_paddr_t cmdq,size_t cmdq_size); +void its_init (gpa_t coll_tbl,size_t coll_tbl_sz, +gpa_t device_tbl,size_t device_tbl_sz, +gpa_t cmdq,size_t cmdq_size); -void its_send_mapd_cmd (void *cmdq_base,u32 device_id,vm_paddr_t itt_base, +void its_send_mapd_cmd (void *cmdq_base,u32 device_id,gpa_t itt_base,size_t itt_size,bool valid);void its_send_mapc_cmd (void *cmdq_base,u32 vcpu_id,u32 collection_id,bool valid); void its_send_mapti_cmd(void *cmdq_base, u32 device_id, u32 event_id,
tools/testing/selftests/kvm/include/kvm_util.h +16 -17
@@ -98,8 +98,8 @@ struct kvm_vm {struct sparsebit *vpages_mapped;bool has_irqchip;bool pgd_created; -vm_paddr_t ucall_mmio_addr; -vm_paddr_t pgd; +gpa_t ucall_mmio_addr; +gpa_t pgd;gva_t handlers;uint32_t dirty_ring_size;uint64_t gpa_tag_mask;
@@ -616,16 +616,16 @@ gva_t gva_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_gpa2hva (struct kvm_vm *vm,gpa_t gpa);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); +gpa_t addr_hva2gpa (struct kvm_vm *vm,void *hva); +void *addr_gpa2alias (struct kvm_vm *vm,gpa_t gpa);#ifndef vcpu_arch_put_guest#define vcpu_arch_put_guest (mem, val) do { (mem) = (val); } while (0)#endif -static inline vm_paddr_t vm_untag_gpa (struct kvm_vm *vm,vm_paddr_t gpa) +static inline gpa_t vm_untag_gpa (struct kvm_vm *vm,gpa_t gpa) {return gpa & ~vm->gpa_tag_mask; }
@@ -876,15 +876,14 @@ void kvm_gsi_routing_write(struct kvm_vm *vm, struct kvm_irq_routing *routing);const char *exit_reason_str (unsigned int exit_reason); -vm_paddr_t vm_phy_page_alloc (struct kvm_vm *vm,vm_paddr_t paddr_min, -uint32_t memslot); -vm_paddr_t __vm_phy_pages_alloc (struct kvm_vm *vm,size_t num, -vm_paddr_t paddr_min,uint32_t memslot, -bool protected); -vm_paddr_t vm_alloc_page_table (struct kvm_vm *vm); +gpa_t vm_phy_page_alloc (struct kvm_vm *vm,gpa_t paddr_min,uint32_t memslot); +gpa_t __vm_phy_pages_alloc (struct kvm_vm *vm,size_t num, +gpa_t paddr_min,uint32_t memslot, +bool protected); +gpa_t vm_alloc_page_table (struct kvm_vm *vm); -static inline vm_paddr_t vm_phy_pages_alloc (struct kvm_vm *vm,size_t num, -vm_paddr_t paddr_min,uint32_t memslot) +static inline gpa_t vm_phy_pages_alloc (struct kvm_vm *vm,size_t num, +gpa_t paddr_min,uint32_t memslot) {/* * By default, allocate memory as protected for VMs that support
@@ -1104,9 +1103,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,gva_t gva); +gpa_t addr_arch_gva2gpa (struct kvm_vm *vm,gva_t gva); -static inline vm_paddr_t addr_gva2gpa (struct kvm_vm *vm,gva_t gva) +static inline gpa_t addr_gva2gpa (struct kvm_vm *vm,gva_t gva) {return addr_arch_gva2gpa (vm, gva); }
@@ -1148,7 +1147,7 @@ void kvm_selftest_arch_init(void);void kvm_arch_vm_post_create (struct kvm_vm *vm); -bool vm_is_gpa_protected (struct kvm_vm *vm,vm_paddr_t paddr); +bool vm_is_gpa_protected (struct kvm_vm *vm,gpa_t paddr);uint32_t guest_get_vcpuid (void );
tools/testing/selftests/kvm/include/kvm_util_types.h +1 -1
@@ -14,7 +14,7 @@#define __kvm_static_assert (expr, msg, ...) _Static_assert(expr, msg)#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 gpa_t ;/* Virtual Machine (Guest) physical address */ typedef uint64_t gva_t ;/* Virtual Machine (Guest) virtual address */ #endif /* SELFTEST_KVM_UTIL_TYPES_H */
tools/testing/selftests/kvm/include/riscv/ucall.h +1 -1
@@ -7,7 +7,7 @@#define UCALL_EXIT_REASON KVM_EXIT_RISCV_SBI -static inline void ucall_arch_init (struct kvm_vm *vm,vm_paddr_t mmio_gpa) +static inline void ucall_arch_init (struct kvm_vm *vm,gpa_t mmio_gpa) { }
tools/testing/selftests/kvm/include/s390/ucall.h +1 -1
@@ -6,7 +6,7 @@#define UCALL_EXIT_REASON KVM_EXIT_S390_SIEIC -static inline void ucall_arch_init (struct kvm_vm *vm,vm_paddr_t mmio_gpa) +static inline void ucall_arch_init (struct kvm_vm *vm,gpa_t mmio_gpa) { }
tools/testing/selftests/kvm/include/ucall_common.h +2 -2
@@ -29,7 +29,7 @@ struct ucall {struct ucall *hva; }; -void ucall_arch_init (struct kvm_vm *vm,vm_paddr_t mmio_gpa); +void ucall_arch_init (struct kvm_vm *vm,gpa_t mmio_gpa);void ucall_arch_do_ucall (gva_t uc);void *ucall_arch_get_ucall (struct kvm_vcpu *vcpu);
@@ -39,7 +39,7 @@ __printf(5, 6) void ucall_assert(uint64_t cmd, const char *exp, const char *file, unsigned int line, const char *fmt, ...);uint64_t get_ucall (struct kvm_vcpu *vcpu,struct ucall *uc); -void ucall_init (struct kvm_vm *vm,vm_paddr_t mmio_gpa); +void ucall_init (struct kvm_vm *vm,gpa_t mmio_gpa);int ucall_nr_pages_required (uint64_t page_size);/*
tools/testing/selftests/kvm/include/x86/sev.h +1 -1
@@ -82,7 +82,7 @@ static inline void sev_register_encrypted_memory(struct kvm_vm *vm,vm_ioctl (vm,KVM_MEMORY_ENCRYPT_REG_REGION , &range); } -static inline void sev_launch_update_data (struct kvm_vm *vm,vm_paddr_t gpa, +static inline void sev_launch_update_data (struct kvm_vm *vm,gpa_t gpa,uint64_t size) {struct kvm_sev_launch_update_data update_data = {
tools/testing/selftests/kvm/include/x86/ucall.h +1 -1
@@ -6,7 +6,7 @@#define UCALL_EXIT_REASON KVM_EXIT_IO -static inline void ucall_arch_init (struct kvm_vm *vm,vm_paddr_t mmio_gpa) +static inline void ucall_arch_init (struct kvm_vm *vm,gpa_t mmio_gpa) { }
tools/testing/selftests/kvm/kvm_page_table_test.c +1 -1
@@ -284,7 +284,7 @@ static struct kvm_vm *pre_init_before_test(enum vm_guest_mode mode, void *arg)virt_map (vm, guest_test_virt_mem, guest_test_phys_mem, guest_num_pages);/* Cache the HVA pointer of the region */ - host_test_mem =addr_gpa2hva (vm, (vm_paddr_t )guest_test_phys_mem); + host_test_mem =addr_gpa2hva (vm, (gpa_t )guest_test_phys_mem);/* Export shared structure test_args to guest */ sync_global_to_guest (vm, test_args);
tools/testing/selftests/kvm/lib/arm64/gic_v3.c +2 -2
@@ -402,8 +402,8 @@ const struct gic_common_ops gicv3_ops = { .gic_irq_set_config = gicv3_irq_set_config, }; -void gic_rdist_enable_lpis (vm_paddr_t cfg_table,size_t cfg_table_size, -vm_paddr_t pend_table) +void gic_rdist_enable_lpis (gpa_t cfg_table,size_t cfg_table_size, +gpa_t pend_table) {volatile void *rdist_base =gicr_base_cpu (guest_get_vcpuid ());
tools/testing/selftests/kvm/lib/arm64/gic_v3_its.c +6 -6
@@ -52,7 +52,7 @@ static unsigned long its_find_baser(unsigned int type)return -1 ; } -static void its_install_table (unsigned int type,vm_paddr_t base,size_t size) +static void its_install_table (unsigned int type,gpa_t base,size_t size) {unsigned long offset =its_find_baser (type);u64 baser;
@@ -67,7 +67,7 @@ static void its_install_table(unsigned int type, vm_paddr_t base, size_t size)its_write_u64 (offset, baser); } -static void its_install_cmdq (vm_paddr_t base,size_t size) +static void its_install_cmdq (gpa_t base,size_t size) {u64 cbaser;
@@ -80,9 +80,9 @@ static void its_install_cmdq(vm_paddr_t base, size_t size)its_write_u64 (GITS_CBASER , cbaser); } -void its_init (vm_paddr_t coll_tbl,size_t coll_tbl_sz, -vm_paddr_t device_tbl,size_t device_tbl_sz, -vm_paddr_t cmdq,size_t cmdq_size) +void its_init (gpa_t coll_tbl,size_t coll_tbl_sz, +gpa_t device_tbl,size_t device_tbl_sz, +gpa_t cmdq,size_t cmdq_size) {u32 ctlr;
@@ -197,7 +197,7 @@ static void its_send_cmd(void *cmdq_base, struct its_cmd_block *cmd) } } -void its_send_mapd_cmd (void *cmdq_base,u32 device_id,vm_paddr_t itt_base, +void its_send_mapd_cmd (void *cmdq_base,u32 device_id,gpa_t itt_base,size_t itt_size,bool valid) {struct its_cmd_block cmd = {};
tools/testing/selftests/kvm/lib/arm64/processor.c +1 -1
@@ -223,7 +223,7 @@ uint64_t *virt_get_pte_hva(struct kvm_vm *vm, gva_t gva)exit (EXIT_FAILURE ); } -vm_paddr_t addr_arch_gva2gpa (struct kvm_vm *vm,gva_t gva) +gpa_t addr_arch_gva2gpa (struct kvm_vm *vm,gva_t gva) {uint64_t *ptep =virt_get_pte_hva (vm, gva);
tools/testing/selftests/kvm/lib/arm64/ucall.c +1 -1
@@ -8,7 +8,7 @@gva_t *ucall_exit_mmio_addr; -void ucall_arch_init (struct kvm_vm *vm,vm_paddr_t mmio_gpa) +void ucall_arch_init (struct kvm_vm *vm,gpa_t mmio_gpa) {gva_t mmio_gva =gva_unused_gap (vm, vm->page_size,KVM_UTIL_MIN_VADDR );
tools/testing/selftests/kvm/lib/kvm_util.c +11 -12
@@ -1446,7 +1446,7 @@ static gva_t ____gva_alloc(struct kvm_vm *vm, size_t sz,uint64_t pages = (sz >> vm->page_shift) + ((sz % vm->page_size) !=0 );virt_pgd_alloc (vm); -vm_paddr_t paddr =__vm_phy_pages_alloc (vm, pages, +gpa_t paddr =__vm_phy_pages_alloc (vm, pages,KVM_UTIL_MIN_PFN * vm->page_size, vm->memslots[type], protected);
@@ -1600,7 +1600,7 @@ void virt_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr,* address providing the memory to the vm physical address is returned. * A TEST_ASSERT failure occurs if no region containing gpa exists. */ -void *addr_gpa2hva (struct kvm_vm *vm,vm_paddr_t gpa) +void *addr_gpa2hva (struct kvm_vm *vm,gpa_t gpa) {struct userspace_mem_region *region;
@@ -1633,7 +1633,7 @@ void *addr_gpa2hva(struct kvm_vm *vm, vm_paddr_t gpa)* VM physical address is returned. A TEST_ASSERT failure occurs if no * region containing hva exists. */ -vm_paddr_t addr_hva2gpa (struct kvm_vm *vm,void *hva) +gpa_t addr_hva2gpa (struct kvm_vm *vm,void *hva) {struct rb_node *node;
@@ -1644,7 +1644,7 @@ vm_paddr_t addr_hva2gpa(struct kvm_vm *vm, void *hva)if (hva >= region->host_mem) {if (hva <= (region->host_mem + region->region.memory_size -1 )) -return (vm_paddr_t)((uintptr_t ) +return (gpa_t)((uintptr_t ) region->region.guest_phys_addr + (hva - (uintptr_t )region->host_mem));
@@ -1676,7 +1676,7 @@ vm_paddr_t addr_hva2gpa(struct kvm_vm *vm, void *hva)* memory without mapping said memory in the guest's address space. And, for * userfaultfd-based demand paging, to do so without triggering userfaults. */ -void *addr_gpa2alias (struct kvm_vm *vm,vm_paddr_t gpa) +void *addr_gpa2alias (struct kvm_vm *vm,gpa_t gpa) {struct userspace_mem_region *region;uintptr_t offset;
@@ -2069,9 +2069,9 @@ const char *exit_reason_str(unsigned int exit_reason)* and their base address is returned. A TEST_ASSERT failure occurs if * not enough pages are available at or above paddr_min. */ -vm_paddr_t __vm_phy_pages_alloc (struct kvm_vm *vm,size_t num, -vm_paddr_t paddr_min,uint32_t memslot, -bool protected) +gpa_t __vm_phy_pages_alloc (struct kvm_vm *vm,size_t num, +gpa_t paddr_min,uint32_t memslot, +bool protected) {struct userspace_mem_region *region;sparsebit_idx_t pg, base;
@@ -2115,13 +2115,12 @@ vm_paddr_t __vm_phy_pages_alloc(struct kvm_vm *vm, size_t num,return base * vm->page_size; } -vm_paddr_t vm_phy_page_alloc (struct kvm_vm *vm,vm_paddr_t paddr_min, -uint32_t memslot) +gpa_t vm_phy_page_alloc (struct kvm_vm *vm,gpa_t paddr_min,uint32_t memslot) {return vm_phy_pages_alloc (vm,1 , paddr_min, memslot); } -vm_paddr_t vm_alloc_page_table (struct kvm_vm *vm) +gpa_t vm_alloc_page_table (struct kvm_vm *vm) {return vm_phy_page_alloc (vm,KVM_GUEST_PAGE_TABLE_MIN_PADDR , vm->memslots[MEM_REGION_PT ]);
@@ -2303,7 +2302,7 @@ void __attribute((constructor)) kvm_selftest_init(void)kvm_selftest_arch_init (); } -bool vm_is_gpa_protected (struct kvm_vm *vm,vm_paddr_t paddr) +bool vm_is_gpa_protected (struct kvm_vm *vm,gpa_t paddr) {sparsebit_idx_t pg =0 ;struct userspace_mem_region *region;
tools/testing/selftests/kvm/lib/memstress.c +1 -1
@@ -207,7 +207,7 @@ struct kvm_vm *memstress_create_vm(enum vm_guest_mode mode, int nr_vcpus,/* Add extra memory slots for testing */ for (i =0 ; i < slots; i++) {uint64_t region_pages = guest_num_pages / slots; -vm_paddr_t region_start = args->gpa + region_pages * args->guest_page_size * i; +gpa_t region_start = args->gpa + region_pages * args->guest_page_size * i; vm_userspace_mem_region_add(vm, backing_src, region_start, MEMSTRESS_MEM_SLOT_INDEX + i,
tools/testing/selftests/kvm/lib/riscv/processor.c +1 -1
@@ -123,7 +123,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,gva_t gva) +gpa_t addr_arch_gva2gpa (struct kvm_vm *vm,gva_t gva) {uint64_t *ptep;int level = vm->pgtable_levels -1 ;
tools/testing/selftests/kvm/lib/s390/processor.c +2 -2
@@ -12,7 +12,7 @@void virt_arch_pgd_alloc (struct kvm_vm *vm) { -vm_paddr_t paddr; +gpa_t paddr;TEST_ASSERT (vm->page_size ==PAGE_SIZE ,"Unsupported page size: 0x%x" , vm->page_size);
@@ -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,gva_t gva) +gpa_t addr_arch_gva2gpa (struct kvm_vm *vm,gva_t gva) {int ri, idx;uint64_t *entry;
tools/testing/selftests/kvm/lib/ucall_common.c +1 -1
@@ -25,7 +25,7 @@ int ucall_nr_pages_required(uint64_t page_size)*/ static struct ucall_header *ucall_pool; -void ucall_init (struct kvm_vm *vm,vm_paddr_t mmio_gpa) +void ucall_init (struct kvm_vm *vm,gpa_t mmio_gpa) {struct ucall_header *hdr;struct ucall *uc;
tools/testing/selftests/kvm/lib/x86/processor.c +1 -1
@@ -463,7 +463,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,gva_t gva) +gpa_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, gva, &level);
tools/testing/selftests/kvm/lib/x86/sev.c +1 -1
@@ -17,7 +17,7 @@static void encrypt_region (struct kvm_vm *vm,struct userspace_mem_region *region) {const struct sparsebit *protected_phy_pages = region->protected_phy_pages; -const vm_paddr_t gpa_base = region->region.guest_phys_addr; +const gpa_t gpa_base = region->region.guest_phys_addr;const sparsebit_idx_t lowest_page_in_region = gpa_base >> vm->page_shift;sparsebit_idx_t i, j;
tools/testing/selftests/kvm/riscv/sbi_pmu_test.c +2 -2
@@ -24,7 +24,7 @@ union sbi_pmu_ctr_info ctrinfo_arr[RISCV_MAX_PMU_COUNTERS];/* Snapshot shared memory data */ #define PMU_SNAPSHOT_GPA_BASE BIT(30)static void *snapshot_gva; -static vm_paddr_t snapshot_gpa; +static gpa_t snapshot_gpa;static int vcpu_shared_irq_count;static int counter_in_use;
@@ -241,7 +241,7 @@ static inline void verify_sbi_requirement_assert(void)__GUEST_ASSERT (0 ,"SBI implementation version doesn't support PMU Snapshot" ); } -static void snapshot_set_shmem (vm_paddr_t gpa,unsigned long flags) +static void snapshot_set_shmem (gpa_t gpa,unsigned long flags) {unsigned long lo = (unsigned long )gpa;#if __riscv_xlen ==32
tools/testing/selftests/kvm/s390/ucontrol_test.c +1 -1
@@ -111,7 +111,7 @@ FIXTURE(uc_kvm)uintptr_t base_hva;uintptr_t code_hva;int kvm_run_size; -vm_paddr_t pgd; +gpa_t pgd;void *vm_mem;int vcpu_fd;int kvm_fd;
tools/testing/selftests/kvm/steal_time.c +2 -2
@@ -210,7 +210,7 @@ static void steal_time_dump(struct kvm_vm *vm, uint32_t vcpu_idx)/* SBI STA shmem must have 64-byte alignment */ #define STEAL_TIME_SIZE ((sizeof(struct sta_struct) + 63) & ~63) -static vm_paddr_t st_gpa[NR_VCPUS ]; +static gpa_t st_gpa[NR_VCPUS ];struct sta_struct {uint32_t sequence;
@@ -220,7 +220,7 @@ struct sta_struct {uint8_t pad[47 ]; } __packed; -static void sta_set_shmem (vm_paddr_t gpa,unsigned long flags) +static void sta_set_shmem (gpa_t gpa,unsigned long flags) {unsigned long lo = (unsigned long )gpa;#if __riscv_xlen ==32
tools/testing/selftests/kvm/x86/hyperv_clock.c +1 -1
@@ -98,7 +98,7 @@ static inline void check_tsc_msr_tsc_page(struct ms_hyperv_tsc_page *tsc_page)GUEST_ASSERT (r2 >= t1 && r2 - t2 <100000 ); } -static void guest_main (struct ms_hyperv_tsc_page *tsc_page,vm_paddr_t tsc_page_gpa) +static void guest_main (struct ms_hyperv_tsc_page *tsc_page,gpa_t tsc_page_gpa) {u64 tsc_scale, tsc_offset;
tools/testing/selftests/kvm/x86/hyperv_extended_hypercalls.c +1 -1
@@ -15,7 +15,7 @@/* Any value is fine */ #define EXT_CAPABILITIES 0xbull -static void guest_code (vm_paddr_t in_pg_gpa,vm_paddr_t out_pg_gpa, +static void guest_code (gpa_t in_pg_gpa,gpa_t out_pg_gpa,gva_t out_pg_gva) {uint64_t *output_gva;
tools/testing/selftests/kvm/x86/hyperv_tlb_flush.c +4 -4
@@ -62,7 +62,7 @@ struct hv_tlb_flush_ex {*/ struct test_data {gva_t hcall_gva; -vm_paddr_t hcall_gpa; +gpa_t hcall_gpa;gva_t test_pages;gva_t test_pages_pte[NTEST_PAGES ]; };
@@ -133,7 +133,7 @@ static void set_expected_val(void *addr, u64 val, int vcpu_id)* Update PTEs swapping two test pages. * TODO: use swap()/xchg() when these are provided. */ -static void swap_two_test_pages (vm_paddr_t pte_gva1,vm_paddr_t pte_gva2) +static void swap_two_test_pages (gpa_t pte_gva1,gpa_t pte_gva2) {uint64_t tmp = *(uint64_t *)pte_gva1;
@@ -201,7 +201,7 @@ 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;struct hv_tlb_flush_ex *flush_ex = (struct hv_tlb_flush_ex *)data->hcall_gva; -vm_paddr_t hcall_gpa = data->hcall_gpa; +gpa_t hcall_gpa = data->hcall_gpa;int i, stage =1 ;wrmsr (HV_X64_MSR_GUEST_OS_ID ,HYPERV_LINUX_OS_ID );
@@ -582,7 +582,7 @@ int main(int argc, char *argv[])struct kvm_vcpu *vcpu[3 ];pthread_t threads[2 ];gva_t test_data_page, gva; -vm_paddr_t gpa; +gpa_t gpa;uint64_t *pte;struct test_data *data;struct ucall uc;
tools/testing/selftests/kvm/x86/kvm_clock_test.c +2 -2
@@ -31,7 +31,7 @@ static struct test_case test_cases[] = {#define GUEST_SYNC_CLOCK (__stage, __val) \ GUEST_SYNC_ARGS(__stage, __val, 0, 0, 0) -static void guest_main (vm_paddr_t pvti_pa,struct pvclock_vcpu_time_info *pvti) +static void guest_main (gpa_t pvti_pa,struct pvclock_vcpu_time_info *pvti) {int i;
@@ -136,7 +136,7 @@ int main(void) {struct kvm_vcpu *vcpu;gva_t pvti_gva; -vm_paddr_t pvti_gpa; +gpa_t pvti_gpa;struct kvm_vm *vm;int flags;
Signature · 1 line
2.49.0.906.g1f30a19c02-goog
PATCH 3/10 KVM: selftests: Use gpa_t for GPAs in Hyper-V selftests
In reply to David MatlackFix various Hyper-V selftests to use gpa_t for variables that contain guest physical addresses, rather than gva_t.
No functional change intended.
--- tools/testing/selftests/kvm/x86/hyperv_evmcs.c | 2 +- tools/testing/selftests/kvm/x86/hyperv_features.c | 2 +- tools/testing/selftests/kvm/x86/hyperv_ipi.c | 6 +++--- tools/testing/selftests/kvm/x86/hyperv_svm_test.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
tools/testing/selftests/kvm/x86/hyperv_evmcs.c +1 -1
@@ -76,7 +76,7 @@ void l2_guest_code(void) }void guest_code (struct vmx_pages *vmx_pages,struct hyperv_test_pages *hv_pages, -gva_t hv_hcall_page_gpa) +gpa_t hv_hcall_page_gpa) {#define L2_GUEST_STACK_SIZE 64unsigned long l2_guest_stack[L2_GUEST_STACK_SIZE ];
tools/testing/selftests/kvm/x86/hyperv_features.c +1 -1
@@ -82,7 +82,7 @@ static void guest_msr(struct msr_data *msr)GUEST_DONE (); } -static void guest_hcall (gva_t pgs_gpa,struct hcall_data *hcall) +static void guest_hcall (gpa_t pgs_gpa,struct hcall_data *hcall) {u64 res, input, output;uint8_t vector;
tools/testing/selftests/kvm/x86/hyperv_ipi.c +3 -3
@@ -45,13 +45,13 @@ struct hv_send_ipi_ex {struct hv_vpset vp_set; }; -static inline void hv_init (gva_t pgs_gpa) +static inline void hv_init (gpa_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,gva_t pgs_gpa) +static void receiver_code (void *hcall_page,gpa_t pgs_gpa) {u32 vcpu_id;
@@ -85,7 +85,7 @@ static inline void nop_loop(void) asmvolatile ("nop" ); } -static void sender_guest_code (void *hcall_page,gva_t pgs_gpa) +static void sender_guest_code (void *hcall_page,gpa_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;
tools/testing/selftests/kvm/x86/hyperv_svm_test.c +1 -1
@@ -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, -gva_t pgs_gpa) +gpa_t pgs_gpa) {unsigned long l2_guest_stack[L2_GUEST_STACK_SIZE ];struct vmcb *vmcb = svm->vmcb;
Signature · 1 line
2.49.0.906.g1f30a19c02-goog
PATCH 4/10 KVM: selftests: Use u64 instead of uint64_t
In reply to David MatlackUse u64 instead of uint64_t to make the KVM selftests code more concise and more similar to the kernel (since selftests are primarily developed by kernel developers).
This commit was generated with the following command:
git ls-files tools/testing/selftests/kvm | xargs sed -i 's/uint64_t/u64/g'
Then by manually adjusting whitespace to make checkpatch.pl happy.
Also include <linux/types.h> in include/x86/pmu.h to avoid compilation failure.
No functional change intended.
--- .../selftests/kvm/access_tracking_perf_test.c | 40 ++--- .../selftests/kvm/arm64/aarch32_id_regs.c | 14 +- .../testing/selftests/kvm/arm64/arch_timer.c | 2 +- .../kvm/arm64/arch_timer_edge_cases.c | 115 +++++++------- .../selftests/kvm/arm64/debug-exceptions.c | 49 +++--- .../testing/selftests/kvm/arm64/hypercalls.c | 18 +-- .../testing/selftests/kvm/arm64/no-vgic-v3.c | 6 +- .../selftests/kvm/arm64/page_fault_test.c | 74 ++++----- tools/testing/selftests/kvm/arm64/psci_test.c | 26 ++-- .../testing/selftests/kvm/arm64/set_id_regs.c | 44 +++--- tools/testing/selftests/kvm/arm64/vgic_init.c | 26 ++-- tools/testing/selftests/kvm/arm64/vgic_irq.c | 36 ++--- .../selftests/kvm/arm64/vpmu_counter_access.c | 60 +++---- .../testing/selftests/kvm/coalesced_io_test.c | 14 +- .../selftests/kvm/demand_paging_test.c | 10 +- .../selftests/kvm/dirty_log_perf_test.c | 12 +- tools/testing/selftests/kvm/dirty_log_test.c | 44 +++--- .../testing/selftests/kvm/guest_memfd_test.c | 2 +- .../testing/selftests/kvm/guest_print_test.c | 14 +- .../selftests/kvm/include/arm64/arch_timer.h | 16 +- .../selftests/kvm/include/arm64/delay.h | 4 +- .../testing/selftests/kvm/include/arm64/gic.h | 2 +- .../selftests/kvm/include/arm64/processor.h | 14 +- .../selftests/kvm/include/arm64/vgic.h | 6 +- .../testing/selftests/kvm/include/kvm_util.h | 146 +++++++++--------- .../selftests/kvm/include/kvm_util_types.h | 4 +- .../testing/selftests/kvm/include/memstress.h | 20 +-- .../selftests/kvm/include/riscv/arch_timer.h | 20 +-- .../selftests/kvm/include/riscv/processor.h | 9 +- .../kvm/include/s390/diag318_test_handler.h | 2 +- .../selftests/kvm/include/s390/facility.h | 4 +- .../testing/selftests/kvm/include/sparsebit.h | 6 +- .../testing/selftests/kvm/include/test_util.h | 14 +- .../selftests/kvm/include/timer_test.h | 6 +- .../selftests/kvm/include/ucall_common.h | 14 +- .../selftests/kvm/include/userfaultfd_util.h | 6 +- .../testing/selftests/kvm/include/x86/apic.h | 8 +- .../testing/selftests/kvm/include/x86/evmcs.h | 18 +-- .../selftests/kvm/include/x86/hyperv.h | 14 +- .../selftests/kvm/include/x86/kvm_util_arch.h | 6 +- tools/testing/selftests/kvm/include/x86/pmu.h | 6 +- .../selftests/kvm/include/x86/processor.h | 116 +++++++------- tools/testing/selftests/kvm/include/x86/sev.h | 4 +- .../selftests/kvm/include/x86/svm_util.h | 8 +- tools/testing/selftests/kvm/include/x86/vmx.h | 56 +++---- .../selftests/kvm/kvm_page_table_test.c | 48 +++--- tools/testing/selftests/kvm/lib/arm64/gic.c | 4 +- .../selftests/kvm/lib/arm64/gic_private.h | 4 +- .../testing/selftests/kvm/lib/arm64/gic_v3.c | 20 +-- .../selftests/kvm/lib/arm64/processor.c | 84 +++++----- tools/testing/selftests/kvm/lib/arm64/ucall.c | 4 +- tools/testing/selftests/kvm/lib/arm64/vgic.c | 18 +-- tools/testing/selftests/kvm/lib/elf.c | 2 +- .../testing/selftests/kvm/lib/guest_sprintf.c | 10 +- tools/testing/selftests/kvm/lib/kvm_util.c | 92 +++++------ tools/testing/selftests/kvm/lib/memstress.c | 32 ++-- .../selftests/kvm/lib/riscv/processor.c | 30 ++-- .../kvm/lib/s390/diag318_test_handler.c | 12 +- .../testing/selftests/kvm/lib/s390/facility.c | 2 +- .../selftests/kvm/lib/s390/processor.c | 22 +-- tools/testing/selftests/kvm/lib/sparsebit.c | 12 +- tools/testing/selftests/kvm/lib/test_util.c | 2 +- .../testing/selftests/kvm/lib/ucall_common.c | 16 +- .../selftests/kvm/lib/userfaultfd_util.c | 12 +- tools/testing/selftests/kvm/lib/x86/apic.c | 2 +- tools/testing/selftests/kvm/lib/x86/hyperv.c | 4 +- .../testing/selftests/kvm/lib/x86/memstress.c | 8 +- tools/testing/selftests/kvm/lib/x86/pmu.c | 4 +- .../testing/selftests/kvm/lib/x86/processor.c | 100 ++++++------ tools/testing/selftests/kvm/lib/x86/sev.c | 4 +- tools/testing/selftests/kvm/lib/x86/svm.c | 6 +- tools/testing/selftests/kvm/lib/x86/vmx.c | 70 ++++----- .../kvm/memslot_modification_stress_test.c | 10 +- .../testing/selftests/kvm/memslot_perf_test.c | 114 +++++++------- tools/testing/selftests/kvm/mmu_stress_test.c | 26 ++-- .../selftests/kvm/pre_fault_memory_test.c | 12 +- .../testing/selftests/kvm/riscv/arch_timer.c | 2 +- .../testing/selftests/kvm/riscv/ebreak_test.c | 6 +- .../selftests/kvm/riscv/get-reg-list.c | 2 +- .../selftests/kvm/riscv/sbi_pmu_test.c | 2 +- tools/testing/selftests/kvm/s390/debug_test.c | 8 +- tools/testing/selftests/kvm/s390/memop.c | 32 ++-- tools/testing/selftests/kvm/s390/resets.c | 4 +- tools/testing/selftests/kvm/s390/tprot.c | 2 +- .../selftests/kvm/set_memory_region_test.c | 30 ++-- tools/testing/selftests/kvm/steal_time.c | 16 +- .../kvm/system_counter_offset_test.c | 12 +- tools/testing/selftests/kvm/x86/amx_test.c | 2 +- .../selftests/kvm/x86/apic_bus_clock_test.c | 12 +- tools/testing/selftests/kvm/x86/debug_regs.c | 2 +- .../kvm/x86/dirty_log_page_splitting_test.c | 16 +- .../selftests/kvm/x86/feature_msrs_test.c | 4 +- .../selftests/kvm/x86/fix_hypercall_test.c | 10 +- .../selftests/kvm/x86/flds_emulation.h | 4 +- .../testing/selftests/kvm/x86/hwcr_msr_test.c | 10 +- .../kvm/x86/hyperv_extended_hypercalls.c | 8 +- .../selftests/kvm/x86/hyperv_features.c | 6 +- tools/testing/selftests/kvm/x86/hyperv_ipi.c | 2 +- .../selftests/kvm/x86/hyperv_tlb_flush.c | 8 +- .../selftests/kvm/x86/kvm_clock_test.c | 4 +- tools/testing/selftests/kvm/x86/kvm_pv_test.c | 6 +- .../selftests/kvm/x86/monitor_mwait_test.c | 2 +- .../selftests/kvm/x86/nx_huge_pages_test.c | 18 +-- .../selftests/kvm/x86/platform_info_test.c | 4 +- .../selftests/kvm/x86/pmu_counters_test.c | 32 ++-- .../selftests/kvm/x86/pmu_event_filter_test.c | 78 +++++----- .../kvm/x86/private_mem_conversions_test.c | 50 +++--- .../kvm/x86/private_mem_kvm_exits_test.c | 8 +- .../selftests/kvm/x86/set_sregs_test.c | 6 +- .../selftests/kvm/x86/sev_init2_tests.c | 4 +- .../selftests/kvm/x86/sev_smoke_test.c | 2 +- .../x86/smaller_maxphyaddr_emulation_test.c | 10 +- tools/testing/selftests/kvm/x86/smm_test.c | 4 +- tools/testing/selftests/kvm/x86/state_test.c | 8 +- .../kvm/x86/svm_nested_soft_inject_test.c | 4 +- .../testing/selftests/kvm/x86/tsc_msrs_test.c | 2 +- .../selftests/kvm/x86/tsc_scaling_sync.c | 4 +- .../selftests/kvm/x86/ucna_injection_test.c | 43 +++--- .../kvm/x86/userspace_msr_exit_test.c | 24 +-- .../selftests/kvm/x86/vmx_dirty_log_test.c | 2 +- .../testing/selftests/kvm/x86/vmx_msrs_test.c | 18 +-- .../kvm/x86/vmx_nested_tsc_scaling_test.c | 20 +-- .../selftests/kvm/x86/vmx_pmu_caps_test.c | 10 +- .../selftests/kvm/x86/vmx_tsc_adjust_test.c | 2 +- .../selftests/kvm/x86/xapic_ipi_test.c | 38 ++--- .../selftests/kvm/x86/xapic_state_test.c | 16 +- .../selftests/kvm/x86/xcr0_cpuid_test.c | 8 +- .../selftests/kvm/x86/xen_shinfo_test.c | 12 +- .../testing/selftests/kvm/x86/xss_msr_test.c | 2 +- 129 files changed, 1276 insertions(+), 1286 deletions(-)
tools/testing/selftests/kvm/access_tracking_perf_test.c +20 -20
@@ -70,15 +70,15 @@ struct test_params {enum vm_mem_backing_src_type backing_src;/* The amount of memory to allocate for each vCPU. */ -uint64_t vcpu_memory_bytes; +u64 vcpu_memory_bytes;/* The number of vCPUs to create in the VM. */ int nr_vcpus; }; -static uint64_t pread_uint64 (int fd,const char *filename,uint64_t index) +static u64 pread_uint64 (int fd,const char *filename,u64 index) { -uint64_t value; +u64 value;off_t offset = index *sizeof (value); TEST_ASSERT(pread(fd, &value, sizeof(value), offset) == sizeof(value),
@@ -92,11 +92,11 @@ static uint64_t pread_uint64(int fd, const char *filename, uint64_t index)#define PAGEMAP_PRESENT (1ULL << 63)#define PAGEMAP_PFN_MASK ((1ULL << 55) - 1) -static uint64_t lookup_pfn (int pagemap_fd,struct kvm_vm *vm,uint64_t gva) +static u64 lookup_pfn (int pagemap_fd,struct kvm_vm *vm,u64 gva) { -uint64_t hva = (uint64_t )addr_gva2hva (vm, gva); -uint64_t entry; -uint64_t pfn; +u64 hva = (u64 )addr_gva2hva (vm, gva); +u64 entry; +u64 pfn; entry =pread_uint64 (pagemap_fd,"pagemap" , hva /getpagesize ());if (!(entry &PAGEMAP_PRESENT ))
@@ -108,16 +108,16 @@ static uint64_t lookup_pfn(int pagemap_fd, struct kvm_vm *vm, uint64_t gva)return pfn; } -static bool is_page_idle (int page_idle_fd,uint64_t pfn) +static bool is_page_idle (int page_idle_fd,u64 pfn) { -uint64_t bits =pread_uint64 (page_idle_fd,"page_idle" , pfn /64 ); +u64 bits =pread_uint64 (page_idle_fd,"page_idle" , pfn /64 );return !!((bits >> (pfn %64 )) &1 ); } -static void mark_page_idle (int page_idle_fd,uint64_t pfn) +static void mark_page_idle (int page_idle_fd,u64 pfn) { -uint64_t bits =1ULL << (pfn %64 ); +u64 bits =1ULL << (pfn %64 );TEST_ASSERT (pwrite (page_idle_fd, &bits,8 ,8 * (pfn /64 )) ==8 ,"Set page_idle bits for PFN 0x%" PRIx64, pfn);
@@ -127,11 +127,11 @@ static void mark_vcpu_memory_idle(struct kvm_vm *vm, struct memstress_vcpu_args *vcpu_args) {int vcpu_idx = vcpu_args->vcpu_idx; -uint64_t base_gva = vcpu_args->gva; -uint64_t pages = vcpu_args->pages; -uint64_t page; -uint64_t still_idle =0 ; -uint64_t no_pfn =0 ; +u64 base_gva = vcpu_args->gva; +u64 pages = vcpu_args->pages; +u64 page; +u64 still_idle =0 ; +u64 no_pfn =0 ;int page_idle_fd;int pagemap_fd;
@@ -146,8 +146,8 @@ static void mark_vcpu_memory_idle(struct kvm_vm *vm,TEST_ASSERT (pagemap_fd >0 ,"Failed to open pagemap." );for (page =0 ; page < pages; page++) { -uint64_t gva = base_gva + page * memstress_args.guest_page_size; -uint64_t pfn =lookup_pfn (pagemap_fd, vm, gva); +u64 gva = base_gva + page * memstress_args.guest_page_size; +u64 pfn =lookup_pfn (pagemap_fd, vm, gva);if (!pfn) { no_pfn++;
@@ -198,10 +198,10 @@ static void mark_vcpu_memory_idle(struct kvm_vm *vm,close (pagemap_fd); } -static void assert_ucall (struct kvm_vcpu *vcpu,uint64_t expected_ucall) +static void assert_ucall (struct kvm_vcpu *vcpu,u64 expected_ucall) {struct ucall uc; -uint64_t actual_ucall =get_ucall (vcpu, &uc); +u64 actual_ucall =get_ucall (vcpu, &uc);TEST_ASSERT (expected_ucall == actual_ucall, "Guest exited unexpectedly (expected ucall %" PRIu64
tools/testing/selftests/kvm/arm64/aarch32_id_regs.c +7 -7
@@ -66,7 +66,7 @@ static void test_guest_raz(struct kvm_vcpu *vcpu) } } -static uint64_t raz_wi_reg_ids[] = { +static u64 raz_wi_reg_ids[] = {KVM_ARM64_SYS_REG (SYS_ID_PFR0_EL1 ),KVM_ARM64_SYS_REG (SYS_ID_PFR1_EL1 ),KVM_ARM64_SYS_REG (SYS_ID_DFR0_EL1 ),
@@ -94,8 +94,8 @@ static void test_user_raz_wi(struct kvm_vcpu *vcpu)int i;for (i =0 ; i <ARRAY_SIZE (raz_wi_reg_ids); i++) { -uint64_t reg_id = raz_wi_reg_ids[i]; -uint64_t val; +u64 reg_id = raz_wi_reg_ids[i]; +u64 val; val =vcpu_get_reg (vcpu, reg_id);TEST_ASSERT_EQ (val,0 );
@@ -111,7 +111,7 @@ static void test_user_raz_wi(struct kvm_vcpu *vcpu) } } -static uint64_t raz_invariant_reg_ids[] = { +static u64 raz_invariant_reg_ids[] = {KVM_ARM64_SYS_REG (SYS_ID_AFR0_EL1 ),KVM_ARM64_SYS_REG (sys_reg (3 ,0 ,0 ,3 ,3 )),KVM_ARM64_SYS_REG (SYS_ID_DFR1_EL1 ),
@@ -123,8 +123,8 @@ static void test_user_raz_invariant(struct kvm_vcpu *vcpu)int i, r;for (i =0 ; i <ARRAY_SIZE (raz_invariant_reg_ids); i++) { -uint64_t reg_id = raz_invariant_reg_ids[i]; -uint64_t val; +u64 reg_id = raz_invariant_reg_ids[i]; +u64 val; val =vcpu_get_reg (vcpu, reg_id);TEST_ASSERT_EQ (val,0 );
@@ -142,7 +142,7 @@ static void test_user_raz_invariant(struct kvm_vcpu *vcpu)static bool vcpu_aarch64_only (struct kvm_vcpu *vcpu) { -uint64_t val, el0; +u64 val, el0; val =vcpu_get_reg (vcpu,KVM_ARM64_SYS_REG (SYS_ID_AA64PFR0_EL1 ));
tools/testing/selftests/kvm/arm64/arch_timer.c +1 -1
@@ -56,7 +56,7 @@ static void guest_validate_irq(unsigned int intid, struct test_vcpu_shared_data *shared_data) {enum guest_stage stage = shared_data->guest_stage; -uint64_t xcnt =0 , xcnt_diff_us, cval =0 ; +u64 xcnt =0 , xcnt_diff_us, cval =0 ;unsigned long xctl =0 ;unsigned int timer_irq =0 ;unsigned int accessor;
tools/testing/selftests/kvm/arm64/arch_timer_edge_cases.c +57 -58
340 lines not on this page · raw message
tools/testing/selftests/kvm/arm64/debug-exceptions.c +24 -25
137 lines not on this page · raw message
tools/testing/selftests/kvm/arm64/hypercalls.c +9 -9
@@ -29,9 +29,9 @@#define KVM_REG_ARM_VENDOR_HYP_BMAP_2_RESET_VAL 0struct kvm_fw_reg_info { -uint64_t reg;/* Register definition */ -uint64_t max_feat_bit;/* Bit that represents the upper limit of the feature-map */ -uint64_t reset_val;/* Reset value for the register */ +u64 reg;/* Register definition */ +u64 max_feat_bit;/* Bit that represents the upper limit of the feature-map */ +u64 reset_val;/* Reset value for the register */ };#define FW_REG_INFO (r) \
@@ -60,7 +60,7 @@ static int stage = TEST_STAGE_REG_IFACE;struct test_hvc_info {uint32_t func_id; -uint64_t arg1; +u64 arg1; };#define TEST_HVC_INFO (f, a1) \
@@ -154,7 +154,7 @@ static void guest_code(void)struct st_time {uint32_t rev;uint32_t attr; -uint64_t st_time; +u64 st_time; };#define STEAL_TIME_SIZE ((sizeof(struct st_time) + 63) & ~63)
@@ -162,7 +162,7 @@ struct st_time {static void steal_time_init (struct kvm_vcpu *vcpu) { -uint64_t st_ipa = (ulong )ST_GPA_BASE ; +u64 st_ipa = (ulong )ST_GPA_BASE ;unsigned int gpages; gpages =vm_calc_num_guest_pages (VM_MODE_DEFAULT ,STEAL_TIME_SIZE );
@@ -174,13 +174,13 @@ static void steal_time_init(struct kvm_vcpu *vcpu)static void test_fw_regs_before_vm_start (struct kvm_vcpu *vcpu) { -uint64_t val; +u64 val;unsigned int i;int ret;for (i =0 ; i <ARRAY_SIZE (fw_reg_info); i++) {const struct kvm_fw_reg_info *reg_info = &fw_reg_info[i]; -uint64_t set_val; +u64 set_val;/* First 'read' should be the reset value for the reg */ val =vcpu_get_reg (vcpu, reg_info->reg);
@@ -229,7 +229,7 @@ static void test_fw_regs_before_vm_start(struct kvm_vcpu *vcpu)static void test_fw_regs_after_vm_start (struct kvm_vcpu *vcpu) { -uint64_t val; +u64 val;unsigned int i;int ret;
tools/testing/selftests/kvm/arm64/no-vgic-v3.c +3 -3
@@ -11,7 +11,7 @@ static volatile bool handled;#define __check_sr_read (r) \ ({ \ - uint64_t val; \ + u64 val; \ \ handled = false; \ dsb(sy); \
@@ -48,7 +48,7 @@ static volatile bool handled;static void guest_code (void ) { -uint64_t val; +u64 val;/* * Check that we advertise that ID_AA64PFR0_EL1.GIC == 0, having
@@ -161,7 +161,7 @@ int main(int argc, char *argv[]) {struct kvm_vcpu *vcpu;struct kvm_vm *vm; -uint64_t pfr0; +u64 pfr0; vm =vm_create_with_one_vcpu (&vcpu,NULL ); pfr0 =vcpu_get_reg (vcpu,KVM_ARM64_SYS_REG (SYS_ID_AA64PFR0_EL1 ));
tools/testing/selftests/kvm/arm64/page_fault_test.c +37 -37
226 lines not on this page · raw message
tools/testing/selftests/kvm/arm64/psci_test.c +12 -14
@@ -22,8 +22,7 @@#define CPU_ON_ENTRY_ADDR 0xfeedf00dul#define CPU_ON_CONTEXT_ID 0xdeadc0deul -static uint64_t psci_cpu_on (uint64_t target_cpu,uint64_t entry_addr, -uint64_t context_id) +static u64 psci_cpu_on (u64 target_cpu,u64 entry_addr,u64 context_id) {struct arm_smccc_res res;
@@ -33,8 +32,7 @@ static uint64_t psci_cpu_on(uint64_t target_cpu, uint64_t entry_addr,return res.a0; } -static uint64_t psci_affinity_info (uint64_t target_affinity, -uint64_t lowest_affinity_level) +static u64 psci_affinity_info (u64 target_affinity,u64 lowest_affinity_level) {struct arm_smccc_res res;
@@ -44,7 +42,7 @@ static uint64_t psci_affinity_info(uint64_t target_affinity,return res.a0; } -static uint64_t psci_system_suspend (uint64_t entry_addr,uint64_t context_id) +static u64 psci_system_suspend (u64 entry_addr,u64 context_id) {struct arm_smccc_res res;
@@ -54,7 +52,7 @@ static uint64_t psci_system_suspend(uint64_t entry_addr, uint64_t context_id)return res.a0; } -static uint64_t psci_system_off2 (uint64_t type,uint64_t cookie) +static u64 psci_system_off2 (u64 type,u64 cookie) {struct arm_smccc_res res;
@@ -63,7 +61,7 @@ static uint64_t psci_system_off2(uint64_t type, uint64_t cookie)return res.a0; } -static uint64_t psci_features (uint32_t func_id) +static u64 psci_features (uint32_t func_id) {struct arm_smccc_res res;
@@ -109,7 +107,7 @@ static void enter_guest(struct kvm_vcpu *vcpu)static void assert_vcpu_reset (struct kvm_vcpu *vcpu) { -uint64_t obs_pc, obs_x0; +u64 obs_pc, obs_x0; obs_pc =vcpu_get_reg (vcpu,ARM64_CORE_REG (regs.pc)); obs_x0 =vcpu_get_reg (vcpu,ARM64_CORE_REG (regs.regs[0 ]));
@@ -122,9 +120,9 @@ static void assert_vcpu_reset(struct kvm_vcpu *vcpu) obs_x0, CPU_ON_CONTEXT_ID); } -static void guest_test_cpu_on (uint64_t target_cpu) +static void guest_test_cpu_on (u64 target_cpu) { -uint64_t target_state; +u64 target_state;GUEST_ASSERT (!psci_cpu_on (target_cpu,CPU_ON_ENTRY_ADDR ,CPU_ON_CONTEXT_ID ));
@@ -141,7 +139,7 @@ static void guest_test_cpu_on(uint64_t target_cpu)static void host_test_cpu_on (void ) {struct kvm_vcpu *source, *target; -uint64_t target_mpidr; +u64 target_mpidr;struct kvm_vm *vm;struct ucall uc;
@@ -165,7 +163,7 @@ static void host_test_cpu_on(void)static void guest_test_system_suspend (void ) { -uint64_t ret; +u64 ret;/* assert that SYSTEM_SUSPEND is discoverable */ GUEST_ASSERT (!psci_features (PSCI_1_0_FN_SYSTEM_SUSPEND ));
@@ -199,7 +197,7 @@ static void host_test_system_suspend(void)static void guest_test_system_off2 (void ) { -uint64_t ret; +u64 ret;/* assert that SYSTEM_OFF2 is discoverable */ GUEST_ASSERT(psci_features(PSCI_1_3_FN_SYSTEM_OFF2) &
@@ -237,7 +235,7 @@ static void host_test_system_off2(void) {struct kvm_vcpu *source, *target;struct kvm_mp_state mps; -uint64_t psci_version =0 ; +u64 psci_version =0 ;int nr_shutdowns =0 ;struct kvm_run *run;struct ucall uc;
tools/testing/selftests/kvm/arm64/set_id_regs.c +22 -22
136 lines not on this page · raw message
tools/testing/selftests/kvm/arm64/vgic_init.c +13 -13
@@ -16,7 +16,7 @@#define NR_VCPUS 4 -#define REG_OFFSET (vcpu, offset) (((uint64_t)vcpu << 32) | offset) +#define REG_OFFSET (vcpu, offset) (((u64)(vcpu) << 32) | (offset))#define GICR_TYPER 0x8
@@ -29,7 +29,7 @@ struct vm_gic {uint32_t gic_dev_type; }; -static uint64_t max_phys_size; +static u64 max_phys_size;/* * Helpers to access a redistributor register and verify the ioctl() failed or
@@ -102,9 +102,9 @@ static void vm_gic_destroy(struct vm_gic *v) }struct vgic_region_attr { -uint64_t attr; -uint64_t size; -uint64_t alignment; +u64 attr; +u64 size; +u64 alignment; };struct vgic_region_attr gic_v3_dist_region = {
@@ -142,7 +142,7 @@ struct vgic_region_attr gic_v2_cpu_region = {static void subtest_dist_rdist (struct vm_gic *v) {int ret; -uint64_t addr; +u64 addr;struct vgic_region_attr rdist;/* CPU interface in GICv2*/ struct vgic_region_attr dist;
@@ -222,7 +222,7 @@ static void subtest_dist_rdist(struct vm_gic *v)/* Test the new REDIST region API */ static void subtest_v3_redist_regions (struct vm_gic *v) { -uint64_t addr, expected_addr; +u64 addr, expected_addr;int ret; ret = __kvm_has_device_attr(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
@@ -407,7 +407,7 @@ static void test_v3_new_redist_regions(void)struct kvm_vcpu *vcpus[NR_VCPUS ];void *dummy =NULL ;struct vm_gic v; -uint64_t addr; +u64 addr;int ret; v =vm_gic_create_with_vcpus (KVM_DEV_TYPE_ARM_VGIC_V3 ,NR_VCPUS , vcpus);
@@ -459,7 +459,7 @@ static void test_v3_new_redist_regions(void)static void test_v3_typer_accesses (void ) {struct vm_gic v; -uint64_t addr; +u64 addr;int ret, i; v.vm =vm_create (NR_VCPUS );
@@ -545,7 +545,7 @@ static void test_v3_last_bit_redist_regions(void) {uint32_t vcpuids[] = {0 ,3 ,5 ,4 ,1 ,2 };struct vm_gic v; -uint64_t addr; +u64 addr; v =vm_gic_v3_create_with_vcpuids (ARRAY_SIZE (vcpuids), vcpuids);
@@ -579,7 +579,7 @@ static void test_v3_last_bit_single_rdist(void) {uint32_t vcpuids[] = {0 ,3 ,5 ,4 ,1 ,2 };struct vm_gic v; -uint64_t addr; +u64 addr; v =vm_gic_v3_create_with_vcpuids (ARRAY_SIZE (vcpuids), vcpuids);
@@ -605,7 +605,7 @@ static void test_v3_redist_ipa_range_check_at_vcpu_run(void)struct kvm_vcpu *vcpus[NR_VCPUS ];struct vm_gic v;int ret, i; -uint64_t addr; +u64 addr; v =vm_gic_create_with_vcpus (KVM_DEV_TYPE_ARM_VGIC_V3 ,1 , vcpus);
@@ -637,7 +637,7 @@ static void test_v3_its_region(void) {struct kvm_vcpu *vcpus[NR_VCPUS ];struct vm_gic v; -uint64_t addr; +u64 addr;int its_fd, ret; v =vm_gic_create_with_vcpus (KVM_DEV_TYPE_ARM_VGIC_V3 ,NR_VCPUS , vcpus);
tools/testing/selftests/kvm/arm64/vgic_irq.c +18 -18
@@ -132,7 +132,7 @@ static struct kvm_inject_desc set_active_fns[] = {for_each_supported_inject_fn ((args), (t), (f))/* Shared between the guest main thread and the IRQ handlers. */ -volatile uint64_t irq_handled; +volatile u64 irq_handled;volatile uint32_t irqnr_received[MAX_SPI +1 ];static void reset_stats (void )
@@ -144,15 +144,15 @@ static void reset_stats(void) irqnr_received[i] =0 ; } -static uint64_t gic_read_ap1r0 (void ) +static u64 gic_read_ap1r0 (void ) { -uint64_t reg =read_sysreg_s (SYS_ICC_AP1R0_EL1 ); +u64 reg =read_sysreg_s (SYS_ICC_AP1R0_EL1 );dsb (sy);return reg; } -static void gic_write_ap1r0 (uint64_t val) +static void gic_write_ap1r0 (u64 val) {write_sysreg_s (val,SYS_ICC_AP1R0_EL1 );isb ();
@@ -555,12 +555,12 @@ static void kvm_set_gsi_routing_irqchip_check(struct kvm_vm *vm, {struct kvm_irq_routing *routing;int ret; -uint64_t i; +u64 i;assert (num <= kvm_max_routes && kvm_max_routes <=KVM_MAX_IRQ_ROUTES ); routing =kvm_gsi_routing_create (); -for (i = intid; i < (uint64_t )intid + num; i++) +for (i = intid; i < (u64 )intid + num; i++)kvm_gsi_routing_irqchip_add (routing, i -MIN_SPI , i -MIN_SPI );if (!expect_failure) {
@@ -568,7 +568,7 @@ static void kvm_set_gsi_routing_irqchip_check(struct kvm_vm *vm, }else { ret =_kvm_gsi_routing_write (vm, routing);/* The kernel only checks e->irqchip.pin >= KVM_IRQCHIP_NUM_PINS */ -if (((uint64_t )intid + num -1 -MIN_SPI ) >=KVM_IRQCHIP_NUM_PINS ) +if (((u64 )intid + num -1 -MIN_SPI ) >=KVM_IRQCHIP_NUM_PINS )TEST_ASSERT (ret !=0 && errno ==EINVAL ,"Bad intid %u did not cause KVM_SET_GSI_ROUTING " "error: rc: %i errno: %i" , intid, ret, errno);
@@ -599,9 +599,9 @@ static void kvm_routing_and_irqfd_check(struct kvm_vm *vm, bool expect_failure) {int fd[MAX_SPI ]; -uint64_t val; +u64 val;int ret, f; -uint64_t i; +u64 i;/* * There is no way to try injecting an SGI or PPI as the interface
@@ -620,35 +620,35 @@ static void kvm_routing_and_irqfd_check(struct kvm_vm *vm,* that no actual interrupt was injected for those cases. */ -for (f =0 , i = intid; i < (uint64_t )intid + num; i++, f++) { +for (f =0 , i = intid; i < (u64 )intid + num; i++, f++) { fd[f] =eventfd (0 ,0 );TEST_ASSERT (fd[f] !=-1 ,__KVM_SYSCALL_ERROR ("eventfd()" , fd[f])); } -for (f =0 , i = intid; i < (uint64_t )intid + num; i++, f++) { +for (f =0 , i = intid; i < (u64 )intid + num; i++, f++) {struct kvm_irqfd irqfd = { .fd = fd[f], .gsi = i -MIN_SPI , }; -assert (i <= (uint64_t )UINT_MAX ); +assert (i <= (u64 )UINT_MAX );vm_ioctl (vm,KVM_IRQFD , &irqfd); } -for (f =0 , i = intid; i < (uint64_t )intid + num; i++, f++) { +for (f =0 , i = intid; i < (u64 )intid + num; i++, f++) { val =1 ; - ret =write (fd[f], &val,sizeof (uint64_t )); -TEST_ASSERT (ret ==sizeof (uint64_t ), + ret =write (fd[f], &val,sizeof (u64)); +TEST_ASSERT (ret ==sizeof (u64),__KVM_SYSCALL_ERROR ("write()" , ret)); } -for (f =0 , i = intid; i < (uint64_t )intid + num; i++, f++) +for (f =0 , i = intid; i < (u64 )intid + num; i++, f++)close (fd[f]); }/* handles the valid case: intid=0xffffffff num=1 */ #define for_each_intid (first, num, tmp, i) \ for ((tmp) = (i) = (first); \ - (tmp) < (uint64_t)(first) + (uint64_t)(num); \ + (tmp) < (u64)(first) + (u64)(num); \ (tmp)++, (i)++) static void run_guest_cmd(struct kvm_vcpu *vcpu, int gic_fd,
@@ -661,7 +661,7 @@ static void run_guest_cmd(struct kvm_vcpu *vcpu, int gic_fd,int level = inject_args->level;bool expect_failure = inject_args->expect_failure;struct kvm_vm *vm = vcpu->vm; -uint64_t tmp; +u64 tmp;uint32_t i;/* handles the valid case: intid=0xffffffff num=1 */
tools/testing/selftests/kvm/arm64/vpmu_counter_access.c +30 -30
189 lines not on this page · raw message
tools/testing/selftests/kvm/coalesced_io_test.c +7 -7
@@ -15,8 +15,8 @@struct kvm_coalesced_io {struct kvm_coalesced_mmio_ring *ring;uint32_t ring_size; -uint64_t mmio_gpa; -uint64_t *mmio; +u64 mmio_gpa; +u64 *mmio;/* * x86-only, but define pio_port for all architectures to minimize the
@@ -94,7 +94,7 @@ static void vcpu_run_and_verify_io_exit(struct kvm_vcpu *vcpu, TEST_ASSERT((!want_pio && (run->exit_reason == KVM_EXIT_MMIO && run->mmio.is_write && run->mmio.phys_addr == io->mmio_gpa && run->mmio.len == 8 && - *(uint64_t *)run->mmio.data == io->mmio_gpa + io->ring_size - 1)) || + *(u64 *)run->mmio.data == io->mmio_gpa + io->ring_size - 1)) || (want_pio && (run->exit_reason == KVM_EXIT_IO && run->io.port == io->pio_port && run->io.direction == KVM_EXIT_IO_OUT && run->io.count == 1 && pio_value == io->pio_port + io->ring_size - 1)),
@@ -105,7 +105,7 @@ static void vcpu_run_and_verify_io_exit(struct kvm_vcpu *vcpu, want_pio ? (unsigned long long )io->pio_port : io->mmio_gpa, (want_pio ? io->pio_port : io->mmio_gpa) + io->ring_size -1 , run->exit_reason, run->exit_reason ==KVM_EXIT_MMIO ?"MMIO" : run->exit_reason ==KVM_EXIT_IO ?"PIO" :"other" , - run->mmio.phys_addr, run->mmio.is_write, run->mmio.len, *(uint64_t *)run->mmio.data, + run->mmio.phys_addr, run->mmio.is_write, run->mmio.len, *(u64 *)run->mmio.data, run->io.port, run->io.direction, run->io.size, run->io.count, pio_value); }
@@ -143,7 +143,7 @@ static void vcpu_run_and_verify_coalesced_io(struct kvm_vcpu *vcpu,"Wanted 8-byte MMIO to 0x%lx = %lx in entry %u, got %u-byte %s 0x%llx = 0x%lx" , io->mmio_gpa, io->mmio_gpa + i, i, entry->len, entry->pio ?"PIO" :"MMIO" , - entry->phys_addr, *(uint64_t *)entry->data); + entry->phys_addr, *(u64 *)entry->data); } }
@@ -219,11 +219,11 @@ int main(int argc, char *argv[])* the MMIO GPA identity mapped in the guest. */ .mmio_gpa = 4ull * SZ_1G, - .mmio = (uint64_t *)(4ull * SZ_1G), + .mmio = (u64 *)(4ull * SZ_1G), .pio_port = 0x80, }; -virt_map (vm, (uint64_t )kvm_builtin_io_ring.mmio, kvm_builtin_io_ring.mmio_gpa,1 ); +virt_map (vm, (u64 )kvm_builtin_io_ring.mmio, kvm_builtin_io_ring.mmio_gpa,1 );sync_global_to_guest (vm, kvm_builtin_io_ring);vcpu_args_set (vcpu,1 , &kvm_builtin_io_ring);
tools/testing/selftests/kvm/demand_paging_test.c +5 -5
@@ -24,7 +24,7 @@#ifdef __NR_userfaultfdstatic int nr_vcpus =1 ; -static uint64_t guest_percpu_mem_size =DEFAULT_PER_VCPU_MEM_SIZE ; +static u64 guest_percpu_mem_size =DEFAULT_PER_VCPU_MEM_SIZE ;static size_t demand_paging_size;static char *guest_data_prototype;
@@ -58,7 +58,7 @@ static int handle_uffd_page_request(int uffd_mode, int uffd, struct uffd_msg *msg) {pid_t tid =syscall (__NR_gettid); -uint64_t addr = msg->arg.pagefault.address; +u64 addr = msg->arg.pagefault.address;struct timespec start;struct timespec ts_diff;int r;
@@ -68,7 +68,7 @@ static int handle_uffd_page_request(int uffd_mode, int uffd,if (uffd_mode ==UFFDIO_REGISTER_MODE_MISSING ) {struct uffdio_copy copy; - copy.src = (uint64_t )guest_data_prototype; + copy.src = (u64 )guest_data_prototype; copy.dst = addr; copy.len = demand_paging_size; copy.mode =0 ;
@@ -138,7 +138,7 @@ struct test_params {bool partition_vcpu_memory_access; }; -static void prefault_mem (void *alias,uint64_t len) +static void prefault_mem (void *alias,u64 len) {size_t p;
@@ -154,7 +154,7 @@ static void run_test(enum vm_guest_mode mode, void *arg)struct memstress_vcpu_args *vcpu_args;struct test_params *p = arg;struct uffd_desc **uffd_descs =NULL ; -uint64_t uffd_region_size; +u64 uffd_region_size;struct timespec start;struct timespec ts_diff;double vcpu_paging_rate;
tools/testing/selftests/kvm/dirty_log_perf_test.c +6 -6
@@ -56,7 +56,7 @@ static void arch_cleanup_vm(struct kvm_vm *vm)#define TEST_HOST_LOOP_N 2ULstatic int nr_vcpus =1 ; -static uint64_t guest_percpu_mem_size =DEFAULT_PER_VCPU_MEM_SIZE ; +static u64 guest_percpu_mem_size =DEFAULT_PER_VCPU_MEM_SIZE ;static bool run_vcpus_while_disabling_dirty_logging;/* Host variables */
@@ -69,7 +69,7 @@ static void vcpu_worker(struct memstress_vcpu_args *vcpu_args) {struct kvm_vcpu *vcpu = vcpu_args->vcpu;int vcpu_idx = vcpu_args->vcpu_idx; -uint64_t pages_count =0 ; +u64 pages_count =0 ;struct kvm_run *run;struct timespec start;struct timespec ts_diff;
@@ -125,7 +125,7 @@ static void vcpu_worker(struct memstress_vcpu_args *vcpu_args)struct test_params {unsigned long iterations; -uint64_t phys_offset; +u64 phys_offset;bool partition_vcpu_memory_access;enum vm_mem_backing_src_type backing_src;int slots;
@@ -138,9 +138,9 @@ static void run_test(enum vm_guest_mode mode, void *arg)struct test_params *p = arg;struct kvm_vm *vm;unsigned long **bitmaps; -uint64_t guest_num_pages; -uint64_t host_num_pages; -uint64_t pages_per_slot; +u64 guest_num_pages; +u64 host_num_pages; +u64 pages_per_slot;struct timespec start;struct timespec ts_diff;struct timespec get_dirty_log_total = (struct timespec ){0 };
tools/testing/selftests/kvm/dirty_log_test.c +22 -22
127 lines not on this page · raw message
tools/testing/selftests/kvm/guest_memfd_test.c +1 -1
@@ -123,7 +123,7 @@ static void test_invalid_punch_hole(int fd, size_t page_size, size_t total_size)static void test_create_guest_memfd_invalid (struct kvm_vm *vm) {size_t page_size =getpagesize (); -uint64_t flag; +u64 flag;size_t size;int fd;
tools/testing/selftests/kvm/guest_print_test.c +7 -7
@@ -16,9 +16,9 @@#include "ucall_common.h" struct guest_vals { -uint64_t a; -uint64_t b; -uint64_t type; +u64 a; +u64 b; +u64 type; };static struct guest_vals vals;
@@ -26,9 +26,9 @@ static struct guest_vals vals;/* GUEST_PRINTF()/GUEST_ASSERT_FMT() does not support float or double. */ #define TYPE_LIST \ TYPE(test_type_i64, I64, "%ld", int64_t) \ -TYPE(test_type_u64, U64u, "%lu", uint64_t) \ -TYPE(test_type_x64, U64x, "0x%lx", uint64_t) \ -TYPE(test_type_X64, U64X, "0x%lX", uint64_t) \ +TYPE(test_type_u64, U64u, "%lu", u64) \ +TYPE(test_type_x64, U64x, "0x%lx", u64) \ +TYPE(test_type_X64, U64X, "0x%lX", u64) \ TYPE(test_type_u32, U32u, "%u", uint32_t) \ TYPE(test_type_x32, U32x, "0x%x", uint32_t) \ TYPE(test_type_X32, U32X, "0x%X", uint32_t) \
@@ -56,7 +56,7 @@ static void fn(struct kvm_vcpu *vcpu, T a, T b) \ \ snprintf(expected_printf, UCALL_BUFFER_LEN, PRINTF_FMT_##ext, a, b); \ snprintf(expected_assert, UCALL_BUFFER_LEN, ASSERT_FMT_##ext, a, b); \ - vals = (struct guest_vals){ (uint64_t)a, (uint64_t)b, TYPE_##ext }; \ + vals = (struct guest_vals){ (u64)a, (u64)b, TYPE_##ext }; \ sync_global_to_guest(vcpu->vm, vals); \ run_test(vcpu, expected_printf, expected_assert); \ }
tools/testing/selftests/kvm/include/arm64/arch_timer.h +8 -8
@@ -18,20 +18,20 @@ enum arch_timer {#define CTL_ISTATUS (1 << 2)#define msec_to_cycles (msec) \ - (timer_get_cntfrq() * (uint64_t)(msec) / 1000) + (timer_get_cntfrq() * (u64)(msec) / 1000)#define usec_to_cycles (usec) \ - (timer_get_cntfrq() * (uint64_t)(usec) / 1000000) + (timer_get_cntfrq() * (u64)(usec) / 1000000)#define cycles_to_usec (cycles) \ - ((uint64_t)(cycles) * 1000000 / timer_get_cntfrq()) + ((u64)(cycles) * 1000000 / timer_get_cntfrq())static inline uint32_t timer_get_cntfrq (void ) {return read_sysreg (cntfrq_el0); } -static inline uint64_t timer_get_cntct (enum arch_timer timer) +static inline u64 timer_get_cntct (enum arch_timer timer) {isb ();
@@ -48,7 +48,7 @@ static inline uint64_t timer_get_cntct(enum arch_timer timer)return 0 ; } -static inline void timer_set_cval (enum arch_timer timer,uint64_t cval) +static inline void timer_set_cval (enum arch_timer timer,u64 cval) {switch (timer) {case VIRTUAL :
@@ -64,7 +64,7 @@ static inline void timer_set_cval(enum arch_timer timer, uint64_t cval)isb (); } -static inline uint64_t timer_get_cval (enum arch_timer timer) +static inline u64 timer_get_cval (enum arch_timer timer) {switch (timer) {case VIRTUAL :
@@ -144,8 +144,8 @@ static inline uint32_t timer_get_ctl(enum arch_timer timer)static inline void timer_set_next_cval_ms (enum arch_timer timer,uint32_t msec) { -uint64_t now_ct =timer_get_cntct (timer); -uint64_t next_ct = now_ct +msec_to_cycles (msec); +u64 now_ct =timer_get_cntct (timer); +u64 next_ct = now_ct +msec_to_cycles (msec);timer_set_cval (timer, next_ct); }
tools/testing/selftests/kvm/include/arm64/delay.h +2 -2
@@ -8,10 +8,10 @@#include "arch_timer.h" -static inline void __delay (uint64_t cycles) +static inline void __delay (u64 cycles) {enum arch_timer timer =VIRTUAL ; -uint64_t start =timer_get_cntct (timer); +u64 start =timer_get_cntct (timer);while ((timer_get_cntct (timer) - start) < cycles)cpu_relax ();
tools/testing/selftests/kvm/include/arm64/gic.h +1 -1
@@ -48,7 +48,7 @@ void gic_set_dir(unsigned int intid);* split is true, EOI drops the priority and deactivates the interrupt. */ void gic_set_eoi_split (bool split); -void gic_set_priority_mask (uint64_t mask); +void gic_set_priority_mask (u64 mask);void gic_set_priority (uint32_t intid,uint32_t prio);void gic_irq_set_active (unsigned int intid);void gic_irq_clear_active (unsigned int intid);
tools/testing/selftests/kvm/include/arm64/processor.h +7 -7
@@ -175,7 +175,7 @@ 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 (struct kvm_vm *vm,gva_t gva); +u64 *virt_get_pte_hva (struct kvm_vm *vm,gva_t gva);static inline void cpu_relax (void ) {
@@ -272,9 +272,9 @@ struct arm_smccc_res {* @res: pointer to write the return values from registers x0-x3 * */ -void smccc_hvc (uint32_t function_id,uint64_t arg0,uint64_t arg1, -uint64_t arg2,uint64_t arg3,uint64_t arg4,uint64_t arg5, -uint64_t arg6,struct arm_smccc_res *res); +void smccc_hvc (uint32_t function_id,u64 arg0,u64 arg1, +u64 arg2,u64 arg3,u64 arg4,u64 arg5, +u64 arg6,struct arm_smccc_res *res);/** * smccc_smc - Invoke a SMCCC function using the smc conduit
@@ -283,9 +283,9 @@ void smccc_hvc(uint32_t function_id, uint64_t arg0, uint64_t arg1,* @res: pointer to write the return values from registers x0-x3 * */ -void smccc_smc (uint32_t function_id,uint64_t arg0,uint64_t arg1, -uint64_t arg2,uint64_t arg3,uint64_t arg4,uint64_t arg5, -uint64_t arg6,struct arm_smccc_res *res); +void smccc_smc (uint32_t function_id,u64 arg0,u64 arg1, +u64 arg2,u64 arg3,u64 arg4,u64 arg5, +u64 arg6,struct arm_smccc_res *res);/* Execute a Wait For Interrupt instruction. */ void wfi (void );
tools/testing/selftests/kvm/include/arm64/vgic.h +3 -3
@@ -11,9 +11,9 @@#include "kvm_util.h" #define REDIST_REGION_ATTR_ADDR (count, base, flags, index) \ - (((uint64_t)(count) << 52) | \ - ((uint64_t)((base) >> 16) << 16) | \ - ((uint64_t)(flags) << 12) | \ + (((u64)(count) << 52) | \ + ((u64)((base) >> 16) << 16) | \ + ((u64)(flags) << 12) | \ index)int vgic_v3_setup (struct kvm_vm *vm,unsigned int nr_vcpus,uint32_t nr_irqs);
tools/testing/selftests/kvm/include/kvm_util.h +72 -74
397 lines not on this page · raw message
tools/testing/selftests/kvm/include/kvm_util_types.h +2 -2
@@ -14,7 +14,7 @@#define __kvm_static_assert (expr, msg, ...) _Static_assert(expr, msg)#define kvm_static_assert (expr, ...) __kvm_static_assert(expr, ##__VA_ARGS__, #expr) -typedef uint64_t gpa_t ;/* Virtual Machine (Guest) physical address */ -typedef uint64_t gva_t ;/* Virtual Machine (Guest) virtual address */ +typedef u64 gpa_t ;/* Virtual Machine (Guest) physical address */ +typedef u64 gva_t ;/* Virtual Machine (Guest) virtual address */ #endif /* SELFTEST_KVM_UTIL_TYPES_H */
tools/testing/selftests/kvm/include/memstress.h +10 -10
@@ -20,9 +20,9 @@#define MEMSTRESS_MEM_SLOT_INDEX 1struct memstress_vcpu_args { -uint64_t gpa; -uint64_t gva; -uint64_t pages; +u64 gpa; +u64 gva; +u64 pages;/* Only used by the host userspace part of the vCPU thread */ struct kvm_vcpu *vcpu;
@@ -32,9 +32,9 @@ struct memstress_vcpu_args {struct memstress_args {struct kvm_vm *vm;/* The starting address and size of the guest test region. */ -uint64_t gpa; -uint64_t size; -uint64_t guest_page_size; +u64 gpa; +u64 size; +u64 guest_page_size;uint32_t random_seed;uint32_t write_percent;
@@ -56,7 +56,7 @@ struct memstress_args {extern struct memstress_args memstress_args;struct kvm_vm *memstress_create_vm (enum vm_guest_mode mode,int nr_vcpus, -uint64_t vcpu_memory_bytes,int slots, +u64 vcpu_memory_bytes,int slots,enum vm_mem_backing_src_type backing_src,bool partition_vcpu_memory_access);void memstress_destroy_vm (struct kvm_vm *vm);
@@ -68,15 +68,15 @@ void memstress_start_vcpu_threads(int vcpus, void (*vcpu_fn)(struct memstress_vcvoid memstress_join_vcpu_threads (int vcpus);void memstress_guest_code (uint32_t vcpu_id); -uint64_t memstress_nested_pages (int nr_vcpus); +u64 memstress_nested_pages (int nr_vcpus);void memstress_setup_nested (struct kvm_vm *vm,int nr_vcpus,struct kvm_vcpu *vcpus[]);void memstress_enable_dirty_logging (struct kvm_vm *vm,int slots);void memstress_disable_dirty_logging (struct kvm_vm *vm,int slots);void memstress_get_dirty_log (struct kvm_vm *vm,unsigned long *bitmaps[],int slots);void memstress_clear_dirty_log (struct kvm_vm *vm,unsigned long *bitmaps[], -int slots,uint64_t pages_per_slot); -unsigned long **memstress_alloc_bitmaps (int slots,uint64_t pages_per_slot); +int slots,u64 pages_per_slot); +unsigned long **memstress_alloc_bitmaps (int slots,u64 pages_per_slot);void memstress_free_bitmaps (unsigned long *bitmaps[],int slots);#endif /* SELFTEST_KVM_MEMSTRESS_H */
tools/testing/selftests/kvm/include/riscv/arch_timer.h +10 -10
@@ -14,25 +14,25 @@static unsigned long timer_freq;#define msec_to_cycles (msec) \ - ((timer_freq) * (uint64_t)(msec) / 1000) + ((timer_freq) * (u64)(msec) / 1000)#define usec_to_cycles (usec) \ - ((timer_freq) * (uint64_t)(usec) / 1000000) + ((timer_freq) * (u64)(usec) / 1000000)#define cycles_to_usec (cycles) \ - ((uint64_t)(cycles) * 1000000 / (timer_freq)) + ((u64)(cycles) * 1000000 / (timer_freq)) -static inline uint64_t timer_get_cycles (void ) +static inline u64 timer_get_cycles (void ) {return csr_read (CSR_TIME ); } -static inline void timer_set_cmp (uint64_t cval) +static inline void timer_set_cmp (u64 cval) {csr_write (CSR_STIMECMP , cval); } -static inline uint64_t timer_get_cmp (void ) +static inline u64 timer_get_cmp (void ) {return csr_read (CSR_STIMECMP ); }
@@ -49,15 +49,15 @@ static inline void timer_irq_disable(void)static inline void timer_set_next_cmp_ms (uint32_t msec) { -uint64_t now_ct =timer_get_cycles (); -uint64_t next_ct = now_ct +msec_to_cycles (msec); +u64 now_ct =timer_get_cycles (); +u64 next_ct = now_ct +msec_to_cycles (msec);timer_set_cmp (next_ct); } -static inline void __delay (uint64_t cycles) +static inline void __delay (u64 cycles) { -uint64_t start =timer_get_cycles (); +u64 start =timer_get_cycles ();while ((timer_get_cycles () - start) < cycles)cpu_relax ();
tools/testing/selftests/kvm/include/riscv/processor.h +4 -5
@@ -11,8 +11,7 @@#include <asm/csr.h> #include "kvm_util.h" -static inline uint64_t __kvm_reg_id (uint64_t type,uint64_t subtype, -uint64_t idx,uint64_t size) +static inline u64 __kvm_reg_id (u64 type,u64 subtype,u64 idx,u64 size) {return KVM_REG_RISCV | type | subtype | idx | size; }
@@ -48,14 +47,14 @@ static inline uint64_t __kvm_reg_id(uint64_t type, uint64_t subtype, KVM_REG_RISCV_SBI_SINGLE, \ idx, KVM_REG_SIZE_ULONG) -bool __vcpu_has_ext (struct kvm_vcpu *vcpu,uint64_t ext); +bool __vcpu_has_ext (struct kvm_vcpu *vcpu,u64 ext); -static inline bool __vcpu_has_isa_ext (struct kvm_vcpu *vcpu,uint64_t isa_ext) +static inline bool __vcpu_has_isa_ext (struct kvm_vcpu *vcpu,u64 isa_ext) {return __vcpu_has_ext (vcpu,RISCV_ISA_EXT_REG (isa_ext)); } -static inline bool __vcpu_has_sbi_ext (struct kvm_vcpu *vcpu,uint64_t sbi_ext) +static inline bool __vcpu_has_sbi_ext (struct kvm_vcpu *vcpu,u64 sbi_ext) {return __vcpu_has_ext (vcpu,RISCV_SBI_EXT_REG (sbi_ext)); }
tools/testing/selftests/kvm/include/s390/diag318_test_handler.h +1 -1
@@ -8,6 +8,6 @@#ifndef SELFTEST_KVM_DIAG318_TEST_HANDLER #define SELFTEST_KVM_DIAG318_TEST_HANDLER -uint64_t get_diag318_info (void ); +u64 get_diag318_info (void );#endif
tools/testing/selftests/kvm/include/s390/facility.h +2 -2
@@ -16,7 +16,7 @@/* alt_stfle_fac_list[16] + stfle_fac_list[16] */ #define NB_STFL_DOUBLEWORDS 32 -extern uint64_t stfl_doublewords[NB_STFL_DOUBLEWORDS ]; +extern u64 stfl_doublewords[NB_STFL_DOUBLEWORDS ];extern bool stfle_flag;static inline bool test_bit_inv (unsigned long nr,const unsigned long *ptr)
@@ -24,7 +24,7 @@ static inline bool test_bit_inv(unsigned long nr, const unsigned long *ptr)return test_bit (nr ^ (BITS_PER_LONG -1 ), ptr); } -static inline void stfle (uint64_t *fac,unsigned int nb_doublewords) +static inline void stfle (u64 *fac,unsigned int nb_doublewords) { register unsigned long r0 asm("0") = nb_doublewords - 1;
tools/testing/selftests/kvm/include/sparsebit.h +3 -3
@@ -6,7 +6,7 @@* * Header file that describes API to the sparsebit library. * This library provides a memory efficient means of storing -* the settings of bits indexed via a uint64_t. Memory usage +* the settings of bits indexed via a u64. Memory usage * is reasonable, significantly less than (2^64 / 8) bytes, as * long as bits that are mostly set or mostly cleared are close * to each other. This library is efficient in memory usage
@@ -25,8 +25,8 @@ extern "C" {#endif struct sparsebit ; -typedef uint64_t sparsebit_idx_t ; -typedef uint64_t sparsebit_num_t ; +typedef u64 sparsebit_idx_t ; +typedef u64 sparsebit_num_t ;struct sparsebit *sparsebit_alloc (void );void sparsebit_free (struct sparsebit **sbitp);
tools/testing/selftests/kvm/include/test_util.h +8 -6
@@ -20,6 +20,8 @@#include <sys/mman.h> #include "kselftest.h" +#include <linux/types.h> +#define msecs_to_usecs (msec) ((msec) * 1000ULL) static inline __printf(1, 2) int _no_printf(const char *format, ...) { return 0; }
@@ -108,9 +110,9 @@ static inline bool guest_random_bool(struct guest_random_state *state)return __guest_random_bool (state,50 ); } -static inline uint64_t guest_random_u64 (struct guest_random_state *state) +static inline u64 guest_random_u64 (struct guest_random_state *state) { -return ((uint64_t )guest_random_u32 (state) <<32 ) |guest_random_u32 (state); +return ((u64 )guest_random_u32 (state) <<32 ) |guest_random_u32 (state); }enum vm_mem_backing_src_type {
@@ -169,18 +171,18 @@ static inline bool backing_src_can_be_huge(enum vm_mem_backing_src_type t) }/* Aligns x up to the next multiple of size. Size must be a power of 2. */ -static inline uint64_t align_up (uint64_t x,uint64_t size) +static inline u64 align_up (u64 x,u64 size) { -uint64_t mask = size -1 ; +u64 mask = size -1 ;TEST_ASSERT (size !=0 && !(size & (size -1 )),"size not a power of 2: %lu" , size);return ((x + mask) & ~mask); } -static inline uint64_t align_down (uint64_t x,uint64_t size) +static inline u64 align_down (u64 x,u64 size) { -uint64_t x_aligned_up =align_up (x, size); +u64 x_aligned_up =align_up (x, size);if (x == x_aligned_up)return x;
tools/testing/selftests/kvm/include/timer_test.h +3 -3
@@ -24,15 +24,15 @@ struct test_args {uint32_t migration_freq_ms;uint32_t timer_err_margin_us;/* Members of struct kvm_arm_counter_offset */ -uint64_t counter_offset; -uint64_t reserved; +u64 counter_offset; +u64 reserved; };/* Shared variables between host and guest */ struct test_vcpu_shared_data {uint32_t nr_iter;int guest_stage; -uint64_t xcnt; +u64 xcnt; };extern struct test_args test_args;
tools/testing/selftests/kvm/include/ucall_common.h +7 -7
@@ -21,8 +21,8 @@ enum {#define UCALL_BUFFER_LEN 1024struct ucall { -uint64_t cmd; -uint64_t args[UCALL_MAX_ARGS ]; +u64 cmd; +u64 args[UCALL_MAX_ARGS ];char buffer[UCALL_BUFFER_LEN ];/* Host virtual address of this struct. */
@@ -33,14 +33,14 @@ void ucall_arch_init(struct kvm_vm *vm, gpa_t mmio_gpa);void ucall_arch_do_ucall (gva_t uc);void *ucall_arch_get_ucall (struct kvm_vcpu *vcpu); -void ucall (uint64_t cmd,int nargs, ...); -__printf(2, 3) void ucall_fmt(uint64_t cmd, const char *fmt, ...); -__printf(5, 6) void ucall_assert(uint64_t cmd, const char *exp, +void ucall (u64 cmd,int nargs, ...); +__printf(2, 3) void ucall_fmt(u64 cmd, const char *fmt, ...); +__printf(5, 6) void ucall_assert(u64 cmd, const char *exp,const char *file,unsigned int line,const char *fmt, ...); -uint64_t get_ucall (struct kvm_vcpu *vcpu,struct ucall *uc); +u64 get_ucall (struct kvm_vcpu *vcpu,struct ucall *uc);void ucall_init (struct kvm_vm *vm,gpa_t mmio_gpa); -int ucall_nr_pages_required (uint64_t page_size); +int ucall_nr_pages_required (u64 page_size);/* * Perform userspace call without any associated data. This bare call avoids
tools/testing/selftests/kvm/include/userfaultfd_util.h +3 -3
@@ -25,7 +25,7 @@ struct uffd_reader_args {struct uffd_desc {int uffd; -uint64_t num_readers; +u64 num_readers;/* Holds the write ends of the pipes for killing the readers. */ int *pipefds;pthread_t *readers;
@@ -33,8 +33,8 @@ struct uffd_desc { };struct uffd_desc *uffd_setup_demand_paging (int uffd_mode,useconds_t delay, -void *hva,uint64_t len, -uint64_t num_readers, +void *hva,u64 len, +u64 num_readers,uffd_handler_t handler);void uffd_stop_demand_paging (struct uffd_desc *uffd);
tools/testing/selftests/kvm/include/x86/apic.h +4 -4
@@ -87,17 +87,17 @@ static inline void xapic_write_reg(unsigned int reg, uint32_t val) ((volatile uint32_t *)APIC_DEFAULT_GPA )[reg >>2 ] = val; } -static inline uint64_t x2apic_read_reg (unsigned int reg) +static inline u64 x2apic_read_reg (unsigned int reg) {return rdmsr (APIC_BASE_MSR + (reg >>4 )); } -static inline uint8_t x2apic_write_reg_safe (unsigned int reg,uint64_t value) +static inline uint8_t x2apic_write_reg_safe (unsigned int reg,u64 value) {return wrmsr_safe (APIC_BASE_MSR + (reg >>4 ), value); } -static inline void x2apic_write_reg (unsigned int reg,uint64_t value) +static inline void x2apic_write_reg (unsigned int reg,u64 value) {uint8_t fault =x2apic_write_reg_safe (reg, value);
@@ -105,7 +105,7 @@ static inline void x2apic_write_reg(unsigned int reg, uint64_t value) fault, APIC_BASE_MSR + (reg >> 4), value); } -static inline void x2apic_write_reg_fault (unsigned int reg,uint64_t value) +static inline void x2apic_write_reg_fault (unsigned int reg,u64 value) {uint8_t fault =x2apic_write_reg_safe (reg, value);
tools/testing/selftests/kvm/include/x86/evmcs.h +9 -9
@@ -12,7 +12,7 @@#define u16 uint16_t#define u32 uint32_t -#define u64 uint64_t +#define u64 u64#define EVMCS_VERSION 1
@@ -245,7 +245,7 @@ static inline void evmcs_enable(void) enable_evmcs = true; } -static inline int evmcs_vmptrld (uint64_t vmcs_pa,void *vmcs) +static inline int evmcs_vmptrld (u64 vmcs_pa,void *vmcs) { current_vp_assist->current_nested_vmcs = vmcs_pa; current_vp_assist->enlighten_vmentry =1 ;
@@ -265,7 +265,7 @@ static inline bool load_evmcs(struct hyperv_test_pages *hv)return true; } -static inline int evmcs_vmptrst (uint64_t *value) +static inline int evmcs_vmptrst (u64 *value) { *value = current_vp_assist->current_nested_vmcs & ~HV_X64_MSR_VP_ASSIST_PAGE_ENABLE ;
@@ -273,7 +273,7 @@ static inline int evmcs_vmptrst(uint64_t *value)return 0 ; } -static inline int evmcs_vmread (uint64_t encoding,uint64_t *value) +static inline int evmcs_vmread (u64 encoding,u64 *value) {switch (encoding) {case GUEST_RIP :
@@ -672,7 +672,7 @@ static inline int evmcs_vmread(uint64_t encoding, uint64_t *value)return 0 ; } -static inline int evmcs_vmwrite (uint64_t encoding,uint64_t value) +static inline int evmcs_vmwrite (u64 encoding,u64 value) {switch (encoding) {case GUEST_RIP :
@@ -1226,9 +1226,9 @@ static inline int evmcs_vmlaunch(void)"pop %%rbp;" : [ret]"=&a"(ret) : [host_rsp]"r" - ((uint64_t)¤t_evmcs->host_rsp), + ((u64)¤t_evmcs->host_rsp), [host_rip]"r" - ((uint64_t)¤t_evmcs->host_rip) + ((u64)¤t_evmcs->host_rip) : "memory", "cc", "rbx", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15");return ret;
@@ -1265,9 +1265,9 @@ static inline int evmcs_vmresume(void)"pop %%rbp;" : [ret]"=&a"(ret) : [host_rsp]"r" - ((uint64_t)¤t_evmcs->host_rsp), + ((u64)¤t_evmcs->host_rsp), [host_rip]"r" - ((uint64_t)¤t_evmcs->host_rip) + ((u64)¤t_evmcs->host_rip) : "memory", "cc", "rbx", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15");return ret;
tools/testing/selftests/kvm/include/x86/hyperv.h +7 -7
@@ -256,9 +256,9 @@*/ static inline uint8_t __hyperv_hypercall (u64 control,gva_t input_address,gva_t output_address, -uint64_t *hv_status) +u64 *hv_status) { -uint64_t error_code; +u64 error_code;uint8_t vector;/* Note both the hypercall and the "asm safe" clobber r9-r11. */
@@ -277,7 +277,7 @@ static inline uint8_t __hyperv_hypercall(u64 control, gva_t input_address,static inline void hyperv_hypercall (u64 control,gva_t input_address,gva_t output_address) { -uint64_t hv_status; +u64 hv_status;uint8_t vector; vector =__hyperv_hypercall (control, input_address, output_address, &hv_status);
@@ -327,22 +327,22 @@ struct hv_vp_assist_page {extern struct hv_vp_assist_page *current_vp_assist; -int enable_vp_assist (uint64_t vp_assist_pa,void *vp_assist); +int enable_vp_assist (u64 vp_assist_pa,void *vp_assist);struct hyperv_test_pages {/* VP assist page */ void *vp_assist_hva; -uint64_t vp_assist_gpa; +u64 vp_assist_gpa;void *vp_assist;/* Partition assist page */ void *partition_assist_hva; -uint64_t partition_assist_gpa; +u64 partition_assist_gpa;void *partition_assist;/* Enlightened VMCS */ void *enlightened_vmcs_hva; -uint64_t enlightened_vmcs_gpa; +u64 enlightened_vmcs_gpa;void *enlightened_vmcs; };
tools/testing/selftests/kvm/include/x86/kvm_util_arch.h +3 -3
@@ -15,8 +15,8 @@ struct kvm_vm_arch {gva_t tss;gva_t idt; -uint64_t c_bit; -uint64_t s_bit; +u64 c_bit; +u64 s_bit;int sev_fd;bool is_pt_protected; };
@@ -40,7 +40,7 @@ do { \ : "+m" (mem) \ : "r" (val) : "memory"); \ }else { \ -uint64_t __old =READ_ONCE (mem); \ +u64 __old =READ_ONCE (mem); \ \ __asm__ __volatile__(KVM_FEP LOCK_PREFIX "cmpxchg %[new], %[ptr]" \ : [ptr] "+m" (mem), [old] "+a" (__old) \
tools/testing/selftests/kvm/include/x86/pmu.h +3 -3
@@ -5,7 +5,7 @@#ifndef SELFTEST_KVM_PMU_H #define SELFTEST_KVM_PMU_H -#include <stdint.h> +#include <linux/types.h> #define KVM_PMU_EVENT_FILTER_MAX_EVENTS 300
@@ -91,7 +91,7 @@ enum amd_pmu_zen_events { NR_AMD_ZEN_EVENTS, }; -extern const uint64_t intel_pmu_arch_events[]; -extern const uint64_t amd_pmu_zen_events[]; +extern const u64 intel_pmu_arch_events[]; +extern const u64 amd_pmu_zen_events[];#endif /* SELFTEST_KVM_PMU_H */
tools/testing/selftests/kvm/include/x86/processor.h +56 -60
198 lines not on this page · raw message
tools/testing/selftests/kvm/include/x86/sev.h +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/include/x86/svm_util.h +4 -4
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/include/x86/vmx.h +28 -28
56 lines not on this page · raw message
tools/testing/selftests/kvm/kvm_page_table_test.c +24 -24
48 lines not on this page · raw message
tools/testing/selftests/kvm/lib/arm64/gic.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/arm64/gic_private.h +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/arm64/gic_v3.c +10 -10
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/arm64/processor.c +42 -42
84 lines not on this page · raw message
tools/testing/selftests/kvm/lib/arm64/ucall.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/arm64/vgic.c +9 -9
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/guest_sprintf.c +5 -5
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/kvm_util.c +46 -46
92 lines not on this page · raw message
tools/testing/selftests/kvm/lib/memstress.c +16 -16
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/riscv/processor.c +15 -15
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/s390/diag318_test_handler.c +6 -6
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/s390/facility.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/s390/processor.c +11 -11
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/sparsebit.c +6 -6
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/test_util.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/ucall_common.c +8 -8
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/userfaultfd_util.c +6 -6
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/x86/apic.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/x86/hyperv.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/x86/memstress.c +4 -4
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/x86/pmu.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/x86/processor.c +49 -51
100 lines not on this page · raw message
tools/testing/selftests/kvm/lib/x86/sev.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/x86/svm.c +3 -3
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/lib/x86/vmx.c +35 -35
70 lines not on this page · raw message
tools/testing/selftests/kvm/memslot_modification_stress_test.c +5 -5
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/memslot_perf_test.c +57 -57
114 lines not on this page · raw message
tools/testing/selftests/kvm/mmu_stress_test.c +13 -13
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/pre_fault_memory_test.c +6 -6
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/riscv/arch_timer.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/riscv/ebreak_test.c +3 -3
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/riscv/get-reg-list.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/riscv/sbi_pmu_test.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/s390/debug_test.c +4 -4
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/s390/memop.c +16 -16
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/s390/resets.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/s390/tprot.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/set_memory_region_test.c +15 -15
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/steal_time.c +8 -8
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/system_counter_offset_test.c +6 -6
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/amx_test.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/apic_bus_clock_test.c +6 -6
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/debug_regs.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/dirty_log_page_splitting_test.c +8 -8
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/feature_msrs_test.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/fix_hypercall_test.c +5 -5
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/flds_emulation.h +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/hwcr_msr_test.c +5 -5
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/hyperv_extended_hypercalls.c +4 -4
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/hyperv_features.c +3 -3
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/hyperv_ipi.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/hyperv_tlb_flush.c +4 -4
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/kvm_clock_test.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/kvm_pv_test.c +3 -3
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/monitor_mwait_test.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/nx_huge_pages_test.c +9 -9
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/platform_info_test.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/pmu_counters_test.c +16 -16
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/pmu_event_filter_test.c +39 -39
78 lines not on this page · raw message
tools/testing/selftests/kvm/x86/private_mem_conversions_test.c +25 -25
50 lines not on this page · raw message
tools/testing/selftests/kvm/x86/private_mem_kvm_exits_test.c +4 -4
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/set_sregs_test.c +3 -3
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/sev_init2_tests.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/sev_smoke_test.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/smaller_maxphyaddr_emulation_test.c +5 -5
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/smm_test.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/state_test.c +4 -4
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/svm_nested_soft_inject_test.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/tsc_msrs_test.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/tsc_scaling_sync.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/ucna_injection_test.c +22 -21
43 lines not on this page · raw message
tools/testing/selftests/kvm/x86/userspace_msr_exit_test.c +12 -12
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/vmx_dirty_log_test.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/vmx_msrs_test.c +9 -9
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/vmx_nested_tsc_scaling_test.c +10 -10
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/vmx_pmu_caps_test.c +5 -5
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/vmx_tsc_adjust_test.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/xapic_ipi_test.c +19 -19
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/xapic_state_test.c +8 -8
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/xcr0_cpuid_test.c +4 -4
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/xen_shinfo_test.c +6 -6
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/xss_msr_test.c +1 -1
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.49.0.906.g1f30a19c02-goog
Part of the diff is not shown here. View the raw message.
PATCH 5/10 KVM: selftests: Use s64 instead of int64_t
In reply to David MatlackUse s64 instead of int64_t to make the KVM selftests code more concise and more similar to the kernel (since selftests are primarily developed by kernel developers).
This commit was generated with the following command:
git ls-files tools/testing/selftests/kvm | xargs sed -i 's/int64_t/s64/g'
Then by manually adjusting whitespace to make checkpatch.pl happy.
No functional change intended.
--- tools/testing/selftests/kvm/arm64/set_id_regs.c | 2 +- tools/testing/selftests/kvm/guest_print_test.c | 2 +- tools/testing/selftests/kvm/include/test_util.h | 4 ++-- tools/testing/selftests/kvm/lib/test_util.c | 16 ++++++++-------- .../testing/selftests/kvm/lib/userfaultfd_util.c | 2 +- tools/testing/selftests/kvm/lib/x86/processor.c | 4 ++-- tools/testing/selftests/kvm/memslot_perf_test.c | 2 +- tools/testing/selftests/kvm/steal_time.c | 4 ++-- tools/testing/selftests/kvm/x86/kvm_clock_test.c | 2 +- .../selftests/kvm/x86/vmx_tsc_adjust_test.c | 6 +++--- 10 files changed, 22 insertions(+), 22 deletions(-)
tools/testing/selftests/kvm/arm64/set_id_regs.c +1 -1
@@ -36,7 +36,7 @@ struct reg_ftr_bits {* For FTR_EXACT, safe_val is used as the exact safe value. * For FTR_LOWER_SAFE, safe_val is used as the minimal safe value. */ -int64_t safe_val; +s64 safe_val; };struct test_feature_reg {
tools/testing/selftests/kvm/guest_print_test.c +1 -1
@@ -25,7 +25,7 @@ static struct guest_vals vals;/* GUEST_PRINTF()/GUEST_ASSERT_FMT() does not support float or double. */ #define TYPE_LIST \ -TYPE(test_type_i64, I64, "%ld", int64_t) \ +TYPE(test_type_i64, I64, "%ld", s64) \ TYPE(test_type_u64, U64u, "%lu", u64) \ TYPE(test_type_x64, U64x, "0x%lx", u64) \ TYPE(test_type_X64, U64X, "0x%lX", u64) \
tools/testing/selftests/kvm/include/test_util.h +2 -2
@@ -82,8 +82,8 @@ do { \size_t parse_size (const char *size); -int64_t timespec_to_ns (struct timespec ts); -struct timespec timespec_add_ns (struct timespec ts,int64_t ns); +s64 timespec_to_ns (struct timespec ts); +struct timespec timespec_add_ns (struct timespec ts,s64 ns);struct timespec timespec_add (struct timespec ts1,struct timespec ts2);struct timespec timespec_sub (struct timespec ts1,struct timespec ts2);struct timespec timespec_elapsed (struct timespec start);
tools/testing/selftests/kvm/lib/test_util.c +8 -8
@@ -76,12 +76,12 @@ size_t parse_size(const char *size)return base << shift; } -int64_t timespec_to_ns (struct timespec ts) +s64 timespec_to_ns (struct timespec ts) { -return (int64_t )ts.tv_nsec +1000000000LL * (int64_t )ts.tv_sec; +return (s64 )ts.tv_nsec +1000000000LL * (s64 )ts.tv_sec; } -struct timespec timespec_add_ns (struct timespec ts,int64_t ns) +struct timespec timespec_add_ns (struct timespec ts,s64 ns) {struct timespec res;
@@ -94,15 +94,15 @@ struct timespec timespec_add_ns(struct timespec ts, int64_t ns)struct timespec timespec_add (struct timespec ts1,struct timespec ts2) { -int64_t ns1 =timespec_to_ns (ts1); -int64_t ns2 =timespec_to_ns (ts2); +s64 ns1 =timespec_to_ns (ts1); +s64 ns2 =timespec_to_ns (ts2);return timespec_add_ns ((struct timespec ){0 }, ns1 + ns2); }struct timespec timespec_sub (struct timespec ts1,struct timespec ts2) { -int64_t ns1 =timespec_to_ns (ts1); -int64_t ns2 =timespec_to_ns (ts2); +s64 ns1 =timespec_to_ns (ts1); +s64 ns2 =timespec_to_ns (ts2);return timespec_add_ns ((struct timespec ){0 }, ns1 - ns2); }
@@ -116,7 +116,7 @@ struct timespec timespec_elapsed(struct timespec start)struct timespec timespec_div (struct timespec ts,int divisor) { -int64_t ns =timespec_to_ns (ts) / divisor; +s64 ns =timespec_to_ns (ts) / divisor;return timespec_add_ns ((struct timespec ){0 }, ns); }
tools/testing/selftests/kvm/lib/userfaultfd_util.c +1 -1
@@ -27,7 +27,7 @@ static void *uffd_handler_thread_fn(void *arg) {struct uffd_reader_args *reader_args = (struct uffd_reader_args *)arg;int uffd = reader_args->uffd; -int64_t pages =0 ; +s64 pages =0 ;struct timespec start;struct timespec ts_diff;struct epoll_event evt;
tools/testing/selftests/kvm/lib/x86/processor.c +2 -2
@@ -293,8 +293,8 @@ u64 *__vm_get_page_table_entry(struct kvm_vm *vm, u64 vaddr, int *level)* Based on the mode check above there are 48 bits in the vaddr, so * shift 16 to sign extend the last bit (bit-47), */ -TEST_ASSERT (vaddr == (((int64_t )vaddr <<16 ) >>16 ), -"Canonical check failed. The virtual address is invalid." ); +TEST_ASSERT (vaddr == (((s64 )vaddr <<16 ) >>16 ), +"Canonical check failed. The virtual address is invalid." ); pml4e =virt_get_pte (vm, &vm->pgd, vaddr,PG_LEVEL_512G );if (vm_is_target_pte (pml4e, level,PG_LEVEL_512G ))
tools/testing/selftests/kvm/memslot_perf_test.c +1 -1
@@ -1039,7 +1039,7 @@ static bool parse_args(int argc, char *argv[],struct test_result {struct timespec slot_runtime, guest_runtime, iter_runtime; -int64_t slottimens, runtimens; +s64 slottimens, runtimens;u64 nloops; };
tools/testing/selftests/kvm/steal_time.c +2 -2
@@ -114,7 +114,7 @@ struct st_time {u64 st_time; }; -static int64_t smccc (uint32_t func,u64 arg) +static s64 smccc (uint32_t func,u64 arg) {struct arm_smccc_res res;
@@ -131,7 +131,7 @@ static void check_status(struct st_time *st)static void guest_code (int cpu) {struct st_time *st; -int64_t status; +s64 status; status =smccc (SMCCC_ARCH_FEATURES ,PV_TIME_FEATURES );GUEST_ASSERT_EQ (status,0 );
tools/testing/selftests/kvm/x86/kvm_clock_test.c +1 -1
@@ -18,7 +18,7 @@struct test_case {u64 kvmclock_base; -int64_t realtime_offset; +s64 realtime_offset; };static struct test_case test_cases[] = {
tools/testing/selftests/kvm/x86/vmx_tsc_adjust_test.c +3 -3
@@ -52,9 +52,9 @@ enum {/* The virtual machine object. */ static struct kvm_vm *vm; -static void check_ia32_tsc_adjust (int64_t max) +static void check_ia32_tsc_adjust (s64 max) { -int64_t adjust; +s64 adjust; adjust =rdmsr (MSR_IA32_TSC_ADJUST );GUEST_SYNC (adjust);
@@ -111,7 +111,7 @@ static void l1_guest_code(struct vmx_pages *vmx_pages)GUEST_DONE (); } -static void report (int64_t val) +static void report (s64 val) {pr_info ("IA32_TSC_ADJUST is %ld (%lld * TSC_ADJUST_VALUE + %lld).\n" , val, val /TSC_ADJUST_VALUE , val %TSC_ADJUST_VALUE );
Signature · 1 line
2.49.0.906.g1f30a19c02-goog
PATCH 6/10 KVM: selftests: Use u32 instead of uint32_t
In reply to David MatlackUse u32 instead of uint32_t to make the KVM selftests code more concise and more similar to the kernel (since selftests are primarily developed by kernel developers).
This commit was generated with the following command:
git ls-files tools/testing/selftests/kvm | xargs sed -i 's/uint32_t/u32/g'
Then by manually adjusting whitespace to make checkpatch.pl happy.
No functional change intended.
--- tools/testing/selftests/kvm/arch_timer.c | 6 +- .../testing/selftests/kvm/arm64/arch_timer.c | 6 +- .../kvm/arm64/arch_timer_edge_cases.c | 28 ++--- .../selftests/kvm/arm64/debug-exceptions.c | 16 +-- .../testing/selftests/kvm/arm64/hypercalls.c | 6 +- .../selftests/kvm/arm64/page_fault_test.c | 6 +- tools/testing/selftests/kvm/arm64/psci_test.c | 2 +- .../testing/selftests/kvm/arm64/set_id_regs.c | 6 +- .../selftests/kvm/arm64/smccc_filter.c | 10 +- tools/testing/selftests/kvm/arm64/vgic_init.c | 30 ++--- tools/testing/selftests/kvm/arm64/vgic_irq.c | 74 +++++------ .../testing/selftests/kvm/coalesced_io_test.c | 22 ++-- .../selftests/kvm/dirty_log_perf_test.c | 2 +- tools/testing/selftests/kvm/dirty_log_test.c | 36 +++--- .../testing/selftests/kvm/guest_print_test.c | 6 +- .../selftests/kvm/hardware_disable_test.c | 6 +- .../selftests/kvm/include/arm64/arch_timer.h | 10 +- .../testing/selftests/kvm/include/arm64/gic.h | 2 +- .../selftests/kvm/include/arm64/processor.h | 10 +- .../selftests/kvm/include/arm64/vgic.h | 14 +-- .../testing/selftests/kvm/include/kvm_util.h | 116 +++++++++--------- .../testing/selftests/kvm/include/memstress.h | 10 +- .../selftests/kvm/include/riscv/arch_timer.h | 2 +- .../testing/selftests/kvm/include/test_util.h | 20 +-- .../selftests/kvm/include/timer_test.h | 12 +- .../testing/selftests/kvm/include/x86/apic.h | 10 +- .../testing/selftests/kvm/include/x86/evmcs.h | 2 +- .../selftests/kvm/include/x86/processor.h | 100 +++++++-------- tools/testing/selftests/kvm/include/x86/sev.h | 6 +- tools/testing/selftests/kvm/include/x86/vmx.h | 10 +- .../selftests/kvm/kvm_page_table_test.c | 2 +- tools/testing/selftests/kvm/lib/arm64/gic.c | 2 +- .../selftests/kvm/lib/arm64/gic_private.h | 20 +-- .../testing/selftests/kvm/lib/arm64/gic_v3.c | 74 +++++------ .../selftests/kvm/lib/arm64/processor.c | 22 ++-- tools/testing/selftests/kvm/lib/arm64/vgic.c | 20 +-- tools/testing/selftests/kvm/lib/guest_modes.c | 2 +- .../testing/selftests/kvm/lib/guest_sprintf.c | 6 +- tools/testing/selftests/kvm/lib/kvm_util.c | 80 ++++++------ tools/testing/selftests/kvm/lib/memstress.c | 4 +- .../selftests/kvm/lib/riscv/processor.c | 6 +- .../selftests/kvm/lib/s390/processor.c | 2 +- tools/testing/selftests/kvm/lib/sparsebit.c | 4 +- tools/testing/selftests/kvm/lib/test_util.c | 14 +-- .../testing/selftests/kvm/lib/x86/processor.c | 22 ++-- tools/testing/selftests/kvm/lib/x86/sev.c | 6 +- tools/testing/selftests/kvm/lib/x86/vmx.c | 14 +-- .../testing/selftests/kvm/memslot_perf_test.c | 50 ++++---- .../testing/selftests/kvm/riscv/arch_timer.c | 6 +- tools/testing/selftests/kvm/s390/memop.c | 18 +-- .../selftests/kvm/set_memory_region_test.c | 8 +- tools/testing/selftests/kvm/steal_time.c | 26 ++-- tools/testing/selftests/kvm/x86/amx_test.c | 4 +- .../selftests/kvm/x86/apic_bus_clock_test.c | 12 +- tools/testing/selftests/kvm/x86/debug_regs.c | 2 +- .../selftests/kvm/x86/feature_msrs_test.c | 8 +- .../testing/selftests/kvm/x86/hyperv_evmcs.c | 2 +- .../selftests/kvm/x86/hyperv_features.c | 4 +- .../selftests/kvm/x86/hyperv_svm_test.c | 2 +- tools/testing/selftests/kvm/x86/kvm_pv_test.c | 2 +- .../selftests/kvm/x86/nested_emulation_test.c | 10 +- .../kvm/x86/nested_exceptions_test.c | 4 +- .../selftests/kvm/x86/pmu_counters_test.c | 32 ++--- .../selftests/kvm/x86/pmu_event_filter_test.c | 20 +-- .../kvm/x86/private_mem_conversions_test.c | 8 +- .../kvm/x86/private_mem_kvm_exits_test.c | 8 +- .../selftests/kvm/x86/set_boot_cpu_id.c | 6 +- .../selftests/kvm/x86/sev_init2_tests.c | 4 +- .../selftests/kvm/x86/sev_smoke_test.c | 6 +- .../selftests/kvm/x86/ucna_injection_test.c | 2 +- .../kvm/x86/userspace_msr_exit_test.c | 28 ++--- .../selftests/kvm/x86/vmx_apic_access_test.c | 2 +- .../testing/selftests/kvm/x86/vmx_msrs_test.c | 8 +- .../kvm/x86/vmx_nested_tsc_scaling_test.c | 2 +- .../selftests/kvm/x86/vmx_tsc_adjust_test.c | 2 +- .../selftests/kvm/x86/xapic_ipi_test.c | 16 +-- .../selftests/kvm/x86/xapic_state_test.c | 4 +- .../selftests/kvm/x86/xen_shinfo_test.c | 6 +- 78 files changed, 598 insertions(+), 600 deletions(-)
tools/testing/selftests/kvm/arch_timer.c +3 -3
@@ -78,9 +78,9 @@ static void *test_vcpu_run(void *arg)return NULL ; } -static uint32_t test_get_pcpu (void ) +static u32 test_get_pcpu (void ) { -uint32_t pcpu; +u32 pcpu;unsigned int nproc_conf;cpu_set_t online_cpuset;
@@ -99,7 +99,7 @@ static int test_migrate_vcpu(unsigned int vcpu_idx) {int ret;cpu_set_t cpuset; -uint32_t new_pcpu =test_get_pcpu (); +u32 new_pcpu =test_get_pcpu ();CPU_ZERO (&cpuset);CPU_SET (new_pcpu, &cpuset);
tools/testing/selftests/kvm/arm64/arch_timer.c +3 -3
@@ -105,7 +105,7 @@ static void guest_validate_irq(unsigned int intid,static void guest_irq_handler (struct ex_regs *regs) {unsigned int intid =gic_get_and_ack_irq (); -uint32_t cpu =guest_get_vcpuid (); +u32 cpu =guest_get_vcpuid ();struct test_vcpu_shared_data *shared_data = &vcpu_shared_data[cpu];guest_validate_irq (intid, shared_data);
@@ -116,7 +116,7 @@ static void guest_irq_handler(struct ex_regs *regs)static void guest_run_stage (struct test_vcpu_shared_data *shared_data,enum guest_stage stage) { -uint32_t irq_iter, config_iter; +u32 irq_iter, config_iter; shared_data->guest_stage = stage; shared_data->nr_iter =0 ;
@@ -140,7 +140,7 @@ static void guest_run_stage(struct test_vcpu_shared_data *shared_data,static void guest_code (void ) { -uint32_t cpu =guest_get_vcpuid (); +u32 cpu =guest_get_vcpuid ();struct test_vcpu_shared_data *shared_data = &vcpu_shared_data[cpu];local_irq_disable ();
tools/testing/selftests/kvm/arm64/arch_timer_edge_cases.c +14 -14
@@ -28,19 +28,19 @@ static const int32_t TVAL_MAX = INT32_MAX;static const int32_t TVAL_MIN =INT32_MIN ;/* After how much time we say there is no IRQ. */ -static const uint32_t TIMEOUT_NO_IRQ_US =50000 ; +static const u32 TIMEOUT_NO_IRQ_US =50000 ;/* A nice counter value to use as the starting one for most tests. */ static const u64 DEF_CNT = (CVAL_MAX /2 );/* Number of runs. */ -static const uint32_t NR_TEST_ITERS_DEF =5 ; +static const u32 NR_TEST_ITERS_DEF =5 ;/* Default wait test time in ms. */ -static const uint32_t WAIT_TEST_MS =10 ; +static const u32 WAIT_TEST_MS =10 ;/* Default "long" wait test time in ms. */ -static const uint32_t LONG_WAIT_TEST_MS =100 ; +static const u32 LONG_WAIT_TEST_MS =100 ;/* Shared with IRQ handler. */ struct test_vcpu_shared_data {
@@ -114,7 +114,7 @@ enum timer_view { TIMER_TVAL, }; -static void assert_irqs_handled (uint32_t n) +static void assert_irqs_handled (u32 n) {int h =atomic_read (&shared_data.handled);
@@ -146,7 +146,7 @@ static void guest_irq_handler(struct ex_regs *regs)unsigned int intid =gic_get_and_ack_irq ();enum arch_timer timer;u64 cnt, cval; -uint32_t ctl; +u32 ctl;bool timer_condition, istatus;if (intid ==IAR_SPURIOUS ) {
@@ -178,7 +178,7 @@ static void guest_irq_handler(struct ex_regs *regs) }static void set_cval_irq (enum arch_timer timer,u64 cval_cycles, -uint32_t ctl) +u32 ctl) {atomic_set (&shared_data.handled,0 );atomic_set (&shared_data.spurious,0 );
@@ -187,7 +187,7 @@ static void set_cval_irq(enum arch_timer timer, u64 cval_cycles, }static void set_tval_irq (enum arch_timer timer,u64 tval_cycles, -uint32_t ctl) +u32 ctl) {atomic_set (&shared_data.handled,0 );atomic_set (&shared_data.spurious,0 );
@@ -195,7 +195,7 @@ static void set_tval_irq(enum arch_timer timer, u64 tval_cycles,timer_set_tval (timer, tval_cycles); } -static void set_xval_irq (enum arch_timer timer,u64 xval,uint32_t ctl, +static void set_xval_irq (enum arch_timer timer,u64 xval,u32 ctl,enum timer_view tv) {switch (tv) {
@@ -848,11 +848,11 @@ static void guest_code(enum arch_timer timer)GUEST_DONE (); } -static uint32_t next_pcpu (void ) +static u32 next_pcpu (void ) { -uint32_t max =get_nprocs (); -uint32_t cur =sched_getcpu (); -uint32_t next = cur; +u32 max =get_nprocs (); +u32 cur =sched_getcpu (); +u32 next = cur;cpu_set_t cpuset;TEST_ASSERT (max >1 ,"Need at least two physical cpus" );
@@ -866,7 +866,7 @@ static uint32_t next_pcpu(void)return next; } -static void migrate_self (uint32_t new_pcpu) +static void migrate_self (u32 new_pcpu) {int ret;cpu_set_t cpuset;
tools/testing/selftests/kvm/arm64/debug-exceptions.c +8 -8
@@ -140,7 +140,7 @@ static void enable_os_lock(void)static void enable_monitor_debug_exceptions (void ) { -uint32_t mdscr; +u32 mdscr; asmvolatile ("msr daifclr, #8" );
@@ -151,7 +151,7 @@ static void enable_monitor_debug_exceptions(void)static void install_wp (uint8_t wpn,u64 addr) { -uint32_t wcr; +u32 wcr; wcr =DBGWCR_LEN8 |DBGWCR_RD |DBGWCR_WR |DBGWCR_EL1 |DBGWCR_E ;write_dbgwcr (wpn, wcr);
@@ -164,7 +164,7 @@ static void install_wp(uint8_t wpn, u64 addr)static void install_hw_bp (uint8_t bpn,u64 addr) { -uint32_t bcr; +u32 bcr; bcr =DBGBCR_LEN8 |DBGBCR_EXEC |DBGBCR_EL1 |DBGBCR_E ;write_dbgbcr (bpn, bcr);
@@ -177,7 +177,7 @@ static void install_hw_bp(uint8_t bpn, u64 addr)static void install_wp_ctx (uint8_t addr_wp,uint8_t ctx_bp,u64 addr,u64 ctx) { -uint32_t wcr; +u32 wcr;u64 ctx_bcr;/* Setup a context-aware breakpoint for Linked Context ID Match */
@@ -188,7 +188,7 @@ static void install_wp_ctx(uint8_t addr_wp, uint8_t ctx_bp, u64 addr,/* Setup a linked watchpoint (linked to the context-aware breakpoint) */ wcr =DBGWCR_LEN8 |DBGWCR_RD |DBGWCR_WR |DBGWCR_EL1 |DBGWCR_E | -DBGWCR_WT_LINK | ((uint32_t )ctx_bp <<DBGWCR_LBN_SHIFT ); +DBGWCR_WT_LINK | ((u32 )ctx_bp <<DBGWCR_LBN_SHIFT );write_dbgwcr (addr_wp, wcr);write_dbgwvr (addr_wp, addr);isb ();
@@ -199,7 +199,7 @@ static void install_wp_ctx(uint8_t addr_wp, uint8_t ctx_bp, u64 addr,void install_hw_bp_ctx (uint8_t addr_bp,uint8_t ctx_bp,u64 addr,u64 ctx) { -uint32_t addr_bcr, ctx_bcr; +u32 addr_bcr, ctx_bcr;/* Setup a context-aware breakpoint for Linked Context ID Match */ ctx_bcr = DBGBCR_LEN8 | DBGBCR_EXEC | DBGBCR_EL1 | DBGBCR_E |
@@ -213,7 +213,7 @@ void install_hw_bp_ctx(uint8_t addr_bp, uint8_t ctx_bp, u64 addr,*/ addr_bcr =DBGBCR_LEN8 |DBGBCR_EXEC |DBGBCR_EL1 |DBGBCR_E |DBGBCR_BT_ADDR_LINK_CTX | - ((uint32_t )ctx_bp <<DBGBCR_LBN_SHIFT ); + ((u32 )ctx_bp <<DBGBCR_LBN_SHIFT );write_dbgbcr (addr_bp, addr_bcr);write_dbgbvr (addr_bp, addr);isb ();
@@ -223,7 +223,7 @@ void install_hw_bp_ctx(uint8_t addr_bp, uint8_t ctx_bp, u64 addr,static void install_ss (void ) { -uint32_t mdscr; +u32 mdscr; asmvolatile ("msr daifclr, #8" );
tools/testing/selftests/kvm/arm64/hypercalls.c +3 -3
@@ -59,7 +59,7 @@ enum test_stage {static int stage =TEST_STAGE_REG_IFACE ;struct test_hvc_info { -uint32_t func_id; +u32 func_id;u64 arg1; };
@@ -152,8 +152,8 @@ static void guest_code(void) }struct st_time { -uint32_t rev; -uint32_t attr; +u32 rev; +u32 attr;u64 st_time; };
tools/testing/selftests/kvm/arm64/page_fault_test.c +3 -3
@@ -59,8 +59,8 @@ struct test_desc {void (*iabt_handler)(struct ex_regs *regs);void (*mmio_handler)(struct kvm_vm *vm,struct kvm_run *run);void (*fail_vcpu_run_handler)(int ret); -uint32_t pt_memslot_flags; -uint32_t data_memslot_flags; +u32 pt_memslot_flags; +u32 data_memslot_flags;bool skip;struct event_cnt expected_events; };
@@ -510,7 +510,7 @@ void fail_vcpu_run_mmio_no_syndrome_handler(int ret) events.fail_vcpu_runs +=1 ; } -typedef uint32_t aarch64_insn_t ; +typedef u32 aarch64_insn_t ;extern aarch64_insn_t __exec_test[2 ]; noinline void __return_0x77(void)
tools/testing/selftests/kvm/arm64/psci_test.c +1 -1
@@ -61,7 +61,7 @@ static u64 psci_system_off2(u64 type, u64 cookie)return res.a0; } -static u64 psci_features (uint32_t func_id) +static u64 psci_features (u32 func_id) {struct arm_smccc_res res;
tools/testing/selftests/kvm/arm64/set_id_regs.c +3 -3
@@ -40,7 +40,7 @@ struct reg_ftr_bits { };struct test_feature_reg { -uint32_t reg; +u32 reg;const struct reg_ftr_bits *ftr_bits; };
@@ -420,7 +420,7 @@ static void test_vm_ftr_id_regs(struct kvm_vcpu *vcpu, bool aarch64_only)for (int i =0 ; i <ARRAY_SIZE (test_regs); i++) {const struct reg_ftr_bits *ftr_bits = test_regs[i].ftr_bits; -uint32_t reg_id = test_regs[i].reg; +u32 reg_id = test_regs[i].reg;u64 reg =KVM_ARM64_SYS_REG (reg_id);int idx;
@@ -643,7 +643,7 @@ static void test_vcpu_non_ftr_id_regs(struct kvm_vcpu *vcpu)ksft_test_result_pass ("%s\n" , __func__); } -static void test_assert_id_reg_unchanged (struct kvm_vcpu *vcpu,uint32_t encoding) +static void test_assert_id_reg_unchanged (struct kvm_vcpu *vcpu,u32 encoding) {size_t idx =encoding_to_range_idx (encoding);u64 observed;
tools/testing/selftests/kvm/arm64/smccc_filter.c +5 -5
@@ -25,7 +25,7 @@ enum smccc_conduit {#define for_each_conduit (conduit) \ for (conduit = HVC_INSN; conduit <= SMC_INSN; conduit++) -static void guest_main (uint32_t func_id,enum smccc_conduit conduit) +static void guest_main (u32 func_id,enum smccc_conduit conduit) {struct arm_smccc_res res;
@@ -37,7 +37,7 @@ static void guest_main(uint32_t func_id, enum smccc_conduit conduit)GUEST_SYNC (res.a0); } -static int __set_smccc_filter (struct kvm_vm *vm,uint32_t start,uint32_t nr_functions, +static int __set_smccc_filter (struct kvm_vm *vm,u32 start,u32 nr_functions,enum kvm_smccc_filter_action action) {struct kvm_smccc_filter filter = {
@@ -50,7 +50,7 @@ static int __set_smccc_filter(struct kvm_vm *vm, uint32_t start, uint32_t nr_fun KVM_ARM_VM_SMCCC_FILTER, &filter); } -static void set_smccc_filter (struct kvm_vm *vm,uint32_t start,uint32_t nr_functions, +static void set_smccc_filter (struct kvm_vm *vm,u32 start,u32 nr_functions,enum kvm_smccc_filter_action action) {int ret =__set_smccc_filter (vm, start, nr_functions, action);
@@ -99,7 +99,7 @@ static void test_filter_reserved_range(void) {struct kvm_vcpu *vcpu;struct kvm_vm *vm =setup_vm (&vcpu); -uint32_t smc64_fn; +u32 smc64_fn;int r; r = __set_smccc_filter(vm, ARM_SMCCC_ARCH_WORKAROUND_1,
@@ -204,7 +204,7 @@ static void test_filter_denied(void) } } -static void expect_call_fwd_to_user (struct kvm_vcpu *vcpu,uint32_t func_id, +static void expect_call_fwd_to_user (struct kvm_vcpu *vcpu,u32 func_id,enum smccc_conduit conduit) {struct kvm_run *run = vcpu->run;
tools/testing/selftests/kvm/arm64/vgic_init.c +15 -15
@@ -26,7 +26,7 @@struct vm_gic {struct kvm_vm *vm;int gic_fd; -uint32_t gic_dev_type; +u32 gic_dev_type; };static u64 max_phys_size;
@@ -38,17 +38,17 @@ static u64 max_phys_size;static void v3_redist_reg_get_errno (int gicv3_fd,int vcpu,int offset,int want,const char *msg) { -uint32_t ignored_val; +u32 ignored_val;int ret =__kvm_device_attr_get (gicv3_fd,KVM_DEV_ARM_VGIC_GRP_REDIST_REGS ,REG_OFFSET (vcpu, offset), &ignored_val);TEST_ASSERT (ret && errno == want,"%s; want errno = %d" , msg, want); } -static void v3_redist_reg_get (int gicv3_fd,int vcpu,int offset,uint32_t want, +static void v3_redist_reg_get (int gicv3_fd,int vcpu,int offset,u32 want,const char *msg) { -uint32_t val; +u32 val;kvm_device_attr_get (gicv3_fd,KVM_DEV_ARM_VGIC_GRP_REDIST_REGS ,REG_OFFSET (vcpu, offset), &val);
@@ -70,8 +70,8 @@ static int run_vcpu(struct kvm_vcpu *vcpu)return __vcpu_run (vcpu) ? -errno :0 ; } -static struct vm_gic vm_gic_create_with_vcpus (uint32_t gic_dev_type, -uint32_t nr_vcpus, +static struct vm_gic vm_gic_create_with_vcpus (u32 gic_dev_type, +u32 nr_vcpus,struct kvm_vcpu *vcpus[]) {struct vm_gic v;
@@ -83,7 +83,7 @@ static struct vm_gic vm_gic_create_with_vcpus(uint32_t gic_dev_type,return v; } -static struct vm_gic vm_gic_create_barebones (uint32_t gic_dev_type) +static struct vm_gic vm_gic_create_barebones (u32 gic_dev_type) {struct vm_gic v;
@@ -331,7 +331,7 @@ static void subtest_v3_redist_regions(struct vm_gic *v)* VGIC KVM device is created and initialized before the secondary CPUs * get created */ -static void test_vgic_then_vcpus (uint32_t gic_dev_type) +static void test_vgic_then_vcpus (u32 gic_dev_type) {struct kvm_vcpu *vcpus[NR_VCPUS ];struct vm_gic v;
@@ -352,7 +352,7 @@ static void test_vgic_then_vcpus(uint32_t gic_dev_type) }/* All the VCPUs are created before the VGIC KVM device gets initialized */ -static void test_vcpus_then_vgic (uint32_t gic_dev_type) +static void test_vcpus_then_vgic (u32 gic_dev_type) {struct kvm_vcpu *vcpus[NR_VCPUS ];struct vm_gic v;
@@ -517,7 +517,7 @@ static void test_v3_typer_accesses(void) }static struct vm_gic vm_gic_v3_create_with_vcpuids (int nr_vcpus, -uint32_t vcpuids[]) +u32 vcpuids[]) {struct vm_gic v;int i;
@@ -543,7 +543,7 @@ static struct vm_gic vm_gic_v3_create_with_vcpuids(int nr_vcpus,*/ static void test_v3_last_bit_redist_regions (void ) { -uint32_t vcpuids[] = {0 ,3 ,5 ,4 ,1 ,2 }; +u32 vcpuids[] = {0 ,3 ,5 ,4 ,1 ,2 };struct vm_gic v;u64 addr;
@@ -577,7 +577,7 @@ static void test_v3_last_bit_redist_regions(void)/* Test last bit with legacy region */ static void test_v3_last_bit_single_rdist (void ) { -uint32_t vcpuids[] = {0 ,3 ,5 ,4 ,1 ,2 }; +u32 vcpuids[] = {0 ,3 ,5 ,4 ,1 ,2 };struct vm_gic v;u64 addr;
@@ -678,11 +678,11 @@ static void test_v3_its_region(void)/* * Returns 0 if it's possible to create GIC device of a given type (V2 or V3). */ -int test_kvm_device (uint32_t gic_dev_type) +int test_kvm_device (u32 gic_dev_type) {struct kvm_vcpu *vcpus[NR_VCPUS ];struct vm_gic v; -uint32_t other; +u32 other;int ret; v.vm =vm_create_with_vcpus (NR_VCPUS , guest_code, vcpus);
@@ -715,7 +715,7 @@ int test_kvm_device(uint32_t gic_dev_type)return 0 ; } -void run_tests (uint32_t gic_dev_type) +void run_tests (u32 gic_dev_type) {test_vcpus_then_vgic (gic_dev_type);test_vgic_then_vcpus (gic_dev_type);
tools/testing/selftests/kvm/arm64/vgic_irq.c +37 -37
236 lines not on this page · raw message
tools/testing/selftests/kvm/coalesced_io_test.c +11 -11
@@ -14,7 +14,7 @@struct kvm_coalesced_io {struct kvm_coalesced_mmio_ring *ring; -uint32_t ring_size; +u32 ring_size;u64 mmio_gpa;u64 *mmio;
@@ -70,13 +70,13 @@ static void guest_code(struct kvm_coalesced_io *io)static void vcpu_run_and_verify_io_exit (struct kvm_vcpu *vcpu,struct kvm_coalesced_io *io, -uint32_t ring_start, -uint32_t expected_exit) +u32 ring_start, +u32 expected_exit) {const bool want_pio = expected_exit ==KVM_EXIT_IO ;struct kvm_coalesced_mmio_ring *ring = io->ring;struct kvm_run *run = vcpu->run; -uint32_t pio_value; +u32 pio_value;WRITE_ONCE (ring->first, ring_start);WRITE_ONCE (ring->last, ring_start);
@@ -88,7 +88,7 @@ static void vcpu_run_and_verify_io_exit(struct kvm_vcpu *vcpu,* data_offset is garbage, e.g. an MMIO gpa. */ if (run->exit_reason ==KVM_EXIT_IO ) - pio_value = *(uint32_t *)((void *)run + run->io.data_offset); + pio_value = *(u32 *)((void *)run + run->io.data_offset);else pio_value =0 ;
@@ -111,8 +111,8 @@ static void vcpu_run_and_verify_io_exit(struct kvm_vcpu *vcpu,static void vcpu_run_and_verify_coalesced_io (struct kvm_vcpu *vcpu,struct kvm_coalesced_io *io, -uint32_t ring_start, -uint32_t expected_exit) +u32 ring_start, +u32 expected_exit) {struct kvm_coalesced_mmio_ring *ring = io->ring;int i;
@@ -124,18 +124,18 @@ static void vcpu_run_and_verify_coalesced_io(struct kvm_vcpu *vcpu, ring->first, ring->last, io->ring_size, ring_start);for (i =0 ; i < io->ring_size -1 ; i++) { -uint32_t idx = (ring->first + i) % io->ring_size; +u32 idx = (ring->first + i) % io->ring_size;struct kvm_coalesced_mmio *entry = &ring->coalesced_mmio[idx];#ifdef __x86_64__if (i &1 )TEST_ASSERT (entry->phys_addr == io->pio_port && entry->len ==4 && entry->pio && - *(uint32_t *)entry->data == io->pio_port + i, + *(u32 *)entry->data == io->pio_port + i,"Wanted 4-byte port I/O 0x%x = 0x%x in entry %u, got %u-byte %s 0x%llx = 0x%x" , io->pio_port, io->pio_port + i, i, entry->len, entry->pio ?"PIO" :"MMIO" , - entry->phys_addr, *(uint32_t *)entry->data); + entry->phys_addr, *(u32 *)entry->data); else#endif TEST_ASSERT(entry->phys_addr == io->mmio_gpa &&
@@ -148,7 +148,7 @@ static void vcpu_run_and_verify_coalesced_io(struct kvm_vcpu *vcpu, }static void test_coalesced_io (struct kvm_vcpu *vcpu, -struct kvm_coalesced_io *io,uint32_t ring_start) +struct kvm_coalesced_io *io,u32 ring_start) {struct kvm_coalesced_mmio_ring *ring = io->ring;
tools/testing/selftests/kvm/dirty_log_perf_test.c +1 -1
@@ -129,7 +129,7 @@ struct test_params {bool partition_vcpu_memory_access;enum vm_mem_backing_src_type backing_src;int slots; -uint32_t write_percent; +u32 write_percent;bool random_access; };
tools/testing/selftests/kvm/dirty_log_test.c +18 -18
@@ -236,7 +236,7 @@ static enum log_mode_t host_log_mode_option = LOG_MODE_ALL;/* Logging mode for current run */ static enum log_mode_t host_log_mode;static pthread_t vcpu_thread; -static uint32_t test_dirty_ring_count =TEST_DIRTY_RING_COUNT ; +static u32 test_dirty_ring_count =TEST_DIRTY_RING_COUNT ;static bool clear_log_supported (void ) {
@@ -255,15 +255,15 @@ static void clear_log_create_vm_done(struct kvm_vm *vm) }static void dirty_log_collect_dirty_pages (struct kvm_vcpu *vcpu,int slot, -void *bitmap,uint32_t num_pages, -uint32_t *unused) +void *bitmap,u32 num_pages, +u32 *unused) {kvm_vm_get_dirty_log (vcpu->vm, slot, bitmap); }static void clear_log_collect_dirty_pages (struct kvm_vcpu *vcpu,int slot, -void *bitmap,uint32_t num_pages, -uint32_t *unused) +void *bitmap,u32 num_pages, +u32 *unused) {kvm_vm_get_dirty_log (vcpu->vm, slot, bitmap);kvm_vm_clear_dirty_log (vcpu->vm, slot, bitmap,0 , num_pages);
@@ -298,7 +298,7 @@ static bool dirty_ring_supported(void)static void dirty_ring_create_vm_done (struct kvm_vm *vm) {u64 pages; -uint32_t limit; +u32 limit;/* * We rely on vcpu exit due to full dirty ring state. Adjust
@@ -333,12 +333,12 @@ static inline void dirty_gfn_set_collected(struct kvm_dirty_gfn *gfn)smp_store_release (&gfn->flags,KVM_DIRTY_GFN_F_RESET ); } -static uint32_t dirty_ring_collect_one (struct kvm_dirty_gfn *dirty_gfns, -int slot,void *bitmap, -uint32_t num_pages,uint32_t *fetch_index) +static u32 dirty_ring_collect_one (struct kvm_dirty_gfn *dirty_gfns, +int slot,void *bitmap, +u32 num_pages,u32 *fetch_index) {struct kvm_dirty_gfn *cur; -uint32_t count =0 ; +u32 count =0 ;while (true) { cur = &dirty_gfns[*fetch_index % test_dirty_ring_count];
@@ -359,10 +359,10 @@ static uint32_t dirty_ring_collect_one(struct kvm_dirty_gfn *dirty_gfns, }static void dirty_ring_collect_dirty_pages (struct kvm_vcpu *vcpu,int slot, -void *bitmap,uint32_t num_pages, -uint32_t *ring_buf_idx) +void *bitmap,u32 num_pages, +u32 *ring_buf_idx) { -uint32_t count, cleared; +u32 count, cleared;/* Only have one vcpu */ count = dirty_ring_collect_one(vcpu_map_dirty_ring(vcpu),
@@ -404,8 +404,8 @@ struct log_mode {void (*create_vm_done)(struct kvm_vm *vm);/* Hook to collect the dirty pages into the bitmap provided */ void (*collect_dirty_pages) (struct kvm_vcpu *vcpu,int slot, -void *bitmap,uint32_t num_pages, -uint32_t *ring_buf_idx); +void *bitmap,u32 num_pages, +u32 *ring_buf_idx);/* Hook to call when after each vcpu run */ void (*after_vcpu_run)(struct kvm_vcpu *vcpu); } log_modes[LOG_MODE_NUM] = {
@@ -459,8 +459,8 @@ static void log_mode_create_vm_done(struct kvm_vm *vm) }static void log_mode_collect_dirty_pages (struct kvm_vcpu *vcpu,int slot, -void *bitmap,uint32_t num_pages, -uint32_t *ring_buf_idx) +void *bitmap,u32 num_pages, +u32 *ring_buf_idx) {struct log_mode *mode = &log_modes[host_log_mode];
@@ -600,7 +600,7 @@ static void run_test(enum vm_guest_mode mode, void *arg)struct kvm_vcpu *vcpu;struct kvm_vm *vm;unsigned long *bmap[2 ]; -uint32_t ring_buf_idx =0 ; +u32 ring_buf_idx =0 ;int sem_val;if (!log_mode_supported ()) {
tools/testing/selftests/kvm/guest_print_test.c +3 -3
@@ -29,9 +29,9 @@ TYPE(test_type_i64, I64, "%ld", s64) \ TYPE(test_type_u64, U64u, "%lu", u64) \ TYPE(test_type_x64, U64x, "0x%lx", u64) \ TYPE(test_type_X64, U64X, "0x%lX", u64) \ -TYPE(test_type_u32, U32u, "%u", uint32_t) \ -TYPE(test_type_x32, U32x, "0x%x", uint32_t) \ -TYPE(test_type_X32, U32X, "0x%X", uint32_t) \ +TYPE(test_type_u32, U32u, "%u", u32) \ +TYPE(test_type_x32, U32x, "0x%x", u32) \ +TYPE(test_type_X32, U32X, "0x%X", u32) \ TYPE(test_type_int, INT, "%d", int) \ TYPE(test_type_char, CHAR, "%c", char) \ TYPE(test_type_str, STR, "'%s'", const char *) \
tools/testing/selftests/kvm/hardware_disable_test.c +3 -3
@@ -80,7 +80,7 @@ static inline void check_join(pthread_t thread, void **retval)TEST_ASSERT (r ==0 ,"%s: failed to join thread" , __func__); } -static void run_test (uint32_t run) +static void run_test (u32 run) {struct kvm_vcpu *vcpu;struct kvm_vm *vm;
@@ -88,7 +88,7 @@ static void run_test(uint32_t run)pthread_t threads[VCPU_NUM ];pthread_t throw_away;void *b; -uint32_t i, j; +u32 i, j;CPU_ZERO (&cpu_set);for (i =0 ; i <VCPU_NUM ; i++)
@@ -149,7 +149,7 @@ void wait_for_child_setup(pid_t pid)int main (int argc,char **argv) { -uint32_t i; +u32 i;int s, r;pid_t pid;
tools/testing/selftests/kvm/include/arm64/arch_timer.h +5 -5
@@ -26,7 +26,7 @@ enum arch_timer {#define cycles_to_usec (cycles) \ ((u64)(cycles) * 1000000 / timer_get_cntfrq()) -static inline uint32_t timer_get_cntfrq (void ) +static inline u32 timer_get_cntfrq (void ) {return read_sysreg (cntfrq_el0); }
@@ -111,7 +111,7 @@ static inline int32_t timer_get_tval(enum arch_timer timer)return 0 ; } -static inline void timer_set_ctl (enum arch_timer timer,uint32_t ctl) +static inline void timer_set_ctl (enum arch_timer timer,u32 ctl) {switch (timer) {case VIRTUAL :
@@ -127,7 +127,7 @@ static inline void timer_set_ctl(enum arch_timer timer, uint32_t ctl)isb (); } -static inline uint32_t timer_get_ctl (enum arch_timer timer) +static inline u32 timer_get_ctl (enum arch_timer timer) {switch (timer) {case VIRTUAL :
@@ -142,7 +142,7 @@ static inline uint32_t timer_get_ctl(enum arch_timer timer)return 0 ; } -static inline void timer_set_next_cval_ms (enum arch_timer timer,uint32_t msec) +static inline void timer_set_next_cval_ms (enum arch_timer timer,u32 msec) {u64 now_ct =timer_get_cntct (timer);u64 next_ct = now_ct +msec_to_cycles (msec);
@@ -150,7 +150,7 @@ static inline void timer_set_next_cval_ms(enum arch_timer timer, uint32_t msec)timer_set_cval (timer, next_ct); } -static inline void timer_set_next_tval_ms (enum arch_timer timer,uint32_t msec) +static inline void timer_set_next_tval_ms (enum arch_timer timer,u32 msec) {timer_set_tval (timer,msec_to_cycles (msec)); }
tools/testing/selftests/kvm/include/arm64/gic.h +1 -1
@@ -49,7 +49,7 @@ void gic_set_dir(unsigned int intid);*/ void gic_set_eoi_split (bool split);void gic_set_priority_mask (u64 mask); -void gic_set_priority (uint32_t intid,uint32_t prio); +void gic_set_priority (u32 intid,u32 prio);void gic_irq_set_active (unsigned int intid);void gic_irq_clear_active (unsigned int intid);bool gic_irq_get_active (unsigned int intid);
tools/testing/selftests/kvm/include/arm64/processor.h +5 -5
@@ -124,7 +124,7 @@#define PTE_ADDR_51_50_LPA2_SHIFT 8void aarch64_vcpu_setup (struct kvm_vcpu *vcpu,struct kvm_vcpu_init *init); -struct kvm_vcpu *aarch64_vcpu_add (struct kvm_vm *vm,uint32_t vcpu_id, +struct kvm_vcpu *aarch64_vcpu_add (struct kvm_vm *vm,u32 vcpu_id,struct kvm_vcpu_init *init,void *guest_code);struct ex_regs {
@@ -163,8 +163,8 @@ enum { (v) == VECTOR_SYNC_LOWER_64 || \ (v) == VECTOR_SYNC_LOWER_32) -void aarch64_get_supported_page_sizes (uint32_t ipa,uint32_t *ipa4k, -uint32_t *ipa16k,uint32_t *ipa64k); +void aarch64_get_supported_page_sizes (u32 ipa,u32 *ipa4k, +u32 *ipa16k,u32 *ipa64k);void vm_init_descriptor_tables (struct kvm_vm *vm);void vcpu_init_descriptor_tables (struct kvm_vcpu *vcpu);
@@ -272,7 +272,7 @@ struct arm_smccc_res {* @res: pointer to write the return values from registers x0-x3 * */ -void smccc_hvc (uint32_t function_id,u64 arg0,u64 arg1, +void smccc_hvc (u32 function_id,u64 arg0,u64 arg1,u64 arg2,u64 arg3,u64 arg4,u64 arg5,u64 arg6,struct arm_smccc_res *res);
@@ -283,7 +283,7 @@ void smccc_hvc(uint32_t function_id, u64 arg0, u64 arg1,* @res: pointer to write the return values from registers x0-x3 * */ -void smccc_smc (uint32_t function_id,u64 arg0,u64 arg1, +void smccc_smc (u32 function_id,u64 arg0,u64 arg1,u64 arg2,u64 arg3,u64 arg4,u64 arg5,u64 arg6,struct arm_smccc_res *res);
tools/testing/selftests/kvm/include/arm64/vgic.h +7 -7
@@ -16,19 +16,19 @@ ((u64)(flags) << 12) | \ index) -int vgic_v3_setup (struct kvm_vm *vm,unsigned int nr_vcpus,uint32_t nr_irqs); +int vgic_v3_setup (struct kvm_vm *vm,unsigned int nr_vcpus,u32 nr_irqs);#define VGIC_MAX_RESERVED 1023 -void kvm_irq_set_level_info (int gic_fd,uint32_t intid,int level); -int _kvm_irq_set_level_info (int gic_fd,uint32_t intid,int level); +void kvm_irq_set_level_info (int gic_fd,u32 intid,int level); +int _kvm_irq_set_level_info (int gic_fd,u32 intid,int level); -void kvm_arm_irq_line (struct kvm_vm *vm,uint32_t intid,int level); -int _kvm_arm_irq_line (struct kvm_vm *vm,uint32_t intid,int level); +void kvm_arm_irq_line (struct kvm_vm *vm,u32 intid,int level); +int _kvm_arm_irq_line (struct kvm_vm *vm,u32 intid,int level);/* The vcpu arg only applies to private interrupts. */ -void kvm_irq_write_ispendr (int gic_fd,uint32_t intid,struct kvm_vcpu *vcpu); -void kvm_irq_write_isactiver (int gic_fd,uint32_t intid,struct kvm_vcpu *vcpu); +void kvm_irq_write_ispendr (int gic_fd,u32 intid,struct kvm_vcpu *vcpu); +void kvm_irq_write_isactiver (int gic_fd,u32 intid,struct kvm_vcpu *vcpu);#define KVM_IRQCHIP_NUM_PINS (1020 - 32)
tools/testing/selftests/kvm/include/kvm_util.h +58 -58
329 lines not on this page · raw message
tools/testing/selftests/kvm/include/memstress.h +5 -5
@@ -35,8 +35,8 @@ struct memstress_args {u64 gpa;u64 size;u64 guest_page_size; -uint32_t random_seed; -uint32_t write_percent; +u32 random_seed; +u32 write_percent;/* Run vCPUs in L2 instead of L1, if the architecture supports it. */ bool nested;
@@ -45,7 +45,7 @@ struct memstress_args {/* True if all vCPUs are pinned to pCPUs */ bool pin_vcpus;/* The vCPU=>pCPU pinning map. Only valid if pin_vcpus is true. */ -uint32_t vcpu_to_pcpu[KVM_MAX_VCPUS ]; +u32 vcpu_to_pcpu[KVM_MAX_VCPUS ];/* Test is done, stop running vCPUs. */ bool stop_vcpus;
@@ -61,12 +61,12 @@ struct kvm_vm *memstress_create_vm(enum vm_guest_mode mode, int nr_vcpus, bool partition_vcpu_memory_access);void memstress_destroy_vm (struct kvm_vm *vm); -void memstress_set_write_percent (struct kvm_vm *vm,uint32_t write_percent); +void memstress_set_write_percent (struct kvm_vm *vm,u32 write_percent);void memstress_set_random_access (struct kvm_vm *vm,bool random_access);void memstress_start_vcpu_threads (int vcpus,void (*vcpu_fn)(struct memstress_vcpu_args *));void memstress_join_vcpu_threads (int vcpus); -void memstress_guest_code (uint32_t vcpu_id); +void memstress_guest_code (u32 vcpu_id);u64 memstress_nested_pages (int nr_vcpus);void memstress_setup_nested (struct kvm_vm *vm,int nr_vcpus,struct kvm_vcpu *vcpus[]);
tools/testing/selftests/kvm/include/riscv/arch_timer.h +1 -1
@@ -47,7 +47,7 @@ static inline void timer_irq_disable(void)csr_clear (CSR_SIE ,IE_TIE ); } -static inline void timer_set_next_cmp_ms (uint32_t msec) +static inline void timer_set_next_cmp_ms (u32 msec) {u64 now_ct =timer_get_cycles ();u64 next_ct = now_ct +msec_to_cycles (msec);
tools/testing/selftests/kvm/include/test_util.h +10 -10
@@ -90,14 +90,14 @@ struct timespec timespec_elapsed(struct timespec start);struct timespec timespec_div (struct timespec ts,int divisor);struct guest_random_state { -uint32_t seed; +u32 seed; }; -extern uint32_t guest_random_seed; +extern u32 guest_random_seed;extern struct guest_random_state guest_rng; -struct guest_random_state new_guest_random_state (uint32_t seed); -uint32_t guest_random_u32 (struct guest_random_state *state); +struct guest_random_state new_guest_random_state (u32 seed); +u32 guest_random_u32 (struct guest_random_state *state);static inline bool __guest_random_bool (struct guest_random_state *state,uint8_t percent)
@@ -141,7 +141,7 @@ enum vm_mem_backing_src_type {struct vm_mem_backing_src_alias {const char *name; -uint32_t flag; +u32 flag; };#define MIN_RUN_DELAY_NS 200000UL
@@ -149,9 +149,9 @@ struct vm_mem_backing_src_alias {bool thp_configured (void );size_t get_trans_hugepagesz (void );size_t get_def_hugetlb_pagesz (void ); -const struct vm_mem_backing_src_alias *vm_mem_backing_src_alias (uint32_t i); -size_t get_backing_src_pagesz (uint32_t i); -bool is_backing_src_hugetlb (uint32_t i); +const struct vm_mem_backing_src_alias *vm_mem_backing_src_alias (u32 i); +size_t get_backing_src_pagesz (u32 i); +bool is_backing_src_hugetlb (u32 i);void backing_src_help (const char *flag);enum vm_mem_backing_src_type parse_backing_src_type (const char *type_name);long get_run_delay (void );
@@ -197,7 +197,7 @@ static inline void *align_ptr_up(void *x, size_t size)int atoi_paranoid (const char *num_str); -static inline uint32_t atoi_positive (const char *name,const char *num_str) +static inline u32 atoi_positive (const char *name,const char *num_str) {int num =atoi_paranoid (num_str);
@@ -205,7 +205,7 @@ static inline uint32_t atoi_positive(const char *name, const char *num_str)return num; } -static inline uint32_t atoi_non_negative (const char *name,const char *num_str) +static inline u32 atoi_non_negative (const char *name,const char *num_str) {int num =atoi_paranoid (num_str);
tools/testing/selftests/kvm/include/timer_test.h +6 -6
@@ -18,11 +18,11 @@/* Timer test cmdline parameters */ struct test_args { -uint32_t nr_vcpus; -uint32_t nr_iter; -uint32_t timer_period_ms; -uint32_t migration_freq_ms; -uint32_t timer_err_margin_us; +u32 nr_vcpus; +u32 nr_iter; +u32 timer_period_ms; +u32 migration_freq_ms; +u32 timer_err_margin_us;/* Members of struct kvm_arm_counter_offset */ u64 counter_offset;u64 reserved;
@@ -30,7 +30,7 @@ struct test_args {/* Shared variables between host and guest */ struct test_vcpu_shared_data { -uint32_t nr_iter; +u32 nr_iter;int guest_stage;u64 xcnt; };
tools/testing/selftests/kvm/include/x86/apic.h +5 -5
@@ -72,19 +72,19 @@ void apic_disable(void);void xapic_enable (void );void x2apic_enable (void ); -static inline uint32_t get_bsp_flag (void ) +static inline u32 get_bsp_flag (void ) {return rdmsr (MSR_IA32_APICBASE ) &MSR_IA32_APICBASE_BSP ; } -static inline uint32_t xapic_read_reg (unsigned int reg) +static inline u32 xapic_read_reg (unsigned int reg) { -return ((volatile uint32_t *)APIC_DEFAULT_GPA )[reg >>2 ]; +return ((volatile u32 *)APIC_DEFAULT_GPA )[reg >>2 ]; } -static inline void xapic_write_reg (unsigned int reg,uint32_t val) +static inline void xapic_write_reg (unsigned int reg,u32 val) { - ((volatile uint32_t *)APIC_DEFAULT_GPA )[reg >>2 ] = val; + ((volatile u32 *)APIC_DEFAULT_GPA )[reg >>2 ] = val; }static inline u64 x2apic_read_reg (unsigned int reg)
tools/testing/selftests/kvm/include/x86/evmcs.h +1 -1
@@ -11,7 +11,7 @@#include "vmx.h" #define u16 uint16_t -#define u32 uint32_t +#define u32 u32#define u64 u64#define EVMCS_VERSION 1
tools/testing/selftests/kvm/include/x86/processor.h +50 -50
285 lines not on this page · raw message
tools/testing/selftests/kvm/include/x86/sev.h +3 -3
@@ -27,13 +27,13 @@ enum sev_guest_state {#define GHCB_MSR_TERM_REQ 0x100 -void sev_vm_launch (struct kvm_vm *vm,uint32_t policy); +void sev_vm_launch (struct kvm_vm *vm,u32 policy);void sev_vm_launch_measure (struct kvm_vm *vm,uint8_t *measurement);void sev_vm_launch_finish (struct kvm_vm *vm); -struct kvm_vm *vm_sev_create_with_one_vcpu (uint32_t type,void *guest_code, +struct kvm_vm *vm_sev_create_with_one_vcpu (u32 type,void *guest_code,struct kvm_vcpu **cpu); -void vm_sev_launch (struct kvm_vm *vm,uint32_t policy,uint8_t *measurement); +void vm_sev_launch (struct kvm_vm *vm,u32 policy,uint8_t *measurement);kvm_static_assert (SEV_RET_SUCCESS ==0 );
tools/testing/selftests/kvm/include/x86/vmx.h +5 -5
@@ -285,8 +285,8 @@ enum vmcs_field { };struct vmx_msr_entry { -uint32_t index; -uint32_t reserved; +u32 index; +u32 reserved;u64 value; } __attribute__ ((aligned (16 )));
@@ -490,7 +490,7 @@ static inline int vmwrite(u64 encoding, u64 value)return ret; } -static inline uint32_t vmcs_revision (void ) +static inline u32 vmcs_revision (void ) {return rdmsr (MSR_IA32_VMX_BASIC ); }
@@ -564,12 +564,12 @@ void nested_pg_map(struct vmx_pages *vmx, struct kvm_vm *vm,void nested_map (struct vmx_pages *vmx,struct kvm_vm *vm,u64 nested_paddr,u64 paddr,u64 size);void nested_map_memslot (struct vmx_pages *vmx,struct kvm_vm *vm, -uint32_t memslot); +u32 memslot);void nested_identity_map_1g (struct vmx_pages *vmx,struct kvm_vm *vm,u64 addr,u64 size);bool kvm_cpu_has_ept (void );void prepare_eptp (struct vmx_pages *vmx,struct kvm_vm *vm, -uint32_t eptp_memslot); +u32 eptp_memslot);void prepare_virtualize_apic_accesses (struct vmx_pages *vmx,struct kvm_vm *vm);#endif /* SELFTEST_KVM_VMX_H */
tools/testing/selftests/kvm/kvm_page_table_test.c +1 -1
@@ -63,7 +63,7 @@ struct test_args {static enum test_stage guest_test_stage;/* Host variables */ -static uint32_t nr_vcpus =1 ; +static u32 nr_vcpus =1 ;static struct test_args test_args;static enum test_stage *current_stage;static bool host_quit;
tools/testing/selftests/kvm/lib/arm64/gic.c +1 -1
@@ -50,7 +50,7 @@ static void gic_dist_init(enum gic_type type, unsigned int nr_cpus)void gic_init (enum gic_type type,unsigned int nr_cpus) { -uint32_t cpu =guest_get_vcpuid (); +u32 cpu =guest_get_vcpuid ();GUEST_ASSERT (type <GIC_TYPE_MAX );GUEST_ASSERT (nr_cpus);
tools/testing/selftests/kvm/lib/arm64/gic_private.h +10 -10
@@ -13,18 +13,18 @@ struct gic_common_ops {void (*gic_irq_enable)(unsigned int intid);void (*gic_irq_disable)(unsigned int intid);u64 (*gic_read_iar)(void); -void (*gic_write_eoir)(uint32_t irq); -void (*gic_write_dir)(uint32_t irq); +void (*gic_write_eoir)(u32 irq); +void (*gic_write_dir)(u32 irq);void (*gic_set_eoi_split)(bool split);void (*gic_set_priority_mask)(u64 mask); -void (*gic_set_priority)(uint32_t intid,uint32_t prio); -void (*gic_irq_set_active)(uint32_t intid); -void (*gic_irq_clear_active)(uint32_t intid); -bool (*gic_irq_get_active)(uint32_t intid); -void (*gic_irq_set_pending)(uint32_t intid); -void (*gic_irq_clear_pending)(uint32_t intid); -bool (*gic_irq_get_pending)(uint32_t intid); -void (*gic_irq_set_config)(uint32_t intid,bool is_edge); +void (*gic_set_priority)(u32 intid,u32 prio); +void (*gic_irq_set_active)(u32 intid); +void (*gic_irq_clear_active)(u32 intid); +bool (*gic_irq_get_active)(u32 intid); +void (*gic_irq_set_pending)(u32 intid); +void (*gic_irq_clear_pending)(u32 intid); +bool (*gic_irq_get_pending)(u32 intid); +void (*gic_irq_set_config)(u32 intid,bool is_edge); };extern const struct gic_common_ops gicv3_ops;
tools/testing/selftests/kvm/lib/arm64/gic_v3.c +37 -37
209 lines not on this page · raw message
tools/testing/selftests/kvm/lib/arm64/processor.c +11 -11
@@ -380,7 +380,7 @@ void vcpu_arch_set_entry_point(struct kvm_vcpu *vcpu, void *guest_code)vcpu_set_reg (vcpu,ARM64_CORE_REG (regs.pc), (u64 )guest_code); } -static struct kvm_vcpu *__aarch64_vcpu_add (struct kvm_vm *vm,uint32_t vcpu_id, +static struct kvm_vcpu *__aarch64_vcpu_add (struct kvm_vm *vm,u32 vcpu_id,struct kvm_vcpu_init *init) {size_t stack_size;
@@ -399,7 +399,7 @@ static struct kvm_vcpu *__aarch64_vcpu_add(struct kvm_vm *vm, uint32_t vcpu_id,return vcpu; } -struct kvm_vcpu *aarch64_vcpu_add (struct kvm_vm *vm,uint32_t vcpu_id, +struct kvm_vcpu *aarch64_vcpu_add (struct kvm_vm *vm,u32 vcpu_id,struct kvm_vcpu_init *init,void *guest_code) {struct kvm_vcpu *vcpu =__aarch64_vcpu_add (vm, vcpu_id, init);
@@ -409,7 +409,7 @@ struct kvm_vcpu *aarch64_vcpu_add(struct kvm_vm *vm, uint32_t vcpu_id,return vcpu; } -struct kvm_vcpu *vm_arch_vcpu_add (struct kvm_vm *vm,uint32_t vcpu_id) +struct kvm_vcpu *vm_arch_vcpu_add (struct kvm_vm *vm,u32 vcpu_id) {return __aarch64_vcpu_add (vm, vcpu_id,NULL ); }
@@ -530,13 +530,13 @@ void vm_install_exception_handler(struct kvm_vm *vm, int vector, handlers->exception_handlers[vector][0 ] = handler; } -uint32_t guest_get_vcpuid (void ) +u32 guest_get_vcpuid (void ) {return read_sysreg (tpidr_el1); } -static uint32_t max_ipa_for_page_size (uint32_t vm_ipa,uint32_t gran, -uint32_t not_sup_val,uint32_t ipa52_min_val) +static u32 max_ipa_for_page_size (u32 vm_ipa,u32 gran, +u32 not_sup_val,u32 ipa52_min_val) {if (gran == not_sup_val)return 0 ;
@@ -546,13 +546,13 @@ static uint32_t max_ipa_for_page_size(uint32_t vm_ipa, uint32_t gran,return min (vm_ipa,48U ); } -void aarch64_get_supported_page_sizes (uint32_t ipa,uint32_t *ipa4k, -uint32_t *ipa16k,uint32_t *ipa64k) +void aarch64_get_supported_page_sizes (u32 ipa,u32 *ipa4k, +u32 *ipa16k,u32 *ipa64k) {struct kvm_vcpu_init preferred_init;int kvm_fd, vm_fd, vcpu_fd, err;u64 val; -uint32_t gran; +u32 gran;struct kvm_one_reg reg = { .id =KVM_ARM64_SYS_REG (SYS_ID_AA64MMFR0_EL1 ), .addr = (u64)&val,
@@ -613,7 +613,7 @@ void aarch64_get_supported_page_sizes(uint32_t ipa, uint32_t *ipa4k, : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7") -void smccc_hvc (uint32_t function_id,u64 arg0,u64 arg1, +void smccc_hvc (u32 function_id,u64 arg0,u64 arg1,u64 arg2,u64 arg3,u64 arg4,u64 arg5,u64 arg6,struct arm_smccc_res *res) {
@@ -621,7 +621,7 @@ void smccc_hvc(uint32_t function_id, u64 arg0, u64 arg1, arg6, res); } -void smccc_smc (uint32_t function_id,u64 arg0,u64 arg1, +void smccc_smc (u32 function_id,u64 arg0,u64 arg1,u64 arg2,u64 arg3,u64 arg4,u64 arg5,u64 arg6,struct arm_smccc_res *res) {
tools/testing/selftests/kvm/lib/arm64/vgic.c +10 -10
@@ -30,7 +30,7 @@* redistributor regions of the guest. Since it depends on the number of * vCPUs for the VM, it must be called after all the vCPUs have been created. */ -int vgic_v3_setup (struct kvm_vm *vm,unsigned int nr_vcpus,uint32_t nr_irqs) +int vgic_v3_setup (struct kvm_vm *vm,unsigned int nr_vcpus,u32 nr_irqs) {int gic_fd;u64 attr;
@@ -80,7 +80,7 @@ int vgic_v3_setup(struct kvm_vm *vm, unsigned int nr_vcpus, uint32_t nr_irqs) }/* should only work for level sensitive interrupts */ -int _kvm_irq_set_level_info (int gic_fd,uint32_t intid,int level) +int _kvm_irq_set_level_info (int gic_fd,u32 intid,int level) {u64 attr =32 * (intid /32 );u64 index = intid %32 ;
@@ -98,16 +98,16 @@ int _kvm_irq_set_level_info(int gic_fd, uint32_t intid, int level)return ret; } -void kvm_irq_set_level_info (int gic_fd,uint32_t intid,int level) +void kvm_irq_set_level_info (int gic_fd,u32 intid,int level) {int ret =_kvm_irq_set_level_info (gic_fd, intid, level);TEST_ASSERT (!ret,KVM_IOCTL_ERROR (KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO , ret)); } -int _kvm_arm_irq_line (struct kvm_vm *vm,uint32_t intid,int level) +int _kvm_arm_irq_line (struct kvm_vm *vm,u32 intid,int level) { -uint32_t irq = intid &KVM_ARM_IRQ_NUM_MASK ; +u32 irq = intid &KVM_ARM_IRQ_NUM_MASK ;TEST_ASSERT (!INTID_IS_SGI (intid),"KVM_IRQ_LINE's interface itself " "doesn't allow injecting SGIs. There's no mask for it." );
@@ -120,14 +120,14 @@ int _kvm_arm_irq_line(struct kvm_vm *vm, uint32_t intid, int level)return _kvm_irq_line (vm, irq, level); } -void kvm_arm_irq_line (struct kvm_vm *vm,uint32_t intid,int level) +void kvm_arm_irq_line (struct kvm_vm *vm,u32 intid,int level) {int ret =_kvm_arm_irq_line (vm, intid, level);TEST_ASSERT (!ret,KVM_IOCTL_ERROR (KVM_IRQ_LINE , ret)); } -static void vgic_poke_irq (int gic_fd,uint32_t intid,struct kvm_vcpu *vcpu, +static void vgic_poke_irq (int gic_fd,u32 intid,struct kvm_vcpu *vcpu,u64 reg_off) {u64 reg = intid /32 ;
@@ -136,7 +136,7 @@ static void vgic_poke_irq(int gic_fd, uint32_t intid, struct kvm_vcpu *vcpu,u64 val;bool intid_is_private =INTID_IS_SGI (intid) ||INTID_IS_PPI (intid); -uint32_t group = intid_is_private ?KVM_DEV_ARM_VGIC_GRP_REDIST_REGS +u32 group = intid_is_private ?KVM_DEV_ARM_VGIC_GRP_REDIST_REGS :KVM_DEV_ARM_VGIC_GRP_DIST_REGS ;if (intid_is_private) {
@@ -159,12 +159,12 @@ static void vgic_poke_irq(int gic_fd, uint32_t intid, struct kvm_vcpu *vcpu,kvm_device_attr_set (gic_fd, group, attr, &val); } -void kvm_irq_write_ispendr (int gic_fd,uint32_t intid,struct kvm_vcpu *vcpu) +void kvm_irq_write_ispendr (int gic_fd,u32 intid,struct kvm_vcpu *vcpu) {vgic_poke_irq (gic_fd, intid, vcpu,GICD_ISPENDR ); } -void kvm_irq_write_isactiver (int gic_fd,uint32_t intid,struct kvm_vcpu *vcpu) +void kvm_irq_write_isactiver (int gic_fd,u32 intid,struct kvm_vcpu *vcpu) {vgic_poke_irq (gic_fd, intid, vcpu,GICD_ISACTIVER ); }
tools/testing/selftests/kvm/lib/guest_modes.c +1 -1
@@ -18,7 +18,7 @@ void guest_modes_append_default(void)#else {unsigned int limit =kvm_check_cap (KVM_CAP_ARM_VM_IPA_SIZE ); -uint32_t ipa4k, ipa16k, ipa64k; +u32 ipa4k, ipa16k, ipa64k;int i;aarch64_get_supported_page_sizes (limit, &ipa4k, &ipa16k, &ipa64k);
tools/testing/selftests/kvm/lib/guest_sprintf.c +3 -3
@@ -35,8 +35,8 @@ static int skip_atoi(const char **s) ({ \int __res; \ \ - __res = ((u64 )n) % (uint32_t ) base; \ - n = ((u64 )n) / (uint32_t ) base; \ + __res = ((u64 )n) % (u32 )base; \ + n = ((u64 )n) / (u32 )base; \ __res; \ })
@@ -292,7 +292,7 @@ int guest_vsnprintf(char *buf, int n, const char *fmt, va_list args) }else if (flags &SIGN ) num =va_arg (args, int);else - num =va_arg (args, uint32_t); + num =va_arg (args, u32); str =number (str, end, num, base, field_width, precision, flags); }
tools/testing/selftests/kvm/lib/kvm_util.c +40 -40
282 lines not on this page · raw message
tools/testing/selftests/kvm/lib/memstress.c +2 -2
@@ -44,7 +44,7 @@ static struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];* Continuously write to the first 8 bytes of each page in the * specified region. */ -void memstress_guest_code (uint32_t vcpu_idx) +void memstress_guest_code (u32 vcpu_idx) {struct memstress_args *args = &memstress_args;struct memstress_vcpu_args *vcpu_args = &args->vcpu_args[vcpu_idx];
@@ -236,7 +236,7 @@ void memstress_destroy_vm(struct kvm_vm *vm)kvm_vm_free (vm); } -void memstress_set_write_percent (struct kvm_vm *vm,uint32_t write_percent) +void memstress_set_write_percent (struct kvm_vm *vm,u32 write_percent) { memstress_args.write_percent = write_percent;sync_global_to_guest (vm, memstress_args.write_percent);
tools/testing/selftests/kvm/lib/riscv/processor.c +3 -3
@@ -49,7 +49,7 @@ static u64 pte_index_mask[] = { PGTBL_L3_INDEX_MASK, }; -static uint32_t pte_index_shift[] = { +static u32 pte_index_shift[] = {PGTBL_L0_INDEX_SHIFT ,PGTBL_L1_INDEX_SHIFT ,PGTBL_L2_INDEX_SHIFT ,
@@ -295,7 +295,7 @@ void vcpu_arch_set_entry_point(struct kvm_vcpu *vcpu, void *guest_code)vcpu_set_reg (vcpu,RISCV_CORE_REG (regs.pc), (unsigned long )guest_code); } -struct kvm_vcpu *vm_arch_vcpu_add (struct kvm_vm *vm,uint32_t vcpu_id) +struct kvm_vcpu *vm_arch_vcpu_add (struct kvm_vm *vm,u32 vcpu_id) {int r;size_t stack_size;
@@ -454,7 +454,7 @@ void vm_install_interrupt_handler(struct kvm_vm *vm, exception_handler_fn handle handlers->exception_handlers[1 ][0 ] = handler; } -uint32_t guest_get_vcpuid (void ) +u32 guest_get_vcpuid (void ) {return csr_read (CSR_SSCRATCH ); }
tools/testing/selftests/kvm/lib/s390/processor.c +1 -1
@@ -160,7 +160,7 @@ void vcpu_arch_set_entry_point(struct kvm_vcpu *vcpu, void *guest_code) vcpu->run->psw_addr = (uintptr_t )guest_code; } -struct kvm_vcpu *vm_arch_vcpu_add (struct kvm_vm *vm,uint32_t vcpu_id) +struct kvm_vcpu *vm_arch_vcpu_add (struct kvm_vm *vm,u32 vcpu_id) {size_t stack_size =DEFAULT_STACK_PGS *getpagesize ();u64 stack_vaddr;
tools/testing/selftests/kvm/lib/sparsebit.c +2 -2
@@ -80,7 +80,7 @@* typedef u64 sparsebit_num_t; * * sparsebit_idx_t idx; -* uint32_t mask; +* u32 mask; * sparsebit_num_t num_after; * * The idx member contains the bit index of the first bit described by this
@@ -162,7 +162,7 @@#define DUMP_LINE_MAX 100/* Does not include indent amount */ -typedef uint32_t mask_t ; +typedef u32 mask_t ;#define MASK_BITS (sizeof(mask_t) * CHAR_BIT)struct node {
tools/testing/selftests/kvm/lib/test_util.c +7 -7
@@ -23,15 +23,15 @@* Park-Miller LCG using standard constants. */ -struct guest_random_state new_guest_random_state (uint32_t seed) +struct guest_random_state new_guest_random_state (u32 seed) {struct guest_random_state s = {.seed = seed};return s; } -uint32_t guest_random_u32 (struct guest_random_state *state) +u32 guest_random_u32 (struct guest_random_state *state) { - state->seed = (u64 )state->seed *48271 % ((uint32_t )(1 <<31 ) -1 ); + state->seed = (u64 )state->seed *48271 % ((u32)(1 <<31 ) -1 );return state->seed; }
@@ -198,7 +198,7 @@ size_t get_def_hugetlb_pagesz(void)#define ANON_FLAGS (MAP_PRIVATE | MAP_ANONYMOUS)#define ANON_HUGE_FLAGS (ANON_FLAGS | MAP_HUGETLB) -const struct vm_mem_backing_src_alias *vm_mem_backing_src_alias (uint32_t i) +const struct vm_mem_backing_src_alias *vm_mem_backing_src_alias (u32 i) {static const struct vm_mem_backing_src_alias aliases[] = { [VM_MEM_SRC_ANONYMOUS ] = {
@@ -290,9 +290,9 @@ const struct vm_mem_backing_src_alias *vm_mem_backing_src_alias(uint32_t i)#define MAP_HUGE_PAGE_SIZE (x) (1ULL << ((x >> MAP_HUGE_SHIFT) & MAP_HUGE_MASK)) -size_t get_backing_src_pagesz (uint32_t i) +size_t get_backing_src_pagesz (u32 i) { -uint32_t flag =vm_mem_backing_src_alias (i)->flag; +u32 flag =vm_mem_backing_src_alias (i)->flag;switch (i) {case VM_MEM_SRC_ANONYMOUS :
@@ -308,7 +308,7 @@ size_t get_backing_src_pagesz(uint32_t i) } } -bool is_backing_src_hugetlb (uint32_t i) +bool is_backing_src_hugetlb (u32 i) {return !!(vm_mem_backing_src_alias (i)->flag &MAP_HUGETLB ); }
tools/testing/selftests/kvm/lib/x86/processor.c +11 -11
@@ -659,7 +659,7 @@ void vcpu_arch_set_entry_point(struct kvm_vcpu *vcpu, void *guest_code)vcpu_regs_set (vcpu, ®s); } -struct kvm_vcpu *vm_arch_vcpu_add (struct kvm_vm *vm,uint32_t vcpu_id) +struct kvm_vcpu *vm_arch_vcpu_add (struct kvm_vm *vm,u32 vcpu_id) {struct kvm_mp_state mp_state;struct kvm_regs regs;
@@ -710,7 +710,7 @@ struct kvm_vcpu *vm_arch_vcpu_add(struct kvm_vm *vm, uint32_t vcpu_id)return vcpu; } -struct kvm_vcpu *vm_arch_vcpu_recreate (struct kvm_vm *vm,uint32_t vcpu_id) +struct kvm_vcpu *vm_arch_vcpu_recreate (struct kvm_vm *vm,u32 vcpu_id) {struct kvm_vcpu *vcpu =__vm_vcpu_add (vm, vcpu_id);
@@ -745,9 +745,9 @@ const struct kvm_cpuid2 *kvm_get_supported_cpuid(void)return kvm_supported_cpuid; } -static uint32_t __kvm_cpu_has (const struct kvm_cpuid2 *cpuid, -uint32_t function,uint32_t index, -uint8_t reg,uint8_t lo,uint8_t hi) +static u32 __kvm_cpu_has (const struct kvm_cpuid2 *cpuid, +u32 function,u32 index, +uint8_t reg,uint8_t lo,uint8_t hi) {const struct kvm_cpuid_entry2 *entry;int i;
@@ -774,8 +774,8 @@ bool kvm_cpuid_has(const struct kvm_cpuid2 *cpuid, feature.reg, feature.bit, feature.bit); } -uint32_t kvm_cpuid_property (const struct kvm_cpuid2 *cpuid, -struct kvm_x86_cpu_property property) +u32 kvm_cpuid_property (const struct kvm_cpuid2 *cpuid, +struct kvm_x86_cpu_property property) {return __kvm_cpu_has (cpuid, property.function, property.index, property.reg, property.lo_bit, property.hi_bit);
@@ -857,7 +857,7 @@ void vcpu_init_cpuid(struct kvm_vcpu *vcpu, const struct kvm_cpuid2 *cpuid)void vcpu_set_cpuid_property (struct kvm_vcpu *vcpu,struct kvm_x86_cpu_property property, -uint32_t value) +u32 value) {struct kvm_cpuid_entry2 *entry;
@@ -872,7 +872,7 @@ void vcpu_set_cpuid_property(struct kvm_vcpu *vcpu,TEST_ASSERT_EQ (kvm_cpuid_property (vcpu->cpuid, property), value); } -void vcpu_clear_cpuid_entry (struct kvm_vcpu *vcpu,uint32_t function) +void vcpu_clear_cpuid_entry (struct kvm_vcpu *vcpu,u32 function) {struct kvm_cpuid_entry2 *entry =vcpu_get_cpuid_entry (vcpu, function);
@@ -1034,7 +1034,7 @@ const struct kvm_msr_list *kvm_get_feature_msr_index_list(void)return list; } -bool kvm_msr_is_in_save_restore_list (uint32_t msr_index) +bool kvm_msr_is_in_save_restore_list (u32 msr_index) {const struct kvm_msr_list *list =kvm_get_msr_index_list ();int i;
@@ -1165,7 +1165,7 @@ void kvm_init_vm_address_properties(struct kvm_vm *vm) }const struct kvm_cpuid_entry2 *get_cpuid_entry (const struct kvm_cpuid2 *cpuid, -uint32_t function,uint32_t index) +u32 function,u32 index) {int i;
tools/testing/selftests/kvm/lib/x86/sev.c +3 -3
@@ -60,7 +60,7 @@ void sev_es_vm_init(struct kvm_vm *vm) } } -void sev_vm_launch (struct kvm_vm *vm,uint32_t policy) +void sev_vm_launch (struct kvm_vm *vm,u32 policy) {struct kvm_sev_launch_start launch_start = { .policy = policy,
@@ -112,7 +112,7 @@ void sev_vm_launch_finish(struct kvm_vm *vm)TEST_ASSERT_EQ (status.state,SEV_GUEST_STATE_RUNNING ); } -struct kvm_vm *vm_sev_create_with_one_vcpu (uint32_t type,void *guest_code, +struct kvm_vm *vm_sev_create_with_one_vcpu (u32 type,void *guest_code,struct kvm_vcpu **cpu) {struct vm_shape shape = {
@@ -128,7 +128,7 @@ struct kvm_vm *vm_sev_create_with_one_vcpu(uint32_t type, void *guest_code,return vm; } -void vm_sev_launch (struct kvm_vm *vm,uint32_t policy,uint8_t *measurement) +void vm_sev_launch (struct kvm_vm *vm,u32 policy,uint8_t *measurement) {sev_vm_launch (vm, policy);
tools/testing/selftests/kvm/lib/x86/vmx.c +7 -7
@@ -148,7 +148,7 @@ bool prepare_for_vmx_operation(struct vmx_pages *vmx)wrmsr (MSR_IA32_FEAT_CTL , feature_control | required);/* Enter VMX root operation. */ - *(uint32_t *)(vmx->vmxon) =vmcs_revision (); + *(u32 *)(vmx->vmxon) =vmcs_revision ();if (vmxon (vmx->vmxon_gpa))return false;
@@ -158,7 +158,7 @@ bool prepare_for_vmx_operation(struct vmx_pages *vmx)bool load_vmcs (struct vmx_pages *vmx) {/* Load a VMCS. */ - *(uint32_t *)(vmx->vmcs) =vmcs_revision (); + *(u32 *)(vmx->vmcs) =vmcs_revision ();if (vmclear (vmx->vmcs_gpa))return false;
@@ -166,7 +166,7 @@ bool load_vmcs(struct vmx_pages *vmx)return false;/* Setup shadow VMCS, do not load it yet. */ - *(uint32_t *)(vmx->shadow_vmcs) =vmcs_revision () |0x80000000ul ; + *(u32 *)(vmx->shadow_vmcs) =vmcs_revision () |0x80000000ul ;if (vmclear (vmx->shadow_vmcs_gpa))return false;
@@ -188,7 +188,7 @@ bool ept_1g_pages_supported(void)*/ static inline void init_vmcs_control_fields (struct vmx_pages *vmx) { -uint32_t sec_exec_ctl =0 ; +u32 sec_exec_ctl =0 ;vmwrite (VIRTUAL_PROCESSOR_ID ,0 );vmwrite (POSTED_INTR_NV ,0 );
@@ -248,7 +248,7 @@ static inline void init_vmcs_control_fields(struct vmx_pages *vmx)*/ static inline void init_vmcs_host_state (void ) { -uint32_t exit_controls =vmreadz (VM_EXIT_CONTROLS ); +u32 exit_controls =vmreadz (VM_EXIT_CONTROLS );vmwrite (HOST_ES_SELECTOR ,get_es ());vmwrite (HOST_CS_SELECTOR ,get_cs ());
@@ -495,7 +495,7 @@ void nested_map(struct vmx_pages *vmx, struct kvm_vm *vm,* physical pages in VM. */ void nested_map_memslot (struct vmx_pages *vmx,struct kvm_vm *vm, -uint32_t memslot) +u32 memslot) {sparsebit_idx_t i, last; struct userspace_mem_region *region =
@@ -535,7 +535,7 @@ bool kvm_cpu_has_ept(void) }void prepare_eptp (struct vmx_pages *vmx,struct kvm_vm *vm, -uint32_t eptp_memslot) +u32 eptp_memslot) {TEST_ASSERT (kvm_cpu_has_ept (),"KVM doesn't support nested EPT" );
tools/testing/selftests/kvm/memslot_perf_test.c +25 -25
173 lines not on this page · raw message
tools/testing/selftests/kvm/riscv/arch_timer.c +3 -3
@@ -19,7 +19,7 @@ static void guest_irq_handler(struct ex_regs *regs) {u64 xcnt, xcnt_diff_us, cmp;unsigned int intid = regs->cause & ~CAUSE_IRQ_FLAG ; -uint32_t cpu =guest_get_vcpuid (); +u32 cpu =guest_get_vcpuid ();struct test_vcpu_shared_data *shared_data = &vcpu_shared_data[cpu];timer_irq_disable ();
@@ -40,7 +40,7 @@ static void guest_irq_handler(struct ex_regs *regs)static void guest_run (struct test_vcpu_shared_data *shared_data) { -uint32_t irq_iter, config_iter; +u32 irq_iter, config_iter; shared_data->nr_iter =0 ; shared_data->guest_stage =0 ;
@@ -66,7 +66,7 @@ static void guest_run(struct test_vcpu_shared_data *shared_data)static void guest_code (void ) { -uint32_t cpu =guest_get_vcpuid (); +u32 cpu =guest_get_vcpuid ();struct test_vcpu_shared_data *shared_data = &vcpu_shared_data[cpu];timer_irq_disable ();
tools/testing/selftests/kvm/s390/memop.c +9 -9
@@ -42,11 +42,11 @@ struct mop_desc { unsigned int _set_flags : 1; unsigned int _sida_offset : 1; unsigned int _ar : 1; -uint32_t size; +u32 size;enum mop_target target;enum mop_access_mode mode;void *buf; -uint32_t sida_offset; +u32 sida_offset;void *old;uint8_t old_value[16 ];bool *cmpxchg_success;
@@ -296,7 +296,7 @@ static void prepare_mem12(void) TEST_ASSERT(!memcmp(p1, p2, size), "Memory contents do not match!")static void default_write_read (struct test_info copy_cpu,struct test_info mop_cpu, -enum mop_target mop_target,uint32_t size,uint8_t key) +enum mop_target mop_target,u32 size,uint8_t key) {prepare_mem12 (); CHECK_N_DO(MOP, mop_cpu, mop_target, WRITE, mem1, size,
@@ -308,7 +308,7 @@ static void default_write_read(struct test_info copy_cpu, struct test_info mop_c }static void default_read (struct test_info copy_cpu,struct test_info mop_cpu, -enum mop_target mop_target,uint32_t size,uint8_t key) +enum mop_target mop_target,u32 size,uint8_t key) {prepare_mem12 ();CHECK_N_DO (MOP , mop_cpu, mop_target,WRITE , mem1, size,GADDR_V (mem1));
@@ -487,7 +487,7 @@ static __uint128_t cut_to_size(int size, __uint128_t val)case 2 :return (uint16_t )val;case 4 : -return (uint32_t )val; +return (u32 )val;case 8 :return (u64 )val;case 16 :
@@ -585,15 +585,15 @@ static bool _cmpxchg(int size, void *target, __uint128_t *old_addr, __uint128_tswitch (size) {case 4 : { -uint32_t old = *old_addr; +u32 old = *old_addr; asmvolatile ("cs %[old],%[new],%[address]" : [old]"+d" (old), - [address]"+Q" (*(uint32_t *)(target)) - : [new]"d" ((uint32_t )new) + [address]"+Q" (*(u32 *)(target)) + : [new]"d" ((u32 )new) :"cc" ); - ret = old == (uint32_t )*old_addr; + ret = old == (u32)*old_addr; *old_addr = old;return ret; }
tools/testing/selftests/kvm/set_memory_region_test.c +4 -4
@@ -345,8 +345,8 @@ static void test_zero_memory_regions(void)static void test_invalid_memory_region_flags (void ) { -uint32_t supported_flags =KVM_MEM_LOG_DIRTY_PAGES ; -const uint32_t v2_only_flags =KVM_MEM_GUEST_MEMFD ; +u32 supported_flags =KVM_MEM_LOG_DIRTY_PAGES ; +const u32 v2_only_flags =KVM_MEM_GUEST_MEMFD ;struct kvm_vm *vm;int r, i;
@@ -410,8 +410,8 @@ static void test_add_max_memory_regions(void) {
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/steal_time.c +13 -13
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/amx_test.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/apic_bus_clock_test.c +6 -6
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/debug_regs.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/feature_msrs_test.c +4 -4
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/hyperv_evmcs.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/hyperv_features.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/hyperv_svm_test.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/kvm_pv_test.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/nested_emulation_test.c +5 -5
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/nested_exceptions_test.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/pmu_counters_test.c +16 -16
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/pmu_event_filter_test.c +10 -10
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/private_mem_conversions_test.c +4 -4
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/private_mem_kvm_exits_test.c +4 -4
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/set_boot_cpu_id.c +3 -3
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/sev_init2_tests.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/sev_smoke_test.c +3 -3
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/ucna_injection_test.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/userspace_msr_exit_test.c +14 -14
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/vmx_apic_access_test.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/vmx_msrs_test.c +3 -5
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/vmx_nested_tsc_scaling_test.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/vmx_tsc_adjust_test.c +1 -1
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/xapic_ipi_test.c +8 -8
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/xapic_state_test.c +2 -2
Lines of this file are not shown. View the raw message.
tools/testing/selftests/kvm/x86/xen_shinfo_test.c +3 -3
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.49.0.906.g1f30a19c02-goog
Part of the diff is not shown here. View the raw message.
PATCH 7/10 KVM: selftests: Use s32 instead of int32_t
In reply to David MatlackUse s32 instead of int32_t to make the KVM selftests code more concise and more similar to the kernel (since selftests are primarily developed by kernel developers).
This commit was generated with the following command:
git ls-files tools/testing/selftests/kvm | xargs sed -i 's/int32_t/s32/g'
Then by manually adjusting whitespace to make checkpatch.pl happy.
No functional change intended.
--- .../kvm/arm64/arch_timer_edge_cases.c | 24 +++++++++---------- .../selftests/kvm/include/arm64/arch_timer.h | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-)
tools/testing/selftests/kvm/arm64/arch_timer_edge_cases.c +12 -12
@@ -24,8 +24,8 @@static const u64 CVAL_MAX = ~0ULL ;/* tval is a signed 32-bit int. */ -static const int32_t TVAL_MAX =INT32_MAX ; -static const int32_t TVAL_MIN =INT32_MIN ; +static const s32 TVAL_MAX =INT32_MAX ; +static const s32 TVAL_MIN =INT32_MIN ;/* After how much time we say there is no IRQ. */ static const u32 TIMEOUT_NO_IRQ_US =50000 ;
@@ -354,7 +354,7 @@ static void test_timer_cval(enum arch_timer timer, u64 cval,test_timer_xval (timer, cval,TIMER_CVAL , wm, reset_state, reset_cnt); } -static void test_timer_tval (enum arch_timer timer,int32_t tval, +static void test_timer_tval (enum arch_timer timer,s32 tval,irq_wait_method_t wm,bool reset_state,u64 reset_cnt) {
@@ -384,10 +384,10 @@ static void test_cval_no_irq(enum arch_timer timer, u64 cval,test_xval_check_no_irq (timer, cval, usec,TIMER_CVAL , wm); } -static void test_tval_no_irq (enum arch_timer timer,int32_t tval,u64 usec, +static void test_tval_no_irq (enum arch_timer timer,s32 tval,u64 usec,sleep_method_t wm) { -/* tval will be cast to an int32_t in test_xval_check_no_irq */ +/* tval will be cast to an s32 in test_xval_check_no_irq */ test_xval_check_no_irq (timer, (u64 )tval, usec,TIMER_TVAL , wm); }
@@ -462,7 +462,7 @@ static void test_timers_fired_multiple_times(enum arch_timer timer)* timeout for the wait: we use the wfi instruction. */ static void test_reprogramming_timer (enum arch_timer timer,irq_wait_method_t wm, -int32_t delta_1_ms,int32_t delta_2_ms) +s32 delta_1_ms,s32 delta_2_ms) {local_irq_disable ();reset_timer_state (timer,DEF_CNT );
@@ -503,7 +503,7 @@ static void test_reprogram_timers(enum arch_timer timer)static void test_basic_functionality (enum arch_timer timer) { -int32_t tval = (int32_t )msec_to_cycles (test_args.wait_ms); +s32 tval = (s32 )msec_to_cycles (test_args.wait_ms);u64 cval =DEF_CNT +msec_to_cycles (test_args.wait_ms);int i;
@@ -684,7 +684,7 @@ static void test_set_cnt_after_xval_no_irq(enum arch_timer timer, }static void test_set_cnt_after_tval (enum arch_timer timer,u64 cnt_1, -int32_t tval,u64 cnt_2, +s32 tval,u64 cnt_2,irq_wait_method_t wm) {test_set_cnt_after_xval (timer, cnt_1, tval, cnt_2, wm,TIMER_TVAL );
@@ -698,7 +698,7 @@ static void test_set_cnt_after_cval(enum arch_timer timer, u64 cnt_1, }static void test_set_cnt_after_tval_no_irq (enum arch_timer timer, -u64 cnt_1,int32_t tval, +u64 cnt_1,s32 tval,u64 cnt_2,sleep_method_t wm) { test_set_cnt_after_xval_no_irq(timer, cnt_1, tval, cnt_2, wm,
@@ -717,7 +717,7 @@ static void test_set_cnt_after_cval_no_irq(enum arch_timer timer,static void test_move_counters_ahead_of_timers (enum arch_timer timer) {int i; -int32_t tval; +s32 tval;for (i =0 ; i <ARRAY_SIZE (irq_wait_method); i++) {irq_wait_method_t wm = irq_wait_method[i];
@@ -758,7 +758,7 @@ static void test_move_counters_behind_timers(enum arch_timer timer)static void test_timers_in_the_past (enum arch_timer timer) { -int32_t tval =-1 * (int32_t )msec_to_cycles (test_args.wait_ms); +s32 tval =-1 * (s32 )msec_to_cycles (test_args.wait_ms);u64 cval;int i;
@@ -794,7 +794,7 @@ static void test_timers_in_the_past(enum arch_timer timer)static void test_long_timer_delays (enum arch_timer timer) { -int32_t tval = (int32_t )msec_to_cycles (test_args.long_wait_ms); +s32 tval = (s32 )msec_to_cycles (test_args.long_wait_ms);u64 cval =DEF_CNT +msec_to_cycles (test_args.long_wait_ms);int i;
tools/testing/selftests/kvm/include/arm64/arch_timer.h +2 -2
@@ -79,7 +79,7 @@ static inline u64 timer_get_cval(enum arch_timer timer)return 0 ; } -static inline void timer_set_tval (enum arch_timer timer,int32_t tval) +static inline void timer_set_tval (enum arch_timer timer,s32 tval) {switch (timer) {case VIRTUAL :
@@ -95,7 +95,7 @@ static inline void timer_set_tval(enum arch_timer timer, int32_t tval)isb (); } -static inline int32_t timer_get_tval (enum arch_timer timer) +static inline s32 timer_get_tval (enum arch_timer timer) {isb ();switch (timer) {
Signature · 1 line
2.49.0.906.g1f30a19c02-goog
PATCH 8/10 KVM: selftests: Use u16 instead of uint16_t
In reply to David MatlackUse u16 instead of uint16_t to make the KVM selftests code more concise and more similar to the kernel (since selftests are primarily developed by kernel developers).
This commit was generated with the following command:
git ls-files tools/testing/selftests/kvm | xargs sed -i 's/uint16_t/u16/g'
Then by manually adjusting whitespace to make checkpatch.pl happy.
No functional change intended.
--- .../selftests/kvm/arm64/page_fault_test.c | 2 +- .../testing/selftests/kvm/include/kvm_util.h | 2 +- .../testing/selftests/kvm/include/x86/evmcs.h | 2 +- .../selftests/kvm/include/x86/processor.h | 58 +++++++++---------- .../testing/selftests/kvm/lib/guest_sprintf.c | 2 +- .../testing/selftests/kvm/lib/x86/processor.c | 8 +-- tools/testing/selftests/kvm/lib/x86/ucall.c | 2 +- tools/testing/selftests/kvm/lib/x86/vmx.c | 4 +- tools/testing/selftests/kvm/s390/memop.c | 2 +- .../selftests/kvm/x86/sync_regs_test.c | 2 +- 10 files changed, 42 insertions(+), 42 deletions(-)
tools/testing/selftests/kvm/arm64/page_fault_test.c +1 -1
@@ -148,7 +148,7 @@ static void guest_at(void)*/ static void guest_dc_zva (void ) { -uint16_t val; +u16 val; asmvolatile ("dc zva, %0" ::"r" (guest_test_memory));dsb (ish);
tools/testing/selftests/kvm/include/kvm_util.h +1 -1
@@ -185,7 +185,7 @@ struct vm_shape {u32 type;uint8_t mode;uint8_t pad0; -uint16_t pad1; +u16 pad1; };kvm_static_assert (sizeof (struct vm_shape ) ==sizeof (u64));
tools/testing/selftests/kvm/include/x86/evmcs.h +1 -1
@@ -10,7 +10,7 @@#include "hyperv.h" #include "vmx.h" -#define u16 uint16_t +#define u16 u16#define u32 u32#define u64 u64
tools/testing/selftests/kvm/include/x86/processor.h +29 -29
138 lines not on this page · raw message
tools/testing/selftests/kvm/lib/guest_sprintf.c +1 -1
@@ -286,7 +286,7 @@ int guest_vsnprintf(char *buf, int n, const char *fmt, va_list args)if (qualifier =='l' ) num =va_arg (args, u64);else if (qualifier =='h' ) { - num = (uint16_t )va_arg (args, int); + num = (u16 )va_arg (args, int);if (flags &SIGN ) num = (int16_t )num; }else if (flags &SIGN )
tools/testing/selftests/kvm/lib/x86/processor.c +4 -4
@@ -334,7 +334,7 @@ void virt_arch_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent)"addr w exec dirty\n" , indent, ""); pml4e_start =addr_gpa2hva (vm, vm->pgd); -for (uint16_t n1 =0 ; n1 <=0x1ffu ; n1++) { +for (u16 n1 =0 ; n1 <=0x1ffu ; n1++) { pml4e = &pml4e_start[n1];if (!(*pml4e &PTE_PRESENT_MASK ))continue ;
@@ -346,7 +346,7 @@ void virt_arch_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent) !!(*pml4e & PTE_WRITABLE_MASK), !!(*pml4e & PTE_NX_MASK)); pdpe_start =addr_gpa2hva (vm, *pml4e &PHYSICAL_PAGE_MASK ); -for (uint16_t n2 =0 ; n2 <=0x1ffu ; n2++) { +for (u16 n2 =0 ; n2 <=0x1ffu ; n2++) { pdpe = &pdpe_start[n2];if (!(*pdpe &PTE_PRESENT_MASK ))continue ;
@@ -359,7 +359,7 @@ void virt_arch_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent) !!(*pdpe & PTE_NX_MASK)); pde_start =addr_gpa2hva (vm, *pdpe &PHYSICAL_PAGE_MASK ); -for (uint16_t n3 =0 ; n3 <=0x1ffu ; n3++) { +for (u16 n3 =0 ; n3 <=0x1ffu ; n3++) { pde = &pde_start[n3];if (!(*pde &PTE_PRESENT_MASK ))continue ;
@@ -371,7 +371,7 @@ void virt_arch_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent) !!(*pde & PTE_NX_MASK)); pte_start =addr_gpa2hva (vm, *pde &PHYSICAL_PAGE_MASK ); -for (uint16_t n4 =0 ; n4 <=0x1ffu ; n4++) { +for (u16 n4 =0 ; n4 <=0x1ffu ; n4++) { pte = &pte_start[n4];if (!(*pte &PTE_PRESENT_MASK ))continue ;
tools/testing/selftests/kvm/lib/x86/ucall.c +1 -1
@@ -6,7 +6,7 @@*/ #include "kvm_util.h" -#define UCALL_PIO_PORT ((uint16_t)0x1000) +#define UCALL_PIO_PORT ((u16)0x1000)void ucall_arch_do_ucall (gva_t uc) {
tools/testing/selftests/kvm/lib/x86/vmx.c +2 -2
@@ -44,7 +44,7 @@ struct eptPageTablePointer { };int vcpu_enable_evmcs (struct kvm_vcpu *vcpu) { -uint16_t evmcs_ver; +u16 evmcs_ver;vcpu_enable_cap (vcpu,KVM_CAP_HYPERV_ENLIGHTENED_VMCS , (unsigned long )&evmcs_ver);
@@ -399,7 +399,7 @@ void __nested_pg_map(struct vmx_pages *vmx, struct kvm_vm *vm, {const u64 page_size =PG_LEVEL_SIZE (target_level);struct eptPageTableEntry *pt = vmx->eptp_hva, *pte; -uint16_t index; +u16 index;TEST_ASSERT (vm->mode ==VM_MODE_PXXV48_4K ,"Attempt to use " "unknown or unsupported guest mode, mode: 0x%x" , vm->mode);
tools/testing/selftests/kvm/s390/memop.c +1 -1
@@ -485,7 +485,7 @@ static __uint128_t cut_to_size(int size, __uint128_t val)case 1 :return (uint8_t )val;case 2 : -return (uint16_t )val; +return (u16 )val;case 4 :return (u32 )val;case 8 :
tools/testing/selftests/kvm/x86/sync_regs_test.c +1 -1
@@ -20,7 +20,7 @@#include "kvm_util.h" #include "processor.h" -#define UCALL_PIO_PORT ((uint16_t)0x1000) +#define UCALL_PIO_PORT ((u16)0x1000)struct ucall uc_none = { .cmd =UCALL_NONE ,
Signature · 1 line
2.49.0.906.g1f30a19c02-goog
PATCH 9/10 KVM: selftests: Use s16 instead of int16_t
In reply to David MatlackUse s16 instead of int16_t to make the KVM selftests code more concise and more similar to the kernel (since selftests are primarily developed by kernel developers).
This commit was generated with the following command:
git ls-files tools/testing/selftests/kvm | xargs sed -i 's/int16_t/s16/g'
Then by manually adjusting whitespace to make checkpatch.pl happy.
No functional change intended.
--- tools/testing/selftests/kvm/lib/guest_sprintf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/kvm/lib/guest_sprintf.c +1 -1
@@ -288,7 +288,7 @@ int guest_vsnprintf(char *buf, int n, const char *fmt, va_list args)else if (qualifier =='h' ) { num = (u16 )va_arg (args, int);if (flags &SIGN ) - num = (int16_t )num; + num = (s16 )num; }else if (flags &SIGN ) num =va_arg (args, int);else
Signature · 1 line
2.49.0.906.g1f30a19c02-goog
PATCH 10/10 KVM: selftests: Use u8 instead of uint8_t
In reply to David MatlackUse u8 instead of uint8_t to make the KVM selftests code more concise and more similar to the kernel (since selftests are primarily developed by kernel developers).
This commit was generated with the following command:
git ls-files tools/testing/selftests/kvm | xargs sed -i 's/uint8_t/u8/g'
Then by manually adjusting whitespace to make checkpatch.pl happy.
No functional change intended.
--- .../selftests/kvm/arm64/debug-exceptions.c | 16 ++--- .../testing/selftests/kvm/arm64/set_id_regs.c | 6 +- .../selftests/kvm/arm64/vpmu_counter_access.c | 2 +- .../testing/selftests/kvm/coalesced_io_test.c | 2 +- tools/testing/selftests/kvm/get-reg-list.c | 2 +- .../testing/selftests/kvm/include/kvm_util.h | 14 ++--- .../testing/selftests/kvm/include/test_util.h | 2 +- .../testing/selftests/kvm/include/x86/apic.h | 6 +- .../selftests/kvm/include/x86/hyperv.h | 10 ++-- .../selftests/kvm/include/x86/processor.h | 20 +++---- tools/testing/selftests/kvm/include/x86/sev.h | 4 +- tools/testing/selftests/kvm/include/x86/vmx.h | 12 ++-- .../selftests/kvm/lib/arm64/processor.c | 8 +-- .../testing/selftests/kvm/lib/guest_sprintf.c | 2 +- tools/testing/selftests/kvm/lib/kvm_util.c | 2 +- .../selftests/kvm/lib/riscv/processor.c | 6 +- .../selftests/kvm/lib/s390/processor.c | 8 +-- tools/testing/selftests/kvm/lib/sparsebit.c | 2 +- .../testing/selftests/kvm/lib/x86/processor.c | 16 ++--- tools/testing/selftests/kvm/lib/x86/sev.c | 4 +- .../testing/selftests/kvm/memslot_perf_test.c | 2 +- tools/testing/selftests/kvm/mmu_stress_test.c | 2 +- tools/testing/selftests/kvm/s390/memop.c | 28 ++++----- tools/testing/selftests/kvm/s390/resets.c | 2 +- .../selftests/kvm/s390/shared_zeropage_test.c | 2 +- tools/testing/selftests/kvm/s390/tprot.c | 12 ++-- .../selftests/kvm/set_memory_region_test.c | 2 +- tools/testing/selftests/kvm/steal_time.c | 4 +- .../selftests/kvm/x86/fix_hypercall_test.c | 12 ++-- .../selftests/kvm/x86/flds_emulation.h | 2 +- .../selftests/kvm/x86/hyperv_features.c | 4 +- tools/testing/selftests/kvm/x86/kvm_pv_test.c | 2 +- .../selftests/kvm/x86/nested_emulation_test.c | 8 +-- .../selftests/kvm/x86/platform_info_test.c | 2 +- .../selftests/kvm/x86/pmu_counters_test.c | 60 +++++++++---------- .../selftests/kvm/x86/pmu_event_filter_test.c | 12 ++-- .../kvm/x86/private_mem_conversions_test.c | 24 ++++---- tools/testing/selftests/kvm/x86/smm_test.c | 2 +- tools/testing/selftests/kvm/x86/state_test.c | 4 +- .../selftests/kvm/x86/userspace_io_test.c | 4 +- .../kvm/x86/userspace_msr_exit_test.c | 14 ++--- .../selftests/kvm/x86/vmx_pmu_caps_test.c | 2 +- .../selftests/kvm/x86/xen_shinfo_test.c | 4 +- 43 files changed, 177 insertions(+), 177 deletions(-)
tools/testing/selftests/kvm/arm64/debug-exceptions.c +8 -8
@@ -102,7 +102,7 @@ GEN_DEBUG_WRITE_REG(dbgwvr)static void reset_debug_state (void ) { -uint8_t brps, wrps, i; +u8 brps, wrps, i;u64 dfr0; asmvolatile ("msr daifset, #8" );
@@ -149,7 +149,7 @@ static void enable_monitor_debug_exceptions(void)isb (); } -static void install_wp (uint8_t wpn,u64 addr) +static void install_wp (u8 wpn,u64 addr) {u32 wcr;
@@ -162,7 +162,7 @@ static void install_wp(uint8_t wpn, u64 addr)enable_monitor_debug_exceptions (); } -static void install_hw_bp (uint8_t bpn,u64 addr) +static void install_hw_bp (u8 bpn,u64 addr) {u32 bcr;
@@ -174,7 +174,7 @@ static void install_hw_bp(uint8_t bpn, u64 addr)enable_monitor_debug_exceptions (); } -static void install_wp_ctx (uint8_t addr_wp,uint8_t ctx_bp,u64 addr, +static void install_wp_ctx (u8 addr_wp,u8 ctx_bp,u64 addr,u64 ctx) {u32 wcr;
@@ -196,7 +196,7 @@ static void install_wp_ctx(uint8_t addr_wp, uint8_t ctx_bp, u64 addr,enable_monitor_debug_exceptions (); } -void install_hw_bp_ctx (uint8_t addr_bp,uint8_t ctx_bp,u64 addr, +void install_hw_bp_ctx (u8 addr_bp,u8 ctx_bp,u64 addr,u64 ctx) {u32 addr_bcr, ctx_bcr;
@@ -234,7 +234,7 @@ static void install_ss(void)static volatile char write_data; -static void guest_code (uint8_t bpn,uint8_t wpn,uint8_t ctx_bpn) +static void guest_code (u8 bpn,u8 wpn,u8 ctx_bpn) {u64 ctx =0xabcdef ;/* a random context number */
@@ -421,7 +421,7 @@ static int debug_version(u64 id_aa64dfr0)return FIELD_GET (ARM64_FEATURE_MASK (ID_AA64DFR0_EL1_DebugVer), id_aa64dfr0); } -static void test_guest_debug_exceptions (uint8_t bpn,uint8_t wpn,uint8_t ctx_bpn) +static void test_guest_debug_exceptions (u8 bpn,u8 wpn,u8 ctx_bpn) {struct kvm_vcpu *vcpu;struct kvm_vm *vm;
@@ -534,7 +534,7 @@ void test_single_step_from_userspace(int test_cnt)*/ void test_guest_debug_exceptions_all (u64 aa64dfr0) { -uint8_t brp_num, wrp_num, ctx_brp_num, normal_brp_num, ctx_brp_base; +u8 brp_num, wrp_num, ctx_brp_num, normal_brp_num, ctx_brp_base;int b, w, c;/* Number of breakpoints */
tools/testing/selftests/kvm/arm64/set_id_regs.c +3 -3
@@ -30,7 +30,7 @@ struct reg_ftr_bits {char *name;bool sign;enum ftr_type type; -uint8_t shift; +u8 shift;u64 mask;/* * For FTR_EXACT, safe_val is used as the exact safe value.
@@ -347,7 +347,7 @@ u64 get_invalid_value(const struct reg_ftr_bits *ftr_bits, u64 ftr)static u64 test_reg_set_success (struct kvm_vcpu *vcpu,u64 reg,const struct reg_ftr_bits *ftr_bits) { -uint8_t shift = ftr_bits->shift; +u8 shift = ftr_bits->shift;u64 mask = ftr_bits->mask;u64 val, new_val, ftr;
@@ -370,7 +370,7 @@ static u64 test_reg_set_success(struct kvm_vcpu *vcpu, u64 reg,static void test_reg_set_fail (struct kvm_vcpu *vcpu,u64 reg,const struct reg_ftr_bits *ftr_bits) { -uint8_t shift = ftr_bits->shift; +u8 shift = ftr_bits->shift;u64 mask = ftr_bits->mask;u64 val, old_val, ftr;int r;
tools/testing/selftests/kvm/arm64/vpmu_counter_access.c +1 -1
@@ -408,7 +408,7 @@ static void guest_code(u64 expected_pmcr_n)static void create_vpmu_vm (void *guest_code) {struct kvm_vcpu_init init; -uint8_t pmuver, ec; +u8 pmuver, ec;u64 dfr0, irq =23 ;struct kvm_device_attr irq_attr = { .group =KVM_ARM_VCPU_PMU_V3_CTRL ,
tools/testing/selftests/kvm/coalesced_io_test.c +1 -1
@@ -23,7 +23,7 @@ struct kvm_coalesced_io {* amount of #ifdeffery and complexity, without having to sacrifice * verbose error messages. */ -uint8_t pio_port; +u8 pio_port; };static struct kvm_coalesced_io kvm_builtin_io_ring;
tools/testing/selftests/kvm/get-reg-list.c +1 -1
@@ -213,7 +213,7 @@ static void run_test(struct vcpu_reg_list *c)* since we don't know the capabilities of any new registers. */ for_each_present_blessed_reg (i) { -uint8_t addr[2048 /8 ]; +u8 addr[2048 /8 ];struct kvm_one_reg reg = { .id = reg_list->reg[i], .addr = (__u64)&addr,
tools/testing/selftests/kvm/include/kvm_util.h +7 -7
@@ -183,8 +183,8 @@ enum vm_guest_mode {struct vm_shape {u32 type; -uint8_t mode; -uint8_t pad0; +u8 mode; +u8 pad0;u16 pad1; };
@@ -432,7 +432,7 @@ void kvm_vm_release(struct kvm_vm *vmp);void kvm_vm_elf_load (struct kvm_vm *vm,const char *filename);int kvm_memfd_alloc (size_t size,bool hugepages); -void vm_dump (FILE *stream,struct kvm_vm *vm,uint8_t indent); +void vm_dump (FILE *stream,struct kvm_vm *vm,u8 indent);static inline void kvm_vm_get_dirty_log (struct kvm_vm *vm,int slot,void *log) {
@@ -1016,10 +1016,10 @@ vm_adjust_num_guest_pages(enum vm_guest_mode mode, unsigned int num_guest_pages)void assert_on_unhandled_exception (struct kvm_vcpu *vcpu);void vcpu_arch_dump (FILE *stream,struct kvm_vcpu *vcpu, -uint8_t indent); +u8 indent);static inline void vcpu_dump (FILE *stream,struct kvm_vcpu *vcpu, -uint8_t indent) +u8 indent) {vcpu_arch_dump (stream, vcpu, indent); }
@@ -1123,9 +1123,9 @@ static inline gpa_t addr_gva2gpa(struct kvm_vm *vm, gva_t gva)* Dumps to the FILE stream given by @stream, the contents of all the * virtual translation tables for the VM given by @vm. */ -void virt_arch_dump (FILE *stream,struct kvm_vm *vm,uint8_t indent); +void virt_arch_dump (FILE *stream,struct kvm_vm *vm,u8 indent); -static inline void virt_dump (FILE *stream,struct kvm_vm *vm,uint8_t indent) +static inline void virt_dump (FILE *stream,struct kvm_vm *vm,u8 indent) {virt_arch_dump (stream, vm, indent); }
tools/testing/selftests/kvm/include/test_util.h +1 -1
@@ -100,7 +100,7 @@ struct guest_random_state new_guest_random_state(u32 seed);u32 guest_random_u32 (struct guest_random_state *state);static inline bool __guest_random_bool (struct guest_random_state *state, -uint8_t percent) +u8 percent) {return (guest_random_u32 (state) %100 ) < percent; }
tools/testing/selftests/kvm/include/x86/apic.h +3 -3
@@ -92,14 +92,14 @@ static inline u64 x2apic_read_reg(unsigned int reg)return rdmsr (APIC_BASE_MSR + (reg >>4 )); } -static inline uint8_t x2apic_write_reg_safe (unsigned int reg,u64 value) +static inline u8 x2apic_write_reg_safe (unsigned int reg,u64 value) {return wrmsr_safe (APIC_BASE_MSR + (reg >>4 ), value); }static inline void x2apic_write_reg (unsigned int reg,u64 value) { -uint8_t fault =x2apic_write_reg_safe (reg, value); +u8 fault =x2apic_write_reg_safe (reg, value);__GUEST_ASSERT (!fault,"Unexpected fault 0x%x on WRMSR(%x) = %lx\n" , fault,APIC_BASE_MSR + (reg >>4 ), value);
@@ -107,7 +107,7 @@ static inline void x2apic_write_reg(unsigned int reg, u64 value)static inline void x2apic_write_reg_fault (unsigned int reg,u64 value) { -uint8_t fault =x2apic_write_reg_safe (reg, value); +u8 fault =x2apic_write_reg_safe (reg, value); __GUEST_ASSERT(fault == GP_VECTOR, "Wanted #GP on WRMSR(%x) = %lx, got 0x%x\n",
tools/testing/selftests/kvm/include/x86/hyperv.h +5 -5
@@ -254,12 +254,12 @@* 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,gva_t input_address, -gva_t output_address, -u64 *hv_status) +static inline u8 __hyperv_hypercall (u64 control,gva_t input_address, +gva_t output_address, +u64 *hv_status) {u64 error_code; -uint8_t vector; +u8 vector;/* Note both the hypercall and the "asm safe" clobber r9-r11. */ asm volatile("mov %[output_address], %%r8\n\t"
@@ -278,7 +278,7 @@ static inline void hyperv_hypercall(u64 control, gva_t input_address, gva_t output_address) {u64 hv_status; -uint8_t vector; +u8 vector; vector =__hyperv_hypercall (control, input_address, output_address, &hv_status);
tools/testing/selftests/kvm/include/x86/processor.h +10 -10
@@ -694,7 +694,7 @@ static inline bool this_cpu_is_amd(void) }static inline u32 __this_cpu_has (u32 function,u32 index, -uint8_t reg,uint8_t lo,uint8_t hi) +u8 reg,u8 lo,u8 hi) {u32 gprs[4 ];
@@ -1074,7 +1074,7 @@ static inline void vcpu_set_cpuid(struct kvm_vcpu *vcpu)void vcpu_set_cpuid_property (struct kvm_vcpu *vcpu,struct kvm_x86_cpu_property property,u32 value); -void vcpu_set_cpuid_maxphyaddr (struct kvm_vcpu *vcpu,uint8_t maxphyaddr); +void vcpu_set_cpuid_maxphyaddr (struct kvm_vcpu *vcpu,u8 maxphyaddr);void vcpu_clear_cpuid_entry (struct kvm_vcpu *vcpu,u32 function);
@@ -1227,7 +1227,7 @@ void vm_install_exception_handler(struct kvm_vm *vm, int vector, #define kvm_asm_safe(insn, inputs...) \ ({ \ u64 ign_error_code; \ - uint8_t vector; \ + u8 vector; \ \ asm volatile(KVM_ASM_SAFE(insn) \ : KVM_ASM_SAFE_OUTPUTS(vector, ign_error_code) \
@@ -1238,7 +1238,7 @@ void vm_install_exception_handler(struct kvm_vm *vm, int vector, #define kvm_asm_safe_ec(insn, error_code, inputs...) \ ({ \ - uint8_t vector; \ + u8 vector; \ \ asm volatile(KVM_ASM_SAFE(insn) \ : KVM_ASM_SAFE_OUTPUTS(vector, error_code) \
@@ -1250,7 +1250,7 @@ void vm_install_exception_handler(struct kvm_vm *vm, int vector, #define kvm_asm_safe_fep(insn, inputs...) \ ({ \ u64 ign_error_code; \ - uint8_t vector; \ + u8 vector; \ \ asm volatile(KVM_ASM_SAFE_FEP(insn) \ : KVM_ASM_SAFE_OUTPUTS(vector, ign_error_code) \
@@ -1261,7 +1261,7 @@ void vm_install_exception_handler(struct kvm_vm *vm, int vector, #define kvm_asm_safe_ec_fep(insn, error_code, inputs...) \ ({ \ - uint8_t vector; \ + u8 vector; \ \ asm volatile(KVM_ASM_SAFE_FEP(insn) \ : KVM_ASM_SAFE_OUTPUTS(vector, error_code) \
@@ -1271,10 +1271,10 @@ void vm_install_exception_handler(struct kvm_vm *vm, int vector, })#define BUILD_READ_U64_SAFE_HELPER (insn, _fep, _FEP) \ -static inline uint8_t insn##_safe ##_fep(u32 idx, u64 *val) \ +static inline u8 insn##_safe ##_fep(u32 idx, u64 *val) \ { \ u64 error_code; \ - uint8_t vector; \ + u8 vector; \ u32 a, d; \ \ asm volatile(KVM_ASM_SAFE##_FEP(#insn) \
@@ -1299,12 +1299,12 @@ BUILD_READ_U64_SAFE_HELPERS(rdmsr) BUILD_READ_U64_SAFE_HELPERS(rdpmc) BUILD_READ_U64_SAFE_HELPERS(xgetbv) -static inline uint8_t wrmsr_safe(u32 msr, u64 val) +static inline u8 wrmsr_safe(u32 msr, u64 val) { return kvm_asm_safe("wrmsr", "a"(val & -1u), "d"(val >> 32), "c"(msr)); } -static inline uint8_t xsetbv_safe (u32 index,u64 value) +static inline u8 xsetbv_safe (u32 index,u64 value) {u32 eax = value;u32 edx = value >>32 ;
tools/testing/selftests/kvm/include/x86/sev.h +2 -2
@@ -28,12 +28,12 @@ enum sev_guest_state {#define GHCB_MSR_TERM_REQ 0x100void sev_vm_launch (struct kvm_vm *vm,u32 policy); -void sev_vm_launch_measure (struct kvm_vm *vm,uint8_t *measurement); +void sev_vm_launch_measure (struct kvm_vm *vm,u8 *measurement);void sev_vm_launch_finish (struct kvm_vm *vm);struct kvm_vm *vm_sev_create_with_one_vcpu (u32 type,void *guest_code,struct kvm_vcpu **cpu); -void vm_sev_launch (struct kvm_vm *vm,u32 policy,uint8_t *measurement); +void vm_sev_launch (struct kvm_vm *vm,u32 policy,u8 *measurement);kvm_static_assert (SEV_RET_SUCCESS ==0 );
tools/testing/selftests/kvm/include/x86/vmx.h +6 -6
@@ -294,7 +294,7 @@ struct vmx_msr_entry {static inline int vmxon (u64 phys) { -uint8_t ret; +u8 ret; __asm__ __volatile__ ("vmxon %[pa]; setna %[ret]" : [ret]"=rm"(ret)
@@ -311,7 +311,7 @@ static inline void vmxoff(void)static inline int vmclear (u64 vmcs_pa) { -uint8_t ret; +u8 ret; __asm__ __volatile__ ("vmclear %[pa]; setna %[ret]" : [ret]"=rm"(ret)
@@ -323,7 +323,7 @@ static inline int vmclear(u64 vmcs_pa)static inline int vmptrld (u64 vmcs_pa) { -uint8_t ret; +u8 ret;if (enable_evmcs)return -1 ;
@@ -339,7 +339,7 @@ static inline int vmptrld(u64 vmcs_pa)static inline int vmptrst (u64 *value) {u64 tmp; -uint8_t ret; +u8 ret;if (enable_evmcs)return evmcs_vmptrst (value);
@@ -450,7 +450,7 @@ static inline void vmcall(void)static inline int vmread (u64 encoding,u64 *value) {u64 tmp; -uint8_t ret; +u8 ret;if (enable_evmcs)return evmcs_vmread (encoding, value);
@@ -477,7 +477,7 @@ static inline u64 vmreadz(u64 encoding)static inline int vmwrite (u64 encoding,u64 value) { -uint8_t ret; +u8 ret;if (enable_evmcs)return evmcs_vmwrite (encoding, value);
tools/testing/selftests/kvm/lib/arm64/processor.c +4 -4
@@ -128,7 +128,7 @@ void virt_arch_pgd_alloc(struct kvm_vm *vm)static void _virt_pg_map (struct kvm_vm *vm,u64 vaddr,u64 paddr,u64 flags) { -uint8_t attr_idx = flags & (PTE_ATTRINDX_MASK >>PTE_ATTRINDX_SHIFT ); +u8 attr_idx = flags & (PTE_ATTRINDX_MASK >>PTE_ATTRINDX_SHIFT );u64 pg_attr;u64 *ptep;
@@ -230,7 +230,7 @@ gpa_t addr_arch_gva2gpa(struct kvm_vm *vm, gva_t gva)return pte_addr (vm, *ptep) + (gva & (vm->page_size -1 )); } -static void pte_dump (FILE *stream,struct kvm_vm *vm,uint8_t indent,u64 page,int level) +static void pte_dump (FILE *stream,struct kvm_vm *vm,u8 indent,u64 page,int level) {#ifdef DEBUG static const char *const type[] = {"" ,"pud" ,"pmd" ,"pte" };
@@ -249,7 +249,7 @@ static void pte_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent, u64 page,#endif } -void virt_arch_dump (FILE *stream,struct kvm_vm *vm,uint8_t indent) +void virt_arch_dump (FILE *stream,struct kvm_vm *vm,u8 indent) {int level =4 - (vm->pgtable_levels -1 );u64 pgd, *ptep;
@@ -364,7 +364,7 @@ void aarch64_vcpu_setup(struct kvm_vcpu *vcpu, struct kvm_vcpu_init *init)vcpu_set_reg (vcpu,KVM_ARM64_SYS_REG (SYS_TPIDR_EL1 ), vcpu->id); } -void vcpu_arch_dump (FILE *stream,struct kvm_vcpu *vcpu,uint8_t indent) +void vcpu_arch_dump (FILE *stream,struct kvm_vcpu *vcpu,u8 indent) {u64 pstate, pc;
tools/testing/selftests/kvm/lib/guest_sprintf.c +1 -1
@@ -216,7 +216,7 @@ int guest_vsnprintf(char *buf, int n, const char *fmt, va_list args)while (--field_width >0 )APPEND_BUFFER_SAFE (str, end,' ' );APPEND_BUFFER_SAFE (str, end, - (uint8_t )va_arg (args, int)); + (u8 )va_arg (args, int));while (--field_width >0 )APPEND_BUFFER_SAFE (str, end,' ' );continue ;
tools/testing/selftests/kvm/lib/kvm_util.c +1 -1
@@ -1935,7 +1935,7 @@ void kvm_gsi_routing_write(struct kvm_vm *vm, struct kvm_irq_routing *routing)* Dumps the current state of the VM given by vm, to the FILE stream * given by stream. */ -void vm_dump (FILE *stream,struct kvm_vm *vm,uint8_t indent) +void vm_dump (FILE *stream,struct kvm_vm *vm,u8 indent) {int ctr;struct userspace_mem_region *region;
tools/testing/selftests/kvm/lib/riscv/processor.c +3 -3
@@ -152,7 +152,7 @@ gpa_t addr_arch_gva2gpa(struct kvm_vm *vm, gva_t gva)exit (1 ); } -static void pte_dump (FILE *stream,struct kvm_vm *vm,uint8_t indent, +static void pte_dump (FILE *stream,struct kvm_vm *vm,u8 indent,u64 page,int level) {#ifdef DEBUG
@@ -174,7 +174,7 @@ static void pte_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent,#endif } -void virt_arch_dump (FILE *stream,struct kvm_vm *vm,uint8_t indent) +void virt_arch_dump (FILE *stream,struct kvm_vm *vm,u8 indent) {int level = vm->pgtable_levels -1 ;u64 pgd, *ptep;
@@ -217,7 +217,7 @@ void riscv_vcpu_mmu_setup(struct kvm_vcpu *vcpu)vcpu_set_reg (vcpu,RISCV_GENERAL_CSR_REG (satp), satp); } -void vcpu_arch_dump (FILE *stream,struct kvm_vcpu *vcpu,uint8_t indent) +void vcpu_arch_dump (FILE *stream,struct kvm_vcpu *vcpu,u8 indent) {struct kvm_riscv_core core;
tools/testing/selftests/kvm/lib/s390/processor.c +4 -4
@@ -111,7 +111,7 @@ gpa_t addr_arch_gva2gpa(struct kvm_vm *vm, gva_t gva)return (entry[idx] & ~0xffful ) + (gva &0xffful ); } -static void virt_dump_ptes (FILE *stream,struct kvm_vm *vm,uint8_t indent, +static void virt_dump_ptes (FILE *stream,struct kvm_vm *vm,u8 indent,u64 ptea_start) {u64 *pte, ptea;
@@ -125,7 +125,7 @@ static void virt_dump_ptes(FILE *stream, struct kvm_vm *vm, uint8_t indent, } } -static void virt_dump_region (FILE *stream,struct kvm_vm *vm,uint8_t indent, +static void virt_dump_region (FILE *stream,struct kvm_vm *vm,u8 indent,u64 reg_tab_addr) {u64 addr, *entry;
@@ -147,7 +147,7 @@ static void virt_dump_region(FILE *stream, struct kvm_vm *vm, uint8_t indent, } } -void virt_arch_dump (FILE *stream,struct kvm_vm *vm,uint8_t indent) +void virt_arch_dump (FILE *stream,struct kvm_vm *vm,u8 indent) {if (!vm->pgd_created)return ;
@@ -212,7 +212,7 @@ void vcpu_args_set(struct kvm_vcpu *vcpu, unsigned int num, ...)va_end (ap); } -void vcpu_arch_dump (FILE *stream,struct kvm_vcpu *vcpu,uint8_t indent) +void vcpu_arch_dump (FILE *stream,struct kvm_vcpu *vcpu,u8 indent) {fprintf (stream,"%*spstate: psw: 0x%.16llx:0x%.16llx\n" , indent,"" , vcpu->run->psw_mask, vcpu->run->psw_addr);
tools/testing/selftests/kvm/lib/sparsebit.c +1 -1
@@ -2074,7 +2074,7 @@ int main(void) { s =sparsebit_alloc ();for (;;) { -uint8_t op =get8 () &0xf ; +u8 op =get8 () &0xf ;u64 first =get64 ();u64 last =get64 ();
tools/testing/selftests/kvm/lib/x86/processor.c +8 -8
@@ -23,7 +23,7 @@ bool host_cpu_is_intel;bool is_forced_emulation_enabled;u64 guest_tsc_khz; -static void regs_dump (FILE *stream,struct kvm_regs *regs,uint8_t indent) +static void regs_dump (FILE *stream,struct kvm_regs *regs,u8 indent) { fprintf(stream, "%*srax: 0x%.16llx rbx: 0x%.16llx " "rcx: 0x%.16llx rdx: 0x%.16llx\n",
@@ -47,7 +47,7 @@ static void regs_dump(FILE *stream, struct kvm_regs *regs, uint8_t indent) }static void segment_dump (FILE *stream,struct kvm_segment *segment, -uint8_t indent) +u8 indent) { fprintf(stream, "%*sbase: 0x%.16llx limit: 0x%.8x " "selector: 0x%.4x type: 0x%.2x\n",
@@ -64,7 +64,7 @@ static void segment_dump(FILE *stream, struct kvm_segment *segment, }static void dtable_dump (FILE *stream,struct kvm_dtable *dtable, -uint8_t indent) +u8 indent) { fprintf(stream, "%*sbase: 0x%.16llx limit: 0x%.4x " "padding: 0x%.4x 0x%.4x 0x%.4x\n",
@@ -72,7 +72,7 @@ static void dtable_dump(FILE *stream, struct kvm_dtable *dtable, dtable->padding[0], dtable->padding[1], dtable->padding[2]); } -static void sregs_dump (FILE *stream,struct kvm_sregs *sregs,uint8_t indent) +static void sregs_dump (FILE *stream,struct kvm_sregs *sregs,u8 indent) {unsigned int i;
@@ -318,7 +318,7 @@ u64 *vm_get_page_table_entry(struct kvm_vm *vm, u64 vaddr)return __vm_get_page_table_entry (vm, vaddr, &level); } -void virt_arch_dump (FILE *stream,struct kvm_vm *vm,uint8_t indent) +void virt_arch_dump (FILE *stream,struct kvm_vm *vm,u8 indent) {u64 *pml4e, *pml4e_start;u64 *pdpe, *pdpe_start;
@@ -747,7 +747,7 @@ const struct kvm_cpuid2 *kvm_get_supported_cpuid(void)static u32 __kvm_cpu_has (const struct kvm_cpuid2 *cpuid,u32 function,u32 index, -uint8_t reg,uint8_t lo,uint8_t hi) +u8 reg,u8 lo,u8 hi) {const struct kvm_cpuid_entry2 *entry;int i;
@@ -965,7 +965,7 @@ void vcpu_args_set(struct kvm_vcpu *vcpu, unsigned int num, ...)va_end (ap); } -void vcpu_arch_dump (FILE *stream,struct kvm_vcpu *vcpu,uint8_t indent) +void vcpu_arch_dump (FILE *stream,struct kvm_vcpu *vcpu,u8 indent) {struct kvm_regs regs;struct kvm_sregs sregs;
@@ -1215,7 +1215,7 @@ unsigned long vm_compute_max_gfn(struct kvm_vm *vm) {const unsigned long num_ht_pages =12 << (30 - vm->page_shift);/* 12 GiB */ unsigned long ht_gfn, max_gfn, max_pfn; -uint8_t maxphyaddr, guest_maxphyaddr; +u8 maxphyaddr, guest_maxphyaddr;/* * Use "guest MAXPHYADDR" from KVM if it's available. Guest MAXPHYADDR
tools/testing/selftests/kvm/lib/x86/sev.c +2 -2
@@ -84,7 +84,7 @@ void sev_vm_launch(struct kvm_vm *vm, u32 policy) vm->arch.is_pt_protected = true; } -void sev_vm_launch_measure (struct kvm_vm *vm,uint8_t *measurement) +void sev_vm_launch_measure (struct kvm_vm *vm,u8 *measurement) {struct kvm_sev_launch_measure launch_measure;struct kvm_sev_guest_status guest_status;
@@ -128,7 +128,7 @@ struct kvm_vm *vm_sev_create_with_one_vcpu(u32 type, void *guest_code,return vm; } -void vm_sev_launch (struct kvm_vm *vm,u32 policy,uint8_t *measurement) +void vm_sev_launch (struct kvm_vm *vm,u32 policy,u8 *measurement) {sev_vm_launch (vm, policy);
tools/testing/selftests/kvm/memslot_perf_test.c +1 -1
@@ -216,7 +216,7 @@ static void *vm_gpa2hva(struct vm_data *data, u64 gpa, u64 *rempages) } base = data->hva_slots[slot]; -return (uint8_t *)base + slotoffs * guest_page_size + pgoffs; +return (u8 *)base + slotoffs * guest_page_size + pgoffs; }static u64 vm_slot2gpa (struct vm_data *data,u32 slot)
tools/testing/selftests/kvm/mmu_stress_test.c +1 -1
@@ -346,7 +346,7 @@ int main(int argc, char *argv[])/* Pre-fault the memory to avoid taking mmap_sem on guest page faults. */ for (i =0 ; i < slot_size; i += vm->page_size) - ((uint8_t *)mem)[i] =0xaa ; + ((u8 *)mem)[i] =0xaa ; gpa =0 ;for (slot = first_slot; slot < max_slots; slot++) {
tools/testing/selftests/kvm/s390/memop.c +14 -14
@@ -48,13 +48,13 @@ struct mop_desc {void *buf;u32 sida_offset;void *old; -uint8_t old_value[16 ]; +u8 old_value[16 ];bool *cmpxchg_success; -uint8_t ar; -uint8_t key; +u8 ar; +u8 key; }; -const uint8_t NO_KEY =0xff ; +const u8 NO_KEY =0xff ;static struct kvm_s390_mem_op ksmo_from_desc (struct mop_desc *desc) {
@@ -230,8 +230,8 @@ static void memop_ioctl(struct test_info info, struct kvm_s390_mem_op *ksmo,#define CR0_FETCH_PROTECTION_OVERRIDE (1UL << (63 - 38))#define CR0_STORAGE_PROTECTION_OVERRIDE (1UL << (63 - 39)) -static uint8_t __aligned(PAGE_SIZE) mem1[65536 ]; -static uint8_t __aligned(PAGE_SIZE) mem2[65536 ]; +static u8 __aligned(PAGE_SIZE) mem1[65536 ]; +static u8 __aligned(PAGE_SIZE) mem2[65536 ];struct test_default {struct kvm_vm *kvm_vm;
@@ -296,7 +296,7 @@ static void prepare_mem12(void) TEST_ASSERT(!memcmp(p1, p2, size), "Memory contents do not match!")static void default_write_read (struct test_info copy_cpu,struct test_info mop_cpu, -enum mop_target mop_target,u32 size,uint8_t key) +enum mop_target mop_target,u32 size,u8 key) {prepare_mem12 (); CHECK_N_DO(MOP, mop_cpu, mop_target, WRITE, mem1, size,
@@ -308,7 +308,7 @@ static void default_write_read(struct test_info copy_cpu, struct test_info mop_c }static void default_read (struct test_info copy_cpu,struct test_info mop_cpu, -enum mop_target mop_target,u32 size,uint8_t key) +enum mop_target mop_target,u32 size,u8 key) {prepare_mem12 ();CHECK_N_DO (MOP , mop_cpu, mop_target,WRITE , mem1, size,GADDR_V (mem1));
@@ -318,12 +318,12 @@ static void default_read(struct test_info copy_cpu, struct test_info mop_cpu,ASSERT_MEM_EQ (mem1, mem2, size); } -static void default_cmpxchg (struct test_default *test,uint8_t key) +static void default_cmpxchg (struct test_default *test,u8 key) {for (int size =1 ; size <=16 ; size *=2 ) {for (int offset =0 ; offset <16 ; offset += size) { -uint8_t __aligned(16) new[16 ] = {}; -uint8_t __aligned(16) old[16 ]; +u8 __aligned(16) new[16 ] = {}; +u8 __aligned(16) old[16 ];bool succ;prepare_mem12 ();
@@ -400,7 +400,7 @@ static void test_copy_access_register(void)kvm_vm_free (t.kvm_vm); } -static void set_storage_key_range (void *addr,size_t len,uint8_t key) +static void set_storage_key_range (void *addr,size_t len,u8 key) {uintptr_t _addr, abs, i;int not_mapped =0 ;
@@ -483,7 +483,7 @@ static __uint128_t cut_to_size(int size, __uint128_t val) {switch (size) {case 1 : -return (uint8_t )val; +return (u8 )val;case 2 :return (u16 )val;case 4 :
@@ -553,7 +553,7 @@ static __uint128_t permutate_bits(bool guest, int i, int size, __uint128_t old)if (swap) {int i, j;__uint128_t new; -uint8_t byte0, byte1; +u8 byte0, byte1; rand = rand *3 +1 ; i = rand % size;
tools/testing/selftests/kvm/s390/resets.c +1 -1
@@ -20,7 +20,7 @@struct kvm_s390_irq buf[ARBITRARY_NON_ZERO_VCPU_ID +LOCAL_IRQS ]; -static uint8_t regs_null[512 ]; +static u8 regs_null[512 ];static void guest_code_initial (void ) {
tools/testing/selftests/kvm/s390/shared_zeropage_test.c +1 -1
@@ -13,7 +13,7 @@#include "kselftest.h" #include "ucall_common.h" -static void set_storage_key (void *addr,uint8_t skey) +static void set_storage_key (void *addr,u8 skey) { asmvolatile ("sske %0,%1" : :"d" (skey),"a" (addr)); }
tools/testing/selftests/kvm/s390/tprot.c +6 -6
@@ -14,12 +14,12 @@#define CR0_FETCH_PROTECTION_OVERRIDE (1UL << (63 - 38))#define CR0_STORAGE_PROTECTION_OVERRIDE (1UL << (63 - 39)) -static __aligned(PAGE_SIZE) uint8_t pages[2 ][PAGE_SIZE ]; -static uint8_t *const page_store_prot = pages[0 ]; -static uint8_t *const page_fetch_prot = pages[1 ]; +static __aligned(PAGE_SIZE) u8 pages[2 ][PAGE_SIZE ]; +static u8 *const page_store_prot = pages[0 ]; +static u8 *const page_fetch_prot = pages[1 ];/* Nonzero return value indicates that address not mapped */ -static int set_storage_key (void *addr,uint8_t key) +static int set_storage_key (void *addr,u8 key) {int not_mapped =0 ;
@@ -44,7 +44,7 @@ enum permission { TRANSL_UNAVAIL = 3, }; -static enum permission test_protection (void *addr,uint8_t key) +static enum permission test_protection (void *addr,u8 key) {u64 mask;
@@ -72,7 +72,7 @@ enum stage {struct test {enum stage stage;void *addr; -uint8_t key; +u8 key;enum permission expected; } tests[] = {/*
tools/testing/selftests/kvm/set_memory_region_test.c +1 -1
@@ -564,7 +564,7 @@ static void guest_code_mmio_during_vectoring(void)set_idt (&idt_desc);/* Generate a #GP by dereferencing a non-canonical address */ - *((uint8_t *)NONCANONICAL ) =0x1 ; + *((u8 *)NONCANONICAL ) =0x1 ;GUEST_ASSERT (0 ); }
tools/testing/selftests/kvm/steal_time.c +2 -2
@@ -216,8 +216,8 @@ struct sta_struct {u32 sequence;u32 flags;u64 steal; -uint8_t preempted; -uint8_t pad[47 ]; +u8 preempted; +u8 pad[47 ]; } __packed;static void sta_set_shmem (gpa_t gpa,unsigned long flags)
tools/testing/selftests/kvm/x86/fix_hypercall_test.c +6 -6
@@ -26,11 +26,11 @@ static void guest_ud_handler(struct ex_regs *regs) regs->rip +=HYPERCALL_INSN_SIZE ; } -static const uint8_t vmx_vmcall[HYPERCALL_INSN_SIZE ] = {0x0f ,0x01 ,0xc1 }; -static const uint8_t svm_vmmcall[HYPERCALL_INSN_SIZE ] = {0x0f ,0x01 ,0xd9 }; +static const u8 vmx_vmcall[HYPERCALL_INSN_SIZE ] = {0x0f ,0x01 ,0xc1 }; +static const u8 svm_vmmcall[HYPERCALL_INSN_SIZE ] = {0x0f ,0x01 ,0xd9 }; -extern uint8_t hypercall_insn[HYPERCALL_INSN_SIZE ]; -static u64 do_sched_yield (uint8_t apic_id) +extern u8 hypercall_insn[HYPERCALL_INSN_SIZE ]; +static u64 do_sched_yield (u8 apic_id) {u64 ret;
@@ -45,8 +45,8 @@ static u64 do_sched_yield(uint8_t apic_id)static void guest_main (void ) { -const uint8_t *native_hypercall_insn; -const uint8_t *other_hypercall_insn; +const u8 *native_hypercall_insn; +const u8 *other_hypercall_insn;u64 ret;if (host_cpu_is_intel) {
tools/testing/selftests/kvm/x86/flds_emulation.h +1 -1
@@ -21,7 +21,7 @@ static inline void handle_flds_emulation_failure_exit(struct kvm_vcpu *vcpu) {struct kvm_run *run = vcpu->run;struct kvm_regs regs; -uint8_t *insn_bytes; +u8 *insn_bytes;u64 flags;TEST_ASSERT_KVM_EXIT_REASON (vcpu,KVM_EXIT_INTERNAL_ERROR );
tools/testing/selftests/kvm/x86/hyperv_features.c +2 -2
@@ -41,7 +41,7 @@ static bool is_write_only_msr(u32 msr)static void guest_msr (struct msr_data *msr) { -uint8_t vector =0 ; +u8 vector =0 ;u64 msr_val =0 ;GUEST_ASSERT (msr->idx);
@@ -85,7 +85,7 @@ static void guest_msr(struct msr_data *msr)static void guest_hcall (gpa_t pgs_gpa,struct hcall_data *hcall) {u64 res, input, output; -uint8_t vector; +u8 vector;GUEST_ASSERT_NE (hcall->control,0 );
tools/testing/selftests/kvm/x86/kvm_pv_test.c +1 -1
@@ -41,7 +41,7 @@ static struct msr_data msrs_to_test[] = {static void test_msr (struct msr_data *msr) {u64 ignored; -uint8_t vector; +u8 vector;PR_MSR (msr);
tools/testing/selftests/kvm/x86/nested_emulation_test.c +4 -4
@@ -13,7 +13,7 @@ enum {struct emulated_instruction {const char name[32 ]; -uint8_t opcode[15 ]; +u8 opcode[15 ];u32 exit_reason[NR_VIRTUALIZATION_FLAVORS ]; };
@@ -32,9 +32,9 @@ static struct emulated_instruction instructions[] = { }, }; -static uint8_t kvm_fep[] = {0x0f ,0x0b ,0x6b ,0x76 ,0x6d };/* ud2 ; .ascii "kvm" */ -static uint8_t l2_guest_code[sizeof (kvm_fep) +15 ]; -static uint8_t *l2_instruction = &l2_guest_code[sizeof (kvm_fep)]; +static u8 kvm_fep[] = {0x0f ,0x0b ,0x6b ,0x76 ,0x6d };/* ud2 ; .ascii "kvm" */ +static u8 l2_guest_code[sizeof (kvm_fep) +15 ]; +static u8 *l2_instruction = &l2_guest_code[sizeof (kvm_fep)];static u32 get_instruction_length (struct emulated_instruction *insn) {
tools/testing/selftests/kvm/x86/platform_info_test.c +1 -1
@@ -24,7 +24,7 @@static void guest_code (void ) {u64 msr_platform_info; -uint8_t vector; +u8 vector;GUEST_SYNC (true); msr_platform_info =rdmsr (MSR_PLATFORM_INFO );
tools/testing/selftests/kvm/x86/pmu_counters_test.c +30 -30
183 lines not on this page · raw message
tools/testing/selftests/kvm/x86/pmu_event_filter_test.c +6 -6
@@ -682,7 +682,7 @@ static int set_pmu_single_event_filter(struct kvm_vcpu *vcpu, u64 event,static void test_filter_ioctl (struct kvm_vcpu *vcpu) { -uint8_t nr_fixed_counters =kvm_cpu_property (X86_PROPERTY_PMU_NR_FIXED_COUNTERS ); +u8 nr_fixed_counters =kvm_cpu_property (X86_PROPERTY_PMU_NR_FIXED_COUNTERS );struct __kvm_pmu_event_filter f;u64 e = ~0ul ;int r;
@@ -726,7 +726,7 @@ static void test_filter_ioctl(struct kvm_vcpu *vcpu)TEST_ASSERT (!r,"Masking non-existent fixed counters should be allowed" ); } -static void intel_run_fixed_counter_guest_code (uint8_t idx) +static void intel_run_fixed_counter_guest_code (u8 idx) {for (;;) {wrmsr (MSR_CORE_PERF_GLOBAL_CTRL ,0 );
@@ -767,8 +767,8 @@ static u64 test_set_gp_and_fixed_event_filter(struct kvm_vcpu *vcpu,return run_vcpu_to_sync (vcpu); } -static void __test_fixed_counter_bitmap (struct kvm_vcpu *vcpu,uint8_t idx, -uint8_t nr_fixed_counters) +static void __test_fixed_counter_bitmap (struct kvm_vcpu *vcpu,u8 idx, +u8 nr_fixed_counters) {unsigned int i;u32 bitmap;
@@ -812,10 +812,10 @@ static void __test_fixed_counter_bitmap(struct kvm_vcpu *vcpu, uint8_t idx,static void test_fixed_counter_bitmap (void ) { -uint8_t nr_fixed_counters =kvm_cpu_property (X86_PROPERTY_PMU_NR_FIXED_COUNTERS ); +u8 nr_fixed_counters =kvm_cpu_property (X86_PROPERTY_PMU_NR_FIXED_COUNTERS );struct kvm_vm *vm;struct kvm_vcpu *vcpu; -uint8_t idx; +u8 idx;/* * Check that pmu_event_filter works as expected when it's applied to
tools/testing/selftests/kvm/x86/private_mem_conversions_test.c +12 -12
@@ -29,7 +29,7 @@/* Horrific macro so that the line info is captured accurately :-( */ #define memcmp_g (gpa, pattern, size) \ do { \ - uint8_t *mem = (uint8_t *)gpa; \ + u8 *mem = (u8 *)gpa; \ size_t i; \ \ for (i = 0; i < size; i++) \
@@ -38,7 +38,7 @@ do { \ pattern, i, gpa + i, mem[i]); \ }while (0 ) -static void memcmp_h(uint8_t *mem, u64 gpa, uint8_t pattern, size_t size) +static void memcmp_h(u8 *mem, u64 gpa, u8 pattern, size_t size) {size_t i;
@@ -71,12 +71,12 @@ enum ucall_syncs { };static void guest_sync_shared (u64 gpa,u64 size, -uint8_t current_pattern,uint8_t new_pattern) +u8 current_pattern,u8 new_pattern) {GUEST_SYNC5 (SYNC_SHARED , gpa, size, current_pattern, new_pattern); } -static void guest_sync_private (u64 gpa,u64 size,uint8_t pattern) +static void guest_sync_private (u64 gpa,u64 size,u8 pattern) {GUEST_SYNC4 (SYNC_PRIVATE , gpa, size, pattern); }
@@ -121,8 +121,8 @@ struct {static void guest_test_explicit_conversion (u64 base_gpa,bool do_fallocate) { -const uint8_t def_p =0xaa ; -const uint8_t init_p =0xcc ; +const u8 def_p =0xaa ; +const u8 init_p =0xcc ;u64 j;int i;
@@ -136,10 +136,10 @@ static void guest_test_explicit_conversion(u64 base_gpa, bool do_fallocate)for (i =0 ; i <ARRAY_SIZE (test_ranges); i++) {u64 gpa = base_gpa + test_ranges[i].offset;u64 size = test_ranges[i].size; -uint8_t p1 =0x11 ; -uint8_t p2 =0x22 ; -uint8_t p3 =0x33 ; -uint8_t p4 =0x44 ; +u8 p1 =0x11 ; +u8 p2 =0x22 ; +u8 p3 =0x33 ; +u8 p4 =0x44 ;/* * Set the test region to pattern one to differentiate it from
@@ -229,7 +229,7 @@ static void guest_punch_hole(u64 gpa, u64 size)*/ static void guest_test_punch_hole (u64 base_gpa,bool precise) { -const uint8_t init_p =0xcc ; +const u8 init_p =0xcc ;int i;/*
@@ -347,7 +347,7 @@ static void *__test_mem_conversions(void *__vcpu)for (i =0 ; i < size; i += vm->page_size) {size_t nr_bytes =min_t (size_t, vm->page_size, size - i); -uint8_t *hva =addr_gpa2hva (vm, gpa + i); +u8 *hva =addr_gpa2hva (vm, gpa + i);/* In all cases, the host should observe the shared data. */ memcmp_h (hva, gpa + i, uc.args[3 ], nr_bytes);
tools/testing/selftests/kvm/x86/smm_test.c +1 -1
@@ -36,7 +36,7 @@* independent subset of asm here. * SMI handler always report back fixed stage SMRAM_STAGE. */ -uint8_t smi_handler[] = { +u8 smi_handler[] = {0xb0 ,SMRAM_STAGE ,/* mov $SMRAM_STAGE, %al */ 0xe4 ,SYNC_PORT ,/* in $SYNC_PORT, %al */ 0x0f ,0xaa ,/* rsm */
tools/testing/selftests/kvm/x86/state_test.c +2 -2
@@ -141,7 +141,7 @@ static void __attribute__((__flatten__)) guest_code(void *arg)if (this_cpu_has (X86_FEATURE_XSAVE )) {u64 supported_xcr0 =this_cpu_supported_xcr0 (); -uint8_t buffer[4096 ]; +u8 buffer[4096 ];memset (buffer,0xcc ,sizeof (buffer));
@@ -296,7 +296,7 @@ int main(int argc, char *argv[])* supported features, even if something goes awry in saving * the original snapshot. */ - xstate_bv = (void *)&((uint8_t *)state->xsave->region)[512 ]; + xstate_bv = (void *)&((u8 *)state->xsave->region)[512 ]; saved_xstate_bv = *xstate_bv; vcpuN =__vm_vcpu_add (vm, vcpu->id +1 );
tools/testing/selftests/kvm/x86/userspace_io_test.c +2 -2
@@ -10,7 +10,7 @@#include "kvm_util.h" #include "processor.h" -static void guest_ins_port80 (uint8_t *buffer,unsigned int count) +static void guest_ins_port80 (u8 *buffer,unsigned int count) {unsigned long end;
@@ -26,7 +26,7 @@ static void guest_ins_port80(uint8_t *buffer, unsigned int count)static void guest_code (void ) { -uint8_t buffer[8192 ]; +u8 buffer[8192 ];int i;/*
tools/testing/selftests/kvm/x86/userspace_msr_exit_test.c +7 -7
@@ -23,21 +23,21 @@ struct kvm_msr_filter filter_allow = { .nmsrs = 1, /* Test an MSR the kernel knows about. */ .base = MSR_IA32_XSS, - .bitmap = (uint8_t*)&deny_bits, + .bitmap = (u8 *)&deny_bits, }, { .flags = KVM_MSR_FILTER_READ | KVM_MSR_FILTER_WRITE, .nmsrs = 1, /* Test an MSR the kernel doesn't know about. */ .base = MSR_IA32_FLUSH_CMD, - .bitmap = (uint8_t*)&deny_bits, + .bitmap = (u8 *)&deny_bits, }, { .flags = KVM_MSR_FILTER_READ | KVM_MSR_FILTER_WRITE, .nmsrs = 1, /* Test a fabricated MSR that no one knows about. */ .base = MSR_NON_EXISTENT, - .bitmap = (uint8_t*)&deny_bits, + .bitmap = (u8 *)&deny_bits, }, }, };
@@ -49,7 +49,7 @@ struct kvm_msr_filter filter_fs = { .flags = KVM_MSR_FILTER_READ, .nmsrs = 1, .base = MSR_FS_BASE, - .bitmap = (uint8_t*)&deny_bits, + .bitmap = (u8 *)&deny_bits, }, }, };
@@ -61,7 +61,7 @@ struct kvm_msr_filter filter_gs = { .flags = KVM_MSR_FILTER_READ, .nmsrs = 1, .base = MSR_GS_BASE, - .bitmap = (uint8_t*)&deny_bits, + .bitmap = (u8 *)&deny_bits, }, }, };
@@ -77,7 +77,7 @@ static u8 bitmap_c0000000[KVM_MSR_FILTER_MAX_BITMAP_SIZE];static u8 bitmap_c0000000_read[KVM_MSR_FILTER_MAX_BITMAP_SIZE ];static u8 bitmap_deadbeef[1 ] = {0x1 }; -static void deny_msr (uint8_t *bitmap,u32 msr) +static void deny_msr (u8 *bitmap,u32 msr) {u32 idx = msr & (KVM_MSR_FILTER_MAX_BITMAP_SIZE -1 );
@@ -724,7 +724,7 @@ static void run_msr_filter_flag_test(struct kvm_vm *vm) .flags = KVM_MSR_FILTER_READ, .nmsrs = 1, .base = 0, - .bitmap = (uint8_t *)&deny_bits, + .bitmap = (u8 *)&deny_bits, }, }, };
tools/testing/selftests/kvm/x86/vmx_pmu_caps_test.c +1 -1
@@ -53,7 +53,7 @@ static const union perf_capabilities format_caps = {static void guest_test_perf_capabilities_gp (u64 val) { -uint8_t vector =wrmsr_safe (MSR_IA32_PERF_CAPABILITIES , val); +u8 vector =wrmsr_safe (MSR_IA32_PERF_CAPABILITIES , val); __GUEST_ASSERT(vector == GP_VECTOR, "Expected #GP for value '0x%lx', got vector '0x%x'",
tools/testing/selftests/kvm/x86/xen_shinfo_test.c +2 -2
@@ -133,8 +133,8 @@ struct arch_vcpu_info { };struct vcpu_info { -uint8_t evtchn_upcall_pending; -uint8_t evtchn_upcall_mask; +u8 evtchn_upcall_pending; +u8 evtchn_upcall_mask;unsigned long evtchn_pending_sel;struct arch_vcpu_info arch;struct pvclock_vcpu_time_info time;
Signature · 1 line
2.49.0.906.g1f30a19c02-goog
Sean Christopherson
maintainerQuoted 5 lines · David Matlack
This series renames types across all KVM selftests to more align with types used in the kernel:
vm_vaddr_t->gva_t
vm_paddr_t->gpa_t
10000% on these.
Quoted 9 lines
uint64_t-> u64
uint32_t-> u32
uint16_t-> u16
uint8_t-> u8
int64_t-> s64
int32_t-> s32
int16_t-> s16
int8_t-> s8
I'm definitely in favor of these renames. I thought I was the only one that tripped over the uintNN_t stuff; at this point, I've probably lost hours of my life trying to type those things out.
Quoted 14 lines · Sean Christopherson
Quoted 5 lines · David Matlack
This series renames types across all KVM selftests to more align with types used in the kernel:
vm_vaddr_t->gva_t
vm_paddr_t->gpa_t10000% on these.
Quoted 5 lines
uint64_t-> u64
uint32_t-> u32
uint16_t-> u16
uint8_t-> u8
Quoted 8 lines
Quoted 4 lines
int64_t-> s64
int32_t-> s32
int16_t-> s16
int8_t-> s8I'm definitely in favor of these renames. I thought I was the only one that tripped over the
uintNN_tstuff; at this point, I've probably lost hours of my life trying to type those things out.
What should the next step be here? I'd be happy to spin a new version whenever on whatever base commit you prefer.
Sean Christopherson
maintainerQuoted 20 lines · David Matlack
Quoted 19 lines · Sean Christopherson
Quoted 5 lines · David Matlack
This series renames types across all KVM selftests to more align with types used in the kernel:
vm_vaddr_t->gva_t
vm_paddr_t->gpa_t10000% on these.
Quoted 9 lines
uint64_t-> u64
uint32_t-> u32
uint16_t-> u16
uint8_t-> u8
int64_t-> s64
int32_t-> s32
int16_t-> s16
int8_t-> s8
Quoted 6 lines
Quoted 3 lines
I'm definitely in favor of these renames. I thought I was the only one that tripped over the
uintNN_tstuff; at this point, I've probably lost hours of my life trying to type those things out.What should the next step be here? I'd be happy to spin a new version whenever on whatever base commit you prefer.
Sorry for the slow reply, I've had this window sitting open for something like two weeks.
My slowness is largely because I'm not sure how to land/approach this. I'm 100% in favor of the renames, it's the timing and coordination I'm unsure of.
In hindsight, it probably would have best to squeeze it into 6.18, so at least the most recent LTS wouldn't generate conflicts all over the place. The next best option would probably be to spin a new version, bribe Paolo to apply it at the end of the next merge window, and tag the whole thing for stable@ (maybe limited to 6.18+?) to minimize downstream pain.
Quoted 26 lines · Sean Christopherson
Quoted 24 lines · David Matlack
Quoted 22 lines · Sean Christopherson
Quoted 5 lines · David Matlack
This series renames types across all KVM selftests to more align with types used in the kernel:
vm_vaddr_t->gva_t
vm_paddr_t->gpa_t10000% on these.
Quoted 9 lines
uint64_t-> u64
uint32_t-> u32
uint16_t-> u16
uint8_t-> u8
int64_t-> s64
int32_t-> s32
int16_t-> s16
int8_t-> s8I'm definitely in favor of these renames. I thought I was the only one that tripped over the
uintNN_tstuff; at this point, I've probably lost hours of my life trying to type those things out.
Quoted 5 lines
Quoted 2 lines
What should the next step be here? I'd be happy to spin a new version whenever on whatever base commit you prefer.
Sorry for the slow reply, I've had this window sitting open for something like two weeks.
No worries, thanks for taking a look :)
Quoted 9 lines
My slowness is largely because I'm not sure how to land/approach this. I'm 100% in favor of the renames, it's the timing and coordination I'm unsure of.
In hindsight, it probably would have best to squeeze it into 6.18, so at least the most recent LTS wouldn't generate conflicts all over the place. The next best option would probably be to spin a new version, bribe Paolo to apply it at the end of the next merge window, and tag the whole thing for stable@ (maybe limited to 6.18+?) to minimize downstream pain.
With LPC coming up I won't have cycles to post a new version before the 6.19 merge window closes.
I'm tempted to say let's just wait for the next LTS release and merge it in then. This is low priorit, so I'm fine with waiting.
Sean Christopherson
maintainerQuoted 10 lines · David Matlack
Quoted 8 lines · Sean Christopherson
My slowness is largely because I'm not sure how to land/approach this. I'm 100% in favor of the renames, it's the timing and coordination I'm unsure of.
In hindsight, it probably would have best to squeeze it into 6.18, so at least the most recent LTS wouldn't generate conflicts all over the place. The next best option would probably be to spin a new version, bribe Paolo to apply it at the end of the next merge window, and tag the whole thing for stable@ (maybe limited to 6.18+?) to minimize downstream pain.
Quoted 5 lines
With LPC coming up I won't have cycles to post a new version before the 6.19 merge window closes.
I'm tempted to say let's just wait for the next LTS release and merge it in then. This is low priorit, so I'm fine with waiting.
I ran this by Paolo in last week's PUCK, and he's in favor of the renames (or at least, is a-ok with us doing it). If you can prep a new version in the next week or so, we can get it applied for 7.1 shortly after the merge window closes.
We don't send all that many selftests patches to LTS kernels, so IMO it's not worth waiting for the next LTS to come around.
Quoted 15 lines · Sean Christopherson
Quoted 13 lines · David Matlack
Quoted 8 lines · Sean Christopherson
My slowness is largely because I'm not sure how to land/approach this. I'm 100% in favor of the renames, it's the timing and coordination I'm unsure of.
In hindsight, it probably would have best to squeeze it into 6.18, so at least the most recent LTS wouldn't generate conflicts all over the place. The next best option would probably be to spin a new version, bribe Paolo to apply it at the end of the next merge window, and tag the whole thing for stable@ (maybe limited to 6.18+?) to minimize downstream pain.
With LPC coming up I won't have cycles to post a new version before the 6.19 merge window closes.
Quoted 6 lines
Quoted 2 lines
I'm tempted to say let's just wait for the next LTS release and merge it in then. This is low priorit, so I'm fine with waiting.
I ran this by Paolo in last week's PUCK, and he's in favor of the renames (or at least, is a-ok with us doing it). If you can prep a new version in the next week or so, we can get it applied for 7.1 shortly after the merge window closes.
Will do. I'll try to have it out by next week. Thanks!
Quoted 16 lines · David Matlack
This series renames types across all KVM selftests to more align with types used in the kernel:
vm_vaddr_t->gva_t
vm_paddr_t->gpa_t
uint64_t-> u64
uint32_t-> u32
uint16_t-> u16
uint8_t-> u8
int64_t-> s64
int32_t-> s32
int16_t-> s16
int8_t-> s8
Quoted 8 lines
The goal of this series is to make the KVM selftests code more concise (the new type names are shorter) and more similar to the kernel, since selftests are developed by kernel developers.
I know broad changes like this series can be difficult to merge and also muddies up the git-blame history, so if there isn't appetite for this we can drop it. But if there is I would be happy to help with rebasing and resolving merge conflicts to get it in.
I don't have a strong preference on this. I'm used to the uint*t stuff since I work on QEMU frequently, but the u* stuff is also fine by me. I guess the biggest downside is the git-blame muddying, but, [knock-on-wood] we don't typically have a lot of bisecting / bug fixing to do.
Thanks,
drew
Quoted 186 lines
Most of the commits in this series are auto-generated with a single command (see commit messages), aside from whitespace fixes, so rebasing onto a different base isn't terrible.
David Matlack (10):
KVM: selftests: Usegva_tinstead ofvm_vaddr_t
KVM: selftests: Usegpa_tinstead ofvm_paddr_t
KVM: selftests: Usegpa_tfor GPAs in Hyper-V selftests
KVM: selftests: Use u64 instead ofuint64_t
KVM: selftests: Use s64 instead ofint64_t
KVM: selftests: Use u32 instead ofuint32_t
KVM: selftests: Use s32 instead ofint32_t
KVM: selftests: Use u16 instead ofuint16_t
KVM: selftests: Use s16 instead ofint16_t
KVM: selftests: Use u8 instead ofuint8_t.../selftests/kvm/access_tracking_perf_test.c | 40 +-- tools/testing/selftests/kvm/arch_timer.c | 6 +- .../selftests/kvm/arm64/aarch32_id_regs.c | 14 +- .../testing/selftests/kvm/arm64/arch_timer.c | 8 +- .../kvm/arm64/arch_timer_edge_cases.c | 159 +++++---- .../selftests/kvm/arm64/debug-exceptions.c | 73 ++-- .../testing/selftests/kvm/arm64/hypercalls.c | 24 +- .../testing/selftests/kvm/arm64/no-vgic-v3.c | 6 +- .../selftests/kvm/arm64/page_fault_test.c | 82 ++--- tools/testing/selftests/kvm/arm64/psci_test.c | 26 +- .../testing/selftests/kvm/arm64/set_id_regs.c | 58 ++-- .../selftests/kvm/arm64/smccc_filter.c | 10 +- tools/testing/selftests/kvm/arm64/vgic_init.c | 56 ++-- tools/testing/selftests/kvm/arm64/vgic_irq.c | 116 +++---- .../selftests/kvm/arm64/vgic_lpi_stress.c | 20 +- .../selftests/kvm/arm64/vpmu_counter_access.c | 62 ++-- .../testing/selftests/kvm/coalesced_io_test.c | 38 +-- .../selftests/kvm/demand_paging_test.c | 10 +- .../selftests/kvm/dirty_log_perf_test.c | 14 +- tools/testing/selftests/kvm/dirty_log_test.c | 82 ++--- tools/testing/selftests/kvm/get-reg-list.c | 2 +- .../testing/selftests/kvm/guest_memfd_test.c | 2 +- .../testing/selftests/kvm/guest_print_test.c | 22 +- .../selftests/kvm/hardware_disable_test.c | 6 +- .../selftests/kvm/include/arm64/arch_timer.h | 30 +- .../selftests/kvm/include/arm64/delay.h | 4 +- .../testing/selftests/kvm/include/arm64/gic.h | 8 +- .../selftests/kvm/include/arm64/gic_v3_its.h | 8 +- .../selftests/kvm/include/arm64/processor.h | 20 +- .../selftests/kvm/include/arm64/ucall.h | 4 +- .../selftests/kvm/include/arm64/vgic.h | 20 +- .../testing/selftests/kvm/include/kvm_util.h | 311 +++++++++--------- .../selftests/kvm/include/kvm_util_types.h | 4 +- .../testing/selftests/kvm/include/memstress.h | 30 +- .../selftests/kvm/include/riscv/arch_timer.h | 22 +- .../selftests/kvm/include/riscv/processor.h | 9 +- .../selftests/kvm/include/riscv/ucall.h | 4 +- .../kvm/include/s390/diag318_test_handler.h | 2 +- .../selftests/kvm/include/s390/facility.h | 4 +- .../selftests/kvm/include/s390/ucall.h | 4 +- .../testing/selftests/kvm/include/sparsebit.h | 6 +- .../testing/selftests/kvm/include/test_util.h | 40 +-- .../selftests/kvm/include/timer_test.h | 18 +- .../selftests/kvm/include/ucall_common.h | 22 +- .../selftests/kvm/include/userfaultfd_util.h | 6 +- .../testing/selftests/kvm/include/x86/apic.h | 22 +- .../testing/selftests/kvm/include/x86/evmcs.h | 22 +- .../selftests/kvm/include/x86/hyperv.h | 28 +- .../selftests/kvm/include/x86/kvm_util_arch.h | 12 +- tools/testing/selftests/kvm/include/x86/pmu.h | 6 +- .../selftests/kvm/include/x86/processor.h | 272 ++++++++------- tools/testing/selftests/kvm/include/x86/sev.h | 14 +- .../selftests/kvm/include/x86/svm_util.h | 10 +- .../testing/selftests/kvm/include/x86/ucall.h | 2 +- tools/testing/selftests/kvm/include/x86/vmx.h | 80 ++--- .../selftests/kvm/kvm_page_table_test.c | 54 +-- tools/testing/selftests/kvm/lib/arm64/gic.c | 6 +- .../selftests/kvm/lib/arm64/gic_private.h | 24 +- .../testing/selftests/kvm/lib/arm64/gic_v3.c | 84 ++--- .../selftests/kvm/lib/arm64/gic_v3_its.c | 12 +- .../selftests/kvm/lib/arm64/processor.c | 126 +++---- tools/testing/selftests/kvm/lib/arm64/ucall.c | 12 +- tools/testing/selftests/kvm/lib/arm64/vgic.c | 38 +-- tools/testing/selftests/kvm/lib/elf.c | 8 +- tools/testing/selftests/kvm/lib/guest_modes.c | 2 +- .../testing/selftests/kvm/lib/guest_sprintf.c | 18 +- tools/testing/selftests/kvm/lib/kvm_util.c | 222 +++++++------ tools/testing/selftests/kvm/lib/memstress.c | 38 +-- .../selftests/kvm/lib/riscv/processor.c | 56 ++-- .../kvm/lib/s390/diag318_test_handler.c | 12 +- .../testing/selftests/kvm/lib/s390/facility.c | 2 +- .../selftests/kvm/lib/s390/processor.c | 42 +-- tools/testing/selftests/kvm/lib/sparsebit.c | 18 +- tools/testing/selftests/kvm/lib/test_util.c | 30 +- .../testing/selftests/kvm/lib/ucall_common.c | 30 +- .../selftests/kvm/lib/userfaultfd_util.c | 14 +- tools/testing/selftests/kvm/lib/x86/apic.c | 2 +- tools/testing/selftests/kvm/lib/x86/hyperv.c | 14 +- .../testing/selftests/kvm/lib/x86/memstress.c | 10 +- tools/testing/selftests/kvm/lib/x86/pmu.c | 4 +- .../testing/selftests/kvm/lib/x86/processor.c | 178 +++++----- tools/testing/selftests/kvm/lib/x86/sev.c | 14 +- tools/testing/selftests/kvm/lib/x86/svm.c | 16 +- tools/testing/selftests/kvm/lib/x86/ucall.c | 4 +- tools/testing/selftests/kvm/lib/x86/vmx.c | 108 +++--- .../kvm/memslot_modification_stress_test.c | 10 +- .../testing/selftests/kvm/memslot_perf_test.c | 164 ++++----- tools/testing/selftests/kvm/mmu_stress_test.c | 28 +- .../selftests/kvm/pre_fault_memory_test.c | 12 +- .../testing/selftests/kvm/riscv/arch_timer.c | 8 +- .../testing/selftests/kvm/riscv/ebreak_test.c | 6 +- .../selftests/kvm/riscv/get-reg-list.c | 2 +- .../selftests/kvm/riscv/sbi_pmu_test.c | 8 +- tools/testing/selftests/kvm/s390/debug_test.c | 8 +- tools/testing/selftests/kvm/s390/memop.c | 94 +++--- tools/testing/selftests/kvm/s390/resets.c | 6 +- .../selftests/kvm/s390/shared_zeropage_test.c | 2 +- tools/testing/selftests/kvm/s390/tprot.c | 24 +- .../selftests/kvm/s390/ucontrol_test.c | 2 +- .../selftests/kvm/set_memory_region_test.c | 40 +-- tools/testing/selftests/kvm/steal_time.c | 52 +-- .../kvm/system_counter_offset_test.c | 12 +- tools/testing/selftests/kvm/x86/amx_test.c | 14 +- .../selftests/kvm/x86/apic_bus_clock_test.c | 24 +- tools/testing/selftests/kvm/x86/cpuid_test.c | 6 +- tools/testing/selftests/kvm/x86/debug_regs.c | 4 +- .../kvm/x86/dirty_log_page_splitting_test.c | 16 +- .../selftests/kvm/x86/feature_msrs_test.c | 12 +- .../selftests/kvm/x86/fix_hypercall_test.c | 20 +- .../selftests/kvm/x86/flds_emulation.h | 6 +- .../testing/selftests/kvm/x86/hwcr_msr_test.c | 10 +- .../testing/selftests/kvm/x86/hyperv_clock.c | 6 +- .../testing/selftests/kvm/x86/hyperv_evmcs.c | 10 +- .../kvm/x86/hyperv_extended_hypercalls.c | 20 +- .../selftests/kvm/x86/hyperv_features.c | 26 +- tools/testing/selftests/kvm/x86/hyperv_ipi.c | 12 +- .../selftests/kvm/x86/hyperv_svm_test.c | 10 +- .../selftests/kvm/x86/hyperv_tlb_flush.c | 36 +- .../selftests/kvm/x86/kvm_clock_test.c | 14 +- tools/testing/selftests/kvm/x86/kvm_pv_test.c | 10 +- .../selftests/kvm/x86/monitor_mwait_test.c | 2 +- .../selftests/kvm/x86/nested_emulation_test.c | 20 +- .../kvm/x86/nested_exceptions_test.c | 6 +- .../selftests/kvm/x86/nx_huge_pages_test.c | 18 +- .../selftests/kvm/x86/platform_info_test.c | 6 +- .../selftests/kvm/x86/pmu_counters_test.c | 108 +++--- .../selftests/kvm/x86/pmu_event_filter_test.c | 102 +++--- .../kvm/x86/private_mem_conversions_test.c | 78 ++--- .../kvm/x86/private_mem_kvm_exits_test.c | 14 +- .../selftests/kvm/x86/set_boot_cpu_id.c | 6 +- .../selftests/kvm/x86/set_sregs_test.c | 6 +- .../selftests/kvm/x86/sev_init2_tests.c | 6 +- .../selftests/kvm/x86/sev_smoke_test.c | 14 +- .../x86/smaller_maxphyaddr_emulation_test.c | 10 +- tools/testing/selftests/kvm/x86/smm_test.c | 8 +- tools/testing/selftests/kvm/x86/state_test.c | 14 +- .../selftests/kvm/x86/svm_int_ctl_test.c | 2 +- .../kvm/x86/svm_nested_shutdown_test.c | 2 +- .../kvm/x86/svm_nested_soft_inject_test.c | 10 +- .../selftests/kvm/x86/svm_vmcall_test.c | 2 +- .../selftests/kvm/x86/sync_regs_test.c | 2 +- .../kvm/x86/triple_fault_event_test.c | 4 +- .../testing/selftests/kvm/x86/tsc_msrs_test.c | 2 +- .../selftests/kvm/x86/tsc_scaling_sync.c | 4 +- .../selftests/kvm/x86/ucna_injection_test.c | 45 +-- .../selftests/kvm/x86/userspace_io_test.c | 4 +- .../kvm/x86/userspace_msr_exit_test.c | 58 ++-- .../selftests/kvm/x86/vmx_apic_access_test.c | 4 +- .../kvm/x86/vmx_close_while_nested_test.c | 2 +- .../selftests/kvm/x86/vmx_dirty_log_test.c | 4 +- .../kvm/x86/vmx_invalid_nested_guest_state.c | 2 +- .../testing/selftests/kvm/x86/vmx_msrs_test.c | 22 +- .../kvm/x86/vmx_nested_tsc_scaling_test.c | 26 +- .../selftests/kvm/x86/vmx_pmu_caps_test.c | 12 +- .../kvm/x86/vmx_preemption_timer_test.c | 2 +- .../selftests/kvm/x86/vmx_tsc_adjust_test.c | 12 +- .../selftests/kvm/x86/xapic_ipi_test.c | 58 ++-- .../selftests/kvm/x86/xapic_state_test.c | 20 +- .../selftests/kvm/x86/xcr0_cpuid_test.c | 8 +- .../selftests/kvm/x86/xen_shinfo_test.c | 22 +- .../testing/selftests/kvm/x86/xss_msr_test.c | 2 +- 161 files changed, 2323 insertions(+), 2338 deletions(-)base-commit:
45eb29140e68ffe8e93a5471006858a018480a45
prerequisite-patch-id:3bae97c9e1093148763235f47a84fa040b512d04Signature · 1 line
2.49.0.906.g1f30a19c02-goog