Linux generic irq handling

Shrikant Dharwadkar msdharwadkar at gmail.com
Mon Nov 6 01:44:50 EST 2017


*Register an linux generic interrupt handler using an virtual irq which
maps to the actual hwirq of domain to handle interrupts.*

I'm having issues in handling interrupts. So far I have registered an
interrupt handler based on the following kernel docuentation IRQ-domain.txt
<https://www.kernel.org/doc/Documentation/IRQ-domain.txt>, by setting the
ops and creating mapping between domain and hwirq. But unable to receive
interrupts on the newly registered virtual interrupt line.

So my question's are:

   1.

   Am I doing something wrong in the mapping because I am not seeing any
   interrupts getting handled in cat /proc/interrupts.
   2.

   Should the request_thereaded_irq() consist of the actual hwirq and later
   handled in the threaded handler on virq as done in arizona.

*code:*

static struct irq_chip irq_chip = {
    .name                   = "CHIP-IRQ",
    .irq_disable            = noop,
    .irq_enable             = noop,
};


static int irq_map(struct irq_domain *h, unsigned int virq,
                             irq_hw_number_t hw)
{
       struct chipdata *data = h->host_data;

       irq_set_chip_and_handler(virq, &irq_chip, handle_simple_irq);
       irq_set_chip_data(virq, data);
       irq_set_noprobe(virq);

       return 0;
}

static const struct irq_domain_ops irq_domain_ops = {
       .map    = irq_map,
       .xlate  = irq_domain_xlate_twocell,
};

/* Register an interrupt domain */    `
chipdata.irq_domain = irq_domain_create_linear( fwn, 20, &irq_domain_ops, ebus);
if (!chipdata.irq_domain) {
         dev_err(ebus->bus.dev, "Failed to add core IRQ domain\n");
}

/* Create mapping between domain and hwirq*/
virq = irq_create_mapping( chipdata.irq_domain, hwirq);

ret = request_threaded_irq( virq, interrupt, threaded_interrupt,
IRQF_SHARED, KBUILD_MODNAME, ebus);
if (ret) {
         dev_err(bus->dev, "unable to grab IRQ %d, disabling device\n", virq);
         return ret;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20171106/7d69c84d/attachment.html 


More information about the Kernelnewbies mailing list