Patchwork [1/6] i82378/i82374: do not create DMA controller twice

login
register
mail settings
Submitter Hervé Poussineau
Date March 17, 2012, 2:39 p.m.
Message ID <1331995186-18507-2-git-send-email-hpoussin@reactos.org>
Download mbox | patch
Permalink /patch/147329/
State New
Headers show

Comments

Hervé Poussineau - March 17, 2012, 2:39 p.m.
This fixes a crash in PReP emulation when using DMA controller to access floppy drive.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/i82374.c |    5 ++++-
 hw/i82378.c |    5 +++--
 2 files changed, 7 insertions(+), 3 deletions(-)
Andreas Färber - March 19, 2012, 11:03 a.m.
Am 17.03.2012 15:39, schrieb Hervé Poussineau:
> This fixes a crash in PReP emulation when using DMA controller to access floppy drive.
> 
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas

> ---
>  hw/i82374.c |    5 ++++-
>  hw/i82378.c |    5 +++--
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/i82374.c b/hw/i82374.c
> index 67298a3..4a922c3 100644
> --- a/hw/i82374.c
> +++ b/hw/i82374.c
> @@ -38,6 +38,7 @@ do { fprintf(stderr, "i82374 ERROR: " fmt , ## __VA_ARGS__); } while (0)
>  
>  typedef struct I82374State {
>      uint8_t commands[8];
> +    qemu_irq out;
>  } I82374State;
>  
>  static const VMStateDescription vmstate_i82374 = {
> @@ -99,7 +100,7 @@ static uint32_t i82374_read_descriptor(void *opaque, uint32_t nport)
>  
>  static void i82374_init(I82374State *s)
>  {
> -    DMA_init(1, NULL);
> +    DMA_init(1, &s->out);
>      memset(s->commands, 0, sizeof(s->commands));
>  }
>  
> @@ -132,6 +133,8 @@ static int i82374_isa_init(ISADevice *dev)
>  
>      i82374_init(s);
>  
> +    qdev_init_gpio_out(&dev->qdev, &s->out, 1);
> +
>      return 0;
>  }
>  
> diff --git a/hw/i82378.c b/hw/i82378.c
> index faad1a3..9b11d90 100644
> --- a/hw/i82378.c
> +++ b/hw/i82378.c
> @@ -170,6 +170,7 @@ static void i82378_init(DeviceState *dev, I82378State *s)
>  {
>      ISABus *isabus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(dev, "isa.0"));
>      ISADevice *pit;
> +    ISADevice *isa;
>      qemu_irq *out0_irq;
>  
>      /* This device has:
> @@ -199,8 +200,8 @@ static void i82378_init(DeviceState *dev, I82378State *s)
>      pcspk_init(isabus, pit);
>  
>      /* 2 82C37 (dma) */
> -    DMA_init(1, &s->out[1]);
> -    isa_create_simple(isabus, "i82374");
> +    isa = isa_create_simple(isabus, "i82374");
> +    qdev_connect_gpio_out(&isa->qdev, 0, s->out[1]);
>  
>      /* timer */
>      isa_create_simple(isabus, "mc146818rtc");
Alexander Graf - March 19, 2012, 11:23 a.m.
On 19.03.2012, at 12:03, Andreas Färber wrote:

> Am 17.03.2012 15:39, schrieb Hervé Poussineau:
>> This fixes a crash in PReP emulation when using DMA controller to access floppy drive.
>> 
>> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
> 
> Reviewed-by: Andreas Färber <afaerber@suse.de>

Why only reviewed? You're the PREP maintainer and this bug shows with PREP, so I don't see why this shouldn't go through your tree :).


Alex
Andreas Färber - March 19, 2012, 12:19 p.m.
Am 19.03.2012 12:23, schrieb Alexander Graf:
> 
> On 19.03.2012, at 12:03, Andreas Färber wrote:
> 
>> Am 17.03.2012 15:39, schrieb Hervé Poussineau:
>>> This fixes a crash in PReP emulation when using DMA controller to access floppy drive.
>>>
>>> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
>>
>> Reviewed-by: Andreas Färber <afaerber@suse.de>
> 
> Why only reviewed?

Because I didn't test and apply it yet :) before reading through the
whole series and rebasing prep-up branch. I like feedback to my patches,
so I provide some myself (and get journaling in my outbox as a bonus).

> You're the PREP maintainer and this bug shows with PREP, so I don't see why this shouldn't go through your tree :).

Correct apart from the spelling, and no one said it should go through
you or the ppc tree. Relax and have a nice vacation! I never noticed you
flaming Anthony for reviewing patches he is going to apply later on... ;)

Andreas
Alexander Graf - March 19, 2012, 12:21 p.m.
On 19.03.2012, at 13:19, Andreas Färber wrote:

> Am 19.03.2012 12:23, schrieb Alexander Graf:
>> 
>> On 19.03.2012, at 12:03, Andreas Färber wrote:
>> 
>>> Am 17.03.2012 15:39, schrieb Hervé Poussineau:
>>>> This fixes a crash in PReP emulation when using DMA controller to access floppy drive.
>>>> 
>>>> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
>>> 
>>> Reviewed-by: Andreas Färber <afaerber@suse.de>
>> 
>> Why only reviewed?
> 
> Because I didn't test and apply it yet :) before reading through the
> whole series and rebasing prep-up branch. I like feedback to my patches,
> so I provide some myself (and get journaling in my outbox as a bonus).
> 
>> You're the PREP maintainer and this bug shows with PREP, so I don't see why this shouldn't go through your tree :).
> 
> Correct apart from the spelling, and no one said it should go through
> you or the ppc tree. Relax and have a nice vacation! I never noticed you
> flaming Anthony for reviewing patches he is going to apply later on... ;)

