[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 38/40] ppc: drop caching ObjectClass from PowerPCCPUAli
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 38/40] ppc: drop caching ObjectClass from PowerPCCPUAlias |
Date: |
Fri, 8 Sep 2017 20:35:56 +1000 |
From: Igor Mammedov <address@hidden>
Caching there practically doesn't give any benefits
and that at slow path druring querying supported CPU list.
But it introduces non conventional path of where from
comes used CPU type name (kvm_ppc_register_host_cpu_type).
Taking in account that kvm_ppc_register_host_cpu_type()
fixes up models the aliases point to, it's sufficient to
make ppc_cpu_class_by_name() translate cpu alias to
correct cpu type name.
So drop PowerPCCPUAlias::oc field + ppc_cpu_class_by_alias()
and let ppc_cpu_class_by_name() do conversion to cpu type name,
which simplifies code a little bit saving ~20LOC and trouble
wondering why ppc_cpu_class_by_alias() is necessary.
Signed-off-by: Igor Mammedov <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target/ppc/cpu-models.h | 1 -
target/ppc/kvm.c | 1 -
target/ppc/translate_init.c | 26 ++------------------------
3 files changed, 2 insertions(+), 26 deletions(-)
diff --git a/target/ppc/cpu-models.h b/target/ppc/cpu-models.h
index 629f112337..df31d7f492 100644
--- a/target/ppc/cpu-models.h
+++ b/target/ppc/cpu-models.h
@@ -31,7 +31,6 @@
typedef struct PowerPCCPUAlias {
const char *alias;
const char *model;
- ObjectClass *oc;
} PowerPCCPUAlias;
extern PowerPCCPUAlias ppc_cpu_aliases[];
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 6861f2f585..6442dfcb95 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -2533,7 +2533,6 @@ static int kvm_ppc_register_host_cpu_type(void)
if (suffix) {
*suffix = 0;
}
- ppc_cpu_aliases[i].oc = oc;
break;
}
}
diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c
index 7c1d83b489..3e24cddb86 100644
--- a/target/ppc/translate_init.c
+++ b/target/ppc/translate_init.c
@@ -10253,28 +10253,6 @@ PowerPCCPUClass *ppc_cpu_class_by_pvr_mask(uint32_t
pvr)
return pcc;
}
-static ObjectClass *ppc_cpu_class_by_name(const char *name);
-
-static ObjectClass *ppc_cpu_class_by_alias(PowerPCCPUAlias *alias)
-{
- ObjectClass *invalid_class = (void*)ppc_cpu_class_by_alias;
-
- /* Cache target class lookups in the alias table */
- if (!alias->oc) {
- alias->oc = ppc_cpu_class_by_name(alias->model);
- if (!alias->oc) {
- /* Fast check for non-existing aliases */
- alias->oc = invalid_class;
- }
- }
-
- if (alias->oc == invalid_class) {
- return NULL;
- } else {
- return alias->oc;
- }
-}
-
static ObjectClass *ppc_cpu_class_by_name(const char *name)
{
char *cpu_model, *typename;
@@ -10386,7 +10364,7 @@ static void ppc_cpu_list_entry(gpointer data, gpointer
user_data)
name, pcc->pvr);
for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
- ObjectClass *alias_oc = ppc_cpu_class_by_alias(alias);
+ ObjectClass *alias_oc = ppc_cpu_class_by_name(alias->model);
if (alias_oc != oc) {
continue;
@@ -10466,7 +10444,7 @@ CpuDefinitionInfoList *arch_query_cpu_definitions(Error
**errp)
CpuDefinitionInfoList *entry;
CpuDefinitionInfo *info;
- oc = ppc_cpu_class_by_alias(alias);
+ oc = ppc_cpu_class_by_name(alias->model);
if (oc == NULL) {
continue;
}
--
2.13.5
- [Qemu-ppc] [PULL 25/40] ppc4xx_i2c: QOMify, (continued)
- [Qemu-ppc] [PULL 25/40] ppc4xx_i2c: QOMify, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 36/40] ppc: replace inter-function cyclic dependency/recurssion with 2 simple lookups, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 40/40] ppc: spapr: Move VCPU ID calculation into sPAPR, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 31/40] PPC: KVM: Support machine option to set VSMT mode, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 33/40] ppc: use macros to make cpu type name from string literal, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 32/40] target/ppc: Remove old STATUS file, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 39/40] ppc: remove non implemented cpu models, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 30/40] spapr: fallback to raw mode if best compat mode cannot be set during CAS, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 37/40] ppc: simplify cpu model lookup by PVR, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 35/40] ppc: make cpu alias point only to real cpu models, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 38/40] ppc: drop caching ObjectClass from PowerPCCPUAlias,
David Gibson <=
- [Qemu-ppc] [PULL 22/40] ppc4xx: Move MAL from ppc405_uc to ppc4xx_devs, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 34/40] ppc: make cpu_model translation to type consistent, David Gibson, 2017/09/08
- Re: [Qemu-ppc] [PULL 00/40] ppc-for-2.11 queue 20170908, Peter Maydell, 2017/09/08