mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
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>
This commit is contained in:
parent
caae6c9611
commit
b981289c49
5 changed files with 34 additions and 3 deletions
|
@ -57,6 +57,7 @@ typedef struct CUDATimer {
|
|||
uint16_t counter_value;
|
||||
int64_t load_time;
|
||||
int64_t next_irq_time;
|
||||
uint64_t frequency;
|
||||
QEMUTimer *timer;
|
||||
} CUDATimer;
|
||||
|
||||
|
@ -97,6 +98,7 @@ typedef struct CUDAState {
|
|||
CUDATimer timers[2];
|
||||
|
||||
uint32_t tick_offset;
|
||||
uint64_t frequency;
|
||||
|
||||
uint8_t last_b;
|
||||
uint8_t last_acr;
|
||||
|
|
|
@ -395,6 +395,7 @@ static void ppc_core99_init(MachineState *machine)
|
|||
qdev_connect_gpio_out(dev, 2, pic[0x02]); /* IDE DMA */
|
||||
qdev_connect_gpio_out(dev, 3, pic[0x0e]); /* IDE */
|
||||
qdev_connect_gpio_out(dev, 4, pic[0x03]); /* IDE DMA */
|
||||
qdev_prop_set_uint64(dev, "frequency", tbfreq);
|
||||
macio_init(macio, pic_mem, escc_bar);
|
||||
|
||||
/* We only emulate 2 out of 3 IDE controllers for now */
|
||||
|
|
|
@ -286,6 +286,7 @@ static void ppc_heathrow_init(MachineState *machine)
|
|||
qdev_connect_gpio_out(dev, 2, pic[0x02]); /* IDE-0 DMA */
|
||||
qdev_connect_gpio_out(dev, 3, pic[0x0E]); /* IDE-1 */
|
||||
qdev_connect_gpio_out(dev, 4, pic[0x03]); /* IDE-1 DMA */
|
||||
qdev_prop_set_uint64(dev, "frequency", tbfreq);
|
||||
macio_init(macio, pic_mem, escc_bar);
|
||||
|
||||
macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue