summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2012-05-16 12:51:22 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-07-16 19:05:48 -0500
commit3bba9a3ff18b6991bba4247898f4c26fa944a676 (patch)
treeda3462c53eaf0670670b37f094c17444f1ce5c4c /src/include
parent2aa5e0afac73384aaabe1fe1529898601be1155f (diff)
downloadblackbird-hostboot-3bba9a3ff18b6991bba4247898f4c26fa944a676.tar.gz
blackbird-hostboot-3bba9a3ff18b6991bba4247898f4c26fa944a676.zip
Support for core_activate via IPI.
RTC: 37009 Change-Id: I56669805c86d9659a20ad7c26e5e9860c7a248c7 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1087 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/arch/ppc.H6
-rw-r--r--src/include/kernel/cpu.H3
-rw-r--r--src/include/kernel/cpumgr.H15
-rw-r--r--src/include/kernel/syscalls.H2
-rw-r--r--src/include/kernel/timemgr.H56
-rw-r--r--src/include/sys/misc.h17
-rw-r--r--src/include/sys/vfs.h4
-rw-r--r--src/include/usr/hwpf/istepreasoncodes.H2
-rw-r--r--src/include/usr/intr/interrupt.H9
-rw-r--r--src/include/util/impl/stlmap.H2
10 files changed, 80 insertions, 36 deletions
diff --git a/src/include/arch/ppc.H b/src/include/arch/ppc.H
index 5d2e51a7b..7807b5743 100644
--- a/src/include/arch/ppc.H
+++ b/src/include/arch/ppc.H
@@ -324,6 +324,12 @@ inline void MAGIC_INSTRUCTION(int _n)
enum
{
+ MAGIC_SIMICS_CORESTATESAVE = 10, // Indicate to the PHYP model of simics
+ // that we are preparing to wake up a core
+ // or thread. This allows them to save
+ // some state from the core doing the
+ // wakeup to apply into the woken one.
+
MAGIC_SHUTDOWN = 7006, // KernelMisc::shutdown() called.
MAGIC_BREAK = 7007, // hard-code a breakpoint
MAGIC_CONTINUOUS_TRACE = 7055, // extract mixed trace buffer
diff --git a/src/include/kernel/cpu.H b/src/include/kernel/cpu.H
index b6fe66ef2..e395b2920 100644
--- a/src/include/kernel/cpu.H
+++ b/src/include/kernel/cpu.H
@@ -75,6 +75,9 @@ struct cpu_t
*/
void* scheduler_extra;
+ /** Location for task delay-list, managed by TimeManager. */
+ void* delay_list;
+
/** Pointer to the idle task for this CPU */
task_t* idle_task;
diff --git a/src/include/kernel/cpumgr.H b/src/include/kernel/cpumgr.H
index e4d2b8b0b..d7bc2da78 100644
--- a/src/include/kernel/cpumgr.H
+++ b/src/include/kernel/cpumgr.H
@@ -36,7 +36,7 @@ class CpuManager
{
MAXCPUS = KERNEL_MAX_SUPPORTED_CPUS,
CPU_PERIODIC_CHECK_MEMORY = 128, // Is this even needed anymore?
- CPU_PERIODIC_FLUSH_PAGETABLE = 256,
+ CPU_PERIODIC_FLUSH_PAGETABLE = 256,
CPU_PERIODIC_DEFRAG = 949, // TODO Any bigger not currently hit
};
@@ -44,7 +44,7 @@ class CpuManager
* Returns a pointer to the current CPU structure by using the
* task structure in SPRG3.
*/
- static cpu_t* getCurrentCPU();
+ static cpu_t* getCurrentCPU() { return cv_cpus[getPIR()]; }
static cpu_t* getCpu(size_t i) { return cv_cpus[i]; }
/** @brief Return pointer to master CPU object.
@@ -87,6 +87,13 @@ class CpuManager
*/
static size_t getCpuCount() { return cv_cpuCount; }
+ /** @fn startCore
+ * Create structures to support a core activating and start the core.
+ *
+ * @param[in] pir - PIR value of first thread in core.
+ */
+ static int startCore(uint64_t pir);
+
/** @fn forceMemoryPeriodic()
* Force the memory free / coalesce operations to be performed on the
@@ -105,8 +112,10 @@ class CpuManager
void startCPU(ssize_t i = -1);
void startSlaveCPU(cpu_t*);
+ static size_t getThreadCount();
+
private:
- static cpu_t* cv_cpus[MAXCPUS]; // Need to be able to access this
+ static cpu_t** cv_cpus; // Need to be able to access this
// from start.S to get initial stacks
// of secondary cpus / threads.
diff --git a/src/include/kernel/syscalls.H b/src/include/kernel/syscalls.H
index a46fde703..0a0d5dba5 100644
--- a/src/include/kernel/syscalls.H
+++ b/src/include/kernel/syscalls.H
@@ -88,6 +88,8 @@ namespace Systemcalls
MISC_CPUCORETYPE,
/** cpu_dd_level() */
MISC_CPUDDLEVEL,
+ /** cpu_start_core() */
+ MISC_CPUSTARTCORE,
/** mm_alloc_block() */
MM_ALLOC_BLOCK,
diff --git a/src/include/kernel/timemgr.H b/src/include/kernel/timemgr.H
index 0590dedff..96950b928 100644
--- a/src/include/kernel/timemgr.H
+++ b/src/include/kernel/timemgr.H
@@ -47,28 +47,32 @@ struct _TimeManager_Delay_t
class TimeManager
{
public:
- enum
- {
+ enum
+ {
/** Number of time-slices to allow per second.
*
* Context length becomes (1/TIMESLICE_PER_SECOND) sec.
*/
- TIMESLICE_PER_SEC = 1000,
- };
+ TIMESLICE_PER_SEC = 1000,
+ };
/** Initialize the time subsystem. */
- static void init();
+ static void init();
+
+ /** Initialize the task-delay structures for a CPU. */
+ static void init_cpu(cpu_t* cpu);
+
/** Return the number of ticks per time-slice. */
- static uint64_t getTimeSliceCount()
- {
- return iv_timebaseFreq / TIMESLICE_PER_SEC;
- };
+ static uint64_t getTimeSliceCount()
+ {
+ return iv_timebaseFreq / TIMESLICE_PER_SEC;
+ };
/** Returns the value of the processor timebase register. */
- static uint64_t getCurrentTimeBase()
- {
- return getTB();
- };
+ static uint64_t getCurrentTimeBase()
+ {
+ return getTB();
+ };
/** Converts seconds/nsecs to timebase ticks.
*
@@ -80,7 +84,7 @@ class TimeManager
*
* @return Number of timebase ticks.
*/
- static uint64_t convertSecToTicks(uint64_t i_sec, uint64_t i_nsec);
+ static uint64_t convertSecToTicks(uint64_t i_sec, uint64_t i_nsec);
/** Converts timebase ticks to seconds/nsecs.
*
* @param[in] i_ticks - Number of ticks.
@@ -96,23 +100,27 @@ class TimeManager
* @param[in] i_sec - Seconds.
* @param[in] i_nsec - Nsecs.
*/
- static void delayTask(task_t* t, uint64_t i_sec, uint64_t i_nsec);
+ static void delayTask(task_t* t, uint64_t i_sec, uint64_t i_nsec);
/** Checks the sleep queue to determine if any tasks should be woken. */
- static void checkReleaseTasks(Scheduler* s);
+ static void checkReleaseTasks(Scheduler* s);
protected:
- TimeManager() {};
- ~TimeManager() {};
+ TimeManager() {};
+ ~TimeManager() {};
private:
- void _init();
- void _delayTask(task_t* t, uint64_t i_sec, uint64_t i_nsec);
- void _checkReleaseTasks(Scheduler* s);
- Util::Locked::PQueue<_TimeManager_Delay_t, uint64_t>
- iv_taskList[KERNEL_MAX_SUPPORTED_CPUS];
+ typedef Util::Locked::PQueue<_TimeManager_Delay_t, uint64_t>
+ delaylist_t;
+
+ void _init();
+ void _init_cpu(cpu_t* cpu);
+ void _delayTask(task_t* t, uint64_t i_sec, uint64_t i_nsec);
+ void _checkReleaseTasks(Scheduler* s);
+ inline delaylist_t* _get_delaylist();
+
/** Frequency of the timebase register in Hz. (ticks per second) */
- static uint64_t iv_timebaseFreq;
+ static uint64_t iv_timebaseFreq;
};
#endif
diff --git a/src/include/sys/misc.h b/src/include/sys/misc.h
index fcf88f08a..90ff57964 100644
--- a/src/include/sys/misc.h
+++ b/src/include/sys/misc.h
@@ -92,11 +92,26 @@ ProcessorCoreType cpu_core_type();
uint8_t cpu_dd_level();
/** @fn cpu_thread_count()
- * @breif Get the number of threads per cpu for this proctype
+ * @brief Get the number of threads per cpu for this proctype
* @return # of threads per cpu
*/
size_t cpu_thread_count();
+/** @fn cpu_start_core
+ * @brief Have the kernel start a new core.
+ *
+ * @param[in] pir - PIR value of the first thread on the core.
+ *
+ * @note The kernel will start all threads on the requested core even
+ * though the callee only requests with a single PIR value.
+ *
+ * @return 0 or -(errno) on failure.
+ *
+ * @retval -ENXIO - The core ID was outside of the range the kernel is
+ * prepared to support.
+ */
+int cpu_start_core(uint64_t pir);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/include/sys/vfs.h b/src/include/sys/vfs.h
index 254a10350..b4b7da594 100644
--- a/src/include/sys/vfs.h
+++ b/src/include/sys/vfs.h
@@ -32,7 +32,7 @@
#endif
// make TODO VFS_MODULE_MAX equal to the actual number of modules in the base image (+ 2?)
-#define VFS_MODULE_MAX 64
+#define VFS_MODULE_MAX 16
// Extended use 4 4k pages
// Extended Module Virtual address at 1GB
#define VFS_EXTENDED_MODULE_VADDR (1 * 1024 * 1024 * 1024)
@@ -51,7 +51,7 @@
#define VFS_MODULE_DEFINE_START(f) \
extern "C" void VFS_SYMBOL_START(void* args) \
{ \
- f(args); \
+ f(args); \
}
#ifdef __cplusplus
diff --git a/src/include/usr/hwpf/istepreasoncodes.H b/src/include/usr/hwpf/istepreasoncodes.H
index fc44b2c87..c186e1e87 100644
--- a/src/include/usr/hwpf/istepreasoncodes.H
+++ b/src/include/usr/hwpf/istepreasoncodes.H
@@ -50,6 +50,7 @@ enum istepModuleId
ISTEP_STARTPAYLOAD_EXECUTE_UNIT_TESTS = 0x01,
ISTEP_START_PAYLOAD_CALL_SHUTDOWN = 0x02,
ISTEP_START_PAYLOAD_NOTIFY_FSP = 0x03,
+ ISTEP_ACTIVATE_SLAVE_CORES = 0x04,
};
/**
@@ -64,6 +65,7 @@ enum istepReasonCode
ISTEP_CXXTEST_FAILED_TEST = ISTEP_COMP_ID | 0x01,
ISTEP_TARGET_NULL = ISTEP_COMP_ID | 0x02,
ISTEP_MBOX_MSG_NULL = ISTEP_COMP_ID | 0x03,
+ ISTEP_BAD_RC = ISTEP_COMP_ID | 0x04,
};
}; // end ISTEP
diff --git a/src/include/usr/intr/interrupt.H b/src/include/usr/intr/interrupt.H
index 51fe950e0..751cedc07 100644
--- a/src/include/usr/intr/interrupt.H
+++ b/src/include/usr/intr/interrupt.H
@@ -60,11 +60,10 @@ namespace INTR
*/
enum msg_intr_types_t
{
- MSG_INTR_ADD_CPU_USR = 1, //!< Add cpu core, data[0] = cpuid (PIR)
- MSG_INTR_REGISTER_MSGQ, //!< Register a msgQ
- MSG_INTR_UNREGISTER_MSGQ, //!< Un register a msgQ
- MSG_INTR_ENABLE, //!< Enable external Interrupts
- MSG_INTR_DISABLE, //!< Disable external interrupts
+ MSG_INTR_REGISTER_MSGQ = 1, //!< Register a msgQ
+ MSG_INTR_UNREGISTER_MSGQ, //!< Un register a msgQ
+ MSG_INTR_ENABLE, //!< Enable external Interrupts
+ MSG_INTR_DISABLE, //!< Disable external interrupts
MSG_INTR_SHUTDOWN, //!< Call to shutdown interrupt presenter
};
diff --git a/src/include/util/impl/stlmap.H b/src/include/util/impl/stlmap.H
index 97379e861..08d293024 100644
--- a/src/include/util/impl/stlmap.H
+++ b/src/include/util/impl/stlmap.H
@@ -531,7 +531,7 @@ namespace Util
* This is a fairly straight-forward cast since no address
* translation is necessary.
*/
- const void** makeSplayTreeValue(const value_type& x)
+ const void** makeSplayTreeValue(const value_type& x) const
{
return reinterpret_cast<const void**>(
const_cast<value_type*>(&x));
OpenPOWER on IntegriCloud