diff options
author | Vineet Gupta <vgupta@synopsys.com> | 2015-12-18 13:57:41 +0530 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2016-03-12 11:59:47 +0530 |
commit | c2ff5cf2735c57542b8e630e63d6983013a2e1c3 (patch) | |
tree | fee4aa6cca0d1e6a7b62063bef6a4f875a97dc92 /arch/arc/include/asm/page.h | |
parent | 0b291635fce2bda983e1d2865a8bb5f46a8382bf (diff) | |
download | blackbird-obmc-linux-c2ff5cf2735c57542b8e630e63d6983013a2e1c3.tar.gz blackbird-obmc-linux-c2ff5cf2735c57542b8e630e63d6983013a2e1c3.zip |
ARC: mm: Use virt_to_pfn() for addr >> PAGE_SHIFT pattern
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc/include/asm/page.h')
-rw-r--r-- | arch/arc/include/asm/page.h | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/arch/arc/include/asm/page.h b/arch/arc/include/asm/page.h index 429957f1c236..9a7cf521b95c 100644 --- a/arch/arc/include/asm/page.h +++ b/arch/arc/include/asm/page.h @@ -10,7 +10,6 @@ #include <uapi/asm/page.h> - #ifndef __ASSEMBLY__ #define get_user_page(vaddr) __get_free_page(GFP_KERNEL) @@ -76,30 +75,26 @@ typedef unsigned long pgprot_t; typedef pte_t * pgtable_t; -#define ARCH_PFN_OFFSET (CONFIG_LINUX_LINK_BASE >> PAGE_SHIFT) +#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) + +#define ARCH_PFN_OFFSET virt_to_pfn(CONFIG_LINUX_LINK_BASE) -#define pfn_valid(pfn) (((pfn) - ARCH_PFN_OFFSET) < max_mapnr) +#define pfn_valid(pfn) (((pfn) - ARCH_PFN_OFFSET) < max_mapnr) /* * __pa, __va, virt_to_page (ALERT: deprecated, don't use them) * * These macros have historically been misnamed * virt here means link-address/program-address as embedded in object code. - * So if kernel img is linked at 0x8000_0000 onwards, 0x8010_0000 will be - * 128th page, and virt_to_page( ) will return the struct page corresp to it. - * mem_map[ ] is an array of struct page for each page frame in the system - * - * Independent of where linux is linked at, link-addr = physical address - * So the old macro __pa = vaddr + PAGE_OFFSET - CONFIG_LINUX_LINK_BASE - * would have been wrong in case kernel is not at 0x8zs + * And for ARC, link-addr = physical address */ #define __pa(vaddr) ((unsigned long)vaddr) #define __va(paddr) ((void *)((unsigned long)(paddr))) #define virt_to_page(kaddr) \ - (mem_map + ((__pa(kaddr) - CONFIG_LINUX_LINK_BASE) >> PAGE_SHIFT)) + (mem_map + virt_to_pfn((kaddr) - CONFIG_LINUX_LINK_BASE)) -#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) +#define virt_addr_valid(kaddr) pfn_valid(virt_to_pfn(kaddr)) /* Default Permissions for stack/heaps pages (Non Executable) */ #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE) |