All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Cc: qemu-devel@nongnu.org, thuth@redhat.com, pbonzini@redhat.com,
	armbru@redhat.com, peter.maydell@linaro.org,
	richard.henderson@linaro.org, alistair.francis@wdc.com,
	Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Subject: Re: [Qemu-devel] [PATCH 22/22] core/sysbus: remove the SysBusDeviceClass::init path
Date: Mon, 19 Nov 2018 21:39:41 -0200	[thread overview]
Message-ID: <20181119233941.GP3807@habkost.net> (raw)
In-Reply-To: <20181119233139.GO3807@habkost.net>

On Mon, Nov 19, 2018 at 09:31:39PM -0200, Eduardo Habkost wrote:
> On Mon, Nov 19, 2018 at 08:08:20PM +0800, Mao Zhongyi wrote:
> > Currently, all sysbus devices have been converted to realize(),
> > so remove this path.
> > 
> > Cc: ehabkost@redhat.com
> > Cc: thuth@redhat.com
> > Cc: pbonzini@redhat.com
> > Cc: armbru@redhat.com
> > Cc: peter.maydell@linaro.org
> > Cc: richard.henderson@linaro.org
> > Cc: alistair.francis@wdc.com
> > 
> > Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> > Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> > ---
> >  hw/core/sysbus.c    | 15 ---------------
> >  include/hw/sysbus.h |  3 ---
> >  2 files changed, 18 deletions(-)
> > 
> > diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
> > index 7ac36ad3e7..030ad426c1 100644
> > --- a/hw/core/sysbus.c
> > +++ b/hw/core/sysbus.c
> > @@ -201,20 +201,6 @@ void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size)
> >      }
> >  }
> >  
> > -/* TODO remove once all sysbus devices have been converted to realize */
> > -static void sysbus_realize(DeviceState *dev, Error **errp)
> > -{
> > -    SysBusDevice *sd = SYS_BUS_DEVICE(dev);
> > -    SysBusDeviceClass *sbc = SYS_BUS_DEVICE_GET_CLASS(sd);
> > -
> > -    if (!sbc->init) {
> > -        return;
> > -    }
> > -    if (sbc->init(sd) < 0) {
> > -        error_setg(errp, "Device initialization failed");
> > -    }
> > -}
> 
> Nice.  :)
> 
> 
> > -
> >  DeviceState *sysbus_create_varargs(const char *name,
> >                                     hwaddr addr, ...)
> >  {
> > @@ -327,7 +313,6 @@ MemoryRegion *sysbus_address_space(SysBusDevice *dev)
> >  static void sysbus_device_class_init(ObjectClass *klass, void *data)
> >  {
> >      DeviceClass *k = DEVICE_CLASS(klass);
> > -    k->realize = sysbus_realize;
> 
> Have you ensured this won't break any subclasses that
> saved the original realize function on a parent_realize field?
> Now they will have parent_realize set to NULL.
> 
> Most of them use device_class_set_parent_realize() to implement
> that.

Found one:

$ ./aarch64-softmmu/qemu-system-aarch64 -machine virt,iommu=smmuv3
Segmentation fault (core dumped)

(gdb) bt
#0  0x0000000000000000 in  ()
#1  0x000055555596eabe in smmu_base_realize (dev=0x555556ac0cb0, errp=0x7fffffffc450) at /home/ehabkost/rh/proj/virt/qemu/hw/arm/smmu-common.c:428
#2  0x0000555555970322 in smmu_realize (d=0x555556ac0cb0, errp=0x7fffffffc4c0) at /home/ehabkost/rh/proj/virt/qemu/hw/arm/smmuv3.c:1390
#3  0x0000555555ac8f00 in device_set_realized (obj=<optimized out>, value=<optimized out>, errp=0x7fffffffc5b0) at hw/core/qdev.c:826
#4  0x0000555555c424a7 in property_set_bool (obj=0x555556ac0cb0, v=<optimized out>, name=<optimized out>, opaque=0x555556a05b70, errp=0x7fffffffc5b0) at qom/object.c:1991
#5  0x0000555555c468df in object_property_set_qobject (obj=obj@entry=0x555556ac0cb0, value=value@entry=0x555556ac2520, name=name@entry=0x555555de03f9 "realized", errp=errp@entry=0x7fffffffc5b0) at qom/qom-qobject.c:27
#6  0x0000555555c44355 in object_property_set_bool (obj=0x555556ac0cb0, value=<optimized out>, name=0x555555de03f9 "realized", errp=0x7fffffffc5b0) at qom/object.c:1249
#7  0x0000555555ac7e22 in qdev_init_nofail (dev=dev@entry=0x555556ac0cb0) at hw/core/qdev.c:313
#8  0x000055555592ef97 in create_smmu (bus=0x5555569970a0, pic=0x7fffffffc900, vms=<optimized out>) at /home/ehabkost/rh/proj/virt/qemu/hw/arm/virt.c:1058
#9  0x000055555592ef97 in create_pcie (pic=0x7fffffffc900, vms=<optimized out>) at /home/ehabkost/rh/proj/virt/qemu/hw/arm/virt.c:1208
#10 0x000055555592ef97 in machvirt_init (machine=0x55555663e9c0) at /home/ehabkost/rh/proj/virt/qemu/hw/arm/virt.c:1549
#11 0x0000555555acf013 in machine_run_board_init (machine=0x55555663e9c0) at hw/core/machine.c:834
#12 0x000055555581dab8 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4518

> 
> >      k->bus_type = TYPE_SYSTEM_BUS;
> >      /*
> >       * device_add plugs devices into a suitable bus.  For "real" buses,
> > diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h
> > index 0b59a3b8d6..1aedcf05c9 100644
> > --- a/include/hw/sysbus.h
> > +++ b/include/hw/sysbus.h
> > @@ -38,9 +38,6 @@ typedef struct SysBusDevice SysBusDevice;
> >  typedef struct SysBusDeviceClass {
> >      /*< private >*/
> >      DeviceClass parent_class;
> > -    /*< public >*/
> > -
> > -    int (*init)(SysBusDevice *dev);
> >  
> >      /*
> >       * Let the sysbus device format its own non-PIO, non-MMIO unit address.
> > -- 
> > 2.17.1
> > 
> > 
> > 
> 
> -- 
> Eduardo

-- 
Eduardo

  reply	other threads:[~2018-11-19 23:39 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-19 12:07 [Qemu-devel] [PATCH 00/22] QOM'ify SysBusDeviceClass->init Mao Zhongyi
2018-11-19 12:07 ` [Qemu-devel] [PATCH 01/22] musicpal: Convert sysbus init function to realize function Mao Zhongyi
2018-11-20 21:43   ` Philippe Mathieu-Daudé
2018-11-19 12:08 ` [Qemu-devel] [PATCH 02/22] block/noenand: " Mao Zhongyi
2018-11-19 12:08 ` [Qemu-devel] [PATCH 03/22] char/grlib_apbuart: " Mao Zhongyi
2018-11-19 12:08 ` [Qemu-devel] [PATCH 04/22] core/empty_slot: " Mao Zhongyi
2018-11-20 14:48   ` Peter Maydell
2018-11-20 21:25   ` Philippe Mathieu-Daudé
2018-11-19 12:08 ` [Qemu-devel] [PATCH 05/22] display/g364fb: " Mao Zhongyi
2018-11-20 17:14   ` Alistair Francis
2018-11-19 12:08 ` [Qemu-devel] [PATCH 06/22] dma/puv3_dma: " Mao Zhongyi
2018-11-20 14:46   ` Peter Maydell
2018-11-23  3:25     ` [Qemu-devel] [PATCH 06/22] dma/puv3_dma: Convert sysbus initfunction " maozy
2018-11-20 21:26   ` [Qemu-devel] [PATCH 06/22] dma/puv3_dma: Convert sysbus init function " Philippe Mathieu-Daudé
2018-11-19 12:08 ` [Qemu-devel] [PATCH 07/22] gpio/puv3_gpio: " Mao Zhongyi
2018-11-19 14:31   ` Peter Maydell
2018-11-20  1:23     ` [Qemu-devel] [PATCH 07/22] gpio/puv3_gpio: Convert sysbus initfunction " maozy
2018-11-19 12:08 ` [Qemu-devel] [PATCH 08/22] milkymist-softusb: Convert sysbus init function " Mao Zhongyi
2018-11-19 12:08 ` [Qemu-devel] [PATCH 09/22] input/pl050: " Mao Zhongyi
2018-11-19 12:08 ` [Qemu-devel] [PATCH 10/22] intc/puv3_intc: " Mao Zhongyi
2018-11-19 12:08 ` [Qemu-devel] [PATCH 11/22] milkymist-hpdmc: " Mao Zhongyi
2018-11-20 14:47   ` Peter Maydell
2018-11-20 21:29   ` Philippe Mathieu-Daudé
2018-11-19 12:08 ` [Qemu-devel] [PATCH 12/22] milkymist-pfpu: " Mao Zhongyi
2018-11-19 12:08 ` [Qemu-devel] [PATCH 13/22] puv3_pm.c: " Mao Zhongyi
2018-11-20 14:51   ` Peter Maydell
2018-11-20 21:29   ` Philippe Mathieu-Daudé
2018-11-19 12:08 ` [Qemu-devel] [PATCH 14/22] nvram/ds1225y: " Mao Zhongyi
2018-11-20 14:51   ` Peter Maydell
2018-11-20 23:14     ` Philippe Mathieu-Daudé
2018-11-19 12:08 ` [Qemu-devel] [PATCH 15/22] pci-bridge/dec: " Mao Zhongyi
2018-11-21  8:42   ` David Gibson
2018-11-19 12:08 ` [Qemu-devel] [PATCH 16/22] timer/etraxfs_timer: " Mao Zhongyi
2018-11-19 12:08 ` [Qemu-devel] [PATCH 17/22] timer/grlib_gptimer: " Mao Zhongyi
2018-11-19 12:08 ` [Qemu-devel] [PATCH 18/22] timer/puv3_ost: " Mao Zhongyi
2018-11-19 12:08 ` [Qemu-devel] [PATCH 19/22] usb/tusb6010: " Mao Zhongyi
2018-11-19 12:08 ` [Qemu-devel] [PATCH 20/22] xen_backend: " Mao Zhongyi
2018-11-20 14:49   ` Peter Maydell
2018-11-20 14:49     ` Peter Maydell
2018-11-19 12:08 ` Mao Zhongyi
2018-11-19 12:08 ` [Qemu-devel] [PATCH 21/22] event-facility: Change SysBusDeviceClass *sbdc to SysBusDeviceClass *sbc Mao Zhongyi
2018-11-19 12:25   ` Cornelia Huck
2018-11-19 14:10     ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-11-20  1:10       ` [Qemu-devel] [qemu-s390x] [PATCH 21/22] event-facility: ChangeSysBusDeviceClass " maozy
2018-11-19 12:08 ` [Qemu-devel] [PATCH 22/22] core/sysbus: remove the SysBusDeviceClass::init path Mao Zhongyi
2018-11-19 23:31   ` Eduardo Habkost
2018-11-19 23:39     ` Eduardo Habkost [this message]
2018-11-23  3:10     ` [Qemu-devel] [PATCH 22/22] core/sysbus: remove the SysBusDeviceClass::initpath maozy
2018-11-23  9:02       ` Peter Maydell
2018-11-23  9:37         ` maozy
2018-11-23 18:16       ` Eduardo Habkost
2018-11-23 18:19         ` Peter Maydell
2018-11-25  1:24           ` maozy
2018-11-19 12:27 ` [Qemu-devel] [PATCH 00/22] QOM'ify SysBusDeviceClass->init Cornelia Huck
2018-11-19 12:27   ` Cornelia Huck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181119233941.GP3807@habkost.net \
    --to=ehabkost@redhat.com \
    --cc=alistair.francis@wdc.com \
    --cc=armbru@redhat.com \
    --cc=maozhongyi@cmss.chinamobile.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    --cc=zhangshengju@cmss.chinamobile.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.