]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
irqchip/irq-msi-lib: Optionally set default irq_eoi()/irq_ack()
authorThomas Gleixner <tglx@linutronix.de>
Mon, 17 Feb 2025 08:56:48 +0000 (14:26 +0530)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 20 Feb 2025 14:19:26 +0000 (15:19 +0100)
msi_lib_init_dev_msi_info() sets the default irq_eoi()/irq_ack() callbacks
unconditionally. This is correct for all existing users, but prevents the
IMSIC driver to be moved to the MSI library implementation.

Introduce chip_flags in struct msi_parent_ops, which instruct the library
to selectively set the callbacks depending on the flags, and update all
current users to set them.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250217085657.789309-3-apatel@ventanamicro.com
drivers/irqchip/irq-gic-v2m.c
drivers/irqchip/irq-gic-v3-its-msi-parent.c
drivers/irqchip/irq-gic-v3-mbi.c
drivers/irqchip/irq-imx-mu-msi.c
drivers/irqchip/irq-loongson-pch-msi.c
drivers/irqchip/irq-msi-lib.c
drivers/irqchip/irq-mvebu-gicp.c
drivers/irqchip/irq-mvebu-odmi.c
drivers/irqchip/irq-mvebu-sei.c
include/linux/msi.h

index be35c5349986aa64094fd37474fdda2f896cf7e3..1e3476c335ca842e6005b8ad2a1f6688ef4a9f8e 100644 (file)
@@ -255,6 +255,7 @@ static void __init gicv2m_teardown(void)
 static struct msi_parent_ops gicv2m_msi_parent_ops = {
        .supported_flags        = GICV2M_MSI_FLAGS_SUPPORTED,
        .required_flags         = GICV2M_MSI_FLAGS_REQUIRED,
+       .chip_flags             = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK,
        .bus_select_token       = DOMAIN_BUS_NEXUS,
        .bus_select_mask        = MATCH_PCI_MSI | MATCH_PLATFORM_MSI,
        .prefix                 = "GICv2m-",
index e150365fbe8922e402ce23d334689093c2301a87..bdb04c8081480de468fb217b68c6933a8e1e2bd7 100644 (file)
@@ -203,6 +203,7 @@ static bool its_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
 const struct msi_parent_ops gic_v3_its_msi_parent_ops = {
        .supported_flags        = ITS_MSI_FLAGS_SUPPORTED,
        .required_flags         = ITS_MSI_FLAGS_REQUIRED,
+       .chip_flags             = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK,
        .bus_select_token       = DOMAIN_BUS_NEXUS,
        .bus_select_mask        = MATCH_PCI_MSI | MATCH_PLATFORM_MSI,
        .prefix                 = "ITS-",
index 3fe870f8ee1744fdd087a73ce1fd4d665871d8de..3e1d8a1cda5e642fa783f08042e61288cadb1f45 100644 (file)
@@ -201,6 +201,7 @@ static bool mbi_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
 static const struct msi_parent_ops gic_v3_mbi_msi_parent_ops = {
        .supported_flags        = MBI_MSI_FLAGS_SUPPORTED,
        .required_flags         = MBI_MSI_FLAGS_REQUIRED,
+       .chip_flags             = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK,
        .bus_select_token       = DOMAIN_BUS_NEXUS,
        .bus_select_mask        = MATCH_PCI_MSI | MATCH_PLATFORM_MSI,
        .prefix                 = "MBI-",
index 4342a21de1eb01d6e195eb4ab02b306cac0f8af7..69aacdfc8bef01278fef78f05914df80292163d1 100644 (file)
@@ -214,6 +214,7 @@ static void imx_mu_msi_irq_handler(struct irq_desc *desc)
 static const struct msi_parent_ops imx_mu_msi_parent_ops = {
        .supported_flags        = IMX_MU_MSI_FLAGS_SUPPORTED,
        .required_flags         = IMX_MU_MSI_FLAGS_REQUIRED,
+       .chip_flags             = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK,
        .bus_select_token       = DOMAIN_BUS_NEXUS,
        .bus_select_mask        = MATCH_PLATFORM_MSI,
        .prefix                 = "MU-MSI-",
index bd337ecddb4097019e74a650eb26d42c5e1ff455..9c62108b3ad588103f9f74f03d931fcdb67d760b 100644 (file)
@@ -146,6 +146,7 @@ static const struct irq_domain_ops pch_msi_middle_domain_ops = {
 static struct msi_parent_ops pch_msi_parent_ops = {
        .required_flags         = PCH_MSI_FLAGS_REQUIRED,
        .supported_flags        = PCH_MSI_FLAGS_SUPPORTED,
+       .chip_flags             = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK,
        .bus_select_mask        = MATCH_PCI_MSI,
        .bus_select_token       = DOMAIN_BUS_NEXUS,
        .prefix                 = "PCH-",
index d8e29fc0d4068b133a0da0de306c3d14ac5a3b50..51464c6257f37fdebbd65bc791e22b9cebd78855 100644 (file)
@@ -28,6 +28,7 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
                               struct msi_domain_info *info)
 {
        const struct msi_parent_ops *pops = real_parent->msi_parent_ops;
+       struct irq_chip *chip = info->chip;
        u32 required_flags;
 
        /* Parent ops available? */
@@ -92,10 +93,10 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
        info->flags                     |= required_flags;
 
        /* Chip updates for all child bus types */
-       if (!info->chip->irq_eoi)
-               info->chip->irq_eoi     = irq_chip_eoi_parent;
-       if (!info->chip->irq_ack)
-               info->chip->irq_ack     = irq_chip_ack_parent;
+       if (!chip->irq_eoi && (pops->chip_flags & MSI_CHIP_FLAG_SET_EOI))
+               chip->irq_eoi = irq_chip_eoi_parent;
+       if (!chip->irq_ack && (pops->chip_flags & MSI_CHIP_FLAG_SET_ACK))
+               chip->irq_ack = irq_chip_ack_parent;
 
        /*
         * The device MSI domain can never have a set affinity callback. It
@@ -105,7 +106,7 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
         * device MSI domain aside of mask/unmask which is provided e.g. by
         * PCI/MSI device domains.
         */
-       info->chip->irq_set_affinity    = msi_domain_set_affinity;
+       chip->irq_set_affinity = msi_domain_set_affinity;
        return true;
 }
 EXPORT_SYMBOL_GPL(msi_lib_init_dev_msi_info);
index 2b6183919ea48bb2ba97ae1614b050256857a969..d67f93f6d750566111d3ac696b309d66d2769ceb 100644 (file)
@@ -161,6 +161,7 @@ static const struct irq_domain_ops gicp_domain_ops = {
 static const struct msi_parent_ops gicp_msi_parent_ops = {
        .supported_flags        = GICP_MSI_FLAGS_SUPPORTED,
        .required_flags         = GICP_MSI_FLAGS_REQUIRED,
+       .chip_flags             = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK,
        .bus_select_token       = DOMAIN_BUS_GENERIC_MSI,
        .bus_select_mask        = MATCH_PLATFORM_MSI,
        .prefix                 = "GICP-",
index ff19bfd258dceabfce26bf4c03f11de2aa7589d7..28f7e81df94f0a34c6287555621960c2f669dcfc 100644 (file)
@@ -157,6 +157,7 @@ static const struct irq_domain_ops odmi_domain_ops = {
 static const struct msi_parent_ops odmi_msi_parent_ops = {
        .supported_flags        = ODMI_MSI_FLAGS_SUPPORTED,
        .required_flags         = ODMI_MSI_FLAGS_REQUIRED,
+       .chip_flags             = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK,
        .bus_select_token       = DOMAIN_BUS_GENERIC_MSI,
        .bus_select_mask        = MATCH_PLATFORM_MSI,
        .prefix                 = "ODMI-",
index 065166ab5dbc044bb2f61248b069b0b0c183a886..ebd4a9014e8da4aff74a18cc84985566b4872e2a 100644 (file)
@@ -356,6 +356,7 @@ static void mvebu_sei_reset(struct mvebu_sei *sei)
 static const struct msi_parent_ops sei_msi_parent_ops = {
        .supported_flags        = SEI_MSI_FLAGS_SUPPORTED,
        .required_flags         = SEI_MSI_FLAGS_REQUIRED,
+       .chip_flags             = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK,
        .bus_select_mask        = MATCH_PLATFORM_MSI,
        .bus_select_token       = DOMAIN_BUS_GENERIC_MSI,
        .prefix                 = "SEI-",
index b10093c4d00ea5a2ce1c7ab10bab00a20bfca327..9abef442c1463b56b9c276e874cf9e2b859a53e0 100644 (file)
@@ -558,11 +558,21 @@ enum {
        MSI_FLAG_NO_AFFINITY            = (1 << 21),
 };
 
+/*
+ * Flags for msi_parent_ops::chip_flags
+ */
+enum {
+       MSI_CHIP_FLAG_SET_EOI           = (1 << 0),
+       MSI_CHIP_FLAG_SET_ACK           = (1 << 1),
+};
+
 /**
  * struct msi_parent_ops - MSI parent domain callbacks and configuration info
  *
  * @supported_flags:   Required: The supported MSI flags of the parent domain
  * @required_flags:    Optional: The required MSI flags of the parent MSI domain
+ * @chip_flags:                Optional: Select MSI chip callbacks to update with defaults
+ *                     in msi_lib_init_dev_msi_info().
  * @bus_select_token:  Optional: The bus token of the real parent domain for
  *                     irq_domain::select()
  * @bus_select_mask:   Optional: A mask of supported BUS_DOMAINs for
@@ -575,6 +585,7 @@ enum {
 struct msi_parent_ops {
        u32             supported_flags;
        u32             required_flags;
+       u32             chip_flags;
        u32             bus_select_token;
        u32             bus_select_mask;
        const char      *prefix;