Skip to content

Commit e4bc882

Browse files
Suzuki K Poulosemathieupoirier
authored andcommitted
coresight: trbe: Allow driver to choose a different alignment
The TRBE hardware mandates a minimum alignment for the TRBPTR_EL1, advertised via the TRBIDR_EL1. This is used by the driver to align the buffer write head. This patch allows the driver to choose a different alignment from that of the hardware, by decoupling the alignment tracking. This will be useful for working around errata. Cc: Mathieu Poirier <[email protected]> Cc: Anshuman Khandual <[email protected]> Cc: Mike Leach <[email protected]> Cc: Leo Yan <[email protected]> Reviewed-by: Anshuman Khandual <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
1 parent 2336a7b commit e4bc882

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

drivers/hwtracing/coresight/coresight-trbe.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,18 @@ struct trbe_buf {
6767
struct trbe_cpudata *cpudata;
6868
};
6969

70+
/*
71+
* struct trbe_cpudata: TRBE instance specific data
72+
* @trbe_flag - TRBE dirty/access flag support
73+
* @trbe_hw_align - Actual TRBE alignment required for TRBPTR_EL1.
74+
* @trbe_align - Software alignment used for the TRBPTR_EL1.
75+
* @cpu - CPU this TRBE belongs to.
76+
* @mode - Mode of current operation. (perf/disabled)
77+
* @drvdata - TRBE specific drvdata
78+
*/
7079
struct trbe_cpudata {
7180
bool trbe_flag;
81+
u64 trbe_hw_align;
7282
u64 trbe_align;
7383
int cpu;
7484
enum cs_mode mode;
@@ -875,7 +885,7 @@ static ssize_t align_show(struct device *dev, struct device_attribute *attr, cha
875885
{
876886
struct trbe_cpudata *cpudata = dev_get_drvdata(dev);
877887

878-
return sprintf(buf, "%llx\n", cpudata->trbe_align);
888+
return sprintf(buf, "%llx\n", cpudata->trbe_hw_align);
879889
}
880890
static DEVICE_ATTR_RO(align);
881891

@@ -967,11 +977,13 @@ static void arm_trbe_probe_cpu(void *info)
967977
goto cpu_clear;
968978
}
969979

970-
cpudata->trbe_align = 1ULL << get_trbe_address_align(trbidr);
971-
if (cpudata->trbe_align > SZ_2K) {
980+
cpudata->trbe_hw_align = 1ULL << get_trbe_address_align(trbidr);
981+
if (cpudata->trbe_hw_align > SZ_2K) {
972982
pr_err("Unsupported alignment on cpu %d\n", cpu);
973983
goto cpu_clear;
974984
}
985+
986+
cpudata->trbe_align = cpudata->trbe_hw_align;
975987
cpudata->trbe_flag = get_trbe_flag_update(trbidr);
976988
cpudata->cpu = cpu;
977989
cpudata->drvdata = drvdata;

0 commit comments

Comments
 (0)