summaryrefslogtreecommitdiff
path: root/include/linux/iommu-debug-pagealloc.h
blob: 46c3c1f701501448a044482a9dbda80f9836a14d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2025 - Google Inc
 * Author: Mostafa Saleh <smostafa@google.com>
 * IOMMU API debug page alloc sanitizer
 */

#ifndef __LINUX_IOMMU_DEBUG_PAGEALLOC_H
#define __LINUX_IOMMU_DEBUG_PAGEALLOC_H

#ifdef CONFIG_IOMMU_DEBUG_PAGEALLOC
DECLARE_STATIC_KEY_FALSE(iommu_debug_initialized);

extern struct page_ext_operations page_iommu_debug_ops;

void __iommu_debug_check_unmapped(const struct page *page, int numpages);

static inline void iommu_debug_check_unmapped(const struct page *page, int numpages)
{
	if (static_branch_unlikely(&iommu_debug_initialized))
		__iommu_debug_check_unmapped(page, numpages);
}

#else
static inline void iommu_debug_check_unmapped(const struct page *page,
					      int numpages)
{
}

#endif /* CONFIG_IOMMU_DEBUG_PAGEALLOC */

#endif /* __LINUX_IOMMU_DEBUG_PAGEALLOC_H */