From: Marc-André Lureau <[email protected]> Add QAPITypeInfo to SpaprCapabilityInfo, and make spapr_caps_add_properties() pass it to object_class_property_add().
Reviewed-by: Amit Machhiwal <[email protected]> Signed-off-by: Marc-André Lureau <[email protected]> Signed-off-by: Markus Armbruster <[email protected]> Message-ID: <[email protected]> --- hw/ppc/spapr_caps.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index b8c48bca8a..79b1cc2e1d 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -24,6 +24,7 @@ #include "qemu/osdep.h" #include "qemu/error-report.h" +#include "qapi/qapi-builtin-type-infos.h" #include "qapi/error.h" #include "qapi/visitor.h" #include "system/hw_accel.h" @@ -60,6 +61,7 @@ typedef struct SpaprCapabilityInfo { ObjectPropertyAccessor *get; ObjectPropertyAccessor *set; const char *type; + const QAPITypeInfo *qapi_type; /* Possible values if this is a custom string type */ SpaprCapPossible *possible; /* Make sure the virtual hardware can support this capability */ @@ -726,6 +728,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .get = spapr_cap_get_bool, .set = spapr_cap_set_bool, .type = "bool", + .qapi_type = &bool_type_info, .apply = cap_htm_apply, }, [SPAPR_CAP_VSX] = { @@ -735,6 +738,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .get = spapr_cap_get_bool, .set = spapr_cap_set_bool, .type = "bool", + .qapi_type = &bool_type_info, .apply = cap_vsx_apply, }, [SPAPR_CAP_DFP] = { @@ -744,6 +748,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .get = spapr_cap_get_bool, .set = spapr_cap_set_bool, .type = "bool", + .qapi_type = &bool_type_info, .apply = cap_dfp_apply, }, [SPAPR_CAP_CFPC] = { @@ -753,6 +758,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .get = spapr_cap_get_string, .set = spapr_cap_set_string, .type = "string", + .qapi_type = &str_type_info, .possible = &cap_cfpc_possible, .apply = cap_safe_cache_apply, }, @@ -763,6 +769,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .get = spapr_cap_get_string, .set = spapr_cap_set_string, .type = "string", + .qapi_type = &str_type_info, .possible = &cap_sbbc_possible, .apply = cap_safe_bounds_check_apply, }, @@ -775,6 +782,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .get = spapr_cap_get_string, .set = spapr_cap_set_string, .type = "string", + .qapi_type = &str_type_info, .possible = &cap_ibs_possible, .apply = cap_safe_indirect_branch_apply, }, @@ -785,6 +793,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .get = spapr_cap_get_pagesize, .set = spapr_cap_set_pagesize, .type = "int", + .qapi_type = &size_type_info, .apply = cap_hpt_maxpagesize_apply, .cpu_apply = cap_hpt_maxpagesize_cpu_apply, }, @@ -795,6 +804,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .get = spapr_cap_get_bool, .set = spapr_cap_set_bool, .type = "bool", + .qapi_type = &bool_type_info, .apply = cap_nested_kvm_hv_apply, }, [SPAPR_CAP_NESTED_PAPR] = { @@ -804,6 +814,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .get = spapr_cap_get_bool, .set = spapr_cap_set_bool, .type = "bool", + .qapi_type = &bool_type_info, .apply = cap_nested_papr_apply, }, [SPAPR_CAP_LARGE_DECREMENTER] = { @@ -813,6 +824,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .get = spapr_cap_get_bool, .set = spapr_cap_set_bool, .type = "bool", + .qapi_type = &bool_type_info, .apply = cap_large_decr_apply, .cpu_apply = cap_large_decr_cpu_apply, }, @@ -823,6 +835,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .get = spapr_cap_get_bool, .set = spapr_cap_set_bool, .type = "bool", + .qapi_type = &bool_type_info, .apply = cap_ccf_assist_apply, }, [SPAPR_CAP_FWNMI] = { @@ -832,6 +845,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .get = spapr_cap_get_bool, .set = spapr_cap_set_bool, .type = "bool", + .qapi_type = &bool_type_info, .apply = cap_fwnmi_apply, }, [SPAPR_CAP_RPT_INVALIDATE] = { @@ -841,6 +855,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .get = spapr_cap_get_bool, .set = spapr_cap_set_bool, .type = "bool", + .qapi_type = &bool_type_info, .apply = cap_rpt_invalidate_apply, }, [SPAPR_CAP_AIL_MODE_3] = { @@ -850,6 +865,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .get = spapr_cap_get_bool, .set = spapr_cap_set_bool, .type = "bool", + .qapi_type = &bool_type_info, .apply = cap_ail_mode_3_apply, }, [SPAPR_CAP_DAWR1] = { @@ -859,6 +875,7 @@ SpaprCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .get = spapr_cap_get_bool, .set = spapr_cap_set_bool, .type = "bool", + .qapi_type = &bool_type_info, .apply = cap_dawr1_apply, }, }; @@ -1069,7 +1086,7 @@ void spapr_caps_add_properties(SpaprMachineClass *smc) g_autofree char *name = g_strdup_printf("cap-%s", cap->name); g_autofree char *desc = g_strdup(cap->description); - object_class_property_add(klass, name, cap->type, NULL, + object_class_property_add(klass, name, cap->type, cap->qapi_type, cap->get, cap->set, NULL, cap); -- 2.55.0
