Skip to content

RFC IOMMU: introduce common IOMMUObject

Peter Xu qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest8 patches 21 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8memory: rename IOMMU_NOTIFIER_*hw/i386/amd_iommu.c hw/i386/intel_iommu.c hw/ppc/spapr_iommu.c +4 more+31 -311 reply
2/8memory: rename IOMMUNotifierhw/i386/intel_iommu.c hw/vfio/common.c hw/virtio/vhost.c +5 more+40 -401 reply
3/8memory: rename iommu_notifier_init()hw/vfio/common.c hw/virtio/vhost.c include/exec/memory.h+12 -112 replies
4/8memory: rename *_notify_iommu*hw/i386/intel_iommu.c hw/ppc/spapr_iommu.c hw/s390x/s390-pci-inst.c +2 more+16 -161 reply
5/8memory: rename *iommu_notifier*hw/vfio/common.c hw/virtio/vhost.c include/exec/memory.h +1 more+19 -191 reply
6/8memory: introduce AddressSpaceOpsinclude/exec/memory.h memory.c+38 -011 replies
7/8intel_iommu: provide AddressSpaceOps.iommu_get()hw/i386/intel_iommu.c+9 -00 replies
8/8iommu: introduce hw/core/iommuhw/core/Makefile.objs hw/core/iommu.c hw/i386/intel_iommu.c +3 more+138 -104 replies

Reviews trailers per patch

1 of 8 patches has a Reviewed-by or Acked-by.

PatchDavid Gibson
1/8R-b
2/8Reviwed-by
3/8
4/8
5/8
6/8
7/8
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [Qemu-devel] [RFC PATCH 0/8] IOMMU: introduce common IOMMUObject
Quoted 1 line

From time to time, I was always thinking whether we should have a

IOMMU object in common, not depending on platform (x86/ppc/...), or bus (PCI/...). Virt-svm is a case that may use it now - it needs to register some notifiers so that when some event triggered the callback can be invoked. However current MemoryRegion IOMMU notifiers do not suite well with that purpose, since the notifiers are mostly binded to memory regions and tailored to IOTLB notifications, while for virt-svm it should be listening to one IOMMU device, rather than a specific memory region.

This series tried to do several things:

- renaming old "iommu notifiers" into "iotlb notifiers", to avoid confusion of what it is used for

- introduce a way to fetch an IOMMU object from a device DMA address space (for x86, it should be a pci device)

- introduce a common IOMMU object, along with a similar notifier mechanism for it

There is a use-case example in the last patch to show how to use it, on how to modify customized IOMMU device to have such a common object, and on how to use the notifiers (merely the same as old one).

If with luck, this series can be a pre-requisite for the following patchset:

[RFC PATCH 00/20] Qemu: Extend intel_iommu emulator to support Shared Virtual Memory

But before that, looking forward to any of your comments.

Test done: compile test only.

Please kindly review. Thanks.

Peter Xu (8):
memory: rename IOMMU_NOTIFIER_*
memory: rename IOMMUNotifier
memory: rename iommu_notifier_init()
memory: rename *_notify_iommu*
memory: rename *iommu_notifier*
memory: introduce AddressSpaceOps
intel_iommu: provide AddressSpaceOps.iommu_get()
iommu: introduce hw/core/iommu

 hw/core/Makefile.objs         |  1 +
 hw/core/iommu.c               | 61 +++++++++++++++++++++++++++++
 hw/i386/amd_iommu.c           |  6 +--
 hw/i386/intel_iommu.c         | 47 +++++++++++++---------
 hw/ppc/spapr_iommu.c          | 10 ++---
 hw/s390x/s390-pci-inst.c      |  2 +-
 hw/vfio/common.c              | 16 ++++----
 hw/virtio/vhost.c             | 14 +++----
 include/exec/memory.h         | 91 +++++++++++++++++++++++++++----------------
 include/hw/core/iommu.h       | 72 ++++++++++++++++++++++++++++++++++
 include/hw/i386/intel_iommu.h | 10 +++--
 include/hw/vfio/vfio-common.h |  2 +-
 include/hw/virtio/vhost.h     |  4 +-
 memory.c                      | 54 ++++++++++++++-----------
 14 files changed, 283 insertions(+), 107 deletions(-)
 create mode 100644 hw/core/iommu.c
 create mode 100644 include/hw/core/iommu.h
Signature · 1 line
2.7.4