From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRCWt-0002zA-EV for qemu-devel@nongnu.org; Wed, 05 Apr 2006 14:14:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRCWs-0002yh-F7 for qemu-devel@nongnu.org; Wed, 05 Apr 2006 14:14:55 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRCWs-0002yc-BA for qemu-devel@nongnu.org; Wed, 05 Apr 2006 14:14:54 -0400 Received: from [212.8.0.13] (helo=rosi.naasa.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FRCaR-0002uN-1X for qemu-devel@nongnu.org; Wed, 05 Apr 2006 14:18:35 -0400 Received: from jako.ping.de (p50910806.dip0.t-ipconnect.de [80.145.8.6]) by rosi.naasa.net (Postfix) with ESMTP id 87CB922AEB5 for ; Wed, 5 Apr 2006 20:14:50 +0200 (CEST) From: Joerg Platte Subject: Re: [Qemu-devel] SPARC iommu mapping References: In-Reply-To: MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_YkANE/RK8vhhkMQ" Message-Id: <200604052014.48225.jplatte@naasa.net> Reply-To: jplatte@naasa.net, qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Wed, 05 Apr 2006 18:14:55 -0000 To: qemu-devel@nongnu.org --Boundary-00=_YkANE/RK8vhhkMQ Content-Type: text/plain; charset="iso-8859-15" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Am Mittwoch, 5. April 2006 19:36 schrieb Blue Swirl: Hi! > I don't have any better documentation either, I just coded against what > Proll and Linux expect. But the theory of operation is simple. Much lik= e OK, I thought I was just too stupid to find good documentation :-) > how the MMU translates CPU's virtual addresses to physical addresses fo= r > memory, IOMMU translates device virtual memory accesses to physical > addresses. The VA to PA entries are found in a simple page table. That's what I read from qemu's iommu functions. > In the case of not finding a valid translation entry, IOMMU can't fault= the > device like normal MMU can easily fault the CPU. I don't know what shou= ld > happen then, probably put the address to AFAR register and raise some > interrupt, while the device (for example Ethernet controller) waiting f= or > the data suffers in limbo. I think it would be strange for an OS to rel= y on > this, so I guess it's a bug somewhere else. My guess for the valid bit = is > that it's used in a real IOMMU to select the entries that will be loade= d to > its internal translation buffer. Maybe.=20 > The DMA controllers for both ESP and Lance are within the same page. Th= is > means that in Qemu, DMA controller register accesses for either of them= go > to just one of these. It just happens to work, but maybe this causes th= e > problem. You could try to confirm this by enabling also DEBUG_LANCE and= see > if there is troublesome activity in the Lance direction near the bad > accesses. Hmmm, I don't use the network. Just disk access. But I'll check this. > Can you provide a test case so that I could try it as well? I'm using the two attached programs. writetest is used inside qemu to dir= ectly=20 write to /dev/sda (with "writetest /dev/sda"). readtest can then be used=20 outside qemu to check the written data ("readtest imagefile").=20 Additionally, I logged the translated virtual address as mentioned in my = first=20 mail. The kernel is 2.6.13.=20 regards, J=F6rg --Boundary-00=_YkANE/RK8vhhkMQ Content-Type: text/x-csrc; charset="iso-8859-15"; name="readtest.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="readtest.c" #include int main(int argc, char**argv) { FILE *fp; unsigned char buffer[4]; unsigned int i,j; unsigned int doprint=1; unsigned int d=0; if ((fp=fopen(argv[1], "r"))) { for (i=0; i<10000000; i+=4) { if (fread(&buffer, 4, 1, fp)!=1) { printf("error writing at byte %d\n", i); break; } d=0; for(j=0;j<4; j++) { if (buffer[3-j]!=((i>>(j*8))&0xff)) { if (doprint) { printf("data differs at address %08x\n", i); } d=1; break; } } if (d) { doprint=0; } else { doprint=1; } } fclose(fp); } } --Boundary-00=_YkANE/RK8vhhkMQ Content-Type: text/x-csrc; charset="iso-8859-15"; name="writetest.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="writetest.c" #include int main(int argc, char**argv) { FILE *fp; unsigned int i; if ((fp=fopen(argv[1], "w"))) { for (i=0; i<10000000; i+=4) { if (fwrite(&i, 4, 1, fp)!=1) { printf("error writing at byte %d\n", i); break; } } fclose(fp); } } --Boundary-00=_YkANE/RK8vhhkMQ--