A method for improving the real-time performance of a virtualization device
By managing the address space and register operations of virtualized devices in operating system software and using a ring buffer linked list for data interaction, the problem of low real-time virtualized devices in embedded systems is solved, achieving more efficient resource utilization and real-time improvement.
Patent Information
- Application Number
- CN202211613946.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-15
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2042-12-15
AI Technical Summary
The prior art is difficult to effectively improve the real-timeness of virtualized devices in embedded systems, due to the complex virtualized device types, control management and data transmission processes.
The address space management and register operation of virtualized devices are realized in the operating system software, and the data sending and receiving cache information is attached through the ring buffer linked list, and the virtual computer switch is only performed when the virtualized device driver software reads and writes the registers, reducing the exit and entry frequency of the virtual computer.
By reducing the switching frequency of virtual computers, the real-timeness of virtualized devices is improved and the resource utilization rate of embedded systems is enhanced.
Smart Images

Figure CN116048717B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer system software, and particularly relates to a method for improving the real-time performance of virtualized devices. Background Art
[0002] With the development of computer technology, virtualization technology is applied to embedded computers to improve the resource utilization rate of embedded systems. Virtualization of virtualized devices is a key technology for applying virtualization technology to embedded computers. Since embedded systems have high requirements for real-time performance, a method for realizing virtualization of virtualized devices that guarantees real-time performance is needed. The complex and diverse types of virtualized devices, the control and management of virtualized devices, and the data transmission of virtualized devices will all affect the real-time performance of virtualization of virtualized devices. Summary of the Invention
[0003] In view of this, the present invention provides a method for improving the real-time performance of virtualized devices, which realizes virtualized devices in operating system software and drives virtualized devices in a virtual computer. The operating system software defines the address space, register management, and operation services of the virtualized devices. The virtualized device driver software running in the virtual computer reads and writes the address space and registers of the virtualized devices, traps and exceptions to the operating system software, and the operating system software completes the actual operations of the virtualized devices. The data transceiver cache information is connected through a circular buffer linked list. Only when the virtualized device driver software reads and writes the registers of the virtualized devices, the virtual computer is switched. When data is transmitted and received, the virtual computer does not need to be switched, thereby reducing the frequency of the virtual computer exiting and entering, and achieving the purpose of improving the real-time performance of the virtualized devices.
[0004] In order to achieve the above technical objectives, the specific technical solutions adopted by the present invention are as follows:
[0005] A method for improving the real-time performance of virtualized devices, which is implemented in operating system software, and the virtualized devices are set in a virtual computer. The address space of the virtualized devices is constructed based on the following method: a virtualized device identification register, a control register, a data transmission register, and a function register are defined in the address space of the virtualized devices;
[0006] Among them, the virtualized device type register is used to store the type of the virtualized device; the virtualized device feature register is used to store the version number and functional features of the virtualized device; the virtualized device status register is used to record the current status of the virtualized device, and the current status includes data readiness and interrupt status; the virtualized device control register is used to control the opening and closing of the virtualized device; the data transfer register is used to record the circular buffer addresses for receiving and sending data of the virtualized device, and data interaction is performed through the circular buffer; the virtualized device interrupt register controls the working mode, virtualized device interrupt number, virtualized device receive interrupt, and send interrupt of the virtualized device.
[0007] The access control management method for the virtualized device is as follows: when constructing a virtual computer, a virtualized device is created for the virtual computer, and an address space and virtualized device operation services are provided; the virtual computer is allowed to drive the virtualized device by directly accessing the virtualized device address.
[0008] The data flow control method for the virtualized device is as follows: when the virtual computer reads and writes the virtualized device address register, an exception is automatically triggered and trapped into the operating system. The operating system responds to the virtualized device service request exception event, parses the service request, completes the service request operation of the virtualized device, and returns to the virtual computer.
[0009] Furthermore, when constructing a virtual computer, the operating system software creates a virtualized device by configuring the virtualized device address, interrupt information, working mode, and virtualized device version information, allocates an address space of 4KB, establishes the virtualized device space of the virtual computer, sets access permissions, and registers operation services.
[0010] When the virtualized device is created, it is in the initial reset state, the virtualized device is closed, the interrupt is closed, and only the virtualized device type register and the virtualized device feature register store read-only data information. The initialization of the control register, data transfer register, and function register is the responsibility of the virtualized device driver software running in the virtual computer.
[0011] Furthermore, the data flow control method of the virtualized device is implemented based on the virtualized device service framework; the virtualized device service framework supports multiple types of virtualized devices and is divided into a virtualized device driver layer, a data transfer layer, and a virtualized device service layer.
[0012] Furthermore, the virtualized device driver layer runs in the virtual computer and serves as an access interface for the virtualized device to access the virtualized device address space and read and write registers.
[0013] During the initialization phase of the virtualized device, the virtualized device driver layer obtains the type and version information of the virtualized device, registers data processing services according to the type of the virtualized device, initializes the data reception and transmission circular buffer of the virtualized device, sets the working mode of the virtualized device, and configures the interrupt information of the virtualized device.
[0014] During the data reception phase of the virtualized device, the virtualized device driver layer obtains the data status of the virtualized device, retrieves data from the data reception circular buffer, and sets the data read completion status at the virtualized device end.
[0015] During the data transmission phase of the virtualized device, the virtualized device driver layer inserts data into the data transmission circular buffer and sets the data transmission ready status at the virtualized device end.
[0016] Furthermore, the data transmission layer is responsible for the data interaction between the virtualized device driver layer and the virtualized device service layer.
[0017] When the data transmission layer receives data, the virtualized device service layer receives data from the physical virtualized device, inserts the data into the data transmission layer, and the virtualized device driver layer reads the data from the data transmission layer.
[0018] When the data transmission layer sends data, the virtualized device driver layer inserts the data into the data transmission layer, the virtualized device service layer reads the data from the data transmission layer, and sends the data to the physical virtualized device.
[0019] Furthermore, the virtualized device service layer is used to process service requests of the virtualized device.
[0020] When the virtualized device driver software accesses the address space of the virtualized device, the virtualized device service layer triggers a trap exception, exits the virtual machine, and enters the virtualized device service layer for execution.
[0021] After entering the virtualized device service layer for execution, the virtualized device service layer is responsible for parsing the cause of the trap exception, parsing the exception information, retrieving the virtualized device according to the exception address, selecting the operation service of the virtualized device according to the operation type, reading and writing the corresponding virtualized device registers, and completing the operation at the virtualized device end.
[0022] Adopting the above technical solutions, the present invention can bring the following beneficial effects:
[0023] After implementing the method of the present invention, virtualization of virtualized devices can be realized in an embedded system, reducing the exit and entry frequencies of the virtual machine during access to virtualized devices, reducing the switching time overhead of the virtual machine, and improving the real-time performance of virtualized devices. Description of the Drawings
[0024] To more clearly illustrate the technical solutions of the embodiments of the present disclosure, the accompanying drawings required for the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present disclosure. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0025] Figure 1 Spatial layout diagram of the virtualization device in the specific embodiment of the present invention;
[0026] Figure 2 Hierarchical structure diagram of the virtualization device in the specific embodiment of the present invention;
[0027] Figure 3 Data sending diagram of the virtualization device in the specific embodiment of the present invention;
[0028] Figure 4 Data receiving diagram of the virtualization device in the specific embodiment of the present invention. Specific Embodiments
[0029] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0030] The following illustrates the embodiments of the present disclosure through specific examples. Those skilled in the art can easily understand other advantages and effects of the present disclosure from the content disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that, without conflict, the following embodiments and the features in the embodiments can be combined with each other. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present disclosure without creative efforts belong to the scope of protection of the present disclosure.
[0031] It should be noted that the following describes various aspects of the embodiments within the scope of the appended claims. It should be obvious that the aspects described herein can be embodied in a wide variety of forms, and any specific structure and / or function described herein is illustrative only. Based on the present disclosure, those skilled in the art should understand that one aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number of aspects described herein can be used to implement the device and / or practice the method. Additionally, this device and / or this method can be implemented using other structures and / or functionality in addition to one or more of the aspects described herein.
[0032] It should also be noted that the diagrams provided in the following embodiments only illustrate the basic concept of the present disclosure in a schematic manner. The diagrams only show the components related to the present disclosure, rather than being drawn according to the number, shape, and size of the components in actual implementation. The types, quantities, and proportions of the components in actual implementation can be arbitrarily changed, and the component layout type may also be more complex.
[0033] In addition, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, those skilled in the art will understand that the described aspects can be practiced without these specific details.
[0034] The virtualization of virtualization devices is a function provided by the operating system software. The operating system software supports the virtualization capability. When creating a virtual computer, it is necessary to create virtualization devices for the virtual computer. Since there are many types of virtualization devices, when the operating system software creates virtualization devices, it is necessary to configure the virtualization device name, virtualization device type, and virtualization device address space.
[0035] The operating system software configures the virtualization device address space, defines the spatial layout within the address space, and defines the functions and operation descriptions of the registers. The register is the lowest-level interface for managing virtualization devices. The virtual computer accesses the virtualization device according to the virtualization device address space, reads and writes relevant registers according to the address space layout and the definition of the registers, and realizes the virtualization device driver.
[0036] The virtualization device driver software running in the virtual computer reads the virtualization device type register to obtain virtualization device information, including the virtualization device type, virtualization device version number, and virtualization device manufacturer; reads the virtualization device feature register to obtain the virtualization device function definition; reads the virtualization device status register to view the status of the virtualization device; writes to the data address register to set the data transceiver circular buffer linked list during data transmission of the virtualization device. The virtualization device driver software operates in the same way as operating a physical virtualization device and realizes the operation of driving the virtualization device through the operation of relevant registers.
[0037] When the virtualization device driver software reads and writes the virtualization device register, it exits the virtual computer in the form of a trap exception and enters the operating system software. The operating system software identifies and parses the virtualization device operation service request. The operating system software determines the virtualization device register and data value that the virtualization device driver software expects to read and write according to the instruction encoding and general register values during the trap exception, and completes the read and write operations and initialization of the corresponding register.
[0038] When the virtualized device driver software sends data, it adds information such as the data buffer address and data length to the data - sending circular buffer linked list, and writes to the data - sending notification register to notify the operating system software to send the data. When receiving data, the operating system software adds information such as the received data buffer address and data length to the data - receiving circular buffer linked list and sets the data status register. The virtualized device data reception can be in polling mode and interrupt mode. In polling mode, the virtualized device driver software determines whether there is ready data in the virtualized device by reading the data - receiving status register, obtains the data address from the data - receiving circular buffer linked list, and reads the data. In interrupt mode, after the operating system software finishes receiving the data, it sends an interrupt to the virtual machine, and the virtualized device interrupt handler registered by the virtual machine completes the data reception.
[0039] The virtualization of the virtualized device is the responsibility of the operating system software to manage and drive the physical virtualized device and provide an interface to the virtual machine. The virtual machine interacts with the operating system software through the interface to complete data sending and receiving, reducing the frequent switching of the virtual machine.
[0040] In an embodiment of the present invention, a method for improving the real - time performance of a virtualized device is proposed, which is implemented in the operating system software. The virtualized device is set in the virtual machine, and the address space of the virtualized device is constructed based on the following method: a virtualized device identification register, a control - type register, a data - transfer register, and a function register are defined within the address space of the virtualized device;
[0041] Among them, the virtualized device type register is used to store the type of the virtualized device; the virtualized device feature register is used to store the version number and functional features of the virtualized device; the virtualized device status register is used to record the current state of the virtualized device, and the current state includes data ready and interrupt status; the virtualized device control register is used to control the opening and closing of the virtualized device; the data - transfer register is used to record the data - receiving circular buffer address and data - sending circular buffer address of the virtualized device, and data interaction is performed through the circular buffer; the virtualized device interrupt register controls the working mode, virtualized device interrupt number, virtualized device receive interrupt, and send interrupt of the virtualized device;
[0042] The access control management method of the virtualized device is as follows: when constructing the virtual machine, a virtualized device is created for the virtual machine, providing an address space and virtualized device operation services; allowing the virtual machine to drive the virtualized device by directly accessing the virtualized device address;
[0043] The data flow control method of the virtualized device is as follows: when the virtual computer reads or writes the virtualized device address register, an exception is automatically triggered and trapped into the operating system. The operating system responds to the virtualized device service request exception event, parses the service request, completes the service request operation of the virtualized device, and returns to the virtual computer.
[0044] In this embodiment, when constructing the virtual computer, the operating system software creates the virtualized device by configuring the virtualized device address, interrupt information, working mode, and virtualized device version information, allocates a 4KB address space, establishes the virtualized device space of the virtual computer, sets the access permission, and registers the operation service;
[0045] When the virtualized device is created, it is in the initial reset state, the virtualized device is closed, the interrupt is closed, and only the virtualized device type register and the virtualized device feature register store read-only data information. The initialization of the control register, data transfer register, and function register is the responsibility of the virtualized device driver software running in the virtual computer.
[0046] In this embodiment, the data flow control method of the virtualized device is implemented based on the virtualized device service framework; the virtualized device service framework supports multiple types of virtualized devices and is divided into a virtualized device driver layer, a data transfer layer, and a virtualized device service layer.
[0047] In this embodiment, the virtualized device driver layer runs in the virtual computer and serves as the access interface of the virtualized device for accessing the virtualized device address space and reading and writing registers;
[0048] In the initialization stage of the virtualized device, the virtualized device driver layer obtains the virtualized device type and version information, registers the data processing service according to the virtualized device type, initializes the virtualized device data transceiver circular buffer, sets the virtualized device working mode, and configures the virtualized device interrupt information;
[0049] In the data reception stage of the virtualized device, the virtualized device driver layer obtains the virtualized device data status, obtains the data from the data reception circular buffer, and sets the data read completion status at the virtualized device end;
[0050] In the data transmission stage of the virtualized device, the virtualized device driver layer inserts the data into the data transmission circular buffer and sets the data transmission ready status at the virtualized device end.
[0051] In this embodiment, the data transfer layer is responsible for the data interaction between the virtualized device driver layer and the virtualized device service layer;
[0052] When the data transmission layer receives data, the virtualized device service layer receives data from the physical virtualized device, inserts the data into the data transmission layer, and the virtualized device driver layer reads the data from the data transmission layer;
[0053] When the data transmission layer sends data, the virtualized device driver layer inserts the data into the data transmission layer, the virtualized device service layer reads the data from the data transmission layer, and sends the data to the physical virtualized device.
[0054] In this embodiment, the virtualized device service layer is used to process service requests of the virtualized device;
[0055] When the virtualized device service layer accesses the virtualized device address space by the virtualized device driver software, it triggers a trap exception, exits the virtual machine, and enters the virtualized device service layer for execution;
[0056] After entering the virtualized device service layer for execution, the virtualized device service layer is responsible for parsing the cause of the trap exception, parsing the exception information, retrieving the virtualized device according to the exception address, selecting the operation service of the virtualized device according to the operation type, reading and writing the corresponding virtualized device registers, and completing the operation on the virtualized device side.
[0057] Furthermore, the further implementation scheme of the method for improving the real-time performance of the virtualized device in this embodiment is as follows:
[0058] 1. Define the virtualized device address space
[0059] In this embodiment, the virtualized device address space is defined in the virtualized device management module in the operating system software. The virtualized device address space is an address of 4KB in size. In this address space, the virtualized device type register, the virtualized device feature register, the virtualized device status register, the virtualized device control register, the virtualized device data transceiver buffer address register, and the virtualized device interrupt register are defined. Among these registers, the virtualized device type register stores the type of the virtualized device; the virtualized device feature register stores the version number and functional features of the virtualized device; the virtualized device status register records the current status of the virtualized device, including data ready and interrupt status; the virtualized device control register controls the opening and closing of the virtualized device. Only when the virtualized device is opened can the virtualized device work; the virtualized device data transceiver buffer address register records the virtualized device receive data circular buffer address and the send data circular buffer address, and data interaction is performed through the circular buffer; the virtualized device interrupt register controls the virtualized device working mode, the virtualized device interrupt number, the virtualized device receive interrupt, and the send interrupt.
[0060] 2. Create a virtualized device
[0061] This embodiment implements a method for creating a virtualized device in the operating system software. When creating a virtual computer, the operating system software creates a virtualized device by configuring the virtualized device address, interrupt information, working mode, and virtualized device version information, allocates an address space of 4KB, establishes the virtualized device space of the virtual computer, sets access permissions, and registers operation services. When the virtualized device is created, the virtualized device is in an initial reset state, the virtualized device is turned off, the interrupt is turned off, and only the virtualized device type register and the virtualized device feature register store read-only data information. The initialization of other registers is responsible for the virtualized device driver software running in the virtual computer.
[0062] 3. Establish a virtualized device service framework
[0063] This embodiment establishes a virtualized device service framework in the virtualized device management module of the operating system software. This framework is a unified virtualized device service framework, independent of the virtualized device type, and is divided into a virtualized device driver layer, a data transmission layer, and a virtualized device service layer.
[0064] The virtualized device driver layer is software running in the virtual computer. This software implements the virtualized device access interface, accesses the virtualized device address space, and reads and writes registers. In the initialization stage of the virtualized device, it obtains the virtualized device type and version information, registers data processing services according to the virtualized device type; initializes the virtualized device data transceiver circular buffer; sets the virtualized device working mode and configures the virtualized device interrupt information. In the data reception stage, it obtains the virtualized device data status, obtains data from the data reception circular buffer, and sets the data read completion status at the virtualized device end. In the data transmission stage, it inserts the data into the data transmission circular buffer and sets the data transmission ready status at the virtualized device end.
[0065] The data transmission layer is between the virtualized device driver layer and the virtualized device service layer and is responsible for data interaction. When receiving data, the virtualized device service layer receives data from the physical virtualized device, inserts the data into the data transmission layer, and the virtualized device driver layer reads the data from the data transmission layer. When sending data, the virtualized device driver layer inserts the data into the data transmission layer, the virtualized device service layer reads the data from the data transmission layer, and sends the data to the physical virtualized device.
[0066] The virtualized device service layer is responsible for processing service requests of the virtualized device. When the virtualized device driver software accesses the virtualized device address space, it triggers a trap exception, exits the virtual computer, and enters the operating system software for execution. The operating system software is responsible for parsing the cause of the trap exception, parsing the exception information, retrieving the virtualized device according to the exception address. Select the operation service of the virtualized device according to the operation type, read and write the corresponding virtualized device register, and complete the operation at the virtualized device end.
[0067] 4. Establish an efficient data transmission mechanism
[0068] In this embodiment, an efficient data transmission is achieved through the data transmission layer. The data transmission layer establishes multiple data circular buffers, including a receive data circular buffer and a transmit data circular buffer. The data circular buffer is implemented in the form of a queue, and the queue description information, including the start address, the number of data items, and the queue number, is recorded in the data address of the virtualized device.
[0069] The receive data circular buffer is the data buffer for the virtualized device to receive data. When the virtualized device service layer receives data from the physical virtualized device, it searches for available data items in the data buffer, fills in the data address and data size in the data buffer, and the virtualized device driver software directly reads the data address and size from the buffer and completes data reception according to the data address and size.
[0070] The transmit data circular buffer is the data buffer for the virtualized device to send data. When sending data, the virtualized device driver software searches for available data items in the data buffer, fills in the data address and size in the data buffer, notifies the virtualized device service layer that the data is ready, and the virtualized device service layer reads the data address and size from the buffer and sends the data to be sent to the physical virtualized device.
[0071] Further explanation:
[0072] In the virtualized device management module of the operating system software, the virtualized device address space layout and each register interface are defined. As Figure 1 shown, the type register, feature register, status register, control register, address register, and interrupt register of the virtualized device are defined.
[0073] The operating system software provides the virtualized device configuration function for the virtual computer, and configures the virtualized device type, address, version information, and interrupt information.
[0074] The operating system software creates a virtual computer, creates a virtualized device for the virtual computer, allocates the virtualized device address space, and initializes the virtualized device information.
[0075] Establish the software hierarchy of the virtualized device, as Figure 2 shown. Establish the virtualized device service layer in the operating system software, establish the virtualized device driver layer in the virtual computer, and connect these two layers into a whole through the data transmission layer.
[0076] Establish a unified virtualized device service interface in the virtualized device service layer, implement differentiated virtualized device services according to the virtualized device type, and register the corresponding virtualized device service interface when the virtualized device is created.
[0077] The virtualized device driver software obtains the virtualized device type, virtualized device version, and virtualized device functional characteristic information.
[0078] The virtualized device driver software constructs receive data and send data circular buffer queues, writes the buffer queue addresses into the virtualized device address registers, sets the virtualized device working mode, and completes the initialization of the virtualized device.
[0079] The virtualized device performs a data sending operation, as Figure 3 shown. The virtualized device driver software finds an available data item from the send circular buffer queue, fills the data address and length information to be sent into the data item, and notifies the virtualized device service layer by writing to the notification register.
[0080] After receiving the data sending notification, the virtualized device service layer obtains the valid data item from the send circular buffer queue, processes the data, and sends it to the physical virtualized device.
[0081] The virtualized device performs a data receiving operation, as Figure 4 shown. When the physical virtualized device receives data, it notifies the operating system software to perform data reception.
[0082] The operating system software receives data from the physical virtualized device and processes the data.
[0083] The operating system software obtains an available data item from the receive circular buffer queue, fills the processed data into the data item, and sends a data reception interrupt to the virtualized device.
[0084] After receiving the interrupt, the virtualized device driver software obtains the valid data item from the receive circular buffer queue, parses the data address and length, and reads the data.
[0085] After completing data reception, the virtualized device driver releases the data item to ensure that there are available data items in the receive circular buffer queue, so that the virtual computer can receive data in real time.
[0086] After completing data sending, the virtualized device driver releases the data item to ensure that there are available data items in the send circular buffer queue, so that the virtual computer can send data in real time.
[0087] A method for improving the real-time performance of a virtualized device in this embodiment implements a virtualized device in an embedded system. The operating system software provides the virtualized device functions, provides a unified virtualized device access interface for virtual machines, and the virtualized device driver software completes the initialization and driving of the virtualized device, establishes a data path with the virtualized device service layer, realizes an efficient data transmission service, realizes multiple virtual computers sharing the physical virtualized device, and improves the real-time performance of the virtualized device.
[0088] As described above, this is only a specific implementation manner of the present disclosure. However, the protection scope of the present disclosure is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed by the present disclosure should be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.
Claims
1. A method for improving the real-time performance of a virtualized device, implemented in an operating system software, where the virtualized device is set in a virtual computer, characterized in that , the address space of the virtualized device is constructed as follows: a virtualized device identification register, a control class register, a data transfer register, and a function register are defined within the address space of the virtualized device; Among them, the virtualized device type register is used to store the type of the virtualized device; the virtualized device feature register is used to store the version number and functional features of the virtualized device; the virtualized device status register is used to record the current status of the virtualized device, and the current status includes data readiness and interrupt status; the virtualized device control register is used to control the opening and closing of the virtualized device; the data transfer register is used to record the circular buffer address for receiving data and the circular buffer address for sending data of the virtualized device, and data interaction is performed through the circular buffer; the virtualized device interrupt register controls the working mode, interrupt number, receive interrupt, and send interrupt of the virtualized device; The access control management method of the virtualized device is: when constructing a virtual computer, a virtualized device is created for the virtual computer, providing an address space and virtualized device operation services; allowing the virtual computer to drive the virtualized device by directly accessing the address of the virtualized device; The data flow control method of the virtualized device is: when the virtual computer reads and writes the address register of the virtualized device, an exception is automatically triggered and trapped into the operating system. The operating system responds to the virtualized device service request exception event, parses the service request, completes the service request operation of the virtualized device, and returns to the virtual computer; The data flow control method of the virtualized device is implemented based on the virtualized device service framework; the virtualized device service framework supports multiple types of virtualized devices and is divided into a virtualized device driver layer, a data transfer layer, and a virtualized device service layer; The virtualized device driver layer runs in the virtual computer and serves as an access interface for the virtualized device, used to access the address space of the virtualized device and read and write registers; In the initialization stage of the virtualized device, the virtualized device driver layer obtains the type and version information of the virtualized device, registers data processing services according to the type of the virtualized device, initializes the data reception and transmission circular buffers of the virtualized device, sets the working mode of the virtualized device, and configures the interrupt information of the virtualized device; In the data reception stage of the virtualized device, the virtualized device driver layer obtains the data status of the virtualized device, retrieves data from the data reception circular buffer, and sets the data read completion status at the virtualized device end; In the data transmission stage of the virtualized device, the virtualized device driver layer inserts data into the data transmission circular buffer and sets the data transmission readiness status at the virtualized device end; The virtualized device service layer is used to process service requests of the virtualized device; When the virtualized device driver software accesses the address space of the virtualized device, the virtualized device service layer triggers a trap exception, exits the virtual computer, and enters the virtualized device service layer for execution; After entering and executing in the virtualized device service layer, the virtualized device service layer is responsible for parsing the cause of the trap exception, parsing the exception information, retrieving the virtualized device according to the exception address, selecting the operation service of the virtualized device according to the operation type, reading and writing the corresponding virtualized device registers, and completing the operation on the virtualized device side.
2. The method for improving the real-time performance of a virtualized device according to claim 1, characterized in that When constructing a virtual computer, the operating system software creates a virtualized device by configuring the virtualized device address, interrupt information, working mode, and virtualized device version information, allocates a 4KB address space, establishes the virtualized device space of the virtual computer, sets the access permission, and registers the operation service; When the virtualized device is created, it is in the initial reset state, the virtualized device is closed, the interrupt is closed, and only the virtualized device type register and the virtualized device feature register store read-only data information. The initialization of the control register, data transfer register, and function register is the responsibility of the virtualized device driver software running in the virtual computer.
3. The method for improving the real-time performance of a virtualized device according to claim 2, characterized in that The data transfer layer is responsible for the data interaction between the virtualized device driver layer and the virtualized device service layer; When the data transfer layer receives data, the virtualized device service layer receives data from the physical virtualized device, inserts the data into the data transfer layer, and the virtualized device driver layer reads the data from the data transfer layer; When the data transfer layer sends data, the virtualized device driver layer inserts the data into the data transfer layer, the virtualized device service layer reads the data from the data transfer layer, and sends the data to the physical virtualized device.
Citation Information
Patent Citations
Method and a system for building a virtual mechanism based on a processor
CN109522087A
CPU virtualization method based on privileged instruction library
CN112416508A