Re: [PATCH/RFC] KVM: selftests: introduce P44V64 for z196 and EC12

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/07/2021 17.38, Christian Borntraeger wrote:
Older machines likes z196 and zEC12 do only support 44 bits of physical
addresses. Make this the default and check via IBC if we are on a later
machine. We then add P47V64 as an additional model.

Signed-off-by: Christian Borntraeger <borntraeger@xxxxxxxxxx>
Fixes: 1bc603af73dd ("KVM: selftests: introduce P47V64 for s390x")
---
  tools/testing/selftests/kvm/include/kvm_util.h |  3 ++-
  tools/testing/selftests/kvm/lib/guest_modes.c  | 16 ++++++++++++++++
  tools/testing/selftests/kvm/lib/kvm_util.c     |  5 +++++
  3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h
index 35739567189e..74d73532fce9 100644
--- a/tools/testing/selftests/kvm/include/kvm_util.h
+++ b/tools/testing/selftests/kvm/include/kvm_util.h
@@ -44,6 +44,7 @@ enum vm_guest_mode {
  	VM_MODE_P40V48_64K,
  	VM_MODE_PXXV48_4K,	/* For 48bits VA but ANY bits PA */
  	VM_MODE_P47V64_4K,
+	VM_MODE_P44V64_4K,
  	NUM_VM_MODES,
  };
@@ -61,7 +62,7 @@ enum vm_guest_mode { #elif defined(__s390x__) -#define VM_MODE_DEFAULT VM_MODE_P47V64_4K
+#define VM_MODE_DEFAULT			VM_MODE_P44V64_4K
  #define MIN_PAGE_SHIFT			12U
  #define ptes_per_page(page_size)	((page_size) / 16)
diff --git a/tools/testing/selftests/kvm/lib/guest_modes.c b/tools/testing/selftests/kvm/lib/guest_modes.c
index 25bff307c71f..c330f414ef96 100644
--- a/tools/testing/selftests/kvm/lib/guest_modes.c
+++ b/tools/testing/selftests/kvm/lib/guest_modes.c
@@ -22,6 +22,22 @@ void guest_modes_append_default(void)
  		}
  	}
  #endif
+#ifdef __s390x__
+	{
+		int kvm_fd, vm_fd;
+		struct kvm_s390_vm_cpu_processor info;
+
+		kvm_fd = open_kvm_dev_path_or_exit();
+		vm_fd = ioctl(kvm_fd, KVM_CREATE_VM, 0);
+		kvm_device_access(vm_fd, KVM_S390_VM_CPU_MODEL,
+				  KVM_S390_VM_CPU_PROCESSOR, &info, false);
+		close(vm_fd);
+		close(kvm_fd);
+		/* Starting with z13 we have 47bits of physical address */
+		if (info.ibc >= 0x30)
+			guest_mode_append(VM_MODE_P47V64_4K, true, true);

Wouldn't it make more sense to check the processor number in /proc/cpuinfo? ... well, I guess both ways of checking have their advantages and disadvantages, so anyway:

Reviewed-by: Thomas Huth <thuth@xxxxxxxxxx>




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux