xref: /openbmc/linux/arch/arm64/mm/physaddr.c (revision 82e6fdd6)
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/bug.h>
3 #include <linux/export.h>
4 #include <linux/types.h>
5 #include <linux/mmdebug.h>
6 #include <linux/mm.h>
7 
8 #include <asm/memory.h>
9 
10 phys_addr_t __virt_to_phys(unsigned long x)
11 {
12 	WARN(!__is_lm_address(x),
13 	     "virt_to_phys used for non-linear address: %pK (%pS)\n",
14 	      (void *)x,
15 	      (void *)x);
16 
17 	return __virt_to_phys_nodebug(x);
18 }
19 EXPORT_SYMBOL(__virt_to_phys);
20 
21 phys_addr_t __phys_addr_symbol(unsigned long x)
22 {
23 	/*
24 	 * This is bounds checking against the kernel image only.
25 	 * __pa_symbol should only be used on kernel symbol addresses.
26 	 */
27 	VIRTUAL_BUG_ON(x < (unsigned long) KERNEL_START ||
28 		       x > (unsigned long) KERNEL_END);
29 	return __pa_symbol_nodebug(x);
30 }
31 EXPORT_SYMBOL(__phys_addr_symbol);
32