An LPI interrupt virtualization method and device, an operating system and a storage medium

By statically allocating devices to virtual machines and creating entries in the physical ITS mapping table, and using simulated ITS commands to map physical LPI interrupts to virtual machines, the problem of LPI interrupts not being uniquely identified in Type 1 virtualization is solved, enabling multiple virtual machines to use virtual vLPI interrupts.

CN117762560BActive Publication Date: 2026-11-10INTEWELL (GUANGZHOU) SOFEWARE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311775528.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-21
Publication Date
2026-11-10
Estimated Expiration
2043-12-21

AI Technical Summary

Technical Problem

In the Type 1 virtualization scheme, LPI interrupts cannot be uniquely identified by LPI interrupt numbers, which prevents other virtual machines from using ITS functions and fails to meet the scenario where every virtual machine can use ITS and LPI.

Method used

By statically allocating devices to virtual machines and creating corresponding entries in the physical ITS mapping table, physical LPI interrupts are mapped to the corresponding virtual machines, and virtual vLPI interrupts can be used by multiple virtual machines using simulated ITS commands.

Benefits of technology

This enables multiple virtual machines to use virtual vLPI interrupts, solving the problem that LPI interrupts cannot be uniquely identified and allowing each virtual machine to handle physical LPI interrupts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117762560B_ABST
    Figure CN117762560B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a kind of LPI interrupt virtualization method, device, operating system and storage medium, the method comprises: when creating virtual machine, hypervisor distributes physical device to the virtual machine;When first running the virtual machine created, the table item corresponding to the device ID and event ID of the virtual machine, the device is established in physical ITS mapping table by simulating ITS command;When hypervisor receives the message of physical LPI interrupt, according to the device ID and event ID in the message, the virtual machine to which the device corresponding to the device ID belongs is obtained using physical ITS mapping table;Hypervisor injects the virtual vLPI interrupt corresponding to the physical LPI interrupt into the virtual machine, and the virtual vLPI interrupt processing is carried out by the virtual machine.The technical scheme of the embodiment of the present application maps the physical LPI interrupt to the corresponding virtual machine by statically allocating the device for the virtual machine and establishing the corresponding table item in the physical ITS mapping table, to realize that multiple virtual machines use virtual vLPI interrupt.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of operating systems, and more particularly to an LPI interrupt virtualization method, apparatus, operating system, and storage medium. Background Technology

[0002] Currently, in the Type 1 virtualization solution, interrupt virtualization is divided into ordinary interrupt virtualization and LPI interrupt virtualization. LPI is different from ordinary interrupts. It is dynamically allocated at runtime and cannot be uniquely identified by the LPI interrupt number. ITS virtualization can only be applied to one virtual machine. Other virtual machines cannot use ITS functions or LPI interrupts.

[0003] For example, the current Xen virtualization solution only allows dom0 to use ITS and LPI. Obviously, this method has limitations and cannot meet the scenario where every virtual machine can use ITS and LPI. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide an LPI interrupt virtualization method, apparatus, operating system, and storage medium. The technical solution of the present invention, in a computer system based on type 1 virtualization, maps physical LPI interrupts to corresponding virtual machines by statically allocating devices to virtual machines and establishing corresponding entries in the physical ITS mapping table, thereby enabling multiple virtual machines to use virtual vLPI interrupts.

[0005] In a first aspect, embodiments of the present invention provide an LPI interrupt virtualization method, comprising: when creating a virtual machine, a hypervisor assigns a physical device to the virtual machine; when the created virtual machine is run for the first time, an entry corresponding to the device ID and event ID of the virtual machine and the device is established in the physical ITS mapping table by simulating ITS commands; when the hypervisor receives a physical LPI interrupt message, it obtains the virtual machine to which the device ID belongs by using the physical ITS mapping table according to the device ID and event ID in the message; the hypervisor injects a virtual vLPI interrupt corresponding to the physical LPI interrupt into the virtual machine, and the virtual machine performs virtual vLPI interrupt processing.

[0006] Therefore, in a computer system based on type 1 virtualization, by statically allocating devices to virtual machines and establishing corresponding entries in the physical ITS mapping table, physical LPI interrupts are mapped to the corresponding virtual machines, enabling multiple virtual machines to use virtual vLPI interrupts.

[0007] In one possible implementation of the first aspect, the simulated ITS command includes: a simulated MAPC command, a simulated MAPD command, and a simulated MAPTI command, which are used to simulate the physical MAPC command, the physical MAPD command, and the physical MAPTI command, respectively.

[0008] As described above, by simulating ITS commands to simulate physical ITS commands, each virtual machine can issue simulated ITS commands to simulate physical ITS commands.

[0009] In one possible implementation of the first aspect, when the virtual machine is first run and created, establishing entries corresponding to the device ID and event ID of the virtual machine and the device in the physical ITS mapping table by simulating ITS commands includes: when the virtual machine sends a simulated MAPC command, the hypervisor adds an entry corresponding to the virtual machine in the physical Collection table of the ITS; when the virtual machine sends a simulated MAPD command that includes the device ID, the hypervisor uses the physical MAPD command of the ITS to add an entry corresponding to the device ID in the physical device table of the ITS; when the virtual machine sends a simulated MAPTI command that includes the device ID, the hypervisor uses the physical MAPTI command of the ITS to add an entry corresponding to the physical LPI interrupt of the device in the corresponding physical ITT table.

[0010] As described above, by simulating MAPC, MAPD, and MAPTI commands, entries corresponding to the virtual machine, device ID, and event ID of the physical LPI interrupt are established in the physical Collection, physical device, and physical ITT tables. This maps the physical LPI interrupt to the virtual machine of its corresponding device, allowing the physical LPI interrupt to be injected into the corresponding virtual machine and avoiding the problem of not being able to inject the physical LPI interrupt according to the interrupt number.

[0011] In one possible implementation of the first aspect, when the created virtual machine is run for the first time, the method further includes: the virtual machine establishing its simulated Collection table by simulating the MAPC command, which maps the Collection ID of each physical LPI interrupt of the virtual machine to the vCPU corresponding to the virtual machine; the virtual machine establishing its simulated device table by simulating the MAPD command, which maps each device ID of the virtual machine to the base address of the simulated ITT table; and the virtual machine establishing its simulated ITT table by simulating the MAPTI command, which maps each event ID of the virtual machine to the Collection ID and the virtual vLPI interrupt.

