[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3428fe2c-77b1-1ad4-ddf6-513eb409c284@arm.com>
Date: Fri, 23 Oct 2020 18:09:46 +0100
From: André Przywara <andre.przywara@....com>
To: Leo Yan <leo.yan@...aro.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Wei Li <liwei391@...wei.com>,
James Clark <james.clark@....com>, Al Grant <Al.Grant@....com>,
Dave Martin <Dave.Martin@....com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 08/20] perf arm-spe: Add new function
arm_spe_pkt_desc_addr()
On 22/10/2020 15:58, Leo Yan wrote:
> This patch moves out the address parsing code from arm_spe_pkt_desc()
> and uses the new introduced function arm_spe_pkt_desc_addr() to process
> address packet.
>
> Signed-off-by: Leo Yan <leo.yan@...aro.org>
Can confirm the move is correct.
Reviewed-by: Andre Przywara <andre.przywara@....com>
Cheers,
Andre
> ---
> .../arm-spe-decoder/arm-spe-pkt-decoder.c | 49 ++++++++++++-------
> 1 file changed, 30 insertions(+), 19 deletions(-)
>
> diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c b/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c
> index 6f2329990729..550cd7648c73 100644
> --- a/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c
> +++ b/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c
> @@ -267,10 +267,38 @@ static int arm_spe_pkt_snprintf(char **buf_p, size_t *blen,
> return ret;
> }
>
> +static int arm_spe_pkt_desc_addr(const struct arm_spe_pkt *packet,
> + char *buf, size_t buf_len)
> +{
> + int ns, el, idx = packet->index;
> + u64 payload = packet->payload;
> +
> + switch (idx) {
> + case 0:
> + case 1:
> + ns = !!(packet->payload & NS_FLAG);
> + el = (packet->payload & EL_FLAG) >> 61;
> + payload &= ~(0xffULL << 56);
> + return arm_spe_pkt_snprintf(&buf, &buf_len,
> + "%s 0x%llx el%d ns=%d",
> + (idx == 1) ? "TGT" : "PC", payload, el, ns);
> + case 2:
> + return arm_spe_pkt_snprintf(&buf, &buf_len,
> + "VA 0x%llx", payload);
> + case 3:
> + ns = !!(packet->payload & NS_FLAG);
> + payload &= ~(0xffULL << 56);
> + return arm_spe_pkt_snprintf(&buf, &buf_len,
> + "PA 0x%llx ns=%d", payload, ns);
> + default:
> + return 0;
> + }
> +}
> +
> int arm_spe_pkt_desc(const struct arm_spe_pkt *packet, char *buf,
> size_t buf_len)
> {
> - int ret, ns, el, idx = packet->index;
> + int ret, idx = packet->index;
> unsigned long long payload = packet->payload;
> const char *name = arm_spe_pkt_name(packet->type);
> size_t blen = buf_len;
> @@ -404,24 +432,7 @@ int arm_spe_pkt_desc(const struct arm_spe_pkt *packet, char *buf,
> case ARM_SPE_TIMESTAMP:
> return arm_spe_pkt_snprintf(&buf, &blen, "%s %lld", name, payload);
> case ARM_SPE_ADDRESS:
> - switch (idx) {
> - case 0:
> - case 1: ns = !!(packet->payload & NS_FLAG);
> - el = (packet->payload & EL_FLAG) >> 61;
> - payload &= ~(0xffULL << 56);
> - return arm_spe_pkt_snprintf(&buf, &blen,
> - "%s 0x%llx el%d ns=%d",
> - (idx == 1) ? "TGT" : "PC", payload, el, ns);
> - case 2:
> - return arm_spe_pkt_snprintf(&buf, &blen,
> - "VA 0x%llx", payload);
> - case 3: ns = !!(packet->payload & NS_FLAG);
> - payload &= ~(0xffULL << 56);
> - return arm_spe_pkt_snprintf(&buf, &blen,
> - "PA 0x%llx ns=%d", payload, ns);
> - default:
> - return 0;
> - }
> + return arm_spe_pkt_desc_addr(packet, buf, buf_len);
> case ARM_SPE_CONTEXT:
> return arm_spe_pkt_snprintf(&buf, &blen, "%s 0x%lx el%d",
> name, (unsigned long)payload, idx + 1);
>
Powered by blists - more mailing lists