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

Configure Feed

Select the types of activity you want to include in your feed.

coresight: Interpret perf config with ATTR_CFG_GET_FLD()

The "config:" string construction in format_attr_contextid_show() can be
removed because it either showed the existing context1 or context2
formats which have already been generated, so can be called themselves.

The other conversions are straightforward replacements.

Tested-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20251128-james-cs-syncfreq-v8-8-4d319764cc58@linaro.org

authored by

James Clark and committed by
Suzuki K Poulose
b945d367 d633fd22

+8 -10
+8 -10
drivers/hwtracing/coresight/coresight-etm-perf.c
··· 77 77 struct device_attribute *attr, 78 78 char *page) 79 79 { 80 - int pid_fmt = ETM_OPT_CTXTID; 81 - 82 - pid_fmt = is_kernel_in_hyp_mode() ? ETM_OPT_CTXTID2 : ETM_OPT_CTXTID; 83 - return sprintf(page, "config:%d\n", pid_fmt); 80 + if (is_kernel_in_hyp_mode()) 81 + return contextid2_show(dev, attr, page); 82 + return contextid1_show(dev, attr, page); 84 83 } 85 84 86 85 static struct device_attribute format_attr_contextid = ··· 318 319 static void *etm_setup_aux(struct perf_event *event, void **pages, 319 320 int nr_pages, bool overwrite) 320 321 { 321 - u32 id, cfg_hash; 322 + u32 sink_hash, cfg_hash; 322 323 int cpu = event->cpu; 323 324 cpumask_t *mask; 324 325 struct coresight_device *sink = NULL; ··· 331 332 INIT_WORK(&event_data->work, free_event_data); 332 333 333 334 /* First get the selected sink from user space. */ 334 - if (event->attr.config2 & GENMASK_ULL(31, 0)) { 335 - id = (u32)event->attr.config2; 336 - sink = user_sink = coresight_get_sink_by_id(id); 337 - } 335 + sink_hash = ATTR_CFG_GET_FLD(&event->attr, sinkid); 336 + if (sink_hash) 337 + sink = user_sink = coresight_get_sink_by_id(sink_hash); 338 338 339 339 /* check if user wants a coresight configuration selected */ 340 - cfg_hash = (u32)((event->attr.config2 & GENMASK_ULL(63, 32)) >> 32); 340 + cfg_hash = ATTR_CFG_GET_FLD(&event->attr, configid); 341 341 if (cfg_hash) { 342 342 if (cscfg_activate_config(cfg_hash)) 343 343 goto err;