public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Tony Luck <tony.luck@intel.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Yinghai Lu <yinghai@kernel.org>, Jiang Liu <liuj97@gmail.com>,
	Myron Stowe <myron.stowe@redhat.com>
Subject: Re: [Alternative 2][PATCH] ACPI / PCI: Set root bridge ACPI handle in advance
Date: Thu, 03 Jan 2013 01:40:52 +0100	[thread overview]
Message-ID: <1626213.gpPY5etSgn@vostro.rjw.lan> (raw)
In-Reply-To: <20130102230732.GB31813@google.com>

On Wednesday, January 02, 2013 04:07:32 PM Bjorn Helgaas wrote:
> On Thu, Dec 27, 2012 at 10:32:13PM +0100, Rafael J. Wysocki wrote:
> > To that end, split pci_create_root_bus() into two functions,
> > pci_alloc_root() and pci_add_root(), that will allocate memory for
> > the new PCI bus and bridge representations and register them with
> > the driver core, respectively, and that may be called directly by
> > the architectures that need to set the root bridge's ACPI handle
> > before registering it.
> 
> I'm trying to *reduce* the interfaces for creating and scanning PCI
> host bridges, and this is a step in the opposite direction.

Yes it is.

The alternative is to make the root bridge initialization code more complex.

> > Next, Make both x86 and ia64 (the only architectures using ACPI at
> > the moment) call pci_alloc_root(), set the root bridge's ACPI handle
> > and then call pci_add_root() in their pci_acpi_scan_root() routines
> > instead of calling pci_create_root_bus().  For the other code paths
> > adding PCI root bridges define a new pci_create_root_bus() as a
> > simple combination of pci_alloc_root() and pci_add_root().
> 
> pci_create_root_bus() takes a "struct device *parent" argument.  That
> seems like a logical place to tell the PCI core about the host bridge
> device, but x86 and ia64 currently pass NULL there.

And there's a reason for that.  Namely, on these architectures PCI host
bridges have no physical parents (well, at least in current practice).

> The patch below shows what I'm thinking.  It does have the side-effect
> of changing the sysfs topology from this:
> 
>     /sys/devices/pci0000:00
>     /sys/devices/pci0000:00/0000:00:00.0
> 
> to this:
> 
>     /sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/pci0000:00
>     /sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/pci0000:00/0000:00:00.0
> 
> because it puts the PCI root bus (pci0000:00) under the PNP0A08 device
> rather than at the top level.

Which is wrong.

PNP0A08 is not a parent of the host bridge, but its ACPI "companion" (ie. ACPI
namespace node representing the host bridge itself).

> That seems like an improvement to me, but it *is* different.

Well, then we should make every ACPI device node corresponding to a PCI device
be a parent of that device's struct pci_dev and so on for other bus types.  It
doesn't sound like an attractive idea. :-)  Moreover, it is impossible, because
those things generally already have parents (struct pci_dev objects have them
at least).

That said the idea to pass something meaningful in the parent argument
of pci_create_root_bus() can be implemented if we create a "physical" device
object corresponding to "device:00" (which is an ACPI namespace node) in your
example.

>From what I can tell, "device:00" always corresponds to the ACPI _SB scope
(which is mandatory), so in principle we can create an abstract "physical"
device object for it and call it something like "system_root".  Then, if we
use it as the parent of pci0000:00 (the host bridge), then we'll have

     /sys/devices/system_root/pci0000:00
     /sys/devices/system_root/pci0000:00/0000:00:00.0

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

  reply	other threads:[~2013-01-03  0:40 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-16 22:25 [PATCH] ACPI / PCI: Set root bridge ACPI handle in advance Rafael J. Wysocki
2012-12-17  5:27 ` Yinghai Lu
2012-12-17  7:51   ` Rafael J. Wysocki
2012-12-17  8:09     ` Yinghai Lu
2012-12-17 12:13       ` Rafael J. Wysocki
2012-12-17 12:20 ` [Update][PATCH] " Rafael J. Wysocki
2012-12-17 17:24   ` Yinghai Lu
2012-12-17 23:13     ` Rafael J. Wysocki
2012-12-17 18:44   ` Greg Kroah-Hartman
2012-12-17 23:14     ` Rafael J. Wysocki
2012-12-17 23:30   ` [Update 2][PATCH] " Rafael J. Wysocki
2012-12-19  6:00     ` Zheng, Lv
2012-12-19 10:50       ` Rafael J. Wysocki
2012-12-20 21:13     ` Bjorn Helgaas
2012-12-20 21:19       ` H. Peter Anvin
2012-12-20 22:56       ` Rafael J. Wysocki
2012-12-21  0:25         ` Bjorn Helgaas
2012-12-25 22:42           ` [Alternative][PATCH] " Rafael J. Wysocki
2012-12-26 18:14             ` Bjorn Helgaas
2012-12-26 22:35               ` Rafael J. Wysocki
2012-12-26 20:04             ` Yinghai Lu
2012-12-26 20:10               ` Bjorn Helgaas
2012-12-26 20:16                 ` Yinghai Lu
2012-12-26 20:41                   ` Yinghai Lu
2012-12-26 22:36                     ` Rafael J. Wysocki
2012-12-27  0:10                       ` Yinghai Lu
2012-12-27 12:47                         ` Rafael J. Wysocki
2012-12-27 13:31                           ` Rafael J. Wysocki
2012-12-27 21:25                             ` Rafael J. Wysocki
2012-12-27 21:32             ` [Alternative 2][PATCH] " Rafael J. Wysocki
2013-01-02 23:07               ` Bjorn Helgaas
2013-01-03  0:40                 ` Rafael J. Wysocki [this message]
2013-01-03 12:11                   ` Rafael J. Wysocki
2013-01-03 21:23                     ` Rafael J. Wysocki
2013-01-03 22:13                       ` Bjorn Helgaas
2013-01-03 22:56                         ` Rafael J. Wysocki
2013-01-04  1:00                           ` Bjorn Helgaas
2013-01-04 11:38                             ` Rafael J. Wysocki
2013-01-05  0:03                               ` Yinghai Lu
2013-01-05  0:14                                 ` Rafael J. Wysocki
2013-01-05  0:19                                   ` Yinghai Lu
2013-01-05  0:36                                     ` Bjorn Helgaas
2013-01-05  0:54                                       ` Rafael J. Wysocki
2013-01-03 20:44                 ` Rafael J. Wysocki
2013-01-09 21:33             ` [Alternative][PATCH] ACPI / PCI: Set root bridge ACPI handle in advance, v2 Rafael J. Wysocki
2013-01-09 22:16               ` Bjorn Helgaas
2013-01-09 23:06                 ` Rafael J. Wysocki
2013-01-09 23:27                   ` Yinghai Lu
2013-01-10  0:05                     ` Rafael J. Wysocki
2013-01-11 21:53                       ` Rafael J. Wysocki
2013-01-11 23:01                         ` Yinghai Lu
2013-01-10 22:54                   ` Yinghai Lu
2013-01-10 23:40                     ` Rafael J. Wysocki
2013-01-11 12:27                       ` Rafael J. Wysocki

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=1626213.gpPY5etSgn@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=bhelgaas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=liuj97@gmail.com \
    --cc=myron.stowe@redhat.com \
    --cc=tony.luck@intel.com \
    --cc=yinghai@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