2019-05-16 11:14:32

by Thomas Huth

[permalink] [raw]
Subject: [RFC PATCH 1/4] KVM: selftests: Guard struct kvm_vcpu_events with __KVM_HAVE_VCPU_EVENTS

The struct kvm_vcpu_events code is only available on certain architectures
(arm, arm64 and x86). To be able to compile kvm_util.c also for other
architectures, we've got to fence the code with __KVM_HAVE_VCPU_EVENTS.

Signed-off-by: Thomas Huth <[email protected]>
---
tools/testing/selftests/kvm/include/kvm_util.h | 2 ++
tools/testing/selftests/kvm/lib/kvm_util.c | 2 ++
2 files changed, 4 insertions(+)

diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h
index 07b71ad9734a..1e46ab205038 100644
--- a/tools/testing/selftests/kvm/include/kvm_util.h
+++ b/tools/testing/selftests/kvm/include/kvm_util.h
@@ -114,10 +114,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);
+#ifdef __KVM_HAVE_VCPU_EVENTS
void vcpu_events_get(struct kvm_vm *vm, uint32_t vcpuid,
struct kvm_vcpu_events *events);
void vcpu_events_set(struct kvm_vm *vm, uint32_t vcpuid,
struct kvm_vcpu_events *events);
+#endif

const char *exit_reason_str(unsigned int exit_reason);

diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
index 4ca96b228e46..8d63ccb93e10 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util.c
+++ b/tools/testing/selftests/kvm/lib/kvm_util.c
@@ -1224,6 +1224,7 @@ void vcpu_regs_set(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_regs *regs)
ret, errno);
}

+#ifdef __KVM_HAVE_VCPU_EVENTS
void vcpu_events_get(struct kvm_vm *vm, uint32_t vcpuid,
struct kvm_vcpu_events *events)
{
@@ -1249,6 +1250,7 @@ void vcpu_events_set(struct kvm_vm *vm, uint32_t vcpuid,
TEST_ASSERT(ret == 0, "KVM_SET_VCPU_EVENTS, failed, rc: %i errno: %i",
ret, errno);
}
+#endif

/*
* VM VCPU System Regs Get
--
2.21.0


2019-05-16 11:25:04

by David Hildenbrand

[permalink] [raw]
Subject: Re: [RFC PATCH 1/4] KVM: selftests: Guard struct kvm_vcpu_events with __KVM_HAVE_VCPU_EVENTS

On 16.05.19 13:12, Thomas Huth wrote:
> The struct kvm_vcpu_events code is only available on certain architectures
> (arm, arm64 and x86). To be able to compile kvm_util.c also for other
> architectures, we've got to fence the code with __KVM_HAVE_VCPU_EVENTS.
>
> Signed-off-by: Thomas Huth <[email protected]>
> ---
> tools/testing/selftests/kvm/include/kvm_util.h | 2 ++
> tools/testing/selftests/kvm/lib/kvm_util.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h
> index 07b71ad9734a..1e46ab205038 100644
> --- a/tools/testing/selftests/kvm/include/kvm_util.h
> +++ b/tools/testing/selftests/kvm/include/kvm_util.h
> @@ -114,10 +114,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);
> +#ifdef __KVM_HAVE_VCPU_EVENTS
> void vcpu_events_get(struct kvm_vm *vm, uint32_t vcpuid,
> struct kvm_vcpu_events *events);
> void vcpu_events_set(struct kvm_vm *vm, uint32_t vcpuid,
> struct kvm_vcpu_events *events);
> +#endif
>
> const char *exit_reason_str(unsigned int exit_reason);
>
> diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
> index 4ca96b228e46..8d63ccb93e10 100644
> --- a/tools/testing/selftests/kvm/lib/kvm_util.c
> +++ b/tools/testing/selftests/kvm/lib/kvm_util.c
> @@ -1224,6 +1224,7 @@ void vcpu_regs_set(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_regs *regs)
> ret, errno);
> }
>
> +#ifdef __KVM_HAVE_VCPU_EVENTS
> void vcpu_events_get(struct kvm_vm *vm, uint32_t vcpuid,
> struct kvm_vcpu_events *events)
> {
> @@ -1249,6 +1250,7 @@ void vcpu_events_set(struct kvm_vm *vm, uint32_t vcpuid,
> TEST_ASSERT(ret == 0, "KVM_SET_VCPU_EVENTS, failed, rc: %i errno: %i",
> ret, errno);
> }
> +#endif
>
> /*
> * VM VCPU System Regs Get
>

Reviewed-by: David Hildenbrand <[email protected]>

--

Thanks,

David / dhildenb

2019-05-20 08:21:11

by Thomas Huth

[permalink] [raw]
Subject: Re: [RFC PATCH 1/4] KVM: selftests: Guard struct kvm_vcpu_events with __KVM_HAVE_VCPU_EVENTS

On 20/05/2019 09.12, Christian Borntraeger wrote:
>
> On 16.05.19 13:12, Thomas Huth wrote:
>> The struct kvm_vcpu_events code is only available on certain architectures
>> (arm, arm64 and x86). To be able to compile kvm_util.c also for other
>> architectures, we've got to fence the code with __KVM_HAVE_VCPU_EVENTS.
>>
>> Signed-off-by: Thomas Huth <[email protected]>
> Acked-by: Christian Borntraeger <[email protected]>
>
> According to the MAINTAINERS patches, you want me to pick these patches. Correct?

That would be nice, yes. But if you don't want to be responsible for
s390x-related KVM selftest patches, please let me know, then I'll drop
these hunks from the patches again.

Thomas

2019-05-20 08:24:13

by Christian Borntraeger

[permalink] [raw]
Subject: Re: [RFC PATCH 1/4] KVM: selftests: Guard struct kvm_vcpu_events with __KVM_HAVE_VCPU_EVENTS



On 20.05.19 10:08, Thomas Huth wrote:
> On 20/05/2019 09.12, Christian Borntraeger wrote:
>>
>> On 16.05.19 13:12, Thomas Huth wrote:
>>> The struct kvm_vcpu_events code is only available on certain architectures
>>> (arm, arm64 and x86). To be able to compile kvm_util.c also for other
>>> architectures, we've got to fence the code with __KVM_HAVE_VCPU_EVENTS.
>>>
>>> Signed-off-by: Thomas Huth <[email protected]>
>> Acked-by: Christian Borntraeger <[email protected]>
>>
>> According to the MAINTAINERS patches, you want me to pick these patches. Correct?
>
> That would be nice, yes. But if you don't want to be responsible for
> s390x-related KVM selftest patches, please let me know, then I'll drop
> these hunks from the patches again.

I can take care of these (as part of the normal KVM maintainership).


2019-05-20 09:04:44

by Christian Borntraeger

[permalink] [raw]
Subject: Re: [RFC PATCH 1/4] KVM: selftests: Guard struct kvm_vcpu_events with __KVM_HAVE_VCPU_EVENTS


On 16.05.19 13:12, Thomas Huth wrote:
> The struct kvm_vcpu_events code is only available on certain architectures
> (arm, arm64 and x86). To be able to compile kvm_util.c also for other
> architectures, we've got to fence the code with __KVM_HAVE_VCPU_EVENTS.
>
> Signed-off-by: Thomas Huth <[email protected]>
Acked-by: Christian Borntraeger <[email protected]>

According to the MAINTAINERS patches, you want me to pick these patches. Correct?


> ---
> tools/testing/selftests/kvm/include/kvm_util.h | 2 ++
> tools/testing/selftests/kvm/lib/kvm_util.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h
> index 07b71ad9734a..1e46ab205038 100644
> --- a/tools/testing/selftests/kvm/include/kvm_util.h
> +++ b/tools/testing/selftests/kvm/include/kvm_util.h
> @@ -114,10 +114,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);
> +#ifdef __KVM_HAVE_VCPU_EVENTS
> void vcpu_events_get(struct kvm_vm *vm, uint32_t vcpuid,
> struct kvm_vcpu_events *events);
> void vcpu_events_set(struct kvm_vm *vm, uint32_t vcpuid,
> struct kvm_vcpu_events *events);
> +#endif
>
> const char *exit_reason_str(unsigned int exit_reason);
>
> diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
> index 4ca96b228e46..8d63ccb93e10 100644
> --- a/tools/testing/selftests/kvm/lib/kvm_util.c
> +++ b/tools/testing/selftests/kvm/lib/kvm_util.c
> @@ -1224,6 +1224,7 @@ void vcpu_regs_set(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_regs *regs)
> ret, errno);
> }
>
> +#ifdef __KVM_HAVE_VCPU_EVENTS
> void vcpu_events_get(struct kvm_vm *vm, uint32_t vcpuid,
> struct kvm_vcpu_events *events)
> {
> @@ -1249,6 +1250,7 @@ void vcpu_events_set(struct kvm_vm *vm, uint32_t vcpuid,
> TEST_ASSERT(ret == 0, "KVM_SET_VCPU_EVENTS, failed, rc: %i errno: %i",
> ret, errno);
> }
> +#endif
>
> /*
> * VM VCPU System Regs Get
>