Skip to content

Commit 43a7eec

Browse files
committed
Merge tag 'irq-core-2025-03-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull irq updates from Thomas Gleixner: "A small set of core changes for the interrupt subsystem: - Expose the MSI message in the existing debug filesystem dump. That's useful for validation and debugging. - Small cleanups" * tag 'irq-core-2025-03-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: genirq: Make a few functions static irqdomain: Remove extern from function declarations genirq/msi: Expose MSI message data in debugfs
2 parents 2df0c02 + 827bafd commit 43a7eec

File tree

7 files changed

+109
-100
lines changed

7 files changed

+109
-100
lines changed

include/linux/irqdomain.h

Lines changed: 68 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,13 @@ struct irq_domain *irq_domain_create_legacy(struct fwnode_handle *fwnode,
350350
irq_hw_number_t first_hwirq,
351351
const struct irq_domain_ops *ops,
352352
void *host_data);
353-
extern struct irq_domain *irq_find_matching_fwspec(struct irq_fwspec *fwspec,
354-
enum irq_domain_bus_token bus_token);
355-
extern void irq_set_default_host(struct irq_domain *host);
356-
extern struct irq_domain *irq_get_default_host(void);
357-
extern int irq_domain_alloc_descs(int virq, unsigned int nr_irqs,
358-
irq_hw_number_t hwirq, int node,
359-
const struct irq_affinity_desc *affinity);
353+
struct irq_domain *irq_find_matching_fwspec(struct irq_fwspec *fwspec,
354+
enum irq_domain_bus_token bus_token);
355+
void irq_set_default_host(struct irq_domain *host);
356+
struct irq_domain *irq_get_default_host(void);
357+
int irq_domain_alloc_descs(int virq, unsigned int nr_irqs,
358+
irq_hw_number_t hwirq, int node,
359+
const struct irq_affinity_desc *affinity);
360360

361361
static inline struct fwnode_handle *of_node_to_fwnode(struct device_node *node)
362362
{
@@ -370,8 +370,8 @@ static inline bool is_fwnode_irqchip(const struct fwnode_handle *fwnode)
370370
return fwnode && fwnode->ops == &irqchip_fwnode_ops;
371371
}
372372

373-
extern void irq_domain_update_bus_token(struct irq_domain *domain,
374-
enum irq_domain_bus_token bus_token);
373+
void irq_domain_update_bus_token(struct irq_domain *domain,
374+
enum irq_domain_bus_token bus_token);
375375

376376
static inline
377377
struct irq_domain *irq_find_matching_fwnode(struct fwnode_handle *fwnode,
@@ -454,7 +454,7 @@ static inline struct irq_domain *irq_domain_add_nomap(struct device_node *of_nod
454454
return IS_ERR(d) ? NULL : d;
455455
}
456456

457-
extern unsigned int irq_create_direct_mapping(struct irq_domain *host);
457+
unsigned int irq_create_direct_mapping(struct irq_domain *host);
458458
#endif
459459

460460
static inline struct irq_domain *irq_domain_add_tree(struct device_node *of_node,
@@ -507,29 +507,29 @@ static inline struct irq_domain *irq_domain_create_tree(struct fwnode_handle *fw
507507
return IS_ERR(d) ? NULL : d;
508508
}
509509

510-
extern void irq_domain_remove(struct irq_domain *host);
510+
void irq_domain_remove(struct irq_domain *host);
511511

512-
extern int irq_domain_associate(struct irq_domain *domain, unsigned int irq,
513-
irq_hw_number_t hwirq);
514-
extern void irq_domain_associate_many(struct irq_domain *domain,
515-
unsigned int irq_base,
516-
irq_hw_number_t hwirq_base, int count);
512+
int irq_domain_associate(struct irq_domain *domain, unsigned int irq,
513+
irq_hw_number_t hwirq);
514+
void irq_domain_associate_many(struct irq_domain *domain,
515+
unsigned int irq_base,
516+
irq_hw_number_t hwirq_base, int count);
517517

518-
extern unsigned int irq_create_mapping_affinity(struct irq_domain *host,
519-
irq_hw_number_t hwirq,
520-
const struct irq_affinity_desc *affinity);
521-
extern unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec);
522-
extern void irq_dispose_mapping(unsigned int virq);
518+
unsigned int irq_create_mapping_affinity(struct irq_domain *host,
519+
irq_hw_number_t hwirq,
520+
const struct irq_affinity_desc *affinity);
521+
unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec);
522+
void irq_dispose_mapping(unsigned int virq);
523523

