The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH][Regression fix] PCI / Hotplug: Always allow acpiphp to handle non-PCIe bridges
@ 2011-12-12 23:02 Rafael J. Wysocki
  2011-12-12 23:09 ` Rafael J. Wysocki
  2011-12-13 18:42 ` Jesse Barnes
  0 siblings, 2 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2011-12-12 23:02 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: LKML, Linus Torvalds, linux-pci, Kenji Kaneshige

From: Rafael J. Wysocki <rjw@sisk.pl>

Commit 0d52f54e2ef64c189dedc332e680b2eb4a34590a (PCI / ACPI: Make
acpiphp ignore root bridges using PCIe native hotplug) added code
that made the acpiphp driver completely ignore PCIe root complexes
for which the kernel had been granted control of the native PCIe
hotplug feature by the BIOS through _OSC.  Unfortunately, however,
this was a mistake, because on some systems there were PCI bridges
supporting PCI (non-PCIe) hotplug under such root complexes and
those bridges should have been handled by acpiphp.

For this reason, revert the changes made by the commit mentioned
above and make register_slot() in drivers/pci/hotplug/acpiphp_glue.c
avoid registering hotplug slots for PCIe ports that belong to
root complexes with native PCIe hotplug enabled (which means that
the BIOS has granted the kernel control of this feature for the
given root complex).  This is reported to address the original
issue fixed by commit 0d52f54e2ef64c189dedc332e680b2eb4a34590a and
to work on the system where that commit broke things.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/pci/hotplug/acpiphp_glue.c |   29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

Index: linux/drivers/pci/hotplug/acpiphp_glue.c
===================================================================
--- linux.orig/drivers/pci/hotplug/acpiphp_glue.c
+++ linux/drivers/pci/hotplug/acpiphp_glue.c
@@ -132,6 +132,18 @@ register_slot(acpi_handle handle, u32 lv
 	if (!acpi_pci_check_ejectable(pbus, handle) && !is_dock_device(handle))
 		return AE_OK;
 
+	pdev = pbus->self;
+	if (pdev && pci_is_pcie(pdev)) {
+		tmp = acpi_find_root_bridge_handle(pdev);
+		if (tmp) {
+			struct acpi_pci_root *root = acpi_pci_find_root(tmp);
+
+			if (root && (root->osc_control_set &
+					OSC_PCI_EXPRESS_NATIVE_HP_CONTROL))
+				return AE_OK;
+		}
+	}
+
 	acpi_evaluate_integer(handle, "_ADR", NULL, &adr);
 	device = (adr >> 16) & 0xffff;
 	function = adr & 0xffff;
@@ -459,17 +471,8 @@ static int add_bridge(acpi_handle handle
 {
 	acpi_status status;
 	unsigned long long tmp;
-	struct acpi_pci_root *root;
 	acpi_handle dummy_handle;
 
-	/*
-	 * We shouldn't use this bridge if PCIe native hotplug control has been
-	 * granted by the BIOS for it.
-	 */
-	root = acpi_pci_find_root(handle);
-	if (root && (root->osc_control_set & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL))
-		return -ENODEV;
-
 	/* if the bridge doesn't have _STA, we assume it is always there */
 	status = acpi_get_handle(handle, "_STA", &dummy_handle);
 	if (ACPI_SUCCESS(status)) {
@@ -1385,19 +1388,11 @@ static void handle_hotplug_event_func(ac
 static acpi_status
 find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv)
 {
-	struct acpi_pci_root *root;
 	int *count = (int *)context;
 
 	if (!acpi_is_root_bridge(handle))
 		return AE_OK;
 
-	root = acpi_pci_find_root(handle);
-	if (!root)
-		return AE_OK;
-
-	if (root->osc_control_set & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL)
-		return AE_OK;
-
 	(*count)++;
 	acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
 				    handle_hotplug_event_bridge, NULL);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][Regression fix] PCI / Hotplug: Always allow acpiphp to handle non-PCIe bridges
  2011-12-12 23:02 [PATCH][Regression fix] PCI / Hotplug: Always allow acpiphp to handle non-PCIe bridges Rafael J. Wysocki
@ 2011-12-12 23:09 ` Rafael J. Wysocki
  2011-12-13 18:42 ` Jesse Barnes
  1 sibling, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2011-12-12 23:09 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: LKML, Linus Torvalds, linux-pci, Kenji Kaneshige

Hi Jesse,

On Tuesday, December 13, 2011, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> Commit 0d52f54e2ef64c189dedc332e680b2eb4a34590a (PCI / ACPI: Make
> acpiphp ignore root bridges using PCIe native hotplug) added code
> that made the acpiphp driver completely ignore PCIe root complexes
> for which the kernel had been granted control of the native PCIe
> hotplug feature by the BIOS through _OSC.  Unfortunately, however,
> this was a mistake, because on some systems there were PCI bridges
> supporting PCI (non-PCIe) hotplug under such root complexes and
> those bridges should have been handled by acpiphp.
> 
> For this reason, revert the changes made by the commit mentioned
> above and make register_slot() in drivers/pci/hotplug/acpiphp_glue.c
> avoid registering hotplug slots for PCIe ports that belong to
> root complexes with native PCIe hotplug enabled (which means that
> the BIOS has granted the kernel control of this feature for the
> given root complex).  This is reported to address the original
> issue fixed by commit 0d52f54e2ef64c189dedc332e680b2eb4a34590a and
> to work on the system where that commit broke things.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---

Sorry for the breakage, I clearly should have been more careful here.

Please also revert this commit from your linux-next branch:

http://git.kernel.org/?p=linux/kernel/git/jbarnes/pci.git;a=commit;h=71c50ab7a32968b73b533dd27620eef563ace6b7

as it makes the same mistake and depends on the code being removed by this
patch.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][Regression fix] PCI / Hotplug: Always allow acpiphp to handle non-PCIe bridges
  2011-12-12 23:02 [PATCH][Regression fix] PCI / Hotplug: Always allow acpiphp to handle non-PCIe bridges Rafael J. Wysocki
  2011-12-12 23:09 ` Rafael J. Wysocki
@ 2011-12-13 18:42 ` Jesse Barnes
  2011-12-13 21:09   ` Rafael J. Wysocki
  1 sibling, 1 reply; 4+ messages in thread
From: Jesse Barnes @ 2011-12-13 18:42 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: LKML, Linus Torvalds, linux-pci, Kenji Kaneshige

[-- Attachment #1: Type: text/plain, Size: 1458 bytes --]

On Tue, 13 Dec 2011 00:02:28 +0100
"Rafael J. Wysocki" <rjw@sisk.pl> wrote:

> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> Commit 0d52f54e2ef64c189dedc332e680b2eb4a34590a (PCI / ACPI: Make
> acpiphp ignore root bridges using PCIe native hotplug) added code
> that made the acpiphp driver completely ignore PCIe root complexes
> for which the kernel had been granted control of the native PCIe
> hotplug feature by the BIOS through _OSC.  Unfortunately, however,
> this was a mistake, because on some systems there were PCI bridges
> supporting PCI (non-PCIe) hotplug under such root complexes and
> those bridges should have been handled by acpiphp.
> 
> For this reason, revert the changes made by the commit mentioned
> above and make register_slot() in drivers/pci/hotplug/acpiphp_glue.c
> avoid registering hotplug slots for PCIe ports that belong to
> root complexes with native PCIe hotplug enabled (which means that
> the BIOS has granted the kernel control of this feature for the
> given root complex).  This is reported to address the original
> issue fixed by commit 0d52f54e2ef64c189dedc332e680b2eb4a34590a and
> to work on the system where that commit broke things.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---

Applied to my for-linus branch.  I'll probably send to Linus on Thu. or
so.

I also rebased the breakage out of linux-next.

Thanks,
-- 
Jesse Barnes, Intel Open Source Technology Center

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][Regression fix] PCI / Hotplug: Always allow acpiphp to handle non-PCIe bridges
  2011-12-13 18:42 ` Jesse Barnes
@ 2011-12-13 21:09   ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2011-12-13 21:09 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: LKML, Linus Torvalds, linux-pci, Kenji Kaneshige

On Tuesday, December 13, 2011, Jesse Barnes wrote:
> On Tue, 13 Dec 2011 00:02:28 +0100
> "Rafael J. Wysocki" <rjw@sisk.pl> wrote:
> 
> > From: Rafael J. Wysocki <rjw@sisk.pl>
> > 
> > Commit 0d52f54e2ef64c189dedc332e680b2eb4a34590a (PCI / ACPI: Make
> > acpiphp ignore root bridges using PCIe native hotplug) added code
> > that made the acpiphp driver completely ignore PCIe root complexes
> > for which the kernel had been granted control of the native PCIe
> > hotplug feature by the BIOS through _OSC.  Unfortunately, however,
> > this was a mistake, because on some systems there were PCI bridges
> > supporting PCI (non-PCIe) hotplug under such root complexes and
> > those bridges should have been handled by acpiphp.
> > 
> > For this reason, revert the changes made by the commit mentioned
> > above and make register_slot() in drivers/pci/hotplug/acpiphp_glue.c
> > avoid registering hotplug slots for PCIe ports that belong to
> > root complexes with native PCIe hotplug enabled (which means that
> > the BIOS has granted the kernel control of this feature for the
> > given root complex).  This is reported to address the original
> > issue fixed by commit 0d52f54e2ef64c189dedc332e680b2eb4a34590a and
> > to work on the system where that commit broke things.
> > 
> > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> > ---
> 
> Applied to my for-linus branch.  I'll probably send to Linus on Thu. or
> so.
> 
> I also rebased the breakage out of linux-next.

Thanks a lot!

Rafael

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-13 21:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-12 23:02 [PATCH][Regression fix] PCI / Hotplug: Always allow acpiphp to handle non-PCIe bridges Rafael J. Wysocki
2011-12-12 23:09 ` Rafael J. Wysocki
2011-12-13 18:42 ` Jesse Barnes
2011-12-13 21:09   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox