Received: from eggs.gnu.org ([2001:4830:134:3::10]:40462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUecD-0007PZ-Pb for qemu-devel@nongnu.org; Tue, 02 Aug 2016 14:40:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bUecB-0006EG-NJ for qemu-devel@nongnu.org; Tue, 02 Aug 2016 14:40:32 -0400 Message-ID: From: "Benjamin David Lunt" References: <20160802061128.22869.50660.malonedeb@soybean.canonical.com> <20160802133908.GA5421@noname.redhat.com> Date: Tue, 2 Aug 2016 11:09:24 -0700 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=original Content-Transfer-Encoding: 7bit Sender: "Benjamin David Lunt" Subject: Re: [Qemu-devel] [Bug 1608802] [NEW] READ_DMA (0xC8) command does not work correctly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , Stefan Weil Cc: John Snow , Peter Maydell , qemu-devel@nongnu.org, qemu-block@nongnu.org ----- Original Message ----- > Am 02.08.2016 um 08:52 hat Stefan Weil geschrieben: >> Am 02.08.2016 um 08:11 schrieb Stefan Weil: >> > Public bug reported: >> > >> > The QEMU PC emulation of DMA does not behave like real hardware or other >> > virtualization software. >> > >> > >From the original bug report (Benjamin David Lunt): >> > >> > Back to the READ_DMA command, it is my conclusion that the >> > READ_DMA command, more precisely, the BUS Master part of QEMU is >> > in error. The tests that people have done to see if it works, is >> > probably the guest finding out that DMA doesn't work and defaulting >> > to PIO, but since the read was successful visually to the user, the >> > user assumed the READ_DMA command works, where the guest actually >> > defaulted back to PIO transfers without notice. >> > >> > My code works on real hardware (numerous machines), Bochs, and Oracle's >> > Virtual Box. >> > >> > ... >> > >> > I have a small test suite, zipped and included at: >> > www.fysnet.net/temp/c8bug.zip >> > >> > Within this zip file is a.img. This is a freeDOS bootable >> > floppy. Emulate it with QEMU and then at the DOS prompt, run >> > c8bug.exe. >> >> Hi John, >> >> I got this bug report only recently from a Windows user, >> but it also occurs on Linux. >> >> As I don't know whether this is a regression or whether >> it is relevant for QEMU 2.7, it would be good if you and >> maybe more people could have a look on that problem, >> too. > > I don't think it's a regression. I commented with more detail in the bug > report, and despite the test case being buggy it seems to be true that > qemu doesn't get the flags completely right (we should set either BSY or > DRQ, but we do set both). Apparently none of the common drivers check > for this, though, so it never made any difference. > > Kevin I agree that the controller is either BSY && !DRQ or !BSY && DRQ. This is explained in section 9.7 of ATAPI v6, Page 354 (doc page 340). My test was to simply show that the status remains 0xD8. BSY *and* DRQ always set. If a patch is made to make QEMU either BSY && !DRQ or !BSY && DRQ after the DMA command, then I believe it will be correct. I would guess that the common drivers, as you put it, don't check for the status at all, but simply wait to see if an interrupt fires. Thank you, Ben