This is for avoid call target_info() in class_init. Now we directly guard in pci_qdev_property_set_loadparm instead. Don't know if its an API break, but the smallest change.
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 0efb4eb4bb0..9d3dcd52942 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2878,6 +2878,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; @@ -2895,14 +2900,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
