From a38ad6f68740a8a7980dcef050e5e3fef2437af5 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Fri, 25 Nov 2022 11:52:55 +0100 Subject: [PATCH] cpu_s390: Implement getVendorForModel for IBM Z 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. Reviewed-by: Jiri Denemark Signed-off-by: Boris Fiuczynski Signed-off-by: Thomas Huth Reviewed-by: Michal Privoznik --- 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..81a1513ecb 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 (STRPREFIX(modelName, "z") || STRPREFIX(modelName, "gen")) + return "IBM"; + + return NULL; +} + + struct cpuArchDriver cpuDriverS390 = { .name = "s390", .arch = archs, @@ -119,4 +129,5 @@ struct cpuArchDriver cpuDriverS390 = { .baseline = NULL, .update = virCPUs390Update, .validateFeatures = virCPUs390ValidateFeatures, + .getVendorForModel = virCPUs390GetVendorForModel, }; diff --git a/tests/domaincapsdata/qemu_4.2.0.s390x.xml b/tests/domaincapsdata/qemu_4.2.0.s390x.xml index a4f075412a..81395f43bf 100644 --- a/tests/domaincapsdata/qemu_4.2.0.s390x.xml +++ b/tests/domaincapsdata/qemu_4.2.0.s390x.xml @@ -83,79 +83,79 @@ - z800-base - z890.2-base - z9EC.2 - z13.2 - z9BC-base - z990.5-base - z890.2 - z890 - z9BC - z13 - z196 - z13s - z990.3 - z13s-base - z9EC - gen15a - z14ZR1-base - z14.2-base - z900.3-base - z13.2-base - z196.2-base - zBC12-base - z9BC.2-base - z900.2-base - z9EC.3 - zEC12 - z900 - z114-base - zEC12-base - z10EC.2 - z10EC-base - z900.3 - z14ZR1 - z10BC - z10BC.2-base - z990.2 - z9BC.2 - z990 - z14 - gen15b-base - z990.4 + z800-base + z890.2-base + z9EC.2 + z13.2 + z9BC-base + z990.5-base + z890.2 + z890 + z9BC + z13 + z196 + z13s + z990.3 + z13s-base + z9EC + gen15a + z14ZR1-base + z14.2-base + z900.3-base + z13.2-base + z196.2-base + zBC12-base + z9BC.2-base + z900.2-base + z9EC.3 + zEC12 + z900 + z114-base + zEC12-base + z10EC.2 + z10EC-base + z900.3 + z14ZR1 + z10BC + z10BC.2-base + z990.2 + z9BC.2 + z990 + z14 + gen15b-base + z990.4 max - z10EC.2-base - gen15a-base - z800 - zEC12.2 - z10EC - z990.2-base - z900-base - z10BC.2 - z9EC-base - z9EC.3-base - z114 - z890.3 - z196-base - z9EC.2-base - z196.2 - z14.2 - z990-base - z900.2 - z890-base - z10EC.3 - z14-base - z990.4-base - z10EC.3-base - z10BC-base - z13-base - z990.3-base - zEC12.2-base - zBC12 - z890.3-base - z990.5 - gen15b + z10EC.2-base + gen15a-base + z800 + zEC12.2 + z10EC + z990.2-base + z900-base + z10BC.2 + z9EC-base + z9EC.3-base + z114 + z890.3 + z196-base + z9EC.2-base + z196.2 + z14.2 + z990-base + z900.2 + z890-base + z10EC.3 + z14-base + z990.4-base + z10EC.3-base + z10BC-base + z13-base + z990.3-base + zEC12.2-base + zBC12 + z890.3-base + z990.5 + gen15b qemu diff --git a/tests/domaincapsdata/qemu_5.2.0.s390x.xml b/tests/domaincapsdata/qemu_5.2.0.s390x.xml index 4ff99ebd64..1e615dab7c 100644 --- a/tests/domaincapsdata/qemu_5.2.0.s390x.xml +++ b/tests/domaincapsdata/qemu_5.2.0.s390x.xml @@ -85,79 +85,79 @@ - z800-base - z890.2-base - z9EC.2 - z13.2 - z990.5-base - z9BC-base - z890.2 - z890 - z9BC - z13 - z196 - z13s - z990.3 - z13s-base - z9EC - gen15a - z14ZR1-base - z14.2-base - z900.3-base - z13.2-base - z196.2-base - zBC12-base - z9BC.2-base - z900.2-base - z9EC.3 - zEC12 - z900 - z114-base - zEC12-base - z10EC.2 - z10EC-base - z900.3 - z14ZR1 - z10BC - z10BC.2-base - z9BC.2 - z990 - z990.2 - z14 - gen15b-base - z990.4 + z800-base + z890.2-base + z9EC.2 + z13.2 + z990.5-base + z9BC-base + z890.2 + z890 + z9BC + z13 + z196 + z13s + z990.3 + z13s-base + z9EC + gen15a + z14ZR1-base + z14.2-base + z900.3-base + z13.2-base + z196.2-base + zBC12-base + z9BC.2-base + z900.2-base + z9EC.3 + zEC12 + z900 + z114-base + zEC12-base + z10EC.2 + z10EC-base + z900.3 + z14ZR1 + z10BC + z10BC.2-base + z9BC.2 + z990 + z990.2 + z14 + gen15b-base + z990.4 max - z990.2-base - z10EC.2-base - gen15a-base - z800 - z10EC - zEC12.2 - z900-base - z10BC.2 - z9EC-base - z9EC.3-base - z114 - z890.3 - z196-base - z9EC.2-base - z196.2 - z14.2 - z990-base - z900.2 - z10EC.3 - z890-base - z14-base - z990.4-base - z10EC.3-base - z10BC-base - z13-base - z990.3-base - zEC12.2-base - zBC12 - z890.3-base - z990.5 - gen15b + z990.2-base + z10EC.2-base + gen15a-base + z800 + z10EC + zEC12.2 + z900-base + z10BC.2 + z9EC-base + z9EC.3-base + z114 + z890.3 + z196-base + z9EC.2-base + z196.2 + z14.2 + z990-base + z900.2 + z10EC.3 + z890-base + z14-base + z990.4-base + z10EC.3-base + z10BC-base + z13-base + z990.3-base + zEC12.2-base + zBC12 + z890.3-base + z990.5 + gen15b qemu diff --git a/tests/domaincapsdata/qemu_6.0.0.s390x.xml b/tests/domaincapsdata/qemu_6.0.0.s390x.xml index d404db316b..f3287347aa 100644 --- a/tests/domaincapsdata/qemu_6.0.0.s390x.xml +++ b/tests/domaincapsdata/qemu_6.0.0.s390x.xml @@ -86,79 +86,79 @@ - z800-base - z890.2-base - z9EC.2 - z13.2 - z990.5-base - z9BC-base - z890.2 - z890 - z9BC - z13 - z196 - z13s - z990.3 - z13s-base - z9EC - gen15a - z14ZR1-base - z14.2-base - z900.3-base - z13.2-base - z196.2-base - zBC12-base - z9BC.2-base - z900.2-base - z9EC.3 - zEC12 - z900 - z114-base - zEC12-base - z10EC.2 - z10EC-base - z900.3 - z14ZR1 - z10BC - z10BC.2-base - z9BC.2 - z990 - z990.2 - z14 - gen15b-base - z990.4 + z800-base + z890.2-base + z9EC.2 + z13.2 + z990.5-base + z9BC-base + z890.2 + z890 + z9BC + z13 + z196 + z13s + z990.3 + z13s-base + z9EC + gen15a + z14ZR1-base + z14.2-base + z900.3-base + z13.2-base + z196.2-base + zBC12-base + z9BC.2-base + z900.2-base + z9EC.3 + zEC12 + z900 + z114-base + zEC12-base + z10EC.2 + z10EC-base + z900.3 + z14ZR1 + z10BC + z10BC.2-base + z9BC.2 + z990 + z990.2 + z14 + gen15b-base + z990.4 max - z10EC.2-base - gen15a-base - z800 - z10EC - zEC12.2 - z990.2-base - z900-base - z10BC.2 - z9EC-base - z9EC.3-base - z114 - z890.3 - z196-base - z9EC.2-base - z196.2 - z14.2 - z990-base - z900.2 - z890-base - z10EC.3 - z14-base - z990.4-base - z10EC.3-base - z10BC-base - z13-base - z990.3-base - zEC12.2-base - zBC12 - z890.3-base - z990.5 - gen15b + z10EC.2-base + gen15a-base + z800 + z10EC + zEC12.2 + z990.2-base + z900-base + z10BC.2 + z9EC-base + z9EC.3-base + z114 + z890.3 + z196-base + z9EC.2-base + z196.2 + z14.2 + z990-base + z900.2 + z890-base + z10EC.3 + z14-base + z990.4-base + z10EC.3-base + z10BC-base + z13-base + z990.3-base + zEC12.2-base + zBC12 + z890.3-base + z990.5 + gen15b qemu