Skip to content

Conversation

@jamieNguyenNVIDIA
Copy link
Collaborator

Commits:

NVIDIA: VR: SAUCE: firmware: smccc: lfa: refresh fw details
NVIDIA: VR: SAUCE: firmware: smccc: register as platform driver
NVIDIA: VR: SAUCE: firmware: smccc: add timeout, touch wdt
NVIDIA: VR: SAUCE: firmware: smccc: LFA: refactor
NVIDIA: VR: SAUCE: firmware: smccc: LFA: use smcc 1.2
NVIDIA: VR: SAUCE: firmware: smccc: Add support for Live Firmware Activation (LFA)

Lore links:

  1. https://lore.kernel.org/lkml/20250926123145.268728-1-salman.nabi@arm.com/
  2. https://lore.kernel.org/all/20251208221319.1524888-1-vvidwans@nvidia.com/

Testing done:

nvidia@localhost:~$ sudo dmesg | grep LFA
[   28.196007] Arm LFA: Arm Live Firmware Activation (LFA): detected v1.0
nvidia@localhost:~$ ls /sys/bus/platform/drivers/ARM_LFA/
ARMHF000:00  bind  uevent  unbind
nvidia@localhost:~$ ls /sys/firmware/lfa
0509b633-5734-422f-a681-6096e932d93a  65922703-2f74-e644-8dff-579ac1ff0610
3ab71f81-32b9-496d-841b-e3d0e9fd1a48  6c0762a6-12f2-4b56-92cb-ba8f633606d9
nvidia@localhost:~$ find /sys/firmware/lfa/0509b633-5734-422f-a681-6096e932d93a
/sys/firmware/lfa/0509b633-5734-422f-a681-6096e932d93a
/sys/firmware/lfa/0509b633-5734-422f-a681-6096e932d93a/may_reset_cpu
/sys/firmware/lfa/0509b633-5734-422f-a681-6096e932d93a/cpu_rendezvous
/sys/firmware/lfa/0509b633-5734-422f-a681-6096e932d93a/cancel
/sys/firmware/lfa/0509b633-5734-422f-a681-6096e932d93a/force_cpu_rendezvous
/sys/firmware/lfa/0509b633-5734-422f-a681-6096e932d93a/activate
/sys/firmware/lfa/0509b633-5734-422f-a681-6096e932d93a/activation_capable
/sys/firmware/lfa/0509b633-5734-422f-a681-6096e932d93a/activation_pending
/sys/firmware/lfa/0509b633-5734-422f-a681-6096e932d93a/name
nvidia@localhost:~$ uname -r
6.18.4-jamienlfa+

salmannabi1 and others added 6 commits January 13, 2026 13:23
…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>
Copy link
Collaborator

@nvmochs nvmochs left a 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>

Copy link
Collaborator

@clsotog clsotog left a 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>

@jamieNguyenNVIDIA
Copy link
Collaborator Author

Merged: 96c0bb5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants