mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-22 17:27:53 +00:00
hv: Add update_vm_vlapic_state API to sync the VM vLAPIC state
This patch introduces vLAPIC state for a VM. The VM vLAPIC state can be one of the following * VM_VLAPIC_X2APIC - All the vCPUs/vLAPICs (Except for those in Disabled mode) of this VM use x2APIC mode * VM_VLAPIC_XAPIC - All the vCPUs/vLAPICs (Except for those in Disabled mode) of this VM use xAPIC mode * VM_VLAPIC_DISABLED - All the vCPUs/vLAPICs of this VM are in Disabled mode * VM_VLAPIC_TRANSITION - Some of the vCPUs/vLAPICs of this VM (Except for those in Disabled mode) are in xAPIC and the others in x2APIC Upon a vCPU updating the IA32_APIC_BASE MSR to switch LAPIC mode, this API is called to sync the vLAPIC state of the VM. Upon VM creation and reset, vLAPIC state is set to VM_VLAPIC_XAPIC, as ACRN starts the vCPUs vLAPIC in XAPIC mode. Tracked-On: #3253 Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
committed by
wenlingz
parent
a3fdc7a496
commit
f3627d4839
@@ -76,6 +76,13 @@ enum vm_state {
|
||||
VM_PAUSED, /* VM paused */
|
||||
};
|
||||
|
||||
enum vm_vlapic_state {
|
||||
VM_VLAPIC_DISABLED = 0U,
|
||||
VM_VLAPIC_XAPIC,
|
||||
VM_VLAPIC_X2APIC,
|
||||
VM_VLAPIC_TRANSITION
|
||||
};
|
||||
|
||||
struct vm_arch {
|
||||
/* I/O bitmaps A and B for this VM, MUST be 4-Kbyte aligned */
|
||||
uint8_t io_bitmap[PAGE_SIZE*2];
|
||||
@@ -93,6 +100,7 @@ struct vm_arch {
|
||||
void *tmp_pg_array; /* Page array for tmp guest paging struct */
|
||||
struct acrn_vioapic vioapic; /* Virtual IOAPIC base address */
|
||||
struct acrn_vpic vpic; /* Virtual PIC */
|
||||
enum vm_vlapic_state vlapic_state; /* Represents vLAPIC state across vCPUs*/
|
||||
|
||||
/* reference to virtual platform to come here (as needed) */
|
||||
} __aligned(PAGE_SIZE);
|
||||
@@ -109,7 +117,7 @@ struct acrn_vm {
|
||||
struct acrn_vuart vuart[MAX_VUART_NUM_PER_VM]; /* Virtual UART */
|
||||
enum vpic_wire_mode wire_mode;
|
||||
struct iommu_domain *iommu; /* iommu domain of this VM */
|
||||
spinlock_t spinlock; /* Spin-lock used to protect VM modifications */
|
||||
spinlock_t vm_lock; /* Spin-lock used to protect VM modifications */
|
||||
|
||||
uint16_t emul_mmio_regions; /* Number of emulated mmio regions */
|
||||
struct mem_io_node emul_mmio[CONFIG_MAX_EMULATED_MMIO_REGIONS];
|
||||
@@ -218,6 +226,7 @@ bool is_lapic_pt_configured(const struct acrn_vm *vm);
|
||||
bool is_rt_vm(const struct acrn_vm *vm);
|
||||
bool is_highest_severity_vm(const struct acrn_vm *vm);
|
||||
bool vm_hide_mtrr(const struct acrn_vm *vm);
|
||||
void update_vm_vlapic_state(struct acrn_vm *vm);
|
||||
|
||||
#endif /* !ASSEMBLER */
|
||||
|
||||
|
Reference in New Issue
Block a user