mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
qemu: Enable 'host-passthrough' cpu mode for aarch64
This patch allows libvirt user to specify 'host-passthrough' cpu mode while using qemu/kvm backend on aarch64. It uses 'host' as a CPU model name instead of some other stub (correct CPU detection is not implemented yet) to allow libvirt user to specify 'host-model' cpu mode as well. Signed-off-by: Oleg Strikov <oleg.strikov@canonical.com> (crobinso: fix some indentation)
This commit is contained in:
parent
96f274a989
commit
29ea437e40
@ -25,6 +25,7 @@
|
||||
|
||||
#include "viralloc.h"
|
||||
#include "cpu.h"
|
||||
#include "virstring.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_CPU
|
||||
|
||||
@ -44,16 +45,19 @@ AArch64NodeData(virArch arch)
|
||||
}
|
||||
|
||||
static int
|
||||
AArch64Decode(virCPUDefPtr cpu ATTRIBUTE_UNUSED,
|
||||
const virCPUData *data ATTRIBUTE_UNUSED,
|
||||
const char **models ATTRIBUTE_UNUSED,
|
||||
unsigned int nmodels ATTRIBUTE_UNUSED,
|
||||
const char *preferred ATTRIBUTE_UNUSED,
|
||||
unsigned int flags)
|
||||
AArch64Decode(virCPUDefPtr cpu,
|
||||
const virCPUData *data ATTRIBUTE_UNUSED,
|
||||
const char **models ATTRIBUTE_UNUSED,
|
||||
unsigned int nmodels ATTRIBUTE_UNUSED,
|
||||
const char *preferred ATTRIBUTE_UNUSED,
|
||||
unsigned int flags)
|
||||
{
|
||||
|
||||
virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, -1);
|
||||
|
||||
if (cpu->model == NULL &&
|
||||
VIR_STRDUP(cpu->model, "host") < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -63,6 +67,24 @@ AArch64DataFree(virCPUDataPtr data)
|
||||
VIR_FREE(data);
|
||||
}
|
||||
|
||||
static int
|
||||
AArch64Update(virCPUDefPtr guest,
|
||||
const virCPUDef *host)
|
||||
{
|
||||
guest->match = VIR_CPU_MATCH_EXACT;
|
||||
virCPUDefFreeModel(guest);
|
||||
return virCPUDefCopyModel(guest, host, true);
|
||||
}
|
||||
|
||||
static virCPUCompareResult
|
||||
AArch64GuestData(virCPUDefPtr host ATTRIBUTE_UNUSED,
|
||||
virCPUDefPtr guest ATTRIBUTE_UNUSED,
|
||||
virCPUDataPtr *data ATTRIBUTE_UNUSED,
|
||||
char **message ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return VIR_CPU_COMPARE_IDENTICAL;
|
||||
}
|
||||
|
||||
struct cpuArchDriver cpuDriverAARCH64 = {
|
||||
.name = "aarch64",
|
||||
.arch = archs,
|
||||
@ -72,8 +94,8 @@ struct cpuArchDriver cpuDriverAARCH64 = {
|
||||
.encode = NULL,
|
||||
.free = AArch64DataFree,
|
||||
.nodeData = AArch64NodeData,
|
||||
.guestData = NULL,
|
||||
.guestData = AArch64GuestData,
|
||||
.baseline = NULL,
|
||||
.update = NULL,
|
||||
.update = AArch64Update,
|
||||
.hasFeature = NULL,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user