[PATCH v2] cpu_s390: Implement getVendorForModel for IBM Z
Jiri Denemark
jdenemar at redhat.com
Fri Nov 25 10:23:51 UTC 2022
On Fri, Nov 25, 2022 at 10:36:22 +0100, Thomas Huth wrote:
> When running "virsh domcapabilities" on a s390x host, all the CPU
> models show up with vendor='unknown' - which sounds kind of weird
> since the vendor of these mainframe CPUs is well known: IBM.
> All CPUs starting with either "z" or "gen" match a real mainframe
> CPU by IBM, so let's return the string "IBM" for those now.
> The only remaining ones are now the artifical "qemu" and "max"
> models from QEMU itself, so it should be OK to get an "unknown"
> vendor for those two.
>
> Thanks to Boris Fiuczynski for helping with the domaincapsdata!
>
> Reviewed-by: Boris Fiuczynski <fiuczy at linux.ibm.com>
> Signed-off-by: Thomas Huth <thuth at redhat.com>
> ---
> src/cpu/cpu_s390.c | 11 ++
> tests/domaincapsdata/qemu_4.2.0.s390x.xml | 144 +++++++++++-----------
> tests/domaincapsdata/qemu_5.2.0.s390x.xml | 144 +++++++++++-----------
> tests/domaincapsdata/qemu_6.0.0.s390x.xml | 144 +++++++++++-----------
> 4 files changed, 227 insertions(+), 216 deletions(-)
>
> diff --git a/src/cpu/cpu_s390.c b/src/cpu/cpu_s390.c
> index d908a83928..7416ec6dc5 100644
> --- a/src/cpu/cpu_s390.c
> +++ b/src/cpu/cpu_s390.c
> @@ -109,6 +109,16 @@ virCPUs390ValidateFeatures(virCPUDef *cpu)
> }
>
>
> +static const char *
> +virCPUs390GetVendorForModel(const char *modelName)
> +{
> + if (modelName[0] == 'z' || STREQLEN(modelName, "gen", 3))
> + return "IBM";
We have a STRPREFIX helper which might be useful especially for the
second part of the condition, but it won't hurt in the first part
either:
if (STRPREFIX(modelName, "z") || STRPREFIX(modelName, "gen"))
return "IBM";
> +
> + return NULL;
> +}
Reviewed-by: Jiri Denemark <jdenemar at redhat.com>
More information about the libvir-list
mailing list