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=-9.8 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=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 75C22C2D0A3 for ; Mon, 9 Nov 2020 20:45:01 +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 07CD52068D for ; Mon, 9 Nov 2020 20:45:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bdqWc5RW"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dn5MnfEb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07CD52068D 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:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vwm6Twng5QiRgTTOMShEoHMi4561OiLYu0vinQrUibo=; b=bdqWc5RW4TJpHJyi+i9nD/5ox jWzBCYIeUp2DgX1eCu6JfkYDWZr9mPytrX+HuzbQ+oqkyS03PSysYzL0u94eKtfdhhICNUsCi1Kmd +WSu/l8pDTTGSWGI0ODnw3gUwEppqMdWhahOtH2Ah7Pdg9cVkKb54tBu6DUn38ypaMakZ2UZyvvIU TRtFSSeyRA12dKFEDH7ebIMuF6l2KnIXeC1v4MPGGS42RFeBXMAajWTFhSlTXTBgh2NOrWNI2g6lY 5auKeQxxMZVR0F7Z/egg03vdsX2CLkH62WTMQ4+u/A0wv+c8teywprhmrnWBpsHZEJpHR8er6QWFK Y/bjnYKng==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcE14-0004KT-GW; Mon, 09 Nov 2020 20:43:54 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcE11-0004Jr-Qb for linux-arm-kernel@lists.infradead.org; Mon, 09 Nov 2020 20:43:53 +0000 Received: by mail-pl1-x644.google.com with SMTP id b12so5320903plr.4 for ; Mon, 09 Nov 2020 12:43:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=2o3jpI0FQrHtcHWDW1qDzIPliaaiJ7Npip1LYgFzqJI=; b=dn5MnfEbu8y3LW3TPYLY3VnN65Wn3bk1Mp3LlpSRsexiGcYuYKrhToFsoaUd3DiGCi dLvgvsHJDtBNPyOLuqPiRbujnblRVNw0bLABxpzcla7DQ/NypVVD7gHaIWY59yWTSkLa jLbqoPx6779284kH7NuBEFFzt6nSkTL8DJVpR/6ooEt4EQyFkEjWJQn9iPkLZ/SRFZtM +vnjNF4JQsjn66P+Wtrr8QEZ/0DeLuQwOnunV+zJNI0Ly2Oz+shyvoCVVoRaG8AexhSM DfduaH3Fc7XdV8o6AB4m+IwYuHr2Ke0dckxhmtgh/dWqrWIMq52FIHIIjjx6ogfuZsLj /0zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=2o3jpI0FQrHtcHWDW1qDzIPliaaiJ7Npip1LYgFzqJI=; b=Qa8m7d8zg4cTx8pVdXsPgSUH2V3ow2kt+ZdK48bWE3k8xKEQE0WJqvoOwjBG3Ab1SZ ILs9jPfCGriZ6kDwAVPxXjKFFf3UTq14JNlRKAmTzNXGA055Fo0no7qt7YHOv2UXG+uM pLqN1yVjQg9zCdFWEiAbEWMLdSAtreVGmp66/5NatITVK8oaSFwkfhDg5cARNQaq+j9Z 257SVKk6ylfnLR1v/DRuNmMruc8mHYEawe7ac9e5tbgEQXZl4VCLPj7MquPVS/J0oGL2 EVdTlB0LgwhLeBGD4sDghjduWPjo3zy9txRFKO7RTuQU0nMkhXmX9dzNS/Ei3g/Tu6tJ rHZQ== X-Gm-Message-State: AOAM532ukdmLq9gxOCduka+Onib6XfsSXlYwZ1Sse3fmG8Vm0Q7B9l5E 13VCPuRvdXT1eWQQIwNMdDq8TQ== X-Google-Smtp-Source: ABdhPJwxIB2fkv+Cv6Xd4g8hfOdmf24HogzPQWYOLYYBG7e4bCphm/NchKFP1mg/9CMahgWV4SKx3g== X-Received: by 2002:a17:902:b192:b029:d7:ca4a:4ec1 with SMTP id s18-20020a170902b192b02900d7ca4a4ec1mr11750733plr.76.1604954629590; Mon, 09 Nov 2020 12:43:49 -0800 (PST) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id w22sm11107187pge.25.2020.11.09.12.43.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 12:43:49 -0800 (PST) Date: Mon, 9 Nov 2020 13:43:47 -0700 From: Mathieu Poirier To: Suzuki K Poulose Subject: Re: [PATCH v3 24/26] coresight: etm4x: Refactor probing routine Message-ID: <20201109204347.GC3396611@xps15> References: <20201028220945.3826358-1-suzuki.poulose@arm.com> <20201028220945.3826358-26-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201028220945.3826358-26-suzuki.poulose@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201109_154352_169541_42A9427E X-CRM114-Status: GOOD ( 25.70 ) 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-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 On Wed, Oct 28, 2020 at 10:09:43PM +0000, Suzuki K Poulose wrote: > CoreSight ETM with system register access may not have a > memory mapped i/o access. Refactor the ETM specific probing > into a common routine to allow reusing the code for such ETMs. > > Cc: Mathieu Poirier > Cc: Mike Leach > Signed-off-by: Suzuki K Poulose > --- > .../coresight/coresight-etm4x-core.c | 48 +++++++++++-------- > 1 file changed, 29 insertions(+), 19 deletions(-) Reviewed-by: Mathieu Poirier > > diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c > index dc537b5612eb..25fab5513604 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c > +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c > @@ -1598,14 +1598,11 @@ static void etm4_pm_clear(void) > } > } > > -static int etm4_probe(struct amba_device *adev, const struct amba_id *id) > +static int etm4_probe(struct device *dev, void __iomem *base) > { > int ret; > - void __iomem *base; > - struct device *dev = &adev->dev; > struct coresight_platform_data *pdata = NULL; > struct etmv4_drvdata *drvdata; > - struct resource *res = &adev->res; > struct coresight_desc desc = { 0 }; > struct etm_init_arg init_arg = { 0 }; > > @@ -1629,11 +1626,6 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) > if (fwnode_property_present(dev_fwnode(dev), "qcom,skip-power-up")) > drvdata->skip_power_up = true; > > - /* Validity for the resource is already checked by the AMBA core */ > - base = devm_ioremap_resource(dev, res); > - if (IS_ERR(base)) > - return PTR_ERR(base); > - > drvdata->base = base; > > spin_lock_init(&drvdata->spinlock); > @@ -1663,7 +1655,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) > if (IS_ERR(pdata)) > return PTR_ERR(pdata); > > - adev->dev.platform_data = pdata; > + dev->platform_data = pdata; > > desc.type = CORESIGHT_DEV_TYPE_SOURCE; > desc.subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_PROC; > @@ -1683,7 +1675,6 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) > > etmdrvdata[drvdata->cpu] = drvdata; > > - pm_runtime_put(&adev->dev); > dev_info(&drvdata->csdev->dev, "CPU%d: ETM v%d.%d initialized\n", > drvdata->cpu, ETM_ARCH_MAJOR_VERSION(drvdata->arch), > ETM_ARCH_MINOR_VERSION(drvdata->arch)); > @@ -1696,6 +1687,25 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) > return 0; > } > > +static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id) > +{ > + void __iomem *base; > + struct device *dev = &adev->dev; > + struct resource *res = &adev->res; > + int ret; > + > + /* Validity for the resource is already checked by the AMBA core */ > + base = devm_ioremap_resource(dev, res); > + if (IS_ERR(base)) > + return PTR_ERR(base); > + > + ret = etm4_probe(dev, base); > + if (!ret) > + pm_runtime_put(&adev->dev); > + > + return ret; > +} > + > static struct amba_cs_uci_id uci_id_etm4[] = { > { > /* ETMv4 UCI data */ > @@ -1712,15 +1722,15 @@ static void __exit clear_etmdrvdata(void *info) > etmdrvdata[cpu] = NULL; > } > > -static int __exit etm4_remove(struct amba_device *adev) > +static int __exit etm4_remove_amba(struct amba_device *adev) > { > struct etmv4_drvdata *drvdata = dev_get_drvdata(&adev->dev); > > etm_perf_symlink(drvdata->csdev, false); > > /* > - * Taking hotplug lock here to avoid racing between etm4_remove and > - * CPU hotplug call backs. > + * Taking hotplug lock here to avoid racing between etm4_remove_amba() > + * and CPU hotplug call backs. > */ > cpus_read_lock(); > /* > @@ -1760,14 +1770,14 @@ static const struct amba_id etm4_ids[] = { > > MODULE_DEVICE_TABLE(amba, etm4_ids); > > -static struct amba_driver etm4x_driver = { > +static struct amba_driver etm4x_amba_driver = { > .drv = { > .name = "coresight-etm4x", > .owner = THIS_MODULE, > .suppress_bind_attrs = true, > }, > - .probe = etm4_probe, > - .remove = etm4_remove, > + .probe = etm4_probe_amba, > + .remove = etm4_remove_amba, > .id_table = etm4_ids, > }; > > @@ -1781,7 +1791,7 @@ static int __init etm4x_init(void) > if (ret) > return ret; > > - ret = amba_driver_register(&etm4x_driver); > + ret = amba_driver_register(&etm4x_amba_driver); > if (ret) { > pr_err("Error registering etm4x driver\n"); > etm4_pm_clear(); > @@ -1792,7 +1802,7 @@ static int __init etm4x_init(void) > > static void __exit etm4x_exit(void) > { > - amba_driver_unregister(&etm4x_driver); > + amba_driver_unregister(&etm4x_amba_driver); > etm4_pm_clear(); > } > > -- > 2.24.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel