|
From: | Avi Kivity |
Subject: | Re: [Qemu-devel] Newbie: How to implement iommu? |
Date: | Mon, 06 Apr 2009 20:41:16 +0300 |
User-agent: | Thunderbird 2.0.0.21 (X11/20090320) |
Brian Wheeler wrote:
I've been going through the source (and the list archives) and I must bemissing something obvious.
Many things in qemu are not obvious and are easy to miss, so you may drop this disclaimer in the future, if you like.
I need to translate an address passed to cpu_physical_memory_{read,write} via an IOMMU. I've been told there's a dma api, but I cannot find any documentation about it, nor can I find an obvious user of it.
The core dma api is cpu_physical_memory_{map,unmap}(), in exec.c. One user is hw/ide.c, through the helpers in dma-helpers.c.
So how do I catch cpu_physical_memory_{read,write} calls and put my address translation in there?
I guess these should be replaced by a pci_memory_{read,write}() (or equivalents for other busses) which would do the translation. Given that the translation changes depending on where you are in the system topology, you'd need to pass an identifier representing that (for pci, your PCIDevice pointer).
-- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.
[Prev in Thread] | Current Thread | [Next in Thread] |