All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hanjun Guo <hanjun.guo@linaro.org>
To: Arnd Bergmann <arnd@arndb.de>, "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: 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 16:35:46 +0800	[thread overview]
Message-ID: <53674D62.5020004@linaro.org> (raw)
In-Reply-To: <8888740.lgd2Xkrtad@wuerfel>

Hi Arnd, Rafael,

Sorry for the late reply, I was on holidays...

I send this email directed to Rafael to ask for help, please
refer to the comments below.

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.

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

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.

But I haven't find any specific example, I must missed something, Rafael,
could you please comment this?

Thanks
Hanjun

WARNING: multiple messages have this Message-ID (diff)
From: hanjun.guo@linaro.org (Hanjun Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 part1 08/11] ARM64 / ACPI: Introduce PCI functions for ACPI on ARM64
Date: Mon, 05 May 2014 16:35:46 +0800	[thread overview]
Message-ID: <53674D62.5020004@linaro.org> (raw)
In-Reply-To: <8888740.lgd2Xkrtad@wuerfel>

Hi Arnd, Rafael,

Sorry for the late reply, I was on holidays...

I send this email directed to Rafael to ask for help, please
refer to the comments below.

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.

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

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.

But I haven't find any specific example, I must missed something, Rafael,
could you please comment this?

Thanks
Hanjun

  reply	other threads:[~2014-05-05  8:36 UTC|newest]

Thread overview: 81+ 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 ` 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-25 13:20   ` Hanjun Guo
2014-04-25 13:20   ` Hanjun Guo
2014-04-29  9:36   ` Grant Likely
2014-04-29  9:36     ` Grant Likely
2014-04-29  9:36     ` [PATCH v3 part1 01/11] ACPI / processor: Rework _PDC related stuff to make it more arch-independ Grant Likely
2014-05-04  8:56     ` [PATCH v3 part1 01/11] ACPI / processor: Rework _PDC related stuff to make it more arch-independent Hanjun Guo
2014-05-04  8:56       ` Hanjun Guo
2014-05-04  8:56       ` [PATCH v3 part1 01/11] ACPI / processor: Rework _PDC related stuff to make it more arch-independ 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-25 13:20   ` Hanjun Guo
2014-04-29  9:39   ` Grant Likely
2014-04-29  9:39     ` Grant Likely
2014-05-04  8:58     ` Hanjun Guo
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-25 13:20   ` Hanjun Guo
2014-04-29  9:40   ` Grant Likely
2014-04-29  9:40     ` Grant Likely
2014-04-29 10:43     ` Arnd Bergmann
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 13:20   ` Hanjun Guo
2014-04-25 15:51   ` Mark Rutland
2014-04-25 15:51     ` Mark Rutland
2014-04-25 16:53     ` Graeme Gregory
2014-04-25 16:53       ` Graeme Gregory
2014-04-25 18:38       ` Mark Rutland
2014-04-25 18:38         ` Mark Rutland
2014-04-26 12:09         ` Graeme Gregory
2014-04-26 12:09           ` Graeme Gregory
2014-04-28 14:58         ` [Linaro-acpi] " Lorenzo Pieralisi
2014-04-28 14:58           ` Lorenzo Pieralisi
2014-04-28  4:54   ` Zheng, Lv
2014-04-28  4:54     ` Zheng, Lv
2014-04-28  9:32     ` Hanjun Guo
2014-04-28  9:32       ` Hanjun Guo
2014-04-29  9:45   ` Grant Likely
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-25 13:20   ` Hanjun Guo
2014-04-29  9:51   ` Grant Likely
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-25 13:20   ` Hanjun Guo
2014-04-28 15:22   ` [Linaro-acpi] " Lorenzo Pieralisi
2014-04-28 15:22     ` Lorenzo Pieralisi
2014-04-29  8:46     ` Hanjun Guo
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 13:20   ` Hanjun Guo
2014-04-25 14:52   ` Mark Brown
2014-04-25 14:52     ` Mark Brown
2014-04-28  3:00     ` Hanjun Guo
2014-04-28  3:00       ` Hanjun Guo
2014-04-28  8:50       ` Mark Brown
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-25 13:20   ` Hanjun Guo
2014-04-28 13:49   ` Arnd Bergmann
2014-04-28 13:49     ` Arnd Bergmann
2014-04-29  8:44     ` Hanjun Guo
2014-04-29  8:44       ` Hanjun Guo
2014-04-29 10:01       ` [Linaro-acpi] " Arnd Bergmann
2014-04-29 10:01         ` Arnd Bergmann
2014-05-05  8:35         ` Hanjun Guo [this message]
2014-05-05  8:35           ` Hanjun Guo
2014-05-05 13:09           ` Arnd Bergmann
2014-05-05 13:09             ` Arnd Bergmann
2014-04-25 13:20 ` [PATCH v3 part1 09/11] ARM64 / ACPI: Enable ARM64 in Kconfig Hanjun Guo
2014-04-25 13:20   ` 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   ` 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-25 13:20   ` Hanjun Guo
2014-04-29  9:56   ` Grant Likely
2014-04-29  9:56     ` Grant Likely
2014-05-04  9:03     ` Hanjun Guo
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=53674D62.5020004@linaro.org \
    --to=hanjun.guo@linaro.org \
    --cc=arnd@arndb.de \
    --cc=broonie@linaro.org \
    --cc=catalin.marinas@arm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.