Changeset 263 for soft/giet_vm/giet_kernel/kernel_init.c
- Timestamp:
- Dec 19, 2013, 9:36:48 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_kernel/kernel_init.c
r258 r263 11 11 // physicals addresses can have up to 40 bits, and use the (unsigned long long) type. 12 12 // 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), 14 14 // and where there is one physical memory bank per cluster. 15 15 // … … 61 61 62 62 __attribute__((section (".kdata"))) 63 static_scheduler_t* _schedulers[ NB_CLUSTERS* NB_PROCS_MAX]; // virtual addresses63 static_scheduler_t* _schedulers[X_SIZE*Y_SIZE * NB_PROCS_MAX]; // virtual addresses 64 64 65 65 //////////////////////////////////////////////////////////////////////////////////// … … 68 68 69 69 __attribute__((section (".kdata"))) 70 unsigned int _idle_stack[ NB_CLUSTERS* NB_PROCS_MAX * 128];70 unsigned int _idle_stack[X_SIZE*Y_SIZE * NB_PROCS_MAX * 128]; 71 71 72 72 //////////////////////////////////////////////////////////////////////////////////// … … 108 108 { 109 109 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; 110 112 111 113 #if 0 112 // Debug feature: we can kill all processors but one113 if ( global_pid != 1)114 ////////////// Debug : we can kill all processors but one 115 if ( global_pid != 0 ) 114 116 { 115 117 _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"); 119 125 _tty_release_lock( 0 ); 120 126 _exit(); … … 125 131 // and contribute to initialise the _schedulers[] array 126 132 127 unsigned int cluster_id = global_pid / NB_PROCS_MAX;128 unsigned int proc_id = global_pid % NB_PROCS_MAX;129 133 static_scheduler_t* psched = (static_scheduler_t*)_get_sched(); 130 134 unsigned int tasks = psched->tasks; … … 134 138 #if GIET_DEBUG_INIT 135 139 _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 = "); 139 147 _putx((unsigned int) psched); 140 148 _puts("\n - tasks = "); … … 173 181 #if GIET_DEBUG_INIT 174 182 _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 "); 178 190 _putd( ltid ); 179 191 _puts("\n - ctx_vsid = "); … … 202 214 // there is at most 32 interrupts per processor 203 215 204 unsigned int isr_switch_ channel= 0xFFFFFFFF;216 unsigned int isr_switch_index = 0xFFFFFFFF; 205 217 unsigned int irq_id; // IN_IRQ index 206 218 unsigned int hwi_mask = 0; … … 228 240 _exit(); 229 241 } 230 if (isr == ISR_SWITCH) isr_switch_ channel= irq_id;242 if (isr == ISR_SWITCH) isr_switch_index = irq_id; 231 243 } 232 244 233 245 #if GIET_DEBUG_INIT 234 246 _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 = "); 238 254 _putx(hwi_mask); 239 255 _puts("\n - ICU SWI_MASK = "); … … 253 269 254 270 #if USE_XICU 255 _xcu_set_mask(cluster_ id, proc_id, hwi_mask, IRQ_TYPE_HWI); // set HWI_MASK256 _xcu_set_mask(cluster_ id, proc_id, swi_mask, IRQ_TYPE_SWI); // set SWI_MASK257 _xcu_set_mask(cluster_ id, proc_id, pti_mask, IRQ_TYPE_PTI); // set PTI_MASK271 _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 258 274 #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) ); 260 276 #endif 261 277 … … 264 280 { 265 281 // one ISR_SWITCH must be defined for each proc 266 if (isr_switch_ channel== 0xFFFFFFFF)282 if (isr_switch_index == 0xFFFFFFFF) 267 283 { 268 284 _tty_get_lock( 0 ); 269 _puts("\n[GIET ERROR] ISR_SWITCH not found on proc");270 _put d(proc_id);285 _puts("\n[GIET ERROR] ISR_SWITCH not found for processor "); 286 _putx(global_pid); 271 287 _puts("\n"); 272 288 _tty_release_lock( 0 ); … … 277 293 unsigned int ko; 278 294 #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 ); 280 296 #else 281 ko = _timer_start( cluster_ id, isr_switch_channel, GIET_TICK_VALUE );297 ko = _timer_start( cluster_xy, local_pid, GIET_TICK_VALUE ); 282 298 #endif 283 299 if ( ko ) 284 300 { 285 301 _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); 288 304 _puts("\n"); 289 305 _tty_release_lock( 0 ); … … 294 310 #if GIET_DEBUG_INIT 295 311 _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("]"); 298 319 if ( tasks > 1 ) _puts("\n context switch activated\n"); 299 320 else _puts("\n context switch not activated\n"); … … 315 336 #if GIET_DEBUG_INIT 316 337 _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"); 320 345 _tty_release_lock( 0 ); 321 346 #endif … … 333 358 _tty_get_lock( 0 ); 334 359 _puts("\n[GIET WARNING] No task allocated to processor "); 335 _put d(global_pid);360 _putx(global_pid); 336 361 _puts(" => idle\n"); 337 362 _tty_release_lock ( 0 ); … … 345 370 #if GIET_DEBUG_INIT 346 371 _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 = "); 350 379 _putx(sp_value); 351 380 _puts("\n - sr = "); … … 360 389 361 390 _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 "); 365 398 _putd( _get_proctime() ); 366 399 _puts(" / task_entry_point = ");
Note: See TracChangeset
for help on using the changeset viewer.