[0012] As described above, by simulating MAPC, MAPD, and MAPTI commands in the simulated Collection, device, and ITT tables, the corresponding Redistributor and physical CPU of the virtual vLPI interrupt are obtained based on these virtual tables. This allows for updating the cached information corresponding to the virtual vLPI interrupt, enabling the injection and processing of physical LPI interrupts.

[0013] In one possible implementation of the first aspect, the simulated ITS command further includes a simulated physical INV command, and further includes: when the virtual machine sends a simulated INV command that includes the device ID and the event ID, obtaining the corresponding Collection ID and virtual vLPI interrupt according to the simulated device table and the simulated ITT table, and the hypervisor uses the configuration information of the virtual vLPI interrupt to update the corresponding cache information in the Redistributor corresponding to the Collection ID.

[0014] As described above, the corresponding Redistributor of the virtual vLPI interrupt is obtained by simulating the INV command, so as to update the information in the cache corresponding to the virtual vLPI interrupt on the corresponding Redistributor, in order to inject the physical LPI interrupt.

[0015] In one possible implementation of the first aspect, the simulated ITS command further includes a simulated physical INVALL command, and further includes: when the virtual machine sends a simulated INVALL command and it includes a Collection ID, it obtains the corresponding vCPU according to the simulated Collection table, and the hypervisor updates the corresponding cache information in the physical CPU corresponding to the vCPU using the configuration information of all virtual vLPI interrupts on the vCPU.

[0016] As described above, the corresponding physical CPU of the virtual vLPI interrupt is obtained by simulating the INVALL command, so as to update the information in the cache corresponding to the virtual vLPI interrupt on the corresponding physical CPU for physical LPI processing.

[0017] In one possible implementation of the first aspect, the simulated ITS command further includes a simulated SYNC command, wherein the virtual machine sends a simulated SYNC command after processing all previously sent simulated ITS commands, and the hypervisor uses the ITS physical SYNC command to make all physical ITS commands effective.

[0018] As described above, the simulated SYNC command, through the ITS physical SYNC command, makes all previous physical ITS commands effective, thus enabling all previous simulated ITS commands to take effect.

[0019] In one possible implementation of the first aspect, when the virtual machine sends a simulated ITS command, it updates the simulated ITS register GITS_CWRITER and enters the hypervisor to process the physical ITS command corresponding to the simulated ITS command. After processing the physical ITS command, it updates the simulated ITS register GITS_CREADR.

[0020] As described above, by simulating ITS commands, the updates of the simulated ITS registers GITS_CWRITER and GITS_CREADR are triggered to process the physical ITS commands corresponding to the simulated ITS commands.

[0021] In one possible implementation of the first aspect, the virtual machine sets the base address of the physical Collection table by writing to the simulated ITS register GITS_BASER0, wherein when the virtual machine writes to the simulated ITS register GITS_BASER0, it traps into the hypervisor, and the hypervisor stores the value written by the virtual machine in the simulated ITS register GITS_BASER0; the virtual machine sets the base address of the physical device table by writing to the simulated ITS register GITS_BASER1, wherein when the virtual machine writes to the simulated ITS register GITS_BASER1, it traps into the hypervisor, and the hypervisor stores the value written by the virtual machine in the simulated ITS register GITS_BASER1.

[0022] As described above, the virtual machine enables the hypervisor to set the correct base addresses for the physical Collection table and physical device table by writing to the simulated ITS registers GITS_BASER0 and GITS_BASER1.

[0023] Secondly, embodiments of the present invention provide an LPI interrupt virtualization apparatus, comprising: a device allocation module, used to allocate physical devices to the virtual machine when the virtual machine is created; a mapping table creation module, used to establish an entry corresponding to the device in the physical ITS mapping table by simulating ITS commands based on the virtual machine, device ID, and event ID when the virtual machine is first run; an interrupt mapping module, used to obtain the virtual machine to which the device ID belongs by using the physical ITS mapping table based on the device ID and event ID in the message when the hypervisor receives a physical LPI interrupt message; and an interrupt injection module, in which the hypervisor injects a virtual vLPI interrupt corresponding to the physical LPI interrupt into the virtual machine, and the virtual machine performs virtual vLPI interrupt processing.

[0024] Therefore, in a computer system based on type 1 virtualization, by statically allocating devices to virtual machines and establishing corresponding entries in the physical ITS mapping table, physical LPI interrupts are mapped to the corresponding virtual machines, enabling multiple virtual machines to use virtual vLPI interrupts.

[0025] In one possible implementation of the second aspect, the simulated ITS command includes: simulated MAPC command, simulated MAPD command, and simulated MAPTI command, which are used to simulate physical MAPC command, physical MAPD command, and physical MAPTI command, respectively.

[0026] As described above, by simulating ITS commands to simulate physical ITS commands, each virtual machine can issue simulated ITS commands to simulate physical ITS commands.

[0027] In one possible implementation of the second aspect, the mapping table creation module is specifically used to include: when the virtual machine sends a simulated MAPC command, the hypervisor adds an entry corresponding to the virtual machine in the physical Collection table of the ITS; when the virtual machine sends a simulated MAPD command that includes the device ID, the hypervisor uses the physical MAPD command of the ITS to add an entry corresponding to the device ID in the physical device table of the ITS; when the virtual machine sends a simulated MAPTI command that includes the device ID, the hypervisor uses the physical MAPTI command of the ITS to add an entry corresponding to the physical LPI interrupt of the device in the corresponding physical ITT table.

[0028] As described above, by simulating MAPC, MAPD, and MAPTI commands, entries corresponding to the virtual machine, device ID, and event ID of the physical LPI interrupt are established in the physical Collection, physical device, and physical ITT tables. This maps the physical LPI interrupt to the virtual machine of its corresponding device, allowing the physical LPI interrupt to be injected into the corresponding virtual machine and avoiding the problem of not being able to inject the physical LPI interrupt according to the interrupt number.

[0029] In one possible implementation of the second aspect, the mapping table creation module is further specifically used when the virtual machine is run for the first time, including: the virtual machine establishing its simulated Collection table by simulating the MAPC command, which realizes the mapping between the Collection ID of each physical LPI interrupt of the virtual machine and the vCPU corresponding to the virtual machine; the virtual machine establishing its simulated device table by simulating the MAPD command, which realizes the mapping between each device ID of the virtual machine and the base address of the simulated ITT table; the virtual machine establishing its simulated ITT table by simulating the MAPTI command, which realizes the mapping between each event ID of the virtual machine and the Collection ID and the virtual vLPI interrupt.

[0030] As described above, by simulating MAPC, MAPD, and MAPTI commands in the simulated Collection, device, and ITT tables, the corresponding Redistributor and physical CPU of the virtual vLPI interrupt are obtained based on these virtual tables. This allows for updating the cached information corresponding to the virtual vLPI interrupt, enabling the injection and processing of physical LPI interrupts.

[0031] In one possible implementation of the second aspect, the simulated ITS command further includes a simulated physical INV command, and also includes: a hybrid update module, used to obtain the corresponding Collection ID and virtual vLPI interrupt according to the simulated device table and the simulated ITS table when the virtual machine sends a simulated INV command that includes the device ID and the event ID, and the hypervisor uses the configuration information of the virtual vLPI interrupt to update the corresponding cache information in the Redistributor corresponding to the Collection ID.

[0032] As described above, the corresponding Redistributor of the virtual vLPI interrupt is obtained by simulating the INV command, so as to update the information in the cache corresponding to the virtual vLPI interrupt on the corresponding Redistributor, in order to inject the physical LPI interrupt.

[0033] In one possible implementation of the second aspect, the simulated ITS command further includes a simulated physical INVALL command, and the hybrid update module is further configured to obtain the corresponding vCPU according to the simulated Collection table when the virtual machine sends a simulated INVALL command and it includes a Collection ID, and the hypervisor updates the corresponding cache information in the physical CPU corresponding to the vCPU using the configuration information of all virtual vLPI interrupts on the vCPU.

[0034] As described above, the corresponding physical CPU of the virtual vLPI interrupt is obtained by simulating the INVALL command, so as to update the information in the cache corresponding to the virtual vLPI interrupt on the corresponding physical CPU for physical LPI processing.

[0035] In one possible implementation of the second aspect, the simulated ITS command further includes a simulated SYNC command, and also includes a command synchronization module, used by the virtual machine to send a simulated SYNC command after all previously sent simulated ITS commands have been processed, and the hypervisor uses the ITS physical SYNC command to make all physical ITS commands effective.

[0036] As described above, the simulated SYNC command makes all previous physical ITS commands effective through the ITS physical SYNC command, thereby making all previous simulated ITS commands effective.

[0037] In one possible implementation of the second aspect, it further includes: a register setting module, used to update the simulated ITS register GITS_CWRITER when the virtual machine sends a simulated ITS command, and to trap into the hypervisor to process the physical ITS command corresponding to the simulated ITS command, and update the simulated ITS register GITS_CREADR after processing the physical ITS command.

[0038] As described above, by simulating ITS commands, the updates of the simulated ITS registers GITS_CWRITER and GITS_CREADR are triggered to process the physical ITS commands corresponding to the simulated ITS commands.

[0039] In one possible implementation of the first aspect, the register setting module is further configured to allow the virtual machine to set the base address of the physical Collection table by writing to the simulated ITS register GITS_BASER0, wherein when the virtual machine writes to the simulated ITS register GITS_BASER0, it traps into the hypervisor, and the hypervisor stores the value written by the virtual machine in the simulated ITS register GITS_BASER0; and the virtual machine to set the base address of the physical device table by writing to the simulated ITS register GITS_BASER1, wherein when the virtual machine writes to the simulated ITS register GITS_BASER1, it traps into the hypervisor, and the hypervisor stores the value written by the virtual machine in the simulated ITS register GITS_BASER1.

[0040] As described above, the virtual machine enables the hypervisor to set the correct base addresses for the physical Collection table and physical device table by writing to the simulated ITS registers GITS_BASER0 and GITS_BASER1.

[0041] Thirdly, embodiments of the present invention provide an operating system configured to run the method described in any embodiment of the first aspect.

[0042] Fourthly, embodiments of the present invention provide a computing device, comprising: a bus; a communication interface connected to the bus; at least one processor connected to the bus; and at least one memory connected to the bus and storing program instructions, which, when executed by the at least one processor, cause the at least one processor to perform any of the embodiments described in the first aspect of the present invention.

[0043] Fifthly, embodiments of the present invention provide a computer-readable storage medium having program instructions stored thereon, which, when executed by a computer, cause the computer to perform any of the embodiments described in the first aspect of the present invention. Attached Figure Description

[0044] Figure 1 This is a flowchart illustrating an embodiment of the LPI interrupt virtualization method of the present invention;

[0045] Figure 2 This is a flowchart illustrating a second embodiment of the LPI interrupt virtualization method of the present invention;

[0046] Figure 3 This is a schematic diagram of the structure of an embodiment of the LPI interrupt virtualization device of the present invention;

[0047] Figure 4 This is a schematic diagram of a second embodiment of the LPI interrupt virtualization device of the present invention;

[0048] Figure 5 This is a schematic diagram of the structure of the computing device of the present invention. Detailed Implementation

[0049] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0050] In the following description, the terms “first, second, third, etc.” or module A, module B, module C, etc. are used only to distinguish similar objects or different embodiments and do not represent a specific ordering of objects. It is understood that a specific order or sequence may be interchanged where permitted so that the embodiments of the invention described herein can be implemented in an order other than that illustrated or described herein.

[0051] In the following description, the labels of the steps, such as S110, S120, etc., do not necessarily mean that the steps will be executed in this way. The order of the steps can be interchanged or executed simultaneously if permitted.

[0052] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein is for the purpose of describing embodiments of the invention only and is not intended to limit the invention.

[0053] This invention provides an LPI interrupt virtualization method, apparatus, operating system, and storage medium. The method includes: when creating a virtual machine, a hypervisor assigns physical devices to the virtual machine; when the created virtual machine is run for the first time, an entry corresponding to the device ID and event ID of the virtual machine and the device is established in the physical ITS mapping table by simulating ITS commands; when the hypervisor receives a physical LPI interrupt message, it obtains the virtual machine to which the device ID belongs using the physical ITS mapping table based on the device ID and event ID in the message; the hypervisor injects a virtual vLPI interrupt corresponding to the physical LPI interrupt into the virtual machine, and the virtual machine performs virtual vLPI interrupt processing.

[0054] In a computer system based on type 1 virtualization, the technical solution of this invention maps physical LPI interrupts to corresponding virtual machines by statically allocating devices to virtual machines and establishing corresponding entries in the physical ITS mapping table, thereby enabling multiple virtual machines to use virtual vLPI interrupts.

[0055] The embodiments of the present invention will now be described in conjunction with the accompanying drawings. First, in conjunction with... Figure 1 This paper introduces an embodiment of an LPI interrupt virtualization method.

[0056] Figure 1 The flowchart of an embodiment of an LPI interrupt virtualization method is shown, which includes steps S110 to S140.

[0057] S110: When creating a virtual machine, the hypervisor assigns the corresponding physical devices to the virtual machine.

[0058] Each virtual machine is statically assigned a corresponding device ID. This corresponding device is the device that sends a physical LPI interrupt message to the ITS via the ITS bus, and this corresponding device includes at least a PCI device.

[0059] S120: When the virtual machine is run for the first time, the table entry corresponding to the device described by the device ID and event ID of the virtual machine, is created in the physical ITS mapping table by simulating ITS commands.

[0060] Among them, the simulated ITS command is the command executed by the virtual machine that simulates the ITS physical command. The physical ITS mapping table includes the physical device table, the physical ITT table, and the physical Collection table.

[0061] Specifically, entries corresponding to the device ID and event ID that generate physical LPI interrupts are created in the physical device table, physical ITT table, and physical Collection table to map physical LPI interrupts to the virtual machine to which the corresponding device belongs.

[0062] In some embodiments, the simulated ITS commands include: simulated MAPC commands, MAPD commands, and simulated MAPTI commands, which are used to simulate the physical MAPC, physical MAPD, and physical MAPTI commands of the ITS, respectively.

[0063] In some embodiments, when a virtual machine sends a simulated MAPC command for the first time it runs, the hypervisor adds an entry corresponding to the virtual machine to the physical Collection table of the ITS, and maps the CollectinID of the entry to a Redistributor, which is mapped to the CPU of the virtual machine.

[0064] In some embodiments, when each virtual machine runs for the first time and sends a MAPD command that includes a device ID of the virtual machine, the hypervisor uses the ITS driver to add an entry corresponding to a device ID to the physical device table of the ITS using the ITS physical MAPD command. The entry includes the base address of the physical ITT table corresponding to the device ID.

[0065] In some embodiments, when each virtual machine runs for the first time and sends a simulated MAPTI command that includes a device ID of the virtual machine, the hypervisor requests an identification number for the physical LPI interrupt of the device and uses the identification number as a parameter to add an entry corresponding to the physical LPI interrupt to the physical ITT table corresponding to the device ID through the ITS driver using the ITS's physical MAPTI command. This allows the ITS to map the physical LPI interrupt to the corresponding Redistributor based on the device ID and event ID in a physical LPI interrupt through the physical device table, physical ITT table, and physical Collection table, so as to obtain the vCPU corresponding to the physical LPI interrupt, i.e., the virtual machine that handles the physical LPI interrupt.

[0066] It is important to emphasize that when a virtual machine runs for the first time, it uses the MAPC command, MAPD command, and simulated MAPTI command to enable the Hypervisor to create the physical Collection table, physical device table, and physical ITT table. When other virtual machines run for the first time subsequently, the table entries corresponding to the physical LPI interrupts of their devices are added to the physical Collection table, physical device table, and physical ITT table.

[0067] In some embodiments, when each virtual machine runs for the first time, the virtual machine establishes a simulated Collection table by simulating MAPC commands, which maps the Collection ID of each physical LPI interrupt of the virtual machine to the vCPU of the virtual machine that handles the physical LPI interrupt.

[0068] In some embodiments, when each virtual machine runs for the first time, the virtual machine establishes a virtual device table by simulating the MAPD command, which implements the mapping of each device ID of the virtual machine to the base address of the corresponding virtual ITT table.

[0069] In some embodiments, when each virtual machine runs for the first time, the virtual machine establishes a simulated ITT table by simulating MAPTI commands, which maps the virtual machine's event IDs to the corresponding CollectionIDs and virtual vLPI interrupts.

[0070] In some embodiments, virtual vLPI configuration information is obtained by simulating the device table, simulating the ITT table, and simulating the Collection table to update the cache information of virtual vLPI interrupts in the corresponding Redistributor and the corresponding physical CPU. Alternatively, physical LPI interrupts can be migrated based on the simulating device table, simulating the ITT table, and simulating the Collection table.

[0071] In some embodiments, the simulated ITS command includes a simulated INV command, used to simulate the physical INV command of the ITS; when each virtual machine runs for the first time, the virtual machine uses the simulated INV command to obtain the Collection ID and virtual vLPI interrupt corresponding to the physical LPI interrupt corresponding to the device ID and the event ID in the simulated device table and simulated ITT table of the virtual machine, and obtains the corresponding Redistributor according to the Collection ID. It also uses the configuration information of the virtual vLPI interrupt to update the corresponding cache information in the corresponding Redistributor, so that the Redistributor maps the virtual vLPI interrupt to the corresponding vCPU according to the cache information.

[0072] In some embodiments, the simulated ITS command includes a simulated INVALL command, used to simulate the physical INVALL command of the ITS; when each virtual machine runs for the first time, the virtual machine uses the simulated INVALL command to obtain the vCPU corresponding to the Collection ID in the simulated Collection table according to the Collection ID included in the simulated INVALL command, and obtains the physical CPU corresponding to the vCPU accordingly. It also uses the configuration information of all virtual vLPI interrupts on the vCPU to update the corresponding cache information in the corresponding physical CPU, so that the physical CPU can process the virtual vLPI interrupt according to the cache information.

[0073] In some embodiments, the simulated ITS command includes a simulated SYNC command used to simulate the physical SYNC command. The virtual machine sends the simulated SYNC command after processing all previously sent simulated ITS commands. The hypervisor uses the ITS physical SYNC command to make all physical ITS commands effective.

