vfio/type1: account iommu allocations
iommu allocations should be accounted in order to allow admins to monitor and limit the amount of iommu memory. Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20231130200900.2320829-1-pasha.tatashin@soleen.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
parent
33cc938e65
commit
160912fc3d
@ -1436,7 +1436,7 @@ static int vfio_iommu_map(struct vfio_iommu *iommu, dma_addr_t iova,
|
|||||||
list_for_each_entry(d, &iommu->domain_list, next) {
|
list_for_each_entry(d, &iommu->domain_list, next) {
|
||||||
ret = iommu_map(d->domain, iova, (phys_addr_t)pfn << PAGE_SHIFT,
|
ret = iommu_map(d->domain, iova, (phys_addr_t)pfn << PAGE_SHIFT,
|
||||||
npage << PAGE_SHIFT, prot | IOMMU_CACHE,
|
npage << PAGE_SHIFT, prot | IOMMU_CACHE,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL_ACCOUNT);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
||||||
@ -1750,7 +1750,8 @@ static int vfio_iommu_replay(struct vfio_iommu *iommu,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = iommu_map(domain->domain, iova, phys, size,
|
ret = iommu_map(domain->domain, iova, phys, size,
|
||||||
dma->prot | IOMMU_CACHE, GFP_KERNEL);
|
dma->prot | IOMMU_CACHE,
|
||||||
|
GFP_KERNEL_ACCOUNT);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (!dma->iommu_mapped) {
|
if (!dma->iommu_mapped) {
|
||||||
vfio_unpin_pages_remote(dma, iova,
|
vfio_unpin_pages_remote(dma, iova,
|
||||||
@ -1845,7 +1846,8 @@ static void vfio_test_domain_fgsp(struct vfio_domain *domain, struct list_head *
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
ret = iommu_map(domain->domain, start, page_to_phys(pages), PAGE_SIZE * 2,
|
ret = iommu_map(domain->domain, start, page_to_phys(pages), PAGE_SIZE * 2,
|
||||||
IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE, GFP_KERNEL);
|
IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE,
|
||||||
|
GFP_KERNEL_ACCOUNT);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
size_t unmapped = iommu_unmap(domain->domain, start, PAGE_SIZE);
|
size_t unmapped = iommu_unmap(domain->domain, start, PAGE_SIZE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user