qemu: S390 does not provide physical address size

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>
This commit is contained in:
Boris Fiuczynski 2023-07-14 16:38:14 +02:00 committed by Michal Privoznik
parent aece25f665
commit 8417c1394c
9 changed files with 20 additions and 11 deletions

View 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;

View File

@ -3911,7 +3911,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCaps *qemuCaps,
}
if (virQEMUCapsTypeIsAccelerated(type))
virHostCPUGetPhysAddrSize(&physAddrSize);
virHostCPUGetPhysAddrSize(hostArch, &physAddrSize);
virQEMUCapsSetHostModel(qemuCaps, type, physAddrSize, cpu, migCPU, fullCPU);

View 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;

View 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,

View 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'/>

View 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'/>

View 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'/>

View 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'/>

View File

@ -37,8 +37,12 @@ virHostCPUGetMicrocodeVersion(virArch hostArch G_GNUC_UNUSED)
}
int
virHostCPUGetPhysAddrSize(unsigned int *size)
virHostCPUGetPhysAddrSize(const virArch hostArch,
unsigned int *size)
{
if (ARCH_IS_S390(hostArch))
*size = 0;
else
*size = 64;
return 0;
}