Skip to contentSkip to conversation

kvm: selftests: conditionally build vm_xsave_req_perm()

PATCH Applied Wei Wang 3 participants 3 messages Jan 18, 2022

Subsystems (2)
lore
Share & tools
lore

Wei Wang

author
#0 lore raw

PATCH 1/1 kvm: selftests: conditionally build vm_xsave_req_perm()

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")
---
 tools/testing/selftests/kvm/lib/kvm_util.c | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/selftests/kvm/lib/kvm_util.c +2 -0
index 4a645dc77f34..c22a17aac6b0 100644
@@ -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)
Signature · 1 line
2.25.1
Tested-by on v1 1/1
#1 lore raw
Quoted 8 lines · 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")

---

[...]

maintainer Applied
#2 lore raw
In reply to Wei Wang
Quoted 18 lines · 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")
---
  tools/testing/selftests/kvm/lib/kvm_util.c | 2 ++
  1 file changed, 2 insertions(+)
tools/testing/selftests/kvm/lib/kvm_util.c +0 -0
index 4a645dc77f34..c22a17aac6b0 100644
@@ -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;

tools/testing/selftests/kvm/lib/kvm_util.c struct kvm_vm *vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus, · line 404

Quoted 10 lines
tools/testing/selftests/kvm/lib/kvm_util.c +2 -0
 
+#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