[Skiboot] [RFC PATCH skiboot] npu2: Remove redundand dt_node

Andrew Donnellan andrew.donnellan at au1.ibm.com
Thu Aug 16 00:38:47 AEST 2018


On 15/08/18 18:25, Alexey Kardashevskiy wrote:
> The npu2 struct embeds a phb struct which also has a DT node pointer,
> use that.
> 
> Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>

We don't initialise npu->phb_nvlink when the NPU is set up in OpenCAPI 
mode so this won't work.


Andrew

> ---
> 
> On witherspoon it is just always NULL.
> ---
>   include/npu2.h     | 1 -
>   hw/npu2-opencapi.c | 6 +++---
>   2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/include/npu2.h b/include/npu2.h
> index 4c2e20e..34bc650 100644
> --- a/include/npu2.h
> +++ b/include/npu2.h
> @@ -142,7 +142,6 @@ struct npu2_dev {
>   
>   struct npu2 {
>   	uint32_t	index;
> -	struct dt_node	*dt_node;
>   	uint32_t	chip_id;
>   	uint64_t	xscom_base;
>   	void		*regs;
> diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c
> index 57c2f2f..e55bdcb 100644
> --- a/hw/npu2-opencapi.c
> +++ b/hw/npu2-opencapi.c
> @@ -1584,7 +1584,7 @@ static void npu2_opencapi_setup_device(struct dt_node *dn_link, struct npu2 *n,
>   	uint64_t mm_win[2];
>   
>   	dev_index = dt_prop_get_u32(dn_link, "ibm,npu-link-index");
> -	npu_index = dt_prop_get_u32(n->dt_node, "ibm,npu-index");
> +	npu_index = dt_prop_get_u32(n->phb_nvlink.dt_node, "ibm,npu-index");
>   
>   	/* Populate PHB device node */
>   	phys_map_get(n->chip_id, NPU_OCAPI_MMIO, dev_index, &mm_win[0],
> @@ -1610,7 +1610,8 @@ static void npu2_opencapi_setup_device(struct dt_node *dn_link, struct npu2 *n,
>   	dt_add_property_cells(dn_phb, "ibm,npu-index", npu_index);
>   	dt_add_property_cells(dn_phb, "ibm,chip-id", n->chip_id);
>   	dt_add_property_cells(dn_phb, "ibm,xscom-base", n->xscom_base);
> -	dt_add_property_cells(dn_phb, "ibm,npcq", n->dt_node->phandle);
> +	dt_add_property_cells(dn_phb, "ibm,npcq",
> +			      n->phb_nvlink.dt_node->phandle);
>   	dt_add_property_cells(dn_phb, "ibm,links", 1);
>   	dt_add_property(dn_phb, "ibm,mmio-window", mm_win, sizeof(mm_win));
>   	dt_add_property_cells(dn_phb, "ibm,phb-diag-data-size", 0);
> @@ -1730,7 +1731,6 @@ static void npu2_opencapi_probe(struct dt_node *dn)
>   	n->chip_id = gcid;
>   	n->xscom_base = scom_base;
>   	n->regs = (void *)reg[0];
> -	n->dt_node = dn;
>   
>   	dt_for_each_compatible(dn, link, "ibm,npu-link") {
>   		dev_index = dt_prop_get_u32(link, "ibm,npu-link-index");
> 

-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com  IBM Australia Limited



More information about the Skiboot mailing list