PCIE device hot plug control method and related device

By using the OptionRom function and hot-swappable registers in the BIOS stage, PCIE devices are dynamically managed, which solves the problem that hot-swappable PCIE devices are not supported in the existing technology, realizes the addition and deletion of PCIE devices in the BIOS stage, and increases the flexibility of topology changes. .

CN116737636BActive Publication Date: 2024-09-10ZHUHAI XINGYUN ZHILIAN TECH CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202311009392.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-11
Publication Date
2024-09-10
Estimated Expiration
2043-08-11

AI Technical Summary

Technical Problem

The existing technology does not support the hot-swappable mechanism of PCIE devices. In particular, it fails to handle interrupt events and implement message signal interrupt capabilities at the BIOS stage, resulting in the inability to dynamically add or delete PCIE devices.

Method used

By using the OptionRom function at the BIOS stage to read the driver from flash memory, detect the value of the hot-plug register, stop and reset the corresponding PCIE device when the value is specified, set the hot-plug register to 0 to delete the device and release resources, Use hot plug and hot plug registers to establish a bridge between software and hardware to implement hot plug and plug of PCIE devices.

Benefits of technology

It realizes the ability to dynamically add and delete PCIE devices in the BIOS stage, increases the flexibility of PCIE topology changes in the BIOS stage, simulates operating system functions through the OptionRom function, and completes the hot-plug operation of PCIE devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116737636B
    Figure CN116737636B
Patent Text Reader

Abstract

The present application discloses a PCIE device hot plug control method and related devices, which are applied to electronic equipment, the electronic equipment includes a first port, a hot plug register and a hot pull register, the method includes: in the BIOS stage, through the OptionRom function of the first port, reading a driver from a flash memory, realizing a driving function, detecting whether the value of the hot pull register is a first specified value, the hot pull register carries first register information, the first register information includes the value of the hot pull register and a first BDF number, when the value of the hot pull register is the first specified value, reading the first BDF number carried by the hot pull register, stopping the first PCIE device corresponding to the first BDF number, resetting the first PCIE device, and setting the value of the hot pull register to 0 to delete the first PCIE device. The present application can be used to implement a hot plug mechanism for PCIE devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology or the field of Internet technology, and in particular to a PCIE device hot plug control method and related devices. Background Art

[0002] At present, the basic input output system (BIOS) does not support the processing of interrupt events when scanning the high-speed serial computer expansion bus standard peripheral component interconnect express (PCIE) topology stage, and does not enable the message signaled interrupts (MSI) and MSI / extended message signaled interrupts (MSIX) capabilities of PCIE bridge devices. Therefore, it does not support the hot-plug mechanism of PCIE devices under the operating system (OS). Therefore, the problem of how to implement the hot-plug mechanism of PCIE devices needs to be solved urgently. Summary of the invention

[0003] The present application provides a PCIE device hot plug control method and related devices, which can implement a hot plug mechanism for PCIE devices.

[0004] In a first aspect, the present application provides a PCIE device hot plug control method, which is applied to an electronic device, wherein the electronic device includes a first port, a hot plug register, and a hot pull register, and the method includes:

[0005] In the BIOS stage, a driver is read from the flash memory through the OptionRom function of the first port, so as to implement a driving function through the driver;

[0006] Detecting whether the value of the hot-plug register is a first specified value, the hot-plug register carries first register information, the first register information includes the value of the hot-plug register and a first BDF number, and the first specified value is not 0;

[0007] When the value of the hot unplug register is the first specified value, the first BDF number carried by the hot unplug register is read, the first PCIE device corresponding to the first BDF number is stopped, and the first PCIE device is reset, and the value of the hot unplug register is set to 0 to delete the first PCIE device and release the resources of the first PCIE device.

[0008] In a second aspect, the present application provides a PCIE device hot plug control device, which is applied to an electronic device, wherein the electronic device includes a first port, a hot plug register and a hot pull register, and the device includes: a reading unit, a detection unit and a deletion unit, wherein:

[0009] The reading unit is used to read the driver program from the flash memory through the OptionRom function of the first port in the BIOS stage, so as to realize the driving function through the driver program;

[0010] The detection unit is used to detect whether the value of the hot unplug register is a first specified value, the hot unplug register carries first register information, the first register information includes the value of the hot unplug register and a first BDF number, and the first specified value is not 0;

