* [PATCH kernel] powerpc/powernv/idoa: Remove unnecessary pcidev from pci_dn
@ 2017-10-23 8:07 Alexey Kardashevskiy
2017-11-22 2:48 ` Alexey Kardashevskiy
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Alexey Kardashevskiy @ 2017-10-23 8:07 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Alexey Kardashevskiy, Benjamin Herrenschmidt, Russell Currey
The pcidev value stored in pci_dn is only used for NPU/NPU2
initialization. We can easily drop the cached pointer and
use an ancient helper - pci_get_domain_bus_and_slot() instead in order
to reduce complexity.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
arch/powerpc/include/asm/pci-bridge.h | 2 --
arch/powerpc/platforms/powernv/npu-dma.c | 5 ++++-
arch/powerpc/platforms/powernv/pci-ioda.c | 3 ---
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 0b8aa1fe2d5f..752718a2949d 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -197,8 +197,6 @@ struct pci_dn {
struct iommu_table_group *table_group; /* for phb's or bridges */
int pci_ext_config_space; /* for pci devices */
-
- struct pci_dev *pcidev; /* back-pointer to the pci device */
#ifdef CONFIG_EEH
struct eeh_dev *edev; /* eeh device */
#endif
diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c
index 2cb6cbea4b3b..b5844a950852 100644
--- a/arch/powerpc/platforms/powernv/npu-dma.c
+++ b/arch/powerpc/platforms/powernv/npu-dma.c
@@ -39,7 +39,10 @@
*/
static struct pci_dev *get_pci_dev(struct device_node *dn)
{
- return PCI_DN(dn)->pcidev;
+ struct pci_dn *pdn = PCI_DN(dn);
+
+ return pci_get_domain_bus_and_slot(pci_domain_nr(pdn->phb->bus),
+ pdn->busno, pdn->devfn);
}
/* Given a NPU device get the associated PCI device. */
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index bc60faa9f6c2..269f119e4b3c 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1047,7 +1047,6 @@ static struct pnv_ioda_pe *pnv_ioda_setup_dev_PE(struct pci_dev *dev)
* At some point we want to remove the PDN completely anyways
*/
pci_dev_get(dev);
- pdn->pcidev = dev;
pdn->pe_number = pe->pe_number;
pe->flags = PNV_IODA_PE_DEV;
pe->pdev = dev;
@@ -1094,7 +1093,6 @@ static void pnv_ioda_setup_same_PE(struct pci_bus *bus, struct pnv_ioda_pe *pe)
continue;
pe->device_count++;
- pdn->pcidev = dev;
pdn->pe_number = pe->pe_number;
if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate)
pnv_ioda_setup_same_PE(dev->subordinate, pe);
@@ -1209,7 +1207,6 @@ static struct pnv_ioda_pe *pnv_ioda_setup_npu_PE(struct pci_dev *npu_pdev)
pci_dev_get(npu_pdev);
npu_pdn = pci_get_pdn(npu_pdev);
rid = npu_pdev->bus->number << 8 | npu_pdn->devfn;
- npu_pdn->pcidev = npu_pdev;
npu_pdn->pe_number = pe_num;
phb->ioda.pe_rmap[rid] = pe->pe_number;
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH kernel] powerpc/powernv/idoa: Remove unnecessary pcidev from pci_dn
2017-10-23 8:07 [PATCH kernel] powerpc/powernv/idoa: Remove unnecessary pcidev from pci_dn Alexey Kardashevskiy
@ 2017-11-22 2:48 ` Alexey Kardashevskiy
2017-11-22 4:26 ` Russell Currey
2018-01-29 4:13 ` [kernel] " Michael Ellerman
2 siblings, 0 replies; 4+ messages in thread
From: Alexey Kardashevskiy @ 2017-11-22 2:48 UTC (permalink / raw)
To: linuxppc-dev
On 23/10/17 19:07, Alexey Kardashevskiy wrote:
> The pcidev value stored in pci_dn is only used for NPU/NPU2
> initialization. We can easily drop the cached pointer and
> use an ancient helper - pci_get_domain_bus_and_slot() instead in order
> to reduce complexity.
Ping?
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> arch/powerpc/include/asm/pci-bridge.h | 2 --
> arch/powerpc/platforms/powernv/npu-dma.c | 5 ++++-
> arch/powerpc/platforms/powernv/pci-ioda.c | 3 ---
> 3 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
> index 0b8aa1fe2d5f..752718a2949d 100644
> --- a/arch/powerpc/include/asm/pci-bridge.h
> +++ b/arch/powerpc/include/asm/pci-bridge.h
> @@ -197,8 +197,6 @@ struct pci_dn {
> struct iommu_table_group *table_group; /* for phb's or bridges */
>
> int pci_ext_config_space; /* for pci devices */
> -
> - struct pci_dev *pcidev; /* back-pointer to the pci device */
> #ifdef CONFIG_EEH
> struct eeh_dev *edev; /* eeh device */
> #endif
> diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c
> index 2cb6cbea4b3b..b5844a950852 100644
> --- a/arch/powerpc/platforms/powernv/npu-dma.c
> +++ b/arch/powerpc/platforms/powernv/npu-dma.c
> @@ -39,7 +39,10 @@
> */
> static struct pci_dev *get_pci_dev(struct device_node *dn)
> {
> - return PCI_DN(dn)->pcidev;
> + struct pci_dn *pdn = PCI_DN(dn);
> +
> + return pci_get_domain_bus_and_slot(pci_domain_nr(pdn->phb->bus),
> + pdn->busno, pdn->devfn);
> }
>
> /* Given a NPU device get the associated PCI device. */
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> index bc60faa9f6c2..269f119e4b3c 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -1047,7 +1047,6 @@ static struct pnv_ioda_pe *pnv_ioda_setup_dev_PE(struct pci_dev *dev)
> * At some point we want to remove the PDN completely anyways
> */
> pci_dev_get(dev);
> - pdn->pcidev = dev;
> pdn->pe_number = pe->pe_number;
> pe->flags = PNV_IODA_PE_DEV;
> pe->pdev = dev;
> @@ -1094,7 +1093,6 @@ static void pnv_ioda_setup_same_PE(struct pci_bus *bus, struct pnv_ioda_pe *pe)
> continue;
>
> pe->device_count++;
> - pdn->pcidev = dev;
> pdn->pe_number = pe->pe_number;
> if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate)
> pnv_ioda_setup_same_PE(dev->subordinate, pe);
> @@ -1209,7 +1207,6 @@ static struct pnv_ioda_pe *pnv_ioda_setup_npu_PE(struct pci_dev *npu_pdev)
> pci_dev_get(npu_pdev);
> npu_pdn = pci_get_pdn(npu_pdev);
> rid = npu_pdev->bus->number << 8 | npu_pdn->devfn;
> - npu_pdn->pcidev = npu_pdev;
> npu_pdn->pe_number = pe_num;
> phb->ioda.pe_rmap[rid] = pe->pe_number;
>
>
--
Alexey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH kernel] powerpc/powernv/idoa: Remove unnecessary pcidev from pci_dn
2017-10-23 8:07 [PATCH kernel] powerpc/powernv/idoa: Remove unnecessary pcidev from pci_dn Alexey Kardashevskiy
2017-11-22 2:48 ` Alexey Kardashevskiy
@ 2017-11-22 4:26 ` Russell Currey
2018-01-29 4:13 ` [kernel] " Michael Ellerman
2 siblings, 0 replies; 4+ messages in thread
From: Russell Currey @ 2017-11-22 4:26 UTC (permalink / raw)
To: Alexey Kardashevskiy, linuxppc-dev
On Mon, 2017-10-23 at 19:07 +1100, Alexey Kardashevskiy wrote:
> The pcidev value stored in pci_dn is only used for NPU/NPU2
> initialization. We can easily drop the cached pointer and
> use an ancient helper - pci_get_domain_bus_and_slot() instead in
> order
> to reduce complexity.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
My bad, must have missed this one. Thanks for the cleanup.
s/idoa/ioda in the title.
Acked-by: Russell Currey <ruscur@russell.cc>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [kernel] powerpc/powernv/idoa: Remove unnecessary pcidev from pci_dn
2017-10-23 8:07 [PATCH kernel] powerpc/powernv/idoa: Remove unnecessary pcidev from pci_dn Alexey Kardashevskiy
2017-11-22 2:48 ` Alexey Kardashevskiy
2017-11-22 4:26 ` Russell Currey
@ 2018-01-29 4:13 ` Michael Ellerman
2 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2018-01-29 4:13 UTC (permalink / raw)
To: Alexey Kardashevskiy, linuxppc-dev; +Cc: Alexey Kardashevskiy
On Mon, 2017-10-23 at 08:07:02 UTC, Alexey Kardashevskiy wrote:
> The pcidev value stored in pci_dn is only used for NPU/NPU2
> initialization. We can easily drop the cached pointer and
> use an ancient helper - pci_get_domain_bus_and_slot() instead in order
> to reduce complexity.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> Acked-by: Russell Currey <ruscur@russell.cc>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/902bdc57451c2c64aa139bbe24067f
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-29 4:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-23 8:07 [PATCH kernel] powerpc/powernv/idoa: Remove unnecessary pcidev from pci_dn Alexey Kardashevskiy
2017-11-22 2:48 ` Alexey Kardashevskiy
2017-11-22 4:26 ` Russell Currey
2018-01-29 4:13 ` [kernel] " Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).