@@ -38,9 +38,24 @@
int tcg_tb_size;
static bool tcg_allowed = true;
+static AccelPropValue x86_tcg_default_props[] = {
+ { "vme", "off" },
+ { NULL, NULL },
+};
+
+static void tcg_register_accel_props(AccelState *accel)
+{
+ AccelPropValue *entry;
+
+ for (entry = x86_tcg_default_props; entry->prop; entry++) {
+ accel_register_x86_cpu_props(accel, entry->prop, entry->value);
+ }
+}
+
static int tcg_init(MachineState *ms)
{
tcg_exec_init(tcg_tb_size * 1024 * 1024);
+ tcg_register_accel_props(ms->accelerator);
return 0;
}
@@ -1480,17 +1480,6 @@ static X86CPUDefinition builtin_x86_defs[] = {
},
};
-typedef struct PropValue {
- const char *prop, *value;
-} PropValue;
-
-/* TCG-specific defaults that override all CPU models when using TCG
- */
-static PropValue tcg_default_props[] = {
- { "vme", "off" },
- { NULL, NULL },
-};
-
static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w,
bool migratable_only);
@@ -2262,18 +2251,6 @@ static void x86_cpu_report_filtered_features(X86CPU *cpu)
}
}
-static void x86_cpu_apply_props(X86CPU *cpu, PropValue *props)
-{
- PropValue *pv;
- for (pv = props; pv->prop; pv++) {
- if (!pv->value) {
- continue;
- }
- object_property_parse(OBJECT(cpu), pv->value, pv->prop,
- &error_abort);
- }
-}
-
/* Load data from X86CPUDefinition into a X86CPU object
*/
static void x86_cpu_load_def(X86CPU *cpu, X86CPUDefinition *def, Error **errp)
@@ -2300,11 +2277,6 @@ static void x86_cpu_load_def(X86CPU *cpu, X86CPUDefinition *def, Error **errp)
env->features[w] = def->features[w];
}
- /* Special cases not set in the X86CPUDefinition structs: */
- if (tcg_enabled()) {
- x86_cpu_apply_props(cpu, tcg_default_props);
- }
-
env->features[FEAT_1_ECX] |= CPUID_EXT_HYPERVISOR;
/* sysenter isn't supported in compatibility mode on AMD,
Let tcg use the new AccelState.global_props as well (used similar trick for the kvm convertion in previous patch). Basically we are moving the tcg_default_props into tcg codes, and link these compat properties onto newly created AccelState.global_props. This is much simpler than KVM. Signed-off-by: Peter Xu <peterx@redhat.com> --- accel.c | 15 +++++++++++++++ target/i386/cpu.c | 28 ---------------------------- 2 files changed, 15 insertions(+), 28 deletions(-)