[Skiboot] [PATCH v3 05/10] npu2-opencapi: Configure NPU for OpenCAPI

Frederic Barrat fbarrat at linux.vnet.ibm.com
Thu Feb 1 05:39:13 AEDT 2018



Le 31/01/2018 à 10:34, Andrew Donnellan a écrit :
> Scan the device tree for NPUs with OpenCAPI links and configure the NPU per
> the initialisation sequence in the NPU OpenCAPI workbook.
> 
> Training of individual links and setup of per-AFU/link configuration will
> be in a later patch.
> 
> Signed-off-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>
> Signed-off-by: Frederic Barrat <fbarrat at linux.vnet.ibm.com>
> 
> ---

This looks ok. One very minor nit below about a comment, definitely not 
worth a respin.

Reviewed-by: Frederic Barrat <fbarrat at linux.vnet.ibm.com>



> diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c
> new file mode 100644
> index 0000000..a66c8f7
> --- /dev/null
> +++ b/hw/npu2-opencapi.c

[ snip ]

> +/* Procedure 13.1.3.5 - TL Configuration */
> +static void tl_config(uint32_t gcid, uint32_t scom_base, uint64_t index)
> +{
> +	uint64_t reg;
> +	uint64_t stack = index_to_stack(index);
> +	uint64_t block = index_to_block(index);
> +
> +	prlog(PR_DEBUG, "OCAPI: %s: TL Configuration\n", __func__);
> +	/* OTL Config 0 Register */
> +	reg = 0;
> +	/* OTL Enable */
> +	reg |= NPU2_OTL_CONFIG0_EN;
> +	/* Block PE Handle from ERAT Index */
> +	reg |= NPU2_OTL_CONFIG0_BLOCK_PE_HANDLE;
> +	/* OTL Brick ID */
> +	reg = SETFIELD(NPU2_OTL_CONFIG0_BRICKID, reg, index - 2);
> +	/* ERAT Hash 0 */
> +	reg = SETFIELD(NPU2_OTL_CONFIG0_ERAT_HASH_0, reg, 0b011001);
> +	/* ERAT Hash 1 */
> +	reg = SETFIELD(NPU2_OTL_CONFIG0_ERAT_HASH_1, reg, 0b000111);
> +	/* ERAT Hash 2 */
> +	reg = SETFIELD(NPU2_OTL_CONFIG0_ERAT_HASH_2, reg, 0b101100);
> +	/* ERAT Hash 3 */
> +	reg = SETFIELD(NPU2_OTL_CONFIG0_ERAT_HASH_3, reg, 0b100110);
> +	npu2_scom_write(gcid, scom_base, NPU2_OTL_CONFIG0(stack, block),
> +			NPU2_MISC_DA_LEN_8B, reg);
> +
> +	/* OTL Config 1 Register */
> +	reg = 0;
> +	/*
> +	 * We leave Template 1-3 bits at 0 to force template 0 as required
> +	 * for unknown devices.
> +	 *
> +	 * Template 0 Transmit Rate is set to most conservative setting which
> +	 * will always be supported. Other Template Transmit rates are left
> +	 * unset and will be set later by OS.
> +	 */
> +	reg = SETFIELD(NPU2_OTL_CONFIG1_TX_TEMP0_RATE, reg, 0b1111);
> +	/* Extra wait cycles TXI-TXO - varied from workbook */
> +	reg = SETFIELD(NPU2_OTL_CONFIG1_TX_DRDY_WAIT, reg, 0b001);

The latest NPU workbook (0.16) was updated to reflect this. So code 
above is correct, and the "varied from workbook" comment could be dropped.

   Fred



More information about the Skiboot mailing list