kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* RE: request_irq not working.. what else should I do?
@ 2022-04-05  5:01 Chan Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Chan Kim @ 2022-04-05  5:01 UTC (permalink / raw)
  To: kernelnewbies

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@etri.re.kr>
> Sent: Monday, April 4, 2022 11:16 PM
> To: kernelnewbies@kernelnewbies.org
> 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@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

* request_irq not working.. what else should I do?
@ 2022-04-04 14:16 Chan Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Chan Kim @ 2022-04-04 14:16 UTC (permalink / raw)
  To: kernelnewbies

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@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-05  5:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05  5:01 request_irq not working.. what else should I do? Chan Kim
  -- strict thread matches above, loose matches on Subject: below --
2022-04-04 14:16 Chan Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).