PPC: Cuda: Use cuda timer to expose tbfreq to guest
commitb981289c493c7ddabc1cdf7de99daa24642c7739
authorAlexander Graf <agraf@suse.de>
Sun, 13 Jul 2014 20:31:53 +0000 (13 22:31 +0200)
committerAlexander Graf <agraf@suse.de>
Mon, 8 Sep 2014 10:50:52 +0000 (8 12:50 +0200)
tree1e239e4f64e013f67057eebe2ca4ca9ed360a2ca
parentcaae6c961107c4c55731a86572f9a1f53837636b
PPC: Cuda: Use cuda timer to expose tbfreq to guest

Mac OS X calibrates a number of frequencies on bootup based on reading
tb values on bootup and comparing them to via cuda timer values.

The only variable we can really steer well (thanks to KVM) is the cuda
frequency. So let's use that one to fake Mac OS X into believing the
bus frequency is tbfreq * 4. That way Mac OS X will automatically
calculate the correct timebase frequency.

With this patch and the patch set I posted earlier I can successfully
run Mac OS X 10.2, 10.3 and 10.4 guests with -M mac99 on TCG and KVM.

Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
hw/misc/macio/cuda.c
hw/misc/macio/macio.c
hw/ppc/mac.h
hw/ppc/mac_newworld.c
hw/ppc/mac_oldworld.c