A method for implementing the MCTP protocol based on FPGA
By simulating a computer hardware environment on an FPGA chip, running a real-time operating system and the MCTP protocol stack, and combining an ARM soft core and FreeRTOS, the problems of portability and low development efficiency when implementing the MCTP protocol on an FPGA are solved, and efficient fault location and debugging are achieved.
Patent Information
- Application Number
- CN202310789156.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-06-30
AI Technical Summary
When implementing the MCTP protocol on existing FPGAs, there are problems such as poor code portability, low development efficiency, and insufficient fault location and analysis methods.
The system simulates a computer hardware environment on an FPGA chip, runs a real-time operating system, provides an MCTP protocol stack and control unit, and realizes the parsing and sending of MCTP messages through a shared storage unit and hardware communication interface. It utilizes an ARM soft core and FreeRTOS operating system to improve code portability and development efficiency, and integrates UART IP to improve debugging efficiency.
It improves the portability of the MCTP protocol, simplifies cross-vendor platform switching, enhances development efficiency and fault location analysis capabilities, and improves the convenience and efficiency of software debugging.
Smart Images

Figure CN116521603B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer technology, specifically relating to a method for implementing the MCTP protocol based on FPGA. Background Technology
[0002] In recent years, various functional boards have been widely used in servers, including memory cards, GPU cards, and DPU cards. Ensuring stable and efficient management in conjunction with servers is an important function that these boards should possess.
[0003] MCTP (Management Component Transport Protocol) is a media-independent protocol used for communication between intelligent devices within a platform management subsystem of a managed computer system. MCTP is independent of the underlying physical bus, acting as a bus-independent "data link layer" protocol. It treats the transport layer messages below it as its own protocol's transport layer messages. MCTP is widely used on function boards, effectively supporting server management of these boards. Many function boards use an FPGA (Field Programmable Gate Array) chip as their main chip. FPGAs are programmable logic chips, increasingly used in electronics due to their customizable design, low cost, and short development cycles. Currently, FPGAs are widely used programmable devices on the market. Implementing the MCTP protocol primarily involves FPGA hardware logic programming to receive, parse, encapsulate, and send MCTP protocol messages. Specifically... Figure 1 As shown.
[0004] However, implementing the MCTP protocol through FPGA hardware logic programming has the following drawbacks: poor code portability, FPGA programs generally lack universality, and when switching to another company's FPGA platform, the FPGA program needs to be redeveloped; low development efficiency when supporting new features; and limited means of troubleshooting when faults occur, as hardware programming can only debug by returning error codes and turning on LEDs, making it difficult to return detailed fault information.
[0005] Therefore, providing a method for implementing the MCTP protocol based on FPGA to improve code portability, development efficiency, and add location analysis methods when faults occur is an urgent problem to be solved. Summary of the Invention
[0006] This invention provides a method for implementing the MCTP protocol based on an FPGA, which runs on an FPGA chip. The specific technical solution includes: Simulate a computer hardware environment on an FPGA chip, and run a real-time operating system on the computer hardware environment; Provide an MCTP protocol stack, enabling the MCTP protocol stack to run in a real-time operating system, for parsing and / or forming MCTP messages; Provide an MCTP control unit, which runs in a real-time operating system, to control the sending and receiving of MCTP messages according to the protocols in the MCTP protocol stack; A shared storage unit is provided to cache the information to be sent under the control of the MCTP control unit; A hardware communication interface is provided to provide a hardware path for sending and receiving MCTP messages under the control of the MCTP control unit.
[0007] In one specific embodiment of the present invention, the computer hardware environment provides: A central processing unit (CPU) is used to run a real-time operating system; A cache unit is used to cache information needed by processes processed by the central processing unit within a preset time. A storage unit used to store information required for the operation of a real-time operating system; An interrupt handling unit is used to handle external interrupt signals; A timer unit is used to provide the central processing unit with the timing signals required for process switching; and A universal asynchronous transceiver unit is used to send and receive debugging control information and generate interrupt signals with external debugging equipment.
[0008] In one specific embodiment of the present invention, the central processing unit includes an ARM soft core.
[0009] In one specific embodiment of the present invention, the real-time operating system includes FreeRTOS, μC / OS-II, embOS, or salvo.
[0010] In one specific embodiment of the present invention, the MCTP control unit provides: A shared storage read module is used to read shared storage units to obtain the information to be sent; A hardware transceiver module is used to receive MCTP request messages and send MCTP messages generated by the MCTP protocol stack.
[0011] In one specific embodiment of the present invention, the hardware communication interface includes an SMBUS protocol interface or a PCIe VDM interface.
[0012] In one specific embodiment of the present invention, the shared storage unit includes a shared memory block.
[0013] In one specific embodiment of the present invention, the MCTP protocol stack is mainly implemented in C language.
[0014] In one specific embodiment of the present invention, the shared storage read module is encapsulated as an application programming interface; and / or The hardware transceiver module is encapsulated into an application programming interface.
[0015] In one specific embodiment of the present invention, the following steps are also included: Step S1: The MCTP protocol stack polls the hardware communication interface through the MCTP control unit until it obtains an MCTP request message; Step S2: The MCTP protocol stack parses the MCTP request message and reads the shared storage unit through the MCTP control unit according to the content of the MCTP request message to obtain the information to be sent; Step S3: The MCTP protocol stack encapsulates the read information into an MCTP message; Step S4: The MCTP protocol stack sends MCTP messages through the hardware communication interface controlled by the MCTP control unit.
[0016] Compared with the prior art, the present invention can bring the following beneficial effects: 1. Improved portability of MCTP. When switching between FPGA platforms from different vendors, only the part of the FPGA emulation computer hardware environment needs to be modified. The rest can be implemented in a common language and is independent of the underlying hardware, so it can be directly reused.
[0017] 2. Easier support for new features. Because a general-purpose operating system runs on the computer hardware environment, the rich resources and APIs provided by the operating system can be called upon when supporting new features, improving development efficiency. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0019] Figure 1 This is a schematic diagram illustrating information exchange between the server and the FPGA via the MCTP protocol. Figure 2 This is a block diagram illustrating the module composition of a method for implementing the MCTP protocol based on FPGA according to the present invention. Figure 3 This is a hardware block diagram of MCTP management implemented based on FPGA in an embodiment of the present invention; Figure 4 This is a flowchart illustrating the sending and receiving of MCTP messages in an embodiment of the present invention; Figure 5 This is a software block diagram of MCTP management based on FPGA in an embodiment of the present invention. Detailed Implementation
[0020] The various aspects of the present invention will be further described in detail below.
[0021] Unless otherwise defined or stated, all technical and scientific terms used herein have the same meaning as are familiar to those skilled in the art. Furthermore, any methods and materials similar to or equivalent to those described herein may be used in the methods of this invention.
[0022] The following explains the terminology.
[0023] Unless otherwise expressly specified and limited, the term "or" as used in this invention includes the relationship of "and". "And" is equivalent to the Boolean logic operator "AND", and "or" is equivalent to the Boolean logic operator "OR", with "AND" being a subset of "OR".
[0024] It is understood that although the terms "first," "second," etc., may be used herein to describe different elements, these elements should not be limited by these terms. These terms are merely used to distinguish one element from another. Therefore, a first element may be referred to as a second element without departing from the teachings of the inventive concept.
[0025] In this invention, the terms "containing," "comprising," or "including" indicate that various ingredients may be used together in the mixtures or compositions of this invention. Therefore, the term "consistent primarily of..." is included in the terms "containing," "comprising," or "including."
[0026] Unless otherwise expressly specified and limited, the terms "connected," "linked," and "connected" in this invention should be interpreted broadly. For example, they can refer to a fixed connection, a connection through an intermediary, or a connection within two elements or an interaction between two elements. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.
[0027] For example, if an element (or component) is referred to as being on, coupled to, or connected to another element, then the element may be directly formed on, coupled to, or connected to the other element, or there may be one or more intermediate elements between them. Conversely, if the expressions "directly on," "directly coupled to," and "directly connected to" are used herein, then it indicates that there is no intermediate element. Other terms used to describe relationships between elements should be interpreted similarly, such as "between" and "directly between," "attached" and "directly attached," "adjacent" and "directly adjacent," etc.
[0028] Additionally, it should be noted that the terms "front," "rear," "left," "right," "up," and "down" used in the following description refer to directions in the accompanying drawings. The terms "inner" and "outer" refer to directions toward or away from the geometric center of a particular component, respectively. It is understood that these terms are used here to describe the relationship of one element, layer, or region relative to another element, layer, or region, as shown in the accompanying drawings. These terms should also encompass other orientations of the device in addition to those described in the accompanying drawings.
[0029] Other aspects of the invention will be apparent to those skilled in the art from the disclosure herein.
[0030] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the specific implementation methods of the present invention will be described below with reference to the accompanying drawings. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings and other implementation methods can be obtained based on these drawings without any creative effort.
[0031] It should also be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. The drawings only show components related to this application and are not drawn according to the actual number, shape, and size of the components in the actual implementation. In the actual implementation, the form, quantity, and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex. For example, the thickness of the elements in the drawings may be exaggerated for clarity.
[0032] Figure 2 The diagram shown is a block diagram of the method of the present invention. The present invention provides a method for implementing the MCTP protocol based on FPGA, which runs on an FPGA chip 10. A computer hardware environment is simulated on the FPGA chip 10, and a real-time operating system 1000 runs on the computer hardware environment.
[0033] An MCTP protocol stack 1100 is provided, which runs in a real-time operating system 1000 to parse or form MCTP messages. In a preferred embodiment, the MCTP protocol stack 1100 can simultaneously parse and form MCTP messages.
[0034] An MCTP control unit 1001 is provided, which runs in a real-time operating system 1000, and is used to control the sending and receiving of MCTP messages according to the protocol in the MCTP protocol stack 1100.
[0035] A shared storage unit 110 is provided to cache information to be sent under the control of the MCTP control unit 1001.
[0036] A hardware communication interface 1002 is provided to provide a hardware path for sending and receiving MCTP messages under the control of the MCTP control unit 1001.
[0037] In one specific embodiment of the present invention, the computer hardware environment provides: A central processing unit (CPU) is used to run a real-time operating system; A cache unit is used to cache information needed by processes processed by the central processing unit within a preset time. A storage unit used to store information required for the operation of a real-time operating system; An interrupt handling unit is used to handle external interrupt signals; A timer unit is used to provide the central processing unit with the timing signals required for process switching; and A universal asynchronous transceiver unit is used to send and receive debugging control information and generate interrupt signals with external debugging equipment.
[0038] In one specific embodiment of the present invention, the central processing unit may include an ARM soft core.
[0039] By simulating an ARM soft core using an FPGA, and executing the ARM processor instruction set through the FPGA's circuitry, the FPGA can be used as an ARM microcontroller to run a general-purpose operating system.
[0040] Figure 3 The diagram shown is a hardware block diagram of the MCTP protocol implemented based on FPGA in an embodiment of the present invention. Figure 3As shown, the ARM soft core 100 requires some necessary external environment to support its operation. Preferably, a cache unit 101 can be set up to cache data recently processed by the central processing unit. The scheduling of the cache unit 101 is not the focus of this application, so the details of cache scheduling will not be elaborated here. Preferably, a storage unit (Random Access) can also be set up. Memory (random access memory) 102 can be understood as the memory in the von Neumann architecture, used to store data needed for the operating system to run, and may also include data needed by other running programs. Memory scheduling is not the focus of this application, so the details of memory scheduling will not be elaborated here. Preferably, an interrupt handling unit 103 can also be set up, which provides the central processing unit with the ability to handle external device requests, further enabling the central processing unit to switch the processing mode of tasks according to the requests of external devices. Preferably, a timer unit 104 can also be set up to time the processes running on the central processing unit to coordinate with the task switching of the central processing unit. Preferably, a universal asynchronous receiver / transmitter (UART) unit 105 can also be set up to facilitate the transfer of data between the system and external devices, thereby realizing program debugging. More preferably, by integrating UART IP, it is convenient to track and view the software running status, improving debugging efficiency.
[0041] In one specific embodiment of the present invention, the real-time operating system may include FreeRTOS, μC / OS-II, embOS, or salvo.
[0042] As a preferred implementation, FreeRTOS (free-arr-toss) is a free and open-source real-time operating system used in embedded systems. It boasts excellent real-time performance, multitasking capabilities, portability, customizability, flexible scheduling strategies, low RAM footprint, low system resource requirements, and support for many different hardware architectures and cross-compilers, making it widely used in embedded systems. Its features include task management, time management, semaphores, message queues, memory management, logging, software timers, and coroutines, which can basically meet the needs of smaller systems. Running FreeRTOS on an ARM soft core allows for the use of rich operating system APIs, making software debugging more convenient and efficient. Because FreeRTOS runs on the ARM soft core, it can utilize the rich resources and APIs provided by the operating system when supporting new features, improving development efficiency.
[0043] In one specific embodiment of the present invention, the MCTP control unit can provide: A shared storage read module is used to read shared storage units to obtain the information to be sent; A hardware transceiver module is used to receive MCTP request messages and send MCTP messages generated by the MCTP protocol stack.
[0044] In one specific embodiment of the present invention, the shared storage reading module can be encapsulated as an application programming interface (API), or the hardware transceiver module can be encapsulated as an API. Preferably, both can be encapsulated as APIs, and the sending and receiving of MCTP messages can be completed by calling both.
[0045] Preferably, the shared storage read module can be encapsulated into an application programming interface (API) called shared memory access API, and the hardware transceiver module can be encapsulated into an application programming interface (API) called hardware transceiver message API. The information interaction between the server and the FPGA chip is realized through the shared memory access API and the hardware transceiver message API.
[0046] The MCTP protocol stack receives MCTP request messages sent by the server through the hardware transceiver API, parses the MCTP request messages to obtain the message content, reads information from shared memory through the shared memory access API based on the message content, encapsulates the read information to generate MCTP messages, and sends the MCTP messages to the server through the hardware transceiver API.
[0047] The shared memory access API is mainly used to read information from shared memory, such as MAC address and temperature; the hardware message receiving API is mainly used to receive and send MCTP messages, which can be sent through the hardware communication interface.
[0048] In one specific embodiment of the present invention, the hardware communication interface includes an SMBUS protocol interface or a PCIe VDM interface.
[0049] In one specific embodiment of the present invention, the shared storage unit includes a shared memory block.
[0050] The MCTP protocol stack and the FPGA chip interact via a shared memory block. For example, the FPGA writes the board temperature information into the shared memory block. When the server sends an MCTP message requesting the board temperature, the MCTP protocol stack receives the message, parses it to obtain its content, reads the temperature information from the shared memory block according to the request (to obtain the board temperature), and then encapsulates the read content into an MCTP message and returns it to the server.
[0051] By acquiring information through shared memory, the differences in underlying hardware become transparent. Regardless of any changes made to the underlying platform or hardware design, as long as the information stored in shared memory by the FPGA is in a negotiated format, upper-layer software can directly call a unified API to retrieve it.
[0052] In one specific embodiment of the present invention, the MCTP protocol stack can be mainly implemented using the C language.
[0053] The MCTP protocol stack, implemented in C and running on FreeRTOS, primarily handles the parsing and encapsulation of MCTP messages. This improves the portability of the MCTP protocol stack; when switching between FPGA platforms from different vendors, only the FPGA's emulated ARM soft core needs modification. Other parts, including FreeRTOS and the MCTP protocol stack, can be implemented in standard C and are independent of the underlying hardware, allowing for direct reuse.
[0054] In one specific embodiment of the present invention, such as Figure 4 The diagram shown is a flowchart of an embodiment of the present invention for sending and receiving MCTP messages, including the following steps: Step S1: The MCTP protocol stack polls the hardware communication interface through the MCTP control unit until it obtains an MCTP request message; Step S2: The MCTP protocol stack parses the MCTP request message and reads the shared storage unit through the MCTP control unit according to the content of the MCTP request message to obtain the information to be sent; Step S3: The MCTP protocol stack encapsulates the read information into an MCTP message; Step S4: The MCTP protocol stack sends MCTP messages through the hardware communication interface controlled by the MCTP control unit.
[0055] Figure 5 This is a software block diagram of MCTP management implemented based on FPGA in an embodiment of the present invention, such as... Figure 5As shown, the MCTP protocol stack 1100 can be run on the FreeRTOS operating system 1000. The system calls the Hardware Transceiver API 1300 to poll the hardware communication interface to detect whether an MCTP request message has been received from the remote server. When the hardware communication interface receives the MCTP request message, it sends the MCTP message into the MCTP protocol stack 1100 for parsing to obtain the request content of the MCTP request message. Then, based on the request content, the system can call the Shared Memory Access API 1200 to obtain the information corresponding to the message request content from the shared memory block, and encapsulate the above information into an MCTP message inside the MCTP protocol stack 1100. Finally, the MCTP message is sent from the hardware communication interface to the remote server that sent the MCTP request message by calling the Hardware Transceiver API 1300.
[0056] In summary, the technical solution of this invention achieves the following effects: 1. FPGA chip emulates ARM soft core. This enables the FPGA chip to run general-purpose software.
[0057] 2. Run FreeRTOS on the ARM soft core. FreeRTOS allows you to call a rich set of operating system APIs, making software debugging more convenient and efficient.
[0058] 3. By acquiring information through shared memory, the differences in underlying hardware become transparent. Regardless of any changes made to the underlying platform or hardware design, upper-layer software can directly call a unified API to complete the functionality.
[0059] 4. A UART interface is reserved for debugging, facilitating software debugging. Compared to other debugging methods, such as LED activation and error code return, integrating UART IP on the ARM soft core can greatly improve debugging efficiency.
[0060] Based on this application, those skilled in the art will understand that one aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number and aspect set forth herein can be used to implement the device and / or practice the method. Additionally, this device and / or practice the method can be implemented using other structures and / or functionalities besides one or more of the aspects set forth herein.
[0061] Those skilled in the art will understand that, besides implementing the system and its various devices, modules, and units provided by this invention in the form of purely computer-readable program code, the same functions can be achieved entirely through logical programming of the method steps, making the system and its various devices, modules, and units of this invention function in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, the system and its various devices, modules, and units provided by this invention can be considered as a hardware component, and the devices, modules, and units included therein for implementing various functions can also be considered as structures within the hardware component; alternatively, the devices, modules, and units for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0062] It should be noted that the above embodiments can be freely combined as needed. The above description is only a preferred embodiment of the present invention. It should be pointed out that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
[0063] All documents mentioned in this invention are incorporated herein by reference as if each document were individually incorporated by reference. Furthermore, it should be understood that after reading the foregoing description of this invention, those skilled in the art can make various alterations or modifications to this invention, and these equivalent forms also fall within the scope defined by the appended claims.
Claims
1. A method for implementing the MCTP protocol based on an FPGA, running on an FPGA chip, characterized in that, A general-purpose computer hardware environment is simulated on the FPGA chip, and a general-purpose real-time operating system runs on the computer hardware environment, the real-time operating system providing a unified application programming interface. Provide an MCTP protocol stack, and run the MCTP protocol stack in the real-time operating system to parse and / or form MCTP messages; An MCTP control unit is provided, which runs in the real-time operating system, to control the sending and receiving of MCTP messages according to the protocols in the MCTP protocol stack; A shared storage unit is provided to cache information to be sent under the control of the MCTP control unit; A hardware communication interface is provided to provide a hardware path for sending and receiving MCTP messages under the control of the MCTP control unit. The MCTP control unit provides: A shared storage reading module is used to read the shared storage unit to obtain the information to be sent; A hardware transceiver module is used to receive MCTP request messages and send MCTP messages formed by the MCTP protocol stack. The shared storage read module is encapsulated into an application programming interface; and / or The hardware transceiver module is encapsulated as an application programming interface.
2. The method for implementing the MCTP protocol based on FPGA according to claim 1, characterized in that, The computer hardware environment provides: A central processing unit for running the real-time operating system; A cache unit is used to cache information required by the processes processed by the central processing unit within a preset time. A storage unit for storing information required for the operation of the real-time operating system; An interrupt handling unit is used to handle external interrupt signals; A timer unit is provided to the central processing unit to provide timing signals required for switching processes; as well as A universal asynchronous transceiver unit is used to send and receive debugging control information and generate interrupt signals with external debugging equipment.
3. The method for implementing the MCTP protocol based on FPGA according to claim 2, characterized in that, The central processing unit includes an ARM soft core.
4. The method for implementing the MCTP protocol based on FPGA according to claim 1, characterized in that, The real-time operating system includes FreeRTOS, μC / OS-II, embOS, or salvo.
5. The method for implementing the MCTP protocol based on FPGA according to claim 1, characterized in that, The hardware communication interface includes an SMBUS protocol interface or a PCIe VDM interface.
6. The method for implementing the MCTP protocol based on FPGA according to claim 1, characterized in that, The shared storage unit includes shared memory blocks.
7. The method for implementing the MCTP protocol based on FPGA according to claim 1, characterized in that, The MCTP protocol stack is mainly implemented in C language.
8. The method for implementing the MCTP protocol based on FPGA according to claim 1, characterized in that, It also includes the following steps: Step S1: The MCTP protocol stack polls the hardware communication interface through the MCTP control unit until an MCTP request message is obtained; Step S2: The MCTP protocol stack parses the MCTP request message and reads the shared storage unit through the MCTP control unit according to the content of the MCTP request message to obtain the information to be sent; Step S3: The MCTP protocol stack encapsulates the read information into an MCTP message; Step S4: The MCTP protocol stack controls the hardware communication interface to send the MCTP message through the MCTP control unit.
Citation Information
Patent Citations
FPGA prototype verification device and method
CN113760748A
