From: mlarkin Date: Sun, 17 Dec 2017 19:16:02 +0000 (+0000) Subject: vmm(4): pass EFER properly from vmd(8), needed to support vmctl(8)'s "-b" X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c4a52258f84a75484a9766ca9af34f532ca08ba5;p=openbsd vmm(4): pass EFER properly from vmd(8), needed to support vmctl(8)'s "-b" option which had been broken due to recent commits on AMD (SVM/RVI) ok pd@ --- diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c index dde279fc9f4..470306fe0ed 100644 --- a/sys/arch/amd64/amd64/vmm.c +++ b/sys/arch/amd64/amd64/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.180 2017/12/07 01:54:39 mlarkin Exp $ */ +/* $OpenBSD: vmm.c,v 1.181 2017/12/17 19:16:02 mlarkin Exp $ */ /* * Copyright (c) 2014 Mike Larkin * @@ -1644,6 +1644,7 @@ vcpu_writeregs_svm(struct vcpu *vcpu, uint64_t regmask, uint64_t *gprs = vrs->vrs_gprs; uint64_t *crs = vrs->vrs_crs; uint16_t attr; + uint64_t *msrs = vrs->vrs_msrs; struct vcpu_segment_info *sregs = vrs->vrs_sregs; struct vmcb *vmcb = (struct vmcb *)vcpu->vc_control_va; @@ -1723,6 +1724,10 @@ vcpu_writeregs_svm(struct vcpu *vcpu, uint64_t regmask, vmcb->v_cr4 = crs[VCPU_REGS_CR4]; } + /* The only presettable MSR via this function in SVM is EFER */ + if (regmask & VM_RWREGS_MSRS) + vmcb->v_efer |= msrs[VCPU_REGS_EFER]; + return (0); }