All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH kvmtool RESENT] arm/pci: update interrupt-map only for legacy interrupts
@ 2021-11-11 12:02 Sathyam Panda
  2021-11-11 14:29 ` Alexandru Elisei
  2021-12-14 15:18 ` Will Deacon
  0 siblings, 2 replies; 3+ messages in thread
From: Sathyam Panda @ 2021-11-11 12:02 UTC (permalink / raw)
  To: will, julien.thierry.kdev, kvm
  Cc: andre.przywara, alexandru.elisei, jean-philippe, vivek.gautam,
	sathyam.panda

The interrupt pin cell in "interrupt-map" property
is defined only for legacy interrupts with a valid
range in [1-4] corrspoding to INTA#..INTD#. And the
PCI endpoint devices that support advance interrupt
mechanism like MSI or MSI-X should not have an entry
with value 0 in "interrupt-map". This patch takes
care of this problem by avoiding redundant entries.

Signed-off-by: Sathyam Panda <sathyam.panda@arm.com>
Reviewed-by: Vivek Kumar Gautam <vivek.gautam@arm.com>
---
 arm/pci.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arm/pci.c b/arm/pci.c
index 2251f62..e44e453 100644
--- a/arm/pci.c
+++ b/arm/pci.c
@@ -80,6 +80,16 @@ void pci__generate_fdt_nodes(void *fdt)
 		u8 irq = pci_hdr->irq_line;
 		u32 irq_flags = pci_hdr->irq_type;
 
+		/*
+		 * Avoid adding entries in "interrupt-map" for devices that
+		 * will be using advance interrupt mechanisms like MSI or
+		 * MSI-X instead of legacy interrupt pins INTA#..INTD#
+		 */
+		if (pin == 0) {
+			dev_hdr = device__next_dev(dev_hdr);
+			continue;
+		}
+
 		*entry = (struct of_interrupt_map_entry) {
 			.pci_irq_mask = {
 				.pci_addr = {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH kvmtool RESENT] arm/pci: update interrupt-map only for legacy interrupts
  2021-11-11 12:02 [PATCH kvmtool RESENT] arm/pci: update interrupt-map only for legacy interrupts Sathyam Panda
@ 2021-11-11 14:29 ` Alexandru Elisei
  2021-12-14 15:18 ` Will Deacon
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandru Elisei @ 2021-11-11 14:29 UTC (permalink / raw)
  To: Sathyam Panda
  Cc: will, julien.thierry.kdev, kvm, andre.przywara, jean-philippe,
	vivek.gautam, sathyam.panda

Hi Sathyam,

On Thu, Nov 11, 2021 at 12:02:31PM +0000, Sathyam Panda wrote:
> The interrupt pin cell in "interrupt-map" property
> is defined only for legacy interrupts with a valid
> range in [1-4] corrspoding to INTA#..INTD#. And the
> PCI endpoint devices that support advance interrupt
> mechanism like MSI or MSI-X should not have an entry
> with value 0 in "interrupt-map". This patch takes
> care of this problem by avoiding redundant entries.
> 
> Signed-off-by: Sathyam Panda <sathyam.panda@arm.com>
> Reviewed-by: Vivek Kumar Gautam <vivek.gautam@arm.com>
> ---
>  arm/pci.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/arm/pci.c b/arm/pci.c
> index 2251f62..e44e453 100644
> --- a/arm/pci.c
> +++ b/arm/pci.c
> @@ -80,6 +80,16 @@ void pci__generate_fdt_nodes(void *fdt)
>  		u8 irq = pci_hdr->irq_line;
>  		u32 irq_flags = pci_hdr->irq_type;
>  
> +		/*
> +		 * Avoid adding entries in "interrupt-map" for devices that
> +		 * will be using advance interrupt mechanisms like MSI or
> +		 * MSI-X instead of legacy interrupt pins INTA#..INTD#
> +		 */
> +		if (pin == 0) {
> +			dev_hdr = device__next_dev(dev_hdr);
> +			continue;
> +		}

I found this in "Open Firmware Recommended Practive: Interrupt Mapping" [1]
(referenced by Documentation/devicetree/bindings/pci/pci.txt in the Linux source
tree), in the PCI bus examples section (page 8):

"The PCI binding defines an "interrupts" property to consist of one cell, which
encodes wheth- er the PCI device’s interrupt is connected to the PCI connector’s
INTA#...INTD# pins, with values 1...4, respectively (assuming that the device is
on a plug-in PCI card)".

The patch makes sense to me, if the interrupt pin is not present a the device,
don't describe it in the DTB:

Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>

[1] https://www.devicetree.org/open-firmware/practice/imap/imap0_9d.pdf

Thanks,
Alex

> +
>  		*entry = (struct of_interrupt_map_entry) {
>  			.pci_irq_mask = {
>  				.pci_addr = {
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH kvmtool RESENT] arm/pci: update interrupt-map only for legacy interrupts
  2021-11-11 12:02 [PATCH kvmtool RESENT] arm/pci: update interrupt-map only for legacy interrupts Sathyam Panda
  2021-11-11 14:29 ` Alexandru Elisei
@ 2021-12-14 15:18 ` Will Deacon
  1 sibling, 0 replies; 3+ messages in thread
From: Will Deacon @ 2021-12-14 15:18 UTC (permalink / raw)
  To: julien.thierry.kdev, kvm, Sathyam Panda
  Cc: catalin.marinas, kernel-team, Will Deacon, jean-philippe,
	alexandru.elisei, sathyam.panda, andre.przywara, vivek.gautam

On Thu, 11 Nov 2021 12:02:31 +0000, Sathyam Panda wrote:
> The interrupt pin cell in "interrupt-map" property
> is defined only for legacy interrupts with a valid
> range in [1-4] corrspoding to INTA#..INTD#. And the
> PCI endpoint devices that support advance interrupt
> mechanism like MSI or MSI-X should not have an entry
> with value 0 in "interrupt-map". This patch takes
> care of this problem by avoiding redundant entries.
> 
> [...]

Applied to kvmtool (master), thanks!

[1/1] arm/pci: update interrupt-map only for legacy interrupts
      https://git.kernel.org/will/kvmtool/c/7a60af05c183

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-14 15:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11 12:02 [PATCH kvmtool RESENT] arm/pci: update interrupt-map only for legacy interrupts Sathyam Panda
2021-11-11 14:29 ` Alexandru Elisei
2021-12-14 15:18 ` Will Deacon

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.