[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [RFC v1 05/15] vmx: Initialize VT-d Posted-Interrupts Descriptor




> -----Original Message-----
> From: Andrew Cooper [mailto:andrew.cooper3@xxxxxxxxxx]
> Sent: Friday, March 27, 2015 2:54 AM
> To: Wu, Feng; xen-devel@xxxxxxxxxxxxx
> Cc: Zhang, Yang Z; Tian, Kevin; keir@xxxxxxx; JBeulich@xxxxxxxx
> Subject: Re: [Xen-devel] [RFC v1 05/15] vmx: Initialize VT-d Posted-Interrupts
> Descriptor
> 
> On 25/03/15 12:31, Feng Wu wrote:
> > This patch initializes the VT-d Posted-interrupt Descriptor.
> >
> > Signed-off-by: Feng Wu <feng.wu@xxxxxxxxx>
> > ---
> >   xen/arch/x86/hvm/vmx/vmcs.c       |  3 +++
> >   xen/include/asm-x86/hvm/vmx/vmx.h | 21 ++++++++++++++++++++-
> >   2 files changed, 23 insertions(+), 1 deletion(-)
> >
> > diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
> > index d614638..942f4b7 100644
> > --- a/xen/arch/x86/hvm/vmx/vmcs.c
> > +++ b/xen/arch/x86/hvm/vmx/vmcs.c
> > @@ -1004,6 +1004,9 @@ static int construct_vmcs(struct vcpu *v)
> >
> >       if ( cpu_has_vmx_posted_intr_processing )
> >       {
> > +        if ( iommu_intpost == 1 )
> 
> Being a boolean, please shorten this to "if ( iommu_intpost )"
> 
> > +            pi_desc_init(v);
> > +
> >           __vmwrite(PI_DESC_ADDR,
> virt_to_maddr(&v->arch.hvm_vmx.pi_desc));
> >           __vmwrite(POSTED_INTR_NOTIFICATION_VECTOR,
> posted_intr_vector);
> >       }
> > diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h
> b/xen/include/asm-x86/hvm/vmx/vmx.h
> > index ecc5e17..3cd75eb 100644
> > --- a/xen/include/asm-x86/hvm/vmx/vmx.h
> > +++ b/xen/include/asm-x86/hvm/vmx/vmx.h
> > @@ -28,6 +28,9 @@
> >   #include <asm/hvm/support.h>
> >   #include <asm/hvm/trace.h>
> >   #include <asm/hvm/vmx/vmcs.h>
> > +#include <asm/apic.h>
> > +
> > +extern uint8_t posted_intr_vector;
> >
> >   typedef union {
> >       struct {
> > @@ -146,6 +149,23 @@ static inline unsigned long pi_get_pir(struct pi_desc
> *pi_desc, int group)
> >       return xchg(&pi_desc->pir[group], 0);
> >   }
> >
> > +static inline void pi_desc_init(struct vcpu *v)
> > +{
> > +    uint32_t dest;
> > +
> > +    pi_clear_sn(&v->arch.hvm_vmx.pi_desc);
> 
> This is called during construct_vmcs().  You safely rely on the fact
> that all memory is safely zeroed, so you don't need this clear bit, nor
> the lower setting of ndm.

Okay.

> 
> > +    v->arch.hvm_vmx.pi_desc.nv = posted_intr_vector;
> > +
> > +    /* Physical mode for Notificaiton Event */
> > +    v->arch.hvm_vmx.pi_desc.ndm = 0;
> > +    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 = (dest << 8) & 0xFF00;
> 
> What takes care of ensuring that this ndst field gets updated whenever
> v->processor changes?
> 

This is done in patch [13/15]

Thanks,
Feng

> ~Andrew
> 
> > +}
> > +
> >   /*
> >    * Exit Reasons
> >    */
> > @@ -265,7 +285,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;
> >
> >   #define cpu_has_vmx_ept_exec_only_supported        \
> >       (vmx_ept_vpid_cap & VMX_EPT_EXEC_ONLY_SUPPORTED)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.