2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-19 10:44:14 +08:00

genirq/irqdomain: Remove auto-recursive hierarchy support

It did seem like a good idea at the time, but it never really
caught on, and auto-recursive domains remain unused 3 years after
having been introduced.

Oh well, time for a late spring cleanup.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
Marc Zyngier 2017-06-20 22:17:44 +01:00 committed by Thomas Gleixner
parent 96f0d93a48
commit 6a6544e520
3 changed files with 17 additions and 49 deletions

View File

@ -180,8 +180,8 @@ enum {
/* Irq domain is hierarchical */ /* Irq domain is hierarchical */
IRQ_DOMAIN_FLAG_HIERARCHY = (1 << 0), IRQ_DOMAIN_FLAG_HIERARCHY = (1 << 0),
/* Core calls alloc/free recursive through the domain hierarchy. */ /* Irq domain name was allocated in __irq_domain_add() */
IRQ_DOMAIN_FLAG_AUTO_RECURSIVE = (1 << 1), IRQ_DOMAIN_NAME_ALLOCATED = (1 << 6),
/* Irq domain is an IPI domain with virq per cpu */ /* Irq domain is an IPI domain with virq per cpu */
IRQ_DOMAIN_FLAG_IPI_PER_CPU = (1 << 2), IRQ_DOMAIN_FLAG_IPI_PER_CPU = (1 << 2),
@ -195,9 +195,6 @@ enum {
/* Irq domain implements MSI remapping */ /* Irq domain implements MSI remapping */
IRQ_DOMAIN_FLAG_MSI_REMAP = (1 << 5), IRQ_DOMAIN_FLAG_MSI_REMAP = (1 << 5),
/* Irq domain name was allocated in __irq_domain_add() */
IRQ_DOMAIN_NAME_ALLOCATED = (1 << 6),
/* /*
* Flags starting from IRQ_DOMAIN_FLAG_NONCORE are reserved * Flags starting from IRQ_DOMAIN_FLAG_NONCORE are reserved
* for implementation specific purposes and ignored by the * for implementation specific purposes and ignored by the
@ -448,7 +445,7 @@ static inline int irq_domain_alloc_irqs(struct irq_domain *domain,
NULL); NULL);
} }
extern int irq_domain_alloc_irqs_recursive(struct irq_domain *domain, extern int irq_domain_alloc_irqs_hierarchy(struct irq_domain *domain,
unsigned int irq_base, unsigned int irq_base,
unsigned int nr_irqs, void *arg); unsigned int nr_irqs, void *arg);
extern int irq_domain_set_hwirq_and_chip(struct irq_domain *domain, extern int irq_domain_set_hwirq_and_chip(struct irq_domain *domain,

View File

@ -1342,43 +1342,18 @@ void irq_domain_free_irqs_top(struct irq_domain *domain, unsigned int virq,
irq_domain_free_irqs_common(domain, virq, nr_irqs); irq_domain_free_irqs_common(domain, virq, nr_irqs);
} }
static bool irq_domain_is_auto_recursive(struct irq_domain *domain) static void irq_domain_free_irqs_hierarchy(struct irq_domain *domain,
{
return domain->flags & IRQ_DOMAIN_FLAG_AUTO_RECURSIVE;
}
static void irq_domain_free_irqs_recursive(struct irq_domain *domain,
unsigned int irq_base, unsigned int irq_base,
unsigned int nr_irqs) unsigned int nr_irqs)
{ {
domain->ops->free(domain, irq_base, nr_irqs); domain->ops->free(domain, irq_base, nr_irqs);
if (irq_domain_is_auto_recursive(domain)) {
BUG_ON(!domain->parent);
irq_domain_free_irqs_recursive(domain->parent, irq_base,
nr_irqs);
}
} }
int irq_domain_alloc_irqs_recursive(struct irq_domain *domain, int irq_domain_alloc_irqs_hierarchy(struct irq_domain *domain,
unsigned int irq_base, unsigned int irq_base,
unsigned int nr_irqs, void *arg) unsigned int nr_irqs, void *arg)
{ {
int ret = 0; return domain->ops->alloc(domain, irq_base, nr_irqs, arg);
struct irq_domain *parent = domain->parent;
bool recursive = irq_domain_is_auto_recursive(domain);
BUG_ON(recursive && !parent);
if (recursive)
ret = irq_domain_alloc_irqs_recursive(parent, irq_base,
nr_irqs, arg);
if (ret < 0)
return ret;
ret = domain->ops->alloc(domain, irq_base, nr_irqs, arg);
if (ret < 0 && recursive)
irq_domain_free_irqs_recursive(parent, irq_base, nr_irqs);
return ret;
} }
/** /**
@ -1439,7 +1414,7 @@ int __irq_domain_alloc_irqs(struct irq_domain *domain, int irq_base,
} }
mutex_lock(&irq_domain_mutex); mutex_lock(&irq_domain_mutex);
ret = irq_domain_alloc_irqs_recursive(domain, virq, nr_irqs, arg); ret = irq_domain_alloc_irqs_hierarchy(domain, virq, nr_irqs, arg);
if (ret < 0) { if (ret < 0) {
mutex_unlock(&irq_domain_mutex); mutex_unlock(&irq_domain_mutex);
goto out_free_irq_data; goto out_free_irq_data;
@ -1474,7 +1449,7 @@ void irq_domain_free_irqs(unsigned int virq, unsigned int nr_irqs)
mutex_lock(&irq_domain_mutex); mutex_lock(&irq_domain_mutex);
for (i = 0; i < nr_irqs; i++) for (i = 0; i < nr_irqs; i++)
irq_domain_remove_irq(virq + i); irq_domain_remove_irq(virq + i);
irq_domain_free_irqs_recursive(data->domain, virq, nr_irqs); irq_domain_free_irqs_hierarchy(data->domain, virq, nr_irqs);
mutex_unlock(&irq_domain_mutex); mutex_unlock(&irq_domain_mutex);
irq_domain_free_irq_data(virq, nr_irqs); irq_domain_free_irq_data(virq, nr_irqs);
@ -1494,15 +1469,11 @@ int irq_domain_alloc_irqs_parent(struct irq_domain *domain,
unsigned int irq_base, unsigned int nr_irqs, unsigned int irq_base, unsigned int nr_irqs,
void *arg) void *arg)
{ {
/* irq_domain_alloc_irqs_recursive() has called parent's alloc() */ if (!domain->parent)
if (irq_domain_is_auto_recursive(domain)) return -ENOSYS;
return 0;
domain = domain->parent; return irq_domain_alloc_irqs_hierarchy(domain->parent, irq_base,
if (domain) nr_irqs, arg);
return irq_domain_alloc_irqs_recursive(domain, irq_base,
nr_irqs, arg);
return -ENOSYS;
} }
EXPORT_SYMBOL_GPL(irq_domain_alloc_irqs_parent); EXPORT_SYMBOL_GPL(irq_domain_alloc_irqs_parent);
@ -1517,10 +1488,10 @@ EXPORT_SYMBOL_GPL(irq_domain_alloc_irqs_parent);
void irq_domain_free_irqs_parent(struct irq_domain *domain, void irq_domain_free_irqs_parent(struct irq_domain *domain,
unsigned int irq_base, unsigned int nr_irqs) unsigned int irq_base, unsigned int nr_irqs)
{ {
/* irq_domain_free_irqs_recursive() will call parent's free */ if (!domain->parent)
if (!irq_domain_is_auto_recursive(domain) && domain->parent) return;
irq_domain_free_irqs_recursive(domain->parent, irq_base,
nr_irqs); irq_domain_free_irqs_hierarchy(domain->parent, irq_base, nr_irqs);
} }
EXPORT_SYMBOL_GPL(irq_domain_free_irqs_parent); EXPORT_SYMBOL_GPL(irq_domain_free_irqs_parent);

View File

@ -315,7 +315,7 @@ int msi_domain_populate_irqs(struct irq_domain *domain, struct device *dev,
ops->set_desc(arg, desc); ops->set_desc(arg, desc);
/* Assumes the domain mutex is held! */ /* Assumes the domain mutex is held! */
ret = irq_domain_alloc_irqs_recursive(domain, virq, 1, arg); ret = irq_domain_alloc_irqs_hierarchy(domain, virq, 1, arg);
if (ret) if (ret)
break; break;