xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Yang Zhang <yang.z.zhang@intel.com>
To: xen-devel@lists.xensource.com
Cc: Yang Zhang <yang.z.zhang@Intel.com>,
	keir.xen@gmail.com, JBeulich@suse.com
Subject: [PATCH 1/7] Nested VMX: Introduce interrupt source supporting
Date: Fri,  9 Aug 2013 16:49:29 +0800	[thread overview]
Message-ID: <1376038175-18571-2-git-send-email-yang.z.zhang@intel.com> (raw)
In-Reply-To: <1376038175-18571-1-git-send-email-yang.z.zhang@intel.com>

From: Yang Zhang <yang.z.zhang@Intel.com>

Introduce interrupt source to determine the source of interrupt that inject
to L1.

Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
---
 xen/arch/x86/hvm/vmx/intr.c        |    4 ++--
 xen/arch/x86/hvm/vmx/vmx.c         |   14 ++++++++------
 xen/include/asm-x86/hvm/vmx/vmx.h  |    2 +-
 xen/include/asm-x86/hvm/vmx/vvmx.h |    1 +
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c
index e376f3c..cb120f2 100644
--- a/xen/arch/x86/hvm/vmx/intr.c
+++ b/xen/arch/x86/hvm/vmx/intr.c
@@ -180,7 +180,7 @@ static int nvmx_intr_intercept(struct vcpu *v, struct hvm_intack intack)
             if ( !(ctrl & PIN_BASED_EXT_INTR_MASK) )
                 return 0;
 
-            vmx_inject_extint(intack.vector);
+            vmx_inject_extint(intack.vector, intack.source);
 
             ctrl = __get_vvmcs(vcpu_nestedhvm(v).nv_vvmcx, VM_EXIT_CONTROLS);
             if ( ctrl & VM_EXIT_ACK_INTR_ON_EXIT )
@@ -309,7 +309,7 @@ void vmx_intr_assist(void)
     else
     {
         HVMTRACE_2D(INJ_VIRQ, intack.vector, /*fake=*/ 0);
-        vmx_inject_extint(intack.vector);
+        vmx_inject_extint(intack.vector, intack.source);
         pt_intr_post(v, intack);
     }
 
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 8ed7026..51c657f 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1208,7 +1208,7 @@ static void vmx_update_guest_efer(struct vcpu *v)
 }
 
 void nvmx_enqueue_n2_exceptions(struct vcpu *v, 
-            unsigned long intr_fields, int error_code)
+            unsigned long intr_fields, int error_code, uint8_t source)
 {
     struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
 
@@ -1216,6 +1216,7 @@ void nvmx_enqueue_n2_exceptions(struct vcpu *v,
         /* enqueue the exception till the VMCS switch back to L1 */
         nvmx->intr.intr_info = intr_fields;
         nvmx->intr.error_code = error_code;
+        nvmx->intr.source = source;
         vcpu_nestedhvm(v).nv_vmexit_pending = 1;
         return;
     }
@@ -1227,7 +1228,8 @@ void nvmx_enqueue_n2_exceptions(struct vcpu *v,
 
 static int nvmx_vmexit_trap(struct vcpu *v, struct hvm_trap *trap)
 {
-    nvmx_enqueue_n2_exceptions(v, trap->vector, trap->error_code);
+    nvmx_enqueue_n2_exceptions(v, trap->vector, trap->error_code,
+            hvm_intsrc_none);
     return NESTEDHVM_VMEXIT_DONE;
 }
 
@@ -1258,7 +1260,7 @@ static void __vmx_inject_exception(int trap, int type, int error_code)
         curr->arch.hvm_vmx.vmx_emulate = 1;
 }
 
-void vmx_inject_extint(int trap)
+void vmx_inject_extint(int trap, uint8_t source)
 {
     struct vcpu *v = current;
     u32    pin_based_cntrl;
@@ -1269,7 +1271,7 @@ void vmx_inject_extint(int trap)
         if ( pin_based_cntrl & PIN_BASED_EXT_INTR_MASK ) {
             nvmx_enqueue_n2_exceptions (v, 
                INTR_INFO_VALID_MASK | (X86_EVENTTYPE_EXT_INTR<<8) | trap,
-               HVM_DELIVER_NO_ERROR_CODE);
+               HVM_DELIVER_NO_ERROR_CODE, source);
             return;
         }
     }
@@ -1288,7 +1290,7 @@ void vmx_inject_nmi(void)
         if ( pin_based_cntrl & PIN_BASED_NMI_EXITING ) {
             nvmx_enqueue_n2_exceptions (v, 
                INTR_INFO_VALID_MASK | (X86_EVENTTYPE_NMI<<8) | TRAP_nmi,
-               HVM_DELIVER_NO_ERROR_CODE);
+               HVM_DELIVER_NO_ERROR_CODE, hvm_intsrc_nmi);
             return;
         }
     }
@@ -1356,7 +1358,7 @@ static void vmx_inject_trap(struct hvm_trap *trap)
     {
         nvmx_enqueue_n2_exceptions (curr, 
             INTR_INFO_VALID_MASK | (_trap.type<<8) | _trap.vector,
-            _trap.error_code); 
+            _trap.error_code, hvm_intsrc_none);
         return;
     }
     else
diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h b/xen/include/asm-x86/hvm/vmx/vmx.h
index c33b9f9..f4d759b 100644
--- a/xen/include/asm-x86/hvm/vmx/vmx.h
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h
@@ -448,7 +448,7 @@ static inline int __vmxon(u64 addr)
 
 void vmx_get_segment_register(struct vcpu *, enum x86_segment,
                               struct segment_register *);
-void vmx_inject_extint(int trap);
+void vmx_inject_extint(int trap, uint8_t source);
 void vmx_inject_nmi(void);
 
 int ept_p2m_init(struct p2m_domain *p2m);
diff --git a/xen/include/asm-x86/hvm/vmx/vvmx.h b/xen/include/asm-x86/hvm/vmx/vvmx.h
index 3874525..be2b5c6 100644
--- a/xen/include/asm-x86/hvm/vmx/vvmx.h
+++ b/xen/include/asm-x86/hvm/vmx/vvmx.h
@@ -36,6 +36,7 @@ struct nestedvmx {
     struct {
         unsigned long intr_info;
         u32           error_code;
+        uint8_t       source;
     } intr;
     struct {
         bool_t   enabled;
-- 
1.7.1

  reply	other threads:[~2013-08-09  8:49 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09  8:49 [PATCH 0/7] Nested VMX: APIC-v related bug fixing Yang Zhang
2013-08-09  8:49 ` Yang Zhang [this message]
2013-08-09 10:14   ` [PATCH 1/7] Nested VMX: Introduce interrupt source supporting Andrew Cooper
2013-08-09 12:03   ` Jan Beulich
2013-08-11  2:30     ` Zhang, Yang Z
2013-08-09  8:49 ` [PATCH 2/7] Nested VMX: Allow to ack irq even virtual intr delivery is enabled Yang Zhang
2013-08-09 10:28   ` Andrew Cooper
2013-08-09 10:32     ` Zhang, Yang Z
2013-08-09 12:04       ` Jan Beulich
2013-08-11  2:30         ` Zhang, Yang Z
2013-08-09 12:06   ` Jan Beulich
2013-08-11  2:43     ` Zhang, Yang Z
2013-08-12  6:47       ` Jan Beulich
2013-08-13  1:10         ` Zhang, Yang Z
2013-08-13 10:30           ` Jan Beulich
2013-08-09  8:49 ` [PATCH 3/7] Nested VMX: Force check ISR when L2 is running Yang Zhang
2013-08-09 10:38   ` Andrew Cooper
2013-08-09 12:12   ` Jan Beulich
2013-08-11  2:49     ` Zhang, Yang Z
2013-08-12  6:47       ` Jan Beulich
2013-08-09  8:49 ` [PATCH 4/7] Nested VMX: Add interface to update vPPR Yang Zhang
2013-08-09 10:42   ` Andrew Cooper
2013-08-09 12:14   ` Jan Beulich
2013-08-11  2:50     ` Zhang, Yang Z
2013-08-09  8:49 ` [PATCH 5/7] Nested VMX: Check whether interrupt is blocked by TPR Yang Zhang
2013-08-09 10:43   ` Andrew Cooper
2013-08-09 12:16     ` Jan Beulich
2013-08-11  2:51       ` Zhang, Yang Z
2013-08-09  8:49 ` [PATCH 6/7] Nested VMX: Update APIC-v(RVI/SVI) when vmexit to L1 Yang Zhang
2013-08-09 10:49   ` Andrew Cooper
2013-08-09 12:31   ` Jan Beulich
2013-08-11  2:59     ` Zhang, Yang Z
2013-08-12  6:53       ` Jan Beulich
2013-08-13  1:08         ` Zhang, Yang Z
2013-08-15  1:41         ` Zhang, Yang Z
2013-08-15  6:26           ` Jan Beulich
2013-08-09  8:49 ` [PATCH 7/7] Nested VMX: Clear APIC-v control bit in vmcs02 Yang Zhang
2013-08-09 10:50   ` Andrew Cooper
2013-08-09 12:37   ` Jan Beulich
2013-08-11  3:04     ` Zhang, Yang Z
2013-08-09 12:00 ` [PATCH 0/7] Nested VMX: APIC-v related bug fixing Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1376038175-18571-2-git-send-email-yang.z.zhang@intel.com \
    --to=yang.z.zhang@intel.com \
    --cc=JBeulich@suse.com \
    --cc=keir.xen@gmail.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).