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

2015-06-30 Thread Gavin Shan
On Tue, Jun 30, 2015 at 07:18:04PM +0100, Grant Likely wrote:
>On Thu,  4 Jun 2015 16:42:11 +1000
>, 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 identified hotpluggable slots and marked their device
>> tree node with proper "ibm,slot-pluggable" and "ibm,reset-by-firmware".
>> The driver simply scans device-tree to create/register PCI hotplug slot
>> accordingly.
>> 
>> If the skiboot firmware doesn't support slot status retrieval, the PCI
>> slot device node shouldn't have property "ibm,reset-by-firmware". In
>> that case, none of valid PCI slots will be detected from device tree.
>> The skiboot firmware doesn't export the capability to access attention
>> LEDs yet and it's something for TBD.
>> 
>> Signed-off-by: Gavin Shan 
>> ---
>> v5:
>>   * Use OF OVERLAY to update the device-tree
>>   * Removed unnecessary header files
>>   * More meaningful return value from powernv_php_register_one()
>>   * Use pnv_pci_hotplug_notifier_{register, unregister}()
>>   * Decimal values for slot's states
>>   * Removed struct powernv_php_slot::release()
>>   * Merged two bool arguments to one for powernv_php_slot_enable()
>>   * Rename release_device_nodes_info() to remove_device_nodes_info()
>>   * Don't check on "!len" in slot_power_on_handler()
>>   * Handle return value in get_adapter_status() as suggested by aik
>>   * Drop invalid attention status in set_attention_status()
>>   * Renaming functions
>>   * Fixed coding style and added entry in MAINTAINERS reported by
>> checkpatch.pl
>> ---
>>  MAINTAINERS|   6 +
>>  drivers/pci/hotplug/Kconfig|  12 +
>>  drivers/pci/hotplug/Makefile   |   4 +
>>  drivers/pci/hotplug/powernv_php.c  | 140 +++
>>  drivers/pci/hotplug/powernv_php.h  |  90 
>>  drivers/pci/hotplug/powernv_php_slot.c | 732 
>> +
>>  6 files changed, 984 insertions(+)
>>  create mode 100644 drivers/pci/hotplug/powernv_php.c
>>  create mode 100644 drivers/pci/hotplug/powernv_php.h
>>  create mode 100644 drivers/pci/hotplug/powernv_php_slot.c
>> 
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index e308718..f5e1dce 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -7481,6 +7481,12 @@ L:linux-...@vger.kernel.org
>>  S:  Supported
>>  F:  Documentation/PCI/pci-error-recovery.txt
>>  
>> +PCI HOTPLUG DRIVER FOR POWERNV PLATFORM
>> +M:  Gavin Shan 
>> +L:  linux-...@vger.kernel.org
>> +S:  Supported
>> +F:  drivers/pci/hotplug/powernv_php*
>> +
>>  PCI SUBSYSTEM
>>  M:  Bjorn Helgaas 
>>  L:  linux-...@vger.kernel.org
>> diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig
>> index df8caec..ef55dae 100644
>> --- a/drivers/pci/hotplug/Kconfig
>> +++ b/drivers/pci/hotplug/Kconfig
>> @@ -113,6 +113,18 @@ config HOTPLUG_PCI_SHPC
>>  
>>When in doubt, say N.
>>  
>> +config HOTPLUG_PCI_POWERNV
>> +tristate "PowerPC PowerNV PCI Hotplug driver"
>> +depends on PPC_POWERNV && EEH
>> +help
>> +  Say Y here if you run PowerPC PowerNV platform that supports
>> +  PCI Hotplug
>> +
>> +  To compile this driver as a module, choose M here: the
>> +  module will be called powernv-php.
>> +
>> +  When in doubt, say N.
>> +
>>  config HOTPLUG_PCI_RPA
>>  tristate "RPA PCI Hotplug driver"
>>  depends on PPC_PSERIES && EEH
>> diff --git a/drivers/pci/hotplug/Makefile b/drivers/pci/hotplug/Makefile
>> index 4a9aa08..a69665e 100644
>> --- a/drivers/pci/hotplug/Makefile
>> +++ b/drivers/pci/hotplug/Makefile
>> @@ -14,6 +14,7 @@ obj-$(CONFIG_HOTPLUG_PCI_PCIE) += pciehp.o
>>  obj-$(CONFIG_HOTPLUG_PCI_CPCI_ZT5550)   += cpcihp_zt5550.o
>>  obj-$(CONFIG_HOTPLUG_PCI_CPCI_GENERIC)  += cpcihp_generic.o
>>  obj-$(CONFIG_HOTPLUG_PCI_SHPC)  += shpchp.o
>> +obj-$(CONFIG_HOTPLUG_PCI_POWERNV)   += powernv-php.o
>>  obj-$(CONFIG_HOTPLUG_PCI_RPA)   += rpaphp.o
>>  obj-$(CONFIG_HOTPLUG_PCI_RPA_DLPAR) += rpadlpar_io.o
>>  obj-$(CONFIG_HOTPLUG_PCI_SGI)   += sgi_hotplug.o
>> @@ -50,6 +51,9 @@ ibmphp-objs:=  ibmphp_core.o   \
>>  acpiphp-objs:=  acpiphp_core.o  \
>>  acpiphp_glue.o
>>  
>> +powernv-php-objs:=  powernv_php.o   \
>> +powernv_php_slot.o
>> +
>>  rpaphp-objs :=  rpaphp_core.o   \
>>  rpaphp_pci.o\
>>  rpaphp_slot.o
>> diff --git a/drivers/pci/hotplug/powernv_php.c 
>> b/drivers/pci/hotplug/powernv_php.c
>> new file mode 100644
>> index 000..4cbff7a
>> --- /dev/null
>> +++ b/drivers/pci/hotplug/powernv_php.c
>> @@ -0,0 +1,140 @@
>> +/*
>> + * PCI Hotplug Driver for PowerPC PowerNV platform.
>> + *
>> + * Copyright Gavin Shan, IBM Corporation 2015.
>> + *
>> + * This program is free software; you can redis

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

2015-06-30 Thread Grant Likely
On Thu,  4 Jun 2015 16:42:11 +1000
, 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 identified hotpluggable slots and marked their device
> tree node with proper "ibm,slot-pluggable" and "ibm,reset-by-firmware".
> The driver simply scans device-tree to create/register PCI hotplug slot
> accordingly.
> 
> If the skiboot firmware doesn't support slot status retrieval, the PCI
> slot device node shouldn't have property "ibm,reset-by-firmware". In
> that case, none of valid PCI slots will be detected from device tree.
> The skiboot firmware doesn't export the capability to access attention
> LEDs yet and it's something for TBD.
> 
> Signed-off-by: Gavin Shan 
> ---
> v5:
>   * Use OF OVERLAY to update the device-tree
>   * Removed unnecessary header files
>   * More meaningful return value from powernv_php_register_one()
>   * Use pnv_pci_hotplug_notifier_{register, unregister}()
>   * Decimal values for slot's states
>   * Removed struct powernv_php_slot::release()
>   * Merged two bool arguments to one for powernv_php_slot_enable()
>   * Rename release_device_nodes_info() to remove_device_nodes_info()
>   * Don't check on "!len" in slot_power_on_handler()
>   * Handle return value in get_adapter_status() as suggested by aik
>   * Drop invalid attention status in set_attention_status()
>   * Renaming functions
>   * Fixed coding style and added entry in MAINTAINERS reported by
> checkpatch.pl
> ---
>  MAINTAINERS|   6 +
>  drivers/pci/hotplug/Kconfig|  12 +
>  drivers/pci/hotplug/Makefile   |   4 +
>  drivers/pci/hotplug/powernv_php.c  | 140 +++
>  drivers/pci/hotplug/powernv_php.h  |  90 
>  drivers/pci/hotplug/powernv_php_slot.c | 732 
> +
>  6 files changed, 984 insertions(+)
>  create mode 100644 drivers/pci/hotplug/powernv_php.c
>  create mode 100644 drivers/pci/hotplug/powernv_php.h
>  create mode 100644 drivers/pci/hotplug/powernv_php_slot.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index e308718..f5e1dce 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7481,6 +7481,12 @@ L: linux-...@vger.kernel.org
>  S:   Supported
>  F:   Documentation/PCI/pci-error-recovery.txt
>  
> +PCI HOTPLUG DRIVER FOR POWERNV PLATFORM
> +M:   Gavin Shan 
> +L:   linux-...@vger.kernel.org
> +S:   Supported
> +F:   drivers/pci/hotplug/powernv_php*
> +
>  PCI SUBSYSTEM
>  M:   Bjorn Helgaas 
>  L:   linux-...@vger.kernel.org
> diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig
> index df8caec..ef55dae 100644
> --- a/drivers/pci/hotplug/Kconfig
> +++ b/drivers/pci/hotplug/Kconfig
> @@ -113,6 +113,18 @@ config HOTPLUG_PCI_SHPC
>  
> When in doubt, say N.
>  
> +config HOTPLUG_PCI_POWERNV
> + tristate "PowerPC PowerNV PCI Hotplug driver"
> + depends on PPC_POWERNV && EEH
> + help
> +   Say Y here if you run PowerPC PowerNV platform that supports
> +  PCI Hotplug
> +
> +   To compile this driver as a module, choose M here: the
> +   module will be called powernv-php.
> +
> +   When in doubt, say N.
> +
>  config HOTPLUG_PCI_RPA
>   tristate "RPA PCI Hotplug driver"
>   depends on PPC_PSERIES && EEH
> diff --git a/drivers/pci/hotplug/Makefile b/drivers/pci/hotplug/Makefile
> index 4a9aa08..a69665e 100644
> --- a/drivers/pci/hotplug/Makefile
> +++ b/drivers/pci/hotplug/Makefile
> @@ -14,6 +14,7 @@ obj-$(CONFIG_HOTPLUG_PCI_PCIE)  += pciehp.o
>  obj-$(CONFIG_HOTPLUG_PCI_CPCI_ZT5550)+= cpcihp_zt5550.o
>  obj-$(CONFIG_HOTPLUG_PCI_CPCI_GENERIC)   += cpcihp_generic.o
>  obj-$(CONFIG_HOTPLUG_PCI_SHPC)   += shpchp.o
> +obj-$(CONFIG_HOTPLUG_PCI_POWERNV)+= powernv-php.o
>  obj-$(CONFIG_HOTPLUG_PCI_RPA)+= rpaphp.o
>  obj-$(CONFIG_HOTPLUG_PCI_RPA_DLPAR)  += rpadlpar_io.o
>  obj-$(CONFIG_HOTPLUG_PCI_SGI)+= sgi_hotplug.o
> @@ -50,6 +51,9 @@ ibmphp-objs :=  ibmphp_core.o   \
>  acpiphp-objs :=  acpiphp_core.o  \
>   acpiphp_glue.o
>  
> +powernv-php-objs :=  powernv_php.o   \
> + powernv_php_slot.o
> +
>  rpaphp-objs  :=  rpaphp_core.o   \
>   rpaphp_pci.o\
>   rpaphp_slot.o
> diff --git a/drivers/pci/hotplug/powernv_php.c 
> b/drivers/pci/hotplug/powernv_php.c
> new file mode 100644
> index 000..4cbff7a
> --- /dev/null
> +++ b/drivers/pci/hotplug/powernv_php.c
> @@ -0,0 +1,140 @@
> +/*
> + * PCI Hotplug Driver for PowerPC PowerNV platform.
> + *
> + * Copyright Gavin Shan, IBM Corporation 2015.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the Lice

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

2015-06-08 Thread Gavin Shan
On Sat, Jun 06, 2015 at 06:18:15AM +1000, Benjamin Herrenschmidt wrote:
>On Fri, 2015-06-05 at 15:11 -0500, Bjorn Helgaas wrote:
>
>> You didn't add this, but "pcibios_add_pci_devices" doesn't seem like the
>> right name.  "pcibios" generally refers to an arch-specific hook that's
>> called by the generic PCI core.  In this case, pcibios_add_pci_devices()
>> contains powerpc-specific code, and it's only called from powerpc code, so
>> I think using "pcibios_" in the name is a bit misleading.
>
>Maybe but just calling it pci_add_* makes it easy to confuse with a core
>function and ppc_add_* is gross :-)
>
>> > +  /* Remove all devices behind the slot */
>> > +  pci_lock_rescan_remove();
>> > +  pcibios_remove_pci_devices(slot->bus);
>> 
>> Same comment for pcibios_remove_pci_devices().  It would be better if the
>> name didn't suggest that this was part of the pcibios_ interface between
>> the PCI core and the arch code, because it's not.
>> 
>> > +  /* Slot indentifier */
>> 
>> s/indentifier/identifier/
>> 
>> > +  if (!php_slot_get_id(dn, &id))
>> > +  return NULL;
>> > +
>> 
>> > +  /* PCI bus */
>> > +  bus = pcibios_find_pci_bus(dn);
>> 
>> And pcibios_find_pci_bus() (it's also powerpc-specific).
>
>This one could actually move to of_pci.c and be generic, something like
>of_pci_node_to_bus()
>

Thanks, Ben. I'll rename those functions as below if Bjorn won't object:

pcibios_add_pci_devices()   pci_add_pci_devices()
pcibios_remove_pci_devices()pci_remove_pci_devices()
pcibios_find_pci_bus()  of_node_to_pci_bus()

Thanks,
Gavin

>Ben.
>
>

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

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

2015-06-08 Thread Gavin Shan
On Fri, Jun 05, 2015 at 03:11:10PM -0500, Bjorn Helgaas wrote:
>On Thu, Jun 04, 2015 at 04:42:11PM +1000, 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 identified hotpluggable slots and marked their device
>> tree node with proper "ibm,slot-pluggable" and "ibm,reset-by-firmware".
>> The driver simply scans device-tree to create/register PCI hotplug slot
>> accordingly.
>> 
>> If the skiboot firmware doesn't support slot status retrieval, the PCI
>> slot device node shouldn't have property "ibm,reset-by-firmware". In
>> that case, none of valid PCI slots will be detected from device tree.
>> 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 
>
>But I do have a few comments (my ack is valid whether you do anything with
>them or not):
>

Thanks for your review, Bjorn.

>> +static void slot_power_off_handler(struct powernv_php_slot *slot)
>> +{
>> +int ret;
>> +
>> +/* Release the firmware data for the child device nodes */
>> +remove_child_pdn(slot->dn);
>> +
>> +/*
>> + * Release the child device nodes. If the sub-tree was
>> + * built with the help of overlay, we just need revert
>> + * the changes introduced by the overlay
>> + */
>> +if (slot->overlay_id >= 0) {
>> +ret = of_overlay_destroy(slot->overlay_id);
>> +if (ret)
>> +pr_warn("%s: Error %d destroying overlay %d\n",
>> +__func__, ret, slot->overlay_id);
>
>For this and similar messages: isn't there a device you can use with
>dev_warn() here?  I think a device name would be much better than a
>function name.
>

There is PCI bus referred (struct powernv_php_slot::bus), but it's
not always valid. So I'll add one more field "struct pci_dev *pdev"
which is initialized to the parent PCI device of the slot, then print
those messages with dev_warn().

>> +scan:
>> +switch (presence) {
>> +case POWERNV_PHP_SLOT_PRESENT:
>> +if (rescan) {
>> +pci_lock_rescan_remove();
>> +pcibios_add_pci_devices(slot->bus);
>
>You didn't add this, but "pcibios_add_pci_devices" doesn't seem like the
>right name.  "pcibios" generally refers to an arch-specific hook that's
>called by the generic PCI core.  In this case, pcibios_add_pci_devices()
>contains powerpc-specific code, and it's only called from powerpc code, so
>I think using "pcibios_" in the name is a bit misleading.
>

Ben already suggested some better names in another reply. I'll pick
it if you agree: pci_add_pci_devices().

>> +/* Remove all devices behind the slot */
>> +pci_lock_rescan_remove();
>> +pcibios_remove_pci_devices(slot->bus);
>
>Same comment for pcibios_remove_pci_devices().  It would be better if the
>name didn't suggest that this was part of the pcibios_ interface between
>the PCI core and the arch code, because it's not.
>

According to Ben's suggestion in another reply, it would be 
pci_remove_pci_devices()
if you agree :-)

>> +/* Slot indentifier */
>
>s/indentifier/identifier/
>

Thanks for pointing it out. I'll fix it up in next revision.

>> +if (!php_slot_get_id(dn, &id))
>> +return NULL;
>> +
>
>> +/* PCI bus */
>> +bus = pcibios_find_pci_bus(dn);
>
>And pcibios_find_pci_bus() (it's also powerpc-specific).
>

I'll pick Ben's suggested name if you agree: of_pci_node_to_bus().

Thanks,
Gavin


>Bjorn
>

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

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

2015-06-05 Thread Benjamin Herrenschmidt
On Fri, 2015-06-05 at 15:11 -0500, Bjorn Helgaas wrote:

> You didn't add this, but "pcibios_add_pci_devices" doesn't seem like the
> right name.  "pcibios" generally refers to an arch-specific hook that's
> called by the generic PCI core.  In this case, pcibios_add_pci_devices()
> contains powerpc-specific code, and it's only called from powerpc code, so
> I think using "pcibios_" in the name is a bit misleading.

Maybe but just calling it pci_add_* makes it easy to confuse with a core
function and ppc_add_* is gross :-)

> > +   /* Remove all devices behind the slot */
> > +   pci_lock_rescan_remove();
> > +   pcibios_remove_pci_devices(slot->bus);
> 
> Same comment for pcibios_remove_pci_devices().  It would be better if the
> name didn't suggest that this was part of the pcibios_ interface between
> the PCI core and the arch code, because it's not.
> 
> > +   /* Slot indentifier */
> 
> s/indentifier/identifier/
> 
> > +   if (!php_slot_get_id(dn, &id))
> > +   return NULL;
> > +
> 
> > +   /* PCI bus */
> > +   bus = pcibios_find_pci_bus(dn);
> 
> And pcibios_find_pci_bus() (it's also powerpc-specific).

This one could actually move to of_pci.c and be generic, something like
of_pci_node_to_bus()

Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

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

2015-06-05 Thread Bjorn Helgaas
On Thu, Jun 04, 2015 at 04:42:11PM +1000, 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 identified hotpluggable slots and marked their device
> tree node with proper "ibm,slot-pluggable" and "ibm,reset-by-firmware".
> The driver simply scans device-tree to create/register PCI hotplug slot
> accordingly.
> 
> If the skiboot firmware doesn't support slot status retrieval, the PCI
> slot device node shouldn't have property "ibm,reset-by-firmware". In
> that case, none of valid PCI slots will be detected from device tree.
> 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 

But I do have a few comments (my ack is valid whether you do anything with
them or not):

> +static void slot_power_off_handler(struct powernv_php_slot *slot)
> +{
> + int ret;
> +
> + /* Release the firmware data for the child device nodes */
> + remove_child_pdn(slot->dn);
> +
> + /*
> +  * Release the child device nodes. If the sub-tree was
> +  * built with the help of overlay, we just need revert
> +  * the changes introduced by the overlay
> +  */
> + if (slot->overlay_id >= 0) {
> + ret = of_overlay_destroy(slot->overlay_id);
> + if (ret)
> + pr_warn("%s: Error %d destroying overlay %d\n",
> + __func__, ret, slot->overlay_id);

For this and similar messages: isn't there a device you can use with
dev_warn() here?  I think a device name would be much better than a
function name.

> +scan:
> + switch (presence) {
> + case POWERNV_PHP_SLOT_PRESENT:
> + if (rescan) {
> + pci_lock_rescan_remove();
> + pcibios_add_pci_devices(slot->bus);

You didn't add this, but "pcibios_add_pci_devices" doesn't seem like the
right name.  "pcibios" generally refers to an arch-specific hook that's
called by the generic PCI core.  In this case, pcibios_add_pci_devices()
contains powerpc-specific code, and it's only called from powerpc code, so
I think using "pcibios_" in the name is a bit misleading.

> + /* Remove all devices behind the slot */
> + pci_lock_rescan_remove();
> + pcibios_remove_pci_devices(slot->bus);

Same comment for pcibios_remove_pci_devices().  It would be better if the
name didn't suggest that this was part of the pcibios_ interface between
the PCI core and the arch code, because it's not.

> + /* Slot indentifier */

s/indentifier/identifier/

> + if (!php_slot_get_id(dn, &id))
> + return NULL;
> +

> + /* PCI bus */
> + bus = pcibios_find_pci_bus(dn);

And pcibios_find_pci_bus() (it's also powerpc-specific).

Bjorn
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

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

2015-06-03 Thread Gavin Shan
The patch intends to add standalone driver to support PCI hotplug
for PowerPC PowerNV platform, which runs on top of skiboot firmware.
The firmware identified hotpluggable slots and marked their device
tree node with proper "ibm,slot-pluggable" and "ibm,reset-by-firmware".
The driver simply scans device-tree to create/register PCI hotplug slot
accordingly.

If the skiboot firmware doesn't support slot status retrieval, the PCI
slot device node shouldn't have property "ibm,reset-by-firmware". In
that case, none of valid PCI slots will be detected from device tree.
The skiboot firmware doesn't export the capability to access attention
LEDs yet and it's something for TBD.

Signed-off-by: Gavin Shan 
---
v5:
  * Use OF OVERLAY to update the device-tree
  * Removed unnecessary header files
  * More meaningful return value from powernv_php_register_one()
  * Use pnv_pci_hotplug_notifier_{register, unregister}()
  * Decimal values for slot's states
  * Removed struct powernv_php_slot::release()
  * Merged two bool arguments to one for powernv_php_slot_enable()
  * Rename release_device_nodes_info() to remove_device_nodes_info()
  * Don't check on "!len" in slot_power_on_handler()
  * Handle return value in get_adapter_status() as suggested by aik
  * Drop invalid attention status in set_attention_status()
  * Renaming functions
  * Fixed coding style and added entry in MAINTAINERS reported by
checkpatch.pl
---
 MAINTAINERS|   6 +
 drivers/pci/hotplug/Kconfig|  12 +
 drivers/pci/hotplug/Makefile   |   4 +
 drivers/pci/hotplug/powernv_php.c  | 140 +++
 drivers/pci/hotplug/powernv_php.h  |  90 
 drivers/pci/hotplug/powernv_php_slot.c | 732 +
 6 files changed, 984 insertions(+)
 create mode 100644 drivers/pci/hotplug/powernv_php.c
 create mode 100644 drivers/pci/hotplug/powernv_php.h
 create mode 100644 drivers/pci/hotplug/powernv_php_slot.c

diff --git a/MAINTAINERS b/MAINTAINERS
index e308718..f5e1dce 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7481,6 +7481,12 @@ L:   linux-...@vger.kernel.org
 S: Supported
 F: Documentation/PCI/pci-error-recovery.txt
 
+PCI HOTPLUG DRIVER FOR POWERNV PLATFORM
+M: Gavin Shan 
+L: linux-...@vger.kernel.org
+S: Supported
+F: drivers/pci/hotplug/powernv_php*
+
 PCI SUBSYSTEM
 M: Bjorn Helgaas 
 L: linux-...@vger.kernel.org
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig
index df8caec..ef55dae 100644
--- a/drivers/pci/hotplug/Kconfig
+++ b/drivers/pci/hotplug/Kconfig
@@ -113,6 +113,18 @@ config HOTPLUG_PCI_SHPC
 
  When in doubt, say N.
 
+config HOTPLUG_PCI_POWERNV
+   tristate "PowerPC PowerNV PCI Hotplug driver"
+   depends on PPC_POWERNV && EEH
+   help
+ Say Y here if you run PowerPC PowerNV platform that supports
+  PCI Hotplug
+
+ To compile this driver as a module, choose M here: the
+ module will be called powernv-php.
+
+ When in doubt, say N.
+
 config HOTPLUG_PCI_RPA
tristate "RPA PCI Hotplug driver"
depends on PPC_PSERIES && EEH
diff --git a/drivers/pci/hotplug/Makefile b/drivers/pci/hotplug/Makefile
index 4a9aa08..a69665e 100644
--- a/drivers/pci/hotplug/Makefile
+++ b/drivers/pci/hotplug/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_HOTPLUG_PCI_PCIE)+= pciehp.o
 obj-$(CONFIG_HOTPLUG_PCI_CPCI_ZT5550)  += cpcihp_zt5550.o
 obj-$(CONFIG_HOTPLUG_PCI_CPCI_GENERIC) += cpcihp_generic.o
 obj-$(CONFIG_HOTPLUG_PCI_SHPC) += shpchp.o
+obj-$(CONFIG_HOTPLUG_PCI_POWERNV)  += powernv-php.o
 obj-$(CONFIG_HOTPLUG_PCI_RPA)  += rpaphp.o
 obj-$(CONFIG_HOTPLUG_PCI_RPA_DLPAR)+= rpadlpar_io.o
 obj-$(CONFIG_HOTPLUG_PCI_SGI)  += sgi_hotplug.o
@@ -50,6 +51,9 @@ ibmphp-objs   :=  ibmphp_core.o   \
 acpiphp-objs   :=  acpiphp_core.o  \
acpiphp_glue.o
 
+powernv-php-objs   :=  powernv_php.o   \
+   powernv_php_slot.o
+
 rpaphp-objs:=  rpaphp_core.o   \
rpaphp_pci.o\
rpaphp_slot.o
diff --git a/drivers/pci/hotplug/powernv_php.c 
b/drivers/pci/hotplug/powernv_php.c
new file mode 100644
index 000..4cbff7a
--- /dev/null
+++ b/drivers/pci/hotplug/powernv_php.c
@@ -0,0 +1,140 @@
+/*
+ * PCI Hotplug Driver for PowerPC PowerNV platform.
+ *
+ * Copyright Gavin Shan, IBM Corporation 2015.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+
+#include 
+#include 
+
+#include "powernv_php.h"
+
+#define DRIVER_VERSION "0.1"
+#define DRIVER_AUTHOR  "Gavin Shan, IBM Corporation"
+#define DRIVER_DESC"PowerPC PowerNV PCI Hotplug Driver"
+
+