qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Hervé Poussineau" <hpoussin@reactos.org>
To: Programmingkid <programmingkidx@gmail.com>,
	qemu-devel qemu-devel <qemu-devel@nongnu.org>
Cc: "qemu-ppc@nongnu.org list:PowerPC" <qemu-ppc@nongnu.org>
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH for-2.5] mac_dbdma: always initialize channel field in DBDMA_channel
Date: Fri, 13 Nov 2015 10:45:22 +0100	[thread overview]
Message-ID: <5645B132.2070404@reactos.org> (raw)
In-Reply-To: <11643EA3-BD07-4DD1-8599-1DD91D1CDE4D@gmail.com>

Le 13/11/2015 05:09, Programmingkid a écrit :
>
> On Nov 12, 2015, at 11:04 PM, qemu-ppc-request@nongnu.org wrote:
>
>> Message: 3
>> Date: Thu, 12 Nov 2015 22:24:08 +0100
>> From: Herv? Poussineau <hpoussin@reactos.org>
>> To: qemu-devel@nongnu.org
>> Cc: "open list:Old World" <qemu-ppc@nongnu.org>, Herv? Poussineau
>> 	<hpoussin@reactos.org>
>> Subject: [Qemu-ppc] [PATCH for-2.5] mac_dbdma: always initialize
>> 	channel	field in DBDMA_channel
>> Message-ID: <1447363448-20405-1-git-send-email-hpoussin@reactos.org>
>> Content-Type: text/plain; charset=UTF-8
>>
>> dbdma_from_ch() uses channel field to return the right DBDMA object.
>> Previous code was working if guest OS was only using registered DMA channels.
>> However, it lead to QEMU crashes if guest OS was using unregistered DMA channels.
>>
>> Signed-off-by: Herv? Poussineau <hpoussin@reactos.org>
>> ---
>> hw/misc/macio/mac_dbdma.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c
>> index 779683c..5ee8f02 100644
>> --- a/hw/misc/macio/mac_dbdma.c
>> +++ b/hw/misc/macio/mac_dbdma.c
>> @@ -557,7 +557,6 @@ void DBDMA_register_channel(void *dbdma, int nchan, qemu_irq irq,
>>      DBDMA_DPRINTF("DBDMA_register_channel 0x%x\n", nchan);
>>
>>      ch->irq = irq;
>> -    ch->channel = nchan;
>>      ch->rw = rw;
>>      ch->flush = flush;
>>      ch->io.opaque = opaque;
>> @@ -753,6 +752,7 @@ void* DBDMA_init (MemoryRegion **dbdma_mem)
>>      for (i = 0; i < DBDMA_CHANNELS; i++) {
>>          DBDMA_io *io = &s->channels[i].io;
>>          qemu_iovec_init(&io->iov, 1);
>> +        s->channels[i].channel = i;
>>      }
>>
>>      memory_region_init_io(&s->mem, NULL, &dbdma_ops, s, "dbdma", 0x1000);
>> --
>> 2.1.4
>
> What operating system(s) did you use to test this patch out?
>

It was during some custom tests with OpenBIOS, where i miswrote the IDE DMA channel.

However, you can see the problem by using this "patch":
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index 3ee962f..73dfec0 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -629,7 +629,7 @@ void macio_ide_init_drives(MACIOIDEState *s, DriveInfo **hd_table)
  void macio_ide_register_dma(MACIOIDEState *s, void *dbdma, int channel)
  {
      s->dbdma = dbdma;
-    DBDMA_register_channel(dbdma, channel, s->dma_irq,
+    DBDMA_register_channel(dbdma, channel + 1, s->dma_irq,
                             pmac_ide_transfer, pmac_ide_flush, s);
  }

And starting whatever operating system. As soon as DMA is used to read the disk/cdrom, QEMU will crash.

Regards,

Hervé

  reply	other threads:[~2015-11-13  9:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.31561.1447387463.7903.qemu-ppc@nongnu.org>
2015-11-13  4:09 ` [Qemu-devel] [Qemu-ppc] [PATCH for-2.5] mac_dbdma: always initialize channel field in DBDMA_channel Programmingkid
2015-11-13  9:45   ` Hervé Poussineau [this message]
2015-11-13 10:40     ` Thomas Huth
2015-11-13 12:10       ` Hervé Poussineau
2015-11-19 19:33         ` Thomas Huth
2015-11-13 11:23     ` Mark Cave-Ayland
2015-12-14 18:34       ` Laurent Vivier

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=5645B132.2070404@reactos.org \
    --to=hpoussin@reactos.org \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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).