mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 07:03:09 -04:00
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 492855939b ("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>
This commit is contained in:
parent
335104082c
commit
5597557244
2 changed files with 37 additions and 0 deletions
|
|
@ -748,6 +748,21 @@ struct vfio_iommu_type1_info_cap_iova_range {
|
|||
struct vfio_iova_range iova_ranges[];
|
||||
};
|
||||
|
||||
/*
|
||||
* The DMA available capability allows to report the current number of
|
||||
* simultaneously outstanding DMA mappings that are allowed.
|
||||
*
|
||||
* The structure below defines version 1 of this capability.
|
||||
*
|
||||
* avail: specifies the current number of outstanding DMA mappings allowed.
|
||||
*/
|
||||
#define VFIO_IOMMU_TYPE1_INFO_DMA_AVAIL 3
|
||||
|
||||
struct vfio_iommu_type1_info_dma_avail {
|
||||
struct vfio_info_cap_header header;
|
||||
__u32 avail;
|
||||
};
|
||||
|
||||
#define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue