mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-02 08:19:16 +00:00
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:
parent
538e7cf74d
commit
3631a85c3c
@ -57,17 +57,6 @@ bool pcpu_has_cap(uint32_t bit)
|
|||||||
return ret;
|
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 has_monitor_cap(void)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
@ -77,7 +66,7 @@ bool has_monitor_cap(void)
|
|||||||
* in hypervisor, but still expose it to the guests and
|
* in hypervisor, but still expose it to the guests and
|
||||||
* let them handle it correctly
|
* let them handle it correctly
|
||||||
*/
|
*/
|
||||||
if (!monitor_cap_buggy()) {
|
if (!is_apl_platform()) {
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,7 +107,7 @@ bool is_apl_platform(void)
|
|||||||
{
|
{
|
||||||
bool ret = false;
|
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;
|
ret = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -698,7 +698,7 @@ static void set_guest_ia32_misc_enalbe(struct acrn_vcpu *vcpu, uint64_t v)
|
|||||||
if ((ecx & CPUID_ECX_SSE3) == 0U) {
|
if ((ecx & CPUID_ECX_SSE3) == 0U) {
|
||||||
vcpu_inject_gp(vcpu, 0U);
|
vcpu_inject_gp(vcpu, 0U);
|
||||||
update_vmsr = false;
|
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 = msr_read(MSR_IA32_MISC_ENABLE) & ~MSR_IA32_MISC_ENABLE_MONITOR_ENA;
|
||||||
msr_value |= v & 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
|
/* This will not change the return value of has_monitor_cap() since the feature values
|
||||||
|
@ -46,7 +46,7 @@ struct cpuinfo_x86 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool has_monitor_cap(void);
|
bool has_monitor_cap(void);
|
||||||
bool monitor_cap_buggy(void);
|
bool is_apl_platform(void);
|
||||||
bool is_apicv_advanced_feature_supported(void);
|
bool is_apicv_advanced_feature_supported(void);
|
||||||
bool pcpu_has_cap(uint32_t bit);
|
bool pcpu_has_cap(uint32_t bit);
|
||||||
bool pcpu_has_vmx_ept_cap(uint32_t bit_mask);
|
bool pcpu_has_vmx_ept_cap(uint32_t bit_mask);
|
||||||
|
Loading…
Reference in New Issue
Block a user