From: "Jan Beulich" Subject: Re: [RFC v2 05/15] vmx: Initialize VT-d Posted-Interrupts Descriptor Date: Tue, 09 Jun 2015 15:20:17 +0100 Message-ID: <557712410200007800082B03@mail.emea.novell.com> References: <1431076038-7497-1-git-send-email-feng.wu@intel.com> <1431076038-7497-6-git-send-email-feng.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1431076038-7497-6-git-send-email-feng.wu@intel.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Feng Wu Cc: kevin.tian@intel.com, keir@xen.org, george.dunlap@eu.citrix.com, andrew.cooper3@citrix.com, xen-devel@lists.xen.org, yang.z.zhang@intel.com List-Id: xen-devel@lists.xenproject.org >>> On 08.05.15 at 11:07, wrote: > --- a/xen/include/asm-x86/hvm/vmx/vmx.h > +++ b/xen/include/asm-x86/hvm/vmx/vmx.h > @@ -28,6 +28,9 @@ > #include > #include > #include > +#include > + > +extern uint8_t posted_intr_vector; > > typedef union { > struct { > @@ -125,6 +128,22 @@ static inline unsigned long pi_get_pir(struct pi_desc *pi_desc, int group) > return xchg(&pi_desc->pir[group], 0); > } > > +#define PI_xAPIC_NDST_MASK 0xFF00 > + > +static inline void pi_desc_init(struct vcpu *v) > +{ > + uint32_t dest; > + > + v->arch.hvm_vmx.pi_desc.nv = posted_intr_vector; > + > + dest = cpu_physical_id(v->processor); > + > + if ( x2apic_enabled ) > + v->arch.hvm_vmx.pi_desc.ndst = dest; > + else > + v->arch.hvm_vmx.pi_desc.ndst = MASK_INSR(dest, PI_xAPIC_NDST_MASK); > +} Unless this is going to be needed outside of vmcs.c this shouldn't be in a header file (and probably also not be inline). > @@ -244,7 +263,6 @@ static inline unsigned long pi_get_pir(struct pi_desc > *pi_desc, int group) > #define MODRM_EAX_ECX ".byte 0xc1\n" /* EAX, ECX */ > > extern u64 vmx_ept_vpid_cap; > -extern uint8_t posted_intr_vector; Which then also eliminates the need to move this declaration. Jan