From patchwork Wed Nov 7 23:08:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 150462 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp123770ljp; Wed, 7 Nov 2018 15:09:03 -0800 (PST) X-Google-Smtp-Source: AJdET5f/Cth7xQ7ct3U3VbiNEJyOu4DNdcuBNNJ7PFJXV1dqTcu2naL3za1pqQfCfgJqWHz/e0g9 X-Received: by 2002:a63:8c0b:: with SMTP id m11-v6mr1892106pgd.422.1541632142892; Wed, 07 Nov 2018 15:09:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541632142; cv=none; d=google.com; s=arc-20160816; b=w0kaXv45LIxep1gUvA6zkg1gcGycRVHzuzwc/7X+aFO6wlvHVZauTAEhibY0fBKips uFXHYDE4RkViOHjKGJRuEY6HetwFXtW8MEjDzT3IG7hN+qn5RqLW6gwIa3v0Xeoc8mOV lYHRiw2gtRtDzVwVK/dG+Fx8qADQmjzRwsktu4UCc18zoNkyFvL0seV6aQUIWa2yARvH +WDdnym6rbvV/a/HUUL0oBWb93VugeO4CNf2wKdrvn2mfalWFNBVcmesCLu3YCTFk8UT R0x2TFYkR5bK7CfgHKoe4DLIZZvU3xpHM2W/VaL1Mp9qGcKoj9TdrWcBXsemrkWZX6dQ DbUA== 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=251q+wzxMwb9EgjyEsAosebAViYOYzyiWozPstsfYng=; b=XMflCbhLMa5q/JWNTJmk6vOaeGCmB1q1afJf3ZDYlBbesckFPOgaXXKLMvXuRGHysW LpjjWClOlOkORcCO+X4uMuZfEZ/ssdFQ0KQmxtFR+Fn6lebJZH9ibC11EzuxA6abXq96 jC8CbfvnZfzdaxmMlBfQ4ZGJfeXg7V0AHW7RCI3GLiguYRo72bRAWIUJqoqrX90jag0Y N51+xJEl1ebUQ+wFt+Z5DIgfTU53JdY45YyqgpF07OYdz5nd9V5Qi6JDNUFOn7ydo5nU 3heDHKvPvGLM86HEzgM6Ya0liwdXu7Fpr6WaBPBVEEumJnNowhFnRylVWKrAnbY9uv3r rg8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fV2K4fx8; 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 14si2016826pgt.386.2018.11.07.15.09.02; Wed, 07 Nov 2018 15:09:02 -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=fV2K4fx8; 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 S1728369AbeKHIlf (ORCPT + 32 others); Thu, 8 Nov 2018 03:41:35 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:42998 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727374AbeKHIle (ORCPT ); Thu, 8 Nov 2018 03:41:34 -0500 Received: by mail-pf1-f194.google.com with SMTP id u10-v6so2618487pfn.9 for ; Wed, 07 Nov 2018 15:08:59 -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=251q+wzxMwb9EgjyEsAosebAViYOYzyiWozPstsfYng=; b=fV2K4fx8qaKM1Eo4yhZfAvx1TS/LwV1RBOW2YgqcgovtU/6t158ik28R7BVDqBCg5I 0WF62c6NByPdStb6yuYI5AMLnRD8MOUaMb2vcHcBYltt8PtrlVkch5PV+29lTgEYZ7aM RmKRahNlyWR9hlGGnJayqXvXfVsCA3SNY6vTE= 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=251q+wzxMwb9EgjyEsAosebAViYOYzyiWozPstsfYng=; b=T60SJa5GxkSmQj+wTh9pDYmyxNiCeXXwe+2CNNj9x/pJaVPP9CZQW3yOVAmjXOIwFE zyD7nsOZfG3yu7F05KkEpYr4mLspbWEsqJZZUVuS7RnLqtTXtMI3TsCiFHh9zmO3NANj 7e56Bi6Ge1En1mr2BDI3+QfzIRO9A1tbdEg+U7nBCD5UrAzuSze0EXappGbEklN+BsZx /V7K6E5l07uaxxtqr0SwEKQahFqcRwVH2rjRZ51FhLYM0zncsmotEdDzINV0mLxjaui1 OLK7xHpfkg0rMdLsfXgsOJyycxWRyuCgBrsaWrWgOQy89Kfui9aPTlspc+NBXgq531bo +PcA== X-Gm-Message-State: AGRZ1gLF8XDJtBeeGwgZvyEqbXsiEVS2GYRsphfSsSWNJkAiWPpaaapi 1snjWWPZcns2iA3gm7dZcmOpmA== X-Received: by 2002:a62:9f98:: with SMTP id v24-v6mr2228075pfk.108.1541632139005; Wed, 07 Nov 2018 15:08:59 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id e70-v6sm1802034pfb.113.2018.11.07.15.08.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Nov 2018 15:08:58 -0800 (PST) From: Mathieu Poirier To: linux-arm-kernel@lists.infradead.org Cc: alexander.shishkin@linux.intel.com, leo.yan@linaro.org, suzuki.poulose@arm.com, coresight@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] coresight: etm3x: Deal with CLAIM tag before and after accessing HW Date: Wed, 7 Nov 2018 16:08:51 -0700 Message-Id: <1541632132-1252-4-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1541632132-1252-1-git-send-email-mathieu.poirier@linaro.org> References: <1541632132-1252-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 --- drivers/hwtracing/coresight/coresight-etm3x.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.7.4 Reviewed-by: Suzuki K Poulose diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index fd5c4cca7db5..4f638d81a66a 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,12 +423,11 @@ 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", - drvdata->cpu, rc); + if (!rc) + dev_dbg(drvdata->dev, "cpu: %d enable smp call done: %d\n", + drvdata->cpu, rc); return rc; } @@ -577,9 +577,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);