Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2535143ybg; Fri, 31 Jul 2020 02:42:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0MRD0sJvPSVPpkH9VvZjeQJkz5Fbgeh4MKCQ3w0ObAgsyKa52xnk+GBdOWlabr1ampKOi X-Received: by 2002:a50:bece:: with SMTP id e14mr2953500edk.190.1596188533348; Fri, 31 Jul 2020 02:42:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596188533; cv=none; d=google.com; s=arc-20160816; b=vUd4mtDQWGoFbIYU6e3j4BEP1TL8Ym4kCpXdeRlwpMUL396KE7cV2eEh9jAm5/x/0M G1vIGd5O9Eqt/oz8p7VIJbel4D9UYRJfbbKO1lqCLmbBqaH3UZlYc3DNyhxJcKehshQG 2dpFXZumRLGXBzulIBx42d/T7+wOnMaOmKnH4ZwkFSZqsQfL+xVxWDi6QWFMcEP8jZmZ 0vVwCJj7qq3iZlM4pqDUZWPFdEfiJN8qEnj/09/m/R3bKBQiMo7MT3QjLRXDl2TXz0MS JHNgPa+WQb/NB992GpetaXhRZkmv4+poxxSLHIG5umNQLJ5lJ7g4BSbjWE2GddWhW+QY IzNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=WcyNJBjjIx5zqW+Lqql1BoTqfn4wD53aFJMZ5rQIaUQ=; b=hZMyxTAGvk/Unij3VWlI0lw5bXuaKteaHEfaK3dKEvtS8UXAnpCvGs39radh9nqVek xTvDHGLhg+vaMLIj/HzUFPixQnQOjzgd+PoYig3RJp2vTQcnYZqp++Fg6kNbTyMeWA4Y BpQIGnHubV1Mxn8nkrsOg2toA6z33YjB+ch6pKyMOTtvrXCqEGuOXG+FbTH9Hdl6TGcm cJJr8/5AV21sZY65Ivul7FXt3n2PkBzFc4sU/pP2n3qzKJEL/BQ5AAmBq+JU/B9vSOw7 wh9c6LPEti8OAFdB5nV4xQ8VJBm3uACnU0JI//ELTz+tGcG8Cp3xoa50lxMjEO9r/VVh tKnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w23si5203623edx.588.2020.07.31.02.41.50; Fri, 31 Jul 2020 02:42:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732268AbgGaJlb (ORCPT + 99 others); Fri, 31 Jul 2020 05:41:31 -0400 Received: from foss.arm.com ([217.140.110.172]:53892 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732257AbgGaJla (ORCPT ); Fri, 31 Jul 2020 05:41:30 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 57AEC31B; Fri, 31 Jul 2020 02:41:30 -0700 (PDT) Received: from [10.37.12.83] (unknown [10.37.12.83]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C54463F66E; Fri, 31 Jul 2020 02:41:28 -0700 (PDT) Subject: Re: [RFC PATCH 06/14] coresight: Convert claim and lock operations to use access wrappers To: mathieu.poirier@linaro.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, mike.leach@linaro.org, coresight@lists.linaro.org References: <20200722172040.1299289-1-suzuki.poulose@arm.com> <20200722172040.1299289-7-suzuki.poulose@arm.com> <20200730195450.GC3155687@xps15> From: Suzuki K Poulose Message-ID: <453196b1-7549-dca5-169a-eff98f8d720e@arm.com> Date: Fri, 31 Jul 2020 10:46:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20200730195450.GC3155687@xps15> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/30/2020 08:54 PM, Mathieu Poirier wrote: > On Wed, Jul 22, 2020 at 06:20:32PM +0100, Suzuki K Poulose wrote: >> Convert the CoreSight CLAIM set/clear, LOCK/UNLOCK operations to >> use the coresight device access abstraction. >> >> Mostly a mechanical change. >> >> Cc: Mathieu Poirier >> Cc: Mike Leach >> Signed-off-by: Suzuki K Poulose >> --- >> drivers/hwtracing/coresight/coresight-catu.c | 14 ++-- >> .../hwtracing/coresight/coresight-cpu-debug.c | 26 ++++++-- >> .../hwtracing/coresight/coresight-cti-sysfs.c | 4 +- >> drivers/hwtracing/coresight/coresight-cti.c | 30 +++++---- >> drivers/hwtracing/coresight/coresight-etb10.c | 20 +++--- >> .../coresight/coresight-etm3x-sysfs.c | 8 +-- >> drivers/hwtracing/coresight/coresight-etm3x.c | 44 ++++++++----- >> drivers/hwtracing/coresight/coresight-etm4x.c | 44 ++++++++----- >> .../hwtracing/coresight/coresight-funnel.c | 18 ++--- >> drivers/hwtracing/coresight/coresight-priv.h | 9 +-- >> .../coresight/coresight-replicator.c | 27 +++++--- >> drivers/hwtracing/coresight/coresight-stm.c | 46 ++++++++----- >> .../hwtracing/coresight/coresight-tmc-etf.c | 36 ++++++---- >> .../hwtracing/coresight/coresight-tmc-etr.c | 19 +++--- >> drivers/hwtracing/coresight/coresight-tpiu.c | 9 +-- >> drivers/hwtracing/coresight/coresight.c | 66 +++++++++++-------- >> include/linux/coresight.h | 16 ++--- >> 17 files changed, 266 insertions(+), 170 deletions(-) >> ... >> diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c >> index 67fc3e3b77d8..d61ffbfe0a5c 100644 >> --- a/drivers/hwtracing/coresight/coresight-funnel.c >> +++ b/drivers/hwtracing/coresight/coresight-funnel.c >> @@ -52,13 +52,14 @@ static int dynamic_funnel_enable_hw(struct funnel_drvdata *drvdata, int port) >> { >> u32 functl; >> int rc = 0; >> + struct coresight_device *csdev = drvdata->csdev; >> >> - CS_UNLOCK(drvdata->base); >> + CS_UNLOCK(&csdev->access); >> >> functl = readl_relaxed(drvdata->base + FUNNEL_FUNCTL); >> /* Claim the device only when we enable the first slave */ >> if (!(functl & FUNNEL_ENSx_MASK)) { >> - rc = coresight_claim_device_unlocked(drvdata->base); >> + rc = coresight_claim_device_unlocked(csdev); >> if (rc) >> goto done; >> } >> @@ -69,7 +70,7 @@ static int dynamic_funnel_enable_hw(struct funnel_drvdata *drvdata, int port) >> writel_relaxed(functl, drvdata->base + FUNNEL_FUNCTL); >> writel_relaxed(drvdata->priority, drvdata->base + FUNNEL_PRICTL); >> done: >> - CS_LOCK(drvdata->base); >> + CS_LOCK(&csdev->access); >> return rc; >> } >> >> @@ -101,8 +102,9 @@ static void dynamic_funnel_disable_hw(struct funnel_drvdata *drvdata, >> int inport) >> { >> u32 functl; >> + struct coresight_device *csdev = drvdata->csdev; > > Sometimes a csdev variable is declared, sometimes not as in get_funnel_ctrl_hw() > below and this makes it hard to review all these changes. Please select a > heuristic and keep with it. I prefer this version but not dead set on it. Agreed, will change. > > Also please split in two, on for CS_LOCK/UNLOCK() and another one for the claim > tag functions. There is a minor dependency here. CS_LOCK/UNLOCK is issued from the coresight_{dis}claim_device() versions. One option is to choose the following order: 1) convert claim/disclaim to accept csdev. And use csdev->access->base for CS_LOCK/UNLOCK. 2) Convert all CS_LOCK/UNLOCK to work on csdev->access. I thought having this at one go might look better. But I agree, it is better to split this one. I will give it a go. Cheers Suzuki