mac_via: remove VIA1 timer optimisations
commit30ca7eddc486646fa19c9619fcf233ceaa65e28c
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Thu, 11 Mar 2021 10:05:05 +0000 (11 10:05 +0000)
committerLaurent Vivier <laurent@vivier.eu>
Tue, 16 Mar 2021 20:41:37 +0000 (16 21:41 +0100)
treed0869e6d574b00d86499cdec9a9dd6d17b73fb39
parent82ff856fe7f6bc6dfba2c60ba6ec24e045696562
mac_via: remove VIA1 timer optimisations

The original implementation of the Macintosh VIA devices in commit 6dca62a000
"hw/m68k: add VIA support" used timer optimisations to reduce high CPU usage on
the host when booting Linux. These optimisations worked by waiting until VIA1
port B was accessed before re-arming the timers.

The MacOS toolbox ROM constantly writes to VIA1 port B which calls
via1_one_second_update() and via1_sixty_hz_update() to calculate the new expiry
time, causing the timers to constantly reset and never fire. The effect of this
is that the Ticks (0x16a) global variable holding the number of 60Hz timer ticks
since reset is never incremented by the interrupt causing time to stand still.

Whilst the code was introduced as a performance optimisation, it is likely that
the high CPU usage was actually caused by the incorrect 60Hz timer interval
fixed in the previous patch. Remove the optimisation to keep everything simple
and enable the MacOS toolbox ROM to start keeping time.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20210311100505.22596-8-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
hw/misc/mac_via.c