[0011] The deleting unit is used to read the first BDF number carried by the hot unplug register when the value of the hot unplug register is the first specified value, stop the first PCIE device corresponding to the first BDF number, reset the first PCIE device, set the value of the hot unplug register to 0, so as to delete the first PCIE device and release the resources of the first PCIE device.

[0012] In a third aspect, the present application provides an electronic device comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the steps in the first aspect of the present application.

[0013] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps described in the first aspect of the present application.

[0014] In a fifth aspect, the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in the first aspect of the present application. The computer program product may be a software installation package.

[0015] The implementation of this application has the following beneficial effects:

[0016] It can be seen that the PCIE device hot plug control method and related devices described in the present application are applied to an electronic device, which includes a first port, a hot plug register and a hot unplug register. In the BIOS stage, the driver is read from the flash memory through the OptionRom function of the first port to implement the driving function through the driver, and detect whether the value of the hot unplug register is the first specified value. The hot unplug register carries the first register information, and the first register information includes the value of the hot unplug register and the first BDF number. The first specified value is not 0. When the value of the hot unplug register is the first specified value, the first BDF number carried by the hot unplug register is read, the first PCIE device corresponding to the first BDF number is stopped, and the first PCIE device is reset. The value of the hot unplug register is set to 0 to delete the first PCIE device and release the resources of the first PCIE device. Since the operating system is not installed in the BIOS stage, the operating system function can be implemented through the OptionRom function. In addition, the hot plug register and the hot unplug register are used to establish a bridge between software and hardware, and the PCIE device deletion operation is completed through the hot unplug register. Then, the PCIE device can be deleted to implement the hot plug mechanism of the PCIE device. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 It is a schematic diagram of the architecture of a PCIE device hot-plug control system for implementing a PCIE device hot-plug control method provided by the present application;

[0019] Figure 2 It is a flow chart of a PCIE device hot plug control method provided by the present application;

[0020] Figure 3 It is a schematic diagram of the architecture of another PCIE device hot-plug control system for implementing a PCIE device hot-plug control method provided by the present application;

[0021] Figure 4 It is a flow chart of another PCIE device hot plug control method provided by the present application;

[0022] Figure 5 It is a structural schematic diagram of an electronic device provided by the present application;

[0023] Figure 6This is a block diagram of the functional units of a PCIE device hot plug control device provided by the present application. DETAILED DESCRIPTION

[0024] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution of the present application will be clearly and completely described below in conjunction with the drawings in the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0025] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0026] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0027] In a specific implementation, the electronic devices involved in this application may include but are not limited to: smart network cards, data processing units (DPUs), hosts (HOSTs), servers, and high-speed serial computer expansion bus standard (peripheral component interconnect express, PCIE) devices.

[0028] In the embodiment of the present application, PCI is Peripheral Component Interconnect, which means "peripheral device interconnect" in Chinese. It is a local parallel bus standard launched by PCISIG (PCI Special Interest Group). The PCI bus is a tree structure and is independent of the CPU bus and can operate in parallel with the CPU bus. PCI devices and PCI bridges can be connected to the PCI bus. Only one PCI master device is allowed on the PCI bus, and the others are all PCI slave devices. Moreover, read and write operations can only be performed between master and slave devices, and data exchange between slave devices needs to be transferred through the master device.

[0029] Among them, PCI Express is derived from the early PCI extension and is compatible with PCI. The main difference between the two is the switching from parallel to serial and the faster speed. PCI Express is a layered protocol consisting of a transaction layer, a data link layer, and a physical layer.

[0030] Among them, PCIE devices and PCI devices implement hot plugging in a way called no surprises. Users are not allowed to insert or remove a PCIE device without informing the system software; after the user informs the software that a device is to be inserted or removed, the software will perform the relevant operations and then inform the user whether it is safe to perform the operation (through the corresponding indicator); then the user can perform the next operation.

[0031] Among them, PCI Option ROM is also called PCI Expansion ROM. It is the code used for device initialization and system boot. Some PCI Option ROMs are stored on the board, while others are stored in the BIOS binary.

[0032] Among them, in the DPU scenario, in order to enable the DPU to simulate multiple different types of standard PCIE devices for the HOST, the ECPU-side software needs to simulate the entire PCIE topology and different types of PCIE devices; the HOST-side operating system enumerates the PCIE topology and PCIE devices; finally, different types of drivers on the HOST side Probe different types of PCIE devices.

