aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/kernel/setup.c
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2013-08-12 15:08:09 -0400
committerChris Metcalf <cmetcalf@tilera.com>2013-09-03 14:52:13 -0400
commit640710a33b54de8d90ae140ef633ed0feba76a75 (patch)
treec58e0f7b36fef258674ddf9d5425608d3b5a430e /arch/tile/kernel/setup.c
parent49cf78ef7bb34833496d59b6dfe84ae51b1ab097 (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/kernel/setup.c')
-rw-r--r--arch/tile/kernel/setup.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c
index 10217844052a..b79c312ca3cb 100644
--- a/arch/tile/kernel/setup.c
+++ b/arch/tile/kernel/setup.c
@@ -1600,7 +1600,7 @@ void __init setup_per_cpu_areas(void)
1600 1600
1601 /* Update the vmalloc mapping and page home. */ 1601 /* Update the vmalloc mapping and page home. */
1602 unsigned long addr = (unsigned long)ptr + i; 1602 unsigned long addr = (unsigned long)ptr + i;
1603 pte_t *ptep = virt_to_pte(NULL, addr); 1603 pte_t *ptep = virt_to_kpte(addr);
1604 pte_t pte = *ptep; 1604 pte_t pte = *ptep;
1605 BUG_ON(pfn != pte_pfn(pte)); 1605 BUG_ON(pfn != pte_pfn(pte));
1606 pte = hv_pte_set_mode(pte, HV_PTE_MODE_CACHE_TILE_L3); 1606 pte = hv_pte_set_mode(pte, HV_PTE_MODE_CACHE_TILE_L3);
@@ -1609,12 +1609,12 @@ void __init setup_per_cpu_areas(void)
1609 1609
1610 /* Update the lowmem mapping for consistency. */ 1610 /* Update the lowmem mapping for consistency. */
1611 lowmem_va = (unsigned long)pfn_to_kaddr(pfn); 1611 lowmem_va = (unsigned long)pfn_to_kaddr(pfn);
1612 ptep = virt_to_pte(NULL, lowmem_va); 1612 ptep = virt_to_kpte(lowmem_va);
1613 if (pte_huge(*ptep)) { 1613 if (pte_huge(*ptep)) {
1614 printk(KERN_DEBUG "early shatter of huge page" 1614 printk(KERN_DEBUG "early shatter of huge page"
1615 " at %#lx\n", lowmem_va); 1615 " at %#lx\n", lowmem_va);
1616 shatter_pmd((pmd_t *)ptep); 1616 shatter_pmd((pmd_t *)ptep);
1617 ptep = virt_to_pte(NULL, lowmem_va); 1617 ptep = virt_to_kpte(lowmem_va);
1618 BUG_ON(pte_huge(*ptep)); 1618 BUG_ON(pte_huge(*ptep));
1619 } 1619 }
1620 BUG_ON(pfn != pte_pfn(*ptep)); 1620 BUG_ON(pfn != pte_pfn(*ptep));