diff mbox series

[Very,RFC,33/46] powernv/pci: Remove open-coded PE lookup in iommu notifier

Message ID 20191120012859.23300-34-oohall@gmail.com (mailing list archive)
State RFC
Headers show
Series [Very,RFC,01/46] powerpc/eeh: Don't attempt to restore VF config space after reset | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/merge (784eee1cc44801366d4f197e0ade7739ee8e1e83)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/next (0695f8bca93ea0c57f0e8e21b4b4db70183b3d1c)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linus/master (c74386d50fbaf4a54fd3fe560f1abc709c0cff4b)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/fixes (7d6475051fb3d9339c5c760ed9883bc0a9048b21)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linux-next (5d1131b4d61e52e5702e0fa4bcbec81ac7d6ef52)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Oliver O'Halloran Nov. 20, 2019, 1:28 a.m. UTC
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 arch/powerpc/platforms/powernv/pci.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Alexey Kardashevskiy Nov. 27, 2019, 5:09 a.m. UTC | #1
On 20/11/2019 12:28, Oliver O'Halloran wrote:
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> ---
>  arch/powerpc/platforms/powernv/pci.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
> index 5b1f4677cdce..0eeea8652426 100644
> --- a/arch/powerpc/platforms/powernv/pci.c
> +++ b/arch/powerpc/platforms/powernv/pci.c
> @@ -943,23 +943,22 @@ static int pnv_tce_iommu_bus_notifier(struct notifier_block *nb,
>  {
>  	struct device *dev = data;
>  	struct pci_dev *pdev;
> -	struct pci_dn *pdn;
>  	struct pnv_ioda_pe *pe;
>  	struct pnv_phb *phb;
>  
>  	switch (action) {
>  	case BUS_NOTIFY_ADD_DEVICE:
>  		pdev = to_pci_dev(dev);
> -		pdn = pci_get_pdn(pdev);
>  		phb = pci_bus_to_pnvhb(pdev->bus);
>  
>  		WARN_ON_ONCE(!phb);
> -		if (!pdn || pdn->pe_number == IODA_INVALID_PE || !phb)
> +		if (!phb)
>  			return 0;

This check is weird - the function does not use @phb anymore, it would
make more sense if pnv_ioda_get_pe() checked phb!=NULL.


>  
> -		pe = &phb->ioda.pe_array[pdn->pe_number];
> -		if (!pe->table_group.group)
> +		pe = pnv_ioda_get_pe(pdev);
> +		if (!pe || !pe->table_group.group)
>  			return 0;
> +
>  		iommu_add_device(&pe->table_group, dev);
>  		return 0;
>  	case BUS_NOTIFY_DEL_DEVICE:
>
diff mbox series

Patch

diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 5b1f4677cdce..0eeea8652426 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -943,23 +943,22 @@  static int pnv_tce_iommu_bus_notifier(struct notifier_block *nb,
 {
 	struct device *dev = data;
 	struct pci_dev *pdev;
-	struct pci_dn *pdn;
 	struct pnv_ioda_pe *pe;
 	struct pnv_phb *phb;
 
 	switch (action) {
 	case BUS_NOTIFY_ADD_DEVICE:
 		pdev = to_pci_dev(dev);
-		pdn = pci_get_pdn(pdev);
 		phb = pci_bus_to_pnvhb(pdev->bus);
 
 		WARN_ON_ONCE(!phb);
-		if (!pdn || pdn->pe_number == IODA_INVALID_PE || !phb)
+		if (!phb)
 			return 0;
 
-		pe = &phb->ioda.pe_array[pdn->pe_number];
-		if (!pe->table_group.group)
+		pe = pnv_ioda_get_pe(pdev);
+		if (!pe || !pe->table_group.group)
 			return 0;
+
 		iommu_add_device(&pe->table_group, dev);
 		return 0;
 	case BUS_NOTIFY_DEL_DEVICE: