From patchwork Thu Apr 7 02:51:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 8768211 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 39F459F3D1 for ; Thu, 7 Apr 2016 02:55:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4BD4B201C7 for ; Thu, 7 Apr 2016 02:55:00 +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 62409201BC for ; Thu, 7 Apr 2016 02:54:59 +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 1ao04f-0001vv-7w; Thu, 07 Apr 2016 02:53:37 +0000 Received: from mail-pa0-x233.google.com ([2607:f8b0:400e:c03::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ao04a-0001kw-M1 for linux-arm-kernel@lists.infradead.org; Thu, 07 Apr 2016 02:53:34 +0000 Received: by mail-pa0-x233.google.com with SMTP id td3so45289253pab.2 for ; Wed, 06 Apr 2016 19:53:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=T/OVwbmPBRKhkj+m7QD7mdTrqCTlbY90c6JRRo7BDXE=; b=CjfkjmfF15oVME6Nm/T0R5BUhIkkiqgp9bXaEuUW2l9UN0YwGvr47sKTX+ZWNGGCvH nnWp6fT8f1cd1BUuhZjSsoniD9Lq3Xwmiz08RHQO9w3nUmNnF7yX4E3/onyjovGq7lpL I2kMeWpCYb1Z+6DL0ISysz+uGoXo3+b1gKbD4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=T/OVwbmPBRKhkj+m7QD7mdTrqCTlbY90c6JRRo7BDXE=; b=GgdLBQ//8d7aMOfZmhH7E4pvTTZXcqW5D82AyWCsuJAL6la6bV/e4zxhJWVGAR8Xce nYUi/lnFW4+yDPsoinkRVt3rsp7oHZbkaBgY7MQIXCN2COVGOXFgy4oImB01b50+E0J6 ZP8hAOKW4Yp56PT/aiAUIWtr449bMhW5TMF7HlS1GMZPtdmvrwoGSsKSE0PbJaxP6JTT 6+Oanbpp+lIbDQD8b2MEFvHtWJPWC2bcZLFYhUZxIVrPgP6In7iQ8tbIUq63M1/fdGyv vov64/7oNpD/m4Xk0Py5m7OV7yhylxezJB3wB3R6fwVO9OHzDqQvOam29RHlGAYBeMNK OZZA== X-Gm-Message-State: AD7BkJJE2tikuKUKSGueI7lEo/IWeKJcgsM82wTcNF+xvs7Q/GeHCdKSxw55tZwepdWkDHGL X-Received: by 10.66.193.202 with SMTP id hq10mr1164116pac.6.1459997591852; Wed, 06 Apr 2016 19:53:11 -0700 (PDT) Received: from zcy-ubuntu.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id xa4sm7829736pab.26.2016.04.06.19.53.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 Apr 2016 19:53:10 -0700 (PDT) From: Chunyan Zhang To: mathieu.poirier@linaro.org, alexander.shishkin@linux.intel.com Subject: [PATCH V5 1/4] stm class: Support devices that override software assigned masters Date: Thu, 7 Apr 2016 10:51:16 +0800 Message-Id: <1459997479-19431-2-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1459997479-19431-1-git-send-email-zhang.chunyan@linaro.org> References: <1459997479-19431-1-git-send-email-zhang.chunyan@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160406_195332_798638_E8662371 X-CRM114-Status: GOOD ( 13.65 ) X-Spam-Score: -2.7 (--) 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@arm.com, Michael.Williams@arm.com, linux-doc@vger.kernel.org, zhang.lyra@gmail.com, linux-kernel@vger.kernel.org, tor@ti.com, mike.leach@arm.com, linux-api@vger.kernel.org, pratikp@codeaurora.org, nicolas.guion@st.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 From: Alexander Shishkin 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 c9aa4f3..77ed3da 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 de80d45..9387f8c 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 1a79ed8..8369d8a 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,