PCIe device pull-out method and device, electronic device and program product

By monitoring the status registers and link status of PCIe devices, safe unplugging and service-level isolation are achieved during host power-on/off states. This solves the stability problem of existing PCIe device management mechanisms and improves the success rate of PCIe device unplugging operations and system stability.

CN121807754APending Publication Date: 2026-04-07CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-19
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing PCIe device management mechanisms employ a separate architecture for hot-swapping and cold-swapping. When the control terminal is independent of the host, it cannot perceive the power status, leading to interruption of the hot-swapping process when the driver malfunctions. Forced unplugging affects system stability and makes it difficult to meet the high reliability requirements of modern data centers for device management.

Method used

By detecting the insertion/removal status register, link status register, and driver status register of PCIe devices, the status monitoring and control of PCIe devices can be achieved, ensuring that devices can be safely removed when the host is powered on or off, and performing business-level isolation when the driver is abnormal, avoiding waste of system resources and failure of hot-swap function.

Benefits of technology

This improves the success rate and stability of PCIe device removal operations, avoids the waste of system resources caused by repeated removal operations, and ensures business continuity and system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121807754A_ABST
    Figure CN121807754A_ABST
Patent Text Reader

Abstract

The invention discloses a PCIe device pull-out method and device, electronic equipment and a program product, and belongs to the technical field of computer system architecture. The method comprises the following steps: responding to a PCIe equipment pull-out instruction; detecting the numerical value of the plugging state register; if the PCIe equipment is not pulled out, detecting a numerical value of a PCIe link state register; if the host is in the power-on state, initiating a pull-out request to the host, and detecting the numerical value of the driving state register after waiting for a preset time; if the driver does not correctly feed back the pull-out state, judging whether the driver is normal or not; and if the drive is normal, isolating the PCIe equipment on a service level, and configuring the plug-pull state register to be in a pull-out state. According to the technical scheme, the stability and the success rate of the PCIe device pull-out operation are effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer system architecture technology, and in particular to a PCIe device removal method, apparatus, electronic device, and software product. Background Technology

[0002] In modern computing architectures, PCIe switches, as hubs for integrating heterogeneous computing power, have become critical infrastructure supporting CPU+XPU converged architectures due to their high bandwidth and low latency interconnect characteristics. The reliable plug-and-play capability of PCIe devices directly determines resource utilization efficiency and business continuity, serving as a fundamental guarantee for building resilient computing platforms. Existing PCIe device management mechanisms have significant shortcomings, such as a separate architecture for hot-swapping and cold-swapping, making it impossible for the control terminal to perceive power status when independent of the host; interruption of the hot-swapping process in case of driver malfunctions, leading to forced unplugging and locking of the PCIehp process, affecting all connected devices; and frequent driver calls triggered by repeated unplugging operations, reducing system stability. These shortcomings are particularly prominent in new architectures such as DPUs, making it difficult to meet the high reliability requirements of modern data centers for device management.

[0003] Therefore, there is an urgent need to provide a method for removing PCIe devices that can ensure the normal removal of PCIe devices extended by the PCIe Switch. Summary of the Invention

[0004] This application provides a PCIe device removal method, apparatus, electronic device, and software product.

[0005] In a first aspect, this application provides a method for removing a PCIe device, comprising: Responding to a command to unplug a PCIe device extended to a PCIe switch. Detect the value of the insertion / removal status register corresponding to the PCIe device; If it is determined from the value of the plug-in / plug-out status register that the PCIe device has not been unplugged, then check the value of the PCIe link status register corresponding to the PCIe device. If the value of the PCIe link status register indicates that the connected host is powered on, a request to unplug the PCIe device is sent to the host, and after waiting for a preset time, the value of the driver status register is checked. If the value of the driver status register indicates that the driver is not correctly reporting the unplugged status, then the current driver status is determined based on the value of the driver status register. If the current driver is determined to be normal, the PCIe device is isolated at the business level, and the insertion / removal status register of the PCIe device is configured to be removed.

[0006] In some embodiments, the link negotiation status between the PCIe device and the host is monitored through the PCIe link status register; If the value of the PCIe link status register indicates that the link negotiation is complete, then the host is powered on. If the value of the PCIe link status register indicates that the link negotiation status is disconnected, then the host is in a powered-off state.

[0007] In some embodiments, if the value of the PCIe link status register indicates that the host connected to it is in a powered-off state, the physical link connection between the PCIe switch and the PCIe device is disconnected.

[0008] In some embodiments, if the value of the driver status register does not indicate that the driver has completed the unplugging preparation after waiting for a preset time, it is determined that the driver has not correctly fed back the unplugging status. If the driver does not correctly report the unplug status, the driver status register value is used to determine whether the driver is working properly. If the driver status register value indicates that the driver has successfully negotiated with the PCIe device, the driver is considered to be working properly. If the driver status register value does not indicate that the driver has successfully negotiated with the PCIe device, the driver is considered to be malfunctioning.

[0009] In some embodiments, if the value of the driver status register indicates that the driver has correctly fed back the unplug status, the physical link between the PCIe switch and the PCIe device is disconnected, and the insertion / removal status register of the PCIe device is configured to the unplug status.

[0010] In some embodiments, if the current driver is determined to be abnormal based on the value of the driver status register, the physical link between the PCIe switch and the PCIe device is disconnected, and the insertion / removal status register of the PCIe device is configured to be unplugged.

[0011] In some embodiments, the service port corresponding to the PCIe device is deleted from the service layer to stop the transmission of service traffic, thereby isolating the PCIe device at the service layer.

[0012] Secondly, this application provides a PCIe device removal device, including a status detection module and a removal control module; The status detection module includes a plug-in / plug-out status detection submodule, a link status detection submodule, and a driver status detection submodule. The plug-in / plug-out status detection submodule is configured to detect the value of the plug-in / plug-out status register corresponding to the PCIe device. The link status detection submodule is configured to detect the value of the PCIe link status register corresponding to the PCIe device. The driver status detection submodule is configured to detect the value of the driver status register. The unplug control module includes an instruction receiving submodule, a link control submodule, a service isolation submodule, and a status maintenance submodule. The instruction receiving submodule is configured to receive and respond to unplug commands for PCIe devices extended to the PCIe switch. The link control submodule is configured to control the connection and disconnection of the physical link between the PCIe switch and the PCIe device based on the detection results of the status detection module. The service isolation submodule is configured to isolate the PCIe device at the service level when the value of the driver status register indicates that the driver has not correctly fed back the unplug status, and the current driver is normal. The status maintenance submodule is configured to update the value of the insertion and removal status register of the PCIe device.

[0013] Thirdly, this application provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program to implement any of the PCIe device removal methods.

[0014] Fourthly, this application provides a computer program product, including a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements any of the PCIe device removal methods.

[0015] The above-mentioned technical solutions adopted in the embodiments of this application can achieve the following beneficial effects: By setting the insertion and removal status register to monitor the insertion and removal status of PCIe devices in real time, the waste of system resources caused by repeated removal and removal operations is effectively avoided, and the device management efficiency is improved; by using the PCIe link status register to detect the physical link connection negotiation status between the host and the PCIe device in real time, the PCIe Switch control terminal can determine the host's power-off or power-on status even when it cannot directly perceive the host's power status; by using the driver status register to detect the driver status, the PCIe device can be directly removed when the driver is abnormal and cannot provide feedback, avoiding the failure of the whole system's hot-swapping function due to the PCIe process locking; when the driver is normal but does not provide timely feedback on the removal status, the device is isolated from the business level to stop traffic transmission, ensuring business continuity and avoiding long-term blocking of the removal process. Through the technical solutions of this application, the success rate and stability of PCIe device removal and removal operations are effectively improved.

[0016] It should be understood that both the foregoing general description and the following detailed description are exemplary and intended to provide further illustration of the claimed technology. Attached Figure Description

