Skip to content

Commit 6db201b

Browse files
author
Myron Stowe
committed
genirq/msi: Add .msi_teardown() callback as the reverse of .msi_prepare()
JIRA: https://issues.redhat.com/browse/RHEL-120705 Upstream Status: 28026cf commit 28026cf Author: Marc Zyngier <maz@kernel.org> Date: Tue May 13 17:31:40 2025 +0100 genirq/msi: Add .msi_teardown() callback as the reverse of .msi_prepare() While the MSI ops do have a .msi_prepare() callback that is responsible for setting up the relevant (usually per-device) allocation, there is no callback reversing this setup. For this purpose, add .msi_teardown() callback. In order to avoid breaking the ITS driver that suffers from related issues, do not call the callback just yet. Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20250513163144.2215824-2-maz@kernel.org Signed-off-by: Myron Stowe <mstowe@redhat.com>
1 parent 0cffa43 commit 6db201b

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

include/linux/msi.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ struct msi_domain_info;
423423
* @msi_init: Domain specific init function for MSI interrupts
424424
* @msi_free: Domain specific function to free a MSI interrupts
425425
* @msi_prepare: Prepare the allocation of the interrupts in the domain
426+
* @msi_teardown: Reverse the effects of @msi_prepare
426427
* @prepare_desc: Optional function to prepare the allocated MSI descriptor
427428
* in the domain
428429
* @set_desc: Set the msi descriptor for an interrupt
@@ -438,8 +439,9 @@ struct msi_domain_info;
438439
* @get_hwirq, @msi_init and @msi_free are callbacks used by the underlying
439440
* irqdomain.
440441
*
441-
* @msi_check, @msi_prepare, @prepare_desc and @set_desc are callbacks used by the
442-
* msi_domain_alloc/free_irqs*() variants.
442+
* @msi_check, @msi_prepare, @msi_teardown, @prepare_desc and
443+
* @set_desc are callbacks used by the msi_domain_alloc/free_irqs*()
444+
* variants.
443445
*
444446
* @domain_alloc_irqs, @domain_free_irqs can be used to override the
445447
* default allocation/free functions (__msi_domain_alloc/free_irqs). This
@@ -461,6 +463,8 @@ struct msi_domain_ops {
461463
int (*msi_prepare)(struct irq_domain *domain,
462464
struct device *dev, int nvec,
463465
msi_alloc_info_t *arg);
466+
void (*msi_teardown)(struct irq_domain *domain,
467+
msi_alloc_info_t *arg);
464468
void (*prepare_desc)(struct irq_domain *domain, msi_alloc_info_t *arg,
465469
struct msi_desc *desc);
466470
void (*set_desc)(msi_alloc_info_t *arg,
@@ -489,6 +493,7 @@ struct msi_domain_ops {
489493
* @handler: Optional: associated interrupt flow handler
490494
* @handler_data: Optional: associated interrupt flow handler data
491495
* @handler_name: Optional: associated interrupt flow handler name
496+
* @alloc_data: Optional: associated interrupt allocation data
492497
* @data: Optional: domain specific data
493498
*/
494499
struct msi_domain_info {
@@ -501,6 +506,7 @@ struct msi_domain_info {
501506
irq_flow_handler_t handler;
502507
void *handler_data;
503508
const char *handler_name;
509+
msi_alloc_info_t *alloc_data;
504510
void *data;
505511
};
506512

kernel/irq/msi.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,11 @@ static int msi_domain_ops_prepare(struct irq_domain *domain, struct device *dev,
776776
return 0;
777777
}
778778

779+
static void msi_domain_ops_teardown(struct irq_domain *domain,
780+
msi_alloc_info_t *arg)
781+
{
782+
}
783+
779784
static void msi_domain_ops_set_desc(msi_alloc_info_t *arg,
780785
struct msi_desc *desc)
781786
{
@@ -801,6 +806,7 @@ static struct msi_domain_ops msi_domain_ops_default = {
801806
.get_hwirq = msi_domain_ops_get_hwirq,
802807
.msi_init = msi_domain_ops_init,
803808
.msi_prepare = msi_domain_ops_prepare,
809+
.msi_teardown = msi_domain_ops_teardown,
804810
.set_desc = msi_domain_ops_set_desc,
805811
};
806812

@@ -822,6 +828,8 @@ static void msi_domain_update_dom_ops(struct msi_domain_info *info)
822828
ops->msi_init = msi_domain_ops_default.msi_init;
823829
if (ops->msi_prepare == NULL)
824830
ops->msi_prepare = msi_domain_ops_default.msi_prepare;
831+
if (ops->msi_teardown == NULL)
832+
ops->msi_teardown = msi_domain_ops_default.msi_teardown;
825833
if (ops->set_desc == NULL)
826834
ops->set_desc = msi_domain_ops_default.set_desc;
827835
}

0 commit comments

Comments
 (0)