We have HW_COMPAT_*, however that's only binded to machines, not other things (like accelerators). Behind it, it was register_compat_prop() that played the trick. Let's export the function for further use outside HW_COMPAT_* magic.
CC: Eduardo Habkost <ehabk...@redhat.com> CC: Markus Armbruster <arm...@redhat.com> CC: Marcel Apfelbaum <mar...@redhat.com> Signed-off-by: Peter Xu <pet...@redhat.com> --- hw/core/machine.c | 6 +++--- include/hw/boards.h | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 3adebf1..320486d 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -753,9 +753,9 @@ static void machine_class_finalize(ObjectClass *klass, void *data) g_free(mc->name); } -static void register_compat_prop(const char *driver, - const char *property, - const char *value) +void register_compat_prop(const char *driver, + const char *property, + const char *value) { GlobalProperty *p = g_new0(GlobalProperty, 1); /* Machine compat_props must never cause errors: */ diff --git a/include/hw/boards.h b/include/hw/boards.h index 76ce021..6e0f5c7 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -41,6 +41,9 @@ int machine_kvm_shadow_mem(MachineState *machine); int machine_phandle_start(MachineState *machine); bool machine_dump_guest_core(MachineState *machine); bool machine_mem_merge(MachineState *machine); +void register_compat_prop(const char *driver, + const char *property, + const char *value); void machine_register_compat_props(MachineState *machine); HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine); void machine_set_cpu_numa_node(MachineState *machine, -- 2.7.4