public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: Nico Boehr <nrb@linux.ibm.com>
Cc: frankja@linux.ibm.com, thuth@redhat.com, kvm@vger.kernel.org,
	linux-s390@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH v1] s390x: cmm: test no-translate bit after reset
Date: Wed, 15 Nov 2023 11:07:17 +0100	[thread overview]
Message-ID: <20231115110717.7d0f29a9@p-imbrenda> (raw)
In-Reply-To: <20231115083848.17803-1-nrb@linux.ibm.com>

On Wed, 15 Nov 2023 09:38:32 +0100
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>
> ---
>  s390x/cmm.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/s390x/cmm.c b/s390x/cmm.c
> index af852838851e..8f10c107d81b 100644
> --- a/s390x/cmm.c
> +++ b/s390x/cmm.c
> @@ -9,6 +9,7 @@
>   */
>  
>  #include <libcflat.h>
> +#include <bitops.h>
>  #include <asm/asm-offsets.h>
>  #include <asm/interrupt.h>
>  #include <asm/page.h>
> @@ -16,6 +17,8 @@
>  
>  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 +38,26 @@ static void test_priv(void)
>  	report_prefix_pop();
>  }
>  
> +static void test_reset_no_translate(void)
> +{
> +	unsigned long state;
> +	const uint64_t mask_no_translate = BIT(63 - 58);

reverse Christmas tree, please :)

also, maybe it's easier to read with just a numeric constant? i.e. 0x20 


with the Christmas tree fixed (with or without numeric constant):

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


> +
> +	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 +70,7 @@ int main(void)
>  
>  	test_priv();
>  	test_params();
> +	test_reset_no_translate();
>  done:
>  	report_prefix_pop();
>  	return report_summary();


      reply	other threads:[~2023-11-15 10:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15  8:38 [kvm-unit-tests PATCH v1] s390x: cmm: test no-translate bit after reset Nico Boehr
2023-11-15 10:07 ` Claudio Imbrenda [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231115110717.7d0f29a9@p-imbrenda \
    --to=imbrenda@linux.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox