Skip to content

Commit

Permalink
Use PROC_MIRROR_BASES_ACK attribute in memory mirroring addr calculation
Browse files Browse the repository at this point in the history
  - There was a situation where the memory behind a proc was valid,
    but there was no valid mirrored memory

  - Using PROC_MIRROR_BASES_ACK in the address calculation
    fixes that problem

Change-Id: Id7a134300f728d28cffeb62d9440c2301536d9ea
CQ: SW436374
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/61834
Reviewed-by: Dean Sanner <dsanner@us.ibm.com>
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@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: William G. Hoffa <wghoffa@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/61925
  • Loading branch information
wghoffa committed Jul 6, 2018
1 parent 34e69d2 commit ea5c84f
Showing 1 changed file with 61 additions and 6 deletions.
67 changes: 61 additions & 6 deletions src/usr/isteps/istep14/call_proc_exit_cache_contained.C
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,68 @@ void* call_proc_exit_cache_contained (void *io_pArgs)
ATTR_MIRROR_BASE_ADDRESS_type l_mirrorBaseAddr = 0;
if(!is_sapphire_load())
{
//First get the Base Memory Mirroring Address
l_mirrorBaseAddr =
l_sys->getAttr<TARGETING::ATTR_MIRROR_BASE_ADDRESS>();
//Get all the proc chips
TARGETING::TargetHandleList l_cpuTargetList;
getAllChips(l_cpuTargetList, TYPE_PROC);

//Iterate through the proc chips, finding the smallest valid
// mirrored memory address
uint64_t l_mirrorSmallestAddr = 0;
for (const auto & l_cpu_target: l_cpuTargetList)
{
//Get the acknowledged memory mirror sizes attribute
// If this is 0, we should not consider this mirror region
uint64_t mirrorSizesAck[sizeof(fapi2::ATTR_PROC_MIRROR_SIZES_ACK_Type)/sizeof(uint64_t)];
bool rc = (l_cpu_target)->
tryGetAttr<TARGETING::ATTR_PROC_MIRROR_SIZES_ACK>(mirrorSizesAck);
if(false == rc)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"Failed to get ATTR_PROC_MIRROR_SIZES_ACK");
assert(0);
}

//Get the acknowledged memory mirror bases attribute
uint64_t mirrorBasesAck[sizeof(fapi2::ATTR_PROC_MIRROR_BASES_ACK_Type)/sizeof(uint64_t)];
rc = (l_cpu_target)->
tryGetAttr<TARGETING::ATTR_PROC_MIRROR_BASES_ACK>(mirrorBasesAck);
if(false == rc)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"Failed to get ATTR_PROC_MIRROR_BASES_ACK");
assert(0);
}

assert ((sizeof(fapi2::ATTR_PROC_MIRROR_SIZES_ACK_Type) ==
sizeof(fapi2::ATTR_PROC_MIRROR_BASES_ACK_Type)),
"sizeof(ATTRPROC_MIRROR_SIZES_ACK) != sizeof(ATTR_PROC_MIRROR_BASES_ACK)");

//Add on the current HRMOR value being used
l_mirrorBaseAddr += (cpu_spr_value(CPU_SPR_HRMOR)
- VMM_HRMOR_OFFSET);
//Loop through each mirror region looking for the lowest
// valid memory value
for (uint8_t i=0;
i < sizeof(fapi2::ATTR_PROC_MIRROR_BASES_ACK_Type)/sizeof(uint64_t);
i++)
{
if (mirrorSizesAck[i] == 0)
{
//Mirrored memory region has a size of 0, do not consider
continue;
}

//Save the smallest address for later use
if (l_mirrorSmallestAddr == 0)
{
l_mirrorSmallestAddr = mirrorBasesAck[i];
}
else if (mirrorBasesAck[i] < l_mirrorBaseAddr &&
mirrorBasesAck[i] != 0)
{
l_mirrorSmallestAddr = mirrorBasesAck[i];
}
}
}
//Set the mirrored addr to the lowest valid memory value found
l_mirrorBaseAddr = l_mirrorSmallestAddr;
}

// Verify there is memory at the mirrored location
Expand Down

0 comments on commit ea5c84f

Please sign in to comment.