diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 0e9014adf5f6..c7b6b1553b30 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -343,3 +343,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_alloc_pages_may_oom_exit); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_vmscan_kswapd_done); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_compaction_begin); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_compaction_end); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_bus_iommu_probe); diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index fc7286d801db..eebba280512f 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "dma-iommu.h" @@ -223,7 +224,8 @@ int iommu_device_register(struct iommu_device *iommu, * already the de-facto behaviour, since any possible combination of * existing drivers would compete for at least the PCI or platform bus. */ - if (iommu_buses[0]->iommu_ops && iommu_buses[0]->iommu_ops != ops) + if (iommu_buses[0]->iommu_ops && iommu_buses[0]->iommu_ops != ops + && !trace_android_vh_bus_iommu_probe_enabled()) return -EBUSY; iommu->ops = ops; @@ -235,6 +237,11 @@ int iommu_device_register(struct iommu_device *iommu, spin_unlock(&iommu_device_lock); for (int i = 0; i < ARRAY_SIZE(iommu_buses) && !err; i++) { + bool skip = false; + + trace_android_vh_bus_iommu_probe(iommu, iommu_buses[i], &skip); + if (skip) + continue; iommu_buses[i]->iommu_ops = ops; err = bus_iommu_probe(iommu_buses[i]); } diff --git a/include/trace/hooks/iommu.h b/include/trace/hooks/iommu.h index d36446f0dd40..604dbf00cf6a 100644 --- a/include/trace/hooks/iommu.h +++ b/include/trace/hooks/iommu.h @@ -15,6 +15,7 @@ DECLARE_RESTRICTED_HOOK(android_rvh_iommu_setup_dma_ops, struct iova_domain; struct iova; +struct iommu_device; DECLARE_RESTRICTED_HOOK(android_rvh_iommu_alloc_insert_iova, TP_PROTO(struct iova_domain *iovad, unsigned long size, @@ -40,6 +41,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_iommu_limit_align_shift, unsigned long *shift), TP_ARGS(iovad, size, shift), 1); +DECLARE_HOOK(android_vh_bus_iommu_probe, + TP_PROTO(struct iommu_device *iommu, struct bus_type *bus, bool *skip), + TP_ARGS(iommu, bus, skip)); + #endif /* _TRACE_HOOK_IOMMU_H */ /* This part must be outside protection */