Virtualization information processing method, device, and storage medium

By creating virtual device instances in the virtualization system and directly passing the real physical base address, zero-copy data processing is achieved, solving the hardware acceleration problem in existing virtualization technologies and improving the hardware access efficiency and data processing performance of the virtualization environment.

CN122431794APending Publication Date: 2026-07-21PHYTIUM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
PHYTIUM TECH CO LTD
Filing Date
2026-04-22
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing virtualization technologies are insufficient to meet hardware acceleration requirements, device passthrough lacks multiplexing capabilities, hardware-assisted virtualization is not applicable to all hardware devices, and software simulation-based solutions have high performance overhead and cannot meet the requirements of high-performance computing.

Method used

Virtual device instances are created by the host system, contiguous memory regions are allocated and configuration information is generated, and the real physical base address is directly passed. After the virtual machine is bound to the instance, zero-copy data processing is performed to avoid address translation and data copying, thereby enabling multiple virtual machines to share hardware resources.

Benefits of technology

It improves hardware access efficiency and data processing performance in virtualized environments, reduces data transmission loss, and enhances the stability and reliability of hardware resource allocation and data access.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122431794A_ABST
    Figure CN122431794A_ABST
Patent Text Reader

Abstract

The application provides a virtual information processing method, device and storage medium. The method comprises the following steps: a host system creates a virtual device instance, allocs hardware resources and a continuous memory area for the virtual device instance, generates and stores first configuration information corresponding to a physical hardware control register area and second configuration information indicating the memory area, and transmits a real physical base address of the memory area to the virtual device instance; after a virtual machine binds the virtual device instance, the virtual machine completes zero-copy data processing according to the real physical base address, the first configuration information and the second configuration information. Through virtual device instantiation, independent memory allocation and direct transmission of a physical base address, the virtual machine can directly initiate a hardware DMA operation, the data copying overhead is saved, a single physical hardware can be safely shared by multiple virtual machines, and the I / O performance of a virtualization environment and the hardware utilization rate are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to a virtualized information processing method, device, and storage medium. Background Technology

[0002] With the rapid development of cloud computing and virtualization technologies, more and more data centers and enterprise applications rely on virtual machines to achieve flexible scheduling and efficient utilization of resources. How to securely and efficiently share dedicated hardware accelerators on the host machine with multiple virtual machines has become a key issue in improving overall system performance.

[0003] Currently, mainstream hardware virtualization technologies mainly include device passthrough, hardware-assisted virtualization, and software virtualization based on software emulation. Device passthrough allocates physical devices exclusively to a single virtual machine through a Virtual Function I / O (VFIO) framework. Hardware-assisted virtualization allows physical devices to generate multiple virtual functions for multiple virtual machines to use concurrently. Software virtualization based on software emulation achieves hardware acceleration for virtual machines by forwarding data in user space through front-end / back-end drivers.

[0004] However, device passthrough lacks multiplexing capabilities, hardware-assisted virtualization cannot be applied to all hardware devices and has a limited scope of application, and software virtualization solutions based on software simulation require high performance overhead and latency, making it difficult to meet the needs of high-performance hardware acceleration. Summary of the Invention

[0005] The purpose of this application is to address the shortcomings of the prior art by providing a virtualized information processing method, device, and storage medium to solve the problem that hardware virtualization technology in the prior art cannot meet the hardware acceleration requirements.

[0006] To achieve the above objectives, the technical solution adopted in this application is as follows: In a first aspect, this application provides a virtualized information processing method, the method comprising: The host system creates virtual device instances and allocates at least one hardware resource and a contiguous memory region to each virtual device instance. It also generates and stores first configuration information and second configuration information for the virtual device instances based on the hardware resources. The first configuration information is used to indicate the control register region of the physical hardware, and the second configuration information is used to indicate the memory region. The host system transmits the actual physical base address of the memory region corresponding to the virtual device instance to the virtual device instance; The virtual machine is bound to the virtual device instance, and zero-copy data processing is performed based on the real physical base address of the virtual device instance, the first configuration information, and the second configuration information.

[0007] In a second aspect, this application provides an electronic device, which includes physical hardware and is equipped with a virtualization system. The virtualization system includes a host system and at least one virtual machine. The host system includes a host kernel and a host user-mode program, and each virtual machine includes at least a virtual machine kernel and a virtual machine user-mode program. The host system is used to execute the method steps performed by the host system in the virtualization information processing method as described in the first aspect; The virtual machine is used to execute the method steps performed by the virtual machine in the virtualized information processing method as described in the first aspect.

[0008] Thirdly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of a virtualized information processing method as described in any one of the first aspects.

[0009] The beneficial effects of this application are as follows: By creating virtual device instances, allocating hardware and contiguous memory, and generating configuration information through the host machine, the actual physical base address of the memory is transmitted. After the virtual machine binds to the instance, zero-copy data processing is achieved based on the actual physical base address, the first configuration information, and the second configuration information. It does not rely on hardware-specific virtualization capabilities, but determines the hardware access path through contiguous memory and configuration information, thereby directly transmitting the physical base address and eliminating address transfer overhead. This not only enables multiple virtual machines to share physical hardware, but also significantly reduces data transmission loss, improves hardware access efficiency and data processing performance in the virtualization environment, and further enhances the stability and reliability of hardware resource allocation and data access.

[0010] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0011] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0012] Figure 1 This paper illustrates a schematic diagram of the architecture of a virtualization system provided in an embodiment of this application. Figure 2 A flowchart of a virtualized information processing method provided in an embodiment of this application is shown; Figure 3 This document illustrates a flowchart of a method for creating a virtual device instance, as provided in an embodiment of this application. Figure 4 This document illustrates a flowchart of generating first configuration information and second configuration information according to an embodiment of this application. Figure 5 This document illustrates a flowchart of a hardware resource allocation method provided in an embodiment of this application. Figure 6 This paper shows a schematic diagram of a PCIe configuration provided in an embodiment of this application; Figure 7 This document illustrates a flowchart of an embodiment of obtaining a real physical base address. Figure 8 This document illustrates a flowchart of a standardized interface parsing method provided in an embodiment of this application. Figure 9 This document illustrates a flowchart of a zero-copy data processing method provided in an embodiment of this application. Figure 10 A flowchart illustrating a method for determining address offset information according to an embodiment of this application is shown; Figure 11 A flowchart illustrating another method for zero-copy data processing provided in an embodiment of this application is shown. Detailed Implementation

[0013] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0014] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.

[0015] In existing virtualization technologies, the host machine typically creates virtual device instances for virtual machines and provides hardware services through software emulation or paravirtualization. When the virtual machine needs to interact with data, the host machine is responsible for allocating memory resources, but the virtual machine usually obtains a translated guest physical address. During data processing, data often needs to be copied multiple times between the virtual machine's user mode, kernel mode, and the host machine's memory space. Each time hardware registers or memory are accessed, address translation and interception processing are required, with the host machine acting as an agent to complete the actual physical operations.

[0016] Existing virtual machine hardware acceleration processes include: S1. The application in the virtual machine prepares data; S2. Data is sent to the backend simulation logic in the host machine through the frontend driver; S3. The host machine copies the data to the kernel buffer; S4. The host machine drives the submission of data to the physical hardware for processing; S5. After processing, the results are copied back to the virtual machine.

[0017] As the above process shows, two data copies are required, and the data must be relayed through the host machine, lacking an end-to-end zero-copy data path. This results in a long and inefficient data transmission path. Because the virtual machine cannot directly know or use the actual host machine physical address, I / O operations must go through multiple layers of address translation and data buffering, generating significant Central Processing Unit (CPU) overhead and wasted memory bandwidth. This frequent context switching and data copying not only significantly increases system latency but also limits hardware performance, making it difficult to meet the stringent requirements of low latency and high throughput in high-performance computing and real-time data processing scenarios. It becomes a bottleneck restricting the performance improvement of virtualization environments.

[0018] Based on the above problems, this application proposes a virtualization information processing method, which creates a virtual device instance through the host system and directly allocates a contiguous memory region and hardware resources, generates first configuration information indicating the physical control register region and second configuration information indicating the memory region, and then directly passes the real physical base address of the memory region to the virtual device instance, thereby overcoming the defects of multi-layer translation and data copying caused by address isolation in the prior art.

[0019] Specifically, this application addresses the problem in traditional virtualization where virtual machines can only obtain translated guest physical addresses and must rely on host backend emulation logic for data transfer. It enables the virtual machine, after binding to a virtual device instance, to directly fill the target physical address into the control register area based on the obtained real physical base address, first configuration information, and second configuration information to drive hardware data processing. This method eliminates redundant paths of repeated data copying between the virtual machine's user mode, kernel mode, and host kernel buffer, avoiding the overhead of address translation interception and context switching for each I / O operation. It achieves direct, zero-copy data interaction between the virtual machine and physical hardware, significantly reducing CPU load and memory bandwidth consumption, and effectively solving the problems of high latency and low throughput in high-performance scenarios of existing technologies.

[0020] Figure 1 This is a schematic diagram of the architecture of a virtualization system provided in an embodiment of this application. For example... Figure 1 As shown, the electronic device includes physical hardware and a virtualization system. The virtualization system includes: a host system and at least one virtual machine (VM). Figure 1 (This is illustrated using a virtual machine). The host system includes: the host user space and the host kernel. The virtual machine includes: the guest user space and the guest kernel. The host kernel layer includes hardware drivers, which contain hardware interaction modules, DMA memory management modules, and virtual device interface modules. Physical hardware includes acceleration hardware, memory, CPU, etc., and resides in the hardware layer.

[0021] The virtual device interface module is used to register driver capabilities with the virtualization environment, create device instance templates, receive instance creation requests, and complete the creation of virtual device instances by calling the device instance templates based on the system management interface. It is also used for the full lifecycle management of virtual device instances, the generation and storage of virtual device information, and the construction and configuration of the Peripheral Component Interconnect (PCI) device configuration space.

[0022] The Direct Memory Access (DMA) memory management module is used to allocate contiguous physical memory regions for each virtual device instance, determine the real physical base address of the memory region, generate and store second configuration information based on the real physical address of the memory region, and fill the real physical base address into the preset extended field of the virtual device instance to complete the base address pass-through.

[0023] The hardware interaction module is used to interact with the acceleration hardware and other hardware in the hardware layer, allocate matching hardware resources to virtual device instances, generate and store first configuration information based on the real physical address of the control register area corresponding to the hardware resources, and provide a pass-through access channel for the hardware control registers of the virtual machine.

[0024] The host user space is the user space management entry point for the host system, including application and hardware user space drivers. It can issue management commands such as virtual device instance creation, resource allocation, and configuration update to the host kernel's hardware drivers through system calls, and complete the user space configuration and full-process control of virtual device instances.

[0025] The virtual machine kernel layer includes virtual machine hardware drivers, which contain a DMA memory application module and a virtual device application module. The virtual device application module is used to identify virtual device instances after the virtual machine starts, load the hardware driver matching the virtual device instance, parse the virtual device instance's real physical base address, first configuration information, and second configuration information, and map the first and second configuration information to the virtual machine's virtual address space. The DMA memory application module is used to request memory based on the second configuration information and determine the target virtual address, determine the address offset information based on the target virtual address and the second configuration information, and determine the target physical address based on the address offset information and the real physical base address.

[0026] The virtual machine user space includes applications and hardware user space drivers. Applications call the capabilities of the Guest kernel hardware drivers through the hardware user space drivers. Based on the target physical address and the first configuration information, end-to-end zero-copy data processing is completed by reading and writing hardware control registers.

[0027] Figure 2 This is a flowchart illustrating a virtualized information processing method provided in an embodiment of this application. This method can be applied to deployments with... Figure 1 The electronic devices of the virtualization system shown below will be combined with... Figure 2 The virtualized information processing method of this application will be described.

[0028] S201. The host system creates virtual device instances and allocates at least one hardware resource and a contiguous memory region to each virtual device instance. It also generates and stores first configuration information and second configuration information of the virtual device instances based on the hardware resources. The first configuration information is used to indicate the control register region of the physical hardware, and the second configuration information is used to indicate the memory region.

[0029] In this context, the host system refers to the physical computer operating system or hypervisor layer that hosts the virtualization environment. A virtual device instance is a logical device object built at the software level, used to simulate or map the functionality of a physical device, serving as middleware for interaction between the virtual machine and physical hardware. The control register region is a specific set of register address spaces on the physical hardware used to receive control commands, status queries, and configuration parameters.

[0030] The first configuration information and the second configuration information are metadata structures generated by the host machine. The first configuration information is used to record the physical location of the control registers, and the second configuration information is used to record the physical location of contiguous memory regions.

[0031] When hardware resources need to be allocated to a virtual machine, a device structure can be initialized and a unique identifier assigned to it to establish the context of the virtual device, which can then be used as the virtual device instance corresponding to the virtual machine.

[0032] In one possible implementation, a static pre-allocation method can be used, where the resource pool is pre-allocated when the host operating system starts. When a virtual device instance is created, a segment of memory is allocated from physical memory as a contiguous memory region, and a data structure is written. The starting physical address and length of this contiguous memory segment are filled into the data structure as the second configuration information, and the starting physical address and length of the device register are filled into the data structure as the first configuration information. This structure is then stored in the kernel object of the virtual device instance.

[0033] In another possible implementation, dynamic allocation can be used. In response to the virtual machine creation request, the memory manager is called in real time to request contiguous page frames and generate a data structure in real time. The starting physical address and length of this contiguous memory are filled into the data structure as the second configuration information, and the starting physical address and length of the device register are filled into the data structure as the first configuration information. This structure is then stored in the kernel object of the virtual device instance.

[0034] S202. The host system passes the real physical base address of the memory region corresponding to the virtual device instance to the virtual device instance.

[0035] The actual physical base address is the address value of the contiguous memory region on the physical memory module, which is the starting address without any virtualization layer address translation.

[0036] It is worth noting that in existing implementations, the virtual machine can only see the translated physical address of the guest machine. However, this application enables the virtual machine to bypass the address translation layer and directly locate physical memory by directly informing the virtual device instance of the real physical base address.

[0037] In one possible implementation, the configuration space can be extended by defining a private extended field in the virtual PCIe configuration space. The host machine writes the real physical base address into this field, and the virtual machine driver reads this field to obtain the address.

[0038] In the second implementation method, the transfer of the real physical base address can also be achieved through shared memory. That is, the host machine and the virtual device instance agree on a fixed shared memory page, the host machine writes the address into it, and triggers an interrupt to notify the virtual machine.

[0039] S203. The virtual machine binds to the virtual device instance and performs zero-copy data processing based on the real physical base address of the virtual device instance, the first configuration information, and the second configuration information.

[0040] Binding a virtual machine to a virtual device instance refers to establishing a connection between the virtual machine and the virtual device instance, recognizing and utilizing the virtual hardware. After the virtual machine connects to the virtual device, it can locate the hardware registers and DMA memory based on the real physical base address, the first configuration information, and the second configuration information, and directly initiate hardware DMA operations to achieve copy-free data processing.

[0041] In one possible implementation, after the virtual machine starts, virtual device instances can be enumerated and identified, matching drivers can be loaded, and control register regions can be mapped based on the first configuration information, DMA memory regions can be mapped based on the second configuration information, and hardware-recognizable DMA addresses can be generated based on the real physical base address to trigger hardware to perform data processing.

[0042] This application's embodiments create virtual device instances on the host machine, allocate hardware and contiguous memory, and generate configuration information, transmitting the actual physical base address of the memory. After the virtual machine binds to the instance, it achieves zero-copy data processing based on the actual physical base address, the first configuration information, and the second configuration information. It does not rely on hardware-specific virtualization capabilities, but determines the hardware access path through contiguous memory and configuration information, directly transmitting the physical base address to eliminate address transfer overhead. This enables multiple virtual machines to share physical hardware, significantly reduces data transmission losses, improves hardware access efficiency and data processing performance in the virtualized environment, and further enhances the stability and reliability of hardware resource allocation and data access.

[0043] The following is a further explanation of how the host system creates virtual device instances, such as... Figure 3 As shown, the above step S201 includes: S301, The host system registers driver capabilities with the virtualization environment.

[0044] By registering the driver capabilities with the virtualization environment, the virtualization management component can recognize, adapt to, and invoke the virtualization functions of the hardware driver, thereby ensuring the compatibility between the hardware driver and the virtualization framework.

[0045] In one possible implementation, a hardware driver module can be loaded when the host machine starts up. The driver registers its core functional interfaces with the virtualization framework through the kernel standard interface API, declaring the virtual device service capabilities it can provide, including virtual device creation, resource allocation, configuration management, instance destruction, and other capabilities. After registration is completed, the virtualization environment can recognize and call the virtualization functions of the driver.

[0046] S302. The host system creates a target device instance and generates at least one device instance template based on the target device instance.

[0047] A target device instance is a baseline virtual device entity created by the host machine based on the full capabilities of its physical hardware. A device instance template is a standardized virtual device configuration template generated based on the target device instance, which explicitly defines parameters such as the hardware capability specifications, resource quotas, and interface standards of the virtual device.

[0048] By creating a baseline target device instance and extracting its standardized hardware capabilities and configuration parameters, a reusable device instance template can be generated, enabling the standardized and batch creation of virtual device instances and avoiding redundancy caused by repeated configuration of a single instance.

[0049] In one possible implementation, the host driver can create a target device instance with full hardware capabilities based on the full functionality of the physical hardware, and extract core information such as the target device instance's device type, hardware resource quota, interface specifications, and capability parameters to generate one or more device instance templates with differentiated specifications. The templates are then stored in the host system for subsequent instance creation.

[0050] When registering a host machine driver, one or more virtual device type templates can be published, defining the specifications and capabilities of virtual devices that can be created. Among them, virtual device instances can be configured with various capability specifications that correspond one-to-one with hardware resources, such as the vHW-1 specification corresponding to 1 hardware queue and the vHW-8 specification corresponding to 8 hardware queues, all of which are generated based on standardized templates.

[0051] S303. Obtain the instance creation request, and based on the instance creation request, create a virtual device instance by calling the device instance template through the system management interface.

[0052] An instance creation request is an instruction initiated by an administrator or virtualization management tool to create a virtual device instance, containing parameters such as the specifications and capabilities of the required virtual device. The system management interface is a standardized operation interface provided by the host system for managing the entire lifecycle of virtual devices, used for operations such as creating, configuring, and destroying virtual devices.

[0053] By uniformly receiving instance creation requests through a standardized system management interface and matching the corresponding device instance template based on the request parameters, virtual device instances that meet the requirements can be created quickly and in a standardized manner.

[0054] In one possible implementation, the host machine can receive instance creation requests through the system management interface, parse the device specifications and capability parameters specified in the request, match the corresponding device instance template, and complete the creation of the virtual device instance, pre-allocation of hardware resources and basic configuration based on the template, and finally generate a virtual device instance that meets the requirements of the instance creation request.

[0055] For example, the creation of virtual device instances can be triggered by the virtual machine management tool Libvirt or by directly manipulating the Sysfs system interface. The driver registration process can generate a standardized system management interface, through which external management tools can trigger the creation, configuration, and destruction of virtual device instances throughout their entire lifecycle.

[0056] In this embodiment, the virtual device creation process is standardized, regulated, and reusable by registering driver capabilities with the virtualization environment from the host machine, generating standardized device instance templates, and creating virtual device instances based on the system management interface and templates. Furthermore, this application enables the virtualization environment to stably identify the virtualization capabilities of the hardware, reduces configuration redundancy through template-based creation, and provides standardized interfaces to adapt to various virtualization tools, thereby improving the efficiency of virtual device creation.

[0057] Optionally, a virtual device instance includes: virtual device information. Virtual device information includes attributes such as the virtual device instance's specifications, capability requirements, and device type.

[0058] The above process involves allocating at least one hardware resource and memory region to each virtual device instance, and generating and storing the first and second configuration information of the virtual device instance based on the hardware resources. Figure 4 As shown, it includes: S401. The host system allocates at least one hardware resource to each virtual device instance based on the virtual device information of each virtual device instance.

[0059] Hardware resources refer to the smallest execution unit on physical hardware that can be independently allocated and operated, such as hardware queues, independent register sets, and hardware computing units.

[0060] By matching and allocating hardware resources of the corresponding specifications to the virtual device instance based on its own attribute information, it can ensure that the hardware resources obtained by each virtual device instance match its capability requirements. At the same time, it can realize fine-grained splitting and isolated allocation of physical hardware resources, avoiding resource conflicts among multiple instances.

[0061] Optionally, the host system can read the virtual device information of the virtual device instance, parse the required hardware capability specifications, resource quotas and other parameters, and allocate a corresponding number of independent hardware resources with corresponding capabilities from the global resource pool of physical hardware to the virtual device instance, thereby completing the binding of hardware resources with the virtual device instance.

[0062] In another possible implementation, hardware resources can be allocated based on fixed specifications of the device type or based on priority weights, etc. The specific allocation method is not limited here.

[0063] S402. The host system allocates memory regions to each virtual device instance based on the hardware resources of each virtual device instance.

[0064] A memory region is a physical memory space allocated by the host machine for virtual device instances, dedicated to hardware DMA data transfer. By allocating a memory region of a corresponding size based on the allocated hardware resources, it ensures that the memory capacity matches the processing power of the hardware resources, avoiding hardware performance waste due to insufficient memory resources or resource waste due to memory redundancy. Furthermore, allocating a dedicated memory region for each virtual device instance achieves memory space isolation.

[0065] Optionally, the host system can calculate the required memory capacity based on the amount of hardware resources allocated to the virtual device instance and the hardware processing power, and call the kernel memory allocation interface to allocate a corresponding size of page-aligned contiguous physical memory as a dedicated memory region for the virtual device instance, and complete the binding of the memory region with the virtual device instance and the corresponding hardware resources.

[0066] As another possible implementation, the memory area of ​​the virtual device instance can be allocated according to the linear ratio of the number of hardware queues, or the memory area of ​​the virtual device instance can be allocated according to the dynamic capacity of the hardware processing bandwidth. The specific allocation method is not limited here.

[0067] S403. The host system generates and stores the first configuration information of each virtual device instance based on the hardware resources of each virtual device instance, and generates and stores the second configuration information of each virtual device instance based on the memory area of ​​each virtual device instance.

[0068] Based on the allocated hardware resources and memory regions, corresponding standardized configuration information can be generated and persistently stored, providing virtual machines with a unified and identifiable hardware and memory access interface. This ensures that virtual machines can determine the hardware control channel and data transfer memory through the first and second configuration information, thereby achieving transparent hardware access.

[0069] Optionally, the host system can extract parameters such as the address and range of the control register region corresponding to the allocated hardware resources to generate first configuration information, and extract parameters such as the address, range, and access attributes of the allocated memory region to generate second configuration information. The host system then binds and stores these two types of configuration information with the corresponding virtual device instances for subsequent reading and use by the virtual machine.

[0070] In one possible implementation, the first and second configuration information can be persistently stored as files in a user-accessible file system directory based on the configuration information in the system files. After the host machine restarts, the driver can restore the complete configuration of the virtual device instance by reading the configuration files in the directory, thus eliminating the need to reallocate hardware resources and memory areas.

[0071] This application embodiment achieves the matching of hardware, memory resources and virtual devices, and can avoid resource waste and allocation conflicts. Through standardized configuration information, it can provide a unified and identifiable access basis for virtual machines, and ensure the stability of multi-instance resource isolation.

[0072] Optionally, the virtual device information includes: UUID identifier and virtual device type.

[0073] A Universally Unique Identifier (UUID) is a globally unique 128-bit identifier assigned to each virtual device instance. It distinguishes different virtual device instances and represents the node attribute information required for hardware resource allocation. The virtual device type is a classification identifier used to define the hardware capability specifications and functional attributes of a virtual device instance, representing the hardware service capabilities and resource configuration standards that the virtual device can provide.

[0074] Optionally, when creating a virtual device instance, the host system can generate a globally unique UUID identifier for each virtual device instance, and at the same time apply for matching the corresponding virtual device type according to the instance's hardware capabilities; bind and store the UUID identifier and virtual device type as the virtual device information of the instance, for subsequent resource allocation processes to read and call.

[0075] The process described above, in which the host system allocates at least one hardware resource to each virtual device instance based on the virtual device information of each virtual device instance, is as follows: Figure 5 As shown, it includes: S501, The host system parses the UUID identifier to obtain the NUMA node identifier.

[0076] Non-uniform Memory Access (NUMA) is a multiprocessor computer memory architecture where the system is divided into multiple NUMA nodes, each with its own dedicated processor and hardware resources. Hardware access latency within the same node is significantly lower than cross-node access latency. A NUMA node identifier is a unique number used to identify each NUMA node in the system.

[0077] By parsing the NUMA node information pre-embedded in the UUID identifier, the optimal NUMA node to which the virtual device instance belongs can be located, providing a basis for subsequent allocation of hardware resources on the same node, avoiding hardware access across NUMA nodes, reducing access latency, and improving hardware processing performance.

[0078] In one possible implementation, the host system can read the UUID identifier of the virtual device instance and extract node information according to predefined parsing rules. For example, it can parse the last character of the UUID, map '0'-'9' to NUMA nodes 0-9, and 'a'-'f' to NUMA nodes 10-15, and finally obtain the NUMA node identifier corresponding to the instance.

[0079] As another possible implementation, the NUMA node number can be stored directly in a specified field of the UUID, or the optimal NUMA node identifier can be automatically matched by combining the NUMA topology configuration of the virtual machine.

[0080] In one possible implementation, extended attributes such as device priority and security level can be embedded in the UUID identifier. The virtual device type can also support user-defined specifications to adapt to different business scenarios.

[0081] S502. The host system determines the amount of hardware resources required for a virtual device instance based on the virtual device type.

[0082] The number of hardware resources refers to the number of independent hardware execution units required by a virtual device instance.

[0083] The host system can pre-establish a mapping table between virtual device types and the number of hardware resources. For example, vHW-1 type corresponds to 1 hardware queue, and vHW-8 type corresponds to 8 hardware queues. After reading the type of the virtual device instance, the number of hardware resources required by the instance can be determined by querying the mapping table.

[0084] S503: The host system allocates a number of hardware resources corresponding to the number of hardware resources from the hardware resource pool corresponding to the NUMA node to the virtual device instance based on the NUMA node identifier and the number of hardware resources.

[0085] The hardware resource pool is a collection of independent hardware execution units pre-divided by the host system and managed according to NUMA nodes. Each NUMA node corresponds to a dedicated hardware resource pool, and the hardware resources in the pool belong to that node and can be allocated to virtual device instances as needed.

[0086] Based on the NUMA node identifier, a dedicated hardware resource pool is located. According to the determined number of hardware resources, a corresponding number of idle hardware resources are allocated from the resource pool. This achieves NUMA node affinity in hardware resource allocation, ensuring low latency for hardware access and isolating hardware resources for allocation, thus avoiding resource conflicts between multiple instances.

[0087] The host system can locate the hardware resource pool corresponding to the NUMA node based on the NUMA node identifier, check whether the available hardware resources in the pool meet the requirements; if they do, it takes out the corresponding number of idle hardware execution units from the pool and allocates them to the virtual device instance, thus completing the binding of hardware resources with the instance, and at the same time updates the availability status of the resource pool.

[0088] When the target node resources are insufficient, resources from neighboring NUMA nodes can be allocated according to preset rules, and hardware resources can be allocated based on the priority of virtual device instances to achieve resource preemption allocation for high-priority instances.

[0089] In this embodiment, the process of resolving NUMA nodes by UUID, determining the number of resources by virtual device type, and allocating hardware to the resource pool of the same node achieves precise allocation of NUMA-friendly hardware resources.

[0090] like Figure 6 The diagram shown is a data structure diagram of a Peripheral Component Interconnect Express (PCIe) configuration space provided in an embodiment of this application. The BAR0 space is used to indicate first configuration information, the BAR1 space is used to store second configuration information, the CAPABILITIES field is a preset extended field used to store the real physical address, DeviceID and VerdorID form the virtual device identifier, the Status field is used to record the running status information of the virtual device instance, and the Command field is used to receive control commands for the virtual device instance.

[0091] After the virtual machine completes the address mapping of the BAR0 space, it can directly access and manipulate the registers in the physical hardware queue. After the virtual machine completes the address mapping of the BAR1 space, it can operate on this contiguous memory region through the guest virtual address.

[0092] The following is a further explanation of how the host system generates and stores the first configuration information for each virtual device instance based on the hardware resources of each virtual device instance, including: The host system generates the first configuration information of the virtual device instance based on the actual physical address of the control register area corresponding to the hardware resources of the virtual device instance.

[0093] By generating the first configuration information based on the actual physical address of the control register corresponding to the hardware resources allocated to the virtual device instance, it is ensured that after the virtual machine obtains the configuration information, it can directly map to the control register area of ​​the physical hardware, thereby achieving direct control of the hardware without the need for the host machine to relay, thus eliminating the performance overhead of the control path.

[0094] In the first implementation, when creating a virtual device instance, the host driver can construct a complete PCIe configuration space for that instance. It encapsulates the control register information corresponding to the hardware resources allocated to the instance into first configuration information and writes it to the BAR0 register area of ​​the PCIe configuration space. Simultaneously, it stores this configuration information in the kernel management structure of the virtual device instance for enumeration and reading during virtual machine startup. During physical hardware initialization, the host driver can calculate the actual physical starting address and address range of the control register area for each smallest hardware unit and record it in the hardware resource management structure. After allocating hardware resources to the virtual device instance, it directly extracts the actual physical base address and address space size of the control register area corresponding to that hardware resource, encapsulates it into first configuration information, and writes it to the BAR0 register area of ​​the PCIe configuration space. Figure 6 The virtual device shown has a PCIeBAR0 configuration space, which also completes the permission isolation configuration of the address space.

[0095] In the second implementation, the host system can pre-establish a global physical address mapping table for all control register regions of the physical hardware and assign a unique address index to each allocatable hardware resource. When generating the first configuration information, the corresponding real physical address range is extracted from the mapping table based on the index corresponding to the hardware resource of the virtual device instance. The address base address, offset, and space size are encapsulated into the first configuration information and stored in the management structure of the virtual device instance.

[0096] In this embodiment, by generating and storing first configuration information based on the actual physical address of the control register region corresponding to the hardware resources of the virtual device instance, a precise and direct hardware control channel access basis is provided for the virtual machine. This allows the virtual machine to directly map the control registers of the physical hardware without the need for control instructions to be relayed by the host machine, thereby reducing the control overhead of the virtualization path. Simultaneously, it also achieves a one-to-one binding between the virtual device instance and the hardware control resources, ensuring control isolation and resource security when multiple virtual machines share hardware.

[0097] The process of generating and storing the second configuration information of each virtual device instance based on the memory region of each virtual device instance includes: The host system generates the second configuration information of the virtual device instance based on the actual physical address of the memory region of the virtual device instance.

[0098] In the first implementation, the host system can allocate a contiguous physical memory region for the virtual device instance through the kernel memory management subsystem, and then directly extract parameters such as the starting real physical address and address space length corresponding to the memory region from the memory management structure. These parameters are then encapsulated into standardized second configuration information and written into the PCIe configuration space and kernel management structure corresponding to the virtual device instance, thus completing the generation and storage of configuration information.

[0099] In the second implementation, the host system can allocate physically contiguous memory regions for virtual device instances using large page memory and contiguous memory allocators. After allocation, the allocator directly returns the actual physical address range of the memory region. The host system encapsulates the base address, offset, page size, and other parameters of this address range into second configuration information and stores it in the descriptor table of the virtual device instance.

[0100] This application embodiment uses the real physical address of the memory region corresponding to the virtual device instance as a parameter to generate second configuration information, ensuring that after the accessing subject obtains the configuration information, it can directly locate the corresponding physical memory space without the host machine performing address translation and data transfer, thereby avoiding the performance overhead caused by memory address translation.

[0101] The following is a further explanation of how the host system passes the actual physical base address of the memory region corresponding to the virtual device instance to the virtual device instance, such as... Figure 7 As shown, the above step S202 includes: S701. The host system determines the actual physical starting address of the memory region within the host system and uses the actual physical starting address as the actual physical base address.

[0102] The host system can allocate a contiguous memory region for a virtual device instance. The actual physical starting address refers to the address value of the first address unit in the physical address space. For example, if the physical address range of the allocated contiguous memory region is 0x10000000-0x100FFFFF, then 0x10000000 is the actual physical starting address of that memory region.

[0103] In the first implementation, the host system can complete the allocation of a contiguous memory region through the kernel memory management subsystem, and then directly extract the starting physical address field of the memory region from the memory management control block, determine the value as the real physical starting address, and assign it as the real physical base address corresponding to the memory region.

[0104] In the second implementation, in the scenario of allocating memory through virtual addresses, after the host system obtains the kernel virtual address corresponding to the memory region, it can complete the conversion from virtual address to physical address by traversing the kernel page table of the host system, obtain the real physical address corresponding to the first page of the memory region, determine it as the real physical starting address, and use it as the real physical base address.

[0105] By using the actual physical starting address of a contiguous memory region as the actual physical base address, the uniqueness, determinism, and indivisibility of the base address can be ensured, providing a unified reference for addressing the entire memory region, thereby avoiding address offset calculation errors and ensuring the accuracy of memory addressing.

[0106] S702, The host system fills the real physical base address into the preset extended field corresponding to the virtual device instance, so that the virtual device instance can obtain the real physical base address from the preset extended field when the hardware driver is loaded.

[0107] Preset extended fields are standardized fields pre-configured by the host system when creating a virtual device instance. They are specifically used to store core address parameters. Preset extended fields have fixed offset positions, data lengths, and read / write permissions, and are used to store extended configuration parameters related to the virtual device instance. For example, vendor-defined extended capability fields in the PCIe configuration space of a virtual PCIe device can be used as preset extended fields.

[0108] By filling the real physical base address into the preset extended field corresponding to the virtual device instance, the hardware driver of the virtual device instance can directly and consistently read the real physical base address from this field during the loading process, thereby achieving standardized and automated transmission of address information and ensuring the stability, real-time performance, and compatibility of address transmission.

[0109] In the first implementation, when the host system creates a virtual device instance, it can pre-configure a dedicated extended capability field in the PCIe configuration space of the virtual device as a preset extended field. After the real physical base address is determined, the real physical base address is filled into the fixed offset position of the extended field according to the PCIe configuration specification, and read-only permission is set. When the hardware driver of the virtual device instance is loaded, it reads the real physical base address in the extended field through the standard PCIe configuration space enumeration process to complete the address acquisition.

[0110] In the second implementation, when the host system creates a virtual device instance, it can pre-configure an extended field in the device descriptor table as a preset extended field, and fill the real physical base address into the field according to the format requirements of the descriptor table, thus binding the descriptor table to the lifecycle of the virtual device instance; when the hardware driver is loaded, it reads the device descriptor table and parses the real physical base address from the preset extended field to obtain the real physical base address.

