From patchwork Wed Nov 7 23:08:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 150460 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp123737ljp; Wed, 7 Nov 2018 15:09:00 -0800 (PST) X-Google-Smtp-Source: AJdET5cJEvxtGw507ksIHATA3VjQcTc/h7P33iUWNSikWDuRocJ5Hmi9PUOMdw4VqE/mREMvvZbS X-Received: by 2002:a17:902:162:: with SMTP id 89-v6mr2209075plb.293.1541632140276; Wed, 07 Nov 2018 15:09:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541632140; cv=none; d=google.com; s=arc-20160816; b=MuuQQ1rD8BeF8AODqn/NSLYL5DzJP749io/cb/YaWVPlm1JVkyRWjnnIakNuKdwj4V 2mpDfkw22tpsr9JF+PkZEJ7/txziDdewkTB62W0vLLnAdOx9GY3Zg5iiULdk/JUSpyke +nHq4/xeQpm7ymQCWCK/0/mKYv6zQNOJLOnYsPr/EskCPl9cHArKohkRFn7tMxZ7/emJ ewZ9wazmbx0F9efQ/FpfU9FSzXO21oQrSR/hh4MeIcDQUrbDOidx8FV7/ENxUbM37cKQ xW5wtRQhc2Bs+Hcf+RqMLru13cez/weYtZ1BmcyQCNJnX3U4vR29yPc+ND3H1vtmUDeF jlXA== 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=OXwnhYG6hQi1Mbl3UXmr0yioawjZlr4QoOQbaBfX9RQ=; b=0FCLTsEglbnwjFzoia7qVDvPZztxLKMBCwfJgun8iGerRn0xPppl8g6KOeWtO7Tyn/ XxTxhCWmeV60qN5hqBXnY38EaEaYGI01gxoHts7Om4yTj763zrWxSSnxiy4nqa8z61uj lZp/GUask+xroYJ9YA3BauZlKL893iEcTz314jYwPxY9/VCHl7VuJIaSlsY72Cg+oh4H Cuy0ruNh+3lJ2xIH6JbmVBwY0Opl0WC+JhCppQmecEqacZRxLngZkesrTKWCD6mamKF9 sodO33GgVmbs7y4wAI6bzy6AVES4sRb511AKsYOuFXYU9ly5QLbBAc2xAYOLBoE/+6F/ dePQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RepACDJG; 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 11si1767777pgy.408.2018.11.07.15.08.59; Wed, 07 Nov 2018 15:09:00 -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=RepACDJG; 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 S1728286AbeKHIlc (ORCPT + 32 others); Thu, 8 Nov 2018 03:41:32 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:35717 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727374AbeKHIlb (ORCPT ); Thu, 8 Nov 2018 03:41:31 -0500 Received: by mail-pl1-f195.google.com with SMTP id n4-v6so8563323plp.2 for ; Wed, 07 Nov 2018 15:08:56 -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=OXwnhYG6hQi1Mbl3UXmr0yioawjZlr4QoOQbaBfX9RQ=; b=RepACDJG8LAg/6Bu6ZjqlkO92o+E423fktjs656vjuS/l9NX0YyzirJkSwapvk1bRB 3K7ftSYA7EtKXFa9SDMmk3kbxkgjSanXIhhmSrp8lUkNNQpoyZ1PemPHNxGdUvxityVE wyexUWhvZc8ne/ejzj/PfpYG/vXvLxKyf15Kk= 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=OXwnhYG6hQi1Mbl3UXmr0yioawjZlr4QoOQbaBfX9RQ=; b=fb73fpylA8522bQX2QzgPuY/6eoQF8DHcSKqFRCLDpmC5+s20fJyE0Pk+vw+A22Svh +7X11wuF4h7CeLC6UxDU58umdbglFUb3YiQ+nDWMZA97WAaqFTJcpwpqxD6fUB31Jmra a7sL2nuY/hj8BJ9epwQhKtOnKL1+6YPloibUMTddlA0FgAZI2bKlarwWLKcGOm+XlhoU o1fnUFaNywp9DMLBXpsJYYUHMI1a8v0ipPBIr0AciuHPYXCO+jnXBmEcWjA9kOtO+yoe HqOojohlJJYG9E8YpeUnusWj60Ae7JXI2AuHEk/Org2teZabjp+syLZInPLba/SLtvpl IPig== X-Gm-Message-State: AGRZ1gKImC76i3dii+QmAgJc1DpFledOF2mR86MREZEk+L1DjKUQkpOA 5nSnvOCMG7zoy8gQYsVSHIgzvw== X-Received: by 2002:a17:902:110a:: with SMTP id d10-v6mr2228999pla.85.1541632136019; Wed, 07 Nov 2018 15:08:56 -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.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Nov 2018 15:08:55 -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 1/4] coresight: etb10: Add support for CLAIM tag Date: Wed, 7 Nov 2018 16:08:49 -0700 Message-Id: <1541632132-1252-2-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 Following in the footstep of what was done for other CoreSight devices, add CLAIM tag support to ETB10 in order to synchronise access to the HW between the kernel and an external agent. Signed-off-by: Mathieu Poirier Reviewed-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-etb10.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 824be0c5f592..105782ea64c7 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -136,6 +136,11 @@ static void __etb_enable_hw(struct etb_drvdata *drvdata) static int etb_enable_hw(struct etb_drvdata *drvdata) { + int rc = coresight_claim_device(drvdata->base); + + if (rc) + return rc; + __etb_enable_hw(drvdata); return 0; } @@ -223,7 +228,7 @@ static int etb_enable(struct coresight_device *csdev, u32 mode, void *data) return 0; } -static void etb_disable_hw(struct etb_drvdata *drvdata) +static void __etb_disable_hw(struct etb_drvdata *drvdata) { u32 ffcr; @@ -313,6 +318,13 @@ static void etb_dump_hw(struct etb_drvdata *drvdata) CS_LOCK(drvdata->base); } +static void etb_disable_hw(struct etb_drvdata *drvdata) +{ + __etb_disable_hw(drvdata); + etb_dump_hw(drvdata); + coresight_disclaim_device(drvdata->base); +} + static void etb_disable(struct coresight_device *csdev) { struct etb_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); @@ -323,7 +335,6 @@ static void etb_disable(struct coresight_device *csdev) /* Disable the ETB only if it needs to */ if (drvdata->mode != CS_MODE_DISABLED) { etb_disable_hw(drvdata); - etb_dump_hw(drvdata); drvdata->mode = CS_MODE_DISABLED; } spin_unlock_irqrestore(&drvdata->spinlock, flags); @@ -402,7 +413,7 @@ static unsigned long etb_update_buffer(struct coresight_device *csdev, capacity = drvdata->buffer_depth * ETB_FRAME_SIZE_WORDS; - etb_disable_hw(drvdata); + __etb_disable_hw(drvdata); CS_UNLOCK(drvdata->base); /* unit is in words, not bytes */ @@ -510,7 +521,7 @@ static unsigned long etb_update_buffer(struct coresight_device *csdev, handle->head = (cur * PAGE_SIZE) + offset; to_read = buf->nr_pages << PAGE_SHIFT; } - etb_enable_hw(drvdata); + __etb_enable_hw(drvdata); CS_LOCK(drvdata->base); return to_read; @@ -534,9 +545,9 @@ static void etb_dump(struct etb_drvdata *drvdata) spin_lock_irqsave(&drvdata->spinlock, flags); if (drvdata->mode == CS_MODE_SYSFS) { - etb_disable_hw(drvdata); + __etb_disable_hw(drvdata); etb_dump_hw(drvdata); - etb_enable_hw(drvdata); + __etb_enable_hw(drvdata); } spin_unlock_irqrestore(&drvdata->spinlock, flags); From patchwork Wed Nov 7 23:08:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 150461 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp123757ljp; Wed, 7 Nov 2018 15:09:01 -0800 (PST) X-Google-Smtp-Source: AJdET5fKnMoBGMVrmAWNyTN6cNFn5xd0Byuqz0pGv4uLBZUmfeAiEj20Zc4+4zc1pE+ooZQuPY4y X-Received: by 2002:a63:7f0e:: with SMTP id a14-v6mr1890725pgd.296.1541632141605; Wed, 07 Nov 2018 15:09:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541632141; cv=none; d=google.com; s=arc-20160816; b=VjtedXMNhfpsr+EtAmY+bKrxVBnxjFE9P9T5MWDSx8TzQXXAOO2pAGrLTtbIF83G8L Oi5ykR7E2Sm8FAGtFqoajZJVbMpP33glWo67dwknDsyfiNS/q3C/pFdlh4wwTnzunjUp ZW3ZdQSKPuezVOi2DF69DYIFnOYtuzSrb4uBqMp52+j6UahVo8fxbnZ3S7oU7csFRK6n un3qRCLamNCXif0bT3jIpOHJZ3NEeo/wU4DP9PVQdY4QapUWb9xr+/4PVj+1BlT7MEmQ gPNpB1l/W/nTH0zhBmug5THqUFOPyd6IeTpQIRLgwp5ds53+yD3kqoyHJ/O6YrWg1D6y 6P+w== 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=a54bpJWkTONWX4xBh3sap+Bcri1qS8QIiPLNgbLvU28=; b=e/rDU30REmqfBBBvaFSUAWHMbIqxxQzPdeFDG5AfuuxxRPD3xnze+QC80oj1u7VVBi qh2QBq5ETpn1PPbWp33MTCAyZiKKRWtCyhkMrkI+LuzIKp9ozNXxfyJ/nkcIsOks0bjY mqO78iViqhOFUQhkuhi7ejrzpzRUugdP2/1BwCJiM0VHyyvpe9vrpiiM7XMeUpkEq/Q5 B+/pGtWvmc+Ln+snrxQAOEMQKA0uLBAVDdd6JDAR4GmrhJ5rQCDxvn3WqSKu3J1Rams3 kvbdwPryclDtf/bb8BFxQfBM4wTmhfSEEpCLnnP5wSW1Js/BQqjV0CBUuMLOryUQ8F7q s6cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="AwZL/D5d"; 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 o24-v6si1667790pgv.242.2018.11.07.15.09.01; Wed, 07 Nov 2018 15:09:01 -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="AwZL/D5d"; 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 S1728344AbeKHIld (ORCPT + 32 others); Thu, 8 Nov 2018 03:41:33 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35976 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727374AbeKHIld (ORCPT ); Thu, 8 Nov 2018 03:41:33 -0500 Received: by mail-pf1-f194.google.com with SMTP id d13-v6so1201320pfo.3 for ; Wed, 07 Nov 2018 15:08:58 -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=a54bpJWkTONWX4xBh3sap+Bcri1qS8QIiPLNgbLvU28=; b=AwZL/D5dLy8phDigaMDGifD0erJIZ1zZs17j10a1S2Wl9x2zrDCMOxv9zAtFQhLSIV bk6jqEYxmJY7WT8BWaw/e51xYAo9YqgAlauZFLAPZdLTqieu3i4LXT1XxRZNBEqSeMkb EqSbDShuUBvk9T8TybIQXX2uDXWRvzyiks4dk= 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=a54bpJWkTONWX4xBh3sap+Bcri1qS8QIiPLNgbLvU28=; b=CfBXqKfXqhHilK8Q1RNPX0JJfOuCYCAv3oudkQTXZltvbQxNf4+iNvMUUWt6QXjH2O hUQveuJoeSmCaS+vjRCibR/v9k/H1X9A+LV+vGgkEN09pVcSN7Eo9kWwTJzc7b+8K1SA NMqnoxpFFRPZ1mM2N5QjQEEj1kqtu3oNc0vcSHW0zyEE7bzDuG3naqkioIGtNN2M10ir 0VRBNjqkrj70X4mgN+U+n9LtHvl+PoJHhdNnPoAPSvYfxIwsWRMXBpTi/tGOYWrNonwB MNuMSvsGD/LNx7+adec2urNMk1NiSAcndJbzQcdWWFq8/pMgsISfP1ptAumUsBwbZ0Fq v/cg== X-Gm-Message-State: AGRZ1gLG989sTsS7AGauCd6rgzm7GCt2e8drsOXBVBcrhOrF5jZH7hpr 2XSWQSF4iXHbYRSYR4/REhBnig== X-Received: by 2002:a62:8208:: with SMTP id w8-v6mr2219657pfd.150.1541632137587; Wed, 07 Nov 2018 15:08:57 -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.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Nov 2018 15:08:56 -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 2/4] coresight: etf: Release CLAIM tag after disabling the HW Date: Wed, 7 Nov 2018 16:08:50 -0700 Message-Id: <1541632132-1252-3-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 rectifies the sequence of events in function tmc_etb_disable_hw() by disabling the HW first and then releasing the CLAIM tag. Otherwise we could be corrupting the configuration done by an external agent that would have claimed the device after we have released it. Signed-off-by: Mathieu Poirier Reviewed-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-tmc-etf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index 5864ac55e275..a5f053f2db2c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -86,8 +86,8 @@ static void __tmc_etb_disable_hw(struct tmc_drvdata *drvdata) static void tmc_etb_disable_hw(struct tmc_drvdata *drvdata) { - coresight_disclaim_device(drvdata->base); __tmc_etb_disable_hw(drvdata); + coresight_disclaim_device(drvdata->base); } static void __tmc_etf_enable_hw(struct tmc_drvdata *drvdata) 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); From patchwork Wed Nov 7 23:08:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 150463 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp123799ljp; Wed, 7 Nov 2018 15:09:04 -0800 (PST) X-Google-Smtp-Source: AJdET5derF8SrwDDCJvTj/8Gm//XaiWH8B+xJqd7dH2UXGSBZperCzfQ9WDBQl75/NvMZiUVjaWE X-Received: by 2002:a63:2b01:: with SMTP id r1mr1870389pgr.432.1541632144272; Wed, 07 Nov 2018 15:09:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541632144; cv=none; d=google.com; s=arc-20160816; b=m23+WRp4YPTjDYFZL5n11ZhgFqjPF+3anNukBLJBUxVLsvHtkM1spEtsiIzWunzkVF PNpx6vEc5Sq8UhRyL+qbXSBE3x7u+MUz56H9X0HGQb383D2s+JtMkFFPQkmWDqkl6D5y E6vzev6jsYMc8Zx1P9Lb/11uSsiT5c4JlafFhV9rbCGovsUCzfQzQ89JTleFSpUQcSvQ 5tJVN+L78OHVQkVZ14zTRP3PGLfo/aZkClOUuNtl3NLF4I+SxTnIbeVxo9JEAkq6SRdj FNCQFBQsstYdI5stC1VEUa7yxUcx6a7+2xflFpMZSFTKUv9r8w91Q3WoqmLW0p0mG6ud /M5A== 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=KfFijGXJwU7EYqU+SdDNmXH5u5EZCG9E6Nv8N75Zm7o=; b=XD+Spcfjc2G7wMScByDB/xavhej9PVKw7gpb8xG10IdpT1jyWYnJjCFA8hs8VIv1Kx SAJ9Wlh2NCYx0PbhlV0htnf1P4z+NhSHZ22r7p2afd1m9G3STrANVMqq6IgA5njufFS/ mIIS9eDe4F5ETVJCU7spWjPhMHAmMQHb/XmnjoWM5vmELyDrOmpoEwSVeOBVZnuMy8NR mwl6AFNa2zpkPDSxyDlDrN6oTXdWYinStQbIsaIW3vr+A2OAjGO2CQPndiBFsxObQ9kc lKVHQo/H7AxEpKPOXqZhjgkz4UlkYkNMItAs5HEtXpzuWUPh7gJlJBcLFHsWb+eSwC6i aKbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dQ81GztV; 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 d9-v6si2079256pfo.108.2018.11.07.15.09.04; Wed, 07 Nov 2018 15:09:04 -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=dQ81GztV; 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 S1728393AbeKHIlh (ORCPT + 32 others); Thu, 8 Nov 2018 03:41:37 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:40993 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727374AbeKHIlg (ORCPT ); Thu, 8 Nov 2018 03:41:36 -0500 Received: by mail-pg1-f195.google.com with SMTP id 70so2385439pgh.8 for ; Wed, 07 Nov 2018 15:09:00 -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=KfFijGXJwU7EYqU+SdDNmXH5u5EZCG9E6Nv8N75Zm7o=; b=dQ81GztVCN/8T6I1e52qyjWwEl0/RCF9wQDvKZS2H3xNo/ItgsXkjnyzQmJTNVWFie TpxCp9atw7eIqjOSz6tUF0DDmPGeo8xseVtU30X9R7a8oAK8EDVkXS+cUxZurfJ2SouT qxxDw+TdYYvAsDgZRs/3xw2R6gUA+4quEl4Y4= 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=KfFijGXJwU7EYqU+SdDNmXH5u5EZCG9E6Nv8N75Zm7o=; b=EtWLS2vs7kWQGr88ijg1bsOBH2gVes4xrtK8SevcB4TfdlW/ksx0Q4DDN5J1dQThSV icxgnzwZS52gAWMWz13x4kT9w7T8GLwuCmMyjnu8OUfTbnXXYqKnbs4RWLRA2bNm0Rdd hdZfwot6gKEbLwTSMx2Jg0HkweeYeM3DBExlrxwsc1yyUUna2llxD2CultNRWKl/9HOv 59XCzXnrj6X2S1OXavMAHjzNThPtxIkrjaaSPWkJ0rVYj2j7Xr6HNoaCrIIGDhutnm6i B5A+s+W2gUldF9UchiYOi8lqC1rns5FUcMWsIYDaBff6sHoYNSSAIlLdufTZ6eWV/nok rDdQ== X-Gm-Message-State: AGRZ1gLzx+XhSwSCEq7UfoYaO8xIL2QLnzZv+98eW2sHjHZQS3/0zk0V TmRPhISoFpEtfufquAygP8pbXA== X-Received: by 2002:a62:ae06:: with SMTP id q6-v6mr2242703pff.126.1541632140457; Wed, 07 Nov 2018 15:09:00 -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.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Nov 2018 15:08:59 -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 4/4] coresight: etm3x: Release CLAIM tag when operated from perf Date: Wed, 7 Nov 2018 16:08:52 -0700 Message-Id: <1541632132-1252-5-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 deals with the release of the CLAIM tag when the ETM is operated from perf. Otherwise the tag is left asserted and subsequent requests to use the device fail. Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm3x.c | 1 + 1 file changed, 1 insertion(+) -- 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 4f638d81a66a..d7f452e62193 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -602,6 +602,7 @@ static void etm_disable_perf(struct coresight_device *csdev) * power down the tracer. */ etm_set_pwrdwn(drvdata); + coresight_disclaim_device_unlocked(drvdata->base); CS_LOCK(drvdata->base); }