[0033] For related technologies, see Figure 1 , Figure 1This is a schematic diagram of the architecture of a PCIE device hot-plug control system for implementing a PCIE device hot-plug control method provided by an embodiment of the present application. As shown in the figure, the PCIE device hot-plug control system is applied to a host (HOST), and the system may include: a hardware module and a software module. The hardware module may include upper-layer hardware (UP), such as upstream, hardware layer (HW), etc., which are not limited here. The software module may include an ECPU Emulator, and the hardware layer may include a network card, such as a DPU network card. The ECPU Emulator is used to simulate a PCIE topology structure. The PCIE topology structure may include multiple nodes, each node corresponding to a device, for example, it may include A1, a first switch, B1, a second switch, A2, B2, wherein A1, A2, B1, and B2 are PCIE devices.

[0034] In the related art, for hot-insertion of a new PCIE device, the Host needs to be manually restarted for rescanning, and hot-plugging of the PCIE device is not currently supported.

[0035] In order to solve the defects in the related art, the present application provides a PCIE device hot plug control method, which is applied to an electronic device, wherein the electronic device includes a first port, a hot plug register and a hot pull register, and the method may include the following steps:

[0036] In the BIOS stage, a driver is read from the flash memory through the OptionRom function of the first port, so as to implement a driving function through the driver;

[0037] Detecting whether the value of the hot-plug register is a first specified value, the hot-plug register carries first register information, the first register information includes the value of the hot-plug register and a first BDF number, and the first specified value is not 0;

[0038] When the value of the hot unplug register is the first specified value, the first BDF number carried by the hot unplug register is read, the first PCIE device corresponding to the first BDF number is stopped, and the first PCIE device is reset, and the value of the hot unplug register is set to 0 to delete the first PCIE device and release the resources of the first PCIE device.

[0039] In the embodiment of the present application, PCIE devices can be dynamically added or deleted for the Host in the BIOS stage without user participation, thereby increasing the flexibility of PCIE topology changes in the BIOS stage.

[0040] The following is a detailed introduction to this application.

[0041] See also Figure 2 , Figure 2 It is a flow chart of a hot plug control method for a PCIE device provided by the present application, which is applied to an electronic device, wherein the electronic device includes a first port, a hot plug register and a hot pull register. As shown in the figure, the hot plug control method for the PCIE device includes:

[0042] S201. In the BIOS stage, a driver is read from a flash memory through the OptionRom function of the first port to implement a driving function through the driver.

[0043] In the embodiment of the present application, in the BIOS stage, since the operating system is not installed, a flash memory (Flash) defined in the PCIE specification is required for the OptionRom function. The network card has its own driver, which tells the HOST that the network card has its own driver. The image is pulled through the OptionRom function. When there is no operating system during the first installation, the operating system function can be implemented through the image.

[0044] The first port includes a UP port.

[0045] Among them, the hot plug register is the HotplugIn register, and the hot unplug register is the HotplugOut register. In the embodiment of the present application, the hot plug mechanism of the PCIE device in the BIOS stage is realized with the help of the OptionRom function and the HotplugIn / HotplugOut register provided by the hardware.

[0046] In a specific implementation, the driver program can be read from the flash memory through the OptionRom function of the first port, so as to implement the driving function through the driver program.

[0047] S202: Detect whether the value of the hot-plug register is a first specified value, the hot-plug register carries first register information, the first register information includes the value of the hot-plug register and a first BDF number, and the first specified value is not 0.

[0048] The first specified value may be preset or set by the system by default, and the first specified value is not 0. For example, the first specified value may be 1. In the embodiment of the present application, it may be detected whether the value of the hot unplug register is 1. If the value of the hot unplug register is the first specified value, it indicates that the PCIE device needs to be deleted, otherwise, it indicates that the PCIE device does not need to be deleted.

[0049] In a specific implementation, the first register information may include a character string, for example, the character string may include the value of the hot unplug register and the first BDF number, wherein the first BDF number may be understood as the BDF number of the device to be deleted. Specifically, it may be detected whether the value of the hot unplug register is the first specified value, that is, whether a PCIE device deletion signal appears.

