Changeset c520034 in mainline for kernel/generic/src/mm/page.c


Ignore:
Timestamp:
2011-12-31T18:19:35Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
295f658, 77c2b02, 96cd5b4
Parents:
852052d (diff), 22f0561 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Support for kernel non-identity mappings, phase I.

  • identity/non-identity kernel memory split on all architectures
  • low/high physical memory split on all architectures
  • frame allocator understands low/high memory
  • high physical memory currently unused (Phase II)
  • more compact frame_t
  • zone conf frames, pte_t, kernel stacks allocated from low memory
  • lockless TLB-miss handlers everywhere (newly sparc64, ia64)
  • preallocate PTL1 page tables for non-identity and prevent their deallocation
  • hw_map() unification
  • new resource allocator used for allocating kernel virtual addresses

Breakage:

  • sparc64/sun4v creates too large kernel identity; not fixed because of lack of testing hw
  • ppc32's tlb_refill() seems wrong as it creates too large kernel identity, but appears unused and the architecture works normally

Not implemented yet (phase II):

  • allow high memory to be used for common kernel allocations
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/page.c

    r852052d rc520034  
    6565#include <arch/mm/asid.h>
    6666#include <mm/as.h>
     67#include <mm/km.h>
    6768#include <mm/frame.h>
    6869#include <arch/barrier.h>
     
    7576#include <errno.h>
    7677#include <align.h>
     78#include <macros.h>
     79#include <bitops.h>
    7780
    7881/** Virtual operations for page subsystem. */
     
    177180}
    178181
     182/** Make the mapping shared by all page tables (not address spaces).
     183 *
     184 * @param base Starting virtual address of the range that is made global.
     185 * @param size Size of the address range that is made global.
     186 */
     187void page_mapping_make_global(uintptr_t base, size_t size)
     188{
     189        ASSERT(page_mapping_operations);
     190        ASSERT(page_mapping_operations->mapping_make_global);
     191       
     192        return page_mapping_operations->mapping_make_global(base, size);
     193}
     194
     195uintptr_t hw_map(uintptr_t physaddr, size_t size)
     196{
     197        uintptr_t virtaddr;
     198        size_t asize;
     199        size_t align;
     200        pfn_t i;
     201
     202        asize = ALIGN_UP(size, PAGE_SIZE);
     203        align = ispwr2(size) ? size : (1U << (fnzb(size) + 1));
     204        virtaddr = km_page_alloc(asize, align);
     205
     206        page_table_lock(AS_KERNEL, true);
     207        for (i = 0; i < ADDR2PFN(asize); i++) {
     208                uintptr_t addr = PFN2ADDR(i);
     209                page_mapping_insert(AS_KERNEL, virtaddr + addr, physaddr + addr,
     210                    PAGE_NOT_CACHEABLE | PAGE_WRITE);
     211        }
     212        page_table_unlock(AS_KERNEL, true);
     213       
     214        return virtaddr;
     215}
     216
    179217int page_find_mapping(uintptr_t virt, void **phys)
    180218{
Note: See TracChangeset for help on using the changeset viewer.