From: Yinghai Lu <yinghai@kernel.org>
To: Taku Izumi <izumi.taku@jp.fujitsu.com>
Cc: linux-pci@vger.kernel.org, bhelgaas@google.com,
linux-acpi@vger.kernel.org, kaneshige.kenji@jp.fujitsu.com,
jiang.liu@huawei.com
Subject: Re: [PATCH v2 6/6] ACPI, PCI: add resoruce-assign code for devices under hot-added hostbridge
Date: Mon, 3 Sep 2012 13:27:11 -0700 [thread overview]
Message-ID: <CAE9FiQVXtTf3+jpbYzHk3D3VVm-bXEB9EcgkBwkEtYR-SRiKHA@mail.gmail.com> (raw)
In-Reply-To: <20120903170705.4e6dbc2c.izumi.taku@jp.fujitsu.com>
On Mon, Sep 3, 2012 at 1:07 AM, Taku Izumi <izumi.taku@jp.fujitsu.com> wrote:
>
> Devices under hot-added hostbridge have no chance to assign resources
> and to configure them, so this patch adds such code for hot-added
> hostbridges at acpi_pci_root_start().
>
> Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
> ---
> drivers/acpi/pci_root.c | 17 +++++++++++++++++
> include/acpi/acpi_bus.h | 1 +
> 2 files changed, 18 insertions(+)
>
> Index: Bjorn-next-0903/drivers/acpi/pci_root.c
> ===================================================================
> --- Bjorn-next-0903.orig/drivers/acpi/pci_root.c
> +++ Bjorn-next-0903/drivers/acpi/pci_root.c
> @@ -39,6 +39,7 @@
> #include <acpi/acpi_bus.h>
> #include <acpi/acpi_drivers.h>
> #include <acpi/apei.h>
> +#include <linux/pci_hotplug.h>
>
> #define PREFIX "ACPI: "
>
> @@ -461,6 +462,9 @@ static int __devinit acpi_pci_root_add(s
> if (!root)
> return -ENOMEM;
>
> + if (system_state != SYSTEM_BOOTING)
> + root->hot_added = true;
> +
> segment = 0;
> status = acpi_evaluate_integer(device->handle, METHOD_NAME__SEG, NULL,
> &segment);
> @@ -639,6 +643,7 @@ static int acpi_pci_root_start(struct ac
> {
> struct acpi_pci_root *root = acpi_driver_data(device);
> struct acpi_pci_driver *driver;
> + struct pci_dev *pdev;
>
> mutex_lock(&acpi_pci_root_lock);
> list_for_each_entry(driver, &acpi_pci_drivers, node)
> @@ -646,6 +651,18 @@ static int acpi_pci_root_start(struct ac
> driver->add(device->handle);
> mutex_unlock(&acpi_pci_root_lock);
>
> + /*
> + * Devices under hot-added hostbridge have no chance to assign
> + * resources and to configure them, so do that here
> + */
> + if (root->hot_added) {
> + pci_bus_size_bridges(root->bus);
> + pci_bus_assign_resources(root->bus);
> + list_for_each_entry(pdev, &root->bus->devices, bus_list)
> + pci_configure_slot(pdev);
> + pci_enable_bridges(root->bus);
> + }
> +
> pci_bus_add_devices(root->bus);
after looking at your simplified version in patch5 and patch6
found that you do not understand my patchset correctly.
in my patchset there is change on:
acpi_pci_root_add
acpi_pci_root_start
acpi_pci_root_remove
and
handle_root_bridge_insertion/acpi_root_configure_bridge
handle_root_bridge_removal
for hot add path:
handle_root_bridge_insertion will call
acpi_pci_root_add: it will scan the root bus and find all pci device
acpi_root_configure_bridge: it will survey fw set pci resource,
and assigned unsigned resource
acpi_pci_root_start: it will start acpi_pci driver for ioapic
controller and dmar iommu
then call pci_bus_add_devices to
load other pci device drivers.
for hot remove path:
acpi_pci_root_remove: will call pci_stop_bus_devices() to stop
drivers for all normal pci devices.
then stop acpi_pci driver for
dmar and ioapic driver
then call
pci_stop_and_remove_bus to remove the root bus.
the point is : keep the driver of ioapic and dmar driver loading
before normal pci drivers, and later
stop driver for dmar/iommu, after unloading pci drivers.
Thanks
Yinghai
next prev parent reply other threads:[~2012-09-03 20:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-03 7:58 [PATCH v2 0/6] acpi,pci: hostbridge hotplug support Taku Izumi
2012-09-03 8:03 ` [PATCH v2 1/6] ACPI, PCI: Use normal list for struct acpi_pci_driver Taku Izumi
2012-09-03 8:04 ` [PATCH v2 2/6] ACPI, PCI: Notify acpi_pci_drivers when hot-plugging PCI root bridges Taku Izumi
2012-09-04 7:58 ` Kaneshige, Kenji
2012-09-04 19:12 ` Yinghai Lu
2012-09-05 4:32 ` Kaneshige, Kenji
2012-09-05 5:01 ` Yinghai Lu
2012-09-05 8:55 ` Kaneshige, Kenji
2012-09-03 8:05 ` [PATCH v2 3/6] ACPI, PCI: add acpi_pci_drivers protection Taku Izumi
2012-09-03 8:06 ` [PATCH v2 4/6] ACPI, PCI: add acpi_pci_roots protection Taku Izumi
2012-09-12 23:40 ` Bjorn Helgaas
2012-09-13 19:09 ` Yinghai Lu
2012-09-13 19:39 ` Bjorn Helgaas
2012-09-13 21:17 ` Yinghai Lu
2012-09-13 22:44 ` Yinghai Lu
2012-09-14 4:35 ` Taku Izumi
2012-09-14 14:43 ` Bjorn Helgaas
2012-09-15 3:23 ` Jiang Liu
2012-09-03 8:06 ` [PATCH v2 5/6] ACPI, PCI: add hostbridge removal function Taku Izumi
2012-09-03 8:07 ` [PATCH v2 6/6] ACPI, PCI: add resoruce-assign code for devices under hot-added hostbridge Taku Izumi
2012-09-03 20:27 ` Yinghai Lu [this message]
2012-09-07 9:26 ` Taku Izumi
2012-09-07 9:31 ` Taku Izumi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAE9FiQVXtTf3+jpbYzHk3D3VVm-bXEB9EcgkBwkEtYR-SRiKHA@mail.gmail.com \
--to=yinghai@kernel.org \
--cc=bhelgaas@google.com \
--cc=izumi.taku@jp.fujitsu.com \
--cc=jiang.liu@huawei.com \
--cc=kaneshige.kenji@jp.fujitsu.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).