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.


modified interrupt interface to pass guest_info pointer
Jack Lange [Tue, 1 Sep 2009 18:24:57 +0000 (13:24 -0500)]
palacios/include/devices/apic.h
palacios/include/palacios/vmm_intr.h
palacios/src/devices/8259a.c
palacios/src/devices/apic.c
palacios/src/devices/io_apic.c
palacios/src/palacios/vmm_intr.c

index 5a11639..f78e2a6 100644 (file)
@@ -25,7 +25,7 @@
 #include <palacios/vmm_dev_mgr.h>
 
 
-int v3_apic_raise_intr(struct vm_device * apic_dev, int intr_num);
+int v3_apic_raise_intr(struct guest_info * info, struct vm_device * apic_dev, int intr_num);
 
 
 #endif // ! __V3VEE__
index 5f44b9e..0781844 100644 (file)
@@ -76,11 +76,11 @@ int v3_lower_irq(struct guest_info * info, int irq);
 
 
 struct intr_ctrl_ops {
-    int (*intr_pending)(void * private_data);
-    int (*get_intr_number)(void * private_data);
-    int (*raise_intr)(void * private_data, int irq);
-    int (*lower_intr)(void * private_data, int irq);
-    int (*begin_irq)(void * private_data, int irq);
+    int (*intr_pending)(struct guest_info * info, void * private_data);
+    int (*get_intr_number)(struct guest_info * info, void * private_data);
+    int (*raise_intr)(struct guest_info * info, void * private_data, int irq);
+    int (*lower_intr)(struct guest_info * info, void * private_data, int irq);
+    int (*begin_irq)(struct guest_info * info, void * private_data, int irq);
 };
 
 
index 4b70979..5edec8c 100644 (file)
@@ -190,7 +190,7 @@ static void DumpPICState(struct pic_internal *p)
 }
 
 
