diff mbox series

[PULL,08/67] target/ppc: Fix HFSCR facility checks

Message ID 20241104001900.682660-9-npiggin@gmail.com (mailing list archive)
State New
Headers show
Series [PULL,01/67] target/ppc: Set ctx->opcode for decode_insn32() | expand

Commit Message

Nicholas Piggin Nov. 4, 2024, 12:17 a.m. UTC
The HFSCR defines were being encoded as bit masks, but the users
expect (and analogous FSCR defines are) bit numbers.

Cc: qemu-stable@nongnu.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 target/ppc/cpu.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Tokarev Nov. 5, 2024, 3:50 p.m. UTC | #1
04.11.2024 03:17, Nicholas Piggin wrote:
> The HFSCR defines were being encoded as bit masks, but the users
> expect (and analogous FSCR defines are) bit numbers.
> 
> Cc: qemu-stable@nongnu.org
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>   target/ppc/cpu.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> index bd32a1a5f8..f7a2da2bbe 100644
> --- a/target/ppc/cpu.h
> +++ b/target/ppc/cpu.h
> @@ -635,8 +635,8 @@ FIELD(MSR, LE, MSR_LE, 1)
>   #define PSSCR_EC          PPC_BIT(43) /* Exit Criterion */
>   
>   /* HFSCR bits */
> -#define HFSCR_MSGP     PPC_BIT(53) /* Privileged Message Send Facilities */
> -#define HFSCR_BHRB     PPC_BIT(59) /* BHRB Instructions */
> +#define HFSCR_MSGP     PPC_BIT_NR(53) /* Privileged Message Send Facilities */
> +#define HFSCR_BHRB     PPC_BIT_NR(59) /* BHRB Instructions */

v9.0.0-892-g6bfcf1dc23 "target/ppc: Add clrbhrb and mfbhrbe instructions"
(ie v9.1.0 release) added the HFSCR_BHRB definition here.  While HFSCR_MSGP
has been there for a very long time, since v4.2.0-1172-g493028d8d7 (2020).
Does it make sense to pick this change to older stable series (9.0 and before)
keeping just the HFSCR_MSGP fix?

How happened this hasn't been noticed for so long time?  Is it enough
reason to not bother with older releases?

Thanks,

/mjt
Nicholas Piggin Nov. 8, 2024, 2:34 a.m. UTC | #2
On Wed Nov 6, 2024 at 1:50 AM AEST, Michael Tokarev wrote:
> 04.11.2024 03:17, Nicholas Piggin wrote:
> > The HFSCR defines were being encoded as bit masks, but the users
> > expect (and analogous FSCR defines are) bit numbers.
> > 
> > Cc: qemu-stable@nongnu.org
> > Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> >   target/ppc/cpu.h | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> > index bd32a1a5f8..f7a2da2bbe 100644
> > --- a/target/ppc/cpu.h
> > +++ b/target/ppc/cpu.h
> > @@ -635,8 +635,8 @@ FIELD(MSR, LE, MSR_LE, 1)
> >   #define PSSCR_EC          PPC_BIT(43) /* Exit Criterion */
> >   
> >   /* HFSCR bits */
> > -#define HFSCR_MSGP     PPC_BIT(53) /* Privileged Message Send Facilities */
> > -#define HFSCR_BHRB     PPC_BIT(59) /* BHRB Instructions */
> > +#define HFSCR_MSGP     PPC_BIT_NR(53) /* Privileged Message Send Facilities */
> > +#define HFSCR_BHRB     PPC_BIT_NR(59) /* BHRB Instructions */
>
> v9.0.0-892-g6bfcf1dc23 "target/ppc: Add clrbhrb and mfbhrbe instructions"
> (ie v9.1.0 release) added the HFSCR_BHRB definition here.  While HFSCR_MSGP
> has been there for a very long time, since v4.2.0-1172-g493028d8d7 (2020).
> Does it make sense to pick this change to older stable series (9.0 and before)
> keeping just the HFSCR_MSGP fix?
>
> How happened this hasn't been noticed for so long time?  Is it enough
> reason to not bother with older releases?

Mainly because KVM doesn't use the feature. PowerVM does, which is where
we caught it recently. I'd probably not bother further backporting.

Thanks,
Nick
diff mbox series

Patch

diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index bd32a1a5f8..f7a2da2bbe 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -635,8 +635,8 @@  FIELD(MSR, LE, MSR_LE, 1)
 #define PSSCR_EC          PPC_BIT(43) /* Exit Criterion */
 
 /* HFSCR bits */
-#define HFSCR_MSGP     PPC_BIT(53) /* Privileged Message Send Facilities */
-#define HFSCR_BHRB     PPC_BIT(59) /* BHRB Instructions */
+#define HFSCR_MSGP     PPC_BIT_NR(53) /* Privileged Message Send Facilities */
+#define HFSCR_BHRB     PPC_BIT_NR(59) /* BHRB Instructions */
 #define HFSCR_IC_MSGP  0xA
 
 #define DBCR0_ICMP (1 << 27)