mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-08 20:29:40 +00:00
hv: add fast string enhanced rep movsb/stosb check on initial
The ACRN suppose the CPU support fast string enhanced rep. Tracked-On: #861 Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
@@ -78,6 +78,24 @@ static inline bool get_monitor_cap(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool is_fast_string_erms_supported_and_enabled(void)
|
||||
{
|
||||
bool ret = false;
|
||||
uint32_t misc_enable = (uint32_t)msr_read(MSR_IA32_MISC_ENABLE);
|
||||
|
||||
if ((misc_enable & MSR_IA32_MISC_ENABLE_FAST_STRING) == 0U) {
|
||||
pr_fatal("%s, fast string is not enabled\n", __func__);
|
||||
} else {
|
||||
if (!cpu_has_cap(X86_FEATURE_ERMS)) {
|
||||
pr_fatal("%s, enhanced rep movsb/stosb not supported\n", __func__);
|
||||
} else {
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static uint64_t get_address_mask(uint8_t limit)
|
||||
{
|
||||
return ((1UL << limit) - 1UL) & PAGE_MASK;
|
||||
@@ -222,6 +240,11 @@ static int32_t hardware_detect_support(void)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (!is_fast_string_erms_supported_and_enabled()) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
||||
if (!cpu_has_vmx_unrestricted_guest_cap()) {
|
||||
pr_fatal("%s, unrestricted guest not supported\n", __func__);
|
||||
return -ENODEV;
|
||||
|
Reference in New Issue
Block a user