Re: [Alternative 2][PATCH] ACPI / PCI: Set root bridge ACPI handlein advance

From: Bjorn Helgaas
Date: Thu Jan 03 2013 - 20:00:28 EST

On Thu, Jan 03, 2013 at 11:56:55PM +0100, Rafael J. Wysocki wrote:

> OK, I now have sent no less than three working version of the patch that fixes
> the current code which _is_ insane. You haven't even responded to the last
> one, but for the first two the reason why you didn't like them was something
> similar to "it may conflict with some future changes I'm planning". Well,
> that might be used to reject prety much any change and I'm not considering it
> as a good enough reason for blocking a fix. Sorry about that.

I think your memory is faulty. My response to the first
( was "Thanks for cleaning this up, I
have an interface concern, here's an outline of a possible alternative."

My response to the second ( was "I like
this much better, Acked-by: Bjorn Helgaas." Then Yinghai noticed the issue
with non-ACPI host bridges, and you abandoned that approach.

I took a few days of vacation, then spent the better part of yesterday
exploring the reasons why x86 and ia64 don't use the "parent" argument when
several other arches do, and worked up a patch
( It turned out to have a fatal flaw,
but was done in good faith.

It's true I haven't responded to the third one, posted about 12 hours ago.

I still like the approach of the second patch. What would you think
of the following incremental change to it? I did reproduce Yinghai's
issue with non-ACPI host bridges, and this change resolves it for me.

diff -u b/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
--- b/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -522,6 +522,7 @@
sd = &info->sd;
sd->domain = domain;
sd->node = node;
+ sd->acpi_handle = device->handle;
* Maybe the desired pci bus has been already scanned. In such case
* it is unnecessary to scan the pci bus with the given domain,busnum.
@@ -596,9 +597,8 @@
int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
struct pci_sysdata *sd = bridge->bus->sysdata;
- struct pci_root_info *info = container_of(sd, struct pci_root_info, sd);

- ACPI_HANDLE_SET(&bridge->dev, info->bridge->handle);
+ ACPI_HANDLE_SET(&bridge->dev, sd->acpi_handle);
return 0;

--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -14,6 +14,7 @@
struct pci_sysdata {
int domain; /* PCI domain */
int node; /* NUMA node */
+ void *acpi_handle;
#ifdef CONFIG_X86_64
void *iommu; /* IOMMU private data */

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at