Re: [PATCH v10 4/6] selftests: KVM: Add fpu and one reg set/get library functions

Paolo Bonzini
2020-01-31T13:59:10Z

On 31/01/20 12:43, Christian Borntraeger wrote:
> Paolo,
>
> are you ok with me taking this patch for my s390 pull request to you?
> Ideally still for 5.6?

Yes to both questions, of course.

Paolo

> On 31.01.20 11:02, Janosch Frank wrote:
>> Add library access to more registers.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
>> ---
>> .../testing/selftests/kvm/include/kvm_util.h | 6 ++++
>> tools/testing/selftests/kvm/lib/kvm_util.c | 36 +++++++++++++++++++
>> 2 files changed, 42 insertions(+)
>>
>> diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h
>> index 29cccaf96baf..ae0d14c2540a 100644
>> --- a/tools/testing/selftests/kvm/include/kvm_util.h
>> +++ b/tools/testing/selftests/kvm/include/kvm_util.h
>> @@ -125,6 +125,12 @@ void vcpu_sregs_set(struct kvm_vm *vm, uint32_t vcpuid,
>> struct kvm_sregs *sregs);
>> int _vcpu_sregs_set(struct kvm_vm *vm, uint32_t vcpuid,
>> struct kvm_sregs *sregs);
>> +void vcpu_fpu_get(struct kvm_vm *vm, uint32_t vcpuid,
>> + struct kvm_fpu *fpu);
>> +void vcpu_fpu_set(struct kvm_vm *vm, uint32_t vcpuid,
>> + struct kvm_fpu *fpu);
>> +void vcpu_get_reg(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_one_reg *reg);
>> +void vcpu_set_reg(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_one_reg *reg);
>> #ifdef __KVM_HAVE_VCPU_EVENTS
>> void vcpu_events_get(struct kvm_vm *vm, uint32_t vcpuid,
>> struct kvm_vcpu_events *events);
>> diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
>> index 41cf45416060..a6dd0401eb50 100644
>> --- a/tools/testing/selftests/kvm/lib/kvm_util.c
>> +++ b/tools/testing/selftests/kvm/lib/kvm_util.c
>> @@ -1373,6 +1373,42 @@ int _vcpu_sregs_set(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_sregs *sregs)
>> return ioctl(vcpu->fd, KVM_SET_SREGS, sregs);
>> }
>>
>> +void vcpu_fpu_get(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_fpu *fpu)
>> +{
>> + int ret;
>> +
>> + ret = _vcpu_ioctl(vm, vcpuid, KVM_GET_FPU, fpu);
>> + TEST_ASSERT(ret == 0, "KVM_GET_FPU failed, rc: %i errno: %i (%s)",
>> + ret, errno, strerror(errno));
>> +}
>> +
>> +void vcpu_fpu_set(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_fpu *fpu)
>> +{
>> + int ret;
>> +
>> + ret = _vcpu_ioctl(vm, vcpuid, KVM_SET_FPU, fpu);
>> + TEST_ASSERT(ret == 0, "KVM_SET_FPU failed, rc: %i errno: %i (%s)",
>> + ret, errno, strerror(errno));
>> +}
>> +
>> +void vcpu_get_reg(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_one_reg *reg)
>> +{
>> + int ret;
>> +
>> + ret = _vcpu_ioctl(vm, vcpuid, KVM_GET_ONE_REG, reg);
>> + TEST_ASSERT(ret == 0, "KVM_GET_ONE_REG failed, rc: %i errno: %i (%s)",
>> + ret, errno, strerror(errno));
>> +}
>> +
>> +void vcpu_set_reg(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_one_reg *reg)
>> +{
>> + int ret;
>> +
>> + ret = _vcpu_ioctl(vm, vcpuid, KVM_SET_ONE_REG, reg);
>> + TEST_ASSERT(ret == 0, "KVM_SET_ONE_REG failed, rc: %i errno: %i (%s)",
>> + ret, errno, strerror(errno));
>> +}
>> +
>> /*
>> * VCPU Ioctl
>> *
>>
>