diff mbox

[3/3] hw/occ: Add occ functional state DT property and set chip->occ_functional properly.

Message ID 1479099220-1787-1-git-send-email-ppaidipe@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

ppaidipe Nov. 14, 2016, 4:53 a.m. UTC
From: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>

ibm,occ-functional-state property exist only on ibm,fsp systems. Add this property
for non-fsp systems also and set chip->occ_functional data field accordingly.

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 data field to true when OPAL find's the
valid homer region and corresponding occ_valid byte is set to 0x1.

Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
---
 hw/occ.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

Comments

Stewart Smith Dec. 21, 2016, 4:56 a.m. UTC | #1
ppaidipe@linux.vnet.ibm.com writes:

> From: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
>
> ibm,occ-functional-state property exist only on ibm,fsp systems. Add this property
> for non-fsp systems also and set chip->occ_functional data field accordingly.
>
> 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 data field to true when OPAL find's the
> valid homer region and corresponding occ_valid byte is set to 0x1.
>
> Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
> ---
>  hw/occ.c | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)

Squashed with previous patch, fixed up some indentation and commit
message things and merged to master as of
3cd459766a01c1cb8334f18e93a1c8eddfc6829c
diff mbox

Patch

diff --git a/hw/occ.c b/hw/occ.c
index d5c590b..194be98 100644
--- a/hw/occ.c
+++ b/hw/occ.c
@@ -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;
@@ -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;
@@ -149,6 +144,11 @@  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);
@@ -156,6 +156,14 @@  static bool wait_for_all_occ_init(void)
 	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;
 }