[PATCH 4/5] perf: arm_spe: Decode memory tagging properties

Leo Yan leo.yan at linaro.org
Sat Sep 26 23:19:18 EDT 2020


On Tue, Sep 22, 2020 at 11:12:24AM +0100, Andre Przywara wrote:
> When SPE records a physical address, it can additionally tag the event
> with information from the Memory Tagging architecture extension.
> 
> Decode the two additional fields in the SPE event payload.
> 
> Signed-off-by: Andre Przywara <andre.przywara at arm.com>
> ---
>  .../util/arm-spe-decoder/arm-spe-pkt-decoder.c  | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 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 943e4155b246..a033f34846a6 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
> @@ -8,13 +8,14 @@
>  #include <string.h>
>  #include <endian.h>
>  #include <byteswap.h>
> +#include <linux/bits.h>
>  
>  #include "arm-spe-pkt-decoder.h"
>  
> -#define BIT(n)		(1ULL << (n))
> -
>  #define NS_FLAG		BIT(63)
>  #define EL_FLAG		(BIT(62) | BIT(61))
> +#define CH_FLAG		BIT(62)
> +#define PAT_FLAG	GENMASK_ULL(59, 56)
>  
>  #define SPE_HEADER0_PAD			0x0
>  #define SPE_HEADER0_END			0x1
> @@ -447,10 +448,16 @@ int arm_spe_pkt_desc(const struct arm_spe_pkt *packet, char *buf,
>  			return snprintf(buf, buf_len, "%s 0x%llx el%d ns=%d",
>  				        (idx == 1) ? "TGT" : "PC", payload, el, ns);
>  		case 2:	return snprintf(buf, buf_len, "VA 0x%llx", payload);
> -		case 3:	ns = !!(packet->payload & NS_FLAG);
> +		case 3:	{
> +			int ch = !!(packet->payload & CH_FLAG);
> +			int pat = (packet->payload & PAT_FLAG) >> 56;
> +
> +			ns = !!(packet->payload & NS_FLAG);
>  			payload &= ~(0xffULL << 56);
> -			return snprintf(buf, buf_len, "PA 0x%llx ns=%d",
> -					payload, ns);
> +			return snprintf(buf, buf_len,
> +					"PA 0x%llx ns=%d ch=%d, pat=%x",
> +					payload, ns, ch, pat);
> +			}

Reviewed-by: Leo Yan <leo.yan at linaro.org>

>  		default: return 0;
>  		}
>  	case ARM_SPE_CONTEXT:
> -- 
> 2.17.1
> 



More information about the linux-arm-kernel mailing list