A data processing method, device, medium and program product

By creating a virtual configuration space in the virtual machine and writing the VF hardware information obtained by the host driver into the space, the client driver obtains information from the space first, which solves the problem of low efficiency in obtaining VF hardware information by the client driver in the virtual machine and realizes Efficient information acquisition and initialization.

CN118363717BActive Publication Date: 2024-10-08北京壁仞科技开发有限公司 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410797320.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-19
Publication Date
2024-10-08
Estimated Expiration
2044-06-19

AI Technical Summary

Technical Problem

The client driver in the virtual machine cannot efficiently obtain the hardware information of the VF, resulting in initialization failure, and when relying on hardware mailbox delivery, frequent communication and small capacity affect efficiency.

Method used

By creating a virtual configuration space in the virtual machine, the VF hardware information obtained by the host driver is written into this space. The client driver obtains information from this space first, avoiding frequent hardware communication, and analyzes the manufacturer's capability information when the space capacity is large. initialization.

Benefits of technology

It improves the efficiency of client drivers in obtaining VF hardware information, reduces dependence on hardware mailboxes, avoids initialization failures, and improves information transmission efficiency and success rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118363717B_ABST
    Figure CN118363717B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a data processing method, device, medium and program product to solve the problem that the client driver in the virtual machine cannot efficiently obtain the hardware information of the VF. The method includes: creating a virtual machine, transparently transmitting the first VF in the PCIE device to the virtual machine, and the first VF has a first virtual configuration space; obtaining the hardware information of the first VF from the host driver, and writing the obtained hardware information of the first VF into the first virtual configuration space; when the virtual machine loads the client driver, the hardware information of the first VF is preferentially obtained from the first virtual configuration space. Thus, the client driver can obtain the hardware information of the first VF by software, which can avoid frequent hardware communication, and the space capacity of the first virtual configuration space is large, and there is no need to transmit the hardware information of the first VF in multiple times, so that the client driver can efficiently obtain the hardware information of the VF.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of artificial intelligence technology, and in particular, to a data processing method, device, medium and program product. Background Art

[0002] Single-Root Input / Output Virtualization (SR-IOV) technology is a hardware-based virtualization solution that uses the properties of physical functions (PF) and virtual functions (VF) to virtualize a physical high-speed serial computer expansion bus standard (Peripheral Component Interconnection Express, PCIE) device into multiple virtual PCIE devices, where PF is a full-featured PCIE device and VF is a lightweight PCIE device. Multiple VFs can use the functions of the same PCIE device. Multiple VFs can be transparently transmitted to different virtual machines (VMs) for use, thereby directly accessing the hardware in a virtual machine environment to improve access performance.

[0003] Taking VF0 being transparently transmitted to virtual machine VM0 as an example, to initialize VF0 in virtual machine VM0, it is necessary to first load the guest driver in virtual machine VM0. The guest driver is a software program that can run in the virtual machine and can access the hardware resources of the VF transparently transmitted to the virtual machine. The hardware information of VF0 can be obtained through the guest driver, so that VF0 can be initialized according to the hardware information of VF0. However, the inability of the guest driver in the virtual machine to efficiently obtain the hardware information of VF is a technical problem that needs to be solved urgently. Summary of the invention

[0004] The embodiments of the present invention provide a data processing method, device, medium and program product, which are used to solve the problem that a client driver in a virtual machine cannot efficiently obtain hardware information of a VF.

[0005] In a first aspect, the present application provides a data processing method, including: creating a virtual machine, transparently transmitting a first VF in a PCIE device to the virtual machine, wherein the first VF has a first virtual configuration space; obtaining hardware information of the first VF from a host driver, and writing the obtained hardware information of the first VF into the first virtual configuration space; when the virtual machine loads a client driver, the hardware information of the first VF is preferentially obtained from the first virtual configuration space.

[0006] Through the above scheme, the client driver obtains the hardware information of the first VF from the first virtual configuration space. This software-based information acquisition method can avoid frequent hardware communications on the one hand, and on the other hand, the space capacity of the first virtual configuration space is large, and there is no need to transmit the hardware information of the first VF in multiple times, so that the client driver can efficiently obtain the hardware information of the VF.

[0007] In a possible implementation, writing the acquired hardware information of the first VF into the first virtual configuration space includes: writing the acquired hardware information of the first VF into the first virtual configuration space according to a predefined header format.

[0008] In a possible implementation, the method further includes: if the client driver successfully obtains the hardware information of the first VF from the first virtual configuration space, initializing the first VF according to the hardware information of the first VF.

[0009] In a possible implementation, the client driver successfully obtains the hardware information of the first VF from the first virtual configuration space, including: if the client driver finds the vendor capability information from the first virtual configuration space and parses the vendor capability information according to a predefined header format to obtain the hardware information of the first VF.

[0010] In a possible implementation, the method further includes: if the client driver fails to successfully obtain the hardware information of the first VF from the first virtual configuration space, obtaining the hardware information of the first VF from a mailbox, and initializing the first VF according to the obtained hardware information of the first VF.

[0011] In a possible implementation, the PCIE device is a GPU or a GPGPU.

[0012] In a second aspect, the present application provides a computer device, the computer device comprising a PCIE device and QEMU, a virtual machine monitor running in the computer device, the virtual machine monitor comprising a host driver;

[0013] The QEMU is used to create a virtual machine, and can transparently transmit a first VF in a PCIE device to the virtual machine, where the first VF has a first virtual configuration space; obtain hardware information of the first VF from a host driver, and write the obtained hardware information of the first VF into the first virtual configuration space;

[0014] When the virtual machine loads the client driver, the client driver is used to: preferentially obtain the hardware information of the first VF from the first virtual configuration space.

[0015] In a third aspect, the present application provides a computer device, comprising a memory, a processor chip, and a computer program stored in the memory and executable on the processor chip, wherein the processor chip implements the method in the above-mentioned first aspect or any possible implementation manner of the first aspect when executing the computer program.

[0016] In a fourth aspect, the present application provides a computer-readable storage medium, comprising computer-executable instructions. When the computer-executable instructions are executed on a computer, the computer executes the method in the above-mentioned first aspect or any possible implementation manner of the first aspect.

[0017] In a fifth aspect, the present application provides a computer program product, wherein the computer program product stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the method in the above-mentioned first aspect or any possible implementation manner of the first aspect.

[0018] The technical effects that can be achieved in any of the second to fifth aspects mentioned above can refer to the description of the beneficial effects in the first aspect mentioned above or any possible implementation method of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 A schematic diagram of a system architecture applicable to an embodiment of the present application;

[0020] Figure 2 A flowchart of a data processing method provided in an embodiment of the present application;

[0021] Figure 3 A schematic diagram of the data processing process provided in the embodiment of the present application;

[0022] Figure 4 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical solution and beneficial effects of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0024] Figure 1 A schematic diagram of a system architecture applicable to an embodiment of the present application.

[0025] like Figure 1As shown, the system architecture includes a PCIE device, a Quick Emulator (QEMU), a virtual machine monitor, a virtual function input-output (VFIO) driver, an input-output memory management unit (IOMMU), and at least one virtual machine. This application does not limit the number of virtual machines. Figure 1 Two virtual machines, VM0 and VM1, are exemplarily shown in FIG.

[0026] The PCIE device is a hardware device that supports the single-root input and output virtualization SR-IOV standard. A PCIE device can virtualize multiple virtual PCIE devices. The PCIE device is called a physical function (PF), and the virtual PCIE device is called a virtual function (VF). That is, the PCIE device can include at least one physical function PF and at least one virtual function VF corresponding to each PF. Figure 1 A PF and two VFs corresponding to the PF, namely VF0 and VF1, are exemplarily shown in the figure. The present application does not limit the number of PFs, nor does it limit the number of VFs corresponding to each PF.

[0027] Among them, PF is used to manage SR-IOV functions. PF is a full-featured PCIE device that can be discovered, managed and processed by the host like any other PCIE device. PF has complete configuration resources and can be used to configure or control PCIE devices. With the help of the host driver running in the host, all resources of PF can be accessed, and VF can be configured, such as configuring the number of VFs, or allocating VF to a virtual machine for use; VF is a lightweight PCIE device that can share one or more physical resources with PF and other VFs associated with the same PF. VF is only allowed to have configuration resources for its own behavior and cannot access the hardware resources of other VFs.

[0028] QEMU can create at least one virtual machine, such as Figure 1 VM0 and VM1 are shown.

[0029] The virtual machine monitor includes a kernel-based virtual machine (KVM) and a host driver, and KVM is used to manage at least one virtual machine. The host driver is a software program running on the central processing unit (CPU) of the physical machine. The host driver can communicate with the hardware device and control its operation. For example, in the embodiment of the present application, the hardware device is PF, and the host driver can communicate with the PF. It can also manage the hardware resources of the PF and the hardware resource allocation of multiple VFs corresponding to the PF, etc. The host driver may include the hardware information of the PF and the hardware information of each VF managed by the PF. KVM can also realize the function of CPU / MMU virtualization. KVM can virtualize the CPU and the memory management unit (MMU) in combination with QEMU. The virtualized CPU and the virtualized MMU can be used by the virtual machine, where the MMU can convert the virtual address visible to the CPU into a physical address. Similar to the function of MMU, IOMMU can map the virtual address visible to the device to the physical address. In addition, since the virtual machine can only access a part of the physical space in the memory of the physical machine, IOMMU also needs to provide a mechanism to ensure that the VF can only access the physical space owned by the virtual machine to which it belongs.

[0030] QEMU can also use VFIO driver and IOMMU to transparently transmit different VFs in PCIE devices to different VMs for use, such as transparently transmitting VF0 to VM0 and VF1 to VM1. Transparently transmitting VFs in PCIE devices to virtual machines is actually mounting VFs on virtual machines, so that virtual machines can directly access VF hardware without accessing hardware through virtual machine monitors. Since there is no device simulation and conversion process, performance loss is extremely small (less than 5%). Client drivers can also run in each virtual machine, and client drivers can communicate directly with VFs assigned to virtual machines, so that virtual machines can directly access VFs assigned to virtual machines through client drivers. For example, VM0 can access VF0 through client driver 0 running in VM0, and VM1 can access VF1 through client driver 1 running in VM1.

[0031] Each VF in any virtual machine has an independent PCIE configuration space. For example, when VF0 is transparently transmitted to VM0, QEMU can write the hardware information of VF0 into the PCIE configuration space of VF0, so that the client driver in VM0 can obtain the hardware information of VF0 from the PCIE configuration space of VF0. For another example, when VF1 is transparently transmitted to VM1, the hardware information of VF1 can be written into the PCIE configuration space of VF1, so that the client driver in VM1 can obtain the hardware information of VF1 from the PCIE configuration space of VF1.

[0032] In the embodiment of the present application, the host driver mainly completes PF initialization and completes the segmentation and management of PF resources, and the client driver mainly completes VF initialization and is responsible for the management and allocation of video memory for use by upper-level applications.

[0033] The PCIE device may also include at least one mailbox to enable communication between the PF and each VF. Figure 1 As shown, the PF and VF0 can communicate through mailbox 0, and the PF and VF1 can communicate through mailbox 1. In some other embodiments, the PF and each VF can also communicate through the same mailbox.

[0034] It should be understood that the system architecture in this application includes Figure 1 In addition to the structures shown, other structures may also be included, and this application does not limit this.

[0035] In the embodiment of the present application, the PCIE device may be: a graphics processing unit (Graphics Processing Unit, referred to as GPU) or a general-purpose graphics processing unit (General-Purpose Computing On Graphics Processing Units, referred to as GPGPU), etc.

[0036] When initializing the VF that is transparently transmitted to the virtual machine, the client driver needs to be loaded first so that the hardware information of the VF can be obtained through the client driver, thereby completing the initialization of the VF according to the hardware information of the VF. However, how the client driver can efficiently obtain the hardware information of the VF is a technical problem that needs to be solved urgently.

[0037] In one implementation, taking the initialization of VF0 in VM0 as an example, the client driver 0 in the virtual machine can obtain the hardware information of VF0 from PF through the mailbox mechanism, thereby completing the initialization of VF0. Specifically, the client driver 0 sends a message to the host driver through mailbox 0. After receiving the message, the host driver writes the hardware information of VF0 into mailbox 0, and then the host driver sends a notification to VF0, which is used to instruct VF0 to read the hardware information of VF0 in mailbox 0. VF0 can read the hardware information of VF0 from mailbox 0, so that the client driver can directly access VF0, thereby obtaining the hardware information of VF0. After the client driver 0 obtains the hardware information of VF0, it can initialize VF0 in the virtual machine VM0. This solution relies on the hardware mailbox. If there is a problem with the mailbox, it will cause the client driver to fail to load, and then cause the initialization VF in the virtual machine to fail. In addition, the capacity of the mailbox is very small, and it may take multiple frequent hardware communications to obtain the complete hardware information of VF0.

[0038] In view of this, the present application provides a data processing method to solve the problem of failure to load a client driver in a virtual machine due to reliance on hardware (such as mailbox) to transmit the hardware information of the VF. The data processing method provided by the present application can include Figure 1 The system architecture shown is implemented on a physical machine.

[0039] Figure 2 A flow chart of a data processing method provided in an embodiment of the present application. Figure 2 As shown, the data processing method includes:

[0040] Step 201, create a virtual machine, transparently transmit the first VF in the PCIE device to the virtual machine, and the first VF has a first virtual configuration space.

[0041] In the embodiment of the present application, QEMU in the physical machine can create a virtual machine through a virtual monitor, for example, creating VM0 and VM1 respectively through KVM in the virtual machine monitor.

[0042] The PCIE device in the above step 201 may include but is not limited to a GPU or a GPGPU. Taking the PCIE device as a GPU as an example, a physical GPU can virtualize multiple virtual GPUs, and multiple virtual GPUs can share the hardware resources on the physical GPU. The physical GPU can be called a PF, and the virtual GPU can be called a VF. The PF can configure hardware resources for each VF, such as memory, computing core and other information. For example, the relevant information of the hardware resources configured by the PF for the first VF is referred to as the hardware information of the first VF. In an embodiment of the present application, more VFs can be virtualized for the VF in the PCIE device through QEMU, and the number of VFs is not limited by the limitation of hardware resources.

[0043] When a new virtual machine is created, a VF needs to be allocated to the newly created virtual machine. A VF can be selected from the currently unallocated VFs in the PCIE device and allocated to the newly created virtual machine, and the VF can be transparently transmitted to the virtual machine for use. QEMU can transparently transmit different VFs in the PCIE device to different virtual machines through the VFIO driver and IOMMU, for example, transparently transmit VF0 to VM0 through the VFIO driver and IOMMU, and transparently transmit VF1 to VM1 through the VFIO driver and IOMMU. Each VF can have an independent virtual configuration space. For example, the first VF is Figure 1 The VF0 shown in FIG. 1 is a first virtual configuration space. Figure 1 PCIE configuration space 0 shown; for example, the first VF is Figure 1 As shown in VF1, the first virtual configuration space is as follows Figure 1 PCIE configuration space 1 is shown.

[0044] Step 202: Obtain hardware information of the first VF from the host driver, and write the obtained hardware information of the first VF into the first virtual configuration space.

[0045] Combination Figure 1 For example, if the first VF is VF0, the first virtual configuration space is PCIE configuration space 0; if the first VF is VF1, the first virtual configuration space is PCIE configuration space 1.

[0046] When loading the client driver, the virtual machine needs to obtain the hardware information of the first VF transmitted to the virtual machine. The client driver can communicate with the host driver in the virtual machine monitor through QEMU, so that the client driver can obtain the hardware information of the first VF from the host driver.

[0047] Take the first VF as Figure 1Taking VF0 in the architecture diagram shown as an example, QEMU can obtain the hardware information of VF0 from the host driver. Specifically, QEMU can obtain the hardware information of VF0 from the host driver through a system call, such as calling the ioctl function in the host driver to obtain the hardware information of VF0, and then QEMU writes the obtained hardware information of VF0 into the PCIE configuration space 0 of VF0.

[0048] In one implementation, QEMU may write the acquired hardware information of the first VF into the first virtual configuration space of the first VF according to a predefined header format, for example, encapsulating the hardware information of the first VF into vendor capability information (VendorCapability) and filling it into the first virtual configuration space, so that the client driver may parse the Vendor Capability acquired from the first virtual configuration space according to the predefined header format, thereby obtaining the hardware information of the first VF. In the embodiment of the present application, the hardware information of the first VF is filled into the first virtual configuration space in a custom format, so as to ensure the security of the hard information of the first VF.

[0049] The capacity of the first virtual configuration space is greater than the capacity of the mailbox in the PCIE device. For example, the capacity of the mailbox is 16 bytes, and only 3 double words (dword) of hardware information and 1 dword of check information can be transmitted each time. 1 dword is 4 bytes, and the check information is used to verify whether the transmitted 3 dwords of hardware information are correct. Therefore, when transmitting data through the mailbox, if the amount of information to be transmitted is large, such as the hardware information of the first VF is greater than 3 dwords, it is necessary to use the mailbox to transmit data multiple times to obtain the complete hardware information of the first VF. The capacity of the first virtual configuration space is about 4 kilobytes, in which a large space is reserved for flexible expansion, which is more flexible in use.

[0050] Step 203: When the virtual machine loads the client driver, the hardware information of the first VF is preferentially obtained from the first virtual configuration space.

[0051] In a possible implementation, if the client driver successfully obtains the hardware information of the first VF from the first virtual configuration space, the first VF is initialized according to the hardware information of the first VF obtained from the first virtual configuration space.

[0052] Specifically, the client driver may search for vendor capability information (Vendor capability) from the first virtual configuration space according to a predefined header format, and then determine whether the hardware information of the first VF is successfully acquired from the first virtual configuration space according to the result of searching for the vendor capability information.

[0053] If the client driver finds the vendor capability information from the first virtual configuration space and parses the vendor capability information according to the predefined header format to obtain the hardware information of the first VF, it is determined that the hardware information of the first VF is successfully obtained from the first virtual configuration space, and the first VF is initialized according to the hardware information of the first VF obtained from the first virtual configuration space.

[0054] If the client driver does not find the vendor capability information from the first virtual configuration space, it is determined that the hardware information of the first VF is not successfully obtained from the first virtual configuration space. Alternatively, if the client driver finds the vendor capability information from the first virtual configuration space and does not parse the hardware information of the first VF by parsing the vendor capability information according to the predefined header format, it is determined that the hardware information of the first VF is not successfully obtained from the first virtual configuration space.

[0055] In another possible implementation, if the client driver fails to successfully obtain the hardware information of the first VF from the first virtual configuration space, it communicates with the PF through the mailbox corresponding to the first VF, obtains the hardware information of the first VF from the PF, and initializes the first VF according to the obtained hardware information of the first VF.

[0056] Take the first VF as Figure 1 Taking VF0 as an example, if client driver 0 fails to successfully obtain the hardware information of VF0 from the first virtual configuration space 0, the hardware information of VF0 is obtained through the mailbox.

[0057] Combination Figure 1 To illustrate, the client driver 0 can communicate with the PF through the mailbox mechanism, obtain the hardware information of VF0 from the PF, and thus complete the initialization of VF0. Exemplarily, the client driver 0 in the virtual machine can send a message to the host driver through the mailbox 0, and the message is used to indicate the information to be obtained. For example, the message indicates that the hardware information of VF0 needs to be obtained. The host driver writes the hardware information of VF0 into the mailbox 0, and then the host driver sends a notification message to VF0, and the notification message is used to notify VF0 to take the information it needs from the mailbox 0, and then the client driver 0 can read the hardware information of VF0 from the mailbox 0.

[0058] The information read by client driver 0 from mailbox 0 includes a data part and a check code part, wherein the data part includes the hardware information of VF0. A check code can be calculated for the data part. If the calculated check code is consistent with the read check code, it means that the data part is correct, otherwise the read hardware information of VF0 is incorrect.

[0059] In the above embodiment, the client driver in a virtual machine obtains the hardware information of the first VF as an example for explanation. The specific implementation of the client driver in other virtual machines obtaining the hardware information of the first VF can refer to the above related content, which will not be repeated here.

[0060] In an embodiment of the present application, the client driver may preferentially obtain the hardware information of the first VF from the first virtual configuration space by software. If the hardware information of the first VF fails to be obtained by software, the hardware information of the first VF may be obtained by hardware mailbox.

[0061] In the embodiment of the present application, the function of shared memory is realized by software, and the hardware information of the first VF is encapsulated into the manufacturer capability information and written into the first virtual configuration space. Since each VF has a configuration space, the present application stores the hardware information of the VF by means of the virtual configuration space, and no additional storage space is required. The space capacity of the first virtual configuration space is large, and there is no need to transmit the hardware information of the first VF in multiple times. The client driver preferentially obtains the hardware information of the first VF from the virtual configuration space by software, which can reduce the dependence on the hardware mailbox and avoid the problem of failure to load the client driver in the virtual machine due to dependence on the hardware method. Moreover, it can avoid repeatedly obtaining the hardware information of the first VF from the host driver through the mailbox, improve the efficiency of information transmission, so that the client driver can efficiently obtain the hardware information of the first VF. If the hardware information of the first VF fails to be obtained from the virtual configuration space, the client driver can also obtain the hardware information of VF0 from the PF through the mailbox mechanism, which can further ensure the probability of successfully obtaining the hardware information of the first VF.

