Search code examples
linuxlinux-kernelspinlockfiq

Does Linux spin_lock_irqsave() disables ARM FIQ interrupt?


I am writing a Linux device driver and need to serialize access to critical sections of the driver from tasks and interrupts. I am developing for ARM.

If I use spin_lock_irqsave() and spin_unlock_irqrestore() pair to protect my critical sections, is FIQ blocked while in these critical sections?

I tried looking at the implementations of these 2 functions, in particular spin_lock_irqsave(). My initial impression is that FIQ is not disabled. Just want to verify this with the experts out here.

Please enlighten me. Thanks!


Solution

  • I don't think Linux uses FIQ, so an FIQ will not conflict with a Linux ISR. That said, I believe it uses:

    cpsid i
    

    This disables regular interrupts. To also disable FIQs it would need to do

    cpsid if
    

    See: https://elixir.bootlin.com/linux/latest/source/arch/arm/include/asm/irqflags.h#L25