Skip to content

RFC iommu: Reserved regions for IOVAs beyond dma_mask and iommu aperture

Eric Auger linux-iommu lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3iommu: Fix merging in iommu_insert_resv_regiondrivers/iommu/iommu.c+1 -10 replies
2/3iommu: Account for dma_mask and iommu aperture in IOVA reserved regionsDocumentation/ABI/testing/sysfs-kernel-iommu_groups drivers/iommu/iommu.c+46 -02 replies
3/3vfio/type1: Increase the version of VFIO_IOMMU_TYPE1_INFO_CAP_IOVA_RANGEdrivers/vfio/vfio_iommu_type1.c+1 -10 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [RFC 0/3] iommu: Reserved regions for IOVAs beyond dma_mask and iommu aperture

VFIO currently exposes the usable IOVA regions through the VFIO_IOMMU_GET_INFO ioctl / VFIO_IOMMU_TYPE1_INFO_CAP_IOVA_RANGE capability. However it fails to take into account the dma_mask of the devices within the container. The top limit currently is defined by the iommu aperture.

So, for instance, if the IOMMU supports up to 48bits, it may give the impression the max IOVA is 48b while a device may have a dma_mask of 42b. So this API cannot really be used to compute the max usable IOVA.

This patch removes the IOVA region beyond the dma_mask's. As we start to expose this reserved region in the sysfs file /sys/kernel/iommu_groups/<n>/reserved_regions, we also need to handle the IOVA range beyond the IOMMU aperture to handle the case where the dma_mask would have a higher number of bits than the iommu max input address.

This is a change to the ABI as this reserved region was not yet exposed in sysfs /sys/kernel/iommu_groups/<n>/reserved_regions or through the VFIO ioctl. At VFIO level we increment the version of the VFIO_IOMMU_TYPE1_INFO_CAP_IOVA_RANGE capability to advertise that change.

Best Regards

Eric

This series can be found at:
https://github.com/eauger/qemu/tree/dma_mask_rfc

Eric Auger (3):
iommu: Fix merging in iommu_insert_resv_region
iommu: Account for dma_mask and iommu aperture in IOVA reserved
regions
vfio/type1: Increase the version of
VFIO_IOMMU_TYPE1_INFO_CAP_IOVA_RANGE

 .../ABI/testing/sysfs-kernel-iommu_groups     |  7 ++++
 drivers/iommu/iommu.c                         | 41 ++++++++++++++++++-
 drivers/vfio/vfio_iommu_type1.c               |  2 +-
 3 files changed, 48 insertions(+), 2 deletions(-)
Signature · 1 line
2.21.3