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

stm class: Support devices that override software assigned masters

Some STM devices adjust software assigned master numbers depending on
the trace source and its runtime state and whatnot. This patch adds
a sysfs attribute to inform the trace-side software that master numbers
assigned to software sources will not match those in the STP stream,
so that, for example, master/channel allocation policy can be adjusted
accordingly.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alexander Shishkin and committed by
Greg Kroah-Hartman
8e996a28 6327a454

+28
+10
Documentation/ABI/testing/sysfs-class-stm
··· 12 12 Contact: Alexander Shishkin <alexander.shishkin@linux.intel.com> 13 13 Description: 14 14 Shows the number of channels per master on this STM device. 15 + 16 + What: /sys/class/stm/<stm>/hw_override 17 + Date: March 2016 18 + KernelVersion: 4.7 19 + Contact: Alexander Shishkin <alexander.shishkin@linux.intel.com> 20 + Description: 21 + Reads as 0 if master numbers in the STP stream produced by 22 + this stm device will match the master numbers assigned by 23 + the software or 1 if the stm hardware overrides software 24 + assigned masters.
+15
drivers/hwtracing/stm/core.c
··· 67 67 68 68 static DEVICE_ATTR_RO(channels); 69 69 70 + static ssize_t hw_override_show(struct device *dev, 71 + struct device_attribute *attr, 72 + char *buf) 73 + { 74 + struct stm_device *stm = to_stm_device(dev); 75 + int ret; 76 + 77 + ret = sprintf(buf, "%u\n", stm->data->hw_override); 78 + 79 + return ret; 80 + } 81 + 82 + static DEVICE_ATTR_RO(hw_override); 83 + 70 84 static struct attribute *stm_attrs[] = { 71 85 &dev_attr_masters.attr, 72 86 &dev_attr_channels.attr, 87 + &dev_attr_hw_override.attr, 73 88 NULL, 74 89 }; 75 90
+3
include/linux/stm.h
··· 50 50 * @sw_end: last STP master available to software 51 51 * @sw_nchannels: number of STP channels per master 52 52 * @sw_mmiosz: size of one channel's IO space, for mmap, optional 53 + * @hw_override: masters in the STP stream will not match the ones 54 + * assigned by software, but are up to the STM hardware 53 55 * @packet: callback that sends an STP packet 54 56 * @mmio_addr: mmap callback, optional 55 57 * @link: called when a new stm_source gets linked to us, optional ··· 87 85 unsigned int sw_end; 88 86 unsigned int sw_nchannels; 89 87 unsigned int sw_mmiosz; 88 + unsigned int hw_override; 90 89 ssize_t (*packet)(struct stm_data *, unsigned int, 91 90 unsigned int, unsigned int, 92 91 unsigned int, unsigned int,