Skip to content

Commit 7b2f8aa

Browse files
committed
irqchip/imx-mu-msi: Switch to MSI parent
All platform MSI users and the PCI/MSI code handle per device MSI domains when the irqdomain associated to the device provides MSI parent functionality. Remove the "global" platform domain related code and provide the MSI parent functionality by filling in msi_parent_ops. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Anna-Maria Behnsen <[email protected]> Signed-off-by: Shivamurthy Shastri <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 74e4445 commit 7b2f8aa

File tree

3 files changed

+24
-27
lines changed

3 files changed

+24
-27
lines changed

drivers/irqchip/Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ config IMX_MU_MSI
492492
select IRQ_DOMAIN
493493
select IRQ_DOMAIN_HIERARCHY
494494
select GENERIC_MSI_IRQ
495+
select IRQ_MSI_LIB
495496
help
496497
Provide a driver for the i.MX Messaging Unit block used as a
497498
CPU-to-CPU MSI controller. This requires a specially crafted DT

drivers/irqchip/irq-imx-mu-msi.c

+21-27
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include <linux/pm_domain.h>
2525
#include <linux/spinlock.h>
2626

27+
#include "irq-msi-lib.h"
28+
2729
#define IMX_MU_CHANS 4
2830

2931
enum imx_mu_xcr {
@@ -114,20 +116,6 @@ static void imx_mu_msi_parent_ack_irq(struct irq_data *data)
114116
imx_mu_read(msi_data, msi_data->cfg->xRR + data->hwirq * 4);
115117
}
116118

117-
static struct irq_chip imx_mu_msi_irq_chip = {
118-
.name = "MU-MSI",
119-
.irq_ack = irq_chip_ack_parent,
120-
};
121-
122-
static struct msi_domain_ops imx_mu_msi_irq_ops = {
123-
};
124-
125-
static struct msi_domain_info imx_mu_msi_domain_info = {
126-
.flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS),
127-
.ops = &imx_mu_msi_irq_ops,
128-
.chip = &imx_mu_msi_irq_chip,
129-
};
130-
131119
static void imx_mu_msi_parent_compose_msg(struct irq_data *data,
132120
struct msi_msg *msg)
133121
{
@@ -195,6 +183,7 @@ static void imx_mu_msi_domain_irq_free(struct irq_domain *domain,
195183
}
196184

197185
static const struct irq_domain_ops imx_mu_msi_domain_ops = {
186+
.select = msi_lib_irq_domain_select,
198187
.alloc = imx_mu_msi_domain_irq_alloc,
199188
.free = imx_mu_msi_domain_irq_free,
200189
};
@@ -216,6 +205,21 @@ static void imx_mu_msi_irq_handler(struct irq_desc *desc)
216205
chained_irq_exit(chip, desc);
217206
}
218207

208+
#define IMX_MU_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \
209+
MSI_FLAG_USE_DEF_CHIP_OPS | \
210+
MSI_FLAG_PARENT_PM_DEV)
211+
212+
#define IMX_MU_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK)
213+
214+
static const struct msi_parent_ops imx_mu_msi_parent_ops = {
215+
.supported_flags = IMX_MU_MSI_FLAGS_SUPPORTED,
216+
.required_flags = IMX_MU_MSI_FLAGS_REQUIRED,
217+
.bus_select_token = DOMAIN_BUS_NEXUS,
218+
.bus_select_mask = MATCH_PLATFORM_MSI,
219+
.prefix = "MU-MSI-",
220+
.init_dev_msi_info = msi_lib_init_dev_msi_info,
221+
};
222+
219223
static int imx_mu_msi_domains_init(struct imx_mu_msi *msi_data, struct device *dev)
220224
{
221225
struct fwnode_handle *fwnodes = dev_fwnode(dev);
@@ -230,19 +234,9 @@ static int imx_mu_msi_domains_init(struct imx_mu_msi *msi_data, struct device *d
230234
}
231235

232236
irq_domain_update_bus_token(parent, DOMAIN_BUS_NEXUS);
233-
234-
msi_data->msi_domain = platform_msi_create_irq_domain(fwnodes,
235-
&imx_mu_msi_domain_info,
236-
parent);
237-
238-
if (!msi_data->msi_domain) {
239-
dev_err(dev, "failed to create MSI domain\n");
240-
irq_domain_remove(parent);
241-
return -ENOMEM;
242-
}
243-
244-
irq_domain_set_pm_device(msi_data->msi_domain, dev);
245-
237+
parent->dev = parent->pm_dev = dev;
238+
parent->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT;
239+
parent->msi_parent_ops = &imx_mu_msi_parent_ops;
246240
return 0;
247241
}
248242

drivers/irqchip/irq-msi-lib.c

+2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
9494
/* Chip updates for all child bus types */
9595
if (!info->chip->irq_eoi)
9696
info->chip->irq_eoi = irq_chip_eoi_parent;
97+
if (!info->chip->irq_ack)
98+
info->chip->irq_ack = irq_chip_ack_parent;
9799

98100
/*
99101
* The device MSI domain can never have a set affinity callback. It

0 commit comments

Comments
 (0)