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.


apic fix
[palacios.git] / palacios / src / devices / apic.c
index 164970e..4823cb6 100644 (file)
@@ -239,7 +239,7 @@ struct apic_state {
     uint8_t trig_mode_reg[32];
 
     struct {
-       int (*ack)(struct guest_info * core, uint8_t irq, void * private_data);
+       int (*ack)(struct guest_info * core, uint32_t irq, void * private_data);
        void * private_data;
     } irq_ack_cbs[256];
 
@@ -422,6 +422,9 @@ static int activate_apic_irq(struct apic_state * apic, uint32_t irq_num,
 
     if (*en_location & flag) {
        *req_location |= flag;
+       apic->irq_ack_cbs[irq_num].ack = ack;
+       apic->irq_ack_cbs[irq_num].private_data = private_data;
+
        return 1;
     } else {
        PrintDebug("apic %u: core %d: Interrupt  not enabled... %.2x\n", 
@@ -545,7 +548,7 @@ static int get_highest_irr(struct apic_state * apic) {
 
 
 
-static int apic_do_eoi(struct apic_state * apic) {
+static int apic_do_eoi(struct guest_info * core, struct apic_state * apic) {
     int isr_irq = get_highest_isr(apic);
 
     if (isr_irq != -1) {
@@ -558,6 +561,10 @@ static int apic_do_eoi(struct apic_state * apic) {
        
        *svc_location &= ~flag;
 
+       if (apic->irq_ack_cbs[isr_irq].ack) {
+           apic->irq_ack_cbs[isr_irq].ack(core, isr_irq, apic->irq_ack_cbs[isr_irq].private_data);
+       }
+
 #ifdef V3_CONFIG_CRAY_XT
        
        if ((isr_irq == 238) || 
@@ -758,13 +765,10 @@ static int deliver_ipi(struct apic_state * src_apic,
 
            add_apic_irq_entry(dst_apic, ipi->vector, ipi->ack, ipi->private_data);
            
-#ifdef V3_CONFIG_MULTITHREAD_OS
            if (dst_apic != src_apic) { 
                PrintDebug(" non-local core with new interrupt, forcing it to exit now\n"); 
                v3_interrupt_cpu(dst_core->vm_info, dst_core->pcpu_id, 0);
            }
-#endif
-
 
            break;
        }
@@ -1466,7 +1470,7 @@ static int apic_write(struct guest_info * core, addr_t guest_addr, void * src, u
            // Action Registers
        case EOI_OFFSET:
            // do eoi 
-           apic_do_eoi(apic);
+           apic_do_eoi(core, apic);
            break;
 
        case INT_CMD_LO_OFFSET: {