hv: TLFS: inject #GP to guest VM for writing of read-only MSRs

TLFS spec defines that HV_X64_MSR_VP_INDEX and HV_X64_MSR_TIME_REF_COUNT
are read-only MSRs. Any attempt to write to them results in a #GP fault.

Fix the issue by returning error in handler hyperv_wrmsr() of MSRs
HV_X64_MSR_VP_INDEX/HV_X64_MSR_TIME_REF_COUNT emulation.

Tracked-On: #5956
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Jian Jun Chen 2019-12-20 09:15:44 +08:00 committed by wenlingz
parent dd524d076d
commit b4312efbd7
1 changed files with 4 additions and 6 deletions

View File

@ -192,15 +192,13 @@ hyperv_wrmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t wval)
vcpu->vm->arch_vm.hyperv.hypercall_page.val64 = wval;
hyperv_setup_hypercall_page(vcpu, wval);
break;
case HV_X64_MSR_VP_INDEX:
/* read only */
break;
case HV_X64_MSR_TIME_REF_COUNT:
/* read only */
break;
case HV_X64_MSR_REFERENCE_TSC:
hyperv_setup_tsc_page(vcpu, wval);
break;
case HV_X64_MSR_VP_INDEX:
case HV_X64_MSR_TIME_REF_COUNT:
/* read only */
/* fallthrough */
default:
pr_err("hv: %s: unexpected MSR[0x%x] write", __func__, msr);
ret = -1;