Skip to content

Commit

Permalink
WHPX workaround bug in OSVW handling
Browse files Browse the repository at this point in the history
Adds a workaround to an incorrect value setting
CPUID Fn8000_0001_ECX[bit 9 OSVW] = 1. This can cause a guest linux kernel
to panic when an issue to rdmsr C001_0140h returns 0. Disabling this feature
correctly allows the guest to boot without accessing the osv workarounds.

Signed-off-by: Justin Terry (VM) <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
jterry75 authored and bonzini committed Jun 28, 2018
1 parent e7d9982 commit e1753a7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion target/i386/whpx-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,16 @@ static int whpx_vcpu_run(CPUState *cpu)
vcpu->exit_ctx.CpuidAccess.DefaultResultRcx |
CPUID_EXT_HYPERVISOR;

rdx = vcpu->exit_ctx.CpuidAccess.DefaultResultRdx;
rbx = vcpu->exit_ctx.CpuidAccess.DefaultResultRbx;
break;
case 0x80000001:
rax = vcpu->exit_ctx.CpuidAccess.DefaultResultRax;
/* Remove any support of OSVW */
rcx =
vcpu->exit_ctx.CpuidAccess.DefaultResultRcx &
~CPUID_EXT3_OSVW;

rdx = vcpu->exit_ctx.CpuidAccess.DefaultResultRdx;
rbx = vcpu->exit_ctx.CpuidAccess.DefaultResultRbx;
break;
Expand Down Expand Up @@ -1382,12 +1392,13 @@ static int whpx_accel_init(MachineState *ms)
goto error;
}

UINT32 cpuidExitList[] = {1};
UINT32 cpuidExitList[] = {1, 0x80000001};
hr = whp_dispatch.WHvSetPartitionProperty(
whpx->partition,
WHvPartitionPropertyCodeCpuidExitList,
cpuidExitList,
RTL_NUMBER_OF(cpuidExitList) * sizeof(UINT32));

if (FAILED(hr)) {
error_report("WHPX: Failed to set partition CpuidExitList hr=%08lx",
hr);
Expand Down

0 comments on commit e1753a7

Please sign in to comment.