From patchwork Mon Nov 5 22:26:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 150224 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3162527ljp; Mon, 5 Nov 2018 14:26:38 -0800 (PST) X-Google-Smtp-Source: AJdET5e4FIaLQgC1bCGRXtQAOUrI9v8kN9AFVFoAuwfYFlKaxjtuorOvJyCqGxo2rMgL8tKpAQ2b X-Received: by 2002:a63:3e05:: with SMTP id l5mr20363824pga.96.1541456798721; Mon, 05 Nov 2018 14:26:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541456798; cv=none; d=google.com; s=arc-20160816; b=O8ivtN/55DcpQEYOmKJzWeQP8enuwHU7w9UoT2nvxJYdndC3Ssae+cFsM6KBHIlLOo /wPkrENpJutUi3K1jFfmmMHPlEbhRDH9QFtXKIueao+7zELyNpOhDAqElLrdwNqnui+h rnHubQp8yNawWgPqCM3l0cIB9TRrvWV9urt229uWgo+8pE+74lJb0bXMVAMd1/aGZft3 5nqYCxQNCgfAG2N57GTa1poXRa5+JbSw1kMKMGC3Hmrc56mdFqSG8nJMnDreJZpjpay1 mH+LAeU+xljqny+eLiizo0ADwMoq47ocL2tE5YKSyILD3V6ZH9a/uboIQJWmUH/fjMN1 HbaQ== 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=czk6Nudv5RkepuEAFasNAuqyPXKfGg6GxLpRP0gwu+A=; b=nL+5ulSufwFOIvxzDLgDap9lHfcOMXfvVy5RR5NC2MdFjXGcAIwUmE5lyg1NdPmFvU Zlu5zfAS90ZmyGo9qQBdeXZPFfZFtvvcb31kbyisczJ83VnQFc0Id66vq9vfM+7RCWOo U3MDcqwzIa1nsmhB9eczcvwxn7UVlepgAE2zpIEqTx7BaTpuqP5XlZCNiXxo74d+f168 1VpLB1ca1/CldVhTth4R9Zl7QnEJ1s/1LEBoQfucbD3RDjimp99r0TYoE5gMJTzrpHDn zSY90qUFBmW84ysYVkuTqNO1Cj8cMU3QbKs6CAgINDoCbLE/IeqbaZOYzjCRRxOpB8DW 4wgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ByL3KEha; 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 97-v6si12567253plb.403.2018.11.05.14.26.38; Mon, 05 Nov 2018 14:26: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=ByL3KEha; 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 S2388170AbeKFHsb (ORCPT + 32 others); Tue, 6 Nov 2018 02:48:31 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:33392 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725933AbeKFHsa (ORCPT ); Tue, 6 Nov 2018 02:48:30 -0500 Received: by mail-pg1-f195.google.com with SMTP id q5-v6so4874267pgv.0 for ; Mon, 05 Nov 2018 14:26:35 -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=czk6Nudv5RkepuEAFasNAuqyPXKfGg6GxLpRP0gwu+A=; b=ByL3KEhazCZAstZsXQIRX1ZKvzDtDRNwJt7TQWseIuPCLXrAslY0nHP5qe30hx6J5F GCqxfUN7Z6N7OJlLvMlpLG4wIZYMO08K/9dwiXCnA1KshkqQXwRi3toRIuoz6LcjQQ6A sJxaPSYfxHZ5uihMVRMe9VuY1eLaUksBjIw68= 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=czk6Nudv5RkepuEAFasNAuqyPXKfGg6GxLpRP0gwu+A=; b=E8Q5L4RNitPhZgvjztYNFcP1Gra/bq6sFMHF3NyyZRe3bl5JfIhEOsj8TjoqnD2+Rb v8PPUSxqb5kn5wIQN/u1PJ0J9UM+VT84L/m6vBpl6ea1TZxMDaAE+FyPcr1T0RHwsv7v KAzpiEDM2/rJTA4VEFUTHdZm/TEZ8s0FlJu/eCOkLTg8bd2qXTGem4fVcL7YneOpqnep qe2+yLmBRQGRFAHWIQ3NU8v9VMg0nUD+5SetXue4WqR87T8Rq6zjMeZ3AMzmF5dvinaA FaasctDmXJyV+PuAH2KMO4Mawn421BvtMocr2wRdWPPHOGnFej4+ucXRMDBFZep9/oA0 CtYg== X-Gm-Message-State: AGRZ1gLwjzFk+UJzItUg60dtbt3taHEZH0Wqp8WVhmEZ2YDpy5NkeRIM eFjMxlCXgVfCqWfa/r5Uuxj73w== X-Received: by 2002:a63:dd0a:: with SMTP id t10-v6mr21672846pgg.379.1541456795182; Mon, 05 Nov 2018 14:26:35 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id q26-v6sm58669804pfi.165.2018.11.05.14.26.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Nov 2018 14:26:34 -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 1/3] coresight: etb10: Add support for CLAIM tag Date: Mon, 5 Nov 2018 15:26:28 -0700 Message-Id: <1541456790-28282-2-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1541456790-28282-1-git-send-email-mathieu.poirier@linaro.org> References: <1541456790-28282-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 --- drivers/hwtracing/coresight/coresight-etb10.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) -- 2.7.4 Reviewed-by: Suzuki K Poulose 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);