[0017] The above and other objects, features, and advantages of this application will become more apparent from the more detailed description of the embodiments of this application in conjunction with the accompanying drawings. The accompanying drawings are used to provide a further understanding of the embodiments of this application and form part of the specification. They are used together with the embodiments of this application to explain this application and do not constitute a limitation thereof. In the accompanying drawings, the same reference numerals generally represent the same components or steps.

[0018] Figure 1 This illustration schematically depicts a service isolation process diagram of a PCIe device removal method according to an embodiment of this application; Figure 2 This illustration schematically shows a host status detection process for a PCIe device removal method according to an embodiment of this application; Figure 3 This illustration schematically shows a cold-pull physical link disconnection process of a PCIe device removal method according to an embodiment of this application; Figure 4 This illustration schematically shows a hot-plug physical link disconnection process of a PCIe device removal method according to an embodiment of this application; Figure 5 This illustration schematically shows a process for disconnecting a PCIe device due to a driver anomaly and the physical link being severed according to an embodiment of this application. Figure 6 This illustration schematically shows a driver feedback status detection process for a PCIe device removal method according to an embodiment of this application. Figure 7 This illustration schematically shows a driver negotiation state detection process for a PCIe device removal method according to an embodiment of this application. Figure 8 This illustration schematically shows a schematic diagram of the insertion / removal status detection process of a PCIe device removal method according to an embodiment of this application; Figure 9 This illustration schematically shows an overall structural diagram of a PCIe device removal device according to an embodiment of this application; Figure 10 This illustration schematically shows a structural diagram of a status detection module for a PCIe device removal device according to an embodiment of this application; Figure 11 This illustration schematically shows a structural diagram of a PCIe device removal control module according to an embodiment of this application; Figure 12 An exemplary block diagram of a computer program product for a PCIe device removal method according to an embodiment of this application is shown schematically.

[0019] In the diagram: 901, Status Detection Module; 902, Unplug Control Module; 903, Plug-in / Unplug Status Detection Submodule; 904, Link Status Detection Submodule; 905, Driver Status Detection Submodule; 906, Command Receiving Submodule; 907, Link Control Submodule; 908, Service Isolation Submodule; 909, Status Maintenance Submodule; 1201, Computer Program. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of this application more apparent, exemplary embodiments according to this application will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this application, and not all embodiments of this application. It should be understood that this application is not limited to the exemplary embodiments described herein.

[0021] Figure 1 This illustration schematically depicts a service isolation process diagram of a PCIe device unplugging method according to an embodiment of this application.

[0022] like Figure 1 As shown, the steps include: S101: Receive and respond to a command to remove a PCIe device extended to the PCIe switch. Specifically, receive and parse the removal command, which includes at least the identification information of the PCIe device to be removed.

[0023] S102, detect the value of the insertion / removal status register corresponding to the PCIe device. Specifically, each PCIe device managed by the PCIe switch has a corresponding insertion / removal status register configured on the control side. The insertion / removal status register is used to persistently record the insertion / removal status of the PCIe device at the logical level. The insertion / removal status of the PCIe device is obtained by reading the value of the insertion / removal status register.

[0024] S103, if it is determined from the value of the insertion / removal status register that the PCIe device has not been removed, then the value of the PCIe link status register corresponding to the PCIe device is detected. The obtained insertion / removal status register value is parsed and judged. If it is determined that the PCIe device is logically in a non-removed state, then the control terminal performs a detection of the host status, that is, reads the PCIe link status register corresponding to the PCIe device.

[0025] S104: If the value of the PCIe link status register indicates that the connected host is powered on, then a request to unplug the PCIe device is initiated to the host. The value of the read PCIe link status register is parsed. If the value of the PCIe link status register indicates that the link negotiation status is complete, then it is determined that the corresponding host is powered on.

[0026] In this case, the unplugging operation must be performed in hot-plug mode. A unplug request for the PCIe device is sent to the host, which notifies the host to initiate the hot-plugging process.

