diff mbox series

[v2] npu2-opencapi: Fix assert on link reset during init

Message ID 20180306171608.24853-1-fbarrat@linux.vnet.ibm.com
State Accepted
Headers show
Series [v2] npu2-opencapi: Fix assert on link reset during init | expand

Commit Message

Frederic Barrat March 6, 2018, 5:16 p.m. UTC
We don't support resetting an opencapi link yet.

Commit fe6d86b9 ("pci: Make fast reboot creset PHBs in parallel")
tries resetting any PHB whose slot defines a 'run_sm' callback. It
raises an assert when applied to an opencapi PHB, as 'run_sm' calls
the 'freset' callback, which is not yet defined for opencapi.

Fix it for now by removing the currently useless definition of
'run_sm' on the opencapi slot. It will print a message in the skiboot
log because the PHB cannot be reset, which is correct. It will all go
away when we add support for resetting an opencapi link.

Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
---
v2:
	add comment


 hw/npu2-opencapi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Andrew Donnellan March 6, 2018, 10:45 p.m. UTC | #1
Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>


On 07/03/18 04:16, Frederic Barrat wrote:
> We don't support resetting an opencapi link yet.
> 
> Commit fe6d86b9 ("pci: Make fast reboot creset PHBs in parallel")
> tries resetting any PHB whose slot defines a 'run_sm' callback. It
> raises an assert when applied to an opencapi PHB, as 'run_sm' calls
> the 'freset' callback, which is not yet defined for opencapi.
> 
> Fix it for now by removing the currently useless definition of
> 'run_sm' on the opencapi slot. It will print a message in the skiboot
> log because the PHB cannot be reset, which is correct. It will all go
> away when we add support for resetting an opencapi link.
> 
> Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
> ---
> v2:
> 	add comment
> 
> 
>   hw/npu2-opencapi.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c
> index d8c2714f..135accab 100644
> --- a/hw/npu2-opencapi.c
> +++ b/hw/npu2-opencapi.c
> @@ -898,6 +898,15 @@ static struct pci_slot *npu2_opencapi_slot_create(struct phb *phb)
>   	slot->ops.get_latch_state     = NULL;
>   	slot->ops.set_power_state     = NULL;
>   	slot->ops.set_attention_state = NULL;
> +	/*
> +	 * Temporarily erase the run_sm callback until we support
> +	 * dynamic reset of the link. Otherwise, run_sm may call
> +	 * freset, creset, ... and we don't define them. The run_sm
> +	 * pointer is always tested before being called, at least at
> +	 * the time of this writing :-) It will go away when we
> +	 * implement dynamic reset of the link
> +	 */
> +	slot->ops.run_sm = NULL;
> 
>   	return slot;
>   }
>
Stewart Smith March 7, 2018, 3:38 a.m. UTC | #2
Frederic Barrat <fbarrat@linux.vnet.ibm.com> writes:
> We don't support resetting an opencapi link yet.
>
> Commit fe6d86b9 ("pci: Make fast reboot creset PHBs in parallel")
> tries resetting any PHB whose slot defines a 'run_sm' callback. It
> raises an assert when applied to an opencapi PHB, as 'run_sm' calls
> the 'freset' callback, which is not yet defined for opencapi.
>
> Fix it for now by removing the currently useless definition of
> 'run_sm' on the opencapi slot. It will print a message in the skiboot
> log because the PHB cannot be reset, which is correct. It will all go
> away when we add support for resetting an opencapi link.
>
> Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
> ---
> v2:
> 	add comment
>
>
>  hw/npu2-opencapi.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Thanks, merged to master as of 48dd5f7b9fbba52f08cd991d3443748dd810a99b
diff mbox series

Patch

diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c
index d8c2714f..135accab 100644
--- a/hw/npu2-opencapi.c
+++ b/hw/npu2-opencapi.c
@@ -898,6 +898,15 @@  static struct pci_slot *npu2_opencapi_slot_create(struct phb *phb)
 	slot->ops.get_latch_state     = NULL;
 	slot->ops.set_power_state     = NULL;
 	slot->ops.set_attention_state = NULL;
+	/*
+	 * Temporarily erase the run_sm callback until we support
+	 * dynamic reset of the link. Otherwise, run_sm may call
+	 * freset, creset, ... and we don't define them. The run_sm
+	 * pointer is always tested before being called, at least at
+	 * the time of this writing :-) It will go away when we
+	 * implement dynamic reset of the link
+	 */
+	slot->ops.run_sm = NULL;
 
 	return slot;
 }