Changeset a9ac978 in mainline for kernel/arch/sparc64/src/mm


Ignore:
Timestamp:
2006-09-27T20:11:34Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
00b38a3
Parents:
86b31ba9
Message:

SMP stuff for sparc64.
Almost complete except for IPIs.
The absence of IPI support deadlocks
the kernel when more CPUs are configured.

Location:
kernel/arch/sparc64/src/mm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/mm/as.c

    r86b31ba9 ra9ac978  
    3838#include <genarch/mm/asid_fifo.h>
    3939#include <debug.h>
     40#include <config.h>
    4041
    4142#ifdef CONFIG_TSB
     
    5253void as_arch_init(void)
    5354{
    54         as_operations = &as_ht_operations;
    55         asid_fifo_init();
     55        if (config.cpu_active == 1) {
     56                as_operations = &as_ht_operations;
     57                asid_fifo_init();
     58        }
    5659}
    5760
  • kernel/arch/sparc64/src/mm/frame.c

    r86b31ba9 ra9ac978  
    5454        pfn_t confdata;
    5555
    56         for (i = 0; i < bootinfo.memmap.count; i++) {
    57                 uintptr_t start = bootinfo.memmap.zones[i].start;
    58                 size_t size = bootinfo.memmap.zones[i].size;
     56        if (config.cpu_active == 1) {
     57                for (i = 0; i < bootinfo.memmap.count; i++) {
     58                        uintptr_t start = bootinfo.memmap.zones[i].start;
     59                        size_t size = bootinfo.memmap.zones[i].size;
    5960
    60                 /*
    61                 * The memmap is created by HelenOS boot loader.
    62                 * It already contains no holes.
    63                 */
     61                        /*
     62                        * The memmap is created by HelenOS boot loader.
     63                        * It already contains no holes.
     64                        */
    6465       
    65                 confdata = ADDR2PFN(start);
    66                 if (confdata == 0)
    67                         confdata = 2;
    68                 zone_create(ADDR2PFN(start), SIZE2FRAMES(ALIGN_DOWN(size, FRAME_SIZE)), confdata, 0);
     66                        confdata = ADDR2PFN(start);
     67                        if (confdata == 0)
     68                                confdata = 2;
     69                        zone_create(ADDR2PFN(start), SIZE2FRAMES(ALIGN_DOWN(size, FRAME_SIZE)), confdata, 0);
    6970               
    70                 last_frame = max(last_frame, start + ALIGN_UP(size, FRAME_SIZE));
     71                        last_frame = max(last_frame, start + ALIGN_UP(size, FRAME_SIZE));
     72                }
    7173        }
    7274
  • kernel/arch/sparc64/src/mm/page.c

    r86b31ba9 ra9ac978  
    4141#include <debug.h>
    4242#include <align.h>
     43#include <config.h>
    4344
     45#ifdef CONFIG_SMP
     46/** Entries locked in DTLB of BSP.
     47 *
     48 * Application processors need to have the same locked entries
     49 * in their DTLBs as the bootstrap processor.
     50 */
     51static struct {
     52        uintptr_t virt_page;
     53        uintptr_t phys_page;
     54        int pagesize_code;
     55} bsp_locked_dtlb_entry[DTLB_ENTRY_COUNT];
     56
     57/** Number of entries in bsp_locked_dtlb_entry array. */
     58static count_t bsp_locked_dtlb_entries = 0;
     59#endif /* CONFIG_SMP */
     60
     61/** Perform sparc64 specific initialization of paging. */
    4462void page_arch_init(void)
    4563{
    46         page_mapping_operations = &ht_mapping_operations;
     64        if (config.cpu_active == 1) {
     65                page_mapping_operations = &ht_mapping_operations;
     66        } else {
     67
     68#ifdef CONFIG_SMP
     69                int i;
     70
     71                /*
     72                 * Copy locked DTLB entries from the BSP.
     73                 */             
     74                for (i = 0; i < bsp_locked_dtlb_entries; i++) {
     75                        dtlb_insert_mapping(bsp_locked_dtlb_entry[i].virt_page,
     76                                bsp_locked_dtlb_entry[i].phys_page, bsp_locked_dtlb_entry[i].pagesize_code,
     77                                true, false);
     78                }
     79#endif 
     80
     81        }
    4782}
    4883
     
    68103        int i;
    69104
     105        ASSERT(config.cpu_active == 1);
     106
    70107        struct {
    71                 int pagesize;
     108                int pagesize_code;
    72109                size_t increment;
    73110                count_t count;
     
    102139        last_frame = ALIGN_UP(virtaddr + size, 1<<(order + FRAME_WIDTH));
    103140       
    104         for (i = 0; i < sizemap[order].count; i++)
     141        for (i = 0; i < sizemap[order].count; i++) {
     142                /*
     143                 * First, insert the mapping into DTLB.
     144                 */
    105145                dtlb_insert_mapping(virtaddr + i*sizemap[order].increment,
    106146                                    physaddr + i*sizemap[order].increment,
    107                                     sizemap[order].pagesize, true, false);
     147                                    sizemap[order].pagesize_code, true, false);
     148       
     149#ifdef CONFIG_SMP       
     150                /*
     151                 * Second, save the information about the mapping for APs.
     152                 */
     153                bsp_locked_dtlb_entry[bsp_locked_dtlb_entries].virt_page = virtaddr + i*sizemap[order].increment;
     154                bsp_locked_dtlb_entry[bsp_locked_dtlb_entries].phys_page = physaddr + i*sizemap[order].increment;
     155                bsp_locked_dtlb_entry[bsp_locked_dtlb_entries].pagesize_code = sizemap[order].pagesize_code;
     156                bsp_locked_dtlb_entries++;
     157#endif
     158        }
    108159       
    109160        return virtaddr;
Note: See TracChangeset for help on using the changeset viewer.