[PATCH v2] powerpc/imc: Dont create debugfs files for cpu-less nodes

Michael Ellerman mpe at ellerman.id.au
Thu Jul 11 14:53:14 AEST 2019


Hi Maddy,

Madhavan Srinivasan <maddy at linux.vnet.ibm.com> writes:
> diff --git a/arch/powerpc/platforms/powernv/opal-imc.c b/arch/powerpc/platforms/powernv/opal-imc.c
> index 186109bdd41b..e04b20625cb9 100644
> --- a/arch/powerpc/platforms/powernv/opal-imc.c
> +++ b/arch/powerpc/platforms/powernv/opal-imc.c
> @@ -69,20 +69,20 @@ static void export_imc_mode_and_cmd(struct device_node *node,
>  	if (of_property_read_u32(node, "cb_offset", &cb_offset))
>  		cb_offset = IMC_CNTL_BLK_OFFSET;
>  
> -	for_each_node(nid) {
> -		loc = (u64)(pmu_ptr->mem_info[chip].vbase) + cb_offset;
> +	while (ptr->vbase != NULL) {

This means you'll bail out as soon as you find a node with no vbase, but
it's possible we could have a CPU-less node intermingled with other
nodes.

So I think you want to keep the for loop, but continue if you see a NULL
vbase?


> +		loc = (u64)(ptr->vbase) + cb_offset;
>  		imc_mode_addr = (u64 *)(loc + IMC_CNTL_BLK_MODE_OFFSET);
> -		sprintf(mode, "imc_mode_%d", nid);
> +		sprintf(mode, "imc_mode_%d", (u32)(ptr->id));
>  		if (!imc_debugfs_create_x64(mode, 0600, imc_debugfs_parent,
>  					    imc_mode_addr))
>  			goto err;
>  
>  		imc_cmd_addr = (u64 *)(loc + IMC_CNTL_BLK_CMD_OFFSET);
> -		sprintf(cmd, "imc_cmd_%d", nid);
> +		sprintf(cmd, "imc_cmd_%d", (u32)(ptr->id));
>  		if (!imc_debugfs_create_x64(cmd, 0600, imc_debugfs_parent,
>  					    imc_cmd_addr))
>  			goto err;
> -		chip++;
> +		ptr++;
>  	}
>  	return;

cheers


More information about the Linuxppc-dev mailing list