uint32_t
getMPIDR(ArmSystem *arm_sys, ThreadContext *tc)
{
+ // Multiprocessor Affinity Register MPIDR from Cortex(tm)-A15 Technical
+ // Reference Manual
+ //
+ // bit 31 - Multi-processor extensions available
+ // bit 30 - Uni-processor system
+ // bit 24 - Multi-threaded cores
+ // bit 11-8 - Cluster ID
+ // bit 1-0 - CPU ID
+ //
+ // We deliberately extend both the Cluster ID and CPU ID fields to allow
+ // for simulation of larger systems
+ assert((0 <= tc->cpuId()) && (tc->cpuId() < 256));
+ assert((0 <= tc->socketId()) && (tc->socketId() < 65536));
if (arm_sys->multiProc) {
return 0x80000000 | // multiprocessor extensions available
- tc->cpuId();
+ tc->cpuId() | tc->socketId() << 8;
} else {
return 0x80000000 | // multiprocessor extensions available
0x40000000 | // in up system
- tc->cpuId();
+ tc->cpuId() | tc->socketId() << 8;
}
}
system = Param.System(Parent.any, "system object")
cpu_id = Param.Int(-1, "CPU identifier")
+ socket_id = Param.Unsigned(0, "Physical Socket identifier")
numThreads = Param.Unsigned(1, "number of HW thread contexts")
function_trace = Param.Bool(False, "Enable function trace")
}
BaseCPU::BaseCPU(Params *p, bool is_checker)
- : MemObject(p), instCnt(0), _cpuId(p->cpu_id),
+ : MemObject(p), instCnt(0), _cpuId(p->cpu_id), _socketId(p->socket_id),
_instMasterId(p->system->getMasterId(name() + ".inst")),
_dataMasterId(p->system->getMasterId(name() + ".data")),
_taskId(ContextSwitchTaskId::Unknown), _pid(Request::invldPid),
// add self to global list of CPUs
cpuList.push_back(this);
- DPRINTF(SyscallVerbose, "Constructing CPU with id %d\n", _cpuId);
+ DPRINTF(SyscallVerbose, "Constructing CPU with id %d, socket id %d\n",
+ _cpuId, _socketId);
if (numThreads > maxThreadsPerCPU)
maxThreadsPerCPU = numThreads;
// therefore no setCpuId() method is provided
int _cpuId;
+ /** Each cpu will have a socket ID that corresponds to its physical location
+ * in the system. This is usually used to bucket cpu cores under single DVFS
+ * domain. This information may also be required by the OS to identify the
+ * cpu core grouping (as in the case of ARM via MPIDR register)
+ */
+ const uint32_t _socketId;
+
/** instruction side request id that must be placed in all requests */
MasterID _instMasterId;
/** Reads this CPU's ID. */
int cpuId() const { return _cpuId; }
+ /** Reads this CPU's Socket ID. */
+ uint32_t socketId() const { return _socketId; }
+
/** Reads this CPU's unique data requestor ID */
MasterID dataMasterId() { return _dataMasterId; }
/** Reads this CPU's unique instruction requestor ID */
/** Read this CPU's ID. */
int cpuId() const { return cpu->cpuId(); }
+ /** Read this CPU's Socket ID. */
+ uint32_t socketId() const { return cpu->socketId(); }
+
/** Read this CPU's data requestor ID */
MasterID masterId() const { return cpu->dataMasterId(); }
BaseCPU *getCpuPtr() { return actualTC->getCpuPtr(); }
+ uint32_t socketId() const { return actualTC->socketId(); }
+
int cpuId() const { return actualTC->cpuId(); }
int contextId() const { return actualTC->contextId(); }
/** Reads this CPU's ID. */
int cpuId() const { return cpu->cpuId(); }
+ /** Reads this CPU's Socket ID. */
+ uint32_t socketId() const { return cpu->socketId(); }
+
int contextId() const { return thread->contextId(); }
void setContextId(int id) { thread->setContextId(id); }
/** Reads this CPU's ID. */
virtual int cpuId() const { return cpu->cpuId(); }
+ /** Reads this CPU's Socket ID. */
+ virtual uint32_t socketId() const { return cpu->socketId(); }
+
virtual int contextId() const { return thread->contextId(); }
virtual void setContextId(int id) { thread->setContextId(id); }
virtual int cpuId() const = 0;
+ virtual uint32_t socketId() const = 0;
+
virtual int threadId() const = 0;
virtual void setThreadId(int id) = 0;
int cpuId() const { return actualTC->cpuId(); }
+ uint32_t socketId() const { return actualTC->socketId(); }
+
int threadId() const { return actualTC->threadId(); }
void setThreadId(int id) { actualTC->setThreadId(id); }
int cpuId() const { return baseCpu->cpuId(); }
+ uint32_t socketId() const { return baseCpu->socketId(); }
+
int contextId() const { return _contextId; }
void setContextId(int id) { _contextId = id; }