Changeset 428
- Timestamp:
- Oct 4, 2014, 3:19:32 PM (10 years ago)
- Location:
- soft/giet_vm/giet_kernel
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_kernel/ctx_handler.c
r391 r428 33 33 { 34 34 unsigned int gpid = _get_procid(); 35 unsigned int cluster_xy = gpid / NB_PROCS_MAX;36 unsigned int lpid = gpid % NB_PROCS_MAX;35 unsigned int cluster_xy = gpid >> P_WIDTH; 36 unsigned int lpid = gpid & ((1<<P_WIDTH)-1); 37 37 38 38 // get scheduler address … … 104 104 { 105 105 unsigned int gpid = _get_procid(); 106 unsigned int cluster_xy = gpid / NB_PROCS_MAX; 107 unsigned int lpid = gpid % NB_PROCS_MAX; 106 unsigned int cluster_xy = gpid >> P_WIDTH; 108 107 unsigned int x = cluster_xy >> Y_WIDTH; 109 108 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 109 unsigned int lpid = gpid & ((1<<P_WIDTH)-1); 110 110 111 111 while(1) -
soft/giet_vm/giet_kernel/exc_handler.c
r294 r428 72 72 { 73 73 unsigned int gpid = _get_procid(); 74 unsigned int cluster_xy = gpid / NB_PROCS_MAX; 75 unsigned int lpid = gpid % NB_PROCS_MAX; 74 unsigned int cluster_xy = gpid >> P_WIDTH; 76 75 unsigned int x = cluster_xy >> Y_WIDTH; 77 76 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 77 unsigned int lpid = gpid & ((1<<P_WIDTH)-1); 78 78 79 unsigned int task = _get_context_slot(CTX_LTID_ID); 79 80 -
soft/giet_vm/giet_kernel/irq_handler.c
r346 r428 51 51 { 52 52 unsigned int gpid = _get_procid(); 53 unsigned int cluster_xy = gpid / NB_PROCS_MAX;53 unsigned int cluster_xy = gpid >> P_WIDTH; 54 54 unsigned int x = cluster_xy >> Y_WIDTH; 55 55 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 56 unsigned int lpid = gpid % NB_PROCS_MAX;56 unsigned int lpid = gpid & ((1<<P_WIDTH)-1); 57 57 unsigned int irq_id; 58 58 unsigned int irq_type; … … 144 144 { 145 145 unsigned int gpid = _get_procid(); 146 unsigned int cluster_xy = gpid / NB_PROCS_MAX;146 unsigned int cluster_xy = gpid >> P_WIDTH; 147 147 unsigned int x = cluster_xy >> Y_WIDTH; 148 148 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 149 unsigned int lpid = gpid % NB_PROCS_MAX;149 unsigned int lpid = gpid & ((1<<P_WIDTH)-1); 150 150 151 151 _printf("\n[GIET WARNING] IRQ handler called but no active IRQ " … … 164 164 unsigned int channel ) // unused 165 165 { 166 unsigned int procid= _get_procid();167 unsigned int cluster_xy = procid / NB_PROCS_MAX;166 unsigned int gpid = _get_procid(); 167 unsigned int cluster_xy = gpid >> P_WIDTH; 168 168 unsigned int x = cluster_xy >> Y_WIDTH; 169 169 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 170 unsigned int lpid = procid % NB_PROCS_MAX; 170 unsigned int lpid = gpid & ((1<<P_WIDTH)-1); 171 171 172 unsigned int task = _get_current_task_id(); 172 173 unsigned int value; … … 219 220 unsigned int channel ) // channel index if HWI 220 221 { 221 unsigned int procid= _get_procid();222 unsigned int cluster_xy = procid / NB_PROCS_MAX;222 unsigned int gpid = _get_procid(); 223 unsigned int cluster_xy = gpid >> P_WIDTH; 223 224 224 225 // acknowledge HWI or PTI … … 229 230 unsigned int x = cluster_xy >> Y_WIDTH; 230 231 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 231 unsigned int lpid = procid % NB_PROCS_MAX;232 unsigned int lpid = gpid & ((1<<P_WIDTH)-1); 232 233 _puts("\n[IRQS DEBUG] Processor["); 233 234 _putd( x ); -
soft/giet_vm/giet_kernel/kernel_init.c
r410 r428 133 133 134 134 __attribute__((section (".kdata"))) 135 volatile static_scheduler_t* _schedulers[ NB_PROCS_MAX<<(X_WIDTH+Y_WIDTH)];135 volatile static_scheduler_t* _schedulers[X_SIZE][Y_SIZE][NB_PROCS_MAX]; 136 136 137 137 //////////////////////////////////////////////////////////////////////////////////// … … 140 140 141 141 __attribute__((section (".kdata"))) 142 volatile unsigned int _init_barrier = 0;142 volatile unsigned int kernel_init_barrier = 0; 143 143 144 144 /////////////////////////////////////////////////////////////////////////////////// 145 145 __attribute__((section (".kinit"))) void kernel_init() 146 146 { 147 unsigned int global_pid = _get_procid(); 148 unsigned int cluster_xy = global_pid / NB_PROCS_MAX; 149 unsigned int x = cluster_xy >> Y_WIDTH; 147 // gpid : hardware processor index (fixed format: X_WIDTH|Y_WIDTH|P_WIDTH) 148 // lpid : local processor id in a cluster ( lpid < NB_PROCS_MAX) 149 // cpid : "continuous" processor index = (((x * Y_SIZE + y) * NB_PROCS_MAX) + p 150 151 unsigned int gpid = _get_procid(); 152 unsigned int cluster_xy = gpid >> P_WIDTH; 153 unsigned int x = cluster_xy >> Y_WIDTH & ((1<<X_WIDTH)-1); 150 154 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 151 unsigned int lpid = global_pid % NB_PROCS_MAX; 152 unsigned int pid = ((( x * Y_SIZE) + y) * NB_PROCS_MAX) + lpid; 153 154 // This last initialisation phase is done sequencially: 155 while( pid != _init_barrier ) asm volatile ( "nop" ); 155 unsigned int lpid = gpid & ((1<<P_WIDTH)-1); 156 unsigned int cpid = ((( x * Y_SIZE) + y) * NB_PROCS_MAX) + lpid; 157 158 159 // This initialisation is done sequencially by each processor 160 while( cpid != kernel_init_barrier ) asm volatile ( "nop" ); 156 161 157 162 // Step 1 : each processor get its scheduler virtual address from CP0 register … … 161 166 unsigned int tasks = psched->tasks; 162 167 163 _schedulers[ global_pid] = psched;168 _schedulers[x][y][lpid] = psched; 164 169 165 170 #if GIET_DEBUG_INIT … … 183 188 for (ltid = 0; ltid < tasks; ltid++) 184 189 { 185 unsigned int vsid = _get_task_slot( global_pid, ltid , CTX_VSID_ID );186 unsigned int ptab = _get_task_slot( global_pid, ltid , CTX_PTAB_ID );187 unsigned int ptpr = _get_task_slot( global_pid, ltid , CTX_PTPR_ID );190 unsigned int vsid = _get_task_slot( x, y, lpid, ltid , CTX_VSID_ID ); 191 unsigned int ptab = _get_task_slot( x, y, lpid, ltid , CTX_PTAB_ID ); 192 unsigned int ptpr = _get_task_slot( x, y, lpid, ltid , CTX_PTPR_ID ); 188 193 189 194 // initialize PTABS arrays … … 204 209 // compute ctx_ra 205 210 unsigned int ctx_ra = (unsigned int)(&_ctx_eret); 206 _set_task_slot( global_pid, ltid, CTX_RA_ID, ctx_ra );211 _set_task_slot( x, y, lpid, ltid, CTX_RA_ID, ctx_ra ); 207 212 208 213 // compute ctx_epc 209 unsigned int* ptr = (unsigned int*)_get_task_slot( global_pid, ltid, CTX_EPC_ID );210 _set_task_slot( global_pid, ltid, CTX_EPC_ID, *ptr );214 unsigned int* ptr = (unsigned int*)_get_task_slot( x, y, lpid, ltid, CTX_EPC_ID ); 215 _set_task_slot( x, y, lpid, ltid, CTX_EPC_ID, *ptr ); 211 216 212 217 #if GIET_DEBUG_INIT … … 215 220 " - ctx_ra = %x\n", 216 221 x, y, lpid, ltid, 217 _get_task_slot( global_pid, ltid, CTX_EPC_ID ),218 _get_task_slot( global_pid, ltid, CTX_RA_ID ) );222 _get_task_slot( x, y, lpid, ltid, CTX_EPC_ID ), 223 _get_task_slot( x, y, lpid, ltid, CTX_RA_ID ) ); 219 224 #endif 220 225 … … 297 302 unsigned int pstack = ((unsigned int)psched) + 0x2000; 298 303 299 _set_task_slot( global_pid, IDLE_TASK_INDEX, CTX_SP_ID, pstack);300 _set_task_slot( global_pid, IDLE_TASK_INDEX, CTX_RA_ID, (unsigned int) &_ctx_eret);301 _set_task_slot( global_pid, IDLE_TASK_INDEX, CTX_EPC_ID, (unsigned int) &_idle_task);304 _set_task_slot( x, y, lpid, IDLE_TASK_INDEX, CTX_SP_ID, pstack); 305 _set_task_slot( x, y, lpid, IDLE_TASK_INDEX, CTX_RA_ID, (unsigned int) &_ctx_eret); 306 _set_task_slot( x, y, lpid, IDLE_TASK_INDEX, CTX_EPC_ID, (unsigned int) &_idle_task); 302 307 303 308 #if GIET_DEBUG_INIT … … 326 331 } 327 332 328 unsigned int sp_value = _get_task_slot( global_pid, ltid, CTX_SP_ID);329 unsigned int sr_value = _get_task_slot( global_pid, ltid, CTX_SR_ID);330 unsigned int ptpr_value = _get_task_slot( global_pid, ltid, CTX_PTPR_ID);331 unsigned int epc_value = _get_task_slot( global_pid, ltid, CTX_EPC_ID);333 unsigned int sp_value = _get_task_slot( x, y, lpid, ltid, CTX_SP_ID); 334 unsigned int sr_value = _get_task_slot( x, y, lpid, ltid, CTX_SR_ID); 335 unsigned int ptpr_value = _get_task_slot( x, y, lpid, ltid, CTX_PTPR_ID); 336 unsigned int epc_value = _get_task_slot( x, y, lpid, ltid, CTX_EPC_ID); 332 337 333 338 #if GIET_DEBUG_INIT … … 337 342 338 343 // increment barrier counter 339 _init_barrier++;344 kernel_init_barrier++; 340 345 341 346 // busy waiting until all processors synchronized 342 while ( _init_barrier != NB_TOTAL_PROCS );347 while ( kernel_init_barrier != NB_TOTAL_PROCS ); 343 348 344 349 #if GIET_DEBUG_INIT -
soft/giet_vm/giet_kernel/sys_handler.c
r410 r428 35 35 const void * _syscall_vector[64] = 36 36 { 37 &_ get_procid,/* 0x00 */37 &_proc_xyp, /* 0x00 */ 38 38 &_get_proctime, /* 0x01 */ 39 39 &_tty_write, /* 0x02 */ … … 113 113 } 114 114 115 ////////////////////////////////////////////////////////////////////////////// 116 // This function returns the processor (x,y,p) identifiers. 117 ////////////////////////////////////////////////////////////////////////////// 118 void _proc_xyp( unsigned int* x, 119 unsigned int* y, 120 unsigned int* p ) 121 { 122 unsigned int gpid = _get_procid(); // global processor index from CPO register 123 124 *x = (gpid >> (Y_WIDTH + P_WIDTH)) & ((1<<X_WIDTH)-1); 125 *y = (gpid >> P_WIDTH) & ((1<<Y_WIDTH)-1); 126 *p = gpid & ((1<<P_WIDTH)-1); 127 } 115 128 //////////////////////////////////////////////////////////////////////////// 116 129 // Task suicide... after printing a death message. … … 119 132 { 120 133 unsigned int date = _get_proctime(); 121 unsigned int proc_id = _get_procid(); 122 unsigned int cluster_xy = proc_id / NB_PROCS_MAX; 134 135 unsigned int gpid = _get_procid(); 136 unsigned int cluster_xy = gpid >> P_WIDTH; 123 137 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 124 138 unsigned int x = cluster_xy >> Y_WIDTH; 125 unsigned int lpid = proc_id % NB_PROCS_MAX; 139 unsigned int lpid = gpid & ((1<<P_WIDTH)-1); 140 126 141 unsigned int task_id = _get_context_slot(CTX_LTID_ID); 127 142 -
soft/giet_vm/giet_kernel/sys_handler.h
r396 r428 20 20 21 21 void _sys_ukn(); 22 23 void _proc_xyp( unsigned int* x, 24 unsigned int* y, 25 unsigned int* p ); 22 26 23 27 void _task_exit();
Note: See TracChangeset
for help on using the changeset viewer.