[0074] In some embodiments, when the virtual machine sends a simulated ITS command, it updates the simulated ITS register GITS_CWRITER and traps into the hypervisor to process the physical ITS command corresponding to the simulated ITS command. After processing the physical ITS command, it updates the simulated ITS register GITS_CREADR. The simulated ITS register GITS_CWRITER is used to simulate the ITS register GITS_CWRITER, and the simulated ITS register GITS_CREADR is used to simulate the ITS register GITS_CREADR.

[0075] In some embodiments, the virtual machine sets the base address of the physical Collection table by writing to the simulated ITS register GITS_BASER0. When the virtual machine writes to the simulated ITS register GITS_BASER0, it traps into the hypervisor, which stores the value written by the virtual machine in the simulated ITS register GITS_BASER0. The simulated ITS register GITS_BASER0 is used to simulate the ITS register GITS_BASER0.

[0076] In some embodiments, the virtual machine sets the base address of the physical device table by writing to the simulated ITS register GITS_BASER1. When the virtual machine writes to the simulated ITS register GITS_BASER1, it traps into the hypervisor, which stores the value written by the virtual machine in the simulated ITS register GITS_BASER1. The simulated ITS register GITS_BASER1 is used to simulate the GITS register GITS_BASER1.

[0077] S130: When the hypervisor receives a message about a physical LPI interruption, it uses the device ID and event ID in the message to obtain the virtual machine to which the device ID belongs using the physical ITS mapping table.

[0078] In this process, a device generates a physical LPI interrupt and sends an ITS message to the ITS via the ITS bus. The hypervisor processes the message, and the ITS uses the device ID and the event ID in the ITS message to obtain the Redistributor corresponding to the physical LPI interrupt from the physical Device table, physical ITT table, and physical Collection table. The corresponding Redistributor then uses the configuration information of the virtual vLPI interrupt in its cache to obtain the corresponding vCPU for the physical LPI interrupt. The corresponding vCPU corresponds to the virtual machine to which the device belongs.

[0079] The querying of the Physical Device table, Physical ITT table, and Physical Collection table can be achieved using the chip's Physical ITS mapping, or through other methods.

[0080] S140: The Hypervisor injects the virtual vLPI interrupt corresponding to the received physical LPI interrupt into the queried virtual machine, and the virtual machine handles the virtual vLPI interrupt.

[0081] The hypervisor obtains the virtual machine to which the device generating the physical LPI interrupt belongs, and then injects the corresponding virtual vLPI interrupt into that virtual machine. This allows virtual vLPI interrupts corresponding to physical LPI interrupts from different devices to be injected into the appropriate virtual machines, thus enabling each virtual machine to handle physical LPI interrupts. When a virtual machine handles the corresponding virtual vLPI interrupt, it processes it according to the configuration information of the virtual vLPI interrupt in its cache.

[0082] In summary, Embodiment 1 of an LPI interrupt virtualization method is used in a computer system based on type 1 virtualization to map physical LPI interrupts to corresponding virtual machines by statically allocating devices to virtual machines and establishing corresponding entries in the physical ITS mapping table, thereby enabling multiple virtual machines to use virtual vLPI interrupts.

[0083] An embodiment of the LPI interrupt virtualization method, which is a detailed implementation of an embodiment of the LPI interrupt virtualization method, is provided below and has all the advantages of the first embodiment of the LPI interrupt virtualization method.

[0084] Figure 2 The flowchart of an embodiment of an LPI interrupt virtualization method is shown, including steps S210 to S270.

[0085] For ease of description, let's take device D1, which is assigned to virtual machine vm1, as an example.

[0086] S210: When creating virtual machine vm1, assign the device_id of device D1 to virtual machine vm1.

[0087] Among them, device D1 is a PCI device, and its device ID (called device_id) is uniquely determined based on the bus, dev, and func of device D1. device_id will be used as a parameter for simulating ITS commands. When virtual machine vm1 runs and sends ITS simulation commands, if the device_id in the command belongs to virtual machine vm1, different additional operations will be performed based on device_id.

[0088] Specifically, when creating virtual machine vm1, a corresponding table entry is also created for virtual machine vm1 in the physical Collection table. The value of this table entry must include at least the Redistributor of virtual machine vm1.

[0089] S220: When the virtual machine vm1 runs for the first time, the simulated ITS register is set in the Hypervisor.

[0090] In this process, virtual machine vm1 accesses the simulated ITS register GITS_BASER by writing to it, setting the base addresses of the devicetable and Collectiontable. At this point, virtual machine vm1 is trapped in the hypervisor, which sets GITS_BASER0 and GITS_BASER1, which point to the base addresses of the physical devicetable and Collectiontable, respectively. The simulated ITS registers GITS_BASER0 and GITS_BASER1 are used to simulate the ITS registers GITS_BASER0 and GITS_BASER1.

[0091] When virtual machine vm1 operates on GITS_CBASER and performs a write access to this register, virtual machine vm1 traps into the hypervisor. The hypervisor sets GITS_CBASER to point to the base address of the ITS command queue. The simulated ITS register GITS_CBASER is used to simulate the ITS register GITS_CBASER.

[0092] In this setup, virtual machine vm1 also enables ITS virtualization by setting GITS_CTLR. Virtual machine vm1 then enters the hypervisor, which in turn sets GITS_CTLR to enable ITS virtualization. The simulated ITS register GITS_CTLR is used to simulate the ITS register GITS_CTLR.

[0093] The simulated ITS registers include GITS_CWRITER and GITS_CREADR. Virtual machine vm1's write access to the GITS_CWRITER register indicates that it is sending an ITS command. This register value indicates the offset of the next ITS command in the command queue, which the hypervisor needs to save and process. Virtual machine vm1's read access to the GITS_CREADR register indicates that it wants to know the progress of the hypervisor's processing of ITS commands. This register value indicates the offset of the next ITS command to be processed by the hypervisor in the command queue. The simulated ITS register GITS_CWRITER is used to simulate the GITS_CWRITER register, and the simulated ITS register GITS_CREADR is used to simulate the GITS_CREADR register.

[0094] S230: When the virtual machine vm1 runs for the first time, it sends simulated MAPC command, simulated MAPD command and simulated MAPTI command to establish the relevant simulated ITS mapping table and physical ITS mapping table.

[0095] Each virtual machine fully simulates the ITS mapping tables, including simulated Collection tables, simulated device tables, and simulated ITT tables, which respectively simulate the physical Collection tables, simulated device tables, and simulated ITT tables of the ITS. These simulated tables are all stored in the virtual machine's own memory space, and querying and setting these simulated tables requires accessing the virtual machine's memory space.

