[Skiboot] [PATCH 13/16] [PATCH 13/16] opencapi5: link training

Frederic Barrat fbarrat at linux.ibm.com
Wed Sep 8 23:19:28 AEST 2021



On 20/08/2021 11:45, Christophe Lombard wrote:
> Add elementary functions to handle a phb complete, fundamental and
> hot resets.
> For the time being, specific creset and hreset are not supported.
> 
> A complete fundamental reset is based on the following steps, in this
> order:
> - Place all bricks into Fence state
> - Disable BARs
> - Reset ODL to Power-on Values
> - Set the i2c reset pin in output mode
> - Initialize PHY Lanes
> - Deassert ODL reset
> - Clear the the i2c reset pin
> - Unfence bricks
> - Enable BARs
> - Enable ODL training mode
> 
> Link training is also set up.
> 
> Signed-off-by: Christophe Lombard <clombard at linux.vnet.ibm.com>
> ---
>   hw/pau.c                 | 536 +++++++++++++++++++++++++++++++++++++++
>   include/pau-regs.h       |   5 +
>   include/pau.h            |   2 +
>   include/xscom-p10-regs.h |  46 ++++
>   4 files changed, 589 insertions(+)
> 
> diff --git a/hw/pau.c b/hw/pau.c
> index 132ef565..63655118 100644
> --- a/hw/pau.c
> +++ b/hw/pau.c

> @@ -207,12 +225,14 @@ static struct pau *pau_create(struct dt_node *dn)
>   	assert(pau);
> 
>   	init_lock(&pau->lock);
> +	init_lock(&pau->procedure_state.lock);
> 
>   	pau->dt_node = dn;
>   	pau->index = dt_prop_get_u32(dn, "ibm,pau-index");
>   	pau->xscom_base = dt_get_address(dn, 0, NULL);
> 
>   	pau->chip_id = dt_get_chip_id(dn);
> +	pau->op_chiplet = dt_prop_get_u32(dn, "ibm,pau-chiplet");
>   	assert(get_chip(pau->chip_id));
> 
>   	pau->links = PAU_LINKS_OPENCAPI_PER_PAU;
> @@ -507,6 +527,458 @@ static void pau_opencapi_enable_bars(struct pau_dev *dev, bool enable)

> +
> +static int64_t pau_opencapi_assert_adapter_reset(struct pau_dev *dev)
> +{
> +	int64_t rc = OPAL_SUCCESS;
> +
> +	if (platform.ocapi->i2c_assert_reset)
> +		rc = platform.ocapi->i2c_assert_reset(dev->i2c_bus_id);
> +	else
> +		rc = OPAL_PARAMETER;


What about, for readability:
	int64_t rc = OPAL_PARAMETER;

	if (platform.ocapi->i2c_assert_reset)
		rc = platform.ocapi->i2c_assert_reset(dev->i2c_bus_id);

Same pattern in several places.


> +static enum OpalShpcLinkState pau_opencapi_get_link_width(uint64_t status)
> +{
> +	uint64_t tx_lanes, rx_lanes, state;
> +
> +	state = GETFIELD(P10_OB_ODL_STATUS_TRAINING_STATE, status);
> +	if (state != PAU_LINK_STATE_TRAINED)
> +		return OPAL_SHPC_LINK_DOWN;
> +
> +	rx_lanes = GETFIELD(P10_OB_ODL_STATUS_RX_TRAINED_LANES, status);
> +	tx_lanes = GETFIELD(P10_OB_ODL_STATUS_TX_TRAINED_LANES, status);
> +	if ((rx_lanes != 0xFF) || (tx_lanes != 0xFF))
> +		return OPAL_SHPC_LINK_UP_x4;
> +	else
> +		return OPAL_SHPC_LINK_UP_x8;
> +
> +	/* OpenCapi link widths x16 ? */


Not any time soon! And that function is the least of our worries if we 
ever aggregate two x8 links. I would just remove that comment

   Fred


More information about the Skiboot mailing list