mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
drm/rockchip: drv: add support pre mapping for vop iommu
Signed-off-by: Sandy Huang <hjc@rock-chips.com> Change-Id: I24f292f58859ed89a7557322dc9cd15ea4930eee
This commit is contained in:
@@ -49,6 +49,7 @@ static bool is_support_iommu = false;
|
||||
#else
|
||||
static bool is_support_iommu = true;
|
||||
#endif
|
||||
static bool iommu_reserve_map;
|
||||
|
||||
static struct drm_driver rockchip_drm_driver;
|
||||
|
||||
@@ -984,6 +985,7 @@ static int rockchip_drm_init_iommu(struct drm_device *drm_dev)
|
||||
struct rockchip_drm_private *private = drm_dev->dev_private;
|
||||
struct iommu_domain_geometry *geometry;
|
||||
u64 start, end;
|
||||
int ret = 0;
|
||||
|
||||
if (!is_support_iommu)
|
||||
return 0;
|
||||
@@ -1004,7 +1006,14 @@ static int rockchip_drm_init_iommu(struct drm_device *drm_dev)
|
||||
iommu_set_fault_handler(private->domain, rockchip_drm_fault_handler,
|
||||
drm_dev);
|
||||
|
||||
return 0;
|
||||
if (iommu_reserve_map) {
|
||||
ret = iommu_map(private->domain, 0, 0, (size_t)SZ_4G,
|
||||
IOMMU_WRITE | IOMMU_READ | IOMMU_PRIV);
|
||||
if (ret)
|
||||
dev_err(drm_dev->dev, "failed to create pre mapping\n");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void rockchip_iommu_cleanup(struct drm_device *drm_dev)
|
||||
@@ -1014,6 +1023,8 @@ static void rockchip_iommu_cleanup(struct drm_device *drm_dev)
|
||||
if (!is_support_iommu)
|
||||
return;
|
||||
|
||||
if (iommu_reserve_map)
|
||||
iommu_unmap(private->domain, 0, (size_t)SZ_4G);
|
||||
drm_mm_takedown(&private->mm);
|
||||
iommu_domain_free(private->domain);
|
||||
}
|
||||
@@ -1802,6 +1813,7 @@ static int rockchip_drm_platform_of_probe(struct device *dev)
|
||||
|
||||
found = true;
|
||||
|
||||
iommu_reserve_map |= of_property_read_bool(iommu, "rockchip,reserve-map");
|
||||
of_node_put(iommu);
|
||||
of_node_put(port);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user