Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1331851 > unrolled thread
| Started by | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> |
|---|---|
| First post | 2016-02-11 13:00 +0100 |
| Last post | 2016-02-11 19:50 +0100 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH V4 22/23] arm64, pci, acpi: Assign legacy IRQs once device is enable. Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-02-11 13:00 +0100
Re: [PATCH V4 22/23] arm64, pci, acpi: Assign legacy IRQs once device is enable. Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-02-11 18:20 +0100
Re: [PATCH V4 22/23] arm64, pci, acpi: Assign legacy IRQs once device is enable. Tomasz Nowicki <tn@semihalf.com> - 2016-02-11 19:50 +0100
Re: [PATCH V4 22/23] arm64, pci, acpi: Assign legacy IRQs once device is enable. Tomasz Nowicki <tn@semihalf.com> - 2016-02-11 19:50 +0100
| From | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> |
|---|---|
| Date | 2016-02-11 13:00 +0100 |
| Subject | Re: [PATCH V4 22/23] arm64, pci, acpi: Assign legacy IRQs once device is enable. |
| Message-ID | <r0Y4G-8bX-7@gated-at.bofh.it> |
On Thu, Feb 04, 2016 at 06:29:00PM +0100, Tomasz Nowicki wrote:
> This is the last step before enabling generic ACPI PCI host controller
> for ARM64. We need to take care of legacy IRQ mapping for non-MSI(X)
> PCI devices. pcibios_enable_device() boot order is not sensitive to
> ACPI device enumeration, so it is the best place to assign device's IRQs.
I guess you are referring to:
https://lists.linaro.org/pipermail/linaro-acpi/2015-October/005944.html
It is weird that the dependency can't be enforced, I will have a look
into this, it would be nice to have DT and ACPI legacy IRQs mapping
confined in pcibios_add_device() so that we can remove them in one go
when Matthew's series is merged.
As for the MSI check, by reading commit history its need I think
it harks back to bba6f6fc, which was supposed to be a quick hack and it
has been in the kernel for 9 years :), is it really needed ?
> NOTE: *This is going to be temporary solution*. There is ongoing work
> which aims for cleaning legacy IRQ allocation, see [1].
> We can consider this patch as the necessary evil which will be removed
> once [1] series hits mailnline in the near future.
>
> 1. http://comments.gmane.org/gmane.linux.kernel.pci/46461
>
> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
> ---
> arch/arm64/kernel/pci.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
> index 023b983..d1a701f 100644
> --- a/arch/arm64/kernel/pci.c
> +++ b/arch/arm64/kernel/pci.c
> @@ -39,16 +39,26 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
> }
>
> /**
> - * pcibios_enable_device - Enable I/O and memory.
> + * pcibios_enable_device - Enable I/O, memory and legacy IRQs for ACPI.
> * @dev: PCI device to be enabled
> * @mask: bitmask of BARs to enable
> */
> int pcibios_enable_device(struct pci_dev *dev, int mask)
> {
> + int ret;
> +
> if (pci_has_flag(PCI_PROBE_ONLY))
> return 0;
>
> - return pci_enable_resources(dev, mask);
> + ret = pci_enable_resources(dev, mask);
> + if (ret < 0)
> + return ret;
> +
> +#ifdef CONFIG_ACPI
> + if (!pci_dev_msi_enabled(dev))
> + return acpi_pci_irq_enable(dev);
You need a guard here anyway, we do not want to probe ACPI IRQ if
it is disabled (ie acpi_pci_disabled). Same goes for DT in
pcibios_add_device(), which is not making this code any nicer.
Lorenzo
> +#endif
> + return 0;
> }
>
> /*
> --
> 1.9.1
>
[toc] | [next] | [standalone]
| From | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> |
|---|---|
| Date | 2016-02-11 18:20 +0100 |
| Message-ID | <r134m-3on-27@gated-at.bofh.it> |
| In reply to | #1331851 |
On Thu, Feb 11, 2016 at 11:58:53AM +0000, Lorenzo Pieralisi wrote:
> On Thu, Feb 04, 2016 at 06:29:00PM +0100, Tomasz Nowicki wrote:
> > This is the last step before enabling generic ACPI PCI host controller
> > for ARM64. We need to take care of legacy IRQ mapping for non-MSI(X)
> > PCI devices. pcibios_enable_device() boot order is not sensitive to
> > ACPI device enumeration, so it is the best place to assign device's IRQs.
>
> I guess you are referring to:
>
> https://lists.linaro.org/pipermail/linaro-acpi/2015-October/005944.html
>
> It is weird that the dependency can't be enforced, I will have a look
> into this, it would be nice to have DT and ACPI legacy IRQs mapping
> confined in pcibios_add_device() so that we can remove them in one go
> when Matthew's series is merged.
One option, that is not ideal but has the merit of setting the stage
for pcibios_enable_device() AND pcibios_add_device() removal, is to add
IRQ mapping (by adding the call) in a pcibios_alloc_irq() callback (if
Bjorn does not remove it from core code before we manage to add it,
I think he is only reverting the x86 version).
https://lkml.org/lkml/2016/2/9/648
That's called at device probe time, it should not change DT probing path
(unless we use the irq number before the device is probed, which I doubt)
and should allow the ACPI scan handlers to be installed so that the ACPI
IRQ mapping can be effectively carried out.
pcibios_alloc_irq() replaces pcibios_add_device().
When Matthew's patchset lands in mainline, pcibios_alloc_irq() will
be removed too (at least we have a place where all legacy IRQ mappings
are carried out and I can obliterate it easily).
Other option is to change ACPI core code, I see no other way.
Tested on KVM PCI host generic (that uses pci_fixup_irqs() so it does
not really count for DT).
Here (on top of your series), ready for flak.
Lorenzo
-- >8 --
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
index 0b53262..26ee291 100644
--- a/arch/arm64/kernel/pci.c
+++ b/arch/arm64/kernel/pci.c
@@ -45,28 +45,23 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
*/
int pcibios_enable_device(struct pci_dev *dev, int mask)
{
- int ret;
-
if (pci_has_flag(PCI_PROBE_ONLY))
return 0;
- ret = pci_enable_resources(dev, mask);
- if (ret < 0)
- return ret;
-
-#ifdef CONFIG_ACPI
- if (!pci_dev_msi_enabled(dev))
- return acpi_pci_irq_enable(dev);
-#endif
- return 0;
+ return pci_enable_resources(dev, mask);
}
/*
- * Try to assign the IRQ number from DT when adding a new device
+ * Try to assign the IRQ number when probing a new device
*/
-int pcibios_add_device(struct pci_dev *dev)
+int pcibios_alloc_irq(struct pci_dev *dev)
{
- dev->irq = of_irq_parse_and_map_pci(dev, 0, 0);
+ if (acpi_disabled)
+ dev->irq = of_irq_parse_and_map_pci(dev, 0, 0);
+#ifdef CONFIG_ACPI
+ else
+ return acpi_pci_irq_enable(dev);
+#endif
return 0;
}
[toc] | [prev] | [next] | [standalone]
| From | Tomasz Nowicki <tn@semihalf.com> |
|---|---|
| Date | 2016-02-11 19:50 +0100 |
| Subject | Re: [PATCH V4 22/23] arm64, pci, acpi: Assign legacy IRQs once device is enable. |
| Message-ID | <r14tt-4eC-45@gated-at.bofh.it> |
| In reply to | #1332254 |
On 11.02.2016 18:17, Lorenzo Pieralisi wrote:
> Here (on top of your series), ready for flak.
>
> Lorenzo
>
> -- >8 --
> diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
> index 0b53262..26ee291 100644
> --- a/arch/arm64/kernel/pci.c
> +++ b/arch/arm64/kernel/pci.c
> @@ -45,28 +45,23 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
> */
> int pcibios_enable_device(struct pci_dev *dev, int mask)
> {
> - int ret;
> -
> if (pci_has_flag(PCI_PROBE_ONLY))
> return 0;
>
> - ret = pci_enable_resources(dev, mask);
> - if (ret < 0)
> - return ret;
> -
> -#ifdef CONFIG_ACPI
> - if (!pci_dev_msi_enabled(dev))
> - return acpi_pci_irq_enable(dev);
> -#endif
> - return 0;
> + return pci_enable_resources(dev, mask);
> }
>
> /*
> - * Try to assign the IRQ number from DT when adding a new device
> + * Try to assign the IRQ number when probing a new device
> */
> -int pcibios_add_device(struct pci_dev *dev)
> +int pcibios_alloc_irq(struct pci_dev *dev)
> {
> - dev->irq = of_irq_parse_and_map_pci(dev, 0, 0);
> + if (acpi_disabled)
> + dev->irq = of_irq_parse_and_map_pci(dev, 0, 0);
> +#ifdef CONFIG_ACPI
> + else
> + return acpi_pci_irq_enable(dev);
> +#endif
>
> return 0;
> }
I miss that way of solving the problem. OK lets try this way. I will
integrate it.
Tomasz
[toc] | [prev] | [next] | [standalone]
| From | Tomasz Nowicki <tn@semihalf.com> |
|---|---|
| Date | 2016-02-11 19:50 +0100 |
| Subject | Re: [PATCH V4 22/23] arm64, pci, acpi: Assign legacy IRQs once device is enable. |
| Message-ID | <r14tt-4eC-55@gated-at.bofh.it> |
| In reply to | #1331851 |
On 11.02.2016 12:58, Lorenzo Pieralisi wrote: > As for the MSI check, by reading commit history its need I think > it harks back to bba6f6fc, which was supposed to be a quick hack and it > has been in the kernel for 9 years:), is it really needed ? IMO, yes it is needed. We need to chose MSI vs IRQ, and MSI is preferable option. Tomasz
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web