[Skiboot] [PATCH] occ: hbrt: Change the OCC reset order

Shilpasri G Bhat shilpa.bhat at linux.vnet.ibm.com
Thu Oct 1 15:48:45 AEST 2015


Modify the OCC reset order such that master OCC is reset after the
slave OCCs are reset. In Tuleta/Alpine systems 'proc0' will always be
the master OCC, which has to be stopped last when FSP sends OCC_RESET
command to Opal.

Signed-off-by: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>
Reviewed-by: Shreyas B. Prabhu <shreyas at linux.vnet.ibm.com>
---
This fixes BZ 119718, SW289036

 core/hostservices.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 41 insertions(+), 8 deletions(-)

diff --git a/core/hostservices.c b/core/hostservices.c
index 815654d..f722bca 100644
--- a/core/hostservices.c
+++ b/core/hostservices.c
@@ -827,8 +827,8 @@ int host_services_occ_start(void)
 int host_services_occ_stop(void)
 {
 	struct proc_chip *chip;
-	int i, rc = 0, nr_chips=0;
-	uint64_t chipids[MAX_CHIPS];
+	int i, rc = 0, nr_chips = 0, nr_slaves = 0, nr_masters = 0;
+	uint64_t chips[MAX_CHIPS], *master_chip_ids, *slave_chip_ids;
 
 	prlog(PR_INFO, "HBRT: OCC Stop requested\n");
 
@@ -837,18 +837,51 @@ int host_services_occ_stop(void)
 		return -ENOENT;
 	}
 
+	/* Sort the chip ids in descending order to split the array to master
+	 * and slave chips instead of hardcoding proc0 and proc1 as master.
+	 */
 	for_each_chip(chip) {
-		chipids[nr_chips++] = chip->id;
+		uint64_t new_id = chip->id;
+
+		for (i = 0; i < nr_chips; i++)
+			if (new_id > chips[i]) {
+				uint64_t tmp;
+
+				tmp = chips[i];
+				chips[i] = new_id;
+				new_id = tmp;
+			}
+		chips[i] = new_id;
+		nr_chips++;
 	}
 
-	for (i = 0; i < nr_chips; i++)
+	chip = next_chip(NULL);
+	nr_masters = (chip->type == PROC_CHIP_P8_MURANO) ? 2 : 1;
+	nr_slaves = nr_chips - nr_masters;
+	slave_chip_ids = chips;
+	master_chip_ids = chips + nr_slaves;
+
+	for (i = 0; i < nr_slaves; i++)
 		prlog(PR_TRACE, "HBRT: Calling stopOCC() for %04llx ",
-		      chipids[i]);
+		      slave_chip_ids[i]);
+
+	if (!nr_slaves)
+		goto master;
+
+	/* Lets STOP all the slave OCC */
+	rc = hservice_runtime->stopOCCs(slave_chip_ids, nr_slaves);
+	prlog(PR_DEBUG, "HBRT: stopOCCs() slave rc  = %d\n", rc);
+
+master:
+	for (i = 0; i < nr_masters; i++)
+		prlog(PR_TRACE, "HBRT: Calling stopOCC() for %04llx ",
+				master_chip_ids[i]);
+
+	/* STOP the master OCC which is proc0 for Tuleta/Alpine systems */
+	rc = hservice_runtime->stopOCCs(master_chip_ids, nr_masters);
 
-	/* Lets STOP all OCC */
-	rc = hservice_runtime->stopOCCs(chipids, nr_chips);
 	hservice_mark();
-	prlog(PR_DEBUG, "HBRT: stopOCCs() rc  = %d\n", rc);
+	prlog(PR_DEBUG, "HBRT: stopOCCs() master rc  = %d\n", rc);
 	return rc;
 }
 
-- 
1.9.3



More information about the Skiboot mailing list