All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC] KVM: selftests: introduce P44V64 for z196 and EC12
@ 2021-07-01 15:38 Christian Borntraeger
  2021-07-05  9:53 ` David Hildenbrand
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Christian Borntraeger @ 2021-07-01 15:38 UTC (permalink / raw)
  To: KVM
  Cc: Cornelia Huck, Christian Borntraeger, Janosch Frank,
	David Hildenbrand, linux-s390, Thomas Huth, Claudio Imbrenda,
	Paolo Bonzini

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@de.ibm.com>
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);
+	}
+#endif
 }
 
 void for_each_guest_mode(void (*func)(enum vm_guest_mode, void *), void *arg)
diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
index a2b732cf96ea..8606000c439e 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util.c
+++ b/tools/testing/selftests/kvm/lib/kvm_util.c
@@ -176,6 +176,7 @@ const char *vm_guest_mode_string(uint32_t i)
 		[VM_MODE_P40V48_64K]	= "PA-bits:40,  VA-bits:48, 64K pages",
 		[VM_MODE_PXXV48_4K]	= "PA-bits:ANY, VA-bits:48,  4K pages",
 		[VM_MODE_P47V64_4K]	= "PA-bits:47,  VA-bits:64,  4K pages",
+		[VM_MODE_P44V64_4K]	= "PA-bits:44,  VA-bits:64,  4K pages",
 	};
 	_Static_assert(sizeof(strings)/sizeof(char *) == NUM_VM_MODES,
 		       "Missing new mode strings?");
@@ -194,6 +195,7 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = {
 	{ 40, 48, 0x10000, 16 },
 	{  0,  0,  0x1000, 12 },
 	{ 47, 64,  0x1000, 12 },
+	{ 44, 64,  0x1000, 12 },
 };
 _Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES,
 	       "Missing new mode params?");
@@ -282,6 +284,9 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm)
 	case VM_MODE_P47V64_4K:
 		vm->pgtable_levels = 5;
 		break;
+	case VM_MODE_P44V64_4K:
+		vm->pgtable_levels = 5;
+		break;
 	default:
 		TEST_FAIL("Unknown guest mode, mode: 0x%x", mode);
 	}
-- 
2.31.1


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

* Re: [PATCH/RFC] KVM: selftests: introduce P44V64 for z196 and EC12
  2021-07-01 15:38 [PATCH/RFC] KVM: selftests: introduce P44V64 for z196 and EC12 Christian Borntraeger
@ 2021-07-05  9:53 ` David Hildenbrand
  2021-07-05  9:59   ` Christian Borntraeger
  2021-07-05 10:16 ` Thomas Huth
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: David Hildenbrand @ 2021-07-05  9:53 UTC (permalink / raw)
  To: Christian Borntraeger, KVM
  Cc: Cornelia Huck, Janosch Frank, linux-s390, Thomas Huth,
	Claudio Imbrenda, Paolo Bonzini

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@de.ibm.com>
> 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?

> +		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


-- 
Thanks,

David / dhildenb


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

* Re: [PATCH/RFC] KVM: selftests: introduce P44V64 for z196 and EC12
  2021-07-05  9:53 ` David Hildenbrand
@ 2021-07-05  9:59   ` Christian Borntraeger
  2021-07-05 10:05     ` David Hildenbrand
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Borntraeger @ 2021-07-05  9:59 UTC (permalink / raw)
  To: David Hildenbrand, KVM
  Cc: Cornelia Huck, Janosch Frank, linux-s390, Thomas Huth,
	Claudio Imbrenda, Paolo Bonzini



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@de.ibm.com>
>> 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
> 
> 

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

* Re: [PATCH/RFC] KVM: selftests: introduce P44V64 for z196 and EC12
  2021-07-05  9:59   ` Christian Borntraeger
@ 2021-07-05 10:05     ` David Hildenbrand
  0 siblings, 0 replies; 9+ messages in thread
From: David Hildenbrand @ 2021-07-05 10:05 UTC (permalink / raw)
  To: Christian Borntraeger, KVM
  Cc: Cornelia Huck, Janosch Frank, linux-s390, Thomas Huth,
	Claudio Imbrenda, Paolo Bonzini

On 05.07.21 11:59, Christian Borntraeger wrote:
> 
> 
> 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@de.ibm.com>
>>> 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?

Fair enough

Reviewed-by: David Hildenbrand <david@redhat.com>


-- 
Thanks,

David / dhildenb


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

* Re: [PATCH/RFC] KVM: selftests: introduce P44V64 for z196 and EC12
  2021-07-01 15:38 [PATCH/RFC] KVM: selftests: introduce P44V64 for z196 and EC12 Christian Borntraeger
  2021-07-05  9:53 ` David Hildenbrand
@ 2021-07-05 10:16 ` Thomas Huth
  2021-07-05 10:34 ` Cornelia Huck
  2021-07-06  7:40 ` Christian Borntraeger
  3 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2021-07-05 10:16 UTC (permalink / raw)
  To: Christian Borntraeger, KVM
  Cc: Cornelia Huck, Janosch Frank, David Hildenbrand, linux-s390,
	Claudio Imbrenda, Paolo Bonzini

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@de.ibm.com>
> 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@redhat.com>


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

* Re: [PATCH/RFC] KVM: selftests: introduce P44V64 for z196 and EC12
  2021-07-01 15:38 [PATCH/RFC] KVM: selftests: introduce P44V64 for z196 and EC12 Christian Borntraeger
  2021-07-05  9:53 ` David Hildenbrand
  2021-07-05 10:16 ` Thomas Huth
@ 2021-07-05 10:34 ` Cornelia Huck
  2021-07-06  7:40 ` Christian Borntraeger
  3 siblings, 0 replies; 9+ messages in thread
From: Cornelia Huck @ 2021-07-05 10:34 UTC (permalink / raw)
  To: Christian Borntraeger, KVM
  Cc: Christian Borntraeger, Janosch Frank, David Hildenbrand,
	linux-s390, Thomas Huth, Claudio Imbrenda, Paolo Bonzini

On Thu, Jul 01 2021, Christian Borntraeger <borntraeger@de.ibm.com> wrote:

> Older machines likes z196 and zEC12 do only support 44 bits of physical

s/likes/like/

> 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@de.ibm.com>
> 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(-)
>

Reviewed-by: Cornelia Huck <cohuck@redhat.com>


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

* Re: [PATCH/RFC] KVM: selftests: introduce P44V64 for z196 and EC12
  2021-07-01 15:38 [PATCH/RFC] KVM: selftests: introduce P44V64 for z196 and EC12 Christian Borntraeger
                   ` (2 preceding siblings ...)
  2021-07-05 10:34 ` Cornelia Huck
@ 2021-07-06  7:40 ` Christian Borntraeger
  2021-07-06  7:45   ` Christian Borntraeger
  3 siblings, 1 reply; 9+ messages in thread
From: Christian Borntraeger @ 2021-07-06  7:40 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Cornelia Huck, Janosch Frank, David Hildenbrand, linux-s390,
	Thomas Huth, Claudio Imbrenda, KVM

Paolo,

since you have not yet pulled my queue for 5.14. Shall I add the two selftest patches and send a new
pull request?

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@de.ibm.com>
> 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);
> +	}
> +#endif
>   }
>   
>   void for_each_guest_mode(void (*func)(enum vm_guest_mode, void *), void *arg)
> diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
> index a2b732cf96ea..8606000c439e 100644
> --- a/tools/testing/selftests/kvm/lib/kvm_util.c
> +++ b/tools/testing/selftests/kvm/lib/kvm_util.c
> @@ -176,6 +176,7 @@ const char *vm_guest_mode_string(uint32_t i)
>   		[VM_MODE_P40V48_64K]	= "PA-bits:40,  VA-bits:48, 64K pages",
>   		[VM_MODE_PXXV48_4K]	= "PA-bits:ANY, VA-bits:48,  4K pages",
>   		[VM_MODE_P47V64_4K]	= "PA-bits:47,  VA-bits:64,  4K pages",
> +		[VM_MODE_P44V64_4K]	= "PA-bits:44,  VA-bits:64,  4K pages",
>   	};
>   	_Static_assert(sizeof(strings)/sizeof(char *) == NUM_VM_MODES,
>   		       "Missing new mode strings?");
> @@ -194,6 +195,7 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = {
>   	{ 40, 48, 0x10000, 16 },
>   	{  0,  0,  0x1000, 12 },
>   	{ 47, 64,  0x1000, 12 },
> +	{ 44, 64,  0x1000, 12 },
>   };
>   _Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES,
>   	       "Missing new mode params?");
> @@ -282,6 +284,9 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm)
>   	case VM_MODE_P47V64_4K:
>   		vm->pgtable_levels = 5;
>   		break;
> +	case VM_MODE_P44V64_4K:
> +		vm->pgtable_levels = 5;
> +		break;
>   	default:
>   		TEST_FAIL("Unknown guest mode, mode: 0x%x", mode);
>   	}
> 

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

* Re: [PATCH/RFC] KVM: selftests: introduce P44V64 for z196 and EC12
  2021-07-06  7:40 ` Christian Borntraeger
@ 2021-07-06  7:45   ` Christian Borntraeger
  2021-07-06  8:18     ` Christian Borntraeger
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Borntraeger @ 2021-07-06  7:45 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Cornelia Huck, Janosch Frank, David Hildenbrand, linux-s390,
	Thomas Huth, Claudio Imbrenda, KVM

On 06.07.21 09:40, Christian Borntraeger wrote:
> Paolo,
> 
> since you have not yet pulled my queue for 5.14. Shall I add the two selftest patches and send a new
> pull request?

Hmm, I cant put it on top of the next queue since I would need to rebase.
So lets do the original pull request and I will do another one
on top of kvm/master for the 2 selftest patches.
> 
> 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@de.ibm.com>
>> 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);
>> +    }
>> +#endif
>>   }
>>   void for_each_guest_mode(void (*func)(enum vm_guest_mode, void *), void *arg)
>> diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
>> index a2b732cf96ea..8606000c439e 100644
>> --- a/tools/testing/selftests/kvm/lib/kvm_util.c
>> +++ b/tools/testing/selftests/kvm/lib/kvm_util.c
>> @@ -176,6 +176,7 @@ const char *vm_guest_mode_string(uint32_t i)
>>           [VM_MODE_P40V48_64K]    = "PA-bits:40,  VA-bits:48, 64K pages",
>>           [VM_MODE_PXXV48_4K]    = "PA-bits:ANY, VA-bits:48,  4K pages",
>>           [VM_MODE_P47V64_4K]    = "PA-bits:47,  VA-bits:64,  4K pages",
>> +        [VM_MODE_P44V64_4K]    = "PA-bits:44,  VA-bits:64,  4K pages",
>>       };
>>       _Static_assert(sizeof(strings)/sizeof(char *) == NUM_VM_MODES,
>>                  "Missing new mode strings?");
>> @@ -194,6 +195,7 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = {
>>       { 40, 48, 0x10000, 16 },
>>       {  0,  0,  0x1000, 12 },
>>       { 47, 64,  0x1000, 12 },
>> +    { 44, 64,  0x1000, 12 },
>>   };
>>   _Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES,
>>              "Missing new mode params?");
>> @@ -282,6 +284,9 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm)
>>       case VM_MODE_P47V64_4K:
>>           vm->pgtable_levels = 5;
>>           break;
>> +    case VM_MODE_P44V64_4K:
>> +        vm->pgtable_levels = 5;
>> +        break;
>>       default:
>>           TEST_FAIL("Unknown guest mode, mode: 0x%x", mode);
>>       }
>>

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

* Re: [PATCH/RFC] KVM: selftests: introduce P44V64 for z196 and EC12
  2021-07-06  7:45   ` Christian Borntraeger
@ 2021-07-06  8:18     ` Christian Borntraeger
  0 siblings, 0 replies; 9+ messages in thread
From: Christian Borntraeger @ 2021-07-06  8:18 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Cornelia Huck, Janosch Frank, David Hildenbrand, linux-s390,
	Thomas Huth, Claudio Imbrenda, KVM


On 06.07.21 09:45, Christian Borntraeger wrote:
> On 06.07.21 09:40, Christian Borntraeger wrote:
>> Paolo,
>>
>> since you have not yet pulled my queue for 5.14. Shall I add the two selftest patches and send a new
>> pull request?
> 
> Hmm, I cant put it on top of the next queue since I would need to rebase.
> So lets do the original pull request and I will do another one
> on top of kvm/master for the 2 selftest patches.

And I just realized that you did already pull the s390x and sent it to Linus.
Pull request for the selftest patches will follow soon.

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

end of thread, other threads:[~2021-07-06  8:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01 15:38 [PATCH/RFC] KVM: selftests: introduce P44V64 for z196 and EC12 Christian Borntraeger
2021-07-05  9:53 ` David Hildenbrand
2021-07-05  9:59   ` Christian Borntraeger
2021-07-05 10:05     ` David Hildenbrand
2021-07-05 10:16 ` Thomas Huth
2021-07-05 10:34 ` Cornelia Huck
2021-07-06  7:40 ` Christian Borntraeger
2021-07-06  7:45   ` Christian Borntraeger
2021-07-06  8:18     ` Christian Borntraeger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.