Re: [RFC] /dev/ioasid uAPI proposal

David Gibson
2021-06-17T07:22:26Z

[-- Attachment #1.1: Type: text/plain, Size: 1799 bytes --]

On Tue, Jun 08, 2021 at 10:17:56AM -0300, Jason Gunthorpe wrote:
> On Tue, Jun 08, 2021 at 12:37:04PM +1000, David Gibson wrote:
>
> > > The PPC/SPAPR support allows KVM to associate a vfio group to an IOMMU
> > > page table so that it can handle iotlb programming from pre-registered
> > > memory without trapping out to userspace.
> >
> > To clarify that's a guest side logical vIOMMU page table which is
> > partially managed by KVM. This is an optimization - things can work
> > without it, but it means guest iomap/unmap becomes a hot path because
> > each map/unmap hypercall has to go
> > guest -> KVM -> qemu -> VFIO
> >
> > So there are multiple context transitions.
>
> Isn't this overhead true of many of the vIOMMUs?

Yes, but historically it bit much harder on POWER for a couple of reasons:

1) POWER guests *always* have a vIOMMU - the platform has no concept
of passthrough mode. We therefore had a vIOMMU implementation some
time before the AMD or Intel IOMMUs were implemented as vIOMMUs in
qemu.

2) At the time we were implementing this the supported IOVA window for
the paravirtualized IOMMU was pretty small (1G, I think) making
vIOMMU maps and unmaps a pretty common operation.

> Can the fast path be
> generalized?

Not really. This is a paravirtualized guest IOMMU, so it's a platform
specific group of hypercalls that's being interpreted by KVM and
passed through to the IOMMU side using essentially the same backend
that that the userspace implementation would eventually get to after a
bunch more context switches.

--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 156 bytes --]