diff mbox

[part2,6/6] PCI: Claim hw/fw allocated resources in hot add path.

Message ID 1346622653-30741-7-git-send-email-yinghai@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Yinghai Lu Sept. 2, 2012, 9:50 p.m. UTC
During testing remove/rescan root bus 00, found
[  338.142574] bus: 'pci': really_probe: probing driver ata_piix with device 0000:00:01.1
[  338.146788] ata_piix 0000:00:01.1: device not available (can't reserve [io  0x01f0-0x01f7])
[  338.150565] ata_piix: probe of 0000:00:01.1 failed with error -22

because that fixed resource is not claimed from
        arch/x86/pci/i386.c::pcibios_allocate_resources()
that is init path.

Try to claim those resources, so on the remove/rescan will still use old
resources.

It is some kind honoring HW/FW setting in the registers during hot add.
esp root-bus hot add is through acpi, BIOS have chance to set some register
for us.

-v2: add rom resource claiming.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 arch/x86/pci/i386.c |   28 +++++++++++++++++++++-------
 drivers/pci/bus.c   |    2 ++
 include/linux/pci.h |    1 +
 3 files changed, 24 insertions(+), 7 deletions(-)

Comments

Bjorn Helgaas Sept. 18, 2012, 12:12 a.m. UTC | #1
On Sun, Sep 2, 2012 at 3:50 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> During testing remove/rescan root bus 00, found
> [  338.142574] bus: 'pci': really_probe: probing driver ata_piix with device 0000:00:01.1
> [  338.146788] ata_piix 0000:00:01.1: device not available (can't reserve [io  0x01f0-0x01f7])
> [  338.150565] ata_piix: probe of 0000:00:01.1 failed with error -22
>
> because that fixed resource is not claimed from
>         arch/x86/pci/i386.c::pcibios_allocate_resources()
> that is init path.
>
> Try to claim those resources, so on the remove/rescan will still use old
> resources.
>
> It is some kind honoring HW/FW setting in the registers during hot add.
> esp root-bus hot add is through acpi, BIOS have chance to set some register
> for us.
>
> -v2: add rom resource claiming.
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> ---
>  arch/x86/pci/i386.c |   28 +++++++++++++++++++++-------
>  drivers/pci/bus.c   |    2 ++
>  include/linux/pci.h |    1 +
>  3 files changed, 24 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
> index abf2a61..3cb7d66 100644
> --- a/arch/x86/pci/i386.c
> +++ b/arch/x86/pci/i386.c
> @@ -201,13 +201,15 @@ EXPORT_SYMBOL(pcibios_align_resource);
>   *         as well.
>   */
>
> -static void __init pcibios_allocate_bridge_resources(struct pci_dev *dev)
> +static void pcibios_allocate_bridge_resources(struct pci_dev *dev)

This patch has a little too much going on at the same time.  Can you
split the __init removal into its own patch so we can focus on what's
left by itself?

>  {
>         int idx;
>         struct resource *r;
>
>         for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
>                 r = &dev->resource[idx];
> +               if (r->parent)  /* Already allocated */
> +                       continue;

This is also a potentially interesting change that maybe should be in
its own patch.

>                 if (!r->flags)
>                         continue;
>                 if (!r->start || pci_claim_resource(dev, idx) < 0) {
> @@ -223,7 +225,7 @@ static void __init pcibios_allocate_bridge_resources(struct pci_dev *dev)
>         }
>  }
>
> -static void __init pcibios_allocate_bus_resources(struct pci_bus *bus)
> +static void pcibios_allocate_bus_resources(struct pci_bus *bus)
>  {
>         struct pci_bus *child;
>
> @@ -239,7 +241,7 @@ struct pci_check_idx_range {
>         int end;
>  };
>
> -static void __init pcibios_allocate_dev_resources(struct pci_dev *dev, int pass)
> +static void pcibios_allocate_dev_resources(struct pci_dev *dev, int pass)
>  {
>         int idx, disabled, i;
>         u16 command;
> @@ -292,7 +294,7 @@ static void __init pcibios_allocate_dev_resources(struct pci_dev *dev, int pass)
>         }
>  }
>
> -static void __init pcibios_allocate_resources(struct pci_bus *bus, int pass)
> +static void pcibios_allocate_resources(struct pci_bus *bus, int pass)
>  {
>         struct pci_dev *dev;
>         struct pci_bus *child;
> @@ -306,7 +308,7 @@ static void __init pcibios_allocate_resources(struct pci_bus *bus, int pass)
>         }
>  }
>
> -static void __init pcibios_allocate_dev_rom_resource(struct pci_dev *dev)
> +static void pcibios_allocate_dev_rom_resource(struct pci_dev *dev)
>  {
>         struct resource *r;
>
> @@ -324,7 +326,7 @@ static void __init pcibios_allocate_dev_rom_resource(struct pci_dev *dev)
>                 r->start = 0;
>         }
>  }
> -static void __init __pcibios_allocate_rom_resources(struct pci_bus *bus)
> +static void __pcibios_allocate_rom_resources(struct pci_bus *bus)
>  {
>         struct pci_dev *dev;
>         struct pci_bus *child;
> @@ -337,7 +339,7 @@ static void __init __pcibios_allocate_rom_resources(struct pci_bus *bus)
>                         __pcibios_allocate_rom_resources(child);
>         }
>  }
> -static void __init pcibios_allocate_rom_resources(struct pci_bus *bus)
> +static void pcibios_allocate_rom_resources(struct pci_bus *bus)
>  {
>         if (pci_probe & PCI_ASSIGN_ROMS)
>                 return;
> @@ -358,6 +360,18 @@ static int __init pcibios_assign_resources(void)
>         return 0;
>  }
>
> +void pcibios_resource_survey_bus(struct pci_bus *bus)
> +{
> +       dev_printk(KERN_DEBUG, &bus->dev, "Allocating resources\n");
> +
> +       pcibios_allocate_bus_resources(bus);
> +
> +       pcibios_allocate_resources(bus, 0);
> +       pcibios_allocate_resources(bus, 1);
> +
> +       pcibios_allocate_rom_resources(bus);
> +}
> +
>  void __init pcibios_resource_survey(void)

