PCIE (Peripheral Component Interface Express) endpoint equipment scanning method, device, equipment, medium and product
By adding a scanning service process to the endpoint device driver on the host side, the identification problem when the PCIe endpoint device and the host are powered on at the same time is solved, and automatic recovery of scanning and identification is achieved, avoiding manual intervention.
Patent Information
- Application Number
- CN202411097784.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-12
- Publication Date
- 2024-11-22
AI Technical Summary
When the PCIe endpoint device and the host are powered on and started simultaneously, the host cannot recognize the PCIe endpoint device because the endpoint device starts up slowly. Existing technology requires manual intervention to manually reset the host to trigger a rescan.
Add a scanning service process to the endpoint device driver on the host side. It is automatically loaded when the operating system starts. It communicates with identified devices through a heartbeat mechanism. For unidentified devices, it calls the operating system's rescan interface to trigger a host rescan.
It enables automatic recovery scanning and identification of PCIe endpoint devices, avoiding manual intervention and ensuring that the host can accurately identify endpoint devices.
Smart Images

Figure CN119003011A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a PCIE endpoint device scanning method, device, equipment, medium and product. Background Art
[0002] In the endpoint (Endpoint, EP) chip design of the high-speed serial computer expansion bus standard (Peripheral Component Interconnect Express, PCIE), there is a solution for implementing the relevant IP configuration of the PCIE IP core through software. Among them, the IP core is an integrated circuit core with an intellectual property core. The IP core implemented by this solution needs to write the relevant configuration of PCIE into the IP core through software when the chip is started, and then enable the PCIE IP core. Then, the host (Root Complex, RC) can enumerate the EP device of PCIE.
[0003] However, in actual engineering development, the RC host enumerates the EP device during the host's Basic Input Output System (BIOS) startup phase, and there is a time limit for the scanning window. During the RC scanning window, the EP device is often not started up, resulting in the incomplete configuration of the PCIE IP core. Therefore, in the scenario where the RC and EP are powered on at the same time, this soft core IP design will cause the RC to be unable to scan and identify the EP device normally.
[0004] Therefore, the prior art has the following problems: the IP design of the soft-core PCIE, when the EP and RC are powered on and started together, the EP starts relatively slowly, resulting in the inability of the RC to recognize the PCIE EP device after startup; when the RC cannot recognize the PCIE device, it cannot recover automatically, and manual intervention is required to manually reset the RC to trigger the RC to rescan the PCIE EP device. Summary of the invention
[0005] The embodiments of the present invention provide a PCIE endpoint device scanning method, apparatus, device, medium and product, which solve the problem that when EP and RC are powered on and started together, the EP starts slowly, resulting in the inability to identify the endpoint device after the RC starts.
[0006] In a first aspect, this embodiment provides a PCIE endpoint device scanning method, the method comprising:
[0007] When the operating system starts, the scanning service process installed in the PCIE endpoint device driver of the host is loaded;
[0008] Searching for a preset PCIE endpoint device based on the scanning service process;
[0009] If the scanning service process finds a PCIE endpoint device, the found PCIE endpoint device is recorded as an identified PCIE endpoint device, and handshake information is periodically sent based on a heartbeat mechanism to communicate with the identified PCIE endpoint device;
[0010] If the scanning service process fails to find the PCIE endpoint device, the PCIE endpoint device that is not found is recorded as an unrecognized PCIE endpoint device, and the rescan interface of the operating system is called to trigger the host to rescan the unrecognized PCIE endpoint device.
[0011] In a second aspect, this embodiment provides a PCIE endpoint device scanning device, the device comprising:
[0012] The process loading module is used to load the scanning service process installed in the PCIE endpoint device driver of the host when the operating system is started;
[0013] A device search module, used for searching a preset PCIE endpoint device based on the scanning service process;
[0014] A communication module, for recording the found PCIE endpoint device as an identified PCIE endpoint device if the scanning service process finds the PCIE endpoint device, and periodically sending handshake information based on a heartbeat mechanism to communicate with the identified PCIE endpoint device;
[0015] The rescanning module is used to record the unfound PCIE endpoint device as an unrecognized PCIE endpoint device if the scanning service process fails to find the PCIE endpoint device, and call the rescanning interface of the operating system to trigger the host to rescan the unrecognized PCIE endpoint device.
[0016] In a third aspect, this embodiment provides an electronic device, including:
[0017] at least one processor; and
[0018] a memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the PCIE endpoint device scanning method described in any embodiment of the present invention.
[0020] In a fourth aspect, this embodiment provides a computer-readable storage medium, and the computer program is executed by the at least one processor so that the at least one processor can execute the PCIE endpoint device scanning method described in any embodiment of the present invention.
[0021] In a fifth aspect, an embodiment of the present invention further provides a computer program product, wherein the computer program product includes a computer program, and when the computer program is executed by a processor, the PCIE endpoint device scanning method as described in any embodiment of the present invention is implemented.
[0022] The embodiment of the present invention provides a PCIE endpoint device scanning method, apparatus, equipment, medium and product. The method comprises: when the operating system is started, loading a scanning service process in a PCIE endpoint device driver installed in a host; searching for a preset PCIE endpoint device based on the scanning service process; if the scanning service process finds the PCIE endpoint device, recording the found PCIE endpoint device as an identified PCIE endpoint device, and periodically sending handshake information based on a heartbeat mechanism to communicate with the identified PCIE endpoint device; if the scanning service process does not find the PCIE endpoint device, recording the unfound PCIE endpoint device as an unidentified PCIE endpoint device, and calling a rescan interface of the operating system to trigger the host to rescan the unidentified PCIE endpoint device. The above technical solution adds a scanning service process to the endpoint device driver on the host side. The scanning service process is automatically loaded when the operating system starts. When the host starts, the scanning service process attempts to trigger the host to re-enumerate the PCIE endpoint device by calling the host's rescan interface, which solves the problem that when the endpoint device and the host are powered on together, the host cannot recognize the endpoint device after startup due to the slow startup of the endpoint device. The automatic recovery of RC rescanning PCIE endpoint devices is realized, and there is no need for manual intervention to manually reset RC to trigger RC to rescan PCIE devices, which can accurately scan and identify PCIE endpoint devices.
[0023] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0025] Figure 1 A schematic diagram of a flow chart of a PCIE endpoint device scanning method provided in Embodiment 1 of the present invention;
[0026] Figure 2 A schematic flow chart of another PCIE endpoint device scanning method provided in Embodiment 2 of the present invention;
[0027] Figure 3 An example flow chart of the execution of a PCIE endpoint device scanning method in a certain application scenario provided by the second embodiment of the present invention;
[0028] Figure 4 A schematic diagram of the structure of a PCIE endpoint device scanning device provided in Embodiment 3 of the present invention;
[0029] Figure 5 A schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "original", "target", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any other variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] It should be clear that in the IP core integrated in the chip, some IPs are software to implement the configuration of the relevant information of PCIE. When the system starts, the software first configures the IP core, and then enables the IP core. Only then can the host scan and identify the PCIE endpoint device. When the PCIE endpoint device and the host are started at the same time, because the PCIE scanning window of the host is very short, during this time period, the EP device cannot complete its own system startup and configure the IP, so that after the RC is started, the EP device cannot be recognized. Exemplarily, with a computer as the host, keyboards, mice and other devices can be considered as endpoint devices. In the IP core integrated in the chip, some IPs are software to implement the configuration of the relevant information of PCIE. When the system starts, the software first configures the IP core, and then enables the IP core. Only then can the host scan and identify the PCIE endpoint device. When the keyboard, mouse and computer are started at the same time, if the PCIE scanning window of the computer is very short, during this time period, the keyboard or mouse cannot complete its own system startup and configure the IP, so after the computer starts, the keyboard or mouse cannot be recognized.
[0033] Embodiment 1
[0034] Figure 1 A flow chart of a PCIE endpoint device scanning method provided in Embodiment 1 of the present invention is provided. The method can be applied to the case where a PCIE endpoint device is scanned in a PCIE soft core IP scenario. The method can be executed by a PCIE endpoint device scanning device. The PCIE endpoint device scanning device can be implemented in the form of hardware and / or software and is generally integrated in an electronic device.
[0035] like Figure 1 As shown, a PCIE endpoint device scanning method provided in the first embodiment may specifically include the following steps:
[0036] S101. When the operating system is started, a scanning service process installed in a PCIE endpoint device driver of a host is loaded.
[0037] It should be noted that in the PCIE bus, RC and EP are the two most core roles. Among them, RC represents the starting point of the bus, which is recorded as the host in this embodiment, and EP represents the end point of the bus, which is recorded as the PCIE endpoint device in this embodiment. The enumeration of the EP endpoint device by the RC host refers to the process of RC identifying and configuring the EP device in the PCIE bus system. The PCIE endpoint device scanning method provided in this embodiment aims to solve the problem that the host cannot normally scan the endpoint device after the host and the endpoint device are powered on at the same time in the soft core IP design of PCIE. The application scenario of this embodiment can be described as the host automatically resuming scanning of the endpoint device after the endpoint device designed for the soft core IP of PCIE is powered on and started by the operating system. Since the endpoint device needs to be used normally, the corresponding device driver needs to be provided on the host side first. Therefore, a service program can be added to the endpoint device driver, which is recorded as a scanning service process in this embodiment. In this embodiment, the scanning service process is automatically loaded when the operating system starts. When the endpoint device driver on the host side is loaded or installed, a kernel-level service program that automatically starts with the system is created in the driver, that is, a scanning service process.
[0038] S102: Searching for a preset PCIE endpoint device based on a scanning service process.
[0039] Considering the IP design of the soft-core PCIE in the prior art, when the endpoint device and the host are powered on and started together, the endpoint device starts relatively slowly, resulting in the host being unable to identify the PCIE endpoint device after startup; in this embodiment, when the operating system is started, the scanning service process installed in the PCIE endpoint device driver of the host is loaded. It should be clear that the host side has various endpoint device drivers written, which is equivalent to the PCIE endpoint devices that the host should identify and enumerate being known, and the PCIE endpoint devices that should be identified and enumerated are recorded as preset PCIE endpoint devices. After the operating system is started, the preset PCIE endpoint devices are searched based on the scanning service process to determine which PCIE endpoint devices the host has identified and which PCIE endpoint devices have not been identified. Exemplarily, the search for the preset PCIE endpoint devices can be performed periodically until all the preset PCIE endpoint devices are found.
[0040] S103: If the scanning service process finds a PCIE endpoint device, the found PCIE endpoint device is recorded as an identified PCIE endpoint device, and handshake information is periodically sent based on a heartbeat mechanism to communicate with the identified PCIE endpoint device.
[0041] In this embodiment, when the scanning service process finds a PCIE endpoint device, the found PCIE endpoint device is recorded as an identified PCIE endpoint device. If the scanning service process can find the PCIE endpoint device normally, it means that the host can normally identify the PCIE endpoint device, and the heartbeat mechanism is started. The scanning service process has a heartbeat mechanism to communicate with the endpoint device, which is equivalent to periodically sending handshake information based on the heartbeat mechanism to communicate with the identified PCIE endpoint device. Exemplarily, the handshake information is sent once per second to communicate with the PCIE endpoint device.
[0042] S104: If the scanning service process fails to find the PCIE endpoint device, the PCIE endpoint device that is not found is recorded as an unrecognized PCIE endpoint device, and a rescanning interface of the operating system is called to trigger the host to rescan the unrecognized PCIE endpoint device.
[0043] In this embodiment, if the scanning service process fails to find the PCIE endpoint device, the unfound PCIE endpoint device is recorded as an unidentified PCIE endpoint device. When the scanning service process cannot find the corresponding PCIE endpoint device, it is necessary to re-trigger the host to scan the unidentified PCIE endpoint device. Specifically, the system is triggered to rescan the PCIE device by periodically calling the PCIE rescan interface of the operating system, and the interface is recorded as the rescan interface. At this time, it is necessary to trigger the host to rescan according to the situation of the host or to soft reset the host to trigger the rescan of the PCIE endpoint device.
[0044] The embodiment of the present invention provides a PCIE endpoint device scanning method, which adds a scanning service process in the endpoint device driver, and the scanning service process is automatically loaded when the operating system is started. When the host is started, the scanning service process attempts to trigger the host to re-enumerate the PCIE endpoint device by calling the host's rescan interface, which solves the problem that when the endpoint device and the host are powered on and started together, the host cannot identify the endpoint device after startup due to the slow startup of the endpoint device. Accurate scanning and identification of PCIE endpoint devices are achieved.
[0045] As a first optional embodiment of an embodiment of the present invention, based on the above embodiment, this first optional embodiment can be optimized. After periodically sending handshake information based on a heartbeat mechanism to communicate with an identified PCIE endpoint device, the method also includes: if the handshake information is abnormal and exceeds the set retry count threshold, calling the operating system's rescan interface to trigger the host to rescan the PCIE endpoint device.
[0046] The retry count threshold can be set according to actual conditions. In this embodiment, if the handshake information of the heartbeat is abnormal, the handshake information is resent to try to communicate with the identified PCIE endpoint device. If the handshake information is abnormal and exceeds the set retry count threshold, the rescan interface of the operating system is called again to trigger the host to rescan the PCIE endpoint device, that is, the heartbeat is tried to be restored by triggering the PCIE rescan of the operating system.
[0047] The above technical solution adds a method for realizing automatic recovery when an abnormality occurs in a PCIE endpoint device during normal use, resulting in a loss of communication, thereby ensuring communication between the host and the identified PCIE endpoint device.
[0048] As a second optional embodiment of the embodiment of the present invention, based on the above embodiment, this second optional embodiment can optimize the method and also include: if no unrecognized PCIE endpoint device is scanned when the number of rescans is greater than the set scan number threshold, hot restart and reset the host based on the hot restart reset interface of the operating system.
[0049] Among them, the scan number threshold can be set according to the actual situation. Specifically, if the rescan exceeds the set scan number threshold and the device still cannot be scanned, the host is hot-restarted and reset through the operating system interface. The host is triggered to rescan and identify the endpoint device during the restart process. If the scan fails multiple times, the PCIE endpoint device is rescanned by hot-restarting the host. Since the host will not power off the PCIE endpoint device during the hot restart, and the PCIE endpoint device has been started at this time, the enumeration and identification of the PCIE endpoint device can be performed normally during the restart.
[0050] This is different from the prior art in which when the host cannot recognize the PCIE endpoint device, it cannot automatically recover and requires manual intervention to manually reset the host to trigger the host to rescan the PCIE endpoint device; the above technical solution solves the problem that the RC cannot automatically recognize the device after the system is started.
[0051] Furthermore, after performing hot restart and reset on the host based on the hot restart and reset interface of the operating system, it also includes: returning to re-execute the step of searching for the preset PCIE endpoint device based on the scanning service process until all the preset PCIE endpoint devices are found.
[0052] In this embodiment, after the host is hot-reset based on the hot-reset interface of the operating system, the PCIE endpoint device scan can be performed normally to achieve enumeration and identification of the PCIE endpoint devices until all preset PCIE endpoint devices are found.
[0053] Embodiment 2
[0054] Figure 2 A flow chart of a PCIE endpoint device scanning method provided in Embodiment 2 of the present invention. This embodiment is a further optimization of the above embodiment. In this embodiment, the optimization is further limited to "if the scanning service process fails to find the PCIE endpoint device, the PCIE endpoint device not found is recorded as an unidentified PCIE endpoint device, and the rescan interface of the operating system is called to trigger the host to rescan the unidentified PCIE endpoint device."
[0055] like Figure 2 As shown, this embodiment 2 provides a PCIE endpoint device scanning method, which specifically includes the following steps:
[0056] S201. When the operating system starts, a scanning service process installed in a PCIE endpoint device driver of a host is loaded.
[0057] S202: Searching for a preset PCIE endpoint device based on a scanning service process.
[0058] S203: If the scanning service process finds a PCIE endpoint device, the found PCIE endpoint device is recorded as an identified PCIE endpoint device, and handshake information is periodically sent based on a heartbeat mechanism to communicate with the identified PCIE endpoint device.
[0059] S204: If the scanning service process fails to find the PCIE endpoint device, the PCIE endpoint device that is not found is recorded as an unrecognized PCIE endpoint device.
[0060] S205: Determine whether the number of rescan times is less than or equal to a set scan time threshold.
[0061] Specifically, this step is used to determine whether the number of rescan times is less than or equal to a set scan number threshold.
[0062] S206: If the number of rescan times is less than or equal to the set scan times threshold, then according to the type of the operating system, a rescan interface corresponding to the type is called to trigger the host to rescan the unrecognized PCIE endpoint device.
[0063] Specifically, if the number of rescan times is less than or equal to the set scan time threshold, the type of operating system is obtained, for example, the operating system is a Linux operating system or a Windows operating system, etc. Different operating system types correspond to different rescan interfaces. The rescan interface corresponding to the type is called to trigger the host to rescan the unrecognized PCIE endpoint device.
[0064] As a specific implementation method, the steps of calling a rescan interface corresponding to the type to trigger the host to rescan the unrecognized PCIE endpoint device can be optimized according to the type of the operating system, including:
[0065] 1) If the operating system is a Linux operating system, the PCIE hot-swap interface of the operating system is called to trigger the host to rescan the PCIE endpoint device.
[0066] Specifically, if the operating system is a Linux operating system, the Linux system triggers the host to rescan the PCIE endpoint device by calling the hot plug (Rescan) interface of the PCIE.
[0067] 2) If the operating system is a Windows operating system, the device console tool is called to trigger the host to rescan the PCIE endpoint device.
[0068] Specifically, if the operating system is a Windows operating system, the rescanning of the PCIE endpoint device is triggered by calling a device console (Devcon) tool in the Windows system.
[0069] The above technical solution specifies the steps of calling the rescan interface corresponding to the type to trigger the host to rescan the unrecognized PCIE endpoint device for different operating system types, thereby solving the problem that the RC cannot automatically identify the device after the system is started.
[0070] The above technical solution realizes the need to trigger the host to rescan according to the host situation or to trigger the rescan of the endpoint device by soft resetting the host.
[0071] In order to more clearly describe the PCIE endpoint device scanning method provided by the embodiment of the present invention, the scanning of a PCIE endpoint device in a certain actual application scenario is taken as an example for explanation. Figure 3 The following is an example flow chart of the execution of the PCIE endpoint device scanning method in a certain application scenario provided by the second embodiment of the present invention, such as Figure 3 As shown, the execution steps of the PCIE endpoint device scanning method specifically include:
[0072] S1. When the operating system starts, the scanning service process installed in the PCIE endpoint device driver of the host is loaded.
[0073] S2. Searching for a preset PCIE endpoint device based on a scanning service process.
[0074] S3. If the scanning service process finds a PCIE endpoint device, the found PCIE endpoint device is recorded as an identified PCIE endpoint device, and handshake information is periodically sent based on the heartbeat mechanism to communicate with the identified PCIE endpoint device.
[0075] S4. Determine whether the handshake information is normal. If the handshake information is abnormal and exceeds the set retry count threshold, execute step S7 or S8.
[0076] S5. If the scanning service process fails to find the PCIE endpoint device, the PCIE endpoint device that is not found is recorded as an unrecognized PCIE endpoint device.
[0077] S6. Determine whether the number of rescans is less than or equal to the set scan number threshold. If the number of rescans is less than or equal to the set scan number threshold, execute steps S7-S8; if the number of rescans is greater than the set scan number threshold and no unrecognized PCIE endpoint device is scanned, execute step S9.
[0078] S7. If the operating system is a Linux operating system, the PCIE hot-swap interface of the operating system is called to trigger the host to rescan the PCIE endpoint device, and then return to step S2.
[0079] S8. If the operating system is a Windows operating system, the device console tool is called to trigger the host to rescan the PCIE endpoint device, and then the process returns to step S2.
[0080] S9. Perform a hot restart and reset on the host based on the hot restart and reset interface of the operating system, and return to step S2.
[0081] S10, until all preset PCIE endpoint devices are found.
[0082] Embodiment 3
[0083] Figure 4 The present invention provides a schematic diagram of the structure of a PCIE endpoint device scanning device provided in the third embodiment of the present invention. The device is applicable to the case of scanning PCIE endpoint devices in a PCIE soft core IP scenario. The PCIE endpoint device scanning device can be implemented in the form of hardware and / or software and is generally integrated in an electronic device. Figure 4 As shown, the system includes: a process loading module 31, a device search module 32, a communication module 33 and a rescanning module 34; wherein,
[0084] The process loading module 31 is used to load the scanning service process installed in the PCIE endpoint device driver of the host when the operating system is started;
[0085] The device search module 32 is used to search for a preset PCIE endpoint device based on a scanning service process;
[0086] The communication module 33 is used for recording the found PCIE endpoint device as an identified PCIE endpoint device if the scanning service process finds the PCIE endpoint device, and periodically sending handshake information based on the heartbeat mechanism to communicate with the identified PCIE endpoint device;
[0087] The rescanning module 34 is used to record the unfound PCIE endpoint device as an unrecognized PCIE endpoint device if the scanning service process fails to find the PCIE endpoint device, and call the rescanning interface of the operating system to trigger the host to rescan the unrecognized PCIE endpoint device.
[0088] The embodiment of the present invention provides a PCIE endpoint device scanning device, which adds a scanning service process in the endpoint device driver, and the scanning service process is automatically loaded when the operating system is started. When the host is started, the scanning service process attempts to trigger the host to re-enumerate the PCIE endpoint device by calling the host's rescan interface, which solves the problem that when the endpoint device and the host are powered on and started together, the host cannot identify the endpoint device after startup due to the slow startup of the endpoint device. Accurate scanning and identification of PCIE endpoint devices are achieved.
[0089] Optionally, the rescanning module 34 may include:
[0090] an unidentified determination unit, configured to record the unfound PCIE endpoint device as an unidentified PCIE endpoint device if the scanning service process fails to find the PCIE endpoint device;
[0091] A times determination unit, used to determine whether the number of rescanning times is less than or equal to a set scanning times threshold;
[0092] The rescanning unit is used to call a rescanning interface corresponding to the type of the operating system to trigger the host to rescan the unrecognized PCIE endpoint device if the rescanning times are less than or equal to the set scanning times threshold.
[0093] Optionally, a rescan unit is provided, specifically for:
[0094] If the operating system is a Linux operating system, the PCIE hot-swap interface of the operating system is called to trigger the host to rescan the PCIE endpoint device;
[0095] If the operating system is a Windows operating system, the device console tool is called to trigger the host to rescan the PCIE endpoint device.
[0096] Optionally, the rescanning module 34, after periodically sending handshake information based on the heartbeat mechanism to communicate with the identified PCIE endpoint device, is further configured to:
[0097] If the handshake information is abnormal and exceeds the set retry count threshold, the rescan interface of the operating system is called to trigger the host to rescan the PCIE endpoint device.
[0098] Optionally, the hot restart module of the device is specifically used for:
[0099] If no unrecognized PCIE endpoint device is scanned when the number of rescan times is greater than the set scan number threshold, a hot restart reset is performed on the host based on the hot restart reset interface of the operating system.
[0100] Optionally, after performing hot restart and reset on the host based on the hot restart and reset interface of the operating system, the device search module 32 is further configured to:
[0101] Return and re-execute the step of searching for the preset PCIE endpoint device based on the scanning service process until all the preset PCIE endpoint devices are found.
[0102] The PCIE endpoint device scanning apparatus provided in the embodiment of the present invention can execute the PCIE endpoint device scanning method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0103] Embodiment 4
[0104] Figure 5 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. The components, their connections and relationships, and their functions shown herein are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0105] like Figure 5 As shown, the electronic device 40 includes at least one processor 41, and a memory connected to the at least one processor 41, such as a read-only memory (ROM) 42, a random access memory (RAM) 43, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 41 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 42 or the computer program loaded from the storage unit 48 to the random access memory (RAM) 43. In the RAM 43, various programs and data required for the operation of the electronic device 40 can also be stored. The processor 41, the ROM 42, and the RAM 43 are connected to each other through a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.
[0106] A number of components in the electronic device 40 are connected to the I / O interface 45, including: an input unit 46, such as a keyboard, a mouse, etc.; an output unit 47, such as various types of displays, speakers, etc.; a storage unit 48, such as a disk, an optical disk, etc.; and a communication unit 49, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0107] The processor 41 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 41 executes the various methods and processes described above, such as a PCIE endpoint device scanning method.
[0108] In some embodiments, the PCIE endpoint device scanning method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 48. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 40 via the ROM 42 and / or the communication unit 49. When the computer program is loaded into the RAM 43 and executed by the processor 41, one or more steps of the PCIE endpoint device scanning method described above may be performed. Alternatively, in other embodiments, the processor 41 may be configured to perform the PCIE endpoint device scanning method in any other appropriate manner (e.g., by means of firmware).
[0109] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0110] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0111] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0112] To provide interaction with a user, the systems and techniques described herein can be implemented on a vehicle having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the vehicle. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0113] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0114] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0115] In the process of implementation, the computer program product can be written in one or more programming languages or a combination thereof to perform the computer program code for the operation of the present disclosure, including but not limited to object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0116] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0117] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A PCIE endpoint device scanning method, characterized in that: include: When the operating system starts, the scanning service process installed in the PCIE endpoint device driver of the host is loaded; Searching for a preset PCIE endpoint device based on the scanning service process; If the scanning service process finds a PCIE endpoint device, the found PCIE endpoint device is recorded as an identified PCIE endpoint device, and handshake information is periodically sent based on a heartbeat mechanism to communicate with the identified PCIE endpoint device; If the scanning service process fails to find the PCIE endpoint device, the PCIE endpoint device that is not found is recorded as an unrecognized PCIE endpoint device, and the rescan interface of the operating system is called to trigger the host to rescan the unrecognized PCIE endpoint device.
2. The method according to claim 1, characterized in that If the scanning service process fails to find the PCIE endpoint device, the PCIE endpoint device that is not found is recorded as an unrecognized PCIE endpoint device, and the rescan interface of the host is called to trigger the host to rescan the unrecognized PCIE endpoint device, including: If the scanning service process fails to find the PCIE endpoint device, the unfound PCIE endpoint device is recorded as an unrecognized PCIE endpoint device; Determine whether the number of rescans is less than or equal to the set scan number threshold; If the rescan times are less than or equal to the set scan times threshold, then according to the type of the operating system, a rescan interface corresponding to the type is called to trigger the host to rescan the unrecognized PCIE endpoint device.
3. The method according to claim 2, characterized in that The calling, according to the type of the operating system, a rescan interface corresponding to the type to trigger the host to rescan the unrecognized PCIE endpoint device comprises: If the operating system is a Linux operating system, calling the PCIE hot-plug interface of the operating system to trigger the host to rescan the PCIE endpoint device; If the operating system is a Windows operating system, a device console tool is called to trigger the host to rescan the PCIE endpoint device.
4. The method according to claim 1, characterized in that: After the handshake information is periodically sent based on the heartbeat mechanism to communicate with the identified PCIE endpoint device, the method further includes: If the handshake information is abnormal and exceeds a set retry count threshold, the rescan interface of the operating system is called to trigger the host to rescan the PCIE endpoint device.
5. The method according to claim 1, characterized in that Also includes: If the unrecognized PCIE endpoint device is not scanned when the number of rescan times is greater than the set scan number threshold, a hot restart reset is performed on the host based on the hot restart reset interface of the operating system.
6. The method according to claim 5, characterized in that After performing hot restart and reset on the host based on the hot restart and reset interface of the operating system, the method further includes: Return and re-execute the step of searching for the preset PCIE endpoint device based on the scanning service process until all the preset PCIE endpoint devices are found.
7. A PCIE endpoint device scanning device, characterized in that: include: The process loading module is used to load the scanning service process installed in the PCIE endpoint device driver of the host when the operating system is started; A device search module, used for searching a preset PCIE endpoint device based on the scanning service process; A communication module, for recording the found PCIE endpoint device as an identified PCIE endpoint device if the scanning service process finds the PCIE endpoint device, and periodically sending handshake information based on a heartbeat mechanism to communicate with the identified PCIE endpoint device; The rescanning module is used to record the unfound PCIE endpoint device as an unrecognized PCIE endpoint device if the scanning service process fails to find the PCIE endpoint device, and call the rescanning interface of the operating system to trigger the host to rescan the unrecognized PCIE endpoint device.
8. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the PCIE endpoint device scanning method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the PCIE endpoint device scanning method according to any one of claims 1 to 6 when executed.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the PCIE endpoint device scanning method according to any one of claims 1 to 6.
