qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] SPARC iommu mapping
@ 2006-04-04 19:27 Joerg Platte
  2006-04-05 15:23 ` Joerg Platte
  0 siblings, 1 reply; 16+ messages in thread
From: Joerg Platte @ 2006-04-04 19:27 UTC (permalink / raw)
  To: qemu-devel

Hi!

I still have problems when using a disk image for the SPARC system emulator. 
Reading and writing now works better than in previous versions, but sometimes 
data written to image is simply corrupt. To find this problem I wrote a small 
program writing data to the beginning of a disk image. Afterwards I compared 
the written data in the image with the expected values. Most of the data was 
correct, but sometimes a few pages mostly contains only zeros. 

To find this problem, I enabled debugging in the esp.c file and printed the 
mapped address (after iommu mapping). In some cases the mapped address is 
zero:

Normal write:

ESP: DMA Direction: r, addr 0x008fd000 0000000b
ESP: DMA Direction: r, addr 0x0bea1000 0000e000
ESP: DMA address 0bea2000
ESP: DMA address 0bea4000
ESP: DMA address 0bea5000
ESP: DMA address 0bea6000
ESP: DMA address 0bea7000
ESP: DMA address 0bea8000
ESP: DMA address 0bea9000
ESP: DMA address 0beaa000
ESP: DMA address 0beab000
ESP: DMA address 0beac000
ESP: DMA address 0bead000
ESP: DMA address 0beaf000
ESP: DMA address 0beb0000

Faulty write:

ESP: DMA Direction: r
ESP: DMA Direction: r, addr 0x008fd000 0000000b
ESP: DMA Direction: r, addr 0x0beb1000 0000e000
ESP: DMA address 0beb2000
ESP: DMA address 0beb3000
ESP: DMA address 0beb4000
ESP: DMA address 0beb5000
ESP: DMA address 0beb6000
ESP: DMA address 0beb7000
ESP: DMA address 0beb8000
ESP: DMA address 00000000

I used this code in handle_ti to produce this output:

	    dmaptr = iommu_translate(s->espdmaregs[1] + i);
	    if ((olddma&0xfffff000) != (dmaptr&0xfffff000)) {
		    DPRINTF("DMA address %08x\n", dmaptr);
		    olddma=dmaptr;
	    }


Unfortunately, I'm no hardware or SPARC expert and it took a whole day to 
track down this problem. So I'm not able to find the reason for this 
behaviour. What may cause the wrong mapping? Is this some kind of page fault, 
which must be handled by the kernel? Or just a bug?

regards,
Jörg

^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [Qemu-devel] SPARC iommu mapping
@ 2006-04-07 15:44 Blue Swirl
  2006-04-07 21:33 ` Joerg Platte
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Blue Swirl @ 2006-04-07 15:44 UTC (permalink / raw)
  To: jplatte, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]

Thank you for the excellent analysis of the problem! Looks like Qemu doesn't 
handle the case where DMA length and SCSI length are not equal.

>Until here, the addresses are subsequent. Then the next address is much 
>lower:

So Linux splits the transfer into two parts to use two separate pieces of 
buffers. Funny, I thought this situation was exactly the one which virtually 
addressed DMA would prevent from happening.

>What is expected, when the number of bytes from the transfer register have
>been read? Should the hardware raise an interrupt? And if yes, which flags
>must be set?

Yes, there will be an interrupt. I didn't find this situation in the 
NCR53C9X.txt file documenting the ESP, though.

There are two cases:
1 - DMA length shorter than SCSI (your case)
2 - SCSI length shorter (could happen in command replies etc.)

Maybe this patch helps?

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.com/

[-- Attachment #2: qemu-sparc.patch-52.bz2 --]
[-- Type: application/octet-stream, Size: 924 bytes --]

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

end of thread, other threads:[~2006-05-03 18:52 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-04 19:27 [Qemu-devel] SPARC iommu mapping Joerg Platte
2006-04-05 15:23 ` Joerg Platte
2006-04-05 17:36   ` Blue Swirl
2006-04-05 18:14     ` Joerg Platte
2006-04-05 18:25     ` Joerg Platte
2006-04-05 20:03     ` Joerg Platte
2006-04-06 16:53     ` Joerg Platte
  -- strict thread matches above, loose matches on Subject: below --
2006-04-07 15:44 Blue Swirl
2006-04-07 21:33 ` Joerg Platte
2006-04-09 16:31 ` Joerg Platte
2006-04-10 13:18 ` Joerg Platte
2006-04-11 19:21   ` Blue Swirl
2006-04-14 16:07     ` Joerg Platte
2006-04-17  8:49       ` Blue Swirl
2006-05-03 18:37         ` Joerg Platte
2006-05-03 18:52           ` Blue Swirl

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