[0111] In this embodiment, the uniqueness and accuracy of memory addressing reference are improved by using the real physical starting address of the memory region as the base address. By filling the real physical base address into the preset extended field of the virtual device instance, the standardization and automated transmission of the base address are realized, allowing the hardware driver to directly read and obtain the base address when loading, simplifying the address acquisition process, and improving the efficiency and stability of memory addressing.

[0112] After the virtual machine starts, virtual device instances can be identified. This identification process establishes an initial association between the virtual machine and the target virtual device instance, providing accurate object location for subsequent driver loading and device interaction, and preventing the virtual machine from mistakenly binding to unrelated devices. For example... Figure 8 As shown, the process of binding a virtual machine to a virtual device instance includes: S801. After the virtual machine starts, it identifies the virtual device instance.

[0113] Optionally, after the virtual machine starts, it can traverse the built-in virtualization bus and match the target virtual device instance through preset fields such as device ID and instance unique identifier to complete the identification of the virtual device instance.

[0114] In the second implementation, the virtual machine can also read the preset virtual device configuration list when it starts up, and locate and identify the target virtual device instance through the instance identifier in the list.

[0115] S802. The virtual machine loads a hardware driver that matches the virtual device instance to trigger the execution of the hardware driver. When the hardware driver is executed, it parses the standardized interface based on the real physical base address of the virtual device instance, the first configuration information, and the second configuration information, and maps the first configuration information and the second configuration information to the virtual address space.

[0116] Hardware drivers are software modules used to control and interact with virtual device instances. Standardized interfaces are unified data channels for data and instruction exchange between virtual machines and virtual device instances. Virtual address space refers to the independent address range allocated by the virtual machine for its own processes and drivers.

[0117] By loading a matching hardware driver, the virtual machine can acquire the software capability to interact with the target virtual device instance, and after execution, the driver can handle device configuration, data transmission, and other requests.

[0118] In one possible implementation, after the virtual machine starts, it can scan the built-in driver library, load the corresponding matching driver file based on the identified virtual device instance attributes, and trigger the execution of the hardware driver after loading. During driver execution, the real physical base address is used as the interface base address, the first configuration information is used as the interface control parameter, and the second configuration information is used as the interface address range parameter. These are concatenated to form the parsing rules for the standardized interface, thus completing the parsing of the standardized interface. Finally, through the virtual machine's memory management unit, the physical address ranges of the first and second configuration information are mapped to contiguous virtual address segments within the virtual address space.

[0119] In another possible implementation, the driver can also have a built-in standardized interface parsing template. The three types of parameters are substituted into the corresponding fields of the template to automatically generate the interface's address mapping and control logic. The driver maps the first configuration information and the second configuration information to two independent segments in the virtual address space, and sets the access permissions for these segments, thus completing the mapping between the first and second configuration information.

[0120] In this embodiment, the driver uses a standardized interface for parsing the real physical base address, first configuration information, and second configuration information to ensure the interoperability of different virtual devices. By mapping the first and second configuration information to the virtual address space, the physical address and virtual machine address domain are isolated, the virtual machine's access process to device configuration is simplified, and the reliability and interaction efficiency of virtual device binding are improved.

[0121] The following is a further explanation of the zero-copy data processing performed on the aforementioned virtual machine based on the real physical base address of the virtual device instance, the first configuration information, and the second configuration information. Figure 9 As shown, the above process includes: S901. The virtual machine requests memory based on the second configuration information and determines the target virtual address based on the requested memory.

[0122] The target virtual address is the guest virtual address that the virtual machine operating system allocates to user-mode programs when it obtains a memory block. It serves as the address entry point for programs within the virtual machine to operate on memory.

[0123] Optionally, the hardware driver within the virtual machine can initialize and manage the DMA memory pool based on the second configuration information. This memory pool corresponds one-to-one with the contiguous physical memory regions allocated by the host machine, and their sizes are also matched accordingly. When a user-mode program within the virtual machine has a DMA data processing requirement, it initiates a memory request to the driver, which allocates a memory block of the corresponding size from the aforementioned DMA memory pool. Finally, the driver maps the allocated memory block to the virtual machine's user-mode address space, generates and returns the target virtual address corresponding to the memory block, allowing the user-mode program to read and write the data to be processed and the result data.

[0124] As another possible implementation, the contiguous memory pool can be divided into several memory pages, with allocation based on the required number of pages during request, while also supporting dynamic expansion and reclamation of the memory pool. Alternatively, based on NUMA node awareness, memory blocks located on the same NUMA node as the virtual device instance can be prioritized for allocation, reducing memory access latency.

[0125] Taking the encryption processing scenario as an example, the user-space program in the virtual machine needs to store the data to be encrypted and the encryption result data separately. It requests two 256-byte memory blocks from the driver. The driver allocates the corresponding memory blocks from the 32MB DMA memory pool corresponding to the second configuration information and returns two target virtual addresses for the program to write the data to be encrypted.

[0126] S902. The virtual machine determines the address offset information based on the target virtual address and the second configuration information.

[0127] Address offset information refers to the offset value of the target virtual address relative to the virtual machine virtual address base address of the DMA memory pool corresponding to the virtual device instance. This offset is consistent with the corresponding offset in the host machine's physical memory space. The virtual address base address refers to the starting address of the contiguous memory region corresponding to the second configuration information after it has been mapped to the virtual machine virtual address space.

[0128] Optionally, the virtual machine driver can obtain and record the virtual machine virtual address base address corresponding to the DMA memory pool based on the second configuration information. This base address corresponds one-to-one with the starting position of the memory region indicated by the second configuration information. Then, the driver obtains the target virtual address, calculates it using linear addressing, and subtracts the virtual address base address from the target virtual address to obtain the address offset information of the target virtual address within the entire DMA memory pool. Finally, the driver performs a validity check on the calculated address offset information to verify whether the offset falls within the memory region range indicated by the second configuration information. If so, the driver continues to execute the following step S903.

[0129] For example, assuming the virtual address base address of the DMA memory pool is 0x10000000 and the target virtual address obtained is 0x10001000, the address offset information is obtained by calculating 0x10001000-0x10000000, which is consistent with the offset in the host machine's physical memory.

[0130] S903: The virtual machine determines the target physical address based on the address offset information and the real physical base address.

[0131] The target physical address refers to the host machine's real physical address where the physical hardware can directly perform DMA operations. It is the memory address that the hardware can directly read and write data to without the need for address translation by the CPU or virtualization layer.

[0132] Optionally, after the virtual machine driver obtains and records the real physical base address corresponding to the DMA memory pool, it can linearly superimpose the address offset information that has completed the validity check with the real physical base address, that is, the target physical address = real physical base address + address offset information, to obtain the target physical address that the hardware can recognize. Finally, the driver performs a second validity check on the generated target physical address to ensure that the address falls within the physical address range of the DMA memory area allocated by the host machine.

[0133] In one possible implementation, after the address calculation is completed, the mapping relationship between the target physical address and the corresponding target virtual address can be stored in a cache table. When accessing the same memory block repeatedly in the future, the table can be looked up directly to obtain the address, thereby avoiding repeated calculations.

[0134] Continuing with the example above, assuming the real physical base address is 0x80000000 and the address offset information is 0x1000, by calculating 0x80000000+0x1000, the target physical address is obtained as 0x80001000, which is the real physical address that the physical encryption hardware can directly access.

