|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v7 30/65] whpx: convert OnOffAuto arch properties to QAPI-aware registration
Convert the ignore-unknown-msr, intercept-msr-gp, and ssd OnOffAuto
properties from manual visitor-based callbacks to
property_add_qapi_enum().
Signed-off-by: Markus Armbruster <armbru@xxxxxxxxxx>
Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
---
target/i386/whpx/whpx-all.c | 101 +++++++++++++++-----------------------------
1 file changed, 34 insertions(+), 67 deletions(-)
diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index 113f79afb9ab..64fa389a2f93 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -30,7 +30,7 @@
#include "qemu/error-report.h"
#include "qapi/error.h"
#include "qapi/qapi-types-common.h"
-#include "qapi/qapi-visit-common.h"
+#include "qapi/qapi-type-infos-common.h"
#include "migration/blocker.h"
#include "host-cpu.h"
#include "accel/accel-cpu-target.h"
@@ -1875,6 +1875,7 @@ void whpx_apply_breakpoints(
}
}
+
void whpx_arch_destroy_vcpu(CPUState *cpu)
{
X86CPU *x86cpu = X86_CPU(cpu);
@@ -1955,7 +1956,7 @@ static int whpx_handle_hyperv_guestidle(CPUState *cpu)
return whpx_handle_halt(cpu);
}
-static void whpx_vcpu_kick_out_of_hlt(CPUState *cpu)
+static void whpx_vcpu_kick_out_of_hlt(CPUState *cpu)
{
WHV_REGISTER_VALUE reg;
whpx_get_reg(cpu, WHvRegisterInternalActivityState, ®);
@@ -2059,7 +2060,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu)
.Vector = irq,
};
reg_count += 1;
- /*
+ /*
* When the Hyper-V APIC is enabled, to get out of HLT we
* either have to request an interrupt or manually get it away
* from HLT.
@@ -2359,7 +2360,7 @@ int whpx_vcpu_run(CPUState *cpu)
WHV_REGISTER_VALUE reg_values[3] = {0};
WHV_REGISTER_NAME reg_names[3];
UINT32 reg_count;
- bool is_known_msr = 0;
+ bool is_known_msr = 0;
bool raises_gpf = false;
uint64_t val;
@@ -2911,120 +2912,86 @@ void whpx_cpu_instance_init(CPUState *cs)
* Partition support
*/
-static void whpx_set_unknown_msr(Object *obj, Visitor *v,
- const char *name, void *opaque,
- Error **errp)
+static void whpx_set_unknown_msr(Object *obj, int value, Error **errp)
{
struct whpx_state *whpx = &whpx_global;
- OnOffAuto mode;
- if (!visit_type_OnOffAuto(v, name, &mode, errp)) {
- return;
- }
-
- switch (mode) {
+ switch (value) {
case ON_OFF_AUTO_ON:
whpx->ignore_unknown_msr = true;
break;
-
case ON_OFF_AUTO_OFF:
whpx->ignore_unknown_msr = false;
break;
-
case ON_OFF_AUTO_AUTO:
whpx->ignore_unknown_msr = true;
break;
default:
- /*
- * The value was checked in visit_type_OnOffAuto() above. If
- * we get here, then something is wrong in QEMU.
- */
- abort();
+ g_assert_not_reached();
}
}
-static void whpx_set_intercept_msr_gp(Object *obj, Visitor *v,
- const char *name, void *opaque,
- Error **errp)
+static void whpx_set_intercept_msr_gp(Object *obj, int value, Error **errp)
{
struct whpx_state *whpx = &whpx_global;
- OnOffAuto mode;
- if (!visit_type_OnOffAuto(v, name, &mode, errp)) {
- return;
- }
-
- switch (mode) {
+ switch (value) {
case ON_OFF_AUTO_ON:
whpx->intercept_msr_gp = true;
break;
-
case ON_OFF_AUTO_OFF:
whpx->intercept_msr_gp = false;
break;
-
case ON_OFF_AUTO_AUTO:
whpx->intercept_msr_gp = false;
break;
default:
- /*
- * The value was checked in visit_type_OnOffAuto() above. If
- * we get here, then something is wrong in QEMU.
- */
- abort();
+ g_assert_not_reached();
}
}
-static void whpx_set_ssd(Object *obj, Visitor *v,
- const char *name, void *opaque,
- Error **errp)
+static void whpx_set_ssd(Object *obj, int value, Error **errp)
{
struct whpx_state *whpx = &whpx_global;
- OnOffAuto mode;
- if (!visit_type_OnOffAuto(v, name, &mode, errp)) {
- return;
- }
-
- switch (mode) {
+ switch (value) {
case ON_OFF_AUTO_ON:
whpx->separate_security_domain = true;
break;
-
case ON_OFF_AUTO_OFF:
whpx->separate_security_domain = false;
break;
-
case ON_OFF_AUTO_AUTO:
whpx->separate_security_domain = true;
break;
default:
- /*
- * The value was checked in visit_type_OnOffAuto() above. If
- * we get here, then something is wrong in QEMU.
- */
- abort();
+ g_assert_not_reached();
}
}
void whpx_arch_accel_class_init(ObjectClass *oc)
{
- object_class_property_add(oc, "ignore-unknown-msr", "OnOffAuto",
- NULL, whpx_set_unknown_msr,
- NULL, NULL);
- object_class_property_set_description(oc, "ignore-unknown-msr",
- "Configure unknown MSR behavior");
- object_class_property_add(oc, "intercept-msr-gp", "OnOffAuto",
- NULL, whpx_set_intercept_msr_gp,
- NULL, NULL);
- object_class_property_set_description(oc, "intercept-msr-gp",
- "Intercept #GP to log erroring MSR accesses.");
- object_class_property_add(oc, "ssd", "OnOffAuto",
- NULL, whpx_set_ssd,
- NULL, NULL);
- object_class_property_set_description(oc, "ssd",
- "Separate security domain");
+ object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP(
+ .name = "ignore-unknown-msr",
+ .description = "Configure unknown MSR behavior",
+ .qapi_type = &OnOffAuto_type_info,
+ .set = whpx_set_unknown_msr,
+ ));
+
+ object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP(
+ .name = "intercept-msr-gp",
+ .description = "Intercept #GP to log erroring MSR accesses.",
+ .qapi_type = &OnOffAuto_type_info,
+ .set = whpx_set_intercept_msr_gp,
+ ));
+
+ object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP(
+ .name = "ssd",
+ .description = "Separate security domain",
+ .qapi_type = &OnOffAuto_type_info,
+ .set = whpx_set_ssd,
+ ));
}
int whpx_accel_init(AccelState *as, MachineState *ms)
--
2.56.0.116.g6de20f6092dc
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |