diff -r 12e1b3452d01 -r 2a96108e9c98 src/arch/arm/utility.cc --- a/src/arch/arm/utility.cc Wed Apr 23 13:07:18 2014 +0100 +++ b/src/arch/arm/utility.cc Wed Apr 23 13:07:26 2014 +0100 @@ -195,13 +195,26 @@ 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; } } diff -r 12e1b3452d01 -r 2a96108e9c98 src/cpu/BaseCPU.py --- a/src/cpu/BaseCPU.py Wed Apr 23 13:07:18 2014 +0100 +++ b/src/cpu/BaseCPU.py Wed Apr 23 13:07:26 2014 +0100 @@ -128,6 +128,7 @@ 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") diff -r 12e1b3452d01 -r 2a96108e9c98 src/cpu/base.hh --- a/src/cpu/base.hh Wed Apr 23 13:07:18 2014 +0100 +++ b/src/cpu/base.hh Wed Apr 23 13:07:26 2014 +0100 @@ -101,6 +101,13 @@ // 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; @@ -145,6 +152,9 @@ /** 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 */ diff -r 12e1b3452d01 -r 2a96108e9c98 src/cpu/base.cc --- a/src/cpu/base.cc Wed Apr 23 13:07:18 2014 +0100 +++ b/src/cpu/base.cc Wed Apr 23 13:07:26 2014 +0100 @@ -117,7 +117,7 @@ } 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), @@ -133,7 +133,8 @@ // 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; diff -r 12e1b3452d01 -r 2a96108e9c98 src/cpu/base_dyn_inst.hh --- a/src/cpu/base_dyn_inst.hh Wed Apr 23 13:07:18 2014 +0100 +++ b/src/cpu/base_dyn_inst.hh Wed Apr 23 13:07:26 2014 +0100 @@ -456,6 +456,9 @@ /** 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(); } diff -r 12e1b3452d01 -r 2a96108e9c98 src/cpu/checker/thread_context.hh --- a/src/cpu/checker/thread_context.hh Wed Apr 23 13:07:18 2014 +0100 +++ b/src/cpu/checker/thread_context.hh Wed Apr 23 13:07:26 2014 +0100 @@ -92,6 +92,8 @@ BaseCPU *getCpuPtr() { return actualTC->getCpuPtr(); } + uint32_t socketId() const { return actualTC->socketId(); } + int cpuId() const { return actualTC->cpuId(); } int contextId() const { return actualTC->contextId(); } diff -r 12e1b3452d01 -r 2a96108e9c98 src/cpu/inorder/thread_context.hh --- a/src/cpu/inorder/thread_context.hh Wed Apr 23 13:07:18 2014 +0100 +++ b/src/cpu/inorder/thread_context.hh Wed Apr 23 13:07:26 2014 +0100 @@ -113,6 +113,9 @@ /** 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); } diff -r 12e1b3452d01 -r 2a96108e9c98 src/cpu/o3/thread_context.hh --- a/src/cpu/o3/thread_context.hh Wed Apr 23 13:07:18 2014 +0100 +++ b/src/cpu/o3/thread_context.hh Wed Apr 23 13:07:26 2014 +0100 @@ -98,6 +98,9 @@ /** 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); } diff -r 12e1b3452d01 -r 2a96108e9c98 src/cpu/thread_context.hh --- a/src/cpu/thread_context.hh Wed Apr 23 13:07:18 2014 +0100 +++ b/src/cpu/thread_context.hh Wed Apr 23 13:07:26 2014 +0100 @@ -123,6 +123,8 @@ virtual int cpuId() const = 0; + virtual uint32_t socketId() const = 0; + virtual int threadId() const = 0; virtual void setThreadId(int id) = 0; @@ -323,6 +325,8 @@ 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); } diff -r 12e1b3452d01 -r 2a96108e9c98 src/cpu/thread_state.hh --- a/src/cpu/thread_state.hh Wed Apr 23 13:07:18 2014 +0100 +++ b/src/cpu/thread_state.hh Wed Apr 23 13:07:26 2014 +0100 @@ -69,6 +69,8 @@ int cpuId() const { return baseCpu->cpuId(); } + uint32_t socketId() const { return baseCpu->socketId(); } + int contextId() const { return _contextId; } void setContextId(int id) { _contextId = id; }