On Tue Sep 26, 2023 at 3:43 AM AEST, Glenn Miles wrote: > 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 > > Signed-off-by: Glenn Miles <mil...@linux.vnet.ibm.com> > ---
> +static inline void gen_update_branch_history(DisasContext *ctx, > + target_ulong nip, > + TCGv target, > + target_long inst_type) > { > #if defined(TARGET_PPC64) > + TCGv base; > + TCGv tmp; > + TCGv offset; > + TCGv mask; > + TCGLabel *no_update; > + > if (ctx->has_cfar) { > tcg_gen_movi_tl(cpu_cfar, nip); > } > + > + if (!ctx->has_bhrb || > + !ctx->bhrb_enable || > + inst_type == BHRB_TYPE_NORECORD) { > + return; > + } BTW while debugging what turned out to be a mismerge, I removed has_bhrb because bhrb_enable is always a subset. Shout if you have an objection. Thanks, Nick