[0135] S904. The virtual machine performs zero-copy data processing based on the target physical address and the first configuration information.

[0136] Zero-copy data processing refers to the process in which data is transferred between the virtual machine user space, memory, and physical hardware without going through multiple data copies via the virtualization layer and the host kernel. Instead, the hardware directly accesses the memory area operated by the virtual machine program and completes the data processing through DMA.

[0137] Optionally, after the virtual machine driver maps the control register area of ​​the physical hardware to the virtual address space of the virtual machine based on the first configuration information, the program inside the virtual machine can directly read and write this register area without going through the host virtualization layer. The user-mode program inside the virtual machine can fill the calculated target physical address into the corresponding register of the control register area corresponding to the first configuration information according to the hardware specifications, generate a hardware processing task request, and then the user-mode program directly notifies the physical hardware to execute the processing task by modifying the flag bit of the control register. The hardware reads the data to be processed directly from the memory area corresponding to the target physical address through DMA. After completing the calculation and processing, it writes the processing result back to the memory area corresponding to the target physical address through DMA. Finally, the program confirms that the task processing is completed by polling the register completion flag bit or receiving a hardware interrupt, and directly reads the processing result from memory through the target virtual address to complete the entire data processing flow.

[0138] Continuing the example above, the user-mode program fills the target physical address 0x80001000 (where the data to be encrypted is stored) and the target physical address 0x80002000 (where the result is stored) into the encryption hardware control register corresponding to the first configuration information, and modifies the queue flag to notify the hardware to execute the encryption task; the hardware directly reads the data to be encrypted from 0x80001000 via DMA, and writes the result back to 0x80002000 after encryption is completed; after the program polls for the completion flag, it directly reads the encryption result through the corresponding target virtual address.

[0139] As one possible implementation, multiple target physical addresses can be filled into different hardware queue registers simultaneously based on multi-queue hardware resources to achieve parallel data processing and improve throughput.

[0140] In this embodiment, memory allocation and virtual address acquisition through the DMA memory pool can determine the legal memory space that the hardware can directly access. Address translation is completed based on linear offset calculation, without the host machine participating in address translation. Instead, a real physical address that the hardware can recognize is generated directly on the virtual machine side. Combined with direct control of hardware registers, DMA data processing without intermediate transfer can be achieved, obtaining processing performance close to physical hardware pass-through, while ensuring the security of memory access.

[0141] The following is a further explanation of how the virtual machine determines the address offset information based on the target virtual address and the second configuration information, such as... Figure 10 As shown, the above step S902 includes: S1001. The virtual machine obtains the virtual address base address based on the second configuration information.

[0142] The virtual address base address is the starting virtual address after the contiguous memory region corresponding to the virtual device instance is mapped to the virtual address space of the virtual machine.

[0143] Optionally, the virtual machine driver can read the second configuration information and parse the configuration fields related to virtual address mapping, extract the virtual address start identifier corresponding to the contiguous memory region, and then perform a validity check on the extracted virtual address start identifier, including address format compliance and memory space boundary validity, to confirm that the address is a legal and accessible address within the virtual machine's virtual address space. After the verification is passed, the driver determines the verified virtual address start address as the virtual address base address corresponding to the memory region.

[0144] For example, the virtual machine driver reads the second configuration information and parses it to obtain the contiguous memory region corresponding to the virtual device instance. The starting address of the virtual address space mapped to the virtual machine is 0x20000000. After verification, this address falls within the legal virtual address range of the virtual machine. Then the driver can determine 0x20000000 as the virtual address base address of the memory region and store it in the local cache.

[0145] S1002. The virtual machine determines the address offset information based on the target virtual address and the virtual address base address.

[0146] Optionally, the virtual machine driver can retrieve the confirmed virtual address base address from the local cache, and simultaneously obtain the target virtual address corresponding to this memory request. Then, it performs boundary checks on the target virtual address to confirm that the target virtual address is greater than or equal to the virtual address base address and falls within the virtual address range of the contiguous memory region indicated by the second configuration information. If it exceeds the range, the calculation is terminated and an exception is returned. For target virtual addresses that pass the boundary check, the virtual address base address is subtracted from the target virtual address, and the difference is used as the address offset information. Finally, the calculated address offset information is aligned to ensure it meets the address alignment requirements for hardware access. After passing the alignment check, the address offset information is output.

[0147] Continuing with the example above, assuming the virtual address base address is determined to be 0x20000000, the target virtual address obtained by this memory allocation is 0x20004000. After verification, this address is within the legal range. By calculating 0x20004000-0x20000000, the address offset information is obtained as 0x4000.

[0148] In this embodiment, the compliance and accuracy of the address calculation base are ensured by extracting the virtual address base address from the second configuration information. Furthermore, the offset calculation based on linear interpolation is performed entirely on the virtual machine side, requiring no external system intervention and avoiding the additional overhead of address translation.

[0149] The following is a further explanation of the zero-copy data processing performed on the aforementioned virtual machine based on the target physical address and the first configuration information, such as... Figure 11 As shown, the process includes: S1101, The virtual machine determines the control register region indicated by the first configuration information as the target register region.

[0150] The target register region refers to the range of hardware control register addresses that the virtual machine selects and can legally access during the current data processing operation.

[0151] The virtual machine can read the complete content of the first configuration information, parse the address parameters used to identify the control register area, extract the start address, end address and space range of the register area, and perform legality and access permission verification on the extracted register address range to confirm that the address range is a hardware register space that the virtual machine can directly access, exclude illegal and unauthorized address ranges, and finally determine the complete control register area indicated by the first configuration information that has passed the verification as the target register area corresponding to this data processing.

[0152] In one possible implementation, when determining the target register region, the virtual machine's read and write permissions for that region can be checked simultaneously, and only the permission range matching the current operation can be opened, further improving the security of hardware access.

[0153] S1102, The virtual machine fills the target physical address into the target register region.

[0154] The virtual machine parses the functional partitioning rules of the target register region, locates the function register in the region used for configuring the physical address for reading and writing data, and performs a validity check on the target physical address to confirm that the address is a valid memory address that can be directly accessed by the physical hardware. Finally, in accordance with the bit width specification and data format requirements of the hardware register, the verified target physical address is completely written into the located function register to complete the address parameter filling.

[0155] S1103, Virtual machine reads and writes target registers to perform zero-copy data processing.

[0156] Optionally, the virtual machine can write a start instruction to the control instruction register in the target register area, triggering the physical hardware to execute the corresponding data processing task based on the configured target physical address. After receiving the start instruction, the hardware directly reads the data to be processed from the memory area corresponding to the target physical address via DMA. After completing the data processing internally, the hardware writes the processing result directly back to the memory area corresponding to the target physical address via DMA. The virtual machine obtains the execution progress and completion status of the hardware task by reading the status register in the target register area. After confirming that the task processing is completed, it directly obtains the processing result from the memory area corresponding to the target physical address, completing the entire zero-copy data processing process.

[0157] This application also provides an electronic device, which includes physical hardware and deploys a virtualization system. The virtualization system includes a host system and at least one virtual machine. (Refer to...) Figure 1 The diagram shows the architecture of a virtualization system. The host system includes a host kernel and a host user-mode program, and each virtual machine includes at least a virtual machine kernel and a virtual machine user-mode program.

[0158] The host system is used to execute the method steps performed by the host system in the aforementioned virtualization information processing method; The virtual machine is used to execute the method steps performed by the virtual machine in the aforementioned virtualization information processing method.

[0159] Optionally, continue to refer to Figure 1 The host kernel includes: a hardware interaction module, a memory management module, and a virtual device interface module; The hardware interaction module is used to interact with the hardware in the host machine; The memory management module is used for memory allocation; The Virtual Device Interface module is used to create and manage virtual device instances.

[0160] Optionally, the host user-mode program includes: host application programs; The host application is used to initiate instance creation requests and display instance processing information.

[0161] Optionally, the virtual machine kernel includes: a memory application module and a virtual device application module; the virtual machine user-space program includes: a virtual machine application and a hardware user-space driver; Virtual machine applications are used to initiate data processing requests and perform zero-copy data processing via hardware user-space drivers. The memory application module and the virtual machine device application module are used to bind virtual device instances.

[0162] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the virtualized information processing method described in the above method embodiments.

[0163] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the method embodiments, and will not be repeated here. In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection can be through some communication interfaces; the indirect coupling or communication connection of devices or modules can be electrical, mechanical, or other forms.

[0164] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. If the functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.

[0165] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A virtualized information processing method, characterized in that, The method includes: The host system creates virtual device instances and allocates at least one hardware resource and a contiguous memory region to each virtual device instance. It also generates and stores first configuration information and second configuration information for the virtual device instances based on the hardware resources. The first configuration information is used to indicate the control register region of the physical hardware, and the second configuration information is used to indicate the memory region. The host system transmits the actual physical base address of the memory region corresponding to the virtual device instance to the virtual device instance; The virtual machine binds to the virtual device instance and performs zero-copy data processing based on the real physical base address of the virtual device instance, the first configuration information, and the second configuration information.

2. The method according to claim 1, characterized in that, The host system creates virtual device instances, including: The host system registers driver capabilities with the virtualization environment; The host system creates a target device instance and generates at least one device instance template based on the target device instance; Obtain an instance creation request, and based on the instance creation request, create the virtual device instance by calling the device instance template through the system management interface.

3. The method according to claim 1, characterized in that, The virtual device instance includes: virtual device information; The step of allocating at least one hardware resource and memory region to each of the virtual device instances, and generating and storing first configuration information and second configuration information of the virtual device instances based on the hardware resources, includes: The host system allocates at least one hardware resource to each virtual device instance based on the virtual device information of each virtual device instance; The host system allocates memory regions to each virtual device instance based on the hardware resources of each virtual device instance; The host system generates and stores the first configuration information of each virtual device instance based on the hardware resources of each virtual device instance, and generates and stores the second configuration information of each virtual device instance based on the memory area of ​​each virtual device instance.

4. The method according to claim 3, characterized in that, The virtual device information includes: UUID identifier and virtual device type; The host system allocates at least one hardware resource to each virtual device instance based on the virtual device information of each virtual device instance, including: The host system parses the UUID identifier to obtain the NUMA node identifier; The host system determines the amount of hardware resources required for the virtual device instance based on the virtual device type. The host system allocates a number of hardware resources corresponding to the number of hardware resources from the hardware resource pool corresponding to the NUMA node to the virtual device instance based on the NUMA node identifier and the number of hardware resources.

5. The method according to claim 3, characterized in that, The host system generates and stores the first configuration information of each virtual device instance based on the hardware resources of each virtual device instance, including: The host system generates the first configuration information of the virtual device instance based on the actual physical address of the control register area corresponding to the hardware resources of the virtual device instance.

6. The method according to claim 3, characterized in that, The step of generating and storing the second configuration information of each virtual device instance based on the memory region of each virtual device instance includes: The host system generates the second configuration information of the virtual device instance based on the actual physical address of the memory region of the virtual device instance.

7. The method according to claim 1, characterized in that, The host system passes the actual physical base address of the memory region corresponding to the virtual device instance to the virtual device instance, including: The host system determines the actual physical starting address of the memory region in the host system and uses the actual physical starting address as the actual physical base address. The host system fills the real physical base address into the preset extended field corresponding to the virtual device instance, so that the virtual device instance can obtain the real physical base address from the preset extended field when the hardware driver is loaded.

8. The method according to claim 1, characterized in that, The virtual machine is bound to the virtual device instance, including: After the virtual machine starts, it identifies the virtual device instance; The virtual machine loads a hardware driver that matches the virtual device instance to trigger the execution of the hardware driver. When the hardware driver is executed, it parses a standardized interface based on the real physical base address of the virtual device instance, the first configuration information, and the second configuration information, and maps the first configuration information and the second configuration information to the virtual address space.

9. The method according to claim 8, characterized in that, The process of zero-copy data processing by the virtual machine based on the real physical base address of the virtual device instance, the first configuration information, and the second configuration information includes: The virtual machine requests memory based on the second configuration information and determines the target virtual address based on the requested memory; The virtual machine determines the address offset information based on the target virtual address and the second configuration information; The virtual machine determines the target physical address based on the address offset information and the real physical base address; The virtual machine performs zero-copy data processing based on the target physical address and the first configuration information.

10. The method according to claim 9, characterized in that, The virtual machine determines the address offset information based on the target virtual address and the second configuration information, including: The virtual machine obtains the virtual address base address according to the second configuration information; The virtual machine determines the address offset information based on the target virtual address and the virtual address base address.

11. The method according to claim 9, characterized in that, The virtual machine performs zero-copy data processing based on the target physical address and the first configuration information, including: The virtual machine determines the control register region indicated by the first configuration information as the target register region; The virtual machine fills the target physical address into the target register region; The virtual machine reads and writes the target register to perform zero-copy data processing.

12. An electronic device, characterized in that, The electronic device includes physical hardware and is equipped with a virtualization system. The virtualization system includes a host system and at least one virtual machine. The host system includes a host kernel and a host user-mode program. Each virtual machine includes at least a virtual machine kernel and a virtual machine user-mode program. The host system is used to execute the method steps performed by the host system in the virtualization information processing method as described in any one of claims 1-11; The virtual machine is used to execute the method steps performed by the virtual machine in the virtualization information processing method as described in any one of claims 1-11.

13. The electronic device according to claim 12, characterized in that, The host kernel includes: a hardware interaction module, a memory management module, and a virtual device interface module; The hardware interaction module is used to interact with the hardware in the host machine; The memory management module is used for memory allocation; The virtual device interface module is used to create and manage virtual device instances.

14. The electronic device according to claim 12, characterized in that, The host user-mode program includes: a host application program; The host application is used to initiate instance creation requests and display instance processing information.

15. The electronic device according to claim 12, characterized in that, The virtual machine kernel includes a memory application module and a virtual device application module; the virtual machine user-space program includes a virtual machine application program and a hardware user-space driver. The virtual machine application is used to initiate data processing requests and perform zero-copy data processing through the hardware user space driver. The memory application module and the virtual device application module are used to bind virtual device instances.

16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the virtualized information processing method as described in any one of claims 1 to 11.