On 05.07.21 11:53, David Hildenbrand wrote:
On 01.07.21 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")
[...]
+#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);
Can we always assume to run on a kernel where this won't fail?
As far as I can tell, the selftests are bundled with a given kernel (and
there it should not fail). I guess most selftests will fail with a 3.x
kernel and we do not care?
+ close(vm_fd);
+ close(kvm_fd);
+ /* Starting with z13 we have 47bits of physical address */
This matches the definition in the QEMU cpu models.
+ if (info.ibc >= 0x30)
+ guest_mode_append(VM_MODE_P47V64_4K, true, true);
+ }
+#endif
In general, LGTM