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.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 EB14CC43464 for ; Fri, 18 Sep 2020 15:37:13 +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 7902020848 for ; Fri, 18 Sep 2020 15:37:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aIKXFUF+"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RNyhhiTX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7902020848 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0vvk9oZ9WbpcMV2g6A3lPpxM9QZWd1yzXN1pM7f/czE=; b=aIKXFUF+CTLirGhaFcmjdKSEt W34IR1AILCvSNnc6iX/rab21xv5Td22rie3GCdY1UAnCqNRFBEooty+nb78dpCF+ficTJRyRmQQ3R 1arRP7/bx9vyTJe+LRsXCM2zXjF+5T+uPwsLOCqTrzPE+/wksbD1Jlv2uLDUOWCvKHP24opv3DdSZ /fmdiuGvsWGZY5cEzOg+f9N9KjfDRsoNgiILkhy/CsvUFZKe3BJ0zDDKVYuLKUHylGERgdtNb861H ZQjWvB2zrzO/dCtj7wZsiSEWjqIL90RxNSyfwECgffjDPyM8qP9SGZ+ONsuF8jsY5wdgQSC6JXN2V GVAkrcv6w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJIPM-0005Gr-IL; Fri, 18 Sep 2020 15:34:44 +0000 Received: from mail-ej1-x644.google.com ([2a00:1450:4864:20::644]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJIP3-0005Ay-Sr for linux-arm-kernel@lists.infradead.org; Fri, 18 Sep 2020 15:34:28 +0000 Received: by mail-ej1-x644.google.com with SMTP id o8so8669921ejb.10 for ; Fri, 18 Sep 2020 08:34:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nOBPLmniHfNOi9YGIY9hrHdEr3ZR58vQwH0UaPE/pOo=; b=RNyhhiTXpLTOQ+d8XUfZzxNchBJ4xpLYRCdlAdMhBxU2J7QIg1POllb4gd6HI05QfD jnlOWx6vqXCHb0QnDeTyxJ4g8Bt+/761XAKbO9vKwWF1vC1fkIddKAZ0P3jJ065tOxUy Nat1RTDI7Cw0iK8HmoYCrKIgzbDqWE+f5M/sHeG9FZPnvbTXBD2wuLSQJrEQamA/R//V TY0nMlJb+6by6nUUiJcXUVssxdZ181ikn/CfhqANxi70PcSteDA4M/3jYWceezcAg6ks xs3Myusjq0epu5z0pcDFMWSoeruf9nxbozTDF1gp019bbl19tBBWQMF1JWYObMBW70cK wVjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nOBPLmniHfNOi9YGIY9hrHdEr3ZR58vQwH0UaPE/pOo=; b=E4eOa2NfMmhpp6TLjCuMM78/mOY8K1zbscSdo54/GD4tP6N6UrloOeEKRbOKbzI/D6 CkQXt7HfOVfae5VuSQWU8hwqDDllfSi16COMHrtcQWmPEa9TT1cRrtQdK8OnsZtvV4DR zwXM4csL5XgdYus2jYn54HYrEdCtcVjShR6gKxS7QWzHJOG9Vjba6HewVWJKSlhJuZ/B eKsaxYjlKAcRbFQYTgS8dttpjiVM3n6WDkYw1b9Zsx2K2d0jKtEO8zJeqsHhfvhGz/K4 fZKkcXXaE+Tw6cbxklCNOhJF8P7UVYBEwSeaqz0wKGNq8XbePrbjUHaUwZVBEZEEWBVQ sx0g== X-Gm-Message-State: AOAM532ZJ100l2PBmdwXpGO9NqyknXiCwQgpVKGGrEOjC664fuduNPpz 3JZK7KCZqsKeYwNlwn1ZD6TlGV1XbD/moeZLcdA/NCpdv10= X-Google-Smtp-Source: ABdhPJwkPWhSW8uU9f9FwvrIPHPyZMaUajiA0amHocRf/ppbseEmH0rooun/TEG+uY6uZpfliWbJdXTlzcaA5D2Kibw= X-Received: by 2002:a17:906:19c7:: with SMTP id h7mr35943420ejd.517.1600443264490; Fri, 18 Sep 2020 08:34:24 -0700 (PDT) MIME-Version: 1.0 References: <20200911084119.1080694-1-suzuki.poulose@arm.com> <20200911084119.1080694-5-suzuki.poulose@arm.com> In-Reply-To: <20200911084119.1080694-5-suzuki.poulose@arm.com> From: Mike Leach Date: Fri, 18 Sep 2020 16:34:13 +0100 Message-ID: Subject: Re: [PATCH 04/19] coresight: Convert claim/disclaim operations to use access wrappers To: Suzuki K Poulose X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200918_113426_027778_1724C8CF X-CRM114-Status: GOOD ( 24.46 ) 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 ML , Anshuman.Khandual@arm.com, Mathieu Poirier , linux-arm-kernel , Leo Yan Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reviewed-by: Mike Leach On Fri, 11 Sep 2020 at 09:41, Suzuki K Poulose wrote: > > Convert the generic CLAIM tag management APIs to use the > device access layer abstraction. > > Cc: Mathieu Poirier > Cc: Mike Leach > Signed-off-by: Suzuki K Poulose > --- > drivers/hwtracing/coresight/coresight-catu.c | 6 +- > drivers/hwtracing/coresight/coresight-cti.c | 17 +++-- > drivers/hwtracing/coresight/coresight-etb10.c | 4 +- > drivers/hwtracing/coresight/coresight-etm3x.c | 8 ++- > drivers/hwtracing/coresight/coresight-etm4x.c | 4 +- > .../hwtracing/coresight/coresight-funnel.c | 6 +- > .../coresight/coresight-replicator.c | 16 +++-- > .../hwtracing/coresight/coresight-tmc-etf.c | 10 +-- > .../hwtracing/coresight/coresight-tmc-etr.c | 4 +- > drivers/hwtracing/coresight/coresight.c | 66 +++++++++++-------- > include/linux/coresight.h | 16 ++--- > 11 files changed, 95 insertions(+), 62 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c > index 15e63e52ff23..df2f45457e2b 100644 > --- a/drivers/hwtracing/coresight/coresight-catu.c > +++ b/drivers/hwtracing/coresight/coresight-catu.c > @@ -412,6 +412,7 @@ static int catu_enable_hw(struct catu_drvdata *drvdata, void *data) > u32 control, mode; > struct etr_buf *etr_buf = data; > struct device *dev = &drvdata->csdev->dev; > + struct coresight_device *csdev = drvdata->csdev; > > if (catu_wait_for_ready(drvdata)) > dev_warn(dev, "Timeout while waiting for READY\n"); > @@ -422,7 +423,7 @@ static int catu_enable_hw(struct catu_drvdata *drvdata, void *data) > return -EBUSY; > } > > - rc = coresight_claim_device_unlocked(drvdata->base); > + rc = coresight_claim_device_unlocked(csdev); > if (rc) > return rc; > > @@ -466,9 +467,10 @@ static int catu_disable_hw(struct catu_drvdata *drvdata) > { > int rc = 0; > struct device *dev = &drvdata->csdev->dev; > + struct coresight_device *csdev = drvdata->csdev; > > catu_write_control(drvdata, 0); > - coresight_disclaim_device_unlocked(drvdata->base); > + coresight_disclaim_device_unlocked(csdev); > if (catu_wait_for_ready(drvdata)) { > dev_info(dev, "Timeout while waiting for READY\n"); > rc = -EAGAIN; > diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c > index e13e24e4a858..e07e15593dd8 100644 > --- a/drivers/hwtracing/coresight/coresight-cti.c > +++ b/drivers/hwtracing/coresight/coresight-cti.c > @@ -102,7 +102,7 @@ static int cti_enable_hw(struct cti_drvdata *drvdata) > goto cti_state_unchanged; > > /* claim the device */ > - rc = coresight_claim_device(drvdata->base); > + rc = coresight_claim_device(drvdata->csdev); > if (rc) > goto cti_err_not_enabled; > > @@ -136,7 +136,7 @@ static void cti_cpuhp_enable_hw(struct cti_drvdata *drvdata) > goto cti_hp_not_enabled; > > /* try to claim the device */ > - if (coresight_claim_device(drvdata->base)) > + if (coresight_claim_device(drvdata->csdev)) > goto cti_hp_not_enabled; > > cti_write_all_hw_regs(drvdata); > @@ -154,6 +154,7 @@ static int cti_disable_hw(struct cti_drvdata *drvdata) > { > struct cti_config *config = &drvdata->config; > struct device *dev = &drvdata->csdev->dev; > + struct coresight_device *csdev = drvdata->csdev; > > spin_lock(&drvdata->spinlock); > > @@ -171,7 +172,7 @@ static int cti_disable_hw(struct cti_drvdata *drvdata) > writel_relaxed(0, drvdata->base + CTICONTROL); > config->hw_enabled = false; > > - coresight_disclaim_device_unlocked(drvdata->base); > + coresight_disclaim_device_unlocked(csdev); > CS_LOCK(drvdata->base); > spin_unlock(&drvdata->spinlock); > pm_runtime_put(dev); > @@ -645,6 +646,7 @@ static int cti_cpu_pm_notify(struct notifier_block *nb, unsigned long cmd, > void *v) > { > struct cti_drvdata *drvdata; > + struct coresight_device *csdev; > unsigned int cpu = smp_processor_id(); > int notify_res = NOTIFY_OK; > > @@ -652,6 +654,7 @@ static int cti_cpu_pm_notify(struct notifier_block *nb, unsigned long cmd, > return NOTIFY_OK; > > drvdata = cti_cpu_drvdata[cpu]; > + csdev = drvdata->csdev; > > if (WARN_ON_ONCE(drvdata->ctidev.cpu != cpu)) > return NOTIFY_BAD; > @@ -663,13 +666,13 @@ static int cti_cpu_pm_notify(struct notifier_block *nb, unsigned long cmd, > /* CTI regs all static - we have a copy & nothing to save */ > drvdata->config.hw_powered = false; > if (drvdata->config.hw_enabled) > - coresight_disclaim_device(drvdata->base); > + coresight_disclaim_device(csdev); > break; > > case CPU_PM_ENTER_FAILED: > drvdata->config.hw_powered = true; > if (drvdata->config.hw_enabled) { > - if (coresight_claim_device(drvdata->base)) > + if (coresight_claim_device(csdev)) > drvdata->config.hw_enabled = false; > } > break; > @@ -682,7 +685,7 @@ static int cti_cpu_pm_notify(struct notifier_block *nb, unsigned long cmd, > /* check enable reference count to enable HW */ > if (atomic_read(&drvdata->config.enable_req_count)) { > /* check we can claim the device as we re-power */ > - if (coresight_claim_device(drvdata->base)) > + if (coresight_claim_device(csdev)) > goto cti_notify_exit; > > drvdata->config.hw_enabled = true; > @@ -726,7 +729,7 @@ static int cti_dying_cpu(unsigned int cpu) > spin_lock(&drvdata->spinlock); > drvdata->config.hw_powered = false; > if (drvdata->config.hw_enabled) > - coresight_disclaim_device(drvdata->base); > + coresight_disclaim_device(drvdata->csdev); > spin_unlock(&drvdata->spinlock); > return 0; > } > diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c > index 2786d02dd23b..5b0d1c1a0442 100644 > --- a/drivers/hwtracing/coresight/coresight-etb10.c > +++ b/drivers/hwtracing/coresight/coresight-etb10.c > @@ -132,7 +132,7 @@ 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); > + int rc = coresight_claim_device(drvdata->csdev); > > if (rc) > return rc; > @@ -344,7 +344,7 @@ static void etb_disable_hw(struct etb_drvdata *drvdata) > { > __etb_disable_hw(drvdata); > etb_dump_hw(drvdata); > - coresight_disclaim_device(drvdata->base); > + coresight_disclaim_device(drvdata->csdev); > } > > static int etb_disable(struct coresight_device *csdev) > diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c > index e3724d8adecb..a7c791f15da7 100644 > --- a/drivers/hwtracing/coresight/coresight-etm3x.c > +++ b/drivers/hwtracing/coresight/coresight-etm3x.c > @@ -360,10 +360,11 @@ static int etm_enable_hw(struct etm_drvdata *drvdata) > int i, rc; > u32 etmcr; > struct etm_config *config = &drvdata->config; > + struct coresight_device *csdev = drvdata->csdev; > > CS_UNLOCK(drvdata->base); > > - rc = coresight_claim_device_unlocked(drvdata->base); > + rc = coresight_claim_device_unlocked(csdev); > if (rc) > goto done; > > @@ -568,6 +569,7 @@ static void etm_disable_hw(void *info) > int i; > struct etm_drvdata *drvdata = info; > struct etm_config *config = &drvdata->config; > + struct coresight_device *csdev = drvdata->csdev; > > CS_UNLOCK(drvdata->base); > etm_set_prog(drvdata); > @@ -579,7 +581,7 @@ static void etm_disable_hw(void *info) > config->cntr_val[i] = etm_readl(drvdata, ETMCNTVRn(i)); > > etm_set_pwrdwn(drvdata); > - coresight_disclaim_device_unlocked(drvdata->base); > + coresight_disclaim_device_unlocked(csdev); > > CS_LOCK(drvdata->base); > > @@ -604,7 +606,7 @@ static void etm_disable_perf(struct coresight_device *csdev) > * power down the tracer. > */ > etm_set_pwrdwn(drvdata); > - coresight_disclaim_device_unlocked(drvdata->base); > + coresight_disclaim_device_unlocked(csdev); > > CS_LOCK(drvdata->base); > } > diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c > index 973fb0fd4826..5b81d6f12027 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x.c > +++ b/drivers/hwtracing/coresight/coresight-etm4x.c > @@ -115,7 +115,7 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata) > > etm4_os_unlock(drvdata); > > - rc = coresight_claim_device_unlocked(drvdata->base); > + rc = coresight_claim_device_unlocked(csdev); > if (rc) > goto done; > > @@ -519,7 +519,7 @@ static void etm4_disable_hw(void *info) > readl_relaxed(drvdata->base + TRCCNTVRn(i)); > } > > - coresight_disclaim_device_unlocked(drvdata->base); > + coresight_disclaim_device_unlocked(csdev); > > CS_LOCK(drvdata->base); > > diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c > index e8e233cbc130..b3f98ce51a68 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); > > 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; > } > @@ -101,6 +102,7 @@ static void dynamic_funnel_disable_hw(struct funnel_drvdata *drvdata, > int inport) > { > u32 functl; > + struct coresight_device *csdev = drvdata->csdev; > > CS_UNLOCK(drvdata->base); > > @@ -110,7 +112,7 @@ static void dynamic_funnel_disable_hw(struct funnel_drvdata *drvdata, > > /* Disclaim the device if none of the slaves are now active */ > if (!(functl & FUNNEL_ENSx_MASK)) > - coresight_disclaim_device_unlocked(drvdata->base); > + coresight_disclaim_device_unlocked(csdev); > > CS_LOCK(drvdata->base); > } > diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c > index 8ba9cbe1d108..b8361bb808f1 100644 > --- a/drivers/hwtracing/coresight/coresight-replicator.c > +++ b/drivers/hwtracing/coresight/coresight-replicator.c > @@ -45,12 +45,18 @@ struct replicator_drvdata { > > static void dynamic_replicator_reset(struct replicator_drvdata *drvdata) > { > + struct coresight_device *csdev = drvdata->csdev; > CS_UNLOCK(drvdata->base); > > - if (!coresight_claim_device_unlocked(drvdata->base)) { > + if (WARN_ON(!csdev)) > + return; > + > + CS_UNLOCK(drvdata->base); > + > + if (!coresight_claim_device_unlocked(csdev)) { > writel_relaxed(0xff, drvdata->base + REPLICATOR_IDFILTER0); > writel_relaxed(0xff, drvdata->base + REPLICATOR_IDFILTER1); > - coresight_disclaim_device_unlocked(drvdata->base); > + coresight_disclaim_device_unlocked(csdev); > } > > CS_LOCK(drvdata->base); > @@ -70,6 +76,7 @@ static int dynamic_replicator_enable(struct replicator_drvdata *drvdata, > { > int rc = 0; > u32 id0val, id1val; > + struct coresight_device *csdev = drvdata->csdev; > > CS_UNLOCK(drvdata->base); > > @@ -84,7 +91,7 @@ static int dynamic_replicator_enable(struct replicator_drvdata *drvdata, > id0val = id1val = 0xff; > > if (id0val == 0xff && id1val == 0xff) > - rc = coresight_claim_device_unlocked(drvdata->base); > + rc = coresight_claim_device_unlocked(csdev); > > if (!rc) { > switch (outport) { > @@ -140,6 +147,7 @@ static void dynamic_replicator_disable(struct replicator_drvdata *drvdata, > int inport, int outport) > { > u32 reg; > + struct coresight_device *csdev = drvdata->csdev; > > switch (outport) { > case 0: > @@ -160,7 +168,7 @@ static void dynamic_replicator_disable(struct replicator_drvdata *drvdata, > > if ((readl_relaxed(drvdata->base + REPLICATOR_IDFILTER0) == 0xff) && > (readl_relaxed(drvdata->base + REPLICATOR_IDFILTER1) == 0xff)) > - coresight_disclaim_device_unlocked(drvdata->base); > + coresight_disclaim_device_unlocked(csdev); > CS_LOCK(drvdata->base); > } > > diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c > index 6375504ba8b0..610a494efbbc 100644 > --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c > +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c > @@ -37,7 +37,7 @@ static void __tmc_etb_enable_hw(struct tmc_drvdata *drvdata) > > static int tmc_etb_enable_hw(struct tmc_drvdata *drvdata) > { > - int rc = coresight_claim_device(drvdata->base); > + int rc = coresight_claim_device(drvdata->csdev); > > if (rc) > return rc; > @@ -88,7 +88,7 @@ static void __tmc_etb_disable_hw(struct tmc_drvdata *drvdata) > static void tmc_etb_disable_hw(struct tmc_drvdata *drvdata) > { > __tmc_etb_disable_hw(drvdata); > - coresight_disclaim_device(drvdata->base); > + coresight_disclaim_device(drvdata->csdev); > } > > static void __tmc_etf_enable_hw(struct tmc_drvdata *drvdata) > @@ -109,7 +109,7 @@ static void __tmc_etf_enable_hw(struct tmc_drvdata *drvdata) > > static int tmc_etf_enable_hw(struct tmc_drvdata *drvdata) > { > - int rc = coresight_claim_device(drvdata->base); > + int rc = coresight_claim_device(drvdata->csdev); > > if (rc) > return rc; > @@ -120,11 +120,13 @@ static int tmc_etf_enable_hw(struct tmc_drvdata *drvdata) > > static void tmc_etf_disable_hw(struct tmc_drvdata *drvdata) > { > + struct coresight_device *csdev = drvdata->csdev; > + > CS_UNLOCK(drvdata->base); > > tmc_flush_and_stop(drvdata); > tmc_disable_hw(drvdata); > - coresight_disclaim_device_unlocked(drvdata->base); > + coresight_disclaim_device_unlocked(csdev); > CS_LOCK(drvdata->base); > } > > diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c > index b29c2db94d96..1aae2405041d 100644 > --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c > +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c > @@ -1021,7 +1021,7 @@ static int tmc_etr_enable_hw(struct tmc_drvdata *drvdata, > rc = tmc_etr_enable_catu(drvdata, etr_buf); > if (rc) > return rc; > - rc = coresight_claim_device(drvdata->base); > + rc = coresight_claim_device(drvdata->csdev); > if (!rc) { > drvdata->etr_buf = etr_buf; > __tmc_etr_enable_hw(drvdata); > @@ -1115,7 +1115,7 @@ void tmc_etr_disable_hw(struct tmc_drvdata *drvdata) > __tmc_etr_disable_hw(drvdata); > /* Disable CATU device if this ETR is connected to one */ > tmc_etr_disable_catu(drvdata); > - coresight_disclaim_device(drvdata->base); > + coresight_disclaim_device(drvdata->csdev); > /* Reset the ETR buf used by hardware */ > drvdata->etr_buf = NULL; > } > diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c > index 21e7615fcbc8..7545a22769c4 100644 > --- a/drivers/hwtracing/coresight/coresight.c > +++ b/drivers/hwtracing/coresight/coresight.c > @@ -130,30 +130,32 @@ static int coresight_find_link_outport(struct coresight_device *csdev, > return -ENODEV; > } > > -static inline u32 coresight_read_claim_tags(void __iomem *base) > +static inline u32 coresight_read_claim_tags(struct coresight_device *csdev) > { > - return readl_relaxed(base + CORESIGHT_CLAIMCLR); > + return csdev_access_relaxed_read32(&csdev->access, CORESIGHT_CLAIMCLR); > } > > -static inline bool coresight_is_claimed_self_hosted(void __iomem *base) > +static inline bool coresight_is_claimed_self_hosted(struct coresight_device *csdev) > { > - return coresight_read_claim_tags(base) == CORESIGHT_CLAIM_SELF_HOSTED; > + return coresight_read_claim_tags(csdev) == CORESIGHT_CLAIM_SELF_HOSTED; > } > > -static inline bool coresight_is_claimed_any(void __iomem *base) > +static inline bool coresight_is_claimed_any(struct coresight_device *csdev) > { > - return coresight_read_claim_tags(base) != 0; > + return coresight_read_claim_tags(csdev) != 0; > } > > -static inline void coresight_set_claim_tags(void __iomem *base) > +static inline void coresight_set_claim_tags(struct coresight_device *csdev) > { > - writel_relaxed(CORESIGHT_CLAIM_SELF_HOSTED, base + CORESIGHT_CLAIMSET); > + csdev_access_relaxed_write32(&csdev->access, CORESIGHT_CLAIM_SELF_HOSTED, > + CORESIGHT_CLAIMSET); > isb(); > } > > -static inline void coresight_clear_claim_tags(void __iomem *base) > +static inline void coresight_clear_claim_tags(struct coresight_device *csdev) > { > - writel_relaxed(CORESIGHT_CLAIM_SELF_HOSTED, base + CORESIGHT_CLAIMCLR); > + csdev_access_relaxed_write32(&csdev->access, CORESIGHT_CLAIM_SELF_HOSTED, > + CORESIGHT_CLAIMCLR); > isb(); > } > > @@ -167,26 +169,32 @@ static inline void coresight_clear_claim_tags(void __iomem *base) > * Called with CS_UNLOCKed for the component. > * Returns : 0 on success > */ > -int coresight_claim_device_unlocked(void __iomem *base) > +int coresight_claim_device_unlocked(struct coresight_device *csdev) > { > - if (coresight_is_claimed_any(base)) > + if (WARN_ON(!csdev)) > + return -EINVAL; > + > + if (coresight_is_claimed_any(csdev)) > return -EBUSY; > > - coresight_set_claim_tags(base); > - if (coresight_is_claimed_self_hosted(base)) > + coresight_set_claim_tags(csdev); > + if (coresight_is_claimed_self_hosted(csdev)) > return 0; > /* There was a race setting the tags, clean up and fail */ > - coresight_clear_claim_tags(base); > + coresight_clear_claim_tags(csdev); > return -EBUSY; > } > > -int coresight_claim_device(void __iomem *base) > +int coresight_claim_device(struct coresight_device *csdev) > { > int rc; > > - CS_UNLOCK(base); > - rc = coresight_claim_device_unlocked(base); > - CS_LOCK(base); > + if (WARN_ON(!csdev)) > + return -EINVAL; > + > + CS_UNLOCK(csdev->access.base); > + rc = coresight_claim_device_unlocked(csdev); > + CS_LOCK(csdev->access.base); > > return rc; > } > @@ -195,11 +203,14 @@ int coresight_claim_device(void __iomem *base) > * coresight_disclaim_device_unlocked : Clear the claim tags for the device. > * Called with CS_UNLOCKed for the component. > */ > -void coresight_disclaim_device_unlocked(void __iomem *base) > +void coresight_disclaim_device_unlocked(struct coresight_device *csdev) > { > > - if (coresight_is_claimed_self_hosted(base)) > - coresight_clear_claim_tags(base); > + if (WARN_ON(!csdev)) > + return; > + > + if (coresight_is_claimed_self_hosted(csdev)) > + coresight_clear_claim_tags(csdev); > else > /* > * The external agent may have not honoured our claim > @@ -209,11 +220,14 @@ void coresight_disclaim_device_unlocked(void __iomem *base) > WARN_ON_ONCE(1); > } > > -void coresight_disclaim_device(void __iomem *base) > +void coresight_disclaim_device(struct coresight_device *csdev) > { > - CS_UNLOCK(base); > - coresight_disclaim_device_unlocked(base); > - CS_LOCK(base); > + if (WARN_ON(!csdev)) > + return; > + > + CS_UNLOCK(csdev->access.base); > + coresight_disclaim_device_unlocked(csdev); > + CS_LOCK(csdev->access.base); > } > > /* enable or disable an associated CTI device of the supplied CS device */ > diff --git a/include/linux/coresight.h b/include/linux/coresight.h > index 55a9c3276a28..811fdc21075a 100644 > --- a/include/linux/coresight.h > +++ b/include/linux/coresight.h > @@ -473,11 +473,11 @@ extern int coresight_timeout(struct csdev_access *csa, > int position, > int value); > > -extern int coresight_claim_device(void __iomem *base); > -extern int coresight_claim_device_unlocked(void __iomem *base); > +extern int coresight_claim_device(struct coresight_device *csdev); > +extern int coresight_claim_device_unlocked(struct coresight_device *csdev); > > -extern void coresight_disclaim_device(void __iomem *base); > -extern void coresight_disclaim_device_unlocked(void __iomem *base); > +extern void coresight_disclaim_device(struct coresight_device *csdev); > +extern void coresight_disclaim_device_unlocked(struct coresight_device *csdev); > extern char *coresight_alloc_device_name(struct coresight_dev_list *devs, > struct device *dev); > > @@ -512,18 +512,18 @@ static inline int coresight_timeout(struct csdev_access *csa, > return 1; > } > > -static inline int coresight_claim_device_unlocked(void __iomem *base) > +static inline int coresight_claim_device_unlocked(struct coresight_device *csdev) > { > return -EINVAL; > } > > -static inline int coresight_claim_device(void __iomem *base) > +static inline int coresight_claim_device(struct coresight_device *csdev) > { > return -EINVAL; > } > > -static inline void coresight_disclaim_device(void __iomem *base) {} > -static inline void coresight_disclaim_device_unlocked(void __iomem *base) {} > +static inline void coresight_disclaim_device(struct coresight_device *csdev) {} > +static inline void coresight_disclaim_device_unlocked(struct coresight_device *csdev) {} > > static inline bool coresight_loses_context_with_cpu(struct device *dev) > { > -- > 2.24.1 > -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel