I found request_irq(32+176, axpu_irq_handler, IRQF_SHARED, "axpu_irq", &axpu_cdev); returned -22. (EINVALID). And this is the sanity-check code of request_thread_irq function where -EINVAL is returned. Because I'm running my app/driver on ubuntu-20.04 (kernel 5.4.0-77) on a virtual machine, I cannot debug the kernel code right now. I suspect one of the "if (!desc)" case or "if (!irq_settings_can_request(desc))" will be returning it -EINVAL. Do I have to do something before I call request_irq? Can I use request_irq in kernel module driver? (I think so). /* * Sanity-check: shared interrupts must pass in a real dev-ID, * otherwise we'll have trouble later trying to figure out * which interrupt is which (messes up the interrupt freeing * logic etc). * * Also IRQF_COND_SUSPEND only makes sense for shared interrupts and * it cannot be set along with IRQF_NO_SUSPEND. */ if (((irqflags & IRQF_SHARED) && !dev_id) || (!(irqflags & IRQF_SHARED) && (irqflags & IRQF_COND_SUSPEND)) || ((irqflags & IRQF_NO_SUSPEND) && (irqflags & IRQF_COND_SUSPEND))) return -EINVAL; desc = irq_to_desc(irq); if (!desc) return -EINVAL; if (!irq_settings_can_request(desc) || WARN_ON(irq_settings_is_per_cpu_devid(desc))) return -EINVAL; if (!handler) { if (!thread_fn) return -EINVAL; handler = irq_default_primary_handler; } Thanks for reading. Chan Kim > -----Original Message----- > From: Chan Kim <ckim@xxxxxxxxxx> > Sent: Monday, April 4, 2022 11:16 PM > To: kernelnewbies@xxxxxxxxxxxxxxxxx > Subject: request_irq not working.. what else should I do? > > Hello, > > When I register interrupt handler in arm64 machine, I use request_irq( ) > function defined below. > (on ubuntu 20.04 on qemu arm64 virtual machine) > > static inline int __must_check > request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, > const char *name, void *dev) > { > return request_threaded_irq(irq, handler, NULL, flags, name, dev); } > > I found even though I registered the handler for arm64 SPI (shared > peripheral interrupt) 176, it is not generating interrupt in the qemu > virtual machine. The OS should set the priority and enable it in the > interrupt controller but it doesn't work. That's what OS is for, isn't it? > But when I follow the qemu code, in the distributor stage, it says there > is no pending interrupt. > How can I set the interrupt priority using request_irq function above? > > Thank you! > Chan Kim _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies