public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH v3 0/1] s390x: cmm: test no-translate bit after reset
@ 2024-04-23 10:34 Nico Boehr
  2024-04-23 10:34 ` [kvm-unit-tests PATCH v3 1/1] " Nico Boehr
  0 siblings, 1 reply; 3+ messages in thread
From: Nico Boehr @ 2024-04-23 10:34 UTC (permalink / raw)
  To: frankja, imbrenda, thuth; +Cc: kvm, linux-s390

v3:
---
* fix specification exception when ESSA no-dat is not available

v2:
---
* fix reverse christmas tree



Nico Boehr (1):
  s390x: cmm: test no-translate bit after reset

 s390x/cmm.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

-- 
2.41.0


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

* [kvm-unit-tests PATCH v3 1/1] s390x: cmm: test no-translate bit after reset
  2024-04-23 10:34 [kvm-unit-tests PATCH v3 0/1] s390x: cmm: test no-translate bit after reset Nico Boehr
@ 2024-04-23 10:34 ` Nico Boehr
  2024-04-23 12:57   ` Claudio Imbrenda
  0 siblings, 1 reply; 3+ messages in thread
From: Nico Boehr @ 2024-04-23 10:34 UTC (permalink / raw)
  To: frankja, imbrenda, thuth; +Cc: kvm, linux-s390

KVM did not properly reset the no-translate bit after reset, see
https://lore.kernel.org/kvm/20231109123624.37314-1-imbrenda@linux.ibm.com/

Add a test which performs a load normal reset (includes a subsystem
reset) and verify that this clears the no-translate bit.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 s390x/cmm.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/s390x/cmm.c b/s390x/cmm.c
index af852838851e..536f2bfc3c93 100644
--- a/s390x/cmm.c
+++ b/s390x/cmm.c
@@ -9,13 +9,17 @@
  */
 
 #include <libcflat.h>
+#include <bitops.h>
 #include <asm/asm-offsets.h>
 #include <asm/interrupt.h>
 #include <asm/page.h>
 #include <asm/cmm.h>
+#include <asm/facility.h>
 
 static uint8_t pagebuf[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE)));
 
+extern int diag308_load_reset(u64);
+
 static void test_params(void)
 {
 	report_prefix_push("invalid ORC 8");
@@ -35,6 +39,35 @@ static void test_priv(void)
 	report_prefix_pop();
 }
 
+static void test_reset_no_translate(void)
+{
+	const uint64_t mask_no_translate = BIT(63 - 58);
+	unsigned long state;
+
+	if (!test_facility(147)) {
+		report_prefix_push("no-translate unavailable");
+		expect_pgm_int();
+		essa(ESSA_SET_STABLE_NODAT, (unsigned long)pagebuf);
+		check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
+		report_prefix_pop();
+		return;
+	}
+
+	report_prefix_push("reset no-translate");
+	essa(ESSA_SET_STABLE_NODAT, (unsigned long)pagebuf);
+
+	state = essa(ESSA_GET_STATE, (unsigned long)pagebuf);
+	report(state & mask_no_translate, "no-translate bit set before reset");
+
+	/* Load normal reset - includes subsystem reset */
+	diag308_load_reset(1);
+
+	state = essa(ESSA_GET_STATE, (unsigned long)pagebuf);
+	report(!(state & mask_no_translate), "no-translate bit unset after reset");
+
+	report_prefix_pop();
+}
+
 int main(void)
 {
 	bool has_essa = check_essa_available();
@@ -47,6 +80,7 @@ int main(void)
 
 	test_priv();
 	test_params();
+	test_reset_no_translate();
 done:
 	report_prefix_pop();
 	return report_summary();
-- 
2.41.0


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

* Re: [kvm-unit-tests PATCH v3 1/1] s390x: cmm: test no-translate bit after reset
  2024-04-23 10:34 ` [kvm-unit-tests PATCH v3 1/1] " Nico Boehr
@ 2024-04-23 12:57   ` Claudio Imbrenda
  0 siblings, 0 replies; 3+ messages in thread
From: Claudio Imbrenda @ 2024-04-23 12:57 UTC (permalink / raw)
  To: Nico Boehr; +Cc: frankja, thuth, kvm, linux-s390

On Tue, 23 Apr 2024 12:34:59 +0200
Nico Boehr <nrb@linux.ibm.com> wrote:

> KVM did not properly reset the no-translate bit after reset, see
> https://lore.kernel.org/kvm/20231109123624.37314-1-imbrenda@linux.ibm.com/
> 
> Add a test which performs a load normal reset (includes a subsystem
> reset) and verify that this clears the no-translate bit.
> 
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

> ---
>  s390x/cmm.c | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/s390x/cmm.c b/s390x/cmm.c
> index af852838851e..536f2bfc3c93 100644
> --- a/s390x/cmm.c
> +++ b/s390x/cmm.c
> @@ -9,13 +9,17 @@
>   */
>  
>  #include <libcflat.h>
> +#include <bitops.h>
>  #include <asm/asm-offsets.h>
>  #include <asm/interrupt.h>
>  #include <asm/page.h>
>  #include <asm/cmm.h>
> +#include <asm/facility.h>
>  
>  static uint8_t pagebuf[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE)));
>  
> +extern int diag308_load_reset(u64);
> +
>  static void test_params(void)
>  {
>  	report_prefix_push("invalid ORC 8");
> @@ -35,6 +39,35 @@ static void test_priv(void)
>  	report_prefix_pop();
>  }
>  
> +static void test_reset_no_translate(void)
> +{
> +	const uint64_t mask_no_translate = BIT(63 - 58);
> +	unsigned long state;
> +
> +	if (!test_facility(147)) {
> +		report_prefix_push("no-translate unavailable");
> +		expect_pgm_int();
> +		essa(ESSA_SET_STABLE_NODAT, (unsigned long)pagebuf);
> +		check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
> +		report_prefix_pop();
> +		return;
> +	}
> +
> +	report_prefix_push("reset no-translate");
> +	essa(ESSA_SET_STABLE_NODAT, (unsigned long)pagebuf);
> +
> +	state = essa(ESSA_GET_STATE, (unsigned long)pagebuf);
> +	report(state & mask_no_translate, "no-translate bit set before reset");
> +
> +	/* Load normal reset - includes subsystem reset */
> +	diag308_load_reset(1);
> +
> +	state = essa(ESSA_GET_STATE, (unsigned long)pagebuf);
> +	report(!(state & mask_no_translate), "no-translate bit unset after reset");
> +
> +	report_prefix_pop();
> +}
> +
>  int main(void)
>  {
>  	bool has_essa = check_essa_available();
> @@ -47,6 +80,7 @@ int main(void)
>  
>  	test_priv();
>  	test_params();
> +	test_reset_no_translate();
>  done:
>  	report_prefix_pop();
>  	return report_summary();


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

end of thread, other threads:[~2024-04-23 12:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-23 10:34 [kvm-unit-tests PATCH v3 0/1] s390x: cmm: test no-translate bit after reset Nico Boehr
2024-04-23 10:34 ` [kvm-unit-tests PATCH v3 1/1] " Nico Boehr
2024-04-23 12:57   ` Claudio Imbrenda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox