[PATCH 3/3] powernv/pci: Add a debugfs entry to dump PHB's IODA PE state

Alexey Kardashevskiy aik at ozlabs.ru
Mon Sep 23 18:10:25 AEST 2019



On 12/09/2019 15:29, Oliver O'Halloran wrote:
> Add a debugfs entry to dump the state of the active IODA PEs. The IODA PE
> state reflects how the PHB's internal concept of a PE is configured. This
> is separate to the EEH PE state and is managed power the PowerNV PCI
> backend rather than the EEH core.
> 
> Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
> ---
>  arch/powerpc/platforms/powernv/pci-ioda.c | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> index f684d3a..941902b 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -3061,6 +3061,33 @@ static int pnv_pci_diag_data_set(void *data, u64 val)
>  DEFINE_SIMPLE_ATTRIBUTE(pnv_pci_diag_data_fops, NULL,
>  			pnv_pci_diag_data_set, "%llu\n");
>  
> +static int pnv_pci_ioda_pe_dump(void *data, u64 val)
> +{
> +	struct pnv_phb *phb = data;
> +	int pe_num;
> +
> +	for (pe_num = 0; pe_num < phb->ioda.total_pe_num; pe_num++) {
> +		struct pnv_ioda_pe *pe = &phb->ioda.pe_array[pe_num];
> +
> +		if (!test_bit(pe_num, phb->ioda.pe_alloc))
> +			continue;
> +
> +		pe_warn(pe, "rid: %04x dev count: %2d flags: %s%s%s%s%s%s\n",
> +			pe->rid, pe->device_count,
> +			(pe->flags & PNV_IODA_PE_DEV) ? "dev " : "",
> +			(pe->flags & PNV_IODA_PE_BUS) ? "bus " : "",
> +			(pe->flags & PNV_IODA_PE_BUS_ALL) ? "all " : "",
> +			(pe->flags & PNV_IODA_PE_MASTER) ? "master " : "",
> +			(pe->flags & PNV_IODA_PE_SLAVE) ? "slave " : "",
> +			(pe->flags & PNV_IODA_PE_VF) ? "vf " : "");


Printing raw flags value would hurt imho, just in case (we add some
later and forget about debugfs? memory corruption?). Or not :)


Reviewed-by: Alexey Kardashevskiy <aik at ozlabs.ru>




> +	}
> +
> +	return 0;
> +}
> +
> +DEFINE_SIMPLE_ATTRIBUTE(pnv_pci_ioda_pe_dump_fops, NULL,
> +			pnv_pci_ioda_pe_dump, "%llu\n");
> +
>  #endif /* CONFIG_DEBUG_FS */
>  
>  static void pnv_pci_ioda_create_dbgfs(void)
> @@ -3086,6 +3113,8 @@ static void pnv_pci_ioda_create_dbgfs(void)
>  
>  		debugfs_create_file("dump_diag_regs", 0200, phb->dbgfs, phb,
>  				    &pnv_pci_diag_data_fops);
> +		debugfs_create_file("dump_ioda_pe_state", 0200, phb->dbgfs, phb,
> +				    &pnv_pci_ioda_pe_dump_fops);
>  	}
>  #endif /* CONFIG_DEBUG_FS */
>  }
> 

-- 
Alexey


More information about the Linuxppc-dev mailing list