qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/2] milkymist-uart fixes
@ 2013-08-31 17:22 Antony Pavlov
  2013-08-31 17:22 ` [Qemu-devel] [PATCH v2 1/2] milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write() Antony Pavlov
  2013-08-31 17:22 ` [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init Antony Pavlov
  0 siblings, 2 replies; 10+ messages in thread
From: Antony Pavlov @ 2013-08-31 17:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Crosthwaite, Michael Walle, Andreas Färber

This patch series based on DIGIC support adding comments:
  http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg04748.html

[PATCH v2 1/2] milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write()
[PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init

Changes since v1:
 * remove xml-styled quotes from patch comments;
 * introduce TypeInfo::instance_init milkymist_uart_init().

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH v2 1/2] milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write()
  2013-08-31 17:22 [Qemu-devel] [PATCH v2 0/2] milkymist-uart fixes Antony Pavlov
@ 2013-08-31 17:22 ` Antony Pavlov
  2013-09-01 22:58   ` Peter Crosthwaite
  2013-09-02 15:39   ` Michael Walle
  2013-08-31 17:22 ` [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init Antony Pavlov
  1 sibling, 2 replies; 10+ messages in thread
From: Antony Pavlov @ 2013-08-31 17:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Crosthwaite, Michael Walle, Antony Pavlov,
	Andreas Färber

qemu_chr_fe_write() is capable of returning 0
to indicate EAGAIN (and friends) and we don't
handle this.

Just change it to qemu_chr_fe_write_all() to fix.

Reported-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
CC: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
CC: Michael Walle <michael@walle.cc>
CC: Andreas Färber <afaerber@suse.de>
---
 hw/char/milkymist-uart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c
index 2e4b5c5..6e4bc20 100644
--- a/hw/char/milkymist-uart.c
+++ b/hw/char/milkymist-uart.c
@@ -124,7 +124,7 @@ static void uart_write(void *opaque, hwaddr addr, uint64_t value,
     switch (addr) {
     case R_RXTX:
         if (s->chr) {
-            qemu_chr_fe_write(s->chr, &ch, 1);
+            qemu_chr_fe_write_all(s->chr, &ch, 1);
         }
         s->regs[R_STAT] |= STAT_TX_EVT;
         break;
-- 
1.8.4.rc3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init
  2013-08-31 17:22 [Qemu-devel] [PATCH v2 0/2] milkymist-uart fixes Antony Pavlov
  2013-08-31 17:22 ` [Qemu-devel] [PATCH v2 1/2] milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write() Antony Pavlov
@ 2013-08-31 17:22 ` Antony Pavlov
  2013-08-31 19:09   ` Andreas Färber
  2013-09-01 23:03   ` Peter Crosthwaite
  1 sibling, 2 replies; 10+ messages in thread
From: Antony Pavlov @ 2013-08-31 17:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Crosthwaite, Michael Walle, Antony Pavlov,
	Andreas Färber

Use of SysBusDevice::init is deprecated.
Use Device::realize instead of SysBusDevice::init.
Check dma/pl330.c for an example of the pattern.

Also introduce TypeInfo::instance_init milkymist_uart_init()
as char/pl011.c does.

Reported-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
CC: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
CC: Michael Walle <michael@walle.cc>
CC: Andreas Färber <afaerber@suse.de>
---
 hw/char/milkymist-uart.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c
index 6e4bc20..da51f82 100644
--- a/hw/char/milkymist-uart.c
+++ b/hw/char/milkymist-uart.c
@@ -195,22 +195,26 @@ static void milkymist_uart_reset(DeviceState *d)
     s->regs[R_STAT] = STAT_THRE;
 }
 
-static int milkymist_uart_init(SysBusDevice *dev)
+static void milkymist_uart_realize(DeviceState *dev, Error **errp)
 {
     MilkymistUartState *s = MILKYMIST_UART(dev);
 
-    sysbus_init_irq(dev, &s->irq);
-
-    memory_region_init_io(&s->regs_region, OBJECT(s), &uart_mmio_ops, s,
-                          "milkymist-uart", R_MAX * 4);
-    sysbus_init_mmio(dev, &s->regs_region);
-
     s->chr = qemu_char_get_next_serial();
     if (s->chr) {
         qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
     }
+}
 
-    return 0;
+static void milkymist_uart_init(Object *obj)
+{
+    SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
+    MilkymistUartState *s = MILKYMIST_UART(obj);
+
+    sysbus_init_irq(sbd, &s->irq);
+
+    memory_region_init_io(&s->regs_region, OBJECT(s), &uart_mmio_ops, s,
+                          "milkymist-uart", R_MAX * 4);
+    sysbus_init_mmio(sbd, &s->regs_region);
 }
 
 static const VMStateDescription vmstate_milkymist_uart = {
@@ -227,9 +231,8 @@ static const VMStateDescription vmstate_milkymist_uart = {
 static void milkymist_uart_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
-    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
-    k->init = milkymist_uart_init;
+    dc->realize = milkymist_uart_realize;
     dc->reset = milkymist_uart_reset;
     dc->vmsd = &vmstate_milkymist_uart;
 }
@@ -238,6 +241,7 @@ static const TypeInfo milkymist_uart_info = {
     .name          = TYPE_MILKYMIST_UART,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(MilkymistUartState),
+    .instance_init = milkymist_uart_init,
     .class_init    = milkymist_uart_class_init,
 };
 
-- 
1.8.4.rc3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init
  2013-08-31 17:22 ` [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init Antony Pavlov
@ 2013-08-31 19:09   ` Andreas Färber
  2013-09-01 18:28     ` Antony Pavlov
  2013-09-01 23:03   ` Peter Crosthwaite
  1 sibling, 1 reply; 10+ messages in thread
From: Andreas Färber @ 2013-08-31 19:09 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: Peter Crosthwaite, Michael Walle, qemu-devel

Am 31.08.2013 19:22, schrieb Antony Pavlov:
> Use of SysBusDevice::init is deprecated.
> Use Device::realize instead of SysBusDevice::init.
> Check dma/pl330.c for an example of the pattern.
> 
> Also introduce TypeInfo::instance_init milkymist_uart_init()
> as char/pl011.c does.
> 
> Reported-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> CC: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> CC: Michael Walle <michael@walle.cc>
> CC: Andreas Färber <afaerber@suse.de>
> ---
>  hw/char/milkymist-uart.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)

Thanks, applied to qom-next (with shortened commit message):
https://github.com/afaerber/qemu-cpu/commits/qom-next

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init
  2013-08-31 19:09   ` Andreas Färber
@ 2013-09-01 18:28     ` Antony Pavlov
  2013-09-02  7:53       ` Andreas Färber
  0 siblings, 1 reply; 10+ messages in thread
From: Antony Pavlov @ 2013-09-01 18:28 UTC (permalink / raw)
  To: Andreas Färber; +Cc: Peter Crosthwaite, Michael Walle, qemu-devel

On Sat, 31 Aug 2013 21:09:20 +0200
Andreas Färber <afaerber@suse.de> wrote:

> Am 31.08.2013 19:22, schrieb Antony Pavlov:
> > Use of SysBusDevice::init is deprecated.
> > Use Device::realize instead of SysBusDevice::init.
> > Check dma/pl330.c for an example of the pattern.
> > 
> > Also introduce TypeInfo::instance_init milkymist_uart_init()
> > as char/pl011.c does.
> > 
> > Reported-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> > Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> > CC: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> > CC: Michael Walle <michael@walle.cc>
> > CC: Andreas Färber <afaerber@suse.de>
> > ---
> >  hw/char/milkymist-uart.c | 24 ++++++++++++++----------
> >  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> Thanks, applied to qom-next (with shortened commit message):
> https://github.com/afaerber/qemu-cpu/commits/qom-next
> 

That's about the patch number 1 ( milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write()) ?

-- 
Best regards,
  Antony Pavlov

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/2] milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write()
  2013-08-31 17:22 ` [Qemu-devel] [PATCH v2 1/2] milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write() Antony Pavlov
@ 2013-09-01 22:58   ` Peter Crosthwaite
  2013-09-17 17:24     ` Michael Walle
  2013-09-02 15:39   ` Michael Walle
  1 sibling, 1 reply; 10+ messages in thread
From: Peter Crosthwaite @ 2013-09-01 22:58 UTC (permalink / raw)
  To: Antony Pavlov
  Cc: Michael Walle, qemu-devel@nongnu.org Developers,
	Andreas Färber

On Sun, Sep 1, 2013 at 3:22 AM, Antony Pavlov <antonynpavlov@gmail.com> wrote:
> qemu_chr_fe_write() is capable of returning 0
> to indicate EAGAIN (and friends) and we don't
> handle this.
>
> Just change it to qemu_chr_fe_write_all() to fix.
>
> Reported-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Acked-by Peter Crosthwaite <peter.crosthwaite@xilinx.com>

> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> CC: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> CC: Michael Walle <michael@walle.cc>
> CC: Andreas Färber <afaerber@suse.de>
> ---
>  hw/char/milkymist-uart.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c
> index 2e4b5c5..6e4bc20 100644
> --- a/hw/char/milkymist-uart.c
> +++ b/hw/char/milkymist-uart.c
> @@ -124,7 +124,7 @@ static void uart_write(void *opaque, hwaddr addr, uint64_t value,
>      switch (addr) {
>      case R_RXTX:
>          if (s->chr) {
> -            qemu_chr_fe_write(s->chr, &ch, 1);
> +            qemu_chr_fe_write_all(s->chr, &ch, 1);
>          }
>          s->regs[R_STAT] |= STAT_TX_EVT;
>          break;
> --
> 1.8.4.rc3
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init
  2013-08-31 17:22 ` [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init Antony Pavlov
  2013-08-31 19:09   ` Andreas Färber
@ 2013-09-01 23:03   ` Peter Crosthwaite
  1 sibling, 0 replies; 10+ messages in thread
From: Peter Crosthwaite @ 2013-09-01 23:03 UTC (permalink / raw)
  To: Antony Pavlov
  Cc: Michael Walle, qemu-devel@nongnu.org Developers,
	Andreas Färber

On Sun, Sep 1, 2013 at 3:22 AM, Antony Pavlov <antonynpavlov@gmail.com> wrote:
> Use of SysBusDevice::init is deprecated.
> Use Device::realize instead of SysBusDevice::init.
> Check dma/pl330.c for an example of the pattern.
>

I think Andreas may have fixed in enqueue, but informal suggestion of
change patterns arent really suitable for commit messages. So drop
sentances like this one.

Regards,
Peter

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init
  2013-09-01 18:28     ` Antony Pavlov
@ 2013-09-02  7:53       ` Andreas Färber
  0 siblings, 0 replies; 10+ messages in thread
From: Andreas Färber @ 2013-09-02  7:53 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: Peter Crosthwaite, Michael Walle, qemu-devel

Am 01.09.2013 20:28, schrieb Antony Pavlov:
> On Sat, 31 Aug 2013 21:09:20 +0200
> Andreas Färber <afaerber@suse.de> wrote:
> 
>> Am 31.08.2013 19:22, schrieb Antony Pavlov:
>>> Use of SysBusDevice::init is deprecated.
>>> Use Device::realize instead of SysBusDevice::init.
>>> Check dma/pl330.c for an example of the pattern.
>>>
>>> Also introduce TypeInfo::instance_init milkymist_uart_init()
>>> as char/pl011.c does.
>>>
>>> Reported-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
>>> CC: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>> CC: Michael Walle <michael@walle.cc>
>>> CC: Andreas Färber <afaerber@suse.de>
>>> ---
>>>  hw/char/milkymist-uart.c | 24 ++++++++++++++----------
>>>  1 file changed, 14 insertions(+), 10 deletions(-)
>>
>> Thanks, applied to qom-next (with shortened commit message):
>> https://github.com/afaerber/qemu-cpu/commits/qom-next
>>
> 
> That's about the patch number 1 ( milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write()) ?

No, it's about patch 2, which I replied to. Patch 1 is not a QOM
conversion but an unrelated bug fix - it can be handled either by the
lm32 maintainer or by whomever takes care of the char layer these days
(Anthony/Gerd).

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/2] milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write()
  2013-08-31 17:22 ` [Qemu-devel] [PATCH v2 1/2] milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write() Antony Pavlov
  2013-09-01 22:58   ` Peter Crosthwaite
@ 2013-09-02 15:39   ` Michael Walle
  1 sibling, 0 replies; 10+ messages in thread
From: Michael Walle @ 2013-09-02 15:39 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: Peter Crosthwaite, qemu-devel, Andreas Färber

Am Samstag, 31. August 2013, 19:22:39 schrieb Antony Pavlov:
> qemu_chr_fe_write() is capable of returning 0
> to indicate EAGAIN (and friends) and we don't
> handle this.
> 
> Just change it to qemu_chr_fe_write_all() to fix.
> 
> Reported-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> CC: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> CC: Michael Walle <michael@walle.cc>
> CC: Andreas Färber <afaerber@suse.de>
> ---
>  hw/char/milkymist-uart.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c
> index 2e4b5c5..6e4bc20 100644
> --- a/hw/char/milkymist-uart.c
> +++ b/hw/char/milkymist-uart.c
> @@ -124,7 +124,7 @@ static void uart_write(void *opaque, hwaddr addr,
> uint64_t value, switch (addr) {
>      case R_RXTX:
>          if (s->chr) {
> -            qemu_chr_fe_write(s->chr, &ch, 1);
> +            qemu_chr_fe_write_all(s->chr, &ch, 1);
>          }
>          s->regs[R_STAT] |= STAT_TX_EVT;
>          break;


Acked-by: Michael Walle <michael@walle.cc>

-- 
Michael

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/2] milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write()
  2013-09-01 22:58   ` Peter Crosthwaite
@ 2013-09-17 17:24     ` Michael Walle
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Walle @ 2013-09-17 17:24 UTC (permalink / raw)
  To: Peter Crosthwaite
  Cc: Antony Pavlov, Andreas Färber,
	qemu-devel@nongnu.org Developers

Am Montag, 2. September 2013, 00:58:42 schrieb Peter Crosthwaite:
> On Sun, Sep 1, 2013 at 3:22 AM, Antony Pavlov <antonynpavlov@gmail.com> 
wrote:
> > qemu_chr_fe_write() is capable of returning 0
> > to indicate EAGAIN (and friends) and we don't
> > handle this.
> > 
> > Just change it to qemu_chr_fe_write_all() to fix.
> > 
> > Reported-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> 
> Acked-by Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> 
> > Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> > CC: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> > CC: Michael Walle <michael@walle.cc>
> > CC: Andreas Färber <afaerber@suse.de>
> > ---
> > 
> >  hw/char/milkymist-uart.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c
> > index 2e4b5c5..6e4bc20 100644
> > --- a/hw/char/milkymist-uart.c
> > +++ b/hw/char/milkymist-uart.c
> > @@ -124,7 +124,7 @@ static void uart_write(void *opaque, hwaddr addr,
> > uint64_t value,
> > 
> >      switch (addr) {
> >      
> >      case R_RXTX:
> >          if (s->chr) {
> > 
> > -            qemu_chr_fe_write(s->chr, &ch, 1);
> > +            qemu_chr_fe_write_all(s->chr, &ch, 1);
> > 
> >          }
> >          s->regs[R_STAT] |= STAT_TX_EVT;
> >          break;
> > 
> > --
> > 1.8.4.rc3

I'll pick this one. Thank you.

-- 
michael

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-09-17 17:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-31 17:22 [Qemu-devel] [PATCH v2 0/2] milkymist-uart fixes Antony Pavlov
2013-08-31 17:22 ` [Qemu-devel] [PATCH v2 1/2] milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write() Antony Pavlov
2013-09-01 22:58   ` Peter Crosthwaite
2013-09-17 17:24     ` Michael Walle
2013-09-02 15:39   ` Michael Walle
2013-08-31 17:22 ` [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init Antony Pavlov
2013-08-31 19:09   ` Andreas Färber
2013-09-01 18:28     ` Antony Pavlov
2013-09-02  7:53       ` Andreas Färber
2013-09-01 23:03   ` Peter Crosthwaite

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).