Skip to content

Commit 1c000dc

Browse files
committed
irqchip/irq-msi-lib: Optionally set default irq_eoi()/irq_ack()
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 <[email protected]> Signed-off-by: Anup Patel <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 999f458 commit 1c000dc

File tree

10 files changed

+25
-5
lines changed

10 files changed

+25
-5
lines changed

drivers/irqchip/irq-gic-v2m.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ static void __init gicv2m_teardown(void)
255255
static struct msi_parent_ops gicv2m_msi_parent_ops = {
256256
.supported_flags = GICV2M_MSI_FLAGS_SUPPORTED,
257257
.required_flags = GICV2M_MSI_FLAGS_REQUIRED,
258+
.chip_flags = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK,
258259
.bus_select_token = DOMAIN_BUS_NEXUS,
259260
.bus_select_mask = MATCH_PCI_MSI | MATCH_PLATFORM_MSI,
260261
.prefix = "GICv2m-",

drivers/irqchip/irq-gic-v3-its-msi-parent.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ static bool its_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
203203
const struct msi_parent_ops gic_v3_its_msi_parent_ops = {
204204
.supported_flags = ITS_MSI_FLAGS_SUPPORTED,
205205
.required_flags = ITS_MSI_FLAGS_REQUIRED,
206+
.chip_flags = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK,
206207
.bus_select_token = DOMAIN_BUS_NEXUS,
207208
.bus_select_mask = MATCH_PCI_MSI | MATCH_PLATFORM_MSI,
208209
.prefix = "ITS-",

drivers/irqchip/irq-gic-v3-mbi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ static bool mbi_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
201201
static const struct msi_parent_ops gic_v3_mbi_msi_parent_ops = {
202202
.supported_flags = MBI_MSI_FLAGS_SUPPORTED,
203203
.required_flags = MBI_MSI_FLAGS_REQUIRED,
204+
.chip_flags = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK,
204205
.bus_select_token = DOMAIN_BUS_NEXUS,
205206
.bus_select_mask = MATCH_PCI_MSI | MATCH_PLATFORM_MSI,
206207
.prefix = "MBI-",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ static void imx_mu_msi_irq_handler(struct irq_desc *desc)
214214
static const struct msi_parent_ops imx_mu_msi_parent_ops = {
215215
.supported_flags = IMX_MU_MSI_FLAGS_SUPPORTED,
216216
.required_flags = IMX_MU_MSI_FLAGS_REQUIRED,
217+
.chip_flags = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK,
217218
.bus_select_token = DOMAIN_BUS_NEXUS,
218219
.bus_select_mask = MATCH_PLATFORM_MSI,
219220
.prefix = "MU-MSI-",

drivers/irqchip/irq-loongson-pch-msi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ static const struct irq_domain_ops pch_msi_middle_domain_ops = {
146146
static struct msi_parent_ops pch_msi_parent_ops = {
147147
.required_flags = PCH_MSI_FLAGS_REQUIRED,
148148
.supported_flags = PCH_MSI_FLAGS_SUPPORTED,
149+
.chip_flags = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK,
149150
.bus_select_mask = MATCH_PCI_MSI,
150151
.bus_select_token = DOMAIN_BUS_NEXUS,
151152
.prefix = "PCH-",

drivers/irqchip/irq-msi-lib.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
2828
struct msi_domain_info *info)
2929
{
3030
const struct msi_parent_ops *pops = real_parent->msi_parent_ops;
31+
struct irq_chip *chip = info->chip;
3132
u32 required_flags;
3233

3334
/* Parent ops available? */
@@ -92,10 +93,10 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
9293
info->flags |= required_flags;
9394

9495
/* Chip updates for all child bus types */
95-
if (!info->chip->irq_eoi)
96-
info->chip->irq_eoi = irq_chip_eoi_parent;
97-
if (!info->chip->irq_ack)
98-
info->chip->irq_ack = irq_chip_ack_parent;
96+
if (!chip->irq_eoi && (pops->chip_flags & MSI_CHIP_FLAG_SET_EOI))
97+
chip->irq_eoi = irq_chip_eoi_parent;
98+
if (!chip->irq_ack && (pops->chip_flags & MSI_CHIP_FLAG_SET_ACK))
99+
chip->irq_ack = irq_chip_ack_parent;
99100

100101
/*
101102
* 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,
105106
* device MSI domain aside of mask/unmask which is provided e.g. by
106107
* PCI/MSI device domains.
107108
*/
108-
info->chip->irq_set_affinity = msi_domain_set_affinity;
109+
chip->irq_set_affinity = msi_domain_set_affinity;
109110
return true;
110111
}
111112
EXPORT_SYMBOL_GPL(msi_lib_init_dev_msi_info);

drivers/irqchip/irq-mvebu-gicp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ static const struct irq_domain_ops gicp_domain_ops = {
161161
static const struct msi_parent_ops gicp_msi_parent_ops = {
162162
.supported_flags = GICP_MSI_FLAGS_SUPPORTED,
163163
.required_flags = GICP_MSI_FLAGS_REQUIRED,
164+
.chip_flags = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK,
164165
.bus_select_token = DOMAIN_BUS_GENERIC_MSI,
165166
.bus_select_mask = MATCH_PLATFORM_MSI,
166167
.prefix = "GICP-",

drivers/irqchip/irq-mvebu-odmi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ static const struct irq_domain_ops odmi_domain_ops = {
157157
static const struct msi_parent_ops odmi_msi_parent_ops = {
158158
.supported_flags = ODMI_MSI_FLAGS_SUPPORTED,
159159
.required_flags = ODMI_MSI_FLAGS_REQUIRED,
160+
.chip_flags = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK,
160161
.bus_select_token = DOMAIN_BUS_GENERIC_MSI,
161162
.bus_select_mask = MATCH_PLATFORM_MSI,
162163
.prefix = "ODMI-",

drivers/irqchip/irq-mvebu-sei.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ static void mvebu_sei_reset(struct mvebu_sei *sei)
356356
static const struct msi_parent_ops sei_msi_parent_ops = {
357357
.supported_flags = SEI_MSI_FLAGS_SUPPORTED,
358358
.required_flags = SEI_MSI_FLAGS_REQUIRED,
359+
.chip_flags = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK,
359360
.bus_select_mask = MATCH_PLATFORM_MSI,
360361
.bus_select_token = DOMAIN_BUS_GENERIC_MSI,
361362
.prefix = "SEI-",

include/linux/msi.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,11 +558,21 @@ enum {
558558
MSI_FLAG_NO_AFFINITY = (1 << 21),
559559
};
560560

561+
/*
562+
* Flags for msi_parent_ops::chip_flags
563+
*/
564+
enum {
565+
MSI_CHIP_FLAG_SET_EOI = (1 << 0),
566+
MSI_CHIP_FLAG_SET_ACK = (1 << 1),
567+
};
568+
561569
/**
562570
* struct msi_parent_ops - MSI parent domain callbacks and configuration info
563571
*
564572
* @supported_flags: Required: The supported MSI flags of the parent domain
565573
* @required_flags: Optional: The required MSI flags of the parent MSI domain
574+
* @chip_flags: Optional: Select MSI chip callbacks to update with defaults
575+
* in msi_lib_init_dev_msi_info().
566576
* @bus_select_token: Optional: The bus token of the real parent domain for
567577
* irq_domain::select()
568578
* @bus_select_mask: Optional: A mask of supported BUS_DOMAINs for
@@ -575,6 +585,7 @@ enum {
575585
struct msi_parent_ops {
576586
u32 supported_flags;
577587
u32 required_flags;
588+
u32 chip_flags;
578589
u32 bus_select_token;
579590
u32 bus_select_mask;
580591
const char *prefix;

0 commit comments

Comments
 (0)