A firmware upgrading method, device, equipment and machine readable storage medium
Patent Information
- Application Number
- CN202611196037.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-07
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2046-08-07
AI Technical Summary
[0004]传统的该类设备固件升级方案,通常需要重启主机端,此举会造成系统服务中断,严重影响业务正常运行与用户使用体验
[0016] Beneficial effects: This invention, through hardware and software collaboration and virtualization technology, migrates the downtime maintenance process required for traditional firmware upgrades to a parallel virtual machine, achieving uninterrupted firmware hot upgrades. Based on hot migration, this invention constructs a digital twin virtual machine equivalent to the PCIe device, ensuring zero service interruption and no packet loss through seamless switching, meeting the high reliability requirements of 24/7 operation. Simultaneously, through an independent bare-core proxy system and memory segmentation mechanism, it enables strong isolation between the business system and the upgrade system, effectively improving system reliability and fault tolerance. Furthermore, this invention offloads a large amount of processing logic to the host-side virtual environment, requiring extremely low hardware resources such as the number of cores and storage capacity of the PCIe device. It is well-suited for microcontrollers and lightweight real-time operating systems, possessing broad applicability and strong engineering practical value.
Smart Images

Figure CN122691627B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a firmware upgrade method, apparatus, device, and machine-readable storage medium. Background Technology
[0002] Peripheral Component Interconnect (PCIe), as a high-speed serial computer expansion bus standard, has been widely used in modern computer systems due to its excellent flexibility and scalability. With the rapid development of computing technology and the continuous expansion of application scenarios, devices using this bus standard have become core components of servers, high-performance computing clusters, data centers, and various embedded systems, undertaking key roles such as data interaction, signal enhancement, and resource expansion. From graphics processing unit (GPU) nodes and non-volatile memory (NVMe) all-flash nodes to network resource pools, the structure and function of these devices are becoming increasingly complex, placing higher demands on their operational stability and performance.
[0003] Meanwhile, driven by technological iterations and continuously evolving functional requirements, firmware upgrades for such devices have become an indispensable part of system operation and maintenance. Firmware upgrades not only fix defects and security vulnerabilities present in the device design phase, but also improve device performance, add new functionalities, and optimize system compatibility. Against the backdrop of rapid development in fields such as artificial intelligence, cloud computing, and big data, the requirements for information exchange rates between server hardware are becoming increasingly stringent, further highlighting the importance of firmware maintenance for such devices. However, traditional firmware upgrade methods have many limitations, which are particularly prominent in critical application scenarios where business continuity must be guaranteed.
[0004] Traditional firmware upgrade solutions for this type of device typically require a host machine reboot, which causes system service interruption and severely impacts normal business operations and user experience. In critical business scenarios such as financial trading systems, cloud computing platforms, and real-time data processing, system reboots can easily lead to significant economic losses and a marked decline in service quality. Therefore, there is an urgent need for a method that allows for device firmware upgrades without host machine reboots, enabling uninterrupted business operations to meet the requirements of high reliability and high continuity scenarios. Summary of the Invention
[0005] The present invention aims to provide a firmware upgrade method, apparatus, device, and machine-readable storage medium.
[0006] To achieve the above objectives, the technical solution of the present invention is as follows: A firmware upgrade method, comprising: Step S1: Load and verify the new firmware file to be distributed using the host's upgrade tool program; configure the virtual machine startup parameters, establish a fast emulator Ethernet socket communication service, and start the virtual machine based on the new firmware file; Step S2: Obtain the virtual machine startup parameters, start the business processing system and agent system in the virtual machine, establish a connection between the agent system in the virtual machine and the business processing system in the PCIe device through the upgrade channel, and the agent system in the virtual machine enters the active mode. Step S3: The business processing system in the virtual machine initiates a configuration synchronization request to the agent system in the virtual machine. The agent system in the virtual machine obtains the current first software configuration synchronization data of the business processing system in the PCIe device through the communication interface of the upgrade channel in the virtual machine and transmits it back to the business processing system in the virtual machine. The agent system synchronizes the business processing system in the virtual machine according to the first software configuration synchronization data. If the synchronization is successful, the new firmware file is downloaded to the backup firmware storage area of the PCIe device. Step S4: After the service processing system in the virtual machine completes synchronization, the host transfers control of the communication interface of the upgrade channel in the virtual machine to the service processing system in the virtual machine. The service processing system in the virtual machine enters active mode and initiates a service switching command to the service processing system of the PCIe device. Step S5: The service processing system of the PCIe device transfers the control of the communication interface of the upgrade channel in the PCIe device to the agent system of the PCIe device according to the service switching instruction. The agent system of the PCIe device enters the active mode and forwards the service packets to the service processing system in the virtual machine for service processing. Step S6: Restart the service processing system in the PCIe device and load the new firmware file in the backup firmware storage area for upgrade. After the upgrade is completed, the service processing system in the PCIe device initiates a configuration synchronization request to the agent system in the PCIe device. The agent system in the PCIe device obtains the current second software configuration synchronization data from the service processing system in the virtual machine according to the configuration synchronization request and sends it back to the service processing system in the PCIe device. The agent system in the PCIe device is synchronized according to the second software configuration synchronization data to complete the software configuration synchronization between the service processing system in the PCIe device and the service processing system in the virtual machine. Step S7: The service processing system in the PCIe device initiates a service switchback command to the agent system in the PCIe device, and the agent system in the PCIe device transfers control of the communication interface to the service processing system in the PCIe device according to the service switchback command. Step S8: After the service processing system in the PCIe device processes the service normally, it disconnects from the service processing system in the virtual machine.
[0007] Optionally, step S3 includes: Step S31: The business processing system in standby mode in the virtual machine initiates a configuration synchronization request to the agent system in the virtual machine; Step S32: The agent system in the virtual machine responds to the configuration synchronization request, generates a first type of configuration request message, and writes the first type of configuration request message into the first base address register space sending queue corresponding to the upgrade channel in the virtual machine, thus completing the sending of the first type of configuration request message; Step S33: Generate a first message signal interrupt message through the agent system in the virtual machine to notify the host that there is data to be processed; Step S34: Obtain and identify the first message signal interruption message through the communication interface in the virtual machine, read the first type of configuration request message from the first base address register space sending queue corresponding to the upgrade channel in the virtual machine, and forward the first type of configuration request message to the host through the Ethernet socket communication connection; Step S35: The host receives the first type of configuration request message through an Ethernet socket communication connection, and writes the first type of configuration request message into the second base address register space receive queue corresponding to the upgrade channel in the PCIe device through the virtual proxy endpoint in the host, thereby completing the request transmission from the host to the PCIe device. Step S36: When the second base address register space receive queue corresponding to the upgrade channel in the PCIe device detects the writing of the first type of configuration request message, the first type of configuration request message is read and parsed. Step S37: Configure a virtual proxy endpoint in the PCIe device, parse the first type of configuration request message through the virtual proxy endpoint of the PCIe device, generate the first software configuration synchronization data of the current service processing system in the PCIe device, encapsulate it into a configuration synchronization data message, and write the configuration synchronization data message into the second base address register space sending queue corresponding to the upgrade channel in the PCIe device, ready to be sent to the virtual machine. Step S38: Send a second message signal interrupt message to the host through the PCIe device to notify the host that the configuration synchronization data message is ready; Step S39: The virtual agent endpoint of the host responds to the second message signal interrupt message, reads the configuration synchronization data message in the second base address register space transmission queue corresponding to the upgrade channel in the PCIe device, and sends the configuration synchronization data message to the virtual machine through the Ethernet socket communication connection; Step S310: The virtual machine receives the configuration synchronization data message through an Ethernet socket communication connection and writes the configuration synchronization data message into the first base address register space receiving queue corresponding to the upgrade channel in the virtual machine, thereby completing the caching of the configuration synchronization data message in the virtual machine; Step S311: The agent system in the virtual machine detects and reads the configuration synchronization data message, and transmits the payload data obtained by parsing the configuration synchronization data message to the business processing system in standby mode in the virtual machine to complete the delivery of configuration synchronization data. In step S312, the service processing system in the virtual machine receives the configuration synchronization data and synchronizes the service processing system in the virtual machine according to the first software configuration synchronization data. Steps S31 to S311 are repeated. If all configuration synchronization data is successfully synchronized, the new firmware file is downloaded to the backup firmware storage area of the PCIe device.
[0008] Optionally, step S5 includes: Step S51: After receiving the service switching instruction, the service processing system of the PCIe device transfers the control of the communication interface of the upgrade channel in the PCIe device to the agent system of the PCIe device, and switches the agent system of the PCIe device to active mode; the agent system of the PCIe device receives the first service request message through the communication interface. Step S52: Encapsulate the first service request message into a second type of transmission message and write it into the second base address register space transmission queue corresponding to the upgrade channel in the PCIe device. Step S53: The third message signal interrupt message is sent to the host through the agent system in the PCIe device to notify the host that there is data to be processed, triggering the host to perform a data forwarding operation; Step S54: The host responds to the third message signal interrupt message, reads the second type of transmission message from the second base address register space transmission queue, and forwards the second type of transmission message to the virtual machine through the Ethernet socket communication connection; Step S55: The virtual machine receives the second type of transmission message through the Ethernet socket communication connection and decapsulates it to obtain the first service request message, and then transmits the first service request message to the first base address register space receiving queue corresponding to the upgrade channel in the virtual machine. Step S56: The service processing system in the virtual machine receives the first service request message in the first base address register space queue, processes the first service request message, terminates the first service request message according to service needs, and completes the service processing; or generates the first service response message according to service needs and encapsulates it into a second type of transmission message, forwards the second type of transmission message to the host through an Ethernet socket communication connection, and proceeds to step S57. Step S57: The host receives the second type of transmission message through an Ethernet socket communication connection and writes the second type of transmission message into the second base address register space transmission queue through the virtual proxy endpoint of the host; Step S58: When the agent system in the PCIe device detects that the second type of transmission message is written into the second base address register space receive queue, it reads and parses the second type of transmission message to obtain the first service response message; In step S59, the agent system of the PCIe device sends the received first service response message directly from the communication interface to the service request source.
[0009] Optionally, the firmware upgrade method further includes: After the agent system starts, it identifies the shared storage area of the business processing system and the agent system within the PCIe device or virtual machine it is located in, and enters the corresponding execution process according to the startup mode. When the agent system starts in active mode, it extracts startup parameters containing upgrade channel base address register address information and communication interface queue information from the shared storage area, completes communication interface initialization, constructs upgrade channel handshake message and writes it into the upgrade channel sending queue, and simultaneously constructs message signal interrupt message and sends it to the host via the communication interface to initiate handshake connection. After successful handshake, the agent system enters active mode, polls and listens to the communication interface receiving queue and the upgrade channel receiving queue, and processes the received service messages according to preset rules. When the agent system starts in standby mode, it waits for the business processing system to enter active mode. The business processing system retrieves startup parameters from the shared storage area, continuously polls and listens for control information in the shared storage area and processes it, waiting for the host to send a communication interface control switch notification. Upon receiving the communication interface control switch notification, it retrieves relevant parameters of the communication interface from the shared storage area, completes the control switch and takeover of the communication interface, and executes the handshake connection establishment process. After the handshake is successful, the agent system enters active mode, polls and listens for the communication interface packet receiving queue and the upgrade channel packet receiving queue, and processes the received business packets according to preset rules. The startup and operation method of the business processing system is the same as that of the agent system.
[0010] Optionally, the firmware upgrade method further includes: the agent system continuously monitors the packet receiving queue of the communication interface and the packet receiving queue of the upgrade channel; when there is a service message in the packet receiving queue of the communication interface, the service message is encapsulated into a custom transmission protocol message and written into the sending queue of the corresponding upgrade channel, a message signal interruption notification message is generated and sent through the communication interface. When a private protocol message is detected in the receive queue of the upgrade channel, the private protocol message is parsed and matched with the corresponding protocol type. It is determined whether the protocol type of the private protocol message is the original service message that needs to be forwarded to the communication interface of the PCIe device. If so, the private protocol message is decapsulated to obtain the original message and sent through the communication interface of the upgrade channel in the PCIe device. If not, the message is terminated or a corresponding protocol response message is generated according to the provisions of the custom transmission protocol and written into the send queue of the upgrade channel. A message signal interruption notification message is generated and sent through the communication interface.
[0011] A firmware upgrade device, comprising: The host includes a virtual agent endpoint module and a host upgrade tool module; the host communicates with PCIe devices via a PCIe bus and with virtual machines via Ethernet sockets based on the Transmission Control Protocol; the host upgrade tool module loads and verifies the new firmware file to be distributed; configures virtual machine startup parameters, establishes a fast emulator Ethernet socket communication service, and starts the virtual machine based on the new firmware file; The virtual machine is a virtual environment built by a fast emulator that simulates the same hardware architecture as the PCIe device; The virtual machine is used to obtain the virtual machine startup parameters, start the first business processing system unit and the first agent unit in the virtual machine, establish a connection between the first agent unit in the virtual machine and the second business processing system unit in the PCIe device, and the first agent unit in the virtual machine enters the active mode. The first service processing system unit in the virtual machine initiates a configuration synchronization request to the first agent unit in the virtual machine. The first agent unit in the virtual machine obtains the current first software configuration synchronization data of the second service processing system unit in the PCIe device through the first communication interface unit in the virtual machine and transmits it back to the first service processing system unit in the virtual machine. The first service processing system unit in the virtual machine is synchronized according to the first software configuration synchronization data. If the synchronization is successful, the new firmware file is downloaded to the backup firmware storage area of the PCIe device. After the first service processing system unit in the virtual machine completes synchronization, the host transfers control of the first communication interface unit in the virtual machine to the first service processing system unit in the virtual machine. The first service processing system unit in the virtual machine enters active mode and initiates a service switching command to the second service processing system unit in the PCIe device. The PCIe device includes at least two independent central processing unit cores, which respectively run a second agent unit and a second service processing system unit. The second service processing system unit of the PCIe device transfers control of the second communication interface unit in the PCIe device to the second agent unit of the PCIe device according to the service switching instruction. The second agent unit of the PCIe device enters an active mode and forwards service packets to the first service processing system unit in the virtual machine for service processing. The second service processing system unit in the PCIe device is restarted and the new firmware file in the backup firmware storage area is loaded for upgrade. After the upgrade is completed, the second service processing system unit in the PCIe device initiates a configuration synchronization request to the second agent unit in the PCIe device. The second agent unit in the PCIe device obtains the current second software configuration synchronization data from the first service processing system unit in the virtual machine according to the configuration synchronization request and sends it back to the second service processing system unit in the PCIe device, thus completing the software configuration synchronization between the second service processing system unit in the PCIe device and the first service processing system unit in the virtual machine. The second service processing system unit in the PCIe device initiates a service switchback command to the second agent unit in the PCIe device, and the second agent unit in the PCIe device transfers control of the second communication interface unit to the second service processing system unit in the PCIe device according to the service switchback command. After the second service processing system unit in the PCIe device processes the service normally, it disconnects from the first service processing system unit in the virtual machine.
[0012] Optionally, the virtual machine includes a first virtual proxy endpoint unit, and the PCIe device includes a second virtual proxy endpoint unit; The virtual proxy endpoint module, the first virtual proxy endpoint unit, and the second virtual proxy endpoint unit include a sending channel and a receiving channel. The sending channel and the receiving channel constitute an upgrade channel for transmitting upgrade firmware packages, service forwarding, and upgrade process control instructions. The virtual proxy endpoint module also includes a status register, a configuration register, and a control register for synchronizing upgrade status and issuing control commands.
[0013] Optionally, the host upgrade tool module includes a fast emulator server Ethernet socket, which communicates with the virtual machine through a fast emulator client Ethernet socket module based on the transmission control protocol, enabling the host to issue upgrade commands to the virtual machine and transmit data.
[0014] An electronic device includes a processor and a machine-readable storage medium storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the firmware upgrade method described above.
[0015] A machine-readable storage medium storing machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the aforementioned firmware upgrade method.
[0016] Beneficial effects: This invention, through hardware and software collaboration and virtualization technology, migrates the downtime maintenance process required for traditional firmware upgrades to a parallel virtual machine, achieving uninterrupted firmware hot upgrades. Based on hot migration, this invention constructs a digital twin virtual machine equivalent to the PCIe device, ensuring zero service interruption and no packet loss through seamless switching, meeting the high reliability requirements of 24 / 7 operation. Simultaneously, through an independent bare-core proxy system and memory segmentation mechanism, it enables strong isolation between the business system and the upgrade system, effectively improving system reliability and fault tolerance. Furthermore, this invention offloads a large amount of processing logic to the host-side virtual environment, requiring extremely low hardware resources such as the number of cores and storage capacity of the PCIe device. It is well-suited for microcontrollers and lightweight real-time operating systems, possessing broad applicability and strong engineering practical value.
[0017] To make the above-mentioned features and advantages of the invention more apparent and understandable, specific embodiments are described below, and detailed descriptions are provided in conjunction with the accompanying drawings. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the system structure of a firmware upgrade device according to the present invention.
[0019] Figure 2 This is a flowchart of a firmware upgrade method according to the present invention.
[0020] Figure 3 This is a flowchart of step S3 of the present invention.
[0021] Figure 4 This is a flowchart of step S5 of the present invention.
[0022] Figure 5 This is a flowchart of step S6 of the present invention. Detailed Implementation
[0023] To make the objectives and technical solutions of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0024] Figure 1 This is a schematic diagram of the system structure of a firmware upgrade device according to the present invention. Figure 1 As shown, a firmware upgrade device includes: a host 1, a virtual machine 2, and a PCIe device 3. The host 1 is used to initiate firmware upgrade tasks, issue upgrade instructions and firmware data, communicate with the PCIe device 3 through the PCIe bus, and communicate with the virtual machine 2 through an Ethernet socket based on the Transmission Control Protocol (TCP) to realize the scheduling and management of firmware upgrades.
[0025] The host 1 includes a virtual proxy endpoint module 11 and a host upgrade tool module 12. The virtual proxy endpoint module 11 includes a sending channel and a receiving channel, which together constitute an upgrade channel for transmitting upgrade firmware packages, service forwarding, and upgrade process control instructions. The virtual proxy endpoint module 11 also includes a status register, a configuration register, and a control register for synchronizing upgrade status and issuing control commands.
[0026] The virtual machine 2 is a virtual environment built using the Quick Emulator (QEMU), simulating a hardware architecture identical to that of the PCIe device 3. It includes a Quick Emulator client Ethernet socket module 21 and a first System-on-Chip (SOC) processing module 22. The first SOC processing module 22 includes a first communication interface unit 221, a first Real-Time Operating System (RTOS) unit 222, a first proxy unit 223, and a first virtual proxy endpoint unit 224. The virtual machine 2 is used to take over all service processing during the firmware upgrade of the PCIe device 3. After the firmware upgrade is complete, it sends the real-time activity configuration back to the PCIe device 3, and the PCIe device 3 then resumes control of all service processing. The first service processing system unit 222 and the first proxy unit 223 communicate efficiently through shared memory.
[0027] The virtual machine 2 simulates the same hardware architecture as the PCIe device 3, mainly referring to the fact that the virtual machine 2 and the PCIe device 3 adopt an equivalent design in terms of software system and business processing logic. Although the fast simulator itself is a software simulation and differs from the hardware in processing performance, the business processing of the on-chip system on the PCIe device is also a software behavior. Therefore, simulating an architecture equivalent to the PCIe device 3 at the software system and business processing logic level of the virtual machine 2 does not require complete physical equivalence in peripheral hardware and timing characteristics. It is only necessary to ensure that the overall processing latency of the virtual machine 2 and the PCIe device 3 does not exceed the maximum latency threshold of the business.
[0028] The PCIe device 3 is a physical hardware entity, which can be an endpoint device (EP) or a PCIe switch chip.
[0029] The PCIe device 3 includes a PCIe controller module 31 and a second system-on-chip (SoC) processing module 32. The second SoC processing module 32 includes a second communication interface unit 321, a second service processing system unit 322, a second proxy unit 323, and a second virtual proxy endpoint unit 324. The PCIe device 3 is primarily responsible for running normal services and processing actual data. The second SoC processing module 32 communicates with the virtual proxy endpoint module 11 of the host 1 through the PCIe controller module 31 in the PCIe device 3, enabling data transmission from the host 1 to the PCIe device 3.
[0030] Before the firmware upgrade, the software configuration of PCIe device 3 is synchronized to virtual machine 2. After the service is switched to virtual machine 2, PCIe device 3 performs a firmware upgrade and completes the switchover between the old and new firmware. After the upgrade is completed, the latest software configuration is synchronized back from virtual machine 2, and the service processing is taken over again. The second service processing system unit 322 and the second agent unit 323 achieve efficient communication through shared memory.
[0031] Furthermore, the second agent unit 323 can run on the processor core of the second on-chip system processing module 32. That is, in the central processing unit (CPU) of the PCIe device, the CPU has multiple cores, one of which is used to run the second agent unit 323, and the remaining cores or another core is used to run the second service processing system unit 322, so that the second service processing system unit 322 and the second agent unit 323 run as two independent operating systems on different cores.
[0032] The second agent unit 323 serves as the main execution and control unit during the firmware upgrade process of PCIe device 3. It is not affected by the restart of PCIe device 3 and the first service processing system unit 222. It is responsible for forwarding service messages to the first service processing system unit 222 of virtual machine 2 during the restart process of PCIe device 3, as well as synchronizing the software configuration of virtual machine 2 to PCIe device 3 after PCIe device 3 restarts.
[0033] Furthermore, since the virtual machine 2 simulates the same hardware architecture as the PCIe device 3, the first service processing system unit 222 and the first agent unit 223 run as two independent operating systems on different cores, and the service logic of the second on-chip system processing module 32 in the PCIe device 3 is completely consistent with that of the first on-chip system processing module 22 in the virtual machine 2.
[0034] Furthermore, the first virtual proxy endpoint unit 224 and the second virtual proxy endpoint unit 324 are identical to the virtual proxy endpoint module 11, each including a sending channel and a receiving channel. These channels constitute an upgrade channel for transmitting upgrade firmware packages, service forwarding, and upgrade process control instructions. Specifically, the PCIe device 3's operation on the upgrade channel in host 1 involves reading and writing to its internal memory; host 1's operation on the upgrade channel in PCIe device 3 involves reading and writing to the base address register (BAR) space in the second virtual proxy endpoint unit 324; and host 1's reading and writing on the upgrade channel in virtual machine 2 involves Ethernet socket communication. The second communication interface unit 321 in PCIe device 3 is a physical interface, while the first communication interface unit 221 in virtual machine 2 is a virtual interface. Control of the communication interface units in virtual machine 2 and PCIe device 3 can only be taken over by either the proxy unit or the service processing system unit at any given time.
[0035] As an example, the communication interface is a PCIe bus compatible communication interface.
[0036] As an example, the write operation of the upgrade channel includes updating the write pointer of the receive queue to indicate that new data is valid.
[0037] Specifically, the host upgrade tool module 12 includes a fast simulator server Ethernet socket, used to load and verify the new firmware file to be issued, configure virtual machine startup parameters, establish a fast simulator Ethernet socket communication service and start the virtual machine 2 based on the new firmware file, and communicate with the first system-on-chip processing module 22 through the fast simulator client Ethernet socket module 21 based on the transmission control protocol to realize the host 1 to issue upgrade instructions to the virtual machine 2 and transmit data.
[0038] Furthermore, the host upgrade tool module 12 runs in the host upgrade control center, responsible for firmware legality verification, virtual machine parameter configuration, and Ethernet socket communication service management. It drives the entire hot upgrade process through a state machine and has the ability to detect anomalies and automatically roll back, ensuring the atomicity of the upgrade process.
[0039] Furthermore, the structure and function of the first virtual agent endpoint unit 224 in virtual machine 2 are completely identical to those of the second virtual agent endpoint unit 324 in PCIe device 3, and are used to realize upgrade data transmission and state synchronization among host 1, PCIe device 3, and virtual machine 2. The fact that the structure and function of the first virtual agent endpoint unit 224 in virtual machine 2 are completely identical to those of the second virtual agent endpoint unit 324 in PCIe device 3 mainly refers to the fact that the first virtual agent endpoint unit 224 in virtual machine 2 and the second virtual agent endpoint unit 324 in PCIe device 3 adopt an equivalent design in terms of software system and business processing logic.
[0040] Specifically, the virtual machine 2 obtains the virtual machine startup parameters, starts the first business processing system unit 222 and the first agent unit 223 in the virtual machine 2, establishes a connection between the first agent unit 223 in the virtual machine 2 and the second business processing system unit 322 in the PCIe device 3, and the first agent unit 223 in the virtual machine 2 enters the active mode. Furthermore, the first service processing system unit 222 in the virtual machine 2 initiates a configuration synchronization request to the first agent unit 223 in the virtual machine 2. The first agent unit 223 in the virtual machine 2 obtains the current first software configuration synchronization data of the second service processing system unit 322 in the PCIe device 3 through the first communication interface unit 221 in the virtual machine 2 and transmits it back to the first service processing system unit 222 in the virtual machine 2. The first service processing system unit 222 in the virtual machine 2 is synchronized according to the first software configuration synchronization data. If the synchronization is successful, it indicates that the new firmware file is compatible with the PCIe device 3, and the new firmware file is downloaded to the backup firmware storage area of the PCIe device 3.
[0041] Furthermore, after the first service processing system unit 222 in the virtual machine 2 completes synchronization, the host 1 transfers control of the first communication interface unit 221 in the virtual machine 2 to the first service processing system unit 222 in the virtual machine 2. The first service processing system unit 222 in the virtual machine 2 enters active mode and initiates a service switching command to the second service processing system unit 322 in the PCIe device 3.
[0042] Furthermore, the second service processing system unit 322 of the PCIe device 3 transfers control of the second communication interface unit 321 in the PCIe device 3 to the second agent unit 323 of the PCIe device 3 according to the service switching instruction. The second agent unit 323 of the PCIe device 3 enters the active mode and forwards the service packets to the first service processing system unit 222 in the virtual machine 2 for service processing. Further, the second service processing system unit 322 in the PCIe device 3 is restarted and the new firmware file in the backup firmware storage area is loaded for upgrade. After the upgrade is completed, the second service processing system unit 322 in the PCIe device 3 initiates a configuration synchronization request to the second agent unit 323 in the PCIe device 3. The second agent unit 323 in the PCIe device 3 obtains the current second software configuration synchronization data from the first service processing system unit 222 in the virtual machine 2 according to the configuration synchronization request and sends it back to the second service processing system unit 322 in the PCIe device 3, thus completing the software configuration synchronization between the first service processing system unit in the PCIe device 3 and the first service processing system unit 222 in the virtual machine 2.
[0043] Furthermore, the second service processing system unit 322 in the PCIe device 3 initiates a service switching instruction to the second proxy unit 323 in the PCIe device 3, and the second service processing system unit 322 in the PCIe device 3 transfers control of the second communication interface unit 321 to the second service processing system unit 322 in the PCIe device 3 according to the service switching instruction.
[0044] Furthermore, after the second service processing system unit 322 in the PCIe device 3 has processed the service normally, it disconnects from the first service processing system unit 222 in the virtual machine 2.
[0045] The present invention also provides a firmware upgrade method, applied to the firmware upgrade device described above. Figure 2 The flowchart of a firmware upgrade method according to the present invention includes the following steps: Steps S1 to S8: Step S1: Load and verify the new firmware file to be distributed through the host upgrade tool module of the host, configure the virtual machine startup parameters, establish a fast emulator Ethernet socket communication service, and start the virtual machine based on the new firmware file.
[0046] Step S2: Obtain the virtual machine startup parameters, start the business processing system and agent system in the virtual machine, establish a connection between the agent system in the virtual machine and the business processing system in the PCIe device through the upgrade channel, and the agent system in the virtual machine enters the active mode.
[0047] Step S3: The service processing system in the virtual machine initiates a configuration synchronization request to the agent system in the virtual machine. The agent system in the virtual machine obtains the current first software configuration synchronization data of the service processing system in the PCIe device through the communication interface of the upgrade channel in the virtual machine and transmits it back to the service processing system in the virtual machine. The agent system synchronizes the service processing system in the virtual machine according to the first software configuration synchronization data. If the synchronization is successful, it indicates that the new firmware file is compatible with the PCIe device, and the new firmware file is downloaded to the backup firmware storage area of the PCIe device.
[0048] In step S4, after the service processing system in the virtual machine completes synchronization, the host transfers control of the communication interface of the upgrade channel in the virtual machine to the service processing system of the virtual machine. The service processing system in the virtual machine enters active mode and initiates a service switching command to the service processing system of the PCIe device. Meanwhile, the agent system in the virtual machine switches to standby mode after transferring control of the communication interface.
[0049] Step S5: The service processing system of the PCIe device transfers the control of the communication interface of the upgrade channel in the PCIe device to the agent system of the PCIe device according to the service switching instruction. The agent system of the PCIe device enters the active mode and forwards the service packets to the service processing system in the virtual machine for service processing.
[0050] Step S6: Restart the service processing system in the PCIe device and load the new firmware file from the backup firmware storage area for upgrade. After the upgrade, the service processing system in the PCIe device initiates a configuration synchronization request to the agent system in the PCIe device. The agent system in the PCIe device obtains the current second software configuration synchronization data from the service processing system in the virtual machine according to the configuration synchronization request and sends it back to the service processing system in the PCIe device. The agent system then synchronizes the service processing system in the PCIe device according to the second software configuration synchronization data to complete the software configuration synchronization between the service processing system in the PCIe device and the service processing system in the virtual machine. During the restart process, the agent system in the PCIe device enters active mode and forwards service packets to the service processing system in the virtual machine for service processing. That is, the second agent unit is transmitting service packets throughout the entire restart process, ensuring the continuity and configuration consistency of services during the upgrade cycle.
[0051] Step S7: The service processing system in the PCIe device initiates a service switchback command to the agent system in the PCIe device. The agent system in the PCIe device transfers control of the communication interface to the service processing system in the PCIe device according to the service switchback command.
[0052] Specifically, the service processing system in the PCIe device reclaims control of the communication interface of the proxy system in the PCIe device, the proxy system in the PCIe device stops receiving packets and transfers service messages before switching back to standby mode, and the service processing system in the PCIe device switches to active mode.
[0053] Step S8: After the service processing system in the PCIe device processes the service normally, it disconnects from the service processing system in the virtual machine.
[0054] In step S1, the virtual machine startup parameters include the on-chip system base address information of the upgrade channel, the message signal interrupt address of the virtual agent endpoint, the new firmware version path, and other related parameters.
[0055] In step S2, the standby mode is when the program does not start and waits for instructions; the active mode is when it runs normally and is responsible for control, communication, and forwarding.
[0056] Figure 3 The flowchart of step S3 of the present invention is shown. Step S3 includes: steps S31 to S312.
[0057] Step S31: The business processing system in standby mode in the virtual machine initiates a configuration synchronization request to the agent system in the virtual machine; Step S32: The agent system in the virtual machine responds to the configuration synchronization request, generates a first type of configuration request message, and writes the first type of configuration request message into the first base address register space sending queue corresponding to the upgrade channel in the virtual machine, thus completing the sending of the first type of configuration request message; Step S33: Generate a first Message Signaled Interrupt (MSI) message through the agent system in the virtual machine to notify the host that there is data to be processed; Step S34: Obtain and identify the first message signal interruption message through the communication interface in the virtual machine, read the first type of configuration request message from the first base address register space sending queue corresponding to the upgrade channel in the virtual machine, and forward the first type of configuration request message to the host through the Ethernet socket communication connection; Step S35: The host receives the first type of configuration request message through an Ethernet socket communication connection, and writes the first type of configuration request message into the second base address register space receive queue corresponding to the upgrade channel in the PCIe device through the virtual proxy endpoint in the host, thereby completing the request transmission from the host to the PCIe device. Step S36: When the second base address register space receive queue corresponding to the upgrade channel in the PCIe device detects the writing of the first type of configuration request message, the first type of configuration request message is read and parsed. Step S37: Configure a virtual proxy endpoint in the PCIe device, parse the first type of configuration request message through the virtual proxy endpoint of the PCIe device, generate the first software configuration synchronization data of the current service processing system in the PCIe device, encapsulate it into a configuration synchronization data message, and write the configuration synchronization data message into the second base address register space sending queue corresponding to the upgrade channel in the PCIe device, ready to be sent to the virtual machine. Step S38: Send a second message signal interrupt message to the host through the PCIe device to notify the host that the configuration synchronization data message is ready; Step S39: The virtual agent endpoint of the host responds to the second message signal interrupt message, reads the configuration synchronization data message in the second base address register space transmission queue corresponding to the upgrade channel in the PCIe device, and sends the configuration synchronization data message to the virtual machine through the Ethernet socket communication connection; Step S310: The virtual machine receives the configuration synchronization data message through an Ethernet socket communication connection and writes the configuration synchronization data message into the first base address register space receiving queue corresponding to the upgrade channel in the virtual machine, thereby completing the caching of the configuration synchronization data message in the virtual machine; Step S311: The agent system in the virtual machine detects and reads the configuration synchronization data message, and transmits the payload data obtained by parsing the configuration synchronization data message to the business processing system in standby mode in the virtual machine to complete the delivery of configuration synchronization data. Step S312: The service processing system in the virtual machine receives the configuration synchronization data and synchronizes the service processing system in the virtual machine according to the first software configuration synchronization data. Steps S31 to S311 are repeated. If all configuration synchronization data is successfully synchronized, it indicates that the new firmware file is compatible with the PCIe device. The new firmware file is then downloaded to the backup firmware storage area of the PCIe device.
[0058] Specifically, in step S34, when the agent system in the virtual machine generates a first message signal interruption message and prepares to send it to the host through the communication interface, since the virtual machine and the host communicate via an Ethernet socket, the first message signal interruption message cannot be directly transmitted. Therefore, the communication interface in the virtual machine identifies a notification interruption based on the characteristics agreed upon in the first message signal interruption message, namely the message signal interruption address of the virtual agent endpoint, and directly terminates the transmission of the first message signal interruption message. Then, it reads the first type of configuration request message from the first base address register space sending queue corresponding to the upgrade channel in the virtual machine and sends it to the host through the Ethernet socket communication connection between the virtual machine and the host.
[0059] Furthermore, in step S39, the service processing system in the PCIe device directly sends the second message signal interrupt message encapsulated in accordance with the PCIe protocol to the virtual agent endpoint of the host through the communication interface. The virtual agent endpoint of the host responds to this second message signal interrupt message to read the configuration synchronization data message in the second base address register space transmission queue corresponding to the upgrade channel in the PCIe device.
[0060] Furthermore, the agent system in the virtual machine determines whether to configure synchronization data packets in a single batch or in multiple batches based on the amount of data configured for synchronization.
[0061] Furthermore, configuration synchronization refers to the synchronization of software configuration between the business processing system in the virtual machine and the business processing system in the PCIe device. Software configuration includes: software default configuration, configuration dynamically modified by the user, software runtime state, and all other software data that affects system operation. The message carrying the above configuration synchronization data is the configuration synchronization data message. The payload data obtained by parsing the configuration synchronization data message is the above configuration synchronization data. The configuration synchronization data message has specific encapsulation information for transmission between the virtual machine and the PCIe device through the upgrade channel.
[0062] Furthermore, if the virtual machine started with the new firmware file successfully synchronizes with the current software configuration of the service processing system in the PCIe device, it indicates that the new firmware file is compatible with the software configuration of the service processing system in the PCIe device.
[0063] Furthermore, the write operation includes writing data to the corresponding receive queue and updating the write pointer of the receive queue to indicate that the new data is valid and awaits reading and processing.
[0064] Figure 4 The flowchart of step S5 of the present invention is shown. Step S5 includes steps S51 to S59.
[0065] Step S51: After receiving the service switching instruction, the service processing system of the PCIe device transfers the control of the communication interface of the upgrade channel in the PCIe device to the agent system of the PCIe device, and switches the agent system of the PCIe device to active mode; the agent system of the PCIe device receives the first service request message through the communication interface. Step S52: Encapsulate the first service request message into a second type of transmission message and write it into the second base address register space transmission queue corresponding to the upgrade channel in the PCIe device. Step S53: The third message signal interrupt message is sent to the host through the agent system in the PCIe device to notify the host that there is data to be processed, triggering the host to perform a data forwarding operation; Step S54: The host responds to the third message signal interrupt message, reads the second type of transmission message from the second base address register space transmission queue, and forwards the second type of transmission message to the virtual machine through the Ethernet socket communication connection; Step S55: The virtual machine receives the second type of transmission message through the Ethernet socket communication connection and decapsulates it to obtain the first service request message, and then transmits the first service request message to the first base address register space receiving queue corresponding to the upgrade channel in the virtual machine. Step S56: The service processing system in the virtual machine receives the first service request message in the first base address register space queue, processes the first service request message, terminates the first service request message according to service needs, and completes the service processing; or generates the first service response message according to service needs and encapsulates it into a second type of transmission message, forwards the second type of transmission message to the host through an Ethernet socket communication connection, and proceeds to step S57. Step S57: The host receives the second type of transmission message through an Ethernet socket communication connection and writes the second type of transmission message into the second base address register space transmission queue through the virtual proxy endpoint of the host; Step S58: When the agent system of the PCIe device detects that the second type of transmission message is written into the second base address register space receive queue, it reads and parses the second type of transmission message to obtain the first service response message; In step S59, the agent system of the PCIe device sends the received first service response message directly from the communication interface to the service request source.
[0066] Specifically, in step S51, after receiving the service switching instruction, the service processing system of the PCIe device immediately enters the process of switching control of the communication interface of the upgrade channel in the PCIe device. First, it ensures that the software configuration between the service processing system in the virtual machine and the service processing system in the PCIe device is fully synchronized. Second, it ensures that no new service messages are added between the service processing system and the agent system of the PCIe device during the switching process, and that no service messages are being processed in the service processing system of the PCIe device. If the above conditions are met, the service processing system of the PCIe device immediately transfers control of the communication interface of the upgrade channel in the PCIe device to the agent system of the PCIe device, and switches the agent system of the PCIe device to active mode. The agent system of the PCIe device receives the first service request message through the communication interface.
[0067] Specifically, after closing the hardware packet retrieval entry point of the current service processing system, it is confirmed that all service packets already processed in the PCIe device's service processing system have been completed. This ensures that service packets received by the PCIe device during the handover process will not enter the PCIe device's service processing system or agent system for service processing. Within the time window ensuring that all service packets entering the PCIe device's service processing system have been processed and that no service packets received by the PCIe device will enter the PCIe device's service processing system for service processing, service packets sent by the service source are normally received by the communication interface in the PCIe device and temporarily stored in the descriptor queue and buffer pool within the communication interface. The communication interface does not send the temporarily stored service packets to the PCIe device's service processing system for service processing. Only after all service packets entering the PCIe device's service processing system have been processed and control of the communication interface has been transferred to the PCIe device's agent system, are the temporarily stored service packets then sent by the communication interface to the PCIe device's agent system for service processing.
[0068] If the depth of the buffer pool or descriptor queue inside the communication interface approaches a preset threshold during the switching process of communication interface control, or if the silent wait times out, the PCIe device will actively cancel the current switching process of communication interface control, restore the hardware packet receiving and pulling of the service processing system in the PCIe device, and notify the virtual machine to restart the switching process of communication interface control later to avoid packet loss due to overflow of temporarily stored service packets.
[0069] Furthermore, the second type of transmission message is a private protocol message used to transmit original service messages.
[0070] Furthermore, the business message includes: business request message and business response message. The business response message is the processing result obtained by the business processing system from the business request message. After the business processing is completed, the business response message, i.e. the processing result, is returned to the business request source.
[0071] Figure 5 The flowchart of step S6 of the present invention is shown. Step S6 includes: steps S61 to S612.
[0072] Step S61: Restart the service processing system in the PCIe device and load the new firmware file in the backup firmware storage area for upgrade. After the upgrade is completed, initiate a configuration synchronization request to the agent system of the PCIe device in active mode through the service processing system of the PCIe device in standby mode. Step S62: The agent system in the PCIe device responds to the configuration synchronization request, generates a first type configuration request message, and writes the first type configuration request message into the transmission queue of the first base address register space corresponding to the upgrade channel in the PCIe device, thus completing the sending of the first type configuration request message; Step S63: The agent system in the PCIe device sends a fourth message signal interrupt message to the host to notify the host that there is data to be processed and trigger the host to perform a data forwarding operation. Step S64: Obtain and identify the fourth message signal interrupt message through the host, read the first type configuration request message from the first base address register space send queue, and forward the first type configuration request message to the host; Step S65: The host receives a first type of configuration request message and sends the first type of configuration request message to the virtual machine through an Ethernet socket communication connection. The virtual machine receives the first type of configuration request message through an Ethernet socket communication connection and writes the first type of configuration request message into the receive queue of the second base address register space of the upgrade channel in the virtual machine. Step S66: When new data is detected in the virtual machine's receive queue, read and parse the first type of configuration request message; Step S67: The first type of configuration request message is parsed through the virtual agent endpoint unit of the virtual machine to generate the current second software configuration synchronization data of the business processing system in the virtual machine, which is then encapsulated into the corresponding configuration synchronization data message and written into the sending queue of the virtual machine upgrade channel to complete the preparation of the configuration synchronization data message. Step S68: The agent system in the virtual machine generates a fifth message signal interrupt message to notify the host that the configuration synchronization data message is ready; Step S69: Obtain and identify the fifth message signal interrupt message through the communication interface in the virtual machine, read the configuration synchronization data message in the first base address register space sending queue corresponding to the upgrade channel in the virtual machine, and send the configuration synchronization data message to the host through the Ethernet socket communication connection. In step S610, after the host receives the configuration synchronization data packet through the Ethernet socket connection, it sends the configuration synchronization data packet to the PCIe device. Step S611: The configuration synchronization data message is detected and read by the agent system in the PCIe device. After parsing, the payload data is transmitted to the service processing system in the PCIe device to complete the delivery of the configuration synchronization data. In step S612, the service processing system in the PCIe device receives the configuration synchronization data and synchronizes the service processing system in the PCIe device according to the second software configuration synchronization data. Steps S61 to S611 are repeated until all configuration synchronization data is synchronized.
[0073] Furthermore, after the configuration synchronization is completed, step S7 is immediately initiated, where control of the PCIe device communication interface is transferred from the agent system to the service processing system.
[0074] Specifically, the process of switching control of the PCIe device communication interface still requires ensuring that the software configurations of the service processing system in the virtual machine and the service processing system in the PCIe device are fully synchronized. Secondly, it requires ensuring that no new service messages are added between the service processing system and the agent system in the PCIe device during the switchover process, and that no service messages are being processed in the agent system of the PCIe device. If the above conditions are met, the agent system in the PCIe device immediately transfers control of the communication interface of the upgrade channel in the PCIe device to the service processing system in the PCIe device. The agent system in the PCIe device is then switched to standby mode, and the service processing system is switched to active mode. The specific working principle and process are similar to step S51, the difference being the object to which the communication interface control is transferred is different, and will not be elaborated further here. The service processing system of the PCIe device receives the first service request message through the communication interface.
[0075] More specifically, after the agent system starts, it first identifies the shared storage area between the business processing system and the agent system within the PCIe device or virtual machine, and then enters the corresponding execution process according to the startup mode. Furthermore, when the agent system starts in active mode, it extracts startup parameters containing upgrade channel base address register address information and communication interface queue information from the shared storage area, completes communication interface initialization, constructs upgrade channel handshake message and writes it into the upgrade channel sending queue, and simultaneously constructs message signal interrupt message and sends it to the host via the communication interface to initiate handshake connection; after successful handshake, the agent system enters active mode, polls and listens to the communication interface receiving queue and upgrade channel receiving queue, and processes the received service messages according to preset rules.
[0076] Furthermore, when the agent system starts in standby mode, it waits for the business processing system to enter active mode. The business processing system extracts startup parameters from the shared storage area, continuously polls and listens for control information in the shared storage area and processes it, waiting for the host to send a communication interface control switch notification. Upon receiving the communication interface control switch notification, it obtains relevant parameters of the communication interface from the shared storage area, completes the control switch and takeover of the communication interface, and executes the handshake connection establishment process. After the handshake is successful, the agent system enters active mode, polls and listens for the communication interface packet receiving queue and the upgrade channel packet receiving queue, and processes the received business messages according to preset rules.
[0077] Furthermore, the startup and operation method of the business processing system is consistent with the startup and operation method of the agent system.
[0078] Furthermore, the packet receiving processing methods of the proxy system include: The agent system continuously monitors the packet receiving queue of the communication interface and the packet receiving queue of the upgrade channel. When there is a service message in the packet receiving queue of the communication interface, the service message is encapsulated into a custom transmission protocol message and written into the sending queue of the corresponding upgrade channel. A message signal interruption notification message is generated and sent through the communication interface. When a private protocol message is detected in the receive queue of the upgrade channel, the private protocol message is parsed and matched with the corresponding protocol type. It is determined whether the protocol type of the private protocol message is the original service message that needs to be forwarded to the communication interface of the PCIe device. If so, the private protocol message is decapsulated to obtain the original message and sent through the communication interface of the upgrade channel in the PCIe device. If not, the message is terminated or a corresponding protocol response message is generated according to the provisions of the custom transmission protocol and written into the send queue of the upgrade channel. A message signal interruption notification message is generated and sent through the communication interface.
[0079] Furthermore, the packet receiving method of the business processing system is that the business processing system simultaneously listens to the packet receiving queue of the communication interface and the packet receiving queue of the upgrade channel, processes the general communication protocol business messages in the packet receiving queue of the communication interface, terminates the messages or generates corresponding business response messages according to the protocol requirements, and completes the sending through the communication interface. The system parses and matches the private protocol messages in the upgrade channel's receiving queue with their protocol types. It then terminates the messages or generates corresponding protocol response messages according to the rules. The protocol response messages are written into the upgrade channel's sending queue, and a message signal interruption notification message is generated and sent out through the communication interface.
[0080] The custom transmission protocol is a proprietary communication protocol used for data transmission in the upgrade channel, including but not limited to the encapsulation and transmission of original messages and configuration synchronization messages; the startup mode is set by the bootloader according to the current upgrade stage of the system.
[0081] The present invention also provides an electronic device, comprising: a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions executable by the processor, the processor executing the machine-executable instructions to implement the firmware upgrade method as described above.
[0082] The present invention also provides a machine-readable storage medium storing machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the firmware upgrade method described above.
[0083] This invention utilizes hardware-software collaboration and virtualization technology to migrate the downtime maintenance process required for traditional firmware upgrades to a parallel virtual machine, achieving uninterrupted firmware hot upgrades. Based on hot migration, this invention constructs a digital twin virtual machine equivalent to the PCIe device, ensuring zero service interruption and no packet loss through seamless switching, meeting the high-reliability application requirements for 24 / 7 operation. Simultaneously, through an independent bare-core proxy system and memory segmentation mechanism, it enables strong isolation between the business system and the upgrade system, effectively improving system reliability and fault tolerance. Furthermore, this invention offloads a large amount of processing logic to the host-side virtual environment, requiring extremely low hardware resources such as the number of cores and storage capacity of the PCIe device. It is well-suited for microcontrollers and lightweight real-time operating systems, possessing broad applicability and strong engineering practical value.
[0084] Although the present invention has been disclosed above by way of embodiments, it is not intended to limit the present invention. Anyone skilled in the art can make some modifications and refinements without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention shall be determined by the appended claims.
Claims
1. A firmware upgrade method, characterized in that, include: Step S1: Load and verify the new firmware file to be distributed using the host's upgrade tool program; Configure the virtual machine startup parameters, establish a fast emulator Ethernet socket communication service, and start the virtual machine based on the new firmware file; Step S2: Obtain the virtual machine startup parameters, start the business processing system and agent system in the virtual machine, establish a connection between the agent system in the virtual machine and the business processing system in the PCIe device through the upgrade channel, and the agent system in the virtual machine enters the active mode. Step S3: The business processing system in the virtual machine initiates a configuration synchronization request to the agent system in the virtual machine. The agent system in the virtual machine obtains the current first software configuration synchronization data of the business processing system in the PCIe device through the communication interface of the upgrade channel in the virtual machine and transmits it back to the business processing system in the virtual machine. The agent system synchronizes the business processing system in the virtual machine according to the first software configuration synchronization data. If the synchronization is successful, the new firmware file is downloaded to the backup firmware storage area of the PCIe device. Step S4: After the service processing system in the virtual machine completes synchronization, the host transfers control of the communication interface of the upgrade channel in the virtual machine to the service processing system in the virtual machine. The service processing system in the virtual machine enters active mode and initiates a service switching command to the service processing system of the PCIe device. Step S5: The service processing system of the PCIe device transfers the control of the communication interface of the upgrade channel in the PCIe device to the agent system of the PCIe device according to the service switching instruction. The agent system of the PCIe device enters the active mode and forwards the service packets to the service processing system in the virtual machine for service processing. Step S6: Restart the service processing system in the PCIe device and load the new firmware file in the backup firmware storage area for upgrade. After the upgrade is completed, the service processing system in the PCIe device initiates a configuration synchronization request to the agent system in the PCIe device. The agent system in the PCIe device obtains the current second software configuration synchronization data from the service processing system in the virtual machine according to the configuration synchronization request and sends it back to the service processing system in the PCIe device. The agent system in the PCIe device is synchronized according to the second software configuration synchronization data to complete the software configuration synchronization between the service processing system in the PCIe device and the service processing system in the virtual machine. Step S7: The service processing system in the PCIe device initiates a service switchback command to the agent system in the PCIe device, and the agent system in the PCIe device transfers control of the communication interface to the service processing system in the PCIe device according to the service switchback command. Step S8: After the service processing system in the PCIe device processes the service normally, it disconnects from the service processing system in the virtual machine.
2. The firmware upgrade method as described in claim 1, characterized in that, Step S3 includes: Step S31: The business processing system in standby mode in the virtual machine initiates a configuration synchronization request to the agent system in the virtual machine; Step S32: The agent system in the virtual machine responds to the configuration synchronization request, generates a first type of configuration request message, and writes the first type of configuration request message into the first base address register space sending queue corresponding to the upgrade channel in the virtual machine, thus completing the sending of the first type of configuration request message; Step S33: Generate a first message signal interrupt message through the agent system in the virtual machine to notify the host that there is data to be processed; Step S34: Obtain and identify the first message signal interruption message through the communication interface in the virtual machine, read the first type of configuration request message from the first base address register space sending queue corresponding to the upgrade channel in the virtual machine, and forward the first type of configuration request message to the host through the Ethernet socket communication connection; Step S35: The host receives the first type of configuration request message through an Ethernet socket communication connection, and writes the first type of configuration request message into the second base address register space receive queue corresponding to the upgrade channel in the PCIe device through the virtual proxy endpoint in the host, thereby completing the request transmission from the host to the PCIe device. Step S36: When the second base address register space receive queue corresponding to the upgrade channel in the PCIe device detects the writing of the first type of configuration request message, the first type of configuration request message is read and parsed. Step S37: Configure a virtual proxy endpoint in the PCIe device, parse the first type of configuration request message through the virtual proxy endpoint of the PCIe device, generate the first software configuration synchronization data of the current service processing system in the PCIe device, encapsulate it into a configuration synchronization data message, and write the configuration synchronization data message into the second base address register space sending queue corresponding to the upgrade channel in the PCIe device, ready to be sent to the virtual machine. Step S38: Send a second message signal interrupt message to the host through the PCIe device to notify the host that the configuration synchronization data message is ready; Step S39: The virtual agent endpoint of the host responds to the second message signal interrupt message, reads the configuration synchronization data message in the second base address register space transmission queue corresponding to the upgrade channel in the PCIe device, and sends the configuration synchronization data message to the virtual machine through the Ethernet socket communication connection; Step S310: The virtual machine receives the configuration synchronization data message through an Ethernet socket communication connection and writes the configuration synchronization data message into the first base address register space receiving queue corresponding to the upgrade channel in the virtual machine, thereby completing the caching of the configuration synchronization data message in the virtual machine; Step S311: The agent system in the virtual machine detects and reads the configuration synchronization data message, and transmits the payload data obtained by parsing the configuration synchronization data message to the business processing system in standby mode in the virtual machine to complete the delivery of configuration synchronization data. In step S312, the service processing system in the virtual machine receives the configuration synchronization data and synchronizes the service processing system in the virtual machine according to the first software configuration synchronization data. Steps S31 to S311 are repeated. If all configuration synchronization data is successfully synchronized, the new firmware file is downloaded to the backup firmware storage area of the PCIe device.
3. The firmware upgrade method as described in claim 2, characterized in that, Step S5 includes: Step S51: After receiving the service switching instruction, the service processing system of the PCIe device transfers the control of the communication interface of the upgrade channel in the PCIe device to the agent system of the PCIe device, and switches the agent system of the PCIe device to active mode; the agent system of the PCIe device receives the first service request message through the communication interface. Step S52: Encapsulate the first service request message into a second type of transmission message and write it into the second base address register space transmission queue corresponding to the upgrade channel in the PCIe device. Step S53: The third message signal interrupt message is sent to the host through the agent system in the PCIe device to notify the host that there is data to be processed, triggering the host to perform a data forwarding operation; Step S54: The host responds to the third message signal interrupt message, reads the second type of transmission message from the second base address register space transmission queue, and forwards the second type of transmission message to the virtual machine through the Ethernet socket communication connection; Step S55: The virtual machine receives the second type of transmission message through the Ethernet socket communication connection and decapsulates it to obtain the first service request message, and then transmits the first service request message to the first base address register space receiving queue corresponding to the upgrade channel in the virtual machine. Step S56: The service processing system in the virtual machine receives the first service request message in the first base address register space queue, processes the first service request message, terminates the first service request message according to service needs, and completes the service processing; or generates a first service response message according to service needs and encapsulates it into a second type of transmission message, forwards the second type of transmission message to the host through an Ethernet socket communication connection, and proceeds to step S57. Step S57: The host receives the second type of transmission message through an Ethernet socket communication connection and writes the second type of transmission message into the second base address register space transmission queue through the virtual proxy endpoint of the host; Step S58: When the agent system in the PCIe device detects that the second type of transmission message is written into the second base address register space receive queue, it reads and parses the second type of transmission message to obtain the first service response message; In step S59, the agent system of the PCIe device sends the received first service response message directly from the communication interface to the service request source.
4. The firmware upgrade method as described in claim 3, characterized in that, Also includes: After the agent system starts, it identifies the shared storage area of the business processing system and the agent system within the PCIe device or virtual machine it is located in, and enters the corresponding execution process according to the startup mode. When the agent system starts in active mode, it extracts startup parameters containing upgrade channel base address register address information and communication interface queue information from the shared storage area, completes communication interface initialization, constructs upgrade channel handshake message and writes it into the upgrade channel sending queue, and simultaneously constructs message signal interrupt message and sends it to the host via the communication interface to initiate handshake connection. After successful handshake, the agent system enters active mode, polls and listens to the communication interface receiving queue and the upgrade channel receiving queue, and processes the received service messages according to preset rules. When the agent system starts in standby mode, it waits for the business processing system to enter active mode. The business processing system extracts startup parameters from the shared storage area, continuously polls and listens for control information in the shared storage area and processes it, and waits for the host to send a communication interface control switch notification. When the communication interface control switch notification is received, the relevant parameters of the communication interface are obtained from the shared storage area, the control switch and takeover of the communication interface are completed, and the handshake connection establishment process is executed. After a successful handshake, the agent system enters active mode, polls and listens to the packet receiving queue of the communication interface and the packet receiving queue of the upgrade channel, and processes the received business messages according to preset rules. The startup and operation method of the business processing system is the same as that of the agent system.
5. A firmware upgrade method as described in claim 4, characterized in that, Also includes: The agent system continuously monitors the packet receiving queue of the communication interface and the packet receiving queue of the upgrade channel. When there is a service message in the packet receiving queue of the communication interface, the service message is encapsulated into a custom transmission protocol message and written into the sending queue of the corresponding upgrade channel. A message signal interruption notification message is generated and sent through the communication interface. When a private protocol message is detected in the receive queue of the upgrade channel, the private protocol message is parsed and matched with the corresponding protocol type. It is then determined whether the protocol type of the private protocol message is the original service message that needs to be forwarded to the communication interface of the PCIe device. If so, the private protocol message is decapsulated to obtain the original message and sent through the communication interface of the upgrade channel in the PCIe device. If not, the message is terminated or a corresponding protocol response message is generated according to the provisions of the custom transmission protocol, and the protocol response message is written into the send queue of the upgrade channel. The generated message signal interruption notification message is sent through the communication interface.
6. A firmware upgrade device, characterized in that, include: The host includes a virtual proxy endpoint module and a host upgrade tool module; The host communicates with PCIe devices via the PCIe bus and with virtual machines via Ethernet sockets based on the Transmission Control Protocol. The host upgrade tool module loads and verifies the new firmware file to be distributed; configures the virtual machine startup parameters, establishes a fast emulator Ethernet socket communication service, and starts the virtual machine based on the new firmware file; The virtual machine is a virtual environment built by a fast emulator that simulates the same hardware architecture as the PCIe device; The virtual machine is used to obtain the virtual machine startup parameters, start the first business processing system unit and the first agent unit in the virtual machine, establish a connection between the first agent unit in the virtual machine and the second business processing system unit in the PCIe device, and the first agent unit in the virtual machine enters the active mode. The first service processing system unit in the virtual machine initiates a configuration synchronization request to the first agent unit in the virtual machine. The first agent unit in the virtual machine obtains the current first software configuration synchronization data of the second service processing system unit in the PCIe device through the first communication interface unit in the virtual machine and transmits it back to the first service processing system unit in the virtual machine. The first service processing system unit in the virtual machine is synchronized according to the first software configuration synchronization data. If the synchronization is successful, the new firmware file is downloaded to the backup firmware storage area of the PCIe device. After the first service processing system unit in the virtual machine completes synchronization, the host transfers control of the first communication interface unit in the virtual machine to the first service processing system unit in the virtual machine. The first service processing system unit in the virtual machine enters active mode and initiates a service switching command to the second service processing system unit in the PCIe device. The PCIe device includes at least two independent central processing unit cores, which respectively run a second agent unit and a second service processing system unit. The second service processing system unit of the PCIe device transfers control of the second communication interface unit in the PCIe device to the second agent unit of the PCIe device according to the service switching instruction. The second agent unit of the PCIe device enters an active mode and forwards service packets to the first service processing system unit in the virtual machine for service processing. The second service processing system unit in the PCIe device is restarted and the new firmware file in the backup firmware storage area is loaded for upgrade. After the upgrade is completed, the second service processing system unit in the PCIe device initiates a configuration synchronization request to the second agent unit in the PCIe device. The second agent unit in the PCIe device obtains the current second software configuration synchronization data from the first service processing system unit in the virtual machine according to the configuration synchronization request and sends it back to the second service processing system unit in the PCIe device, thus completing the software configuration synchronization between the second service processing system unit in the PCIe device and the first service processing system unit in the virtual machine. The second service processing system unit in the PCIe device initiates a service switchback command to the second agent unit in the PCIe device, and the second agent unit in the PCIe device transfers control of the second communication interface unit to the second service processing system unit in the PCIe device according to the service switchback command. After the second service processing system unit in the PCIe device processes the service normally, it disconnects from the first service processing system unit in the virtual machine.
7. A firmware upgrade device as described in claim 6, characterized in that, The virtual machine includes a first virtual proxy endpoint unit, and the PCIe device includes a second virtual proxy endpoint unit; The virtual proxy endpoint module, the first virtual proxy endpoint unit, and the second virtual proxy endpoint unit include a sending channel and a receiving channel. The sending channel and the receiving channel constitute an upgrade channel for transmitting upgrade firmware packages, service forwarding, and upgrade process control instructions. The virtual proxy endpoint module also includes a status register, a configuration register, and a control register for synchronizing upgrade status and issuing control commands.
8. A firmware upgrade device as described in claim 7, characterized in that, The host upgrade tool module includes a fast emulator server Ethernet socket, which communicates with the virtual machine through a fast emulator client Ethernet socket module based on the transmission control protocol, enabling the host to issue upgrade commands to the virtual machine and transmit data.
9. An electronic device, characterized in that, include: A processor and a machine-readable storage medium storing machine-executable instructions that can be executed by the processor to implement the firmware upgrade method according to any one of claims 1-5.
10. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the firmware upgrade method according to any one of claims 1-5.
Citation Information
Patent Citations
State-preserving upgrade of an intelligent server adapter
US20200201624A1
Zero packet loss upgrade of an IO device
US20210216305A1