Re: [Qemu-devel] Re: [RFC PATCH 4/7] ide: IOMMU support

Joerg Roedel
2010-07-15T14:59:17Z

On Thu, Jul 15, 2010 at 11:49:20AM +0100, Paul Brook wrote:

> > An IOMMU is not necessarily part of a bus bridge. By concept an IOMMU
> > can also be implemented on a plugin-card translating only that card.
> > Real implementations that I am aware of always implement the IOMMU in
> > the PCI root bridge, though.
>
> If the IOMMU is implemented on the card, then it isn't an interesting case.
> It's effectively just a complex form of scatter-gather.
>
> If the on-card MMU can delegate pagetable walks to an external device then IMO
> that's also an unrelated feature, and requires an additional data channel.

But that would be handled by the same IOMMU emulation code, so the
hooks need to be usable there too.

> My point still stands. You should not be pushing the IOMMU handling into
> device specific code. All you need to do is make the memory access routines
> aware of which device caused the access.

Right, the device does not need to know too much about the IOMMU in the
general case. The iommu_get/iommu_read/iommu_write interface should
replaced by the pci_memory* functions like suggested by Anthony.

> The fact that the GART can translate CPU accesses proves my point. If you
> have separate code for CPU and devices, then you need to duplicate the GART
> handling code.

You can configure the GART to translate device accesses only, cpu
accesses only, or to translate both. This is hard to handle if cpu and
device emulation use the same memory access functions.

Joerg