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] [PATCH] vmx-pit-reset-vector.patch

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [PATCH] vmx-pit-reset-vector.patch
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Tue, 07 Jun 2005 06:57:24 +0000
Delivery-date: Tue, 07 Jun 2005 07:01:58 +0000
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1687, 2005/06/07 07:57:24+01:00, arun.sharma@xxxxxxxxx

        [PATCH] vmx-pit-reset-vector.patch
        
        If the guest resets irq_base in the PIC, we should reset the vector
        in the hypervisor as well.
        
        Signed-off-by: Arun Sharma <arun.sharma@xxxxxxxxx>



 i8254.c |   62 +++++++++++++++++++++++++++++++++++++++++---------------------
 i8259.c |    1 +
 2 files changed, 42 insertions(+), 21 deletions(-)


diff -Nru a/tools/ioemu/hw/i8254.c b/tools/ioemu/hw/i8254.c
--- a/tools/ioemu/hw/i8254.c    2005-06-07 03:02:54 -04:00
+++ b/tools/ioemu/hw/i8254.c    2005-06-07 03:02:54 -04:00
@@ -50,6 +50,7 @@
     int64_t next_transition_time;
     QEMUTimer *irq_timer;
     int irq;
+    int vmx_channel; /* Is this accelerated by VMX ? */
 } PITChannelState;
 
 struct PITState {
@@ -214,12 +215,47 @@
     return s->gate;
 }
 
-static inline void pit_load_count(PITChannelState *s, int val)
+void pit_reset_vmx_vectors()
 {
     extern void *shared_page;
     ioreq_t *req; 
-    int irq;
+    int irq, i;
+    PITChannelState *s;
 
+    /* Assumes PIT is wired to IRQ0 and -1 is uninitialized irq base */
+    if ((irq = pic_irq2vec(0)) == -1)
+        return;
+
+    for(i = 0; i < 3; i++) {
+        if (pit_state.channels[i].vmx_channel)
+             break;
+    }
+    
+    if (i == 3)
+        return;
+
+    /* Assumes just one VMX accelerated channel */
+    vmx_channel = i;
+    s = &pit_state.channels[vmx_channel];
+    fprintf(logfile,
+       "VMX_PIT:guest init pit channel %d!\n", vmx_channel);
+    req = &((vcpu_iodata_t *) shared_page)->vp_ioreq;
+
+    req->state = STATE_IORESP_HOOK;
+    /*
+     * info passed to HV as following
+     * -- init count:16 bit, timer vec:8 bit,
+     * PIT channel(0~2):2 bit, rw mode:2 bit
+     */
+    req->u.data = s->count;
+    req->u.data |= (irq << 16);
+    req->u.data |= (vmx_channel << 24);
+    req->u.data |= ((s->rw_mode) << 26);
+    fprintf(logfile, "VMX_PIT:pass info 0x%llx to HV!\n", req->u.data);
+}
+
+static inline void pit_load_count(PITChannelState *s, int val)
+{
     if (val == 0)
         val = 0x10000;
     s->count_load_time = qemu_get_clock(vm_clock);
@@ -228,25 +264,8 @@
     /* guest init this pit channel for periodic mode. we do not update related
      * timer so the channel never send intr from device model*/
     if (vmx_channel != -1 && s->mode == 2) {
-       /* get the pit irq(0)'s vector from pic DM */
-       if ((irq = pic_irq2vec(0)) >= 0) {
-           fprintf(logfile,
-               "VMX_PIT:guest init pit channel %d!\n", vmx_channel);
-           req = &((vcpu_iodata_t *) shared_page)->vp_ioreq;
-
-           req->state = STATE_IORESP_HOOK;
-           /*
-            * info passed to HV as following
-            * -- init count:16 bit, timer vec:8 bit,
-            * PIT channel(0~2):2 bit, rw mode:2 bit
-            */
-           req->u.data = s->count;
-           req->u.data |= (irq << 16);
-           req->u.data |= (vmx_channel << 24);
-           req->u.data |= ((s->rw_mode) << 26);
-           fprintf(logfile, "VMX_PIT:pass info 0x%llx to HV!\n", req->u.data);
-           vmx_channel = -1;
-       }
+        pit_reset_vmx_vectors();
+        vmx_channel = -1;
     }
 
 /*    pit_irq_timer_update(s, s->count_load_time);*/
@@ -306,6 +325,7 @@
         }
     } else {
         s = &pit->channels[addr];
+        s->vmx_channel = 1;
         vmx_channel = addr;
         switch(s->write_state) {
         default:
diff -Nru a/tools/ioemu/hw/i8259.c b/tools/ioemu/hw/i8259.c
--- a/tools/ioemu/hw/i8259.c    2005-06-07 03:02:54 -04:00
+++ b/tools/ioemu/hw/i8259.c    2005-06-07 03:02:54 -04:00
@@ -334,6 +334,7 @@
         case 1:
             s->irq_base = val & 0xf8;
             s->init_state = 2;
+            pit_reset_vmx_vectors();
             break;
         case 2:
             if (s->init4) {

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [PATCH] vmx-pit-reset-vector.patch, BitKeeper Bot <=