From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: "Corey Minyard" <cminyard@mvista.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
qemu-devel <qemu-devel@nongnu.org>,
"KONRAD Frederic" <frederic.konrad@adacore.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Paul Burton" <pburton@wavecomp.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Magnus Damm" <magnus.damm@gmail.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Artyom Tarasenko" <atar4qemu@gmail.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Fabien Chouteau" <chouteau@adacore.com>,
qemu-arm <qemu-arm@nongnu.org>,
"Richard Henderson" <rth@twiddle.net>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Aleksandar Rikalo" <arikalo@wavecomp.com>,
qemu-ppc <qemu-ppc@nongnu.org>,
"Aleksandar Markovic" <amarkovic@wavecomp.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: Re: [PATCH v3 19/33] sm501: make SerialMM a child, export chardev property
Date: Thu, 24 Oct 2019 12:28:52 +0200 [thread overview]
Message-ID: <CAMxuvawtzdWkyuZRoEs9Zmv9EsxeD6H_d+9-aEM0PetKjf1hbQ@mail.gmail.com> (raw)
In-Reply-To: <0033fd98-f191-c3f5-4726-ba052254808a@redhat.com>
Hi
On Thu, Oct 24, 2019 at 12:58 AM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> On 10/23/19 7:31 PM, Marc-André Lureau wrote:
> > Embed the SerialMM sybus device, and re-export its "chardev" property.
> > That way, we can get rid of PROP_PTR "chr-state" and better track
> > devices relationship.
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> > hw/display/sm501.c | 31 ++++++++++++++++++++++---------
> > hw/sh4/r2d.c | 2 +-
> > 2 files changed, 23 insertions(+), 10 deletions(-)
> >
> > diff --git a/hw/display/sm501.c b/hw/display/sm501.c
> > index 1f33c87e65..6efdf764c1 100644
> > --- a/hw/display/sm501.c
> > +++ b/hw/display/sm501.c
> > @@ -1930,13 +1930,14 @@ typedef struct {
> > SM501State state;
> > uint32_t vram_size;
> > uint32_t base;
> > - void *chr_state;
> > + SerialMM serial;
> > } SM501SysBusState;
> >
> > static void sm501_realize_sysbus(DeviceState *dev, Error **errp)
> > {
> > SM501SysBusState *s = SYSBUS_SM501(dev);
> > SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
> > + SerialState *ss = &s->serial.serial;
> > DeviceState *usb_dev;
> >
> > sm501_init(&s->state, dev, s->vram_size);
> > @@ -1958,17 +1959,18 @@ static void sm501_realize_sysbus(DeviceState *dev, Error **errp)
> > sysbus_pass_irq(sbd, SYS_BUS_DEVICE(usb_dev));
> >
> > /* bridge to serial emulation module */
> > - if (s->chr_state) {
> > - serial_mm_init(&s->state.mmio_region, SM501_UART0, 2,
> > - NULL, /* TODO : chain irq to IRL */
> > - 115200, s->chr_state, DEVICE_LITTLE_ENDIAN);
> > + if (qemu_chr_fe_backend_connected(&ss->chr)) {
>
> Oh, this is a Companion Chip (Northbridge + Southbridge), mostly
> implementing the display part, that's why it is in hw/display/.
>
> The SM501_UART0 is always mapped here, no need to check for the backend.
> (Not related to your series goal, but cleaning this might simplify this
> patch).
I see, I will drop a FIXME. Otherwise, it looks ok?
>
> > + MemoryRegion *mr;
> > + qdev_init_nofail(DEVICE(&s->serial));
> > + mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->serial), 0);
> > + memory_region_add_subregion(&s->state.mmio_region, SM501_UART0, mr);
> > + /* TODO : chain irq to IRL */
> > }
> > }
> >
> > static Property sm501_sysbus_properties[] = {
> > DEFINE_PROP_UINT32("vram-size", SM501SysBusState, vram_size, 0),
> > DEFINE_PROP_UINT32("base", SM501SysBusState, base, 0),
> > - DEFINE_PROP_PTR("chr-state", SM501SysBusState, chr_state),
> > DEFINE_PROP_END_OF_LIST(),
> > };
> >
> > @@ -1999,9 +2001,19 @@ static void sm501_sysbus_class_init(ObjectClass *klass, void *data)
> > dc->props = sm501_sysbus_properties;
> > dc->reset = sm501_reset_sysbus;
> > dc->vmsd = &vmstate_sm501_sysbus;
> > - /* Note: pointer property "chr-state" may remain null, thus
> > - * no need for dc->user_creatable = false;
> > - */
> > +}
> > +
> > +static void sm501_sysbus_init(Object *o)
> > +{
> > + SM501SysBusState *self = SYSBUS_SM501(o);
> > + SerialMM *s = &self->serial;
> > +
> > + sysbus_init_child_obj(o, "serial", s, sizeof(SerialMM), TYPE_SERIAL_MM);
> > + qdev_prop_set_int32(DEVICE(s), "instance-id", SM501_UART0);
> > + qdev_prop_set_uint8(DEVICE(s), "regshift", 2);
> > + qdev_prop_set_uint8(DEVICE(s), "endianness", DEVICE_LITTLE_ENDIAN);
> > +
> > + object_property_add_alias(o, "chardev", OBJECT(s), "chardev", &error_abort);
> > }
> >
> > static const TypeInfo sm501_sysbus_info = {
> > @@ -2009,6 +2021,7 @@ static const TypeInfo sm501_sysbus_info = {
> > .parent = TYPE_SYS_BUS_DEVICE,
> > .instance_size = sizeof(SM501SysBusState),
> > .class_init = sm501_sysbus_class_init,
> > + .instance_init = sm501_sysbus_init,
> > };
> >
> > #define TYPE_PCI_SM501 "sm501"
> > diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c
> > index ee0840f380..72bb5285cc 100644
> > --- a/hw/sh4/r2d.c
> > +++ b/hw/sh4/r2d.c
> > @@ -272,7 +272,7 @@ static void r2d_init(MachineState *machine)
> > busdev = SYS_BUS_DEVICE(dev);
> > qdev_prop_set_uint32(dev, "vram-size", SM501_VRAM_SIZE);
> > qdev_prop_set_uint32(dev, "base", 0x10000000);
> > - qdev_prop_set_ptr(dev, "chr-state", serial_hd(2));
> > + qdev_prop_set_chr(dev, "chardev", serial_hd(2));
> > qdev_init_nofail(dev);
> > sysbus_mmio_map(busdev, 0, 0x10000000);
> > sysbus_mmio_map(busdev, 1, 0x13e00000);
> >
next prev parent reply other threads:[~2019-10-24 10:44 UTC|newest]
Thread overview: 99+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-23 17:31 [PATCH v3 00/33] Clean-ups: qom-ify serial and remove QDEV_PROP_PTR Marc-André Lureau
2019-10-23 17:31 ` [PATCH v3 01/33] qdev: remove unused qdev_prop_int64 Marc-André Lureau
2019-11-18 14:01 ` Peter Maydell
2019-11-20 3:36 ` Marc-André Lureau
2019-10-23 17:31 ` [PATCH v3 02/33] sysbus: remove unused sysbus_try_create* Marc-André Lureau
2019-10-23 22:35 ` Philippe Mathieu-Daudé
2019-11-18 14:02 ` Peter Maydell
2019-10-23 17:31 ` [PATCH v3 03/33] sysbus: remove outdated comment Marc-André Lureau
2019-10-23 22:36 ` Philippe Mathieu-Daudé
2019-10-23 17:31 ` [PATCH v3 04/33] chardev: generate an internal id when none given Marc-André Lureau
2019-11-18 14:12 ` Peter Maydell
2019-11-18 18:54 ` Marc-André Lureau
2019-10-23 17:31 ` [PATCH v3 05/33] serial-pci-multi: factor out multi_serial_get_nr_ports Marc-André Lureau
2019-10-23 22:41 ` Philippe Mathieu-Daudé
2019-10-24 9:59 ` Marc-André Lureau
2019-10-23 17:31 ` [PATCH v3 06/33] serial: initial qom-ification Marc-André Lureau
2019-10-24 8:48 ` Marc-André Lureau
2019-10-23 17:31 ` [PATCH v3 07/33] serial: register vmsd with DeviceClass Marc-André Lureau
2019-11-18 14:21 ` Peter Maydell
2019-11-19 10:22 ` Marc-André Lureau
2019-11-19 10:33 ` Peter Maydell
2019-11-19 11:57 ` Marc-André Lureau
2019-11-20 18:54 ` Dr. David Alan Gilbert
2019-11-21 6:49 ` Marc-André Lureau
2019-10-23 17:31 ` [PATCH v3 08/33] serial: add "chardev" property Marc-André Lureau
2019-10-23 22:39 ` Philippe Mathieu-Daudé
2019-11-18 14:23 ` Peter Maydell
2019-10-23 17:31 ` [PATCH v3 09/33] serial: add "baudbase" property Marc-André Lureau
2019-10-23 22:40 ` Philippe Mathieu-Daudé
2019-11-18 14:26 ` Peter Maydell
2019-10-23 17:31 ` [PATCH v3 10/33] serial: add "instance-id" property Marc-André Lureau
2019-11-18 14:29 ` Peter Maydell
2019-11-19 10:32 ` Marc-André Lureau
2019-11-20 9:06 ` Marc-André Lureau
2019-10-23 17:31 ` [PATCH v3 11/33] serial: realize the serial device Marc-André Lureau
2019-10-23 17:31 ` [PATCH v3 12/33] serial: replace serial_exit_core() with unrealize Marc-André Lureau
2019-11-18 14:32 ` Peter Maydell
2019-11-20 12:32 ` Philippe Mathieu-Daudé
2019-10-23 17:31 ` [PATCH v3 13/33] serial: start making SerialMM a sysbus device Marc-André Lureau
2019-11-18 14:43 ` Peter Maydell
2019-11-20 7:34 ` Marc-André Lureau
2019-11-20 10:36 ` Peter Maydell
2019-11-20 10:40 ` Marc-André Lureau
2019-11-20 10:58 ` Peter Maydell
2019-11-20 11:03 ` Marc-André Lureau
2019-10-23 17:31 ` [PATCH v3 14/33] serial-mm: add "regshift" property Marc-André Lureau
2019-11-18 14:54 ` Peter Maydell
2019-11-20 7:53 ` Marc-André Lureau
2019-11-20 10:43 ` Peter Maydell
2019-10-23 17:31 ` [PATCH v3 15/33] serial-mm: add endianness property Marc-André Lureau
2019-11-18 15:02 ` Peter Maydell
2019-11-18 15:07 ` Peter Maydell
2019-11-20 7:59 ` Marc-André Lureau
2019-11-20 12:57 ` Philippe Mathieu-Daudé
2019-10-23 17:31 ` [PATCH v3 16/33] serial-mm: use sysbus facilities Marc-André Lureau
2019-11-18 15:09 ` Peter Maydell
2019-11-20 8:30 ` Marc-André Lureau
2019-11-20 10:46 ` Peter Maydell
2019-10-23 17:31 ` [PATCH v3 17/33] serial: make SerialIO a sysbus device Marc-André Lureau
2019-11-18 15:16 ` Peter Maydell
2019-11-20 8:41 ` Marc-André Lureau
2019-10-23 17:31 ` [PATCH v3 18/33] mips: inline serial_init Marc-André Lureau
2019-11-18 15:24 ` Peter Maydell
2019-11-20 11:14 ` Marc-André Lureau
2019-11-20 0:07 ` Aleksandar Markovic
2019-10-23 17:31 ` [PATCH v3 19/33] sm501: make SerialMM a child, export chardev property Marc-André Lureau
2019-10-23 22:57 ` Philippe Mathieu-Daudé
2019-10-24 10:28 ` Marc-André Lureau [this message]
2019-10-23 17:31 ` [PATCH v3 20/33] vmmouse: replace PROP_PTR with PROP_LINK Marc-André Lureau
2019-10-23 22:59 ` Philippe Mathieu-Daudé
2019-10-23 17:31 ` [PATCH v3 21/33] lance: " Marc-André Lureau
2019-10-23 23:00 ` Philippe Mathieu-Daudé
2019-10-24 11:09 ` Marc-André Lureau
2019-10-24 11:47 ` Philippe Mathieu-Daudé
2019-10-24 11:52 ` Peter Maydell
2019-10-24 18:07 ` Eduardo Habkost
2019-10-25 7:31 ` Peter Maydell
2019-10-24 12:25 ` Marc-André Lureau
2019-10-23 17:31 ` [PATCH v3 22/33] etraxfs: remove PROP_PTR usage Marc-André Lureau
2019-11-18 15:28 ` Peter Maydell
2019-10-23 17:31 ` [PATCH v3 23/33] dp8393x: replace PROP_PTR with PROP_LINK Marc-André Lureau
2019-10-23 23:02 ` Philippe Mathieu-Daudé
2019-10-24 11:12 ` Marc-André Lureau
2019-10-24 11:48 ` Philippe Mathieu-Daudé
2019-10-23 17:31 ` [PATCH v3 24/33] leon3: use qemu_irq framework instead of callback as property Marc-André Lureau
2019-11-18 14:15 ` KONRAD Frederic
2019-11-18 15:34 ` Peter Maydell
2019-10-23 17:31 ` [PATCH v3 25/33] sparc: move PIL irq handling to cpu.c Marc-André Lureau
2019-11-18 15:38 ` Peter Maydell
2019-10-23 17:31 ` [PATCH v3 26/33] RFC: mips/cps: fix setting saar property Marc-André Lureau
2019-10-23 17:31 ` [PATCH v3 27/33] cris: improve passing PIC interrupt vector to the CPU Marc-André Lureau
2019-11-18 15:40 ` Peter Maydell
2019-10-23 17:31 ` [PATCH v3 28/33] smbus-eeprom: remove PROP_PTR Marc-André Lureau
2019-10-23 17:31 ` [PATCH v3 29/33] omap-intc: " Marc-André Lureau
2019-10-23 17:31 ` [PATCH v3 30/33] omap-i2c: " Marc-André Lureau
2019-10-23 17:31 ` [PATCH v3 31/33] omap-gpio: " Marc-André Lureau
2019-10-23 17:31 ` [PATCH v3 32/33] qdev: remove PROP_MEMORY_REGION Marc-André Lureau
2019-10-23 23:07 ` Philippe Mathieu-Daudé
2019-10-23 17:31 ` [PATCH v3 33/33] qdev: remove QDEV_PROP_PTR Marc-André Lureau
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=CAMxuvawtzdWkyuZRoEs9Zmv9EsxeD6H_d+9-aEM0PetKjf1hbQ@mail.gmail.com \
--to=marcandre.lureau@redhat.com \
--cc=amarkovic@wavecomp.com \
--cc=arikalo@wavecomp.com \
--cc=atar4qemu@gmail.com \
--cc=aurelien@aurel32.net \
--cc=berrange@redhat.com \
--cc=chouteau@adacore.com \
--cc=cminyard@mvista.com \
--cc=edgar.iglesias@gmail.com \
--cc=ehabkost@redhat.com \
--cc=frederic.konrad@adacore.com \
--cc=hpoussin@reactos.org \
--cc=jasowang@redhat.com \
--cc=magnus.damm@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pburton@wavecomp.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rth@twiddle.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).