From patchwork Mon Oct 16 10:14:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422923 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 58F6C1D69B for ; Mon, 16 Oct 2023 10:15:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="gJ3gKZ9y" Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2040.outbound.protection.outlook.com [40.107.96.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80FBCB4; Mon, 16 Oct 2023 03:15:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=brp1goxherUTvXjigjYHIXVe/3ts2rmHaoX/gUveGopy9xFxv7nobfZLH4DPhdKRhxWNdv6R+gybXdCGQ0AXxCgJ4CAuqxmWGnjaa9dhEmVYAHTrA+VCStl6yshM59uo8CEPfExs4riT3OimhHGamp6fnRvj+7YOgTtzGR8Qmp0dBnTRTRlko1y3jtuR8MbEbD23qwJbrdJNUbXjgeI1K5Mb6ve8SjhurVq2s1NnAzYf3nu/3MNJIDvoY6intWcXZOLLcR8ayFyiX4tnJ+lRIgHQjyxPxS8n0xyQDomJatjnt2NG1ApPmuFSVWgXerYFOA+POQ003XdNHobj4rYEqg== 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=m/CuS/nWXj5jZxTDQDSW+ZMO/7Ytk8NFIjzhDoBd4mEoWHaQ+IrBaXLBzrYO5v84OdCf9qpiKyx2aYFKITnOm9sJdWcjkhITq1g1JNE4G5gOdrB7CNRgSxuIDjyKAvBTfh3sh4Aw86lG6zanGRDwZQbdIm/gH0lCzuqXO46PCrA7jvpbET5Jy6aLG7tvElnpbH2EvHLxb174o4uXZN6bOTPTCNu5cNnqH5afqG0rZKnmmW3Qv/8Mo+OqFo1UqLU+tURJ8pl8sQad4RTGZjZbUG3ensx1jx+RUg9JSPI2xZ+SkD1fzZ9giEZKZsLMAF2pcY3VpLGj4P5thgEfitJQPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=gJ3gKZ9yYBTXIcovyvumvZiE+7OZNwlSS8Ooa1LmQ/yiLDNeeH5Fr4JED2/Uvk2u1PFRTALe6KCN4bLyVDz57G6h60dJghad5Hj9yXPKVCa3h5p/nx1KhUnJfwTWGYRP67qdonwW0j+BIO/ix8eTRVZCNvE2JaVgs4RDs1ZHpt3hXsiGYSDDueHftSYvkax8ch1tQvOW/08Jc7HuyfuasgcbSZXc3wtbRrUdfZihzcxq07yAphKxBbZ6EFAe0LN/USD+Uzkdd/oAgvRGEi6zBIhjnbHTXgAKIc9d62gVk/rLtwOR7pVvnsaRRruR/xDbf405lLJKn96ZOvkmTXHCoA== Received: from PH8PR20CA0004.namprd20.prod.outlook.com (2603:10b6:510:23c::12) by MW4PR12MB8610.namprd12.prod.outlook.com (2603:10b6:303:1ef::18) 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 10:15:11 +0000 Received: from SA2PEPF000015C9.namprd03.prod.outlook.com (2603:10b6:510:23c:cafe::26) by PH8PR20CA0004.outlook.office365.com (2603:10b6:510:23c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.47 via Frontend Transport; Mon, 16 Oct 2023 10:15:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SA2PEPF000015C9.mail.protection.outlook.com (10.167.241.199) 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 10:15:10 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:14:54 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:14:53 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:14:48 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 1/8] mm/util: Introduce kmemdup_array() Date: Mon, 16 Oct 2023 15:44:29 +0530 Message-ID: <20231016101436.7146-2-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-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: SA2PEPF000015C9:EE_|MW4PR12MB8610:EE_ X-MS-Office365-Filtering-Correlation-Id: d45218c2-e495-45fb-af4e-08dbce30c7ec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FpagbLjOp2taghtHhDTj0N33hrJXhtUQHXamHhyNq4e82xMSq1rYNx/ABbVpmOdN9iyAhxYNAd0W/8cSP8WTIYpKXG2+o1+NdMoGfIzbQkwjEA5EoxR2d9owOb0btVpLwSkh8Fu/WwrRLIo8KbGFHKOl6EhQtrKC/S81j78EDXhM/anNghP5DT/eUxuOf0r+239KxNEGyulwWn/fNbGZvl9kjA7SDmpaIfJm3FSqBrFH2F35I1Z4spwb7k+MgBiVriCw8g4rg0BNpCbG7Ejyrb/JPQiNeS0M55gq4pHH6zkvazCEzsaibQq96BTBzzJ5vss447BnJq2pC1Q2QGIG199fcDrLOCJVIaTp/xuH2ThLaaTvzzlwpM0xl3iGGV+JH1tB97pyl65iyAWk4+16P8wHK26CHQS/d0jpaKK9LNM+jF9nkYh/tVHugcfblpDnv6LxV/mEOTin8ts3pk59NuwSHRVVSNy+xnuYlDW4768nxK0Ypiljb1ClS/5hPuSiJ1CkqcEBUIdm+ZyfjI3yGiSWzNvd22QmXSVbtVkhthYbBh7l+mAKg+iRLb3MSRfzpSiHW3vi/yoA5h0UnrB8wmbqvWvsyJ/EHnI+Un5FePrRyUd+8AaNt/DXd5au0lqPciI7Zw/AZBKYjkJSZea/Yd5bL8xT78fDqHKgxYfX8EFnABi4Plgp4eqd+FhPzW6IqUXHvzbSiWhQC6dxu0err7ETAsn1eYO882+v1j9J3uwMtZdR/fsqZAOaaja6dtLJedIhyFGi+j9mqoj4dPGuYN3Y8y0Dv+LoEs6wOORhSso4mPoutOUeCZhoBDjRTerG X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(396003)(376002)(136003)(346002)(39860400002)(230922051799003)(82310400011)(186009)(1800799009)(451199024)(64100799003)(46966006)(40470700004)(36840700001)(47076005)(36860700001)(26005)(40460700003)(82740400003)(2616005)(426003)(336012)(40480700001)(8936002)(7416002)(86362001)(2906002)(5660300002)(8676002)(6666004)(316002)(70586007)(70206006)(110136005)(36756003)(41300700001)(1076003)(921005)(356005)(7636003)(478600001)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:10.9580 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d45218c2-e495-45fb-af4e-08dbce30c7ec X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015C9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB8610 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_NONE,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 --- 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 10:14:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422924 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 C31921D69B for ; Mon, 16 Oct 2023 10:15:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="MnGrAcP0" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2065.outbound.protection.outlook.com [40.107.243.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35543C5; Mon, 16 Oct 2023 03:15:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mc9w8eRjHCWtN6Y+ktTpjsGb565hF/vl9SquVvV0bx/XAJN2HAtzji5GtsBakjX6F8FPzOnynZ7glztQYkX+Ss2uakaAHPYzPk8vYh2GXPeRDeJpinTEnf/7cuKPzkO/tiri2JqUQ3QfVc15OkpxMdLUlF50jHqTLHVKnJqWU0+R/lNp28qErEiej51qbL2dMdaU07N6seWE5eN/c9n6PZQLvjUs1DbdzgL+qKg63MX4A9Y5ioIRrqxvjvUFHBhQaw80qV4C18hUSDqvR2QeM4s9jObGLILBHbv66PlL//cR1g7KmDDO7DPDhaLiOSS6x5pdr5uNzbXT7l0aHn5j+A== 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=LulEdkk2+C2/B0k9/H8iAHiR+NDDiyjMJdi2KEuOQbOdu2zFjeZWOb+rlKkChFgb4QGHLM3QhB3qsnK9eLd6W7shc6dUkmEpHw2etfubE3MuYTC3q0iUrMJko71VPD0yfhocuomODk0VhpHbOy/aFyh3GQiqH/Lhl9myKhP9X9UInBJx0I6Jp5rI8gkg5F79qjRuYd4Avo6nUglgbx4OuqN4WOkJn5DJbX86BlT01nN678l8s2+sMMUMpEY7OIEUxDuqVt1YlRQRR7TX0GaBE2z9OS1u4PR5do6IO6Dn1OSJJcc9AsihQumU8JMlHP3FIvs8NcKsrfinANoNRS2Cjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=MnGrAcP0tcR5pPtLUMTsx+/ysuI1BL0KCmkj9u6ru1D7HZJFje0k0R1eIY2ewQkkObpj72TIY4aNqBnjQaNqqTd4Tfp1BpOQmEHnn9JtYxzJAcFuvCAR1vZfMqjU+BUvEpQP5bYhT2ik2TfrMGddQ/q+dSM5p8rps9m3RHV7xSJvM2Hhp3EiAxyL21lGgoA6jgoBzAsfjr6OWI1z3e6BLlcJkGagClUiNXT3YZUP0sjToX3yCBjLoDQCprmNt+qU6LakxqymeJ4v999KYcbyJ49c0tseBmMue9LrpDjGCGsvsk0xePaz/k1iy4NsoCeFIMaJ6kdMpAL1qcapIR9mww== Received: from SA9PR10CA0020.namprd10.prod.outlook.com (2603:10b6:806:a7::25) by MW4PR12MB7261.namprd12.prod.outlook.com (2603:10b6:303:229::22) 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 10:15:14 +0000 Received: from SA2PEPF000015C8.namprd03.prod.outlook.com (2603:10b6:806:a7:cafe::c7) by SA9PR10CA0020.outlook.office365.com (2603:10b6:806:a7::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Mon, 16 Oct 2023 10:15:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SA2PEPF000015C8.mail.protection.outlook.com (10.167.241.198) 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 10:15:13 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:00 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:14:59 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:14:54 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 2/8] soc/tegra: fuse: Use dev_err_probe for probe failures Date: Mon, 16 Oct 2023 15:44:30 +0530 Message-ID: <20231016101436.7146-3-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-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: SA2PEPF000015C8:EE_|MW4PR12MB7261:EE_ X-MS-Office365-Filtering-Correlation-Id: 5f6d036a-5ded-4453-b75b-08dbce30c9a8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w69nCxV52EfcyVpKAt4Iz1Fp3xsxGR0JXfXuUrh+gRR9FF1fflVFzV5EbALnU3Lp5VkuxJxRDRBVxBabkvT7TkqbP33r4C3xSO6/q6cix8zXUgKx8zOvJiyb5FYx2ykRYrqlxeN/WzODPBmXJdhrq48c0vFP+D2bp1VjXQJ0zAnHuXSA1zcfViSBv99gpDsI2+yWn4bqbkVZ5TqC8a7VSgKWMsrOtci4HcXq9zkNtlPgMDx4xqbQJnqCh82kuP+4MmEECnMZUqX8+imCm+w3Kz+bSG2Ipk80ddNMYZ5hi0G2BvBifF4nOWH1na0JLZNZ1ZENCcRT0H01H2SRV6vb7VzaaiEms3mgImGdKJgQlUPljyto8Fg+TqbwelNJY+FjRASUOyIKpdhECDT2Y0SPINcb0AvEzWzzl/aPwojxQGT03kN7tg9BH1H3vB9gUogtuuTCtvtRMQ883vYpD3151JOxMMTvDDQxJvOeXiIexdRShtSuuubZs2532qejR+GEM8LeGFJEv+pfwyln+lsT2ygYfezIkxUXVNIYhCmm7sT1NSjpMsaXdfRQefbN+3n7RXTfr61T65Uo73NCJPYjwKaFM7qNvs/ILYn86otpWjGNz1TLmArI14r1AOUBrMe+Iy7CZcKLNI1KyK+5zugdlONtm0ojddnkUUeiURIetE2H7DJml0lNllUbN/Odq7nmsIBnq2rOE6eRVggOxgLRI3K5dGXwYIBCAX7rDYQRco55lv6Aijw6Fj34nY2ZACGuFAlIFjCW3HFKdf5l9oojFmwVDOPilcZ37knhWt8uqWU= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(396003)(346002)(136003)(376002)(230922051799003)(64100799003)(186009)(82310400011)(1800799009)(451199024)(36840700001)(46966006)(40470700004)(110136005)(478600001)(6666004)(70206006)(70586007)(26005)(2616005)(1076003)(316002)(336012)(426003)(8676002)(8936002)(2906002)(7416002)(5660300002)(41300700001)(36756003)(7636003)(86362001)(47076005)(921005)(36860700001)(83380400001)(82740400003)(356005)(40460700003)(40480700001)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:13.8680 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f6d036a-5ded-4453-b75b-08dbce30c9a8 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015C8.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7261 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_NONE,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 10:14:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422925 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 8C7B61CFAF for ; Mon, 16 Oct 2023 10:15:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="FA3H1Ue+" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2078.outbound.protection.outlook.com [40.107.94.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D71C5E8; Mon, 16 Oct 2023 03:15:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EIT4WsMFhP3IallIZ2B/15jEq8EMIS4ikeBpg4LU+SCfGUNtEMOsmHJ7MTL2XQkM5m+vhg39szOHEtp/deOjv42ZVLifvJD00aiJzDFACjH6zDNnw45whg4kzfRrKRL+Y/T7gHesV9od+rSdAK75xcXDSu959jrhv05sWTaBspQlkNexyvE8P+QEl/VL7+02LKSxlLj1N9umrDpep+NpBZ1aEdFtDxfr6Ie96+1ZW2o36mOevSn7BEfRjjYtdzSlWgvpNfFcgq1SKAjuRgRinVPd5/b39WlNgzTpGMg8UHBpS6YwvcJv/NMmh17ZCjTPmwmt9Kap+quqvShGQ9t6MA== 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=JBh0c33nL3u6mwZmQobKWSRLXhKs2GFzTB156NNi4riU2kVjBNkBRUhwNjwToNd1N4lA1QOEdZJ+hImlil92/OEq6yqJd7IaAOIAhWK4xLjUnGbvUTI9KWCLn7kOGJ1c1iuDmewtv62YYuNND3GbxxSKtlnYgZrX1lY/nQry1QpVtc3iAjElNvdDexG1WlcWo5zJV35Wm1vGPvvMkdEOL4PBPLwfiXQynQEFtieClnd0rtB2LZLeIRmSh4qWR6Z7IEKt9OtR/eK4njDsDHSsSVGxIsFUTKpQDj0gaclKEja27ke+4+Q5PPtIwfVO4uKrOYBA1MQfA1bd6+4cM8smBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=FA3H1Ue+8mb+mW4I5VAme3usDXqRdTAvt0fedEThqnsNDXtEGWDmkAjqGXQUFZviynNE7eKmvr18S5kyrMJlvU9bFavq+afLpuM2z6IKtf7sRiv4mmmvU49EKn1Qz13KxBwNWMd45TWLNAYl87sZGK6Jc0nIdiPKCiXoBuHrNh9BJxr7yElxcccDyHW/JMtHZK9Ls09rbtmz4+2FWhrE2+9a8AasvTXFY/ZWrwRnIA4g1q9ldPv2M4/qFUTefGPAw8M0PKO+63EvKG7YjLIoclIcPoumU8r93lB7EijewVA7doYkkzicDA5PmLcm4oxcd5s3rCGKIUosHbIZOXSt0Q== Received: from CH2PR18CA0017.namprd18.prod.outlook.com (2603:10b6:610:4f::27) by DM4PR12MB8452.namprd12.prod.outlook.com (2603:10b6:8:184::18) 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 10:15:19 +0000 Received: from DS3PEPF000099DA.namprd04.prod.outlook.com (2603:10b6:610:4f:cafe::f7) by CH2PR18CA0017.outlook.office365.com (2603:10b6:610:4f::27) 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 10:15:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS3PEPF000099DA.mail.protection.outlook.com (10.167.17.11) 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 10:15:18 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:06 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:05 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:15:00 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 3/8] soc/tegra: fuse: Refactor resource mapping Date: Mon, 16 Oct 2023 15:44:31 +0530 Message-ID: <20231016101436.7146-4-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-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: DS3PEPF000099DA:EE_|DM4PR12MB8452:EE_ X-MS-Office365-Filtering-Correlation-Id: fcd79bd0-39f9-4aee-d389-08dbce30cca3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Nqegj82AxvbaYC7S1nOfZo4psz5tEeQEZRhN9gFFtxvNBN7LakKD04bsVRk/xv5mzKebg1yHyWFEfJCAvWYPJjTISrS9jZQa//kFGmY37q27U+T9uPQXWXCu914/e2Sk9C2pogi7OKHUz0t4SWA6VFaQeaLcUNGRsIP7kQ8YVa7HqOimPt0b9jW6r8IK0pTaKdyUHwMglGVz1bUWP8++NU6Efdy3RzBOwZmDCYg+asTIH0T2VByEzci0d7iqZsY0GsqPQ7v1PJEqUZupOUZ98Xzi2aPSe7Jmq+oiL0QR4+wNyVnFDO7kGqsMCdfVFFU+lK2XgUnYpWkMON+stIbE+PwQh/OcAzvo639SVo6A9MGrfWxL7ab6bpOb1u3TjvWEhU4AzNiKAsOzIzeptqg8ntOZs9iWMbW2JoqnVcy3P8VbuGfCyYUCSQWZb7aHzAfChndbB5HLvxwNdDPD/869JBxFIknJX7DoFvPBw8XJB+vIqwW3P1+G+koGw+JvfGmd2g7nCefdc7s/+I1JtQz5UQPN2tsx3FQl1lwRi5a27DLtOOrAaQAtWE5R6CgQPjn9qHQGcbIXdbP6wTDC0Yw/ASAHprkCDe9hfOiiIMSjdr1xEOQFbfiH5VEZcyA8s9XoxeB9W+f8e3aZ3y/xsnh6YvBxO32vkBSKwkCzIGHSHh5Gt5AG8sIo3WCdvaTruyIVLIKLsvo1FLOPAFa7neWVu4SLaxK+B+MXXTUpPi4O1eooLO1I3s6X+da3/IPNDFe7Q6o72oS00KpqLbZA44OuEuum3Oi0tBMk4SFp2vJOuqlaViV3deEdz2wHfbWG08/5 X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(376002)(136003)(39860400002)(346002)(396003)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(82310400011)(36840700001)(46966006)(40470700004)(7416002)(478600001)(41300700001)(8936002)(110136005)(70206006)(70586007)(316002)(8676002)(5660300002)(40480700001)(36860700001)(47076005)(7636003)(921005)(356005)(82740400003)(86362001)(2616005)(26005)(36756003)(336012)(426003)(83380400001)(6666004)(40460700003)(2906002)(1076003)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:18.8535 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fcd79bd0-39f9-4aee-d389-08dbce30cca3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099DA.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8452 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_NONE,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 10:14:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422926 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 BFDCD1D69A for ; Mon, 16 Oct 2023 10:15:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="SoJ7vhug" Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2052.outbound.protection.outlook.com [40.107.102.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7743123; Mon, 16 Oct 2023 03:15:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GQYu2kY1U5G5H+F8oY4M+GmA2enH6EUnbNNp64joTtV926fZdvrTLc/bf3GihX3PQmndXNtccqZ+lcGNUxmscZX67gX2ZnvQsuM3hfRNyMYZg5KhrHe804/QHOLxsaa3CdCVRZARMgKo+w8bRQ+1iUORcL/PzIfZ7wwDrixu1n1QVtpo7PnsRV6v6WHRwqiGnMJ1egWZBl6FF1ajuXNyML68brME5x6uHDZ0h47FLRNJGQmm214uk/Z5it/OwU4NsiaKmCf3+5xnnn1mobP6h8bUPKDac9DbG0fIe2S0A4h/gkpcOtlqXuUZveAwrDU8OOdwy4p9BJW7kexsfhl8Xw== 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=Huwxg3aaNBgwNNxWl7rYicXbXEr+ZCJVJJKyE4DsCNU=; b=khI81Aeem5EyyAMCMHBGrMsCpN6TsSN8ZCnDhi7L3Nw7WGSTa4h4uotHV5v++FqP04rkKIK0OYWJP4VGFrLqj96GIAocsEeyKYW5GovR7LC7Hh9wnRYceObpu29gs2dLvOeZdSnFuHYxE8E07ldVS/eP6v2r880ysxq1YruVnEVjHsBdZbZpQc7GvDSrG1VmIkjrjUIXMNjdApLT231/nwLXgsBb2sm6AdZUh+qk54D5UTa1Pz1j26Lvu0a7L3ZoFAzI2pUPCbNYLHN5/lja4ByyH38l1E99KR0Z6sDnyiGQJ/DDYC2CV7Tiv9nmjFk8ApQ91B0z4649H6CSe2U8sQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=Huwxg3aaNBgwNNxWl7rYicXbXEr+ZCJVJJKyE4DsCNU=; b=SoJ7vhugt4aft1ur0hmCyj63dKhf0J1DWWPKT2LT2rjl/Isxa4B7nZZ23FDDA9nul8xTVrjV+KUTRLVAntOvmjX4GekLOOqiZY6mcHw/uR5j1W4rMQfDoVvh6DZHAJ4EEzsyxQ7Sgj9mhC+1ODqrzeWZBZE+wrwUJ4GXgYkktDKcELoOgze9bAMjoK848zn6dVkCWhWrJdIetwjPgavLZxbQknYpuu6pH5JuQigSR1+Tf87fOoMklKUnO0inXlYVdm8e3MLJPWiSdXrbZybz302vC6y88AoAaT0bREAjd+IbSr0BRZ9ZrMhOTcv2FX6L/29fPldFZZY0x6TXfrDIjQ== Received: from PH8PR20CA0002.namprd20.prod.outlook.com (2603:10b6:510:23c::6) by CH2PR12MB4876.namprd12.prod.outlook.com (2603:10b6:610:67::10) 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 10:15:25 +0000 Received: from SA2PEPF000015C9.namprd03.prod.outlook.com (2603:10b6:510:23c:cafe::fc) by PH8PR20CA0002.outlook.office365.com (2603:10b6:510:23c::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.30 via Frontend Transport; Mon, 16 Oct 2023 10:15:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SA2PEPF000015C9.mail.protection.outlook.com (10.167.241.199) 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 10:15:25 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:12 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:11 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:15:06 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 4/8] soc/tegra: fuse: Add tegra_acpi_init_apbmisc() Date: Mon, 16 Oct 2023 15:44:32 +0530 Message-ID: <20231016101436.7146-5-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-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: SA2PEPF000015C9:EE_|CH2PR12MB4876:EE_ X-MS-Office365-Filtering-Correlation-Id: 7fa599d8-4bcf-4453-fbe5-08dbce30d057 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HnXXmtuxgWYd/mOFSVEgjRhlE9vZwtFDy2fyzT5Z1VSzLs/6QCVp8eXcUQxDFpMF/J+dTS2tc1L63dnR97wTfdvpMPdKWvdq3ryevT+FWz2C+Ah8vpJzjfOZxpOI4oTtzV6yzEsJNNfkqdXy21pjTeyQ0oOvDykWoBgH3UAeGxdOlB1LoQvR/6QurwXsEvec6q1/G8IIM1GwuF+j88ctmWQbFU8K40svdbnF38MxojeGToOc6ojTk1Uk0Dz7doJPIuh6ACPIEZvVWm6T83AwoMKYaWe3ovWi8L2EZrJfC7ktrlDWCXQOfjF62g85D5EY4HwJ0PdwtP/FZFxag/MRM1cfzwESQCMEjZSwSu3rYmqrgKSIDhKNrtMknwwK00STNLqEbE6wt10qRxJg59nYe1qVr73x4HopE6Ax7isCMVToYetaDlsy8H8u7zmXqueqHEThe0/5DD2ccqk0bYRI+PXph7DBZwMaqnxn+zXIwUtDCAs6/e/hwVD6pllPireiG45yhVcePlms4CZ+gsXOoGJJPIL4rKONd44zKD1vepHwcFLqU0OB3mA/JXW9tHvtzeMAlUJYDNdhCkUxTFT+Rd74LQtlADbhWaehosvLZ7RqrFYsX4qhurdKx02AKbkc9aLKN9YXLI68UWR5x4tvnooJXV5bptMVB0CDWw4zzwpBllNa1zPE1Dw0f+PZLwPwRemjZ8u6bqulSDyRE9IBi7IaVJtxrdvfUN1UpeIe3ekW6qkQ1+5KB67Fsq8k51lkAcXDIMzL+D5G1CarG56X2UOSbuelZchOUrfdMyExy1oaLVjIyhB97EmoRMVgVpST X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(376002)(39860400002)(346002)(136003)(396003)(230922051799003)(451199024)(82310400011)(64100799003)(186009)(1800799009)(36840700001)(40470700004)(46966006)(40460700003)(40480700001)(82740400003)(36756003)(7636003)(921005)(356005)(36860700001)(47076005)(83380400001)(6666004)(26005)(70586007)(70206006)(316002)(478600001)(2616005)(1076003)(426003)(336012)(110136005)(41300700001)(2906002)(7416002)(86362001)(5660300002)(8936002)(8676002)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:25.0517 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7fa599d8-4bcf-4453-fbe5-08dbce30d057 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015C9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4876 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_NONE,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 --- v3 -> v6: * Use resource_list_for_each_entry() instead of resource_list_for_each_entry_safe(). 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..6457f80821bb 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; + 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(rentry, &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 10:14:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422927 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 DB3A51CFAF for ; Mon, 16 Oct 2023 10:15:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Q0KCnjBj" Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2044.outbound.protection.outlook.com [40.107.92.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6374B109; Mon, 16 Oct 2023 03:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=foYmv0pVzymGenQmeCJ2M7Y9BlLVVhsn04awBQoVViJZlUujE5jVzZc4uiFrilSO5l5V1q49TRnqIy5UAVg04XI5Ysh47ZVOvj+u+vPU4xgcE2Py0bQGpS9OgPOZ2jYofuAlr7BVINdz8AX3zU0r5WfOm8K4BONjVcmCt549kh1OmLDEWoqmOPEimrem8WzJ59wMqY9pH0uJmSe0PLV7AuXDWwfRXP2pHPDw6TzlNBLKbAxWr4cYBYJ+xmq+zjMFH1YXB/j9TMbVazcO0G5PCDVnTmVpy8SG4uM1GG/f5xTsS9Eov8EwDTcnSNv2zpBmyEMLfb8WO9DG3d4Jx4HA2Q== 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=wHnqTB/I/hBTi1klkL4hU/OmFUiU9wc9yjCWyXOOe8c=; b=Jo6YVWh24Czukgvo1w7wMHq/vCMzi57nfaDIQQlT3Nx3brZLsbQ0zdv2u1ZymJUoNuOCcWx0vbjkanqJhC6vn8yzkLH1N20sKMJBs2cv/U7GR4KyUye28QnCjQtpQY/+P90/bAOwf8qrL7Fx+OQs+xpIIQhqGeZQqCd2eEsotL3B2Y9TmHSc9FMw95ZRbs8X59p21puUE5ccEK8bBRPTcKz07/REDN31AA6fm3YMQosNFgCXm7nZLAg5jDQqTk4XVQi3udCfz9yA4bfo8nVCJeDpdQ//dUbyLKCPS2QhGdnyWl7yD7t24x2dvW5krixmrxhHbpHmvYnKa1PAYbbSng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=wHnqTB/I/hBTi1klkL4hU/OmFUiU9wc9yjCWyXOOe8c=; b=Q0KCnjBjaWIYsP3gV6WZik7Xaw2efOFp5lC9IpdTpe+GO9+G32zLS0wkx2EXBpWwYMmmAgO5R2hWlE8xm+OXo0MoNoUwUlOYe/jPvnX9z5jvpHxrqL0fNJnvLVvZyU30oBkahm7Sx/ijYCoLOY+XLFbOKSOygaB4CKXXVAmOADWvj67stOqmiSHGk84I74JKb1uVi4CJzNSJg0Si9guUIml9WD3aS+6dBhBfdxYJ2AFL04Nm1mm9aS8EccnE68S3NPr0czhDh0wePGsx0KF3aCFvcuEeJuWY5laaxO94bJrD1FRT3MJPnLnInXo7BKH5Ae46WOmUHAyydD/+QveVhQ== Received: from DM6PR10CA0003.namprd10.prod.outlook.com (2603:10b6:5:60::16) by BL1PR12MB5078.namprd12.prod.outlook.com (2603:10b6:208:313::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Mon, 16 Oct 2023 10:15:31 +0000 Received: from DS3PEPF000099D5.namprd04.prod.outlook.com (2603:10b6:5:60:cafe::38) by DM6PR10CA0003.outlook.office365.com (2603:10b6:5:60::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Mon, 16 Oct 2023 10:15:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS3PEPF000099D5.mail.protection.outlook.com (10.167.17.6) 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 10:15:31 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:18 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:17 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:15:12 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 5/8] soc/tegra: fuse: Add function to add lookups Date: Mon, 16 Oct 2023 15:44:33 +0530 Message-ID: <20231016101436.7146-6-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-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: DS3PEPF000099D5:EE_|BL1PR12MB5078:EE_ X-MS-Office365-Filtering-Correlation-Id: b62457a4-14b7-4380-8e55-08dbce30d411 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Mk0LP8BUIStzTxQ2wtmF3yyB/C5EOqvazvEOHseQ7JBPFt37IU4PoQo4BWxSHtph2TKHnt/MFE/iWT36/KEVKoqt9J5HDeuSLUybBoMCvAOrLoFuQGkbyqI4MnnHlY/omDCx5/CHqEUUh50v6YY71flzvxji457HK++wMBcHH2RFARpGDvU3EX/Y0mDnos8LfYhATF/FXBuXNVvP4eGfQsHmrMYxiweeFY0ews8BzsKxQVHk+WJy+Yx48wPzxtEvK29qD+RVpHX1S9dyLBSqtZkhzNE4mowiUOHqZINSZh8+Wls8kz+R/ruZf9xq2iXw17tS9BGOh5XY/T0b2/dO+t9rwPs9hFmBrTILKeFqKXcHH2JHNLwUapDI+oTyTUjYl5dOTF9vYlyN3IgxJ7BNE9qmsmEhWwwTgMqgh34NSNdbx/favm80gMtwwnbz/W9BucCqOWzU/IpgJ5Bw2wIzR+hJuLDcAQKqBOrh8mX5E2x8PDZBOJKR9TAfuq98lpdk966W50RKVOE0YI5iQCXknRAy70NVYlqrDSLqThaYNcKBVK1vnysKUzg5NFoZlcYOdQSaC1zFmirtXuBBpWlvYhn8/5fIl2iZFKsBeau7YU7hcLP2+Zi+dHKkxWkMXdlwautHCgwwFGqgDdqaqF7qn7xLGH7QxxO7alJyHyGwfvDIG053CmHgAsFt0VmzIl4a3XwVnuKfCiH4zc7mg0dvsazyCGUnipLJqu5mNWfKL2SvuhMnXr69vE/pQqgS9cxKmdDLbjpOwViHDCvzBYQSbB9+9O1W63Mi7DzF9V9k6uzDi9VrHZagHUzJ/2oE7oDZqyt37ty9+Sgld0kpZae7fg== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(346002)(376002)(136003)(396003)(230922051799003)(1800799009)(186009)(64100799003)(82310400011)(451199024)(36840700001)(46966006)(40470700004)(47076005)(478600001)(6666004)(70206006)(70586007)(316002)(110136005)(1076003)(26005)(2616005)(336012)(426003)(8676002)(8936002)(7416002)(2906002)(5660300002)(41300700001)(36756003)(7636003)(86362001)(921005)(356005)(36860700001)(83380400001)(82740400003)(40460700003)(40480700001)(334744004)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:31.3167 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b62457a4-14b7-4380-8e55-08dbce30d411 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099D5.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5078 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_NONE,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..4ebb5597a77b 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 10:14:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422928 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 721741DDF4 for ; Mon, 16 Oct 2023 10:15:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="lNRne9lU" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2060.outbound.protection.outlook.com [40.107.94.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A951C123; Mon, 16 Oct 2023 03:15:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UNImDBtYW+aExC4B48HYeJrW2rSAEJod++pVHNFCmbkQsqyHxMVzuFd69GjkZcwU/jL6Tmp5/95LpJLJHLw5hiAtUFjycW5zopvGcN8lxm3NIe95i4+Y9/c+U3Dhs8Tc2vesW/sCpUK0jKMgOtAa041sts9591tRP0e0zh3QKqYd5X2pBlpOjeltvSpOCRO6QOefJKnw/bZguKaQZAf2xVEGrRnGUIUEAeoclQzJLjHj4+MfhsTnYDH6D2CB2cyDNUAxvxhQcDtTyJGXjbRYb222fCjIZ109UcNG/ogqQw4daeTUVAqgjE1vfVuAPn7J+Wsn7Jg6VAMOxJ/Y4lhC4A== 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=Boe9hAUW3Y1DekcyUmXJ4mkqskHoBpTocROHHjVt0YM=; b=etuZbUc6tiIlcq6D7uygKutbsrJkaeHX0AKfTzSjaXpzN6dxa2CtQymow+cY2j+cSiwkdQ6midlTIqcUJAJgszivHWTUDszOCus0NyMBSevoBx6Ed1KOWgzFLsg+iIyhnGd0N7hWKRYhbYXjEmbi5AN2uSRPI69lwaSvR2/3xHt7Pr/bMuuXqswIxKZIpunwHkEVsnVxiswlYweKa4ExSKLgvbOkPxsFYaUwTkfz4iaB9quoM8CTZoIKFZJuU/xpPJacLJTGheObg2iLWYnMaufWNOGIX+2WDuL6vV2+Spx+fWOWNLKAXIiHj0OuyKt2BqqoKcwYrtbcp04YcnILwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=Boe9hAUW3Y1DekcyUmXJ4mkqskHoBpTocROHHjVt0YM=; b=lNRne9lUlD9wSr3q+JRP7qYMxy+tOen3kxVPqB30ko4mvC/UGMoyePJghUtwHzF2lykT7TePFjEntmYFfPl9Hk3cAgKZ8lK9ydQNWW+qkHCDNCP5TZzJ6lwWqcliVIqKIcl8fnjZZO7omWKqukCWEik2AW5Q3ez1gOv4EcJzckG/2uEVzfKSIMp9WdGsDXrMsujZMplcRfvoWeF2G/ut3c3lGuQX42LPayQx5m0sgj5NnaW/VswcEFMbJIU9qRhfVf4dU+Fo0oFIJsjxSUsu2PzS+6TU9g37juig1n7+CG5Ujv3cy0QzaXW2hx6s3iBFw5qtlUIA735S5rNr1pg7GQ== Received: from SA9PR10CA0028.namprd10.prod.outlook.com (2603:10b6:806:a7::33) by LV3PR12MB9331.namprd12.prod.outlook.com (2603:10b6:408:219::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Mon, 16 Oct 2023 10:15:41 +0000 Received: from SA2PEPF000015C8.namprd03.prod.outlook.com (2603:10b6:806:a7:cafe::d) by SA9PR10CA0028.outlook.office365.com (2603:10b6:806:a7::33) 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 10:15:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SA2PEPF000015C8.mail.protection.outlook.com (10.167.241.198) 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 10:15:40 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:24 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:23 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:15:18 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 6/8] soc/tegra: fuse: Add function to print SKU info Date: Mon, 16 Oct 2023 15:44:34 +0530 Message-ID: <20231016101436.7146-7-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-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: SA2PEPF000015C8:EE_|LV3PR12MB9331:EE_ X-MS-Office365-Filtering-Correlation-Id: c2730010-b993-46d1-eb60-08dbce30d9af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Vyj5hgZUNf/Gu0aqe+M9bZUgr6TeK6JZ8STXp2Jez0/rk+nr2RRQ5+i0WDlLdPgzu11g4UCcBlGgIYL7NXTLih0jhv/LRiki3RcAg1oeEF7NgahH3E+Lii7U/yx9ew1ku+ISSVZRqcq8L/ttka57uJilAFeSVxIGkUYVe4lUrwZxb6/+zoe1AvNbaZkuKbo7FBquvk97rNcGtRoUzUWfVfsupmkM0jLf4TibJubQaPKJ14Tgmhl46McHpvKy9O2ifLS1vuC9yqTM4MiDl1a6+d+B8xOl63Xyv2LKa1LDmYcgQuTIFmhHQ57AHyO9GGD5uWgv1LfRKewglTaJdgpdrCwYyNM4VO3uLiMqqXXdFWVU0ZlSF/suRM7QE3k6tR6DNJ3t7bBysdCvVLHas1qv8n4Q+gjwksEwiwGR3qSrQks/p4glm8vlLjmdRgGI6Sg6BQDz1W/Np0qKzdw/drj2Pn8AtUvOSyR1xBq7861YitFGN1jZ4KikVNND5hY+iDFfHi/DsR6NsB5lTvZf/4150lVdWO7dPlsSjo+32Hwk6nL5i2Bp7mYMpovL3S0L3LUqaHmuW9Qu0MsPW28Rk9WZ1AQoEIt+gwDIhnfaJj9ORgTrjpa8IZ+ep0ylQBe1g5pzQJq02NgBO57r/vJ6h44A8Ux+tkSvtUF1laJ3j8IyzH5GzR0bfXH/h3XAjGv3kGM8upYHaoPeOq+hr6CM5lQO9kug/LUrX+2WuSJGspTKQIoDTNvM9qsm66rfRFchdVVsgcVvMhxNnZn0quNqqAx6QYeU4AdsmUqGMy6PtopbiAg= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(376002)(396003)(39860400002)(136003)(346002)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(82310400011)(40470700004)(36840700001)(46966006)(7416002)(41300700001)(478600001)(8676002)(8936002)(110136005)(70206006)(70586007)(316002)(5660300002)(40480700001)(36860700001)(47076005)(921005)(7636003)(356005)(86362001)(82740400003)(2616005)(26005)(36756003)(336012)(426003)(83380400001)(6666004)(40460700003)(2906002)(1076003)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:40.7431 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c2730010-b993-46d1-eb60-08dbce30d9af X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015C8.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9331 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_NONE,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 4ebb5597a77b..7a93c6512f7b 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 10:14:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422929 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 99D7D1D55B for ; Mon, 16 Oct 2023 10:15:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="tHd0OC60" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2040.outbound.protection.outlook.com [40.107.94.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D75A7D49; Mon, 16 Oct 2023 03:15:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I/2MZ6FdFOw7AM5lE2jSam/dD/SDRm3UWLSgK9cSY59Hw6g+SAh5DRSg+IdMPPAPabJkXTLr0hlv6PtyIogH9I5nrHK8MqoVNnk9maN7L/vaRwvzIM1LTsSODsO7YCmHbSprhOobOJOy1Ha984y0iWXRCnAMjAOxkeAbpWJH6L0ngVwNscwLYFbn9NH7COcf92Ho6+6wl7GSSLtPrwRqvCNi9RqkMW4gc33dR/IYyJH1IzlzcZ2u7XbJ96F2peQF3Q1vlqnmkq/JxvihIxb6zVpykDOKw8uqgxH14+X4OUrLwxBKMMe/f/DN/7+ZGBR/5ordIUORXwTtMzS/pNUfaQ== 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=vnCLkKiG3WoNwvXMTh+9d4u1aDhdbcmtKjbLuTY7D9k=; b=OZ5flYqwDa/8sSbjkh5fOnGr4CnUrVFI6jSx2Njt8Vj+q4ytFXcQTzcVfFAK9/wnFDqR9Yey9h4ktSdM9I5Rf91fbqxktd2qQ92QRh0Ac8CkRBt/jhmBoo+SJ6EB5543lclH4kmpCxphUAGD56ENAx+69E0eYArMq6tkfkTrM8bh4pMvLTfedxVO6PQiewOq9jJ9XLG7oXKBLfEVso9d5CghW1JzKmlfHMFnku0O9n+/rMEt82X2C97KCYZ6wiC2LFbcuRp2ozo2w5xoTFKDGps1DG6isDgITmlCjS01745ufVvQniqk3uVOctrLPUFdrXjWCtSZ9Zh48WNkZNyy7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=vnCLkKiG3WoNwvXMTh+9d4u1aDhdbcmtKjbLuTY7D9k=; b=tHd0OC60KHVezR1q/NyJVSMSvNuDQpHZ08ykri3DrJ6UOuQz785KPImKGV8OLyZXp8CUSFmC5omrbk16etiEpljljE0xsH+MBfFtsYWZ6h6mK8mbj6MEkuQLDPvHkvOIGVEIyrb/Wo2XDqHPzL5oq/2tex1GEgAzB+Tg1Ikt8v1U9Bl8x4vKLeW7wj4rl8ufky7mamgOfSP8ffyViNm4jlbnTUPBJIjJ+nNwaTFIn54xEjWIN9ulTP18beImHjsRKnMb2MCmkLBLOGy8Sm7djIRwTdrffnCTJ6hkHi3mUR8EK0r+uGIrKXG9luYRx1y9iU/9FATHr806vGTmX2ehDw== Received: from SA9PR10CA0014.namprd10.prod.outlook.com (2603:10b6:806:a7::19) by MW3PR12MB4508.namprd12.prod.outlook.com (2603:10b6:303:5b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Mon, 16 Oct 2023 10:15:47 +0000 Received: from SA2PEPF000015C8.namprd03.prod.outlook.com (2603:10b6:806:a7:cafe::18) by SA9PR10CA0014.outlook.office365.com (2603:10b6:806:a7::19) 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 10:15:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SA2PEPF000015C8.mail.protection.outlook.com (10.167.241.198) 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 10:15:47 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:30 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:29 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:15:24 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 7/8] soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234 Date: Mon, 16 Oct 2023 15:44:35 +0530 Message-ID: <20231016101436.7146-8-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-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: SA2PEPF000015C8:EE_|MW3PR12MB4508:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c74d648-26f5-4277-33eb-08dbce30dda5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DAJ48sWstUPNxt8Uo7a0vtRBzyzVJY4eYZ7ly+Qnndmu46Rh1A3SLW7Avsut8dE5oBQGKDBmq6wgnSwjDnOVQVLjf0ahkFdAKWws1Bt6zHlGsBnBCdcbKXaUfyQgo50S8w+bm1PILl0dkpzrXJhFw8RD5hiHIq4Qu9UAT1/DA9CGn8aJPHG5htrKtjgXEkICeOcy3VjsbDUcqbLPQfwsOA3qUZQHuH44pk69iXwUt+Ill/mA5pUdY39fz3xGruquG3o5psgVcLUwLj2IeptmX26nZ7D4Jl3H05+pypljLumpbUpW8lazA1FGLtySMMVPkN0RjoVVFaz4utecA0Uiqmp5QSZBhdXWEV/pdsCPSCPgLfsDek8ES9I47jpuZjDuu7OzZXC5D5d+V3IuBGMjIF2PO1EvCoYxxFpZTGbhg40BMdAz2n50IgSub6v2Vls6pVP8z1w2Y1Ar4ZgDsu7hZWHZLVOziu7fT3TIqutc3tt7VBNjD6o4PbjTNUe1z8MMqOAOYkRUKeTsaQvFrQMdLTuRoPhw3XkP09kkD7h7UxxTXQsrZxuIhLV/u1cslu1J8JiBYCGckUOFuGOFKTTben4xQ5yZNTvlOwmNOPiRcug2kkqh5IOCUZ4R9b2Ma5aH44/FeaELktKN3egs0NlGvFCPmu0iA9SDwoCTSAF3HixP38kBM9X9a+EFDqahljmXjaGi7OZUEvfpw98edH5EA5KwUX/0MBByQ69Q4mQtyJwfcEIlUheCDODgTtyZDqd1KDug69GGSOAz9Xh9x9wsks3g6B9rsI/3FrVDjdzVG1Nts2VrO5aOMXkYGova6jbb X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(396003)(39860400002)(346002)(376002)(136003)(230922051799003)(64100799003)(1800799009)(82310400011)(451199024)(186009)(36840700001)(40470700004)(46966006)(110136005)(478600001)(6666004)(70206006)(70586007)(26005)(1076003)(2616005)(426003)(316002)(86362001)(336012)(8676002)(8936002)(7416002)(2906002)(5660300002)(41300700001)(36756003)(7636003)(921005)(47076005)(356005)(36860700001)(83380400001)(82740400003)(40460700003)(40480700001)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:47.3994 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c74d648-26f5-4277-33eb-08dbce30dda5 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015C8.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4508 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_NONE,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 | 52 +++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index 7a93c6512f7b..39a59545c93f 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,7 +154,38 @@ static int tegra_fuse_probe(struct platform_device *pdev) return PTR_ERR(fuse->base); fuse->phys = res->start; - fuse->clk = devm_clk_get(&pdev->dev, "fuse"); + /* 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_optional(&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 10:14:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422930 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 1FBE81E511 for ; Mon, 16 Oct 2023 10:15:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="RqDIbZdV" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2075.outbound.protection.outlook.com [40.107.223.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B035D4B; Mon, 16 Oct 2023 03:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JEh/PCfLYBex2xQ9P3yg2SrM7VZ4pL6oU41VRbRd91FZ/kTr2nWYJB/Bo0SIck5t2bsmYDbKRTWvrBNwZPEMcRg/CJ4HLpbgO4mTwFxUAybDyz5RrF1JgX2UtGvXpI6Tm+peUIo9zrjFuKM9KGe609GE0Sp6c2F265rD0oiyyRug5CZC0/8IMFCfDMKVwt50EGXxMMhe5BQKhQwSFBmglvwuc3N7Y+QabvVaWOit5coNRmnSK88vBAjSxd++fFfjPXHLNFvkvcTmrfj0dyAh3jeq5clV1TjBDaxVl7Sc18HS4VV3xindaSH9dTrn6wDCashbNKsb1ug11ASsAHoD+Q== 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=3b6A1/4Co5BKI2JVzzuIO8+xdLoWsK1IncyT9iv4Tgc=; b=CySMYKHDMWXTWbiDfGv19E928BhKCrM8rETUm6GQYy2FeHVrowGvuKF25/NCfF0Ii9EJiM7mqZ7PrM2XOU4yhoRmQSWF3L7NGzCtX9jQh+nHdijub3Wb0t9dxR7k8X2M5dIJAJSYK1HtWoYplC3lZtCSwDRAfo9D8ka4fLUWr0olPz5W5wh2pZ1QBIsg7U3TtbNA8rYQwe+4uJ6YRukodKwcgSuAR8Q0vMf0QgoNBUzblwPgXw7zuiQmsRHbi0ARJmHvzj6vJP2gFmogyuYOuLPxho3+4Bi09cdOIzl1U03WF0/gsplnLg9oK2PStvR+aTEFx1kRBlom66HgpNeBMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=3b6A1/4Co5BKI2JVzzuIO8+xdLoWsK1IncyT9iv4Tgc=; b=RqDIbZdV8u6euTRJ2wDzj9pACLWR4UMZdfY4VTm4hrgDBMtpNNjg2lJWGZl7Ky5ELdGIOuKxXoAknptNy+7FkVM+WQgWDtkbegV8mO/meNwbzdj4kbtbwomdle/eFhoaLngJNlMpuolKy2aRz6inMJBw1iphLNUTk4OO6iJcIT/qDXz471v3VcsvJOb2v/hm8fqICLuTi2I5F/FPLZ+khsIZvs8KCRUGSmGHv3YayHCIA1nLLIUyfckBx2SpIT8Kj9x7LtQbSN/jqEk6qrDorM5Aw2BiBp2rT6fV1fNkDlkgHfgeANO4Lup2ayZ/qd+nFgFDzPhOVj9vaovlB1sEvg== Received: from DM6PR21CA0027.namprd21.prod.outlook.com (2603:10b6:5:174::37) by SA1PR12MB6920.namprd12.prod.outlook.com (2603:10b6:806:258::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.44; Mon, 16 Oct 2023 10:15:48 +0000 Received: from DS3PEPF000099D6.namprd04.prod.outlook.com (2603:10b6:5:174:cafe::8c) by DM6PR21CA0027.outlook.office365.com (2603:10b6:5:174::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.2 via Frontend Transport; Mon, 16 Oct 2023 10:15:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS3PEPF000099D6.mail.protection.outlook.com (10.167.17.7) 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 10:15:48 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:36 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:35 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:15:30 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 8/8] soc/tegra: fuse: Add support for Tegra241 Date: Mon, 16 Oct 2023 15:44:36 +0530 Message-ID: <20231016101436.7146-9-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-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: DS3PEPF000099D6:EE_|SA1PR12MB6920:EE_ X-MS-Office365-Filtering-Correlation-Id: 35501aed-6597-400d-cabc-08dbce30de1e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QDjo7XemUXDn1njIO52G3Bz2qvTFC6LSS4kEaKaRrs000AJSLg1u34Ek7G8rPPcEKg9irVtE1x1XLUoT62BsITkmoBFMQpjbdvZCqN2VKFLfyww0W0vPxJv2gR5ZjtEMH7T6SUHFkY1q4ftQQv2j4kEiSWhiDHgRQPhUl6i+JQ5eSVlwiyn32RsC7EsLPeuzlPj5wP46croWSYZAQq0I+6wJ9L6nOwg/pfolDzJ8FBkYzSpRG4B+5/2UXA2+qH/ILmbm8rn1NDGBzy3txxMmvn4d9epvBY8p/kITjiVozjPURDoFdzQWO0MfUZn6CJ1TuxHrUQZVa7jPfAoVZ0Sc55ZqIsD8JxieRTCvpISAe2dw+ekrlsrcmSZaplPdOI2B9mAM+HEWW42dwl2cpaqTHQosBsvfhZqzxWDI1NyviLJVBFqn6jrsY9OidJBnRPurOwYE9X44wNeinpbBbVc5DW1ZhGkDgagOyyYylcHwlg9HHACrUPh/1XwHos6bICDBbEDd7e00RYslVW3kYbZ8ifnH/+XzeXWX6wA+PmMIOg7fgcLSTVT5rvli5mvhvWqAbt2VDVNB1+HLkZpc/DDn4lZNMq1hEqX3k7eD9Sot6mU2Lf3FN1BVZjH64/6tNEdSUyeKr9GjEQRHUwlXELJxDoZ+uL4RodEdnDaOgkKP37BwSdRhM9I2bxqQ+osfOdso6C/7/sTSC1/p8X2HYRNFvLfru9npEbHfqfJJCRMdvQgIh+3cyYDcNpdA35OvwknrsAMYNDieiIwdShORrV6lqF3aReaQpZER6R9J7LrAjuCqekb7eAVXtwcOkEo5qNaG X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(396003)(136003)(376002)(346002)(230922051799003)(64100799003)(451199024)(82310400011)(1800799009)(186009)(40470700004)(36840700001)(46966006)(82740400003)(5660300002)(921005)(8936002)(356005)(7636003)(41300700001)(8676002)(40460700003)(86362001)(40480700001)(7416002)(2906002)(1076003)(36860700001)(336012)(2616005)(478600001)(26005)(36756003)(70206006)(426003)(70586007)(47076005)(110136005)(316002)(83380400001)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:48.1806 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 35501aed-6597-400d-cabc-08dbce30de1e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099D6.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6920 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_NONE,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 39a59545c93f..240846dd56b4 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 6457f80821bb..e2ca5d55fd31 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