Skip to content

Commit

Permalink
coresight: etm4x: Run arch feature detection on the CPU
Browse files Browse the repository at this point in the history
As we are about to add support for system register based devices,
we don't get an AMBA pid. So, the detection code could check
the system registers running on the CPU to check for the architecture
specific features. Thus we move the arch feature detection to
run on the CPU. We cannot always read the PID from the HW, as the
PID could be overridden by DT for broken devices. So, use the
PID from AMBA layer if available.

Link: https://lore.kernel.org/r/20210110224850.1880240-25-suzuki.poulose@arm.com
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: liuqi115@huawei.com
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20210201181351.1475223-27-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Suzuki K Poulose authored and Greg Kroah-Hartman committed Feb 4, 2021
1 parent c23bc38 commit e97db2c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/hwtracing/coresight/coresight-etm4x-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static u64 etm4_get_access_type(struct etmv4_config *config);
static enum cpuhp_state hp_online;

struct etm4_init_arg {
unsigned int pid;
struct etmv4_drvdata *drvdata;
struct csdev_access *csa;
};
Expand Down Expand Up @@ -884,6 +885,8 @@ static void etm4_init_arch_data(void *info)
etm4_os_unlock_csa(drvdata, csa);
etm4_cs_unlock(drvdata, csa);

etm4_check_arch_features(drvdata, init_arg->pid);

/* find all capabilities of the tracing unit */
etmidr0 = etm4x_relaxed_read32(csa, TRCIDR0);

Expand Down Expand Up @@ -1750,6 +1753,7 @@ static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid)

init_arg.drvdata = drvdata;
init_arg.csa = &desc.access;
init_arg.pid = etm_pid;

if (smp_call_function_single(drvdata->cpu,
etm4_init_arch_data, &init_arg, 1))
Expand Down Expand Up @@ -1794,8 +1798,6 @@ static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid)
drvdata->boot_enable = true;
}

etm4_check_arch_features(drvdata, etm_pid);

return 0;
}

Expand Down

0 comments on commit e97db2c

Please sign in to comment.