summaryrefslogtreecommitdiffstats
path: root/drivers/hwtracing/intel_th
diff options
context:
space:
mode:
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>2019-05-03 10:44:50 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-03 18:17:40 +0200
commit6cac7866c27418cd784fbb8041c2dddd6d966bc7 (patch)
tree1d6470e54a77ac654b05728552953a8317413c6e /drivers/hwtracing/intel_th
parentintel_th: msu: Correct the block wrap detection (diff)
downloadlinux-6cac7866c27418cd784fbb8041c2dddd6d966bc7.tar.xz
linux-6cac7866c27418cd784fbb8041c2dddd6d966bc7.zip
intel_th: msu: Add a sysfs attribute to trigger window switch
Now that we have the means to trigger a window switch for the MSU trace store, add a sysfs file to allow triggering it from userspace. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing/intel_th')
-rw-r--r--drivers/hwtracing/intel_th/msu.c28
1 files changed, 28 insertions, 0 deletions
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:
static DEVICE_ATTR_RW(nr_pages);
+static ssize_t
+win_switch_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t size)
+{
+ struct msc *msc = dev_get_drvdata(dev);
+ unsigned long val;
+ int ret;
+
+ ret = kstrtoul(buf, 10, &val);
+ if (ret)
+ return ret;
+
+ if (val != 1)
+ return -EINVAL;
+
+ mutex_lock(&msc->buf_mutex);
+ if (msc->mode != MSC_MODE_MULTI)
+ ret = -ENOTSUPP;
+ else
+ ret = intel_th_trace_switch(msc->thdev);
+ mutex_unlock(&msc->buf_mutex);
+
+ return ret ? ret : size;
+}
+
+static DEVICE_ATTR_WO(win_switch);
+
static struct attribute *msc_output_attrs[] = {
&dev_attr_wrap.attr,
&dev_attr_mode.attr,
&dev_attr_nr_pages.attr,
+ &dev_attr_win_switch.attr,
NULL,
};