diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2012-03-29 13:58:43 -0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2012-05-25 12:48:24 -0400 |
commit | d5d14ed6f2db7287a5088e1350cf422bf72140b3 (patch) | |
tree | 19f0bc20bb6f1995a1e4f75dc58e388c047f7d23 /arch/tile/kernel/setup.c | |
parent | 47d632f9f8f3ed62b21f725e98b726d65769b6d7 (diff) |
arch/tile: Allow tilegx to build with either 16K or 64K page size
This change introduces new flags for the hv_install_context()
API that passes a page table pointer to the hypervisor. Clients
can explicitly request 4K, 16K, or 64K small pages when they
install a new context. In practice, the page size is fixed at
kernel compile time and the same size is always requested every
time a new page table is installed.
The <hv/hypervisor.h> header changes so that it provides more abstract
macros for managing "page" things like PFNs and page tables. For
example there is now a HV_DEFAULT_PAGE_SIZE_SMALL instead of the old
HV_PAGE_SIZE_SMALL. The various PFN routines have been eliminated and
only PA- or PTFN-based ones remain (since PTFNs are always expressed
in fixed 2KB "page" size). The page-table management macros are
renamed with a leading underscore and take page-size arguments with
the presumption that clients will use those macros in some single
place to provide the "real" macros they will use themselves.
I happened to notice the old hv_set_caching() API was totally broken
(it assumed 4KB pages) so I changed it so it would nominally work
correctly with other page sizes.
Tag modules with the page size so you can't load a module built with
a conflicting page size. (And add a test for SMP while we're at it.)
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/kernel/setup.c')
-rw-r--r-- | arch/tile/kernel/setup.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c index bff23f476110..32948e21113a 100644 --- a/arch/tile/kernel/setup.c +++ b/arch/tile/kernel/setup.c | |||
@@ -1396,13 +1396,13 @@ void __init setup_per_cpu_areas(void) | |||
1396 | for (i = 0; i < size; i += PAGE_SIZE, ++pfn, ++pg) { | 1396 | for (i = 0; i < size; i += PAGE_SIZE, ++pfn, ++pg) { |
1397 | 1397 | ||
1398 | /* Update the vmalloc mapping and page home. */ | 1398 | /* Update the vmalloc mapping and page home. */ |
1399 | pte_t *ptep = | 1399 | unsigned long addr = (unsigned long)ptr + i; |
1400 | virt_to_pte(NULL, (unsigned long)ptr + i); | 1400 | pte_t *ptep = virt_to_pte(NULL, addr); |
1401 | pte_t pte = *ptep; | 1401 | pte_t pte = *ptep; |
1402 | BUG_ON(pfn != pte_pfn(pte)); | 1402 | BUG_ON(pfn != pte_pfn(pte)); |
1403 | pte = hv_pte_set_mode(pte, HV_PTE_MODE_CACHE_TILE_L3); | 1403 | pte = hv_pte_set_mode(pte, HV_PTE_MODE_CACHE_TILE_L3); |
1404 | pte = set_remote_cache_cpu(pte, cpu); | 1404 | pte = set_remote_cache_cpu(pte, cpu); |
1405 | set_pte(ptep, pte); | 1405 | set_pte_at(&init_mm, addr, ptep, pte); |
1406 | 1406 | ||
1407 | /* Update the lowmem mapping for consistency. */ | 1407 | /* Update the lowmem mapping for consistency. */ |
1408 | lowmem_va = (unsigned long)pfn_to_kaddr(pfn); | 1408 | lowmem_va = (unsigned long)pfn_to_kaddr(pfn); |
@@ -1415,7 +1415,7 @@ void __init setup_per_cpu_areas(void) | |||
1415 | BUG_ON(pte_huge(*ptep)); | 1415 | BUG_ON(pte_huge(*ptep)); |
1416 | } | 1416 | } |
1417 | BUG_ON(pfn != pte_pfn(*ptep)); | 1417 | BUG_ON(pfn != pte_pfn(*ptep)); |
1418 | set_pte(ptep, pte); | 1418 | set_pte_at(&init_mm, lowmem_va, ptep, pte); |
1419 | } | 1419 | } |
1420 | } | 1420 | } |
1421 | 1421 | ||