1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_IOREMAP_H
3#define _LINUX_IOREMAP_H
4
5#include <linux/kasan.h>
6#include <asm/pgtable.h>
7
8#if defined(CONFIG_HAS_IOMEM) || defined(CONFIG_GENERIC_IOREMAP)
9/*
10 * Ioremap often, but not always uses the generic vmalloc area. E.g on
11 * Power ARCH, it could have different ioremap space.
12 */
13#ifndef IOREMAP_START
14#define IOREMAP_START   VMALLOC_START
15#define IOREMAP_END     VMALLOC_END
16#endif
17static inline bool is_ioremap_addr(const void *x)
18{
19	unsigned long addr = (unsigned long)kasan_reset_tag(x);
20
21	return addr >= IOREMAP_START && addr < IOREMAP_END;
22}
23#else
24static inline bool is_ioremap_addr(const void *x)
25{
26	return false;
27}
28#endif
29
30#endif /* _LINUX_IOREMAP_H */
31