From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 06/28] nVMX: Implement reading and writing of VMX MSRs Date: Thu, 09 Dec 2010 13:04:43 +0200 Message-ID: <4D00B7CB.80106@redhat.com> References: <1291827596-nyh@il.ibm.com> <201012081703.oB8H32EM008609@rice.haifa.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, gleb@redhat.com To: "Nadav Har'El" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:61960 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751082Ab0LILEs (ORCPT ); Thu, 9 Dec 2010 06:04:48 -0500 In-Reply-To: <201012081703.oB8H32EM008609@rice.haifa.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 12/08/2010 07:03 PM, Nadav Har'El wrote: > When the guest can use VMX instructions (when the "nested" module option is > on), it should also be able to read and write VMX MSRs, e.g., to query about > VMX capabilities. This patch adds this support. > > + > +static int vmx_set_vmx_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) > +{ > + switch (msr_index) { > + case MSR_IA32_FEATURE_CONTROL: > + case MSR_IA32_VMX_BASIC: > + case MSR_IA32_VMX_TRUE_PINBASED_CTLS: > + case MSR_IA32_VMX_PINBASED_CTLS: > + case MSR_IA32_VMX_PROCBASED_CTLS: > + case MSR_IA32_VMX_EXIT_CTLS: > + case MSR_IA32_VMX_ENTRY_CTLS: > + case MSR_IA32_VMX_PROCBASED_CTLS2: > + case MSR_IA32_VMX_EPT_VPID_CAP: > + pr_unimpl(vcpu, "unimplemented VMX MSR write: 0x%x data %llx\n", > + msr_index, data); > + return 0; > + default: > + return 1; > + } > +} These msrs are read-only IIRC, so they should #GP without any message. Nor should they be part of the save/restore msr set. We do need a way for userspace to set them though. -- error compiling committee.c: too many arguments to function