[0050] In the embodiment of the present application, each function (Function) in the PCIE bus has a unique identifier corresponding to it, and the identifier is the BDF number, and the BDF number specifically includes the bus (Bus), device (Device), and function (Function).

[0051] S203. When the value of the hot unplug register is the first specified value, read the first BDF number carried by the hot unplug register, stop the first PCIE device corresponding to the first BDF number, reset the first PCIE device, set the value of the hot unplug register to 0, so as to delete the first PCIE device and release the resources of the first PCIE device.

[0052] In a specific implementation, when the value of the hot unplug register is the first specified value, it indicates that a PCIE device deletion signal appears, and the first BDF number carried by the hot unplug register can be read, the first PCIE device corresponding to the first BDF number can be stopped, and the first PCIE device can be reset, and the value of the hot unplug register can be set to 0 to delete the first PCIE device. In this way, dynamic deletion of the PCIE device can be achieved, and the resources of the first PCIE device can be released. For example, the node where the first PCIE device is located in the PCIE topology structure can be freed up, and the node can be used to insert other PCIE devices that need to be inserted.

[0053] Optionally, the following steps may also be included:

[0054] Detect whether the value of the hot plug register is a second specified value, the hot plug register carries second register information, the second register information includes the value of the hot plug register, and the second specified value is not 0; when the value of the hot plug register is the second specified value, set the value of the hot plug register to 0; trigger the electronic device to restart, scan the second PCIE device and allocate resources to create the second PCIE device.

[0055] In the embodiment of the present application, the second specified value may be preset or set by the system by default, and the second specified value is not 0, for example, the second specified value may be 1. In a specific implementation, the second specified value may be the same as or different from the first specified value.

[0056] In a specific implementation, it can be detected whether the value of the hot plug register is the second specified value. If the value of the hot plug register is the second specified value, it means that the PCIE device needs to be inserted, otherwise, it means that the PCIE device is not inserted.

[0057] In the specific implementation, for example, when the second specified value is 1, it is detected whether the value of the hot plug register is 1. When the value of the hot plug register is 1, the value of the hot plug register is set to 0, triggering the electronic device to restart, and scanning and resource allocation of the second PCIE device are performed to create a second PCIE device. The second PCIE device corresponds to the second BDF number, and thus, dynamic creation of PCIE devices can be realized.

[0058] In a specific implementation, when the value of the hot-plug register is not the first specified value, the step of detecting whether the value of the hot-plug register is the second specified value is performed.

[0059] In a specific implementation, when the value of the hot unplug register is not the first specified value, the step of detecting whether the value of the hot plug register is the second specified value may be performed, thereby facilitating the dynamic insertion of the PCIE device.

[0060] Optionally, the following steps may also be included:

[0061] When the value of the hot plug register is not the second specified value, the step of detecting whether the value of the hot pull register is the first specified value is performed.

[0062] In a specific implementation, when the value of the hot-plug register is not the second specified value, the step of detecting whether the value of the hot-plug register is the first specified value can be performed, thereby facilitating dynamic deletion of the PCIE device.

[0063] In the embodiment of the present application, a hot-plug mechanism for PCIE devices in the BIOS stage can be implemented: the hardware provides the OptionRom function and the HotplugIn / HotplugOut register; when a new PCIE device is created on the ECPU side, the HotplugIn register is set to 1, triggering the Host to rescan and allocate resources; when the ECPU side deletes the PCIE device, the HotplugOut register is set to 1, and after the BIOS stops and resets the device, the ECPU side completely deletes the device.

[0064] Optionally, the above step of reading the first BDF carried by the hot unplug register may include the following steps:

[0065] Obtain BDF numbers of m PCIE devices to obtain m BDF numbers; select one of the m BDF numbers as the first BDF number; and pass the first BDF number to the hot-plug register.

[0066] In an embodiment of the present application, the BDF numbers of m PCIE devices can be obtained, and m BDF numbers are obtained, where m is a positive integer. One of the m BDF numbers is selected as the first BDF number, and the first BDF number is passed to the hot unplug register, that is, the PCIE device that the user wants to delete can be deleted based on the user's selection.

[0067] Optionally, the above step of scanning and allocating resources of the second PCIE device to create the second PCIE device may include the following steps:

