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: Change functions to accept the coresight_path

Modify following functions to accept the coresight_path. Devices in the path
can read data from coresight_path if needed.
- coresight_enable_path
- coresight_disable_path
- coresight_get_source
- coresight_get_sink
- coresight_enable_helpers
- coresight_disable_helpers

Signed-off-by: Jie Gan <quic_jiegan@quicinc.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250303032931.2500935-8-quic_jiegan@quicinc.com

authored by

Jie Gan and committed by
Suzuki K Poulose
080ee83c 7b365f05

+32 -33
+19 -18
drivers/hwtracing/coresight/coresight-core.c
··· 77 77 } 78 78 EXPORT_SYMBOL_GPL(coresight_get_percpu_sink); 79 79 80 - static struct coresight_device *coresight_get_source(struct list_head *path) 80 + static struct coresight_device *coresight_get_source(struct coresight_path *path) 81 81 { 82 82 struct coresight_device *csdev; 83 83 84 84 if (!path) 85 85 return NULL; 86 86 87 - csdev = list_first_entry(path, struct coresight_node, link)->csdev; 87 + csdev = list_first_entry(&path->path_list, struct coresight_node, link)->csdev; 88 88 if (!coresight_is_device_source(csdev)) 89 89 return NULL; 90 90 ··· 333 333 return helper_ops(csdev)->enable(csdev, mode, data); 334 334 } 335 335 336 - static void coresight_disable_helper(struct coresight_device *csdev) 336 + static void coresight_disable_helper(struct coresight_device *csdev, void *data) 337 337 { 338 - helper_ops(csdev)->disable(csdev, NULL); 338 + helper_ops(csdev)->disable(csdev, data); 339 339 } 340 340 341 - static void coresight_disable_helpers(struct coresight_device *csdev) 341 + static void coresight_disable_helpers(struct coresight_device *csdev, void *data) 342 342 { 343 343 int i; 344 344 struct coresight_device *helper; ··· 346 346 for (i = 0; i < csdev->pdata->nr_outconns; ++i) { 347 347 helper = csdev->pdata->out_conns[i]->dest_dev; 348 348 if (helper && coresight_is_helper(helper)) 349 - coresight_disable_helper(helper); 349 + coresight_disable_helper(helper, data); 350 350 } 351 351 } 352 352 ··· 363 363 void coresight_disable_source(struct coresight_device *csdev, void *data) 364 364 { 365 365 source_ops(csdev)->disable(csdev, data); 366 - coresight_disable_helpers(csdev); 366 + coresight_disable_helpers(csdev, NULL); 367 367 } 368 368 EXPORT_SYMBOL_GPL(coresight_disable_source); 369 369 ··· 372 372 * @nd in the list. If @nd is NULL, all the components, except the SOURCE are 373 373 * disabled. 374 374 */ 375 - static void coresight_disable_path_from(struct list_head *path, 375 + static void coresight_disable_path_from(struct coresight_path *path, 376 376 struct coresight_node *nd) 377 377 { 378 378 u32 type; 379 379 struct coresight_device *csdev, *parent, *child; 380 380 381 381 if (!nd) 382 - nd = list_first_entry(path, struct coresight_node, link); 382 + nd = list_first_entry(&path->path_list, struct coresight_node, link); 383 383 384 - list_for_each_entry_continue(nd, path, link) { 384 + list_for_each_entry_continue(nd, &path->path_list, link) { 385 385 csdev = nd->csdev; 386 386 type = csdev->type; 387 387 ··· 419 419 } 420 420 421 421 /* Disable all helpers adjacent along the path last */ 422 - coresight_disable_helpers(csdev); 422 + coresight_disable_helpers(csdev, path); 423 423 } 424 424 } 425 425 426 - void coresight_disable_path(struct list_head *path) 426 + void coresight_disable_path(struct coresight_path *path) 427 427 { 428 428 coresight_disable_path_from(path, NULL); 429 429 } ··· 448 448 return 0; 449 449 } 450 450 451 - int coresight_enable_path(struct list_head *path, enum cs_mode mode, 451 + int coresight_enable_path(struct coresight_path *path, enum cs_mode mode, 452 452 void *sink_data) 453 453 { 454 454 int ret = 0; ··· 458 458 struct coresight_device *source; 459 459 460 460 source = coresight_get_source(path); 461 - list_for_each_entry_reverse(nd, path, link) { 461 + list_for_each_entry_reverse(nd, &path->path_list, link) { 462 462 csdev = nd->csdev; 463 463 type = csdev->type; 464 464 465 465 /* Enable all helpers adjacent to the path first */ 466 - ret = coresight_enable_helpers(csdev, mode, sink_data); 466 + ret = coresight_enable_helpers(csdev, mode, path); 467 467 if (ret) 468 468 goto err; 469 469 /* ··· 511 511 goto out; 512 512 } 513 513 514 - struct coresight_device *coresight_get_sink(struct list_head *path) 514 + struct coresight_device *coresight_get_sink(struct coresight_path *path) 515 515 { 516 516 struct coresight_device *csdev; 517 517 518 518 if (!path) 519 519 return NULL; 520 520 521 - csdev = list_last_entry(path, struct coresight_node, link)->csdev; 521 + csdev = list_last_entry(&path->path_list, struct coresight_node, link)->csdev; 522 522 if (csdev->type != CORESIGHT_DEV_TYPE_SINK && 523 523 csdev->type != CORESIGHT_DEV_TYPE_LINKSINK) 524 524 return NULL; 525 525 526 526 return csdev; 527 527 } 528 + EXPORT_SYMBOL_GPL(coresight_get_sink); 528 529 529 530 u32 coresight_get_sink_id(struct coresight_device *csdev) 530 531 { ··· 681 680 void coresight_path_assign_trace_id(struct coresight_path *path, 682 681 enum cs_mode mode) 683 682 { 684 - struct coresight_device *sink = coresight_get_sink(&path->path_list); 683 + struct coresight_device *sink = coresight_get_sink(path); 685 684 struct coresight_node *nd; 686 685 int trace_id; 687 686
+7 -9
drivers/hwtracing/coresight/coresight-etm-perf.c
··· 197 197 int cpu; 198 198 cpumask_t *mask = &event_data->mask; 199 199 struct coresight_device *sink; 200 - struct coresight_path *path; 201 200 202 201 if (!event_data->snk_config) 203 202 return; ··· 205 206 return; 206 207 207 208 cpu = cpumask_first(mask); 208 - path = etm_event_cpu_path(event_data, cpu); 209 - sink = coresight_get_sink(&path->path_list); 209 + sink = coresight_get_sink(etm_event_cpu_path(event_data, cpu)); 210 210 sink_ops(sink)->free_buffer(event_data->snk_config); 211 211 } 212 212 ··· 230 232 231 233 ppath = etm_event_cpu_path_ptr(event_data, cpu); 232 234 if (!(IS_ERR_OR_NULL(*ppath))) { 233 - struct coresight_device *sink = coresight_get_sink(&((*ppath)->path_list)); 235 + struct coresight_device *sink = coresight_get_sink(*ppath); 234 236 235 237 /* 236 238 * Mark perf event as done for trace id allocator, but don't call ··· 492 494 493 495 path = etm_event_cpu_path(event_data, cpu); 494 496 /* We need a sink, no need to continue without one */ 495 - sink = coresight_get_sink(&path->path_list); 497 + sink = coresight_get_sink(path); 496 498 if (WARN_ON_ONCE(!sink)) 497 499 goto fail_end_stop; 498 500 499 501 /* Nothing will happen without a path */ 500 - if (coresight_enable_path(&path->path_list, CS_MODE_PERF, handle)) 502 + if (coresight_enable_path(path, CS_MODE_PERF, handle)) 501 503 goto fail_end_stop; 502 504 503 505 /* Finally enable the tracer */ ··· 529 531 return; 530 532 531 533 fail_disable_path: 532 - coresight_disable_path(&path->path_list); 534 + coresight_disable_path(path); 533 535 fail_end_stop: 534 536 /* 535 537 * Check if the handle is still associated with the event, ··· 594 596 if (!path) 595 597 return; 596 598 597 - sink = coresight_get_sink(&path->path_list); 599 + sink = coresight_get_sink(path); 598 600 if (!sink) 599 601 return; 600 602 ··· 638 640 } 639 641 640 642 /* Disabling the path make its elements available to other sessions */ 641 - coresight_disable_path(&path->path_list); 643 + coresight_disable_path(path); 642 644 } 643 645 644 646 static int etm_event_add(struct perf_event *event, int mode)
+3 -3
drivers/hwtracing/coresight/coresight-priv.h
··· 132 132 } while (0); 133 133 } 134 134 135 - void coresight_disable_path(struct list_head *path); 136 - int coresight_enable_path(struct list_head *path, enum cs_mode mode, 135 + void coresight_disable_path(struct coresight_path *path); 136 + int coresight_enable_path(struct coresight_path *path, enum cs_mode mode, 137 137 void *sink_data); 138 - struct coresight_device *coresight_get_sink(struct list_head *path); 138 + struct coresight_device *coresight_get_sink(struct coresight_path *path); 139 139 struct coresight_device *coresight_get_sink_by_id(u32 id); 140 140 struct coresight_device * 141 141 coresight_find_default_sink(struct coresight_device *csdev);
+3 -3
drivers/hwtracing/coresight/coresight-sysfs.c
··· 214 214 if (!IS_VALID_CS_TRACE_ID(path->trace_id)) 215 215 goto err_path; 216 216 217 - ret = coresight_enable_path(&path->path_list, CS_MODE_SYSFS, NULL); 217 + ret = coresight_enable_path(path, CS_MODE_SYSFS, NULL); 218 218 if (ret) 219 219 goto err_path; 220 220 ··· 256 256 return ret; 257 257 258 258 err_source: 259 - coresight_disable_path(&path->path_list); 259 + coresight_disable_path(path); 260 260 261 261 err_path: 262 262 coresight_release_path(path); ··· 302 302 break; 303 303 } 304 304 305 - coresight_disable_path(&path->path_list); 305 + coresight_disable_path(path); 306 306 coresight_release_path(path); 307 307 308 308 out: