Skip to contentSkip to conversation

Clear the pending interrupt on sharedpage when PIC initialized

PATCH Jiang, Yunhong 1 participant 1 message Sep 14, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 10 lines · Keir Fraser
Quoted 7 lines · Yunhong

1) I think the cpu_reset_interrupt() is a common API on qemu for hardware interrupt/exception etc,while clear the shared page is just for hardware interrupt. Of course, this function is currently used just for hardware interrupt since qemu works as a device model :) But change here may cause following code on cpu_reset_interrupt().

	if ( mask == CPU_INTERRUPT_HARD)
	     ......clear the shared page...
Quoted 5 lines

Hmm... okay, I see your point here. This would be a bit ugly.

I think placing your patch under pic_reset() is a better plan.

-- Keir

Attached is the changed patch. Please have a look on it.

Thanks
Yunhong Jiang

Quoted 6 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

# HG changeset patch
# User [email protected] # Node ID 46137991a813f3185a36d34e5af914fac3d7479f # Parent 97d4703287cd0d9abe4ec373c72afccaec399693

Clear pending interrupt on shared page when pic initialized and irq base changed

tools/ioemu/hw/i8259.c +4 -0
diff -r 97d4703287cd -r 46137991a813 tools/ioemu/hw/i8259.c
@@ -279,11 +279,15 @@
 {
     PicState *s = opaque;
     int tmp;
+    extern shared_iopage_t *shared_page;
+    unsigned long *intr;
 
     tmp = s->elcr_mask;
     memset(s, 0, sizeof(PicState));
     s->elcr_mask = tmp;
     shared_page_update();
+    intr = (unsigned long *) &(shared_page->sp_global.pic_intr[0]);
+    memset(intr, 0, INTR_LEN);
 }
 
 static void pic_ioport_write(void *opaque, uint32_t addr, uint32_t val)
xen/arch/x86/vmx_intercept.c +8 -0
diff -r 97d4703287cd -r 46137991a813 xen/arch/x86/vmx_intercept.c
@@ -227,6 +227,7 @@
     u64 *intr = &(sp->sp_global.pic_intr[0]);
     struct vmx_virpit_t *vpit = &(d->domain->arch.vmx_platform.vmx_pit);
     int rw_mode, reinit = 0;
+    int oldvec = 0;
 
     /* load init count*/
     if (p->state == STATE_IORESP_HOOK) { 
@@ -235,6 +236,7 @@
             VMX_DBG_LOG(DBG_LEVEL_1, "VMX_PIT: guest reset PIT with channel %lx!\n", (unsigned long) ((p->u.data >> 24) & 0x3) );
             rem_ac_timer(&(vpit->pit_timer));
             reinit = 1;
+            oldvec = vpit->vector;
         }
         else
             init_ac_timer(&vpit->pit_timer, pit_timer_fn, vpit, d->processor);
@@ -250,6 +252,12 @@
             vpit->period = 1000000;
         }
         vpit->vector = ((p->u.data >> 16) & 0xFF);
+
+        if( reinit && oldvec != vpit->vector){
+            clear_bit(oldvec, intr);
+            vpit->pending_intr_nr = 0;
+        }
+
         vpit->channel = ((p->u.data >> 24) & 0x3);
         vpit->first_injected = 0;
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel