-
Notifications
You must be signed in to change notification settings - Fork 53
[linux-nvidia-6.18] Backport ARM Live Firmware Activation (LFA) Support #281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[linux-nvidia-6.18] Backport ARM Live Firmware Activation (LFA) Support #281
Conversation
…ivation (LFA) The Arm Live Firmware Activation (LFA) is a specification [1] to describe activating firmware components without a reboot. Those components (like TF-A's BL31, EDK-II, TF-RMM, secure paylods) would be updated the usual way: via fwupd, FF-A or other secure storage methods, or via some IMPDEF Out-Of-Bound method. The user can then activate this new firmware, at system runtime, without requiring a reboot. The specification covers the SMCCC interface to list and query available components and eventually trigger the activation. Add a new directory under /sys/firmware to present firmware components capable of live activation. Each of them is a directory under lfa/, and is identified via its GUID. The activation will be triggered by echoing "1" into the "activate" file. The other files reflect the status of the firmware image, as reported by the LFA agent, and described in the LFA spec. "force_cpu_rendezvous" is a boolean flag that controls the CPU rendezvous behaviour. Normally when activating a firmware the kernel will gather all CPUs to avoid them calling firmware services during the activation. As this is disruptive and might not be necessary, depending on the nature of the firmware, setting this flag to 0 will let the kernel skip the stop_machine() call for the activation. ========================================== /sys/firmware/lfa # ls -l . 6c* .: total 0 drwxr-xr-x 2 0 0 0 May 30 13:31 47d4086d-4cfe-9846-9b95-2950cbbd5a00 drwxr-xr-x 2 0 0 0 May 30 13:31 6c0762a6-12f2-4b56-92cb-ba8f633606d9 drwxr-xr-x 2 0 0 0 May 30 13:31 d6d0eea7-fcea-d54b-9782-9934f234b6e4 6c0762a6-12f2-4b56-92cb-ba8f633606d9: total 0 --w------- 1 0 0 4096 May 30 13:31 activate -r--r--r-- 1 0 0 4096 May 30 13:31 activation_capable -r--r--r-- 1 0 0 4096 May 30 13:31 activation_pending --w------- 1 0 0 4096 May 30 13:31 cancel -r--r--r-- 1 0 0 4096 May 30 13:31 cpu_rendezvous -rw-r--r-- 1 0 0 4096 May 30 13:31 force_cpu_rendezvous -r--r--r-- 1 0 0 4096 May 30 13:31 may_reset_cpu -r--r--r-- 1 0 0 4096 May 30 13:31 name /sys/firmware/lfa/6c0762a6-12f2-4b56-92cb-ba8f633606d9 # grep . * grep: activate: Permission denied activation_capable:1 activation_pending:1 grep: cancel: Permission denied cpu_rendezvous:1 force_cpu_rendezvous:1 may_reset_cpu:0 name:rmm /sys/firmware/lfa/6c0762a6-12f2-4b56-92cb-ba8f633606d9 # echo 1 > activate [ 2825.797871] Arm LFA: firmware activation succeeded. /sys/firmware/lfa/6c0762a6-12f2-4b56-92cb-ba8f633606d9 # ========================================== [1] https://developer.arm.com/documentation/den0147/latest/ Signed-off-by: Salman Nabi <salman.nabi@arm.com> [Andre: add actual activation routine, cleanups] Signed-off-by: Andre Przywara <andre.przywara@arm.com> (backported from https://lore.kernel.org/lkml/20250926123145.268728-1-salman.nabi@arm.com/) Signed-off-by: Jamie Nguyen <jamien@nvidia.com>
Update driver to use SMCCC 1.2+ version as mentioned in the LFA spec. Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com> (backported from https://lore.kernel.org/linux-arm-kernel/20251208221319.1524888-1-vvidwans@nvidia.com/) Signed-off-by: Jamie Nguyen <jamien@nvidia.com>
- Refactor LFA CANCEL logic into independent lfa_cancel() function. - Use FW UUID as image_name for images not known by the driver. - Move may_reset_cpu check to activate_fw_image(). This keeps all the functionality within a function. Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com> (backported from https://lore.kernel.org/linux-arm-kernel/20251208221319.1524888-1-vvidwans@nvidia.com/) Signed-off-by: Jamie Nguyen <jamien@nvidia.com>
Enhance PRIME/ACTIVATION functions to touch watchdog and implement timeout mechanism. This update ensures that any potential hangs are detected promptly and that the LFA process is allocated sufficient execution time before the watchdog timer expires. These changes improve overall system reliability by reducing the risk of undetected process stalls and unexpected watchdog resets. Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com> (backported from https://lore.kernel.org/linux-arm-kernel/20251208221319.1524888-1-vvidwans@nvidia.com/) Signed-off-by: Jamie Nguyen <jamien@nvidia.com>
- Update driver to be in-built kernel module. This will ensure driver is
installed in kernel and would not require any user intervention.
- Register the LFA driver as a platform driver corresponding to
'armhf000' device. The driver will be invoked when the device is
detected on a platform.
- Add functionality to register LFA interrupt in the driver probe().
This LFA IRQ number will be retrived from the LFA device node.
- On IRQ, driver will query FW component details and trigger activation
of capable and pending FW component. The driver will loop to update FW
component details after every successful FW component activation.
- Mutex synchronization is implemented to avoid concurrent LFA updates
through interrupt and sysfs interfaces.
Device node snippet from LFA spec[1]:
fwu0 {
compatible = "arm,armhf000";
memory-region = <&fwu_payload>;
interrupt-parent = <&ic>;
interrupts = <0 100 1>; // SPI, Interrupt NVIDIA#100, Edge Rising
};
[1] https://developer.arm.com/documentation/den0147/latest/
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
(backported from https://lore.kernel.org/linux-arm-kernel/20251208221319.1524888-1-vvidwans@nvidia.com/)
[jamien: remove unnecessary __init from lfa_probe to avoid warning]
Signed-off-by: Jamie Nguyen <jamien@nvidia.com>
FW image details are querried with a SMC call. Currently, these FW details are added as nodes in a linked list. This patch updates the FW node creation and update functions. Now the linked list is updated based on the current value of num_lfa_components. As per spec [1], FW inventory is updated after each activation. [1] https://developer.arm.com/documentation/den0147/latest/ Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com> (backported from https://lore.kernel.org/linux-arm-kernel/20251208221319.1524888-1-vvidwans@nvidia.com/) [jamien: remove unnecessary loop initializer in update_fw_images_tree() to avoid warning] Signed-off-by: Jamie Nguyen <jamien@nvidia.com>
nvmochs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed this matches what is present on LKML (excluding the minor fixes in two of the patches).
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
clsotog
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acked-by: Carol L Soto <csoto@nvidia.com>
|
Merged: 96c0bb5 |
Commits:
Lore links:
Testing done: