Re: [PATCH v7 34/50] powerpc/pci: Delay populating pdn

2015-11-23 Thread Gavin Shan
On Wed, Nov 18, 2015 at 03:24:35PM +1100, Alexey Kardashevskiy wrote: >On 11/05/2015 12:12 AM, Gavin Shan wrote: >>The pdn (struct pci_dn) instances are allocated from memblock or >>bootmem when creating PCI controller (hoses) in setup_arch(). PCI >>hotplug, which will be su

Re: [PATCH v7 33/50] powerpc/pci: Export pci_traverse_device_nodes()

2015-11-23 Thread Gavin Shan
On Wed, Nov 18, 2015 at 02:14:59PM +1100, Alexey Kardashevskiy wrote: >On 11/05/2015 12:12 AM, Gavin Shan wrote: >>This renames traverse_pci_devices() to pci_traverse_device_nodes(). > >Why? pci_traverse_device_nodes() is not moved to some more generic header >where is would be

Re: [PATCH v7 50/50] PCI/hotplug: PowerPC PowerNV PCI hotplug driver

2015-11-23 Thread Gavin Shan
On Wed, Nov 18, 2015 at 06:33:08PM +1100, Alexey Kardashevskiy wrote: >On 11/05/2015 12:12 AM, Gavin Shan wrote: >>This adds standalone driver to support PCI hotplug for PowerPC PowerNV >>platform that runs on top of skiboot firmware. The firmware identifies >>hotpluggable s

Re: [PATCH v7 29/50] powerpc/pci: Rename pcibios_find_pci_bus()

2015-11-23 Thread Gavin Shan
On Wed, Nov 18, 2015 at 02:59:32PM +1100, Alexey Kardashevskiy wrote: >On 11/05/2015 12:12 AM, Gavin Shan wrote: >>This renames pcibios_find_pci_bus() to pci_find_bus_by_node() to >>avoid conflicts with those PCI subsystem weak function names, which >>have prefix "pc

Re: [PATCH v7 28/50] powerpc/pci: Rename pcibios_{add,remove}_pci_devices()

2015-11-23 Thread Gavin Shan
On Wed, Nov 18, 2015 at 01:43:06PM +1100, Alexey Kardashevskiy wrote: >On 11/05/2015 12:12 AM, Gavin Shan wrote: >>This renames pcibios_{add,remove}_pci_devices() to avoid conflicts >>with names of the weak functions in PCI subsystem, which have the >>prefix "pc

Re: [PATCH v7 27/50] powerpc/powernv: Dynamically release PEs

2015-11-23 Thread Gavin Shan
On Wed, Nov 18, 2015 at 01:23:05PM +1100, Alexey Kardashevskiy wrote: >On 11/05/2015 12:12 AM, Gavin Shan wrote: >>This adds a reference count of PE, representing the number of PCI >>devices associated with the PE. The reference count is increased >>or decreased when PCI devi

Re: [PATCH v7 12/50] powerpc/powernv: Track M64 segment consumption

2015-11-23 Thread Gavin Shan
On Thu, Nov 19, 2015 at 11:10:42AM +1100, Alexey Kardashevskiy wrote: >On 11/17/2015 12:04 PM, Gavin Shan wrote: >>On Mon, Nov 16, 2015 at 07:01:59PM +1100, Alexey Kardashevskiy wrote: >>>On 11/05/2015 12:12 AM, Gavin Shan wrote: >>>>As we track M32 segment consumptio

Re: [PATCH v7 14/50] powerpc/powernv: M64 support on P7IOC

2015-11-22 Thread Gavin Shan
On Thu, Nov 19, 2015 at 11:18:46AM +1100, Alexey Kardashevskiy wrote: >On 11/17/2015 12:37 PM, Gavin Shan wrote: >>On Mon, Nov 16, 2015 at 07:01:46PM +1100, Alexey Kardashevskiy wrote: >>>On 11/05/2015 12:12 AM, Gavin Shan wrote: >>>>This enables M64 window on P7IOC,

Re: [PATCH v7 23/50] powerpc/powernv: Use PE instead of number during setup and release

2015-11-22 Thread Gavin Shan
On Wed, Nov 18, 2015 at 11:13:55AM +1100, Alexey Kardashevskiy wrote: >On 11/17/2015 08:03 PM, Gavin Shan wrote: >>On Tue, Nov 17, 2015 at 04:08:30PM +1100, Alexey Kardashevskiy wrote: >>>On 11/05/2015 12:12 AM, Gavin Shan wrote: >>>>In current implementation, the PE

Re: [PATCH v7 26/50] powerpc/powernv: Create PEs at PCI hot plugging time

2015-11-17 Thread Gavin Shan
On Tue, Nov 17, 2015 at 06:57:20PM +1100, Alexey Kardashevskiy wrote: >On 11/05/2015 12:12 AM, Gavin Shan wrote: >>Currently, the PEs and their associated resources are assigned >>in ppc_md.pcibios_fixup() except those used by SRIOV VFs. The >>function is called for once

Re: [PATCH v7 25/50] powerpc/powernv: Reserve PE for root bus

