Skip to content

Factor VT-d KVM functions into a generic API (with multiple device assignment support)

Joerg Roedel kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest12 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12VT-d: Support multiple device assignment for KVMdrivers/pci/dmar.c drivers/pci/intel-iommu.c include/linux/dma_remapping.h +2 more+636 -1190 replies
2/12KVM: change to use new APIs for kvm vtdinclude/linux/kvm.h include/linux/kvm_host.h virt/kvm/kvm_main.c +1 more+143 -410 replies
3/12KVM: rename vtd.c to iommu.carch/ia64/kvm/Makefile arch/x86/kvm/Makefile virt/kvm/iommu.c+2 -20 replies
4/12introcude linux/iommu.h for an iommu apiinclude/linux/iommu.h+109 -00 replies
5/12add frontend implementation for the IOMMU APIdrivers/base/iommu.c+100 -00 replies
6/12select IOMMU_API when DMAR and/or AMD_IOMMU is selectedarch/ia64/Kconfig arch/x86/Kconfig drivers/base/Makefile+7 -00 replies
7/12KVM: change KVM iommu.c to use IOMMU APIarch/ia64/kvm/Makefile arch/x86/include/asm/kvm_host.h arch/x86/kvm/Makefile +2 more+40 -370 replies
8/12VT-d: adapt domain init and destroy functions for IOMMU APIdrivers/pci/intel-iommu.c include/linux/intel-iommu.h+17 -150 replies
9/12VT-d: adapt device attach and detach functions for IOMMU APIdrivers/pci/intel-iommu.c include/linux/intel-iommu.h+15 -170 replies
10/12VT-d: adapt domain map and unmap functions for IOMMU APIdrivers/pci/intel-iommu.c include/linux/intel-iommu.h+11 -150 replies
11/12VT-d: adapt domain iova_to_phys function for IOMMU APIdrivers/pci/intel-iommu.c include/linux/intel-iommu.h+8 -90 replies
12/12VT-d: register functions for the IOMMU APIdrivers/pci/intel-iommu.c+13 -00 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/12] Factor VT-d KVM functions into a generic API (with multiple device assignment support)

Hi,

this patch series makes the current KVM device passthrough code generic enough so that other IOMMU implementation can also plug into this code. It works by factoring the functions Vt-d code exports to KVM into a generic interface which allows different backends.

This is the second version of the patchset. The most important change to the previous version is that this patchset was rebased to the improved API from Han Weidong which supports multiple devices per IOMMU domain.

For completeness, this series also includes the patches from Han with some cleanups. So this patchset can be applied on current avi/master tree.

For testing this code can also be pulled against avi/master tree from

git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu.git iommu-api

This a basic implementation of a generic interface. It can and should be improved later to support more types of hardware IOMMUs then VT-d and AMD IOMMU.

Since I have no VT-d hardware available these patches are only compile tested for now.

Please review, comment and test these patches.

Thanks,

Joerg

diffstat:

 arch/ia64/Kconfig               |    3 +
 arch/ia64/kvm/Makefile          |    4 +-
 arch/x86/Kconfig                |    3 +
 arch/x86/include/asm/kvm_host.h |    3 +-
 arch/x86/kvm/Makefile           |    4 +-
 drivers/base/Makefile           |    1 +
 drivers/base/iommu.c            |  100 ++++++
 drivers/pci/dmar.c              |   15 +-
 drivers/pci/intel-iommu.c       |  738 +++++++++++++++++++++++++++++++++------
 include/linux/dma_remapping.h   |   21 +-
 include/linux/dmar.h            |    2 +
 include/linux/intel-iommu.h     |   13 +-
 include/linux/iommu.h           |  109 ++++++
 include/linux/kvm.h             |    5 +
 include/linux/kvm_host.h        |   23 +-
 virt/kvm/{vtd.c => iommu.c}     |  131 +++++---
 virt/kvm/kvm_main.c             |   49 +++-