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

coresight: etb10: splitting sysFS "status" entry

The sysFS "status" entry conveys a wealth of information about
the status of the HW but goes agains the sysFS rule of one topic
per file.

This patch rectify the situation by adding read-only entries for
each of the field formaly displayed by "status". The ABI
documentation is kept up to date.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Mathieu Poirier and committed by
Greg Kroah-Hartman
ad352acb 154f3520

+98 -48
+62 -7
Documentation/ABI/testing/sysfs-bus-coresight-devices-etb10
··· 6 6 source for a single sink. 7 7 ex: echo 1 > /sys/bus/coresight/devices/20010000.etb/enable_sink 8 8 9 - What: /sys/bus/coresight/devices/<memory_map>.etb/status 10 - Date: November 2014 11 - KernelVersion: 3.19 12 - Contact: Mathieu Poirier <mathieu.poirier@linaro.org> 13 - Description: (R) List various control and status registers. The specific 14 - layout and content is driver specific. 15 - 16 9 What: /sys/bus/coresight/devices/<memory_map>.etb/trigger_cntr 17 10 Date: November 2014 18 11 KernelVersion: 3.19 ··· 15 22 following the trigger event. The number of 32-bit words written 16 23 into the Trace RAM following the trigger event is equal to the 17 24 value stored in this register+1 (from ARM ETB-TRM). 25 + 26 + What: /sys/bus/coresight/devices/<memory_map>.etb/mgmt/rdp 27 + Date: March 2016 28 + KernelVersion: 4.7 29 + Contact: Mathieu Poirier <mathieu.poirier@linaro.org> 30 + Description: (R) Defines the depth, in words, of the trace RAM in powers of 31 + 2. The value is read directly from HW register RDP, 0x004. 32 + 33 + What: /sys/bus/coresight/devices/<memory_map>.etb/mgmt/sts 34 + Date: March 2016 35 + KernelVersion: 4.7 36 + Contact: Mathieu Poirier <mathieu.poirier@linaro.org> 37 + Description: (R) Shows the value held by the ETB status register. The value 38 + is read directly from HW register STS, 0x00C. 39 + 40 + What: /sys/bus/coresight/devices/<memory_map>.etb/mgmt/rrp 41 + Date: March 2016 42 + KernelVersion: 4.7 43 + Contact: Mathieu Poirier <mathieu.poirier@linaro.org> 44 + Description: (R) Shows the value held by the ETB RAM Read Pointer register 45 + that is used to read entries from the Trace RAM over the APB 46 + interface. The value is read directly from HW register RRP, 47 + 0x014. 48 + 49 + What: /sys/bus/coresight/devices/<memory_map>.etb/mgmt/rwp 50 + Date: March 2016 51 + KernelVersion: 4.7 52 + Contact: Mathieu Poirier <mathieu.poirier@linaro.org> 53 + Description: (R) Shows the value held by the ETB RAM Write Pointer register 54 + that is used to sets the write pointer to write entries from 55 + the CoreSight bus into the Trace RAM. The value is read directly 56 + from HW register RWP, 0x018. 57 + 58 + What: /sys/bus/coresight/devices/<memory_map>.etb/mgmt/trg 59 + Date: March 2016 60 + KernelVersion: 4.7 61 + Contact: Mathieu Poirier <mathieu.poirier@linaro.org> 62 + Description: (R) Similar to "trigger_cntr" above except that this value is 63 + read directly from HW register TRG, 0x01C. 64 + 65 + What: /sys/bus/coresight/devices/<memory_map>.etb/mgmt/ctl 66 + Date: March 2016 67 + KernelVersion: 4.7 68 + Contact: Mathieu Poirier <mathieu.poirier@linaro.org> 69 + Description: (R) Shows the value held by the ETB Control register. The value 70 + is read directly from HW register CTL, 0x020. 71 + 72 + What: /sys/bus/coresight/devices/<memory_map>.etb/mgmt/ffsr 73 + Date: March 2016 74 + KernelVersion: 4.7 75 + Contact: Mathieu Poirier <mathieu.poirier@linaro.org> 76 + Description: (R) Shows the value held by the ETB Formatter and Flush Status 77 + register. The value is read directly from HW register FFSR, 78 + 0x300. 79 + 80 + What: /sys/bus/coresight/devices/<memory_map>.etb/mgmt/ffcr 81 + Date: March 2016 82 + KernelVersion: 4.7 83 + Contact: Mathieu Poirier <mathieu.poirier@linaro.org> 84 + Description: (R) Shows the value held by the ETB Formatter and Flush Control 85 + register. The value is read directly from HW register FFCR, 86 + 0x304.
+36 -41
drivers/hwtracing/coresight/coresight-etb10.c
··· 579 579 .llseek = no_llseek, 580 580 }; 581 581 582 - static ssize_t status_show(struct device *dev, 583 - struct device_attribute *attr, char *buf) 584 - { 585 - unsigned long flags; 586 - u32 etb_rdr, etb_sr, etb_rrp, etb_rwp; 587 - u32 etb_trg, etb_cr, etb_ffsr, etb_ffcr; 588 - struct etb_drvdata *drvdata = dev_get_drvdata(dev->parent); 582 + #define coresight_etb10_simple_func(name, offset) \ 583 + coresight_simple_func(struct etb_drvdata, name, offset) 589 584 590 - pm_runtime_get_sync(drvdata->dev); 591 - spin_lock_irqsave(&drvdata->spinlock, flags); 592 - CS_UNLOCK(drvdata->base); 585 + coresight_etb10_simple_func(rdp, ETB_RAM_DEPTH_REG); 586 + coresight_etb10_simple_func(sts, ETB_STATUS_REG); 587 + coresight_etb10_simple_func(rrp, ETB_RAM_READ_POINTER); 588 + coresight_etb10_simple_func(rwp, ETB_RAM_WRITE_POINTER); 589 + coresight_etb10_simple_func(trg, ETB_TRG); 590 + coresight_etb10_simple_func(ctl, ETB_CTL_REG); 591 + coresight_etb10_simple_func(ffsr, ETB_FFSR); 592 + coresight_etb10_simple_func(ffcr, ETB_FFCR); 593 593 594 - etb_rdr = readl_relaxed(drvdata->base + ETB_RAM_DEPTH_REG); 595 - etb_sr = readl_relaxed(drvdata->base + ETB_STATUS_REG); 596 - etb_rrp = readl_relaxed(drvdata->base + ETB_RAM_READ_POINTER); 597 - etb_rwp = readl_relaxed(drvdata->base + ETB_RAM_WRITE_POINTER); 598 - etb_trg = readl_relaxed(drvdata->base + ETB_TRG); 599 - etb_cr = readl_relaxed(drvdata->base + ETB_CTL_REG); 600 - etb_ffsr = readl_relaxed(drvdata->base + ETB_FFSR); 601 - etb_ffcr = readl_relaxed(drvdata->base + ETB_FFCR); 602 - 603 - CS_LOCK(drvdata->base); 604 - spin_unlock_irqrestore(&drvdata->spinlock, flags); 605 - 606 - pm_runtime_put(drvdata->dev); 607 - 608 - return sprintf(buf, 609 - "Depth:\t\t0x%x\n" 610 - "Status:\t\t0x%x\n" 611 - "RAM read ptr:\t0x%x\n" 612 - "RAM wrt ptr:\t0x%x\n" 613 - "Trigger cnt:\t0x%x\n" 614 - "Control:\t0x%x\n" 615 - "Flush status:\t0x%x\n" 616 - "Flush ctrl:\t0x%x\n", 617 - etb_rdr, etb_sr, etb_rrp, etb_rwp, 618 - etb_trg, etb_cr, etb_ffsr, etb_ffcr); 619 - 620 - return -EINVAL; 621 - } 622 - static DEVICE_ATTR_RO(status); 594 + static struct attribute *coresight_etb_mgmt_attrs[] = { 595 + &dev_attr_rdp.attr, 596 + &dev_attr_sts.attr, 597 + &dev_attr_rrp.attr, 598 + &dev_attr_rwp.attr, 599 + &dev_attr_trg.attr, 600 + &dev_attr_ctl.attr, 601 + &dev_attr_ffsr.attr, 602 + &dev_attr_ffcr.attr, 603 + NULL, 604 + }; 623 605 624 606 static ssize_t trigger_cntr_show(struct device *dev, 625 607 struct device_attribute *attr, char *buf) ··· 631 649 632 650 static struct attribute *coresight_etb_attrs[] = { 633 651 &dev_attr_trigger_cntr.attr, 634 - &dev_attr_status.attr, 635 652 NULL, 636 653 }; 637 - ATTRIBUTE_GROUPS(coresight_etb); 654 + 655 + static const struct attribute_group coresight_etb_group = { 656 + .attrs = coresight_etb_attrs, 657 + }; 658 + 659 + static const struct attribute_group coresight_etb_mgmt_group = { 660 + .attrs = coresight_etb_mgmt_attrs, 661 + .name = "mgmt", 662 + }; 663 + 664 + const struct attribute_group *coresight_etb_groups[] = { 665 + &coresight_etb_group, 666 + &coresight_etb_mgmt_group, 667 + NULL, 668 + }; 638 669 639 670 static int etb_probe(struct amba_device *adev, const struct amba_id *id) 640 671 {