diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2013-08-12 15:08:09 -0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2013-09-03 14:52:13 -0400 |
commit | 640710a33b54de8d90ae140ef633ed0feba76a75 (patch) | |
tree | c58e0f7b36fef258674ddf9d5425608d3b5a430e /arch/tile/mm/init.c | |
parent | 49cf78ef7bb34833496d59b6dfe84ae51b1ab097 (diff) |
tile: add virt_to_kpte() API and clean up and document behavior
We use virt_to_pte(NULL, va) a lot, which isn't very obvious.
I added virt_to_kpte(va) as a more obvious wrapper function,
that also validates the va as being a kernel adddress.
And, I fixed the semantics of virt_to_pte() so that we handle
the pud and pmd the same way, and we now document the fact that
we handle the final pte level differently.
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/mm/init.c')
-rw-r--r-- | arch/tile/mm/init.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/tile/mm/init.c b/arch/tile/mm/init.c index c6d21601ec4d..c8f58c12866d 100644 --- a/arch/tile/mm/init.c +++ b/arch/tile/mm/init.c | |||
@@ -951,7 +951,7 @@ static void mark_w1data_ro(void) | |||
951 | BUG_ON((addr & (PAGE_SIZE-1)) != 0); | 951 | BUG_ON((addr & (PAGE_SIZE-1)) != 0); |
952 | for (; addr <= (unsigned long)__w1data_end - 1; addr += PAGE_SIZE) { | 952 | for (; addr <= (unsigned long)__w1data_end - 1; addr += PAGE_SIZE) { |
953 | unsigned long pfn = kaddr_to_pfn((void *)addr); | 953 | unsigned long pfn = kaddr_to_pfn((void *)addr); |
954 | pte_t *ptep = virt_to_pte(NULL, addr); | 954 | pte_t *ptep = virt_to_kpte(addr); |
955 | BUG_ON(pte_huge(*ptep)); /* not relevant for kdata_huge */ | 955 | BUG_ON(pte_huge(*ptep)); /* not relevant for kdata_huge */ |
956 | set_pte_at(&init_mm, addr, ptep, pfn_pte(pfn, PAGE_KERNEL_RO)); | 956 | set_pte_at(&init_mm, addr, ptep, pfn_pte(pfn, PAGE_KERNEL_RO)); |
957 | } | 957 | } |
@@ -997,7 +997,7 @@ static void free_init_pages(char *what, unsigned long begin, unsigned long end) | |||
997 | */ | 997 | */ |
998 | int pfn = kaddr_to_pfn((void *)addr); | 998 | int pfn = kaddr_to_pfn((void *)addr); |
999 | struct page *page = pfn_to_page(pfn); | 999 | struct page *page = pfn_to_page(pfn); |
1000 | pte_t *ptep = virt_to_pte(NULL, addr); | 1000 | pte_t *ptep = virt_to_kpte(addr); |
1001 | if (!initfree) { | 1001 | if (!initfree) { |
1002 | /* | 1002 | /* |
1003 | * If debugging page accesses then do not free | 1003 | * If debugging page accesses then do not free |