qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Nicholas Piggin" <npiggin@gmail.com>
To: "Aditya Gupta" <adityag@linux.ibm.com>,
	"Mahesh J Salgaonkar" <mahesh@linux.ibm.com>,
	"Madhavan Srinivasan" <maddy@linux.ibm.com>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>
Cc: <qemu-devel@nongnu.org>, <qemu-ppc@nongnu.org>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>
Subject: Re: [PATCH v5 5/5] target/ppc: Fix regression due to Power10 and Power11 having same PCR
Date: Tue, 23 Jul 2024 14:58:57 +1000	[thread overview]
Message-ID: <D2WNIPIYCNGA.2WYVT9ZXPW78Y@gmail.com> (raw)
In-Reply-To: <20240606121657.254308-6-adityag@linux.ibm.com>

On Thu Jun 6, 2024 at 10:16 PM AEST, Aditya Gupta wrote:
> Power11 has the same PCR (Processor Compatibility Register) value, as
> Power10.
>
> Due to this, QEMU considers Power11 as a valid compat-mode for Power10,
> ie. earlier it was possible to run QEMU with '-M pseries,max-compat-mode=power11 --cpu power10'

Isn't this expected to work, or no?

>
> Same PCR also introduced a regression where `-M pseries --cpu power10`
> boots as Power11 (ie. logical PVR is of Power11, even though PVR is Power10).
> The regression was due to 'do_client_architecture_support' checking for
> valid compat modes and finding Power11 to be a valid compat mode for
> Power10 (it happens even without passing 'max-compat-mode' explicitly).
>
> Fix compat-mode issue and regression, by ensuring a future Power
> processor (with a higher logical_pvr value, eg. P11) cannot be valid
> compat-mode for an older Power processor (eg. P10)

This should be done before introducing the Power11 CPU so there's no
regression inside the series.

>
> Cc: Cédric Le Goater <clg@kaod.org>
> Cc: Daniel Henrique Barboza <danielhb413@gmail.com>
> Cc: Harsh Prateek Bora <harshpb@linux.ibm.com>
> Cc: Mahesh J Salgaonkar <mahesh@linux.ibm.com>
> Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Signed-off-by: Aditya Gupta <adityag@linux.ibm.com>
> ---
>  target/ppc/compat.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/target/ppc/compat.c b/target/ppc/compat.c
> index 12dd8ae290ca..168a3c06316f 100644
> --- a/target/ppc/compat.c
> +++ b/target/ppc/compat.c
> @@ -139,6 +139,10 @@ static bool pcc_compat(PowerPCCPUClass *pcc, uint32_t compat_pvr,
>          /* Outside specified range */
>          return false;
>      }
> +    if (compat->pvr > pcc->logical_pvr) {
> +        /* Older CPU cannot support a newer processor's compat mode */
> +        return false;
> +    }

Hmm. I suppose this is the right way to fix it.

Reviewed-by: Nicholas Piggin <npiggin@gmail.com>

>      if (!(pcc->pcr_supported & compat->pcr_level)) {
>          /* Not supported by this CPU */
>          return false;



  reply	other threads:[~2024-07-23  4:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-06 12:16 [PATCH v5 0/5] Power11 support for QEMU [PSeries] Aditya Gupta
2024-06-06 12:16 ` [PATCH v5 1/5] target/ppc: reduce code duplication across Power9/10 init code Aditya Gupta
2024-07-23  4:21   ` Nicholas Piggin
2024-07-23  5:02     ` Aditya Gupta
2024-07-23  5:22   ` Nicholas Piggin
2024-07-23 15:13     ` Aditya Gupta
2024-07-24  4:16       ` Harsh Prateek Bora
2024-07-24  6:31     ` Aditya Gupta
2024-07-24  6:50     ` Aditya Gupta
2024-07-24 12:04       ` BALATON Zoltan
2024-06-06 12:16 ` [PATCH v5 2/5] target/ppc: Add Power11 DD2.0 processor Aditya Gupta
2024-07-23  4:30   ` Nicholas Piggin
2024-07-23  5:01     ` Aditya Gupta
2024-07-23  5:27   ` Nicholas Piggin
2024-06-06 12:16 ` [PATCH v5 3/5] ppc/pseries: Add Power11 cpu type Aditya Gupta
2024-07-23  4:34   ` Nicholas Piggin
2024-06-06 12:16 ` [PATCH v5 4/5] target/ppc: Introduce 'PowerPCCPUClass::logical_pvr' Aditya Gupta
2024-07-23  5:13   ` Nicholas Piggin
2024-07-23  5:42     ` Aditya Gupta
2024-06-06 12:16 ` [PATCH v5 5/5] target/ppc: Fix regression due to Power10 and Power11 having same PCR Aditya Gupta
2024-07-23  4:58   ` Nicholas Piggin [this message]
2024-07-23  5:08     ` Aditya Gupta
2024-06-06 12:22 ` [PATCH v5 0/5] Power11 support for QEMU [PSeries] Aditya Gupta
2024-07-22  9:12 ` Aditya Gupta

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=D2WNIPIYCNGA.2WYVT9ZXPW78Y@gmail.com \
    --to=npiggin@gmail.com \
    --cc=adityag@linux.ibm.com \
    --cc=clg@kaod.org \
    --cc=danielhb413@gmail.com \
    --cc=harshpb@linux.ibm.com \
    --cc=maddy@linux.ibm.com \
    --cc=mahesh@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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).