[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 007/118] target-ppc: Create versionless CPU class per
From: |
Alexander Graf |
Subject: |
[Qemu-devel] [PULL 007/118] target-ppc: Create versionless CPU class per family if KVM |
Date: |
Wed, 4 Jun 2014 14:43:08 +0200 |
From: Alexey Kardashevskiy <address@hidden>
At the moment generic version-less CPUs are supported via hardcoded aliases.
For example, POWER7 is an alias for POWER7_v2.1. So when QEMU is started
with -cpu POWER7, the POWER7_v2.1 class instance is created.
This approach works for TCG and KVMs other than HV KVM. HV KVM cannot emulate
PVR value so the guest always sees the real PVR. HV KVM will not allow setting
PVR other that the host PVR because of that (the kernel patch for it is on
its way). So in most cases it is impossible to run QEMU with -cpu POWER7
unless the host PVR is exactly the same as the one from the alias (which
is now POWER7_v2.3). It was decided that under HV KVM QEMU should use
-cpu host.
Using "host" CPU type creates a problem for management tools such as libvirt
because they want to know in advance if the destination guest can possibly
run on the destination. Since the "host" type is really not a type and will
always work with any KVM, there is no way for libvirt to know if the migration
will success.
This registers additional CPU class derived from the host CPU family.
The name for it is taken from @desc field of the CPU family class.
Signed-off-by: Alexey Kardashevskiy <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
target-ppc/kvm.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 8ff1777..3569367 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -1761,6 +1761,18 @@ bool kvmppc_has_cap_htab_fd(void)
return cap_htab_fd;
}
+static PowerPCCPUClass *ppc_cpu_get_family_class(PowerPCCPUClass *pcc)
+{
+ ObjectClass *oc = OBJECT_CLASS(pcc);
+
+ while (oc && !object_class_is_abstract(oc)) {
+ oc = object_class_get_parent(oc);
+ }
+ assert(oc);
+
+ return POWERPC_CPU_CLASS(oc);
+}
+
static int kvm_ppc_register_host_cpu_type(void)
{
TypeInfo type_info = {
@@ -1770,6 +1782,7 @@ static int kvm_ppc_register_host_cpu_type(void)
};
uint32_t host_pvr = mfpvr();
PowerPCCPUClass *pvr_pcc;
+ DeviceClass *dc;
pvr_pcc = ppc_cpu_class_by_pvr(host_pvr);
if (pvr_pcc == NULL) {
@@ -1780,6 +1793,14 @@ static int kvm_ppc_register_host_cpu_type(void)
}
type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc));
type_register(&type_info);
+
+ /* Register generic family CPU class for a family */
+ pvr_pcc = ppc_cpu_get_family_class(pvr_pcc);
+ dc = DEVICE_CLASS(pvr_pcc);
+ type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc));
+ type_info.name = g_strdup_printf("%s-"TYPE_POWERPC_CPU, dc->desc);
+ type_register(&type_info);
+
return 0;
}
--
1.8.1.4
- [Qemu-devel] [PULL 003/118] Fix typo in eTSEC Ethernet controller, (continued)
- [Qemu-devel] [PULL 003/118] Fix typo in eTSEC Ethernet controller, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 008/118] target-ppc: Move alias lookup after class lookup, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 001/118] target-ppc: Fix target_disas, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 002/118] monitor: QEMU Monitor Instruction Disassembly Incorrect for PowerPC LE Mode, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 005/118] target-ppc: extract register length calculation in gdbstub, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 009/118] target-ppc: Remove redundant POWER7 declarations, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 010/118] spapr-pci: remove io ports workaround, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 014/118] mac99: Added FW_CFG_PPC_BUSFREQ to match CLOCKFREQ and TBFREQ already there, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 004/118] spapr_nvram: Correct max nvram size, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 011/118] spapr_pci: Fix number of returned vectors in ibm, change-msi, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 007/118] target-ppc: Create versionless CPU class per family if KVM,
Alexander Graf <=
- [Qemu-devel] [PULL 006/118] target-ppc: gdbstub allow byte swapping for reading/writing registers, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 013/118] target-ppc: Remove PVR check from migration, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 021/118] libdecnumber: Eliminate Unused Variable in decSetSubnormal, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 022/118] target-ppc: Enable Building of libdecnumber, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 019/118] libdecnumber: Change gstdint.h to stdint.h, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 012/118] target-ppc: Eliminate Magic Number MSR Masks, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 030/118] target-ppc: Introduce DFP Post Processor Utilities, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 025/118] libdecnumber: Fix decNumberSetBCD, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 017/118] libdecnumber: Prepare libdecnumber for QEMU include structure, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 033/118] target-ppc: Introduce DFP Multiply, Alexander Graf, 2014/06/04