Changeset 610 for trunk/hal/tsar_mips32
- Timestamp:
- Dec 27, 2018, 7:38:58 PM (6 years ago)
- Location:
- trunk/hal/tsar_mips32
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/core/hal_exception.c
r587 r610 158 158 // This function is called when an MMU exception has been detected (IBE / DBE). 159 159 // It get the relevant exception arguments from the MMU. 160 // It signal a fatal error in case of illegal access. In case of page unmapped 161 // it checks that the faulty address belongs to a registered vseg. It update the local 160 // It signal a fatal error in case of illegal access. In case of page unmapped, 161 // it get the client process to access the relevant VMM: for a RPC thread, the client 162 // process is NOT the calling thread process. 163 // Then, it checks that the faulty address belongs to a registered vseg, update the local 162 164 // vseg list from the reference cluster if required, and signal a fatal user error 163 165 // in case of illegal virtual address. Finally, it updates the local page table from the … … 183 185 uint32_t bad_vaddr; 184 186 uint32_t excp_code; 185 187 188 // check thread type 189 if( CURRENT_THREAD->type != THREAD_USER ) 190 { 191 printk("\n[KERNEL PANIC] in %s : illegal thread type %s\n", 192 __FUNCTION__, thread_type_str(CURRENT_THREAD->type) ); 193 194 return EXCP_KERNEL_PANIC; 195 } 196 197 // get faulty thread process 186 198 process = this->process; 187 199 … … 207 219 uint32_t cycle = (uint32_t)hal_get_cycles(); 208 220 if( DEBUG_HAL_EXCEPTIONS < cycle ) 209 printk("\n[ DBG] %s : thread[%x,%x] enter / is_ins %d / %s / vaddr %x / cycle %d\n",210 __FUNCTION__, process->pid, this->trdid, 221 printk("\n[%s] thread[%x,%x] on core [%x,%x] enter / is_ins %d / %s / vaddr %x / cycle %d\n", 222 __FUNCTION__, process->pid, this->trdid, local_cxy, this->core->lid, 211 223 is_ins, hal_mmu_exception_str(excp_code), bad_vaddr, cycle); 212 224 #endif … … 215 227 switch( excp_code ) 216 228 { 217 case MMU_WRITE_PT1_UNMAPPED: // non fatal218 case MMU_WRITE_PT2_UNMAPPED: 219 case MMU_READ_PT1_UNMAPPED: 220 case MMU_READ_PT2_UNMAPPED: 229 case MMU_WRITE_PT1_UNMAPPED: // can be non fatal 230 case MMU_WRITE_PT2_UNMAPPED: // can be non fatal 231 case MMU_READ_PT1_UNMAPPED: // can be non fatal 232 case MMU_READ_PT2_UNMAPPED: // can be non fatal 221 233 { 222 234 // try to map the unmapped PTE … … 230 242 cycle = (uint32_t)hal_get_cycles(); 231 243 if( DEBUG_HAL_EXCEPTIONS < cycle ) 232 printk("\n[ DBG] %s : thread[%x,%x] exit / page-fault handled for vaddr = %x\n",233 __FUNCTION__, process->pid, this->trdid, bad_vaddr );244 printk("\n[%s] thread[%x,%x] on core [%x,%x] exit / page-fault handled for vaddr = %x\n", 245 __FUNCTION__, process->pid, this->trdid, local_cxy, this->core->lid, bad_vaddr ); 234 246 #endif 235 247 … … 238 250 else if( error == EXCP_USER_ERROR ) // illegal vaddr 239 251 { 240 printk("\n[USER ERROR] in %s for thread %x in process %x\n" 241 " illegal vaddr = %x / is_ins %d / epc %x\n", 242 __FUNCTION__, this->trdid, this->process->pid, bad_vaddr, is_ins, excPC ); 252 printk("\n[USER ERROR] in %s : thread[%x,%x] on core[%x,%x] / cycle %d\n" 253 " %s : epc %x / badvaddr %x / is_ins %d\n", 254 __FUNCTION__, this->process->pid, this->trdid, local_cxy, 255 this->core->lid, (uint32_t)hal_get_cycles(), 256 hal_mmu_exception_str(excp_code), excPC, bad_vaddr, is_ins ); 243 257 244 258 return EXCP_USER_ERROR; … … 246 260 else // error == EXCP_KERNEL_PANIC 247 261 { 248 printk("\n[KERNEL ERROR] in %s for thread %x in process %x\n" 249 " no memory to map vaddr = %x / is_ins %d / epc %x\n", 250 __FUNCTION__, this->trdid, this->process->pid, bad_vaddr, is_ins, excPC ); 262 printk("\n[KERNEL PANIC] in %s : thread[%x,%x] on core[%x,%x] / cycle %d\n" 263 " %s : epc %x / badvaddr %x / is_ins %d\n", 264 __FUNCTION__, this->process->pid, this->trdid, local_cxy, 265 this->core->lid, (uint32_t)hal_get_cycles(), 266 hal_mmu_exception_str(excp_code), excPC, bad_vaddr, is_ins ); 251 267 252 268 return EXCP_KERNEL_PANIC; 253 269 } 254 270 } 255 case MMU_WRITE_PRIVILEGE_VIOLATION: // illegal access user error 256 case MMU_READ_PRIVILEGE_VIOLATION: 257 { 258 printk("\n[USER ERROR] in %s : thread %x in process %x\n" 259 " illegal user access to vaddr = %x / is_ins %d / epc %x\n", 260 __FUNCTION__, this->trdid, this->process->pid, bad_vaddr, is_ins, excPC ); 271 case MMU_WRITE_PRIVILEGE_VIOLATION: // illegal user error 272 case MMU_READ_PRIVILEGE_VIOLATION: // illegal 273 { 274 printk("\n[USER ERROR] in %s : thread[%x,%x] on core[%x,%x] / cycle %d\n" 275 " %s : epc %x / badvaddr %x / is_ins %d\n", 276 __FUNCTION__, this->process->pid, this->trdid, local_cxy, 277 this->core->lid, (uint32_t)hal_get_cycles(), 278 hal_mmu_exception_str(excp_code), excPC, bad_vaddr, is_ins ); 261 279 262 280 return EXCP_USER_ERROR; 263 281 } 264 case MMU_WRITE_ACCESS_VIOLATION: // user error, or Copy-on-Write 265 { 266 // access page table to get GPT_COW flag 267 bool_t cow = hal_gpt_pte_is_cow( &(process->vmm.gpt), 268 bad_vaddr >> CONFIG_PPM_PAGE_SHIFT ); 269 270 if( cow ) // Copy-on-Write 271 { 272 // try to allocate and copy the page 273 error = vmm_handle_cow( process, 274 bad_vaddr >> CONFIG_PPM_PAGE_SHIFT ); 275 276 if( error == EXCP_NON_FATAL ) // Copy on write successfull 277 { 282 case MMU_WRITE_ACCESS_VIOLATION: // can be non fatal if COW 283 { 284 // try to handle a possible COW 285 error = vmm_handle_cow( process, 286 bad_vaddr >> CONFIG_PPM_PAGE_SHIFT ); 287 288 if( error == EXCP_NON_FATAL ) // COW successfully handled 289 { 278 290 279 291 #if DEBUG_HAL_EXCEPTIONS 280 292 cycle = (uint32_t)hal_get_cycles(); 281 293 if( DEBUG_HAL_EXCEPTIONS < cycle ) 282 printk("\n[ DBG] %s :thread[%x,%x] exit / copy-on-write handled for vaddr = %x\n",294 printk("\n[%s] thread[%x,%x] exit / copy-on-write handled for vaddr = %x\n", 283 295 __FUNCTION__, process->pid, this->trdid, bad_vaddr ); 284 296 #endif 285 286 return EXCP_NON_FATAL; 287 } 288 else if( error == EXCP_USER_ERROR ) // illegal user access 289 { 290 printk("\n[USER ERROR] in %s : thread %x in process %x\n" 291 " cannot cow vaddr = %x / is_ins %d / epc %x\n", 292 __FUNCTION__, this->trdid, this->process->pid, bad_vaddr, is_ins, excPC ); 297 return EXCP_NON_FATAL; 298 } 299 else if( error == EXCP_USER_ERROR ) // illegal write access 300 { 301 printk("\n[USER ERROR] in %s : thread[%x,%x] on core[%x,%x] / cycle %d\n" 302 " %s : epc %x / badvaddr %x / is_ins %d\n", 303 __FUNCTION__, this->process->pid, this->trdid, local_cxy, 304 this->core->lid, (uint32_t)hal_get_cycles(), 305 hal_mmu_exception_str(excp_code), excPC, bad_vaddr, is_ins ); 293 306 294 307 return EXCP_USER_ERROR; 295 }296 else // error == EXCP_KERNEL_PANIC297 {298 printk("\n[KERNEL ERROR] in %s : thread %x in process %x\n"299 " no memoty to cow vaddr = %x / is_ins %d / epc %x\n",300 __FUNCTION__, this->trdid, this->process->pid, bad_vaddr, is_ins, excPC );301 302 return EXCP_USER_ERROR;303 }304 308 } 305 else // non writable user error 306 { 307 printk("\n[USER ERROR] in %s : thread %x in process %x\n" 308 " non-writable vaddr = %x / is_ins %d / epc %x\n", 309 __FUNCTION__, this->trdid, this->process->pid, bad_vaddr, is_ins, excPC ); 310 311 return EXCP_USER_ERROR; 309 else // error == EXCP_KERNEL_PANIC 310 { 311 printk("\n[KERNEL PANIC] in %s : thread[%x,%x] on core[%x,%x] / cycle %d\n" 312 " %s : epc %x / badvaddr %x / is_ins %d\n", 313 __FUNCTION__, this->process->pid, this->trdid, local_cxy, 314 this->core->lid, (uint32_t)hal_get_cycles(), 315 hal_mmu_exception_str(excp_code), excPC, bad_vaddr, is_ins ); 316 317 return EXCP_USER_ERROR; 312 318 } 313 319 } 314 320 case MMU_READ_EXEC_VIOLATION: // user error 315 321 { 316 printk("\n[USER_ERROR] in %s : thread %x in process %x\n" 317 " non-executable vaddr = %x / is_ins %d / epc %x\n", 318 __FUNCTION__, this->trdid, this->process->pid, bad_vaddr, is_ins, excPC ); 322 printk("\n[USER ERROR] in %s : thread[%x,%x] on core[%x,%x] / cycle %d\n" 323 " %s : epc %x / badvaddr %x / is_ins %d\n", 324 __FUNCTION__, this->process->pid, this->trdid, local_cxy, 325 this->core->lid, (uint32_t)hal_get_cycles(), 326 hal_mmu_exception_str(excp_code), excPC, bad_vaddr, is_ins ); 319 327 320 328 return EXCP_USER_ERROR; … … 322 330 default: // this is a kernel error 323 331 { 324 printk("\n[KERNEL ERROR] in %s : thread %x in process %x\n" 325 " epc %x / badvaddr %x / is_ins %d\n", 326 __FUNCTION__, this->trdid, this->process->pid, excPC, bad_vaddr, is_ins ); 332 printk("\n[KERNEL PANIC] in %s : thread[%x,%x] on core[%x,%x] / cycle %d\n" 333 " %s : epc %x / badvaddr %x / is_ins %d\n", 334 __FUNCTION__, this->process->pid, this->trdid, local_cxy, 335 this->core->lid, (uint32_t)hal_get_cycles(), 336 hal_mmu_exception_str(excp_code), excPC, bad_vaddr, is_ins ); 327 337 328 338 return EXCP_KERNEL_PANIC; … … 359 369 if( error == EXCP_USER_ERROR ) 360 370 { 361 nolock_printk("\n=== USER ERROR / t rdid %x / pid %x / core[%x,%d] / cycle %d ===\n",362 this->trdid, process->pid, local_cxy, core->lid, (uint32_t)hal_get_cycles() );371 nolock_printk("\n=== USER ERROR / thread(%x,%x) / core[%d] / cycle %d ===\n", 372 process->pid, this->trdid, core->lid, (uint32_t)hal_get_cycles() ); 363 373 } 364 374 else 365 375 { 366 nolock_printk("\n=== KERNEL ERROR / trdid %x / pid %x / core[%x,%d] / cycle %d ===\n",367 this->trdid, process->pid, local_cxy, core->lid, (uint32_t)hal_get_cycles() );376 nolock_printk("\n=== KERNEL PANIC / thread(%x,%x) / core[%d] / cycle %d ===\n", 377 process->pid, this->trdid, core->lid, (uint32_t)hal_get_cycles() ); 368 378 } 369 379 … … 400 410 } // end hal_exception_dump() 401 411 402 /////////////////////// 412 ///////////////////////////// 403 413 void hal_do_exception( void ) 404 414 { … … 420 430 uint32_t cycle = (uint32_t)hal_get_cycles(); 421 431 if( DEBUG_HAL_EXCEPTIONS < cycle ) 422 printk("\n[DBG] %s : thread %x in process %x enter / core[%x,%d] / epc %x / xcode %x / cycle %d\n", 423 __FUNCTION__, this->trdid, this->process->pid, local_cxy, this->core->lid, excPC, excCode, cycle ); 432 printk("\n[%s] thread[%x,%x] enter / core[%x,%d] / epc %x / xcode %x / cycle %d\n", 433 __FUNCTION__, this->process->pid, this->trdid, 434 local_cxy, this->core->lid, excPC, excCode, cycle ); 424 435 #endif 425 436 … … 473 484 { 474 485 printk("\n[USER_ERROR] in %s for thread %x in process %x\n" 475 " illegal data load address / epc %x \n",476 __FUNCTION__, this->trdid, this->process->pid, excPC );486 " illegal data load address / epc %x / bad_address %x\n", 487 __FUNCTION__, this->trdid, this->process->pid, excPC, hal_get_bad_vaddr() ); 477 488 478 489 error = EXCP_USER_ERROR; … … 482 493 { 483 494 printk("\n[USER_ERROR] in %s for thread %x in process %x\n" 484 " illegal data store address / epc %x \n",485 __FUNCTION__, this->trdid, this->process->pid, excPC );495 " illegal data store address / epc %x / bad_address %x\n", 496 __FUNCTION__, this->trdid, this->process->pid, excPC, hal_get_bad_vaddr() ); 486 497 487 498 error = EXCP_USER_ERROR; … … 505 516 hal_exception_dump( this , uzone , error ); 506 517 507 assert( false , "Exception raised kernel panic see information below.\n");518 hal_core_sleep(); 508 519 } 509 520 … … 511 522 cycle = (uint32_t)hal_get_cycles(); 512 523 if( DEBUG_HAL_EXCEPTIONS < cycle ) 513 printk("\n[DBG] %s : thread %x in process %x exit / core[%x,%d] / epc %x / xcode %x / cycle %d\n", 514 __FUNCTION__, this->trdid, this->process->pid, local_cxy, this->core->lid, excPC, excCode, cycle ); 524 printk("\n[%s] thread[%x,%x] exit / core[%x,%d] / epc %x / xcode %x / cycle %d\n", 525 __FUNCTION__, this->process->pid, this->trdid, 526 local_cxy, this->core->lid, excPC, excCode, cycle ); 515 527 #endif 516 528 -
trunk/hal/tsar_mips32/core/hal_ppm.c
r570 r610 2 2 * hal_ppm.c - Generic Physical Page Manager API implementation for TSAR 3 3 * 4 * Authors Alain Greiner (2016,2017 )4 * Authors Alain Greiner (2016,2017,2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 63 63 64 64 // initialize lock protecting the dirty_pages list 65 queuelock_init( &ppm->dirty_lock, LOCK_PPM_DIRTY );65 remote_queuelock_init( XPTR( local_cxy , &ppm->dirty_lock ) , LOCK_PPM_DIRTY ); 66 66 67 67 // initialize all free_pages[] lists as empty -
trunk/hal/tsar_mips32/core/hal_remote.c
r570 r610 381 381 uint32_t scxy = (uint32_t)GET_CXY( src ); 382 382 383 /* 384 if( local_cxy == 1 ) 385 printk("\n@@@ %s : scxy %x / sptr %x / dcxy %x / dptr %x\n", 386 __FUNCTION__, scxy, sptr, dcxy, dptr ); 387 */ 383 388 hal_disable_irq( &save_sr ); 384 389 -
trunk/hal/tsar_mips32/core/hal_uspace.c
r457 r610 43 43 uint32_t dst = (uint32_t)k_dst; 44 44 45 #if DEBUG_HAL_USPACE 46 thread_t * this = CURRENT_THREAD; 47 printk("\n[%s] thread[%x,%x] enter in cluster %x / u_src %x / k_dst %x / size %d\n", 48 __FUNCTION__, this->process->pid, this->trdid, local_cxy, u_src, k_dst, size ); 49 #endif 50 45 51 if( (dst & 0x3) || (src & 0x3) ) wsize = 0; // do it all in bytes 46 52 else wsize = size >> 2; … … 80 86 81 87 hal_restore_irq( save_sr ); 88 89 #if DEBUG_HAL_USPACE 90 printk("\n[%s] thread[%x,%x] exit\n", 91 __FUNCTION__, this->process->pid, this->trdid ); 92 #endif 82 93 83 94 } // end hal_copy_from_uspace() … … 94 105 uint32_t dst = (uint32_t)u_dst; 95 106 107 #if DEBUG_HAL_USPACE 108 thread_t * this = CURRENT_THREAD; 109 printk("\n[%s] thread[%x,%x] enter in cluster %x / k_src %x / u_dst %x / size %d\n", 110 __FUNCTION__, this->process->pid, this->trdid, local_cxy, k_src, u_dst, size ); 111 #endif 112 96 113 if( (dst & 0x3) || (src & 0x3) ) wsize = 0; // not aligned 97 114 else wsize = size >> 2; … … 118 135 asm volatile( 119 136 "mfc2 $15, $1 \n" /* save MMU_MODE */ 120 "l w$13, 0(%0) \n" /* read data from kernel space */137 "lb $13, 0(%0) \n" /* read data from kernel space */ 121 138 "ori $14, $0, 0x7 \n" 122 139 "mtc2 $14, $1 \n" /* MMU_MODE <= DTLB ON */ … … 130 147 131 148 hal_restore_irq( save_sr ); 149 150 #if DEBUG_HAL_USPACE 151 printk("\n[%s] thread[%x,%x] exit\n", 152 __FUNCTION__, this->process->pid, this->trdid ); 153 #endif 132 154 133 155 } // end hal_copy_to_uspace() -
trunk/hal/tsar_mips32/drivers/soclib_bdv.c
r570 r610 32 32 void soclib_bdv_init( chdev_t * chdev ) 33 33 { 34 // get extended pointer on SOCLIB_BDV peripheral base address34 // get extended pointer on SOCLIB_BDV peripheral base 35 35 xptr_t bdv_xp = chdev->base; 36 36 … … 62 62 xptr_t buf_xp; 63 63 xptr_t ioc_xp; 64 uint32_t status; // I/0 operation status (from BDV) 65 reg_t save_sr; // for critical section 66 uint32_t op; // BDV_OP_READ / BDV_OP_WRITE 64 67 65 68 // get client thread cluster and local pointer … … 67 70 thread_t * th_ptr = GET_PTR( th_xp ); 68 71 72 #if (DEBUG_HAL_IOC_RX || DEBUG_HAL_IOC_TX) 73 uint32_t cycle = (uint32_t)hal_get_cycles(); 74 thread_t * this = CURRENT_THREAD; 75 process_t * process = hal_remote_lpt( XPTR( th_cxy , &th_ptr->process ) ); 76 pid_t client_pid = hal_remote_l32( XPTR( th_cxy , &process->pid ) ); 77 trdid_t client_trdid = hal_remote_l32( XPTR( th_cxy , &th_ptr->trdid ) ); 78 #endif 79 69 80 // get command arguments and extended pointer on IOC device 70 cmd_type = hal_remote_l32 71 lba = hal_remote_l32 72 count = hal_remote_l32 81 cmd_type = hal_remote_l32( XPTR( th_cxy , &th_ptr->ioc_cmd.type ) ); 82 lba = hal_remote_l32( XPTR( th_cxy , &th_ptr->ioc_cmd.lba ) ); 83 count = hal_remote_l32( XPTR( th_cxy , &th_ptr->ioc_cmd.count ) ); 73 84 buf_xp = (xptr_t)hal_remote_l64( XPTR( th_cxy , &th_ptr->ioc_cmd.buf_xp ) ); 74 85 ioc_xp = (xptr_t)hal_remote_l64( XPTR( th_cxy , &th_ptr->ioc_cmd.dev_xp ) ); 75 86 76 87 #if DEBUG_HAL_IOC_RX 77 uint32_t cycle = (uint32_t)hal_get_cycles();78 88 if( (DEBUG_HAL_IOC_RX < cycle) && (cmd_type != IOC_WRITE ) ) 79 printk("\n[DBG] %s : thread %x enter for RX / cycle %d\n", 80 __FUNCTION__ , CURRENT_THREAD , cycle ); 81 #endif 82 83 #if DEBUG_HAL_IOC_TX 84 uint32_t cycle = (uint32_t)hal_get_cycles(); 89 printk("\n[%s] thread[%x,%x] enters for client thread[%x,%x] / RX / cycle %d\n", 90 __FUNCTION__ , this->process->pid, this->trdid, client_pid, client_trdid, cycle ); 91 #endif 92 93 #if DEBUG_HAL_IOC_TX 85 94 if( (DEBUG_HAL_IOC_TX < cycle) && (cmd_type == IOC_WRITE) ) 86 printk("\n[ DBG] %s : thread %x enter forTX / cycle %d\n",87 __FUNCTION__ , CURRENT_THREAD, cycle );95 printk("\n[%s] thread[%x,%x] enters for client thread[%x,%x] / TX / cycle %d\n", 96 __FUNCTION__ , this->process->pid, this->trdid, client_pid, client_trdid, cycle ); 88 97 #endif 89 98 … … 101 110 uint32_t buf_msb = (uint32_t)(buf_xp>>32); 102 111 103 // set operation 104 uint32_t op; 112 // select operation 105 113 if( cmd_type == IOC_WRITE ) op = BDV_OP_WRITE; 106 114 else op = BDV_OP_READ; 107 115 108 // set SOCLIB_BDV registers to start one I/O operation116 // set SOCLIB_BDV registers to configure the I/O operation 109 117 hal_remote_s32( XPTR( seg_cxy , seg_ptr + BDV_IRQ_ENABLE_REG ) , 1 ); 110 118 hal_remote_s32( XPTR( seg_cxy , seg_ptr + BDV_BUFFER_REG ) , buf_lsb ); … … 112 120 hal_remote_s32( XPTR( seg_cxy , seg_ptr + BDV_LBA_REG ) , lba ); 113 121 hal_remote_s32( XPTR( seg_cxy , seg_ptr + BDV_COUNT_REG ) , count ); 114 hal_remote_s32( XPTR( seg_cxy , seg_ptr + BDV_OP_REG ) , op );115 122 116 123 // waiting policy depends on the command type 117 124 // - for IOC_READ / IOC_WRITE commands, this function is called by the server thread 118 // - for IOC_SYNC_READ command, this function is directly called by the client thread 125 // that blocks and deschedules after launching the I/O transfer. 126 // The I/O operation status is reported in the command by the ISR. 127 // - for IOC_SYNC_READ command, this function is called by the client thread 128 // that polls the BDV status register until I/O transfer completion. 119 129 120 130 if( cmd_type == IOC_SYNC_READ ) // status polling policy 121 131 { 122 uint32_t status; 132 // launch I/O operation on BDV device 133 hal_remote_s32( XPTR( seg_cxy , seg_ptr + BDV_OP_REG ) , op ); 134 135 // wait completion 123 136 while (1) 124 137 { … … 143 156 else // descheduling + IRQ policy 144 157 { 158 // enter critical section to atomically 159 // lauch I/O operation and deschedule 160 hal_disable_irq( &save_sr ); 161 162 // launch I/O operation on BDV device 163 hal_remote_s32( XPTR( seg_cxy , seg_ptr + BDV_OP_REG ) , op ); 164 165 // server thread blocks on ISR 145 166 thread_block( XPTR( local_cxy , CURRENT_THREAD ) , THREAD_BLOCKED_ISR ); 167 168 #if DEBUG_HAL_IOC_RX 169 if( (DEBUG_HAL_IOC_RX < cycle) && (cmd_type != IOC_WRITE ) ) 170 printk("\n[%s] thread[%x,%x] blocks & deschedules after lauching RX transfer\n", 171 __FUNCTION__ , this->process->pid, this->trdid ); 172 #endif 173 174 #if DEBUG_HAL_IOC_TX 175 if( (DEBUG_HAL_IOC_TX < cycle) && (cmd_type == IOC_WRITE) ) 176 printk("\n[%s] thread[%x,%x] blocks & deschedules after lauching TX transfer\n", 177 __FUNCTION__ , this->process->pid, this->trdid ); 178 #endif 179 // server thread deschedules 146 180 sched_yield("blocked on ISR"); 147 181 148 // the IO operation status is reported in the command by the ISR 182 // exit critical section 183 hal_restore_irq( save_sr ); 149 184 } 150 185 151 186 #if DEBUG_HAL_IOC_RX 152 187 cycle = (uint32_t)hal_get_cycles(); 153 if( (DEBUG_HAL_IOC_RX < cycle) && (cmd_type != TXT_WRITE) )154 printk("\n[ DBG] %s : thread %x exit after RX/ cycle %d\n",155 __FUNCTION__ , CURRENT_THREAD, cycle );188 if( (DEBUG_HAL_IOC_RX < cycle) && (cmd_type != IOC_WRITE) ) 189 printk("\n[%s] thread[%x,%x] exit after RX for client thread[%x,%x] / cycle %d\n", 190 __FUNCTION__, this->process->pid, this->trdid, client_pid, client_trdid, cycle ); 156 191 #endif 157 192 158 193 #if DEBUG_HAL_IOC_TX 159 194 cycle = (uint32_t)hal_get_cycles(); 160 if( (DEBUG_HAL_IOC_TX < cycle) && (cmd_type == TXT_WRITE) )161 printk("\n[ DBG] %s : thread %x exit after TX/ cycle %d\n",162 __FUNCTION__ , CURRENT_THREAD, cycle );195 if( (DEBUG_HAL_IOC_TX < cycle) && (cmd_type == IOC_WRITE) ) 196 printk("\n[%s] thread[%x,%x] exit after TX for client thread[%x,%x] / cycle %d\n", 197 __FUNCTION__, this->process->pid, this->trdid, client_pid, client_trdid, cycle ); 163 198 #endif 164 199 … … 171 206 error_t error = 0; 172 207 208 // get extended pointer on server thread 209 xptr_t server_xp = XPTR( local_cxy , chdev->server ); 210 173 211 // get extended pointer on client thread 174 xptr_t root = XPTR( local_cxy , &chdev->wait_root );212 xptr_t root = XPTR( local_cxy , &chdev->wait_root ); 175 213 xptr_t client_xp = XLIST_FIRST( root , thread_t , wait_list ); 176 177 // get extended pointer on server thread178 xptr_t server_xp = XPTR( local_cxy , &chdev->server );179 214 180 215 // get client thread cluster and local pointer 181 216 cxy_t client_cxy = GET_CXY( client_xp ); 182 thread_t * client_ptr = (thread_t *)GET_PTR( client_xp );217 thread_t * client_ptr = GET_PTR( client_xp ); 183 218 184 219 // get command type 185 220 uint32_t cmd_type = hal_remote_l32( XPTR( client_cxy , &client_ptr->ioc_cmd.type ) ); 186 221 222 #if (DEBUG_HAL_IOC_RX || DEBUG_HAL_IOC_TX) 223 uint32_t cycle = (uint32_t)hal_get_cycles(); 224 process_t * process = hal_remote_lpt( XPTR( client_cxy , &client_ptr->process ) ); 225 pid_t client_pid = hal_remote_l32( XPTR( client_cxy , &process->pid ) ); 226 trdid_t client_trdid = hal_remote_l32( XPTR( client_cxy , &client_ptr->trdid ) ); 227 thread_t * server = GET_PTR( server_xp ); 228 pid_t server_pid = server->process->pid; 229 trdid_t server_trdid = server->trdid; 230 #endif 231 187 232 // get SOCLIB_BDV device cluster and local pointer 188 233 cxy_t bdv_cxy = GET_CXY( chdev->base ); 189 uint32_t * bdv_ptr = (uint32_t *)GET_PTR( chdev->base );234 uint32_t * bdv_ptr = GET_PTR( chdev->base ); 190 235 191 236 // get BDV status register and acknowledge IRQ … … 197 242 198 243 #if DEBUG_HAL_IOC_RX 199 uint32_t cycle = (uint32_t)hal_get_cycles();200 244 if( DEBUG_HAL_IOC_RX < cycle ) 201 printk("\n[ DBG] %s : IOC_IRQ / RX transfer / client %x / server %x/ cycle %d\n",202 __FUNCTION__, client_p tr , chdev->server, cycle );245 printk("\n[%s] RX transfer completed for client[%x,%x] / server[%x,%x] / cycle %d\n", 246 __FUNCTION__, client_pid, client_trdid, server_pid, server_trdid, cycle ); 203 247 #endif 204 248 … … 209 253 210 254 #if DEBUG_HAL_IOC_TX 211 uint32_t cycle = (uint32_t)hal_get_cycles();212 255 if( DEBUG_HAL_IOC_TX < cycle ) 213 printk("\n[ DBG] %s : IOC_IRQ / RX transfer / client %x / server %x/ cycle %d\n",214 __FUNCTION__, client_p tr , chdev->server, cycle );256 printk("\n[%s] TX transfer completed for client[%x,%x] / server[%x,%x] / cycle %d\n", 257 __FUNCTION__, client_pid, client_trdid, server_pid, server_trdid, cycle ); 215 258 #endif 216 259
Note: See TracChangeset
for help on using the changeset viewer.