From patchwork Thu Sep 20 19:18:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 147162 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp2377604ljw; Thu, 20 Sep 2018 12:20:11 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZB6TojDsknxoYcPVFFYjSW9twYM17cl/zgfAtYZts6nwn9vVa8Tl6Qqcxn9rMGWu/bKtho X-Received: by 2002:a62:591a:: with SMTP id n26-v6mr42790565pfb.94.1537471211589; Thu, 20 Sep 2018 12:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537471211; cv=none; d=google.com; s=arc-20160816; b=cl1h8LKHq8oDd8kpCXhcLpxmJQfPTAm9YIqIG/PYS3GE6NiQufdACIspvE4HylM4z6 Tr6AlLRC9s0e1WMgXNlsdb+q0qj0CpuzHoy7w8OYfcR8Rj7ULjk7DtOnZHot/Cjpzkj7 4XVuYW7UET0VlVejyiiHK4Sg4GLAX4y3OCt9/Xl+Mi+Qy4oGeYew5hbY9pCsIVNMk0YH lcWivJF7r9f3eQEUbVdeDkC8Dq8B9qVEnOPO8lTazE41XNUrhX0vk8OObxm3ZLx5mgmb ymJP+xUXjvKwtqR2B1vzDCQS1290FqY1FF0UTifQtJQxOAJ+Q+5QzDANREjRoO1gILQo 7HMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=JqAqiFp39e/iP5YLkBuDUIuE6G94xqJ7+L+i9J0h7x8=; b=0QiNdmnT1IzTGZn7tW0N8k9eEyyWxDjA/j0UApXhujE/+IhZCaRbvt9TyQ3JKhH6dS BvBeZFvggNyLjxgM0DyaDZMziYxD44FdZU/UbtJa335aZK5O1iu+Cr3GGRjhF6sV6V6W JG7/VD7ZfD0s+LAgkbKeaLbKXdV4/vsyd6r+RBi57bC7lrs29jkkiCoKV3q1qY2i9IIh TYf0DQ776Q1ixRY8rdiu8TL/xDzIpbeaMHNVwehFLB8DOVr8OY53aVgnWvqwAROMzLIh yfV71l7yOlZtYhakI2ok7wvbWaxZzgT6JH0NFmFbym4E+2HntAjlUC6+J23Dn3+IBB7h UAAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZREsNBHP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u10-v6si23815456plr.58.2018.09.20.12.20.11; Thu, 20 Sep 2018 12:20:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZREsNBHP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389164AbeIUBFI (ORCPT + 32 others); Thu, 20 Sep 2018 21:05:08 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:40222 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389061AbeIUBER (ORCPT ); Thu, 20 Sep 2018 21:04:17 -0400 Received: by mail-pl1-f195.google.com with SMTP id s17-v6so4791732plp.7 for ; Thu, 20 Sep 2018 12:19:18 -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=JqAqiFp39e/iP5YLkBuDUIuE6G94xqJ7+L+i9J0h7x8=; b=ZREsNBHPIopn3W51dQ9fgFBIBaMd3Za5CZQ+FzL3lGOdHBFP7KLR0RMZJbMkQa2KXy mjmmrWxOgEA9iUYBfMh1ccm+5zDBI/p20CqtmFBPfaLl+Vo0fGB9HT8yWduXf1fXHJA5 S6TGZcsIKQoNGsUl0AmernAR0cEQ6VbMDPb30= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JqAqiFp39e/iP5YLkBuDUIuE6G94xqJ7+L+i9J0h7x8=; b=m1jYPUws43/1G7TvGDUWeImbGvFHmQ29E7a+vaplDLLIgGY58SmEXgQCwOqPzocFA8 /Ym7HYOiuOiKrDbiwBhSg2qahrdcAl1zgJMbuMkfRZgY0AtlFqcJ8GuTX3c5JR7ItC4t hlq5sy4EzzATcJjBSmYnuuFf2raEublUTDE1+JOygwF0E+wLfYnvGIhTCCXCbbHC59Gw 1mlnGaIXyV6/l9i1j2sCj5D0LVFN4EladZK5EOq6l3oSm1V+Ddet+C3hwyI4fATfqhJl q3rlUVfM92zMlaamqTj0HOKkUjwKxJzqnJLP98zoacFJyEmJic01t9AdC6pvff3XJ3mL zOCA== X-Gm-Message-State: APzg51Dk0IKjvyaDc5ICd2LCYc4ln61KOSHZdLD2t6TcMC4p6Se5Drr3 YThAC0hqOJkXtXXkbgVdVRWtRA== X-Received: by 2002:a17:902:2006:: with SMTP id n6-v6mr40066103pla.325.1537471158027; Thu, 20 Sep 2018 12:19:18 -0700 (PDT) Received: from localhost.localdomain ([209.121.128.187]) by smtp.gmail.com with ESMTPSA id k13-v6sm4424443pgf.37.2018.09.20.12.19.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Sep 2018 12:19:17 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 37/44] coresight: etmx: Claim devices before use Date: Thu, 20 Sep 2018 13:18:12 -0600 Message-Id: <1537471099-19781-38-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537471099-19781-1-git-send-email-mathieu.poirier@linaro.org> References: <1537471099-19781-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suzuki K Poulose Use the CLAIM tags to grab the device for self-hosted usage. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm3x.c | 16 +++++++++++++--- drivers/hwtracing/coresight/coresight-etm4x.c | 14 +++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index 206c2381a11a..fd5c4cca7db5 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -357,7 +357,7 @@ static int etm_parse_event_config(struct etm_drvdata *drvdata, static int etm_enable_hw(struct etm_drvdata *drvdata) { - int i; + int i, rc; u32 etmcr; struct etm_config *config = &drvdata->config; @@ -369,6 +369,9 @@ static int etm_enable_hw(struct etm_drvdata *drvdata) etm_set_pwrup(drvdata); /* Make sure all registers are accessible */ etm_os_unlock(drvdata); + rc = coresight_claim_device_unlocked(drvdata->base); + if (rc) + goto done; etm_set_prog(drvdata); @@ -417,10 +420,15 @@ static int etm_enable_hw(struct etm_drvdata *drvdata) etm_writel(drvdata, 0x0, ETMVMIDCVR); etm_clr_prog(drvdata); + +done: + if (rc) + etm_set_pwrdwn(drvdata); CS_LOCK(drvdata->base); - dev_dbg(drvdata->dev, "cpu: %d enable smp call done\n", drvdata->cpu); - return 0; + dev_dbg(drvdata->dev, "cpu: %d enable smp call done: %d\n", + drvdata->cpu, rc); + return rc; } struct etm_enable_arg { @@ -569,6 +577,8 @@ static void etm_disable_hw(void *info) for (i = 0; i < drvdata->nr_cntr; i++) config->cntr_val[i] = etm_readl(drvdata, ETMCNTVRn(i)); + coresight_disclaim_device_unlocked(drvdata->base); + etm_set_pwrdwn(drvdata); CS_LOCK(drvdata->base); diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 064e0bfaefd0..53e2fb6e86f6 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -85,13 +85,17 @@ struct etm4_enable_arg { static int etm4_enable_hw(struct etmv4_drvdata *drvdata) { - int i; + int i, rc; struct etmv4_config *config = &drvdata->config; CS_UNLOCK(drvdata->base); etm4_os_unlock(drvdata); + rc = coresight_claim_device_unlocked(drvdata->base); + if (rc) + goto done; + /* Disable the trace unit before programming trace registers */ writel_relaxed(0, drvdata->base + TRCPRGCTLR); @@ -179,10 +183,12 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata) dev_err(drvdata->dev, "timeout while waiting for Idle Trace Status\n"); +done: CS_LOCK(drvdata->base); - dev_dbg(drvdata->dev, "cpu: %d enable smp call done\n", drvdata->cpu); - return 0; + dev_dbg(drvdata->dev, "cpu: %d enable smp call done: %d\n", + drvdata->cpu, rc); + return rc; } static void etm4_enable_hw_smp_call(void *info) @@ -342,6 +348,8 @@ static void etm4_disable_hw(void *info) isb(); writel_relaxed(control, drvdata->base + TRCPRGCTLR); + coresight_disclaim_device_unlocked(drvdata->base); + CS_LOCK(drvdata->base); dev_dbg(drvdata->dev, "cpu: %d disable smp call done\n", drvdata->cpu);