[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/9] hw/sysbus: Introduce TYPE_DYNAMIC_SYS_BUS_DEVICE
- To: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>, "qemu-devel@xxxxxxxxxx" <qemu-devel@xxxxxxxxxx>
- From: CLEMENT MATHIEU--DRIF <clement.mathieu--drif@xxxxxxxxxx>
- Date: Mon, 27 Jan 2025 06:19:05 +0000
- Accept-language: en-GB, fr-FR, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=eviden.com; dmarc=pass action=none header.from=eviden.com; dkim=pass header.d=eviden.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dMoMtMlz3GxWv3/X28rMpuYtMbtTb6eezMZZCUrs0IM=; b=q3rlys+4ZLaMkIVPMdUi4HjE4tPadM2c5y4amqGRJzo5hk1xsAF4LMQBIQiHKMs3zJefeqfe8fejAt+RrOGIvt0aU2ZcgniQZpCYOhTaE7HX+jShLuLYTdPLBJnN9HETb1fMYBHb9OnZ6y+20KnTOEJPwgm4qIGSmcx2YTnbWrW/MglPaHj3uZ+Z2af/5xmrAAaWalroXHGI7LjfJjKdzFnoWwiLBzxvZ7Ql0zi9fkNOxLiCH5eWA8rbIMX+rq0dNL9FZLvemGrl9hLvk3W8OB21MOe1wPTmI2+hiUk4LBVSLe6s86WufzbD2wKNPBC3I+1VJADAa0jh2PqZ3hLLjw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pFqBLTAaoNuQLjtOy2HvByo+5bu24OrNWdvapImWsKpOtJA2U++J7lEVgZwItDch/3X0iZfiegYO0P6mCP6Qq8FjAJBrHLJjdE8GOd9UspW/m2AOreqns1ndsOvaO667g53yqGS/J0/i5k2Uyxg6V/ATOFQmL+XTjuMYMVA7EVZXy3dRs86nct/RX1EO8hSP7VVxQtt/uAKulEVFnG+WfOJdswGCmIHAVSfu1QQsHCbADeWJIEt2XFtXdOznGOViK6sPiGt2pTvDqdy4SUWdLj3Y/tD5OiQJXIfRRtbbCFpxQ0wxbCenxfPTbjUxduElW64yxEP0qJUvIOMPerkXxQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=eviden.com;
- Cc: Yi Liu <yi.l.liu@xxxxxxxxx>, Markus Armbruster <armbru@xxxxxxxxxx>, Eduardo Habkost <eduardo@xxxxxxxxxxx>, Anthony PERARD <anthony@xxxxxxxxxxxxxx>, Gustavo Romero <gustavo.romero@xxxxxxxxxx>, Jason Wang <jasowang@xxxxxxxxxx>, "qemu-ppc@xxxxxxxxxx" <qemu-ppc@xxxxxxxxxx>, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Alexander Graf <graf@xxxxxxxxxx>, Richard Henderson <richard.henderson@xxxxxxxxxx>, Stefan Berger <stefanb@xxxxxxxxxxxxxxxxxx>, Bernhard Beschow <shentey@xxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Gerd Hoffmann <kraxel@xxxxxxxxxx>, Daniel P. Berrangé <berrange@xxxxxxxxxx>, "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Marcel Apfelbaum <marcel.apfelbaum@xxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Cédric Le Goater <clg@xxxxxxxxxx>
- Delivery-date: Mon, 27 Jan 2025 06:19:12 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHbb1TqeocQ1Uio5UusvHnGsHg3IrMqJ/wA
- Thread-topic: [PATCH 3/9] hw/sysbus: Introduce TYPE_DYNAMIC_SYS_BUS_DEVICE
Reviewed-by: Clément Mathieu--Drif<clement.mathieu--drif@xxxxxxxxxx>
On 25/01/2025 19:13, Philippe Mathieu-Daudé wrote:
> Caution: External email. Do not open attachments or click links, unless this
> email comes from a known sender and you know the content is safe.
>
>
> Some TYPE_SYS_BUS_DEVICEs can be optionally dynamically
> plugged on the TYPE_PLATFORM_BUS_DEVICE.
> Rather than sometimes noting that with comment around
> the 'user_creatable = true' line in each DeviceRealize
> handler, introduce an abstract TYPE_DYNAMIC_SYS_BUS_DEVICE
> class.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>
> ---
> include/hw/sysbus.h | 2 ++
> hw/core/sysbus.c | 14 ++++++++++++++
> 2 files changed, 16 insertions(+)
>
> diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h
> index c9b1e0e90e3..81bbda10d37 100644
> --- a/include/hw/sysbus.h
> +++ b/include/hw/sysbus.h
> @@ -19,6 +19,8 @@ DECLARE_INSTANCE_CHECKER(BusState, SYSTEM_BUS,
> OBJECT_DECLARE_TYPE(SysBusDevice, SysBusDeviceClass,
> SYS_BUS_DEVICE)
>
> +#define TYPE_DYNAMIC_SYS_BUS_DEVICE "dynamic-sysbus-device"
> +
> /**
> * SysBusDeviceClass:
> *
> diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
> index 306f98406c0..e8d03fd28d9 100644
> --- a/hw/core/sysbus.c
> +++ b/hw/core/sysbus.c
> @@ -321,6 +321,14 @@ BusState *sysbus_get_default(void)
> return main_system_bus;
> }
>
> +static void dynamic_sysbus_device_class_init(ObjectClass *klass, void *data)
> +{
> + DeviceClass *k = DEVICE_CLASS(klass);
> +
> + k->user_creatable = true;
> + k->hotpluggable = false;
> +}
> +
> static const TypeInfo sysbus_types[] = {
> {
> .name = TYPE_SYSTEM_BUS,
> @@ -336,6 +344,12 @@ static const TypeInfo sysbus_types[] = {
> .class_size = sizeof(SysBusDeviceClass),
> .class_init = sysbus_device_class_init,
> },
> + {
> + .name = TYPE_DYNAMIC_SYS_BUS_DEVICE,
> + .parent = TYPE_SYS_BUS_DEVICE,
> + .class_init = dynamic_sysbus_device_class_init,
> + .abstract = true,
> + }
> };
>
> DEFINE_TYPES(sysbus_types)
> --
> 2.47.1
>
|