Changeset a9ac978 in mainline for kernel/arch/sparc64/src/mm/page.c


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.