Changeset c520034 in mainline for kernel/arch/mips32/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/mips32/src/mm/frame.c

    r852052d rc520034  
    131131}
    132132
    133 static void frame_add_region(pfn_t start_frame, pfn_t end_frame)
    134 {
    135         if (end_frame > start_frame) {
    136                 /* Convert 1M frames to 16K frames */
    137                 pfn_t first = ADDR2PFN(start_frame << ZERO_PAGE_WIDTH);
    138                 pfn_t count = ADDR2PFN((end_frame - start_frame) << ZERO_PAGE_WIDTH);
    139                
     133static void frame_add_region(pfn_t start_frame, pfn_t end_frame, bool low)
     134{
     135        if (end_frame <= start_frame)
     136                return;
     137
     138        uintptr_t base = start_frame << ZERO_PAGE_WIDTH;
     139        size_t size = (end_frame - start_frame) << ZERO_PAGE_WIDTH;
     140
     141        if (!frame_adjust_zone_bounds(low, &base, &size))
     142                return;
     143
     144        pfn_t first = ADDR2PFN(base);
     145        size_t count = SIZE2FRAMES(size);
     146        pfn_t conf_frame;
     147
     148        if (low) {
    140149                /* Interrupt vector frame is blacklisted */
    141                 pfn_t conf_frame;
    142150                if (first == 0)
    143151                        conf_frame = 1;
    144152                else
    145153                        conf_frame = first;
    146                
    147                 zone_create(first, count, conf_frame, 0);
    148                
    149                 if (phys_regions_count < MAX_REGIONS) {
    150                         phys_regions[phys_regions_count].start = first;
    151                         phys_regions[phys_regions_count].count = count;
    152                         phys_regions_count++;
    153                 }
     154                zone_create(first, count, conf_frame,
     155                    ZONE_AVAILABLE | ZONE_LOWMEM);
     156        } else {
     157                conf_frame = zone_external_conf_alloc(count);
     158                zone_create(first, count, conf_frame,
     159                    ZONE_AVAILABLE | ZONE_HIGHMEM);
     160        }
     161               
     162               
     163        if (phys_regions_count < MAX_REGIONS) {
     164                phys_regions[phys_regions_count].start = first;
     165                phys_regions[phys_regions_count].count = count;
     166                phys_regions_count++;
    154167        }
    155168}
     
    165178 *
    166179 */
    167 void frame_arch_init(void)
     180void frame_low_arch_init(void)
    168181{
    169182        ipl_t ipl = interrupts_disable();
     
    224237               
    225238                if (!avail) {
    226                         frame_add_region(start_frame, frame);
     239                        frame_add_region(start_frame, frame, true);
    227240                        start_frame = frame + 1;
    228241                        avail = true;
     
    230243        }
    231244       
    232         frame_add_region(start_frame, frame);
     245        frame_add_region(start_frame, frame, true);
    233246       
    234247        /* Blacklist interrupt vector frame */
     
    246259}
    247260
     261void frame_high_arch_init(void)
     262{
     263}
    248264
    249265void physmem_print(void)
Note: See TracChangeset for help on using the changeset viewer.