• Sudeep Holla's avatar
    firmware: arm_ffa: Fix kernel warning about incorrect SRI/NPI · 0370fb12
    Sudeep Holla authored
    If the firmware returns incorrect SRI/NRI number, we fail to set it up
    in the kernel which is absolutely fine.
    
    However, we don't reset the stashed value of sched_recv or notif_pend
    IRQs. When we call ffa_notifications_cleanup() in case of failures to
    setup the notifications, we end up calling free_percpu_irq() from
    ffa_uninit_pcpu_irq() which results in the following warning:
    
      |  genirq: Flags mismatch irq 6. 00004401 (ARM-FFA-NPI) vs. 00004400 (IPI)
      |  ARM FF-A: Error registering percpu NPI nIRQ 6 : -16
      |  ARM FF-A: Notification setup failed -16, not enabled
      |  ------------[ cut here ]------------
      |  Trying to free already-free IRQ 6
      |  WARNING: CPU: 2 PID: 1 at kernel/irq/manage.c:2476 __free_percpu_irq+0x6c/0x138
      |  Modules linked in:
      |  CPU: 2 PID: 1 Comm: swapper/0 Not tainted 6.9.0-rc3 #211
      |  Hardware name: FVP Base RevC (DT)
      |  pstate: 614000c9 (nZCv daIF +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
      |  pc : __free_percpu_irq+0x6c/0x138
      |  lr : __free_percpu_irq+0x6c/0x138
      |  Call trace:
      |   __free_percpu_irq+0x6c/0x138
      |   free_percpu_irq+0x48/0x84
      |   ffa_notifications_cleanup+0x78/0x164
      |   ffa_notifications_setup+0x368/0x3c0
      |   ffa_init+0x2b4/0x36c
      |   do_one_initcall+0xe0/0x258
      |   do_initcall_level+0x8c/0xac
      |   do_initcalls+0x54/0x94
      |   do_basic_setup+0x1c/0x28
      |   kernel_init_freeable+0x108/0x174
      |   kernel_init+0x20/0x1a4
      |   ret_from_fork+0x10/0x20
    
    Fix the same by resetting the stashed copy of IRQ values to 0 in case
    of any failure to set them up properly.
    
    Cc: Jens Wiklander <jens.wiklander@linaro.org>
    Link: https://lore.kernel.org/r/20240418102932.3093576-1-sudeep.holla@arm.comSigned-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
    0370fb12
driver.c 39.7 KB