[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC] Incorrect CPU timebase-frequency and clock-frequency

From: William Hahne
Subject: [Qemu-devel] [RFC] Incorrect CPU timebase-frequency and clock-frequency in OpenBIOS
Date: Tue, 9 Aug 2011 19:02:13 -0500


I would like to apologize for not splitting up my last post. I am a Google Summer of Code student working on getting Mac OS X to work in Qemu. 

Currently the cpu device in OpenBIOS has incorrect timebase-frequency and clock-frequency properties. The Mac OS X scheduler relies on these values to calculate the length of a timeslice. Both values are taken from fw_cfg by OpenBIOS. The problem with timebase-frequency is that the value is far too high. Mac OS X depends on this value being sufficiently smaller than clock-frequency. The value for clock-frequency no longer even exists in fw_cfg and is therefore reported as 0. Mac OS X needs some value here even if it doesn't indicate an actual cpu frequency. The patch below for OpenBIOS provides some fake values that work, but since the values are hard-coded into OpenBIOS, it isn't a very nice solution. 

The best solutions I can think of are to either compute clock-frequency in OpenBIOS or have Qemu provide a value even if its purpose is only to appease Mac OS X or any other OS that depends on the value. If the timebase frequency is correct than it can be lowered otherwise it can be corrected. I am posting this RFC to get thoughts more on what to do with clock-frequency. For reference the timebase frequency is from the fw_cfg value FW_CFG_PPC_TBFREQ and clock frequency is from FW_CFG_PPC_CPUFREQ.

William Hahne

Index: arch/ppc/qemu/init.c
--- arch/ppc/qemu/init.c (revision 1041)
+++ arch/ppc/qemu/init.c (working copy)
@@ -250,12 +250,14 @@
-    PUSH(fw_cfg_read_i32(FW_CFG_PPC_TBFREQ));
+    /* XXX - Mac OS X needs valid values for timebase-frequency and clock-frequency
+       for scheduling to work. These are just temporary values and shouldn't be hardcoded here. */
+    PUSH(16600000);
-    PUSH(fw_cfg_read_i32(FW_CFG_PPC_CPUFREQ));
+    PUSH(266000000);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]