etr_buf 284 drivers/hwtracing/coresight/coresight-catu.c static void catu_free_etr_buf(struct etr_buf *etr_buf) etr_buf 288 drivers/hwtracing/coresight/coresight-catu.c if (!etr_buf || etr_buf->mode != ETR_MODE_CATU || !etr_buf->private) etr_buf 291 drivers/hwtracing/coresight/coresight-catu.c catu_buf = etr_buf->private; etr_buf 296 drivers/hwtracing/coresight/coresight-catu.c static ssize_t catu_get_data_etr_buf(struct etr_buf *etr_buf, u64 offset, etr_buf 299 drivers/hwtracing/coresight/coresight-catu.c struct catu_etr_buf *catu_buf = etr_buf->private; etr_buf 304 drivers/hwtracing/coresight/coresight-catu.c static void catu_sync_etr_buf(struct etr_buf *etr_buf, u64 rrp, u64 rwp) etr_buf 306 drivers/hwtracing/coresight/coresight-catu.c struct catu_etr_buf *catu_buf = etr_buf->private; etr_buf 314 drivers/hwtracing/coresight/coresight-catu.c r_offset = rrp - etr_buf->hwaddr; etr_buf 315 drivers/hwtracing/coresight/coresight-catu.c w_offset = rwp - etr_buf->hwaddr; etr_buf 317 drivers/hwtracing/coresight/coresight-catu.c if (!etr_buf->full) { etr_buf 318 drivers/hwtracing/coresight/coresight-catu.c etr_buf->len = w_offset - r_offset; etr_buf 320 drivers/hwtracing/coresight/coresight-catu.c etr_buf->len += etr_buf->size; etr_buf 322 drivers/hwtracing/coresight/coresight-catu.c etr_buf->len = etr_buf->size; etr_buf 325 drivers/hwtracing/coresight/coresight-catu.c etr_buf->offset = r_offset; etr_buf 326 drivers/hwtracing/coresight/coresight-catu.c tmc_sg_table_sync_data_range(catu_table, r_offset, etr_buf->len); etr_buf 330 drivers/hwtracing/coresight/coresight-catu.c struct etr_buf *etr_buf, int node, void **pages) etr_buf 344 drivers/hwtracing/coresight/coresight-catu.c etr_buf->size, pages); etr_buf 350 drivers/hwtracing/coresight/coresight-catu.c etr_buf->mode = ETR_MODE_CATU; etr_buf 351 drivers/hwtracing/coresight/coresight-catu.c etr_buf->private = catu_buf; etr_buf 352 drivers/hwtracing/coresight/coresight-catu.c etr_buf->hwaddr = CATU_DEFAULT_INADDR; etr_buf 412 drivers/hwtracing/coresight/coresight-catu.c struct etr_buf *etr_buf = data; etr_buf 430 drivers/hwtracing/coresight/coresight-catu.c if (etr_buf && etr_buf->mode == ETR_MODE_CATU) { etr_buf 431 drivers/hwtracing/coresight/coresight-catu.c struct catu_etr_buf *catu_buf = etr_buf->private; etr_buf 41 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *etr_buf; etr_buf 591 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *etr_buf, int node, etr_buf 605 drivers/hwtracing/coresight/coresight-tmc-etr.c flat_buf->vaddr = dma_alloc_coherent(real_dev, etr_buf->size, etr_buf 612 drivers/hwtracing/coresight/coresight-tmc-etr.c flat_buf->size = etr_buf->size; etr_buf 614 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->hwaddr = flat_buf->daddr; etr_buf 615 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->mode = ETR_MODE_FLAT; etr_buf 616 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->private = flat_buf; etr_buf 620 drivers/hwtracing/coresight/coresight-tmc-etr.c static void tmc_etr_free_flat_buf(struct etr_buf *etr_buf) etr_buf 622 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_flat_buf *flat_buf = etr_buf->private; etr_buf 633 drivers/hwtracing/coresight/coresight-tmc-etr.c static void tmc_etr_sync_flat_buf(struct etr_buf *etr_buf, u64 rrp, u64 rwp) etr_buf 639 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->offset = rrp - etr_buf->hwaddr; etr_buf 640 drivers/hwtracing/coresight/coresight-tmc-etr.c if (etr_buf->full) etr_buf 641 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->len = etr_buf->size; etr_buf 643 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->len = rwp - rrp; etr_buf 646 drivers/hwtracing/coresight/coresight-tmc-etr.c static ssize_t tmc_etr_get_data_flat_buf(struct etr_buf *etr_buf, etr_buf 649 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_flat_buf *flat_buf = etr_buf->private; etr_buf 671 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *etr_buf, int node, etr_buf 678 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->size, pages); etr_buf 681 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->hwaddr = etr_table->hwaddr; etr_buf 682 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->mode = ETR_MODE_ETR_SG; etr_buf 683 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->private = etr_table; etr_buf 687 drivers/hwtracing/coresight/coresight-tmc-etr.c static void tmc_etr_free_sg_buf(struct etr_buf *etr_buf) etr_buf 689 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_sg_table *etr_table = etr_buf->private; etr_buf 697 drivers/hwtracing/coresight/coresight-tmc-etr.c static ssize_t tmc_etr_get_data_sg_buf(struct etr_buf *etr_buf, u64 offset, etr_buf 700 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_sg_table *etr_table = etr_buf->private; etr_buf 705 drivers/hwtracing/coresight/coresight-tmc-etr.c static void tmc_etr_sync_sg_buf(struct etr_buf *etr_buf, u64 rrp, u64 rwp) etr_buf 708 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_sg_table *etr_table = etr_buf->private; etr_buf 716 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->len = 0; etr_buf 724 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->len = 0; etr_buf 728 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->offset = r_offset; etr_buf 729 drivers/hwtracing/coresight/coresight-tmc-etr.c if (etr_buf->full) etr_buf 730 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->len = etr_buf->size; etr_buf 732 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->len = ((w_offset < r_offset) ? etr_buf->size : 0) + etr_buf 734 drivers/hwtracing/coresight/coresight-tmc-etr.c tmc_sg_table_sync_data_range(table, r_offset, etr_buf->len); etr_buf 771 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *etr_buf) etr_buf 776 drivers/hwtracing/coresight/coresight-tmc-etr.c return helper_ops(catu)->enable(catu, etr_buf); etr_buf 785 drivers/hwtracing/coresight/coresight-tmc-etr.c helper_ops(catu)->disable(catu, drvdata->etr_buf); etr_buf 797 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *etr_buf, int node, etr_buf 807 drivers/hwtracing/coresight/coresight-tmc-etr.c rc = etr_buf_ops[mode]->alloc(drvdata, etr_buf, etr_buf 810 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->ops = etr_buf_ops[mode]; etr_buf 825 drivers/hwtracing/coresight/coresight-tmc-etr.c static struct etr_buf *tmc_alloc_etr_buf(struct tmc_drvdata *drvdata, etr_buf 832 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *etr_buf; etr_buf 841 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf = kzalloc(sizeof(*etr_buf), GFP_KERNEL); etr_buf 842 drivers/hwtracing/coresight/coresight-tmc-etr.c if (!etr_buf) etr_buf 845 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->size = size; etr_buf 862 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf, node, pages); etr_buf 865 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf, node, pages); etr_buf 868 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf, node, pages); etr_buf 870 drivers/hwtracing/coresight/coresight-tmc-etr.c kfree(etr_buf); etr_buf 874 drivers/hwtracing/coresight/coresight-tmc-etr.c refcount_set(&etr_buf->refcount, 1); etr_buf 876 drivers/hwtracing/coresight/coresight-tmc-etr.c (unsigned long)size >> 10, etr_buf->mode); etr_buf 877 drivers/hwtracing/coresight/coresight-tmc-etr.c return etr_buf; etr_buf 880 drivers/hwtracing/coresight/coresight-tmc-etr.c static void tmc_free_etr_buf(struct etr_buf *etr_buf) etr_buf 882 drivers/hwtracing/coresight/coresight-tmc-etr.c WARN_ON(!etr_buf->ops || !etr_buf->ops->free); etr_buf 883 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->ops->free(etr_buf); etr_buf 884 drivers/hwtracing/coresight/coresight-tmc-etr.c kfree(etr_buf); etr_buf 893 drivers/hwtracing/coresight/coresight-tmc-etr.c static ssize_t tmc_etr_buf_get_data(struct etr_buf *etr_buf, etr_buf 897 drivers/hwtracing/coresight/coresight-tmc-etr.c len = (len < (etr_buf->size - offset)) ? len : etr_buf->size - offset; etr_buf 899 drivers/hwtracing/coresight/coresight-tmc-etr.c return etr_buf->ops->get_data(etr_buf, (u64)offset, len, bufpp); etr_buf 903 drivers/hwtracing/coresight/coresight-tmc-etr.c tmc_etr_buf_insert_barrier_packet(struct etr_buf *etr_buf, u64 offset) etr_buf 908 drivers/hwtracing/coresight/coresight-tmc-etr.c len = tmc_etr_buf_get_data(etr_buf, offset, etr_buf 924 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *etr_buf = drvdata->etr_buf; etr_buf 939 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->len = 0; etr_buf 940 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->full = 0; etr_buf 944 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->full = status & TMC_STS_FULL; etr_buf 946 drivers/hwtracing/coresight/coresight-tmc-etr.c WARN_ON(!etr_buf->ops || !etr_buf->ops->sync); etr_buf 948 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->ops->sync(etr_buf, rrp, rwp); etr_buf 954 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *etr_buf = drvdata->etr_buf; etr_buf 961 drivers/hwtracing/coresight/coresight-tmc-etr.c writel_relaxed(etr_buf->size / 4, drvdata->base + TMC_RSZ); etr_buf 974 drivers/hwtracing/coresight/coresight-tmc-etr.c if (etr_buf->mode == ETR_MODE_ETR_SG) etr_buf 978 drivers/hwtracing/coresight/coresight-tmc-etr.c tmc_write_dba(drvdata, etr_buf->hwaddr); etr_buf 985 drivers/hwtracing/coresight/coresight-tmc-etr.c tmc_write_rrp(drvdata, etr_buf->hwaddr); etr_buf 986 drivers/hwtracing/coresight/coresight-tmc-etr.c tmc_write_rwp(drvdata, etr_buf->hwaddr); etr_buf 1002 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *etr_buf) etr_buf 1007 drivers/hwtracing/coresight/coresight-tmc-etr.c if (WARN_ON(!etr_buf)) etr_buf 1010 drivers/hwtracing/coresight/coresight-tmc-etr.c if ((etr_buf->mode == ETR_MODE_ETR_SG) && etr_buf 1014 drivers/hwtracing/coresight/coresight-tmc-etr.c if (WARN_ON(drvdata->etr_buf)) etr_buf 1021 drivers/hwtracing/coresight/coresight-tmc-etr.c rc = tmc_etr_enable_catu(drvdata, etr_buf); etr_buf 1026 drivers/hwtracing/coresight/coresight-tmc-etr.c drvdata->etr_buf = etr_buf; etr_buf 1048 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *etr_buf = drvdata->sysfs_buf; etr_buf 1050 drivers/hwtracing/coresight/coresight-tmc-etr.c if (pos + actual > etr_buf->len) etr_buf 1051 drivers/hwtracing/coresight/coresight-tmc-etr.c actual = etr_buf->len - pos; etr_buf 1056 drivers/hwtracing/coresight/coresight-tmc-etr.c offset = etr_buf->offset + pos; etr_buf 1057 drivers/hwtracing/coresight/coresight-tmc-etr.c if (offset >= etr_buf->size) etr_buf 1058 drivers/hwtracing/coresight/coresight-tmc-etr.c offset -= etr_buf->size; etr_buf 1059 drivers/hwtracing/coresight/coresight-tmc-etr.c return tmc_etr_buf_get_data(etr_buf, offset, actual, bufpp); etr_buf 1062 drivers/hwtracing/coresight/coresight-tmc-etr.c static struct etr_buf * etr_buf 1070 drivers/hwtracing/coresight/coresight-tmc-etr.c tmc_etr_free_sysfs_buf(struct etr_buf *buf) etr_buf 1078 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *etr_buf = drvdata->etr_buf; etr_buf 1080 drivers/hwtracing/coresight/coresight-tmc-etr.c if (WARN_ON(drvdata->sysfs_buf != etr_buf)) { etr_buf 1089 drivers/hwtracing/coresight/coresight-tmc-etr.c if (etr_buf->full) etr_buf 1090 drivers/hwtracing/coresight/coresight-tmc-etr.c tmc_etr_buf_insert_barrier_packet(etr_buf, etr_buf 1091 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf->offset); etr_buf 1120 drivers/hwtracing/coresight/coresight-tmc-etr.c drvdata->etr_buf = NULL; etr_buf 1128 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *sysfs_buf = NULL, *new_buf = NULL, *free_buf = NULL; etr_buf 1202 drivers/hwtracing/coresight/coresight-tmc-etr.c static struct etr_buf * etr_buf 1207 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *etr_buf; etr_buf 1216 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf = tmc_alloc_etr_buf(drvdata, (nr_pages << PAGE_SHIFT), etr_buf 1218 drivers/hwtracing/coresight/coresight-tmc-etr.c if (!IS_ERR(etr_buf)) etr_buf 1228 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf = tmc_alloc_etr_buf(drvdata, size, 0, node, NULL); etr_buf 1229 drivers/hwtracing/coresight/coresight-tmc-etr.c if (!IS_ERR(etr_buf)) etr_buf 1237 drivers/hwtracing/coresight/coresight-tmc-etr.c return etr_buf; etr_buf 1240 drivers/hwtracing/coresight/coresight-tmc-etr.c static struct etr_buf * etr_buf 1247 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *etr_buf; etr_buf 1269 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf = idr_find(&drvdata->idr, pid); etr_buf 1270 drivers/hwtracing/coresight/coresight-tmc-etr.c if (etr_buf) { etr_buf 1271 drivers/hwtracing/coresight/coresight-tmc-etr.c refcount_inc(&etr_buf->refcount); etr_buf 1273 drivers/hwtracing/coresight/coresight-tmc-etr.c return etr_buf; etr_buf 1279 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf = alloc_etr_buf(drvdata, event, nr_pages, pages, snapshot); etr_buf 1280 drivers/hwtracing/coresight/coresight-tmc-etr.c if (IS_ERR(etr_buf)) etr_buf 1281 drivers/hwtracing/coresight/coresight-tmc-etr.c return etr_buf; etr_buf 1285 drivers/hwtracing/coresight/coresight-tmc-etr.c ret = idr_alloc(&drvdata->idr, etr_buf, pid, pid + 1, GFP_KERNEL); etr_buf 1290 drivers/hwtracing/coresight/coresight-tmc-etr.c tmc_free_etr_buf(etr_buf); etr_buf 1296 drivers/hwtracing/coresight/coresight-tmc-etr.c tmc_free_etr_buf(etr_buf); etr_buf 1301 drivers/hwtracing/coresight/coresight-tmc-etr.c return etr_buf; etr_buf 1304 drivers/hwtracing/coresight/coresight-tmc-etr.c static struct etr_buf * etr_buf 1316 drivers/hwtracing/coresight/coresight-tmc-etr.c static struct etr_buf * etr_buf 1333 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *etr_buf; etr_buf 1342 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_buf = get_perf_etr_buf(drvdata, event, nr_pages, pages, snapshot); etr_buf 1343 drivers/hwtracing/coresight/coresight-tmc-etr.c if (!IS_ERR(etr_buf)) etr_buf 1355 drivers/hwtracing/coresight/coresight-tmc-etr.c etr_perf->etr_buf = etr_buf; etr_buf 1387 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *buf, *etr_buf = etr_perf->etr_buf; etr_buf 1389 drivers/hwtracing/coresight/coresight-tmc-etr.c if (!etr_buf) etr_buf 1394 drivers/hwtracing/coresight/coresight-tmc-etr.c if (!refcount_dec_and_test(&etr_buf->refcount)) { etr_buf 1407 drivers/hwtracing/coresight/coresight-tmc-etr.c if (buf && WARN_ON(buf != etr_buf)) etr_buf 1410 drivers/hwtracing/coresight/coresight-tmc-etr.c tmc_free_etr_buf(etr_perf->etr_buf); etr_buf 1428 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *etr_buf = etr_perf->etr_buf; etr_buf 1444 drivers/hwtracing/coresight/coresight-tmc-etr.c if (src_offset >= etr_buf->size) etr_buf 1445 drivers/hwtracing/coresight/coresight-tmc-etr.c src_offset -= etr_buf->size; etr_buf 1446 drivers/hwtracing/coresight/coresight-tmc-etr.c bytes = tmc_etr_buf_get_data(etr_buf, src_offset, to_copy, etr_buf 1484 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *etr_buf = etr_perf->etr_buf; etr_buf 1494 drivers/hwtracing/coresight/coresight-tmc-etr.c if (WARN_ON(drvdata->perf_buf != etr_buf)) { etr_buf 1508 drivers/hwtracing/coresight/coresight-tmc-etr.c lost = etr_buf->full; etr_buf 1509 drivers/hwtracing/coresight/coresight-tmc-etr.c offset = etr_buf->offset; etr_buf 1510 drivers/hwtracing/coresight/coresight-tmc-etr.c size = etr_buf->len; etr_buf 1527 drivers/hwtracing/coresight/coresight-tmc-etr.c offset = etr_buf->offset + etr_buf->len - size; etr_buf 1529 drivers/hwtracing/coresight/coresight-tmc-etr.c if (offset >= etr_buf->size) etr_buf 1530 drivers/hwtracing/coresight/coresight-tmc-etr.c offset -= etr_buf->size; etr_buf 1536 drivers/hwtracing/coresight/coresight-tmc-etr.c tmc_etr_buf_insert_barrier_packet(etr_buf, etr_buf->offset); etr_buf 1575 drivers/hwtracing/coresight/coresight-tmc-etr.c if (WARN_ON(!etr_perf || !etr_perf->etr_buf)) { etr_buf 1600 drivers/hwtracing/coresight/coresight-tmc-etr.c rc = tmc_etr_enable_hw(drvdata, etr_perf->etr_buf); etr_buf 1605 drivers/hwtracing/coresight/coresight-tmc-etr.c drvdata->perf_buf = etr_perf->etr_buf; etr_buf 1711 drivers/hwtracing/coresight/coresight-tmc-etr.c struct etr_buf *sysfs_buf = NULL; etr_buf 197 drivers/hwtracing/coresight/coresight-tmc.h struct etr_buf *etr_buf; /* TMC ETR */ etr_buf 208 drivers/hwtracing/coresight/coresight-tmc.h struct etr_buf *sysfs_buf; etr_buf 209 drivers/hwtracing/coresight/coresight-tmc.h struct etr_buf *perf_buf; etr_buf 213 drivers/hwtracing/coresight/coresight-tmc.h int (*alloc)(struct tmc_drvdata *drvdata, struct etr_buf *etr_buf, etr_buf 215 drivers/hwtracing/coresight/coresight-tmc.h void (*sync)(struct etr_buf *etr_buf, u64 rrp, u64 rwp); etr_buf 216 drivers/hwtracing/coresight/coresight-tmc.h ssize_t (*get_data)(struct etr_buf *etr_buf, u64 offset, size_t len, etr_buf 218 drivers/hwtracing/coresight/coresight-tmc.h void (*free)(struct etr_buf *etr_buf);