Skip to content

KVM-VFIO pseudo device for VFIO coherency

Alex Williamson kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4kvm: Destroy & free KVM devices on releasearch/powerpc/kvm/book3s_xics.c virt/kvm/kvm_main.c+5 -18 replies
2/4kvm: Add VFIO deviceDocumentation/virtual/kvm/devices/vfio.txt arch/x86/kvm/Kconfig arch/x86/kvm/Makefile +5 more+256 -10 replies
3/4kvm/x86: Convert iommu_flags to iommu_noncoherentarch/ia64/include/asm/kvm_host.h arch/x86/include/asm/kvm_host.h arch/x86/kvm/vmx.c +3 more+12 -150 replies
4/4kvm: Create non-coherent DMA registerationarch/x86/include/asm/kvm_host.h arch/x86/kvm/vmx.c arch/x86/kvm/x86.c +3 more+91 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] KVM-VFIO pseudo device for VFIO coherency

This series allows QEMU to create a VFIO device in KVM for registering VFIO groups. The initial user of this interface is to toggle whether KVM emulates coherency instructions like WBINVD. For this particular use case I've toyed with the idea of disabling NoSnoop at the device, but we already have an example where this fails as video cards often have backdoors to PCI config space and may re-enable NoSnoop support. Regardless of whether the driver should be doing this or not, we don't really want to rely on well behaved drivers for things as important as coherency.

In this first step we assume that noncoherent DMA is possible any time a VFIO group is present. I have follow-on patches which fix a bug in intel-iommu which that prevents us from always enabling SNP support in the IOMMU page tables and prevents us from tracking the hardware capabilities of the IOMMU domain for coherency. Once that is fixed I can fill in the TODO which would allow us to only mark VFIO as noncoherent when necessary.

POWER support for VFIO would also like to make use of the VFIO pseudo device interface, but has some remaining work to architect an interface into it.

I'd very much like to see this for v3.13. Thanks,

Alex

---

Alex Williamson (4):
kvm: Destroy & free KVM devices on release
kvm: Add VFIO device
kvm/x86: Convert iommu_flags to iommu_noncoherent
kvm: Create non-coherent DMA registeration

 Documentation/virtual/kvm/devices/vfio.txt |   22 ++
 arch/ia64/include/asm/kvm_host.h           |    2 
 arch/powerpc/kvm/book3s_xics.c             |    1 
 arch/x86/include/asm/kvm_host.h            |    4 
 arch/x86/kvm/Kconfig                       |    1 
 arch/x86/kvm/Makefile                      |    2 
 arch/x86/kvm/vmx.c                         |    3 
 arch/x86/kvm/x86.c                         |   21 ++
 include/linux/kvm_host.h                   |   23 ++
 include/uapi/linux/kvm.h                   |    4 
 virt/kvm/Kconfig                           |    3 
 virt/kvm/iommu.c                           |   22 +-
 virt/kvm/kvm_main.c                        |   10 +
 virt/kvm/vfio.c                            |  263 ++++++++++++++++++++++++++++
 14 files changed, 362 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/virtual/kvm/devices/vfio.txt
 create mode 100644 virt/kvm/vfio.c