From patchwork Tue Dec 10 17:45:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johnny Liu X-Patchwork-Id: 849597 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2049.outbound.protection.outlook.com [40.107.94.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44AAA23ED5F; Tue, 10 Dec 2024 17:46:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733852779; cv=fail; b=EM8zT5hNfie6mSmNKegAK6yGRwUdwqEqszbKOQWcihuRb45f6ZlCEbC0Ppg2UwdDDqdUTWy9bGzLtuvN8YatpDs4Yvhry/bU+qIP864pVpHnhM23l5gbFBw8SzPu0ZCvE7CTrGRzmfld9dU/1KpEO+rEo2h8OsVVW0I+ctn2rr8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733852779; c=relaxed/simple; bh=D7jZMKlwr6UGiAyelYH4rp816Fs/7Pnl/KFU2+Yb9Fs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Lv/l9KXelTC4UPAelYnEDILxPruvL5XtaRBczl+mGLA1CbAe/Nvk/rBQEVgUtW4wv4cbPY2hK6llS+GIBWti5t4GpKM/HJyzjD1mWMnbHHLqGq3Jzq/adk/+sqxZG3qW86vTo1r4S4ercv9Kj0lhmHrFhKYV2oqfEbxkMPb2LfU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=IRHAbj5l; arc=fail smtp.client-ip=40.107.94.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="IRHAbj5l" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nHHJ8D+KZu/fuTRLFH01Fii+9nPZWojaKxt59El4lD/ZINbUyQj82s3xRMXOriNaIuDH4izRwbO13pYduJorjUfYwwWL8WozekzI6eF0KPxTGyMxbeINepCvML2r0XL7462q+LNpVlrSa6eGO8YHx8D7YQAY+A0LTjZ/5cH8tK7y0luNfUpWS1auOQKQAU1OOu1rK9CpXwqSptoizEZFZ17A+zCFVGijlCumdIeumd16+1dJ4LWGhuEt0jBEAwyM14Ibg+sEFyxDgqMcrkYhvs0fwm/7ZjoVeQRRDPhXIZbmAb2+KYhMUqSapmYbgE6SYQVw2pDUhocaRtuC80+vLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=DIHpgc503MwlsXlWBMNYsvDAJnlykYQzOYEUtHQHp/4=; b=vC8iLPzGRBjyg/tr+6/cjKOCiowAWEvpOPw0O6v7KRBi8q6SgWYMHpwpDygWwpG5Gr5oNdeuoYIyWUqGQkm171Js1G9IPJbE+iU2M19q7sObWweHjNI8l99hCK3qMekdhH6YTmugyo9eGTqZy/MCMpOrr5fDNDpxTQ2/FwFnFvUdabkuPjuQWe95tSKPfRFkGzlSi/eibZ6AZOsZIh1JGMm6x9PJsIYvvQ24a5KB6aSn9xpDnFBbz0/XCEYoHowt8IridHV5juqLiXqcM4W7u+l9E7yKnQnbGHTLMaXfLO4VqrlRWo2zFZujMQGJ7SmvcTqTed+02SHWmy+pPgCFzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=gmail.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 (0) 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=DIHpgc503MwlsXlWBMNYsvDAJnlykYQzOYEUtHQHp/4=; b=IRHAbj5lgdyT87s67AUGBvah7pbbY07TwEbwYFTj4IdoCsvDYxuxyo1nV7GlQrCcYpWEgZfO5X4ZkFThUYpGcQ/dBARkOqTcYmRKEjX3ij2O5/J+zlhz3Bj1KS+zqeVVshDAGKLQw4vfIa2m7J39WqSFzWJxDtM5bIyxdj3uWvqaqFAl53JJv4ZKFLISdoRHVhxmzNk52CxbpL9VAtLfHIq35k+7l87gFlUnjf1r49wQKU3cJlFpHPWgJsLaVWx7H/U84zKBZGpfId7BE1YT9j42aWIDQptYpOLhMWdBzHr3coHS25oIh2elqIgsDLIG4nWGWaIOPinUCuRk/8mdRw== Received: from SN7P220CA0029.NAMP220.PROD.OUTLOOK.COM (2603:10b6:806:123::34) by CH2PR12MB4309.namprd12.prod.outlook.com (2603:10b6:610:a4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.14; Tue, 10 Dec 2024 17:46:13 +0000 Received: from SA2PEPF00001508.namprd04.prod.outlook.com (2603:10b6:806:123:cafe::83) by SN7P220CA0029.outlook.office365.com (2603:10b6:806:123::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.18 via Frontend Transport; Tue, 10 Dec 2024 17:46:12 +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 SA2PEPF00001508.mail.protection.outlook.com (10.167.242.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Tue, 10 Dec 2024 17:46:12 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) 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.1544.4; Tue, 10 Dec 2024 09:45:57 -0800 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 10 Dec 2024 09:45:57 -0800 Received: from thinkpad-t480.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Tue, 10 Dec 2024 09:45:56 -0800 From: Johnny Liu To: , , , , , , , , , , , , CC: , , , , , Johnny Liu Subject: [PATCH v1 1/5] dt-bindings: display: tegra: Add actmon information Date: Tue, 10 Dec 2024 09:45:50 -0800 Message-ID: <20241210174554.18869-2-johnliu@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241210174554.18869-1-johnliu@nvidia.com> References: <20241210174554.18869-1-johnliu@nvidia.com> X-NVConfidentiality: public Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001508:EE_|CH2PR12MB4309:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b4cb8b2-85cb-469c-c05e-08dd194289f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|82310400026|7416014|1800799024|376014|921020; X-Microsoft-Antispam-Message-Info: SguUD1MUf5DL2o1ckSkhVeErXnHj22RZ0RfjLNVf26n16/+6//B4Zg8P+uNbnklLtuPy5+W2SgpPl5jIoyRpOw/7VNTeO2ywg5Zh9GD8vW7x6uEaefgHkV7BjxL2iXpR40hhieIla7RXVU79AhIXe/p8h0qxdu/mYAWp8J/5t4F3Lu3d9VcHwlXSTA1w7M9xIWDIbnbqYXbkiA7e/Qo/JiVwK/OYyXMn++r0F26IkC7SYR+0naeWtHCGqqRoWxnBiTpnH1hYbg+z+pXF9JJ9kngcGTUG8T3IfyRiKStYvmQIqatQhbhUVUVyIMa9USl1vIMtUg2As+ZQH9VMDy4266oTmA2uWe6TfU+nNEnN2LBnfdBYPmNSsl3inHOWkUUnptzo7uk/1TXu2QsU1vfMfCHyjDST6q+2/zEbGkpzGYfIxo96i8+yJYPok/rtzaGiib75aL7E9Ez5x8NHC1ZSn/HetU8Bh2p0wGNc5I6N8V9QlVNH9MibiVywKjsj5OZVvqmYNFDSJfSVwnCBfCXjUVUGz/qX/Kzgu0Txq0yZjrBDtjkRMz11T0/OV9R0KQHWc3aNaYWBswJe0xQZH9HGGm2Sy4wOQYkeY8jOTUZlz/ID1NdKD9Rjg+6s2Muk5To+YkyVns9WHr8IDJ9C28mBQvPFiLW0QD8OPeoaOS2LyncaR5ihjrj2xNyNL0K92Xkl8Z7aNYWu7Xn98lxyuOrBZQHCRH43Vp9rO2n1yxhTOSPKgXfDchqZucLFub6dLjm1uRbACGDQb+VSEifCdv4islLtnIKPl7O4gkcfpgkkDa4q0JhYw4JBDmKE2bpFF0h6+B7lLKmtXUctwHHoqCuX/GyFX/URfyTVlFJJzqZXlOpULLLHRlvmvzB6CPplpIJnAmY5+z+kUGIWG6vckQgPYDsw+03yjPwW3q4Jh1UX1uLqbJW45G+3p7IOmpEqMqMUWxmxcWWfCjQ497rSTlf5GvszejI6znTm96u/wtguFQzrwspdH8tbkEb+8+MT86LHkyEn8XRKCUzIGnuKxt7zEatHo+VaNhkegA5gDhOIEHEyC9RIS/wqlI2plmwcCE/UfYmoeXQaLAGnpwBkllW/UTPTdXML3IAYD6N5e0iOBhqRIRr8AD3m4BgJSvu9wZsvh1Fv5VACsDuVMogPRJwo/6hsdOQqNOyJQQB5gmTz4XEutb7u8gvFw3H6BlgSljOEtgknXhEYo4tZZlsic7vUaL1YtNZ1E/oEjauzwNWZ6rDQl3l/mcONK9dKhM55n6B0dHyP22/MR3WN3cicLfB02UDeWfUTUXmXYj6NGoH3pEy5XwLyk/970fIaM3PDod2b17Qpf9yZdxNeeHYzOp8/rwQIvNRwREN92Ht4EibmEZ+MkU3N/jVYxjuGX8JQiGEg0fcsezS/q9i5x5fOC3qmZg/nnU+tlZAFY41K6zQpSxW7vuzc2KNUYYsrCumM83CJwcdozftxkrp96ah/GD9Okw== 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:(13230040)(36860700013)(82310400026)(7416014)(1800799024)(376014)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2024 17:46:12.7930 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b4cb8b2-85cb-469c-c05e-08dd194289f1 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: SA2PEPF00001508.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4309 An activity monitor (actmon) is used to measure the device runtime utilization to help drive software power management policies. Extend the reg space to include actmon aperture for actmon configuration through host1x. Extend the number of clocks to include actmon clock, which is shared between unit actmons for different host1x clients. Signed-off-by: Johnny Liu --- .../display/tegra/nvidia,tegra20-host1x.yaml | 45 ++++++++++++++++--- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.yaml b/Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.yaml index 3563378a01af4..46e1d27ddef8b 100644 --- a/Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.yaml +++ b/Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.yaml @@ -32,11 +32,11 @@ properties: reg: minItems: 1 - maxItems: 3 + maxItems: 4 reg-names: minItems: 1 - maxItems: 3 + maxItems: 4 interrupts: minItems: 1 @@ -60,12 +60,12 @@ properties: maxItems: 1 clocks: - description: Must contain one entry, for the module clock. See - ../clocks/clock-bindings.txt for details. + minItems: 1 + maxItems: 2 clock-names: - items: - - const: host1x + minItems: 1 + maxItems: 2 resets: minItems: 1 # MC reset is optional on Tegra186 and later @@ -132,6 +132,15 @@ allOf: items: - const: syncpt - const: host1x + + clocks: + items: + - description: host1x clock + + clock-names: + items: + - const: host1x + required: - resets - reset-names @@ -170,6 +179,14 @@ allOf: - const: syncpt - const: host1x + clocks: + items: + - description: host1x clock + + clock-names: + items: + - const: host1x + iommu-map: description: Specification of stream IDs available for memory context device use. Should be a mapping of IDs 0..n to IOMMU entries corresponding to @@ -195,16 +212,20 @@ allOf: then: properties: reg-names: + minItems: 3 items: - const: common - const: hypervisor - const: vm + - const: actmon reg: + minItems: 3 items: - description: region used by host1x server - description: region used by the hypervisor - description: region assigned to the virtual machine + - description: region used for configuring actmon for host1x clients interrupts: items: @@ -230,6 +251,18 @@ allOf: - const: syncpt7 - const: host1x + clocks: + minItems: 1 + items: + - description: host1x clock + - description: actmon clock + + clock-names: + minItems: 1 + items: + - const: host1x + - const: actmon + iommu-map: description: Specification of stream IDs available for memory context device use. Should be a mapping of IDs 0..n to IOMMU entries corresponding to From patchwork Tue Dec 10 17:45:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johnny Liu X-Patchwork-Id: 849596 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B69631F2385; Tue, 10 Dec 2024 17:46:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733852782; cv=fail; b=PAtvHxrm5YTW42wec3a/WQfc2DPOrOPoaVt7mhOgrPxkH+MTqdT7DSnp9P0qqMso/cdAOGde4jw2ALLx7gyefJetdsvgFsai3R9rbf2iQFR5Qs8iEiStteMvH3uR/cyETN8WXzSXUdo621z0Lyy7iTg19kznVWxvhdzDs4zhphM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733852782; c=relaxed/simple; bh=X9LNmv2qHjIw8zli3pxVjux1bnPMVxkyCwSL0Oh+X0w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aYjbyiQ6vQPwUErVjBhIryC27NdAZdS8SPkzJv/4dXfkCR4ZIXNR0GeCos/IFLmGX93HlxUrHIi94YcPiLkdlqb64+yUu0WhozLcmFhw2/MVIMKME8pWryxcfcHFieyMkBK88JQm8d//3slVXaOppYPo3mEx+8apPQCF1KEFefA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=N/5d2JMY; arc=fail smtp.client-ip=40.107.236.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="N/5d2JMY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VsMCYIuIk3FejPmfrlvq8C9OYsVCwgCeSk4hSfiPL8DxMGoEaaZ+eUwww2Yp9BcBxbzbabvWwS8uQ8uRct/Z6IIKr+EXzOpQr/dFeoEjBIy3cUXv3n+sVMZQD62NPtXOMLqOVLeLxjVQeIsvbbVM2Ed1csZ8RbLKY7oUQElvSrAwdGzWpLTsU5AD6muHykKjrrqYTZifpPPMjhXGhnp9ZSomzkpR4bXcR5CFOezvwhrFJvWwsYoBDXzpxCpjDTLAjxvgV6n9S2R2ATAERttVIg6VzlKOJqZZfHyIIuoUQTB0wvL7EevGtQZ83hqqPjCyd4hDW3gdzpcSc4BMOxc4/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=i1Zpx32ZpJHlEx2zxr8ljF0cJYu/fUivypFZUIlSJ7Q=; b=m808g15L9limCYVMjauOTpbS8cB2R86tlVrHHhH5f4eGWxqnIj5DD7eb4Rtf6oNSqVlRN88+4Oy83nPi1axealIJ1NwnoivforXnEs0Zh0eOObj5JSGStlqjOQB3a5tH03yNCe7K+T9CgXroxsTS0cH48JrkqGLRQ5VMuVy5QBig6z438P72Cdmx2RlzFgeW4PB/3H/8S6pQUP59mturkgkFoAfw38wl9smwC7FovdtHS2aTSkDIdTTW2A/34K0DIVLGuX0YSj0th0XRjoSL4NckcoINheQ0bcBbDQOJraudf2fD60nXzYEEK+2GmzFqnaQ+pBuzPmZ+hVDU9IBqUQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=gmail.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 (0) 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=i1Zpx32ZpJHlEx2zxr8ljF0cJYu/fUivypFZUIlSJ7Q=; b=N/5d2JMYvNExuFiJSkBzjgnIdAK7EWlEt8jNNUkiaRBABb/tJ81pz1lnWPRSlh3UtFs8NpCAdFw7FbJwYFBhgr7eVHaVi5CBwF/5KMSnFwBSXGENN27rOH2lXwd+eSrqpN1ITJZ5uBubqTIRqezjQ2R0BdxEC4CwjToMjdNZHdrfeeOnLykirENs7BSr71FY4S3k8an2AlQbo9HtYRiGefL5mloicOxoR7fzMs/ZaweBQZtasqSPG2iz11grnhscXVyXeggPkMM0jzgLGA1UTRIHjc9ZGhZ6BObaBXsNL8LZUnXvhmPlStNmVf8fETOv8f8GQKuqkfZn3+azF/yiYQ== Received: from BN9PR03CA0976.namprd03.prod.outlook.com (2603:10b6:408:109::21) by CH2PR12MB9494.namprd12.prod.outlook.com (2603:10b6:610:27f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.15; Tue, 10 Dec 2024 17:46:16 +0000 Received: from MN1PEPF0000ECD5.namprd02.prod.outlook.com (2603:10b6:408:109:cafe::87) by BN9PR03CA0976.outlook.office365.com (2603:10b6:408:109::21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.13 via Frontend Transport; Tue, 10 Dec 2024 17:46:16 +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 MN1PEPF0000ECD5.mail.protection.outlook.com (10.167.242.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.15 via Frontend Transport; Tue, 10 Dec 2024 17:46:16 +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.1544.4; Tue, 10 Dec 2024 09:45:58 -0800 Received: from drhqmail203.nvidia.com (10.126.190.182) 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.1544.4; Tue, 10 Dec 2024 09:45:58 -0800 Received: from thinkpad-t480.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Tue, 10 Dec 2024 09:45:57 -0800 From: Johnny Liu To: , , , , , , , , , , , , CC: , , , , , Johnny Liu Subject: [PATCH v1 2/5] arm64: tegra: Add actmon information Date: Tue, 10 Dec 2024 09:45:51 -0800 Message-ID: <20241210174554.18869-3-johnliu@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241210174554.18869-1-johnliu@nvidia.com> References: <20241210174554.18869-1-johnliu@nvidia.com> X-NVConfidentiality: public Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD5:EE_|CH2PR12MB9494:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b2bf168-be13-4cef-b6e2-08dd19428c21 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|1800799024|376014|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: n3JyMH1mvnXEl27H8rSIi0CF3VcaWE6GauCrnuP0zR0zfKwcW8txMMUKfMRmhvntyO3NdXaO6SNa48FRXgPi/jWhZvOiPLk+zPy6YhIIeGurvOWvPqxMgh5SLf96aX9b4Wg1aLbc9IstXDl2mpN9ObdH3arxwSC8//tyrHYvxivDmXZkZYVPN8juQcsx1J0D7LevcoQ40j9pxbrURjqtQZDvx0mHTRDsfkKXohIIXV40tCj+KiSLSGzMLGpAjTsNAJH/1XSe8vLU6uMVfkX5fRVzL3tIbvssezTakJkTYWLDjYIgwVp0aB17ou84nzjectdtDQM/6uT0dm5LnWZu2aHN8vscqHU89bd6dTGR0Glv9WXn4hyYfsetvo4NnkG4mpw6wTVopeotJJzhu+x2ltDfm6n1xyyWkK3kHdqUrn28XQed+SJ2JtjeO/VohH7pPD8H9KZ16AaB28O2K3wlhgA2cFopHs0M3Kz2B0go0eagziMF80w+c+0UFou8/BjsVdRxKKwrQ1WHLZ0Fq7rIttn6YOSLnYtOZ6V7+HKptHF1cl+bd7csfFEOzPNDhVa1+J83A7c6p6ibtrLxhtjZo2YeJZmkHsS7bpaRf1OQFKpybbYszFSOUnyeMx6f1GSI5rgzE1pvmhZ6q7FfBuLtonJc5eYxxKjMsP3HAWkLWfgbClWLy+nxhGDgwxloRjkMCu049pXjE5XiU0O8kNmScyrq3R/sf5QyerXLXQR5yZXcDQdSpENfzdLPyGYCBODXT7GoAaQIZcQaA2iG3mO0HxatJlUggZ270N1zsKaEpc5oxVX40vhwfG+PSHaV3Prb+4Lkt7B8pIHOW3lEn75SGuG8QtXUwJ+KPQ2kg93m+535Ia1fNYjwGDOKqX5w8nnRYXiJBowQ+DcpRxMmA5quwGEnuKU0HYBSyLckXukS7SESW4UgBi11gn/FbxZzbTvf4XKZZbe03ZIpvCUGml8MczW792kIkxoZTOGzbQaTW0O0SmwWq5325w4rWcMFSB4Za5i1GwYUiWPo0aamHzkQFbuFlfsR3VfiQE41ZYOJRaRsu9sDzKvxFhN5Q2Oa8ShX522CWpCb3rb8S4Ufg8VvgWY9vjx++bUIZZPZ+GtG6ZlkHls5QYa+kceh+AxgWKlT+oR/oJu2yRHgpzRMvQ8kizSD7iFYpGqqAjngy+WfjrdrYl3Mbxu5UP18guTLD0FK6Xjnz5nqegUHj+iesR3ev8T47c2GGvs3FV4JwI2+WbIYrYxT1xcUwbQoiI8hUbZDRGAVsqmhxWzsTiwOInr7p2HG+C03lXG9r2Ag3ARDP2BVGfHETryNYY/551+GWchtK85LFvCiizkTls7oO2asROwaWjg3GOLHDxMe80YkklQuJXfdewSrnqBXDddrWeOB/e45BPtMyt6tnWSr0Emsov5PibIdFZdt7zLtD2jYc6wIGuGAEZHhKu8v3NhINYLAiS9bOakrHRdTHczVazL1uw== 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:(13230040)(7416014)(1800799024)(376014)(36860700013)(82310400026)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2024 17:46:16.4002 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b2bf168-be13-4cef-b6e2-08dd19428c21 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: MN1PEPF0000ECD5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB9494 An activity monitor (actmon) is used to measure the device runtime utilization to help drive software power management policies. Configuration of actmon is under the host1x address space. Therefore, add the actmon aperture under the host1x. All unit actmons for host1x clients share the same actmon clock source from host1x. Therefore, add the clock phandle in host1x. Signed-off-by: Johnny Liu --- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi index 984c85eab41af..8faeef83d7596 100644 --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi @@ -4313,8 +4313,9 @@ host1x@13e00000 { compatible = "nvidia,tegra234-host1x"; reg = <0x0 0x13e00000 0x0 0x10000>, <0x0 0x13e10000 0x0 0x10000>, - <0x0 0x13e40000 0x0 0x10000>; - reg-names = "common", "hypervisor", "vm"; + <0x0 0x13e40000 0x0 0x10000>, + <0x0 0x13ef0000 0x0 0x60000>; + reg-names = "common", "hypervisor", "vm", "actmon"; interrupts = , , , @@ -4326,8 +4327,9 @@ host1x@13e00000 { ; interrupt-names = "syncpt0", "syncpt1", "syncpt2", "syncpt3", "syncpt4", "syncpt5", "syncpt6", "syncpt7", "host1x"; - clocks = <&bpmp TEGRA234_CLK_HOST1X>; - clock-names = "host1x"; + clocks = <&bpmp TEGRA234_CLK_HOST1X>, + <&bpmp TEGRA234_CLK_ACTMON>; + clock-names = "host1x", "actmon"; #address-cells = <2>; #size-cells = <2>; From patchwork Tue Dec 10 17:45:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johnny Liu X-Patchwork-Id: 849003 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2066.outbound.protection.outlook.com [40.107.93.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE49521421B; Tue, 10 Dec 2024 17:46:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733852790; cv=fail; b=NM0LXyyskcy6uw+EWiM0TS8b6BzN0EyBJ6B7AC45fcfs+lIJekgpDpSZhYJ1V0n4PaOs5KcO19pYoeVFwr5vwX1szJpgQZScIQEa8p5W+v6JaXPNPGXvYFyXqodZjckpfYZQOpd+TIIgrSOqcO9DDAQiCy2bPg01STQkaWOhuI8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733852790; c=relaxed/simple; bh=QohShMjPjJY4GuLCtWpw4Ketg2C8kcb/mlXK/9x1IyM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VFACHldP4WpdwFYxoJrJbqvEXP4x5ck89oAer9bolOE6kr/F7OFMazIenOgKslZt+kBNzEe5zt54Uy0c4N/gULBjlEexOW1jjBo4pk9/YrFvmrOK4nMLn6JgScdvJRtakrNypaOnjxZquC7Z26WznWOI/BiCEMUG00QPXBtTkr8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Hi55FbZS; arc=fail smtp.client-ip=40.107.93.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Hi55FbZS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IquQRwCT4YlQ1hDwSQSrITCK89KHBgiMWXi8HiwZHAcGAmasAQd2jdoRTubW2mxAJx3ZkuDWJ7JsmZQfuomuoUjYQktJQJK4kMlDwG7su5+tdGf5ibrS/8T9PPkkV2Sz3+ijvuBA2EkZw3NmYttRLb8WwgmuOoc92TyYDFFyuZ52mnnr7jvVCnN+XNWtH3oY9ZYdmDuHo/x2ZHNmmSBy6qu8bTfg8kW9yAgiYtiYyQSb+gZ8Cd8YP8mJJyZPSxd6CRagK5+mGRgkjOZG/ZPphetrUvL4YM+RRkP8KLJ2G8mwKr9BR4OXWwsD0JRDGddWDJoWrEf/iXUKinYifs+UwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=4O7pikL5AwyexE3GZyrcx0Q5qBG+QnwkpMorv8ywK9w=; b=D3av6vx136F5rAXl4pv9Vljj30O+6Qu0XVxNPkTf06xG7AYM77T9iIeIlaPfYhnnN0HkHzlZ01OxsmrsNI2KN7vP0yBoRH11LpndZRG7g1wSiTQK1DkgrB8gzIzyQhomMSmoOZoImmjFzCrgYEpEhxFx8BWV5EJonzZ1VJmIwn2bFozQB0lVeciUhBDu9W12fKz4PCjJF1FlCXgfz9d1Rt7MRY9GtJGpY43RmQ4WVDaYPJVF3uZCN0+Vpx9/ObfelsNfwIeRnNVEm+uaEn/A0fSxpXz2LC4zu1NUI7pM+PciR+sH0J5sCorBAvoloXi2ZkInx1zNx4v68BkF5LnGmA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=gmail.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 (0) 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=4O7pikL5AwyexE3GZyrcx0Q5qBG+QnwkpMorv8ywK9w=; b=Hi55FbZSHXbtcsI++b1/ZdNqOCOpspVf0auikaa7SAV6UlMCNI1fAsBmsfkljtsH4HUs/t1Hg7dld6jRnQkoWc3pL+6SOj6jw80bQ5PuJhM120OwlFn0OusPlCOFpdX4Bl7SJRkgg0M8L6OwKeh9NCr/BF5cwGbjOahlo7vEXMv08i6c1aJjOz0oKZjhOd2I6fPnSzOoz6U3jhRsv/tWYqtSvd/0yBtX1Bqm0Sp9ENXWiG8th1mmxT6bUszbjgiJEHxdLv2BcHhqWiQkEE8ife1TmX7lqsKwH5LOsbFBQX24FRQZLE2zIBnzzpFfGwrxMNW+LVVKL5NLIKk96gg6Lg== Received: from BN9PR03CA0975.namprd03.prod.outlook.com (2603:10b6:408:109::20) by LV8PR12MB9408.namprd12.prod.outlook.com (2603:10b6:408:208::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Tue, 10 Dec 2024 17:46:17 +0000 Received: from MN1PEPF0000ECD5.namprd02.prod.outlook.com (2603:10b6:408:109:cafe::27) by BN9PR03CA0975.outlook.office365.com (2603:10b6:408:109::20) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.20 via Frontend Transport; Tue, 10 Dec 2024 17:46: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 MN1PEPF0000ECD5.mail.protection.outlook.com (10.167.242.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.15 via Frontend Transport; Tue, 10 Dec 2024 17:46:17 +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.1544.4; Tue, 10 Dec 2024 09:45:59 -0800 Received: from drhqmail203.nvidia.com (10.126.190.182) 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.1544.4; Tue, 10 Dec 2024 09:45:59 -0800 Received: from thinkpad-t480.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Tue, 10 Dec 2024 09:45:58 -0800 From: Johnny Liu To: , , , , , , , , , , , , CC: , , , , , Johnny Liu Subject: [PATCH v1 3/5] gpu: host1x: Support device monitoring with actmon Date: Tue, 10 Dec 2024 09:45:52 -0800 Message-ID: <20241210174554.18869-4-johnliu@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241210174554.18869-1-johnliu@nvidia.com> References: <20241210174554.18869-1-johnliu@nvidia.com> X-NVConfidentiality: public Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD5:EE_|LV8PR12MB9408:EE_ X-MS-Office365-Filtering-Correlation-Id: fe0eb662-c55c-4c9a-d98c-08dd19428c85 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|7416014|36860700013|1800799024|82310400026|921020; X-Microsoft-Antispam-Message-Info: T0FnMFukNKUHxmu5dhSb2xBkbxDWbvOuYIVKW/ZkV5Nly9CxSDH+BVflGEffE5Q865I1ySvj1+pndnCVqsSZz/wmAZi5oMdeRO0T/XmlX6BbB2WL4KaNGKos7JMaaMJ+92X3CZpTb5CKwwjKkjKIMOfFtYvkOCoSsUrIjf6Kebokn9hoMi4JtRzGYNuz05a1PLJ3vwfyO2Fo8xXH+LHd7K67LnUqz3uNoNJAcUZF8gnvL/JAmZcRacNbcnADMOuDPVnlGsV8DShvgLbFT91XJ426kzgFUTI/MfePoiIcc+XtfIUZhXxi0ZtREI5Z+Zz35sgPdhaZtGc4vBfvl1YVyAW1NX5thF0NJIuxoSrkcft8AJFtJBYlbQYnRJnfLMrX+8mv6hEoFQSMmLuyaIJxyym0s/ndx0K4T5W/GtRQej76+jyhRS0BB+iwxlGCRXMmdNDe1lMYpy7EZwPA6Na8pVr6qDwMlcRy5vnu4sb71ghP7B/EKzJtrXdQ9h6qwgzuCsXyq/nebglWE7yr1Uqh6Tpm+5ZCPjlc6VUaDx9/OaVgug9V61/IxUG6wnsqRhsapkyhkQwUNCxAs6BOZpt/kpcsjuzqFRCrImB27RqSpSv3KuEiTMVMxSivl2IGuK5MDJYCmGcD8LSUHXfU2dCu0KBedAhIpM5YRlRlzlh85epKdxdqxbMha+Os8f2bm4mbljAJbytBaKjfhPFZA+ICTxZz3d5p2UAEplQcpr552SVZLwOCW3DewEl+HYx0lSabDMTRIfeJC+ka/07zXIKgU/aHyfWeeDbP47QwRUhS8LwV84xrKBywL6hpZe3/oEgXRoVt7BirZIB/EQLF4VKUmDmb2QOGk2nhiju2nm85e9YlA4j2BUD7CxAwXjv/K0DfX5xUjYK6zHWGR2vqJzumjcHUS/rMlc2Sp++vbMbH+s4ygR2xAsn6piMckZ4+rR5tB4yfw1zkDhJWKO6GFYtRjIKHeaBgPb7ym+td9rrV0ALDZbfxq9LGbzpqdKa4e4plU1nKXKLd/SsiP0Zpm7l7YIvjht0uged9Ly/SC7LTsbuz+T02AGkPm1Z9sB72+ePAO/pdEL3W/IhjGT3aJrl+ejVq465rxN7XiaH5CWDdq4RG/fcqh3nyufDyAOBmI0omJQOE7piSOOwbN1FOqCZlC0uavM6kCEjZeb1e5NkHv1+Ar6SP74xzx/upd3Kx1ZFD2OAEA6uTNcIHse3exT30sm0qBTmD8UfG47lInpauKesDfEJhWlcAw/HTvxRtM7uU+7jUW0EK3MjEPKOOyhkHL4zt/e0ive1X+skK5WpqbNCQ7tbsOSvGIDFBDY35ZBOAgwyDcFJlC/GV8mxIhBJbtFs7mZV7xdb81mzAbWg+Ef4A3aXjB5M8cdCcPnrWyKJ82nnXgsVyUaK/eMAuRcDCBeRagGRRL8V5EMxzyzQpfd3NqbEzChQJGofT95DWk/Iu9yDflEmQq5G7PadzqPyW0g== 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:(13230040)(376014)(7416014)(36860700013)(1800799024)(82310400026)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2024 17:46:17.0565 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fe0eb662-c55c-4c9a-d98c-08dd19428c85 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: MN1PEPF0000ECD5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9408 An activity monitor (actmon) is used to measure the device runtime utilization to help drive software power management policies, such as device dynamic frequency scaling. For every host1x client, an actmon is employed to monitor its runtime utilization. Upon detecting an actmon watermark breach against the sampled runtime utilization value, it will trigger an interrupt to the host1x subsystem to trigger device dynamic frequency scaling if supported by the client. Upon registration with actmon within the host1x subsystem, a host1x client gains the ability to activate/deactivate its own actmon during the device resume/suspend cycle. This ensures that a host1x client runs at the power-optimal frequency when active, while also preventing unnecessary actmon interrupts during periods of inactivity. Signed-off-by: Johnny Liu --- drivers/gpu/host1x/Makefile | 1 + drivers/gpu/host1x/actmon.c | 558 +++++++++++++++++++++ drivers/gpu/host1x/actmon.h | 46 ++ drivers/gpu/host1x/dev.c | 71 ++- drivers/gpu/host1x/dev.h | 59 ++- drivers/gpu/host1x/hw/actmon.h | 49 ++ drivers/gpu/host1x/hw/host1x08.c | 6 +- drivers/gpu/host1x/hw/hw_host1x08_common.h | 16 +- drivers/gpu/host1x/hw/intr_general_hw.c | 83 +++ include/linux/host1x.h | 30 +- 10 files changed, 903 insertions(+), 16 deletions(-) create mode 100644 drivers/gpu/host1x/actmon.c create mode 100644 drivers/gpu/host1x/actmon.h create mode 100644 drivers/gpu/host1x/hw/actmon.h create mode 100644 drivers/gpu/host1x/hw/intr_general_hw.c diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile index ee5286ffe08d5..230afea0f2aa5 100644 --- a/drivers/gpu/host1x/Makefile +++ b/drivers/gpu/host1x/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 host1x-y = \ + actmon.o \ bus.o \ syncpt.o \ dev.o \ diff --git a/drivers/gpu/host1x/actmon.c b/drivers/gpu/host1x/actmon.c new file mode 100644 index 0000000000000..7a1d98fd099a8 --- /dev/null +++ b/drivers/gpu/host1x/actmon.c @@ -0,0 +1,558 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * + * Tegra host1x actmon driver + */ + +#include +#include +#include +#include +#include +#include + +#include "dev.h" +#include "actmon.h" +#include "hw/actmon.h" + +static void actmon_writel(struct host1x_actmon *actmon, u32 val, u32 offset) +{ + writel(val, actmon->regs + offset); +} + +static u32 actmon_readl(struct host1x_actmon *actmon, u32 offset) +{ + return readl(actmon->regs + offset); +} + +static void actmon_module_writel(struct host1x_actmon_module *module, u32 val, u32 offset) +{ + writel(val, module->regs + offset); +} + +static u32 actmon_module_readl(struct host1x_actmon_module *module, u32 offset) +{ + return readl(module->regs + offset); +} + +static void host1x_actmon_update_sample_period(struct host1x_actmon *actmon) +{ + unsigned long actmon_mhz; + u32 actmon_clks_per_sample, sample_period, val = 0; + + actmon_mhz = actmon->rate / HZ_PER_MHZ; + actmon_clks_per_sample = actmon_mhz * actmon->usecs_per_sample; + + val |= HOST1X_ACTMON_CTRL_SOURCE(2); + + if (actmon_clks_per_sample > 65536) { + val |= HOST1X_ACTMON_CTRL_SAMPLE_TICK(1); + sample_period = actmon_clks_per_sample / 65536; + } else { + val &= ~HOST1X_ACTMON_CTRL_SAMPLE_TICK(1); + sample_period = actmon_clks_per_sample / 256; + } + + val &= ~HOST1X_ACTMON_CTRL_SAMPLE_PERIOD_MASK; + val |= HOST1X_ACTMON_CTRL_SAMPLE_PERIOD(sample_period); + actmon_writel(actmon, val, HOST1X_ACTMON_CTRL_REG); +} + +static int host1x_actmon_sample_period_get(void *data, u64 *val) +{ + struct host1x_actmon *actmon = (struct host1x_actmon *)data; + + *val = (u64)actmon->usecs_per_sample; + + return 0; +} + +static int host1x_actmon_sample_period_set(void *data, u64 val) +{ + struct host1x_actmon *actmon = (struct host1x_actmon *)data; + + actmon->usecs_per_sample = (u32)val; + host1x_actmon_update_sample_period(actmon); + + return 0; +} + +DEFINE_SIMPLE_ATTRIBUTE(host1x_actmon_sample_period_fops, + host1x_actmon_sample_period_get, + host1x_actmon_sample_period_set, + "%lld\n"); + +/** + * host1x_actmon_debug_init - Initialize actmon debugfs + * @actmon: the actmon instance being configured + * @name: an unique name of the actmon + * + * There are multiple modules available inside the actmon, and they perform the + * signal sampling at the same rate. The debugfs of an actmon will expose this + * shared configuration, sample_period, via a debugfs node: + * - sample_period: + * Sampling period in micro-second of modules inside the actmon + */ +static void host1x_actmon_debug_init(struct host1x_actmon *actmon, const char *name) +{ + struct host1x *host = dev_get_drvdata(actmon->client->host->parent); + + if (!host->debugfs) { + dev_warn(host->dev, "debugfs is unavailable\n"); + return; + } + + if (!host->actmon_debugfs) + host->actmon_debugfs = debugfs_create_dir("actmon", host->debugfs); + + actmon->debugfs = debugfs_create_dir(name, host->actmon_debugfs); + + /* R/W files */ + debugfs_create_file("sample_period", 0644, actmon->debugfs, actmon, + &host1x_actmon_sample_period_fops); +} + +static int host1x_actmon_module_k_get(void *data, u64 *val) +{ + struct host1x_actmon_module *module = (struct host1x_actmon_module *)data; + + *val = (u64)module->k; + + return 0; +} + +static int host1x_actmon_module_k_set(void *data, u64 val) +{ + struct host1x_actmon_module *module = (struct host1x_actmon_module *)data; + u32 val32; + + module->k = (u32)val; + + val32 = actmon_module_readl(module, HOST1X_ACTMON_MODULE_CTRL_REG); + val32 &= ~HOST1X_ACTMON_MODULE_CTRL_K_VAL_MASK; + val32 |= HOST1X_ACTMON_MODULE_CTRL_K_VAL(module->k); + actmon_module_writel(module, val32, HOST1X_ACTMON_MODULE_CTRL_REG); + + return 0; +} + +DEFINE_SIMPLE_ATTRIBUTE(host1x_actmon_module_k_fops, + host1x_actmon_module_k_get, + host1x_actmon_module_k_set, + "%lld\n"); + +static int host1x_actmon_module_consec_upper_num_get(void *data, u64 *val) +{ + struct host1x_actmon_module *module = (struct host1x_actmon_module *)data; + + *val = (u64)module->consec_upper_num; + + return 0; +} + +static int host1x_actmon_module_consec_upper_num_set(void *data, u64 val) +{ + struct host1x_actmon_module *module = (struct host1x_actmon_module *)data; + u32 val32; + + module->consec_upper_num = (u32)val; + + val32 = actmon_module_readl(module, HOST1X_ACTMON_MODULE_CTRL_REG); + val32 &= ~HOST1X_ACTMON_MODULE_CTRL_CONSEC_UPPER_NUM_MASK; + val32 |= HOST1X_ACTMON_MODULE_CTRL_CONSEC_UPPER_NUM(module->consec_upper_num); + actmon_module_writel(module, val32, HOST1X_ACTMON_MODULE_CTRL_REG); + + return 0; +} + +DEFINE_SIMPLE_ATTRIBUTE(host1x_actmon_module_consec_upper_num_fops, + host1x_actmon_module_consec_upper_num_get, + host1x_actmon_module_consec_upper_num_set, + "%lld\n"); + +static int host1x_actmon_module_consec_lower_num_get(void *data, u64 *val) +{ + struct host1x_actmon_module *module = (struct host1x_actmon_module *)data; + + *val = (u64)module->consec_lower_num; + + return 0; +} + +static int host1x_actmon_module_consec_lower_num_set(void *data, u64 val) +{ + struct host1x_actmon_module *module = (struct host1x_actmon_module *)data; + u32 val32; + + module->consec_lower_num = (u32)val; + + val32 = actmon_module_readl(module, HOST1X_ACTMON_MODULE_CTRL_REG); + val32 &= ~HOST1X_ACTMON_MODULE_CTRL_CONSEC_LOWER_NUM_MASK; + val32 |= HOST1X_ACTMON_MODULE_CTRL_CONSEC_LOWER_NUM(module->consec_lower_num); + actmon_module_writel(module, val32, HOST1X_ACTMON_MODULE_CTRL_REG); + + return 0; +} + +DEFINE_SIMPLE_ATTRIBUTE(host1x_actmon_module_consec_lower_num_fops, + host1x_actmon_module_consec_lower_num_get, + host1x_actmon_module_consec_lower_num_set, + "%lld\n"); + +static int host1x_actmon_module_avg_norm_get(void *data, u64 *val) +{ + struct host1x_actmon_module *module = (struct host1x_actmon_module *)data; + struct host1x_actmon *actmon = module->actmon; + struct host1x_client *client = actmon->client; + unsigned long client_freq; + u32 active_clks, client_clks; + + if (!client->ops || !client->ops->get_rate) + return -EOPNOTSUPP; + + active_clks = actmon_module_readl(module, HOST1X_ACTMON_MODULE_AVG_COUNT_REG); + + client_freq = client->ops->get_rate(client); + client_clks = ((client_freq / 1000) * actmon->usecs_per_sample) / 1000; + + *val = (u64)(active_clks * 1000) / client_clks; + + return 0; +} + +DEFINE_SIMPLE_ATTRIBUTE(host1x_actmon_module_avg_norm_fops, + host1x_actmon_module_avg_norm_get, NULL, + "%lld\n"); + +/** + * host1x_actmon_module_debug_init - Initialize debugfs for module inside actmon + * @module: the actmon module being configured + * + * Each module inside the actmon is used for monitoring the utilization of the + * underlying host1x client. The debugfs of an actmon module will expose the + * following debugfs nodes: + * - k: + * It is a programmable factor affecting the exponential-moving-average filter + * inside the actmon module for calculating the utilization of the engine over + * the time. The formula of the filter is as following: + * + * K = 1 / 2^(k+1) + * A_t = (K * C_t) + ((1-K) * A_{t-1}) + * + * where A_t is the average utilization at time t. C_t is the sampled actmon + * counter value at time t. + * + * - consec_upper_num: + * "`consec_upper_num` + 1" of consecutive upper watermark breaches that need + * to occur before actmon module asserts the interrupt to CPU. + * + * - consec_lower_num: + * "`consec_lower_num` + 1" of consecutive lower watermark breaches that need + * to occur before actmon module asserts the interrupt to CPU. + * + * - usage: + * A normalized value representing the utilization of the engine ranges from + * 0 to 1000. + */ +static void host1x_actmon_module_debug_init(struct host1x_actmon_module *module) +{ + struct host1x *host = dev_get_drvdata(module->actmon->client->host->parent); + struct device *dev = module->actmon->client->dev; + struct dentry *debugfs = module->actmon->debugfs; + char dirname[8]; + + if (!debugfs) { + dev_warn(host->dev, + "actmon debugfs entry for %s was not found\n", + dev_name(dev)); + return; + } + + snprintf(dirname, sizeof(dirname), "module%d", module->type); + module->debugfs = debugfs_create_dir(dirname, debugfs); + + /* R/W files */ + debugfs_create_file("k", 0644, module->debugfs, module, + &host1x_actmon_module_k_fops); + debugfs_create_file("consec_upper_num", 0644, module->debugfs, module, + &host1x_actmon_module_consec_upper_num_fops); + debugfs_create_file("consec_lower_num", 0644, module->debugfs, module, + &host1x_actmon_module_consec_lower_num_fops); + + /* R files */ + debugfs_create_file("usage", 0444, module->debugfs, module, + &host1x_actmon_module_avg_norm_fops); +} + +static void host1x_actmon_init(struct host1x_actmon *actmon) +{ + u32 val; + + /* Global control register */ + host1x_actmon_update_sample_period(actmon); + + /* Global interrupt enable register */ + val = (1 << actmon->num_modules) - 1; + actmon_writel(actmon, val, HOST1X_ACTMON_INTR_ENB_REG); +} + +static void host1x_actmon_deinit(struct host1x_actmon *actmon) +{ + actmon_writel(actmon, 0, HOST1X_ACTMON_CTRL_REG); + actmon_writel(actmon, 0, HOST1X_ACTMON_INTR_ENB_REG); +} + +static void host1x_actmon_module_init(struct host1x_actmon_module *module) +{ + /* Local control register */ + actmon_module_writel(module, + HOST1X_ACTMON_MODULE_CTRL_ACTMON_ENB(0) | + HOST1X_ACTMON_MODULE_CTRL_ENB_PERIODIC(1) | + HOST1X_ACTMON_MODULE_CTRL_K_VAL(module->k) | + HOST1X_ACTMON_MODULE_CTRL_CONSEC_UPPER_NUM(module->consec_upper_num) | + HOST1X_ACTMON_MODULE_CTRL_CONSEC_LOWER_NUM(module->consec_lower_num), + HOST1X_ACTMON_MODULE_CTRL_REG); + + /* Interrupt enable register (disable interrupts by default) */ + actmon_module_writel(module, 0, HOST1X_ACTMON_MODULE_INTR_ENB_REG); + + /* Interrupt status register */ + actmon_module_writel(module, ~0, HOST1X_ACTMON_MODULE_INTR_STATUS_REG); + + /* Consecutive watermark registers */ + actmon_module_writel(module, ~0, HOST1X_ACTMON_MODULE_UPPER_WMARK_REG); + actmon_module_writel(module, 0, HOST1X_ACTMON_MODULE_LOWER_WMARK_REG); + + /* Moving-average watermark registers */ + actmon_module_writel(module, ~0, HOST1X_ACTMON_MODULE_AVG_UPPER_WMARK_REG); + actmon_module_writel(module, 0, HOST1X_ACTMON_MODULE_AVG_LOWER_WMARK_REG); + + /* Init average value register */ + actmon_module_writel(module, 0, HOST1X_ACTMON_MODULE_INIT_AVG_REG); +} + +static void host1x_actmon_module_deinit(struct host1x_actmon_module *module) +{ + actmon_module_writel(module, 0, HOST1X_ACTMON_MODULE_CTRL_REG); + actmon_module_writel(module, 0, HOST1X_ACTMON_MODULE_INTR_ENB_REG); + actmon_module_writel(module, ~0, HOST1X_ACTMON_MODULE_INTR_STATUS_REG); + actmon_module_writel(module, 0, HOST1X_ACTMON_MODULE_UPPER_WMARK_REG); + actmon_module_writel(module, 0, HOST1X_ACTMON_MODULE_LOWER_WMARK_REG); + actmon_module_writel(module, 0, HOST1X_ACTMON_MODULE_AVG_UPPER_WMARK_REG); + actmon_module_writel(module, 0, HOST1X_ACTMON_MODULE_AVG_LOWER_WMARK_REG); + actmon_module_writel(module, 0, HOST1X_ACTMON_MODULE_INIT_AVG_REG); + actmon_module_writel(module, 0, HOST1X_ACTMON_MODULE_COUNT_WEIGHT_REG); +} + +void host1x_actmon_handle_interrupt(struct host1x *host, int classid) +{ + unsigned long actmon_status, module_status; + struct host1x_actmon_module *module; + struct host1x_actmon *actmon, *tmp_actmon; + struct host1x_client *client; + + list_for_each_entry_safe(actmon, tmp_actmon, &host->actmons, list) { + if (actmon->client->class == classid) + break; + } + + client = actmon->client; + module = &actmon->modules[HOST1X_ACTMON_MODULE_ACTIVE]; + + actmon_status = actmon_readl(actmon, HOST1X_ACTMON_INTR_STATUS_REG); + module_status = actmon_module_readl(module, HOST1X_ACTMON_MODULE_INTR_STATUS_REG); + + /* Trigger DFS if client supports it */ + if (client->ops && client->ops->actmon_event) { + if (module_status & HOST1X_ACTMON_MODULE_INTR_CONSEC_WMARK_ABOVE) + client->ops->actmon_event(client, HOST1X_ACTMON_CONSEC_WMARK_ABOVE); + + if (module_status & HOST1X_ACTMON_MODULE_INTR_CONSEC_WMARK_BELOW) + client->ops->actmon_event(client, HOST1X_ACTMON_CONSEC_WMARK_BELOW); + + if (module_status & HOST1X_ACTMON_MODULE_INTR_AVG_WMARK_ABOVE) + client->ops->actmon_event(client, HOST1X_ACTMON_AVG_WMARK_ABOVE); + + if (module_status & HOST1X_ACTMON_MODULE_INTR_AVG_WMARK_BELOW) + client->ops->actmon_event(client, HOST1X_ACTMON_AVG_WMARK_BELOW); + } + + actmon_module_writel(module, module_status, HOST1X_ACTMON_MODULE_INTR_STATUS_REG); + actmon_writel(actmon, actmon_status, HOST1X_ACTMON_INTR_STATUS_REG); +} + +int host1x_actmon_register(struct host1x_client *client) +{ + struct host1x *host = dev_get_drvdata(client->host->parent); + const struct host1x_info *info = host->info; + const struct host1x_actmon_entry *entry = NULL; + struct host1x_actmon_module *module; + struct host1x_actmon *actmon; + int i; + + if (!info->has_actmon) { + dev_dbg(host->dev, "actmon is not supported\n"); + return 0; + } + + if (!host->actmon_regs) { + dev_warn(host->dev, + "skip registration since actmon resource is not defined\n"); + return 0; + } + + if (!host->actmon_clk) { + dev_warn(host->dev, + "skip registration since actmon clock is unavailable\n"); + return 0; + } + + if (client->actmon) { + dev_warn(host->dev, + "%s has already registered actmon\n", + dev_name(client->dev)); + return 0; + } + + for (i = 0; i < info->num_actmon_entries; i++) { + if (info->actmon_table[i].classid == client->class) + entry = &info->actmon_table[i]; + } + if (!entry) + return -ENODEV; + + actmon = devm_kzalloc(client->dev, sizeof(*actmon), GFP_KERNEL); + if (!actmon) + return -ENOMEM; + + INIT_LIST_HEAD(&actmon->list); + mutex_lock(&host->actmons_lock); + list_add_tail(&actmon->list, &host->actmons); + mutex_unlock(&host->actmons_lock); + + actmon->client = client; + actmon->rate = clk_get_rate(host->actmon_clk); + actmon->regs = host->actmon_regs + entry->offset; + actmon->irq = entry->irq; + actmon->num_modules = entry->num_modules; + actmon->usecs_per_sample = 1500; + + /* Configure actmon registers */ + host1x_actmon_init(actmon); + + /* Create debugfs for the actmon */ + host1x_actmon_debug_init(actmon, entry->name); + + /* Configure actmon module registers */ + for (i = 0; i < actmon->num_modules; i++) { + module = &actmon->modules[i]; + module->actmon = actmon; + module->type = i; + module->regs = actmon->regs + (i * HOST1X_ACTMON_MODULE_OFFSET); + + module->k = 2; + module->consec_upper_num = 7; + module->consec_lower_num = 7; + host1x_actmon_module_init(module); + + /* Create debugfs for the actmon module */ + host1x_actmon_module_debug_init(module); + } + + client->actmon = actmon; + + return 0; +} +EXPORT_SYMBOL(host1x_actmon_register); + +void host1x_actmon_unregister(struct host1x_client *client) +{ + struct host1x_actmon_module *module; + struct host1x *host = dev_get_drvdata(client->host->parent); + struct host1x_actmon *actmon = client->actmon; + int i; + + if (!actmon) + return; + + for (i = 0; i < actmon->num_modules; i++) { + module = &actmon->modules[i]; + host1x_actmon_module_deinit(module); + debugfs_remove_recursive(module->debugfs); + } + + debugfs_remove_recursive(actmon->debugfs); + + host1x_actmon_deinit(actmon); + + mutex_lock(&host->actmons_lock); + list_del(&actmon->list); + mutex_unlock(&host->actmons_lock); + + client->actmon = NULL; +} +EXPORT_SYMBOL(host1x_actmon_unregister); + +void host1x_actmon_enable(struct host1x_client *client) +{ + struct host1x_actmon *actmon = client->actmon; + struct host1x_actmon_module *module; + int i; + + if (!actmon) + return; + + for (i = 0; i < actmon->num_modules; i++) { + module = &actmon->modules[i]; + actmon_module_writel(module, + actmon_module_readl(module, HOST1X_ACTMON_MODULE_CTRL_REG) | + HOST1X_ACTMON_MODULE_CTRL_ACTMON_ENB(1), + HOST1X_ACTMON_MODULE_CTRL_REG); + } +} +EXPORT_SYMBOL(host1x_actmon_enable); + +void host1x_actmon_disable(struct host1x_client *client) +{ + struct host1x_actmon *actmon = client->actmon; + struct host1x_actmon_module *module; + int i; + + if (!actmon) + return; + + for (i = 0; i < actmon->num_modules; i++) { + module = &actmon->modules[i]; + actmon_module_writel(module, + actmon_module_readl(module, HOST1X_ACTMON_MODULE_CTRL_REG) & + ~HOST1X_ACTMON_MODULE_CTRL_ACTMON_ENB(1), + HOST1X_ACTMON_MODULE_CTRL_REG); + } +} +EXPORT_SYMBOL(host1x_actmon_disable); + +void host1x_actmon_update_client_rate(struct host1x_client *client, + unsigned long rate, + u32 *weight) +{ + struct host1x_actmon *actmon = client->actmon; + struct host1x_actmon_module *module; + u32 val; + int i; + + if (!actmon) { + *weight = 0; + return; + } + + val = (rate / actmon->rate) << 2; + + for (i = 0; i < actmon->num_modules; i++) { + module = &actmon->modules[i]; + actmon_module_writel(module, val, HOST1X_ACTMON_MODULE_COUNT_WEIGHT_REG); + } + + *weight = val; +} +EXPORT_SYMBOL(host1x_actmon_update_client_rate); diff --git a/drivers/gpu/host1x/actmon.h b/drivers/gpu/host1x/actmon.h new file mode 100644 index 0000000000000..8d6f314b8a3ea --- /dev/null +++ b/drivers/gpu/host1x/actmon.h @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: GPL-2.0-only + * SPDX-FileCopyrightText: Copyright (c) 2009-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + */ + +#ifndef HOST1X_ACTMON_H +#define HOST1X_ACTMON_H + +#include +#include + +enum host1x_actmon_module_type { + HOST1X_ACTMON_MODULE_ACTIVE, + HOST1X_ACTMON_MODULE_STALL, +}; + +struct host1x_actmon; + +struct host1x_actmon_module { + enum host1x_actmon_module_type type; + u32 k; + u32 consec_upper_num; + u32 consec_lower_num; + void __iomem *regs; + struct host1x_actmon *actmon; + struct dentry *debugfs; +}; + +struct host1x_client; + +struct host1x_actmon { + unsigned int irq; + unsigned int num_modules; + unsigned long rate; + u32 usecs_per_sample; + void __iomem *regs; + struct host1x_client *client; + struct host1x_actmon_module modules[8]; + struct dentry *debugfs; + struct list_head list; +}; + +struct host1x; + +void host1x_actmon_handle_interrupt(struct host1x *host, int classid); + +#endif diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c index 7b1d091f3c090..9b60693dccdb2 100644 --- a/drivers/gpu/host1x/dev.c +++ b/drivers/gpu/host1x/dev.c @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Tegra host1x driver + * SPDX-FileCopyrightText: Copyright (c) 2010-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * - * Copyright (c) 2010-2013, NVIDIA Corporation. + * Tegra host1x driver */ #include @@ -47,6 +47,11 @@ void host1x_common_writel(struct host1x *host1x, u32 v, u32 r) writel(v, host1x->common_regs + r); } +u32 host1x_common_readl(struct host1x *host1x, u32 r) +{ + return readl(host1x->common_regs + r); +} + void host1x_hypervisor_writel(struct host1x *host1x, u32 v, u32 r) { writel(v, host1x->hv_regs + r); @@ -259,6 +264,23 @@ static const struct host1x_sid_entry tegra234_sid_table[] = { { /* VI2_THI MMIO */ .base = 0x16f8, .offset = 0x30, .limit = 0x34 }, }; +static const struct host1x_actmon_entry tegra234_actmon_table[] = { + { + .classid = HOST1X_CLASS_VIC, + .name = "vic", + .irq = 3, + .offset = 0x10000, + .num_modules = 1, + }, + { + .classid = HOST1X_CLASS_NVDEC, + .name = "nvdec", + .irq = 4, + .offset = 0x20000, + .num_modules = 1, + }, +}; + static const struct host1x_info host1x08_info = { .nb_channels = 63, .nb_pts = 1024, @@ -270,7 +292,10 @@ static const struct host1x_info host1x08_info = { .has_wide_gather = true, .has_hypervisor = true, .has_common = true, + .has_actmon = true, + .num_actmon_entries = ARRAY_SIZE(tegra234_actmon_table), .num_sid_entries = ARRAY_SIZE(tegra234_sid_table), + .actmon_table = tegra234_actmon_table, .sid_table = tegra234_sid_table, .streamid_vm_table = { 0x1004, 128 }, .classid_vm_table = { 0x1404, 25 }, @@ -530,6 +555,14 @@ static int host1x_probe(struct platform_device *pdev) if (IS_ERR(host->common_regs)) return PTR_ERR(host->common_regs); } + + if (host->info->has_actmon) { + host->actmon_regs = devm_platform_ioremap_resource_byname(pdev, "actmon"); + if (IS_ERR(host->actmon_regs)) { + dev_warn(&pdev->dev, "failed to get actmon resource\n"); + host->actmon_regs = NULL; + } + } } else { host->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(host->regs)) @@ -561,8 +594,12 @@ static int host1x_probe(struct platform_device *pdev) host->num_syncpt_irqs = 1; } + host->general_irq = platform_get_irq_byname_optional(pdev, "host1x"); + mutex_init(&host->devices_lock); INIT_LIST_HEAD(&host->devices); + mutex_init(&host->actmons_lock); + INIT_LIST_HEAD(&host->actmons); INIT_LIST_HEAD(&host->list); host->dev = &pdev->dev; @@ -578,6 +615,12 @@ static int host1x_probe(struct platform_device *pdev) return err; } + err = host1x_hw_intr_init_host_general(host); + if (err) { + dev_err(&pdev->dev, "failed to init general interrupt handler: %d\n", err); + return err; + } + host->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(host->clk)) { err = PTR_ERR(host->clk); @@ -588,6 +631,14 @@ static int host1x_probe(struct platform_device *pdev) return err; } + if (host->info->has_actmon) { + host->actmon_clk = devm_clk_get(&pdev->dev, "actmon"); + if (IS_ERR(host->actmon_clk)) { + dev_warn(&pdev->dev, "failed to get actmon clock\n"); + host->actmon_clk = NULL; + } + } + err = host1x_get_resets(host); if (err) return err; @@ -692,6 +743,7 @@ static int __maybe_unused host1x_runtime_suspend(struct device *dev) struct host1x *host = dev_get_drvdata(dev); int err; + host1x_hw_intr_disable_general_intrs(host); host1x_channel_stop_all(host); host1x_intr_stop(host); host1x_syncpt_save(host); @@ -707,6 +759,7 @@ static int __maybe_unused host1x_runtime_suspend(struct device *dev) } clk_disable_unprepare(host->clk); + clk_disable_unprepare(host->actmon_clk); reset_control_bulk_release(host->nresets, host->resets); return 0; @@ -715,6 +768,7 @@ static int __maybe_unused host1x_runtime_suspend(struct device *dev) host1x_setup_virtualization_tables(host); host1x_syncpt_restore(host); host1x_intr_start(host); + host1x_hw_intr_enable_general_intrs(host); return err; } @@ -724,6 +778,12 @@ static int __maybe_unused host1x_runtime_resume(struct device *dev) struct host1x *host = dev_get_drvdata(dev); int err; + err = clk_prepare_enable(host->actmon_clk); + if (err) { + dev_err(dev, "failed to enable actmon clock: %d\n", err); + goto disable_host1x_clk; + } + err = reset_control_bulk_acquire(host->nresets, host->resets); if (err) { dev_err(dev, "failed to acquire reset: %d\n", err); @@ -739,16 +799,19 @@ static int __maybe_unused host1x_runtime_resume(struct device *dev) err = reset_control_bulk_deassert(host->nresets, host->resets); if (err < 0) { dev_err(dev, "failed to deassert reset: %d\n", err); - goto disable_clk; + goto disable_actmon_clk; } host1x_setup_virtualization_tables(host); host1x_syncpt_restore(host); host1x_intr_start(host); + host1x_hw_intr_enable_general_intrs(host); return 0; -disable_clk: +disable_actmon_clk: + clk_disable_unprepare(host->actmon_clk); +disable_host1x_clk: clk_disable_unprepare(host->clk); release_reset: reset_control_bulk_release(host->nresets, host->resets); diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h index d3855a1c6b472..2270ec6b73f2e 100644 --- a/drivers/gpu/host1x/dev.h +++ b/drivers/gpu/host1x/dev.h @@ -1,12 +1,12 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2012-2015, NVIDIA Corporation. +/* SPDX-License-Identifier: GPL-2.0-only + * SPDX-FileCopyrightText: Copyright (c) 20012-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ #ifndef HOST1X_DEV_H #define HOST1X_DEV_H #include +#include #include #include #include @@ -74,6 +74,12 @@ struct host1x_syncpt_ops { void (*enable_protection)(struct host1x *host); }; +struct host1x_intr_general_ops { + int (*init_host_general)(struct host1x *host); + void (*enable_general_intrs)(struct host1x *host); + void (*disable_general_intrs)(struct host1x *host); +}; + struct host1x_intr_ops { int (*init_host_sync)(struct host1x *host, u32 cpm); void (*set_syncpt_threshold)( @@ -85,6 +91,14 @@ struct host1x_intr_ops { irqreturn_t (*isr)(int irq, void *dev_id); }; +struct host1x_actmon_entry { + int classid; + const char *name; + unsigned int irq; + unsigned int offset; + unsigned int num_modules; +}; + struct host1x_sid_entry { unsigned int base; unsigned int offset; @@ -107,8 +121,11 @@ struct host1x_info { bool has_wide_gather; /* supports GATHER_W opcode */ bool has_hypervisor; /* has hypervisor registers */ bool has_common; /* has common registers separate from hypervisor */ + bool has_actmon; /* has actmon registers separate from hypervisor */ unsigned int num_sid_entries; + unsigned int num_actmon_entries; const struct host1x_sid_entry *sid_table; + const struct host1x_actmon_entry *actmon_table; struct host1x_table_desc streamid_vm_table; struct host1x_table_desc classid_vm_table; struct host1x_table_desc mmio_vm_table; @@ -132,12 +149,15 @@ struct host1x { void __iomem *regs; void __iomem *hv_regs; /* hypervisor region */ void __iomem *common_regs; + void __iomem *actmon_regs; int syncpt_irqs[8]; int num_syncpt_irqs; + int general_irq; struct host1x_syncpt *syncpt; struct host1x_syncpt_base *bases; struct device *dev; struct clk *clk; + struct clk *actmon_clk; struct reset_control_bulk_data resets[2]; unsigned int nresets; @@ -149,6 +169,7 @@ struct host1x { struct mutex intr_mutex; const struct host1x_syncpt_ops *syncpt_op; + const struct host1x_intr_general_ops *intr_general_op; const struct host1x_intr_ops *intr_op; const struct host1x_channel_ops *channel_op; const struct host1x_cdma_ops *cdma_op; @@ -163,10 +184,15 @@ struct host1x { struct host1x_memory_context_list context_list; struct dentry *debugfs; + struct dentry *actmon_debugfs; struct mutex devices_lock; struct list_head devices; + /* Ensure atomic update against the list of registered actmons */ + struct mutex actmons_lock; + struct list_head actmons; + struct list_head list; struct device_dma_parameters dma_parms; @@ -175,7 +201,8 @@ struct host1x { }; void host1x_common_writel(struct host1x *host1x, u32 v, u32 r); -void host1x_hypervisor_writel(struct host1x *host1x, u32 v, u32 r); +u32 host1x_common_readl(struct host1x *host1x, u32 r); +void host1x_hypervisor_writel(struct host1x *host1x, u32 r, u32 v); u32 host1x_hypervisor_readl(struct host1x *host1x, u32 r); void host1x_sync_writel(struct host1x *host1x, u32 v, u32 r); u32 host1x_sync_readl(struct host1x *host1x, u32 r); @@ -224,6 +251,30 @@ static inline void host1x_hw_syncpt_enable_protection(struct host1x *host) return host->syncpt_op->enable_protection(host); } +static inline int host1x_hw_intr_init_host_general(struct host1x *host) +{ + if (!host->intr_general_op) + return 0; + + return host->intr_general_op->init_host_general(host); +} + +static inline void host1x_hw_intr_enable_general_intrs(struct host1x *host) +{ + if (!host->intr_general_op) + return; + + host->intr_general_op->enable_general_intrs(host); +} + +static inline void host1x_hw_intr_disable_general_intrs(struct host1x *host) +{ + if (!host->intr_general_op) + return; + + host->intr_general_op->disable_general_intrs(host); +} + static inline int host1x_hw_intr_init_host_sync(struct host1x *host, u32 cpm) { return host->intr_op->init_host_sync(host, cpm); diff --git a/drivers/gpu/host1x/hw/actmon.h b/drivers/gpu/host1x/hw/actmon.h new file mode 100644 index 0000000000000..01659829d51ac --- /dev/null +++ b/drivers/gpu/host1x/hw/actmon.h @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: GPL-2.0-only + * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * + * Tegra host1x Actmon Register Offsets + */ + +#ifndef __HOST1X_ACTMON_HARDWARE_H +#define __HOST1X_ACTMON_HARDWARE_H + +#define HOST1X_ACTMON_MODULE_OFFSET 0x80 + +#define HOST1X_ACTMON_CTRL_REG 0x0 +#define HOST1X_ACTMON_INTR_ENB_REG 0x4 +#define HOST1X_ACTMON_INTR_STATUS_REG 0x8 +#define HOST1X_ACTMON_MODULE_INIT_AVG_REG 0x14 +#define HOST1X_ACTMON_MODULE_CTRL_REG 0x80 +#define HOST1X_ACTMON_MODULE_INTR_ENB_REG 0x84 +#define HOST1X_ACTMON_MODULE_INTR_STATUS_REG 0x88 +#define HOST1X_ACTMON_MODULE_UPPER_WMARK_REG 0x8c +#define HOST1X_ACTMON_MODULE_LOWER_WMARK_REG 0x90 +#define HOST1X_ACTMON_MODULE_AVG_UPPER_WMARK_REG 0x94 +#define HOST1X_ACTMON_MODULE_AVG_LOWER_WMARK_REG 0x98 +#define HOST1X_ACTMON_MODULE_AVG_COUNT_REG 0xa4 +#define HOST1X_ACTMON_MODULE_COUNT_WEIGHT_REG 0xa8 + +#define HOST1X_ACTMON_CTRL_SOURCE(v) (((v) & 0x3) << 8) +#define HOST1X_ACTMON_CTRL_SAMPLE_TICK(v) (((v) & 0x1) << 10) +#define HOST1X_ACTMON_CTRL_SAMPLE_PERIOD(v) (((v) & 0xff) << 0) +#define HOST1X_ACTMON_MODULE_CTRL_ACTMON_ENB(v) (((v) & 0x1) << 31) +#define HOST1X_ACTMON_MODULE_CTRL_CONSEC_UPPER_NUM(v) (((v) & 0x7) << 26) +#define HOST1X_ACTMON_MODULE_CTRL_CONSEC_LOWER_NUM(v) (((v) & 0x7) << 21) +#define HOST1X_ACTMON_MODULE_CTRL_ENB_PERIODIC(v) (((v) & 0x1) << 13) +#define HOST1X_ACTMON_MODULE_CTRL_K_VAL(v) (((v) & 0x7) << 10) +#define HOST1X_ACTMON_MODULE_INTR_CONSEC_WMARK_ABOVE_ENB(v) (((v) & 0x1) << 31) +#define HOST1X_ACTMON_MODULE_INTR_CONSEC_WMARK_BELOW_ENB(v) (((v) & 0x1) << 30) +#define HOST1X_ACTMON_MODULE_INTR_AVG_WMARK_ABOVE_ENB(v) (((v) & 0x1) << 29) +#define HOST1X_ACTMON_MODULE_INTR_AVG_WMARK_BELOW_ENB(v) (((v) & 0x1) << 28) + +#define HOST1X_ACTMON_CTRL_SAMPLE_PERIOD_MASK 0xff +#define HOST1X_ACTMON_MODULE_CTRL_CONSEC_UPPER_NUM_MASK (0x7 << 26) +#define HOST1X_ACTMON_MODULE_CTRL_CONSEC_LOWER_NUM_MASK (0x7 << 21) +#define HOST1X_ACTMON_MODULE_CTRL_K_VAL_MASK (0x7 << 10) + +#define HOST1X_ACTMON_MODULE_INTR_CONSEC_WMARK_ABOVE BIT(31) +#define HOST1X_ACTMON_MODULE_INTR_CONSEC_WMARK_BELOW BIT(30) +#define HOST1X_ACTMON_MODULE_INTR_AVG_WMARK_ABOVE BIT(29) +#define HOST1X_ACTMON_MODULE_INTR_AVG_WMARK_BELOW BIT(28) + +#endif diff --git a/drivers/gpu/host1x/hw/host1x08.c b/drivers/gpu/host1x/hw/host1x08.c index 754890c34c740..a32b263bcbc75 100644 --- a/drivers/gpu/host1x/hw/host1x08.c +++ b/drivers/gpu/host1x/hw/host1x08.c @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Host1x init for Tegra234 SoCs + * SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * - * Copyright (c) 2022 NVIDIA Corporation. + * Host1x init for Tegra234 SoCs */ /* include hw specification */ @@ -15,6 +15,7 @@ #include "cdma_hw.c" #include "channel_hw.c" #include "debug_hw.c" +#include "intr_general_hw.c" #include "intr_hw.c" #include "syncpt_hw.c" @@ -26,6 +27,7 @@ int host1x08_init(struct host1x *host) host->cdma_op = &host1x_cdma_ops; host->cdma_pb_op = &host1x_pushbuffer_ops; host->syncpt_op = &host1x_syncpt_ops; + host->intr_general_op = &host1x_intr_general_ops; host->intr_op = &host1x_intr_ops; host->debug_op = &host1x_debug_ops; diff --git a/drivers/gpu/host1x/hw/hw_host1x08_common.h b/drivers/gpu/host1x/hw/hw_host1x08_common.h index 8e0c99150ec2c..b6c210f357428 100644 --- a/drivers/gpu/host1x/hw/hw_host1x08_common.h +++ b/drivers/gpu/host1x/hw/hw_host1x08_common.h @@ -1,6 +1,5 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2022 NVIDIA Corporation. +/* SPDX-License-Identifier: GPL-2.0-only + * SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ #define HOST1X_COMMON_OFA_MLOCK 0x4050 @@ -9,3 +8,14 @@ #define HOST1X_COMMON_NVENC_MLOCK 0x407c #define HOST1X_COMMON_NVDEC_MLOCK 0x4080 #define HOST1X_COMMON_NVJPG_MLOCK 0x4084 + +#define HOST1X_COMMON_INTR_CPU0_MASK 0x4 +#define HOST1X_COMMON_THOST_INTRSTATUS 0x1c +#define HOST1X_COMMON_THOST_INTRMASK 0x30 +#define HOST1X_COMMON_THOST_GLOBAL_INTRMASK 0x44 + +#define HOST1X_COMMON_THOST_INTRMASK_VIC_ACTMON(v) ((v) << 3) +#define HOST1X_COMMON_THOST_INTRMASK_NVDEC_ACTMON(v) ((v) << 4) + +#define HOST1X_COMMON_THOST_INTRSTATUS_VIC_ACTMON_INTR BIT(3) +#define HOST1X_COMMON_THOST_INTRSTATUS_NVDEC_ACTMON_INTR BIT(4) diff --git a/drivers/gpu/host1x/hw/intr_general_hw.c b/drivers/gpu/host1x/hw/intr_general_hw.c new file mode 100644 index 0000000000000..ef5064384f77f --- /dev/null +++ b/drivers/gpu/host1x/hw/intr_general_hw.c @@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * + * Tegra host1x General Interrupt Management + */ + +#include + +#include "../actmon.h" +#include "../dev.h" + +static irqreturn_t host1x_general_isr(int irq, void *dev_id) +{ + struct host1x *host = dev_id; + unsigned long status; + + status = host1x_common_readl(host, HOST1X_COMMON_THOST_INTRSTATUS); + + if (status & HOST1X_COMMON_THOST_INTRSTATUS_VIC_ACTMON_INTR) + host1x_actmon_handle_interrupt(host, HOST1X_CLASS_VIC); + + if (status & HOST1X_COMMON_THOST_INTRSTATUS_NVDEC_ACTMON_INTR) + host1x_actmon_handle_interrupt(host, HOST1X_CLASS_NVDEC); + + host1x_common_writel(host, status, HOST1X_COMMON_THOST_INTRSTATUS); + + return IRQ_HANDLED; +} + +static int host1x_intr_init_host_general(struct host1x *host) +{ + int err; + + if (host->general_irq <= 0 && !host->common_regs) + return 0; + + host1x_hw_intr_disable_general_intrs(host); + + err = devm_request_threaded_irq(host->dev, + host->general_irq, + NULL, host1x_general_isr, + IRQF_ONESHOT, "host1x_general", + host); + if (err < 0) { + devm_free_irq(host->dev, host->general_irq, host); + return err; + } + + return 0; +} + +static void host1x_intr_enable_general_intrs(struct host1x *host) +{ + if (host->general_irq <= 0 || !host->common_regs) + return; + + /* Assign CCPLEX for host1x general interrupts */ + host1x_common_writel(host, 0x1, HOST1X_COMMON_INTR_CPU0_MASK); + + /* Allow host1x general interrupts go to CCPLEX only */ + host1x_common_writel(host, 0x1, HOST1X_COMMON_THOST_GLOBAL_INTRMASK); + + /* Enable host1x general interrupts */ + host1x_common_writel(host, + HOST1X_COMMON_THOST_INTRMASK_VIC_ACTMON(1) | + HOST1X_COMMON_THOST_INTRMASK_NVDEC_ACTMON(1), + HOST1X_COMMON_THOST_INTRMASK); +} + +static void host1x_intr_disable_general_intrs(struct host1x *host) +{ + if (host->general_irq <= 0 || !host->common_regs) + return; + + host1x_common_writel(host, 0x0, HOST1X_COMMON_THOST_INTRMASK); +} + +static const struct host1x_intr_general_ops host1x_intr_general_ops = { + .init_host_general = host1x_intr_init_host_general, + .enable_general_intrs = host1x_intr_enable_general_intrs, + .disable_general_intrs = host1x_intr_disable_general_intrs, +}; diff --git a/include/linux/host1x.h b/include/linux/host1x.h index 9fa9c30a34e65..528b89d0ebdfa 100644 --- a/include/linux/host1x.h +++ b/include/linux/host1x.h @@ -1,6 +1,5 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (c) 2009-2013, NVIDIA Corporation. All rights reserved. +/* SPDX-License-Identifier: GPL-2.0-only + * SPDX-FileCopyrightText: Copyright (c) 2009-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ #ifndef __LINUX_HOST1X_H @@ -27,6 +26,13 @@ enum host1x_class { HOST1X_CLASS_OFA = 0xF8, }; +enum host1x_actmon_wmark_event { + HOST1X_ACTMON_AVG_WMARK_BELOW, + HOST1X_ACTMON_AVG_WMARK_ABOVE, + HOST1X_ACTMON_CONSEC_WMARK_BELOW, + HOST1X_ACTMON_CONSEC_WMARK_ABOVE, +}; + struct host1x; struct host1x_client; struct iommu_group; @@ -68,6 +74,8 @@ static inline void host1x_bo_cache_destroy(struct host1x_bo_cache *cache) * @late_exit: host1x client late tear down code * @suspend: host1x client suspend code * @resume: host1x client resume code + * @get_rate: host1x client get clock rate code + * @actmon_event: host1x client actmon event handling code in threaded interrupt context */ struct host1x_client_ops { int (*early_init)(struct host1x_client *client); @@ -76,8 +84,13 @@ struct host1x_client_ops { int (*late_exit)(struct host1x_client *client); int (*suspend)(struct host1x_client *client); int (*resume)(struct host1x_client *client); + unsigned long (*get_rate)(struct host1x_client *client); + void (*actmon_event)(struct host1x_client *client, + enum host1x_actmon_wmark_event event); }; +struct host1x_actmon; + /** * struct host1x_client - host1x client structure * @list: list node for the host1x client @@ -93,6 +106,7 @@ struct host1x_client_ops { * @usecount: reference count for this structure * @lock: mutex for mutually exclusive concurrency * @cache: host1x buffer object cache + * @actmon: unit actmon for this host1x client */ struct host1x_client { struct list_head list; @@ -113,6 +127,8 @@ struct host1x_client { struct mutex lock; struct host1x_bo_cache cache; + + struct host1x_actmon *actmon; }; /* @@ -500,4 +516,12 @@ static inline void host1x_memory_context_put(struct host1x_memory_context *cd) } #endif +int host1x_actmon_register(struct host1x_client *client); +void host1x_actmon_unregister(struct host1x_client *client); +void host1x_actmon_enable(struct host1x_client *client); +void host1x_actmon_disable(struct host1x_client *client); +void host1x_actmon_update_client_rate(struct host1x_client *client, + unsigned long rate, + u32 *weight); + #endif From patchwork Tue Dec 10 17:45:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johnny Liu X-Patchwork-Id: 849004 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2055.outbound.protection.outlook.com [40.107.237.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B644120469C; Tue, 10 Dec 2024 17:46:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733852784; cv=fail; b=eiWD8r+h+x26d9JQNZIAxqVUrgZdKl1em9l41a1IogLUPpzoovKExncgFrZA4mDNq+kBG24ew/Zwq/WlTZPrra/GQw6pxA8REmhAWhXDBBHbcDEJ0U7lZu8dL64YTWR61OoYAhY4a+ax8VDePdr4BMDkwCN3rvDoXdEskLcGRsU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733852784; c=relaxed/simple; bh=W5rUP1qJdnGz1R7auMDEoY1NDqGLoOsesnirDd0XryU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UhJINPtLcUkS5bjHHD3ICEoaxVeNXARlIv1wFvoLyvfd8wP9sDsKaHGD8KlwJSNv9FO97KzISS/QfxEH6CfCecVCd902jqj0RNTSY/S8XHEDNXqL1ksHx0VvcNTVM/e6Mv2/I6u2VXmRZfUwOBVHPZrM4RFK7MiXcKDLIiOJ2eQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=fZsstPEJ; arc=fail smtp.client-ip=40.107.237.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="fZsstPEJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NGOPdpD7U/29YS6FAv00G3MDcMiYU6bKyZbng+0hYI1IjP+JplBGtXdaa4Fsu5JxU07Pgg3GjUs7FZBffmbVA+Cy36+DW3Ocso+0Hz1vk7gDka9cYtQuNjs6Z8GyKCmHzkHlq0d8MQ+dJrlj77s5oS649v1DasXkuqegS5+KYWH9BI3Vj8D2BPj7Lxg/iAZvy5Bs56wqpbxrlmdtkllwpO073cOJ/X+URvnkXaJJ2PM5u+s0MYf5gZcpCReYesnyswj1kyFDzsiF2IwogCqTqWY8g1Iw70HgnFm0XsF60hW0mg2Pyjzx3IzJ5rl2tO0jgRaljGdEb9dGkCfC3E+jwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=UeBOyrNndl2/rz2H1q2Ts3sA89Xg/HljkXeaX38HY8I=; b=T+yy3k338IuaQssJXiQXRvmpZxkYYgH0Ram3x7cCi7BFJmpJlgMdQVHznJxXKnuEU0g20N4q4M3lH/C7sCydU8SEhuOSFO6SBJiop6D5rZyNn1tcLSinzWMAFenNWgppGUr7ILAIAyh4iwRQc3Pv4SmVBHEG7R1v6iI0QCWEYY3P15E7nMbSv5yPHMXeOtKL2Hv4y4zOAb5IR8CdG4aGlyIWu1GrH57+TyEaoV0BCEzUk40dsWOtS/Zb/ItRzpdhachwuMWJIVvJWoZS8+iL9pwGwJlPeBIdl43sXGS6+YGgxSgwe1r8VStEscJGkYGkIKW5sAjseN/2SQgOj+BzZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=gmail.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 (0) 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=UeBOyrNndl2/rz2H1q2Ts3sA89Xg/HljkXeaX38HY8I=; b=fZsstPEJKAbvYcFkZpssytsLSWTQflPx2BtZc7maQG6A/IDRmNiOmVACuTfzbGIx8TisZcTzGDmy/NFSSDe+QXeNpBVqr+E/kSmpv4FaRLMYoB/QCVUVxWe4VgyMG/nwwxNSrLXbxugHyMhsPK5oQsi5UrFfyXEr81STUyTgBX3LM2QzVGQMmAAB0f4FE0qpkJ8yFjkPBR52Ktw+286h63+MxqaZqh0RMzITqZxhG7cl7NeLOcrHW59C/xgwKpSrM0Np5UMEZiEK52vWgOZNtTQW12Js/g9Mpp6liPBxculHsKUMUTpNs/jQLKaKiar85PerQc7ZNYxYSIJ+6mDNaQ== Received: from BN9PR03CA0977.namprd03.prod.outlook.com (2603:10b6:408:109::22) by SA3PR12MB7974.namprd12.prod.outlook.com (2603:10b6:806:307::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.24; Tue, 10 Dec 2024 17:46:18 +0000 Received: from MN1PEPF0000ECD5.namprd02.prod.outlook.com (2603:10b6:408:109:cafe::37) by BN9PR03CA0977.outlook.office365.com (2603:10b6:408:109::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.14 via Frontend Transport; Tue, 10 Dec 2024 17:46:18 +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 MN1PEPF0000ECD5.mail.protection.outlook.com (10.167.242.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.15 via Frontend Transport; Tue, 10 Dec 2024 17:46:17 +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.1544.4; Tue, 10 Dec 2024 09:46:00 -0800 Received: from drhqmail203.nvidia.com (10.126.190.182) 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.1544.4; Tue, 10 Dec 2024 09:46:00 -0800 Received: from thinkpad-t480.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Tue, 10 Dec 2024 09:45:59 -0800 From: Johnny Liu To: , , , , , , , , , , , , CC: , , , , , Johnny Liu Subject: [PATCH v1 4/5] drm/tegra: nvdec: Register the device with actmon Date: Tue, 10 Dec 2024 09:45:53 -0800 Message-ID: <20241210174554.18869-5-johnliu@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241210174554.18869-1-johnliu@nvidia.com> References: <20241210174554.18869-1-johnliu@nvidia.com> X-NVConfidentiality: public Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD5:EE_|SA3PR12MB7974:EE_ X-MS-Office365-Filtering-Correlation-Id: fef6495c-1897-491a-e844-08dd19428cf5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|7416014|376014|82310400026|921020; X-Microsoft-Antispam-Message-Info: 4itRbsl9mcXzJMRbA96zMK6surKwasRGmAo0bTJAnfPK/+YJXgldNbUuZ3IoVz9sESJY33ReCKpsPnN3OleTdvsdbnuMUrfUM/hF5MRLQhSbHBtaXt1Q22qd9j1xaSkwqZNGm8kX624jKrm6fKj/AphN3MzfqnRHq8R/v0dsnk+0Q6RjRj+7K2IStvF/Ya4gdXz+lnoI7ujJ4PRPUhUsAcjNJEsoI8M1vQkmAtEvUEu1dXBlUNbx6cyWclWPNPvC3AZpK+HShvmbHL+ORty449JLSK81XHv4IJSyLsl9/Cu8OR4S3yqwqKc4baUa6+TSSBKE67NhcC+uA1sWZL6dCXAyxI46h1h1pLNWGvJXUQhpANk3YlB63G9NXtfg8rxqo1LmNUIqrP55Lp61rgxTo6zN33o5eMxNKTbSRimEnFD/7wyJeNxNzHgpCjI0kdpIb6B8Gu+lf5o+rmkKTydnr1pFun+QMlfU7Coq6gF3VXOWj4uO2tctm/HCD/dp06YtN1e/R6nt/DhQIZPx+Fmmk/EhJ3mDS6sjyA70eq3TcKXLK2NEk5a5KKg0ORqVOsWF10MToqA1ROr5hteVsrfXM2nLun02x7fIBkae50AyO5jIiaIRrcSlmZFWuweShkXJ51cwLIEKMceiK9Y/3OYejWqTv6q8e9kQh3pl7Air9ngT3SYJ+6+Xyapoh7yO2Q0S1/IApq1+7y5BgM4/aQbUnnxelhQh7z635t6/ys4OZ7FAZ4Dj+a6AHfTE2PgifmUMQL0kt0HnopQjxLEp3nhPNvamdu3oTO0LnVuR3JeTpv+oNv2rbQpoBo9DUG7XH2Ra4bzzIoqPCfHWGiAixo04TqRhFDt7hrZtCp8KGqjQEdJp1g5DB+0F0zX8BBx6soeCu8kLuUzBy1k5+TVL0/44Ac5QAlrOjAEDRRd6suUpgBcKSHt/eoZqYLu3yJPQ5e/x3NYMfw68wyemTorwoLjvaiZaux9VNIObp1pJv2WPAJDQVo93WnjCEcDewDu9BxFmEfHnSUEUSvkWD9Ths4I3FNQMPuqNP6CfvTCZkeLJ8c1rw2UpGDXO+zrZFcYPMZmE+AgmXT2LpXnfSEYmm5trnDSJXx8w5b9CmcjI7ngQ8DYK0/TGn6I76+/mXyZ/hxP3Qtwa+P2mZjxU3nKXWSwWF2ZUwTyRpWqa8uv303VsXNn5ucTgJS3lEQj0KLLhMNIb9jN1fjtGU9pb6LJ57maSEtxYU8ryqtQQgzvGMTZ5u7lcKG0Em7Rt9imZqYV3Ww6QEK+aIdfcid9LtlgLZ6UONvyEReN/m30G//hCmyEHCw/tU0mlGDzRctFu7Rhpq4sWBxR8wZax1cE4rNbXIqxf9i4uCQszFMjKzwajTizcP5kJhiEER0ioxM4COXQxlHTqBZfSONqh3JH3bYVr/poLoGjWsl2ECS/hr5G8SGoyOQkQjPo1CeourFsGgvaPbAGyfUSSbRdV86yBhly0kk23nQ== 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:(13230040)(1800799024)(36860700013)(7416014)(376014)(82310400026)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2024 17:46:17.8065 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fef6495c-1897-491a-e844-08dd19428cf5 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: MN1PEPF0000ECD5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7974 By registering the nvdec with actmon, engine load information can be exported to the user through debugfs for engine profiling purpose. Signed-off-by: Johnny Liu --- drivers/gpu/drm/tegra/nvdec.c | 82 ++++++++++++++++++++++++++++++++++- 1 file changed, 80 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tegra/nvdec.c b/drivers/gpu/drm/tegra/nvdec.c index 2d9a0a3f6c381..b7c572484d1be 100644 --- a/drivers/gpu/drm/tegra/nvdec.c +++ b/drivers/gpu/drm/tegra/nvdec.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2015-2022, NVIDIA Corporation. + * SPDX-FileCopyrightText: Copyright (c) 2015-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ #include @@ -22,8 +22,21 @@ #include "riscv.h" #include "vic.h" -#define NVDEC_FALCON_DEBUGINFO 0x1094 +#define NVDEC_FW_MTHD_ADDR_ACTMON_ACTIVE_MASK 0xCAU +#define NVDEC_FW_MTHD_ADDR_ACTMON_ACTIVE_BORPS 0xCBU +#define NVDEC_FW_MTHD_ADDR_ACTMON_ACTIVE_WEIGHT 0xC9U +#define NVDEC_FALCON_UCLASS_METHOD_OFFSET 0x40 +#define NVDEC_FALCON_UCLASS_METHOD_DATA 0x44 +#define NVDEC_FALCON_DEBUGINFO 0x1094 #define NVDEC_TFBIF_TRANSCFG 0x2c44 +#define NVDEC_TFBIF_ACTMON_ACTIVE_MASK 0x2c4c +#define NVDEC_TFBIF_ACTMON_ACTIVE_BORPS 0x2c50 +#define NVDEC_TFBIF_ACTMON_ACTIVE_WEIGHT 0x2c54 + +#define NVDEC_TFBIF_ACTMON_ACTIVE_MASK_STARVED BIT(0) +#define NVDEC_TFBIF_ACTMON_ACTIVE_MASK_STALLED BIT(1) +#define NVDEC_TFBIF_ACTMON_ACTIVE_MASK_DELAYED BIT(2) +#define NVDEC_TFBIF_ACTMON_ACTIVE_BORPS_ACTIVE BIT(7) struct nvdec_config { const char *firmware; @@ -306,6 +319,56 @@ static int nvdec_load_falcon_firmware(struct nvdec *nvdec) return err; } +static void nvdec_actmon_reg_init(struct nvdec *nvdec) +{ + if (nvdec->config->has_riscv) { + nvdec_writel(nvdec, + NVDEC_FW_MTHD_ADDR_ACTMON_ACTIVE_MASK, + NVDEC_FALCON_UCLASS_METHOD_OFFSET); + nvdec_writel(nvdec, + NVDEC_TFBIF_ACTMON_ACTIVE_MASK_DELAYED | + NVDEC_TFBIF_ACTMON_ACTIVE_MASK_STALLED | + NVDEC_TFBIF_ACTMON_ACTIVE_MASK_STARVED, + NVDEC_FALCON_UCLASS_METHOD_DATA); + nvdec_writel(nvdec, + NVDEC_FW_MTHD_ADDR_ACTMON_ACTIVE_BORPS, + NVDEC_FALCON_UCLASS_METHOD_OFFSET); + nvdec_writel(nvdec, + NVDEC_TFBIF_ACTMON_ACTIVE_BORPS_ACTIVE, + NVDEC_FALCON_UCLASS_METHOD_DATA); + } else { + nvdec_writel(nvdec, + NVDEC_TFBIF_ACTMON_ACTIVE_MASK_DELAYED | + NVDEC_TFBIF_ACTMON_ACTIVE_MASK_STALLED | + NVDEC_TFBIF_ACTMON_ACTIVE_MASK_STARVED, + NVDEC_TFBIF_ACTMON_ACTIVE_MASK); + nvdec_writel(nvdec, + NVDEC_TFBIF_ACTMON_ACTIVE_BORPS_ACTIVE, + NVDEC_TFBIF_ACTMON_ACTIVE_BORPS); + } +} + +static void nvdec_count_weight_init(struct nvdec *nvdec, unsigned long rate) +{ + const struct nvdec_config *config = nvdec->config; + struct host1x_client *client = &nvdec->client.base; + u32 weight; + + host1x_actmon_update_client_rate(client, rate, &weight); + + if (!weight) + return; + + if (!config->has_riscv) { + nvdec_writel(nvdec, weight, NVDEC_TFBIF_ACTMON_ACTIVE_WEIGHT); + } else { + nvdec_writel(nvdec, + NVDEC_FW_MTHD_ADDR_ACTMON_ACTIVE_WEIGHT, + NVDEC_FALCON_UCLASS_METHOD_OFFSET); + nvdec_writel(nvdec, weight, NVDEC_FALCON_UCLASS_METHOD_DATA); + } +} + static __maybe_unused int nvdec_runtime_resume(struct device *dev) { struct nvdec *nvdec = dev_get_drvdata(dev); @@ -331,6 +394,10 @@ static __maybe_unused int nvdec_runtime_resume(struct device *dev) goto disable; } + nvdec_actmon_reg_init(nvdec); + nvdec_count_weight_init(nvdec, clk_get_rate(nvdec->clks[0].clk)); + host1x_actmon_enable(&nvdec->client.base); + return 0; disable: @@ -346,6 +413,8 @@ static __maybe_unused int nvdec_runtime_suspend(struct device *dev) clk_bulk_disable_unprepare(nvdec->num_clks, nvdec->clks); + host1x_actmon_disable(&nvdec->client.base); + return 0; } @@ -532,12 +601,20 @@ static int nvdec_probe(struct platform_device *pdev) goto exit_falcon; } + err = host1x_actmon_register(&nvdec->client.base); + if (err < 0) { + dev_info(&pdev->dev, "failed to register host1x actmon: %d\n", err); + goto exit_client; + } + pm_runtime_enable(dev); pm_runtime_use_autosuspend(dev); pm_runtime_set_autosuspend_delay(dev, 500); return 0; +exit_client: + host1x_client_unregister(&nvdec->client.base); exit_falcon: falcon_exit(&nvdec->falcon); @@ -549,6 +626,7 @@ static void nvdec_remove(struct platform_device *pdev) struct nvdec *nvdec = platform_get_drvdata(pdev); pm_runtime_disable(&pdev->dev); + host1x_actmon_unregister(&nvdec->client.base); host1x_client_unregister(&nvdec->client.base); falcon_exit(&nvdec->falcon); } From patchwork Tue Dec 10 17:45:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johnny Liu X-Patchwork-Id: 849595 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2071.outbound.protection.outlook.com [40.107.212.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DED1214211; Tue, 10 Dec 2024 17:46:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733852787; cv=fail; b=pwvV8UsJzvWsanUYCirrpVjHl6BkqEMwQSfyAV9iQPL07bfhgq0ECQ0ZRMMxQoKmQE1Mpx5JfzFqwdkcmiwndK+qNAamPe92ual5o/u9lCI6GeAo0ut4TRhVGJic1HtBo2nm8/0Wqz6QwdvvkO2GvI43TeAXNgjzB1BdO3Z1W2s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733852787; c=relaxed/simple; bh=9EhYSFWsRus1+fVauRO2T+umX6Yu6+CNmfYkzKXcU78=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cJy27XUayN6HXGblbeXE/ZTotfVPjZBfm29iKmcnPmCzo6QTXLaZP5geclIvkBcoMiWXLkuK+QCHnVU+UG14hSvNetS+xYIOmlsgNZwVZc47ntB7Nvet8SEaEp+Vp5idUAe0inBzJuKN9Wly62VRj/GoTJ+Pkb1Sf3Ztb7qO9mA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Mhd+/GeX; arc=fail smtp.client-ip=40.107.212.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Mhd+/GeX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VXiAxaSC49CkbfgOHX++pMFqXIu1DTZsbmS3OpcWB+RlpG3Vnvh+qZEv6Nw6Llx1+TBCvYpmoLcXHgUcucdvDWtDPMt5QyGK58Syb4pBNjc1C/IH5EAXlzEUe8XsBqXUwhiv8rfm2VJjDv+ISzpoQuEpM+uHQr8A1Dg/vFP4IQc8tDlDywIrAwrnLZTDi9MNVxlzMjef8ZriZYJAvdnm8cWrOw3lm+aLvUBEcieM06lQnk6a/tRsLam6lm1jzNIXt8vzZ75Jv713uT/pAO1XpOb9/cQ/2Mlq7XeAfweYAIdDRgAaPGAEVJ9gzxM14ryiFvCKzIP8tS+9s3eUuqmCVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=6s1mgzYgjubaFe5vz2yf25UsogL8btmVF5U9yte3mAQ=; b=ck6qIdWTuSX0u14YWcjWWuAKiQ6l3C07klEtNes+OcjtX5CidUo0rKj4qv+9qLZ1DfUBKBXh85xxrlXSJvydePhGH5H8hi5V2P2z8O5Ukln5Ih/p5m7CbGwcjtueWHoXDByU/hMK2BW4JdRaAh8PwAeLFlbbenJoC6MEE9ll5wH0CJafNqKUq07jgrk4f+NlhW+ckDS5gCYUx+HU5eKjZ1ci7HSgsASIicmz6S4yix2aIvdKm3CO//3alJVfqEXaQgBjIMD0d/GD2ixp7yEXCDhLwkZVbrO7196wSs/896jm0QdPKu9zewRHbKh9mPij8VQEjpC+KSACQ7XU3JV+zQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=gmail.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 (0) 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=6s1mgzYgjubaFe5vz2yf25UsogL8btmVF5U9yte3mAQ=; b=Mhd+/GeXEtBWMhXR1YkZxq2Thk8Q2KD3m4Ds6+8FoagZGaVu1VviIFsN9FkVSTad9GME7E/UdombEUzxCoT0RNlKxkSQB4cjEdVqulfggPYI8Dq2bC4iMd9WBHsNjf5fsUh7PZK18BsqYz6iuL9PtTqpQu7S073l6jgXPVxIY5zVYaFxvVAFeasHwWtj8bpLCaXcPT/vAunZ7EeBW+ZZtmZgHvAxeGRQFWKKFN2H+BL89wcz3n0LDNsFXhBeZagCetxGOvflQyUbd2TUxrFd9aJ4L9FBhBzLKxDh2twORfx9n1FDZkTwcYJm7TRc9OY9vzyrOqCfk6Ls4QOS65Fykw== Received: from BL6PEPF00013E0A.NAMP222.PROD.OUTLOOK.COM (2603:10b6:22e:400:0:1001:0:12) by DS0PR12MB7653.namprd12.prod.outlook.com (2603:10b6:8:13e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Tue, 10 Dec 2024 17:46:18 +0000 Received: from MN1PEPF0000ECD9.namprd02.prod.outlook.com (2a01:111:f403:f902::3) by BL6PEPF00013E0A.outlook.office365.com (2603:1036:903:4::4) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8158.23 via Frontend Transport; Tue, 10 Dec 2024 17:46:18 +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 MN1PEPF0000ECD9.mail.protection.outlook.com (10.167.242.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.15 via Frontend Transport; Tue, 10 Dec 2024 17:46:18 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) 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.1544.4; Tue, 10 Dec 2024 09:46:01 -0800 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 10 Dec 2024 09:46:01 -0800 Received: from thinkpad-t480.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Tue, 10 Dec 2024 09:46:00 -0800 From: Johnny Liu To: , , , , , , , , , , , , CC: , , , , , Johnny Liu Subject: [PATCH v1 5/5] drm/tegra: vic: Register the device with actmon Date: Tue, 10 Dec 2024 09:45:54 -0800 Message-ID: <20241210174554.18869-6-johnliu@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241210174554.18869-1-johnliu@nvidia.com> References: <20241210174554.18869-1-johnliu@nvidia.com> X-NVConfidentiality: public Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD9:EE_|DS0PR12MB7653:EE_ X-MS-Office365-Filtering-Correlation-Id: 914034bc-590a-433e-5265-08dd19428d7f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|82310400026|376014|1800799024|36860700013|921020; X-Microsoft-Antispam-Message-Info: gdSIMqV62+OgdIjAGgyvsZqDn7wcWuT+o7wDxiz5r2TCAteSDn9yRPiY6RPtiYLq/eYUdBPrqETTXm/WhOGb236zNOVIpRWtGogJOt3XVwqY+I7q7hAPu5jpdrp8FEyK9HvHnqSZg8lmnU3jmFExePH7M7/SP3LY1oY8boKgvmI7tOBwOuj9qAB9Sjq+e/pZGKBEmFTiSQita0nDhq3UD4/gsSIFXU8VwIy24WiKJMerbq2DNmiwVvoHW4ObcK0oV0ZR6m1bxh52w0fjM0MjBu3RFUcChZt5Yx2v/lXKY33a4jJE7pGFttwfGWB8V4hq6GTTY90qLOXxRwsoNitfqgQemeXXmL+lwuXDcIlsZH4NUAgAA0+BUJ4kYy436Omi5atSkqYWaDUGuvRntFOln4MvZE8GLvAjBjlK+z1ea+YPfPUUfthlJ+MkRuFLzdS3SOm+CWSafELnr42whJNo1og56FhpNtEzwzrwgJ4s0WAhf4H7h9iQTHoT6RlNURRLYKq5L5V7S0Nhr5lasgslg53HSgY4rLsPYVDKL/y7xfEh2nmdZuKbbiumxRPSXQgRzEABfVglmueyZsFNqsLLzGTsvGBPLhiAAdAEpqf4hxePM5SXSaYwPXd+cs0Phe0JxcHatRqYn+hrbsyyae1eGPPWfMks/fQktH6NEY25OxhOsf2UYA27OET5imOKqMlI1ozShDH9vL0kDr59zF83SGHb42SXpDxQRReCrH/OZ0Z9/OwvsvrpLq5B0gQn2/c5Jmls3p09tEmixMWArwGqiG4Alq6AQ4waiZ7mi/wa9IlEWoE1cfzZ3uPP+ufZB3FCGKg9TJbJppLYk34s3+NakP5l4R3M8klqCW/Sa9X6IbBxpKF16O6XAPG03KYATgRGfGOXKHgrCP3HGkz4BdD9F9t44vdig865mLlaSpaBlCI0PtYOXaCKvbvPYEBuC/M5Vt+WK4bLiMjZWLwyWiK/Gx1t8gj6Hyig2YeRyV058e/QuXRlCMLx/3u3uDMGF2t8Nk37niZIkAhAFDzn/1+Zg4OX7DZqK+qz25wCP9YMYxqnaNZOsDNb5NjYRen8D3fmC0sPfv6L2LzFdScWUaYMOBGb5TaD1uNX5TDYMY5TzJHonDC7iZyUrxrqZGVdDuu70OmZUi027Sw9arEovcKS6SGzIjYvUoyRwcf5JJWwtzIV+BNS1mhebNTqb37VWVyOQN3UH6HRvXgSGS1tJzBB8HyJdtJiC8F13pXLOKpuLMxU7ft8gMkKIVShHkzeGe4kQ/oCFqVjWhlN0kCWyrWu43kK3SGCDdrX8zDf1/JdVlIpY77zjguynYrIGyY0wMy9uL04nbN3+NYYAeBwzArQVIu7unlUtqSwleMrl8omQvFCImSqxeWorxXOa5o74NG1Vzr70slsnRYIiXnBUgYBXa9uKpz8ZDYMj5zxd6e7FjUO0Sbl44LRGssLpkHAz/O6VQ2hImw9Lny58u8LdzK+dg== 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:(13230040)(7416014)(82310400026)(376014)(1800799024)(36860700013)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2024 17:46:18.7071 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 914034bc-590a-433e-5265-08dd19428d7f 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: MN1PEPF0000ECD9.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7653 By registering the vic with actmon, engine load information can be exported to the user through debugfs for engine profiling purpose. Signed-off-by: Johnny Liu --- drivers/gpu/drm/tegra/vic.c | 39 ++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/tegra/vic.h | 9 +++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index 332c9b563d3f4..54c9b9b2af0a2 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2015, NVIDIA Corporation. + * SPDX-FileCopyrightText: Copyright (c) 2015-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ #include @@ -302,6 +302,28 @@ static int vic_load_firmware(struct vic *vic) return err; } +static void vic_actmon_reg_init(struct vic *vic) +{ + vic_writel(vic, + VIC_TFBIF_ACTMON_ACTIVE_MASK_STARVED | + VIC_TFBIF_ACTMON_ACTIVE_MASK_STALLED | + VIC_TFBIF_ACTMON_ACTIVE_MASK_DELAYED, + NV_PVIC_TFBIF_ACTMON_ACTIVE_MASK); + vic_writel(vic, + VIC_TFBIF_ACTMON_ACTIVE_BORPS_ACTIVE, + NV_PVIC_TFBIF_ACTMON_ACTIVE_BORPS); +} + +static void vic_count_weight_init(struct vic *vic, unsigned long rate) +{ + struct host1x_client *client = &vic->client.base; + u32 weight = 0; + + host1x_actmon_update_client_rate(client, rate, &weight); + + if (weight) + vic_writel(vic, weight, NV_PVIC_TFBIF_ACTMON_ACTIVE_WEIGHT); +} static int __maybe_unused vic_runtime_resume(struct device *dev) { @@ -328,6 +350,10 @@ static int __maybe_unused vic_runtime_resume(struct device *dev) if (err < 0) goto assert; + vic_actmon_reg_init(vic); + vic_count_weight_init(vic, clk_get_rate(vic->clk)); + host1x_actmon_enable(&vic->client.base); + return 0; assert: @@ -352,6 +378,8 @@ static int __maybe_unused vic_runtime_suspend(struct device *dev) clk_disable_unprepare(vic->clk); + host1x_actmon_disable(&vic->client.base); + return 0; } @@ -520,12 +548,20 @@ static int vic_probe(struct platform_device *pdev) goto exit_falcon; } + err = host1x_actmon_register(&vic->client.base); + if (err < 0) { + dev_info(&pdev->dev, "failed to register host1x actmon: %d\n", err); + goto exit_client; + } + pm_runtime_enable(dev); pm_runtime_use_autosuspend(dev); pm_runtime_set_autosuspend_delay(dev, 500); return 0; +exit_client: + host1x_client_unregister(&vic->client.base); exit_falcon: falcon_exit(&vic->falcon); @@ -537,6 +573,7 @@ static void vic_remove(struct platform_device *pdev) struct vic *vic = platform_get_drvdata(pdev); pm_runtime_disable(&pdev->dev); + host1x_actmon_unregister(&vic->client.base); host1x_client_unregister(&vic->client.base); falcon_exit(&vic->falcon); } diff --git a/drivers/gpu/drm/tegra/vic.h b/drivers/gpu/drm/tegra/vic.h index acf35aac948b2..905cd7bfde2f6 100644 --- a/drivers/gpu/drm/tegra/vic.h +++ b/drivers/gpu/drm/tegra/vic.h @@ -21,6 +21,15 @@ #define CG_IDLE_CG_EN (1 << 6) #define CG_WAKEUP_DLY_CNT(val) ((val & 0xf) << 16) +#define NV_PVIC_TFBIF_ACTMON_ACTIVE_MASK 0x0000204c +#define NV_PVIC_TFBIF_ACTMON_ACTIVE_BORPS 0x00002050 +#define NV_PVIC_TFBIF_ACTMON_ACTIVE_WEIGHT 0x00002054 + +#define VIC_TFBIF_ACTMON_ACTIVE_MASK_STARVED BIT(0) +#define VIC_TFBIF_ACTMON_ACTIVE_MASK_STALLED BIT(1) +#define VIC_TFBIF_ACTMON_ACTIVE_MASK_DELAYED BIT(2) +#define VIC_TFBIF_ACTMON_ACTIVE_BORPS_ACTIVE BIT(7) + #define VIC_TFBIF_TRANSCFG 0x00002044 #define TRANSCFG_ATT(i, v) (((v) & 0x3) << (i * 4)) #define TRANSCFG_SID_HW 0