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)]
palacios/include/palacios/vmm_intr.h
palacios/src/devices/8259a.c
palacios/src/palacios/svm.c
palacios/src/palacios/vmm_intr.c

index 2a7c294..8cc9ae1 100644 (file)
@@ -89,6 +89,7 @@ struct intr_router_ops {
     int (*lower_intr)(struct v3_vm_info * vm, void * private_data, int irq);
 };
 
+void v3_clear_pending_intr(struct guest_info * core);
 
 
 int v3_register_intr_controller(struct guest_info * info, struct intr_ctrl_ops * ops, void * priv_data);
index e7d59be..325f416 100644 (file)
@@ -421,6 +421,8 @@ static int write_master_port1(struct guest_info * core, ushort_t port, void * sr
         return -1;
     }
 
+    v3_clear_pending_intr(core);
+
     if (IS_ICW1(cw)) {
 
         PrintDebug("8259 PIC: Setting ICW1 = %x (wr_Master1)\n", cw);
@@ -483,12 +485,16 @@ static int write_master_port2(struct guest_info * core, ushort_t port, void * sr
         return -1;
     }
 
+    v3_clear_pending_intr(core);
+
     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(struct guest_info * core, ushort_t port, void * sr
             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(struct guest_info * core, ushort_t port, void * src
        return -1;
     }
 
+    v3_clear_pending_intr(core);
+
     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(struct guest_info * core, ushort_t port, void * src
         return -1;
     }
 
+    v3_clear_pending_intr(core);
+
+
     if (state->slave_state == ICW2) {
         struct icw1 * cw1 =  (struct icw1 *)&(state->master_icw1);
 
index 1a1cf35..aeed691 100644 (file)
@@ -306,7 +306,7 @@ static int update_irq_exit_state(struct guest_info * info) {
        // Interrupt was taken fully vectored
        info->intr_core_state.irq_started = 0;
 
-    } else {
+    } else if ((info->intr_core_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
@@ -319,6 +319,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_core_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 87b6802..1397c07 100644 (file)
@@ -228,6 +228,13 @@ int v3_raise_irq(struct v3_vm_info * vm, int irq) {
 }
 
 
+void v3_clear_pending_intr(struct guest_info * core) {
+    struct v3_intr_core_state * intr_state = &(core->intr_core_state);
+
+    intr_state->irq_pending = 0;
+
+}
+
 
 v3_intr_type_t v3_intr_pending(struct guest_info * info) {
     struct v3_intr_core_state * intr_state = &(info->intr_core_state);