]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
vfio iommu: Add dma available capability
authorMatthew Rosato <mjrosato@linux.ibm.com>
Mon, 11 Jan 2021 17:31:28 +0000 (12:31 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Jan 2021 13:05:30 +0000 (14:05 +0100)
commit5597557244d44989a7310755d0a8ec40ae603acb
tree48c6b542da1d79021d6be8996846cd13f2d05caa
parent335104082c213c5657650dfe176c731a521b3cfc
vfio iommu: Add dma available capability

[ Upstream commit 7d6e1329652ed971d1b6e0e7bea66fba5044e271 ]

The following functional changes were needed for backport:
- vfio_iommu_type1_get_info doesn't exist, call
  vfio_iommu_dma_avail_build_caps from vfio_iommu_type1_ioctl.
- As further fallout from this, vfio_iommu_dma_avail_build_caps must
  acquire and release the iommu mutex lock.  To do so, the return value is
  stored in a local variable as in vfio_iommu_iova_build_caps.

Upstream commit description:
Commit 492855939bdb ("vfio/type1: Limit DMA mappings per container")
added the ability to limit the number of memory backed DMA mappings.
However on s390x, when lazy mapping is in use, we use a very large
number of concurrent mappings.  Let's provide the current allowable
number of DMA mappings to userspace via the IOMMU info chain so that
userspace can take appropriate mitigation.

Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/vfio/vfio_iommu_type1.c
include/uapi/linux/vfio.h