Skip to content

Commit

Permalink
hv:cpu-caps:refine is_apl_platform func and clean up duplicated code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junming Liu authored and wenlingz committed Aug 14, 2020
1 parent 538e7cf commit 3631a85
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
15 changes: 2 additions & 13 deletions hypervisor/arch/x86/cpu_caps.c
Expand Up @@ -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;
Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion hypervisor/arch/x86/guest/vmsr.c
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion hypervisor/include/arch/x86/cpu_caps.h
Expand Up @@ -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);
Expand Down

0 comments on commit 3631a85

Please sign in to comment.