qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>,
	qemu-devel@nongnu.org,
	Richard Henderson <richard.henderson@linaro.org>,
	David Hildenbrand <david@redhat.com>
Cc: qemu-s390x@nongnu.org, Ilya Leoshkevich <iii@linux.ibm.com>
Subject: Re: [PATCH for-8.0] target/s390x/tcg/mem_helper: Test the right bits in psw_key_valid()
Date: Mon, 05 Dec 2022 16:59:46 +0100	[thread overview]
Message-ID: <ed02c91839064052f8c52cc7a66279380eb91e71.camel@linux.ibm.com> (raw)
In-Reply-To: <20221205142043.95185-1-thuth@redhat.com>

On Mon, 2022-12-05 at 15:20 +0100, Thomas Huth wrote:
> The PSW key mask is a 16 bit field, and the psw_key variable is
> in the range from 0 to 15, so it does not make sense to use
> "0x80 >> psw_key" for testing the bits here. We should use 0x8000
> instead.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>

> ---
>  Found by code inspection (Linux likely does not use these PSW key masks
>  yet, otherwise we might have noticed earlier)
> 
>  target/s390x/tcg/mem_helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c
> index 9542fad59b..cb82cd1c1d 100644
> --- a/target/s390x/tcg/mem_helper.c
> +++ b/target/s390x/tcg/mem_helper.c
> @@ -51,7 +51,7 @@ static inline bool psw_key_valid(CPUS390XState *env, uint8_t psw_key)
>  
>      if (env->psw.mask & PSW_MASK_PSTATE) {
>          /* PSW key has range 0..15, it is valid if the bit is 1 in the PKM */
> -        return pkm & (0x80 >> psw_key);
> +        return pkm & (0x8000 >> psw_key);
>      }
>      return true;
>  }



      parent reply	other threads:[~2022-12-05 18:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05 14:20 [PATCH for-8.0] target/s390x/tcg/mem_helper: Test the right bits in psw_key_valid() Thomas Huth
2022-12-05 14:31 ` David Hildenbrand
2022-12-05 15:59 ` Nina Schoetterl-Glausch [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=ed02c91839064052f8c52cc7a66279380eb91e71.camel@linux.ibm.com \
    --to=nsg@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=iii@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --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;
as well as URLs for NNTP newsgroup(s).