[0062] based on Figure 1 The system architecture shown in the embodiment of the present application provides Figure 3 The data processing process is shown in Figure 1. Figure 3 As shown, the data processing process mainly includes the following steps:

[0063] S301 , when loading, the host driver obtains hardware resource information from the PF, including hardware information of the PF, hardware information of VF0 and hardware information of VF1.

[0064] S302, QEMU creates a virtual machine through KVM, and transparently transmits VF0 in the PCIE device to the virtual machine VM 0, and transparently transmits VF1 to the virtual machine VM 1, wherein VF0 has PCIE configuration space 0, and VF1 has PCIE configuration space 1.

[0065] S303, QEMU obtains the hardware information of VF0 and the hardware information of VF1 from the host driver.

[0066] S304, QEMU writes the obtained hardware information of VF0 into PCIE configuration space 0, and writes the obtained hardware information of VF1 into PCIE configuration space 1.

[0067] S305, when loading client driver 0 in the virtual machine, client driver 0 preferentially obtains the hardware information of VF0 from PCIE configuration space 0; if the hardware information of VF0 is successfully obtained from PCIE configuration space 0, continue to execute S307; if the hardware information of VF0 is not successfully obtained from PCIE configuration space 0, continue to execute S306.

[0068] S306, client driver 0 obtains the hardware information of VF0 from PF through the mailbox mechanism. Then, continue to execute S307.

[0069] Here, the specific implementation of S306 can refer to the relevant description in the aforementioned method embodiment, which will not be repeated here.

[0070] S307: Client driver 0 initializes VF0 according to the acquired hardware information of VF0.

[0071] Based on the same technical concept, an embodiment of the present application provides a computer device, the computer device includes a PCIE device and QEMU, a virtual machine monitor runs in the computer device, and the virtual machine monitor includes a host driver;

[0072] The QEMU is used to create a virtual machine; transparently transmit the first VF in the PCIE device to the virtual machine, where the first VF has a first virtual configuration space; obtain the hardware information of the first VF from the host driver, and write the obtained hardware information of the first VF into the first virtual configuration space;

[0073] When the virtual machine loads the client driver, the client driver is used to: preferentially obtain the hardware information of the first VF from the first virtual configuration space.

[0074] Optionally, the QEMU is specifically configured to write the acquired hardware information of the first VF into the first virtual configuration space according to a predefined header format.

[0075] Optionally, the client driver is further configured to: if the hardware information of the first VF is successfully acquired from the first virtual configuration space, initialize the first VF according to the hardware information of the first VF.

[0076] Optionally, the client driver is further used to: if vendor capability information is found from the first virtual configuration space and the hardware information of the first VF is obtained by parsing the vendor capability information according to a predefined header format, then determine that the hardware information of the first VF is successfully obtained from the first virtual configuration space.

[0077] Optionally, the client driver is further configured to: if the hardware information of the first VF is not successfully obtained from the first virtual configuration space, obtain the hardware information of the first VF from a mailbox, and initialize the first VF according to the obtained hardware information of the first VF.

[0078] Optionally, the PCIE device is a GPU or a GPGPU.

[0079] Based on the same inventive concept, the present application provides a computer device, such as Figure 4 The computer device 400 shown includes at least one processor 401 and a memory 402 , in which programs or data are stored.

[0080] The memory 402 may be a volatile memory, such as a random access memory; the memory may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), or the memory 402 may be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 402 may be a combination of the above memories.

[0081] Optionally, the processor 401 may be one or more central processing units.

[0082] Optionally, the computer device may further include a PCIE device 403. The process executed by the PCIE device 403 may refer to the method process described in the aforementioned method embodiment, which will not be repeated here.

[0083] Optionally, although Figure 4 Not shown, the computer device 400 may also include at least one input / output interface, which may be used to connect a mouse, keyboard, etc. The input / output interface is an optional component and may or may not exist, and is not limited here.

