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

coresight: configuring ETF in FIFO mode when acting as link

When part of a path but not identified as a sink, the EFT has to
be configured as a link and placed in HW FIFO mode. As such when
enabling a path, call the right configuration function based on
the role the ETF if playing in this trace run.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Mathieu Poirier and committed by
Greg Kroah-Hartman
dc2c4ef1 2e499bbc

+28 -4
+28 -4
drivers/hwtracing/coresight/coresight.c
··· 265 265 266 266 void coresight_disable_path(struct list_head *path) 267 267 { 268 + u32 type; 268 269 struct coresight_node *nd; 269 270 struct coresight_device *csdev, *parent, *child; 270 271 271 272 list_for_each_entry(nd, path, link) { 272 273 csdev = nd->csdev; 274 + type = csdev->type; 273 275 274 - switch (csdev->type) { 276 + /* 277 + * ETF devices are tricky... They can be a link or a sink, 278 + * depending on how they are configured. If an ETF has been 279 + * "activated" it will be configured as a sink, otherwise 280 + * go ahead with the link configuration. 281 + */ 282 + if (type == CORESIGHT_DEV_TYPE_LINKSINK) 283 + type = (csdev == coresight_get_sink(path)) ? 284 + CORESIGHT_DEV_TYPE_SINK : 285 + CORESIGHT_DEV_TYPE_LINK; 286 + 287 + switch (type) { 275 288 case CORESIGHT_DEV_TYPE_SINK: 276 - case CORESIGHT_DEV_TYPE_LINKSINK: 277 289 coresight_disable_sink(csdev); 278 290 break; 279 291 case CORESIGHT_DEV_TYPE_SOURCE: ··· 306 294 { 307 295 308 296 int ret = 0; 297 + u32 type; 309 298 struct coresight_node *nd; 310 299 struct coresight_device *csdev, *parent, *child; 311 300 312 301 list_for_each_entry_reverse(nd, path, link) { 313 302 csdev = nd->csdev; 303 + type = csdev->type; 314 304 315 - switch (csdev->type) { 305 + /* 306 + * ETF devices are tricky... They can be a link or a sink, 307 + * depending on how they are configured. If an ETF has been 308 + * "activated" it will be configured as a sink, otherwise 309 + * go ahead with the link configuration. 310 + */ 311 + if (type == CORESIGHT_DEV_TYPE_LINKSINK) 312 + type = (csdev == coresight_get_sink(path)) ? 313 + CORESIGHT_DEV_TYPE_SINK : 314 + CORESIGHT_DEV_TYPE_LINK; 315 + 316 + switch (type) { 316 317 case CORESIGHT_DEV_TYPE_SINK: 317 - case CORESIGHT_DEV_TYPE_LINKSINK: 318 318 ret = coresight_enable_sink(csdev, mode); 319 319 if (ret) 320 320 goto err;