[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC v2 05/15] vmx: Initialize VT-d Posted-Interrupts Descriptor
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 | 20 +++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index 63007a9..f60a454 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 ) + 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 91c5e18..e4292cc 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 { @@ -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); +} + /* * Exit Reasons */ @@ -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; #define cpu_has_vmx_ept_exec_only_supported \ (vmx_ept_vpid_cap & VMX_EPT_EXEC_ONLY_SUPPORTED) -- 2.1.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |