mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-25 22:15:20 +00:00
Ensure 'arch' is always set in cpuArchNodeData
The s390, ppc and arm CPU drivers never set the 'arch' field in their impl of cpuArchNodeData. This leads to error messages being reported from cpuDataFree later, due to trying to use VIR_ARCH_NONE. #0 virRaiseErrorFull (filename=filename@entry=0x76f94434 "cpu/cpu.c", funcname=funcname@entry=0x76f942dc <__FUNCTION__.18096> "cpuGetSubDriver", linenr=linenr@entry=58, domain=domain@entry=31, code=code@entry=1, level=level@entry=VIR_ERR_ERROR, str1=0x76f70e18 "internal error: %s", str2=str2@entry=0x7155f2ec "undefined hardware architecture", str3=str3@entry=0x0, int1=int1@entry=-1, int2=int2@entry=-1, fmt=0x76f70e18 "internal error: %s") at util/virerror.c:646 #1 0x76e682ea in virReportErrorHelper (domcode=domcode@entry=31, errorcode=errorcode@entry=1, filename=0x76f94434 "cpu/cpu.c", funcname=0x76f942dc <__FUNCTION__.18096> "cpuGetSubDriver", linenr=linenr@entry=58, fmt=0x76f7e7e4 "%s") at util/virerror.c:1292 #2 0x76ed82d4 in cpuGetSubDriver (arch=<optimized out>) at cpu/cpu.c:57 #3 cpuGetSubDriver (arch=VIR_ARCH_NONE) at cpu/cpu.c:51 #4 0x76ed8818 in cpuDataFree (data=data@entry=0x70c22d78) at cpu/cpu.c:216 #5 0x716aaec0 in virQEMUCapsInitCPU (arch=VIR_ARCH_ARMV7L, caps=0x70c29a08) at qemu/qemu_capabilities.c:867 Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
bbcdd9b5dc
commit
66ec11ade4
@ -244,7 +244,7 @@ cpuNodeData(virArch arch)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return driver->nodeData();
|
return driver->nodeData(arch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ typedef void
|
|||||||
(*cpuArchDataFree) (virCPUDataPtr data);
|
(*cpuArchDataFree) (virCPUDataPtr data);
|
||||||
|
|
||||||
typedef virCPUDataPtr
|
typedef virCPUDataPtr
|
||||||
(*cpuArchNodeData) (void);
|
(*cpuArchNodeData) (virArch arch);
|
||||||
|
|
||||||
typedef virCPUCompareResult
|
typedef virCPUCompareResult
|
||||||
(*cpuArchGuestData) (virCPUDefPtr host,
|
(*cpuArchGuestData) (virCPUDefPtr host,
|
||||||
|
@ -31,11 +31,15 @@
|
|||||||
static const virArch archs[] = { VIR_ARCH_ARMV7L };
|
static const virArch archs[] = { VIR_ARCH_ARMV7L };
|
||||||
|
|
||||||
static virCPUDataPtr
|
static virCPUDataPtr
|
||||||
ArmNodeData(void)
|
ArmNodeData(virArch arch)
|
||||||
{
|
{
|
||||||
virCPUDataPtr data;
|
virCPUDataPtr data;
|
||||||
|
|
||||||
ignore_value(VIR_ALLOC(data));
|
if (VIR_ALLOC(data) < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
data->arch = arch;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,21 +353,23 @@ ppcDataFree(virCPUDataPtr data)
|
|||||||
VIR_FREE(data);
|
VIR_FREE(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__powerpc__) || defined(__powerpc64__)
|
|
||||||
static virCPUDataPtr
|
static virCPUDataPtr
|
||||||
ppcNodeData(void)
|
ppcNodeData(virArch arch)
|
||||||
{
|
{
|
||||||
virCPUDataPtr cpuData;
|
virCPUDataPtr cpuData;
|
||||||
|
|
||||||
if (VIR_ALLOC(cpuData) < 0)
|
if (VIR_ALLOC(cpuData) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
cpuData->arch = arch;
|
||||||
|
|
||||||
|
#if defined(__powerpc__) || defined(__powerpc64__)
|
||||||
asm("mfpvr %0"
|
asm("mfpvr %0"
|
||||||
: "=r" (cpuData->data.ppc.pvr));
|
: "=r" (cpuData->data.ppc.pvr));
|
||||||
|
#endif
|
||||||
|
|
||||||
return cpuData;
|
return cpuData;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ppcUpdate(virCPUDefPtr guest ATTRIBUTE_UNUSED,
|
ppcUpdate(virCPUDefPtr guest ATTRIBUTE_UNUSED,
|
||||||
@ -474,11 +476,7 @@ struct cpuArchDriver cpuDriverPowerPC = {
|
|||||||
.decode = ppcDecode,
|
.decode = ppcDecode,
|
||||||
.encode = NULL,
|
.encode = NULL,
|
||||||
.free = ppcDataFree,
|
.free = ppcDataFree,
|
||||||
#if defined(__powerpc__) || defined(__powerpc64__)
|
|
||||||
.nodeData = ppcNodeData,
|
.nodeData = ppcNodeData,
|
||||||
#else
|
|
||||||
.nodeData = NULL,
|
|
||||||
#endif
|
|
||||||
.guestData = NULL,
|
.guestData = NULL,
|
||||||
.baseline = ppcBaseline,
|
.baseline = ppcBaseline,
|
||||||
.update = ppcUpdate,
|
.update = ppcUpdate,
|
||||||
|
@ -32,13 +32,15 @@
|
|||||||
static const virArch archs[] = { VIR_ARCH_S390, VIR_ARCH_S390X };
|
static const virArch archs[] = { VIR_ARCH_S390, VIR_ARCH_S390X };
|
||||||
|
|
||||||
static virCPUDataPtr
|
static virCPUDataPtr
|
||||||
s390NodeData(void)
|
s390NodeData(virArch arch)
|
||||||
{
|
{
|
||||||
virCPUDataPtr data;
|
virCPUDataPtr data;
|
||||||
|
|
||||||
if (VIR_ALLOC(data) < 0)
|
if (VIR_ALLOC(data) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
data->arch = arch;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1675,7 +1675,7 @@ cpuidSet(uint32_t base, struct cpuX86cpuid **set)
|
|||||||
|
|
||||||
|
|
||||||
static virCPUDataPtr
|
static virCPUDataPtr
|
||||||
x86NodeData(void)
|
x86NodeData(virArch arch)
|
||||||
{
|
{
|
||||||
virCPUDataPtr cpuData = NULL;
|
virCPUDataPtr cpuData = NULL;
|
||||||
struct cpuX86Data *data;
|
struct cpuX86Data *data;
|
||||||
@ -1692,7 +1692,7 @@ x86NodeData(void)
|
|||||||
goto error;
|
goto error;
|
||||||
data->extended_len = ret;
|
data->extended_len = ret;
|
||||||
|
|
||||||
if (!(cpuData = x86MakeCPUData(virArchFromHost(), &data)))
|
if (!(cpuData = x86MakeCPUData(arch, &data)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
return cpuData;
|
return cpuData;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user