Hot swapping method and computer system

By including hot-swap identifiers in the hardware device driver and performing configuration operations, the problem of low hot-swap reliability of hardware devices in computer systems is solved, and a higher plug-in and unplug success rate and device security is achieved.

WO2024239573A1PCT designated stage expired Publication Date: 2024-11-28XFUSION DIGITAL TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/134850
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-05-24
Filing Date
2023-11-28
Publication Date
2024-11-28

AI Technical Summary

Technical Problem

Hardware devices in computer systems often fail to work properly or are damaged after hot plugging, resulting in low reliability of hot plugging.

Method used

By including a hot-swap identifier in the driver of the hardware device, the processor obtains the identifier when receiving a hot-swap request, determines whether the device supports hot-swap configuration, and performs hot-swap configuration operations when supported, ensuring that the hardware device is guaranteed The configuration matches plug-in and unplug to avoid damage and inability to implement functions.

Benefits of technology

It improves the reliability of hot-swap hardware equipment, ensures the integrity of the plug-in and unplug process, avoids damage and function failure, and enhances the rapid maintenance of the computer system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023134850_28112024_PF_FP_ABST
    Figure CN2023134850_28112024_PF_FP_ABST
Patent Text Reader

Abstract

The present application provides a hot swapping method and a computer system and relates to the technical field of computers. The method is executed by a processor. The processor is in communication connection with a hardware device. A driver of the hardware device comprises a hot swapping identifier used for indicating that the hardware device supports hot swapping or does not support hot swapping. Based on this, when receiving a hot swapping request, the processor determines, by means of acquiring the hot swapping identifier, whether the hardware device supports hot swapping or not, and executes a hot swapping configuration operation on the hardware device in a case that the hardware device supports hot swapping, so that it can be ensured that the hot swapping configuration operation is executed on the hardware device supporting hot swapping, thereby helping ensure that the configuration of a PCIE device matches hot swapping and further helping improve the reliability of hot swapping of the hardware device.
Need to check novelty before this filing date? Find Prior Art

Description

Hot plug method and computer system

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on May 24, 2023, with application number 202310613553.3 and application name “Hot Plug Method and Computer System”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of computer technology, and in particular to a hot plug method and a computer system. Background Art

[0003] Hot swapping, or hot plugging, refers to the ability to insert or remove hardware devices from a computer system without shutting down the system's power without affecting its normal operation. Because hot swapping technology can improve the rapid maintenance of computer systems, it is widely used in the computer industry.

[0004] However, after the hot plugging of hardware devices on a computer system, abnormal situations such as the hardware devices not being able to work properly or being damaged often occur, resulting in low reliability of the hot plugging of hardware devices.

[0005] Therefore, how to improve the reliability of hot-swapping of hardware devices has become a technical problem that needs to be solved urgently.

[0006] Summary of the Invention

[0007] The embodiments of the present application provide a hot-plugging method and a computer system, which help to improve the reliability of hot-plugging of hardware devices.

[0008] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0009] In a first aspect, a hot plug method is provided, which is executed by a processor, and the processor is communicatively connected to a hardware device; the method includes: receiving a hot plug request; the hot plug request is used to request hot plugging of a hardware device, and the driver of the hardware device includes a hot plug identifier, and the hot plug identifier is used to indicate whether the hardware device supports hot plugging or not; obtaining the hot plug identifier of the hardware device; if the hot plug identifier indicates that the hardware device supports hot plugging, performing a hot plug configuration operation on the hardware device.

[0010] In this approach, the hardware device driver includes a hot-plug flag to indicate whether the hardware device supports hot-plugging or not. Upon receiving a hot-plug request, the processor obtains the hot-plug flag to determine whether the hardware device supports hot-plugging. If the hot-plug flag indicates that the hardware device supports hot-plugging, the processor performs hot-plug configuration operations on the hardware device. This ensures that hot-plug configuration operations are performed on hardware devices that support hot-plugging, helping to ensure that the PCIE device configuration is compatible with hot-plugging and, in turn, improving the reliability of hot-plugging the hardware device.

[0011] In one possible implementation, a driver of the hardware device includes configuration information of the hardware device; performing a hot plug configuration operation on the hardware device includes: obtaining the configuration information of the hardware device included in the driver of the hardware device; and performing a configuration operation indicated by the configuration information of the hardware device on the hardware device.

[0012] This implementation method includes the configuration information of the hardware device in the driver of the hardware device, and when the hardware device supports hot plugging, obtains the configuration information of the hardware device included in the hardware device, and performs the configuration operation indicated by the configuration information on the hardware device, so as to make the hot plugging process of the hardware device more complete, thereby ensuring that the current configuration of the hardware device matches the hot plugging, thereby avoiding damage to the hardware device when hot plugging, or avoiding the inability to realize some functions of the hardware device after hot plugging due to incomplete configuration operations performed on the hardware device.

[0013] In another possible implementation, when the hot-swap request is a hot-insert request, the configuration operation indicated by the configuration information of the hardware device includes at least one configuration operation among multiple configuration operations that the hardware device needs to perform when the computer system starts.

[0014] This implementation method can ensure the completeness and accuracy of the hardware device configuration after the hardware device is powered on, and avoid abnormal operation of the hardware device or the inability to implement some functions due to incomplete configuration operations performed on the hardware device, thereby helping to make the hot-swap process of the hardware device more complete, and further helping to further improve the reliability of the hot-plugging of the hardware device.

[0015] In another possible implementation, when the hot plug request is a hot unplug request, the configuration operation indicated by the configuration information of the hardware device is used to modify the current configuration of the hardware device so that the modified configuration of the hardware device matches the hot unplug.

[0016] This implementation method, by modifying configurations that may cause damage to the hardware device in advance before hot-plugging the hardware device, ensures that the modified configuration of the hardware device matches the hot-plugging, thereby helping to avoid damage to the hardware device during hot-plugging due to incomplete configuration operations performed on the hardware device, and helps to improve the reliability of hot-plugging the hardware device.

[0017] In another possible implementation, the driver of the hardware device also includes a hot plug configuration identifier, which is used to indicate whether the driver of the hardware device includes configuration information or does not include configuration information; obtaining the configuration information of the hardware device included in the driver of the hardware device includes: when the hot plug configuration identifier indicates that the driver of the hardware device includes configuration information, obtaining the configuration information of the hardware device included in the driver of the hardware device.

[0018] This implementation method sets the hardware device driver to also include a hot plug configuration identifier, which is used to indicate whether the hardware device driver includes configuration information or does not include configuration information. In this way, it is possible to determine whether the hardware device driver includes the hardware device configuration information based on the hot plug configuration identifier, and if the hot plug configuration identifier indicates that the configuration information is included, the hardware device configuration information included in the hardware device driver is obtained. Compared with directly reading the hardware device driver, this helps to save program processing overhead.

[0019] In another possible implementation, the configuration information of the hardware device includes one or more of the general purpose input / output (GPIO) configuration information, register configuration information, port mode configuration information and optional read-only memory (OptionROM) configuration information of the hardware device.

[0020] In another possible implementation, when the hot plug request is a hot insert request, performing a hot plug configuration operation on the hardware device includes: accessing the hardware device.

[0021] This implementation method only accesses the hardware device if the hardware device supports hot plugging. Compared to accessing the hardware device when it is uncertain whether the hardware device supports hot plugging, this helps avoid abnormal access to the hardware device when the hardware device does not support hot plugging, thereby avoiding affecting the normal operation of the computer system. In another possible implementation method, when the hot plug request is a hot unplug request, a hot plug configuration operation is performed on the hardware device, including: releasing PCIE resources allocated to the hardware device.

[0022] This implementation releases PCIE resources allocated to the PCIE device when the hardware device requests hot unplugging and the hardware device supports hot unplugging, thereby preventing unused hardware devices from occupying PCIE resources and helping to improve PCIE resource utilization.

[0023] In another possible implementation, when the hot plug request is a hot pull request, performing a hot plug configuration operation on the hardware device includes: stopping access to the hardware device.

[0024] In this implementation, when the hardware device requests hot unplugging and the hardware device supports hot plugging, access to the hardware device is stopped, thereby avoiding the processor continuing to access the hardware device after the hardware device is hot unplugged, resulting in the access process waiting and hanging due to not receiving a response from the hardware device for a long time, affecting the normal operation of the processor.

[0025] In another possible implementation, when the hot-plug request is a hot-unplug request, performing a hot-plug configuration operation on the hardware device includes: powering off the hardware device.

[0026] This implementation method powers off the hardware device when the hardware device requests hot unplugging and the hardware device supports hot plugging, so that the hardware device can be hot unplugged while powered off, which helps to avoid damage to the hardware device during hot unplugging and further helps to improve the reliability of hot unplugging the hardware device.

