qom: Spring cleaning
Subsystems (14)
PATCH 4/17 qom: Change object_property_get_uint16List() to match its doc
In reply to Markus Armbruster--- include/qom/object.h | 4 ++-- hw/core/machine-qmp-cmds.c | 6 +++--- qom/object.c | 9 +++++---- 3 files changed, 10 insertions(+), 9 deletions(-)
include/qom/object.h +2 -2
@@ -1331,8 +1331,8 @@ int object_property_get_enum(Object *obj, const char *name,* undefined if an error occurs (including when the property value is not * an list of integers). */ -void object_property_get_uint16List (Object *obj,const char *name, -uint16List **list,Error **errp); +uint16List *object_property_get_uint16List (Object *obj,const char *name, +Error **errp);/** * object_property_set:
hw/core/machine-qmp-cmds.c +3 -3
@@ -325,9 +325,9 @@ static int query_memdev(Object *obj, void *opaque)"policy" ,"HostMemPolicy" , &error_abort); -object_property_get_uint16List (obj,"host-nodes" , - &m->value->host_nodes, - &error_abort); + m->value->host_nodes =object_property_get_uint16List (obj, +"host-nodes" , + &error_abort); m->next = *list; *list = m;
qom/object.c +5 -4
@@ -1559,10 +1559,11 @@ int object_property_get_enum(Object *obj, const char *name,return ret; } -void object_property_get_uint16List (Object *obj,const char *name, -uint16List **list,Error **errp) +uint16List *object_property_get_uint16List (Object *obj,const char *name, +Error **errp) {Error *err =NULL ; +uint16List *list =NULL ;Visitor *v;char *str;
@@ -1575,11 +1576,11 @@ void object_property_get_uint16List(Object *obj, const char *name,visit_complete (v, &str);visit_free (v); v =string_input_visitor_new (str); -visit_type_uint16List (v,NULL , list, errp); - +visit_type_uint16List (v,NULL , &list, errp);g_free (str); out:visit_free (v); +return list; } void object_property_parse(Object *obj, const char *string,
Signature · 1 line
2.21.1
PATCH 1/17 qom: Clearer reference counting in object_initialize_childv()
In reply to Markus Armbruster--- qom/object.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
qom/object.c +8 -8
@@ -571,18 +571,18 @@ void object_initialize_childv(Object *parentobj, const char *propname, } } +out:/* -* Since object_property_add_child added a reference to the child object, -* we can drop the reference added by object_initialize(), so the child -* property will own the only reference to the object. +* We want @obj's reference to be 1 on success, 0 on failure. +* On success, it's 2: one taken by object_initialize(), and one +* by object_property_add_child(). +* On failure in object_initialize() or earlier, it's 1. +* On failure afterwards, it's also 1: object_unparent() releases +* the reference taken by object_property_add_child(). */ object_unref (obj); -out: -if (local_err) { -error_propagate (errp, local_err); -object_unref (obj); - } +error_propagate (errp, local_err); }static inline bool object_property_is_child (ObjectProperty *prop)
Signature · 1 line
2.21.1
PATCH 8/17 s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256
In reply to Markus ArmbrusterBoth s390_features[S390_FEAT_PCC_CMAC_AES_256].name and s390_features[S390_FEAT_PCC_CMAC_EAES_256].name is "pcc-cmac-eaes-256". The former is obviously a pasto.
Impact:
* s390_feat_bitmap_to_ascii() misidentifies S390_FEAT_PCC_CMAC_AES_256 as "pcc-cmac-eaes-256". Affects QMP commands query-cpu-definitions, query-cpu-model-expansion, query-cpu-model-baseline, query-cpu-model-comparison, and the error message when s390_realize_cpu_model() fails in check_compatibility().
* s390_realize_cpu_model() misidentifies it in check_consistency() warnings.
* s390_cpu_list() likewise. Affects -cpu help.
* s390_cpu_model_register_props() creates CPU property "pcc-cmac-eaes-256" twice. The second one fails, but the error is ignored (a later commit will change that). Results in a single property "pcc-cmac-eaes-256" with the description for S390_FEAT_PCC_CMAC_AES_256, and no property for S390_FEAT_PCC_CMAC_EAES_256. CPU properties are visible in CLI -cpu and -device, QMP & HMP device_add, QMP device-list-properties, and QOM introspection.
Fix by deleting the wayward 'e'.
--- target/s390x/cpu_features_def.inc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/s390x/cpu_features_def.inc.h +1 -1
@@ -310,7 +310,7 @@ DEF_FEAT(PCC_CMAC_ETDEA_192, "pcc-cmac-etdea-128", PCC, 10, "PCC Compute-Last-Bl DEF_FEAT(PCC_CMAC_TDEA, "pcc-cmac-etdea-192", PCC, 11, "PCC Compute-Last-Block-CMAC-Using-EncryptedTDEA-192") DEF_FEAT(PCC_CMAC_AES_128, "pcc-cmac-aes-128", PCC, 18, "PCC Compute-Last-Block-CMAC-Using-AES-128") DEF_FEAT(PCC_CMAC_AES_192, "pcc-cmac-aes-192", PCC, 19, "PCC Compute-Last-Block-CMAC-Using-AES-192") -DEF_FEAT(PCC_CMAC_AES_256, "pcc-cmac-eaes-256", PCC, 20, "PCC Compute-Last-Block-CMAC-Using-AES-256") +DEF_FEAT(PCC_CMAC_AES_256, "pcc-cmac-aes-256", PCC, 20, "PCC Compute-Last-Block-CMAC-Using-AES-256") DEF_FEAT(PCC_CMAC_EAES_128, "pcc-cmac-eaes-128", PCC, 26, "PCC Compute-Last-Block-CMAC-Using-Encrypted-AES-128") DEF_FEAT(PCC_CMAC_EAES_192, "pcc-cmac-eaes-192", PCC, 27, "PCC Compute-Last-Block-CMAC-Using-Encrypted-AES-192")DEF_FEAT (PCC_CMAC_EAES_256 ,"pcc-cmac-eaes-256" ,PCC ,28 ,"PCC Compute-Last-Block-CMAC-Using-Encrypted-AES-256" )
Signature · 1 line
2.21.1
PATCH 12/17 qdev: Clean up qdev_connect_gpio_out_named()
In reply to Markus ArmbrusterBoth qdev_connect_gpio_out_named() and device_set_realized() put objects without a parent into the "/machine/unattached/" orphanage.
qdev_connect_gpio_out_named() needs a lengthy comment to explain how it works. It exploits that object_property_add_child() can fail only when we got a parent already, and ignoring that error does what we want. True. If it failed due to "duplicate property", we'd be in trouble, but that would be a programming error.
device_set_realized() is cleaner: it checks whether we need a parent, then calls object_property_add_child(), aborting on failure. No need for a comment, and programming errors get caught.
Change qdev_connect_gpio_out_named() to match.
--- hw/core/qdev.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
hw/core/qdev.c +4 -7
@@ -541,15 +541,12 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n, {char *propname =g_strdup_printf ("%s[%d]" , name ? name :"unnamed-gpio-out" , n); -if (pin) { -/* We need a name for object_property_set_link to work. If the -* object has a parent, object_property_add_child will come back -* with an error without doing anything. If it has none, it will -* never fail. So we can just call it with a NULL Error pointer. -*/ +if (pin && !OBJECT (pin)->parent) { +/* We need a name for object_property_set_link to work */ object_property_add_child (container_get (qdev_get_machine (),"/unattached" ), -"non-qdev-gpio[*]" ,OBJECT (pin),NULL ); +"non-qdev-gpio[*]" ,OBJECT (pin), + &error_abort); }object_property_set_link (OBJECT (dev),OBJECT (pin), propname, &error_abort);g_free (propname);
Signature · 1 line
2.21.1
PATCH 3/17 qom: Drop object_property_del_child()'s unused parameter @errp
In reply to Markus Armbruster--- qom/object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
qom/object.c +2 -2
@@ -614,7 +614,7 @@ static void object_property_del_all(Object *obj)g_hash_table_unref (obj->properties); } -static void object_property_del_child (Object *obj,Object *child,Error **errp) +static void object_property_del_child (Object *obj,Object *child) {ObjectProperty *prop;GHashTableIter iter;
@@ -644,7 +644,7 @@ static void object_property_del_child(Object *obj, Object *child, Error **errp)void object_unparent (Object *obj) {if (obj->parent) { -object_property_del_child (obj->parent, obj,NULL ); +object_property_del_child (obj->parent, obj); } }
Signature · 1 line
2.21.1
PATCH 7/17 tests/check-qom-proplist: Improve iterator coverage
In reply to Markus ArmbrusterThe tests' "qemu-dummy" device has only class properties. Turn one of them into an instance property. test_dummy_class_iterator() expects one fewer property than test_dummy_iterator(). Rewrite test_dummy_prop_iterator() to take expected properties as argument.
--- tests/check-qom-proplist.c | 51 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 25 deletions(-)
tests/check-qom-proplist.c +26 -25
@@ -130,17 +130,18 @@ static void dummy_init(Object *obj)object_property_add_bool (obj,"bv" , dummy_get_bv, dummy_set_bv, - &err); +NULL ); +/* duplicate: */ +object_property_add_str (obj,"sv" , + dummy_get_sv, + dummy_set_sv, + &err);error_free_or_abort (&err); }static void dummy_class_init (ObjectClass *cls,void *data) { -object_class_property_add_bool (cls,"bv" , - dummy_get_bv, - dummy_set_bv, -NULL ); object_class_property_add_str(cls, "sv", dummy_get_sv, dummy_set_sv,
@@ -520,34 +521,33 @@ static void test_dummy_getenum(void) } -static void test_dummy_prop_iterator (ObjectPropertyIterator *iter) +static void test_dummy_prop_iterator (ObjectPropertyIterator *iter, +const char *expected[],int n) { -bool seenbv = false, seensv = false, seenav = false, seentype = false;ObjectProperty *prop; +int i;while ((prop =object_property_iter_next (iter))) { -if (!seenbv &&g_str_equal (prop->name,"bv" )) { - seenbv = true; - }else if (!seensv &&g_str_equal (prop->name,"sv" )) { - seensv = true; - }else if (!seenav &&g_str_equal (prop->name,"av" )) { - seenav = true; - }else if (!seentype &&g_str_equal (prop->name,"type" )) { -/* This prop comes from the base Object class */ - seentype = true; - }else { -g_printerr ("Found prop '%s'\n" , prop->name); -g_assert_not_reached (); +for (i =0 ; i < n; i++) { +if (!g_strcmp0 (prop->name, expected[i])) { +break ; + } } +g_assert (i < n); + expected[i] =NULL ; + } + +for (i =0 ; i < n; i++) { +g_assert (!expected[i]); } -g_assert (seenbv); -g_assert (seenav); -g_assert (seensv); -g_assert (seentype); }static void test_dummy_iterator (void ) { +const char *expected[] = { +"type" ,/* inherited from TYPE_OBJECT */ +"sv" ,"av" ,/* class properties */ +"bv" };/* instance property */ Object *parent =object_get_objects_root (); DummyObject *dobj = DUMMY_OBJECT( object_new_with_props(TYPE_DUMMY,
@@ -561,17 +561,18 @@ static void test_dummy_iterator(void)ObjectPropertyIterator iter;object_property_iter_init (&iter,OBJECT (dobj)); -test_dummy_prop_iterator (&iter); +test_dummy_prop_iterator (&iter, expected,ARRAY_SIZE (expected));object_unparent (OBJECT (dobj)); }static void test_dummy_class_iterator (void ) { +const char *expected[] = {"type" ,"av" ,"sv" };ObjectPropertyIterator iter;ObjectClass *klass =object_class_by_name (TYPE_DUMMY );object_class_property_iter_init (&iter, klass); -test_dummy_prop_iterator (&iter); +test_dummy_prop_iterator (&iter, expected,ARRAY_SIZE (expected)); }static void test_dummy_delchild (void )
Signature · 1 line
2.21.1
PATCH 6/17 qom: Drop object_property_set_description() parameter @errp
In reply to Markus Armbrusterobject_property_set_description() and object_class_property_set_description() fail only when property @name is not found.
There are 85 calls of object_property_set_description() and object_class_property_set_description(). None of them can fail:
* 84 immediately follow the creation of the property.
* The one in spapr_rng_instance_init() refers to a property created in spapr_rng_class_init(), from spapr_rng_properties[].
Every one of them still gets to decide what to pass for @errp.
51 calls pass &error_abort, 32 calls pass NULL, one receives the error and propagates it to &error_abort, and one propagates it to &error_fatal. I'm actually surprised none of them violates the Error API.
What are we gaining by letting callers handle the "property not found" error? Use when the property is not known to exist is simpler: you don't have to guard the call with a check. We haven't found such a use in 5+ years. Until we do, let's make life a bit simpler and drop the @errp parameter.
--- include/qom/object.h | 6 ++---- accel/kvm/kvm-all.c | 4 ++-- accel/tcg/tcg-all.c | 2 +- backends/hostmem-memfd.c | 9 +++------ backends/hostmem.c | 16 +++++++-------- hw/arm/aspeed.c | 2 +- hw/arm/vexpress.c | 6 ++---- hw/arm/virt.c | 20 +++++++------------ hw/arm/xlnx-zcu102.c | 6 ++---- hw/core/machine.c | 41 ++++++++++++++++++-------------------- hw/core/qdev.c | 6 ++---- hw/i386/microvm.c | 14 ++++++------- hw/i386/pc.c | 2 +- hw/i386/x86.c | 6 +++--- hw/ppc/mac_newworld.c | 3 +-- hw/ppc/pnv.c | 3 +-- hw/ppc/spapr.c | 21 ++++++++----------- hw/ppc/spapr_caps.c | 6 +----- hw/ppc/spapr_rng.c | 3 +-- hw/riscv/sifive_u.c | 5 ++--- hw/s390x/css-bridge.c | 3 +-- hw/s390x/s390-virtio-ccw.c | 9 +++------ hw/sparc/sun4m.c | 3 +-- hw/xen/xen-common.c | 2 +- qom/object.c | 19 ++++-------------- target/arm/cpu64.c | 3 +-- target/arm/kvm.c | 2 +- target/i386/sev.c | 6 +++--- target/ppc/compat.c | 2 +- target/s390x/cpu_models.c | 4 ++-- 30 files changed, 91 insertions(+), 143 deletions(-)
include/qom/object.h +2 -4
@@ -1827,16 +1827,14 @@ ObjectProperty *object_property_add_const_link(Object *obj, const char *name,* @obj: the object owning the property * @name: the name of the property * @description: the description of the property on the object -* @errp: if an error occurs, a pointer to an area to store the error * * Set an object property's description. * */ void object_property_set_description (Object *obj,const char *name, -const char *description,Error **errp); +const char *description);void object_class_property_set_description (ObjectClass *klass,const char *name, -const char *description, -Error **errp); +const char *description);/** * object_child_foreach:
accel/kvm/kvm-all.c +2 -2
@@ -3077,13 +3077,13 @@ static void kvm_accel_class_init(ObjectClass *oc, void *data)NULL , kvm_set_kernel_irqchip, NULL, NULL, &error_abort);object_class_property_set_description (oc,"kernel-irqchip" , -"Configure KVM in-kernel irqchip" , &error_abort); +"Configure KVM in-kernel irqchip" );object_class_property_add (oc,"kvm-shadow-mem" ,"int" , kvm_get_kvm_shadow_mem, kvm_set_kvm_shadow_mem,NULL ,NULL , &error_abort);object_class_property_set_description (oc,"kvm-shadow-mem" , -"KVM shadow MMU size" , &error_abort); +"KVM shadow MMU size" ); }static const TypeInfo kvm_accel_type = {
accel/tcg/tcg-all.c +1 -1
@@ -210,7 +210,7 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data) tcg_get_tb_size, tcg_set_tb_size, NULL, NULL, &error_abort);object_class_property_set_description (oc,"tb-size" , -"TCG translation block cache size" , &error_abort); +"TCG translation block cache size" ); }
backends/hostmem-memfd.c +3 -6
@@ -144,23 +144,20 @@ memfd_backend_class_init(ObjectClass *oc, void *data) memfd_backend_set_hugetlb, &error_abort);object_class_property_set_description (oc,"hugetlb" , -"Use huge pages" , - &error_abort); +"Use huge pages" );object_class_property_add (oc,"hugetlbsize" ,"int" , memfd_backend_get_hugetlbsize, memfd_backend_set_hugetlbsize,NULL ,NULL , &error_abort);object_class_property_set_description (oc,"hugetlbsize" , -"Huge pages size (ex: 2M, 1G)" , - &error_abort); +"Huge pages size (ex: 2M, 1G)" ); }object_class_property_add_bool (oc,"seal" , memfd_backend_get_seal, memfd_backend_set_seal, &error_abort);object_class_property_set_description (oc,"seal" , -"Seal growing & shrinking" , - &error_abort); +"Seal growing & shrinking" ); }static const TypeInfo memfd_backend_info = {
backends/hostmem.c +8 -8
@@ -465,46 +465,46 @@ host_memory_backend_class_init(ObjectClass *oc, void *data) host_memory_backend_get_merge, host_memory_backend_set_merge, &error_abort);object_class_property_set_description (oc,"merge" , -"Mark memory as mergeable" , &error_abort); +"Mark memory as mergeable" );object_class_property_add_bool (oc,"dump" , host_memory_backend_get_dump, host_memory_backend_set_dump, &error_abort);object_class_property_set_description (oc,"dump" , -"Set to 'off' to exclude from core dump" , &error_abort); +"Set to 'off' to exclude from core dump" );object_class_property_add_bool (oc,"prealloc" , host_memory_backend_get_prealloc, host_memory_backend_set_prealloc, &error_abort);object_class_property_set_description (oc,"prealloc" , -"Preallocate memory" , &error_abort); +"Preallocate memory" );object_class_property_add (oc,"prealloc-threads" ,"int" , host_memory_backend_get_prealloc_threads, host_memory_backend_set_prealloc_threads,NULL ,NULL , &error_abort);object_class_property_set_description (oc,"prealloc-threads" , -"Number of CPU threads to use for prealloc" , &error_abort); +"Number of CPU threads to use for prealloc" );object_class_property_add (oc,"size" ,"int" , host_memory_backend_get_size, host_memory_backend_set_size,NULL ,NULL , &error_abort);object_class_property_set_description (oc,"size" , -"Size of the memory region (ex: 500M)" , &error_abort); +"Size of the memory region (ex: 500M)" );object_class_property_add (oc,"host-nodes" ,"int" , host_memory_backend_get_host_nodes, host_memory_backend_set_host_nodes,NULL ,NULL , &error_abort);object_class_property_set_description (oc,"host-nodes" , -"Binds memory to the list of NUMA host nodes" , &error_abort); +"Binds memory to the list of NUMA host nodes" );object_class_property_add_enum (oc,"policy" ,"HostMemPolicy" , &HostMemPolicy_lookup, host_memory_backend_get_policy, host_memory_backend_set_policy, &error_abort);object_class_property_set_description (oc,"policy" , -"Set the NUMA policy" , &error_abort); +"Set the NUMA policy" );object_class_property_add_bool (oc,"share" , host_memory_backend_get_share, host_memory_backend_set_share, &error_abort);object_class_property_set_description (oc,"share" , -"Mark the memory as private to QEMU or shared" , &error_abort); +"Mark the memory as private to QEMU or shared" );object_class_property_add_bool (oc,"x-use-canonical-path-for-ramblock-id" , host_memory_backend_get_use_canonical_path, host_memory_backend_set_use_canonical_path, &error_abort);
hw/arm/aspeed.c +1 -1
@@ -422,7 +422,7 @@ static void aspeed_machine_class_props_init(ObjectClass *oc) aspeed_get_mmio_exec, aspeed_set_mmio_exec, &error_abort);object_class_property_set_description (oc,"execute-in-place" , -"boot directly from CE0 flash device" , &error_abort); +"boot directly from CE0 flash device" ); }static void aspeed_machine_class_init (ObjectClass *oc,void *data)
hw/arm/vexpress.c +2 -4
@@ -752,8 +752,7 @@ static void vexpress_instance_init(Object *obj) vexpress_set_secure, NULL);object_property_set_description (obj,"secure" ,"Set on/off to enable/disable the ARM " -"Security Extensions (TrustZone)" , -NULL ); +"Security Extensions (TrustZone)" ); }static void vexpress_a15_instance_init (Object *obj)
@@ -770,8 +769,7 @@ static void vexpress_a15_instance_init(Object *obj)object_property_set_description (obj,"virtualization" ,"Set on/off to enable/disable the ARM " "Virtualization Extensions " -"(defaults to same as 'secure')" , -NULL ); +"(defaults to same as 'secure')" ); }static void vexpress_a9_instance_init (Object *obj)
hw/arm/virt.c +7 -13
@@ -2215,7 +2215,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) virt_get_acpi, virt_set_acpi, NULL, NULL, &error_abort);object_class_property_set_description (oc,"acpi" , -"Enable ACPI" , &error_abort); +"Enable ACPI" ); }static void virt_instance_init (Object *obj)
@@ -2232,8 +2232,7 @@ static void virt_instance_init(Object *obj) virt_set_secure, NULL);object_property_set_description (obj,"secure" ,"Set on/off to enable/disable the ARM " -"Security Extensions (TrustZone)" , -NULL ); +"Security Extensions (TrustZone)" );/* EL2 is also disabled by default, for similar reasons */ vms->virt = false;
@@ -2242,8 +2241,7 @@ static void virt_instance_init(Object *obj)object_property_set_description (obj,"virtualization" ,"Set on/off to enable/disable emulating a " "guest CPU which implements the ARM " -"Virtualization Extensions" , -NULL ); +"Virtualization Extensions" );/* High memory is enabled by default */ vms->highmem = true;
@@ -2251,15 +2249,13 @@ static void virt_instance_init(Object *obj) virt_set_highmem, NULL);object_property_set_description (obj,"highmem" ,"Set on/off to enable/disable using " -"physical address space above 32 bits" , -NULL ); +"physical address space above 32 bits" ); vms->gic_version =VIRT_GIC_VERSION_NOSEL ;object_property_add_str (obj,"gic-version" , virt_get_gic_version, virt_set_gic_version,NULL );object_property_set_description (obj,"gic-version" ,"Set GIC version. " -"Valid values are 2, 3, host and max" , -NULL ); +"Valid values are 2, 3, host and max" ); vms->highmem_ecam = !vmc->no_highmem_ecam;
@@ -2272,8 +2268,7 @@ static void virt_instance_init(Object *obj) virt_set_its, NULL);object_property_set_description (obj,"its" ,"Set on/off to enable/disable " -"ITS instantiation" , -NULL ); +"ITS instantiation" ); }/* Default disallows iommu instantiation */
@@ -2281,8 +2276,7 @@ static void virt_instance_init(Object *obj)object_property_add_str (obj,"iommu" , virt_get_iommu, virt_set_iommu,NULL );object_property_set_description (obj,"iommu" ,"Set the IOMMU type. " -"Valid values are none and smmuv3" , -NULL ); +"Valid values are none and smmuv3" ); vms->irqmap = a15irqmap;
hw/arm/xlnx-zcu102.c +2 -4
@@ -181,8 +181,7 @@ static void xlnx_zcu102_machine_instance_init(Object *obj) zcu102_set_secure, NULL);object_property_set_description (obj,"secure" ,"Set on/off to enable/disable the ARM " -"Security Extensions (TrustZone)" , -NULL ); +"Security Extensions (TrustZone)" );/* Default to virt (EL2) being disabled */ s->virt = false;
@@ -191,8 +190,7 @@ static void xlnx_zcu102_machine_instance_init(Object *obj)object_property_set_description (obj,"virtualization" ,"Set on/off to enable/disable emulating a " "guest CPU which implements the ARM " -"Virtualization Extensions" , -NULL ); +"Virtualization Extensions" ); }static void xlnx_zcu102_machine_class_init (ObjectClass *oc,void *data)
hw/core/machine.c +19 -22
132 lines not on this page · raw message
hw/core/qdev.c +2 -4
@@ -774,8 +774,7 @@ void qdev_property_add_static(DeviceState *dev, Property *prop) prop, &error_abort);object_property_set_description (obj, prop->name, - prop->info->description, - &error_abort); + prop->info->description);if (prop->set_default) { prop->info->set_default_value (op, prop);
@@ -804,8 +803,7 @@ static void qdev_class_add_property(DeviceClass *klass, Property *prop) } }object_class_property_set_description (oc, prop->name, - prop->info->description, - &error_abort); + prop->info->description); }/* @qdev_alias_all_properties - Add alias properties to the source object for
hw/i386/microvm.c +6 -8
@@ -512,36 +512,35 @@ static void microvm_class_init(ObjectClass *oc, void *data) microvm_machine_set_pic, NULL, NULL, &error_abort);object_class_property_set_description (oc,MICROVM_MACHINE_PIC , -"Enable i8259 PIC" , &error_abort); +"Enable i8259 PIC" );object_class_property_add (oc,MICROVM_MACHINE_PIT ,"OnOffAuto" , microvm_machine_get_pit, microvm_machine_set_pit,NULL ,NULL , &error_abort);object_class_property_set_description (oc,MICROVM_MACHINE_PIT , -"Enable i8254 PIT" , &error_abort); +"Enable i8254 PIT" );object_class_property_add (oc,MICROVM_MACHINE_RTC ,"OnOffAuto" , microvm_machine_get_rtc, microvm_machine_set_rtc,NULL ,NULL , &error_abort);object_class_property_set_description (oc,MICROVM_MACHINE_RTC , -"Enable MC146818 RTC" , &error_abort); +"Enable MC146818 RTC" );object_class_property_add_bool (oc,MICROVM_MACHINE_ISA_SERIAL , microvm_machine_get_isa_serial, microvm_machine_set_isa_serial, &error_abort);object_class_property_set_description (oc,MICROVM_MACHINE_ISA_SERIAL , -"Set off to disable the instantiation an ISA serial port" , - &error_abort); +"Set off to disable the instantiation an ISA serial port" );object_class_property_add_bool (oc,MICROVM_MACHINE_OPTION_ROMS , microvm_machine_get_option_roms, microvm_machine_set_option_roms, &error_abort);object_class_property_set_description (oc,MICROVM_MACHINE_OPTION_ROMS , -"Set off to disable loading option ROMs" , &error_abort); +"Set off to disable loading option ROMs" ); object_class_property_add_bool(oc, MICROVM_MACHINE_AUTO_KERNEL_CMDLINE, microvm_machine_get_auto_kernel_cmdline,
@@ -549,8 +548,7 @@ static void microvm_class_init(ObjectClass *oc, void *data) &error_abort);object_class_property_set_description (oc,MICROVM_MACHINE_AUTO_KERNEL_CMDLINE , -"Set off to disable adding virtio-mmio devices to the kernel cmdline" , - &error_abort); +"Set off to disable adding virtio-mmio devices to the kernel cmdline" ); }static const TypeInfo microvm_machine_info = {
hw/i386/pc.c +1 -1
@@ -1967,7 +1967,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) pc_machine_get_vmport, pc_machine_set_vmport, NULL, NULL, &error_abort);object_class_property_set_description (oc,PC_MACHINE_VMPORT , -"Enable vmport (pc & q35)" , &error_abort); +"Enable vmport (pc & q35)" );object_class_property_add_bool (oc,PC_MACHINE_SMBUS , pc_machine_get_smbus, pc_machine_set_smbus, &error_abort);
hw/i386/x86.c +3 -3
@@ -984,19 +984,19 @@ static void x86_machine_class_init(ObjectClass *oc, void *data) x86_machine_get_max_ram_below_4g, x86_machine_set_max_ram_below_4g, NULL, NULL, &error_abort);object_class_property_set_description (oc,X86_MACHINE_MAX_RAM_BELOW_4G , -"Maximum ram below the 4G boundary (32bit boundary)" , &error_abort); +"Maximum ram below the 4G boundary (32bit boundary)" );object_class_property_add (oc,X86_MACHINE_SMM ,"OnOffAuto" , x86_machine_get_smm, x86_machine_set_smm,NULL ,NULL , &error_abort);object_class_property_set_description (oc,X86_MACHINE_SMM , -"Enable SMM" , &error_abort); +"Enable SMM" );object_class_property_add (oc,X86_MACHINE_ACPI ,"OnOffAuto" , x86_machine_get_acpi, x86_machine_set_acpi,NULL ,NULL , &error_abort);object_class_property_set_description (oc,X86_MACHINE_ACPI , -"Enable ACPI" , &error_abort); +"Enable ACPI" ); }static const TypeInfo x86_machine_info = {
hw/ppc/mac_newworld.c +1 -2
@@ -631,8 +631,7 @@ static void core99_instance_init(Object *obj) core99_set_via_config, NULL);object_property_set_description (obj,"via" ,"Set VIA configuration. " -"Valid values are cuda, pmu and pmu-adb" , -NULL ); +"Valid values are cuda, pmu and pmu-adb" );return ; }
hw/ppc/pnv.c +1 -2
@@ -2002,8 +2002,7 @@ static void pnv_machine_class_init(ObjectClass *oc, void *data) pnv_machine_get_hb, pnv_machine_set_hb, &error_abort);object_class_property_set_description (oc,"hb-mode" , -"Use a hostboot like boot loader" , -NULL ); +"Use a hostboot like boot loader" ); }#define DEFINE_PNV8_CHIP_TYPE (type, class_initfn) \
hw/ppc/spapr.c +8 -13
@@ -3317,8 +3317,7 @@ static void spapr_instance_init(Object *obj)object_property_add_str (obj,"kvm-type" , spapr_get_kvm_type, spapr_set_kvm_type,NULL );object_property_set_description (obj,"kvm-type" , -"Specifies the KVM virtualization mode (HV, PR)" , -NULL ); +"Specifies the KVM virtualization mode (HV, PR)" ); object_property_add_bool(obj, "modern-hotplug-events", spapr_get_modern_hotplug_events, spapr_set_modern_hotplug_events,
@@ -3326,8 +3325,7 @@ static void spapr_instance_init(Object *obj)object_property_set_description (obj,"modern-hotplug-events" ,"Use dedicated hotplug event mechanism in" " place of standard EPOW events when possible" -" (required for memory hot-unplug support)" , -NULL ); +" (required for memory hot-unplug support)" );ppc_compat_add_property (obj,"max-cpu-compat" , &spapr->max_compat_pvr,"Maximum permitted CPU compatibility mode" , &error_fatal);
@@ -3335,14 +3333,13 @@ static void spapr_instance_init(Object *obj)object_property_add_str (obj,"resize-hpt" , spapr_get_resize_hpt, spapr_set_resize_hpt,NULL );object_property_set_description (obj,"resize-hpt" , -"Resizing of the Hash Page Table (enabled, disabled, required)" , -NULL ); +"Resizing of the Hash Page Table (enabled, disabled, required)" );object_property_add_uint32_ptr (obj,"vsmt" , &spapr->vsmt,OBJ_PROP_FLAG_READWRITE , &error_abort);object_property_set_description (obj,"vsmt" ,"Virtual SMT: KVM behaves as if this were" -" the host's SMT mode" , &error_abort); +" the host's SMT mode" );object_property_add_bool (obj,"vfio-no-msix-emulation" , spapr_get_msix_emulation,NULL ,NULL );
@@ -3352,27 +3349,25 @@ static void spapr_instance_init(Object *obj) &error_abort);object_property_set_description (obj,"kernel-addr" , stringify(KERNEL_LOAD_ADDR) -" for -kernel is the default" , -NULL ); +" for -kernel is the default" ); spapr->kernel_addr =KERNEL_LOAD_ADDR ;/* The machine class defines the default interrupt controller mode */ spapr->irq = smc->irq;object_property_add_str (obj,"ic-mode" , spapr_get_ic_mode, spapr_set_ic_mode,NULL );object_property_set_description (obj,"ic-mode" , -"Specifies the interrupt controller mode (xics, xive, dual)" , -NULL ); +"Specifies the interrupt controller mode (xics, xive, dual)" );object_property_add_str (obj,"host-model" , spapr_get_host_model, spapr_set_host_model, &error_abort);object_property_set_description (obj,"host-model" , -"Host model to advertise in guest device tree" , &error_abort); +"Host model to advertise in guest device tree" );object_property_add_str (obj,"host-serial" , spapr_get_host_serial, spapr_set_host_serial, &error_abort);object_property_set_description (obj,"host-serial" , -"Host serial number to advertise in guest device tree" , &error_abort); +"Host serial number to advertise in guest device tree" ); }static void spapr_machine_finalizefn (Object *obj)
hw/ppc/spapr_caps.c +1 -5
@@ -845,12 +845,8 @@ void spapr_caps_add_properties(SpaprMachineClass *smc, Error **errp) } desc =g_strdup_printf ("%s" , cap->description); -object_class_property_set_description (klass, name, desc, &local_err); +object_class_property_set_description (klass, name, desc);g_free (name);g_free (desc); -if (local_err) { -error_propagate (errp, local_err); -return ; - } } }
hw/ppc/spapr_rng.c +1 -2
@@ -103,8 +103,7 @@ static void spapr_rng_instance_init(Object *obj) }object_property_set_description (obj,"rng" , -"ID of the random number generator backend" , -NULL ); +"ID of the random number generator backend" ); }static void spapr_rng_realize (DeviceState *dev,Error **errp)
hw/riscv/sifive_u.c +2 -3
@@ -465,9 +465,8 @@ static void riscv_sifive_u_machine_instance_init(Object *obj)object_property_add_bool (obj,"start-in-flash" , sifive_u_get_start_in_flash, sifive_u_set_start_in_flash,NULL );object_property_set_description (obj,"start-in-flash" , -"Set on to tell QEMU's ROM to jump to " \ -"flash. Otherwise QEMU will jump to DRAM" , -NULL ); +"Set on to tell QEMU's ROM to jump to " +"flash. Otherwise QEMU will jump to DRAM" ); }static void riscv_sifive_u_soc_realize (DeviceState *dev,Error **errp)
hw/s390x/css-bridge.c +1 -2
@@ -144,8 +144,7 @@ static void virtual_css_bridge_class_init(ObjectClass *klass, void *data) prop_get_true, NULL, NULL);object_class_property_set_description (klass,"cssid-unrestricted" ,"A css device can use any cssid, regardless whether virtual" -" or not (read only, always true)" , -NULL ); +" or not (read only, always true)" ); }static const TypeInfo virtual_css_bridge_info = {
hw/s390x/s390-virtio-ccw.c +3 -6
@@ -602,24 +602,21 @@ static inline void s390_machine_initfn(Object *obj) machine_get_aes_key_wrap, machine_set_aes_key_wrap, NULL);object_property_set_description (obj,"aes-key-wrap" , -"enable/disable AES key wrapping using the CPACF wrapping key" , -NULL ); +"enable/disable AES key wrapping using the CPACF wrapping key" );object_property_set_bool (obj, true,"aes-key-wrap" ,NULL );object_property_add_bool (obj,"dea-key-wrap" , machine_get_dea_key_wrap, machine_set_dea_key_wrap,NULL );object_property_set_description (obj,"dea-key-wrap" , -"enable/disable DEA key wrapping using the CPACF wrapping key" , -NULL ); +"enable/disable DEA key wrapping using the CPACF wrapping key" );object_property_set_bool (obj, true,"dea-key-wrap" ,NULL );object_property_add_str (obj,"loadparm" , machine_get_loadparm, machine_set_loadparm,NULL );object_property_set_description (obj,"loadparm" ,"Up to 8 chars in set of [A-Za-z0-9. ] (lower case chars converted" " to upper case) to pass to machine loader, boot manager," -" and guest kernel" , -NULL ); +" and guest kernel" ); }static const TypeInfo ccw_machine_info = {
hw/sparc/sun4m.c +1 -2
@@ -797,8 +797,7 @@ static void ram_initfn(Object *obj) object_property_allow_set_link, OBJ_PROP_LINK_STRONG, &error_abort);object_property_set_description (obj,"memdev" ,"Set RAM backend" -"Valid value is ID of a hostmem backend" , - &error_abort); +"Valid value is ID of a hostmem backend" ); }static void ram_class_init (ObjectClass *klass,void *data)
hw/xen/xen-common.c +1 -1
@@ -201,7 +201,7 @@ static void xen_accel_class_init(ObjectClass *oc, void *data) xen_get_igd_gfx_passthru, xen_set_igd_gfx_passthru, &error_abort);object_class_property_set_description (oc,"igd-passthru" , -"Set on/off to enable/disable igd passthrou" , &error_abort); +"Set on/off to enable/disable igd passthrou" ); }#define TYPE_XEN_ACCEL ACCEL_CLASS_NAME("xen")
qom/object.c +4 -15
@@ -2835,38 +2835,27 @@ object_property_add_alias(Object *obj, const char *name, }object_property_set_description (obj, op->name, - target_prop->description, - &error_abort); + target_prop->description);return op; }void object_property_set_description (Object *obj,const char *name, -const char *description,Error **errp) +const char *description) {ObjectProperty *op; - op =object_property_find (obj, name, errp); -if (!op) { -return ; - } - + op =object_property_find (obj, name, &error_abort);g_free (op->description); op->description =g_strdup (description); }void object_class_property_set_description (ObjectClass *klass,const char *name, -const char *description, -Error **errp) +const char *description) {ObjectProperty *op; op =g_hash_table_lookup (klass->properties, name); -if (!op) { -error_setg (errp,"Property '.%s' not found" , name); -return ; - } -g_free (op->description); op->description =g_strdup (description); }
target/arm/cpu64.c +1 -2
@@ -785,8 +785,7 @@ static void aarch64_cpu_initfn(Object *obj) aarch64_cpu_set_aarch64, NULL);object_property_set_description (obj,"aarch64" ,"Set on/off to enable/disable aarch64 " -"execution state " , -NULL ); +"execution state " ); }static void aarch64_cpu_finalizefn (Object *obj)
target/arm/kvm.c +1 -1
@@ -204,7 +204,7 @@ void kvm_arm_add_vcpu_properties(Object *obj)object_property_set_description (obj,"kvm-no-adjvtime" ,"Set on to disable the adjustment of " "the virtual counter. VM stopped time " -"will be counted." , &error_abort); +"will be counted." ); }bool kvm_arm_pmu_supported (CPUState *cpu)
target/i386/sev.c +3 -3
@@ -251,19 +251,19 @@ qsev_guest_class_init(ObjectClass *oc, void *data) qsev_guest_set_sev_device, NULL);object_class_property_set_description (oc,"sev-device" , -"SEV device to use" ,NULL ); +"SEV device to use" );object_class_property_add_str (oc,"dh-cert-file" , qsev_guest_get_dh_cert_file, qsev_guest_set_dh_cert_file,NULL );object_class_property_set_description (oc,"dh-cert-file" , -"guest owners DH certificate (encoded with base64)" ,NULL ); +"guest owners DH certificate (encoded with base64)" );object_class_property_add_str (oc,"session-file" , qsev_guest_get_session_file, qsev_guest_set_session_file,NULL );object_class_property_set_description (oc,"session-file" , -"guest owners session parameters (encoded with base64)" ,NULL ); +"guest owners session parameters (encoded with base64)" ); } static void
target/ppc/compat.c +1 -1
@@ -324,7 +324,7 @@ void ppc_compat_add_property(Object *obj, const char *name, names =g_strjoinv (", " , namesv); desc =g_strdup_printf ("%s. Valid values are %s." , basedesc, names); -object_property_set_description (obj, name, desc, &local_err); +object_property_set_description (obj, name, desc);g_free (names);g_free (desc);
target/s390x/cpu_models.c +2 -2
@@ -1107,13 +1107,13 @@ void s390_cpu_model_register_props(Object *obj)const S390FeatDef *def =s390_feat_def (feat);object_property_add (obj, def->name,"bool" , get_feature, set_feature,NULL , (void *) feat,NULL ); -object_property_set_description (obj, def->name, def->desc ,NULL ); +object_property_set_description (obj, def->name, def->desc); }for (group =0 ; group <S390_FEAT_GROUP_MAX ; group++) {const S390FeatGroupDef *def =s390_feat_group_def (group);object_property_add (obj, def->name,"bool" , get_feature_group, set_feature_group,NULL , (void *) group,NULL ); -object_property_set_description (obj, def->name, def->desc ,NULL ); +object_property_set_description (obj, def->name, def->desc); } }
Signature · 1 line
2.21.1
PATCH 2/17 qom: Clean up inconsistent use of gchar * vs. char *
In reply to Markus ArmbrusterUses of gchar * in qom/object.h:
* ObjectProperty member @name
Functions that take a property name argument all use char *. Change the member to match.
* ObjectProperty member @type
Functions that take a property type argument or return it all use char *. Change the member to match.
* ObjectProperty member @description
Functions that take a property description argument all use char *. Change the member to match.
* object_resolve_path_component() parameter @part
Path components are property names. Most callers pass char * arguments. Change the parameter to match. Adjust the few callers that pass gchar * to pass char *.
* Return value of object_get_canonical_path_component(), object_get_canonical_path()
Most callers convert their return values right back to char *. Change the return value to match. Adjust the few callers where that would add a conversion to gchar * to use char * instead.
--- include/qom/object.h | 12 +++++----- monitor/monitor-internal.h | 2 +- hw/dma/xlnx-zdma.c | 4 ++-- hw/net/virtio-net.c | 2 +- hw/ppc/spapr_drc.c | 2 +- memory.c | 4 ++-- qom/container.c | 2 +- qom/object.c | 46 ++++++++++++++++++++------------------ 8 files changed, 38 insertions(+), 36 deletions(-)
include/qom/object.h +6 -6
@@ -369,9 +369,9 @@ typedef void (ObjectPropertyInit)(Object *obj, ObjectProperty *prop);struct ObjectProperty { -gchar *name; -gchar *type; -gchar *description; +char *name; +char *type; +char *description;ObjectPropertyAccessor *get;ObjectPropertyAccessor *set;ObjectPropertyResolve *resolve;
@@ -1421,7 +1421,7 @@ Object *object_get_internal_root(void);* path is the path within the composition tree starting from the root. * %NULL if the object doesn't have a parent (and thus a canonical path). */ -gchar *object_get_canonical_path_component (Object *obj); +char *object_get_canonical_path_component (Object *obj);/** * object_get_canonical_path:
@@ -1429,7 +1429,7 @@ gchar *object_get_canonical_path_component(Object *obj);* Returns: The canonical path for a object. This is the path within the * composition tree starting from the root. */ -gchar *object_get_canonical_path (Object *obj); +char *object_get_canonical_path (Object *obj);/** * object_resolve_path:
@@ -1487,7 +1487,7 @@ Object *object_resolve_path_type(const char *path, const char *typename,* * Returns: The resolved object or NULL on path lookup failure. */ -Object *object_resolve_path_component (Object *parent,const gchar *part); +Object *object_resolve_path_component (Object *parent,const char *part);/** * object_property_add_child:
monitor/monitor-internal.h +1 -1
@@ -91,7 +91,7 @@ struct Monitor {bool skip_flush;bool use_io_thread; -gchar *mon_cpu_path; +char *mon_cpu_path;QTAILQ_ENTRY (Monitor) entry;/*
hw/dma/xlnx-zdma.c +2 -2
@@ -710,7 +710,7 @@ static uint64_t zdma_read(void *opaque, hwaddr addr, unsigned size)RegisterInfo *r = &s->regs_info[addr /4 ];if (!r->data) { -gchar *path =object_get_canonical_path (OBJECT (s)); +char *path =object_get_canonical_path (OBJECT (s));qemu_log ("%s: Decode error: read from %" HWADDR_PRIx"\n" , path, addr);
@@ -729,7 +729,7 @@ static void zdma_write(void *opaque, hwaddr addr, uint64_t value,RegisterInfo *r = &s->regs_info[addr /4 ];if (!r->data) { -gchar *path =object_get_canonical_path (OBJECT (s)); +char *path =object_get_canonical_path (OBJECT (s));qemu_log ("%s: Decode error: write to %" HWADDR_PRIx"=%" PRIx64"\n" , path, addr, value);
hw/net/virtio-net.c +1 -1
@@ -399,7 +399,7 @@ static void rxfilter_notify(NetClientState *nc)VirtIONet *n =qemu_get_nic_opaque (nc);if (nc->rxfilter_notify_enabled) { -gchar *path =object_get_canonical_path (OBJECT (n->qdev)); +char *path =object_get_canonical_path (OBJECT (n->qdev));qapi_event_send_nic_rx_filter_changed (!!n->netclient_name, n->netclient_name, path);g_free (path);
hw/ppc/spapr_drc.c +1 -1
@@ -518,7 +518,7 @@ static void realize(DeviceState *d, Error **errp)SpaprDrc *drc =SPAPR_DR_CONNECTOR (d);Object *root_container;gchar *link_name; -gchar *child_name; +char *child_name;Error *err =NULL ;trace_spapr_drc_realize (spapr_drc_index (drc));
memory.c +2 -2
@@ -1175,7 +1175,7 @@ static void memory_region_get_container(Object *obj, Visitor *v, Error **errp) {MemoryRegion *mr =MEMORY_REGION (obj); -gchar *path = (gchar *)"" ; +char *path = (char *)"" ;if (mr->container) { path =object_get_canonical_path (OBJECT (mr->container));
@@ -2845,7 +2845,7 @@ static void mtree_expand_owner(const char *label, Object *obj)if (dev && dev->id) {qemu_printf (" id=%s" , dev->id); }else { -gchar *canonical_path =object_get_canonical_path (obj); +char *canonical_path =object_get_canonical_path (obj);if (canonical_path) {qemu_printf (" path=%s" , canonical_path);g_free (canonical_path);
qom/container.c +1 -1
@@ -28,7 +28,7 @@ static void container_register_types(void)Object *container_get (Object *root,const char *path) {Object *obj, *child; -gchar **parts; +char **parts;int i; parts =g_strsplit (path,"/" ,0 );
qom/object.c +24 -22
154 lines not on this page · raw message
Signature · 1 line
2.21.1
PATCH 5/17 qom: Make all the object_property_add_FOO() return the property
In reply to Markus ArmbrusterSome object_property_add_FOO() return the newly added property, some don't. Clean that up.
--- include/qom/object.h | 50 ++++++--- qom/object.c | 250 ++++++++++++++++++++++--------------------- 2 files changed, 164 insertions(+), 136 deletions(-)
include/qom/object.h +37 -13
@@ -1505,9 +1505,11 @@ Object *object_resolve_path_component(Object *parent, const char *part);* The value of a child property as a C string will be the child object's * canonical path. It can be retrieved using object_property_get_str(). * The child object itself can be retrieved using object_property_get_link(). +* +* Returns: The newly added property on success, or %NULL on failure. */ -void object_property_add_child (Object *obj,const char *name, -Object *child,Error **errp); +ObjectProperty *object_property_add_child (Object *obj,const char *name, +Object *child,Error **errp); typedef enum { /* Unref the link pointer when the property is deleted */
@@ -1556,8 +1558,10 @@ void object_property_allow_set_link(const Object *, const char *,* <code>@flags</code> <code>OBJ_PROP_LINK_STRONG</code> bit is set, * the reference count is decremented when the property is deleted or * modified. +* +* Returns: The newly added property on success, or %NULL on failure. */ -void object_property_add_link(Object *obj, const char *name, +ObjectProperty *object_property_add_link(Object *obj, const char *name, const char *type, Object **targetp, void (*check)(const Object *obj, const char *name, Object *val, Error **errp),
@@ -1583,8 +1587,10 @@ ObjectProperty *object_class_property_add_link(ObjectClass *oc,* * Add a string property using getters/setters. This function will add a * property of type 'string'. +* +* Returns: The newly added property on success, or %NULL on failure. */ -void object_property_add_str (Object *obj,const char *name, +ObjectProperty *object_property_add_str (Object *obj,const char *name,char *(*get)(Object *,Error **),void (*set)(Object *,const char *,Error **),Error **errp);
@@ -1606,8 +1612,10 @@ ObjectProperty *object_class_property_add_str(ObjectClass *klass,* * Add a bool property using getters/setters. This function will add a * property of type 'bool'. +* +* Returns: The newly added property on success, or %NULL on failure. */ -void object_property_add_bool (Object *obj,const char *name, +ObjectProperty *object_property_add_bool (Object *obj,const char *name,bool (*get)(Object *,Error **),void (*set)(Object *,bool ,Error **),Error **errp);
@@ -1629,8 +1637,10 @@ ObjectProperty *object_class_property_add_bool(ObjectClass *klass,* * Add an enum property using getters/setters. This function will add a * property of type '@typename'. +* +* Returns: The newly added property on success, or %NULL on failure. */ -void object_property_add_enum(Object *obj, const char *name, +ObjectProperty *object_property_add_enum(Object *obj, const char *name, const char *typename, const QEnumLookup *lookup, int (*get)(Object *, Error **),
@@ -1654,8 +1664,10 @@ ObjectProperty *object_class_property_add_enum(ObjectClass *klass,* * Add a read-only struct tm valued property using a getter function. * This function will add a property of type 'struct tm'. +* +* Returns: The newly added property on success, or %NULL on failure. */ -void object_property_add_tm (Object *obj,const char *name, +ObjectProperty *object_property_add_tm (Object *obj,const char *name,void (*get)(Object *,struct tm *,Error **),Error **errp);
@@ -1683,8 +1695,10 @@ typedef enum {* * Add an integer property in memory. This function will add a * property of type 'uint8'. +* +* Returns: The newly added property on success, or %NULL on failure. */ -void object_property_add_uint8_ptr (Object *obj,const char *name, +ObjectProperty *object_property_add_uint8_ptr (Object *obj,const char *name,const uint8_t *v,ObjectPropertyFlags flags,Error **errp);
@@ -1704,8 +1718,10 @@ ObjectProperty *object_class_property_add_uint8_ptr(ObjectClass *klass,* * Add an integer property in memory. This function will add a * property of type 'uint16'. +* +* Returns: The newly added property on success, or %NULL on failure. */ -void object_property_add_uint16_ptr (Object *obj,const char *name, +ObjectProperty *object_property_add_uint16_ptr (Object *obj,const char *name,const uint16_t *v,ObjectPropertyFlags flags,Error **errp);
@@ -1726,8 +1742,10 @@ ObjectProperty *object_class_property_add_uint16_ptr(ObjectClass *klass,* * Add an integer property in memory. This function will add a * property of type 'uint32'. +* +* Returns: The newly added property on success, or %NULL on failure. */ -void object_property_add_uint32_ptr (Object *obj,const char *name, +ObjectProperty *object_property_add_uint32_ptr (Object *obj,const char *name,const uint32_t *v,ObjectPropertyFlags flags,Error **errp);
@@ -1748,8 +1766,10 @@ ObjectProperty *object_class_property_add_uint32_ptr(ObjectClass *klass,* * Add an integer property in memory. This function will add a * property of type 'uint64'. +* +* Returns: The newly added property on success, or %NULL on failure. */ -void object_property_add_uint64_ptr (Object *obj,const char *name, +ObjectProperty *object_property_add_uint64_ptr (Object *obj,const char *name,const uint64_t *v,ObjectPropertyFlags flags,Error **Errp);
@@ -1775,8 +1795,10 @@ ObjectProperty *object_class_property_add_uint64_ptr(ObjectClass *klass,* this property exists. In the case of a child object or an alias on the same * object this will be the case. For aliases to other objects the caller is * responsible for taking a reference. +* +* Returns: The newly added property on success, or %NULL on failure. */ -void object_property_add_alias (Object *obj,const char *name, +ObjectProperty *object_property_add_alias (Object *obj,const char *name,Object *target_obj,const char *target_name,Error **errp);
@@ -1794,8 +1816,10 @@ void object_property_add_alias(Object *obj, const char *name,* this property exists. In the case @target is a child of @obj, * this will be the case. Otherwise, the caller is responsible for * taking a reference. +* +* Returns: The newly added property on success, or %NULL on failure. */ -void object_property_add_const_link (Object *obj,const char *name, +ObjectProperty *object_property_add_const_link (Object *obj,const char *name,Object *target,Error **errp);/**
qom/object.c +127 -123
430 lines not on this page · raw message
Signature · 1 line
2.21.1
cover qom: Spring cleaning
Includes one actual bug fix for s390x.
Markus Armbruster (17):
qom: Clearer reference counting in object_initialize_childv()
qom: Clean up inconsistent use of gchar * vs. char *
qom: Drop object_property_del_child()'s unused parameter @errp
qom: Change object_property_get_uint16List() to match its doc
qom: Make all the object_property_add_FOO() return the property
qom: Drop object_property_set_description() parameter @errp tests/check-qom-proplist: Improve iterator coverage s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes,eaes}-256 hw/isa/superio: Make the components QOM children
e1000: Don't run e1000_instance_init() twice hw/arm/bcm2835: Drop futile attempts at QOM-adopting memory
qdev: Clean up qdev_connect_gpio_out_named()
qom: Drop parameter @errp of object_property_add() & friends Drop more @errp parameters after previous commit
qdev: Unrealize must not fail
spapr_pci: Drop some dead error handling
qom: Drop @errp parameter of object_property_del()
hw/9pfs/9p.h | 2 +- hw/s390x/virtio-ccw.h | 2 +- hw/sd/sdhci-internal.h | 2 +- hw/usb/ccid.h | 2 +- hw/usb/hcd-ehci.h | 2 +- include/hw/acpi/ich9.h | 2 +- include/hw/ppc/spapr.h | 2 +- include/hw/qdev-core.h | 6 +- include/hw/s390x/s390-ccw.h | 2 +- include/hw/scsi/scsi.h | 2 +- include/hw/usb.h | 2 +- include/hw/xen/xen-block.h | 2 +- include/hw/xen/xen-bus.h | 2 +- include/qom/object.h | 153 ++++----- include/sysemu/sysemu.h | 2 +- monitor/monitor-internal.h | 2 +- target/ppc/cpu.h | 3 +- target/s390x/cpu_features_def.inc.h | 2 +- accel/kvm/kvm-all.c | 8 +- accel/tcg/tcg-all.c | 7 +- authz/list.c | 5 +- authz/listfile.c | 6 +- authz/pamacct.c | 3 +- authz/simple.c | 3 +- backends/cryptodev-vhost-user.c | 3 +- backends/cryptodev.c | 2 +- backends/dbus-vmstate.c | 6 +- backends/hostmem-file.c | 11 +- backends/hostmem-memfd.c | 17 +- backends/hostmem.c | 35 +- backends/rng-egd.c | 3 +- backends/rng-random.c | 3 +- backends/rng.c | 3 +- backends/vhost-user.c | 2 +- block/throttle-groups.c | 6 +- bootdevice.c | 10 +- chardev/char-socket.c | 4 +- chardev/char.c | 7 +- crypto/secret.c | 18 +- crypto/tlscreds.c | 12 +- crypto/tlscredsanon.c | 3 +- crypto/tlscredspsk.c | 6 +- crypto/tlscredsx509.c | 9 +- hw/9pfs/9p.c | 4 +- hw/9pfs/virtio-9p-device.c | 4 +- hw/acpi/ich9.c | 25 +- hw/acpi/pcihp.c | 9 +- hw/acpi/piix4.c | 15 +- hw/arm/allwinner-a10.c | 2 +- hw/arm/allwinner-h3.c | 12 +- hw/arm/armv7m.c | 2 +- hw/arm/aspeed.c | 4 +- hw/arm/aspeed_ast2600.c | 13 +- hw/arm/aspeed_soc.c | 13 +- hw/arm/bcm2835_peripherals.c | 28 +- hw/arm/bcm2836.c | 16 +- hw/arm/cubieboard.c | 3 +- hw/arm/mcimx6ul-evk.c | 2 +- hw/arm/mcimx7d-sabre.c | 2 +- hw/arm/msf2-soc.c | 3 +- hw/arm/nrf51_soc.c | 3 +- hw/arm/orangepi.c | 3 +- hw/arm/raspi.c | 3 +- hw/arm/sabrelite.c | 2 +- hw/arm/sbsa-ref.c | 5 +- hw/arm/vexpress.c | 10 +- hw/arm/virt.c | 39 +-- hw/arm/xlnx-versal-virt.c | 3 +- hw/arm/xlnx-versal.c | 10 +- hw/arm/xlnx-zcu102.c | 10 +- hw/arm/xlnx-zynqmp.c | 9 +- hw/audio/intel-hda.c | 2 +- hw/audio/marvell_88w8618.c | 2 +- hw/audio/pcspk.c | 2 +- hw/block/fdc.c | 4 +- hw/block/nvme.c | 2 +- hw/block/pflash_cfi02.c | 2 +- hw/block/vhost-user-blk.c | 4 +- hw/block/virtio-blk.c | 4 +- hw/block/xen-block.c | 8 +- hw/char/serial-pci-multi.c | 2 +- hw/char/serial-pci.c | 2 +- hw/char/serial.c | 2 +- hw/char/virtio-console.c | 2 +- hw/char/virtio-serial-bus.c | 8 +- hw/core/bus.c | 24 +- hw/core/cpu.c | 2 +- hw/core/generic-loader.c | 2 +- hw/core/machine-qmp-cmds.c | 6 +- hw/core/machine.c | 87 +++-- hw/core/qdev-properties.c | 11 +- hw/core/qdev.c | 74 ++--- hw/cpu/core.c | 4 +- hw/display/bochs-display.c | 3 +- hw/display/sm501.c | 2 +- hw/display/vga-pci.c | 4 +- hw/display/vhost-user-gpu-pci.c | 3 +- hw/display/vhost-user-gpu.c | 2 +- hw/display/vhost-user-vga.c | 3 +- hw/display/virtio-gpu-base.c | 2 +- hw/display/xlnx_dp.c | 7 +- hw/dma/rc4030.c | 2 +- hw/dma/sparc32_dma.c | 10 +- hw/dma/xilinx_axidma.c | 9 +- hw/dma/xlnx-zdma.c | 7 +- hw/gpio/aspeed_gpio.c | 2 +- hw/hyperv/hyperv.c | 2 +- hw/i386/kvm/apic.c | 2 +- hw/i386/microvm.c | 29 +- hw/i386/pc.c | 18 +- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 4 +- hw/i386/pc_sysfw.c | 7 +- hw/i386/x86.c | 14 +- hw/ide/macio.c | 2 +- hw/ide/qdev.c | 6 +- hw/input/vhost-user-input.c | 2 +- hw/input/virtio-input-hid.c | 2 +- hw/input/virtio-input-host.c | 2 +- hw/input/virtio-input.c | 9 +- hw/intc/apic.c | 2 +- hw/intc/apic_common.c | 6 +- hw/intc/ioapic.c | 2 +- hw/intc/s390_flic.c | 4 +- hw/intc/xics.c | 4 +- hw/intc/xive.c | 2 +- hw/ipack/ipack.c | 6 +- hw/ipmi/ipmi.c | 3 +- hw/isa/isa-superio.c | 13 +- hw/isa/lpc_ich9.c | 8 +- hw/mem/nvdimm.c | 4 +- hw/mem/pc-dimm.c | 4 +- hw/microblaze/petalogix_ml605_mmu.c | 6 +- hw/misc/aspeed_sdmc.c | 2 +- hw/misc/edu.c | 3 +- hw/misc/mac_via.c | 4 +- hw/misc/macio/gpio.c | 2 +- hw/misc/macio/macio.c | 4 +- hw/misc/macio/pmu.c | 2 +- hw/misc/pca9552.c | 2 +- hw/misc/tmp105.c | 2 +- hw/misc/tmp421.c | 8 +- hw/net/cadence_gem.c | 3 +- hw/net/can/can_kvaser_pci.c | 2 +- hw/net/can/can_mioe3680_pci.c | 4 +- hw/net/can/can_pcm3680_pci.c | 4 +- hw/net/e1000.c | 3 +- hw/net/e1000e.c | 2 +- hw/net/eepro100.c | 2 +- hw/net/lance.c | 2 +- hw/net/lasi_i82596.c | 2 +- hw/net/ne2000-isa.c | 2 +- hw/net/ne2000-pci.c | 2 +- hw/net/pcnet-pci.c | 2 +- hw/net/rtl8139.c | 2 +- hw/net/spapr_llan.c | 2 +- hw/net/sungem.c | 2 +- hw/net/sunhme.c | 2 +- hw/net/tulip.c | 2 +- hw/net/virtio-net.c | 6 +- hw/net/vmxnet3.c | 2 +- hw/net/xilinx_axienet.c | 9 +- hw/nios2/10m50_devboard.c | 3 +- hw/nvram/fw_cfg.c | 4 +- hw/nvram/mac_nvram.c | 2 +- hw/pci-host/grackle.c | 2 +- hw/pci-host/i440fx.c | 12 +- hw/pci-host/pnv_phb3_msi.c | 3 +- hw/pci-host/pnv_phb3_pbcq.c | 3 +- hw/pci-host/q35.c | 20 +- hw/pci-host/sabre.c | 2 +- hw/pci-host/uninorth.c | 8 +- hw/pci/pci.c | 14 +- hw/pci/pcie.c | 2 +- hw/pci/shpc.c | 2 +- hw/pcmcia/pxa2xx.c | 2 +- hw/ppc/e500.c | 8 +- hw/ppc/mac_newworld.c | 7 +- hw/ppc/mac_oldworld.c | 2 +- hw/ppc/pnv.c | 16 +- hw/ppc/pnv_bmc.c | 5 +- hw/ppc/pnv_core.c | 4 +- hw/ppc/pnv_psi.c | 2 +- hw/ppc/prep.c | 6 +- hw/ppc/spapr.c | 59 ++-- hw/ppc/spapr_caps.c | 16 +- hw/ppc/spapr_cpu_core.c | 7 +- hw/ppc/spapr_drc.c | 36 +- hw/ppc/spapr_iommu.c | 4 +- hw/ppc/spapr_irq.c | 2 +- hw/ppc/spapr_pci.c | 98 ++---- hw/ppc/spapr_rng.c | 3 +- hw/ppc/spapr_rtc.c | 2 +- hw/ppc/spapr_tpm_proxy.c | 2 +- hw/riscv/sifive_u.c | 7 +- hw/riscv/virt.c | 5 +- hw/rtc/mc146818rtc.c | 4 +- hw/s390x/ap-bridge.c | 2 +- hw/s390x/css-bridge.c | 9 +- hw/s390x/event-facility.c | 6 +- hw/s390x/s390-ccw.c | 4 +- hw/s390x/s390-pci-bus.c | 4 +- hw/s390x/s390-skeys.c | 4 +- hw/s390x/s390-stattrib.c | 4 +- hw/s390x/s390-virtio-ccw.c | 19 +- hw/s390x/sclp.c | 5 +- hw/s390x/tod.c | 2 +- hw/s390x/virtio-ccw-balloon.c | 4 +- hw/s390x/virtio-ccw-blk.c | 2 +- hw/s390x/virtio-ccw-net.c | 2 +- hw/s390x/virtio-ccw.c | 8 +- hw/scsi/lsi53c895a.c | 2 +- hw/scsi/scsi-bus.c | 17 +- hw/scsi/scsi-disk.c | 2 +- hw/scsi/vhost-scsi.c | 4 +- hw/scsi/vhost-user-scsi.c | 4 +- hw/scsi/virtio-scsi.c | 2 +- hw/sd/sdhci-pci.c | 2 +- hw/sd/sdhci.c | 6 +- hw/sparc/sun4m.c | 7 +- hw/sparc64/sun4u.c | 2 +- hw/ssi/xilinx_spips.c | 3 +- hw/usb/bus.c | 18 +- hw/usb/ccid-card-emulated.c | 2 +- hw/usb/dev-audio.c | 2 +- hw/usb/dev-hid.c | 2 +- hw/usb/dev-hub.c | 2 +- hw/usb/dev-network.c | 4 +- hw/usb/dev-smartcard-reader.c | 11 +- hw/usb/dev-storage.c | 2 +- hw/usb/dev-uas.c | 2 +- hw/usb/dev-wacom.c | 2 +- hw/usb/hcd-ehci-pci.c | 2 +- hw/usb/hcd-ehci.c | 2 +- hw/usb/host-libusb.c | 4 +- hw/usb/redirect.c | 4 +- hw/vfio/ap.c | 2 +- hw/vfio/ccw.c | 6 +- hw/vfio/pci-quirks.c | 6 +- hw/vfio/pci.c | 2 +- hw/virtio/vhost-scsi-pci.c | 2 +- hw/virtio/vhost-user-blk-pci.c | 2 +- hw/virtio/vhost-user-fs.c | 2 +- hw/virtio/vhost-user-input-pci.c | 3 +- hw/virtio/vhost-user-scsi-pci.c | 2 +- hw/virtio/vhost-vsock.c | 2 +- hw/virtio/virtio-balloon-pci.c | 4 +- hw/virtio/virtio-balloon.c | 6 +- hw/virtio/virtio-blk-pci.c | 2 +- hw/virtio/virtio-crypto.c | 2 +- hw/virtio/virtio-iommu.c | 2 +- hw/virtio/virtio-net-pci.c | 2 +- hw/virtio/virtio-pmem.c | 2 +- hw/virtio/virtio-rng.c | 4 +- hw/virtio/virtio.c | 11 +- hw/watchdog/wdt_diag288.c | 2 +- hw/xen/xen-bus.c | 12 +- hw/xen/xen-common.c | 5 +- iothread.c | 6 +- memory.c | 14 +- net/can/can_host.c | 3 +- net/can/can_socketcan.c | 3 +- net/colo-compare.c | 20 +- net/dump.c | 4 +- net/filter-buffer.c | 2 +- net/filter-mirror.c | 10 +- net/filter-rewriter.c | 2 +- net/filter.c | 15 +- qdev-monitor.c | 4 +- qom/container.c | 4 +- qom/object.c | 499 +++++++++++----------------- qom/object_interfaces.c | 8 +- scsi/pr-manager-helper.c | 3 +- softmmu/vl.c | 7 +- target/arm/cpu.c | 11 +- target/arm/cpu64.c | 11 +- target/arm/kvm.c | 4 +- target/i386/cpu.c | 92 +++-- target/i386/sev.c | 23 +- target/ppc/compat.c | 14 +- target/ppc/translate_init.inc.c | 9 +- target/s390x/cpu.c | 2 +- target/s390x/cpu_models.c | 15 +- tests/check-qom-proplist.c | 70 ++-- tests/test-qdev-global-props.c | 4 +- ui/console.c | 7 +- ui/input-barrier.c | 14 +- ui/input-linux.c | 8 +- 288 files changed, 1127 insertions(+), 1604 deletions(-)
Signature · 1 line
2.21.1
PATCH 15/17 qdev: Unrealize must not fail
Devices may have component devices and buses.
Device realization may fail. Realization is recursive: a device's realize() method realizes its components, and device_set_realized() realizes its buses (which should in turn realize the devices on that bus, except bus_set_realized() doesn't implement that, yet).
When realization of a component or bus fails, we need to roll back:
unrealize everything we realized so far. If any of these unrealizes failed, the device would be left in an inconsistent state. Must not happen.
device_set_realized() lets it happen: it ignores errors in the roll back code starting at label child_realize_fail.
Since realization is recursive, unrealization must be recursive, too. But how could a partly failed unrealize be rolled back? We'd have to re-realize, which can fail. This design is fundamentally broken.
device_set_realized() does not roll back at all. Instead, it keeps unrealizing, ignoring further errors.
It can screw up even for a device with no buses: if the lone dc->unrealize() fails, it still unregisters vmstate, and calls listeners' unrealize() callback.
bus_set_realized() does not roll back either. Instead, it stops unrealizing.
Fortunately, no unrealize method can fail, as we'll see below.
To fix the design error, drop parameter @errp from all the unrealize methods.
Any unrealize method that uses @errp now needs an update. This leads us to unrealize() methods that can fail. Merely passing it to another unrealize method cannot cause failure, though. Here are the ones that do other things with @errp:
* virtio_serial_device_unrealize()
Fails when qbus_set_hotplug_handler() fails, but still does all the other work. On failure, the device would stay realized with its resources completely gone. Oops. Can't happen, because qbus_set_hotplug_handler() can't actually fail here. Pass &error_abort to qbus_set_hotplug_handler() instead.
* hw/ppc/spapr_drc.c's unrealize()
Fails when object_property_del() fails, but all the other work is already done. On failure, the device would stay realized with its vmstate registration gone. Oops. Can't happen, because object_property_del() can't actually fail here. Pass &error_abort to object_property_del() instead.
* spapr_phb_unrealize()
Fails and bails out when remove_drcs() fails, but other work is already done. On failure, the device would stay realized with some of its resources gone. Oops. remove_drcs() fails only when chassis_from_bus()'s object_property_get_uint() fails, and it can't here. Pass &error_abort to remove_drcs() instead.
Therefore, no unrealize method can fail before this patch.
device_set_realized()'s recursive unrealization via bus uses object_property_set_bool(). Can't drop @errp there, so pass &error_abort.
We similarly unrealize with object_property_set_bool() elsewhere, always ignoring errors. Pass &error_abort instead.
Several unrealize methods no longer handle errors from other unrealize
methods: virtio_9p_device_unrealize(), virtio_input_device_unrealize(), scsi_qdev_unrealize(), ... Much of the deleted error handling looks wrong anyway.
One unrealize methods no longer ignore such errors:usb_ehci_pci_exit().
Several realize methods no longer ignore errors when rolling back:v9fs_device_realize_common(), pci_qdev_unrealize(), spapr_phb_realize(), usb_qdev_realize(), vfio_ccw_realize(), virtio_device_realize().
--- hw/9pfs/9p.h | 2 +- hw/s390x/virtio-ccw.h | 2 +- hw/sd/sdhci-internal.h | 2 +- hw/usb/ccid.h | 2 +- hw/usb/hcd-ehci.h | 2 +- include/hw/qdev-core.h | 4 ++-- include/hw/s390x/s390-ccw.h | 2 +- include/hw/scsi/scsi.h | 2 +- include/hw/usb.h | 2 +- include/hw/xen/xen-block.h | 2 +- include/hw/xen/xen-bus.h | 2 +- hw/9pfs/9p.c | 4 ++-- hw/9pfs/virtio-9p-device.c | 4 ++-- hw/acpi/pcihp.c | 2 +- hw/audio/intel-hda.c | 2 +- hw/block/pflash_cfi02.c | 2 +- hw/block/vhost-user-blk.c | 2 +- hw/block/virtio-blk.c | 2 +- hw/block/xen-block.c | 8 ++++---- hw/char/serial-pci-multi.c | 2 +- hw/char/serial-pci.c | 2 +- hw/char/serial.c | 2 +- hw/char/virtio-console.c | 2 +- hw/char/virtio-serial-bus.c | 8 ++++---- hw/core/bus.c | 17 ++++------------- hw/core/cpu.c | 2 +- hw/core/generic-loader.c | 2 +- hw/core/qdev.c | 17 ++++++----------- hw/display/virtio-gpu-base.c | 2 +- hw/dma/rc4030.c | 2 +- hw/i386/kvm/apic.c | 2 +- hw/i386/pc.c | 4 ++-- hw/ide/qdev.c | 4 ++-- hw/input/virtio-input-hid.c | 2 +- hw/input/virtio-input-host.c | 2 +- hw/input/virtio-input.c | 9 ++------- hw/intc/apic.c | 2 +- hw/intc/apic_common.c | 4 ++-- hw/intc/ioapic.c | 2 +- hw/intc/xics.c | 2 +- hw/ipack/ipack.c | 6 ++---- hw/mem/pc-dimm.c | 2 +- hw/net/virtio-net.c | 2 +- hw/nvram/mac_nvram.c | 2 +- hw/pci/pci.c | 14 +++++++------- hw/pci/pcie.c | 2 +- hw/pci/shpc.c | 2 +- hw/ppc/pnv_core.c | 2 +- hw/ppc/spapr.c | 8 ++++---- hw/ppc/spapr_cpu_core.c | 2 +- hw/ppc/spapr_drc.c | 14 ++++---------- hw/ppc/spapr_iommu.c | 2 +- hw/ppc/spapr_pci.c | 14 +++++--------- hw/ppc/spapr_tpm_proxy.c | 2 +- hw/s390x/css-bridge.c | 2 +- hw/s390x/s390-ccw.c | 2 +- hw/s390x/s390-pci-bus.c | 4 ++-- hw/s390x/virtio-ccw.c | 8 ++++---- hw/scsi/lsi53c895a.c | 2 +- hw/scsi/scsi-bus.c | 13 ++++--------- hw/scsi/scsi-disk.c | 2 +- hw/scsi/vhost-scsi.c | 2 +- hw/scsi/vhost-user-scsi.c | 2 +- hw/scsi/virtio-scsi.c | 2 +- hw/sd/sdhci-pci.c | 2 +- hw/sd/sdhci.c | 6 +++--- hw/usb/bus.c | 12 ++++++------ hw/usb/ccid-card-emulated.c | 2 +- hw/usb/dev-audio.c | 2 +- hw/usb/dev-hid.c | 2 +- hw/usb/dev-hub.c | 2 +- hw/usb/dev-network.c | 2 +- hw/usb/dev-smartcard-reader.c | 11 +++-------- hw/usb/dev-uas.c | 2 +- hw/usb/dev-wacom.c | 2 +- hw/usb/hcd-ehci-pci.c | 2 +- hw/usb/hcd-ehci.c | 2 +- hw/usb/host-libusb.c | 2 +- hw/usb/redirect.c | 2 +- hw/vfio/ap.c | 2 +- hw/vfio/ccw.c | 6 +++--- hw/virtio/vhost-user-fs.c | 2 +- hw/virtio/vhost-vsock.c | 2 +- hw/virtio/virtio-balloon.c | 2 +- hw/virtio/virtio-crypto.c | 2 +- hw/virtio/virtio-iommu.c | 2 +- hw/virtio/virtio-pmem.c | 2 +- hw/virtio/virtio-rng.c | 2 +- hw/virtio/virtio.c | 11 +++-------- hw/watchdog/wdt_diag288.c | 2 +- hw/xen/xen-bus.c | 12 ++++++------ target/i386/cpu.c | 9 ++------- target/ppc/translate_init.inc.c | 9 ++------- 93 files changed, 158 insertions(+), 214 deletions(-)
hw/9pfs/9p.h +1 -1
@@ -423,7 +423,7 @@ int v9fs_name_to_path(V9fsState *s, V9fsPath *dirpath, const char *name, V9fsPath *path);int v9fs_device_realize_common (V9fsState *s,const V9fsTransport *t,Error **errp); -void v9fs_device_unrealize_common (V9fsState *s,Error **errp); +void v9fs_device_unrealize_common (V9fsState *s);V9fsPDU *pdu_alloc (V9fsState *s);void pdu_free (V9fsPDU *pdu);
hw/s390x/virtio-ccw.h +1 -1
@@ -76,7 +76,7 @@ typedef struct VirtioCcwDevice VirtioCcwDevice;typedef struct VirtIOCCWDeviceClass {CCWDeviceClass parent_class;void (*realize)(VirtioCcwDevice *dev,Error **errp); -void (*unrealize)(VirtioCcwDevice *dev,Error **errp); +void (*unrealize)(VirtioCcwDevice *dev);void (*parent_reset)(DeviceState *dev); }VirtIOCCWDeviceClass ;
hw/sd/sdhci-internal.h +1 -1
@@ -335,7 +335,7 @@ extern const VMStateDescription sdhci_vmstate;void sdhci_initfn (SDHCIState *s);void sdhci_uninitfn (SDHCIState *s);void sdhci_common_realize (SDHCIState *s,Error **errp); -void sdhci_common_unrealize (SDHCIState *s,Error **errp); +void sdhci_common_unrealize (SDHCIState *s);void sdhci_common_class_init (ObjectClass *klass,void *data);#endif
hw/usb/ccid.h +1 -1
@@ -36,7 +36,7 @@ typedef struct CCIDCardClass {const uint8_t *apdu, uint32_t len);void (*realize)(CCIDCardState *card,Error **errp); -void (*unrealize)(CCIDCardState *card,Error **errp); +void (*unrealize)(CCIDCardState *card); } CCIDCardClass;/*
hw/usb/hcd-ehci.h +1 -1
@@ -324,7 +324,7 @@ extern const VMStateDescription vmstate_ehci;void usb_ehci_init (EHCIState *s,DeviceState *dev);void usb_ehci_finalize (EHCIState *s);void usb_ehci_realize (EHCIState *s,DeviceState *dev,Error **errp); -void usb_ehci_unrealize (EHCIState *s,DeviceState *dev,Error **errp); +void usb_ehci_unrealize (EHCIState *s,DeviceState *dev);void ehci_reset (void *opaque);#define TYPE_PCI_EHCI "pci-ehci-usb"
include/hw/qdev-core.h +2 -2
@@ -30,10 +30,10 @@ typedef enum DeviceCategory { } DeviceCategory;typedef void (*DeviceRealize )(DeviceState *dev,Error **errp); -typedef void (*DeviceUnrealize )(DeviceState *dev,Error **errp); +typedef void (*DeviceUnrealize )(DeviceState *dev);typedef void (*DeviceReset )(DeviceState *dev);typedef void (*BusRealize )(BusState *bus,Error **errp); -typedef void (*BusUnrealize )(BusState *bus,Error **errp); +typedef void (*BusUnrealize )(BusState *bus);/** * DeviceClass:
include/hw/s390x/s390-ccw.h +1 -1
@@ -33,7 +33,7 @@ typedef struct S390CCWDevice { typedef struct S390CCWDeviceClass { CCWDeviceClass parent_class; void (*realize)(S390CCWDevice *dev, char *sysfsdev, Error **errp); - void (*unrealize)(S390CCWDevice *dev, Error **errp); + void (*unrealize)(S390CCWDevice *dev); IOInstEnding (*handle_request) (SubchDev *sch); int (*handle_halt) (SubchDev *sch); int (*handle_clear) (SubchDev *sch);
include/hw/scsi/scsi.h +1 -1
@@ -59,7 +59,7 @@ struct SCSIRequest { typedef struct SCSIDeviceClass { DeviceClass parent_class; void (*realize)(SCSIDevice *dev, Error **errp); - void (*unrealize)(SCSIDevice *dev, Error **errp); + void (*unrealize)(SCSIDevice *dev); int (*parse_cdb)(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf, void *hba_private); SCSIRequest *(*alloc_req)(SCSIDevice *s, uint32_t tag, uint32_t lun,
include/hw/usb.h +1 -1
@@ -272,7 +272,7 @@ struct USBDevice { OBJECT_GET_CLASS(USBDeviceClass, (obj), TYPE_USB_DEVICE)typedef void (*USBDeviceRealize )(USBDevice *dev,Error **errp); -typedef void (*USBDeviceUnrealize )(USBDevice *dev,Error **errp); +typedef void (*USBDeviceUnrealize )(USBDevice *dev); typedef struct USBDeviceClass { DeviceClass parent_class;
include/hw/xen/xen-block.h +1 -1
@@ -57,7 +57,7 @@ typedef struct XenBlockDevice { } XenBlockDevice;typedef void (*XenBlockDeviceRealize )(XenBlockDevice *blockdev,Error **errp); -typedef void (*XenBlockDeviceUnrealize )(XenBlockDevice *blockdev,Error **errp); +typedef void (*XenBlockDeviceUnrealize )(XenBlockDevice *blockdev); typedef struct XenBlockDeviceClass { /*< private >*/
include/hw/xen/xen-bus.h +1 -1
@@ -42,7 +42,7 @@ typedef void (*XenDeviceRealize)(XenDevice *xendev, Error **errp);typedef void (*XenDeviceFrontendChanged )(XenDevice *xendev,enum xenbus_state frontend_state,Error **errp); -typedef void (*XenDeviceUnrealize )(XenDevice *xendev,Error **errp); +typedef void (*XenDeviceUnrealize )(XenDevice *xendev); typedef struct XenDeviceClass { /*< private >*/
hw/9pfs/9p.c +2 -2
@@ -4124,13 +4124,13 @@ int v9fs_device_realize_common(V9fsState *s, const V9fsTransport *t, rc =0 ; out:if (rc) { -v9fs_device_unrealize_common (s,NULL ); +v9fs_device_unrealize_common (s); }v9fs_path_free (&path);return rc; } -void v9fs_device_unrealize_common (V9fsState *s,Error **errp) +void v9fs_device_unrealize_common (V9fsState *s) {if (s->ops && s->ops->cleanup) { s->ops->cleanup (&s->ctx);
hw/9pfs/virtio-9p-device.c +2 -2
@@ -212,7 +212,7 @@ static void virtio_9p_device_realize(DeviceState *dev, Error **errp) v->vq =virtio_add_queue (vdev,MAX_REQ , handle_9p_output); } -static void virtio_9p_device_unrealize (DeviceState *dev,Error **errp) +static void virtio_9p_device_unrealize (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);V9fsVirtioState *v =VIRTIO_9P (dev);
@@ -220,7 +220,7 @@ static void virtio_9p_device_unrealize(DeviceState *dev, Error **errp)virtio_delete_queue (v->vq);virtio_cleanup (vdev); -v9fs_device_unrealize_common (s, errp); +v9fs_device_unrealize_common (s); }/* virtio-9p device */
hw/acpi/pcihp.c +1 -1
@@ -266,7 +266,7 @@ void acpi_pcihp_device_unplug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s, {trace_acpi_pci_unplug (PCI_SLOT (PCI_DEVICE (dev)->devfn),acpi_pcihp_get_bsel (pci_get_bus (PCI_DEVICE (dev)))); -object_property_set_bool (OBJECT (dev), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (dev), false,"realized" , &error_abort); } void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev,
hw/audio/intel-hda.c +1 -1
@@ -74,7 +74,7 @@ static void hda_codec_dev_realize(DeviceState *qdev, Error **errp) } } -static void hda_codec_dev_unrealize (DeviceState *qdev,Error **errp) +static void hda_codec_dev_unrealize (DeviceState *qdev) {HDACodecDevice *dev =HDA_CODEC_DEVICE (qdev);HDACodecDeviceClass *cdc =HDA_CODEC_DEVICE_GET_CLASS (dev);
hw/block/pflash_cfi02.c +1 -1
@@ -949,7 +949,7 @@ static Property pflash_cfi02_properties[] = { DEFINE_PROP_END_OF_LIST(), }; -static void pflash_cfi02_unrealize (DeviceState *dev,Error **errp) +static void pflash_cfi02_unrealize (DeviceState *dev) {PFlashCFI02 *pfl =PFLASH_CFI02 (dev);timer_del (&pfl->timer);
hw/block/vhost-user-blk.c +1 -1
@@ -450,7 +450,7 @@ virtio_err:vhost_user_cleanup (&s->vhost_user); } -static void vhost_user_blk_device_unrealize (DeviceState *dev,Error **errp) +static void vhost_user_blk_device_unrealize (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VHostUserBlk *s =VHOST_USER_BLK (dev);
hw/block/virtio-blk.c +1 -1
@@ -1223,7 +1223,7 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp) conf->conf.lsecs); } -static void virtio_blk_device_unrealize (DeviceState *dev,Error **errp) +static void virtio_blk_device_unrealize (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VirtIOBlock *s =VIRTIO_BLK (dev);
hw/block/xen-block.c +4 -4
@@ -136,7 +136,7 @@ static void xen_block_connect(XenDevice *xendev, Error **errp)g_free (ring_ref); } -static void xen_block_unrealize (XenDevice *xendev,Error **errp) +static void xen_block_unrealize (XenDevice *xendev) {XenBlockDevice *blockdev =XEN_BLOCK_DEVICE (xendev); XenBlockDeviceClass *blockdev_class =
@@ -157,7 +157,7 @@ static void xen_block_unrealize(XenDevice *xendev, Error **errp) blockdev->dataplane =NULL ;if (blockdev_class->unrealize) { - blockdev_class->unrealize (blockdev, errp); + blockdev_class->unrealize (blockdev); } }
@@ -567,7 +567,7 @@ static const TypeInfo xen_block_type_info = { .class_init = xen_block_class_init, }; -static void xen_disk_unrealize (XenBlockDevice *blockdev,Error **errp) +static void xen_disk_unrealize (XenBlockDevice *blockdev) {trace_xen_disk_unrealize (); }
@@ -606,7 +606,7 @@ static const TypeInfo xen_disk_type_info = { .class_init = xen_disk_class_init, }; -static void xen_cdrom_unrealize (XenBlockDevice *blockdev,Error **errp) +static void xen_cdrom_unrealize (XenBlockDevice *blockdev) {trace_xen_cdrom_unrealize (); }
hw/char/serial-pci-multi.c +1 -1
@@ -56,7 +56,7 @@ static void multi_serial_pci_exit(PCIDevice *dev)for (i =0 ; i < pci->ports; i++) { s = pci->state + i; -object_property_set_bool (OBJECT (s), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (s), false,"realized" , &error_abort);memory_region_del_subregion (&pci->iobar, &s->io);g_free (pci->name[i]); }
hw/char/serial-pci.c +1 -1
@@ -68,7 +68,7 @@ static void serial_pci_exit(PCIDevice *dev)PCISerialState *pci =DO_UPCAST (PCISerialState, dev, dev);SerialState *s = &pci->state; -object_property_set_bool (OBJECT (s), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (s), false,"realized" , &error_abort);qemu_free_irq (s->irq); }
hw/char/serial.c +1 -1
@@ -950,7 +950,7 @@ static void serial_realize(DeviceState *dev, Error **errp)serial_reset (s); } -static void serial_unrealize (DeviceState *dev,Error **errp) +static void serial_unrealize (DeviceState *dev) {SerialState *s =SERIAL (dev);
hw/char/virtio-console.c +1 -1
@@ -249,7 +249,7 @@ static void virtconsole_realize(DeviceState *dev, Error **errp) } } -static void virtconsole_unrealize (DeviceState *dev,Error **errp) +static void virtconsole_unrealize (DeviceState *dev) {VirtConsole *vcon =VIRTIO_CONSOLE (dev);
hw/char/virtio-serial-bus.c +4 -4
@@ -1010,7 +1010,7 @@ static void virtser_port_device_plug(HotplugHandler *hotplug_dev,virtio_notify_config (VIRTIO_DEVICE (hotplug_dev)); } -static void virtser_port_device_unrealize (DeviceState *dev,Error **errp) +static void virtser_port_device_unrealize (DeviceState *dev) {VirtIOSerialPort *port =VIRTIO_SERIAL_PORT (dev);VirtIOSerialPortClass *vsc =VIRTIO_SERIAL_PORT_GET_CLASS (dev);
@@ -1022,7 +1022,7 @@ static void virtser_port_device_unrealize(DeviceState *dev, Error **errp)QTAILQ_REMOVE (&vser->ports, port, next);if (vsc->unrealize) { - vsc->unrealize (dev, errp); + vsc->unrealize (dev); } }
@@ -1122,7 +1122,7 @@ static const TypeInfo virtio_serial_port_type_info = { .class_init = virtio_serial_port_class_init, }; -static void virtio_serial_device_unrealize (DeviceState *dev,Error **errp) +static void virtio_serial_device_unrealize (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VirtIOSerial *vser =VIRTIO_SERIAL (dev);
@@ -1147,7 +1147,7 @@ static void virtio_serial_device_unrealize(DeviceState *dev, Error **errp)g_free (vser->post_load); } -qbus_set_hotplug_handler (BUS (&vser->bus),NULL , errp); +qbus_set_hotplug_handler (BUS (&vser->bus),NULL , &error_abort);virtio_cleanup (vdev); }
hw/core/bus.c +4 -13
@@ -176,11 +176,10 @@ static void bus_set_realized(Object *obj, bool value, Error **errp)BusState *bus =BUS (obj);BusClass *bc =BUS_GET_CLASS (bus);BusChild *kid; -Error *local_err =NULL ;if (value && !bus->realized) {if (bc->realize) { - bc->realize (bus, &local_err); + bc->realize (bus, errp); }/* TODO: recursive realization */
@@ -188,21 +187,13 @@ static void bus_set_realized(Object *obj, bool value, Error **errp) QTAILQ_FOREACH(kid, &bus->children, sibling) {DeviceState *dev = kid->child;object_property_set_bool (OBJECT (dev), false,"realized" , - &local_err); -if (local_err !=NULL ) { -break ; - } + &error_abort); } -if (bc->unrealize && local_err ==NULL ) { - bc->unrealize (bus, &local_err); +if (bc->unrealize) { + bc->unrealize (bus); } } -if (local_err !=NULL ) { -error_propagate (errp, local_err); -return ; - } - bus->realized = value; }
hw/core/cpu.c +1 -1
@@ -345,7 +345,7 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp)trace_init_vcpu (cpu); } -static void cpu_common_unrealizefn (DeviceState *dev,Error **errp) +static void cpu_common_unrealizefn (DeviceState *dev) {CPUState *cpu =CPU (dev);/* NOTE: latest generic point before the cpu is fully unrealized */
hw/core/generic-loader.c +1 -1
@@ -173,7 +173,7 @@ static void generic_loader_realize(DeviceState *dev, Error **errp) } } -static void generic_loader_unrealize (DeviceState *dev,Error **errp) +static void generic_loader_unrealize (DeviceState *dev) {qemu_unregister_reset (generic_loader_reset, dev); }
hw/core/qdev.c +6 -11
@@ -391,7 +391,7 @@ static void device_reset_child_foreach(Object *obj, ResettableChildCallback cb,void qdev_simple_device_unplug_cb (HotplugHandler *hotplug_dev,DeviceState *dev,Error **errp) { -object_property_set_bool (OBJECT (dev), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (dev), false,"realized" , &error_abort); }/*
@@ -936,23 +936,18 @@ static void device_set_realized(Object *obj, bool value, Error **errp) } }else if (!value && dev->realized) { -/* We want local_err to track only the first error */ QLIST_FOREACH(bus, &dev->child_bus, sibling) {object_property_set_bool (OBJECT (bus), false,"realized" , - local_err ?NULL : &local_err); + &error_abort); }if (qdev_get_vmsd (dev)) {vmstate_unregister (VMSTATE_IF (dev),qdev_get_vmsd (dev), dev); }if (dc->unrealize) { - dc->unrealize (dev, local_err ?NULL : &local_err); + dc->unrealize (dev); } dev->pending_deleted_event = true;DEVICE_LISTENER_CALL (unrealize, Reverse, dev); - -if (local_err !=NULL ) { - goto fail; - } }assert (local_err ==NULL );
@@ -962,7 +957,7 @@ static void device_set_realized(Object *obj, bool value, Error **errp) child_realize_fail: QLIST_FOREACH(bus, &dev->child_bus, sibling) {object_property_set_bool (OBJECT (bus), false,"realized" , -NULL ); + &error_abort); }if (qdev_get_vmsd (dev)) {
@@ -973,7 +968,7 @@ post_realize_fail:g_free (dev->canonical_path); dev->canonical_path =NULL ;if (dc->unrealize) { - dc->unrealize (dev,NULL ); + dc->unrealize (dev); } fail:
@@ -1071,7 +1066,7 @@ static void device_unparent(Object *obj)BusState *bus;if (dev->realized) { -object_property_set_bool (obj, false,"realized" ,NULL ); +object_property_set_bool (obj, false,"realized" , &error_abort); }while (dev->num_child_bus) { bus =QLIST_FIRST (&dev->child_bus);
hw/display/virtio-gpu-base.c +1 -1
@@ -203,7 +203,7 @@ virtio_gpu_base_set_features(VirtIODevice *vdev, uint64_t features) }static void -virtio_gpu_base_device_unrealize (DeviceState *qdev,Error **errp) +virtio_gpu_base_device_unrealize (DeviceState *qdev) {VirtIOGPUBase *g =VIRTIO_GPU_BASE (qdev);
hw/dma/rc4030.c +1 -1
@@ -690,7 +690,7 @@ static void rc4030_realize(DeviceState *dev, Error **errp)address_space_init (&s->dma_as,MEMORY_REGION (&s->dma_mr),"rc4030-dma" ); } -static void rc4030_unrealize (DeviceState *dev,Error **errp) +static void rc4030_unrealize (DeviceState *dev) {rc4030State *s =RC4030 (dev);
hw/i386/kvm/apic.c +1 -1
@@ -230,7 +230,7 @@ static void kvm_apic_realize(DeviceState *dev, Error **errp) } } -static void kvm_apic_unrealize (DeviceState *dev,Error **errp) +static void kvm_apic_unrealize (DeviceState *dev) { }
hw/i386/pc.c +2 -2
@@ -1381,7 +1381,7 @@ static void pc_memory_unplug(HotplugHandler *hotplug_dev, }pc_dimm_unplug (PC_DIMM (dev),MACHINE (pcms)); -object_property_set_bool (OBJECT (dev), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (dev), false,"realized" , &error_abort); out:error_propagate (errp, local_err); }
@@ -1489,7 +1489,7 @@ static void pc_cpu_unplug_cb(HotplugHandler *hotplug_dev, found_cpu =pc_find_cpu_slot (MACHINE (pcms), cpu->apic_id,NULL ); found_cpu->cpu =NULL ; -object_property_set_bool (OBJECT (dev), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (dev), false,"realized" , &error_abort);/* decrement the number of CPUs */ x86ms->boot_cpus--;
hw/ide/qdev.c +2 -2
@@ -36,7 +36,7 @@/* --------------------------------- */ static char *idebus_get_fw_dev_path (DeviceState *dev); -static void idebus_unrealize (BusState *qdev,Error **errp); +static void idebus_unrealize (BusState *qdev);static Property ide_props[] = {DEFINE_PROP_UINT32 ("unit" , IDEDevice, unit,-1 ),
@@ -51,7 +51,7 @@ static void ide_bus_class_init(ObjectClass *klass, void *data) k->unrealize = idebus_unrealize; } -static void idebus_unrealize (BusState *bus,Error **errp) +static void idebus_unrealize (BusState *bus) {IDEBus *ibus =IDE_BUS (bus);
hw/input/virtio-input-hid.c +1 -1
@@ -165,7 +165,7 @@ static void virtio_input_hid_realize(DeviceState *dev, Error **errp) } } -static void virtio_input_hid_unrealize (DeviceState *dev,Error **errp) +static void virtio_input_hid_unrealize (DeviceState *dev) {VirtIOInputHID *vhid =VIRTIO_INPUT_HID (dev);qemu_input_handler_unregister (vhid->hs);
hw/input/virtio-input-host.c +1 -1
@@ -178,7 +178,7 @@ err_close:return ; } -static void virtio_input_host_unrealize (DeviceState *dev,Error **errp) +static void virtio_input_host_unrealize (DeviceState *dev) {VirtIOInputHost *vih =VIRTIO_INPUT_HOST (dev);
hw/input/virtio-input.c +2 -7
@@ -276,19 +276,14 @@ static void virtio_input_finalize(Object *obj)g_free (vinput->queue); } -static void virtio_input_device_unrealize (DeviceState *dev,Error **errp) +static void virtio_input_device_unrealize (DeviceState *dev) {VirtIOInputClass *vic =VIRTIO_INPUT_GET_CLASS (dev);VirtIODevice *vdev =VIRTIO_DEVICE (dev);VirtIOInput *vinput =VIRTIO_INPUT (dev); -Error *local_err =NULL ;if (vic->unrealize) { - vic->unrealize (dev, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } + vic->unrealize (dev); }virtio_delete_queue (vinput->evt);virtio_delete_queue (vinput->sts);
hw/intc/apic.c +1 -1
@@ -900,7 +900,7 @@ static void apic_realize(DeviceState *dev, Error **errp) msi_nonbroken = true; } -static void apic_unrealize (DeviceState *dev,Error **errp) +static void apic_unrealize (DeviceState *dev) {APICCommonState *s =APIC (dev);
hw/intc/apic_common.c +2 -2
@@ -293,13 +293,13 @@ static void apic_common_realize(DeviceState *dev, Error **errp) s, -1, 0, NULL); } -static void apic_common_unrealize (DeviceState *dev,Error **errp) +static void apic_common_unrealize (DeviceState *dev) {APICCommonState *s =APIC_COMMON (dev);APICCommonClass *info =APIC_COMMON_GET_CLASS (s);vmstate_unregister (NULL , &vmstate_apic_common, s); - info->unrealize (dev, errp); + info->unrealize (dev);if (apic_report_tpr_access && info->enable_tpr_reporting) { info->enable_tpr_reporting (s, false);
hw/intc/ioapic.c +1 -1
@@ -451,7 +451,7 @@ static void ioapic_realize(DeviceState *dev, Error **errp)qemu_add_machine_init_done_notifier (&s->machine_done); } -static void ioapic_unrealize (DeviceState *dev,Error **errp) +static void ioapic_unrealize (DeviceState *dev) {IOAPICCommonState *s =IOAPIC_COMMON (dev);
hw/intc/xics.c +1 -1
@@ -338,7 +338,7 @@ static void icp_realize(DeviceState *dev, Error **errp)vmstate_register (NULL , icp->cs->cpu_index, &vmstate_icp_server, icp); } -static void icp_unrealize (DeviceState *dev,Error **errp) +static void icp_unrealize (DeviceState *dev) {ICPState *icp =ICP (dev);
hw/ipack/ipack.c +2 -4
@@ -60,15 +60,13 @@ static void ipack_device_realize(DeviceState *dev, Error **errp) k->realize (dev, errp); } -static void ipack_device_unrealize (DeviceState *dev,Error **errp) +static void ipack_device_unrealize (DeviceState *dev) {IPackDevice *idev =IPACK_DEVICE (dev);IPackDeviceClass *k =IPACK_DEVICE_GET_CLASS (dev); -Error *err =NULL ;if (k->unrealize) { - k->unrealize (dev, &err); -error_propagate (errp, err); + k->unrealize (dev);return ; }
hw/mem/pc-dimm.c +1 -1
@@ -199,7 +199,7 @@ static void pc_dimm_realize(DeviceState *dev, Error **errp)host_memory_backend_set_mapped (dimm->hostmem, true); } -static void pc_dimm_unrealize (DeviceState *dev,Error **errp) +static void pc_dimm_unrealize (DeviceState *dev) {PCDIMMDevice *dimm =PC_DIMM (dev);
hw/net/virtio-net.c +1 -1
@@ -3074,7 +3074,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) n->qdev = dev; } -static void virtio_net_device_unrealize (DeviceState *dev,Error **errp) +static void virtio_net_device_unrealize (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VirtIONet *n =VIRTIO_NET (dev);
hw/nvram/mac_nvram.c +1 -1
@@ -107,7 +107,7 @@ static void macio_nvram_realizefn(DeviceState *dev, Error **errp)sysbus_init_mmio (d, &s->mem); } -static void macio_nvram_unrealizefn (DeviceState *dev,Error **errp) +static void macio_nvram_unrealizefn (DeviceState *dev) {MacIONVRAMState *s =MACIO_NVRAM (dev);
hw/pci/pci.c +7 -7
@@ -146,7 +146,7 @@ static void pcie_bus_realize(BusState *qbus, Error **errp) } } -static void pci_bus_unrealize (BusState *qbus,Error **errp) +static void pci_bus_unrealize (BusState *qbus) {PCIBus *bus =PCI_BUS (qbus);
@@ -456,7 +456,7 @@ void pci_root_bus_cleanup(PCIBus *bus) {pci_bus_uninit (bus);/* the caller of the unplug hotplug handler will delete this device */ -object_property_set_bool (OBJECT (bus), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (bus), false,"realized" , &error_abort); } void pci_bus_irqs(PCIBus *bus, pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,
@@ -1118,7 +1118,7 @@ static void pci_unregister_io_regions(PCIDevice *pci_dev)pci_unregister_vga (pci_dev); } -static void pci_qdev_unrealize (DeviceState *dev,Error **errp) +static void pci_qdev_unrealize (DeviceState *dev) {PCIDevice *pci_dev =PCI_DEVICE (dev);PCIDeviceClass *pc =PCI_DEVICE_GET_CLASS (pci_dev);
@@ -2108,7 +2108,7 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)error_setg (errp,"failover primary device must be on " "PCIExpress bus" );error_propagate (errp, local_err); -pci_qdev_unrealize (DEVICE (pci_dev),NULL ); +pci_qdev_unrealize (DEVICE (pci_dev));return ; } class_id =pci_get_word (pci_dev->config +PCI_CLASS_DEVICE );
@@ -2116,7 +2116,7 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)error_setg (errp,"failover primary device is not an " "Ethernet device" );error_propagate (errp, local_err); -pci_qdev_unrealize (DEVICE (pci_dev),NULL ); +pci_qdev_unrealize (DEVICE (pci_dev));return ; } if (!(pci_dev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION)
@@ -2126,7 +2126,7 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)error_setg (errp,"failover: primary device must be in its own " "PCI slot" );error_propagate (errp, local_err); -pci_qdev_unrealize (DEVICE (pci_dev),NULL ); +pci_qdev_unrealize (DEVICE (pci_dev));return ; } qdev->allow_unplug_during_migration = true;
@@ -2142,7 +2142,7 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)pci_add_option_rom (pci_dev, is_default_rom, &local_err);if (local_err) {error_propagate (errp, local_err); -pci_qdev_unrealize (DEVICE (pci_dev),NULL ); +pci_qdev_unrealize (DEVICE (pci_dev));return ; } }
hw/pci/pcie.c +1 -1
@@ -449,7 +449,7 @@ void pcie_cap_slot_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,void pcie_cap_slot_unplug_cb (HotplugHandler *hotplug_dev,DeviceState *dev,Error **errp) { -object_property_set_bool (OBJECT (dev), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (dev), false,"realized" , &error_abort); }static void pcie_unplug_device (PCIBus *bus,PCIDevice *dev,void *opaque)
hw/pci/shpc.c +1 -1
@@ -547,7 +547,7 @@ void shpc_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,void shpc_device_unplug_cb (HotplugHandler *hotplug_dev,DeviceState *dev,Error **errp) { -object_property_set_bool (OBJECT (dev), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (dev), false,"realized" , &error_abort); } void shpc_device_unplug_request_cb(HotplugHandler *hotplug_dev,
hw/ppc/pnv_core.c +1 -1
@@ -275,7 +275,7 @@ static void pnv_core_cpu_unrealize(PnvCore *pc, PowerPCCPU *cpu)object_unparent (OBJECT (cpu)); } -static void pnv_core_unrealize (DeviceState *dev,Error **errp) +static void pnv_core_unrealize (DeviceState *dev) {PnvCore *pc =PNV_CORE (dev);CPUCore *cc =CPU_CORE (dev);
hw/ppc/spapr.c +4 -4
@@ -3677,7 +3677,7 @@ static void spapr_memory_unplug(HotplugHandler *hotplug_dev, DeviceState *dev)SpaprDimmState *ds =spapr_pending_dimm_unplugs_find (spapr,PC_DIMM (dev));pc_dimm_unplug (PC_DIMM (dev),MACHINE (hotplug_dev)); -object_property_set_bool (OBJECT (dev), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (dev), false,"realized" , &error_abort);spapr_pending_dimm_unplugs_remove (spapr, ds); }
@@ -3770,7 +3770,7 @@ static void spapr_core_unplug(HotplugHandler *hotplug_dev, DeviceState *dev)assert (core_slot); core_slot->cpu =NULL ; -object_property_set_bool (OBJECT (dev), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (dev), false,"realized" , &error_abort); } static
@@ -4043,7 +4043,7 @@ void spapr_phb_release(DeviceState *dev)static void spapr_phb_unplug (HotplugHandler *hotplug_dev,DeviceState *dev) { -object_property_set_bool (OBJECT (dev), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (dev), false,"realized" , &error_abort); } static void spapr_phb_unplug_request(HotplugHandler *hotplug_dev,
@@ -4079,7 +4079,7 @@ static void spapr_tpm_proxy_unplug(HotplugHandler *hotplug_dev, DeviceState *dev {SpaprMachineState *spapr =SPAPR_MACHINE (OBJECT (hotplug_dev)); -object_property_set_bool (OBJECT (dev), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (dev), false,"realized" , &error_abort);object_unparent (OBJECT (dev)); spapr->tpm_proxy =NULL ; }
hw/ppc/spapr_cpu_core.c +1 -1
@@ -218,7 +218,7 @@ static void spapr_cpu_core_reset_handler(void *opaque)spapr_cpu_core_reset (opaque); } -static void spapr_cpu_core_unrealize (DeviceState *dev,Error **errp) +static void spapr_cpu_core_unrealize (DeviceState *dev) {SpaprCpuCore *sc =SPAPR_CPU_CORE (OBJECT (dev));CPUCore *cc =CPU_CORE (dev);
hw/ppc/spapr_drc.c +4 -10
@@ -541,7 +541,7 @@ static void realize(DeviceState *d, Error **errp)trace_spapr_drc_realize_complete (spapr_drc_index (drc)); } -static void unrealize (DeviceState *d,Error **errp) +static void unrealize (DeviceState *d) {SpaprDrc *drc =SPAPR_DR_CONNECTOR (d);Object *root_container;
@@ -551,7 +551,7 @@ static void unrealize(DeviceState *d, Error **errp)vmstate_unregister (VMSTATE_IF (drc), &vmstate_spapr_drc, drc); root_container =container_get (object_get_root (),DRC_CONTAINER_PATH ); name =g_strdup_printf ("%x" ,spapr_drc_index (drc)); -object_property_del (root_container, name, errp); +object_property_del (root_container, name, &error_abort);g_free (name); }
@@ -650,17 +650,11 @@ static void realize_physical(DeviceState *d, Error **errp)qemu_register_reset (drc_physical_reset, drcp); } -static void unrealize_physical (DeviceState *d,Error **errp) +static void unrealize_physical (DeviceState *d) {SpaprDrcPhysical *drcp =SPAPR_DRC_PHYSICAL (d); -Error *local_err =NULL ; - -unrealize (d, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } +unrealize (d);vmstate_unregister (VMSTATE_IF (drcp), &vmstate_spapr_drc_physical, drcp);qemu_unregister_reset (drc_physical_reset, drcp); }
hw/ppc/spapr_iommu.c +1 -1
@@ -416,7 +416,7 @@ void spapr_tce_table_disable(SpaprTceTable *tcet) tcet->nb_table =0 ; } -static void spapr_tce_table_unrealize (DeviceState *dev,Error **errp) +static void spapr_tce_table_unrealize (DeviceState *dev) {SpaprTceTable *tcet =SPAPR_TCE_TABLE (dev);
hw/ppc/spapr_pci.c +5 -9
@@ -1627,7 +1627,8 @@ static void spapr_pci_unplug(HotplugHandler *plug_handler,return ; } -object_property_set_bool (OBJECT (plugged_dev), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (plugged_dev), false,"realized" , + &error_abort); } static void spapr_pci_unplug_request(HotplugHandler *plug_handler,
@@ -1711,7 +1712,7 @@ static void spapr_phb_finalizefn(Object *obj) sphb->dtbusname =NULL ; } -static void spapr_phb_unrealize (DeviceState *dev,Error **errp) +static void spapr_phb_unrealize (DeviceState *dev) {SpaprMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ());SysBusDevice *s =SYS_BUS_DEVICE (dev);
@@ -1720,7 +1721,6 @@ static void spapr_phb_unrealize(DeviceState *dev, Error **errp)SpaprTceTable *tcet;int i;const unsigned windows_supported =spapr_phb_windows_supported (sphb); -Error *local_err =NULL ;spapr_phb_nvgpu_free (sphb);
@@ -1741,11 +1741,7 @@ static void spapr_phb_unrealize(DeviceState *dev, Error **errp) } } -remove_drcs (sphb, phb->bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } +remove_drcs (sphb, phb->bus, &error_abort);for (i =PCI_NUM_PINS -1 ; i >=0 ; i--) {if (sphb->lsi_table[i].irq) {
@@ -2007,7 +2003,7 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)return ; unrealize: -spapr_phb_unrealize (dev,NULL ); +spapr_phb_unrealize (dev); }static int spapr_phb_children_reset (Object *child,void *opaque)
hw/ppc/spapr_tpm_proxy.c +1 -1
@@ -140,7 +140,7 @@ static void spapr_tpm_proxy_realize(DeviceState *d, Error **errp)qemu_register_reset (spapr_tpm_proxy_reset, tpm_proxy); } -static void spapr_tpm_proxy_unrealize (DeviceState *d,Error **errp) +static void spapr_tpm_proxy_unrealize (DeviceState *d) {SpaprTpmProxy *tpm_proxy =SPAPR_TPM_PROXY (d);
hw/s390x/css-bridge.c +1 -1
@@ -54,7 +54,7 @@ static void ccw_device_unplug(HotplugHandler *hotplug_dev,css_generate_sch_crws (sch->cssid, sch->ssid, sch->schid,1 ,0 ); -object_property_set_bool (OBJECT (dev), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (dev), false,"realized" , &error_abort); }static void virtual_css_bus_reset (BusState *qbus)
hw/s390x/s390-ccw.c +1 -1
@@ -132,7 +132,7 @@ out_err_propagate:error_propagate (errp, err); } -static void s390_ccw_unrealize (S390CCWDevice *cdev,Error **errp) +static void s390_ccw_unrealize (S390CCWDevice *cdev) {CcwDevice *ccw_dev =CCW_DEVICE (cdev);SubchDev *sch = ccw_dev->sch;
hw/s390x/s390-pci-bus.c +2 -2
@@ -1003,7 +1003,7 @@ static void s390_pcihost_unplug(HotplugHandler *hotplug_dev, DeviceState *dev, pbdev->fh, pbdev->fid); bus =pci_get_bus (pci_dev); devfn = pci_dev->devfn; -object_property_set_bool (OBJECT (dev), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (dev), false,"realized" , &error_abort);s390_pci_msix_free (pbdev);s390_pci_iommu_free (s, bus, devfn);
@@ -1014,7 +1014,7 @@ static void s390_pcihost_unplug(HotplugHandler *hotplug_dev, DeviceState *dev, pbdev->fid =0 ;QTAILQ_REMOVE (&s->zpci_devs, pbdev, link);g_hash_table_remove (s->zpci_table, &pbdev->idx); -object_property_set_bool (OBJECT (dev), false,"realized" ,NULL ); +object_property_set_bool (OBJECT (dev), false,"realized" , &error_abort); } }
hw/s390x/virtio-ccw.c +4 -4
@@ -752,14 +752,14 @@ out_err:g_free (sch); } -static void virtio_ccw_device_unrealize (VirtioCcwDevice *dev,Error **errp) +static void virtio_ccw_device_unrealize (VirtioCcwDevice *dev) {VirtIOCCWDeviceClass *dc =VIRTIO_CCW_DEVICE_GET_CLASS (dev);CcwDevice *ccw_dev =CCW_DEVICE (dev);SubchDev *sch = ccw_dev->sch;if (dc->unrealize) { - dc->unrealize (dev, errp); + dc->unrealize (dev); }if (sch) {
@@ -1155,11 +1155,11 @@ static void virtio_ccw_busdev_realize(DeviceState *dev, Error **errp)virtio_ccw_device_realize (_dev, errp); } -static void virtio_ccw_busdev_unrealize (DeviceState *dev,Error **errp) +static void virtio_ccw_busdev_unrealize (DeviceState *dev) {VirtioCcwDevice *_dev = (VirtioCcwDevice *)dev; -virtio_ccw_device_unrealize (_dev, errp); +virtio_ccw_device_unrealize (_dev); } static void virtio_ccw_busdev_unplug(HotplugHandler *hotplug_dev,
hw/scsi/lsi53c895a.c +1 -1
@@ -2312,7 +2312,7 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)scsi_bus_new (&s->bus,sizeof (s->bus), d, &lsi_scsi_info,NULL ); } -static void lsi_scsi_unrealize (DeviceState *dev,Error **errp) +static void lsi_scsi_unrealize (DeviceState *dev) {LSIState *s =LSI53C895A (dev);
hw/scsi/scsi-bus.c +4 -9
@@ -59,11 +59,11 @@ static void scsi_device_realize(SCSIDevice *s, Error **errp) } } -static void scsi_device_unrealize (SCSIDevice *s,Error **errp) +static void scsi_device_unrealize (SCSIDevice *s) {SCSIDeviceClass *sc =SCSI_DEVICE_GET_CLASS (s);if (sc->unrealize) { - sc->unrealize (s, errp); + sc->unrealize (s); } }
@@ -222,10 +222,9 @@ static void scsi_qdev_realize(DeviceState *qdev, Error **errp) scsi_dma_restart_cb, dev); } -static void scsi_qdev_unrealize (DeviceState *qdev,Error **errp) +static void scsi_qdev_unrealize (DeviceState *qdev) {SCSIDevice *dev =SCSI_DEVICE (qdev); -Error *local_err =NULL ;if (dev->vmsentry) {qemu_del_vm_change_state_handler (dev->vmsentry);
@@ -233,11 +232,7 @@ static void scsi_qdev_unrealize(DeviceState *qdev, Error **errp)scsi_device_purge_requests (dev,SENSE_CODE (NO_SENSE )); -scsi_device_unrealize (dev, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } +scsi_device_unrealize (dev);blockdev_mark_auto_del (dev->conf.blk); }
hw/scsi/scsi-disk.c +1 -1
@@ -2421,7 +2421,7 @@ static void scsi_realize(SCSIDevice *dev, Error **errp) dev->conf.lsecs); } -static void scsi_unrealize (SCSIDevice *dev,Error **errp) +static void scsi_unrealize (SCSIDevice *dev) {del_boot_device_lchs (&dev->qdev,NULL ); }
hw/scsi/vhost-scsi.c +1 -1
@@ -248,7 +248,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)return ; } -static void vhost_scsi_unrealize (DeviceState *dev,Error **errp) +static void vhost_scsi_unrealize (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VHostSCSICommon *vsc =VHOST_SCSI_COMMON (dev);
hw/scsi/vhost-user-scsi.c +1 -1
@@ -143,7 +143,7 @@ free_virtio:virtio_scsi_common_unrealize (dev); } -static void vhost_user_scsi_unrealize (DeviceState *dev,Error **errp) +static void vhost_user_scsi_unrealize (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VHostUserSCSI *s =VHOST_USER_SCSI (dev);
hw/scsi/virtio-scsi.c +1 -1
@@ -954,7 +954,7 @@ void virtio_scsi_common_unrealize(DeviceState *dev)virtio_cleanup (vdev); } -static void virtio_scsi_device_unrealize (DeviceState *dev,Error **errp) +static void virtio_scsi_device_unrealize (DeviceState *dev) {VirtIOSCSI *s =VIRTIO_SCSI (dev);
hw/sd/sdhci-pci.c +1 -1
@@ -50,7 +50,7 @@ static void sdhci_pci_exit(PCIDevice *dev) {SDHCIState *s =PCI_SDHCI (dev); -sdhci_common_unrealize (s, &error_abort); +sdhci_common_unrealize (s);sdhci_uninitfn (s); }
hw/sd/sdhci.c +3 -3
@@ -1346,7 +1346,7 @@ void sdhci_common_realize(SDHCIState *s, Error **errp) SDHC_REGISTERS_MAP_SIZE); } -void sdhci_common_unrealize (SDHCIState *s,Error **errp) +void sdhci_common_unrealize (SDHCIState *s) {/* This function is expected to be called only once for each class: * - SysBus: via DeviceClass->unrealize(),
@@ -1479,11 +1479,11 @@ static void sdhci_sysbus_realize(DeviceState *dev, Error **errp)sysbus_init_mmio (sbd, &s->iomem); } -static void sdhci_sysbus_unrealize (DeviceState *dev,Error **errp) +static void sdhci_sysbus_unrealize (DeviceState *dev) {SDHCIState *s =SYSBUS_SDHCI (dev); -sdhci_common_unrealize (s, &error_abort); +sdhci_common_unrealize (s);if (s->dma_mr) {address_space_destroy (s->dma_as);
hw/usb/bus.c +6 -6
@@ -14,7 +14,7 @@ static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent);static char *usb_get_dev_path (DeviceState *dev);static char *usb_get_fw_dev_path (DeviceState *qdev); -static void usb_qdev_unrealize (DeviceState *qdev,Error **errp); +static void usb_qdev_unrealize (DeviceState *qdev);static Property usb_props[] = {DEFINE_PROP_STRING ("port" , USBDevice, port_path),
@@ -130,12 +130,12 @@ USBDevice *usb_device_find_device(USBDevice *dev, uint8_t addr)return NULL ; } -static void usb_device_unrealize (USBDevice *dev,Error **errp) +static void usb_device_unrealize (USBDevice *dev) {USBDeviceClass *klass =USB_DEVICE_GET_CLASS (dev);if (klass->unrealize) { - klass->unrealize (dev, errp); + klass->unrealize (dev); } }
@@ -265,14 +265,14 @@ static void usb_qdev_realize(DeviceState *qdev, Error **errp)if (dev->auto_attach) {usb_device_attach (dev, &local_err);if (local_err) { -usb_qdev_unrealize (qdev,NULL ); +usb_qdev_unrealize (qdev);error_propagate (errp, local_err);return ; } } } -static void usb_qdev_unrealize (DeviceState *qdev,Error **errp) +static void usb_qdev_unrealize (DeviceState *qdev) {USBDevice *dev =USB_DEVICE (qdev);USBDescString *s, *next;
@@ -286,7 +286,7 @@ static void usb_qdev_unrealize(DeviceState *qdev, Error **errp)if (dev->attached) {usb_device_detach (dev); } -usb_device_unrealize (dev, errp); +usb_device_unrealize (dev);if (dev->port) {usb_release_port (dev); }
hw/usb/ccid-card-emulated.c +1 -1
@@ -562,7 +562,7 @@ out1:qemu_mutex_destroy (&card->event_list_mutex); } -static void emulated_unrealize (CCIDCardState *base,Error **errp) +static void emulated_unrealize (CCIDCardState *base) {EmulatedState *card =EMULATED_CCID_CARD (base);VEvent *vevent =vevent_new (VEVENT_LAST ,NULL ,NULL );
hw/usb/dev-audio.c +1 -1
@@ -923,7 +923,7 @@ static void usb_audio_handle_data(USBDevice *dev, USBPacket *p) } } -static void usb_audio_unrealize (USBDevice *dev,Error **errp) +static void usb_audio_unrealize (USBDevice *dev) {USBAudioState *s =USB_AUDIO (dev);
hw/usb/dev-hid.c +1 -1
@@ -699,7 +699,7 @@ static void usb_hid_handle_data(USBDevice *dev, USBPacket *p) } } -static void usb_hid_unrealize (USBDevice *dev,Error **errp) +static void usb_hid_unrealize (USBDevice *dev) {USBHIDState *us =USB_HID (dev);
hw/usb/dev-hub.c +1 -1
@@ -565,7 +565,7 @@ static void usb_hub_handle_data(USBDevice *dev, USBPacket *p) } } -static void usb_hub_unrealize (USBDevice *dev,Error **errp) +static void usb_hub_unrealize (USBDevice *dev) {USBHubState *s = (USBHubState *)dev;int i;
hw/usb/dev-network.c +1 -1
@@ -1326,7 +1326,7 @@ static void usbnet_cleanup(NetClientState *nc) s->nic =NULL ; } -static void usb_net_unrealize (USBDevice *dev,Error **errp) +static void usb_net_unrealize (USBDevice *dev) {USBNetState *s = (USBNetState *) dev;
hw/usb/dev-smartcard-reader.c +3 -8
@@ -1146,7 +1146,7 @@ static void ccid_handle_data(USBDevice *dev, USBPacket *p) } } -static void ccid_unrealize (USBDevice *dev,Error **errp) +static void ccid_unrealize (USBDevice *dev) {USBCCIDState *s =USB_CCID_DEV (dev);
@@ -1269,23 +1269,18 @@ void ccid_card_card_inserted(CCIDCardState *card)ccid_on_slot_change (s, true); } -static void ccid_card_unrealize (DeviceState *qdev,Error **errp) +static void ccid_card_unrealize (DeviceState *qdev) {CCIDCardState *card =CCID_CARD (qdev);CCIDCardClass *cc =CCID_CARD_GET_CLASS (card);USBDevice *dev =USB_DEVICE (qdev->parent_bus->parent);USBCCIDState *s =USB_CCID_DEV (dev); -Error *local_err =NULL ;if (ccid_card_inserted (s)) {ccid_card_card_removed (card); }if (cc->unrealize) { - cc->unrealize (card, &local_err); -if (local_err !=NULL ) { -error_propagate (errp, local_err); -return ; - } + cc->unrealize (card); } s->card =NULL ; }
hw/usb/dev-uas.c +1 -1
@@ -894,7 +894,7 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p) } } -static void usb_uas_unrealize (USBDevice *dev,Error **errp) +static void usb_uas_unrealize (USBDevice *dev) {UASDevice *uas =USB_UAS (dev);
hw/usb/dev-wacom.c +1 -1
@@ -331,7 +331,7 @@ static void usb_wacom_handle_data(USBDevice *dev, USBPacket *p) } } -static void usb_wacom_unrealize (USBDevice *dev,Error **errp) +static void usb_wacom_unrealize (USBDevice *dev) {USBWacomState *s = (USBWacomState *) dev;
hw/usb/hcd-ehci-pci.c +1 -1
@@ -105,7 +105,7 @@ static void usb_ehci_pci_exit(PCIDevice *dev)EHCIPCIState *i =PCI_EHCI (dev);EHCIState *s = &i->ehci; -usb_ehci_unrealize (s,DEVICE (dev),NULL ); +usb_ehci_unrealize (s,DEVICE (dev));g_free (s->irq); s->irq =NULL ;
hw/usb/hcd-ehci.c +1 -1
@@ -2522,7 +2522,7 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp) s->vmstate =qemu_add_vm_change_state_handler (usb_ehci_vm_state_change, s); } -void usb_ehci_unrealize (EHCIState *s,DeviceState *dev,Error **errp) +void usb_ehci_unrealize (EHCIState *s,DeviceState *dev) {trace_usb_ehci_unrealize ();
hw/usb/host-libusb.c +1 -1
@@ -1104,7 +1104,7 @@ static void usb_host_instance_init(Object *obj) &udev->qdev); } -static void usb_host_unrealize (USBDevice *udev,Error **errp) +static void usb_host_unrealize (USBDevice *udev) {USBHostDevice *s =USB_HOST_DEVICE (udev);
hw/usb/redirect.c +1 -1
@@ -1468,7 +1468,7 @@ static void usbredir_cleanup_device_queues(USBRedirDevice *dev) } } -static void usbredir_unrealize (USBDevice *udev,Error **errp) +static void usbredir_unrealize (USBDevice *udev) {USBRedirDevice *dev =USB_REDIRECT (udev);
hw/vfio/ap.c +1 -1
@@ -124,7 +124,7 @@ out_get_dev_err:vfio_put_group (vfio_group); } -static void vfio_ap_unrealize (DeviceState *dev,Error **errp) +static void vfio_ap_unrealize (DeviceState *dev) {APDevice *apdev =AP_DEVICE (dev);VFIOAPDevice *vapdev =VFIO_AP_DEVICE (apdev);
hw/vfio/ccw.c +3 -3
@@ -521,13 +521,13 @@ out_device_err:vfio_put_group (group); out_group_err:if (cdc->unrealize) { - cdc->unrealize (cdev,NULL ); + cdc->unrealize (cdev); } out_err_propagate:error_propagate (errp, err); } -static void vfio_ccw_unrealize (DeviceState *dev,Error **errp) +static void vfio_ccw_unrealize (DeviceState *dev) {CcwDevice *ccw_dev =DO_UPCAST (CcwDevice, parent_obj, dev);S390CCWDevice *cdev =DO_UPCAST (S390CCWDevice, parent_obj, ccw_dev);
@@ -541,7 +541,7 @@ static void vfio_ccw_unrealize(DeviceState *dev, Error **errp)vfio_put_group (group);if (cdc->unrealize) { - cdc->unrealize (cdev, errp); + cdc->unrealize (cdev); } }
hw/virtio/vhost-user-fs.c +1 -1
@@ -241,7 +241,7 @@ err_virtio:return ; } -static void vuf_device_unrealize (DeviceState *dev,Error **errp) +static void vuf_device_unrealize (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VHostUserFS *fs =VHOST_USER_FS (dev);
hw/virtio/vhost-vsock.c +1 -1
@@ -377,7 +377,7 @@ err_virtio:return ; } -static void vhost_vsock_device_unrealize (DeviceState *dev,Error **errp) +static void vhost_vsock_device_unrealize (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VHostVSock *vsock =VHOST_VSOCK (dev);
hw/virtio/virtio-balloon.c +1 -1
@@ -819,7 +819,7 @@ static void virtio_balloon_device_realize(DeviceState *dev, Error **errp)reset_stats (s); } -static void virtio_balloon_device_unrealize (DeviceState *dev,Error **errp) +static void virtio_balloon_device_unrealize (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VirtIOBalloon *s =VIRTIO_BALLOON (dev);
hw/virtio/virtio-crypto.c +1 -1
@@ -822,7 +822,7 @@ static void virtio_crypto_device_realize(DeviceState *dev, Error **errp)cryptodev_backend_set_used (vcrypto->cryptodev, true); } -static void virtio_crypto_device_unrealize (DeviceState *dev,Error **errp) +static void virtio_crypto_device_unrealize (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VirtIOCrypto *vcrypto =VIRTIO_CRYPTO (dev);
hw/virtio/virtio-iommu.c +1 -1
@@ -688,7 +688,7 @@ static void virtio_iommu_device_realize(DeviceState *dev, Error **errp) } } -static void virtio_iommu_device_unrealize (DeviceState *dev,Error **errp) +static void virtio_iommu_device_unrealize (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VirtIOIOMMU *s =VIRTIO_IOMMU (dev);
hw/virtio/virtio-pmem.c +1 -1
@@ -124,7 +124,7 @@ static void virtio_pmem_realize(DeviceState *dev, Error **errp) pmem->rq_vq =virtio_add_queue (vdev,128 , virtio_pmem_flush); } -static void virtio_pmem_unrealize (DeviceState *dev,Error **errp) +static void virtio_pmem_unrealize (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VirtIOPMEM *pmem =VIRTIO_PMEM (dev);
hw/virtio/virtio-rng.c +1 -1
@@ -230,7 +230,7 @@ static void virtio_rng_device_realize(DeviceState *dev, Error **errp) vrng); } -static void virtio_rng_device_unrealize (DeviceState *dev,Error **errp) +static void virtio_rng_device_unrealize (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VirtIORNG *vrng =VIRTIO_RNG (dev);
hw/virtio/virtio.c +3 -8
@@ -3622,7 +3622,7 @@ static void virtio_device_realize(DeviceState *dev, Error **errp)virtio_bus_device_plugged (vdev, &err);if (err !=NULL ) {error_propagate (errp, err); - vdc->unrealize (dev,NULL ); + vdc->unrealize (dev);return ; }
@@ -3630,20 +3630,15 @@ static void virtio_device_realize(DeviceState *dev, Error **errp)memory_listener_register (&vdev->listener, vdev->dma_as); } -static void virtio_device_unrealize (DeviceState *dev,Error **errp) +static void virtio_device_unrealize (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VirtioDeviceClass *vdc =VIRTIO_DEVICE_GET_CLASS (dev); -Error *err =NULL ;virtio_bus_device_unplugged (vdev);if (vdc->unrealize !=NULL ) { - vdc->unrealize (dev, &err); -if (err !=NULL ) { -error_propagate (errp, err); -return ; - } + vdc->unrealize (dev); }g_free (vdev->bus_name);
hw/watchdog/wdt_diag288.c +1 -1
@@ -108,7 +108,7 @@ static void wdt_diag288_realize(DeviceState *dev, Error **errp) dev); } -static void wdt_diag288_unrealize (DeviceState *dev,Error **errp) +static void wdt_diag288_unrealize (DeviceState *dev) {DIAG288State *diag288 =DIAG288 (dev);
hw/xen/xen-bus.c +6 -6
@@ -428,7 +428,7 @@ static void xen_bus_backend_changed(void *opaque)xen_bus_cleanup (xenbus); } -static void xen_bus_unrealize (BusState *bus,Error **errp) +static void xen_bus_unrealize (BusState *bus) {XenBus *xenbus =XEN_BUS (bus);
@@ -486,7 +486,7 @@ static void xen_bus_realize(BusState *bus, Error **errp)return ; fail: -xen_bus_unrealize (bus, &error_abort); +xen_bus_unrealize (bus); } static void xen_bus_unplug_request(HotplugHandler *hotplug,
@@ -1189,7 +1189,7 @@ void xen_device_unbind_event_channel(XenDevice *xendev,g_free (channel); } -static void xen_device_unrealize (DeviceState *dev,Error **errp) +static void xen_device_unrealize (DeviceState *dev) {XenDevice *xendev =XEN_DEVICE (dev);XenDeviceClass *xendev_class =XEN_DEVICE_GET_CLASS (xendev);
@@ -1208,7 +1208,7 @@ static void xen_device_unrealize(DeviceState *dev, Error **errp) }if (xendev_class->unrealize) { - xendev_class->unrealize (xendev, errp); + xendev_class->unrealize (xendev); }/* Make sure all event channels are cleaned up */
@@ -1242,7 +1242,7 @@ static void xen_device_exit(Notifier *n, void *data) {XenDevice *xendev =container_of (n, XenDevice, exit); -xen_device_unrealize (DEVICE (xendev), &error_abort); +xen_device_unrealize (DEVICE (xendev)); }static void xen_device_realize (DeviceState *dev,Error **errp)
@@ -1336,7 +1336,7 @@ static void xen_device_realize(DeviceState *dev, Error **errp)return ; unrealize: -xen_device_unrealize (dev, &error_abort); +xen_device_unrealize (dev); }static Property xen_device_props[] = {
target/i386/cpu.c +2 -7
@@ -6722,11 +6722,10 @@ out: } } -static void x86_cpu_unrealizefn (DeviceState *dev,Error **errp) +static void x86_cpu_unrealizefn (DeviceState *dev) {X86CPU *cpu =X86_CPU (dev);X86CPUClass *xcc =X86_CPU_GET_CLASS (dev); -Error *local_err =NULL ;#ifndef CONFIG_USER_ONLY cpu_remove_sync (CPU (dev));
@@ -6738,11 +6737,7 @@ static void x86_cpu_unrealizefn(DeviceState *dev, Error **errp) cpu->apic_state =NULL ; } - xcc->parent_unrealize (dev, &local_err); -if (local_err !=NULL ) { -error_propagate (errp, local_err); -return ; - } + xcc->parent_unrealize (dev); } typedef struct BitProperty {
target/ppc/translate_init.inc.c +2 -7
@@ -10293,19 +10293,14 @@ unrealize:cpu_exec_unrealizefn (cs); } -static void ppc_cpu_unrealize (DeviceState *dev,Error **errp) +static void ppc_cpu_unrealize (DeviceState *dev) {PowerPCCPU *cpu =POWERPC_CPU (dev);PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (cpu); -Error *local_err =NULL ;opc_handler_t **table, **table_2;int i, j, k; - pcc->parent_unrealize (dev, &local_err); -if (local_err !=NULL ) { -error_propagate (errp, local_err); -return ; - } + pcc->parent_unrealize (dev);for (i =0 ; i <PPC_CPU_OPCODES_LEN ; i++) {if (cpu->opcodes[i] == &invalid_handler) {
Signature · 1 line
2.21.1
PATCH 11/17 hw/arm/bcm2835: Drop futile attempts at QOM-adopting memory
In reply to Markus ArmbrusterThe "bcm2835-peripherals" device's .instance_init() method bcm2835_peripherals_init() attempts to make two memory regions QOM children of the device. This is futile, because memory_region_init() already did. The errors are ignored (a later commit will change that). Drop the useless calls.
--- hw/arm/bcm2835_peripherals.c | 2 -- 1 file changed, 2 deletions(-)
hw/arm/bcm2835_peripherals.c +0 -2
@@ -43,12 +43,10 @@ static void bcm2835_peripherals_init(Object *obj)/* Memory region for peripheral devices, which we export to our parent */ memory_region_init (&s->peri_mr, obj,"bcm2835-peripherals" ,0x1000000 ); -object_property_add_child (obj,"peripheral-io" ,OBJECT (&s->peri_mr),NULL );sysbus_init_mmio (SYS_BUS_DEVICE (s), &s->peri_mr);/* Internal memory region for peripheral bus addresses (not exported) */ memory_region_init (&s->gpu_bus_mr, obj,"bcm2835-gpu" , (uint64_t )1 <<32 ); -object_property_add_child (obj,"gpu-bus" ,OBJECT (&s->gpu_bus_mr),NULL );/* Internal memory region for request/response communication with * mailbox-addressable peripherals (not exported)
Signature · 1 line
2.21.1
PATCH 9/17 hw/isa/superio: Make the components QOM children
In reply to Markus Armbrusterisa_superio_realize() attempts to make isa-parallel and isa-serial QOM children, but this does not work, because it calls object_property_add_child() after realizing with qdev_init_nofail(). Realizing a device without a parent gives it one: it gets put into the "/machine/unattached/" orphanage. The extra object_property_add_child() fails, and isa_superio_realize() ignores the error.
Move the object_property_add_child() before qdev_init_nofail(), and pass &error_abort.
For the other components, isa_superio_realize() doesn't even try. Add object_property_add_child() there.
This affects machines 40p, clipper and fulong2e.
For instance, fulong2e has its vt82c686b-superio (which is an isa-superio) at /machine/unattached/device[9]. Before the patch, its components are at /machine/unattached/device[10] .. [14]. Afterwards, they are at /machine/unattached/device[9]/{parallel0,serial0,serial1,isa-fdc,i8042}.
--- hw/isa/isa-superio.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
hw/isa/isa-superio.c +13 -5
@@ -62,6 +62,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)qdev_prop_set_uint32 (d,"irq" , k->parallel.get_irq (sio, i)); }qdev_prop_set_chr (d,"chardev" , chr); +object_property_add_child (OBJECT (sio), name,OBJECT (isa), + &error_abort);qdev_init_nofail (d); sio->parallel[i] = isa; trace_superio_create_parallel(i,
@@ -69,8 +71,6 @@ static void isa_superio_realize(DeviceState *dev, Error **errp) k->parallel.get_iobase(sio, i) : -1, k->parallel.get_irq ? k->parallel.get_irq(sio, i) : -1); -object_property_add_child (OBJECT (dev), name, -OBJECT (sio->parallel[i]),NULL );g_free (name); } }
@@ -102,6 +102,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)qdev_prop_set_uint32 (d,"irq" , k->serial.get_irq (sio, i)); }qdev_prop_set_chr (d,"chardev" , chr); +object_property_add_child (OBJECT (sio), name,OBJECT (isa), + &error_abort);qdev_init_nofail (d); sio->serial[i] = isa; trace_superio_create_serial(i,
@@ -109,8 +111,6 @@ static void isa_superio_realize(DeviceState *dev, Error **errp) k->serial.get_iobase(sio, i) : -1, k->serial.get_irq ? k->serial.get_irq(sio, i) : -1); -object_property_add_child (OBJECT (dev), name, -OBJECT (sio->serial[0 ]),NULL );g_free (name); } }
@@ -137,6 +137,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)qdev_prop_set_drive (d,"driveB" ,blk_by_legacy_dinfo (drive), &error_fatal); } +object_property_add_child (OBJECT (sio),"isa-fdc" ,OBJECT (isa), + &error_abort);qdev_init_nofail (d); sio->floppy = isa; trace_superio_create_floppy(0,
@@ -147,7 +149,11 @@ static void isa_superio_realize(DeviceState *dev, Error **errp) }/* Keyboard, mouse */ - sio->kbc =isa_create_simple (bus,TYPE_I8042 ); + isa =isa_create (bus,TYPE_I8042 ); +object_property_add_child (OBJECT (sio),TYPE_I8042 ,OBJECT (isa), + &error_abort); +qdev_init_nofail (DEVICE (isa)); + sio->kbc = isa;/* IDE */ if (k->ide.count && (!k->ide.is_enabled || k->ide.is_enabled (sio,0 ))) {
@@ -163,6 +169,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)qdev_prop_set_uint32 (d,"irq" , k->ide.get_irq (sio,0 )); }qdev_init_nofail (d); +object_property_add_child (OBJECT (sio),"isa-ide" ,OBJECT (isa), + &error_abort); sio->ide = isa; trace_superio_create_ide(0, k->ide.get_iobase ?
Signature · 1 line
2.21.1
PATCH 13/17 qom: Drop parameter @errp of object_property_add() & friends
In reply to Markus ArmbrusterThe only way object_property_add() can fail is when a property with the same name already exists. Since our property names are all hardcoded, failure is a programming error, and the appropriate way to handle it is passing &error_abort.
Same for its variants, except for object_property_add_child(), which additionally fails when the child already has a parent. Parentage is also under program control, so this is a programming error, too.
We have a bit over 500 callers. Almost half of them pass &error_abort, slightly fewer ignore errors, one test case handles errors, and the remaining few callers pass them to their own callers.
The previous few commits demonstrated once again that ignoring programming errors is a bad idea.
Of the few ones that pass on errors, several violate the Error API. The Error ** argument must be NULL, &error_abort, &error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second call. ich9_pm_add_properties(), sparc32_ledma_realize(), sparc32_dma_realize(), xilinx_axidma_realize(), xilinx_enet_realize() are wrong that way.
When the one appropriate choice of argument is &error_abort, letting users pick the argument is a bad idea.
Drop parameter @errp and assert the preconditions instead.
There's one exception to "duplicate property name is a programming error": the way object_property_add() implements the magic (and undocumented) "automatic arrayification". Don't drop @errp there. Instead, rename object_property_add() to object_property_try_add(), and add the obvious wrapper object_property_add().
--- include/qom/object.h | 81 +++----- accel/kvm/kvm-all.c | 4 +- accel/tcg/tcg-all.c | 5 +- authz/list.c | 5 +- authz/listfile.c | 6 +- authz/pamacct.c | 3 +- authz/simple.c | 3 +- backends/cryptodev-vhost-user.c | 3 +- backends/cryptodev.c | 2 +- backends/dbus-vmstate.c | 6 +- backends/hostmem-file.c | 11 +- backends/hostmem-memfd.c | 8 +- backends/hostmem.c | 19 +- backends/rng-egd.c | 3 +- backends/rng-random.c | 3 +- backends/rng.c | 3 +- backends/vhost-user.c | 2 +- block/throttle-groups.c | 6 +- bootdevice.c | 8 +- chardev/char-socket.c | 4 +- chardev/char.c | 7 +- crypto/secret.c | 18 +- crypto/tlscreds.c | 12 +- crypto/tlscredsanon.c | 3 +- crypto/tlscredspsk.c | 6 +- crypto/tlscredsx509.c | 9 +- hw/acpi/ich9.c | 23 +-- hw/acpi/pcihp.c | 7 +- hw/acpi/piix4.c | 15 +- hw/arm/allwinner-a10.c | 2 +- hw/arm/allwinner-h3.c | 12 +- hw/arm/armv7m.c | 2 +- hw/arm/aspeed.c | 2 +- hw/arm/aspeed_ast2600.c | 13 +- hw/arm/aspeed_soc.c | 13 +- hw/arm/bcm2835_peripherals.c | 26 +-- hw/arm/bcm2836.c | 16 +- hw/arm/cubieboard.c | 3 +- hw/arm/mcimx6ul-evk.c | 2 +- hw/arm/mcimx7d-sabre.c | 2 +- hw/arm/msf2-soc.c | 3 +- hw/arm/nrf51_soc.c | 3 +- hw/arm/orangepi.c | 3 +- hw/arm/raspi.c | 3 +- hw/arm/sabrelite.c | 2 +- hw/arm/sbsa-ref.c | 5 +- hw/arm/vexpress.c | 4 +- hw/arm/virt.c | 19 +- hw/arm/xlnx-versal-virt.c | 3 +- hw/arm/xlnx-versal.c | 10 +- hw/arm/xlnx-zcu102.c | 4 +- hw/arm/xlnx-zynqmp.c | 9 +- hw/audio/marvell_88w8618.c | 2 +- hw/audio/pcspk.c | 2 +- hw/core/bus.c | 7 +- hw/core/machine.c | 46 ++--- hw/core/qdev-properties.c | 9 +- hw/core/qdev.c | 40 ++-- hw/cpu/core.c | 4 +- hw/display/bochs-display.c | 3 +- hw/display/sm501.c | 2 +- hw/display/vga-pci.c | 4 +- hw/display/vhost-user-gpu-pci.c | 3 +- hw/display/vhost-user-gpu.c | 2 +- hw/display/vhost-user-vga.c | 3 +- hw/display/xlnx_dp.c | 7 +- hw/dma/sparc32_dma.c | 10 +- hw/dma/xilinx_axidma.c | 9 +- hw/dma/xlnx-zdma.c | 3 +- hw/gpio/aspeed_gpio.c | 2 +- hw/hyperv/hyperv.c | 2 +- hw/i386/microvm.c | 15 +- hw/i386/pc.c | 12 +- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 4 +- hw/i386/pc_sysfw.c | 5 +- hw/i386/x86.c | 8 +- hw/ide/macio.c | 2 +- hw/ide/qdev.c | 2 +- hw/input/vhost-user-input.c | 2 +- hw/intc/apic_common.c | 2 +- hw/intc/s390_flic.c | 4 +- hw/intc/xics.c | 2 +- hw/intc/xive.c | 2 +- hw/ipmi/ipmi.c | 3 +- hw/isa/isa-superio.c | 15 +- hw/isa/lpc_ich9.c | 6 +- hw/mem/nvdimm.c | 4 +- hw/mem/pc-dimm.c | 2 +- hw/microblaze/petalogix_ml605_mmu.c | 6 +- hw/misc/aspeed_sdmc.c | 2 +- hw/misc/edu.c | 3 +- hw/misc/mac_via.c | 4 +- hw/misc/macio/gpio.c | 2 +- hw/misc/macio/macio.c | 4 +- hw/misc/macio/pmu.c | 2 +- hw/misc/pca9552.c | 2 +- hw/misc/tmp105.c | 2 +- hw/misc/tmp421.c | 8 +- hw/net/cadence_gem.c | 3 +- hw/net/can/can_kvaser_pci.c | 2 +- hw/net/can/can_mioe3680_pci.c | 4 +- hw/net/can/can_pcm3680_pci.c | 4 +- hw/net/ne2000-isa.c | 2 +- hw/net/xilinx_axienet.c | 9 +- hw/nios2/10m50_devboard.c | 3 +- hw/nvram/fw_cfg.c | 4 +- hw/pci-host/grackle.c | 2 +- hw/pci-host/i440fx.c | 12 +- hw/pci-host/pnv_phb3_msi.c | 3 +- hw/pci-host/pnv_phb3_pbcq.c | 3 +- hw/pci-host/q35.c | 20 +- hw/pci-host/sabre.c | 2 +- hw/pci-host/uninorth.c | 8 +- hw/pcmcia/pxa2xx.c | 2 +- hw/ppc/e500.c | 8 +- hw/ppc/mac_newworld.c | 4 +- hw/ppc/mac_oldworld.c | 2 +- hw/ppc/pnv.c | 13 +- hw/ppc/pnv_bmc.c | 5 +- hw/ppc/pnv_core.c | 2 +- hw/ppc/pnv_psi.c | 2 +- hw/ppc/prep.c | 6 +- hw/ppc/spapr.c | 25 +-- hw/ppc/spapr_caps.c | 8 +- hw/ppc/spapr_cpu_core.c | 5 +- hw/ppc/spapr_drc.c | 18 +- hw/ppc/spapr_iommu.c | 2 +- hw/ppc/spapr_irq.c | 2 +- hw/ppc/spapr_rtc.c | 2 +- hw/riscv/sifive_u.c | 2 +- hw/riscv/virt.c | 5 +- hw/rtc/mc146818rtc.c | 4 +- hw/s390x/ap-bridge.c | 2 +- hw/s390x/css-bridge.c | 4 +- hw/s390x/event-facility.c | 6 +- hw/s390x/s390-skeys.c | 4 +- hw/s390x/s390-stattrib.c | 4 +- hw/s390x/s390-virtio-ccw.c | 10 +- hw/s390x/sclp.c | 5 +- hw/s390x/tod.c | 2 +- hw/s390x/virtio-ccw-balloon.c | 4 +- hw/s390x/virtio-ccw-blk.c | 2 +- hw/s390x/virtio-ccw-net.c | 2 +- hw/scsi/scsi-bus.c | 2 +- hw/sparc/sun4m.c | 4 +- hw/sparc64/sun4u.c | 2 +- hw/ssi/xilinx_spips.c | 3 +- hw/usb/bus.c | 6 +- hw/usb/dev-storage.c | 2 +- hw/vfio/pci-quirks.c | 6 +- hw/virtio/vhost-scsi-pci.c | 2 +- hw/virtio/vhost-user-blk-pci.c | 2 +- hw/virtio/vhost-user-input-pci.c | 3 +- hw/virtio/vhost-user-scsi-pci.c | 2 +- hw/virtio/virtio-balloon-pci.c | 4 +- hw/virtio/virtio-balloon.c | 4 +- hw/virtio/virtio-blk-pci.c | 2 +- hw/virtio/virtio-net-pci.c | 2 +- hw/virtio/virtio-rng.c | 2 +- hw/xen/xen-common.c | 3 +- iothread.c | 6 +- memory.c | 10 +- net/can/can_host.c | 3 +- net/can/can_socketcan.c | 3 +- net/colo-compare.c | 20 +- net/dump.c | 4 +- net/filter-buffer.c | 2 +- net/filter-mirror.c | 10 +- net/filter-rewriter.c | 2 +- net/filter.c | 15 +- qdev-monitor.c | 4 +- qom/container.c | 2 +- qom/object.c | 302 +++++++++------------------- qom/object_interfaces.c | 5 +- scsi/pr-manager-helper.c | 3 +- softmmu/vl.c | 7 +- target/arm/cpu.c | 11 +- target/arm/cpu64.c | 8 +- target/arm/kvm.c | 2 +- target/i386/cpu.c | 83 ++++---- target/i386/sev.c | 17 +- target/ppc/compat.c | 9 +- target/s390x/cpu.c | 2 +- target/s390x/cpu_models.c | 11 +- tests/check-qom-proplist.c | 29 +-- tests/test-qdev-global-props.c | 4 +- ui/console.c | 7 +- ui/input-barrier.c | 14 +- ui/input-linux.c | 8 +- 190 files changed, 643 insertions(+), 987 deletions(-)
include/qom/object.h +25 -56
@@ -1036,7 +1036,6 @@ void object_unref(Object *obj);* meant to allow a property to free its opaque upon object * destruction. This may be NULL. * @opaque: an opaque pointer to pass to the callbacks for the property -* @errp: returns an error if this function fails * * Returns: The #ObjectProperty; this can be used to set the @resolve * callback for child and link properties.
@@ -1046,7 +1045,7 @@ ObjectProperty *object_property_add(Object *obj, const char *name, ObjectPropertyAccessor *get, ObjectPropertyAccessor *set, ObjectPropertyRelease *release, - void *opaque, Error **errp); + void *opaque);void object_property_del (Object *obj,const char *name,Error **errp);
@@ -1055,7 +1054,7 @@ ObjectProperty *object_class_property_add(ObjectClass *klass, const char *name, ObjectPropertyAccessor *get, ObjectPropertyAccessor *set, ObjectPropertyRelease *release, - void *opaque, Error **errp); + void *opaque);/** * object_property_set_default_bool:
@@ -1494,7 +1493,6 @@ Object *object_resolve_path_component(Object *parent, const char *part);* @obj: the object to add a property to * @name: the name of the property * @child: the child object -* @errp: if an error occurs, a pointer to an area to store the error * * Child properties form the composition tree. All objects need to be a child * of another object. Objects can only be a child of one object.
@@ -1509,7 +1507,7 @@ Object *object_resolve_path_component(Object *parent, const char *part);* Returns: The newly added property on success, or %NULL on failure. */ ObjectProperty *object_property_add_child (Object *obj,const char *name, -Object *child,Error **errp); +Object *child); typedef enum { /* Unref the link pointer when the property is deleted */
@@ -1538,7 +1536,6 @@ void object_property_allow_set_link(const Object *, const char *,* @targetp: a pointer to where the link object reference is stored * @check: callback to veto setting or NULL if the property is read-only * @flags: additional options for the link -* @errp: if an error occurs, a pointer to an area to store the error * * Links establish relationships between objects. Links are unidirectional * although two links can be combined to form a bidirectional relationship
@@ -1565,16 +1562,14 @@ ObjectProperty *object_property_add_link(Object *obj, const char *name, const char *type, Object **targetp, void (*check)(const Object *obj, const char *name,Object *val,Error **errp), - ObjectPropertyLinkFlags flags, - Error **errp); + ObjectPropertyLinkFlags flags);ObjectProperty *object_class_property_add_link (ObjectClass *oc,const char *name,const char *type,ptrdiff_t offset,void (*check)(const Object *obj,const char *name,Object *val,Error **errp), -ObjectPropertyLinkFlags flags, -Error **errp); +ObjectPropertyLinkFlags flags);/** * object_property_add_str:
@@ -1583,7 +1578,6 @@ ObjectProperty *object_class_property_add_link(ObjectClass *oc,* @get: the getter or NULL if the property is write-only. This function must * return a string to be freed by g_free(). * @set: the setter or NULL if the property is read-only -* @errp: if an error occurs, a pointer to an area to store the error * * Add a string property using getters/setters. This function will add a * property of type 'string'.
@@ -1592,15 +1586,13 @@ ObjectProperty *object_class_property_add_link(ObjectClass *oc,*/ ObjectProperty *object_property_add_str (Object *obj,const char *name,char *(*get)(Object *,Error **), -void (*set)(Object *,const char *,Error **), -Error **errp); +void (*set)(Object *,const char *,Error **));ObjectProperty *object_class_property_add_str (ObjectClass *klass,const char *name,char *(*get)(Object *,Error **),void (*set)(Object *,const char *, -Error **), -Error **errp); +Error **));/** * object_property_add_bool:
@@ -1608,7 +1600,6 @@ ObjectProperty *object_class_property_add_str(ObjectClass *klass,* @name: the name of the property * @get: the getter or NULL if the property is write-only. * @set: the setter or NULL if the property is read-only -* @errp: if an error occurs, a pointer to an area to store the error * * Add a bool property using getters/setters. This function will add a * property of type 'bool'.
@@ -1617,14 +1608,12 @@ ObjectProperty *object_class_property_add_str(ObjectClass *klass,*/ ObjectProperty *object_property_add_bool (Object *obj,const char *name,bool (*get)(Object *,Error **), -void (*set)(Object *,bool ,Error **), -Error **errp); +void (*set)(Object *,bool ,Error **));ObjectProperty *object_class_property_add_bool (ObjectClass *klass,const char *name,bool (*get)(Object *,Error **), -void (*set)(Object *,bool ,Error **), -Error **errp); +void (*set)(Object *,bool ,Error **));/** * object_property_add_enum:
@@ -1633,7 +1622,6 @@ ObjectProperty *object_class_property_add_bool(ObjectClass *klass,* @typename: the name of the enum data type * @get: the getter or %NULL if the property is write-only. * @set: the setter or %NULL if the property is read-only -* @errp: if an error occurs, a pointer to an area to store the error * * Add an enum property using getters/setters. This function will add a * property of type '@typename'.
@@ -1644,23 +1632,20 @@ ObjectProperty *object_property_add_enum(Object *obj, const char *name,const char *typename, const QEnumLookup *lookup, int (*get)(Object *, Error **), - void (*set)(Object *, int, Error **), - Error **errp); + void (*set)(Object *, int, Error **));ObjectProperty *object_class_property_add_enum (ObjectClass *klass,const char *name,const char *typename,const QEnumLookup *lookup,int (*get)(Object *,Error **), -void (*set)(Object *,int ,Error **), -Error **errp); +void (*set)(Object *,int ,Error **));/** * object_property_add_tm: * @obj: the object to add a property to * @name: the name of the property * @get: the getter or NULL if the property is write-only. -* @errp: if an error occurs, a pointer to an area to store the error * * Add a read-only struct tm valued property using a getter function. * This function will add a property of type 'struct tm'.
@@ -1668,13 +1653,11 @@ ObjectProperty *object_class_property_add_enum(ObjectClass *klass,* Returns: The newly added property on success, or %NULL on failure. */ ObjectProperty *object_property_add_tm (Object *obj,const char *name, -void (*get)(Object *,struct tm *,Error **), -Error **errp); +void (*get)(Object *,struct tm *,Error **));ObjectProperty *object_class_property_add_tm (ObjectClass *klass, -const char *name, -void (*get)(Object *,struct tm *,Error **), -Error **errp); +const char *name, +void (*get)(Object *,struct tm *,Error **)); typedef enum { /* Automatically add a getter to the property */
@@ -1691,7 +1674,6 @@ typedef enum {* @name: the name of the property * @v: pointer to value * @flags: bitwise-or'd ObjectPropertyFlags -* @errp: if an error occurs, a pointer to an area to store the error * * Add an integer property in memory. This function will add a * property of type 'uint8'.
@@ -1699,14 +1681,13 @@ typedef enum {* Returns: The newly added property on success, or %NULL on failure. */ ObjectProperty *object_property_add_uint8_ptr (Object *obj,const char *name, -const uint8_t *v,ObjectPropertyFlags flags, -Error **errp); +const uint8_t *v, +ObjectPropertyFlags flags);ObjectProperty *object_class_property_add_uint8_ptr (ObjectClass *klass,const char *name,const uint8_t *v, -ObjectPropertyFlags flags, -Error **errp); +ObjectPropertyFlags flags);/** * object_property_add_uint16_ptr:
@@ -1714,7 +1695,6 @@ ObjectProperty *object_class_property_add_uint8_ptr(ObjectClass *klass,* @name: the name of the property * @v: pointer to value * @flags: bitwise-or'd ObjectPropertyFlags -* @errp: if an error occurs, a pointer to an area to store the error * * Add an integer property in memory. This function will add a * property of type 'uint16'.
@@ -1723,14 +1703,12 @@ ObjectProperty *object_class_property_add_uint8_ptr(ObjectClass *klass,*/ ObjectProperty *object_property_add_uint16_ptr (Object *obj,const char *name,const uint16_t *v, -ObjectPropertyFlags flags, -Error **errp); +ObjectPropertyFlags flags);ObjectProperty *object_class_property_add_uint16_ptr (ObjectClass *klass,const char *name,const uint16_t *v, -ObjectPropertyFlags flags, -Error **errp); +ObjectPropertyFlags flags);/** * object_property_add_uint32_ptr:
@@ -1738,7 +1716,6 @@ ObjectProperty *object_class_property_add_uint16_ptr(ObjectClass *klass,* @name: the name of the property * @v: pointer to value * @flags: bitwise-or'd ObjectPropertyFlags -* @errp: if an error occurs, a pointer to an area to store the error * * Add an integer property in memory. This function will add a * property of type 'uint32'.
@@ -1747,14 +1724,12 @@ ObjectProperty *object_class_property_add_uint16_ptr(ObjectClass *klass,*/ ObjectProperty *object_property_add_uint32_ptr (Object *obj,const char *name,const uint32_t *v, -ObjectPropertyFlags flags, -Error **errp); +ObjectPropertyFlags flags);ObjectProperty *object_class_property_add_uint32_ptr (ObjectClass *klass,const char *name,const uint32_t *v, -ObjectPropertyFlags flags, -Error **errp); +ObjectPropertyFlags flags);/** * object_property_add_uint64_ptr:
@@ -1762,7 +1737,6 @@ ObjectProperty *object_class_property_add_uint32_ptr(ObjectClass *klass,* @name: the name of the property * @v: pointer to value * @flags: bitwise-or'd ObjectPropertyFlags -* @errp: if an error occurs, a pointer to an area to store the error * * Add an integer property in memory. This function will add a * property of type 'uint64'.
@@ -1771,14 +1745,12 @@ ObjectProperty *object_class_property_add_uint32_ptr(ObjectClass *klass,*/ ObjectProperty *object_property_add_uint64_ptr (Object *obj,const char *name,const uint64_t *v, -ObjectPropertyFlags flags, -Error **Errp); +ObjectPropertyFlags flags);ObjectProperty *object_class_property_add_uint64_ptr (ObjectClass *klass,const char *name,const uint64_t *v, -ObjectPropertyFlags flags, -Error **Errp); +ObjectPropertyFlags flags);/** * object_property_add_alias:
@@ -1786,7 +1758,6 @@ ObjectProperty *object_class_property_add_uint64_ptr(ObjectClass *klass,* @name: the name of the property * @target_obj: the object to forward property access to * @target_name: the name of the property on the forwarded object -* @errp: if an error occurs, a pointer to an area to store the error * * Add an alias for a property on an object. This function will add a property * of the same type as the forwarded property.
@@ -1799,15 +1770,13 @@ ObjectProperty *object_class_property_add_uint64_ptr(ObjectClass *klass,* Returns: The newly added property on success, or %NULL on failure. */ ObjectProperty *object_property_add_alias (Object *obj,const char *name, -Object *target_obj,const char *target_name, -Error **errp); +Object *target_obj,const char *target_name);/** * object_property_add_const_link: * @obj: the object to add a property to * @name: the name of the property * @target: the object to be referred by the link -* @errp: if an error occurs, a pointer to an area to store the error * * Add an unmodifiable link for a property on an object. This function will * add a property of type link<TYPE> where TYPE is the type of @target.
@@ -1820,7 +1789,7 @@ ObjectProperty *object_property_add_alias(Object *obj, const char *name,* Returns: The newly added property on success, or %NULL on failure. */ ObjectProperty *object_property_add_const_link (Object *obj,const char *name, -Object *target,Error **errp); +Object *target);/** * object_property_set_description:
accel/kvm/kvm-all.c +2 -2
@@ -3075,13 +3075,13 @@ static void kvm_accel_class_init(ObjectClass *oc, void *data)object_class_property_add (oc,"kernel-irqchip" ,"on|off|split" ,NULL , kvm_set_kernel_irqchip, -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_set_description (oc,"kernel-irqchip" ,"Configure KVM in-kernel irqchip" );object_class_property_add (oc,"kvm-shadow-mem" ,"int" , kvm_get_kvm_shadow_mem, kvm_set_kvm_shadow_mem, -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_set_description (oc,"kvm-shadow-mem" ,"KVM shadow MMU size" ); }
accel/tcg/tcg-all.c +2 -3
@@ -203,12 +203,11 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data)object_class_property_add_str (oc,"thread" , tcg_get_thread, - tcg_set_thread, -NULL ); + tcg_set_thread);object_class_property_add (oc,"tb-size" ,"int" , tcg_get_tb_size, tcg_set_tb_size, -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_set_description (oc,"tb-size" ,"TCG translation block cache size" );
authz/list.c +2 -3
@@ -124,13 +124,12 @@ qauthz_list_class_init(ObjectClass *oc, void *data)"QAuthZListPolicy" , &QAuthZListPolicy_lookup, qauthz_list_prop_get_policy, - qauthz_list_prop_set_policy, - NULL); + qauthz_list_prop_set_policy);object_class_property_add (oc,"rules" ,"QAuthZListRule" , qauthz_list_prop_get_rules, qauthz_list_prop_set_rules, -NULL ,NULL ,NULL ); +NULL ,NULL ); authz->is_allowed = qauthz_list_is_allowed; }
authz/listfile.c +2 -4
@@ -221,12 +221,10 @@ qauthz_list_file_class_init(ObjectClass *oc, void *data)object_class_property_add_str (oc,"filename" , qauthz_list_file_prop_get_filename, - qauthz_list_file_prop_set_filename, -NULL ); + qauthz_list_file_prop_set_filename);object_class_property_add_bool (oc,"refresh" , qauthz_list_file_prop_get_refresh, - qauthz_list_file_prop_set_refresh, -NULL ); + qauthz_list_file_prop_set_refresh); authz->is_allowed = qauthz_list_file_is_allowed; }
authz/pamacct.c +1 -2
@@ -107,8 +107,7 @@ qauthz_pam_class_init(ObjectClass *oc, void *data)object_class_property_add_str (oc,"service" , qauthz_pam_prop_get_service, - qauthz_pam_prop_set_service, -NULL ); + qauthz_pam_prop_set_service); }
authz/simple.c +1 -2
@@ -74,8 +74,7 @@ qauthz_simple_class_init(ObjectClass *oc, void *data)object_class_property_add_str (oc,"identity" , qauthz_simple_prop_get_identity, - qauthz_simple_prop_set_identity, -NULL ); + qauthz_simple_prop_set_identity); }
backends/cryptodev-vhost-user.c +1 -2
@@ -340,8 +340,7 @@ static void cryptodev_vhost_user_instance_int(Object *obj) {object_property_add_str (obj,"chardev" , cryptodev_vhost_user_get_chardev, - cryptodev_vhost_user_set_chardev, -NULL ); + cryptodev_vhost_user_set_chardev); }static void cryptodev_vhost_user_finalize (Object *obj)
backends/cryptodev.c +1 -1
@@ -213,7 +213,7 @@ static void cryptodev_backend_instance_init(Object *obj)object_property_add (obj,"queues" ,"uint32" , cryptodev_backend_get_queues, cryptodev_backend_set_queues, -NULL ,NULL ,NULL ); +NULL ,NULL );/* Initialize devices' queues property to 1 */ object_property_set_int (obj,1 ,"queues" ,NULL ); }
backends/dbus-vmstate.c +2 -4
@@ -481,11 +481,9 @@ dbus_vmstate_class_init(ObjectClass *oc, void *data) vc->get_id = dbus_vmstate_get_id;object_class_property_add_str (oc,"addr" , - get_dbus_addr, set_dbus_addr, - &error_abort); + get_dbus_addr, set_dbus_addr);object_class_property_add_str (oc,"id-list" , - get_id_list, set_id_list, - &error_abort); + get_id_list, set_id_list); }static const TypeInfo dbus_vmstate_info = {
backends/hostmem-file.c +4 -7
@@ -184,18 +184,15 @@ file_backend_class_init(ObjectClass *oc, void *data) oc->unparent = file_backend_unparent;object_class_property_add_bool (oc,"discard-data" , - file_memory_backend_get_discard_data, file_memory_backend_set_discard_data, - &error_abort); + file_memory_backend_get_discard_data, file_memory_backend_set_discard_data);object_class_property_add_str (oc,"mem-path" , - get_mem_path, set_mem_path, - &error_abort); + get_mem_path, set_mem_path);object_class_property_add (oc,"align" ,"int" , file_memory_backend_get_align, file_memory_backend_set_align, -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_add_bool (oc,"pmem" , - file_memory_backend_get_pmem, file_memory_backend_set_pmem, - &error_abort); + file_memory_backend_get_pmem, file_memory_backend_set_pmem); }static void file_backend_instance_finalize (Object *o)
backends/hostmem-memfd.c +3 -5
@@ -141,21 +141,19 @@ memfd_backend_class_init(ObjectClass *oc, void *data)if (qemu_memfd_check (MFD_HUGETLB )) {object_class_property_add_bool (oc,"hugetlb" , memfd_backend_get_hugetlb, - memfd_backend_set_hugetlb, - &error_abort); + memfd_backend_set_hugetlb);object_class_property_set_description (oc,"hugetlb" ,"Use huge pages" );object_class_property_add (oc,"hugetlbsize" ,"int" , memfd_backend_get_hugetlbsize, memfd_backend_set_hugetlbsize, -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_set_description (oc,"hugetlbsize" ,"Huge pages size (ex: 2M, 1G)" ); }object_class_property_add_bool (oc,"seal" , memfd_backend_get_seal, - memfd_backend_set_seal, - &error_abort); + memfd_backend_set_seal);object_class_property_set_description (oc,"seal" ,"Seal growing & shrinking" ); }
backends/hostmem.c +9 -10
@@ -463,51 +463,50 @@ host_memory_backend_class_init(ObjectClass *oc, void *data)object_class_property_add_bool (oc,"merge" , host_memory_backend_get_merge, - host_memory_backend_set_merge, &error_abort); + host_memory_backend_set_merge);object_class_property_set_description (oc,"merge" ,"Mark memory as mergeable" );object_class_property_add_bool (oc,"dump" , host_memory_backend_get_dump, - host_memory_backend_set_dump, &error_abort); + host_memory_backend_set_dump);object_class_property_set_description (oc,"dump" ,"Set to 'off' to exclude from core dump" );object_class_property_add_bool (oc,"prealloc" , host_memory_backend_get_prealloc, - host_memory_backend_set_prealloc, &error_abort); + host_memory_backend_set_prealloc);object_class_property_set_description (oc,"prealloc" ,"Preallocate memory" );object_class_property_add (oc,"prealloc-threads" ,"int" , host_memory_backend_get_prealloc_threads, host_memory_backend_set_prealloc_threads, -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_set_description (oc,"prealloc-threads" ,"Number of CPU threads to use for prealloc" );object_class_property_add (oc,"size" ,"int" , host_memory_backend_get_size, host_memory_backend_set_size, -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_set_description (oc,"size" ,"Size of the memory region (ex: 500M)" );object_class_property_add (oc,"host-nodes" ,"int" , host_memory_backend_get_host_nodes, host_memory_backend_set_host_nodes, -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_set_description (oc,"host-nodes" ,"Binds memory to the list of NUMA host nodes" );object_class_property_add_enum (oc,"policy" ,"HostMemPolicy" , &HostMemPolicy_lookup, host_memory_backend_get_policy, - host_memory_backend_set_policy, &error_abort); + host_memory_backend_set_policy);object_class_property_set_description (oc,"policy" ,"Set the NUMA policy" );object_class_property_add_bool (oc,"share" , - host_memory_backend_get_share, host_memory_backend_set_share, - &error_abort); + host_memory_backend_get_share, host_memory_backend_set_share);object_class_property_set_description (oc,"share" ,"Mark the memory as private to QEMU or shared" );object_class_property_add_bool (oc,"x-use-canonical-path-for-ramblock-id" , host_memory_backend_get_use_canonical_path, - host_memory_backend_set_use_canonical_path, &error_abort); + host_memory_backend_set_use_canonical_path); }static const TypeInfo host_memory_backend_info = {
backends/rng-egd.c +1 -2
@@ -138,8 +138,7 @@ static char *rng_egd_get_chardev(Object *obj, Error **errp)static void rng_egd_init (Object *obj) {object_property_add_str (obj,"chardev" , - rng_egd_get_chardev, rng_egd_set_chardev, -NULL ); + rng_egd_get_chardev, rng_egd_set_chardev); }static void rng_egd_finalize (Object *obj)
backends/rng-random.c +1 -2
@@ -110,8 +110,7 @@ static void rng_random_init(Object *obj)object_property_add_str (obj,"filename" , rng_random_get_filename, - rng_random_set_filename, -NULL ); + rng_random_set_filename); s->filename =g_strdup ("/dev/urandom" ); s->fd =-1 ;
backends/rng.c +1 -2
@@ -108,8 +108,7 @@ static void rng_backend_init(Object *obj)object_property_add_bool (obj,"opened" , rng_backend_prop_get_opened, - rng_backend_prop_set_opened, -NULL ); + rng_backend_prop_set_opened); }static void rng_backend_finalize (Object *obj)
backends/vhost-user.c +1 -1
@@ -177,7 +177,7 @@ static char *get_chardev(Object *obj, Error **errp)static void vhost_user_backend_init (Object *obj) { -object_property_add_str (obj,"chardev" , get_chardev, set_chardev,NULL ); +object_property_add_str (obj,"chardev" , get_chardev, set_chardev); }static void vhost_user_backend_finalize (Object *obj)
block/throttle-groups.c +2 -4
@@ -954,8 +954,7 @@ static void throttle_group_obj_class_init(ObjectClass *klass, void *class_data)"int" , throttle_group_get, throttle_group_set, -NULL , &properties[i], - &error_abort); + NULL, &properties[i]); }/* ThrottleLimits */
@@ -963,8 +962,7 @@ static void throttle_group_obj_class_init(ObjectClass *klass, void *class_data)"limits" ,"ThrottleLimits" , throttle_group_get_limits, throttle_group_set_limits, -NULL ,NULL , - &error_abort); + NULL, NULL); }static const TypeInfo throttle_group_info = {
bootdevice.c +1 -7
@@ -329,7 +329,6 @@ void device_add_bootindex_property(Object *obj, int32_t *bootindex, const char *name, const char *suffix, DeviceState *dev, Error **errp) { - Error *local_err = NULL; BootIndexProperty *prop = g_malloc0(sizeof(*prop)); prop->bootindex = bootindex;
@@ -340,13 +339,8 @@ void device_add_bootindex_property(Object *obj, int32_t *bootindex, device_get_bootindex, device_set_bootindex, property_release_bootindex, - prop, &local_err); + prop); -if (local_err) { -error_propagate (errp, local_err); -g_free (prop); -return ; - }/* initialize devices' bootindex property to -1 */ object_property_set_int (obj,-1 , name,NULL ); }
chardev/char-socket.c +2 -2
@@ -1489,10 +1489,10 @@ static void char_socket_class_init(ObjectClass *oc, void *data)object_class_property_add (oc,"addr" ,"SocketAddress" , char_socket_get_addr,NULL , -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_add_bool (oc,"connected" , char_socket_get_connected, -NULL , &error_abort); +NULL ); }static const TypeInfo char_socket_type_info = {
chardev/char.c +2 -5
@@ -986,10 +986,7 @@ static Chardev *chardev_new(const char *id, const char *typename, }if (id) { -object_property_add_child (get_chardevs_root (), id, obj, &local_err); -if (local_err) { - goto end; - } +object_property_add_child (get_chardevs_root (), id, obj);object_unref (obj); }
@@ -1116,7 +1113,7 @@ ChardevReturn *qmp_chardev_change(const char *id, ChardevBackend *backend,object_unparent (OBJECT (chr));object_property_add_child (get_chardevs_root (), chr_new->label, -OBJECT (chr_new), &error_abort); +OBJECT (chr_new));object_unref (OBJECT (chr_new)); ret =g_new0 (ChardevReturn,1 );
crypto/secret.c +6 -12
@@ -368,30 +368,24 @@ qcrypto_secret_class_init(ObjectClass *oc, void *data)object_class_property_add_bool (oc,"loaded" , qcrypto_secret_prop_get_loaded, - qcrypto_secret_prop_set_loaded, -NULL ); + qcrypto_secret_prop_set_loaded);object_class_property_add_enum (oc,"format" ,"QCryptoSecretFormat" , &QCryptoSecretFormat_lookup, qcrypto_secret_prop_get_format, - qcrypto_secret_prop_set_format, -NULL ); + qcrypto_secret_prop_set_format);object_class_property_add_str (oc,"data" , qcrypto_secret_prop_get_data, - qcrypto_secret_prop_set_data, -NULL ); + qcrypto_secret_prop_set_data);object_class_property_add_str (oc,"file" , qcrypto_secret_prop_get_file, - qcrypto_secret_prop_set_file, -NULL ); + qcrypto_secret_prop_set_file);object_class_property_add_str (oc,"keyid" , qcrypto_secret_prop_get_keyid, - qcrypto_secret_prop_set_keyid, -NULL ); + qcrypto_secret_prop_set_keyid);object_class_property_add_str (oc,"iv" , qcrypto_secret_prop_get_iv, - qcrypto_secret_prop_set_iv, -NULL ); + qcrypto_secret_prop_set_iv); }
crypto/tlscreds.c +4 -8
@@ -226,22 +226,18 @@ qcrypto_tls_creds_class_init(ObjectClass *oc, void *data) {object_class_property_add_bool (oc,"verify-peer" , qcrypto_tls_creds_prop_get_verify, - qcrypto_tls_creds_prop_set_verify, -NULL ); + qcrypto_tls_creds_prop_set_verify);object_class_property_add_str (oc,"dir" , qcrypto_tls_creds_prop_get_dir, - qcrypto_tls_creds_prop_set_dir, -NULL ); + qcrypto_tls_creds_prop_set_dir);object_class_property_add_enum (oc,"endpoint" ,"QCryptoTLSCredsEndpoint" , &QCryptoTLSCredsEndpoint_lookup, qcrypto_tls_creds_prop_get_endpoint, - qcrypto_tls_creds_prop_set_endpoint, -NULL ); + qcrypto_tls_creds_prop_set_endpoint);object_class_property_add_str (oc,"priority" , qcrypto_tls_creds_prop_get_priority, - qcrypto_tls_creds_prop_set_priority, -NULL ); + qcrypto_tls_creds_prop_set_priority); }
crypto/tlscredsanon.c +1 -2
@@ -187,8 +187,7 @@ qcrypto_tls_creds_anon_class_init(ObjectClass *oc, void *data)object_class_property_add_bool (oc,"loaded" , qcrypto_tls_creds_anon_prop_get_loaded, - qcrypto_tls_creds_anon_prop_set_loaded, -NULL ); + qcrypto_tls_creds_anon_prop_set_loaded); }
crypto/tlscredspsk.c +2 -4
@@ -275,12 +275,10 @@ qcrypto_tls_creds_psk_class_init(ObjectClass *oc, void *data)object_class_property_add_bool (oc,"loaded" , qcrypto_tls_creds_psk_prop_get_loaded, - qcrypto_tls_creds_psk_prop_set_loaded, -NULL ); + qcrypto_tls_creds_psk_prop_set_loaded);object_class_property_add_str (oc,"username" , qcrypto_tls_creds_psk_prop_get_username, - qcrypto_tls_creds_psk_prop_set_username, -NULL ); + qcrypto_tls_creds_psk_prop_set_username); }
crypto/tlscredsx509.c +3 -6
@@ -806,16 +806,13 @@ qcrypto_tls_creds_x509_class_init(ObjectClass *oc, void *data)object_class_property_add_bool (oc,"loaded" , qcrypto_tls_creds_x509_prop_get_loaded, - qcrypto_tls_creds_x509_prop_set_loaded, -NULL ); + qcrypto_tls_creds_x509_prop_set_loaded);object_class_property_add_bool (oc,"sanity-check" , qcrypto_tls_creds_x509_prop_get_sanity, - qcrypto_tls_creds_x509_prop_set_sanity, -NULL ); + qcrypto_tls_creds_x509_prop_set_sanity);object_class_property_add_str (oc,"passwordid" , qcrypto_tls_creds_x509_prop_get_passwordid, - qcrypto_tls_creds_x509_prop_set_passwordid, -NULL ); + qcrypto_tls_creds_x509_prop_set_passwordid); }
hw/acpi/ich9.c +9 -14
@@ -379,32 +379,27 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp) pm->s4_val =2 ;object_property_add_uint32_ptr (obj,ACPI_PM_PROP_PM_IO_BASE , - &pm->pm_io_base,OBJ_PROP_FLAG_READ , errp); + &pm->pm_io_base,OBJ_PROP_FLAG_READ );object_property_add (obj,ACPI_PM_PROP_GPE0_BLK ,"uint32" , ich9_pm_get_gpe0_blk, -NULL ,NULL , pm,NULL ); +NULL ,NULL , pm);object_property_add_uint32_ptr (obj,ACPI_PM_PROP_GPE0_BLK_LEN , - &gpe0_len,OBJ_PROP_FLAG_READ , errp); + &gpe0_len,OBJ_PROP_FLAG_READ );object_property_add_bool (obj,"memory-hotplug-support" , ich9_pm_get_memory_hotplug_support, - ich9_pm_set_memory_hotplug_support, -NULL ); + ich9_pm_set_memory_hotplug_support);object_property_add_bool (obj,"cpu-hotplug-legacy" , ich9_pm_get_cpu_hotplug_legacy, - ich9_pm_set_cpu_hotplug_legacy, -NULL ); + ich9_pm_set_cpu_hotplug_legacy);object_property_add_uint8_ptr (obj,ACPI_PM_PROP_S3_DISABLED , - &pm->disable_s3,OBJ_PROP_FLAG_READWRITE , -NULL ); + &pm->disable_s3,OBJ_PROP_FLAG_READWRITE );object_property_add_uint8_ptr (obj,ACPI_PM_PROP_S4_DISABLED , - &pm->disable_s4,OBJ_PROP_FLAG_READWRITE , -NULL ); + &pm->disable_s4,OBJ_PROP_FLAG_READWRITE );object_property_add_uint8_ptr (obj,ACPI_PM_PROP_S4_VAL , - &pm->s4_val,OBJ_PROP_FLAG_READWRITE ,NULL ); + &pm->s4_val,OBJ_PROP_FLAG_READWRITE );object_property_add_bool (obj,ACPI_PM_PROP_TCO_ENABLED , ich9_pm_get_enable_tco, - ich9_pm_set_enable_tco, -NULL ); + ich9_pm_set_enable_tco); } void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
hw/acpi/pcihp.c +3 -4
@@ -80,8 +80,7 @@ static void *acpi_set_bsel(PCIBus *bus, void *opaque) *bus_bsel = (*bsel_alloc)++;object_property_add_uint32_ptr (OBJECT (bus),ACPI_PCIHP_PROP_BSEL , - bus_bsel,OBJ_PROP_FLAG_READ , - &error_abort); + bus_bsel,OBJ_PROP_FLAG_READ ); }return bsel_alloc;
@@ -374,9 +373,9 @@ void acpi_pcihp_init(Object *owner, AcpiPciHpState *s, PCIBus *root_bus,memory_region_add_subregion (address_space_io, s->io_base, &s->io);object_property_add_uint16_ptr (owner,ACPI_PCIHP_IO_BASE_PROP , &s->io_base, -OBJ_PROP_FLAG_READ , &error_abort); +OBJ_PROP_FLAG_READ );object_property_add_uint16_ptr (owner,ACPI_PCIHP_IO_LEN_PROP , &s->io_len, -OBJ_PROP_FLAG_READ , &error_abort); +OBJ_PROP_FLAG_READ ); }const VMStateDescription vmstate_acpi_pcihp_pci_status = {
hw/acpi/piix4.c +7 -8
@@ -444,17 +444,17 @@ static void piix4_pm_add_propeties(PIIX4PMState *s)static const uint16_t sci_int =9 ;object_property_add_uint8_ptr (OBJECT (s),ACPI_PM_PROP_ACPI_ENABLE_CMD , - &acpi_enable_cmd,OBJ_PROP_FLAG_READ ,NULL ); + &acpi_enable_cmd,OBJ_PROP_FLAG_READ );object_property_add_uint8_ptr (OBJECT (s),ACPI_PM_PROP_ACPI_DISABLE_CMD , - &acpi_disable_cmd,OBJ_PROP_FLAG_READ ,NULL ); + &acpi_disable_cmd,OBJ_PROP_FLAG_READ );object_property_add_uint32_ptr (OBJECT (s),ACPI_PM_PROP_GPE0_BLK , - &gpe0_blk,OBJ_PROP_FLAG_READ ,NULL ); + &gpe0_blk,OBJ_PROP_FLAG_READ );object_property_add_uint32_ptr (OBJECT (s),ACPI_PM_PROP_GPE0_BLK_LEN , - &gpe0_blk_len,OBJ_PROP_FLAG_READ ,NULL ); + &gpe0_blk_len,OBJ_PROP_FLAG_READ );object_property_add_uint16_ptr (OBJECT (s),ACPI_PM_PROP_SCI_INT , - &sci_int,OBJ_PROP_FLAG_READ ,NULL ); + &sci_int,OBJ_PROP_FLAG_READ );object_property_add_uint32_ptr (OBJECT (s),ACPI_PM_PROP_PM_IO_BASE , - &s->io_base,OBJ_PROP_FLAG_READ ,NULL ); + &s->io_base,OBJ_PROP_FLAG_READ ); }static void piix4_pm_realize (PCIDevice *dev,Error **errp)
@@ -598,8 +598,7 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent, s->cpu_hotplug_legacy = true;object_property_add_bool (OBJECT (s),"cpu-hotplug-legacy" , piix4_get_cpu_hotplug_legacy, - piix4_set_cpu_hotplug_legacy, -NULL ); + piix4_set_cpu_hotplug_legacy);legacy_acpi_cpu_hotplug_init (parent,OBJECT (s), &s->gpe_cpu,PIIX4_CPU_HOTPLUG_IO_BASE );
hw/arm/allwinner-a10.c +1 -1
@@ -178,7 +178,7 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->mmc0),0 ,AW_A10_MMC0_BASE );sysbus_connect_irq (SYS_BUS_DEVICE (&s->mmc0),0 ,qdev_get_gpio_in (dev,32 ));object_property_add_alias (OBJECT (s),"sd-bus" ,OBJECT (&s->mmc0), -"sd-bus" , &error_abort); +"sd-bus" );/* RTC */ qdev_init_nofail (DEVICE (&s->rtc));
hw/arm/allwinner-h3.c +6 -6
@@ -205,9 +205,9 @@ static void allwinner_h3_init(Object *obj)sysbus_init_child_obj (obj,"timer" , &s->timer,sizeof (s->timer),TYPE_AW_A10_PIT );object_property_add_alias (obj,"clk0-freq" ,OBJECT (&s->timer), -"clk0-freq" , &error_abort); +"clk0-freq" );object_property_add_alias (obj,"clk1-freq" ,OBJECT (&s->timer), -"clk1-freq" , &error_abort); +"clk1-freq" );sysbus_init_child_obj (obj,"ccu" , &s->ccu,sizeof (s->ccu),TYPE_AW_H3_CCU );
@@ -221,7 +221,7 @@ static void allwinner_h3_init(Object *obj)sysbus_init_child_obj (obj,"sid" , &s->sid,sizeof (s->sid),TYPE_AW_SID );object_property_add_alias (obj,"identifier" ,OBJECT (&s->sid), -"identifier" , &error_abort); +"identifier" );sysbus_init_child_obj (obj,"mmc0" , &s->mmc0,sizeof (s->mmc0),TYPE_AW_SDHOST_SUN5I );
@@ -232,9 +232,9 @@ static void allwinner_h3_init(Object *obj)sysbus_init_child_obj (obj,"dramc" , &s->dramc,sizeof (s->dramc),TYPE_AW_H3_DRAMC );object_property_add_alias (obj,"ram-addr" ,OBJECT (&s->dramc), -"ram-addr" , &error_abort); +"ram-addr" );object_property_add_alias (obj,"ram-size" ,OBJECT (&s->dramc), -"ram-size" , &error_abort); +"ram-size" );sysbus_init_child_obj (obj,"rtc" , &s->rtc,sizeof (s->rtc),TYPE_AW_RTC_SUN6I );
@@ -366,7 +366,7 @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp) qdev_get_gpio_in(DEVICE(&s->gic), AW_H3_GIC_SPI_MMC0));object_property_add_alias (OBJECT (s),"sd-bus" ,OBJECT (&s->mmc0), -"sd-bus" , &error_abort); +"sd-bus" );/* EMAC */ if (nd_table[0 ].used) {
hw/arm/armv7m.c +1 -1
@@ -138,7 +138,7 @@ static void armv7m_instance_init(Object *obj)sysbus_init_child_obj (obj,"nvnic" , &s->nvic,sizeof (s->nvic),TYPE_NVIC );object_property_add_alias (obj,"num-irq" , -OBJECT (&s->nvic),"num-irq" , &error_abort); +OBJECT (&s->nvic),"num-irq" );for (i =0 ; i <ARRAY_SIZE (s->bitband); i++) { sysbus_init_child_obj(obj, "bitband[*]", &s->bitband[i],
hw/arm/aspeed.c +1 -1
@@ -420,7 +420,7 @@ static void aspeed_machine_class_props_init(ObjectClass *oc) {object_class_property_add_bool (oc,"execute-in-place" , aspeed_get_mmio_exec, - aspeed_set_mmio_exec, &error_abort); + aspeed_set_mmio_exec);object_class_property_set_description (oc,"execute-in-place" ,"boot directly from CE0 flash device" ); }
hw/arm/aspeed_ast2600.c +6 -7
@@ -138,11 +138,11 @@ static void aspeed_soc_ast2600_init(Object *obj)qdev_prop_set_uint32 (DEVICE (&s->scu),"silicon-rev" , sc->silicon_rev);object_property_add_alias (obj,"hw-strap1" ,OBJECT (&s->scu), -"hw-strap1" , &error_abort); +"hw-strap1" );object_property_add_alias (obj,"hw-strap2" ,OBJECT (&s->scu), -"hw-strap2" , &error_abort); +"hw-strap2" );object_property_add_alias (obj,"hw-prot-key" ,OBJECT (&s->scu), -"hw-prot-key" , &error_abort); +"hw-prot-key" );sysbus_init_child_obj (obj,"a7mpcore" , &s->a7mpcore,sizeof (s->a7mpcore),TYPE_A15MPCORE_PRIV );
@@ -161,8 +161,7 @@ static void aspeed_soc_ast2600_init(Object *obj)snprintf (typename,sizeof (typename),"aspeed.fmc-%s" , socname);sysbus_init_child_obj (obj,"fmc" ,OBJECT (&s->fmc),sizeof (s->fmc), typename); -object_property_add_alias (obj,"num-cs" ,OBJECT (&s->fmc),"num-cs" , - &error_abort); +object_property_add_alias (obj,"num-cs" ,OBJECT (&s->fmc),"num-cs" );for (i =0 ; i < sc->spis_num; i++) {snprintf (typename,sizeof (typename),"aspeed.spi%d-%s" , i +1 , socname);
@@ -179,9 +178,9 @@ static void aspeed_soc_ast2600_init(Object *obj)sysbus_init_child_obj (obj,"sdmc" ,OBJECT (&s->sdmc),sizeof (s->sdmc), typename);object_property_add_alias (obj,"ram-size" ,OBJECT (&s->sdmc), -"ram-size" , &error_abort); +"ram-size" );object_property_add_alias (obj,"max-ram-size" ,OBJECT (&s->sdmc), -"max-ram-size" , &error_abort); +"max-ram-size" );for (i =0 ; i < sc->wdts_num; i++) {snprintf (typename,sizeof (typename),"aspeed.wdt-%s" , socname);
hw/arm/aspeed_soc.c +6 -7
@@ -153,11 +153,11 @@ static void aspeed_soc_init(Object *obj)qdev_prop_set_uint32 (DEVICE (&s->scu),"silicon-rev" , sc->silicon_rev);object_property_add_alias (obj,"hw-strap1" ,OBJECT (&s->scu), -"hw-strap1" , &error_abort); +"hw-strap1" );object_property_add_alias (obj,"hw-strap2" ,OBJECT (&s->scu), -"hw-strap2" , &error_abort); +"hw-strap2" );object_property_add_alias (obj,"hw-prot-key" ,OBJECT (&s->scu), -"hw-prot-key" , &error_abort); +"hw-prot-key" );sysbus_init_child_obj (obj,"vic" ,OBJECT (&s->vic),sizeof (s->vic),TYPE_ASPEED_VIC );
@@ -176,8 +176,7 @@ static void aspeed_soc_init(Object *obj)snprintf (typename,sizeof (typename),"aspeed.fmc-%s" , socname);sysbus_init_child_obj (obj,"fmc" ,OBJECT (&s->fmc),sizeof (s->fmc), typename); -object_property_add_alias (obj,"num-cs" ,OBJECT (&s->fmc),"num-cs" , - &error_abort); +object_property_add_alias (obj,"num-cs" ,OBJECT (&s->fmc),"num-cs" );for (i =0 ; i < sc->spis_num; i++) {snprintf (typename,sizeof (typename),"aspeed.spi%d-%s" , i +1 , socname);
@@ -194,9 +193,9 @@ static void aspeed_soc_init(Object *obj)sysbus_init_child_obj (obj,"sdmc" ,OBJECT (&s->sdmc),sizeof (s->sdmc), typename);object_property_add_alias (obj,"ram-size" ,OBJECT (&s->sdmc), -"ram-size" , &error_abort); +"ram-size" );object_property_add_alias (obj,"max-ram-size" ,OBJECT (&s->sdmc), -"max-ram-size" , &error_abort); +"max-ram-size" );for (i =0 ; i < sc->wdts_num; i++) {snprintf (typename,sizeof (typename),"aspeed.wdt-%s" , socname);
hw/arm/bcm2835_peripherals.c +10 -16
@@ -74,26 +74,25 @@ static void bcm2835_peripherals_init(Object *obj) TYPE_BCM2835_MBOX);object_property_add_const_link (OBJECT (&s->mboxes),"mbox-mr" , -OBJECT (&s->mbox_mr), &error_abort); +OBJECT (&s->mbox_mr));/* Framebuffer */ sysbus_init_child_obj (obj,"fb" , &s->fb,sizeof (s->fb),TYPE_BCM2835_FB ); -object_property_add_alias (obj,"vcram-size" ,OBJECT (&s->fb),"vcram-size" , - &error_abort); +object_property_add_alias (obj,"vcram-size" ,OBJECT (&s->fb),"vcram-size" );object_property_add_const_link (OBJECT (&s->fb),"dma-mr" , -OBJECT (&s->gpu_bus_mr), &error_abort); +OBJECT (&s->gpu_bus_mr));/* Property channel */ sysbus_init_child_obj (obj,"property" , &s->property,sizeof (s->property),TYPE_BCM2835_PROPERTY );object_property_add_alias (obj,"board-rev" ,OBJECT (&s->property), -"board-rev" , &error_abort); +"board-rev" );object_property_add_const_link (OBJECT (&s->property),"fb" , -OBJECT (&s->fb), &error_abort); +OBJECT (&s->fb));object_property_add_const_link (OBJECT (&s->property),"dma-mr" , -OBJECT (&s->gpu_bus_mr), &error_abort); +OBJECT (&s->gpu_bus_mr));/* Random Number Generator */ sysbus_init_child_obj(obj, "rng", &s->rng, sizeof(s->rng),
@@ -112,7 +111,7 @@ static void bcm2835_peripherals_init(Object *obj) TYPE_BCM2835_DMA);object_property_add_const_link (OBJECT (&s->dma),"dma-mr" , -OBJECT (&s->gpu_bus_mr), &error_abort); +OBJECT (&s->gpu_bus_mr));/* Thermal */ sysbus_init_child_obj(obj, "thermal", &s->thermal, sizeof(s->thermal),
@@ -123,9 +122,9 @@ static void bcm2835_peripherals_init(Object *obj) TYPE_BCM2835_GPIO);object_property_add_const_link (OBJECT (&s->gpio),"sdbus-sdhci" , -OBJECT (&s->sdhci.sdbus), &error_abort); +OBJECT (&s->sdhci.sdbus));object_property_add_const_link (OBJECT (&s->gpio),"sdbus-sdhost" , -OBJECT (&s->sdhost.sdbus), &error_abort); +OBJECT (&s->sdhost.sdbus)); }static void bcm2835_peripherals_realize (DeviceState *dev,Error **errp)
@@ -359,12 +358,7 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (&s->peri_mr,GPIO_OFFSET ,sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->gpio),0 )); -object_property_add_alias (OBJECT (s),"sd-bus" ,OBJECT (&s->gpio),"sd-bus" , - &err); -if (err) { -error_propagate (errp, err); -return ; - } +object_property_add_alias (OBJECT (s),"sd-bus" ,OBJECT (&s->gpio),"sd-bus" );create_unimp (s, &s->armtmr,"bcm2835-sp804" ,ARMCTRL_TIMER0_1_OFFSET ,0x40 );create_unimp (s, &s->cprman,"bcm2835-cprman" ,CPRMAN_OFFSET ,0x1000 );
hw/arm/bcm2836.c +4 -12
@@ -63,9 +63,9 @@ static void bcm2836_init(Object *obj)sysbus_init_child_obj (obj,"peripherals" , &s->peripherals,sizeof (s->peripherals),TYPE_BCM2835_PERIPHERALS );object_property_add_alias (obj,"board-rev" ,OBJECT (&s->peripherals), -"board-rev" , &error_abort); +"board-rev" );object_property_add_alias (obj,"vcram-size" ,OBJECT (&s->peripherals), -"vcram-size" , &error_abort); +"vcram-size" ); }static void bcm2836_realize (DeviceState *dev,Error **errp)
@@ -86,11 +86,7 @@ static void bcm2836_realize(DeviceState *dev, Error **errp)return ; } -object_property_add_const_link (OBJECT (&s->peripherals),"ram" , obj, &err); -if (err) { -error_propagate (errp, err); -return ; - } +object_property_add_const_link (OBJECT (&s->peripherals),"ram" , obj);object_property_set_bool (OBJECT (&s->peripherals), true,"realized" , &err);if (err) {
@@ -99,11 +95,7 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) }object_property_add_alias (OBJECT (s),"sd-bus" ,OBJECT (&s->peripherals), -"sd-bus" , &err); -if (err) { -error_propagate (errp, err); -return ; - } +"sd-bus" );sysbus_mmio_map_overlap (SYS_BUS_DEVICE (&s->peripherals),0 , info->peri_base,1 );
hw/arm/cubieboard.c +1 -2
@@ -59,8 +59,7 @@ static void cubieboard_init(MachineState *machine) } a10 =AW_A10 (object_new (TYPE_AW_A10 )); -object_property_add_child (OBJECT (machine),"soc" ,OBJECT (a10), - &error_abort); +object_property_add_child (OBJECT (machine),"soc" ,OBJECT (a10));object_unref (OBJECT (a10));object_property_set_int (OBJECT (&a10->emac),1 ,"phy-addr" , &err);
hw/arm/mcimx6ul-evk.c +1 -1
@@ -39,7 +39,7 @@ static void mcimx6ul_evk_init(MachineState *machine) }; s =FSL_IMX6UL (object_new (TYPE_FSL_IMX6UL )); -object_property_add_child (OBJECT (machine),"soc" ,OBJECT (s), &error_fatal); +object_property_add_child (OBJECT (machine),"soc" ,OBJECT (s));object_property_set_bool (OBJECT (s), true,"realized" , &error_fatal); memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_MMDC_ADDR,
hw/arm/mcimx7d-sabre.c +1 -1
@@ -41,7 +41,7 @@ static void mcimx7d_sabre_init(MachineState *machine) }; s =FSL_IMX7 (object_new (TYPE_FSL_IMX7 )); -object_property_add_child (OBJECT (machine),"soc" ,OBJECT (s), &error_fatal); +object_property_add_child (OBJECT (machine),"soc" ,OBJECT (s));object_property_set_bool (OBJECT (s), true,"realized" , &error_fatal); memory_region_add_subregion(get_system_memory(), FSL_IMX7_MMDC_ADDR,
hw/arm/msf2-soc.c +1 -2
@@ -187,8 +187,7 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)/* Alias controller SPI bus to the SoC itself */ bus_name =g_strdup_printf ("spi%d" , i);object_property_add_alias (OBJECT (s), bus_name, -OBJECT (&s->spi[i]),"spi" , - &error_abort); +OBJECT (&s->spi[i]),"spi" );g_free (bus_name); }
hw/arm/nrf51_soc.c +1 -2
@@ -192,8 +192,7 @@ static void nrf51_soc_init(Object *obj)sysbus_init_child_obj (obj,"uart" , &s->uart,sizeof (s->uart),TYPE_NRF51_UART ); -object_property_add_alias (obj,"serial0" ,OBJECT (&s->uart),"chardev" , - &error_abort); +object_property_add_alias (obj,"serial0" ,OBJECT (&s->uart),"chardev" );sysbus_init_child_obj (obj,"rng" , &s->rng,sizeof (s->rng),TYPE_NRF51_RNG );
hw/arm/orangepi.c +1 -2
@@ -59,8 +59,7 @@ static void orangepi_init(MachineState *machine) } h3 =AW_H3 (object_new (TYPE_AW_H3 )); -object_property_add_child (OBJECT (machine),"soc" ,OBJECT (h3), - &error_abort); +object_property_add_child (OBJECT (machine),"soc" ,OBJECT (h3));object_unref (OBJECT (h3));/* Setup timer properties */
hw/arm/raspi.c +1 -2
@@ -284,8 +284,7 @@ static void raspi_machine_init(MachineState *machine)/* Setup the SOC */ object_initialize_child (OBJECT (machine),"soc" , &s->soc,sizeof (s->soc),board_soc_type (board_rev), &error_abort,NULL ); -object_property_add_const_link (OBJECT (&s->soc),"ram" ,OBJECT (machine->ram), - &error_abort); +object_property_add_const_link (OBJECT (&s->soc),"ram" ,OBJECT (machine->ram));object_property_set_int (OBJECT (&s->soc), board_rev,"board-rev" , &error_abort);object_property_set_bool (OBJECT (&s->soc), true,"realized" , &error_abort);
hw/arm/sabrelite.c +1 -1
@@ -51,7 +51,7 @@ static void sabrelite_init(MachineState *machine) } s =FSL_IMX6 (object_new (TYPE_FSL_IMX6 )); -object_property_add_child (OBJECT (machine),"soc" ,OBJECT (s), &error_fatal); +object_property_add_child (OBJECT (machine),"soc" ,OBJECT (s));object_property_set_bool (OBJECT (s), true,"realized" , &err);if (err !=NULL ) {error_report ("%s" ,error_get_pretty (err));
hw/arm/sbsa-ref.c +2 -3
@@ -222,10 +222,9 @@ static PFlashCFI01 *sbsa_flash_create1(SBSAMachineState *sms,qdev_prop_set_uint16 (dev,"id2" ,0x00 );qdev_prop_set_uint16 (dev,"id3" ,0x00 );qdev_prop_set_string (dev,"name" , name); -object_property_add_child (OBJECT (sms), name,OBJECT (dev), - &error_abort); +object_property_add_child (OBJECT (sms), name,OBJECT (dev));object_property_add_alias (OBJECT (sms), alias_prop_name, -OBJECT (dev),"drive" , &error_abort); +OBJECT (dev),"drive" );return PFLASH_CFI01 (dev); }
hw/arm/vexpress.c +2 -2
@@ -749,7 +749,7 @@ static void vexpress_instance_init(Object *obj)/* EL3 is enabled by default on vexpress */ vms->secure = true;object_property_add_bool (obj,"secure" , vexpress_get_secure, - vexpress_set_secure,NULL ); + vexpress_set_secure);object_property_set_description (obj,"secure" ,"Set on/off to enable/disable the ARM " "Security Extensions (TrustZone)" );
@@ -765,7 +765,7 @@ static void vexpress_a15_instance_init(Object *obj)*/ vms->virt = true;object_property_add_bool (obj,"virtualization" , vexpress_get_virt, - vexpress_set_virt,NULL ); + vexpress_set_virt);object_property_set_description (obj,"virtualization" ,"Set on/off to enable/disable the ARM " "Virtualization Extensions "
hw/arm/virt.c +9 -10
@@ -936,10 +936,9 @@ static PFlashCFI01 *virt_flash_create1(VirtMachineState *vms,qdev_prop_set_uint16 (dev,"id2" ,0x00 );qdev_prop_set_uint16 (dev,"id3" ,0x00 );qdev_prop_set_string (dev,"name" , name); -object_property_add_child (OBJECT (vms), name,OBJECT (dev), - &error_abort); +object_property_add_child (OBJECT (vms), name,OBJECT (dev));object_property_add_alias (OBJECT (vms), alias_prop_name, -OBJECT (dev),"drive" , &error_abort); +OBJECT (dev),"drive" );return PFLASH_CFI01 (dev); }
@@ -2213,7 +2212,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)object_class_property_add (oc,"acpi" ,"OnOffAuto" , virt_get_acpi, virt_set_acpi, -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_set_description (oc,"acpi" ,"Enable ACPI" ); }
@@ -2229,7 +2228,7 @@ static void virt_instance_init(Object *obj)*/ vms->secure = false;object_property_add_bool (obj,"secure" , virt_get_secure, - virt_set_secure,NULL ); + virt_set_secure);object_property_set_description (obj,"secure" ,"Set on/off to enable/disable the ARM " "Security Extensions (TrustZone)" );
@@ -2237,7 +2236,7 @@ static void virt_instance_init(Object *obj)/* EL2 is also disabled by default, for similar reasons */ vms->virt = false;object_property_add_bool (obj,"virtualization" , virt_get_virt, - virt_set_virt,NULL ); + virt_set_virt);object_property_set_description (obj,"virtualization" ,"Set on/off to enable/disable emulating a " "guest CPU which implements the ARM "
@@ -2246,13 +2245,13 @@ static void virt_instance_init(Object *obj)/* High memory is enabled by default */ vms->highmem = true;object_property_add_bool (obj,"highmem" , virt_get_highmem, - virt_set_highmem,NULL ); + virt_set_highmem);object_property_set_description (obj,"highmem" ,"Set on/off to enable/disable using " "physical address space above 32 bits" ); vms->gic_version =VIRT_GIC_VERSION_NOSEL ;object_property_add_str (obj,"gic-version" , virt_get_gic_version, - virt_set_gic_version,NULL ); + virt_set_gic_version);object_property_set_description (obj,"gic-version" ,"Set GIC version. " "Valid values are 2, 3, host and max" );
@@ -2265,7 +2264,7 @@ static void virt_instance_init(Object *obj)/* Default allows ITS instantiation */ vms->its = true;object_property_add_bool (obj,"its" , virt_get_its, - virt_set_its,NULL ); + virt_set_its);object_property_set_description (obj,"its" ,"Set on/off to enable/disable " "ITS instantiation" );
@@ -2273,7 +2272,7 @@ static void virt_instance_init(Object *obj)/* Default disallows iommu instantiation */ vms->iommu =VIRT_IOMMU_NONE ; -object_property_add_str (obj,"iommu" , virt_get_iommu, virt_set_iommu,NULL ); +object_property_add_str (obj,"iommu" , virt_get_iommu, virt_set_iommu);object_property_set_description (obj,"iommu" ,"Set the IOMMU type. " "Valid values are none and smmuv3" );
hw/arm/xlnx-versal-virt.c +1 -2
@@ -385,8 +385,7 @@ static void create_virtio_regions(VersalVirt *s) pic_irq =qdev_get_gpio_in (DEVICE (&s->soc.fpd.apu.gic), irq); dev =qdev_create (NULL ,"virtio-mmio" ); -object_property_add_child (OBJECT (&s->soc), name,OBJECT (dev), - &error_fatal); +object_property_add_child (OBJECT (&s->soc), name,OBJECT (dev));qdev_init_nofail (dev);sysbus_connect_irq (SYS_BUS_DEVICE (dev),0 , pic_irq); mr =sysbus_mmio_get_region (SYS_BUS_DEVICE (dev),0 );
hw/arm/xlnx-versal.c +5 -5
@@ -44,7 +44,7 @@ static void versal_create_apu_cpus(Versal *s) } name =g_strdup_printf ("apu-cpu[%d]" , i); -object_property_add_child (OBJECT (s), name, obj, &error_fatal); +object_property_add_child (OBJECT (s), name, obj);g_free (name); object_property_set_int(obj, s->cfg.psci_conduit,
@@ -148,7 +148,7 @@ static void versal_create_uarts(Versal *s, qemu_irq *pic) dev =qdev_create (NULL ,TYPE_PL011 ); s->lpd.iou.uart[i] =SYS_BUS_DEVICE (dev);qdev_prop_set_chr (dev,"chardev" ,serial_hd (i)); -object_property_add_child (OBJECT (s), name,OBJECT (dev), &error_fatal); +object_property_add_child (OBJECT (s), name,OBJECT (dev));qdev_init_nofail (dev); mr =sysbus_mmio_get_region (s->lpd.iou.uart[i],0 );
@@ -173,7 +173,7 @@ static void versal_create_gems(Versal *s, qemu_irq *pic) dev =qdev_create (NULL ,"cadence_gem" ); s->lpd.iou.gem[i] =SYS_BUS_DEVICE (dev); -object_property_add_child (OBJECT (s), name,OBJECT (dev), &error_fatal); +object_property_add_child (OBJECT (s), name,OBJECT (dev));if (nd->used) {qemu_check_nic_model (nd,"cadence_gem" );qdev_set_nic_properties (dev, nd);
@@ -205,7 +205,7 @@ static void versal_create_admas(Versal *s, qemu_irq *pic) dev =qdev_create (NULL ,"xlnx.zdma" ); s->lpd.iou.adma[i] =SYS_BUS_DEVICE (dev); -object_property_add_child (OBJECT (s), name,OBJECT (dev), &error_fatal); +object_property_add_child (OBJECT (s), name,OBJECT (dev));qdev_init_nofail (dev); mr =sysbus_mmio_get_region (s->lpd.iou.adma[i],0 );
@@ -266,7 +266,7 @@ static void versal_unimp_area(Versal *s, const char *name,qdev_prop_set_string (dev,"name" , name);qdev_prop_set_uint64 (dev,"size" , size); -object_property_add_child (OBJECT (s), name,OBJECT (dev), &error_fatal); +object_property_add_child (OBJECT (s), name,OBJECT (dev));qdev_init_nofail (dev); mr_dev =sysbus_mmio_get_region (SYS_BUS_DEVICE (dev),0 );
hw/arm/xlnx-zcu102.c +2 -2
@@ -178,7 +178,7 @@ static void xlnx_zcu102_machine_instance_init(Object *obj)/* Default to secure mode being disabled */ s->secure = false;object_property_add_bool (obj,"secure" , zcu102_get_secure, - zcu102_set_secure,NULL ); + zcu102_set_secure);object_property_set_description (obj,"secure" ,"Set on/off to enable/disable the ARM " "Security Extensions (TrustZone)" );
@@ -186,7 +186,7 @@ static void xlnx_zcu102_machine_instance_init(Object *obj)/* Default to virt (EL2) being disabled */ s->virt = false;object_property_add_bool (obj,"virtualization" , zcu102_get_virt, - zcu102_set_virt,NULL ); + zcu102_set_virt);object_property_set_description (obj,"virtualization" ,"Set on/off to enable/disable emulating a " "guest CPU which implements the ARM "
hw/arm/xlnx-zynqmp.c +3 -6
@@ -554,8 +554,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)/* Alias controller SD bus to the SoC itself */ bus_name =g_strdup_printf ("sd-bus%d" , i); -object_property_add_alias (OBJECT (s), bus_name, sdhci,"sd-bus" , - &error_abort); +object_property_add_alias (OBJECT (s), bus_name, sdhci,"sd-bus" );g_free (bus_name); }
@@ -575,8 +574,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)/* Alias controller SPI bus to the SoC itself */ bus_name =g_strdup_printf ("spi%d" , i);object_property_add_alias (OBJECT (s), bus_name, -OBJECT (&s->spi[i]),"spi0" , - &error_abort); +OBJECT (&s->spi[i]),"spi0" );g_free (bus_name); }
@@ -597,8 +595,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) bus_name =g_strdup_printf ("qspi%d" , i); target_bus =g_strdup_printf ("spi%d" , i);object_property_add_alias (OBJECT (s), bus_name, -OBJECT (&s->qspi), target_bus, - &error_abort); +OBJECT (&s->qspi), target_bus);g_free (bus_name);g_free (target_bus); }
hw/audio/marvell_88w8618.c +1 -1
@@ -259,7 +259,7 @@ static void mv88w8618_audio_init(Object *obj)object_property_add_link (OBJECT (dev),"wm8750" ,TYPE_WM8750 , (Object **) &s->wm, qdev_prop_allow_set_link_before_realize, -0 , &error_abort); +0 ); }static void mv88w8618_audio_realize (DeviceState *dev,Error **errp)
hw/audio/pcspk.c +1 -1
@@ -175,7 +175,7 @@ static void pcspk_initfn(Object *obj)object_property_add_link (obj,"pit" ,TYPE_PIT_COMMON , (Object **)&s->pit, qdev_prop_allow_set_link_before_realize, -0 , &error_abort); +0 ); }static void pcspk_realizefn (DeviceState *dev,Error **errp)
hw/core/bus.c +3 -4
@@ -122,7 +122,7 @@ static void qbus_realize(BusState *bus, DeviceState *parent, const char *name)if (bus->parent) {QLIST_INSERT_HEAD (&bus->parent->child_bus, bus, sibling); bus->parent->num_child_bus++; -object_property_add_child (OBJECT (bus->parent), bus->name,OBJECT (bus),NULL ); +object_property_add_child (OBJECT (bus->parent), bus->name,OBJECT (bus));object_unref (OBJECT (bus)); }else {/* The only bus without a parent is the main system bus */
@@ -215,10 +215,9 @@ static void qbus_initfn(Object *obj)TYPE_HOTPLUG_HANDLER , (Object **)&bus->hotplug_handler, object_property_allow_set_link, -0 , - NULL); + 0);object_property_add_bool (obj,"realized" , - bus_get_realized, bus_set_realized,NULL ); + bus_get_realized, bus_set_realized); }static char *default_bus_get_fw_dev_path (DeviceState *dev)
hw/core/machine.c +19 -27
133 lines not on this page · raw message
hw/core/qdev-properties.c +2 -7
@@ -1043,11 +1043,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, arrayprop->prop.info->get, arrayprop->prop.info->set, array_element_release, - arrayprop, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } + arrayprop); } }
@@ -1259,8 +1255,7 @@ static void create_link_property(ObjectClass *oc, Property *prop, Error **errp)object_class_property_add_link (oc, prop->name, prop->link_type, prop->offset, qdev_prop_allow_set_link_before_realize, -OBJ_PROP_LINK_STRONG , - errp); +OBJ_PROP_LINK_STRONG ); }const PropertyInfo qdev_prop_link = {
hw/core/qdev.c +15 -25
@@ -90,8 +90,7 @@ static void bus_add_child(BusState *bus, DeviceState *child)object_get_typename (OBJECT (child)), (Object **)&kid->child,NULL ,/* read-only property */ -0 ,/* return ownership on prop deletion */ - NULL); + 0); }void qdev_set_parent_bus (DeviceState *dev,BusState *bus)
@@ -480,7 +479,7 @@ void qdev_init_gpio_in_named_with_opaque(DeviceState *dev,gchar *propname =g_strdup_printf ("%s[%u]" , name, i);object_property_add_child (OBJECT (dev), propname, -OBJECT (gpio_list->in[i]), &error_abort); +OBJECT (gpio_list->in[i]));g_free (propname); }
@@ -511,8 +510,7 @@ void qdev_init_gpio_out_named(DeviceState *dev, qemu_irq *pins,object_property_add_link (OBJECT (dev), propname,TYPE_IRQ , (Object **)&pins[i], object_property_allow_set_link, -OBJ_PROP_LINK_STRONG , - &error_abort); +OBJ_PROP_LINK_STRONG );g_free (propname); } gpio_list->num_out += n;
@@ -545,8 +543,7 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,/* We need a name for object_property_set_link to work */ object_property_add_child (container_get (qdev_get_machine (),"/unattached" ), -"non-qdev-gpio[*]" ,OBJECT (pin), - &error_abort); +"non-qdev-gpio[*]" ,OBJECT (pin)); }object_property_set_link (OBJECT (dev),OBJECT (pin), propname, &error_abort);g_free (propname);
@@ -604,8 +601,7 @@ void qdev_pass_gpios(DeviceState *dev, DeviceState *container,char *propname =g_strdup_printf ("%s[%d]" , nm, i);object_property_add_alias (OBJECT (container), propname, -OBJECT (dev), propname, - &error_abort); +OBJECT (dev), propname);g_free (propname); }for (i =0 ; i < ngl->num_out; i++) {
@@ -613,8 +609,7 @@ void qdev_pass_gpios(DeviceState *dev, DeviceState *container,char *propname =g_strdup_printf ("%s[%d]" , nm, i);object_property_add_alias (OBJECT (container), propname, -OBJECT (dev), propname, - &error_abort); +OBJECT (dev), propname);g_free (propname); }QLIST_REMOVE (ngl, node);
@@ -755,7 +750,7 @@ static void qdev_class_add_legacy_property(DeviceClass *dc, Property *prop) name =g_strdup_printf ("legacy-%s" , prop->name);object_class_property_add (OBJECT_CLASS (dc), name,"str" , prop->info->print ? qdev_get_legacy_property : prop->info->get, -NULL ,NULL , prop, &error_abort); +NULL ,NULL , prop); }void qdev_property_add_static (DeviceState *dev,Property *prop)
@@ -768,7 +763,7 @@ void qdev_property_add_static(DeviceState *dev, Property *prop) op =object_property_add (obj, prop->name, prop->info->name, prop->info->get, prop->info->set, prop->info->release, - prop, &error_abort); + prop);object_property_set_description (obj, prop->name, prop->info->description);
@@ -794,7 +789,7 @@ static void qdev_class_add_property(DeviceClass *klass, Property *prop) prop->name, prop->info->name, prop->info->get, prop->info->set, prop->info->release, - prop, &error_abort); + prop);if (prop->set_default) { prop->info->set_default_value (op, prop); }
@@ -817,8 +812,7 @@ void qdev_alias_all_properties(DeviceState *target, Object *source)for (prop = dc->props_; prop && prop->name; prop++) {object_property_add_alias (source, prop->name, -OBJECT (target), prop->name, - &error_abort); +OBJECT (target), prop->name); } class =object_class_get_parent (class); }while (class !=object_class_by_name (TYPE_DEVICE ));
@@ -869,7 +863,7 @@ static void device_set_realized(Object *obj, bool value, Error **errp)object_property_add_child (container_get (qdev_get_machine (),"/unattached" ), - name, obj, &error_abort); + name, obj); unattached_parent = true;g_free (name); }
@@ -1186,17 +1180,13 @@ static void device_class_init(ObjectClass *class, void *data) rc->get_transitional_function = device_get_transitional_reset;object_class_property_add_bool (class,"realized" , - device_get_realized, device_set_realized, - &error_abort); + device_get_realized, device_set_realized);object_class_property_add_bool (class,"hotpluggable" , - device_get_hotpluggable,NULL , - &error_abort); + device_get_hotpluggable,NULL );object_class_property_add_bool (class,"hotplugged" , - device_get_hotplugged,NULL , - &error_abort); + device_get_hotplugged,NULL );object_class_property_add_link (class,"parent_bus" ,TYPE_BUS , - offsetof(DeviceState , parent_bus),NULL ,0 , - &error_abort); + offsetof(DeviceState , parent_bus),NULL ,0 ); }void device_class_set_props (DeviceClass *dc,Property *props)
hw/cpu/core.c +2 -2
@@ -76,9 +76,9 @@ static void cpu_core_instance_init(Object *obj)CPUCore *core =CPU_CORE (obj);object_property_add (obj,"core-id" ,"int" , core_prop_get_core_id, - core_prop_set_core_id,NULL ,NULL ,NULL ); + core_prop_set_core_id,NULL ,NULL );object_property_add (obj,"nr-threads" ,"int" , core_prop_get_nr_threads, - core_prop_set_nr_threads,NULL ,NULL ,NULL ); + core_prop_set_nr_threads,NULL ,NULL ); core->nr_threads = ms->smp.threads; }
hw/display/bochs-display.c +1 -2
@@ -331,8 +331,7 @@ static void bochs_display_init(Object *obj)/* Expose framebuffer byteorder via QOM */ object_property_add_bool (obj,"big-endian-framebuffer" , bochs_display_get_big_endian_fb, - bochs_display_set_big_endian_fb, -NULL ); + bochs_display_set_big_endian_fb); dev->cap_present |=QEMU_PCI_CAP_EXPRESS ; }
hw/display/sm501.c +1 -1
@@ -2011,7 +2011,7 @@ static void sm501_sysbus_init(Object *o)qdev_prop_set_uint8 (DEVICE (smm),"endianness" ,DEVICE_LITTLE_ENDIAN );object_property_add_alias (o,"chardev" , -OBJECT (smm),"chardev" , &error_abort); +OBJECT (smm),"chardev" ); }static const TypeInfo sm501_sysbus_info = {
hw/display/vga-pci.c +2 -2
@@ -270,7 +270,7 @@ static void pci_std_vga_init(Object *obj) {/* Expose framebuffer byteorder via QOM */ object_property_add_bool (obj,"big-endian-framebuffer" , - vga_get_big_endian_fb, vga_set_big_endian_fb,NULL ); + vga_get_big_endian_fb, vga_set_big_endian_fb); }static void pci_secondary_vga_realize (PCIDevice *dev,Error **errp)
@@ -321,7 +321,7 @@ static void pci_secondary_vga_init(Object *obj) {/* Expose framebuffer byteorder via QOM */ object_property_add_bool (obj,"big-endian-framebuffer" , - vga_get_big_endian_fb, vga_set_big_endian_fb,NULL ); + vga_get_big_endian_fb, vga_set_big_endian_fb); }static void pci_secondary_vga_reset (DeviceState *dev)
hw/display/vhost-user-gpu-pci.c +1 -2
@@ -32,8 +32,7 @@ static void vhost_user_gpu_pci_initfn(Object *obj)VIRTIO_GPU_PCI_BASE (obj)->vgpu =VIRTIO_GPU_BASE (&dev->vdev);object_property_add_alias (obj,"chardev" , -OBJECT (&dev->vdev),"chardev" , - &error_abort); +OBJECT (&dev->vdev),"chardev" ); }static const VirtioPCIDeviceTypeInfo vhost_user_gpu_pci_info = {
hw/display/vhost-user-gpu.c +1 -1
@@ -512,7 +512,7 @@ vhost_user_gpu_instance_init(Object *obj) g->vhost =VHOST_USER_BACKEND (object_new (TYPE_VHOST_USER_BACKEND ));object_property_add_alias (obj,"chardev" , -OBJECT (g->vhost),"chardev" , &error_abort); +OBJECT (g->vhost),"chardev" ); } static void
hw/display/vhost-user-vga.c +1 -2
@@ -33,8 +33,7 @@ static void vhost_user_vga_inst_initfn(Object *obj)VIRTIO_VGA_BASE (dev)->vgpu =VIRTIO_GPU_BASE (&dev->vdev);object_property_add_alias (obj,"chardev" , -OBJECT (&dev->vdev),"chardev" , - &error_abort); +OBJECT (&dev->vdev),"chardev" ); }static const VirtioPCIDeviceTypeInfo vhost_user_vga_info = {
hw/display/xlnx_dp.c +3 -4
@@ -1237,8 +1237,7 @@ static void xlnx_dp_init(Object *obj)object_property_add_link (obj,"dpdma" ,TYPE_XLNX_DPDMA , (Object **) &s->dpdma, xlnx_dp_set_dpdma, -OBJ_PROP_LINK_STRONG , - &error_abort); +OBJ_PROP_LINK_STRONG );/* * Initialize AUX Bus.
@@ -1249,11 +1248,11 @@ static void xlnx_dp_init(Object *obj)* Initialize DPCD and EDID.. */ s->dpcd =DPCD (aux_create_slave (s->aux_bus,"dpcd" )); -object_property_add_child (OBJECT (s),"dpcd" ,OBJECT (s->dpcd),NULL ); +object_property_add_child (OBJECT (s),"dpcd" ,OBJECT (s->dpcd)); s->edid =I2CDDC (qdev_create (BUS (aux_get_i2c_bus (s->aux_bus)),"i2c-ddc" ));i2c_set_slave_address (I2C_SLAVE (s->edid),0x50 ); -object_property_add_child (OBJECT (s),"edid" ,OBJECT (s->edid),NULL ); +object_property_add_child (OBJECT (s),"edid" ,OBJECT (s->edid));fifo8_create (&s->rx_fifo,16 );fifo8_create (&s->tx_fifo,16 );
hw/dma/sparc32_dma.c +5 -5
@@ -264,7 +264,7 @@ static void sparc32_dma_device_init(Object *obj)object_property_add_link (OBJECT (dev),"iommu" ,TYPE_SUN4M_IOMMU , (Object **) &s->iommu, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 );qdev_init_gpio_in (dev, dma_set_irq,1 );qdev_init_gpio_out (dev, s->gpio,2 );
@@ -302,7 +302,7 @@ static void sparc32_espdma_device_realize(DeviceState *dev, Error **errp)ESPState *esp; d =qdev_create (NULL ,TYPE_ESP ); -object_property_add_child (OBJECT (dev),"esp" ,OBJECT (d), errp); +object_property_add_child (OBJECT (dev),"esp" ,OBJECT (d)); sysbus =ESP_STATE (d); esp = &sysbus->esp; esp->dma_memory_read = espdma_memory_read;
@@ -344,7 +344,7 @@ static void sparc32_ledma_device_realize(DeviceState *dev, Error **errp)qemu_check_nic_model (nd,TYPE_LANCE ); d =qdev_create (NULL ,TYPE_LANCE ); -object_property_add_child (OBJECT (dev),"lance" ,OBJECT (d), errp); +object_property_add_child (OBJECT (dev),"lance" ,OBJECT (d));qdev_set_nic_properties (d, nd);object_property_set_link (OBJECT (d),OBJECT (dev),"dma" , errp);qdev_init_nofail (d);
@@ -380,7 +380,7 @@ static void sparc32_dma_realize(DeviceState *dev, Error **errp) espdma =qdev_create (NULL ,TYPE_SPARC32_ESPDMA_DEVICE );object_property_set_link (OBJECT (espdma), iommu,"iommu" , errp); -object_property_add_child (OBJECT (s),"espdma" ,OBJECT (espdma), errp); +object_property_add_child (OBJECT (s),"espdma" ,OBJECT (espdma));qdev_init_nofail (espdma); esp =DEVICE (object_resolve_path_component (OBJECT (espdma),"esp" ));
@@ -395,7 +395,7 @@ static void sparc32_dma_realize(DeviceState *dev, Error **errp) ledma =qdev_create (NULL ,TYPE_SPARC32_LEDMA_DEVICE );object_property_set_link (OBJECT (ledma), iommu,"iommu" , errp); -object_property_add_child (OBJECT (s),"ledma" ,OBJECT (ledma), errp); +object_property_add_child (OBJECT (s),"ledma" ,OBJECT (ledma));qdev_init_nofail (ledma); lance =DEVICE (object_resolve_path_component (OBJECT (ledma),"lance" ));
hw/dma/xilinx_axidma.c +2 -7
@@ -529,16 +529,11 @@ static void xilinx_axidma_realize(DeviceState *dev, Error **errp)object_property_add_link (OBJECT (ds),"dma" ,TYPE_XILINX_AXI_DMA , (Object **)&ds->dma, object_property_allow_set_link, -OBJ_PROP_LINK_STRONG , - &local_err); +OBJ_PROP_LINK_STRONG );object_property_add_link (OBJECT (cs),"dma" ,TYPE_XILINX_AXI_DMA , (Object **)&cs->dma, object_property_allow_set_link, -OBJ_PROP_LINK_STRONG , - &local_err); -if (local_err) { - goto xilinx_axidma_realize_fail; - } +OBJ_PROP_LINK_STRONG );object_property_set_link (OBJECT (ds),OBJECT (s),"dma" , &local_err);object_property_set_link (OBJECT (cs),OBJECT (s),"dma" , &local_err);if (local_err) {
hw/dma/xlnx-zdma.c +1 -2
@@ -790,8 +790,7 @@ static void zdma_init(Object *obj)object_property_add_link (obj,"dma" ,TYPE_MEMORY_REGION , (Object **)&s->dma_mr, qdev_prop_allow_set_link_before_realize, -OBJ_PROP_LINK_STRONG , - &error_abort); +OBJ_PROP_LINK_STRONG ); }static const VMStateDescription vmstate_zdma = {
hw/gpio/aspeed_gpio.c +1 -1
@@ -873,7 +873,7 @@ static void aspeed_gpio_init(Object *obj) name =g_strdup_printf ("gpio%s%d" , props->group_label[group_idx], pin_idx %GPIOS_PER_GROUP );object_property_add (obj, name,"bool" , aspeed_gpio_get_pin, - aspeed_gpio_set_pin,NULL ,NULL ,NULL ); + aspeed_gpio_set_pin,NULL ,NULL );g_free (name); } }
hw/hyperv/hyperv.c +1 -1
@@ -130,7 +130,7 @@ void hyperv_synic_add(CPUState *cs) obj =object_new (TYPE_SYNIC ); synic =SYNIC (obj); synic->cs = cs; -object_property_add_child (OBJECT (cs),"synic" , obj, &error_abort); +object_property_add_child (OBJECT (cs),"synic" , obj);object_unref (obj);object_property_set_bool (obj, true,"realized" , &error_abort); }
hw/i386/microvm.c +6 -9
@@ -510,42 +510,39 @@ static void microvm_class_init(ObjectClass *oc, void *data)object_class_property_add (oc,MICROVM_MACHINE_PIC ,"OnOffAuto" , microvm_machine_get_pic, microvm_machine_set_pic, -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_set_description (oc,MICROVM_MACHINE_PIC ,"Enable i8259 PIC" );object_class_property_add (oc,MICROVM_MACHINE_PIT ,"OnOffAuto" , microvm_machine_get_pit, microvm_machine_set_pit, -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_set_description (oc,MICROVM_MACHINE_PIT ,"Enable i8254 PIT" );object_class_property_add (oc,MICROVM_MACHINE_RTC ,"OnOffAuto" , microvm_machine_get_rtc, microvm_machine_set_rtc, -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_set_description (oc,MICROVM_MACHINE_RTC ,"Enable MC146818 RTC" );object_class_property_add_bool (oc,MICROVM_MACHINE_ISA_SERIAL , microvm_machine_get_isa_serial, - microvm_machine_set_isa_serial, - &error_abort); + microvm_machine_set_isa_serial);object_class_property_set_description (oc,MICROVM_MACHINE_ISA_SERIAL ,"Set off to disable the instantiation an ISA serial port" );object_class_property_add_bool (oc,MICROVM_MACHINE_OPTION_ROMS , microvm_machine_get_option_roms, - microvm_machine_set_option_roms, - &error_abort); + microvm_machine_set_option_roms);object_class_property_set_description (oc,MICROVM_MACHINE_OPTION_ROMS ,"Set off to disable loading option ROMs" );object_class_property_add_bool (oc,MICROVM_MACHINE_AUTO_KERNEL_CMDLINE , microvm_machine_get_auto_kernel_cmdline, - microvm_machine_set_auto_kernel_cmdline, - &error_abort); + microvm_machine_set_auto_kernel_cmdline);object_class_property_set_description (oc,MICROVM_MACHINE_AUTO_KERNEL_CMDLINE ,"Set off to disable adding virtio-mmio devices to the kernel cmdline" );
hw/i386/pc.c +6 -6
@@ -658,7 +658,7 @@ void pc_cmos_init(PCMachineState *pcms,TYPE_ISA_DEVICE , (Object **)&x86ms->rtc, object_property_allow_set_link, - OBJ_PROP_LINK_STRONG, &error_abort); + OBJ_PROP_LINK_STRONG);object_property_set_link (OBJECT (pcms),OBJECT (s),"rtc_state" , &error_abort);
@@ -1961,22 +1961,22 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)object_class_property_add (oc,PC_MACHINE_DEVMEM_REGION_SIZE ,"int" , pc_machine_get_device_memory_region_size,NULL , -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_add (oc,PC_MACHINE_VMPORT ,"OnOffAuto" , pc_machine_get_vmport, pc_machine_set_vmport, -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_set_description (oc,PC_MACHINE_VMPORT ,"Enable vmport (pc & q35)" );object_class_property_add_bool (oc,PC_MACHINE_SMBUS , - pc_machine_get_smbus, pc_machine_set_smbus, &error_abort); + pc_machine_get_smbus, pc_machine_set_smbus);object_class_property_add_bool (oc,PC_MACHINE_SATA , - pc_machine_get_sata, pc_machine_set_sata, &error_abort); + pc_machine_get_sata, pc_machine_set_sata);object_class_property_add_bool (oc,PC_MACHINE_PIT , - pc_machine_get_pit, pc_machine_set_pit, &error_abort); + pc_machine_get_pit, pc_machine_set_pit); }static const TypeInfo pc_machine_info = {
hw/i386/pc_piix.c +1 -1
@@ -290,7 +290,7 @@ static void pc_init1(MachineState *machine,TYPE_HOTPLUG_HANDLER , (Object **)&pcms->acpi_dev, object_property_allow_set_link, - OBJ_PROP_LINK_STRONG, &error_abort); + OBJ_PROP_LINK_STRONG);object_property_set_link (OBJECT (machine),OBJECT (piix4_pm),PC_MACHINE_ACPI_DEVICE_PROP , &error_abort); }
hw/i386/pc_q35.c +2 -2
@@ -213,7 +213,7 @@ static void pc_q35_init(MachineState *machine)/* create pci host bus */ q35_host =Q35_HOST_DEVICE (qdev_create (NULL ,TYPE_Q35_HOST_DEVICE )); -object_property_add_child (qdev_get_machine (),"q35" ,OBJECT (q35_host),NULL ); +object_property_add_child (qdev_get_machine (),"q35" ,OBJECT (q35_host));object_property_set_link (OBJECT (q35_host),OBJECT (ram_memory),MCH_HOST_PROP_RAM_MEM ,NULL ); object_property_set_link(OBJECT(q35_host), OBJECT(pci_memory),
@@ -239,7 +239,7 @@ static void pc_q35_init(MachineState *machine)TYPE_HOTPLUG_HANDLER , (Object **)&pcms->acpi_dev, object_property_allow_set_link, - OBJ_PROP_LINK_STRONG, &error_abort); + OBJ_PROP_LINK_STRONG);object_property_set_link (OBJECT (machine),OBJECT (lpc),PC_MACHINE_ACPI_DEVICE_PROP , &error_abort);
hw/i386/pc_sysfw.c +2 -3
@@ -90,10 +90,9 @@ static PFlashCFI01 *pc_pflash_create(PCMachineState *pcms,qdev_prop_set_uint64 (dev,"sector-length" ,FLASH_SECTOR_SIZE );qdev_prop_set_uint8 (dev,"width" ,1 );qdev_prop_set_string (dev,"name" , name); -object_property_add_child (OBJECT (pcms), name,OBJECT (dev), - &error_abort); +object_property_add_child (OBJECT (pcms), name,OBJECT (dev));object_property_add_alias (OBJECT (pcms), alias_prop_name, -OBJECT (dev),"drive" , &error_abort); +OBJECT (dev),"drive" );return PFLASH_CFI01 (dev); }
hw/i386/x86.c +4 -4
@@ -350,7 +350,7 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name) dev =qdev_create (NULL ,TYPE_IOAPIC ); }object_property_add_child (object_resolve_path (parent_name,NULL ), -"ioapic" ,OBJECT (dev),NULL ); +"ioapic" ,OBJECT (dev));qdev_init_nofail (dev); d =SYS_BUS_DEVICE (dev);sysbus_mmio_map (d,0 ,IO_APIC_DEFAULT_ADDRESS );
@@ -982,19 +982,19 @@ static void x86_machine_class_init(ObjectClass *oc, void *data)object_class_property_add (oc,X86_MACHINE_MAX_RAM_BELOW_4G ,"size" , x86_machine_get_max_ram_below_4g, x86_machine_set_max_ram_below_4g, -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_set_description (oc,X86_MACHINE_MAX_RAM_BELOW_4G ,"Maximum ram below the 4G boundary (32bit boundary)" );object_class_property_add (oc,X86_MACHINE_SMM ,"OnOffAuto" , x86_machine_get_smm, x86_machine_set_smm, -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_set_description (oc,X86_MACHINE_SMM ,"Enable SMM" );object_class_property_add (oc,X86_MACHINE_ACPI ,"OnOffAuto" , x86_machine_get_acpi, x86_machine_set_acpi, -NULL ,NULL , &error_abort); +NULL ,NULL );object_class_property_set_description (oc,X86_MACHINE_ACPI ,"Enable ACPI" ); }
hw/ide/macio.c +1 -1
@@ -459,7 +459,7 @@ static void macio_ide_initfn(Object *obj)object_property_add_link (obj,"dbdma" ,TYPE_MAC_DBDMA , (Object **) &s->dbdma, - qdev_prop_allow_set_link_before_realize,0 ,NULL ); + qdev_prop_allow_set_link_before_realize,0 ); }static Property macio_ide_properties[] = {
hw/ide/qdev.c +1 -1
@@ -266,7 +266,7 @@ static void ide_dev_instance_init(Object *obj) {object_property_add (obj,"bootindex" ,"int32" , ide_dev_get_bootindex, - ide_dev_set_bootindex,NULL ,NULL ,NULL ); + ide_dev_set_bootindex,NULL ,NULL );object_property_set_int (obj,-1 ,"bootindex" ,NULL ); }
hw/input/vhost-user-input.c +1 -1
@@ -101,7 +101,7 @@ static void vhost_input_init(Object *obj) vhi->vhost =VHOST_USER_BACKEND (object_new (TYPE_VHOST_USER_BACKEND ));object_property_add_alias (obj,"chardev" , -OBJECT (vhi->vhost),"chardev" , &error_abort); +OBJECT (vhi->vhost),"chardev" ); }static void vhost_input_finalize (Object *obj)
hw/intc/apic_common.c +1 -1
@@ -445,7 +445,7 @@ static void apic_common_initfn(Object *obj) s->id = s->initial_apic_id =-1 ;object_property_add (obj,"id" ,"uint32" , apic_common_get_id, - apic_common_set_id,NULL ,NULL ,NULL ); + apic_common_set_id,NULL ,NULL ); }static void apic_common_class_init (ObjectClass *klass,void *data)
hw/intc/s390_flic.c +2 -2
@@ -65,11 +65,11 @@ void s390_flic_init(void)if (kvm_enabled ()) { dev =qdev_create (NULL ,TYPE_KVM_S390_FLIC );object_property_add_child (qdev_get_machine (),TYPE_KVM_S390_FLIC , -OBJECT (dev),NULL ); +OBJECT (dev)); }else { dev =qdev_create (NULL ,TYPE_QEMU_S390_FLIC );object_property_add_child (qdev_get_machine (),TYPE_QEMU_S390_FLIC , -OBJECT (dev),NULL ); +OBJECT (dev)); }qdev_init_nofail (dev); }
hw/intc/xics.c +1 -1
@@ -380,7 +380,7 @@ Object *icp_create(Object *cpu, const char *type, XICSFabric *xi, Error **errp)Object *obj; obj =object_new (type); -object_property_add_child (cpu, type, obj, &error_abort); +object_property_add_child (cpu, type, obj);object_unref (obj);object_property_set_link (obj,OBJECT (xi),ICP_PROP_XICS , &error_abort);object_property_set_link (obj, cpu,ICP_PROP_CPU , &error_abort);
hw/intc/xive.c +1 -1
@@ -761,7 +761,7 @@ Object *xive_tctx_create(Object *cpu, XivePresenter *xptr, Error **errp)Object *obj; obj =object_new (TYPE_XIVE_TCTX ); -object_property_add_child (cpu,TYPE_XIVE_TCTX , obj, &error_abort); +object_property_add_child (cpu,TYPE_XIVE_TCTX , obj);object_unref (obj);object_property_set_link (obj, cpu,"cpu" , &error_abort);object_property_set_link (obj,OBJECT (xptr),"presenter" , &error_abort);
hw/ipmi/ipmi.c +1 -2
@@ -105,8 +105,7 @@ void ipmi_bmc_find_and_link(Object *obj, Object **bmc) {object_property_add_link (obj,"bmc" ,TYPE_IPMI_BMC , bmc, isa_ipmi_bmc_check, -OBJ_PROP_LINK_STRONG , - &error_abort); +OBJ_PROP_LINK_STRONG ); }static Property ipmi_bmc_properties[] = {
hw/isa/isa-superio.c +5 -10
@@ -62,8 +62,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)qdev_prop_set_uint32 (d,"irq" , k->parallel.get_irq (sio, i)); }qdev_prop_set_chr (d,"chardev" , chr); -object_property_add_child (OBJECT (sio), name,OBJECT (isa), - &error_abort); +object_property_add_child (OBJECT (dev), name,OBJECT (isa));qdev_init_nofail (d); sio->parallel[i] = isa; trace_superio_create_parallel(i,
@@ -102,8 +101,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)qdev_prop_set_uint32 (d,"irq" , k->serial.get_irq (sio, i)); }qdev_prop_set_chr (d,"chardev" , chr); -object_property_add_child (OBJECT (sio), name,OBJECT (isa), - &error_abort); +object_property_add_child (OBJECT (dev), name,OBJECT (isa));qdev_init_nofail (d); sio->serial[i] = isa; trace_superio_create_serial(i,
@@ -137,8 +135,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)qdev_prop_set_drive (d,"driveB" ,blk_by_legacy_dinfo (drive), &error_fatal); } -object_property_add_child (OBJECT (sio),"isa-fdc" ,OBJECT (isa), - &error_abort); +object_property_add_child (OBJECT (sio),"isa-fdc" ,OBJECT (isa));qdev_init_nofail (d); sio->floppy = isa; trace_superio_create_floppy(0,
@@ -150,8 +147,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)/* Keyboard, mouse */ isa =isa_create (bus,TYPE_I8042 ); -object_property_add_child (OBJECT (sio),TYPE_I8042 ,OBJECT (isa), - &error_abort); +object_property_add_child (OBJECT (sio),TYPE_I8042 ,OBJECT (isa));qdev_init_nofail (DEVICE (isa)); sio->kbc = isa;
@@ -169,8 +165,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)qdev_prop_set_uint32 (d,"irq" , k->ide.get_irq (sio,0 )); }qdev_init_nofail (d); -object_property_add_child (OBJECT (sio),"isa-ide" ,OBJECT (isa), - &error_abort); +object_property_add_child (OBJECT (sio),"isa-ide" ,OBJECT (isa)); sio->ide = isa; trace_superio_create_ide(0, k->ide.get_iobase ?
hw/isa/lpc_ich9.c +3 -3
@@ -633,11 +633,11 @@ static void ich9_lpc_initfn(Object *obj)static const uint8_t acpi_disable_cmd =ICH9_APM_ACPI_DISABLE ;object_property_add_uint8_ptr (obj,ACPI_PM_PROP_SCI_INT , - &lpc->sci_gsi,OBJ_PROP_FLAG_READ ,NULL ); + &lpc->sci_gsi,OBJ_PROP_FLAG_READ );object_property_add_uint8_ptr (OBJECT (lpc),ACPI_PM_PROP_ACPI_ENABLE_CMD , - &acpi_enable_cmd,OBJ_PROP_FLAG_READ ,NULL ); + &acpi_enable_cmd,OBJ_PROP_FLAG_READ );object_property_add_uint8_ptr (OBJECT (lpc),ACPI_PM_PROP_ACPI_DISABLE_CMD , - &acpi_disable_cmd,OBJ_PROP_FLAG_READ ,NULL ); + &acpi_disable_cmd,OBJ_PROP_FLAG_READ );ich9_pm_add_properties (obj, &lpc->pm,NULL ); }
hw/mem/nvdimm.c +2 -2
@@ -110,10 +110,10 @@ static void nvdimm_init(Object *obj) {object_property_add (obj,NVDIMM_LABEL_SIZE_PROP ,"int" , nvdimm_get_label_size, nvdimm_set_label_size,NULL , -NULL ,NULL ); +NULL );object_property_add (obj,NVDIMM_UUID_PROP ,"QemuUUID" , nvdimm_get_uuid, - nvdimm_set_uuid,NULL ,NULL ,NULL ); + nvdimm_set_uuid,NULL ,NULL ); }static void nvdimm_finalize (Object *obj)
hw/mem/pc-dimm.c +1 -1
@@ -165,7 +165,7 @@ static void pc_dimm_get_size(Object *obj, Visitor *v, const char *name,static void pc_dimm_init (Object *obj) {object_property_add (obj,PC_DIMM_SIZE_PROP ,"uint64" , pc_dimm_get_size, -NULL ,NULL ,NULL , &error_abort); +NULL ,NULL ,NULL ); }static void pc_dimm_realize (DeviceState *dev,Error **errp)
hw/microblaze/petalogix_ml605_mmu.c +2 -4
@@ -138,10 +138,8 @@ petalogix_ml605_init(MachineState *machine) dma =qdev_create (NULL ,"xlnx.axi-dma" );/* FIXME: attach to the sysbus instead */ -object_property_add_child (qdev_get_machine (),"xilinx-eth" ,OBJECT (eth0), -NULL ); -object_property_add_child (qdev_get_machine (),"xilinx-dma" ,OBJECT (dma), -NULL ); +object_property_add_child (qdev_get_machine (),"xilinx-eth" ,OBJECT (eth0)); +object_property_add_child (qdev_get_machine (),"xilinx-dma" ,OBJECT (dma)); ds =object_property_get_link (OBJECT (dma),"axistream-connected-target" ,NULL );
hw/misc/aspeed_sdmc.c +1 -1
@@ -255,7 +255,7 @@ static void aspeed_sdmc_initfn(Object *obj) {object_property_add (obj,"ram-size" ,"int" , aspeed_sdmc_get_ram_size, aspeed_sdmc_set_ram_size, -NULL ,NULL ,NULL ); +NULL ,NULL ); }static void aspeed_sdmc_realize (DeviceState *dev,Error **errp)
hw/misc/edu.c +1 -2
@@ -402,8 +402,7 @@ static void edu_instance_init(Object *obj) edu->dma_mask = (1UL <<28 ) -1 ;object_property_add_uint64_ptr (obj,"dma_mask" , - &edu->dma_mask,OBJ_PROP_FLAG_READWRITE , -NULL ); + &edu->dma_mask,OBJ_PROP_FLAG_READWRITE ); }static void edu_class_init (ObjectClass *class,void *data)
hw/misc/mac_via.c +2 -2
@@ -885,10 +885,10 @@ static void mac_via_realize(DeviceState *dev, Error **errp)/* Pass through mos6522 output IRQs */ ms =MOS6522 (&m->mos6522_via1);object_property_add_alias (OBJECT (dev),"irq[0]" ,OBJECT (ms), -SYSBUS_DEVICE_GPIO_IRQ "[0]" , &error_abort); +SYSBUS_DEVICE_GPIO_IRQ "[0]" ); ms =MOS6522 (&m->mos6522_via2);object_property_add_alias (OBJECT (dev),"irq[1]" ,OBJECT (ms), -SYSBUS_DEVICE_GPIO_IRQ "[0]" , &error_abort); +SYSBUS_DEVICE_GPIO_IRQ "[0]" );/* Pass through mos6522 input IRQs */ qdev_pass_gpios (DEVICE (&m->mos6522_via1), dev,"via1-irq" );
hw/misc/macio/gpio.c +1 -1
@@ -170,7 +170,7 @@ static void macio_gpio_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_OPENPIC , (Object **) &s->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 );memory_region_init_io (&s->gpiomem,OBJECT (s), &macio_gpio_ops, obj,"gpio" ,0x30 );
hw/misc/macio/macio.c +2 -2
@@ -241,7 +241,7 @@ static void macio_oldworld_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_HEATHROW , (Object **) &os->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 );macio_init_child_obj (s,"cuda" , &s->cuda,sizeof (s->cuda),TYPE_CUDA );
@@ -397,7 +397,7 @@ static void macio_newworld_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_OPENPIC , (Object **) &ns->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 );macio_init_child_obj (s,"gpio" , &ns->gpio,sizeof (ns->gpio),TYPE_MACIO_GPIO );
hw/misc/macio/pmu.c +1 -1
@@ -773,7 +773,7 @@ static void pmu_init(Object *obj)object_property_add_link (obj,"gpio" ,TYPE_MACIO_GPIO , (Object **) &s->gpio, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 );sysbus_init_child_obj (obj,"mos6522-pmu" , &s->mos6522_pmu,sizeof (s->mos6522_pmu),TYPE_MOS6522_PMU );
hw/misc/pca9552.c +1 -1
@@ -298,7 +298,7 @@ static void pca9552_initfn(Object *obj) name =g_strdup_printf ("led%d" , led);object_property_add (obj, name,"bool" , pca9552_get_led, pca9552_set_led, -NULL ,NULL ,NULL ); +NULL ,NULL );g_free (name); } }
hw/misc/tmp105.c +1 -1
@@ -245,7 +245,7 @@ static void tmp105_initfn(Object *obj) {object_property_add (obj,"temperature" ,"int" , tmp105_get_temperature, - tmp105_set_temperature,NULL ,NULL ,NULL ); + tmp105_set_temperature,NULL ,NULL ); }static void tmp105_class_init (ObjectClass *klass,void *data)
hw/misc/tmp421.c +4 -4
@@ -347,16 +347,16 @@ static void tmp421_initfn(Object *obj) {object_property_add (obj,"temperature0" ,"int" , tmp421_get_temperature, - tmp421_set_temperature,NULL ,NULL ,NULL ); + tmp421_set_temperature,NULL ,NULL );object_property_add (obj,"temperature1" ,"int" , tmp421_get_temperature, - tmp421_set_temperature,NULL ,NULL ,NULL ); + tmp421_set_temperature,NULL ,NULL );object_property_add (obj,"temperature2" ,"int" , tmp421_get_temperature, - tmp421_set_temperature,NULL ,NULL ,NULL ); + tmp421_set_temperature,NULL ,NULL );object_property_add (obj,"temperature3" ,"int" , tmp421_get_temperature, - tmp421_set_temperature,NULL ,NULL ,NULL ); + tmp421_set_temperature,NULL ,NULL ); }static void tmp421_class_init (ObjectClass *klass,void *data)
hw/net/cadence_gem.c +1 -2
@@ -1586,8 +1586,7 @@ static void gem_init(Object *obj)object_property_add_link (obj,"dma" ,TYPE_MEMORY_REGION , (Object **)&s->dma_mr, qdev_prop_allow_set_link_before_realize, -OBJ_PROP_LINK_STRONG , - &error_abort); +OBJ_PROP_LINK_STRONG ); }static const VMStateDescription vmstate_cadence_gem = {
hw/net/can/can_kvaser_pci.c +1 -1
@@ -282,7 +282,7 @@ static void kvaser_pci_instance_init(Object *obj)object_property_add_link (obj,"canbus" ,TYPE_CAN_BUS , (Object **)&d->canbus, qdev_prop_allow_set_link_before_realize, -0 , &error_abort); +0 ); }static void kvaser_pci_class_init (ObjectClass *klass,void *data)
hw/net/can/can_mioe3680_pci.c +2 -2
@@ -219,11 +219,11 @@ static void mioe3680_pci_instance_init(Object *obj)object_property_add_link (obj,"canbus0" ,TYPE_CAN_BUS , (Object **)&d->canbus[0 ], qdev_prop_allow_set_link_before_realize, -0 , &error_abort); +0 );object_property_add_link (obj,"canbus1" ,TYPE_CAN_BUS , (Object **)&d->canbus[1 ], qdev_prop_allow_set_link_before_realize, -0 , &error_abort); +0 ); }static void mioe3680_pci_class_init (ObjectClass *klass,void *data)
hw/net/can/can_pcm3680_pci.c +2 -2
@@ -220,11 +220,11 @@ static void pcm3680i_pci_instance_init(Object *obj)object_property_add_link (obj,"canbus0" ,TYPE_CAN_BUS , (Object **)&d->canbus[0 ], qdev_prop_allow_set_link_before_realize, -0 , &error_abort); +0 );object_property_add_link (obj,"canbus1" ,TYPE_CAN_BUS , (Object **)&d->canbus[1 ], qdev_prop_allow_set_link_before_realize, -0 , &error_abort); +0 ); }static void pcm3680i_pci_class_init (ObjectClass *klass,void *data)
hw/net/ne2000-isa.c +1 -1
@@ -133,7 +133,7 @@ static void isa_ne2000_instance_init(Object *obj) {object_property_add (obj,"bootindex" ,"int32" , isa_ne2000_get_bootindex, - isa_ne2000_set_bootindex,NULL ,NULL ,NULL ); + isa_ne2000_set_bootindex,NULL ,NULL );object_property_set_int (obj,-1 ,"bootindex" ,NULL ); }static const TypeInfo ne2000_isa_info = {
hw/net/xilinx_axienet.c +2 -7
@@ -956,16 +956,11 @@ static void xilinx_enet_realize(DeviceState *dev, Error **errp)object_property_add_link (OBJECT (ds),"enet" ,"xlnx.axi-ethernet" , (Object **) &ds->enet, object_property_allow_set_link, -OBJ_PROP_LINK_STRONG , - &local_err); +OBJ_PROP_LINK_STRONG );object_property_add_link (OBJECT (cs),"enet" ,"xlnx.axi-ethernet" , (Object **) &cs->enet, object_property_allow_set_link, -OBJ_PROP_LINK_STRONG , - &local_err); -if (local_err) { - goto xilinx_enet_realize_fail; - } +OBJ_PROP_LINK_STRONG );object_property_set_link (OBJECT (ds),OBJECT (s),"enet" , &local_err);object_property_set_link (OBJECT (cs),OBJECT (s),"enet" , &local_err);if (local_err) {
hw/nios2/10m50_devboard.c +1 -2
@@ -81,8 +81,7 @@ static void nios2_10m50_ghrd_init(MachineState *machine)/* Register: Internal Interrupt Controller (IIC) */ dev =qdev_create (NULL ,"altera,iic" ); -object_property_add_const_link (OBJECT (dev),"cpu" ,OBJECT (cpu), - &error_abort); +object_property_add_const_link (OBJECT (dev),"cpu" ,OBJECT (cpu));qdev_init_nofail (dev);sysbus_connect_irq (SYS_BUS_DEVICE (dev),0 , cpu_irq[0 ]);for (i =0 ; i <32 ; i++) {
hw/nvram/fw_cfg.c +2 -2
@@ -1105,7 +1105,7 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase, }object_property_add_child (OBJECT (qdev_get_machine ()),TYPE_FW_CFG , -OBJECT (dev),NULL ); +OBJECT (dev));qdev_init_nofail (dev); sbd =SYS_BUS_DEVICE (dev);
@@ -1145,7 +1145,7 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr, }object_property_add_child (OBJECT (qdev_get_machine ()),TYPE_FW_CFG , -OBJECT (dev),NULL ); +OBJECT (dev));qdev_init_nofail (dev); sbd =SYS_BUS_DEVICE (dev);
hw/pci-host/grackle.c +1 -1
@@ -109,7 +109,7 @@ static void grackle_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_HEATHROW , (Object **) &s->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 );sysbus_init_mmio (sbd, &phb->conf_mem);sysbus_init_mmio (sbd, &phb->data_mem);
hw/pci-host/i440fx.c +6 -6
@@ -212,19 +212,19 @@ static void i440fx_pcihost_initfn(Object *obj)object_property_add (obj,PCI_HOST_PROP_PCI_HOLE_START ,"uint32" , i440fx_pcihost_get_pci_hole_start, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL );object_property_add (obj,PCI_HOST_PROP_PCI_HOLE_END ,"uint32" , i440fx_pcihost_get_pci_hole_end, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL );object_property_add (obj,PCI_HOST_PROP_PCI_HOLE64_START ,"uint64" , i440fx_pcihost_get_pci_hole64_start, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL );object_property_add (obj,PCI_HOST_PROP_PCI_HOLE64_END ,"uint64" , i440fx_pcihost_get_pci_hole64_end, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL ); }static void i440fx_pcihost_realize (DeviceState *dev,Error **errp)
@@ -275,7 +275,7 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type, b =pci_root_bus_new (dev,NULL , pci_address_space, address_space_io,0 ,TYPE_PCI_BUS ); s->bus = b; -object_property_add_child (qdev_get_machine (),"i440fx" ,OBJECT (dev),NULL ); +object_property_add_child (qdev_get_machine (),"i440fx" ,OBJECT (dev));qdev_init_nofail (dev); d =pci_create_simple (b,0 , pci_type);
@@ -308,7 +308,7 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type,memory_region_set_enabled (&f->low_smram, true);memory_region_add_subregion (&f->smram,0xa0000 , &f->low_smram);object_property_add_const_link (qdev_get_machine (),"smram" , -OBJECT (&f->smram), &error_abort); +OBJECT (&f->smram));init_pam (dev, f->ram_memory, f->system_memory, f->pci_address_space, &f->pam_regions[0 ],PAM_BIOS_BASE ,PAM_BIOS_SIZE );
hw/pci-host/pnv_phb3_msi.c +1 -2
@@ -282,8 +282,7 @@ static void phb3_msi_instance_init(Object *obj)object_property_add_link (obj,"phb" ,TYPE_PNV_PHB3 , (Object **)&msi->phb, object_property_allow_set_link, -OBJ_PROP_LINK_STRONG , - &error_abort); +OBJ_PROP_LINK_STRONG );/* Will be overriden later */ ics->offset =0 ;
hw/pci-host/pnv_phb3_pbcq.c +1 -2
@@ -324,8 +324,7 @@ static void phb3_pbcq_instance_init(Object *obj)object_property_add_link (obj,"phb" ,TYPE_PNV_PHB3 , (Object **)&pbcq->phb, object_property_allow_set_link, -OBJ_PROP_LINK_STRONG , - &error_abort); +OBJ_PROP_LINK_STRONG ); }static void pnv_pbcq_class_init (ObjectClass *klass,void *data)
hw/pci-host/q35.c +10 -10
@@ -222,38 +222,38 @@ static void q35_host_initfn(Object *obj) Q35_PCI_HOST_HOLE64_SIZE_DEFAULT);object_property_add (obj,PCI_HOST_PROP_PCI_HOLE_START ,"uint32" , q35_host_get_pci_hole_start, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL );object_property_add (obj,PCI_HOST_PROP_PCI_HOLE_END ,"uint32" , q35_host_get_pci_hole_end, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL );object_property_add (obj,PCI_HOST_PROP_PCI_HOLE64_START ,"uint64" , q35_host_get_pci_hole64_start, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL );object_property_add (obj,PCI_HOST_PROP_PCI_HOLE64_END ,"uint64" , q35_host_get_pci_hole64_end, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL );object_property_add_uint64_ptr (obj,PCIE_HOST_MCFG_SIZE , - &pehb->size,OBJ_PROP_FLAG_READ ,NULL ); + &pehb->size,OBJ_PROP_FLAG_READ );object_property_add_link (obj,MCH_HOST_PROP_RAM_MEM ,TYPE_MEMORY_REGION , (Object **) &s->mch.ram_memory, - qdev_prop_allow_set_link_before_realize,0 ,NULL ); + qdev_prop_allow_set_link_before_realize,0 );object_property_add_link (obj,MCH_HOST_PROP_PCI_MEM ,TYPE_MEMORY_REGION , (Object **) &s->mch.pci_address_space, - qdev_prop_allow_set_link_before_realize,0 ,NULL ); + qdev_prop_allow_set_link_before_realize,0 );object_property_add_link (obj,MCH_HOST_PROP_SYSTEM_MEM ,TYPE_MEMORY_REGION , (Object **) &s->mch.system_memory, - qdev_prop_allow_set_link_before_realize,0 ,NULL ); + qdev_prop_allow_set_link_before_realize,0 );object_property_add_link (obj,MCH_HOST_PROP_IO_MEM ,TYPE_MEMORY_REGION , (Object **) &s->mch.address_space_io, - qdev_prop_allow_set_link_before_realize,0 ,NULL ); + qdev_prop_allow_set_link_before_realize,0 ); }static const TypeInfo q35_host_info = {
@@ -638,7 +638,7 @@ static void mch_realize(PCIDevice *d, Error **errp) &mch->smbase_window);object_property_add_const_link (qdev_get_machine (),"smram" , -OBJECT (&mch->smram), &error_abort); +OBJECT (&mch->smram)); init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory, mch->pci_address_space, &mch->pam_regions[0],
hw/pci-host/sabre.c +1 -1
@@ -442,7 +442,7 @@ static void sabre_init(Object *obj)object_property_add_link (obj,"iommu" ,TYPE_SUN4U_IOMMU , (Object **) &s->iommu, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 );/* sabre_config */ memory_region_init_io(&s->sabre_config, OBJECT(s), &sabre_config_ops, s,
hw/pci-host/uninorth.c +4 -4
@@ -175,7 +175,7 @@ static void pci_unin_main_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_OPENPIC , (Object **) &s->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 );sysbus_init_mmio (sbd, &h->conf_mem);sysbus_init_mmio (sbd, &h->data_mem);
@@ -223,7 +223,7 @@ static void pci_u3_agp_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_OPENPIC , (Object **) &s->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 );sysbus_init_mmio (sbd, &h->conf_mem);sysbus_init_mmio (sbd, &h->data_mem);
@@ -262,7 +262,7 @@ static void pci_unin_agp_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_OPENPIC , (Object **) &s->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 );sysbus_init_mmio (sbd, &h->conf_mem);sysbus_init_mmio (sbd, &h->data_mem);
@@ -299,7 +299,7 @@ static void pci_unin_internal_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_OPENPIC , (Object **) &s->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 );sysbus_init_mmio (sbd, &h->conf_mem);sysbus_init_mmio (sbd, &h->data_mem);
hw/pcmcia/pxa2xx.c +1 -1
@@ -189,7 +189,7 @@ static void pxa2xx_pcmcia_initfn(Object *obj)object_property_add_link (obj,"card" ,TYPE_PCMCIA_CARD , (Object **)&s->card,NULL ,/* read-only property */ -0 ,NULL ); +0 ); }/* Insert a new card into a slot */
hw/ppc/e500.c +3 -5
@@ -744,8 +744,7 @@ static DeviceState *ppce500_init_mpic_qemu(PPCE500MachineState *pms,const PPCE500MachineClass *pmc =PPCE500_MACHINE_GET_CLASS (pms); dev =qdev_create (NULL ,TYPE_OPENPIC ); -object_property_add_child (OBJECT (machine),"pic" ,OBJECT (dev), - &error_fatal); +object_property_add_child (OBJECT (machine),"pic" ,OBJECT (dev));qdev_prop_set_uint32 (dev,"model" , pmc->mpic_version);qdev_prop_set_uint32 (dev,"nb_cpus" , smp_cpus);
@@ -916,7 +915,7 @@ void ppce500_init(MachineState *machine) dev =qdev_create (NULL ,"e500-ccsr" );object_property_add_child (qdev_get_machine (),"e500-ccsr" , -OBJECT (dev),NULL ); +OBJECT (dev));qdev_init_nofail (dev); ccsr =CCSR (dev); ccsr_addr_space = &ccsr->ccsr_space;
@@ -957,8 +956,7 @@ void ppce500_init(MachineState *machine)/* PCI */ dev =qdev_create (NULL ,"e500-pcihost" ); -object_property_add_child (qdev_get_machine (),"pci-host" ,OBJECT (dev), - &error_abort); +object_property_add_child (qdev_get_machine (),"pci-host" ,OBJECT (dev));qdev_prop_set_uint32 (dev,"first_slot" , pmc->pci_first_slot);qdev_prop_set_uint32 (dev,"first_pin_irq" , pci_irq_nrs[0 ]);qdev_init_nofail (dev);
hw/ppc/mac_newworld.c +2 -2
@@ -455,7 +455,7 @@ static void ppc_core99_init(MachineState *machine)qdev_prop_set_uint32 (dev,"data_width" ,1 );qdev_prop_set_bit (dev,"dma_enabled" , false);object_property_add_child (OBJECT (qdev_get_machine ()),TYPE_FW_CFG , -OBJECT (fw_cfg),NULL ); +OBJECT (fw_cfg));qdev_init_nofail (dev); s =SYS_BUS_DEVICE (dev);sysbus_mmio_map (s,0 ,CFG_ADDR );
@@ -628,7 +628,7 @@ static void core99_instance_init(Object *obj)/* Default via_config is CORE99_VIA_CONFIG_CUDA */ cms->via_config =CORE99_VIA_CONFIG_CUDA ;object_property_add_str (obj,"via" , core99_get_via_config, - core99_set_via_config,NULL ); + core99_set_via_config);object_property_set_description (obj,"via" ,"Set VIA configuration. " "Valid values are cuda, pmu and pmu-adb" );
hw/ppc/mac_oldworld.c +1 -1
@@ -314,7 +314,7 @@ static void ppc_heathrow_init(MachineState *machine)qdev_prop_set_uint32 (dev,"data_width" ,1 );qdev_prop_set_bit (dev,"dma_enabled" , false);object_property_add_child (OBJECT (qdev_get_machine ()),TYPE_FW_CFG , -OBJECT (fw_cfg),NULL ); +OBJECT (fw_cfg));qdev_init_nofail (dev); s =SYS_BUS_DEVICE (dev);sysbus_mmio_map (s,0 ,CFG_ADDR );
hw/ppc/pnv.c +5 -8
@@ -830,7 +830,7 @@ static void pnv_init(MachineState *machine) }snprintf (chip_name,sizeof (chip_name),"chip[%d]" ,PNV_CHIP_HWID (i)); -object_property_add_child (OBJECT (pnv), chip_name, chip, &error_fatal); +object_property_add_child (OBJECT (pnv), chip_name, chip);object_property_set_int (chip,PNV_CHIP_HWID (i),"chip-id" , &error_fatal); object_property_set_int(chip, machine->smp.cores,
@@ -1058,8 +1058,7 @@ static void pnv_chip_power8_instance_init(Object *obj)object_property_add_link (obj,"xics" ,TYPE_XICS_FABRIC , (Object **)&chip8->xics, object_property_allow_set_link, -OBJ_PROP_LINK_STRONG , - &error_abort); +OBJ_PROP_LINK_STRONG );object_initialize_child (obj,"psi" , &chip8->psi,sizeof (chip8->psi),TYPE_PNV8_PSI , &error_abort,NULL );
@@ -1319,7 +1318,7 @@ static void pnv_chip_power9_instance_init(Object *obj)object_initialize_child (obj,"xive" , &chip9->xive,sizeof (chip9->xive),TYPE_PNV_XIVE , &error_abort,NULL );object_property_add_alias (obj,"xive-fabric" ,OBJECT (&chip9->xive), -"xive-fabric" , &error_abort); +"xive-fabric" );object_initialize_child (obj,"psi" , &chip9->psi,sizeof (chip9->psi),TYPE_PNV9_PSI , &error_abort,NULL );
@@ -1737,8 +1736,7 @@ static void pnv_chip_core_realize(PnvChip *chip, Error **errp) pnv_core =PNV_CORE (object_new (typename));snprintf (core_name,sizeof (core_name),"core[%d]" , core_hwid); -object_property_add_child (OBJECT (chip), core_name,OBJECT (pnv_core), - &error_abort); +object_property_add_child (OBJECT (chip), core_name,OBJECT (pnv_core)); chip->cores[i] = pnv_core;object_property_set_int (OBJECT (pnv_core), chip->nr_threads,"nr-threads" , &error_fatal);
@@ -1999,8 +1997,7 @@ static void pnv_machine_class_init(ObjectClass *oc, void *data) ispc->print_info = pnv_pic_print_info;object_class_property_add_bool (oc,"hb-mode" , - pnv_machine_get_hb, pnv_machine_set_hb, - &error_abort); + pnv_machine_get_hb, pnv_machine_set_hb);object_class_property_set_description (oc,"hb-mode" ,"Use a hostboot like boot loader" ); }
hw/ppc/pnv_bmc.c +2 -3
@@ -217,8 +217,7 @@ static const IPMINetfn hiomap_netfn = {void pnv_bmc_set_pnor (IPMIBmc *bmc,PnvPnor *pnor) {object_ref (OBJECT (pnor)); -object_property_add_const_link (OBJECT (bmc),"pnor" ,OBJECT (pnor), - &error_abort); +object_property_add_const_link (OBJECT (bmc),"pnor" ,OBJECT (pnor));/* Install the HIOMAP protocol handlers to access the PNOR */ ipmi_sim_register_netfn(IPMI_BMC_SIMULATOR(bmc), IPMI_NETFN_OEM,
@@ -235,7 +234,7 @@ IPMIBmc *pnv_bmc_create(PnvPnor *pnor) obj =object_new (TYPE_IPMI_BMC_SIMULATOR );object_ref (OBJECT (pnor)); -object_property_add_const_link (obj,"pnor" ,OBJECT (pnor), &error_abort); +object_property_add_const_link (obj,"pnor" ,OBJECT (pnor));object_property_set_bool (obj, true,"realized" , &error_fatal);/* Install the HIOMAP protocol handlers to access the PNOR */
hw/ppc/pnv_core.c +1 -1
@@ -232,7 +232,7 @@ static void pnv_core_realize(DeviceState *dev, Error **errp) pc->threads[i] =POWERPC_CPU (obj);snprintf (name,sizeof (name),"thread[%d]" , i); -object_property_add_child (OBJECT (pc), name, obj, &error_abort); +object_property_add_child (OBJECT (pc), name, obj); cpu->machine_data =g_new0 (PnvCPUState,1 );
hw/ppc/pnv_psi.c +1 -1
@@ -486,7 +486,7 @@ static void pnv_psi_power8_instance_init(Object *obj)object_initialize_child (obj,"ics-psi" , &psi8->ics,sizeof (psi8->ics),TYPE_ICS , &error_abort,NULL );object_property_add_alias (obj,ICS_PROP_XICS ,OBJECT (&psi8->ics), -ICS_PROP_XICS , &error_abort); +ICS_PROP_XICS ); }static const uint8_t irq_to_xivr[] = {
hw/ppc/prep.c +3 -3
@@ -229,7 +229,7 @@ static int prep_set_cmos_checksum(DeviceState *dev, void *opaque)rtc_set_memory (rtc,0x3f , checksum >>8 );object_property_add_alias (qdev_get_machine (),"rtc-time" ,OBJECT (rtc), -"date" ,NULL ); +"date" ); }return 0 ; }
@@ -275,7 +275,7 @@ static void ibm_40p_init(MachineState *machine)qdev_prop_set_string (dev,"bios-name" , bios_name);qdev_prop_set_uint32 (dev,"elf-machine" ,PPC_ELF_MACHINE ); pcihost =SYS_BUS_DEVICE (dev); -object_property_add_child (qdev_get_machine (),"raven" ,OBJECT (dev),NULL ); +object_property_add_child (qdev_get_machine (),"raven" ,OBJECT (dev));qdev_init_nofail (dev); pci_bus =PCI_BUS (qdev_get_child_bus (dev,"pci.0" ));if (!pci_bus) {
@@ -343,7 +343,7 @@ static void ibm_40p_init(MachineState *machine)qdev_prop_set_uint32 (dev,"data_width" ,1 );qdev_prop_set_bit (dev,"dma_enabled" , false);object_property_add_child (OBJECT (qdev_get_machine ()),TYPE_FW_CFG , -OBJECT (fw_cfg),NULL ); +OBJECT (fw_cfg));qdev_init_nofail (dev); s =SYS_BUS_DEVICE (dev);sysbus_mmio_map (s,0 ,CFG_ADDR );
hw/ppc/spapr.c +10 -15
@@ -1743,7 +1743,7 @@ static void spapr_rtc_create(SpaprMachineState *spapr)object_property_set_bool (OBJECT (&spapr->rtc), true,"realized" , &error_fatal);object_property_add_alias (OBJECT (spapr),"rtc-time" ,OBJECT (&spapr->rtc), -"date" , &error_fatal); +"date" ); }/* Returns whether we want to use VGA or not */
@@ -3315,13 +3315,12 @@ static void spapr_instance_init(Object *obj) spapr->htab_fd =-1 ; spapr->use_hotplug_event_source = true;object_property_add_str (obj,"kvm-type" , - spapr_get_kvm_type, spapr_set_kvm_type,NULL ); + spapr_get_kvm_type, spapr_set_kvm_type);object_property_set_description (obj,"kvm-type" ,"Specifies the KVM virtualization mode (HV, PR)" );object_property_add_bool (obj,"modern-hotplug-events" , spapr_get_modern_hotplug_events, - spapr_set_modern_hotplug_events, -NULL ); + spapr_set_modern_hotplug_events);object_property_set_description (obj,"modern-hotplug-events" ,"Use dedicated hotplug event mechanism in" " place of standard EPOW events when possible"
@@ -3331,22 +3330,20 @@ static void spapr_instance_init(Object *obj) &error_fatal);object_property_add_str (obj,"resize-hpt" , - spapr_get_resize_hpt, spapr_set_resize_hpt,NULL ); + spapr_get_resize_hpt, spapr_set_resize_hpt);object_property_set_description (obj,"resize-hpt" ,"Resizing of the Hash Page Table (enabled, disabled, required)" );object_property_add_uint32_ptr (obj,"vsmt" , - &spapr->vsmt,OBJ_PROP_FLAG_READWRITE , - &error_abort); + &spapr->vsmt,OBJ_PROP_FLAG_READWRITE );object_property_set_description (obj,"vsmt" ,"Virtual SMT: KVM behaves as if this were" " the host's SMT mode" );object_property_add_bool (obj,"vfio-no-msix-emulation" , - spapr_get_msix_emulation,NULL ,NULL ); + spapr_get_msix_emulation,NULL );object_property_add_uint64_ptr (obj,"kernel-addr" , - &spapr->kernel_addr,OBJ_PROP_FLAG_READWRITE , - &error_abort); + &spapr->kernel_addr,OBJ_PROP_FLAG_READWRITE );object_property_set_description (obj,"kernel-addr" , stringify(KERNEL_LOAD_ADDR)" for -kernel is the default" );
@@ -3354,18 +3351,16 @@ static void spapr_instance_init(Object *obj)/* The machine class defines the default interrupt controller mode */ spapr->irq = smc->irq;object_property_add_str (obj,"ic-mode" , spapr_get_ic_mode, - spapr_set_ic_mode,NULL ); + spapr_set_ic_mode);object_property_set_description (obj,"ic-mode" ,"Specifies the interrupt controller mode (xics, xive, dual)" );object_property_add_str (obj,"host-model" , - spapr_get_host_model, spapr_set_host_model, - &error_abort); + spapr_get_host_model, spapr_set_host_model);object_property_set_description (obj,"host-model" ,"Host model to advertise in guest device tree" );object_property_add_str (obj,"host-serial" , - spapr_get_host_serial, spapr_set_host_serial, - &error_abort); + spapr_get_host_serial, spapr_set_host_serial);object_property_set_description (obj,"host-serial" ,"Host serial number to advertise in guest device tree" ); }
hw/ppc/spapr_caps.c +1 -7
@@ -826,7 +826,6 @@ void spapr_caps_cpu_apply(SpaprMachineState *spapr, PowerPCCPU *cpu)void spapr_caps_add_properties (SpaprMachineClass *smc,Error **errp) { -Error *local_err =NULL ;ObjectClass *klass =OBJECT_CLASS (smc);int i;
@@ -837,12 +836,7 @@ void spapr_caps_add_properties(SpaprMachineClass *smc, Error **errp)object_class_property_add (klass, name, cap->type, cap->get, cap->set, -NULL , cap, &local_err); -if (local_err) { -error_propagate (errp, local_err); -g_free (name); -return ; - } +NULL , cap); desc =g_strdup_printf ("%s" , cap->description);object_class_property_set_description (klass, name, desc);
hw/ppc/spapr_cpu_core.c +1 -4
@@ -290,11 +290,8 @@ static PowerPCCPU *spapr_create_vcpu(SpaprCpuCore *sc, int i, Error **errp) cpu->node_id = sc->node_id; id =g_strdup_printf ("thread[%d]" , i); -object_property_add_child (OBJECT (sc), id, obj, &local_err); +object_property_add_child (OBJECT (sc), id, obj);g_free (id); -if (local_err) { - goto err; - } cpu->machine_data =g_new0 (SpaprCpuState,1 );
hw/ppc/spapr_drc.c +6 -12
@@ -392,7 +392,7 @@ void spapr_drc_attach(SpaprDrc *drc, DeviceState *d, Error **errp)object_property_add_link (OBJECT (drc),"device" ,object_get_typename (OBJECT (drc->dev)), (Object **)(&drc->dev), -NULL ,0 ,NULL ); +NULL ,0 ); }static void spapr_drc_release (SpaprDrc *drc)
@@ -519,7 +519,6 @@ static void realize(DeviceState *d, Error **errp)Object *root_container;gchar *link_name;char *child_name; -Error *err =NULL ;trace_spapr_drc_realize (spapr_drc_index (drc));/* NOTE: we do this as part of realize/unrealize due to the fact
@@ -534,13 +533,9 @@ static void realize(DeviceState *d, Error **errp) child_name =object_get_canonical_path_component (OBJECT (drc));trace_spapr_drc_realize_child (spapr_drc_index (drc), child_name);object_property_add_alias (root_container, link_name, - drc->owner, child_name, &err); + drc->owner, child_name);g_free (child_name);g_free (link_name); -if (err) { -error_propagate (errp, err); -return ; - }vmstate_register (VMSTATE_IF (drc),spapr_drc_index (drc), &vmstate_spapr_drc, drc);trace_spapr_drc_realize_complete (spapr_drc_index (drc));
@@ -570,7 +565,7 @@ SpaprDrc *spapr_dr_connector_new(Object *owner, const char *type, drc->owner = owner; prop_name =g_strdup_printf ("dr-connector[%" PRIu32"]" ,spapr_drc_index (drc)); -object_property_add_child (owner, prop_name,OBJECT (drc), &error_abort); +object_property_add_child (owner, prop_name,OBJECT (drc));object_unref (OBJECT (drc));object_property_set_bool (OBJECT (drc), true,"realized" ,NULL );g_free (prop_name);
@@ -583,12 +578,11 @@ static void spapr_dr_connector_instance_init(Object *obj)SpaprDrc *drc =SPAPR_DR_CONNECTOR (obj);SpaprDrcClass *drck =SPAPR_DR_CONNECTOR_GET_CLASS (drc); -object_property_add_uint32_ptr (obj,"id" , &drc->id,OBJ_PROP_FLAG_READ , -NULL ); +object_property_add_uint32_ptr (obj,"id" , &drc->id,OBJ_PROP_FLAG_READ );object_property_add (obj,"index" ,"uint32" , prop_get_index, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL );object_property_add (obj,"fdt" ,"struct" , prop_get_fdt, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL ); drc->state = drck->empty_state; }
hw/ppc/spapr_iommu.c +1 -1
@@ -365,7 +365,7 @@ SpaprTceTable *spapr_tce_new_table(DeviceState *owner, uint32_t liobn) tcet->liobn = liobn; tmp =g_strdup_printf ("tce-table-%x" , liobn); -object_property_add_child (OBJECT (owner), tmp,OBJECT (tcet),NULL ); +object_property_add_child (OBJECT (owner), tmp,OBJECT (tcet));g_free (tmp);object_unref (OBJECT (tcet));
hw/ppc/spapr_irq.c +1 -1
@@ -307,7 +307,7 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **errp) obj =object_new (TYPE_ICS_SPAPR ); -object_property_add_child (OBJECT (spapr),"ics" , obj, &error_abort); +object_property_add_child (OBJECT (spapr),"ics" , obj);object_property_set_link (obj,OBJECT (spapr),ICS_PROP_XICS , &error_abort);object_property_set_int (obj, smc->nr_xirqs,"nr-irqs" , &error_abort);
hw/ppc/spapr_rtc.c +1 -1
@@ -149,7 +149,7 @@ static void spapr_rtc_realize(DeviceState *dev, Error **errp) rtc_ns =qemu_clock_get_ns (rtc_clock); rtc->ns_offset = host_s *NANOSECONDS_PER_SECOND - rtc_ns; -object_property_add_tm (OBJECT (rtc),"date" , spapr_rtc_qom_date,NULL ); +object_property_add_tm (OBJECT (rtc),"date" , spapr_rtc_qom_date); }static const VMStateDescription vmstate_spapr_rtc = {
hw/riscv/sifive_u.c +1 -1
@@ -463,7 +463,7 @@ static void riscv_sifive_u_machine_instance_init(Object *obj) s->start_in_flash = false;object_property_add_bool (obj,"start-in-flash" , sifive_u_get_start_in_flash, - sifive_u_set_start_in_flash,NULL ); + sifive_u_set_start_in_flash);object_property_set_description (obj,"start-in-flash" ,"Set on to tell QEMU's ROM to jump to " "flash. Otherwise QEMU will jump to DRAM" );
hw/riscv/virt.c +2 -3
@@ -92,10 +92,9 @@ static PFlashCFI01 *virt_flash_create1(RISCVVirtState *s,qdev_prop_set_uint16 (dev,"id3" ,0x00 );qdev_prop_set_string (dev,"name" , name); -object_property_add_child (OBJECT (s), name,OBJECT (dev), - &error_abort); +object_property_add_child (OBJECT (s), name,OBJECT (dev));object_property_add_alias (OBJECT (s), alias_prop_name, -OBJECT (dev),"drive" , &error_abort); +OBJECT (dev),"drive" );return PFLASH_CFI01 (dev); }
hw/rtc/mc146818rtc.c +2 -2
@@ -963,7 +963,7 @@ static void rtc_realizefn(DeviceState *dev, Error **errp)qdev_set_legacy_instance_id (dev, base,3 );qemu_register_reset (rtc_reset, s); -object_property_add_tm (OBJECT (s),"date" , rtc_get_date,NULL ); +object_property_add_tm (OBJECT (s),"date" , rtc_get_date);qdev_init_gpio_out (dev, &s->irq,1 );QLIST_INSERT_HEAD (&rtc_devices, s, link);
@@ -985,7 +985,7 @@ ISADevice *mc146818_rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq) }object_property_add_alias (qdev_get_machine (),"rtc-time" ,OBJECT (isadev), -"date" ,NULL ); +"date" );return isadev; }
hw/s390x/ap-bridge.c +1 -1
@@ -51,7 +51,7 @@ void s390_init_ap(void)/* Create bridge device */ dev =qdev_create (NULL ,TYPE_AP_BRIDGE );object_property_add_child (qdev_get_machine (),TYPE_AP_BRIDGE , -OBJECT (dev),NULL ); +OBJECT (dev));qdev_init_nofail (dev);/* Create bus on bridge device */
hw/s390x/css-bridge.c +2 -2
@@ -103,7 +103,7 @@ VirtualCssBus *virtual_css_bus_init(void)/* Create bridge device */ dev =qdev_create (NULL ,TYPE_VIRTUAL_CSS_BRIDGE );object_property_add_child (qdev_get_machine (),TYPE_VIRTUAL_CSS_BRIDGE , -OBJECT (dev),NULL ); +OBJECT (dev));qdev_init_nofail (dev);/* Create bus on bridge device */
@@ -141,7 +141,7 @@ static void virtual_css_bridge_class_init(ObjectClass *klass, void *data)set_bit (DEVICE_CATEGORY_BRIDGE , dc->categories);device_class_set_props (dc, virtual_css_bridge_properties);object_class_property_add_bool (klass,"cssid-unrestricted" , - prop_get_true,NULL ,NULL ); + prop_get_true,NULL );object_class_property_set_description (klass,"cssid-unrestricted" ,"A css device can use any cssid, regardless whether virtual" " or not (read only, always true)" );
hw/s390x/event-facility.c +3 -3
@@ -449,18 +449,18 @@ static void init_event_facility(Object *obj) event_facility->allow_all_mask_sizes = true;object_property_add_bool (obj,"allow_all_mask_sizes" , sclp_event_get_allow_all_mask_sizes, - sclp_event_set_allow_all_mask_sizes,NULL ); + sclp_event_set_allow_all_mask_sizes);/* Spawn a new bus for SCLP events */ qbus_create_inplace (&event_facility->sbus,sizeof (event_facility->sbus),TYPE_SCLP_EVENTS_BUS , sdev,NULL ); new =object_new (TYPE_SCLP_QUIESCE ); -object_property_add_child (obj,TYPE_SCLP_QUIESCE , new,NULL ); +object_property_add_child (obj,TYPE_SCLP_QUIESCE , new);object_unref (new);qdev_set_parent_bus (DEVICE (new),BUS (&event_facility->sbus)); new =object_new (TYPE_SCLP_CPU_HOTPLUG ); -object_property_add_child (obj,TYPE_SCLP_CPU_HOTPLUG , new,NULL ); +object_property_add_child (obj,TYPE_SCLP_CPU_HOTPLUG , new);object_unref (new);qdev_set_parent_bus (DEVICE (new),BUS (&event_facility->sbus));/* the facility will automatically realize the devices via the bus */
hw/s390x/s390-skeys.c +2 -2
@@ -45,7 +45,7 @@ void s390_skeys_init(void) obj =object_new (TYPE_QEMU_S390_SKEYS ); }object_property_add_child (qdev_get_machine (),TYPE_S390_SKEYS , - obj,NULL ); + obj);object_unref (obj);qdev_init_nofail (DEVICE (obj));
@@ -400,7 +400,7 @@ static void s390_skeys_instance_init(Object *obj) {object_property_add_bool (obj,"migration-enabled" , s390_skeys_get_migration_enabled, - s390_skeys_set_migration_enabled,NULL ); + s390_skeys_set_migration_enabled);object_property_set_bool (obj, true,"migration-enabled" ,NULL ); }
hw/s390x/s390-stattrib.c +2 -2
@@ -47,7 +47,7 @@ void s390_stattrib_init(void) }object_property_add_child (qdev_get_machine (),TYPE_S390_STATTRIB , - obj,NULL ); + obj);object_unref (obj);qdev_init_nofail (DEVICE (obj));
@@ -387,7 +387,7 @@ static void s390_stattrib_instance_init(Object *obj)object_property_add_bool (obj,"migration-enabled" , s390_stattrib_get_migration_enabled, - s390_stattrib_set_migration_enabled,NULL ); + s390_stattrib_set_migration_enabled);object_property_set_bool (obj, true,"migration-enabled" ,NULL ); sas->migration_cur_gfn =0 ; }
hw/s390x/s390-virtio-ccw.c +5 -5
@@ -202,7 +202,7 @@ static void s390_init_ipl_dev(const char *kernel_filename, }g_free (netboot_fw_prop);object_property_add_child (qdev_get_machine (),TYPE_S390_IPL , - new,NULL ); + new);object_unref (new);qdev_init_nofail (dev); }
@@ -265,7 +265,7 @@ static void ccw_init(MachineState *machine) dev =qdev_create (NULL ,TYPE_S390_PCI_HOST_BRIDGE );object_property_add_child (qdev_get_machine (),TYPE_S390_PCI_HOST_BRIDGE , -OBJECT (dev),NULL ); +OBJECT (dev));qdev_init_nofail (dev);/* register hypercalls */
@@ -600,19 +600,19 @@ static inline void s390_machine_initfn(Object *obj) {object_property_add_bool (obj,"aes-key-wrap" , machine_get_aes_key_wrap, - machine_set_aes_key_wrap,NULL ); + machine_set_aes_key_wrap);object_property_set_description (obj,"aes-key-wrap" ,"enable/disable AES key wrapping using the CPACF wrapping key" );object_property_set_bool (obj, true,"aes-key-wrap" ,NULL );object_property_add_bool (obj,"dea-key-wrap" , machine_get_dea_key_wrap, - machine_set_dea_key_wrap,NULL ); + machine_set_dea_key_wrap);object_property_set_description (obj,"dea-key-wrap" ,"enable/disable DEA key wrapping using the CPACF wrapping key" );object_property_set_bool (obj, true,"dea-key-wrap" ,NULL );object_property_add_str (obj,"loadparm" , - machine_get_loadparm, machine_set_loadparm,NULL ); + machine_get_loadparm, machine_set_loadparm);object_property_set_description (obj,"loadparm" ,"Up to 8 chars in set of [A-Za-z0-9. ] (lower case chars converted" " to upper case) to pass to machine loader, boot manager,"
hw/s390x/sclp.c +2 -3
@@ -286,8 +286,7 @@ void s390_sclp_init(void) {Object *new =object_new (TYPE_SCLP ); -object_property_add_child (qdev_get_machine (),TYPE_SCLP , new, -NULL ); +object_property_add_child (qdev_get_machine (),TYPE_SCLP , new);object_unref (OBJECT (new));qdev_init_nofail (DEVICE (new)); }
@@ -349,7 +348,7 @@ static void sclp_init(Object *obj)Object *new; new =object_new (TYPE_SCLP_EVENT_FACILITY ); -object_property_add_child (obj,TYPE_SCLP_EVENT_FACILITY , new,NULL ); +object_property_add_child (obj,TYPE_SCLP_EVENT_FACILITY , new);object_unref (new); sclp->event_facility =EVENT_FACILITY (new);
hw/s390x/tod.c +1 -1
@@ -26,7 +26,7 @@ void s390_init_tod(void) }else { obj =object_new (TYPE_QEMU_S390_TOD ); } -object_property_add_child (qdev_get_machine (),TYPE_S390_TOD , obj,NULL ); +object_property_add_child (qdev_get_machine (),TYPE_S390_TOD , obj);object_unref (obj);qdev_init_nofail (DEVICE (obj));
hw/s390x/virtio-ccw-balloon.c +2 -2
@@ -32,10 +32,10 @@ static void virtio_ccw_balloon_instance_init(Object *obj)virtio_instance_init_common (obj, &dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_BALLOON );object_property_add_alias (obj,"guest-stats" ,OBJECT (&dev->vdev), -"guest-stats" , &error_abort); +"guest-stats" );object_property_add_alias (obj,"guest-stats-polling-interval" ,OBJECT (&dev->vdev), -"guest-stats-polling-interval" , &error_abort); +"guest-stats-polling-interval" ); }static Property virtio_ccw_balloon_properties[] = {
hw/s390x/virtio-ccw-blk.c +1 -1
@@ -32,7 +32,7 @@ static void virtio_ccw_blk_instance_init(Object *obj)virtio_instance_init_common (obj, &dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_BLK );object_property_add_alias (obj,"bootindex" ,OBJECT (&dev->vdev), -"bootindex" , &error_abort); +"bootindex" ); }static Property virtio_ccw_blk_properties[] = {
hw/s390x/virtio-ccw-net.c +1 -1
@@ -35,7 +35,7 @@ static void virtio_ccw_net_instance_init(Object *obj)virtio_instance_init_common (obj, &dev->vdev,sizeof (dev->vdev),TYPE_VIRTIO_NET );object_property_add_alias (obj,"bootindex" ,OBJECT (&dev->vdev), -"bootindex" , &error_abort); +"bootindex" ); }static Property virtio_ccw_net_properties[] = {
hw/scsi/scsi-bus.c +1 -1
@@ -268,7 +268,7 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk, } dev =qdev_create (&bus->qbus, driver); name =g_strdup_printf ("legacy[%d]" , unit); -object_property_add_child (OBJECT (bus), name,OBJECT (dev),NULL ); +object_property_add_child (OBJECT (bus), name,OBJECT (dev));g_free (name);qdev_prop_set_uint32 (dev,"scsi-id" , unit);
hw/sparc/sun4m.c +2 -2
@@ -795,7 +795,7 @@ static void ram_initfn(Object *obj)object_property_add_link (obj,"memdev" ,TYPE_MEMORY_BACKEND , (Object **)&d->memdev, object_property_allow_set_link, -OBJ_PROP_LINK_STRONG , &error_abort); +OBJ_PROP_LINK_STRONG );object_property_set_description (obj,"memdev" ,"Set RAM backend" "Valid value is ID of a hostmem backend" ); }
@@ -1060,7 +1060,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,qdev_prop_set_uint32 (dev,"data_width" ,1 );qdev_prop_set_bit (dev,"dma_enabled" , false);object_property_add_child (OBJECT (qdev_get_machine ()),TYPE_FW_CFG , -OBJECT (fw_cfg),NULL ); +OBJECT (fw_cfg));qdev_init_nofail (dev); s =SYS_BUS_DEVICE (dev);sysbus_mmio_map (s,0 ,CFG_ADDR );
hw/sparc64/sun4u.c +1 -1
@@ -691,7 +691,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, dev =qdev_create (NULL ,TYPE_FW_CFG_IO );qdev_prop_set_bit (dev,"dma_enabled" , false); -object_property_add_child (OBJECT (ebus),TYPE_FW_CFG ,OBJECT (dev),NULL ); +object_property_add_child (OBJECT (ebus),TYPE_FW_CFG ,OBJECT (dev));qdev_init_nofail (dev);memory_region_add_subregion (pci_address_space_io (ebus),BIOS_CFG_IOPORT , &FW_CFG_IO (dev)->comb_iomem);
hw/ssi/xilinx_spips.c +1 -2
@@ -1360,8 +1360,7 @@ static void xlnx_zynqmp_qspips_init(Object *obj)object_property_add_link (obj,"stream-connected-dma" ,TYPE_STREAM_SLAVE , (Object **)&rq->dma, object_property_allow_set_link, -OBJ_PROP_LINK_STRONG , -NULL ); +OBJ_PROP_LINK_STRONG );
Lines of this file are not shown. View the raw message.
qom/object.c +100 -202
302 lines not on this page · raw message
target/i386/cpu.c +41 -42
83 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.21.1
Part of the diff is not shown here. View the raw message.
PATCH 10/17 e1000: Don't run e1000_instance_init() twice
In reply to Markus ArmbrusterQOM object initialization runs .instance_init() for the type and all its supertypes; see object_init_with_type().
Both TYPE_E1000_BASE and its concrete subtypes set .instance_init() to e1000_instance_init(). For the concrete subtypes, it duly gets run twice. The second run fails, but the error gets ignored (a later commit will change that).
Remove it from the subtypes.
--- hw/net/e1000.c | 1 - 1 file changed, 1 deletion(-)
hw/net/e1000.c +0 -1
@@ -1824,7 +1824,6 @@ static void e1000_register_types(void) type_info.parent =TYPE_E1000_BASE ; type_info.class_data = (void *)info; type_info.class_init = e1000_class_init; - type_info.instance_init = e1000_instance_init;type_register (&type_info); }
Signature · 1 line
2.21.1
PATCH 14/17 Drop more @errp parameters after previous commit
In reply to Markus ArmbrusterSeveral functions can't fail anymore: ich9_pm_add_properties(), device_add_bootindex_property(), ppc_compat_add_property(), spapr_caps_add_properties(), PropertyInfo.create(). Drop their @errp parameter.
--- include/hw/acpi/ich9.h | 2 +- include/hw/ppc/spapr.h | 2 +- include/hw/qdev-core.h | 2 +- include/sysemu/sysemu.h | 2 +- target/ppc/cpu.h | 3 +-- bootdevice.c | 2 +- hw/acpi/ich9.c | 2 +- hw/block/fdc.c | 4 ++-- hw/block/nvme.c | 2 +- hw/block/vhost-user-blk.c | 2 +- hw/block/virtio-blk.c | 2 +- hw/core/qdev-properties.c | 2 +- hw/core/qdev.c | 2 +- hw/isa/lpc_ich9.c | 2 +- hw/net/e1000.c | 2 +- hw/net/e1000e.c | 2 +- hw/net/eepro100.c | 2 +- hw/net/lance.c | 2 +- hw/net/lasi_i82596.c | 2 +- hw/net/ne2000-pci.c | 2 +- hw/net/pcnet-pci.c | 2 +- hw/net/rtl8139.c | 2 +- hw/net/spapr_llan.c | 2 +- hw/net/sungem.c | 2 +- hw/net/sunhme.c | 2 +- hw/net/tulip.c | 2 +- hw/net/virtio-net.c | 2 +- hw/net/vmxnet3.c | 2 +- hw/ppc/spapr.c | 5 ++--- hw/ppc/spapr_caps.c | 2 +- hw/s390x/s390-ccw.c | 2 +- hw/scsi/scsi-bus.c | 2 +- hw/scsi/vhost-scsi.c | 2 +- hw/scsi/vhost-user-scsi.c | 2 +- hw/usb/dev-network.c | 2 +- hw/usb/host-libusb.c | 2 +- hw/usb/redirect.c | 2 +- hw/vfio/pci.c | 2 +- target/ppc/compat.c | 3 +-- 39 files changed, 41 insertions(+), 44 deletions(-)
include/hw/acpi/ich9.h +1 -1
@@ -72,7 +72,7 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,void ich9_pm_iospace_update (ICH9LPCPMRegs *pm,uint32_t pm_io_base);extern const VMStateDescription vmstate_ich9_pm; -void ich9_pm_add_properties (Object *obj,ICH9LPCPMRegs *pm,Error **errp); +void ich9_pm_add_properties (Object *obj,ICH9LPCPMRegs *pm);void ich9_pm_device_pre_plug_cb (HotplugHandler *hotplug_dev,DeviceState *dev,Error **errp);
include/hw/ppc/spapr.h +1 -1
@@ -915,7 +915,7 @@ static inline uint8_t spapr_get_cap(SpaprMachineState *spapr, int cap)void spapr_caps_init (SpaprMachineState *spapr);void spapr_caps_apply (SpaprMachineState *spapr);void spapr_caps_cpu_apply (SpaprMachineState *spapr,PowerPCCPU *cpu); -void spapr_caps_add_properties (SpaprMachineClass *smc,Error **errp); +void spapr_caps_add_properties (SpaprMachineClass *smc);int spapr_caps_post_migration (SpaprMachineState *spapr); void spapr_check_pagesize(SpaprMachineState *spapr, hwaddr pagesize,
include/hw/qdev-core.h +1 -1
@@ -274,7 +274,7 @@ struct PropertyInfo {const QEnumLookup *enum_table;int (*print)(DeviceState *dev,Property *prop,char *dest,size_t len);void (*set_default_value)(ObjectProperty *op,const Property *prop); -void (*create)(ObjectClass *oc,Property *prop,Error **errp); +void (*create)(ObjectClass *oc,Property *prop);ObjectPropertyAccessor *get;ObjectPropertyAccessor *set;ObjectPropertyRelease *release;
include/sysemu/sysemu.h +1 -1
@@ -92,7 +92,7 @@ void check_boot_index(int32_t bootindex, Error **errp);void del_boot_device_path (DeviceState *dev,const char *suffix);void device_add_bootindex_property (Object *obj,int32_t *bootindex,const char *name,const char *suffix, -DeviceState *dev,Error **errp); +DeviceState *dev);void restore_boot_order (void *opaque);void validate_bootdevices (const char *devices,Error **errp); void add_boot_device_lchs(DeviceState *dev, const char *suffix,
target/ppc/cpu.h +1 -2
@@ -1335,8 +1335,7 @@ void ppc_set_compat_all(uint32_t compat_pvr, Error **errp);#endif int ppc_compat_max_vthreads (PowerPCCPU *cpu);void ppc_compat_add_property (Object *obj,const char *name, -uint32_t *compat_pvr,const char *basedesc, -Error **errp); +uint32_t *compat_pvr,const char *basedesc);#endif /* defined(TARGET_PPC64) */ typedef CPUPPCState CPUArchState ;
bootdevice.c +1 -1
@@ -327,7 +327,7 @@ static void property_release_bootindex(Object *obj, const char *name,void device_add_bootindex_property (Object *obj,int32_t *bootindex,const char *name,const char *suffix, -DeviceState *dev,Error **errp) +DeviceState *dev) {BootIndexProperty *prop =g_malloc0 (sizeof (*prop));
hw/acpi/ich9.c +1 -1
@@ -369,7 +369,7 @@ static void ich9_pm_set_enable_tco(Object *obj, bool value, Error **errp) s->pm.enable_tco = value; } -void ich9_pm_add_properties (Object *obj,ICH9LPCPMRegs *pm,Error **errp) +void ich9_pm_add_properties (Object *obj,ICH9LPCPMRegs *pm) {static const uint32_t gpe0_len =ICH9_PMIO_GPE0_LEN ; pm->acpi_memory_hotplug.is_enabled = true;
hw/block/fdc.c +2 -2
@@ -2812,10 +2812,10 @@ static void isabus_fdc_instance_init(Object *obj)device_add_bootindex_property (obj, &isa->bootindexA,"bootindexA" ,"/floppy@0" , -DEVICE (obj),NULL ); +DEVICE (obj));device_add_bootindex_property (obj, &isa->bootindexB,"bootindexB" ,"/floppy@1" , -DEVICE (obj),NULL ); +DEVICE (obj)); }static const TypeInfo isa_fdc_info = {
hw/block/nvme.c +1 -1
@@ -1485,7 +1485,7 @@ static void nvme_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/namespace@1,0" , -DEVICE (obj), &error_abort); +DEVICE (obj)); }static const TypeInfo nvme_info = {
hw/block/vhost-user-blk.c +1 -1
@@ -477,7 +477,7 @@ static void vhost_user_blk_instance_init(Object *obj)VHostUserBlk *s =VHOST_USER_BLK (obj);device_add_bootindex_property (obj, &s->bootindex,"bootindex" , -"/disk@0,0" ,DEVICE (obj),NULL ); +"/disk@0,0" ,DEVICE (obj)); }static const VMStateDescription vmstate_vhost_user_blk = {
hw/block/virtio-blk.c +1 -1
@@ -1248,7 +1248,7 @@ static void virtio_blk_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.conf.bootindex,"bootindex" ,"/disk@0,0" , -DEVICE (obj),NULL ); +DEVICE (obj)); }static const VMStateDescription vmstate_virtio_blk = {
hw/core/qdev-properties.c +1 -1
@@ -1250,7 +1250,7 @@ const PropertyInfo qdev_prop_size = {/* --- object link property --- */ -static void create_link_property (ObjectClass *oc,Property *prop,Error **errp) +static void create_link_property (ObjectClass *oc,Property *prop) { object_class_property_add_link(oc, prop->name, prop->link_type, prop->offset,
hw/core/qdev.c +1 -1
@@ -781,7 +781,7 @@ static void qdev_class_add_property(DeviceClass *klass, Property *prop)ObjectClass *oc =OBJECT_CLASS (klass);if (prop->info->create) { - prop->info->create (oc, prop, &error_abort); + prop->info->create (oc, prop); }else {ObjectProperty *op;
hw/isa/lpc_ich9.c +1 -1
@@ -639,7 +639,7 @@ static void ich9_lpc_initfn(Object *obj)object_property_add_uint8_ptr (OBJECT (lpc),ACPI_PM_PROP_ACPI_DISABLE_CMD , &acpi_disable_cmd,OBJ_PROP_FLAG_READ ); -ich9_pm_add_properties (obj, &lpc->pm,NULL ); +ich9_pm_add_properties (obj, &lpc->pm); }static void ich9_lpc_realize (PCIDevice *d,Error **errp)
hw/net/e1000.c +1 -1
@@ -1774,7 +1774,7 @@ static void e1000_instance_init(Object *obj)E1000State *n =E1000 (obj);device_add_bootindex_property (obj, &n->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (n),NULL ); +DEVICE (n)); }static const TypeInfo e1000_base_info = {
hw/net/e1000e.c +1 -1
@@ -705,7 +705,7 @@ static void e1000e_instance_init(Object *obj)E1000EState *s =E1000E (obj);device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (obj),NULL ); +DEVICE (obj)); }static const TypeInfo e1000e_info = {
hw/net/eepro100.c +1 -1
@@ -1883,7 +1883,7 @@ static void eepro100_instance_init(Object *obj)EEPRO100State *s =DO_UPCAST (EEPRO100State, dev,PCI_DEVICE (obj));device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (s),NULL ); +DEVICE (s)); }static E100PCIDeviceInfo e100_devices[] = {
hw/net/lance.c +1 -1
@@ -134,7 +134,7 @@ static void lance_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (obj),NULL ); +DEVICE (obj)); }static Property lance_properties[] = {
hw/net/lasi_i82596.c +1 -1
@@ -152,7 +152,7 @@ static void lasi_82596_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (obj),NULL ); +DEVICE (obj)); }static Property lasi_82596_properties[] = {
hw/net/ne2000-pci.c +1 -1
@@ -92,7 +92,7 @@ static void ne2000_instance_init(Object *obj)device_add_bootindex_property (obj, &s->c.bootindex,"bootindex" ,"/ethernet-phy@0" , - &pci_dev->qdev,NULL ); + &pci_dev->qdev); }static Property ne2000_properties[] = {
hw/net/pcnet-pci.c +1 -1
@@ -250,7 +250,7 @@ static void pcnet_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (obj),NULL ); +DEVICE (obj)); }static Property pcnet_properties[] = {
hw/net/rtl8139.c +1 -1
@@ -3415,7 +3415,7 @@ static void rtl8139_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (obj),NULL ); +DEVICE (obj)); }static Property rtl8139_properties[] = {
hw/net/spapr_llan.c +1 -1
@@ -340,7 +340,7 @@ static void spapr_vlan_instance_init(Object *obj)device_add_bootindex_property (obj, &dev->nicconf.bootindex,"bootindex" ,"" , -DEVICE (dev),NULL ); +DEVICE (dev));if (dev->compat_flags &SPAPRVLAN_FLAG_RX_BUF_POOLS ) {for (i =0 ; i <RX_MAX_POOLS ; i++) {
hw/net/sungem.c +1 -1
@@ -1378,7 +1378,7 @@ static void sungem_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (obj),NULL ); +DEVICE (obj)); }static Property sungem_properties[] = {
hw/net/sunhme.c +1 -1
@@ -901,7 +901,7 @@ static void sunhme_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (obj),NULL ); +DEVICE (obj)); }static void sunhme_reset (DeviceState *ds)
hw/net/tulip.c +1 -1
@@ -1001,7 +1001,7 @@ static void tulip_instance_init(Object *obj)device_add_bootindex_property (obj, &d->c.bootindex,"bootindex" ,"/ethernet-phy@0" , - &pci_dev->qdev,NULL ); + &pci_dev->qdev); }static Property tulip_properties[] = {
hw/net/virtio-net.c +1 -1
@@ -3122,7 +3122,7 @@ static void virtio_net_instance_init(Object *obj) n->config_size =sizeof (struct virtio_net_config );device_add_bootindex_property (obj, &n->nic_conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (n),NULL ); +DEVICE (n)); }static int virtio_net_pre_save (void *opaque)
hw/net/vmxnet3.c +1 -1
@@ -2237,7 +2237,7 @@ static void vmxnet3_instance_init(Object *obj)VMXNET3State *s =VMXNET3 (obj);device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (obj),NULL ); +DEVICE (obj)); }static void vmxnet3_pci_uninit (PCIDevice *pci_dev)
hw/ppc/spapr.c +2 -3
@@ -3326,8 +3326,7 @@ static void spapr_instance_init(Object *obj)" place of standard EPOW events when possible" " (required for memory hot-unplug support)");ppc_compat_add_property (obj,"max-cpu-compat" , &spapr->max_compat_pvr, -"Maximum permitted CPU compatibility mode" , - &error_fatal); +"Maximum permitted CPU compatibility mode" );object_property_add_str (obj,"resize-hpt" , spapr_get_resize_hpt, spapr_set_resize_hpt);
@@ -4532,7 +4531,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) smc->default_caps.caps[SPAPR_CAP_LARGE_DECREMENTER ] =SPAPR_CAP_ON ; smc->default_caps.caps[SPAPR_CAP_CCF_ASSIST ] =SPAPR_CAP_ON ; smc->default_caps.caps[SPAPR_CAP_FWNMI ] =SPAPR_CAP_ON ; -spapr_caps_add_properties (smc, &error_abort); +spapr_caps_add_properties (smc); smc->irq = &spapr_irq_dual; smc->dr_phb_enabled = true; smc->linux_pci_probe = true;
hw/ppc/spapr_caps.c +1 -1
@@ -824,7 +824,7 @@ void spapr_caps_cpu_apply(SpaprMachineState *spapr, PowerPCCPU *cpu) } } -void spapr_caps_add_properties (SpaprMachineClass *smc,Error **errp) +void spapr_caps_add_properties (SpaprMachineClass *smc) {ObjectClass *klass =OBJECT_CLASS (smc);int i;
hw/s390x/s390-ccw.c +1 -1
@@ -151,7 +151,7 @@ static void s390_ccw_instance_init(Object *obj)S390CCWDevice *dev =S390_CCW_DEVICE (obj);device_add_bootindex_property (obj, &dev->bootindex,"bootindex" , -"/disk@0,0" ,DEVICE (obj),NULL ); +"/disk@0,0" ,DEVICE (obj)); }static void s390_ccw_class_init (ObjectClass *klass,void *data)
hw/scsi/scsi-bus.c +1 -1
@@ -1738,7 +1738,7 @@ static void scsi_dev_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,NULL , - &s->qdev,NULL ); + &s->qdev); }static const TypeInfo scsi_device_type_info = {
hw/scsi/vhost-scsi.c +1 -1
@@ -311,7 +311,7 @@ static void vhost_scsi_instance_init(Object *obj) vsc->feature_bits = kernel_feature_bits;device_add_bootindex_property (obj, &vsc->bootindex,"bootindex" ,NULL , -DEVICE (vsc),NULL ); +DEVICE (vsc)); }static const TypeInfo vhost_scsi_info = {
hw/scsi/vhost-user-scsi.c +1 -1
@@ -217,7 +217,7 @@ static void vhost_user_scsi_instance_init(Object *obj)/* Add the bootindex property for this object */ device_add_bootindex_property (obj, &vsc->bootindex,"bootindex" ,NULL , -DEVICE (vsc),NULL ); +DEVICE (vsc)); }static const TypeInfo vhost_user_scsi_info = {
hw/usb/dev-network.c +1 -1
@@ -1381,7 +1381,7 @@ static void usb_net_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , - &dev->qdev,NULL ); + &dev->qdev); }static const VMStateDescription vmstate_usb_net = {
hw/usb/host-libusb.c +1 -1
@@ -1101,7 +1101,7 @@ static void usb_host_instance_init(Object *obj)device_add_bootindex_property (obj, &s->bootindex,"bootindex" ,NULL , - &udev->qdev,NULL ); + &udev->qdev); }static void usb_host_unrealize (USBDevice *udev,Error **errp)
hw/usb/redirect.c +1 -1
@@ -2595,7 +2595,7 @@ static void usbredir_instance_init(Object *obj)device_add_bootindex_property (obj, &dev->bootindex,"bootindex" ,NULL , - &udev->qdev,NULL ); + &udev->qdev); }static const TypeInfo usbredir_dev_info = {
hw/vfio/pci.c +1 -1
@@ -3133,7 +3133,7 @@ static void vfio_instance_init(Object *obj)device_add_bootindex_property (obj, &vdev->bootindex,"bootindex" ,NULL , - &pci_dev->qdev,NULL ); + &pci_dev->qdev); vdev->host.domain = ~0U ; vdev->host.bus = ~0U ; vdev->host.slot = ~0U ;
target/ppc/compat.c +1 -2
@@ -298,8 +298,7 @@ out: }void ppc_compat_add_property (Object *obj,const char *name, -uint32_t *compat_pvr,const char *basedesc, -Error **errp) +uint32_t *compat_pvr,const char *basedesc) {gchar *namesv[ARRAY_SIZE (compat_table) +1 ];gchar *names, *desc;
Signature · 1 line
2.21.1
PATCH 16/17 spapr_pci: Drop some dead error handling
In reply to Markus Armbrusterchassis_from_bus() uses object_property_get_uint() to get property "chassis_nr" of the bridge device. Failure would be a programming error. Pass &error_abort, and simplify its callers.
--- hw/ppc/spapr_pci.c | 86 ++++++++++------------------------------------ 1 file changed, 18 insertions(+), 68 deletions(-)
hw/ppc/spapr_pci.c +18 -68
@@ -1203,46 +1203,36 @@ static SpaprDrc *drc_from_devfn(SpaprPhbState *phb, drc_id_from_devfn(phb, chassis, devfn)); } -static uint8_t chassis_from_bus (PCIBus *bus,Error **errp) +static uint8_t chassis_from_bus (PCIBus *bus) {if (pci_bus_is_root (bus)) {return 0 ; }else {PCIDevice *bridge =pci_bridge_get_device (bus); -return object_property_get_uint (OBJECT (bridge),"chassis_nr" , errp); +return object_property_get_uint (OBJECT (bridge),"chassis_nr" , + &error_abort); } }static SpaprDrc *drc_from_dev (SpaprPhbState *phb,PCIDevice *dev) { -Error *local_err =NULL ; -uint8_t chassis =chassis_from_bus (pci_get_bus (dev), &local_err); - -if (local_err) { -error_report_err (local_err); -return NULL ; - } +uint8_t chassis =chassis_from_bus (pci_get_bus (dev));return drc_from_devfn (phb, chassis, dev->devfn); } -static void add_drcs (SpaprPhbState *phb,PCIBus *bus,Error **errp) +static void add_drcs (SpaprPhbState *phb,PCIBus *bus) {Object *owner;int i;uint8_t chassis; -Error *local_err =NULL ;if (!phb->dr_enabled) {return ; } - chassis =chassis_from_bus (bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } + chassis =chassis_from_bus (bus);if (pci_bus_is_root (bus)) { owner =OBJECT (phb);
@@ -1256,21 +1246,16 @@ static void add_drcs(SpaprPhbState *phb, PCIBus *bus, Error **errp) } } -static void remove_drcs (SpaprPhbState *phb,PCIBus *bus,Error **errp) +static void remove_drcs (SpaprPhbState *phb,PCIBus *bus) {int i;uint8_t chassis; -Error *local_err =NULL ;if (!phb->dr_enabled) {return ; } - chassis =chassis_from_bus (bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } + chassis =chassis_from_bus (bus);for (i =PCI_SLOT_MAX *PCI_FUNC_MAX -1 ; i >=0 ; i--) {SpaprDrc *drc =drc_from_devfn (phb, chassis, i);
@@ -1488,17 +1473,11 @@ int spapr_pci_dt_populate(SpaprDrc *drc, SpaprMachineState *spapr, }static void spapr_pci_bridge_plug (SpaprPhbState *phb, -PCIBridge *bridge, -Error **errp) +PCIBridge *bridge) { -Error *local_err =NULL ;PCIBus *bus =pci_bridge_get_sec_bus (bridge); -add_drcs (phb, bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } +add_drcs (phb, bus); } static void spapr_pci_plug(HotplugHandler *plug_handler,
@@ -1529,11 +1508,7 @@ static void spapr_pci_plug(HotplugHandler *plug_handler,g_assert (drc);if (pc->is_bridge) { -spapr_pci_bridge_plug (phb,PCI_BRIDGE (plugged_dev), &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } +spapr_pci_bridge_plug (phb,PCI_BRIDGE (plugged_dev)); }/* Following the QEMU convention used for PCIe multifunction
@@ -1560,12 +1535,7 @@ static void spapr_pci_plug(HotplugHandler *plug_handler,spapr_drc_reset (drc); }else if (PCI_FUNC (pdev->devfn) ==0 ) {int i; -uint8_t chassis =chassis_from_bus (pci_get_bus (pdev), &local_err); - -if (local_err) { -error_propagate (errp, local_err); -return ; - } +uint8_t chassis =chassis_from_bus (pci_get_bus (pdev));for (i =0 ; i <8 ; i++) {SpaprDrc *func_drc;
@@ -1587,17 +1557,11 @@ out: }static void spapr_pci_bridge_unplug (SpaprPhbState *phb, -PCIBridge *bridge, -Error **errp) +PCIBridge *bridge) { -Error *local_err =NULL ;PCIBus *bus =pci_bridge_get_sec_bus (bridge); -remove_drcs (phb, bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } +remove_drcs (phb, bus); } static void spapr_pci_unplug(HotplugHandler *plug_handler,
@@ -1619,11 +1583,7 @@ static void spapr_pci_unplug(HotplugHandler *plug_handler,pci_device_reset (PCI_DEVICE (plugged_dev));if (pc->is_bridge) { -Error *local_err =NULL ; -spapr_pci_bridge_unplug (phb,PCI_BRIDGE (plugged_dev), &local_err); -if (local_err) { -error_propagate (errp, local_err); - } +spapr_pci_bridge_unplug (phb,PCI_BRIDGE (plugged_dev));return ; }
@@ -1654,13 +1614,7 @@ static void spapr_pci_unplug_request(HotplugHandler *plug_handler,SpaprDrcClass *func_drck;SpaprDREntitySense state;int i; -Error *local_err =NULL ; -uint8_t chassis =chassis_from_bus (pci_get_bus (pdev), &local_err); - -if (local_err) { -error_propagate (errp, local_err); -return ; - } +uint8_t chassis =chassis_from_bus (pci_get_bus (pdev));if (pc->is_bridge) {error_setg (errp,"PCI: Hot unplug of PCI bridges not supported" );
@@ -1741,7 +1695,7 @@ static void spapr_phb_unrealize(DeviceState *dev) } } -remove_drcs (sphb, phb->bus, &error_abort); +remove_drcs (sphb, phb->bus);for (i =PCI_NUM_PINS -1 ; i >=0 ; i--) {if (sphb->lsi_table[i].irq) {
@@ -1980,11 +1934,7 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp) }/* allocate connectors for child PCI devices */ -add_drcs (sphb, phb->bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); - goto unrealize; - } +add_drcs (sphb, phb->bus);/* DMA setup */ for (i =0 ; i < windows_supported; ++i) {
Signature · 1 line
2.21.1
PATCH 17/17 qom: Drop @errp parameter of object_property_del()
In reply to Markus ArmbrusterSame story as for object_property_add(): the only way object_property_del() can fail is when the property with this name does not exist. Since our property names are all hardcoded, failure is a programming error, and the appropriate way to handle it is passing &error_abort. Most callers do that, the commit before previous fixed one that didn't (and got the error handling wrong), and the two remaining exceptions ignore errors.
Drop the @errp parameter and assert the precondition instead.
--- include/qom/object.h | 2 +- hw/core/qdev.c | 2 +- hw/i386/pc_sysfw.c | 2 +- hw/ppc/spapr_drc.c | 4 ++-- qom/object.c | 7 +------ qom/object_interfaces.c | 3 +-- tests/check-qom-proplist.c | 2 +- 7 files changed, 8 insertions(+), 14 deletions(-)
include/qom/object.h +1 -1
@@ -1047,7 +1047,7 @@ ObjectProperty *object_property_add(Object *obj, const char *name, ObjectPropertyRelease *release, void *opaque); -void object_property_del (Object *obj,const char *name,Error **errp); +void object_property_del (Object *obj,const char *name); ObjectProperty *object_class_property_add(ObjectClass *klass, const char *name, const char *type,
hw/core/qdev.c +1 -1
@@ -64,7 +64,7 @@ static void bus_remove_child(BusState *bus, DeviceState *child) bus->num_children--;/* This gives back ownership of kid->child back to us. */ -object_property_del (OBJECT (bus), name,NULL ); +object_property_del (OBJECT (bus), name);object_unref (OBJECT (kid->child));g_free (kid);return ;
hw/i386/pc_sysfw.c +1 -1
@@ -120,7 +120,7 @@ static void pc_system_flash_cleanup_unused(PCMachineState *pcms) dev_obj =OBJECT (pcms->flash[i]);if (!object_property_get_bool (dev_obj,"realized" , &error_abort)) { prop_name =g_strdup_printf ("pflash%d" , i); -object_property_del (OBJECT (pcms), prop_name, &error_abort); +object_property_del (OBJECT (pcms), prop_name);g_free (prop_name);object_unparent (dev_obj); pcms->flash[i] =NULL ;
hw/ppc/spapr_drc.c +2 -2
@@ -405,7 +405,7 @@ static void spapr_drc_release(SpaprDrc *drc)g_free (drc->fdt); drc->fdt =NULL ; drc->fdt_start_offset =0 ; -object_property_del (OBJECT (drc),"device" , &error_abort); +object_property_del (OBJECT (drc),"device" ); drc->dev =NULL ; }
@@ -551,7 +551,7 @@ static void unrealize(DeviceState *d)vmstate_unregister (VMSTATE_IF (drc), &vmstate_spapr_drc, drc); root_container =container_get (object_get_root (),DRC_CONTAINER_PATH ); name =g_strdup_printf ("%x" ,spapr_drc_index (drc)); -object_property_del (root_container, name, &error_abort); +object_property_del (root_container, name);g_free (name); }
qom/object.c +1 -6
@@ -1280,15 +1280,10 @@ ObjectProperty *object_class_property_find(ObjectClass *klass, const char *name,return prop; } -void object_property_del (Object *obj,const char *name,Error **errp) +void object_property_del (Object *obj,const char *name) {ObjectProperty *prop =g_hash_table_lookup (obj->properties, name); -if (!prop) { -error_setg (errp,"Property '.%s' not found" , name); -return ; - } -if (prop->release) { prop->release (obj, name, prop->opaque); }
qom/object_interfaces.c +1 -2
@@ -88,8 +88,7 @@ Object *user_creatable_add_type(const char *type, const char *id,user_creatable_complete (USER_CREATABLE (obj), &local_err);if (local_err) {if (id !=NULL ) { -object_property_del (object_get_objects_root (), - id, &error_abort); +object_property_del (object_get_objects_root (), id); } goto out; }
tests/check-qom-proplist.c +1 -1
@@ -280,7 +280,7 @@ static void dummy_bus_init(Object *obj)static void dummy_bus_unparent (Object *obj) {DummyBus *bus =DUMMY_BUS (obj); -object_property_del (obj->parent,"backend" ,NULL ); +object_property_del (obj->parent,"backend" );object_unparent (OBJECT (bus->backend)); }
Signature · 1 line
2.21.1
Re: [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes,eaes}-256
In reply to Markus ArmbrusterQuoted 26 lines · Markus Armbruster
Both s390_features[S390_FEAT_PCC_CMAC_AES_256].name and s390_features[S390_FEAT_PCC_CMAC_EAES_256].name is "pcc-cmac-eaes-256". The former is obviously a pasto.
Impact:
*
s390_feat_bitmap_to_ascii()misidentifiesS390_FEAT_PCC_CMAC_AES_256as "pcc-cmac-eaes-256". Affects QMP commands query-cpu-definitions, query-cpu-model-expansion, query-cpu-model-baseline, query-cpu-model-comparison, and the error message whens390_realize_cpu_model()fails incheck_compatibility().*
s390_realize_cpu_model()misidentifies it incheck_consistency()warnings.*
s390_cpu_list()likewise. Affects -cpu help.*
s390_cpu_model_register_props()creates CPU property "pcc-cmac-eaes-256" twice. The second one fails, but the error is ignored (a later commit will change that). Results in a single property "pcc-cmac-eaes-256" with the description forS390_FEAT_PCC_CMAC_AES_256, and no property forS390_FEAT_PCC_CMAC_EAES_256. CPU properties are visible in CLI -cpu and -device, QMP & HMPdevice_add, QMP device-list-properties, and QOM introspection.
Quoted 1 line
Fix by deleting the wayward 'e'.
Very nice catch - thanks!
While this sounds very bad, it's luckily not that bad in practice (currently).
The feature (or rather, both features) is part of the feature group "msa4". As long as we have all sub-features part of that group (which is usually the case), we will always indicate "msa4" to the user, instead of all the separate sub-features. So, expansion, baseline, comparison will usually only work with "msa4".
(in addition, current KVM is not capable of actually masking off these sub-features, so it will still, always see the feature, even if not explicitly specified via "-cpu X,pcc-cmac-aes-256=on)
I think we should do stable backports.
Quoted 27 lines
Fixes 782417446279717aa85320191a519b51f6d5dd31Cc Halil Pasic <[email protected]>Cc Cornelia Huck <[email protected]>Cc Christian Borntraeger <[email protected]>Cc Richard Henderson <[email protected]>Cc David Hildenbrand <[email protected]>Signed-off-by Markus Armbruster <[email protected]>--- target/s390x/cpu_features_def.inc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/s390x/cpu_features_def.inc.h +1
-1@@ -310,7 +310,7 @@ DEF_FEAT(PCC_CMAC_ETDEA_192, "pcc-cmac-etdea-128", PCC, 10, "PCC Compute-Last-Bl DEF_FEAT(PCC_CMAC_TDEA, "pcc-cmac-etdea-192", PCC, 11, "PCC Compute-Last-Block-CMAC-Using-EncryptedTDEA-192") DEF_FEAT(PCC_CMAC_AES_128, "pcc-cmac-aes-128", PCC, 18, "PCC Compute-Last-Block-CMAC-Using-AES-128") DEF_FEAT(PCC_CMAC_AES_192, "pcc-cmac-aes-192", PCC, 19, "PCC Compute-Last-Block-CMAC-Using-AES-192") -DEF_FEAT(PCC_CMAC_AES_256, "pcc-cmac-eaes-256", PCC, 20, "PCC Compute-Last-Block-CMAC-Using-AES-256") +DEF_FEAT(PCC_CMAC_AES_256, "pcc-cmac-aes-256", PCC, 20, "PCC Compute-Last-Block-CMAC-Using-AES-256") DEF_FEAT(PCC_CMAC_EAES_128, "pcc-cmac-eaes-128", PCC, 26, "PCC Compute-Last-Block-CMAC-Using-Encrypted-AES-128") DEF_FEAT(PCC_CMAC_EAES_192, "pcc-cmac-eaes-192", PCC, 27, "PCC Compute-Last-Block-CMAC-Using-Encrypted-AES-192")DEF_FEAT (PCC_CMAC_EAES_256 ,"pcc-cmac-eaes-256" ,PCC ,28 ,"PCC Compute-Last-Block-CMAC-Using-Encrypted-AES-256" )
Signature · 3 lines
Thanks, David / dhildenb
Re: [PATCH 11/17] hw/arm/bcm2835: Drop futile attempts at QOM-adopting memory
In reply to Markus ArmbrusterQuoted 23 lines · Markus Armbruster
The "bcm2835-peripherals" device's .instance_init() method
bcm2835_peripherals_init()attempts to make two memory regions QOM children of the device. This is futile, becausememory_region_init()already did. The errors are ignored (a later commit will change that). Drop the useless calls.Cc Peter Maydell <[email protected]>Cc Andrew Baumann <[email protected]>Cc "Philippe Mathieu-Daudé" <[email protected]>Signed-off-by Markus Armbruster <[email protected]>--- hw/arm/bcm2835_peripherals.c | 2 -- 1 file changed, 2 deletions(-)hw/arm/bcm2835_peripherals.c +0
-0@@ -43,12 +43,10 @@ static void bcm2835_peripherals_init(Object *obj)/* Memory region for peripheral devices, which we export to our parent */
hw/arm/bcm2835_peripherals.c static void bcm2835_peripherals_init(Object *obj) · line 52
Quoted 10 lines
hw/arm/bcm2835_peripherals.c +0
-2memory_region_init (&s->peri_mr, obj,"bcm2835-peripherals" ,0x1000000 ); -object_property_add_child (obj,"peripheral-io" ,OBJECT (&s->peri_mr),NULL );sysbus_init_mmio (SYS_BUS_DEVICE (s), &s->peri_mr);/* Internal memory region for peripheral bus addresses (not exported) */ memory_region_init (&s->gpu_bus_mr, obj,"bcm2835-gpu" , (uint64_t )1 <<32 ); -object_property_add_child (obj,"gpu-bus" ,OBJECT (&s->gpu_bus_mr),NULL );/* Internal memory region for request/response communication with * mailbox-addressable peripherals (not exported)
Re: [PATCH 01/17] qom: Clearer reference counting in object_initialize_childv()
In reply to Markus ArmbrusterQuoted 14 lines · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>--- qom/object.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)qom/object.c +1
-0@@ -571,18 +571,18 @@ void object_initialize_childv(Object *parentobj, const char *propname, } } +out:
qom/object.c void object_initialize_childv(Object *parentobj, const char *propname, · line 581
Quoted 10 lines
qom/object.c +6
-3/* -* Since object_property_add_child added a reference to the child object, -* we can drop the reference added by object_initialize(), so the child -* property will own the only reference to the object. +* We want @obj's reference to be 1 on success, 0 on failure. +* On success, it's 2: one taken by object_initialize(), and one +* by object_property_add_child(). +* On failure in object_initialize() or earlier, it's 1. +* On failure afterwards, it's also 1: object_unparent() releases +* the reference taken by object_property_add_child().
Useful comment.
qom/object.c void object_initialize_childv(Object *parentobj, const char *propname, · line 585
Quoted 9 lines
qom/object.c +1
-5*/ object_unref (obj); -out: -if (local_err) { -error_propagate (errp, local_err); -object_unref (obj); - } +error_propagate (errp, local_err);
But looking at just the code (even without comments), this is safe - pre-patch, the only way to get to the out: label without a 'goto' is on the success path, at which point we can deduce that object_unref() is called exactly once whether on the success path or on the local_err path, at which point moving the label up and making the object_unref() unconditional is the same semantics. With that hoisted, error_propagate is the only thing remaining under an 'if (local_err)' guard, and it is safe to call that when there is no error. No semantic change, at which point all that remains to review is the accuracy of the comment.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH 02/17] qom: Clean up inconsistent use of gchar * vs. char *
In reply to Markus ArmbrusterQuoted 2 lines · Markus Armbruster
Uses of gchar * in
qom/object.h:
Nice audit. I don't know if we can blindly assume that 'gchar' is a (stupid) typedef to 'char', or if they can ever differ, but avoiding gchar where possible always makes sense to me.
Quoted 3 lines
Signed-off-by Markus Armbruster <[email protected]>---
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH 03/17] qom: Drop object_property_del_child()'s unused parameter @errp
In reply to Markus ArmbrusterQuoted 4 lines · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>--- qom/object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 24 lines
qom/object.c +2
-2@@ -614,7 +614,7 @@ static void object_property_del_all(Object *obj)g_hash_table_unref (obj->properties); } -static void object_property_del_child (Object *obj,Object *child,Error **errp) +static void object_property_del_child (Object *obj,Object *child) {ObjectProperty *prop;GHashTableIter iter;@@ -644,7 +644,7 @@ static void object_property_del_child(Object *obj, Object *child, Error **errp)void object_unparent (Object *obj) {if (obj->parent) { -object_property_del_child (obj->parent, obj,NULL ); +object_property_del_child (obj->parent, obj); } }
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH 05/17] qom: Make all the object_property_add_FOO() return the property
In reply to Markus ArmbrusterQuoted 14 lines · Markus Armbruster
Some
object_property_add_FOO()return the newly added property, some don't. Clean that up.Signed-off-by Markus Armbruster <[email protected]>--- include/qom/object.h | 50 ++++++--- qom/object.c | 250 ++++++++++++++++++++++--------------------- 2 files changed, 164 insertions(+), 136 deletions(-)+++
b/qom/object.cqom/object.c +0
-0@@ -1679,33 +1679,30 @@ static void object_finalize_child_property(Object *obj, const char *name,object_unref (child); }
qom/object.c static void object_finalize_child_property(Object *obj, const char *name, · line 1686
Quoted 10 lines
qom/object.c +4
-4-void object_property_add_child (Object *obj,const char *name, -Object *child,Error **errp) +ObjectProperty * +object_property_add_child (Object *obj,const char *name, +Object *child,Error **errp) { -Error *local_err =NULL ; -char *type; + g_autofree char *type = NULL;
I love how g_autofree simplifies things.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH 04/17] qom: Change object_property_get_uint16List() to match its doc
In reply to Markus Armbrusterinclude/qom/object.h int object_property_get_enum(Object *obj, const char *name,
Quoted 12 lines · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>--- include/qom/object.h | 4 ++-- hw/core/machine-qmp-cmds.c | 6 +++--- qom/object.c | 9 +++++---- 3 files changed, 10 insertions(+), 9 deletions(-)include/qom/object.h +0
-0@@ -1331,8 +1331,8 @@ int object_property_get_enum(Object *obj, const char *name,
Adding context:
/**
* object_property_get_uint16List:
* @obj: the object
* @name: the name of the property
* @list: the returned int list
* @errp: returns an error if this function fails
*
* Returns: the value of the property, converted to integers, or
include/qom/object.h int object_property_get_enum(Object *obj, const char *name, · line 1335
Quoted 7 lines
include/qom/object.h +2
-2* undefined if an error occurs (including when the property value is not * an list of integers). */ -void object_property_get_uint16List (Object *obj,const char *name, -uint16List **list,Error **errp); +uint16List *object_property_get_uint16List (Object *obj,const char *name, +Error **errp);
Incomplete. The doc comments need to drop the @list line, as well as s/undefined/#NULL/ in the Returns line.
With that fixed,
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH 06/17] qom: Drop object_property_set_description() parameter @errp
In reply to Markus ArmbrusterQuoted 4 lines · Markus Armbruster
object_property_set_description()andobject_class_property_set_description()fail only when property @name is not found.
Quoted 8 lines
There are 85 calls of
object_property_set_description()andobject_class_property_set_description(). None of them can fail:* 84 immediately follow the creation of the property.
* The one in
spapr_rng_instance_init()refers to a property created inspapr_rng_class_init(), from spapr_rng_properties[].
I don't envy how you counted those. But on sheer numbers, this patch has to be at least 85 changed lines in length...
Quoted 13 lines
Every one of them still gets to decide what to pass for @errp.
51 calls pass
&error_abort, 32 calls pass NULL, one receives the error and propagates it to&error_abort, and one propagates it to&error_fatal. I'm actually surprised none of them violates the Error API.What are we gaining by letting callers handle the "property not found" error? Use when the property is not known to exist is simpler: you don't have to guard the call with a check. We haven't found such a use in 5+ years. Until we do, let's make life a bit simpler and drop the @errp parameter.
Quoted 4 lines
Signed-off-by Markus Armbruster <[email protected]>---
30 files changed, 91 insertions(+), 143 deletions(-)
...which it is. And the compiler would choke if you missed anything. The bulk of this is mechanical, with no way to split it smaller.
After hunting, I found the core of the patch:
Quoted 31 lines
+++
b/qom/object.cqom/object.c +3
-10@@ -2835,38 +2835,27 @@ object_property_add_alias(Object *obj, const char *name, }object_property_set_description (obj, op->name, - target_prop->description, - &error_abort); + target_prop->description);return op; }void object_property_set_description (Object *obj,const char *name, -const char *description,Error **errp) +const char *description) {ObjectProperty *op; - op =object_property_find (obj, name, errp); -if (!op) { -return ; - } - + op =object_property_find (obj, name, &error_abort);g_free (op->description); op->description =g_strdup (description); } void object_class_property_set_description(ObjectClass *klass, const char *name, -const char *description, -Error **errp)
qom/object.c object_property_add_alias(Object *obj, const char *name, · line 2869
Quoted 10 lines
qom/object.c +1
-5+ const char *description) {ObjectProperty *op; op =g_hash_table_lookup (klass->properties, name); -if (!op) { -error_setg (errp,"Property '.%s' not found" , name); -return ; - } -
and it is sensible.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH 07/17] tests/check-qom-proplist: Improve iterator coverage
In reply to Markus ArmbrusterQuoted 10 lines · Markus Armbruster
The tests' "qemu-dummy" device has only class properties. Turn one of them into an instance property.
test_dummy_class_iterator()expects one fewer property thantest_dummy_iterator(). Rewritetest_dummy_prop_iterator()to take expected properties as argument.Signed-off-by Markus Armbruster <[email protected]>--- tests/check-qom-proplist.c | 51 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 25 deletions(-)
Nice way to enhance coverage. (I wish we could get rid of instance properties, but as long as we still have them, testing them is good).
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH 13/17] qom: Drop parameter @errp of object_property_add() & friends
In reply to Markus ArmbrusterQuoted 28 lines · Markus Armbruster
The only way
object_property_add()can fail is when a property with the same name already exists. Since our property names are all hardcoded, failure is a programming error, and the appropriate way to handle it is passing&error_abort.Same for its variants, except for
object_property_add_child(), which additionally fails when the child already has a parent. Parentage is also under program control, so this is a programming error, too.We have a bit over 500 callers. Almost half of them pass
&error_abort, slightly fewer ignore errors, one test case handles errors, and the remaining few callers pass them to their own callers.The previous few commits demonstrated once again that ignoring programming errors is a bad idea.
Of the few ones that pass on errors, several violate the Error API. The Error ** argument must be NULL,
&error_abort,&error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second call.ich9_pm_add_properties(),sparc32_ledma_realize(),sparc32_dma_realize(),xilinx_axidma_realize(),xilinx_enet_realize()are wrong that way.When the one appropriate choice of argument is
&error_abort, letting users pick the argument is a bad idea.
Quoted 7 lines
Drop parameter @errp and assert the preconditions instead.
There's one exception to "duplicate property name is a programming error": the way
object_property_add()implements the magic (and undocumented) "automatic arrayification". Don't drop @errp there. Instead, renameobject_property_add()toobject_property_try_add(), and add the obvious wrapperobject_property_add().
Huge. Could this last paragraph be done as a separate patch (ie. introduce object_property_try_add and adjust its clients), prior to the bulk mechanical patch that deletes the errp argument for all remaining instances?
Quoted 8 lines
Signed-off-by Markus Armbruster <[email protected]>--- include/qom/object.h | 81 +++-----qom/container.c | 2 +- qom/object.c | 302 +++++++++------------------- qom/object_interfaces.c | 5 +-
The core of the patch lies in these files, but even then it is still large because of adding a new API at the same time as fixing an existing one.
Quoted 25 lines
190 files changed, 643 insertions(+), 987 deletions(-)+++
b/qom/object.cqom/object.c +6
-6@@ -1129,12 +1123,12 @@ void object_unref(Object *obj) } } -ObjectProperty * -object_property_add (Object *obj,const char *name,const char *type, -ObjectPropertyAccessor *get, -ObjectPropertyAccessor *set, -ObjectPropertyRelease *release, -void *opaque,Error **errp) +static ObjectProperty * +object_property_try_add (Object *obj,const char *name,const char *type, +ObjectPropertyAccessor *get, +ObjectPropertyAccessor *set, +ObjectPropertyRelease *release, +void *opaque,Error **errp) {ObjectProperty *prop;size_t name_len =strlen (name);
qom/object.c object_property_add(Object *obj, const char *name, const char *type, · line 1147
Quoted 8 lines
qom/object.c +2
-2@@ -1148,8 +1142,8 @@ object_property_add(Object *obj, const char *name, const char *type,for (i =0 ; ; ++i) {char *full_name =g_strdup_printf ("%s[%d]" , name_no_array, i); - ret =object_property_add (obj, full_name, type, get, set, - release, opaque,NULL ); + ret =object_property_try_add (obj, full_name, type, get, set, + release, opaque,NULL );g_free (full_name);
Here's the magic in the last paragraph.
Quoted 7 lines
qom/object.c +1
-0if (ret) {break ;@@ -1179,6 +1173,17 @@ object_property_add(Object *obj, const char *name, const char *type,return prop; } +ObjectProperty *
qom/object.c object_property_add(Object *obj, const char *name, const char *type, · line 1186
Quoted 10 lines
qom/object.c +10
-0+object_property_add(Object *obj, const char *name, const char *type, + ObjectPropertyAccessor *get, + ObjectPropertyAccessor *set, + ObjectPropertyRelease *release, + void *opaque) +{ +return object_property_try_add (obj, name, type, get, set, release, + opaque, &error_abort); +} +
and if you were to split things into two patches, the first patch would be adding:
ObjectProperty *
object_property_add(Object *obj, const char *name, const char *type,
ObjectPropertyAccessor *get, ObjectPropertyAccessor *set, ObjectPropertyRelease *release,
void *opaque, Error **errp)
{
return object_property_try_add(obj, name, type, get, set, release,
opaque, errp);
}
with the second changing the signature to drop errp and forward &error_abort.
Quoted 9 lines
qom/object.c +0
-2ObjectProperty * object_class_property_add(ObjectClass *klass, const char *name,@@ -1186,16 +1191,11 @@ object_class_property_add(ObjectClass *klass, ObjectPropertyAccessor *get, ObjectPropertyAccessor *set, ObjectPropertyRelease *release, - void *opaque, - Error **errp)
qom/object.c object_class_property_add(ObjectClass *klass, · line 1198
Quoted 10 lines
qom/object.c +2
-5+ void *opaque) {ObjectProperty *prop; -if (object_class_property_find (klass, name,NULL ) !=NULL ) { -error_setg (errp,"attempt to add duplicate property '%s' to class (type '%s')" , - name,object_class_get_name (klass)); -return NULL ; - } +assert (!object_class_property_find (klass, name,NULL ));
If you do split, then deciding whether this type of cleanup belongs in the first patch (by ignoring the errp parameter, before mechanically dropping it) or the second is a fuzzier answer.
At any rate, my quick glance over the mechanical changes, and focused glance at these points of interest, sees nothing wrong. So even if you do not split the patch, I can live with:
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH 14/17] Drop more @errp parameters after previous commit
In reply to Markus ArmbrusterQuoted 7 lines · Markus Armbruster
Several functions can't fail anymore:
ich9_pm_add_properties(),device_add_bootindex_property(),ppc_compat_add_property(),spapr_caps_add_properties(),PropertyInfo.create(). Drop their @errp parameter.Signed-off-by Markus Armbruster <[email protected]>---
Nice that the compiler helps you find impacted spots, once you tweak the .h.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH 17/17] qom: Drop @errp parameter of object_property_del()
In reply to Markus ArmbrusterQuoted 8 lines · Markus Armbruster
Same story as for
object_property_add(): the only wayobject_property_del()can fail is when the property with this name does not exist. Since our property names are all hardcoded, failure is a programming error, and the appropriate way to handle it is passing&error_abort. Most callers do that, the commit before previous fixed one that didn't (and got the error handling wrong), and the two remaining exceptions ignore errors.
Quoted 4 lines
Drop the @errp parameter and assert the precondition instead.
Signed-off-by Markus Armbruster <[email protected]>---
I skipped review of 15/17 (it's less mechanical, and although the commit message was good, verifying that the patch matches the commit message is a bigger task). But assuming it is right, then this one indeed makes sense.
Quoted 8 lines
+++
b/qom/object.cqom/object.c +1
-1@@ -1280,15 +1280,10 @@ ObjectProperty *object_class_property_find(ObjectClass *klass, const char *name,return prop; } -void object_property_del (Object *obj,const char *name,Error **errp) +void object_property_del (Object *obj,const char *name) {
qom/object.c ObjectProperty *object_class_property_find(ObjectClass *klass, const char *name, · line 1289
Quoted 10 lines
qom/object.c +0
-5ObjectProperty *prop =g_hash_table_lookup (obj->properties, name); -if (!prop) { -error_setg (errp,"Property '.%s' not found" , name); -return ; - } -if (prop->release) { prop->release (obj, name, prop->opaque); }
However, the commit message says you assert the precondition, whereas the code SEGVs rather than asserts if the precondition is not met. In practice, both will flag the programmer error, so I don't care which you do, but it's worth making the commit match the intent: Did you mean to add an assert()?
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [PATCH 00/17] qom: Spring cleaning
Message-id: [email protected]
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
1e7e79e qom: Drop @errp parameter of object_property_del() 787ab69 spapr_pci: Drop some dead error handling
4ae2109 qdev: Unrealize must not fail
31f0921 Drop more @errp parameters after previous commit 7ab7aa4 qom: Drop parameter @errp of object_property_add() & friends 3413d9b qdev: Clean up qdev_connect_gpio_out_named()
bbdfd24 hw/arm/bcm2835: Drop futile attempts at QOM-adopting memory 4c03b90 e1000: Don't run e1000_instance_init() twice
78ab4cf hw/isa/superio: Make the components QOM children df98931 s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256 8f252d2 tests/check-qom-proplist: Improve iterator coverage b4f77da qom: Drop object_property_set_description() parameter @errp 993374e qom: Make all the object_property_add_FOO() return the property 4c6606e qom: Change object_property_get_uint16List() to match its doc 78efad6 qom: Drop object_property_del_child()'s unused parameter @errp 10c2151 qom: Clean up inconsistent use of gchar * vs. char * a5d5e35 qom: Clearer reference counting in object_initialize_childv()
=== OUTPUT BEGIN ===
1/17 Checking commit a5d5e35f75b2 (qom: Clearer reference counting in object_initialize_childv()) 2/17 Checking commit 10c2151f5621 (qom: Clean up inconsistent use of gchar * vs. char *) 3/17 Checking commit 78efad64bd9a (qom: Drop object_property_del_child()'s unused parameter @errp) 4/17 Checking commit 4c6606e56d70 (qom: Change object_property_get_uint16List() to match its doc) 5/17 Checking commit 993374e1cb51 (qom: Make all the object_property_add_FOO() return the property) 6/17 Checking commit b4f77daab5f8 (qom: Drop object_property_set_description() parameter @errp) 7/17 Checking commit 8f252d2131c6 (tests/check-qom-proplist: Improve iterator coverage) 8/17 Checking commit df9893154598 (s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256)
ERROR: line over 90 characters
#54: FILE: target/s390x/cpu_features_def.inc.h:313:
+DEF_FEAT(PCC_CMAC_AES_256, "pcc-cmac-aes-256", PCC, 20, "PCC Compute-Last-Block-CMAC-Using-AES-256")
total: 1 errors, 0 warnings, 8 lines checked
Patch 8/17 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
9/17 Checking commit 78ab4cf91a3b (hw/isa/superio: Make the components QOM children) 10/17 Checking commit 4c03b90970d8 (e1000: Don't run e1000_instance_init() twice) 11/17 Checking commit bbdfd2486f47 (hw/arm/bcm2835: Drop futile attempts at QOM-adopting memory) 12/17 Checking commit 3413d9b7f4e7 (qdev: Clean up qdev_connect_gpio_out_named()) 13/17 Checking commit 7ab7aa47a97d (qom: Drop parameter @errp of object_property_add() & friends)
WARNING: line over 80 characters
#207: FILE: backends/hostmem-file.c:187:
+ file_memory_backend_get_discard_data, file_memory_backend_set_discard_data);
WARNING: line over 80 characters
#1078: FILE: hw/arm/raspi.c:287:
+ object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(machine->ram));
WARNING: line over 80 characters
#3084: FILE: hw/ppc/spapr.c:3346:
+ &spapr->kernel_addr, OBJ_PROP_FLAG_READWRITE);
total: 0 errors, 3 warnings, 4457 lines checked
Patch 13/17 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
14/17 Checking commit 31f09214e529 (Drop more @errp parameters after previous commit) 15/17 Checking commit 4ae21090aaa6 (qdev: Unrealize must not fail)
16/17 Checking commit 787ab6991f71 (spapr_pci: Drop some dead error handling) 17/17 Checking commit 1e7e79e14e27 (qom: Drop @errp parameter of object_property_del()) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Re: [PATCH 16/17] spapr_pci: Drop some dead error handling
In reply to Markus ArmbrusterQuoted 7 lines · Markus Armbruster
chassis_from_bus()usesobject_property_get_uint()to get property "chassis_nr" of the bridge device. Failure would be a programming error. Pass&error_abort, and simplify its callers.Cc David Gibson <[email protected]>Signed-off-by Markus Armbruster <[email protected]>
Quoted 202 lines
--- hw/ppc/spapr_pci.c | 86 ++++++++++------------------------------------ 1 file changed, 18 insertions(+), 68 deletions(-)hw/ppc/spapr_pci.c +18
-68@@ -1203,46 +1203,36 @@ static SpaprDrc *drc_from_devfn(SpaprPhbState *phb, drc_id_from_devfn(phb, chassis, devfn)); } -static uint8_t chassis_from_bus (PCIBus *bus,Error **errp) +static uint8_t chassis_from_bus (PCIBus *bus) {if (pci_bus_is_root (bus)) {return 0 ; }else {PCIDevice *bridge =pci_bridge_get_device (bus); -return object_property_get_uint (OBJECT (bridge),"chassis_nr" , errp); +return object_property_get_uint (OBJECT (bridge),"chassis_nr" , + &error_abort); } }static SpaprDrc *drc_from_dev (SpaprPhbState *phb,PCIDevice *dev) { -Error *local_err =NULL ; -uint8_t chassis =chassis_from_bus (pci_get_bus (dev), &local_err); - -if (local_err) { -error_report_err (local_err); -return NULL ; - } +uint8_t chassis =chassis_from_bus (pci_get_bus (dev));return drc_from_devfn (phb, chassis, dev->devfn); } -static void add_drcs (SpaprPhbState *phb,PCIBus *bus,Error **errp) +static void add_drcs (SpaprPhbState *phb,PCIBus *bus) {Object *owner;int i;uint8_t chassis; -Error *local_err =NULL ;if (!phb->dr_enabled) {return ; } - chassis =chassis_from_bus (bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } + chassis =chassis_from_bus (bus);if (pci_bus_is_root (bus)) { owner =OBJECT (phb);@@ -1256,21 +1246,16 @@ static void add_drcs(SpaprPhbState *phb, PCIBus *bus, Error **errp) } } -static void remove_drcs (SpaprPhbState *phb,PCIBus *bus,Error **errp) +static void remove_drcs (SpaprPhbState *phb,PCIBus *bus) {int i;uint8_t chassis; -Error *local_err =NULL ;if (!phb->dr_enabled) {return ; } - chassis =chassis_from_bus (bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } + chassis =chassis_from_bus (bus);for (i =PCI_SLOT_MAX *PCI_FUNC_MAX -1 ; i >=0 ; i--) {SpaprDrc *drc =drc_from_devfn (phb, chassis, i);@@ -1488,17 +1473,11 @@ int spapr_pci_dt_populate(SpaprDrc *drc, SpaprMachineState *spapr, }static void spapr_pci_bridge_plug (SpaprPhbState *phb, -PCIBridge *bridge, -Error **errp) +PCIBridge *bridge) { -Error *local_err =NULL ;PCIBus *bus =pci_bridge_get_sec_bus (bridge); -add_drcs (phb, bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } +add_drcs (phb, bus); } static void spapr_pci_plug(HotplugHandler *plug_handler,@@ -1529,11 +1508,7 @@ static void spapr_pci_plug(HotplugHandler *plug_handler,g_assert (drc);if (pc->is_bridge) { -spapr_pci_bridge_plug (phb,PCI_BRIDGE (plugged_dev), &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } +spapr_pci_bridge_plug (phb,PCI_BRIDGE (plugged_dev)); }/* Following the QEMU convention used for PCIe multifunction @@ -1560,12 +1535,7 @@ static void spapr_pci_plug(HotplugHandler *plug_handler,spapr_drc_reset (drc); }else if (PCI_FUNC (pdev->devfn) ==0 ) {int i; -uint8_t chassis =chassis_from_bus (pci_get_bus (pdev), &local_err); - -if (local_err) { -error_propagate (errp, local_err); -return ; - } +uint8_t chassis =chassis_from_bus (pci_get_bus (pdev));for (i =0 ; i <8 ; i++) {SpaprDrc *func_drc;@@ -1587,17 +1557,11 @@ out: }static void spapr_pci_bridge_unplug (SpaprPhbState *phb, -PCIBridge *bridge, -Error **errp) +PCIBridge *bridge) { -Error *local_err =NULL ;PCIBus *bus =pci_bridge_get_sec_bus (bridge); -remove_drcs (phb, bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } +remove_drcs (phb, bus); } static void spapr_pci_unplug(HotplugHandler *plug_handler,@@ -1619,11 +1583,7 @@ static void spapr_pci_unplug(HotplugHandler *plug_handler,pci_device_reset (PCI_DEVICE (plugged_dev));if (pc->is_bridge) { -Error *local_err =NULL ; -spapr_pci_bridge_unplug (phb,PCI_BRIDGE (plugged_dev), &local_err); -if (local_err) { -error_propagate (errp, local_err); - } +spapr_pci_bridge_unplug (phb,PCI_BRIDGE (plugged_dev));return ; }@@ -1654,13 +1614,7 @@ static void spapr_pci_unplug_request(HotplugHandler *plug_handler,SpaprDrcClass *func_drck;SpaprDREntitySense state;int i; -Error *local_err =NULL ; -uint8_t chassis =chassis_from_bus (pci_get_bus (pdev), &local_err); - -if (local_err) { -error_propagate (errp, local_err); -return ; - } +uint8_t chassis =chassis_from_bus (pci_get_bus (pdev));if (pc->is_bridge) {error_setg (errp,"PCI: Hot unplug of PCI bridges not supported" );@@ -1741,7 +1695,7 @@ static void spapr_phb_unrealize(DeviceState *dev) } } -remove_drcs (sphb, phb->bus, &error_abort); +remove_drcs (sphb, phb->bus);for (i =PCI_NUM_PINS -1 ; i >=0 ; i--) {if (sphb->lsi_table[i].irq) {@@ -1980,11 +1934,7 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp) }/* allocate connectors for child PCI devices */ -add_drcs (sphb, phb->bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); - goto unrealize; - } +add_drcs (sphb, phb->bus);/* DMA setup */ for (i =0 ; i < windows_supported; ++i) {
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [PATCH 16/17] spapr_pci: Drop some dead error handling
In reply to Markus ArmbrusterQuoted 8 lines · On Tue, 28 Apr 2020 18:34:18 +0200 Markus Armbruster <[email protected]> wrote:
chassis_from_bus()usesobject_property_get_uint()to get property "chassis_nr" of the bridge device. Failure would be a programming error. Pass&error_abort, and simplify its callers.Cc David Gibson <[email protected]>Signed-off-by Markus Armbruster <[email protected]>---
Quoted 201 lines
hw/ppc/spapr_pci.c | 86 ++++++++++------------------------------------ 1 file changed, 18 insertions(+), 68 deletions(-)hw/ppc/spapr_pci.c +18
-68@@ -1203,46 +1203,36 @@ static SpaprDrc *drc_from_devfn(SpaprPhbState *phb, drc_id_from_devfn(phb, chassis, devfn)); } -static uint8_t chassis_from_bus (PCIBus *bus,Error **errp) +static uint8_t chassis_from_bus (PCIBus *bus) {if (pci_bus_is_root (bus)) {return 0 ; }else {PCIDevice *bridge =pci_bridge_get_device (bus); -return object_property_get_uint (OBJECT (bridge),"chassis_nr" , errp); +return object_property_get_uint (OBJECT (bridge),"chassis_nr" , + &error_abort); } }static SpaprDrc *drc_from_dev (SpaprPhbState *phb,PCIDevice *dev) { -Error *local_err =NULL ; -uint8_t chassis =chassis_from_bus (pci_get_bus (dev), &local_err); - -if (local_err) { -error_report_err (local_err); -return NULL ; - } +uint8_t chassis =chassis_from_bus (pci_get_bus (dev));return drc_from_devfn (phb, chassis, dev->devfn); } -static void add_drcs (SpaprPhbState *phb,PCIBus *bus,Error **errp) +static void add_drcs (SpaprPhbState *phb,PCIBus *bus) {Object *owner;int i;uint8_t chassis; -Error *local_err =NULL ;if (!phb->dr_enabled) {return ; } - chassis =chassis_from_bus (bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } + chassis =chassis_from_bus (bus);if (pci_bus_is_root (bus)) { owner =OBJECT (phb);@@ -1256,21 +1246,16 @@ static void add_drcs(SpaprPhbState *phb, PCIBus *bus, Error **errp) } } -static void remove_drcs (SpaprPhbState *phb,PCIBus *bus,Error **errp) +static void remove_drcs (SpaprPhbState *phb,PCIBus *bus) {int i;uint8_t chassis; -Error *local_err =NULL ;if (!phb->dr_enabled) {return ; } - chassis =chassis_from_bus (bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } + chassis =chassis_from_bus (bus);for (i =PCI_SLOT_MAX *PCI_FUNC_MAX -1 ; i >=0 ; i--) {SpaprDrc *drc =drc_from_devfn (phb, chassis, i);@@ -1488,17 +1473,11 @@ int spapr_pci_dt_populate(SpaprDrc *drc, SpaprMachineState *spapr, }static void spapr_pci_bridge_plug (SpaprPhbState *phb, -PCIBridge *bridge, -Error **errp) +PCIBridge *bridge) { -Error *local_err =NULL ;PCIBus *bus =pci_bridge_get_sec_bus (bridge); -add_drcs (phb, bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } +add_drcs (phb, bus); } static void spapr_pci_plug(HotplugHandler *plug_handler,@@ -1529,11 +1508,7 @@ static void spapr_pci_plug(HotplugHandler *plug_handler,g_assert (drc);if (pc->is_bridge) { -spapr_pci_bridge_plug (phb,PCI_BRIDGE (plugged_dev), &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } +spapr_pci_bridge_plug (phb,PCI_BRIDGE (plugged_dev)); }/* Following the QEMU convention used for PCIe multifunction @@ -1560,12 +1535,7 @@ static void spapr_pci_plug(HotplugHandler *plug_handler,spapr_drc_reset (drc); }else if (PCI_FUNC (pdev->devfn) ==0 ) {int i; -uint8_t chassis =chassis_from_bus (pci_get_bus (pdev), &local_err); - -if (local_err) { -error_propagate (errp, local_err); -return ; - } +uint8_t chassis =chassis_from_bus (pci_get_bus (pdev));for (i =0 ; i <8 ; i++) {SpaprDrc *func_drc;@@ -1587,17 +1557,11 @@ out: }static void spapr_pci_bridge_unplug (SpaprPhbState *phb, -PCIBridge *bridge, -Error **errp) +PCIBridge *bridge) { -Error *local_err =NULL ;PCIBus *bus =pci_bridge_get_sec_bus (bridge); -remove_drcs (phb, bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } +remove_drcs (phb, bus); } static void spapr_pci_unplug(HotplugHandler *plug_handler,@@ -1619,11 +1583,7 @@ static void spapr_pci_unplug(HotplugHandler *plug_handler,pci_device_reset (PCI_DEVICE (plugged_dev));if (pc->is_bridge) { -Error *local_err =NULL ; -spapr_pci_bridge_unplug (phb,PCI_BRIDGE (plugged_dev), &local_err); -if (local_err) { -error_propagate (errp, local_err); - } +spapr_pci_bridge_unplug (phb,PCI_BRIDGE (plugged_dev));return ; }@@ -1654,13 +1614,7 @@ static void spapr_pci_unplug_request(HotplugHandler *plug_handler,SpaprDrcClass *func_drck;SpaprDREntitySense state;int i; -Error *local_err =NULL ; -uint8_t chassis =chassis_from_bus (pci_get_bus (pdev), &local_err); - -if (local_err) { -error_propagate (errp, local_err); -return ; - } +uint8_t chassis =chassis_from_bus (pci_get_bus (pdev));if (pc->is_bridge) {error_setg (errp,"PCI: Hot unplug of PCI bridges not supported" );@@ -1741,7 +1695,7 @@ static void spapr_phb_unrealize(DeviceState *dev) } } -remove_drcs (sphb, phb->bus, &error_abort); +remove_drcs (sphb, phb->bus);for (i =PCI_NUM_PINS -1 ; i >=0 ; i--) {if (sphb->lsi_table[i].irq) {@@ -1980,11 +1934,7 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp) }/* allocate connectors for child PCI devices */ -add_drcs (sphb, phb->bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); - goto unrealize; - } +add_drcs (sphb, phb->bus);/* DMA setup */ for (i =0 ; i < windows_supported; ++i) {
Re: [PATCH 16/17] spapr_pci: Drop some dead error handling
In reply to Markus ArmbrusterQuoted 200 lines · Markus Armbruster
chassis_from_bus()usesobject_property_get_uint()to get property "chassis_nr" of the bridge device. Failure would be a programming error. Pass&error_abort, and simplify its callers.Cc David Gibson <[email protected]>Signed-off-by Markus Armbruster <[email protected]>--- hw/ppc/spapr_pci.c | 86 ++++++++++------------------------------------ 1 file changed, 18 insertions(+), 68 deletions(-)hw/ppc/spapr_pci.c +17
-63@@ -1203,46 +1203,36 @@ static SpaprDrc *drc_from_devfn(SpaprPhbState *phb, drc_id_from_devfn(phb, chassis, devfn)); } -static uint8_t chassis_from_bus (PCIBus *bus,Error **errp) +static uint8_t chassis_from_bus (PCIBus *bus) {if (pci_bus_is_root (bus)) {return 0 ; }else {PCIDevice *bridge =pci_bridge_get_device (bus); -return object_property_get_uint (OBJECT (bridge),"chassis_nr" , errp); +return object_property_get_uint (OBJECT (bridge),"chassis_nr" , + &error_abort); } }static SpaprDrc *drc_from_dev (SpaprPhbState *phb,PCIDevice *dev) { -Error *local_err =NULL ; -uint8_t chassis =chassis_from_bus (pci_get_bus (dev), &local_err); - -if (local_err) { -error_report_err (local_err); -return NULL ; - } +uint8_t chassis =chassis_from_bus (pci_get_bus (dev));return drc_from_devfn (phb, chassis, dev->devfn); } -static void add_drcs (SpaprPhbState *phb,PCIBus *bus,Error **errp) +static void add_drcs (SpaprPhbState *phb,PCIBus *bus) {Object *owner;int i;uint8_t chassis; -Error *local_err =NULL ;if (!phb->dr_enabled) {return ; } - chassis =chassis_from_bus (bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } + chassis =chassis_from_bus (bus);if (pci_bus_is_root (bus)) { owner =OBJECT (phb);@@ -1256,21 +1246,16 @@ static void add_drcs(SpaprPhbState *phb, PCIBus *bus, Error **errp) } } -static void remove_drcs (SpaprPhbState *phb,PCIBus *bus,Error **errp) +static void remove_drcs (SpaprPhbState *phb,PCIBus *bus) {int i;uint8_t chassis; -Error *local_err =NULL ;if (!phb->dr_enabled) {return ; } - chassis =chassis_from_bus (bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } + chassis =chassis_from_bus (bus);for (i =PCI_SLOT_MAX *PCI_FUNC_MAX -1 ; i >=0 ; i--) {SpaprDrc *drc =drc_from_devfn (phb, chassis, i);@@ -1488,17 +1473,11 @@ int spapr_pci_dt_populate(SpaprDrc *drc, SpaprMachineState *spapr, }static void spapr_pci_bridge_plug (SpaprPhbState *phb, -PCIBridge *bridge, -Error **errp) +PCIBridge *bridge) { -Error *local_err =NULL ;PCIBus *bus =pci_bridge_get_sec_bus (bridge); -add_drcs (phb, bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } +add_drcs (phb, bus); } static void spapr_pci_plug(HotplugHandler *plug_handler,@@ -1529,11 +1508,7 @@ static void spapr_pci_plug(HotplugHandler *plug_handler,g_assert (drc);if (pc->is_bridge) { -spapr_pci_bridge_plug (phb,PCI_BRIDGE (plugged_dev), &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } +spapr_pci_bridge_plug (phb,PCI_BRIDGE (plugged_dev)); }/* Following the QEMU convention used for PCIe multifunction @@ -1560,12 +1535,7 @@ static void spapr_pci_plug(HotplugHandler *plug_handler,spapr_drc_reset (drc); }else if (PCI_FUNC (pdev->devfn) ==0 ) {int i; -uint8_t chassis =chassis_from_bus (pci_get_bus (pdev), &local_err); - -if (local_err) { -error_propagate (errp, local_err); -return ; - } +uint8_t chassis =chassis_from_bus (pci_get_bus (pdev));for (i =0 ; i <8 ; i++) {SpaprDrc *func_drc;@@ -1587,17 +1557,11 @@ out: }static void spapr_pci_bridge_unplug (SpaprPhbState *phb, -PCIBridge *bridge, -Error **errp) +PCIBridge *bridge) { -Error *local_err =NULL ;PCIBus *bus =pci_bridge_get_sec_bus (bridge); -remove_drcs (phb, bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } +remove_drcs (phb, bus); } static void spapr_pci_unplug(HotplugHandler *plug_handler,@@ -1619,11 +1583,7 @@ static void spapr_pci_unplug(HotplugHandler *plug_handler,pci_device_reset (PCI_DEVICE (plugged_dev));if (pc->is_bridge) { -Error *local_err =NULL ; -spapr_pci_bridge_unplug (phb,PCI_BRIDGE (plugged_dev), &local_err); -if (local_err) { -error_propagate (errp, local_err); - } +spapr_pci_bridge_unplug (phb,PCI_BRIDGE (plugged_dev));return ; }@@ -1654,13 +1614,7 @@ static void spapr_pci_unplug_request(HotplugHandler *plug_handler,SpaprDrcClass *func_drck;SpaprDREntitySense state;int i; -Error *local_err =NULL ; -uint8_t chassis =chassis_from_bus (pci_get_bus (pdev), &local_err); - -if (local_err) { -error_propagate (errp, local_err); -return ; - } +uint8_t chassis =chassis_from_bus (pci_get_bus (pdev));if (pc->is_bridge) {error_setg (errp,"PCI: Hot unplug of PCI bridges not supported" );@@ -1741,7 +1695,7 @@ static void spapr_phb_unrealize(DeviceState *dev) } } -remove_drcs (sphb, phb->bus, &error_abort); +remove_drcs (sphb, phb->bus);for (i =PCI_NUM_PINS -1 ; i >=0 ; i--) {if (sphb->lsi_table[i].irq) {@@ -1980,11 +1934,7 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp) }
hw/ppc/spapr_pci.c static void spapr_phb_realize(DeviceState *dev, Error **errp) · line 1940
Quoted 10 lines
hw/ppc/spapr_pci.c +1
-5/* allocate connectors for child PCI devices */ -add_drcs (sphb, phb->bus, &local_err); -if (local_err) { -error_propagate (errp, local_err); - goto unrealize; - } +add_drcs (sphb, phb->bus);/* DMA setup */ for (i =0 ; i < windows_supported; ++i) {
Very nice cleanup.
Re: [PATCH 10/17] e1000: Don't run e1000_instance_init() twice
In reply to Markus ArmbrusterQuoted 8 lines · Markus Armbruster
QOM object initialization runs .instance_init() for the type and all its supertypes; see
object_init_with_type().Both
TYPE_E1000_BASEand its concrete subtypes set .instance_init() toe1000_instance_init(). For the concrete subtypes, it duly gets run twice. The second run fails, but the error gets ignored (a later commit will change that).
Quoted 4 lines
Remove it from the subtypes.
Cc Jason Wang <[email protected]>Signed-off-by Markus Armbruster <[email protected]>
Quoted 16 lines
--- hw/net/e1000.c | 1 - 1 file changed, 1 deletion(-)hw/net/e1000.c +0
-1@@ -1824,7 +1824,6 @@ static void e1000_register_types(void) type_info.parent =TYPE_E1000_BASE ; type_info.class_data = (void *)info; type_info.class_init = e1000_class_init; - type_info.instance_init = e1000_instance_init;type_register (&type_info); }
Re: [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes,eaes}-256
In reply to David HildenbrandQuoted 40 lines · David Hildenbrand
Quoted 26 lines · Markus Armbruster
Both s390_features[S390_FEAT_PCC_CMAC_AES_256].name and s390_features[S390_FEAT_PCC_CMAC_EAES_256].name is "pcc-cmac-eaes-256". The former is obviously a pasto.
Impact:
*
s390_feat_bitmap_to_ascii()misidentifiesS390_FEAT_PCC_CMAC_AES_256as "pcc-cmac-eaes-256". Affects QMP commands query-cpu-definitions, query-cpu-model-expansion, query-cpu-model-baseline, query-cpu-model-comparison, and the error message whens390_realize_cpu_model()fails incheck_compatibility().*
s390_realize_cpu_model()misidentifies it incheck_consistency()warnings.*
s390_cpu_list()likewise. Affects -cpu help.*
s390_cpu_model_register_props()creates CPU property "pcc-cmac-eaes-256" twice. The second one fails, but the error is ignored (a later commit will change that). Results in a single property "pcc-cmac-eaes-256" with the description forS390_FEAT_PCC_CMAC_AES_256, and no property forS390_FEAT_PCC_CMAC_EAES_256. CPU properties are visible in CLI -cpu and -device, QMP & HMPdevice_add, QMP device-list-properties, and QOM introspection.Quoted 1 line
Fix by deleting the wayward 'e'.
Very nice catch - thanks!
While this sounds very bad, it's luckily not that bad in practice (currently).
The feature (or rather, both features) is part of the feature group "msa4". As long as we have all sub-features part of that group (which is usually the case), we will always indicate "msa4" to the user, instead of all the separate sub-features. So, expansion, baseline, comparison will usually only work with "msa4".
Quoted 5 lines
(in addition, current KVM is not capable of actually masking off these sub-features, so it will still, always see the feature, even if not explicitly specified via "-cpu X,pcc-cmac-aes-256=on)
I think we should do stable backports.
makes sense, but I would like to do some testing upfront (old QEMU <-> new QEMU
Re: [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256
In reply to David HildenbrandQuoted 27 lines · David Hildenbrand
Quoted 26 lines · Markus Armbruster
Both s390_features[S390_FEAT_PCC_CMAC_AES_256].name and s390_features[S390_FEAT_PCC_CMAC_EAES_256].name is "pcc-cmac-eaes-256". The former is obviously a pasto.
Impact:
*
s390_feat_bitmap_to_ascii()misidentifiesS390_FEAT_PCC_CMAC_AES_256as "pcc-cmac-eaes-256". Affects QMP commands query-cpu-definitions, query-cpu-model-expansion, query-cpu-model-baseline, query-cpu-model-comparison, and the error message whens390_realize_cpu_model()fails incheck_compatibility().*
s390_realize_cpu_model()misidentifies it incheck_consistency()warnings.*
s390_cpu_list()likewise. Affects -cpu help.*
s390_cpu_model_register_props()creates CPU property "pcc-cmac-eaes-256" twice. The second one fails, but the error is ignored (a later commit will change that). Results in a single property "pcc-cmac-eaes-256" with the description forS390_FEAT_PCC_CMAC_AES_256, and no property forS390_FEAT_PCC_CMAC_EAES_256. CPU properties are visible in CLI -cpu and -device, QMP & HMPdevice_add, QMP device-list-properties, and QOM introspection.
Quoted 3 lines
Quoted 1 line
Fix by deleting the wayward 'e'.
Very nice catch - thanks!
:)
Quoted 9 lines
While this sounds very bad, it's luckily not that bad in practice (currently).
The feature (or rather, both features) is part of the feature group "msa4". As long as we have all sub-features part of that group (which is usually the case), we will always indicate "msa4" to the user, instead of all the separate sub-features. So, expansion, baseline, comparison will usually only work with "msa4".
Quoted 3 lines
(in addition, current KVM is not capable of actually masking off these sub-features, so it will still, always see the feature, even if not explicitly specified via "-cpu X,pcc-cmac-aes-256=on)
Would you like to propose an commit message improvements?
Quoted 3 lines
I think we should do stable backports.
Reviewed-by David Hildenbrand <[email protected]>
Thanks!
Re: [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes,eaes}-256
In reply to Christian BorntraegerQuoted 43 lines · Christian Borntraeger
Quoted 40 lines · David Hildenbrand
Quoted 26 lines · Markus Armbruster
Both s390_features[S390_FEAT_PCC_CMAC_AES_256].name and s390_features[S390_FEAT_PCC_CMAC_EAES_256].name is "pcc-cmac-eaes-256". The former is obviously a pasto.
Impact:
*
s390_feat_bitmap_to_ascii()misidentifiesS390_FEAT_PCC_CMAC_AES_256as "pcc-cmac-eaes-256". Affects QMP commands query-cpu-definitions, query-cpu-model-expansion, query-cpu-model-baseline, query-cpu-model-comparison, and the error message whens390_realize_cpu_model()fails incheck_compatibility().*
s390_realize_cpu_model()misidentifies it incheck_consistency()warnings.*
s390_cpu_list()likewise. Affects -cpu help.*
s390_cpu_model_register_props()creates CPU property "pcc-cmac-eaes-256" twice. The second one fails, but the error is ignored (a later commit will change that). Results in a single property "pcc-cmac-eaes-256" with the description forS390_FEAT_PCC_CMAC_AES_256, and no property forS390_FEAT_PCC_CMAC_EAES_256. CPU properties are visible in CLI -cpu and -device, QMP & HMPdevice_add, QMP device-list-properties, and QOM introspection.Quoted 1 line
Fix by deleting the wayward 'e'.
Very nice catch - thanks!
While this sounds very bad, it's luckily not that bad in practice (currently).
The feature (or rather, both features) is part of the feature group "msa4". As long as we have all sub-features part of that group (which is usually the case), we will always indicate "msa4" to the user, instead of all the separate sub-features. So, expansion, baseline, comparison will usually only work with "msa4".
Quoted 7 lines
Quoted 5 lines
(in addition, current KVM is not capable of actually masking off these sub-features, so it will still, always see the feature, even if not explicitly specified via "-cpu X,pcc-cmac-aes-256=on)
I think we should do stable backports.
makes sense, but I would like to do some testing upfront (old QEMU <-> new QEMU
So migration does work between a qemu with and without the patch for host-model and custom model=z14.
Re: [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes,eaes}-256
In reply to Markus ArmbrusterQuoted 44 lines · Markus Armbruster
Quoted 27 lines · David Hildenbrand
Quoted 26 lines · Markus Armbruster
Both s390_features[S390_FEAT_PCC_CMAC_AES_256].name and s390_features[S390_FEAT_PCC_CMAC_EAES_256].name is "pcc-cmac-eaes-256". The former is obviously a pasto.
Impact:
*
s390_feat_bitmap_to_ascii()misidentifiesS390_FEAT_PCC_CMAC_AES_256as "pcc-cmac-eaes-256". Affects QMP commands query-cpu-definitions, query-cpu-model-expansion, query-cpu-model-baseline, query-cpu-model-comparison, and the error message whens390_realize_cpu_model()fails incheck_compatibility().*
s390_realize_cpu_model()misidentifies it incheck_consistency()warnings.*
s390_cpu_list()likewise. Affects -cpu help.*
s390_cpu_model_register_props()creates CPU property "pcc-cmac-eaes-256" twice. The second one fails, but the error is ignored (a later commit will change that). Results in a single property "pcc-cmac-eaes-256" with the description forS390_FEAT_PCC_CMAC_AES_256, and no property forS390_FEAT_PCC_CMAC_EAES_256. CPU properties are visible in CLI -cpu and -device, QMP & HMPdevice_add, QMP device-list-properties, and QOM introspection.Quoted 3 lines
Quoted 1 line
Fix by deleting the wayward 'e'.
Very nice catch - thanks!
:)
Quoted 9 lines
While this sounds very bad, it's luckily not that bad in practice (currently).
The feature (or rather, both features) is part of the feature group "msa4". As long as we have all sub-features part of that group (which is usually the case), we will always indicate "msa4" to the user, instead of all the separate sub-features. So, expansion, baseline, comparison will usually only work with "msa4".
Quoted 5 lines
Quoted 3 lines
(in addition, current KVM is not capable of actually masking off these sub-features, so it will still, always see the feature, even if not explicitly specified via "-cpu X,pcc-cmac-aes-256=on)
Would you like to propose an commit message improvements?
Maybe something like
"Both affected features are part of the feature group msa4. In current setups, we will always see the msa4 feature instead of the separate contained sub-features (because all sub-features are around). Therefore, both features are currently never passed from/to the user explicitly (e.g., via cpu model expansion, comparison, baseline and '-cpu' setup)."
Thanks!
Signature · 3 lines
Thanks, David / dhildenb
Re: [PATCH 02/17] qom: Clean up inconsistent use of gchar * vs. char *
In reply to Eric BlakeQuoted 7 lines · Eric Blake
Quoted 2 lines · Markus Armbruster
Uses of gchar * in
qom/object.h:Nice audit. I don't know if we can blindly assume that 'gchar' is a (stupid) typedef to 'char', or if they can ever differ, but avoiding gchar where possible always makes sense to me.
GLib's "basic types" are one of the most misguided aspects of its interface.
Quote https://developer.gnome.org/glib/stable/glib-Basic-Types.html
GLib defines a number of commonly used types, which can be divided into several groups:
New types which are not part of standard C (but are defined in various C standard library header files) — gboolean, gssize.
Stuck in the 90s.
Integer types which are guaranteed to be the same size across all platforms — gint8, guint8, gint16, guint16, gint32, guint32, gint64, guint64.
Again.
Types which are easier to use than their standard C counterparts
- gpointer, gconstpointer, guchar, guint, gushort, gulong.
Surely, you're joking Mr. GLib.
Types which correspond exactly to standard C types, but are included for completeness — gchar, gint, gshort, glong, gfloat, gdouble.
This answers your question: yes, gchar is exactly char.
It also reminds me of "It has been said that XML is like violence; if a little doesn't solve the problem, use more."
Types which correspond exactly to standard C99 types, but are available to use even if your compiler does not support C99 — gsize, goffset, gintptr, guintptr.
And the 90s again.
Purge with fire.
Quoted 3 lines
Quoted 2 lines
Signed-off-by Markus Armbruster <[email protected]>---
Reviewed-by Eric Blake <[email protected]>
Thanks!
Re: [PATCH 04/17] qom: Change object_property_get_uint16List() to match its doc
In reply to Eric BlakeQuoted 25 lines · Eric Blake
include/qom/object.h int object_property_get_enum(Object *obj, const char *name,
Quoted 12 lines · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>--- include/qom/object.h | 4 ++-- hw/core/machine-qmp-cmds.c | 6 +++--- qom/object.c | 9 +++++---- 3 files changed, 10 insertions(+), 9 deletions(-)include/qom/object.h +0
-0@@ -1331,8 +1331,8 @@ int object_property_get_enum(Object *obj, const char *name,Adding context:
/**
*object_property_get_uint16List:
* @obj: the object
* @name: the name of the property
* @list: the returned int list
* @errp: returns an error if this function fails
*
* Returns: the value of the property, converted to integers, or
Quoted 10 lines
include/qom/object.h int object_property_get_enum(Object *obj, const char *name, · line 1335
Quoted 7 lines
include/qom/object.h +2
-2* undefined if an error occurs (including when the property value is not * an list of integers). */ -void object_property_get_uint16List (Object *obj,const char *name, -uint16List **list,Error **errp); +uint16List *object_property_get_uint16List (Object *obj,const char *name, +Error **errp);Incomplete. The doc comments need to drop the @list line, as well as s/undefined/#NULL/ in the Returns line.
Will fix.
Quoted 2 lines
With that fixed,
Reviewed-by Eric Blake <[email protected]>
Thanks!
Re: [PATCH 13/17] qom: Drop parameter @errp of object_property_add() & friends
In reply to Eric BlakeQuoted 37 lines · Eric Blake
Quoted 28 lines · Markus Armbruster
The only way
object_property_add()can fail is when a property with the same name already exists. Since our property names are all hardcoded, failure is a programming error, and the appropriate way to handle it is passing&error_abort.Same for its variants, except for
object_property_add_child(), which additionally fails when the child already has a parent. Parentage is also under program control, so this is a programming error, too.We have a bit over 500 callers. Almost half of them pass
&error_abort, slightly fewer ignore errors, one test case handles errors, and the remaining few callers pass them to their own callers.The previous few commits demonstrated once again that ignoring programming errors is a bad idea.
Of the few ones that pass on errors, several violate the Error API. The Error ** argument must be NULL,
&error_abort,&error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second call.ich9_pm_add_properties(),sparc32_ledma_realize(),sparc32_dma_realize(),xilinx_axidma_realize(),xilinx_enet_realize()are wrong that way.When the one appropriate choice of argument is
&error_abort, letting users pick the argument is a bad idea.Quoted 7 lines
Drop parameter @errp and assert the preconditions instead.
There's one exception to "duplicate property name is a programming error": the way
object_property_add()implements the magic (and undocumented) "automatic arrayification". Don't drop @errp there. Instead, renameobject_property_add()toobject_property_try_add(), and add the obvious wrapperobject_property_add().
Quoted 4 lines
Huge. Could this last paragraph be done as a separate patch (ie. introduce
object_property_try_addand adjust its clients), prior to the bulk mechanical patch that deletes the errp argument for all remaining instances?
It could. Patch would look like this:
@@ -1129,12 +1123,12 @@ void object_unref(Object *obj)
}
} -ObjectProperty *
-object_property_add(Object *obj, const char *name, const char *type,
- ObjectPropertyAccessor *get,
- ObjectPropertyAccessor *set,
- ObjectPropertyRelease *release,
- void *opaque, Error **errp)
+static ObjectProperty *
+object_property_try_add(Object *obj, const char *name, const char *type,
+ ObjectPropertyAccessor *get,
+ ObjectPropertyAccessor *set,
+ ObjectPropertyRelease *release,
+ void *opaque, Error **errp)
{
ObjectProperty *prop;
size_t name_len = strlen(name);
@@ -1148,8 +1142,8 @@ object_property_add(Object *obj, const char *name, const char *type,
for (i = 0; ; ++i) {
char *full_name = g_strdup_printf("%s[%d]", name_no_array, i); - ret = object_property_add(obj, full_name, type, get, set,
- release, opaque, NULL);
+ ret = object_property_try_add(obj, full_name, type, get, set,
+ release, opaque, NULL);
g_free(full_name);
if (ret) {
break;
@@ -1179,6 +1173,17 @@ object_property_add(Object *obj, const char *name, const char *type,
return prop;
} +ObjectProperty *
+object_property_add(Object *obj, const char *name, const char *type,
+ ObjectPropertyAccessor *get, + ObjectPropertyAccessor *set, + ObjectPropertyRelease *release, + void *opaque, Error **errp)
+{
+ return object_property_try_add(obj, name, type, get, set, release,
+ opaque, errp);
+}
+
ObjectProperty *
object_class_property_add(ObjectClass *klass,
const char *name,
Makes no sense on its own, so I'd have to explain in the commit message. I doubt it's worthwhile.
Quoted 5 lines
Quoted 4 lines
Signed-off-by Markus Armbruster <[email protected]>--- include/qom/object.h | 81 +++-----
Quoted 7 lines
Quoted 3 lines
qom/container.c | 2 +- qom/object.c | 302 +++++++++------------------- qom/object_interfaces.c | 5 +-The core of the patch lies in these files, but even then it is still large because of adding a new API at the same time as fixing an existing one.
It is large because we're fixing up 25 functions (object.h: 25 insertions(+), 56 deletions(-)), and their uses. The new code is actually quite small: 19 insertions(+), 8 deletions(-).
Quoted 84 lines
Quoted 24 lines
190 files changed, 643 insertions(+), 987 deletions(-)+++
b/qom/object.cqom/object.c +6
-5@@ -1129,12 +1123,12 @@ void object_unref(Object *obj) } } -ObjectProperty * -object_property_add(Object *obj, const char *name, const char *type, - ObjectPropertyAccessor *get, - ObjectPropertyAccessor *set, - ObjectPropertyRelease *release, - void *opaque, Error **errp) +static ObjectProperty * +object_property_try_add (Object *obj,const char *name,const char *type, +ObjectPropertyAccessor *get, +ObjectPropertyAccessor *set, +ObjectPropertyRelease *release, +void *opaque,Error **errp) {ObjectProperty *prop;size_t name_len =strlen (name);qom/object.c object_property_add(Object *obj, const char *name, const char *type, · line 1148
Quoted 8 lines
qom/object.c +2
-1@@ -1148,8 +1142,8 @@ object_property_add(Object *obj, const char *name, const char *type,for (i =0 ; ; ++i) {char *full_name =g_strdup_printf ("%s[%d]" , name_no_array, i); - ret =object_property_add (obj, full_name, type, get, set, - release, opaque,NULL ); + ret =object_property_try_add (obj, full_name, type, get, set, + release, opaque, NULL);g_free (full_name);Here's the magic in the last paragraph.
Quoted 6 lines
qom/object.c +0
-0if (ret) {break ;@@ -1179,6 +1173,17 @@ object_property_add(Object *obj, const char *name, const char *type,return prop; } +ObjectProperty *qom/object.c object_property_add(Object *obj, const char *name, const char *type, · line 1185
Quoted 10 lines
qom/object.c +10
-0+object_property_add(Object *obj, const char *name, const char *type, + ObjectPropertyAccessor *get, + ObjectPropertyAccessor *set, + ObjectPropertyRelease *release, + void *opaque) +{ +return object_property_try_add (obj, name, type, get, set, release, + opaque, &error_abort); +} +and if you were to split things into two patches, the first patch would be adding:
ObjectProperty *
object_property_add(Object *obj, const char *name, const char *type,
ObjectPropertyAccessor *get, ObjectPropertyAccessor *set, ObjectPropertyRelease *release,
void *opaque, Error **errp)
{
return object_property_try_add(obj, name, type, get, set, release,
opaque, errp);
}with the second changing the signature to drop errp and forward
&error_abort.Quoted 14 lines
qom/object.c +1
-3ObjectProperty * object_class_property_add(ObjectClass *klass, const char *name,@@ -1186,16 +1191,11 @@ object_class_property_add(ObjectClass *klass, ObjectPropertyAccessor *get, ObjectPropertyAccessor *set, ObjectPropertyRelease *release, - void *opaque, - Error **errp) + void *opaque) {ObjectProperty *prop; - if (object_class_property_find(klass, name, NULL) != NULL) { - error_setg(errp, "attempt to add duplicate property '%s' to class (type '%s')",
Quoted 8 lines
qom/object.c object_class_property_add(ObjectClass *klass, · line 1198
Quoted 4 lines
qom/object.c +1
-3- name, object_class_get_name(klass)); -return NULL ; - } +assert (!object_class_property_find (klass, name,NULL ));If you do split, then deciding whether this type of cleanup belongs in the first patch (by ignoring the errp parameter, before mechanically dropping it) or the second is a fuzzier answer.
Hmm, that's another splitting idea: eliminate use of the @errp parameters, then drop them. I'll think about it.
Quoted 5 lines
At any rate, my quick glance over the mechanical changes, and focused glance at these points of interest, sees nothing wrong. So even if you do not split the patch, I can live with:
Reviewed-by Eric Blake <[email protected]>
Thanks!
Re: [PATCH 17/17] qom: Drop @errp parameter of object_property_del()
In reply to Eric BlakeQuoted 35 lines · Eric Blake
Quoted 8 lines · Markus Armbruster
Same story as for
object_property_add(): the only wayobject_property_del()can fail is when the property with this name does not exist. Since our property names are all hardcoded, failure is a programming error, and the appropriate way to handle it is passing&error_abort. Most callers do that, the commit before previous fixed one that didn't (and got the error handling wrong), and the two remaining exceptions ignore errors.Quoted 4 lines
Drop the @errp parameter and assert the precondition instead.
Signed-off-by Markus Armbruster <[email protected]>---
I skipped review of 15/17 (it's less mechanical, and although the commit message was good, verifying that the patch matches the commit message is a bigger task). But assuming it is right, then this one indeed makes sense.
Quoted 15 lines
+++
b/qom/object.cqom/object.c +1
-4@@ -1280,15 +1280,10 @@ ObjectProperty *object_class_property_find(ObjectClass *klass, const char *name,return prop; } -void object_property_del(Object *obj, const char *name, Error **errp) +void object_property_del (Object *obj,const char *name) {ObjectProperty *prop =g_hash_table_lookup (obj->properties, name); - if (!prop) { -error_setg (errp,"Property '.%s' not found" , name); -return ; - } -if (prop->release) {
Quoted 8 lines
qom/object.c ObjectProperty *object_class_property_find(ObjectClass *klass, const char *name, · line 1289
Quoted 2 lines
qom/object.c +0
-0prop->release (obj, name, prop->opaque); }However, the commit message says you assert the precondition, whereas the code SEGVs rather than asserts if the precondition is not met. In practice, both will flag the programmer error, so I don't care which you do, but it's worth making the commit match the intent: Did you mean to add an
assert()?
I started with an assert, then decided asserting prop right before dereferncing it is silly, and deleted the assertion without adjusting the commit message. I'll tidy up.
Re: [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256
In reply to Christian BorntraegerQuoted 48 lines · Christian Borntraeger
Quoted 47 lines · Christian Borntraeger
Quoted 44 lines · David Hildenbrand
Quoted 26 lines · Markus Armbruster
Both s390_features[S390_FEAT_PCC_CMAC_AES_256].name and s390_features[S390_FEAT_PCC_CMAC_EAES_256].name is "pcc-cmac-eaes-256". The former is obviously a pasto.
Impact:
*
s390_feat_bitmap_to_ascii()misidentifiesS390_FEAT_PCC_CMAC_AES_256as "pcc-cmac-eaes-256". Affects QMP commands query-cpu-definitions, query-cpu-model-expansion, query-cpu-model-baseline, query-cpu-model-comparison, and the error message whens390_realize_cpu_model()fails incheck_compatibility().*
s390_realize_cpu_model()misidentifies it incheck_consistency()warnings.*
s390_cpu_list()likewise. Affects -cpu help.*
s390_cpu_model_register_props()creates CPU property "pcc-cmac-eaes-256" twice. The second one fails, but the error is ignored (a later commit will change that). Results in a single property "pcc-cmac-eaes-256" with the description forS390_FEAT_PCC_CMAC_AES_256, and no property forS390_FEAT_PCC_CMAC_EAES_256. CPU properties are visible in CLI -cpu and -device, QMP & HMPdevice_add, QMP device-list-properties, and QOM introspection.Quoted 1 line
Fix by deleting the wayward 'e'.
Very nice catch - thanks!
While this sounds very bad, it's luckily not that bad in practice (currently).
The feature (or rather, both features) is part of the feature group "msa4". As long as we have all sub-features part of that group (which is usually the case), we will always indicate "msa4" to the user, instead of all the separate sub-features. So, expansion, baseline, comparison will usually only work with "msa4".
(in addition, current KVM is not capable of actually masking off these sub-features, so it will still, always see the feature, even if not explicitly specified via "-cpu X,pcc-cmac-aes-256=on)
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
I think we should do stable backports.
makes sense, but I would like to do some testing upfront (old QEMU <-> new QEMU
So migration does work between a qemu with and without the patch for host-model and custom model=z14.
Is this a Tested-by?
Re: [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256
In reply to David HildenbrandQuoted 53 lines · David Hildenbrand
Quoted 44 lines · Markus Armbruster
Quoted 27 lines · David Hildenbrand
Quoted 26 lines · Markus Armbruster
Both s390_features[S390_FEAT_PCC_CMAC_AES_256].name and s390_features[S390_FEAT_PCC_CMAC_EAES_256].name is "pcc-cmac-eaes-256". The former is obviously a pasto.
Impact:
*
s390_feat_bitmap_to_ascii()misidentifiesS390_FEAT_PCC_CMAC_AES_256as "pcc-cmac-eaes-256". Affects QMP commands query-cpu-definitions, query-cpu-model-expansion, query-cpu-model-baseline, query-cpu-model-comparison, and the error message whens390_realize_cpu_model()fails incheck_compatibility().*
s390_realize_cpu_model()misidentifies it incheck_consistency()warnings.*
s390_cpu_list()likewise. Affects -cpu help.*
s390_cpu_model_register_props()creates CPU property "pcc-cmac-eaes-256" twice. The second one fails, but the error is ignored (a later commit will change that). Results in a single property "pcc-cmac-eaes-256" with the description forS390_FEAT_PCC_CMAC_AES_256, and no property forS390_FEAT_PCC_CMAC_EAES_256. CPU properties are visible in CLI -cpu and -device, QMP & HMPdevice_add, QMP device-list-properties, and QOM introspection.Quoted 3 lines
Quoted 1 line
Fix by deleting the wayward 'e'.
Very nice catch - thanks!
:)
Quoted 9 lines
While this sounds very bad, it's luckily not that bad in practice (currently).
The feature (or rather, both features) is part of the feature group "msa4". As long as we have all sub-features part of that group (which is usually the case), we will always indicate "msa4" to the user, instead of all the separate sub-features. So, expansion, baseline, comparison will usually only work with "msa4".
Quoted 5 lines
Quoted 3 lines
(in addition, current KVM is not capable of actually masking off these sub-features, so it will still, always see the feature, even if not explicitly specified via "-cpu X,pcc-cmac-aes-256=on)
Would you like to propose an commit message improvements?
Maybe something like
Quoted 7 lines
"Both affected features are part of the feature group msa4. In current setups, we will always see the msa4 feature instead of the separate contained sub-features (because all sub-features are around). Therefore, both features are currently never passed from/to the user explicitly (e.g., via cpu model expansion, comparison, baseline and '-cpu' setup)."
Thanks!
I think I can guess how this could work for reporting features (I haven't checked my guess against the code), which is what the query-cpu-model-* do: suppress individual features when their group is complete.
But "'-cpu' setup" doesn't seem to be about reporting features. Am I confused?
While testing, I noticed that
$ s390x-softmmu/qemu-system-s390x
flashes a window at me, then terminates successfully, without printing anything. With -S, it behaves like other targets. Bug?
Re: [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes,eaes}-256
Quoted 61 lines · Markus Armbruster
Quoted 59 lines · David Hildenbrand
Quoted 44 lines · Markus Armbruster
Quoted 27 lines · David Hildenbrand
Quoted 26 lines · Markus Armbruster
Both s390_features[S390_FEAT_PCC_CMAC_AES_256].name and s390_features[S390_FEAT_PCC_CMAC_EAES_256].name is "pcc-cmac-eaes-256". The former is obviously a pasto.
Impact:
*
s390_feat_bitmap_to_ascii()misidentifiesS390_FEAT_PCC_CMAC_AES_256as "pcc-cmac-eaes-256". Affects QMP commands query-cpu-definitions, query-cpu-model-expansion, query-cpu-model-baseline, query-cpu-model-comparison, and the error message whens390_realize_cpu_model()fails incheck_compatibility().*
s390_realize_cpu_model()misidentifies it incheck_consistency()warnings.*
s390_cpu_list()likewise. Affects -cpu help.*
s390_cpu_model_register_props()creates CPU property "pcc-cmac-eaes-256" twice. The second one fails, but the error is ignored (a later commit will change that). Results in a single property "pcc-cmac-eaes-256" with the description forS390_FEAT_PCC_CMAC_AES_256, and no property forS390_FEAT_PCC_CMAC_EAES_256. CPU properties are visible in CLI -cpu and -device, QMP & HMPdevice_add, QMP device-list-properties, and QOM introspection.Quoted 3 lines
Quoted 1 line
Fix by deleting the wayward 'e'.
Very nice catch - thanks!
:)
Quoted 9 lines
While this sounds very bad, it's luckily not that bad in practice (currently).
The feature (or rather, both features) is part of the feature group "msa4". As long as we have all sub-features part of that group (which is usually the case), we will always indicate "msa4" to the user, instead of all the separate sub-features. So, expansion, baseline, comparison will usually only work with "msa4".
Quoted 5 lines
Quoted 3 lines
(in addition, current KVM is not capable of actually masking off these sub-features, so it will still, always see the feature, even if not explicitly specified via "-cpu X,pcc-cmac-aes-256=on)
Would you like to propose an commit message improvements?
Maybe something like
"Both affected features are part of the feature group msa4. In current setups, we will always see the msa4 feature instead of the separate contained sub-features (because all sub-features are around). Therefore, both features are currently never passed from/to the user explicitly (e.g., via cpu model expansion, comparison, baseline and '-cpu' setup)."
Quoted 6 lines
Quoted 1 line
Thanks!
I think I can guess how this could work for reporting features (I haven't checked my guess against the code), which is what the query-cpu-model-* do: suppress individual features when their group is complete.
Yes. Expand the group to single features on user input, expand the single features to the group on user output (if all features are enabled).
Quoted 4 lines
But "'-cpu' setup" doesn't seem to be about reporting features. Am I confused?
Let me clarify. Any user input would be broken if the two sub-features would be specified explicitly, instead of the whole "msa4" group. This applies to any user input, also the user input for query-cpu-model-.
In the usual cases, libvirt will expand a cpu model (e.g., "host", "z15") and start QEMU with that (-cpu ...). We will only have the complete msa4 group here in practice.
Yes, if some user would pick and chose such features manually, it would be broken - it's just not the common on s390x with the huge amount of features. But that's why I thing stable backports still make sense.
Quoted 7 lines
While testing, I noticed that
$ s390x-softmmu/qemu-system-s390xflashes a window at me, then terminates successfully, without printing anything. With -S, it behaves like other targets. Bug?
Think this is expected.
t480s: ~ $ qemu-system-s390x --nographic
LOADPARM=[ ]
Could not find a suitable boot device (none specified)
The s390-ccw bios will come up, detect that there is nothing to boot and quit. The bios can only print to the sclp console, not to a graphical output.
What the others do (e.g., ppc64, x86_64) is boot the bios/firmware and then halt there.
Signature · 3 lines
Thanks, David / dhildenb
Re: [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes,eaes}-256
In reply to Markus ArmbrusterQuoted 50 lines · Markus Armbruster
Quoted 48 lines · Christian Borntraeger
Quoted 47 lines · Christian Borntraeger
Quoted 44 lines · David Hildenbrand
Quoted 26 lines · Markus Armbruster
Both s390_features[S390_FEAT_PCC_CMAC_AES_256].name and s390_features[S390_FEAT_PCC_CMAC_EAES_256].name is "pcc-cmac-eaes-256". The former is obviously a pasto.
Impact:
*
s390_feat_bitmap_to_ascii()misidentifiesS390_FEAT_PCC_CMAC_AES_256as "pcc-cmac-eaes-256". Affects QMP commands query-cpu-definitions, query-cpu-model-expansion, query-cpu-model-baseline, query-cpu-model-comparison, and the error message whens390_realize_cpu_model()fails incheck_compatibility().*
s390_realize_cpu_model()misidentifies it incheck_consistency()warnings.*
s390_cpu_list()likewise. Affects -cpu help.*
s390_cpu_model_register_props()creates CPU property "pcc-cmac-eaes-256" twice. The second one fails, but the error is ignored (a later commit will change that). Results in a single property "pcc-cmac-eaes-256" with the description forS390_FEAT_PCC_CMAC_AES_256, and no property forS390_FEAT_PCC_CMAC_EAES_256. CPU properties are visible in CLI -cpu and -device, QMP & HMPdevice_add, QMP device-list-properties, and QOM introspection.Quoted 1 line
Fix by deleting the wayward 'e'.
Very nice catch - thanks!
While this sounds very bad, it's luckily not that bad in practice (currently).
The feature (or rather, both features) is part of the feature group "msa4". As long as we have all sub-features part of that group (which is usually the case), we will always indicate "msa4" to the user, instead of all the separate sub-features. So, expansion, baseline, comparison will usually only work with "msa4".
(in addition, current KVM is not capable of actually masking off these sub-features, so it will still, always see the feature, even if not explicitly specified via "-cpu X,pcc-cmac-aes-256=on)
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
I think we should do stable backports.
makes sense, but I would like to do some testing upfront (old QEMU <-> new QEMU
So migration does work between a qemu with and without the patch for host-model and custom model=z14.
Is this a Tested-by?
Yes. As David pointed out when a user really starts to pick manual things in MSA4 then we can have a non-migrateable guests. But this is still the right thing I guess.
Re: [PATCH 02/17] qom: Clean up inconsistent use of gchar * vs. char *
In reply to Markus ArmbrusterQuoted 6 lines · Markus Armbruster
Quoted 4 lines · Eric Blake
Quoted 2 lines · Markus Armbruster
Uses of gchar * in
qom/object.h:
Quoted 6 lines
Quoted 3 lines
Nice audit. I don't know if we can blindly assume that 'gchar' is a (stupid) typedef to 'char', or if they can ever differ, but avoiding gchar where possible always makes sense to me.
GLib's "basic types" are one of the most misguided aspects of its interface.
There is work to re-define them in terms of stdint.h
https://gitlab.gnome.org/GNOME/glib/issues/1484
with long term possible plan to deprecate them
Quoted 9 lines
Quote https://developer.gnome.org/glib/stable/glib-Basic-Types.html
GLib defines a number of commonly used types, which can be divided into several groups:
New types which are not part of standard C (but are defined in various C standard library header files) — gboolean, gssize.
Stuck in the 90s.
snip
Quoted 1 line
Purge with fire.
Note gboolean is a trap door. Any code integrating with GLib APIs that use "gboolean" in their signature must keep using that. It is *NOT* interchangable with the "bool" from stdbool.h.
"gboolean" is a typedef for "gint" "bool" is a "_Bool" which is just a single byte.
Also note TRUE and true are not the same value.
'TRUE' is bitwise !FALSE
'true' is 1
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 1 line · Markus Armbruster
Includes one actual bug fix for s390x.
I reviewed everything except patch 8 and it looks good. Thanks very much!
Paolo
Re: [PATCH 02/17] qom: Clean up inconsistent use of gchar * vs. char *
In reply to Daniel P. BerrangéQuoted 11 lines · Daniel P. Berrangé
Quoted 10 lines · Markus Armbruster
Quoted 7 lines · Eric Blake
Quoted 2 lines · Markus Armbruster
Uses of gchar * in
qom/object.h:Nice audit. I don't know if we can blindly assume that 'gchar' is a (stupid) typedef to 'char', or if they can ever differ, but avoiding gchar where possible always makes sense to me.
Quoted 8 lines
Quoted 2 lines
GLib's "basic types" are one of the most misguided aspects of its interface.
There is work to re-define them in terms of
stdint.hhttps://gitlab.gnome.org/GNOME/glib/issues/1484with long term possible plan to deprecate them
Long overdue.
Quoted 18 lines
Quoted 9 lines
Quote https://developer.gnome.org/glib/stable/glib-Basic-Types.html
GLib defines a number of commonly used types, which can be divided into several groups:
New types which are not part of standard C (but are defined in various C standard library header files) — gboolean, gssize.
Stuck in the 90s.
snip
Quoted 1 line
Purge with fire.
Note gboolean is a trap door. Any code integrating with GLib APIs that use "gboolean" in their signature must keep using that. It is *NOT* interchangable with the "bool" from
stdbool.h.
Quoted 7 lines
"gboolean" is a typedef for "gint" "bool" is a "
_Bool" which is just a single byte.Also note TRUE and true are not the same value.
'TRUE' is bitwise !FALSE
'true' is 1
Yes, gboolean is the worst of the lot, and pretty much impossible to eliminate.
Quoted 4 lines · Paolo Bonzini
Quoted 1 line · Markus Armbruster
Includes one actual bug fix for s390x.
I reviewed everything except patch 8 and it looks good. Thanks very much!
May I add Reviewed-by: Paolo Bonzini <[email protected]>?
Quoted 3 lines · Markus Armbruster
Quoted 1 line
I reviewed everything except patch 8 and it looks good. Thanks very much!
May I add Reviewed-by: Paolo Bonzini <[email protected]>?
For those 16 yes.
Paolo
Re: [PATCH 15/17] qdev: Unrealize must not fail
In reply to Markus ArmbrusterQuoted 181 lines · Markus Armbruster
Devices may have component devices and buses.
Device realization may fail. Realization is recursive: a device's
realize()method realizes its components, anddevice_set_realized()realizes its buses (which should in turn realize the devices on that bus, exceptbus_set_realized()doesn't implement that, yet).When realization of a component or bus fails, we need to roll back:
unrealize everything we realized so far. If any of these unrealizes failed, the device would be left in an inconsistent state. Must not happen.
device_set_realized()lets it happen: it ignores errors in the roll back code starting at labelchild_realize_fail.Since realization is recursive, unrealization must be recursive, too. But how could a partly failed unrealize be rolled back? We'd have to re-realize, which can fail. This design is fundamentally broken.
device_set_realized()does not roll back at all. Instead, it keeps unrealizing, ignoring further errors.It can screw up even for a device with no buses: if the lone
dc->unrealize()fails, it still unregisters vmstate, and calls listeners'unrealize()callback.
bus_set_realized()does not roll back either. Instead, it stops unrealizing.Fortunately, no unrealize method can fail, as we'll see below.
To fix the design error, drop parameter @errp from all the unrealize methods.
Any unrealize method that uses @errp now needs an update. This leads us to
unrealize()methods that can fail. Merely passing it to another unrealize method cannot cause failure, though. Here are the ones that do other things with @errp:*
virtio_serial_device_unrealize()Fails when
qbus_set_hotplug_handler()fails, but still does all the other work. On failure, the device would stay realized with its resources completely gone. Oops. Can't happen, becauseqbus_set_hotplug_handler()can't actually fail here. Pass&error_aborttoqbus_set_hotplug_handler()instead.* hw/ppc/spapr_drc.c's
unrealize()Fails when
object_property_del()fails, but all the other work is already done. On failure, the device would stay realized with its vmstate registration gone. Oops. Can't happen, becauseobject_property_del()can't actually fail here. Pass&error_aborttoobject_property_del()instead.*
spapr_phb_unrealize()Fails and bails out when
remove_drcs()fails, but other work is already done. On failure, the device would stay realized with some of its resources gone. Oops.remove_drcs()fails only when chassis_from_bus()'sobject_property_get_uint()fails, and it can't here. Pass&error_aborttoremove_drcs()instead.Therefore, no unrealize method can fail before this patch.
device_set_realized()'s recursive unrealization via bus uses
object_property_set_bool(). Can't drop @errp there, so pass&error_abort.We similarly unrealize with
object_property_set_bool()elsewhere, always ignoring errors. Pass&error_abortinstead.Several unrealize methods no longer handle errors from other unrealize
methods:virtio_9p_device_unrealize(),virtio_input_device_unrealize(),scsi_qdev_unrealize(), ... Much of the deleted error handling looks wrong anyway.One unrealize methods no longer ignore such errors:
usb_ehci_pci_exit().Several realize methods no longer ignore errors when rolling back:
v9fs_device_realize_common(),pci_qdev_unrealize(),spapr_phb_realize(),usb_qdev_realize(),vfio_ccw_realize(),virtio_device_realize().Signed-off-by Markus Armbruster <[email protected]>--- hw/9pfs/9p.h | 2 +- hw/s390x/virtio-ccw.h | 2 +- hw/sd/sdhci-internal.h | 2 +- hw/usb/ccid.h | 2 +- hw/usb/hcd-ehci.h | 2 +- include/hw/qdev-core.h | 4 ++-- include/hw/s390x/s390-ccw.h | 2 +- include/hw/scsi/scsi.h | 2 +- include/hw/usb.h | 2 +- include/hw/xen/xen-block.h | 2 +- include/hw/xen/xen-bus.h | 2 +- hw/9pfs/9p.c | 4 ++-- hw/9pfs/virtio-9p-device.c | 4 ++-- hw/acpi/pcihp.c | 2 +- hw/audio/intel-hda.c | 2 +- hw/block/pflash_cfi02.c | 2 +- hw/block/vhost-user-blk.c | 2 +- hw/block/virtio-blk.c | 2 +- hw/block/xen-block.c | 8 ++++---- hw/char/serial-pci-multi.c | 2 +- hw/char/serial-pci.c | 2 +- hw/char/serial.c | 2 +- hw/char/virtio-console.c | 2 +- hw/char/virtio-serial-bus.c | 8 ++++---- hw/core/bus.c | 17 ++++------------- hw/core/cpu.c | 2 +- hw/core/generic-loader.c | 2 +- hw/core/qdev.c | 17 ++++++----------- hw/display/virtio-gpu-base.c | 2 +- hw/dma/rc4030.c | 2 +- hw/i386/kvm/apic.c | 2 +- hw/i386/pc.c | 4 ++-- hw/ide/qdev.c | 4 ++-- hw/input/virtio-input-hid.c | 2 +- hw/input/virtio-input-host.c | 2 +- hw/input/virtio-input.c | 9 ++------- hw/intc/apic.c | 2 +- hw/intc/apic_common.c | 4 ++-- hw/intc/ioapic.c | 2 +- hw/intc/xics.c | 2 +- hw/ipack/ipack.c | 6 ++---- hw/mem/pc-dimm.c | 2 +- hw/net/virtio-net.c | 2 +- hw/nvram/mac_nvram.c | 2 +- hw/pci/pci.c | 14 +++++++------- hw/pci/pcie.c | 2 +- hw/pci/shpc.c | 2 +- hw/ppc/pnv_core.c | 2 +- hw/ppc/spapr.c | 8 ++++---- hw/ppc/spapr_cpu_core.c | 2 +- hw/ppc/spapr_drc.c | 14 ++++---------- hw/ppc/spapr_iommu.c | 2 +- hw/ppc/spapr_pci.c | 14 +++++--------- hw/ppc/spapr_tpm_proxy.c | 2 +- hw/s390x/css-bridge.c | 2 +- hw/s390x/s390-ccw.c | 2 +- hw/s390x/s390-pci-bus.c | 4 ++-- hw/s390x/virtio-ccw.c | 8 ++++---- hw/scsi/lsi53c895a.c | 2 +- hw/scsi/scsi-bus.c | 13 ++++--------- hw/scsi/scsi-disk.c | 2 +- hw/scsi/vhost-scsi.c | 2 +- hw/scsi/vhost-user-scsi.c | 2 +- hw/scsi/virtio-scsi.c | 2 +- hw/sd/sdhci-pci.c | 2 +- hw/sd/sdhci.c | 6 +++--- hw/usb/bus.c | 12 ++++++------ hw/usb/ccid-card-emulated.c | 2 +- hw/usb/dev-audio.c | 2 +- hw/usb/dev-hid.c | 2 +- hw/usb/dev-hub.c | 2 +- hw/usb/dev-network.c | 2 +- hw/usb/dev-smartcard-reader.c | 11 +++-------- hw/usb/dev-uas.c | 2 +- hw/usb/dev-wacom.c | 2 +- hw/usb/hcd-ehci-pci.c | 2 +- hw/usb/hcd-ehci.c | 2 +- hw/usb/host-libusb.c | 2 +- hw/usb/redirect.c | 2 +- hw/vfio/ap.c | 2 +- hw/vfio/ccw.c | 6 +++--- hw/virtio/vhost-user-fs.c | 2 +- hw/virtio/vhost-vsock.c | 2 +- hw/virtio/virtio-balloon.c | 2 +- hw/virtio/virtio-crypto.c | 2 +- hw/virtio/virtio-iommu.c | 2 +- hw/virtio/virtio-pmem.c | 2 +- hw/virtio/virtio-rng.c | 2 +- hw/virtio/virtio.c | 11 +++-------- hw/watchdog/wdt_diag288.c | 2 +- hw/xen/xen-bus.c | 12 ++++++------ target/i386/cpu.c | 9 ++------- target/ppc/translate_init.inc.c | 9 ++------- 93 files changed, 158 insertions(+), 214 deletions(-)
[...]
hw/virtio/virtio.c static void virtio_device_realize(DeviceState *dev, Error **errp) · line 3625
Quoted 10 lines
hw/virtio/virtio.c +1
-1@@ -3622,7 +3622,7 @@ static void virtio_device_realize(DeviceState *dev, Error **errp)virtio_bus_device_plugged (vdev, &err);if (err !=NULL ) {error_propagate (errp, err); - vdc->unrealize (dev,NULL ); + vdc->unrealize (dev);
Not related to this patch, but I'm surprise we are not checking for vdc->unrealize non-NULL here ...
Quoted 7 lines
hw/virtio/virtio.c +0
-0return ; }@@ -3630,20 +3630,15 @@ static void virtio_device_realize(DeviceState *dev, Error **errp)memory_listener_register (&vdev->listener, vdev->dma_as); }
hw/virtio/virtio.c static void virtio_device_realize(DeviceState *dev, Error **errp) · line 3640
Quoted 10 lines
hw/virtio/virtio.c +1
-2-static void virtio_device_unrealize (DeviceState *dev,Error **errp) +static void virtio_device_unrealize (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VirtioDeviceClass *vdc =VIRTIO_DEVICE_GET_CLASS (dev); -Error *err =NULL ;virtio_bus_device_unplugged (vdev);if (vdc->unrealize !=NULL ) {
... while here we do.
Quoted 9 lines
hw/virtio/virtio.c +1
-5- vdc->unrealize (dev, &err); -if (err !=NULL ) { -error_propagate (errp, err); -return ; - } + vdc->unrealize (dev); }g_free (vdev->bus_name);
[...]
Re: [PATCH 09/17] hw/isa/superio: Make the components QOM children
In reply to Markus ArmbrusterQuoted 34 lines · Markus Armbruster
isa_superio_realize()attempts to make isa-parallel and isa-serial QOM children, but this does not work, because it callsobject_property_add_child()after realizing withqdev_init_nofail(). Realizing a device without a parent gives it one: it gets put into the "/machine/unattached/" orphanage. The extraobject_property_add_child()fails, andisa_superio_realize()ignores the error.Move the
object_property_add_child()beforeqdev_init_nofail(), and pass&error_abort.For the other components,
isa_superio_realize()doesn't even try. Addobject_property_add_child()there.This affects machines 40p, clipper and fulong2e.
For instance, fulong2e has its vt82c686b-superio (which is an isa-superio) at /machine/unattached/device[9]. Before the patch, its components are at /machine/unattached/device[10] .. [14]. Afterwards, they are at /machine/unattached/device[9]/{parallel0,serial0,serial1,isa-fdc,i8042}.
Cc Michael S. Tsirkin <[email protected]>Cc Paolo Bonzini <[email protected]>Signed-off-by Markus Armbruster <[email protected]>--- hw/isa/isa-superio.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)hw/isa/isa-superio.c +0
-0
hw/isa/isa-superio.c static void isa_superio_realize(DeviceState *dev, Error **errp) · line 66
Quoted 5 lines
hw/isa/isa-superio.c +2
-0@@ -62,6 +62,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)qdev_prop_set_uint32 (d,"irq" , k->parallel.get_irq (sio, i)); }qdev_prop_set_chr (d,"chardev" , chr); +object_property_add_child (OBJECT (sio), name,OBJECT (isa), + &error_abort);
I have a WiP series where I resolved that by adding an 'Object *parent' to isa_create*() (and pci equiv), but the conversion touch many things and not trivial to order for bisectability. I suppose rebasing won't be a problem, so meanwhile:
Quoted 62 lines
hw/isa/isa-superio.c +11
-5qdev_init_nofail (d); sio->parallel[i] = isa; trace_superio_create_parallel(i,@@ -69,8 +71,6 @@ static void isa_superio_realize(DeviceState *dev, Error **errp) k->parallel.get_iobase(sio, i) : -1, k->parallel.get_irq ? k->parallel.get_irq(sio, i) : -1); -object_property_add_child (OBJECT (dev), name, -OBJECT (sio->parallel[i]),NULL );g_free (name); } }@@ -102,6 +102,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)qdev_prop_set_uint32 (d,"irq" , k->serial.get_irq (sio, i)); }qdev_prop_set_chr (d,"chardev" , chr); +object_property_add_child (OBJECT (sio), name,OBJECT (isa), + &error_abort);qdev_init_nofail (d); sio->serial[i] = isa; trace_superio_create_serial(i,@@ -109,8 +111,6 @@ static void isa_superio_realize(DeviceState *dev, Error **errp) k->serial.get_iobase(sio, i) : -1, k->serial.get_irq ? k->serial.get_irq(sio, i) : -1); -object_property_add_child (OBJECT (dev), name, -OBJECT (sio->serial[0 ]),NULL );g_free (name); } }@@ -137,6 +137,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)qdev_prop_set_drive (d,"driveB" ,blk_by_legacy_dinfo (drive), &error_fatal); } +object_property_add_child (OBJECT (sio),"isa-fdc" ,OBJECT (isa), + &error_abort);qdev_init_nofail (d); sio->floppy = isa; trace_superio_create_floppy(0,@@ -147,7 +149,11 @@ static void isa_superio_realize(DeviceState *dev, Error **errp) }/* Keyboard, mouse */ - sio->kbc =isa_create_simple (bus,TYPE_I8042 ); + isa =isa_create (bus,TYPE_I8042 ); +object_property_add_child (OBJECT (sio),TYPE_I8042 ,OBJECT (isa), + &error_abort); +qdev_init_nofail (DEVICE (isa)); + sio->kbc = isa;/* IDE */ if (k->ide.count && (!k->ide.is_enabled || k->ide.is_enabled (sio,0 ))) {@@ -163,6 +169,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)qdev_prop_set_uint32 (d,"irq" , k->ide.get_irq (sio,0 )); }qdev_init_nofail (d); +object_property_add_child (OBJECT (sio),"isa-ide" ,OBJECT (isa), + &error_abort); sio->ide = isa; trace_superio_create_ide(0, k->ide.get_iobase ?
Re: [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256
In reply to David HildenbrandQuoted 13 lines · David Hildenbrand
Quoted 12 lines · Markus Armbruster
Quoted 10 lines · David Hildenbrand
Quoted 9 lines · Markus Armbruster
Quoted 7 lines · David Hildenbrand
Quoted 6 lines · Markus Armbruster
Both s390_features[S390_FEAT_PCC_CMAC_AES_256].name and s390_features[S390_FEAT_PCC_CMAC_EAES_256].name is "pcc-cmac-eaes-256". The former is obviously a pasto.
Impact:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
*
s390_feat_bitmap_to_ascii()misidentifiesS390_FEAT_PCC_CMAC_AES_256as "pcc-cmac-eaes-256". Affects QMP commands query-cpu-definitions, query-cpu-model-expansion, query-cpu-model-baseline, query-cpu-model-comparison, and the error message whens390_realize_cpu_model()fails incheck_compatibility().*
s390_realize_cpu_model()misidentifies it incheck_consistency()warnings.
Actually not, because the feature isn't in check_consistency()'s dep[]. I'll drop this item.
Quoted 42 lines
Quoted 42 lines
Quoted 41 lines
Quoted 26 lines
Quoted 11 lines
Quoted 11 lines
*
s390_cpu_list()likewise. Affects -cpu help.*
s390_cpu_model_register_props()creates CPU property "pcc-cmac-eaes-256" twice. The second one fails, but the error is ignored (a later commit will change that). Results in a single property "pcc-cmac-eaes-256" with the description forS390_FEAT_PCC_CMAC_AES_256, and no property forS390_FEAT_PCC_CMAC_EAES_256. CPU properties are visible in CLI -cpu and -device, QMP & HMPdevice_add, QMP device-list-properties, and QOM introspection.Quoted 3 lines
Quoted 1 line
Fix by deleting the wayward 'e'.
Very nice catch - thanks!
:)
Quoted 9 lines
While this sounds very bad, it's luckily not that bad in practice (currently).
The feature (or rather, both features) is part of the feature group "msa4". As long as we have all sub-features part of that group (which is usually the case), we will always indicate "msa4" to the user, instead of all the separate sub-features. So, expansion, baseline, comparison will usually only work with "msa4".
Quoted 5 lines
Quoted 3 lines
(in addition, current KVM is not capable of actually masking off these sub-features, so it will still, always see the feature, even if not explicitly specified via "-cpu X,pcc-cmac-aes-256=on)
Would you like to propose an commit message improvements?
Maybe something like
"Both affected features are part of the feature group msa4. In current setups, we will always see the msa4 feature instead of the separate contained sub-features (because all sub-features are around). Therefore, both features are currently never passed from/to the user explicitly (e.g., via cpu model expansion, comparison, baseline and '-cpu' setup)."
Thanks!
Quoted 7 lines
Quoted 4 lines
I think I can guess how this could work for reporting features (I haven't checked my guess against the code), which is what the query-cpu-model-* do: suppress individual features when their group is complete.
Yes. Expand the group to single features on user input, expand the single features to the group on user output (if all features are enabled).
Okay, let's play.
Here's query-cpu-definitions:
$ echo -e '{"execute": "qmp_capabilities"}\n{"execute": "query-cpu-definitions"}\n{"execute": "quit"}' | ../qemu/bld/s390x-softmmu/qemu-system-s390x -qmp-pretty stdio -S -display none | egrep 'msa4|pcc-cmac-e?aes-256'Before this patch:
28 "pcc-cmac-eaes-256",
After:
14 "pcc-cmac-aes-256",
14 "pcc-cmac-eaes-256",No msa4.
Here's query-cpu-model-expansion for model "qemu" (arbitrarily chosen), type "static":
$ echo -e '{"execute": "qmp_capabilities"}\n{"execute": "query-cpu-model-expansion", "arguments": {"type": "full", "model": {"name": "qemu"}}}\n{"execute": "quit"}' | $i -qmp-pretty stdio -S -display none | egrep 'msa4|pcc-cmac-e?aes-256' | sort | uniq -cBefore and after:
1 "msa4-base": true,
Same with type "full":
$ echo -e '{"execute": "qmp_capabilities"}\n{"execute": "query-cpu-model-expansion", "arguments": {"type": "full", "model": {"name": "qemu"}}}\n{"execute": "quit"}' | $i -qmp-pretty stdio -S -display none | egrep 'msa4|pcc-cmac-e?aes-256' | sort | uniq -cBefore:
1 "msa4-base": true,
1 "pcc-cmac-eaes-256": false,
After
1 "msa4-base": true,
1 "pcc-cmac-aes-256": false,
1 "pcc-cmac-eaes-256": false,The grouping and masking you described appears to apply to query-cpu-model-expansion with type "static". With type "full", I can see the grouping, but not the masking. With query-cpu-definitions, I can't see either.
I haven't played with query-cpu-model-comparison and query-cpu-model-baseline.
Quoted 8 lines
Quoted 3 lines
But "'-cpu' setup" doesn't seem to be about reporting features. Am I confused?
Let me clarify. Any user input would be broken if the two sub-features would be specified explicitly, instead of the whole "msa4" group. This applies to any user input, also the user input for query-cpu-model-.
Quoted 7 lines
In the usual cases, libvirt will expand a cpu model (e.g., "host", "z15") and start QEMU with that (-cpu ...). We will only have the complete msa4 group here in practice.
Yes, if some user would pick and chose such features manually, it would be broken - it's just not the common on s390x with the huge amount of features. But that's why I thing stable backports still make sense.
The commit message should be accurate and sufficiently precise. The "sufficiently" gives me some wiggle room to avoid inaccuracy due to my ignorance. Would the following be good enough?
Impact:
* s390_feat_bitmap_to_ascii() misidentifies S390_FEAT_PCC_CMAC_AES_256 as "pcc-cmac-eaes-256". Affects QMP commands query-cpu-definitions, query-cpu-model-expansion, query-cpu-model-baseline, query-cpu-model-comparison, and the error message when s390_realize_cpu_model() fails in check_compatibility().
* s390_cpu_list() also misidentifies it. Affects -cpu help.
* s390_cpu_model_register_props() creates CPU property "pcc-cmac-eaes-256" twice. The second one fails, but the error is ignored (a later commit will change that). Results in a single property "pcc-cmac-eaes-256" with the description for S390_FEAT_PCC_CMAC_AES_256, and no property for S390_FEAT_PCC_CMAC_EAES_256. CPU properties are visible in CLI -cpu and -device, QMP & HMP device_add, QMP device-list-properties, and QOM introspection.
The two features are almost always used via their group msa4. Such use is not affected by this bug.
Quoted 14 lines
Quoted 7 lines
While testing, I noticed that
$ s390x-softmmu/qemu-system-s390xflashes a window at me, then terminates successfully, without printing anything. With -S, it behaves like other targets. Bug?
Think this is expected.
t480s: ~ $ qemu-system-s390x --nographic
LOADPARM=[ ]
Could not find a suitable boot device (none specified)
Quoted 6 lines
The s390-ccw bios will come up, detect that there is nothing to boot and quit. The bios can only print to the sclp console, not to a graphical output.
What the others do (e.g., ppc64,
x86_64) is boot the bios/firmware and then halt there.
Thanks!
Re: [PATCH 12/17] qdev: Clean up qdev_connect_gpio_out_named()
In reply to Markus ArmbrusterQuoted 9 lines · Markus Armbruster
Both
qdev_connect_gpio_out_named()anddevice_set_realized()put objects without a parent into the "/machine/unattached/" orphanage.
qdev_connect_gpio_out_named()needs a lengthy comment to explain how it works. It exploits thatobject_property_add_child()can fail only when we got a parent already, and ignoring that error does what we want. True. If it failed due to "duplicate property", we'd be in trouble, but that would be a programming error.
Quoted 3 lines
device_set_realized()is cleaner: it checks whether we need a parent, then callsobject_property_add_child(), aborting on failure. No need for a comment, and programming errors get caught.
I suppose it was not that obvious at the time of that comment :)
commit 615c4895703164134379b68214130dd502721174
Author: Andreas Färber <[email protected]> Date: Wed Jun 18 00:57:08 2014 -0700
irq: Slim conversion of qemu_irq to QOM
As a prequel to any big Pin refactoring plans, do an in-place conversion of qemu_irq to an Object, so that we can reference it in link<> properties.
commit 02757df2ad2d5dfc96482e2cdfa046f439dafc3d
Author: Peter Crosthwaite <[email protected]> Date: Thu Sep 25 22:20:25 2014 -0700
qdev: gpio: Re-implement qdev_connect_gpio QOM style
Re-implement as a link setter. This should allow the QOM framework to keep track of ref counts properly etc.
We need to add a default parent for the connecting input in case it's coming from a non-qdev source. We simply parent the IRQ to the machine in this case.
Quoted 5 lines
Change
qdev_connect_gpio_out_named()to match.Cc Peter Crosthwaite <[email protected]>Signed-off-by Markus Armbruster <[email protected]>
Quoted 29 lines
--- hw/core/qdev.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)hw/core/qdev.c +4
-7@@ -541,15 +541,12 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n, {char *propname =g_strdup_printf ("%s[%d]" , name ? name :"unnamed-gpio-out" , n); -if (pin) { -/* We need a name for object_property_set_link to work. If the -* object has a parent, object_property_add_child will come back -* with an error without doing anything. If it has none, it will -* never fail. So we can just call it with a NULL Error pointer. -*/ +if (pin && !OBJECT (pin)->parent) { +/* We need a name for object_property_set_link to work */ object_property_add_child (container_get (qdev_get_machine (),"/unattached" ), -"non-qdev-gpio[*]" ,OBJECT (pin),NULL ); +"non-qdev-gpio[*]" ,OBJECT (pin), + &error_abort); }object_property_set_link (OBJECT (dev),OBJECT (pin), propname, &error_abort);g_free (propname);
Re: [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes,eaes}-256
In reply to Markus Armbruster[...]
Quoted 11 lines
1 "msa4-base": true, 1 "pcc-cmac-aes-256": false, 1 "pcc-cmac-eaes-256": false,The grouping and masking you described appears to apply to query-cpu-model-expansion with type "static". With type "full", I can see the grouping, but not the masking. With query-cpu-definitions, I can't see either.
I haven't played with query-cpu-model-comparison and query-cpu-model-baseline.
Grouping will be done whenever all features part of a group are to be reported. Please note that "msa4-base" is part of "msa4".
You chose the only model where we do have msa4-base but none of the other msa4 features - the qemu model.
So when you do a "query-cpu-definitions" under TCG (which basically maps to the qemu model and only has the msa4-base feature), then you do have msa4-base of all relevant models, but none of the other sub-features they define. That's why you don't see msa4 explicitly, but instead the subfeatures.
query-cpu-model-expansion and the others behave similar the same way with the "qemu" model. Note that the qemu model is not really used under KVM on s390x. There, we use "host" as default.
Quoted 40 lines
Quoted 9 lines
Quoted 4 lines
But "'-cpu' setup" doesn't seem to be about reporting features. Am I confused?
Let me clarify. Any user input would be broken if the two sub-features would be specified explicitly, instead of the whole "msa4" group. This applies to any user input, also the user input for query-cpu-model-.
Quoted 7 lines
In the usual cases, libvirt will expand a cpu model (e.g., "host", "z15") and start QEMU with that (-cpu ...). We will only have the complete msa4 group here in practice.
Yes, if some user would pick and chose such features manually, it would be broken - it's just not the common on s390x with the huge amount of features. But that's why I thing stable backports still make sense.
The commit message should be accurate and sufficiently precise. The "sufficiently" gives me some wiggle room to avoid inaccuracy due to my ignorance. Would the following be good enough?
Impact:
*
s390_feat_bitmap_to_ascii()misidentifiesS390_FEAT_PCC_CMAC_AES_256as "pcc-cmac-eaes-256". Affects QMP commands query-cpu-definitions, query-cpu-model-expansion, query-cpu-model-baseline, query-cpu-model-comparison, and the error message whens390_realize_cpu_model()fails incheck_compatibility().*
s390_cpu_list()also misidentifies it. Affects -cpu help.*
s390_cpu_model_register_props()creates CPU property "pcc-cmac-eaes-256" twice. The second one fails, but the error is ignored (a later commit will change that). Results in a single property "pcc-cmac-eaes-256" with the description forS390_FEAT_PCC_CMAC_AES_256, and no property forS390_FEAT_PCC_CMAC_EAES_256. CPU properties are visible in CLI -cpu and -device, QMP & HMPdevice_add, QMP device-list-properties, and QOM introspection.
Quoted 2 lines
The two features are almost always used via their group msa4. Such use is not affected by this bug.
Yeah, sounds good, thanks.
Signature · 3 lines
Thanks, David / dhildenb
Re: [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256
Quoted 11 lines · David Hildenbrand
[...]
Quoted 9 lines
1 "msa4-base": true, 1 "pcc-cmac-aes-256": false, 1 "pcc-cmac-eaes-256": false,The grouping and masking you described appears to apply to query-cpu-model-expansion with type "static". With type "full", I can see the grouping, but not the masking. With query-cpu-definitions, I can't see either.
Quoted 8 lines
Quoted 2 lines
I haven't played with query-cpu-model-comparison and query-cpu-model-baseline.
Grouping will be done whenever all features part of a group are to be reported. Please note that "msa4-base" is part of "msa4".
You chose the only model where we do have msa4-base but none of the other msa4 features - the qemu model.
Ah, "lucky" random pick.
Quoted 9 lines
So when you do a "query-cpu-definitions" under TCG (which basically maps to the qemu model and only has the msa4-base feature), then you do have msa4-base of all relevant models, but none of the other sub-features they define. That's why you don't see msa4 explicitly, but instead the subfeatures.
query-cpu-model-expansion and the others behave similar the same way with the "qemu" model. Note that the qemu model is not really used under KVM on s390x. There, we use "host" as default.
Next random pick: z13.2 shows msa4 before and after.
Quoted 39 lines
Quoted 39 lines
Quoted 8 lines
Quoted 3 lines
But "'-cpu' setup" doesn't seem to be about reporting features. Am I confused?
Let me clarify. Any user input would be broken if the two sub-features would be specified explicitly, instead of the whole "msa4" group. This applies to any user input, also the user input for query-cpu-model-.
Quoted 7 lines
In the usual cases, libvirt will expand a cpu model (e.g., "host", "z15") and start QEMU with that (-cpu ...). We will only have the complete msa4 group here in practice.
Yes, if some user would pick and chose such features manually, it would be broken - it's just not the common on s390x with the huge amount of features. But that's why I thing stable backports still make sense.
The commit message should be accurate and sufficiently precise. The "sufficiently" gives me some wiggle room to avoid inaccuracy due to my ignorance. Would the following be good enough?
Impact:
*
s390_feat_bitmap_to_ascii()misidentifiesS390_FEAT_PCC_CMAC_AES_256as "pcc-cmac-eaes-256". Affects QMP commands query-cpu-definitions, query-cpu-model-expansion, query-cpu-model-baseline, query-cpu-model-comparison, and the error message whens390_realize_cpu_model()fails incheck_compatibility().*
s390_cpu_list()also misidentifies it. Affects -cpu help.*
s390_cpu_model_register_props()creates CPU property "pcc-cmac-eaes-256" twice. The second one fails, but the error is ignored (a later commit will change that). Results in a single property "pcc-cmac-eaes-256" with the description forS390_FEAT_PCC_CMAC_AES_256, and no property forS390_FEAT_PCC_CMAC_EAES_256. CPU properties are visible in CLI -cpu and -device, QMP & HMPdevice_add, QMP device-list-properties, and QOM introspection.
Quoted 4 lines
Quoted 2 lines
The two features are almost always used via their group msa4. Such use is not affected by this bug.
Yeah, sounds good, thanks.
Excellent.
Re: [PATCH 12/17] qdev: Clean up qdev_connect_gpio_out_named()
In reply to Philippe Mathieu-DaudéQuoted 10 lines · Philippe Mathieu-Daudé
Quoted 9 lines · Markus Armbruster
Both
qdev_connect_gpio_out_named()anddevice_set_realized()put objects without a parent into the "/machine/unattached/" orphanage.
qdev_connect_gpio_out_named()needs a lengthy comment to explain how it works. It exploits thatobject_property_add_child()can fail only when we got a parent already, and ignoring that error does what we want. True. If it failed due to "duplicate property", we'd be in trouble, but that would be a programming error.
Quoted 5 lines
Quoted 3 lines
device_set_realized()is cleaner: it checks whether we need a parent, then callsobject_property_add_child(), aborting on failure. No need for a comment, and programming errors get caught.I suppose it was not that obvious at the time of that comment :)
Safe guess :)
Quoted 25 lines
commit
615c4895703164134379b68214130dd502721174Author: Andreas Färber <[email protected]> Date: Wed Jun 18 00:57:08 2014 -0700irq: Slim conversion of
qemu_irqto QOMAs a prequel to any big Pin refactoring plans, do an in-place conversion of
qemu_irqto an Object, so that we can reference it in link<> properties.commit
02757df2ad2d5dfc96482e2cdfa046f439dafc3dAuthor: Peter Crosthwaite <[email protected]> Date: Thu Sep 25 22:20:25 2014 -0700qdev: gpio: Re-implement
qdev_connect_gpioQOM styleRe-implement as a link setter. This should allow the QOM framework to keep track of ref counts properly etc.
We need to add a default parent for the connecting input in case it's coming from a non-qdev source. We simply parent the IRQ to the machine in this case.
Quoted 1 line
Quoted 6 lines
Quoted 4 lines
Change
qdev_connect_gpio_out_named()to match.Cc Peter Crosthwaite <[email protected]>Signed-off-by Markus Armbruster <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Thanks!