mirror of
https://github.com/qemu/qemu.git
synced 2024-11-27 05:43:47 +08:00
target/ppc: Add SPR TBU40
The spr TBU40 is used to set the upper 40 bits of the timebase register, present on POWER5+ and later processors. This register can only be written by the hypervisor, and cannot be read. Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20191128134700.16091-5-clg@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
32d0f0d8de
commit
f0ec31b1e2
13
hw/ppc/ppc.c
13
hw/ppc/ppc.c
@ -698,6 +698,19 @@ void cpu_ppc_store_vtb(CPUPPCState *env, uint64_t value)
|
||||
&tb_env->vtb_offset, value);
|
||||
}
|
||||
|
||||
void cpu_ppc_store_tbu40(CPUPPCState *env, uint64_t value)
|
||||
{
|
||||
ppc_tb_t *tb_env = env->tb_env;
|
||||
uint64_t tb;
|
||||
|
||||
tb = cpu_ppc_get_tb(tb_env, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL),
|
||||
tb_env->tb_offset);
|
||||
tb &= 0xFFFFFFUL;
|
||||
tb |= (value & ~0xFFFFFFUL);
|
||||
cpu_ppc_store_tb(tb_env, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL),
|
||||
&tb_env->tb_offset, tb);
|
||||
}
|
||||
|
||||
static void cpu_ppc_tb_stop (CPUPPCState *env)
|
||||
{
|
||||
ppc_tb_t *tb_env = env->tb_env;
|
||||
|
@ -1310,6 +1310,7 @@ target_ulong cpu_ppc_load_decr(CPUPPCState *env);
|
||||
void cpu_ppc_store_decr(CPUPPCState *env, target_ulong value);
|
||||
target_ulong cpu_ppc_load_hdecr(CPUPPCState *env);
|
||||
void cpu_ppc_store_hdecr(CPUPPCState *env, target_ulong value);
|
||||
void cpu_ppc_store_tbu40(CPUPPCState *env, uint64_t value);
|
||||
uint64_t cpu_ppc_load_purr(CPUPPCState *env);
|
||||
void cpu_ppc_store_purr(CPUPPCState *env, uint64_t value);
|
||||
uint32_t cpu_ppc601_load_rtcl(CPUPPCState *env);
|
||||
|
@ -672,6 +672,7 @@ DEF_HELPER_FLAGS_2(store_decr, TCG_CALL_NO_RWG, void, env, tl)
|
||||
DEF_HELPER_FLAGS_1(load_hdecr, TCG_CALL_NO_RWG, tl, env)
|
||||
DEF_HELPER_FLAGS_2(store_hdecr, TCG_CALL_NO_RWG, void, env, tl)
|
||||
DEF_HELPER_FLAGS_2(store_vtb, TCG_CALL_NO_RWG, void, env, tl)
|
||||
DEF_HELPER_FLAGS_2(store_tbu40, TCG_CALL_NO_RWG, void, env, tl)
|
||||
DEF_HELPER_2(store_hid0_601, void, env, tl)
|
||||
DEF_HELPER_3(store_403_pbr, void, env, i32, tl)
|
||||
DEF_HELPER_FLAGS_1(load_40x_pit, TCG_CALL_NO_RWG, tl, env)
|
||||
|
@ -128,6 +128,11 @@ void helper_store_vtb(CPUPPCState *env, target_ulong val)
|
||||
cpu_ppc_store_vtb(env, val);
|
||||
}
|
||||
|
||||
void helper_store_tbu40(CPUPPCState *env, target_ulong val)
|
||||
{
|
||||
cpu_ppc_store_tbu40(env, val);
|
||||
}
|
||||
|
||||
target_ulong helper_load_40x_pit(CPUPPCState *env)
|
||||
{
|
||||
return load_40x_pit(env);
|
||||
|
@ -327,6 +327,11 @@ static void spr_write_vtb(DisasContext *ctx, int sprn, int gprn)
|
||||
gen_helper_store_vtb(cpu_env, cpu_gpr[gprn]);
|
||||
}
|
||||
|
||||
static void spr_write_tbu40(DisasContext *ctx, int sprn, int gprn)
|
||||
{
|
||||
gen_helper_store_tbu40(cpu_env, cpu_gpr[gprn]);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -7853,6 +7858,16 @@ static void gen_spr_power5p_ear(CPUPPCState *env)
|
||||
0x00000000);
|
||||
}
|
||||
|
||||
static void gen_spr_power5p_tb(CPUPPCState *env)
|
||||
{
|
||||
/* TBU40 (High 40 bits of the Timebase register */
|
||||
spr_register_hv(env, SPR_TBU40, "TBU40",
|
||||
SPR_NOACCESS, SPR_NOACCESS,
|
||||
SPR_NOACCESS, SPR_NOACCESS,
|
||||
SPR_NOACCESS, &spr_write_tbu40,
|
||||
0x00000000);
|
||||
}
|
||||
|
||||
#if !defined(CONFIG_USER_ONLY)
|
||||
static void spr_write_hmer(DisasContext *ctx, int sprn, int gprn)
|
||||
{
|
||||
@ -8404,6 +8419,7 @@ static void init_proc_power5plus(CPUPPCState *env)
|
||||
gen_spr_power5p_common(env);
|
||||
gen_spr_power5p_lpar(env);
|
||||
gen_spr_power5p_ear(env);
|
||||
gen_spr_power5p_tb(env);
|
||||
|
||||
/* env variables */
|
||||
env->dcache_line_size = 128;
|
||||
@ -8516,6 +8532,7 @@ static void init_proc_POWER7(CPUPPCState *env)
|
||||
gen_spr_power5p_common(env);
|
||||
gen_spr_power5p_lpar(env);
|
||||
gen_spr_power5p_ear(env);
|
||||
gen_spr_power5p_tb(env);
|
||||
gen_spr_power6_common(env);
|
||||
gen_spr_power6_dbg(env);
|
||||
gen_spr_power7_book4(env);
|
||||
@ -8657,6 +8674,7 @@ static void init_proc_POWER8(CPUPPCState *env)
|
||||
gen_spr_power5p_common(env);
|
||||
gen_spr_power5p_lpar(env);
|
||||
gen_spr_power5p_ear(env);
|
||||
gen_spr_power5p_tb(env);
|
||||
gen_spr_power6_common(env);
|
||||
gen_spr_power6_dbg(env);
|
||||
gen_spr_power8_tce_address_control(env);
|
||||
@ -8847,6 +8865,7 @@ static void init_proc_POWER9(CPUPPCState *env)
|
||||
gen_spr_power5p_common(env);
|
||||
gen_spr_power5p_lpar(env);
|
||||
gen_spr_power5p_ear(env);
|
||||
gen_spr_power5p_tb(env);
|
||||
gen_spr_power6_common(env);
|
||||
gen_spr_power6_dbg(env);
|
||||
gen_spr_power8_tce_address_control(env);
|
||||
|
Loading…
Reference in New Issue
Block a user