[0068] Scan the PCIE device to obtain the entire PCIE topology structure; determine available resources according to the entire PCIE topology structure, wherein the available resources include at least one idle node in the entire PCIE topology structure; select a target idle node from the at least one idle node; and create the second PCIE device according to the target idle node.

[0069] In the embodiment of the present application, scanning and resource allocation can be performed to create a PCIE device that needs to be created. In a specific implementation, a PCIE device is scanned to obtain the entire PCIE topology structure, and then available resources are determined based on the entire PCIE topology structure. The available resources include at least one idle node in the entire PCIE topology structure. Then, a target idle node in the at least one idle node can be selected, and then a second PCIE device can be created based on the target idle node. The second PCIE device can correspond to the second BDF number, and then the dynamic creation of the PCIE device can be realized.

[0070] In the embodiment of the present application, the hot plug mechanism of PCIE device in BIOS stage can be realized by means of OptionRom function and HotplugIn / HotplugOut register provided by hardware, such as Figure 3 As shown, the present PCIE device hot-swap control system is applied to HOST, and the system may include: hardware module and software module. The hardware module may include upper hardware (UP), such as upstream, hardware layer (HW), etc., which are not limited here. The software module may include ECPU Emulator, and the hardware layer may include a network card, such as a DPU network card. The software module (ECPU Emulator) is used to simulate the PCIE topology structure, for example, it may include A1, a first switch, B1, a second switch, A2, B2, wherein A1, A2, B1, and B2 are PCIE devices. The hardware layer may include OptionRom (OptionRom function) and HotplugIn / HotplugOut registers. The HotplugIn / HotplugOut registers are equivalent to the connection bridge between software and hardware.

[0071] For example, the first specified value is 1 and the second specified value is 1. In the specific implementation, with the help of the OptionRom function and HotplugIn / HotplugOut registers provided by the DPU card UP port, the ECPU side emulator can dynamically create and delete PCIE devices and notify the HOST side BIOS to implement hot plugging of PCIE devices. Figure 4 As shown, the server is hot restarted, the HOST side BIOS scans the complete PCIE topology, the HOST side BIOS loads the UP port OptionRom and starts, detects the value of the HotplugOut register, when the value of the HotplugOut register is 1, OptionRom stops the device queue and resets the device; sets the HotplugOut register to 0; the ECPU detects that the HotplugOut register is 0, deletes the device, and when the value of the HotplugOut register is 0, detects the value of the HotplugIn register, when the value of the HotplugIn register is 1, OptionRom sets the HotplugIn register to 0, and restarts the HOST, when the value of the HotplugIn register is 0, the HOST side BIOS loads the UP port OptionRom and starts.

[0072] In the embodiment of the present application, the following functions can be realized:

[0073] 1) The BIOS on the host side scans the complete PCIE topology simulated by the ECPU side software on the DPU card, loads the OptionRom program of the UP port of the DPU card and executes it;

[0074] 2) The UP port OptionRom program executes two event processing:

[0075] a. Check whether the HotplugOut register is 1; if it is 1, read the BDF carried by the HotplugOut register, stop the PCIE device and reset it, and set the HotplugOut register to 0; otherwise, execute step b;

[0076] b. Check whether the HotplugIn register is 1; if it is 1, set the HotplugIn register to 0; at the same time, trigger the Host to restart, scan the new PCIE device and allocate resources; otherwise, execute step a;

[0077] 3) If the ECPU software on the DPU card wants to delete a PCIE device, it sets the HotplugOut register to 1 and writes the BDF number of the PCIE device; then it checks whether the HotplugOut register is 0. If it is 0, the PCIE device is completely deleted;

[0078] 4) If the ECPU-side software on the DPU card wants to create a PCIE device, set the HotplugIn register to 1.

[0079] In the embodiment of the present application, the OptionRom function and HotplugIn / HotplugOut registers provided by the hardware are used to implement the hot plug mechanism of the PCIE device in the BIOS stage.

