1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * Copyright (C) 2025 - Google Inc 4 * Author: Mostafa Saleh <smostafa@google.com> 5 * IOMMU API debug page alloc sanitizer 6 */ 7 8 #ifndef __LINUX_IOMMU_DEBUG_PAGEALLOC_H 9 #define __LINUX_IOMMU_DEBUG_PAGEALLOC_H 10 11 #ifdef CONFIG_IOMMU_DEBUG_PAGEALLOC 12 DECLARE_STATIC_KEY_FALSE(iommu_debug_initialized); 13 14 extern struct page_ext_operations page_iommu_debug_ops; 15 16 void __iommu_debug_check_unmapped(const struct page *page, int numpages); 17 iommu_debug_check_unmapped(const struct page * page,int numpages)18static inline void iommu_debug_check_unmapped(const struct page *page, int numpages) 19 { 20 if (static_branch_unlikely(&iommu_debug_initialized)) 21 __iommu_debug_check_unmapped(page, numpages); 22 } 23 24 #else iommu_debug_check_unmapped(const struct page * page,int numpages)25static inline void iommu_debug_check_unmapped(const struct page *page, 26 int numpages) 27 { 28 } 29 30 #endif /* CONFIG_IOMMU_DEBUG_PAGEALLOC */ 31 32 #endif /* __LINUX_IOMMU_DEBUG_PAGEALLOC_H */ 33