Ignore:
Timestamp:
Apr 4, 2018, 2:49:02 PM (7 years ago)
Author:
alain
Message:

Fix a bug in scheduler related to RPC blocking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/tsar_mips32/drivers/soclib_pic.c

    r435 r438  
    130130                           &pti_status );
    131131
    132 #if CONFIG_DEBUG_HAL_IRQS
     132#if DEBUG_HAL_IRQS
    133133uint32_t cycle = (uint32_t)hal_get_cycles();
    134 if (CONFIG_DEBUG_HAL_IRQS < cycle )
     134if (DEBUG_HAL_IRQS < cycle )
    135135printk("\n[DBG] %s : core[%x,%d] enter / WTI = %x / HWI = %x / PTI = %x / cycle %d\n",
    136136__FUNCTION__ , local_cxy , core->lid , wti_status , hwi_status , pti_status, cycle );
     
    143143        index = wti_status - 1;
    144144
     145        ////////////////////////////////////////////////////////
    145146        if( index < LOCAL_CLUSTER->cores_nr )   // it is an IPI
    146147        {
    147148            assert( (index == core->lid) , __FUNCTION__ , "illegal IPI index" );
    148149
    149 #if CONFIG_DEBUG_HAL_IRQS
    150 if (CONFIG_DEBUG_HAL_IRQS < cycle )
     150#if DEBUG_HAL_IRQS
     151if (DEBUG_HAL_IRQS < cycle )
    151152printk("\n[DBG] %s : core[%x,%d] received an IPI\n", __FUNCTION__ , local_cxy , core->lid );
    152153#endif
    153             // acknowledge WTI (this require an XCU read)
     154            // acknowledge IRQ (this require an XCU read)
    154155            uint32_t   ack  = xcu_base[(XCU_WTI_REG << 5) | core->lid];
    155            
     156
    156157            // check RPC FIFO,  and activate or create a RPC thread
    157158            // condition is always true, but we must use the ack value
    158159            if( ack + 1 ) rpc_check();
    159160        }
    160         else                                    // it is an external device
     161        ////////////////////////////////////////////////////////////////
     162        else                                    // it is an external IRQ
    161163        {
    162164            // get pointer on source chdev
     
    171173
    172174                // disable WTI in local XCU controller
    173                 uint32_t * base = soclib_pic_xcu_base();
    174                 base[(XCU_MSK_WTI_DISABLE << 5) | core->lid] = 1 << core->lid;
     175                xcu_base[(XCU_MSK_WTI_DISABLE << 5) | core->lid] = 1 << core->lid;
     176
     177                hal_fence();
    175178            }
    176179            else                                 // call relevant ISR
    177180            {
    178181
    179 #if CONFIG_DEBUG_HAL_IRQS
    180 if (CONFIG_DEBUG_HAL_IRQS < cycle )
     182#if DEBUG_HAL_IRQS
     183if (DEBUG_HAL_IRQS < cycle )
    181184printk("\n[DBG] %s : core[%x,%d] received external WTI %d\n",
    182185__FUNCTION__ , local_cxy , core->lid , index );
     
    188191        }
    189192
    190         if( hwi_status )      // pending HWI
     193    /////////////////////////////////////////////////////////////
     194        if( hwi_status )                     // It is an Internal IRQ
    191195        {
    192196        index = hwi_status - 1;
     
    204208            // disable HWI in local XCU controller
    205209            xcu_base[(XCU_MSK_HWI_DISABLE << 5) | core->lid] = 1 << core->lid;
     210
     211            hal_fence();
    206212                }
    207213        else                    // call relevant ISR
    208214        {
    209215
    210 #if CONFIG_DEBUG_HAL_IRQS
    211 if (CONFIG_DEBUG_HAL_IRQS < cycle )
     216#if DEBUG_HAL_IRQS
     217if (DEBUG_HAL_IRQS < cycle )
    212218printk("\n[DBG] %s : core[%x,%d] received HWI %d\n",
    213219__FUNCTION__ , local_cxy , core->lid , index );
     
    217223        }
    218224        }
    219 
    220     if( pti_status )      // pending PTI
     225    ///////////////////////////////////////////////////////
     226    if( pti_status )                   // It is a Timer IRQ
    221227        {
    222228        index = pti_status - 1;
     
    224230        assert( (index == core->lid) , __FUNCTION__ , "unconsistent PTI index\n");
    225231
    226 #if CONFIG_DEBUG_HAL_IRQS
    227 if (CONFIG_DEBUG_HAL_IRQS < cycle )
     232#if DEBUG_HAL_IRQS
     233if (DEBUG_HAL_IRQS < cycle )
    228234printk("\n[DBG] %s : core[%x,%d] received PTI %d\n",
    229235__FUNCTION__ , core->lid , local_cxy , index );
    230236#endif
    231         // acknowledge PTI (this require a read access to XCU)
     237        // acknowledge IRQ (this require a read access to XCU)
    232238        uint32_t   ack  = xcu_base[(XCU_PTI_ACK << 5) | core->lid];
    233239
     
    359365{
    360366
    361 #if CONFIG_DEBUG_HAL_IRQS
     367#if DEBUG_HAL_IRQS
    362368uint32_t cycle = (uint32_t)hal_get_cycles();
    363 if( CONFIG_DEBUG_HAL_IRQS < cycle )
     369if( DEBUG_HAL_IRQS < cycle )
    364370printk("\n[DBG] %s : thread %x enter for core[%x,%d] / cycle %d\n",
    365371__FUNCTION__ , CURRENT_THREAD , local_cxy , lid , cycle );
     
    422428        ((soclib_pic_core_t *)core->pic_extend)->wti_vector[wti_id] = src_chdev;
    423429
    424 #if CONFIG_DEBUG_HAL_IRQS
    425 if( CONFIG_DEBUG_HAL_IRQS < cycle )
     430#if DEBUG_HAL_IRQS
     431if( DEBUG_HAL_IRQS < cycle )
    426432printk("\n[DBG] %s : %s / channel = %d / rx = %d / hwi_id = %d / wti_id = %d / cluster = %x\n",
    427433__FUNCTION__ , chdev_func_str( func ) , channel , is_rx , hwi_id , wti_id , local_cxy );
     
    444450        ((soclib_pic_core_t *)core->pic_extend)->wti_vector[hwi_id] = src_chdev;
    445451
    446 #if CONFIG_DEBUG_HAL_IRQS
    447 if( CONFIG_DEBUG_HAL_IRQS < cycle )
     452#if DEBUG_HAL_IRQS
     453if( DEBUG_HAL_IRQS < cycle )
    448454printk("\n[DBG] %s : %s / channel = %d / hwi_id = %d / cluster = %x\n",
    449455__FUNCTION__ , chdev_func_str( func ) , channel , hwi_id , local_cxy );
Note: See TracChangeset for help on using the changeset viewer.