524524
static inline unsigned int irq_create_mapping(struct irq_domain *host,
525525
irq_hw_number_t hwirq)
526526
{
527527
return irq_create_mapping_affinity(host, hwirq, NULL);
528528
}
529529

530-
extern struct irq_desc *__irq_resolve_mapping(struct irq_domain *domain,
531-
irq_hw_number_t hwirq,
532-
unsigned int *irq);
530+
struct irq_desc *__irq_resolve_mapping(struct irq_domain *domain,
531+
irq_hw_number_t hwirq,
532+
unsigned int *irq);
533533

534534
static inline struct irq_desc *irq_resolve_mapping(struct irq_domain *domain,
535535
irq_hw_number_t hwirq)
@@ -587,19 +587,21 @@ int irq_reserve_ipi(struct irq_domain *domain, const struct cpumask *dest);
587587
int irq_destroy_ipi(unsigned int irq, const struct cpumask *dest);
588588

589589
/* V2 interfaces to support hierarchy IRQ domains. */
590-
extern struct irq_data *irq_domain_get_irq_data(struct irq_domain *domain,
591-
unsigned int virq);
592-
extern void irq_domain_set_info(struct irq_domain *domain, unsigned int virq,
593-
irq_hw_number_t hwirq,
594-
const struct irq_chip *chip,
595-
void *chip_data, irq_flow_handler_t handler,
596-
void *handler_data, const char *handler_name);
597-
extern void irq_domain_reset_irq_data(struct irq_data *irq_data);
590+
struct irq_data *irq_domain_get_irq_data(struct irq_domain *domain,
591+
unsigned int virq);
592+
void irq_domain_set_info(struct irq_domain *domain, unsigned int virq,
593+
irq_hw_number_t hwirq,
594+
const struct irq_chip *chip,
595+
void *chip_data, irq_flow_handler_t handler,
596+
void *handler_data, const char *handler_name);
597+
void irq_domain_reset_irq_data(struct irq_data *irq_data);
598598
#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
599-
extern struct irq_domain *irq_domain_create_hierarchy(struct irq_domain *parent,
600-
unsigned int flags, unsigned int size,
601-
struct fwnode_handle *fwnode,
602-
const struct irq_domain_ops *ops, void *host_data);
599+
struct irq_domain *irq_domain_create_hierarchy(struct irq_domain *parent,
600+
unsigned int flags,
601+
unsigned int size,
602+
struct fwnode_handle *fwnode,
603+
const struct irq_domain_ops *ops,
604+
void *host_data);
603605

604606
static inline struct irq_domain *irq_domain_add_hierarchy(struct irq_domain *parent,
605607
unsigned int flags,
@@ -613,13 +615,13 @@ static inline struct irq_domain *irq_domain_add_hierarchy(struct irq_domain *par
613615
ops, host_data);
614616
}
615617

