0

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!

stark
  • 12,615
  • 3
  • 33
  • 50
David C
  • 25
  • 3

1 Answers1

0

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

stark
  • 12,615
  • 3
  • 33
  • 50
  • Hi @stark, just to clarify, I am of the same opinion that Linux most probably do not use FIQ but the code base I am working on uses the FIQ for its own purpose. This FIQ calls into my driver code. – David C Aug 18 '20 at 14:24
  • If you need to disable FIQ, you could do your own custom irq_save. – stark Aug 18 '20 at 14:26
  • ... but watch out for race conditions in the order of disable/enable. – stark Sep 15 '22 at 11:12