sst: Don't always wake idle CPU
Some parts of SST are important (initial discovery, appliedConfig
change) and should use wake-on-PECI to ensure success even if the CPU is
in an idle PkgC state. Other parts are not important enough to justify
increasing the CPU power draw. Add a WakePolicy parameter to the
SSTInterface infrastructure to use a different policy in different
contexts.
Change-Id: I91435cc0357ab60ca4656e1bc51286e046ae3809
Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
diff --git a/src/sst_mailbox.cpp b/src/sst_mailbox.cpp
index 2627894..b086c55 100644
--- a/src/sst_mailbox.cpp
+++ b/src/sst_mailbox.cpp
@@ -38,9 +38,11 @@
bool peciWoken;
CPUModel cpuModel;
uint8_t mbBus;
+ WakePolicy wakePolicy;
- PECIManager(uint8_t address, CPUModel model) :
- peciAddress(address), peciWoken(false), cpuModel(model)
+ PECIManager(uint8_t address, CPUModel model, WakePolicy wakePolicy_) :
+ peciAddress(address), peciWoken(false), cpuModel(model),
+ wakePolicy(wakePolicy_)
{
mbBus = (model == icx) ? mbBusICX : mbBusOther;
}
@@ -120,7 +122,7 @@
void wrMailboxReg(uint16_t regAddress, uint32_t data)
{
uint8_t completionCode;
- bool tryWaking = true;
+ bool tryWaking = (wakePolicy == wakeAllowed);
while (true)
{
EPECIStatus libStatus = peci_WrEndPointPCIConfigLocal(
@@ -152,7 +154,7 @@
{
uint8_t completionCode;
uint32_t outputData;
- bool tryWaking = true;
+ bool tryWaking = (wakePolicy == wakeAllowed);
while (true)
{
EPECIStatus libStatus = peci_RdEndPointConfigPciLocal(
@@ -397,9 +399,9 @@
static constexpr int mhzPerRatio = 100;
public:
- SSTMailbox(uint8_t _address, CPUModel _model) :
+ SSTMailbox(uint8_t _address, CPUModel _model, WakePolicy wakePolicy) :
address(_address), model(_model),
- pm(static_cast<uint8_t>(address), model)
+ pm(static_cast<uint8_t>(address), model, wakePolicy)
{}
~SSTMailbox() {}
@@ -568,8 +570,8 @@
}
};
-static std::unique_ptr<SSTInterface> createMailbox(uint8_t address,
- CPUModel model)
+static std::unique_ptr<SSTInterface>
+ createMailbox(uint8_t address, CPUModel model, WakePolicy wakePolicy)
{
DEBUG_PRINT << "createMailbox\n";
switch (model)
@@ -578,7 +580,7 @@
case icxd:
case spr:
case emr:
- return std::make_unique<SSTMailbox>(address, model);
+ return std::make_unique<SSTMailbox>(address, model, wakePolicy);
default:
return nullptr;
}