From patchwork Mon Jul 10 06:24:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 117638 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4821618vqx; Sun, 9 Jul 2023 23:36:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlGNoAPJ5X9tkoL1GzkqZ88m7dHvZUIFRBEC9PZKOXUbJTJtl8rp9IRugZZjwCfOaPukkgtj X-Received: by 2002:a05:6a00:1ace:b0:67b:f249:35e3 with SMTP id f14-20020a056a001ace00b0067bf24935e3mr10051771pfv.26.1688970972475; Sun, 09 Jul 2023 23:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688970972; cv=none; d=google.com; s=arc-20160816; b=N3PFKKGGPX4f+jhLlCxHDrUxAx/qtftJNtttA3Z/OczcmTM3Pf/SSxM/jwdBP66PcY tXUSAfTp13kwRbUQC9tIlSUwJMdmdQK+XW452xi4ISjnATxOePJ+FRbclZAWcTj7gEUx X6Gsr0TXXTMd56wLXg+UfjKYpPDd6JiKmSVfpZrAOSvX5odX1kFC9rWeXpip7By85vKg 56LaUYZJMjHKVqmEaF+aaHX+hax1BZAxispkuCn2NvIKbDDVp4NZpqcNukT6/+zfNi4+ uz+Nh2IbkqveRgzmRzhwuQsLI+hie412hU91tbQOKWjWXbY1T4lcqSECfk4hr4MuiWSV 9GNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=d5i0T8bJPB1vnO99QP8D4yoMhXEgTKfhdApv05pOhqw=; fh=PY9h/cLRZw7UBGWy1EIb8bqZUZXcomX82OLAF53kzVA=; b=TNJxS6btfaMyLHCYn1o1lwOdLszX1JATm4JlxPU3YjFGgm3wBQMYSLd/ETtSedBjK3 DkkJ6xKF/NZ6pJ3kI+KLPmn6QLnweP6zUZFiRbUAEjADtfI2MrEF1Rjt514wowPt7o/G JhFo8V8jmP86Nss5DRmWvh3vmo/fVdviuTh9UQ5ODTLeQTZduX3KdMcr3sydQJQnFKPo gI4l6n6BKWhj70eI4xSMTPgVUCaTSGxgzc2YPtD2uwr4tZwN0EL7KMEEtbDM5Y6E7Hsj npe5+6F+tofPfbXYnS7pCMtN0uSTKqwYTC+AMlfj87uCrD5uSvaL7mpT/2PP2sC2uQzs dwvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bs125-20020a632883000000b0054ff425ab2csi8373708pgb.234.2023.07.09.23.36.00; Sun, 09 Jul 2023 23:36:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230006AbjGJGZa (ORCPT + 99 others); Mon, 10 Jul 2023 02:25:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230466AbjGJGZY (ORCPT ); Mon, 10 Jul 2023 02:25:24 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E4716128; Sun, 9 Jul 2023 23:25:22 -0700 (PDT) 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 B1C05D75; Sun, 9 Jul 2023 23:26:04 -0700 (PDT) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.40.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6F0B33F67D; Sun, 9 Jul 2023 23:25:16 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org Cc: Anshuman Khandual , Ganapatrao Kulkarni , Steve Clevenger , Rob Herring , Frank Rowand , Russell King , Len Brown , Sudeep Holla , Lorenzo Pieralisi , Mathieu Poirier , Mike Leach , Leo Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V6 1/6] coresight: etm4x: Allocate and device assign 'struct etmv4_drvdata' earlier Date: Mon, 10 Jul 2023 11:54:55 +0530 Message-Id: <20230710062500.45147-2-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230710062500.45147-1-anshuman.khandual@arm.com> References: <20230710062500.45147-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771014426219719697 X-GMAIL-MSGID: 1771014426219719697 Allocate and device assign 'struct etmv4_drvdata' earlier during the driver probe, ensuring that it can be retrieved in power management based runtime callbacks if required. This will also help in dropping iomem base address argument from the function etm4_probe() later. Cc: Mathieu Poirier Cc: Suzuki K Poulose Cc: Mike Leach Cc: Leo Yan Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- .../coresight/coresight-etm4x-core.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 7e307022303a..264242ba345b 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -2046,17 +2046,14 @@ static int etm4_add_coresight_dev(struct etm4_init_arg *init_arg) static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid) { - struct etmv4_drvdata *drvdata; + struct etmv4_drvdata *drvdata = dev_get_drvdata(dev); struct csdev_access access = { 0 }; struct etm4_init_arg init_arg = { 0 }; struct etm4_init_arg *delayed; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); - if (!drvdata) + if (WARN_ON(!drvdata)) return -ENOMEM; - dev_set_drvdata(dev, drvdata); - if (pm_save_enable == PARAM_PM_SAVE_FIRMWARE) pm_save_enable = coresight_loses_context_with_cpu(dev) ? PARAM_PM_SAVE_SELF_HOSTED : PARAM_PM_SAVE_NEVER; @@ -2108,6 +2105,7 @@ static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid) static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id) { + struct etmv4_drvdata *drvdata; void __iomem *base; struct device *dev = &adev->dev; struct resource *res = &adev->res; @@ -2118,6 +2116,11 @@ static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id) if (IS_ERR(base)) return PTR_ERR(base); + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + + dev_set_drvdata(dev, drvdata); ret = etm4_probe(dev, base, id->id); if (!ret) pm_runtime_put(&adev->dev); @@ -2127,8 +2130,14 @@ static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id) static int etm4_probe_platform_dev(struct platform_device *pdev) { + struct etmv4_drvdata *drvdata; int ret; + drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + + dev_set_drvdata(&pdev->dev, drvdata); pm_runtime_get_noresume(&pdev->dev); pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); From patchwork Mon Jul 10 06:24:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 117632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4820954vqx; Sun, 9 Jul 2023 23:34:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlGLOf+N+AqJnNX5aqbL4z51H3KNdeKGEb1IfjxiIxRqhYJW/pinVfUdj/wPfTJxAk5TofBI X-Received: by 2002:a17:907:2d2c:b0:98d:ebb7:a8b0 with SMTP id gs44-20020a1709072d2c00b0098debb7a8b0mr17867835ejc.14.1688970890748; Sun, 09 Jul 2023 23:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688970890; cv=none; d=google.com; s=arc-20160816; b=FvQoBPH34yIOv66GOYeEdPOwwTAeVG1pLqkgZR32KBDDpqL/cCCWJFpDxR7ywxYpSh HtgHeOcl2BDg7J61IZEyx+l3OYV9aL0Ew14VaakCFRWP6tWcEb2R0MzviF2BB40mttyJ uMZDQxLJwvrmCQpflbMKYu8YjJelQOfxdRGYuxsGry5wxD0OPf01Pp9yzZrkjXLdulrb mmUB5L+WeuXhivVQBxOzgI5jYaP2v46r8wTlnl+Qzt99nNN2NRpjXnMIbf/6BvsSeEM3 Nr4LHjHeI9wTNSnsVRSDrYsVee9QhW26JOXg4WRmbZNXw4tLsWYGLnr8yeroXCovX0Ko 6e9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=0j4dI3FimJiTTkmqd9o33hvCYlrF7wD1Z4uVboOCSok=; fh=hdwAEthwmb3POkfgUnaElOYfdpDheN8UmlA27oZrR2A=; b=fHkKr7rzmQHCPxL1T3dMu3pG40WtKGJrYzQuK5lsm/cA7tf4xLBh4dYjjavKPeLBQ5 gJC7ctmq5KNRvp2HkXRhEazv8Uo1LJmZxrACjGwrcsXVv2vcTx8C2EIT1QEmWYtb0hYl bZeZE9oGgq2oBzLrJE4RpFKF08bKkzmloEo2B3MKr7/7B7pSRhAxx1BFpmflqpzA5gYW akChfyMPgHqUymcB76bjn4LOfyNCJE9nQw0zL2AaDhg7u0yaTesoxaYPTt+Q4H4N3nuP eT/oo85UEaHDIRwWZM49lImBYO+TXdkjt+8HHvlcqvqhw5eYFJrerK7+dikBL1LpXZs9 avAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o2-20020aa7d3c2000000b0051be8be77afsi8880109edr.145.2023.07.09.23.34.27; Sun, 09 Jul 2023 23:34:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231226AbjGJGZr (ORCPT + 99 others); Mon, 10 Jul 2023 02:25:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230319AbjGJGZc (ORCPT ); Mon, 10 Jul 2023 02:25:32 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 07C0418B; Sun, 9 Jul 2023 23:25:30 -0700 (PDT) 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 CDE101FB; Sun, 9 Jul 2023 23:26:11 -0700 (PDT) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.40.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1B6273F67D; Sun, 9 Jul 2023 23:25:22 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org Cc: Anshuman Khandual , Ganapatrao Kulkarni , Steve Clevenger , Rob Herring , Frank Rowand , Russell King , Len Brown , Sudeep Holla , Lorenzo Pieralisi , Mathieu Poirier , Mike Leach , Leo Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, James Clark Subject: [PATCH V6 2/6] coresight: etm4x: Drop iomem 'base' argument from etm4_probe() Date: Mon, 10 Jul 2023 11:54:56 +0530 Message-Id: <20230710062500.45147-3-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230710062500.45147-1-anshuman.khandual@arm.com> References: <20230710062500.45147-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771014340427129326 X-GMAIL-MSGID: 1771014340427129326 'struct etm4_drvdata' itself can carry the base address before etm4_probe() gets called. Just drop that redundant argument from etm4_probe(). Cc: Mathieu Poirier Cc: Suzuki K Poulose Cc: Mike Leach Cc: Leo Yan Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Reviewed-by: James Clark Signed-off-by: Anshuman Khandual --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 264242ba345b..bf93147c23ca 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -2044,7 +2044,7 @@ static int etm4_add_coresight_dev(struct etm4_init_arg *init_arg) return 0; } -static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid) +static int etm4_probe(struct device *dev, u32 etm_pid) { struct etmv4_drvdata *drvdata = dev_get_drvdata(dev); struct csdev_access access = { 0 }; @@ -2065,8 +2065,6 @@ static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid) return -ENOMEM; } - drvdata->base = base; - spin_lock_init(&drvdata->spinlock); drvdata->cpu = coresight_get_cpu(dev); @@ -2120,8 +2118,9 @@ static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id) if (!drvdata) return -ENOMEM; + drvdata->base = base; dev_set_drvdata(dev, drvdata); - ret = etm4_probe(dev, base, id->id); + ret = etm4_probe(dev, id->id); if (!ret) pm_runtime_put(&adev->dev); @@ -2137,6 +2136,7 @@ static int etm4_probe_platform_dev(struct platform_device *pdev) if (!drvdata) return -ENOMEM; + drvdata->base = NULL; dev_set_drvdata(&pdev->dev, drvdata); pm_runtime_get_noresume(&pdev->dev); pm_runtime_set_active(&pdev->dev); @@ -2147,7 +2147,7 @@ static int etm4_probe_platform_dev(struct platform_device *pdev) * HW by reading appropriate registers on the HW * and thus we could skip the PID. */ - ret = etm4_probe(&pdev->dev, NULL, 0); + ret = etm4_probe(&pdev->dev, 0); pm_runtime_put(&pdev->dev); return ret; From patchwork Mon Jul 10 06:24:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 117640 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4822708vqx; Sun, 9 Jul 2023 23:38:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlFMMfPQ9KldXPo7m6Fb1MuD47h4zAxMaMZrt5aA8wPm0WuZcDQ65x1DQSxqo+dmVuwf30Eg X-Received: by 2002:a19:7113:0:b0:4f9:567a:7a59 with SMTP id m19-20020a197113000000b004f9567a7a59mr9184624lfc.30.1688971136740; Sun, 09 Jul 2023 23:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688971136; cv=none; d=google.com; s=arc-20160816; b=qc94vC1Y31DmPxL8njGtpBQGIRLs72fPY/kWb486lYeZG3QUkONfMdJ7tlHC+yXnmi 03y9dVW0dRBj4pYvQxiCb0lJC6tAFG0yxyWT56oFIObbQ3y6Krn1W6v/BU8ziW328Hem im10hpGXfkOXPYFMgfhsM1ULKbaQXP2nYSGzGjuqkMsiZNFIHp4SmW1zuiUIryRdlXH4 PHKCnAyoQPVeYw75kZuZOgF1AqNvXm9gF8vZzpKL9tCeO6K5N8oxHWywwISu76sMS5ZF rQymzOicomoTrSHEoygdXvrXOb9RxT7Wp8XOgEk7y/TJZTHJDV7ITi/cLKcCraWgc7Xb ATSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=T9qsOxlLou6SXfsR2KqbRloY/ooyLz2frMPfRA3Vo0g=; fh=PY9h/cLRZw7UBGWy1EIb8bqZUZXcomX82OLAF53kzVA=; b=y1cJX/lbQqDLn4F/QJH1F23IX7DK28PT5UmLw+Iv98YcLQN76Yr7jGHW15RI6ksoc4 Nz8bwtkfO472vlFPadYXQIjcAbQNcQPa1eU4ki4VzQ/byJBT6xISpT6jSFg71yxKoXJ1 iZPuQtIQKuBVxRPO0/NNnMmPBWJ6snNDSumWFujXP6y12x0FRVaKnq4O972jfnMICsE1 nT4zND86WyhYPlt6BLPPujxBJfA1taFFZYq1qAErdO9tjIoBBbG4YWkPeQSBC+uuDuYv 8jWGcQSntqFD4Gl1/qlE3S5EIJH9Ou45DnXqR4IBScrNmT2ae2ndLFk5ZbIlRmXtg0h3 MIFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p10-20020aa7d30a000000b0051e1b802ef9si8415266edq.96.2023.07.09.23.38.33; Sun, 09 Jul 2023 23:38:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231381AbjGJG0B (ORCPT + 99 others); Mon, 10 Jul 2023 02:26:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231180AbjGJGZo (ORCPT ); Mon, 10 Jul 2023 02:25:44 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8045B118; Sun, 9 Jul 2023 23:25:36 -0700 (PDT) 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 559741FB; Sun, 9 Jul 2023 23:26:18 -0700 (PDT) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.40.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4AAE73F67D; Sun, 9 Jul 2023 23:25:30 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org Cc: Anshuman Khandual , Ganapatrao Kulkarni , Steve Clevenger , Rob Herring , Frank Rowand , Russell King , Len Brown , Sudeep Holla , Lorenzo Pieralisi , Mathieu Poirier , Mike Leach , Leo Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V6 3/6] coresight: etm4x: Drop pid argument from etm4_probe() Date: Mon, 10 Jul 2023 11:54:57 +0530 Message-Id: <20230710062500.45147-4-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230710062500.45147-1-anshuman.khandual@arm.com> References: <20230710062500.45147-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771014598514057014 X-GMAIL-MSGID: 1771014598514057014 Coresight device pid can be retrieved from its iomem base address, which is stored in 'struct etm4x_drvdata'. This drops pid argument from etm4_probe() and 'struct etm4_init_arg'. Instead etm4_check_arch_features() derives the coresight device pid with a new helper coresight_get_pid(), right before it is consumed in etm4_hisi_match_pid(). Cc: Mathieu Poirier Cc: Suzuki K Poulose Cc: Mike Leach Cc: Leo Yan Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- .../coresight/coresight-etm4x-core.c | 29 ++++++++++--------- include/linux/coresight.h | 12 ++++++++ 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index bf93147c23ca..e91e59ecec53 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -66,7 +66,6 @@ static u64 etm4_get_access_type(struct etmv4_config *config); static enum cpuhp_state hp_online; struct etm4_init_arg { - unsigned int pid; struct device *dev; struct csdev_access *csa; }; @@ -370,9 +369,17 @@ static void etm4_disable_arch_specific(struct etmv4_drvdata *drvdata) } static void etm4_check_arch_features(struct etmv4_drvdata *drvdata, - unsigned int id) + struct csdev_access *csa) { - if (etm4_hisi_match_pid(id)) + /* + * TRCPIDR* registers are not required for ETMs with system + * instructions. They must be identified by the MIDR+REVIDRs. + * Skip the TRCPID checks for now. + */ + if (!csa->io_mem) + return; + + if (etm4_hisi_match_pid(coresight_get_pid(csa))) set_bit(ETM4_IMPDEF_HISI_CORE_COMMIT, drvdata->arch_features); } #else @@ -385,7 +392,7 @@ static void etm4_disable_arch_specific(struct etmv4_drvdata *drvdata) } static void etm4_check_arch_features(struct etmv4_drvdata *drvdata, - unsigned int id) + struct csdev_access *csa) { } #endif /* CONFIG_ETM4X_IMPDEF_FEATURE */ @@ -1161,7 +1168,7 @@ static void etm4_init_arch_data(void *info) etm4_os_unlock_csa(drvdata, csa); etm4_cs_unlock(drvdata, csa); - etm4_check_arch_features(drvdata, init_arg->pid); + etm4_check_arch_features(drvdata, csa); /* find all capabilities of the tracing unit */ etmidr0 = etm4x_relaxed_read32(csa, TRCIDR0); @@ -2044,7 +2051,7 @@ static int etm4_add_coresight_dev(struct etm4_init_arg *init_arg) return 0; } -static int etm4_probe(struct device *dev, u32 etm_pid) +static int etm4_probe(struct device *dev) { struct etmv4_drvdata *drvdata = dev_get_drvdata(dev); struct csdev_access access = { 0 }; @@ -2073,7 +2080,6 @@ static int etm4_probe(struct device *dev, u32 etm_pid) init_arg.dev = dev; init_arg.csa = &access; - init_arg.pid = etm_pid; /* * Serialize against CPUHP callbacks to avoid race condition @@ -2120,7 +2126,7 @@ static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id) drvdata->base = base; dev_set_drvdata(dev, drvdata); - ret = etm4_probe(dev, id->id); + ret = etm4_probe(dev); if (!ret) pm_runtime_put(&adev->dev); @@ -2142,12 +2148,7 @@ static int etm4_probe_platform_dev(struct platform_device *pdev) 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, 0); + ret = etm4_probe(&pdev->dev); pm_runtime_put(&pdev->dev); return ret; diff --git a/include/linux/coresight.h b/include/linux/coresight.h index bf70987240e4..255cfd283883 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -386,6 +386,18 @@ static inline u32 csdev_access_relaxed_read32(struct csdev_access *csa, return csa->read(offset, true, false); } +#define CORESIGHT_PIDRn(i) (0xFE0 + ((i) * 4)) + +static inline u32 coresight_get_pid(struct csdev_access *csa) +{ + u32 i, pid = 0; + + for (i = 0; i < 4; i++) + pid |= csdev_access_relaxed_read32(csa, CORESIGHT_PIDRn(i)) << (i * 8); + + return pid; +} + static inline u64 csdev_access_relaxed_read_pair(struct csdev_access *csa, u32 lo_offset, u32 hi_offset) { From patchwork Mon Jul 10 06:24:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 117630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4819415vqx; Sun, 9 Jul 2023 23:31:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlGuym/ekfkud+EtuTqsje9FNyfFCH8hRKYNeFkCQ0YYLFJyPq/aGNrJIKgO8kpvln+vbr6a X-Received: by 2002:a17:906:6a23:b0:991:f0dc:c930 with SMTP id qw35-20020a1709066a2300b00991f0dcc930mr16583750ejc.16.1688970679000; Sun, 09 Jul 2023 23:31:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688970678; cv=none; d=google.com; s=arc-20160816; b=BS73jwej44T/SIUuWRuiFhplRaMGjIwIrHpbDnXJ62bcqOpVlQdxkrvBmz3U7MHEfI M/ElQ312YLUvDSXwTfxem6frrjH8PaZofmsXkOOC95TIkFDCGxEmcGXkR6SLMYbB7qxH 5Kpgdt2ep81/0V39w8JaWKFDeMJuWX/fMPhVIlJckz+RsxKCWtYjCQr0mb9pvAbVSpqC +6zU4PX1g87pPJo2RGtQTltlPm97eaOj6O3wpbXQnNjXIcPPAtvIH0veWwF1iatvTiXt sUZbUV1AEAGZfrO/9r/KER9+7Xe76lrfvVjXOYUoWYad4HZYXta/KdbjnMPpHVSHrybR OEsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=T2X4GzDVjEq7I+B+8TQbv5/DnqbG9RwBowvKYpk9ROA=; fh=PY9h/cLRZw7UBGWy1EIb8bqZUZXcomX82OLAF53kzVA=; b=i+ro99369wLEtvu5Gxv/zIIQZ0kdL/pv3rPCeqWwQys65X/h73t0Ms8XX7sBy05cT8 d58UHkkh9SqYb4FKmdy9UhI8HgpnFyiAveQOkkQcYfbSuJokwSnCOmxUPvS2Q4G//9d5 BCkXo53IBwsqqIVXT9D2f7dOJfUZNRnOuWriep0MRLC0+ANxT2zsqYJChEudMpfng/VA rDkGrlb6DYatdrI6dtcHL9YfHpKIkDIFq329dpzDAUEiScYOufPAq+eLlKMMS8wYWcN7 a9Z9G2WJROVJzY3mqSPp1z0pbKVvpkDCpNN5zupWz5GaVVz7mJ9JzWaYJtZ1oaEFKiBS offA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z12-20020a170906074c00b009886c420b37si7310212ejb.941.2023.07.09.23.30.55; Sun, 09 Jul 2023 23:31:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229654AbjGJG0U (ORCPT + 99 others); Mon, 10 Jul 2023 02:26:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230487AbjGJGZx (ORCPT ); Mon, 10 Jul 2023 02:25:53 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E4901E75; Sun, 9 Jul 2023 23:25:43 -0700 (PDT) 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 664591FB; Sun, 9 Jul 2023 23:26:25 -0700 (PDT) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.40.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B82823F67D; Sun, 9 Jul 2023 23:25:36 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org Cc: Anshuman Khandual , Ganapatrao Kulkarni , Steve Clevenger , Rob Herring , Frank Rowand , Russell King , Len Brown , Sudeep Holla , Lorenzo Pieralisi , Mathieu Poirier , Mike Leach , Leo Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V6 4/6] coresight: etm4x: Change etm4_platform_driver driver for MMIO devices Date: Mon, 10 Jul 2023 11:54:58 +0530 Message-Id: <20230710062500.45147-5-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230710062500.45147-1-anshuman.khandual@arm.com> References: <20230710062500.45147-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771014118548459580 X-GMAIL-MSGID: 1771014118548459580 Add support for handling MMIO based devices via platform driver. We need to make sure that : 1) The APB clock, if present is enabled at probe and via runtime_pm ops 2) Use the ETM4x architecture or CoreSight architecture registers to identify a device as CoreSight ETM4x, instead of relying a white list of "Peripheral IDs" The driver doesn't get to handle the devices yet, until we wire the ACPI changes to move the devices to be handled via platform driver than the etm4_amba driver. Cc: Mathieu Poirier Cc: Suzuki K Poulose Cc: Mike Leach Cc: Leo Yan Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Acked-by: Sudeep Holla Signed-off-by: Anshuman Khandual --- .../coresight/coresight-etm4x-core.c | 58 ++++++++++++++++++- drivers/hwtracing/coresight/coresight-etm4x.h | 4 ++ include/linux/coresight.h | 47 +++++++++++++++ 3 files changed, 107 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index e91e59ecec53..43f583987250 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -1073,11 +1074,21 @@ static bool etm4_init_sysreg_access(struct etmv4_drvdata *drvdata, return true; } +static bool is_devtype_cpu_trace(void __iomem *base) +{ + u32 devtype = readl(base + TRCDEVTYPE); + + return (devtype == CS_DEVTYPE_PE_TRACE); +} + static bool etm4_init_iomem_access(struct etmv4_drvdata *drvdata, struct csdev_access *csa) { u32 devarch = readl_relaxed(drvdata->base + TRCDEVARCH); + if (!is_coresight_device(drvdata->base) || !is_devtype_cpu_trace(drvdata->base)) + return false; + /* * All ETMs must implement TRCDEVARCH to indicate that * the component is an ETMv4. Even though TRCIDR1 also @@ -2135,6 +2146,7 @@ static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id) static int etm4_probe_platform_dev(struct platform_device *pdev) { + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct etmv4_drvdata *drvdata; int ret; @@ -2142,7 +2154,18 @@ static int etm4_probe_platform_dev(struct platform_device *pdev) if (!drvdata) return -ENOMEM; - drvdata->base = NULL; + drvdata->pclk = coresight_get_enable_apb_pclk(&pdev->dev); + if (IS_ERR(drvdata->pclk)) + return -ENODEV; + + if (res) { + drvdata->base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(drvdata->base)) { + clk_put(drvdata->pclk); + return PTR_ERR(drvdata->base); + } + } + dev_set_drvdata(&pdev->dev, drvdata); pm_runtime_get_noresume(&pdev->dev); pm_runtime_set_active(&pdev->dev); @@ -2188,7 +2211,7 @@ static struct amba_cs_uci_id uci_id_etm4[] = { /* ETMv4 UCI data */ .devarch = ETM_DEVARCH_ETMv4x_ARCH, .devarch_mask = ETM_DEVARCH_ID_MASK, - .devtype = 0x00000013, + .devtype = CS_DEVTYPE_PE_TRACE, } }; @@ -2244,6 +2267,10 @@ static int __exit etm4_remove_platform_dev(struct platform_device *pdev) if (drvdata) etm4_remove_dev(drvdata); pm_runtime_disable(&pdev->dev); + + if (drvdata->pclk) + clk_put(drvdata->pclk); + return 0; } @@ -2288,6 +2315,32 @@ static struct amba_driver etm4x_amba_driver = { .id_table = etm4_ids, }; +#ifdef CONFIG_PM +static int etm4_runtime_suspend(struct device *dev) +{ + struct etmv4_drvdata *drvdata = dev_get_drvdata(dev); + + if (drvdata->pclk && !IS_ERR(drvdata->pclk)) + clk_disable_unprepare(drvdata->pclk); + + return 0; +} + +static int etm4_runtime_resume(struct device *dev) +{ + struct etmv4_drvdata *drvdata = dev_get_drvdata(dev); + + if (drvdata->pclk && !IS_ERR(drvdata->pclk)) + clk_prepare_enable(drvdata->pclk); + + return 0; +} +#endif + +static const struct dev_pm_ops etm4_dev_pm_ops = { + SET_RUNTIME_PM_OPS(etm4_runtime_suspend, etm4_runtime_resume, NULL) +}; + static const struct of_device_id etm4_sysreg_match[] = { { .compatible = "arm,coresight-etm4x-sysreg" }, { .compatible = "arm,embedded-trace-extension" }, @@ -2301,6 +2354,7 @@ static struct platform_driver etm4_platform_driver = { .name = "coresight-etm4x", .of_match_table = etm4_sysreg_match, .suppress_bind_attrs = true, + .pm = &etm4_dev_pm_ops, }, }; diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h index 27c8a9901868..20e2e4cb7614 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -701,6 +701,8 @@ #define ETM_DEVARCH_ETE_ARCH \ (ETM_DEVARCH_ARCHITECT_ARM | ETM_DEVARCH_ARCHID_ETE | ETM_DEVARCH_PRESENT) +#define CS_DEVTYPE_PE_TRACE 0x00000013 + #define TRCSTATR_IDLE_BIT 0 #define TRCSTATR_PMSTABLE_BIT 1 #define ETM_DEFAULT_ADDR_COMP 0 @@ -944,6 +946,7 @@ struct etmv4_save_state { /** * struct etm4_drvdata - specifics associated to an ETM component + * @pclk APB clock if present, otherwise NULL * @base: Memory mapped base address for this component. * @csdev: Component vitals needed by the framework. * @spinlock: Only one at a time pls. @@ -1009,6 +1012,7 @@ struct etmv4_save_state { * @arch_features: Bitmap of arch features of etmv4 devices. */ struct etmv4_drvdata { + struct clk *pclk; void __iomem *base; struct coresight_device *csdev; spinlock_t spinlock; diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 255cfd283883..a269fffaf991 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -6,6 +6,8 @@ #ifndef _LINUX_CORESIGHT_H #define _LINUX_CORESIGHT_H +#include +#include #include #include #include @@ -386,6 +388,51 @@ static inline u32 csdev_access_relaxed_read32(struct csdev_access *csa, return csa->read(offset, true, false); } +#define CORESIGHT_CIDRn(i) (0xFF0 + ((i) * 4)) + +static inline u32 coresight_get_cid(void __iomem *base) +{ + u32 i, cid = 0; + + for (i = 0; i < 4; i++) + cid |= readl(base + CORESIGHT_CIDRn(i)) << (i * 8); + + return cid; +} + +static inline bool is_coresight_device(void __iomem *base) +{ + u32 cid = coresight_get_cid(base); + + return cid == CORESIGHT_CID; +} + +/* + * Attempt to find and enable "APB clock" for the given device + * + * Returns: + * + * clk - Clock is found and enabled + * NULL - clock is not found + * ERROR - Clock is found but failed to enable + */ +static inline struct clk *coresight_get_enable_apb_pclk(struct device *dev) +{ + struct clk *pclk; + int ret; + + pclk = clk_get(dev, "apb_pclk"); + if (IS_ERR(pclk)) + return NULL; + + ret = clk_prepare_enable(pclk); + if (ret) { + clk_put(pclk); + return ERR_PTR(ret); + } + return pclk; +} + #define CORESIGHT_PIDRn(i) (0xFE0 + ((i) * 4)) static inline u32 coresight_get_pid(struct csdev_access *csa) From patchwork Mon Jul 10 06:24:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 117637 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4821497vqx; Sun, 9 Jul 2023 23:35:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlGTus0GOrtGdU86frCR+urhXzhFf0xSE10SirgIcTzk5/oKJPuxm++7C8C9GTCrC1X8TlyJ X-Received: by 2002:a05:6a20:1584:b0:12c:763b:f099 with SMTP id h4-20020a056a20158400b0012c763bf099mr15739324pzj.58.1688970956463; Sun, 09 Jul 2023 23:35:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688970956; cv=none; d=google.com; s=arc-20160816; b=BMG6OZdSM398FQEDoM84PvBT4k3qkEjowzBzQDus5z0twPLGpEL7vEoFRCI+TPmjch IiKgyObwIMns1eDEsrmU/n6GxHH+m9vhbUgtjGt+VCulD01ES4SKP52mvrWFz4hioeQ+ 3LqrP04ViRiz4farPjqsjrHQ8cE+7HMyuJCs4cqqrsQeTVAppWljGCzwfPv072ZzZO+G 78bCZihjew5Lrx+bEN/q8qiut2YWyP4ZHE73eyYZrTvYNIYAWtZpEQW0W1QTY4PMvhNL 8rkz3+bLdr8gt1DAoOqUw/WqwJjUgJ4R/0ArJq1LU5sEtet9ZaAF05l5iZ5ALffh3Tt1 Jqug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=FlemL/9malbqvCT4dNO40NSxVMIysLNR28OSP2NVsmE=; fh=PY9h/cLRZw7UBGWy1EIb8bqZUZXcomX82OLAF53kzVA=; b=QmcgApchDt2K9eH6/BZQbD+Ny27EVm9HvveoK4e8rVk+505WFpD9WozjZqxOXqbFd4 lCz3LO42R7INfbj14/XeaAYxqfqzc2tjfq0T+bmojMjkm/Z8pR+d92EQDgYlqwZyagGk S4Q4G1c1uDejQIarHkM4+CMjJ1XOgas+kY5rMw/8kPWEqGX18NU4IvstClyq7ma70rMQ PQQT+54r1tjmFQCqqR3HuuaHBEwdp+N6OfCdeHwLgHNllSY1f3hqEEN0dkqd1ipJEtVg Fdo81NCOK/po9m9a53b77SY/2pOx+qkjTCKifmI2ycDbeo041TvFFPhQDcOnH889MIkH g6yA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i6-20020a170902c94600b001b89b5a460esi9381458pla.405.2023.07.09.23.35.43; Sun, 09 Jul 2023 23:35:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231164AbjGJG00 (ORCPT + 99 others); Mon, 10 Jul 2023 02:26:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231299AbjGJGZ6 (ORCPT ); Mon, 10 Jul 2023 02:25:58 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 51C65E78; Sun, 9 Jul 2023 23:25:50 -0700 (PDT) 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 10BD9D75; Sun, 9 Jul 2023 23:26:32 -0700 (PDT) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.40.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E14BB3F67D; Sun, 9 Jul 2023 23:25:43 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org Cc: Anshuman Khandual , Ganapatrao Kulkarni , Steve Clevenger , Rob Herring , Frank Rowand , Russell King , Len Brown , Sudeep Holla , Lorenzo Pieralisi , Mathieu Poirier , Mike Leach , Leo Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V6 5/6] coresight: platform: acpi: Ignore the absence of graph Date: Mon, 10 Jul 2023 11:54:59 +0530 Message-Id: <20230710062500.45147-6-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230710062500.45147-1-anshuman.khandual@arm.com> References: <20230710062500.45147-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771014409917328017 X-GMAIL-MSGID: 1771014409917328017 From: Suzuki K Poulose Some components may not have graph connections for describing the trace path. e.g., ETE, where it could directly use the per CPU TRBE. Ignore the absence of graph connections Signed-off-by: Suzuki K Poulose Signed-off-by: Anshuman Khandual --- drivers/hwtracing/coresight/coresight-platform.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 3e2e135cb8f6..c8940314cceb 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -669,8 +669,12 @@ static int acpi_coresight_parse_graph(struct device *dev, struct coresight_connection *new_conn; graph = acpi_get_coresight_graph(adev); + /* + * There are no graph connections, which is fine for some components. + * e.g., ETE + */ if (!graph) - return -ENOENT; + return 0; nlinks = graph->package.elements[2].integer.value; if (!nlinks) From patchwork Mon Jul 10 06:25:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 117639 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4822225vqx; Sun, 9 Jul 2023 23:37:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlHGSRt8BSbZTsP/91b/fRke6Y2QAn6YFte1fOhLgiBhSgp8plYhChXWklyG/rjO1D0W1NQV X-Received: by 2002:a05:6402:35c4:b0:51e:3d42:33ba with SMTP id z4-20020a05640235c400b0051e3d4233bamr11791707edc.9.1688971054131; Sun, 09 Jul 2023 23:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688971054; cv=none; d=google.com; s=arc-20160816; b=MuffUAZCOUeNgRaSM+gZBG0htF1Xn3Jqr3zL232EwDGsy+p/LreURw/JLKrdcU5HOE 6fji8FJh/mDYpo3A03WA6jMPfa53rp26+QB1aVvgq1tFGl+vl6CK0n9DTQcKlUk7yD25 BARM9pUHjG26TyvLbEmXysZRGQshZ47Iemb7pcwfwnelVWqQgn5JwRuSAsieI0N/zJUu vWcFLWKN7oWuV9cifM1i+Zge/krauK8JGiK1HPCBQUSTGpp/vlAhM/SdpranVa4WN0j+ 20Z/pOYvuOOBmExbh59FD/wXP/4mv1brsYBe38etQvQBY3LwXWETIqs9mjH9yySFVS11 6r1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=B+oHyyLE0fT2E8L8b4emej/u+jtpYtahhXuZkAv1BFI=; fh=PY9h/cLRZw7UBGWy1EIb8bqZUZXcomX82OLAF53kzVA=; b=PoEwhZB+F3NuQSRWskHCwN8IUZat0Trp6N8z37O0lfjXTCySf8vhI9a4buoOGCRd5r NXS7pZBv+bDWICw4P1T/Y4drNAb2vevvPGqRv5TsmvPl0zTIaxC7tpMD5sEuHXPQVJTq b6Q1kxKwBkQ/r0FqZnj/q/sHJyjR+oIEBlkRt2wIrQcUwaHT9u4hda+tkTJfphuvxo1Q HiZiV9G8b4wE9SwYneQlqoqXigVDuvrkEBl6vHSy4kH9kmMm/vbNtCB7ssmQ5JpiCvJp L+Q6nZVmMKd9+NWxsv1UQ0dkKdzqHWp5eo4ynbM7NvU7KvlRV8aowhJQMriALd/vHjyt sq+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e25-20020a056402089900b0051a324db9bcsi5411589edy.304.2023.07.09.23.37.10; Sun, 09 Jul 2023 23:37:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231410AbjGJG0y (ORCPT + 99 others); Mon, 10 Jul 2023 02:26:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230496AbjGJG0D (ORCPT ); Mon, 10 Jul 2023 02:26:03 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D5BA010DA; Sun, 9 Jul 2023 23:25:56 -0700 (PDT) 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 A5C5D1FB; Sun, 9 Jul 2023 23:26:38 -0700 (PDT) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.40.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6DFD33F67D; Sun, 9 Jul 2023 23:25:50 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org Cc: Anshuman Khandual , Ganapatrao Kulkarni , Steve Clevenger , Rob Herring , Frank Rowand , Russell King , Len Brown , Sudeep Holla , Lorenzo Pieralisi , Mathieu Poirier , Mike Leach , Leo Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V6 6/6] coresight: etm4x: Add ACPI support in platform driver Date: Mon, 10 Jul 2023 11:55:00 +0530 Message-Id: <20230710062500.45147-7-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230710062500.45147-1-anshuman.khandual@arm.com> References: <20230710062500.45147-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771014512081328990 X-GMAIL-MSGID: 1771014512081328990 From: Suzuki K Poulose Drop ETM4X ACPI ID from the AMBA ACPI device list, and instead just move it inside the new ACPI devices list detected and used via platform driver. Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Mathieu Poirier Cc: Suzuki K Poulose Cc: Mike Leach Cc: Leo Yan Cc: Sudeep Holla Cc: Lorenzo Pieralisi Cc: linux-acpi@vger.kernel.org Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Sudeep Holla (for ACPI specific changes) Signed-off-by: Suzuki K Poulose Signed-off-by: Anshuman Khandual Tested-by: Tanmay Jagdale --- drivers/acpi/acpi_amba.c | 1 - drivers/hwtracing/coresight/coresight-etm4x-core.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_amba.c b/drivers/acpi/acpi_amba.c index f5b443ab01c2..099966cbac5a 100644 --- a/drivers/acpi/acpi_amba.c +++ b/drivers/acpi/acpi_amba.c @@ -22,7 +22,6 @@ static const struct acpi_device_id amba_id_list[] = { {"ARMH0061", 0}, /* PL061 GPIO Device */ {"ARMH0330", 0}, /* ARM DMA Controller DMA-330 */ - {"ARMHC500", 0}, /* ARM CoreSight ETM4x */ {"ARMHC501", 0}, /* ARM CoreSight ETR */ {"ARMHC502", 0}, /* ARM CoreSight STM */ {"ARMHC503", 0}, /* ARM CoreSight Debug */ diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 43f583987250..703b6fcbb6a5 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -3,6 +3,7 @@ * Copyright (c) 2014, The Linux Foundation. All rights reserved. */ +#include #include #include #include @@ -2347,12 +2348,21 @@ static const struct of_device_id etm4_sysreg_match[] = { {} }; +#ifdef CONFIG_ACPI +static const struct acpi_device_id etm4x_acpi_ids[] = { + {"ARMHC500", 0}, /* ARM CoreSight ETM4x */ + {} +}; +MODULE_DEVICE_TABLE(acpi, etm4x_acpi_ids); +#endif + 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, + .acpi_match_table = ACPI_PTR(etm4x_acpi_ids), .suppress_bind_attrs = true, .pm = &etm4_dev_pm_ops, },