Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Fix interrupt injection bug due to caching irq vectors after vector mappings have...
Jack Lange [Wed, 3 Feb 2010 01:24:34 +0000 (19:24 -0600)]
back port of irq fix

palacios/include/palacios/vmm_intr.h
palacios/src/devices/8259a.c
palacios/src/palacios/svm.c
palacios/src/palacios/vmm_intr.c

index 0781844..44de7db 100644 (file)
@@ -84,6 +84,7 @@ struct intr_ctrl_ops {
 };
 
 
+void v3_clear_pending_intr(struct guest_info * core);
 
 void v3_register_intr_controller(struct guest_info * info, struct intr_ctrl_ops * ops, void * state);
 
index 443fb0a..34851dd 100644 (file)
@@ -421,6 +421,8 @@ static int write_master_port1(ushort_t port, void * src, uint_t length, struct v
         return -1;
     }
 
+    v3_clear_pending_intr(dev->vm);
+
     if (IS_ICW1(cw)) {
 
         PrintDebug("8259 PIC: Setting ICW1 = %x (wr_Master1)\n", cw);
@@ -483,12 +485,16 @@ static int write_master_port2(ushort_t port, void * src, uint_t length, struct v
         return -1;
     }
 
+    v3_clear_pending_intr(dev->vm);
+
     if (state->master_state == ICW2) {
         struct icw1 * cw1 = (struct icw1 *)&(state->master_icw1);
 
         PrintDebug("8259 PIC: Setting ICW2 = %x (wr_Master2)\n", cw);
         state->master_icw2 = cw;
 
+
+
         if (cw1->sngl == 0) {
             state->master_state = ICW3;
         } else if (cw1->ic4 == 1) {
@@ -497,6 +503,8 @@ static int write_master_port2(ushort_t port, void * src, uint_t length, struct v
             state->master_state = READY;
         }
 
+
+
     } else if (state->master_state == ICW3) {
         struct icw1 * cw1 = (struct icw1 *)&(state->master_icw1);
 
@@ -539,6 +547,8 @@ static int write_slave_port1(ushort_t port, void * src, uint_t length, struct vm
        return -1;
     }
 
+    v3_clear_pending_intr(dev->vm);
+
     if (IS_ICW1(cw)) {
        PrintDebug("8259 PIC: Setting ICW1 = %x (wr_Slave1)\n", cw);
        state->slave_icw1 = cw;
@@ -597,6 +607,9 @@ static int write_slave_port2(ushort_t port, void * src, uint_t length, struct vm
         return -1;
     }
 
+    v3_clear_pending_intr(dev->vm);
+
+
     if (state->slave_state == ICW2) {
         struct icw1 * cw1 =  (struct icw1 *)&(state->master_icw1);
 
index acb5353..4b01c8b 100644 (file)
@@ -309,7 +309,7 @@ static int update_irq_exit_state(struct guest_info * info) {
        // Interrupt was taken fully vectored
        info->intr_state.irq_started = 0;
 
-    } else {
+    } else if ((info->intr_state.irq_started == 1) && (guest_ctrl->exit_int_info.valid == 1)) {
 #ifdef CONFIG_DEBUG_INTERRUPTS
        PrintDebug("EXIT INT INFO is set (vec=%d)\n", guest_ctrl->exit_int_info.vector);
 #endif
@@ -322,6 +322,12 @@ static int update_irq_exit_state(struct guest_info * info) {
 static int update_irq_entry_state(struct guest_info * info) {
     vmcb_ctrl_t * guest_ctrl = GET_VMCB_CTRL_AREA((vmcb_t*)(info->vmm_data));
 
+
+    if (info->intr_state.irq_pending == 0) {
+       guest_ctrl->guest_ctrl.V_IRQ = 0;
+       guest_ctrl->guest_ctrl.V_INTR_VECTOR = 0;
+    }
+    
     if (v3_excp_pending(info)) {
        uint_t excp = v3_get_excp_number(info);
        
index 656fa1e..bc36d05 100644 (file)
@@ -200,6 +200,13 @@ int v3_raise_irq(struct guest_info * info, int irq) {
 }
 
 
+void v3_clear_pending_intr(struct guest_info * core) {
+    struct v3_intr_state * intr_state = &(core->intr_state);
+
+    intr_state->irq_pending = 0;
+
+}
+
 
 v3_intr_type_t v3_intr_pending(struct guest_info * info) {
     struct v3_intr_state * intr_state = &(info->intr_state);