ANDROID: iommu: Add vendor hook to tracing iova alloc & free in iova_domain

Add struct (iova_domain *) in iova alloc & free vendor hook by create a new vendor hook.
Thus we can know the iova we are operating belongs to which iova domain.

Bug: 201255968

Change-Id: I7df419650af2e85a3b2b8c3d6995247694bdc953
Signed-off-by: Chao Hao <chao.hao@mediatek.com>
Signed-off-by: Guangming Cao <Guangming.Cao@mediatek.com>
This commit is contained in:
Guangming Cao
2021-09-29 15:10:09 +08:00
parent befb2a75ab
commit dccb021dc4
3 changed files with 14 additions and 0 deletions

View File

@@ -202,7 +202,9 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_mem_abort);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_sp_pc_abort); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_sp_pc_abort);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_iommu_setup_dma_ops); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_iommu_setup_dma_ops);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_iommu_alloc_iova); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_iommu_alloc_iova);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_iommu_iovad_alloc_iova);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_iommu_free_iova); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_iommu_free_iova);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_iommu_iovad_free_iova);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_pick_next_entity); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_pick_next_entity);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_check_preempt_wakeup); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_check_preempt_wakeup);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_start); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_start);

View File

@@ -488,6 +488,7 @@ static dma_addr_t iommu_dma_alloc_iova(struct iommu_domain *domain,
true); true);
trace_android_vh_iommu_alloc_iova(dev, (dma_addr_t)iova << shift, size); trace_android_vh_iommu_alloc_iova(dev, (dma_addr_t)iova << shift, size);
trace_android_vh_iommu_iovad_alloc_iova(dev, iovad, (dma_addr_t)iova << shift, size);
return (dma_addr_t)iova << shift; return (dma_addr_t)iova << shift;
} }
@@ -508,6 +509,7 @@ static void iommu_dma_free_iova(struct iommu_dma_cookie *cookie,
size >> iova_shift(iovad)); size >> iova_shift(iovad));
trace_android_vh_iommu_free_iova(iova, size); trace_android_vh_iommu_free_iova(iova, size);
trace_android_vh_iommu_iovad_free_iova(iovad, iova, size);
} }
static void __iommu_dma_unmap(struct device *dev, dma_addr_t dma_addr, static void __iommu_dma_unmap(struct device *dev, dma_addr_t dma_addr,

View File

@@ -20,10 +20,20 @@ DECLARE_HOOK(android_vh_iommu_alloc_iova,
TP_PROTO(struct device *dev, dma_addr_t iova, size_t size), TP_PROTO(struct device *dev, dma_addr_t iova, size_t size),
TP_ARGS(dev, iova, size)); TP_ARGS(dev, iova, size));
struct iova_domain;
DECLARE_HOOK(android_vh_iommu_iovad_alloc_iova,
TP_PROTO(struct device *dev, struct iova_domain *iovad, dma_addr_t iova, size_t size),
TP_ARGS(dev, iovad, iova, size));
DECLARE_HOOK(android_vh_iommu_free_iova, DECLARE_HOOK(android_vh_iommu_free_iova,
TP_PROTO(dma_addr_t iova, size_t size), TP_PROTO(dma_addr_t iova, size_t size),
TP_ARGS(iova, size)); TP_ARGS(iova, size));
DECLARE_HOOK(android_vh_iommu_iovad_free_iova,
TP_PROTO(struct iova_domain *iovad, dma_addr_t iova, size_t size),
TP_ARGS(iovad, iova, size));
#endif /* _TRACE_HOOK_IOMMU_H */ #endif /* _TRACE_HOOK_IOMMU_H */