hv:cpu-caps:refine is_apl_platform func and clean up duplicated code

Fix the bug for "is_apl_platform" func.
"monitor_cap_buggy" is identical to "is_apl_platform", so remove it.

On apl platform:
1) ACRN doesn't use monitor/mwait instructions
2) ACRN disable GPU IOMMU

Tracked-On:#3675

Signed-off-by: Junming Liu <junming.liu@intel.com>
This commit is contained in:
Junming Liu 2020-08-13 20:16:36 +08:00 committed by wenlingz
parent 538e7cf74d
commit 3631a85c3c
3 changed files with 4 additions and 15 deletions

View File

@ -57,17 +57,6 @@ bool pcpu_has_cap(uint32_t bit)
return ret;
}
bool monitor_cap_buggy(void)
{
bool buggy = false;
if ((boot_cpu_data.displayfamily == 0x6U) && (boot_cpu_data.displaymodel == 0x5cU)) {
buggy = true;
}
return buggy;
}
bool has_monitor_cap(void)
{
bool ret = false;
@ -77,7 +66,7 @@ bool has_monitor_cap(void)
* in hypervisor, but still expose it to the guests and
* let them handle it correctly
*/
if (!monitor_cap_buggy()) {
if (!is_apl_platform()) {
ret = true;
}
}
@ -118,7 +107,7 @@ bool is_apl_platform(void)
{
bool ret = false;
if ((boot_cpu_data.displayfamily == 0x6U) && (boot_cpu_data.displaymodel == 0x92U)) {
if ((boot_cpu_data.displayfamily == 0x6U) && (boot_cpu_data.displaymodel == 0x5cU)) {
ret = true;
}

View File

@ -698,7 +698,7 @@ static void set_guest_ia32_misc_enalbe(struct acrn_vcpu *vcpu, uint64_t v)
if ((ecx & CPUID_ECX_SSE3) == 0U) {
vcpu_inject_gp(vcpu, 0U);
update_vmsr = false;
} else if ((!has_monitor_cap()) && (!monitor_cap_buggy())) {
} else if ((!has_monitor_cap()) && (!is_apl_platform())) {
msr_value = msr_read(MSR_IA32_MISC_ENABLE) & ~MSR_IA32_MISC_ENABLE_MONITOR_ENA;
msr_value |= v & MSR_IA32_MISC_ENABLE_MONITOR_ENA;
/* This will not change the return value of has_monitor_cap() since the feature values

View File

@ -46,7 +46,7 @@ struct cpuinfo_x86 {
};
bool has_monitor_cap(void);
bool monitor_cap_buggy(void);
bool is_apl_platform(void);
bool is_apicv_advanced_feature_supported(void);
bool pcpu_has_cap(uint32_t bit);
bool pcpu_has_vmx_ept_cap(uint32_t bit_mask);