2015-11-17 Thread Gavin Shan
On Tue, Nov 17, 2015 at 05:04:42PM +1100, Alexey Kardashevskiy wrote: >On 11/05/2015 12:12 AM, Gavin Shan wrote: >>We're going to reserve/assign PEs when pcibios_setup_bridge() is >>called. The function won't be called for root bus as it doesn't >>have parent

Re: [PATCH v7 23/50] powerpc/powernv: Use PE instead of number during setup and release

2015-11-17 Thread Gavin Shan
On Tue, Nov 17, 2015 at 04:08:30PM +1100, Alexey Kardashevskiy wrote: >On 11/05/2015 12:12 AM, Gavin Shan wrote: >>In current implementation, the PEs that are allocated or picked >>from the reserved list are identified by PE number. The PE instance >>has to be picked accor

Re: [PATCH v7 17/50] powerpc/powernv: Avoid calculating DMA32 segments on PHB3

2015-11-17 Thread Gavin Shan
On Tue, Nov 17, 2015 at 12:07:17PM +1100, Alexey Kardashevskiy wrote: >On 11/05/2015 12:12 AM, Gavin Shan wrote: >>In pnv_ioda_setup_dma(), it's unnecessary to calculate the DMA32 >>segments for PEs on PHB3 as the whole available DMA32 space can >>be assigned to one spec

Re: [PATCH v7 14/50] powerpc/powernv: M64 support on P7IOC

2015-11-17 Thread Gavin Shan
On Tue, Nov 17, 2015 at 03:43:28PM +1100, Alexey Kardashevskiy wrote: >On 11/17/2015 02:04 PM, Gavin Shan wrote: >>On Tue, Nov 17, 2015 at 01:37:22PM +1100, Alexey Kardashevskiy wrote: >>>On 11/17/2015 12:42 PM, Gavin Shan wrote: >>>>On Mon, Nov 16, 2015 at 07:02:18

Re: [PATCH v7 14/50] powerpc/powernv: M64 support on P7IOC

2015-11-16 Thread Gavin Shan
On Tue, Nov 17, 2015 at 01:37:22PM +1100, Alexey Kardashevskiy wrote: >On 11/17/2015 12:42 PM, Gavin Shan wrote: >>On Mon, Nov 16, 2015 at 07:02:18PM +1100, Alexey Kardashevskiy wrote: >>>On 11/05/2015 12:12 AM, Gavin Shan wrote: >>>>This enables M64 window on P7IOC,

Re: [PATCH v7 22/50] powerpc/powernv: Introduce pnv_ioda_init_pe()

2015-11-16 Thread Gavin Shan
On Tue, Nov 17, 2015 at 01:37:33PM +1100, Alexey Kardashevskiy wrote: >On 11/17/2015 12:58 PM, Gavin Shan wrote: >>On Tue, Nov 17, 2015 at 11:30:49AM +1100, Daniel Axtens wrote: >>>Gavin Shan writes: >>> >>>>This introduces pnv_ioda_init_pe() to initia

Re: [PATCH v7 14/50] powerpc/powernv: M64 support on P7IOC

2015-11-16 Thread Gavin Shan
On Tue, Nov 17, 2015 at 01:11:56PM +1100, Alexey Kardashevskiy wrote: >On 11/17/2015 12:38 PM, Gavin Shan wrote: >>On Mon, Nov 16, 2015 at 07:02:03PM +1100, Alexey Kardashevskiy wrote: >>>On 11/05/2015 12:12 AM, Gavin Shan wrote: >>>>This enables M64 window on P7IOC,

Re: [PATCH v7 18/50] powerpc/powernv: Remove DMA32 PE list

2015-11-16 Thread Gavin Shan
On Tue, Nov 17, 2015 at 12:54:04PM +1100, Alexey Kardashevskiy wrote: >On 11/05/2015 12:12 AM, Gavin Shan wrote: >>PEs are put into PHB DMA32 list (phb->ioda.pe_dma_list) according >>to their DMA32 weight. The PEs on the list are iterated to setup >>their TCE32 tables at

Re: [PATCH v7 22/50] powerpc/powernv: Introduce pnv_ioda_init_pe()

2015-11-16 Thread Gavin Shan
On Tue, Nov 17, 2015 at 11:30:49AM +1100, Daniel Axtens wrote: >Gavin Shan writes: > >> This introduces pnv_ioda_init_pe() to initialize the specified PE >> instance (phb->ioda.pe_array[x]). It's used by pnv_ioda_alloc_pe() >> and pnv_ioda_reserve_pe(). No logical

Re: [PATCH v7 21/50] powerpc/powernv: Increase PE# capacity

2015-11-16 Thread Gavin Shan
On Tue, Nov 17, 2015 at 11:29:26AM +1100, Daniel Axtens wrote: >Gavin Shan writes: > >> Each PHB maintains an array helping to translate 2-bytes Request >> ID (RID) to PE# with the assumption that PE# takes one byte, meaning >> that we can't have more than 256 PE

Re: [PATCH v7 19/50] powerpc/powernv: Track DMA32 segment consumption

2015-11-16 Thread Gavin Shan
On Tue, Nov 17, 2015 at 11:28:20AM +1100, Daniel Axtens wrote: >Gavin Shan writes: > >> Similar to the mechanism tracking consumed IO/M32/M64 segments, >> this introduces an array for each PHB to track the consumed DMA32 >> segments, which are going to be released on PCI

