mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-20 12:42:54 +00:00
hv: x2APICv support on platforms without support for APICv reg virtualization
On platforms, that do not support APICv register virtualization, all the x2APIC MSRs need to intercepted by ACRN for emulation. Tracked-On: #1973 Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
This commit is contained in:
parent
9d4b5d7e1b
commit
9ea93ce620
@ -869,6 +869,11 @@ bool is_ept_supported(void)
|
||||
return (cpu_caps.ept_features != 0U);
|
||||
}
|
||||
|
||||
bool is_apicv_reg_virtualization_supported(void)
|
||||
{
|
||||
return ((cpu_caps.apicv_features & VAPIC_FEATURE_VIRT_REG) != 0U);
|
||||
}
|
||||
|
||||
bool is_apicv_intr_delivery_supported(void)
|
||||
{
|
||||
return ((cpu_caps.apicv_features & VAPIC_FEATURE_INTR_DELIVERY) != 0U);
|
||||
|
@ -469,18 +469,28 @@ void update_msr_bitmap_x2apic_apicv(struct acrn_vcpu *vcpu)
|
||||
uint8_t *msr_bitmap;
|
||||
|
||||
msr_bitmap = vcpu->vm->arch_vm.msr_bitmap;
|
||||
intercept_x2apic_msrs(msr_bitmap, WRITE);
|
||||
enable_msr_interception(msr_bitmap, MSR_IA32_EXT_APIC_CUR_COUNT, READ);
|
||||
/*
|
||||
* Open read-only interception for write-only
|
||||
* registers to inject gp on reads. EOI and Self-IPI
|
||||
* Writes are disabled for EOI, TPR and Self-IPI as
|
||||
* writes to them are virtualized with Register Virtualization
|
||||
* Refer to Section 29.1 in Intel SDM Vol. 3
|
||||
* For platforms that do not support register virtualization
|
||||
* all x2APIC MSRs need to intercepted. So no need to update
|
||||
* the MSR bitmap.
|
||||
*
|
||||
* TPR is virtualized even when register virtualization is not
|
||||
* supported
|
||||
*/
|
||||
enable_msr_interception(msr_bitmap, MSR_IA32_EXT_APIC_TPR, DISABLE);
|
||||
enable_msr_interception(msr_bitmap, MSR_IA32_EXT_APIC_EOI, READ);
|
||||
enable_msr_interception(msr_bitmap, MSR_IA32_EXT_APIC_SELF_IPI, READ);
|
||||
if (is_apicv_reg_virtualization_supported()) {
|
||||
intercept_x2apic_msrs(msr_bitmap, WRITE);
|
||||
enable_msr_interception(msr_bitmap, MSR_IA32_EXT_APIC_CUR_COUNT, READ);
|
||||
/*
|
||||
* Open read-only interception for write-only
|
||||
* registers to inject gp on reads. EOI and Self-IPI
|
||||
* Writes are disabled for EOI, TPR and Self-IPI as
|
||||
* writes to them are virtualized with Register Virtualization
|
||||
* Refer to Section 29.1 in Intel SDM Vol. 3
|
||||
*/
|
||||
enable_msr_interception(msr_bitmap, MSR_IA32_EXT_APIC_TPR, DISABLE);
|
||||
enable_msr_interception(msr_bitmap, MSR_IA32_EXT_APIC_EOI, READ);
|
||||
enable_msr_interception(msr_bitmap, MSR_IA32_EXT_APIC_SELF_IPI, READ);
|
||||
}
|
||||
}
|
||||
|
||||
void update_msr_bitmap_x2apic_passthru(struct acrn_vcpu *vcpu)
|
||||
|
@ -311,6 +311,7 @@ extern struct cpuinfo_x86 boot_cpu_data;
|
||||
void cpu_do_idle(void);
|
||||
void cpu_dead(uint16_t pcpu_id);
|
||||
void trampoline_start16(void);
|
||||
bool is_apicv_reg_virtualization_supported(void);
|
||||
bool is_apicv_intr_delivery_supported(void);
|
||||
bool is_apicv_posted_intr_supported(void);
|
||||
bool is_ept_supported(void);
|
||||
|
Loading…
Reference in New Issue
Block a user