mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-25 12:40:08 +00:00
dc333cd609
Our guest systems need to know by how much the timebase increases every second, so there usually is a "timebase-frequency" property in the cpu leaf of the device tree. This property is missing in OpenBIOS. With qemu, Linux's fallback timebase speed and qemu's internal timebase speed match up. With KVM, that is no longer true. The guest is running at the same timebase speed as the host. This leads to massive timing problems. On my test machine, a "sleep 2" takes about 14 seconds with KVM enabled. This patch exports the timebase frequency to OpenBIOS, so it can then put them into the device tree. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
52 lines
1.7 KiB
C
52 lines
1.7 KiB
C
/* PowerPC hardware exceptions management helpers */
|
|
typedef void (*clk_setup_cb)(void *opaque, uint32_t freq);
|
|
typedef struct clk_setup_t clk_setup_t;
|
|
struct clk_setup_t {
|
|
clk_setup_cb cb;
|
|
void *opaque;
|
|
};
|
|
static inline void clk_setup (clk_setup_t *clk, uint32_t freq)
|
|
{
|
|
if (clk->cb != NULL)
|
|
(*clk->cb)(clk->opaque, freq);
|
|
}
|
|
|
|
clk_setup_cb cpu_ppc_tb_init (CPUState *env, uint32_t freq);
|
|
/* Embedded PowerPC DCR management */
|
|
typedef uint32_t (*dcr_read_cb)(void *opaque, int dcrn);
|
|
typedef void (*dcr_write_cb)(void *opaque, int dcrn, uint32_t val);
|
|
int ppc_dcr_init (CPUState *env, int (*dcr_read_error)(int dcrn),
|
|
int (*dcr_write_error)(int dcrn));
|
|
int ppc_dcr_register (CPUState *env, int dcrn, void *opaque,
|
|
dcr_read_cb drc_read, dcr_write_cb dcr_write);
|
|
clk_setup_cb ppc_emb_timers_init (CPUState *env, uint32_t freq);
|
|
/* Embedded PowerPC reset */
|
|
void ppc40x_core_reset (CPUState *env);
|
|
void ppc40x_chip_reset (CPUState *env);
|
|
void ppc40x_system_reset (CPUState *env);
|
|
void PREP_debug_write (void *opaque, uint32_t addr, uint32_t val);
|
|
|
|
extern CPUWriteMemoryFunc * const PPC_io_write[];
|
|
extern CPUReadMemoryFunc * const PPC_io_read[];
|
|
void PPC_debug_write (void *opaque, uint32_t addr, uint32_t val);
|
|
|
|
void ppc40x_irq_init (CPUState *env);
|
|
void ppce500_irq_init (CPUState *env);
|
|
void ppc6xx_irq_init (CPUState *env);
|
|
void ppc970_irq_init (CPUState *env);
|
|
|
|
/* PPC machines for OpenBIOS */
|
|
enum {
|
|
ARCH_PREP = 0,
|
|
ARCH_MAC99,
|
|
ARCH_HEATHROW,
|
|
ARCH_MAC99_U3,
|
|
};
|
|
|
|
#define FW_CFG_PPC_WIDTH (FW_CFG_ARCH_LOCAL + 0x00)
|
|
#define FW_CFG_PPC_HEIGHT (FW_CFG_ARCH_LOCAL + 0x01)
|
|
#define FW_CFG_PPC_DEPTH (FW_CFG_ARCH_LOCAL + 0x02)
|
|
#define FW_CFG_PPC_TBFREQ (FW_CFG_ARCH_LOCAL + 0x03)
|
|
|
|
#define PPC_SERIAL_MM_BAUDBASE 399193
|