Skip to content

Commit

Permalink
Enable ATTN prior to OPAL handoff
Browse files Browse the repository at this point in the history
Change-Id: Iadfded90c09b149948348ee462ab34f9c2431982
RTC: 182134
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/49865
Reviewed-by: Matt Derksen <mderkse1@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
brianebakke authored and dcrowell77 committed Nov 30, 2017
1 parent c5c12e6 commit 3a88f18
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/include/arch/ppc.H
Expand Up @@ -363,6 +363,13 @@ inline uint64_t getHID()
return hid;
}

ALWAYS_INLINE
inline void setHID(uint64_t _hid)
{
register uint64_t hid = _hid;
asm volatile("mtspr 1008, %0; isync" :: "r" (hid));
}

ALWAYS_INLINE
inline size_t getCacheLineBytes()
{
Expand Down
4 changes: 3 additions & 1 deletion src/include/kernel/syscalls.H
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2010,2014 */
/* Contributors Listed Below - COPYRIGHT 2010,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -93,6 +93,8 @@ namespace Systemcalls
MISC_CPUSTARTCORE,
/** cpu_spr_value() */
MISC_CPUSPRVALUE,
/** cpu_spr_set() */
MISC_CPUSPRSET,
/** cpu_nap() - Hidden syscall */
MISC_CPUNAP,
/** cpu_master_winkle() */
Expand Down
7 changes: 7 additions & 0 deletions src/include/sys/misc.h
Expand Up @@ -202,6 +202,13 @@ enum CpuSprNames
*/
uint64_t cpu_spr_value(CpuSprNames spr);

/** @fn cpu_spr_set
* @brief Writes an SPR.
*
* @return rc: true = success, false = unsupported SPR.
*/
uint64_t cpu_spr_set(CpuSprNames spr, uint64_t newValue );

/** @fn cpu_master_winkle
* @brief Winkle the master core so runtime SLW image can be applied.
*
Expand Down
1 change: 1 addition & 0 deletions src/include/usr/isteps/istep_reasoncodes.H
Expand Up @@ -125,6 +125,7 @@ namespace ISTEP
RC_RETURNED_FFDC = ISTEP_COMP_ID | 0x34,
RC_P9N_DD1_NOT_SUPPORTED = ISTEP_COMP_ID | 0x35,
RC_PREVENT_REBOOT_IN_MFG_TERM_MODE = ISTEP_COMP_ID | 0x36,
RC_FAILED_WRITE_SPR = ISTEP_COMP_ID | 0x37,
};

};
Expand Down
22 changes: 22 additions & 0 deletions src/kernel/syscall.C
Expand Up @@ -119,6 +119,7 @@ namespace Systemcalls
void CpuDDLevel(task_t *t);
void CpuStartCore(task_t *t);
void CpuSprValue(task_t *t);
void CpuSprSet(task_t *t);
void CpuNap(task_t *t);
void CpuWinkle(task_t *t);
void MmAllocBlock(task_t *t);
Expand Down Expand Up @@ -160,6 +161,7 @@ namespace Systemcalls
&CpuDDLevel, // MISC_CPUDDLEVEL
&CpuStartCore, // MISC_CPUSTARTCORE
&CpuSprValue, // MISC_CPUSPRVALUE
&CpuSprSet, // MISC_CPUSPRSET
&CpuNap, // MISC_CPUNAP
&CpuWinkle, // MISC_CPUWINKLE

Expand Down Expand Up @@ -745,6 +747,26 @@ namespace Systemcalls
}
};

/** Set SPR values. */
void CpuSprSet(task_t *t)
{
uint64_t spr = TASK_GETARG0(t);
uint64_t newValue = TASK_GETARG1(t);

switch (spr)
{
case CPU_SPR_HID:
setHID( newValue );
TASK_SETRTN(t, true);
break;

default:
// unsupported SPR for write
TASK_SETRTN(t, false);
break;
}
};

/**
* Allow a task to request privilege escalation to execute the 'nap'
* instruction.
Expand Down
8 changes: 8 additions & 0 deletions src/lib/syscall_misc.C
Expand Up @@ -93,6 +93,14 @@ uint64_t cpu_spr_value(CpuSprNames spr)
_syscall1(MISC_CPUSPRVALUE, reinterpret_cast<void*>(spr)));
}

uint64_t cpu_spr_set(CpuSprNames spr, uint64_t newValue)
{
return reinterpret_cast<uint64_t>(
_syscall2( MISC_CPUSPRSET,
reinterpret_cast<void*>(spr),
reinterpret_cast<void*>(newValue) ));
}

int cpu_master_winkle(bool i_fusedCores)
{
task_affinity_pin();
Expand Down
51 changes: 51 additions & 0 deletions src/usr/isteps/istep21/call_host_start_payload.C
Expand Up @@ -50,6 +50,7 @@
#include <fapi2/target.H>
#include <fapi2/plat_hwp_invoker.H>
#include <p9_cpu_special_wakeup.H>
#include <p9n2_quad_scom_addresses_fld.H>
#include <ipmi/ipmiwatchdog.H>
#include <config.h>
#include <errno.h>
Expand Down Expand Up @@ -466,6 +467,56 @@ errlHndl_t callShutdown ( uint64_t i_masterInstance,
}
}

if ( is_sapphire_load() )
{
// opal load, Set the ATTN enable bit in the HID register
uint64_t l_enblAttnMask =
0x8000000000000000ull >> P9N2_C_HID_EN_ATTN;

uint64_t l_curHidVal = cpu_spr_value( CPU_SPR_HID );
uint64_t l_newHidVal = l_curHidVal | l_enblAttnMask;

uint64_t rc = cpu_spr_set( CPU_SPR_HID, l_newHidVal);

if ( rc == false )
{
// Error writing the SPR or
// SPR is unsupported/restricted from being written
// We will create an error to be passed back.
// This will cause the istep to fail.
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
ERR_MRK"call_host_start_payload()::"
"callShutdown() -"
" Write of HID SPR failed" );

/*@
* @errortype
* @reasoncode RC_FAILED_WRITE_SPR
* @severity ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM
* @moduleid MOD_START_PAYLOAD_CALL_SHUTDOWN
* @userdata1 current value of HID
* @userdata2 write value attempted to HID
* @devdesc Write of HID SPR failed
* @custdesc A problem occurred during the IPL
* of the system.
*/
err =
new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM,
MOD_START_PAYLOAD_CALL_SHUTDOWN,
RC_FAILED_WRITE_SPR,
l_curHidVal,
l_newHidVal );

err->collectTrace(ISTEP_COMP_NAME);

break;
}
} // end opal load
else
{
// PHYP load, do not enable ATTN
}

// do the shutdown.
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"callShutdown finished, shutdown = 0x%x.",
Expand Down
1 change: 1 addition & 0 deletions src/usr/isteps/istep21/makefile
Expand Up @@ -25,6 +25,7 @@
ROOTPATH = ../../../..
MODULE = istep21

EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/common/include/
EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/pm/
EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/initfiles/
EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc/
Expand Down

0 comments on commit 3a88f18

Please sign in to comment.