616-
extern int __irq_domain_alloc_irqs(struct irq_domain *domain, int irq_base,
617-
unsigned int nr_irqs, int node, void *arg,
618-
bool realloc,
619-
const struct irq_affinity_desc *affinity);
620-
extern void irq_domain_free_irqs(unsigned int virq, unsigned int nr_irqs);
621-
extern int irq_domain_activate_irq(struct irq_data *irq_data, bool early);
622-
extern void irq_domain_deactivate_irq(struct irq_data *irq_data);
618+
int __irq_domain_alloc_irqs(struct irq_domain *domain, int irq_base,
619+
unsigned int nr_irqs, int node, void *arg,
620+
bool realloc,
621+
const struct irq_affinity_desc *affinity);
622+
void irq_domain_free_irqs(unsigned int virq, unsigned int nr_irqs);
623+
int irq_domain_activate_irq(struct irq_data *irq_data, bool early);
624+
void irq_domain_deactivate_irq(struct irq_data *irq_data);
623625

624626
static inline int irq_domain_alloc_irqs(struct irq_domain *domain,
625627
unsigned int nr_irqs, int node, void *arg)
@@ -628,32 +630,29 @@ static inline int irq_domain_alloc_irqs(struct irq_domain *domain,
628630
NULL);
629631
}
630632

631-
extern int irq_domain_alloc_irqs_hierarchy(struct irq_domain *domain,
632-
unsigned int irq_base,
633-
unsigned int nr_irqs, void *arg);
634-
extern int irq_domain_set_hwirq_and_chip(struct irq_domain *domain,
635-
unsigned int virq,
636-
irq_hw_number_t hwirq,
637-
const struct irq_chip *chip,
638-
void *chip_data);
639-
extern void irq_domain_free_irqs_common(struct irq_domain *domain,
640-
unsigned int virq,
641-
unsigned int nr_irqs);
642-
extern void irq_domain_free_irqs_top(struct irq_domain *domain,
643-
unsigned int virq, unsigned int nr_irqs);
644-
645-
extern int irq_domain_push_irq(struct irq_domain *domain, int virq, void *arg);
646-
extern int irq_domain_pop_irq(struct irq_domain *domain, int virq);
647-
648-
extern int irq_domain_alloc_irqs_parent(struct irq_domain *domain,
649-
unsigned int irq_base,
650-
unsigned int nr_irqs, void *arg);
651-
652-
extern void irq_domain_free_irqs_parent(struct irq_domain *domain,
653-
unsigned int irq_base,
654-
unsigned int nr_irqs);
655-
656-
extern int irq_domain_disconnect_hierarchy(struct irq_domain *domain,
633+
int irq_domain_set_hwirq_and_chip(struct irq_domain *domain,
634+
unsigned int virq,
635+
irq_hw_number_t hwirq,
636+
const struct irq_chip *chip,
637+
void *chip_data);
638+
void irq_domain_free_irqs_common(struct irq_domain *domain,
639+
unsigned int virq,
640+
unsigned int nr_irqs);
641+
void irq_domain_free_irqs_top(struct irq_domain *domain,
642+
unsigned int virq, unsigned int nr_irqs);
643+
644+
int irq_domain_push_irq(struct irq_domain *domain, int virq, void *arg);
645+
int irq_domain_pop_irq(struct irq_domain *domain, int virq);
646+
647+
int irq_domain_alloc_irqs_parent(struct irq_domain *domain,
648+
unsigned int irq_base,
649+
unsigned int nr_irqs, void *arg);
650+
651+
void irq_domain_free_irqs_parent(struct irq_domain *domain,
652+
unsigned int irq_base,
653+
unsigned int nr_irqs);
654+
655+
int irq_domain_disconnect_hierarchy(struct irq_domain *domain,
657656
unsigned int virq);
658657

659658
static inline bool irq_domain_is_hierarchy(struct irq_domain *domain)

kernel/irq/chip.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,21 @@ __irq_startup_managed(struct irq_desc *desc, const struct cpumask *aff,
232232
}
233233
#endif
234234

235+
static void irq_enable(struct irq_desc *desc)
236+
{
237+
if (!irqd_irq_disabled(&desc->irq_data)) {
238+
unmask_irq(desc);
239+
} else {
240+
irq_state_clr_disabled(desc);
241+
if (desc->irq_data.chip->irq_enable) {
242+
desc->irq_data.chip->irq_enable(&desc->irq_data);
243+
irq_state_clr_masked(desc);
244+
} else {
245+
unmask_irq(desc);
246+
}
247+
}
248+
}
249+
235250
static int __irq_startup(struct irq_desc *desc)
236251
{
237252
struct irq_data *d = irq_desc_get_irq_data(desc);
@@ -332,21 +347,6 @@ void irq_shutdown_and_deactivate(struct irq_desc *desc)
332347
irq_domain_deactivate_irq(&desc->irq_data);
333348
}
334349

335-
void irq_enable(struct irq_desc *desc)
336-
{
337-
if (!irqd_irq_disabled(&desc->irq_data)) {
338-
unmask_irq(desc);
339-
} else {
340-
irq_state_clr_disabled(desc);
341-
if (desc->irq_data.chip->irq_enable) {
342-
desc->irq_data.chip->irq_enable(&desc->irq_data);
343-
irq_state_clr_masked(desc);
344-
} else {
345-
unmask_irq(desc);
346-
}
347-
}
348-
}
349-
350350
static void __irq_disable(struct irq_desc *desc, bool mask)
351351
{
352352
if (irqd_irq_disabled(&desc->irq_data)) {

kernel/irq/internals.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,26 +90,19 @@ extern int irq_startup(struct irq_desc *desc, bool resend, bool force);
9090

9191
extern void irq_shutdown(struct irq_desc *desc);
9292
extern void irq_shutdown_and_deactivate(struct irq_desc *desc);
93-
extern void irq_enable(struct irq_desc *desc);
9493
extern void irq_disable(struct irq_desc *desc);
9594
extern void irq_percpu_enable(struct irq_desc *desc, unsigned int cpu);
9695
extern void irq_percpu_disable(struct irq_desc *desc, unsigned int cpu);
9796
extern void mask_irq(struct irq_desc *desc);
9897
extern void unmask_irq(struct irq_desc *desc);
9998
extern void unmask_threaded_irq(struct irq_desc *desc);
10099

101-
extern unsigned int kstat_irqs_desc(struct irq_desc *desc, const struct cpumask *cpumask);
102-
103100
#ifdef CONFIG_SPARSE_IRQ
104101
static inline void irq_mark_irq(unsigned int irq) { }
105102
#else
106103
extern void irq_mark_irq(unsigned int irq);
107104
#endif
108105

109-
extern int __irq_get_irqchip_state(struct irq_data *data,
110-
enum irqchip_irq_state which,
111-
bool *state);
112-
113106
irqreturn_t __handle_irq_event_percpu(struct irq_desc *desc);
114107
irqreturn_t handle_irq_event_percpu(struct irq_desc *desc);
115108
irqreturn_t handle_irq_event(struct irq_desc *desc);
@@ -139,8 +132,6 @@ static inline void unregister_handler_proc(unsigned int irq,
139132

140133
extern bool irq_can_set_affinity_usr(unsigned int irq);
141134

142-
extern void irq_set_thread_affinity(struct irq_desc *desc);
143-
144135
extern int irq_do_set_affinity(struct irq_data *data,
145136
const struct cpumask *dest, bool force);
146137

kernel/irq/irqdesc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
991991
return desc && desc->kstat_irqs ? per_cpu(desc->kstat_irqs->cnt, cpu) : 0;
992992
}
993993

994-
unsigned int kstat_irqs_desc(struct irq_desc *desc, const struct cpumask *cpumask)
994+
static unsigned int kstat_irqs_desc(struct irq_desc *desc, const struct cpumask *cpumask)
995995
{
996996
unsigned int sum = 0;
997997
int cpu;

kernel/irq/irqdomain.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,9 +1589,8 @@ static void irq_domain_free_irqs_hierarchy(struct irq_domain *domain,
15891589
}
15901590
}
15911591

1592-
int irq_domain_alloc_irqs_hierarchy(struct irq_domain *domain,
1593-
unsigned int irq_base,
1594-
unsigned int nr_irqs, void *arg)
1592+
static int irq_domain_alloc_irqs_hierarchy(struct irq_domain *domain, unsigned int irq_base,
1593+
unsigned int nr_irqs, void *arg)
15951594
{
15961595
if (!domain->ops->alloc) {
15971596
pr_debug("domain->ops->alloc() is NULL\n");

kernel/irq/manage.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ static int __init setup_forced_irqthreads(char *arg)
3535
early_param("threadirqs", setup_forced_irqthreads);
3636
#endif
3737

38+
static int __irq_get_irqchip_state(struct irq_data *d, enum irqchip_irq_state which, bool *state);
39+
3840
static void __synchronize_hardirq(struct irq_desc *desc, bool sync_chip)
3941
{
4042
struct irq_data *irqd = irq_desc_get_irq_data(desc);
@@ -187,7 +189,7 @@ bool irq_can_set_affinity_usr(unsigned int irq)
187189
* set_cpus_allowed_ptr() here as we hold desc->lock and this
188190
* code can be called from hard interrupt context.
189191
*/
190-
void irq_set_thread_affinity(struct irq_desc *desc)
192+
static void irq_set_thread_affinity(struct irq_desc *desc)
191193
{
192194
struct irqaction *action;
193195

@@ -2789,8 +2791,7 @@ void teardown_percpu_nmi(unsigned int irq)
27892791
irq_put_desc_unlock(desc, flags);
27902792
}
27912793

2792-
int __irq_get_irqchip_state(struct irq_data *data, enum irqchip_irq_state which,
2793-
bool *state)
2794+
static int __irq_get_irqchip_state(struct irq_data *data, enum irqchip_irq_state which, bool *state)
27942795
{
27952796
struct irq_chip *chip;
27962797
int err = -EINVAL;

kernel/irq/msi.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/mutex.h>
1616
#include <linux/pci.h>
1717
#include <linux/slab.h>
18+
#include <linux/seq_file.h>
1819
#include <linux/sysfs.h>
1920
#include <linux/types.h>
2021
#include <linux/xarray.h>
@@ -756,12 +757,30 @@ static int msi_domain_translate(struct irq_domain *domain, struct irq_fwspec *fw
756757
return info->ops->msi_translate(domain, fwspec, hwirq, type);
757758
}
758759

760+
#ifdef CONFIG_GENERIC_IRQ_DEBUGFS
761+
static void msi_domain_debug_show(struct seq_file *m, struct irq_domain *d,
762+
struct irq_data *irqd, int ind)
763+
{
764+
struct msi_desc *desc = irq_data_get_msi_desc(irqd);
765+
766+
if (!desc)
767+
return;
768+
769+
seq_printf(m, "\n%*saddress_hi: 0x%08x", ind + 1, "", desc->msg.address_hi);
770+
seq_printf(m, "\n%*saddress_lo: 0x%08x", ind + 1, "", desc->msg.address_lo);
771+
seq_printf(m, "\n%*smsg_data: 0x%08x\n", ind + 1, "", desc->msg.data);
772+
}
773+
#endif
774+
759775
static const struct irq_domain_ops msi_domain_ops = {
760776
.alloc = msi_domain_alloc,
761777
.free = msi_domain_free,
762778
.activate = msi_domain_activate,
763779
.deactivate = msi_domain_deactivate,
764780
.translate = msi_domain_translate,
781+
#ifdef CONFIG_GENERIC_IRQ_DEBUGFS
782+
.debug_show = msi_domain_debug_show,
783+
#endif
765784
};
766785

767786
static irq_hw_number_t msi_domain_ops_get_hwirq(struct msi_domain_info *info,

0 commit comments

Comments
 (0)