[Skiboot] [RFC 07/12] npu2-opencapi: Detect PHY reset errors

Andrew Donnellan ajd at linux.ibm.com
Fri Jun 21 13:49:28 AEST 2019


On 19/6/19 10:45 pm, Frederic Barrat wrote:
> PHY reset can fail! Though past problems are now fixed, let's handle
> any future failure.
> 
> Signed-off-by: Frederic Barrat <fbarrat at linux.ibm.com>

Looks good

Reviewed-by: Andrew Donnellan <ajd at linux.ibm.com>

> ---
>   hw/npu2-hw-procedures.c | 13 ++++++++++---
>   hw/npu2-opencapi.c      |  5 ++++-
>   include/npu2.h          |  2 +-
>   3 files changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/npu2-hw-procedures.c b/hw/npu2-hw-procedures.c
> index 98e93191..e9501f12 100644
> --- a/hw/npu2-hw-procedures.c
> +++ b/hw/npu2-hw-procedures.c
> @@ -1049,10 +1049,17 @@ void npu2_opencapi_phy_init(struct npu2_dev *dev)
>   	}
>   }
>   
> -void npu2_opencapi_phy_reset(struct npu2_dev *dev)
> +int npu2_opencapi_phy_reset(struct npu2_dev *dev)
>   {
> -	run_procedure(dev, 4); /* procedure_phy_reset */
> -	run_procedure(dev, 6); /* procedure_phy_rx_dccal */
> +	int rc;
> +
> +	rc = run_procedure(dev, 4); /* procedure_phy_reset */
> +	if (rc != PROCEDURE_COMPLETE)
> +		return -1;
> +	rc = run_procedure(dev, 6); /* procedure_phy_rx_dccal */
> +	if (rc != PROCEDURE_COMPLETE)
> +		return -1;
> +	return 0;
>   }
>   
>   void npu2_opencapi_phy_prbs31(struct npu2_dev *dev)
> diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c
> index 1328ee93..153f2c6f 100644
> --- a/hw/npu2-opencapi.c
> +++ b/hw/npu2-opencapi.c
> @@ -1200,6 +1200,7 @@ static int64_t npu2_opencapi_freset(struct pci_slot *slot)
>   	struct npu2_dev *dev = phb_to_npu2_dev_ocapi(slot->phb);
>   	uint32_t chip_id = dev->npu->chip_id;
>   	uint8_t presence = 1;
> +	int rc;
>   
>   	switch (slot->state) {
>   	case OCAPI_SLOT_NORMAL:
> @@ -1229,7 +1230,9 @@ static int64_t npu2_opencapi_freset(struct pci_slot *slot)
>   		return pci_slot_set_sm_timeout(slot, msecs_to_tb(5));
>   
>   	case OCAPI_SLOT_FRESET_ASSERT_DELAY:
> -		npu2_opencapi_phy_reset(dev);
> +		rc = npu2_opencapi_phy_reset(dev);
> +		if (rc)
> +			return OPAL_HARDWARE;
>   		deassert_odl_reset(chip_id, dev->brick_index);
>   		deassert_adapter_reset(dev);
>   		pci_slot_set_state(slot,
> diff --git a/include/npu2.h b/include/npu2.h
> index 6aead6cb..4648464b 100644
> --- a/include/npu2.h
> +++ b/include/npu2.h
> @@ -247,7 +247,7 @@ void npu2_clear_link_flag(struct npu2_dev *ndev, uint8_t flag);
>   uint32_t reset_ntl(struct npu2_dev *ndev);
>   extern int nv_zcal_nominal;
>   void npu2_opencapi_phy_init(struct npu2_dev *dev);
> -void npu2_opencapi_phy_reset(struct npu2_dev *dev);
> +int npu2_opencapi_phy_reset(struct npu2_dev *dev);
>   void npu2_opencapi_phy_prbs31(struct npu2_dev *dev);
>   void npu2_opencapi_bump_ui_lane(struct npu2_dev *dev);
>   int64_t npu2_freeze_status(struct phb *phb __unused,
> 

-- 
Andrew Donnellan              OzLabs, ADL Canberra
ajd at linux.ibm.com             IBM Australia Limited



More information about the Skiboot mailing list