Linux ACPI
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Hanjun Guo <hanjun.guo@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	linaro-acpi@lists.linaro.org, Rob Herring <robh@kernel.org>,
	Mark Brown <broonie@linaro.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Olof Johansson <olof@lixom.net>,
	Will Deacon <will.deacon@arm.com>,
	linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 part1 08/11] ARM64 / ACPI: Introduce PCI functions for ACPI on ARM64
Date: Mon, 05 May 2014 15:09:26 +0200	[thread overview]
Message-ID: <4761400.zttHIHIKh6@wuerfel> (raw)
In-Reply-To: <53674D62.5020004@linaro.org>

On Monday 05 May 2014 16:35:46 Hanjun Guo wrote:
> On 2014-4-29 18:01, Arnd Bergmann wrote:
> [...]
> >>> For raw_pci_{read,write} we can have a trivial generic implementation in
> >>> the PCI core, like
> >>>
> >>> int __weak raw_pci_read(unsigned int domain, unsigned int bus,
> >>> 		  unsigned int devfn, int reg, int len, u32 *val)
> >>> {
> >>> 	struct pci_bus *bus = pci_find_bus(domain, bus);
> >>> 	if (!bus)
> >>> 		return -ENODEV;
> >>>
> >>> 	return bus->ops->read(bus, devfn, reg, len, val);
> >>> }
> >>>
> >>> which won't work on x86 or ia64, but should be fine everywhere else. Alternatively,
> >>> you can change the ACPI code to do the above manually and call the architecture
> >>> independent interfaces, either bus->ops->read, or pci_bus_read_config_{byte,word,dword},
> >>> which would actually simplify the ACPI code.
> >>
> >> This may not work. ACPI needs to be able to access PCI config space before
> >> we've done a PCI bus scan and created pci_bus structures, so the pointer
> >> of bus will be NULL.
> > 
> > Hmm, this is a serious issue, and I don't have a good idea for how
> > to solve it yet, we need to discuss it some more I think.
> > 
> > We are currently working on generic PCI support for ARM64 with DT, which
> > will be based around the concept that all PCI host drivers can be loadable
> > modules, and each host driver would supply its own config space access
> > method.
> 
> this will be the problem, ACPI may access config space before modules are
> loaded.

I've given it some more thought independently. In the end, I think it's
not a big issue because the standard PCI driver for ACPI will be rather
trivial and we can always have that built-in.

It destroys my dream of making the PCI core itself a loadable module,
but I wasn't sure if that was realistic anyway, and we may still be able
to do that for non-ACPI configurations.

> > With ACPI, we probably don't need the flexibility, because hopefully all
> > PCI host bridges will be SBSA compliant and have a regular ECAM config
> > space implementation (as opposed to the proprietary methods used by
> > e.g. APM X-Gene, Samsung GH7 or everything we have on ARM32).
> > 
> > If we can rely on always having ECAM support available, it would be
> > easy enough to add an implementation of that specifically for ACPI,
> > outside of the architecture code or the PCI core, or we could have
> > a global implementation of that, which gets used by both ACPI and
> > the compliant PCI host bridge drivers and can be built-in even for
> > loadable host drivers.
> > 
> > Alternatively, you could try to see if it's possible to defer the PCI
> > access to the time the host driver is loaded. Do you know what the access
> > to config space is actually needed for?
> 
> There is a statement in ACPI 5.0a spec:
> OSPM must guarantee that the following operation regions must always be
> accessible (which means even before the driver is ready):
> PCI_Config operation regions on a PCI root bus containing a _BBN object.
> (invoke _BBN method will return PCI bus number)

Hmm, the next statement there is

* I/O operation regions.

That one is even harder to make available in general, in particular
because SBSA says it doesn't have to be provided at all.

> And raw_pci_{read,write} will be called in ACPICA to access the PCI_Config
> to get some information, so theoretic any device defined in DSDT with
> PCI_Config operation region which be enumerated before PCI host bridge will
> access config space before the PCI bus scan.

Just to confirm: Are they called before pci_acpi_scan_root()?

In the same section you quote, it seems not:

It should be noted that PCI Config Space Operation Regions are ready as
soon the host controller or bridge controller has been programmed with a
bus number. PCI1’s _REG method would not be run until the PCI-PCI bridge
has been properly configured.

	Arnd
--
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

  reply	other threads:[~2014-05-05 13:09 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-25 13:20 [PATCH v3 part1 00/11] Enable ACPI on ARM64 in Kconfig Hanjun Guo
2014-04-25 13:20 ` [PATCH v3 part1 01/11] ACPI / processor: Rework _PDC related stuff to make it more arch-independent Hanjun Guo
2014-04-29  9:36   ` Grant Likely
2014-05-04  8:56     ` Hanjun Guo
2014-04-25 13:20 ` [PATCH v3 part1 02/11] ARM64 / ACPI: Introduce the skeleton of _PDC related for ARM64 Hanjun Guo
2014-04-29  9:39   ` Grant Likely
2014-05-04  8:58     ` Hanjun Guo
2014-04-25 13:20 ` [PATCH v3 part1 03/11] ARM64 : Add dummy asm/cpu.h Hanjun Guo
2014-04-29  9:40   ` Grant Likely
2014-04-29 10:43     ` Arnd Bergmann
2014-04-25 13:20 ` [PATCH v3 part1 04/11] ARM64 / ACPI: Introduce arm-core.c and its related head file Hanjun Guo
2014-04-25 15:51   ` Mark Rutland
2014-04-25 16:53     ` Graeme Gregory
2014-04-25 18:38       ` Mark Rutland
2014-04-26 12:09         ` Graeme Gregory
2014-04-28 14:58         ` [Linaro-acpi] " Lorenzo Pieralisi
2014-04-28  4:54   ` Zheng, Lv
2014-04-28  9:32     ` Hanjun Guo
2014-04-29  9:45   ` Grant Likely
2014-04-25 13:20 ` [PATCH v3 part1 05/11] ARM64 / ACPI: Introduce early_param for "acpi" Hanjun Guo
2014-04-29  9:51   ` Grant Likely
2014-04-25 13:20 ` [PATCH v3 part1 06/11] ARM64 / ACPI: Introduce lowlevel suspend function Hanjun Guo
2014-04-28 15:22   ` [Linaro-acpi] " Lorenzo Pieralisi
2014-04-29  8:46     ` Hanjun Guo
2014-04-25 13:20 ` [PATCH v3 part1 07/11] ARM64 / ACPI: Introduce arch_fix_phys_package_id() for cpu topology Hanjun Guo
2014-04-25 14:52   ` Mark Brown
2014-04-28  3:00     ` Hanjun Guo
2014-04-28  8:50       ` Mark Brown
2014-04-25 13:20 ` [PATCH v3 part1 08/11] ARM64 / ACPI: Introduce PCI functions for ACPI on ARM64 Hanjun Guo
2014-04-28 13:49   ` Arnd Bergmann
2014-04-29  8:44     ` Hanjun Guo
2014-04-29 10:01       ` [Linaro-acpi] " Arnd Bergmann
2014-05-05  8:35         ` Hanjun Guo
2014-05-05 13:09           ` Arnd Bergmann [this message]
2014-04-25 13:20 ` [PATCH v3 part1 09/11] ARM64 / ACPI: Enable ARM64 in Kconfig Hanjun Guo
2014-04-25 13:20 ` [PATCH v3 part1 10/11] ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on ARM64 Hanjun Guo
2014-04-25 13:20 ` [PATCH v3 part1 11/11] ACPI: Make EC depend on X86 || IA64 in Kconfig Hanjun Guo
2014-04-29  9:56   ` Grant Likely
2014-05-04  9:03     ` Hanjun Guo

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=4761400.zttHIHIKh6@wuerfel \
    --to=arnd@arndb.de \
    --cc=broonie@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=hanjun.guo@linaro.org \
    --cc=linaro-acpi@lists.linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=olof@lixom.net \
    --cc=rjw@rjwysocki.net \
    --cc=robh@kernel.org \
    --cc=will.deacon@arm.com \
    /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