[0027] In another possible implementation, the method further includes: if the hot-plug identifier indicates that the hardware device does not support hot-plugging, outputting a prompt message, where the prompt message is used to indicate that the hardware device does not support hot-plugging.

[0028] This implementation method, when receiving a hot-plug request, outputs a prompt message to indicate that the hardware device does not support hot-plugging if the hot-plug identifier indicates that the hardware device does not support hot-plugging. On the one hand, it can inform the user that the current hardware device does not support hot-plugging, thereby preventing the user from hot-plugging a hardware device that does not support hot-plugging, causing the hardware device that does not support hot-plugging to work abnormally or be damaged after hot-plugging, affecting the application of the computer system, thereby helping to improve the reliability of hot-plugging of hardware devices. On the other hand, it can ensure that hot-plugging configuration operations are performed on the hardware device only when the hardware device supports hot-plugging. This helps to increase the probability that the hardware device can work normally on the computer system after hot-plugging, thereby helping to improve the reliability of hot-plugging of hardware devices.

[0029] In another possible implementation, the method further includes: if the hot plug indicator indicates that the hardware device does not support hot plugging, generating log information; the log information is used to record that the hardware device does not support hot plugging and / or the hardware device does not perform hot plugging.

[0030] This implementation generates log information when the plug-in identifier indicates that the hardware device does not support hot plugging, so as to facilitate use in system operation and maintenance.

[0031] In another possible implementation, when the hot-swap request is a hot-insert request, the method further includes: if the hot-swap flag indicates that the hardware device does not support hot-swap, powering off the hardware device.

[0032] This implementation method powers off the hardware device when the hardware device requests hot plugging and the hardware device does not support hot plugging. In this way, it can avoid the situation where the hardware device that does not support hot plugging malfunctions due to being used by the computer system after being erroneously hot plugged, thereby avoiding the normal application of the computer system being affected by the malfunction of the hardware device, and further helps to improve the reliability of hot plugging of the hardware device.

[0033] In another possible implementation, when the hot plug request is a hot insertion request, the method further includes: if the hot plug flag indicates that the hardware device does not support hot plugging, releasing PCIE resources allocated to the hardware device.

[0034] In this implementation, when a hardware device requests hot plugging and the hardware device does not support hot plugging, the PCIE resources allocated to the PCIE device are released. This can prevent currently unused hardware devices from occupying PCIE resources, thereby helping to improve the utilization of PCIE resources.

[0035] Another possible implementation method is that the processor is also communicated with the hardware slot; obtaining the hot plug identifier of the hardware device includes: obtaining a first hot plug identifier of the hardware slot, the first hot plug identifier is used to indicate whether the hardware slot supports hot plugging or not; if the first hot plug identifier indicates that the hardware slot supports hot plugging, obtaining the hot plug identifier of the hardware device.

[0036] In this implementation, a first hot-plug flag of the PCIE slot is first obtained. If the first hot-plug flag indicates that the PCIE slot supports hot-plugging, the hot-plug flag of the PCIE device is then obtained. Since the PCIE slot is a component of the computer system, and the PCIE device is a peripheral component, that is, whether the PCIE slot supports hot-plugging depends on the ability of the computer system itself. Therefore, it is first determined whether the PCIE slot supports hot-plugging. If the PCIE slot does not support hot-plugging, it is not necessary to determine whether the PCIE device supports hot-plugging. This helps improve operational efficiency compared to first determining whether the PCIE device supports hot-plugging and then determining whether the PCIE slot supports hot-plugging.

[0037] In a second aspect, a hot-plug device is provided, comprising: a functional unit for executing any one of the methods provided in the first aspect, wherein the actions executed by each functional unit are implemented through hardware or by hardware running corresponding software. For example, the hot-plug device may comprise: a receiving unit, an acquiring unit, and a processing unit; the receiving unit is configured to receive a hot-plug request; the hot-plug request is configured to request hot-plugging of a hardware device, wherein the driver of the hardware device includes a hot-plug identifier, and the hot-plug identifier is configured to indicate whether the hardware device supports hot-plugging or not; the acquiring unit is configured to acquire the hot-plug identifier of the hardware device; and the processing unit is configured to perform a hot-plug configuration operation on the hardware device if the hot-plug identifier indicates that the hardware device supports hot-plugging.

[0038] In a third aspect, a computer system is provided, comprising: a processor and a memory, wherein the processor is connected to the memory, the memory is used to store computer-executable instructions, and the processor executes the computer-executable instructions stored in the memory, thereby implementing any one of the methods provided in the first aspect.

[0039] In a fourth aspect, a chip is provided, comprising: a processor and an interface circuit; the interface circuit is configured to receive code instructions and transmit them to the processor; and the processor is configured to run the code instructions to execute any one of the methods provided in the first aspect.

[0040] In a fifth aspect, a computer-readable storage medium is provided, which stores computer execution instructions. When the computer execution instructions are run on a computer, the computer executes any one of the methods provided in the first aspect.

[0041] In a sixth aspect, a computer program product is provided, comprising: computer execution instructions, which, when executed on a computer, cause the computer to execute any one of the methods provided in the first aspect.

[0042] Among them, the technical effects brought about by any implementation method in the second to sixth aspects can refer to the technical effects brought about by different implementation methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] FIG1 is a schematic diagram of the structure of a computer system provided in an embodiment of the present application;

[0044] FIG2 is a schematic diagram of a hierarchical structure of a computer system provided in an embodiment of the present application;

[0045] FIG3 is a schematic diagram of a data structure of a hot plug identifier and hot plug configuration information provided in an embodiment of the present application;

[0046] FIG4 is a flow chart of a hot swap method provided in an embodiment of the present application;

[0047] FIG5 is a flow chart of a hot insertion method provided in an embodiment of the present application;

[0048] FIG6 is a flow chart of another hot plugging method provided in an embodiment of the present application;

[0049] FIG7 is a flow chart of a hot removal method provided in an embodiment of the present application;

[0050] FIG8 is a flow chart of another hot removal method provided in an embodiment of the present application;

[0051] FIG9 is a schematic structural diagram of a hot-swap device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0052] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0053] In the description of this application, unless otherwise specified, " / " indicates that the objects associated before and after are in an "or" relationship, for example, A / B can represent A or B; "and / or" in this application is merely a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural.

[0054] Furthermore, in the description of this application, unless otherwise specified, "plurality" means two or more than two. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or plural.

[0055] In addition, in order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. Those skilled in the art will understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit differences. At the same time, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or design schemes. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way for easy understanding.

[0056] The following is an exemplary introduction to the application scenarios of this application.

[0057] Hot swapping, or hot plugging, refers to the ability to insert or remove hardware devices from a computer system without shutting down the system's power without affecting its normal operation. Because hot swapping technology can improve the rapid maintainability of computer systems, it is widely used in the computer industry.

[0058] However, after the hardware devices on the computer system are hot-plugged, the hardware devices often fail to work properly or are damaged, resulting in low reliability of the hot-plugging of the hardware devices.

[0059] Therefore, how to improve the reliability of hot-swapping of hardware devices has become a technical problem that needs to be solved urgently.

[0060] In view of this, the present application provides a hot plug method, wherein the driver of the hardware device includes a hot plug identifier, and the hot plug identifier is used to indicate whether the hardware device supports hot plugging or not. When the processor receives a hot plug request, it determines whether the hardware device supports hot plugging by obtaining the hot plug identifier, and when the hot plug identifier indicates that the hardware device supports hot plugging, the processor performs a hot plug configuration operation on the hardware device based on the configuration information of the hardware device stored in the driver of the hardware device. In this way, on the one hand, it can ensure that the hot plug configuration operation is performed on the hardware device that supports hot plugging, which helps to ensure that the configuration of the PCIE device matches the hot plugging, thereby helping to improve the reliability of the hot plugging of the hardware device. On the other hand, based on the configuration information of the hardware device, the hot plug configuration operation is performed on the hardware device, which can make the hot plug process of the hardware device more complete, thereby ensuring that the current configuration of the hardware device matches the hot plugging, thereby avoiding damage to the PCIE device during hot plugging, or avoiding the inability to implement some functions of the hardware device due to incomplete configuration operations performed on the hardware device.

[0061] The following is a brief introduction to the relevant terms involved in this application.

[0062] Firmware: Code that runs on a device's chip and implements its functions. For example, network card firmware implements network connectivity, message transmission and reception, and protocol offloading.

[0063] Driver: Code that runs on an operating system (OS) and enables communication and interaction between the OS and the device. For example, a network card driver enables communication and data transfer between the OS and the network card, as well as configuration and status monitoring of the card.

