diff --git a/arch/x86/kernel/processor.c b/arch/x86/kernel/processor.c index 7cae4339f..6fc3f35ac 100644 --- a/arch/x86/kernel/processor.c +++ b/arch/x86/kernel/processor.c @@ -637,10 +637,6 @@ int cpu_detection(void) { if (first_time) { - // enable fast string operations - uint64_t misc = rdmsr(MSR_IA32_MISC_ENABLE); - wrmsr(MSR_IA32_MISC_ENABLE, misc | MSR_IA32_MISC_ENABLE_FAST_STRING); - LOG_INFO("CR0 0x%llx, CR4 0x%llx\n", read_cr0(), read_cr4()); LOG_INFO("size of xsave_t: %d\n", sizeof(xsave_t)); if (has_msr()) { diff --git a/tools/uhyve.c b/tools/uhyve.c index 4e4c736fb..5bd3b3f70 100644 --- a/tools/uhyve.c +++ b/tools/uhyve.c @@ -1069,9 +1069,21 @@ static int vcpu_init(void) kvm_ioctl(vcpufd, KVM_SET_XSAVE, &xsave); kvm_ioctl(vcpufd, KVM_SET_VCPU_EVENTS, &events); } else { + struct { + struct kvm_msrs info; + struct kvm_msr_entry entries[MAX_MSR_ENTRIES]; + } msr_data; + struct kvm_msr_entry *msrs = msr_data.entries; + // be sure that the multiprocessor is runable kvm_ioctl(vcpufd, KVM_SET_MP_STATE, &mp_state); + // enable fast string operations + msrs[0].index = MSR_IA32_MISC_ENABLE; + msrs[0].data = 1; + msr_data.info.nmsrs = 1; + kvm_ioctl(vcpufd, KVM_SET_MSRS, &msr_data); + /* Setup registers and memory. */ setup_system(vcpufd, guest_mem, cpuid); kvm_ioctl(vcpufd, KVM_SET_REGS, ®s);