-static int pic_raise_intr(void * private_data, int irq) {
+static int pic_raise_intr(struct guest_info * info, void * private_data, int irq) {
     struct pic_internal * state = (struct pic_internal*)private_data;
 
     if (irq == 2) {
@@ -213,9 +213,8 @@ static int pic_raise_intr(void * private_data, int irq) {
 }
 
 
-static int pic_lower_intr(void *private_data, int irq) {
-
-    struct pic_internal *state = (struct pic_internal*)private_data;
+static int pic_lower_intr(struct guest_info * info, void * private_data, int irq) {
+    struct pic_internal * state = (struct pic_internal*)private_data;
 
     PrintDebug("[pic_lower_intr] IRQ line %d now low\n", irq);
     if (irq <= 7) {
@@ -236,7 +235,7 @@ static int pic_lower_intr(void *private_data, int irq) {
 
 
 
-static int pic_intr_pending(void * private_data) {
+static int pic_intr_pending(struct guest_info * info, void * private_data) {
     struct pic_internal * state = (struct pic_internal*)private_data;
 
     if ((state->master_irr & ~(state->master_imr)) || 
@@ -247,7 +246,7 @@ static int pic_intr_pending(void * private_data) {
     return 0;
 }
 
-static int pic_get_intr_number(void * private_data) {
+static int pic_get_intr_number(struct guest_info * info, void * private_data) {
     struct pic_internal * state = (struct pic_internal *)private_data;
     int i = 0;
     int irq = -1;
@@ -290,7 +289,7 @@ static int pic_get_intr_number(void * private_data) {
 
 
 /* The IRQ number is the number returned by pic_get_intr_number(), not the pin number */
-static int pic_begin_irq(void * private_data, int irq) {
+static int pic_begin_irq(struct guest_info * info, void * private_data, int irq) {
     struct pic_internal * state = (struct pic_internal*)private_data;
     
     if ((irq >= state->master_icw2) && (irq <= state->master_icw2 + 7)) {
index 34ac432..098b87d 100644 (file)
@@ -844,7 +844,7 @@ static int apic_write(addr_t guest_addr, void * src, uint_t length, void * priv_
 /* Interrupt Controller Functions */
 
 // returns 1 if an interrupt is pending, 0 otherwise
-static int apic_intr_pending(void * private_data) {
+static int apic_intr_pending(struct guest_info * info, void * private_data) {
     struct vm_device * dev = (struct vm_device *)private_data;
     struct apic_state * apic = (struct apic_state *)dev->private_data;
     int req_irq = get_highest_irr(apic);
@@ -858,7 +858,7 @@ static int apic_intr_pending(void * private_data) {
     return 0;
 }
 
-static int apic_get_intr_number(void * private_data) {
+static int apic_get_intr_number(struct guest_info * info, void * private_data) {
     struct vm_device * dev = (struct vm_device *)private_data;
     struct apic_state * apic = (struct apic_state *)dev->private_data;
     int req_irq = get_highest_irr(apic);
@@ -873,7 +873,7 @@ static int apic_get_intr_number(void * private_data) {
     return -1;
 }
 
-static int apic_raise_intr(void * private_data, int irq) {
+static int apic_raise_intr(struct guest_info * info, void * private_data, int irq) {
 #ifdef CONFIG_CRAY_XT
     // The Seastar is connected directly to the LAPIC via LINT0 on the ICC bus
 
@@ -884,14 +884,15 @@ static int apic_raise_intr(void * private_data, int irq) {
        return activate_apic_irq(apic, irq);
     }
 #endif
+
     return 0;
 }
 
-static int apic_lower_intr(void * private_data, int irq) {
+static int apic_lower_intr(struct guest_info * info, void * private_data, int irq) {
     return 0;
 }
 
-static int apic_begin_irq(void * private_data, int irq) {
+static int apic_begin_irq(struct guest_info * info, void * private_data, int irq) {
     struct vm_device * dev = (struct vm_device *)private_data;
     struct apic_state * apic = (struct apic_state *)dev->private_data;
     int major_offset = (irq & ~0x00000007) >> 3;
@@ -914,9 +915,15 @@ static int apic_begin_irq(void * private_data, int irq) {
 
 
 
-int v3_apic_raise_intr(struct vm_device * apic_dev, int intr_num) {
+int v3_apic_raise_intr(struct guest_info * info, struct vm_device * apic_dev, int intr_num) {
     struct apic_state * apic = (struct apic_state *)apic_dev->private_data;
-    return activate_apic_irq(apic, intr_num);
+
+    if (activate_apic_irq(apic, intr_num) == -1) {
+       PrintError("Error: Could not activate apic_irq\n");
+       return -1;
+    } 
+
+    return 0;
 }
 
 
@@ -990,7 +997,7 @@ static void apic_update_time(ullong_t cpu_cycles, ullong_t cpu_freq, void * priv
        PrintDebug("Raising APIC Timer interrupt (periodic=%d) (icnt=%d) (div=%d)\n", 
                   apic->tmr_vec_tbl.tmr_mode, apic->tmr_init_cnt, shift_num);
 
-       if (apic_intr_pending(priv_data)) {
+       if (apic_intr_pending(dev->vm, priv_data)) {
            PrintDebug("Overriding pending IRQ %d\n", apic_get_intr_number(priv_data));
        }
 
index 860cf8d..3bd5902 100644 (file)
@@ -254,20 +254,20 @@ static int ioapic_write(addr_t guest_addr, void * src, uint_t length, void * pri
 }
 
 /* Interrupt controller functions */
-static int ioapic_intr_pending(void * private_data) {
+static int ioapic_intr_pending(struct guest_info * info, void * private_data) {
     return 0;
 }
 
 
-static int ioapic_get_intr_number(void * private_data) {
+static int ioapic_get_intr_number(struct guest_info * info, void * private_data) {
     return 0;
 }
 
-static int ioapic_begin_irq(void * private_data, int irq) {
+static int ioapic_begin_irq(struct guest_info * info, void * private_data, int irq) {
     return 0;
 }
 
-static int ioapic_raise_irq(void * private_data, int irq) {
+static int ioapic_raise_irq(struct guest_info * info, void * private_data, int irq) {
     struct vm_device * dev = (struct vm_device *)private_data;
     struct io_apic_state * ioapic = (struct io_apic_state *)(dev->private_data);  
     struct redir_tbl_entry * irq_entry = NULL;
@@ -281,14 +281,14 @@ static int ioapic_raise_irq(void * private_data, int irq) {
 
     if (irq_entry->mask == 0) {
        PrintDebug("IOAPIC Signalling APIC to raise INTR %d\n", irq_entry->vec);
-       v3_apic_raise_intr(ioapic->apic, irq_entry->vec);
+       v3_apic_raise_intr(info, ioapic->apic, irq_entry->vec);
     }
 
     return 0;
 }
 
 /* I don't know if we can do anything here.... */
-static int ioapic_lower_irq(void * private_data, int irq) {
+static int ioapic_lower_irq(struct guest_info * info, void * private_data, int irq) {
     return 0;
 }
 
index b823c8c..656fa1e 100644 (file)
@@ -175,7 +175,7 @@ int v3_lower_irq(struct guest_info * info, int irq) {
     addr_t irq_state = v3_lock_irqsave(intr_state->irq_lock);
 
     list_for_each_entry(ctrl, &(intr_state->controller_list), ctrl_node) {
-       ctrl->ctrl_ops->lower_intr(ctrl->priv_data, irq);
+       ctrl->ctrl_ops->lower_intr(info, ctrl->priv_data, irq);
     }
  
     v3_unlock_irqrestore(intr_state->irq_lock, irq_state);
@@ -191,7 +191,7 @@ int v3_raise_irq(struct guest_info * info, int irq) {
     addr_t irq_state = v3_lock_irqsave(intr_state->irq_lock);
 
     list_for_each_entry(ctrl, &(intr_state->controller_list), ctrl_node) {
-       ctrl->ctrl_ops->raise_intr(ctrl->priv_data, irq);
+       ctrl->ctrl_ops->raise_intr(info, ctrl->priv_data, irq);
     }
 
     v3_unlock_irqrestore(intr_state->irq_lock, irq_state);
@@ -220,7 +220,7 @@ v3_intr_type_t v3_intr_pending(struct guest_info * info) {
 
     if (ret == V3_INVALID_INTR) {
        list_for_each_entry(ctrl, &(intr_state->controller_list), ctrl_node) {
-           if (ctrl->ctrl_ops->intr_pending(ctrl->priv_data) == 1) {
+           if (ctrl->ctrl_ops->intr_pending(info, ctrl->priv_data) == 1) {
                ret = V3_EXTERNAL_IRQ;
                break;
            }
@@ -257,8 +257,8 @@ uint32_t v3_get_intr(struct guest_info * info) {
 
     if (!ret) {
        list_for_each_entry(ctrl, &(intr_state->controller_list), ctrl_node) {
-           if (ctrl->ctrl_ops->intr_pending(ctrl->priv_data)) {
-               uint_t intr_num = ctrl->ctrl_ops->get_intr_number(ctrl->priv_data);
+           if (ctrl->ctrl_ops->intr_pending(info, ctrl->priv_data)) {
+               uint_t intr_num = ctrl->ctrl_ops->get_intr_number(info, ctrl->priv_data);
                
                //      PrintDebug("[get_intr_number] intr_number = %d\n", intr_num);
                ret = intr_num;
@@ -314,7 +314,7 @@ int v3_injecting_intr(struct guest_info * info, uint_t intr_num, v3_intr_type_t
 
        //      PrintDebug("[injecting_intr] External_Irq with intr_num = %x\n", intr_num);
        list_for_each_entry(ctrl, &(intr_state->controller_list), ctrl_node) {
-           ctrl->ctrl_ops->begin_irq(ctrl->priv_data, intr_num);
+           ctrl->ctrl_ops->begin_irq(info, ctrl->priv_data, intr_num);
        }
 
        v3_unlock_irqrestore(intr_state->irq_lock, irq_state);