1016fec91SBaoquan He /* SPDX-License-Identifier: GPL-2.0 */ 2016fec91SBaoquan He #ifndef _LINUX_IOREMAP_H 3016fec91SBaoquan He #define _LINUX_IOREMAP_H 4016fec91SBaoquan He 5016fec91SBaoquan He #include <linux/kasan.h> 6016fec91SBaoquan He #include <asm/pgtable.h> 7*50c6dbdfSMax Ramanouski #include <asm/vmalloc.h> 8016fec91SBaoquan He 9016fec91SBaoquan He #if defined(CONFIG_HAS_IOMEM) || defined(CONFIG_GENERIC_IOREMAP) 10016fec91SBaoquan He /* 11016fec91SBaoquan He * Ioremap often, but not always uses the generic vmalloc area. E.g on 12016fec91SBaoquan He * Power ARCH, it could have different ioremap space. 13016fec91SBaoquan He */ 14016fec91SBaoquan He #ifndef IOREMAP_START 15016fec91SBaoquan He #define IOREMAP_START VMALLOC_START 16016fec91SBaoquan He #define IOREMAP_END VMALLOC_END 17016fec91SBaoquan He #endif is_ioremap_addr(const void * x)18016fec91SBaoquan Hestatic inline bool is_ioremap_addr(const void *x) 19016fec91SBaoquan He { 20016fec91SBaoquan He unsigned long addr = (unsigned long)kasan_reset_tag(x); 21016fec91SBaoquan He 22016fec91SBaoquan He return addr >= IOREMAP_START && addr < IOREMAP_END; 23016fec91SBaoquan He } 24016fec91SBaoquan He #else is_ioremap_addr(const void * x)25016fec91SBaoquan Hestatic inline bool is_ioremap_addr(const void *x) 26016fec91SBaoquan He { 27016fec91SBaoquan He return false; 28016fec91SBaoquan He } 29016fec91SBaoquan He #endif 30016fec91SBaoquan He 31016fec91SBaoquan He #endif /* _LINUX_IOREMAP_H */ 32