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

[Xen-changelog] [xen master] x86/HVM: add more checks verifying that PIT/PIC/IOAPIC are emulated



commit 5fe65b5eafc8897549f23ca83a3105f63a79867b
Author:     Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
AuthorDate: Thu Aug 11 13:18:24 2016 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Aug 11 13:18:24 2016 +0200

    x86/HVM: add more checks verifying that PIT/PIC/IOAPIC are emulated
    
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/hvm/vlapic.c | 14 ++++++++++++--
 xen/arch/x86/hvm/vpt.c    |  2 +-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index ba9b293..1d5d287 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -1114,7 +1114,14 @@ static int __vlapic_accept_pic_intr(struct vcpu *v)
     struct domain *d = v->domain;
     struct vlapic *vlapic = vcpu_vlapic(v);
     uint32_t lvt0 = vlapic_get_reg(vlapic, APIC_LVT0);
-    union vioapic_redir_entry redir0 = domain_vioapic(d)->redirtbl[0];
+    union vioapic_redir_entry redir0;
+
+    ASSERT(has_vpic(d));
+
+    if ( !has_vioapic(d) )
+        return 0;
+
+    redir0 = domain_vioapic(d)->redirtbl[0];
 
     /* We deliver 8259 interrupts to the appropriate CPU as follows. */
     return ((/* IOAPIC pin0 is unmasked and routing to this LAPIC? */
@@ -1130,7 +1137,7 @@ static int __vlapic_accept_pic_intr(struct vcpu *v)
 
 int vlapic_accept_pic_intr(struct vcpu *v)
 {
-    if ( vlapic_hw_disabled(vcpu_vlapic(v)) )
+    if ( vlapic_hw_disabled(vcpu_vlapic(v)) || !has_vpic(v->domain) )
         return 0;
 
     TRACE_2D(TRC_HVM_EMUL_LAPIC_PIC_INTR,
@@ -1145,6 +1152,9 @@ void vlapic_adjust_i8259_target(struct domain *d)
 {
     struct vcpu *v;
 
+    if ( !has_vpic(d) )
+        return;
+
     for_each_vcpu ( d, v )
         if ( __vlapic_accept_pic_intr(v) )
             goto found;
diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 358ec57..5c48fdb 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -496,7 +496,7 @@ void pt_adjust_global_vcpu_target(struct vcpu *v)
     struct pl_time *pl_time;
     int i;
 
-    if ( v == NULL )
+    if ( !v || !has_vpit(v->domain) )
         return;
 
     vpit = &v->domain->arch.vpit;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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