Message ID | 20120903170442.c406455c.izumi.taku@jp.fujitsu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
> -----Original Message----- > From: Taku Izumi [mailto:izumi.taku@jp.fujitsu.com] > Sent: Monday, September 03, 2012 5:05 PM > To: Izumi, Taku/? ? > Cc: linux-pci@vger.kernel.org; bhelgaas@google.com; > linux-acpi@vger.kernel.org; Kaneshige, Kenji/?? ??; > yinghai@kernel.org; jiang.liu@huawei.com > Subject: [PATCH v2 2/6] ACPI, PCI: Notify acpi_pci_drivers when > hot-plugging PCI root bridges > > From: Jiang Liu <jiang.liu@huawei.com> > > ACPI, PCI: Notify acpi_pci_drivers when hot-plugging PCI root bridges > > When hot-plugging PCI root bridge, acpi_pci_drivers' add()/remove() > methods should be invoked to notify registered drivers. > > -v2: Move add calling to acpi_pci_root_start by Yinghai > > Signed-off-by: Jiang Liu <jiang.liu@huawei.com> > Signed-off-by: Yinghai Lu <yinghai@kernel.org> > Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com> > --- > drivers/acpi/pci_root.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > Index: Bjorn-next-0808/drivers/acpi/pci_root.c > =================================================================== > --- Bjorn-next-0808.orig/drivers/acpi/pci_root.c > +++ Bjorn-next-0808/drivers/acpi/pci_root.c > @@ -626,14 +626,25 @@ end: > static int acpi_pci_root_start(struct acpi_device *device) > { > struct acpi_pci_root *root = acpi_driver_data(device); > + struct acpi_pci_driver *driver; > + > + list_for_each_entry(driver, &acpi_pci_drivers, node) > + if (driver->add) > + driver->add(device->handle); > I think this (invoke .add callback for each acpi pci driver) should be done after pci_bus_add_devices(). It seems ACPI pci drivers run *after* pci_bus_add_devices() at the boot time (because no acpi pci drivers is loaded at that time). On the other hand, it seems that ACPI pci drivers run *before* pci_bus_add_devices() at the hotadd time. Those should be the same. Regards, Kenji Kaneshige > pci_bus_add_devices(root->bus); > + -- 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
On Tue, Sep 4, 2012 at 12:58 AM, Kaneshige, Kenji <kaneshige.kenji@jp.fujitsu.com> wrote: >> -v2: Move add calling to acpi_pci_root_start by Yinghai >> static int acpi_pci_root_start(struct acpi_device *device) >> { >> struct acpi_pci_root *root = acpi_driver_data(device); >> + struct acpi_pci_driver *driver; >> + >> + list_for_each_entry(driver, &acpi_pci_drivers, node) >> + if (driver->add) >> + driver->add(device->handle); >> > > I think this (invoke .add callback for each acpi pci driver) should be done > after pci_bus_add_devices(). We need to load ioapic driver and dmar driver before normal pci drivers. > > It seems ACPI pci drivers run *after* pci_bus_add_devices() at the boot time > (because no acpi pci drivers is loaded at that time). On the other hand, it > seems that ACPI pci drivers run *before* pci_bus_add_devices() at the hotadd > time. Those should be the same. for boot time, sequence : normal pci driver still get loaded after ioapic and dmar drivers. otherwise those driver will have problem to get irq and iommu work correctly. and if ioapic and dmar are static, and they will get initialized around pci device get scanned and pci_bus_add_devices get called already. but that time normal devices driver does not get registered yet. those pci drivers will get loaded (should be bounded) for pci devices when those driver get registered. 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
> -----Original Message----- > From: yhlu.kernel@gmail.com [mailto:yhlu.kernel@gmail.com] On Behalf Of > Yinghai Lu > Sent: Wednesday, September 05, 2012 4:12 AM > To: Kaneshige, Kenji/?? ?? > Cc: Izumi, Taku/? ?; linux-pci@vger.kernel.org; bhelgaas@google.com; > linux-acpi@vger.kernel.org; jiang.liu@huawei.com > Subject: Re: [PATCH v2 2/6] ACPI, PCI: Notify acpi_pci_drivers when > hot-plugging PCI root bridges > > On Tue, Sep 4, 2012 at 12:58 AM, Kaneshige, Kenji > <kaneshige.kenji@jp.fujitsu.com> wrote: > >> -v2: Move add calling to acpi_pci_root_start by Yinghai > >> static int acpi_pci_root_start(struct acpi_device *device) > >> { > >> struct acpi_pci_root *root = acpi_driver_data(device); > >> + struct acpi_pci_driver *driver; > >> + > >> + list_for_each_entry(driver, &acpi_pci_drivers, node) > >> + if (driver->add) > >> + driver->add(device->handle); > >> > > > > I think this (invoke .add callback for each acpi pci driver) should be > done > > after pci_bus_add_devices(). > > We need to load ioapic driver and dmar driver before normal pci drivers. Ok, my understanding of your comment is that IOAPIC and DMAR drivers are implemented as ACPI PCI driver (or you have a plan to implement IOAPIC and DMAR drivers as ACPI PCI driver), and those drivers need to be loaded before PCI device drivers. Is my understanding correct? Regards, Kenji Kaneshige > > > > > It seems ACPI pci drivers run *after* pci_bus_add_devices() at the boot > time > > (because no acpi pci drivers is loaded at that time). On the other hand, > it > > seems that ACPI pci drivers run *before* pci_bus_add_devices() at the > hotadd > > time. Those should be the same. > > for boot time, sequence : normal pci driver still get loaded after > ioapic and dmar drivers. > otherwise those driver will have problem to get irq and iommu work correctly. > and if ioapic and dmar are static, and they will get initialized > around pci device get scanned and pci_bus_add_devices get called > already. > but that time normal devices driver does not get registered yet. those > pci drivers will get loaded (should be bounded) > for pci devices when those driver get registered. > > 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
On Tue, Sep 4, 2012 at 9:32 PM, Kaneshige, Kenji <kaneshige.kenji@jp.fujitsu.com> wrote: > > Ok, my understanding of your comment is that IOAPIC and DMAR drivers are implemented > as ACPI PCI driver (or you have a plan to implement IOAPIC and DMAR drivers as ACPI > PCI driver), and those drivers need to be loaded before PCI device drivers. Is my > understanding correct? yes. for ioapic: http://git.kernel.org/?p=linux/kernel/git/yinghai/linux-yinghai.git;a=shortlog;h=refs/heads/for-x86-irq for iommu: http://git.kernel.org/?p=linux/kernel/git/yinghai/linux-yinghai.git;a=shortlog;h=refs/heads/for-iommu 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
> -----Original Message----- > From: yhlu.kernel@gmail.com [mailto:yhlu.kernel@gmail.com] On Behalf Of > Yinghai Lu > Sent: Wednesday, September 05, 2012 2:02 PM > To: Kaneshige, Kenji/?? ?? > Cc: Izumi, Taku/? ?; linux-pci@vger.kernel.org; bhelgaas@google.com; > linux-acpi@vger.kernel.org; jiang.liu@huawei.com > Subject: Re: [PATCH v2 2/6] ACPI, PCI: Notify acpi_pci_drivers when > hot-plugging PCI root bridges > > On Tue, Sep 4, 2012 at 9:32 PM, Kaneshige, Kenji > <kaneshige.kenji@jp.fujitsu.com> wrote: > > > > Ok, my understanding of your comment is that IOAPIC and DMAR drivers are > implemented > > as ACPI PCI driver (or you have a plan to implement IOAPIC and DMAR drivers > as ACPI > > PCI driver), and those drivers need to be loaded before PCI device drivers. > Is my > > understanding correct? > > yes. > > for ioapic: > http://git.kernel.org/?p=linux/kernel/git/yinghai/linux-yinghai.git;a= > shortlog;h=refs/heads/for-x86-irq > > for iommu: > http://git.kernel.org/?p=linux/kernel/git/yinghai/linux-yinghai.git;a= > shortlog;h=refs/heads/for-iommu > Thank you for answering. Though I've not looked at those trees yet, the idea, which utilize ACPI pci driver to load ioapic and dmar driver, looks good to me. Regards, Kenji Kaneshige -- 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
Index: Bjorn-next-0808/drivers/acpi/pci_root.c =================================================================== --- Bjorn-next-0808.orig/drivers/acpi/pci_root.c +++ Bjorn-next-0808/drivers/acpi/pci_root.c @@ -626,14 +626,25 @@ end: static int acpi_pci_root_start(struct acpi_device *device) { struct acpi_pci_root *root = acpi_driver_data(device); + struct acpi_pci_driver *driver; + + list_for_each_entry(driver, &acpi_pci_drivers, node) + if (driver->add) + driver->add(device->handle); pci_bus_add_devices(root->bus); + return 0; } static int acpi_pci_root_remove(struct acpi_device *device, int type) { struct acpi_pci_root *root = acpi_driver_data(device); + struct acpi_pci_driver *driver; + + list_for_each_entry(driver, &acpi_pci_drivers, node) + if (driver->remove) + driver->remove(root->device->handle); device_set_run_wake(root->bus->bridge, false); pci_acpi_remove_bus_pm_notifier(device);