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/scsi/scsi-disk.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index de2b6d85da..7fec5a74d1 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -3212,6 +3212,11 @@ static void scsi_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; @@ -3229,14 +3234,11 @@ static void scsi_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", - scsi_property_get_loadparm, - scsi_property_set_loadparm); - object_class_property_set_description(oc, "loadparm", - "load parameter (s390x only)"); - } + object_class_property_add_str(oc, "loadparm", + scsi_property_get_loadparm, + scsi_property_set_loadparm); + object_class_property_set_description(oc, "loadparm", + "load parameter (s390x only)"); } static void scsi_disk_base_class_initfn(ObjectClass *klass, const void *data) -- 2.55.0.windows.3
