iommu/rockchip: add rockchip_iommu_is_enabled api

Change-Id: I07ee2a1998322acec525868552c5626081bd8137
Signed-off-by: Simon Xue <xxm@rock-chips.com>
This commit is contained in:
Simon Xue
2022-04-21 10:22:24 +08:00
committed by Tao Huang
parent c231916b68
commit 18762023bb
2 changed files with 17 additions and 0 deletions

View File

@@ -1382,6 +1382,18 @@ int rockchip_iommu_enable(struct device *dev)
}
EXPORT_SYMBOL(rockchip_iommu_enable);
bool rockchip_iommu_is_enabled(struct device *dev)
{
struct rk_iommu *iommu;
iommu = rk_iommu_from_dev(dev);
if (!iommu)
return false;
return rk_iommu_is_paging_enabled(iommu);
}
EXPORT_SYMBOL(rockchip_iommu_is_enabled);
static void rk_iommu_detach_device(struct iommu_domain *domain,
struct device *dev)
{

View File

@@ -12,6 +12,7 @@ int rockchip_iommu_enable(struct device *dev);
int rockchip_iommu_disable(struct device *dev);
int rockchip_pagefault_done(struct device *master_dev);
void __iomem *rockchip_get_iommu_base(struct device *master_dev, int idx);
bool rockchip_iommu_is_enabled(struct device *dev);
#else
static inline int rockchip_iommu_enable(struct device *dev)
{
@@ -29,6 +30,10 @@ static inline void __iomem *rockchip_get_iommu_base(struct device *master_dev, i
{
return NULL;
}
static inline bool rockchip_iommu_is_enabled(struct device *dev)
{
return false;
}
#endif
#endif