]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
genirq: Introduce irq_can_move_in_process_context()
authorAnup Patel <apatel@ventanamicro.com>
Mon, 17 Feb 2025 08:56:51 +0000 (14:26 +0530)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 20 Feb 2025 14:19:26 +0000 (15:19 +0100)
Interrupt controller drivers which enable CONFIG_GENERIC_PENDING_IRQ
require to know whether an interrupt can be moved in process context or not
to decide whether they need to invoke the work around for non-atomic MSI
updates or not.

This information can be retrieved via irq_can_move_pcntxt(). That helper
requires access to the top-most interrupt domain data, but the driver which
requires this is usually further down in the hierarchy.

Introduce irq_can_move_in_process_context() which retrieves that
information from the top-most interrupt domain data.

[ tglx: Massaged change log ]

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250217085657.789309-6-apatel@ventanamicro.com
include/linux/irq.h
kernel/irq/migration.c

index 56f6583093d2887b85cf96ed9572ffacb6320e40..dd5df1e2d032d8b857b4d952ba860116215ecfa1 100644 (file)
@@ -615,6 +615,7 @@ extern int irq_affinity_online_cpu(unsigned int cpu);
 #endif
 
 #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ)
+bool irq_can_move_in_process_context(struct irq_data *data);
 void __irq_move_irq(struct irq_data *data);
 static inline void irq_move_irq(struct irq_data *data)
 {
@@ -623,6 +624,7 @@ static inline void irq_move_irq(struct irq_data *data)
 }
 void irq_move_masked_irq(struct irq_data *data);
 #else
+static inline bool irq_can_move_in_process_context(struct irq_data *data) { return true; }
 static inline void irq_move_irq(struct irq_data *data) { }
 static inline void irq_move_masked_irq(struct irq_data *data) { }
 #endif
index e110300ad650fe2cef9d2deb9bf5bd0a41eb15c2..147cabb4c0779b977c21881a672bfbe5aaa2f338 100644 (file)
@@ -127,3 +127,13 @@ void __irq_move_irq(struct irq_data *idata)
        if (!masked)
                idata->chip->irq_unmask(idata);
 }
+
+bool irq_can_move_in_process_context(struct irq_data *data)
+{
+       /*
+        * Get the top level irq_data in the hierarchy, which is optimized
+        * away when CONFIG_IRQ_DOMAIN_HIERARCHY is disabled.
+        */
+       data = irq_desc_get_irq_data(irq_data_to_desc(data));
+       return irq_can_move_pcntxt(data);
+}