[0064] Peripheral Component Interconnect Express (PCIE) slot: refers to a slot with a PCIE interface that complies with the PCIE protocol.

[0065] PCIE device: refers to a device with a PCIE interface.

[0066] The following is an exemplary introduction to the system architecture of this application.

[0067] As shown in FIG1 , it is a schematic diagram of the structure of a computer system provided by this application.

[0068] 1 , a computer system includes a central processing unit (CPU), a hot-swap controller, hardware slots, and hardware devices.

[0069] The hardware device is connected to the hardware slot through a plug-and-play connection. The CPU is connected to the hardware device through the hardware slot. The hot-swap controller is connected to the hardware device through the hardware slot. The hot-swap controller is also connected to the CPU.

[0070] In this application, the computer system may include a network device or a terminal device.

[0071] The network device may include a server, etc. The server may be a single physical or logical server, or may be two or more physical or logical servers that share different responsibilities and work together to implement various server functions.

[0072] The terminal device may include an ultra-mobile personal computer (UMPC), a tablet computer, a notebook computer, a netbook, a desktop computer, an all-in-one computer, etc.

[0073] In this application, the hardware device can be a plug-and-play device such as a PCIE device, a Universal Serial Bus (USB) device, a Serial Attached SCSI (SAS) device, or a Serial ATA (SATA) device.

[0074] It should be noted that, in the following, the hardware device will be used as a PCIE device to introduce this application.

[0075] It can be understood that when the hardware device is a PCIE device, the hardware slot is a PCIE slot.

[0076] In this application, a PCIE device can be a network card, a redundant array of independent disks (RAID) card, a PCI solid state disk (SSD), a graphics processing unit (GPU) card, a graphics card or an accelerator card, etc.

[0077] In this application, a computer system includes a hardware layer and a software layer. The software layer is the program code running on the hardware layer. The software layer can be divided into several layers, and the layers communicate with each other through software interfaces.

[0078] The hardware layer includes computer hardware such as the CPU, hot-swap controller, PCIE slots, and PCIE devices, as shown in Figure 1.

[0079] The software layer includes the application layer, operating system (OS) layer, and basic input and output system (BIOS) layer from top to bottom, as shown in Figure 2.

[0080] The BIOS layer is the most basic software code loaded into a computer's hardware system. It runs below the OS layer, configuring the hardware and preparing it for the OS to run.

[0081] The OS layer includes the OS program code and the PCIE device driver. The OS can be Linux, Windows, or VxWorks. The OS layer runs on the CPU, and the PCIE device driver runs within the OS.

[0082] In the present application, the OS may be stored in the hard disk of the computer system, or may be stored in a remote device for use during remote booting using a preboot execution environment (PXE).

[0083] When the computer system starts, the OS is loaded into the memory of the computer system and runs. After the OS starts, the driver of the PCIE device is loaded (i.e., runs).

[0084] It should be noted that the BIOS layer can also be referred to as BIOS, and the OS layer can also be referred to as OS. Based on this, the OS mentioned below can also be understood as the OS layer.

[0085] It can be understood that the driver of the PCIE device performs a certain operation (such as the driver of the PCIE device reads the hot plug flag) hereinafter, which can be considered as the driver running in the OS reading the hot plug flag during the process of the CPU running the OS.

[0086] The application layer includes a series of program codes that run the application.

[0087] In this application, the CPU module, OS, and PCIE device drivers can be collectively referred to as the CPU system. The CPU module includes the CPU, memory, flash memory (Flash) / non-volatile random access memory (NVRAM), etc. Alternatively, the CPU module can also be a separate CPU.

[0088] In this application, the computer system further includes a power supply device connected to the PCIE slot and configured to supply power to the PCIE slot and the PCIE device. The power supply device is further connected to a hot-swap controller, which is configured to control the power supply device to supply power to the PCIE slot and the PCIE device, or to control the power supply device to power off the PCIE device.

[0089] Illustratively, the power supply device may include a power controller and a power supply.

[0090] The power supply is connected to the PCIE slot to provide power to the PCIE device.

[0091] The power supply is connected to the power controller, and the power controller is connected to the hot-swap controller, so that the hot-swap controller controls the power supply to the PCIE slot and PCIE device through the power controller, or controls the power supply to power off the PCIE slot and PCIE device.

[0092] In the present application, the computer system includes a management controller connected to a hot-swap controller. The management controller is used to send a hot-plug request to the hot-swap controller, and the hot-plug request is used to request hot-plugging of a PCIE device.

[0093] Exemplarily, the management controller may include a monitoring management unit external to the computer device, a management system in a management chip external to the processor, a baseboard management controller (BMC), a system management module (SMM), etc. It should be noted that the embodiments of the present application do not limit the form of the management controller, and the above is only an example. In the following embodiments, the management controller is only described as a BMC.

[0094] It should be noted that different computer devices have different names for BMC. For example, some computer devices call it BMC, some computer devices call it iLO, and some computer devices call it iDRAC. Regardless of whether it is called BMC, iLO or iDRAC, it can be understood as the BMC in the embodiments of the present invention.

[0095] It should be noted that the system architecture and application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the evolution of the system architecture and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0096] For ease of understanding, the hot-swap method provided in this application is introduced below based on the system architecture mentioned above.

[0097] Hereinafter, in conjunction with FIG3 , an exemplary introduction is given on how to store the hot plug identification (Hot Plug Identification) and the hot plug configuration information.

[0098] In this application, the hot plug identification and hot plug configuration information can be stored in the driver of the PCIE device, and the driver of the PCIE device can be stored in the hard disk of the computer system or in the remote device. In other words, the hot plug identification and hot plug configuration information can be stored in the hard disk of the computer system or in the remote device.

[0099] The hot plug flag is used to indicate whether the PCIE device supports hot plugging or does not support hot plugging. Hot plugging includes hot insertion and hot removal. The PCIE device supports hot plugging, including the PCIE device supports hot plugging and hot removal. The PCIE device does not support hot plugging, including the PCIE device does not support hot plugging and hot removal.

[0100] Exemplarily, whether the PCIE device supports hot plugging can be determined based on the content of the hot plugging identifier. For example, if the hot plugging identifier is 1, it indicates that the PCIE device supports hot plugging; if the hot plugging identifier is 0, it indicates that the PCIE device does not support hot plugging.

[0101] It should be noted that this embodiment does not limit how the hot plug flag specifically indicates whether the PCIE device supports hot plugging, and the above example is only for illustrative purposes.

[0102] The hot plug configuration information includes a hot plug configuration identifier and configuration information of the PCIE device. The hot plug configuration identifier is used to indicate whether the driver of the PCIE device includes the configuration information or does not include the configuration information.

[0103] It can be understood that the existence of configuration information means that the driver of the PCIE device includes the configuration information of the PCIE device, and the absence of configuration information means that the driver of the PCIE device does not include the configuration information of the PCIE device.

[0104] In this application, the configuration information of the PCIE device includes one or more of the configuration information of the GPIO of the PCIE device, the configuration information of the register, the configuration information of the port mode and the configuration information of the optional read-only memory.

[0105] In this application, the configuration information of the PCIE device includes hot-plug configuration information and hot-plug configuration information.

[0106] The hot-plug configuration information is configuration information executed when the PCIE device supports hot-plugging. The configuration operation indicated by the hot-plug configuration information can be referred to as a hot-plug configuration operation. Specifically, it is a configuration operation performed on the PCIE device after the PCIE device is hot-plugged. The hot-unplug configuration information is configuration information executed when the PCIE device supports hot-unplugging. The configuration operation indicated by the hot-unplug configuration information can be referred to as a hot-unplug configuration operation. Specifically, it is a configuration operation performed on the PCIE device before the PCIE device is hot-unplugged.

[0107] Since the GPIO configuration, register configuration, port mode configuration and optional read-only memory configuration will affect the working safety and removal safety of the PCIE device, the GPIO configuration information, register configuration information, port mode configuration information and optional read-only memory configuration information are pre-stored in the driver of the PCIE device. When the PCIE device supports hot plugging, the configuration operations corresponding to these configuration information are executed, which helps to improve the reliability of hot plugging of hardware devices.

[0108] In this application, the driver of the PCIE device can be shared by multiple PCIE devices. For example, different models of PCIE devices from the same manufacturer can use the same driver. Based on this, the hot plug configuration information in the driver of the PCIE device can be shared by multiple PCIE devices.

[0109] Illustratively, the hot-swap identifier and hot-swap configuration information may be as shown in Table 1.

[0110] Table 1

[0111] As shown in Table 1, the driver for a PCIE device includes hot-plug identifiers and hot-plug configuration information for Device 1, ..., and Device N. The hot-plug identifiers and hot-plug configuration information for different devices can be searched using the PCI device identifier (PCI_ID). In other words, the hot-plug identifiers and hot-plug configuration information for different PCIE devices can be found using the PCI_ID as an index.

[0112] The PCI_ID includes the vendor ID (Vendor ID), device ID (Device ID), sub-vendor ID (SubVendor ID), subsystem ID (SubSystem ID), etc.

[0113] The Setting Data Pointer field stores pointers to the various Setting Data areas of the PCIE device, i.e., offset addresses. The PCIE device's configuration information can be stored in the PCIE device driver in the form of code (e.g., a subroutine or function), a configuration script, or commands. In Table 1, the configuration information pointer (i.e., offset address) is used to point to the storage area for these codes and commands. A schematic diagram of the actual storage area of ​​the configuration information is shown in Figure 3.

[0114] In this application, the driver of the PCIE device can directly run the code, script, command, etc. stored in the configuration information area, thereby completing the configuration operation indicated by the configuration information of the PCIE device, and then completing the hot plug of the PCIE device normally.

[0115] Hereinafter, in conjunction with FIG4 , an embodiment of the hot-swap method of the present application will be exemplarily introduced.

[0116] Fig. 4 is a flow chart showing a hot swap method according to an exemplary embodiment. Exemplarily, the hot swap method includes the following steps S401-S405.

[0117] S401: The CPU receives a hot plug request, where the hot plug request is used to request hot plugging of a PCIE device.

[0118] The hot plug request includes a hot insert request or a hot pull request. The hot plug request is used to request hot plugging, and the hot pull request is used to request hot pull out.

[0119] In this embodiment, if the hot-swap controller detects that a PCIE device is hot-plugged into a PCIE slot, the hot-swap controller sends a hot-plug request to the CPU.

[0120] Exemplarily, the hot-plug request includes a slot identifier and a first event identifier, wherein the slot identifier is used to indicate a PCIE slot, and the slot identifier has a unique correspondence with the PCIE slot, and the first event identifier is used to indicate a hot-plug event of a PCIE device in the PCIE slot corresponding to the slot identifier.

[0121] Exemplarily, after a PCIE device is inserted into a PCIE slot, the PCIE slot generates a presence signal. When the hot-swap controller detects the presence signal, it can determine that the PCIE device is inserted into the PCIE slot and sends a hot-plug request to the CPU.

[0122] It should be noted that, since the hot-plug request is sent after the PCIE device is inserted into the PCIE slot, the hot-plug request can also be considered as a request by the PCIE device for hot-plugging.

[0123] In this embodiment, if the hot-swap controller receives the hot-swap notification, the hot-swap controller sends a hot-swap request to the CPU.

[0124] Exemplarily, the hot unplug request includes a slot identifier and a second event identifier, wherein the second event identifier is used to indicate a hot unplug event of a PCIE device in the PCIE slot corresponding to the slot identifier.

[0125] There are multiple implementations for how the hot-swap controller receives the hot-plug notification. The following uses methods a and b for exemplary description.

[0126] Method a: The hot-swap controller receives a hot-plug notification sent by the PCIE slot.

[0127] In this method, the computer system includes a notification button that corresponds to a PCIE slot. The notification button can be located on a motherboard of the computer system. The notification button includes a trigger state that indicates sending a hot unplug notification, for example, sending a hot unplug notification to a hot plug controller.

[0128] When the user needs to unplug the PCIE device from the PCIE slot, the user sets the notification button to a trigger state, for example, by pressing the notification button to put the notification button in a trigger state, so that the PCIE slot corresponding to the notification button sends a hot unplug notification to the hot plug controller.

[0129] Method 2: The hot-swap controller receives the hot-plug notification sent by the management controller.

[0130] In this method, the client of the management controller includes a notification control, which is used to instruct to send a hot unplug notification.

[0131] When a user needs to unplug a PCIE device from a PCIE slot, the user logs in to the client of the management controller through an electronic device, enters the slot identifier, and performs a trigger operation on the notification control, for example, clicking the notification control. The management controller obtains the slot identifier in response to the user's trigger operation and input operation on the notification control, and sends a hot unplug notification to the hot plug controller. The hot unplug notification includes the slot identifier, and the slot identifier is used to indicate the PCIE slot. The hot unplug notification is used to notify that the PCIE device on the PCIE slot indicated by the slot identifier is to be hot unplugged.

[0132] It should be noted that, since the hot unplug request is sent before the PCIE device is unplugged from the PCIE slot, the hot unplug request can also be considered as a request to hot unplug the PCIE device.

[0133] S402: The CPU obtains a hot plug flag of the PCIE device.

[0134] In this embodiment, after receiving the hot plug request, the CPU obtains or checks the hot plug identifier of the PCIE device in the driver of the PCIE device in response to the hot plug request.

[0135] Exemplarily, while the CPU is running the OS, the hot plug flag in the hard disk or remote device of the computer system is obtained or viewed through the driver of the PCIE device running in the OS.

[0136] S403: The CPU determines whether the PCIE device supports hot plugging according to the hot plugging flag.

[0137] If the determination result is yes, execute S404; if the determination result is no, execute S405.

[0138] In this embodiment, whether the PCIE device supports hot plugging can be determined based on the content of the hot plugging flag. For example, if the hot plugging flag is 1, it indicates that the PCIE device supports hot plugging, and if the hot plugging flag is 0, it indicates that the PCIE device does not support hot plugging.

[0139] S404: The CPU performs a hot plug configuration operation on the PCIE device.

[0140] In this application, if the PCIE device supports hot plugging, hot plugging of the PCIE device is allowed, that is, the PCIE device is allowed to be hot plugged into the PCIE slot, or hot unplugged from the PCIE slot.

[0141] In this embodiment, if the hot plug request is a hot insert request, S404 can be considered as "performing a hot plug configuration operation on the PCIE device." If the hot plug request is a hot unplug request, S404 can be considered as "performing a hot unplug configuration operation on the PCIE device."

[0142] Exemplarily, if the hot plug request is a hot insert request and the PCIE device supports hot plugging, the PCIE device is allowed to be inserted into the PCIE slot while the computer system is powered on. If the hot plug request is a hot unplug request and the PCIE device supports hot plugging, the PCIE device is allowed to be unplugged from the PCIE slot while the computer system is powered on.

[0143] It should be noted that, regarding the specific implementation method of performing hot-plug configuration operations on PCIE devices, please refer to S507-S508 and S610-S611 in the following embodiments. Regarding the specific implementation method of performing hot-plug configuration operations on PCIE devices, please refer to S704-S709 and S806-S811 in the following embodiments, which will not be repeated here.

[0144] Optionally, S405: output prompt information, where the prompt information is used to indicate that the PCIE device does not support hot plugging.

[0145] In this application, if the PCIE device does not support hot plugging, hot plugging of the PCIE device should be prohibited, that is, the PCIE device is not allowed to be hot plugged into the PCIE slot or hot unplugged from the PCIE slot.

[0146] In other words, if the hot plug request is a hot insert request and the PCIE device does not support hot plugging, the PCIE device is not allowed to be inserted into the PCIE slot when the computer system is not powered off. If the hot plug request is a hot unplug request and the PCIE device does not support hot plugging, the PCIE device is not allowed to be unplugged from the PCIE slot when the computer system is not powered off.

[0147] It is understandable that if the CPU prohibits the PCIE device from performing hot unplugging, the power supply device should continue to supply power to the PCIE device.

[0148] It should be noted that regarding the specific implementation method of prohibiting PCIE devices from performing hot insertion, please refer to S509-S512 and S612-S616 in the following embodiments. Regarding the specific implementation method of prohibiting PCIE devices from performing hot unplugging, please refer to S710-S711 and S812-S813 in the following embodiments, which will not be repeated here.

[0149] In the above embodiment, after receiving a hot-plug request, the hot-plug request is used to request hot-plugging of a PCIE device. A hot-plug identifier is used to determine whether the PCIE device supports hot-plugging. If the hot-plug identifier indicates that the PCIE device supports hot-plugging, a hot-plug configuration operation is performed on the PCIE device, allowing the PCIE device to be hot-plugged. Otherwise, the PCIE device is not allowed to be hot-plugged, and a prompt message is output to indicate that the PCIE device does not support hot-plugging. On the one hand, this can prevent a PCIE device that does not support hot-plugging from being incorrectly hot-plugged, causing the PCIE device that does not support hot-plugging to operate abnormally after hot-plugging, affecting the application of the computer system, and thus helping to improve the reliability of hot-plugging of hardware devices. On the other hand, it can ensure that the hot-plug configuration operation is performed on the PCIE device only when the PCIE device supports hot-plugging, which helps to increase the probability that the PCIE device can operate normally after hot-plugging, and thus helps to improve the reliability of hot-plugging of hardware devices.

[0150] The following is an exemplary introduction to the hot plugging method provided in this application with reference to FIG5 .

[0151] Fig. 5 is a flow chart showing a hot-plugging method according to an exemplary embodiment. Exemplarily, the hot-plugging method includes the following steps S501-S512.

[0152] S501: In response to detecting that a PCIE device is inserted into a PCIE slot, the hot-swap controller sends a hot-plug request to the CPU.

[0153] It should be noted that for the relevant description of S501, please refer to the above S401 and will not be repeated here.

[0154] Optionally, S502: the CPU sends a power-on notification to the hot-swap controller in response to the received hot-plug request.

[0155] The power-on notification is used to notify the hot-swap controller to power on the PCIE device.

[0156] In this embodiment, the CPU forwards the power-on notification to the hot-swap controller to instruct the hot-swap controller to power on the PCIE slot, thereby powering on the PCIE device.

[0157] Optionally, S503: the hot-swap controller powers on the PCIE device in response to the power-on notification.

[0158] In this embodiment, the hot-swap controller sends a power-on instruction to the power supply device, where the power-on instruction is used to instruct the power supply device to power on the PCIE slot. Exemplarily, the hot-swap controller sends the power-on instruction to the power controller of the power supply device, and the power controller responds to the power-on instruction and controls the power supply to power on the PCIE slot.

[0159] It should be noted that S502-S503 are optional steps. In this embodiment, S502-S503 may not be executed, but S504 may be executed directly after S501.

[0160] S504: The CPU runs the driver of the PCIE device.

[0161] In this embodiment, after the PCIE device is powered on, the CPU runs the driver of the PCIE device to read or view the hot plug flag in the driver of the PCIE device.

[0162] Exemplarily, when the CPU is running the OS, the OS runs the driver of the PCIE device. The driver of the PCIE device runs in the OS, so that the hot plug flag in the driver of the PCIE device can be read or viewed.

[0163] S505: The CPU obtains a hot plug flag of the PCIE device.

[0164] In this embodiment, after the CPU runs the driver of the PCIE device, it obtains or checks the hot plug flag in the driver of the PCIE device.

[0165] It should be noted that for other relevant instructions of S505, please refer to the relevant instructions in S402, which will not be repeated here.

[0166] It should be noted that S504-S505 can be considered as a specific implementation of S402.

[0167] S506: The CPU determines whether the PCIE device supports hot plugging according to the hot plugging flag.

[0168] If the determination result is yes, then execute S507 - S508 ; if the determination result is no, then execute S509 - S512 .

[0169] It should be noted that for the relevant description of S506, reference can be made to the above-mentioned S403, which will not be repeated here.

[0170] Optionally, S507: the CPU determines, according to the hot plug configuration identifier, whether the driver of the PCIE device includes hot plug configuration information.

[0171] If the determination result is yes, then execute S508. If the determination result is no, then end.

[0172] In this embodiment, when the PCIE device supports hot plugging, the CPU obtains or checks the plug configuration identifier in the driver of the PCIE device, and determines whether the driver of the PCIE device includes hot plug configuration information according to the hot plug configuration identifier.

[0173] Exemplarily, during the process of the CPU running the OS, the hot plug configuration identifier in the hard disk or remote device of the computer system is obtained or checked through the driver of the PCIE device running in the OS, so as to determine whether the driver of the PCIE device includes hot plug configuration information based on the hot plug configuration identifier.

[0174] S508: The CPU performs the hot plug configuration operation indicated by the hot plug configuration information on the PCIE device.

[0175] The hot-plug configuration operation includes at least one configuration operation among a plurality of configuration operations that the PCIE device needs to execute when the computer system is powered on.

[0176] In this embodiment, the hot-plug configuration information includes one or more of the configuration information of the register of the PCIE device, the configuration information of the port mode, and the configuration information of the optional read-only memory.

[0177] It should be noted that the hot-plug configuration information of different PCIE devices may be the same or different. The above description is only an example and is not limited in this embodiment.

[0178] Since the hot-plug configuration information is pre-stored in the driver of the PCIE device, if part of the configuration information needs to be configured after the PCIE device is powered on so that the PCIE device can work normally on the computer system, then the part of the configuration information can be used as the hot-plug configuration information and stored in the driver of the PCIE device.

[0179] In this embodiment, the CPU obtains the hot plug configuration information in the driver of the PCIE device and performs the hot plug configuration operation indicated by the hot plug configuration information on the PCIE device, so that the PCIE device completes the hot plug configuration operation normally, thereby allowing the PCIE device to work normally on the computer system.

[0180] Exemplarily, during the CPU running the OS, the hot plug configuration information in the hard disk or remote device of the computer system is obtained through the driver of the PCIE device running in the OS, and the hot plug configuration operation indicated by the hot plug configuration information is performed on the PCIE device.

[0181] During the normal power-up and initialization of a computer system, PCIE devices are powered on along with the computer system. While the CPU is running the BIOS, the BIOS performs multiple configuration operations on the PCIE devices to enable them to operate normally on the computer system. However, when a PCIE device is hot-plugged into a PCIE slot while the computer system is already operating normally, the CPU is no longer running the BIOS, meaning the BIOS cannot perform configuration operations on the PCIE devices.

[0182] Based on this, when a PCIE device is hot-plugged into a PCIE slot, by executing the hot-plug configuration operation indicated by the hot-plug configuration information, the configuration completeness and accuracy of the PCIE device can be guaranteed after the PCIE device is powered on, thereby avoiding abnormal operation of the PCIE device or inability to implement some functions due to incomplete configuration of the PCIE device, thereby helping to more perfectly control the hot-plug configuration operation, and further helping to further improve the reliability of hot-plugging of hardware devices.

[0183] In the following, S508 is exemplarily described by taking the PCIE device as a network card, such as an Ethernet card (Ethernet, Eth), and the driver of the network card including the configuration information of the port mode as an example.

[0184] For example, an Eth network card supports virtualization (VF). Some parameters of the virtualization function can be configured through registers, such as the number of VFs, the number of teams assigned to each VF, and the amount of memory required by each VF. When the Eth network card is hot-inserted into a slot, the PCIE device configures the virtualization function registers to ensure that the Eth network card is fully functional after hot-slot insertion and can operate normally. Otherwise, the virtualization function cannot be used normally.

[0185] It should be noted that S507 - S508 can be considered as a specific implementation of "performing a hot-plug configuration operation on a PCIE device" in S403.

[0186] In this embodiment, the computer system may further include a first indicator light, the first indicator light being used to indicate the hot plug status of the PCIE device. The hot plug status includes one or more of a first state, a second state, and a third state. The first state indicates that the PCIE device is operating normally. The second state indicates that hot plug configuration information or hot unplug configuration information is being executed on the PCIE device. The third state indicates that the PCIE device can be removed from the PCIE slot.

[0187] For example, the first state can be indicated by the first indicator light being constantly on, the second state can be indicated by the first indicator light flashing, and the third state can be indicated by the first indicator light being constantly off. It should be noted that this embodiment does not limit how the first indicator light indicates the first state, the second state, and the third state; the above is merely an example.

[0188] It is understandable that when hot unplugging configuration information is executed on a PCIE device, the PCIE device cannot be unplugged from the PCIE slot.

[0189] For example, the first indicator light can be installed on a mainboard of a computer system or a PCIE device. It should be noted that this embodiment does not limit the installation position of the first indicator light, and the above is only an example.

[0190] Optionally, S509: the CPU outputs prompt information, where the prompt information is used to indicate that the PCIE device does not support hot plugging.

[0191] In this embodiment, there are multiple implementation methods for outputting prompt information. Methods A to C are used as examples below.

[0192] Method A: The OS outputs a prompt message.

[0193] In this manner, while the CPU is running the OS, the OS prints a system message, which includes prompt information, thereby outputting the prompt information.

[0194] Exemplarily, the OS prints a system message, which may be a pop-up system message on the OS interface.

[0195] Method B: The management controller outputs prompt information.

[0196] In this manner, the CPU sends prompt information to the management controller. After receiving the prompt information, the management controller sends the prompt information to the client of the management controller, and the client of the management controller outputs the prompt information.

[0197] Mode C: The indicator light outputs prompt information.

[0198] In this embodiment, the computer system includes a second indicator light, which is used to indicate that the PCIE device does not support hot plugging. For example, when the second indicator light is in a flashing state or a permanently lit state, it indicates that the PCIE device does not support hot plugging.

[0199] For example, the initial state of the second indicator light is always off. After the user inserts the PCIE device into the PCIE slot, the user finds that the second indicator light switches to always on or flashing. At this time, the user can determine that the PCIE device does not support hot plugging.

[0200] For example, the second indicator light can be installed on the mainboard of the computer system or on a PCIE device. It should be noted that this embodiment does not limit the installation position of the second indicator light, and the above is only an example.

[0201] In the above embodiment, prompt information is output through methods A to C, which not only helps to improve the output diversity of prompt information, but also can accurately present the hot plug status of the PCIE device, notifying the user that the PCIE device does not support hot plugging, so that the user can replace the PCIE device in time, avoiding the user from hot plugging a PCIE device that does not support hot plugging, causing the hardware device that does not support hot plugging to work abnormally after hot plugging, affecting the application of the computer system, thereby helping to improve the reliability of hot plugging of hardware devices.

[0202] Optionally, S510: the CPU generates log information, where the log information is used to record that the PCIE device does not support hot plugging and / or the PCIE device does not perform hot plugging.

[0203] In this embodiment, while the CPU is running the OS, the OS generates log information (also called OS log) for recording that the PCIE device does not support hot plugging and / or the PCIE device does not perform hot plugging, so as to facilitate system operation and maintenance.

[0204] Exemplarily, the log information may be stored in a storage medium of the computer system, for example, in a hard disk of the computer system.

[0205] Optionally, S511: the CPU sends a power-off notification to the hot-swap controller, where the power-off notification is used to notify that the PCIE device is powered off.

[0206] In this embodiment, while the CPU is running the OS, the OS sends a power-off notification to the CPU, which forwards the power-off notification to the hot-swap controller to instruct the hot-swap controller to power off the PCIE slot, thereby powering off the PCIE device.

[0207] Optionally, S512: the hot-swap controller powers off the PCIE device in response to the power-off notification.

[0208] In this embodiment, the hot-swap controller sends a power-off instruction to the power supply device, where the power-off instruction is used to instruct the power supply device to power off the PCIE slot. Exemplarily, the hot-swap controller sends the power-off instruction to the power supply controller of the power supply device, and the power supply controller responds to the power-off instruction and controls the power supply to power off the PCIE slot.

[0209] In this embodiment, when the PCIE device does not support hot plugging, the PCIE device is powered off. In this way, the PCIE device that does not support hot plugging can be prevented from malfunctioning due to being used by the computer system after being incorrectly hot plugged, thereby avoiding affecting the normal application of the computer system due to the malfunction of the PCIE device, and further helping to improve the reliability of hot plugging of hardware devices.

[0210] The hot-plug method described in the above embodiment is a solution for managing hot-plugging of PCIE devices based on whether the PCIE device supports hot-plugging. Below, in conjunction with FIG6 , another hot-plug method provided by the present application is exemplarily described. Unlike the above embodiment, this embodiment manages hot-plugging of PCIE devices based on whether the PCIE device supports hot-plugging and whether the PCIE slot supports hot-plugging.

[0211] Fig. 6 is a flow chart showing a hot-plugging method according to an exemplary embodiment. Exemplarily, the hot-plugging method includes the following steps S601-S616.

[0212] S601: See above S501.

[0213] S602: The CPU determines whether the PCIE slot supports hot plugging in response to the hot plug request.

[0214] If the determination result is no, then execute S603. If the determination result is yes, then execute S604.

[0215] In this embodiment, after receiving the hot plug request, the CPU obtains a first hot plug flag of the PCIE slot in response to the hot plug request. The first hot plug flag is used to indicate whether the PCIE slot supports hot plugging or not. Based on this, the CPU can determine whether the PCIE slot supports hot plugging based on the obtained first hot plug flag.

[0216] Exemplarily, after receiving the hot plug request, the CPU forwards the hot plug request to the OS. During the process of the CPU running the OS, the OS responds to the hot plug request and determines whether the PCIE slot supports hot plugging.

[0217] Exemplarily, the OS reads a slot capability register of the PCIE slot, which includes a hot plug flag, which is used to indicate whether the PCIE slot is hot pluggable. For example, when the hot plug flag is 1, it indicates that the PCIE slot supports hot plugging, and when it is 0, it indicates that the PCIE slot does not support hot plugging.

[0218] S603: The CPU outputs first prompt information, where the first prompt information is used to indicate that the PCIE slot does not support hot plugging.

[0219] It should be noted that for the relevant description of S603, reference can be made to the above-mentioned S509, which will not be repeated here.

[0220] In this embodiment, the first output prompt information is used to notify the user that the PCIE slot does not support hot plugging. In this way, the user can detect the slot configuration of the computer system based on the first prompt information, which helps the user to replace the slot used by the PCIE device in time, so as to configure the computer system with a slot that supports hot plugging.

[0221] Optionally, S604: the CPU sends a power-on notification to the hot-swap controller, where the power-on notification is used to notify the PCIE device to power on.

[0222] It should be noted that for the relevant description of S604, reference can be made to the above-mentioned S502, which will not be repeated here.

[0223] Optionally, S605: see above S503.

[0224] Optionally, S606: the CPU allocates PCIE resources to the PCIE device.

[0225] PCIE resources include memory, bus, device, and function numbers. Allocating memory, bus, device, and function numbers to PCIE devices allows the OS and the application layer running on it to interact with the PCIE devices.

[0226] In this embodiment, while the CPU is running the OS, the OS enumerates the PCIE devices and allocates PCIE resources to the PCIE devices. The OS then writes the bus number, device number, and function number into the basic configuration space of the PCIE devices for subsequent communication.

[0227] Exemplarily, enumerating the PCIE devices may include reading register configuration information on the PCIE devices. For example, the register configuration information may include a vendor ID, a device ID, and the like.

[0228] S607-S611: See above S504-S508.

[0229] S612: The CPU releases the PCIE resources allocated to the PCIE device.

[0230] In this embodiment, while the CPU is running the OS, the OS releases the PCIE resources allocated to the PCIE device. After the OS releases the PCIE resources allocated to the PCIE device, the memory space can be reallocated to other applications or other PCIE devices, and the PCIE address can be reallocated to other PCIE devices. This prevents unused PCIE devices from occupying PCIE resources, thereby improving PCIE resource utilization.

[0231] S613-S616: See above S509-S512.

[0232] In the above embodiment, when a hot plug request is received, it is first determined whether the PCIE slot supports hot plugging. If it does, it is determined whether the PCIE device supports hot plugging. Otherwise, a prompt message indicating that the PCIE slot does not support hot plugging is output. In this way, it is possible to avoid hot plugging the PCIE device into the PCIE slot when the PCIE slot does not support hot plugging but the PCIE device supports hot plugging, resulting in the PCIE device being unable to work normally after the PCIE device is hot plugged into the PCIE slot, thereby helping to improve the reliability of hot plugging of hardware devices.

[0233] In addition, since the PCIE slot is a component of the computer system, and the PCIE device is a peripheral component, that is to say, whether the PCIE slot supports hot plugging belongs to the ability of the computer system itself. Therefore, it is necessary to first determine whether the PCIE slot supports hot plugging. If the PCIE slot does not support hot plugging, there is no need to determine whether the PCIE device supports hot plugging. Compared with first determining whether the PCIE device supports hot plugging and then determining whether the PCIE slot supports hot plugging, it helps to improve operational efficiency.

[0234] The above embodiment describes the solution of the hot plugging method. The following is an exemplary description of the hot unplugging solution with reference to FIG7 .

[0235] Fig. 7 is a flow chart showing a hot unplugging method according to an exemplary embodiment. Exemplarily, the hot unplugging method includes the following steps S701-S711.

[0236] S701: The hot-swap controller sends a hot-swap request to the CPU in response to the received hot-swap notification.

[0237] It should be noted that for the relevant description of S701, please refer to the above S401 and will not be repeated here.

[0238] S702: The CPU obtains a hot plug flag of the PCIE device.

[0239] It should be noted that for the relevant description of S702, please refer to S402 and will not be repeated here.

[0240] S703: The CPU determines whether the PCIE device supports hot plugging according to the hot plugging flag.

[0241] If the determination result is yes, then S704 to S708 are executed. If the determination result is no, then S709 to S710 are executed.

[0242] It should be noted that for the relevant description of S703, reference can be made to the above-mentioned S403, which will not be repeated here.

[0243] Optionally, S704: the CPU determines, according to the hot plug configuration identifier, whether the driver of the PCIE device includes hot plug configuration information.

[0244] If the determination result is yes, execute S705; if the determination result is no, execute S706.

[0245] In this embodiment, when the PCIE device supports hot plugging, the CPU obtains or checks the plug configuration identifier in the driver of the PCIE device, and determines whether the driver of the PCIE device includes hot plug configuration information according to the hot plug configuration identifier.