[0080] It can be seen that the PCIE device hot plug control method described in the present application is applied to an electronic device, which includes a first port, a hot plug register and a hot unplug register. In the BIOS stage, the driver is read from the flash memory through the OptionRom function of the first port to implement the driving function through the driver, and detect whether the value of the hot unplug register is the first specified value. The hot unplug register carries the first register information, and the first register information includes the value of the hot unplug register and the first BDF number. The first specified value is not 0. When the value of the hot unplug register is the first specified value, the first BDF number carried by the hot unplug register is read, the first PCIE device corresponding to the first BDF number is stopped, and the first PCIE device is reset, and the value of the hot unplug register is set to 0 to delete the first PCIE device and release the resources of the first PCIE device. Since the operating system is not installed in the BIOS stage, the operating system function can be implemented through the OptionRom function. In addition, the hot plug register and the hot unplug register are used to establish a bridge between software and hardware, and the PCIE device deletion operation is completed through the hot unplug register. Then, the PCIE device can be deleted to implement the hot plug mechanism of the PCIE device.

[0081] In accordance with the above embodiment, please refer to Figure 5 , Figure 5 This is a structural diagram of an electronic device provided by the present application. As shown in the figure, the electronic device includes a processor, a memory, a communication interface and one or more programs. The one or more programs are stored in the memory and are configured to be executed by the processor. The electronic device also includes a first port, a hot plug register and a hot unplug register. In the present application, the program includes instructions for executing the following steps:

[0082] In the BIOS stage, a driver is read from the flash memory through the OptionRom function of the first port, so as to implement a driving function through the driver;

[0083] Detecting whether the value of the hot-plug register is a first specified value, the hot-plug register carries first register information, the first register information includes the value of the hot-plug register and a first BDF number, and the first specified value is not 0;

[0084] When the value of the hot unplug register is the first specified value, the first BDF number carried by the hot unplug register is read, the first PCIE device corresponding to the first BDF number is stopped, and the first PCIE device is reset, and the value of the hot unplug register is set to 0 to delete the first PCIE device and release the resources of the first PCIE device.

[0085] Optionally, the program further includes instructions for executing the following steps:

[0086] Detecting whether the value of the hot plug register is a second specified value, the hot plug register carries second register information, the second register information includes the value of the hot plug register, and the second specified value is not 0;

[0087] When the value of the hot plug register is the second specified value, the value of the hot plug register is set to 0; the electronic device is triggered to restart, and a second PCIE device is scanned and resources are allocated to create the second PCIE device.

[0088] Optionally, the program further includes instructions for executing the following steps:

[0089] When the value of the hot plug register is not the second specified value, the step of detecting whether the value of the hot pull register is the first specified value is performed.

[0090] Optionally, in the aspect of reading the first BDF number carried by the hot unplug register, the program includes instructions for executing the following steps:

[0091] Get the BDF numbers of m PCIE devices and get m BDF numbers;

[0092] Select one of the m BDF numbers as the first BDF number;

[0093] The first BDF number is passed to the hot unplug register.

[0094] Optionally, in the aspect of performing scanning and resource allocation of the second PCIE device to create the second PCIE device, the program includes instructions for performing the following steps:

[0095] Scan PCIE devices to obtain the entire PCIE topology;

[0096] Determine available resources according to the entire PCIE topology structure, where the available resources include at least one idle node in the entire PCIE topology structure;

[0097] Selecting a target idle node from the at least one idle node;

[0098] The second PCIE device is created according to the target idle node.

[0099] It can be seen that the electronic device described in the present application includes a first port, a hot plug register and a hot unplug register. In the BIOS stage, the driver is read from the flash memory through the OptionRom function of the first port to implement the driving function through the driver, and detect whether the value of the hot unplug register is the first specified value. The hot unplug register carries the first register information, and the first register information includes the value of the hot unplug register and the first BDF number. The first specified value is not 0. When the value of the hot unplug register is the first specified value, the first BDF number carried by the hot unplug register is read, the first PCIE device corresponding to the first BDF number is stopped, and the first PCIE device is reset, and the value of the hot unplug register is set to 0 to delete the first PCIE device and release the resources of the first PCIE device. Since the operating system is not installed in the BIOS stage, the operating system function can be implemented through the OptionRom function. In addition, the hot plug register and the hot unplug register are used to establish a bridge between software and hardware, and the PCIE device deletion operation is completed through the hot unplug register. Then, the PCIE device can be deleted to implement the hot plug mechanism of the PCIE device.

[0100] Figure 6 This is a functional unit block diagram of a PCIE device hot-plug control device 600 involved in this application. The PCIE device hot-plug control device 600 is applied to an electronic device, the electronic device includes a first port, a hot-plug register and a hot-plug register, and the PCIE device hot-plug control device 600 includes: a reading unit 601, a detection unit 602 and a deletion unit 603, wherein:

