Skip to content

Commit

Permalink
iommu/sunxi: define protection flag IOMMU_SUNXI_NO_ZAP_TLB
Browse files Browse the repository at this point in the history
  • Loading branch information
scpcom committed Dec 12, 2021
1 parent 4acf05d commit 8bd1945
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/iommu/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,7 @@ size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
#ifdef CONFIG_ARCH_SUNXI
struct iommu_iotlb_gather iotlb_gather;

prot |= (1 << 16);
prot |= IOMMU_SUNXI_NO_ZAP_TLB;
#endif
while (i <= nents) {
phys_addr_t s_phys = sg_phys(sg);
Expand Down
2 changes: 1 addition & 1 deletion drivers/iommu/sunxi-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ static int sunxi_iommu_map(struct iommu_domain *domain, unsigned long iova,
dma_sync_single_for_device(dma_dev, virt_to_phys(iopte_offset(dent, s_iova_start)),
flush_count << 2, DMA_TO_DEVICE);
out:
if (!(prot & (1 << 16)))
if (!(prot & IOMMU_SUNXI_NO_ZAP_TLB))
sunxi_zap_tlb(iova, size);
mutex_unlock(&sunxi_domain->dt_lock);

Expand Down
6 changes: 6 additions & 0 deletions include/linux/iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
* last level cache, aka system cache.
*/
#define IOMMU_QCOM_SYS_CACHE (1 << 6)
#ifdef CONFIG_ARCH_SUNXI
/*
* Do not call sunxi_zap_tlb on map if this flag is set.
*/
#define IOMMU_SUNXI_NO_ZAP_TLB (1 << 16)
#endif

struct iommu_ops;
struct iommu_group;
Expand Down

0 comments on commit 8bd1945

Please sign in to comment.