Ignore:
Timestamp:
Dec 19, 2013, 9:36:48 AM (11 years ago)
Author:
alain
Message:

Introducing support for TSAR fixed format cluster index (cluster_xy)
We have now 4 parameters defined in map.xml:

  • X_WIDTH, Y_WIDTH define the fixed format (typically X_WIDTH = 4 / Y_WIDTH = 4)
  • X_SIZE, Y_SIZE define the actual TSAR 2D mesh variable size (from 1 to 16)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_kernel/kernel_init.c

    r258 r263  
    1111// physicals addresses can have up to 40 bits, and use the  (unsigned long long) type.
    1212// It natively supports clusterised shared mmemory multi-processors architectures,
    13 // where each processor is identified by a composite index (cluster_id, local_id),
     13// where each processor is identified by a composite index (cluster_xy, local_id),
    1414// and where there is one physical memory bank per cluster.
    1515//
     
    6161
    6262__attribute__((section (".kdata")))
    63 static_scheduler_t* _schedulers[NB_CLUSTERS * NB_PROCS_MAX];   // virtual addresses
     63static_scheduler_t* _schedulers[X_SIZE*Y_SIZE * NB_PROCS_MAX];   // virtual addresses
    6464
    6565////////////////////////////////////////////////////////////////////////////////////
     
    6868
    6969__attribute__((section (".kdata")))
    70 unsigned int _idle_stack[NB_CLUSTERS * NB_PROCS_MAX * 128];
     70unsigned int _idle_stack[X_SIZE*Y_SIZE * NB_PROCS_MAX * 128];
    7171
    7272////////////////////////////////////////////////////////////////////////////////////
     
    108108{
    109109    unsigned int global_pid = _get_procid();
     110    unsigned int cluster_xy = global_pid / NB_PROCS_MAX;
     111    unsigned int local_pid  = global_pid % NB_PROCS_MAX;
    110112
    111113#if 0
    112 // Debug feature : we can kill all processors but one
    113 if ( global_pid != 1 )
     114////////////// Debug : we can kill all processors but one
     115if ( global_pid != 0 )
    114116{
    115117    _tty_get_lock( 0 );
    116     _puts("\n[GIET] Processor ");
    117     _putd( global_pid );
    118     _puts(" suicide...\n");
     118    _puts("\n[GIET] Processor[");
     119    _putd( cluster_xy >> Y_WIDTH );
     120    _puts(",");
     121    _putd( cluster_xy & ((1<<Y_WIDTH)-1) );
     122    _puts(",");
     123    _putd( local_pid );
     124    _puts("] suicide...\n");
    119125    _tty_release_lock( 0 );
    120126    _exit();
     
    125131    //          and contribute to initialise the _schedulers[] array
    126132
    127     unsigned int        cluster_id = global_pid / NB_PROCS_MAX;
    128     unsigned int        proc_id    = global_pid % NB_PROCS_MAX;
    129133    static_scheduler_t* psched     = (static_scheduler_t*)_get_sched();
    130134    unsigned int        tasks      = psched->tasks;
     
    134138#if GIET_DEBUG_INIT
    135139_tty_get_lock( 0 );
    136 _puts("\n[GIET DEBUG] Parallel init : step 1 for processor ");
    137 _putd(global_pid);
    138 _puts("\n - scheduler vbase = ");
     140_puts("\n[GIET DEBUG] Parallel init : step 1 for processor[");
     141_putd( cluster_xy >> Y_WIDTH );
     142_puts(",");
     143_putd( cluster_xy & ((1<<Y_WIDTH)-1) );
     144_puts(",");
     145_putd( local_pid );
     146_puts("]\n - scheduler vbase = ");
    139147_putx((unsigned int) psched);
    140148_puts("\n - tasks           = ");
     
    173181#if GIET_DEBUG_INIT
    174182_tty_get_lock( 0 );
    175 _puts("\n[GIET DEBUG] Parallel init : step 2 for processor ");
    176 _putd( global_pid );
    177 _puts(" / task ");
     183_puts("\n[GIET DEBUG] Parallel init : step 2 for processor[");
     184_putd( cluster_xy >> Y_WIDTH );
     185_puts(",");
     186_putd( cluster_xy & ((1<<Y_WIDTH)-1) );
     187_puts(",");
     188_putd( local_pid );
     189_puts("] / task ");
    178190_putd( ltid );
    179191_puts("\n - ctx_vsid  = ");
     
    202214    //          there is at most 32 interrupts per processor
    203215
    204     unsigned int isr_switch_channel = 0xFFFFFFFF;
     216    unsigned int isr_switch_index = 0xFFFFFFFF;
    205217    unsigned int irq_id;            // IN_IRQ index
    206218    unsigned int hwi_mask = 0;
     
    228240            _exit();
    229241        }
    230         if (isr == ISR_SWITCH) isr_switch_channel = irq_id;
     242        if (isr == ISR_SWITCH) isr_switch_index = irq_id;
    231243    }
    232244
    233245#if GIET_DEBUG_INIT
    234246_tty_get_lock( 0 );
    235 _puts("\n[GIET DEBUG] Parallel init : step 3 for processor ");
    236 _putd(global_pid);
    237 _puts("\n - ICU HWI_MASK = ");
     247_puts("\n[GIET DEBUG] Parallel init : step 3 for processor[");
     248_putd( cluster_xy >> Y_WIDTH );
     249_puts(",");
     250_putd( cluster_xy & ((1<<Y_WIDTH)-1) );
     251_puts(",");
     252_putd( local_pid );
     253_puts("]\n - ICU HWI_MASK = ");
    238254_putx(hwi_mask);
    239255_puts("\n - ICU SWI_MASK = ");
     
    253269
    254270#if USE_XICU
    255     _xcu_set_mask(cluster_id, proc_id, hwi_mask, IRQ_TYPE_HWI); // set HWI_MASK
    256     _xcu_set_mask(cluster_id, proc_id, swi_mask, IRQ_TYPE_SWI); // set SWI_MASK
    257     _xcu_set_mask(cluster_id, proc_id, pti_mask, IRQ_TYPE_PTI); // set PTI_MASK
     271    _xcu_set_mask(cluster_xy, local_pid, hwi_mask, IRQ_TYPE_HWI); // set HWI_MASK
     272    _xcu_set_mask(cluster_xy, local_pid, swi_mask, IRQ_TYPE_SWI); // set SWI_MASK
     273    _xcu_set_mask(cluster_xy, local_pid, pti_mask, IRQ_TYPE_PTI); // set PTI_MASK
    258274#else
    259     _icu_set_mask(cluster_id, proc_id, (hwi_mask | pti_mask | swi_mask) );   
     275    _icu_set_mask(cluster_xy, local_pid, (hwi_mask | pti_mask | swi_mask) );   
    260276#endif
    261277
     
    264280    {
    265281        // one ISR_SWITCH must be defined for each proc
    266         if (isr_switch_channel == 0xFFFFFFFF)
     282        if (isr_switch_index == 0xFFFFFFFF)
    267283        {
    268284            _tty_get_lock( 0 );
    269             _puts("\n[GIET ERROR] ISR_SWITCH not found on proc ");
    270             _putd(proc_id);
     285            _puts("\n[GIET ERROR] ISR_SWITCH not found for processor ");
     286            _putx(global_pid);
    271287            _puts("\n");
    272288            _tty_release_lock( 0 );
     
    277293        unsigned int ko;
    278294#if USE_XICU
    279         ko = _xcu_timer_start( cluster_id, isr_switch_channel, GIET_TICK_VALUE );
     295        ko = _xcu_timer_start( cluster_xy, local_pid, GIET_TICK_VALUE );
    280296#else
    281         ko = _timer_start( cluster_id, isr_switch_channel, GIET_TICK_VALUE );
     297        ko = _timer_start( cluster_xy, local_pid, GIET_TICK_VALUE );
    282298#endif
    283299        if ( ko )
    284300        {
    285301            _tty_get_lock( 0 );
    286             _puts("\n[GIET ERROR] ISR_SWITCH start error for processor ");
    287             _putd(proc_id);
     302            _puts("\n[GIET ERROR] cannot start timer for processor ");
     303            _putd(local_pid);
    288304            _puts("\n");
    289305            _tty_release_lock( 0 );
     
    294310#if GIET_DEBUG_INIT
    295311_tty_get_lock( 0 );
    296 _puts("\n[GIET DEBUG] Parallel init : step 4 for processor ");
    297 _putd(global_pid);
     312_puts("\n[GIET DEBUG] Parallel init : step 4 for processor[");
     313_putd( cluster_xy >> Y_WIDTH );
     314_puts(",");
     315_putd( cluster_xy & ((1<<Y_WIDTH)-1) );
     316_puts(",");
     317_putd( local_pid );
     318_puts("]");
    298319if ( tasks > 1 ) _puts("\n  context switch activated\n");
    299320else             _puts("\n  context switch  not activated\n");
     
    315336#if GIET_DEBUG_INIT
    316337_tty_get_lock( 0 );
    317 _puts("\n[GIET DEBUG] Parallel init : step 5 for processor ");
    318 _putd(global_pid);
    319 _puts("\n  idle task context set\n");
     338_puts("\n[GIET DEBUG] Parallel init : step 5 for processor[");
     339_putd( cluster_xy >> Y_WIDTH );
     340_puts(",");
     341_putd( cluster_xy & ((1<<Y_WIDTH)-1) );
     342_puts(",");
     343_putd( local_pid );
     344_puts("] : idle task context set\n");
    320345_tty_release_lock( 0 );
    321346#endif
     
    333358        _tty_get_lock( 0 );
    334359        _puts("\n[GIET WARNING] No task allocated to processor ");
    335         _putd(global_pid);
     360        _putx(global_pid);
    336361        _puts(" => idle\n");
    337362        _tty_release_lock ( 0 );
     
    345370#if GIET_DEBUG_INIT
    346371_tty_get_lock( 0 );
    347 _puts("\n[GIET DEBUG] Parallel init : step 6 for processor ");
    348 _putd(global_pid);
    349 _puts("\n - sp   = ");
     372_puts("\n[GIET DEBUG] Parallel init : step 6 for processor[");
     373_putd( cluster_xy >> Y_WIDTH );
     374_puts(",");
     375_putd( cluster_xy & ((1<<Y_WIDTH)-1) );
     376_puts(",");
     377_putd( local_pid );
     378_puts("]\n - sp   = ");
    350379_putx(sp_value);
    351380_puts("\n - sr   = ");
     
    360389
    361390_tty_get_lock( 0 );
    362 _puts("\n[GIET] Processor ");
    363 _putd( global_pid );
    364 _puts(" completes kernel init at cycle ");
     391_puts("\n[GIET] Processor[");
     392_putd( cluster_xy >> Y_WIDTH );
     393_puts(",");
     394_putd( cluster_xy & ((1<<Y_WIDTH)-1) );
     395_puts(",");
     396_putd( local_pid );
     397_puts("] completes kernel init at cycle ");
    365398_putd( _get_proctime() );
    366399_puts(" / task_entry_point = ");
Note: See TracChangeset for help on using the changeset viewer.