diff mbox series

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

Message ID 20190319060405.22264-3-mikey@neuling.org
State Superseded
Headers show
Series Initial "big cores" support for POWER9 | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (92a5c57a14e24a60c306a9106bd6415c03f1234d)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Michael Neuling March 19, 2019, 6:03 a.m. UTC
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

The TADA array is missing half of the secondary threads

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

Comments

Vaidyanathan Srinivasan March 22, 2019, 1:29 p.m. UTC | #1
* Michael Neuling <mikey@neuling.org> [2019-03-19 17:03:58]:

> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> The TADA array is missing half of the secondary threads
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Michael Neuling <mikey@neuling.org>

Tested-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>


> ---
>  hdata/pcia.c | 27 +++++++++++++++++++++------
>  1 file changed, 21 insertions(+), 6 deletions(-)
> 
> diff --git a/hdata/pcia.c b/hdata/pcia.c
> index 9b210e4dfb..7ba5a6e793 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;
> +		prlog(PR_INFO, "CORE[%i]: Thread %d PIR 0x%04x\n",
> +		      pcia_index(pcia), i, iserv[i]);

I have tested this workaround on a FW booted big-core machine where
the HDAT TADA array bug is present.  However, I have also verified
a fix from the HDAT team which actually provides the correct array.
They will roll-up the fix into hdat/hostboot.  In that case we can
drop this patch (workaround) from OPAL.

--Vaidy
diff mbox series

Patch

diff --git a/hdata/pcia.c b/hdata/pcia.c
index 9b210e4dfb..7ba5a6e793 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;
+		prlog(PR_INFO, "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);