[0101] The reading unit 601 is used to read the driver from the flash memory through the OptionRom function of the first port in the BIOS stage, so as to implement the driving function through the driver;

[0102] The detection unit 602 is used to detect whether the value of the hot unplug register is a first specified value, the hot unplug register carries first register information, the first register information includes the value of the hot unplug register and a first BDF number, and the first specified value is not 0;

[0103] The deleting unit 603 is used to read the first BDF number carried by the hot unplug register when the value of the hot unplug register is the first specified value, stop the first PCIE device corresponding to the first BDF number, reset the first PCIE device, set the value of the hot unplug register to 0, so as to delete the first PCIE device and release the resources of the first PCIE device.

[0104] Optionally, the PCIE device hot plug control device 600 is further specifically used for:

[0105] Detecting whether the value of the hot plug register is a second specified value, the hot plug register carries second register information, the second register information includes the value of the hot plug register, and the second specified value is not 0;

[0106] When the value of the hot plug register is the second specified value, the value of the hot plug register is set to 0; the electronic device is triggered to restart, and a second PCIE device is scanned and resources are allocated to create the second PCIE device.

[0107] Optionally, the PCIE device hot plug control device 600 is further specifically used for:

[0108] When the value of the hot plug register is not the second specified value, the step of detecting whether the value of the hot pull register is the first specified value is performed.

[0109] Optionally, in the aspect of reading the first BDF carried by the hot unplug register, the deleting unit 603 is specifically used for:

[0110] Get the BDF numbers of m PCIE devices and get m BDF numbers;

[0111] Select one of the m BDF numbers as the first BDF number;

[0112] The first BDF number is passed to the hot unplug register.

[0113] Optionally, in the aspect of performing scanning and resource allocation of the second PCIE device to create the second PCIE device, the PCIE device hot plug control device 600 is specifically used for:

[0114] Scan PCIE devices to obtain the entire PCIE topology;

[0115] Determine available resources according to the entire PCIE topology structure, where the available resources include at least one idle node in the entire PCIE topology structure;

[0116] Selecting a target idle node from the at least one idle node;

[0117] The second PCIE device is created according to the target idle node.

[0118] It can be seen that the PCIE device hot plug control device described in the present application is applied to an electronic device, which includes a first port, a hot plug register and a hot pull register. In the BIOS stage, the driver is read from the flash memory through the OptionRom function of the first port to implement the driving function through the driver, and detect whether the value of the hot pull register is the first specified value. The hot pull register carries the first register information, and the first register information includes the value of the hot pull register and the first BDF number. The first specified value is not 0. When the value of the hot pull register is the first specified value, the first BDF number carried by the hot pull register is read, the first PCIE device corresponding to the first BDF number is stopped, and the first PCIE device is reset, and the value of the hot pull register is set to 0 to delete the first PCIE device and release the resources of the first PCIE device. Since the operating system is not installed in the BIOS stage, the operating system function can be implemented through the OptionRom function. In addition, the hot plug register and the hot pull register are used to establish a bridge between software and hardware, and the PCIE device deletion operation is completed through the hot pull register. Then, the PCIE device can be deleted to implement the hot plug mechanism of the PCIE device.

[0119] It can be understood that the functions of each program module of the PCIE device hot plug control device of this embodiment can be specifically implemented according to the method in the above method embodiment, and its specific implementation process can refer to the relevant description of the above method embodiment, which will not be repeated here.

[0120] The present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps of any method described in the above method embodiments, and the above computer includes an electronic device.

[0121] The present application also provides a computer program product, the computer program product comprising a non-transitory computer-readable storage medium storing a computer program, the computer program being operable to cause a computer to execute some or all of the steps of any method described in the above method embodiment. The computer program product may be a software installation package, and the computer comprises an electronic device.

[0122] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0123] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0124] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the above-mentioned units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0125] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0126] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0127] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the above-mentioned methods in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0128] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable memory, which may include a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0129] The above is a detailed introduction to the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A PCIE device hot plug control method, characterized in that: Applied to an electronic device, the electronic device comprises a first port, a hot-insertion register and a hot-unplugging register, the method comprising: In the BIOS stage, a driver is read from the flash memory through the OptionRom function of the first port, so as to implement a driving function through the driver, that is, to implement an operating system function through the OptionRom function; Detecting whether the value of the hot-plug register is a first specified value, the hot-plug register carries first register information, the first register information includes the value of the hot-plug register and a first BDF number, the first specified value is not 0; the first BDF number includes: bus, device, function; When the value of the hot unplug register is the first specified value, read the first BDF number carried by the hot unplug register, stop the first PCIE device corresponding to the first BDF number, reset the first PCIE device, set the value of the hot unplug register to 0, so as to delete the first PCIE device and release the resources of the first PCIE device, that is, use the hot plug register and the hot unplug register to establish a bridge between software and hardware; The step of reading the first BDF carried by the hot-plug register includes: Get the BDF numbers of m PCIE devices and get m BDF numbers; Selecting one of the m BDF numbers as the first BDF number based on user selection; The first BDF number is passed to the hot unplug register.

2. The method according to claim 1, characterized in that The method further comprises: Detecting whether the value of the hot plug register is a second specified value, the hot plug register carries second register information, the second register information includes the value of the hot plug register, and the second specified value is not 0; When the value of the hot plug register is the second specified value, the value of the hot plug register is set to 0; the electronic device is triggered to restart, and a second PCIE device is scanned and resources are allocated to create the second PCIE device.

3. The method according to claim 2, characterized in that The method further comprises: When the value of the hot plug register is not the second specified value, the step of detecting whether the value of the hot pull register is the first specified value is performed.

4. The method according to claim 3, characterized in that The scanning and resource allocation of the second PCIE device to create the second PCIE device includes: Scan PCIE devices to obtain the entire PCIE topology; Determine available resources according to the entire PCIE topology structure, where the available resources include at least one idle node in the entire PCIE topology structure; Selecting a target idle node from the at least one idle node; The second PCIE device is created according to the target idle node.

5. A PCIE device hot plug control device, characterized in that: Applied to an electronic device, the electronic device comprises a first port, a hot plug register and a hot unplug register, the device comprises: a reading unit, a detection unit and a deletion unit, wherein: The reading unit is used to read the driver program from the flash memory through the OptionRom function of the first port in the BIOS stage, so as to implement the driving function through the driver program, that is, to implement the operating system function through the OptionRom function; The detection unit is used to detect whether the value of the hot unplug register is a first specified value, the hot unplug register carries first register information, the first register information includes the value of the hot unplug register and a first BDF number, the first specified value is not 0; the first BDF number includes: bus, device, function; The deleting unit is used to read the first BDF number carried by the hot unplug register when the value of the hot unplug register is the first specified value, stop the first PCIE device corresponding to the first BDF number, reset the first PCIE device, set the value of the hot unplug register to 0, so as to delete the first PCIE device and release the resources of the first PCIE device, that is, to use the hot plug register and the hot unplug register to establish a bridge between software and hardware; The step of reading the first BDF carried by the hot-plug register includes: Get the BDF numbers of m PCIE devices and get m BDF numbers; Selecting one of the m BDF numbers as the first BDF number based on user selection; The first BDF number is passed to the hot unplug register.

6. The device according to claim 5, characterized in that The device is also specifically used for: Detecting whether the value of the hot plug register is a second specified value, the hot plug register carries second register information, the second register information includes the value of the hot plug register, and the second specified value is not 0; When the value of the hot plug register is the second specified value, the value of the hot plug register is set to 0; the electronic device is triggered to restart, and a second PCIE device is scanned and resources are allocated to create the second PCIE device.

7. The device according to claim 6, characterized in that The device is also specifically used for: When the value of the hot plug register is not the second specified value, the step of detecting whether the value of the hot pull register is the first specified value is performed.

8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory is used to store one or more programs and is configured to be executed by the processor, wherein the program comprises instructions for executing the steps in the method according to any one of claims 1 to 4.

9. A computer-readable storage medium, characterized in that: A computer program for electronic data exchange is stored, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Hot plug method, device and system of PCIE equipment

    CN110955624A

  • Hard disk hot plug method and device, terminal equipment and medium

    CN113535246A

  • Equipment enumeration method and device, computer equipment and storage medium

    CN114817105A

  • NVME communication system and method based on PCIE interface

    CN115454902A

  • Managing configuration and operation of an adapter as a virtual peripheral component interconnect root to expansion read-only memory emulation

    US20130159686A1