Oh, sorry, it sounded like "Reviewed, someone else please apply it". I didn't think of the case where you'd pick it up yourself later :).


Alex
Andreas Färber - April 14, 2012, 11:24 a.m.
Am 19.03.2012 12:03, schrieb Andreas Färber:
> Am 17.03.2012 15:39, schrieb Hervé Poussineau:
>> This fixes a crash in PReP emulation when using DMA controller to access floppy drive.
>>
>> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
> 
> Reviewed-by: Andreas Färber <afaerber@suse.de>

Thanks, tested and applied to prep-up (rebreaking the long line):
http://repo.or.cz/w/qemu/afaerber.git/shortlog/refs/heads/prep-up

Andreas

Patch

diff --git a/hw/i82374.c b/hw/i82374.c
index 67298a3..4a922c3 100644
--- a/hw/i82374.c
+++ b/hw/i82374.c
@@ -38,6 +38,7 @@  do { fprintf(stderr, "i82374 ERROR: " fmt , ## __VA_ARGS__); } while (0)
 
 typedef struct I82374State {
     uint8_t commands[8];
+    qemu_irq out;
 } I82374State;
 
 static const VMStateDescription vmstate_i82374 = {
@@ -99,7 +100,7 @@  static uint32_t i82374_read_descriptor(void *opaque, uint32_t nport)
 
 static void i82374_init(I82374State *s)
 {
-    DMA_init(1, NULL);
+    DMA_init(1, &s->out);
     memset(s->commands, 0, sizeof(s->commands));
 }
 
@@ -132,6 +133,8 @@  static int i82374_isa_init(ISADevice *dev)
 
     i82374_init(s);
 
+    qdev_init_gpio_out(&dev->qdev, &s->out, 1);
+
     return 0;
 }
 
diff --git a/hw/i82378.c b/hw/i82378.c
index faad1a3..9b11d90 100644
--- a/hw/i82378.c
+++ b/hw/i82378.c
@@ -170,6 +170,7 @@  static void i82378_init(DeviceState *dev, I82378State *s)
 {
     ISABus *isabus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(dev, "isa.0"));
     ISADevice *pit;
+    ISADevice *isa;
     qemu_irq *out0_irq;
 
     /* This device has:
@@ -199,8 +200,8 @@  static void i82378_init(DeviceState *dev, I82378State *s)
     pcspk_init(isabus, pit);
 
     /* 2 82C37 (dma) */
-    DMA_init(1, &s->out[1]);
-    isa_create_simple(isabus, "i82374");
+    isa = isa_create_simple(isabus, "i82374");
+    qdev_connect_gpio_out(&isa->qdev, 0, s->out[1]);
 
     /* timer */
     isa_create_simple(isabus, "mc146818rtc");