Changeset c520034 in mainline for kernel/arch/ppc32/src/mm/frame.c


Ignore:
Timestamp:
2011-12-31T18:19:35Z (13 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/arch/ppc32/src/mm/frame.c

    r852052d rc520034  
    4040#include <print.h>
    4141
    42 uintptr_t last_frame = 0;
    4342memmap_t memmap;
    4443
     
    5453}
    5554
    56 void frame_arch_init(void)
     55static void frame_common_arch_init(bool low)
    5756{
    5857        pfn_t minconf = 2;
     
    6160        for (i = 0; i < memmap.cnt; i++) {
    6261                /* To be safe, make the available zone possibly smaller */
    63                 uintptr_t new_start = ALIGN_UP((uintptr_t) memmap.zones[i].start,
     62                uintptr_t base = ALIGN_UP((uintptr_t) memmap.zones[i].start,
    6463                    FRAME_SIZE);
    65                 size_t new_size = ALIGN_DOWN(memmap.zones[i].size -
    66                     (new_start - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE);
     64                size_t size = ALIGN_DOWN(memmap.zones[i].size -
     65                    (base - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE);
    6766               
    68                 pfn_t pfn = ADDR2PFN(new_start);
    69                 size_t count = SIZE2FRAMES(new_size);
    70                
     67                if (!frame_adjust_zone_bounds(low, &base, &size))
     68                        return;
     69
     70                pfn_t pfn = ADDR2PFN(base);
     71                size_t count = SIZE2FRAMES(size);
    7172                pfn_t conf;
    72                 if ((minconf < pfn) || (minconf >= pfn + count))
    73                         conf = pfn;
    74                 else
    75                         conf = minconf;
    76                
    77                 zone_create(pfn, count, conf, 0);
    78                
    79                 if (last_frame < ALIGN_UP(new_start + new_size, FRAME_SIZE))
    80                         last_frame = ALIGN_UP(new_start + new_size, FRAME_SIZE);
     73
     74                if (low) {
     75                        if ((minconf < pfn) || (minconf >= pfn + count))
     76                                conf = pfn;
     77                        else
     78                                conf = minconf;
     79                        zone_create(pfn, count, conf,
     80                            ZONE_AVAILABLE | ZONE_LOWMEM);
     81                } else {
     82                        conf = zone_external_conf_alloc(count);
     83                        zone_create(pfn, count, conf,
     84                            ZONE_AVAILABLE | ZONE_HIGHMEM);
     85                }
    8186        }
     87       
     88}
     89
     90void frame_low_arch_init(void)
     91{
     92        frame_common_arch_init(true);
    8293       
    8394        /* First is exception vector, second is 'implementation specific',
     
    92103}
    93104
     105void frame_high_arch_init(void)
     106{
     107        frame_common_arch_init(false);
     108}
     109
    94110/** @}
    95111 */
Note: See TracChangeset for help on using the changeset viewer.