From patchwork Mon Mar 20 18:24:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 665468 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3617C76195 for ; Mon, 20 Mar 2023 18:34:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231463AbjCTSeO (ORCPT ); Mon, 20 Mar 2023 14:34:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231206AbjCTSd4 (ORCPT ); Mon, 20 Mar 2023 14:33:56 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2065.outbound.protection.outlook.com [40.107.244.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3CE86EA1; Mon, 20 Mar 2023 11:26:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oXYgdsLDW3tSMC+eSHVftyatopk/i6CXHA/blOfH7PLYex8AiCzvN/Np7iwZ/TLfnE7p0xXKSkLOdSYcBlTtkHcnxv3rVj0Ke2tvTA33MvvSCE9ncRK3gDq8XrXK+L5JpEpoMbga5dVrfE++2MZZiFC+nhQ4DlscwajYXQW+wAViwc90D/Frvxmee3z9MsImfKaIyqbt0hh1zrwHeeTNPkS9rCZHM4rcLQt58bc7fqV41u3nd3futuKDYnM9oQOSun0NoOkCEtYuOHdE6I4dVMj/gMz0ZxeJKx0mOLhUYKjqWKWpV+kUBF8V8OjEQSoCh+boYDYEHj4b7c+cbZRC4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZY7hBPAPyidQC30WF7UQ3BbHzOEMRgFy/GmbkaFA/xQ=; b=K0dvzQTrCEO4TE1y7IQ3+S41ZQDR+7YBuC6Dpzal3THrZEsFR+ss8CGxzp9kJHi3WhdXFDdCeC/90+Xl1nwM6sh9kym8F7UKFrv3hlDbJu6dtGCWM9edrnkGaRJGaKubW6QD4pHqB/NNzcNcbGGFe8yGfC0UQ/uMVXr0xDWDqEp+JNWEyyAVBo3Z2VDSpYbSIvRtSjuI7pKbdVuc4clLQh4rAzGL01+KwyiouKW8AQXyHxeofMQLFQE64V/b0OGkubLOp3VWfAoegixkBEr/rO/GqGSDfsfybBqNXoA0CW4T6L9bU/0p4SIS2kyWAPxcy8gYf3Pw32k190mnxJn8AQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=google.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZY7hBPAPyidQC30WF7UQ3BbHzOEMRgFy/GmbkaFA/xQ=; b=PvMvX127qXl5WYitlBmsy5plMsG1gZpwNzAhYwR8x7HsGxLzd75udihDBtdinFFzZRNxs/ohWuJfljE4nyXHGXpVuKk8qm5f4iRYTzRyG1uR0lSgQe/PlfFjkwoeoOgSER21NnzRYN2Lg+5uLuGVIkXR4Myf+ZmL1A3fgPbGX+yh89YtbDU8ZjnV4J+uTlb9DwCdhnMlJLsOpPjHV2iqX1siv+bHOUz0kHk8XmDg81ogK18np+MxJ1blsxLAEuvlEFVEwpHqduYMHJPfVueh0DnI+qZv4ZzX0OAlfyB34gua8soXLdy2A1SoFxwAYdonEPcJyhA6pBxoLXEn1tYj4g== Received: from MW4P223CA0021.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::26) by DS0PR12MB7725.namprd12.prod.outlook.com (2603:10b6:8:136::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Mon, 20 Mar 2023 18:25:24 +0000 Received: from CO1NAM11FT112.eop-nam11.prod.protection.outlook.com (2603:10b6:303:80:cafe::1e) by MW4P223CA0021.outlook.office365.com (2603:10b6:303:80::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Mon, 20 Mar 2023 18:25:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CO1NAM11FT112.mail.protection.outlook.com (10.13.174.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.16 via Frontend Transport; Mon, 20 Mar 2023 18:25:23 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 20 Mar 2023 11:25:09 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 20 Mar 2023 11:25:09 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.5 via Frontend Transport; Mon, 20 Mar 2023 11:25:04 -0700 From: Sumit Gupta To: , , , , , , , CC: , , , , , , , , , , , , , Subject: [Patch v3 01/11] firmware: tegra: add function to get BPMP data Date: Mon, 20 Mar 2023 23:54:31 +0530 Message-ID: <20230320182441.11904-2-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230320182441.11904-1-sumitg@nvidia.com> References: <20230320182441.11904-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT112:EE_|DS0PR12MB7725:EE_ X-MS-Office365-Filtering-Correlation-Id: 135b7234-a11e-47c9-410f-08db2970787e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l1Uq0tg3Gm/vLlgfzyv87t8jmJL6NBmGVBpS9K3jjyBdfUmZNIvLQBWxljqyI7/Y2NEuDwdHRLhBDVK7Q+k9KSsuBL2WimhLXv2RSE4jN0/MOG+or/lNyYa4EKa1eX+uc2u4m5PdcjtVISAnn/e251E8QbyKFivGFMyJHeu/MiTGxPUn5SuTF12LYWfAo8ebUu8CXOmS9IwO7ZNbilA+RwLMSa8ZBWlk87TxFNccMgxRQtczhI3hwU9lwOp/+Ya6l4CNbE2Mk5gPsJDIOzKysnL+F3xvECc43BPGFUYdWGzVq00k858Ra3GkygOT5KSSVYbWUw6pXqKqOsGNYmrggY5Tdr0fuztKF04Q3GSFzm0XVYfbyH7w54sOQUmJXgJM6OUcAnBzgBTkwcW1ilAst7gGDGdx4qu7oM+ZXj/jx8K/EYXkpsvcAFBS2+aajPd5cnzeq9bz6hflxZubzJDOfXOp03y5qofO0D5R2BsNdGlvlcOhQSegHtHsSA44UzDzqiGOKwhUK3xKcBv+OSCorhsN8aVrW29ehq/nCRI8Ri3Y9gZYMid4Vt6aaucDEL2hIg2OBbyEi3uCXuiR07kaU1dM+IuQi3gY+z2CU1+glU96LZqXc5mmPBpjkw9iT/LJ3JrUgoc2UKnVTQV8vViSWPHJJZOEHJLMf6i1O7/xLxqiZCsKWjDPbgsJgLkqBlUwV/chzOBE1GbfuGYuWcHiMWY/qywzNxJ1aC/7gGk3zXaAVr14eXDJmiwTSv/e/6Fd X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(346002)(396003)(376002)(39860400002)(136003)(451199018)(46966006)(40470700004)(36840700001)(110136005)(2616005)(426003)(47076005)(83380400001)(82310400005)(316002)(7696005)(54906003)(107886003)(7416002)(6666004)(5660300002)(478600001)(1076003)(186003)(26005)(36860700001)(356005)(336012)(40460700003)(86362001)(7636003)(70206006)(70586007)(8936002)(2906002)(82740400003)(40480700001)(4326008)(36756003)(41300700001)(8676002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2023 18:25:23.6735 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 135b7234-a11e-47c9-410f-08db2970787e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT112.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7725 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add new function 'of_tegra_bpmp_get()' which can be used by other drivers like MC to get BPMP data without adding any property in respective drivers DT node. Signed-off-by: Sumit Gupta --- drivers/firmware/tegra/bpmp.c | 38 +++++++++++++++++++++++++++++++++++ include/soc/tegra/bpmp.h | 5 +++++ 2 files changed, 43 insertions(+) diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c index 042c2043929d..d825067a223a 100644 --- a/drivers/firmware/tegra/bpmp.c +++ b/drivers/firmware/tegra/bpmp.c @@ -39,6 +39,44 @@ channel_to_ops(struct tegra_bpmp_channel *channel) return bpmp->soc->ops; } +struct tegra_bpmp *of_tegra_bpmp_get(void) +{ + struct platform_device *pdev; + struct device_node *bpmp_dev; + struct tegra_bpmp *bpmp; + + /* Check for bpmp device status in DT */ + bpmp_dev = of_find_compatible_node(NULL, NULL, "nvidia,tegra186-bpmp"); + if (!bpmp_dev) { + bpmp = ERR_PTR(-ENODEV); + goto err_out; + } + if (!of_device_is_available(bpmp_dev)) { + bpmp = ERR_PTR(-ENODEV); + goto err_put; + } + + pdev = of_find_device_by_node(bpmp_dev); + if (!pdev) { + bpmp = ERR_PTR(-ENODEV); + goto err_put; + } + + bpmp = platform_get_drvdata(pdev); + if (!bpmp) { + bpmp = ERR_PTR(-EPROBE_DEFER); + put_device(&pdev->dev); + goto err_put; + } + + return bpmp; +err_put: + of_node_put(bpmp_dev); +err_out: + return bpmp; +} +EXPORT_SYMBOL_GPL(of_tegra_bpmp_get); + struct tegra_bpmp *tegra_bpmp_get(struct device *dev) { struct platform_device *pdev; diff --git a/include/soc/tegra/bpmp.h b/include/soc/tegra/bpmp.h index 5842e38bb288..9fd3aa9e69bb 100644 --- a/include/soc/tegra/bpmp.h +++ b/include/soc/tegra/bpmp.h @@ -120,6 +120,7 @@ struct tegra_bpmp_message { }; #if IS_ENABLED(CONFIG_TEGRA_BPMP) +struct tegra_bpmp *of_tegra_bpmp_get(void); struct tegra_bpmp *tegra_bpmp_get(struct device *dev); void tegra_bpmp_put(struct tegra_bpmp *bpmp); int tegra_bpmp_transfer_atomic(struct tegra_bpmp *bpmp, @@ -135,6 +136,10 @@ void tegra_bpmp_free_mrq(struct tegra_bpmp *bpmp, unsigned int mrq, void *data); bool tegra_bpmp_mrq_is_supported(struct tegra_bpmp *bpmp, unsigned int mrq); #else +static inline struct tegra_bpmp *of_tegra_bpmp_get(void) +{ + return ERR_PTR(-EOPNOTSUPP); +} static inline struct tegra_bpmp *tegra_bpmp_get(struct device *dev) { return ERR_PTR(-ENOTSUPP); From patchwork Mon Mar 20 18:24:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 665469 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2B1BC7618A for ; Mon, 20 Mar 2023 18:34:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230527AbjCTSeJ (ORCPT ); Mon, 20 Mar 2023 14:34:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231165AbjCTSdw (ORCPT ); Mon, 20 Mar 2023 14:33:52 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on20615.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5b::615]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FC7625956; Mon, 20 Mar 2023 11:26:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X/6clwLB+JWauVroa2zd5rKz2gQfEHUmxeKboq8ZFAJtcYLeU21Qkiv108iNh7TBCIB+a05RkovQPk+GzHhTrLk2wXoy7PMxweeLf0Ovmuu2kM3g36NkBZrpWVGq3a9BGYq7RjnIMx8rPK/eNVIaYmGimL+QuobzU24Vl+QfUHNLJ95mAWTK63C/FeAq+c7dM7s0u71G+vJ6+/b8SDTEVyM6Rd0KNunBPnLMtV9inHiP4DMoqxvqYm4Eft5CLoN85MbC1sJjCI8vkuQFkZEe5x8hTKn5aNgUzAcdqYPBTUAZQ4T+/ACY/Dr3FM7byVr68cpyHmgUNPben/OL3yQs/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Ikjh4nWBmAxK6GZKcmmO/GUTzB5ICdCyIc3FS64IhCg=; b=KMcqdNqGcTvCn9i737krTwHox0TxLg8plRSXayoTCh+VbDPdDtnU3rWE+qlztYN8tXF1gDgSwQE5NxtSK2191HUEtV0bBh58IZaDNc+eIupKReHPxIoE8mH7P+lI4mqsoTmU9ostQAd7nPn0duxyHj1GjzNQVQfp29gJjOrfWbrNbAC2nBJEliD8LW7854S4G87YK96P3y96Ev2wwD4N8Q3pWvKn/T7QB5+xAPoWuEm+Hz2nrIQpAHOJrKhJsjOsRI5QK+hQiv74PU70SMCpHMlFpPb4tUcY0r5hU4DVi9KxJFocWk02Af4/J6eiMvnlLaHh5doJhjXCW8HGvlWEDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=google.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ikjh4nWBmAxK6GZKcmmO/GUTzB5ICdCyIc3FS64IhCg=; b=UITwFVI5pb3axzy/qkzDS+F6e488F80qr0FG2jsw8jCM2N9A54E05hHVIB8wtOVfNDyLW2R/ttuQHQZzV7os2sEcUcR83r+CmlUARqtImv0mMRFdNINGQzwi42uOLOPLJPSLeDV9qH2jy1C0Ft6+ckJG3dnUYD8dXoB3b9weYEwCA8ZTC04ExZeSMTUD9thdKQQVFKdXOdOr8syPzIB05vem61wh8oZIq8ui0z5GLAB/enA78uQPp8mw2nO2LtYP+ZbPujmjQdtXJV8LwlNpLlTDfSEDrCyQrCkzFO8tQmE01ee2bH/+gOKDssW94Au50e1i97yWoRtEYYjz4QGdHw== Received: from MW4P223CA0024.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::29) by DM4PR12MB5293.namprd12.prod.outlook.com (2603:10b6:5:390::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Mon, 20 Mar 2023 18:25:23 +0000 Received: from CO1NAM11FT112.eop-nam11.prod.protection.outlook.com (2603:10b6:303:80:cafe::4) by MW4P223CA0024.outlook.office365.com (2603:10b6:303:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Mon, 20 Mar 2023 18:25:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CO1NAM11FT112.mail.protection.outlook.com (10.13.174.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.16 via Frontend Transport; Mon, 20 Mar 2023 18:25:27 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 20 Mar 2023 11:25:23 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 20 Mar 2023 11:25:22 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.5 via Frontend Transport; Mon, 20 Mar 2023 11:25:17 -0700 From: Sumit Gupta To: , , , , , , , CC: , , , , , , , , , , , , , Subject: [Patch v3 02/11] memory: tegra: add interconnect support for DRAM scaling in Tegra234 Date: Mon, 20 Mar 2023 23:54:32 +0530 Message-ID: <20230320182441.11904-3-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230320182441.11904-1-sumitg@nvidia.com> References: <20230320182441.11904-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT112:EE_|DM4PR12MB5293:EE_ X-MS-Office365-Filtering-Correlation-Id: 013b491a-1386-4db2-a7e7-08db29707ab5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k6ogAOJ4V9S1PHwfiw/E9jpGG7pzWTNdyIaI2hPATsL/z2YqWJqP1Ssz4xEj3HwTWEzkXDkSob6lybEoChtY9m0jwRnBK6od22DxJh4QvknB60Js3W6y3NRp2/KXmbJP/pwC/ez+3wH7RhpEZgejwfrvUcV6+rlbPGvb5mwG39ZxepojR6NM9+Oje4wFd7Zb+AWj3F4rStisaJr4crj5pczn6BJc3pV5flAkfK6kYTtfL0Qpo1wAoPLhYhQGQS9kkPrmEfDOkBnW6Qy9fl/WSD9xQcHYiy1rspI0skNOSjarl2fI/ySjdDBhrTon5SYVvQTT587gA0fz5/CAW349UFZhxy+FVJTFkzKMk3w0Lrc15T7pRZX0Us7Knyg539v2l9ezaE8FmvmlG6PgXUE7c1pzP+ty5NIEiVOTNvXq6YMo2PTaVAOQZ0JeUNF1Jj7GnagbIg0lBeyXSDFgYvEfia/6wFJO0zZiOwdzCyfusQZqcbcJYRC3BkDnh001T8UC/1WbUxUtgjdjzDfXPpbrJmsq1TAyj5izPstGhwHxGs15zsG/3kEoBnPPSZzdeaXRE3OsrY49QlarR/v2ARfHDZNl1B06p4xw+rsDeIl/Xpn6luqz6JQLuFy8VA/U8Gy5/PUIQkcgkYSzZA8pSqDM4OmsxQzVD+OQbd9GPoiI8CMKRbI3py+q7bSJqjfY3/ma5OYpWpHFlrrJRZZkzjz9Zpmqqx1BvCBZkNjaUzwb6ZaBqppeGx0HnYBUxj0e5EwL X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(39860400002)(376002)(346002)(136003)(396003)(451199018)(46966006)(40470700004)(36840700001)(41300700001)(8936002)(2906002)(30864003)(70586007)(70206006)(5660300002)(4326008)(8676002)(7416002)(316002)(110136005)(86362001)(54906003)(478600001)(1076003)(36756003)(40460700003)(7696005)(107886003)(6666004)(186003)(40480700001)(26005)(336012)(47076005)(426003)(2616005)(83380400001)(82740400003)(82310400005)(356005)(7636003)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2023 18:25:27.3921 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 013b491a-1386-4db2-a7e7-08db29707ab5 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT112.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5293 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add Interconnect framework support to dynamically set the DRAM bandwidth from different clients. Both the MC and EMC drivers are added as ICC providers. The path for any request is: MC-Client[1-n] -> MC -> EMC -> EMEM/DRAM MC client's request for bandwidth will go to the MC driver which passes the client request info like BPMP Client ID, Client type and the Bandwidth to the BPMP-FW. The final DRAM freq to achieve the requested bandwidth is set by the BPMP-FW based on the passed parameters. Signed-off-by: Sumit Gupta Acked-by: Krzysztof Kozlowski --- drivers/memory/tegra/mc.c | 5 + drivers/memory/tegra/tegra186-emc.c | 117 +++++++++++++++++++++++ drivers/memory/tegra/tegra234.c | 139 +++++++++++++++++++++++++++- include/linux/tegra-icc.h | 65 +++++++++++++ include/soc/tegra/mc.h | 5 + 5 files changed, 330 insertions(+), 1 deletion(-) create mode 100644 include/linux/tegra-icc.h diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c index 9082b6c3763d..bbd27d754fef 100644 --- a/drivers/memory/tegra/mc.c +++ b/drivers/memory/tegra/mc.c @@ -15,6 +15,7 @@ #include #include #include +#include #include @@ -792,6 +793,8 @@ static int tegra_mc_interconnect_setup(struct tegra_mc *mc) mc->provider.data = &mc->provider; mc->provider.set = mc->soc->icc_ops->set; mc->provider.aggregate = mc->soc->icc_ops->aggregate; + mc->provider.get_bw = mc->soc->icc_ops->get_bw; + mc->provider.xlate = mc->soc->icc_ops->xlate; mc->provider.xlate_extended = mc->soc->icc_ops->xlate_extended; icc_provider_init(&mc->provider); @@ -824,6 +827,8 @@ static int tegra_mc_interconnect_setup(struct tegra_mc *mc) err = icc_link_create(node, TEGRA_ICC_MC); if (err) goto remove_nodes; + + node->data = (char *)&(mc->soc->clients[i]); } err = icc_provider_register(&mc->provider); diff --git a/drivers/memory/tegra/tegra186-emc.c b/drivers/memory/tegra/tegra186-emc.c index e935ad4e95b6..978be8f54de4 100644 --- a/drivers/memory/tegra/tegra186-emc.c +++ b/drivers/memory/tegra/tegra186-emc.c @@ -7,9 +7,11 @@ #include #include #include +#include #include #include +#include "mc.h" struct tegra186_emc_dvfs { unsigned long latency; @@ -29,8 +31,15 @@ struct tegra186_emc { unsigned long min_rate; unsigned long max_rate; } debugfs; + + struct icc_provider provider; }; +static inline struct tegra186_emc *to_tegra186_emc(struct icc_provider *provider) +{ + return container_of(provider, struct tegra186_emc, provider); +} + /* * debugfs interface * @@ -146,11 +155,104 @@ DEFINE_DEBUGFS_ATTRIBUTE(tegra186_emc_debug_max_rate_fops, tegra186_emc_debug_max_rate_get, tegra186_emc_debug_max_rate_set, "%llu\n"); +/* + * tegra_emc_icc_set_bw() - Set BW api for EMC provider + * @src: ICC node for External Memory Controller (EMC) + * @dst: ICC node for External Memory (DRAM) + * + * Do nothing here as info to BPMP-FW is now passed in the BW set function + * of the MC driver. BPMP-FW sets the final Freq based on the passed values. + */ +static int tegra_emc_icc_set_bw(struct icc_node *src, struct icc_node *dst) +{ + return 0; +} + +static struct icc_node * +tegra_emc_of_icc_xlate(struct of_phandle_args *spec, void *data) +{ + struct icc_provider *provider = data; + struct icc_node *node; + + /* External Memory is the only possible ICC route */ + list_for_each_entry(node, &provider->nodes, node_list) { + if (node->id != TEGRA_ICC_EMEM) + continue; + + return node; + } + + return ERR_PTR(-EPROBE_DEFER); +} + +static int tegra_emc_icc_get_init_bw(struct icc_node *node, u32 *avg, u32 *peak) +{ + *avg = 0; + *peak = 0; + + return 0; +} + +static int tegra_emc_interconnect_init(struct tegra186_emc *emc) +{ + struct tegra_mc *mc = dev_get_drvdata(emc->dev->parent); + const struct tegra_mc_soc *soc = mc->soc; + struct icc_node *node; + int err; + + emc->provider.dev = emc->dev; + emc->provider.set = tegra_emc_icc_set_bw; + emc->provider.data = &emc->provider; + emc->provider.aggregate = soc->icc_ops->aggregate; + emc->provider.xlate = tegra_emc_of_icc_xlate; + emc->provider.get_bw = tegra_emc_icc_get_init_bw; + + err = icc_provider_add(&emc->provider); + if (err) + goto err_msg; + + /* create External Memory Controller node */ + node = icc_node_create(TEGRA_ICC_EMC); + if (IS_ERR(node)) { + err = PTR_ERR(node); + goto del_provider; + } + + node->name = "External Memory Controller"; + icc_node_add(node, &emc->provider); + + /* link External Memory Controller to External Memory (DRAM) */ + err = icc_link_create(node, TEGRA_ICC_EMEM); + if (err) + goto remove_nodes; + + /* create External Memory node */ + node = icc_node_create(TEGRA_ICC_EMEM); + if (IS_ERR(node)) { + err = PTR_ERR(node); + goto remove_nodes; + } + + node->name = "External Memory (DRAM)"; + icc_node_add(node, &emc->provider); + + return 0; +remove_nodes: + icc_nodes_remove(&emc->provider); +del_provider: + icc_provider_del(&emc->provider); +err_msg: + dev_err(emc->dev, "failed to initialize ICC: %d\n", err); + + return err; +} + static int tegra186_emc_probe(struct platform_device *pdev) { struct mrq_emc_dvfs_latency_response response; struct tegra_bpmp_message msg; struct tegra186_emc *emc; + struct tegra_mc *mc; unsigned int i; int err; @@ -158,6 +260,9 @@ static int tegra186_emc_probe(struct platform_device *pdev) if (!emc) return -ENOMEM; + platform_set_drvdata(pdev, emc); + emc->dev = &pdev->dev; + emc->bpmp = tegra_bpmp_get(&pdev->dev); if (IS_ERR(emc->bpmp)) return dev_err_probe(&pdev->dev, PTR_ERR(emc->bpmp), "failed to get BPMP\n"); @@ -236,6 +341,17 @@ static int tegra186_emc_probe(struct platform_device *pdev) debugfs_create_file("max_rate", S_IRUGO | S_IWUSR, emc->debugfs.root, emc, &tegra186_emc_debug_max_rate_fops); + mc = dev_get_drvdata(emc->dev->parent); + if (mc && mc->soc->icc_ops) { + if (tegra_bpmp_mrq_is_supported(emc->bpmp, MRQ_BWMGR_INT)) { + err = tegra_emc_interconnect_init(emc); + if (err) + goto put_bpmp; + } else { + dev_info(&pdev->dev, "MRQ_BWMGR_INT not present\n"); + } + } + return 0; put_bpmp: @@ -272,6 +388,7 @@ static struct platform_driver tegra186_emc_driver = { .name = "tegra186-emc", .of_match_table = tegra186_emc_of_match, .suppress_bind_attrs = true, + .sync_state = icc_sync_state, }, .probe = tegra186_emc_probe, .remove = tegra186_emc_remove, diff --git a/drivers/memory/tegra/tegra234.c b/drivers/memory/tegra/tegra234.c index 02dcc5748bba..b40229926558 100644 --- a/drivers/memory/tegra/tegra234.c +++ b/drivers/memory/tegra/tegra234.c @@ -1,18 +1,24 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (C) 2021-2022, NVIDIA CORPORATION. All rights reserved. + * Copyright (C) 20212-2023, NVIDIA CORPORATION. All rights reserved. */ #include #include +#include +#include +#include +#include #include "mc.h" static const struct tegra_mc_client tegra234_mc_clients[] = { { .id = TEGRA234_MEMORY_CLIENT_MGBEARD, .name = "mgbeard", + .bpmp_id = TEGRA_ICC_BPMP_EQOS, + .type = TEGRA_ICC_NISO, .sid = TEGRA234_SID_MGBE, .regs = { .sid = { @@ -23,6 +29,8 @@ static const struct tegra_mc_client tegra234_mc_clients[] = { }, { .id = TEGRA234_MEMORY_CLIENT_MGBEBRD, .name = "mgbebrd", + .bpmp_id = TEGRA_ICC_BPMP_EQOS, + .type = TEGRA_ICC_NISO, .sid = TEGRA234_SID_MGBE_VF1, .regs = { .sid = { @@ -33,6 +41,8 @@ static const struct tegra_mc_client tegra234_mc_clients[] = { }, { .id = TEGRA234_MEMORY_CLIENT_MGBECRD, .name = "mgbecrd", + .bpmp_id = TEGRA_ICC_BPMP_EQOS, + .type = TEGRA_ICC_NISO, .sid = TEGRA234_SID_MGBE_VF2, .regs = { .sid = { @@ -43,6 +53,8 @@ static const struct tegra_mc_client tegra234_mc_clients[] = { }, { .id = TEGRA234_MEMORY_CLIENT_MGBEDRD, .name = "mgbedrd", + .bpmp_id = TEGRA_ICC_BPMP_EQOS, + .type = TEGRA_ICC_NISO, .sid = TEGRA234_SID_MGBE_VF3, .regs = { .sid = { @@ -52,6 +64,8 @@ static const struct tegra_mc_client tegra234_mc_clients[] = { }, }, { .id = TEGRA234_MEMORY_CLIENT_MGBEAWR, + .bpmp_id = TEGRA_ICC_BPMP_EQOS, + .type = TEGRA_ICC_NISO, .name = "mgbeawr", .sid = TEGRA234_SID_MGBE, .regs = { @@ -63,6 +77,8 @@ static const struct tegra_mc_client tegra234_mc_clients[] = { }, { .id = TEGRA234_MEMORY_CLIENT_MGBEBWR, .name = "mgbebwr", + .bpmp_id = TEGRA_ICC_BPMP_EQOS, + .type = TEGRA_ICC_NISO, .sid = TEGRA234_SID_MGBE_VF1, .regs = { .sid = { @@ -73,6 +89,8 @@ static const struct tegra_mc_client tegra234_mc_clients[] = { }, { .id = TEGRA234_MEMORY_CLIENT_MGBECWR, .name = "mgbecwr", + .bpmp_id = TEGRA_ICC_BPMP_EQOS, + .type = TEGRA_ICC_NISO, .sid = TEGRA234_SID_MGBE_VF2, .regs = { .sid = { @@ -83,6 +101,8 @@ static const struct tegra_mc_client tegra234_mc_clients[] = { }, { .id = TEGRA234_MEMORY_CLIENT_SDMMCRAB, .name = "sdmmcrab", + .bpmp_id = TEGRA_ICC_BPMP_SDMMC_4, + .type = TEGRA_ICC_NISO, .sid = TEGRA234_SID_SDMMC4, .regs = { .sid = { @@ -93,6 +113,8 @@ static const struct tegra_mc_client tegra234_mc_clients[] = { }, { .id = TEGRA234_MEMORY_CLIENT_MGBEDWR, .name = "mgbedwr", + .bpmp_id = TEGRA_ICC_BPMP_EQOS, + .type = TEGRA_ICC_NISO, .sid = TEGRA234_SID_MGBE_VF3, .regs = { .sid = { @@ -103,6 +125,8 @@ static const struct tegra_mc_client tegra234_mc_clients[] = { }, { .id = TEGRA234_MEMORY_CLIENT_SDMMCWAB, .name = "sdmmcwab", + .bpmp_id = TEGRA_ICC_BPMP_SDMMC_4, + .type = TEGRA_ICC_NISO, .sid = TEGRA234_SID_SDMMC4, .regs = { .sid = { @@ -153,6 +177,8 @@ static const struct tegra_mc_client tegra234_mc_clients[] = { }, { .id = TEGRA234_MEMORY_CLIENT_APEDMAR, .name = "apedmar", + .bpmp_id = TEGRA_ICC_BPMP_APEDMA, + .type = TEGRA_ICC_ISO_AUDIO, .sid = TEGRA234_SID_APE, .regs = { .sid = { @@ -163,6 +189,8 @@ static const struct tegra_mc_client tegra234_mc_clients[] = { }, { .id = TEGRA234_MEMORY_CLIENT_APEDMAW, .name = "apedmaw", + .bpmp_id = TEGRA_ICC_BPMP_APEDMA, + .type = TEGRA_ICC_ISO_AUDIO, .sid = TEGRA234_SID_APE, .regs = { .sid = { @@ -333,6 +361,114 @@ static const struct tegra_mc_client tegra234_mc_clients[] = { }, }; +/* + * tegra234_mc_icc_set() - Pass MC client info to the BPMP-FW + * @src: ICC node for Memory Controller's (MC) Client + * @dst: ICC node for Memory Controller (MC) + * + * Passing the current request info from the MC to the BPMP-FW where + * LA and PTSA registers are accessed and the final EMC freq is set + * based on client_id, type, latency and bandwidth. + * icc_set_bw() makes set_bw calls for both MC and EMC providers in + * sequence. Both the calls are protected by 'mutex_lock(&icc_lock)'. + * So, the data passed won't be updated by concurrent set calls from + * other clients. + */ +static int tegra234_mc_icc_set(struct icc_node *src, struct icc_node *dst) +{ + struct tegra_mc *mc = icc_provider_to_tegra_mc(dst->provider); + struct mrq_bwmgr_int_request bwmgr_req = { 0 }; + struct mrq_bwmgr_int_response bwmgr_resp = { 0 }; + const struct tegra_mc_client *pclient = src->data; + struct tegra_bpmp_message msg; + struct tegra_bpmp *bpmp; + int ret; + + /* + * Same Src and Dst node will happen during boot from icc_node_add(). + * This can be used to pre-initialize and set bandwidth for all clients + * before their drivers are loaded. We are skipping this case as for us, + * the pre-initialization already happened in Bootloader(MB2) and BPMP-FW. + */ + if (src->id == dst->id) + return 0; + + bpmp = of_tegra_bpmp_get(); + if (IS_ERR(bpmp)) { + ret = PTR_ERR(bpmp); + return ret; + } + + if (pclient->type == TEGRA_ICC_NISO) + bwmgr_req.bwmgr_calc_set_req.niso_bw = src->avg_bw; + else + bwmgr_req.bwmgr_calc_set_req.iso_bw = src->avg_bw; + + bwmgr_req.bwmgr_calc_set_req.client_id = pclient->bpmp_id; + + bwmgr_req.cmd = CMD_BWMGR_INT_CALC_AND_SET; + bwmgr_req.bwmgr_calc_set_req.mc_floor = src->peak_bw; + bwmgr_req.bwmgr_calc_set_req.floor_unit = BWMGR_INT_UNIT_KBPS; + + memset(&msg, 0, sizeof(msg)); + msg.mrq = MRQ_BWMGR_INT; + msg.tx.data = &bwmgr_req; + msg.tx.size = sizeof(bwmgr_req); + msg.rx.data = &bwmgr_resp; + msg.rx.size = sizeof(bwmgr_resp); + + ret = tegra_bpmp_transfer(bpmp, &msg); + if (ret < 0) { + dev_err(mc->dev, "BPMP transfer failed: %d\n", ret); + goto error; + } + if (msg.rx.ret < 0) { + pr_err("failed to set bandwidth for %u: %d\n", + bwmgr_req.bwmgr_calc_set_req.client_id, msg.rx.ret); + ret = -EINVAL; + } + +error: + tegra_bpmp_put(bpmp); + return ret; +} + +static struct icc_node* +tegra234_mc_of_icc_xlate(struct of_phandle_args *spec, void *data) +{ + struct tegra_mc *mc = icc_provider_to_tegra_mc(data); + unsigned int cl_id = spec->args[0]; + struct icc_node *node; + + list_for_each_entry(node, &mc->provider.nodes, node_list) { + if (node->id != cl_id) + continue; + + return node; + } + + /* + * If a client driver calls devm_of_icc_get() before the MC driver + * is probed, then return EPROBE_DEFER to the client driver. + */ + return ERR_PTR(-EPROBE_DEFER); +} + +static int tegra234_mc_icc_get_init_bw(struct icc_node *node, u32 *avg, u32 *peak) +{ + *avg = 0; + *peak = 0; + + return 0; +} + +static const struct tegra_mc_icc_ops tegra234_mc_icc_ops = { + .xlate = tegra234_mc_of_icc_xlate, + .aggregate = icc_std_aggregate, + .get_bw = tegra234_mc_icc_get_init_bw, + .set = tegra234_mc_icc_set, +}; + const struct tegra_mc_soc tegra234_mc_soc = { .num_clients = ARRAY_SIZE(tegra234_mc_clients), .clients = tegra234_mc_clients, @@ -345,6 +481,7 @@ const struct tegra_mc_soc tegra234_mc_soc = { MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM, .has_addr_hi_reg = true, .ops = &tegra186_mc_ops, + .icc_ops = &tegra234_mc_icc_ops, .ch_intmask = 0x0000ff00, .global_intstatus_channel_shift = 8, /* diff --git a/include/linux/tegra-icc.h b/include/linux/tegra-icc.h new file mode 100644 index 000000000000..4b4d4bee290c --- /dev/null +++ b/include/linux/tegra-icc.h @@ -0,0 +1,65 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2022-2023 NVIDIA CORPORATION. All rights reserved. + */ + +#ifndef LINUX_TEGRA_ICC_H +#define LINUX_TEGRA_ICC_H + +enum tegra_icc_client_type { + TEGRA_ICC_NONE, + TEGRA_ICC_NISO, + TEGRA_ICC_ISO_DISPLAY, + TEGRA_ICC_ISO_VI, + TEGRA_ICC_ISO_AUDIO, + TEGRA_ICC_ISO_VIFAL, +}; + +/* ICC ID's for MC client's used in BPMP */ +#define TEGRA_ICC_BPMP_DEBUG 1 +#define TEGRA_ICC_BPMP_CPU_CLUSTER0 2 +#define TEGRA_ICC_BPMP_CPU_CLUSTER1 3 +#define TEGRA_ICC_BPMP_CPU_CLUSTER2 4 +#define TEGRA_ICC_BPMP_GPU 5 +#define TEGRA_ICC_BPMP_CACTMON 6 +#define TEGRA_ICC_BPMP_DISPLAY 7 +#define TEGRA_ICC_BPMP_VI 8 +#define TEGRA_ICC_BPMP_EQOS 9 +#define TEGRA_ICC_BPMP_PCIE_0 10 +#define TEGRA_ICC_BPMP_PCIE_1 11 +#define TEGRA_ICC_BPMP_PCIE_2 12 +#define TEGRA_ICC_BPMP_PCIE_3 13 +#define TEGRA_ICC_BPMP_PCIE_4 14 +#define TEGRA_ICC_BPMP_PCIE_5 15 +#define TEGRA_ICC_BPMP_PCIE_6 16 +#define TEGRA_ICC_BPMP_PCIE_7 17 +#define TEGRA_ICC_BPMP_PCIE_8 18 +#define TEGRA_ICC_BPMP_PCIE_9 19 +#define TEGRA_ICC_BPMP_PCIE_10 20 +#define TEGRA_ICC_BPMP_DLA_0 21 +#define TEGRA_ICC_BPMP_DLA_1 22 +#define TEGRA_ICC_BPMP_SDMMC_1 23 +#define TEGRA_ICC_BPMP_SDMMC_2 24 +#define TEGRA_ICC_BPMP_SDMMC_3 25 +#define TEGRA_ICC_BPMP_SDMMC_4 26 +#define TEGRA_ICC_BPMP_NVDEC 27 +#define TEGRA_ICC_BPMP_NVENC 28 +#define TEGRA_ICC_BPMP_NVJPG_0 29 +#define TEGRA_ICC_BPMP_NVJPG_1 30 +#define TEGRA_ICC_BPMP_OFAA 31 +#define TEGRA_ICC_BPMP_XUSB_HOST 32 +#define TEGRA_ICC_BPMP_XUSB_DEV 33 +#define TEGRA_ICC_BPMP_TSEC 34 +#define TEGRA_ICC_BPMP_VIC 35 +#define TEGRA_ICC_BPMP_APE 36 +#define TEGRA_ICC_BPMP_APEDMA 37 +#define TEGRA_ICC_BPMP_SE 38 +#define TEGRA_ICC_BPMP_ISP 39 +#define TEGRA_ICC_BPMP_HDA 40 +#define TEGRA_ICC_BPMP_VIFAL 41 +#define TEGRA_ICC_BPMP_VI2FAL 42 +#define TEGRA_ICC_BPMP_VI2 43 +#define TEGRA_ICC_BPMP_RCE 44 +#define TEGRA_ICC_BPMP_PVA 45 + +#endif /* LINUX_TEGRA_ICC_H */ diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h index 51a2263e1bc5..fefac9622987 100644 --- a/include/soc/tegra/mc.h +++ b/include/soc/tegra/mc.h @@ -13,6 +13,7 @@ #include #include #include +#include struct clk; struct device; @@ -26,6 +27,8 @@ struct tegra_mc_timing { struct tegra_mc_client { unsigned int id; + unsigned int bpmp_id; + enum tegra_icc_client_type type; const char *name; /* * For Tegra210 and earlier, this is the SWGROUP ID used for IOVA translations in the @@ -166,8 +169,10 @@ struct tegra_mc_icc_ops { int (*set)(struct icc_node *src, struct icc_node *dst); int (*aggregate)(struct icc_node *node, u32 tag, u32 avg_bw, u32 peak_bw, u32 *agg_avg, u32 *agg_peak); + struct icc_node* (*xlate)(struct of_phandle_args *spec, void *data); struct icc_node_data *(*xlate_extended)(struct of_phandle_args *spec, void *data); + int (*get_bw)(struct icc_node *node, u32 *avg, u32 *peak); }; struct tegra_mc_ops { From patchwork Mon Mar 20 18:24:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 665761 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7802FC761AF for ; Mon, 20 Mar 2023 18:34:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231437AbjCTSeL (ORCPT ); Mon, 20 Mar 2023 14:34:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231225AbjCTSdx (ORCPT ); Mon, 20 Mar 2023 14:33:53 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on20611.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe59::611]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B22A37B76; Mon, 20 Mar 2023 11:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=btyrvy2TxoeJDpjwLAJtGFSSgbGyHtr8HQczImxn7l7OSfPoXu/GmY52EEzdmYiypqgTZYPTtw14pY4/9IGdO52bgcjFx+Cnfw7nvVNDOKSLlIKG4MSjGCG+xpsDxzYTpVPP7R8c48aEGy/sc//ltvqnAm0jZcK31ZFTkmz6Ux2YJX+KsZ/e+HjwEqjZervPQ+H1oAX2UQKlKKHXs470ALrbj0t2ZvK/YDivq/gk6xDqfRfQh84o9VGJIzOY7upiJ8zIrK1y8jdibLy5qJOM7OkVfGWOsG4RYNyJm5Wvaqa6ZB/kA9ozy5WFntFEKjAcFlRoN/klGzVIn4EBpuMsGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7HewRol2vw9rvVIfTdmYVBC/1mQMXSvdHNc/fD3rnGM=; b=huecutLzswikLy0Po1OD2PAh+Ty4Yg7rHFtQbyrVLyaAOof3a19suZ621aef5147kYr7EjBMLwrd03FEXRnNWuzgHJM5qsA0eG5/Smt+eQ6zeQhfYWSulBydC8sZdH+fli2EPwt+KsNhZEVTpXgpy02PNOyF+YgbwqhTuWbJp3crSiw62b3Fc+sf/+PZlfDCtpWSgzEEtLBTLmI5qye/MRy2oIu/SUz6KyMfXi0FBe7Vg9kGzjyHFhqsJ0C3+itKGSRgIFxRRKlcPj8VSGQYqlEWh2FIOLad7ZPKfS2jrE0PN+ySWK3ck+c7Ym1R5UC/tNGeRv4FvBgWrBoYnXkUOw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=google.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7HewRol2vw9rvVIfTdmYVBC/1mQMXSvdHNc/fD3rnGM=; b=VO4kZJjnQ9er8s1YeHChuyw4riQj5/eMyItoZgPAmamPAF8KS6M6ykn01LnXvn0GkzQc0bi3IG1fOhyiVSqhFLD2z0HdgNubgcAuSWaaPOUN8v7qDrEBquZe887OtEKqcXkncBHPqFlZwIiWAd43D4TSX/Z5ZiRnVhFxJ4tjI6XzSCI+HXxxQWWmoDxlHQBbMHCcHyLt7YIemJ9RSpMZVEVaIxFQt+fShRBJVAvWo2KbfMXQGfOOPHByvOCS4mmj0kUgHXRCcofgXOmVeFu4CoPSbfE2uVvSZFHG+t52dMPFNuXoFZ/1PyKWKD88mHbJlTaVyYE8jOxiWEiJI5szYA== Received: from MW4P223CA0007.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::12) by SA1PR12MB8986.namprd12.prod.outlook.com (2603:10b6:806:375::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Mon, 20 Mar 2023 18:25:34 +0000 Received: from CO1NAM11FT112.eop-nam11.prod.protection.outlook.com (2603:10b6:303:80:cafe::fe) by MW4P223CA0007.outlook.office365.com (2603:10b6:303:80::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Mon, 20 Mar 2023 18:25:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CO1NAM11FT112.mail.protection.outlook.com (10.13.174.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.16 via Frontend Transport; Mon, 20 Mar 2023 18:25:34 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 20 Mar 2023 11:25:31 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 20 Mar 2023 11:25:30 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.5 via Frontend Transport; Mon, 20 Mar 2023 11:25:25 -0700 From: Sumit Gupta To: , , , , , , , CC: , , , , , , , , , , , , , Subject: [Patch v3 03/11] memory: tegra: add mc clients for Tegra234 Date: Mon, 20 Mar 2023 23:54:33 +0530 Message-ID: <20230320182441.11904-4-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230320182441.11904-1-sumitg@nvidia.com> References: <20230320182441.11904-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT112:EE_|SA1PR12MB8986:EE_ X-MS-Office365-Filtering-Correlation-Id: 2ff521ef-2109-496c-029c-08db29707ef0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ux2b5Ws2vvUBnD5B6iKpGOVN9euXgrN1AZt9+dALTH+UmlszAKiBoCLHQW3zjSOeY9wTMzLBZC5BeVAVUH1STjgGpLyKaOO+rml8HDY46KK0IjbSitAFIeeHRIh5HrCkHPRSf6P+IALbX6XYAIF/zpHezDTC1oGCL57K49bSR8LYwT8Y4CsOTgSTIm69N4eFu3j+P7c3jIdVeb2s/fVIDojtzeK3Fjv5WMpgLPVvD2oSZDIzvHNMNwDZqAoedJl4pszs7agvbI3m8H/J7B4pce53Ql5GRmMeiEC9sXC7ARZz0haUggORTZbBkWMItOdp3WxRvPRb87Rpc/QkviSS8xIYhUAhJrPrTnJpNeR5QoTsLyAGVHx8mw6ec+ZJInBXsaaK+oWR49YzqG7eybi1u6bcwlS2Nb8jKqgJRUFic3NwB7q8FQkJhcOjsW0EopNZ9lvFJAAndkRSGDS50ai1Sl1qMWU/JejlYreBMabSTDpfoi8NeCO1QefouU8/N8VEATRfR44Z8jZ+Ha3KLPSdzMKzRhkfSE/lpPYixC8K1qWKjDxpjipKPJd+EWlkAVj4kl3nhNFz8V3JdJUddvj01Z73nmaOJjqxrEm9vRv/cihuBi5IWHWY1AdphAgbgPCJh6BfHjvD+PpDgW2KJuYByWwTX4aGM15ggSV2VsWUoFjtj5Wlz8dO9MZS2/Yw0sn7cvsrGAzR7hJ+FK/JUGm1LwZXYnO9zfcQJE0ONW7AJ7y5aNPlw6XfMrIArfFIM+7A X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(346002)(396003)(39860400002)(376002)(136003)(451199018)(40470700004)(46966006)(36840700001)(2906002)(82740400003)(7636003)(356005)(40480700001)(40460700003)(47076005)(7696005)(426003)(478600001)(83380400001)(186003)(86362001)(36756003)(82310400005)(110136005)(6666004)(2616005)(316002)(41300700001)(54906003)(70206006)(4326008)(8676002)(5660300002)(70586007)(107886003)(336012)(26005)(1076003)(8936002)(7416002)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2023 18:25:34.4854 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2ff521ef-2109-496c-029c-08db29707ef0 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT112.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8986 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add few Isochronous (ISO) and Non-ISO MC clients. ISO clients have guaranteed bandwidth requirement. PCIE clients added to the mc_clients table represent each controller in Tegra234. Signed-off-by: Sumit Gupta Acked-by: Krzysztof Kozlowski --- drivers/memory/tegra/tegra234.c | 420 ++++++++++++++++++++++++++++++++ 1 file changed, 420 insertions(+) diff --git a/drivers/memory/tegra/tegra234.c b/drivers/memory/tegra/tegra234.c index b40229926558..7ca744036f59 100644 --- a/drivers/memory/tegra/tegra234.c +++ b/drivers/memory/tegra/tegra234.c @@ -15,6 +15,30 @@ static const struct tegra_mc_client tegra234_mc_clients[] = { { + .id = TEGRA234_MEMORY_CLIENT_HDAR, + .name = "hdar", + .bpmp_id = TEGRA_ICC_BPMP_HDA, + .type = TEGRA_ICC_ISO_AUDIO, + .sid = TEGRA234_SID_HDA, + .regs = { + .sid = { + .override = 0xa8, + .security = 0xac, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_HDAW, + .name = "hdaw", + .bpmp_id = TEGRA_ICC_BPMP_HDA, + .type = TEGRA_ICC_ISO_AUDIO, + .sid = TEGRA234_SID_HDA, + .regs = { + .sid = { + .override = 0x1a8, + .security = 0x1ac, + }, + }, + }, { .id = TEGRA234_MEMORY_CLIENT_MGBEARD, .name = "mgbeard", .bpmp_id = TEGRA_ICC_BPMP_EQOS, @@ -134,6 +158,90 @@ static const struct tegra_mc_client tegra234_mc_clients[] = { .security = 0x33c, }, }, + }, { + .id = TEGRA234_MEMORY_CLIENT_VI2W, + .name = "vi2w", + .bpmp_id = TEGRA_ICC_BPMP_VI2, + .type = TEGRA_ICC_ISO_VI, + .sid = TEGRA234_SID_ISO_VI2, + .regs = { + .sid = { + .override = 0x380, + .security = 0x384, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_VI2FALR, + .name = "vi2falr", + .bpmp_id = TEGRA_ICC_BPMP_VI2FAL, + .type = TEGRA_ICC_ISO_VIFAL, + .sid = TEGRA234_SID_ISO_VI2FALC, + .regs = { + .sid = { + .override = 0x388, + .security = 0x38c, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_VI2FALW, + .name = "vi2falw", + .bpmp_id = TEGRA_ICC_BPMP_VI2FAL, + .type = TEGRA_ICC_ISO_VIFAL, + .sid = TEGRA234_SID_ISO_VI2FALC, + .regs = { + .sid = { + .override = 0x3e0, + .security = 0x3e4, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_APER, + .name = "aper", + .bpmp_id = TEGRA_ICC_BPMP_APE, + .type = TEGRA_ICC_ISO_AUDIO, + .sid = TEGRA234_SID_APE, + .regs = { + .sid = { + .override = 0x3d0, + .security = 0x3d4, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_APEW, + .name = "apew", + .bpmp_id = TEGRA_ICC_BPMP_APE, + .type = TEGRA_ICC_ISO_AUDIO, + .sid = TEGRA234_SID_APE, + .regs = { + .sid = { + .override = 0x3d8, + .security = 0x3dc, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_NVDISPLAYR, + .name = "nvdisplayr", + .bpmp_id = TEGRA_ICC_BPMP_DISPLAY, + .type = TEGRA_ICC_ISO_DISPLAY, + .sid = TEGRA234_SID_ISO_NVDISPLAY, + .regs = { + .sid = { + .override = 0x490, + .security = 0x494, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_NVDISPLAYR1, + .name = "nvdisplayr1", + .bpmp_id = TEGRA_ICC_BPMP_DISPLAY, + .type = TEGRA_ICC_ISO_DISPLAY, + .sid = TEGRA234_SID_ISO_NVDISPLAY, + .regs = { + .sid = { + .override = 0x508, + .security = 0x50c, + }, + }, }, { .id = TEGRA234_MEMORY_CLIENT_BPMPR, .name = "bpmpr", @@ -358,6 +466,318 @@ static const struct tegra_mc_client tegra234_mc_clients[] = { .security = 0x37c, }, }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE0R, + .name = "pcie0r", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_0, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE0, + .regs = { + .sid = { + .override = 0x6c0, + .security = 0x6c4, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE0W, + .name = "pcie0w", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_0, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE0, + .regs = { + .sid = { + .override = 0x6c8, + .security = 0x6cc, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE1R, + .name = "pcie1r", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_1, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE1, + .regs = { + .sid = { + .override = 0x6d0, + .security = 0x6d4, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE1W, + .name = "pcie1w", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_1, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE1, + .regs = { + .sid = { + .override = 0x6d8, + .security = 0x6dc, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE2AR, + .name = "pcie2ar", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_2, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE2, + .regs = { + .sid = { + .override = 0x6e0, + .security = 0x6e4, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE2AW, + .name = "pcie2aw", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_2, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE2, + .regs = { + .sid = { + .override = 0x6e8, + .security = 0x6ec, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE3R, + .name = "pcie3r", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_3, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE3, + .regs = { + .sid = { + .override = 0x6f0, + .security = 0x6f4, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE3W, + .name = "pcie3w", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_3, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE3, + .regs = { + .sid = { + .override = 0x6f8, + .security = 0x6fc, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE4R, + .name = "pcie4r", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_4, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE4, + .regs = { + .sid = { + .override = 0x700, + .security = 0x704, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE4W, + .name = "pcie4w", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_4, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE4, + .regs = { + .sid = { + .override = 0x708, + .security = 0x70c, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE5R, + .name = "pcie5r", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_5, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE5, + .regs = { + .sid = { + .override = 0x710, + .security = 0x714, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE5W, + .name = "pcie5w", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_5, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE5, + .regs = { + .sid = { + .override = 0x718, + .security = 0x71c, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE5R1, + .name = "pcie5r1", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_5, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE5, + .regs = { + .sid = { + .override = 0x778, + .security = 0x77c, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE6AR, + .name = "pcie6ar", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_6, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE6, + .regs = { + .sid = { + .override = 0x140, + .security = 0x144, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE6AW, + .name = "pcie6aw", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_6, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE6, + .regs = { + .sid = { + .override = 0x148, + .security = 0x14c, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE6AR1, + .name = "pcie6ar1", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_6, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE6, + .regs = { + .sid = { + .override = 0x1e8, + .security = 0x1ec, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE7AR, + .name = "pcie7ar", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_7, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE7, + .regs = { + .sid = { + .override = 0x150, + .security = 0x154, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE7AW, + .name = "pcie7aw", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_7, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE7, + .regs = { + .sid = { + .override = 0x180, + .security = 0x184, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE7AR1, + .name = "pcie7ar1", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_7, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE7, + .regs = { + .sid = { + .override = 0x248, + .security = 0x24c, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE8AR, + .name = "pcie8ar", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_8, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE8, + .regs = { + .sid = { + .override = 0x190, + .security = 0x194, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE8AW, + .name = "pcie8aw", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_8, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE8, + .regs = { + .sid = { + .override = 0x1d8, + .security = 0x1dc, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE9AR, + .name = "pcie9ar", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_9, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE9, + .regs = { + .sid = { + .override = 0x1e0, + .security = 0x1e4, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE9AW, + .name = "pcie9aw", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_9, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE9, + .regs = { + .sid = { + .override = 0x1f0, + .security = 0x1f4, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE10AR, + .name = "pcie10ar", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_10, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE10, + .regs = { + .sid = { + .override = 0x1f8, + .security = 0x1fc, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE10AW, + .name = "pcie10aw", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_10, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE10, + .regs = { + .sid = { + .override = 0x200, + .security = 0x204, + }, + }, + }, { + .id = TEGRA234_MEMORY_CLIENT_PCIE10AR1, + .name = "pcie10ar1", + .bpmp_id = TEGRA_ICC_BPMP_PCIE_10, + .type = TEGRA_ICC_NISO, + .sid = TEGRA234_SID_PCIE10, + .regs = { + .sid = { + .override = 0x240, + .security = 0x244, + }, + }, }, }; From patchwork Mon Mar 20 18:24:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 665467 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 807A5C7618E for ; Mon, 20 Mar 2023 18:34:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231401AbjCTSel (ORCPT ); Mon, 20 Mar 2023 14:34:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229902AbjCTSeG (ORCPT ); Mon, 20 Mar 2023 14:34:06 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2060f.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eab::60f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E85054B813; Mon, 20 Mar 2023 11:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k2QcRhiVexnE1FLcjKzdUEuTePMBMNmT452gULI3z4XtP2AvTIAXSrB5L62Ujw6CM8OaJFu0kFPP27VMgHR7R1GErIGbCoX3pmPRucFI5nmvZyfrn2zpUEmG/bMkHp82JiIt+OYNVXF/oqwk+s0Tl+m9TkDhw8eCB16+Eb0AR/quBg8Qb/2ca0XGmDlVtC2dYgVi5gayIplktKsKGuZrQpV7sl0iIRdbAIrrUDB8v1eukc4kW1TI5kRXC1XtU1iDXavH3ske/0G9Mf0a8n4ozmJ+Sm4RBf3RWh1aUjwRroZoce5sfnIp9Pc1p6m2TBgyG7UznVfucjBLjmtVqHnRlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=svHueZvVRekRKinotHkmNyJdtEVj/8ePfaOL6y6CMbA=; b=EttJ4yiZiosAb1MrT9OppaQGBlgV84EKwNwhnrx2L32lRAFR4RpBNsODNvU+z61FWSfsnbr6K+G8+Uruo+8ACv/szC9uo7O/BZEa2NBl/8Qe/skiNjpVWX77ra3csePLmNhx/qos23hk1zdqG1f/0DEToa/hFbpjhbYIyfhJ44w7yon/y7wbPFVtUuwbl3z08BTId8Be58FlnT8/9NBnjLsNfaWJN9Wck4dlajjWr6jqjM+lV0/JpnKUmbjix+GrATlZt7a75WMj+IM1lLzMdb8Wf6JmAhVBliSLSYkb0XmtTGUJ2fsnl7UhCe6oDqMxB4mXokQ+jEdwx5pB61vzAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=google.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=svHueZvVRekRKinotHkmNyJdtEVj/8ePfaOL6y6CMbA=; b=kwZejcQu+UC7cIYypGJlE2TgOHfd1MhkdlXD0yUPLQ3LYxN9J92bcM+oMm/NTySuRcGfD2Otl4c2oEQT1IgxW+4ZL6TKkD8Od+UvbcP1GyJ/jQdA2tf9Qc/suxoaZ+Raz50Sv26F6gXZ8q6f9nqKWvXA7hBN83RaCtYXMbQ9tbiSuonlJsVjAxjZ21nDpuEIoDHIPFPiT4OFR3gu5v1ppJsYAzTgs1JjrCYxL7TZgr5cvyaFJ0iPJaBJymC+1g0TrhbbLZJeZFRKKNuobz9fVyouVD32tlw9BZAsuFutnwDUp3yBYXNdii3NJPGJWXegHKrKxkctP8oljtZquXvfdA== Received: from BN9P223CA0002.NAMP223.PROD.OUTLOOK.COM (2603:10b6:408:10b::7) by MN0PR12MB5785.namprd12.prod.outlook.com (2603:10b6:208:374::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Mon, 20 Mar 2023 18:25:51 +0000 Received: from BN8NAM11FT095.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10b:cafe::35) by BN9P223CA0002.outlook.office365.com (2603:10b6:408:10b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Mon, 20 Mar 2023 18:25:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by BN8NAM11FT095.mail.protection.outlook.com (10.13.176.206) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.15 via Frontend Transport; Mon, 20 Mar 2023 18:25:51 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 20 Mar 2023 11:25:40 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 20 Mar 2023 11:25:39 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.5 via Frontend Transport; Mon, 20 Mar 2023 11:25:34 -0700 From: Sumit Gupta To: , , , , , , , CC: , , , , , , , , , , , , , Subject: [Patch v3 04/11] memory: tegra: add software mc clients in Tegra234 Date: Mon, 20 Mar 2023 23:54:34 +0530 Message-ID: <20230320182441.11904-5-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230320182441.11904-1-sumitg@nvidia.com> References: <20230320182441.11904-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT095:EE_|MN0PR12MB5785:EE_ X-MS-Office365-Filtering-Correlation-Id: df2d9522-fd66-4d8e-c477-08db29708912 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vSsNVKKFw3+q2qxlFhe3sE5zE/YikzcddaEok1MA1EdLFudV/+9FVubW17Z57am1HLNUFM4C1zVWybTS2sUH8HGkAq0VYcF2cL2HAr5bxLiDNQPen7blAcAaq/UPegtJuNVaRcOZCbHbhTezV5OVck3Pf8JW8eKiXSCx3SDCjO6JqC7W0Beh17tBFDqWOerdbsbjAnbmT2APUUN9L6xwTEOPSr3m2RuC9ZO83/tu57kwNG3p07HCwbLzouzqS3yu7tNwNOB8000GgBV7UWHyeAYh4W6Q4QDpQpbljn4aatrGoy/9vgcimXhCTv32YcXC5khVGwDfU922revzv+iUVXATGzqaNXsot4JVLx5ZUaYimEPGz9tw6hzn/HD2qjXxgzcBKnhz4uqi2oDO/6JXjF4lLsSb4nwkq/WsmdpXWidCK+8GQs8thNmlL6uzBJBZLtsIHAtCHarbyklJceHtVNcMKZXA1RSU0G0AeVMrPG5UETBVHbf4tWNqeCHgM2c806HHtWazSTFeRMaYTcrCwdO8vFlvGhTRfDK6yeIhh+EfSyWnVjIbDhoU1xzi1e6bJq9938/KomNVHXiK7WoqAMDqRmA8lSmwMzJo65xy3x605TJBHpsx5txq6siWqcZ29W12upo4P3z3Qe/e8cCYRY7al84X/PQMKSxMfZRHYF3dA9VMQw1Tb3vVEv/wJVuvXUErKYZiXu+Gcpyzdl14F2ZJ2eoGDjL324ayBEm2E9LaeXf4P8qTHCA7B5cuWhG1 X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(39860400002)(396003)(376002)(346002)(136003)(451199018)(36840700001)(46966006)(40470700004)(47076005)(426003)(86362001)(316002)(40480700001)(110136005)(54906003)(36860700001)(8676002)(36756003)(70586007)(7416002)(41300700001)(4326008)(8936002)(5660300002)(70206006)(40460700003)(2906002)(478600001)(7636003)(7696005)(83380400001)(82310400005)(82740400003)(336012)(107886003)(356005)(2616005)(1076003)(26005)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2023 18:25:51.3966 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df2d9522-fd66-4d8e-c477-08db29708912 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT095.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5785 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add dummy Memory Controller clients to represent CPU clusters. They will be used by the CPUFREQ driver to scale DRAM FREQ with the CPU FREQ. Signed-off-by: Sumit Gupta Acked-by: Krzysztof Kozlowski --- drivers/memory/tegra/tegra234.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/memory/tegra/tegra234.c b/drivers/memory/tegra/tegra234.c index 7ca744036f59..0c666e52bf46 100644 --- a/drivers/memory/tegra/tegra234.c +++ b/drivers/memory/tegra/tegra234.c @@ -778,6 +778,21 @@ static const struct tegra_mc_client tegra234_mc_clients[] = { .security = 0x244, }, }, + }, { + .id = TEGRA_ICC_MC_CPU_CLUSTER0, + .name = "sw_cluster0", + .bpmp_id = TEGRA_ICC_BPMP_CPU_CLUSTER0, + .type = TEGRA_ICC_NISO, + }, { + .id = TEGRA_ICC_MC_CPU_CLUSTER1, + .name = "sw_cluster1", + .bpmp_id = TEGRA_ICC_BPMP_CPU_CLUSTER1, + .type = TEGRA_ICC_NISO, + }, { + .id = TEGRA_ICC_MC_CPU_CLUSTER2, + .name = "sw_cluster2", + .bpmp_id = TEGRA_ICC_BPMP_CPU_CLUSTER2, + .type = TEGRA_ICC_NISO, }, }; From patchwork Mon Mar 20 18:24:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 665760 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 914F3C7619A for ; Mon, 20 Mar 2023 18:34:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231309AbjCTSee (ORCPT ); Mon, 20 Mar 2023 14:34:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbjCTSeA (ORCPT ); Mon, 20 Mar 2023 14:34:00 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on20600.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e8a::600]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EF584AFE1; Mon, 20 Mar 2023 11:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g4z5dsAV4hihEw9XHeZw6dbiRf1rXEbCaiJPjvSTh0z92lwimMm8hz22v8Ydwq+mHcA8CGGuZmhWlnx+KAiunUgouJ/RaDwZW8UW7KmgQcmaE2s7x4mLIn0DkfOkuXVpYA9wrbT+BG42jyRYrkxUAk2md0tqyepMzxqMguJKNUHFxTgWoAQjKekDvCSpphXITer8kRKGIhaiuavt4x38lWv51t9JQ5Z9ijDkRlZAqvGEyRMxIE4YnBvdTEuvzD5pzvmyfJ6ZZ8b+4kM9KO3YHpOAnr+f+D0yrockbYzexBVmRGzkOlBPevfXUSxXq6GNfikDin2wXXbH8Ld510Xbsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8EOLSj2IMC6AmgQP+x8WnAbrOd38Fq0L406q4vninRQ=; b=E3NCiZka0h6nArlSQXrsUVlX1NAdeXklFVryBBJRcfZZT04jjYnZQpdWp4aBwVMcySzqF76OSVmq0q9FuOZpeG7/JNcD70xThsz7yhEX9BakyrURE5NnqgRWkVlPqtAFcYs6lNXIgvDmB9X68GsM87j7rZJoHyUD/tZmWZ1vUSqRKGBHpY4Y8QAXdOa8bd4w1Dewll8wjY9RCK1+nug5CqhnZy7sWGcsASGA3abwr1itamLvhSXxGCofvaHd8WdcXo16bhLklJPnPkMMxZW/h8V0sX5pTRtGig/M2cLYvKL+VK29mBOexWk05ORmZxS4cOpsLPXc1etZ56BUF+ihvg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=google.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8EOLSj2IMC6AmgQP+x8WnAbrOd38Fq0L406q4vninRQ=; b=unI0W+bB6n3M9w/WRVbR0P6AOXgcD4eVrXDU4BjUMBXYBwXCLtmzGlyvWUJMCIEqnxcE0uyDLMPZ8ivqtEPVfr7BnsUSqWPAn/zblvxxJFUJsREw4XfIoar5dV/5W+TcVMbBNLCNXhJagFwzwzBH4UudkN5o2fpy9cccb1JGT1p1SQ+yybEV3w9GJcBklj7SIh+tMQ1PpQVB3rjh/o5IhdrIURmkXoUpQUT3rPhCr/DnQvQyCVQvlwq2aHs7uYkttSi8BgNcPnClkMEm2RyMwifEu09durT2issE/RtGb8s69UvHP+8RCBYO2xrjwSIchf4zg103V5TfmlaFuNEHng== Received: from MW4PR03CA0116.namprd03.prod.outlook.com (2603:10b6:303:b7::31) by DM6PR12MB4186.namprd12.prod.outlook.com (2603:10b6:5:21b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Mon, 20 Mar 2023 18:25:47 +0000 Received: from CO1NAM11FT085.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b7:cafe::46) by MW4PR03CA0116.outlook.office365.com (2603:10b6:303:b7::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Mon, 20 Mar 2023 18:25:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CO1NAM11FT085.mail.protection.outlook.com (10.13.174.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.15 via Frontend Transport; Mon, 20 Mar 2023 18:25:47 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 20 Mar 2023 11:25:46 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 20 Mar 2023 11:25:46 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.5 via Frontend Transport; Mon, 20 Mar 2023 11:25:41 -0700 From: Sumit Gupta To: , , , , , , , CC: , , , , , , , , , , , , , Subject: [Patch v3 05/11] dt-bindings: tegra: add icc ids for dummy MC clients Date: Mon, 20 Mar 2023 23:54:35 +0530 Message-ID: <20230320182441.11904-6-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230320182441.11904-1-sumitg@nvidia.com> References: <20230320182441.11904-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT085:EE_|DM6PR12MB4186:EE_ X-MS-Office365-Filtering-Correlation-Id: aad7287b-1ae3-420d-96e8-08db2970869d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TKv3wSuCicyBdvUiFIYQ7a6HEMv1m9wbSHVUQ3SgBDMeD1Th4ywa6CKnuto7SVBC/63hhzJQvoQuoLhvCXNE5hNjmla9fJw6VE/5lZlaCTUezhqdnVqEFAuw7tA6Cd83E2YNm/a0wA4/4iTTZ3qbaWNGq0RJVPK2HZGFONF4biqXThv8Tkozi8PjjZStJW8v1wExa/1UXLVenhLVtii8G/vnay1NvFQPmL3uAUo+UUG7dQn+CNjmsv+TPnQTYgM1WEcSAIf/FCCn2JZWxD+93tNqesRVg/UaTVZFkll466dNQ+YAzNpPgt0ebjuTgMUe1L9BjCMxUt2uKA50tYIEOv14YCwXjku1T87Sr6aMSJSxATrEHA2sikaC40KFA0E6ymdpvgEi5PrPbtLnvUDrE4O71IbXo+pz4vmU0ZNcZQi6nDrwbEO1li9p4GkAV4fUqQvXN9SOmLWIP5VXMuKGCy6Of1Pa6bKWDxfE0cVezvfJ5wtKqr0BjlcSj71KOaWPn/Af8AHk3qQFF/5viiMJmgnVYF+5KsgeVHwml2QDbWRN7PhL8pYa+k6iZpg/KOu2feqgZLkYoiyscK+2iECrA583X98ftMQrFZlBADKw6ShlTEMGVv6q82LpPQ9XTouonPUypgOrE0w1T3BfQUQa09xGMKq4dLhMouLh5tMU+phVv1QdkDnwgN5S5e+pGuLEUhLRRMAtE7ho6XThgdIIIrE57P7nIMLzjvCqj+bu18/F55HpyxKK+/sxyjKka+tJ X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(396003)(376002)(39860400002)(346002)(136003)(451199018)(40470700004)(46966006)(36840700001)(47076005)(2616005)(82310400005)(478600001)(426003)(316002)(54906003)(26005)(186003)(110136005)(6666004)(1076003)(7696005)(7416002)(107886003)(8936002)(356005)(7636003)(40460700003)(336012)(86362001)(36860700001)(2906002)(4744005)(70206006)(70586007)(5660300002)(4326008)(82740400003)(40480700001)(41300700001)(8676002)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2023 18:25:47.3670 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aad7287b-1ae3-420d-96e8-08db2970869d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT085.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4186 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add ICC id's for dummy software clients representing CCPLEX clusters. Signed-off-by: Sumit Gupta Acked-by: Krzysztof Kozlowski --- include/dt-bindings/memory/tegra234-mc.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/dt-bindings/memory/tegra234-mc.h b/include/dt-bindings/memory/tegra234-mc.h index 347e55e89a2a..6e60d55491b3 100644 --- a/include/dt-bindings/memory/tegra234-mc.h +++ b/include/dt-bindings/memory/tegra234-mc.h @@ -536,4 +536,9 @@ #define TEGRA234_MEMORY_CLIENT_NVJPG1SRD 0x123 #define TEGRA234_MEMORY_CLIENT_NVJPG1SWR 0x124 +/* ICC ID's for dummy MC clients used to represent CPU Clusters */ +#define TEGRA_ICC_MC_CPU_CLUSTER0 1003 +#define TEGRA_ICC_MC_CPU_CLUSTER1 1004 +#define TEGRA_ICC_MC_CPU_CLUSTER2 1005 + #endif From patchwork Mon Mar 20 18:24:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 665759 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B689C7618A for ; Mon, 20 Mar 2023 18:35:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230000AbjCTSfJ (ORCPT ); Mon, 20 Mar 2023 14:35:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231478AbjCTSee (ORCPT ); Mon, 20 Mar 2023 14:34:34 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on20604.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eaa::604]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37FAB2E0FF; Mon, 20 Mar 2023 11:26:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IwoQzOubhEHVSidMieDmqnphoRVfhhXhpWz6i/uUj2PuYNGhNkpStrd3nqUlTdtLW/+D6dlCr7ZhC2uk31RFPub7JuzMOfmfRDAn1i26U+0PW5mdXk088OYboiyVErojCAeyQKep3+saCQIktMIVXXh2+y2r5R4R1gCImjOUs1YHzqYcQrmSgKBks+ME4yhkE6hq2VPxSaO1HGG5+/61A/DrihlFs2iXvSYeeE5Qq7yrAK+nI7kjPQk7QMQKhBSUO5h3FfaxDecB1KHJxQrjj1MD3T2MAl32h5bTgivwondneG7G43OcBVE/5M3/SuNYCsPcwh2amnLa3+8KBbPnGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pNCTaro6ewyVWAmKyh/Qk0oQqzhR9dQ1kRZCS8CFNvY=; b=Z0v0XusEuQtcZYNp3TxV7mLwOfWRUS3F7g5hxzIQG2mMaJYTn/612H92D5z4aiGwSUzgaRyIcn1vrFuelyMTtEXKONe3O02wr2YVbRGLvejbqBi7bgJKBlKjXOxDwhi9TLkCDwWsYiAx63V6BFeEewW1qd3qahGLW/buGIT+AE/o309mN8N/cRZh1E+sRLXkbtVsXJF601srm2hg4u2aIPQZj44aR4MGOmEDsvCLfy/A6VdG6ijYfqZlOiJygsUyiwcLrPB1m+ZuqkLNdymWXwPuttTHhI0UaaQSyyCtMYQxUHJ5TmOid+QyGWbv3HXEk0VchF3rKMWP0GN/YFyjbg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=google.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pNCTaro6ewyVWAmKyh/Qk0oQqzhR9dQ1kRZCS8CFNvY=; b=patRxxeQu4JLr8blBdscvmFMn6UMpZNX2uAhzg+w5CPa3xDLh89Pt8Q+Clm+O6IGn80Lli4ESGTNszgH4GLV0s4IPGr6OxIBNZfUQ8YAKPpX1JMDd0f+TB76/Yhmt35FKTwvJLOcavOSO3mQhMyioJtzlhzWXQK+J4YgLCeIepXEib2Aw0aLJlA/dCcVsi5hnfMsZkZzKl3KGcqTKM/KPKTgXuvbiSr6N0Q2MibqEcSyrHA6kWE7PsZgkDJ3c/QGGtsVBm3R0vcy/DYA66itGnh2HljhsfSrxXAFrKCxGngeTdxLMHnb38hvGZf8qYEXugPVKmxfpkySvinYvd3Mrw== Received: from BN9PR03CA0735.namprd03.prod.outlook.com (2603:10b6:408:110::20) by MN2PR12MB4208.namprd12.prod.outlook.com (2603:10b6:208:1d0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Mon, 20 Mar 2023 18:26:07 +0000 Received: from BN8NAM11FT087.eop-nam11.prod.protection.outlook.com (2603:10b6:408:110:cafe::cc) by BN9PR03CA0735.outlook.office365.com (2603:10b6:408:110::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Mon, 20 Mar 2023 18:26:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by BN8NAM11FT087.mail.protection.outlook.com (10.13.177.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.16 via Frontend Transport; Mon, 20 Mar 2023 18:26:06 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 20 Mar 2023 11:25:58 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 20 Mar 2023 11:25:58 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.5 via Frontend Transport; Mon, 20 Mar 2023 11:25:53 -0700 From: Sumit Gupta To: , , , , , , , CC: , , , , , , , , , , , , , Subject: [Patch v3 06/11] arm64: tegra: Add cpu OPP tables and interconnects property Date: Mon, 20 Mar 2023 23:54:36 +0530 Message-ID: <20230320182441.11904-7-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230320182441.11904-1-sumitg@nvidia.com> References: <20230320182441.11904-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT087:EE_|MN2PR12MB4208:EE_ X-MS-Office365-Filtering-Correlation-Id: 8cf87a40-3128-40d5-c742-08db29709255 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HhehNrbaR7qyRdQ1oAiXW0HmJn8CWZVAKutBD9g5iicGCfmK/nxa6qcFLppFYj6EcCPrd2CXa3VEDJ9hWS3Ge7U7bAvLOx6cr94nWg1Ha6qvVyrhQOvXAGqYFWGlVgSUifipQ6DBDmx75DpcyK93dBs90j/1hvh8alKdfarNQggEud9UiXRhWywCU1bEk/6Da/pWPLbb4PnLOCGgkyvOUOVoNWC53g8v4NUnSrKJs8HTdR1p1HoadBmL31CTOyFxgdda/iLtS0aDlbztpv6DozbJfcGu6WhYAwLrfq2rK0v84AN6UJtRUVGFmiDCFyg/Y3U9MoeHXZlHrO84WaZSkRXUooE2KS3lDhoH5dZHq9e1wecUvapfgLEoKG5mOU7xkFjsgj0Rb+v1GqMeBULHJX5lgiTq/dW6MXIuyNEecq/Tl783xN35GDSaRnehLz3LmVR0rpVvz6hXu6J9EOCYb/yFQ5bQNv00vrjHvP/qcEsXPQv9JXWQoojGBaPnKPW3pqB5tB3o+2V9mT1gqFtV2wGrctmzaxTU4mk7Q6DZ8OnNIxJJFZi6HrngM4lD5cLtf/U926DQJshfnWZAgdyAcNgkeF+LinsnxhKSR0+lhnkfuHTPkGwN9NGw4CEnZ3OUqBtRPaqkZDhnbupnF7Fjxo2IS7DcW4q0gmBJiFstEBuVWbPgrKNX+sHgdCDBMwxviaReTVfFEqZ15MdMASOcCi0YN08A6rXb84rPKtOj71+wlzA24mohOgLoL4RfBIH+ X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(396003)(346002)(39860400002)(376002)(136003)(451199018)(46966006)(40470700004)(36840700001)(356005)(2616005)(6666004)(107886003)(336012)(186003)(1076003)(26005)(7696005)(47076005)(426003)(86362001)(2906002)(478600001)(83380400001)(40460700003)(82740400003)(82310400005)(7636003)(8676002)(54906003)(110136005)(40480700001)(316002)(8936002)(4326008)(5660300002)(7416002)(36860700001)(41300700001)(36756003)(70586007)(70206006); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2023 18:26:06.9353 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8cf87a40-3128-40d5-c742-08db29709255 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT087.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4208 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add OPP table and interconnects property to scale DDR frequency with CPU frequency for better performance. Each operating point entry of the OPP table has CPU freq to per MC channel bandwidth mapping. One table is added for each cluster even though the table data is same because the bandwidth request is per cluster. This is done because OPP framework creates a single icc path and hence single bandwidth request if the table is marked as 'opp-shared' and shared among all clusters. For us, the OPP table data is same but the MC Client ID argument to interconnects property is different for each cluster. So, having per cluster table makes different icc path for each cluster and helps to make per cluster BW requests. Signed-off-by: Sumit Gupta --- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 276 +++++++++++++++++++++++ 1 file changed, 276 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi index f1748cff8a33..285fff0bef99 100644 --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi @@ -3013,6 +3013,9 @@ enable-method = "psci"; + operating-points-v2 = <&cl0_opp_tbl>; + interconnects = <&mc TEGRA_ICC_MC_CPU_CLUSTER0 &emc>; + i-cache-size = <65536>; i-cache-line-size = <64>; i-cache-sets = <256>; @@ -3029,6 +3032,9 @@ enable-method = "psci"; + operating-points-v2 = <&cl0_opp_tbl>; + interconnects = <&mc TEGRA_ICC_MC_CPU_CLUSTER0 &emc>; + i-cache-size = <65536>; i-cache-line-size = <64>; i-cache-sets = <256>; @@ -3045,6 +3051,9 @@ enable-method = "psci"; + operating-points-v2 = <&cl0_opp_tbl>; + interconnects = <&mc TEGRA_ICC_MC_CPU_CLUSTER0 &emc>; + i-cache-size = <65536>; i-cache-line-size = <64>; i-cache-sets = <256>; @@ -3061,6 +3070,9 @@ enable-method = "psci"; + operating-points-v2 = <&cl0_opp_tbl>; + interconnects = <&mc TEGRA_ICC_MC_CPU_CLUSTER0 &emc>; + i-cache-size = <65536>; i-cache-line-size = <64>; i-cache-sets = <256>; @@ -3077,6 +3089,9 @@ enable-method = "psci"; + operating-points-v2 = <&cl1_opp_tbl>; + interconnects = <&mc TEGRA_ICC_MC_CPU_CLUSTER1 &emc>; + i-cache-size = <65536>; i-cache-line-size = <64>; i-cache-sets = <256>; @@ -3093,6 +3108,9 @@ enable-method = "psci"; + operating-points-v2 = <&cl1_opp_tbl>; + interconnects = <&mc TEGRA_ICC_MC_CPU_CLUSTER1 &emc>; + i-cache-size = <65536>; i-cache-line-size = <64>; i-cache-sets = <256>; @@ -3109,6 +3127,9 @@ enable-method = "psci"; + operating-points-v2 = <&cl1_opp_tbl>; + interconnects = <&mc TEGRA_ICC_MC_CPU_CLUSTER1 &emc>; + i-cache-size = <65536>; i-cache-line-size = <64>; i-cache-sets = <256>; @@ -3125,6 +3146,9 @@ enable-method = "psci"; + operating-points-v2 = <&cl1_opp_tbl>; + interconnects = <&mc TEGRA_ICC_MC_CPU_CLUSTER1 &emc>; + i-cache-size = <65536>; i-cache-line-size = <64>; i-cache-sets = <256>; @@ -3141,6 +3165,9 @@ enable-method = "psci"; + operating-points-v2 = <&cl2_opp_tbl>; + interconnects = <&mc TEGRA_ICC_MC_CPU_CLUSTER2 &emc>; + i-cache-size = <65536>; i-cache-line-size = <64>; i-cache-sets = <256>; @@ -3157,6 +3184,9 @@ enable-method = "psci"; + operating-points-v2 = <&cl2_opp_tbl>; + interconnects = <&mc TEGRA_ICC_MC_CPU_CLUSTER2 &emc>; + i-cache-size = <65536>; i-cache-line-size = <64>; i-cache-sets = <256>; @@ -3173,6 +3203,9 @@ enable-method = "psci"; + operating-points-v2 = <&cl2_opp_tbl>; + interconnects = <&mc TEGRA_ICC_MC_CPU_CLUSTER2 &emc>; + i-cache-size = <65536>; i-cache-line-size = <64>; i-cache-sets = <256>; @@ -3189,6 +3222,9 @@ enable-method = "psci"; + operating-points-v2 = <&cl2_opp_tbl>; + interconnects = <&mc TEGRA_ICC_MC_CPU_CLUSTER2 &emc>; + i-cache-size = <65536>; i-cache-line-size = <64>; i-cache-sets = <256>; @@ -3445,4 +3481,244 @@ interrupt-parent = <&gic>; always-on; }; + + cl0_opp_tbl: opp-table-cluster0 { + compatible = "operating-points-v2"; + opp-shared; + + cl0_ch1_opp1: opp-115200000 { + opp-hz = /bits/ 64 <115200000>; + opp-peak-kBps = <816000>; + }; + + cl0_ch1_opp2: opp-268800000 { + opp-hz = /bits/ 64 <268800000>; + opp-peak-kBps = <816000>; + }; + + cl0_ch1_opp3: opp-422400000 { + opp-hz = /bits/ 64 <422400000>; + opp-peak-kBps = <816000>; + }; + + cl0_ch1_opp4: opp-576000000 { + opp-hz = /bits/ 64 <576000000>; + opp-peak-kBps = <816000>; + }; + + cl0_ch1_opp5: opp-729600000 { + opp-hz = /bits/ 64 <729600000>; + opp-peak-kBps = <816000>; + }; + + cl0_ch1_opp6: opp-883200000 { + opp-hz = /bits/ 64 <883200000>; + opp-peak-kBps = <816000>; + }; + + cl0_ch1_opp7: opp-1036800000 { + opp-hz = /bits/ 64 <1036800000>; + opp-peak-kBps = <816000>; + }; + + cl0_ch1_opp8: opp-1190400000 { + opp-hz = /bits/ 64 <1190400000>; + opp-peak-kBps = <816000>; + }; + + cl0_ch1_opp9: opp-1344000000 { + opp-hz = /bits/ 64 <1344000000>; + opp-peak-kBps = <1632000>; + }; + + cl0_ch1_opp10: opp-1497600000 { + opp-hz = /bits/ 64 <1497600000>; + opp-peak-kBps = <1632000>; + }; + + cl0_ch1_opp11: opp-1651200000 { + opp-hz = /bits/ 64 <1651200000>; + opp-peak-kBps = <2660000>; + }; + + cl0_ch1_opp12: opp-1804800000 { + opp-hz = /bits/ 64 <1804800000>; + opp-peak-kBps = <2660000>; + }; + + cl0_ch1_opp13: opp-1958400000 { + opp-hz = /bits/ 64 <1958400000>; + opp-peak-kBps = <3200000>; + }; + + cl0_ch1_opp14: opp-2112000000 { + opp-hz = /bits/ 64 <2112000000>; + opp-peak-kBps = <6400000>; + }; + + cl0_ch1_opp15: opp-2201600000 { + opp-hz = /bits/ 64 <2201600000>; + opp-peak-kBps = <6400000>; + }; + }; + + cl1_opp_tbl: opp-table-cluster1 { + compatible = "operating-points-v2"; + opp-shared; + + cl1_ch1_opp1: opp-115200000 { + opp-hz = /bits/ 64 <115200000>; + opp-peak-kBps = <816000>; + }; + + cl1_ch1_opp2: opp-268800000 { + opp-hz = /bits/ 64 <268800000>; + opp-peak-kBps = <816000>; + }; + + cl1_ch1_opp3: opp-422400000 { + opp-hz = /bits/ 64 <422400000>; + opp-peak-kBps = <816000>; + }; + + cl1_ch1_opp4: opp-576000000 { + opp-hz = /bits/ 64 <576000000>; + opp-peak-kBps = <816000>; + }; + + cl1_ch1_opp5: opp-729600000 { + opp-hz = /bits/ 64 <729600000>; + opp-peak-kBps = <816000>; + }; + + cl1_ch1_opp6: opp-883200000 { + opp-hz = /bits/ 64 <883200000>; + opp-peak-kBps = <816000>; + }; + + cl1_ch1_opp7: opp-1036800000 { + opp-hz = /bits/ 64 <1036800000>; + opp-peak-kBps = <816000>; + }; + + cl1_ch1_opp8: opp-1190400000 { + opp-hz = /bits/ 64 <1190400000>; + opp-peak-kBps = <816000>; + }; + + cl1_ch1_opp9: opp-1344000000 { + opp-hz = /bits/ 64 <1344000000>; + opp-peak-kBps = <1632000>; + }; + + cl1_ch1_opp10: opp-1497600000 { + opp-hz = /bits/ 64 <1497600000>; + opp-peak-kBps = <1632000>; + }; + + cl1_ch1_opp11: opp-1651200000 { + opp-hz = /bits/ 64 <1651200000>; + opp-peak-kBps = <2660000>; + }; + + cl1_ch1_opp12: opp-1804800000 { + opp-hz = /bits/ 64 <1804800000>; + opp-peak-kBps = <2660000>; + }; + + cl1_ch1_opp13: opp-1958400000 { + opp-hz = /bits/ 64 <1958400000>; + opp-peak-kBps = <3200000>; + }; + + cl1_ch1_opp14: opp-2112000000 { + opp-hz = /bits/ 64 <2112000000>; + opp-peak-kBps = <6400000>; + }; + + cl1_ch1_opp15: opp-2201600000 { + opp-hz = /bits/ 64 <2201600000>; + opp-peak-kBps = <6400000>; + }; + }; + + cl2_opp_tbl: opp-table-cluster2 { + compatible = "operating-points-v2"; + opp-shared; + + cl2_ch1_opp1: opp-115200000 { + opp-hz = /bits/ 64 <115200000>; + opp-peak-kBps = <816000>; + }; + + cl2_ch1_opp2: opp-268800000 { + opp-hz = /bits/ 64 <268800000>; + opp-peak-kBps = <816000>; + }; + + cl2_ch1_opp3: opp-422400000 { + opp-hz = /bits/ 64 <422400000>; + opp-peak-kBps = <816000>; + }; + + cl2_ch1_opp4: opp-576000000 { + opp-hz = /bits/ 64 <576000000>; + opp-peak-kBps = <816000>; + }; + + cl2_ch1_opp5: opp-729600000 { + opp-hz = /bits/ 64 <729600000>; + opp-peak-kBps = <816000>; + }; + + cl2_ch1_opp6: opp-883200000 { + opp-hz = /bits/ 64 <883200000>; + opp-peak-kBps = <816000>; + }; + + cl2_ch1_opp7: opp-1036800000 { + opp-hz = /bits/ 64 <1036800000>; + opp-peak-kBps = <816000>; + }; + + cl2_ch1_opp8: opp-1190400000 { + opp-hz = /bits/ 64 <1190400000>; + opp-peak-kBps = <816000>; + }; + + cl2_ch1_opp9: opp-1344000000 { + opp-hz = /bits/ 64 <1344000000>; + opp-peak-kBps = <1632000>; + }; + + cl2_ch1_opp10: opp-1497600000 { + opp-hz = /bits/ 64 <1497600000>; + opp-peak-kBps = <1632000>; + }; + + cl2_ch1_opp11: opp-1651200000 { + opp-hz = /bits/ 64 <1651200000>; + opp-peak-kBps = <2660000>; + }; + + cl2_ch1_opp12: opp-1804800000 { + opp-hz = /bits/ 64 <1804800000>; + opp-peak-kBps = <2660000>; + }; + + cl2_ch1_opp13: opp-1958400000 { + opp-hz = /bits/ 64 <1958400000>; + opp-peak-kBps = <3200000>; + }; + + cl2_ch1_opp14: opp-2112000000 { + opp-hz = /bits/ 64 <2112000000>; + opp-peak-kBps = <6400000>; + }; + + cl2_ch1_opp15: opp-2201600000 { + opp-hz = /bits/ 64 <2201600000>; + opp-peak-kBps = <6400000>; + }; + }; }; From patchwork Mon Mar 20 18:24:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 665758 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6BC6C7618A for ; Mon, 20 Mar 2023 18:35:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231494AbjCTSft (ORCPT ); Mon, 20 Mar 2023 14:35:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231637AbjCTSfD (ORCPT ); Mon, 20 Mar 2023 14:35:03 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2075.outbound.protection.outlook.com [40.107.243.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC08232522; Mon, 20 Mar 2023 11:27:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rge3/NP1t8CIHO8CwIJChd87aZxY2dz6J0Q+QiYrAni0PLjKJ7QOmEY6Zhfz0s0rjC+c9dUEYOs2znyInUcAXzWXaWGtjXVB7fypXpaE46kj/jd3KqW8n2OdheE5NLkuHFrNtJTtDHHWvyCj21FHB+jlrxwfBuZWjZZ7A1Qtab6n9UcwJJIvFM3JiUowGOke+k+sMXDl+98udEvrx9TWmXi1M/35ZTGakM8TW2kf6w7lvmAV7c+P1kLM5l9qOjnF/Ij/2x7gKB/onpVG3rh6QqmOk+RsFazUQN2R85uM4JntDMe0nlQ4vzvn8pEmGTFUjzeDTtWSXwSbeAuOTTniTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=J2fJMPg55NcQr4hwmtNTOXQSWXYohXcRkTAzsKOmL70=; b=oB+55MRbVuaAldDF1kwHx4z0r5N+5NQTRPssERIsr6rUK3gr8MlPiF/5qd5GVcFT8btwNFqjY32CcAC5gW6uvKX4uyjClO2keGIgFNpyeyqbGb75T2gTGB+WlWT3zlJv4qwmJX1xZg36555zx338ljWUZpXZW2Ks07MlScWsXOGxkT7ITMBFZaRoKBOK/Hu4BMEAC5UGPY9DBS7HTV7AfkViyOGe0xXMZk4UX76rrFjyJt4PXgYLmj/pBdW6MgybYmKc/GX+WauHu59ltJsrSHZQQhlyYNzV0FgSH503S1IdynH+ngO2dWARgFyAbNSP8f4/ofGRBDVTUptRO9otMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=google.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J2fJMPg55NcQr4hwmtNTOXQSWXYohXcRkTAzsKOmL70=; b=XwPjb9XjG77TTFgFO8INbLPeFQsW/VbYr4Up1Z9R5cTr83DJHpMwvuOsAdHym+Q3kEk783X5WXN+0AJS+vYr1/wuRQnoKMSkRFvr6QfI0xHaGqkoUkj7yq4EiBceUIxVSwOq14s2+wbw7xTAYCeaRSep8AifAUWAlHVqH8Bf4bUSYoRJDfYH5yNDnb8ckZTUNmm0x+j/v4EV5h51kO0cpzIZ1oSZpzB2SyNCbUoVbKd4cm8g2fRhtuTmDplT4JGfYR4CjZcvG779NuiZsRHGlRN04mNkA91OIHZlMlC+Do8ds9x3NKT9r3UxEcp4WawDQAm242vkO1UBpOXphVjiXg== Received: from MW4PR03CA0148.namprd03.prod.outlook.com (2603:10b6:303:8c::33) by DS0PR12MB8368.namprd12.prod.outlook.com (2603:10b6:8:fe::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Mon, 20 Mar 2023 18:26:14 +0000 Received: from CO1NAM11FT010.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8c:cafe::62) by MW4PR03CA0148.outlook.office365.com (2603:10b6:303:8c::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Mon, 20 Mar 2023 18:26:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CO1NAM11FT010.mail.protection.outlook.com (10.13.175.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.15 via Frontend Transport; Mon, 20 Mar 2023 18:26:17 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 20 Mar 2023 11:26:10 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 20 Mar 2023 11:26:10 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.5 via Frontend Transport; Mon, 20 Mar 2023 11:26:05 -0700 From: Sumit Gupta To: , , , , , , , CC: , , , , , , , , , , , , , Subject: [Patch v3 07/11] cpufreq: tegra194: add OPP support and set bandwidth Date: Mon, 20 Mar 2023 23:54:37 +0530 Message-ID: <20230320182441.11904-8-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230320182441.11904-1-sumitg@nvidia.com> References: <20230320182441.11904-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT010:EE_|DS0PR12MB8368:EE_ X-MS-Office365-Filtering-Correlation-Id: a6c0244c-bbbb-4838-1b5a-08db297098c8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PPlD7JWXlKFd0+H6Wj9RlnStq4flCQxPTlpTYWP+1bookvBp2wawvz11YOQ/L3P+IZq+hj/lMNDhVwnmhPjZ6DgciVUeA/gskOitNO4bbMwPX1by4A9zAwmz8NdvgU3Xajday5u61AmFrQQy5SPmao15CY00m2IpsngLcyreo2labmxlCtD9Y5hClzisN4K6wImDlaMdbasIos0M9UDyR+k3J1GkZmAFdMNe3q0JxW6dEP7MwfDnGdvNDTsA7QdmMZLpuunpQ/eb9A3Gs1Ng6rDctno/gVVqYc3oLsUlAUXd3/TlqAsUgUi9bpO7FmTUQAgQABaCzlMG4fHU0rn9wthM+dihgLicEeb1ua2EVBpwCvZEefYjPxWESBaX7G3Edle07nnGYyiCSR6EuSUgKuwjTGiqayTihqjaB//rdUi+vv/dpp9eIcGT1kglKfhXdyoUx5dUoXRo/vKLAWQQGf+keCgJMFOL7fu7dkEK7VaAkGOFXqhigCxDix3Xn4opJUSQgzw6yiBpLfFXQri+zP/+YchXAkswvxcezehz3z+d2JY5PnnyJQHL4RuLwOdtAF9AUMgPjP5zISQnHc+ARAsXsU89ssvnFYx/AkHhk72DJ80SpD6jYftxb7XvKezEFIvy8ofv+RCxJO7DpsQED3cijE5Ga9vriG0eoa47gtBFSNASjcKAm/Iw+poe/hKUXL5B4dsLO8h/OyUS2TX1tSzbKNGs49uR2gqiqHLALAAZVLmW5a5Bjk9jo87FVVvQ X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(136003)(376002)(396003)(39860400002)(346002)(451199018)(46966006)(40470700004)(36840700001)(8936002)(7416002)(5660300002)(41300700001)(36860700001)(356005)(36756003)(82310400005)(40480700001)(86362001)(40460700003)(82740400003)(7636003)(2906002)(426003)(47076005)(4326008)(336012)(107886003)(83380400001)(478600001)(6666004)(2616005)(7696005)(186003)(26005)(1076003)(54906003)(316002)(70206006)(110136005)(8676002)(70586007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2023 18:26:17.8446 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a6c0244c-bbbb-4838-1b5a-08db297098c8 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT010.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8368 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add support to use OPP table from DT in Tegra194 cpufreq driver. Tegra SoC's receive the frequency lookup table (LUT) from BPMP-FW. Cross check the OPP's present in DT against the LUT from BPMP-FW and enable only those DT OPP's which are present in LUT also. The OPP table in DT has CPU Frequency to bandwidth mapping where the bandwidth value is per MC channel. DRAM bandwidth depends on the number of MC channels which can vary as per the boot configuration. This per channel bandwidth from OPP table will be later converted by MC driver to final bandwidth value by multiplying with number of channels before sending the request to BPMP-FW. If OPP table is not present in DT, then use the LUT from BPMP-FW directy as the CPU frequency table and not do the DRAM frequency scaling which is same as the current behavior. Now, as the CPU Frequency table is being controlling through OPP table in DT. Keeping fewer entries in the table will create less frequency steps and can help to scale fast to high frequencies when required. Signed-off-by: Sumit Gupta --- drivers/cpufreq/tegra194-cpufreq.c | 156 ++++++++++++++++++++++++++--- 1 file changed, 143 insertions(+), 13 deletions(-) diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c index 5890e25d7f77..038c67339b01 100644 --- a/drivers/cpufreq/tegra194-cpufreq.c +++ b/drivers/cpufreq/tegra194-cpufreq.c @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -65,12 +66,36 @@ struct tegra_cpufreq_soc { struct tegra194_cpufreq_data { void __iomem *regs; - struct cpufreq_frequency_table **tables; + struct cpufreq_frequency_table **bpmp_luts; const struct tegra_cpufreq_soc *soc; + bool icc_dram_bw_scaling; }; static struct workqueue_struct *read_counters_wq; +static int tegra_cpufreq_set_bw(struct cpufreq_policy *policy, unsigned long freq_khz) +{ + struct tegra194_cpufreq_data *data = cpufreq_get_driver_data(); + struct dev_pm_opp *opp; + struct device *dev; + int ret; + + dev = get_cpu_device(policy->cpu); + if (!dev) + return -ENODEV; + + opp = dev_pm_opp_find_freq_exact(dev, freq_khz * KHZ, true); + if (IS_ERR(opp)) + return PTR_ERR(opp); + + ret = dev_pm_opp_set_opp(dev, opp); + if (ret) + data->icc_dram_bw_scaling = false; + + dev_pm_opp_put(opp); + return ret; +} + static void tegra_get_cpu_mpidr(void *mpidr) { *((u64 *)mpidr) = read_cpuid_mpidr() & MPIDR_HWID_BITMASK; @@ -354,7 +379,7 @@ static unsigned int tegra194_get_speed(u32 cpu) * to the last written ndiv value from freq_table. This is * done to return consistent value. */ - cpufreq_for_each_valid_entry(pos, data->tables[clusterid]) { + cpufreq_for_each_valid_entry(pos, data->bpmp_luts[clusterid]) { if (pos->driver_data != ndiv) continue; @@ -369,16 +394,93 @@ static unsigned int tegra194_get_speed(u32 cpu) return rate; } +int tegra_cpufreq_init_cpufreq_table(struct cpufreq_policy *policy, + struct cpufreq_frequency_table *bpmp_lut, + struct cpufreq_frequency_table **opp_table) +{ + struct tegra194_cpufreq_data *data = cpufreq_get_driver_data(); + struct cpufreq_frequency_table *freq_table = NULL; + struct cpufreq_frequency_table *pos; + struct device *cpu_dev; + struct dev_pm_opp *opp; + unsigned long rate; + int ret, max_opps; + int j = 0; + + cpu_dev = get_cpu_device(policy->cpu); + if (!cpu_dev) { + pr_err("%s: failed to get cpu%d device\n", __func__, policy->cpu); + return -ENODEV; + } + + /* Initialize OPP table mentioned in operating-points-v2 property in DT */ + ret = dev_pm_opp_of_add_table_indexed(cpu_dev, 0); + if (!ret) { + max_opps = dev_pm_opp_get_opp_count(cpu_dev); + if (max_opps <= 0) { + dev_err(cpu_dev, "Failed to add OPPs\n"); + return max_opps; + } + + /* Disable all opps and cross-validate against LUT later */ + for (rate = 0; ; rate++) { + opp = dev_pm_opp_find_freq_ceil(cpu_dev, &rate); + if (IS_ERR(opp)) + break; + + dev_pm_opp_put(opp); + dev_pm_opp_disable(cpu_dev, rate); + } + } else { + dev_err(cpu_dev, "Invalid or empty opp table in device tree\n"); + data->icc_dram_bw_scaling = false; + return ret; + } + + freq_table = kcalloc((max_opps + 1), sizeof(*freq_table), GFP_KERNEL); + if (!freq_table) + return -ENOMEM; + + /* + * Cross check the frequencies from BPMP-FW LUT against the OPP's present in DT. + * Enable only those DT OPP's which are present in LUT also. + */ + cpufreq_for_each_valid_entry(pos, bpmp_lut) { + opp = dev_pm_opp_find_freq_exact(cpu_dev, pos->frequency * KHZ, false); + if (IS_ERR(opp)) + continue; + + ret = dev_pm_opp_enable(cpu_dev, pos->frequency * KHZ); + if (ret < 0) + return ret; + + freq_table[j].driver_data = pos->driver_data; + freq_table[j].frequency = pos->frequency; + j++; + } + + freq_table[j].driver_data = pos->driver_data; + freq_table[j].frequency = CPUFREQ_TABLE_END; + + *opp_table = &freq_table[0]; + + dev_pm_opp_set_sharing_cpus(cpu_dev, policy->cpus); + + return ret; +} + static int tegra194_cpufreq_init(struct cpufreq_policy *policy) { struct tegra194_cpufreq_data *data = cpufreq_get_driver_data(); int maxcpus_per_cluster = data->soc->maxcpus_per_cluster; + struct cpufreq_frequency_table *freq_table; + struct cpufreq_frequency_table *bpmp_lut; u32 start_cpu, cpu; u32 clusterid; + int ret; data->soc->ops->get_cpu_cluster_id(policy->cpu, NULL, &clusterid); - - if (clusterid >= data->soc->num_clusters || !data->tables[clusterid]) + if (clusterid >= data->soc->num_clusters || !data->bpmp_luts[clusterid]) return -EINVAL; start_cpu = rounddown(policy->cpu, maxcpus_per_cluster); @@ -387,9 +489,22 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy) if (cpu_possible(cpu)) cpumask_set_cpu(cpu, policy->cpus); } - policy->freq_table = data->tables[clusterid]; policy->cpuinfo.transition_latency = TEGRA_CPUFREQ_TRANSITION_LATENCY; + bpmp_lut = data->bpmp_luts[clusterid]; + + if (data->icc_dram_bw_scaling) { + ret = tegra_cpufreq_init_cpufreq_table(policy, bpmp_lut, &freq_table); + if (!ret) { + policy->freq_table = freq_table; + return 0; + } + } + + data->icc_dram_bw_scaling = false; + policy->freq_table = bpmp_lut; + pr_info("OPP tables missing from DT, EMC frequency scaling disabled\n"); + return 0; } @@ -406,6 +521,9 @@ static int tegra194_cpufreq_set_target(struct cpufreq_policy *policy, */ data->soc->ops->set_cpu_ndiv(policy, (u64)tbl->driver_data); + if (data->icc_dram_bw_scaling) + tegra_cpufreq_set_bw(policy, tbl->frequency); + return 0; } @@ -439,8 +557,8 @@ static void tegra194_cpufreq_free_resources(void) } static struct cpufreq_frequency_table * -init_freq_table(struct platform_device *pdev, struct tegra_bpmp *bpmp, - unsigned int cluster_id) +tegra_cpufreq_bpmp_read_lut(struct platform_device *pdev, struct tegra_bpmp *bpmp, + unsigned int cluster_id) { struct cpufreq_frequency_table *freq_table; struct mrq_cpu_ndiv_limits_response resp; @@ -515,6 +633,7 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev) const struct tegra_cpufreq_soc *soc; struct tegra194_cpufreq_data *data; struct tegra_bpmp *bpmp; + struct device *cpu_dev; int err, i; data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); @@ -530,9 +649,9 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev) return -EINVAL; } - data->tables = devm_kcalloc(&pdev->dev, data->soc->num_clusters, - sizeof(*data->tables), GFP_KERNEL); - if (!data->tables) + data->bpmp_luts = devm_kcalloc(&pdev->dev, data->soc->num_clusters, + sizeof(*data->bpmp_luts), GFP_KERNEL); + if (!data->bpmp_luts) return -ENOMEM; if (soc->actmon_cntr_base) { @@ -556,15 +675,26 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev) } for (i = 0; i < data->soc->num_clusters; i++) { - data->tables[i] = init_freq_table(pdev, bpmp, i); - if (IS_ERR(data->tables[i])) { - err = PTR_ERR(data->tables[i]); + data->bpmp_luts[i] = tegra_cpufreq_bpmp_read_lut(pdev, bpmp, i); + if (IS_ERR(data->bpmp_luts[i])) { + err = PTR_ERR(data->bpmp_luts[i]); goto err_free_res; } } tegra194_cpufreq_driver.driver_data = data; + /* Check for optional OPPv2 and interconnect paths on CPU0 to enable ICC scaling */ + cpu_dev = get_cpu_device(0); + if (!cpu_dev) + return -EPROBE_DEFER; + + if (dev_pm_opp_of_get_opp_desc_node(cpu_dev)) { + err = dev_pm_opp_of_find_icc_paths(cpu_dev, NULL); + if (!err) + data->icc_dram_bw_scaling = true; + } + err = cpufreq_register_driver(&tegra194_cpufreq_driver); if (!err) goto put_bpmp; From patchwork Mon Mar 20 18:24:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 665466 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73AF5C7618E for ; Mon, 20 Mar 2023 18:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231452AbjCTSfq (ORCPT ); Mon, 20 Mar 2023 14:35:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231631AbjCTSfD (ORCPT ); Mon, 20 Mar 2023 14:35:03 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on20606.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5a::606]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FC663598; Mon, 20 Mar 2023 11:27:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dPN9yd6hOnaPRTajKmTctjnxg10X+xxtmCFg+O3M8hoMpSOPS7Vhr32TbDoxbP8bqCT2pd6eHEI5YJ7EKQGt2sxr2x711TO19Lz9xxNsXsYwIQSa7ao/iltD1bkH8NBLrAsiJ9GUymH7W6CencuhFvKBu37vBC2Q3drtO+fQt8jhfz8LOa16yQwxGGLL6kwT7Gw0dPXURB3DelIHJTf+ReIyArv7G6Y9CYeJShgKSXczBbWM2cbs+y0ZgIVVjW5WwGV6J43sP+5C4cPeo0s9OONN5LVEQ7aVdQX0rFx2/eeRnNj7yxyrJs5CiKG/NBGNaiWoM9HLAWqfP/A1RUSJLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oVRwgFgeJYSRsGwUZ2XIMEM87v9qQMGzP1nTzHvrqW4=; b=HbrZfUVrPG4e9H391ggnRiosA0hjaXGdDT1qSlK0mnbofkey1NHHQWo6T4YC+yz/msND4Xnpfx9kX4kqT/HGcXrdO07qpKiJYpLB8GVip4skg+bAbq/pXqivZKYBWWgjJbaAtj2oTTW6GCxuMlWsLts6ixic1dUYmS6AaYJ+ifllZ5EQuEoaBAWuYR2EUwd1Zi+YbCOIw+GJ2VJ84iNp6uAZDDhIAWBkyI8G62eLi+y9OXuvKNCaQF/cmNMucoQPeSvTsuBMKfqyWzYnIzmHi8D3HzefgkrnZi9wKtDErAHwkCJNC1Z+6TpEtK9lQbNOhNKxOnUt7sI4QVUCJVRXjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=google.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oVRwgFgeJYSRsGwUZ2XIMEM87v9qQMGzP1nTzHvrqW4=; b=r5hWqjepssJwnDPok+6zZ4Ykp9z7s0Xyn4soUqFahCe6fllfO/2VCD0Y6BdsOYCx9oLTSAtw5A7q3vOi4srFbDkcfauZUU+wnadwEncnjuU1SnlMTO4DFR/e24wb5C9MO/L1GK9xrisGsKultjz0jZh6TdQ/89fTMKcKC+PIVGwPxGrkt4JI0RnS1vQrpoBTHC/C/Y8LQCsU34r4w9tB/ePBhGrFo3Pt5CzzwL7J7Fs+uN0CzEhrDLW8ciGeGJB+EKSB+t331DoPqs8tzjsOzKHji5oOU+3hMQlb/w3kd4781yhTUBGmncZwnhvfybWyHwYQ6GYFeJvMzIUDAvI72g== Received: from BN0PR04CA0125.namprd04.prod.outlook.com (2603:10b6:408:ed::10) by BL1PR12MB5112.namprd12.prod.outlook.com (2603:10b6:208:316::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Mon, 20 Mar 2023 18:26:41 +0000 Received: from BN8NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ed:cafe::9e) by BN0PR04CA0125.outlook.office365.com (2603:10b6:408:ed::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Mon, 20 Mar 2023 18:26:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by BN8NAM11FT023.mail.protection.outlook.com (10.13.177.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.16 via Frontend Transport; Mon, 20 Mar 2023 18:26:40 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 20 Mar 2023 11:26:33 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 20 Mar 2023 11:26:32 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.5 via Frontend Transport; Mon, 20 Mar 2023 11:26:27 -0700 From: Sumit Gupta To: , , , , , , , CC: , , , , , , , , , , , , , Subject: [Patch v3 08/11] memory: tegra: make cpu cluster bw request a multiple of mc channels Date: Mon, 20 Mar 2023 23:54:38 +0530 Message-ID: <20230320182441.11904-9-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230320182441.11904-1-sumitg@nvidia.com> References: <20230320182441.11904-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT023:EE_|BL1PR12MB5112:EE_ X-MS-Office365-Filtering-Correlation-Id: 43e773a7-e4d4-4335-74c0-08db2970a694 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yGeIDYM1rQW51KCOI1zNHcUqclzU1MzRxaJTuoIC5lhfpRFWEx+MwJe8naDfL/ND0MrW4mkjtvLjIyOb8+sErNoXR/NjA32lTKP0ZkfmU61uvhROTjiEP40vr340LV1D6zpx1cT/X37ZvD8dnA3JNQBhFkbVA5hZUJtgeFUeaeRTCxnl9UH9DG+cj5QOmfEtIxeiz3NcUk5kWhU7yv3SFSFBm3NPXlk2CNBNMst+12N7UlDksy9z/JPsX4CvRqaAnqEty49IHgs2FplfjO8qJ17aezrY4lxEZFSFSWDKvNGpOjMaMYng5JGqy2bye2udr5LDG0hULktrL8dXFh/GQrNeTsEnVdyoy0oT5KdsvrtRsWzUY2yQBo5uJj5bNftQG4lmNSxbZYjquib/xeVxyxPfuAcgCX5/1rn0vCsbP0PoHGciEl2SoPPX4Gw5aQq1i1wlMsBXVPDpvt/b9TP1fPpp7YHgKOapy+sOKesqNtQNIu45OPGnGXxPtAadoNy/l7nNPThTJvOVe6IeuHst0uK2Gl6AaZaPNgn1yckHdDD4Cl/uZzBnv5qEAawwfJ5q1AjCFW8HbRXvZIEWzVS+k213AMEcsWHqT14VEVMVvoFR9A9dxYxuzh5TPYTWSqgRby2ONzxCBfnS5c6mUuU5GWR9NPOlqE5vUpoCpJ+CketpF2AHUDUWtmkIBlXXX9K8823CMrX95YEWlowbKrFCkUWV5RszhRpWMY0WBqsb/c8BnPKHVZmSdkU7osIFKf4h X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(39860400002)(396003)(346002)(376002)(136003)(451199018)(36840700001)(40470700004)(46966006)(47076005)(426003)(2616005)(83380400001)(82310400005)(54906003)(6666004)(107886003)(1076003)(478600001)(316002)(5660300002)(186003)(26005)(7416002)(7696005)(7636003)(110136005)(36860700001)(40460700003)(356005)(86362001)(336012)(82740400003)(8936002)(2906002)(41300700001)(40480700001)(70586007)(70206006)(4326008)(8676002)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2023 18:26:40.8849 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43e773a7-e4d4-4335-74c0-08db2970a694 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5112 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Make CPU cluster's bandwidth (BW) request a multiple of MC channels. CPU OPP tables have BW info per MC channel. But, the actual BW depends on the number of MC channels which can change as per the boot config. Get the number of MC channels which are actually enabled in current boot configuration and multiply the BW request from a CPU cluster with the number of enabled MC channels. This is not required to be done for other MC clients. Signed-off-by: Sumit Gupta Acked-by: Krzysztof Kozlowski --- drivers/memory/tegra/mc.c | 19 +++++++++++++++++++ drivers/memory/tegra/mc.h | 1 + drivers/memory/tegra/tegra234.c | 21 ++++++++++++++++++++- include/soc/tegra/mc.h | 1 + 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c index bbd27d754fef..77346125dea6 100644 --- a/drivers/memory/tegra/mc.c +++ b/drivers/memory/tegra/mc.c @@ -843,6 +843,23 @@ static int tegra_mc_interconnect_setup(struct tegra_mc *mc) return err; } +static void tegra_mc_num_channel_enabled(struct tegra_mc *mc) +{ + unsigned int i; + u32 value; + + value = mc_ch_readl(mc, 0, MC_EMEM_ADR_CFG_CHANNEL_ENABLE); + if (value <= 0) { + mc->num_channels = mc->soc->num_channels; + return; + } + + for (i = 0; i < 32; i++) { + if (value & BIT(i)) + mc->num_channels++; + } +} + static int tegra_mc_probe(struct platform_device *pdev) { struct tegra_mc *mc; @@ -881,6 +898,8 @@ static int tegra_mc_probe(struct platform_device *pdev) return err; } + tegra_mc_num_channel_enabled(mc); + if (mc->soc->ops && mc->soc->ops->handle_irq) { mc->irq = platform_get_irq(pdev, 0); if (mc->irq < 0) diff --git a/drivers/memory/tegra/mc.h b/drivers/memory/tegra/mc.h index bc01586b6560..c3f6655bec60 100644 --- a/drivers/memory/tegra/mc.h +++ b/drivers/memory/tegra/mc.h @@ -53,6 +53,7 @@ #define MC_ERR_ROUTE_SANITY_ADR 0x9c4 #define MC_ERR_GENERALIZED_CARVEOUT_STATUS 0xc00 #define MC_ERR_GENERALIZED_CARVEOUT_ADR 0xc04 +#define MC_EMEM_ADR_CFG_CHANNEL_ENABLE 0xdf8 #define MC_GLOBAL_INTSTATUS 0xf24 #define MC_ERR_ADR_HI 0x11fc diff --git a/drivers/memory/tegra/tegra234.c b/drivers/memory/tegra/tegra234.c index 0c666e52bf46..0b608b820b28 100644 --- a/drivers/memory/tegra/tegra234.c +++ b/drivers/memory/tegra/tegra234.c @@ -868,6 +868,25 @@ static int tegra234_mc_icc_set(struct icc_node *src, struct icc_node *dst) return ret; } +static int tegra234_mc_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, + u32 peak_bw, u32 *agg_avg, u32 *agg_peak) +{ + struct icc_provider *p = node->provider; + struct tegra_mc *mc = icc_provider_to_tegra_mc(p); + + if (node->id == TEGRA_ICC_MC_CPU_CLUSTER0 || + node->id == TEGRA_ICC_MC_CPU_CLUSTER1 || + node->id == TEGRA_ICC_MC_CPU_CLUSTER2) { + if (mc) + peak_bw = peak_bw * mc->num_channels; + } + + *agg_avg += avg_bw; + *agg_peak = max(*agg_peak, peak_bw); + + return 0; +} + static struct icc_node* tegra234_mc_of_icc_xlate(struct of_phandle_args *spec, void *data) { @@ -899,7 +918,7 @@ static int tegra234_mc_icc_get_init_bw(struct icc_node *node, u32 *avg, u32 *pea static const struct tegra_mc_icc_ops tegra234_mc_icc_ops = { .xlate = tegra234_mc_of_icc_xlate, - .aggregate = icc_std_aggregate, + .aggregate = tegra234_mc_icc_aggregate, .get_bw = tegra234_mc_icc_get_init_bw, .set = tegra234_mc_icc_set, }; diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h index fefac9622987..2fe6f0217a39 100644 --- a/include/soc/tegra/mc.h +++ b/include/soc/tegra/mc.h @@ -233,6 +233,7 @@ struct tegra_mc { struct tegra_mc_timing *timings; unsigned int num_timings; + unsigned int num_channels; struct reset_controller_dev reset; From patchwork Mon Mar 20 18:24:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 665757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20EF3C7618E for ; Mon, 20 Mar 2023 18:36:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231502AbjCTSg2 (ORCPT ); Mon, 20 Mar 2023 14:36:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230162AbjCTSgE (ORCPT ); Mon, 20 Mar 2023 14:36:04 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2044.outbound.protection.outlook.com [40.107.96.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A86F237F38; Mon, 20 Mar 2023 11:28:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EmiMnZ1/j8sdZnP921Gslt+cGB4GQ8OgE7CgeW1jsCDA8SxkJ+H3DL6OGQs2Gi4dCGnhbQy5yvDeuAh9QSkRtqhaQQC+TeAKzFmL+Lm0cOHJXOAKtW9zoU9NiR3m0NG0VCspz4lLZdPPcGculkNnJQbmWAkxulFI9aoxiYzUe6lGCnssjAAL/NC04+Vd4MZavTEr5Sq6yHI7zNhyeUqeJjNwqgF773e4P3tFJ9jwJ4eB9Cw5HE9RnF8I3U3A2DgWmm6Id8Wzs/vOWJrnozliyqKKG80V3QEfx19K6JkT4zAQ4PSY8O+cY/HE48ANmG3OgEz3u03QLkougNsFxWkYWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Zl/Zq3udnXoPPmPhp/uzEpbABsNB15gy+KqjcHFYdzA=; b=WHfnWkNKP2P1xHHx+LBsR9cVMo20I05SQwoFO2cosF/8W5hBD8/qAk2JODoyM3TLwRbB2A3DYDpCoo32RIaJNAihkUCWW79jRk67SFoJaB+yCbRrANDT8erku+ijlXC4Bl/qcQWSzHHssz5AVagILGBJGbs6icjiPTf3RM6+u3OhqaExNSglTrvJP2M3WOvWbv4VPaByNdT25BrHFQShp9mJZK6Tu5Hal28QGyzZatXjBDqsNTfEpyLxDxeYTpqdsFVPRajjjtDUlhFuHV+7K3BfyAe+A8iOckaRy/yUjNqqVOYkDWGxb3jO9tyO/ELdS6JDW3b2Lv/uGDTRIKe37g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=google.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Zl/Zq3udnXoPPmPhp/uzEpbABsNB15gy+KqjcHFYdzA=; b=hSE1ku6SK16qx42p6Y12lkhLqqwxMnvBsDY+eo39Y9/GrPikgPcFGdl5cC4oF3h3LBkwM6vYdTqz4F7Cm54Xm6SHs2tBRyKZB2EVWpfrHopRhxsGvxz+r35i05eGjv76nakyoxmxmpruX4bPdQpU/qjf8SRTmZlF7+bQfFPwDV96qLz34zgOZ0LFuAukgpz91ZEOHR5hdSygEcry4jwJvScKOxOT0e2Vx/e9CIPLh5yDQK9dXgdyjK1YuBaGzck5Z7WSqVyKig90dOvo2xpf+G4yzm2G47ExGIZEHBa4iuP4YMRYNdKZJ1ZgEbbdRmHHK3KVrWhmsC/YknfYCgAn0Q== Received: from MW4PR03CA0112.namprd03.prod.outlook.com (2603:10b6:303:b7::27) by DM4PR12MB6012.namprd12.prod.outlook.com (2603:10b6:8:6c::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.33; Mon, 20 Mar 2023 18:26:55 +0000 Received: from CO1NAM11FT085.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b7:cafe::24) by MW4PR03CA0112.outlook.office365.com (2603:10b6:303:b7::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Mon, 20 Mar 2023 18:26:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CO1NAM11FT085.mail.protection.outlook.com (10.13.174.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.15 via Frontend Transport; Mon, 20 Mar 2023 18:26:54 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 20 Mar 2023 11:26:44 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 20 Mar 2023 11:26:43 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.5 via Frontend Transport; Mon, 20 Mar 2023 11:26:38 -0700 From: Sumit Gupta To: , , , , , , , CC: , , , , , , , , , , , , , Subject: [Patch v3 09/11] PCI: tegra194: add interconnect support in Tegra234 Date: Mon, 20 Mar 2023 23:54:39 +0530 Message-ID: <20230320182441.11904-10-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230320182441.11904-1-sumitg@nvidia.com> References: <20230320182441.11904-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT085:EE_|DM4PR12MB6012:EE_ X-MS-Office365-Filtering-Correlation-Id: ae155388-fa7c-457b-8371-08db2970aedf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VMnkquGLqRaEEgbELFAsbTF8R0NuQrvFQrEB9fBQiGZsNpiCQZTspmRH1+PWFFXlASfgM5yimOjvLTMn+EZ93BayQr0S6gnngVDh7Gm2wfuuToXwbBNyi6RGM7a+KpwQ8DrCYVMz/OaPN/+A8IkrBq8C9MxkFCJt2IVeIpU/veZpFItmXf30tJKGqsFKBjbH/RqH9oz/DNutSLmPw4ep8k7hxnPbfOC9j3sGFEjlvmSsJkA6RQBR2hxKHOVK8YfZNYBvinLyqOHoz3vHn0cI36fMjBckAxq8vxTTFn17dAHMZve/mcDc1qpMiokIjUh+hFywWoHHvlYg9os+rWUg1lKb0q7xpQnD/XlgN9jM9jVsjF1Q+xyajdTBJnxtZ61PA/52ueCK24OiQELhwXLVMjNaRKM2ptXk/u1USuXwFQ9XNrMwp7eBqeT//qMqpi7UwOg+qWo2jZzRmdu9WSgjpt/AaMIKBUWdwJqEeOSI3dC7OBgCcv7SkpJ0l8A3nz8LrqzS+XIeUFGhM2FkVA3ZyeDGlwXj91/pQZ+uheh3DHntFdS3YExj5eQZQaoaR8yEC62gjuMjEbcHFDdKk71TYTzgxuwBsMg7/fuW+cBhF2DCC6jpgK/eJZ++pf5fQvcMnCM7pCc1LzyLiuWyMUKKwup1IAwk1HoE+SkhASGNREKwbZ352OPu7V5Lnvd+8czxaQuGABCOORPx0WnU3J74VpAaObBNpcG5xM1JV6sCtQoYQm1GsoOr4M3b7rJ3Clf/ X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(396003)(136003)(376002)(39860400002)(346002)(451199018)(36840700001)(46966006)(40470700004)(8936002)(5660300002)(7416002)(41300700001)(83380400001)(40460700003)(36860700001)(1076003)(40480700001)(82740400003)(86362001)(36756003)(82310400005)(356005)(7636003)(2906002)(110136005)(54906003)(7696005)(316002)(2616005)(107886003)(478600001)(26005)(426003)(186003)(70206006)(70586007)(8676002)(336012)(4326008)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2023 18:26:54.9079 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ae155388-fa7c-457b-8371-08db2970aedf X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT085.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6012 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add support to request DRAM bandwidth with Memory Interconnect in Tegra234 SoC. The DRAM BW required for different modes depends on speed (Gen-1/2/3/4) and width/lanes (x1/x2/x4/x8). Suggested-by: Manikanta Maddireddy Signed-off-by: Sumit Gupta --- drivers/pci/controller/dwc/pcie-tegra194.c | 40 +++++++++++++++++----- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c index 09825b4a075e..d2513c9d3feb 100644 --- a/drivers/pci/controller/dwc/pcie-tegra194.c +++ b/drivers/pci/controller/dwc/pcie-tegra194.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -287,6 +288,7 @@ struct tegra_pcie_dw { unsigned int pex_rst_irq; int ep_state; long link_status; + struct icc_path *icc_path; }; static inline struct tegra_pcie_dw *to_tegra_pcie(struct dw_pcie *pci) @@ -309,6 +311,24 @@ struct tegra_pcie_soc { enum dw_pcie_device_mode mode; }; +static void tegra_pcie_icc_set(struct tegra_pcie_dw *pcie) +{ + struct dw_pcie *pci = &pcie->pci; + u32 val, speed, width; + + val = dw_pcie_readw_dbi(pci, pcie->pcie_cap_base + PCI_EXP_LNKSTA); + + speed = FIELD_GET(PCI_EXP_LNKSTA_CLS, val); + width = FIELD_GET(PCI_EXP_LNKSTA_NLW, val); + + val = width * (PCIE_SPEED2MBS_ENC(pcie_link_speed[speed]) / BITS_PER_BYTE); + + if (icc_set_bw(pcie->icc_path, MBps_to_icc(val), 0)) + dev_err(pcie->dev, "can't set bw[%u]\n", val); + + clk_set_rate(pcie->core_clk, pcie_gen_freq[speed - 1]); +} + static void apply_bad_link_workaround(struct dw_pcie_rp *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); @@ -452,14 +472,12 @@ static irqreturn_t tegra_pcie_ep_irq_thread(int irq, void *arg) struct tegra_pcie_dw *pcie = arg; struct dw_pcie_ep *ep = &pcie->pci.ep; struct dw_pcie *pci = &pcie->pci; - u32 val, speed; + u32 val; if (test_and_clear_bit(0, &pcie->link_status)) dw_pcie_ep_linkup(ep); - speed = dw_pcie_readw_dbi(pci, pcie->pcie_cap_base + PCI_EXP_LNKSTA) & - PCI_EXP_LNKSTA_CLS; - clk_set_rate(pcie->core_clk, pcie_gen_freq[speed - 1]); + tegra_pcie_icc_set(pcie); if (pcie->of_data->has_ltr_req_fix) return IRQ_HANDLED; @@ -945,9 +963,9 @@ static int tegra_pcie_dw_host_init(struct dw_pcie_rp *pp) static int tegra_pcie_dw_start_link(struct dw_pcie *pci) { - u32 val, offset, speed, tmp; struct tegra_pcie_dw *pcie = to_tegra_pcie(pci); struct dw_pcie_rp *pp = &pci->pp; + u32 val, offset, tmp; bool retry = true; if (pcie->of_data->mode == DW_PCIE_EP_TYPE) { @@ -1018,9 +1036,7 @@ static int tegra_pcie_dw_start_link(struct dw_pcie *pci) goto retry_link; } - speed = dw_pcie_readw_dbi(pci, pcie->pcie_cap_base + PCI_EXP_LNKSTA) & - PCI_EXP_LNKSTA_CLS; - clk_set_rate(pcie->core_clk, pcie_gen_freq[speed - 1]); + tegra_pcie_icc_set(pcie); tegra_pcie_enable_interrupts(pp); @@ -2224,6 +2240,14 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pcie); + pcie->icc_path = devm_of_icc_get(&pdev->dev, "write"); + ret = PTR_ERR_OR_ZERO(pcie->icc_path); + if (ret) { + tegra_bpmp_put(pcie->bpmp); + dev_err_probe(&pdev->dev, ret, "failed to get write interconnect\n"); + return ret; + } + switch (pcie->of_data->mode) { case DW_PCIE_RC_TYPE: ret = devm_request_irq(dev, pp->irq, tegra_pcie_rp_irq_handler, From patchwork Mon Mar 20 18:24:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 665465 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7396AC7618E for ; Mon, 20 Mar 2023 18:36:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231206AbjCTSgJ (ORCPT ); Mon, 20 Mar 2023 14:36:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbjCTSfd (ORCPT ); Mon, 20 Mar 2023 14:35:33 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on20626.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e89::626]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE5F22B289; Mon, 20 Mar 2023 11:27:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vv9GNvJoV6EB1HgrKSPt9ZMScD3qk6c9UD4HWgBvhUBae39hl1+IfZcwAz1zJUZysGzKFXMoin/GVZ7m7HeA2RfJeT6swd1gYRXCA1LvBRefTB+81XACxJ3o82Psk6v5mLaqgeEUBwEh4HYcUGxZL3tDaZ/j8u6QjYnw/CGz9EYZldujTK1uqNW0RDBIjbuVJJghyc2O/faDC7TxrKNlUA6jiWqC+KlWUPk67hxvZ8QmozYoaGvBg09matXmvyg6ENDDYV8mvOdJZz00POQQTOMV4U2bVa7+ULb7KjRMIWgqf8VSSfK751bWKKyXBhE8vZexIaorsv5IQXPzxNw/kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sexpUMgz4sNbKdwfL02pMAnMxx9Kiyp9FsqW9Yav37U=; b=LDrBnmOmTEKYWqt3ZD4zgKokieNxxZxzk3QCb0bKvdcLSFsq68VwUhzEs1dbKKYnkWGnWarEF78EJU1h3F/qWz0adr25E9jCC1isBPK0xis2aM2vHbFZs4hZDeyQFin+DujO5F+a+aDwureDjkmAh27dpavoO0rjlK+LeTp2FzVFiJtY0XoY6sXNm36CkXhAMdJBPrx/QkSmm3ZFYbvHQAFcTEOE6On4uoN0yBTPXRIpGasnMQGLmbxDtjOhfr6y+YvyooptgcNCGTFOOGTKwz69Qiq/+BKOq9Nma//zoq5XoxG+E/sNgXji7GVgiN976uUeSlV5GRfOB/cMWBHsvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=google.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sexpUMgz4sNbKdwfL02pMAnMxx9Kiyp9FsqW9Yav37U=; b=kfvzuOcjziQS8VcfWxBfk61n/jbyjTF3NZv18AAAOjhd6w0XBcPHGTra1l/vS4zoPJ1suMF+hIPXFgiD39kwukT5nOr1f5zEMR4Q6oU5wdEvTt2s2VDegO4rqZ9sUlUoPE++/ka6KycLGdK1NgVseKTEPWZvPVZTFFaFPWHDH+dtw9KBSTwn/llfzLWvRPrLkL5EZBmVIyo34GeT04sWtE8Bs38ifVDf27njPJGj2BXtYvYTsT2kHXaMjGGiH0ypQ6HbwwLSABFOrY+dcWLxJBJwbzOIHUOnaodCzvYN0cX8vWECtJGVsLoTkXvrzb7hppsz1qWhTn+VE/mqc8F1nA== Received: from MW2PR2101CA0034.namprd21.prod.outlook.com (2603:10b6:302:1::47) by PH7PR12MB6979.namprd12.prod.outlook.com (2603:10b6:510:1b9::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Mon, 20 Mar 2023 18:27:09 +0000 Received: from CO1NAM11FT092.eop-nam11.prod.protection.outlook.com (2603:10b6:302:1:cafe::35) by MW2PR2101CA0034.outlook.office365.com (2603:10b6:302:1::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.2 via Frontend Transport; Mon, 20 Mar 2023 18:27:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CO1NAM11FT092.mail.protection.outlook.com (10.13.175.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.15 via Frontend Transport; Mon, 20 Mar 2023 18:27:08 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 20 Mar 2023 11:27:06 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 20 Mar 2023 11:27:05 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.5 via Frontend Transport; Mon, 20 Mar 2023 11:27:00 -0700 From: Sumit Gupta To: , , , , , , , CC: , , , , , , , , , , , , , Subject: [Patch v3 10/11] memory: tegra: handle no BWMGR MRQ support in BPMP Date: Mon, 20 Mar 2023 23:54:40 +0530 Message-ID: <20230320182441.11904-11-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230320182441.11904-1-sumitg@nvidia.com> References: <20230320182441.11904-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT092:EE_|PH7PR12MB6979:EE_ X-MS-Office365-Filtering-Correlation-Id: e37ed870-55d1-4b49-0101-08db2970b734 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TGVh/eEkwcplQ6rrca+wJPLiQJqOq79itVnSbaCsfek5ue/y9AvyVsFyDdBGKWpwNzTOCVCa1BDgg1+P5dY8kLGiLEusxepA+9ydT84VYtggjYd2F8myRX8RrLW0onctwxQ3HP1hocbjV72Xiqu9LtbqZ555Bs9NiHGDLtkTxBvXgMlBmke0N0mV8e+lxnsTvl1Vk7fTZ7fSUiRSe321GMdwg0kV3aewugxxFpw3Wyw8hB8hUkNp9smtzSbE7N+I+oCjkShhPfWfyRSB8DEL7TN1i/BCMP1cHJmdA8n6pnGTxYAR2AzA+pHXBNuQfKAJEeRdMOatGZbqvM/tf2WKB1FxSK/qqCBVzDhaHUrIvXvMXDXS3nzC0a+K82Q74KG4H0ZxzWqsd30Rzj4kQFFQ4L8rlAKn3GFfK5CR8yUJUMR1WTNMYiOXXLpPCNrHfdIW6PIUARq8jBBY/vyPGE/I5XPSpa+P5yQHGmJiicUTBlRiI3gDjW3/OjdU5LtXSPd/ljcP4tqS9V1rmfSOWczCdxrY6GdP6GQMWkJaRdr/KHtFOB/nrLXKZfRmdRL2c/dwc1cISnP03Pl21ey6ldtncxYrKh20L/LT4uxl4JID0Zarm/Xhtc4n0qKMoJO+5Mqcp6hkiOG43apLBA4r7uj7KockhQvl42YfdvaAvFRQpXfJBB3/tLClUfcynzZuoDJXwmmXficu14bUORZa2/x6gW2OPhayOS2ARUBSBxhUo7L6ZgGcyu77CS1XsirFnObj X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(346002)(376002)(396003)(136003)(39860400002)(451199018)(36840700001)(40470700004)(46966006)(2616005)(478600001)(7696005)(47076005)(426003)(107886003)(336012)(83380400001)(6666004)(316002)(8676002)(70206006)(70586007)(186003)(26005)(1076003)(54906003)(110136005)(4326008)(5660300002)(36860700001)(41300700001)(7416002)(8936002)(40460700003)(82740400003)(7636003)(2906002)(356005)(40480700001)(82310400005)(36756003)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2023 18:27:08.8834 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e37ed870-55d1-4b49-0101-08db2970b734 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT092.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6979 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org If BPMP-FW doesn't support 'MRQ_BWMGR_INT', then the MC Client driver probe fails with 'EPROBE_DEFER' which it receives on calling the func 'devm_of_icc_get()'. Fix this by initializing the ICC even if the MRQ is missing and return 'EINVAL' from 'icc_set_bw()' instead of passing the request to BPMP-FW later when the BW request is made by client. Fixes: ("memory: tegra: add interconnect support for DRAM scaling in Tegra234") Signed-off-by: Sumit Gupta --- drivers/memory/tegra/tegra186-emc.c | 13 +++++++------ drivers/memory/tegra/tegra234.c | 6 ++++++ include/soc/tegra/mc.h | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/memory/tegra/tegra186-emc.c b/drivers/memory/tegra/tegra186-emc.c index 978be8f54de4..0d68a20fd376 100644 --- a/drivers/memory/tegra/tegra186-emc.c +++ b/drivers/memory/tegra/tegra186-emc.c @@ -343,13 +343,14 @@ static int tegra186_emc_probe(struct platform_device *pdev) mc = dev_get_drvdata(emc->dev->parent); if (mc && mc->soc->icc_ops) { - if (tegra_bpmp_mrq_is_supported(emc->bpmp, MRQ_BWMGR_INT)) { - err = tegra_emc_interconnect_init(emc); - if (err) - goto put_bpmp; - } else { + err = tegra_emc_interconnect_init(emc); + if (err) + goto put_bpmp; + + if (tegra_bpmp_mrq_is_supported(emc->bpmp, MRQ_BWMGR_INT)) + mc->bwmgr_mrq_supported = true; + else dev_info(&pdev->dev, "MRQ_BWMGR_INT not present\n"); - } } return 0; diff --git a/drivers/memory/tegra/tegra234.c b/drivers/memory/tegra/tegra234.c index 0b608b820b28..5b4b359f7c71 100644 --- a/drivers/memory/tegra/tegra234.c +++ b/drivers/memory/tegra/tegra234.c @@ -828,6 +828,9 @@ static int tegra234_mc_icc_set(struct icc_node *src, struct icc_node *dst) if (src->id == dst->id) return 0; + if (!mc->bwmgr_mrq_supported) + return -EINVAL; + bpmp = of_tegra_bpmp_get(); if (IS_ERR(bpmp)) { ret = PTR_ERR(bpmp); @@ -874,6 +877,9 @@ static int tegra234_mc_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, struct icc_provider *p = node->provider; struct tegra_mc *mc = icc_provider_to_tegra_mc(p); + if (!mc->bwmgr_mrq_supported) + return -EINVAL; + if (node->id == TEGRA_ICC_MC_CPU_CLUSTER0 || node->id == TEGRA_ICC_MC_CPU_CLUSTER1 || node->id == TEGRA_ICC_MC_CPU_CLUSTER2) { diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h index 2fe6f0217a39..522b7679500c 100644 --- a/include/soc/tegra/mc.h +++ b/include/soc/tegra/mc.h @@ -234,7 +234,7 @@ struct tegra_mc { struct tegra_mc_timing *timings; unsigned int num_timings; unsigned int num_channels; - + bool bwmgr_mrq_supported; struct reset_controller_dev reset; struct icc_provider provider; From patchwork Mon Mar 20 18:24:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 665464 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3197C7618A for ; Mon, 20 Mar 2023 18:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231440AbjCTSgp (ORCPT ); Mon, 20 Mar 2023 14:36:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231520AbjCTSgL (ORCPT ); Mon, 20 Mar 2023 14:36:11 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2077.outbound.protection.outlook.com [40.107.220.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 794543645E; Mon, 20 Mar 2023 11:28:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NzcHhSw2AC7XlQFbRoLQ5pRPSOSS9kNcraKWLzOkbznLtyexSSd3DaX05Fo2muquLrpRqL2sOE2JdUJlGC4ue4m523dIzuplXVlLrgUqDDj9pUbYWoNwtSJ/K9M6d6+SMx5DBWLid3kN12vV76l/tgFdRYobhxaORpq3F20U3wd53f4vGCzG7CO583rtSbK8qhQUquxopIaRJZRx4gUhpJC50B00D4Fu7uP3g0ep1Ar+C7pRb5PeSl+W9G8k+ChzfH35LuI/Gr+sblaXAIO9/tVyrY9huhDWZ1RuLCqgMgVLTfHMeHALQLFEfEIIe2LQq9oJbpmYZyi0GwNyJsM9yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mFknPj1juTW4yd0nvS8kgtV28YxgIZKG3ZTe30gnatA=; b=Fx/jYw861a3R7WJw7IjuIphwq+I0mPbq916iSmzOREwrYVTOWNsC8vqc02wte5gMzBiTLWoNpooIsdyPxR4cmfUAUa8r8lSyYDi2sIqQQpEKnwn8Pn+uFRCF6p6E3Rf8+lsaVkvcIdWTKAkZZ1S/NDBxm79Wsl+E5FyueSKGI01jqp0ny41JvBmLeV8SESn/35GWBcDZukU6r1Z72wrrHgGgglDqIMrFYiF1bHdyA5H8uAU+OWh1tvMkESnDcYz8Kgmb+uy2+R4Q69fDT65Te1JpFkpQWS1QD2JardE8wHVJ7v3h0w24eO7DZYkBjVfDdTaSozUYcJ2jaQ+fK0nliw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=google.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mFknPj1juTW4yd0nvS8kgtV28YxgIZKG3ZTe30gnatA=; b=HwZyWxMScnuOA9LGZMiebr04sPtYeSrR7SGYrZvdxtbzT1hDfrXhyGV8IHphlWd2EtQR4XkcZ0hl+JNLlBWWIrg+givrnQ32iQaE1JqGiD2Ju6smQbHfRvc+p7FHaH8Sl4cmkO4i3Sn1mr9Hl2/vewb1BYLuv7dMI8Cl7DfzmzNMS1OVALMbVh4SDngEzkXLmeWgU8efi68dHzpAEgIMfOxNfzA52EwfQ35Lt3OLOjNbDyNz6TrGWEwpQT2do6odRxqfUBBF8xl+UYcxpNFItcnSu5w4yGHIUwtJFC13KRBek4kiCcsDBZDRLBeHEjODEBLLfMF0V3aslc+ExBvRrA== Received: from MW4PR04CA0059.namprd04.prod.outlook.com (2603:10b6:303:6a::34) by PH0PR12MB8125.namprd12.prod.outlook.com (2603:10b6:510:293::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Mon, 20 Mar 2023 18:27:22 +0000 Received: from CO1NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:303:6a:cafe::db) by MW4PR04CA0059.outlook.office365.com (2603:10b6:303:6a::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Mon, 20 Mar 2023 18:27:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CO1NAM11FT056.mail.protection.outlook.com (10.13.175.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.16 via Frontend Transport; Mon, 20 Mar 2023 18:27:21 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 20 Mar 2023 11:27:13 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 20 Mar 2023 11:27:12 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.5 via Frontend Transport; Mon, 20 Mar 2023 11:27:07 -0700 From: Sumit Gupta To: , , , , , , , CC: , , , , , , , , , , , , , Subject: [Patch v3 11/11] memory: tegra186-emc: fix interconnect registration race Date: Mon, 20 Mar 2023 23:54:41 +0530 Message-ID: <20230320182441.11904-12-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230320182441.11904-1-sumitg@nvidia.com> References: <20230320182441.11904-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT056:EE_|PH0PR12MB8125:EE_ X-MS-Office365-Filtering-Correlation-Id: 6a67cb8c-72c5-40e4-4494-08db2970bf00 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aNmrClQK7SYCKuVaxl43iEGAVzMwtJQJ40SWsRwk0AejLb9CXlJYZkyeiGxQdXHlcv1DGSj14ZNvWFa0EWeKmGT1Ev9pkSkBsCZ0niASgWU7zY4W1t3s4JB3IIJESzRMVsnNZsIws+ieq0UU0WlKgjLgtrUsfWg8jRQlJbkWWoxbtQkmp0BkDiCAyjgpOWpY3wALa+7rrJH/+9WE7OIjsx57dczG95Mt+P8t45mGgz4JHz0u1BsPNigZmwOMIxmEBP2wXZEKPv/VRl10Xvbm2ZN9b1ukALb00RfmkHZomj5PbmbtLFIA9EwIQB5OxAvTJFuBN0tGtO+ca8QmOn8DEeGjY4uN2vXQDOkxNuiGV8V4EJOUDz4rZMX0OHLlNbY3WMIPM+sxoLFpRCIOwVlKbADSP9InlIJgjSEJ16zjFn4VMiFMW0GkBfqXfMGZgHFGrK+WGRdsVmS60xpwwKMYjuIG+LUzcIqO+RRDY3a/2yBinR579I4nEhazids32lg9QC4l/83NWVLw3CgptF+EXAfD+2nLD6+rDsb1jXmcYcJUq5V+cT6RVOiMyZhVmomOLvmACoigImTyZR0YAWdt49kX0z4IlcpJKKu8OcdbmKGkEMtrDkXAUfM8JAHuvyCJEsBv7P6iPcVluWpcReL52B7rUGZeLr2Nv1EbvjrVtoxb+4MpxBm2bbKqiWGzsaBwzqqU+bgdSlEDXKlXffbB95ta9bHLbzYmBChdPyIcyankjxLw396pGdePDA4t7/pC X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(376002)(39860400002)(396003)(136003)(346002)(451199018)(40470700004)(36840700001)(46966006)(41300700001)(40480700001)(4326008)(8676002)(70586007)(70206006)(82740400003)(36756003)(7636003)(2906002)(36860700001)(40460700003)(8936002)(5660300002)(26005)(1076003)(7416002)(82310400005)(336012)(107886003)(6666004)(47076005)(7696005)(356005)(186003)(2616005)(426003)(86362001)(83380400001)(316002)(478600001)(110136005)(54906003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2023 18:27:21.9349 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a67cb8c-72c5-40e4-4494-08db2970bf00 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8125 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The current interconnect provider registration interface is inherently racy as nodes are not added until the after adding the provider. This can specifically cause racing DT lookups to fail. Switch to using the new API where the provider is not registered until after it has been fully initialised. Fixes: ("memory: tegra: add interconnect support for DRAM scaling in Tegra234") Signed-off-by: Sumit Gupta --- drivers/memory/tegra/tegra186-emc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/memory/tegra/tegra186-emc.c b/drivers/memory/tegra/tegra186-emc.c index 0d68a20fd376..a5a2bce01db4 100644 --- a/drivers/memory/tegra/tegra186-emc.c +++ b/drivers/memory/tegra/tegra186-emc.c @@ -207,15 +207,13 @@ static int tegra_emc_interconnect_init(struct tegra186_emc *emc) emc->provider.xlate = tegra_emc_of_icc_xlate; emc->provider.get_bw = tegra_emc_icc_get_init_bw; - err = icc_provider_add(&emc->provider); - if (err) - goto err_msg; + icc_provider_init(&emc->provider); /* create External Memory Controller node */ node = icc_node_create(TEGRA_ICC_EMC); if (IS_ERR(node)) { err = PTR_ERR(node); - goto del_provider; + goto err_msg; } node->name = "External Memory Controller"; @@ -236,11 +234,13 @@ static int tegra_emc_interconnect_init(struct tegra186_emc *emc) node->name = "External Memory (DRAM)"; icc_node_add(node, &emc->provider); + err = icc_provider_register(&emc->provider); + if (err) + goto remove_nodes; + return 0; remove_nodes: icc_nodes_remove(&emc->provider); -del_provider: - icc_provider_del(&emc->provider); err_msg: dev_err(emc->dev, "failed to initialize ICC: %d\n", err);