From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
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 Developers" <qemu-devel@nongnu.org>,
"KONRAD Frederic" <frederic.konrad@adacore.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Aleksandar Rikalo" <arikalo@wavecomp.com>,
"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>,
qemu-ppc <qemu-ppc@nongnu.org>,
"Aleksandar Markovic" <amarkovic@wavecomp.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: Re: [PATCH v2 10/28] serial: add "base" property
Date: Tue, 22 Oct 2019 18:42:12 +0200 [thread overview]
Message-ID: <CAMxuvaxTdPyODFAofKWURq8_zJNQtxiX7Xj8dogB1iFPqgbj4A@mail.gmail.com> (raw)
In-Reply-To: <CAFEAcA-5DkdB-iUHBRONB0SHO6rYmU7ZzdojJd5iZbQdLHswTQ@mail.gmail.com>
Hi
On Tue, Oct 22, 2019 at 6:32 PM Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Tue, 22 Oct 2019 at 17:23, Marc-André Lureau
> <marcandre.lureau@redhat.com> wrote:
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> > hw/char/serial.c | 3 +++
> > include/hw/char/serial.h | 1 +
> > 2 files changed, 4 insertions(+)
> >
> > diff --git a/hw/char/serial.c b/hw/char/serial.c
> > index 0ae52ec60c..4748a2b023 100644
> > --- a/hw/char/serial.c
> > +++ b/hw/char/serial.c
> > @@ -990,6 +990,7 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase,
> > qdev_connect_gpio_out_named(dev, "serial-irq", 0, irq);
> > qdev_prop_set_uint32(dev, "baudbase", baudbase);
> > qdev_prop_set_chr(dev, "chardev", chr);
> > + qdev_prop_set_uint64(dev, "base", base);
> > serial_realize_core(s, &error_fatal);
> > qdev_set_legacy_instance_id(dev, base, 2);
> > qdev_init_nofail(dev);
> > @@ -1003,6 +1004,7 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase,
> > static Property serial_properties[] = {
> > DEFINE_PROP_CHR("chardev", SerialState, chr),
> > DEFINE_PROP_UINT32("baudbase", SerialState, baudbase, 115200),
> > + DEFINE_PROP_UINT64("base", SerialState, base, 0),
> > DEFINE_PROP_END_OF_LIST(),
> > };
> >
> > @@ -1083,6 +1085,7 @@ SerialState *serial_mm_init(MemoryRegion *address_space,
> > qdev_prop_set_uint32(dev, "baudbase", baudbase);
> > qdev_prop_set_chr(dev, "chardev", chr);
> > qdev_prop_set_uint8(dev, "regshift", regshift);
> > + qdev_prop_set_uint64(dev, "base", base);
> >
> > serial_realize_core(s, &error_fatal);
> > qdev_set_legacy_instance_id(DEVICE(s), base, 2);
> > diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
> > index ecbd3f1b40..6e9c9768ed 100644
> > --- a/include/hw/char/serial.h
> > +++ b/include/hw/char/serial.h
> > @@ -77,6 +77,7 @@ typedef struct SerialState {
> >
> > QEMUTimer *modem_status_poll;
> > MemoryRegion io;
> > + uint64_t base;
> > } SerialState;
>
> Devices shouldn't have properties to set their MMIO base
> address -- instead the memory-mapped serial device should
> be a child of TYPE_SYSBUS_DEVICE, and should provide
> a sysbus mmio region, which users of the device can
> map at the address they want to map the registers.
Can we make serial a sysbus device? It seems to be embedded from
various places, in various buses. Not sure that makes sense, please
advise me :)
"base" is mostly needed to set qdev_set_legacy_instance_id(), I should
have added a commit comment. Otherwise, it can be passed to
serial_mm_connect() directly.
next prev parent reply other threads:[~2019-10-22 16:57 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 16:21 [PATCH v2 00/28] Clean-ups: qom-ify serial and remove QDEV_PROP_PTR Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 01/28] chardev: generate an internal id when none given Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 02/28] serial-pci-multi: factor out multi_serial_get_nr_ports Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 03/28] serial: initial qom-ification Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 04/28] serial: register vmsd with DeviceClass Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 05/28] serial: add and set "chardev" property Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 06/28] serial: make SerialMMState actually a different type Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 07/28] serial: add and set "regshift" property Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 08/28] serial: convert irq to qdev gpio properties Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 09/28] serial: add "baudbase" property Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 10/28] serial: add "base" property Marc-André Lureau
2019-10-22 16:31 ` Peter Maydell
2019-10-22 16:42 ` Marc-André Lureau [this message]
2019-10-22 16:50 ` Peter Maydell
2019-10-22 16:21 ` [PATCH v2 11/28] serial: realize the serial device Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 12/28] serial: replace serial_exit_core() with unrealize Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 13/28] serial: factor out serial_mm_connect Marc-André Lureau
2019-10-22 16:34 ` Peter Maydell
2019-10-22 16:21 ` [PATCH v2 14/28] sm501: embed the serial device Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 15/28] vmmouse: replace PROP_PTR with PROP_LINK Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 16/28] lance: " Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 17/28] etraxfs: remove PROP_PTR usage Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 18/28] dp8393x: replace PROP_PTR with PROP_LINK Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 19/28] leon3: use qemu_irq framework instead of callback as property Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 20/28] sparc: move PIL irq handling to cpu.c Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 21/28] RFC: mips/cps: fix setting saar property Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 22/28] cris: improve passing PIC interrupt vector to the CPU Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 23/28] smbus-eeprom: remove PROP_PTR Marc-André Lureau
2019-10-22 17:19 ` Peter Maydell
2019-10-22 17:56 ` Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 24/28] omap-intc: " Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 25/28] omap-i2c: " Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 26/28] omap-gpio: " Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 27/28] qdev: remove PROP_MEMORY_REGION Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 28/28] 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=CAMxuvaxTdPyODFAofKWURq8_zJNQtxiX7Xj8dogB1iFPqgbj4A@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=peter.maydell@linaro.org \
--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).