src/occ_405/gpu/gpu.c
// For all GPUs read GPU reset status and take action if reset status has changed
For all GPUs read GPU reset status and take action if reset status has changed
For all GPUs read GPU reset status and take action if reset status has changed
void update_gpu_reset_status(void)
{
    uint8_t gpu_num = 0;
    ocb_occflg_t occ_flags = {0};
    occ_flags.value = in32(OCB_OCCFLG);
    bool not_in_reset[3] = {occ_flags.fields.gpu0_reset_status,
                            occ_flags.fields.gpu1_reset_status,
                            occ_flags.fields.gpu2_reset_status};
    for (gpu_num=0; gpu_num<MAX_NUM_GPU_PER_DOMAIN; gpu_num++)
    {
        if(not_in_reset[gpu_num] != g_amec->gpu[gpu_num].status.notReset)
        {
            INTR_TRAC_IMP("update_gpu_reset_status: GPU%d NOT in reset is now = %d",
                           gpu_num,
                           not_in_reset[gpu_num]);
            clear_gpu_driver_status(gpu_num);
            g_amec->gpu[gpu_num].status.errorCount = 0;
            g_amec->gpu[gpu_num].status.retryCount = 0;
            g_amec->gpu[gpu_num].status.readOnce = false;
            if(not_in_reset[gpu_num])
            {
                g_amec->gpu[gpu_num].status.disabled = false;
            }
            else
            {
                g_amec->gpu[gpu_num].status.coreTempFailure = false;
                g_amec->gpu[gpu_num].status.coreTempNotAvailable = true;
                g_amec->gpu[gpu_num].status.memTempFailure = false;
                g_amec->gpu[gpu_num].status.memTempNotAvailable = true;
            }
            g_amec->gpu[gpu_num].status.notReset = not_in_reset[gpu_num];
        }  
    }  
}
void update_gpu_reset_status ( void ) { uint8_t gpu_num = 0 ; ocb_occflg_t occ_flags = { 0 } ; occ_flags . value = in32 ( OCB_OCCFLG ) ; bool not_in_reset [ 3 ] = { occ_flags . fields . gpu0_reset_status , occ_flags . fields . gpu1_reset_status , occ_flags . fields . gpu2_reset_status } ; for ( gpu_num = 0 ; gpu_num < MAX_NUM_GPU_PER_DOMAIN ; gpu_num ++ ) { if ( not_in_reset [ gpu_num ] != g_amec -> gpu [ gpu_num ] . status . notReset ) { INTR_TRAC_IMP ( " " , gpu_num , not_in_reset [ gpu_num ] ) ; clear_gpu_driver_status ( gpu_num ) ; g_amec -> gpu [ gpu_num ] . status . errorCount = 0 ; g_amec -> gpu [ gpu_num ] . status . retryCount = 0 ; g_amec -> gpu [ gpu_num ] . status . readOnce = false ; if ( not_in_reset [ gpu_num ] ) { g_amec -> gpu [ gpu_num ] . status . disabled = false ; } else { g_amec -> gpu [ gpu_num ] . status . coreTempFailure = false ; g_amec -> gpu [ gpu_num ] . status . coreTempNotAvailable = true ; g_amec -> gpu [ gpu_num ] . status . memTempFailure = false ; g_amec -> gpu [ gpu_num ] . status . memTempNotAvailable = true ; } g_amec -> gpu [ gpu_num ] . status . notReset = not_in_reset [ gpu_num ] ; } } }
For all GPUs read GPU reset status and take action if reset status has changed
For all GPUs read GPU reset status and take action if reset status has changed
// GPU reset status is in the OCC FLAGS register and is updated by OPAL // Read the current reset status for all GPUs.  A reset status of '1' indicates NOT in reset // reset status of '0' (IN reset) is the default // the OCC will still try to read GPU when IN reset but will not log errors // this is so we still communicate with the GPUs without OPAL support to indicate // a GPU is not in reset. // Full OCC support below for when OPAL starts updating the reset status // There has been a change to the reset status clear everything out except for errors logged so we don't log again // readOnce of false will force comm to be established and once established then checkDriverLoaded will get set // GPU was taken out of reset clear disabled to allow communication again // GPU was put in reset.  Clear temperature sensor errors and set to not available // if GPU reset status changed // for each GPU