From patchwork Mon May 29 06:25:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 100108 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1319351vqr; Sun, 28 May 2023 23:49:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5mVGQnMDGpHqwUdWxAnZ66UyL2D35j+jdXODF/Z4M7vVLhjoZ+JMzeKH7Rgc0MvE3c78tz X-Received: by 2002:a05:6a20:144f:b0:106:5dff:5db5 with SMTP id a15-20020a056a20144f00b001065dff5db5mr7605937pzi.1.1685342958355; Sun, 28 May 2023 23:49:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685342958; cv=none; d=google.com; s=arc-20160816; b=MY37dqHUweLhF6Yzg9Oid+Ja0NIl4K8LgP4onjMPdX8N89J7PuiqwJL1xaVAuRpZ82 FJTo87qfIe0v1eGKnLGi7WayIC4M6CFzsw9/EXl3FnuLyngZj6g/TfcqYO/5c8x74BzK RBoafv8ZIG2JnXulycrH1MZ7VfvRMptElrDxMntDzvlIAW6XaVlgwYVqyBlGdjQMmy6k GpumiU7qtKxvjUdw8NLixMIXwhqvD4+T9aeFHdoh5oPnSAHBoeXgPeL/i41G99VJgbdq +aQ1fXu+OdY5VV8F91eDWro416Rmntat6UDKnZ/2cU+YkumhCU1BZsHQNG6VCdSwaQJi 03ZQ== 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=m+e1imscgxxfdaZ4eyi90ayYqSxq81Un1Qj+za5xbdU=; b=HAgQ3+RzQZfyBVY+/dstszjJk7e5UfWl8ozIHHr6sUMz4eM7lt5x3+lgHy0o9Szz4c LyL924mLFbwnBPKhBT75++8XyL14gcZw3FF122mRwg618kV72IgE5PXZH35DAQjhvdMS U3elMBr7zJgch2z59BlS6h9qyUHlM5BBbE+fVq+DnRhV1T/QhupXN7R40APHakvXe5Qb 0T/TrJXBHRg0DZWwRYy5xgmBAMJwHm65Xkbrgh8gvwCzgtGivcURU0mzdNwyfCvMvy/h r98jgAnhWmErHfACIwWloHVni0k2rEiESJjEzfVP0cTmIVK9vv36wNOdURjqOdWSR+tF 4ESg== 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 pi5-20020a17090b1e4500b002535e5e607asi9935723pjb.150.2023.05.28.23.49.05; Sun, 28 May 2023 23:49: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 S231596AbjE2G1H (ORCPT + 99 others); Mon, 29 May 2023 02:27:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231638AbjE2G05 (ORCPT ); Mon, 29 May 2023 02:26:57 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0318DC4; Sun, 28 May 2023 23:26: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 7CAC5AB6; Sun, 28 May 2023 23:26:18 -0700 (PDT) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7147E3F6C4; Sun, 28 May 2023 23:25:27 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com Cc: scclevenger@os.amperecomputing.com, Anshuman Khandual , Ganapatrao Kulkarni , Rob Herring , Frank Rowand , Russell King , Greg Kroah-Hartman , "Rafael J. Wysocki" , 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 V5 1/6] coresight: etm4x: Allocate and device assign 'struct etmv4_drvdata' earlier Date: Mon, 29 May 2023 11:55:06 +0530 Message-Id: <20230529062511.52016-2-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230529062511.52016-1-anshuman.khandual@arm.com> References: <20230529062511.52016-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767210177820105952?= X-GMAIL-MSGID: =?utf-8?q?1767210177820105952?= 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 4c15fae534f3..7e96293c638f 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 May 29 06:25:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 100112 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1319959vqr; Sun, 28 May 2023 23:51:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4CzHHFTdGk1rGIfINfh/QN9VHoeLYLRZRNXKiWCzFuevAPPx9SLx1oBuJ033Ot6J3qRMDD X-Received: by 2002:a05:6a20:72a8:b0:10c:3cf3:ef7e with SMTP id o40-20020a056a2072a800b0010c3cf3ef7emr8927519pzk.42.1685343061240; Sun, 28 May 2023 23:51:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685343061; cv=none; d=google.com; s=arc-20160816; b=DCptp+yDxjePULwJooGIuQRTI48DxcL7b9IDnBoujHHxJxCaiBMgqH16uIn1l4pQge eVwedJQ0AniJxMxI+Is/qcajgi0rRiDToQUhiriOHPwV9/fUSZZfBQxAGSHfc7lsQnz8 bRxr+DRufV61tIZVaChDy57keGP6WwfaURnLwcM8lM5uEdq9c8zqk9AIqu18y1ELyHC/ FpVGvgQNEUGU52tYCtYPXLkRyqekQY6wk2NDPlvS1shK7RuwTKs+t4Xv6BgeTCGkOBXL 4SgzX9Mikz3YYQAxC10qErAWvs+S4vuEDLFWiXAEi1MuvISUcLygGiFvQnUF6DmQoBLl v4cw== 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=I6wrXTLtk+T+M0+0vot1sHidxwRMTZ+UBL8LgnHHU1Y=; b=vMT4HZeLyDIk6W1cD+raBmwztmSPuM+w0HV75FpvrRUc8VycsdABDHi8sAUknHsLT1 QE+ZCjsrYToChI5Tg/dILRD4/+55z+1daRrj1L5kYSpeK/yjno84pVmuR+vhoM4faFr7 GFiz1rrnq+zBigTpZSv2vXkzopfvRQZKRl0LkPQ6hAb70WGmNmh9klkC4FtEWneGuaOr bpbqoOrQ++qmH8mFBkyEb6YqElLZgL7KRaLI6yWBT9zmpJrXOFR/mInezqwjaKORO6WV 2O2basrRN0XYdzni8a+VvrCeycBtOPIvPSS0kDSOpy9f++9T7+g/q7LNwH96G1qZ9fds QWEg== 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 q38-20020a635c26000000b005348885119asi8540127pgb.523.2023.05.28.23.50.43; Sun, 28 May 2023 23:51:01 -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 S231667AbjE2G1X (ORCPT + 99 others); Mon, 29 May 2023 02:27:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231556AbjE2G1O (ORCPT ); Mon, 29 May 2023 02:27:14 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 383B7DC; Sun, 28 May 2023 23:26:39 -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 BE93CC14; Sun, 28 May 2023 23:26:25 -0700 (PDT) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D0D0B3F6C4; Sun, 28 May 2023 23:25:33 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com Cc: scclevenger@os.amperecomputing.com, Anshuman Khandual , Ganapatrao Kulkarni , Rob Herring , Frank Rowand , Russell King , Greg Kroah-Hartman , "Rafael J. Wysocki" , 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 V5 2/6] coresight: etm4x: Drop iomem 'base' argument from etm4_probe() Date: Mon, 29 May 2023 11:55:07 +0530 Message-Id: <20230529062511.52016-3-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230529062511.52016-1-anshuman.khandual@arm.com> References: <20230529062511.52016-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767210285545434879?= X-GMAIL-MSGID: =?utf-8?q?1767210285545434879?= '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 7e96293c638f..748d2ef53cb0 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 May 29 06:25:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 100104 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1318684vqr; Sun, 28 May 2023 23:47:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7otL+3r+ONRt+wYIKy/9PlpkcycMNM3mYXlvZ+grKUY4UQ+4h1pTeIeYRNUdyhxXCq2XQj X-Received: by 2002:a17:90b:3e86:b0:24b:c580:1ab8 with SMTP id rj6-20020a17090b3e8600b0024bc5801ab8mr9116230pjb.40.1685342833751; Sun, 28 May 2023 23:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685342833; cv=none; d=google.com; s=arc-20160816; b=Iv1jIiqn0HlriXZ6gARjW5jRFCZ+7nC+rWcD4dkbSTLAtemP5K/3+qbbkMeUvXlqWw OUooAB1WqCL53GW1CdzhvF3LiblS63luvQdu8v6XmDdMT/N+eSnLMTBO0siwXvatfa6Z ZADDo+2KgS1tmvOzeoYM2dwvWhPF1udFI//AqT54nHDLSmr6i4cIZ6SSoxcOY9Doy5vb kWApEBpwOQ3rhdqyJ8y8UQjhS1l24asKIjDaTDvfk99iKzTamBhIvJmJ7B3bVhp1I8HU fMMebfwIYyHdOiiuVYHstQqkx/ff80at/VrJqtVJ28CX6gEBOQSj3NKvLbtwNWHEhh+Z GhJg== 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=NIbH+XPEvVZoLSk99QsLejsw+pxawcOixDgFTrNfwBE=; b=D7CaggvBCQhcStZGBwaVIx7x4w39hNyzthEQQpSRWmBQORhQJC2XEFyikbBJLvr+LD 9tEm2kngti1e1ZnlD3GJAqCzvFTdTOrHVyjwM6lRqaFPbHNwu7JmLTMYMrkn5CXZn3a0 EA/cOgfVFIYtTESqXPeMHE/fM+gkuaOVvpHcn1kgHEKwQ+zjbkjE/alBptZW4OX6LWHx wB6ZmrvqwMA/jvsfR4Oijvt1pNonTT8HKjEJLbCR2lIh6W4WiJlHIgS7qI9OLjzHGjG+ IDyjzXqt2FzXzrjAyxDAtyuL5I6XpMUdSTGle2FvPp4RPAabfPpdamfyM9kNQt/h91Fb 3U7A== 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 mm14-20020a17090b358e00b0023418ec51f8si11290775pjb.136.2023.05.28.23.47.01; Sun, 28 May 2023 23:47:13 -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 S231664AbjE2G1S (ORCPT + 99 others); Mon, 29 May 2023 02:27:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231658AbjE2G1O (ORCPT ); Mon, 29 May 2023 02:27:14 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 56FAFC2; Sun, 28 May 2023 23:26:38 -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 84BF814BF; Sun, 28 May 2023 23:26:32 -0700 (PDT) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1EEB43F6C4; Sun, 28 May 2023 23:25:40 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com Cc: scclevenger@os.amperecomputing.com, Anshuman Khandual , Ganapatrao Kulkarni , Rob Herring , Frank Rowand , Russell King , Greg Kroah-Hartman , "Rafael J. Wysocki" , 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 V5 3/6] coresight: etm4x: Drop pid argument from etm4_probe() Date: Mon, 29 May 2023 11:55:08 +0530 Message-Id: <20230529062511.52016-4-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230529062511.52016-1-anshuman.khandual@arm.com> References: <20230529062511.52016-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767210047394389369?= X-GMAIL-MSGID: =?utf-8?q?1767210047394389369?= 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 748d2ef53cb0..57a7181017bd 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 f19a47b9bb5a..f85b041ea475 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -370,6 +370,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 May 29 06:25:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 100098 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1317500vqr; Sun, 28 May 2023 23:44:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4N/MV2LVdK9xu5PiQUIP4h3NMdtzhQju4nmAGX7tdya8O1az2HQMxWp3kqWEEEaPKhXgV2 X-Received: by 2002:a05:6a20:12d2:b0:10b:97c8:2e12 with SMTP id v18-20020a056a2012d200b0010b97c82e12mr8367521pzg.60.1685342645558; Sun, 28 May 2023 23:44:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685342645; cv=none; d=google.com; s=arc-20160816; b=qHf/PuSjL6M7ociEZ5A+CpoTiAgG5QkmOESKaZmB6P3sVZKpyOwvXFd3Sht1ig1iBR aXw0NZMHp/pU83fa9EhFYgRmJHXk7qCRLzDjBabvJkwjZxaAJk9goDJGfF5Q+fm4CkfK MpEAzO3hdmE3y4jmfmyPicuYpFaAsWRlfWQjg1I4lVpdtwUXhaZ63sf5xI2Mq2JLEH34 9G6+NCLCxCS4F4XbJg3c0ZUt0ZjbsJ4nCRK4sugvHKUWAafDvTrmN4sIxARhJnGPq0ue AlDgYX1DPirIn8zs6CkZxhZqhwvkYyolMT4+tZmqXONfTpuSGyXyzwXsJwNMygb6pdkD Qe4A== 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=8PG6E9QSDLTFtWUTtVTrsA1c/ly8Rk04lAsozHDjX0I=; b=hd+Edga2bsuMTMPbDCRuKziG3OIFZAinYgcWjUAw/XbEWK2YP37/t7fojBvO59bmhq lEehFuqZ6iRjAQeW3lr8I3IA043GhYw/+nVrsSDOZ3iYtM3vwI4Yzk3h11LAchZskViJ 8s2aLPJi5CIxqemKlpHBuD1gBhQeTHByYmjHbHrUT7QUoVSOOlhKe5cPkmCHYWPkv5qX +wNaIGEiYhCEeHiIkFBDe4bb24/bi44dBVPSL67EaFfjrwtQH/TNViKq1KrtBvMHSTd9 7DwfPoeLzkM04ZqzAwPZ1ZrUPEa7K5x0LmObvsGWwnsgoFjYT5oJS743eD6oj6kfloru Yv7Q== 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 i128-20020a639d86000000b005346c49e06esi4415420pgd.843.2023.05.28.23.43.49; Sun, 28 May 2023 23:44:05 -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 S231686AbjE2G10 (ORCPT + 99 others); Mon, 29 May 2023 02:27:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231656AbjE2G1O (ORCPT ); Mon, 29 May 2023 02:27:14 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5399EC7; Sun, 28 May 2023 23:26:37 -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 ACEBF1516; Sun, 28 May 2023 23:26:39 -0700 (PDT) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D83EE3F6C4; Sun, 28 May 2023 23:25:47 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com Cc: scclevenger@os.amperecomputing.com, Anshuman Khandual , Ganapatrao Kulkarni , Rob Herring , Frank Rowand , Russell King , Greg Kroah-Hartman , "Rafael J. Wysocki" , 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 V5 4/6] coresight: etm4x: Change etm4_platform_driver driver for MMIO devices Date: Mon, 29 May 2023 11:55:09 +0530 Message-Id: <20230529062511.52016-5-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230529062511.52016-1-anshuman.khandual@arm.com> References: <20230529062511.52016-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767209849627568757?= X-GMAIL-MSGID: =?utf-8?q?1767209849627568757?= 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 | 57 ++++++++++++++++++- drivers/hwtracing/coresight/coresight-etm4x.h | 4 ++ include/linux/coresight.h | 47 +++++++++++++++ 3 files changed, 106 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 57a7181017bd..e10f6676dd9b 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, } }; @@ -2247,6 +2270,9 @@ static int __exit etm4_remove_platform_dev(struct platform_device *pdev) if (drvdata) ret = etm4_remove_dev(drvdata); pm_runtime_disable(&pdev->dev); + + if (drvdata->pclk) + clk_put(drvdata->pclk); return ret; } @@ -2286,6 +2312,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" }, @@ -2299,6 +2351,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 f85b041ea475..be60a8b84c49 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 @@ -370,6 +372,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 May 29 06:25:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 100096 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1313462vqr; Sun, 28 May 2023 23:33:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7RNeH71Wxpl6mbrZx9X8L7zkGPQQmkmaEXFm8a2XmWgmRTlarxmu7lzz5gQEf2UDBIuGnO X-Received: by 2002:a17:90a:aa0b:b0:24b:a5b6:e866 with SMTP id k11-20020a17090aaa0b00b0024ba5b6e866mr8995999pjq.24.1685341993517; Sun, 28 May 2023 23:33:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685341993; cv=none; d=google.com; s=arc-20160816; b=eCJLir/k4cWkIOwlPuuc8Nz6ZZiWorus2FjjMqvOmVQYBZrt0apOmAZYofOi57QhLy aYInDUyojfXStu64UE9zu8etSZnQ0kDRQYfRNvu2cBpX6YZ3Cnh4dfgtxwYdUYDbYYSO zSr6pUsmLBfRT8gkh7hQgb/Pzp9DduTxJ76yJUK9XVhgJ8nGFF9GYG07hzgRTtpRIz2O pOthpAFEuY5KuWaIZYXl2FMhlNiZOvW7lsiLOC0C+3QeC3JCfGCSIfBjFbGJUsvwO5yF P6v5ppIXq4ZBtI4joj1vTRBLAIyU0SCWxOO0jq9ALiXW5SY6E5pEPJfrd7c57DVTv775 n9Eg== 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=SS8eFXdUUvA8OCPxf5Syhx2f4mz+ypgKZ9P0aUNsBxE=; b=PPGdtCEsxte4+miHiKbCLQKzKgK5qUWGk53USkPp51QbT10JYX4RNcH30mLw1LfOlB RLRqXRha6T0SFHmyVdHDGikbdcJBPcNEV9j4jfuYJ5C4xVI/j8eS9FKwsxKou0xhIq+L DrFHR4JXsZeHy13LgaO8iwHPcIVzpsOM1xUyJlsoFY3ZqJ/0MMCaaKehDOJ+YzYhlTqT 0Ip11gP/JqInj8pSFYSQ1e7/FWzqavafBXMOu3ZYKEi7oxwag1xdj3pT8YFk/bRt+QLp U2PORmQ23dK/l5VT7tUwojAcyNNGXByu0yF6FzFuz2u6U/9k03bQBt9p+Wk5gZ+5JgyC OeMw== 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 bt1-20020a17090af00100b00250d10c6fe7si435545pjb.67.2023.05.28.23.32.58; Sun, 28 May 2023 23:33:13 -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 S231741AbjE2G2Y (ORCPT + 99 others); Mon, 29 May 2023 02:28:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231723AbjE2G15 (ORCPT ); Mon, 29 May 2023 02:27:57 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0918F138; Sun, 28 May 2023 23:27:26 -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 290EA153B; Sun, 28 May 2023 23:26:46 -0700 (PDT) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F1D9A3F6C4; Sun, 28 May 2023 23:25:54 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com Cc: scclevenger@os.amperecomputing.com, Anshuman Khandual , Ganapatrao Kulkarni , Rob Herring , Frank Rowand , Russell King , Greg Kroah-Hartman , "Rafael J. Wysocki" , 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 V5 5/6] coresight: platform: acpi: Ignore the absence of graph Date: Mon, 29 May 2023 11:55:10 +0530 Message-Id: <20230529062511.52016-6-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230529062511.52016-1-anshuman.khandual@arm.com> References: <20230529062511.52016-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767209166299770341?= X-GMAIL-MSGID: =?utf-8?q?1767209166299770341?= 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 475899714104..c4b4fbde8550 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -692,8 +692,12 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev, pdata->nr_inport = pdata->nr_outport = 0; 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 May 29 06:25:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 100102 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1318419vqr; Sun, 28 May 2023 23:46:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6wANWSWxqTo77j5Zr8PK3UZxOEN3+xqFgMeB/BsKQ0qe7bVucdmsTmshTRe5TgdmYpqIKJ X-Received: by 2002:a05:6a00:9a0:b0:64f:cd1a:e41 with SMTP id u32-20020a056a0009a000b0064fcd1a0e41mr5862437pfg.1.1685342789758; Sun, 28 May 2023 23:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685342789; cv=none; d=google.com; s=arc-20160816; b=whQZmmwZ5HYVIcO6p5yr5gJr+MFmL9GYRxKMVhwdMIPCZn24CG+BfWGyI1fHFwZTTe 9tjaWp0T0RIBMk2odw5qVkQeYsN+EwqVAIJOQQ9e3z1dowMvnb90FZuQjZIr9Z61d4VF nJAYqVkmvtV89WErOiBNZItXUZYyiiIMdtGS5fcsSvP7hAX4+z+g9gcMtVaPbvsK9kXV uc6PxVrrUnfLCHlUEmowRRp1CX7MJcG+8HWttrnOVgTM5Vre5FzbwY2FiXX8N0jE0CvD yAjuSCWD2eqocFKcp27pqNS5LYrP1xt32+AMVk5Bug495EhjeZrMWkw71AtTVNSn+SAS M3kg== 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=pbiWy0SylHsshtpAxJmkjyVos4xQ1pb9tgI1faHLrmI=; b=XWqRjaJVZ0DLy6zWDXc47rYsbHQSz9+7i0uUIXl4YnxQcEBvIGB+7CWmzhOJqcKdTK LeYsmkR2RzuhDbqH/W5Q2GFwWHmNhh9clbVb/UuYlo8kWaLTiFoe2UBWlpbXvRzdxQCm 6l4kIfgZrccrmQ+oOKMzF7LQQiM0EiY8Q8fP5KUuha3SvwLprFGdzN/Lw4aKSv6V6lxy 7irMQI+HyGQa+v26pr7HxKPoeePdnihsMrhS8G1wD4rq50hgnovFkdfo2lxu/z8ViIJ7 DSepFqKgG8lU8N77+cm4/QBioMnNWNP7gZnfB22/FfDEZ8hK0rZLuknXSRBlPa29dU+U ZGpA== 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 q38-20020a635c26000000b005348885119asi8540127pgb.523.2023.05.28.23.45.54; Sun, 28 May 2023 23:46:29 -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 S231727AbjE2G2V (ORCPT + 99 others); Mon, 29 May 2023 02:28:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231700AbjE2G15 (ORCPT ); Mon, 29 May 2023 02:27:57 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CFB32136; Sun, 28 May 2023 23:27:25 -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 514DE1576; Sun, 28 May 2023 23:26:53 -0700 (PDT) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6269F3F6C4; Sun, 28 May 2023 23:26:01 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com Cc: scclevenger@os.amperecomputing.com, Anshuman Khandual , Ganapatrao Kulkarni , Rob Herring , Frank Rowand , Russell King , Greg Kroah-Hartman , "Rafael J. Wysocki" , 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 V5 6/6] coresight: etm4x: Add ACPI support in platform driver Date: Mon, 29 May 2023 11:55:11 +0530 Message-Id: <20230529062511.52016-7-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230529062511.52016-1-anshuman.khandual@arm.com> References: <20230529062511.52016-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767210001071094443?= X-GMAIL-MSGID: =?utf-8?q?1767210001071094443?= 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 --- 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 e10f6676dd9b..fd6f9dff5881 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 @@ -2344,12 +2345,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, },