WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86, hvm: Allow delivery of timer interru

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86, hvm: Allow delivery of timer interrupts to VCPUs != 0
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 08 Jul 2009 14:15:14 -0700
Delivery-date: Wed, 08 Jul 2009 14:15:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1246972876 -3600
# Node ID a29bb4efff00b1323a52527b974d58651fdce9b6
# Parent  2fadef1b008f8db66b69cd01cadac1629421f1fa
x86,hvm: Allow delivery of timer interrupts to VCPUs != 0

This patch is needed for kexec/kdump since VCPU#0 is halted.

Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hvm/hpet.c       |    2 -
 xen/arch/x86/hvm/i8254.c      |    2 -
 xen/arch/x86/hvm/rtc.c        |    2 -
 xen/arch/x86/hvm/vlapic.c     |    3 ++
 xen/arch/x86/hvm/vpt.c        |   50 ++++++++++++++++++++++++++++++++++++++++++
 xen/include/asm-x86/hvm/vpt.h |    4 +++
 6 files changed, 60 insertions(+), 3 deletions(-)

diff -r 2fadef1b008f -r a29bb4efff00 xen/arch/x86/hvm/hpet.c
--- a/xen/arch/x86/hvm/hpet.c   Tue Jul 07 14:08:47 2009 +0100
+++ b/xen/arch/x86/hvm/hpet.c   Tue Jul 07 14:21:16 2009 +0100
@@ -28,7 +28,7 @@
 #define vcpu_vhpet(vcpu)   (domain_vhpet((vcpu)->domain))
 #define vhpet_domain(hpet) (container_of((hpet), struct domain, \
                                          arch.hvm_domain.pl_time.vhpet))
-#define vhpet_vcpu(hpet)   (vhpet_domain(hpet)->vcpu[0])
+#define vhpet_vcpu(hpet)   (pt_global_vcpu_target(vhpet_domain(hpet)))
 
 #define HPET_BASE_ADDRESS   0xfed00000ULL
 #define HPET_MMAP_SIZE      1024
diff -r 2fadef1b008f -r a29bb4efff00 xen/arch/x86/hvm/i8254.c
--- a/xen/arch/x86/hvm/i8254.c  Tue Jul 07 14:08:47 2009 +0100
+++ b/xen/arch/x86/hvm/i8254.c  Tue Jul 07 14:21:16 2009 +0100
@@ -42,7 +42,7 @@
 #define vcpu_vpit(vcpu)  (domain_vpit((vcpu)->domain))
 #define vpit_domain(pit) (container_of((pit), struct domain, \
                                        arch.hvm_domain.pl_time.vpit))
-#define vpit_vcpu(pit)   (vpit_domain(pit)->vcpu[0])
+#define vpit_vcpu(pit)   (pt_global_vcpu_target(vpit_domain(pit)))
 
 #define RW_STATE_LSB 1
 #define RW_STATE_MSB 2
diff -r 2fadef1b008f -r a29bb4efff00 xen/arch/x86/hvm/rtc.c
--- a/xen/arch/x86/hvm/rtc.c    Tue Jul 07 14:08:47 2009 +0100
+++ b/xen/arch/x86/hvm/rtc.c    Tue Jul 07 14:21:16 2009 +0100
@@ -32,7 +32,7 @@
 #define vcpu_vrtc(vcpu)  (domain_vrtc((vcpu)->domain))
 #define vrtc_domain(rtc) (container_of((rtc), struct domain, \
                                        arch.hvm_domain.pl_time.vrtc))
-#define vrtc_vcpu(rtc)   (vrtc_domain(rtc)->vcpu[0])
+#define vrtc_vcpu(rtc)   (pt_global_vcpu_target(vrtc_domain(rtc)))
 
 static void rtc_periodic_cb(struct vcpu *v, void *opaque)
 {
diff -r 2fadef1b008f -r a29bb4efff00 xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c Tue Jul 07 14:08:47 2009 +0100
+++ b/xen/arch/x86/hvm/vlapic.c Tue Jul 07 14:21:16 2009 +0100
@@ -814,7 +814,10 @@ void vlapic_adjust_i8259_target(struct d
     v = d->vcpu ? d->vcpu[0] : NULL;
 
  found:
+    if ( d->arch.hvm_domain.i8259_target == v )
+        return;
     d->arch.hvm_domain.i8259_target = v;
+    pt_adjust_global_vcpu_target(v);
 }
 
 int vlapic_has_pending_irq(struct vcpu *v)
diff -r 2fadef1b008f -r a29bb4efff00 xen/arch/x86/hvm/vpt.c
--- a/xen/arch/x86/hvm/vpt.c    Tue Jul 07 14:08:47 2009 +0100
+++ b/xen/arch/x86/hvm/vpt.c    Tue Jul 07 14:21:16 2009 +0100
@@ -437,3 +437,53 @@ void destroy_periodic_time(struct period
      */
     kill_timer(&pt->timer);
 }
+
+static void pt_adjust_vcpu(struct periodic_time *pt, struct vcpu *v)
+{
+    int on_list;
+
+    ASSERT(pt->source == PTSRC_isa);
+
+    if ( pt->vcpu == NULL )
+        return;
+
+    pt_lock(pt);
+    on_list = pt->on_list;
+    if ( pt->on_list )
+        list_del(&pt->list);
+    pt->on_list = 0;
+    pt_unlock(pt);
+
+    spin_lock(&v->arch.hvm_vcpu.tm_lock);
+    pt->vcpu = v;
+    if ( on_list )
+    {
+        pt->on_list = 1;
+        list_add(&pt->list, &v->arch.hvm_vcpu.tm_list);
+
+        migrate_timer(&pt->timer, v->processor);
+    }
+    spin_unlock(&v->arch.hvm_vcpu.tm_lock);
+}
+
+void pt_adjust_global_vcpu_target(struct vcpu *v)
+{
+    struct pl_time *pl_time = &v->domain->arch.hvm_domain.pl_time;
+    int i;
+
+    if ( v == NULL )
+        return;
+
+    spin_lock(&pl_time->vpit.lock);
+    pt_adjust_vcpu(&pl_time->vpit.pt0, v);
+    spin_unlock(&pl_time->vpit.lock);
+
+    spin_lock(&pl_time->vrtc.lock);
+    pt_adjust_vcpu(&pl_time->vrtc.pt, v);
+    spin_unlock(&pl_time->vrtc.lock);
+
+    spin_lock(&pl_time->vhpet.lock);
+    for ( i = 0; i < HPET_TIMER_NUM; i++ )
+        pt_adjust_vcpu(&pl_time->vhpet.pt[i], v);
+    spin_unlock(&pl_time->vhpet.lock);
+}
diff -r 2fadef1b008f -r a29bb4efff00 xen/include/asm-x86/hvm/vpt.h
--- a/xen/include/asm-x86/hvm/vpt.h     Tue Jul 07 14:08:47 2009 +0100
+++ b/xen/include/asm-x86/hvm/vpt.h     Tue Jul 07 14:21:16 2009 +0100
@@ -142,6 +142,10 @@ void pt_reset(struct vcpu *v);
 void pt_reset(struct vcpu *v);
 void pt_migrate(struct vcpu *v);
 
+void pt_adjust_global_vcpu_target(struct vcpu *v);
+#define pt_global_vcpu_target(d) \
+    ((d)->arch.hvm_domain.i8259_target ? : (d)->vcpu ? (d)->vcpu[0] : NULL)
+
 /* Is given periodic timer active? */
 #define pt_active(pt) ((pt)->on_list)
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86, hvm: Allow delivery of timer interrupts to VCPUs != 0, Xen patchbot-unstable <=