qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] Re: DMA timeouts running a FreeBSD guest with last


From: Carlo Marcelo Arenas Belon
Subject: [Qemu-devel] [PATCH] Re: DMA timeouts running a FreeBSD guest with last CVS snapshot
Date: Mon, 22 Jan 2007 04:23:16 -0600
User-agent: Mutt/1.4.1i

On Mon, Jan 15, 2007 at 03:21:36AM -0600, Carlo Marcelo Arenas Belon wrote:
> FreeBSD 6.2 guest I noticed the following errors at boot time :
> 
>   ad0: 2048MB <QEMU HARDDISK 0.8.3> at ata0-master WDMA2
>   ad0: FAILURE - READ_DMA timed out LBA=4194301
>   acd0: CDROM <QEMU CD-ROM/0.8.3> at ata1-master WDMA2
>   acd0: TIMEOUT - READ BIG retrying (1 retry left)
> 

The problem is that FreeBSD is sending a WIN_READDMA (0xC8) command to the
emulated PIIX3 controller before it sets the DMA address that will be used and
therefore the code in ide_dma_start is not setting bm->cur_addr to the right
value (it is left set to 0) and then it is failing the validation in
dma_buf_rw where the distance between bm->cur_addr and bm->addr is expected to
be smaller than 1 page (4K) and resulting in an EOT error and a timeout which
FreeBSD handles by resetting the IDE controller.

Apparently all other guests I'd tried (Linux, Solaris, OpenBSD and Windows)
set the address first (bmdma_addr_write) and then send the request for a DMA
command and are therefore not affected by this, but even if FreeBSD behavior
is peculiar, it should be OK if implemented against real hardware as per the
spec in :

  http://www.intel.com/design/intarch/datashts/290550.htm

The following patch moves the initialization of bm->cur_addr to match FreeBSD
behavior while being also compatible with all other guests but keeping in
sync closely the values of the memory addresses which will be used for the DMA
in a way that better emulates real hardware.

Tested with guests running FreeBSD 6.2 amd64, OpenBSD 4.0 amd64, Ubuntu Linux 
6.06 amd64, OpenSolaris b55b amd64, Windows 2000 Professional i386 and Gentoo
Linux 2006.1 i386.

Carlo

Attachment: qemu-dma-freebsd.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]