linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] KVM noncoherent DMA registration and VFIO pseudo device
@ 2013-10-01 20:15 Alex Williamson
  2013-10-01 20:15 ` [PATCH 1/4] kvm: Destroy & free KVM devices on release Alex Williamson
                   ` (4 more replies)
  0 siblings, 5 replies; 22+ messages in thread
From: Alex Williamson @ 2013-10-01 20:15 UTC (permalink / raw)
  To: gleb; +Cc: aik, linux-kernel, kvm

This is a follow-up to my previous RFC series on this topic.  The goal
is to unify how KVM manages guests in the presence of non-coherent DMA
trafic and provide a way for QEMU to register VFIO groups to enable
that support.  Since this changes the way KVM handles things like
WBINVD, we use the VFIO external user interface so that KVM can verify
if a user has physical hardware access.  For now we assume VFIO domains
are always non-coherent, which is true if the IOMMU driver honors the
IOMMU_CACHE mapping attribute.  Once this is in and we figure out what
exactly VFIO should do regarding support for coherent IOMMU domains,
we can create a new interface for KVM to call.  This is noted with a
TODO in this patch.  I've reworked the device interface to use
attributes and pass an address for the file descriptor since the RFC.
Alexey, I expect that a new attribute to associate an LIOBN to a group
and arch callbacks to make use of that information is all that you'll
need to add for POWER.  Thanks,

Alex

---

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


 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/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/iommu.c                           |   22 +-
 virt/kvm/kvm_main.c                        |    8 +
 virt/kvm/vfio.c                            |  262 ++++++++++++++++++++++++++++
 12 files changed, 355 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/virtual/kvm/devices/vfio.txt
 create mode 100644 virt/kvm/vfio.c

^ permalink raw reply	[flat|nested] 22+ messages in thread
* [PATCH 0/4] KVM-VFIO pseudo device for VFIO coherency
@ 2013-10-29 16:13 Alex Williamson
  2013-10-29 16:13 ` [PATCH 1/4] kvm: Destroy & free KVM devices on release Alex Williamson
  0 siblings, 1 reply; 22+ messages in thread
From: Alex Williamson @ 2013-10-29 16:13 UTC (permalink / raw)
  To: kvm, gleb; +Cc: aik, pbonzini, linux-kernel

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

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2013-10-30 16:19 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-01 20:15 [PATCH 0/4] KVM noncoherent DMA registration and VFIO pseudo device Alex Williamson
2013-10-01 20:15 ` [PATCH 1/4] kvm: Destroy & free KVM devices on release Alex Williamson
2013-10-01 20:15 ` [PATCH 2/4] kvm/x86: Convert iommu_flags to iommu_noncoherent Alex Williamson
2013-10-01 20:15 ` [PATCH 3/4] kvm: Create non-coherent DMA registeration Alex Williamson
2013-10-04 10:02   ` Alexey Kardashevskiy
2013-10-04 14:53     ` Alex Williamson
2013-10-01 20:15 ` [PATCH 4/4] kvm: Add VFIO device for handling IOMMU cache coherency Alex Williamson
2013-10-03  2:55   ` [PATCH v2 " Alex Williamson
2013-10-03 20:40     ` Alex Williamson
2013-10-04 12:24 ` [RFC PATCH] PPC: KVM: vfio kvm device: support spapr tce Alexey Kardashevskiy
2013-10-04 16:05   ` Alex Williamson
2013-10-05  1:52     ` Alexey Kardashevskiy
2013-10-05  3:36       ` Alexey Kardashevskiy
  -- strict thread matches above, loose matches on Subject: below --
2013-10-29 16:13 [PATCH 0/4] KVM-VFIO pseudo device for VFIO coherency Alex Williamson
2013-10-29 16:13 ` [PATCH 1/4] kvm: Destroy & free KVM devices on release Alex Williamson
2013-10-30 10:40   ` Gleb Natapov
2013-10-30 14:30     ` Alex Williamson
2013-10-30 15:33       ` Gleb Natapov
2013-10-30 15:42         ` Paolo Bonzini
2013-10-30 15:44           ` Gleb Natapov
2013-10-30 15:56           ` Alex Williamson
2013-10-30 16:10             ` Paolo Bonzini
2013-10-30 16:18               ` Gleb Natapov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).