milkymist-uart fixes
v2 cover milkymist-uart fixes
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().
PATCH v2 1/2 milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write()
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.
--- hw/char/milkymist-uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/char/milkymist-uart.c +1 -1
@@ -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 ;
Signature · 1 line
1.8.4.rc3
Re: [Qemu-devel] [PATCH v2 1/2] milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write()
Quoted 7 lines · 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 <[email protected]>
Acked-by Peter Crosthwaite <[email protected]>
Quoted 25 lines
Signed-off-by Antony Pavlov <[email protected]>CC Peter Crosthwaite <[email protected]>CC Michael Walle <[email protected]>CC Andreas Färber <[email protected]>--- hw/char/milkymist-uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/char/milkymist-uart.c +1
-2@@ -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
Re: [Qemu-devel] [PATCH v2 1/2] milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write()
Am Montag, 2. September 2013, 00:58:42 schrieb Peter Crosthwaite:
Quoted 1 line
On Sun, Sep 1, 2013 at 3:22 AM, Antony Pavlov <[email protected]>
Quoted 34 lines · wrote:
Quoted 7 lines
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 <[email protected]>Acked-by Peter Crosthwaite <[email protected]>
Quoted 24 lines
Signed-off-by Antony Pavlov <[email protected]>CC Peter Crosthwaite <[email protected]>CC Michael Walle <[email protected]>CC Andreas Färber <[email protected]>---
hw/char/milkymist-uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/char/milkymist-uart.c +1
-1@@ -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 );
Quoted 6 lines
Quoted 6 lines
} s->regs[R_STAT] |= STAT_TX_EVT; break;--
1.8.4.rc3
I'll pick this one. Thank you.
Signature · 1 line
michael
Re: [Qemu-devel] [PATCH v2 1/2] milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write()
In reply to Antony PavlovAm Samstag, 31. August 2013, 19:22:39 schrieb Antony Pavlov:
Quoted 20 lines
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 <[email protected]>Signed-off-by Antony Pavlov <[email protected]>CC Peter Crosthwaite <[email protected]>CC Michael Walle <[email protected]>CC Andreas Färber <[email protected]>--- hw/char/milkymist-uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/char/milkymist-uart.c +0
-0
hw/char/milkymist-uart.c static void uart_write(void *opaque, hwaddr addr, · line 130
Quoted 8 lines
hw/char/milkymist-uart.c +1
-1@@ -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 ;
Signature · 1 line
Michael
PATCH v2 2/2 milkymist-uart: use Device::realize instead of SysBusDevice::init
In reply to Antony PavlovUse 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.
--- hw/char/milkymist-uart.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
hw/char/milkymist-uart.c +14 -10
@@ -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, };
Signature · 1 line
1.8.4.rc3
Andreas Färber
AppliedRe: [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init
Am 31.08.2013 19:22, schrieb Antony Pavlov:
Quoted 7 lines
Use of
SysBusDevice::initis deprecated. UseDevice::realizeinstead ofSysBusDevice::init. Checkdma/pl330.cfor an example of the pattern.Also introduce
TypeInfo::instance_initmilkymist_uart_init()aschar/pl011.cdoes.
Quoted 8 lines
Reported-by Peter Crosthwaite <[email protected]>Signed-off-by Antony Pavlov <[email protected]>CC Peter Crosthwaite <[email protected]>CC Michael Walle <[email protected]>CC Andreas Färber <[email protected]>--- 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
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init
Quoted 17 lines · On Sat, 31 Aug 2013 21:09:20 +0200 Andreas Färber <[email protected]> wrote:
Am 31.08.2013 19:22, schrieb Antony Pavlov:
Quoted 7 lines
Use of
SysBusDevice::initis deprecated. UseDevice::realizeinstead ofSysBusDevice::init. Checkdma/pl330.cfor an example of the pattern.Also introduce
TypeInfo::instance_initmilkymist_uart_init()aschar/pl011.cdoes.Quoted 8 lines
Reported-by Peter Crosthwaite <[email protected]>Signed-off-by Antony Pavlov <[email protected]>CC Peter Crosthwaite <[email protected]>CC Michael Walle <[email protected]>CC Andreas Färber <[email protected]>--- hw/char/milkymist-uart.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
Quoted 3 lines
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
Re: [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init
Am 01.09.2013 20:28, schrieb Antony Pavlov:
Quoted 20 lines
Quoted 17 lines · On Sat, 31 Aug 2013 21:09:20 +0200 Andreas Färber <[email protected]> wrote:
Am 31.08.2013 19:22, schrieb Antony Pavlov:
Quoted 15 lines
Use of
SysBusDevice::initis deprecated. UseDevice::realizeinstead ofSysBusDevice::init. Checkdma/pl330.cfor an example of the pattern.Also introduce
TypeInfo::instance_initmilkymist_uart_init()aschar/pl011.cdoes.Reported-by Peter Crosthwaite <[email protected]>Signed-off-by Antony Pavlov <[email protected]>CC Peter Crosthwaite <[email protected]>CC Michael Walle <[email protected]>CC Andreas Färber <[email protected]>--- hw/char/milkymist-uart.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
Quoted 5 lines
Quoted 3 lines
Thanks, applied to qom-next (with shortened commit message):
https://github.com/afaerber/qemu-cpu/commits/qom-nextThat's about the patch number 1 ( milkymist-uart: use
qemu_chr_fe_write_all()instead ofqemu_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
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH v2 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init
In reply to Antony PavlovQuoted 4 lines · Antony Pavlov
Use of
SysBusDevice::initis deprecated. UseDevice::realizeinstead ofSysBusDevice::init. Checkdma/pl330.cfor 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