All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/char: QOM'ify escc.c (fix)
@ 2016-06-01  7:58 xiaoqiang zhao
  2016-06-01 12:33 ` Mark Cave-Ayland
  2016-06-01 19:44 ` Mark Cave-Ayland
  0 siblings, 2 replies; 6+ messages in thread
From: xiaoqiang zhao @ 2016-06-01  7:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: pbonzini, mark.cave-ayland, peter.maydell, michael,
	edgar.iglesias, armbru

The previous commit e7c9136977cb99c6eb52c9139f7b8d8b5fa87db9
(hw/char: QOM'ify escc.c) cause qemu-system-ppc/ppc64
OpenBIOS to freeze on startup, this commit fix it.

Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
---
 hw/char/escc.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/hw/char/escc.c b/hw/char/escc.c
index 8e6a7df..31a5f90 100644
--- a/hw/char/escc.c
+++ b/hw/char/escc.c
@@ -989,18 +989,13 @@ static void escc_init1(Object *obj)
     SysBusDevice *dev = SYS_BUS_DEVICE(obj);
     unsigned int i;
 
-    s->chn[0].disabled = s->disabled;
-    s->chn[1].disabled = s->disabled;
     for (i = 0; i < 2; i++) {
         sysbus_init_irq(dev, &s->chn[i].irq);
         s->chn[i].chn = 1 - i;
-        s->chn[i].clock = s->frequency / 2;
     }
     s->chn[0].otherchn = &s->chn[1];
     s->chn[1].otherchn = &s->chn[0];
 
-    memory_region_init_io(&s->mmio, obj, &escc_mem_ops, s, "escc",
-                          ESCC_SIZE << s->it_shift);
     sysbus_init_mmio(dev, &s->mmio);
 }
 
@@ -1009,8 +1004,15 @@ static void escc_realize(DeviceState *dev, Error **errp)
     ESCCState *s = ESCC(dev);
     unsigned int i;
 