I wish pcibios_resource_survey() could look like this:

    void __init pcibios_resource_survey(void)
    {
        list_for_each_entry(bus, &pci_root_buses, node)
            pcibios_resource_survey_bus(bus)

        e820_reserve_resources_late();
        ...

but maybe there's a reason why pcibios_allocate_rom_resources() really
has to be in the pcibios_assign_resources() fs_initcall rather than in
pcibios_resource_survey().

>  {
>         struct pci_bus *bus;
> diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
> index 4b0970b..2882d01 100644
> --- a/drivers/pci/bus.c
> +++ b/drivers/pci/bus.c
> @@ -154,6 +154,8 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
>         return ret;
>  }
>
> +void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { }
> +
>  /**
>   * pci_bus_add_device - add a single device
>   * @dev: device to add
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 1b460e1..29a4704 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -676,6 +676,7 @@ extern struct list_head pci_root_buses;     /* list of all known PCI buses */
>  /* Some device drivers need know if pci is initiated */
>  extern int no_pci_devices(void);
>
> +void pcibios_resource_survey_bus(struct pci_bus *bus);
>  void pcibios_fixup_bus(struct pci_bus *);
>  int __must_check pcibios_enable_device(struct pci_dev *, int mask);
>  /* Architecture specific versions may override this (weak) */
> --
> 1.7.7
>
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yinghai Lu Sept. 18, 2012, 4:44 a.m. UTC | #2
On Mon, Sep 17, 2012 at 5:12 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> On Sun, Sep 2, 2012 at 3:50 PM, Yinghai Lu <yinghai@kernel.org> wrote:

>> -static void __init pcibios_allocate_bridge_resources(struct pci_dev *dev)
>> +static void pcibios_allocate_bridge_resources(struct pci_dev *dev)
>
> This patch has a little too much going on at the same time.  Can you
> split the __init removal into its own patch so we can focus on what's
> left by itself?

ok.

>
>>  {
>>         int idx;
>>         struct resource *r;
>>
>>         for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
>>                 r = &dev->resource[idx];
>> +               if (r->parent)  /* Already allocated */
>> +                       continue;
>
> This is also a potentially interesting change that maybe should be in
> its own patch.

oh, we don't need that extra checking anymore. because support
removing non-root bus is dropped.

>> +void pcibios_resource_survey_bus(struct pci_bus *bus)
>> +{
>> +       dev_printk(KERN_DEBUG, &bus->dev, "Allocating resources\n");
>> +
>> +       pcibios_allocate_bus_resources(bus);
>> +
>> +       pcibios_allocate_resources(bus, 0);
>> +       pcibios_allocate_resources(bus, 1);
>> +
>> +       pcibios_allocate_rom_resources(bus);
>> +}
>> +
>>  void __init pcibios_resource_survey(void)
>
> I wish pcibios_resource_survey() could look like this:
>
>     void __init pcibios_resource_survey(void)
>     {
>         list_for_each_entry(bus, &pci_root_buses, node)
>             pcibios_resource_survey_bus(bus)
>
>         e820_reserve_resources_late();
>         ...
>
> but maybe there's a reason why pcibios_allocate_rom_resources() really
> has to be in the pcibios_assign_resources() fs_initcall rather than in
> pcibios_resource_survey().

that should be another patch later.

Thanks

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yinghai Lu Sept. 18, 2012, 5:36 a.m. UTC | #3
On Mon, Sep 17, 2012 at 9:44 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> On Mon, Sep 17, 2012 at 5:12 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
>> On Sun, Sep 2, 2012 at 3:50 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>
>>> -static void __init pcibios_allocate_bridge_resources(struct pci_dev *dev)
>>> +static void pcibios_allocate_bridge_resources(struct pci_dev *dev)
>>
>> This patch has a little too much going on at the same time.  Can you
>> split the __init removal into its own patch so we can focus on what's
>> left by itself?
>
> ok.
>
>>
>>>  {
>>>         int idx;
>>>         struct resource *r;
>>>
>>>         for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
>>>                 r = &dev->resource[idx];
>>> +               if (r->parent)  /* Already allocated */
>>> +                       continue;
>>
>> This is also a potentially interesting change that maybe should be in
>> its own patch.
>
> oh, we don't need that extra checking anymore. because support
> removing non-root bus is dropped.

I updated for-pci-root-bus-hotplug-part2.

http://git.kernel.org/?p=linux/kernel/git/yinghai/linux-yinghai.git;a=shortlog;h=refs/heads/for-pci-root-bus-hotplug-part2

Thanks

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yinghai Lu Sept. 19, 2012, 6:54 p.m. UTC | #4
It supports pci root bus removal with
	echo "PCI0 3" > /sys/kernel/debug/acpi/sci_notify

add with
	echo "PCI0 0" > /sys/kernel/debug/acpi/sci_notify

based on pci/next

We need to separate pci root bus add from acpiphp. so user could only root bus
hotplug and pciehp that will make system fw simple.
Also later CONFIG_HOTPLUG will be removed, so pci root bus hotplug will be
enabled by default and user still need select acpiphp and pciehp for normal
pci device hotplug support.

could get from
        git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git for-pci-root-bus-hotplug

-v6: do not depend on busn-alloc anymore.

part1: cleanup for pci/next
[PATCH 01/40] PCI: fix default vga ref_count
[PATCH 02/40] PCI, x86: clear initial value for root info resources
[PATCH 03/40] PCI, ia64: clear initial value for root info resources
[PATCH 04/40] PCI, acpiphp: Add is_hotplug_bridge detection
[PATCH 05/40] PCI: Add root bus children dev's res to fail list
[PATCH 06/40] PCI: Split out stop_bus_device and remove_bus_dev

part2: reserve BIOS allocated resource for hotadd root bus
[PATCH 07/40] x86, PCI: Separate pcibios_allocate_bridge_resources()
[PATCH 08/40] x86, PCI: Separate pcibios_allocate_dev_resources()
[PATCH 09/40] x86, PCI: Let pcibios_allocate_bus_resources() take us instead
[PATCH 10/40] x86, PCI: Separate rom resource claim out
[PATCH 11/40] PCI, x86: Add pcibios_fw_addr_done
[PATCH 12/40] PCI, x86: Remove __init for hw/fw allocated functions
[PATCH 13/40] PCI: Claim hw/fw allocated resources in hot add path.

part3: pci_assign_unsissigned_bus_resources() for root bus add.
[PATCH 14/40] PCI: Separate out pci_assign_unassigned_bus_resources()
[PATCH 15/40] PCI: Move back pci_rescan_bus() to probe.c
[PATCH 16/40] PCI: pci_bus_size_bridges() should not size own bridge
[PATCH 17/40] PCI: Use __pci_bus_size_bridges() directly in pci_assign_unassigned_bus_resources()
[PATCH 18/40] PCI: Rescan bus using callback method too
[PATCH 19/40] PCI, sysfs: Clean up rescan/remove with schedule_callback

part4: Separate root bus add from acpiphp and add removal support.
[PATCH 20/40] PCI: Fix a device reference count leakage issue in
[PATCH 21/40] PCI: Add pci_stop_and_remove_root_bus()
[PATCH 22/40] PCI, acpiphp: Separate out hot-add support of pci host
[PATCH 23/40] PCI, ACPI: Pass device instead of handle when config
[PATCH 24/40] PCI, acpi: Update acpi_pci_driver add/remove interface
[PATCH 25/40] PCI, ACPI: Make acpi_pci_root_remove remove pci root
[PATCH 26/40] PCI, ACPI: del root bus prt
[PATCH 27/40] ACPI: acpi_bus_trim to support two steps.
[PATCH 28/40] PCI, ACPI: Add pci_root_hp hot removal notification
[PATCH 29/40] PCI, ACPI: Add alloc_acpi_hp_work()
[PATCH 30/40] PCI, acpiphp: Use acpi_hp_work
[PATCH 31/40] PCI, pci_root_hp: Use acpi_hp_work
[PATCH 32/40] PCI, ACPI: Make kacpi_hotplug_wq static

part5: add/remove calling for acpi_pci_drivers.
[PATCH 33/40] ACPI, PCI: Use normal list for struct acpi_pci_driver
[PATCH 34/40] ACPI, PCI: Notify acpi_pci_drivers when hot-plugging
[PATCH 35/40] ACPI, PCI: Protect global lists in
[PATCH 36/40] PCI: Set dev_node early for pci_dev
[PATCH 37/40] PCI, x86: Move pci_enable_bridges() down
[PATCH 38/40] ACPI, PCI: Skip extra pci_enable_bridges for non
[PATCH 39/40] PCI, acpiphp: Don't ailout even no slots found yet.

part6: acpi add/remove simulation
[PATCH 40/40] ACPI: Enable SCI_EMULATE to manually simulate physical

 arch/ia64/pci/pci.c                |    3 +-
 arch/x86/pci/acpi.c                |    3 +-
 arch/x86/pci/i386.c                |  185 ++++++++++++++++--------
 drivers/acpi/Kconfig               |   10 ++
 drivers/acpi/Makefile              |    2 +
 drivers/acpi/osl.c                 |   24 +++-
 drivers/acpi/pci_root.c            |  123 ++++++++++------
 drivers/acpi/pci_root_hp.c         |  278 ++++++++++++++++++++++++++++++++++++
 drivers/acpi/pci_slot.c            |   12 +-
 drivers/acpi/scan.c                |    5 +-
 drivers/acpi/sci_emu.c             |  145 +++++++++++++++++++
 drivers/gpu/vga/vgaarb.c           |   14 ++-
 drivers/pci/bus.c                  |    2 +
 drivers/pci/hotplug/acpiphp.h      |    1 -
 drivers/pci/hotplug/acpiphp_core.c |   23 +---
 drivers/pci/hotplug/acpiphp_glue.c |  165 +++++++--------------
 drivers/pci/pci-sysfs.c            |   41 ++++--
 drivers/pci/probe.c                |   26 ++++-
 drivers/pci/remove.c               |   87 +++++++++--
 drivers/pci/search.c               |   10 +-
 drivers/pci/setup-bus.c            |   54 +++-----
 include/acpi/acpi_bus.h            |    1 +
 include/acpi/acpiosxf.h            |    9 +-
 include/linux/acpi.h               |    6 +-
 include/linux/pci.h                |    5 +
 25 files changed, 899 insertions(+), 335 deletions(-)
 create mode 100644 drivers/acpi/pci_root_hp.c
 create mode 100644 drivers/acpi/sci_emu.c
Yijing Wang Oct. 17, 2012, 7:50 a.m. UTC | #5
On 2012/9/20 2:54, Yinghai Lu wrote:

Hi Yinghai,
   I applied this series patches to the latest pci-next, but git am fail occured.
When I try to pull from for-pci-root-bus-hotplug branch, I found some patches missed(eg. SCI_EMULATE).
Where can I get the newest pci root bus hotplug patches?

Thanks!
Yijing

> It supports pci root bus removal with
> 	echo "PCI0 3" > /sys/kernel/debug/acpi/sci_notify
> 
> add with
> 	echo "PCI0 0" > /sys/kernel/debug/acpi/sci_notify
> 
> based on pci/next
> 
> We need to separate pci root bus add from acpiphp. so user could only root bus
> hotplug and pciehp that will make system fw simple.
> Also later CONFIG_HOTPLUG will be removed, so pci root bus hotplug will be
> enabled by default and user still need select acpiphp and pciehp for normal
> pci device hotplug support.
> 
> could get from
>         git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git for-pci-root-bus-hotplug
> 
> -v6: do not depend on busn-alloc anymore.
> 
> part1: cleanup for pci/next
> [PATCH 01/40] PCI: fix default vga ref_count
> [PATCH 02/40] PCI, x86: clear initial value for root info resources
> [PATCH 03/40] PCI, ia64: clear initial value for root info resources
> [PATCH 04/40] PCI, acpiphp: Add is_hotplug_bridge detection
> [PATCH 05/40] PCI: Add root bus children dev's res to fail list
> [PATCH 06/40] PCI: Split out stop_bus_device and remove_bus_dev
> 
> part2: reserve BIOS allocated resource for hotadd root bus
> [PATCH 07/40] x86, PCI: Separate pcibios_allocate_bridge_resources()
> [PATCH 08/40] x86, PCI: Separate pcibios_allocate_dev_resources()
> [PATCH 09/40] x86, PCI: Let pcibios_allocate_bus_resources() take us instead
> [PATCH 10/40] x86, PCI: Separate rom resource claim out
> [PATCH 11/40] PCI, x86: Add pcibios_fw_addr_done
> [PATCH 12/40] PCI, x86: Remove __init for hw/fw allocated functions
> [PATCH 13/40] PCI: Claim hw/fw allocated resources in hot add path.
> 
> part3: pci_assign_unsissigned_bus_resources() for root bus add.
> [PATCH 14/40] PCI: Separate out pci_assign_unassigned_bus_resources()
> [PATCH 15/40] PCI: Move back pci_rescan_bus() to probe.c
> [PATCH 16/40] PCI: pci_bus_size_bridges() should not size own bridge
> [PATCH 17/40] PCI: Use __pci_bus_size_bridges() directly in pci_assign_unassigned_bus_resources()
> [PATCH 18/40] PCI: Rescan bus using callback method too
> [PATCH 19/40] PCI, sysfs: Clean up rescan/remove with schedule_callback
> 
> part4: Separate root bus add from acpiphp and add removal support.
> [PATCH 20/40] PCI: Fix a device reference count leakage issue in
> [PATCH 21/40] PCI: Add pci_stop_and_remove_root_bus()
> [PATCH 22/40] PCI, acpiphp: Separate out hot-add support of pci host
> [PATCH 23/40] PCI, ACPI: Pass device instead of handle when config
> [PATCH 24/40] PCI, acpi: Update acpi_pci_driver add/remove interface
> [PATCH 25/40] PCI, ACPI: Make acpi_pci_root_remove remove pci root
> [PATCH 26/40] PCI, ACPI: del root bus prt
> [PATCH 27/40] ACPI: acpi_bus_trim to support two steps.
> [PATCH 28/40] PCI, ACPI: Add pci_root_hp hot removal notification
> [PATCH 29/40] PCI, ACPI: Add alloc_acpi_hp_work()
> [PATCH 30/40] PCI, acpiphp: Use acpi_hp_work
> [PATCH 31/40] PCI, pci_root_hp: Use acpi_hp_work
> [PATCH 32/40] PCI, ACPI: Make kacpi_hotplug_wq static
> 
> part5: add/remove calling for acpi_pci_drivers.
> [PATCH 33/40] ACPI, PCI: Use normal list for struct acpi_pci_driver
> [PATCH 34/40] ACPI, PCI: Notify acpi_pci_drivers when hot-plugging
> [PATCH 35/40] ACPI, PCI: Protect global lists in
> [PATCH 36/40] PCI: Set dev_node early for pci_dev
> [PATCH 37/40] PCI, x86: Move pci_enable_bridges() down
> [PATCH 38/40] ACPI, PCI: Skip extra pci_enable_bridges for non
> [PATCH 39/40] PCI, acpiphp: Don't ailout even no slots found yet.
> 
> part6: acpi add/remove simulation
> [PATCH 40/40] ACPI: Enable SCI_EMULATE to manually simulate physical
> 
>  arch/ia64/pci/pci.c                |    3 +-
>  arch/x86/pci/acpi.c                |    3 +-
>  arch/x86/pci/i386.c                |  185 ++++++++++++++++--------
>  drivers/acpi/Kconfig               |   10 ++
>  drivers/acpi/Makefile              |    2 +
>  drivers/acpi/osl.c                 |   24 +++-
>  drivers/acpi/pci_root.c            |  123 ++++++++++------
>  drivers/acpi/pci_root_hp.c         |  278 ++++++++++++++++++++++++++++++++++++
>  drivers/acpi/pci_slot.c            |   12 +-
>  drivers/acpi/scan.c                |    5 +-
>  drivers/acpi/sci_emu.c             |  145 +++++++++++++++++++
>  drivers/gpu/vga/vgaarb.c           |   14 ++-
>  drivers/pci/bus.c                  |    2 +
>  drivers/pci/hotplug/acpiphp.h      |    1 -
>  drivers/pci/hotplug/acpiphp_core.c |   23 +---
>  drivers/pci/hotplug/acpiphp_glue.c |  165 +++++++--------------
>  drivers/pci/pci-sysfs.c            |   41 ++++--
>  drivers/pci/probe.c                |   26 ++++-
>  drivers/pci/remove.c               |   87 +++++++++--
>  drivers/pci/search.c               |   10 +-
>  drivers/pci/setup-bus.c            |   54 +++-----
>  include/acpi/acpi_bus.h            |    1 +
>  include/acpi/acpiosxf.h            |    9 +-
>  include/linux/acpi.h               |    6 +-
>  include/linux/pci.h                |    5 +
>  25 files changed, 899 insertions(+), 335 deletions(-)
>  create mode 100644 drivers/acpi/pci_root_hp.c
>  create mode 100644 drivers/acpi/sci_emu.c
>
Yinghai Lu Oct. 17, 2012, 4:19 p.m. UTC | #6
On Wed, Oct 17, 2012 at 12:50 AM, Yijing Wang <wangyijing@huawei.com> wrote:
> On 2012/9/20 2:54, Yinghai Lu wrote:
>
> Hi Yinghai,
>    I applied this series patches to the latest pci-next, but git am fail occured.
> When I try to pull from for-pci-root-bus-hotplug branch, I found some patches missed(eg. SCI_EMULATE).
> Where can I get the newest pci root bus hotplug patches?

should be
for-pci-split-pci-root-hp-2
or
for-pci-next-2
branch.

but
>> part6: acpi add/remove simulation
>> [PATCH 40/40] ACPI: Enable SCI_EMULATE to manually simulate physical

is not in. you need to apply that separately.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yijing Wang Oct. 18, 2012, 12:51 a.m. UTC | #7
On 2012/10/18 0:19, Yinghai Lu wrote:
> On Wed, Oct 17, 2012 at 12:50 AM, Yijing Wang <wangyijing@huawei.com> wrote:
>> On 2012/9/20 2:54, Yinghai Lu wrote:
>>
>> Hi Yinghai,
>>    I applied this series patches to the latest pci-next, but git am fail occured.
>> When I try to pull from for-pci-root-bus-hotplug branch, I found some patches missed(eg. SCI_EMULATE).
>> Where can I get the newest pci root bus hotplug patches?
> 
> should be
> for-pci-split-pci-root-hp-2
> or
> for-pci-next-2
> branch.
> 
> but
>>> part6: acpi add/remove simulation
>>> [PATCH 40/40] ACPI: Enable SCI_EMULATE to manually simulate physical
> 
> is not in. you need to apply that separately.
> 

OK, Thanks!

> .
>
diff mbox

Patch

diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index abf2a61..3cb7d66 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -201,13 +201,15 @@  EXPORT_SYMBOL(pcibios_align_resource);
  *	    as well.
  */
 
-static void __init pcibios_allocate_bridge_resources(struct pci_dev *dev)
+static void pcibios_allocate_bridge_resources(struct pci_dev *dev)
 {
 	int idx;
 	struct resource *r;
 
 	for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
 		r = &dev->resource[idx];
+		if (r->parent)	/* Already allocated */
+			continue;
 		if (!r->flags)
 			continue;
 		if (!r->start || pci_claim_resource(dev, idx) < 0) {
@@ -223,7 +225,7 @@  static void __init pcibios_allocate_bridge_resources(struct pci_dev *dev)
 	}
 }
 
-static void __init pcibios_allocate_bus_resources(struct pci_bus *bus)
+static void pcibios_allocate_bus_resources(struct pci_bus *bus)
 {
 	struct pci_bus *child;
 
@@ -239,7 +241,7 @@  struct pci_check_idx_range {
 	int end;
 };
 
-static void __init pcibios_allocate_dev_resources(struct pci_dev *dev, int pass)
+static void pcibios_allocate_dev_resources(struct pci_dev *dev, int pass)
 {
 	int idx, disabled, i;
 	u16 command;
@@ -292,7 +294,7 @@  static void __init pcibios_allocate_dev_resources(struct pci_dev *dev, int pass)
 	}
 }
 
-static void __init pcibios_allocate_resources(struct pci_bus *bus, int pass)
+static void pcibios_allocate_resources(struct pci_bus *bus, int pass)
 {
 	struct pci_dev *dev;
 	struct pci_bus *child;
@@ -306,7 +308,7 @@  static void __init pcibios_allocate_resources(struct pci_bus *bus, int pass)
 	}
 }
 
-static void __init pcibios_allocate_dev_rom_resource(struct pci_dev *dev)
+static void pcibios_allocate_dev_rom_resource(struct pci_dev *dev)
 {
 	struct resource *r;
 
@@ -324,7 +326,7 @@  static void __init pcibios_allocate_dev_rom_resource(struct pci_dev *dev)
 		r->start = 0;
 	}
 }
-static void __init __pcibios_allocate_rom_resources(struct pci_bus *bus)
+static void __pcibios_allocate_rom_resources(struct pci_bus *bus)
 {
 	struct pci_dev *dev;
 	struct pci_bus *child;
@@ -337,7 +339,7 @@  static void __init __pcibios_allocate_rom_resources(struct pci_bus *bus)
 			__pcibios_allocate_rom_resources(child);
 	}
 }
-static void __init pcibios_allocate_rom_resources(struct pci_bus *bus)
+static void pcibios_allocate_rom_resources(struct pci_bus *bus)
 {
 	if (pci_probe & PCI_ASSIGN_ROMS)
 		return;
@@ -358,6 +360,18 @@  static int __init pcibios_assign_resources(void)
 	return 0;
 }
 
+void pcibios_resource_survey_bus(struct pci_bus *bus)
+{
+	dev_printk(KERN_DEBUG, &bus->dev, "Allocating resources\n");
+
+	pcibios_allocate_bus_resources(bus);
+
+	pcibios_allocate_resources(bus, 0);
+	pcibios_allocate_resources(bus, 1);
+
+	pcibios_allocate_rom_resources(bus);
+}
+
 void __init pcibios_resource_survey(void)
 {
 	struct pci_bus *bus;
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index 4b0970b..2882d01 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -154,6 +154,8 @@  pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
 	return ret;
 }
 
+void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { }
+
 /**
  * pci_bus_add_device - add a single device
  * @dev: device to add
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 1b460e1..29a4704 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -676,6 +676,7 @@  extern struct list_head pci_root_buses;	/* list of all known PCI buses */
 /* Some device drivers need know if pci is initiated */
 extern int no_pci_devices(void);
 
+void pcibios_resource_survey_bus(struct pci_bus *bus);
 void pcibios_fixup_bus(struct pci_bus *);
 int __must_check pcibios_enable_device(struct pci_dev *, int mask);
 /* Architecture specific versions may override this (weak) */