[2/9] hdat: Workaround HostBoot bug with fused core

Message ID 20180927044849.28322-3-benh@kernel.crashing.org
State Under Review
Headers show
Series
  • Initial "big cores" support for POWER9
Related show

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied

Commit Message

Benjamin Herrenschmidt Sept. 27, 2018, 4:48 a.m.
The TADA array is missing half of the secondary threads

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 hdata/pcia.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

Patch

diff --git a/hdata/pcia.c b/hdata/pcia.c
index 9b210e4d..954c0491 100644
--- a/hdata/pcia.c
+++ b/hdata/pcia.c
@@ -103,7 +103,7 @@  static struct dt_node *add_core_node(struct dt_node *cpus,
 				     const struct sppcia_core_unique *id,
 				     bool okay)
 {
-	const struct sppcia_cpu_thread *t;
+	const struct sppcia_cpu_thread *t, *t0;
 	const struct sppcia_cpu_timebase *timebase;
 	const struct sppcia_cpu_cache *cache;
 	const struct sppcia_cpu_attr *attr;
@@ -172,12 +172,27 @@  static struct dt_node *add_core_node(struct dt_node *cpus,
 	/* Build ibm,ppc-interrupt-server#s with all threads */
 	for (i = 0; i < threads; i++) {
 		t = find_tada(pcia, i);
-		if (!t) {
-			threads = i;
-			break;
+		if (i == 0)
+			t0 = t;
+		if (t) {
+			iserv[i] = t->pir;
+		} else {
+			if (i > 0 && i < cpu_thread_count) {
+				prerror("CORE[%i]: HDAT TADA bug for"
+					" thread %d, working around"
+					" using 0x%04x...\n",
+					pcia_index(pcia),  i, t0->pir + i);
+				iserv[i] = t0->pir + i;
+			} else {
+				prerror("CORE[%i]: Failed to find TADA for"
+					" thread %d\n",
+					pcia_index(pcia),  i);
+				threads = i;
+				break;
+			}
 		}
-
-		iserv[i] = t->pir;
+		printf("CORE[%i]: Thread %d PIR 0x%04x\n",
+		       pcia_index(pcia), i, iserv[i]);
 	}
 
 	dt_add_property(cpu, "ibm,ppc-interrupt-server#s", iserv, 4 * threads);