Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

Paolo Bonzini
2015-07-29T08:17:18Z

On 29/07/2015 02:47, Andy Lutomirski wrote:
> > > If new kernels ignore the IOMMU for devices that don't set the flag
> > > and there are physical devices that already exist and don't set the
> > > flag, then those devices won't work reliably on most modern
> > > non-virtual platforms, PPC included.
> >
> > Are there many virtio physical devices out there ? We are talking about
> > a virtio flag right ? Or have you been considering something else ?
>
> Yes, virtio flag. I dislike having a virtio flag at all, but so far
> no one has come up with any better ideas. If there was a reliable,
> cross-platform mechanism for per-device PCI bus properties, I'd be all
> for using that instead.

No, a virtio flag doesn't make sense.

Blindly using system memory is a bug in QEMU; it has to be fixed to use
the right address space, and then whatever the system provides to
describe "the right address space" can be used (like the DMAR table on x86).

On PPC I suppose you could use the host bridge's device tree? If you
need a hook, you can add a

bool virtio_should_bypass_iommu(void)
{
/* lookup something in the device tree?!? */
}
EXPORT_SYMBOL_GPL(virtio_should_bypass_iommu);

in some pseries.c file, and in the driver:

static bool virtio_bypass_iommu(void)
{
bool (*fn)(void);

fn = symbol_get(virtio_should_bypass_iommu);
return fn && fn();
}

Awful, but that's what this thing is.

Paolo