aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/ABI/testing/sysfs-bus-intel_th-devices-msc8
-rw-r--r--drivers/hwtracing/intel_th/msu.c28
2 files changed, 36 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-intel_th-devices-msc b/Documentation/ABI/testing/sysfs-bus-intel_th-devices-msc
index b940c5d91cf7..f54ae244f3f1 100644
--- a/Documentation/ABI/testing/sysfs-bus-intel_th-devices-msc
+++ b/Documentation/ABI/testing/sysfs-bus-intel_th-devices-msc
@@ -30,4 +30,12 @@ Description: (RW) Configure MSC buffer size for "single" or "multi" modes.
30 there are no active users and tracing is not enabled) and then 30 there are no active users and tracing is not enabled) and then
31 allocates a new one. 31 allocates a new one.
32 32
33What: /sys/bus/intel_th/devices/<intel_th_id>-msc<msc-id>/win_switch
34Date: May 2019
35KernelVersion: 5.2
36Contact: Alexander Shishkin <alexander.shishkin@linux.intel.com>
37Description: (RW) Trigger window switch for the MSC's buffer, in
38 multi-window mode. In "multi" mode, accepts writes of "1", thereby
39 triggering a window switch for the buffer. Returns an error in any
40 other operating mode or attempts to write something other than "1".
33 41
diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
index b0bb69942328..aed72b33675d 100644
--- a/drivers/hwtracing/intel_th/msu.c
+++ b/drivers/hwtracing/intel_th/msu.c
@@ -1572,10 +1572,38 @@ free_win:
1572 1572
1573static DEVICE_ATTR_RW(nr_pages); 1573static DEVICE_ATTR_RW(nr_pages);
1574 1574
1575static ssize_t
1576win_switch_store(struct device *dev, struct device_attribute *attr,
1577 const char *buf, size_t size)
1578{
1579 struct msc *msc = dev_get_drvdata(dev);
1580 unsigned long val;
1581 int ret;
1582
1583 ret = kstrtoul(buf, 10, &val);
1584 if (ret)
1585 return ret;
1586
1587 if (val != 1)
1588 return -EINVAL;
1589
1590 mutex_lock(&msc->buf_mutex);
1591 if (msc->mode != MSC_MODE_MULTI)
1592 ret = -ENOTSUPP;
1593 else
1594 ret = intel_th_trace_switch(msc->thdev);
1595 mutex_unlock(&msc->buf_mutex);
1596
1597 return ret ? ret : size;
1598}
1599
1600static DEVICE_ATTR_WO(win_switch);
1601
1575static struct attribute *msc_output_attrs[] = { 1602static struct attribute *msc_output_attrs[] = {
1576 &dev_attr_wrap.attr, 1603 &dev_attr_wrap.attr,
1577 &dev_attr_mode.attr, 1604 &dev_attr_mode.attr,
1578 &dev_attr_nr_pages.attr, 1605 &dev_attr_nr_pages.attr,
1606 &dev_attr_win_switch.attr,
1579 NULL, 1607 NULL,
1580}; 1608};
1581 1609