Re: [PATCH v7 14/50] powerpc/powernv: M64 support on P7IOC

2015-11-16 Thread Gavin Shan
On Mon, Nov 16, 2015 at 07:02:18PM +1100, Alexey Kardashevskiy wrote: >On 11/05/2015 12:12 AM, Gavin Shan wrote: >>This enables M64 window on P7IOC, which has been enabled on PHB3. >>Different from PHB3 where 16 M64 BARs are supported and each of >>them can be owned

Re: [PATCH v7 14/50] powerpc/powernv: M64 support on P7IOC

2015-11-16 Thread Gavin Shan
On Mon, Nov 16, 2015 at 07:02:03PM +1100, Alexey Kardashevskiy wrote: >On 11/05/2015 12:12 AM, Gavin Shan wrote: >>This enables M64 window on P7IOC, which has been enabled on PHB3. >>Different from PHB3 where 16 M64 BARs are supported and each of >>them can be owned

Re: [PATCH v7 14/50] powerpc/powernv: M64 support on P7IOC

2015-11-16 Thread Gavin Shan
On Mon, Nov 16, 2015 at 07:01:46PM +1100, Alexey Kardashevskiy wrote: >On 11/05/2015 12:12 AM, Gavin Shan wrote: >>This enables M64 window on P7IOC, which has been enabled on PHB3. >>Different from PHB3 where 16 M64 BARs are supported and each of >>them can be owned

Re: [PATCH v7 11/50] powerpc/powernv: IO and M32 mapping based on PCI device resources

2015-11-16 Thread Gavin Shan
On Mon, Nov 16, 2015 at 07:01:43PM +1100, Alexey Kardashevskiy wrote: >On 11/12/2015 03:55 PM, Gavin Shan wrote: >>On Thu, Nov 12, 2015 at 02:30:27PM +1100, Daniel Axtens wrote: >>>Hi Gavin, >>> >>>Sorry to have taken so long to resume these reviews! >

Re: [PATCH v7 08/50] powerpc/powernv: Rename PE# fields in struct pnv_phb

2015-11-16 Thread Gavin Shan
On Mon, Nov 16, 2015 at 07:01:06PM +1100, Alexey Kardashevskiy wrote: >On 11/05/2015 12:12 AM, Gavin Shan wrote: >>This renames the fields related to PE number in "struct pnv_phb" >>for better reflecting of their usages as Alexey suggested. No >>logical changes

Re: [PATCH v7 12/50] powerpc/powernv: Track M64 segment consumption

2015-11-16 Thread Gavin Shan
On Mon, Nov 16, 2015 at 07:01:59PM +1100, Alexey Kardashevskiy wrote: >On 11/05/2015 12:12 AM, Gavin Shan wrote: >>As we track M32 segment consumption, this introduces an array to >>the PHB to track the mapping between M64 segment and PE number. >>The information is going t

Re: [PATCH v7 10/50] powerpc/powernv: Simplify pnv_ioda_setup_pe_seg()

2015-11-16 Thread Gavin Shan
On Mon, Nov 16, 2015 at 07:01:18PM +1100, Alexey Kardashevskiy wrote: >On 11/06/2015 10:52 AM, Gavin Shan wrote: >>On Fri, Nov 06, 2015 at 09:56:06AM +1100, Daniel Axtens wrote: >>>Gavin Shan writes: >>> >>>>The original implementation of pnv_ioda_setup_pe_s

Re: [PATCH v7 39/50] powerpc/powernv: Fundamental reset in pnv_pci_reset_secondary_bus()

