Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp719812pxu; Thu, 7 Jan 2021 17:00:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwvGKkSOenuOZ0g1cgnJ2fvTn6Jyzu16w0OD7SkSbh4HpxaNnEent2mTT8dJKp5Hu7Q834z X-Received: by 2002:a05:6402:a52:: with SMTP id bt18mr3567391edb.228.1610067630732; Thu, 07 Jan 2021 17:00:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610067630; cv=none; d=google.com; s=arc-20160816; b=RvZkPf5Khh3GpFWiNd7n3/M1TXII8ETLGc6U3dP/MU6zpwPihk3NArPIrtG5LybJ9G nLgxGRoB+xB4sXSw6MbuROgucOJMQ+QgffY5pFHG18WhEixZdX5DlCszoD16UmNDeF6g Xidm9p9RoHp0+KPKp0e83BTCrKQjlDIl0ypxj4c9jry0DDbSbAZ7eafWhLXtBVWksOMm jZooX9wMavbF6TU8Z//savCrD8AysDmekPe8Akk4lcVKdJ7opbHsdrIfnT1u0DNmN2Hq b5y97L4cLMTc8nLHuu5RTi1qACR6AfPHHTuKHdYzC6AbKo9NP742gdthNYL4NgpvuYY3 iqXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Mzp+TKeYFNUCiao7ntDagpd86LmNj82kXWV1cqQ1gNI=; b=uNMcRhORNVczjlJHWRCf/I+dK/anj0nEgBPanBxNCi29Whb5z9RkAJp8bQczBQEdrt xyjccBIUZrezD9QDUZVUUUqRX1Q6CCGFzYxFHOTZetOzfbdztRC06I9kftpm8SDwKJaB 1sEQ54AlWi+v16gNk8QwaJyo3gN3KuxtaymU+MLtMv7CaMMj80MqETjsCjhYDRSj2ulf jqZt541odi3mrvaOdZX1s6idj/g9ccvaNTybywK4SJY/JtDq/3yU084ww572G+J18eNF 4Sx4HCmgqvsJobrg2X7jHJ/Zy3wEdvoPUUURPKfj+lapsuHgcTUTQxjQ9c0yfrFbKzIH bx7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JeJ1X0pC; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id no7si2750617ejb.586.2021.01.07.17.00.06; Thu, 07 Jan 2021 17:00:30 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=JeJ1X0pC; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729691AbhAHA4N (ORCPT + 99 others); Thu, 7 Jan 2021 19:56:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729502AbhAHA4N (ORCPT ); Thu, 7 Jan 2021 19:56:13 -0500 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBA45C0612F6 for ; Thu, 7 Jan 2021 16:55:32 -0800 (PST) Received: by mail-pg1-x534.google.com with SMTP id 30so6540649pgr.6 for ; Thu, 07 Jan 2021 16:55:32 -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=Mzp+TKeYFNUCiao7ntDagpd86LmNj82kXWV1cqQ1gNI=; b=JeJ1X0pCi75b4g3kj1TGG6/QZXo7nahPOMSU99vr/5fWNWQzc8j8qvv5Abn/cPgiMe 29wPh9yxax0MhLxicw0fS9B4dACTTtrPJURsBfa8BFNFgE8VxoZglovipeft/ILmyiS9 ntuNx5mysRoXl6Lb/CHC4FHcTrsBzs8KgARelCj2SIqGaWInEj6XUjIftItKoO9k9zmm IOH24gnezg8of17ZuvACN2z9DghDEULLUHTCdOWS+2dENlTITRPRIDF+tLkEeGzARXVG IreZ/WS0k5u8Vz89TMPxcfX+C332ScQR2AwQBmlUqPRnRqNI5FKxr5g07njeH+pT04Al wU8Q== 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=Mzp+TKeYFNUCiao7ntDagpd86LmNj82kXWV1cqQ1gNI=; b=WhSMJPqdcsrawavkaiaem70/A/7chrRzBHrKPLYgILr4PNLlciTwHA8zI2xU4wzTGq iSjOkzI+l+TXsUBidqYSvj48mBgelexMSVBWl96mQvDpPfJW9NWaje5D31lDXDaQQp35 T+F3bJxfV0W5gc4JwZrw0Ul/mHWWGGAJ3ipJkiLSxTbCUY1c2EsVV+oIjwLnDHvVrKug xYYheTN5PejXv/HSCR3kSUnAGQ5wixzjJdtIUOg1NYdF6KU+NhFPm4gmjAGPNyGcbeAF KaZ4N5fv1pfxQgGL0/itOQJZ76qs9uRJox29hsofHG5nUYpZ35ZZ2onD1zgUzKEqHj82 K18A== X-Gm-Message-State: AOAM530kq02YzNNwYtUZesdbqehqb9XYw8gZl3/Epv9qwpVrk26dANl4 6eBPxIHTwTyR2F3zWtO6fYSoY81v/xi+QQ== X-Received: by 2002:a63:1322:: with SMTP id i34mr4417255pgl.282.1610067332432; Thu, 07 Jan 2021 16:55:32 -0800 (PST) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id x15sm6524892pfn.118.2021.01.07.16.55.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 16:55:31 -0800 (PST) Date: Thu, 7 Jan 2021 17:55:30 -0700 From: Mathieu Poirier To: Suzuki K Poulose Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, leo.yan@linaro.org, mike.leach@linaro.org, anshuman.khandual@arm.com Subject: Re: [PATCH v6 23/26] coresight: etm4x: Add support for sysreg only devices Message-ID: <20210108005530.GG43045@xps15> References: <20210107123859.674252-1-suzuki.poulose@arm.com> <20210107123859.674252-24-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210107123859.674252-24-suzuki.poulose@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 07, 2021 at 12:38:56PM +0000, Suzuki K Poulose wrote: > Add support for devices with system instruction access only. > They don't have a memory mapped interface and thus are not > AMBA devices. System register access is not permitted to > TRCPDCR and thus skip access to them. > > Cc: Mike Leach > Cc: Mathieu Poirier > Signed-off-by: Suzuki K Poulose > --- > Changes since v5: > - Rebased to accommodate check_arch_features(). > Added comments to explain why we don't pass PID for system > register based devices. > Changes since v4 > - Add "remove" callback for platform_driver. > - Dropped Reviewed-by tag from Mathieu due to the above > > Changes since v3 > - Improve comment over "TRCPDCR" usage with sysreg > - Rename etm_xx => etm4_xx > - Update the compatible to "arm,coresight-etm4x-sysreg" > --- > .../coresight/coresight-etm4x-core.c | 68 +++++++++++++++++-- > 1 file changed, 63 insertions(+), 5 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c > index f4fbb65b4cc1..34a6cdff75e7 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c > +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c > @@ -27,6 +27,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -1736,9 +1737,6 @@ static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid) > return -ENOMEM; > } > > - if (fwnode_property_present(dev_fwnode(dev), "qcom,skip-power-up")) > - drvdata->skip_power_up = true; > - > drvdata->base = base; > > spin_lock_init(&drvdata->spinlock); > @@ -1762,6 +1760,11 @@ static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid) > if (!drvdata->arch) > return -EINVAL; > > + /* TRCPDCR is not accessible with system instructions. */ > + if (!desc.access.io_mem || > + fwnode_property_present(dev_fwnode(dev), "qcom,skip-power-up")) > + drvdata->skip_power_up = true; > + > etm4_init_trace_id(drvdata); > etm4_set_default(&drvdata->config); > > @@ -1820,6 +1823,25 @@ static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id) > return ret; > } > > +static int etm4_probe_platform_dev(struct platform_device *pdev) > +{ > + int ret; > + > + pm_runtime_get_noresume(&pdev->dev); > + pm_runtime_set_active(&pdev->dev); > + pm_runtime_enable(&pdev->dev); > + > + /* > + * System register based devices could match the > + * HW by reading appropriate registers on the HW > + * and thus we could skip the PID. > + */ > + ret = etm4_probe(&pdev->dev, NULL, 0); > + > + pm_runtime_put(&pdev->dev); > + return ret; > +} > + > static struct amba_cs_uci_id uci_id_etm4[] = { > { > /* ETMv4 UCI data */ > @@ -1869,6 +1891,17 @@ static int __exit etm4_remove_amba(struct amba_device *adev) > return 0; > } > > +static int __exit etm4_remove_platform_dev(struct platform_device *pdev) > +{ > + int ret = 0; > + struct etmv4_drvdata *drvdata = dev_get_drvdata(&pdev->dev); > + > + if (drvdata) > + ret = etm4_remove_dev(drvdata); > + pm_runtime_disable(&pdev->dev); > + return ret; > +} > + > static const struct amba_id etm4_ids[] = { > CS_AMBA_ID(0x000bb95d), /* Cortex-A53 */ > CS_AMBA_ID(0x000bb95e), /* Cortex-A57 */ > @@ -1901,6 +1934,21 @@ static struct amba_driver etm4x_amba_driver = { > .id_table = etm4_ids, > }; > > +static const struct of_device_id etm4_sysreg_match[] = { > + { .compatible = "arm,coresight-etm4x-sysreg" }, > + {} > +}; > + > +static struct platform_driver etm4_platform_driver = { > + .probe = etm4_probe_platform_dev, > + .remove = etm4_remove_platform_dev, > + .driver = { > + .name = "coresight-etm4x", > + .of_match_table = etm4_sysreg_match, > + .suppress_bind_attrs = true, > + }, > +}; > + > static int __init etm4x_init(void) > { > int ret; > @@ -1913,16 +1961,26 @@ static int __init etm4x_init(void) > > ret = amba_driver_register(&etm4x_amba_driver); > if (ret) { > - pr_err("Error registering etm4x driver\n"); > - etm4_pm_clear(); > + pr_err("Error registering etm4x AMBA driver\n"); > + goto clear_pm; > } > > + ret = platform_driver_register(&etm4_platform_driver); > + if (!ret) > + return 0; > + > + pr_err("Error registering etm4x platform driver\n"); > + amba_driver_unregister(&etm4x_amba_driver); > + > +clear_pm: > + etm4_pm_clear(); > return ret; > } > > static void __exit etm4x_exit(void) > { > amba_driver_unregister(&etm4x_amba_driver); > + platform_driver_unregister(&etm4_platform_driver); Good catch. Reviewed-by: Mathieu Poirier > etm4_pm_clear(); > } > > -- > 2.24.1 >