[0246] Exemplarily, during the process of the CPU running the OS, the hot plug configuration identifier in the hard disk or remote device of the computer system is obtained or viewed by the driver of the PCIE device running in the OS to determine whether the PCIE device includes hot plug configuration information based on the hot plug configuration identifier.

[0247] In this embodiment, the hot plug configuration identifier is used to determine whether the driver of the PCIE device includes hot plug configuration information. If the determination result is yes, the program is executed; otherwise, the program is not executed. Compared with directly reading the driver of the PCIE device and executing the program when the hot plug configuration information is read, this helps to save program processing overhead.

[0248] S705: The CPU performs the hot unplug configuration operation indicated by the hot unplug configuration information on the PCIE device.

[0249] The hot unplug configuration operation is used to modify the configuration of the PCIE device.

[0250] In this embodiment, the hot-plug configuration information includes one or more of GPIO configuration information, register configuration information, port mode configuration information, and optional read-only memory configuration information of the PCIE device.

[0251] It should be noted that the hot-plug configuration information of different PCIE devices may be the same or different. The above description is merely an example and is not limited in this embodiment.

[0252] In this embodiment, the CPU obtains the hot unplug configuration information in the driver of the PCIE device, and performs the hot unplug configuration operation indicated by the hot unplug configuration information on the PCIE device, so that before the PCIE device is hot unplugged, the configurations that may cause damage to the PCIE device can be modified, which helps to ensure that the modified configuration of the PCIE device matches the hot unplugging, thereby helping to avoid the impact on the PCIE device when the PCIE device is powered off and unplugged due to problems with the PCIE configuration, such as causing damage to the PCIE device when it is hot unplugged, thereby helping to improve the reliability of hot plugging of hardware devices.

[0253] Exemplarily, while the CPU is running the OS, the hot unplug configuration information in the hard disk or remote device of the computer system is obtained through the driver of the PCIE device running in the OS, and the hot unplug configuration operation indicated by the hot unplug configuration information is performed on the PCIE device.

[0254] Hereinafter, S705 will be exemplarily described by taking the case where the hot-plug configuration information includes GPIO configuration information as an example.

[0255] In this embodiment, the PCIE device includes a controller, GPIO, a management module, and an environmental monitoring module. The controller is connected to the management module and the environmental monitoring module via the GPIO. For example, the connection can be achieved by configuring the GPIO as an inter-integrated circuit (I2C) interface. The management module includes management information such as the board type and version number. The environmental monitoring module includes monitoring information such as ambient temperature.

[0256] In this embodiment, the power supply device includes a main power supply and an auxiliary power supply. The main power supply is used to power the controller, and the auxiliary power supply is used to power the management module and the environment monitoring module.

[0257] In related technology, if a PCIE device supports hot-plugging, when the hot-swap controller powers off the PCIE device, it only shuts off the main power supply while maintaining the auxiliary power supply. This means that the management module and environmental monitoring module continue to be powered and operational. Consequently, when the PCIE device is hot-plugged from the PCIE slot, the GPIOs connecting the controller to the management module and environmental monitoring module are susceptible to current backflow and voltage spikes, posing a risk of port latching or even damage.

[0258] Based on this, before the PCIE device is hot-plugged from the PCIE slot, GPIO configuration operations are performed on the PCIE device according to the GPIO configuration information, such as turning off the GPIO or setting the GPIO to a high-impedance state, thereby preventing the GPIO port of the PCIE device from being damaged when the PCIE device is hot-plugged from the PCIE slot, thereby preventing the PCIE device from being damaged during hot-plugging, and thus improving the reliability of hot-plugging the hardware device.

[0259] It should be noted that S704-S705 can be considered as a specific implementation of the hot unplug configuration operation on the PCIE device in S404.

[0260] Optionally, S706: the CPU stops accessing the PCIE device.

[0261] In this embodiment, when the hot-plug flag indicates that the PCIE device supports hot-plugging, the PCIE device driver is silenced so that the PCIE device driver no longer accesses the PCIE device. In other words, the PCIE device driver no longer performs read and write communications with the PCIE device, thereby causing the CPU to stop accessing the PCIE device. This helps prevent the OS from continuing to access the PCIE device through the PCIE device driver after the PCIE device is hot-plugged, resulting in the access process being stuck due to a long period of not receiving a response from the PCIE device, thus affecting the normal operation of the OS.

[0262] It should be noted that S706 can be considered as a specific implementation of the hot unplug configuration operation on the PCIE device in S404.

[0263] Optionally, S707: the CPU releases PCIE resources allocated to the PCIE device.

[0264] It should be noted that for the relevant description of S707, reference can be made to the above-mentioned S612, which will not be repeated here.

[0265] It should be noted that S707 can be considered as a specific implementation of the hot unplug configuration operation on the PCIE device in S404.

[0266] S708: The CPU sends a power-off notification to the hot-swap controller, where the power-off notification is used to notify the PCIE device to power off.

[0267] It should be noted that for the relevant description of S708, reference can be made to the above-mentioned S511, which will not be repeated here.

[0268] S709: The hot-swap controller powers off the PCIE device in response to the power-off notification.

[0269] It should be noted that for the relevant description of S709, reference can be made to the above-mentioned S512, which will not be repeated here.

[0270] It should be noted that S708-S709 can be considered as a specific implementation of the hot unplug configuration operation on the PCIE device in S404.

[0271] Optionally, S710: the CPU outputs a prompt message, where the prompt message is used to prompt that the PCIE device does not support hot plugging.

[0272] It should be noted that for the relevant description of S710, reference can be made to the above-mentioned S509, which will not be repeated here.

[0273] It should be noted that S710 can be considered as a specific implementation method of prohibiting the PCIE device from performing hot unplugging in S405.

[0274] Optionally, S711: the CPU generates log information, where the log information is used to record that the PCIE device does not support hot plugging and / or the hardware device does not perform hot plugging.

[0275] It should be noted that for the relevant description of S711, reference can be made to the above-mentioned S510, which will not be repeated here.

[0276] It should be noted that S711 can be considered as a specific implementation method of prohibiting the PCIE device from performing hot unplugging in S405.

[0277] The hot unplug method described in the above embodiment is a solution for managing hot unplugging of PCIE devices based on whether the PCIE device supports hot plugging. Below, in conjunction with Figure 8, another hot unplug method provided by this application is exemplarily described. Unlike the above embodiment, this embodiment manages hot unplugging of PCIE devices based on whether the PCIE device supports hot plugging and whether the PCIE slot supports hot plugging.

[0278] Fig. 8 is a flow chart showing a hot unplugging method according to an exemplary embodiment. Exemplarily, the hot unplugging method includes the following steps S801-S813.

[0279] S801: See above S701.

[0280] S802: The CPU determines whether the PCIE slot supports hot plugging in response to the hot plugging request.

[0281] If the determination result is no, then execute S803. If the determination result is yes, then execute S804.

[0282] It should be noted that for the relevant description of S802, reference can be made to the above-mentioned S602. The principles of the two are the same and will not be repeated here.

[0283] S803: The CPU outputs a first prompt message, where the first prompt message is used to prompt that the PCIE slot does not support hot plugging.

[0284] It should be noted that for the relevant description of S803, reference can be made to the above-mentioned S603, which will not be repeated here.

[0285] S804-S813: See above S702-S711.

[0286] In the above embodiment, when a hot-plug notification is received, it is first determined whether the PCIE slot supports hot-plugging. If so, it is determined whether the PCIE device supports hot-plugging. Otherwise, a prompt message indicating that the PCIE slot does not support hot-plugging is output. In this way, it is possible to avoid hot-plugging the PCIE device from the PCIE slot when the PCIE slot does not support hot-plugging but the PCIE device supports hot-plugging, thereby helping to improve the reliability of hot-plugging of hardware devices.

[0287] In addition, since the PCIE slot is a component of the computer system, and the PCIE device is a peripheral component, that is to say, whether the PCIE slot supports hot plugging belongs to the ability of the computer system itself. Therefore, it is necessary to first determine whether the PCIE slot supports hot plugging. If the PCIE slot does not support hot plugging, there is no need to determine whether the PCIE device supports hot plugging. Compared with first determining whether the PCIE device supports hot plugging and then determining whether the PCIE slot supports hot plugging, it helps to improve operational efficiency.

[0288] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of method. In order to realize the above functions, the hot-swap device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0289] The embodiment of the present application can exemplarily divide the functional modules of the hot-swappable device according to the above method. For example, the hot-swappable device can include functional modules corresponding to the functional divisions, or two or more functions can be integrated into one processing module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical functional division. In actual implementation, there may be other division methods.

[0290] Exemplarily, FIG9 shows a possible structural diagram of the hot-plug device involved in the above embodiment (denoted as hot-plug device 900). The action performed by the hot-plug device 900 is implemented by the processor of the computer system or by the processor executing the corresponding software. The computer system includes a hardware device. The driver of the hardware device includes a hot-plug identifier. The hot-plug identifier is used to indicate whether the hardware device supports hot-plugging or not. The hot-plug device 900 includes a receiving unit 901, an acquisition unit 902 and a processing unit 903. The receiving unit 901 is used to receive a hot-plug request; the hot-plug request is used to indicate that the hardware device requests hot-plugging. For example, as shown in S401 of FIG4. The acquisition unit 902 is used to obtain the hot-plug identifier of the hardware device. For example, as shown in S402 of FIG4. The processing unit 903 is used to perform a hot-plug configuration operation on the hardware device if the hot-plug identifier indicates that the hardware device supports hot-plugging. For example, as shown in S403-S404 of FIG4.

[0291] Optionally, the processing unit 903 is specifically configured to: obtain configuration information of the hardware device included in a driver of the hardware device; and perform a configuration operation indicated by the configuration information of the hardware device on the hardware device.

[0292] Optionally, the configuration information of the hardware device includes one or more of configuration information of a general purpose input / output port (GPIO) of the hardware device, configuration information of a register, configuration information of a port mode, and configuration information of an optional read-only memory (ROM).

[0293] Optionally, the driver of the hardware device also includes a hot plug configuration identifier, which is used to indicate whether the driver of the hardware device includes configuration information or does not include configuration information; the processing unit 903 is specifically used to: when the hot plug configuration identifier indicates that the driver of the hardware device includes the configuration information of the hardware device, obtain the configuration information of the hardware device included in the driver of the hardware device.

[0294] Optionally, when the hot plug request is a hot unplug request, the processing unit 903 is further configured to: release PCIE resources allocated to the hardware device; and / or control the hardware device to power off; and / or stop accessing the hardware device.

[0295] Optionally, the processing unit 903 is further configured to: if the hot-plug flag indicates that the hardware device does not support hot-plug, output a prompt message, where the prompt message is used to indicate that the hardware device does not support hot-plug.

[0296] Optionally, the processing unit 903 is further configured to: generate log information if the hot plug flag indicates that the hardware device does not support hot plug; the log information is used to record that the hardware device does not support hot plug and / or the hardware device does not perform hot plug.

[0297] Optionally, in a case where the hot-swap request is a hot-insert request, the processing unit 903 is further configured to: if the hot-swap flag indicates that the hardware device does not support hot-swap, power off the hardware device.

[0298] Optionally, in a case where the hot plug request is a hot insertion request, the processing unit 903 is further configured to: if the hot plug flag indicates that the hardware device does not support hot plugging, release the PCIE resources allocated to the hardware device.

[0299] For the detailed description of the above optional methods, please refer to the above method embodiments, which will not be repeated here. In addition, the explanation and description of the beneficial effects of any of the hot-swap devices 900 provided above can refer to the above corresponding method embodiments, which will not be repeated here.

[0300] The present application also provides a computer device, which includes a processor and a memory, the processor being connected to the memory, the memory storing computer-executable instructions, and the processor implementing the data processing method in the above embodiment when executing the computer-executable instructions. The present application does not impose any restrictions on the specific form of the computer device. For example, the computer device can be a terminal device or a network device. The terminal device can be referred to as: terminal, user equipment (UE), terminal device, access terminal, user unit, user station, mobile station, remote station, remote terminal, mobile device, user terminal, wireless communication device, user agent or user device, etc. The terminal device can be a mobile phone, augmented reality (AR) device, virtual reality (VR) device, tablet computer, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), etc. The network device can be a server, etc. The server can be a physical or logical server, or two or more physical or logical servers sharing different responsibilities and cooperating with each other to implement the various functions of the server.

[0301] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is run on a computer, the computer is caused to execute any of the methods executed by the computer devices provided above.

[0302] For explanations of the relevant contents and descriptions of the beneficial effects of any of the computer-readable storage media provided above, reference may be made to the corresponding embodiments described above, and no further details will be given here.

[0303] The embodiment of the present application also provides a chip. The chip integrates a control circuit and one or more ports for implementing the functions of the above-mentioned computer device. Optionally, the functions supported by the chip can be referred to above and will not be repeated here. A person of ordinary skill in the art will understand that all or part of the steps of implementing the above-mentioned embodiment can be completed by instructing the relevant hardware through a program. The program can be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a random access memory, etc. The above-mentioned processing unit or processor can be a central processing unit, a general-purpose processor, an application specific integrated circuit (ASIC), a microprocessor (digital signal processor, DSP), a field programmable gate array (FPGA) or other programmable logic device, transistor logic device, hardware component or any combination thereof.

[0304] The present application also provides a computer program product comprising instructions, which, when executed on a computer, causes the computer to perform any of the methods described in the above embodiments. The computer program product comprises one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available media may be magnetic media (e.g., floppy disk, hard disk, tape), optical media (e.g., DVD), or semiconductor media (e.g., SSD).

[0305] It should be noted that the above-mentioned devices for storing computer instructions or computer programs provided in the embodiments of the present application, such as but not limited to the above-mentioned memories, computer-readable storage media and communication chips, etc., are all non-transitory.

[0306] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using a software program, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more media integrated therein. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).

[0307] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other variations of the disclosed embodiments by reviewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0308] Although the present application has been described with reference to specific features and embodiments thereof, it is apparent that various modifications and combinations may be made thereto without departing from the spirit and scope of the present application. Accordingly, this specification and the drawings are merely illustrative of the present application as defined by the appended claims and are deemed to cover any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art may make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, the present application is intended to include such modifications and variations as fall within the scope of the claims of the present application and their equivalents.

Claims

1. A hot-swap method, characterized in that: The method is executed by a processor, the processor is communicatively connected with a hardware device, and the method includes: Receiving a hot-plug request; the hot-plug request is used to request hot-plugging of the hardware device, the driver of the hardware device includes a hot-plug identifier, and the hot-plug identifier is used to indicate whether the hardware device supports hot-plugging or does not support hot-plugging; Obtaining a hot-swap identifier of the hardware device; When the hot-plug identifier indicates that the hardware device supports hot-plugging, a hot-plugging configuration operation is performed on the hardware device.

2. The method according to claim 1, characterized in that The driver of the hardware device also includes configuration information of the hardware device; performing a hot-plug configuration operation on the hardware device includes: Acquire configuration information of the hardware device included in a driver program of the hardware device; Performing a configuration operation indicated by the configuration information of the hardware device on the hardware device.

3. The method according to claim 2, characterized in that The driver of the hardware device also includes a hot-plug configuration identifier, and the hot-plug configuration identifier is used to indicate whether the driver of the hardware device includes configuration information or does not include configuration information; the step of obtaining the configuration information of the hardware device included in the hardware device includes: In a case where the hot-plug configuration identifier indicates that the driver of the hardware device includes configuration information, the configuration information of the hardware device included in the driver of the hardware device is acquired.

4. The method according to claim 2 or 3, characterized in that: The configuration information of the hardware device includes one or more of configuration information of a general purpose input / output port GPIO, configuration information of a register, configuration information of a port mode, and configuration information of an optional read-only memory of the hardware device.

5. The method according to any one of claims 1 to 4, characterized in that The hot plug request is a hot pull request, and the performing a hot plug configuration operation on the hardware device includes: Release the PCIE resources allocated to the hardware device; and / or Power off the hardware device; and / or Stop access to the hardware device.

6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: If the hot-plug identifier indicates that the hardware device does not support hot-plugging, a prompt message is output, where the prompt message is used to indicate that the hardware device does not support hot-plugging.

7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: When the hot-plug identifier indicates that the hardware device does not support hot-plugging, log information is generated; the log information is used to record that the hardware device does not support hot-plugging and / or the hardware device does not perform hot-plugging.

8. The method according to any one of claims 1 to 7, characterized in that The hot plug request is a hot insertion request, and the method further includes: If the hot-plug indicator indicates that the hardware device does not support hot-plugging, the hardware device is powered off.

9. The method according to any one of claims 1 to 8, characterized in that The hot plug request is a hot insertion request, and the method further includes: If the hot-plug identifier indicates that the hardware device does not support hot-plugging, the PCIE resources allocated to the hardware device are released.

10. A computer system, characterized in that: include: Processor and memory; The processor is connected to the memory, the memory is used to store computer-executable instructions, and the processor executes the computer-executable instructions stored in the memory to enable the computer system to implement the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Method and device of node hot plug

    CN102520982A

  • Hot-plug control circuit and control method thereof

    CN105955911A

  • Hot plug method and computer system

    CN116860681A

  • Method and system for hot-plug functions

    US20160179734A1