+    s->chn[0].disabled = s->disabled;
+    s->chn[1].disabled = s->disabled;
+
+    memory_region_init_io(&s->mmio, OBJECT(dev), &escc_mem_ops, s, "escc",
+                          ESCC_SIZE << s->it_shift);
+
     for (i = 0; i < 2; i++) {
         if (s->chn[i].chr) {
+            s->chn[i].clock = s->frequency / 2;
             qemu_chr_add_handlers(s->chn[i].chr, serial_can_receive,
                                   serial_receive1, serial_event, &s->chn[i]);
         }
-- 
2.1.4

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

* Re: [Qemu-devel] [PATCH] hw/char: QOM'ify escc.c (fix)
  2016-06-01  7:58 [Qemu-devel] [PATCH] hw/char: QOM'ify escc.c (fix) xiaoqiang zhao
@ 2016-06-01 12:33 ` Mark Cave-Ayland
  2016-06-01 12:38   ` xiaoqiang zhao
  2016-06-01 13:13   ` Paolo Bonzini
  2016-06-01 19:44 ` Mark Cave-Ayland
  1 sibling, 2 replies; 6+ messages in thread
From: Mark Cave-Ayland @ 2016-06-01 12:33 UTC (permalink / raw)
  To: xiaoqiang zhao, qemu-devel
  Cc: pbonzini, peter.maydell, michael, edgar.iglesias, armbru

On 01/06/16 08:58, xiaoqiang zhao wrote:

> The previous commit e7c9136977cb99c6eb52c9139f7b8d8b5fa87db9
> (hw/char: QOM'ify escc.c) cause qemu-system-ppc/ppc64
> OpenBIOS to freeze on startup, this commit fix it.
> 
> Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
> ---
>  hw/char/escc.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/char/escc.c b/hw/char/escc.c
> index 8e6a7df..31a5f90 100644
> --- a/hw/char/escc.c
> +++ b/hw/char/escc.c
> @@ -989,18 +989,13 @@ static void escc_init1(Object *obj)
>      SysBusDevice *dev = SYS_BUS_DEVICE(obj);
>      unsigned int i;
>  
> -    s->chn[0].disabled = s->disabled;
> -    s->chn[1].disabled = s->disabled;
>      for (i = 0; i < 2; i++) {
>          sysbus_init_irq(dev, &s->chn[i].irq);
>          s->chn[i].chn = 1 - i;
> -        s->chn[i].clock = s->frequency / 2;
>      }
>      s->chn[0].otherchn = &s->chn[1];
>      s->chn[1].otherchn = &s->chn[0];
>  
> -    memory_region_init_io(&s->mmio, obj, &escc_mem_ops, s, "escc",
> -                          ESCC_SIZE << s->it_shift);
>      sysbus_init_mmio(dev, &s->mmio);
>  }
>  
> @@ -1009,8 +1004,15 @@ static void escc_realize(DeviceState *dev, Error **errp)
>      ESCCState *s = ESCC(dev);
>      unsigned int i;
>  
> +    s->chn[0].disabled = s->disabled;
> +    s->chn[1].disabled = s->disabled;
> +
> +    memory_region_init_io(&s->mmio, OBJECT(dev), &escc_mem_ops, s, "escc",
> +                          ESCC_SIZE << s->it_shift);
> +
>      for (i = 0; i < 2; i++) {
>          if (s->chn[i].chr) {
> +            s->chn[i].clock = s->frequency / 2;

Should this not still be in escc_init1() since s->frequency is set by a
property?

>              qemu_chr_add_handlers(s->chn[i].chr, serial_can_receive,
>                                    serial_receive1, serial_event, &s->chn[i]);
>          }
> 

Otherwise, thanks for the patch - I'll try it this evening on both
qemu-system-ppc and qemu-system-sparc since both of them use ESCC serial
ports and report back.


ATB,

Mark.

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

* Re: [Qemu-devel] [PATCH] hw/char: QOM'ify escc.c (fix)
  2016-06-01 12:33 ` Mark Cave-Ayland
@ 2016-06-01 12:38   ` xiaoqiang zhao
  2016-06-01 13:13   ` Paolo Bonzini
  1 sibling, 0 replies; 6+ messages in thread
From: xiaoqiang zhao @ 2016-06-01 12:38 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: qemu-devel, pbonzini, peter.maydell, michael, edgar.iglesias, armbru



在 2016年6月1日,20:33,Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> 写道:

>>     for (i = 0; i < 2; i++) {
>>         if (s->chn[i].chr) {
>> +            s->chn[i].clock = s->frequency / 2;
> 
> Should this not still be in escc_init1() since s->frequency is set by a
> property?

You are right!

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

* Re: [Qemu-devel] [PATCH] hw/char: QOM'ify escc.c (fix)
  2016-06-01 12:33 ` Mark Cave-Ayland
  2016-06-01 12:38   ` xiaoqiang zhao
@ 2016-06-01 13:13   ` Paolo Bonzini
  1 sibling, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2016-06-01 13:13 UTC (permalink / raw)
  To: Mark Cave-Ayland, xiaoqiang zhao, qemu-devel
  Cc: peter.maydell, michael, edgar.iglesias, armbru



On 01/06/2016 14:33, Mark Cave-Ayland wrote:
> > +
> > +    memory_region_init_io(&s->mmio, OBJECT(dev), &escc_mem_ops, s, "escc",
> > +                          ESCC_SIZE << s->it_shift);
> > +
> >      for (i = 0; i < 2; i++) {
> >          if (s->chn[i].chr) {
> > +            s->chn[i].clock = s->frequency / 2;
> 
> Should this not still be in escc_init1() since s->frequency is set by a
> property?

It's the other way round, escc_init1 is for things that do _not_ depend
on property values.  So I think this should be fine.

Thanks,

Paolo

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

* Re: [Qemu-devel] [PATCH] hw/char: QOM'ify escc.c (fix)
  2016-06-01  7:58 [Qemu-devel] [PATCH] hw/char: QOM'ify escc.c (fix) xiaoqiang zhao
  2016-06-01 12:33 ` Mark Cave-Ayland
@ 2016-06-01 19:44 ` Mark Cave-Ayland
  2016-06-01 23:20   ` xiaoqiang zhao
  1 sibling, 1 reply; 6+ messages in thread
From: Mark Cave-Ayland @ 2016-06-01 19:44 UTC (permalink / raw)
  To: xiaoqiang zhao, qemu-devel
  Cc: pbonzini, peter.maydell, michael, edgar.iglesias, armbru

On 01/06/16 08:58, xiaoqiang zhao wrote:

> The previous commit e7c9136977cb99c6eb52c9139f7b8d8b5fa87db9
> (hw/char: QOM'ify escc.c) cause qemu-system-ppc/ppc64
> OpenBIOS to freeze on startup, this commit fix it.
> 
> Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
> ---
>  hw/char/escc.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/char/escc.c b/hw/char/escc.c
> index 8e6a7df..31a5f90 100644
> --- a/hw/char/escc.c
> +++ b/hw/char/escc.c
> @@ -989,18 +989,13 @@ static void escc_init1(Object *obj)
>      SysBusDevice *dev = SYS_BUS_DEVICE(obj);
>      unsigned int i;
>  
> -    s->chn[0].disabled = s->disabled;
> -    s->chn[1].disabled = s->disabled;
>      for (i = 0; i < 2; i++) {
>          sysbus_init_irq(dev, &s->chn[i].irq);
>          s->chn[i].chn = 1 - i;
> -        s->chn[i].clock = s->frequency / 2;
>      }
>      s->chn[0].otherchn = &s->chn[1];
>      s->chn[1].otherchn = &s->chn[0];
>  
> -    memory_region_init_io(&s->mmio, obj, &escc_mem_ops, s, "escc",
> -                          ESCC_SIZE << s->it_shift);
>      sysbus_init_mmio(dev, &s->mmio);
>  }
>  
> @@ -1009,8 +1004,15 @@ static void escc_realize(DeviceState *dev, Error **errp)
>      ESCCState *s = ESCC(dev);
>      unsigned int i;
>  
> +    s->chn[0].disabled = s->disabled;
> +    s->chn[1].disabled = s->disabled;
> +
> +    memory_region_init_io(&s->mmio, OBJECT(dev), &escc_mem_ops, s, "escc",
> +                          ESCC_SIZE << s->it_shift);
> +
>      for (i = 0; i < 2; i++) {
>          if (s->chn[i].chr) {
> +            s->chn[i].clock = s->frequency / 2;
>              qemu_chr_add_handlers(s->chn[i].chr, serial_can_receive,
>                                    serial_receive1, serial_event, &s->chn[i]);
>          }
> 

Thanks a lot for this patch, I can confirm that it fixes the problem
under qemu-system-ppc for me:

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.

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

* Re: [Qemu-devel] [PATCH] hw/char: QOM'ify escc.c (fix)
  2016-06-01 19:44 ` Mark Cave-Ayland
@ 2016-06-01 23:20   ` xiaoqiang zhao
  0 siblings, 0 replies; 6+ messages in thread
From: xiaoqiang zhao @ 2016-06-01 23:20 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: qemu-devel, pbonzini, michael, edgar.iglesias, armbru, peter.maydell



> 在 2016年6月2日,03:44,Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> 写道:
> 
>> On 01/06/16 08:58, xiaoqiang zhao wrote:
>> 
>> The previous commit e7c9136977cb99c6eb52c9139f7b8d8b5fa87db9
>> (hw/char: QOM'ify escc.c) cause qemu-system-ppc/ppc64
>> OpenBIOS to freeze on startup, this commit fix it.
>> 
>> Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
>> ---
>> hw/char/escc.c | 12 +++++++-----
>> 1 file changed, 7 insertions(+), 5 deletions(-)
>> 
>> diff --git a/hw/char/escc.c b/hw/char/escc.c
>> index 8e6a7df..31a5f90 100644
>> --- a/hw/char/escc.c
>> +++ b/hw/char/escc.c
>> @@ -989,18 +989,13 @@ static void escc_init1(Object *obj)
>>     SysBusDevice *dev = SYS_BUS_DEVICE(obj);
>>     unsigned int i;
>> 
>> -    s->chn[0].disabled = s->disabled;
>> -    s->chn[1].disabled = s->disabled;
>>     for (i = 0; i < 2; i++) {
>>         sysbus_init_irq(dev, &s->chn[i].irq);
>>         s->chn[i].chn = 1 - i;
>> -        s->chn[i].clock = s->frequency / 2;
>>     }
>>     s->chn[0].otherchn = &s->chn[1];
>>     s->chn[1].otherchn = &s->chn[0];
>> 
>> -    memory_region_init_io(&s->mmio, obj, &escc_mem_ops, s, "escc",
>> -                          ESCC_SIZE << s->it_shift);
>>     sysbus_init_mmio(dev, &s->mmio);
>> }
>> 
>> @@ -1009,8 +1004,15 @@ static void escc_realize(DeviceState *dev, Error **errp)
>>     ESCCState *s = ESCC(dev);
>>     unsigned int i;
>> 
>> +    s->chn[0].disabled = s->disabled;
>> +    s->chn[1].disabled = s->disabled;
>> +
>> +    memory_region_init_io(&s->mmio, OBJECT(dev), &escc_mem_ops, s, "escc",
>> +                          ESCC_SIZE << s->it_shift);
>> +
>>     for (i = 0; i < 2; i++) {
>>         if (s->chn[i].chr) {
>> +            s->chn[i].clock = s->frequency / 2;
>>             qemu_chr_add_handlers(s->chn[i].chr, serial_can_receive,
>>                                   serial_receive1, serial_event, &s->chn[i]);
>>         }
> 
> Thanks a lot for this patch, I can confirm that it fixes the problem
> under qemu-system-ppc for me:
> 
> Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> 
> 
> ATB,
> 
> Mark.
> 
> 

That's OK :-)

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

end of thread, other threads:[~2016-06-01 23:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-01  7:58 [Qemu-devel] [PATCH] hw/char: QOM'ify escc.c (fix) xiaoqiang zhao
2016-06-01 12:33 ` Mark Cave-Ayland
2016-06-01 12:38   ` xiaoqiang zhao
2016-06-01 13:13   ` Paolo Bonzini
2016-06-01 19:44 ` Mark Cave-Ayland
2016-06-01 23:20   ` xiaoqiang zhao

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.