kvm selftest cleanup
cover kvm selftest cleanup
Patch 1 to sync KVM_CAP_XSAVE2 to 208, and patch 2 only cleanup processor.c file with tabs as Sean requested before. Those two patches were based on latest Linux release(commit id: e3a8b6a1e70c).
Yang Zhong (2):
kvm: selftests: Sync KVM_CAP_XSAVE2 from linux header
kvm: selftests: Use tabs to replace spaces
tools/include/uapi/linux/kvm.h | 2 +- .../selftests/kvm/lib/x86_64/processor.c | 70 +++++++++---------- 2 files changed, 36 insertions(+), 36 deletions(-)
PATCH 1/2 kvm: selftests: Sync KVM_CAP_XSAVE2 from linux header
Need sync KVM_CAP_XSAVE2 from linux header to here.
--- tools/include/uapi/linux/kvm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/include/uapi/linux/kvm.h +1 -1
@@ -1131,7 +1131,7 @@ struct kvm_ppc_resize_hpt {#define KVM_CAP_EXIT_ON_EMULATION_FAILURE 204#define KVM_CAP_ARM_MTE 205#define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206 -#define KVM_CAP_XSAVE2 207 +#define KVM_CAP_XSAVE2 208#ifdef KVM_CAP_IRQ_ROUTING
Sean Christopherson
reviewerRe: [PATCH 1/2] kvm: selftests: Sync KVM_CAP_XSAVE2 from linux header
Quoted 12 lines · Yang Zhong
Need sync
KVM_CAP_XSAVE2from linux header to here.Signed-off-by Yang Zhong <[email protected]>--- tools/include/uapi/linux/kvm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/include/uapi/linux/kvm.h +0
-0
tools/include/uapi/linux/kvm.h struct kvm_ppc_resize_hpt { · line 1134
Quoted 5 lines
tools/include/uapi/linux/kvm.h +1
-1@@ -1131,7 +1131,7 @@ struct kvm_ppc_resize_hpt {#define KVM_CAP_EXIT_ON_EMULATION_FAILURE 204#define KVM_CAP_ARM_MTE 205#define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206 -#define KVM_CAP_XSAVE2 207 +#define KVM_CAP_XSAVE2 208
Any reason not to opportunistically sync the entire file? E.g. this diff looks rather confusing without pulling in KVM_CAP_VM_GPA_BITS (that consumes "207").
Quoted 3 lines
tools/include/uapi/linux/kvm.h +0
-0#ifdef KVM_CAP_IRQ_ROUTING
Re: [PATCH 1/2] kvm: selftests: Sync KVM_CAP_XSAVE2 from linux header
Quoted 8 lines · Sean Christopherson
Quoted 7 lines · Yang Zhong
Need sync
KVM_CAP_XSAVE2from linux header to here.Signed-off-by Yang Zhong <[email protected]>--- tools/include/uapi/linux/kvm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
tools/include/uapi/linux/kvm.h struct kvm_ppc_resize_hpt { · line 1134
Quoted 10 lines
tools/include/uapi/linux/kvm.h +1
-1@@ -1131,7 +1131,7 @@ struct kvm_ppc_resize_hpt {#define KVM_CAP_EXIT_ON_EMULATION_FAILURE 204#define KVM_CAP_ARM_MTE 205#define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206 -#define KVM_CAP_XSAVE2 207 +#define KVM_CAP_XSAVE2 208Any reason not to opportunistically sync the entire file? E.g. this diff looks rather confusing without pulling in
KVM_CAP_VM_GPA_BITS(that consumes "207").
Thanks Sean, I checked this file history, Arnaldo Carvalho de Melo <[email protected]>, who always sync this header with kernel source, so maybe much better if he can do this.
Please ignore this patch and help review patch 2, thanks!
Yang
Quoted 3 lines
Quoted 3 lines
tools/include/uapi/linux/kvm.h +0
-0#ifdef KVM_CAP_IRQ_ROUTING
PATCH 2/2 kvm: selftests: Use tabs to replace spaces
In reply to Yang ZhongOnly cleanup this processor.c by using tabs to replace spaces.
--- .../selftests/kvm/lib/x86_64/processor.c | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-)
tools/testing/selftests/kvm/lib/x86_64/processor.c +35 -35
@@ -1136,25 +1136,25 @@ struct kvm_x86_state *vcpu_save_state(struct kvm_vm *vm, uint32_t vcpuid) list =malloc (sizeof (*list) + nmsrs *sizeof (list->indices[0 ])); list->nmsrs = nmsrs; r =ioctl (vm->kvm_fd,KVM_GET_MSR_INDEX_LIST , list); -TEST_ASSERT (r ==0 ,"Unexpected result from KVM_GET_MSR_INDEX_LIST, r: %i" , - r); +TEST_ASSERT (r ==0 ,"Unexpected result from KVM_GET_MSR_INDEX_LIST, r: %i" , + r); state =malloc (sizeof (*state) + nmsrs *sizeof (state->msrs.entries[0 ])); r =ioctl (vcpu->fd,KVM_GET_VCPU_EVENTS , &state->events); -TEST_ASSERT (r ==0 ,"Unexpected result from KVM_GET_VCPU_EVENTS, r: %i" , - r); +TEST_ASSERT (r ==0 ,"Unexpected result from KVM_GET_VCPU_EVENTS, r: %i" , + r); r =ioctl (vcpu->fd,KVM_GET_MP_STATE , &state->mp_state); -TEST_ASSERT (r ==0 ,"Unexpected result from KVM_GET_MP_STATE, r: %i" , - r); +TEST_ASSERT (r ==0 ,"Unexpected result from KVM_GET_MP_STATE, r: %i" , + r); r =ioctl (vcpu->fd,KVM_GET_REGS , &state->regs); -TEST_ASSERT (r ==0 ,"Unexpected result from KVM_GET_REGS, r: %i" , - r); +TEST_ASSERT (r ==0 ,"Unexpected result from KVM_GET_REGS, r: %i" , + r); r =vcpu_save_xsave_state (vm, vcpu, state); -TEST_ASSERT (r ==0 ,"Unexpected result from KVM_GET_XSAVE, r: %i" , - r); +TEST_ASSERT (r ==0 ,"Unexpected result from KVM_GET_XSAVE, r: %i" , + r);if (kvm_check_cap (KVM_CAP_XCRS )) { r =ioctl (vcpu->fd,KVM_GET_XCRS , &state->xcrs);
@@ -1163,17 +1163,17 @@ struct kvm_x86_state *vcpu_save_state(struct kvm_vm *vm, uint32_t vcpuid) } r =ioctl (vcpu->fd,KVM_GET_SREGS , &state->sregs); -TEST_ASSERT (r ==0 ,"Unexpected result from KVM_GET_SREGS, r: %i" , - r); +TEST_ASSERT (r ==0 ,"Unexpected result from KVM_GET_SREGS, r: %i" , + r);if (nested_size) { state->nested.size =sizeof (state->nested_); r =ioctl (vcpu->fd,KVM_GET_NESTED_STATE , &state->nested);TEST_ASSERT (r ==0 ,"Unexpected result from KVM_GET_NESTED_STATE, r: %i" , - r); + r);TEST_ASSERT (state->nested.size <= nested_size, -"Nested state size too big, %i (KVM_CHECK_CAP gave %i)" , - state->nested.size, nested_size); +"Nested state size too big, %i (KVM_CHECK_CAP gave %i)" , + state->nested.size, nested_size); }else state->nested.size =0 ;
@@ -1181,12 +1181,12 @@ struct kvm_x86_state *vcpu_save_state(struct kvm_vm *vm, uint32_t vcpuid)for (i =0 ; i < nmsrs; i++) state->msrs.entries[i].index = list->indices[i]; r =ioctl (vcpu->fd,KVM_GET_MSRS , &state->msrs); -TEST_ASSERT (r == nmsrs,"Unexpected result from KVM_GET_MSRS, r: %i (failed MSR was 0x%x)" , - r, r == nmsrs ?-1 : list->indices[r]); +TEST_ASSERT (r == nmsrs,"Unexpected result from KVM_GET_MSRS, r: %i (failed MSR was 0x%x)" , + r, r == nmsrs ?-1 : list->indices[r]); r =ioctl (vcpu->fd,KVM_GET_DEBUGREGS , &state->debugregs); -TEST_ASSERT (r ==0 ,"Unexpected result from KVM_GET_DEBUGREGS, r: %i" , - r); +TEST_ASSERT (r ==0 ,"Unexpected result from KVM_GET_DEBUGREGS, r: %i" , + r);free (list);return state;
@@ -1199,7 +1199,7 @@ void vcpu_load_state(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_x86_state *s r =ioctl (vcpu->fd,KVM_SET_SREGS , &state->sregs);TEST_ASSERT (r ==0 ,"Unexpected result from KVM_SET_SREGS, r: %i" , - r); + r); r =ioctl (vcpu->fd,KVM_SET_MSRS , &state->msrs); TEST_ASSERT(r == state->msrs.nmsrs,
@@ -1214,28 +1214,28 @@ void vcpu_load_state(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_x86_state *s r =ioctl (vcpu->fd,KVM_SET_XSAVE , state->xsave);TEST_ASSERT (r ==0 ,"Unexpected result from KVM_SET_XSAVE, r: %i" , - r); + r); r =ioctl (vcpu->fd,KVM_SET_VCPU_EVENTS , &state->events); -TEST_ASSERT (r ==0 ,"Unexpected result from KVM_SET_VCPU_EVENTS, r: %i" , - r); +TEST_ASSERT (r ==0 ,"Unexpected result from KVM_SET_VCPU_EVENTS, r: %i" , + r); r =ioctl (vcpu->fd,KVM_SET_MP_STATE , &state->mp_state); -TEST_ASSERT (r ==0 ,"Unexpected result from KVM_SET_MP_STATE, r: %i" , - r); +TEST_ASSERT (r ==0 ,"Unexpected result from KVM_SET_MP_STATE, r: %i" , + r); r =ioctl (vcpu->fd,KVM_SET_DEBUGREGS , &state->debugregs); -TEST_ASSERT (r ==0 ,"Unexpected result from KVM_SET_DEBUGREGS, r: %i" , - r); +TEST_ASSERT (r ==0 ,"Unexpected result from KVM_SET_DEBUGREGS, r: %i" , + r); r =ioctl (vcpu->fd,KVM_SET_REGS , &state->regs); -TEST_ASSERT (r ==0 ,"Unexpected result from KVM_SET_REGS, r: %i" , - r); +TEST_ASSERT (r ==0 ,"Unexpected result from KVM_SET_REGS, r: %i" , + r);if (state->nested.size) { r =ioctl (vcpu->fd,KVM_SET_NESTED_STATE , &state->nested);TEST_ASSERT (r ==0 ,"Unexpected result from KVM_SET_NESTED_STATE, r: %i" , - r); + r); } }
@@ -1485,14 +1485,14 @@ struct kvm_cpuid2 *vcpu_get_supported_hv_cpuid(struct kvm_vm *vm, uint32_t vcpuistatic inline unsigned x86_family (unsigned int eax) { -unsigned int x86; +unsigned int x86; - x86 = (eax >>8 ) &0xf ; + x86 = (eax >>8 ) &0xf ; -if (x86 ==0xf ) - x86 += (eax >>20 ) &0xff ; +if (x86 ==0xf ) + x86 += (eax >>20 ) &0xff ; -return x86; +return x86; }unsigned long vm_compute_max_gfn (struct kvm_vm *vm)
Paolo Bonzini
maintainerQuoted 4 lines · Yang Zhong
Patch 1 to sync
KVM_CAP_XSAVE2to 208, and patch 2 only cleanupprocessor.cfile with tabs as Sean requested before. Those two patches were based on latest Linux release(commit id:e3a8b6a1e70c).
Quoted 8 lines
Yang Zhong (2):
kvm: selftests: SyncKVM_CAP_XSAVE2from linux header
kvm: selftests: Use tabs to replace spacestools/include/uapi/linux/kvm.h | 2 +- .../selftests/kvm/lib/x86_64/processor.c | 70 +++++++++---------- 2 files changed, 36 insertions(+), 36 deletions(-)
Hi,
I sent a slightly more complete version of both patches.
Thanks,
Paolo
Quoted 9 lines · Paolo Bonzini
Quoted 8 lines · Yang Zhong
Patch 1 to sync
KVM_CAP_XSAVE2to 208, and patch 2 only cleanupprocessor.cfile with tabs as Sean requested before. Those two patches were based on latest Linux release(commit id:e3a8b6a1e70c).Yang Zhong (2):
kvm: selftests: SyncKVM_CAP_XSAVE2from linux header
kvm: selftests: Use tabs to replace spaces
Quoted 9 lines
Quoted 4 lines
tools/include/uapi/linux/kvm.h | 2 +- .../selftests/kvm/lib/x86_64/processor.c | 70 +++++++++---------- 2 files changed, 36 insertions(+), 36 deletions(-)Hi,
I sent a slightly more complete version of both patches.
Thanks Paolo, :).
Yang
Quoted 3 lines
Thanks,
Paolo