[0027] S105: After waiting for a preset time, check the value of the driver status register. After issuing the unplug request, start an internal timer and wait for the preset time. This preset time is used to ensure that the host driver has sufficient time to perform unloading operations such as resource release and state saving, and to provide feedback on the results. After the preset waiting time is completed, the control terminal reads the value of the driver status register and, based on this value, provides the driver's response status and result to this unplug request.

[0028] S106, if the value of the driver status register indicates that the driver is not correctly reporting the unplugged status, then determine whether the current driver is normal based on the value of the driver status register. Specifically, parse the obtained value of the driver status register; if the value of the driver status register indicates that the driver is not correctly reporting the unplugged status, then further evaluate whether the driver's own operating status is normal or abnormal.

[0029] S107, if the current driver is determined to be normal, the PCIe device is isolated at the service layer. Specifically, when the driver is in a normal state, service layer isolation operations are performed, including: disabling or removing the service port, storage mount point, or compute resource identifier associated with the PCIe device on the host; stopping the distribution of service data streams to the PCIe device; or removing the PCIe device from the service resource scheduling pool. The service layer isolation operation makes the PCIe device unusable to the upper-layer service system while maintaining the physical link and driver state of the PCIe device, thereby achieving logical disconnection.

[0030] S108, configure the PCIe device's insertion / removal status register to the removed state. After the removal operation is completed, update the value of the PCIe device's insertion / removal status register to the corresponding value for the removed state.

[0031] Figure 2 The illustration shows a schematic diagram of the host status detection process of a PCIe device removal method according to an embodiment of this application.

[0032] like Figure 2 As shown, the steps include: S201, the link negotiation status between the PCIe device and the host is detected through the PCIe link status register. Specifically, the current value of the PCIe link status register corresponding to the PCIe device is read. The value of the PCIe link status register reflects the physical link status between the PCIe device and the host it is connected to in real time.

[0033] S202, determine the status based on the value of the PCIe link status register. If the value of the PCIe link status register indicates that the link negotiation is complete, then the host is determined to be in the powered-on state. If the value of the PCIe link status register indicates that the link negotiation is disconnected, then the host is determined to be in the powered-off state.

[0034] Figure 3 The illustration shows a schematic diagram of the cold-pull physical link disconnection process of a PCIe device removal method according to an embodiment of this application.

[0035] like Figure 3 As shown, the steps include: S301, based on the value of the PCIe link status register, determines that the connected host is in a powered-off state. Specifically, based on the parsing of the PCIe link status register value, if the value of the PCIe link status register indicates that the physical link between the PCIe device and the host is disconnected, the control terminal determines that the host is in a powered-off state.

[0036] S302, Disconnect the physical link between the PCIe switch and the PCIe device. When the host is powered off, the PCIe switch disconnects the physical link between itself and the PCIe device.

[0037] S303, configure the PCIe device's insertion / removal status register to the removed state. Specifically, after the physical link connection is disconnected, update the value of the PCIe device's insertion / removal status register to the corresponding value for the removed state.

[0038] Figure 4 The illustration shows a schematic diagram of the hot-swapping physical link disconnection process of a PCIe device removal method according to an embodiment of this application.

[0039] like Figure 4 As shown, the steps include: S401, based on the value of the driver status register, determine that the driver has correctly reported the unplugging status. Specifically, obtain and parse the value of the driver status register. If the value of the driver status register indicates that the driver has completed all necessary software uninstallation operations and reports that it is safe to physically unplug the device, then determine that the driver has correctly reported the unplugging status.

[0040] S402, Disconnect the physical link between the PCIe switch and the PCIe device. Control the PCIe switch to disconnect the physical link connected to the PCIe device.

[0041] S403, configure the PCIe device's plug-in / plug-out status register to the unplugged state. Specifically, after the physical link between the PCIe switch and the PCIe device is disconnected, update the value of the PCIe device's plug-in / plug-out status register to the corresponding value for the unplugged state.

[0042] Figure 5 The illustration shows a schematic diagram of the physical link disconnection process for a PCIe device removal method according to an embodiment of this application.

[0043] like Figure 5 As shown, the steps include: S501: If the current driver is determined to be abnormal based on the value of the driver status register, the physical link between the PCIe switch and the PCIe device is disconnected. Specifically, the value of the driver status register is obtained and parsed. If the value of the driver status register does not indicate that the driver and the PCIe device have successfully negotiated, the current driver is determined to be abnormal, and the PCIe switch is controlled to disconnect the physical link between itself and the PCIe device.

[0044] S502, configure the PCIe device's insertion / removal status register to the removed state. Specifically, after the physical link connection is disconnected, update the value of the PCIe device's insertion / removal status register to the corresponding value for the removed state.

[0045] Figure 6 The illustration shows a schematic diagram of the drive feedback status detection process of a PCIe device removal method according to an embodiment of this application.

[0046] like Figure 6 As shown, the steps include: S601, initiates a request to the host to remove the PCIe device. Specifically, after confirming that the host is powered on, a removal request is sent to the host, which instructs the host to perform a hot-plug procedure for the specified PCIe device.

[0047] S602: Wait for a preset time and check the value of the driver status register. Specifically, after issuing a unplug request, the control terminal starts a timer and waits for a preset time. This preset time is configured to be a reasonable time window sufficient to allow the driver to perform an unloading operation and report its status. After the preset time has elapsed, the current value of the driver status register is read.

[0048] S603, if the value of the driver status register does not indicate that the driver has completed the unplugging preparation, it is determined that the driver has not correctly fed back the unplugging status. Specifically, the control terminal obtains and parses the current value of the driver status register. If the value of the driver status register indicates that the driver has completed the release of all necessary software resources and is in a safe removable state, it means that the driver has completed the unplugging preparation. If the value of the driver status register does not indicate that the driver has completed the release of all necessary software resources and is in a safe removable state, it is determined that the driver has not correctly fed back the unplugging status.

[0049] Figure 7 The illustration shows a schematic diagram of the driver negotiation state detection process of a PCIe device removal method according to an embodiment of this application.

[0050] like Figure 7 As shown, the steps include: S701: Obtain the value of the driver status register and determine the negotiation status between the driver and the PCIe device based on the value of the driver status register. Specifically, the control terminal reads the current value of the driver status register and parses the value. The value of the driver status register reflects the negotiation status between the driver and the PCIe device.

[0051] S702 determines whether the current driver is functioning correctly based on the value of the driver status register. If the value of the driver status register indicates that the driver has successfully negotiated with the PCIe device, the current driver is considered to be functioning correctly; if the value of the driver status register does not indicate that the driver has successfully negotiated with the PCIe device, the current driver is considered to be malfunctioning.

[0052] Figure 8 The illustration shows a schematic diagram of the insertion / removal status detection process of a PCIe device removal method according to an embodiment of this application.

[0053] like Figure 8 As shown, the steps include: S801, obtain the value of the insertion / removal status register corresponding to the PCIe device. Specifically, the control terminal reads the current value of the insertion / removal status register corresponding to the PCIe device, which is used to record the logical insertion / removal status of the PCIe device.

[0054] S802 makes a judgment based on the value of the insertion / removal status register. If the value of the insertion / removal status register is a first predetermined value, it is determined that the PCIe device is in the inserted state; if the value of the insertion / removal status register is a second predetermined value, it is determined that the PCIe device is in the removed state.

[0055] Figure 9 The schematic diagram illustrates the overall structure of a PCIe device removal device according to an embodiment of this application.

[0056] like Figure 9 As shown, the device includes a status detection module 901 and a pull-out control module 902.

[0057] The status detection module 901 is configured to perform detection of various statuses of the PCIe device, including the insertion / removal status of the PCIe device, the physical link connection status between the PCIe device and the host, and the status of the driver, and transmit the detected statuses to the removal control module 902.

