@@ -31,6 +31,7 @@
#include "hpet_emul.h"
#include "sysbus.h"
#include "mc146818rtc.h"
+#include "sysemu.h"
//#define HPET_DEBUG
#ifdef HPET_DEBUG
@@ -176,11 +177,12 @@ static inline uint64_t hpet_calculate_diff(HPETTimer *t, uint64_t current)
}
}
-static void update_irq(struct HPETTimer *timer, int set)
+static int update_irq(struct HPETTimer *timer, int set)
{
uint64_t mask;
HPETState *s;
int route;
+ int irq_delivered = 1;
if (timer->tn <= 1 && hpet_in_legacy_mode(timer->state)) {
/* if LegacyReplacementRoute bit is set, HPET specification requires
@@ -205,8 +207,17 @@ static void update_irq(struct HPETTimer *timer, int set)
qemu_irq_raise(s->irqs[route]);
} else {
s->isr &= ~mask;
- qemu_irq_pulse(s->irqs[route]);
+ if (s->driftfix && target_get_irq_delivered
+ && target_reset_irq_delivered) {
+ target_reset_irq_delivered();
+ qemu_irq_raise(s->irqs[route]);
+ irq_delivered = target_get_irq_delivered();
+ qemu_irq_lower(s->irqs[route]);
+ } else {
+ qemu_irq_pulse(s->irqs[route]);
+ }
}
+ return irq_delivered;
}
static void hpet_pre_save(void *opaque)
update_irq() uses a similar method as in 'rtc_td_hack' to detect coalesced interrupts. The function entry addresses are retrieved from 'target_get_irq_delivered' and 'target_reset_irq_delivered'. Signed-off-by: Ulrich Obergfell <uobergfe@redhat.com> --- hw/hpet.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-)