Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

coresight: etm4x: Fix number of resources check for ETM 4.3 and above

The initialisation code checks TRCIDR4 to determine the number of resource
selectors available on the system. Since ETM v 4.3, the value 0 has a
different meaning. This patch takes into account this change.

Signed-off-by: Mike Leach <mike.leach@linaro.org>
[Removed '.' in patch title, added stable]
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20200916191737.4001561-17-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Mike Leach and committed by
Greg Kroah-Hartman
14ea4db1 685d84a7

+10 -1
+7 -1
drivers/hwtracing/coresight/coresight-etm4x.c
··· 742 742 * The number of resource pairs conveyed by the HW starts at 0, i.e a 743 743 * value of 0x0 indicate 1 resource pair, 0x1 indicate two and so on. 744 744 * As such add 1 to the value of NUMRSPAIR for a better representation. 745 + * 746 + * For ETM v4.3 and later, 0x0 means 0, and no pairs are available - 747 + * the default TRUE and FALSE resource selectors are omitted. 748 + * Otherwise for values 0x1 and above the number is N + 1 as per v4.2. 745 749 */ 746 - drvdata->nr_resource = BMVAL(etmidr4, 16, 19) + 1; 750 + drvdata->nr_resource = BMVAL(etmidr4, 16, 19); 751 + if ((drvdata->arch < ETM4X_ARCH_4V3) || (drvdata->nr_resource > 0)) 752 + drvdata->nr_resource += 1; 747 753 /* 748 754 * NUMSSCC, bits[23:20] the number of single-shot 749 755 * comparator control for tracing. Read any status regs as these
+3
drivers/hwtracing/coresight/coresight-etm4x.h
··· 200 200 /* NS MON (EL3) mode never implemented */ 201 201 #define ETM_EXLEVEL_NS_VICTLR_MASK GENMASK(22, 20) 202 202 203 + /* Interpretation of resource numbers change at ETM v4.3 architecture */ 204 + #define ETM4X_ARCH_4V3 0x43 205 + 203 206 /** 204 207 * struct etmv4_config - configuration information related to an ETMv4 205 208 * @mode: Controls various modes supported by this ETM.