Commit c351ab7b authored by Marc Zyngier's avatar Marc Zyngier

soc/tegra: pmc: Don't create fake interrupt hierarchy levels

The Tegra PMC driver does ungodly things with the interrupt hierarchy,
repeatedly corrupting it by pulling hwirq numbers out of thin air,
overriding existing IRQ mappings and changing the handling flow
of unsuspecting users.

All of this is done in the name of preserving the interrupt hierarchy
even when these levels do not exist in the HW. Together with the use
of proper IRQs for IPIs, this leads to an unbootable system as the
rescheduling IPI gets repeatedly repurposed for random drivers...

Instead, let's simply mark the level from which the hierarchy does
not make sense for the HW, and let the core code trim the usused
levels from the hierarchy.
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
parent 8681cc33
...@@ -1990,44 +1990,17 @@ static int tegra_pmc_irq_alloc(struct irq_domain *domain, unsigned int virq, ...@@ -1990,44 +1990,17 @@ static int tegra_pmc_irq_alloc(struct irq_domain *domain, unsigned int virq,
event->id, event->id,
&pmc->irq, pmc); &pmc->irq, pmc);
/* /* GPIO hierarchies stop at the PMC level */
* GPIOs don't have an equivalent interrupt in the if (!err && domain->parent)
* parent controller (GIC). However some code, such err = irq_domain_disconnect_hierarchy(domain->parent,
* as the one in irq_get_irqchip_state(), require a virq);
* valid IRQ chip to be set. Make sure that's the
* case by passing NULL here, which will install a
* dummy IRQ chip for the interrupt in the parent
* domain.
*/
if (domain->parent)
irq_domain_set_hwirq_and_chip(domain->parent,
virq, 0, NULL,
NULL);
break; break;
} }
} }
/* /* If there is no wake-up event, there is no PMC mapping */
* For interrupts that don't have associated wake events, assign a if (i == soc->num_wake_events)
* dummy hardware IRQ number. This is used in the ->irq_set_type() err = irq_domain_disconnect_hierarchy(domain, virq);
* and ->irq_set_wake() callbacks to return early for these IRQs.
*/
if (i == soc->num_wake_events) {
err = irq_domain_set_hwirq_and_chip(domain, virq, ULONG_MAX,
&pmc->irq, pmc);
/*
* Interrupts without a wake event don't have a corresponding
* interrupt in the parent controller (GIC). Pass NULL for the
* chip here, which causes a dummy IRQ chip to be installed
* for the interrupt in the parent domain, to make this
* explicit.
*/
if (domain->parent)
irq_domain_set_hwirq_and_chip(domain->parent, virq, 0,
NULL, NULL);
}
return err; return err;
} }
...@@ -2043,9 +2016,6 @@ static int tegra210_pmc_irq_set_wake(struct irq_data *data, unsigned int on) ...@@ -2043,9 +2016,6 @@ static int tegra210_pmc_irq_set_wake(struct irq_data *data, unsigned int on)
unsigned int offset, bit; unsigned int offset, bit;
u32 value; u32 value;
if (data->hwirq == ULONG_MAX)
return 0;
offset = data->hwirq / 32; offset = data->hwirq / 32;
bit = data->hwirq % 32; bit = data->hwirq % 32;
...@@ -2080,9 +2050,6 @@ static int tegra210_pmc_irq_set_type(struct irq_data *data, unsigned int type) ...@@ -2080,9 +2050,6 @@ static int tegra210_pmc_irq_set_type(struct irq_data *data, unsigned int type)
unsigned int offset, bit; unsigned int offset, bit;
u32 value; u32 value;
if (data->hwirq == ULONG_MAX)
return 0;
offset = data->hwirq / 32; offset = data->hwirq / 32;
bit = data->hwirq % 32; bit = data->hwirq % 32;
...@@ -2123,10 +2090,6 @@ static int tegra186_pmc_irq_set_wake(struct irq_data *data, unsigned int on) ...@@ -2123,10 +2090,6 @@ static int tegra186_pmc_irq_set_wake(struct irq_data *data, unsigned int on)
unsigned int offset, bit; unsigned int offset, bit;
u32 value; u32 value;
/* nothing to do if there's no associated wake event */
if (WARN_ON(data->hwirq == ULONG_MAX))
return 0;
offset = data->hwirq / 32; offset = data->hwirq / 32;
bit = data->hwirq % 32; bit = data->hwirq % 32;
...@@ -2154,10 +2117,6 @@ static int tegra186_pmc_irq_set_type(struct irq_data *data, unsigned int type) ...@@ -2154,10 +2117,6 @@ static int tegra186_pmc_irq_set_type(struct irq_data *data, unsigned int type)
struct tegra_pmc *pmc = irq_data_get_irq_chip_data(data); struct tegra_pmc *pmc = irq_data_get_irq_chip_data(data);
u32 value; u32 value;
/* nothing to do if there's no associated wake event */
if (data->hwirq == ULONG_MAX)
return 0;
value = readl(pmc->wake + WAKE_AOWAKE_CNTRL(data->hwirq)); value = readl(pmc->wake + WAKE_AOWAKE_CNTRL(data->hwirq));
switch (type) { switch (type) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment