From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH v9 2/3] x86, apicv: add virtual x2apic support Date: Thu, 10 Jan 2013 10:25:27 +0200 Message-ID: <20130110082527.GK700@redhat.com> References: <1357802768-15816-1-git-send-email-yang.z.zhang@intel.com> <1357802768-15816-3-git-send-email-yang.z.zhang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, haitao.shan@intel.com, mtosatti@redhat.com, Kevin Tian To: Yang Zhang Return-path: Received: from mx1.redhat.com ([209.132.183.28]:10650 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751397Ab3AJIZb (ORCPT ); Thu, 10 Jan 2013 03:25:31 -0500 Content-Disposition: inline In-Reply-To: <1357802768-15816-3-git-send-email-yang.z.zhang@intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Jan 10, 2013 at 03:26:07PM +0800, Yang Zhang wrote: > +static void vmx_enable_virtual_x2apic_mode(struct kvm_vcpu *vcpu) > +{ > + u32 exec_control; > + int msr; > + struct vcpu_vmx *vmx = to_vmx(vcpu); > + > + if (!cpu_has_vmx_virtualize_x2apic_mode()) > + return; > + > + exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); > + /* virtualize x2apic mode relies on tpr shadow */ > + if (!(exec_control & CPU_BASED_TPR_SHADOW)) > + return; > + > + exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL); > + exec_control &= ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; > + exec_control |= SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE; > + vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control); > + vmx->virtual_x2apic_enabled = true; > + > + if (!cpu_has_vmx_virtual_intr_delivery()) > + return; > + > + for (msr = 0x800; msr <= 0x8ff; msr++) > + vmx_intercept_for_msr_read(msr, false, false); > + > + /* APIC ID */ > + vmx_intercept_for_msr_read(0x802, false, true); Why are you enabling apic id read intercept? > + /* TMCCT */ > + vmx_intercept_for_msr_read(0x839, false, true); > + /* TPR */ > + vmx_intercept_for_msr_write(0x808, false, false); > + /* EOI */ > + vmx_intercept_for_msr_write(0x80b, false, false); > + /* SELF-IPI */ > + vmx_intercept_for_msr_write(0x83f, false, false); > + > +} > + -- Gleb.