[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 15/17] ppc/kvm: have the "family" CPU alias to point to
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 15/17] ppc/kvm: have the "family" CPU alias to point to TYPE_HOST_POWERPC_CPU |
Date: |
Tue, 11 Jul 2017 14:39:15 +1000 |
From: Greg Kurz <address@hidden>
When running KVM on POWER, we allow the user to pass "-cpu POWERx" instead
of "-cpu host". This is achieved by patching the ppc_cpu_aliases[] array
so that "POWERx" points to the CPU class with the same PVR as the host CPU.
This causes CPUs to be instantiated from this CPU class instead of the
TYPE_HOST_POWERPC_CPU class which is used with "-cpu host". These CPUs thus
miss all the KVM specific tuning from kvmppc_host_cpu_class_init().
This currently causes QEMU with "-cpu POWER9" to fail when running KVM on a
POWER9 DD1 host:
qemu-system-ppc64: Register sync failed... If you're using kvm-hv.ko, only
"-cpu host" is possible
kvm_init_vcpu failed: Invalid argument
Let's have the "POWERx" alias to point to TYPE_HOST_POWERPC_CPU directly,
so that "-cpu POWERx" instantiates CPUs from the same class as "-cpu host".
Signed-off-by: Greg Kurz <address@hidden>
Tested-by: Laurent Vivier <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target/ppc/kvm.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index f2f7c53..f7a7ea5 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -2445,6 +2445,7 @@ static int kvm_ppc_register_host_cpu_type(void)
.class_init = kvmppc_host_cpu_class_init,
};
PowerPCCPUClass *pvr_pcc;
+ ObjectClass *oc;
DeviceClass *dc;
int i;
@@ -2455,6 +2456,9 @@ static int kvm_ppc_register_host_cpu_type(void)
type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc));
type_register(&type_info);
+ oc = object_class_by_name(type_info.name);
+ g_assert(oc);
+
#if defined(TARGET_PPC64)
type_info.name = g_strdup_printf("%s-"TYPE_SPAPR_CPU_CORE, "host");
type_info.parent = TYPE_SPAPR_CPU_CORE,
@@ -2474,7 +2478,6 @@ static int kvm_ppc_register_host_cpu_type(void)
dc = DEVICE_CLASS(ppc_cpu_get_family_class(pvr_pcc));
for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
if (strcmp(ppc_cpu_aliases[i].alias, dc->desc) == 0) {
- ObjectClass *oc = OBJECT_CLASS(pvr_pcc);
char *suffix;
ppc_cpu_aliases[i].model = g_strdup(object_class_get_name(oc));
--
2.9.4
- [Qemu-ppc] [PULL 07/17] spapr: Uniform DRC reset paths, (continued)
- [Qemu-ppc] [PULL 07/17] spapr: Uniform DRC reset paths, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 14/17] spapr: Only report host/guest IOMMU page size mismatches on KVM, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 17/17] spapr: populate device tree depending on XIVE_EXPLOIT option, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 13/17] spapr: fix memory hotplug error path, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 10/17] spapr: Use unplug_request for PCI hot unplug, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 09/17] spapr: Remove unnecessary differences between hotplug and coldplug paths, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 16/17] spapr: introduce the XIVE_EXPLOIT option in CAS, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 15/17] ppc/kvm: have the "family" CPU alias to point to TYPE_HOST_POWERPC_CPU,
David Gibson <=
- [Qemu-ppc] [PULL 02/17] spapr: refresh "platform-specific" hcalls comment, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 04/17] spapr: fix migration to pseries machine < 2.8, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 06/17] spapr: Leave DR-indicator management to the guest, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 08/17] spapr: Add DRC release method, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 05/17] target-ppc: SPR_BOOKE_ESR not set on FP exceptions, David Gibson, 2017/07/11
- Re: [Qemu-ppc] [PULL 00/17] ppc-for-2.10 queue 20170711, Peter Maydell, 2017/07/11