From patchwork Fri Sep 18 16:26:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 7219231 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 3B2F8BEEC1 for ; Fri, 18 Sep 2015 16:45:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 51D2620870 for ; Fri, 18 Sep 2015 16:45:37 +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 705B520859 for ; Fri, 18 Sep 2015 16:45:36 +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 1ZcylY-0004Cy-NI; Fri, 18 Sep 2015 16:44:04 +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 1Zcyks-0002XH-OL for linux-arm-kernel@bombadil.infradead.org; Fri, 18 Sep 2015 16:43:22 +0000 Received: from mail-pa0-f51.google.com ([209.85.220.51]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZcyVg-0006xJ-Ct for linux-arm-kernel@lists.infradead.org; Fri, 18 Sep 2015 16:27:41 +0000 Received: by pacex6 with SMTP id ex6so55406010pac.0 for ; Fri, 18 Sep 2015 09:27:18 -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=+K2v6IWvtdNPXz39GSZRO+UrPq2786UeNtrYocPL4yY=; b=gU88fDtDnjSJDAGPDcwTM3RVMnUQf+z+TqtQFkFQyZkC5BdKf52tr1uUnFlHrzcJCo HZHEXGzy5Q4rciS/7IgO7ZRXf4QsDp6TYmyeZjkW6Vozcwh6zJt2TXyxOSXYNLzAbbo7 ZVqvUznX+REGc6HPJaKBk59bvqy4hsIi9MIoNJ6ur0S1h9eAoZrd/7PiuCCBgz0kwzp9 VodlNuGl61dDW/YVW4MfWWt94z2ItA/UZH/x0HGVA+aAGKiUfsQRXdfSV5l//wZGCLvu gb6LIgmQchSmJ5SEh/0KQGZLigrARYwCgiNwAGaPsGeGUoQALka2w+LqpHIhU/sXxrkb zUSg== X-Gm-Message-State: ALoCoQn3LEZRNFEvy166+cwVJ9LVhgwh08Gw6JxUT/IhgOKslEsOHb67hxSZLEhPxjtxJ/3qut7H X-Received: by 10.68.139.226 with SMTP id rb2mr8211681pbb.49.1442593638605; Fri, 18 Sep 2015 09:27:18 -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.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Sep 2015 09:27:18 -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 12/20] coresight: keeping track of enabled sink buffers Date: Fri, 18 Sep 2015 10:26:26 -0600 Message-Id: <1442593594-10665-13-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_172740_585561_821C8CC5 X-CRM114-Status: GOOD ( 20.02 ) 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 Keep track of enabled sink buffers as paths between source and sinks are being built. That way sinks associated to a source can be accessed quickly. Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-priv.h | 3 ++- drivers/hwtracing/coresight/coresight.c | 11 +++++++---- include/linux/coresight.h | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index 8a52fdcb4bd6..3d7467f315ed 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -53,7 +53,8 @@ static inline void CS_UNLOCK(void __iomem *addr) } int coresight_build_paths(struct coresight_device *csdev, - struct list_head *path, bool enable); + struct list_head *path, + struct list_head *sinks, bool enable); #ifdef CONFIG_CORESIGHT_SOURCE_ETM3X extern int etm_readl_cp14(u32 off, unsigned int *val); diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 7a54d8069670..2e9f6248fb7e 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -302,7 +302,8 @@ static int coresight_disable_path(struct list_head *path) } int coresight_build_paths(struct coresight_device *csdev, - struct list_head *path, bool enable) + struct list_head *path, + struct list_head *sinks, bool enable) { int i, ret = -EINVAL; struct coresight_connection *conn; @@ -314,13 +315,15 @@ int coresight_build_paths(struct coresight_device *csdev, csdev->activated) { if (enable) ret = coresight_enable_path(path); + if (!ret && sinks) + list_add(&csdev->sinks, sinks); else ret = coresight_disable_path(path); } else { for (i = 0; i < csdev->nr_outport; i++) { conn = &csdev->conns[i]; if (coresight_build_paths(conn->child_dev, - path, enable) == 0) + path, sinks, enable) == 0) ret = 0; } } @@ -347,7 +350,7 @@ int coresight_enable(struct coresight_device *csdev) if (csdev->enable) goto out; - if (coresight_build_paths(csdev, &path, true)) { + if (coresight_build_paths(csdev, &path, NULL, true)) { dev_err(&csdev->dev, "building path(s) failed\n"); goto out; } @@ -373,7 +376,7 @@ void coresight_disable(struct coresight_device *csdev) goto out; coresight_disable_source(csdev); - if (coresight_build_paths(csdev, &path, false)) + if (coresight_build_paths(csdev, &path, NULL, false)) dev_err(&csdev->dev, "releasing path(s) failed\n"); out: diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 48c3b9df0ae0..da76b2951f10 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -154,6 +154,7 @@ struct coresight_connection { * @dev: The device entity associated to this component. * @refcnt: keep track of what is in use. * @path_link: link of current component into the path being enabled. + * @sinks: list of currently enabled sinks for a source. * @orphan: true if the component has connections that haven't been linked. * @enable: 'true' if component is currently part of an active path. * @activated: 'true' only if a _sink_ has been activated. A sink can be @@ -170,6 +171,7 @@ struct coresight_device { struct device dev; atomic_t *refcnt; struct list_head path_link; + struct list_head sinks; bool orphan; bool enable; /* true only if configured as part of a path */ bool activated; /* true only if a sink is part of a path */