[0058] The unplug control module 902 is configured to respond to an unplug command and, based on the detected status provided by the status detection module 901, control the execution of the corresponding unplug operation, including initiating an unplug request, controlling the connection and disconnection of the physical link, performing service layer isolation, and maintaining and updating the insertion and removal status of the PCIe device.

[0059] Figure 10 The illustration shows a schematic diagram of the status detection module structure of a PCIe device removal device according to an embodiment of this application.

[0060] like Figure 10 As shown, the status detection module 901 includes a plug-in / plug-out status detection submodule 903, a link status detection submodule 904, and a driver status detection submodule 905.

[0061] The insertion / removal status detection submodule 903 is configured to detect the value of the insertion / removal status register corresponding to the PCIe device in order to determine its logical insertion / removal status.

[0062] The link status detection submodule 904 is configured to detect the value of the PCIe link status register corresponding to the PCIe device in order to determine the power-on / off status of the host to which it is connected.

[0063] The driver status detection submodule 905 is configured to detect the value of the driver status register in order to obtain the driver's feedback status to the unplug request and the driver's own running status.

[0064] Figure 11 The illustration shows a schematic diagram of the structure of a PCIe device removal control module according to an embodiment of this application.

[0065] like Figure 11 As shown, the unplug control module 902 includes an instruction receiving submodule 906, a link control submodule 907, a service isolation submodule 908, and a status maintenance submodule 909.

[0066] The instruction receiving submodule 906 is configured to receive and respond to unplugging instructions for PCIe devices extended for PCIe switches.

[0067] The link control submodule 907 is configured to control the connection and disconnection of the physical link between the PCIe switch and the PCIe device based on the status detected by the status detection module 901.

[0068] The service isolation submodule 908 is configured to isolate the PCIe device at the service level when the driver does not correctly report the unplugged status but the driver itself is running normally. This includes disabling the service port, stopping the service flow, or removing the PCIe device from the resource pool.

[0069] The status maintenance submodule 909 is configured to update the value of the corresponding plug-in / plug-out status register to the value of the unplugged status after the PCIe device is unplugged by disconnecting the physical link or isolating the service.

[0070] Figure 12 An exemplary block diagram of a computer program product for a PCIe device removal method according to an embodiment of this application is shown schematically.

[0071] like Figure 12 As shown, the computer program product stores a computer program 1201, which, when executed by a processor, implements the method provided in any embodiment of this application.

[0072] The basic principles of this application have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in this application are merely examples and not limitations, and should not be considered as essential features of each embodiment of this application. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the application to the necessity of employing the aforementioned specific details for implementation.

[0073] The block diagrams of devices, apparatuses, devices, and systems involved in this application are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.

[0074] Additionally, as used herein, the "or" used in a list of items beginning with "at least one" indicates a separate list, such that a list of, for example, "at least one of A, B, or C" means A or B or C, or AB or AC or BC, or ABC (i.e., A and B and C). Furthermore, the word "exemplary" does not imply that the described example is preferred or better than other examples.

[0075] It should also be noted that in the system and method of this application, the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations should be considered as equivalent solutions of this application.

[0076] Various changes, substitutions, and modifications can be made to the technology described herein without departing from the teachings defined by the appended claims. Furthermore, the scope of the claims of this application is not limited to the specific aspects of the processes, machines, manufacturing, events, means, methods, and actions described above. Currently existing or later-developed processes, machines, manufacturing, events, means, methods, or actions that perform substantially the same function or achieve substantially the same result as the corresponding aspects described above can be utilized. Therefore, the appended claims include such processes, machines, manufacturing, events, means, methods, or actions within their scope.

[0077] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use this application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein can be applied to other aspects without departing from the scope of this application. Therefore, this application is not intended to be limited to the aspects shown herein, but rather to be accorded the widest scope consistent with the principles and novel features disclosed herein.

[0078] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of this application to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations thereof.

