mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
target/ppc: Add recording of taken branches to BHRB
This commit continues adding support for the Branch History Rolling Buffer (BHRB) as is provided starting with the P8 processor and continuing with its successors. This commit is limited to the recording and filtering of taken branches. The following changes were made: - Enabled functionality on P10 processors only due to performance impact seen with P8 and P9 where it is not disabled for non problem state branches. - Added a BHRB buffer for storing branch instruction and target addresses for taken branches - Renamed gen_update_cfar to gen_update_branch_history and added a 'target' parameter to hold the branch target address and 'inst_type' parameter to use for filtering - Added TCG code to gen_update_branch_history that stores data to the BHRB and updates the BHRB offset. - Added BHRB resource initialization and reset functions Reviewed-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Glenn Miles <milesg@linux.vnet.ibm.com> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
This commit is contained in:
parent
a7138e28a2
commit
4de4a4705f
6 changed files with 185 additions and 8 deletions
|
@ -6142,6 +6142,28 @@ POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data)
|
|||
pcc->l1_icache_size = 0x8000;
|
||||
}
|
||||
|
||||
static void bhrb_init_state(CPUPPCState *env, target_long num_entries_log2)
|
||||
{
|
||||
if (env->flags & POWERPC_FLAG_BHRB) {
|
||||
if (num_entries_log2 > BHRB_MAX_NUM_ENTRIES_LOG2) {
|
||||
num_entries_log2 = BHRB_MAX_NUM_ENTRIES_LOG2;
|
||||
}
|
||||
env->bhrb_num_entries = 1 << num_entries_log2;
|
||||
env->bhrb_base = (intptr_t)&env->bhrb[0];
|
||||
env->bhrb_offset_mask = (env->bhrb_num_entries * sizeof(uint64_t)) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void bhrb_reset_state(CPUPPCState *env)
|
||||
{
|
||||
if (env->flags & POWERPC_FLAG_BHRB) {
|
||||
env->bhrb_offset = 0;
|
||||
env->bhrb_filter = 0;
|
||||
memset(env->bhrb, 0, sizeof(env->bhrb));
|
||||
}
|
||||
}
|
||||
|
||||
#define POWER8_BHRB_ENTRIES_LOG2 5
|
||||
static void init_proc_POWER8(CPUPPCState *env)
|
||||
{
|
||||
/* Common Registers */
|
||||
|
@ -6183,6 +6205,8 @@ static void init_proc_POWER8(CPUPPCState *env)
|
|||
env->dcache_line_size = 128;
|
||||
env->icache_line_size = 128;
|
||||
|
||||
bhrb_init_state(env, POWER8_BHRB_ENTRIES_LOG2);
|
||||
|
||||
/* Allocate hardware IRQ controller */
|
||||
init_excp_POWER8(env);
|
||||
ppcPOWER7_irq_init(env_archcpu(env));
|
||||
|
@ -6307,6 +6331,7 @@ static struct ppc_radix_page_info POWER9_radix_page_info = {
|
|||
};
|
||||
#endif /* CONFIG_USER_ONLY */
|
||||
|
||||
#define POWER9_BHRB_ENTRIES_LOG2 5
|
||||
static void init_proc_POWER9(CPUPPCState *env)
|
||||
{
|
||||
/* Common Registers */
|
||||
|
@ -6357,6 +6382,8 @@ static void init_proc_POWER9(CPUPPCState *env)
|
|||
env->dcache_line_size = 128;
|
||||
env->icache_line_size = 128;
|
||||
|
||||
bhrb_init_state(env, POWER9_BHRB_ENTRIES_LOG2);
|
||||
|
||||
/* Allocate hardware IRQ controller */
|
||||
init_excp_POWER9(env);
|
||||
ppcPOWER9_irq_init(env_archcpu(env));
|
||||
|
@ -6497,6 +6524,7 @@ static struct ppc_radix_page_info POWER10_radix_page_info = {
|
|||
};
|
||||
#endif /* !CONFIG_USER_ONLY */
|
||||
|
||||
#define POWER10_BHRB_ENTRIES_LOG2 5
|
||||
static void init_proc_POWER10(CPUPPCState *env)
|
||||
{
|
||||
/* Common Registers */
|
||||
|
@ -6546,6 +6574,8 @@ static void init_proc_POWER10(CPUPPCState *env)
|
|||
env->dcache_line_size = 128;
|
||||
env->icache_line_size = 128;
|
||||
|
||||
bhrb_init_state(env, POWER10_BHRB_ENTRIES_LOG2);
|
||||
|
||||
/* Allocate hardware IRQ controller */
|
||||
init_excp_POWER10(env);
|
||||
ppcPOWER9_irq_init(env_archcpu(env));
|
||||
|
@ -6650,7 +6680,8 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data)
|
|||
pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
|
||||
POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
|
||||
POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR |
|
||||
POWERPC_FLAG_VSX | POWERPC_FLAG_SCV;
|
||||
POWERPC_FLAG_VSX | POWERPC_FLAG_SCV |
|
||||
POWERPC_FLAG_BHRB;
|
||||
pcc->l1_dcache_size = 0x8000;
|
||||
pcc->l1_icache_size = 0x8000;
|
||||
}
|
||||
|
@ -7222,6 +7253,10 @@ static void ppc_cpu_reset_hold(Object *obj, ResetType type)
|
|||
}
|
||||
env->spr[i] = spr->default_value;
|
||||
}
|
||||
|
||||
#if defined(TARGET_PPC64)
|
||||
bhrb_reset_state(env);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue