arch-arm: Rewrite getMPIDR
This patch is rewriting getMPIDR to have a more canonical form: * Using threadId() instead of contextId() It is also splitting the helper so that a client can get an affinity number given a specific thread context. Change-Id: I727e4b96ada345fd548cd3ff9423bf27347812c4 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26304 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Ciro Santilli <ciro.santilli@arm.com> Tested-by: kokoro <noreply+kokoro@google.com> Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
This commit is contained in:
committed by
Giacomo Travaglini
parent
25f139555d
commit
8cfa988335
@@ -263,18 +263,42 @@ getMPIDR(ArmSystem *arm_sys, ThreadContext *tc)
|
||||
// for simulation of larger systems
|
||||
assert((0 <= tc->cpuId()) && (tc->cpuId() < 256));
|
||||
assert(tc->socketId() < 65536);
|
||||
if (arm_sys->multiThread) {
|
||||
return 0x80000000 | // multiprocessor extensions available
|
||||
0x01000000 | // multi-threaded cores
|
||||
tc->contextId();
|
||||
} else if (arm_sys->multiProc) {
|
||||
return 0x80000000 | // multiprocessor extensions available
|
||||
tc->cpuId() | tc->socketId() << 8;
|
||||
} else {
|
||||
return 0x80000000 | // multiprocessor extensions available
|
||||
0x40000000 | // in up system
|
||||
tc->cpuId() | tc->socketId() << 8;
|
||||
}
|
||||
|
||||
RegVal mpidr = 0x80000000;
|
||||
|
||||
if (!arm_sys->multiProc)
|
||||
replaceBits(mpidr, 30, 1);
|
||||
|
||||
if (arm_sys->multiThread)
|
||||
replaceBits(mpidr, 24, 1);
|
||||
|
||||
// Get Affinity numbers
|
||||
mpidr |= getAffinity(arm_sys, tc);
|
||||
return mpidr;
|
||||
}
|
||||
|
||||
static RegVal
|
||||
getAff2(ArmSystem *arm_sys, ThreadContext *tc)
|
||||
{
|
||||
return arm_sys->multiThread ? tc->socketId() << 16 : 0;
|
||||
}
|
||||
|
||||
static RegVal
|
||||
getAff1(ArmSystem *arm_sys, ThreadContext *tc)
|
||||
{
|
||||
return arm_sys->multiThread ? tc->cpuId() << 8 : tc->socketId() << 8;
|
||||
}
|
||||
|
||||
static RegVal
|
||||
getAff0(ArmSystem *arm_sys, ThreadContext *tc)
|
||||
{
|
||||
return arm_sys->multiThread ? tc->threadId() : tc->cpuId();
|
||||
}
|
||||
|
||||
RegVal
|
||||
getAffinity(ArmSystem *arm_sys, ThreadContext *tc)
|
||||
{
|
||||
return getAff2(arm_sys, tc) | getAff1(arm_sys, tc) | getAff0(arm_sys, tc);
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -256,9 +256,12 @@ bool longDescFormatInUse(ThreadContext *tc);
|
||||
* to VMPIDR_EL2 (as it happens in virtualized systems) */
|
||||
RegVal readMPIDR(ArmSystem *arm_sys, ThreadContext *tc);
|
||||
|
||||
/** This helper function is returing the value of MPIDR_EL1 */
|
||||
/** This helper function is returning the value of MPIDR_EL1 */
|
||||
RegVal getMPIDR(ArmSystem *arm_sys, ThreadContext *tc);
|
||||
|
||||
/** Retrieves MPIDR_EL1.{Aff2,Aff1,Aff0} affinity numbers */
|
||||
RegVal getAffinity(ArmSystem *arm_sys, ThreadContext *tc);
|
||||
|
||||
static inline uint32_t
|
||||
mcrMrcIssBuild(bool isRead, uint32_t crm, IntRegIndex rt, uint32_t crn,
|
||||
uint32_t opc1, uint32_t opc2)
|
||||
|
||||
Reference in New Issue
Block a user