Method, device, equipment and storage medium for allocating server PCIe resources
By using programmable logic devices and switch chips on the server motherboard to build a mapping relationship, it can automatically adapt to various PCIe topologies, solve the problem of extending the development and debugging cycle caused by manually modifying the BIOS code in the existing technology, and improve PCIe resource allocation. efficiency.
Patent Information
- Application Number
- CN202410666956.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-05-28
AI Technical Summary
When existing servers are paired with various PCIe topologies, the BIOS code needs to be modified manually, which prolongs the development and debugging cycle and affects efficiency.
By setting programmable logic devices and switch chips on the server motherboard, a mapping relationship is constructed, and resources are allocated according to the type and topology relationship of PCIe devices to achieve automatic adaptation to multiple PCIe topologies.
There is no need to manually modify the BIOS code, which improves the efficiency of PCIe resource allocation and shortens the product development and debugging cycle.
Smart Images

Figure CN118245231B
Abstract
Description
Technical Field
[0001] The present application relates to the field of server technology, and in particular to a method, device, equipment and storage medium for allocating PCIe resources of a server. Background Art
[0002] Based on system performance and hot-swappable PCIe (peripheral component interconnect express, high-speed serial computer expansion bus standard) device considerations, the server needs to plan in advance the number of PCIe devices that can be connected and the positions of different types of PCIe devices in the entire system, so that PCIe resources can be reserved for the devices in advance. The number of connected PCIe devices and the positions of different types of PCIe devices in the entire system constitute the PCIe topology of the system. Therefore, different PCIe resource allocation data needs to be designed for different PCIe topologies connected to the server.
[0003] Currently, when a motherboard needs to be equipped with several different PCIe topologies, it is necessary to manually modify the BIOS (Basic Input Output System) code to obtain several different BIOS versions for adaptation and re-release the versions, which prolongs the product development and debugging cycle and affects efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide a server PCIe resource allocation method, device, equipment and storage medium that can adapt to resource allocation of multiple PCIe topologies in order to address the above technical problems.
[0005] In a first aspect, an embodiment of the present disclosure provides a PCIe resource allocation method for a server, the method is applied to a basic input and output system of a server motherboard, the motherboard is provided with a programmable logic device and a switch chip, the programmable logic device is connected to the switch chip, and the method includes:
[0006] Obtain the current firmware version of the switch chip from the programmable logic device;
[0007] Acquire current PCIe topology data according to the current firmware version and a pre-created mapping relationship, wherein the mapping relationship includes multiple reference firmware versions pre-configured for the switch chip and PCIe topology data matching each reference firmware version, and the current PCIe topology data includes resource information required by each PCIe device accessing the server and a topology relationship between each PCIe device, wherein the topology relationship between each PCIe device is created according to a device type of each PCIe device;
[0008] Resources are allocated based on the resource information required by each PCIe device and the topological relationship between the PCIe devices.
[0009] In one embodiment, the device types include root ports and PCIe bridges. When the device type is a root port, the topological relationship includes a parent-child topological relationship between the root port and a downstream device of the root port. When the device type is the PCIe bridge, the topological relationship includes a parent-child topological relationship between an upstream device of the PCIe bridge and the PCIe bridge and a parent-child topological relationship between the PCIe bridge and a downstream device of the PCIe bridge.
[0010] In one embodiment, the PCIe resource allocation method of the server further includes:
[0011] Receive a request for adjusting current PCIe topology data;
[0012] Adjust the current PCIe topology data according to the adjustment request;
[0013] Debug the new firmware version based on the adjusted PCIe topology data;
[0014] When debugging is successful, a corresponding relationship between the new firmware version and the adjusted PCIe topology data is created and added to the mapping relationship.
[0015] In one embodiment, the adjustment request includes a request for adding a new PCIe device, the request for adding a new PCIe device at the target PCIe device, the request for adding a new PCIe device carries a topological relationship between the target PCIe device and the new PCIe device and resource information required by the new PCIe device, and adjusting the current PCIe topology data according to the adjustment request includes:
[0016] The topological relationship between the target PCIe device and the new PCIe device and the resource information required by the new PCIe device are added to the current PCIe topology data.
[0017] In one embodiment, the device type includes a root port and a PCIe bridge, and after adjusting the current PCIe topology data according to the adjustment request, the PCIe resource allocation method of the server further includes:
[0018] Saving the adjusted PCIe topology data to a non-volatile random access memory;
[0019] When restarting next time, reading the device type of each PCIe device from the first preset area of the non-volatile random access memory;
[0020] When the device type is a root port, reading resource information required by a downstream device of the root port from the second preset area;
[0021] When the device type is a PCIe bridge, resource information of an upstream device of the PCIe bridge and resource information required by a downstream device of the PCIe bridge are read from a third preset area;
[0022] The adjusted PCIe topology data is reconstructed according to the acquired resource information required by each PCIe device.
[0023] In one embodiment, the PCIe resource allocation method of the server further includes:
[0024] When the current firmware version is switched to a new firmware version, the new firmware version is obtained from the programmable logic device;
[0025] Obtain adjusted PCIe topology data according to the new firmware version and the updated mapping relationship;
[0026] Resources are reallocated according to the adjusted PCIe topology data.
[0027] In one of the embodiments, before receiving the adjustment request for the current PCIe topology data, the PCIe resource allocation method of the server further includes:
[0028] Receive a request to enable a dynamic configuration enable signal, and control the enabling of the dynamic configuration enable signal;
[0029] When restarting next time, the device type of each PCIe device is read from the first preset area of the non-volatile random access memory, including:
[0030] When restarting next time, check the status of the dynamic configuration enable signal;
[0031] When it is detected that the dynamic configuration enable signal is in an on state, the device type of each PCIe device in the first preset area of the non-volatile random access memory is read.
[0032] In one embodiment, obtaining the current firmware version of the switch chip from the programmable logic device includes:
[0033] During the startup process, the corresponding register value is read from the reserved register space of the programmable logic device to obtain the current firmware version of the switch chip.
[0034] In one embodiment, the PCIe resource allocation method of the server further includes:
[0035] When the read register value is abnormal, the corresponding PCIe topology data is obtained from the mapping relationship according to the preset current firmware version.
[0036] In a second aspect, an embodiment of the present disclosure provides a PCIe resource allocation system for a server, the system comprising a programmable logic device and a switch chip disposed on a mainboard, the programmable logic device is connected to the switch chip, and the mainboard is also equipped with a basic input and output system, wherein:
[0037] The basic input and output system is used to obtain the current firmware version of the switch chip from the programmable logic device during the startup process, and obtain the current PCIe topology data according to the current firmware version and a pre-created mapping relationship. The mapping relationship includes multiple reference firmware versions pre-configured for the switch chip and PCIe topology data matching each reference firmware version. The current PCIe topology data includes resource information required by each PCIe device accessing the server and the topological relationship between each PCIe device. The topological relationship between each PCIe device is created according to the device type of each PCIe device, and resources are allocated according to the resource information required by each PCIe device and the topological relationship between each PCIe device.
[0038] In one of the embodiments, the switch chip is further used to write the current firmware version of the switch chip into a reserved register space of the programmable logic device;
[0039] The basic input and output system is used to read the current firmware version from the reserved register space of the programmable logic device.
[0040] In one embodiment, the PCIe resource allocation system of the server further includes a basic input and output system setting interface, wherein:
[0041] The basic input and output system is also used to receive a request for obtaining current PCIe topology data through the basic input and output system setting interface, obtain the current PCIe topology data from the mapping relationship, and import it into the basic input and output system setting interface for display;
[0042] The basic input / output system is further used to receive an adjustment request for the current PCIe topology data through the basic input / output system setting interface, and adjust the current PCIe topology data according to the adjustment request.
[0043] In a third aspect, an embodiment of the present disclosure provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method for allocating server PCIe resources provided in any embodiment of the present disclosure in the first aspect are implemented.
[0044] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for allocating server PCIe resources provided in any embodiment of the present disclosure in the first aspect.
[0045] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the server PCIe resource allocation method provided in any embodiment of the first aspect of the present disclosure.
[0046] The above-mentioned server PCIe resource allocation method, device, equipment and storage medium, since the firmware of the switch chip determines the topological structure of each PCIe device connected to the switch chip, and the topological structure of each PCIe device connected to the switch chip determines the topological structure of each PCIe device connected to the server, therefore, the present application records multiple firmware versions of the switch chip and the PCIe topological data corresponding to each firmware version in the mapping relationship by constructing a mapping relationship, wherein, when creating the mapping relationship, by analyzing the device type of each PCIe device, the topological relationship corresponding to each device type is analyzed, the device type determines the topological relationship, and the topological relationship determines the resource allocation situation, therefore, the present application creates each PCIe topological data based on the association relationship between the device type, the topological relationship and the required resource information, and further creates an association relationship between each firmware version and the PCIe topological data, so that a motherboard can adapt to multiple PCIe topological structures. When a motherboard needs to be matched with several different PCIe topological structures, there is no need to manually modify the BIOS code every time, thereby improving the efficiency of PCIe resource allocation. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A schematic diagram of a flow chart of a method for allocating PCIe resources of a server in one embodiment;
[0048] Figure 2 A schematic diagram of a PCIe topology structure in one embodiment;
[0049] Figure 3 It is a structural schematic diagram of a PCIe resource allocation system of a server in one embodiment;
[0050] Figure 4 A timing diagram of dynamic adjustment of PCIe resources in one embodiment;
[0051] Figure 5 It is a structural block diagram of a PCIe resource allocation device in one embodiment;
[0052] Figure 6FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0054] In the first aspect, Figure 1 As shown, an embodiment of the present disclosure provides a PCIe resource allocation method for a server, the method is applied to a basic input and output system of a server motherboard, the motherboard is provided with a programmable logic device and a switch chip, the programmable logic device is connected to the switch chip, and the PCIe resource allocation method for the server includes the following steps:
[0055] Step S11, obtaining the current firmware version of the switch chip from the programmable logic device.
[0056] Among them, the Basic Input Output System (BIOS) is a set of programs solidified on a ROM chip on the motherboard of the computer. It stores the most important basic input and output programs of the computer, the self-test program after power-on, and the system self-starting program. It can read and write specific information of the system settings from CMOS.
[0057] Programmable logic devices are produced as a general-purpose integrated circuit, and their logic functions are determined by the user's programming of the device. In this application, programmable logic devices may include CPLD (Complex Programmable Logic Device), which is the abbreviation of Complex PLD, a more complex logic element than PLD.
[0058] Switch chips are used to provide expansion or aggregation capabilities and allow more devices to be connected to a PCle port. They act as packet routers, identifying which path a given packet needs to take based on the address or other routing information. They are a PCIe to PCIe bridge.
[0059] The current firmware version refers to the information of the current firmware version of the switch chip. Specifically, the current firmware version can be the identification information of the version, where the identification information of the version can be the name of the version or the version number and other information. In this application, the switch chip can be pre-configured with multiple firmware versions. The current firmware version is one of the pre-configured multiple firmware versions.
[0060] Specifically, during the startup process, the firmware of the switch chip writes the corresponding current firmware version into the register of the programmable logic device to identify the current version of the firmware of the switch chip. The basic input and output system reads the value of the register in the programmable logic device to obtain the current firmware version. Exemplarily, the current firmware version can be represented as version 1, version 2, or version 3, etc.
[0061] Step S12, obtaining current PCIe topology data according to the current firmware version and a pre-created mapping relationship, wherein the mapping relationship includes multiple reference firmware versions pre-configured for the switch chip and PCIe topology data matching each reference firmware version, and the current PCIe topology data includes resource information required by each PCIe device accessing the server and the topological relationship between each PCIe device, wherein the topological relationship between each PCIe device is created according to the device type of each PCIe device.
[0062] The mapping relationship is a mapping relationship between multiple reference firmware versions and multiple PCIe topology structures. Specifically, the mapping relationship is a mapping relationship between version information corresponding to each reference firmware version and PCIe topology data corresponding to each PCIe topology structure. The reference firmware version refers to a pre-configured reference version for matching with the current firmware version.
[0063] The current PCIe topology data refers to the data of the current PCIe topology structure, specifically including the device type, quantity, level, required resource information of each PCIe device in the current PCIe topology structure, and the topological relationship between each PCIe device.
[0064] When creating a mapping relationship, the present application first creates PCIe topology data corresponding to various PCIe structures, and then establishes a mapping relationship between each PCIe topology data and each firmware version of the switch chip. Among them, when creating each PCIe topology data, the device type of each PCIe device in each PCIe topology structure is specifically identified, and the data of each PCIe device is sorted based on the device type. The topological relationship of each PCIe device is created according to the device type, because different device types have different topological relationships with other types of PCIe devices in the topological structure. Therefore, the present application analyzes the topological relationship of each PCIe device based on the device type, and further integrates it with the resource information required by each PCIe device to obtain each PCIe topological data.
[0065] The required resource information refers to the types of resources required and the amount of resources required for each type of resource. The types of resources required may include but are not limited to bus, MMIO (Memory-mapped Input / Output) resources, and IO (Input / Output) resources. The topological relationship refers to the relationship between various PCIe devices in the PCIe topological structure.
[0066] Exemplarily, please refer to the following Table 1, which is a data structure table of mapping relationships in an embodiment.
[0067] Table 1
[0068]
[0069] Table 1 shows the PCIe topology data corresponding to three reference firmware versions, wherein version 1 corresponds to topology structure 1 and the PCIe topology data of topology structure 1. Specifically, the PCIe topology data may also include the type of each PCIe device in topology structure 1.
[0070] In this application, the server expands the PCIe bandwidth by matching the Switch chip. Specifically, the PCIe bandwidth expansion is achieved by configuring the switch chip into multiple PCIe domains (ranges). After the switch chip is configured into multiple PCIe domains, multiple PCIe devices can be connected, thereby forming the topology of the Switch chip. The PCIe resources occupied by the Switch itself will change with the change of the topology of the Switch chip.
[0071] When the topology of the Switch chip changes, the entire PCIe topology will change. And for each Switch chip topology, a corresponding Switch firmware needs to be configured. Therefore, when the PCIe topology changes, the firmware version of the Switch chip also needs to change accordingly. Therefore, this application establishes a mapping relationship between different Switch chip firmware versions and PCIe topology data of different PCIe topologies, so as to enable the same motherboard to adapt to multiple PCIe topologies.
[0072] Step S13: Allocate resources according to the resource information required by each PCIe device and the topological relationship between the PCIe devices.
[0073] The present application reserves resources for each PCIe device according to the maximum amount of resources that can be allocated, the resource information required by each PCIe device, and the topological relationship between each PCIe device.
[0074] In one embodiment, the device types include root ports and PCIe bridges. When the device type is a root port, the topological relationship includes a parent-child topological relationship between the root port and a downstream device of the root port. When the device type is a PCIe bridge, the topological relationship includes a parent-child topological relationship between an upstream device of the PCIe bridge and the PCIe bridge and a parent-child topological relationship between the PCIe bridge and a downstream device of the PCIe bridge.
[0075] In this application, the device type of the PCIe device may specifically include rootport (root port), PCIe bridge and PCIe endpoint (PCIe terminal device).
[0076] Please refer to Figure 2 , Figure 2 FIG. 1 is a schematic diagram of a PCIe topology structure in an embodiment. Figure 2 In the embodiment, the PCIe topology is a tree structure, including three layers, the first layer is the rootport (root port), the rootport is integrated in the CPU, the second layer is the switch chip, and the third layer is the PCIe endpoint (PCIe terminal node). Among them, the device type of the switch chip in the second layer is a PCIe bridge. In other embodiments, the rootport may also include multiple rootports, and the rootport may also be directly connected to other PCIe devices.
[0077] Depend on Figure 2 It can be seen that the rootport and the switch chip have a parent-child topology relationship, where the rootport is the parent node of the switch chip and the switch chip is the child node of the rootport. When allocating resources, the rootport's resources need to be reserved for the switch chip, and the switch chip's resources need to be reserved for its downstream devices.
[0078] In this application, the device type determines the topological relationship. For example, the rootport is located at the first layer of the topological structure, and it has a parent-child topological relationship with the downstream device. The topological relationship determines the resource allocation. For example, the resource allocation between the rootport and its downstream device is that the rootport's resources need to be allocated to its downstream device according to the resource information required by its downstream device.
[0079] like Figure 2 In the example, the switch chip and each PCIe endpoint form a parent-child topology relationship, and each PCIe endpoint forms a brother topology relationship.
[0080] When allocating resources, the amount of resources allocated by the rootport is determined based on the resource information required by each PCIe device in the PCIe topology structure, the level it is in, and the topological relationship with other nodes. Further, resources are allocated to each PCIe device in other layers based on the amount of resources allocated by the rootport.
[0081] In this application, when the PCIe topology changes, the division of the CPU's root port, the reservation of PCIe resources on the rootport and the PCIe resources of the downstream PCIe bridge will also change, causing the allocation of PCIe resources in the entire PCIe topology to change. Therefore, the allocation of PCIe resources is associated with the PCIe topology, the PCIe topology is associated with the topology of the switch chip, and the topology of the switch chip is associated with the firmware version of the switch. Therefore, this application creates a mapping relationship between PCIe topology data and the firmware version of the switch.
[0082] Specifically, the number of root ports in the PCIe topology and the number of downstream PCIe bridges of the root ports determine the entire PCIe topology. Therefore, the present application pre-creates two data structures, one for describing the information of each rootport device in the PCIe topology, and the other for describing the information of each PCIe bridge in the PCIe topology (i.e. Figure 2 The second layer in the PCIe topology structure is constructed in the memory according to the two data structures, and the PCIe topology data corresponding to each PCIe topology structure is constructed according to the PCIe topology data corresponding to each PCIe topology structure.
[0083] Specifically, the mapping relationship may include serial numbers corresponding to each PCIe topology structure and PCIe topology data corresponding to each serial number. The serial numbers here maintain a one-to-one correspondence (correspondence and consistency) with the firmware version information written into the CPLD register.
[0084] Furthermore, the BIOS startup process reads the firmware version information from the CPLD, and then uses the read value as an index to match the corresponding PCIe topology data from the mapping relationship. In the PCIe device enumeration process started by the BIOS, each item of the matched PCIe topology data is parsed one by one, and corresponding configuration and resource reservation are performed for each PCIe device one by one.
[0085] In one of the embodiments, the PCIe resource allocation method of the server may further include:
[0086] Receive a request for adjusting current PCIe topology data;
[0087] Adjust the current PCIe topology data according to the adjustment request;
[0088] Debug the new firmware version based on the adjusted PCIe topology data;
[0089] When debugging is successful, a corresponding relationship between the new firmware version and the adjusted PCIe topology data is created and added to the mapping relationship.
[0090] In this application, when a new firmware version needs to be developed, the current PCIe topology data needs to be adaptively adjusted. Specifically, the developer can input adjustment instructions through the BIOS setup interface, submit an adjustment request to the BIOS through the BIOS setup interface, and the adjustment request carries the PCIe topology structure to be adjusted, such as the current PCIe topology data. The BIOS adjusts the current PCIe topology data accordingly according to the adjustment request.
[0091] Specifically, developers can input an index value through the BIOS setup interface. The index value can be information about the firmware version to be debugged, such as the version number of the current firmware version. The BIOS obtains the corresponding current PCIe topology data from the pre-created mapping relationship based on the index value and imports it into the BIOS setup interface for display. Developers can further perform adjustment operations such as adding nodes to any node through the current PCIe topology data displayed on the BIOS setup interface, thereby triggering an adjustment request. The BIOS adjusts the current PCIe topology data accordingly based on the adjustment request.
[0092] When the new firmware version and the new PCIe topology structure are successfully debugged, a correspondence between the new firmware version and the PCIe topology data corresponding to the new PCIe topology structure can be created, that is, a correspondence between the new firmware version and the adjusted PCIe topology data can be created and added to the mapping relationship.
[0093] Through this implementation mode, during the BIOS development process, if the PCIe topology needs to be adjusted, modification and adaptation can be performed in the BIOS setting interface, so that the PCIe topology structure can be dynamically adjusted during the debugging phase. There is no need to re-modify the BIOS code every time the topology is adjusted, which increases the flexibility of configuration and shortens the product development and debugging cycle.
[0094] In one embodiment, the adjustment request includes a request for adding a new PCIe device, the request for adding a new PCIe device at the target PCIe device, the request for adding a new PCIe device carries a topological relationship between the target PCIe device and the new PCIe device and resource information required by the new PCIe device, and adjusting the current PCIe topology data according to the adjustment request includes:
[0095] The topological relationship between the target PCIe device and the new PCIe device and the resource information required by the new PCIe device are added to the current PCIe topology data.
[0096] Among them, after the PCIe topology structure is successfully imported, a new PCIe device can be added to the target PCIe device, that is, a brother node or a child node can be added. When adding a node, the type of node can be selected, for example, a bridge or a rootport, and the topological relationship between the target PCIe device and the new PCIe device and the resource information required by the new PCIe device are added to the current PCIe topology data.
[0097] Through this implementation, the present application can dynamically adjust the current PCIe topology data during the debugging phase, thereby realizing dynamic adjustment of resource allocation.
[0098] In one embodiment, the device type includes a root port and a PCIe bridge, and after adjusting the current PCIe topology data according to the adjustment request, the PCIe resource allocation method of the server further includes:
[0099] Saving the adjusted PCIe topology data to a non-volatile random access memory;
[0100] When restarting next time, reading the device type of each PCIe device from the first preset area of the non-volatile random access memory;
[0101] When the device type is a root port, reading resource information required by a downstream device of the root port from the second preset area;
[0102] When the device type is a PCIe bridge, resource information of an upstream device of the PCIe bridge and resource information required by a downstream device of the PCIe bridge are read from a third preset area;
[0103] The adjusted PCIe topology data is reconstructed according to the acquired resource information required by each PCIe device.
[0104] During the debugging process of this application, the adjusted PCIe topology data is saved to the NVram (Non-Volatile Random Access Memor) area. When the BIOS is restarted, the adjusted PCIe topology data is read from the specific area of the non-volatile random access memory.
[0105] Specifically, the present application creates corresponding data record tables for the root port and the PCIe bridge, respectively, for recording the relevant information of the two types of PCIe devices, and stores the two data record tables in a designated area in NVRAM, wherein the two data record tables may occupy the same size of space. For example, a first target area is reserved for storing the data record table corresponding to the root port, and a second target area is reserved for storing the data record table corresponding to the PCIe bridge.
[0106] Furthermore, the first byte is divided from the first target area to record the device type of the root port, and the second byte is used to record the resource information required by the downstream device of the root port.
[0107] The first byte from the second target area is divided to store the device type of the PCIe bridge, the second byte is used to store the resource information required by the upstream device of the PCIe bridge, and the third byte is used to store the resource information required by the downstream device of the PCIe bridge.
[0108] The first byte in the first target area and the first byte in the second target area are equivalent to the first preset area in this application. The second byte in the first target area is equivalent to the second preset area in this application. The second byte and the third byte in the second target area are equivalent to the third preset area in this application.
[0109] During parsing, according to the above storage rules, the device type of the root port and the device type of the PCIe bridge are parsed from the first byte in the first target area and the first byte in the second target area respectively. The resource information required by the downstream device of the root port is parsed from the second byte in the first target area. The resource information required by the upstream device of the PCIe bridge and the resource information required by the downstream device are parsed from the second byte and the third byte in the second target area respectively.
[0110] The present application implements parsing of adjusted PCIe topology data from the NVram area during the debugging phase through this implementation.
[0111] In a possible implementation manner, when reserving the first target area and the second target area, the space size may be reserved according to the size of a portion of the adjusted PCIe topology data to save space in the NVRam area.
[0112] In one embodiment, the method further comprises:
[0113] When the current firmware version is switched to a new firmware version, the new firmware version is obtained from the programmable logic device;
[0114] Obtain adjusted PCIe topology data according to the new firmware version and the updated mapping relationship;
[0115] Resources are reallocated according to the adjusted PCIe topology data.
[0116] In this application, when the current firmware version is switched to a new firmware version, the new firmware version can be obtained from the programmable logic device, and the new firmware version is used as the current firmware version to return to the step of obtaining the current PCIe topology data according to the current firmware version and the pre-created mapping relationship.
[0117] Through this implementation, the present application can achieve the situation where multiple switch firmware versions are adapted to one motherboard. There is no need to use separate BOIS versions for maintenance of different firmware versions. Multiple switch firmware versions can be adapted in one BOIS version, and then adapted to multiple PCIe topologies, reducing the cost of version maintenance.
[0118] In one of the embodiments, before receiving the adjustment request for the current PCIe topology data, the PCIe resource allocation method of the server may further include:
[0119] Receive a request to enable a dynamic configuration enable signal, and control the enabling of the dynamic configuration enable signal;
[0120] When the next restart is performed, the device type of each PCIe device is read from the first preset area of the non-volatile random access memory, including:
[0121] When restarting next time, check the status of the dynamic configuration enable signal;
[0122] When it is detected that the dynamic configuration enable signal is in an on state, the device type of each PCIe device in the first preset area of the non-volatile random access memory is read.
[0123] The present application can set the on state of the dynamic configuration enable signal through BIOS setup. Specifically, in BIOS setup, the on state of the dynamic configuration enable signal is set by dynamically configuring the value of the flag: flag_dynamic option, and the option is closed by default.
[0124] Among them, after the current PCIe topology data is adjusted, it is stored in the non-volatile random access memory. When the BIOS is restarted again, the setting status of the flag_dynmaic option will be detected. When it is detected that the setting status of the flag_dynmaic option is on, the device type of each PCIe device in the first preset area of the non-volatile random access memory is read.
[0125] In one embodiment, the above-mentioned obtaining the current firmware version of the switch chip from the programmable logic device includes:
[0126] During the startup process, the corresponding register value is read from the reserved register space of the programmable logic device to obtain the current firmware version of the switch chip.
[0127] A preset size, such as a byte of register space, is reserved in the programmable logic device to store the firmware version of the switch chip. A byte-sized space can be compatible with 256 different versions of switch firmware.
[0128] Specifically, during the startup process, the Switch chip writes different values to the Reg_switch register of the programmable logic device to identify the Switch firmware version. For example, a specific version number identifies the firmware version of the switch chip.
[0129] In one embodiment, the PCIe resource allocation method of the server may further include:
[0130] When the read register value is abnormal, the corresponding PCIe topology data is obtained from the mapping relationship according to the preset firmware version information.
[0131] In the present application, when the value of the reg_switch register obtained during the BIOS startup process is abnormal, the BIOS will specify a preset firmware version information, and obtain the corresponding PCIe topology data based on the preset firmware version information. Exemplarily, the preset firmware version information of the present application can be version number 1, and the PCIe topology data matching it is queried from the mapping relationship according to version number 1.
[0132] The present application implements an exception handling mechanism through this implementation, and when the read register value is abnormal, there is a corresponding handling mechanism.
[0133] In the second aspect, Figure 3As shown, an embodiment of the present disclosure provides a PCIe resource allocation system for a server, the system includes a programmable logic device and a switch chip arranged on a mainboard, the programmable logic device is connected to the switch chip, and the mainboard is also equipped with a basic input and output system, wherein:
[0134] The basic input and output system is used to obtain the current firmware version of the switch chip from the programmable logic device during the startup process, and obtain the current PCIe topology data according to the current firmware version and a pre-created mapping relationship, wherein the mapping relationship includes multiple reference firmware versions pre-configured for the switch chip and PCIe topology data matching each reference firmware version, and the current PCIe topology data includes resource information required by each PCIe device accessing the server and the topological relationship between each PCIe device, wherein the topological relationship between each PCIe device is created according to the device type of each PCIe device, wherein the topological relationship between each PCIe device is created according to the device type of each PCIe device, and resources are allocated according to the resource information required by each PCIe device and the topological relationship between each PCIe device.
[0135] Specifically, the programmable logic device and the switch chip may be connected via an I2C (Inter-Integrated Circuit) bus, and the programmable logic device is connected to the CPU via the I2C bus.
[0136] The data processing steps of each device in the PCIe resource allocation system of the server can refer to the data processing steps of each embodiment of the above-mentioned PCIe resource allocation method for the server, and are not specifically limited here.
[0137] In one of the embodiments, the switch chip is further used to write the current firmware version of the switch chip into a reserved register space of the programmable logic device;
[0138] The basic input and output system is used to read the current firmware version from the reserved register space of the programmable logic device.
[0139] In one embodiment, the PCIe resource allocation system of the server further includes a basic input and output system setting interface, wherein:
[0140] The basic input and output system is also used to receive a request for obtaining current PCIe topology data through the basic input and output system setting interface, obtain the current PCIe topology data from the mapping relationship, and import it into the basic input and output system setting interface for display;
[0141] The basic input / output system is further used to receive an adjustment request for the current PCIe topology data through the basic input / output system setting interface, and adjust the current PCIe topology data according to the adjustment request.
[0142] In this application, the basic input and output system setting interface is the BIOS setting. Developers can enter the version number of the current firmware version in the BIOS setting interface to trigger the above-mentioned current PCIe topology data acquisition instruction. BIOS obtains the corresponding current PCIe topology data from the mapping relationship according to the input current firmware version number and imports it into the BIOS setting interface for display.
[0143] Furthermore, developers can display the current PCIe topology data on the BIOS setup interface and perform adjustment operations such as adding nodes to any node. After receiving the adjustment instruction, the basic input and output system setup interface sends an adjustment request to the BIOS, and the BIOS adjusts the current PCIe topology data according to the adjustment request.
[0144] In one embodiment, the basic input / output system setting interface is further used to receive a trigger instruction for starting a dynamic configuration enable signal, and send a request for starting the dynamic configuration enable signal to the basic input / output system;
[0145] The basic input and output system is further used for controlling the activation of the dynamic configuration enable signal according to an activation request of the dynamic configuration enable signal.
[0146] Please refer to Figure 4 , Figure 4 FIG. 1 is a timing diagram of PCIe resource dynamic adjustment in one embodiment. Figure 4 As shown in the figure, when the switch chip re-divides the domain (range), the topology of the switch chip changes, and the joint debugging of the BIOS and the switch is not completed, there is no corresponding new PCIe topology data and new firmware version in the mapping relationship, and there is no corresponding resource allocation data.
[0147] At this time, you can turn on the dynamic configuration enable signal through the BIOS setup interface, and enter the corresponding index value through the BIOS setup interface. The index value is the firmware version being debugged. When debugging the current firmware version, the index value is the version number of the current firmware version. After entering, the BIOS will read the current PCIe topology data corresponding to the current firmware version from the mapping relationship and import it into the BIOS setup interface.
[0148] Furthermore, the imported current PCIe topology data can be adjusted in the BIOS setup interface, such as adding a new node, and the corresponding resource allocation data will also change accordingly, and the adjusted data and resource allocation data will be saved to the non-volatile random access memory. When the system restarts, the adjusted data in the non-volatile random access memory is read, and the corresponding new PCIe topology data is constructed in the memory.
[0149] After debugging is completed, the new PCIe topology data is printed to the serial port. The BIOS can add the printed new PCIe topology data to the original mapping relationship and compile it into the binary file of the BIOS for direct use during the BIOS operation.
[0150] In one embodiment, Figure 5 As shown, a PCIe resource allocation device for a server is provided. The device is applied to a basic input and output system of a server mainboard. The mainboard is provided with a programmable logic device and a switch chip. The programmable logic device is connected to the switch chip. The device includes:
[0151] A first acquisition module 51 is used to acquire the current firmware version of the switch chip from the programmable logic device;
[0152] A second acquisition module 52 is used to acquire current PCIe topology data according to the current firmware version and a pre-created mapping relationship, wherein the mapping relationship includes multiple reference firmware versions pre-configured for the switch chip and PCIe topology data matching each reference firmware version, and the current PCIe topology data includes resource information required by each PCIe device accessing the server and a topological relationship between each PCIe device, wherein the topological relationship between each PCIe device is created according to the device type of each PCIe device;
[0153] The resource allocation module 53 is used to allocate resources according to the resource information required by each PCIe device and the topological relationship between each PCIe device.
[0154] In one embodiment, the device types include root ports and PCIe bridges. When the device type is a root port, the topological relationship includes a parent-child topological relationship between the root port and a downstream device of the root port. When the device type is the PCIe bridge, the topological relationship includes a parent-child topological relationship between an upstream device of the PCIe bridge and the PCIe bridge and a parent-child topological relationship between the PCIe bridge and a downstream device of the PCIe bridge.
[0155] In one of the embodiments, the PCIe resource allocation device of the server also includes a dynamic configuration module (not shown), which can receive an adjustment request for the current PCIe topology data, adjust the current PCIe topology data according to the adjustment request, debug the new firmware version according to the adjusted PCIe topology data, and when the debugging is successful, create a corresponding relationship between the new firmware version and the adjusted PCIe topology data, and add it to the mapping relationship.
[0156] In one embodiment, the adjustment request includes a request for adding a new PCIe device, the request for adding a new PCIe device at the target PCIe device, the request for adding a new PCIe device carries the topological relationship between the target PCIe device and the new PCIe device and the resource information required for the new PCIe device, and the dynamic configuration module can also add the topological relationship between the target PCIe device and the new PCIe device and the resource information required for the new PCIe device to the current PCIe topology data.
[0157] In one of the embodiments, the device types include root ports and PCIe bridges. The dynamic configuration module can also save the adjusted PCIe topology data to a non-volatile random access memory. During the next restart, the device type of each PCIe device is read from a first preset area of the non-volatile random access memory. When the device type is a root port, the resource information required by the downstream device of the root port is read from a second preset area. When the device type is a PCIe bridge, the resource information of the upstream device of the PCIe bridge and the resource information required by the downstream device of the PCIe bridge are read from a third preset area. The adjusted PCIe topology data is reconstructed based on the acquired resource information required by each PCIe device.
[0158] In one embodiment, the above-mentioned resource allocation module 53 can also obtain a new firmware version from the programmable logic device when the current firmware version is switched to a new firmware version, obtain adjusted PCIe topology data according to the new firmware version and the updated mapping relationship, and reallocate resources according to the adjusted PCIe topology data.
[0159] In one of the embodiments, the dynamic configuration module can also receive a request to enable a dynamic configuration enable signal, control the enabling of the dynamic configuration enable signal, and the dynamic configuration module can also detect the state of the dynamic configuration enable signal during the next restart, and when it is detected that the dynamic configuration enable signal is in the enabled state, read the device type of each PCIe device in the first preset area of the non-volatile random access memory.
[0160] In one embodiment, the first acquisition module 51 may read the corresponding register value from the reserved register space of the programmable logic device during the startup process to obtain the current firmware version of the switch chip.
[0161] In one embodiment, the first acquisition module 51 may also acquire corresponding PCIe topology data from the mapping relationship according to preset firmware version information when the read register value is abnormal.
[0162] In a third aspect, an embodiment of the present disclosure provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method for allocating server PCIe resources provided in any embodiment of the present disclosure in the first aspect are implemented.
[0163] In some embodiments, the computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the PCIe resource allocation method of the server is implemented.
[0164] Those skilled in the art will understand that Figure 6 The structure shown in the figure is merely a block diagram of a partial structure related to the embodiment scheme of the present disclosure, and does not constitute a limitation on the computer device to which the embodiment scheme of the present disclosure is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0165] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for allocating server PCIe resources provided in any embodiment of the present disclosure in the first aspect.
[0166] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, the computer program product including computer instructions, the computer instructions stored in a computer-readable storage medium. A processor of a computing device can read the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computing device performs the steps of the method for allocating server PCIe resources provided in any embodiment of the first aspect above.
[0167] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the above-mentioned computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0168] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0169] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A PCIe resource allocation method for a server, characterized in that: The method is applied to a basic input / output system of a server mainboard, the mainboard is provided with a programmable logic device and a switch chip, the programmable logic device is connected to the switch chip, and the method comprises: Obtaining the current firmware version of the switch chip from the programmable logic device; The current PCIe topology data is obtained according to the current firmware version and the pre-created mapping relationship, wherein the mapping relationship includes multiple reference firmware versions pre-configured for the switch chip and PCIe topology data matching each reference firmware version, and the current PCIe topology data includes resource information required for each PCIe device connected to the server and the topological relationship between each PCIe device, wherein the topological relationship between each PCIe device is created according to the device type of each PCIe device, and the device type includes a root port and a PCIe bridge. When the device type is the root port, the topological relationship includes a parent-child topological relationship between the root port and a downstream device of the root port. When the device type is the PCIe bridge, the topological relationship includes a parent-child topological relationship between an upstream device of the PCIe bridge and the PCIe bridge, and a parent-child topological relationship between the PCIe bridge and a downstream device of the PCIe bridge. Resource allocation is performed according to resource information required by each PCIe device and the topological relationship between each PCIe device.
2. The method according to claim 1, characterized in that The method further comprises: Receiving an adjustment request for the current PCIe topology data; Adjust the current PCIe topology data according to the adjustment request; Debug the new firmware version based on the adjusted PCIe topology data; When the debugging is successful, a corresponding relationship between the new firmware version and the adjusted PCIe topology data is created and added to the mapping relationship.
3. The method according to claim 2, characterized in that The adjustment request includes a new addition request for a PCIe device, the new addition request is used to add a new PCIe device at the target PCIe device, the new addition request carries a topological relationship between the target PCIe device and the new PCIe device and resource information required by the new PCIe device, and adjusting the current PCIe topology data according to the adjustment request includes: The topological relationship between the target PCIe device and the new PCIe device and the resource information required by the new PCIe device are added to the current PCIe topology data.
4. The method according to claim 2, characterized in that: The device types include root ports and PCIe bridges. After adjusting the current PCIe topology data according to the adjustment request, the method further includes: Saving the adjusted PCIe topology data to a non-volatile random access memory; When restarting next time, reading the device type of each PCIe device from the first preset area of the non-volatile random access memory; When the device type is a root port, reading resource information required by a downstream device of the root port from a second preset area; When the device type is a PCIe bridge, resource information required by an upstream device of the PCIe bridge and resource information required by a downstream device of the PCIe bridge are read from a third preset area; The adjusted PCIe topology data is reconstructed according to the acquired resource information required by each PCIe device.
5. The method according to claim 2, characterized in that: The method further comprises: When the current firmware version is switched to a new firmware version, obtaining the new firmware version from the programmable logic device; Acquire the adjusted PCIe topology data according to the new firmware version and the updated mapping relationship; Resources are reallocated according to the adjusted PCIe topology data.
6. The method according to claim 4, characterized in that Before receiving the adjustment request for the current PCIe topology data, the method further includes: Receiving a request to enable a dynamic configuration enable signal, and controlling to enable the dynamic configuration enable signal; The device type of each PCIe device is read from the first preset area of the non-volatile random access memory during the next restart, including: When restarting next time, detecting the state of the dynamic configuration enable signal; When it is detected that the dynamic configuration enable signal is in an on state, the device type of each PCIe device in the first preset area of the non-volatile random access memory is read.
7. The method according to claim 1, characterized in that The obtaining the current firmware version of the switch chip from the programmable logic device includes: During the startup process, the corresponding register value is read from the reserved register space of the programmable logic device to obtain the current firmware version of the switch chip.
8. The method according to claim 7, characterized in that The method further comprises: When the read register value is abnormal, the corresponding PCIe topology data is obtained from the mapping relationship according to the preset firmware version information.
9. A PCIe resource allocation system for a server, characterized in that: The system includes a programmable logic device and a switch chip arranged on a mainboard, the programmable logic device is connected to the switch chip, and the mainboard is also equipped with a basic input and output system, wherein: The basic input and output system is used to obtain the current firmware version of the switch chip from the programmable logic device during the startup process, and obtain the current PCIe topology data according to the current firmware version and the pre-created mapping relationship, wherein the mapping relationship includes multiple reference firmware versions pre-configured for the switch chip and PCIe topology data matching each reference firmware version, and the current PCIe topology data includes resource information required for each PCIe device connected to the server and the topological relationship between each PCIe device, wherein the topological relationship between each PCIe device is root It is created according to the device type of each PCIe device, the device type includes a root port and a PCIe bridge. When the device type is the root port, the topological relationship includes a parent-child topological relationship between the root port and a downstream device of the root port. When the device type is the PCIe bridge, the topological relationship includes a parent-child topological relationship between an upstream device of the PCIe bridge and the PCIe bridge and a parent-child topological relationship between the PCIe bridge and a downstream device of the PCIe bridge. Resources are allocated according to the resource information required by each PCIe device and the topological relationship between each PCIe device.
10. The system according to claim 9, characterized in that The switch chip is also used to write the current firmware version of the switch chip into the reserved register space of the programmable logic device; The basic input and output system is used to read the current firmware version from the reserved register space of the programmable logic device.
11. The system according to claim 9, characterized in that The system also includes a basic input and output system setting interface, wherein: The basic input and output system is also used to receive a request for obtaining the current PCIe topology data through the basic input and output system setting interface, and obtain the current PCIe topology data from the mapping relationship and import it into the basic input and output system setting interface for display; The basic input / output system is further used to receive an adjustment request for the current PCIe topology data through the basic input / output system setting interface, and adjust the current PCIe topology data according to the adjustment request.
12. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
