From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499150748720384.11681247988065; Mon, 3 Jul 2017 23:45:48 -0700 (PDT) Received: from localhost ([::1]:38888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHal-0005cs-A8 for importer@patchew.org; Tue, 04 Jul 2017 02:45:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZ0-0003nH-7H for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:43:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHYw-0002u2-Rb for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:43:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49432) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHYw-0002sl-Hl for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:43:54 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65588C0587DE for ; Tue, 4 Jul 2017 06:43:53 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC7D95C469; Tue, 4 Jul 2017 06:43:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 65588C0587DE Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 65588C0587DE From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:28 +0800 Message-Id: <20170704064347.7022-2-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 04 Jul 2017 06:43:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 01/20] qom: enforce readonly nature of link's check callback X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Igor Mammedov link's check callback is supposed to verify/permit setting it, however currently nothing restricts it from misusing it and modifying target object from within. Make sure that readonly semantics are checked by compiler to prevent callback's misuse. Signed-off-by: Igor Mammedov Signed-off-by: Fam Zheng --- hw/core/qdev-properties.c | 3 ++- hw/display/xlnx_dp.c | 2 +- hw/ipmi/ipmi.c | 2 +- hw/mem/pc-dimm.c | 2 +- hw/misc/ivshmem.c | 2 +- hw/virtio/virtio-crypto.c | 2 +- include/hw/qdev-properties.h | 3 ++- include/qom/object.h | 6 +++--- qom/object.c | 8 ++++---- 9 files changed, 16 insertions(+), 14 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index f11d578..113ce7d 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -25,7 +25,8 @@ void qdev_prop_set_after_realize(DeviceState *dev, const = char *name, } } =20 -void qdev_prop_allow_set_link_before_realize(Object *obj, const char *name, +void qdev_prop_allow_set_link_before_realize(const Object *obj, + const char *name, Object *val, Error **errp) { DeviceState *dev =3D DEVICE(obj); diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c index f7b7b80..e99bba4 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -515,7 +515,7 @@ static void xlnx_dp_aux_set_command(XlnxDPState *s, uin= t32_t value) s->core_registers[DP_INTERRUPT_SIGNAL_STATE] |=3D 0x04; } =20 -static void xlnx_dp_set_dpdma(Object *obj, const char *name, Object *val, +static void xlnx_dp_set_dpdma(const Object *obj, const char *name, Object = *val, Error **errp) { XlnxDPState *s =3D XLNX_DP(obj); diff --git a/hw/ipmi/ipmi.c b/hw/ipmi/ipmi.c index afafe14..b27babd 100644 --- a/hw/ipmi/ipmi.c +++ b/hw/ipmi/ipmi.c @@ -90,7 +90,7 @@ static TypeInfo ipmi_interface_type_info =3D { .class_init =3D ipmi_interface_class_init, }; =20 -static void isa_ipmi_bmc_check(Object *obj, const char *name, +static void isa_ipmi_bmc_check(const Object *obj, const char *name, Object *val, Error **errp) { IPMIBmc *bmc =3D IPMI_BMC(val); diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index b72258e..5e23495 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -367,7 +367,7 @@ static void pc_dimm_get_size(Object *obj, Visitor *v, c= onst char *name, visit_type_uint64(v, name, &value, errp); } =20 -static void pc_dimm_check_memdev_is_busy(Object *obj, const char *name, +static void pc_dimm_check_memdev_is_busy(const Object *obj, const char *na= me, Object *val, Error **errp) { Error *local_err =3D NULL; diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 2f0819d..97beaf6 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -1009,7 +1009,7 @@ static const TypeInfo ivshmem_common_info =3D { .class_init =3D ivshmem_common_class_init, }; =20 -static void ivshmem_check_memdev_is_busy(Object *obj, const char *name, +static void ivshmem_check_memdev_is_busy(const Object *obj, const char *na= me, Object *val, Error **errp) { if (host_memory_backend_is_mapped(MEMORY_BACKEND(val))) { diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c index 0353eb6..2590893 100644 --- a/hw/virtio/virtio-crypto.c +++ b/hw/virtio/virtio-crypto.c @@ -889,7 +889,7 @@ static void virtio_crypto_class_init(ObjectClass *klass= , void *data) } =20 static void -virtio_crypto_check_cryptodev_is_used(Object *obj, const char *name, +virtio_crypto_check_cryptodev_is_used(const Object *obj, const char *name, Object *val, Error **errp) { if (cryptodev_backend_is_used(CRYPTODEV_BACKEND(val))) { diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 0604c33..9edded2 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -272,7 +272,8 @@ void qdev_prop_set_after_realize(DeviceState *dev, cons= t char *name, * This function should be used as the check() argument to * object_property_add_link(). */ -void qdev_prop_allow_set_link_before_realize(Object *obj, const char *name, +void qdev_prop_allow_set_link_before_realize(const Object *obj, + const char *name, Object *val, Error **errp); =20 #endif diff --git a/include/qom/object.h b/include/qom/object.h index abaeb8c..1b82899 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -764,7 +764,7 @@ ObjectClass *object_get_class(Object *obj); * * Returns: The QOM typename of @obj. */ -const char *object_get_typename(Object *obj); +const char *object_get_typename(const Object *obj); =20 /** * type_register_static: @@ -1319,7 +1319,7 @@ typedef enum { * callback function. It allows the link property to be set and never ret= urns * an error. */ -void object_property_allow_set_link(Object *, const char *, +void object_property_allow_set_link(const Object *, const char *, Object *, Error **); =20 /** @@ -1352,7 +1352,7 @@ void object_property_allow_set_link(Object *, const c= har *, */ void object_property_add_link(Object *obj, const char *name, const char *type, Object **child, - void (*check)(Object *obj, const char *name, + void (*check)(const Object *obj, const char = *name, Object *val, Error **errp), ObjectPropertyLinkFlags flags, Error **errp); diff --git a/qom/object.c b/qom/object.c index 5f6fdfa..dfdbd50 100644 --- a/qom/object.c +++ b/qom/object.c @@ -740,7 +740,7 @@ out: return ret; } =20 -const char *object_get_typename(Object *obj) +const char *object_get_typename(const Object *obj) { return obj->class->type->name; } @@ -1428,7 +1428,7 @@ out: g_free(type); } =20 -void object_property_allow_set_link(Object *obj, const char *name, +void object_property_allow_set_link(const Object *obj, const char *name, Object *val, Error **errp) { /* Allow the link to be set, always */ @@ -1436,7 +1436,7 @@ void object_property_allow_set_link(Object *obj, cons= t char *name, =20 typedef struct { Object **child; - void (*check)(Object *, const char *, Object *, Error **); + void (*check)(const Object *, const char *, Object *, Error **); ObjectPropertyLinkFlags flags; } LinkProperty; =20 @@ -1552,7 +1552,7 @@ static void object_release_link_property(Object *obj,= const char *name, =20 void object_property_add_link(Object *obj, const char *name, const char *type, Object **child, - void (*check)(Object *, const char *, + void (*check)(const Object *, const char *, Object *, Error **), ObjectPropertyLinkFlags flags, Error **errp) --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499150993519998.5649520651464; Mon, 3 Jul 2017 23:49:53 -0700 (PDT) Received: from localhost ([::1]:38901 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHeh-0000sn-41 for importer@patchew.org; Tue, 04 Jul 2017 02:49:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZ0-0003nI-7V for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:43:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHYz-0002vX-1e for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:43:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59926) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHYy-0002un-O7 for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:43:56 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A6C2761E4B for ; Tue, 4 Jul 2017 06:43:55 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17D0063F66; Tue, 4 Jul 2017 06:43:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A6C2761E4B Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A6C2761E4B From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:29 +0800 Message-Id: <20170704064347.7022-3-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 04 Jul 2017 06:43:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 02/20] qdev: Introduce PropertyInfo.create X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This allows property implementation to provide a specialized property creation method. Update conditions guarding property types accordingly. Signed-off-by: Fam Zheng --- hw/core/qdev.c | 31 +++++++++++++++++++------------ include/hw/qdev-core.h | 1 + qmp.c | 2 +- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 849952a..ec63fe0 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -744,6 +744,10 @@ static void qdev_property_add_legacy(DeviceState *dev,= Property *prop, return; } =20 + if (prop->info->create) { + return; + } + name =3D g_strdup_printf("legacy-%s", prop->name); object_property_add(OBJECT(dev), name, "str", prop->info->print ? qdev_get_legacy_property : pro= p->info->get, @@ -770,20 +774,23 @@ void qdev_property_add_static(DeviceState *dev, Prope= rty *prop, Error *local_err =3D NULL; Object *obj =3D OBJECT(dev); =20 - /* - * TODO qdev_prop_ptr does not have getters or setters. It must - * go now that it can be replaced with links. The test should be - * removed along with it: all static properties are read/write. - */ - if (!prop->info->get && !prop->info->set) { - return; + if (prop->info->create) { + prop->info->create(obj, prop, &local_err); + } else { + /* + * TODO qdev_prop_ptr does not have getters or setters. It must + * go now that it can be replaced with links. The test should be + * removed along with it: all static properties are read/write. + */ + if (!prop->info->get && !prop->info->set) { + return; + } + object_property_add(obj, prop->name, prop->info->name, + prop->info->get, prop->info->set, + prop->info->release, + prop, &local_err); } =20 - object_property_add(obj, prop->name, prop->info->name, - prop->info->get, prop->info->set, - prop->info->release, - prop, &local_err); - if (local_err) { error_propagate(errp, local_err); return; diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 9d7c1c0..33518ee 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -241,6 +241,7 @@ struct PropertyInfo { const char * const *enum_table; int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len); void (*set_default_value)(Object *obj, const Property *prop); + void (*create)(Object *obj, Property *prop, Error **errp); ObjectPropertyAccessor *get; ObjectPropertyAccessor *set; ObjectPropertyRelease *release; diff --git a/qmp.c b/qmp.c index 7ee9bcf..133fdfc 100644 --- a/qmp.c +++ b/qmp.c @@ -490,7 +490,7 @@ static DevicePropertyInfo *make_device_property_info(Ob= jectClass *klass, * for removal. This conditional should be removed along with * it. */ - if (!prop->info->set) { + if (!prop->info->set && !prop->info->create) { return NULL; /* no way to set it, don't show */ } =20 --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14991511332161019.0132398877248; Mon, 3 Jul 2017 23:52:13 -0700 (PDT) Received: from localhost ([::1]:38913 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHgy-0002u1-31 for importer@patchew.org; Tue, 04 Jul 2017 02:52:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41582) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZ2-0003qQ-1K for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZ1-0002wl-5T for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:43:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49546) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZ0-0002w4-Rs for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:43:59 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C83CEC0587FA for ; Tue, 4 Jul 2017 06:43:57 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D11363F69; Tue, 4 Jul 2017 06:43:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C83CEC0587FA Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C83CEC0587FA From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:30 +0800 Message-Id: <20170704064347.7022-4-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 04 Jul 2017 06:43:57 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 03/20] qdev: Introduce DEFINE_PROP_LINK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This property can be used to replace the object_property_add_link in device code, to add a link to other objects, which is a common pattern. Signed-off-by: Fam Zheng --- hw/core/qdev-properties.c | 18 ++++++++++++++++++ include/hw/qdev-core.h | 1 + include/hw/qdev-properties.h | 9 +++++++++ 3 files changed, 28 insertions(+) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 113ce7d..5429c63 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1214,3 +1214,21 @@ PropertyInfo qdev_prop_size =3D { .set =3D set_size, .set_default_value =3D set_default_value_uint, }; + +/* --- object link property --- */ + +static void create_link_property(Object *obj, Property *prop, Error **errp) +{ + Object **child =3D qdev_get_prop_ptr(DEVICE(obj), prop); + + object_property_add_link(obj, prop->name, prop->link_type, + child, + qdev_prop_allow_set_link_before_realize, + OBJ_PROP_LINK_UNREF_ON_RELEASE, + errp); +} + +PropertyInfo qdev_prop_link =3D { + .name =3D "link", + .create =3D create_link_property, +}; diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 33518ee..08d1d2c 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -233,6 +233,7 @@ struct Property { int arrayoffset; PropertyInfo *arrayinfo; int arrayfieldsize; + const char *link_type; }; =20 struct PropertyInfo { diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 9edded2..b150378 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -30,6 +30,7 @@ extern PropertyInfo qdev_prop_pci_devfn; extern PropertyInfo qdev_prop_blocksize; extern PropertyInfo qdev_prop_pci_host_devaddr; extern PropertyInfo qdev_prop_arraylen; +extern PropertyInfo qdev_prop_link; =20 #define DEFINE_PROP(_name, _state, _field, _prop, _type) { \ .name =3D (_name), \ @@ -117,6 +118,14 @@ extern PropertyInfo qdev_prop_arraylen; .arrayoffset =3D offsetof(_state, _arrayfield), \ } =20 +#define DEFINE_PROP_LINK(_name, _state, _field, _type) {\ + .name =3D (_name), \ + .info =3D &(qdev_prop_link), \ + .offset =3D offsetof(_state, _field) \ + + type_check(Object *, typeof_field(_state, _field)), \ + .link_type =3D _type, \ + } + #define DEFINE_PROP_UINT8(_n, _s, _f, _d) \ DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint8, uint8_t) #define DEFINE_PROP_UINT16(_n, _s, _f, _d) \ --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499150750925167.96313893543982; Mon, 3 Jul 2017 23:45:50 -0700 (PDT) Received: from localhost ([::1]:38889 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHan-0005fC-Oc for importer@patchew.org; Tue, 04 Jul 2017 02:45:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZ3-0003sU-VY for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZ3-0002xo-3j for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55590) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZ2-0002xL-Tu for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:01 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DED9180478 for ; Tue, 4 Jul 2017 06:43:59 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4877C5C469; Tue, 4 Jul 2017 06:43:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DED9180478 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DED9180478 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:31 +0800 Message-Id: <20170704064347.7022-5-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 04 Jul 2017 06:44:00 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 04/20] qmp: Use ObjectProperty.type if present X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The dynamic value is more informative in the case of link property, otherwise it is the same. Signed-off-by: Fam Zheng --- qmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qmp.c b/qmp.c index 133fdfc..9f8a167 100644 --- a/qmp.c +++ b/qmp.c @@ -496,7 +496,8 @@ static DevicePropertyInfo *make_device_property_info(Ob= jectClass *klass, =20 info =3D g_malloc0(sizeof(*info)); info->name =3D g_strdup(prop->name); - info->type =3D g_strdup(prop->info->name); + info->type =3D default_type ? g_strdup(default_type) + : g_strdup(prop->info->name); info->has_description =3D !!prop->info->description; info->description =3D g_strdup(prop->info->description); return info; --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499150921720785.027751281631; Mon, 3 Jul 2017 23:48:41 -0700 (PDT) Received: from localhost ([::1]:38898 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHdX-0007lK-D8 for importer@patchew.org; Tue, 04 Jul 2017 02:48:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZ7-0003wT-Gs for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZ5-0002zN-LO for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60978) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZ5-0002yl-CQ for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:03 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 520E67D0C3 for ; Tue, 4 Jul 2017 06:44:02 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 541465C469; Tue, 4 Jul 2017 06:44:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 520E67D0C3 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 520E67D0C3 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:32 +0800 Message-Id: <20170704064347.7022-6-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 04 Jul 2017 06:44:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 05/20] qdev: Add const qualifier to PropertyInfo definitions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The remaining non-const ones are in e1000e which modifies description at runtime. They can be addressed separatedly. Signed-off-by: Fam Zheng --- hw/core/qdev-properties-system.c | 8 +++---- hw/core/qdev-properties.c | 44 +++++++++++++++++----------------- hw/s390x/css.c | 4 ++-- hw/s390x/s390-pci-bus.c | 2 +- include/hw/qdev-core.h | 4 ++-- include/hw/qdev-properties.h | 52 ++++++++++++++++++++----------------= ---- include/hw/s390x/css.h | 4 ++-- target/i386/cpu.c | 2 +- target/ppc/translate_init.c | 2 +- 9 files changed, 61 insertions(+), 61 deletions(-) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 3bef419..ec10da7 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -159,7 +159,7 @@ static void set_drive(Object *obj, Visitor *v, const ch= ar *name, void *opaque, set_pointer(obj, v, opaque, parse_drive, name, errp); } =20 -PropertyInfo qdev_prop_drive =3D { +const PropertyInfo qdev_prop_drive =3D { .name =3D "str", .description =3D "Node name or ID of a block device to use as a backen= d", .get =3D get_drive, @@ -228,7 +228,7 @@ static void release_chr(Object *obj, const char *name, = void *opaque) qemu_chr_fe_deinit(be, false); } =20 -PropertyInfo qdev_prop_chr =3D { +const PropertyInfo qdev_prop_chr =3D { .name =3D "str", .description =3D "ID of a chardev to use as a backend", .get =3D get_chr, @@ -313,7 +313,7 @@ out: g_free(str); } =20 -PropertyInfo qdev_prop_netdev =3D { +const PropertyInfo qdev_prop_netdev =3D { .name =3D "str", .description =3D "ID of a netdev to use as a backend", .get =3D get_netdev, @@ -393,7 +393,7 @@ static void set_vlan(Object *obj, Visitor *v, const cha= r *name, void *opaque, *ptr =3D hubport; } =20 -PropertyInfo qdev_prop_vlan =3D { +const PropertyInfo qdev_prop_vlan =3D { .name =3D "int32", .description =3D "Integer VLAN id to connect to", .print =3D print_vlan, diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 5429c63..f22bd71 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -132,7 +132,7 @@ static void set_default_value_bool(Object *obj, const P= roperty *prop) object_property_set_bool(obj, prop->defval.u, prop->name, &error_abort= ); } =20 -PropertyInfo qdev_prop_bit =3D { +const PropertyInfo qdev_prop_bit =3D { .name =3D "bool", .description =3D "on/off", .get =3D prop_get_bit, @@ -191,7 +191,7 @@ static void prop_set_bit64(Object *obj, Visitor *v, con= st char *name, bit64_prop_set(dev, prop, value); } =20 -PropertyInfo qdev_prop_bit64 =3D { +const PropertyInfo qdev_prop_bit64 =3D { .name =3D "bool", .description =3D "on/off", .get =3D prop_get_bit64, @@ -226,7 +226,7 @@ static void set_bool(Object *obj, Visitor *v, const cha= r *name, void *opaque, visit_type_bool(v, name, ptr, errp); } =20 -PropertyInfo qdev_prop_bool =3D { +const PropertyInfo qdev_prop_bool =3D { .name =3D "bool", .get =3D get_bool, .set =3D set_bool, @@ -270,7 +270,7 @@ static void set_default_value_uint(Object *obj, const P= roperty *prop) object_property_set_uint(obj, prop->defval.u, prop->name, &error_abort= ); } =20 -PropertyInfo qdev_prop_uint8 =3D { +const PropertyInfo qdev_prop_uint8 =3D { .name =3D "uint8", .get =3D get_uint8, .set =3D set_uint8, @@ -304,7 +304,7 @@ static void set_uint16(Object *obj, Visitor *v, const c= har *name, visit_type_uint16(v, name, ptr, errp); } =20 -PropertyInfo qdev_prop_uint16 =3D { +const PropertyInfo qdev_prop_uint16 =3D { .name =3D "uint16", .get =3D get_uint16, .set =3D set_uint16, @@ -363,14 +363,14 @@ static void set_int32(Object *obj, Visitor *v, const = char *name, void *opaque, visit_type_int32(v, name, ptr, errp); } =20 -PropertyInfo qdev_prop_uint32 =3D { +const PropertyInfo qdev_prop_uint32 =3D { .name =3D "uint32", .get =3D get_uint32, .set =3D set_uint32, .set_default_value =3D set_default_value_uint, }; =20 -PropertyInfo qdev_prop_int32 =3D { +const PropertyInfo qdev_prop_int32 =3D { .name =3D "int32", .get =3D get_int32, .set =3D set_int32, @@ -404,7 +404,7 @@ static void set_uint64(Object *obj, Visitor *v, const c= har *name, visit_type_uint64(v, name, ptr, errp); } =20 -PropertyInfo qdev_prop_uint64 =3D { +const PropertyInfo qdev_prop_uint64 =3D { .name =3D "uint64", .get =3D get_uint64, .set =3D set_uint64, @@ -457,7 +457,7 @@ static void set_string(Object *obj, Visitor *v, const c= har *name, *ptr =3D str; } =20 -PropertyInfo qdev_prop_string =3D { +const PropertyInfo qdev_prop_string =3D { .name =3D "str", .release =3D release_string, .get =3D get_string, @@ -467,7 +467,7 @@ PropertyInfo qdev_prop_string =3D { /* --- pointer --- */ =20 /* Not a proper property, just for dirty hacks. TODO Remove it! */ -PropertyInfo qdev_prop_ptr =3D { +const PropertyInfo qdev_prop_ptr =3D { .name =3D "ptr", }; =20 @@ -541,7 +541,7 @@ inval: g_free(str); } =20 -PropertyInfo qdev_prop_macaddr =3D { +const PropertyInfo qdev_prop_macaddr =3D { .name =3D "str", .description =3D "Ethernet 6-byte MAC Address, example: 52:54:00:12:34= :56", .get =3D get_mac, @@ -550,7 +550,7 @@ PropertyInfo qdev_prop_macaddr =3D { =20 /* --- on/off/auto --- */ =20 -PropertyInfo qdev_prop_on_off_auto =3D { +const PropertyInfo qdev_prop_on_off_auto =3D { .name =3D "OnOffAuto", .description =3D "on/off/auto", .enum_table =3D OnOffAuto_lookup, @@ -563,7 +563,7 @@ PropertyInfo qdev_prop_on_off_auto =3D { =20 QEMU_BUILD_BUG_ON(sizeof(LostTickPolicy) !=3D sizeof(int)); =20 -PropertyInfo qdev_prop_losttickpolicy =3D { +const PropertyInfo qdev_prop_losttickpolicy =3D { .name =3D "LostTickPolicy", .enum_table =3D LostTickPolicy_lookup, .get =3D get_enum, @@ -575,7 +575,7 @@ PropertyInfo qdev_prop_losttickpolicy =3D { =20 QEMU_BUILD_BUG_ON(sizeof(BlockdevOnError) !=3D sizeof(int)); =20 -PropertyInfo qdev_prop_blockdev_on_error =3D { +const PropertyInfo qdev_prop_blockdev_on_error =3D { .name =3D "BlockdevOnError", .description =3D "Error handling policy, " "report/ignore/enospc/stop/auto", @@ -589,7 +589,7 @@ PropertyInfo qdev_prop_blockdev_on_error =3D { =20 QEMU_BUILD_BUG_ON(sizeof(BiosAtaTranslation) !=3D sizeof(int)); =20 -PropertyInfo qdev_prop_bios_chs_trans =3D { +const PropertyInfo qdev_prop_bios_chs_trans =3D { .name =3D "BiosAtaTranslation", .description =3D "Logical CHS translation algorithm, " "auto/none/lba/large/rechs", @@ -601,7 +601,7 @@ PropertyInfo qdev_prop_bios_chs_trans =3D { =20 /* --- FDC default drive types */ =20 -PropertyInfo qdev_prop_fdc_drive_type =3D { +const PropertyInfo qdev_prop_fdc_drive_type =3D { .name =3D "FdcDriveType", .description =3D "FDC drive type, " "144/288/120/none/auto", @@ -677,7 +677,7 @@ static int print_pci_devfn(DeviceState *dev, Property *= prop, char *dest, } } =20 -PropertyInfo qdev_prop_pci_devfn =3D { +const PropertyInfo qdev_prop_pci_devfn =3D { .name =3D "int32", .description =3D "Slot and optional function number, example: 06.0 or = 06", .print =3D print_pci_devfn, @@ -726,7 +726,7 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t char *name, *ptr =3D value; } =20 -PropertyInfo qdev_prop_blocksize =3D { +const PropertyInfo qdev_prop_blocksize =3D { .name =3D "uint16", .description =3D "A power of two between 512 and 32768", .get =3D get_uint16, @@ -841,7 +841,7 @@ inval: g_free(str); } =20 -PropertyInfo qdev_prop_pci_host_devaddr =3D { +const PropertyInfo qdev_prop_pci_host_devaddr =3D { .name =3D "str", .description =3D "Address (bus/device/function) of " "the host device, example: 04:10.0", @@ -950,7 +950,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, = const char *name, } } =20 -PropertyInfo qdev_prop_arraylen =3D { +const PropertyInfo qdev_prop_arraylen =3D { .name =3D "uint32", .get =3D get_uint32, .set =3D set_prop_arraylen, @@ -1208,7 +1208,7 @@ static void set_size(Object *obj, Visitor *v, const c= har *name, void *opaque, visit_type_size(v, name, ptr, errp); } =20 -PropertyInfo qdev_prop_size =3D { +const PropertyInfo qdev_prop_size =3D { .name =3D "size", .get =3D get_size, .set =3D set_size, @@ -1228,7 +1228,7 @@ static void create_link_property(Object *obj, Propert= y *prop, Error **errp) errp); } =20 -PropertyInfo qdev_prop_link =3D { +const PropertyInfo qdev_prop_link =3D { .name =3D "link", .create =3D create_link_property, }; diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 599805d..1742d9b 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -2029,7 +2029,7 @@ out: g_free(str); } =20 -PropertyInfo css_devid_propinfo =3D { +const PropertyInfo css_devid_propinfo =3D { .name =3D "str", .description =3D "Identifier of an I/O device in the channel " "subsystem, example: fe.1.23ab", @@ -2037,7 +2037,7 @@ PropertyInfo css_devid_propinfo =3D { .set =3D set_css_devid, }; =20 -PropertyInfo css_devid_ro_propinfo =3D { +const PropertyInfo css_devid_ro_propinfo =3D { .name =3D "str", .description =3D "Read-only identifier of an I/O device in the channel= " "subsystem, example: fe.1.23ab", diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 5651483..061e0c6 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1018,7 +1018,7 @@ static void s390_pci_set_fid(Object *obj, Visitor *v,= const char *name, zpci->fid_defined =3D true; } =20 -static PropertyInfo s390_pci_fid_propinfo =3D { +static const PropertyInfo s390_pci_fid_propinfo =3D { .name =3D "zpci_fid", .get =3D s390_pci_get_fid, .set =3D s390_pci_set_fid, diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 08d1d2c..5348815 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -223,7 +223,7 @@ struct BusState { =20 struct Property { const char *name; - PropertyInfo *info; + const PropertyInfo *info; ptrdiff_t offset; uint8_t bitnr; union { @@ -231,7 +231,7 @@ struct Property { uint64_t u; } defval; int arrayoffset; - PropertyInfo *arrayinfo; + const PropertyInfo *arrayinfo; int arrayfieldsize; const char *link_type; }; diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index b150378..71b33b2 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -5,32 +5,32 @@ =20 /*** qdev-properties.c ***/ =20 -extern PropertyInfo qdev_prop_bit; -extern PropertyInfo qdev_prop_bit64; -extern PropertyInfo qdev_prop_bool; -extern PropertyInfo qdev_prop_uint8; -extern PropertyInfo qdev_prop_uint16; -extern PropertyInfo qdev_prop_uint32; -extern PropertyInfo qdev_prop_int32; -extern PropertyInfo qdev_prop_uint64; -extern PropertyInfo qdev_prop_size; -extern PropertyInfo qdev_prop_string; -extern PropertyInfo qdev_prop_chr; -extern PropertyInfo qdev_prop_ptr; -extern PropertyInfo qdev_prop_macaddr; -extern PropertyInfo qdev_prop_on_off_auto; -extern PropertyInfo qdev_prop_losttickpolicy; -extern PropertyInfo qdev_prop_blockdev_on_error; -extern PropertyInfo qdev_prop_bios_chs_trans; -extern PropertyInfo qdev_prop_fdc_drive_type; -extern PropertyInfo qdev_prop_drive; -extern PropertyInfo qdev_prop_netdev; -extern PropertyInfo qdev_prop_vlan; -extern PropertyInfo qdev_prop_pci_devfn; -extern PropertyInfo qdev_prop_blocksize; -extern PropertyInfo qdev_prop_pci_host_devaddr; -extern PropertyInfo qdev_prop_arraylen; -extern PropertyInfo qdev_prop_link; +extern const PropertyInfo qdev_prop_bit; +extern const PropertyInfo qdev_prop_bit64; +extern const PropertyInfo qdev_prop_bool; +extern const PropertyInfo qdev_prop_uint8; +extern const PropertyInfo qdev_prop_uint16; +extern const PropertyInfo qdev_prop_uint32; +extern const PropertyInfo qdev_prop_int32; +extern const PropertyInfo qdev_prop_uint64; +extern const PropertyInfo qdev_prop_size; +extern const PropertyInfo qdev_prop_string; +extern const PropertyInfo qdev_prop_chr; +extern const PropertyInfo qdev_prop_ptr; +extern const PropertyInfo qdev_prop_macaddr; +extern const PropertyInfo qdev_prop_on_off_auto; +extern const PropertyInfo qdev_prop_losttickpolicy; +extern const PropertyInfo qdev_prop_blockdev_on_error; +extern const PropertyInfo qdev_prop_bios_chs_trans; +extern const PropertyInfo qdev_prop_fdc_drive_type; +extern const PropertyInfo qdev_prop_drive; +extern const PropertyInfo qdev_prop_netdev; +extern const PropertyInfo qdev_prop_vlan; +extern const PropertyInfo qdev_prop_pci_devfn; +extern const PropertyInfo qdev_prop_blocksize; +extern const PropertyInfo qdev_prop_pci_host_devaddr; +extern const PropertyInfo qdev_prop_arraylen; +extern const PropertyInfo qdev_prop_link; =20 #define DEFINE_PROP(_name, _state, _field, _prop, _type) { \ .name =3D (_name), \ diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h index 596a2f2..8fdc2e1 100644 --- a/include/hw/s390x/css.h +++ b/include/hw/s390x/css.h @@ -109,7 +109,7 @@ typedef struct CssDevId { bool valid; } CssDevId; =20 -extern PropertyInfo css_devid_propinfo; +extern const PropertyInfo css_devid_propinfo; =20 #define DEFINE_PROP_CSS_DEV_ID(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, css_devid_propinfo, CssDevId) @@ -190,7 +190,7 @@ int css_do_rchp(uint8_t cssid, uint8_t chpid); bool css_present(uint8_t cssid); #endif =20 -extern PropertyInfo css_devid_ro_propinfo; +extern const PropertyInfo css_devid_ro_propinfo; =20 #define DEFINE_PROP_CSS_DEV_ID_RO(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, css_devid_ro_propinfo, CssDevId) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 642519a..fce277b 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1961,7 +1961,7 @@ static void x86_set_hv_spinlocks(Object *obj, Visitor= *v, const char *name, cpu->hyperv_spinlock_attempts =3D value; } =20 -static PropertyInfo qdev_prop_spinlocks =3D { +static const PropertyInfo qdev_prop_spinlocks =3D { .name =3D "int", .get =3D x86_get_hv_spinlocks, .set =3D x86_set_hv_spinlocks, diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index 783bf98..ae25faf 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -8435,7 +8435,7 @@ static void getset_compat_deprecated(Object *obj, Vis= itor *v, const char *name, visit_type_null(v, name, NULL); } =20 -static PropertyInfo ppc_compat_deprecated_propinfo =3D { +static const PropertyInfo ppc_compat_deprecated_propinfo =3D { .name =3D "str", .description =3D "compatibility mode (deprecated)", .get =3D getset_compat_deprecated, --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499151077609361.7746403313839; Mon, 3 Jul 2017 23:51:17 -0700 (PDT) Received: from localhost ([::1]:38911 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHg4-00027c-9U for importer@patchew.org; Tue, 04 Jul 2017 02:51:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZC-00041B-Jl for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZ7-00030N-Pw for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55384) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZ7-0002zu-HH for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:05 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7610731A34A for ; Tue, 4 Jul 2017 06:44:04 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC5F55C48E; Tue, 4 Jul 2017 06:44:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7610731A34A Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7610731A34A From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:33 +0800 Message-Id: <20170704064347.7022-7-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 04 Jul 2017 06:44:04 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 06/20] virtio-blk: Convert to DEFINE_PROP_LINK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- hw/block/dataplane/virtio-blk.c | 2 +- hw/block/virtio-blk.c | 5 +---- hw/s390x/virtio-ccw.c | 2 -- hw/virtio/virtio-pci.c | 2 -- include/hw/virtio/virtio-blk.h | 3 ++- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-bl= k.c index 5556f0e..6fdc6f6 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -116,7 +116,7 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, V= irtIOBlkConf *conf, s->conf =3D conf; =20 if (conf->iothread) { - s->iothread =3D conf->iothread; + s->iothread =3D IOTHREAD(conf->iothread); object_ref(OBJECT(s->iothread)); s->ctx =3D iothread_get_aio_context(s->iothread); } else { diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index c0bd247..8146306 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -983,10 +983,6 @@ static void virtio_blk_instance_init(Object *obj) { VirtIOBlock *s =3D VIRTIO_BLK(obj); =20 - object_property_add_link(obj, "iothread", TYPE_IOTHREAD, - (Object **)&s->conf.iothread, - qdev_prop_allow_set_link_before_realize, - OBJ_PROP_LINK_UNREF_ON_RELEASE, NULL); device_add_bootindex_property(obj, &s->conf.conf.bootindex, "bootindex", "/disk@0,0", DEVICE(obj), NULL); @@ -1014,6 +1010,7 @@ static Property virtio_blk_properties[] =3D { DEFINE_PROP_BIT("request-merging", VirtIOBlock, conf.request_merging, = 0, true), DEFINE_PROP_UINT16("num-queues", VirtIOBlock, conf.num_queues, 1), + DEFINE_PROP_LINK("iothread", VirtIOBlock, conf.iothread, TYPE_IOTHREAD= ), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 90d37cb..a17ce84 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -789,8 +789,6 @@ static void virtio_ccw_blk_instance_init(Object *obj) =20 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_BLK); - object_property_add_alias(obj, "iothread", OBJECT(&dev->vdev),"iothrea= d", - &error_abort); object_property_add_alias(obj, "bootindex", OBJECT(&dev->vdev), "bootindex", &error_abort); } diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 301920e..984baf8 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1996,8 +1996,6 @@ static void virtio_blk_pci_instance_init(Object *obj) =20 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_BLK); - object_property_add_alias(obj, "iothread", OBJECT(&dev->vdev),"iothrea= d", - &error_abort); object_property_add_alias(obj, "bootindex", OBJECT(&dev->vdev), "bootindex", &error_abort); } diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h index d3c8a6f..2452074 100644 --- a/include/hw/virtio/virtio-blk.h +++ b/include/hw/virtio/virtio-blk.h @@ -33,7 +33,8 @@ struct virtio_blk_inhdr struct VirtIOBlkConf { BlockConf conf; - IOThread *iothread; + /* IOThread pointer to be filled by link property */ + Object *iothread; char *serial; uint32_t scsi; uint32_t config_wce; --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499151069814386.2497082241259; Mon, 3 Jul 2017 23:51:09 -0700 (PDT) Received: from localhost ([::1]:38910 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHfw-00020r-H2 for importer@patchew.org; Tue, 04 Jul 2017 02:51:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZC-00041D-K7 for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZA-00031V-7g for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32904) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZ9-00031A-Uo for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:08 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2B587DCC8 for ; Tue, 4 Jul 2017 06:44:06 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 269AF5C48E; Tue, 4 Jul 2017 06:44:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E2B587DCC8 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E2B587DCC8 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:34 +0800 Message-Id: <20170704064347.7022-8-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 04 Jul 2017 06:44:07 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 07/20] virtio-scsi: Convert to DEFINE_PROP_LINK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- hw/s390x/virtio-ccw.c | 2 -- hw/scsi/virtio-scsi-dataplane.c | 2 +- hw/scsi/virtio-scsi.c | 13 ++----------- hw/virtio/virtio-pci.c | 2 -- include/hw/virtio/virtio-scsi.h | 3 ++- 5 files changed, 5 insertions(+), 17 deletions(-) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index a17ce84..9386893 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -872,8 +872,6 @@ static void virtio_ccw_scsi_instance_init(Object *obj) =20 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_SCSI); - object_property_add_alias(obj, "iothread", OBJECT(&dev->vdev), "iothre= ad", - &error_abort); } =20 #ifdef CONFIG_VHOST_SCSI diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplan= e.c index 944ea4e..887c100 100644 --- a/hw/scsi/virtio-scsi-dataplane.c +++ b/hw/scsi/virtio-scsi-dataplane.c @@ -40,7 +40,7 @@ void virtio_scsi_dataplane_setup(VirtIOSCSI *s, Error **e= rrp) error_setg(errp, "ioeventfd is required for iothread"); return; } - s->ctx =3D iothread_get_aio_context(vs->conf.iothread); + s->ctx =3D iothread_get_aio_context(IOTHREAD(vs->conf.iothread)); } else { if (!virtio_device_ioeventfd_enabled(vdev)) { return; diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index f46f06d..d48bcce 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -897,16 +897,6 @@ static void virtio_scsi_device_realize(DeviceState *de= v, Error **errp) virtio_scsi_dataplane_setup(s, errp); } =20 -static void virtio_scsi_instance_init(Object *obj) -{ - VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(obj); - - object_property_add_link(obj, "iothread", TYPE_IOTHREAD, - (Object **)&vs->conf.iothread, - qdev_prop_allow_set_link_before_realize, - OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); -} - void virtio_scsi_common_unrealize(DeviceState *dev, Error **errp) { VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); @@ -934,6 +924,8 @@ static Property virtio_scsi_properties[] =3D { VIRTIO_SCSI_F_HOTPLUG, true), DEFINE_PROP_BIT("param_change", VirtIOSCSI, host_features, VIRTIO_SCSI_F_CHANGE, true= ), + DEFINE_PROP_LINK("iothread", VirtIOSCSI, parent_obj.conf.iothread, + TYPE_IOTHREAD), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -988,7 +980,6 @@ static const TypeInfo virtio_scsi_info =3D { .name =3D TYPE_VIRTIO_SCSI, .parent =3D TYPE_VIRTIO_SCSI_COMMON, .instance_size =3D sizeof(VirtIOSCSI), - .instance_init =3D virtio_scsi_instance_init, .class_init =3D virtio_scsi_class_init, .interfaces =3D (InterfaceInfo[]) { { TYPE_HOTPLUG_HANDLER }, diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 984baf8..1eb61be 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -2065,8 +2065,6 @@ static void virtio_scsi_pci_instance_init(Object *obj) =20 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_SCSI); - object_property_add_alias(obj, "iothread", OBJECT(&dev->vdev), "iothre= ad", - &error_abort); } =20 static const TypeInfo virtio_scsi_pci_info =3D { diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scs= i.h index de6ae5a..9d9bb56 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -56,7 +56,8 @@ struct VirtIOSCSIConf { #endif CharBackend chardev; uint32_t boot_tpgt; - IOThread *iothread; + /* IOThread pointer to be filled by link property */ + Object *iothread; }; =20 struct VirtIOSCSI; --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499151210616550.4618930855008; Mon, 3 Jul 2017 23:53:30 -0700 (PDT) Received: from localhost ([::1]:38919 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHiD-0003sF-CE for importer@patchew.org; Tue, 04 Jul 2017 02:53:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZD-000429-Jz for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZC-00032W-IC for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55570) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZC-000327-8u for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:10 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 31DFA315D44 for ; Tue, 4 Jul 2017 06:44:09 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E26D5C469; Tue, 4 Jul 2017 06:44:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 31DFA315D44 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 31DFA315D44 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:35 +0800 Message-Id: <20170704064347.7022-9-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 04 Jul 2017 06:44:09 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 08/20] virtio-rng: Convert to DEFINE_PROP_LINK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- hw/s390x/virtio-ccw.c | 2 -- hw/virtio/virtio-pci.c | 2 -- hw/virtio/virtio-rng.c | 14 ++------------ include/hw/virtio/virtio-rng.h | 3 ++- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 9386893..bd4a9ea 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1546,8 +1546,6 @@ static void virtio_ccw_rng_instance_init(Object *obj) =20 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_RNG); - object_property_add_alias(obj, "rng", OBJECT(&dev->vdev), - "rng", &error_abort); } =20 static Property virtio_ccw_rng_properties[] =3D { diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 1eb61be..c76f3e5 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -2459,8 +2459,6 @@ static void virtio_rng_initfn(Object *obj) =20 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_RNG); - object_property_add_alias(obj, "rng", OBJECT(&dev->vdev), "rng", - &error_abort); } =20 static const TypeInfo virtio_rng_pci_info =3D { diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index a6ee501..4bfe9c5 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -199,7 +199,7 @@ static void virtio_rng_device_realize(DeviceState *dev,= Error **errp) "rng", NULL); } =20 - vrng->rng =3D vrng->conf.rng; + vrng->rng =3D RNG_BACKEND(vrng->conf.rng); if (vrng->rng =3D=3D NULL) { error_setg(errp, "'rng' parameter expects a valid object"); return; @@ -246,6 +246,7 @@ static Property virtio_rng_properties[] =3D { */ DEFINE_PROP_UINT64("max-bytes", VirtIORNG, conf.max_bytes, INT64_MAX), DEFINE_PROP_UINT32("period", VirtIORNG, conf.period_ms, 1 << 16), + DEFINE_PROP_LINK("rng", VirtIORNG, conf.rng, TYPE_RNG_BACKEND), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -262,21 +263,10 @@ static void virtio_rng_class_init(ObjectClass *klass,= void *data) vdc->get_features =3D get_features; } =20 -static void virtio_rng_initfn(Object *obj) -{ - VirtIORNG *vrng =3D VIRTIO_RNG(obj); - - object_property_add_link(obj, "rng", TYPE_RNG_BACKEND, - (Object **)&vrng->conf.rng, - qdev_prop_allow_set_link_before_realize, - OBJ_PROP_LINK_UNREF_ON_RELEASE, NULL); -} - static const TypeInfo virtio_rng_info =3D { .name =3D TYPE_VIRTIO_RNG, .parent =3D TYPE_VIRTIO_DEVICE, .instance_size =3D sizeof(VirtIORNG), - .instance_init =3D virtio_rng_initfn, .class_init =3D virtio_rng_class_init, }; =20 diff --git a/include/hw/virtio/virtio-rng.h b/include/hw/virtio/virtio-rng.h index 922dce7..f2f106b 100644 --- a/include/hw/virtio/virtio-rng.h +++ b/include/hw/virtio/virtio-rng.h @@ -23,7 +23,8 @@ OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_RNG) =20 struct VirtIORNGConf { - RngBackend *rng; + /* RngBackend pointer to be filled by link property */ + Object *rng; uint64_t max_bytes; uint32_t period_ms; RngRandom *default_backend; --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499151270893948.7451124607841; Mon, 3 Jul 2017 23:54:30 -0700 (PDT) Received: from localhost ([::1]:38921 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHjB-0005FI-FL for importer@patchew.org; Tue, 04 Jul 2017 02:54:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZG-00044d-1h for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZE-00033a-Pg for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47180) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZE-00033L-Fw for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:12 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 69DEF7F6A2 for ; Tue, 4 Jul 2017 06:44:11 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id D37C660470; Tue, 4 Jul 2017 06:44:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 69DEF7F6A2 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 69DEF7F6A2 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:36 +0800 Message-Id: <20170704064347.7022-10-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 04 Jul 2017 06:44:11 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 09/20] virtio-crypto: Convert to DEFINE_PROP_LINK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Unlike other object_property_add_link() occurrences in virtio devices, virtio-crypto checks the "in use" state of the linked backend object in addition to qdev_prop_allow_set_link_before_realize. To convert it without needing to specialize DEFINE_PROP_LINK which always uses the qdev callback, move the "in use" check to device realize time. Signed-off-by: Fam Zheng --- hw/s390x/virtio-ccw.c | 3 --- hw/virtio/virtio-crypto-pci.c | 2 -- hw/virtio/virtio-crypto.c | 56 +++++++++++++----------------------= ---- include/hw/virtio/virtio-crypto.h | 3 ++- 4 files changed, 21 insertions(+), 43 deletions(-) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index bd4a9ea..dfc55ba 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1592,9 +1592,6 @@ static void virtio_ccw_crypto_instance_init(Object *o= bj) ccw_dev->force_revision_1 =3D true; virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_CRYPTO); - - object_property_add_alias(obj, "cryptodev", OBJECT(&dev->vdev), - "cryptodev", &error_abort); } =20 static void virtio_ccw_crypto_class_init(ObjectClass *klass, void *data) diff --git a/hw/virtio/virtio-crypto-pci.c b/hw/virtio/virtio-crypto-pci.c index 422aca3..bf64996 100644 --- a/hw/virtio/virtio-crypto-pci.c +++ b/hw/virtio/virtio-crypto-pci.c @@ -62,8 +62,6 @@ static void virtio_crypto_initfn(Object *obj) =20 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_CRYPTO); - object_property_add_alias(obj, "cryptodev", OBJECT(&dev->vdev), - "cryptodev", &error_abort); } =20 static const TypeInfo virtio_crypto_pci_info =3D { diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c index 2590893..0c44fe1 100644 --- a/hw/virtio/virtio-crypto.c +++ b/hw/virtio/virtio-crypto.c @@ -753,22 +753,18 @@ static void virtio_crypto_reset(VirtIODevice *vdev) static void virtio_crypto_init_config(VirtIODevice *vdev) { VirtIOCrypto *vcrypto =3D VIRTIO_CRYPTO(vdev); + CryptoDevBackend *cryptodev =3D CRYPTODEV_BACKEND(vcrypto->conf.crypto= dev); =20 - vcrypto->conf.crypto_services =3D - vcrypto->conf.cryptodev->conf.crypto_services; - vcrypto->conf.cipher_algo_l =3D - vcrypto->conf.cryptodev->conf.cipher_algo_l; - vcrypto->conf.cipher_algo_h =3D - vcrypto->conf.cryptodev->conf.cipher_algo_h; - vcrypto->conf.hash_algo =3D vcrypto->conf.cryptodev->conf.hash_algo; - vcrypto->conf.mac_algo_l =3D vcrypto->conf.cryptodev->conf.mac_algo_l; - vcrypto->conf.mac_algo_h =3D vcrypto->conf.cryptodev->conf.mac_algo_h; - vcrypto->conf.aead_algo =3D vcrypto->conf.cryptodev->conf.aead_algo; - vcrypto->conf.max_cipher_key_len =3D - vcrypto->conf.cryptodev->conf.max_cipher_key_len; - vcrypto->conf.max_auth_key_len =3D - vcrypto->conf.cryptodev->conf.max_auth_key_len; - vcrypto->conf.max_size =3D vcrypto->conf.cryptodev->conf.max_size; + vcrypto->conf.crypto_services =3D cryptodev->conf.crypto_services; + vcrypto->conf.cipher_algo_l =3D cryptodev->conf.cipher_algo_l; + vcrypto->conf.cipher_algo_h =3D cryptodev->conf.cipher_algo_h; + vcrypto->conf.hash_algo =3D cryptodev->conf.hash_algo; + vcrypto->conf.mac_algo_l =3D cryptodev->conf.mac_algo_l; + vcrypto->conf.mac_algo_h =3D cryptodev->conf.mac_algo_h; + vcrypto->conf.aead_algo =3D cryptodev->conf.aead_algo; + vcrypto->conf.max_cipher_key_len =3D cryptodev->conf.max_cipher_key_le= n; + vcrypto->conf.max_auth_key_len =3D cryptodev->conf.max_auth_key_len; + vcrypto->conf.max_size =3D cryptodev->conf.max_size; } =20 static void virtio_crypto_device_realize(DeviceState *dev, Error **errp) @@ -776,11 +772,15 @@ static void virtio_crypto_device_realize(DeviceState = *dev, Error **errp) VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); VirtIOCrypto *vcrypto =3D VIRTIO_CRYPTO(dev); int i; - - vcrypto->cryptodev =3D vcrypto->conf.cryptodev; + vcrypto->cryptodev =3D CRYPTODEV_BACKEND(vcrypto->conf.cryptodev); if (vcrypto->cryptodev =3D=3D NULL) { error_setg(errp, "'cryptodev' parameter expects a valid object"); return; + } else if (cryptodev_backend_is_used(vcrypto->cryptodev)) { + char *path =3D object_get_canonical_path_component(vcrypto->conf.c= ryptodev); + error_setg(errp, "can't use already used cryptodev backend: %s", p= ath); + g_free(path); + return; } =20 vcrypto->max_queues =3D MAX(vcrypto->cryptodev->conf.peers.queues, 1); @@ -845,6 +845,8 @@ static const VMStateDescription vmstate_virtio_crypto = =3D { }; =20 static Property virtio_crypto_properties[] =3D { + DEFINE_PROP_LINK("cryptodev", VirtIOCrypto, conf.cryptodev, + TYPE_CRYPTODEV_BACKEND), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -888,20 +890,6 @@ static void virtio_crypto_class_init(ObjectClass *klas= s, void *data) vdc->reset =3D virtio_crypto_reset; } =20 -static void -virtio_crypto_check_cryptodev_is_used(const Object *obj, const char *name, - Object *val, Error **errp) -{ - if (cryptodev_backend_is_used(CRYPTODEV_BACKEND(val))) { - char *path =3D object_get_canonical_path_component(val); - error_setg(errp, - "can't use already used cryptodev backend: %s", path); - g_free(path); - } else { - qdev_prop_allow_set_link_before_realize(obj, name, val, errp); - } -} - static void virtio_crypto_instance_init(Object *obj) { VirtIOCrypto *vcrypto =3D VIRTIO_CRYPTO(obj); @@ -911,12 +899,6 @@ static void virtio_crypto_instance_init(Object *obj) * Can be overriden with virtio_crypto_set_config_size. */ vcrypto->config_size =3D sizeof(struct virtio_crypto_config); - - object_property_add_link(obj, "cryptodev", - TYPE_CRYPTODEV_BACKEND, - (Object **)&vcrypto->conf.cryptodev, - virtio_crypto_check_cryptodev_is_used, - OBJ_PROP_LINK_UNREF_ON_RELEASE, NULL); } =20 static const TypeInfo virtio_crypto_info =3D { diff --git a/include/hw/virtio/virtio-crypto.h b/include/hw/virtio/virtio-c= rypto.h index a00a0bf..d3db159 100644 --- a/include/hw/virtio/virtio-crypto.h +++ b/include/hw/virtio/virtio-crypto.h @@ -38,7 +38,8 @@ do { \ =20 =20 typedef struct VirtIOCryptoConf { - CryptoDevBackend *cryptodev; + /* CryptoDevBackend pointer to be filled by link property */ + Object *cryptodev; =20 /* Supported service mask */ uint32_t crypto_services; --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499151416862761.0504616433307; Mon, 3 Jul 2017 23:56:56 -0700 (PDT) Received: from localhost ([::1]:38936 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHlX-0007Xe-HY for importer@patchew.org; Tue, 04 Jul 2017 02:56:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZI-00045U-1D for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZG-00034W-Ls for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55846) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZG-000340-DP for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:14 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F6918553F for ; Tue, 4 Jul 2017 06:44:13 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05BA95C469; Tue, 4 Jul 2017 06:44:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5F6918553F Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5F6918553F From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:37 +0800 Message-Id: <20170704064347.7022-11-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 04 Jul 2017 06:44:13 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 10/20] dimm: Convert to DEFINE_PROP_LINK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Unlike the usual object_property_add_link() invocations in other devices, dimm checks the "is mapped" state of the backend in addition to qdev_prop_allow_set_link_before_realize. To convert it without specializing DEFINE_PROP_LINK which always uses the qdev general check callback, move the extra check to device realize time. Signed-off-by: Fam Zheng --- hw/mem/nvdimm.c | 11 +++++++---- hw/mem/pc-dimm.c | 42 ++++++++++++++---------------------------- include/hw/mem/pc-dimm.h | 3 ++- 3 files changed, 23 insertions(+), 33 deletions(-) diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c index db896b0..b22f271 100644 --- a/hw/mem/nvdimm.c +++ b/hw/mem/nvdimm.c @@ -80,7 +80,8 @@ static MemoryRegion *nvdimm_get_memory_region(PCDIMMDevic= e *dimm) =20 static void nvdimm_realize(PCDIMMDevice *dimm, Error **errp) { - MemoryRegion *mr =3D host_memory_backend_get_memory(dimm->hostmem, err= p); + MemoryRegion *mr =3D host_memory_backend_get_memory(MEMORY_BACKEND(dim= m->hostmem), + errp); NVDIMMDevice *nvdimm =3D NVDIMM(dimm); uint64_t align, pmem_size, size =3D memory_region_size(mr); =20 @@ -91,7 +92,7 @@ static void nvdimm_realize(PCDIMMDevice *dimm, Error **er= rp) pmem_size =3D QEMU_ALIGN_DOWN(pmem_size, align); =20 if (size <=3D nvdimm->label_size || !pmem_size) { - HostMemoryBackend *hostmem =3D dimm->hostmem; + HostMemoryBackend *hostmem =3D MEMORY_BACKEND(dimm->hostmem); char *path =3D object_get_canonical_path_component(OBJECT(hostmem)= ); =20 error_setg(errp, "the size of memdev %s (0x%" PRIx64 ") is too " @@ -136,14 +137,16 @@ static void nvdimm_write_label_data(NVDIMMDevice *nvd= imm, const void *buf, =20 memcpy(nvdimm->label_data + offset, buf, size); =20 - mr =3D host_memory_backend_get_memory(dimm->hostmem, &error_abort); + mr =3D host_memory_backend_get_memory(MEMORY_BACKEND(dimm->hostmem), + &error_abort); backend_offset =3D memory_region_size(mr) - nvdimm->label_size + offse= t; memory_region_set_dirty(mr, backend_offset, size); } =20 static MemoryRegion *nvdimm_get_vmstate_memory_region(PCDIMMDevice *dimm) { - return host_memory_backend_get_memory(dimm->hostmem, &error_abort); + return host_memory_backend_get_memory(MEMORY_BACKEND(dimm->hostmem), + &error_abort); } =20 static void nvdimm_class_init(ObjectClass *oc, void *data) diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index 5e23495..eb8deca 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -184,7 +184,7 @@ int qmp_pc_dimm_device_list(Object *obj, void *opaque) di->node =3D dimm->node; di->size =3D object_property_get_uint(OBJECT(dimm), PC_DIMM_SI= ZE_PROP, NULL); - di->memdev =3D object_get_canonical_path(OBJECT(dimm->hostmem)= ); + di->memdev =3D object_get_canonical_path(dimm->hostmem); =20 info->u.dimm.data =3D di; elem->value =3D info; @@ -350,6 +350,8 @@ static Property pc_dimm_properties[] =3D { DEFINE_PROP_UINT32(PC_DIMM_NODE_PROP, PCDIMMDevice, node, 0), DEFINE_PROP_INT32(PC_DIMM_SLOT_PROP, PCDIMMDevice, slot, PC_DIMM_UNASSIGNED_SLOT), + DEFINE_PROP_LINK(PC_DIMM_MEMDEV_PROP, PCDIMMDevice, hostmem, + TYPE_MEMORY_BACKEND), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -367,33 +369,10 @@ static void pc_dimm_get_size(Object *obj, Visitor *v,= const char *name, visit_type_uint64(v, name, &value, errp); } =20 -static void pc_dimm_check_memdev_is_busy(const Object *obj, const char *na= me, - Object *val, Error **errp) -{ - Error *local_err =3D NULL; - - if (host_memory_backend_is_mapped(MEMORY_BACKEND(val))) { - char *path =3D object_get_canonical_path_component(val); - error_setg(&local_err, "can't use already busy memdev: %s", path); - g_free(path); - } else { - qdev_prop_allow_set_link_before_realize(obj, name, val, &local_err= ); - } - - error_propagate(errp, local_err); -} - static void pc_dimm_init(Object *obj) { - PCDIMMDevice *dimm =3D PC_DIMM(obj); - object_property_add(obj, PC_DIMM_SIZE_PROP, "uint64", pc_dimm_get_size, NULL, NULL, NULL, &error_abort); - object_property_add_link(obj, PC_DIMM_MEMDEV_PROP, TYPE_MEMORY_BACKEND, - (Object **)&dimm->hostmem, - pc_dimm_check_memdev_is_busy, - OBJ_PROP_LINK_UNREF_ON_RELEASE, - &error_abort); } =20 static void pc_dimm_realize(DeviceState *dev, Error **errp) @@ -404,6 +383,11 @@ static void pc_dimm_realize(DeviceState *dev, Error **= errp) if (!dimm->hostmem) { error_setg(errp, "'" PC_DIMM_MEMDEV_PROP "' property is not set"); return; + } else if (host_memory_backend_is_mapped(MEMORY_BACKEND(dimm->hostmem)= )) { + char *path =3D object_get_canonical_path_component(dimm->hostmem); + error_setg(errp, "can't use already busy memdev: %s", path); + g_free(path); + return; } if (((nb_numa_nodes > 0) && (dimm->node >=3D nb_numa_nodes)) || (!nb_numa_nodes && dimm->node)) { @@ -417,24 +401,26 @@ static void pc_dimm_realize(DeviceState *dev, Error *= *errp) ddc->realize(dimm, errp); } =20 - host_memory_backend_set_mapped(dimm->hostmem, true); + host_memory_backend_set_mapped(MEMORY_BACKEND(dimm->hostmem), true); } =20 static void pc_dimm_unrealize(DeviceState *dev, Error **errp) { PCDIMMDevice *dimm =3D PC_DIMM(dev); =20 - host_memory_backend_set_mapped(dimm->hostmem, false); + host_memory_backend_set_mapped(MEMORY_BACKEND(dimm->hostmem), false); } =20 static MemoryRegion *pc_dimm_get_memory_region(PCDIMMDevice *dimm) { - return host_memory_backend_get_memory(dimm->hostmem, &error_abort); + return host_memory_backend_get_memory(MEMORY_BACKEND(dimm->hostmem), + &error_abort); } =20 static MemoryRegion *pc_dimm_get_vmstate_memory_region(PCDIMMDevice *dimm) { - return host_memory_backend_get_memory(dimm->hostmem, &error_abort); + return host_memory_backend_get_memory(MEMORY_BACKEND(dimm->hostmem), + &error_abort); } =20 static void pc_dimm_class_init(ObjectClass *oc, void *data) diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h index 1e483f2..ea903f5 100644 --- a/include/hw/mem/pc-dimm.h +++ b/include/hw/mem/pc-dimm.h @@ -53,7 +53,8 @@ typedef struct PCDIMMDevice { uint64_t addr; uint32_t node; int32_t slot; - HostMemoryBackend *hostmem; + /* HostMemoryBackend pointer to be filled by link property */ + Object *hostmem; } PCDIMMDevice; =20 /** --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499150979966412.6442259328685; Mon, 3 Jul 2017 23:49:39 -0700 (PDT) Received: from localhost ([::1]:38899 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHeU-0000i7-4s for importer@patchew.org; Tue, 04 Jul 2017 02:49:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZN-00049N-1g for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZI-00035X-N1 for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35502) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZI-000357-E8 for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:16 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 68A56A0212 for ; Tue, 4 Jul 2017 06:44:15 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA7E163F66; Tue, 4 Jul 2017 06:44:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 68A56A0212 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 68A56A0212 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:38 +0800 Message-Id: <20170704064347.7022-12-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 04 Jul 2017 06:44:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 11/20] ivshmem: Convert to DEFINE_PROP_LINK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Unlike the usual object_property_add_link() invocations in other devices, ivshmem checks the "is mapped" state of the backend in addition to qdev_prop_allow_set_link_before_realize. To convert it without specializing DEFINE_PROP_LINK which always uses the qdev callback, move the extra check to device realize time. Signed-off-by: Fam Zheng --- hw/misc/ivshmem.c | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 97beaf6..e318427 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -87,7 +87,8 @@ typedef struct IVShmemState { uint32_t features; =20 /* exactly one of these two may be set */ - HostMemoryBackend *hostmem; /* with interrupts */ + Object *hostmem; /* HostMemoryBackend pointer to be filled by link + property, used with interrupts */ CharBackend server_chr; /* without interrupts */ =20 /* registers */ @@ -864,7 +865,7 @@ static void ivshmem_common_realize(PCIDevice *dev, Erro= r **errp) if (s->hostmem !=3D NULL) { IVSHMEM_DPRINTF("using hostmem\n"); =20 - s->ivshmem_bar2 =3D host_memory_backend_get_memory(s->hostmem, + s->ivshmem_bar2 =3D host_memory_backend_get_memory(MEMORY_BACKEND(= s->hostmem), &error_abort); } else { Chardev *chr =3D qemu_chr_fe_get_driver(&s->server_chr); @@ -1009,18 +1010,6 @@ static const TypeInfo ivshmem_common_info =3D { .class_init =3D ivshmem_common_class_init, }; =20 -static void ivshmem_check_memdev_is_busy(const Object *obj, const char *na= me, - Object *val, Error **errp) -{ - if (host_memory_backend_is_mapped(MEMORY_BACKEND(val))) { - char *path =3D object_get_canonical_path_component(val); - error_setg(errp, "can't use already busy memdev: %s", path); - g_free(path); - } else { - qdev_prop_allow_set_link_before_realize(obj, name, val, errp); - } -} - static const VMStateDescription ivshmem_plain_vmsd =3D { .name =3D TYPE_IVSHMEM_PLAIN, .version_id =3D 0, @@ -1037,6 +1026,7 @@ static const VMStateDescription ivshmem_plain_vmsd = =3D { =20 static Property ivshmem_plain_properties[] =3D { DEFINE_PROP_ON_OFF_AUTO("master", IVShmemState, master, ON_OFF_AUTO_OF= F), + DEFINE_PROP_LINK("memdev", IVShmemState, hostmem, TYPE_MEMORY_BACKEND), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -1044,11 +1034,6 @@ static void ivshmem_plain_init(Object *obj) { IVShmemState *s =3D IVSHMEM_PLAIN(obj); =20 - object_property_add_link(obj, "memdev", TYPE_MEMORY_BACKEND, - (Object **)&s->hostmem, - ivshmem_check_memdev_is_busy, - OBJ_PROP_LINK_UNREF_ON_RELEASE, - &error_abort); s->not_legacy_32bit =3D 1; } =20 @@ -1059,17 +1044,22 @@ static void ivshmem_plain_realize(PCIDevice *dev, E= rror **errp) if (!s->hostmem) { error_setg(errp, "You must specify a 'memdev'"); return; + } else if (host_memory_backend_is_mapped(MEMORY_BACKEND(s->hostmem))) { + char *path =3D object_get_canonical_path_component(s->hostmem); + error_setg(errp, "can't use already busy memdev: %s", path); + g_free(path); + return; } =20 ivshmem_common_realize(dev, errp); - host_memory_backend_set_mapped(s->hostmem, true); + host_memory_backend_set_mapped(MEMORY_BACKEND(s->hostmem), true); } =20 static void ivshmem_plain_exit(PCIDevice *pci_dev) { IVShmemState *s =3D IVSHMEM_COMMON(pci_dev); =20 - host_memory_backend_set_mapped(s->hostmem, false); + host_memory_backend_set_mapped(MEMORY_BACKEND(s->hostmem), false); } =20 static void ivshmem_plain_class_init(ObjectClass *klass, void *data) @@ -1245,7 +1235,7 @@ static void desugar_shm(IVShmemState *s) object_property_add_child(OBJECT(s), "internal-shm-backend", obj, &error_abort); user_creatable_complete(obj, &error_abort); - s->hostmem =3D MEMORY_BACKEND(obj); + s->hostmem =3D obj; } =20 static void ivshmem_realize(PCIDevice *dev, Error **errp) --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499150807324232.98678516600899; Mon, 3 Jul 2017 23:46:47 -0700 (PDT) Received: from localhost ([::1]:38891 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHbi-0006Rg-48 for importer@patchew.org; Tue, 04 Jul 2017 02:46:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZN-00049O-1i for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZK-00036L-Hr for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41592) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZK-000365-As for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:18 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 43523369C9 for ; Tue, 4 Jul 2017 06:44:17 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id CEB4B60470; Tue, 4 Jul 2017 06:44:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 43523369C9 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 43523369C9 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:39 +0800 Message-Id: <20170704064347.7022-13-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 04 Jul 2017 06:44:17 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 12/20] armv7m: Convert bitband.source-mamory to DEFINE_PROP_LINK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- hw/arm/armv7m.c | 10 +++------- include/hw/arm/armv7m.h | 3 ++- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index c8a11f2..3a13d82 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -97,12 +97,6 @@ static void bitband_init(Object *obj) BitBandState *s =3D BITBAND(obj); SysBusDevice *dev =3D SYS_BUS_DEVICE(obj); =20 - object_property_add_link(obj, "source-memory", - TYPE_MEMORY_REGION, - (Object **)&s->source_memory, - qdev_prop_allow_set_link_before_realize, - OBJ_PROP_LINK_UNREF_ON_RELEASE, - &error_abort); memory_region_init_io(&s->iomem, obj, &bitband_ops, s, "bitband", 0x02000000); sysbus_init_mmio(dev, &s->iomem); @@ -117,7 +111,7 @@ static void bitband_realize(DeviceState *dev, Error **e= rrp) return; } =20 - s->source_as =3D address_space_init_shareable(s->source_memory, + s->source_as =3D address_space_init_shareable(MEMORY_REGION(s->source_= memory), "bitband-source"); } =20 @@ -349,6 +343,8 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel= _filename, int mem_size) =20 static Property bitband_properties[] =3D { DEFINE_PROP_UINT32("base", BitBandState, base, 0), + DEFINE_PROP_LINK("source-memory", BitBandState, source_memory, + TYPE_MEMORY_REGION), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/arm/armv7m.h b/include/hw/arm/armv7m.h index a9b3f2a..1b4ce5b 100644 --- a/include/hw/arm/armv7m.h +++ b/include/hw/arm/armv7m.h @@ -24,7 +24,8 @@ typedef struct { AddressSpace *source_as; MemoryRegion iomem; uint32_t base; - MemoryRegion *source_memory; + /* MemoryRegion pointer to be filled by link property */ + Object *source_memory; } BitBandState; =20 #define TYPE_ARMV7M "armv7m" --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499151200389458.7580980621509; Mon, 3 Jul 2017 23:53:20 -0700 (PDT) Received: from localhost ([::1]:38917 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHi2-0003ho-Uz for importer@patchew.org; Tue, 04 Jul 2017 02:53:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZN-0004A3-OJ for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZM-00037L-PY for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60582) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZM-00036t-IS for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:20 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 81D2961E48 for ; Tue, 4 Jul 2017 06:44:19 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id D07D45C469; Tue, 4 Jul 2017 06:44:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 81D2961E48 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 81D2961E48 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:40 +0800 Message-Id: <20170704064347.7022-14-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 04 Jul 2017 06:44:19 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 13/20] armv7m: Convert armv7m.memory to DEFINE_PROP_LINK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- hw/arm/armv7m.c | 10 +++------- include/hw/arm/armv7m.h | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index 3a13d82..3b0ada0 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -132,12 +132,6 @@ static void armv7m_instance_init(Object *obj) =20 /* Can't init the cpu here, we don't yet know which model to use */ =20 - object_property_add_link(obj, "memory", - TYPE_MEMORY_REGION, - (Object **)&s->board_memory, - qdev_prop_allow_set_link_before_realize, - OBJ_PROP_LINK_UNREF_ON_RELEASE, - &error_abort); memory_region_init(&s->container, obj, "armv7m-container", UINT64_MAX); =20 object_initialize(&s->nvic, sizeof(s->nvic), "armv7m_nvic"); @@ -167,7 +161,8 @@ static void armv7m_realize(DeviceState *dev, Error **er= rp) return; } =20 - memory_region_add_subregion_overlap(&s->container, 0, s->board_memory,= -1); + memory_region_add_subregion_overlap(&s->container, 0, + MEMORY_REGION(s->board_memory), -1= ); =20 cpustr =3D g_strsplit(s->cpu_model, ",", 2); =20 @@ -248,6 +243,7 @@ static void armv7m_realize(DeviceState *dev, Error **er= rp) =20 static Property armv7m_properties[] =3D { DEFINE_PROP_STRING("cpu-model", ARMv7MState, cpu_model), + DEFINE_PROP_LINK("memory", ARMv7MState, board_memory, TYPE_MEMORY_REGI= ON), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/arm/armv7m.h b/include/hw/arm/armv7m.h index 1b4ce5b..1640199 100644 --- a/include/hw/arm/armv7m.h +++ b/include/hw/arm/armv7m.h @@ -58,7 +58,7 @@ typedef struct ARMv7MState { /* Properties */ char *cpu_model; /* MemoryRegion the board provides to us (with its devices, RAM, etc) = */ - MemoryRegion *board_memory; + Object *board_memory; } ARMv7MState; =20 #endif --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499151344439452.8073511705069; Mon, 3 Jul 2017 23:55:44 -0700 (PDT) Received: from localhost ([::1]:38932 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHkM-0006V9-45 for importer@patchew.org; Tue, 04 Jul 2017 02:55:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZP-0004Bn-SC for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZO-00038P-Ue for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47650) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZO-00037z-OU for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:22 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A43ADC04B924 for ; Tue, 4 Jul 2017 06:44:21 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A8145C469; Tue, 4 Jul 2017 06:44:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A43ADC04B924 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A43ADC04B924 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:41 +0800 Message-Id: <20170704064347.7022-15-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 04 Jul 2017 06:44:21 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 14/20] gicv3: Convert to DEFINE_PROP_LINK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- hw/intc/arm_gicv3_its_kvm.c | 18 ++++++------------ include/hw/intc/arm_gicv3_its_common.h | 3 ++- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c index 1f8991b..5520c28 100644 --- a/hw/intc/arm_gicv3_its_kvm.c +++ b/hw/intc/arm_gicv3_its_kvm.c @@ -120,17 +120,6 @@ static void kvm_arm_its_realize(DeviceState *dev, Erro= r **errp) qemu_add_vm_change_state_handler(vm_change_state_handler, s); } =20 -static void kvm_arm_its_init(Object *obj) -{ - GICv3ITSState *s =3D KVM_ARM_ITS(obj); - - object_property_add_link(obj, "parent-gicv3", - "kvm-arm-gicv3", (Object **)&s->gicv3, - object_property_allow_set_link, - OBJ_PROP_LINK_UNREF_ON_RELEASE, - &error_abort); -} - /** * kvm_arm_its_pre_save - handles the saving of ITS registers. * ITS tables are flushed into guest RAM separately and earlier, @@ -205,12 +194,18 @@ static void kvm_arm_its_post_load(GICv3ITSState *s) GITS_CTLR, &s->ctlr, true, &error_abort); } =20 +static Property kvm_arm_its_props[] =3D { + DEFINE_PROP_LINK("parent-gicv3", GICv3ITSState, gicv3, "kvm-arm-gicv3"= ), + DEFINE_PROP_END_OF_LIST(), +}; + static void kvm_arm_its_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); GICv3ITSCommonClass *icc =3D ARM_GICV3_ITS_COMMON_CLASS(klass); =20 dc->realize =3D kvm_arm_its_realize; + dc->props =3D kvm_arm_its_props; icc->send_msi =3D kvm_its_send_msi; icc->pre_save =3D kvm_arm_its_pre_save; icc->post_load =3D kvm_arm_its_post_load; @@ -220,7 +215,6 @@ static const TypeInfo kvm_arm_its_info =3D { .name =3D TYPE_KVM_ARM_ITS, .parent =3D TYPE_ARM_GICV3_ITS_COMMON, .instance_size =3D sizeof(GICv3ITSState), - .instance_init =3D kvm_arm_its_init, .class_init =3D kvm_arm_its_class_init, }; =20 diff --git a/include/hw/intc/arm_gicv3_its_common.h b/include/hw/intc/arm_g= icv3_its_common.h index fd1fe64..29ec114 100644 --- a/include/hw/intc/arm_gicv3_its_common.h +++ b/include/hw/intc/arm_gicv3_its_common.h @@ -42,7 +42,8 @@ struct GICv3ITSState { MemoryRegion iomem_its_cntrl; MemoryRegion iomem_its_translation; =20 - GICv3State *gicv3; + /* GICv3State pointer to be filled by link property */ + Object *gicv3; =20 int dev_fd; /* kvm device fd if backed by kvm vgic support */ uint64_t gits_translater_gpa; --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499151476809994.9245004183282; Mon, 3 Jul 2017 23:57:56 -0700 (PDT) Received: from localhost ([::1]:38939 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHmV-0008MV-J0 for importer@patchew.org; Tue, 04 Jul 2017 02:57:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZS-0004Dh-5a for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZR-00039P-8t for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50096) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZQ-000391-Vv for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:25 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E1738C0587DE for ; Tue, 4 Jul 2017 06:44:23 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58D0A5C469; Tue, 4 Jul 2017 06:44:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E1738C0587DE Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E1738C0587DE From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:42 +0800 Message-Id: <20170704064347.7022-16-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 04 Jul 2017 06:44:24 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 15/20] xlnx_zynqmp: Convert to DEFINE_PROP_LINK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- hw/arm/xlnx-zynqmp.c | 12 ++++-------- include/hw/arm/xlnx-zynqmp.h | 3 ++- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index 64f52f8..2ce9cad 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -140,11 +140,6 @@ static void xlnx_zynqmp_init(Object *obj) &error_abort); } =20 - object_property_add_link(obj, "ddr-ram", TYPE_MEMORY_REGION, - (Object **)&s->ddr_ram, - qdev_prop_allow_set_link_before_realize, - OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); - object_initialize(&s->gic, sizeof(s->gic), gic_class_name()); qdev_set_parent_bus(DEVICE(&s->gic), sysbus_get_default()); =20 @@ -192,7 +187,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error= **errp) qemu_irq gic_spi[GIC_NUM_SPI_INTR]; Error *err =3D NULL; =20 - ram_size =3D memory_region_size(s->ddr_ram); + ram_size =3D memory_region_size(MEMORY_REGION(s->ddr_ram)); =20 /* Create the DDR Memory Regions. User friendly checks should happen at * the board level @@ -206,7 +201,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error= **errp) ddr_high_size =3D ram_size - XLNX_ZYNQMP_MAX_LOW_RAM_SIZE; =20 memory_region_init_alias(&s->ddr_ram_high, NULL, - "ddr-ram-high", s->ddr_ram, + "ddr-ram-high", MEMORY_REGION(s->ddr_ram), ddr_low_size, ddr_high_size); memory_region_add_subregion(get_system_memory(), XLNX_ZYNQMP_HIGH_RAM_START, @@ -218,7 +213,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error= **errp) } =20 memory_region_init_alias(&s->ddr_ram_low, NULL, - "ddr-ram-low", s->ddr_ram, + "ddr-ram-low", MEMORY_REGION(s->ddr_ram), 0, ddr_low_size); memory_region_add_subregion(get_system_memory(), 0, &s->ddr_ram_low); =20 @@ -434,6 +429,7 @@ static Property xlnx_zynqmp_props[] =3D { DEFINE_PROP_STRING("boot-cpu", XlnxZynqMPState, boot_cpu), DEFINE_PROP_BOOL("secure", XlnxZynqMPState, secure, false), DEFINE_PROP_BOOL("has_rpu", XlnxZynqMPState, has_rpu, false), + DEFINE_PROP_LINK("ddr-ram", XlnxZynqMPState, ddr_ram, TYPE_MEMORY_REGI= ON), DEFINE_PROP_END_OF_LIST() }; =20 diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h index c2931bf..efd4c1a 100644 --- a/include/hw/arm/xlnx-zynqmp.h +++ b/include/hw/arm/xlnx-zynqmp.h @@ -75,7 +75,8 @@ typedef struct XlnxZynqMPState { =20 MemoryRegion ocm_ram[XLNX_ZYNQMP_NUM_OCM_BANKS]; =20 - MemoryRegion *ddr_ram; + /* A MemoryRegion pointer to be filled by link property */ + Object *ddr_ram; MemoryRegion ddr_ram_low, ddr_ram_high; =20 CadenceGEMState gem[XLNX_ZYNQMP_NUM_GEMS]; --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499151592759616.2621743352845; Mon, 3 Jul 2017 23:59:52 -0700 (PDT) Received: from localhost ([::1]:38945 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHoN-00027L-Cd for importer@patchew.org; Tue, 04 Jul 2017 02:59:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZY-0004LT-HO for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZT-0003AQ-Jx for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56066) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZT-00039w-BC for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:27 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3DF438553F for ; Tue, 4 Jul 2017 06:44:26 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6792B5C469; Tue, 4 Jul 2017 06:44:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3DF438553F Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3DF438553F From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:43 +0800 Message-Id: <20170704064347.7022-17-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 04 Jul 2017 06:44:26 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 16/20] xilinx_axienet: Convert to DEFINE_PROP_LINK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- hw/net/xilinx_axienet.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c index b670184..e92762b 100644 --- a/hw/net/xilinx_axienet.c +++ b/hw/net/xilinx_axienet.c @@ -341,8 +341,10 @@ struct XilinxAXIEnet { SysBusDevice busdev; MemoryRegion iomem; qemu_irq irq; - StreamSlave *tx_data_dev; - StreamSlave *tx_control_dev; + /* StreamSlave pointers for data and control tx devices, to be filled = by + * link property. */ + Object *tx_data_dev; + Object *tx_control_dev; XilinxAXIEnetStreamSlave rx_data_dev; XilinxAXIEnetStreamSlave rx_control_dev; NICState *nic; @@ -688,17 +690,18 @@ static void axienet_eth_rx_notify(void *opaque) { XilinxAXIEnet *s =3D XILINX_AXI_ENET(opaque); =20 - while (s->rxappsize && stream_can_push(s->tx_control_dev, + while (s->rxappsize && stream_can_push(STREAM_SLAVE(s->tx_control_dev), axienet_eth_rx_notify, s)) { - size_t ret =3D stream_push(s->tx_control_dev, + size_t ret =3D stream_push(STREAM_SLAVE(s->tx_control_dev), (void *)s->rxapp + CONTROL_PAYLOAD_SIZE - s->rxappsize, s->rxappsize); s->rxappsize -=3D ret; } =20 - while (s->rxsize && stream_can_push(s->tx_data_dev, + while (s->rxsize && stream_can_push(STREAM_SLAVE(s->tx_data_dev), axienet_eth_rx_notify, s)) { - size_t ret =3D stream_push(s->tx_data_dev, (void *)s->rxmem + s->r= xpos, + size_t ret =3D stream_push(STREAM_SLAVE(s->tx_data_dev), + (void *)s->rxmem + s->rxpos, s->rxsize); s->rxsize -=3D ret; s->rxpos +=3D ret; @@ -991,18 +994,6 @@ static void xilinx_enet_init(Object *obj) XilinxAXIEnet *s =3D XILINX_AXI_ENET(obj); SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); =20 - object_property_add_link(obj, "axistream-connected", TYPE_STREAM_SLAVE, - (Object **) &s->tx_data_dev, - qdev_prop_allow_set_link_before_realize, - OBJ_PROP_LINK_UNREF_ON_RELEASE, - &error_abort); - object_property_add_link(obj, "axistream-control-connected", - TYPE_STREAM_SLAVE, - (Object **) &s->tx_control_dev, - qdev_prop_allow_set_link_before_realize, - OBJ_PROP_LINK_UNREF_ON_RELEASE, - &error_abort); - object_initialize(&s->rx_data_dev, sizeof(s->rx_data_dev), TYPE_XILINX_AXI_ENET_DATA_STREAM); object_initialize(&s->rx_control_dev, sizeof(s->rx_control_dev), @@ -1023,6 +1014,10 @@ static Property xilinx_enet_properties[] =3D { DEFINE_PROP_UINT32("rxmem", XilinxAXIEnet, c_rxmem, 0x1000), DEFINE_PROP_UINT32("txmem", XilinxAXIEnet, c_txmem, 0x1000), DEFINE_NIC_PROPERTIES(XilinxAXIEnet, conf), + DEFINE_PROP_LINK("axistream-connected", XilinxAXIEnet, + tx_data_dev, TYPE_STREAM_SLAVE), + DEFINE_PROP_LINK("axistream-control-connected", XilinxAXIEnet, + tx_control_dev, TYPE_STREAM_SLAVE), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14991515371071013.3507974601011; Mon, 3 Jul 2017 23:58:57 -0700 (PDT) Received: from localhost ([::1]:38942 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHnT-0001Aj-S3 for importer@patchew.org; Tue, 04 Jul 2017 02:58:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZY-0004LX-Hf for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZV-0003Aw-QX for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35688) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZV-0003Ak-IU for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:29 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8425F8E771 for ; Tue, 4 Jul 2017 06:44:28 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC7E15C469; Tue, 4 Jul 2017 06:44:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8425F8E771 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8425F8E771 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:44 +0800 Message-Id: <20170704064347.7022-18-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 04 Jul 2017 06:44:28 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 17/20] xilinx_axidma: Convert to DEFINE_PROP_LINK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- hw/dma/xilinx_axidma.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c index 6065689..df293d3 100644 --- a/hw/dma/xilinx_axidma.c +++ b/hw/dma/xilinx_axidma.c @@ -124,8 +124,11 @@ struct XilinxAXIDMA { SysBusDevice busdev; MemoryRegion iomem; uint32_t freqhz; - StreamSlave *tx_data_dev; - StreamSlave *tx_control_dev; + + /* StreamSlave pointers to be fille by link property */ + Object *tx_data_dev; + Object *tx_control_dev; + XilinxAXIDMAStreamSlave rx_data_dev; XilinxAXIDMAStreamSlave rx_control_dev; =20 @@ -491,7 +494,8 @@ static void axidma_write(void *opaque, hwaddr addr, s->regs[addr] =3D value; s->regs[R_DMASR] &=3D ~DMASR_IDLE; /* Not idle. */ if (!sid) { - stream_process_mem2s(s, d->tx_data_dev, d->tx_control_dev); + stream_process_mem2s(s, STREAM_SLAVE(d->tx_data_dev), + STREAM_SLAVE(d->tx_control_dev)); } break; default: @@ -564,18 +568,6 @@ static void xilinx_axidma_init(Object *obj) XilinxAXIDMA *s =3D XILINX_AXI_DMA(obj); SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); =20 - object_property_add_link(obj, "axistream-connected", TYPE_STREAM_SLAVE, - (Object **)&s->tx_data_dev, - qdev_prop_allow_set_link_before_realize, - OBJ_PROP_LINK_UNREF_ON_RELEASE, - &error_abort); - object_property_add_link(obj, "axistream-control-connected", - TYPE_STREAM_SLAVE, - (Object **)&s->tx_control_dev, - qdev_prop_allow_set_link_before_realize, - OBJ_PROP_LINK_UNREF_ON_RELEASE, - &error_abort); - object_initialize(&s->rx_data_dev, sizeof(s->rx_data_dev), TYPE_XILINX_AXI_DMA_DATA_STREAM); object_initialize(&s->rx_control_dev, sizeof(s->rx_control_dev), @@ -595,6 +587,10 @@ static void xilinx_axidma_init(Object *obj) =20 static Property axidma_properties[] =3D { DEFINE_PROP_UINT32("freqhz", XilinxAXIDMA, freqhz, 50000000), + DEFINE_PROP_LINK("axistream-connected", XilinxAXIDMA, + tx_data_dev, TYPE_STREAM_SLAVE), + DEFINE_PROP_LINK("axistream-control-connected", XilinxAXIDMA, + tx_control_dev, TYPE_STREAM_SLAVE), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499151639927460.32059052533305; Tue, 4 Jul 2017 00:00:39 -0700 (PDT) Received: from localhost ([::1]:38954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHp7-0002kk-MB for importer@patchew.org; Tue, 04 Jul 2017 03:00:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZY-0004LW-Hh for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZX-0003BY-IN for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56158) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZX-0003BC-9Y for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:31 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3E8AD8553F for ; Tue, 4 Jul 2017 06:44:30 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12C6D63F66; Tue, 4 Jul 2017 06:44:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3E8AD8553F Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3E8AD8553F From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:45 +0800 Message-Id: <20170704064347.7022-19-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 04 Jul 2017 06:44:30 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 18/20] mips_cmgcr: Convert to DEFINE_PROP_LINK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- hw/misc/mips_cmgcr.c | 22 ++++++---------------- include/hw/misc/mips_cmgcr.h | 5 +++-- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/hw/misc/mips_cmgcr.c b/hw/misc/mips_cmgcr.c index a1edb53..f9b2a67 100644 --- a/hw/misc/mips_cmgcr.c +++ b/hw/misc/mips_cmgcr.c @@ -48,9 +48,9 @@ static inline void update_cpc_base(MIPSGCRState *gcr, uin= t64_t val) if (is_cpc_connected(gcr)) { gcr->cpc_base =3D val & GCR_CPC_BASE_MSK; memory_region_transaction_begin(); - memory_region_set_address(gcr->cpc_mr, + memory_region_set_address(MEMORY_REGION(gcr->cpc_mr), gcr->cpc_base & GCR_CPC_BASE_CPCBASE_MSK= ); - memory_region_set_enabled(gcr->cpc_mr, + memory_region_set_enabled(MEMORY_REGION(gcr->cpc_mr), gcr->cpc_base & GCR_CPC_BASE_CPCEN_MSK); memory_region_transaction_commit(); } @@ -61,9 +61,9 @@ static inline void update_gic_base(MIPSGCRState *gcr, uin= t64_t val) if (is_gic_connected(gcr)) { gcr->gic_base =3D val & GCR_GIC_BASE_MSK; memory_region_transaction_begin(); - memory_region_set_address(gcr->gic_mr, + memory_region_set_address(MEMORY_REGION(gcr->gic_mr), gcr->gic_base & GCR_GIC_BASE_GICBASE_MSK= ); - memory_region_set_enabled(gcr->gic_mr, + memory_region_set_enabled(MEMORY_REGION(gcr->gic_mr), gcr->gic_base & GCR_GIC_BASE_GICEN_MSK); memory_region_transaction_commit(); } @@ -181,18 +181,6 @@ static void mips_gcr_init(Object *obj) SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); MIPSGCRState *s =3D MIPS_GCR(obj); =20 - object_property_add_link(obj, "gic", TYPE_MEMORY_REGION, - (Object **)&s->gic_mr, - qdev_prop_allow_set_link_before_realize, - OBJ_PROP_LINK_UNREF_ON_RELEASE, - &error_abort); - - object_property_add_link(obj, "cpc", TYPE_MEMORY_REGION, - (Object **)&s->cpc_mr, - qdev_prop_allow_set_link_before_realize, - OBJ_PROP_LINK_UNREF_ON_RELEASE, - &error_abort); - memory_region_init_io(&s->iomem, OBJECT(s), &gcr_ops, s, "mips-gcr", GCR_ADDRSPACE_SZ); sysbus_init_mmio(sbd, &s->iomem); @@ -227,6 +215,8 @@ static Property mips_gcr_properties[] =3D { DEFINE_PROP_INT32("num-vp", MIPSGCRState, num_vps, 1), DEFINE_PROP_INT32("gcr-rev", MIPSGCRState, gcr_rev, 0x800), DEFINE_PROP_UINT64("gcr-base", MIPSGCRState, gcr_base, GCR_BASE_ADDR), + DEFINE_PROP_LINK("gic", MIPSGCRState, gic_mr, TYPE_MEMORY_REGION), + DEFINE_PROP_LINK("cpc", MIPSGCRState, cpc_mr, TYPE_MEMORY_REGION), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/misc/mips_cmgcr.h b/include/hw/misc/mips_cmgcr.h index c9dfcb4..f2b3577 100644 --- a/include/hw/misc/mips_cmgcr.h +++ b/include/hw/misc/mips_cmgcr.h @@ -76,8 +76,9 @@ struct MIPSGCRState { int32_t num_vps; hwaddr gcr_base; MemoryRegion iomem; - MemoryRegion *cpc_mr; - MemoryRegion *gic_mr; + /* MemoryRegion pointers for cpc and gic, to be filled by link propert= y */ + Object *cpc_mr; + Object *gic_mr; =20 uint64_t cpc_base; uint64_t gic_base; --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499151739667765.6228591546669; Tue, 4 Jul 2017 00:02:19 -0700 (PDT) Received: from localhost ([::1]:38961 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHqk-0003qR-E1 for importer@patchew.org; Tue, 04 Jul 2017 03:02:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZa-0004U8-Tr for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZZ-0003CY-Lt for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56218) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZZ-0003CE-Cp for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:33 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4CB9B80462 for ; Tue, 4 Jul 2017 06:44:32 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id B883263F77; Tue, 4 Jul 2017 06:44:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4CB9B80462 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4CB9B80462 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:46 +0800 Message-Id: <20170704064347.7022-20-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 04 Jul 2017 06:44:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 19/20] cpu: Convert to DEFINE_PROP_LINK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- cpus.c | 5 +++-- exec.c | 30 ++++++++++++++++-------------- include/qom/cpu.h | 4 +++- qom/cpu.c | 1 + target/arm/cpu.c | 6 +++--- target/i386/cpu.c | 5 +++-- 6 files changed, 29 insertions(+), 22 deletions(-) diff --git a/cpus.c b/cpus.c index 14bb8d5..708ee78 100644 --- a/cpus.c +++ b/cpus.c @@ -1764,8 +1764,9 @@ void qemu_init_vcpu(CPUState *cpu) /* If the target cpu hasn't set up any address spaces itself, * give it the default one. */ - AddressSpace *as =3D address_space_init_shareable(cpu->memory, - "cpu-memory"); + AddressSpace *as =3D + address_space_init_shareable(MEMORY_REGION(cpu->memory), + "cpu-memory"); cpu->num_ases =3D 1; cpu_address_space_init(cpu, as, 0); } diff --git a/exec.c b/exec.c index 42ad1ea..26a4f0f 100644 --- a/exec.c +++ b/exec.c @@ -27,6 +27,7 @@ #include "exec/target_page.h" #include "tcg.h" #include "hw/qdev-core.h" +#include "hw/qdev-properties.h" #if !defined(CONFIG_USER_ONLY) #include "hw/boards.h" #include "hw/xen/xen.h" @@ -730,6 +731,19 @@ void cpu_exec_unrealizefn(CPUState *cpu) } } =20 +Property cpu_common_props[] =3D { +#ifndef CONFIG_USER_ONLY + /* Create a memory property for softmmu CPU object, + * so users can wire up its memory. (This can't go in qom/cpu.c + * because that file is compiled only once for both user-mode + * and system builds.) The default if no link is set up is to use + * the system address space. + */ + DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION), +#endif + DEFINE_PROP_END_OF_LIST(), +}; + void cpu_exec_initfn(CPUState *cpu) { cpu->as =3D NULL; @@ -737,20 +751,8 @@ void cpu_exec_initfn(CPUState *cpu) =20 #ifndef CONFIG_USER_ONLY cpu->thread_id =3D qemu_get_thread_id(); - - /* This is a softmmu CPU object, so create a property for it - * so users can wire up its memory. (This can't go in qom/cpu.c - * because that file is compiled only once for both user-mode - * and system builds.) The default if no link is set up is to use - * the system address space. - */ - object_property_add_link(OBJECT(cpu), "memory", TYPE_MEMORY_REGION, - (Object **)&cpu->memory, - qdev_prop_allow_set_link_before_realize, - OBJ_PROP_LINK_UNREF_ON_RELEASE, - &error_abort); - cpu->memory =3D system_memory; - object_ref(OBJECT(cpu->memory)); + cpu->memory =3D OBJECT(system_memory); + object_ref(cpu->memory); #endif } =20 diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 2fe7cff..9857781 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -342,7 +342,8 @@ struct CPUState { CPUAddressSpace *cpu_ases; int num_ases; AddressSpace *as; - MemoryRegion *memory; + /* Memory region pointer to be filled by link property */ + Object *memory; =20 void *env_ptr; /* CPUArchState */ =20 @@ -1010,6 +1011,7 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, in= t asidx); =20 void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...) GCC_FMT_ATTR(2, 3); +extern Property cpu_common_props[]; void cpu_exec_initfn(CPUState *cpu); void cpu_exec_realizefn(CPUState *cpu, Error **errp); void cpu_exec_unrealizefn(CPUState *cpu); diff --git a/qom/cpu.c b/qom/cpu.c index 585419b..071551c 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -446,6 +446,7 @@ static void cpu_class_init(ObjectClass *klass, void *da= ta) set_bit(DEVICE_CATEGORY_CPU, dc->categories); dc->realize =3D cpu_common_realizefn; dc->unrealize =3D cpu_common_unrealizefn; + dc->props =3D cpu_common_props; /* * Reason: CPUs still need special care by board code: wiring up * IRQs, adding reset handlers, halting non-first CPUs, ... diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 28a9141..9b5968b 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -817,14 +817,14 @@ static void arm_cpu_realizefn(DeviceState *dev, Error= **errp) AddressSpace *as; =20 if (!cpu->secure_memory) { - cpu->secure_memory =3D cs->memory; + cpu->secure_memory =3D MEMORY_REGION(cs->memory); } - as =3D address_space_init_shareable(cpu->secure_memory, + as =3D address_space_init_shareable(MEMORY_REGION(cpu->secure_memo= ry), "cpu-secure-memory"); cpu_address_space_init(cs, as, ARMASIdx_S); } cpu_address_space_init(cs, - address_space_init_shareable(cs->memory, + address_space_init_shareable(MEMORY_REGION(cs->= memory), "cpu-memory"), ARMASIdx_NS); #endif diff --git a/target/i386/cpu.c b/target/i386/cpu.c index fce277b..4f1c9fa 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3615,8 +3615,9 @@ static void x86_cpu_realizefn(DeviceState *dev, Error= **errp) =20 #ifndef CONFIG_USER_ONLY if (tcg_enabled()) { - AddressSpace *as_normal =3D address_space_init_shareable(cs->memor= y, - "cpu-memory= "); + AddressSpace *as_normal =3D + address_space_init_shareable(MEMORY_REGION(cs->memory), + "cpu-memory"); AddressSpace *as_smm =3D g_new(AddressSpace, 1); =20 cpu->cpu_as_mem =3D g_new(MemoryRegion, 1); --=20 2.9.4 From nobody Thu May 2 08:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499151846858417.14350635745893; Tue, 4 Jul 2017 00:04:06 -0700 (PDT) Received: from localhost ([::1]:38965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHsS-0005KI-Jc for importer@patchew.org; Tue, 04 Jul 2017 03:04:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZc-0004VK-49 for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZb-0003DC-BV for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47820) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZb-0003Cv-5c for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:35 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2C880C0467C4 for ; Tue, 4 Jul 2017 06:44:34 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id C840C5C469; Tue, 4 Jul 2017 06:44:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2C880C0467C4 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2C880C0467C4 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:47 +0800 Message-Id: <20170704064347.7022-21-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 04 Jul 2017 06:44:34 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 20/20] spapr_rng: Convert to DEFINE_PROP_LINK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- hw/ppc/spapr_rng.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/hw/ppc/spapr_rng.c b/hw/ppc/spapr_rng.c index 80515eb..fcffc65 100644 --- a/hw/ppc/spapr_rng.c +++ b/hw/ppc/spapr_rng.c @@ -34,7 +34,8 @@ struct sPAPRRngState { /*< private >*/ DeviceState ds; - RngBackend *backend; + /* RngBackend pointer to be fill by link property */ + Object *backend; bool use_kvm; }; typedef struct sPAPRRngState sPAPRRngState; @@ -81,7 +82,8 @@ static target_ulong h_random(PowerPCCPU *cpu, sPAPRMachin= eState *spapr, hrdata.received =3D 0; =20 while (hrdata.received < 8) { - rng_backend_request_entropy(rngstate->backend, 8 - hrdata.received, + rng_backend_request_entropy(RNG_BACKEND(rngstate->backend), + 8 - hrdata.received, random_recv, &hrdata); qemu_mutex_unlock_iothread(); qemu_sem_wait(&hrdata.sem); @@ -96,17 +98,11 @@ static target_ulong h_random(PowerPCCPU *cpu, sPAPRMach= ineState *spapr, =20 static void spapr_rng_instance_init(Object *obj) { - sPAPRRngState *rngstate =3D SPAPR_RNG(obj); - if (object_resolve_path_type("", TYPE_SPAPR_RNG, NULL) !=3D NULL) { error_report("spapr-rng can not be instantiated twice!"); return; } =20 - object_property_add_link(obj, "rng", TYPE_RNG_BACKEND, - (Object **)&rngstate->backend, - object_property_allow_set_link, - OBJ_PROP_LINK_UNREF_ON_RELEASE, NULL); object_property_set_description(obj, "rng", "ID of the random number generator bac= kend", NULL); @@ -163,6 +159,7 @@ int spapr_rng_populate_dt(void *fdt) =20 static Property spapr_rng_properties[] =3D { DEFINE_PROP_BOOL("use-kvm", sPAPRRngState, use_kvm, false), + DEFINE_PROP_LINK("rng", sPAPRRngState, backend, TYPE_RNG_BACKEND), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.9.4