[RFC v1 4/8] intel/vt-d: export intel_iommu_get_resv_regions

From: Wei Liu
Date: Fri Jul 09 2021 - 07:43:54 EST


When Microsoft Hypervisor runs on Intel platforms it needs to know the
reserved regions to program devices correctly. There is no reason to
duplicate intel_iommu_get_resv_regions. Export it.

Signed-off-by: Wei Liu <wei.liu@xxxxxxxxxx>
---
drivers/iommu/intel/iommu.c | 5 +++--
include/linux/intel-iommu.h | 4 ++++
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index a4294d310b93..01973bc20080 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -5176,8 +5176,8 @@ static void intel_iommu_probe_finalize(struct device *dev)
set_dma_ops(dev, NULL);
}

-static void intel_iommu_get_resv_regions(struct device *device,
- struct list_head *head)
+void intel_iommu_get_resv_regions(struct device *device,
+ struct list_head *head)
{
int prot = DMA_PTE_READ | DMA_PTE_WRITE;
struct iommu_resv_region *reg;
@@ -5232,6 +5232,7 @@ static void intel_iommu_get_resv_regions(struct device *device,
return;
list_add_tail(&reg->list, head);
}
+EXPORT_SYMBOL_GPL(intel_iommu_get_resv_regions);

int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct device *dev)
{
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 03faf20a6817..f91869f765bc 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -814,6 +814,8 @@ extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu);
extern int dmar_disabled;
extern int intel_iommu_enabled;
extern int intel_iommu_gfx_mapped;
+extern void intel_iommu_get_resv_regions(struct device *device,
+ struct list_head *head);
#else
static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
{
@@ -825,6 +827,8 @@ static inline int iommu_calculate_max_sagaw(struct intel_iommu *iommu)
}
#define dmar_disabled (1)
#define intel_iommu_enabled (0)
+static inline void intel_iommu_get_resv_regions(struct device *device,
+ struct list_head *head) {}
#endif

#endif
--
2.30.2