Skip to content

Commit 6988e0e

Browse files
Marc ZyngierKAGA-KOKO
authored andcommitted
genirq/msi: Limit level-triggered MSI to platform devices
Nobody would be insane enough to try and use level triggered MSIs on PCI, but let's make sure it doesn't happen. Also, let's mandate that the irqchip backing the platform MSI domain is providing the IRQCHIP_SUPPORTS_LEVEL_MSI flag. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Rob Herring <robh@kernel.org> Cc: Jason Cooper <jason@lakedaemon.net> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Cc: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lkml.kernel.org/r/20180508121438.11301-3-marc.zyngier@arm.com
1 parent 0be8153 commit 6988e0e

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

drivers/base/platform-msi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ static void platform_msi_update_chip_ops(struct msi_domain_info *info)
101101
chip->irq_set_affinity = msi_domain_set_affinity;
102102
if (!chip->irq_write_msi_msg)
103103
chip->irq_write_msi_msg = platform_msi_write_msg;
104+
if (WARN_ON((info->flags & MSI_FLAG_LEVEL_CAPABLE) &&
105+
!(chip->flags & IRQCHIP_SUPPORTS_LEVEL_MSI)))
106+
info->flags &= ~MSI_FLAG_LEVEL_CAPABLE;
104107
}
105108

106109
static void platform_msi_free_descs(struct device *dev, int base, int nvec)

drivers/bus/fsl-mc/fsl-mc-msi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode,
163163
{
164164
struct irq_domain *domain;
165165

166+
if (WARN_ON((info->flags & MSI_FLAG_LEVEL_CAPABLE)))
167+
info->flags &= ~MSI_FLAG_LEVEL_CAPABLE;
166168
if (info->flags & MSI_FLAG_USE_DEF_DOM_OPS)
167169
fsl_mc_msi_update_dom_ops(info);
168170
if (info->flags & MSI_FLAG_USE_DEF_CHIP_OPS)

drivers/pci/msi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,6 +1434,9 @@ struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode,
14341434
{
14351435
struct irq_domain *domain;
14361436

1437+
if (WARN_ON(info->flags & MSI_FLAG_LEVEL_CAPABLE))
1438+
info->flags &= ~MSI_FLAG_LEVEL_CAPABLE;
1439+
14371440
if (info->flags & MSI_FLAG_USE_DEF_DOM_OPS)
14381441
pci_msi_domain_update_dom_ops(info);
14391442
if (info->flags & MSI_FLAG_USE_DEF_CHIP_OPS)

include/linux/irq.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ enum {
512512
IRQCHIP_SKIP_SET_WAKE = (1 << 4),
513513
IRQCHIP_ONESHOT_SAFE = (1 << 5),
514514
IRQCHIP_EOI_THREADED = (1 << 6),
515+
IRQCHIP_SUPPORTS_LEVEL_MSI = (1 << 7),
515516
};
516517

517518
#include <linux/irqdesc.h>

0 commit comments

Comments
 (0)