Skip to content

Commit

Permalink
powerpc/xics: Remove ICS list
Browse files Browse the repository at this point in the history
We always had only one ICS per machine. Simplify the XICS driver by
removing the ICS list.

The ICS stored in the chip data of the XICS domain becomes useless and
we don't need it anymore to migrate away IRQs from a CPU. This will be
removed in a subsequent patch.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210701132750.1475580-17-clg@kaod.org
  • Loading branch information
Cédric Le Goater authored and Michael Ellerman committed Aug 10, 2021
1 parent 51be9e5 commit 298f6f9
Showing 1 changed file with 19 additions and 26 deletions.
45 changes: 19 additions & 26 deletions arch/powerpc/sysdev/xics/xics-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ DEFINE_PER_CPU(struct xics_cppr, xics_cppr);

struct irq_domain *xics_host;

static LIST_HEAD(ics_list);
static struct ics *xics_ics;

void xics_update_irq_servers(void)
{
Expand Down Expand Up @@ -111,12 +111,11 @@ void xics_setup_cpu(void)

void xics_mask_unknown_vec(unsigned int vec)
{
struct ics *ics;

pr_err("Interrupt 0x%x (real) is invalid, disabling it.\n", vec);

list_for_each_entry(ics, &ics_list, link)
ics->mask_unknown(ics, vec);
if (WARN_ON(!xics_ics))
return;
xics_ics->mask_unknown(xics_ics, vec);
}


Expand Down Expand Up @@ -198,7 +197,6 @@ void xics_migrate_irqs_away(void)
struct irq_chip *chip;
long server;
unsigned long flags;
struct ics *ics;

/* We can't set affinity on ISA interrupts */
if (virq < NR_IRQS_LEGACY)
Expand All @@ -219,13 +217,10 @@ void xics_migrate_irqs_away(void)
raw_spin_lock_irqsave(&desc->lock, flags);

/* Locate interrupt server */
server = -1;
ics = irq_desc_get_chip_data(desc);
if (ics)
server = ics->get_server(ics, irq);
server = xics_ics->get_server(xics_ics, irq);
if (server < 0) {
printk(KERN_ERR "%s: Can't find server for irq %d\n",
__func__, irq);
pr_err("%s: Can't find server for irq %d/%x\n",
__func__, virq, irq);
goto unlock;
}

Expand Down Expand Up @@ -307,13 +302,9 @@ int xics_get_irq_server(unsigned int virq, const struct cpumask *cpumask,
static int xics_host_match(struct irq_domain *h, struct device_node *node,
enum irq_domain_bus_token bus_token)
{
struct ics *ics;

list_for_each_entry(ics, &ics_list, link)
if (ics->host_match(ics, node))
return 1;

return 0;
if (WARN_ON(!xics_ics))
return 0;
return xics_ics->host_match(xics_ics, node) ? 1 : 0;
}

/* Dummies */
Expand All @@ -330,8 +321,6 @@ static struct irq_chip xics_ipi_chip = {
static int xics_host_map(struct irq_domain *h, unsigned int virq,
irq_hw_number_t hw)
{
struct ics *ics;

pr_devel("xics: map virq %d, hwirq 0x%lx\n", virq, hw);

/*
Expand All @@ -348,12 +337,14 @@ static int xics_host_map(struct irq_domain *h, unsigned int virq,
return 0;
}

if (WARN_ON(!xics_ics))
return -EINVAL;

/* Let the ICS setup the chip data */
list_for_each_entry(ics, &ics_list, link)
if (ics->map(ics, virq) == 0)
return 0;
if (xics_ics->map(xics_ics, virq))
return -EINVAL;

return -EINVAL;
return 0;
}

static int xics_host_xlate(struct irq_domain *h, struct device_node *ct,
Expand Down Expand Up @@ -427,7 +418,9 @@ static void __init xics_init_host(void)

void __init xics_register_ics(struct ics *ics)
{
list_add(&ics->link, &ics_list);
if (WARN_ONCE(xics_ics, "XICS: Source Controller is already defined !"))
return;
xics_ics = ics;
}

static void __init xics_get_server_size(void)
Expand Down

0 comments on commit 298f6f9

Please sign in to comment.