Skip to content

Commit

Permalink
Always set ibm,occ-functional-state correctly
Browse files Browse the repository at this point in the history
Currently chip->occ_functional data field set's to true always whether
ibm,occ-functional-state property exists or not.

ibm,occ-functional-state property of xscom node's are populated only in
ibm,fsp systems by detecting the OCC state in OPAL/SPIRA. In
non-fsp(i.e OpenPower) systems this property is not populating. But OPAL
sets chip->occ_functional field incorrectly to true without acually knowing
the occ state.

OCC Spec says:
When OCC is told to go active it will populate OCC-OPAL shared memory
interface with ‘valid’ and all Pstate data.

So incase of OpenPower systems OPAL can add DT property
ibm,occ-functional-state and set the chip->occ_functional when OPAL finds
the valid homer region and corresponding occ_valid byte is set to 0x1.

Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
[stewart@linux.vnet.ibm.com: squash commits, tweak commit message]
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
pridhiviraj authored and stewartsmith committed Dec 21, 2016
1 parent 4c2f2fc commit 3cd4597
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void init_chips(void)
0xffffffff);
chip->pcid = dt_prop_get_u32_def(xn, "ibm,proc-chip-id",
0xffffffff);
if (dt_prop_get_u32_def(xn, "ibm,occ-functional-state", 1))
if (dt_prop_get_u32_def(xn, "ibm,occ-functional-state", 0))
chip->occ_functional = true;
else
chip->occ_functional = false;
Expand Down
19 changes: 13 additions & 6 deletions hw/occ.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ DEFINE_LOG_ENTRY(OPAL_RC_OCC_TIMEOUT, OPAL_PLATFORM_ERR_EVT, OPAL_OCC,
static bool wait_for_all_occ_init(void)
{
struct proc_chip *chip;
struct dt_node *xn;
uint64_t occ_data_area;
struct occ_pstate_table *occ_data;
int tries;
Expand Down Expand Up @@ -115,12 +116,6 @@ static bool wait_for_all_occ_init(void)
return false;
}

if (!chip->occ_functional) {
prlog(PR_WARNING, "OCC: Chip: %x occ not functional\n",
chip->id);
continue;
}

/* Get PState table address */
occ_data_area = chip->homer_base + P8_HOMER_SAPPHIRE_DATA_OFFSET;
occ_data = (struct occ_pstate_table *)occ_data_area;
Expand Down Expand Up @@ -149,13 +144,25 @@ static bool wait_for_all_occ_init(void)
chip->id);
return false;
}

if (!chip->occ_functional)
chip->occ_functional = true;

prlog(PR_DEBUG, "OCC: Chip %02x Data (%016llx) = %016llx\n",
chip->id, occ_data_area,
*(uint64_t *)occ_data_area);
}
end_time = mftb();
prlog(PR_NOTICE, "OCC: All Chip Rdy after %lu ms\n",
tb_to_msecs(end_time - start_time));

dt_for_each_compatible(dt_root, xn, "ibm,xscom") {
const struct dt_property *p;
p = dt_find_property(xn, "ibm,occ-functional-state");
if (!p)
dt_add_property_cells(xn, "ibm,occ-functional-state",
0x1);
}
return true;
}

Expand Down

0 comments on commit 3cd4597

Please sign in to comment.