mos6522: fix T1 and T2 timers
commitcd8843ff25d62a0af747517289a4f330b1ae2a6e
authorLaurent Vivier <laurent@vivier.eu>
Sat, 2 Nov 2019 15:49:19 +0000 (2 16:49 +0100)
committerLaurent Vivier <lvivier@redhat.com>
Mon, 18 Nov 2019 10:50:49 +0000 (18 11:50 +0100)
tree890be52086f8d92598904f66507a35521e3fb827
parent165dc3edd7f705c6c10908860b8c72e55eadd04b
mos6522: fix T1 and T2 timers

With the Quadra 800 emulation, mos6522 timers processing can consume
until 70% of the host CPU time with an idle guest (I guess the problem
should also happen with PowerMac emulation).

On a recent system, it can be painless (except if you look at top), but
on an old host like a PowerMac G5 the guest kernel can be terribly slow
during the boot sequence (for instance, unpacking initramfs can take 15
seconds rather than only 3 seconds).

We can avoid this CPU overload by enabling QEMU internal timers only if
the mos6522 counter interrupts are enabled. Sometime the guest kernel
wants to read the counters values, but we don't need the timers to
update the counters.

With this patch applied, an idle Q800 consumes only 3% of host CPU time
(and the guest can boot in a decent time).

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20191102154919.17775-1-laurent@vivier.eu>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
hw/misc/mos6522.c