With the multi-target work, the goal is to move to a single unified QOM tree that applies universally across all targets. This complements the migration away from instance level properties to class level properties, which again aims to ensure a fixed QOM object model for each class.
This requires that properties are either unconditionally registered in the class, with invalid options rejected at runtime (for example, during realize()), or that distinct subclasses are used for specialized use cases that need a distinct impl for some targets. It is harmless to have the 'loadparm' property registered unconditionally so take the simple option. Reviewed-by: Daniel P. Berrangé <[email protected]> Signed-off-by: Yonggang Luo <[email protected]> --- hw/pci/pci.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index d8b117799f..3204939469 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2889,6 +2889,11 @@ static void pci_qdev_property_set_loadparm(Object *obj, const char *value, { void *lp_str; + if (!target_s390x()) { + error_setg(errp, "'loadparm' is only supported on s390x"); + return; + } + if (object_property_get_int(obj, "bootindex", NULL) < 0) { error_setg(errp, "'loadparm' is only valid for boot devices"); return; @@ -2906,14 +2911,11 @@ void pci_qdev_property_add_specifics(DeviceClass *dc) { ObjectClass *oc = OBJECT_CLASS(dc); - /* The loadparm property is only supported on s390x */ - if (target_s390x()) { - object_class_property_add_str(oc, "loadparm", - pci_qdev_property_get_loadparm, - pci_qdev_property_set_loadparm); - object_class_property_set_description(oc, "loadparm", - "load parameter (s390x only)"); - } + object_class_property_add_str(oc, "loadparm", + pci_qdev_property_get_loadparm, + pci_qdev_property_set_loadparm); + object_class_property_set_description(oc, "loadparm", + "load parameter (s390x only)"); } MemoryRegion *pci_address_space(PCIDevice *dev) -- 2.55.0.windows.3