[0096] In this context, each entry in the simulated Collection table is indexed by CollectionID, and its content includes the corresponding vCPU; each entry in the simulated device table is indexed by device_id, and its content includes the corresponding ITT table base address and the number of event ID (event_id) bits; each entry in the simulated ITT table is indexed by event_id, and its content includes the corresponding virtual vLPI interrupt and CollectionID.

[0097] When each virtual machine issues a simulated MAPC command, the hypervisor parses the MAPC command parameters, which include the parameters CollectionID and vCPU. It then creates a corresponding entry in the physical Collection table, which maps the Collection ID to a Redistributor, which is to say, a vCPU. Finally, it sets the MAPC command parameters in the simulated Collection table.

[0098] In this process, each virtual machine issues a simulated MAPC command and simultaneously establishes its simulated Collection table, which maps the Collection IDs of each physical LPI interrupt of the virtual machine to the vCPU corresponding to the virtual machine.

[0099] When each virtual machine issues a simulated MAPD command, the hypervisor parses the MAPC command parameters, which include the device_id, ITT table base address, and event_id bit count, and sets them in the simulated device table. If the device_id in the MAPD command parameters has already been assigned to the current virtual machine, the physical ITS driver needs to be called to send a physical MAPD command to create the corresponding table entry in the physical device table and map the device_id to the corresponding ITT table base address.

[0100] In this process, each virtual machine issues a simulated MAPD command and simultaneously establishes its simulated device table, which maps the device IDs of the virtual machine to the base addresses of the simulated ITT table.

[0101] When each virtual machine issues a simulated MAPTI command, the hypervisor parses the MAPTI command parameters, which include device_id, event_id, vLPI, and CollectionID. It obtains the simulated ITT table address based on device_id, and creates corresponding report entries in the simulated ITT based on event_id, vLPI, and CollectionID. It also configures the virtual vLPI data structure with information such as virtual vLPI priority and interrupt enable status. If device_id in the MAPTI command parameters has already been assigned to the current virtual machine, an additional physical LPI interrupt number needs to be requested. Using this physical LPI interrupt number as a parameter, the physical ITS driver is called to send a physical MAPTI command to create a corresponding entry in the physical ITT table, mapping an ITTID in the physical ITT table to a Collection ID.

[0102] In this process, each virtual machine issues a simulated MAPI command and simultaneously establishes its simulated ITT table, which maps the virtual machine's event IDs to CollectionIDs and virtual vLPI interrupts.

[0103] S240: When virtual machine vm1 runs for the first time, it sends simulated INV and simulated INVALL commands as needed to set the corresponding Redistributor and the corresponding vLPI cache information in the CPU.

[0104] When each virtual machine sends a simulated INV command, the hypervisor queries the simulated device table and the virtual ITT table based on the device_id and event_id in the command to obtain the corresponding vLPI interrupt number, and updates the corresponding vLPI data structure, including priority, interrupt enable status, etc. At this time, if the device_id in the simulated INV command parameter has already been assigned to the current virtual machine, the physical ITT driver needs to be called to send a physical INV command to synchronize the physical cache of the corresponding vLPI on the corresponding Redistributor.

[0105] When each virtual machine sends a simulated INVALL command, the hypervisor needs to query the virtual Collectiontable based on the CollectionID in the command to obtain the corresponding vCPU number, update all vLPI data structures on the corresponding vCPU of the updated virtual machine, obtain the corresponding physical CPU based on the vCPU number, call the physical ITS driver to send a physical INVALL command to synchronize the cache of all vLPI on the corresponding physical CPU.

[0106] S250: When virtual machine vm1 runs for the first time, after executing each virtual ITS command, it sends a simulated SYNC command to make the previous virtual ITS commands valid.

[0107] When a virtual machine sends an ITS command, it updates `GITS_CWRITER`, triggering the hypervisor to process the command. After processing each command, `GITS_CREADR` is updated. As long as `GITS_CWRITER` is not equal to `GITS_CREADR`, the hypervisor will continue processing ITS commands. This means there will be no unprocessed ITS commands in the hypervisor. When the virtual machine sends a simulated SYNC command, all virtual ITS commands have already been processed. Only the physical ITS driver needs to be called to send a physical SYNC command to activate the physical ITS commands, thus making the virtual ITS commands effective.

[0108] S260: Device D1 generates a physical LPI interrupt, which is handled by the hypervisor. The virtual machine vm1 that handles the physical LPI interrupt is determined through the physical ITS mapping table.

[0109] One device generates a physical LPI interrupt, which is sent to the ITS via the ITS bus. The ITS in the hypervisor processes the interrupt. The ITS obtains the base address of the corresponding physical ITT table based on the device ID and the physical Device table. It then obtains the corresponding Collection ID based on the physical ITT table and the event ID. Finally, it obtains the corresponding Redistributor based on the Collection ID and the physical Collection table. The Redistributor then obtains the corresponding vCPU for the physical LPI interrupt based on the configuration information of the virtual vLPI interrupt in its cache. The corresponding vCPU corresponds to the virtual machine to which the device belongs.

[0110] S270: The hypervisor injects the vLPI interrupt corresponding to the physical LPI interrupt into the virtual machine vm1, enabling the virtual machine vm1 to handle the virtual vLPI interrupt.

[0111] The hypervisor obtains the virtual machine to which the device generating the physical LPI interrupt belongs, and then injects the corresponding virtual vLPI interrupt into that virtual machine. This allows virtual vLPI interrupts corresponding to physical LPI interrupts from different devices to be injected into the corresponding virtual machines, thus enabling each virtual machine to handle physical LPI interrupts. The physical CPU corresponding to each virtual machine handles the physical LPI interrupt according to the configuration information of the virtual vLPI interrupt in its cache.

[0112] In summary, Embodiment 2 of the LPI interrupt virtualization method provides a way to achieve static LPI interrupt virtualization by statically allocating device_id, simulating ITS registers, simulating ITS commands, and simulating ITS tables. This maps static LPI interrupts to their respective virtual machines, enabling multiple virtual machines to use LPI interrupts.

[0113] The following describes an embodiment of an LPI interrupt virtualization device with reference to the accompanying drawings.

[0114] An embodiment of an LPI interrupt virtualization device executes an LPI interrupt virtualization method, which has all its advantages.

[0115] Figure 3 The structure of an LPI interrupt virtualization device embodiment 1 is shown, including: a device allocation module 310, a mapping table creation module 320, an interrupt mapping module 330, and an interrupt injection module 340.

[0116] The device allocation module 310 is used by the hypervisor to allocate corresponding devices to each virtual machine when creating each virtual machine. For its working principle and advantages, please refer to step S130 of an embodiment of an LPI interrupt virtualization method.

[0117] The mapping table creation module 320 is used to create an entry in the physical ITS mapping table corresponding to the device allocated to the virtual machine when the newly created virtual machine is run for the first time, by simulating ITS commands based on the virtual machine, device ID, and event ID. For its working principle and advantages, please refer to step S120 of Embodiment 1 of an LPI interrupt virtualization method.

[0118] The interrupt mapping module 330 is used to obtain the virtual machine to which the device belongs by means of the device ID and event ID in the message when the hypervisor receives a physical LPI interrupt message from a device, using the physical ITS mapping table. For its working principle and advantages, please refer to step S130 of an embodiment of an LPI interrupt virtualization method.

[0119] The interrupt injection module 340 is used by the Hypervisor to inject virtual vLPI interrupts corresponding to physical LPI interrupts into the queried virtual machines, enabling the virtual machine to handle the corresponding virtual vLPI interrupts. For its working principle and advantages, please refer to step S140 of an embodiment of an LPI interrupt virtualization method.

[0120] An embodiment of an LPI interrupt virtualization device executes an LPI interrupt virtualization method, which has all its advantages.

[0121] Figure 4The structure of an LPI interrupt virtualization device according to a second embodiment is shown, including: a device allocation module 410, a register setting module 420, a mapping table establishment module 430, a cache update module 440, a command synchronization module 450, an interrupt mapping module 460, and an interrupt injection module 470.

[0122] The device allocation module 410 is used to assign the device_id of device D1 to virtual machine vm1 when creating virtual machine vm1. For its working principle and advantages, please refer to step S210 of Embodiment 2 of an LPI interrupt virtualization method.

[0123] The register setting module 420 is used to set the simulated ITS register in the hypervisor when the virtual machine vm1 runs for the first time. For its working principle and advantages, please refer to step S220 of Embodiment 2 of an LPI interrupt virtualization method.

[0124] The mapping table establishment module 430 is used to send simulated MAPC, MAPD, and MAPTI commands during the first runtime of virtual machine vm1 to establish relevant simulated ITS mapping tables and physical ITS mapping tables. For its working principle and advantages, please refer to step S230 of Embodiment 2 of an LPI interrupt virtualization method.

[0125] The cache update module 440 is used when virtual machine vm1 runs for the first time to send simulated INV and INVALL commands as needed to set the corresponding Redistributor and vLPI cache information in the corresponding CPU. For its working principle and advantages, please refer to step S240 of Embodiment 2 of an LPI interrupt virtualization method.

[0126] The command synchronization module 450 is used when virtual machine vm1 runs for the first time. After executing each virtual ITS command, it sends a simulated SYNC command to make the previous virtual ITS commands valid. For its working principle and advantages, please refer to step S250 of Embodiment 2 of an LPI interrupt virtualization method.

[0127] The interrupt mapping module 460 is used by device D1 to generate physical LPI interrupts, which are then processed by the hypervisor. The virtual machine vm1 that handles the physical LPI interrupt is determined through the physical ITS mapping table. For its working principle and advantages, please refer to step S260 of Embodiment 2 of an LPI interrupt virtualization method.

[0128] The interrupt injection module 470 is used by the hypervisor to inject the vLPI interrupt corresponding to the physical LPI interrupt into the virtual machine vm1, enabling the virtual machine vm1 to handle the virtual vLPI interrupt. For its working principle and advantages, please refer to step S270 of Embodiment 2 of an LPI interrupt virtualization method.

[0129] This invention also provides an operating system configured to run the method described in Embodiment 1 or Embodiment 2 of a virtual machine resource management method, which is configured to include the apparatus described in Embodiment 1 or Embodiment 2 of a virtual machine resource management method.

[0130] This invention also provides a computing device, which is described below. Figure 5 Detailed introduction.

[0131] The computing device 500 includes a processor 510, a memory 520, a communication interface 530, and a bus 540.

[0132] It should be understood that the communication interface 530 in the computing device 500 shown in the figure can be used to communicate with other devices.

[0133] The processor 510 can be connected to the memory 520. The memory 520 can be used to store the program code and data. Therefore, the memory 520 can be a storage unit inside the processor 510, an external storage unit independent of the processor 510, or a component that includes both the storage unit inside the processor 510 and the external storage unit independent of the processor 510.

[0134] Optionally, the computing device 500 may also include a bus 540. The memory 520 and communication interface 530 can be connected to the processor 510 via the bus 540. The bus 540 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 540 can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one line is used in this figure, but this does not mean that there is only one bus or one type of bus.

[0135] It should be understood that in this embodiment of the invention, the processor 510 may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor. Alternatively, the processor 510 may employ one or more integrated circuits to execute relevant programs to implement the technical solutions provided in this embodiment of the invention.

[0136] The memory 520 may include read-only memory and random access memory, and provides instructions and data to the processor 510. A portion of the processor 510 may also include non-volatile random access memory. For example, the processor 510 may also store device type information.

[0137] When the computing device 500 is running, the processor 510 executes computer execution instructions stored in the memory 520 to perform the operation steps of each method embodiment.

[0138] It should be understood that the computing device 500 according to the embodiments of the present invention can correspond to the corresponding subject in executing the methods according to the various embodiments of the present invention, and the above and other operations and / or functions of each module in the computing device 500 are respectively for implementing the corresponding processes of the methods in the embodiments of the present method. For the sake of brevity, they will not be described in detail here.

[0139] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0140] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0141] In the embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0142] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this method embodiment according to actual needs.

[0143] In addition, the functional units in the various embodiments of the present invention 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.

[0144] If the aforementioned 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 the present 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 decoding method described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0145] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is used to perform the operation steps of the various method embodiments.

[0146] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0147] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.

[0148] The program code contained on a computer-readable medium may be transmitted using any suitable medium, including, but not limited to, wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0149] Computer program code for performing the operations of this invention can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0150] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, all of which fall within the scope of protection of the present invention.

Claims

1. An LPI interrupt virtualization method, characterized in that, include: When a virtual machine is created, the hypervisor assigns physical devices to that virtual machine; When the virtual machine is run for the first time, the entries corresponding to the device ID and event ID of the virtual machine and the device are created in the physical ITS mapping table by simulating ITS commands. The simulated ITS commands include: simulated MAPC commands, simulated MAPD commands, and simulated MAPTI commands, which are used to simulate physical MAPC commands, physical MAPD commands, and physical MAPTI commands, respectively. When the hypervisor receives a physical LPI interruption message, it uses the device ID and event ID in the message to obtain the virtual machine to which the device ID belongs using the physical ITS mapping table; The hypervisor injects the virtual vLPI interrupt corresponding to the physical LPI interrupt into the virtual machine, which then handles the virtual vLPI interrupt. Specifically, when the virtual machine is first created, entries corresponding to the device ID and event ID of the virtual machine and the device are established in the physical ITS mapping table by simulating ITS commands, including: When the virtual machine sends a simulated MAPC command, the hypervisor adds an entry corresponding to the virtual machine to the ITS physical Collection table; when the virtual machine sends a simulated MAPD command that includes the device ID, the hypervisor uses the ITS physical MAPD command to add an entry corresponding to the device ID to the ITS physical device table; when the virtual machine sends a simulated MAPTI command that includes the device ID, the hypervisor uses the ITS physical MAPTI command to add an entry corresponding to the physical LPI interrupt of the device to the corresponding physical ITT table.

2. The method according to claim 1, characterized in that, When the virtual machine is run for the first time, it also includes: The virtual machine establishes its simulated Collection table by simulating MAPC commands, which maps the Collection ID of each physical LPI interrupt of the virtual machine to the vCPU corresponding to the virtual machine. The virtual machine establishes its simulated device table by simulating MAPD commands, which realizes the mapping between each device ID of the virtual machine and the base address of the simulated ITT table; The virtual machine establishes its simulated ITT table by simulating MAPTI commands, which implements the mapping of each event ID of the virtual machine with CollectionID and virtual vLPI interrupt.

3. The method according to claim 2, characterized in that, The simulated ITS command also includes the simulated INV command, and further includes: When the virtual machine sends a simulated INV command that includes the device ID and the event ID, it obtains the corresponding Collection ID and virtual vLPI interrupt according to the simulated device table and the simulated ITT table. The hypervisor uses the configuration information of the virtual vLPI interrupt to update the corresponding cache information in the Redistributor corresponding to the Collection ID.

4. The method according to claim 2, characterized in that, The simulated ITS command also includes a simulated INVALL command, and further includes: When the virtual machine sends a simulated INVALL command that includes a Collection ID, it obtains the corresponding vCPU based on the simulated Collection table. The hypervisor then uses the configuration information of all virtual vLPI interrupts on that vCPU to update the corresponding cache information in the physical CPU corresponding to that vCPU.

5. The method according to claim 1, characterized in that, Also includes: The simulated ITS command also includes a simulated SYNC command. After the virtual machine has processed all the previously sent simulated ITS commands, it sends a simulated SYNC command. The hypervisor uses the ITS physical SYNC command to make all physical ITS commands effective.

6. The method according to claim 1, characterized in that, Also includes: When the virtual machine sends a simulated ITS command, it updates the simulated ITS register GITS_CWRITER and enters the hypervisor to process the physical ITS command corresponding to the simulated ITS command. After processing the physical ITS command, it updates the simulated ITS register GITS_CREADR.

7. The method according to claim 1, characterized in that, Also includes: The virtual machine sets the base address of the physical Collection table by writing to the simulated ITS register GITS_BASER0. When the virtual machine writes to the simulated ITS register GITS_BASER0, it traps into the hypervisor, and the hypervisor stores the value written by the virtual machine in the simulated ITS register GITS_BASER0. The virtual machine sets the base address of the physical device table by writing to the simulated ITS register GITS_BASER1. When the virtual machine writes to the simulated ITS register GITS_BASER1, it traps into the hypervisor, which stores the value written by the virtual machine in the simulated ITS register GITS_BASER1.

8. An LPI interrupt virtualization device, characterized in that, include: The device allocation module is used by the hypervisor to allocate physical devices to the virtual machine when the virtual machine is created; The mapping table creation module is used to create an entry corresponding to the device in the physical ITS mapping table by simulating ITS commands when the virtual machine is first run; The simulated ITS commands include: simulated MAPC commands, simulated MAPD commands, and simulated MAPTI commands, which are used to simulate physical MAPC commands, physical MAPD commands, and physical MAPTI commands, respectively. The interrupt mapping module is used when the hypervisor receives a physical LPI interrupt message, and uses the physical ITS mapping table to obtain the virtual machine to which the device ID belongs based on the device ID and event ID in the message. The interrupt injection module, in which the hypervisor injects the virtual vLPI interrupt corresponding to the physical LPI interrupt into the virtual machine, and the virtual machine performs virtual vLPI interrupt processing; Specifically, when the mapping table creation module creates the corresponding table entry for the device in the physical ITS mapping table based on the virtual machine, device ID, and event ID using simulated ITS commands, it is used to include: When the virtual machine sends a simulated MAPC command, the hypervisor adds an entry corresponding to the virtual machine to the ITS physical Collection table; when the virtual machine sends a simulated MAPD command that includes the device ID, the hypervisor uses the ITS physical MAPD command to add an entry corresponding to the device ID to the ITS physical device table; when the virtual machine sends a simulated MAPTI command that includes the device ID, the hypervisor uses the ITS physical MAPTI command to add an entry corresponding to the physical LPI interrupt of the device to the corresponding physical ITT table.

9. An operating system, characterized in that, It is configured to perform the method described in any one of claims 1 to 7.

10. A computing device, characterized in that, include: bus; A communication interface, which is connected to the bus; At least one processor is connected to the bus; And at least one memory connected to the bus and storing program instructions that, when executed by the at least one processor, cause the at least one processor to perform the method of any one of claims 1 to 7.

11. A computer-readable storage medium, characterized in that, It stores program instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method for enabling virtual machine to realize msi / x interruption under jailhouse

    CN116954830A