[irqchip: irq/irqchip-next] irqchip/wpcm450: Drop COMPILE_TEST

2021-04-08 Thread irqchip-bot for Marc Zyngier
The following commit has been merged into the irq/irqchip-next branch of 
irqchip:

Commit-ID: 94bc94209a66f05532c065279f4a719058d447e4
Gitweb:
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/94bc94209a66f05532c065279f4a719058d447e4
Author:Marc Zyngier 
AuthorDate:Thu, 08 Apr 2021 08:56:27 +01:00
Committer: Marc Zyngier 
CommitterDate: Thu, 08 Apr 2021 11:37:14 +01:00

irqchip/wpcm450: Drop COMPILE_TEST

This driver is (for now) ARM specific, and currently doesn't
build with a variety of architectures (ia64, RISC-V, x86_64
at the very least).

Drop COMPILE_TEST from Kconfig until it gets sorted out.

Reviewed-by: Jonathan Neuschäfer 
Reported-by: Stephen Rothwell 
Signed-off-by: Marc Zyngier 
---
 drivers/irqchip/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 38ad9dc..715eb43 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -579,7 +579,7 @@ config MST_IRQ
 
 config WPCM450_AIC
bool "Nuvoton WPCM450 Advanced Interrupt Controller"
-   depends on ARCH_WPCM450 || COMPILE_TEST
+   depends on ARCH_WPCM450
help
  Support for the interrupt controller in the Nuvoton WPCM450 BMC SoC.
 


[irqchip: irq/irqchip-next] irqchip/wpcm450: Drop COMPILE_TEST

2021-04-08 Thread irqchip-bot for Marc Zyngier
The following commit has been merged into the irq/irqchip-next branch of 
irqchip:

Commit-ID: 384cf046e474b40db4773e9358241a5de11ed8a7
Gitweb:
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/384cf046e474b40db4773e9358241a5de11ed8a7
Author:Marc Zyngier 
AuthorDate:Thu, 08 Apr 2021 08:56:27 +01:00
Committer: Marc Zyngier 
CommitterDate: Thu, 08 Apr 2021 08:56:27 +01:00

irqchip/wpcm450: Drop COMPILE_TEST

This driver is (for now) ARM specific, and currently doesn't
build with a variety of architectures (ia64, RISC-V, x86_64
at the very least).

Drop COMPILE_TEST from Kconfig until it gets sorted out.

Cc: Jonathan Neuschäfer 
Reported-by: Stephen Rothwell 
Signed-off-by: Marc Zyngier 
---
 drivers/irqchip/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 38ad9dc..715eb43 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -579,7 +579,7 @@ config MST_IRQ
 
 config WPCM450_AIC
bool "Nuvoton WPCM450 Advanced Interrupt Controller"
-   depends on ARCH_WPCM450 || COMPILE_TEST
+   depends on ARCH_WPCM450
help
  Support for the interrupt controller in the Nuvoton WPCM450 BMC SoC.
 


[irqchip: irq/irqchip-next] sh: intc: Drop the use of irq_create_identity_mapping()

2021-04-07 Thread irqchip-bot for Marc Zyngier
The following commit has been merged into the irq/irqchip-next branch of 
irqchip:

Commit-ID: eef56c3a0492e4c1bc2a081da8f402a26d882489
Gitweb:
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/eef56c3a0492e4c1bc2a081da8f402a26d882489
Author:Marc Zyngier 
AuthorDate:Fri, 02 Apr 2021 15:58:21 +01:00
Committer: Marc Zyngier 
CommitterDate: Wed, 07 Apr 2021 12:12:52 +01:00

sh: intc: Drop the use of irq_create_identity_mapping()

Instead of playing games with using irq_create_identity_mapping()
and irq_domain_associate(), drop the use of the former and only
use the latter, together with the allocation of the irq_desc
as needed.

It doesn't make the code less awful, but at least the intent
is clearer.

Tested-by: Geert Uytterhoeven 
Signed-off-by: Marc Zyngier 
---
 drivers/sh/intc/core.c | 49 +++--
 1 file changed, 19 insertions(+), 30 deletions(-)

diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index a14684f..ca4f4ca 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -179,6 +179,21 @@ static unsigned int __init save_reg(struct intc_desc_int 
*d,
return 0;
 }
 
+static bool __init intc_map(struct irq_domain *domain, int irq)
+{
+   if (!irq_to_desc(irq) && irq_alloc_desc_at(irq, NUMA_NO_NODE) != irq) {
+   pr_err("uname to allocate IRQ %d\n", irq);
+   return false;
+   }
+
+   if (irq_domain_associate(domain, irq, irq)) {
+   pr_err("domain association failure\n");
+   return false;
+   }
+
+   return true;
+}
+
 int __init register_intc_controller(struct intc_desc *desc)
 {
unsigned int i, k, smp;
@@ -311,24 +326,12 @@ int __init register_intc_controller(struct intc_desc 
*desc)
for (i = 0; i < hw->nr_vectors; i++) {
struct intc_vect *vect = hw->vectors + i;
unsigned int irq = evt2irq(vect->vect);
-   int res;
 
if (!vect->enum_id)
continue;
 
-   res = irq_create_identity_mapping(d->domain, irq);
-   if (unlikely(res)) {
-   if (res == -EEXIST) {
-   res = irq_domain_associate(d->domain, irq, irq);
-   if (unlikely(res)) {
-   pr_err("domain association failure\n");
-   continue;
-   }
-   } else {
-   pr_err("can't identity map IRQ %d\n", irq);
-   continue;
-   }
-   }
+   if (!intc_map(d->domain, irq))
+   continue;
 
intc_irq_xlate_set(irq, vect->enum_id, d);
intc_register_irq(desc, d, vect->enum_id, irq);
@@ -345,22 +348,8 @@ int __init register_intc_controller(struct intc_desc *desc)
 * IRQ support, each vector still needs to have
 * its own backing irq_desc.
 */
-   res = irq_create_identity_mapping(d->domain, irq2);
-   if (unlikely(res)) {
-   if (res == -EEXIST) {
-   res = irq_domain_associate(d->domain,
-  irq2, irq2);
-   if (unlikely(res)) {
-   pr_err("domain association "
-  "failure\n");
-   continue;
-   }
-   } else {
-   pr_err("can't identity map IRQ %d\n",
-  irq);
-   continue;
-   }
-   }
+   if (!intc_map(d->domain, irq2))
+   continue;
 
vect2->enum_id = 0;
 


[irqchip: irq/irqchip-next] irqdomain: Get rid of irq_create_identity_mapping()

2021-04-07 Thread irqchip-bot for Marc Zyngier
The following commit has been merged into the irq/irqchip-next branch of 
irqchip:

Commit-ID: 4a35d6a03744ded782c9301f5f5d78ad68ce680f
Gitweb:
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/4a35d6a03744ded782c9301f5f5d78ad68ce680f
Author:Marc Zyngier 
AuthorDate:Wed, 07 Apr 2021 13:17:10 +01:00
Committer: Marc Zyngier 
CommitterDate: Wed, 07 Apr 2021 13:25:52 +01:00

irqdomain: Get rid of irq_create_identity_mapping()

The sole user of irq_create_identity_mapping() having been converted,
get rid of the unused helper.

Signed-off-by: Marc Zyngier 
---
 include/linux/irqdomain.h | 6 --
 kernel/irq/irqdomain.c| 3 ---
 2 files changed, 9 deletions(-)

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 33cacc8..d2c61de 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -419,12 +419,6 @@ extern int irq_create_strict_mappings(struct irq_domain 
*domain,
  unsigned int irq_base,
  irq_hw_number_t hwirq_base, int count);
 
-static inline int irq_create_identity_mapping(struct irq_domain *host,
- irq_hw_number_t hwirq)
-{
-   return irq_create_strict_mappings(host, hwirq, hwirq, 1);
-}
-
 extern const struct irq_domain_ops irq_domain_simple_ops;
 
 /* stock xlate functions */
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index d10ab1d..35c5a99 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -715,9 +715,6 @@ EXPORT_SYMBOL_GPL(irq_create_mapping_affinity);
  * locations. For use by controllers that already have static mappings
  * to insert in to the domain.
  *
- * Non-linear users can use irq_create_identity_mapping() for IRQ-at-a-time
- * domain insertion.
- *
  * 0 is returned upon success, while any failure to establish a static
  * mapping is treated as an error.
  */


[irqchip: irq/irqchip-next] mips: netlogic: Use irq_domain_simple_ops for XLP PIC

2021-04-07 Thread irqchip-bot for Marc Zyngier
The following commit has been merged into the irq/irqchip-next branch of 
irqchip:

Commit-ID: bd781ae53fac31acea9dec594d62a1424952dd4c
Gitweb:
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/bd781ae53fac31acea9dec594d62a1424952dd4c
Author:Marc Zyngier 
AuthorDate:Fri, 02 Apr 2021 18:09:49 +01:00
Committer: Marc Zyngier 
CommitterDate: Wed, 07 Apr 2021 13:25:52 +01:00

mips: netlogic: Use irq_domain_simple_ops for XLP PIC

Use the generic irq_domain_simple_ops structure instead of
a home-grown one.

Acked-by: Thomas Bogendoerfer 
Signed-off-by: Marc Zyngier 
---
 arch/mips/netlogic/common/irq.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/mips/netlogic/common/irq.c b/arch/mips/netlogic/common/irq.c
index cf33dd8..c25a2ce 100644
--- a/arch/mips/netlogic/common/irq.c
+++ b/arch/mips/netlogic/common/irq.c
@@ -276,10 +276,6 @@ asmlinkage void plat_irq_dispatch(void)
 }
 
 #ifdef CONFIG_CPU_XLP
-static const struct irq_domain_ops xlp_pic_irq_domain_ops = {
-   .xlate = irq_domain_xlate_onetwocell,
-};
-
 static int __init xlp_of_pic_init(struct device_node *node,
struct device_node *parent)
 {
@@ -324,7 +320,7 @@ static int __init xlp_of_pic_init(struct device_node *node,
 
xlp_pic_domain = irq_domain_add_legacy(node, n_picirqs,
nlm_irq_to_xirq(socid, PIC_IRQ_BASE), PIC_IRQ_BASE,
-   _pic_irq_domain_ops, NULL);
+   _domain_simple_ops, NULL);
if (xlp_pic_domain == NULL) {
pr_err("PIC %pOFn: Creating legacy domain failed!\n", node);
return -EINVAL;


[irqchip: irq/irqchip-next] irqchip: Do not blindly select CONFIG_GENERIC_IRQ_MULTI_HANDLER

2021-03-08 Thread irqchip-bot for Marc Zyngier
The following commit has been merged into the irq/irqchip-next branch of 
irqchip:

Commit-ID: a79f7051cccb6f3bcd3d2a0a058c7d5c79bb0371
Gitweb:
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/a79f7051cccb6f3bcd3d2a0a058c7d5c79bb0371
Author:Marc Zyngier 
AuthorDate:Wed, 17 Feb 2021 14:28:00 
Committer: Marc Zyngier 
CommitterDate: Mon, 08 Mar 2021 20:18:41 

irqchip: Do not blindly select CONFIG_GENERIC_IRQ_MULTI_HANDLER

Implementing CONFIG_GENERIC_IRQ_MULTI_HANDLER is a decision that is
made at the architecture level, and shouldn't involve the irqchip
at all (we even provide a fallback helper when the option isn't
selected).

Drop all instances of such selection from non-arch code.

Signed-off-by: Marc Zyngier 
Link: https://lore.kernel.org/r/20210217142800.2547737-1-...@kernel.org
Signed-off-by: Mark Rutland 
Tested-by: Hector Martin 
Cc: Catalin Marinas 
Cc: James Morse 
Cc: Thomas Gleixner 
Cc: Will Deacon 
Signed-off-by: Marc Zyngier 
---
 drivers/irqchip/Kconfig |  9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index e74fa20..15536e3 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -8,7 +8,6 @@ config IRQCHIP
 config ARM_GIC
bool
select IRQ_DOMAIN_HIERARCHY
-   select GENERIC_IRQ_MULTI_HANDLER
select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 
 config ARM_GIC_PM
@@ -33,7 +32,6 @@ config GIC_NON_BANKED
 
 config ARM_GIC_V3
bool
-   select GENERIC_IRQ_MULTI_HANDLER
select IRQ_DOMAIN_HIERARCHY
select PARTITION_PERCPU
select GENERIC_IRQ_EFFECTIVE_AFF_MASK
@@ -64,7 +62,6 @@ config ARM_NVIC
 config ARM_VIC
bool
select IRQ_DOMAIN
-   select GENERIC_IRQ_MULTI_HANDLER
 
 config ARM_VIC_NR
int
@@ -99,14 +96,12 @@ config ATMEL_AIC_IRQ
bool
select GENERIC_IRQ_CHIP
select IRQ_DOMAIN
-   select GENERIC_IRQ_MULTI_HANDLER
select SPARSE_IRQ
 
 config ATMEL_AIC5_IRQ
bool
select GENERIC_IRQ_CHIP
select IRQ_DOMAIN
-   select GENERIC_IRQ_MULTI_HANDLER
select SPARSE_IRQ
 
 config I8259
@@ -153,7 +148,6 @@ config DW_APB_ICTL
 config FARADAY_FTINTC010
bool
select IRQ_DOMAIN
-   select GENERIC_IRQ_MULTI_HANDLER
select SPARSE_IRQ
 
 config HISILICON_IRQ_MBIGEN
@@ -169,7 +163,6 @@ config IMGPDC_IRQ
 config IXP4XX_IRQ
bool
select IRQ_DOMAIN
-   select GENERIC_IRQ_MULTI_HANDLER
select SPARSE_IRQ
 
 config MADERA_IRQ
@@ -186,7 +179,6 @@ config CLPS711X_IRQCHIP
bool
depends on ARCH_CLPS711X
select IRQ_DOMAIN
-   select GENERIC_IRQ_MULTI_HANDLER
select SPARSE_IRQ
default y
 
@@ -205,7 +197,6 @@ config OMAP_IRQCHIP
 config ORION_IRQCHIP
bool
select IRQ_DOMAIN
-   select GENERIC_IRQ_MULTI_HANDLER
 
 config PIC32_EVIC
bool


[irqchip: irq/irqchip-next] ARM: ep93xx: Select GENERIC_IRQ_MULTI_HANDLER directly

2021-03-08 Thread irqchip-bot for Marc Zyngier
The following commit has been merged into the irq/irqchip-next branch of 
irqchip:

Commit-ID: 3e895f4cbd158c31f1295d097a73ea4fe50f88f4
Gitweb:
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/3e895f4cbd158c31f1295d097a73ea4fe50f88f4
Author:Marc Zyngier 
AuthorDate:Wed, 17 Feb 2021 18:10:35 
Committer: Marc Zyngier 
CommitterDate: Mon, 08 Mar 2021 20:18:32 

ARM: ep93xx: Select GENERIC_IRQ_MULTI_HANDLER directly

ep93xx currently relies of CONFIG_ARM_VIC to select
GENERIC_IRQ_MULTI_HANDLER. Given that this is logically a platform
architecture property, add the selection of GENERIC_IRQ_MULTI_HANDLER
at the platform level.

Further patches will remove the selection from the irqchip side.

Reported-by: Marc Rutland 
Signed-off-by: Marc Zyngier 
Signed-off-by: Mark Rutland 
Tested-by: Hector Martin 
Cc: Catalin Marinas 
Cc: James Morse 
Cc: Thomas Gleixner 
Cc: Will Deacon 
Signed-off-by: Marc Zyngier 
---
 arch/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 853aab5..5da96f5 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -348,6 +348,7 @@ config ARCH_EP93XX
select ARM_AMBA
imply ARM_PATCH_PHYS_VIRT
select ARM_VIC
+   select GENERIC_IRQ_MULTI_HANDLER
select AUTO_ZRELADDR
select CLKDEV_LOOKUP
select CLKSRC_MMIO


[irqchip: irq/irqchip-next] irqchip/bcm2836: Fix IPI acknowledgement after conversion to handle_percpu_devid_irq

2020-12-18 Thread irqchip-bot for Marc Zyngier
The following commit has been merged into the irq/irqchip-next branch of 
irqchip:

Commit-ID: d7f39c40ebb6986e7371510d1c20a4efee4a7f0d
Gitweb:
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/d7f39c40ebb6986e7371510d1c20a4efee4a7f0d
Author:Marc Zyngier 
AuthorDate:Fri, 18 Dec 2020 18:03:46 
Committer: Marc Zyngier 
CommitterDate: Fri, 18 Dec 2020 18:34:17 

irqchip/bcm2836: Fix IPI acknowledgement after conversion to 
handle_percpu_devid_irq

It appears that despite its name, the bcm2836_arm_irqchip_ipi_eoi()
callback is an acknowledgement, and not an EOI. This means that
we lose IPIs that are made pending between the handling of the
IPI and the write to LOCAL_MAILBOX0_CLR0. With the right timing,
things fail nicely.

This used to work with handle_percpu_devid_fasteoi_ipi(), which
started by eoi-ing the interrupt. With the standard fasteoi flow,
this doesn't work anymore.

So let's use this callback for what it is, an ack. Your favourite
RPi-2/3 is back up and running.

Fixes: ffdad793d579 ("irqchip/bcm2836: Make IPIs use handle_percpu_devid_irq()")
Cc: Valentin Schneider 
Reported-by: Guenter Roeck 
Tested-by: Guenter Roeck 
Signed-off-by: Marc Zyngier 
Link: 
https://lore.kernel.org/r/c9fb4ab3-a5cb-648c-6de3-c6a871e60...@roeck-us.net
---
 drivers/irqchip/irq-bcm2836.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c
index 5f5eb88..25c9a9c 100644
--- a/drivers/irqchip/irq-bcm2836.c
+++ b/drivers/irqchip/irq-bcm2836.c
@@ -167,7 +167,7 @@ static void bcm2836_arm_irqchip_handle_ipi(struct irq_desc 
*desc)
chained_irq_exit(chip, desc);
 }
 
-static void bcm2836_arm_irqchip_ipi_eoi(struct irq_data *d)
+static void bcm2836_arm_irqchip_ipi_ack(struct irq_data *d)
 {
int cpu = smp_processor_id();
 
@@ -195,7 +195,7 @@ static struct irq_chip bcm2836_arm_irqchip_ipi = {
.name   = "IPI",
.irq_mask   = bcm2836_arm_irqchip_dummy_op,
.irq_unmask = bcm2836_arm_irqchip_dummy_op,
-   .irq_eoi= bcm2836_arm_irqchip_ipi_eoi,
+   .irq_ack= bcm2836_arm_irqchip_ipi_ack,
.ipi_send_mask  = bcm2836_arm_irqchip_ipi_send_mask,
 };
 


[irqchip: irq/irqchip-next] platform-msi: Track shared domain allocation

2020-12-11 Thread irqchip-bot for Marc Zyngier
The following commit has been merged into the irq/irqchip-next branch of 
irqchip:

Commit-ID: 91f90daa4fb2b77db7aa25ef2e0206f2e3962665
Gitweb:
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/91f90daa4fb2b77db7aa25ef2e0206f2e3962665
Author:Marc Zyngier 
AuthorDate:Sun, 29 Nov 2020 13:52:06 
Committer: Marc Zyngier 
CommitterDate: Fri, 11 Dec 2020 14:47:50 

platform-msi: Track shared domain allocation

We have two flavours of platform-MSI:

- MSIs generated by devices for themselves (the usual case)

- MSIs generated on behalf of other devices, as the generating
  device is some form of bridge (either a wire-to-MSI bridge,
  or even a non-transparent PCI bridge that repaints the PCI
  requester ID).

In the latter case, the underlying interrupt architecture may need
to track this in order to keep the mapping alive even when no MSI
are currently being generated.

Add a set of flags to the generic msi_alloc_info_t structure, as
well as the MSI_ALLOC_FLAGS_PROXY_DEVICE flag that will get
advertized by the platform-MSI code when allocating an irqdomain
for a device.

Signed-off-by: Marc Zyngier 
Tested-by: John Garry 
Link: https://lore.kernel.org/r/20201129135208.680293-2-...@kernel.org
---
 drivers/base/platform-msi.c | 7 +++
 include/asm-generic/msi.h   | 4 
 2 files changed, 11 insertions(+)

diff --git a/drivers/base/platform-msi.c b/drivers/base/platform-msi.c
index c4a17e5..2c1e2e0 100644
--- a/drivers/base/platform-msi.c
+++ b/drivers/base/platform-msi.c
@@ -59,9 +59,15 @@ static int platform_msi_init(struct irq_domain *domain,
return irq_domain_set_hwirq_and_chip(domain, virq, hwirq,
 info->chip, info->chip_data);
 }
+
+static void platform_msi_set_proxy_dev(msi_alloc_info_t *arg)
+{
+   arg->flags |= MSI_ALLOC_FLAGS_PROXY_DEVICE;
+}
 #else
 #define platform_msi_set_desc  NULL
 #define platform_msi_init  NULL
+#define platform_msi_set_proxy_dev(x)  do {} while(0)
 #endif
 
 static void platform_msi_update_dom_ops(struct msi_domain_info *info)
@@ -343,6 +349,7 @@ __platform_msi_create_device_domain(struct device *dev,
if (!domain)
goto free_priv;
 
+   platform_msi_set_proxy_dev(>arg);
err = msi_domain_prepare_irqs(domain->parent, dev, nvec, >arg);
if (err)
goto free_domain;
diff --git a/include/asm-generic/msi.h b/include/asm-generic/msi.h
index e6795f0..1010e74 100644
--- a/include/asm-generic/msi.h
+++ b/include/asm-generic/msi.h
@@ -22,12 +22,16 @@ struct msi_desc;
 typedef struct msi_alloc_info {
struct msi_desc *desc;
irq_hw_number_t hwirq;
+   unsigned long   flags;
union {
unsigned long   ul;
void*ptr;
} scratchpad[NUM_MSI_ALLOC_SCRATCHPAD_REGS];
 } msi_alloc_info_t;
 
+/* Device generating MSIs is proxying for another device */
+#define MSI_ALLOC_FLAGS_PROXY_DEVICE   (1UL << 0)
+
 #define GENERIC_MSI_DOMAIN_OPS 1
 
 #endif


[irqchip: irq/irqchip-next] irqchip/alpine-msi: Fix freeing of interrupts on allocation error path

2020-12-11 Thread irqchip-bot for Marc Zyngier
The following commit has been merged into the irq/irqchip-next branch of 
irqchip:

Commit-ID: 3841245e8498a789c65dedd7ffa8fb2fee2c0684
Gitweb:
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/3841245e8498a789c65dedd7ffa8fb2fee2c0684
Author:Marc Zyngier 
AuthorDate:Sun, 29 Nov 2020 13:55:25 
Committer: Marc Zyngier 
CommitterDate: Fri, 11 Dec 2020 14:45:22 

irqchip/alpine-msi: Fix freeing of interrupts on allocation error path

The alpine-msi driver has an interesting allocation error handling,
where it frees the same interrupts repeatedly. Hilarity follows.

This code is probably never executed, but let's fix it nonetheless.

Fixes: e6b78f2c3e14 ("irqchip: Add the Alpine MSIX interrupt controller")
Signed-off-by: Marc Zyngier 
Reviewed-by: Antoine Tenart 
Cc: Tsahee Zidenberg 
Cc: Antoine Tenart 
Link: https://lore.kernel.org/r/20201129135525.396671-1-...@kernel.org
---
 drivers/irqchip/irq-alpine-msi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-alpine-msi.c b/drivers/irqchip/irq-alpine-msi.c
index 23a3b87..ede02dc 100644
--- a/drivers/irqchip/irq-alpine-msi.c
+++ b/drivers/irqchip/irq-alpine-msi.c
@@ -165,8 +165,7 @@ static int alpine_msix_middle_domain_alloc(struct 
irq_domain *domain,
return 0;
 
 err_sgi:
-   while (--i >= 0)
-   irq_domain_free_irqs_parent(domain, virq, i);
+   irq_domain_free_irqs_parent(domain, virq, i - 1);
alpine_msix_free_sgi(priv, sgi, nr_irqs);
return err;
 }


[irqchip: irq/irqchip-next] irqchip/gic-v3-its: Tag ITS device as shared if allocating for a proxy device

2020-12-11 Thread irqchip-bot for Marc Zyngier
The following commit has been merged into the irq/irqchip-next branch of 
irqchip:

Commit-ID: 5fe71d271df8c05e1060c0184764eba18b17a96f
Gitweb:
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/5fe71d271df8c05e1060c0184764eba18b17a96f
Author:Marc Zyngier 
AuthorDate:Sun, 29 Nov 2020 13:52:07 
Committer: Marc Zyngier 
CommitterDate: Fri, 11 Dec 2020 14:47:50 

irqchip/gic-v3-its: Tag ITS device as shared if allocating for a proxy device

The ITS already has some notion of "shared" devices. Let's map the
MSI_ALLOC_FLAGS_PROXY_DEVICE flag onto this internal property.

Signed-off-by: Marc Zyngier 
Tested-by: John Garry 
Link: https://lore.kernel.org/r/20201129135208.680293-3-...@kernel.org
---
 drivers/irqchip/irq-gic-v3-its.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index d74ef41..c951ad2 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -3487,6 +3487,9 @@ static int its_msi_prepare(struct irq_domain *domain, 
struct device *dev,
goto out;
}
 
+   if (info->flags & MSI_ALLOC_FLAGS_PROXY_DEVICE)
+   its_dev->shared = true;
+
pr_debug("ITT %d entries, %d bits\n", nvec, ilog2(nvec));
 out:
mutex_unlock(>dev_alloc_lock);


[irqchip: irq/irqchip-next] irqchip/gic-v3-its: Flag device allocation as proxied if behind a PCI bridge

2020-12-11 Thread irqchip-bot for Marc Zyngier
The following commit has been merged into the irq/irqchip-next branch of 
irqchip:

Commit-ID: 34dd263fce3114147f21698f8e55e05b9e8185bd
Gitweb:
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/34dd263fce3114147f21698f8e55e05b9e8185bd
Author:Marc Zyngier 
AuthorDate:Sun, 29 Nov 2020 13:52:08 
Committer: Marc Zyngier 
CommitterDate: Fri, 11 Dec 2020 14:47:50 

irqchip/gic-v3-its: Flag device allocation as proxied if behind a PCI bridge

An aliasing PCI bridge is another case where we should flag the
corresponding allocation as "proxied", as MSIs are coming with
the bridge's RID, and not the originating device's.

Signed-off-by: Marc Zyngier 
Tested-by: John Garry 
Link: https://lore.kernel.org/r/20201129135208.680293-4-...@kernel.org
---
 drivers/irqchip/irq-gic-v3-its-pci-msi.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c 
b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
index 87711e0..ad2810c 100644
--- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c
+++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
@@ -67,11 +67,16 @@ static int its_pci_msi_prepare(struct irq_domain *domain, 
struct device *dev,
/*
 * If pdev is downstream of any aliasing bridges, take an upper
 * bound of how many other vectors could map to the same DevID.
+* Also tell the ITS that the signalling will come from a proxy
+* device, and that special allocation rules apply.
 */
pci_for_each_dma_alias(pdev, its_get_pci_alias, _dev);
-   if (alias_dev != pdev && alias_dev->subordinate)
-   pci_walk_bus(alias_dev->subordinate, its_pci_msi_vec_count,
-_count);
+   if (alias_dev != pdev) {
+   if (alias_dev->subordinate)
+   pci_walk_bus(alias_dev->subordinate,
+its_pci_msi_vec_count, _count);
+   info->flags |= MSI_ALLOC_FLAGS_PROXY_DEVICE;
+   }
 
/* ITS specific DeviceID, as the core ITS ignores dev. */
info->scratchpad[0].ul = pci_msi_domain_get_msi_rid(domain, pdev);