mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +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:
@@ -37,7 +37,7 @@ static int rockchip_gem_iommu_map(struct rockchip_gem_object *rk_obj)
|
||||
{
|
||||
struct drm_device *drm = rk_obj->base.dev;
|
||||
struct rockchip_drm_private *private = drm->dev_private;
|
||||
int prot = IOMMU_READ | IOMMU_WRITE;
|
||||
int prot = IOMMU_READ | IOMMU_WRITE | IOMMU_TLB_SHOT_ENTIRE;
|
||||
ssize_t ret;
|
||||
|
||||
mutex_lock(&private->mm_lock);
|
||||
|
||||
@@ -1717,6 +1717,9 @@ size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
|
||||
mapped += s->length;
|
||||
}
|
||||
|
||||
if (domain->ops->flush_iotlb_all && (prot & IOMMU_TLB_SHOT_ENTIRE))
|
||||
domain->ops->flush_iotlb_all(domain);
|
||||
|
||||
return mapped;
|
||||
|
||||
out_err:
|
||||
|
||||
@@ -771,7 +771,10 @@ 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.
|
||||
*/
|
||||
rk_iommu_zap_iova_first_last(rk_domain, iova, size);
|
||||
|
||||
/* 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);
|
||||
|
||||
return 0;
|
||||
unwind:
|
||||
|
||||
@@ -42,6 +42,9 @@
|
||||
*/
|
||||
#define IOMMU_PRIV (1 << 5)
|
||||
|
||||
/* For shoting entire IOMMU tlb once */
|
||||
#define IOMMU_TLB_SHOT_ENTIRE (1 << 6)
|
||||
|
||||
struct iommu_ops;
|
||||
struct iommu_group;
|
||||
struct bus_type;
|
||||
|
||||
Reference in New Issue
Block a user