Re: [PATCH v3 08/12] irqchip: add J-Core AIC driver

From: Rich Felker
Date: Fri Jul 15 2016 - 13:03:18 EST


On Fri, Jul 15, 2016 at 04:19:17PM +0000, Jason Cooper wrote:
> > + u32 cpu_offset;
> > + struct irq_chip chip;
> > + struct irq_domain *domain;
> > + struct notifier_block nb;
> > +} aic_data;
> > +
> > +static int aic_irqdomain_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hwirq)
> > +{
> > + struct aic_data *aic = d->host_data;
> > +
> > + irq_set_chip_data(irq, aic);
> > + irq_set_chip_and_handler(irq, &aic->chip, handle_simple_irq);
> > + irq_set_probe(irq);
> > +
> > + return 0;
> > +}
> > +
> > +static const struct irq_domain_ops aic_irqdomain_ops = {
> > + .map = aic_irqdomain_map,
> > + .xlate = irq_domain_xlate_onecell,
> > +};
> > +
> > +static void noop(struct irq_data *data)
> > +{
> > +}
> > +
> > +static void aic1_localenable(struct aic_data *aic)
> > +{
> > + unsigned cpu = smp_processor_id();
> > + pr_info("Local AIC enable on cpu %u\n", cpu);
> > + writel(0xffffffff, aic->base + cpu * aic->cpu_offset + AIC1_INTPRI);
> > +}
> > +
> > +static int aic1_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
> > +{
> > + switch (action & ~CPU_TASKS_FROZEN) {
> > + case CPU_STARTING:
> > + aic1_localenable(container_of(self, struct aic_data, nb));
> > + break;
> > + }
> > + return NOTIFY_OK;
> > +}
>
> Please take a look at the series posted by Anna-Maria Gleixner for
> recent changes to the cpu hp state machine.
>
> https://lkml.kernel.org/r/20160713153333.416260485@xxxxxxxxxxxxx

I saw this but was utterly confused about what's going on. Is the
general notifier system that doesn't need to be aware of specific
devices actually being replaced by a huge enum table of all possible
devices that need special treatment as cpu starting/dying?? Or do I
misunderstand what's going on?

Rich