Signed-off-by: Igor Mammedov <imamm...@redhat.com> --- target-i386/cpu.c | 35 ++++++++++++++++++++++++++++++++++- 1 files changed, 34 insertions(+), 1 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 1f14b65..b804031 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -528,6 +528,38 @@ PropertyInfo qdev_prop_spinlocks = { .defval = _defval \ } +static void x86_get_hv_relaxed(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ + bool value = hyperv_relaxed_timing_enabled(); + + visit_type_bool(v, &value, name, errp); +} + +static void x86_set_hv_relaxed(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ + bool value; + + visit_type_bool(v, &value, name, errp); + if (error_is_set(errp)) { + return; + } + hyperv_enable_relaxed_timing(value); +} + +PropertyInfo qdev_prop_hv_relaxed = { + .name = "boolean", + .get = x86_get_hv_relaxed, + .set = x86_set_hv_relaxed, +}; +#define DEFINE_PROP_HV_RELAXED(_n, _defval) { \ + .name = _n, \ + .info = &qdev_prop_hv_relaxed, \ + .qtype = QTYPE_QBOOL, \ + .defval = _defval \ +} + static Property cpu_x86_properties[] = { DEFINE_PROP_FAMILY("family"), DEFINE_PROP_MODEL("model"), @@ -538,6 +570,7 @@ static Property cpu_x86_properties[] = { DEFINE_PROP_MODEL_ID("model-id"), DEFINE_PROP_TSC_FREQ("tsc-frequency"), DEFINE_PROP_HV_SPINLOCKS("hv-spinlocks", HYPERV_SPINLOCK_NEVER_RETRY), + DEFINE_PROP_HV_RELAXED("hv-relaxed", false), DEFINE_PROP_END_OF_LIST(), }; @@ -1468,7 +1501,7 @@ static void cpu_x86_parse_featurestr(X86CPU *cpu, char *features, Error **errp) } else if (!strcmp(featurestr, "enforce")) { check_cpuid = enforce_cpuid = 1; } else if (!strcmp(featurestr, "hv_relaxed")) { - hyperv_enable_relaxed_timing(true); + object_property_parse(OBJECT(cpu), "on", "hv-relaxed", errp); } else if (!strcmp(featurestr, "hv_vapic")) { hyperv_enable_vapic_recommended(true); } else { -- 1.7.1