2015-11-12 Thread Gavin Shan
On Fri, Nov 13, 2015 at 11:08:29AM +1100, Daniel Axtens wrote: >Gavin Shan writes: > >> void pnv_pci_reset_secondary_bus(struct pci_dev *dev) >> { >> -pnv_eeh_bridge_reset(dev, EEH_RESET_HOT); >> +int option, freset = 0; >> + >> +if (dev-

Re: [PATCH v7 38/50] powerpc/powernv: Exclude root bus in pnv_pci_reset_secondary_bus()

2015-11-12 Thread Gavin Shan
On Fri, Nov 13, 2015 at 09:59:27AM +1100, Daniel Axtens wrote: >Gavin Shan writes: > >> When pnv_pci_reset_secondary_bus() is called to issue reset on >> the indicated secondary bus, the bus can't be root bus. So we >> needn't consider root bus in the function.

Re: [PATCH v7 39/50] powerpc/powernv: Fundamental reset in pnv_pci_reset_secondary_bus()

2015-11-11 Thread Gavin Shan
On Thu, Nov 05, 2015 at 12:12:39AM +1100, Gavin Shan wrote: >In pnv_pci_reset_secondary_bus(), we should issue fundamental >reset if any one subordinate device of the specified is requesting ^^

Re: [PATCH v7 37/50] powerpc/powernv: Simplify pnv_eeh_reset()

2015-11-11 Thread Gavin Shan
On Thu, Nov 12, 2015 at 04:11:12PM +1100, Daniel Axtens wrote: >> -rc = opal_pci_reset(phb->opal_id, >> -OPAL_RESET_PHB_ERROR, >> -OPAL_ASSERT_RESET); >> -if (rc != OPAL_SUCCESS)

Re: [PATCH v7 11/50] powerpc/powernv: IO and M32 mapping based on PCI device resources

2015-11-11 Thread Gavin Shan
On Thu, Nov 12, 2015 at 02:30:27PM +1100, Daniel Axtens wrote: >Hi Gavin, > >Sorry to have taken so long to resume these reviews! > Thanks for your review, Daniel! >> Currently, the IO and M32 segments are mapped to the corresponding >> PE based on the windows of the parent bridge of PE's primary

Re: [PATCH v7 00/50] powerpc/powernv: PCI hotplug support

2015-11-08 Thread Gavin Shan
On Sun, Nov 08, 2015 at 08:24:37PM -0800, Pramod Sudheendra wrote: >> On Nov 8, 2015, at 7:09 PM, Gavin Shan wrote: >> On Thu, Nov 05, 2015 at 12:12:00AM +1100, Gavin Shan wrote: >>> This series of patches rebases on powerpc/next branch, plus below additional >>

Re: [PATCH v7 00/50] powerpc/powernv: PCI hotplug support

2015-11-08 Thread Gavin Shan
On Thu, Nov 05, 2015 at 12:12:00AM +1100, Gavin Shan wrote: >This series of patches rebases on powerpc/next branch, plus below additional >patches: > > https://patchwork.ozlabs.org/patch/534804/ (PATCH[1/1] Andrew's EEH fix) > https://patchwork.ozlabs.org/patch/

Re: [PATCH v7 04/50] powerpc/powernv: Cleanup on pnv_pci_ioda_controller_ops

2015-11-05 Thread Gavin Shan
On Fri, Nov 06, 2015 at 09:28:20AM +1100, Daniel Axtens wrote: >Gavin Shan writes: > >> This cleans up on pnv_pci_ioda_controller_ops struct to use tab >> instead of space indent of statement to avoid complains from >> scripts/checkpatch.pl. No logical changes introduced.

Re: [PATCH v7 10/50] powerpc/powernv: Simplify pnv_ioda_setup_pe_seg()

2015-11-05 Thread Gavin Shan
On Fri, Nov 06, 2015 at 09:56:06AM +1100, Daniel Axtens wrote: >Gavin Shan writes: > >> The original implementation of pnv_ioda_setup_pe_seg() configures >> IO and M32 segments by separate logics, which can be merged by >> by caching @segmap, @seg_size, @win in advance.

Re: [PATCH v7 03/50] powerpc/pci: Cleanup on struct pci_controller_ops

2015-11-05 Thread Gavin Shan
On Fri, Nov 06, 2015 at 09:32:57AM +1100, Daniel Axtens wrote: >Gavin Shan writes: > >> Each PHB has one instance of "struct pci_controller_ops", which >> includes various callbacks called by PCI subsystem. In the definition >> of this struct, some callbacks hav

Re: [PATCH v7 02/50] powerpc/pci: Override pcibios_setup_bridge()

2015-11-05 Thread Gavin Shan
On Fri, Nov 06, 2015 at 09:27:42AM +1100, Daniel Axtens wrote: >Gavin Shan writes: > >> >> +void pcibios_setup_bridge(struct pci_bus *bus, unsigned long type) >> +{ >> +struct pci_controller *hose = pci_bus_to_host(bus); >Very much a nit-pick, but I thoug

Re: [PATCH v7 45/50] drivers/of: Avoid recursively calling unflatten_dt_node()

2015-11-04 Thread Gavin Shan
On Thu, Nov 05, 2015 at 10:23:15AM +1100, Gavin Shan wrote: >On Wed, Nov 04, 2015 at 10:07:50AM -0600, Rob Herring wrote: >>On Wed, Nov 4, 2015 at 7:12 AM, Gavin Shan wrote: >>> In current implementation, unflatten_dt_node() is called recursively >>> to unflatten dev

Re: [PATCH v7 49/50] drivers/of: Export OF changeset functions

2015-11-04 Thread Gavin Shan
On Wed, Nov 04, 2015 at 10:12:00AM -0600, Rob Herring wrote: >On Wed, Nov 4, 2015 at 7:12 AM, Gavin Shan wrote: >> The PowerNV PCI hotplug driver is going to use the OF changeset >> to manage the changed device sub-tree. This exports those OF >> changeset functions for that

Re: [PATCH v7 45/50] drivers/of: Avoid recursively calling unflatten_dt_node()

2015-11-04 Thread Gavin Shan
On Wed, Nov 04, 2015 at 10:07:50AM -0600, Rob Herring wrote: >On Wed, Nov 4, 2015 at 7:12 AM, Gavin Shan wrote: >> In current implementation, unflatten_dt_node() is called recursively >> to unflatten device nodes in FDT blob. It's stress to limited stack >> capacity.

Re: [PATCH v7 44/50] drivers/of: Split unflatten_dt_node()

2015-11-04 Thread Gavin Shan
On Wed, Nov 04, 2015 at 12:43:08PM -0600, Rob Herring wrote: >On Wed, Nov 4, 2015 at 7:12 AM, Gavin Shan wrote: >> The function unflatten_dt_node() is called recursively to unflatten >> device nodes and properties in the FDT blob. It looks complicated >> and hard to be u

[PATCH v7 08/50] powerpc/powernv: Rename PE# fields in struct pnv_phb

2015-11-04 Thread Gavin Shan
This renames the fields related to PE number in "struct pnv_phb" for better reflecting of their usages as Alexey suggested. No logical changes introduced. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/eeh-powernv.c | 2 +- arch/powerpc/platforms/powernv/pci-ioda

[PATCH v7 23/50] powerpc/powernv: Use PE instead of number during setup and release

2015-11-04 Thread Gavin Shan
changes introduced. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 81 +-- arch/powerpc/platforms/powernv/pci.h | 2 +- 2 files changed, 46 insertions(+), 37 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch

[PATCH v7 20/50] powerpc/powernv: Improve DMA32 segment calculation

2015-11-04 Thread Gavin Shan
locate as much DMA32 segments as we can. It's acceptable that number of DMA32 segments less than the expected number are allocated. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 119 ++ 1 file changed, 57 insertions(+), 62 deletions(-)

[PATCH v7 09/50] powerpc/powernv: Fix initial IO and M32 segmap

2015-11-04 Thread Gavin Shan
nsigned int" to "int". Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 9 +++-- arch/powerpc/platforms/powernv/pci.h | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerp

[PATCH v7 04/50] powerpc/powernv: Cleanup on pnv_pci_ioda_controller_ops

2015-11-04 Thread Gavin Shan
This cleans up on pnv_pci_ioda_controller_ops struct to use tab instead of space indent of statement to avoid complains from scripts/checkpatch.pl. No logical changes introduced. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 18 +- 1 file changed, 9

[PATCH v7 17/50] powerpc/powernv: Avoid calculating DMA32 segments on PHB3

2015-11-04 Thread Gavin Shan
DMA32 segments for PEs on PHB3. No logical changes introduced. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 41 ++- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/po

[PATCH v7 31/50] powerpc/pci: Export pci_add_device_node_info()

2015-11-04 Thread Gavin Shan
in traverse_pci_devices(). No logical changes introduced. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/pci-bridge.h | 3 ++- arch/powerpc/kernel/pci_dn.c | 30 +++--- arch/powerpc/platforms/pseries/setup.c | 2 +- 3 files changed, 22 insertions

[PATCH v7 13/50] powerpc/powernv: Rename M64 related functions

2015-11-04 Thread Gavin Shan
This renames those functions picking PE number based on consumed M64 segments, mapping M64 segments to PEs as those functions are going to be shared by IODA1/IODA2 in next patch. No logical changes introduced. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 22

[PATCH v7 35/50] powerpc/pci: Don't scan empty slot

2015-11-04 Thread Gavin Shan
t have any subordinate devices, in order to avoid kernel crash. Signed-off-by: Gavin Shan --- arch/powerpc/kernel/pci-hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c index 96e2cc3..825b39c 100644 --- a/ar

[PATCH v7 36/50] powerpc/pci: Update bridge windows on PCI plug

2015-11-04 Thread Gavin Shan
ot plugged slot's upstream bridge in pcibios_finish_adding_to_bus() so that the platform resources (PE#, IO/MMIO/DMA segments) are allocated or created accordingly. Signed-off-by: Gavin Shan --- arch/powerpc/kernel/pci-common.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) di

[PATCH v7 32/50] powerpc/pci: Introduce pci_remove_device_node_info()

2015-11-04 Thread Gavin Shan
This implements and exports pci_remove_device_node_info(). It's used to remove the pdn (struct pci_dn) for the indicated device node. The function is going to be used by PowerNV PCI hotplug driver. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/pci-bridge.h | 1 + arch/powerpc/k

[PATCH v7 45/50] drivers/of: Avoid recursively calling unflatten_dt_node()

2015-11-04 Thread Gavin Shan
duced to track the parent path size and the device node of current level of depth, which will be used by the device node on next level of depth to be unflattened. Also, the parameter "poffset" and "fpsize" are unused and dropped. Signed-off-by: Gavin Shan -

[PATCH v7 40/50] powerpc/powernv: Support PCI slot ID

2015-11-04 Thread Gavin Shan
_poll(). * One more argument (PCI slot's state) added to opal_pci_poll(). * Drop pnv_eeh_phb_poll() and introduce a enhanced similar function pnv_pci_poll() that will be used by PowerNV hotplug backends. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/opal.h | 4

[PATCH v7 41/50] powerpc/powernv: Use firmware PCI slot reset infrastructure

2015-11-04 Thread Gavin Shan
as before. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/eeh-powernv.c | 41 +++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c index e533535..086d153 10

[PATCH v7 43/50] powerpc/powernv: Select OF_DYNAMIC

2015-11-04 Thread Gavin Shan
The device tree will change dynamically in PowerNV PCI hotplug driver. This enables CONFIG_OF_DYNAMIC to support that. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/powernv/Kconfig b/arch/powerpc

[PATCH v7 33/50] powerpc/pci: Export pci_traverse_device_nodes()

2015-11-04 Thread Gavin Shan
dition reported from checkpatch.pl. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/ppc-pci.h | 6 +++--- arch/powerpc/kernel/pci_dn.c | 14 +- arch/powerpc/platforms/pseries/msi.c | 4 ++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/arch/pow

[PATCH v7 06/50] powerpc/powernv: Drop phb->bdfn_to_pe()

2015-11-04 Thread Gavin Shan
This drops struct pnv_phb::bdfn_to_pe() as nobody uses it. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 9 - arch/powerpc/platforms/powernv/pci.h | 1 - 2 files changed, 10 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch

[PATCH v7 12/50] powerpc/powernv: Track M64 segment consumption

2015-11-04 Thread Gavin Shan
As we track M32 segment consumption, this introduces an array to the PHB to track the mapping between M64 segment and PE number. The information is going to be used to find M64 segment from the PE number during PCI unplugging time in subsequent patches. Signed-off-by: Gavin Shan --- arch

[PATCH v7 07/50] powerpc/powernv: Reorder fields in struct pnv_phb

2015-11-04 Thread Gavin Shan
This moves those fields in struct pnv_phb that are related to PE allocation around. No logical change. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci.h | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch

[PATCH v7 34/50] powerpc/pci: Delay populating pdn

2015-11-04 Thread Gavin Shan
same life cycle, the eeh_dev is created when pdn is populated. We needn't create eeh_dev with another initcall. The time to create PHB PEs is delayed a bit from core_initcall() to core_initcall_sync(). Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/eeh.h | 2 +- arch/powerpc/in

[PATCH v7 28/50] powerpc/pci: Rename pcibios_{add,remove}_pci_devices()

2015-11-04 Thread Gavin Shan
This renames pcibios_{add,remove}_pci_devices() to avoid conflicts with names of the weak functions in PCI subsystem, which have the prefix "pcibios". No logical changes introduced. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/pci-bridge.h | 4 ++-- arch/powerpc/kernel/ee

[PATCH v7 38/50] powerpc/powernv: Exclude root bus in pnv_pci_reset_secondary_bus()

2015-11-04 Thread Gavin Shan
When pnv_pci_reset_secondary_bus() is called to issue reset on the indicated secondary bus, the bus can't be root bus. So we needn't consider root bus in the function. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/eeh-powernv.c | 12 ++-- 1 file changed, 2

[PATCH v7 29/50] powerpc/pci: Rename pcibios_find_pci_bus()

2015-11-04 Thread Gavin Shan
This renames pcibios_find_pci_bus() to pci_find_bus_by_node() to avoid conflicts with those PCI subsystem weak function names, which have prefix "pcibios". No logical changes introduced. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/pci-bridge.h | 2 +- arch/powerpc

[PATCH v7 24/50] powerpc/powernv: Allocate PE# in reverse order

2015-11-04 Thread Gavin Shan
s the PE number to be allocated dynamically in reverse order. With this patch applied, the PE numbers are reserved in ascending order, but allocated dynamically in reverse order. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 14 ++ 1 file changed, 6 inser

[PATCH v7 11/50] powerpc/powernv: IO and M32 mapping based on PCI device resources

2015-11-04 Thread Gavin Shan
rder to support hotplug in subsequent patch. This fixes the issue by mapping IO and M32 segments based on the resources of the PCI devices included in the PE, instead of the windows of the parent bridge of the PE's primary bus. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powe

[PATCH v7 50/50] PCI/hotplug: PowerPC PowerNV PCI hotplug driver

2015-11-04 Thread Gavin Shan
The skiboot firmware doesn't export the capability to access attention LEDs yet and it's something for TBD. Signed-off-by: Gavin Shan Acked-by: Bjorn Helgaas --- MAINTAINERS | 6 + drivers/pci/hotplug/Kconfig | 12 + drivers/pci/hotplug/Make

[PATCH v7 30/50] powerpc/pci: Move pci_find_bus_by_node() around

2015-11-04 Thread Gavin Shan
n" in find_bus_among_children() * Use PCI_DN() to convert device node to pci_dn Signed-off-by: Gavin Shan Acked-by: Benjamin Herrenschmidt --- arch/powerpc/kernel/pci-hotplug.c | 29 arch/powerpc/platforms/pseries/pci_dl

[PATCH v7 10/50] powerpc/powernv: Simplify pnv_ioda_setup_pe_seg()

2015-11-04 Thread Gavin Shan
The original implementation of pnv_ioda_setup_pe_seg() configures IO and M32 segments by separate logics, which can be merged by by caching @segmap, @seg_size, @win in advance. This shouldn't cause any behavioural changes. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-i

[PATCH v7 05/50] powerpc/powernv: Drop pnv_ioda_setup_dev_PE()

2015-11-04 Thread Gavin Shan
Nobody uses this function and this just drops it. Signed-off-by: Gavin Shan Reviewed-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c | 71 --- 1 file changed, 71 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch

[PATCH v7 42/50] powerpc/powernv: Functions to get/set PCI slot status

2015-11-04 Thread Gavin Shan
from skiboot firmware in PowerNV PCI hotplug driver. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/opal-api.h| 17 ++- arch/powerpc/include/asm/opal.h| 4 ++ arch/powerpc/include/asm/pnv-pci.h | 7 +++ arch/powerpc/platforms/powernv/opal

[PATCH v7 18/50] powerpc/powernv: Remove DMA32 PE list

2015-11-04 Thread Gavin Shan
of PHB and PE to pnv_pci_ioda1_setup_dma() to drop PHB's DMA32 list. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 150 ++ arch/powerpc/platforms/powernv/pci.h | 19 2 files changed, 68 insertions(+), 101 deletions(-) diff

[PATCH v7 37/50] powerpc/powernv: Simplify pnv_eeh_reset()

2015-11-04 Thread Gavin Shan
This drops unnecessary nested if statements in pnv_eeh_reset() to improve the code readability. After the changes, the unused local variable "ret" is dropped as well. No logical changes introduced. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/eeh-powe

[PATCH v7 19/50] powerpc/powernv: Track DMA32 segment consumption

2015-11-04 Thread Gavin Shan
assigned PE number. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 30 +- arch/powerpc/platforms/powernv/pci.h | 7 --- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch

[PATCH v7 22/50] powerpc/powernv: Introduce pnv_ioda_init_pe()

2015-11-04 Thread Gavin Shan
This introduces pnv_ioda_init_pe() to initialize the specified PE instance (phb->ioda.pe_array[x]). It's used by pnv_ioda_alloc_pe() and pnv_ioda_reserve_pe(). No logical changes introduced. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 14 ++

[PATCH v7 49/50] drivers/of: Export OF changeset functions

2015-11-04 Thread Gavin Shan
The PowerNV PCI hotplug driver is going to use the OF changeset to manage the changed device sub-tree. This exports those OF changeset functions for that. Signed-off-by: Gavin Shan --- drivers/of/dynamic.c| 65 ++--- drivers/of/of_private.h | 2

[PATCH v7 47/50] drivers/of: Specify parent node in of_fdt_unflatten_tree()

2015-11-04 Thread Gavin Shan
This adds one more argument to of_fdt_unflatten_tree() to specify the parent node of the FDT blob that is going to be unflattened. In the result, the function can be used to unflatten FDT blob that represents device sub-tree in PowerNV PCI hotplug driver. Signed-off-by: Gavin Shan --- drivers

[PATCH v7 15/50] powerpc/powernv: Rename pnv_pci_ioda_setup_dma_pe()

2015-11-04 Thread Gavin Shan
This renames pnv_pci_ioda_setup_dma_pe() to pnv_pci_ioda1_setup_dma_pe() as it's the counter-part of IODA2's pnv_pci_ioda2_setup_dma_pe(). No logical changes introduced. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 9 + 1 file changed, 5 insert

[PATCH v7 46/50] drivers/of: Rename unflatten_dt_node()

2015-11-04 Thread Gavin Shan
This renames unflatten_dt_node() to unflatten_dt_nodes() as it populates multiple device nodes from FDT blob. No logical changes introduced. Signed-off-by: Gavin Shan --- drivers/of/fdt.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/of/fdt.c b

[PATCH v7 02/50] powerpc/pci: Override pcibios_setup_bridge()

2015-11-04 Thread Gavin Shan
This overrides pcibios_setup_bridge() that is called to update PCI bridge windows when PCI resource assignment is completed, to assign PE and setup various (resource) mapping for the PE in subsequent patches. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/pci-bridge.h | 2 ++ arch

[PATCH v7 48/50] drivers/of: Return allocated memory from of_fdt_unflatten_tree()

2015-11-04 Thread Gavin Shan
This returns the allocate memory chunk, storing the unflattened device tree, from of_fdt_unflatten_tree() so that memory chunk can be released on demand in PowerNV PCI hotplug driver. Signed-off-by: Gavin Shan Acked-by: Rob Herring --- drivers/of/fdt.c | 25

[PATCH v7 01/50] PCI: Add pcibios_setup_bridge()

2015-11-04 Thread Gavin Shan
s not hotplug friendly. This adds weak function pcibios_setup_bridge(), which is called by pci_setup_bridge(). PowerPC PowerNV platform will reuse the function to assign above platform required resources to newly added PCI devices, in order to support PCI hotplug in subsequent patches. Signed-off-by:

[PATCH v7 00/50] powerpc/powernv: PCI hotplug support

2015-11-04 Thread Gavin Shan
sed to 4.1.RC0 * PowerNV PCI infrasturcture is total refactored in order to support PCI hotplug. The PowerNV hotplug driver is also reworked a lot because of the changes in skiboot in order to support PCI hotplug. Gavin Shan (50): PCI: Add pcibios_setup_bridge() powerpc/pci: Overr

[PATCH v7 44/50] drivers/of: Split unflatten_dt_node()

2015-11-04 Thread Gavin Shan
is called by populate_node(), creates properties for the indicated device node. The later one creates the device nodes from FDT blob. populate_node() gets the offset in FDT blob for next device nodes and then calls populate_node(). No logical changes introduced. Signed-off-by: Gavin Shan

[PATCH v7 14/50] powerpc/powernv: M64 support on P7IOC

2015-11-04 Thread Gavin Shan
just provide 128 M64 segments on every P7IOC PHB and each of them is pinned to the fixed PE# by bypassing the function of M64DT. In turn, we just need different phb->init_m64() for P7IOC and PHB3 to support M64. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-iod

[PATCH v7 03/50] powerpc/pci: Cleanup on struct pci_controller_ops

2015-11-04 Thread Gavin Shan
he callbacks in "struct pci_controller_ops" so that the code looks consistent. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/pci-bridge.h | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/inclu

[PATCH v7 27/50] powerpc/powernv: Dynamically release PEs

2015-11-04 Thread Gavin Shan
PCI hot unplug. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 245 ++ arch/powerpc/platforms/powernv/pci.h | 1 + 2 files changed, 218 insertions(+), 28 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch

[PATCH v7 21/50] powerpc/powernv: Increase PE# capacity

2015-11-04 Thread Gavin Shan
ill be 4-bytes long. Then we can reuse IODA_INVALID_PE to check the PE# stored in phb->pe_rmap[] is valid or not. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 6 +- arch/powerpc/platforms/powernv/pci.h | 7 ++- 2 files changed, 7 insertions(+), 6 deletio

[PATCH v7 25/50] powerpc/powernv: Reserve PE for root bus

2015-11-04 Thread Gavin Shan
Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 33 ++- arch/powerpc/platforms/powernv/pci.h | 1 + 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/pow

[PATCH v7 16/50] powerpc/powernv: Define PNV_IODA1_DMA32_SEGSIZE

2015-11-04 Thread Gavin Shan
can be calcualted when the page has fixed 4KB size. So all the related calculation depends on one macro (PNV_IODA1_DMA32_SEGSIZE). No logical changes introduced. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 27 ++- arch/powerpc/platforms/powernv

[PATCH v7 39/50] powerpc/powernv: Fundamental reset in pnv_pci_reset_secondary_bus()

2015-11-04 Thread Gavin Shan
In pnv_pci_reset_secondary_bus(), we should issue fundamental reset if any one subordinate device of the specified is requesting that. Otherwise, the device might not come up after the reset. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/eeh-powernv.c | 21

[PATCH v7 26/50] powerpc/powernv: Create PEs at PCI hot plugging time

2015-11-04 Thread Gavin Shan
the PCIe switch behind root port. The extension for those PCI brdiges' windows is done in ppc_md.pcibios_setup_bridge() as well. Signed-off-by: Gavin Shan --- arch/powerpc/platforms/powernv/pci-ioda.c | 240 +- arch/powerpc/platforms/powernv/pci.h | 1 +

Re: [PATCH v6 38/42] drivers/of: Unflatten subordinate nodes after specified level

2015-11-03 Thread Gavin Shan
On Thu, Aug 06, 2015 at 02:11:43PM +1000, Gavin Shan wrote: >unflatten_dt_node() is called recursively to unflatten FDT nodes >with the assumption that FDT blob has only one root node, which >isn't true when the FDT blob represents device sub-tree. This >improves the function to

Re: [PATCH v6 20/42] powerpc/powernv: Create PEs dynamically

2015-08-14 Thread Gavin Shan
On Fri, Aug 14, 2015 at 11:52:44PM +1000, Alexey Kardashevskiy wrote: >On 08/06/2015 02:11 PM, Gavin Shan wrote: >>Currently, the PEs and their associated resources are assigned >>in ppc_md.pcibios_fixup() except those consumed by SRIOV VFs. >>The function is called for once

Re: [PATCH v6 42/42] pci/hotplug: PowerPC PowerNV PCI hotplug driver

2015-08-14 Thread Gavin Shan
On Sat, Aug 15, 2015 at 01:13:21PM +1000, Alexey Kardashevskiy wrote: >On 08/06/2015 02:11 PM, Gavin Shan wrote: >>The patch intends to add standalone driver to support PCI hotplug >>for PowerPC PowerNV platform, which runs on top of skiboot firmware. >>The firmware identifi

Re: [PATCH v6 23/42] powerpc/powernv: Release PEs dynamically

2015-08-12 Thread Gavin Shan
On Tue, Aug 11, 2015 at 11:03:40PM +1000, Alexey Kardashevskiy wrote: >On 08/06/2015 02:11 PM, Gavin Shan wrote: >>This adds the refcount to PE, which represents number of PCI >>devices contained in the PE. When last device leaves from the >>PE, the PE together with its consum

Re: [PATCH v6 18/42] powerpc/powernv: Allocate PE# in deasending order

2015-08-12 Thread Gavin Shan
On Tue, Aug 11, 2015 at 12:50:33PM +1000, Alexey Kardashevskiy wrote: >On 08/11/2015 10:43 AM, Gavin Shan wrote: >>On Tue, Aug 11, 2015 at 12:39:02AM +1000, Alexey Kardashevskiy wrote: >>>On 08/06/2015 02:11 PM, Gavin Shan wrote: >>>>The available PE#, represen

Re: [PATCH v6 12/42] powerpc/powernv: Increase PE# capacity

2015-08-12 Thread Gavin Shan
On Tue, Aug 11, 2015 at 12:47:25PM +1000, Alexey Kardashevskiy wrote: >On 08/11/2015 10:38 AM, Gavin Shan wrote: >>On Mon, Aug 10, 2015 at 07:53:02PM +1000, Alexey Kardashevskiy wrote: >>>On 08/06/2015 02:11 PM, Gavin Shan wrote: >>>>Each PHB maintains an array hel

  1   2   3   >