Skip to content

Commit

Permalink
Tie tm-suspend fw-feature and opal_reinit_cpus() together
Browse files Browse the repository at this point in the history
Currently opal_reinit_cpus(OPAL_REINIT_CPUS_TM_SUSPEND_DISABLED)
always returns OPAL_UNSUPPORTED.

This ties the tm suspend fw-feature to the
opal_reinit_cpus(OPAL_REINIT_CPUS_TM_SUSPEND_DISABLED) so that when tm
suspend is disabled, we correctly report it to the kernel.  For
backwards compatibility, it's assumed tm suspend is available if the
fw-feature is not present.

Currently hostboot will clear fw-feature(TM_SUSPEND_ENABLED) on P9N
DD2.1. P9N DD2.2 will set fw-feature(TM_SUSPEND_ENABLED).  DD2.0 and
below has TM disabled completely (not just suspend).

We are using opal_reinit_cpus() to determine this setting (rather than
the device tree/HDAT) as some future firmware may let us change this
dynamically after boot. That is not the case currently though.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Reviewed-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
mikey authored and stewartsmith committed Mar 5, 2018
1 parent 785b35d commit 730bccb
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions core/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ static bool ipi_enabled;
static bool pm_enabled;
static bool current_hile_mode;
static bool current_radix_mode;
static bool tm_suspend_enabled;

unsigned long cpu_secondary_start __force_data = 0;

Expand Down Expand Up @@ -1012,6 +1013,21 @@ static int find_dec_bits(void)
return bits;
}

static void init_tm_suspend_mode_property(void)
{
struct dt_node *node;

/* If we don't find anything, assume TM suspend is enabled */
tm_suspend_enabled = true;

node = dt_find_by_path(dt_root, "/ibm,opal/fw-features/tm-suspend-mode");
if (!node)
return;

if (dt_find_property(node, "disabled"))
tm_suspend_enabled = false;
}

void init_all_cpus(void)
{
struct dt_node *cpus, *cpu;
Expand All @@ -1021,6 +1037,8 @@ void init_all_cpus(void)
cpus = dt_find_by_path(dt_root, "/cpus");
assert(cpus);

init_tm_suspend_mode_property();

/* Iterate all CPUs in the device-tree */
dt_for_each_child(cpus, cpu) {
unsigned int pir, server_no, chip_id;
Expand Down Expand Up @@ -1436,11 +1454,10 @@ static int64_t opal_reinit_cpus(uint64_t flags)
if (flags & OPAL_REINIT_CPUS_TM_SUSPEND_DISABLED) {
flags &= ~OPAL_REINIT_CPUS_TM_SUSPEND_DISABLED;

/*
* Pending a hostboot change we can't determine the status of
* this, so it always fails.
*/
rc = OPAL_UNSUPPORTED;
if (tm_suspend_enabled)
rc = OPAL_UNSUPPORTED;
else
rc = OPAL_SUCCESS;
}

/* Handle P8 DD1 SLW reinit */
Expand Down

0 comments on commit 730bccb

Please sign in to comment.