Data transmission method, electronic equipment, system and storage medium
By introducing a direct data transfer module into the RC device, the data to be transmitted by the EP device is directly stored in the cache of the target processor, solving the problem of low data transmission efficiency in the PCIe bus system and achieving more efficient data transmission.
Patent Information
- Application Number
- CN202411782958.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-04-11
AI Technical Summary
In the existing PCIe bus system, the process of uploading data to the processor by EP devices is too cumbersome, resulting in low data transmission efficiency.
A direct data transmission module is introduced into the RC device, and a transaction layer data packet TLP message is received by the EP device through the transmission controller, and a determination is made on the basis of the target device identification whether the EP device belongs to a preset fast access device. If so, the data to be transferred is sent directly to the cache of the target processor.
By directly storing the data to be transmitted to the cache of the target processor, the data transmission path is greatly simplified and the data transmission efficiency is significantly improved.
Smart Images

Figure CN119814706A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data transmission method, electronic device, system and storage medium. Background Art
[0002] Combination Figure 1 As shown, in the PCIe (Peripheral Component Interconnect express) bus system provided by the relevant technology, processor 0, processor 1, RC (Root Complex) device, memory, LLC (Last Level Cache) and other related devices are respectively connected to the on-chip network, and data is transmitted through the on-chip network. The EP (End Point) device is connected to the RC device, and is connected to the on-chip network through the RC device.
[0003] In actual applications, the EP device needs to feed back data to the processor during operation. Taking the EP device feeding back data to processor 0 as an example, first, according to Figure 1 In the transmission path shown by the dotted line A, the EP device sends the data to be transmitted to the RC device, and the RC device sends the data to be transmitted to the memory or LLC through the on-chip network. Afterwards, according to the transmission path shown by the dotted line B, the processor 0 accesses the memory or LLC, reads the data to be transmitted and stores the data to be transmitted in the internal cache, and finally completes the data transmission process.
[0004] Based on the above data transmission process, it can be seen that the process of uploading data from the EP device to the processor is too cumbersome, which seriously affects the data transmission efficiency. Summary of the invention
[0005] In view of this, the present application is committed to providing a data transmission method, electronic device, system and storage medium to solve the problem of low data transmission efficiency in related technologies.
[0006] In a first aspect, the present application provides a data transmission method, which is applied to a root complex RC device configured with a data direct transmission module, wherein the data direct transmission module includes a transmission controller, and the method includes the following steps performed by the transmission controller:
[0007] Receive a transaction layer data packet TLP message provided by an EP device, wherein the TLP message includes a first field, a second field, and data to be transmitted, wherein the first field indicates a target processor corresponding to the EP device, and the second field records a target device identifier of the EP device;
[0008] Determining whether the EP device belongs to a preset quick access device based on the target device identifier;
[0009] If the EP device is a preset fast access device, the data to be transmitted is sent to the cache of the target processor.
[0010] In an optional implementation, judging whether the EP device belongs to a preset quick access device based on the target device identifier includes:
[0011] Obtain a pre-created device identification set, wherein the device identification set records the device identification of each preset quick access device;
[0012] If the target device identifier is recorded in the device identifier centrally, it is determined that the EP device belongs to a preset quick access device;
[0013] If the target device identifier is not recorded in the device identifier set, it is determined that the EP device does not belong to the preset quick access device.
[0014] In an optional implementation, the data direct transmission module further includes a register group, the register group includes at least one device identification register, and each of the device identification registers is used to store a device identification in the device identification set.
[0015] In an optional implementation, the data transmission method provided in the first aspect of the present application further includes:
[0016] After the data to be transmitted is sent, a first interrupt signal is sent to the target processor, where the first interrupt signal is used to trigger the target processor to obtain the data to be transmitted.
[0017] In an optional implementation, the data transmission method provided in the first aspect of the present application further includes:
[0018] If the EP device is not a preset fast access device, the data to be transmitted is transmitted to a memory or a last-level cache.
[0019] In a second aspect, the present application provides a data transmission method, applied to an endpoint EP device, the method comprising:
[0020] Encapsulating a transaction layer data packet TLP message, the TLP message includes a first field, a second field and data to be transmitted, the first field indicates a target processor corresponding to the EP device, and the second field records a target device identifier of the EP device;
[0021] The TLP message is sent to the root complex RC device, and the RC device sends the to-be-transmitted data to the cache of the target processor when determining that the EP device belongs to a preset fast access device based on the target device identifier.
[0022] In an optional implementation, the EP device includes a direct memory access DMA register, and the DMA register stores a processor identification of the target processor;
[0023] The encapsulated transaction layer data packet TLP message includes:
[0024] Acquire the data to be transmitted, the target device identifier of the EP device, and the processor identifier stored in the DMA register;
[0025] The TLP message is encapsulated based on the data to be transmitted, the target device identifier, and the processor identifier.
[0026] In an optional implementation, the first field and the second field are respectively configured based on a multiplexing field in the TLP header.
[0027] In an optional implementation, the data transmission method provided in the second aspect of the present application further includes:
[0028] After the TLP message is sent, a second interrupt signal is output, wherein the second interrupt signal is used to trigger the RC device to send a first interrupt signal to the target processor after the data to be transmitted is sent;
[0029] The first interrupt signal is used to trigger the target processor to obtain the data to be transmitted.
[0030] In an optional implementation, before encapsulating the TLP message, the method further includes:
[0031] A new device request is sent to the target processor, where the new device request is used to instruct the target processor to configure the EP device as a preset fast access device.
[0032] In an optional implementation, the data transmission method provided in the second aspect of the present application further includes:
[0033] A remove device request is sent to the target processor, where the remove device request is used to instruct the target processor to configure the EP device as a non-preset fast access device.
[0034] In a third aspect, the present application provides a data transmission method, applied to a processor, the method comprising:
[0035] Obtaining a first interrupt signal, wherein the first interrupt signal is triggered by the root complex RC device after sending the data to be transmitted to the cache of the processor;
[0036] The data to be transmitted is carried in a transaction layer data packet TLP message provided by an endpoint EP device, the TLP message also includes a first field indicating the processor and a second field recording a target device identifier of the EP device, and the data to be transmitted is sent by the RC device when it is determined that the EP device belongs to a preset fast access device based on the target device identifier;
[0037] In response to the first interrupt signal, the data to be transmitted in the cache is acquired.
[0038] In an optional implementation, before obtaining the first interrupt signal, the method further includes:
[0039] The EP device is configured as a preset quick access device.
[0040] In an optional implementation, the RC device includes a pre-created device identification set;
[0041] Configuring the EP device as a preset quick access device includes:
[0042] The target device identification of the EP device is added to the device identification set to configure the EP device as a preset quick access device.
[0043] In an optional implementation, the RC device includes a data direct transmission module, the data direct transmission module includes a register group, the register group includes at least one device identification register, each of the device identification registers is used to store a device identification in the device identification set;
[0044] Adding the target device identification of the EP device to the device identification set includes:
[0045] The target device identification of the EP device is added to the device identification register.
[0046] In an optional implementation, the processor loads an EP device driver and a data direct transmission module driver;
[0047] Adding the target device identification of the EP device to the device identification register includes:
[0048] Sending a first request to the data direct transmission module driver through the EP device driver, where the first request includes the target device identifier;
[0049] The data direct transmission module drives the response to the first request and adds the target device identification to the device identification register.
[0050] In an optional implementation, the data transmission method provided in the third aspect of the present application further includes:
[0051] In response to the device removal request of the EP device, the EP device is configured as a non-preset quick access device.
[0052] In an optional implementation, the RC device includes a data direct transmission module, the data direct transmission module includes a register group, the register group includes at least one device identification register, each of the device identification registers is used to store a device identification of a preset fast access device;
[0053] Configuring the EP device as a non-preset quick access device includes:
[0054] The device identification of the EP device stored in a target device identification register is deleted, where the target device identification register is a device identification register corresponding to the EP device.
[0055] In an optional implementation, before obtaining the first interrupt signal, the method further includes:
[0056] The processor identifier of the processor is sent to the EP device, so that the EP device encapsulates a TLP message based on the processor identifier.
[0057] In a fourth aspect, the present application provides an electronic device, which is configured to execute the data transmission method as described in any one of the first aspect, the second aspect or the third aspect of the present application.
[0058] In a fifth aspect, the present application provides a data transmission system, comprising: at least one processor, a root complex RC device, an endpoint EP device and an on-chip network, wherein:
[0059] Each of the processors, the RC device, and the EP device is connected to the on-chip network respectively;
[0060] The RC device includes a data direct transmission module, the data direct transmission module includes a transmission controller, and the transmission controller executes the data transmission method according to any one of the first aspects of the present application;
[0061] The EP device performs the data transmission method as described in any one of the second aspects of the present application;
[0062] The processor executes the data transmission method as described in any one of the third aspects of the present application.
[0063] In a sixth aspect, the present application provides a computer-readable storage medium storing a computer program, which, when executed, implements the data transmission method as described in any one of the first aspect, the second aspect, or the third aspect of the present application.
[0064] Based on the above content, the data transmission method provided by the present application, the EP device encapsulates a TLP message, the TLP message includes a first field indicating the target processor, a second field recording the target device identifier of the EP device, and the data to be transmitted, the RC device receives the TLP message provided by the EP device, and when it is determined based on the target device identifier that the EP device belongs to a preset fast access device, sends the data to be transmitted to the cache of the target processor, the processor obtains the data to be transmitted in the cache, and completes the data to be transmitted. The present application stores the data to be transmitted of the EP device directly to the cache of the target processor through the RC device, and the data transmission path is greatly simplified. Compared with the related technology, the data transmission efficiency can be effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0066] Figure 1 It is a structural diagram of a PCIe bus system in the related technology.
[0067] Figure 2 It is a structural diagram of a data transmission system provided by this application.
[0068] Figure 3 It is a structural diagram of the register group in the data direct transfer module provided by this application.
[0069] Figure 4 This is a flow chart of a data transmission method provided by this application.
[0070] Figure 5 This is a schematic diagram of the structure of the TLP header of the TLP message.
[0071] Figure 6 This is a flowchart of another data transmission method provided by the present application. DETAILED DESCRIPTION
[0072] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0073] PCIe (Peripheral Component Interconnect express) is a high-speed serial computer expansion bus standard, which is widely used for communication between processors and high-speed peripherals. In practical applications, the PCIe bus system consists of multiple point-to-point interconnected components, combined with Figure 1 As shown, the aforementioned PCIe component may include at least one processor ( Figure 1 The processor 0 and processor 1 are shown in the figure), RC (Root Complex) devices, storage and EP devices, etc., wherein the storage can be a memory or LLC (Last Level Cache). Each processor, RC device and storage in the aforementioned PCIe component are respectively connected to the on-chip network, communicate with each other through the on-chip network to complete data transmission. Furthermore, the EP (End Point) device is connected to the RC device as a downstream device of the RC device, and is connected to the on-chip network through the RC device. In actual applications, the EP device can send data to the on-chip network through the RC device, or receive data transmitted by the on-chip network through the RC device.
[0074] In a typical CPU+accelerator heterogeneous computing system, the RC device is located between the processor and the PCIe topology. It is connected to the processor through the on-chip network and manages the nodes in the PCIe tree topology. The main function of the RC device is to complete the address conversion from the memory domain to the PCIe bus domain. It is also the root of the PCIe bus system. The interfaces of the PCIe bus system and peripherals can be integrated into the RC device. It can lead to several PCIe interfaces, each of which can be connected to the PCIe node. The RC device can obtain the message transmitted by the PCIe node to access the memory. Correspondingly, the RC device can also send the processor's request information to the EP device mounted on the system, thereby realizing the communication between the processor and the EP device.
[0075] EP devices can be understood as devices that implement independent functions in the PCIe bus system. Different EP devices often support different functions, so that the PCIe bus system as a whole can support diverse application functions. In actual applications, typical EP devices include graphics cards, network cards, etc. At the same time, EP devices are also the initiators and responders of PCIe transactions.
[0076] Any processor also communicates with other PCIe components in the system through the on-chip network, sending data to other PCIe components or receiving data uploaded by other PCIe components. Figure 1As shown, each processor is also configured with a cache. When data is transmitted, the data first reaches the cache, and the processor core transmits data by accessing the cache. The high-speed reading and writing of data by the cache improves the efficiency of the processor in processing data.
[0077] Figure 1 In the PCIe bus system shown in FIG. 1 , in actual applications, the EP device needs to feed back data to the processor during operation. Taking the EP device feeding back data to the processor 0 as an example, first, according to Figure 1 In the transmission path shown by the dotted line A, the EP device sends the data to be transmitted to the RC device, and the RC device sends the data to be transmitted to the memory or LLC through the on-chip network. Afterwards, according to the transmission path shown by the dotted line B, the processor 0 accesses the memory or LLC, reads the data to be transmitted and stores the data to be transmitted in the internal cache, and finally completes the data transmission process.
[0078] Based on the above data transmission process, it can be seen that the process of uploading data from the EP device to the processor is too cumbersome, which seriously affects the data transmission efficiency.
[0079] In order to solve the above problems, the present application provides a data transmission system, combined with Figure 2 As shown, the data transmission system provided by the present application includes: at least one processor ( Figure 2 Two processors, namely processor 1 and processor 2, are shown), RC devices, EP devices and an on-chip network. As an optional implementation, the data transmission system provided by the present application also includes a preset memory, such as a memory and LLC. Each processor, RC device, EP device and memory are respectively connected to the on-chip network and communicate with each other through the on-chip network.
[0080] Compared with the related art, in the data transmission system provided by the present application, the RC device is also configured with a data direct transmission module. Furthermore, the data direct transmission module includes a transmission controller and a register group, wherein the transmission controller is used to execute the data transmission method provided in the subsequent embodiments of the present application, and the register group is used to store relevant information involved in the data transmission process.
[0081] In an optional implementation, the register group of the data direct transfer module may include: Figure 3The registers shown. Specifically, the register group includes a 64-bit capability register for recording a 16-bit version number to identify the version information of the data direct transfer module, so that in actual applications, the update iteration status of the data direct transfer module can be determined by the version number, and whether the currently used data direct transfer module is the latest version can be determined. Furthermore, it also includes a 16-bit requester threshold, wherein the requester refers to the device applying for the aforementioned DCA function, in this application, that is, the EP device connected to the RC device. The maximum number of EP devices supported by the data direct transfer module can be limited by the requester threshold. The remaining 32 in the capability register are reserved for subsequent development and use.
[0082] Furthermore, the register group also includes a 64-bit status register, one of which is used as an enable bit, through which the data direct transmission module is enabled or disabled. For example, when the enable bit is set to 1, the data direct transmission module is enabled or activated, and when the enable bit is set to 0, the data direct transmission module is disabled. The remaining 63 bits of the status register are reserved for subsequent development and use.
[0083] The register group also includes at least one 32-bit device identification register, each of which is used to store the device identification of a requester device (i.e., EP device). In combination with the foregoing, the maximum number of EP devices supported by the data direct transmission module can be configured through the capability register. Therefore, in actual applications, the capability register and the device identification register need to be used in conjunction, that is, the number of device identification registers used is limited by the capability register. It can be understood that the actual number of device identification registers can be set in combination with the number of EP devices that the RC device can connect to. When the number of EP devices actually connected to the RC device is less than the set number of device identification registers, the device identification registers that can be used are limited by configuring the capability register, thereby ensuring the match between the device identification register and the EP device, and ensuring that the device identification of each EP device can be stored through a device identification register.
[0084] Of course, in practical applications, registers for implementing other functions can also be set in the register group in combination with data transmission requirements. This will not be described in detail here. Unless it exceeds the core idea of this application, it also falls within the scope of protection of this application.
[0085] In an optional embodiment, Figure 3 Each register in the register group shown can be configured by any processor in the data transmission system provided by this application. As for the specific configuration process of each register, it will be expanded in detail in the subsequent content and will not be described in detail here.
[0086] It can be understood that the data direct transfer module in the RC device can write the data to be transmitted directly into the processor's cache based on the data transmission method provided by the present application, that is, directly access the cache. Based on this, the data direct transfer module provided by the present application can also be called a direct cache access (Direct Cache Access, DCA) engine. Correspondingly, the cache direct access function implemented by the data direct transfer module can also be called a DCA function.
[0087] When data transmission is performed through the data transmission system provided by the present application, the EP device encapsulates a TLP message, which includes a first field indicating the target processor, a second field recording the target device identifier of the EP device, and the data to be transmitted. The RC device receives the TLP message provided by the EP device, and when it is determined based on the target device identifier that the EP device belongs to a preset fast access device, the RC device sends the data to be transmitted to the cache of the target processor. The processor obtains the data to be transmitted in the cache and completes the data to be transmitted. The present application stores the data to be transmitted of the EP device directly to the cache of the target processor through the RC device, and the data transmission path is greatly simplified. Compared with the related technology, the data transmission efficiency can be effectively improved.
[0088] Based on the above data transmission system, the present application also provides a data transmission method, see Figure 4 As shown, the data transmission method provided by the present application may include the following steps.
[0089] S100. The EP device encapsulates the TLP message.
[0090] Data is transmitted between PCIe nodes in the PCIe bus system in the form of messages. Usually, the PCIe node encapsulates the TLP message according to the type of communication request, the destination address, the specific data to be transmitted, and other related attributes.
[0091] Different from the related art, the TLP message encapsulated by the EP device in the present application includes not only the data to be transmitted, but also a first field and a second field, wherein the first field is used to indicate the target processor corresponding to the EP device, and the second field is used to record the device identifier of the EP device. For the sake of ease of expression, the present application defines the device identifier of the EP device that uploads data as the target device identifier.
[0092] Combination Figure 2As shown, in actual applications, the data transmission system provided by the present application may include multiple processors and multiple EP devices. For any processor, it can be specified that one or some of the EP devices can directly send data to its own cache, and prohibit other EP devices from directly sending data to their own cache. Correspondingly, for any EP device, it can apply for direct access to the cache of one or some processors according to the requirements of data transmission efficiency. In other words, there is a preset correspondence between the processor and the EP device. The EP device can only send data directly to the cache of the processor through the RC device when uploading data to the processor with the preset correspondence. In the present application, the correspondence between the processor and the EP device is configured by the processor. The specific configuration process will be expanded in the subsequent content and will not be described in detail here. The data transmission method provided in this embodiment is applicable to the case where the correspondence between the processor and the EP device has been established.
[0093] In the PCIe standard, a TLP message mainly consists of three parts, namely the TLP header, data, and cyclic redundancy check (CRC) field. Among them, the TLP header plays an extremely critical role in the implementation of the TLP message. The TLP header is mainly used to record the relevant information of the sender, the destination address of the message receiver, the TLP type, and the data length.
[0094] The structure of a typical TLP header can be found in Figure 5 As shown, the Fmt (Format) field is used to indicate whether the TLP message carries data, and whether the TLP header is 3 double words or 4 double words (DW); the Type field is used to characterize the type of the TLP message. It should be noted that the message types here mainly include memory read (Memory Read), memory write (Memory Write), etc. The R field is a reserved field (Reserved), and the field value is generally 0 in the default state; the TC field (Traffic Class), in existing applications, the TC field in the TLP header is used to characterize the transmission level of the TLP message, including 3 bits, that is, it can represent 8 different transmission levels, namely TC0-TC7. The larger the code value of the field, the higher the transmission level of the TLP message. In addition, the TLP header also includes a multiplexing field. In actual applications, the multiplexing field can be configured as different fields that implement different functions according to the TLP message type, data transmission requirements, and the specific functions of the TLP message. Therefore, the reserved field and the multiplexing field can enable the TLP message to transmit more information. As for the functions of other fields in the TLP header, please refer to the relevant technology and will not be described in detail here.
[0095] exist Figure 5 In the example shown, bytes 0-2 in Byte4 are the multiplexing field. Based on this, this application uses bytes 0 and 1, a total of 16 bits, as the second field to record the device identification of the EP device. Figure 5 As shown, the second field is marked as Requester ID. In actual applications, the device information that can uniquely represent the EP device, such as the device code or device name of the EP, can be used as the device identifier. When encapsulating the TLP message, it is recorded in the TLP message as the field value of the second field. It can be understood that for the EP device, it can obtain its corresponding device identifier by querying its own configuration information.
[0096] Correspondingly, the 8 bits corresponding to the 2 bytes in Byte4 are used as the first field, and the first field indicates the processor that has a preset corresponding relationship with the EP device, that is, the target processor. In an optional implementation, the processor identifier of the processor can be used as the field value of the first field, that is, the first field of the TLP message indicates the corresponding processor by recording the processor identifier of the processor. In practical applications, the number of the processor in the data transmission system can be used as the processor identifier. Of course, with reference to the aforementioned device identifier, other information that can uniquely characterize the processor can also be used as the processor identifier, which also falls within the scope of protection of this application without exceeding the core idea of this application.
[0097] Since the processor ID of the processor is unknown to the EP device, the processor needs to inform the EP device of its corresponding processor ID before encapsulating the TLP message. In an optional implementation, the EP device is configured with a DMA (Direct Memory Access) controller, which implements direct access to storage space such as memory through the DMA controller. The DMA controller is provided with a DMA register. Based on this, in the process of establishing the correspondence between the aforementioned processor and the EP device, the processor writes its own processor ID into the DMA register of the EP device. When the EP device encapsulates the TLP message, it can obtain the corresponding processor ID by accessing the DMA register. As for the specific process of the processor configuring the DMA register, it will be expanded in subsequent content and will not be described in detail here.
[0098] As for the data to be transmitted, it can be various operating data generated during the operation of the EP device, or it can be data fed back by other external devices connected to the EP device. In short, any data that needs to be uploaded from the EP device to the processor can be used as the data to be transmitted in this application. This application does not limit the specific source of the data to be transmitted.
[0099] Based on the above content, the processor identifier of the target processor is used as the field value of the first field, and the target device identifier of the EP device is used as the field value of the second field. The EP device encapsulates the information such as the data to be transmitted, the processor identifier, and the target device identifier according to the TLP message format to obtain the TLP message. As for the specific encapsulation process of the TLP message, it can be implemented with reference to the relevant technology and will not be described in detail here.
[0100] S110. The EP device sends a TLP message to the RC device.
[0101] After encapsulating the TLP message, the EP device can send the TLP message to the RC device according to the communication mechanism of the PCIe bus system. Based on the communication mechanism of the PCIe bus system, it can be seen that the EP device and the RC device have point-to-point serial communication, and the TLP message of the EP device can directly reach the RC device. In actual applications, if a switch is set between the EP device and the RC device, the TLP message needs to be forwarded by the switch device before reaching the RC device.
[0102] S120. The RC device receives the TLP message.
[0103] Combination Figure 2 As shown, the RC device is directly connected to the downstream EP device for communication. As mentioned above, the RC device can also be connected to the EP device through a switching device. Based on this, the RC device can obtain the TLP message sent by the EP device based on the communication link directly connected to the EP device, or the RC device can obtain the TLP message sent by the EP device through the switching device. Of course, in actual applications, if the EP device and the RC device can also transmit TLP messages in other ways, it is also optional.
[0104] In an optional implementation, whether the RC device provides the DCA function through the data direct transmission module can be configured by the processor. In the case where the RC device is required to provide the DCA function, the processor sends an enable instruction to the transmission controller of the data direct transmission module of the RC device, and the transmission controller will receive the TLP message of the EP device only when it receives the enable instruction. Accordingly, in the case where the enable instruction is not received, the RC device can implement the transmission process of the TLP message with reference to the relevant technology.
[0105] In combination with the above content, the register group of the data direct transmission module includes a status register, through which the data direct transmission module can be enabled or disabled. Based on this, the processor writes a preset first value, such as 1, to the status register through an enable instruction to activate the data direct transmission module. Correspondingly, the processor writes a preset second value, such as 0, to the status register through a disable instruction to disable the data direct transmission module. Figure 2As shown, in the case where the data transmission system includes multiple processors, the enable instruction can be sent by any processor, and of course, the enable instruction can also be sent by a pre-designated processor.
[0106] S130: The RC device determines whether the EP device is a preset quick access device based on the target device identifier.
[0107] After the RC device receives the TLP message, it parses the TLP message according to the TLP message format to obtain the data to be transmitted, the processor identifier and the target device identifier carried in the TLP message. Based on the aforementioned message encapsulation process, it can be known that the RC device can determine the EP device that provides the TLP message based on the target device identifier, and determine the target processor based on the processor identifier, that is, the upload object of the data to be transmitted.
[0108] Furthermore, the RC device determines whether the EP device providing the TLP message belongs to the preset quick access device based on the obtained target device identifier. It should be noted that the preset quick access device mentioned in the present application refers to the EP device that establishes a preset correspondence with the processor and can transmit data directly to the processor cache through the DCA function. The establishment of the correspondence with the processor mentioned in the aforementioned content is also the process of configuring the EP device as a preset quick access device. The configuration process of the preset quick access device will be expanded in detail in the subsequent content and will not be described in detail here.
[0109] In an optional implementation, the present application provides a pre-created device identification set, which records the device identification of each preset quick access device. In other words, the EP device whose device identification is recorded in the device identification set belongs to the preset quick access device. Based on this, after extracting the target device identification of the EP device, the RC device queries the device identification set. If the target device identification is recorded in the device identification set, it is determined that the EP device belongs to the preset quick access device. On the contrary, if the target device identification is not recorded in the device identification set, it is determined that the EP device does not belong to the preset quick access device.
[0110] As mentioned above, a register group is provided in the data direct transmission module of the RC device, and the register group includes at least one device identification register, and the aforementioned device identification set can be carried by the device identification register in the register group. Specifically, each device identification register stores a device identification in the device identification set. Accordingly, the set of device identifications stored in all device identification registers is the device identification set. Based on this, after extracting the target device identification, the RC device sequentially queries the device identification recorded in each device identification register. If the target device identification is queried, the EP device is determined to be a preset quick access device. On the contrary, if the target device identification is not queried, the EP device is determined to be a non-preset quick access device.
[0111] S140: If the EP device is a preset fast access device, send the data to be transmitted to the cache of the target processor.
[0112] After the above steps, if it is determined that the EP device belongs to the preset fast access device, the RC device directly sends the data to be transmitted to the cache of the target processor indicated by the first field of the TLP message. Compared with the related art, the process of writing the data to be transmitted into the memory and reading the data to be transmitted from the memory to the cache can be omitted, thereby realizing efficient transmission of the data to be transmitted. As for the specific implementation method of the RC device directly writing the data to be transmitted into the cache through the on-chip network, it can be implemented with reference to the related technology, such as the stash transaction message provided by the on-chip network, and this application does not make specific limitations on this.
[0113] On the contrary, if the EP device is not a preset fast access device, the RC device transmits the data to be transmitted to the memory or the last-level cache through the on-chip network. The processor refers to the relevant technology and accesses the memory or LLC through the on-chip network to obtain the data to be transmitted stored therein.
[0114] S150: After the data to be transmitted is sent, the RC device sends a first interrupt signal to the target processor.
[0115] As an optional implementation, the RC device may determine the progress of sending the data to be transmitted to the target processor. After the data to be transmitted is sent, the RC device sends a first interrupt signal to the target processor to notify the target processor to read the data to be transmitted.
[0116] In an optional implementation, after the EP device completes sending the TLP message, it outputs a second interrupt signal to the RC device. The RC device responds to the obtained second interrupt signal, monitors the sending status of the data to be transmitted, and outputs the aforementioned first interrupt signal after the sending of the data to be transmitted is completed.
[0117] S160: The processor obtains the data to be transmitted in the cache in response to the first interrupt signal.
[0118] In response to the first interrupt signal, the processor accesses its own cache to read the data to be transmitted therein.
[0119] To summarize, through the data transmission method provided by the application, the EP device encapsulates a TLP message, which includes a first field indicating the target processor, a second field recording the target device identifier of the EP device, and the data to be transmitted. The RC device receives the TLP message provided by the EP device, and when it is determined based on the target device identifier that the EP device belongs to a preset fast access device, the RC device sends the data to be transmitted to the cache of the target processor. The processor obtains the data to be transmitted in the cache and completes the data to be transmitted. The present application stores the data to be transmitted of the EP device directly to the cache of the target processor through the RC device, and the data transmission path is greatly simplified. Compared with the related technology, the data transmission efficiency can be effectively improved.
[0120] The following is a detailed description of the process of configuring the RC device and the EP device of the processor, as well as the process of establishing the corresponding relationship between the EP device and the processor.
[0121] This embodiment provides another data transmission method, which is applied to Figure 2 The processor in the data transmission system shown, it should be noted that the data transmission method provided in this embodiment can be coordinated with the data transmission method provided in the previous embodiment to complete tasks such as RC device, EP device configuration, preset quick access device configuration, and further realize efficient data transmission.
[0122] See also Figure 6 As shown, the data transmission method provided in this embodiment includes the following steps.
[0123] S200: Initialize the RC device and the EP device.
[0124] The processor initializes the RC device and the EP device, including waking up the RC device and the EP device, configuring basic information related to the normal operation of the RC device and the EP device, and allocating access addresses to the RC device and the EP device. Of course, other initialization operations may also be included, which will not be described in detail here. For details, please refer to the relevant technical implementation of the PCIe bus system.
[0125] Unlike the related art, in the present application, the processor also needs to enable the DCA function of the RC device. As mentioned above, the register group of the data direct transmission module in the RC device includes a status register, through which the data direct transmission module can be enabled or disabled. Based on this, the processor writes a preset first value to the status register through an enable instruction to activate the data direct transmission module. Correspondingly, the processor writes a preset second value to the status register through a disable instruction to disable the data direct transmission module. Based on this, during the initialization process, the processor sends an enable instruction to the RC device to activate the data direct transmission module, that is, to enable the DCA function.
[0126] Furthermore, the processor also needs to register the RC device as a DCA function provider in the operating system loaded by the electronic device.
[0127] In actual applications, the EP devices in the data transmission system may come from different manufacturers, resulting in different drivers for different EP devices, making it difficult to unify the drivers for the EP devices. Based on this, in an optional implementation, the processor independently sets the drivers for the RC device and each EP device, and during the initialization process, the RC device is initialized and enabled through the driver of the RC device. It can be understood that the driver of the RC device includes a data direct transmission module driver specifically used to initialize the data direct transmission module, and accordingly, the corresponding EP device is initialized through the driver of the EP device.
[0128] S210: Configure the EP device as a preset quick access device.
[0129] As mentioned above, the RC device provides a pre-created device identification set, which records the EP devices that can use the DCA function, i.e., the preset quick access devices. Based on this, the processor accesses the RC device and adds the target device identification of the EP device to the device identification set, thereby configuring the EP device as a preset quick access device.
[0130] In an optional embodiment, the RC device carries the aforementioned device identification set through at least one device identification register in the register group, and each device identification register is used to store a device identification in the device identification set. Based on this, the processor adds the device identification of the EP device to any unoccupied device identification register, and can also configure the EP device as a preset quick access device.
[0131] When the processor configures the RC device and the EP device through different drivers, the processor first sends a first request to the data direct transfer module driver through the EP device driver, and the first request includes the target device identifier of the EP device. Further, the processor responds to the first request through the data direct transfer module driver, and adds the target device identifier to the device identifier register through the data direct transfer module driver, thereby configuring the EP device as a preset quick access device.
[0132] Furthermore, for the EP device, if it is not configured as a preset fast access device during the initialization process, and the EP device hopes to use the DCA function to improve the data transmission efficiency between the processor and the EP device, it can also actively request to become a preset fast access device. Specifically, the EP device sends a new device request to the processor, and the new device request carries the target device identifier of the EP. After the processor receives the new device request, it extracts the target device identifier carried in the request, and can configure the EP device as a preset fast access device according to the above content.
[0133] Correspondingly, for an EP device that has been configured as a preset quick access device, a device removal request can also be sent to the processor. Referring to the aforementioned new device request, the device removal request must also carry the target device identifier of the EP device. After receiving the device removal request, the processor extracts the target device identifier carried therein and configures the EP device corresponding to the target device identifier as a non-preset quick access device.
[0134] Referring to the foregoing content, the data direct transmission module in the RC device stores the device identification of the EP device through the device identification register. The EP device whose corresponding device identification is stored in any device identification register is configured as a preset quick access device. Based on this, after obtaining the target device identification carried in the device removal request, the processor queries each device identification register in turn until the target device identification register storing the target device identification is determined, and the target device identification stored in the target device identification register is deleted, that is, the EP device corresponding to the target device identification is configured as a non-preset quick access device.
[0135] S220: Send the processor identifier of the processor to the EP device.
[0136] As mentioned above, for any processor, it can be specified that one or some of the EP devices can send data directly to its own cache. Correspondingly, for any EP device, it can apply to directly access the cache of one or some processors based on the requirements of data transmission efficiency. In other words, there is a preset correspondence between the processor and the EP device.
[0137] In order to establish a corresponding relationship with the EP device, the processor sends its own processor ID to the EP device. As mentioned above, the EP device includes a DMA register. The processor writes its own processor ID into the DMA register of the EP device with which it wishes to establish a corresponding relationship, thereby completing the establishment of the above-mentioned corresponding relationship. Figure 4 The data transmission method provided in the illustrated embodiment is that when the EP device sends the data to be transmitted, it obtains the processor identifier stored in the DMA register, and encapsulates the obtained processor identifier, its own device identifier and the data to be transmitted into a TLP message. The transmission controller in the RC device can determine the correspondence between the processor and the EP device based on the processor identifier and the device identifier recorded in the TLP message, thereby completing the data transmission process according to the above-mentioned data transmission method, which will not be repeated here. For details, please refer to the above-mentioned content.
[0138] In an optional implementation, the processor number is used as the processor identifier, which means that there may be a processor with the processor number 0, and in computer technology, 0 can also represent disabling information. In order to avoid the processor number 0 being the same as the disabling information, the processor number can be negated and the negated result can be used as the processor identifier of the corresponding processor.
[0139] For example, when the processor loads the EP device driver and the data direct transfer module driver respectively, the processor sends the processor number to the data direct transfer module driver through the EP device driver, further inverts the processor number through the data direct transfer module driver, and feeds back the inverted result to the EP device driver. The EP device driver stores the inverted result of the processor number as the processor identifier in the DMA register of the EP device, thereby completing the establishment of the aforementioned corresponding relationship.
[0140] It is understandable that in accordance with Figure 4 During data transmission in the illustrated embodiment, the processor identifier encapsulated by the EP device is also the inverted result of the processor number. After the RC device obtains the processor identifier, that is, the inverted result of the processor number, it needs to perform the inversion operation again to obtain the correct processor number, thereby determining the target processor.
[0141] To sum up, through the method provided in this embodiment, the initialization of the RC device and the EP device can be completed, and the EP device can be configured as a preset quick access device. At the same time, a corresponding relationship between the processor and the EP device is established. After that, the data transmission process provided in the aforementioned embodiment can be executed to achieve efficient data transmission between the EP device and the processor.
[0142] Furthermore, the present application also provides an electronic device, which is configured to execute the data transmission method provided in any of the aforementioned embodiments.
[0143] In some embodiments, this embodiment further provides a computer-readable storage medium, such as a floppy disk, an optical disk, a hard disk, a flash memory, a USB flash disk, an SD (Secure Digital Memory Card) card, an MMC (Multimedia Card) card, etc., in which one or more instructions for implementing the above steps are stored, and when the one or more instructions are executed by one or more processors, the processors execute the data transmission method described above. For the relevant specific implementation, please refer to the above description, which will not be repeated here.
[0144] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the data transmission method according to various embodiments of the present application described in the above content of this specification.
[0145] The computer program product may be written in any combination of one or more programming languages to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0146] Those skilled in the art will appreciate that the contents disclosed in this disclosure may be subject to various modifications and improvements. For example, the various devices or components described above may be implemented by hardware, or by software, firmware, or a combination of some or all of the three.
[0147] In addition, although the present disclosure makes various references to certain units in the system according to embodiments of the present disclosure, any number of different units can be used and run on the client and / or server. The units are only illustrative, and different aspects of the system and method can use different units.
[0148] Flowcharts are used in this disclosure to illustrate the steps of the method according to the embodiments of the present disclosure. It should be understood that the preceding or following steps are not necessarily performed precisely in order. On the contrary, various steps may be processed in reverse order or simultaneously. At the same time, other operations may also be added to these processes.
[0149] Those skilled in the art will appreciate that all or part of the steps in the above method can be completed by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, such as a read-only memory, etc. Optionally, all or part of the steps in the above embodiment can also be implemented using one or more integrated circuits. Accordingly, each module / unit in the above embodiment can be implemented in the form of hardware or in the form of a software functional module. The present disclosure is not limited to any particular form of combination of hardware and software.
[0150] Unless otherwise defined, all terms used herein have the same meaning as commonly understood by those of ordinary skill in the art to which the present disclosure belongs. It should also be understood that terms such as those defined in common dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant technology, and should not be interpreted in an idealized or highly formal sense, unless explicitly defined as such herein.
[0151] The above is an explanation of the present disclosure and should not be considered as a limitation thereof. Although several exemplary embodiments of the present disclosure are described, it will be readily understood by those skilled in the art that many modifications may be made to the exemplary embodiments without departing from the novel teachings and advantages of the present disclosure. Therefore, all such modifications are intended to be included within the scope of the present disclosure as defined in the claims. It should be understood that the above is an explanation of the present disclosure and should not be considered to be limited to the specific embodiments disclosed, and modifications to the disclosed embodiments and other embodiments are intended to be included within the scope of the appended claims. The present disclosure is defined by the claims and their equivalents.
Claims
1. A data transmission method, characterized in that: The method is applied to a root complex RC device configured with a data direct transmission module, wherein the data direct transmission module includes a transmission controller, and the method includes the following steps performed by the transmission controller: Receive a transaction layer data packet TLP message provided by an EP device, wherein the TLP message includes a first field, a second field, and data to be transmitted, wherein the first field indicates a target processor corresponding to the EP device, and the second field records a target device identifier of the EP device; Determining whether the EP device belongs to a preset quick access device based on the target device identifier; If the EP device is a preset fast access device, the data to be transmitted is sent to the cache of the target processor.
2. The method according to claim 1, characterized in that Determining whether the EP device belongs to a preset quick access device based on the target device identifier includes: Obtain a pre-created device identification set, wherein the device identification set records the device identification of each preset quick access device; If the target device identifier is recorded in the device identifier centrally, it is determined that the EP device belongs to a preset quick access device; If the target device identifier is not recorded in the device identifier set, it is determined that the EP device does not belong to the preset quick access device.
3. The method according to claim 2, characterized in that The data direct transmission module further includes a register group, wherein the register group includes at least one device identification register, and each of the device identification registers is used to store a device identification in the device identification set.
4. The method according to claim 1, characterized in that: The method further comprises: After the data to be transmitted is sent, a first interrupt signal is sent to the target processor, where the first interrupt signal is used to trigger the target processor to obtain the data to be transmitted.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: If the EP device is not a preset fast access device, the data to be transmitted is transmitted to a memory or a last-level cache.
6. A data transmission method, characterized in that: Applied to an endpoint EP device, the method includes: Encapsulating a transaction layer data packet TLP message, the TLP message includes a first field, a second field and data to be transmitted, the first field indicates a target processor corresponding to the EP device, and the second field records a target device identifier of the EP device; The TLP message is sent to the root complex RC device, and the RC device sends the to-be-transmitted data to the cache of the target processor when determining that the EP device belongs to a preset fast access device based on the target device identifier.
7. The method according to claim 6, characterized in that The EP device includes a direct memory access DMA register, wherein the DMA register stores a processor identification of the target processor; The encapsulated transaction layer data packet TLP message includes: Acquire the data to be transmitted, the target device identifier of the EP device, and the processor identifier stored in the DMA register; The TLP message is encapsulated based on the data to be transmitted, the target device identifier, and the processor identifier.
8. The method according to claim 6, characterized in that The first field and the second field are respectively configured based on the multiplexing field in the TLP header.
9. The method according to claim 6, characterized in that The method further comprises: After the TLP message is sent, a second interrupt signal is output, wherein the second interrupt signal is used to trigger the RC device to send a first interrupt signal to the target processor after the data to be transmitted is sent; The first interrupt signal is used to trigger the target processor to obtain the data to be transmitted.
10. The method according to any one of claims 6 to 9, characterized in that: Before encapsulating the TLP message, the method further includes: A new device request is sent to the target processor, where the new device request is used to instruct the target processor to configure the EP device as a preset fast access device.
11. The method according to any one of claims 6 to 9, characterized in that: The method further comprises: A remove device request is sent to the target processor, where the remove device request is used to instruct the target processor to configure the EP device as a non-preset fast access device.
12. A data transmission method, characterized in that: Applied to a processor, the method comprises: Obtaining a first interrupt signal, wherein the first interrupt signal is triggered by the root complex RC device after sending the data to be transmitted to the cache of the processor; The data to be transmitted is carried in a transaction layer data packet TLP message provided by an endpoint EP device, the TLP message also includes a first field indicating the processor and a second field recording a target device identifier of the EP device, and the data to be transmitted is sent by the RC device when it is determined that the EP device belongs to a preset fast access device based on the target device identifier; In response to the first interrupt signal, the data to be transmitted in the cache is acquired.
13. The method according to claim 12, characterized in that Before acquiring the first interrupt signal, the method further includes: The EP device is configured as a preset quick access device.
14. The method according to claim 13, characterized in that The RC device includes a pre-created device identification set; Configuring the EP device as a preset quick access device includes: The target device identification of the EP device is added to the device identification set to configure the EP device as a preset quick access device.
15. The method according to claim 14, characterized in that The RC device comprises a data direct transmission module, the data direct transmission module comprises a register group, the register group comprises at least one device identification register, each of the device identification registers is used to store a device identification in the device identification set; Adding the target device identification of the EP device to the device identification set includes: The target device identification of the EP device is added to the device identification register.
16. The method according to claim 15, characterized in that The processor loads the EP device driver and the data direct transmission module driver; Adding the target device identification of the EP device to the device identification register includes: Sending a first request to the data direct transmission module driver through the EP device driver, where the first request includes the target device identifier; The data direct transmission module drives the response to the first request and adds the target device identification to the device identification register.
17. The method according to claim 12, characterized in that The method further comprises: In response to the removal device request of the EP device, the EP device is configured as a non-preset quick access device.
18. The method according to claim 17, characterized in that The RC device includes a data direct transmission module, the data direct transmission module includes a register group, the register group includes at least one device identification register, each of the device identification registers is used to store a device identification of a preset fast access device; Configuring the EP device as a non-preset quick access device includes: The device identification of the EP device stored in a target device identification register is deleted, where the target device identification register is a device identification register corresponding to the EP device.
19. The method according to claim 12, characterized in that Before acquiring the first interrupt signal, the method further includes: The processor identifier of the processor is sent to the EP device, so that the EP device encapsulates a TLP message based on the processor identifier.
20. An electronic device, characterized in that: The electronic device is configured to execute the data transmission method as described in any one of claims 1-5 or 6-11 or 12-19.
21. A data transmission system, characterized in that: include: at least one processor, a root complex RC device, an endpoint EP device, and an on-chip network, wherein: Each of the processors, the RC device, and the EP device is connected to the on-chip network respectively; The RC device includes a data direct transmission module, the data direct transmission module includes a transmission controller, and the transmission controller executes the data transmission method according to any one of claims 1 to 5; The EP device executes the data transmission method according to any one of claims 6 to 11; The processor executes the data transmission method according to any one of claims 12 to 19.
22. A computer-readable storage medium, characterized in that: A computer program is stored, and when the computer program is executed, the data transmission method as described in any one of claims 1-5 or 6-11 or 12-19 is implemented.
Citation Information
Cited By
Data transmission method, programmable logic controller system and electronic equipment
CN121478688A