From patchwork Fri Nov 30 18:43:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 152584 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3990122ljp; Fri, 30 Nov 2018 10:43:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/WIYny4BYuaFPVQj5drI/NPwOu1f6ec9ik7joyhOc14DZG6sQirqr6yAC8TU2RPP6yoJCJ4 X-Received: by 2002:a63:d846:: with SMTP id k6mr4653383pgj.251.1543603418507; Fri, 30 Nov 2018 10:43:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543603418; cv=none; d=google.com; s=arc-20160816; b=DN0NTyPyoDmBOyXCI9UNhrjqmiUP9NEtGzISzh67l8gzFIVLdqpi4zBac3ve7JURY5 +C5XdUQyhMzok4k92KeV9MVDdP4ZNt4nFOChTEbAfyYUMv+P+raYvD+4TKlE3dnCVyfW BG5T/ha3UdTOpkio+96/RPD4xc3A99Yt5qrew6x90e4igoojfom86ZonviL2WNfh0C2H DiQkadIJeTf6ddWDZ2fJPTTRM5HHZLOGqAwTxKW/WMtMlrbLp/yh8ridggOfb4IoiExK KiRTxaNHeZySHipwGIYSv2UwEN9m9R/Vnq/BGtgpdyfpqLYx9h90Q48+8WjL+u23PGUn +cJA== 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=nRCMbs1niHfCKKMgIdqa0tTvaYoIe2yHH7+q+SVnGbs+H+OVs7wqndHlPwAjI4vFgv 0Zd8YcCpUhlIpPGboe9wnHNNcZCHNjNzXiNX2zFnZLyz8bSPhpW//IgOV8mPlIX4F/dk fx918Ad9kIxwDAb/Hku33OF0frB1vBSeyIivy8HKUGlSuMq7Hah6sjXRleXCHWFCDv+6 N1kiO5O3Avwi06jooZm/G4z8rVy0nlprnwhLbzn6FsAnkxWVqe55O/eGWr/gSoESbgiv SyzhfvtXjLJLzWGQZ//e6iHrrGp6fYcB/EvUCLVzqPpGBDtf5ltRFgmTqJKjNqBEffI+ J0rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i8F6CGCO; 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 v35si5549086pgl.130.2018.11.30.10.43.38; Fri, 30 Nov 2018 10:43:38 -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=i8F6CGCO; 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 S1726989AbeLAFxs (ORCPT + 32 others); Sat, 1 Dec 2018 00:53:48 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:44913 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726078AbeLAFxX (ORCPT ); Sat, 1 Dec 2018 00:53:23 -0500 Received: by mail-pg1-f196.google.com with SMTP id t13so2847591pgr.11 for ; Fri, 30 Nov 2018 10:43:11 -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=i8F6CGCOfAYjBRuRriccxKKihlxKdkJTiuAsuI6Rq1UYlMykqzsgSxTWcNZx/3bOHZ /1AgbfSqt6i639mZt5TdOoUi4CbHFTV6TpjFSNET1okOzpwje2RZCNlXpn2zcCpPOHX+ R8BLpWofEXs+urLmVufc6Pa4eMSj0HY5czx08= 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=inxTgtk2/mTarJewI7RjWNw1KtTC7QAtGGIdzgnBxX5Ez0AL7lnbenEvvD6sC3Tt5k TaHjPJ84NOp8/g/AUEzrYHnG0Q+3PcG4gLEvNKAeUAVtOLrkKVslnxoQ0w8fP/cmINpz 0BxleYG2IZs4Bh/FJkvsZVXUdxK7/883HHkk43YCSQWTqs0rBWkBDsn37WuRmqxPq2sT OcCow72X/pizmVZZcxToIJGS/uWn8Wf+3k8avl5rhnzACCoKJZ8asZj9vWsu3ox9a7Rx Nr5z6wwQcfPGvqiO6DL8dEHzovhwQ2Xdz/ndBjrUWeDEu4J/fS2wEV0lKuYsKAnLFFEp a09Q== X-Gm-Message-State: AA+aEWbhEEHkrzfDU8pccDPJ9U7/nM4UMxqvyAaCDwTVIoei56LnU+V8 i4NtyVsia9X1T2+P9hK1RBDU6ixGv1w= X-Received: by 2002:a63:e80e:: with SMTP id s14mr5726174pgh.30.1543603391042; Fri, 30 Nov 2018 10:43:11 -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.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Nov 2018 10:43:10 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/6] coresight: etb10: Add support for CLAIM tag Date: Fri, 30 Nov 2018 11:43:03 -0700 Message-Id: <1543603387-32645-3-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 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);