1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 24baa9922SRussell King /* 34baa9922SRussell King * arch/arm/include/asm/memory.h 44baa9922SRussell King * 54baa9922SRussell King * Copyright (C) 2000-2002 Russell King 64baa9922SRussell King * modification for nommu, Hyok S. Choi, 2004 74baa9922SRussell King * 84baa9922SRussell King * Note: this file should not be included by non-asm/.h files 94baa9922SRussell King */ 104baa9922SRussell King #ifndef __ASM_ARM_MEMORY_H 114baa9922SRussell King #define __ASM_ARM_MEMORY_H 124baa9922SRussell King 138d5796d2SLennert Buytenhek #include <linux/compiler.h> 148d5796d2SLennert Buytenhek #include <linux/const.h> 153a6b1676SWill Deacon #include <linux/types.h> 16158e8bfeSAlessandro Rubini #include <linux/sizes.h> 178d5796d2SLennert Buytenhek 180cdc8b92SNicolas Pitre #ifdef CONFIG_NEED_MACH_MEMORY_H 191b9f95f8SNicolas Pitre #include <mach/memory.h> 201b9f95f8SNicolas Pitre #endif 21c12366baSLinus Walleij #include <asm/kasan_def.h> 221b9f95f8SNicolas Pitre 23006fa259SRussell King /* PAGE_OFFSET - the virtual address of the start of the kernel image */ 24006fa259SRussell King #define PAGE_OFFSET UL(CONFIG_PAGE_OFFSET) 25006fa259SRussell King 264baa9922SRussell King #ifdef CONFIG_MMU 274baa9922SRussell King 284baa9922SRussell King /* 294baa9922SRussell King * TASK_SIZE - the maximum size of a user space task. 304baa9922SRussell King * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area 314baa9922SRussell King */ 32c12366baSLinus Walleij #ifndef CONFIG_KASAN 335d1c20bcSWill Deacon #define TASK_SIZE (UL(CONFIG_PAGE_OFFSET) - UL(SZ_16M)) 34c12366baSLinus Walleij #else 35c12366baSLinus Walleij #define TASK_SIZE (KASAN_SHADOW_START) 36c12366baSLinus Walleij #endif 3779d1f5c9SWill Deacon #define TASK_UNMAPPED_BASE ALIGN(TASK_SIZE / 3, SZ_16M) 384baa9922SRussell King 394baa9922SRussell King /* 404baa9922SRussell King * The maximum size of a 26-bit user space task. 414baa9922SRussell King */ 425d1c20bcSWill Deacon #define TASK_SIZE_26 (UL(1) << 26) 434baa9922SRussell King 444baa9922SRussell King /* 454baa9922SRussell King * The module space lives between the addresses given by TASK_SIZE 464baa9922SRussell King * and PAGE_OFFSET - it must be within 32MB of the kernel text. 474baa9922SRussell King */ 48adca6dc2SCatalin Marinas #ifndef CONFIG_THUMB2_KERNEL 495d1c20bcSWill Deacon #define MODULES_VADDR (PAGE_OFFSET - SZ_16M) 50adca6dc2SCatalin Marinas #else 51adca6dc2SCatalin Marinas /* smaller range for Thumb-2 symbols relocation (2^24)*/ 525d1c20bcSWill Deacon #define MODULES_VADDR (PAGE_OFFSET - SZ_8M) 53adca6dc2SCatalin Marinas #endif 54adca6dc2SCatalin Marinas 55ab4f2ee1SRussell King #if TASK_SIZE > MODULES_VADDR 564baa9922SRussell King #error Top of user space clashes with start of module space 574baa9922SRussell King #endif 584baa9922SRussell King 594baa9922SRussell King /* 60d73cd428SNicolas Pitre * The highmem pkmap virtual space shares the end of the module area. 61d73cd428SNicolas Pitre */ 62d73cd428SNicolas Pitre #ifdef CONFIG_HIGHMEM 63d73cd428SNicolas Pitre #define MODULES_END (PAGE_OFFSET - PMD_SIZE) 64d73cd428SNicolas Pitre #else 65d73cd428SNicolas Pitre #define MODULES_END (PAGE_OFFSET) 66d73cd428SNicolas Pitre #endif 67d73cd428SNicolas Pitre 68d73cd428SNicolas Pitre /* 694baa9922SRussell King * The XIP kernel gets mapped at the bottom of the module vm area. 704baa9922SRussell King * Since we use sections to map it, this macro replaces the physical address 714baa9922SRussell King * with its virtual address while keeping offset from the base section. 724baa9922SRussell King */ 73ab4f2ee1SRussell King #define XIP_VIRT_ADDR(physaddr) (MODULES_VADDR + ((physaddr) & 0x000fffff)) 744baa9922SRussell King 757a1be318SArd Biesheuvel #define FDT_FIXED_BASE UL(0xff800000) 76*fc2933c1SArd Biesheuvel #define FDT_FIXED_SIZE (2 * SECTION_SIZE) 77*fc2933c1SArd Biesheuvel #define FDT_VIRT_BASE(physbase) ((void *)(FDT_FIXED_BASE | (physbase) % SECTION_SIZE)) 787a1be318SArd Biesheuvel 79803e3dbcSSergey Dyasly #if !defined(CONFIG_SMP) && !defined(CONFIG_ARM_LPAE) 804baa9922SRussell King /* 814baa9922SRussell King * Allow 16MB-aligned ioremap pages 824baa9922SRussell King */ 834baa9922SRussell King #define IOREMAP_MAX_ORDER 24 84803e3dbcSSergey Dyasly #endif 854baa9922SRussell King 8658c16709SAfzal Mohammed #define VECTORS_BASE UL(0xffff0000) 8758c16709SAfzal Mohammed 884baa9922SRussell King #else /* CONFIG_MMU */ 894baa9922SRussell King 9058c16709SAfzal Mohammed #ifndef __ASSEMBLY__ 9162d1c95dSVladimir Murzin extern unsigned long setup_vectors_base(void); 9258c16709SAfzal Mohammed extern unsigned long vectors_base; 9358c16709SAfzal Mohammed #define VECTORS_BASE vectors_base 9458c16709SAfzal Mohammed #endif 9558c16709SAfzal Mohammed 964baa9922SRussell King /* 974baa9922SRussell King * The limitation of user task size can grow up to the end of free ram region. 984baa9922SRussell King * It is difficult to define and perhaps will never meet the original meaning 994baa9922SRussell King * of this define that was meant to. 1004baa9922SRussell King * Fortunately, there is no reference for this in noMMU mode, for now. 1014baa9922SRussell King */ 10203eca200SUwe Kleine-König #define TASK_SIZE UL(0xffffffff) 1034baa9922SRussell King 1044baa9922SRussell King #ifndef TASK_UNMAPPED_BASE 1054baa9922SRussell King #define TASK_UNMAPPED_BASE UL(0x00000000) 1064baa9922SRussell King #endif 1074baa9922SRussell King 1084baa9922SRussell King #ifndef END_MEM 109c931b4f6SFenkart/Bostandzhyan #define END_MEM (UL(CONFIG_DRAM_BASE) + CONFIG_DRAM_SIZE) 1104baa9922SRussell King #endif 1114baa9922SRussell King 1124baa9922SRussell King /* 1134baa9922SRussell King * The module can be at any place in ram in nommu mode. 1144baa9922SRussell King */ 115ab4f2ee1SRussell King #define MODULES_END (END_MEM) 116b713aa0bSRussell King #define MODULES_VADDR PAGE_OFFSET 1174baa9922SRussell King 11838b4205aSUwe Kleine-König #define XIP_VIRT_ADDR(physaddr) (physaddr) 119*fc2933c1SArd Biesheuvel #define FDT_VIRT_BASE(physbase) ((void *)(physbase)) 12038b4205aSUwe Kleine-König 1214baa9922SRussell King #endif /* !CONFIG_MMU */ 1224baa9922SRussell King 123a09975bfSFlorian Fainelli #ifdef CONFIG_XIP_KERNEL 124a09975bfSFlorian Fainelli #define KERNEL_START _sdata 125a09975bfSFlorian Fainelli #else 126a09975bfSFlorian Fainelli #define KERNEL_START _stext 127a09975bfSFlorian Fainelli #endif 128a09975bfSFlorian Fainelli #define KERNEL_END _end 129a09975bfSFlorian Fainelli 1304baa9922SRussell King /* 1311dbd30e9SLinus Walleij * We fix the TCM memories max 32 KiB ITCM resp DTCM at these 1321dbd30e9SLinus Walleij * locations 1331dbd30e9SLinus Walleij */ 1341dbd30e9SLinus Walleij #ifdef CONFIG_HAVE_TCM 1351dbd30e9SLinus Walleij #define ITCM_OFFSET UL(0xfffe0000) 1361dbd30e9SLinus Walleij #define DTCM_OFFSET UL(0xfffe8000) 1371dbd30e9SLinus Walleij #endif 1381dbd30e9SLinus Walleij 1391dbd30e9SLinus Walleij /* 140719301ffSRussell King * Convert a page to/from a physical address 141719301ffSRussell King */ 142719301ffSRussell King #define page_to_phys(page) (__pfn_to_phys(page_to_pfn(page))) 143719301ffSRussell King #define phys_to_page(phys) (pfn_to_page(__phys_to_pfn(phys))) 144719301ffSRussell King 1454756dcbfSCyril Chemparathy /* 146b713aa0bSRussell King * PLAT_PHYS_OFFSET is the offset (from zero) of the start of physical 147c6f54a9bSUwe Kleine-König * memory. This is used for XIP and NoMMU kernels, and on platforms that don't 148c6f54a9bSUwe Kleine-König * have CONFIG_ARM_PATCH_PHYS_VIRT. Assembly code must always use 149b713aa0bSRussell King * PLAT_PHYS_OFFSET and not PHYS_OFFSET. 150b713aa0bSRussell King */ 151b713aa0bSRussell King #define PLAT_PHYS_OFFSET UL(CONFIG_PHYS_OFFSET) 152b713aa0bSRussell King 153d7811455SNicolas Pitre #ifdef CONFIG_XIP_KERNEL 1548ff97fa3SRussell King /* 1558ff97fa3SRussell King * When referencing data in RAM from the XIP region in a relative manner 1568ff97fa3SRussell King * with the MMU off, we need the relative offset between the two physical 1578ff97fa3SRussell King * addresses. The macro below achieves this, which is: 1588ff97fa3SRussell King * __pa(v_data) - __xip_pa(v_text) 1598ff97fa3SRussell King */ 1608ff97fa3SRussell King #define PHYS_RELATIVE(v_data, v_text) \ 1618ff97fa3SRussell King (((v_data) - PAGE_OFFSET + PLAT_PHYS_OFFSET) - \ 1628ff97fa3SRussell King ((v_text) - XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR) + \ 1638ff97fa3SRussell King CONFIG_XIP_PHYS_ADDR)) 164d7811455SNicolas Pitre #else 1658ff97fa3SRussell King #define PHYS_RELATIVE(v_data, v_text) ((v_data) - (v_text)) 166d7811455SNicolas Pitre #endif 167d7811455SNicolas Pitre 1684baa9922SRussell King #ifndef __ASSEMBLY__ 1694baa9922SRussell King 1704baa9922SRussell King /* 171dc21af99SRussell King * Physical vs virtual RAM address space conversion. These are 172dc21af99SRussell King * private definitions which should NOT be used outside memory.h 173dc21af99SRussell King * files. Use virt_to_phys/phys_to_virt/__pa/__va instead. 174e26a9e00SRussell King * 175e26a9e00SRussell King * PFNs are used to describe any physical page; this means 176e26a9e00SRussell King * PFN 0 == physical address 0. 177dc21af99SRussell King */ 178e26a9e00SRussell King 1797d281b62SNicolas Pitre #if defined(CONFIG_ARM_PATCH_PHYS_VIRT) 180dc21af99SRussell King 181cada3c08SRussell King /* 182cada3c08SRussell King * Constants used to force the right instruction encodings and shifts 183cada3c08SRussell King * so that all we need to do is modify the 8-bit constant field. 184cada3c08SRussell King */ 185cada3c08SRussell King #define __PV_BITS_31_24 0x81000000 186f52bb722SSricharan R #define __PV_BITS_7_0 0x81 187cada3c08SRussell King 188e26a9e00SRussell King extern unsigned long __pv_phys_pfn_offset; 189f52bb722SSricharan R extern u64 __pv_offset; 190f52bb722SSricharan R extern void fixup_pv_table(const void *, unsigned long); 191f52bb722SSricharan R extern const void *__pv_table_begin, *__pv_table_end; 192f52bb722SSricharan R 193e26a9e00SRussell King #define PHYS_OFFSET ((phys_addr_t)__pv_phys_pfn_offset << PAGE_SHIFT) 194e26a9e00SRussell King #define PHYS_PFN_OFFSET (__pv_phys_pfn_offset) 195e26a9e00SRussell King 196cada3c08SRussell King #define __pv_stub(from,to,instr,type) \ 197dc21af99SRussell King __asm__("@ __pv_stub\n" \ 198dc21af99SRussell King "1: " instr " %0, %1, %2\n" \ 199dc21af99SRussell King " .pushsection .pv_table,\"a\"\n" \ 200dc21af99SRussell King " .long 1b\n" \ 201dc21af99SRussell King " .popsection\n" \ 202dc21af99SRussell King : "=r" (to) \ 203cada3c08SRussell King : "r" (from), "I" (type)) 204dc21af99SRussell King 205f52bb722SSricharan R #define __pv_stub_mov_hi(t) \ 206f52bb722SSricharan R __asm__ volatile("@ __pv_stub_mov\n" \ 207f52bb722SSricharan R "1: mov %R0, %1\n" \ 208f52bb722SSricharan R " .pushsection .pv_table,\"a\"\n" \ 209f52bb722SSricharan R " .long 1b\n" \ 210f52bb722SSricharan R " .popsection\n" \ 211f52bb722SSricharan R : "=r" (t) \ 212f52bb722SSricharan R : "I" (__PV_BITS_7_0)) 213f52bb722SSricharan R 214f52bb722SSricharan R #define __pv_add_carry_stub(x, y) \ 215f52bb722SSricharan R __asm__ volatile("@ __pv_add_carry_stub\n" \ 216f52bb722SSricharan R "1: adds %Q0, %1, %2\n" \ 217f52bb722SSricharan R " adc %R0, %R0, #0\n" \ 218f52bb722SSricharan R " .pushsection .pv_table,\"a\"\n" \ 219f52bb722SSricharan R " .long 1b\n" \ 220f52bb722SSricharan R " .popsection\n" \ 221f52bb722SSricharan R : "+r" (y) \ 222f52bb722SSricharan R : "r" (x), "I" (__PV_BITS_31_24) \ 223f52bb722SSricharan R : "cc") 224f52bb722SSricharan R 225e377cd82SFlorian Fainelli static inline phys_addr_t __virt_to_phys_nodebug(unsigned long x) 226dc21af99SRussell King { 227f52bb722SSricharan R phys_addr_t t; 228f52bb722SSricharan R 229f52bb722SSricharan R if (sizeof(phys_addr_t) == 4) { 230cada3c08SRussell King __pv_stub(x, t, "add", __PV_BITS_31_24); 231f52bb722SSricharan R } else { 232f52bb722SSricharan R __pv_stub_mov_hi(t); 233f52bb722SSricharan R __pv_add_carry_stub(x, t); 234f52bb722SSricharan R } 235dc21af99SRussell King return t; 236dc21af99SRussell King } 237dc21af99SRussell King 238ca5a45c0SSantosh Shilimkar static inline unsigned long __phys_to_virt(phys_addr_t x) 239dc21af99SRussell King { 240dc21af99SRussell King unsigned long t; 241139cc2baSVictor Kamensky 242139cc2baSVictor Kamensky /* 243139cc2baSVictor Kamensky * 'unsigned long' cast discard upper word when 244139cc2baSVictor Kamensky * phys_addr_t is 64 bit, and makes sure that inline 245139cc2baSVictor Kamensky * assembler expression receives 32 bit argument 246139cc2baSVictor Kamensky * in place where 'r' 32 bit operand is expected. 247139cc2baSVictor Kamensky */ 248139cc2baSVictor Kamensky __pv_stub((unsigned long) x, t, "sub", __PV_BITS_31_24); 249dc21af99SRussell King return t; 250dc21af99SRussell King } 251ca5a45c0SSantosh Shilimkar 252dc21af99SRussell King #else 253ca5a45c0SSantosh Shilimkar 254b713aa0bSRussell King #define PHYS_OFFSET PLAT_PHYS_OFFSET 255e26a9e00SRussell King #define PHYS_PFN_OFFSET ((unsigned long)(PHYS_OFFSET >> PAGE_SHIFT)) 256b713aa0bSRussell King 257e377cd82SFlorian Fainelli static inline phys_addr_t __virt_to_phys_nodebug(unsigned long x) 258ca5a45c0SSantosh Shilimkar { 259ca5a45c0SSantosh Shilimkar return (phys_addr_t)x - PAGE_OFFSET + PHYS_OFFSET; 260ca5a45c0SSantosh Shilimkar } 261ca5a45c0SSantosh Shilimkar 262ca5a45c0SSantosh Shilimkar static inline unsigned long __phys_to_virt(phys_addr_t x) 263ca5a45c0SSantosh Shilimkar { 264ca5a45c0SSantosh Shilimkar return x - PHYS_OFFSET + PAGE_OFFSET; 265ca5a45c0SSantosh Shilimkar } 266ca5a45c0SSantosh Shilimkar 2677d281b62SNicolas Pitre #endif 2687d281b62SNicolas Pitre 269e26a9e00SRussell King #define virt_to_pfn(kaddr) \ 270e26a9e00SRussell King ((((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT) + \ 271e26a9e00SRussell King PHYS_PFN_OFFSET) 272b4ad5155SStephen Boyd 273e377cd82SFlorian Fainelli #define __pa_symbol_nodebug(x) __virt_to_phys_nodebug((x)) 274e377cd82SFlorian Fainelli 275e377cd82SFlorian Fainelli #ifdef CONFIG_DEBUG_VIRTUAL 276e377cd82SFlorian Fainelli extern phys_addr_t __virt_to_phys(unsigned long x); 277e377cd82SFlorian Fainelli extern phys_addr_t __phys_addr_symbol(unsigned long x); 278e377cd82SFlorian Fainelli #else 279e377cd82SFlorian Fainelli #define __virt_to_phys(x) __virt_to_phys_nodebug(x) 280e377cd82SFlorian Fainelli #define __phys_addr_symbol(x) __pa_symbol_nodebug(x) 281e377cd82SFlorian Fainelli #endif 282e377cd82SFlorian Fainelli 2834baa9922SRussell King /* 2844baa9922SRussell King * These are *only* valid on the kernel direct mapped RAM memory. 2854baa9922SRussell King * Note: Drivers should NOT use these. They are the wrong 2864baa9922SRussell King * translation for translating DMA addresses. Use the driver 2874baa9922SRussell King * DMA support - see dma-mapping.h. 2884baa9922SRussell King */ 28984c4d3a6SThierry Reding #define virt_to_phys virt_to_phys 2903a6b1676SWill Deacon static inline phys_addr_t virt_to_phys(const volatile void *x) 2914baa9922SRussell King { 2924baa9922SRussell King return __virt_to_phys((unsigned long)(x)); 2934baa9922SRussell King } 2944baa9922SRussell King 29584c4d3a6SThierry Reding #define phys_to_virt phys_to_virt 2963a6b1676SWill Deacon static inline void *phys_to_virt(phys_addr_t x) 2974baa9922SRussell King { 298ca5a45c0SSantosh Shilimkar return (void *)__phys_to_virt(x); 2994baa9922SRussell King } 3004baa9922SRussell King 3014baa9922SRussell King /* 3024baa9922SRussell King * Drivers should NOT use these either. 3034baa9922SRussell King */ 3044baa9922SRussell King #define __pa(x) __virt_to_phys((unsigned long)(x)) 305e377cd82SFlorian Fainelli #define __pa_symbol(x) __phys_addr_symbol(RELOC_HIDE((unsigned long)(x), 0)) 306ca5a45c0SSantosh Shilimkar #define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x))) 307e4886664SVitaly Andrianov #define pfn_to_kaddr(pfn) __va((phys_addr_t)(pfn) << PAGE_SHIFT) 3084baa9922SRussell King 309981b6714SRussell King extern long long arch_phys_to_idmap_offset; 3105e4432d3SRussell King 3114baa9922SRussell King /* 312981b6714SRussell King * These are for systems that have a hardware interconnect supported alias 313981b6714SRussell King * of physical memory for idmap purposes. Most cases should leave these 31428410293SRussell King * untouched. Note: this can only return addresses less than 4GiB. 3154dc9a817SSantosh Shilimkar */ 31607a7056cSRussell King static inline bool arm_has_idmap_alias(void) 31707a7056cSRussell King { 31807a7056cSRussell King return IS_ENABLED(CONFIG_MMU) && arch_phys_to_idmap_offset != 0; 31907a7056cSRussell King } 32007a7056cSRussell King 321981b6714SRussell King #define IDMAP_INVALID_ADDR ((u32)~0) 322981b6714SRussell King 323981b6714SRussell King static inline unsigned long phys_to_idmap(phys_addr_t addr) 324981b6714SRussell King { 325981b6714SRussell King if (IS_ENABLED(CONFIG_MMU) && arch_phys_to_idmap_offset) { 326981b6714SRussell King addr += arch_phys_to_idmap_offset; 327981b6714SRussell King if (addr > (u32)~0) 328981b6714SRussell King addr = IDMAP_INVALID_ADDR; 329981b6714SRussell King } 330981b6714SRussell King return addr; 331981b6714SRussell King } 332981b6714SRussell King 333981b6714SRussell King static inline phys_addr_t idmap_to_phys(unsigned long idmap) 334981b6714SRussell King { 335981b6714SRussell King phys_addr_t addr = idmap; 336981b6714SRussell King 337981b6714SRussell King if (IS_ENABLED(CONFIG_MMU) && arch_phys_to_idmap_offset) 338981b6714SRussell King addr -= arch_phys_to_idmap_offset; 339981b6714SRussell King 340981b6714SRussell King return addr; 341981b6714SRussell King } 342981b6714SRussell King 34328410293SRussell King static inline unsigned long __virt_to_idmap(unsigned long x) 3444dc9a817SSantosh Shilimkar { 345981b6714SRussell King return phys_to_idmap(__virt_to_phys(x)); 3464dc9a817SSantosh Shilimkar } 3474dc9a817SSantosh Shilimkar 3484dc9a817SSantosh Shilimkar #define virt_to_idmap(x) __virt_to_idmap((unsigned long)(x)) 3494dc9a817SSantosh Shilimkar 3504dc9a817SSantosh Shilimkar /* 3514baa9922SRussell King * Virtual <-> DMA view memory address translations 3524baa9922SRussell King * Again, these are *only* valid on the kernel direct mapped RAM 3534baa9922SRussell King * memory. Use of these is *deprecated* (and that doesn't mean 3544baa9922SRussell King * use the __ prefixed forms instead.) See dma-mapping.h. 3554baa9922SRussell King */ 356b5ee9002SNicolas Pitre #ifndef __virt_to_bus 357b5ee9002SNicolas Pitre #define __virt_to_bus __virt_to_phys 358b5ee9002SNicolas Pitre #define __bus_to_virt __phys_to_virt 3591c4a4f48SRussell King #define __pfn_to_bus(x) __pfn_to_phys(x) 3601c4a4f48SRussell King #define __bus_to_pfn(x) __phys_to_pfn(x) 361b5ee9002SNicolas Pitre #endif 362b5ee9002SNicolas Pitre 3634baa9922SRussell King /* 3644baa9922SRussell King * Conversion between a struct page and a physical address. 3654baa9922SRussell King * 3664baa9922SRussell King * page_to_pfn(page) convert a struct page * to a PFN number 3674baa9922SRussell King * pfn_to_page(pfn) convert a _valid_ PFN number to struct page * 3684baa9922SRussell King * 3694baa9922SRussell King * virt_to_page(k) convert a _valid_ virtual address to struct page * 3704baa9922SRussell King * virt_addr_valid(k) indicates whether a virtual address is valid 3714baa9922SRussell King */ 3724baa9922SRussell King #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET 3734baa9922SRussell King 374e26a9e00SRussell King #define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr)) 375efea3403SLaura Abbott #define virt_addr_valid(kaddr) (((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) \ 376e26a9e00SRussell King && pfn_valid(virt_to_pfn(kaddr))) 3774baa9922SRussell King 3784baa9922SRussell King #endif 3794baa9922SRussell King 3804baa9922SRussell King #include <asm-generic/memory_model.h> 3814baa9922SRussell King 3824baa9922SRussell King #endif 383