From patchwork Mon Oct 16 05:34:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422510 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 749581FA9 for ; Mon, 16 Oct 2023 05:34:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="bzs6M8Zm" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2070.outbound.protection.outlook.com [40.107.237.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2409ED; Sun, 15 Oct 2023 22:34:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U1Q7QKa3ruGA4rmvraQ3lEADNcz4L4ojGZBMA+o+rPKjDiP9Iu0WzfePYKvtJiwiscxIFu5ifauKh0H/wBURCpFfs0upOHQaijoZiqavPRGDRYrRc2CyFlnTGyYAzutzGLrcxqAGM+yzlYyLM0XrLpu2WMKCtyA4O5oWBLdK6v58qKp/P+xEluugswuaSP5U0JhsKrZVgKXKevkFVpq8+LmgZYeFYrHA3PfEIJX5WaQbKEjUujXSCIBoASymquAlWoVL4MRLe30nqMefYa30wGvkqCercKFFf0s+jPDdcz0dhMgNkqbi2pyOPBhdeqjzLRzKL9JJRobQjIC8PClNbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kEdGy8EGffjLOVahWgd5/Q4+67B31sO+LdNTQ+9iJ4E=; b=jOAv6Sa/y6ZcR6GtwSFoK7BDPpveDL4sMoTLRa2nt9Oipm+MgNG5uXn1785zE3PBjo/ud2oLkUGlEnAalvJe590jw3flt61qnFvl7aGVLpeWzFUZMZP4HQJ9UyvlCjzRl/f1A5GIlhc3FQwO+eaaqCtwGhWukpMbgckrr6Gyto82Yb5lwVlNJd89DKOQPEHRmY02GSNRIyHBjtCU1J/US+WJXCW+kpof3DufvNi0Y1gW8TMfg2HFDUv0uclXLd5iRPrSLPkfyM7xasX2KkdSNduxiMvKNd/PKk0g2uHwgZ+bqwQAuIIG3/lqK1i7xYBHjm5z/C0y1S0TNJli8JnzTg== 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 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=kEdGy8EGffjLOVahWgd5/Q4+67B31sO+LdNTQ+9iJ4E=; b=bzs6M8ZmSTXtpaf2Dbn2lIBvo4bUQnkhXy5C1y/l8bnyhhenWd/VSA957oQSDpK9Yl+Q5m482dhTwEPcFu3UeBu8fet20vgwo8DwnJuaUssBzRsR91DLaz0rrFWJLmVmMfGqYbpu1LfCp5h7fi7cv2peur5p40cEeybTXBtq5yJtjICkV3sV9bg6KWM/a0HjPbbfZvW+iNkiDPKgYtIR6RPXd3wfbSgdGIP0PwLYPuBjfZxjmhAOQNMgAEh+sFJunfBnRaJss2LO69jrdUx2ibHtyPBTXgdFfLb5MJwFbthEholgvxH5TEzOafHBJUpyxn+gxdqMij+W6AsNKEPDfw== Received: from SA0PR11CA0079.namprd11.prod.outlook.com (2603:10b6:806:d2::24) by DM3PR12MB9436.namprd12.prod.outlook.com (2603:10b6:8:1af::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.34; Mon, 16 Oct 2023 05:34:27 +0000 Received: from SA2PEPF00001507.namprd04.prod.outlook.com (2603:10b6:806:d2:cafe::79) by SA0PR11CA0079.outlook.office365.com (2603:10b6:806:d2::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Mon, 16 Oct 2023 05:34:27 +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 SA2PEPF00001507.mail.protection.outlook.com (10.167.242.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 05:34:27 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:26 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:25 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Sun, 15 Oct 2023 22:34:21 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 1/8] mm/util: Introduce kmemdup_array() Date: Mon, 16 Oct 2023 11:04:04 +0530 Message-ID: <20231016053411.3380-2-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016053411.3380-1-kkartik@nvidia.com> References: <20231016053411.3380-1-kkartik@nvidia.com> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001507:EE_|DM3PR12MB9436:EE_ X-MS-Office365-Filtering-Correlation-Id: 532511ea-9c7d-4680-11ab-08dbce099082 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JIqjJSYk9cle5q0KrE6X1zbwBG4mHKYoAsBFKjjGY9LvyjaNaHf7jYGmx2rPwenjZilMZYZwqy3hPmJYZ+E1psL6VD0h6l9gc3NZ2nrkktG8Ma9ZDAGeZDamkcPfDPMr/Ggpf6+hSARsTWARpXoVbeUS4ZYnFndqKC+dDYVU1iy8T3WZmIJIe/KGHaeq+xWybOTCwuduHUBDbU7Hwd4wAQXQNMAi1Jh3ZN6ESlb5z/l+BAOF1a8v8xFLURYSLaEEqhYP4iYJd2L23QqxJCyyia8n//0NCulUU1jdARDHlSP8PHecWcEekasLdDCIAc5OCxwQX3X4oKX2liLnxrqkJJGjGO1vkFdlLbSk8PbAJ8U2xXj63KL0ZAhMc0qlkIZnBPQ6ScSxbzie8asew6eSgxXS2wIIKCP0jtQnG7ypfVzlRRkWkR4rpw/yeNpMIjsPW9uMavtu+3xyDZJTTIoM/SYfAFbzds6gIJphH+3ilTxJiuHZe9weKnv9nr1dmC/AwhP/1HWsEPJ9H9RWX9PNyrgN8qfwxffmWUm/Yvh0PpJ3iQzT9PL5l7J2wV2P6rkZwyrYgV6zjexNNsZRmsEy/muknAWG0SFRRecNhT+9M3CWF0eJ6uLzIAUEITlXNMpzCGl3AE8LMuM7UKTgE6N8hFRx3YoKtIJCltFS/XnJ6/yWM3v0xBuQSILXqSseYzcRvrSg0GJp1VzubKvX0vmrByfn6e/VzuYebmzM/IQGISwo5A3w/lHGAeNwzykHl5Kw0Jw1suRn0AB3Hl867d2YTA== 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:(13230031)(4636009)(396003)(39850400004)(346002)(376002)(136003)(230922051799003)(1800799009)(64100799003)(186009)(82310400011)(451199024)(36840700001)(46966006)(478600001)(426003)(70206006)(70586007)(316002)(110136005)(1076003)(2616005)(336012)(26005)(6666004)(8676002)(8936002)(5660300002)(41300700001)(7416002)(2906002)(86362001)(36756003)(7636003)(921005)(356005)(82740400003)(36860700001)(47076005)(40480700001)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 05:34:27.6121 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 532511ea-9c7d-4680-11ab-08dbce099082 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: SA2PEPF00001507.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB9436 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Introduce kmemdup_array() API to duplicate `n` number of elements from a given array. This internally uses kmemdup to allocate and duplicate the `src` array. Signed-off-by: Kartik Acked-by: Kees Cook --- v4 -> v5: * Simplify the implementation by just returning kmemdup(size_mul). --- include/linux/string.h | 1 + mm/util.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/linux/string.h b/include/linux/string.h index 3c920b6d609b..fcfa1062c79b 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -180,6 +180,7 @@ extern char *kstrndup(const char *s, size_t len, gfp_t gfp); extern void *kmemdup(const void *src, size_t len, gfp_t gfp) __realloc_size(2); extern void *kvmemdup(const void *src, size_t len, gfp_t gfp) __realloc_size(2); extern char *kmemdup_nul(const char *s, size_t len, gfp_t gfp); +extern void *kmemdup_array(const void *src, size_t element_size, size_t count, gfp_t gfp); extern char **argv_split(gfp_t gfp, const char *str, int *argcp); extern void argv_free(char **argv); diff --git a/mm/util.c b/mm/util.c index 6eddd891198e..8801446140d6 100644 --- a/mm/util.c +++ b/mm/util.c @@ -135,6 +135,23 @@ void *kmemdup(const void *src, size_t len, gfp_t gfp) } EXPORT_SYMBOL(kmemdup); +/** + * kmemdup_array - duplicate a given array. + * + * @src: array to duplicate. + * @element_size: size of each element of array. + * @count: number of elements to duplicate from array. + * @gfp: GFP mask to use. + * + * Return: duplicated array of @src or %NULL in case of error, + * result is physically contiguous. Use kfree() to free. + */ +void *kmemdup_array(const void *src, size_t element_size, size_t count, gfp_t gfp) +{ + return kmemdup(src, size_mul(element_size, count), gfp); +} +EXPORT_SYMBOL(kmemdup_array); + /** * kvmemdup - duplicate region of memory * From patchwork Mon Oct 16 05:34:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422511 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 CA0751FA9 for ; Mon, 16 Oct 2023 05:34:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="e3pEKWdX" Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2087.outbound.protection.outlook.com [40.107.100.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69CB7E6; Sun, 15 Oct 2023 22:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QDo9/AomUqjuBwCcgb7TGRfhKQVklWGtvWosxgBMrqrTDr//7yrUcxRDIyFKhZeEao4Sw1pTq6O/YYg5avjXM+nJrieBJkzsMLQQndSdtKaOstpAcR9esaB+jSPSyLLViGyV8ejrNSvxzuN74402kY2w5HEHIFDyz/cZQN6uCIfD/zemkctQixoKVt6OYfNMftL8e/pTNtZEJK/K7tV5krQ758il4Cve38oyiVZ/PZjU/uilWyoN2sIKhOY2+uRtF1H08rPcmcoXpW4Zh1rkSGUICtZuL5dew5RzzA5NjrCe1KLp5QukjEFomXtRkUQdOnZxzaBcnmiCuLBYyKu8Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uAxNN1B8Aq1rvOj2d6rD47BDQcgdbvf1bV0VdIQGpLo=; b=ApGyS4WakQlUTpPJXVHshZLenAWa22s4GGKtI0L6VrvWShA2Zp1SQUToxW8gK2MzDfWXPU9bO+0lmaUEpKxJgfkW4puTI+bdgdL3whZESuyUhc6cLHGTN7k3fNW4Dt7U0jE6AojyzhMSif4kdbkXUACQBGD5Naz6visB16r3zr+W6UbGzBXlkPWyAiS/8ckOSFLlEjQlvuImhzu6TuvDB0us7ZUqKHBSzPniKEevy/pftlHc/TmxBYeq7hbhNVZI50ldulumQBibYAt71asuhD3pZ/vFE0HntWD42LkbEbi/LX5NXTCCBBQxEEmLiHtKGMWrYdrc+jwRJx0TBqSvLg== 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 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=uAxNN1B8Aq1rvOj2d6rD47BDQcgdbvf1bV0VdIQGpLo=; b=e3pEKWdX4tU+8OqD1qBIerNVUWoEMMg+QfpTUtxvJl49A94xfxs7YY+AzwRv7jQNVKrHg7cPionjWpy07NR/gok6ZMXT0gGoz2SJJKaFh6fu1Qudpl50hHVuHrJoFkPK8sBkDpsPdMpwzSdqEa0929DOAUhJv5HE42L+kvBazInsBnHIedAIaMYn+XCAY9nCscGxa5CaRj62+sSmrwiCeAfkdMzwfb9KksOrSnLCvdcUqdyQcRrxicRBlCrNOvnmuyF3EhgKYPXEG1iJvAohBuMg4rRsfMyURfItsgyjhurtsO4+rchlgUUmSKaYO1SCTPDNIOyKt2mjsPMSDKMbHg== Received: from DM6PR06CA0021.namprd06.prod.outlook.com (2603:10b6:5:120::34) by SN7PR12MB6814.namprd12.prod.outlook.com (2603:10b6:806:266::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Mon, 16 Oct 2023 05:34:39 +0000 Received: from DS1PEPF0001709C.namprd05.prod.outlook.com (2603:10b6:5:120:cafe::8f) by DM6PR06CA0021.outlook.office365.com (2603:10b6:5:120::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Mon, 16 Oct 2023 05:34:39 +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 DS1PEPF0001709C.mail.protection.outlook.com (10.167.18.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 05:34:39 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:32 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:31 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Sun, 15 Oct 2023 22:34:26 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 2/8] soc/tegra: fuse: Use dev_err_probe for probe failures Date: Mon, 16 Oct 2023 11:04:05 +0530 Message-ID: <20231016053411.3380-3-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016053411.3380-1-kkartik@nvidia.com> References: <20231016053411.3380-1-kkartik@nvidia.com> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0001709C:EE_|SN7PR12MB6814:EE_ X-MS-Office365-Filtering-Correlation-Id: 9739b100-a834-49b3-0c20-08dbce099784 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IBRKZELZzpFH10UvxHe0vEgypkH6Y911Kk0BctBFcXGaBZI5cogSodzvd4yCqrGBpk88KK4qWgmGDi7JeUBhWLHM00DZjVOX5IA+w0wc/T5wfmZB1VDfWaTvUqouGUuZk/GwNArAiSaVWU01hX0Nxd/B37bpyO/ZvKSC6VIpIRkns2K1C4rOcBdt5MwANFnf83oYhSJXoMq8OlO3c85HPestrOBNfKNi4dCetlUALD//aO3frin/l4KHshYgnB2g+s+2lBii6avVhM7iHOgb0JSBTG0WBGEtQ3cL+YzoT8To3Y6YSm2vHmDMnnAxf68u9CLhTWlkiSRjgbBYcaIUQnstiMBe1fFVAZhOPNfBd+iE8+gdLF6OgXiz1Zwr6vk82rzluqjjx8qbn/fihRvwqTaWdr38+sCXw40fhJW08b9ddCoIK3kLZPsH5BeWcWJ5kbBUMUqGmdkpCNyxsGXe8KuTy/Z28zA1+W3Zj29ZfG58zUGGomvco9hxhUbGLAiLSkAh7/BOI4BifO0VF1y5+6E8ntx9eEoLxKQZm8jg88jlwWYHddUpth8shT5KmgpswNBKJ+gtetXcvDmaabyI0sKvfToORdhGJ3ThlRXA48dhsP7heVRlE9CaXFnbpnYXOUImzMexKt12zr/VXY7nAJqrkgd0HVKU2SsbY7LhqFGYSI+q4b6LKQEQJqDLBEKqXh44Z2NT27/CyAp2WCndjWuxCOyg2RAfrT6mgCIna6A8R0Nibjf6wl19k4NeV8j8dnXx8EAorL0zNsjzbqLI2w+iAlhOjrev5VIDiK9cPtM= 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:(13230031)(4636009)(39860400002)(346002)(376002)(136003)(396003)(230922051799003)(64100799003)(82310400011)(1800799009)(186009)(451199024)(40470700004)(46966006)(36840700001)(478600001)(6666004)(70206006)(70586007)(110136005)(26005)(1076003)(336012)(426003)(2616005)(8676002)(8936002)(7416002)(2906002)(5660300002)(316002)(41300700001)(36756003)(86362001)(7636003)(921005)(47076005)(36860700001)(83380400001)(82740400003)(356005)(40480700001)(40460700003)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 05:34:39.3691 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9739b100-a834-49b3-0c20-08dbce099784 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: DS1PEPF0001709C.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6814 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Currently, in tegra_fuse_probe() if clock/reset get fails, then the driver prints an error if the error is not caused by -EPROBE_DEFER. This can be improved by using dev_err_probe() instead. So, return dev_err_probe() if clock/reset get fails. Signed-off-by: Kartik --- drivers/soc/tegra/fuse/fuse-tegra.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index a2c28f493a75..98805885158e 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -131,13 +131,8 @@ static int tegra_fuse_probe(struct platform_device *pdev) fuse->phys = res->start; fuse->clk = devm_clk_get(&pdev->dev, "fuse"); - if (IS_ERR(fuse->clk)) { - if (PTR_ERR(fuse->clk) != -EPROBE_DEFER) - dev_err(&pdev->dev, "failed to get FUSE clock: %ld", - PTR_ERR(fuse->clk)); - - return PTR_ERR(fuse->clk); - } + if (IS_ERR(fuse->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(fuse->clk), "failed to get FUSE clock\n"); platform_set_drvdata(pdev, fuse); fuse->dev = &pdev->dev; @@ -179,12 +174,8 @@ static int tegra_fuse_probe(struct platform_device *pdev) } fuse->rst = devm_reset_control_get_optional(&pdev->dev, "fuse"); - if (IS_ERR(fuse->rst)) { - err = PTR_ERR(fuse->rst); - dev_err(&pdev->dev, "failed to get FUSE reset: %pe\n", - fuse->rst); - return err; - } + if (IS_ERR(fuse->rst)) + return dev_err_probe(&pdev->dev, PTR_ERR(fuse->rst), "failed to get FUSE reset\n"); /* * FUSE clock is enabled at a boot time, hence this resume/suspend From patchwork Mon Oct 16 05:34:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422512 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 DDDC079FD for ; Mon, 16 Oct 2023 05:34:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="K+GhkQxb" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2043.outbound.protection.outlook.com [40.107.244.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84993F7; Sun, 15 Oct 2023 22:34:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O8CvTD65LUD8MyWcR2q3gonBCbXfAcNOrS9VYwv2HMzyDaWUyCjm7VqrDJCSobk+f9cQPH/vEUbjPa8z4RYzb5IXuFrOCi7bvpSROz9iZA89ODK86T1SV+8+154F7EOPUMbiN5LC9gq0VU0n2PStXPcPLG7j/+FGh3y/8iqoer0Dm8IptuSiItSY4UP14jrCxs7kFl+Z9yrXfRXmrtNbC8E1Tlz/RG9Pgp2mKQozKKev8hi/SrJjti5HGR5+gu3wZhNCSp6oNHLMaqarsE3z8r+S6LxG/yZ0nZbExqwKRKgQO1SFXAL2WHpsMSYBtigB91PZIEWxm1L/7BpgmeLXUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Re29ps3AiOSg4y0WBx8YIBQJTME/7AeggREHZrD4b44=; b=mamLsGc4sQXGfXU3fvBtlclFn+hMi9J9fVSOGZ51vInwG0Qo/VdL8x3iOOA41ZdKI/p2qGWe5VzYx8Suq26DXVfFfalG5dfpGR6zAUs96tZ51H9gllxLO/4omu619XoFTN4jpvAac8SlwDr6csFCeR8hebiY6En8sLEvNFSs+3A5hTAngHFm8LiZZUfEXb3luTOD4T01j9aKdvICvLbGo9RPbG7WSsa2fNyRI6dlEKrDOyBqctJ7cFU0gM3YJu1DcN3Eyv1JA5PeWhm0nP4rV+c4ApVc7b4pxbtgCHE+DkSuqLsaJzl7XEJIsvhC8CXhKr1bfqYwIBKRmuDVbeFOGw== 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 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=Re29ps3AiOSg4y0WBx8YIBQJTME/7AeggREHZrD4b44=; b=K+GhkQxbcfKSNRGLK2HBCC+W3h6ffp88FVuxE3dcImy+FaOURQ/MPE5RLcllQr4XPLTSXzXuBicfaOorMZdXcWB4zH9fQCI3zrrwbeQ97RPF/TJ1BseAH/GQVxfXSXF8HTnT5WSOk+5FEXbTpeh81R+e13TNKUDgfsPzIJET6bU6j+tYKny+0GzRnh00muoBKMWKjRnku3t/cIaeX8CeoBON1WTWVix1MJLvXBvUWVt9KD+hrGbESwJfzifGSTvl1XTxv+10sH/gk/YsD0KQKbgTTqjfLpmd05ZldRSasb4HJaVsFBPEnM6Dx/A601JOMycVCfSnVR8+tvkCzxTv6Q== Received: from SA0PR11CA0086.namprd11.prod.outlook.com (2603:10b6:806:d2::31) by CYXPR12MB9337.namprd12.prod.outlook.com (2603:10b6:930:d8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Mon, 16 Oct 2023 05:34:41 +0000 Received: from SA2PEPF00001507.namprd04.prod.outlook.com (2603:10b6:806:d2:cafe::b7) by SA0PR11CA0086.outlook.office365.com (2603:10b6:806:d2::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Mon, 16 Oct 2023 05:34:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00001507.mail.protection.outlook.com (10.167.242.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 05:34:41 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:38 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:37 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Sun, 15 Oct 2023 22:34:32 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 3/8] soc/tegra: fuse: Refactor resource mapping Date: Mon, 16 Oct 2023 11:04:06 +0530 Message-ID: <20231016053411.3380-4-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016053411.3380-1-kkartik@nvidia.com> References: <20231016053411.3380-1-kkartik@nvidia.com> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001507:EE_|CYXPR12MB9337:EE_ X-MS-Office365-Filtering-Correlation-Id: c31fbd33-0181-405b-5e6f-08dbce0998ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AG8YG7fENyNvGKJaTkKKwFAnu66pRMOcQVhSaXZypKL9hT3KqYrl3tyHBgt+kG7XGuF5cRR6pLXP+zlOs7eqZ5cT4vIHNVUJDY5veHSW50pW6qWFw2C81Tox4TcwZYZ7HD2KI9WK1JzeUpuJeJYuFVFNmRreoPmpGRzrh7l0BYfrtnEYsrz2RKD7k/kJM6jE2LLJRkaGxkvLjC7ZHeD3fosobslClm3MsU1J+ykgCG3+4phCSt8xepRuImV3oLibt2zLIQsjslmhBmbIJaNoCKO4GttAIyh2yeB1CyavfFzimWaeIWNEuClVKrXOWr6pnW3hAO04q9Z95bpq29nBwuz9CtbI2P0TMla22RlkR+Y/s/GuM5MXE4YN/LQRKsxrksJ5qAJkh4vdWYpEZ+qM72F+zskbmqvDRII3R6d+OS2PoBrPigW8Iu1F1ZhmmK0dHIBFU3B3+SvJyphtt8XRKP+KMP/16Y6n9OHtHuvNtgjLmMzYDRkCr0ZI6Cx+UgOqcBQLpmX+Ql9M+6AL1v2DASH8SQyLq/hnzPcH/TWr/d5DFx95LKCOBPMrgwF0SsCUa65q5NuK99+QEfneDfEIWRA7MtPQh77K3dmLHXPF7iuri0kKOHGUOZZAKByNLqy52M9G3JmrXUZbloe3ZX9hV/KOGCDGIu3xprGdmmex8G6T9sUeVQY0KSLXB4RGr2eR+6PSvasFcMTmHNQjUMpenr0O1CzN9IWtS4pmNnYdMVD5b0hRi1p0Ez6E4ry2bdHJEWCC7gxrUAHKACfT21CNh/v1R/QESRqR+cHuLKISoCYkFTHnPMRzqik7tROIm7TI 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:(13230031)(4636009)(396003)(136003)(376002)(346002)(39860400002)(230922051799003)(82310400011)(451199024)(64100799003)(1800799009)(186009)(46966006)(40470700004)(36840700001)(40480700001)(40460700003)(478600001)(70586007)(70206006)(110136005)(316002)(6666004)(47076005)(356005)(921005)(83380400001)(36860700001)(86362001)(82740400003)(26005)(1076003)(2616005)(336012)(426003)(36756003)(41300700001)(5660300002)(7636003)(8936002)(8676002)(7416002)(2906002)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 05:34:41.5339 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c31fbd33-0181-405b-5e6f-08dbce0998ce 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: SA2PEPF00001507.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR12MB9337 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To prepare for adding ACPI support to the tegra-apbmisc driver, relocate the code responsible for mapping memory resources from the function ‘tegra_init_apbmisc’ to the function ‘tegra_init_apbmisc_resources.’ This adjustment will allow the code to be shared between ‘tegra_init_apbmisc’ and the upcoming ‘tegra_acpi_init_apbmisc’ function. Signed-off-by: Kartik --- drivers/soc/tegra/fuse/tegra-apbmisc.c | 37 +++++++++++++++----------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c index da970f3dbf35..06c1b3a2c7ec 100644 --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c @@ -160,9 +160,28 @@ void __init tegra_init_revision(void) tegra_sku_info.platform = tegra_get_platform(); } -void __init tegra_init_apbmisc(void) +static void tegra_init_apbmisc_resources(struct resource *apbmisc, + struct resource *straps) { void __iomem *strapping_base; + + apbmisc_base = ioremap(apbmisc->start, resource_size(apbmisc)); + if (apbmisc_base) + chipid = readl_relaxed(apbmisc_base + 4); + else + pr_err("failed to map APBMISC registers\n"); + + strapping_base = ioremap(straps->start, resource_size(straps)); + if (strapping_base) { + strapping = readl_relaxed(strapping_base); + iounmap(strapping_base); + } else { + pr_err("failed to map strapping options registers\n"); + } +} + +void __init tegra_init_apbmisc(void) +{ struct resource apbmisc, straps; struct device_node *np; @@ -219,21 +238,7 @@ void __init tegra_init_apbmisc(void) } } - apbmisc_base = ioremap(apbmisc.start, resource_size(&apbmisc)); - if (!apbmisc_base) { - pr_err("failed to map APBMISC registers\n"); - } else { - chipid = readl_relaxed(apbmisc_base + 4); - } - - strapping_base = ioremap(straps.start, resource_size(&straps)); - if (!strapping_base) { - pr_err("failed to map strapping options registers\n"); - } else { - strapping = readl_relaxed(strapping_base); - iounmap(strapping_base); - } - + tegra_init_apbmisc_resources(&apbmisc, &straps); long_ram_code = of_property_read_bool(np, "nvidia,long-ram-code"); put: From patchwork Mon Oct 16 05:34:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422513 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 624D979FD for ; Mon, 16 Oct 2023 05:34:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="EJhiHXw/" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2087.outbound.protection.outlook.com [40.107.94.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 900A8127; Sun, 15 Oct 2023 22:34:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JEnHW0+I0hcVKdERWb4BJ3ZUJMEG9bMSEwftNQMlKAAcfxgJdQtbcSKr1NGjPldXnMmRP4KBGk43zAS/eByZTP/LygPjMRSqFwtVpKZzNDuoLz2zgFysSzZnGyD0UCjalCeKmeWKccnaoTQYhQr2A/JoO0O29XdFFxRwsJWMcE2e7vMljdonG9PvI9q0xy0izSxJuaG4cPWn5VxvWlmvofEFH4etjuOsNHpYyA1MYhxcYYv1dKujoudim6//Jc/er6TlSV8wjA6RirFAwTkw6GstrDIICn8RLzQg+pHFOff5VpAs+VSfwUD2v+Z+fXq/CqmeOM6Y7mczCdfiuklcBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=H+Fro14rgalH/06qabhLwOLhxQnp+Tg6JsjLLk27Cig=; b=mdYeQifIyCnTv/msJCmWj7O5FRd+MLXEI/hFFV/d7x0AZ3eF4g5K1jPPSkzolAR/dikaT7B1tuVsItHckZ2hztoFW8YoRE+ECIRJG1/UWCp4rEVsJIsuBiGt+OrIYOcLhKoFRrW9jf2yqXjXGYzrCqeD4EZJt9QNDNR0CaOz8EkgRJR5qABKPTvkGJWvGqhY1M8Aa4cMrR6uJpJ45ES6m+XKoiEcxeWz7CU4Qs9GNuMeqjd4XQ8VJsQKJTWc+MgxT4+CFv4PplFcATJeUGV3R8pRqjCqzX/nSj5YBA1DUbqfHwe8tSn/91/kOJMMNa+cVrHDkdBc6Nj6N5GSZwTc3Q== 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 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=H+Fro14rgalH/06qabhLwOLhxQnp+Tg6JsjLLk27Cig=; b=EJhiHXw/eQ0qSI0b50LirdGXbhE1hJAvKIrw96d8T/yvx+MvvN1ed0eENKkcO/KzodEaTzBng2DMeCkKnh7OLL3Z5BWA0GF2tOlcwne5n+kDVLg96twZ/Rcyyb2qPp4ZXmQ4QcH2glrzOH5MbzsQwzy41j9mhgZ1PeueKm1KTjuSTXStPE/NtlGzXaeqI4D7/EPSeWDv8iXUccGvWBx26/lr2Ix9H0DIGCBD06zN2iCEQ9gEq9Bj9YaQL3bfg+WP6WqF3+Vy/I/t/rPgy7P8hBTIas/30T6pG/70j7aufnDOAiotBFAWky1ADupdJNdaDhUf7rph0hIU9zh0FBKxxQ== Received: from SA0PR11CA0085.namprd11.prod.outlook.com (2603:10b6:806:d2::30) by DM6PR12MB4340.namprd12.prod.outlook.com (2603:10b6:5:2a8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.34; Mon, 16 Oct 2023 05:34:50 +0000 Received: from SA2PEPF00001507.namprd04.prod.outlook.com (2603:10b6:806:d2:cafe::a9) by SA0PR11CA0085.outlook.office365.com (2603:10b6:806:d2::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.34 via Frontend Transport; Mon, 16 Oct 2023 05:34:50 +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 SA2PEPF00001507.mail.protection.outlook.com (10.167.242.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 05:34:50 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:44 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:43 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Sun, 15 Oct 2023 22:34:38 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 4/8] soc/tegra: fuse: Add tegra_acpi_init_apbmisc() Date: Mon, 16 Oct 2023 11:04:07 +0530 Message-ID: <20231016053411.3380-5-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016053411.3380-1-kkartik@nvidia.com> References: <20231016053411.3380-1-kkartik@nvidia.com> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001507:EE_|DM6PR12MB4340:EE_ X-MS-Office365-Filtering-Correlation-Id: 02f06d93-628f-468d-7eec-08dbce099e43 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qP2r2GZDdysf7gyp370SU2VOGuNHyE5GxwcGlvPGzVC95X9NYVHnMS8VQbquYFgZuS2R/CqzDFkq1WCYxS6Al90XipBg+6zC3hjSWyrhFZpjtQt0AFf+OH2N4MeCvO6VEl+GMuMa+uPHPdw2oCj3M8mVqBDtRS8E2QN0YI8Fb8fUC0RIyA3LA8PhUpQpsLghhvOktMbgVzY6agGaP5rHlNbjivOp2ll7EQ1VL8sNf8ADpeFztE9xvqBiAqhtbxNR7yGkkM1LxqJB4dLe6hL1nARo51wfdVuFn2ct/cmHlT57v7Tsui5qFW/jZYQ2wOPkyc+IW0PLtsZrD6qnkT5XZejRrpRRccWlqWQJMpeYpcaVTTstP2BIKAiGcKjy8juECINaWVIXj9Ja5cV5wx+yStJO93fPgqJHGm8amQnSCDKbrwmq2Xr4/SCO8oBfr+CGwMFVKC9SaRAKK0V873+WQFrBF1dfk71WyiH48u+21GzIacerjZo7ZsxoRERchMoxK/R5B11JKNwm2yCs6jpm1xMEzXbuR+2XKJld42tDBDgOUWfCgO8Tld9uaKEWUfD8nVjcfQS7lLtcnu6x/SRuK7toethCXvjm0xUBuQ5qlv6pJwAuck4hyyziRpH+vQGTebLQ5fJfNB13CZi8HJ3fjgz4qTqQbjHLlp38N7FNsuT4s8EnhXSgidIbrsQcl4SS5jIgSWvsNUM6Rk/lmmxTBLLohjBOJnuHlBZVGvJnskrMzWiIwUES8EH0C51xQDy8aAXjMG34zEORfRP4dUYF4zhiZR0YJzoqDW4D0XrNUArIrBuEXT22JI9c1khz6Jtv 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:(13230031)(4636009)(136003)(39860400002)(396003)(346002)(376002)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(82310400011)(36840700001)(40470700004)(46966006)(478600001)(7416002)(36860700001)(26005)(2616005)(6666004)(5660300002)(8936002)(8676002)(83380400001)(41300700001)(47076005)(1076003)(316002)(2906002)(70586007)(70206006)(82740400003)(110136005)(336012)(426003)(7636003)(356005)(921005)(86362001)(36756003)(40460700003)(40480700001)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 05:34:50.7058 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 02f06d93-628f-468d-7eec-08dbce099e43 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: SA2PEPF00001507.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4340 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net In preparation to ACPI support in Tegra fuse driver add function tegra_acpi_init_apbmisc() to initialize tegra-apbmisc driver. Also, document the reason of calling tegra_init_apbmisc() at early init. Note that function tegra_acpi_init_apbmisc() is not placed in the __init section, because it will be called during probe. Signed-off-by: Kartik --- v2 -> v3: * Fix build warnings seen when CONFIG_ACPI is disabled by moving tegra_init_apbmisc table inside #ifdef CONFIG_ACPI block. v1 -> v2: * Update ACPI ID table 'tegra_init_apbmisc'. * Add comment to document the reason to call tegra_init_apbmisc at early init. * Fix an issue where acpi_dev_free_resource_list() and * acpi_dev_put() were not called if acpi_dev_get_memory_resources() returned 1. * Update logic to fetch memory resources in tegra_acpi_init_apbmisc(). * Fix build errors seen when CONFIG_ACPI is disabled. --- drivers/soc/tegra/fuse/fuse.h | 1 + drivers/soc/tegra/fuse/tegra-apbmisc.c | 72 ++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h index 90f23be73894..a41e9f85281a 100644 --- a/drivers/soc/tegra/fuse/fuse.h +++ b/drivers/soc/tegra/fuse/fuse.h @@ -69,6 +69,7 @@ struct tegra_fuse { void tegra_init_revision(void); void tegra_init_apbmisc(void); +void tegra_acpi_init_apbmisc(void); u32 __init tegra_fuse_read_spare(unsigned int spare); u32 __init tegra_fuse_read_early(unsigned int offset); diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c index 06c1b3a2c7ec..e2ca93de6c1f 100644 --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c @@ -3,9 +3,11 @@ * Copyright (c) 2014-2023, NVIDIA CORPORATION. All rights reserved. */ +#include #include #include #include +#include #include #include @@ -180,6 +182,12 @@ static void tegra_init_apbmisc_resources(struct resource *apbmisc, } } +/** + * tegra_init_apbmisc - Initializes Tegra APBMISC and Strapping registers. + * + * This is called during early init as some of the old 32-bit ARM code needs + * information from the APBMISC registers very early during boot. + */ void __init tegra_init_apbmisc(void) { struct resource apbmisc, straps; @@ -244,3 +252,67 @@ void __init tegra_init_apbmisc(void) put: of_node_put(np); } + +#ifdef CONFIG_ACPI +static const struct acpi_device_id apbmisc_acpi_match[] = { + { "NVDA2010" }, + { /* sentinel */ } +}; + +void tegra_acpi_init_apbmisc(void) +{ + struct resource *resources[2] = { NULL }; + struct resource_entry *rentry, *tmp; + struct acpi_device *adev = NULL; + struct list_head resource_list; + int rcount = 0; + int ret; + + adev = acpi_dev_get_first_match_dev(apbmisc_acpi_match[0].id, NULL, -1); + if (!adev) + return; + + INIT_LIST_HEAD(&resource_list); + + ret = acpi_dev_get_memory_resources(adev, &resource_list); + if (ret < 0) { + pr_err("failed to get APBMISC memory resources"); + goto out_put_acpi_dev; + } + + /* + * Get required memory resources. + * + * resources[0]: apbmisc. + * resources[1]: straps. + */ + resource_list_for_each_entry_safe(rentry, tmp, &resource_list) { + if (rcount >= ARRAY_SIZE(resources)) + break; + + resources[rcount++] = rentry->res; + } + + if (!resources[0]) { + pr_err("failed to get APBMISC registers\n"); + goto out_free_resource_list; + } + + if (!resources[1]) { + pr_err("failed to get strapping options registers\n"); + goto out_free_resource_list; + } + + tegra_init_apbmisc_resources(resources[0], resources[1]); + +out_free_resource_list: + acpi_dev_free_resource_list(&resource_list); + +out_put_acpi_dev: + acpi_dev_put(adev); +} +#else +void tegra_acpi_init_apbmisc(void) +{ +} +#endif From patchwork Mon Oct 16 05:34:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422514 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 9A21F79FD for ; Mon, 16 Oct 2023 05:35:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="M35ECHo5" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2081.outbound.protection.outlook.com [40.107.220.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6CE6F3; Sun, 15 Oct 2023 22:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RWsxpi+L6fM1FbZu8BuPfEAdaJT7lalkZesQrm5Ve0AlHeDK/rBHTulTTkWtfVKxX5x7kFB2dk7JwF2bqXIRGOTYN2zo+jdgGBznk1ka4bl4wAoAaAgJCUA0ZxLBLlzR/a/8wLq9MNR0nvigOcKEMahRAVpAeppTZLg/Yaa4/FP/etTI5vR87PKAg7GqovhWDGuUEps49nc1j/oK4hvMg4a1sULx5xHXJdDqyMNIzChQQzDa86J8jUf+dp29hdoMN+AhWR9der37B4W606lkb7kPX+7CWqR364WT/yz6Y2Mp1iBjtt1lv7pzdC3qBcHpASIMTMhTqKT9OHzWV8anew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UsfBJldkiMPpKKWg3UTuMtU4ygnaQjwm8g1iBXNqTyI=; b=lPcHjyrvaPj4EAm+bAfwTYNpa1SHkKIbZ7ye1trdZrsoS07x7l+ubeETm9VPEMyZ0BYOt57ItiDQ17Cw83kmno6dby7GuBkoix/Oe88lavZ2+rHdm9oC0xBky55+8lELAR1/52hyJS+KcK1tUTHb8CBiYFPc6TyZY6uAOiB5vDRYmRkgqC9u3pqF0d+U5t++x5NXfk5tErDehbjnAduoGl7P4KMixKxfxnEffMVlyt0U4FEOV7a3TofsZ6Yl04Agu8Eb2bl7pD9C2taX88y16y/vtT/90cvG+GI3LOEePx5PqovpnI5fzhuL2b7kNHtQZa8lwAg0JdZNdJkTov9/Hg== 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 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=UsfBJldkiMPpKKWg3UTuMtU4ygnaQjwm8g1iBXNqTyI=; b=M35ECHo5BsLaPKiLYXEhPVhd3DykHxx/XlsIWgWDRhRo32jTvCZfE5B+ZVok3DrhvNE1WtVTmQ/fFbJtajT2sZHg2qdwzzMRa6gwutmaI0KckERN5RDdf1qdSC6FN5hay1ufSlZHcAHPOBWh8z4OxMRGOl/chPuxDpTt/3mfDJTJQ/7OI0IgQIUDSbPIRDmg+nPYFqSUy1m6n0GvpuMGN2ljxlCbhNWhqgqeBwN52APsUvuNrjKQnUzzEYF3IDXVGIdK7poyVy1ORtOc3LiqDZxm+z75MHXLTXPt5g9UaQ+KB7drcW32qpV2zXIcIjX2UcLtqGBKXdnSOU699NYz5g== Received: from DM6PR04CA0007.namprd04.prod.outlook.com (2603:10b6:5:334::12) by BY5PR12MB4180.namprd12.prod.outlook.com (2603:10b6:a03:213::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Mon, 16 Oct 2023 05:34:58 +0000 Received: from DS1PEPF00017098.namprd05.prod.outlook.com (2603:10b6:5:334:cafe::2e) by DM6PR04CA0007.outlook.office365.com (2603:10b6:5:334::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.30 via Frontend Transport; Mon, 16 Oct 2023 05:34:58 +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 DS1PEPF00017098.mail.protection.outlook.com (10.167.18.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 05:34:57 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:51 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:48 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Sun, 15 Oct 2023 22:34:44 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 5/8] soc/tegra: fuse: Add function to add lookups Date: Mon, 16 Oct 2023 11:04:08 +0530 Message-ID: <20231016053411.3380-6-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016053411.3380-1-kkartik@nvidia.com> References: <20231016053411.3380-1-kkartik@nvidia.com> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017098:EE_|BY5PR12MB4180:EE_ X-MS-Office365-Filtering-Correlation-Id: 9333ef9a-438c-4f6f-391e-08dbce09a291 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RS2xRLxxam8cUnx23c4byl61r3KgNJzpK7ipFt0obcH8YopY6l0EMfyfrsN/K/OZZrdwOxm/bXCD+Qyz0g981dXRVr9pa6iF6c8ojhVR4J9t1vdZqAAhH5H5BMsBaL8jHkukenbbiptHPkymeYYyspiikjZz5NezIJhjzFCP3oH+eY+k/FxSMD1/vrMt7FgrVcH2FJitWSNNYXy65sKvvXk27no2v6K9vzO4rdHnttWA5VLdGU4StuIB1poT1h+66adyp/HbNP1jPbAXyu2vL9e9t1DEFF4cqWYa03WHKJK/Gr7zV9cOvVKnQHc+685p93u1+ohnfGjVe0NotG3EsZ76iK/XD5uRcGkRKjAhLmH4v9sTX2J5DVA6NK1cSRwiO7pV1i8cqBSEVsh0aU1+RMNSKuLDvwjaWSIUFUFKU5QxgZGCsmoSeWHvHbg0ymjW3P8EAIf1TDpr7edGVNH4SmVPSuVkvNwx/SgS6fs/yF0pcpcZ1FHg9Dah69wr86AKhmXIaERiJ6liqfFJ+LNJi6XcdbMqZHkBMphLsNBmVNsMbaaDYBvX0trSiOm/2eWDaKpAsQX9P8Qa3lgd9UC9fCck8CdEArj7yHH8ttWaHOzV3mPHVKf50UATsxXPQUrcipEpMF26AOiVh1NDPXL5ukIwtemlOQvQaeGzVY3sPLqjQoP8nxc2k9EnzfRmDBq0rcUokS9tZ0folMcoNJm1uPIkKfbSrH9GGY54LD4KIaNejV/lKdA4g1ELBR8Eq3PA1okRFdLGtIJ6gVWpCdnBW3+4tPU5CMpNsnGyEh3zTfQ= 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:(13230031)(4636009)(396003)(376002)(346002)(136003)(39860400002)(230922051799003)(82310400011)(451199024)(64100799003)(1800799009)(186009)(46966006)(36840700001)(478600001)(1076003)(7636003)(2616005)(83380400001)(82740400003)(86362001)(356005)(36756003)(6666004)(921005)(36860700001)(7416002)(2906002)(41300700001)(426003)(316002)(40480700001)(336012)(8676002)(5660300002)(26005)(47076005)(70586007)(8936002)(70206006)(110136005)(334744004)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 05:34:57.9260 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9333ef9a-438c-4f6f-391e-08dbce09a291 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: DS1PEPF00017098.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4180 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Add helper function tegra_fuse_add_lookups() to register Tegra fuse nvmem lookups. So, this can be shared between tegra_fuse_init() and ACPI probe, which is to be introduced later. Use kmemdup_array to duplicate fuse->soc->lookups. Signed-off-by: Kartik --- v3 -> v4: * Use kmemdup_array to duplicate fuse->soc->lookups. * Return err at the end of tegra_fuse_probe to remove redundant code. v1 -> v2: * Use size_mul to calculate lookups array size. --- drivers/soc/tegra/fuse/fuse-tegra.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index 98805885158e..c91194612a9a 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -113,6 +113,18 @@ static void tegra_fuse_restore(void *base) fuse->clk = NULL; } +static int tegra_fuse_add_lookups(struct tegra_fuse *fuse) +{ + fuse->lookups = kmemdup_array(fuse->soc->lookups, sizeof(*fuse->lookups), + fuse->soc->num_lookups, GFP_KERNEL); + if (!fuse->lookups) + return -ENOMEM; + + nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups); + + return 0; +} + static int tegra_fuse_probe(struct platform_device *pdev) { void __iomem *base = fuse->base; @@ -398,6 +410,7 @@ static int __init tegra_init_fuse(void) const struct of_device_id *match; struct device_node *np; struct resource regs; + int err; tegra_init_apbmisc(); @@ -495,15 +508,11 @@ static int __init tegra_init_fuse(void) pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n", tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id); - if (fuse->soc->lookups) { - size_t size = sizeof(*fuse->lookups) * fuse->soc->num_lookups; + err = tegra_fuse_add_lookups(fuse); + if (err) + pr_err("failed to add FUSE lookups\n"); - fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL); - if (fuse->lookups) - nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups); - } - - return 0; + return err; } early_initcall(tegra_init_fuse); From patchwork Mon Oct 16 05:34:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422516 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 B100279FD for ; Mon, 16 Oct 2023 05:35:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="BGsDk4dM" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2064.outbound.protection.outlook.com [40.107.94.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAAD1138; Sun, 15 Oct 2023 22:35:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OYm+dGOAYcvPlvd6vegUM/CgjYb130iNqQw74i1931GNSXbdhQn5YJG79ZaCx+in8jeFrzHvQ9IUveB/RBWSPzoMJrQsw4vPRqrVx77AgmP1djuly/OZ//JhzkPjoOvPCCwsHhfqgQJYg4b0VwkB50ff98omh/w2r1lty5i3ureQAvtxSKvdmDm87auM5GUxWWean+GZs9YB79Tz9/MOSrvtMyXpjy5QZREnuL73k77Qk2vpTVrOHXVCCvH2cFaNvrh3+v2yu8QFoh8cuNcknOUAAnPxqLC+JW4oYYnEUQz0WD2cvMSOPEjvviHKKJ+Hnrh8K+vSetnnsvifoXT7rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ELKSSmXMLGbNFUFnL8TV/EvgiM4XWsEshppFSZUpBQE=; b=EaY4hoJdHbtVxNsIdV09KMafEmZQp/LAmqJSEle2hr2ftF8dbbwJP4rloQkqTD2PYEuSCsx/RR6ZjqJE0LOaAcuJiJC+OoRTn3pglzVbG+uB9MvmohAr4RJdimgivNuX1o6LVLE7fAEXmxXsdne4842G7oZMTG/kSph3+1mRWCiXOYhU/5Jr/qzhN59Vd4Ba2aZfMCYDV7Mf0J19xXxKVLvor5SCvhUvYLjsbfigdHG4Eg4mswPo/bV86hMZI4Qdu4ExWu2UbV8EfuGy03LEiMMepH+VwTJwTSCpEKifEJZT33lqK2CeF8+fT5AnpzevpUkbzU0kvQC/Ap9G9ydSEQ== 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 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=ELKSSmXMLGbNFUFnL8TV/EvgiM4XWsEshppFSZUpBQE=; b=BGsDk4dMKAbSoSpv1aAWheaTnKqKMYP6AXzUCKFOiYy9PEMf797H9r2qjjJ8XC9nRPlN8kSw8WHzgRZ2QOmrPJfsVIQC6oQG0xuB/r61CqJrDdoxUyr7R/E6bQ0pp6pSwaEEsoClcmUGn7YTsuymtVc0QFhsh6PqVH4BpKryXBsoGI975Ram6UtdMYVPI90pTl6wZ1hy1uH2F/xcoqUUQAE1UMQOrXvJxQ6jYMKyXCehnrVlhsWRc+McczYRvYkhgxVDn1bilJpypS0/RGZKTbSr7giXzUBSj/X3YToIa00+EBGFIHA2WgbLCCaMnOHPSCTDHk5A47fm8EJc8g6+eA== Received: from DM6PR17CA0034.namprd17.prod.outlook.com (2603:10b6:5:1b3::47) by SA1PR12MB6847.namprd12.prod.outlook.com (2603:10b6:806:25e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Mon, 16 Oct 2023 05:35:06 +0000 Received: from DS1PEPF0001709A.namprd05.prod.outlook.com (2603:10b6:5:1b3:cafe::11) by DM6PR17CA0034.outlook.office365.com (2603:10b6:5:1b3::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Mon, 16 Oct 2023 05:35:06 +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 DS1PEPF0001709A.mail.protection.outlook.com (10.167.18.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 05:35:06 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:55 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:54 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Sun, 15 Oct 2023 22:34:49 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 6/8] soc/tegra: fuse: Add function to print SKU info Date: Mon, 16 Oct 2023 11:04:09 +0530 Message-ID: <20231016053411.3380-7-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016053411.3380-1-kkartik@nvidia.com> References: <20231016053411.3380-1-kkartik@nvidia.com> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0001709A:EE_|SA1PR12MB6847:EE_ X-MS-Office365-Filtering-Correlation-Id: 3b6025d3-7c4b-4a1f-b61e-08dbce09a7b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +m2Ph9orPCiC93IPmA8nMcpflSWuAYGLzxcJOuvI3VEmVsoCGIUKYheYORx0hWzIB6jyHhJ2sfQji+N0hasGzPCnhmSn1K5jxCHU0km6ma2OEHfVVCBZjM1T32Th0HELvg1ZVFDsM0H7UoXvEdD762q3ra0gYKM0MYDp5kAcAHbsnW3iMPBzJeY8tyldFnnDGwlklI42Xrx0cJAr9Q8nNmLber4oEDRRRe4Zov12Udp0DrKseQmDJfLg3QCZYkim7Vp9b4WsWBRJ1BScjaCeBw3bV1A1o8KFXv87GN0CJ1JJZke49lYDWtnNCV1IWupE6/38IKa3NdAptJ8qmX0aZ88TUI62ft4fjO6ZBWz2L0EG0DcFojkZ/WRjh9dDGfPlAsR5d1PJdSZ3PfMLiJBlBArNEhPd/rioatB8Gz0taic4EWZ+5H3sVuFRaj4cLx5XucTGurwVQvU1OxQubBtL/B+wkq/0aMuzyuKcFS7zHywipA4B4HmbdguTY7rumjbcgrrNPeDW6aRurLj2DNSxy3wamKN62bTrJGi/HdheYbMDy9QGWdNjUMQqHaZ7aRF1NBZLhia1OrFlLNGGLOMhelZ0M93/ICcsmvUP06CLkdMMeJG83Uqthb7EsdUVHMG/aBdLuHw5nmVjBOrLJMzv086x4Q2MfV2aueDXBd2t+HIsp8oogEG7eu7cSIg0lsV53CxBYjUkMQGNPan/qZ0UTEYHOIfyixX1AiGJmj0k+jKk91oU6VKa7xFWpGVra3TsSxr7d8vg+zY8JefB9BKMJ6ldr1RLAJHRNlHSuj23GUA= 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:(13230031)(4636009)(346002)(396003)(376002)(39860400002)(136003)(230922051799003)(1800799009)(451199024)(64100799003)(82310400011)(186009)(40470700004)(46966006)(36840700001)(40480700001)(40460700003)(478600001)(6666004)(110136005)(36860700001)(47076005)(82740400003)(36756003)(86362001)(921005)(7636003)(356005)(7416002)(2906002)(2616005)(426003)(336012)(26005)(1076003)(41300700001)(83380400001)(316002)(5660300002)(70206006)(8676002)(70586007)(8936002)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 05:35:06.5316 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3b6025d3-7c4b-4a1f-b61e-08dbce09a7b4 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: DS1PEPF0001709A.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6847 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Add helper function tegra_fuse_print_sku_info() to print Tegra SKU information. So, it can be shared between tegra_fuse_init() and ACPI probe which is to be introduced later. Signed-off-by: Kartik --- v1 -> v2: * Renamed tegra_fuse_pr_sku_info() as tegra_fuse_print_sku_info(). --- drivers/soc/tegra/fuse/fuse-tegra.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index c91194612a9a..9bab758a60f2 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -113,6 +113,16 @@ static void tegra_fuse_restore(void *base) fuse->clk = NULL; } +static void tegra_fuse_print_sku_info(struct tegra_sku_info *tegra_sku_info) +{ + pr_info("Tegra Revision: %s SKU: %d CPU Process: %d SoC Process: %d\n", + tegra_revision_name[tegra_sku_info->revision], + tegra_sku_info->sku_id, tegra_sku_info->cpu_process_id, + tegra_sku_info->soc_process_id); + pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n", + tegra_sku_info->cpu_speedo_id, tegra_sku_info->soc_speedo_id); +} + static int tegra_fuse_add_lookups(struct tegra_fuse *fuse) { fuse->lookups = kmemdup_array(fuse->soc->lookups, sizeof(*fuse->lookups), @@ -501,12 +511,7 @@ static int __init tegra_init_fuse(void) fuse->soc->init(fuse); - pr_info("Tegra Revision: %s SKU: %d CPU Process: %d SoC Process: %d\n", - tegra_revision_name[tegra_sku_info.revision], - tegra_sku_info.sku_id, tegra_sku_info.cpu_process_id, - tegra_sku_info.soc_process_id); - pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n", - tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id); + tegra_fuse_print_sku_info(&tegra_sku_info); err = tegra_fuse_add_lookups(fuse); if (err) From patchwork Mon Oct 16 05:34:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422515 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 C5CDC847B for ; Mon, 16 Oct 2023 05:35:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="RrkYXmov" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2066.outbound.protection.outlook.com [40.107.244.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D55D136; Sun, 15 Oct 2023 22:35:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HHKpMQ+wEqxL95cdClz8Nr+Tm+WbGuHVCs+PrOqshtIOfrDTk/fU5UTFdbS8yKyHB4s4V4BmxXArSWS+iZAHPohyga8MHWtDOsKmX65g+kIaQmmEZiy0QkvHEZmS7cEbZXERrEy6h2VsSarkJlOdUXW5oXUuExAOVgtza+NmH+AAUN2z0dUYyLaFXK7zuQ6oeeey2DAcLxwFLJ0KS+kB/ln+8n2c7Ot2dO5apY1EWC0E7i45D8XQi6qPGgvGmvygFaLaVCE7L1efNhpo0jg5aP0Jr9f3dSLapRXKmDIqJ0ENkANBTzT6rCFw+bsaqgOxtINRcNUBzZMk6ONqEIhSiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RXqsHU6ogXlp1x2pbNwnf9ALqPnJ0NoVRvhf8LgRRWM=; b=acX7rU5dDZADS+KlxpqTwbdcdLQcfGxcYaZS/wpppkI2NliRFaD4lli+4PJZPGh4wLS0WYxwPnUl73q3VtC3xxPoVSqv7RFomB7if1YUh1jB5iSPl6kHH1a3sMHPLin3qaca5yZMRswSsSQOGPTc11B4dbOZ2cvnuM5C+bnUwdeO9AEIEkRLIrLS/Q9JFrt17TTotc31NAC9ky8DaUOzKileE/pttkWUD1p/vgr7SIoYlJhUr9v+POlNN0haRjP4Tups4M6KBjkWVi9hc8TIAFo3CN02UbXcadHTXVIrh25YaCSUGhrvbCG6strbQFytwzelPYnPsHMXMlIix0ACPg== 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 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=RXqsHU6ogXlp1x2pbNwnf9ALqPnJ0NoVRvhf8LgRRWM=; b=RrkYXmov4OdL9r0k79dWXpEokdT2Tit2T9vvQMWV+D5qqTHB0GN1SZSvGAUuCVc9ogb+tKzDlttxSVZxoCX3QyqLwCO5GbL9nHhfJo/2YfjkEZUwZ5Wp9/5OfhUzOW8UCrYg6ngUhxLYUwd7Dq+lgmhpH2trbvn7txfPMF6dnQ3ki0OhLapzyhHV0HKAwoZIKCUI/tgSLGeEJl0vJMK+v50Wt5c1COuHxJdwSKReLeVlsx1Bfain5gOEyHkY54QHcfQMbtj0o4VcnUyFYemchLzJsJszi+gBIkBl8kENKHbbA5Xq89zR8wUVAg8dCJqGdyFx51OdnVmCpIm8S0+0zw== Received: from SA9PR10CA0009.namprd10.prod.outlook.com (2603:10b6:806:a7::14) by IA1PR12MB6532.namprd12.prod.outlook.com (2603:10b6:208:3a3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.46; Mon, 16 Oct 2023 05:35:06 +0000 Received: from SA2PEPF0000150A.namprd04.prod.outlook.com (2603:10b6:806:a7:cafe::f) by SA9PR10CA0009.outlook.office365.com (2603:10b6:806:a7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Mon, 16 Oct 2023 05:35:05 +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 SA2PEPF0000150A.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 05:35:05 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:35:00 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:35:00 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Sun, 15 Oct 2023 22:34:55 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 7/8] soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234 Date: Mon, 16 Oct 2023 11:04:10 +0530 Message-ID: <20231016053411.3380-8-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016053411.3380-1-kkartik@nvidia.com> References: <20231016053411.3380-1-kkartik@nvidia.com> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150A:EE_|IA1PR12MB6532:EE_ X-MS-Office365-Filtering-Correlation-Id: a019253a-ccd6-4e34-fe3c-08dbce09a72b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mz/FNMb5wwnMmYSedSFgsJbsEN54AQrXsSv2TSoDrcFRYMJs26KUwKE/uZTVmUF1+Y/bGpiQUyyCQEIsVAdZCToPKr5pPATVBd4NOPpJuouyUKcjboDcK3JYSB/6vLxeKYLQ8iHm/m1zK4WkudmXFU5VaBi9JIqO6p9JLqOnrF+ouEfReOP/nn2zCk5tfkgIlhKnG1uHAae4mgJnLncXUEmUS7gRHa3y5d3kZDtiCg8uex653QOStXWAZuyikdNxZCESXpXAE+lvtruU6WHT5Ksa/54ebFNwevvtFCQ8PJZVympL+yLuC9Sf2xuov1qUsv4U59zBQ6b/MG9ib/MmrksWW83xb955bVb5CinyuGzT9I0xfpX+l/Wh94NfA0pjWB/0vkeWU2VwzzHm4S2FCjHQwm9KAEvupyybtXH7V99lgQBPEwvRJV3AE/P3rw1Z3bDF8w58a0iLpIU/ZhoSzIT4esHy9rZyFK+7pIcmNazWSvxyl/O6yGKukPBU2vXJ/qK/+vzCqVN3sox8tluXUVSwQeWe96+jUZb7boHhQFm3hUnqpRbPSSzH/8zJcOjKobaPZy3VyKRnF5x9WCbYi/4K+0B9oZASHALtWfd+JKtAAM4ZkGPDC79c0fU5BzlFkaH57SMYP2vSKKe6gbotmmq5H2m9YO8a0qyr+jvGhgZ5GsPbZNIy2pQVnSyIveA+zVRSFoAdts4F/7MGXBNA0vf8GNYSzS0L7q+O9s8QpVl7VXoQrMhZLQY1Ha2flwBsiFfyF7XYUUXcH1ohHbJXjGbp/avASFforH1IcVZT4K66/cKWqRWeXbQ1mYs1K1tL 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:(13230031)(4636009)(396003)(346002)(376002)(136003)(39860400002)(230922051799003)(82310400011)(451199024)(64100799003)(1800799009)(186009)(40470700004)(46966006)(36840700001)(6666004)(426003)(336012)(83380400001)(2616005)(40480700001)(82740400003)(26005)(40460700003)(921005)(1076003)(7636003)(356005)(316002)(70586007)(70206006)(110136005)(36860700001)(7416002)(41300700001)(2906002)(36756003)(8936002)(86362001)(8676002)(5660300002)(47076005)(478600001)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 05:35:05.6512 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a019253a-ccd6-4e34-fe3c-08dbce09a72b 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: SA2PEPF0000150A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6532 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Add ACPI support for Tegra194 & Tegra243 SoC's. This requires following modifications to the probe when ACPI boot is used: - Initialize soc data. - Add nvmem lookups. - Register soc device. - use devm_clk_get_optional() instead of devm_clk_get() to get fuse->clk, as fuse clocks are not required when using ACPI boot. Also, drop '__init' keyword for tegra_soc_device_register() as this is also used by tegra_fuse_probe() and use dev_err_probe() wherever applicable. Signed-off-by: Kartik --- v4 -> v5: * Fix build warnings seen with tegra_fuse_acpi_match when CONFIG_ACPI is disabled. v3 -> v4: * Use dev_fwnode() to dereference the fwnode. * Add MODULE_DEVICE_TABLE for tegra_fuse_acpi_match. * Moved tegra_fuse_acpi_match above tegra_fuse_driver i.e., close to the user of tegra_fuse_acpi_match. * Moved the improvements made to fuse clk/rst get error handling to separate patch. * Moved ACPI related initialization after fuse->base is initialized in tegra_fuse_probe(), as this triggers a warning in tegra_fuse_read_early() which is called from fuse->soc->init(). v2 -> v3: * Updated commit message to specify changes related to inclusion of dev_err_probe(). v1 -> v2: * Updated ACPI ID table 'tegra_fuse_acpi_match'. * Removed ',' after "{ /* sentinel */ }" in 'tegra_fuse_acpi_match'. * Using same probe for ACPI and device-tree boot. * Added code for required initialization when ACPI boot is used. * Make clocks optional for ACPI. * Use dev_err_probe() wherever applicable. * Check if clock has been initialized only when device-tree boot is used. --- drivers/soc/tegra/fuse/fuse-tegra.c | 50 +++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index 9bab758a60f2..daf39f0e6d93 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -3,11 +3,13 @@ * Copyright (c) 2013-2023, NVIDIA CORPORATION. All rights reserved. */ +#include #include #include #include #include #include +#include #include #include #include @@ -152,6 +154,37 @@ static int tegra_fuse_probe(struct platform_device *pdev) return PTR_ERR(fuse->base); fuse->phys = res->start; + /* Initialize the soc data and lookups if using ACPI boot. */ + if (is_acpi_node(dev_fwnode(&pdev->dev)) && !fuse->soc) { + u8 chip; + + tegra_acpi_init_apbmisc(); + + chip = tegra_get_chip_id(); + switch (chip) { +#if defined(CONFIG_ARCH_TEGRA_194_SOC) + case TEGRA194: + fuse->soc = &tegra194_fuse_soc; + break; +#endif +#if defined(CONFIG_ARCH_TEGRA_234_SOC) + case TEGRA234: + fuse->soc = &tegra234_fuse_soc; + break; +#endif + default: + return dev_err_probe(&pdev->dev, -EINVAL, "Unsupported SoC: %02x\n", chip); + } + + fuse->soc->init(fuse); + tegra_fuse_print_sku_info(&tegra_sku_info); + tegra_soc_device_register(); + + err = tegra_fuse_add_lookups(fuse); + if (err) + return dev_err_probe(&pdev->dev, err, "failed to add FUSE lookups\n"); + } + fuse->clk = devm_clk_get(&pdev->dev, "fuse"); if (IS_ERR(fuse->clk)) return dev_err_probe(&pdev->dev, PTR_ERR(fuse->clk), "failed to get FUSE clock\n"); @@ -275,10 +308,17 @@ static const struct dev_pm_ops tegra_fuse_pm = { SET_SYSTEM_SLEEP_PM_OPS(tegra_fuse_suspend, tegra_fuse_resume) }; +static const struct acpi_device_id __maybe_unused tegra_fuse_acpi_match[] = { + { "NVDA200F" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(acpi, tegra_fuse_acpi_match); + static struct platform_driver tegra_fuse_driver = { .driver = { .name = "tegra-fuse", .of_match_table = tegra_fuse_match, + .acpi_match_table = ACPI_PTR(tegra_fuse_acpi_match), .pm = &tegra_fuse_pm, .suppress_bind_attrs = true, }, @@ -300,7 +340,13 @@ u32 __init tegra_fuse_read_early(unsigned int offset) int tegra_fuse_readl(unsigned long offset, u32 *value) { - if (!fuse->read || !fuse->clk) + /* + * Wait for fuse->clk to be initialized if device-tree boot is used. + */ + if (is_of_node(dev_fwnode(fuse->dev)) && !fuse->clk) + return -EPROBE_DEFER; + + if (!fuse->read) return -EPROBE_DEFER; if (IS_ERR(fuse->clk)) @@ -383,7 +429,7 @@ const struct attribute_group tegra194_soc_attr_group = { }; #endif -struct device * __init tegra_soc_device_register(void) +struct device *tegra_soc_device_register(void) { struct soc_device_attribute *attr; struct soc_device *dev; From patchwork Mon Oct 16 05:34:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422517 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 5786979FD for ; Mon, 16 Oct 2023 05:35:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="n0LMXQSn" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2070.outbound.protection.outlook.com [40.107.93.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ED8510B; Sun, 15 Oct 2023 22:35:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mJh4oq8AKjYQsYnUFemE9DwtQp6Dz6fftaki45Z/AAyo4O0YiUVquVs5mUHvaFsl9JlNwDmBuRNF57EPM7zW/o7zvQ+4NJTTUqJ/Y7lstztAHaVeYoARuDbGjAHQKE6DiDMWLg/zyfi4yHD3QB7/vGEsBQb+IxYaCIkWuOuifoeXOqCsGsbA7Tpx32kvTxMke7R604Zl1dm7N5S0VdAm8N9hCca10JZTBzTI7/P+YCHCZLYbQAWImjNQKuDPNiOJsA1/1KWsIw8Sv/1FpPXWf/2f5IROera0wvWje2/AM+vAcuUiad/X9plhPrIAgyFa3cEtFifABj4RE4+z5UKWuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Mc7Y8uE9T1ZTCbSjAzTP5hNlgaBupFVz56cm0VutrO4=; b=i4aAuhCFxGl8Bsk8CtIxgP2b/K0puJa2Q9G4qYo+Eib3IPX+nbQeSu3Nk426Fyf6wzLi+toogfpf08cWkbWnk78YVHiN8HMs8uENBKEj7n5u6rE0dyl5vYF+te7ldqxC9GT2DBnWyxy4zc/eMTdlJzFGcLjD1fgg4+sVgLl6mrYWqlX/w/NP9fVuE2gstvKPByz0VatSws8erkKlVueeeofgI55ISBHYzV4MUMbDDC3BPF/v87fD/WY5XZwLmcWNabtDG6aLA5VJRD1rTpRwRIQrErDE9P4IPTP2lyM0ERtaS36mdBvJmogfrjKbUD6mobvfA4+quD5YXh9TP7j43A== 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 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=Mc7Y8uE9T1ZTCbSjAzTP5hNlgaBupFVz56cm0VutrO4=; b=n0LMXQSnSVl+CWpQvI03RXfX5pGV+gZiusybbOkd3yG213vrcv4TSXLFmSawh9lQCVxhROyDfQxtZLAqhDJRClErc6Js8p9DQkTqEi322sxe8ntDReNBdeRsL9jWt+CmeMIj/PKz+J7XzOHhLayAPGPs9bwpDPIctSDJi0yvpB0lcJjGafWIEu5dENNKkqT2OZS4o80T8DgjzKhxWMY8b5/Z44SCO7WWk54DjSl3pGCjxEhrmPXmBm5aQyMdAco0REiQMauYTVcqkLU+SSRxLewepPvt80wNrpso82e3aBZ27zjX2a/dQGNbFoGJ4lVeNUYcaRTV4sWMAgJeDBLfZA== Received: from DM6PR01CA0020.prod.exchangelabs.com (2603:10b6:5:296::25) by MN6PR12MB8491.namprd12.prod.outlook.com (2603:10b6:208:46f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Mon, 16 Oct 2023 05:35:14 +0000 Received: from DS1PEPF00017096.namprd05.prod.outlook.com (2603:10b6:5:296:cafe::9d) by DM6PR01CA0020.outlook.office365.com (2603:10b6:5:296::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Mon, 16 Oct 2023 05:35:14 +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 DS1PEPF00017096.mail.protection.outlook.com (10.167.18.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 05:35:14 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:35:06 -0700 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.986.41; Sun, 15 Oct 2023 22:35:05 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Sun, 15 Oct 2023 22:35:00 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 8/8] soc/tegra: fuse: Add support for Tegra241 Date: Mon, 16 Oct 2023 11:04:11 +0530 Message-ID: <20231016053411.3380-9-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016053411.3380-1-kkartik@nvidia.com> References: <20231016053411.3380-1-kkartik@nvidia.com> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017096:EE_|MN6PR12MB8491:EE_ X-MS-Office365-Filtering-Correlation-Id: e2a9cc61-c5cb-4cca-572f-08dbce09ac88 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GPblzzhVtLPfcaentQ5isVSfwcpASwPLZ+iqWnKpKQ+3nhQmoLGJQzJYKR3xE5VFBVLC1MUvANPEgzPaDuuVUYqFmit1BdhpHtkJHibMfePWA2Hy/9NXae6STqwrMtSiX3eGHyjr3AyLIv5R5V328ucn2+6+almlLKNqThf85eiaSQejP+mBOqaG75Ni4zF8gX2I6p9QdSvrv58QVEFxI+f7r0ETfOwp4AvotqVzRZF9h81wai63bsBftccUdQByDUCO/UMJBr+Q+YgXd4iBVVhkoqSZ5PjAEClPqxjDg/pzmNw7z9uOqm+7WnhSc5XVAK3U2XwuKplBPuhEtapRi99duLmyrT1khTZEGIVqjFKvawOXRmnLqahSZ2Oga9sXjyNA8/fTt4hAAY2aUtAbBODxnvnuN9ZP4x2rxSz0Rl6+Y1JLOvMt6w3YXyAs7bE8k6IEua+g/5iNaO+Zl39H/ZBtEEeUr5aKVae4mZkbch+o97jG6eMIYbXTajnVIXBCgqTIsXh5l821lndd1OgCKDLlq1W1+h3rkby3sRcKrbLESyQXM0Aw8Eg/Y7kI4U+kdTmV1bD+HTIIwBm50krlIzMTFyXBOiVtn0XzaZVcz2GtEqWv7lD/5XyoeiW6YDbj6zMu8TRknoC36W3LTv1yZqXOL76+S3FtPQ3hcUVoP1mclpKbkWyyom+CAqBdwQIwfBDybbDaH8ZF8m9fzk9fmAYSJp7exKn/pjZjqNDELJ3BBYKOm7Jg7PTuUuoWqZxUQC5YA9HfCoEMrg8OcfgxWL+rTqXvOCqZcVacLjioxuqJFoEv6aWHSze2jtocpLgB 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:(13230031)(4636009)(396003)(136003)(376002)(346002)(39860400002)(230922051799003)(451199024)(64100799003)(186009)(82310400011)(1800799009)(46966006)(36840700001)(40470700004)(40460700003)(40480700001)(478600001)(110136005)(70586007)(70206006)(6666004)(921005)(7636003)(47076005)(83380400001)(36860700001)(86362001)(356005)(82740400003)(316002)(2616005)(26005)(1076003)(426003)(336012)(41300700001)(5660300002)(36756003)(8936002)(8676002)(7416002)(2906002)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 05:35:14.6294 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e2a9cc61-c5cb-4cca-572f-08dbce09ac88 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: DS1PEPF00017096.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR12MB8491 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Add support for Tegra241 which use ACPI boot. Signed-off-by: Kartik --- v1 -> v2: * Removed few entries from tegra241_fuse_soc which were initilized as NULL or 0. --- drivers/soc/tegra/Kconfig | 5 +++++ drivers/soc/tegra/fuse/fuse-tegra.c | 5 +++++ drivers/soc/tegra/fuse/fuse-tegra30.c | 20 ++++++++++++++++++++ drivers/soc/tegra/fuse/fuse.h | 4 ++++ drivers/soc/tegra/fuse/tegra-apbmisc.c | 1 + include/soc/tegra/fuse.h | 1 + 6 files changed, 36 insertions(+) diff --git a/drivers/soc/tegra/Kconfig b/drivers/soc/tegra/Kconfig index f16beeabaa92..33512558af9f 100644 --- a/drivers/soc/tegra/Kconfig +++ b/drivers/soc/tegra/Kconfig @@ -133,6 +133,11 @@ config ARCH_TEGRA_234_SOC help Enable support for the NVIDIA Tegra234 SoC. +config ARCH_TEGRA_241_SOC + bool "NVIDIA Tegra241 SoC" + help + Enable support for the NVIDIA Tegra241 SoC. + endif endif diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index daf39f0e6d93..eac95946c425 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -171,6 +171,11 @@ static int tegra_fuse_probe(struct platform_device *pdev) case TEGRA234: fuse->soc = &tegra234_fuse_soc; break; +#endif +#if defined(CONFIG_ARCH_TEGRA_241_SOC) + case TEGRA241: + fuse->soc = &tegra241_fuse_soc; + break; #endif default: return dev_err_probe(&pdev->dev, -EINVAL, "Unsupported SoC: %02x\n", chip); diff --git a/drivers/soc/tegra/fuse/fuse-tegra30.c b/drivers/soc/tegra/fuse/fuse-tegra30.c index e94d46372a63..2070d36c510d 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra30.c +++ b/drivers/soc/tegra/fuse/fuse-tegra30.c @@ -678,3 +678,23 @@ const struct tegra_fuse_soc tegra234_fuse_soc = { .clk_suspend_on = false, }; #endif + +#if defined(CONFIG_ARCH_TEGRA_241_SOC) +static const struct tegra_fuse_info tegra241_fuse_info = { + .read = tegra30_fuse_read, + .size = 0x16008, + .spare = 0xcf0, +}; + +static const struct nvmem_keepout tegra241_fuse_keepouts[] = { + { .start = 0xc, .end = 0x1600c } +}; + +const struct tegra_fuse_soc tegra241_fuse_soc = { + .init = tegra30_fuse_init, + .info = &tegra241_fuse_info, + .keepouts = tegra241_fuse_keepouts, + .num_keepouts = ARRAY_SIZE(tegra241_fuse_keepouts), + .soc_attr_group = &tegra194_soc_attr_group, +}; +#endif diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h index a41e9f85281a..f3b705327c20 100644 --- a/drivers/soc/tegra/fuse/fuse.h +++ b/drivers/soc/tegra/fuse/fuse.h @@ -136,4 +136,8 @@ extern const struct tegra_fuse_soc tegra194_fuse_soc; extern const struct tegra_fuse_soc tegra234_fuse_soc; #endif +#ifdef CONFIG_ARCH_TEGRA_241_SOC +extern const struct tegra_fuse_soc tegra241_fuse_soc; +#endif + #endif diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c index e2ca93de6c1f..c72bdb3e4e2c 100644 --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c @@ -64,6 +64,7 @@ bool tegra_is_silicon(void) switch (tegra_get_chip_id()) { case TEGRA194: case TEGRA234: + case TEGRA241: case TEGRA264: if (tegra_get_platform() == 0) return true; diff --git a/include/soc/tegra/fuse.h b/include/soc/tegra/fuse.h index 3a513be50243..8f421b9f7585 100644 --- a/include/soc/tegra/fuse.h +++ b/include/soc/tegra/fuse.h @@ -17,6 +17,7 @@ #define TEGRA186 0x18 #define TEGRA194 0x19 #define TEGRA234 0x23 +#define TEGRA241 0x24 #define TEGRA264 0x26 #define TEGRA_FUSE_SKU_CALIB_0 0xf0