From patchwork Thu Mar 31 13:20:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shishkin X-Patchwork-Id: 8712951 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 920619F30C for ; Thu, 31 Mar 2016 13:24:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8098020270 for ; Thu, 31 Mar 2016 13:24:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 578EF20221 for ; Thu, 31 Mar 2016 13:24:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1alcXj-00051p-WE; Thu, 31 Mar 2016 13:21:48 +0000 Received: from mga02.intel.com ([134.134.136.20]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1alcXg-0004xH-6L for linux-arm-kernel@lists.infradead.org; Thu, 31 Mar 2016 13:21:45 +0000 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 31 Mar 2016 06:20:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,422,1455004800"; d="scan'208";a="775414657" Received: from um.fi.intel.com (HELO localhost) ([10.237.72.212]) by orsmga003.jf.intel.com with ESMTP; 31 Mar 2016 06:20:24 -0700 From: Alexander Shishkin To: Mathieu Poirier Subject: Re: [RESEND PATCH V4 1/4] stm class: provision for statically assigned masterIDs In-Reply-To: References: <1457418835-31417-1-git-send-email-zhang.chunyan@linaro.org> <1457418835-31417-2-git-send-email-zhang.chunyan@linaro.org> <87wpow6znl.fsf@ashishki-desk.ger.corp.intel.com> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Thu, 31 Mar 2016 16:20:23 +0300 Message-ID: <878u0y7pig.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160331_062144_338132_C979118B X-CRM114-Status: GOOD ( 19.95 ) X-Spam-Score: -7.9 (-------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Al Grant , Michael Williams , linux-doc@vger.kernel.org, Lyra Zhang , "linux-kernel@vger.kernel.org" , "Jeremiassen, Tor" , Mike Leach , linux-api@vger.kernel.org, serge.broslavsky@linaro.org, Chunyan Zhang , Pratik Patel , Nicolas GUION , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Mathieu Poirier writes: > On 21 March 2016 at 01:47, Alexander Shishkin > wrote: >> Chunyan Zhang writes: >> >>> From: Mathieu Poirier >>> >>> Some architecture like ARM assign masterIDs at the HW design >>> phase. Those are therefore unreachable to users, making masterID >>> management in the generic STM core irrelevant. >>> >>> In this kind of configuration channels are shared between masters >>> rather than being allocated on a per master basis. >>> >>> This patch adds a new 'mshared' flag to struct stm_data that tells the >>> core that this specific STM device doesn't need explicit masterID >>> management. >> >> There are two kinds of 'masterIDs' that we're talking about here: the >> ones that turn up in the STP stream and the ones that are accessible to >> trace-side software (sw_start/sw_end). So in this case we want to >> reflect the fact that there is no correlation between the two, because >> hardware assigns STP channels dynamically based on the states of the >> trace/execution environment. And although the trace side software can do >> very little with this information, it does make sense to provide it. >> >> The sw_start==sw_end situation, on the other hand, is a side effect of >> the above and, as I said in one of the previous threads, may not even be >> the case, or at least I don't see why it has to. And when it is the >> case, I don't see the point in handling it differently from >> sw_start Other than the above, is there anything you'd like to see modified in > this patch, i.e how the mshared flag is used to modify the output in > sysFS/configFS? Yes, the two paragraphs quoted above that had gone unnoticed. I've been thinking some more about this and came up with the following. No need to do any extra handling in the policy code or anywhere else. From 8be22a8e391b94ec13d428976e7b1410aa59991e Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Thu, 31 Mar 2016 15:51:29 +0300 Subject: [PATCH] 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 --- Documentation/ABI/testing/sysfs-class-stm | 10 ++++++++++ drivers/hwtracing/stm/core.c | 15 +++++++++++++++ include/linux/stm.h | 3 +++ 3 files changed, 28 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-class-stm b/Documentation/ABI/testing/sysfs-class-stm index c9aa4f3fc9..77ed3da0f6 100644 --- a/Documentation/ABI/testing/sysfs-class-stm +++ b/Documentation/ABI/testing/sysfs-class-stm @@ -12,3 +12,13 @@ KernelVersion: 4.3 Contact: Alexander Shishkin Description: Shows the number of channels per master on this STM device. + +What: /sys/class/stm//hw_override +Date: March 2016 +KernelVersion: 4.7 +Contact: Alexander Shishkin +Description: + Reads as 0 if master numbers in the STP stream produced by + this stm device will match the master numbers assigned by + the software or 1 if the stm hardware overrides software + assigned masters. diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c index 2591442e2c..ff31108b06 100644 --- a/drivers/hwtracing/stm/core.c +++ b/drivers/hwtracing/stm/core.c @@ -67,9 +67,24 @@ static ssize_t channels_show(struct device *dev, static DEVICE_ATTR_RO(channels); +static ssize_t hw_override_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct stm_device *stm = to_stm_device(dev); + int ret; + + ret = sprintf(buf, "%u\n", stm->data->hw_override); + + return ret; +} + +static DEVICE_ATTR_RO(hw_override); + static struct attribute *stm_attrs[] = { &dev_attr_masters.attr, &dev_attr_channels.attr, + &dev_attr_hw_override.attr, NULL, }; diff --git a/include/linux/stm.h b/include/linux/stm.h index 1a79ed8e43..8369d8a8ca 100644 --- a/include/linux/stm.h +++ b/include/linux/stm.h @@ -50,6 +50,8 @@ struct stm_device; * @sw_end: last STP master available to software * @sw_nchannels: number of STP channels per master * @sw_mmiosz: size of one channel's IO space, for mmap, optional + * @hw_override: masters in the STP stream will not match the ones + * assigned by software, but are up to the STM hardware * @packet: callback that sends an STP packet * @mmio_addr: mmap callback, optional * @link: called when a new stm_source gets linked to us, optional @@ -85,6 +87,7 @@ struct stm_data { unsigned int sw_end; unsigned int sw_nchannels; unsigned int sw_mmiosz; + unsigned int hw_override; ssize_t (*packet)(struct stm_data *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int,