# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 1cdc469bf78d8807a4b11737b851986b860fc179
# Parent b9b120c7631a9693ca015ec35c9a5fbaedd9a6f8
Clear pending interrupt on shared page when pic initialized
and irq base changed.
Signed-off-by: Yunhong Jiang <yunhong.jiang@xxxxxxxxx>
diff -r b9b120c7631a -r 1cdc469bf78d tools/ioemu/hw/i8259.c
--- a/tools/ioemu/hw/i8259.c Wed Sep 14 13:13:10 2005
+++ b/tools/ioemu/hw/i8259.c Wed Sep 14 13:28:45 2005
@@ -128,21 +128,23 @@
/* pic[1] is connected to pin2 of pic[0] */
#define CASCADE_IRQ 2
-static void shared_page_update()
-{
- extern shared_iopage_t *shared_page;
- uint8_t * pmask = (uint8_t *)&(shared_page->sp_global.pic_mask[0]);
- int index;
+extern shared_iopage_t *shared_page;
+
+static void xen_update_shared_imr(void)
+{
+ uint8_t *pmask = (uint8_t *)shared_page->sp_global.pic_mask;
+ int index;
index = pics[0].irq_base/8;
pmask[index] = pics[0].imr;
+
index = pics[1].irq_base/8;
-
- if ( pics[0].imr & (1 << CASCADE_IRQ) ) {
- pmask[index] = 0xff;
- } else {
- pmask[index] = pics[1].imr;
- }
+ pmask[index] = (pics[0].imr & (1 << CASCADE_IRQ)) ? 0xff : pics[1].imr;
+}
+
+static void xen_clear_shared_irr(void)
+{
+ memset(shared_page->sp_global.pic_intr, 0, INTR_LEN);
}
/* raise irq to CPU if necessary. must be called every time the active
@@ -174,7 +176,8 @@
#endif
cpu_interrupt(cpu_single_env, CPU_INTERRUPT_HARD);
}
- shared_page_update();
+
+ xen_update_shared_imr();
}
#ifdef DEBUG_IRQ_LATENCY
@@ -283,7 +286,9 @@
tmp = s->elcr_mask;
memset(s, 0, sizeof(PicState));
s->elcr_mask = tmp;
- shared_page_update();
+
+ xen_update_shared_imr();
+ xen_clear_shared_irr();
}
static void pic_ioport_write(void *opaque, uint32_t addr, uint32_t val)
diff -r b9b120c7631a -r 1cdc469bf78d xen/arch/x86/vmx_intercept.c
--- a/xen/arch/x86/vmx_intercept.c Wed Sep 14 13:13:10 2005
+++ b/xen/arch/x86/vmx_intercept.c Wed Sep 14 13:28:45 2005
@@ -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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|