From 44e582460230a9c711396ade8de720ff1c571ded Mon Sep 17 00:00:00 2001 From: Georgi Djakov Date: Wed, 26 Jan 2022 11:06:36 -0800 Subject: [PATCH] ANDROID: iommu: Use restricted vendor hook for dma ops Use rvh instead of vh for the iommu_setup_dma_ops to prevent sleeping while atomic bugs as mutexes are used to serialize access to iova regions, as well GFP_KERNEL allocations are used. Bug: 214353193 Change-Id: I45f8f0404a247b67fd07a6831ff813bbc50fbca2 Signed-off-by: Georgi Djakov --- arch/arm64/mm/dma-mapping.c | 2 +- drivers/android/vendor_hooks.c | 2 +- include/trace/hooks/iommu.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index ba8f22dbd123..443475dc4ddc 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -52,7 +52,7 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, dev->dma_coherent = coherent; if (iommu) { iommu_setup_dma_ops(dev, dma_base, dma_base + size - 1); - trace_android_vh_iommu_setup_dma_ops(dev, dma_base, dma_base + size - 1); + trace_android_rvh_iommu_setup_dma_ops(dev, dma_base, dma_base + size - 1); } #ifdef CONFIG_XEN diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 34a9f9b3e45e..aa0582079184 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -150,7 +150,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_send_uic_command); 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_cgroup_attach); -EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_iommu_setup_dma_ops); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_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); diff --git a/include/trace/hooks/iommu.h b/include/trace/hooks/iommu.h index b5f2e47ff9dd..082d8e7df897 100644 --- a/include/trace/hooks/iommu.h +++ b/include/trace/hooks/iommu.h @@ -12,9 +12,9 @@ #include #include -DECLARE_HOOK(android_vh_iommu_setup_dma_ops, +DECLARE_RESTRICTED_HOOK(android_rvh_iommu_setup_dma_ops, 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), 1); struct iova_domain;