All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hanjun Guo <hanjun.guo@linaro.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Mark Brown <broonie@linaro.org>,
	Grant Likely <grant.likely@linaro.org>,
	Sudeep Holla <Sudeep.Holla@arm.com>,
	Olof Johansson <olof@lixom.net>,
	Mark Rutland <mark.rutland@arm.com>,
	Rob Herring <robh@kernel.org>, Will Deacon <will.deacon@arm.com>,
	Charles.Garcia-Tobin@arm.com, linaro-acpi@lists.linaro.org,
	Graeme Gregory <graeme.gregory@linaro.org>,
	Al Stone <al.stone@linaro.org>
Subject: Re: [PATCH v3 part1 08/11] ARM64 / ACPI: Introduce PCI functions for ACPI on ARM64
Date: Tue, 29 Apr 2014 16:44:37 +0800	[thread overview]
Message-ID: <535F6675.1060109@linaro.org> (raw)
In-Reply-To: <201404281549.50738.arnd@arndb.de>

Hi Arnd,

On 2014-4-28 21:49, Arnd Bergmann wrote:
> On Friday 25 April 2014, Hanjun Guo wrote:
>> CONFIG_ACPI depends CONFIG_PCI now, and ACPI provides ACPI based
>> PCI hotplug and PCI host bridge hotplug, introduce some PCI
>> functions to make ACPI core can be compiled, some of the functions
>> should be revisited when implemented on ARM64.
> 
>> diff --git a/arch/arm64/include/asm/pci.h b/arch/arm64/include/asm/pci.h
>> index d93576f..0aa3607 100644
>> --- a/arch/arm64/include/asm/pci.h
>> +++ b/arch/arm64/include/asm/pci.h
>> @@ -21,6 +21,17 @@ struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus);
>>  #define pcibios_assign_all_busses() \
>>  	(pci_has_flag(PCI_REASSIGN_ALL_BUS))
>>  
>> +static inline void pcibios_penalize_isa_irq(int irq, int active)
>> +{
>> +	/* we don't do dynamic pci irq allocation */
>> +}
>> +
>> +static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
>> +{
>> +	/* no legacy IRQ on arm64 */
>> +	return -ENODEV;
>> +}
>> +
> 
> I think these would be better addressed in the caller. From what I can tell, they
> are only called by the ISAPNP code path for doing IRQ resource allocation, while
> the ACPIPNP code uses hardwired IRQ resources.

I agree. pcibios_penalize_isa_irq() is only used by x86 and I will send out a
patch to make pcibios_penalize_isa_irq() as __weak in PCI core and remove
all the stub function out except x86. For pci_get_legacy_ide_irq(), I think we
can fix it in the same way, does this make sense to you?

> 
>> @@ -171,3 +172,36 @@ unsigned long pci_ioremap_io(const struct resource *res, phys_addr_t phys_addr)
>>  	/* return io_offset */
>>  	return start * PAGE_SIZE - res->start;
>>  }
>> +
>> +/*
>> + * raw_pci_read - Platform-specific PCI config space access.
>> + *
>> + * Default empty implementation.  Replace with an architecture-specific setup
>> + * routine, if necessary.
>> + */
>> +int raw_pci_read(unsigned int domain, unsigned int bus,
>> +		  unsigned int devfn, int reg, int len, u32 *val)
>> +{
>> +	return -EINVAL;
>> +}
>> +
>> +int raw_pci_write(unsigned int domain, unsigned int bus,
>> +		  unsigned int devfn, int reg, int len, u32 val)
>> +{
>> +	return -EINVAL;
>> +}
>> +
>> +#ifdef CONFIG_ACPI
>> +/* Root bridge scanning */
>> +struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
>> +{
>> +	/* TODO: Should be revisited when implementing PCI on ACPI */
>> +	return NULL;
>> +}
>> +
>> +void __init pci_acpi_crs_quirks(void)
>> +{
>> +	/* Do nothing on ARM64 */
>> +	return;
>> +}
>> +#endif
> 
> And these probably don't need to be done at the architecture level. I expect we
> will only have to worry about SBSA compliant PCI hosts, so this can be done in
> the host controller driver for compliant devices, which is probably the one
> that Will Deacon is working on already.
> 
> Note that we are aiming for an empty PCI implementation in ARM64, doing everything
> in either the PCI core or in the individual host drivers.

Ok, I will review Will Deacon's patch to find out the solution for
pci_acpi_scan_root().

> 
> For pci_acpi_crs_quirks(), it's probably enough to stub out the declaration and
> to make it x86 specific. ia64 already doesn't use it, and we can hope we won't
> need it for arm64 either.

Yes, I agree, thanks a lot for the great suggestion :)
I will send out a patch to address this according to your advice.

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

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: Tue, 29 Apr 2014 16:44:37 +0800	[thread overview]
Message-ID: <535F6675.1060109@linaro.org> (raw)
In-Reply-To: <201404281549.50738.arnd@arndb.de>

Hi Arnd,

On 2014-4-28 21:49, Arnd Bergmann wrote:
> On Friday 25 April 2014, Hanjun Guo wrote:
>> CONFIG_ACPI depends CONFIG_PCI now, and ACPI provides ACPI based
>> PCI hotplug and PCI host bridge hotplug, introduce some PCI
>> functions to make ACPI core can be compiled, some of the functions
>> should be revisited when implemented on ARM64.
> 
>> diff --git a/arch/arm64/include/asm/pci.h b/arch/arm64/include/asm/pci.h
>> index d93576f..0aa3607 100644
>> --- a/arch/arm64/include/asm/pci.h
>> +++ b/arch/arm64/include/asm/pci.h
>> @@ -21,6 +21,17 @@ struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus);
>>  #define pcibios_assign_all_busses() \
>>  	(pci_has_flag(PCI_REASSIGN_ALL_BUS))
>>  
>> +static inline void pcibios_penalize_isa_irq(int irq, int active)
>> +{
>> +	/* we don't do dynamic pci irq allocation */
>> +}
>> +
>> +static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
>> +{
>> +	/* no legacy IRQ on arm64 */
>> +	return -ENODEV;
>> +}
>> +
> 
> I think these would be better addressed in the caller. From what I can tell, they
> are only called by the ISAPNP code path for doing IRQ resource allocation, while
> the ACPIPNP code uses hardwired IRQ resources.

I agree. pcibios_penalize_isa_irq() is only used by x86 and I will send out a
patch to make pcibios_penalize_isa_irq() as __weak in PCI core and remove
all the stub function out except x86. For pci_get_legacy_ide_irq(), I think we
can fix it in the same way, does this make sense to you?

> 
>> @@ -171,3 +172,36 @@ unsigned long pci_ioremap_io(const struct resource *res, phys_addr_t phys_addr)
>>  	/* return io_offset */
>>  	return start * PAGE_SIZE - res->start;
>>  }
>> +
>> +/*
>> + * raw_pci_read - Platform-specific PCI config space access.
>> + *
>> + * Default empty implementation.  Replace with an architecture-specific setup
>> + * routine, if necessary.
>> + */
>> +int raw_pci_read(unsigned int domain, unsigned int bus,
>> +		  unsigned int devfn, int reg, int len, u32 *val)
>> +{
>> +	return -EINVAL;
>> +}
>> +
>> +int raw_pci_write(unsigned int domain, unsigned int bus,
>> +		  unsigned int devfn, int reg, int len, u32 val)
>> +{
>> +	return -EINVAL;
>> +}
>> +
>> +#ifdef CONFIG_ACPI
>> +/* Root bridge scanning */
>> +struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
>> +{
>> +	/* TODO: Should be revisited when implementing PCI on ACPI */
>> +	return NULL;
>> +}
>> +
>> +void __init pci_acpi_crs_quirks(void)
>> +{
>> +	/* Do nothing on ARM64 */
>> +	return;
>> +}
>> +#endif
> 
> And these probably don't need to be done at the architecture level. I expect we
> will only have to worry about SBSA compliant PCI hosts, so this can be done in
> the host controller driver for compliant devices, which is probably the one
> that Will Deacon is working on already.
> 
> Note that we are aiming for an empty PCI implementation in ARM64, doing everything
> in either the PCI core or in the individual host drivers.

Ok, I will review Will Deacon's patch to find out the solution for
pci_acpi_scan_root().

> 
> For pci_acpi_crs_quirks(), it's probably enough to stub out the declaration and
> to make it x86 specific. ia64 already doesn't use it, and we can hope we won't
> need it for arm64 either.

Yes, I agree, thanks a lot for the great suggestion :)
I will send out a patch to address this according to your advice.

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

Thanks
Hanjun

  reply	other threads:[~2014-04-29  8:45 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 [this message]
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
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=535F6675.1060109@linaro.org \
    --to=hanjun.guo@linaro.org \
    --cc=Charles.Garcia-Tobin@arm.com \
    --cc=Sudeep.Holla@arm.com \
    --cc=al.stone@linaro.org \
    --cc=arnd@arndb.de \
    --cc=broonie@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=graeme.gregory@linaro.org \
    --cc=grant.likely@linaro.org \
    --cc=linaro-acpi@lists.linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --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.