On Tue, Apr 15, 2025 at 04:13:09 -0400, Narayana Murty N wrote:
> QEMU has historically used uppercase CPU model names like "POWER8",
> "POWER9", etc. However, starting with commit c5354f54aa60 ("ppc: make
> cpu_model translation to type consistent"), QEMU began using lowercase
> CPU model names (e.g., "power8") for newer POWER generations.
> 
> This shift in naming convention causes host-model compatibility checks
> to fail, as the logic in ppc64CheckCompatibilityMode was case-sensitive
> and expected only uppercase model names.
> 
> This patch adds support for "power11" as a valid host-model. Also
> updates the compatibility logic to treat host-model names case-insensitively,
> enabling recognition of both legacy uppercase and newer lowercase formats.
> To ensure compatibility checks work correctly across POWER CPU generations,
> avoiding false mismatches due to case differences.
> 
> Signed-off-by: Narayana Murty N <nnmli...@linux.ibm.com>
> ---
>  src/cpu/cpu_ppc64.c                           | 11 +++----
>  ...eries-cpu-compat-power11.ppc64-latest.args | 31 +++++++++++++++++++
>  ...series-cpu-compat-power11.ppc64-latest.err |  1 +
>  ...series-cpu-compat-power11.ppc64-latest.xml | 29 +++++++++++++++++
>  .../pseries-cpu-compat-power11.xml            | 19 ++++++++++++
>  tests/qemuxmlconftest.c                       |  4 +++
>  tests/testutilshostcpus.h                     | 11 +++++++
>  tests/testutilsqemu.c                         |  4 +++
>  tests/testutilsqemu.h                         |  1 +
>  9 files changed, 105 insertions(+), 6 deletions(-)
>  create mode 100644 
> tests/qemuxmlconfdata/pseries-cpu-compat-power11.ppc64-latest.args
>  create mode 100644 
> tests/qemuxmlconfdata/pseries-cpu-compat-power11.ppc64-latest.err
>  create mode 100644 
> tests/qemuxmlconfdata/pseries-cpu-compat-power11.ppc64-latest.xml
>  create mode 100644 tests/qemuxmlconfdata/pseries-cpu-compat-power11.xml
> 
> diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
> index 13f5fc9c2c..d1b9c52287 100644
> --- a/src/cpu/cpu_ppc64.c
> +++ b/src/cpu/cpu_ppc64.c
> @@ -93,22 +93,21 @@ ppc64CheckCompatibilityMode(const char *host_model,
>      if (!compat_mode)
>          return VIR_CPU_COMPARE_IDENTICAL;
>  
> -    /* Valid host CPUs: POWER6, POWER7, POWER8, POWER9, POWER10 */
> -    if (!STRPREFIX(host_model, "POWER") ||
> +    /* Valid host CPUs: POWER6, POWER7, POWER8, POWER9, POWER10, power11 */
> +    if (!STRCASEPREFIX(host_model, "POWER") ||
>          !(tmp = (char *) host_model + strlen("POWER")) ||
>          virStrToLong_i(tmp, NULL, 10, &host) < 0 ||
> -        host < 6 || host > 10) {
> +        host < 6 || host > 11) {
>          virReportError(VIR_ERR_INTERNAL_ERROR,
>                         "%s",
>                         _("Host CPU does not support compatibility modes"));
>          return VIR_CPU_COMPARE_ERROR;
>      }

I'm unfamiliar with this code thus uncomfortable with giving my R-b for
the change to STRCASEPREFIX.

> -
> -    /* Valid compatibility modes: power6, power7, power8, power9, power10 */
> +    /* Valid compatibility modes: power6, power7, power8, power9, power10, 
> power11 */
>      if (!STRPREFIX(compat_mode, "power") ||
>          !(tmp = (char *) compat_mode + strlen("power")) ||
>          virStrToLong_i(tmp, NULL, 10, &compat) < 0 ||
> -        compat < 6 || compat > 10) {
> +        compat < 6 || compat > 11) {
>          virReportError(VIR_ERR_INTERNAL_ERROR,
>                         _("Unknown compatibility mode %1$s"),
>                         compat_mode);

The rest looks sane

Reply via email to