[0084] Based on the same inventive concept, the present application provides a computer device, which includes a memory, a processor chip, and a computer program stored in the memory and executable on the processor chip. When the processor chip executes the computer program, the method steps in any of the above method embodiments are implemented.

[0085] Based on the same technical concept, an embodiment of the present application provides a computer-readable storage medium, including computer-executable instructions. When the computer-executable instructions are executed on a computer, the computer executes the method steps in any of the above method embodiments.

[0086] Based on the same technical concept, an embodiment of the present application provides a computer program product, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the method steps in any of the above method embodiments.

[0087] Those skilled in the art should understand that the embodiments of the present application can be provided as methods, devices (equipment), systems, chips, computer-readable storage media, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware, which are collectively referred to as "modules" or "systems" herein.

[0088] The present application is described with reference to at least one of the following diagrams of the method, apparatus (device) or system of the present application: a flowchart, a block diagram. It should be understood that at least one of the following can be implemented by computer program instructions: each process in the flowchart, each box in the block diagram, and a combination of a process in the flowchart and a box in the block diagram.

[0089] These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce instructions for implementing at least one of the following: Figure 1 Devices or blocks that specify functions in a process or multiple processes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0090] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, the instruction device implementing at least one of the following: Figure 1 A function or a block specified in a process or multiple processes Figure 1 A function specified in one or more boxes.

[0091] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing at least one of the following: steps for specifying a function in one or more processes in a flowchart, steps for specifying a function in one or more boxes in a block diagram.

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

Claims

1. A data processing method, It is characterized in that The method comprises: Creating a virtual machine, transparently transmitting a first VF in a PCIE device to the virtual machine, wherein the first VF has a first virtual configuration space; Acquire the hardware information of the first VF from the host driver through QEMU, and write the acquired hardware information of the first VF into the first virtual configuration space through QEMU; the host driver is located in the virtual machine monitor; the first virtual configuration space is a PCIE device configuration space, and the capacity of the first virtual configuration space is greater than the capacity of the mailbox in the PCIE device; When the virtual machine loads the client driver, the hardware information of the first VF is preferentially obtained from the first virtual configuration space.

2. The method according to claim 1, It is characterized in that Writing the acquired hardware information of the first VF into the first virtual configuration space includes: The acquired hardware information of the first VF is written into the first virtual configuration space according to a predefined header format.

3. The method according to claim 1 or 2, It is characterized in that The method further comprises: If the client driver successfully obtains the hardware information of the first VF from the first virtual configuration space, the first VF is initialized according to the hardware information of the first VF.

4. The method according to claim 3, It is characterized in that The client driver successfully obtains the hardware information of the first VF from the first virtual configuration space, including: The client driver searches for vendor capability information from the first virtual configuration space, and parses the vendor capability information according to a predefined header format to obtain hardware information of the first VF.

5. The method according to claim 1 or 2, It is characterized in that The method further comprises: If the client driver fails to successfully obtain the hardware information of the first VF from the first virtual configuration space, the hardware information of the first VF is obtained from a mailbox, and the first VF is initialized according to the obtained hardware information of the first VF.

6. The method according to claim 1 or 2, It is characterized in that The PCIE device is a GPU or a GPGPU.

7. A computer device, It is characterized in that The computer device includes a PCIE device and QEMU, a virtual machine monitor runs in the computer device, and the virtual machine monitor includes a host driver; The QEMU is used to create a virtual machine; transparently transmit the first VF in the PCIE device to the virtual machine, wherein the first VF has a first virtual configuration space; Acquire the hardware information of the first VF from the host driver, and write the acquired hardware information of the first VF into the first virtual configuration space; The first virtual configuration space is a PCIE device configuration space, and the capacity of the first virtual configuration space is greater than the capacity of the mailbox in the PCIE device; When the virtual machine loads the client driver, the client driver is used to: preferentially obtain the hardware information of the first VF from the first virtual configuration space.

8. A computer device comprising a memory, a processor chip, and a computer program stored in the memory and executable on the processor chip, It is characterized in that When the processor chip executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium, It is characterized in that The method comprises computer executable instructions, which, when executed on a computer, cause the computer to execute the steps of the method according to any one of claims 1 to 6.

10. A computer program product, It is characterized in that The computer program product stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a computer, the computer is caused to execute the steps of the method according to any one of claims 1 to 6.