mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
drm/rockchip: gem: add IOMMU_TLB_SHOT_ENTIRE when call iommu_map_sg
Add IOMMU_TLB_SHOT_ENTIRE prot for iommu_map_sg, this shoot down entire iommu tlb one time after iommu_map_sg.This may save about 5ms when DRM mapping 12MB buffer. Change-Id: I618aff1b3928bd1ec1dd3d896db746e09e96acdc Signed-off-by: Simon Xue <xxm@rock-chips.com>
This commit is contained in:
@@ -30,6 +30,10 @@ static int rockchip_gem_iommu_map(struct rockchip_gem_object *rk_obj)
|
||||
int prot = IOMMU_READ | IOMMU_WRITE;
|
||||
ssize_t ret;
|
||||
|
||||
#ifdef IOMMU_TLB_SHOT_ENTIRE
|
||||
prot |= IOMMU_TLB_SHOT_ENTIRE;
|
||||
#endif
|
||||
|
||||
mutex_lock(&private->mm_lock);
|
||||
ret = drm_mm_insert_node_generic(&private->mm, &rk_obj->mm,
|
||||
rk_obj->base.size, PAGE_SIZE,
|
||||
|
||||
@@ -2636,6 +2636,12 @@ static size_t __iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
|
||||
|
||||
if (ops->iotlb_sync_map)
|
||||
ops->iotlb_sync_map(domain, iova, mapped);
|
||||
|
||||
#ifdef IOMMU_TLB_SHOT_ENTIRE
|
||||
if (domain->ops->flush_iotlb_all && (prot & IOMMU_TLB_SHOT_ENTIRE))
|
||||
domain->ops->flush_iotlb_all(domain);
|
||||
#endif
|
||||
|
||||
return mapped;
|
||||
|
||||
out_err:
|
||||
|
||||
@@ -993,7 +993,13 @@ static int rk_iommu_map_iova(struct rk_iommu_domain *rk_domain, u32 *pte_addr,
|
||||
* We only zap the first and last iova, since only they could have
|
||||
* dte or pte shared with an existing mapping.
|
||||
*/
|
||||
#ifdef IOMMU_TLB_SHOT_ENTIRE
|
||||
/* Do not zap tlb cache line if IOMMU_TLB_SHOT_ENTIRE set */
|
||||
if (!(prot & IOMMU_TLB_SHOT_ENTIRE))
|
||||
rk_iommu_zap_iova_first_last(rk_domain, iova, size);
|
||||
#else
|
||||
rk_iommu_zap_iova_first_last(rk_domain, iova, size);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
unwind:
|
||||
@@ -1038,7 +1044,13 @@ static int rk_iommu_map_iova_v2(struct rk_iommu_domain *rk_domain, u32 *pte_addr
|
||||
* We only zap the first and last iova, since only they could have
|
||||
* dte or pte shared with an existing mapping.
|
||||
*/
|
||||
#ifdef IOMMU_TLB_SHOT_ENTIRE
|
||||
/* Do not zap tlb cache line if IOMMU_TLB_SHOT_ENTIRE set */
|
||||
if (!(prot & IOMMU_TLB_SHOT_ENTIRE))
|
||||
rk_iommu_zap_iova_first_last(rk_domain, iova, size);
|
||||
#else
|
||||
rk_iommu_zap_iova_first_last(rk_domain, iova, size);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
unwind:
|
||||
|
||||
@@ -45,6 +45,13 @@
|
||||
*/
|
||||
#define IOMMU_SYS_CACHE_ONLY_NWA (1 << 7)
|
||||
|
||||
#ifdef CONFIG_NO_GKI
|
||||
|
||||
/* For shoting entire IOMMU tlb once */
|
||||
#define IOMMU_TLB_SHOT_ENTIRE (1 << 8)
|
||||
|
||||
#endif
|
||||
|
||||
struct iommu_ops;
|
||||
struct iommu_group;
|
||||
struct bus_type;
|
||||
|
||||
Reference in New Issue
Block a user