[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 3/8] ppc: Provide function to get CPU class of the host
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 3/8] ppc: Provide function to get CPU class of the host CPU |
Date: |
Tue, 14 Jun 2016 15:54:45 +1000 |
From: Thomas Huth <address@hidden>
When running with KVM, we might be interested in some details
of the host CPU class, too, so provide a function to get the
corresponding CPU class.
Signed-off-by: Thomas Huth <address@hidden>
Reviewed-by: Michael Roth <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target-ppc/kvm.c | 19 ++++++++++++++-----
target-ppc/kvm_ppc.h | 7 +++++++
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 24d6032..6c15361 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -2329,6 +2329,19 @@ static PowerPCCPUClass
*ppc_cpu_get_family_class(PowerPCCPUClass *pcc)
return POWERPC_CPU_CLASS(oc);
}
+PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void)
+{
+ uint32_t host_pvr = mfpvr();
+ PowerPCCPUClass *pvr_pcc;
+
+ pvr_pcc = ppc_cpu_class_by_pvr(host_pvr);
+ if (pvr_pcc == NULL) {
+ pvr_pcc = ppc_cpu_class_by_pvr_mask(host_pvr);
+ }
+
+ return pvr_pcc;
+}
+
static int kvm_ppc_register_host_cpu_type(void)
{
TypeInfo type_info = {
@@ -2336,14 +2349,10 @@ static int kvm_ppc_register_host_cpu_type(void)
.instance_init = kvmppc_host_cpu_initfn,
.class_init = kvmppc_host_cpu_class_init,
};
- uint32_t host_pvr = mfpvr();
PowerPCCPUClass *pvr_pcc;
DeviceClass *dc;
- pvr_pcc = ppc_cpu_class_by_pvr(host_pvr);
- if (pvr_pcc == NULL) {
- pvr_pcc = ppc_cpu_class_by_pvr_mask(host_pvr);
- }
+ pvr_pcc = kvm_ppc_get_host_cpu_class();
if (pvr_pcc == NULL) {
return -1;
}
diff --git a/target-ppc/kvm_ppc.h b/target-ppc/kvm_ppc.h
index 3b2090e..20bfb59 100644
--- a/target-ppc/kvm_ppc.h
+++ b/target-ppc/kvm_ppc.h
@@ -56,6 +56,7 @@ void kvmppc_hash64_write_pte(CPUPPCState *env, target_ulong
pte_index,
bool kvmppc_has_cap_fixup_hcalls(void);
int kvmppc_enable_hwrng(void);
int kvmppc_put_books_sregs(PowerPCCPU *cpu);
+PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void);
#else
@@ -252,6 +253,12 @@ static inline int kvmppc_put_books_sregs(PowerPCCPU *cpu)
{
abort();
}
+
+static inline PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void)
+{
+ return NULL;
+}
+
#endif
#ifndef CONFIG_KVM
--
2.5.5
- [Qemu-ppc] [PULL 0/8] ppc-for-2.7 queue 20160614, David Gibson, 2016/06/14
- [Qemu-ppc] [PULL 1/8] ppc/spapr: Refactor h_client_architecture_support() CPU parsing code, David Gibson, 2016/06/14
- [Qemu-ppc] [PULL 3/8] ppc: Provide function to get CPU class of the host CPU,
David Gibson <=
- [Qemu-ppc] [PULL 4/8] ppc: Improve PCR bit selection in ppc_set_compat(), David Gibson, 2016/06/14
- [Qemu-ppc] [PULL 7/8] macio: call dma_memory_unmap() at the end of each DMA transfer, David Gibson, 2016/06/14
- [Qemu-ppc] [PULL 2/8] ppc: Split pcr_mask settings into supported bits and the register mask, David Gibson, 2016/06/14
- [Qemu-ppc] [PULL 8/8] spapr: Ensure all LMBs are represented in ibm, dynamic-memory, David Gibson, 2016/06/14
- [Qemu-ppc] [PULL 6/8] Add PowerPC AT_HWCAP2 definitions, David Gibson, 2016/06/14
- [Qemu-ppc] [PULL 5/8] ppc: Add PowerISA 2.07 compatibility mode, David Gibson, 2016/06/14
- Re: [Qemu-ppc] [PULL 0/8] ppc-for-2.7 queue 20160614, Peter Maydell, 2016/06/14