#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__
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);
};
}
-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) {
}
-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) {
-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)) ||
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;
/* 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)) {
/* 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);
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);
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
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;
-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;
}
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));
}
}
/* 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;
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;
}
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);
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);
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;
}
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;
// 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);