From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A686C433DF for ; Fri, 31 Jul 2020 09:41:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6720F20829 for ; Fri, 31 Jul 2020 09:41:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732273AbgGaJlb (ORCPT ); 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22D60C433DF for ; Fri, 31 Jul 2020 09:43:52 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DE62D20829 for ; Fri, 31 Jul 2020 09:43:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0ANFlZn5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE62D20829 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jTXvBFMjYs/f+PennvcMBqyoQYy+k6bJo6kYuvt6Fik=; b=0ANFlZn5gbEvxgWsM9Z+XBDSw 18j01ChblUMf1YqSTbDhd+bp2I5xrJ7ajO4/AGPmGS6Phf6w6zcWvbqnS2R67UiU4VRJRIhQ22e/H nQcpjaFB+kZbA/wT7ib75y+R7RNNqow4YGj/LpsKW1G5pHvkdc4UPJYHho29bBpzO9/x9bOIHZNZ6 QQEQghuPomJOtWp4DHi5oU8jWtnL27VwI1FfM0vKEgAKINvyXxP22VJ2NPy/Ar/8bcRDT64nVYPV6 bAnTnYjTA4tit9bvRKxzrWEmADuzzixsbQ7SCd5QSuVmHHEjSJCAgkAnxglIoB03AsTDliuxtOyzd WfQTWjabA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k1RY1-0002lJ-CN; Fri, 31 Jul 2020 09:41:53 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k1RXf-0002cr-G3 for linux-arm-kernel@lists.infradead.org; Fri, 31 Jul 2020 09:41:33 +0000 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 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-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200731_054131_718848_781D8336 X-CRM114-Status: GOOD ( 22.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: coresight@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel