From 0cb1adebab01b426c7dc1b38334f6e61226f14bb Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 18 Dec 2020 17:30:46 +0100 Subject: [PATCH] Revert "FROMLIST: iommu/dma: Allow drivers to reserve an iova range" This reverts commit 0d5de782bbcb6056d000c24c553ba771e4a57929 as it was not accepted upstream and it causes merge issues with 5.11-rc1. If this change is still needed, please work with upstream to get it accepted and then submit the backported patch here. Bug: 149544395 Cc: Patrick Daly Cc: Isaac J. Manjarres Cc: Chris Goldsworthy Signed-off-by: Greg Kroah-Hartman Change-Id: I53fb1d0d5245de3c1afc03246f31a36333b055ff --- drivers/iommu/dma-iommu.c | 28 ---------------------------- include/linux/dma-iommu.h | 9 --------- 2 files changed, 37 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 215a3197e626..0cbcd3fc3e7e 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -370,34 +370,6 @@ static int iommu_dma_deferred_attach(struct device *dev, return 0; } -/* - * Should be called prior to using dma-apis - */ -int iommu_dma_reserve_iova(struct device *dev, dma_addr_t base, - u64 size) -{ - struct iommu_domain *domain; - struct iommu_dma_cookie *cookie; - struct iova_domain *iovad; - unsigned long pfn_lo, pfn_hi; - - domain = iommu_get_domain_for_dev(dev); - if (!domain || !domain->iova_cookie) - return -EINVAL; - - cookie = domain->iova_cookie; - iovad = &cookie->iovad; - - /* iova will be freed automatically by put_iova_domain() */ - pfn_lo = iova_pfn(iovad, base); - pfn_hi = iova_pfn(iovad, base + size - 1); - if (!reserve_iova(iovad, pfn_lo, pfn_hi)) - return -EINVAL; - - return 0; -} -EXPORT_SYMBOL(iommu_dma_reserve_iova); - /** * dma_info_to_prot - Translate DMA API directions and attributes to IOMMU API * page flags. diff --git a/include/linux/dma-iommu.h b/include/linux/dma-iommu.h index 79eef7cf9013..2112f21f73d8 100644 --- a/include/linux/dma-iommu.h +++ b/include/linux/dma-iommu.h @@ -37,9 +37,6 @@ void iommu_dma_compose_msi_msg(struct msi_desc *desc, void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list); -int iommu_dma_reserve_iova(struct device *dev, dma_addr_t base, - u64 size); - #else /* CONFIG_IOMMU_DMA */ struct iommu_domain; @@ -81,11 +78,5 @@ static inline void iommu_dma_get_resv_regions(struct device *dev, struct list_he { } -static inline int iommu_dma_reserve_iova(struct device *dev, dma_addr_t base, - u64 size) -{ - return -ENODEV; -} - #endif /* CONFIG_IOMMU_DMA */ #endif /* __DMA_IOMMU_H */