Firmware non-inductive updating method and system for storage device
By saving and restoring the runtime context information of the storage device in RAM, the problem of service interruption caused by firmware updates is solved, and seamless switching and low-latency firmware updates are achieved. It is applicable to storage devices with multiple interfaces such as NVMe and SATA.
Patent Information
- Application Number
- CN202511564821.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-30
- Publication Date
- 2026-02-10
AI Technical Summary
Existing storage devices require hardware reset or power failure to restart during firmware updates, causing service interruptions and preventing seamless switching to new versions while the device is running, thus impacting high-availability application scenarios.
Runtime context information is stored in a reserved area in RAM and restored during firmware switching through the context management module. This, combined with the firmware update processing module, reset control module, and context recovery module, enables seamless switching.
It achieves a service latency of 10ms, ensuring seamless switching, meeting high availability requirements, and requires no additional hardware costs while maintaining good compatibility.
Smart Images

Figure CN121501320A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of storage device technology, and in particular relates to a method and system for seamless firmware updates of storage devices. Background Technology
[0002] After a firmware update (FFU) is performed on an existing storage device, the new firmware must be activated by a hardware reset or power-off restart. This process can cause a disruption to the host's operations, which is unacceptable in some high-availability applications, such as cloud servers and continuously running industrial equipment.
[0003] When updating the firmware of existing storage devices, it is not possible to seamlessly switch to the new version while the firmware is running. The main obstacle is the inability to solve the problem of saving and restoring runtime context (such as stack, register state, and incomplete transactions). This may lead to losses in continuous production workshops, interruptions in cloud servers, and other situations, posing certain cost risks. Summary of the Invention
[0004] To address the aforementioned technical problems, this invention provides a method and system for seamless firmware updates of a storage device. The method involves allocating a storage area in RAM to instantly save the complete context of the currently running device before switching devices. During the switch, the device is restored based on the information in RAM. The host only perceives a delay of around 10ms. The system for seamless firmware updates of a storage device includes:
[0005] A reserved RAM area, located in the random access memory of the storage device, is used to store the runtime context information of the front-end module in a fixed format;
[0006] A context management module is used to write the runtime context information of the front-end module into the reserved RAM area during firmware runtime.
[0007] A firmware update processing module is used to receive firmware update instructions issued by the host and control the writing of the new firmware image into non-volatile memory.
[0008] A reset control module is used to trigger a firmware soft reset after the new firmware programming is completed, so that control is transferred to the boot program;
[0009] A context recovery module, integrated into the new firmware, is used to detect the firmware update identifier after the bootloader loads the new firmware, and to read and restore the saved context from the reserved RAM area, so that the new firmware can seamlessly take over the front-end business.
[0010] A method for seamless firmware update of a storage device, characterized in that the method includes the following steps:
[0011] Step S1: Define a region by defining a fixed reserved region in the random access memory of the storage device;
[0012] Step S2: Save information. During firmware operation, the runtime context information of the front-end module is continuously or periodically saved to the RAM reserved area. The runtime context information includes at least the front-end protocol status, driver running status, and incomplete transaction status.
[0013] Step S3: Programming and maintenance. When a firmware update instruction is received from the host, the new firmware image is programmed into the non-volatile memory, while the context information in the RAM reserved area is maintained.
[0014] Step S4: Execute the jump. After completing the new firmware programming, perform the firmware's own soft reset operation and transfer control to the boot program in the storage device.
[0015] Step S5: Loading and running, the bootloader loads and runs the new firmware;
[0016] Step S6: Detection and determination. After the new firmware is started, the preset firmware update identifier in the RAM reserved area is first detected. If the identifier is detected, it is determined to be a seamless update process, and the new firmware skips the normal initialization process of the front-end hardware and software protocols.
[0017] Step S7: Read recovery. The new firmware directly reads and recovers the saved runtime context information from the RAM reserved area, and continues to respond to host commands and process unfinished transactions based on this context.
[0018] Preferably, the contents of the RAM reserved area remain unchanged during system reset.
[0019] Preferably, in step S2, the runtime context information is stored in a predefined fixed data format that can be recognized by both new and old firmware versions.
[0020] Preferably, the soft reset operation in step S4 only resets firmware transactions and backend modules, while ensuring that the RAM reserved area and frontend hardware logic are not affected.
[0021] Preferably, the entire process from performing a soft reset to the new firmware restoring the context and becoming ready again takes on the order of 10 milliseconds, which is imperceptible to the host.
[0022] Beneficial effects
[0023] Compared with the prior art, the present invention has the following beneficial effects:
[0024] 1. Uninterrupted service: Completely eliminates device resets and service interruptions caused by firmware updates, meeting the stringent requirements of high-availability scenarios such as cloud servers and industrial control systems.
[0025] 2. Seamless context inheritance: By decoupling the state between the front-end and back-end / firmware transactions and solidifying the key front-end running state in RAM, the new firmware can "hot take over" all unfinished transactions, achieving a truly seamless switchover.
[0026] 3. Low implementation cost: This solution is mainly implemented by adding context saving and recovery logic to the existing firmware architecture. No additional hardware cost is required. It makes full use of the device's existing RAM resources and has high practicality and economy.
[0027] 4. Good compatibility: This method is transparent to the host and does not require modification of the host driver or protocol. It can be widely used in storage devices with multiple interfaces such as NVMe and SATA. Attached Figure Description
[0028] Figure 1 This is a diagram of the architecture of a system for seamless firmware updates of storage devices.
[0029] Figure 2 This is a flowchart of a method for seamless firmware updates for storage devices. Detailed Implementation
[0030] The present invention will be further described below with reference to the accompanying drawings:
[0031] In the picture:
[0032] As attached Figure 1 As shown:
[0033] The storage device in this embodiment is an NVMe solid-state drive. Its controller firmware is logically divided into a front-end, firmware transactions and a back-end. The front-end is responsible for handling NVMe protocol communication with the host and managing the Admin and I / O queues. The back-end is responsible for the read, write and erase operations of the Flash conversion layer and NAND Flash.
[0034] In the controller's RAM, a reserved area of 4KB is pre-allocated, and the contents of this area will not be cleared when the system is reset;
[0035] During normal operation, the firmware continuously writes the runtime state of the front end to this reserved area, including:
[0036] Head and tail pointers of the NVMe queue;
[0037] Identifiers and status of all incomplete I / O commands;
[0038] Key variables and data structures related to the Host session;
[0039] When the host issues the FFU command and the new firmware image via the Admin command, the device begins the firmware update process:
[0040] 1. The firmware writes the received firmware package to a specified area of the Flash memory;
[0041] 2. After writing is complete, the firmware sets the FFU flag in the reserved area to '1';
[0042] 3. Subsequently, the firmware triggers a soft reset signal directed to itself. This reset will reset the CPU core and most peripherals, but through hardware design, it ensures that the power and contents of the designated RAM reserved area and part of the front-end PHY logic are preserved.
[0043] After a reset, the CPU begins execution from the bootloader in ROM. The bootloader detects a new firmware image in Flash, loads it into RAM, and runs it.
[0044] The new firmware begins executing initialization code. Before initializing the front-end NVMe module, it first checks the FFU flag bit in the RAM reserved area. Upon finding the flag bit to be '1', the new firmware performs the following operations:
[0045] Skip standard steps such as NVMe controller register initialization and queue creation;
[0046] Read previously saved context information such as queue pointers and lists of incomplete commands directly from the RAM reserved area;
[0047] This context information is then restored to the corresponding software variables and hardware registers;
[0048] Clear the FFU flag;
[0049] After completing the above steps, the front end of the new firmware has been completely restored to the state before the old firmware update. It can correctly respond to any commands sent by the host during or after the update. The entire reset and loading process is completed within 10ms, far below the host's command timeout threshold, so the host is completely unaware that the firmware has been updated.
[0050] Any technical solution that achieves the above-mentioned technical effects by utilizing the technical solutions described in this invention, or by designing similar technical solutions by those skilled in the art under the inspiration of the technical solutions described in this invention, falls within the protection scope of this invention.
Claims
1. A system for seamless firmware updates of a storage device, characterized in that, The system is integrated into the storage device controller, and the system for seamless firmware updates of this type of storage device includes: A reserved RAM area, located in the random access memory of the storage device, is used to store the runtime context information of the front-end module in a fixed format; A context management module is used to write the runtime context information of the front-end module into the reserved RAM area during firmware runtime. A firmware update processing module is used to receive firmware update instructions issued by the host and control the writing of the new firmware image into non-volatile memory. A reset control module is used to trigger a firmware soft reset after the new firmware programming is completed, so that control is transferred to the boot program; A context recovery module, integrated into the new firmware, is used to detect the firmware update identifier after the bootloader loads the new firmware, and to read and restore the saved context from the reserved RAM area, so that the new firmware can seamlessly take over the front-end business.
2. A method for seamless firmware update of a storage device, characterized in that, The firmware seamless update method for this type of storage device includes the following steps: Step S1: Define a region by defining a fixed reserved region in the random access memory of the storage device; Step S2: Save information. During firmware operation, the runtime context information of the front-end module is continuously or periodically saved to the RAM reserved area. The runtime context information includes at least the front-end protocol status, driver running status, and incomplete transaction status. Step S3: Programming and maintenance. When a firmware update instruction is received from the host, the new firmware image is programmed into the non-volatile memory, while the context information in the RAM reserved area is maintained. Step S4: Execute the jump. After completing the new firmware programming, perform the firmware's own soft reset operation and transfer control to the boot program in the storage device. Step S5: Loading and running, the bootloader loads and runs the new firmware; Step S6: Detection and determination. After the new firmware is started, the preset firmware update identifier in the RAM reserved area is first detected. If the identifier is detected, it is determined to be a seamless update process. The new firmware skips the normal initialization process of the front-end hardware and software protocol. Step S7: Read recovery. The new firmware directly reads and recovers the saved runtime context information from the RAM reserved area, and continues to respond to host commands and process unfinished transactions based on this context.
3. The firmware seamless update method for a storage device as described in claim 2, characterized in that, The contents of the RAM reserved area remain unchanged during system reset.
4. The firmware seamless update method for a storage device as described in claim 2, characterized in that, In step S2, the runtime context information is stored in a predefined fixed data format that can be recognized by both new and old firmware versions.
5. The firmware seamless update method for a storage device as described in claim 2, characterized in that, The soft reset operation in step S4 only resets firmware transactions and backend modules, while ensuring that the RAM reserved area and frontend hardware logic are not affected.
6. The firmware seamless update method for a storage device as described in claim 2, characterized in that, The entire process, from performing a soft reset to the new firmware restoring the context and becoming ready again, takes on the order of 10 milliseconds, making the service interruption imperceptible to the host.
Citation Information
Cited By
A BMS non-inductive upgrading system and method based on a hardware holding circuit
CN122239563A