kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm: selftests: conditionally build vm_xsave_req_perm()
@ 2022-01-18  1:48 Wei Wang
  2022-01-18  8:02 ` Janis Schoetterl-Glausch
  2022-01-18  8:43 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Wang @ 2022-01-18  1:48 UTC (permalink / raw)
  To: scgl, kvm
  Cc: pbonzini, seanjc, guang.zeng, jing2.liu, yang.zhong, tglx,
	kevin.tian, Wei Wang

vm_xsave_req_perm() is currently defined and used by x86_64 only.
Make it compiled into vm_create_with_vcpus() only when on x86_64
machines. Otherwise, it would cause linkage errors, e.g. on s390x.

Fixes: 415a3c33e8 ("kvm: selftests: Add support for KVM_CAP_XSAVE2")
Reported-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Signed-off-by: Wei Wang <wei.w.wang@intel.com>
---
 tools/testing/selftests/kvm/lib/kvm_util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
index 4a645dc77f34..c22a17aac6b0 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util.c
+++ b/tools/testing/selftests/kvm/lib/kvm_util.c
@@ -393,10 +393,12 @@ struct kvm_vm *vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus,
 	struct kvm_vm *vm;
 	int i;
 
+#ifdef __x86_64__
 	/*
 	 * Permission needs to be requested before KVM_SET_CPUID2.
 	 */
 	vm_xsave_req_perm();
+#endif
 
 	/* Force slot0 memory size not small than DEFAULT_GUEST_PHY_PAGES */
 	if (slot0_mem_pages < DEFAULT_GUEST_PHY_PAGES)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kvm: selftests: conditionally build vm_xsave_req_perm()
  2022-01-18  1:48 [PATCH] kvm: selftests: conditionally build vm_xsave_req_perm() Wei Wang
@ 2022-01-18  8:02 ` Janis Schoetterl-Glausch
  2022-01-18  8:43 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Janis Schoetterl-Glausch @ 2022-01-18  8:02 UTC (permalink / raw)
  To: Wei Wang, kvm
  Cc: pbonzini, seanjc, guang.zeng, jing2.liu, yang.zhong, tglx, kevin.tian

On 1/18/22 02:48, Wei Wang wrote:
> vm_xsave_req_perm() is currently defined and used by x86_64 only.
> Make it compiled into vm_create_with_vcpus() only when on x86_64
> machines. Otherwise, it would cause linkage errors, e.g. on s390x.
> 
> Fixes: 415a3c33e8 ("kvm: selftests: Add support for KVM_CAP_XSAVE2")
> Reported-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
> Signed-off-by: Wei Wang <wei.w.wang@intel.com>
> ---

[...]

Tested-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kvm: selftests: conditionally build vm_xsave_req_perm()
  2022-01-18  1:48 [PATCH] kvm: selftests: conditionally build vm_xsave_req_perm() Wei Wang
  2022-01-18  8:02 ` Janis Schoetterl-Glausch
@ 2022-01-18  8:43 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2022-01-18  8:43 UTC (permalink / raw)
  To: Wei Wang, scgl, kvm
  Cc: seanjc, guang.zeng, jing2.liu, yang.zhong, tglx, kevin.tian

On 1/18/22 02:48, Wei Wang wrote:
> vm_xsave_req_perm() is currently defined and used by x86_64 only.
> Make it compiled into vm_create_with_vcpus() only when on x86_64
> machines. Otherwise, it would cause linkage errors, e.g. on s390x.
> 
> Fixes: 415a3c33e8 ("kvm: selftests: Add support for KVM_CAP_XSAVE2")
> Reported-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
> Signed-off-by: Wei Wang <wei.w.wang@intel.com>
> ---
>   tools/testing/selftests/kvm/lib/kvm_util.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
> index 4a645dc77f34..c22a17aac6b0 100644
> --- a/tools/testing/selftests/kvm/lib/kvm_util.c
> +++ b/tools/testing/selftests/kvm/lib/kvm_util.c
> @@ -393,10 +393,12 @@ struct kvm_vm *vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus,
>   	struct kvm_vm *vm;
>   	int i;
>   
> +#ifdef __x86_64__
>   	/*
>   	 * Permission needs to be requested before KVM_SET_CPUID2.
>   	 */
>   	vm_xsave_req_perm();
> +#endif
>   
>   	/* Force slot0 memory size not small than DEFAULT_GUEST_PHY_PAGES */
>   	if (slot0_mem_pages < DEFAULT_GUEST_PHY_PAGES)

Queued, thanks.

Paolo


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-18  8:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18  1:48 [PATCH] kvm: selftests: conditionally build vm_xsave_req_perm() Wei Wang
2022-01-18  8:02 ` Janis Schoetterl-Glausch
2022-01-18  8:43 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).