diff mbox series

[v2] opal/hmi: Catch NPU2 HMIs for opencapi

Message ID 20180813094721.21548-1-fbarrat@linux.ibm.com
State Accepted
Headers show
Series [v2] opal/hmi: Catch NPU2 HMIs for opencapi | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/make_check success Test make_check on branch master

Commit Message

Frederic Barrat Aug. 13, 2018, 9:47 a.m. UTC
HMIs for NPU2 are filtered with the 'compatible' string of the PHB, so
add opencapi to the mix.

Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
---
Changelog:

v2:
	use boolean instead of dummy pointer when looking for PHB (Andrew)


core/hmi.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

Andrew Donnellan Aug. 13, 2018, 9:50 a.m. UTC | #1
On 13/08/18 19:47, Frederic Barrat wrote:
> HMIs for NPU2 are filtered with the 'compatible' string of the PHB, so
> add opencapi to the mix.
> 
> Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
> ---
> Changelog:
> 
> v2:
> 	use boolean instead of dummy pointer when looking for PHB (Andrew)

Thanks for fixing that.

Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

> 
> 
> core/hmi.c | 15 ++++++++++-----
>   1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/core/hmi.c b/core/hmi.c
> index e6fed405..1f665a2f 100644
> --- a/core/hmi.c
> +++ b/core/hmi.c
> @@ -639,14 +639,19 @@ static void dump_scoms(int flat_chip_id, const char *unit, uint32_t *scoms,
>   	}
>   }
>   
> +static bool phb_is_npu2(struct dt_node *dn)
> +{
> +	return (dt_node_is_compatible(dn, "ibm,power9-npu-pciex") ||
> +		dt_node_is_compatible(dn, "ibm,power9-npu-opencapi-pciex"));
> +}
> +
>   static void find_npu2_checkstop_reason(int flat_chip_id,
>   				      struct OpalHMIEvent *hmi_evt,
>   				      uint64_t *out_flags)
>   {
>   	struct phb *phb;
> -	struct npu *p = NULL;
>   	int i;
> -	bool npu2_hmi_verbose = false;
> +	bool npu2_hmi_verbose = false, found = false;
>   	uint64_t npu2_fir;
>   	uint64_t npu2_fir_mask;
>   	uint64_t npu2_fir_action0;
> @@ -662,15 +667,15 @@ static void find_npu2_checkstop_reason(int flat_chip_id,
>   	/* Find the NPU on the chip associated with the HMI. */
>   	for_each_phb(phb) {
>   		/* NOTE: if a chip ever has >1 NPU this will need adjusting */
> -		if (dt_node_is_compatible(phb->dt_node, "ibm,power9-npu-pciex") &&
> +		if (phb_is_npu2(phb->dt_node) &&
>   		    (dt_get_chip_id(phb->dt_node) == flat_chip_id)) {
> -			p = phb_to_npu(phb);
> +			found = true;
>   			break;
>   		}
>   	}
>   
>   	/* If we didn't find a NPU on the chip, it's not our checkstop. */
> -	if (p == NULL)
> +	if (!found)
>   		return;
>   
>   	npu2_fir_addr = NPU2_FIR_REGISTER_0;
>
Stewart Smith Aug. 15, 2018, 4:50 a.m. UTC | #2
Frederic Barrat <fbarrat@linux.ibm.com> writes:
> HMIs for NPU2 are filtered with the 'compatible' string of the PHB, so
> add opencapi to the mix.
>
> Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
> ---
> Changelog:
>
> v2:
> 	use boolean instead of dummy pointer when looking for PHB (Andrew)
>
>
> core/hmi.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)

Thanks, merged to master as of 2d339446fc774626bf7fde55cc67f3fdfedeb98a
diff mbox series

Patch

diff --git a/core/hmi.c b/core/hmi.c
index e6fed405..1f665a2f 100644
--- a/core/hmi.c
+++ b/core/hmi.c
@@ -639,14 +639,19 @@  static void dump_scoms(int flat_chip_id, const char *unit, uint32_t *scoms,
 	}
 }
 
+static bool phb_is_npu2(struct dt_node *dn)
+{
+	return (dt_node_is_compatible(dn, "ibm,power9-npu-pciex") ||
+		dt_node_is_compatible(dn, "ibm,power9-npu-opencapi-pciex"));
+}
+
 static void find_npu2_checkstop_reason(int flat_chip_id,
 				      struct OpalHMIEvent *hmi_evt,
 				      uint64_t *out_flags)
 {
 	struct phb *phb;
-	struct npu *p = NULL;
 	int i;
-	bool npu2_hmi_verbose = false;
+	bool npu2_hmi_verbose = false, found = false;
 	uint64_t npu2_fir;
 	uint64_t npu2_fir_mask;
 	uint64_t npu2_fir_action0;
@@ -662,15 +667,15 @@  static void find_npu2_checkstop_reason(int flat_chip_id,
 	/* Find the NPU on the chip associated with the HMI. */
 	for_each_phb(phb) {
 		/* NOTE: if a chip ever has >1 NPU this will need adjusting */
-		if (dt_node_is_compatible(phb->dt_node, "ibm,power9-npu-pciex") &&
+		if (phb_is_npu2(phb->dt_node) &&
 		    (dt_get_chip_id(phb->dt_node) == flat_chip_id)) {
-			p = phb_to_npu(phb);
+			found = true;
 			break;
 		}
 	}
 
 	/* If we didn't find a NPU on the chip, it's not our checkstop. */
-	if (p == NULL)
+	if (!found)
 		return;
 
 	npu2_fir_addr = NPU2_FIR_REGISTER_0;