Skip to content

Commit 9f199dd

Browse files
author
Marc Zyngier
committed
irqdomain: Allow the default irq domain to be retrieved
The default irq domain allows legacy code to create irqdomain mappings without having to track the domain it is allocating from. Setting the default domain is a one shot, fire and forget operation, and no effort was made to be able to retrieve this information at a later point in time. Newer irqdomain APIs (the hierarchical stuff) relies on both the irqchip code to track the irqdomain it is allocating from, as well as some form of firmware abstraction to easily identify which piece of HW maps to which irq domain (DT, ACPI). For systems without such firmware (or legacy platform that are getting dragged into the 21st century), things are a bit harder. For these cases (and these cases only!), let's provide a way to retrieve the default domain, allowing the use of the v2 API without having to resort to platform-specific hacks. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent cc9f04f commit 9f199dd

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

include/linux/irqdomain.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ extern struct irq_domain *irq_find_matching_fwspec(struct irq_fwspec *fwspec,
265265
enum irq_domain_bus_token bus_token);
266266
extern bool irq_domain_check_msi_remap(void);
267267
extern void irq_set_default_host(struct irq_domain *host);
268+
extern struct irq_domain *irq_get_default_host(void);
268269
extern int irq_domain_alloc_descs(int virq, unsigned int nr_irqs,
269270
irq_hw_number_t hwirq, int node,
270271
const struct irq_affinity_desc *affinity);

kernel/irq/irqdomain.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,20 @@ void irq_set_default_host(struct irq_domain *domain)
458458
}
459459
EXPORT_SYMBOL_GPL(irq_set_default_host);
460460

461+
/**
462+
* irq_get_default_host() - Retrieve the "default" irq domain
463+
*
464+
* Returns: the default domain, if any.
465+
*
466+
* Modern code should never use this. This should only be used on
467+
* systems that cannot implement a firmware->fwnode mapping (which
468+
* both DT and ACPI provide).
469+
*/
470+
struct irq_domain *irq_get_default_host(void)
471+
{
472+
return irq_default_domain;
473+
}
474+
461475
static void irq_domain_clear_mapping(struct irq_domain *domain,
462476
irq_hw_number_t hwirq)
463477
{

0 commit comments

Comments
 (0)