Disclosure of Invention
In view of the above, an object of the present invention is to provide a method, an apparatus, a device and a medium for reserving bus resources, which can improve the efficiency of bus resource allocation. The specific scheme is as follows:
in a first aspect, the present application discloses a method for reserving bus resources, including:
adding bus configuration information to a VGA shared memory associated with a substrate management controller; the bus configuration information comprises the bus number corresponding to each root port of the CPU;
initializing VGA equipment where the VGA shared memory is located in a first stage of a basic input/output system;
and at a second stage after the first stage of the basic input and output system, carrying out bus resource configuration on each root port according to the bus configuration information in the VGA shared memory.
Optionally, before adding the bus configuration information to the VGA shared memory associated with the baseboard management controller, the method further includes:
acquiring default bus configuration parameters corresponding to the CPU to obtain the bus configuration information; the default bus configuration parameters include a default bus number corresponding to each root port of each CPU.
Optionally, before initializing the VGA device in which the VGA shared memory is located in the first stage of the basic input output system, the method further includes:
acquiring a modification request sent by a user in an out-of-band mode according to a target protocol through the baseboard management controller;
and modifying the bus configuration information according to the modification request to configure the corresponding current target bus number for the target root port of the CPU.
Optionally, the modification request includes a modification command or a modification file in a target format; the target format is a file storage format corresponding to the bus configuration information; the target protocol comprises an intelligent platform management interface protocol and a redfish protocol.
Optionally, the configuring bus resources for each root port according to the bus configuration information in the VGA shared memory includes:
judging whether the bus configuration information contains the current target bus number or not;
and if the bus configuration information contains the current target bus number, performing bus resource configuration for the corresponding root port according to the current target bus number.
Optionally, after determining whether the bus configuration information includes the current target bus number, the method further includes:
and if the bus configuration information does not contain the current target bus number, performing bus resource configuration for the corresponding root port according to the default bus number.
Optionally, at a second stage after the first stage of the basic input output system, performing bus resource configuration for each root port according to the bus configuration information in the VGA shared memory, including:
at a second stage after the first stage of the basic input and output system, reading the bus configuration information in the VGA shared memory in a memory mapping I/O mode;
and carrying out bus resource configuration for each root port according to the bus configuration information.
In a second aspect, the present application discloses a bus resource reservation apparatus, including:
the bus configuration information adding module is used for adding bus configuration information to the VGA shared memory associated with the substrate management controller; the bus configuration information comprises the bus number corresponding to each root port of the CPU;
the initialization module is used for initializing VGA equipment where the VGA shared memory is located in the first stage of a basic input/output system;
and the bus resource configuration module is used for performing bus resource configuration on each root port according to the bus configuration information in the VGA shared memory at a second stage after the first stage of the basic input and output system.
In a third aspect, the present application discloses an electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the aforementioned bus resource reservation method.
In a fourth aspect, the present application discloses a computer readable storage medium for storing a computer program; wherein the computer program when executed by a processor implements the aforementioned bus resource reservation method.
In the application, bus configuration information is added to a VGA shared memory associated with a baseboard management controller; the bus configuration information comprises the bus number corresponding to each root port of the CPU; initializing VGA equipment where the VGA shared memory is located in a first stage of a basic input/output system; and at a second stage after the first stage of the basic input and output system, carrying out bus resource configuration on each root port according to the bus configuration information in the VGA shared memory. Therefore, by storing the bus configuration information in the VGA shared memory associated with the substrate management controller, the basic input/output system can obtain the configuration information of the reserved bus resources corresponding to the root port of the CPU by accessing the VGA shared memory before the bus resource configuration is performed for the first time, and thus, when the bus resource configuration is performed for the first time, the bus number configuration can be directly performed for each root port of the CPU according to the bus configuration information stored in the VGA shared memory, so that the bus reservation scheme is activated and validated at one time without additional restart, and the efficiency of bus resource allocation is improved.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the prior art, the CPU reserves resources by first acquiring resource information of each PCIE device corresponding to the server, and then determining the maximum resource demand of the PCIE device according to the resource information, and performing resource allocation according to the resource type and the maximum resource demand that can be prefetched. However, the resources required to be reserved for the CPU are obtained by reading the PCIE device configuration space, which is performed after the PCIE device enumeration, and the stage of CPU resource allocation has already passed, so that resource allocation is performed according to the maximum resource demand by restarting at certain time, which causes resource waste and reduces the efficiency of resource allocation. In order to overcome the technical problem, the application provides a method for reserving bus resources based on a VGA shared memory associated with a baseboard management controller, which can improve the efficiency of bus resource allocation.
The embodiment of the application discloses a bus resource reservation method, and as shown in fig. 1, the method may include the following steps:
step S11: adding bus configuration information to a VGA shared memory associated with a substrate management controller; the bus configuration information includes the number of buses corresponding to each root port of the CPU.
In this embodiment, a VGA (Video Graphics Array) shared memory associated with a Baseboard Management Controller (BMC) is used to store BUS configuration information, where the BUS configuration information includes the number of buses corresponding to each Root Port of the CPU, that is, the number of buses reserved for each Root Port of the CPU, and the BUS configuration information may be specifically stored in the shared memory in a JSON format, that is, the BMC stores the number of buses reserved for each Root Port of the CPU in a JSON file manner in the VGA shared memory.
In this embodiment, before adding the bus configuration information to the VGA shared memory associated with the baseboard management controller, the method may further include: acquiring default bus configuration parameters corresponding to the CPU to obtain the bus configuration information; the default bus configuration parameters include a default bus number corresponding to each root port of each CPU. That is, the bus configuration information may be a default bus configuration parameter corresponding to the current CPU, including a default bus number corresponding to each root port of each CPU, where the current CPU may be one or more.
In this embodiment, before initializing the VGA device in which the VGA shared memory is located in the first stage of the basic input output system, the method may further include: acquiring a modification request sent by a user in an out-of-band mode according to a target protocol through the baseboard management controller; and modifying the bus configuration information according to the modification request to configure the corresponding current target bus number for the target root port of the CPU. For example, as shown in fig. 2, after acquiring the default bus number corresponding to each root port, the user may further send a modification request for the bus configuration information by using an out-of-band method according to a target protocol through the baseboard management controller, so that the baseboard management controller modifies the bus configuration information according to the modification request, so that the target root port configuration bus number of the CPU in the bus configuration information is the currently required target bus number, where the target root port may be all root ports of the CPU or a part of root ports. For example, fig. 3 is a schematic diagram showing a specific storage format of BUS configuration information in a VGA shared memory at a BMC end, taking an Intel latest whitley platform icelabel CPU as an example, each CPU has 5 Root ports, on a two-way server, a first column is a position of a Root Port, specifically, a CPU0 Root ports 0-Port4 and a CPU1 Root ports 0-Port4, a second column is a number of buses to be allocated by default, and a third column is a number of currently reserved buses to be modified for a user.
In this embodiment, the modification request may include a modification command or a modification file in a target format; the target format can be a file storage format corresponding to the bus configuration information; the target protocol may include an Intelligent Platform Management Interface (IPMI) protocol and a redfish protocol. The reserved BUS number of a specific Root Port in the BUS configuration information file can be set by the BMC in an out-of-band mode, and the reserved BUS number can be modified by a command or by a mode of importing a JSON file. For example, a user needs to reserve 100 buses on the CPU0 Root Port1 and 80 buses on the CPU1 Root Port3, that is, the number of reserved buses can be modified out of band as shown in fig. 3, and the buses are concentrated under the Root ports with demands by reasonably adjusting the distribution of BUS resources, and the Root ports without demands can distribute a small number of buses. The number of reserved BUSs of the Root ports of the CPU is stored in a VGA shared memory of the BMC in a JSON file mode, and the modification of a user through an IPMI or redfish or other out-of-band protocols is supported, so that the user can modify the reserved BUSs according to requirements before starting up no matter which Root Port the equipment needing to reserve BUSs is connected under, and the flexibility of modifying the reserved parameters of the BUS resources is improved.
Step S12: and initializing the VGA equipment in which the VGA shared memory is positioned in the first stage of the basic input and output system.
In this embodiment, after the BUS configuration information is stored in the VGA shared memory of the baseboard management controller, a Basic Input Output System (BIOS) initializes the VGA device in which the VGA shared memory is located in a first stage of operation, it can be understood that, in an early stage of startup, the BIOS initializes the BMC-associated VGA device before BUS allocation of the CPU Root is completed, so that the BMC-associated VGA device can access the VGA device, and the initialization step is executed immediately after startup, so that the BIOS can be guaranteed to read the BUS configuration information before BUS resource configuration is performed, thereby ensuring that a BUS reservation scheme in the BUS resource configuration is valid when a startup is performed.
Step S13: and at a second stage after the first stage of the basic input and output system, carrying out bus resource configuration on each root port according to the bus configuration information in the VGA shared memory.
In this embodiment, after initializing the BMC VGA device, the bios performs bus resource configuration for each root port according to bus configuration information in the VGA shared memory. It can be understood that before the initialization of the CPU, the BIOS obtains the number of Root Port reserved buses of the CPU by accessing the BMC VGA shared memory, and then the BIOS allocates the number of reserved buses to the Root ports in the CPU.
In this embodiment, the performing, at a second stage after the first stage of the basic input output system, bus resource configuration for each root port according to the bus configuration information in the VGA shared memory may include: at a second stage after the first stage of the basic input and output system, reading the bus configuration information in the VGA shared memory in a memory mapping I/O mode; and carrying out bus resource configuration for each root port according to the bus configuration information. That is, the BIOS may read the content of the JSON file in the VGA shared Memory in a Memory-mapped I/O (MMIO) manner.
In this embodiment, the performing bus resource configuration for each root port according to the bus configuration information in the VGA shared memory may include: judging whether the bus configuration information contains the current target bus number or not; and if the bus configuration information contains the current target bus number, performing bus resource configuration for the corresponding root port according to the current target bus number. And if the bus configuration information does not contain the current target bus number, performing bus resource configuration for the corresponding root port according to the default bus number. To illustrate by taking fig. 3 as an example, after the BIOS reads the bus configuration information in the VGA shared memory, it determines whether the current target bus number in the third row changes from the default bus number in the second row; if yes, the BIOS distributes BUS to Root ports in the CPU according to the requirement of the current target BUS number of the third column in the JSON file; otherwise, the BIOS allocates BUS to the Root Port of the CPU according to the default BUS number in the JSON file, namely, the default average allocation mode.
Therefore, through fully utilizing the VGA shared memory associated with the BMC, the BIOS can be initialized and accessed in the early stage of starting, the BIOS reads the reserved BUS quantity required by a user firstly, then initializes the BUS resources of the CPU, so that the requirement of the reserved BUS can be started once and takes effect immediately, the BIOS is not required to be restarted once again in the starting process, in addition, interfaces for setting the reserved BUS quantity out of band of the user reserved by the BMC are very flexible, the content in the VGA shared memory can be set out of band by protocols such as IPMI and Redfish, and when the user wants to adjust the reserved BUS quantity, the BIOS is not required to be changed, and the realization can be realized by only sending an out-of-band command.
As can be seen from the above, in this embodiment, bus configuration information is added to the VGA shared memory associated with the baseboard management controller; the bus configuration information comprises the bus number corresponding to each root port of the CPU; initializing VGA equipment where the VGA shared memory is located in a first stage of a basic input/output system; and at a second stage after the first stage of the basic input and output system, carrying out bus resource configuration on each root port according to the bus configuration information in the VGA shared memory. Therefore, by storing the bus configuration information in the VGA shared memory associated with the substrate management controller, the basic input/output system can obtain the configuration information of the reserved bus resources corresponding to the root port of the CPU by accessing the VGA shared memory before the bus resource configuration is performed for the first time, and thus, when the bus resource configuration is performed for the first time, the bus number configuration can be directly performed for each root port of the CPU according to the bus configuration information stored in the VGA shared memory, so that the bus reservation scheme is activated and validated at one time without additional restart, and the efficiency of bus resource allocation is improved.
Correspondingly, an embodiment of the present application further discloses a bus resource reservation apparatus, as shown in fig. 4, the apparatus includes:
the bus configurationinformation adding module 11 is used for adding bus configuration information to the VGA shared memory associated with the baseboard management controller; the bus configuration information comprises the bus number corresponding to each root port of the CPU;
theinitialization module 12 is configured to initialize VGA equipment in which the VGA shared memory is located in a first stage of a basic input/output system;
a busresource configuration module 13, configured to perform, at a second stage after the first stage of the basic input/output system, bus resource configuration for each root port according to the bus configuration information in the VGA shared memory.
As can be seen from the above, in this embodiment, bus configuration information is added to the VGA shared memory associated with the baseboard management controller; the bus configuration information comprises the bus number corresponding to each root port of the CPU; initializing VGA equipment where the VGA shared memory is located in a first stage of a basic input/output system; and at a second stage after the first stage of the basic input and output system, carrying out bus resource configuration on each root port according to the bus configuration information in the VGA shared memory. Therefore, by storing the bus configuration information in the VGA shared memory associated with the substrate management controller, the basic input/output system can obtain the configuration information of the reserved bus resources corresponding to the root port of the CPU by accessing the VGA shared memory before the bus resource configuration is performed for the first time, and thus, when the bus resource configuration is performed for the first time, the bus number configuration can be directly performed for each root port of the CPU according to the bus configuration information stored in the VGA shared memory, so that the bus reservation scheme is activated and validated at one time without additional restart, and the efficiency of bus resource allocation is improved.
In some specific embodiments, the bus resource reservation device may specifically include:
a default bus configuration parameter obtaining unit, configured to obtain a default bus configuration parameter corresponding to the CPU, so as to obtain the bus configuration information; the default bus configuration parameters include a default bus number corresponding to each root port of each CPU.
In some specific embodiments, the bus resource reservation device may specifically include:
a modification request acquisition unit, configured to acquire, by the baseboard management controller, a modification request sent by a user in an out-of-band manner according to a target protocol;
and the modifying unit is used for modifying the bus configuration information according to the modifying request so as to configure the corresponding current target bus number for the target root port of the CPU.
In some embodiments, the modification request may specifically include a modification command or a modification file in a target format; the target format may specifically be a file storage format corresponding to the bus configuration information; the target protocol may specifically include an intelligent platform management interface protocol and a redfish protocol.
In some specific embodiments, the busresource configuration module 13 may specifically include:
the judging unit is used for judging whether the bus configuration information contains the current target bus number or not;
and the first bus resource configuration unit is used for configuring bus resources for the corresponding root port according to the current target bus number if the bus configuration information contains the current target bus number.
In some specific embodiments, the busresource configuration module 13 may specifically include:
and the second bus resource configuration unit is configured to, if the bus configuration information does not include the current target bus number, perform bus resource configuration for the corresponding root port according to the default bus number.
In some specific embodiments, the busresource configuration module 13 may specifically include:
a reading unit, configured to read the bus configuration information in the VGA shared memory in a memory mapped I/O manner at a second stage after the first stage of the basic input output system;
and the configuration unit is used for carrying out bus resource configuration on each root port according to the bus configuration information.
Further, the embodiment of the present application also discloses an electronic device, which is shown in fig. 5, and the content in the drawing cannot be considered as any limitation to the application scope.
Fig. 5 is a schematic structural diagram of anelectronic device 20 according to an embodiment of the present disclosure. Theelectronic device 20 may specifically include: at least one processor 21, at least onememory 22, a power supply 23, a communication interface 24, an input output interface 25, and acommunication bus 26. Wherein, thememory 22 is used for storing a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the bus resource reservation method disclosed in any of the foregoing embodiments.
In this embodiment, the power supply 23 is configured to provide a working voltage for each hardware device on theelectronic device 20; the communication interface 24 can create a data transmission channel between theelectronic device 20 and an external device, and a communication protocol followed by the communication interface is any communication protocol applicable to the technical solution of the present application, and is not specifically limited herein; the input/output interface 25 is configured to obtain external input data or output data to the outside, and a specific interface type thereof may be selected according to specific application requirements, which is not specifically limited herein.
In addition, thestorage 22 is used as a carrier for resource storage, and may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., the resources stored thereon include an operating system 221, a computer program 222, data 223 including bus configuration information, etc., and the storage may be a transient storage or a permanent storage.
The operating system 221 is used for managing and controlling each hardware device and the computer program 222 on theelectronic device 20, so as to realize the operation and processing of the mass data 223 in thememory 22 by the processor 21, and may be Windows Server, Netware, Unix, Linux, and the like. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the bus resource reservation method performed by theelectronic device 20 disclosed in any of the foregoing embodiments.
Further, an embodiment of the present application further discloses a computer storage medium, where computer-executable instructions are stored in the computer storage medium, and when the computer-executable instructions are loaded and executed by a processor, the steps of the bus resource reservation method disclosed in any of the foregoing embodiments are implemented.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The method, the apparatus, the device and the medium for reserving bus resources provided by the present invention are described in detail above, and a specific example is applied in the present document to explain the principle and the implementation of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.