Claims

1. A method for removing a PCIe device, characterized in that, include: Responding to a command to unplug a PCIe device extended to a PCIe switch. Detect the value of the insertion / removal status register corresponding to the PCIe device; If it is determined from the value of the insertion / removal status register that the PCIe device has not been removed, then the value of the PCIe link status register corresponding to the PCIe device is detected. If the value of the PCIe link status register indicates that the connected host is powered on, a request to unplug the PCIe device is sent to the host, and after waiting for a preset time, the value of the driver status register is checked. If the value of the drive status register indicates that the drive is not correctly reporting the unplugged status, then the current drive status is determined based on the value of the drive status register. If the current driver is determined to be normal, the PCIe device is isolated at the business level, and the insertion / removal status register of the PCIe device is configured to be removed.

2. The PCIe device removal method according to claim 1, characterized in that, The link negotiation status between the PCIe device and the host is monitored through the PCIe link status register; If the value of the PCIe link status register indicates that the link negotiation is complete, then the host is powered on. If the value of the PCIe link status register indicates that the link negotiation status is disconnected, then the host is in a power-off state.

3. The PCIe device removal method according to claim 2, characterized in that, If the value of the PCIe link status register indicates that the connected host is in a powered-off state, then the physical link between the PCIe switch and the PCIe device is disconnected.

4. The PCIe device removal method according to claim 1, characterized in that, If, after waiting for the preset time, the value of the drive status register does not indicate that the drive has completed the unplugging preparation, it is determined that the drive has not correctly fed back the unplugging status. If the driver does not correctly report the unplugged status, the current driver status is determined based on the value of the driver status register. If the value of the driver status register indicates that the driver has successfully negotiated with the PCIe device, then the current driver is considered to be normal. If the value of the driver status register does not indicate that the driver has successfully negotiated with the PCIe device, then the current driver is determined to be abnormal.

5. The PCIe device removal method according to claim 4, characterized in that, If the value of the driver status register indicates that the driver has correctly fed back the unplugged status, then the physical link connection between the PCIe switch and the PCIe device is disconnected, and the plug-in / unplugged status register of the PCIe device is configured to the unplugged status.

6. The PCIe device removal method according to claim 4, characterized in that, If the current driver is determined to be abnormal based on the value of the driver status register, the physical link between the PCIe switch and the PCIe device is disconnected, and the insertion / removal status register of the PCIe device is configured to be in the unplugged state.

7. The PCIe device removal method according to claim 1, characterized in that, Remove the service port corresponding to the PCIe device from the service layer to stop the transmission of service traffic, thereby isolating the PCIe device from the service layer.

8. A PCIe device removal device, characterized in that, It includes a status detection module and a pull-out control module; among which, The status detection module includes a plug-in / plug-out status detection submodule, a link status detection submodule, and a driver status detection submodule; the plug-in / plug-out status detection submodule is configured to detect the value of the plug-in / plug-out status register corresponding to the PCIe device; the link status detection submodule is configured to detect the value of the PCIe link status register corresponding to the PCIe device; and the driver status detection submodule is configured to detect the value of the driver status register. The unplug control module includes an instruction receiving submodule, a link control submodule, a service isolation submodule, and a status maintenance submodule. The instruction receiving submodule is configured to receive and respond to unplug commands for the PCIe device extended to the PCIe switch. The link control submodule is configured to control the connection and disconnection of the physical link between the PCIe switch and the PCIe device based on the detection result of the status detection module. The service isolation submodule is configured to isolate the PCIe device at the service level when the value of the driver status register indicates that the driver has not correctly fed back the unplug status, and the current driver is normal. The status maintenance submodule is configured to update the value of the insertion / removal status register of the PCIe device.

9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the PCIe device removal method according to any one of claims 1 to 7.

10. A computer program product comprising a computer-readable storage medium on which a computer program is stored, characterized in that, When the computer program is executed by the processor, it implements the PCIe device removal method according to any one of claims 1 to 7.