ANDROID: iommu: Add vendor hook for iova allocation and free tracking
Add vendor hook for iommu_dma_alloc_iova and iommu_dma_free_iova
to allow vendor enhancement.
Bug: 187861158
Change-Id: I2ebe8b24318bd5292edc66a94d7109332d478212
Signed-off-by: Guangming Cao <Guangming.Cao@mediatek.com>
(cherry picked from commit 15acc8fac6)
This commit is contained in:
@@ -146,6 +146,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_send_tm_command);
|
|||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_check_int_errors);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_check_int_errors);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cgroup_attach);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cgroup_attach);
|
||||||
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_iovad_alloc_iova);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_iommu_iovad_free_iova);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ptype_head);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ptype_head);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_kfree_skb);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_kfree_skb);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_timer_calc_index);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_timer_calc_index);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include <linux/vmalloc.h>
|
#include <linux/vmalloc.h>
|
||||||
#include <linux/crash_dump.h>
|
#include <linux/crash_dump.h>
|
||||||
#include <linux/dma-direct.h>
|
#include <linux/dma-direct.h>
|
||||||
|
#include <trace/hooks/iommu.h>
|
||||||
|
|
||||||
struct iommu_dma_msi_page {
|
struct iommu_dma_msi_page {
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
@@ -467,6 +468,8 @@ static dma_addr_t iommu_dma_alloc_iova(struct iommu_domain *domain,
|
|||||||
iova = alloc_iova_fast(iovad, iova_len, dma_limit >> shift,
|
iova = alloc_iova_fast(iovad, iova_len, dma_limit >> shift,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,6 +488,8 @@ static void iommu_dma_free_iova(struct iommu_dma_cookie *cookie,
|
|||||||
else
|
else
|
||||||
free_iova_fast(iovad, iova_pfn(iovad, iova),
|
free_iova_fast(iovad, iova_pfn(iovad, iova),
|
||||||
size >> iova_shift(iovad));
|
size >> iova_shift(iovad));
|
||||||
|
|
||||||
|
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,
|
||||||
|
|||||||
@@ -12,17 +12,19 @@
|
|||||||
#include <linux/tracepoint.h>
|
#include <linux/tracepoint.h>
|
||||||
#include <trace/hooks/vendor_hooks.h>
|
#include <trace/hooks/vendor_hooks.h>
|
||||||
|
|
||||||
#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS)
|
|
||||||
|
|
||||||
DECLARE_HOOK(android_vh_iommu_setup_dma_ops,
|
DECLARE_HOOK(android_vh_iommu_setup_dma_ops,
|
||||||
TP_PROTO(struct device *dev, u64 dma_base, u64 dma_limit),
|
TP_PROTO(struct device *dev, u64 dma_base, u64 dma_limit),
|
||||||
TP_ARGS(dev, dma_base, dma_limit));
|
TP_ARGS(dev, dma_base, dma_limit));
|
||||||
|
|
||||||
#else
|
struct iova_domain;
|
||||||
|
|
||||||
#define trace_android_vh_iommu_setup_dma_ops(dev, dma_base, dma_limit)
|
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));
|
||||||
|
|
||||||
#endif
|
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 */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user