From patchwork Fri Sep 18 16:26:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 7219281 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3F0EBBEEC1 for ; Fri, 18 Sep 2015 16:47:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 62E9D208CC for ; Fri, 18 Sep 2015 16:47:34 +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 79FE1208BC for ; Fri, 18 Sep 2015 16:47:33 +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 1ZcynW-0007qr-UJ; Fri, 18 Sep 2015 16:46:06 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zcykz-0002XH-NH for linux-arm-kernel@bombadil.infradead.org; Fri, 18 Sep 2015 16:43:29 +0000 Received: from mail-pa0-f50.google.com ([209.85.220.50]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZcyVV-0006wr-Sz for linux-arm-kernel@lists.infradead.org; Fri, 18 Sep 2015 16:27:30 +0000 Received: by pacfv12 with SMTP id fv12so56038048pac.2 for ; Fri, 18 Sep 2015 09:27:07 -0700 (PDT) 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=6jZe5KS6TBYCHDEqRX/oH9O/JzTVPha9YZTa81JSf4U=; b=BPIJcY8SwJCHCn7Yj5uUIkRgsOjPvZkt4bMtVCwOPkuoj/hKuIzF/UgcNQgMvE1BlO hefVgT25efWs7U/nNswM45S3NBQDuzqC8MnpkL/uU28N7Kc/YHPffDy+fjkjwvFtCIxp Lxej9VcArHcBnuv0RrglBvndGQorQcZ/60kgOxUcYlzf5DR9P+hAp5i6Unq3XoEkoG0O icj90Vef6ruZ1w0NGNLcgxkOz806XVWH2S5lURG+e2WQgJIO1zLqtFitOzSajixU6oqJ 6AXrPqEaiaCbVUDYx3IZxlf1Iup5yPGwPCzVnmE0fTZbly/PTJh9QSDkgApLNned/+q6 WXBg== X-Gm-Message-State: ALoCoQlf0sMwjO20Zc4Oos9j7xW7sDrwtZh79RbKs+r4I5/LG37VmsdT+sGMi7LTou+LhL9QMAv5 X-Received: by 10.66.131.10 with SMTP id oi10mr8134203pab.87.1442593624854; Fri, 18 Sep 2015 09:27:04 -0700 (PDT) Received: from t430.cg.shawcable.net ([184.64.168.246]) by smtp.gmail.com with ESMTPSA id la4sm9847027pbc.76.2015.09.18.09.27.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Sep 2015 09:27:04 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org, a.p.zijlstra@chello.nl, alexander.shishkin@linux.intel.com, acme@kernel.org, mingo@redhat.com, corbet@lwn.net Subject: [RFC PATCH 02/20] coresight: etm3x: implementing 'is_enabled()' API Date: Fri, 18 Sep 2015 10:26:16 -0600 Message-Id: <1442593594-10665-3-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442593594-10665-1-git-send-email-mathieu.poirier@linaro.org> References: <1442593594-10665-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150918_172730_085144_57037F34 X-CRM114-Status: GOOD ( 15.56 ) X-Spam-Score: -2.6 (--) 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, pawel.moll@arm.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, adrian.hunter@intel.com, tor@ti.com, mike.leach@arm.com, zhang.chunyan@linaro.org, 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=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 Adding an interface to lookup the status of a tracer along with a source operation allowing external customers to access it. Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm3x.c | 13 +++++++++++++ include/linux/coresight.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index 999c62a59c70..a44bc3532585 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -374,6 +374,18 @@ static int etm_configure(struct coresight_device *csdev) etm_configure_cpu, csdev, 1); } +static bool etm_is_enabled(struct coresight_device *csdev) +{ + bool enabled; + struct etm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); + + spin_lock(&drvdata->spinlock); + enabled = drvdata->enable; + spin_unlock(&drvdata->spinlock); + + return enabled; +} + /** * etm_trace_enable - enable ETM tracer * @csdev - the etm that needs to be enabled/disabled. @@ -525,6 +537,7 @@ static void etm_disable(struct coresight_device *csdev) static const struct coresight_ops_source etm_source_ops = { .trace_id = etm_trace_id, + .is_enabled = etm_is_enabled, .configure = etm_configure, .trace_enable = etm_trace_enable, .enable = etm_enable, diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 70f3dafa5194..d16e874079b7 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -207,6 +207,7 @@ struct coresight_ops_link { * Operations available for sources. * @trace_id: returns the value of the component's trace ID as known * to the HW. + * @is_enabled: returns whether a source has been enabled or not. * @configure: performs configuration for a source but doesn't enable it. * @trace_enable: enable/disable tracing on a source. * @enable: enables tracing for a source. @@ -216,6 +217,7 @@ struct coresight_ops_link { */ struct coresight_ops_source { int (*trace_id)(struct coresight_device *csdev); + bool (*is_enabled)(struct coresight_device *csdev); int (*configure)(struct coresight_device *csdev); int (*trace_enable)(struct coresight_device *csdev, bool enable); int (*enable)(struct coresight_device *csdev);