From: Joerg Platte <lists@naasa.net>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] SPARC iommu mapping
Date: Wed, 5 Apr 2006 20:25:39 +0200 [thread overview]
Message-ID: <200604052025.39315.lists@naasa.net> (raw)
In-Reply-To: <BAY104-F2926FE4988EEFCC93C59DFFFCB0@phx.gbl>
[-- Attachment #1: Type: text/plain, Size: 2030 bytes --]
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 like
OK, I thought I was just too stupid to find good documentation :-)
> how the MMU translates CPU's virtual addresses to physical addresses for
> 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 should
> happen then, probably put the address to AFAR register and raise some
> interrupt, while the device (for example Ethernet controller) waiting for
> the data suffers in limbo. I think it would be strange for an OS to rely 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 loaded to
> its internal translation buffer.
Maybe.
> The DMA controllers for both ESP and Lance are within the same page. This
> 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 the
> 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 directly
write to /dev/sda (with "writetest /dev/sda"). readtest can then be used
outside qemu to check the written data ("readtest imagefile").
Additionally, I logged the translated virtual address as mentioned in my first
mail. The kernel is 2.6.13.
regards,
Jörg
[-- Attachment #2: readtest.c --]
[-- Type: text/x-csrc, Size: 671 bytes --]
#include <stdio.h>
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);
}
}
[-- Attachment #3: writetest.c --]
[-- Type: text/x-csrc, Size: 289 bytes --]
#include <stdio.h>
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);
}
}
next prev parent reply other threads:[~2006-04-05 18:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=200604052025.39315.lists@naasa.net \
--to=lists@naasa.net \
--cc=jplatte@naasa.net \
--cc=qemu-devel@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).