firmware: arm_ffa: Fix kernel warning about incorrect SRI/NPI

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.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
Sudeep Holla 2024-04-18 11:29:32 +01:00
parent 08530a2aa9
commit 0370fb127c

View File

@ -1435,6 +1435,7 @@ static int ffa_init_pcpu_irq(void)
if (ret) {
pr_err("Error registering percpu SRI nIRQ %d : %d\n",
drv_info->sched_recv_irq, ret);
drv_info->sched_recv_irq = 0;
return ret;
}
}
@ -1446,6 +1447,7 @@ static int ffa_init_pcpu_irq(void)
if (ret) {
pr_err("Error registering percpu NPI nIRQ %d : %d\n",
drv_info->notif_pend_irq, ret);
drv_info->notif_pend_irq = 0;
return ret;
}
}