Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings.
First, some terms in the embodiments of the present application will be described.
The host system is a hardware set which plays a core role in instruction operation and operation control in computer equipment, and can independently complete data processing and instruction execution. Optionally, the host system includes a central processing unit (Central Processing Unit, CPU), a memory, a motherboard, a storage device, and a power supply. The CPU is responsible for executing operation instructions and logic judgment and is an operation core of the whole host system. The memory, i.e. the random access memory, is a temporary storage space of the host system, and is used for temporarily storing running programs and data being processed, and the data in the memory can be lost after power failure. The main board is a connecting part of the host system and is used for connecting a central processing unit, a memory, a storage device, a power supply and other parts, and the main board is used for providing a data transmission channel and transmitting power. The storage device comprises a hard disk (a mechanical hard disk, a solid state hard disk and the like), is a long-term storage space of a host system, is used for permanently storing data of an operating system, software, files and the like, and cannot be lost after power is off. The power supply is an energy source of the host system and is used for converting commercial power into stable direct current required by each component, so that the normal operation of the host system is ensured.
The link control unit is a device responsible for managing the physical link between the local device and the opposite device. The link control unit is used for packaging or unpacking the communication data between the local device and the opposite device according to the protocol layer format, so that the reliable, orderly and error-free data transmission is ensured. The link control unit is responsible for the establishment, maintenance and release of links, such as connection negotiation of point-to-point links, monitoring of link status, etc.
In the related art, in a scenario where a single-host eight-card (eight graphics processors) interconnect, the chaining between two graphics processors is performed after the driver of the graphics processor is loaded and the driver completes the probe (probe) operation. The driver identifies each physical port of the first graphic processor by performing a probing operation using BDF (Bus/Device/Function) information and link port identification (link port id) of the first graphic processor as an identity token. After the first graphics processor and the second graphics processor physical layer link establishment are synchronized, the driver will reconfigure the identity information (link port identity information) of the first graphics processor, after which the first link control unit of the first graphics processor will initiate a link layer link establishment to the second graphics processor, exchanging each other's identity information. After the first graphics processor and all other graphics processors finish the link establishment, the first graphics processor is taken as a topology node, the topology information of the graphics processor on the node is generated, and thus, the driver can acquire the identity information of all other graphics processors electrically connected with the first graphics processor. The overall process takes at least several minutes from the time the computer device is powered on to the time the graphics processor topology information is built.
The related technology has the problems that 1, the device topology discovery is seriously lagged, a driver is usually loaded at the later starting period of a host system and even in a user state, before the driver cannot know which devices are physically connected to a local link port, the discovery can be realized only by relying on subsequent user data interaction or long-time polling, and the device discovery and topology information construction take too long (possibly up to a plurality of minutes);
2. The identity information is not synchronized timely, namely, in a Link training stage, although the physical connection between two graphic processors is established, the identity information (such as BDF information, link ID and the like) between the devices cannot be synchronized to the opposite terminal timely, so that a driver cannot immediately sense the identity information of the opposite terminal device in a detection stage and can acquire the identity information after the completion of a subsequent Link establishment flow;
3. The efficiency is low, the system starting speed is influenced, and particularly in a large-scale deployment scene (such as a data center and a multi-card training cluster), the integral initialization time delay is further amplified in the one-by-one detection and chain building process of a large number of to-be-built chain devices, so that the service is not beneficial to being fast and ready;
Therefore, a technical solution is needed for implementing synchronization of equipment identity information in early power-on and link training phases of a host system, and enabling a driver to quickly perceive remote connection equipment and corresponding link port information in a detection phase, so as to skip lengthy waiting and interaction processes in the related art and accelerate link establishment.
Fig. 1 shows a flowchart of a method for acquiring identity information according to an exemplary embodiment of the present application, where the method is executed by a first device for illustration, the method includes the following steps.
Step 120, in the process of performing link training between the first device and the second device, information exchange is performed between the first device and the second device based on the first identity information, so as to obtain second identity information of the second device.
Illustratively, the first device is an internal device of the host system or an external device connected to the host system. The first device is, for example, a central processor in the host system, and also, for example, an external device such as a graphics processor, a neural network processor (Neural network Processing Unit, NPU), a tensor processor (Tensor Processing Unit, TPU) connected to the host system. Optionally, the first device is a central processor, a chipset, a link master device, a link endpoint device, or the like.
After the host system is powered on, the host system enumerates the hardware devices and distributes identity information for the hardware devices. Alternatively, the hardware device may be a PCIe (PERIPHERAL COMPONENT INTERCONNECT EXPRESS, high speed serial computer expansion bus standard) device or the like. Optionally, the first identity information is identity information allocated to the first device after the host system is powered up, and the first identity information is initial identity information of the first device.
Optionally, the first identity information is BDF information, and after the first device is powered on, the first device receives BDF information configured by a BIOS (Basic Input/Output System)/UEFI (Unified Extensible FIRMWARE INTERFACE ) program. After powering up the host system, the BIOS/UEFI program will enumerate the devices during initialization and configuration of the hardware devices, and configure BDF information into the first device to inform the first device of its assigned initial identity information.
The BIOS program is pre-installed on the main board, and after the host system is started, the hardware is electrified and tested and initialized, and the bootstrap program is loaded from the storage device (such as a hard disk, a U disk, an optical disk and the like), and then the bootstrap program starts the operating system. The BIOS program can be said to be the first software loaded after the host system is started.
BDF information is used to uniquely identify each device. The BDF information includes Bus information, which is an 8-bit field used to indicate the Bus number of the device. Because of 8 bits, 256 buses can be supported. Device information, a 5-bit field, is used to represent the number of devices on a particular bus. There may be 32 devices per bus, numbered from 0 to 31.Function information, a 3-bit field, is used to indicate the Function number of a specific device. Because of the 3 bits, a device can have up to 8 functions. The structure of BDF information allows the whole system to support up to 256 buses×32 devices/buses×8 functions/devices=65536 unique functions, which is enough to meet the needs of modern computer systems.
Illustratively, after the first device receives the first identity information configured after the host system is powered up, the first device will initiate link training for the second device. Similarly, the second device initiates link training to the first device after receiving the second identity information configured after the host system is powered on. The second identity information is the identity information allocated to the second device after the host system is powered on, and the second identity information is the initial identity information of the second device. Optionally, similar to the first identity information, the second identity information is BDF information, and the second device receives the BDF information configured by the BIOS/UEFI program after the host system is powered on. In the present application, the description will be made mainly in terms of a first device, and a second device is a counterpart device of the first device, and performs similarly to the first device.
Alternatively, the first device and the second device are the same type of device, such as a graphics processor, or alternatively, the first device and the second device are different types of devices, such as a Central Processing Unit (CPU), and the second device is a graphics processor. Alternatively, the first device and the second device are both devices in the host system, or are both external devices connected to the host system, or one of the first device and the second device is a device inside the host system, and the other device is an external device of the host system.
Illustratively, prior to powering up the host system, the first device will be physically connected to the second device, where no power is applied between the first device and the second device, where the connection may be direct or indirect via an intermediate medium, such as via Regslice. After the host system is powered up, the first device will also be electrically connected to the second device, at which time power between the first device and the second device is successfully applied.
In the link training process, the first device synchronizes the first identity information to the second device, the second device also synchronizes the second identity information to the first device, and the first device acquires the second identity information of the second device through handshake exchange information between the first device and the second device. Optionally, the first device will store the acquired second identity information.
Optionally, the first device stores the second identity information of the second device into a link state register, a training state bit or a target field corresponding to a first link control unit on the first device, where the first link control unit is the link control unit on the first device, and waits for the driver to query.
Step 140, after the driver of the first device is loaded, responding to the query operation of the driver, and feeding back the second identity information of the second device to the driver.
After the driver is loaded, the second identity information of the second device is obtained by querying a link state register, a training state bit or a target field corresponding to the first link control unit on the first device.
For example, in one possible case, the link training process between the first device and the second device may be completed before the driver of the first device is successfully loaded, and at this time, after the driver of the first device is loaded, the driver of the first device may directly query to obtain the second identity information of the second device, without waiting for the link establishment procedure.
For example, in another possible scenario, the link training process between the first device and the second device may be completed after the driver of the first device is loaded, where the driver of the first device may need to go through a certain time before obtaining the second identity information of the second device. However, although a certain waiting time is required, compared with the related art, the method and the device for obtaining the second identity information of the second device after the chain establishment can be obtained after the chain establishment is completed by executing the chain establishment process after the driver is loaded, the method and the device for obtaining the second identity information of the second device can be used for executing the identity information discovery process of the second device in advance, and the second identity information of the second device can be obtained earlier than the related art.
In one embodiment, the second identity information of the second device is fed back to the driver in response to the driver polling the port status of the first device while performing device probing.
The device detection operation executed by the driver is an operation of executing identity verification, resource management, hardware initialization, software interface creation, frame integration, interconnection preparation and the like on the device by a driver initialization function automatically called by the kernel after the driver and the device are successfully matched, and initializing the device to a state manageable by an operating system.
By polling the port status of the first device, the status of all ports of the first device will be queried, and the driver can learn the identity information of all devices connected to the first device, and learn the topology structure of the devices connected to the first device centering on the first device.
In one embodiment, in response to the driver polling the port status of the first device while performing device probing, the driver is fed back with first device connected indication information indicating that the connected remote device includes a second device whose identity information is second identity information.
After the driver of the first device is loaded, the driver polls the port state of the first device when the device detects, judges whether each port is connected with the device, and when one port is polled to be connected with the device, the driver inquires the information that the port is connected with the device and further inquires the identity information of the device connected with the port. When the driver polls that a port is not connected to a device, the driver will query the port for information that the port is not connected to a device.
In one embodiment, the second identity information is used for triggering the driver to determine whether the electrical connection between the first device and the second device is an effective connection based on the state of the link state machine, and determining that the second identity information is effective if the electrical connection between the first device and the second device is an effective connection;
optionally, the link state machine state includes at least one of a training complete state and a normal operating state.
If the state of the link state machine indicates that the first device and the second device complete link training, or the link between the first device and the second device is in a normal working state, further confirming that the electrical connection between the first device and the second device is in an effective state, the driver can confirm that the queried second identity information of the second device is effective, and at the moment, the second identity information of the second device is more trusted;
If the state of the link state machine indicates that the first device and the second device do not complete the link training, or the link between the first device and the second device is not in a normal working state, further confirming that the electrical connection between the first device and the second device is in an invalid state, the driver can confirm that the queried second identity information of the second device is invalid, and the driver does not trust the second identity information of the second device and re-queries.
The driver can inquire the identity information of the second device more reliably through comprehensive judgment of the state of the link state machine, and the confidence of the inquired identity information of the second device is improved.
In the embodiment of the application, the first identity information distributed to the first device after the host system is electrified is multiplexed, the first device exchanges information with the second device based on the first identity information in the link training process to obtain the second identity information of the second device, and then the driver of the first device can quickly inquire the second identity information of the second device after being loaded.
Compared with the related art, the method and the device can acquire the second identity information of the second device through a complete link establishment flow after the driver is loaded in the related art, and the device discovery process of the driver layer is advanced to the device discovery process of the current process level on the host system, so that the second device electrically connected with the first device can be discovered more quickly after the driver is loaded, and the identity information of the second device can be queried more quickly.
In one embodiment, in the link training process, the first device further exchanges information between the first link identification information and the second device to obtain second link identification information of the second device;
After the driver of the first device is loaded, the second link identification information of the second device is fed back to the driver in response to the query operation of the driver.
The first link identification information is link identification information of a link to be established by the first device and the second device, and is used for distinguishing a plurality of parallel links. Optionally, the first link identification information uses the first device as a central node, and numbers of links established by the first device and other devices, such as numbers of links established by the first device and the second device (device a) are 1, numbers of links established by the first device and the second device (device a) are 2, and the like.
Similarly, the second link identification information is link identification information of a link to be established between the second device and the first device, and is used for distinguishing multiple parallel links. The second link identification information is the number of the link established by the second device with other equipment by taking the second device as a central node, for example, the number of the link established by the second device with equipment D is 1, the number of the link established by the second device with the first device (equipment E) is 2, and the like.
Optionally, the first link identification information and the first identity information are stored in the same field on the first device, so that the first link identification information and the first identity information can be read together in the link training process.
Optionally, the second link identification information and the second identity information obtained by exchanging with the second device are stored in the same field on the first device, so that the driver can conveniently inquire and obtain the second link identification information and the second identity information together.
By exchanging link identification information in the link training process, the driver can quickly inquire the identification of the link established by the first device and the second device after loading, so that more comprehensive information is obtained.
Based on the alternative embodiment shown in fig. 1, fig. 2 shows a flowchart of a method for obtaining identity information according to an exemplary embodiment of the present application, where the method is executed by a first device and illustrated, step 120 is preceded by step 220, step 120 includes step 240 and step 260, and the method includes the following.
Step 220, storing the first identity information in a target field corresponding to a first link control unit, where the first link control unit is a link control unit on the first device;
Illustratively, during the initialization and configuration of the first device, the BIOS/UEFI program writes BDF information into a configuration space corresponding to the first device (if the first device is a PCIe device, the configuration space is a PCIe configuration space), and the first device synchronously writes BDF information into a target field corresponding to the first link control unit on the first device. Alternatively, the target field is a dedicated field of the first link control unit, and only the first link control unit may use the field content carried in the target field.
In one embodiment, after powering up the host system, the target field is configured in a dedicated register or internal cache of the first link control unit in response to a configuration operation of the BIOS program or the UEFI program.
Illustratively, after the host system is powered on, the BIOS program or the UEFI program configures the BDF information and the target field for the first device, and the first device synchronizes the BDF information to the target field, and waits for reading the BDF information from the target field as the first identity information for information exchange during subsequent link training.
Optionally, the target field is a device identification field (Decice _id). The first device stores the first identity information into a device identification field corresponding to the first link control unit, where the device identification field is used to accommodate the identity information of the first device. The identity information of the first device comprises identity information associated with the first device for link training. Optionally, the device identification field is a reusable or expandable field.
The equipment identification field is configured for the first link control unit, and then the first link control unit can read the complete identification information of the first device for establishing the link from the equipment identification field.
Step 240, in the process of performing link training between the first device and the second device, reading the first identity information from the target field through the first link control unit;
In the process of performing link training between the first device and the second device, the first device can read the first identity information from the target field through the first link control unit on the first device for link training.
In this embodiment, the first device moves the first identity information to the target field corresponding to the first link control unit, which gives the first link control unit read permission to the first identity information, so as to ensure that the first link control unit can execute link training based on the first identity information before loading the driver.
In step 260, the first link control unit exchanges information with the second device based on the first identity information, so as to obtain second identity information of the second device.
The first device may exchange information with the second device by means of the first link control unit thereon transmitting the link training frame on the physical layer (PHY layer), to obtain second identity information of the second device.
In one embodiment, a link training is initiated by a first link control unit to transmit a first link training frame to a second link control unit on a second device, the first link training frame including first identity information. Optionally, the link training is initiated by a first physical layer module on the first link control unit, and the first link training frame is transmitted to a second physical layer module of a second link control unit on the second device, where the first physical layer module is an exemplary hardware module on the first link control unit that processes data according to a physical layer format, and the second physical layer module is an exemplary hardware module on the second link control unit that processes data according to a physical layer format. In the link training stage, the first physical layer module acquires first identity information, encapsulates the first physical layer module based on the first identity information to obtain a first link training frame, and transmits the first link training frame to the second physical layer module of the second link control unit on the second device.
And analyzing the received second link training frame through the first link control unit to obtain second identity information of the second device, wherein the second link training frame is sent by the second link control unit. Optionally, the received second link training frame is parsed by the first physical layer module on the first link control unit to obtain second identity information of the second device, where the second link training frame is sent by the second physical layer module of the second link control unit on the second device. The first physical layer module on the first link control unit also obtains a second link training frame constructed by the second physical layer module on the second link control unit, and analyzes the second identity information of the second device from the second link training frame.
Optionally, the first link training frame further includes at least one of type information of the first device, vendor identification information of the first device, and rate capability of the first device, so that the second device can also learn the type of the first device, manufacturer of the first device, rate capability of the first device, and the like by parsing the first link training frame. The type information of the first device comprises information for indicating that the first device is a graphic processor, a central processing unit or a network card, a manufacturer identifier of the first device is a unique identification number of a manufacturer of the first device, and the rate capability of the first device is used for indicating the maximum transmission speed which can be supported by the first device when data transmission is carried out.
In one embodiment, a first link training frame is constructed based on a link training protocol by a first physical layer module on a first link control unit. The link training protocol refers to a standard protocol (e.g., PCIe protocol) in which a training procedure and frame format, such as training sequence TS1/TS2 or similar training phase frames, are defined.
On the basis of the training flow and frame format defined by the link training protocol, the embodiment adds custom information in the standard training frame on the premise of not breaking the original protocol so as to transmit information by using the existing training channel. The custom information at least comprises the first identity information, and optionally at least one of first link identification information, type information of the first device, manufacturer identification information of the first device and rate capability of the first device.
At this time, the existing link training protocol is utilized to transmit the first identity information, and the requirement of quickly acquiring the second identity information after the driver is loaded can be met only by carrying out small-range adaptation on the existing protocol.
In another embodiment, the first link training frame is constructed and transmitted during a non-data transmission period by a first physical layer module on the first link control unit.
During link training or during periods of normal operation, there are some idle periods of time where there is no active data transmission. Standard protocols may dictate that certain Idle symbols (Idle) be sent during these periods to maintain link activation and synchronization. The present embodiment will not send standard idle symbols during these idle periods, but rather construct and transmit custom first link training frames. At this time, the first link training frame may be constructed and transmitted without interfering with normal data transmission, where the frame format of the first link training frame is a custom format.
In summary, in the above embodiment, after the host system is powered on, the first device will allocate the first identity information to the first device, the first device will synchronously write the first identity information into the target field corresponding to the first link control unit, and in the link training stage, the first link control unit will read the first identity information and construct the first link training frame, and synchronize the identity information of the first device and the second device by using the training frame, so that the driver of the first device can quickly perceive the second device after loading, without waiting for the subsequent link establishment procedure, and significantly improving the system initialization speed and the device topology discovery efficiency.
In an alternative embodiment, which is shown based on fig. 2, the first device and the second device also synchronize the link identification information during the link training process of the first device and the second device. Optionally, the method of synchronizing the link identification information between the first device and the second device includes the following two methods.
1. The first device reads first link identification information from the target field through a first link control unit;
Encapsulating the first link identification information in a first link training frame by a first link control unit, and
And analyzing the received second link training frame through the first link control unit to obtain second link identification information of the second device.
Optionally, the first link identification information is encapsulated in a first link training frame through a first physical layer module on the first link control unit;
And analyzing the received second link training frame through a first physical layer module on the first link control unit to obtain second link identification information of the second device.
At this time, the first identity information and the first link identification information are encapsulated in the first link training frame, the second identity information and the second link identification information are encapsulated in the second link training frame, and the first physical layer module can read the second identity information and the second link identification information through once decapsulation, so that the encapsulation resource is saved.
Optionally, in the first link training frame, the first identity information is located before the first link identification information, so as to ensure that the more important first identity information can be resolved by the second physical layer module as soon as possible, and the first link identification information can be mapped to the first device as soon as possible after the first link identification information is obtained by resolving.
Optionally, the first link training frame includes repeated information combinations, where one information combination includes a first identity information and a first link identification information. Repeated information combinations are placed in the first link training frame, so that information loss can be avoided to a certain extent, and the second device can be conveniently compared and analyzed.
2. The first device reads first link identification information from the target field through a first link control unit;
Transmitting a third link training frame to the second link control unit on the second device via the first link control unit, the third link training frame including the first link identification information, and
And analyzing the received fourth link training frame through the first link control unit to obtain second link identification information of the second device, wherein the fourth link training frame is sent by the second link control unit on the second device.
Optionally, transmitting, by the first physical layer module on the first link control unit, a third link training frame to the second physical layer module of the second link control unit on the second device, the third link training frame including the first link identification information;
And analyzing the received fourth link training frame through a first physical layer module on the first link control unit to obtain second link identification information of the second device, wherein the fourth link training frame is sent by a second physical layer module of the second link control unit on the second device.
At this time, the first identity information and the first link identification information are transmitted by different link training frames, so that the reliability of transmission is improved, when the first identity information or the first link identification information is lost, the transmission of the other information is not influenced, and the transmission resources required by each transmission can be reduced by framing transmission, so that the requirements on the software and hardware resources required by data transmission are reduced.
In one embodiment, the method for acquiring identity information provided by the application comprises the following steps:
1. BIOS configuration phase-BDF information pre-writing link control unit
After the host system is powered on, the BIOS/UEFI program will write standard PCIe BDF information into the PCIe configuration space of the corresponding device during the initialization and configuration of the hardware device (including CPU, chipset, link master/endpoint device, etc.), the local device will also write the BDF information into the special field (such as device_id field) of the link control unit associated with the local device, the link control unit of the local device is responsible for managing the physical link with the opposite terminal connection device, the device_id field is multiplexed or expanded in the scheme, and the identity identification information of the local device can be carried in the subsequent link training stage, wherein the identity identification can contain PCIe BDF information and optional link identification information.
Alternatively, the device_id field may be located in a dedicated register or internal cache of the link control unit, which the BIOS program configures in the device with BDF information at initialization.
2. Link training phase-synchronizing device information using custom training frames
When the physical layer of the link control unit begins to initiate link training (LINK TRAINING), the home device (e.g., host or expansion card) will construct and send a Custom training frame (Custom TRAINING FRAME) containing at least the following fields:
1) PCIe BDF information of the current device;
2) Link identification information of the current device (for distinguishing a plurality of parallel links);
3) Optionally other device attributes or link attributes (e.g., device type, vendor ID, rate capability, etc.);
The self-defined training frame is transmitted to the opposite terminal device through the physical layer in the link training process, after the opposite terminal device receives the self-defined training frame, the opposite terminal device analyzes the BDF information, the link identification information and other information carried in the self-defined training frame, so that the identity of the remote terminal device which is currently connected with the self-defined training frame is obtained, and in the same way, the home terminal device can also obtain the identity information of the opposite terminal device by receiving the corresponding self-defined frame sent by the opposite terminal.
Alternatively, the custom training frame may be extended based on a link training protocol (e.g., training sequence TS1/TS2 or similar training phase frames), or alternatively, the custom training frame may be derived based on inserting custom control information during non-data transmission periods (e.g., training idle periods).
Optionally, the BDF information and the link identification information may be carried by a single custom frame, or may be transferred in multiple frame phases, so as to ensure the reliability of the training process.
3. Drive loading and detection phase-fast sensing remote device
After the host system starts to enter the operating system, the related driver is loaded, and when the probe operation of the device is executed, the driver of the local device directly polls (poll) the state of the current connection port (such as a link state register, a training state bit, a current value of a device_id field, etc.), because in the link training stage, the link control unit of the local device has synchronized the information such as BDF information of the remote device through a custom training frame, and the information is recorded or mapped to the internal state of the link control unit (such as a device_id field or a special buffer memory), the driver of the local device can learn through simple state query:
1) Whether the current connection port is connected with the remote equipment or not;
2) If connected, the remote equipment has key identity information such as BDF information, link identification information and the like;
based on the information, the driver of the local device can quickly collect the equipment topology information of the current connection port of the local device in a detection stage, and does not need to wait for the subsequent initiation of an additional link establishment flow through user data and wait for topology discovery for a long time, thereby obviously shortening the system initialization time and equipment discovery delay.
Optionally, the driver may also comprehensively determine whether the remote device is effectively connected in combination with the link state machine state (e.g., whether training has been completed, whether it is in an UP state, etc.) during the polling process.
Alternatively, the method is applicable to link high speed interconnect technology, and can be extended to other proprietary or standard high speed bus systems that employ similar hierarchies (physical layer-link layer-transaction layer).
Compared with the related art, the application has the following remarkable beneficial effects:
1) The method comprises the steps of establishing a link control unit, establishing a link, pre-writing PCIe BDF information into the link control unit through a BIOS configuration stage, synchronizing remote equipment identity information by utilizing a custom frame in a link training stage, enabling a driver to quickly perceive which equipment is connected to a current connection port in a detection stage, and avoiding waiting for long-time user data interaction or a link establishment process in the related technology, thereby greatly reducing the waiting time of equipment discovery in the system starting process.
2) The application realizes synchronization of the identities (such as BDF information and link identification information) of the devices at the local end and the opposite end in a link training stage (rather than an operation stage after the drive is loaded), and the drive can acquire the remote equipment information by simply polling the state of a connection port in the detection stage, thereby avoiding the problem that the drive program in the related art can acquire the equipment list only by initiating an additional link establishment process or long-time polling, and remarkably improving the detection efficiency of the drive program and the initialization speed of the system.
3) Because the equipment topology information is quickly available in the drive detection stage, the system does not need to go through the long flow of 'drive loading → initiation of chain building → waiting for training completion → collecting topology → initializing equipment' in the traditional scheme, especially in multi-equipment and large-scale deployment scenes (such as servers and data centers), the overall starting time of the system can be obviously shortened, and the service online and resource readiness can be accelerated.
4) The driver can know which device (such as which accelerator card and which intelligent network card) is connected to the connection port of the current device in early stage by synchronizing identity information such as BDF information of the device in advance, provides accurate basic information for subsequent device management, resource allocation, fault positioning and the like, and enhances maintainability and observability of the system.
Fig. 3 is a schematic diagram illustrating an architecture for acquiring identity information according to an exemplary embodiment of the present application, where fig. 3 illustrates a first device 320 and a second device 330 as external devices of a host system 310, and optionally, at least one of the first device 320 and the second device 330 may also be an internal device of the host system 310, such as the first device 320 is a central processor inside the host system, and the second device 330 is an accelerator card or other expansion card outside the host system.
Illustratively, as shown in FIG. 3, after the host system 310 is powered up, the host system 310 will assign first identity information and second identity information to the first device 320 and the second device 330, respectively. For example, the host system allocates BDF information of the first device 320 to the first device 320 and BDF information of the second device 330 to the second device 330 by running the BIOS program. The BIOS program is stored as firmware in a storage device of the host system 310.
In the process of carrying out link training on the first device 320 and the second device 330, the first device 320 carries out information exchange with the second device 330 based on the first identity information to obtain second identity information of the second device 330, and similarly, the second device 330 carries out information exchange with the first device 320 based on the second identity information to obtain first identity information of the first device 320;
after the driver of the first device 320 is loaded (not shown in fig. 3), the first device 320 feeds back the second identity information of the second device 330 to the first driver in response to a query operation of the first driver of the first device 320, and after the driver of the second device 330 is loaded, the second device 330 feeds back the first identity information of the first device 320 to the second driver in response to a query operation of the second driver of the second device 330. A driver is run by the host system 310 and the driver will be stored in a storage device of the host system 310. Optionally, when the driver of the first device 320 detects the device, by polling the port state of the first device 320, the driver queries to obtain the second identity information of the second device 330 connected to the port of the first device 320;
Optionally, the driver of the second device 330 queries, when probing the device, the first identity information of the first device 320 connected to the port of the second device 330 by polling the port status of the second device 330.
In the embodiment of the present application, by multiplexing the first identity information allocated to the first device 320 after the host system 310 is powered on, the first device 320 exchanges information with the second device 330 based on the first identity information in the link training process, so as to obtain the second identity information of the second device 330, and further, after the driver of the first device 320 is loaded, the second identity information of the second device 330 can be quickly queried.
Compared with the related art, the second identity information of the second device 330 can be obtained only after the driver is loaded and a complete link establishment process is needed in the related art, and the method and the device for detecting the identity information of the second device can be used for detecting the second device electrically connected with the first device more quickly after the driver is loaded by taking the device detection process of the driver layer as the device detection process of the current process level on the host system in advance.
In one embodiment, as shown in fig. 4, the first device 320 stores the first identity information in a first target field corresponding to the first link control unit 321, the first link control unit 321 is a link control unit on the first device 320, the second device 330 stores the second identity information in a second target field corresponding to the second link control unit 331, and the second link control unit 331 is a link control unit on the second device 330.
In the process of carrying out link training on the first device 320 and the second device 330, the first device 320 reads first identity information from a first target field through a first link control unit 321, carries out information exchange with the second device 330 through the first link control unit 321 based on the first identity information to obtain second identity information of the second device 330, and similarly, the second device 330 reads second identity information from a second target field through a second link control unit 331, carries out information exchange with the first device 320 through the second link control unit 331 based on the second identity information to obtain first identity information of the first device 320.
In one embodiment, a first physical layer module in the first link control unit 321 initiates link training, and constructs a first link training frame, wherein the first link training frame comprises first identity information;
And analyzing, by the first physical layer module on the first link control unit 321, the received second link training frame to obtain the second identity information of the second device 330, where the second link training frame is sent by the second physical layer module of the second link control unit 331 on the second device 320.
Similarly, a second physical layer module in the second link control unit 331 initiates link training, and constructs a second link training frame, where the second link training frame includes second identity information;
And analyzing, by the second physical layer module on the second link control unit 321, the received first link training frame to obtain the first identity information of the first device 320, where the first link training frame is sent by the first physical layer module of the first link control unit 321 on the first device 320.
In the embodiment of the present application, after the host system 310 is powered on, first identity information is allocated to the first device 320, the first device 320 synchronously writes the first identity information into a target field corresponding to the first link control unit 321, and in a link training stage, the first link control unit 321 reads the first identity information and constructs a first link training frame, and synchronizes identity information of the first device and the second device by using the training frame, so that a driver of the first device 320 can quickly perceive the second device after loading, without waiting for a subsequent link establishment procedure, and the system initialization speed and the device topology discovery efficiency are significantly improved.
For other contents of the hardware architecture, reference may be made to the related contents of the above-described "method for acquiring identity information" for saving space, and details are not repeated here.
The application also provides a first device, which comprises a device discovery unit, wherein the device discovery unit is used for executing the related content of the identity information acquisition method;
In one embodiment, the device discovery unit includes a first link control unit;
a device discovery unit for reading first identity information from the target field during the link training between the first device and the second device by the first link control unit, and
And carrying out information exchange with the second device based on the first identity information through the first link control unit to obtain second identity information of the second device.
Optionally, a device discovery unit configured to initiate a link training by the first link control unit to transmit a first link training frame to the second link control unit on the second device, the first link training frame including the first identity information, and
And analyzing the received second link training frame through the first link control unit to obtain second identity information of the second device, wherein the second link training frame is sent by the second link control unit.
Optionally, the first link control unit includes a first physical layer module. A device discovery unit for initiating link training by the first physical layer module to transmit a first link training frame to a second physical layer module of the second link control unit on the second device, and
And analyzing the received second link training frame through the first physical layer module to obtain second identity information of the second device, wherein the second link training frame is sent by the second physical layer module.
For other descriptions of the first device, reference may be made to the content related to the "method for obtaining identity information" described above, which is not described herein for brevity.
Fig. 5 shows a block diagram of an electronic device according to an exemplary embodiment of the present application. Optionally, the electronic device 500 includes a first device provided by the present application.
Alternatively, the electronic device may be a portable mobile terminal such as a smart phone, tablet, MP3 player (Moving Picture Experts Group Audio Layer III, MPEG audio layer 3), MP4 (Moving Picture Experts Group Audio Layer IV, MPEG audio layer 4) player, notebook, or desktop. Electronic device 500 may also be referred to by other names of user devices, portable terminals, laptop terminals, desktop terminals, and the like. In general, electronic device 500 includes a processor 501 and a memory 502.
Processor 501 may include one or more processing cores, such as a 4-core processor, a 5-core processor, and the like. The processor 501 may be implemented in at least one hardware form of DSP (DIGITAL SIGNAL Processing), FPGA (Field-Programmable gate array), PLA (Programmable Logic Array ). The processor 501 may also include a main processor, which is a processor for processing data in a wake-up state, also referred to as a CPU (Central Processing Unit ), and a coprocessor, which is a low-power processor for processing data in a standby state. In some embodiments, the processor 501 may be integrated with a graphics processor (Graphics Processing Unit, graphics processor) for use in responsible for rendering and rendering of the content that is to be displayed by the display. In some embodiments, the processor 501 may also include an AI (ARTIFICIAL INTELLIGENCE ) processor for processing computing operations related to machine learning.
Memory 502 may include one or more computer-readable storage media, which may be non-transitory. Memory 502 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices.
In some embodiments, the electronic device 500 may also optionally include a peripheral interface 503 and at least one peripheral. Those skilled in the art will appreciate that the structure shown in fig. 5 is not limiting of the electronic device 500 and may include more or fewer components than shown, or may combine certain components, or may employ a different arrangement of components.
The application also provides a chip comprising the first device described in the above embodiment.
The application also provides a server comprising the first device as described in the above embodiment.
Fig. 6 shows a schematic structural diagram of a server according to an exemplary embodiment of the present application, where a server 600 includes a plurality of first devices 601, and at least one first device 601 on the plurality of first devices 601 is a first device described in the foregoing embodiments of the present application.
Alternatively, in the case where a plurality of first devices 601 exist in the server, any one of the plurality of first devices 601 may be regarded as the first device described in the above-described embodiment of the present application, and any one of the remaining first devices 601 may be regarded as the second device.
The application also provides a computing cluster comprising a plurality of servers, at least one of the plurality of servers comprising the first device as described in the above embodiments.
It should be understood that references herein to "a plurality" are to two or more. "and/or" describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate that there are three cases of a alone, a and B together, and B alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program for instructing relevant hardware, where the program may be stored in a computer readable storage medium, and the storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The foregoing description of the preferred embodiments of the application is not intended to limit the application to the precise form disclosed, and any such modifications, equivalents, and alternatives falling within the spirit and principles of the application are intended to be included within the scope of the application.