提交 437fafa1 编写于 作者: J James Clark 提交者: Zhong Jinghua

perf cs-etm: Refactor initialisation of decoder params.

mainline inclusion
from mainline-v5.14-rc4
commit 991f69e9
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I636PS
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=991f69e9e0bb33e4917485bead62b51f0afefac0

--------------------------------------------------------------------------

The initialisation of the decoder params is duplicated between
creation of the packet printer and packet decoder. Put them both
into one function so that future changes only need to be made in one
place.
Reviewed-by: NLeo Yan <leo.yan@linaro.org>
Signed-off-by: NJames Clark <james.clark@arm.com>
Acked-by: NSuzuki Poulouse <suzuki.poulose@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Link: https //lore.kernel.org/r/20210806134109.1182235-2-james.clark@arm.com
Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: NJunhao He <hejunhao3@huawei.com>
上级 4f0091a3
......@@ -227,55 +227,6 @@ cs_etm_decoder__init_raw_frame_logging(
}
#endif
static int cs_etm_decoder__create_packet_printer(struct cs_etm_decoder *decoder,
const char *decoder_name,
void *trace_config)
{
u8 csid;
if (ocsd_dt_create_decoder(decoder->dcd_tree, decoder_name,
OCSD_CREATE_FLG_PACKET_PROC,
trace_config, &csid))
return -1;
if (ocsd_dt_set_pkt_protocol_printer(decoder->dcd_tree, csid, 0))
return -1;
return 0;
}
static int
cs_etm_decoder__create_etm_packet_printer(struct cs_etm_trace_params *t_params,
struct cs_etm_decoder *decoder)
{
const char *decoder_name;
ocsd_etmv3_cfg config_etmv3;
ocsd_etmv4_cfg trace_config_etmv4;
void *trace_config;
switch (t_params->protocol) {
case CS_ETM_PROTO_ETMV3:
case CS_ETM_PROTO_PTM:
cs_etm_decoder__gen_etmv3_config(t_params, &config_etmv3);
decoder_name = (t_params->protocol == CS_ETM_PROTO_ETMV3) ?
OCSD_BUILTIN_DCD_ETMV3 :
OCSD_BUILTIN_DCD_PTM;
trace_config = &config_etmv3;
break;
case CS_ETM_PROTO_ETMV4i:
cs_etm_decoder__gen_etmv4_config(t_params, &trace_config_etmv4);
decoder_name = OCSD_BUILTIN_DCD_ETMV4I;
trace_config = &trace_config_etmv4;
break;
default:
return -1;
}
return cs_etm_decoder__create_packet_printer(decoder,
decoder_name,
trace_config);
}
static ocsd_datapath_resp_t
cs_etm_decoder__do_soft_timestamp(struct cs_etm_queue *etmq,
struct cs_etm_packet_queue *packet_queue,
......@@ -631,9 +582,10 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer(
return resp;
}
static int cs_etm_decoder__create_etm_packet_decoder(
struct cs_etm_trace_params *t_params,
struct cs_etm_decoder *decoder)
static int
cs_etm_decoder__create_etm_decoder(struct cs_etm_decoder_params *d_params,
struct cs_etm_trace_params *t_params,
struct cs_etm_decoder *decoder)
{
const char *decoder_name;
ocsd_etmv3_cfg config_etmv3;
......@@ -659,31 +611,30 @@ static int cs_etm_decoder__create_etm_packet_decoder(
return -1;
}
if (ocsd_dt_create_decoder(decoder->dcd_tree,
decoder_name,
OCSD_CREATE_FLG_FULL_DECODER,
trace_config, &csid))
return -1;
if (d_params->operation == CS_ETM_OPERATION_DECODE) {
if (ocsd_dt_create_decoder(decoder->dcd_tree,
decoder_name,
OCSD_CREATE_FLG_FULL_DECODER,
trace_config, &csid))
return -1;
if (ocsd_dt_set_gen_elem_outfn(decoder->dcd_tree,
cs_etm_decoder__gen_trace_elem_printer,
decoder))
return -1;
if (ocsd_dt_set_gen_elem_outfn(decoder->dcd_tree,
cs_etm_decoder__gen_trace_elem_printer,
decoder))
return -1;
return 0;
}
return 0;
} else if (d_params->operation == CS_ETM_OPERATION_PRINT) {
if (ocsd_dt_create_decoder(decoder->dcd_tree, decoder_name,
OCSD_CREATE_FLG_PACKET_PROC,
trace_config, &csid))
return -1;
static int
cs_etm_decoder__create_etm_decoder(struct cs_etm_decoder_params *d_params,
struct cs_etm_trace_params *t_params,
struct cs_etm_decoder *decoder)
{
if (d_params->operation == CS_ETM_OPERATION_PRINT)
return cs_etm_decoder__create_etm_packet_printer(t_params,
decoder);
else if (d_params->operation == CS_ETM_OPERATION_DECODE)
return cs_etm_decoder__create_etm_packet_decoder(t_params,
decoder);
if (ocsd_dt_set_pkt_protocol_printer(decoder->dcd_tree, csid, 0))
return -1;
return 0;
}
return -1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册