]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: S390 does not provide physical address size
authorBoris Fiuczynski <fiuczy@linux.ibm.com>
Fri, 14 Jul 2023 14:38:14 +0000 (16:38 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 19 Jul 2023 06:42:08 +0000 (08:42 +0200)
Commit be1b7d5b18 introduced parsing /proc/cpuinfo for "address size"
which is not including on S390 and therefore reports an internal error.
Lets remove the parsing on S390.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/cpu/cpu_x86.c
src/qemu/qemu_capabilities.c
src/util/virhostcpu.c
src/util/virhostcpu.h
tests/domaincapsdata/qemu_4.2.0.s390x.xml
tests/domaincapsdata/qemu_5.2.0.s390x.xml
tests/domaincapsdata/qemu_6.0.0.s390x.xml
tests/domaincapsdata/qemu_8.1.0.s390x.xml
tests/domaincapsmock.c

index 8d371d5501847c46316bd1af75d22219edf5e7db..3c0163c4d14bdb5773d3030781d6cba256444e3c 100644 (file)
@@ -2795,7 +2795,7 @@ virCPUx86GetHost(virCPUDef *cpu,
         VIR_DEBUG("Host CPU does not support invariant TSC");
     }
 
-    if (virHostCPUGetPhysAddrSize(&addrsz) == 0) {
+    if (virHostCPUGetPhysAddrSize(cpuData->arch, &addrsz) == 0) {
         virCPUMaxPhysAddrDef *addr = g_new0(virCPUMaxPhysAddrDef, 1);
 
         addr->bits = addrsz;
index 338608f0a272e58a04b3a70f4ea7c18f81babd04..85ea879f0ba3f2b22b9e9931f1ab5577150b721d 100644 (file)
@@ -3911,7 +3911,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCaps *qemuCaps,
     }
 
     if (virQEMUCapsTypeIsAccelerated(type))
-        virHostCPUGetPhysAddrSize(&physAddrSize);
+        virHostCPUGetPhysAddrSize(hostArch, &physAddrSize);
 
     virQEMUCapsSetHostModel(qemuCaps, type, physAddrSize, cpu, migCPU, fullCPU);
 
index 19195a1470219dba349394dd5854276548180bff..a15731e9ea189b89d733942b4fd0b7622dc89afb 100644 (file)
@@ -1646,10 +1646,17 @@ virHostCPUGetSignature(char **signature)
 }
 
 int
-virHostCPUGetPhysAddrSize(unsigned int *size)
+virHostCPUGetPhysAddrSize(const virArch hostArch,
+                          unsigned int *size)
 {
     g_autoptr(FILE) cpuinfo = NULL;
 
+    if (ARCH_IS_S390(hostArch)) {
+        /* Ensure size is set to 0 as physical address size is unknown */
+        *size = 0;
+        return 0;
+    }
+
     if (!(cpuinfo = fopen(CPUINFO_PATH, "r"))) {
         virReportSystemError(errno, _("Failed to open cpuinfo file '%1$s'"),
                              CPUINFO_PATH);
@@ -1669,7 +1676,8 @@ virHostCPUGetSignature(char **signature)
 }
 
 int
-virHostCPUGetPhysAddrSize(unsigned int *size G_GNUC_UNUSED)
+virHostCPUGetPhysAddrSize(const virArch hostArch G_GNUC_UNUSED,
+                          unsigned int *size G_GNUC_UNUSED)
 {
     errno = ENOSYS;
     return -1;
index 5232fee36db4a122b004bef8b142c44aa4b59c81..5f0d43e069362973d4e22cbd920518bfb81a6359 100644 (file)
@@ -87,7 +87,8 @@ virHostCPUTscInfo *virHostCPUGetTscInfo(void);
 
 int virHostCPUGetSignature(char **signature);
 
-int virHostCPUGetPhysAddrSize(unsigned int *size);
+int virHostCPUGetPhysAddrSize(const virArch hostArch,
+                              unsigned int *size);
 
 int virHostCPUGetHaltPollTime(pid_t pid,
                               unsigned long long *haltPollSuccess,
index da271825f901050589a871824a0e0f0a77c884df..2566f42997ad47b8c40860c6ed50184a49c3aab3 100644 (file)
@@ -38,7 +38,6 @@
     </mode>
     <mode name='host-model' supported='yes'>
       <model fallback='forbid'>gen15a-base</model>
-      <maxphysaddr mode='passthrough' limit='64'/>
       <feature policy='require' name='aen'/>
       <feature policy='require' name='cmmnt'/>
       <feature policy='require' name='vxpdeh'/>
index 99faaad866202b8e72e6670ccce9e042cb562e11..12f38d363819542fdf0d1df4da224e6802b7fa3a 100644 (file)
@@ -38,7 +38,6 @@
     </mode>
     <mode name='host-model' supported='yes'>
       <model fallback='forbid'>gen15a-base</model>
-      <maxphysaddr mode='passthrough' limit='64'/>
       <feature policy='require' name='aen'/>
       <feature policy='require' name='cmmnt'/>
       <feature policy='require' name='vxpdeh'/>
index df3708f80195689770bd354289f2e6dc571722d7..703f729ae27b3512c309e70972508653d65456d3 100644 (file)
@@ -38,7 +38,6 @@
     </mode>
     <mode name='host-model' supported='yes'>
       <model fallback='forbid'>gen15a-base</model>
-      <maxphysaddr mode='passthrough' limit='64'/>
       <feature policy='require' name='aen'/>
       <feature policy='require' name='cmmnt'/>
       <feature policy='require' name='vxpdeh'/>
index d70b63950359e269227bb766f5e8175294bed344..3562e969651fca0cecb6227898efac147872a0d7 100644 (file)
@@ -38,7 +38,6 @@
     </mode>
     <mode name='host-model' supported='yes'>
       <model fallback='forbid'>gen16a-base</model>
-      <maxphysaddr mode='passthrough' limit='64'/>
       <feature policy='require' name='nnpa'/>
       <feature policy='require' name='aen'/>
       <feature policy='require' name='cmmnt'/>
index cecb333602b031badd91346115e00749eecf150b..6ae0c4ad45aa20530068a6fbf6153b8ea525e5d8 100644 (file)
@@ -37,9 +37,13 @@ virHostCPUGetMicrocodeVersion(virArch hostArch G_GNUC_UNUSED)
 }
 
 int
-virHostCPUGetPhysAddrSize(unsigned int *size)
+virHostCPUGetPhysAddrSize(const virArch hostArch,
+                          unsigned int *size)
 {
-    *size = 64;
+    if (ARCH_IS_S390(hostArch))
+        *size = 0;
+    else
+        *size = 64;
     return 0;
 }