From patchwork Fri Nov 30 18:43:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 152581 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3989790ljp; Fri, 30 Nov 2018 10:43:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/VbRiN9bTyT2H27rk0SHBmHsE18DZ95R9GK7diyNYlRdBPhaP5yM/0IVfl4MElCPR1HiXCP X-Received: by 2002:a63:e20a:: with SMTP id q10mr4440065pgh.206.1543603396772; Fri, 30 Nov 2018 10:43:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543603396; cv=none; d=google.com; s=arc-20160816; b=iONsAiXPFFwih31Egtv0yfgEaggLnhzhpNf/KeHfL2B4BEFwFIKSCzuRKNk6nuA6ue xhwVnbGVBdldTVqG5R8JoqvHEzGZ0yL4GEp9fXRAqVa/LHXH2qxEh8ZWbakNc6igkIuw 0W6PuymVB7ozAb59Ty9AZCsd7JPAkOnOfjdEYtYlwBC3AkfB75lRA68EuvzEyzOUmq97 Hxy44M8LxBO5mEImeRoUFDS3rG1E2gQBweuDcPKDpD1q8Q74NRqr8vl1K11Z+wCZhFvd bmbAhEyHRMm1qjXQ8Bs9fAH4nr7h7V7Xw3ZJTbAq9+QQ1Z75y0NaMNJotID+zcwJ0H0l 1IyQ== 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=Vzhe1k+4Sg0ipa3ln5fdFCWCmxq09KTUkxbptlEwH0o=; b=ZlobyNmxX0/nJoy92SdlTEgiVr/1kzfvKHoZOuwj+Bk1ZSbxP6+QNW9cYQFR4MFrUP hLpVdp6ITM2PsAyXbxkopD4zMm8gih3X0aSweYfM6wI1nb5tbvar/44Rz9QfdO5qfawR GvAkgNpmJ7Hj2LEGL0Tzdf591BaMxrPlkZ2QWbc3a+BXi46YKvffADqiJZl7wbZ0jIHu t9/fl1NAYR6CZW4cvpWEEKZ7voJfM/TZNqrkuUD86IXEAOuzGHYXreOZ5MS/pLDBh7Qi /NP+cUNgYL1s4L7DEw/ZwGdM50aqSQGRnRx10FGoTNuLNRXHMCos220GpfJiiCAU3ydU Bg/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MNfo2gVn; 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 p186si5620599pgp.37.2018.11.30.10.43.16; Fri, 30 Nov 2018 10:43:16 -0800 (PST) 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=MNfo2gVn; 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 S1726886AbeLAFxZ (ORCPT + 32 others); Sat, 1 Dec 2018 00:53:25 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:38167 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725817AbeLAFxY (ORCPT ); Sat, 1 Dec 2018 00:53:24 -0500 Received: by mail-pg1-f195.google.com with SMTP id g189so2867142pgc.5 for ; Fri, 30 Nov 2018 10:43:13 -0800 (PST) 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=Vzhe1k+4Sg0ipa3ln5fdFCWCmxq09KTUkxbptlEwH0o=; b=MNfo2gVn4M21WigIT/e+iaNN9ezDzgUXXWXSfwDo6u8q7wl0e60KnDGwCVXDsPm4hw vGgJ6SDizOsZu+A7J39csL3PzLfeo7a8ZE2fACs5tsPKjnE7IciTWbA3BpmortyQr5Zv 0CwpP4AXmrzSuXAd+4YgQQMaw597TfE0vRN+4= 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=Vzhe1k+4Sg0ipa3ln5fdFCWCmxq09KTUkxbptlEwH0o=; b=cmOd9C4jOv9733vSgxrIYqgmp8Eiobb5Stm07/gooLWPg4DeBvcTN6hTebKSzhhhot mrn1e1iu8SwehJoL0oREHrubLUsoFr/a5joWDChKk2sTBPEk422SpNyhB5DiGG573qB8 dfWzlZz/LQFDkcFAJqSlHfMc4MPjKgiJ+B3nwR3qUnB3LsviJIeAPwtDDBQTccTd75fU p5ZgbW4MZ3ijyDzy339wm6YLZFTgsnpHeB/X3nSlc/kP1AE2PTJaqu2Id/MxVtcoMrtn 5V2sKJTii1CXABXlSRriCHknsotLzyiwYI07gsojtldtrQXuPmoly6u80tTK76nVEvqt nheA== X-Gm-Message-State: AA+aEWab1YjS7MhjIzbvCE6Iz5di2t50eGP5ZW3kXdcAtJMEBmZAmag8 u1gM00waNwu7yQfn5ctY/vkc+49Qsqw= X-Received: by 2002:a62:29c3:: with SMTP id p186mr6786256pfp.117.1543603392931; Fri, 30 Nov 2018 10:43:12 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id l184sm12743147pfc.112.2018.11.30.10.43.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Nov 2018 10:43:12 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/6] coresight: etm3x: Deal with CLAIM tag before and after accessing HW Date: Fri, 30 Nov 2018 11:43:05 -0700 Message-Id: <1543603387-32645-5-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543603387-32645-1-git-send-email-mathieu.poirier@linaro.org> References: <1543603387-32645-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 This patch moves access to the CLAIM tag so that no modification to the HW happens before and after the CLAIM operation has been carried. Signed-off-by: Mathieu Poirier Reviewed-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-etm3x.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index fd5c4cca7db5..6f30d52da9e4 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -363,15 +363,16 @@ static int etm_enable_hw(struct etm_drvdata *drvdata) CS_UNLOCK(drvdata->base); + rc = coresight_claim_device_unlocked(drvdata->base); + if (rc) + goto done; + /* Turn engine on */ etm_clr_pwrdwn(drvdata); /* Apply power to trace registers */ 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); @@ -422,8 +423,6 @@ static int etm_enable_hw(struct etm_drvdata *drvdata) 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: %d\n", @@ -577,9 +576,9 @@ static void etm_disable_hw(void *info) for (i = 0; i < drvdata->nr_cntr; i++) config->cntr_val[i] = etm_readl(drvdata, ETMCNTVRn(i)); + etm_set_pwrdwn(drvdata); coresight_disclaim_device_unlocked(drvdata->base); - etm_set_pwrdwn(drvdata); CS_LOCK(drvdata->base); dev_dbg(drvdata->dev, "cpu: %d disable smp call done\n", drvdata->cpu);