linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Aaron Durbin <adurbin@google.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Linux PCI <linux-pci@vger.kernel.org>
Subject: Re: ACPI device using sub-resource of PCI device
Date: Fri, 22 Jul 2016 11:40:56 -0500	[thread overview]
Message-ID: <20160722164056.GD20646@localhost> (raw)
In-Reply-To: <1787767.fkqrmkTfXg@vostro.rjw.lan>

On Thu, Jul 21, 2016 at 12:46:03AM +0200, Rafael J. Wysocki wrote:
> On Wednesday, July 20, 2016 02:35:43 PM Bjorn Helgaas wrote:
> > On Tue, Jun 28, 2016 at 09:41:19PM -0700, Aaron Durbin wrote:
> > > On Fri, Jun 24, 2016 at 12:34 PM, Aaron Durbin <adurbin@google.com> wrote:

> > > > acpi_init() and pci_subsys_init() are both subsys_initcalls during
> > > > boot up. I'm not sure if the ordering is dumb luck or not, but
> > > > acpi_init() is called prior to pci_subsys_init(). The conflict error
> > > > is spit out from pcibios_resource_survey() by way of pci_subsys_init()
> > > >  subsys_initcall. However, the PCI device scanning is kicked off prior
> > > > to this through acpi_scan_init() by way of acpi_init()
> > > > subsys_initcall.  The conflict error occurs because there's already
> > > > the child ACPI device in the resource tree. I'm not sure when/where
> > > > those ACPI devices' resources are added, but clearly they are sitting
> > > > in there since the conflict was found.
> > 
> > I think the acpi_init()/pci_subsys_init() ordering is correct.  The
> > ACPI namespace is primary.  A PCI hierarchy originates at a PCI host
> > bridge in the ACPI namespace, so we should enumerate the ACPI
> > namespace first, and when we find a PCI host bridge, we should
> > enumerate the PCI devices below it.
> > 
> > That said, I think it is correct mostly by accident and it would be
> > nice if it were more explicit.
> 
> No, it isn't by accident.
> 
> The enumeration of PCI devices under a PCI host bridge discovered via ACPI
> starts in acpi_pci_root_add() which quite explicitly is only called after
> enumerating the ACPI namespace entirely.
> 
> acpi_bus_scan() has two passes now, one is to call acpi_bus_check_add() for
> all namespace objects and the other is the acpi_bus_attach() pass where
> all things like acpi_pci_root_add() are called.

I meant the ordering between acpi_init() and pci_subsys_init().
They're both subsys_initcalls, so their ordering is determined by link
order, which is not at all obvious (at least to me), since acpi_init()
is in drivers/acpi and pci_subsys_init() is in arch/x86.  If they were
both in drivers, the drivers/Makefile would make it pretty obvious.
But finding the order of "arch" relative to "drivers" in Makefile is
less obvious.

acpi_init() has to be before pci_subsys_init(), and it is.  I
shouldn't have said it was by accident, just that it's non-obvious.

Bjorn

      parent reply	other threads:[~2016-07-22 16:40 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-18 15:54 ACPI device using sub-resource of PCI device Aaron Durbin
2016-05-18 21:25 ` Rafael J. Wysocki
2016-05-18 22:32   ` Aaron Durbin
2016-06-14 17:04     ` Aaron Durbin
2016-06-24 19:34       ` Aaron Durbin
2016-06-29  4:41         ` Aaron Durbin
2016-07-20 19:35           ` Bjorn Helgaas
2016-07-20 22:06             ` Aaron Durbin
2016-07-20 22:46             ` Rafael J. Wysocki
2016-07-20 23:02               ` Aaron Durbin
2016-07-21  0:40                 ` Rafael J. Wysocki
2016-07-21  1:58                   ` Aaron Durbin
2016-07-22  0:55                     ` Rafael J. Wysocki
2016-07-22 17:26                       ` Aaron Durbin
2016-07-22 21:04                         ` Rafael J. Wysocki
2016-07-25 19:11                           ` Aaron Durbin
2016-07-28  0:09                             ` Rafael J. Wysocki
2016-07-28  4:02                               ` Aaron Durbin
2016-08-12 16:45                                 ` Aaron Durbin
2016-08-16  9:15                                   ` Mika Westerberg
2016-08-16 11:23                                     ` Andy Shevchenko
2016-08-16 11:27                                       ` Rafael J. Wysocki
2016-08-16 12:20                                       ` Mika Westerberg
2016-08-17 23:02                                     ` Aaron Durbin
2016-09-09 14:12                                       ` Aaron Durbin
2016-09-09 14:16                                         ` Aaron Durbin
2016-09-12  8:10                                         ` Mika Westerberg
2016-09-12 12:26                                           ` Rafael J. Wysocki
2016-09-13 12:19                                             ` [PATCH 1/2] PCI: Add pci_find_resource() Mika Westerberg
2016-09-13 12:19                                               ` [PATCH 2/2] ACPI / platform: Pay attention to parent device's resources Mika Westerberg
2016-09-13 14:11                                               ` [PATCH 1/2] PCI: Add pci_find_resource() Andy Shevchenko
2016-09-14  7:45                                                 ` Mika Westerberg
2016-09-14 22:16                                               ` Bjorn Helgaas
2016-09-14 22:47                                                 ` Rafael J. Wysocki
2016-09-15  8:07                                                   ` [PATCH v2 " Mika Westerberg
2016-09-15  8:07                                                     ` [PATCH v2 2/2] ACPI / platform: Pay attention to parent device's resources Mika Westerberg
2016-07-22 16:40               ` Bjorn Helgaas [this message]

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=20160722164056.GD20646@localhost \
    --to=helgaas@kernel.org \
    --cc=adurbin@google.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    /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).