I am trying to code some IRQ handler for a shared IRQ line.
Essentially I only need to read some memory words from the device memory.
To do so I use mem = ioremap_nocache(addr, 8);
(8 Bytes is only what I need). And then calling from the handlers.
irqreturn_t do_sample_irq() {
int val;
val = ioread32(mem); // I know this is only 4 Bytes, but it is ok.
printk(KERN_INFO, "%x.\n", val);
return (irqreturn_t) IRQ_HANDLED;
}
irqreturn_t sample_irq_handler() {
irqreturn_t ret;
spin_lock_irq(&lock);
ret = do_sample_irq();
spin_unlock_irq(&lock);
return ret;
}
Then, whenever I insert the module, instantly gives a kernel panic: kernel not sync: Fatal exception interrupt context.
My guess is that I am not using the proper synchronising techniques, but I cannot devise what (new in the developing kernel modules task).
What is happening?