From patchwork Wed Jan 4 16:39:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088740 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A602FC4708D for ; Wed, 4 Jan 2023 16:42:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9EA6F10E54C; Wed, 4 Jan 2023 16:42:05 +0000 (UTC) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2068.outbound.protection.outlook.com [40.107.100.68]) by gabe.freedesktop.org (Postfix) with ESMTPS id 938E610E058; Wed, 4 Jan 2023 16:41:54 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J6SV2o3DVYiQVK+vrgIkFNBJjufxGd7uo5eFiil7s36i4+iycHEzxkaF2a2rZqO+m+i8wVoTWCunR5m6ZnY+2uqIL+516qwubBwwCnQ0vEDwwEyAk/11eAA5iJazN2A8roPUibd8x2qZGrGcsoHhkP4gWa6Hk9uQYJTtavr+UL9u/FTM3HIKCjY+x6Mct6ZIy+96DZgZ98JUOP55xHrpf9i/5saeWIEGAV/vkJo6E+dvmsEY9pJltGT+8tbp0idKBEYEuxjz2ZYfKrPlviwhqgAHrh3XzyiifJbj8ALMnx+j70L8Nl8WvUH6YbbHU41tQkoOZ3OkJup47Ln97/1glQ== 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=m/W2v75+G03JpFiqlh+KJepaevNRkX/3FquwmPd1Y3Y=; b=nceH22RXZmJfe2vq7U40PchDMBE62DMtAnX89EXGBYzk+qXQaRx83AelXAa7e4jB2FKiPW5AzQPOMJHF7K2OLWkiG7jXIGT9DuMoZp0ldNiT5KzAAVclMpclqKGRvbR8C3WpQNqpoY098rkTpaIfrriI0XA0t9UAG6khJUlLTXyBkYVMSgTGLvkkRU6kdsWBNL5vxmJ3nOupO8tRV92rW2N0D3xALeatt1suPWqxBiAJcuTJjlBgbMKZF4nWbvPnTQb/dHmba/pealfcD4ij5/e9wLTroJvkSLkaRrJOLT+0040kSNDdz5fVX1szJbMYov4z1r9sDAhuq9i7vesyOw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m/W2v75+G03JpFiqlh+KJepaevNRkX/3FquwmPd1Y3Y=; b=RurEih6XtkNF4aya0tcyR88LxbfwSwcsLQ7hAU8Q8Lr0IOzJeh8bOWBvgDjVqVHhIsVN/ttosyR1aAk4MnbyISy4qWac5bItD+spLQOtDpKEgjLbah5TJoTmwYjRNUCG73yqQa/tfG+PBujU7oCMb+5R2zVlgfaTDsowwGujAsc= Received: from DS7PR03CA0307.namprd03.prod.outlook.com (2603:10b6:8:2b::13) by IA1PR12MB6411.namprd12.prod.outlook.com (2603:10b6:208:388::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:41:50 +0000 Received: from DS1PEPF0000E644.namprd02.prod.outlook.com (2603:10b6:8:2b:cafe::e5) by DS7PR03CA0307.outlook.office365.com (2603:10b6:8:2b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:41:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF0000E644.mail.protection.outlook.com (10.167.17.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:41:50 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:41:45 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 01/45] drm/amd: Delay removal of the firmware framebuffer Date: Wed, 4 Jan 2023 10:39:50 -0600 Message-ID: <20230104164042.30271-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E644:EE_|IA1PR12MB6411:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d4e3923-978c-4986-cdff-08daee729427 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w/RbPgZE9so4v4lgNh6pc9rRK9wtfeF5Q3ECeexBNfWWRx9aqjReecVHCI9Oee82fxbtGxb8dXFlzLd7JHfFFAZje6nIltLPA8Nkb5996lsXmadkl5TDybjykiWTjQwP/AeoqI1XcK+9Cr23BSthWiVURelBzfHqZd7ROttIOKLBlWZOwpZFjVUAp2IGHotjI0bjBRdLFdUkjNlxeuKeN+FKSOAPO7MEqaXDrn0fykHywRHYTbNCRzweaMdPgi9K1CrQ2f92wMzzB7x8nDfR+WkWIXO3p8jumgn7Ho3WmpfL+3/G1vtoYKCYvvAs69EHOepvp4fjf4Q4j0gvihq7SWX5b2HcGFqH7ZLH5bmHwnsqO0j4E7v4W9UAmgZdwpdztoee5+MHnzDIZmaEZB04mmcapb5C7EfVnPT1TRic9VVSaR49cBZZB5Woqs+kdD3S899RVVcAExhfxnFyIe4a57fI7J3WX7KvSQAzOag73+FI1O8xK3k/yxH5Zr1mKXKNG+QC9pfdJ1HSg4xzIJS2f38r1rx3qCtFi1SXdIGe4oWt/WTlOloUUJBk3YBaL5XnUCIWk4SoPpaDETyJyBCOtj/Zytfm7cRtjQWd1NJkiuPjcPSs+dtek5UwPVy5U8UFjpDnLty2PRVNNQvuhzebHjKMefrqLGDRMYv+BYFZv+24xOhhuU7467bARhIcnBzmZU2RQpCNZoCDMslhpd7+xTREQ7OhDHHs3JUDqwZm3WE= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(39860400002)(136003)(376002)(396003)(451199015)(46966006)(36840700001)(40470700004)(83380400001)(426003)(47076005)(1076003)(16526019)(26005)(6666004)(336012)(82310400005)(7696005)(40480700001)(86362001)(40460700003)(36860700001)(36756003)(81166007)(82740400003)(356005)(2616005)(186003)(316002)(4326008)(478600001)(41300700001)(8676002)(2906002)(5660300002)(8936002)(44832011)(70586007)(54906003)(70206006)(110136005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:41:50.4884 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7d4e3923-978c-4986-cdff-08daee729427 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0000E644.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6411 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , stable@vger.kernel.org, christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Removing the firmware framebuffer from the driver means that even if the driver doesn't support the IP blocks in a GPU it will no longer be functional after the driver fails to initialize. This change will ensure that unsupported IP blocks at least cause the driver to work with the EFI framebuffer. Cc: stable@vger.kernel.org Suggested-by: Alex Deucher Signed-off-by: Mario Limonciello --- v4->v5: * no changes --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 9a1a5c2864a0..cdb681398a99 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -89,6 +90,8 @@ MODULE_FIRMWARE("amdgpu/navi12_gpu_info.bin"); #define AMDGPU_MAX_RETRY_LIMIT 2 #define AMDGPU_RETRY_SRIOV_RESET(r) ((r) == -EBUSY || (r) == -ETIMEDOUT || (r) == -EINVAL) +static const struct drm_driver amdgpu_kms_driver; + const char *amdgpu_asic_name[] = { "TAHITI", "PITCAIRN", @@ -3685,6 +3688,11 @@ int amdgpu_device_init(struct amdgpu_device *adev, if (r) return r; + /* Get rid of things like offb */ + r = drm_aperture_remove_conflicting_pci_framebuffers(adev->pdev, &amdgpu_kms_driver); + if (r) + return r; + /* Enable TMZ based on IP_VERSION */ amdgpu_gmc_tmz_set(adev); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index db7e34eacc35..b9f14ec9edb2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -23,7 +23,6 @@ */ #include -#include #include #include #include @@ -2096,11 +2095,6 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, } #endif - /* Get rid of things like offb */ - ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, &amdgpu_kms_driver); - if (ret) - return ret; - adev = devm_drm_dev_alloc(&pdev->dev, &amdgpu_kms_driver, typeof(*adev), ddev); if (IS_ERR(adev)) return PTR_ERR(adev); From patchwork Wed Jan 4 16:39:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088734 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E5104C4332F for ; Wed, 4 Jan 2023 16:42:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A3FB010E442; Wed, 4 Jan 2023 16:41:57 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2083.outbound.protection.outlook.com [40.107.94.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id EE0CE10E058; Wed, 4 Jan 2023 16:41:52 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RmPHk+vtwvC2E+NzSb988m0wsN0l8v4x4MhvPxpMoifYy0FGnPgPg7Ix5wQ2vzRHJkIidZwBWvBZJ/TOcye24/Wftv/jQ582vY8piNPz/yckdaEcPJE+lhM2QFrGA698l+DFkzmAzsUwLm3/2JrY9bKu/J//CVeo0IDkaG0L32+MgEerEhtFIyjEvnrA6bLfAFft5ULF0K77zbpK+M76YqBXwkikGElhILz4ODd3Xkz+5QByUifrZmILvKKiBRT9mLnSBBo/VYQGdkuB2G1K4sSEE+0lnqcPN5W+kPKbWMCNveR4dCezcmuB+MmRPU560sINjdKsOETAsPCurRJLQw== 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=NoCJN3HhImmHrmnKweBk8pSJ5G2rBeB9x2K6QkGQYoU=; b=DHVMvyJFe0uRpMRDT/e3v3U57VgLHO8qwh/9lrNEnAyuafB8I4j+Wr8SJfoFy+yGamBiK7YYBYsL/2VOnr+eUJSmvYD+LyuWCiS1ILUWCISWo6dHFxyShAWLXuIZnWmvR4j3hy8AmXxTQHkB2EitOO2d7sIpUAWTTUGyVVpTcfZl7hm+NKre7BlTjYGNvAQGRsT+3B9Uk7xB5oGX075Lx68EI4lWo3CC1LEAiXnl+DOqmA80zIdBEpiVGqz2jgMqWnSHIbpcEv3udqj3RMJS4TNPgMHraUMEzKp6FjwRIfII1n2bsx5lbQ46CjaqLqle1oJb4rL1xWBP4mtlM+S+NA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NoCJN3HhImmHrmnKweBk8pSJ5G2rBeB9x2K6QkGQYoU=; b=ESuJT9LRN/hod6dGSBHI14lQJPh4dEPE58/gUMNe/vGcCE2428TLqYW0ilL5RzVAxOw0zg0MD2Gq5uLMq9+IBtI+VHw9m994Mrr4PrIUPo+cFd14tiLg3x7zhSSv3yr9FNeI/63L2qDZnTIcBo24ZRkNFJ4sfzrylbVqPlU7KIk= Received: from DS7PR03CA0328.namprd03.prod.outlook.com (2603:10b6:8:2b::30) by DS0PR12MB7509.namprd12.prod.outlook.com (2603:10b6:8:137::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:41:51 +0000 Received: from DS1PEPF0000E644.namprd02.prod.outlook.com (2603:10b6:8:2b:cafe::fc) by DS7PR03CA0328.outlook.office365.com (2603:10b6:8:2b::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:41:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF0000E644.mail.protection.outlook.com (10.167.17.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:41:50 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:41:47 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 02/45] drm/amd: Add a legacy mapping to "amdgpu_ucode_ip_version_decode" Date: Wed, 4 Jan 2023 10:39:51 -0600 Message-ID: <20230104164042.30271-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E644:EE_|DS0PR12MB7509:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ccae722-bac2-4a9b-a425-08daee72945e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rCDl3v02tdBs2nXZN7bWP0I5USI3JlSp803StcyC5JCqwq36JbX+xgugvJn86M+dadLX4TA8dZbDtzsJjyT2bvqgwCw5iHeRI2VyI1nnAfkVpV5uWoTu4n9ynIc9M3MuucKKQbCVPHbAw0H+lVfZpIYIgW36JBQDJkfzHA9R6qyiZ3d9P8c+5OTO5lm5Wqxgcy/n7sqhcc9pg+evbH71gBFe7Px1U+4LUJiJMBHpyyk1uDtiEDwNznAlCha625cpsgZ88oAnPg02D1LdtJHEHit/RD4/Gpzq6n/8dS6bjIck/TL72Ub4JgVV4PqMdwYSMio+5Wr2s2Ga3TU9FcsET3yxFGcmtXB15Kd9uJt/0OzBu3WEEpJS2JC6MVRw9pMei3JM9Ie3gZii26lxW8gNNhfgi4u4qMB/Wflyud77Dv245prv21dX0CPX5RqQBgEI1poVE6+7CmoD1TWX2avziNjkom6BhxBTKIPY/DgADi9XMV3rb/4VZh4KEVJ6wzSK1OosQusaxBj/YTUtcITjUOT49UHF8xfMJX3YS/eC6dekr/+i+3xAclTPIUXEffCpdj33yYKBwkpgZazVCpNKvc0gZjeCUzWjEeqMS20GGyzpuKO8gzlPn6c5MUtmhXvb9Fzc26e2KSPuAXiWe+awhZxzBggocTtdpU7q+pypqdBCIlieGBMNeeN023XYoWs08of0MTiyGXQEo6ePiD8J78q59a+kRmnkVjGxDipIJrQ= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(136003)(376002)(346002)(396003)(451199015)(36840700001)(46966006)(40470700004)(110136005)(54906003)(26005)(186003)(478600001)(1076003)(6666004)(70206006)(2616005)(16526019)(4326008)(83380400001)(336012)(426003)(8936002)(8676002)(5660300002)(44832011)(47076005)(41300700001)(2906002)(316002)(70586007)(36860700001)(82740400003)(40480700001)(356005)(81166007)(40460700003)(86362001)(7696005)(36756003)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:41:50.8478 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ccae722-bac2-4a9b-a425-08daee72945e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0000E644.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7509 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This will allow other parts of the driver that currently special case firmware file names to before IP version style naming to just have a single call to `amdgpu_ucode_ip_version_decode`. Signed-off-by: Mario Limonciello Acked-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 221 ++++++++++++++++++++++ 1 file changed, 221 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c index 5cb62e6249c2..eafcddce58d3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c @@ -1059,12 +1059,233 @@ int amdgpu_ucode_init_bo(struct amdgpu_device *adev) return 0; } +static const char *amdgpu_ucode_legacy_naming(struct amdgpu_device *adev, int block_type) +{ + if (block_type == MP0_HWIP) { + switch (adev->ip_versions[MP0_HWIP][0]) { + case IP_VERSION(9, 0, 0): + switch (adev->asic_type) { + case CHIP_VEGA10: + return "vega10"; + case CHIP_VEGA12: + return "vega12"; + default: + return NULL; + } + break; + case IP_VERSION(10, 0, 0): + case IP_VERSION(10, 0, 1): + if (adev->asic_type == CHIP_RAVEN) { + if (adev->apu_flags & AMD_APU_IS_RAVEN2) + return "raven2"; + else if (adev->apu_flags & AMD_APU_IS_PICASSO) + return "picasso"; + return "raven"; + } + break; + case IP_VERSION(11, 0, 0): + return "navi10"; + case IP_VERSION(11, 0, 2): + return "vega20"; + case IP_VERSION(11, 0, 4): + return "arcturus"; + case IP_VERSION(11, 0, 5): + return "navi14"; + case IP_VERSION(11, 0, 7): + return "sienna_cichlid"; + case IP_VERSION(11, 0, 9): + return "navi12"; + case IP_VERSION(11, 0, 11): + return "navy_flounder"; + case IP_VERSION(11, 0, 12): + return "dimgrey_cavefish"; + case IP_VERSION(11, 0, 13): + return "beige_goby"; + case IP_VERSION(11, 5, 0): + return "vangogh"; + case IP_VERSION(12, 0, 1): + if (adev->asic_type == CHIP_RENOIR) { + if (adev->apu_flags & AMD_APU_IS_RENOIR) + return "renoir"; + return "green_sardine"; + } + break; + case IP_VERSION(13, 0, 2): + return "aldebaran"; + case IP_VERSION(13, 0, 1): + case IP_VERSION(13, 0, 3): + return "yellow_carp"; + } + } else if (block_type == MP1_HWIP) { + switch (adev->ip_versions[MP1_HWIP][0]) { + case IP_VERSION(9, 0, 0): + case IP_VERSION(10, 0, 0): + case IP_VERSION(10, 0, 1): + case IP_VERSION(11, 0, 2): + if (adev->asic_type == CHIP_ARCTURUS) + return "arcturus_smc"; + return NULL; + case IP_VERSION(11, 0, 0): + return "navi10_smc"; + case IP_VERSION(11, 0, 5): + return "navi14_smc"; + case IP_VERSION(11, 0, 9): + return "navi12_smc"; + case IP_VERSION(11, 0, 7): + return "sienna_cichlid_smc"; + case IP_VERSION(11, 0, 11): + return "navy_flounder_smc"; + case IP_VERSION(11, 0, 12): + return "dimgrey_cavefish_smc"; + case IP_VERSION(11, 0, 13): + return "beige_goby_smc"; + case IP_VERSION(13, 0, 2): + return "aldebaran_smc"; + } + } else if (block_type == SDMA0_HWIP) { + switch (adev->ip_versions[SDMA0_HWIP][0]) { + case IP_VERSION(4, 0, 0): + return "vega10_sdma"; + case IP_VERSION(4, 0, 1): + return "vega12_sdma"; + case IP_VERSION(4, 1, 0): + case IP_VERSION(4, 1, 1): + if (adev->apu_flags & AMD_APU_IS_RAVEN2) + return "raven2_sdma"; + else if (adev->apu_flags & AMD_APU_IS_PICASSO) + return "picasso_sdma"; + return "raven_sdma"; + case IP_VERSION(4, 1, 2): + if (adev->apu_flags & AMD_APU_IS_RENOIR) + return "renoir_sdma"; + return "green_sardine_sdma"; + case IP_VERSION(4, 2, 0): + return "vega20_sdma"; + case IP_VERSION(4, 2, 2): + return "arcturus_sdma"; + case IP_VERSION(4, 4, 0): + return "aldebaran_sdma"; + case IP_VERSION(5, 0, 0): + return "navi10_sdma"; + case IP_VERSION(5, 0, 1): + return "cyan_skillfish2_sdma"; + case IP_VERSION(5, 0, 2): + return "navi14_sdma"; + case IP_VERSION(5, 0, 5): + return "navi12_sdma"; + case IP_VERSION(5, 2, 0): + return "sienna_cichlid_sdma"; + case IP_VERSION(5, 2, 2): + return "navy_flounder_sdma"; + case IP_VERSION(5, 2, 4): + return "dimgrey_cavefish_sdma"; + case IP_VERSION(5, 2, 5): + return "beige_goby_sdma"; + case IP_VERSION(5, 2, 3): + return "yellow_carp_sdma"; + case IP_VERSION(5, 2, 1): + return "vangogh_sdma"; + } + } else if (block_type == UVD_HWIP) { + switch (adev->ip_versions[UVD_HWIP][0]) { + case IP_VERSION(1, 0, 0): + case IP_VERSION(1, 0, 1): + if (adev->apu_flags & AMD_APU_IS_RAVEN2) + return "raven2_vcn"; + else if (adev->apu_flags & AMD_APU_IS_PICASSO) + return "picasso_vcn"; + return "raven_vcn"; + case IP_VERSION(2, 5, 0): + return "arcturus_vcn"; + case IP_VERSION(2, 2, 0): + if (adev->apu_flags & AMD_APU_IS_RENOIR) + return "renoir_vcn"; + return "green_sardine_vcn"; + case IP_VERSION(2, 6, 0): + return "aldebaran_vcn"; + case IP_VERSION(2, 0, 0): + return "navi10_vcn"; + case IP_VERSION(2, 0, 2): + if (adev->asic_type == CHIP_NAVI12) + return "navi12_vcn"; + return "navi14_vcn"; + case IP_VERSION(3, 0, 0): + case IP_VERSION(3, 0, 64): + case IP_VERSION(3, 0, 192): + if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0)) + return "sienna_cichlid_vcn"; + return "navy_flounder_vcn"; + case IP_VERSION(3, 0, 2): + return "vangogh_vcn"; + case IP_VERSION(3, 0, 16): + return "dimgrey_cavefish_vcn"; + case IP_VERSION(3, 0, 33): + return "beige_goby_vcn"; + case IP_VERSION(3, 1, 1): + return "yellow_carp_vcn"; + } + } else if (block_type == GC_HWIP) { + switch (adev->ip_versions[GC_HWIP][0]) { + case IP_VERSION(9, 0, 1): + return "vega10"; + case IP_VERSION(9, 2, 1): + return "vega12"; + case IP_VERSION(9, 4, 0): + return "vega20"; + case IP_VERSION(9, 2, 2): + case IP_VERSION(9, 1, 0): + if (adev->apu_flags & AMD_APU_IS_RAVEN2) + return "raven2"; + else if (adev->apu_flags & AMD_APU_IS_PICASSO) + return "picasso"; + return "raven"; + case IP_VERSION(9, 4, 1): + return "arcturus"; + case IP_VERSION(9, 3, 0): + if (adev->apu_flags & AMD_APU_IS_RENOIR) + return "renoir"; + return "green_sardine"; + case IP_VERSION(9, 4, 2): + return "aldebaran"; + case IP_VERSION(10, 1, 10): + return "navi10"; + case IP_VERSION(10, 1, 1): + return "navi14"; + case IP_VERSION(10, 1, 2): + return "navi12"; + case IP_VERSION(10, 3, 0): + return "sienna_cichlid"; + case IP_VERSION(10, 3, 2): + return "navy_flounder"; + case IP_VERSION(10, 3, 1): + return "vangogh"; + case IP_VERSION(10, 3, 4): + return "dimgrey_cavefish"; + case IP_VERSION(10, 3, 5): + return "beige_goby"; + case IP_VERSION(10, 3, 3): + return "yellow_carp"; + case IP_VERSION(10, 1, 3): + case IP_VERSION(10, 1, 4): + return "cyan_skillfish2"; + } + } + return NULL; +} + void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type, char *ucode_prefix, int len) { int maj, min, rev; char *ip_name; + const char *legacy; uint32_t version = adev->ip_versions[block_type][0]; + legacy = amdgpu_ucode_legacy_naming(adev, block_type); + if (legacy) { + snprintf(ucode_prefix, len, "%s", legacy); + return; + } + switch (block_type) { case GC_HWIP: ip_name = "gc"; From patchwork Wed Jan 4 16:39:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088739 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C27EFC4708D for ; Wed, 4 Jan 2023 16:42:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C198910E457; Wed, 4 Jan 2023 16:42:03 +0000 (UTC) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2083.outbound.protection.outlook.com [40.107.243.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id C20A010E058; Wed, 4 Jan 2023 16:41:53 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bAn35OfBwj+BGxcZDLLhVM1xVQFT6sh7m10yiiOWT3CuyoeKzJQ84mqd02jDgsWiTwJWdTw7SbVkAr0omwUSmRp7Hyb/MIcMUJyaObsgSIq46CJ6VAHCpSBYrUqD5gvkzE7tsoM4fpW2vx34p9QxdZSh3Cic5DHt/bFD2sPGGZqTIebER3TFZgMFlrRbtpBW/655chINQGfe5rSYKPJWqZ80jWWvP6OOJxdg0sxitkhQZ5S2yy5CE7aGMEuPNjrpAbP4MG11U45jdgWjDbzKu3kfx+skioDRhSmpmrJkoXipCR7HVWIImbxFewI4ALsiBVDJOxcYUE1DpEv349Wlcg== 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=fpx8LEP67+rj/cBdMTpYdHwfGfBYeBDBkIJIzX2znc4=; b=R0UYCtTVlejSWWFlG6CU+ZALYEaf/mmQQ0Q4Pqb90Q+3IiXxv7hK2R75KE79CHVSlf+1qpYlPPn41Qw7sz5pQFZtWY36RMHTLbig1YXHi2CYIP9Zob7+s1zn8OwarKJbqBF3pQ4vIRCDzQDQs+p/sWM/uS8iEu0SmcN3/GP8gXLMhN6WQBJTad3t25vHTUy1k9+8HIOIpyG1ILUb/c3lBldLu+uXc9ZRWYcg+s7tdbO0U3U8rY1bUcEbhg44nWPd7UAYqQz4BMEQs8c/CaPsyBvLQmzEBVV9fbSyWvSvEMVaIJSVm+S/ReozqgW8Ootn4Oh+JkbyzqVCe3SWNzZQ0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fpx8LEP67+rj/cBdMTpYdHwfGfBYeBDBkIJIzX2znc4=; b=MsZdlme6dIZOcwxR3j2XqyygTtUG6hmkOn7KTZI5f4194OYeViGNi/0XM1AVoh1qP0h6qbulL1b35rrGxY6KZOvfNkx4P7tilP2y0+ZOsL8MyonrBTh8jLfmANBHKI6v36kxHdFkDEcv7xsPBPFFPTxLBozpk1Ls1lPqO2wBTy8= Received: from DS7PR03CA0306.namprd03.prod.outlook.com (2603:10b6:8:2b::14) by PH0PR12MB5449.namprd12.prod.outlook.com (2603:10b6:510:e7::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:41:51 +0000 Received: from DS1PEPF0000E644.namprd02.prod.outlook.com (2603:10b6:8:2b:cafe::cf) by DS7PR03CA0306.outlook.office365.com (2603:10b6:8:2b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:41:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF0000E644.mail.protection.outlook.com (10.167.17.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:41:51 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:41:48 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 03/45] drm/amd: Convert SMUv11 microcode to use `amdgpu_ucode_ip_version_decode` Date: Wed, 4 Jan 2023 10:39:52 -0600 Message-ID: <20230104164042.30271-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E644:EE_|PH0PR12MB5449:EE_ X-MS-Office365-Filtering-Correlation-Id: 201f944e-3063-4800-dcc5-08daee729497 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gw8RxR/D61fptW5qfwVXY4FBri0YZo6ZlgYUUvxs0mI0h5/EVljLRd30Ja0/qb+dTbw9W+egVJKbQfAN9zyCQSMLxSRw4E/oNcccgaq5QxtGcn4p8BaeL+mA54GwmLMYbvLNdF9G3j022AwCPhhrPGnTD9TMb/tvVZbZQydSLaawJXZSd8px15oZwsNRKiM1iRinB6CaP1+RWL2v5h97N+uu37ltfxsTm1G5wKNVY9chw7Bc01jH3QZ8ctz/KVSvmKDtcsJcfKXLuN4pn9OJvDqBvHu0ScyPJdvSkEVx3BrGnhOoJy8nJbnuGKsITiv2GsOtR5sfryQdYKWrYJh9Duw3afCiA+ZNUx0t0Xj9sxkuayAd4hjMy/A+jnqWPyaJePeFI/N3oRCn2Dm15OFHbV3anWVoxSYrrLQB9wqEIvP1JSnklBM24wx0Y6F+T316r/Cc366P4oq9AvvQeAy7uuVZEEyg6QobJNF/LZrLjAi9PafgvTy0fSJDHr+ZA8KPmzbpVwYUUmtgeTVjEFR58wh1zxzZej2y/YlepWNtWO66FFfs73w6MD/oWdh85T5bakWqHoQ03GmHhZHcemlmPyKAGYszvGL8faDjHu8NzSczvSmDybBKsP6OQeA8SauM8wjsYE/yor3jSz7wrtxZJE3gE2ceqVZEnn6vx4zF9+b96mv+PQxgS4N/AUlGRbH8vvVZHAQqDX2gCLEuP00dyqA51GR4AErXXazPSyDgtt847Og18yWIYzCCq+KUkCc9qR1Z5k0FvzUgev4aOTXYvA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(346002)(39860400002)(136003)(451199015)(46966006)(36840700001)(40470700004)(16526019)(54906003)(316002)(6666004)(7696005)(26005)(110136005)(186003)(1076003)(478600001)(2616005)(70206006)(8676002)(336012)(70586007)(4326008)(82740400003)(426003)(41300700001)(66574015)(2906002)(47076005)(83380400001)(8936002)(5660300002)(44832011)(86362001)(36756003)(36860700001)(40460700003)(356005)(40480700001)(81166007)(82310400005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:41:51.2228 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 201f944e-3063-4800-dcc5-08daee729497 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0000E644.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5449 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , Evan Quan , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Remove the special casing from SMU v11 code. No intended functional changes. Signed-off-by: Mario Limonciello Acked-by: Christian König --- .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 35 ++----------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c index ad66d57aa102..d4756bd30830 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c @@ -93,7 +93,7 @@ static void smu_v11_0_poll_baco_exit(struct smu_context *smu) int smu_v11_0_init_microcode(struct smu_context *smu) { struct amdgpu_device *adev = smu->adev; - const char *chip_name; + char ucode_prefix[30]; char fw_name[SMU_FW_NAME_LEN]; int err = 0; const struct smc_firmware_header_v1_0 *hdr; @@ -105,38 +105,9 @@ int smu_v11_0_init_microcode(struct smu_context *smu) (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 7)))) return 0; - switch (adev->ip_versions[MP1_HWIP][0]) { - case IP_VERSION(11, 0, 0): - chip_name = "navi10"; - break; - case IP_VERSION(11, 0, 5): - chip_name = "navi14"; - break; - case IP_VERSION(11, 0, 9): - chip_name = "navi12"; - break; - case IP_VERSION(11, 0, 7): - chip_name = "sienna_cichlid"; - break; - case IP_VERSION(11, 0, 11): - chip_name = "navy_flounder"; - break; - case IP_VERSION(11, 0, 12): - chip_name = "dimgrey_cavefish"; - break; - case IP_VERSION(11, 0, 13): - chip_name = "beige_goby"; - break; - case IP_VERSION(11, 0, 2): - chip_name = "arcturus"; - break; - default: - dev_err(adev->dev, "Unsupported IP version 0x%x\n", - adev->ip_versions[MP1_HWIP][0]); - return -EINVAL; - } + amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix)); - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_smc.bin", chip_name); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix); err = request_firmware(&adev->pm.fw, fw_name, adev->dev); if (err) From patchwork Wed Jan 4 16:39:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088735 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BCE22C53210 for ; Wed, 4 Jan 2023 16:42:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E3FB10E452; Wed, 4 Jan 2023 16:41:58 +0000 (UTC) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2086.outbound.protection.outlook.com [40.107.243.86]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F25B10E058; Wed, 4 Jan 2023 16:41:53 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YkfCKWYPEqtaggVkWdOFBMNVPsDcWgaZBM9KEhWcauCkgDdq6DbElqDxGflisvqmKFkf55eUQxnTqk657jbpikcf1Ab/fIX0gKWK6z7ZeMRT0RbhGVziz70k88IOfal05f5oJ7Ny9lfH1qtNS9wlUyOmTiHkJ/bb+E+NwmLEYAvyHrJDkL1J0o2xLS4xShq5VhujrHYsHl0p2fC2WLY3fu0L2j1UGAuoCI1psUONdSoXC54ds3KFYG6MKOUKfQ3WS+eZbHJ6vPboZIeOAug7BYssHmb1Xi96QgoArCJHT38Zrpdll1bA8eidLx1MWeLvp8Dn/9SDXH8G/9qiGdpaOw== 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=nSyu8no0i4tN1bff68akPDEKxhO4iVdu4y+ah8dMRi8=; b=OoOS4C2TBsgQ2Lr5iVNWprIJIrorhY53Hx99W0jV/124or4tsMlt6nQOI0ameh/ImHjR++CbYmcQjCVC0H3VpjN+Wlk391J8qNpsoKjJ+GUHj8KKZHelhkkfEoEgq6k5Si3JtWa2JKeqeuYZaWJoU0wCXH/4Pl0qxIItB7FYAKacyi0Hp/mtd8pwIJVxMZq210v2xDaWN/uZD65OBFusQMkNJZoXkBGkmuwDJ77QFf/mjPDFK5YPtRUA+s/dq9kmk13BLrASHvRRe78h9l+X4lqDrkaq0k9Q6H24FxHP6kmFaj+vtqtFNs7A5Sy2GDp+/BymhHPqHt0VpjtH/5bs9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nSyu8no0i4tN1bff68akPDEKxhO4iVdu4y+ah8dMRi8=; b=2eqCHrdMp6wmSKhyKIqoYA+NzWNeKl2Vm2X2foPxkzW0AiXDnMHUGJgYy0eXvkKc2R1TxD8VnhqKb+fC3oPf7FW61AScXMtnCWChG9bay9xkOhiTbp/rPB+zlTQW1Dt7KGZmjDulQw856QsJwE57jKuYYkZMI3AvSkAuwPfGUFs= Received: from DS7PR03CA0313.namprd03.prod.outlook.com (2603:10b6:8:2b::18) by DM6PR12MB4315.namprd12.prod.outlook.com (2603:10b6:5:223::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:41:51 +0000 Received: from DS1PEPF0000E644.namprd02.prod.outlook.com (2603:10b6:8:2b:cafe::6d) by DS7PR03CA0313.outlook.office365.com (2603:10b6:8:2b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:41:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF0000E644.mail.protection.outlook.com (10.167.17.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:41:51 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:41:49 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 04/45] drm/amd: Convert SMUv13 microcode to use `amdgpu_ucode_ip_version_decode` Date: Wed, 4 Jan 2023 10:39:53 -0600 Message-ID: <20230104164042.30271-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E644:EE_|DM6PR12MB4315:EE_ X-MS-Office365-Filtering-Correlation-Id: a1ef3230-e0c0-4b01-c66e-08daee7294e1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p9t46LSgv4jayZrH/v/K95ZAqXKRC1NNHSJ7g+klYeymPj8r5N1BWxmSyzs+53yGpiJALlN11i8iNKIDwWgjZtGOCgk3lVDC82U7XgeRZETwH59CdNC9BoqPeGsYafqb2CLw66KUiv9Yd5FuL2ofSzXgHa7iZce+BV2vPrZxCOmsaAMW8H+LPnSqQOluIJ31RZkqH+5k96nPSx3ecQGDlPid7X56vxqBsNyMRdURsfmAZ3JgqlAzVCcDDXDGcmSjy7opxRS5G5gSiPdxA0MLrKorj/6m/FexAAo7c06ygElzArOvZNJe0loQP0ceXHYJvUIgyUn/IFUTsLVJ0FtgrLxS+0hPiaOG29LO/baiG8XWx4ucLhgkzOQ6uCXb1xqwo+RvpNLah4I13lNBTfVVg8q9+Yxhj7/Fe+fTNUAQbmZjnSOwEY7eQdnY0egL+ep3WaXwPTFGyjK9SN9xa1y2S089VlyWlkAlZphsavj0GWefIp574eko9RMq7bnl4PI4fAJyvBd/Uf2BIPrqb7yn4N0BDK7p1jF3ejbZB2FnZW5Bob4cYzlcbfZv2NE7vAHTdJOjxDfvWKuqMPpzL8Eukch0pFlEvSVdTOCLwI2q5D5pEV2KP0wayvWqsLNAn6JRRo/qjjySacRo70yvWrGcnN+2itJVmKuNG9jFobLmST7yemQC+d8dbYXfixepVgg+xUBaQwjSj4gmBFPCkm5Bhv6cbFNHM8s2PwTSg2O0occgXFivecj2k7cLAXxDdyWdmw1eWM3Zgx6es3maoMlIwQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(136003)(376002)(396003)(39860400002)(451199015)(46966006)(36840700001)(40470700004)(4326008)(5660300002)(6666004)(8676002)(70206006)(70586007)(316002)(8936002)(41300700001)(40460700003)(110136005)(478600001)(2906002)(54906003)(7696005)(81166007)(16526019)(356005)(82740400003)(1076003)(426003)(66574015)(47076005)(2616005)(186003)(26005)(40480700001)(336012)(86362001)(36756003)(44832011)(36860700001)(82310400005)(83380400001)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:41:51.7071 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a1ef3230-e0c0-4b01-c66e-08daee7294e1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0000E644.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4315 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , Evan Quan , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The special case for the one dGPU has been moved into `amdgpu_ucode_ip_version_decode`, so simplify this code. Reviewed-by: Alex Deucher Signed-off-by: Mario Limonciello Acked-by: Christian König --- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c index 0ac9cac805f9..506a49a4b425 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c @@ -88,7 +88,6 @@ static const int link_speed[] = {25, 50, 80, 160}; int smu_v13_0_init_microcode(struct smu_context *smu) { struct amdgpu_device *adev = smu->adev; - const char *chip_name; char fw_name[30]; char ucode_prefix[30]; int err = 0; @@ -100,16 +99,9 @@ int smu_v13_0_init_microcode(struct smu_context *smu) if (amdgpu_sriov_vf(adev)) return 0; - switch (adev->ip_versions[MP1_HWIP][0]) { - case IP_VERSION(13, 0, 2): - chip_name = "aldebaran_smc"; - break; - default: - amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix)); - chip_name = ucode_prefix; - } + amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix)); - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", chip_name); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix); err = request_firmware(&adev->pm.fw, fw_name, adev->dev); if (err) From patchwork Wed Jan 4 16:39:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088736 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 97241C4332F for ; Wed, 4 Jan 2023 16:42:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 72EAA10E458; Wed, 4 Jan 2023 16:41:59 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2048.outbound.protection.outlook.com [40.107.237.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id C01C910E060; Wed, 4 Jan 2023 16:41:54 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G9fxSreiTA38W1LaxCOS5i4VH/kLGMPnakrVWg2RWpMs9PjknJbp5wRoTJ9DS6S9ml2e6fiRXKj1MJWgLlLzWsHXpEvaxdb0T09BB9/9qKXAOFi9DT10el7J3ztDaLCB8FmcxZfPFkF0FcnAbOcPyN4MZnGiGNr5ca9U2GqfQ447MKe/stunZY2dKHT+eHzyOBM0ZxYJ+tEQbiLKaFGJ4VAu9jKVz6ljrh9frGISJJR0FbuIZKuSG8SNgFJ2WHwT7ZeEPtx3y5OO2dE+qIL/X+e/spi/snEjOICljG07dINozgcscqnDz8V6sIQ5bGkmvBJPFLyx8GKLdly9Hx0Hiw== 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=sdWRrWwltduWR39N5OtD4kGLpx64J6ZTI2P9qKz4OCA=; b=oLiGkp/efzIPrDNuMMXGdA0KUOQ2mhgmtmH17cKF1wz/GWpFwzQhIJ7Reo1+DAzz/GX8U0r58ZGq40WIS+FrPSJggg0OToN0h3uzIRHgYRXWXiYnrxwgUISjgzEMm/GJzjQN8Ch28rCP50KNdWumMDsSaoJmMsCbC5yfImHaHF0TxdhFwXN2RFATXJMfR1ztlG21yTYSXE3wtwZRj1n1aoj2TMQJsqHdJqo3h22NwYcdQav6Df2fSVAg7ZNgcMn8EcJ+DUR5lMlU+LezFFBaeQnFdlhebfnazAa91HJ4QiIoQOJ4V8sxg5/puxR8ZI2OzXJDTID5kFivbW0YXdRn3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sdWRrWwltduWR39N5OtD4kGLpx64J6ZTI2P9qKz4OCA=; b=WGOdYKq9hFcJwDslYiOrwAecXWYI5xoZ1XTcXL7LJzA+y8Xv5Ol1y5V4Rn4iBsWnloYuOKnoGLZPQ3GxtcbqiLPn0YJHd5A0aaUyikMZRjGkSIP1Vp51HutQObPHgdDX3371m5wgIjcEinjZUxF3X4ccGsTd3MAo3S3Tbi8nJhk= Received: from DS7PR03CA0306.namprd03.prod.outlook.com (2603:10b6:8:2b::14) 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.5944.19; Wed, 4 Jan 2023 16:41:52 +0000 Received: from DS1PEPF0000E644.namprd02.prod.outlook.com (2603:10b6:8:2b:cafe::cf) by DS7PR03CA0306.outlook.office365.com (2603:10b6:8:2b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:41:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF0000E644.mail.protection.outlook.com (10.167.17.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:41:51 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:41:50 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 05/45] drm/amd: Add a new helper for loading/validating microcode Date: Wed, 4 Jan 2023 10:39:54 -0600 Message-ID: <20230104164042.30271-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E644:EE_|SN7PR12MB6814:EE_ X-MS-Office365-Filtering-Correlation-Id: dc2ebe28-7530-4df3-b014-08daee72950c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /lxtGJcQ47gzXouqvL1lTR+G+GSRrKea2l4XWXt3TR7D5X5jlZvBYsnzQPXFPKMZFn83zAMAOi1YhCvunON3yQ2vidg3SjGE/yQpVUlXYuYl5SZ50ZQw9rZCf1MFZkka5hvv4qugjAikwO/zWLCcvpK6golFhF8DjlLB5UV35lKW3Lx6PnFc+8iIWh1BEjQ/u4W2g2kFHpGHbwwRKjjx2NfmnhsSSYpZS/G+KQd6Xc2zHfex4OgztPMlmPc6+LfuDzZ2dsa+1XpWGISGe5z+o7u14RG+0Ynpvw5EClIApjzZSx7zwjzbMNSj6Gzxmygzo/GF8+fb00/tODXmvpxYQSmbYbTCGut7qea7i6GRTb+yXppcDd23c8Z60zykWKhKuiSUwS8Nt4hv84kDLdMdVNKAGiwQz7GV1vOsFWAFc0UymLo0enO2o2gn1ARtGnHpf/4smgttm6prmlZEDVvkOnAagVgzCjOL6FlUWzR9RYegr0dtZYpFs7gf3qMeDILySuF281mwrVsRKb5XbDeiEcrds1VooaYsGuR4D/DCInkdBhz+jzHSsO+Er3qmCR01C06TbAMUpUPzXUvU5hE+4244a+fef/UnNteuvfE5brH0fszhQwETzjLXkxX0fne6Kn0cnyrI6SjVwSoAMTvqj0EzJDfN8z4JiOkhNGnqmOdBt0RBJqtepaImoqQJflPsAPI5Equ1nKpUpepvTmhaPLRgVJ/bGa0TwJwgdYUDaxU= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(396003)(136003)(39860400002)(376002)(451199015)(46966006)(40470700004)(36840700001)(83380400001)(47076005)(426003)(1076003)(16526019)(26005)(336012)(82310400005)(7696005)(40480700001)(86362001)(36860700001)(36756003)(40460700003)(81166007)(82740400003)(356005)(2616005)(186003)(316002)(4326008)(478600001)(41300700001)(8676002)(2906002)(5660300002)(8936002)(44832011)(70586007)(70206006)(54906003)(110136005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:41:51.9884 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dc2ebe28-7530-4df3-b014-08daee72950c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0000E644.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6814 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" All microcode runs a basic validation after it's been loaded. Each IP block as part of init will run both. Introduce a wrapper for request_firmware and amdgpu_ucode_validate. This wrapper will also remap any error codes from request_firmware to -ENODEV. This is so that early_init will fail if firmware couldn't be loaded instead of the IP block being disabled. Signed-off-by: Mario Limonciello --- v4->v5: * Rename symbols for amdgpu_ucode_request/amdgpu_ucode_release * Make argument const --- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 36 +++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 3 ++ 2 files changed, 39 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c index eafcddce58d3..dc6af1fffdd9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c @@ -1312,3 +1312,39 @@ void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type, snprintf(ucode_prefix, len, "%s_%d_%d_%d", ip_name, maj, min, rev); } + +/* + * amdgpu_ucode_request - Fetch and validate amdgpu microcode + * + * @adev: amdgpu device + * @fw: pointer to load firmware to + * @fw_name: firmware to load + * + * This is a helper that will use request_firmware and amdgpu_ucode_validate + * to load and run basic validation on firmware. If the load fails, remap + * the error code to -ENODEV, so that early_init functions will fail to load. + */ +int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw, + const char *fw_name) +{ + int err = request_firmware(fw, fw_name, adev->dev); + + if (err) + return -ENODEV; + err = amdgpu_ucode_validate(*fw); + if (err) + dev_dbg(adev->dev, "\"%s\" failed to validate\n", fw_name); + + return err; +} + +/* + * amdgpu_ucode_release - Release firmware microcode + * + * @fw: pointer to firmware to release + */ +void amdgpu_ucode_release(const struct firmware *fw) +{ + release_firmware(fw); + fw = NULL; +} diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h index 552e06929229..7fd2f04f7f98 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h @@ -544,6 +544,9 @@ void amdgpu_ucode_print_sdma_hdr(const struct common_firmware_header *hdr); void amdgpu_ucode_print_psp_hdr(const struct common_firmware_header *hdr); void amdgpu_ucode_print_gpu_info_hdr(const struct common_firmware_header *hdr); int amdgpu_ucode_validate(const struct firmware *fw); +int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw, + const char *fw_name); +void amdgpu_ucode_release(const struct firmware *fw); bool amdgpu_ucode_hdr_version(union amdgpu_firmware_header *hdr, uint16_t hdr_major, uint16_t hdr_minor); From patchwork Wed Jan 4 16:39:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088738 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B6612C4332F for ; Wed, 4 Jan 2023 16:42:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 47BB410E44B; Wed, 4 Jan 2023 16:42:03 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2071.outbound.protection.outlook.com [40.107.237.71]) by gabe.freedesktop.org (Postfix) with ESMTPS id C576510E455; Wed, 4 Jan 2023 16:41:58 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aS0EXOY1v2ASJnk2SkCJnwXRFRKVzlDe2Zk2spTCX6TSplXWs++CzqGa7XeG64tJIbEW+dbRp+CEqw1AL6f38JxcaMYBj0487kaQcUckFPYVKapjasJzMeYzdIXBgG76uUt6CpZsNoMb+7DglVPz1QXTjCALmazmbLF19tzr4EVi1giwWz1piAR39isorzA3XeZcJz1T41vD1SZQv0nhue0TPKL+M1wyW+hjwNX5y5cx9C2fMk4t3KD9WMEXEueaEr+l7dj0rdvkzDtj+QpM/ep6O08983XBTmfHlGV91XqMk5FKGzF53DI0lMwnRUnGexmOELQoKwcSCEQzZAve9w== 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=3Q1UUJY5AJruN8oGu2kMpYduRktDi5GDRRcUEkcMqk4=; b=WTpxrlQXV1Q9shvd1PkmFBLncXn/7PlA/+ixveo67Ih3gB3Z111yqKmPZWh/xQEeVFomHuiuIwDx8j7qiFg53576ayRip+slodupkqAnWZYaNdVw2SRI2TIfLj88B6N4mOczCnBd2osyy1/HKQcEO+ff7l/KJXf70us7EgZP2kJyISWb3aa5a82bVvdN4hBvTftjlXPasUtNuicz+mkn9ZSw2FJiJgt8yZmHgyq74CvMmEUV9inIiGNRgFmMNGlTwEIiU35eKzJ5j4zYv6hrQ2BQ0oi+VXwMApTj9RXxt4IN729N+J78IfJySSuoBX7CP2MN5B71ezMFCsOu9WyW+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3Q1UUJY5AJruN8oGu2kMpYduRktDi5GDRRcUEkcMqk4=; b=woeH2hFRM2keief/MEUde2OYNQMCSkod8bKIJcPQ1AP3B/3RpPxntO+5Fz8m0+LI3yT4FDLqz+z0Y/uQRu7FSmW9d27g1MgnRxE0kIT4zv8dRUROokwTHZy4qPhGoyi/1fxisGnGB5R70fwapxORjQGoDD8jaWeH/FKQRJYJgVw= Received: from DS7PR03CA0302.namprd03.prod.outlook.com (2603:10b6:8:2b::11) by BL1PR12MB5142.namprd12.prod.outlook.com (2603:10b6:208:312::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:41:54 +0000 Received: from DS1PEPF0000E644.namprd02.prod.outlook.com (2603:10b6:8:2b:cafe::a5) by DS7PR03CA0302.outlook.office365.com (2603:10b6:8:2b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:41:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF0000E644.mail.protection.outlook.com (10.167.17.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:41:54 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:41:52 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 06/45] drm/amd: Use `amdgpu_ucode_request` helper for SDMA Date: Wed, 4 Jan 2023 10:39:55 -0600 Message-ID: <20230104164042.30271-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E644:EE_|BL1PR12MB5142:EE_ X-MS-Office365-Filtering-Correlation-Id: 543baaca-7912-40cb-0236-08daee729664 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xCT+8D7/Ez8PJ0/VUOYKN/gsioArufonwHDCJGgxILA3/k43Ydik+Yvi3FfIN8qNnEx3sch9xU5gwGxE4BKjTcfSxKIg6sAU3MiwwqZG2PTksbdU+1D/seB41PAzD9Wi0dltCNTJhA1nqGz3tseQGNcgiIBi8/+gcokahV95VD7EjofycMh1RF2tBn5pkt+bQYZsqJbsO/RPbCk8s1aXHmSPzp/bpXLabLAgzUP0/W/OY1IAfJuOj+5XfdcC5R5S8KpLvQAt0yL9ozZtdGAOmDxcWmyERuVd5twhtBsOoIV+OJJhFldX5qHQkm5fM0QH/mmvoPgnXCH1ZkD+XzjmpxrbJmTd3kKTUfJmbexafHGQZ2o1AolmICLRRi9QOg3V6F7n4KvhDdXN6P7VuBhtjbG2Y7GeO/LMhi/QB78QhHrcO3BM6BJJyeK8aKC0NzsoFSlMz9PjxPDZPYvF8y7m/v4i6phP8E6PyLqmaXSkqDCuvcr/ZJhjjwDhkw28p+RnoCOpUwARRNmlwVF/IiCY23C1K031KBtM+AnWMBpCkDitLaf6VpRJf3HHqLwIKPjEBibas4D7LiSIAe9TTDH4ZrQDOKqzNtL4y/BL7Nbfi3nuzYlxQ9dwbYqghZMfwTALoys5Gm+wjlulvNmUTHZ1mDGw3wb93QoJtpoQsXONMb4m+qCOUcKj84c8T6CBHxOh7U16+0vZozeKG3jH5jDDU25ajNQujFEowgnWWQ2dXYZQwuzrQj2Zyj+QPgVjktflYwMFQsgJnY6557NdrctSqA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(396003)(346002)(39860400002)(376002)(136003)(451199015)(46966006)(36840700001)(40470700004)(5660300002)(2906002)(8936002)(44832011)(4326008)(41300700001)(8676002)(70586007)(70206006)(110136005)(54906003)(478600001)(316002)(26005)(186003)(16526019)(82310400005)(336012)(40480700001)(7696005)(83380400001)(47076005)(426003)(1076003)(356005)(81166007)(82740400003)(2616005)(86362001)(40460700003)(36756003)(36860700001)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:41:54.2384 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 543baaca-7912-40cb-0236-08daee729664 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0000E644.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5142 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c index ea5278f094c0..1668360bc699 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c @@ -154,16 +154,11 @@ int amdgpu_sdma_process_ecc_irq(struct amdgpu_device *adev, static int amdgpu_sdma_init_inst_ctx(struct amdgpu_sdma_instance *sdma_inst) { - int err = 0; uint16_t version_major; const struct common_firmware_header *header = NULL; const struct sdma_firmware_header_v1_0 *hdr; const struct sdma_firmware_header_v2_0 *hdr_v2; - err = amdgpu_ucode_validate(sdma_inst->fw); - if (err) - return err; - header = (const struct common_firmware_header *) sdma_inst->fw->data; version_major = le16_to_cpu(header->header_version_major); @@ -195,7 +190,7 @@ void amdgpu_sdma_destroy_inst_ctx(struct amdgpu_device *adev, int i; for (i = 0; i < adev->sdma.num_instances; i++) { - release_firmware(adev->sdma.instance[i].fw); + amdgpu_ucode_release(adev->sdma.instance[i].fw); if (duplicate) break; } @@ -214,7 +209,7 @@ int amdgpu_sdma_init_microcode(struct amdgpu_device *adev, const struct sdma_firmware_header_v2_0 *sdma_hdr; uint16_t version_major; - err = request_firmware(&adev->sdma.instance[instance].fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->sdma.instance[instance].fw, fw_name); if (err) goto out; From patchwork Wed Jan 4 16:39:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088741 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56425C4332F for ; Wed, 4 Jan 2023 16:42:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6386A10E55D; Wed, 4 Jan 2023 16:42:06 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id F0B0C10E44B; Wed, 4 Jan 2023 16:41:59 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gTCOmbkvyvPSpSuznPamsbMDcRoPn5zyUgn80cfXYIz5TkUAJdETVYU9ueO2ye1BELqrF6ICPkFyxOceb3sTlE3WonYoB6MANaM8mVYYJNXfFc61ysjWXPKn/NffhxogSGTt9Mn7nEuMbfRekcjucbxY+sU5jUFbYEfXcsEDtqXqVKLKXb5QstyirU27D39NVREG2iJOwO65jUHTP45/smpr5ZCK6wUONsirdY9CleYKoQ6Yjw+5u+ACmRRW+OTLnN5TWlRKJW5QjozKaF0keCWTF6BN9m3jjklpHihIFXl8HsNcajLMDOerZlA10WNqvqGWDR9IWOt0dhmHstIoHA== 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=uyRt6+7NMTCf8iY9ELJOdfwDjHirMOauwxgAEJCyCzg=; b=ji0Qv2SdL4jaVU3Sj837sosuiXs8Q+h04FaJ80wtQUXaOb9cdsrDnAeo8yiO671cGjjTTHRS35ggvVplR63oPHD2Er9x0CjZv5XL0tyTXOYUiDrADR3bXNtEucfEWbIO+zsQXzU02tuYIbL8cksrbzBBFharbRLji6L/jQMddoprrovVweZpSEVoR4Fw8G44IikuKjYC30APAJzsU/s290S41LiGIYZO/bI/MgZDVcn+JN0gL7+ZFyo/m8j7VBHcA+AuIjbcUHe3WhdveC1i67lwcyhUr1XQT2Q3BY6/PDw4IHBB1YH0TsXy2seYwoj5OhicTb1gzBVbMGaZp8sgYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uyRt6+7NMTCf8iY9ELJOdfwDjHirMOauwxgAEJCyCzg=; b=HUt8vz5Ivta8cU0CrV/KddI43CXg3nj89pWxgCJo2ucVPwTuN4D2kxhgXMLe1h1mfjnqsej6cM3OVTilJY1DVrFhHZ8A+2Fwe+WDZ7HrT9kV91Gn942Kcxj1xoNX98uvRI4+3BDP74XsjYvO65tOH8Ziurz6d7Abq6m1ap0HXA0= Received: from DS7PR03CA0330.namprd03.prod.outlook.com (2603:10b6:8:2b::22) by CH2PR12MB4263.namprd12.prod.outlook.com (2603:10b6:610:a6::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:41:56 +0000 Received: from DS1PEPF0000E644.namprd02.prod.outlook.com (2603:10b6:8:2b:cafe::d5) by DS7PR03CA0330.outlook.office365.com (2603:10b6:8:2b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:41:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF0000E644.mail.protection.outlook.com (10.167.17.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:41:56 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:41:53 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 07/45] drm/amd: Convert SDMA to use `amdgpu_ucode_ip_version_decode` Date: Wed, 4 Jan 2023 10:39:56 -0600 Message-ID: <20230104164042.30271-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E644:EE_|CH2PR12MB4263:EE_ X-MS-Office365-Filtering-Correlation-Id: a9e2d546-d60f-4112-e10c-08daee729786 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MnADDMNb+82WWa/g27FbWfHxcxWRi9+4UN8yIAdXcRN0vKOIfMU8NMPmVnvaKG1mLGoAhXhfzUQVKmQKj+k6NR6Me6lano7p+O1sxORTsJIy1jRWUB2y0rmYhWediv0tZLkRYpT2cDQO2w30/r+6jtkZ4dSZ1dHb4VYQ0uFsk7SNyz835aZ1B/moFjGSYor23FpZT+nMteXoGBroZUZhLL2AIP3OO90V2Q8hfuLBa5zm9FSfO6q7n3DpiOuGkqeQoE0lOUa3edVnErXEq+RhPbfLiLzLD0AT5OKnasARnaa0Cwdkf/7Yamzco7OfNwljjTagJESQ6zrDICdAGWFFmeZ9s8w1FJ/sgMh7OYPIWqz8hc6g9BPIm7hriVUagBFL4sYRlIVObdvemmqrUrCEkvk9XGH3FvOJgqvZZri803P12UZ7/h3TW5a3wDTLANfhaTylU6IhcJelndST3W3hgYzb0rMKQFGdtOqW0ogp8xcxLPwBSBBGsMv3nHo/HIrcsoVRf/PwbutuYSQZ13hoM7uV5LchX7giT5wYVOf7e/Q+TLAWhbOR9TWIcPlWoA/vcRIk8BXRrh+u9Gq3bCzLdNoy/Y8Fj5g6dADORTL9EKPp1SIcBBW1IverG7YcUEmRHpt6yXha++QMRBYEfa6N/nIEdwzsoZLWeOqh1b8vljKNIxAZAUjWsrawGFcXazNyOF7B2ODjj2fgzWa+jaZDLCartKjNCxFDFS1nqmXCsALDqV+7941DGlK4NH2sV02m X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(346002)(396003)(136003)(376002)(451199015)(40470700004)(46966006)(36840700001)(36756003)(86362001)(81166007)(356005)(82740400003)(426003)(36860700001)(83380400001)(47076005)(336012)(2616005)(16526019)(1076003)(26005)(186003)(478600001)(7696005)(110136005)(316002)(70586007)(54906003)(70206006)(41300700001)(5660300002)(4326008)(2906002)(44832011)(8676002)(8936002)(82310400005)(40480700001)(40460700003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:41:56.1446 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a9e2d546-d60f-4112-e10c-08daee729786 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0000E644.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4263 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Simplifies the code so that all SDMA versions will get the firmware name from `amdgpu_ucode_ip_version_decode`. Signed-off-by: Mario Limonciello --- v4->v5: * Use instance number to build names like before --- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 12 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h | 4 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 47 +------------------- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 30 +------------ drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 55 +----------------------- drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c | 25 +---------- 6 files changed, 17 insertions(+), 156 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c index 1668360bc699..f8e4a52ab67a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c @@ -200,15 +200,21 @@ void amdgpu_sdma_destroy_inst_ctx(struct amdgpu_device *adev, } int amdgpu_sdma_init_microcode(struct amdgpu_device *adev, - char *fw_name, u32 instance, - bool duplicate) + u32 instance, bool duplicate) { struct amdgpu_firmware_info *info = NULL; const struct common_firmware_header *header = NULL; int err = 0, i; const struct sdma_firmware_header_v2_0 *sdma_hdr; uint16_t version_major; - + char ucode_prefix[30]; + char fw_name[40]; + + amdgpu_ucode_ip_version_decode(adev, SDMA0_HWIP, ucode_prefix, sizeof(ucode_prefix)); + if (instance == 0) + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", ucode_prefix); + else + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma%d.bin", ucode_prefix, i); err = amdgpu_ucode_request(adev, &adev->sdma.instance[instance].fw, fw_name); if (err) goto out; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h index 7d99205c2e01..2d16e6d36728 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h @@ -124,8 +124,8 @@ int amdgpu_sdma_process_ras_data_cb(struct amdgpu_device *adev, int amdgpu_sdma_process_ecc_irq(struct amdgpu_device *adev, struct amdgpu_irq_src *source, struct amdgpu_iv_entry *entry); -int amdgpu_sdma_init_microcode(struct amdgpu_device *adev, - char *fw_name, u32 instance, bool duplicate); +int amdgpu_sdma_init_microcode(struct amdgpu_device *adev, u32 instance, + bool duplicate); void amdgpu_sdma_destroy_inst_ctx(struct amdgpu_device *adev, bool duplicate); void amdgpu_sdma_unset_buffer_funcs_helper(struct amdgpu_device *adev); diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c index 4d780e4430e7..017ae298558e 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c @@ -575,60 +575,17 @@ static void sdma_v4_0_setup_ulv(struct amdgpu_device *adev) // vega10 real chip need to use PSP to load firmware static int sdma_v4_0_init_microcode(struct amdgpu_device *adev) { - const char *chip_name; - char fw_name[30]; int ret, i; - DRM_DEBUG("\n"); - - switch (adev->ip_versions[SDMA0_HWIP][0]) { - case IP_VERSION(4, 0, 0): - chip_name = "vega10"; - break; - case IP_VERSION(4, 0, 1): - chip_name = "vega12"; - break; - case IP_VERSION(4, 2, 0): - chip_name = "vega20"; - break; - case IP_VERSION(4, 1, 0): - case IP_VERSION(4, 1, 1): - if (adev->apu_flags & AMD_APU_IS_RAVEN2) - chip_name = "raven2"; - else if (adev->apu_flags & AMD_APU_IS_PICASSO) - chip_name = "picasso"; - else - chip_name = "raven"; - break; - case IP_VERSION(4, 2, 2): - chip_name = "arcturus"; - break; - case IP_VERSION(4, 1, 2): - if (adev->apu_flags & AMD_APU_IS_RENOIR) - chip_name = "renoir"; - else - chip_name = "green_sardine"; - break; - case IP_VERSION(4, 4, 0): - chip_name = "aldebaran"; - break; - default: - BUG(); - } - for (i = 0; i < adev->sdma.num_instances; i++) { - if (i == 0) - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", chip_name); - else - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma%d.bin", chip_name, i); if (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(4, 2, 2) || adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(4, 4, 0)) { /* Acturus & Aldebaran will leverage the same FW memory for every SDMA instance */ - ret = amdgpu_sdma_init_microcode(adev, fw_name, 0, true); + ret = amdgpu_sdma_init_microcode(adev, 0, true); break; } else { - ret = amdgpu_sdma_init_microcode(adev, fw_name, i, false); + ret = amdgpu_sdma_init_microcode(adev, i, false); if (ret) return ret; } diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c index d4d9f196db83..1941b3b7c5d9 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c @@ -237,39 +237,13 @@ static void sdma_v5_0_init_golden_registers(struct amdgpu_device *adev) // emulation only, won't work on real chip // navi10 real chip need to use PSP to load firmware static int sdma_v5_0_init_microcode(struct amdgpu_device *adev) -{ - const char *chip_name; - char fw_name[40]; - int ret, i; +{ int ret, i; if (amdgpu_sriov_vf(adev) && (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(5, 0, 5))) return 0; - DRM_DEBUG("\n"); - - switch (adev->ip_versions[SDMA0_HWIP][0]) { - case IP_VERSION(5, 0, 0): - chip_name = "navi10"; - break; - case IP_VERSION(5, 0, 2): - chip_name = "navi14"; - break; - case IP_VERSION(5, 0, 5): - chip_name = "navi12"; - break; - case IP_VERSION(5, 0, 1): - chip_name = "cyan_skillfish2"; - break; - default: - BUG(); - } - for (i = 0; i < adev->sdma.num_instances; i++) { - if (i == 0) - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", chip_name); - else - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma1.bin", chip_name); - ret = amdgpu_sdma_init_microcode(adev, fw_name, i, false); + ret = amdgpu_sdma_init_microcode(adev, i, false); if (ret) return ret; } diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c index 65e7a710298d..8e445eb9dd49 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c @@ -89,59 +89,6 @@ static u32 sdma_v5_2_get_reg_offset(struct amdgpu_device *adev, u32 instance, u3 return base + internal_offset; } -/** - * sdma_v5_2_init_microcode - load ucode images from disk - * - * @adev: amdgpu_device pointer - * - * Use the firmware interface to load the ucode images into - * the driver (not loaded into hw). - * Returns 0 on success, error on failure. - */ - -// emulation only, won't work on real chip -// navi10 real chip need to use PSP to load firmware -static int sdma_v5_2_init_microcode(struct amdgpu_device *adev) -{ - const char *chip_name; - char fw_name[40]; - - DRM_DEBUG("\n"); - - switch (adev->ip_versions[SDMA0_HWIP][0]) { - case IP_VERSION(5, 2, 0): - chip_name = "sienna_cichlid_sdma"; - break; - case IP_VERSION(5, 2, 2): - chip_name = "navy_flounder_sdma"; - break; - case IP_VERSION(5, 2, 1): - chip_name = "vangogh_sdma"; - break; - case IP_VERSION(5, 2, 4): - chip_name = "dimgrey_cavefish_sdma"; - break; - case IP_VERSION(5, 2, 5): - chip_name = "beige_goby_sdma"; - break; - case IP_VERSION(5, 2, 3): - chip_name = "yellow_carp_sdma"; - break; - case IP_VERSION(5, 2, 6): - chip_name = "sdma_5_2_6"; - break; - case IP_VERSION(5, 2, 7): - chip_name = "sdma_5_2_7"; - break; - default: - BUG(); - } - - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", chip_name); - - return amdgpu_sdma_init_microcode(adev, fw_name, 0, true); -} - static unsigned sdma_v5_2_ring_init_cond_exec(struct amdgpu_ring *ring) { unsigned ret; @@ -1288,7 +1235,7 @@ static int sdma_v5_2_sw_init(void *handle) return r; } - r = sdma_v5_2_init_microcode(adev); + r = amdgpu_sdma_init_microcode(adev, 0, true); if (r) { DRM_ERROR("Failed to load sdma firmware!\n"); return r; diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c index 049c26a45d85..bf1fa5e8d2f9 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c @@ -78,29 +78,6 @@ static u32 sdma_v6_0_get_reg_offset(struct amdgpu_device *adev, u32 instance, u3 return base + internal_offset; } -/** - * sdma_v6_0_init_microcode - load ucode images from disk - * - * @adev: amdgpu_device pointer - * - * Use the firmware interface to load the ucode images into - * the driver (not loaded into hw). - * Returns 0 on success, error on failure. - */ -static int sdma_v6_0_init_microcode(struct amdgpu_device *adev) -{ - char fw_name[30]; - char ucode_prefix[30]; - - DRM_DEBUG("\n"); - - amdgpu_ucode_ip_version_decode(adev, SDMA0_HWIP, ucode_prefix, sizeof(ucode_prefix)); - - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix); - - return amdgpu_sdma_init_microcode(adev, fw_name, 0, true); -} - static unsigned sdma_v6_0_ring_init_cond_exec(struct amdgpu_ring *ring) { unsigned ret; @@ -1260,7 +1237,7 @@ static int sdma_v6_0_sw_init(void *handle) if (r) return r; - r = sdma_v6_0_init_microcode(adev); + r = amdgpu_sdma_init_microcode(adev, 0, true); if (r) { DRM_ERROR("Failed to load sdma firmware!\n"); return r; From patchwork Wed Jan 4 16:39:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088737 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32967C46467 for ; Wed, 4 Jan 2023 16:42:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 186EC10E45B; Wed, 4 Jan 2023 16:42:04 +0000 (UTC) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2087.outbound.protection.outlook.com [40.107.102.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3D0B310E455; Wed, 4 Jan 2023 16:42:00 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SdxhpXmQ9K8ws2+Kjbrjb8R8BjbboV3GcfWfg+cmdf04vRKaXemsT+j+R4CvlznFYWB7YFNFYyr8Y/aEESq6yvjUnJAQAyQNP/d1dX/RLSg4G+qkycM9eGU7R+TQ10ZV6ONoJdSuqE7PPnI4oKgwH7eiGM73vQLldGu0HbuyYLqBt1G+eW2lQ0WmdLDAs/9ywB5mu21E3a4zxYqnaqZMBupVMF4l3ZjoNPY2hDb3Rwb6RqlBfV7TDta5l4uYeybfnsDNc7dogQkbUlqt8O8K01qFVsvhBs+uEFz8z8fDjAWZJxJiKqwFBiCnvPGCjAC9VSsZ+8Cr6gEngh4jGSqtzw== 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=9onkh3T7I6BUCh1NaGBPv9JEp1AEd9+jZQNQUZTAMpw=; b=d74aMubyZC2o5RltL+3vbtMqtvUs9sjr8I2B9Iibf5xQpC0ttgwfU8dbUYRNUAQQQS74l+7ZHndylLWEzfarm0q1+vSpFPFNdE5pMuNYkJ1/tGr692+ZEfJZV6dILdN0LPxm+jfLEHSmKYouOny+92WwxFtsBiIqgxvFgOqlZ6D2Svf5qSsrCNI42r/pn/w2hQg7PvDqEKShiBFAVxmAWQ9MN+i0jrGPxzUAjQ7Ll+5l2yOAgGL9Kk9vkOMK8el+nRRigqjW0/BQw+lagpvZDaUyAuXFcJ2OKpU6pADANoNhFqAHt6Pj0tvmVLwa+n6x1Ekvf6TTUgOYkqvSdUpeKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9onkh3T7I6BUCh1NaGBPv9JEp1AEd9+jZQNQUZTAMpw=; b=VuKAFKEZADQm9oQZiuRHJFojyB1/0poyMNqb5Iai5VvQIr2ITWCzPcTDpCNNTMtha7jHOM4iVqs6g1eaDCWX1YXDNkgToZDV1AQKdUiLKKqE+2a8RLkLLbVQwzH17orGLCKdpTyBP/gWk9TtfYdAy3oEB3Brbuji9TRMI4zuInc= Received: from MN2PR16CA0038.namprd16.prod.outlook.com (2603:10b6:208:234::7) by MW3PR12MB4396.namprd12.prod.outlook.com (2603:10b6:303:59::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:41:56 +0000 Received: from BL02EPF00010206.namprd05.prod.outlook.com (2603:10b6:208:234:cafe::60) by MN2PR16CA0038.outlook.office365.com (2603:10b6:208:234::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:41:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010206.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:41:56 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:41:54 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 08/45] drm/amd: Make SDMA firmware load failures less noisy. Date: Wed, 4 Jan 2023 10:39:57 -0600 Message-ID: <20230104164042.30271-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010206:EE_|MW3PR12MB4396:EE_ X-MS-Office365-Filtering-Correlation-Id: 68544ddb-3e05-4e73-464b-08daee7297ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pDX3mlN7x8hPJFWWuHjJcAiu46eknhvw80OgHqHiC67Vk6+KVKgQzPw8UEjSYN0Cm/NZc1U8g9EOwzJx92DIVkeEQdVv9iWqM4A8I3ko63+cnwSad1MA8UmN0RZvqugrjM7UroqhydukXKhgMNATBEdXucHAL5kIaBPYKLM0rMaOkokoZkKUk2oAV+4+pmz4+jflLzmeMpPKI/0Os0dvXAjiGjhB/0QOJSmGB3ORhUeKRIF0u0dqKW1YaiMudufPTpZssBhHvLJ1WpGGNzdsfi7nV/aHw8q0gTuSsxm99NqNuhDpPZQYWrbPc070Tnmz4MnM0hsR/bnL6TZ2L/HoWj4f23C7aIjzDwoGgRS//DcGWbeH2KSHTp1w7qvg3j79Dr7TItYmEkBkJLkz5v+BpQeF/sGh0IDQVLgsBdyhTssy66Wmlp3hTkEb4P8wc3ELH2uEtmk3zsYv0D+z3AfjJ3MKjV1dhZuB0lBuWDh8tlPm7X4tYxY8945cPWESBXfYOPAcv9jyK4GWhTOe49VHmME2TxWj9F4czrnphCz2g8HGz1XHVIK17/hycNijWoy1LZGZlgMQYwqzGr3aU4KGEe7eTSvK/YJrkptoHagdCbcmqc8asT9MRpfcGxGPvVhMPdLwJUpQN6PkXBY2WaznlWMUdjCHVpW7MaUNA4rsxmE8M0WmlJHRzrLWuXnPGB6euQn9hHuLK2lJQie9oTxuSrPt8jlrHipOo8wN4hqjZf0= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(136003)(346002)(39860400002)(396003)(451199015)(36840700001)(46966006)(40470700004)(2906002)(5660300002)(8936002)(44832011)(8676002)(41300700001)(4326008)(110136005)(316002)(70206006)(70586007)(54906003)(478600001)(2616005)(186003)(16526019)(82310400005)(26005)(40480700001)(7696005)(83380400001)(426003)(47076005)(336012)(82740400003)(81166007)(356005)(1076003)(86362001)(40460700003)(36756003)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:41:56.6438 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68544ddb-3e05-4e73-464b-08daee7297ce X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010206.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4396 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When firmware is missing we get failures at every step. ``` [ 3.855086] amdgpu 0000:04:00.0: Direct firmware load for amdgpu/green_sardine_sdma.bin failed with error -2 [ 3.855087] [drm:amdgpu_sdma_init_microcode [amdgpu]] *ERROR* SDMA: Failed to init firmware "amdgpu/green_sardine_sdma.bin" [ 3.855398] [drm:sdma_v4_0_early_init [amdgpu]] *ERROR* Failed to load sdma firmware! ``` Realistically we don't need all of these, a user can tell from the first one that request_firmware emitted what happened. Drop the others. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c index f8e4a52ab67a..35b79eeb5f09 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c @@ -280,10 +280,8 @@ int amdgpu_sdma_init_microcode(struct amdgpu_device *adev, } out: - if (err) { - DRM_ERROR("SDMA: Failed to init firmware \"%s\"\n", fw_name); + if (err) amdgpu_sdma_destroy_inst_ctx(adev, duplicate); - } return err; } From patchwork Wed Jan 4 16:39:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A055C4332F for ; Wed, 4 Jan 2023 16:42:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E923A10E532; Wed, 4 Jan 2023 16:42:13 +0000 (UTC) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2060.outbound.protection.outlook.com [40.107.101.60]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5A05D10E457; Wed, 4 Jan 2023 16:42:00 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LaEhBEBdDHKvuFkxK6ukZUMNuLdzxan4kXEgaezPaHSdIVv5llPibn3vFOZlOIq1fYGSrInPVkeBugcpLtEZQzwl+Wes20jeDiruDTrp57cCG+do91rKf27+vMJD+Xx+dqhQNpQ1I1i6fvgRBh4szthvQxPU5paHpyBKjhvgmnn4JwNkVfJziNobAuhQijOHgHOnlTigdOb2wFRMNDHwoE/doIQTm7en3O9BwtRGZdOzn3Q/HKHpRm0UirTmAiCDHjHGSCCLLU7fV6VZkxN8i7j+YNbbCRrWEd5TedOAeOTBE3b04d6hadfW1xvb5bhvisg/P70jB5oZDKiienYqFg== 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=FYEI94OHZJD5rujfGunzioO+qt2jPdpcF4T44tMN5Pg=; b=c6yh3H+wGvZZvVBTNYTMambvzb40or5KmHcuIKdLc6C1byUljWcCb3VcF9Dg+whXaEqKH7wps7325huV/5i+k3fhLOffiF4iyXNDuG7LNm2TfjbMNsB99Kewx6fq5Bl86KnM8tphHIXOtPmuVLGsVqXaF73hNgzsYZTiBxFgXhneriVRCpm2az+k+3MTr/CgemF8bEPohBFtZybi5lpxpkSbZA024rsR0madv+WKtJQC3m5Rfp2cx5THSsRPAy9+PhB8IPvNS5g9heFqayQwd1RDAcg0S1pDrDGnNJQ/pMjQ8JpvoaxYZw1J2e+Fox0fXyiDmmVgfPr+MXtEEpZkSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FYEI94OHZJD5rujfGunzioO+qt2jPdpcF4T44tMN5Pg=; b=dkrpMf5RoCOy5po1032K45x2FZjI6vRJQDQ0kXL9CwS7pVC/bnU/yqkKkXj60cQqmYMIqtyDqcnAgZrjOTnRszsVCvOTXPaTecvEYVeWHBLUNKVNSI9kXWy0pl/uV66JOsYxjkyLvmZxfGcFVxNLmUdVKrpCFWxxdRSpjpxuMfg= Received: from MN2PR16CA0045.namprd16.prod.outlook.com (2603:10b6:208:234::14) by BN9PR12MB5049.namprd12.prod.outlook.com (2603:10b6:408:132::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:41:57 +0000 Received: from BL02EPF00010206.namprd05.prod.outlook.com (2603:10b6:208:234:cafe::bd) by MN2PR16CA0045.outlook.office365.com (2603:10b6:208:234::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:41:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010206.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:41:57 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:41:55 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 09/45] drm/amd: Use `amdgpu_ucode_*` helpers for VCN Date: Wed, 4 Jan 2023 10:39:58 -0600 Message-ID: <20230104164042.30271-10-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010206:EE_|BN9PR12MB5049:EE_ X-MS-Office365-Filtering-Correlation-Id: 28ef1c81-1395-4595-1b64-08daee729824 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GTb7gCKjqqTCvumJ60IyjnldWxytkyMnm8hTgRb2B4/TrHqj1GA62RbaLSpKYhI0jR8giAPKzLO+I2muujUyRn+eqMpqFe0Pv4nyjDRreM/+ysSIafHIf5w7fkhCwhccQB8wGbx9vsW/uSgrUSXdcENXvWiP+qUcOtAUDxkLTHZpnB2FIMwuA3cKFqvbdnv3JJWu53F/YPLTaDNgqkxBtsTqEMunoDLOcoPFOM/thqfNe/o6a5hMR3TFsgKR4feg0xuuVclsZqb/6BPjr3IeTFnDdltylPwIJWQeYHppI+9XTdqET/EOigLpUegtrOcLajJRS4yOoiV4ZzxJvjGBXw6OjPZUQa6Soa3pXyPkOSCEJ07E2b1WaelSNW1eFWpvJTpUmyw8gI4HxznBdvJub7w7sU+7ClXS5bRbvDSTgG0zjj/YcN0GjaCBBoN10vLKmdK337xo0ZAwFDFsYsaM++FsEUxGTZuGOcPlTYdrhfmwlb9uXdJTKI+QjJesuDykvYBGzYsWoI9NqLEE2BzDf7mUHKIVPpS4ruXBXza8tQ5H2QLuN4a6WFFzjeSF/F1t9r2OeY2AqPpboRdOxTOAaZWpZgJw9We5L0mGFtMAmgoAezIXMiWYLY5EGhFCZf2SWhD58mdAtg6fTkrE/x3nVxTxeW7w6KDe7nWFFTaZ5IC5f8sUJzT5z9GZY7cQaTUaOQTgywCBCXjla9ZrdBptWMBuy59Rlpo8HM+YAf1H7/Wkh+7rLhEnT53w+mddVIhi0wa49M8vaRnK+k+NtPZIJw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(346002)(39860400002)(396003)(451199015)(46966006)(40470700004)(36840700001)(426003)(1076003)(2616005)(336012)(83380400001)(47076005)(16526019)(186003)(82310400005)(40460700003)(81166007)(26005)(356005)(82740400003)(40480700001)(86362001)(36860700001)(36756003)(54906003)(316002)(110136005)(44832011)(2906002)(5660300002)(70586007)(70206006)(8676002)(4326008)(8936002)(41300700001)(7696005)(478600001)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:41:57.2219 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 28ef1c81-1395-4595-1b64-08daee729824 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010206.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5049 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index a23e26b272b4..b5692f825589 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c @@ -206,19 +206,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev) return -EINVAL; } - r = request_firmware(&adev->vcn.fw, fw_name, adev->dev); + r = amdgpu_ucode_request(adev, &adev->vcn.fw, fw_name); if (r) { - dev_err(adev->dev, "amdgpu_vcn: Can't load firmware \"%s\"\n", - fw_name); - return r; - } - - r = amdgpu_ucode_validate(adev->vcn.fw); - if (r) { - dev_err(adev->dev, "amdgpu_vcn: Can't validate firmware \"%s\"\n", - fw_name); - release_firmware(adev->vcn.fw); - adev->vcn.fw = NULL; + amdgpu_ucode_release(adev->vcn.fw); return r; } @@ -333,7 +323,7 @@ int amdgpu_vcn_sw_fini(struct amdgpu_device *adev) amdgpu_ring_fini(&adev->vcn.inst[j].ring_enc[i]); } - release_firmware(adev->vcn.fw); + amdgpu_ucode_release(adev->vcn.fw); mutex_destroy(&adev->vcn.vcn1_jpeg1_workaround); mutex_destroy(&adev->vcn.vcn_pg_lock); From patchwork Wed Jan 4 16:39:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088742 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A545DC4708D for ; Wed, 4 Jan 2023 16:42:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AF69310E45A; Wed, 4 Jan 2023 16:42:11 +0000 (UTC) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2067.outbound.protection.outlook.com [40.107.212.67]) by gabe.freedesktop.org (Postfix) with ESMTPS id A23C110E455; Wed, 4 Jan 2023 16:42:01 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PI9bnkIKteDDpNg74DxHSZah9gQeZZezD9Q377b+CWnc7ctpGq0UrcR6UIpxeLX4fRyOpagHSnJGjeCUrmi5TFzTUZe2yEbjUDIO/1ULytIu8Xkc2Gs0KYEgQcBbYMdM0H0+BjKaj+sNuXyvCLo+ZZ2FQaGFIC3G6b4MHETr8nEBRXET76FHwe0nBqjWfpLkeyk07qIUWqqMQw+24ChQ8rh9YziSFKQ5s/i2+2F0k5SgHVDNH0/8+ZbnHpesOjVJwxLS3MAd4eF5kLV5nlDegn1eoudHsxlg25Xi7pXfxKOI8KyWGnDdxDAGYHQAzd1dWF1ea4J+Ib7YW93ssGFEmg== 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=lQXlCycgBBLrHcEie65t3IuLWuR9DejOGTH4sC4TmMc=; b=dlu9t8QP30/D/c+kuAW+Wri34jUxJi5H4QHOZFoNJAEhgPRz28qAp4YrbY/lsgKkhol6vdVA3juOjo/DjZEBKmHWuzILcPQ/mwJE3A711hu5Wb/UMR912sUpNuOe6Ege7DOQnfLGpk0TY0zOeganEa9Zi2D4gk5NacNKceHf/2A4OJlhhSCwiLRJvdJtvFlee0utDoAyB9fVw+NzQ59NNIUAFkkvcSVQfzXLY+4l0LXXmu5LHL09Ul4R7QfVo/HDtWCAFHb39W4q6vaVEuOjSqLMHRZsctxs647kyvIu+9YExyRfIOYajP/yRVPkJBw6p1OZrGlejigKyAJ9idC4bQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lQXlCycgBBLrHcEie65t3IuLWuR9DejOGTH4sC4TmMc=; b=vM86Rn+X/cV0/fO7nBtZ2upeVdG26w0jj9VlksTmfeYVjXmVdyNQlohrfEw+qNPWiVmRWQWN75cngM+fWDQ31ZTIZIVZzaUwA8brNIyeT/wB1fUp0sEomBMHnnCTv8OSmLUEXzwp14qnc4pkx6VixtminHWXTbWtANey0neP1Sg= Received: from MN2PR16CA0046.namprd16.prod.outlook.com (2603:10b6:208:234::15) by MN0PR12MB6056.namprd12.prod.outlook.com (2603:10b6:208:3cc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:41:58 +0000 Received: from BL02EPF00010206.namprd05.prod.outlook.com (2603:10b6:208:234:cafe::52) by MN2PR16CA0046.outlook.office365.com (2603:10b6:208:234::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:41:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010206.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:41:58 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:41:57 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 10/45] drm/amd: Load VCN microcode during early_init Date: Wed, 4 Jan 2023 10:39:59 -0600 Message-ID: <20230104164042.30271-11-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010206:EE_|MN0PR12MB6056:EE_ X-MS-Office365-Filtering-Correlation-Id: 23d80acd-cbd6-4abe-733d-08daee72991e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R1xZcYSYJdwlP7p/uZMcatMMRJ8BiVJQaBSJwGGvG8g0w2g9jUe7Wl89doBOKDfsUoUs+XyunUpGHUadEx4a54VPjtGy0p/RY+jxSOBBQUf5MVamwhh+j+F1gTB7vmctAv7zt+QO2ug16CNGbOKo9/sFrYbYfKgGzZMRSNJKbHaNhpAfPptpErUIxl7plG9/UXh2LEVeXePtJcQdX2EX/0F95Qz9pgcn9ZtrmMzjJcxtQtsUfyhsyFMVJ6iAOwIKLyXUEKdgc9R/6zna4oquU2ElDakfU35bBQpiW5ZStCw4thcY7WTxhcZpRpW2Di241X+ubCJ3ZS2QV02AlmdaZ9m8hZu8mlVH4BdO5eMVrr9zVdh8QYXIzKdUKMier8v9AdcRA1riI4DWqRw/JLgC20EIJu2gXVNta92SATC7LAmzE1K7lraaUoNM2FNulORyMkMmYCQy9oY07UGRL311dEU7nvFqTDwsyPBafiBh0fEMzIuveAUy2P2Wf4Iu3wOB6CXH3/yhl63I5XYl7lbIvztlZ1wDsdslfA2E7QI6j58sgl5iXsM6q3rKFGCc9IYzf9zZCeVTxeXd/RtMk+s1e/f5aZwqhTlrCFJ6AxowMjaG3JZllieEf6F4SWRoajYF6pQLGZnrlNNFDqcpLUfbprd0fwg7MMZYE7NcfeZxWRNSgZ3oQcGO7ATEynNpeLW7Ji1v0CPckq1ineWqeno8NDf4pdvxxBuGINuyGbBLMHU= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(39860400002)(396003)(136003)(346002)(451199015)(46966006)(36840700001)(40470700004)(186003)(26005)(2616005)(54906003)(70586007)(70206006)(1076003)(4326008)(41300700001)(478600001)(8676002)(47076005)(8936002)(336012)(83380400001)(5660300002)(426003)(44832011)(30864003)(16526019)(2906002)(36860700001)(356005)(81166007)(7696005)(110136005)(316002)(40480700001)(40460700003)(36756003)(82310400005)(86362001)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:41:58.8625 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23d80acd-cbd6-4abe-733d-08daee72991e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010206.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6056 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Simplifies the code so that all VCN versions will get the firmware name from `amdgpu_ucode_ip_version_decode` and then use this filename to load microcode as part of the early_init process. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 91 +++++++++---------------- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 1 + drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 5 +- drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 5 +- drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 5 +- drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 5 +- drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 5 +- 7 files changed, 50 insertions(+), 67 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index b5692f825589..55bbe4c8ff5b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c @@ -36,25 +36,25 @@ #include "soc15d.h" /* Firmware Names */ -#define FIRMWARE_RAVEN "amdgpu/raven_vcn.bin" -#define FIRMWARE_PICASSO "amdgpu/picasso_vcn.bin" -#define FIRMWARE_RAVEN2 "amdgpu/raven2_vcn.bin" -#define FIRMWARE_ARCTURUS "amdgpu/arcturus_vcn.bin" -#define FIRMWARE_RENOIR "amdgpu/renoir_vcn.bin" -#define FIRMWARE_GREEN_SARDINE "amdgpu/green_sardine_vcn.bin" -#define FIRMWARE_NAVI10 "amdgpu/navi10_vcn.bin" -#define FIRMWARE_NAVI14 "amdgpu/navi14_vcn.bin" -#define FIRMWARE_NAVI12 "amdgpu/navi12_vcn.bin" -#define FIRMWARE_SIENNA_CICHLID "amdgpu/sienna_cichlid_vcn.bin" -#define FIRMWARE_NAVY_FLOUNDER "amdgpu/navy_flounder_vcn.bin" -#define FIRMWARE_VANGOGH "amdgpu/vangogh_vcn.bin" -#define FIRMWARE_DIMGREY_CAVEFISH "amdgpu/dimgrey_cavefish_vcn.bin" -#define FIRMWARE_ALDEBARAN "amdgpu/aldebaran_vcn.bin" -#define FIRMWARE_BEIGE_GOBY "amdgpu/beige_goby_vcn.bin" -#define FIRMWARE_YELLOW_CARP "amdgpu/yellow_carp_vcn.bin" -#define FIRMWARE_VCN_3_1_2 "amdgpu/vcn_3_1_2.bin" -#define FIRMWARE_VCN4_0_0 "amdgpu/vcn_4_0_0.bin" -#define FIRMWARE_VCN4_0_2 "amdgpu/vcn_4_0_2.bin" +#define FIRMWARE_RAVEN "amdgpu/raven_vcn.bin" +#define FIRMWARE_PICASSO "amdgpu/picasso_vcn.bin" +#define FIRMWARE_RAVEN2 "amdgpu/raven2_vcn.bin" +#define FIRMWARE_ARCTURUS "amdgpu/arcturus_vcn.bin" +#define FIRMWARE_RENOIR "amdgpu/renoir_vcn.bin" +#define FIRMWARE_GREEN_SARDINE "amdgpu/green_sardine_vcn.bin" +#define FIRMWARE_NAVI10 "amdgpu/navi10_vcn.bin" +#define FIRMWARE_NAVI14 "amdgpu/navi14_vcn.bin" +#define FIRMWARE_NAVI12 "amdgpu/navi12_vcn.bin" +#define FIRMWARE_SIENNA_CICHLID "amdgpu/sienna_cichlid_vcn.bin" +#define FIRMWARE_NAVY_FLOUNDER "amdgpu/navy_flounder_vcn.bin" +#define FIRMWARE_VANGOGH "amdgpu/vangogh_vcn.bin" +#define FIRMWARE_DIMGREY_CAVEFISH "amdgpu/dimgrey_cavefish_vcn.bin" +#define FIRMWARE_ALDEBARAN "amdgpu/aldebaran_vcn.bin" +#define FIRMWARE_BEIGE_GOBY "amdgpu/beige_goby_vcn.bin" +#define FIRMWARE_YELLOW_CARP "amdgpu/yellow_carp_vcn.bin" +#define FIRMWARE_VCN_3_1_2 "amdgpu/vcn_3_1_2.bin" +#define FIRMWARE_VCN4_0_0 "amdgpu/vcn_4_0_0.bin" +#define FIRMWARE_VCN4_0_2 "amdgpu/vcn_4_0_2.bin" #define FIRMWARE_VCN4_0_4 "amdgpu/vcn_4_0_4.bin" MODULE_FIRMWARE(FIRMWARE_RAVEN); @@ -80,10 +80,24 @@ MODULE_FIRMWARE(FIRMWARE_VCN4_0_4); static void amdgpu_vcn_idle_work_handler(struct work_struct *work); +int amdgpu_vcn_early_init(struct amdgpu_device *adev) +{ + char ucode_prefix[30]; + char fw_name[40]; + int r; + + amdgpu_ucode_ip_version_decode(adev, UVD_HWIP, ucode_prefix, sizeof(ucode_prefix)); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix); + r = amdgpu_ucode_request(adev, &adev->vcn.fw, fw_name); + if (r) + amdgpu_ucode_release(adev->vcn.fw); + + return r; +} + int amdgpu_vcn_sw_init(struct amdgpu_device *adev) { unsigned long bo_size; - const char *fw_name; const struct common_firmware_header *hdr; unsigned char fw_check; unsigned int fw_shared_size, log_offset; @@ -99,46 +113,27 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev) switch (adev->ip_versions[UVD_HWIP][0]) { case IP_VERSION(1, 0, 0): case IP_VERSION(1, 0, 1): - if (adev->apu_flags & AMD_APU_IS_RAVEN2) - fw_name = FIRMWARE_RAVEN2; - else if (adev->apu_flags & AMD_APU_IS_PICASSO) - fw_name = FIRMWARE_PICASSO; - else - fw_name = FIRMWARE_RAVEN; - break; case IP_VERSION(2, 5, 0): - fw_name = FIRMWARE_ARCTURUS; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(2, 2, 0): - if (adev->apu_flags & AMD_APU_IS_RENOIR) - fw_name = FIRMWARE_RENOIR; - else - fw_name = FIRMWARE_GREEN_SARDINE; - if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(2, 6, 0): - fw_name = FIRMWARE_ALDEBARAN; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(2, 0, 0): - fw_name = FIRMWARE_NAVI10; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(2, 0, 2): - if (adev->asic_type == CHIP_NAVI12) - fw_name = FIRMWARE_NAVI12; - else - fw_name = FIRMWARE_NAVI14; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; @@ -146,58 +141,46 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev) case IP_VERSION(3, 0, 0): case IP_VERSION(3, 0, 64): case IP_VERSION(3, 0, 192): - if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0)) - fw_name = FIRMWARE_SIENNA_CICHLID; - else - fw_name = FIRMWARE_NAVY_FLOUNDER; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(3, 0, 2): - fw_name = FIRMWARE_VANGOGH; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(3, 0, 16): - fw_name = FIRMWARE_DIMGREY_CAVEFISH; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(3, 0, 33): - fw_name = FIRMWARE_BEIGE_GOBY; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(3, 1, 1): - fw_name = FIRMWARE_YELLOW_CARP; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(3, 1, 2): - fw_name = FIRMWARE_VCN_3_1_2; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(4, 0, 0): - fw_name = FIRMWARE_VCN4_0_0; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(4, 0, 2): - fw_name = FIRMWARE_VCN4_0_2; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(4, 0, 4): - fw_name = FIRMWARE_VCN4_0_4; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; @@ -206,12 +189,6 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev) return -EINVAL; } - r = amdgpu_ucode_request(adev, &adev->vcn.fw, fw_name); - if (r) { - amdgpu_ucode_release(adev->vcn.fw); - return r; - } - hdr = (const struct common_firmware_header *)adev->vcn.fw->data; adev->vcn.fw_version = le32_to_cpu(hdr->ucode_version); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h index dbb8d68a30c6..d3e2af902907 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h @@ -369,6 +369,7 @@ enum vcn_ring_type { VCN_UNIFIED_RING, }; +int amdgpu_vcn_early_init(struct amdgpu_device *adev); int amdgpu_vcn_sw_init(struct amdgpu_device *adev); int amdgpu_vcn_sw_fini(struct amdgpu_device *adev); int amdgpu_vcn_suspend(struct amdgpu_device *adev); diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c index f0fbcda76f5e..c305b2cb8490 100644 --- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c @@ -57,11 +57,12 @@ static void vcn_v1_0_idle_work_handler(struct work_struct *work); static void vcn_v1_0_ring_begin_use(struct amdgpu_ring *ring); /** - * vcn_v1_0_early_init - set function pointers + * vcn_v1_0_early_init - set function pointers and load microcode * * @handle: amdgpu_device pointer * * Set ring and irq function pointers + * Load microcode from filesystem */ static int vcn_v1_0_early_init(void *handle) { @@ -75,7 +76,7 @@ static int vcn_v1_0_early_init(void *handle) jpeg_v1_0_early_init(handle); - return 0; + return amdgpu_vcn_early_init(adev); } /** diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c index 08871bad9994..4b4cd88414e0 100644 --- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c @@ -62,11 +62,12 @@ static int vcn_v2_0_pause_dpg_mode(struct amdgpu_device *adev, int inst_idx, struct dpg_pause_state *new_state); static int vcn_v2_0_start_sriov(struct amdgpu_device *adev); /** - * vcn_v2_0_early_init - set function pointers + * vcn_v2_0_early_init - set function pointers and load microcode * * @handle: amdgpu_device pointer * * Set ring and irq function pointers + * Load microcode from filesystem */ static int vcn_v2_0_early_init(void *handle) { @@ -81,7 +82,7 @@ static int vcn_v2_0_early_init(void *handle) vcn_v2_0_set_enc_ring_funcs(adev); vcn_v2_0_set_irq_funcs(adev); - return 0; + return amdgpu_vcn_early_init(adev); } /** diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c index ec87b00f2e05..b0b0e69c6a94 100644 --- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c @@ -71,11 +71,12 @@ static int amdgpu_ih_clientid_vcns[] = { }; /** - * vcn_v2_5_early_init - set function pointers + * vcn_v2_5_early_init - set function pointers and load microcode * * @handle: amdgpu_device pointer * * Set ring and irq function pointers + * Load microcode from filesystem */ static int vcn_v2_5_early_init(void *handle) { @@ -107,7 +108,7 @@ static int vcn_v2_5_early_init(void *handle) vcn_v2_5_set_irq_funcs(adev); vcn_v2_5_set_ras_funcs(adev); - return 0; + return amdgpu_vcn_early_init(adev); } /** diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c index 9c8b5fd99037..bd228512424a 100644 --- a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c @@ -78,11 +78,12 @@ static void vcn_v3_0_dec_ring_set_wptr(struct amdgpu_ring *ring); static void vcn_v3_0_enc_ring_set_wptr(struct amdgpu_ring *ring); /** - * vcn_v3_0_early_init - set function pointers + * vcn_v3_0_early_init - set function pointers and load microcode * * @handle: amdgpu_device pointer * * Set ring and irq function pointers + * Load microcode from filesystem */ static int vcn_v3_0_early_init(void *handle) { @@ -109,7 +110,7 @@ static int vcn_v3_0_early_init(void *handle) vcn_v3_0_set_enc_ring_funcs(adev); vcn_v3_0_set_irq_funcs(adev); - return 0; + return amdgpu_vcn_early_init(adev); } /** diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c index 1e2b22299975..a79b6088374b 100644 --- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c @@ -68,11 +68,12 @@ static void vcn_v4_0_unified_ring_set_wptr(struct amdgpu_ring *ring); static void vcn_v4_0_set_ras_funcs(struct amdgpu_device *adev); /** - * vcn_v4_0_early_init - set function pointers + * vcn_v4_0_early_init - set function pointers and load microcode * * @handle: amdgpu_device pointer * * Set ring and irq function pointers + * Load microcode from filesystem */ static int vcn_v4_0_early_init(void *handle) { @@ -88,7 +89,7 @@ static int vcn_v4_0_early_init(void *handle) vcn_v4_0_set_irq_funcs(adev); vcn_v4_0_set_ras_funcs(adev); - return 0; + return amdgpu_vcn_early_init(adev); } /** From patchwork Wed Jan 4 16:40:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3AB75C4332F for ; Wed, 4 Jan 2023 16:43:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 045FB10E586; Wed, 4 Jan 2023 16:43:53 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2048.outbound.protection.outlook.com [40.107.244.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8182F10E586; Wed, 4 Jan 2023 16:43:50 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TidpfAcWyp1oTT2c1ZOlOuN5I2Gyd2KAbHdMTcva2pz22diAnC8ymNMnThKimJ/XESsIczh+RqPX5NrL21cJUoiWywK31v5kYBBjBNHjrRgUNxpl28NFuDQkIM8aXKCyVmM2VQQZsxWP6O4GkkRO3dIrTYD6lJCXDeUtcKU12EQo05K5+B0jdpGxCafene1gJo4Ol2Mb8rwhGnoGzzSn6huysGMNjM/CkAky3rG6VRe/pLku4qphBpZ52T2DsgQotmkv2hdIg/K0wIzmXMaMmbpViFiPBItjAbPOWTKXyk686bvuqv1jxB1LIeF6b/Z8o7zVjrlKEnpM+alybviPag== 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=eOk4MvdTXi2tl/ytowgm5qVNpgWmogBHwW0VsTZ0Azg=; b=F/YAmyy4AasWiggsPmt2sduy5yiY2R39lXQN+nVG25OCB9JZJ433pBc5WwI6Yeav734mojBGOQsu9F8slZD5gDAURNNLvK/g6bv4/tX4aynAJb3+gBTdgc+g5bHLCv06HJWoWpnN/x+/GrYAWypsbR5HH/1uoE2VUVlyyu0ke3kZSBqX9P4xYrkLsAck1N/jPp85xat2cH0SgiGLi77tWa9Sc/LFNZxZMb95s9oHveGoAFYfRewCgfX+4piKNaI9KrR1AimBz6uz8I2eJuQNvOn5W1nvW9VaCCqCiLDiv3g6/FgDSjgNo2jOqZcw7qEwnKnzFXioIaYE5LhMR7Ks6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eOk4MvdTXi2tl/ytowgm5qVNpgWmogBHwW0VsTZ0Azg=; b=2NZyWHXdw60YRSz7UALtJqYMKP8vVyUIet6Fvnd6pzfihK0aswpe9Ja6DuOm1S0YqsAEd3N+xxtNOhx03QjuwvusGTwfQmUPUIvDYOmsFIyhIImFrvBEIjiPlKan0XMaitUFXlO/ge1cfCU1j5zcgcFpKLT8F5IXVW1HaVw5SOk= Received: from BN8PR15CA0031.namprd15.prod.outlook.com (2603:10b6:408:c0::44) by DS0PR12MB7898.namprd12.prod.outlook.com (2603:10b6:8:14c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:43:48 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:408:c0:cafe::13) by BN8PR15CA0031.outlook.office365.com (2603:10b6:408:c0::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.20 via Frontend Transport; Wed, 4 Jan 2023 16:43:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:43:15 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:41:59 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 11/45] drm/amd: Load MES microcode during early_init Date: Wed, 4 Jan 2023 10:40:00 -0600 Message-ID: <20230104164042.30271-12-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|DS0PR12MB7898:EE_ X-MS-Office365-Filtering-Correlation-Id: fda2b673-3a29-4fac-5a7f-08daee72d70f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KYUpWmVAxVwxEUA1JDw0oHX/qktm5tsZMJcDfbNH99LVVRLmqBCR1D7VV/7k/6BUR/N8+dxazDJe43pqpgq0ABIRYrzyVKKUaBOtZCRIwBQlRziwv2tGtioMD8n6zIj3TgWcwWERdF2CZYUOOqSs14rz2X4tjSl68h38l5l2547OhUY2KwscAN9PuJLODX3QKYA3pIMVBKVz9TqS0DTZZmr2x3ziYUPdn0JFwt409w/KtQG4VHuSH5wthTtUnpKIO0yRj4gYixzhDX9ay5CuS7x8pRATkRvbD4vQMyAmd17vtisdRnLjXZwo3MnUaDJosWiAWsp1LmB3WdCOEBvE5InDHf7me7Y5Mv8O8lF2/8/lwovhaoWtO5Rc+QXv7ze9tiZSY0ZpsqhssUX06J23xnOU6ToMoAYqJCzKeeIGjlq26GD1ATLsXfPAfSMgpBSuGY2MlRRVU/dxCNN0EKEfGkgJ0CkXl348l8/QrBBMC2YYQrTy69sw/sFeBB92u4gbceTc4OW8wt46J7EdkHwMB2aHmcUfjuYZ7VX/wX3fN8g6jDV3X+lo+FLcbmZR7NgJWvCjdaPcYRjCynCP9bz/X7VGV6fr4fuYkUklyEsNma5Q+4p2N6WILM2ZyfcDrPiHrnK/qrrd6pJHl2gqsLWGL9Rv+Hn2ozTGeRg5tw/06kUIgGt1LXGOpoTrvHOxBES6SM1e3c+hb3ovARNN9YaPwaSM6N7ZEESWT7MLCt6Egow= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(376002)(396003)(136003)(39860400002)(451199015)(40470700004)(46966006)(36840700001)(70586007)(4326008)(41300700001)(70206006)(47076005)(8676002)(426003)(356005)(86362001)(336012)(186003)(54906003)(2906002)(83380400001)(81166007)(6666004)(316002)(7696005)(82310400005)(26005)(36860700001)(478600001)(44832011)(16526019)(82740400003)(110136005)(30864003)(1076003)(8936002)(36756003)(40460700003)(5660300002)(40480700001)(2616005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:43:15.3289 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fda2b673-3a29-4fac-5a7f-08daee72d70f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7898 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add an early_init phase to MES for fetching and validating microcode from the filesystem. If MES microcode is required but not available during early init, the firmware framebuffer will have already been released and the screen will freeze. Move the request for MES microcode into the early_init phase so that if it's not available, early_init will fail. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 65 +++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 1 + drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 97 +++++-------------------- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 88 +++++----------------- 4 files changed, 100 insertions(+), 151 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c index 0c546245793b..dd8f35234507 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c @@ -21,6 +21,8 @@ * */ +#include + #include "amdgpu_mes.h" #include "amdgpu.h" #include "soc15_common.h" @@ -1423,3 +1425,66 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev) kfree(vm); return 0; } + +int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe) +{ + const struct mes_firmware_header_v1_0 *mes_hdr; + struct amdgpu_firmware_info *info; + char ucode_prefix[30]; + char fw_name[40]; + int r; + + amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix)); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin", + ucode_prefix, + pipe == AMDGPU_MES_SCHED_PIPE ? "" : "1"); + r = request_firmware(&adev->mes.fw[pipe], fw_name, adev->dev); + if (r) + goto out; + + r = amdgpu_ucode_validate(adev->mes.fw[pipe]); + if (r) + goto out; + + mes_hdr = (const struct mes_firmware_header_v1_0 *) + adev->mes.fw[pipe]->data; + adev->mes.uc_start_addr[pipe] = + le32_to_cpu(mes_hdr->mes_uc_start_addr_lo) | + ((uint64_t)(le32_to_cpu(mes_hdr->mes_uc_start_addr_hi)) << 32); + adev->mes.data_start_addr[pipe] = + le32_to_cpu(mes_hdr->mes_data_start_addr_lo) | + ((uint64_t)(le32_to_cpu(mes_hdr->mes_data_start_addr_hi)) << 32); + + if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) { + int ucode, ucode_data; + + if (pipe == AMDGPU_MES_SCHED_PIPE) { + ucode = AMDGPU_UCODE_ID_CP_MES; + ucode_data = AMDGPU_UCODE_ID_CP_MES_DATA; + } else { + ucode = AMDGPU_UCODE_ID_CP_MES1; + ucode_data = AMDGPU_UCODE_ID_CP_MES1_DATA; + } + + info = &adev->firmware.ucode[ucode]; + info->ucode_id = ucode; + info->fw = adev->mes.fw[pipe]; + adev->firmware.fw_size += + ALIGN(le32_to_cpu(mes_hdr->mes_ucode_size_bytes), + PAGE_SIZE); + + info = &adev->firmware.ucode[ucode_data]; + info->ucode_id = ucode_data; + info->fw = adev->mes.fw[pipe]; + adev->firmware.fw_size += + ALIGN(le32_to_cpu(mes_hdr->mes_ucode_data_size_bytes), + PAGE_SIZE); + } + + return 0; + +out: + release_firmware(adev->mes.fw[pipe]); + adev->mes.fw[pipe] = NULL; + return r; +} diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h index 97c05d08a551..547ec35691fa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h @@ -306,6 +306,7 @@ struct amdgpu_mes_funcs { int amdgpu_mes_ctx_get_offs(struct amdgpu_ring *ring, unsigned int id_offs); +int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe); int amdgpu_mes_init(struct amdgpu_device *adev); void amdgpu_mes_fini(struct amdgpu_device *adev); diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c index 614394118a53..9c5ff8b7c202 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c @@ -379,82 +379,6 @@ static const struct amdgpu_mes_funcs mes_v10_1_funcs = { .resume_gang = mes_v10_1_resume_gang, }; -static int mes_v10_1_init_microcode(struct amdgpu_device *adev, - enum admgpu_mes_pipe pipe) -{ - const char *chip_name; - char fw_name[30]; - int err; - const struct mes_firmware_header_v1_0 *mes_hdr; - struct amdgpu_firmware_info *info; - - switch (adev->ip_versions[GC_HWIP][0]) { - case IP_VERSION(10, 1, 10): - chip_name = "navi10"; - break; - case IP_VERSION(10, 3, 0): - chip_name = "sienna_cichlid"; - break; - default: - BUG(); - } - - if (pipe == AMDGPU_MES_SCHED_PIPE) - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes.bin", - chip_name); - else - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes1.bin", - chip_name); - - err = request_firmware(&adev->mes.fw[pipe], fw_name, adev->dev); - if (err) - return err; - - err = amdgpu_ucode_validate(adev->mes.fw[pipe]); - if (err) { - release_firmware(adev->mes.fw[pipe]); - adev->mes.fw[pipe] = NULL; - return err; - } - - mes_hdr = (const struct mes_firmware_header_v1_0 *) - adev->mes.fw[pipe]->data; - adev->mes.uc_start_addr[pipe] = - le32_to_cpu(mes_hdr->mes_uc_start_addr_lo) | - ((uint64_t)(le32_to_cpu(mes_hdr->mes_uc_start_addr_hi)) << 32); - adev->mes.data_start_addr[pipe] = - le32_to_cpu(mes_hdr->mes_data_start_addr_lo) | - ((uint64_t)(le32_to_cpu(mes_hdr->mes_data_start_addr_hi)) << 32); - - if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) { - int ucode, ucode_data; - - if (pipe == AMDGPU_MES_SCHED_PIPE) { - ucode = AMDGPU_UCODE_ID_CP_MES; - ucode_data = AMDGPU_UCODE_ID_CP_MES_DATA; - } else { - ucode = AMDGPU_UCODE_ID_CP_MES1; - ucode_data = AMDGPU_UCODE_ID_CP_MES1_DATA; - } - - info = &adev->firmware.ucode[ucode]; - info->ucode_id = ucode; - info->fw = adev->mes.fw[pipe]; - adev->firmware.fw_size += - ALIGN(le32_to_cpu(mes_hdr->mes_ucode_size_bytes), - PAGE_SIZE); - - info = &adev->firmware.ucode[ucode_data]; - info->ucode_id = ucode_data; - info->fw = adev->mes.fw[pipe]; - adev->firmware.fw_size += - ALIGN(le32_to_cpu(mes_hdr->mes_ucode_data_size_bytes), - PAGE_SIZE); - } - - return 0; -} - static void mes_v10_1_free_microcode(struct amdgpu_device *adev, enum admgpu_mes_pipe pipe) { @@ -1019,10 +943,6 @@ static int mes_v10_1_sw_init(void *handle) if (!adev->enable_mes_kiq && pipe == AMDGPU_MES_KIQ_PIPE) continue; - r = mes_v10_1_init_microcode(adev, pipe); - if (r) - return r; - r = mes_v10_1_allocate_eop_buf(adev, pipe); if (r) return r; @@ -1229,6 +1149,22 @@ static int mes_v10_1_resume(void *handle) return amdgpu_mes_resume(adev); } +static int mes_v10_0_early_init(void *handle) +{ + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + int pipe, r; + + for (pipe = 0; pipe < AMDGPU_MAX_MES_PIPES; pipe++) { + if (!adev->enable_mes_kiq && pipe == AMDGPU_MES_KIQ_PIPE) + continue; + r = amdgpu_mes_init_microcode(adev, pipe); + if (r) + return r; + } + + return 0; +} + static int mes_v10_0_late_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -1241,6 +1177,7 @@ static int mes_v10_0_late_init(void *handle) static const struct amd_ip_funcs mes_v10_1_ip_funcs = { .name = "mes_v10_1", + .early_init = mes_v10_0_early_init, .late_init = mes_v10_0_late_init, .sw_init = mes_v10_1_sw_init, .sw_fini = mes_v10_1_sw_fini, diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c index 970b066b37bb..3af77a32baac 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c @@ -459,73 +459,6 @@ static const struct amdgpu_mes_funcs mes_v11_0_funcs = { .misc_op = mes_v11_0_misc_op, }; -static int mes_v11_0_init_microcode(struct amdgpu_device *adev, - enum admgpu_mes_pipe pipe) -{ - char fw_name[30]; - char ucode_prefix[30]; - int err; - const struct mes_firmware_header_v1_0 *mes_hdr; - struct amdgpu_firmware_info *info; - - amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix)); - - if (pipe == AMDGPU_MES_SCHED_PIPE) - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes.bin", - ucode_prefix); - else - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes1.bin", - ucode_prefix); - - err = request_firmware(&adev->mes.fw[pipe], fw_name, adev->dev); - if (err) - return err; - - err = amdgpu_ucode_validate(adev->mes.fw[pipe]); - if (err) { - release_firmware(adev->mes.fw[pipe]); - adev->mes.fw[pipe] = NULL; - return err; - } - - mes_hdr = (const struct mes_firmware_header_v1_0 *) - adev->mes.fw[pipe]->data; - adev->mes.uc_start_addr[pipe] = - le32_to_cpu(mes_hdr->mes_uc_start_addr_lo) | - ((uint64_t)(le32_to_cpu(mes_hdr->mes_uc_start_addr_hi)) << 32); - adev->mes.data_start_addr[pipe] = - le32_to_cpu(mes_hdr->mes_data_start_addr_lo) | - ((uint64_t)(le32_to_cpu(mes_hdr->mes_data_start_addr_hi)) << 32); - - if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) { - int ucode, ucode_data; - - if (pipe == AMDGPU_MES_SCHED_PIPE) { - ucode = AMDGPU_UCODE_ID_CP_MES; - ucode_data = AMDGPU_UCODE_ID_CP_MES_DATA; - } else { - ucode = AMDGPU_UCODE_ID_CP_MES1; - ucode_data = AMDGPU_UCODE_ID_CP_MES1_DATA; - } - - info = &adev->firmware.ucode[ucode]; - info->ucode_id = ucode; - info->fw = adev->mes.fw[pipe]; - adev->firmware.fw_size += - ALIGN(le32_to_cpu(mes_hdr->mes_ucode_size_bytes), - PAGE_SIZE); - - info = &adev->firmware.ucode[ucode_data]; - info->ucode_id = ucode_data; - info->fw = adev->mes.fw[pipe]; - adev->firmware.fw_size += - ALIGN(le32_to_cpu(mes_hdr->mes_ucode_data_size_bytes), - PAGE_SIZE); - } - - return 0; -} - static void mes_v11_0_free_microcode(struct amdgpu_device *adev, enum admgpu_mes_pipe pipe) { @@ -1100,10 +1033,6 @@ static int mes_v11_0_sw_init(void *handle) if (!adev->enable_mes_kiq && pipe == AMDGPU_MES_KIQ_PIPE) continue; - r = mes_v11_0_init_microcode(adev, pipe); - if (r) - return r; - r = mes_v11_0_allocate_eop_buf(adev, pipe); if (r) return r; @@ -1338,6 +1267,22 @@ static int mes_v11_0_resume(void *handle) return amdgpu_mes_resume(adev); } +static int mes_v11_0_early_init(void *handle) +{ + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + int pipe, r; + + for (pipe = 0; pipe < AMDGPU_MAX_MES_PIPES; pipe++) { + if (!adev->enable_mes_kiq && pipe == AMDGPU_MES_KIQ_PIPE) + continue; + r = amdgpu_mes_init_microcode(adev, pipe); + if (r) + return r; + } + + return 0; +} + static int mes_v11_0_late_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -1352,6 +1297,7 @@ static int mes_v11_0_late_init(void *handle) static const struct amd_ip_funcs mes_v11_0_ip_funcs = { .name = "mes_v11_0", + .early_init = mes_v11_0_early_init, .late_init = mes_v11_0_late_init, .sw_init = mes_v11_0_sw_init, .sw_fini = mes_v11_0_sw_fini, From patchwork Wed Jan 4 16:40:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088744 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE538C4332F for ; Wed, 4 Jan 2023 16:43:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 17AF110E530; Wed, 4 Jan 2023 16:43:02 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2057.outbound.protection.outlook.com [40.107.92.57]) by gabe.freedesktop.org (Postfix) with ESMTPS id D0A4710E530; Wed, 4 Jan 2023 16:43:00 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hZTE9FPhiFAhLDLKkYwuHAfndLWVry6VjZCkb8mZtKz96sTj5qHey+bpxtBLGX+tkH2hcaA8WR8AJoWn1otOAAhGzTCx8pIxodDDaX/Qd0g799otutUoxZp+iTDY2b6d8fzo1EL4mHo9Gchim2N3amTUNvKnJJYjuCaa1tQn0OI3VsvpvK/41nbwWaHXocZfxpWEch4b+GdTtFfEQ1nYyh8iP1PBu3RQSZFRqc+uRbExqu+vgSXei+8eWUQtDJKPXXAKUKPAMekg1YK1fvLgWxQddJln70/sSI6K4Jvp9tZu3uN4X4V/JqzmDj8JUpzy+tjOEjl7UGnGSZoLy7WxUQ== 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=LqmZ2nAkRcQhgEH0df0U3RghwaRhIhV82O2EuOCNjeU=; b=MgHTysFSFy3cpcH3IPh0+HADyzjY18M9Pgl18CFFpHWed1zjlIZeB2FefxqPUciQ8yHVHcZA6rtJ3N82BduKjv9IIabnd06FJ2WDjv9nLJpyS6ck90nfMaDnoL7a8Gn/baUtBoj5VE6x/y5JOOrC/7DAVUkBOidcv7S5hAnsIXchH9fW5zSLtpaNov+EHpWH6Y2cQGDOAE82ETzw0Bhw/oZ4U6Wo/jcoK+XelfGPuNvaFQdrgP1m0jVGMCrKjKeUl+BXI/b1VHfQIWJhc02CyemHYmq4pYht8gvq+B06oxRwTTrYSjy2mUr3bwsNdtg9orY/WiLZ6G87izAFH7krYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LqmZ2nAkRcQhgEH0df0U3RghwaRhIhV82O2EuOCNjeU=; b=Yn1u4aTkg2tu4N2j2CDeUej8IDcgn1T2TFu3eO1ePEl66ewhosYC+qc9KvPUf9aBNcr9+vHFwD0B0QkE7yReYXFjR+pdp2DrkfICv1VGe7cxxdShCAVGhQxuzEJbt8x4dv7mK+nWGOY3QzAAP2qWT0jIKG8XZ8TgOUviycNJqug= Received: from BN9PR03CA0628.namprd03.prod.outlook.com (2603:10b6:408:106::33) by PH0PR12MB5450.namprd12.prod.outlook.com (2603:10b6:510:e8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:42:58 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::15) by BN9PR03CA0628.outlook.office365.com (2603:10b6:408:106::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:42:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:42:58 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:42:00 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 12/45] drm/amd: Use `amdgpu_ucode_*` helpers for MES Date: Wed, 4 Jan 2023 10:40:01 -0600 Message-ID: <20230104164042.30271-13-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|PH0PR12MB5450:EE_ X-MS-Office365-Filtering-Correlation-Id: 231eaa6b-b64e-4938-dd65-08daee72bc72 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f+nGelDsT7U4XHRI+PsKXtX1v2IidrBceD2uIgnM7tzy/LeFcqpbIOuUxvb4gy1fm9k3i1pEiCsImTb2ORRXulJ4EI4tAdoDqnQKlRSYEq9oCaw4yCMqlMtjaaj1UcU+sqIyGvYai2tSS67BoioQTtu2Ifc3jVKSiLbp1M90SalBl/fUJl2uZPfpCaD6L7zIDsgFiOXtePxfZU1ZOtkgA0XQ898ScYTVlOeTPH1JtTdY0gk6mLRGzlCjD+u6rVzXdYxjVHXkRARkzKyPfWsd7Zu/0Fl+qrPaRL5Y5a1quWz5ZACTRvy7V/FzA5/UXkfpZmvfcZ1QoN+ROOhekf7cc6Sb/6iUMx9LzdB59HOxM2CD/TS0oEhoWhaeYP+em1SZUzI3srZSD/Lfv7QVFpnAnm9PuZvPFne/hx9uyHB+WmSuqdL41JRQTVQohrcg6jhUm+SbgxgqOGRXpVdzceVgY1LxH9zpsmxq6aQdkMpcbtMSJvKM2IRHVwZw2Qc5smaItOqAfwSnmB3/6tCvvf0eywbv5pwFkn/nJjYSBg4NWR+BskyUjACMzCNdZNDFpjwrviI01LRAptbGy2ABid2tEvB6j7NHQBPlCJ1r2o2Js1c8Y0gNK507P2WVUaraOdLJu8BiTK1O0UkH7rkaS+6A/SqF+6SEYwRE7OXjtjqkC1C4UZIN/Nqpwst/MJuKIFaajmJVozxKl8y9bs5eRPjOtGheGw4M7uPMCQ0HjfOrB/hZhI6EW2GTm8nwhiR3+stlyWA8pKtwlkmXnK5p4+l7cw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(346002)(39860400002)(136003)(451199015)(46966006)(36840700001)(40470700004)(16526019)(54906003)(316002)(7696005)(26005)(110136005)(186003)(1076003)(478600001)(2616005)(70206006)(8676002)(336012)(70586007)(4326008)(82740400003)(426003)(41300700001)(2906002)(47076005)(83380400001)(8936002)(5660300002)(44832011)(86362001)(36756003)(36860700001)(40460700003)(356005)(40480700001)(81166007)(82310400005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:42:58.0423 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 231eaa6b-b64e-4938-dd65-08daee72bc72 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5450 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper provides symmetry for releasing firmware. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 10 ++-------- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 10 +--------- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 10 +--------- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c index dd8f35234507..73ec471a8c2f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c @@ -1438,11 +1438,7 @@ int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe) snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin", ucode_prefix, pipe == AMDGPU_MES_SCHED_PIPE ? "" : "1"); - r = request_firmware(&adev->mes.fw[pipe], fw_name, adev->dev); - if (r) - goto out; - - r = amdgpu_ucode_validate(adev->mes.fw[pipe]); + r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe], fw_name); if (r) goto out; @@ -1482,9 +1478,7 @@ int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe) } return 0; - out: - release_firmware(adev->mes.fw[pipe]); - adev->mes.fw[pipe] = NULL; + amdgpu_ucode_release(adev->mes.fw[pipe]); return r; } diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c index 9c5ff8b7c202..a2c96a86538c 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c @@ -379,13 +379,6 @@ static const struct amdgpu_mes_funcs mes_v10_1_funcs = { .resume_gang = mes_v10_1_resume_gang, }; -static void mes_v10_1_free_microcode(struct amdgpu_device *adev, - enum admgpu_mes_pipe pipe) -{ - release_firmware(adev->mes.fw[pipe]); - adev->mes.fw[pipe] = NULL; -} - static int mes_v10_1_allocate_ucode_buffer(struct amdgpu_device *adev, enum admgpu_mes_pipe pipe) { @@ -979,8 +972,7 @@ static int mes_v10_1_sw_fini(void *handle) amdgpu_bo_free_kernel(&adev->mes.eop_gpu_obj[pipe], &adev->mes.eop_gpu_addr[pipe], NULL); - - mes_v10_1_free_microcode(adev, pipe); + amdgpu_ucode_release(adev->mes.fw[pipe]); } amdgpu_bo_free_kernel(&adev->gfx.kiq.ring.mqd_obj, diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c index 3af77a32baac..4dab62335d0d 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c @@ -459,13 +459,6 @@ static const struct amdgpu_mes_funcs mes_v11_0_funcs = { .misc_op = mes_v11_0_misc_op, }; -static void mes_v11_0_free_microcode(struct amdgpu_device *adev, - enum admgpu_mes_pipe pipe) -{ - release_firmware(adev->mes.fw[pipe]); - adev->mes.fw[pipe] = NULL; -} - static int mes_v11_0_allocate_ucode_buffer(struct amdgpu_device *adev, enum admgpu_mes_pipe pipe) { @@ -1069,8 +1062,7 @@ static int mes_v11_0_sw_fini(void *handle) amdgpu_bo_free_kernel(&adev->mes.eop_gpu_obj[pipe], &adev->mes.eop_gpu_addr[pipe], NULL); - - mes_v11_0_free_microcode(adev, pipe); + amdgpu_ucode_release(adev->mes.fw[pipe]); } amdgpu_bo_free_kernel(&adev->gfx.kiq.ring.mqd_obj, From patchwork Wed Jan 4 16:40:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C8448C4332F for ; Wed, 4 Jan 2023 16:43:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0824A10E536; Wed, 4 Jan 2023 16:43:08 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2079.outbound.protection.outlook.com [40.107.244.79]) by gabe.freedesktop.org (Postfix) with ESMTPS id 493D810E536; Wed, 4 Jan 2023 16:43:06 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LbPOwfeG3M8LLYzwogcJaDPqiXkwWEevg4W2RLqQAXFBPwmYu6keQBkuiJa1LVAFVHRA6ZI2iXOmebRq+t55ULs9NK13iqjIv8X3akSwo9tnC2jzKywGMq+YZC444P8jMIr3Oh8aKw3L5R4YFYoQCeAI8fEPPy0EjpKHPikY7o4Qbt3gB/p97DywklCNsUAkxJphJl3ua/IyR/UEWNKWWkFTAAnAliiMhOXR+sSc+gDGuXJUtqL252VN261jcKwNU/HQBTDXCrlolwIAgljOeoYU3avtY7ls5UJ34vdD02ySYTHjb7k+bEp4N/egUcy2WkZIO2jUw9ygXxT+SiDmkA== 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=ElAv01ZLm8lyvFBhjcrt9T+FkCKdVDpIZNwqkK3sGq0=; b=KRnytCehJ7ae3DY0Zknyhy+/hi17DsR4Q4gpvMJrmPeAtL7qs0xDEIb/UfqOBXpS5O/UmlencvkAI8pTHRZqU0yFudiexBXjCf1PIPfRv4fTBn4TMBR68AY+2mvR5YtkC6BjworuAm5E8Q6/fxn4rTb8GFWVFl3yMmHxu1HhQBakPSfsGtkN3ldokmFSeaHZZWxC5qjB1421bCAhZ2wDZERDB/tTIVCZXndTl+pQP1fxUXl5dR9G++klXiAuSL5ZSrPU4pgP0znrSB9LB8l9ge+qjHUlVh613LK1vijhIgMUDz9wCUbq9tiFUqc+nSJDu5JGHLIaMTWFCvVPp4m6iA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ElAv01ZLm8lyvFBhjcrt9T+FkCKdVDpIZNwqkK3sGq0=; b=EXbkIUSByHrWzqhNwzOadBdBLdnCFgLVpQpU4hJm6Koxb39vudjp+WB283TWFVRkGJHt5YMjU3ap5atGesB7al1k7CtDuibP6w7u0B8+n1tn6Mdlt7hGTMl9I+S47djgpCIsdbgq1N44XaWOFEbbou9jh1DDHvq6PHFV1jtHJ+4= Received: from BN9PR03CA0609.namprd03.prod.outlook.com (2603:10b6:408:106::14) by DM4PR12MB6207.namprd12.prod.outlook.com (2603:10b6:8:a6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:43:05 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::22) by BN9PR03CA0609.outlook.office365.com (2603:10b6:408:106::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:43:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:43:04 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:42:53 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 13/45] drm/amd: Remove superfluous assignment for `adev->mes.adev` Date: Wed, 4 Jan 2023 10:40:02 -0600 Message-ID: <20230104164042.30271-14-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|DM4PR12MB6207:EE_ X-MS-Office365-Filtering-Correlation-Id: f4665c7c-300e-45ac-ec6a-08daee72c06c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: otg5RUKEGq6CPckDiy75X9eyxfdum2x6h4IAfLdsZJot2Dt8PZHIwhAezE6yRJPnTlS2L/IE+ITrh+1zS4gByJOWqg3jafflohpoaVUkioHCFzynLrLBNhpWL9qXPtCCXC21INFNd2bHv2JBPtcllOr+/+HZDqUR6HXJJyZBw0uV4IvUUjizvUZQfCezyt3QATTXxqICKSLz7OO53KxSiaOVgwQZkJy0D12TPSApWMR0iRWYHDax9hXyXT3sbEmGu0u5D06s4EzQeweb8AD8wlORV6qCC1+lALq4LrQTWDGOHB35BgwLtaf4DlJJL21cG3j5J8aykocOVihTZPa59jKhnbYm4dizL9JLxtbvro3veX2ANDpdtU6A6TZOrhHnrZjF4NeK9wj+61ADwQCMIVTw1CyciqThHp0WiUXKdw9iTwtex2/Obycof0bG31flq0I97wmKFwXmG7xJNk9SnwKtFd3ncTHYsRpRfJHPCiudRg4/1KkVos3G8/Re5Q3T9F0yKxxCNuIG8yckdJnBWiFHirSvNFeGeuIsfCmkz4Yl7BLJN5zTjbjlvBG6Gi+f1+yqeg+wHz5nixQcfuH4PjpfSfSUs6Ckm9FlFl6wPovEvaDa/1c8zPuonM60rs7SdIZsZ0+L1HSLnuheMfWEx1ibV/NFkInatNwsiqhS3EvC9MVE9TGufAMApwsc0/gha6Vazl+/6tJYEOcV1bZriRMTHLl/yvO50sI4J2cz9x2Sr7bsO+5p4WvvjnrPNW9Hjt7ieh9cwAKzQ3vuTXkILw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(346002)(396003)(39860400002)(136003)(451199015)(40470700004)(36840700001)(46966006)(47076005)(36860700001)(2616005)(83380400001)(336012)(426003)(2906002)(40480700001)(1076003)(86362001)(40460700003)(82310400005)(36756003)(356005)(82740400003)(81166007)(70586007)(44832011)(316002)(54906003)(110136005)(41300700001)(70206006)(8676002)(8936002)(5660300002)(4326008)(186003)(26005)(478600001)(6666004)(16526019)(7696005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:43:04.7924 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f4665c7c-300e-45ac-ec6a-08daee72c06c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6207 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" `amdgpu_mes_init` already sets `adev->mes.adev`, so there is no need to also set it in the IP specific versions. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 1 - drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c index a2c96a86538c..76151dddf0a9 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c @@ -924,7 +924,6 @@ static int mes_v10_1_sw_init(void *handle) struct amdgpu_device *adev = (struct amdgpu_device *)handle; int pipe, r; - adev->mes.adev = adev; adev->mes.funcs = &mes_v10_1_funcs; adev->mes.kiq_hw_init = &mes_v10_1_kiq_hw_init; diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c index 4dab62335d0d..824af819f447 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c @@ -1013,7 +1013,6 @@ static int mes_v11_0_sw_init(void *handle) struct amdgpu_device *adev = (struct amdgpu_device *)handle; int pipe, r; - adev->mes.adev = adev; adev->mes.funcs = &mes_v11_0_funcs; adev->mes.kiq_hw_init = &mes_v11_0_kiq_hw_init; adev->mes.kiq_hw_fini = &mes_v11_0_kiq_hw_fini; From patchwork Wed Jan 4 16:40:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088749 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 91B3FC54EBF for ; Wed, 4 Jan 2023 16:43:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1A3DE10E551; Wed, 4 Jan 2023 16:43:14 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2041.outbound.protection.outlook.com [40.107.223.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8588F10E53E; Wed, 4 Jan 2023 16:43:09 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JG7u5tAS1F3NsVtOSgr4ywfKOpMxSnrGa0X9twgXs2FpQrVZR+8DwjtjvFuQk4FCniaObPd0xc1EgZHCF5GAGHjuwUisiRDFWDuVxx2/GpQUriamfv60JzmslHJDoa48jbAySEooUePSBWg6MwD+f3YiQbwGvp/cNgpchEfyKeSODfsVWvfZ+JcRJfwpdb4TJUUGD4JdWugtt+2v6AFosEBQoRIrHkyggqXeqn4nK5+7XZd4T5QN/iNjbaY1aHsdtWLxDJM6ir2rDwLobvTAkJS5yyE33O/dsrSg9s7J/Gom03ENX4ZIrL2SW5ar9BBg7clSUQC9F9ShacprJLLMwQ== 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=c5tZzvWFUFU9Jcg17/eLNItQmoD+0xjyJ1Jwtysv6Uc=; b=ORLO9/FoT+4+711XohhtSUdbAix02UrRbBSJyWA7J862+QN906qvB4xJ9LYkjuJhHSqf5i0cRMB651o5kCjQVV2hUoDTh8X219W+D0D+mKOjmKmhGG68Pp3KPZ0h/kDWEdURxEbH8/nQci/a/R04MjnRiNio9hU1OfcR/uzs6w8PjIzZitRF/YRdTP77QOkN2TB1TJiV47fcY3Dr47BJYJlIl5L6dbjYlKsQHFYu9lFO5yLrzqPb0EPO0Jnw+U2aq+PaQgwBbNZBRLvWB3FAK+g9nANi7R389ZW2cKfwD3AUMsqYs9qQtTPfZ9h93NXydbpz3+IT8GbnSH56dJdFAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c5tZzvWFUFU9Jcg17/eLNItQmoD+0xjyJ1Jwtysv6Uc=; b=v82tAkQnmjSuB2yjo55kCHAmFihz5f2kd/RgJA380sQ2wzHTSQEgTVHroomBxViPJEZzXKDZ0V8xfXWbyxxx8M5PRpWXua/4MK7C7MR+JsUgVR+eurin1R7JF3C5dzMyXAklGKw1Jt2Wg9bfZdsFX2IZoqOauq0x5oeKx9dQ3V4= Received: from BN9PR03CA0604.namprd03.prod.outlook.com (2603:10b6:408:106::9) by IA1PR12MB6211.namprd12.prod.outlook.com (2603:10b6:208:3e5::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:43:06 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::3f) by BN9PR03CA0604.outlook.office365.com (2603:10b6:408:106::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:43:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:43:06 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:42:54 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 14/45] drm/amd: Use `amdgpu_ucode_*` helpers for GFX9 Date: Wed, 4 Jan 2023 10:40:03 -0600 Message-ID: <20230104164042.30271-15-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|IA1PR12MB6211:EE_ X-MS-Office365-Filtering-Correlation-Id: 32da0e1b-84d4-4ae6-1e3a-08daee72c141 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yjgLU9IB8UrSZdUFn6Uu+LT96usstVjl+UCxvvpYfJUT2+aKFIQbgMniYFMKjlg8vYt7YrWDBN2YVfBn7EpHrsAk6idvj3tM+pcmNWD79Re1jQ/PwByA5apcHWOghqxiRsaL8rletOqq0BYBv9cOTEkU+3zgCtBEgefr6TxR560zCXeKpBryn6IFGZ51WDO+lAhc/tJzkctGUxni5OdCgLvqGNgRTwUpQwYbFLrbX2FsI+CEjjU5kGLO4N1qQXkqmKCSqxdvKM6AR+MeTNlG+fbxwRcP6tH4nVYHkk7ctj2Ts6Og6VPxw3t4ktX9bM1LvnsfneQHbF7V9lNXsuWZ2TeATEfmNFz4CF75zIEqBJ+ElkuGM2vWXUniBkx71Dlg8/9Sz3KIV+iGq1amARvAnw6Lj1XSC3hDO5aaVnyD/QAQDaHvMppxzeGogLcUcdugQXA4srGq2Jb+N44u2famA+CQ+MyE+fG+GesmQOXgVJOaxCZe8eZDeNIb4Og+b4SgA2K/fEhivYnpIg3uVldX2bzZkfhRmVoJAS5EQKrcDLQst2uT4O8A9yc6CSrlxhHWMjW+1Jbq5jZdsJallS8oHtD0oODVDAsRtlHtt0Xw403OTunASI07hKOLeyVXkLM+x8yPhWSTi18o0WFyagHrajtsWd2nP6RnL+VmVAmX9kzvVzxmRFUgP7IxHc7uI2mHBXNvmyRbSwZj5h8XgY4pA1W4IVy+2kDyklsMyvqYsMEV65ZyUnZcWgPKojBfxrjjCS4S23772Rn3jLxgWJCJAQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(136003)(39860400002)(376002)(346002)(396003)(451199015)(46966006)(40470700004)(36840700001)(54906003)(26005)(186003)(478600001)(110136005)(1076003)(6666004)(2616005)(316002)(70206006)(70586007)(16526019)(4326008)(336012)(426003)(8936002)(5660300002)(83380400001)(44832011)(47076005)(41300700001)(2906002)(8676002)(36860700001)(82740400003)(40480700001)(356005)(81166007)(40460700003)(86362001)(7696005)(36756003)(82310400005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:43:06.1674 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 32da0e1b-84d4-4ae6-1e3a-08daee72c141 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6211 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper will provide symmetry on unload. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 82 +++++++-------------------- 1 file changed, 21 insertions(+), 61 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index f202b45c413c..3ae46eab693c 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c @@ -1078,18 +1078,12 @@ static int gfx_v9_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) static void gfx_v9_0_free_microcode(struct amdgpu_device *adev) { - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; - release_firmware(adev->gfx.mec2_fw); - adev->gfx.mec2_fw = NULL; + amdgpu_ucode_release(adev->gfx.pfp_fw); + amdgpu_ucode_release(adev->gfx.me_fw); + amdgpu_ucode_release(adev->gfx.ce_fw); + amdgpu_ucode_release(adev->gfx.rlc_fw); + amdgpu_ucode_release(adev->gfx.mec_fw); + amdgpu_ucode_release(adev->gfx.mec2_fw); kfree(adev->gfx.rlc.register_list_format); } @@ -1257,43 +1251,28 @@ static int gfx_v9_0_init_cp_gfx_microcode(struct amdgpu_device *adev, int err; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name); - err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.pfp_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_PFP); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name); - err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.me_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_ME); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name); - err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.ce_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_CE); out: if (err) { - dev_err(adev->dev, - "gfx9: Failed to init firmware \"%s\"\n", - fw_name); - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; + amdgpu_ucode_release(adev->gfx.pfp_fw); + amdgpu_ucode_release(adev->gfx.me_fw); + amdgpu_ucode_release(adev->gfx.ce_fw); } return err; } @@ -1328,10 +1307,7 @@ static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev, snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_kicker_rlc.bin", chip_name); else snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); - err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.rlc_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name); if (err) goto out; rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data; @@ -1340,13 +1316,9 @@ static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev, version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor); err = amdgpu_gfx_rlc_init_microcode(adev, version_major, version_minor); out: - if (err) { - dev_err(adev->dev, - "gfx9: Failed to init firmware \"%s\"\n", - fw_name); - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; - } + if (err) + amdgpu_ucode_release(adev->gfx.rlc_fw); + return err; } @@ -1371,12 +1343,9 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev, else snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name); - err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name); if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.mec_fw); - if (err) - goto out; + return err; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1); amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1_JT); @@ -1386,11 +1355,8 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev, else snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name); - err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name); if (!err) { - err = amdgpu_ucode_validate(adev->gfx.mec2_fw); - if (err) - goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2); amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2_JT); } else { @@ -1402,17 +1368,11 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev, adev->gfx.mec2_feature_version = adev->gfx.mec_feature_version; } -out: gfx_v9_0_check_if_need_gfxoff(adev); gfx_v9_0_check_fw_write_wait(adev); if (err) { - dev_err(adev->dev, - "gfx9: Failed to init firmware \"%s\"\n", - fw_name); - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; - release_firmware(adev->gfx.mec2_fw); - adev->gfx.mec2_fw = NULL; + amdgpu_ucode_release(adev->gfx.mec_fw); + amdgpu_ucode_release(adev->gfx.mec2_fw); } return err; } From patchwork Wed Jan 4 16:40:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088746 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA2C8C4332F for ; Wed, 4 Jan 2023 16:43:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 46DAA10E53E; Wed, 4 Jan 2023 16:43:13 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2069.outbound.protection.outlook.com [40.107.244.69]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5224610E53E; Wed, 4 Jan 2023 16:43:08 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ilsBxoaeuWgTe+aLmF389P0k06mxyD71iz28ueaURldmYGjRzbyyHh6juMR3HrkMwSp092h8JGiyemiTo3rRQtUme7NtPEQAGCl6XpDa+RZtoKVkTjDsbBNhyQbMGTyk5dZq+QqWGwpCpnD8wYcDr3IFYAriJfdw6nlASmTCbHYiuwAlpzQhMClUQ582/TSNzUBGWNHla9MK/T9Iwtkm6JUnD+qQFAp4NUpscF2jKG1q2i7jP/dFjwcXyu2zNX2YaBcbE5wlw7qySj/pVbXGliLQ00hdwWSfHbZYw/Sp1NSeIb/HzNuV4t5uQUfy4dQfjed6w14nNtf2gwxMXyGdJA== 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=bDQp7cpzblYgBjxCZ3eSdC+VMwONegYXTSs+j7j+GkM=; b=cEB2sgtK0CHG0rBTaDetgr8dTNfsaC7YsGJKPaRDr03hf2cStbEig/nxCIgt3/Q6PNNZJRr/zNTD8GoTJRJevTnCRmQe0kiR2QWPs2Nca9tA1Au5ntVUSXYtT1xcETF+pG4WXiF9SEeAoPp9qJt1d6cWBdvP3xnyeQrokb+mJgpi8uOAb8N6Vl3GIuJgAikD+1WHuDe5gIfLXE3vcHKB0w72Yo6OwkoYEkle/+6ffbKGJJOpl7LA0vYRWXW2xZB6yBTsQT3aAH3o9qu4tzWiMbwCHw1uKgkqR2enBilUizLVV7FyLMqW4kGItzFshfeMdy4AfNIOcw6ED6CLpI3Q8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bDQp7cpzblYgBjxCZ3eSdC+VMwONegYXTSs+j7j+GkM=; b=MzavJjC1xGYqi8CXUCHE6DSjRi3xgiBRy4ocOjnY0lqBAd7PxnKRqPb7C9Z+bU0Cu/uDp6KmT52pLQchwyhAzZ6HOIJF11zDuhopJhWvi/Y+XKy5SqDqWKGaHC1wW0GfYrp4cHcGOJNhTK/WQ1FMRg9RiIHr+yc/hX9KsxQWq1c= Received: from BN9PR03CA0625.namprd03.prod.outlook.com (2603:10b6:408:106::30) by MW6PR12MB7086.namprd12.prod.outlook.com (2603:10b6:303:238::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:43:06 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::a) by BN9PR03CA0625.outlook.office365.com (2603:10b6:408:106::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:43:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:43:06 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:42:55 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 15/45] drm/amd: Load GFX9 microcode during early_init Date: Wed, 4 Jan 2023 10:40:04 -0600 Message-ID: <20230104164042.30271-16-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|MW6PR12MB7086:EE_ X-MS-Office365-Filtering-Correlation-Id: 66554eff-e38e-44d1-1e3a-08daee72c141 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: D1TdDAOE8RM4IlrjWgRUc1HgtXf4H+/nii9YdUOgEJiQ8CL47yqSWDb6k7nsJP4AWuRA7hy8j4WNbHaBzTqUfyrBFOG27JgzUJE6gZYGWrO+k2wcmrTNUpCtNKjdLmidvv50JP/FX3vrY9sZ4hhK/EuqNGkIaTz3CKSNaZROaOOSrim2aHHmPWbTy+b6PQZo3kBn3n+5aJVp9JOGO9xtcy8e5cGoP6DgR07unJO9rLr7qGSaEDRct5NCijdW5EPdOTczZVLAWqPl5+ChJ+uDjqUJxm6JvSG2jhd5/7sd3y8ej70UKEIpIac3erejrGzybRRX07mp5bXAgb/kPYKD2jdxWx0zfIKh6GORYPeEbDMKQJuomPy1E6xq0ceazlaNp3kojpUDIWSXLWYEq71EV5lUcDCpCWin+MscuGZu3CQvVJ0ZUoqMTo1zfRjs55ufXWWIv6X+zXXZWIi6v/CtK/phf5pkTby4ctZSRNXRDEPGsmJ9T8+2gpp30++VR2oIw9F/wns0sSGCvZG3oa0VPGp34W04a5yhTlWyOlofLQixKbYOJQx9o3d8lESTMmIGh5q1Jc5KAB7VvhSGTD91cWD+TMcR4yrN2JpuUnoAO9FKRBLBGgl2noV2g3wgOLr5/BKfrPeZuFwPIQ1yJOgdN3n84GuyUFyJe6JboMj5R1TMcnR39Dg+qEZgUoaZw1/tq1VIFgL0pXyEEomDL9PW/LMVMsmwRozQ90GLFWQy1sI= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(136003)(39860400002)(396003)(346002)(451199015)(46966006)(36840700001)(40470700004)(47076005)(426003)(186003)(16526019)(1076003)(26005)(2616005)(81166007)(336012)(82740400003)(356005)(83380400001)(86362001)(82310400005)(36756003)(36860700001)(44832011)(40480700001)(316002)(41300700001)(8936002)(8676002)(5660300002)(4326008)(40460700003)(70206006)(6666004)(70586007)(478600001)(7696005)(110136005)(54906003)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:43:06.1830 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66554eff-e38e-44d1-1e3a-08daee72c141 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB7086 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If GFX9 microcode is required but not available during early init, the firmware framebuffer will have already been released and the screen will freeze. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 58 +++++---------------------- 1 file changed, 9 insertions(+), 49 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index 3ae46eab693c..f0c948f11213 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c @@ -1245,7 +1245,7 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev) } static int gfx_v9_0_init_cp_gfx_microcode(struct amdgpu_device *adev, - const char *chip_name) + char *chip_name) { char fw_name[30]; int err; @@ -1278,7 +1278,7 @@ static int gfx_v9_0_init_cp_gfx_microcode(struct amdgpu_device *adev, } static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev, - const char *chip_name) + char *chip_name) { char fw_name[30]; int err; @@ -1333,7 +1333,7 @@ static bool gfx_v9_0_load_mec2_fw_bin_support(struct amdgpu_device *adev) } static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev, - const char *chip_name) + char *chip_name) { char fw_name[30]; int err; @@ -1379,58 +1379,24 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev, static int gfx_v9_0_init_microcode(struct amdgpu_device *adev) { - const char *chip_name; + char ucode_prefix[30]; int r; DRM_DEBUG("\n"); - - switch (adev->ip_versions[GC_HWIP][0]) { - case IP_VERSION(9, 0, 1): - chip_name = "vega10"; - break; - case IP_VERSION(9, 2, 1): - chip_name = "vega12"; - break; - case IP_VERSION(9, 4, 0): - chip_name = "vega20"; - break; - case IP_VERSION(9, 2, 2): - case IP_VERSION(9, 1, 0): - if (adev->apu_flags & AMD_APU_IS_RAVEN2) - chip_name = "raven2"; - else if (adev->apu_flags & AMD_APU_IS_PICASSO) - chip_name = "picasso"; - else - chip_name = "raven"; - break; - case IP_VERSION(9, 4, 1): - chip_name = "arcturus"; - break; - case IP_VERSION(9, 3, 0): - if (adev->apu_flags & AMD_APU_IS_RENOIR) - chip_name = "renoir"; - else - chip_name = "green_sardine"; - break; - case IP_VERSION(9, 4, 2): - chip_name = "aldebaran"; - break; - default: - BUG(); - } + amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix)); /* No CPG in Arcturus */ if (adev->gfx.num_gfx_rings) { - r = gfx_v9_0_init_cp_gfx_microcode(adev, chip_name); + r = gfx_v9_0_init_cp_gfx_microcode(adev, ucode_prefix); if (r) return r; } - r = gfx_v9_0_init_rlc_microcode(adev, chip_name); + r = gfx_v9_0_init_rlc_microcode(adev, ucode_prefix); if (r) return r; - r = gfx_v9_0_init_cp_compute_microcode(adev, chip_name); + r = gfx_v9_0_init_cp_compute_microcode(adev, ucode_prefix); if (r) return r; @@ -2118,12 +2084,6 @@ static int gfx_v9_0_sw_init(void *handle) adev->gfx.gfx_current_status = AMDGPU_GFX_NORMAL_MODE; - r = gfx_v9_0_init_microcode(adev); - if (r) { - DRM_ERROR("Failed to load gfx firmware!\n"); - return r; - } - if (adev->gfx.rlc.funcs) { if (adev->gfx.rlc.funcs->init) { r = adev->gfx.rlc.funcs->init(adev); @@ -4565,7 +4525,7 @@ static int gfx_v9_0_early_init(void *handle) /* init rlcg reg access ctrl */ gfx_v9_0_init_rlcg_reg_access_ctrl(adev); - return 0; + return gfx_v9_0_init_microcode(adev); } static int gfx_v9_0_ecc_late_init(void *handle) From patchwork Wed Jan 4 16:40:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6953BC4708D for ; Wed, 4 Jan 2023 16:43:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 57AA610E579; Wed, 4 Jan 2023 16:43:28 +0000 (UTC) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2048.outbound.protection.outlook.com [40.107.96.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id AF1F110E550; Wed, 4 Jan 2023 16:43:11 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HL+qI/Abw4WTDLPMwCXkrtadSyPROlCwHoWuxJrWiljSLR7/j31cQ8n/iCfkpBnXpbMb3u7w+H8xsvw6OkXoDGia+vPTblmpLvGBRaksTWhwdKAkI4tMOHzKvDjEtbAUuVfLfxQatCwRyoH+Ua7kyr2RqBnPd2DWfkkLT+mQPXVe2fD5xZ3jedPdeo1bLZ6t+c8/emBgI4YC1ZKUoToOXs9DT/Cr5I0jxJ3xOUVTHHTlf3dNihFgzGVRU7n8QVU22fsUbTAmEuisFq+AkAW8o6pn5InnV3t3FsEG8/H7BNtMfrsGLO//96MXJxBpwMoAdu37pXoHp0ZwUCb2uZaFmA== 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=0Db3pbPE4ZeneeyrhNVpYik7H8B7cgj6jDm6G29G7Qc=; b=JRHTFmdz2ddRFjQxwMv0NrweJ/Tf3lLGhE8exRFROhgIHkUe/2hssuNZXvLhhu1DzvH8LSmPJpFNnpK7RaCZNWmivZxRpvrwfKCBIwmsC0JRM++9bBBdt5tHubjOLvZExUnajA4WJfvakqbARbo2nSLKPgjt5B0DoNbnVHmvFHZmSVs14gZI+HKEb89kT15szD2RTKaedNRrZEjxoqppVOdeCDMNatdyKUs7X5nQS71t6CNoivcNnlvt5iUTiX/Szc+LncFcIGPtLZojGOwLWZpJ1R0SYiR7cE9+OlaEi2sfwU2VkCinjB7T3ICveqRwn4YcZ6WEi80YLeCag56Qaw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0Db3pbPE4ZeneeyrhNVpYik7H8B7cgj6jDm6G29G7Qc=; b=TBsNdwaHVIsRNqHVbGzTevajrTRf1LlNGjt5m+Kpgwjo5vspU1QbQzeiNSnPZnUTfOV2gvu+pw21x0juDtA/OnE8yCfrWoG7bwJwchlb2VZJOBgMmcyIrXzXcT6j5UG5HjO16tnKpt7cPg1yie1TNCwch0p93QB4EV2UNkbVT3M= Received: from BN9PR03CA0604.namprd03.prod.outlook.com (2603:10b6:408:106::9) by SA3PR12MB7998.namprd12.prod.outlook.com (2603:10b6:806:320::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:43:06 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::76) by BN9PR03CA0604.outlook.office365.com (2603:10b6:408:106::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:43:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:43:06 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:42:56 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 16/45] drm/amd: Use `amdgpu_ucode_*` helpers for GFX10 Date: Wed, 4 Jan 2023 10:40:05 -0600 Message-ID: <20230104164042.30271-17-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|SA3PR12MB7998:EE_ X-MS-Office365-Filtering-Correlation-Id: 1b6cd410-41d3-482a-f331-08daee72c196 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: akCgCJLMbAZ/xum5dY994xfP+TBUcruhsJ2oYXLUDF/HEL0LWH/53D0UNN+knp3yckBh1OqQMp0N928kV0uNaGW8ui7G+B2VUBcl+jGnyi9B8ISfmlgCHEDnZKsUmYDYHFNhB+Ui7fCBngglVlmnXO1FUj+ZegSmXm8/RbO1UA9Zw7JcvgHedpD5ZFFEyCbs9BCFIh+30D/WbaqXSIiR2rpxVFN2Iuq+Hi6ey/BYkoNkzYzbSPrFcMWreNpvywscvGZEUEQXYVzR+7M1CKRlRQow9oebQMcgXu6Capn9kAdMnC2b8sqWhzC2SxFrsW0LqC5kdH08qml3KehnddD60Qz/3qHNOqi/bsWiEjWZEwQ7WFb/IJFj3Je1/q8+Ql3x/hhs4RNGDXekUNv5Qlb8PEDcjfXX31zWb+l8NN5neoSAtmJWi/4gR5Ty5Eu2mXLdOaaUQFGVEVe+MuhtZBlNKn6KGtuojeps/OZucbxW5OMbBy3l5g+UALMoiUhFSHdQXQPUj4oKGxqRc044IGilcZPI3xPU47kRIgwmXDMDrerL9JxlrP7QXGHQSIwqqZgdKSeZsuLLj2hRIENQI0jRZF5o+z+TpSg7KE0R3NDTaKL1YVOUGsag3vNShhDiiG3kmxpDJkyy261jgqUBCTZ75YUv1qUUsBsy3X/cB1l0ZX/optc/DLP9T2BC4+4YmyHd5fneNT9RQ46R1sgesPHUH1TI/vVmowHNY555EcFiTFm2cSgRw3nRSiMhfAkph3Pwtn3hbTHVMRbqnc2PsMejXQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(39860400002)(136003)(376002)(396003)(451199015)(40470700004)(36840700001)(46966006)(47076005)(426003)(336012)(26005)(16526019)(2616005)(1076003)(186003)(82310400005)(40480700001)(6666004)(83380400001)(7696005)(86362001)(36860700001)(36756003)(40460700003)(81166007)(82740400003)(356005)(8676002)(4326008)(41300700001)(2906002)(5660300002)(8936002)(44832011)(478600001)(110136005)(70206006)(316002)(54906003)(70586007)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:43:06.5736 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1b6cd410-41d3-482a-f331-08daee72c196 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7998 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unload. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 71 ++++++++------------------ 1 file changed, 20 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index 49d34c7bbf20..d36dd823a319 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -3891,18 +3891,12 @@ static int gfx_v10_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) static void gfx_v10_0_free_microcode(struct amdgpu_device *adev) { - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; - release_firmware(adev->gfx.mec2_fw); - adev->gfx.mec2_fw = NULL; + amdgpu_ucode_release(adev->gfx.pfp_fw); + amdgpu_ucode_release(adev->gfx.me_fw); + amdgpu_ucode_release(adev->gfx.ce_fw); + amdgpu_ucode_release(adev->gfx.rlc_fw); + amdgpu_ucode_release(adev->gfx.mec_fw); + amdgpu_ucode_release(adev->gfx.mec2_fw); kfree(adev->gfx.rlc.register_list_format); } @@ -4030,41 +4024,31 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp%s.bin", chip_name, wks); - err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.pfp_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_PFP); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me%s.bin", chip_name, wks); - err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.me_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_ME); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce%s.bin", chip_name, wks); - err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.ce_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_CE); if (!amdgpu_sriov_vf(adev)) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); - err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); - if (err) - goto out; + err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name); /* don't check this. There are apparently firmwares in the wild with * incorrect size in the header */ - err = amdgpu_ucode_validate(adev->gfx.rlc_fw); + if (err == -ENODEV) + goto out; if (err) dev_dbg(adev->dev, "gfx10: amdgpu_ucode_validate() failed \"%s\"\n", @@ -4078,21 +4062,15 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec%s.bin", chip_name, wks); - err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.mec_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1); amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1_JT); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2%s.bin", chip_name, wks); - err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name); if (!err) { - err = amdgpu_ucode_validate(adev->gfx.mec2_fw); - if (err) - goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2); amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2_JT); } else { @@ -4103,21 +4081,12 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) gfx_v10_0_check_fw_write_wait(adev); out: if (err) { - dev_err(adev->dev, - "gfx10: Failed to init firmware \"%s\"\n", - fw_name); - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; - release_firmware(adev->gfx.mec2_fw); - adev->gfx.mec2_fw = NULL; + amdgpu_ucode_release(adev->gfx.pfp_fw); + amdgpu_ucode_release(adev->gfx.me_fw); + amdgpu_ucode_release(adev->gfx.ce_fw); + amdgpu_ucode_release(adev->gfx.rlc_fw); + amdgpu_ucode_release(adev->gfx.mec_fw); + amdgpu_ucode_release(adev->gfx.mec2_fw); } gfx_v10_0_check_gfxoff_flag(adev); From patchwork Wed Jan 4 16:40:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088747 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35F45C4332F for ; Wed, 4 Jan 2023 16:43:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4291810E554; Wed, 4 Jan 2023 16:43:14 +0000 (UTC) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2088.outbound.protection.outlook.com [40.107.212.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id F021410E550; Wed, 4 Jan 2023 16:43:09 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VqavuAJmyGsgJAb5Oyb7uun9CUx9y5r7Psb+hJkvJ1nHKIuFZOr+CqnTJ3iZaeq0scPltKzF1CBs0Hi1mDF9uFHzR4Lzs+JOR2/5KGd5ytcF9rvVX+2tzC3AwcO4l/lCon3IuTEspvA1BdFY9DbVp2ZRSORhswyIvhmcgWkR9PJOZtLy1r61sADDwxlwrlCmwqfCpmq+Z6mi47FVmFCf9ldLsdWmiU4Ixv9TRe15Snbjn2FnDs7ZGtP6puNhmmrLrno3kSupkQpGbbaIYdbbl/BOL8OytJTA1t02pF05aolUUzy6IS5jpzHWzbUalmDjMs54qo4Zcm7/2DStxPHpuQ== 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=2TD8MMOvWypqmaW205Y7oBJdV8zNA4RizmWVOnY1S6c=; b=fL0Ayryaer0SDNOTBnQV7VvohA+5l2Qr0rJR1uEzZ4UTgpU7U471734jDh7V05goUs95dsea2q9GLMuMYeTHxUqJNR+8rYMR/13wt97SDU1dBjZYdXSVcuOu0fHAlKIfXgaaSYkE1Mu3sohwCeO+xWJzNyEF6su6NowpzRcVGTvZL2fpmI4dwQprqs0Ih9YPT34vRTNc/BTZasIi4zvjizHI3ElI64tykgV95a1qOPO180rvJD6nbxacSKpdGzDh0DJ7fxyQ2DUUfarMIZgEqJ1CFRlbGcRFHCj7V79hhFom65h/9SORHwhSVtZUzzGdgHvoj2PAhSIuZLVBhl8JyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2TD8MMOvWypqmaW205Y7oBJdV8zNA4RizmWVOnY1S6c=; b=ShUrsxiBCx3glKz9+0Zwi85hgFwCEhOYCn3f1ynSNkyWjn0r59nEff4UneN8qqW/qxXNqAbgykJ+lYaGFmTEfIa/bh2064NASzH0LlKPYgdTdkKh7zo+2bLxivsBe6aPg5on4CKWJBCzgz1vYUd4LvpVc6dwqSoqQfwgSs8Pp/Q= Received: from BN9PR03CA0626.namprd03.prod.outlook.com (2603:10b6:408:106::31) by PH0PR12MB5630.namprd12.prod.outlook.com (2603:10b6:510:146::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:43:07 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::13) by BN9PR03CA0626.outlook.office365.com (2603:10b6:408:106::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Wed, 4 Jan 2023 16:43:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:43:06 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:42:57 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 17/45] drm/amd: Load GFX10 microcode during early_init Date: Wed, 4 Jan 2023 10:40:06 -0600 Message-ID: <20230104164042.30271-18-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|PH0PR12MB5630:EE_ X-MS-Office365-Filtering-Correlation-Id: 9946da09-c3b6-48e7-2d0e-08daee72c1b1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 20jcFH2Qs5P3TuhjSa6Zuk6yYIQeTF8zH4N/sKSVv8CCb7pkC7VyEZ15Vo2CX9x7+cN7PWJ/3oVDRNt2p2FDqmojPorF4mXDMaBPxISaKPZxkiat/rUvN+hB74V2a8QQ/HTVoC8Z9DLC97QeBtBItQZzvAoy3KoSXcE1JywH0NmSCF7m0H7ZNueBFWjGYHeuLVBBuGO8GymXvcfiM9+XM8L09qffs1oW9moVVvm2+Bl+JCrlcLDkwkf5yLG9yzvkRwePieNXBhiBOhAk2ciXI7LWEZnULfRi6Its45x5GdfEQLizWs21qiv4kCCr14ft5vRhZsTbggy40InUqTcPeH3uyOV4HU675hmfxFZ83XNFHpY3BB74ERRoAoVFro6SynlMXOXNIqsOtoMxer4Piy5UI4f1g4+l6Vb4MZ38kVGXdfc9u23uTi7Kt3BEFjEYJ6XDGIieSMbPmUGR/4rNiPJGTphRqCfhwjGC547GQFaJLPldNLLYfcqOD8igVD4rHaTs1yp/q7ONPTmpBaGRJaRnYdoEMlFUUSyLvCA1F16ftmpczkgA1ffII0qv05jhmNDZLYwWAD1gq/1L5SoUUeDHUTOGDW1u7jE8HFxRQpEomKwkqsHGFoXW2qZSAE2DlpiJUACOhWkEWVfdx2bran2HGEn6GiTc0oJQ3fro3TABe6bKQpzj1qovLvLr/fxc/R43rlXVSbiMj/vkGG0KQil/pcYKVKGjX7Xf0+IPgvA= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(136003)(346002)(39860400002)(376002)(396003)(451199015)(40470700004)(36840700001)(46966006)(356005)(316002)(44832011)(7696005)(1076003)(2616005)(54906003)(186003)(16526019)(26005)(40480700001)(478600001)(426003)(6666004)(47076005)(36756003)(40460700003)(2906002)(110136005)(83380400001)(336012)(82740400003)(82310400005)(41300700001)(81166007)(86362001)(5660300002)(36860700001)(70206006)(70586007)(8676002)(4326008)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:43:06.9174 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9946da09-c3b6-48e7-2d0e-08daee72c1b1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5630 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Simplifies the code so that GFX10 will get the firmware name from `amdgpu_ucode_ip_version_decode` and then use this filename to load microcode as part of the early_init process. Any failures will cause the driver to fail to probe before the firmware framebuffer has been removed. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 84 ++++++-------------------- 1 file changed, 18 insertions(+), 66 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index d36dd823a319..585b301856d7 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -3968,9 +3968,9 @@ static void gfx_v10_0_check_gfxoff_flag(struct amdgpu_device *adev) static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) { - const char *chip_name; char fw_name[40]; - char *wks = ""; + char ucode_prefix[30]; + const char *wks = ""; int err; const struct rlc_firmware_header_v2_0 *rlc_hdr; uint16_t version_major; @@ -3978,71 +3978,31 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) DRM_DEBUG("\n"); - switch (adev->ip_versions[GC_HWIP][0]) { - case IP_VERSION(10, 1, 10): - chip_name = "navi10"; - break; - case IP_VERSION(10, 1, 1): - chip_name = "navi14"; - if (!(adev->pdev->device == 0x7340 && - adev->pdev->revision != 0x00)) - wks = "_wks"; - break; - case IP_VERSION(10, 1, 2): - chip_name = "navi12"; - break; - case IP_VERSION(10, 3, 0): - chip_name = "sienna_cichlid"; - break; - case IP_VERSION(10, 3, 2): - chip_name = "navy_flounder"; - break; - case IP_VERSION(10, 3, 1): - chip_name = "vangogh"; - break; - case IP_VERSION(10, 3, 4): - chip_name = "dimgrey_cavefish"; - break; - case IP_VERSION(10, 3, 5): - chip_name = "beige_goby"; - break; - case IP_VERSION(10, 3, 3): - chip_name = "yellow_carp"; - break; - case IP_VERSION(10, 3, 6): - chip_name = "gc_10_3_6"; - break; - case IP_VERSION(10, 1, 3): - case IP_VERSION(10, 1, 4): - chip_name = "cyan_skillfish2"; - break; - case IP_VERSION(10, 3, 7): - chip_name = "gc_10_3_7"; - break; - default: - BUG(); - } + if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 1, 1) && + (!(adev->pdev->device == 0x7340 && adev->pdev->revision != 0x00))) + wks = "_wks"; + amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix)); - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp%s.bin", chip_name, wks); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp%s.bin", ucode_prefix, wks); err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_PFP); - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me%s.bin", chip_name, wks); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me%s.bin", ucode_prefix, wks); err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_ME); - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce%s.bin", chip_name, wks); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce%s.bin", ucode_prefix, wks); err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_CE); if (!amdgpu_sriov_vf(adev)) { - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", ucode_prefix); err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name); /* don't check this. There are apparently firmwares in the wild with * incorrect size in the header @@ -4051,7 +4011,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) goto out; if (err) dev_dbg(adev->dev, - "gfx10: amdgpu_ucode_validate() failed \"%s\"\n", + "gfx10: amdgpu_ucode_request() failed \"%s\"\n", fw_name); rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data; version_major = le16_to_cpu(rlc_hdr->header.header_version_major); @@ -4061,14 +4021,14 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) goto out; } - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec%s.bin", chip_name, wks); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec%s.bin", ucode_prefix, wks); err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1); amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1_JT); - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2%s.bin", chip_name, wks); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2%s.bin", ucode_prefix, wks); err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name); if (!err) { amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2); @@ -4077,6 +4037,8 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) err = 0; adev->gfx.mec2_fw = NULL; } + amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2); + amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2_JT); gfx_v10_0_check_fw_write_wait(adev); out: @@ -4239,19 +4201,11 @@ static void gfx_v10_0_mec_fini(struct amdgpu_device *adev) amdgpu_bo_free_kernel(&adev->gfx.mec.mec_fw_obj, NULL, NULL); } -static int gfx_v10_0_me_init(struct amdgpu_device *adev) +static void gfx_v10_0_me_init(struct amdgpu_device *adev) { - int r; - bitmap_zero(adev->gfx.me.queue_bitmap, AMDGPU_MAX_GFX_QUEUES); amdgpu_gfx_graphics_queue_acquire(adev); - - r = gfx_v10_0_init_microcode(adev); - if (r) - DRM_ERROR("Failed to load gfx firmware!\n"); - - return r; } static int gfx_v10_0_mec_init(struct amdgpu_device *adev) @@ -4619,9 +4573,7 @@ static int gfx_v10_0_sw_init(void *handle) adev->gfx.gfx_current_status = AMDGPU_GFX_NORMAL_MODE; - r = gfx_v10_0_me_init(adev); - if (r) - return r; + gfx_v10_0_me_init(adev); if (adev->gfx.rlc.funcs) { if (adev->gfx.rlc.funcs->init) { @@ -7599,7 +7551,7 @@ static int gfx_v10_0_early_init(void *handle) /* init rlcg reg access ctrl */ gfx_v10_0_init_rlcg_reg_access_ctrl(adev); - return 0; + return gfx_v10_0_init_microcode(adev); } static int gfx_v10_0_late_init(void *handle) From patchwork Wed Jan 4 16:40:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088748 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2AD38C4332F for ; Wed, 4 Jan 2023 16:43:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2E81110E553; Wed, 4 Jan 2023 16:43:14 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2055.outbound.protection.outlook.com [40.107.220.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id BC2A810E547; Wed, 4 Jan 2023 16:43:09 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NIN8zlEL/tzE8481bbz+GKdkPBHqZXEIOQCxGBMeWzxqGQdL/q86+oN/UwdglnwbadqmbZ4ZqKPOvjxU19l2Cdu+3qVC3CRNSSHzvq/gQ54o9c5LlYEIRSqXuBW2KsBqVIjhocddRz5n1ksur/20TYZBDnn+evcG4G2OsxisO1oPre8FWi12UJ8ssfhv1OkWK+G8IpNHMsP3Bf9LrBV+2GVUwGU48CptXctUH7Cmslq4DKqdA3G4Y2FGPABATN0t+bovPM1BnS5W6LpNh9hyL458eBG4MnmdKoK5WkKGf+Dy8r1xmmf1DBS1Z+Im3vkUehKPQOJrCOT+npYcFptPxw== 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=/M0YVsQ3BZxtOgwckN7CY7NeFI4c/jRuufH1fIIyYtc=; b=kRkW6Fa/7ZDZeOGP48duRjOZYPrV7+xrF9MpF7qfD8PYNqPUuuECxOF/QOUQ4vQUdvPTB1KhNhZD7yF5ilaBHURTEQWz20N2H3aaP9+evlQBJZA24ZPIDl2Pb8ar1HCxU+HlFbYZgrnbJTTV8g/1Ra5/rfpecuvim9N6URouQ50Y0imM7Gka6kfXZAeKM/k+9Z9gPzjWco+9WZWE/MjPwggcM///topjFDKsFbMqds37bfU70yGFEV9kW560n6m9iPyFQPWT+9IWvxoKOIy131v3/5yAf8N5gcw/T26fLehifdqtqUNcsF42rnFCNonuFozxC3aVz2LRmgiDyu6MAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/M0YVsQ3BZxtOgwckN7CY7NeFI4c/jRuufH1fIIyYtc=; b=XStjuDvWy02KfpeYp6pdhDpoKp5hdHSeDV3b2Nz0Uuu/59rocJijguhi3xrsHgeqmRQipQzfjDLxsGsFgTbMQVT2NDX15TM7N4+Mir01BzqGFfSUSJKEevslf1ty3OEHc1b/dnabuvfXaAvyFJ0M9eWL5QkVEMy2YxkzkGLf5n8= Received: from BN9PR03CA0625.namprd03.prod.outlook.com (2603:10b6:408:106::30) by MW4PR12MB6780.namprd12.prod.outlook.com (2603:10b6:303:20e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:43:07 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::2d) by BN9PR03CA0625.outlook.office365.com (2603:10b6:408:106::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:43:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:43:07 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:42:59 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 18/45] drm/amd: Use `amdgpu_ucode_*` helpers for GFX11 Date: Wed, 4 Jan 2023 10:40:07 -0600 Message-ID: <20230104164042.30271-19-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|MW4PR12MB6780:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c200f4d-f517-4b95-a0ea-08daee72c1e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WKUr5eAvrV3ykADiZ9MOhq9DsPhnN1z/+syAV0sKwZh+vgs6QP3Yd5/Ms7utbEjS2QdZoLBjj28J95xaimcm3MGZk6MaGmSuZBHtzUwGE2YoJWDobPmrHxyYEYh68LRi3dJqzM9fiGjatOelAZOeSL6xAfi7H5OKiyreco/O7wUzIXWS0tEJz6RpoN9fRRsmeilNhB4h5WT/PXO0fsKXiJ1Gg0ZLnBrnGefAyZ8Euemu4Uf/9oXM1KdQuHdcKirKMkePOQjNDz6LBaqVLShrHYhnyb+7bFfxlnACDfR2CT7kk5uDkBa5lOBd6HuPCYomBiQANGxATDMp/DKMcRKiOq0zelmZiKqf0cOO9Xn5Z0iHYDc+tWICBzYb4DvhcNZwW230E/OOMO2lNxfzxwSD0wh3IFxEWh02fzSU/tIpA43TKfP/6rl3LpERQHGnVSvn37b9GFEb4ekPTXYeeDGaJaGeJGp4x277KjtXBWJaG5n6/iMflQHdNEpj6TtMGmQ90kagckZRFkFFzs+LA1+t/8xQvKg+reXycnzfws2e6So8YCMCK0E8wnSQK6anxc5qr+nqX8afCNMtmdhWtDGnWZImAjsRqEiHo0QzFrFDAJyCkTzVjfhfaQChFAQiR3OGtckPGvr9z/2eAqwUHPHA+LLL3byCBpQ0XCPBTIjAbHlKbjr9oM37ygEuaif17aRLYOsy2uBkKazKS9BuTUKQg9w9Up8oZ5Ot7rbeEV1bUrcyFAeaKmG74UgiyyPvslOXkYHXu8hHbGAGBoUdDdJqJw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(39860400002)(396003)(136003)(376002)(451199015)(36840700001)(40470700004)(46966006)(83380400001)(2616005)(1076003)(336012)(36860700001)(426003)(47076005)(40480700001)(86362001)(40460700003)(81166007)(82310400005)(356005)(82740400003)(36756003)(110136005)(54906003)(316002)(2906002)(41300700001)(44832011)(70586007)(8936002)(4326008)(70206006)(8676002)(26005)(186003)(478600001)(6666004)(16526019)(5660300002)(7696005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:43:07.2455 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c200f4d-f517-4b95-a0ea-08daee72c1e5 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6780 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper will provide symmetery on unload. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 102 +++++++++---------------- drivers/gpu/drm/amd/amdgpu/imu_v11_0.c | 7 +- 2 files changed, 37 insertions(+), 72 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index a56c6e106d00..ce018331b093 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -431,18 +431,37 @@ static int gfx_v11_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) static void gfx_v11_0_free_microcode(struct amdgpu_device *adev) { - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; + amdgpu_ucode_release(adev->gfx.pfp_fw); + amdgpu_ucode_release(adev->gfx.me_fw); + amdgpu_ucode_release(adev->gfx.rlc_fw); + amdgpu_ucode_release(adev->gfx.mec_fw); kfree(adev->gfx.rlc.register_list_format); } +static int gfx_v11_0_init_toc_microcode(struct amdgpu_device *adev, char *ucode_prefix) +{ + const struct psp_firmware_header_v1_0 *toc_hdr; + int err = 0; + char fw_name[40]; + + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_toc.bin", ucode_prefix); + err = amdgpu_ucode_load(adev, &adev->psp.toc_fw, fw_name); + if (err) + goto out; + + toc_hdr = (const struct psp_firmware_header_v1_0 *)adev->psp.toc_fw->data; + adev->psp.toc.fw_version = le32_to_cpu(toc_hdr->header.ucode_version); + adev->psp.toc.feature_version = le32_to_cpu(toc_hdr->sos.fw_version); + adev->psp.toc.size_bytes = le32_to_cpu(toc_hdr->header.ucode_size_bytes); + adev->psp.toc.start_addr = (uint8_t *)toc_hdr + + le32_to_cpu(toc_hdr->header.ucode_array_offset_bytes); + return 0; +out: + amdgpu_ucode_release(adev->psp.toc_fw); + return err; +} + static int gfx_v11_0_init_microcode(struct amdgpu_device *adev) { char fw_name[40]; @@ -457,10 +476,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev) amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix)); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", ucode_prefix); - err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.pfp_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); if (err) goto out; /* check pfp fw hdr version to decide if enable rs64 for gfx11.*/ @@ -477,10 +493,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", ucode_prefix); - err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.me_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); if (err) goto out; if (adev->gfx.rs64_enable) { @@ -493,10 +506,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev) if (!amdgpu_sriov_vf(adev)) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", ucode_prefix); - err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.rlc_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name); if (err) goto out; rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data; @@ -508,10 +518,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", ucode_prefix); - err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.mec_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name); if (err) goto out; if (adev->gfx.rs64_enable) { @@ -530,54 +537,15 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev) out: if (err) { - dev_err(adev->dev, - "gfx11: Failed to init firmware \"%s\"\n", - fw_name); - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; + amdgpu_ucode_release(adev->gfx.pfp_fw); + amdgpu_ucode_release(adev->gfx.me_fw); + amdgpu_ucode_release(adev->gfx.rlc_fw); + amdgpu_ucode_release(adev->gfx.mec_fw); } return err; } -static int gfx_v11_0_init_toc_microcode(struct amdgpu_device *adev) -{ - const struct psp_firmware_header_v1_0 *toc_hdr; - int err = 0; - char fw_name[40]; - char ucode_prefix[30]; - - amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix)); - - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_toc.bin", ucode_prefix); - err = request_firmware(&adev->psp.toc_fw, fw_name, adev->dev); - if (err) - goto out; - - err = amdgpu_ucode_validate(adev->psp.toc_fw); - if (err) - goto out; - - toc_hdr = (const struct psp_firmware_header_v1_0 *)adev->psp.toc_fw->data; - adev->psp.toc.fw_version = le32_to_cpu(toc_hdr->header.ucode_version); - adev->psp.toc.feature_version = le32_to_cpu(toc_hdr->sos.fw_version); - adev->psp.toc.size_bytes = le32_to_cpu(toc_hdr->header.ucode_size_bytes); - adev->psp.toc.start_addr = (uint8_t *)toc_hdr + - le32_to_cpu(toc_hdr->header.ucode_array_offset_bytes); - return 0; -out: - dev_err(adev->dev, "Failed to load TOC microcode\n"); - release_firmware(adev->psp.toc_fw); - adev->psp.toc_fw = NULL; - return err; -} - static u32 gfx_v11_0_get_csb_size(struct amdgpu_device *adev) { u32 count = 0; diff --git a/drivers/gpu/drm/amd/amdgpu/imu_v11_0.c b/drivers/gpu/drm/amd/amdgpu/imu_v11_0.c index 95548c512f4f..79ebf692cec6 100644 --- a/drivers/gpu/drm/amd/amdgpu/imu_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/imu_v11_0.c @@ -49,10 +49,7 @@ static int imu_v11_0_init_microcode(struct amdgpu_device *adev) amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix)); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_imu.bin", ucode_prefix); - err = request_firmware(&adev->gfx.imu_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.imu_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, fw_name); if (err) goto out; imu_hdr = (const struct imu_firmware_header_v1_0 *)adev->gfx.imu_fw->data; @@ -77,7 +74,7 @@ static int imu_v11_0_init_microcode(struct amdgpu_device *adev) dev_err(adev->dev, "gfx11: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(adev->gfx.imu_fw); + amdgpu_ucode_release(adev->gfx.imu_fw); } return err; From patchwork Wed Jan 4 16:40:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088750 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9F437C4708D for ; Wed, 4 Jan 2023 16:43:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E2A4D10E56A; Wed, 4 Jan 2023 16:43:16 +0000 (UTC) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2066.outbound.protection.outlook.com [40.107.102.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id D4C7E10E54A; Wed, 4 Jan 2023 16:43:09 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C+L14Nm5HTPWVfqkEpw7Y0OfRCg8hPic8KFXvVIJVKkZ/cEixfHtoG04FwuzxxrAdqQu0mFI9XEJ5f9ROWdG/cS1ON1bQKuAyD6PEDquJR38EuRqs+sPa3s/LT9FnyHqEkEdnhfAgrl+gAu6T181o2r67w5jyBsX6fkvKJoJMRe6Tx4ybeyfG9/SYyg4j2b82FSaASB5oxbXBOEfDiw2CMrR67QtOzr2FBuJCgHvxDqP4p0Zj4aQbVJmjrw3GsJeTm1AmLIq5mDD3EaVXbF9UC9yUVjVeQPr21a/XpQU0qlUtCq+Djet4YMgsF+N8tyvqijcDjb7+MhaPhJ9cn8KRw== 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=4q5X5maJe64aIx4Sd/OlmpTCbvTkhNblm8yOV9gV1sQ=; b=UlKfEllgr3cRFJB75jONNCkixqymZKrsv0Cqk+xpCIWXONpQxELnYm6oEj0PuRQtqqdxnF83qibpaprKRunHRXIVKkqOQgps28icr8j+IkDlOeQuCFF5s1efHq9u8DGn8VQxRUf4qxfGFIRP+kyp084bUjzNb+liIG4mhpF5ccxoZ5nBkox2bZH20KFdg+/2Qgeso69kWusLVkS2NtoOI4TRlyvZJfciDjPPkpDIfanzOqoQC8lncLUx4Zqry6prg8DYT5jBoEgtA0jfjbOoHgM33uN//Yjol2JZ7GvOGQ5nJK55IbG4Gj+wGkWTtNVCDiWBfU8np5384jsYjzeDRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4q5X5maJe64aIx4Sd/OlmpTCbvTkhNblm8yOV9gV1sQ=; b=MeFaDqN04vpayafvIZaxqM7lgLnQvdJgctlEEiugSjvC296dgP9us+XrQ1FlASHW/i0YyUBLEYSEwyxDgI9sgtD5Lg3eIvqEzpkxr9I7SeQwoTQ96XN+AVzQqL9ZTe0zwaC74d7B7J7sCF2CCT00mUJmXTk817bJnGatMftRGCU= Received: from BN9PR03CA0628.namprd03.prod.outlook.com (2603:10b6:408:106::33) by MN2PR12MB4357.namprd12.prod.outlook.com (2603:10b6:208:262::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:43:07 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::1a) by BN9PR03CA0628.outlook.office365.com (2603:10b6:408:106::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:43:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:43:07 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:43:00 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 19/45] drm/amd: Load GFX11 microcode during early_init Date: Wed, 4 Jan 2023 10:40:08 -0600 Message-ID: <20230104164042.30271-20-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|MN2PR12MB4357:EE_ X-MS-Office365-Filtering-Correlation-Id: f9e03955-dc89-4186-3d46-08daee72c202 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fRrfb03QO7jzv+l2Szs8Pw8MF4LhmNMl64EfYf8N6F/fUUYI66uY2NXgpPFl1l720wd+RBIGzwxOeMtY4bvWxjXQmrz29v9LzDX4a6DLM+5xnfyOcgauBB5lb+SplpJXacwB2S9jbpKBvj89MfxRMw60Ps1a1H1BmrMqK30fW6/FQA7rXmyJOf1oheJMqh6J+8k5Ipj62dm3K+DpDx6WUtBQ/kb/SZqmga1M/M5emaxo/x+EmY8Lw8/Bd8ouJXxS3cffCaj1zlFd3r9uuiw/aWLytFHT9HTh2CD+x8++E/uJn7VVpjsrEdZa2sBXgYIqQvhJPU1tB6XN398RwE1n9WGNW0wEr+99QqdGjZlhlZJxcqExxgAXPEFV8AP7oZoeFCl6ew2AOVlb+CvGW4eOSBNaMe/mL+KzPvJ7CIsKIXLtMlpPgKjcA3zFCEVIzJ1Mnpa46dFVG8f8hzEJAtH6eSpMQhUXsZCq+UBxxP7Jfk1sRLLuo6w+/kZ8KcAdLnpvqzG+iQ0MzyDcvwX230Uf/wr5UYBT4OIo+FBltDcdByQFL2nQVcWiimS+rbbSXqmclaqBb4OSYjP/TEfxa5xrhj8PfhRItyNJDvM+yG7h0rZFrYdQdlNwIjiLx484POeD2MHkjwNdtS5k0vL3UndUO/glnJIqguaqVHmkpXfuXSppRGPHYKtN8EoMDvfCUBsBqDyLjB6mwAuR8OH3IW+edPbpzrqy+pdm6TcGOOZuO4s= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(376002)(39860400002)(396003)(136003)(451199015)(40470700004)(36840700001)(46966006)(36860700001)(2906002)(82740400003)(40460700003)(36756003)(40480700001)(316002)(16526019)(110136005)(2616005)(82310400005)(81166007)(86362001)(54906003)(356005)(5660300002)(41300700001)(83380400001)(4326008)(47076005)(70586007)(426003)(8676002)(336012)(1076003)(7696005)(186003)(70206006)(8936002)(26005)(44832011)(478600001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:43:07.4486 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f9e03955-dc89-4186-3d46-08daee72c202 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4357 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If GFX11 microcode is required but not available during early init, the firmware framebuffer will have already been released and the screen will freeze. Move the request for GFX11 microcode into the early_init phase so that if it's not available, driver init will fail. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index ce018331b093..28efea3b9070 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -532,6 +532,9 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev) amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1_JT); } + if (adev->firmware.load_type == AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO) + err = gfx_v11_0_init_toc_microcode(adev, ucode_prefix); + /* only one MEC for gfx 11.0.0. */ adev->gfx.mec2_fw = NULL; @@ -682,19 +685,11 @@ static void gfx_v11_0_mec_fini(struct amdgpu_device *adev) amdgpu_bo_free_kernel(&adev->gfx.mec.mec_fw_data_obj, NULL, NULL); } -static int gfx_v11_0_me_init(struct amdgpu_device *adev) +static void gfx_v11_0_me_init(struct amdgpu_device *adev) { - int r; - bitmap_zero(adev->gfx.me.queue_bitmap, AMDGPU_MAX_GFX_QUEUES); amdgpu_gfx_graphics_queue_acquire(adev); - - r = gfx_v11_0_init_microcode(adev); - if (r) - DRM_ERROR("Failed to load gfx firmware!\n"); - - return r; } static int gfx_v11_0_mec_init(struct amdgpu_device *adev) @@ -1307,9 +1302,7 @@ static int gfx_v11_0_sw_init(void *handle) } } - r = gfx_v11_0_me_init(adev); - if (r) - return r; + gfx_v11_0_me_init(adev); r = gfx_v11_0_rlc_init(adev); if (r) { @@ -1377,9 +1370,6 @@ static int gfx_v11_0_sw_init(void *handle) /* allocate visible FB for rlc auto-loading fw */ if (adev->firmware.load_type == AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO) { - r = gfx_v11_0_init_toc_microcode(adev); - if (r) - dev_err(adev->dev, "Failed to load toc firmware!\n"); r = gfx_v11_0_rlc_autoload_buffer_init(adev); if (r) return r; @@ -4648,7 +4638,7 @@ static int gfx_v11_0_early_init(void *handle) gfx_v11_0_init_rlcg_reg_access_ctrl(adev); - return 0; + return gfx_v11_0_init_microcode(adev); } static int gfx_v11_0_ras_late_init(void *handle) From patchwork Wed Jan 4 16:40:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088752 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5F9DAC4708E for ; Wed, 4 Jan 2023 16:43:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2CBD210E575; Wed, 4 Jan 2023 16:43:19 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2084.outbound.protection.outlook.com [40.107.223.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id A0D7610E547; Wed, 4 Jan 2023 16:43:10 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hV0GGQk2zpqsEoGCpaBzKPP16zKPNEtPBpBkFI5pz2iSONMneDwhYCaXZbe5dTNRdo/z6+POYDo0flv7Qb+TtFE5Pb+UP2qu0SY0Fws4qPzg3qkW+AxuSvdsFU7rY+7vqinOFfs+g6rjzACOfKLzEridSMIO/zsVyZNxs7MMPpjZmWqJMg1eMRjv8X+3lXqHN9uyjRK19996f+4Eu7yV9crKMlD/Lvo1VOHlgDt+zXHIADYfV5XOH6lIROpJ6Ei+On25Af4z5mThA7iG2wcyUskIdTL6XwmKlEQWA3p/NmQgpHERXYYpF1o2x5+GpBPP1XEuu78oX2i8o9g/LCasMA== 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=8viU84SzRIoLLy3WbYfSdP8GnCVJQ5n7dtBoGNb2mnY=; b=PJhsjXmeexBjHz7ABK2XOSSE9h1M0+irE+Zjh+N1YjioYiII7F+q0vS2dRe6d1N1ma8Ray8SX0Cy2TGdSQ5DDaLuu1almoyagAz82IyBEstY75SsgqFVM1HAYdodjNfk3t5/X+zv6EIaD6vTQ4YX72v+v3kuUhGEMCjSHELAJrFwA9e1FHoXFjY47vSPpJzMDlkdbMpRSrcKBusRgO6iNHPtwDFfk7l6drje1lS7rdw7B1d6CEl1nUWZ8C30wHU62lo7BkNY/2e+AEWbslpbfMYQETTe3j0hJQTomPAGq3l8wS1LrbJ5+vjhYPX8bhwmr2qWA4seTfebSu6v6J42lA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8viU84SzRIoLLy3WbYfSdP8GnCVJQ5n7dtBoGNb2mnY=; b=FC0QmiF9dxQcjZD3kz9HI3iTtrZhjnaWEO+nuPMZk652e7g9VHqNzcUXrpY7+ShEzpXTUBQfPuYSyqxNcSlr7GpdkJYCBafjmu+u3LBLYRnCG/PfUJgFGAy3ce/llvYHpwZnRcAEYAA8F5yYv3nFGwx/S9zXwe6Gobt+4MBZvZY= Received: from BN9PR03CA0626.namprd03.prod.outlook.com (2603:10b6:408:106::31) by PH7PR12MB5925.namprd12.prod.outlook.com (2603:10b6:510:1d8::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:43:08 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::a3) by BN9PR03CA0626.outlook.office365.com (2603:10b6:408:106::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Wed, 4 Jan 2023 16:43:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:43:07 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:43:02 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 20/45] drm/amd: Parse both v1 and v2 TA microcode headers using same function Date: Wed, 4 Jan 2023 10:40:09 -0600 Message-ID: <20230104164042.30271-21-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|PH7PR12MB5925:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ce91735-9fcf-43ea-4ecd-08daee72c234 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +nFAxvhDe1+AWAntDtfz+kan0U8b+ZF2U6BzYHbqSTGN2KSvfm84sYvRz36yt1NYto9AxtWgboihReWbx9820X0jjDLJeKZuDklsbbzMbo8QQTVtzV72Kx9/QWqywQHtros5q3hBSmdz8mWx+yMTEkcoS0v/y9ytZhm8Op5Z1R1VhhJW9ARKzZYav5IIwfLkDw+zdPe4l3jyt7yVYYFuI+7vb/iWVmzVlePgWRREB3hBj+UoQJcJSfIGaTyFaeLywenNRwziZ5Y7/hfjHsstICaAOeGqvPIT7vkOJfo9GeRiFxB8sP+7qh+88EOhVV4b3rY4WnbqZiPT6mBWuxmfosW++AbKCyB/y7ZtsRtw80Lm0uCwdpgczbFMHAdZX1z0VAE+YKmWkFxE4GznGXrMNHdmhF59o93P6vjU+J7nkJirQYcLf+rjQpzagRA0rxwbcyJ3ha93GJW2sfaZDj5r+llBp8myS3BsMI86sgZrjmRurCRDPVriSqcAqBhTboZnQn+fUKpKZInG4R2Lc/13J98zhZ0Fly3QAvAq+B6phNPdbv6CQ26pEg/FNKQuayL+8UuslpPdWSS4Q4JoILAY5hmh/UC0AxYA9OGc3QeOxAQX2n0D/8ZTho7q0ic640fCPE8M+oh3t5Vs+VR+80Zb01HBnTuB23GU4RixXDb0xXYsliV/tfGwDQt/5yAxDmTB5DiSzcrlcjQDlvEG9tSgi7jMl2riL+rmVGwERuui1Hc= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(376002)(136003)(39860400002)(396003)(451199015)(40470700004)(46966006)(36840700001)(16526019)(26005)(186003)(1076003)(2616005)(478600001)(110136005)(7696005)(36860700001)(70586007)(70206006)(8676002)(4326008)(8936002)(47076005)(41300700001)(426003)(336012)(30864003)(83380400001)(44832011)(5660300002)(2906002)(40480700001)(82740400003)(356005)(81166007)(86362001)(40460700003)(316002)(54906003)(36756003)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:43:07.7924 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ce91735-9fcf-43ea-4ecd-08daee72c234 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5925 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Several IP versions duplicate code and can't use the common helpers. Move this code into a single function so that the helpers can be used. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 120 ++++++++++++++++++------ drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/psp_v10_0.c | 60 +----------- drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 74 ++------------- drivers/gpu/drm/amd/amdgpu/psp_v12_0.c | 62 +----------- 5 files changed, 107 insertions(+), 211 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index 7a2fc920739b..d971e3785eaf 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -3272,41 +3272,75 @@ static int parse_ta_bin_descriptor(struct psp_context *psp, return 0; } -int psp_init_ta_microcode(struct psp_context *psp, - const char *chip_name) +static int parse_ta_v1_microcode(struct psp_context *psp) { + const struct ta_firmware_header_v1_0 *ta_hdr; struct amdgpu_device *adev = psp->adev; - char fw_name[PSP_FW_NAME_LEN]; - const struct ta_firmware_header_v2_0 *ta_hdr; - int err = 0; - int ta_index = 0; - if (!chip_name) { - dev_err(adev->dev, "invalid chip name for ta microcode\n"); + ta_hdr = (const struct ta_firmware_header_v1_0 *) + adev->psp.ta_fw->data; + + if (le16_to_cpu(ta_hdr->header.header_version_major) != 1) return -EINVAL; + + adev->psp.xgmi_context.context.bin_desc.fw_version = + le32_to_cpu(ta_hdr->xgmi.fw_version); + adev->psp.xgmi_context.context.bin_desc.size_bytes = + le32_to_cpu(ta_hdr->xgmi.size_bytes); + adev->psp.xgmi_context.context.bin_desc.start_addr = + (uint8_t *)ta_hdr + + le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes); + adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version); + adev->psp.ras_context.context.bin_desc.fw_version = + le32_to_cpu(ta_hdr->ras.fw_version); + adev->psp.ras_context.context.bin_desc.size_bytes = + le32_to_cpu(ta_hdr->ras.size_bytes); + adev->psp.ras_context.context.bin_desc.start_addr = + (uint8_t *)adev->psp.xgmi_context.context.bin_desc.start_addr + + le32_to_cpu(ta_hdr->ras.offset_bytes); + adev->psp.hdcp_context.context.bin_desc.fw_version = + le32_to_cpu(ta_hdr->hdcp.fw_version); + adev->psp.hdcp_context.context.bin_desc.size_bytes = + le32_to_cpu(ta_hdr->hdcp.size_bytes); + adev->psp.hdcp_context.context.bin_desc.start_addr = + (uint8_t *)ta_hdr + + le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes); + adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version); + adev->psp.dtm_context.context.bin_desc.fw_version = + le32_to_cpu(ta_hdr->dtm.fw_version); + adev->psp.dtm_context.context.bin_desc.size_bytes = + le32_to_cpu(ta_hdr->dtm.size_bytes); + adev->psp.dtm_context.context.bin_desc.start_addr = + (uint8_t *)adev->psp.hdcp_context.context.bin_desc.start_addr + + le32_to_cpu(ta_hdr->dtm.offset_bytes); + if (adev->apu_flags & AMD_APU_IS_RENOIR) { + adev->psp.securedisplay_context.context.bin_desc.fw_version = + le32_to_cpu(ta_hdr->securedisplay.fw_version); + adev->psp.securedisplay_context.context.bin_desc.size_bytes = + le32_to_cpu(ta_hdr->securedisplay.size_bytes); + adev->psp.securedisplay_context.context.bin_desc.start_addr = + (uint8_t *)adev->psp.hdcp_context.context.bin_desc.start_addr + + le32_to_cpu(ta_hdr->securedisplay.offset_bytes); } - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name); - err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev); - if (err) - goto out; + return 0; +} - err = amdgpu_ucode_validate(adev->psp.ta_fw); - if (err) - goto out; +static int parse_ta_v2_microcode(struct psp_context *psp) +{ + const struct ta_firmware_header_v2_0 *ta_hdr; + struct amdgpu_device *adev = psp->adev; + int err = 0; + int ta_index = 0; ta_hdr = (const struct ta_firmware_header_v2_0 *)adev->psp.ta_fw->data; - if (le16_to_cpu(ta_hdr->header.header_version_major) != 2) { - dev_err(adev->dev, "unsupported TA header version\n"); - err = -EINVAL; - goto out; - } + if (le16_to_cpu(ta_hdr->header.header_version_major) != 2) + return -EINVAL; if (le32_to_cpu(ta_hdr->ta_fw_bin_count) >= UCODE_MAX_PSP_PACKAGING) { dev_err(adev->dev, "packed TA count exceeds maximum limit\n"); - err = -EINVAL; - goto out; + return -EINVAL; } for (ta_index = 0; ta_index < le32_to_cpu(ta_hdr->ta_fw_bin_count); ta_index++) { @@ -3314,14 +3348,46 @@ int psp_init_ta_microcode(struct psp_context *psp, &ta_hdr->ta_fw_bin[ta_index], ta_hdr); if (err) - goto out; + return err; } return 0; -out: - dev_err(adev->dev, "fail to initialize ta microcode\n"); - release_firmware(adev->psp.ta_fw); - adev->psp.ta_fw = NULL; +} + +int psp_init_ta_microcode(struct psp_context *psp, const char *chip_name) +{ + const struct common_firmware_header *hdr; + struct amdgpu_device *adev = psp->adev; + char fw_name[PSP_FW_NAME_LEN]; + int err; + + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name); + err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev); + if (err) + return err; + err = amdgpu_ucode_validate(adev->psp.ta_fw); + if (err) + return err; + + hdr = (const struct common_firmware_header *)adev->psp.ta_fw->data; + switch (le16_to_cpu(hdr->header_version_major)) { + case 1: + err = parse_ta_v1_microcode(psp); + break; + case 2: + err = parse_ta_v2_microcode(psp); + break; + default: + dev_err(adev->dev, "unsupported TA header version\n"); + err = -EINVAL; + } + + if (err) { + dev_err(adev->dev, "fail to initialize ta microcode\n"); + release_firmware(adev->psp.ta_fw); + adev->psp.ta_fw = NULL; + } + return err; } diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index 28efea3b9070..0031a199121f 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -446,7 +446,7 @@ static int gfx_v11_0_init_toc_microcode(struct amdgpu_device *adev, char *ucode_ char fw_name[40]; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_toc.bin", ucode_prefix); - err = amdgpu_ucode_load(adev, &adev->psp.toc_fw, fw_name); + err = amdgpu_ucode_request(adev, &adev->psp.toc_fw, fw_name); if (err) goto out; diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c index 9de46fa8f46c..7fb48c1dec71 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c @@ -48,9 +48,8 @@ static int psp_v10_0_init_microcode(struct psp_context *psp) { struct amdgpu_device *adev = psp->adev; const char *chip_name; - char fw_name[30]; + char ucode_prefix[30]; int err = 0; - const struct ta_firmware_header_v1_0 *ta_hdr; DRM_DEBUG("\n"); switch (adev->asic_type) { @@ -64,66 +63,13 @@ static int psp_v10_0_init_microcode(struct psp_context *psp) break; default: BUG(); } + amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix)); err = psp_init_asd_microcode(psp, chip_name); if (err) goto out; - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name); - err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev); - if (err) { - release_firmware(adev->psp.ta_fw); - adev->psp.ta_fw = NULL; - dev_info(adev->dev, - "psp v10.0: Failed to load firmware \"%s\"\n", - fw_name); - } else { - err = amdgpu_ucode_validate(adev->psp.ta_fw); - if (err) - goto out2; - - ta_hdr = (const struct ta_firmware_header_v1_0 *) - adev->psp.ta_fw->data; - adev->psp.hdcp_context.context.bin_desc.fw_version = - le32_to_cpu(ta_hdr->hdcp.fw_version); - adev->psp.hdcp_context.context.bin_desc.size_bytes = - le32_to_cpu(ta_hdr->hdcp.size_bytes); - adev->psp.hdcp_context.context.bin_desc.start_addr = - (uint8_t *)ta_hdr + - le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes); - - adev->psp.dtm_context.context.bin_desc.fw_version = - le32_to_cpu(ta_hdr->dtm.fw_version); - adev->psp.dtm_context.context.bin_desc.size_bytes = - le32_to_cpu(ta_hdr->dtm.size_bytes); - adev->psp.dtm_context.context.bin_desc.start_addr = - (uint8_t *)adev->psp.hdcp_context.context.bin_desc.start_addr + - le32_to_cpu(ta_hdr->dtm.offset_bytes); - - adev->psp.securedisplay_context.context.bin_desc.fw_version = - le32_to_cpu(ta_hdr->securedisplay.fw_version); - adev->psp.securedisplay_context.context.bin_desc.size_bytes = - le32_to_cpu(ta_hdr->securedisplay.size_bytes); - adev->psp.securedisplay_context.context.bin_desc.start_addr = - (uint8_t *)adev->psp.hdcp_context.context.bin_desc.start_addr + - le32_to_cpu(ta_hdr->securedisplay.offset_bytes); - - adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version); - } - - return 0; - -out2: - release_firmware(adev->psp.ta_fw); - adev->psp.ta_fw = NULL; -out: - if (err) { - dev_err(adev->dev, - "psp v10.0: Failed to load firmware \"%s\"\n", - fw_name); - } - - return err; + return psp_init_ta_microcode(psp, ucode_prefix); } static int psp_v10_0_ring_create(struct psp_context *psp, diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c index bd3e3e23a939..5f140b7c30d2 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c @@ -129,6 +129,7 @@ static int psp_v11_0_init_microcode(struct psp_context *psp) default: BUG(); } + amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix)); switch (adev->ip_versions[MP0_HWIP][0]) { @@ -140,35 +141,9 @@ static int psp_v11_0_init_microcode(struct psp_context *psp) err = psp_init_asd_microcode(psp, chip_name); if (err) return err; - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name); - err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev); - if (err) { - release_firmware(adev->psp.ta_fw); - adev->psp.ta_fw = NULL; - dev_info(adev->dev, - "psp v11.0: Failed to load firmware \"%s\"\n", fw_name); - } else { - err = amdgpu_ucode_validate(adev->psp.ta_fw); - if (err) - goto out2; - - ta_hdr = (const struct ta_firmware_header_v1_0 *)adev->psp.ta_fw->data; - adev->psp.xgmi_context.context.bin_desc.fw_version = - le32_to_cpu(ta_hdr->xgmi.fw_version); - adev->psp.xgmi_context.context.bin_desc.size_bytes = - le32_to_cpu(ta_hdr->xgmi.size_bytes); - adev->psp.xgmi_context.context.bin_desc.start_addr = - (uint8_t *)ta_hdr + - le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes); - adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version); - adev->psp.ras_context.context.bin_desc.fw_version = - le32_to_cpu(ta_hdr->ras.fw_version); - adev->psp.ras_context.context.bin_desc.size_bytes = - le32_to_cpu(ta_hdr->ras.size_bytes); - adev->psp.ras_context.context.bin_desc.start_addr = - (uint8_t *)adev->psp.xgmi_context.context.bin_desc.start_addr + - le32_to_cpu(ta_hdr->ras.offset_bytes); - } + err = psp_init_ta_microcode(psp, ucode_prefix); + if (err) + return err; break; case IP_VERSION(11, 0, 0): case IP_VERSION(11, 0, 5): @@ -179,39 +154,9 @@ static int psp_v11_0_init_microcode(struct psp_context *psp) err = psp_init_asd_microcode(psp, chip_name); if (err) return err; - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name); - err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev); - if (err) { - release_firmware(adev->psp.ta_fw); - adev->psp.ta_fw = NULL; - dev_info(adev->dev, - "psp v11.0: Failed to load firmware \"%s\"\n", fw_name); - } else { - err = amdgpu_ucode_validate(adev->psp.ta_fw); - if (err) - goto out2; - - ta_hdr = (const struct ta_firmware_header_v1_0 *)adev->psp.ta_fw->data; - adev->psp.hdcp_context.context.bin_desc.fw_version = - le32_to_cpu(ta_hdr->hdcp.fw_version); - adev->psp.hdcp_context.context.bin_desc.size_bytes = - le32_to_cpu(ta_hdr->hdcp.size_bytes); - adev->psp.hdcp_context.context.bin_desc.start_addr = - (uint8_t *)ta_hdr + - le32_to_cpu( - ta_hdr->header.ucode_array_offset_bytes); - - adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version); - - adev->psp.dtm_context.context.bin_desc.fw_version = - le32_to_cpu(ta_hdr->dtm.fw_version); - adev->psp.dtm_context.context.bin_desc.size_bytes = - le32_to_cpu(ta_hdr->dtm.size_bytes); - adev->psp.dtm_context.context.bin_desc.start_addr = - (uint8_t *)adev->psp.hdcp_context.context - .bin_desc.start_addr + - le32_to_cpu(ta_hdr->dtm.offset_bytes); - } + err = psp_init_ta_microcode(psp, ucode_prefix); + if (err) + return err; break; case IP_VERSION(11, 0, 7): case IP_VERSION(11, 0, 11): @@ -237,11 +182,6 @@ static int psp_v11_0_init_microcode(struct psp_context *psp) } return 0; - -out2: - release_firmware(adev->psp.ta_fw); - adev->psp.ta_fw = NULL; - return err; } static int psp_v11_0_wait_for_bootloader(struct psp_context *psp) diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c index 8ed2281b6557..634fa2822d8a 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c @@ -49,9 +49,8 @@ static int psp_v12_0_init_microcode(struct psp_context *psp) { struct amdgpu_device *adev = psp->adev; const char *chip_name; - char fw_name[30]; + char ucode_prefix[30]; int err = 0; - const struct ta_firmware_header_v1_0 *ta_hdr; DRM_DEBUG("\n"); switch (adev->asic_type) { @@ -64,67 +63,12 @@ static int psp_v12_0_init_microcode(struct psp_context *psp) default: BUG(); } + amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix)); err = psp_init_asd_microcode(psp, chip_name); if (err) return err; - - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name); - err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev); - if (err) { - release_firmware(adev->psp.ta_fw); - adev->psp.ta_fw = NULL; - dev_info(adev->dev, - "psp v12.0: Failed to load firmware \"%s\"\n", - fw_name); - } else { - err = amdgpu_ucode_validate(adev->psp.ta_fw); - if (err) - goto out; - - ta_hdr = (const struct ta_firmware_header_v1_0 *) - adev->psp.ta_fw->data; - adev->psp.hdcp_context.context.bin_desc.fw_version = - le32_to_cpu(ta_hdr->hdcp.fw_version); - adev->psp.hdcp_context.context.bin_desc.size_bytes = - le32_to_cpu(ta_hdr->hdcp.size_bytes); - adev->psp.hdcp_context.context.bin_desc.start_addr = - (uint8_t *)ta_hdr + - le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes); - - adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version); - - adev->psp.dtm_context.context.bin_desc.fw_version = - le32_to_cpu(ta_hdr->dtm.fw_version); - adev->psp.dtm_context.context.bin_desc.size_bytes = - le32_to_cpu(ta_hdr->dtm.size_bytes); - adev->psp.dtm_context.context.bin_desc.start_addr = - (uint8_t *)adev->psp.hdcp_context.context.bin_desc.start_addr + - le32_to_cpu(ta_hdr->dtm.offset_bytes); - - if (adev->apu_flags & AMD_APU_IS_RENOIR) { - adev->psp.securedisplay_context.context.bin_desc.fw_version = - le32_to_cpu(ta_hdr->securedisplay.fw_version); - adev->psp.securedisplay_context.context.bin_desc.size_bytes = - le32_to_cpu(ta_hdr->securedisplay.size_bytes); - adev->psp.securedisplay_context.context.bin_desc.start_addr = - (uint8_t *)adev->psp.hdcp_context.context.bin_desc.start_addr + - le32_to_cpu(ta_hdr->securedisplay.offset_bytes); - } - } - - return 0; - -out: - release_firmware(adev->psp.ta_fw); - adev->psp.ta_fw = NULL; - if (err) { - dev_err(adev->dev, - "psp v12.0: Failed to load firmware \"%s\"\n", - fw_name); - } - - return err; + return psp_init_ta_microcode(psp, ucode_prefix); } static int psp_v12_0_bootloader_load_sysdrv(struct psp_context *psp) From patchwork Wed Jan 4 16:40:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9E24DC4708D for ; Wed, 4 Jan 2023 16:43:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 02ACC10E571; Wed, 4 Jan 2023 16:43:18 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7FA9510E53E; Wed, 4 Jan 2023 16:43:10 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L+CVCvWaULp8oMn4uPFsVAnVe1bJ7NPzX1YkSRw+fI9P/0UBhI96jZr+aT9pTrAkt49XeXTmR1UZY01pfrnwgbOYjhFx4g879nzLrumIFZxvb304NqpnTEREbUdlFAvfKLpvoT/pOfO0BppohZ/q8ckd6lRUfqlxetKRTAHmVnHff0OJxPYVXizrUpDz6aDltgFcTjy3CIwAoG7bjLeVmycRtFgApC5F01iKw8EusLaqdK9eqS47myUcsjpW8ZcPNe6jbIYfv43db3WW1osL5RrfOMvRT9TRVQwsJd0bYQCdr4jgyDHrm3+yPyQfCsPbdDK/nJRYJcfxcDvEKuhF3Q== 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=1ZPLroUHJnEcEoKdznZ8w/er9pKPntcuefEAqwnvnFs=; b=BXLkrgonO1mtEf0qNUW1W+hygLGbaSnRp1s94L4Gw3OlHXzljKNkpS6r33W/STfeLahnYglCrMhUb9peeoLMluScSvtYtoCb2NSnB7IUnPqYYmLHpB9E6++fsn3uWPcrL5901nYxvplmIShsQ5WGnrt/pmmxgIZQPYfCH+FCEjGFmjN7WzAiribBUbyyi+LaCGyFTwhtBsUrT0llBYOTHJDAp3FzOcZtNiRHLpS2+eF6FjzILJ3Shwy86H5cF8VIJnmag0sY+Fq9eFrtCFMy3QvzuMsgRhRy3SDVUXnmQaFex5XM9zeZGOnnVVVIzdBwEgE5cwi0y/ArpyX9O4AWHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1ZPLroUHJnEcEoKdznZ8w/er9pKPntcuefEAqwnvnFs=; b=GM4Hg2Nol7naD5vRRep6HYOLJwfG8fxKeNuL6gyhTEww1ZCIwzXycaoyeVZSgI5X01bfJFn5xVQOarPJsUDx/X+y5FRepfWCD44ozO8EUjsfnjbcAUVhDM1KzR1IDZMUhTywMqNPZuEGocfnIuqM1P149T5Wlk1+j3yTrpvI+Ps= Received: from MN2PR16CA0066.namprd16.prod.outlook.com (2603:10b6:208:234::35) by DS0PR12MB8415.namprd12.prod.outlook.com (2603:10b6:8:fc::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:43:08 +0000 Received: from BL02EPF00010206.namprd05.prod.outlook.com (2603:10b6:208:234:cafe::67) by MN2PR16CA0066.outlook.office365.com (2603:10b6:208:234::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:43:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010206.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:43:08 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:43:03 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 21/45] drm/amd: Avoid BUG() for case of SRIOV missing IP version Date: Wed, 4 Jan 2023 10:40:10 -0600 Message-ID: <20230104164042.30271-22-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010206:EE_|DS0PR12MB8415:EE_ X-MS-Office365-Filtering-Correlation-Id: 3960df6a-4d82-451f-0a71-08daee72c289 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IvW/O5ZKhW1CB6rB30SO+nUPMwLX4r/pChgaQUCmXa8yA3J5RRnGcRPVhZUhyuE+OTHsu87RlHi/GdfCpHmdL0hW/VV/wEsUsu8iNL/tSY87TxKBTmBDC/PbzYl5NLJuWIj+loM2m5BntgbIPwRLLux847uA4zlEdGWwH3pWSZmGXdoEo+cIVmW9kNVNu+/8eThqnIQQK4jllP+xImDMEH9EyyRV6t7cdPS6aVn8LEynwpMNpE5DCP5jHAhVTnYNZ9zvpYdLRf0aOizX+sluywrEW238+tFXnqfrjE1R1w7aVTv2xs6pYKNAF6BWYaQI8Lqhz9qL56eMZHCGNaZJgptnxO4dgNnZPpEz9fITSIKes5Iy0ueorabA7xriyZxwyJrT/kRxcxVQphgjasYHeQkdNr0gWeqv0UbdhZFJjutlFMMrstVhUvAb2MJ59a7BrVdyMyEt8/6b/FbiZTYOS+CZbiIyzygFqw26FbdN4P5znVVOyVh+xaVRKO1rsHoNNRLFjwwaQTQT9ZMTeAdj8GqG3buKMcFM1Mhn8d9p7c/M4+cAliV6bQ1w5cJJEft4/uxK/gUD8xMgjZVb2osGCQEDtvbJFLFPUbX+PjEXf5w98D9QwVrSSzMi7go8JSvLDz2fpgxL7MYGyE4sXSTU8sV/RU6Tt9sZ+eAFGUsh45GYGukxGRjL4+vrXuZZjuJsFiCRaXY+PVhgE1NEFaRRd6OhUehhNAQvtO246wmzIF4= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(346002)(376002)(396003)(136003)(451199015)(46966006)(36840700001)(40470700004)(2616005)(336012)(36860700001)(83380400001)(1076003)(426003)(47076005)(40480700001)(86362001)(40460700003)(81166007)(82310400005)(356005)(82740400003)(36756003)(4744005)(110136005)(54906003)(316002)(2906002)(41300700001)(44832011)(70586007)(8936002)(4326008)(70206006)(8676002)(26005)(186003)(478600001)(6666004)(16526019)(5660300002)(7696005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:43:08.3321 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3960df6a-4d82-451f-0a71-08daee72c289 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010206.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8415 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" No need to crash the kernel. AMDGPU will now fail to probe. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index d971e3785eaf..a4a62753bfd6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -380,7 +380,7 @@ static int psp_init_sriov_microcode(struct psp_context *psp) adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MES1_DATA; break; default: - BUG(); + ret = -EINVAL; break; } return ret; From patchwork Wed Jan 4 16:40:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 089DBC4332F for ; Wed, 4 Jan 2023 16:43:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B3AF310E588; Wed, 4 Jan 2023 16:43:19 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2062.outbound.protection.outlook.com [40.107.223.62]) by gabe.freedesktop.org (Postfix) with ESMTPS id D6DB210E551; Wed, 4 Jan 2023 16:43:11 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nycI4RxBDiL8AtcBmetrlavhs4WcY8I8GC4QSxqpRk+LXzWm4Z3xC/jLGka3Wr92IXGpEg1nTMXtBiBRbhkXvt3SjYD5A5Bhr2QLX1d3mm2MeCLyQA/kJnkg425UN/RpTPWJ3hXWvwZoZd4RR4hGMEtTz1EUvL6stR2Z7m1IRZPLAX2yGu8GjV/flUYCc3WQBjiihpU/oWT4tTdc89G9cvGMtYMrKuuHSg03FveStlDRc0KHmYOT51B78cTpIMMx/xZjLCVZ44pyV/SH8QQN80sLAedqbVNF1yeaVQ0lLzWWIWdKCMNjBwLmY9ThVJSRS99KA6ldVHgXZFufPyCxYg== 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=w4LG8ljH5D+j7uaxA2q62hGzc+4PSKUxY3ApNpX7YoE=; b=WKLB+5MZf3jMdX29hEyYlgYm40mhCRKRguR21xL8SLzyboThNZDdXmVo/oYTcuihQEcDaoiLGqrmWX64K9jQ5tt2RSDMVdTwuVDN+xXfy6mClm+XFrXogsyLTRa9oWj8eBbnQ2kOCQIIjIo8uRSAQSj3H8KP/lvPJ74DnOfgMpnHBvXGOUa/sAoUkBPTANQekU/QYhwAlkitYDiiLKs1pX5F02xFm6OvIGrelLeI60jBvLMyg38yhRPWM0mOTyjJtf9j8cWcC1P2uSJQqt19Te0HMx64hdWFQRaGa42KU0Am9uDcx7VFVnJakLbtnL3WWbpT56FNc/wyX3YzAMgeqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w4LG8ljH5D+j7uaxA2q62hGzc+4PSKUxY3ApNpX7YoE=; b=PhXjFmMSayAcqn3wn03jw/QnYBVFDx0w7n5p0NOdBccPEUa2E7srV20alpyhLaiI3E8PzBp/hNTsWQnTX6Le8ylw+u2bM0swOXu81EbOyX2aMgJqslQznwAZrt+5PviWRSa94Ni0/6nSoqAAQ/Wo/cpCfWAT4hgdMiO/jdSdZsQ= Received: from BN9PR03CA0614.namprd03.prod.outlook.com (2603:10b6:408:106::19) by PH7PR12MB7139.namprd12.prod.outlook.com (2603:10b6:510:1ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:43:09 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::44) by BN9PR03CA0614.outlook.office365.com (2603:10b6:408:106::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:43:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:43:08 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:43:05 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 22/45] drm/amd: Load PSP microcode during early_init Date: Wed, 4 Jan 2023 10:40:11 -0600 Message-ID: <20230104164042.30271-23-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|PH7PR12MB7139:EE_ X-MS-Office365-Filtering-Correlation-Id: 576b7b45-e943-4ab3-bebd-08daee72c2c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5BfiJ1j/lnLegbA2IPGPgkk/sZ/caf2DePvDERthOyAbOUzFVRLwV7zSyDYXkUKM8UBjo4GyY33bEmK4Vr30Y5lvuzo8d+dCyNNm+GfKPE9knYWAmkod8gd1lIgJleX7LbxjqHNcmeNnGvxqrQtpMug+yzfN23i0Yd72MyM5kYM/766jGgC1YbBkyDPV1IkVYq8WqsjP/qmvegz4Uy60NkzaKfEy4pDFEIZfLNSysfBBsiCrcZECU8HBWIHhtAvYik9bSAqEnvhAQrYgxohYhLw4+q/75LdC95GJq0F+QtK2KzoD5gMYs6Tw/zdws4/X65I6LdR+lE5jTkhiyMIvwIl1LFoJP1BE2m+ebBpkXo75i7Xz+nKpSia5+Cnc5p6N3QElknPbNwYUFPeSyr4wkyeMq2X8E3aZnUOs5dauOwvmhtM9VIZUGwcbelDnAdp4k7xQ0cNInz72sQTna6pZq5VfjjobQ/W/l7aPsL5yB02D4YUj/2h8FfzoAlVEdo3WwCnE0YhLcEgBmnqsOxQGQacacc4EiByyqGqy/rvBlObZo5EaDD/+L1DhmA3OHbgPgXzaAos23ODpYg9LBT7rqdZ6IDLzYUA6M/Df0y7MlWJRQSxNRwmNWJ+FS44fgMzIV606RT7sZWc8Wbhh2WOwMW3kryT7sVs9TmpvXoNHxjDWhlU9BXW9pDvazGyGoobu90nQPr1dvRYJoTv2WwjlaqBH+QYnZxwUWJLDjCzzV3o= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(346002)(39860400002)(136003)(451199015)(36840700001)(40470700004)(46966006)(16526019)(54906003)(316002)(6666004)(186003)(110136005)(7696005)(26005)(70586007)(478600001)(8676002)(4326008)(1076003)(70206006)(336012)(2616005)(41300700001)(47076005)(426003)(8936002)(5660300002)(83380400001)(30864003)(44832011)(2906002)(36756003)(82740400003)(36860700001)(40460700003)(81166007)(40480700001)(86362001)(356005)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:43:08.7299 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 576b7b45-e943-4ab3-bebd-08daee72c2c5 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7139 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Simplifies the code so that all PSP versions will get the firmware name from `amdgpu_ucode_ip_version_decode` and then use this filename to load microcode as part of the early_init process. Any failures will cause the driver to fail to probe before the firmware framebuffer has been removed. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 120 +++++++++-------------- drivers/gpu/drm/amd/amdgpu/psp_v10_0.c | 16 +-- drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 55 ++--------- drivers/gpu/drm/amd/amdgpu/psp_v12_0.c | 13 +-- drivers/gpu/drm/amd/amdgpu/psp_v13_0.c | 27 ++--- drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c | 14 +-- drivers/gpu/drm/amd/amdgpu/psp_v3_1.c | 16 +-- 7 files changed, 72 insertions(+), 189 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index a4a62753bfd6..beaca5846c73 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -122,6 +122,44 @@ static void psp_check_pmfw_centralized_cstate_management(struct psp_context *psp } } +static int psp_init_sriov_microcode(struct psp_context *psp) +{ + struct amdgpu_device *adev = psp->adev; + char ucode_prefix[30]; + int ret = 0; + + amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix)); + + switch (adev->ip_versions[MP0_HWIP][0]) { + case IP_VERSION(9, 0, 0): + adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; + ret = psp_init_cap_microcode(psp, ucode_prefix); + break; + case IP_VERSION(11, 0, 9): + adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; + ret = psp_init_cap_microcode(psp, ucode_prefix); + break; + case IP_VERSION(11, 0, 7): + adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; + ret = psp_init_cap_microcode(psp, ucode_prefix); + break; + case IP_VERSION(13, 0, 2): + adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; + ret = psp_init_cap_microcode(psp, ucode_prefix); + ret &= psp_init_ta_microcode(psp, ucode_prefix); + break; + case IP_VERSION(13, 0, 0): + adev->virt.autoload_ucode_id = 0; + break; + case IP_VERSION(13, 0, 10): + adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MES1_DATA; + break; + default: + return -EINVAL; + } + return ret; +} + static int psp_early_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -192,7 +230,10 @@ static int psp_early_init(void *handle) psp_check_pmfw_centralized_cstate_management(psp); - return 0; + if (amdgpu_sriov_vf(adev)) + return psp_init_sriov_microcode(psp); + else + return psp_init_microcode(psp); } void psp_ta_free_shared_buf(struct ta_mem_context *mem_ctx) @@ -350,42 +391,6 @@ static bool psp_get_runtime_db_entry(struct amdgpu_device *adev, return ret; } -static int psp_init_sriov_microcode(struct psp_context *psp) -{ - struct amdgpu_device *adev = psp->adev; - int ret = 0; - - switch (adev->ip_versions[MP0_HWIP][0]) { - case IP_VERSION(9, 0, 0): - adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; - ret = psp_init_cap_microcode(psp, "vega10"); - break; - case IP_VERSION(11, 0, 9): - adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; - ret = psp_init_cap_microcode(psp, "navi12"); - break; - case IP_VERSION(11, 0, 7): - adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; - ret = psp_init_cap_microcode(psp, "sienna_cichlid"); - break; - case IP_VERSION(13, 0, 2): - adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; - ret = psp_init_cap_microcode(psp, "aldebaran"); - ret &= psp_init_ta_microcode(psp, "aldebaran"); - break; - case IP_VERSION(13, 0, 0): - adev->virt.autoload_ucode_id = 0; - break; - case IP_VERSION(13, 0, 10): - adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MES1_DATA; - break; - default: - ret = -EINVAL; - break; - } - return ret; -} - static int psp_sw_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -401,15 +406,6 @@ static int psp_sw_init(void *handle) ret = -ENOMEM; } - if (amdgpu_sriov_vf(adev)) - ret = psp_init_sriov_microcode(psp); - else - ret = psp_init_microcode(psp); - if (ret) { - DRM_ERROR("Failed to load psp firmware!\n"); - return ret; - } - adev->psp.xgmi_context.supports_extended_data = !adev->gmc.xgmi.connected_to_cpu && adev->ip_versions[MP0_HWIP][0] == IP_VERSION(13, 0, 2); @@ -2908,19 +2904,13 @@ int psp_ring_cmd_submit(struct psp_context *psp, return 0; } -int psp_init_asd_microcode(struct psp_context *psp, - const char *chip_name) +int psp_init_asd_microcode(struct psp_context *psp, const char *chip_name) { struct amdgpu_device *adev = psp->adev; char fw_name[PSP_FW_NAME_LEN]; const struct psp_firmware_header_v1_0 *asd_hdr; int err = 0; - if (!chip_name) { - dev_err(adev->dev, "invalid chip name for asd microcode\n"); - return -EINVAL; - } - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_asd.bin", chip_name); err = request_firmware(&adev->psp.asd_fw, fw_name, adev->dev); if (err) @@ -2944,19 +2934,13 @@ int psp_init_asd_microcode(struct psp_context *psp, return err; } -int psp_init_toc_microcode(struct psp_context *psp, - const char *chip_name) +int psp_init_toc_microcode(struct psp_context *psp, const char *chip_name) { struct amdgpu_device *adev = psp->adev; char fw_name[PSP_FW_NAME_LEN]; const struct psp_firmware_header_v1_0 *toc_hdr; int err = 0; - if (!chip_name) { - dev_err(adev->dev, "invalid chip name for toc microcode\n"); - return -EINVAL; - } - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_toc.bin", chip_name); err = request_firmware(&adev->psp.toc_fw, fw_name, adev->dev); if (err) @@ -3107,8 +3091,7 @@ static int psp_init_sos_base_fw(struct amdgpu_device *adev) return 0; } -int psp_init_sos_microcode(struct psp_context *psp, - const char *chip_name) +int psp_init_sos_microcode(struct psp_context *psp, const char *chip_name) { struct amdgpu_device *adev = psp->adev; char fw_name[PSP_FW_NAME_LEN]; @@ -3121,11 +3104,6 @@ int psp_init_sos_microcode(struct psp_context *psp, uint8_t *ucode_array_start_addr; int fw_index = 0; - if (!chip_name) { - dev_err(adev->dev, "invalid chip name for sos microcode\n"); - return -EINVAL; - } - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sos.bin", chip_name); err = request_firmware(&adev->psp.sos_fw, fw_name, adev->dev); if (err) @@ -3391,8 +3369,7 @@ int psp_init_ta_microcode(struct psp_context *psp, const char *chip_name) return err; } -int psp_init_cap_microcode(struct psp_context *psp, - const char *chip_name) +int psp_init_cap_microcode(struct psp_context *psp, const char *chip_name) { struct amdgpu_device *adev = psp->adev; char fw_name[PSP_FW_NAME_LEN]; @@ -3400,11 +3377,6 @@ int psp_init_cap_microcode(struct psp_context *psp, struct amdgpu_firmware_info *info = NULL; int err = 0; - if (!chip_name) { - dev_err(adev->dev, "invalid chip name for cap microcode\n"); - return -EINVAL; - } - if (!amdgpu_sriov_vf(adev)) { dev_err(adev->dev, "cap microcode should only be loaded under SRIOV\n"); return -EINVAL; diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c index 7fb48c1dec71..e1b7fca09666 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c @@ -47,27 +47,15 @@ MODULE_FIRMWARE("amdgpu/raven_ta.bin"); static int psp_v10_0_init_microcode(struct psp_context *psp) { struct amdgpu_device *adev = psp->adev; - const char *chip_name; char ucode_prefix[30]; int err = 0; DRM_DEBUG("\n"); - switch (adev->asic_type) { - case CHIP_RAVEN: - if (adev->apu_flags & AMD_APU_IS_RAVEN2) - chip_name = "raven2"; - else if (adev->apu_flags & AMD_APU_IS_PICASSO) - chip_name = "picasso"; - else - chip_name = "raven"; - break; - default: BUG(); - } amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix)); - err = psp_init_asd_microcode(psp, chip_name); + err = psp_init_asd_microcode(psp, ucode_prefix); if (err) - goto out; + return err; return psp_init_ta_microcode(psp, ucode_prefix); } diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c index 5f140b7c30d2..5fb572d3e42a 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c @@ -88,57 +88,20 @@ MODULE_FIRMWARE("amdgpu/beige_goby_ta.bin"); static int psp_v11_0_init_microcode(struct psp_context *psp) { struct amdgpu_device *adev = psp->adev; - const char *chip_name; - char fw_name[PSP_FW_NAME_LEN]; + char ucode_prefix[30]; int err = 0; - const struct ta_firmware_header_v1_0 *ta_hdr; DRM_DEBUG("\n"); - switch (adev->ip_versions[MP0_HWIP][0]) { - case IP_VERSION(11, 0, 2): - chip_name = "vega20"; - break; - case IP_VERSION(11, 0, 0): - chip_name = "navi10"; - break; - case IP_VERSION(11, 0, 5): - chip_name = "navi14"; - break; - case IP_VERSION(11, 0, 9): - chip_name = "navi12"; - break; - case IP_VERSION(11, 0, 4): - chip_name = "arcturus"; - break; - case IP_VERSION(11, 0, 7): - chip_name = "sienna_cichlid"; - break; - case IP_VERSION(11, 0, 11): - chip_name = "navy_flounder"; - break; - case IP_VERSION(11, 5, 0): - chip_name = "vangogh"; - break; - case IP_VERSION(11, 0, 12): - chip_name = "dimgrey_cavefish"; - break; - case IP_VERSION(11, 0, 13): - chip_name = "beige_goby"; - break; - default: - BUG(); - } amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix)); - switch (adev->ip_versions[MP0_HWIP][0]) { case IP_VERSION(11, 0, 2): case IP_VERSION(11, 0, 4): - err = psp_init_sos_microcode(psp, chip_name); + err = psp_init_sos_microcode(psp, ucode_prefix); if (err) return err; - err = psp_init_asd_microcode(psp, chip_name); + err = psp_init_asd_microcode(psp, ucode_prefix); if (err) return err; err = psp_init_ta_microcode(psp, ucode_prefix); @@ -148,10 +111,10 @@ static int psp_v11_0_init_microcode(struct psp_context *psp) case IP_VERSION(11, 0, 0): case IP_VERSION(11, 0, 5): case IP_VERSION(11, 0, 9): - err = psp_init_sos_microcode(psp, chip_name); + err = psp_init_sos_microcode(psp, ucode_prefix); if (err) return err; - err = psp_init_asd_microcode(psp, chip_name); + err = psp_init_asd_microcode(psp, ucode_prefix); if (err) return err; err = psp_init_ta_microcode(psp, ucode_prefix); @@ -162,18 +125,18 @@ static int psp_v11_0_init_microcode(struct psp_context *psp) case IP_VERSION(11, 0, 11): case IP_VERSION(11, 0, 12): case IP_VERSION(11, 0, 13): - err = psp_init_sos_microcode(psp, chip_name); + err = psp_init_sos_microcode(psp, ucode_prefix); if (err) return err; - err = psp_init_ta_microcode(psp, chip_name); + err = psp_init_ta_microcode(psp, ucode_prefix); if (err) return err; break; case IP_VERSION(11, 5, 0): - err = psp_init_asd_microcode(psp, chip_name); + err = psp_init_asd_microcode(psp, ucode_prefix); if (err) return err; - err = psp_init_toc_microcode(psp, chip_name); + err = psp_init_toc_microcode(psp, ucode_prefix); if (err) return err; break; diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c index 634fa2822d8a..45810e4a7e45 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c @@ -48,24 +48,13 @@ MODULE_FIRMWARE("amdgpu/green_sardine_ta.bin"); static int psp_v12_0_init_microcode(struct psp_context *psp) { struct amdgpu_device *adev = psp->adev; - const char *chip_name; char ucode_prefix[30]; int err = 0; DRM_DEBUG("\n"); - switch (adev->asic_type) { - case CHIP_RENOIR: - if (adev->apu_flags & AMD_APU_IS_RENOIR) - chip_name = "renoir"; - else - chip_name = "green_sardine"; - break; - default: - BUG(); - } amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix)); - err = psp_init_asd_microcode(psp, chip_name); + err = psp_init_asd_microcode(psp, ucode_prefix); if (err) return err; return psp_init_ta_microcode(psp, ucode_prefix); diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v13_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v13_0.c index e6a26a7e5e5e..d62fcc77af95 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v13_0.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v13_0.c @@ -70,32 +70,19 @@ MODULE_FIRMWARE("amdgpu/psp_13_0_11_ta.bin"); static int psp_v13_0_init_microcode(struct psp_context *psp) { struct amdgpu_device *adev = psp->adev; - const char *chip_name; char ucode_prefix[30]; int err = 0; - switch (adev->ip_versions[MP0_HWIP][0]) { - case IP_VERSION(13, 0, 2): - chip_name = "aldebaran"; - break; - case IP_VERSION(13, 0, 1): - case IP_VERSION(13, 0, 3): - chip_name = "yellow_carp"; - break; - default: - amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix)); - chip_name = ucode_prefix; - break; - } + amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix)); switch (adev->ip_versions[MP0_HWIP][0]) { case IP_VERSION(13, 0, 2): - err = psp_init_sos_microcode(psp, chip_name); + err = psp_init_sos_microcode(psp, ucode_prefix); if (err) return err; /* It's not necessary to load ras ta on Guest side */ if (!amdgpu_sriov_vf(adev)) { - err = psp_init_ta_microcode(&adev->psp, chip_name); + err = psp_init_ta_microcode(psp, ucode_prefix); if (err) return err; } @@ -105,21 +92,21 @@ static int psp_v13_0_init_microcode(struct psp_context *psp) case IP_VERSION(13, 0, 5): case IP_VERSION(13, 0, 8): case IP_VERSION(13, 0, 11): - err = psp_init_toc_microcode(psp, chip_name); + err = psp_init_toc_microcode(psp, ucode_prefix); if (err) return err; - err = psp_init_ta_microcode(psp, chip_name); + err = psp_init_ta_microcode(psp, ucode_prefix); if (err) return err; break; case IP_VERSION(13, 0, 0): case IP_VERSION(13, 0, 7): case IP_VERSION(13, 0, 10): - err = psp_init_sos_microcode(psp, chip_name); + err = psp_init_sos_microcode(psp, ucode_prefix); if (err) return err; /* It's not necessary to load ras ta on Guest side */ - err = psp_init_ta_microcode(psp, chip_name); + err = psp_init_ta_microcode(psp, ucode_prefix); if (err) return err; break; diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c b/drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c index 9d4e24e518e8..d5ba58eba3e2 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c @@ -35,25 +35,17 @@ MODULE_FIRMWARE("amdgpu/psp_13_0_4_ta.bin"); static int psp_v13_0_4_init_microcode(struct psp_context *psp) { struct amdgpu_device *adev = psp->adev; - const char *chip_name; char ucode_prefix[30]; int err = 0; - switch (adev->ip_versions[MP0_HWIP][0]) { - case IP_VERSION(13, 0, 4): - amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix)); - chip_name = ucode_prefix; - break; - default: - BUG(); - } + amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix)); switch (adev->ip_versions[MP0_HWIP][0]) { case IP_VERSION(13, 0, 4): - err = psp_init_toc_microcode(psp, chip_name); + err = psp_init_toc_microcode(psp, ucode_prefix); if (err) return err; - err = psp_init_ta_microcode(psp, chip_name); + err = psp_init_ta_microcode(psp, ucode_prefix); if (err) return err; break; diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c index 157147c6c94e..f6b75e3e47ff 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c @@ -57,26 +57,18 @@ static int psp_v3_1_ring_stop(struct psp_context *psp, static int psp_v3_1_init_microcode(struct psp_context *psp) { struct amdgpu_device *adev = psp->adev; - const char *chip_name; + char ucode_prefix[30]; int err = 0; DRM_DEBUG("\n"); - switch (adev->asic_type) { - case CHIP_VEGA10: - chip_name = "vega10"; - break; - case CHIP_VEGA12: - chip_name = "vega12"; - break; - default: BUG(); - } + amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix)); - err = psp_init_sos_microcode(psp, chip_name); + err = psp_init_sos_microcode(psp, ucode_prefix); if (err) return err; - err = psp_init_asd_microcode(psp, chip_name); + err = psp_init_asd_microcode(psp, ucode_prefix); if (err) return err; From patchwork Wed Jan 4 16:40:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088754 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AC770C46467 for ; Wed, 4 Jan 2023 16:43:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A217A10E567; Wed, 4 Jan 2023 16:43:20 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2044.outbound.protection.outlook.com [40.107.92.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id 84FB710E53E; Wed, 4 Jan 2023 16:43:11 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QaajcZgY2Xmtr07Q5WbdPpwqFpWefXEos9ULnMw0iTNbfiOZhltibr1L/rFMiypgMdgkmIhqyHRsIFG1mWx1hFcMrvXcUX64gPMXhVUPGq4w70jWOsXIph6rOoRVtdwd6QK3qtLC/Hvlqlg0sWHR8T5XpfJzJVFYJqNPZPM+/LdQrLriF3itLssDannuqaRzq+9eKD+8iHsB/MnyDg9xNugJtrkDyzFm4RbLk687l8g1yiinb5CLVG9p1uZtITfzP6FkkGhOQeghg1RLUJIHXtEE99ylQbPInOYzwT9EBt0tvgCUmkqzRu40q6zrklBigRCokU/+AKXQS8nf0zWZLA== 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=MTTm8v6JricYqEcyTi+Bi6psl2A+KKp8lyx7d2ID5U8=; b=cabcTzg3pTXr7UNB2XjoV+FfNzpkFotQFh9BpiMhavIjpAFSyuiuBqDi7+jOotaGqV3T3zUql6EJ5QQOwOY+rDUqQAm/2ty412Y7Rguv71s+Tvtb7frlLrztDzNMYriNlMW/sazbvN0iv389j7ILEq2cpecjlFc0kNoDhTi7V1EhUF9TO7BMr7P9ut2AAjUDAoa6+nVaOw2Pd+gjXPpvWWEb2fup/ZC9ElcP4XVm6qZDIkwlJMM9CzUJhdopy4AZF2RxXmSAKG34dNQDRSEZiqvKrDwaOB6v3mY4ucz9OZkF4g1CZA4linORrTrPnhLprXA3OTSF8PVbMKLVB3L2zg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MTTm8v6JricYqEcyTi+Bi6psl2A+KKp8lyx7d2ID5U8=; b=vlqAQuhRHshaC7VBOa4EnNps1zpHzVyFnlnW8waSqABOhN5NHv7CSVBVxg44eHgq01lm8yWDzM7UkPatBLOer9s4cvloDIJpdFHqQNhFZDcWOdru+qMfaZOd2wX3P5eCqv4ZXk9307IbykG8sZiZMLw9rDs7XCyKG0gQ6Ozq4Qk= Received: from MN2PR16CA0050.namprd16.prod.outlook.com (2603:10b6:208:234::19) by SA1PR12MB7223.namprd12.prod.outlook.com (2603:10b6:806:2bc::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:43:08 +0000 Received: from BL02EPF00010206.namprd05.prod.outlook.com (2603:10b6:208:234:cafe::82) by MN2PR16CA0050.outlook.office365.com (2603:10b6:208:234::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:43:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010206.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:43:08 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:43:06 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 23/45] drm/amd: Use `amdgpu_ucode_*` helpers for PSP Date: Wed, 4 Jan 2023 10:40:12 -0600 Message-ID: <20230104164042.30271-24-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010206:EE_|SA1PR12MB7223:EE_ X-MS-Office365-Filtering-Correlation-Id: 15dd52f5-7faa-4fb1-6a1d-08daee72c2c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I6LSXlBOSpDJkDI9/t4aiXTzo0qMAb9516Tb13uG1u1an1JjmyznG2EtEjAVO60xE7X0zc992Qn9Nt38GiUWC1T91cJlrYophX56oSesRqVdTRLVcI4jZVDb1EQfnIOvV+xTo3YyFD2ku0BU8Ck+omrVbAK3CuS+oBYoV1n6xUsyJN33P33adMjkuAEzS491ilElMreigDskbfWWMxAY/cO91t1weE2jKIUu5gwb8ZRSMgQIUAplofdUYmWJmcWGTkxq2DBzukR4TbVjFDv79A3srKwpBRpUg+bmQ0+YUG2XGvV0wo1R8lt0bgtLcJjwOxwVsWflhGvQ4E+KZKu01Qvr+nYt7XWgKr1TYnteF8DEE/LyQzq8dfH06Oal3PNsgYjP08EsUBEhcBLFoa0yJ+G2xMi/gyJNgXSV1R4IIAwOkpJx8FNJzbPV9zZJh2Bffu2jzzMKT41jN1c0fyJ7P10aoZ2LIHHTaYu1KjrxGpfawCAW7CZsSoSKxW9WYhOuHftWdsi0VTb2dzACGooOEZTdhqR70z15rXm9bZjHFkJLY/g6LPGvYYQv3upv64qATitBbS2z6Vhjqrwl8JKnhOHORhXffdmSP6mEaNwkfA1Fb0spUZJf1laVqnzdwOcKtHotb0V2cNVAIE8k7DlMJvZ37y/tWKJDFubU26dYHRxcS23dp3idEWKRFA0tGW3mCCPUVUwogs3H/JMdYQRQJSpRwKT97nGeFOEwEAeu/bfiMvR8TcPohTjx4FI6CjyHBZiFExtgARDcCiV9/8ExXQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(346002)(39860400002)(136003)(451199015)(46966006)(36840700001)(40470700004)(16526019)(54906003)(316002)(6666004)(7696005)(26005)(110136005)(186003)(1076003)(478600001)(2616005)(70206006)(8676002)(336012)(70586007)(4326008)(82740400003)(426003)(41300700001)(2906002)(47076005)(83380400001)(8936002)(5660300002)(44832011)(86362001)(36756003)(36860700001)(40460700003)(356005)(40480700001)(81166007)(82310400005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:43:08.7540 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 15dd52f5-7faa-4fb1-6a1d-08daee72c2c9 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010206.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7223 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 80 +++++++------------------ 1 file changed, 21 insertions(+), 59 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index beaca5846c73..8a3a38ea7b46 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -510,20 +510,11 @@ static int psp_sw_fini(void *handle) psp_memory_training_fini(psp); - release_firmware(psp->sos_fw); - psp->sos_fw = NULL; - - release_firmware(psp->asd_fw); - psp->asd_fw = NULL; - - release_firmware(psp->ta_fw); - psp->ta_fw = NULL; - - release_firmware(psp->cap_fw); - psp->cap_fw = NULL; - - release_firmware(psp->toc_fw); - psp->toc_fw = NULL; + amdgpu_ucode_release(psp->sos_fw); + amdgpu_ucode_release(psp->asd_fw); + amdgpu_ucode_release(psp->ta_fw); + amdgpu_ucode_release(psp->cap_fw); + amdgpu_ucode_release(psp->toc_fw); if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 0) || adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7)) @@ -2912,11 +2903,7 @@ int psp_init_asd_microcode(struct psp_context *psp, const char *chip_name) int err = 0; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_asd.bin", chip_name); - err = request_firmware(&adev->psp.asd_fw, fw_name, adev->dev); - if (err) - goto out; - - err = amdgpu_ucode_validate(adev->psp.asd_fw); + err = amdgpu_ucode_request(adev, &adev->psp.asd_fw, fw_name); if (err) goto out; @@ -2928,9 +2915,7 @@ int psp_init_asd_microcode(struct psp_context *psp, const char *chip_name) le32_to_cpu(asd_hdr->header.ucode_array_offset_bytes); return 0; out: - dev_err(adev->dev, "fail to initialize asd microcode\n"); - release_firmware(adev->psp.asd_fw); - adev->psp.asd_fw = NULL; + amdgpu_ucode_release(adev->psp.asd_fw); return err; } @@ -2942,11 +2927,7 @@ int psp_init_toc_microcode(struct psp_context *psp, const char *chip_name) int err = 0; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_toc.bin", chip_name); - err = request_firmware(&adev->psp.toc_fw, fw_name, adev->dev); - if (err) - goto out; - - err = amdgpu_ucode_validate(adev->psp.toc_fw); + err = amdgpu_ucode_request(adev, &adev->psp.toc_fw, fw_name); if (err) goto out; @@ -2958,9 +2939,7 @@ int psp_init_toc_microcode(struct psp_context *psp, const char *chip_name) le32_to_cpu(toc_hdr->header.ucode_array_offset_bytes); return 0; out: - dev_err(adev->dev, "fail to request/validate toc microcode\n"); - release_firmware(adev->psp.toc_fw); - adev->psp.toc_fw = NULL; + amdgpu_ucode_release(adev->psp.toc_fw); return err; } @@ -3105,11 +3084,7 @@ int psp_init_sos_microcode(struct psp_context *psp, const char *chip_name) int fw_index = 0; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sos.bin", chip_name); - err = request_firmware(&adev->psp.sos_fw, fw_name, adev->dev); - if (err) - goto out; - - err = amdgpu_ucode_validate(adev->psp.sos_fw); + err = amdgpu_ucode_request(adev, &adev->psp.sos_fw, fw_name); if (err) goto out; @@ -3181,10 +3156,7 @@ int psp_init_sos_microcode(struct psp_context *psp, const char *chip_name) return 0; out: - dev_err(adev->dev, - "failed to init sos firmware\n"); - release_firmware(adev->psp.sos_fw); - adev->psp.sos_fw = NULL; + amdgpu_ucode_release(adev->psp.sos_fw); return err; } @@ -3340,10 +3312,7 @@ int psp_init_ta_microcode(struct psp_context *psp, const char *chip_name) int err; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name); - err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev); - if (err) - return err; - err = amdgpu_ucode_validate(adev->psp.ta_fw); + err = amdgpu_ucode_request(adev, &adev->psp.ta_fw, fw_name); if (err) return err; @@ -3360,11 +3329,8 @@ int psp_init_ta_microcode(struct psp_context *psp, const char *chip_name) err = -EINVAL; } - if (err) { - dev_err(adev->dev, "fail to initialize ta microcode\n"); - release_firmware(adev->psp.ta_fw); - adev->psp.ta_fw = NULL; - } + if (err) + amdgpu_ucode_release(adev->psp.ta_fw); return err; } @@ -3383,17 +3349,14 @@ int psp_init_cap_microcode(struct psp_context *psp, const char *chip_name) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_cap.bin", chip_name); - err = request_firmware(&adev->psp.cap_fw, fw_name, adev->dev); - if (err) { - dev_warn(adev->dev, "cap microcode does not exist, skip\n"); - err = 0; - goto out; - } - - err = amdgpu_ucode_validate(adev->psp.cap_fw); + err = amdgpu_ucode_request(adev, &adev->psp.cap_fw, fw_name); if (err) { + if (err == -ENODEV) { + dev_warn(adev->dev, "cap microcode does not exist, skip\n"); + err = 0; + goto out; + } dev_err(adev->dev, "fail to initialize cap microcode\n"); - goto out; } info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CAP]; @@ -3410,8 +3373,7 @@ int psp_init_cap_microcode(struct psp_context *psp, const char *chip_name) return 0; out: - release_firmware(adev->psp.cap_fw); - adev->psp.cap_fw = NULL; + amdgpu_ucode_release(adev->psp.cap_fw); return err; } From patchwork Wed Jan 4 16:40:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088756 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 05F5FC4708E for ; Wed, 4 Jan 2023 16:43:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6B5A210E56D; Wed, 4 Jan 2023 16:43:28 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2084.outbound.protection.outlook.com [40.107.93.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9E8C610E547; Wed, 4 Jan 2023 16:43:11 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bVlrI+dX9jOYVxMAN9fV5yXFm4cDfDMcPQLZ/XByO1sOT1hD43e/eA9VS7fvyqeMfpanA9evcRWTkK9kc9soXHDHmRfBnd7JwFxKwzTv8Z8HR/zu6b9XwxNkAmNWaWrMDhaXZ8ytB7OhHRm41qFBNcNYzg2Hsr9f+4Tqu9gCfQMY4QphfhV1rShP++c8aKcbrywBf7wmzK1JAuGiVjMVjN0sup6po+9KqD+XldrrVuBg1kJg4oLOGUAGMgSISzRNJPSp3ehkP0pcVKioVSGqCeuhKrQMFkn/QFp53y+qEdiAD3aaP9jNel3ORZatdXrKyhUi4u9IDizzXT8lJEI3bw== 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=xdFj2J0vZKmh3A/vZax61hV9ZXdK0jadgP+W7c8sDWQ=; b=UDmwiAQ9jA6inoQbC+7Il7QkQGl0ME6izJO/3OqcKGe4/3I0/loVbqAOqdeeqxh7/+kU7wrWengfHd0dF0G1GWTXvQEVf5HhbtQjB+KR6XW5/5W6pR9whT+Yso8RLqat2zgtyhLZdJvd7qFhpZJ4pUghPFRFBIvNxDmEJ3PmuZ4Cz2NS7WbkpQq2d2jcOQAOiLizJv4BVnWxuQT7S4rJvsP0JMvlutrFoDcu3A/02P/j/HWjfQAvIXTkxAZEQvRhZ582rYcbNZxa7XxepD8SWQ7+tFN4G7dOE1VJIyWv5Jybf9JEHfsrYUG2dItb9VrcQIuUQQs3xtOcT4Dgw2ZkVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xdFj2J0vZKmh3A/vZax61hV9ZXdK0jadgP+W7c8sDWQ=; b=XVG4D7TS68Hrdci9XcCGw6D0CISwPwkYqHkmXM685YXeU3lnv4p00vwmXdoQv0YS4X+dp81+9dsbr0l9d/OznzUKc6UcbFG2pUCgtRtQ3BqBijBZC9uAPKaM6DMS/OSSGIhd6vUzyJiptigAet8MsX0WwaLNgXlmRWU/LTTC0qc= Received: from MN2PR16CA0050.namprd16.prod.outlook.com (2603:10b6:208:234::19) by MW4PR12MB6777.namprd12.prod.outlook.com (2603:10b6:303:1e9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:43:09 +0000 Received: from BL02EPF00010206.namprd05.prod.outlook.com (2603:10b6:208:234:cafe::d2) by MN2PR16CA0050.outlook.office365.com (2603:10b6:208:234::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:43:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010206.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:43:09 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:43:07 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 24/45] drm/amd/display: Load DMUB microcode during early_init Date: Wed, 4 Jan 2023 10:40:13 -0600 Message-ID: <20230104164042.30271-25-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010206:EE_|MW4PR12MB6777:EE_ X-MS-Office365-Filtering-Correlation-Id: 8582c4d7-4e03-4992-b595-08daee72c315 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 64tBMjnODcEy/G+doQ6W5GYjog3ddZHeeB7bc7q/rzl9Nltlbb8fMbQn3r6oWx7v6cxDkR0Hrz83WRI694WV3h9Z4d+kNo5NhHh1T38xZmPV9Ak5hFsyN0FFhA9OXWvwvQUtfrhUUd0yQ07WXf+/bZXj0YOXTTv7XL92k3S53lBHgicSngZk1YJSyEBSwo5o3wwdTQNu4QOEcFYKbAeK2meXBclw5xiPVgF8ABXqifM7Mb19cIRxX9010JuWYTXC+KtEEKbYbnJtTY9cLPGTysWflUBm8sWSFQ4gGt0UOrz79iWh5OWoqtoZBbXaYlpPvHyIcDrze+0gegREc2Pc7LvcjOAMNACJbn0+SnSZMwo7VQ3O753DIHjNx7krFlPUSNs7pPH5CP9UTisYGTnH6F3H9Or1fcaXB/YYi6FX4S1DCiccqEaf4B8YdNvHsUOPhR3KPjfFyGWl349Ty9F+Ds5p3uz7kIe/QQ8Iondha5FYdy+H5Zd39PsHIHfy2q5SNPAh9xXJ8T31Gb0r+13RKsm0xI6SlcheHiPJMNxlvLtnpdJ2xbZ/Y+G+2o6zsAM+9YTtbipOmONVwASqs1OPXfYef/9IwwmPSc2MQltEdA9KgvF3kUBrj5lP2mk7dv+xV13EtiDCV9GeDFX43hnaK4cEgyJLPuvk/vaimDYlozhuhkfMO7v0ifFKQqqBZHv0vDFwJqQ1ttyaIwEGy2AvpJbh5AUc/Neh8xpvq6U79AU= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(346002)(136003)(396003)(376002)(451199015)(46966006)(36840700001)(40470700004)(47076005)(83380400001)(426003)(2616005)(186003)(82310400005)(16526019)(26005)(336012)(7696005)(40480700001)(6666004)(40460700003)(86362001)(36860700001)(36756003)(81166007)(356005)(1076003)(82740400003)(41300700001)(4326008)(8676002)(2906002)(5660300002)(44832011)(8936002)(316002)(478600001)(110136005)(70206006)(54906003)(70586007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:43:09.2540 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8582c4d7-4e03-4992-b595-08daee72c315 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010206.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6777 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Leo Li , Lazar Lijo , Rodrigo Siqueira , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If DMUB is required for an ASIC, ensure that the microcode is available and validates during early_init. Any failures will cause the driver to fail to probe before the firmware framebuffer has been removed. Reviewed-by: Harry Wentland Signed-off-by: Mario Limonciello --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 89 ++++++++++++------- 1 file changed, 58 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 4829b5431e4c..c8c5d37c8b3a 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1945,7 +1945,6 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev) struct dmub_srv_fb_info *fb_info; struct dmub_srv *dmub_srv; const struct dmcub_firmware_header_v1_0 *hdr; - const char *fw_name_dmub; enum dmub_asic dmub_asic; enum dmub_status status; int r; @@ -1953,73 +1952,46 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev) switch (adev->ip_versions[DCE_HWIP][0]) { case IP_VERSION(2, 1, 0): dmub_asic = DMUB_ASIC_DCN21; - fw_name_dmub = FIRMWARE_RENOIR_DMUB; - if (ASICREV_IS_GREEN_SARDINE(adev->external_rev_id)) - fw_name_dmub = FIRMWARE_GREEN_SARDINE_DMUB; break; case IP_VERSION(3, 0, 0): - if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0)) { + if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0)) dmub_asic = DMUB_ASIC_DCN30; - fw_name_dmub = FIRMWARE_SIENNA_CICHLID_DMUB; - } else { + else dmub_asic = DMUB_ASIC_DCN30; - fw_name_dmub = FIRMWARE_NAVY_FLOUNDER_DMUB; - } break; case IP_VERSION(3, 0, 1): dmub_asic = DMUB_ASIC_DCN301; - fw_name_dmub = FIRMWARE_VANGOGH_DMUB; break; case IP_VERSION(3, 0, 2): dmub_asic = DMUB_ASIC_DCN302; - fw_name_dmub = FIRMWARE_DIMGREY_CAVEFISH_DMUB; break; case IP_VERSION(3, 0, 3): dmub_asic = DMUB_ASIC_DCN303; - fw_name_dmub = FIRMWARE_BEIGE_GOBY_DMUB; break; case IP_VERSION(3, 1, 2): case IP_VERSION(3, 1, 3): dmub_asic = (adev->external_rev_id == YELLOW_CARP_B0) ? DMUB_ASIC_DCN31B : DMUB_ASIC_DCN31; - fw_name_dmub = FIRMWARE_YELLOW_CARP_DMUB; break; case IP_VERSION(3, 1, 4): dmub_asic = DMUB_ASIC_DCN314; - fw_name_dmub = FIRMWARE_DCN_314_DMUB; break; case IP_VERSION(3, 1, 5): dmub_asic = DMUB_ASIC_DCN315; - fw_name_dmub = FIRMWARE_DCN_315_DMUB; break; case IP_VERSION(3, 1, 6): dmub_asic = DMUB_ASIC_DCN316; - fw_name_dmub = FIRMWARE_DCN316_DMUB; break; case IP_VERSION(3, 2, 0): dmub_asic = DMUB_ASIC_DCN32; - fw_name_dmub = FIRMWARE_DCN_V3_2_0_DMCUB; break; case IP_VERSION(3, 2, 1): dmub_asic = DMUB_ASIC_DCN321; - fw_name_dmub = FIRMWARE_DCN_V3_2_1_DMCUB; break; default: /* ASIC doesn't support DMUB. */ return 0; } - r = request_firmware_direct(&adev->dm.dmub_fw, fw_name_dmub, adev->dev); - if (r) { - DRM_ERROR("DMUB firmware loading failed: %d\n", r); - return 0; - } - - r = amdgpu_ucode_validate(adev->dm.dmub_fw); - if (r) { - DRM_ERROR("Couldn't validate DMUB firmware: %d\n", r); - return 0; - } - hdr = (const struct dmcub_firmware_header_v1_0 *)adev->dm.dmub_fw->data; adev->dm.dmcub_fw_version = le32_to_cpu(hdr->header.ucode_version); @@ -4513,6 +4485,61 @@ DEVICE_ATTR_WO(s3_debug); #endif +static int dm_init_microcode(struct amdgpu_device *adev) +{ + char *fw_name_dmub; + int r; + + switch (adev->ip_versions[DCE_HWIP][0]) { + case IP_VERSION(2, 1, 0): + fw_name_dmub = FIRMWARE_RENOIR_DMUB; + if (ASICREV_IS_GREEN_SARDINE(adev->external_rev_id)) + fw_name_dmub = FIRMWARE_GREEN_SARDINE_DMUB; + break; + case IP_VERSION(3, 0, 0): + if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0)) + fw_name_dmub = FIRMWARE_SIENNA_CICHLID_DMUB; + else + fw_name_dmub = FIRMWARE_NAVY_FLOUNDER_DMUB; + break; + case IP_VERSION(3, 0, 1): + fw_name_dmub = FIRMWARE_VANGOGH_DMUB; + break; + case IP_VERSION(3, 0, 2): + fw_name_dmub = FIRMWARE_DIMGREY_CAVEFISH_DMUB; + break; + case IP_VERSION(3, 0, 3): + fw_name_dmub = FIRMWARE_BEIGE_GOBY_DMUB; + break; + case IP_VERSION(3, 1, 2): + case IP_VERSION(3, 1, 3): + fw_name_dmub = FIRMWARE_YELLOW_CARP_DMUB; + break; + case IP_VERSION(3, 1, 4): + fw_name_dmub = FIRMWARE_DCN_314_DMUB; + break; + case IP_VERSION(3, 1, 5): + fw_name_dmub = FIRMWARE_DCN_315_DMUB; + break; + case IP_VERSION(3, 1, 6): + fw_name_dmub = FIRMWARE_DCN316_DMUB; + break; + case IP_VERSION(3, 2, 0): + fw_name_dmub = FIRMWARE_DCN_V3_2_0_DMCUB; + break; + case IP_VERSION(3, 2, 1): + fw_name_dmub = FIRMWARE_DCN_V3_2_1_DMCUB; + break; + default: + /* ASIC doesn't support DMUB. */ + return 0; + } + r = amdgpu_ucode_request(adev, &adev->dm.dmub_fw, fw_name_dmub); + if (r) + DRM_ERROR("DMUB firmware loading failed: %d\n", r); + return r; +} + static int dm_early_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -4645,7 +4672,7 @@ static int dm_early_init(void *handle) #endif adev->dc_enabled = true; - return 0; + return dm_init_microcode(adev); } static bool modereset_required(struct drm_crtc_state *crtc_state) From patchwork Wed Jan 4 16:40:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088759 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5906EC46467 for ; Wed, 4 Jan 2023 16:44:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3E74C10E58B; Wed, 4 Jan 2023 16:44:33 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6D91010E57F; Wed, 4 Jan 2023 16:44:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oNyi38S95ASyRSDLC7KpABoPgtKDkCtjlxZp/1r6cQDvwjriWon/Q4lyvbLu5kmg5x/ICMcXLhPA+LIlciI1iTn92cKRZ7zibTdVCNbzZZ9oHjQrgYq5AFQIe0CBb5YhJKIdEK6KY11gfv1vgX1aFJnLeoJwCUy894CyqeV/mEDekEgMK43VAtcumpi0GiWg8r+vvvXZPYgr5JW0rSQmv+AJUy9kOh7RKklF1gkBaYK7xI8M9yMrNJ4qyUWQqfmtD3W5tlozmeTbe/zE2NiHkIApxjHE9xs5Vq+dxOMqY5+s4WBrpiydm/avfgddWD9FLyzR/vzXISsmvBVvk0V7+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wf93+5M97FMm0151DXNABEff4+vT8JxlCz2YYKAhjQw=; b=A/H9koYWMev226u15Wa6zO6vk+FZhh0Z/F3hp6NIkRoQcBneScULWa7gWGtSu+bMj+xrh4qvW6zHleweVxSRsB+4OxAepwZi5rc5SqiRK4LS19CW3P5fZmOw2fqQj0HX86D+UPkLgq4CJrGG3BmpXRLNbBsI54l0WPaDou40Sto8wwJypn9Q+kSKMy3F7xXWZDVO2Ma8ZRxEqTCU0g253RAB3kevk4D4mPehC+D/FweEq4HH0vye73zRLpBLKpiAmnzc/rvnclcfSbiOcF7ype98eQlW5UROIizGA4g9N3F0j5KdjqjCuwMFxYnTjiWISiMHxR7e9PyGmIueE87VDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wf93+5M97FMm0151DXNABEff4+vT8JxlCz2YYKAhjQw=; b=AxidPZmU/iwxZjGlatzVlngoavK1RUoF3MoWiZ3BMLAyoF/gapNZBom8Kn2efj5qi2L2oPvuCkCvpaS97SYNqL/s73pGRB6lSeeODRSPKOKr3uIE+QOi2GMMYw7fiHcKozDqBM2AYhoJXjgq7bGfYXB9zqk/fx9Q67Hx+SGOULs= Received: from MN2PR14CA0004.namprd14.prod.outlook.com (2603:10b6:208:23e::9) by DS7PR12MB8420.namprd12.prod.outlook.com (2603:10b6:8:e9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:26 +0000 Received: from BL02EPF00010208.namprd05.prod.outlook.com (2603:10b6:208:23e:cafe::ad) by MN2PR14CA0004.outlook.office365.com (2603:10b6:208:23e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:44:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010208.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:43:53 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:43:08 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 25/45] drm/amd: Use `amdgpu_ucode_release` helper for DMUB Date: Wed, 4 Jan 2023 10:40:14 -0600 Message-ID: <20230104164042.30271-26-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010208:EE_|DS7PR12MB8420:EE_ X-MS-Office365-Filtering-Correlation-Id: a422a66b-d03d-4d30-bcad-08daee72f14a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +RUFMVBFtWiCbnl0OIx91Hn2/Rg8NOGJ/4s4/hvWbk6xART4AdyuXE23zcAfWV2xtf324eydn6aWMDOPSxETpHnpvXGFD9wOPOp+wbVSQ8kBMyR2ZbS3/T41JGMQcEJQbZMgkSDD0rp0PRyii/FRsZw4qLK9uTbTkYETZNnMUkFISGayF8bPWaDcrUJWoe50shBR1n9eoEyCEXSAURjfK0ELrR5tcRnw5cYVdaTpurTXOkYUKmb0jFYS43XjYma9uNOYxFCYC1Mtfn4aljojzylFWhCX1XBRATrPN6i2nufYeBV3yDj9a6Pk+6lXWC8mhii98AKvqIkM30RklK7ncSDisQrhRxg34HbspFtpzmSSArRqLwEJeVkcckkgSeT5BzrLcnPce+H9Lnxz+yiS/X0LXnk5+w4u9T2etiJvMRoMr68zet+fYyn53pkhNgOg/Ki2qCbC+BXi17r49PHU9qqAeZh8ixZ3deVTm8yAkb6rPmuYu7xQXfn/NBXVaFeZWfaqGYL5g9V/oPghL3XKGJ7usSnahVEWpRlSZaQ8e9fXxdz4WXeV0pu8liqd3MxtTm0NGRpj/89W0w/ANHX3SLewOU923H+PAY9UocutZU+DarJ2OIyNThv1go/nXSCLHDZTH8GDw4MtEmVRysgo0W2sy1f+fVxXAIK2GlZd+yHhYxLWW4z3Wg+dc/7cZ7UOfPOApsAwmOg8k0j9A4rtRajs4i7d9TtstfpP3OjiLxYzfsJEmR3ECzuzuzaGN9CG X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(346002)(396003)(136003)(376002)(451199015)(40470700004)(36840700001)(46966006)(8936002)(4326008)(70206006)(5660300002)(70586007)(8676002)(2906002)(44832011)(41300700001)(54906003)(316002)(478600001)(36860700001)(82310400005)(110136005)(36756003)(6666004)(26005)(426003)(1076003)(83380400001)(186003)(2616005)(47076005)(16526019)(7696005)(82740400003)(356005)(40480700001)(86362001)(40460700003)(336012)(81166007)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:43:53.0576 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a422a66b-d03d-4d30-bcad-08daee72f14a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8420 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Leo Li , Lazar Lijo , Rodrigo Siqueira , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index c8c5d37c8b3a..3908d715b90b 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1898,8 +1898,7 @@ static int load_dmcu_fw(struct amdgpu_device *adev) if (r) { dev_err(adev->dev, "amdgpu_dm: Can't validate firmware \"%s\"\n", fw_name_dmcu); - release_firmware(adev->dm.fw_dmcu); - adev->dm.fw_dmcu = NULL; + amdgpu_ucode_release(adev->dm.fw_dmcu); return r; } @@ -2113,11 +2112,8 @@ static int dm_sw_fini(void *handle) adev->dm.dmub_srv = NULL; } - release_firmware(adev->dm.dmub_fw); - adev->dm.dmub_fw = NULL; - - release_firmware(adev->dm.fw_dmcu); - adev->dm.fw_dmcu = NULL; + amdgpu_ucode_release(adev->dm.dmub_fw); + amdgpu_ucode_release(adev->dm.fw_dmcu); return 0; } From patchwork Wed Jan 4 16:40:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088763 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 229A4C4332F for ; Wed, 4 Jan 2023 16:44:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2584910E592; Wed, 4 Jan 2023 16:44:42 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2052.outbound.protection.outlook.com [40.107.94.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id 975CE10E58E; Wed, 4 Jan 2023 16:44:31 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HadzZ7ec+qFCH4mKqB+paZQjROmB3cozta+jAaC0yPiF14492VACMc/I6/du0x8AuzLvRn1hgBou4miKrFOhtVzjd7nsD/qtyJ3uj7hXFJBKxLcZx4hGgn0wwym3JkbKkxIBJn0hroDsBvQ2LAv8LjFeDg18QdESrEGOJMLww1x9bC2V9az6IXaErdG/vdcFsnvcQ8PJGhpkkO2eIGKldnW/4DtF4RSClq9aViTHb2e6gq3q06jzghWvZjG/LunEQ3Hin+EejhYE9HlFfxKiqinNfl5ckbi5CxLI593KWIkZSMhPpVP82u9Uo1ehE+KAEBbQdasPsAB1rmO9TafipQ== 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=NcARxDdOCypc9+MdqyOWGgEf4LnBxZ2wthl+qTDXDaY=; b=nfqkFgZC2ls+8D/IAJV9E5GZkwdTrT/gSzsTcSq42ka1uJUytm5m7Zv6QdwcccCzdoPXc8sHBAobmiM03d2Bt6O+S+dyP9k9MSUdUvp6eVPZC9fGcb5VZZaWoh1JFNeY4LjzwR50Jv88Lb4TrkEhbs7llJ19aXk8SSrXo4fM7LZxRI2binq8nPPrLbPGfHrAZsJ/qHoYffH6J0bd0ETYmU4gO1g1dOrGikh6+W4R5a5asZ+tMf0XJxXIV3NsbYXu4EqauAtoVN1dLvMiFB6RUVR3x6R/UpxapV0jdb7mwSQ/ZM8QLq2A7+sKb681ea7VB2v1ojRDlX3YoRUxdfOc2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NcARxDdOCypc9+MdqyOWGgEf4LnBxZ2wthl+qTDXDaY=; b=nn1OxPTlhD/pYBbcRxjy6hdoCt5T+T15tpY4NZnLO0aC91GeCMxCAzsTRg5TPuVZWjA/sujFvbtLKFWBs0jB4xP6WC6ZO86oMX3g5YQJeWXGDKVC7APWJCJg/SLwPaEF0nqIlu01Nma5uI/xr4H7xx8dcFXDd+22aFSkDzSV1gI= Received: from BN8PR15CA0001.namprd15.prod.outlook.com (2603:10b6:408:c0::14) by PH8PR12MB6842.namprd12.prod.outlook.com (2603:10b6:510:1c9::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:27 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:408:c0:cafe::f8) by BN8PR15CA0001.outlook.office365.com (2603:10b6:408:c0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:44:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:43:52 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:43:43 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 26/45] drm/amd: Use `amdgpu_ucode_*` helpers for SMU Date: Wed, 4 Jan 2023 10:40:15 -0600 Message-ID: <20230104164042.30271-27-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|PH8PR12MB6842:EE_ X-MS-Office365-Filtering-Correlation-Id: 256da0bd-7e23-4442-1110-08daee72f14e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bf13BTKS2FN3f/evcUIQJA+SQ/BTDScqFwxT27D0WHT1kWASAIOUYkhelfzCRlaNeGRehwqPpUw45qgqUrIhF0aJWbZMnbMt4KJaMrNMT6E0M9xhDXCKSVZUkrgAD3TWVxa1jwDRmakUVdo7IequPl2ihdwCeDpmhbY2Qj2yRz/xzz/lQ/Jyd7oO1zyMVSKEprFytbrbOE37MiLn2BSSTbB54dNEo6YuWwMmvYBDW3FGzjeI1hyHjRJmgh4llIUorp2IVF8HzRgl/OPSVpD7pqak9DqjNKOjqGj5fxTeyNsgyuADBPF3l3YcTB8Tt33aP40/SDRDF+VUaDdvZJRs+ygDFsKA98ZyL43i+uxim/d/RBwkGRAVbJ9Hl9vOSOH1LS8ubvN5CCPigM6NwW7DdSaS9qnm/Ost92fs3bqONcBr3Wc8r9vWXVQQ+pXae8a7mujvM1uZYoWxi8Qd9ny1Py3PtbQT8QGaW55AFzeZfTSFlVsC85dev3A4qEWUglS9D2jO3FdVrwDxCWtNXpAYo38hvK4JvkA84EcS42k0QOQRBVYtdXJxGD4+6fsVhPVGwJ67CNW7OgiWUN7ZQufFFvebk7E42X/uSKD87O+5CUBnAd1iuIuRiIwDYAXNVwTqd22aZ9knJL/2SrpokhogQgh+przDW7uIGyJMY/3/JrI3sfYuV84Dnegx+xVZVQWBuDHl6w2Qo3I4wLro7W/GLxRAeWu0LrJewJcEkbOPWbURgkz7OXXCt1dp+ZAjKEHsTuJWol/VVI9dvTflkF8m/g== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(396003)(136003)(346002)(39860400002)(376002)(451199015)(40470700004)(36840700001)(46966006)(6666004)(83380400001)(36756003)(478600001)(110136005)(36860700001)(82310400005)(40460700003)(86362001)(82740400003)(81166007)(356005)(40480700001)(47076005)(426003)(26005)(1076003)(186003)(16526019)(2616005)(7696005)(336012)(44832011)(5660300002)(70586007)(8676002)(4326008)(70206006)(8936002)(41300700001)(2906002)(316002)(54906003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:43:52.9231 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 256da0bd-7e23-4442-1110-08daee72f14e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6842 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , Evan Quan , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 16 ++++------------ drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 16 ++++------------ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c index d4756bd30830..2e03dffbe59c 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c @@ -109,10 +109,7 @@ int smu_v11_0_init_microcode(struct smu_context *smu) snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix); - err = request_firmware(&adev->pm.fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->pm.fw); + err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name); if (err) goto out; @@ -130,12 +127,8 @@ int smu_v11_0_init_microcode(struct smu_context *smu) } out: - if (err) { - DRM_ERROR("smu_v11_0: Failed to load firmware \"%s\"\n", - fw_name); - release_firmware(adev->pm.fw); - adev->pm.fw = NULL; - } + if (err) + amdgpu_ucode_release(adev->pm.fw); return err; } @@ -143,8 +136,7 @@ void smu_v11_0_fini_microcode(struct smu_context *smu) { struct amdgpu_device *adev = smu->adev; - release_firmware(adev->pm.fw); - adev->pm.fw = NULL; + amdgpu_ucode_release(adev->pm.fw); adev->pm.fw_version = 0; } diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c index 506a49a4b425..990cf54b4bca 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c @@ -103,10 +103,7 @@ int smu_v13_0_init_microcode(struct smu_context *smu) snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix); - err = request_firmware(&adev->pm.fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->pm.fw); + err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name); if (err) goto out; @@ -124,12 +121,8 @@ int smu_v13_0_init_microcode(struct smu_context *smu) } out: - if (err) { - DRM_ERROR("smu_v13_0: Failed to load firmware \"%s\"\n", - fw_name); - release_firmware(adev->pm.fw); - adev->pm.fw = NULL; - } + if (err) + amdgpu_ucode_release(adev->pm.fw); return err; } @@ -137,8 +130,7 @@ void smu_v13_0_fini_microcode(struct smu_context *smu) { struct amdgpu_device *adev = smu->adev; - release_firmware(adev->pm.fw); - adev->pm.fw = NULL; + amdgpu_ucode_release(adev->pm.fw); adev->pm.fw_version = 0; } From patchwork Wed Jan 4 16:40:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088762 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 99EE4C4332F for ; Wed, 4 Jan 2023 16:44:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E753B10E590; Wed, 4 Jan 2023 16:44:40 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2065.outbound.protection.outlook.com [40.107.237.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4F86310E58C; Wed, 4 Jan 2023 16:44:31 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LUZXkg+oCB0EMo23JgzG3poKSsXS/Pp+qNjEjLG+0uKT3oGHeXlRhWbuChWLn/dsTJk0HHbkC6+/eIOrXsdhtfEjmIRcrepy/kl6oD4GqD2XRBQdITbca+0H/pd/5FSYSsHAuUTePQffMA3j6e2rLOGg2Fz5Cb3XJUBEoPS0EAEFcMSPuWWsIZd7PF2Hh1NjXP0Vd86gnr4w3tszWm2KGw7S7V9a6AablXx9m8hEAFe5VZ5rxFjXmooQxRGY1K7P2zfyTJ8/JSFMzCGTtD4BZ6ogXTleWnYawKO3MWW3/V3XIkh57HMYsm+oIWIQrY+HxOH17LQJQpRwgEyffCUYiA== 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=f6zFVeH6ycNozFmqRJ49q1s8rz4/0HRquCK775mnL3k=; b=NLaQE9dddRbLecTM6WE6vG2SXiCV+0EdMSc23qQtu/7Gz1qawz35k80u9Y8wj9JYcS+OpiPXe471f/vwgTHLj26emzG7fhW5t6c/nNR+O9AAIPPP9B+et3Mm7GhB4AMgQn+1nMleLz4dH4PRvsD9ExZyDnNBotLTCVJlUI07kINzl7Wj+oNKDEUZvf/Wec5YIpX+4yXViKMeujKFCgORqVSabi8FhCIoXvYYPXQ4U4//dJdEXOc7Hb4tdL0JCTqkCDcnKpcHBx6TD27/nl2R7k/Fmxiy6guJxJVYRavFuSVZ96qNdsfB66Xy/Gw9Y+nQmWfWzsEE4wCdaep4I9O49g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f6zFVeH6ycNozFmqRJ49q1s8rz4/0HRquCK775mnL3k=; b=JL/+uDs56gYDTS7zhHonI89NJoU22zHXirsKppLs8bcYny7DJ6RgYgwsCmqsScAa8GjMmT/bDQubaOcHpeGcC7jf25mTslxnJVY+bxByW84gvcpys+Lv9kMPKeHdtGlKWt9oedhlzyM60US4Hoa5t41Frop6E0krt81Vm3yuf8E= Received: from BN8PR15CA0034.namprd15.prod.outlook.com (2603:10b6:408:c0::47) by PH7PR12MB6980.namprd12.prod.outlook.com (2603:10b6:510:1ba::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:27 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:408:c0:cafe::9a) by BN8PR15CA0034.outlook.office365.com (2603:10b6:408:c0::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:44:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:27 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:43:44 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 27/45] drm/amd: Load SMU microcode during early_init Date: Wed, 4 Jan 2023 10:40:16 -0600 Message-ID: <20230104164042.30271-28-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|PH7PR12MB6980:EE_ X-MS-Office365-Filtering-Correlation-Id: 6baea5ac-0240-4b33-e73e-08daee72f184 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e/dXUTAwrH45xySuNDktkWlyWXt9P6vLjbhUjJ3c2uXiv847OQYpBG100PU9YkGYmH/sIYhBM3eeJpUlEqzBXRIfoJ0/1EoiohhRH7ROxZR0Ed2U9XnVLJ5FXLFLVifvUXR91JO/rYFMzgC4+rnlEeQWB+RMBk+tmnaOlNeHAXPahBPZp8Y0niTURIbK40UVGoc/72Sewln/u4jQxvAyGGkh5ElW6X74B9hXZb64q3RssuV5D6ko4hecP2tMsLnVj8Pi52MZq9mIsowLmw3dSTRrq3xBVNlQc9CaKPbmmVT6KFtvqyzCgZziwZt+elfGEtkYyooc4SYgmlPCXdtpinEu+bXaL4NnLmaXUcBdPSaCchxIKfetYv1xL2d9g9E16VKFWvy8Qsxv1B4hjEk52+iR359xFzy64GQpS9bblLGJDFIMq8SdAEhjvqVqEBTYmLXvcPguq0OVUAIRd4HWGRRIide1/KRMYU6Ji2LOADNqZTWtjS8lRDM+9x3p9Jl80Ccf8qz1N72DDfOd69PGK0sfVobXCsduMRuC1C9GwTmH9Pm1sOiLmbgO+xYxEkBz71uDVwjA1MGPCV1TGMkjwmf9dCj7Jug3+99HZ9iwyINjU9P+nEVNeYULV0/sB5XQNXuZsp9HBuUk4yVXdM1geN3aa87fRXXFpTIo1MSiWo2FEyzJB2AbjHoMf2Zo9yq7NXavF+ut9GjtgJW92fCSZTTQhPR8YvckM41Vg1K/sLY= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(396003)(136003)(39860400002)(376002)(451199015)(46966006)(40470700004)(36840700001)(83380400001)(47076005)(426003)(1076003)(16526019)(26005)(336012)(82310400005)(7696005)(40480700001)(6666004)(86362001)(36860700001)(36756003)(40460700003)(81166007)(82740400003)(356005)(2616005)(186003)(316002)(4326008)(478600001)(41300700001)(8676002)(2906002)(5660300002)(8936002)(44832011)(70586007)(70206006)(54906003)(110136005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:27.1579 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6baea5ac-0240-4b33-e73e-08daee72f184 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6980 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , Evan Quan , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This will ensure that the microcode is available before the firmware framebuffer has been destroyed. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c index 2fa79f892a92..ec52830dde24 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c @@ -623,6 +623,7 @@ static int smu_early_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct smu_context *smu; + int r; smu = kzalloc(sizeof(struct smu_context), GFP_KERNEL); if (!smu) @@ -640,7 +641,10 @@ static int smu_early_init(void *handle) adev->powerplay.pp_handle = smu; adev->powerplay.pp_funcs = &swsmu_pm_funcs; - return smu_set_funcs(adev); + r = smu_set_funcs(adev); + if (r) + return r; + return smu_init_microcode(smu); } static int smu_set_default_dpm_table(struct smu_context *smu) @@ -1067,12 +1071,6 @@ static int smu_sw_init(void *handle) smu->smu_dpm.dpm_level = AMD_DPM_FORCED_LEVEL_AUTO; smu->smu_dpm.requested_dpm_level = AMD_DPM_FORCED_LEVEL_AUTO; - ret = smu_init_microcode(smu); - if (ret) { - dev_err(adev->dev, "Failed to load smu firmware!\n"); - return ret; - } - ret = smu_smc_table_sw_init(smu); if (ret) { dev_err(adev->dev, "Failed to sw init smc table!\n"); From patchwork Wed Jan 4 16:40:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088764 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6AC09C4332F for ; Wed, 4 Jan 2023 16:44:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A77210E59A; Wed, 4 Jan 2023 16:44:43 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2069.outbound.protection.outlook.com [40.107.92.69]) by gabe.freedesktop.org (Postfix) with ESMTPS id 351BD10E58C; Wed, 4 Jan 2023 16:44:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dpdwertpqoZUFXacOs5RZjrPAcNzz5vYXnM7u8FuwH+NJ9jHVkefbWNxX8oP9/Yb4LWVmkAF1VNK5dmRhqXS3sz/Y59VRP2oqq2/cXLsjPVgPihBpWhH3++TQaHEi92hc8Xp8axzCOg0RMbMhysWg/z+e2oIMNlOcT9bwilb6D2+s+eIGutn0XdpfFoNLl46AXXzL05RoMtL3095+5kmdEFQQNGY8gGaUM7aHLi/zNn9HU9tg08uMrHGtChGmsrEWrMUyEiKdOwHrG1V8R8q6u/pzxuxd7v+CLSomAkGL3+CSvquCjTC2MNEApqLwwJZWjGcclLizIFFrZSITw9xUg== 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=gAupng/DiBgVq4A49K1akqtvG/HYBBcWMVkzCkT7rmA=; b=WeeDBP6ZjDC1e6u9e+BOTqwLfxqskJg9Ua1e3EYNwVRLq3CITkyaB0+3+iskfC6OxqEv5r3RlibqhSuvMtxPXmAT8oTyPTgkNoTwkyujI+urxm+HcyU4QcjBvgV8D/aVfBIHL+6efa5DtjaR6oC3pY6+ENgCwpafZBHKaZrRoHiZqRs7r63nA3L7krPC7cwA8suxku3bPmAbALVxbKJrEeLaAnDXxF2NmyPQWqpDyQAP1q5kWPNB4CB9XWZmNBicx/LjWPv8ZZ9c9JuXLXokobGovpxT5oHSG3rR6l4xkF4UfXu5rMpTnNOOnGP5fSD2rFZB/vXDTOlMR5eSXJ9PtQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gAupng/DiBgVq4A49K1akqtvG/HYBBcWMVkzCkT7rmA=; b=tbKPKu7d3Jt90B/b+P0HFQNqYp78EP3v5oS93FQdkZns64j99l0Y8S+fTyo1IbhXo/aGTGE1ngYptmZTtWcX572znkf5F3v4aZ6oNTWRqxlYIoR0DnYoW50YgcT0HdRqTXMuRNzzWIKLPP3Bx6PkWaUZA23ebjDXz906tWfnCDE= Received: from BN9PR03CA0618.namprd03.prod.outlook.com (2603:10b6:408:106::23) by IA1PR12MB7637.namprd12.prod.outlook.com (2603:10b6:208:427::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:27 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::bb) by BN9PR03CA0618.outlook.office365.com (2603:10b6:408:106::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:44:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:27 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:43:45 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 28/45] drm/amd: Optimize SRIOV switch/case for PSP microcode load Date: Wed, 4 Jan 2023 10:40:17 -0600 Message-ID: <20230104164042.30271-29-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|IA1PR12MB7637:EE_ X-MS-Office365-Filtering-Correlation-Id: e079dd52-a4a9-45eb-dd01-08daee72f1c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: llQMKtn8vYUireGEv22YirGj6fil41FDkCuQ0a9cV92cwaw5ah0EMS653X7H9v/+5Qyz/fbGs+ahHqnrmtToBVKw1JBXuEfO3uArCwFBQ0CvD7D7DmUuZGHwI8xR9MSq4l5ZD8xz2oBjAPjcjWhsTsFlmBxZ/xs+/bb7qOajbwtbqALoFdtbtneiuqyA2LIhd87NiFX+WMID/3FyLTDP2zG7gGO9CwXOpETZUhH8bgpq8tFK9WDZ7+sg6wJo1R2/jsrOqNa088hN282HZClRCSeOD9SHZVCCDhkoYtZDeeRDcxgSrmshhFB41GqdLpGM0+XNmuql9aS2zSZKk+NUKQXNE2tWVEgrbXOIw0gdfRlkerG2fv8h6+2Ud3kWD1TrZQ5uVPDKlxAbmP4vIX8S9Dg4KnIlgy48pvPRxeDtK57yGCu9XX7MPaWxC4N2rtn1macfMexpbYNpSXxSlCi6QXPSEJZimvUhF07RBfI1fv+rgtZyVkMO3tw/8K3vi47/1r+Nccu5n5l515Z2tEdDSzf+Yf4W/wj2YUKgs4MVYcJEsYqss/RGRMS1QMF1MLTGFAhYppEFcLtBf9x1s9qfD+btaV7Qc9o6QTwVuJTlrgEbOczMp09tRtQgeNL4Mroc+pf2bhxhxJeS2uGNYJMKstE1I1jZlG9qrgQDqdEv0+jNDHBX9Zd6ld26Z8XVvmnB7cq4Fg25elC8S5m09r3v10ZrqDHQJMC385c1Arxc8Ts= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(376002)(136003)(396003)(346002)(451199015)(46966006)(40470700004)(36840700001)(6666004)(110136005)(36756003)(478600001)(36860700001)(82310400005)(40460700003)(86362001)(82740400003)(81166007)(40480700001)(356005)(426003)(47076005)(7696005)(16526019)(1076003)(2616005)(26005)(186003)(336012)(83380400001)(70586007)(5660300002)(70206006)(44832011)(8676002)(4326008)(8936002)(2906002)(41300700001)(316002)(54906003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:27.5745 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e079dd52-a4a9-45eb-dd01-08daee72f1c6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7637 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Now that IP version decoding is used, a number of case statements can be combined. Reviewed-by: Christian König Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index 8a3a38ea7b46..15ffc5a6e4da 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -132,14 +132,8 @@ static int psp_init_sriov_microcode(struct psp_context *psp) switch (adev->ip_versions[MP0_HWIP][0]) { case IP_VERSION(9, 0, 0): - adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; - ret = psp_init_cap_microcode(psp, ucode_prefix); - break; - case IP_VERSION(11, 0, 9): - adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; - ret = psp_init_cap_microcode(psp, ucode_prefix); - break; case IP_VERSION(11, 0, 7): + case IP_VERSION(11, 0, 9): adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; ret = psp_init_cap_microcode(psp, ucode_prefix); break; From patchwork Wed Jan 4 16:40:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088758 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CB6FBC46467 for ; Wed, 4 Jan 2023 16:44:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6442A10E58A; Wed, 4 Jan 2023 16:44:30 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2073.outbound.protection.outlook.com [40.107.94.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id CB87D10E57F; Wed, 4 Jan 2023 16:44:28 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b64rqRvf3voP0HMpjUyKhzFFRzUmHIdyA0oQa57wDJWLExx+dn2qXGORZo94SVRTE74Wj+FJTNFdU2PjLzZqpHzG1RYx0Mi8vtghT1F87UWT8W0mRrO/yyFavLR70IANVst0h1k1XdDiP8qpIztcxpyWr3u6WF5TUsoQWX3p4fEc5sSV9gyMYB8SbaK7JAQaqv5qQ0YDe5ih5WPKwAx1+iqepQvcOowhgtmEFplNzJD+gJUFkBkvB9htbyQIXOZYIjZwtI73nBHgooq3QXl3Zg2q/za5jQchKcWlGJEx7LWrEBobNuS9raLEqy+InHUt4RlE1lisfO+VrGjVpkoloA== 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=wd1zlKWvld1jLozUiuJPQ6HbgOIicSeri2N+lSU9c40=; b=nwAHld2QoEBmSviIdjWxb235GnFlmo2w6f8/F0m5ZiDwZPvY7Z2WsbBkJcUbGtc8QwEWNnKtm0TFZbWxpR7poVBMQC/hxbfdFCNzrP29g0jpCNwZFULH/YnZKbGvthySXL0FeMWPmrcn/xYexkisMfaUm1KPrlBRSh6eNq6/urovrDTcPvONfgGmHuBf/FVex2XWwFCateY1+eM/xXaFKMaCoKClZrLysD7NCvoX8eP7avQBMwYv3bgG4Vv9wgu4vESueql32byIz9hQ2Czc8tHOnlW4LEvQ6ZmxwSb1D/3D/lkL8FHHd/SW9HMm2IyR2ZapRRsvjVE5AV1qzGTiRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wd1zlKWvld1jLozUiuJPQ6HbgOIicSeri2N+lSU9c40=; b=etzb6/HeYdUaiJP+5hxQBYBQDYr06OQi9Tl0N1I3UTGlvynggJ01mZyycoMWJZfnL9H12QR62Ks05ZU0pA9ilLKIWQmyxDFuTnkOZBR2zLaO53rrXE9PO+kEvElAtemg0CJhEHpPBYTmSKt9z8SVOSA8Elgezk9osb2mnjgtcIk= Received: from BN9PR03CA0617.namprd03.prod.outlook.com (2603:10b6:408:106::22) by SA0PR12MB4382.namprd12.prod.outlook.com (2603:10b6:806:9a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:27 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::b6) by BN9PR03CA0617.outlook.office365.com (2603:10b6:408:106::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:44:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:27 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:43:46 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 29/45] drm/amd: Use `amdgpu_ucode_*` helpers for GFX6 Date: Wed, 4 Jan 2023 10:40:18 -0600 Message-ID: <20230104164042.30271-30-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|SA0PR12MB4382:EE_ X-MS-Office365-Filtering-Correlation-Id: eef20672-c579-4b09-06b2-08daee72f190 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /vN5U/8IzjeohVbia2k7Uj8HmAwErKjAzxnP7ugfw7BoeFJiQeS2cVKucImtS78TxUnNpc6Vt/a03l952sYEHsQENWKYa/T8xvmjr2roZ3uWpJW81sWGtKBs9lr3FjGAodqOB+8oXNal0ktPZK93cwQSoomSOX7q0OdloULAGJSs1BK6c0fzP+twRnAk9liU+XmjslmkdXKLNKtkzS5K+2Fq0Oh0L+t2i3v2N9ejMkqLkhXzaiQREekiw070WYhBmgJIieHNnxldOMggziM4j/9wdThHmLnvVaM8a7VWFafKaka9mxJA064fT6/TRFc44gALOkuW3KFF48Izp3pqbymbJ1c1rW2ge90ZYkC3RDeJmdcdGSNceTLcHK/mOB1509FXF0WBcY4g3eYnsiW7wz2q/NlRYYW0Xy0gXfNHwzKkSj4KHqgDtdqcvfBVMBaafJ3tpP5Dt4wK2w4IhEhLEmJ2g+M1QhmCb72bChDVsP+mSrPdcsA5Ni1GVxFzXH8Hz1Yyq3WYqsuA7EQX6qcJgJ4OS/MmVUxUapMGeFTgLUdTONcOimkSyrAYgJ+wzyJZ6FBBdz/iH7w4On041+ltxmQBAyE+0K1TcEXkbVOgxiHR9eyJNyALbaHbwfhazFy7usk8Lf8gkDyV+04Hfsedj6vJVn2nQE/QYa++HfL3vGUNOW2HMDA8kBQe/3O+Aua5W4J5AdtiLjrQzyEQobQ/FzezNElBq9+afN+lvLvrq3uHexBRzLw5bbQg4dcYS3Zx2QW0E5l/xHRWJwn2YoB5ug== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(396003)(136003)(376002)(346002)(451199015)(46966006)(40470700004)(36840700001)(47076005)(426003)(16526019)(1076003)(186003)(2616005)(26005)(81166007)(82740400003)(336012)(356005)(86362001)(83380400001)(82310400005)(36756003)(36860700001)(44832011)(40480700001)(41300700001)(8936002)(4326008)(70206006)(8676002)(40460700003)(5660300002)(6666004)(70586007)(316002)(478600001)(54906003)(7696005)(2906002)(110136005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:27.2308 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eef20672-c579-4b09-06b2-08daee72f190 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4382 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 30 +++++++-------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c index 204b246f0e3f..c2f31d8ad23d 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c @@ -338,10 +338,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name); - err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.pfp_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); if (err) goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.pfp_fw->data; @@ -349,10 +346,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev) adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name); - err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.me_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); if (err) goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.me_fw->data; @@ -360,10 +354,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev) adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name); - err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.ce_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name); if (err) goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.ce_fw->data; @@ -371,10 +362,9 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev) adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); - err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name); if (err) goto out; - err = amdgpu_ucode_validate(adev->gfx.rlc_fw); rlc_hdr = (const struct rlc_firmware_header_v1_0 *)adev->gfx.rlc_fw->data; adev->gfx.rlc_fw_version = le32_to_cpu(rlc_hdr->header.ucode_version); adev->gfx.rlc_feature_version = le32_to_cpu(rlc_hdr->ucode_feature_version); @@ -382,14 +372,10 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev) out: if (err) { pr_err("gfx6: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; + amdgpu_ucode_release(adev->gfx.pfp_fw); + amdgpu_ucode_release(adev->gfx.me_fw); + amdgpu_ucode_release(adev->gfx.ce_fw); + amdgpu_ucode_release(adev->gfx.rlc_fw); } return err; } From patchwork Wed Jan 4 16:40:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088760 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DECCCC46467 for ; Wed, 4 Jan 2023 16:44:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A258C10E58D; Wed, 4 Jan 2023 16:44:35 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2066.outbound.protection.outlook.com [40.107.220.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id F233710E58B; Wed, 4 Jan 2023 16:44:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lRQrEf22bhe0qJlXgB007L5IpfI+rlG4ZpBZfzwcP11Dvs5G80f0mmA6BDWlMZOTJV4e22VePkic1oRys3v9AKbstQ/FNZy7LHJqgLLbCll166+4GpgkPvEdP7j3OW0oZ5x13SbIUAVXRie2QZ4Mu8C0e1bz6kuVEKJp+sLKu4K91o4+S72cOoNucbRqJbEuYaHeqA8ZUafYJam1PLhyZog2p7qFyZ+46E5Qra8g0PoJfn/w6NfzVt7h/fP1g9Saa+ZOIP4MMDbBY6BpcD7QQyepKPTvLh71OJpQTc22PfynDwHn5lvoZWMkoPWIeR5V4mWaK03Y9SrWDA183SIxhA== 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+0rKKn9CEDRtNlIfOYexIP6ICDHD9e6fRkgwYHK7L0=; b=gVYG8Ix0qQpxCHLd5kUPfQS+aBJ90/KzX8meLBnLZF+Gd1YSeI2K3XyqaE7mLDRIoPi6JgZILzFmkMSUhSs8bxDCTQWC8rodZio+jNmvjhqgC+vZj9t9ZK1POrNgiSp5y1jdR1SMY2a7okNUgojXQxW1hcHYs4l1C9EwV3B7MlS0w4FWCYisDm5vRKw6EHYXR2vtWPp3pbZFOeC9TlrrL14WVaUYNxVO4JVAG0sYnmHyTdgyStTlnSIWh/nW6rTWo9mwJtEP4gwknoyMHdyeRy+o/BoJ6PwaaZ8eUZhuEeP0+jA5C+5PgbxkW7l/pR0kyhsy+C8OgzNWLHZBa8TtlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H+0rKKn9CEDRtNlIfOYexIP6ICDHD9e6fRkgwYHK7L0=; b=vXoTxZR0QzTGVSzW6vcJhg2E689riv1kin8jxvx9D77kT1jigiwG4H/iVs+RjYGrscHjgUG3fduTEex22pZiE+s7/9CYDxmNBAPbj9GgfQB3ro7NI2KnVztQhzDC7BUUv/d3qoiuI5aTdT/UjxMutQbSQ7DOS3/SsMWpVDtJ56U= Received: from MN2PR14CA0002.namprd14.prod.outlook.com (2603:10b6:208:23e::7) by PH7PR12MB6657.namprd12.prod.outlook.com (2603:10b6:510:212::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.21; Wed, 4 Jan 2023 16:44:27 +0000 Received: from BL02EPF00010208.namprd05.prod.outlook.com (2603:10b6:208:23e:cafe::48) by MN2PR14CA0002.outlook.office365.com (2603:10b6:208:23e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:44:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010208.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:27 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:43:47 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 30/45] drm/amd: Use `amdgpu_ucode_*` helpers for GFX7 Date: Wed, 4 Jan 2023 10:40:19 -0600 Message-ID: <20230104164042.30271-31-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010208:EE_|PH7PR12MB6657:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c47fdf4-eb7d-4be0-b9e5-08daee72f188 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fI3a3TzhwWDAH7Em+JuFwlfPkq8Nf33P1oSVOvcVLKyNL8z4U0Grp+tovswAs+nhCRhJW4IMBXpUz2dyrFCKz59b8KCQJl7F39CxUBGi6lSdIyuHmtxIrbceGyi0YQuejhCOiZYhz56EyCg0XQC34zdmby4ryEBpSAHOoWo/eNlBOgNJAH7CHwZgGsubLLfNht9MBGDzxKl5sWIlbOSloe6Xrm+wtrykF65Ry2BXxaMhffn6fMzBuQ+x3rfUHEKKY9BtLh8Lit9fM/rh6WzxWv61axbv5T9oVM30u1pyGJ87VnUQVr4tIXMHvfV6fJPTzgKvXDy8kBQrIwstIurFxc7L3NrVjeECtEyzxIBhOKuPC7npzXaoPTFflutquSYxYp/WX2+m5xSMj0Yg//3XS22zotkZwtco0cDE98W7WxwPxvYJSKvrZytavMc+iQ5p/08a0d1KJIJLN9e0eUjdUAuV9FkelcCwFasrJeLNa8UTR/gW0Db0meHhkAd87Z/qAB1OTNF9NpCAbUyiucqMMh27/AAPrr+oz6/ITd48opsjjji+V9BzzTP24/cGYpZ3k7DXPyxKwMGow5dQfyXtiL39iQeykF/BkNSiviRhpMZ4+ODIaz7u5LE9/Z0PlN7GXF0ezu/VubaudAypG599NviAkZWxV7NvSs73K/GdOABLNxCr3mnuexwUJ/Npma8h5pn2yDddfr+N+yLbc/DDEqQqjD3SLDk1dOogUE9r3rfhLlpZX25eEaaDpeuYI7r6//sksecUEeepoksY7Yt8yA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(396003)(376002)(136003)(39860400002)(451199015)(36840700001)(40470700004)(46966006)(478600001)(186003)(26005)(36756003)(36860700001)(82310400005)(4326008)(1076003)(2616005)(44832011)(5660300002)(316002)(6666004)(70206006)(16526019)(2906002)(110136005)(83380400001)(40480700001)(41300700001)(81166007)(8936002)(54906003)(40460700003)(426003)(47076005)(7696005)(336012)(8676002)(70586007)(82740400003)(356005)(86362001)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:27.1829 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1c47fdf4-eb7d-4be0-b9e5-08daee72f188 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6657 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 68 +++++++-------------------- 1 file changed, 17 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c index 0f2976507e48..a16a44e5fb32 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c @@ -887,6 +887,16 @@ static void gfx_v7_0_get_csb_buffer(struct amdgpu_device *adev, volatile u32 *bu static void gfx_v7_0_init_pg(struct amdgpu_device *adev); static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev); +static void gfx_v7_0_free_microcode(struct amdgpu_device *adev) +{ + amdgpu_ucode_release(adev->gfx.pfp_fw); + amdgpu_ucode_release(adev->gfx.me_fw); + amdgpu_ucode_release(adev->gfx.ce_fw); + amdgpu_ucode_release(adev->gfx.mec_fw); + amdgpu_ucode_release(adev->gfx.mec2_fw); + amdgpu_ucode_release(adev->gfx.rlc_fw); +} + /* * Core functions */ @@ -927,88 +937,44 @@ static int gfx_v7_0_init_microcode(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name); - err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.pfp_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); if (err) goto out; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name); - err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.me_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); if (err) goto out; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name); - err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.ce_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name); if (err) goto out; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name); - err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.mec_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name); if (err) goto out; if (adev->asic_type == CHIP_KAVERI) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name); - err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.mec2_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name); if (err) goto out; } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); - err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name); if (err) goto out; - err = amdgpu_ucode_validate(adev->gfx.rlc_fw); - out: if (err) { pr_err("gfx7: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; - release_firmware(adev->gfx.mec2_fw); - adev->gfx.mec2_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; + gfx_v7_0_free_microcode(adev); } return err; } -static void gfx_v7_0_free_microcode(struct amdgpu_device *adev) -{ - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; - release_firmware(adev->gfx.mec2_fw); - adev->gfx.mec2_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; -} - /** * gfx_v7_0_tiling_mode_table_init - init the hw tiling table * From patchwork Wed Jan 4 16:40:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088768 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2AF05C4708D for ; Wed, 4 Jan 2023 16:44:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A370E10E59E; Wed, 4 Jan 2023 16:44:48 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2081.outbound.protection.outlook.com [40.107.220.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id 74A4B10E58C; Wed, 4 Jan 2023 16:44:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IlSLfhKA4mDIu7s1ucjEQamH7ldRppjLowscETtf/x8Ml2SaOgJkx7Sehv/WTPJneYlOInjr7whr4FslWlJRD9Gds2a+7xdgIfhOHd4yPL7m+N3oN1rFE/fGpbc3Rh5RYOjX96i4Ral/WNt+YvItwuYFr951t6DsIlA1xe+WmC0P+ahWPyi55cH1cVehvmhLLWPTr7Tlb2AhgiUNGIF6pceXOO35Ks+PaZy5OkLhWWUHshkvLdthNc92PGMM0hhqfy2ow79hqOPZ5walnUngglQiElyif0v48qvB96fulFzdESyLIw1dNzKtiZFtH7qFFATDzdzT/gWaHOQIhPBvHg== 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=BsrW767LczqfNIt4VUnmmB/NRtKKiXdowhEelPGWIBY=; b=AN7MNL73MoK0/NGl7WMA91lUJm0QowEsQS3EogFk3BMJgYttthpXL+BMgmPNpTKP7fgK1QL4aGRUTRNljIYPn02c/IdxEJtu8eQrWShVl/Mb3kYnkFJfl+R2bScsaYZSEKYhLlZb8P4emdWXgzMNaxiQmQIJcOJBNbJZ6wUx3+3/8GF69/Lq2nEQl/yx7bXXp2ClVk/DNuXwNSWjoXtvNnoEOJAfr18PONLl9Esq31Z8anLFkSSLHVkGjdo0hMcTTLHvYSkHqB1Rn869bxYEy9uAqIgcPJGpIbz0Kg5rTppoyjC9PwIF/iU6OgGmONCvSdTfk8iu8AOdLYuZj70A/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BsrW767LczqfNIt4VUnmmB/NRtKKiXdowhEelPGWIBY=; b=FJ6vzIlNHhrxMhvrOsZkIDYYG9EyeOAyaNoXUnLQWlxsYp5muQBqjwCBSHUYhpfEOgeeloTzpa+i2YnhIIff6GOFFqtgVevAxo2MpqN7AEKgYdhdvKDzHoKr8flWJHGTiRFsVTeYg0MvsDyZe2yTOCDoE4cX6oaE1m6dzC0jnz4= Received: from BN8PR15CA0010.namprd15.prod.outlook.com (2603:10b6:408:c0::23) by CH0PR12MB8551.namprd12.prod.outlook.com (2603:10b6:610:186::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:27 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:408:c0:cafe::97) by BN8PR15CA0010.outlook.office365.com (2603:10b6:408:c0::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.20 via Frontend Transport; Wed, 4 Jan 2023 16:44:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:27 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:43:48 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 31/45] drm/amd: Use `amdgpu_ucode_*` helpers for GFX8 Date: Wed, 4 Jan 2023 10:40:20 -0600 Message-ID: <20230104164042.30271-32-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|CH0PR12MB8551:EE_ X-MS-Office365-Filtering-Correlation-Id: bbca1ab5-664d-4598-bed2-08daee72f19c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lipZ9UoWjZxkjAU8BMbwZ2HXu26FZopnqRdiSMX9ARFX+KVwvzW+C+HrMZwYg1M7BmJB03xIf+2/lXbuUitB/Ka8th1WiakC+APz4JMm1lEfdJTZZguGv/6sSeXXTFLdQUh+H4wz1UZ2FcjqjkEaDgkp+/UuUQ4RslVvLHj0baLlWKEMJg7KKqT8y/VzXWWlOYAnPiLmn9uW+uvm5DXs53ecCmXy9EGYNzcTR+9F0R5nmD2l43qK6Q6Q1H5/JGuk/OPiH9NC8O96dR/0H+lJDn8daeUft8+S5fxgdugZ8+QCZRe1lNBO9mUzb+f9whYkK2JRhN9TYi3hQ9cQDq5mBzz+aLFuk8X1E1Kr2lUPRSKyZKDcLzIfvGidufOQKb4Dylr5rMtyFb9nh0xr0K8xaOuqPBcNVg2RYw/k2XX1+EXo2mS28H5hVh9F6c5KqUa88H5f02tE3Kc9T8tcI3H5vvMbW4T5Qvk+wysWegahPeabbVs45ZLApJqco1Bk4ogVyVFMj+SeJRS7q81w+SuRWx2op+mGcpBhGLgv7h9g9/gSliJsikg7rjTcwCtIDGwzRjsjm88QAnBCkhHFF1K8lQyrLDvarq6ioe9CDDvS/15/1AAN5oSaxmrcpcovECZYg1pXRxADuhAmjuLi1L+AhlJTFZ81Tpygco9taNf0lsF3FhkLraNqhZr1/KCEo4dPo0ytG7hlKbcOl9XbuPI9Aegcfq09Q6a9GRwShS0e6GTK7rWbAOINDi1NrLqCmHI4CgPie3d6xKGygd8O8XSvlA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(346002)(396003)(376002)(136003)(451199015)(40470700004)(36840700001)(46966006)(70206006)(4326008)(2616005)(1076003)(36756003)(8676002)(40460700003)(70586007)(81166007)(336012)(41300700001)(426003)(316002)(54906003)(47076005)(2906002)(86362001)(356005)(5660300002)(82740400003)(36860700001)(82310400005)(110136005)(40480700001)(8936002)(16526019)(478600001)(44832011)(186003)(6666004)(83380400001)(26005)(7696005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:27.3141 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bbca1ab5-664d-4598-bed2-08daee72f19c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB8551 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 94 ++++++++++----------------- 1 file changed, 33 insertions(+), 61 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index d47135606e3e..7197b342944c 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c @@ -924,20 +924,14 @@ static int gfx_v8_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) static void gfx_v8_0_free_microcode(struct amdgpu_device *adev) { - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; + amdgpu_ucode_release(adev->gfx.pfp_fw); + amdgpu_ucode_release(adev->gfx.me_fw); + amdgpu_ucode_release(adev->gfx.ce_fw); + amdgpu_ucode_release(adev->gfx.rlc_fw); + amdgpu_ucode_release(adev->gfx.mec_fw); if ((adev->asic_type != CHIP_STONEY) && (adev->asic_type != CHIP_TOPAZ)) - release_firmware(adev->gfx.mec2_fw); - adev->gfx.mec2_fw = NULL; + amdgpu_ucode_release(adev->gfx.mec2_fw); kfree(adev->gfx.rlc.register_list_format); } @@ -989,18 +983,15 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp_2.bin", chip_name); - err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev); - if (err == -ENOENT) { + err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); + if (err == -ENODEV) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name); - err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); } } else { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name); - err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); } - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.pfp_fw); if (err) goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.pfp_fw->data; @@ -1009,18 +1000,15 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me_2.bin", chip_name); - err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); - if (err == -ENOENT) { + err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); + if (err == -ENODEV) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name); - err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); } } else { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name); - err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); } - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.me_fw); if (err) goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.me_fw->data; @@ -1030,18 +1018,15 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce_2.bin", chip_name); - err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); - if (err == -ENOENT) { + err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name); + if (err == -ENODEV) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name); - err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name); } } else { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name); - err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name); } - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.ce_fw); if (err) goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.ce_fw->data; @@ -1060,10 +1045,9 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) adev->virt.chained_ib_support = false; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); - err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name); if (err) goto out; - err = amdgpu_ucode_validate(adev->gfx.rlc_fw); rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data; adev->gfx.rlc_fw_version = le32_to_cpu(rlc_hdr->header.ucode_version); adev->gfx.rlc_feature_version = le32_to_cpu(rlc_hdr->ucode_feature_version); @@ -1110,18 +1094,15 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec_2.bin", chip_name); - err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); - if (err == -ENOENT) { + err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name); + if (err == -ENODEV) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name); - err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name); } } else { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name); - err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name); } - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.mec_fw); if (err) goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; @@ -1132,19 +1113,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) (adev->asic_type != CHIP_TOPAZ)) { if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2_2.bin", chip_name); - err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); - if (err == -ENOENT) { + err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name); + if (err == -ENODEV) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name); - err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name); } } else { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name); - err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name); } if (!err) { - err = amdgpu_ucode_validate(adev->gfx.mec2_fw); - if (err) - goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *) adev->gfx.mec2_fw->data; adev->gfx.mec2_fw_version = @@ -1219,18 +1197,12 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) dev_err(adev->dev, "gfx8: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; - release_firmware(adev->gfx.mec2_fw); - adev->gfx.mec2_fw = NULL; + amdgpu_ucode_release(adev->gfx.pfp_fw); + amdgpu_ucode_release(adev->gfx.me_fw); + amdgpu_ucode_release(adev->gfx.ce_fw); + amdgpu_ucode_release(adev->gfx.rlc_fw); + amdgpu_ucode_release(adev->gfx.mec_fw); + amdgpu_ucode_release(adev->gfx.mec2_fw); } return err; } From patchwork Wed Jan 4 16:40:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088770 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D25DC4708E for ; Wed, 4 Jan 2023 16:45:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C02B10E59D; Wed, 4 Jan 2023 16:44:51 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2046.outbound.protection.outlook.com [40.107.92.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id D955110E58D; Wed, 4 Jan 2023 16:44:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gVG2e+DwdEN5jhUiIsxo4rRSpOf6oGW6vB9vfrPghz2BWyQ880r35WPtsgW8vBk7s6PLWceRWSvc9KDsbDJyCXoI9bEnbw9jea6iulqeedOIzW9Plt7ijNZAVYTPBiL9+rSp/6FATn7AkjQBdfXim5+cbqtwB712tqafP+dnCXy3S3y+RdCI7oqX7Y7IIB7P/RoVELPx6lebJtN4zX+/f0UEusxS1PTN2ZQ70la6YwDJZrTcs1Jm00qwVG1ZBuZ8Tts3MonSrWvRVY3Ooq1absjyMtn50kCsZZOPUnw4Xqn1yTyTU5ha5ZtMCHVlTrQR466j6SRLyc158/J6+ATnOg== 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=KziW04yoVrSRS5oKftctrQIygUW7V8IlNqPG4dDhh2k=; b=RZNuLwOgIU8GoxFYCMLBl1V+6odoPn+C6xMAr6HN3YTbSsWhGXvUTiagcAViwJbb9RcCtrY0O6ZTc+fvZWSunuzJJkGRFdKibCupUNxxbmh29EZ3AfrvK6DZJnHC5blxYyCinkVyKxUDKz3cGCYXl5yA2Grdgsvkw3hY936AzvavrPfBuWvbNhKXECzL4GNHq3mvHFy0/HzYKVStXvYV5qW13L/tDXIPV742wlyBDp8ODh7MZl94ako/TTQsUJbBvDYDIq3kFJmAym09IeeQArxi2eptcmPnY+2sNdjkuInv8UrObM0XrhdIolQoCyMe4UjNg9cBSU8i8CiEil7Bzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KziW04yoVrSRS5oKftctrQIygUW7V8IlNqPG4dDhh2k=; b=vvgcsZy9ggTnsDxpvs0z01HidO9iYS3KtW+3ExHnGirStWjO/tQcG8NC1eAUFhMSsWaMsKZDEZyrHBkvBEZIVq/YFf1vfqnzZSXtThNODldxJJtqV2OGp0vYyxqua81Y8xziJtWwjCd8wlNOS/Pd1aIW7/QICZVSowm/BXyVguc= Received: from BN8PR15CA0004.namprd15.prod.outlook.com (2603:10b6:408:c0::17) by MN0PR12MB6176.namprd12.prod.outlook.com (2603:10b6:208:3c3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:27 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:408:c0:cafe::4) by BN8PR15CA0004.outlook.office365.com (2603:10b6:408:c0::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.20 via Frontend Transport; Wed, 4 Jan 2023 16:44:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:27 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:43:49 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 32/45] drm/amd: Use `amdgpu_ucode_*` helpers for GMC6 Date: Wed, 4 Jan 2023 10:40:21 -0600 Message-ID: <20230104164042.30271-33-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|MN0PR12MB6176:EE_ X-MS-Office365-Filtering-Correlation-Id: 59d8d443-f510-4c33-e34d-08daee72f1e1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0p7aD3JJyuKOnK8tk1hpuE9tCDWhn6OrQe6sWj0+FT5d0SN0PPCPBh2cqwkUYC8UvtdXjMpO1U6M1DgHh1OzroabYfyOo9zhu29CcdA7WKG7VvtPjKJnQpkOM10Exk9Sk/ENsQRWphbKfAsV+C8AQ/wEuGS9BCFokprcyFAAlXwr3khtW3l7Wzmir0NYHIRSqWDH7dosyi322Wgl03RW+CY9PfBqazdv9l1GEbycFqClGoSlP9VY1FGT+6Tc2rBX9ijTg06l0HkHs5pfcF5qfXLQu8HFbayYG4r2MGhDQxYPdOkGzlon/Cea6bh/YwyA1TxOnq+rr0jAkit7PNJx2UfR9kvTWSTevWgTy+8Vf1Et4r41N17r6dnFxjHnMsyb8NdKYgmlBhNIEYNY9OfkPkuuXwITbP8kDy1Wevt6f38YXhrY7FBNDaMEkGIrExMWh5kHmZNK++gNw8ax3cQZBQrWcZTBOW7dls9TFDo1cr2RW+T30n4lzqtukAOXowpY6UAeX7vk23GSm1rekRW7Y0zbxPPNT59bdfFLsr/iiqATzX/Qwe6RzmvLIwlvzv5QxanG8XMi+ng51gpCEQHAzPu6UYwJ1XP9skJ4waN8REd9KlsDrhPqZLgo0qOvXYDzz3a8yzWZTZwl0eKw3nsQER/xDniM8U/TTQ+98r2EPpgB0pNePhxZVBwNzozIie0gKIdaj5PcxzkbgBAm1jUOp37iCPRQP1MsJM/cgcWwMljOUG8bekNbDxVyJ9TEZrPD+RjNPUppdC/QTiyJPtjVDQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(136003)(396003)(39860400002)(346002)(376002)(451199015)(46966006)(36840700001)(40470700004)(83380400001)(426003)(47076005)(1076003)(16526019)(26005)(6666004)(336012)(82310400005)(7696005)(40480700001)(86362001)(40460700003)(36860700001)(36756003)(81166007)(82740400003)(356005)(2616005)(186003)(316002)(4326008)(478600001)(41300700001)(8676002)(2906002)(5660300002)(8936002)(44832011)(70586007)(54906003)(70206006)(110136005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:27.7204 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 59d8d443-f510-4c33-e34d-08daee72f1e1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6176 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c index ec291d28edff..cc8f79a9d52a 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c @@ -131,19 +131,12 @@ static int gmc_v6_0_init_microcode(struct amdgpu_device *adev) snprintf(fw_name, sizeof(fw_name), "amdgpu/si58_mc.bin"); else snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mc.bin", chip_name); - err = request_firmware(&adev->gmc.fw, fw_name, adev->dev); - if (err) - goto out; - - err = amdgpu_ucode_validate(adev->gmc.fw); - -out: + err = amdgpu_ucode_request(adev, &adev->gmc.fw, fw_name); if (err) { dev_err(adev->dev, "si_mc: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(adev->gmc.fw); - adev->gmc.fw = NULL; + amdgpu_ucode_release(adev->gmc.fw); } return err; } @@ -894,8 +887,7 @@ static int gmc_v6_0_sw_fini(void *handle) amdgpu_vm_manager_fini(adev); amdgpu_gart_table_vram_free(adev); amdgpu_bo_fini(adev); - release_firmware(adev->gmc.fw); - adev->gmc.fw = NULL; + amdgpu_ucode_release(adev->gmc.fw); return 0; } From patchwork Wed Jan 4 16:40:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 16D31C4708E for ; Wed, 4 Jan 2023 16:44:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C949810E598; Wed, 4 Jan 2023 16:44:42 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2062.outbound.protection.outlook.com [40.107.92.62]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6A6E910E58B; Wed, 4 Jan 2023 16:44:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FZwjHL781C5m7KGej63ux8yhooWesuP/P0ZWRCk/mPHaglg7oDoYsalEYIoLaBwn/L1ClBAR9p+/y4ypn5Kbyd1B8aTseXRwNM7s/8vYe1525pmnj5xXF5I3nD5kAkL9hai7kSzBevPpe86JjyAN+8cHrR7gsgbMcSQ6fvXRSVdvqu+wA1NkCIfw7Nt06uL40rwPfRELNT49UoPqmdLZrXKpfD5qOr1FaL0jLyFWVXz1MWKrwKUB6mO8MCOqQlwCUjk0KBgcf3EoQwgOr2aqSuPeH/PxYm6y98jRCdv3pKO/liEmCZNmgS/cJjd/hmaXeZ2wHqRvjRLAP1NFdHyS8w== 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=gY3Nh3V1HcysaBhUlG+JOEGX7gYTLaL+2fJ/AJTHqdg=; b=JGxgh7LbdPdlGQALGBfJhYBab8BCmFBnnyPLlC0uAxxQY1xMSi/4GOyVkSutA5X7kXlKmWFDTYCL/kOnXRVbvKnm9LcfF3isys1xUq4AoA8yztgjTfeCyI2tfofKT0Pn4b9tXQgDKSYgh1NThwu8COHkyY97cSHflksCxSxVQmqMR4K8j1Uxn8KQHKpVBIj8acrjRjZATdQs6m1Z4ZHzFYMeaAtmhK7UTdiVoJCBdqyftFkSjRMnOD4nH5437i7WUuDAhgdJKHSviUTRq+p0HsVB9r3ZaDilBjhnsUlSSbtEAQVD7G8Dve5lqcwjdIkl4AoQafrjcaX8tIGUEd4Y5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gY3Nh3V1HcysaBhUlG+JOEGX7gYTLaL+2fJ/AJTHqdg=; b=EP8s/3D+lIsOv1rpKysSmEsdTlU6e7YK86XZjwGuEDcUnzHgK8qWrc2ZfmvaUngu/Nhr1ynRTOkeOc/agHCgmsRJsmzFjrWJbn+fpL/Rk9g1cIelSeceCJBv4KyU/xNtffrArD5lw7XLhJkLvjfaaSRcB8RaFCPC3JRRTFIXpqk= Received: from BN9PR03CA0629.namprd03.prod.outlook.com (2603:10b6:408:106::34) by DM6PR12MB4420.namprd12.prod.outlook.com (2603:10b6:5:2a7::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:28 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::6a) by BN9PR03CA0629.outlook.office365.com (2603:10b6:408:106::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:44:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:27 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:44:26 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 33/45] drm/amd: Use `amdgpu_ucode_*` helpers for GMC7 Date: Wed, 4 Jan 2023 10:40:22 -0600 Message-ID: <20230104164042.30271-34-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|DM6PR12MB4420:EE_ X-MS-Office365-Filtering-Correlation-Id: c707485b-2c56-4f23-da8d-08daee72f204 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: liaqwrFALkjUsX+swErJuB15zekRABuouYU4Mfe0wzBpn5cMFqCktC/dNMtAQxGS44Y0bHdXt3foJg+qwI4NaLR2rzTv3W/TehTz8VKpuRPBnPqlzkNbaWlveDRWV7R/mfjpq4Rev3rqIGrBfclmJO+wj/280zolBp5k0hQpWLw1X7BJdNUVcWM7nQ0mrgsVUZeivUHAdhG+Nwvu91+X/zJtgTjNPjHahgZMFKLLHFz48vA6LMuwF23xbjqbYGD6jJcls4PNgz7OUVZCA0PmxYrdP8VZWPACJpgaqx+FgfIj/dDW2asm6labkuWcNi7oreIrAlUzI0y1MJjSnGyCpbc+izzJIKvXduz6W8TMiHZddAdfc/pKzbHV2zeQ+AL3aGAUW5XWriEYZiU3aRf3eVyH1aOJgCScfVhfCq2wJ8rj+flNAxcLiAI2OwSCpW/t+YZosuaueFk6a24KJu6Oq+tApchG63nVPZrQ4mZ+W7zkxhp8X/oyHOBn810Usk5qv2WTbUJPWUpKoeVdJ3dPay4JAVrRb1VKvMbIflV2SYnx+r/OGHc4mRunaNZimXrqZV6B3aQsXg9Lyjdw3/XuftFxjPXNSCBSlQyzItkMLtkrpySF9E8V/qwkJI2zJwWcFhIRuCQNkJSrj/+F5gGfEiExc8DxgelWVVG1TyQHjkK9KhTFpC2ULsNHwRE/M2dhrqmbn51AjjJ4DmOZtHEK1afrzgTsUkA5+vwavAmAt/X3eRpbw6LtnYUhcUR8+K1MlQ9y605PxZk/jzVzHGl7gw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(376002)(39860400002)(396003)(136003)(451199015)(36840700001)(46966006)(40470700004)(5660300002)(2906002)(41300700001)(44832011)(8936002)(6666004)(4326008)(8676002)(316002)(70206006)(70586007)(110136005)(54906003)(478600001)(2616005)(7696005)(26005)(16526019)(40480700001)(186003)(83380400001)(82310400005)(47076005)(426003)(336012)(356005)(82740400003)(81166007)(1076003)(86362001)(36860700001)(40460700003)(36756003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:27.9808 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c707485b-2c56-4f23-da8d-08daee72f204 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4420 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c index 979da6f510e8..934410701a15 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c @@ -156,16 +156,10 @@ static int gmc_v7_0_init_microcode(struct amdgpu_device *adev) snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mc.bin", chip_name); - err = request_firmware(&adev->gmc.fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gmc.fw); - -out: + err = amdgpu_ucode_request(adev, &adev->gmc.fw, fw_name); if (err) { pr_err("cik_mc: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(adev->gmc.fw); - adev->gmc.fw = NULL; + amdgpu_ucode_release(adev->gmc.fw); } return err; } @@ -1081,8 +1075,7 @@ static int gmc_v7_0_sw_fini(void *handle) kfree(adev->gmc.vm_fault_info); amdgpu_gart_table_vram_free(adev); amdgpu_bo_fini(adev); - release_firmware(adev->gmc.fw); - adev->gmc.fw = NULL; + amdgpu_ucode_release(adev->gmc.fw); return 0; } From patchwork Wed Jan 4 16:40:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088774 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 95ACEC4332F for ; Wed, 4 Jan 2023 16:45:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1357710E5AB; Wed, 4 Jan 2023 16:44:56 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2045.outbound.protection.outlook.com [40.107.244.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id 433E210E58B; Wed, 4 Jan 2023 16:44:31 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LmrZ1eFTxhOel/QpmKQ/u0oxxYtTajk/2D61cs8XaUx6Ceh/DtimZxK/JGowTVMx53JWhni/TpzQxU9cz4XyjxR15JdJG/P3edWBm04C3QNjMDutRvhKC6zJvSRXutLXor3KG0cN1hj/zF6LAOxvEiKnoew8y6roPTV5V0G5m74NmHknZoNyrErd0ar1On/epZabwZK8VSA9NHkfdLsCfBZCJmqzM2yjcyTkXgzCL3E9Nnne6G7jx58QXzBZ/TTqLA1lkc5M3ZrIG5sm1LRuP9zG8IIvLRNgbd5zFk0mNBqtcYfJZz3gL5Dl1UdDRjYMdLOlWW5fSV4pqh+vBKZvTA== 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=ajYXM5ERvcqp8aaPolHyK9jd/3gjnZ41YWnQyfSc2w0=; b=BnVIfwhApp8a7+rLOJDBL+hgkiNkOQH4wcY1CuhhL7ISfg3c2lxVxKraQ9wkAPXRwZeKoA55p3R9fdH4fD0549sIAV+vb5HHnQgFL5qguh4dDT5H7u5uqWsI8vbN864L/cuS0pvsJle/CTCcNG9KOoDJKmMjlYvMndlzqDDkkKJNP6AyZ5mk3ounABczUKk9HVDwoHbwQS0mYj9oNQvYfJ9WsU/MCBRyAPadjqJnQMEefNKwhfHVXSE7XugyAJoApVM773X21e5BJx0d0mIYGK438eALErFcMsP+Uw2/5hDFs8akyCA0ZuWsdVY7GAQUlolndgIlesEtC4HBbUVwrw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ajYXM5ERvcqp8aaPolHyK9jd/3gjnZ41YWnQyfSc2w0=; b=oqEUEnM4HNIebHVNQ4kiBqtBToo/9rMqnUeInyul3cDF46Ga+XDTQvyNaEQz8UNeC2p1BRQppi6IVf1s2+f28h/sE5ES3iM61vHjsTsDamVJqm9VggbRemGE6QrLxKAO/QljuboWLwVqNMCRjZ+e53DB+WWdXfDCwbzo9GWc1Zo= Received: from BN9PR03CA0605.namprd03.prod.outlook.com (2603:10b6:408:106::10) by PH7PR12MB6564.namprd12.prod.outlook.com (2603:10b6:510:210::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:29 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::1) by BN9PR03CA0605.outlook.office365.com (2603:10b6:408:106::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:44:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:29 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:44:28 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 34/45] drm/amd: Use `amdgpu_ucode_*` helpers for GMC8 Date: Wed, 4 Jan 2023 10:40:23 -0600 Message-ID: <20230104164042.30271-35-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|PH7PR12MB6564:EE_ X-MS-Office365-Filtering-Correlation-Id: 5bf7e88b-9ae7-4e28-6fcc-08daee72f2bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XZjPUlU4ZvX+Sc/HSahcgs3pEGl9C/ROXssA9SNYF/5AGv7AKb+/Q2IUk6ErNPhSYWxjzxubfUsQnTU8ThcjR4C0guliwe/9j90wlZ/lUvLu3529uK3uAGeEN9QG3NHyNujHZvvDXuSliZk2satm8XfSUI+rnpwj+6Q805WJEDlXHkZ/aL3JABEA8A9sO/m4/4J54lq8MUaiGg4rN8d7EPjw2gNm1VRrshtDjPRQCF303U/2Hnz+qVgzPXv1z9sm07uFlPOvf0T62Q5mP+V0Zo+0955OGhZGZunRMDnHYXCaXox/DDJ+GvloxoVohhJfE96vUopLJsHDxSiN4+vvigkFtR0dm/uIsYnE5wehGSVRygbt3RCghElLJh868Zaxx+OnWfj75Nw/bPtyAJ4whjdt6HcVICPKrsBpLf711MwFZ+UYAngFVcbFwfDYxhFQjCFK43YSkZDMlTjGpMMQh6cleXAVSbDYdBBMYO7NFCEF1tRHD88KLmhPyelZyd3reCIqSh5r3z/+BwAZXO5haLR9KKfL0Lvzizh7Kn9oKUAUdb9EinxZv1WnfSPZwac0PG1RV94TW0DXz/ojIdNMrJhDq+0VEYet2NEn81/Hl4+7/QnilAE/SIqM0Q2A0Gc0jkFKEC8dH50KgHar/QVnrX0QwrOqEfONWtaSU5xTC9piNTmhvkyW28LNSLYoMs2lNPTtrUluv+pLultvb4jkruZ84LN6YiRkXc2Nk1IrTFg/uAd+rtjq3o8UuIeXRHZyE9pOOG80is6sz5/et0nc4w== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(39860400002)(346002)(136003)(396003)(451199015)(40470700004)(46966006)(36840700001)(36756003)(110136005)(4326008)(54906003)(41300700001)(70586007)(86362001)(8676002)(70206006)(82740400003)(81166007)(356005)(36860700001)(186003)(7696005)(478600001)(26005)(6666004)(8936002)(2906002)(40460700003)(316002)(82310400005)(426003)(40480700001)(5660300002)(83380400001)(16526019)(1076003)(336012)(47076005)(44832011)(2616005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:29.1839 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5bf7e88b-9ae7-4e28-6fcc-08daee72f2bc X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6564 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c index 382dde1ce74c..caea65de3e85 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c @@ -264,16 +264,10 @@ static int gmc_v8_0_init_microcode(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mc.bin", chip_name); - err = request_firmware(&adev->gmc.fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gmc.fw); - -out: + err = amdgpu_ucode_request(adev, &adev->gmc.fw, fw_name); if (err) { pr_err("mc: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(adev->gmc.fw); - adev->gmc.fw = NULL; + amdgpu_ucode_release(adev->gmc.fw); } return err; } @@ -1203,8 +1197,7 @@ static int gmc_v8_0_sw_fini(void *handle) kfree(adev->gmc.vm_fault_info); amdgpu_gart_table_vram_free(adev); amdgpu_bo_fini(adev); - release_firmware(adev->gmc.fw); - adev->gmc.fw = NULL; + amdgpu_ucode_release(adev->gmc.fw); return 0; } From patchwork Wed Jan 4 16:40:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088776 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B6C9C46467 for ; Wed, 4 Jan 2023 16:45:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3448410E5BA; Wed, 4 Jan 2023 16:44:59 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id B950E10E58D; Wed, 4 Jan 2023 16:44:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nt0fNu/LoWAPzsNFfc/WEyjk7fsaa0+Znm1uwI4Axlne+Xg/1g5FqHgiwmsy1qfDIWuhrCOBhBdgJqZg/E4zza7q+pGNM1R3qcB6qZLnD0ufq+a25dQXXXjC51LHuHo/lX/t0v2Zxdc148zuaQExABCSdiK1h/Z4UgyFYwftOL+gy8BgF07aHY/VSWx1/7S8RpzkSgVjAvjPlfPvGqOdtXvlenHHFZQA26kVtZdKv0A7j1T/fQZcR4IojjBnqQ9pUzK1XCpdvsBnSjyqoi9OKe3Tq1ss4yQjYqzuN3qFGTKAN6ZsBj54ImcijzjB/581JQ4c3y+gZzUm7UjlYl7kYg== 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=dfKqq4ZfjgU4XiCBoOylCvIDUSAfYdnuISmcSjcrCz4=; b=O72k8P32KYbO46zf/h6yF/rzjfuLf1jQ7sD6XGK6Y393d3/aNNe1eiNZi+socd0m+t9BET12IVEYrsATaW2pG48f4tw2DEIqqEsTCxogOK25FtCO2x3gHmBYOXrwvr7pLTttqZMMZqGZgZumrkSof5TTxa0tGGYwkBAL12ym45dY4QB9NKVWYlZDXYR39y3LATfqHcPIf5UlBfzFX00sakciSRU3rZvzsiZYAFq0BPnRIARJPLmCyB/l39n59rYLE1GbXgvYcX/qTHTi782XFcx0uMraCZq9URGr32GS+oI9hq/X38EXybVtzNp9lDNBoe97s7yXEPdS9pVhqfgd8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dfKqq4ZfjgU4XiCBoOylCvIDUSAfYdnuISmcSjcrCz4=; b=D13t7E3cFbpDoEYN3uqoue3KLAwZ43n/WVOyOuu00mMgPClvAczOSXiNgZ1Vd6RloXTxa/sJVi56BWeJK8dNoqws6qk0v/IZBnuynPv+zXvY9j4FgVbVPGXzl6QVUUf+eEvN9d9Y94gEsZbw+5s2HdO7u4+SRu6Pa1mvvrNCx/E= Received: from BN9PR03CA0602.namprd03.prod.outlook.com (2603:10b6:408:106::7) by BL1PR12MB5873.namprd12.prod.outlook.com (2603:10b6:208:395::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:30 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::e) by BN9PR03CA0602.outlook.office365.com (2603:10b6:408:106::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:44:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:30 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:44:29 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 35/45] drm/amd: Use `amdgpu_ucode_*` helpers for SDMA2.4 Date: Wed, 4 Jan 2023 10:40:24 -0600 Message-ID: <20230104164042.30271-36-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|BL1PR12MB5873:EE_ X-MS-Office365-Filtering-Correlation-Id: fa35cc59-e8d1-4392-dfaf-08daee72f34d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tHIyjEWaEzhlMIFPwVyH+ipSALbRSft5YWyz0o7a1LucVAH+K1u53EYHlohe/8l0bBhkkJw/zCePWkGAfKKVBmOrcEiYbrv1Spk0RyeMDJekp9xOPonlmL+3OB5F+HxpFoLP7n2+NOTsdBOYP/dLxpCADiY+m3j8RItOWHVBGTlZOD4t9i41AkAP3Q8fBmsAufi+UQLs9kkclwCAuhSVyykQPCf7j0jYnoirKZeGVWUn254avJZtF0HdhFAgqIJVb2P3RT4jDNyt9Cz7VOO6RLSzyoESgJuNv5Uy4vWJyMXoG/lOWnTFjjikIQzBIhpX0Wydb2H2tq4QmcvAy1gaRzfLdLLd5ZYSGRlBeKJkg3rQxYBvuhdScZU3VIO2lrXvsIgW3yuhMOYsXY5AfmY7w3FzhUChu1jx56rxU9JT8mDWV+cPqnZyea55x3+orB6VFZ4EccNp3T5guF1berTo9S+fEq95jVG5nfcGcSSDemFvGSJaBueaMyYL8ySAEcvk/cbdcJR5nswpuCEL/vpqdkuoxSOVtAPXh6Z2O8VkFlWM0ylXq1jLA2X0FcfjyHA5Xji9voMYcarTy03y14VVgWvWXQT2EAKHooMnSHzxeuP/0iAbGbc3J7fNnBoXRtYDC4W+T+G1uCfDNs6gVdnbj2PkKmBY3tDs7z7qNHEtxGpSMxXcj/CLHoj3/MZgQvKdZYaPvuwv6biIuNlk+t0Ew1Wf6aQT163E/p6UF8vixkDrZYuWgKhjppqepshwWU8U X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(376002)(396003)(136003)(39860400002)(451199015)(40470700004)(46966006)(36840700001)(70586007)(4326008)(41300700001)(70206006)(47076005)(8676002)(426003)(356005)(86362001)(336012)(186003)(54906003)(2906002)(83380400001)(81166007)(6666004)(316002)(7696005)(82310400005)(26005)(36860700001)(478600001)(44832011)(16526019)(82740400003)(110136005)(1076003)(8936002)(36756003)(40460700003)(5660300002)(40480700001)(2616005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:30.1527 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fa35cc59-e8d1-4392-dfaf-08daee72f34d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5873 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c index c52d246a1d96..297695731efd 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c @@ -113,10 +113,9 @@ static void sdma_v2_4_init_golden_registers(struct amdgpu_device *adev) static void sdma_v2_4_free_microcode(struct amdgpu_device *adev) { int i; - for (i = 0; i < adev->sdma.num_instances; i++) { - release_firmware(adev->sdma.instance[i].fw); - adev->sdma.instance[i].fw = NULL; - } + + for (i = 0; i < adev->sdma.num_instances; i++) + amdgpu_ucode_release(adev->sdma.instance[i].fw); } /** @@ -151,10 +150,7 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev) snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", chip_name); else snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma1.bin", chip_name); - err = request_firmware(&adev->sdma.instance[i].fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->sdma.instance[i].fw); + err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw, fw_name); if (err) goto out; hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma.instance[i].fw->data; @@ -176,10 +172,8 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev) out: if (err) { pr_err("sdma_v2_4: Failed to load firmware \"%s\"\n", fw_name); - for (i = 0; i < adev->sdma.num_instances; i++) { - release_firmware(adev->sdma.instance[i].fw); - adev->sdma.instance[i].fw = NULL; - } + for (i = 0; i < adev->sdma.num_instances; i++) + amdgpu_ucode_release(adev->sdma.instance[i].fw); } return err; } From patchwork Wed Jan 4 16:40:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088761 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A78D6C53210 for ; Wed, 4 Jan 2023 16:44:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 051D410E597; Wed, 4 Jan 2023 16:44:37 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2083.outbound.protection.outlook.com [40.107.92.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id A1D2310E58C; Wed, 4 Jan 2023 16:44:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HFD5vkwIKcq7SszBRvwAAGN7B2TfA4HpiVkwpjta0D9UFgVuKDqurkWo5BZZeuJ7arhkBNZvhuSp+6KglyM9Z+0mRB9yQnYAINsTTXCnkWjEB9tIWFVl3HwHUl0O3TRHO6X/w/BMWaJ/swRNcsl3ALXJBGd/OwXH1U+/ClyF44Hp+v2DscHyvSJc+71s2gDLYjEF3Fb1Q8TH08XvbstIBnZrSLlelHjpXTkesCggbo5ukzcS/bUL4R96SMe0WnJpTjYlEi+hTUiivcpOur0L+zcoA4CCvJTMigQm0DEGr450vf3xlR/WGEhOuUaLIUM4dopvN/K6xDWT25DLXe8DTg== 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=LcFaQ6tiACY+u/8gC6lqi/OSCcd2YkehJs+D36wu3gQ=; b=PSXEc3O2W+xISb7heJatIlZcfpry4twatkjLsNwMz2jnB0kZMJ1cf+UopU4U/DYMyzaBaSxknYFEzoMEamfIL7F7ZKyEh7urpyiYTFxMGTX9HsGHRomvPA3mecVXTKGhbXQySSuTtV852WLsVdMXibQdymHoNwPBI8wuL9M/ZtgUeBGVx+fDpUTK2hbehBGoSl3Oks9abZ9jlbBEUg5zrjNlhm1stYH72+5fCgJb2cnzB0nbLQordodxw1Wk1CrlHOWGXEjIdB7WKTVZMDBaOKD302/YZqGJloGG6p9nOM755yb/D9qO/6NNcjJVjdRziWc5P33oLj5oOZfNR5lqwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LcFaQ6tiACY+u/8gC6lqi/OSCcd2YkehJs+D36wu3gQ=; b=Ir7SZK6GlNO8bZPcA6K1AMMdbjr9cvY05caxDQ9HSLpLVmWUCeNwQ0Fn3x5f2gCUJBXBjwQcCqskjPrAx9Wrdwt4jeqAddcklFQ8kmcGz7cdG7gu+rnDOdNDAQRKzPtRiF5ra+Qlf/Dxy7/urR6D6M5RjtbTqzazSZxG1uNhVNA= Received: from BN8PR15CA0020.namprd15.prod.outlook.com (2603:10b6:408:c0::33) by SJ0PR12MB6734.namprd12.prod.outlook.com (2603:10b6:a03:478::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:31 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:408:c0:cafe::c1) by BN8PR15CA0020.outlook.office365.com (2603:10b6:408:c0::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.20 via Frontend Transport; Wed, 4 Jan 2023 16:44:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:31 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:44:30 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 36/45] drm/amd: Use `amdgpu_ucode_*` helpers for SDMA3.0 Date: Wed, 4 Jan 2023 10:40:25 -0600 Message-ID: <20230104164042.30271-37-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|SJ0PR12MB6734:EE_ X-MS-Office365-Filtering-Correlation-Id: f789f3d8-5390-4e33-2ef5-08daee72f3f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IXrONkGLS5F3cXiBZWNxGGcA/qeN3sXgSZc3K+kAc4S8ts6uYKQZ+2fZgdcX5Af32PO1NKGCcjjiKJugOgxB3fUxCYisMRhQxPLVVu4Hxsm/k94fa7DNVtzym4JxvQ5IF5XAMt9UtGrLzjfJmuwPO/SrGrdz+nA0V5+nq8Et15qFgXGceRBGsM96DoHNcglwt3fPMVikf1IdnywiB6oPwYTtiFQTh16DrlfZaM166DMHz5wpqGrW9jzYdK0Yj2RUbrN3XEmDv8ceWbIsMqKpRSIhQU4ZydhRY4LPLmnyx6/TTIii62higLnOAXSRtwqtNEz8V0zqZJm+3aDZyPL0gq/Y/rGt9oRAJIvvOvPeZUBAjXJjYkguGELmQYoAjAYsMMB2kpJL1AB4EVPwtCGG7dRnzRHCesTRXNtX3HaqmfS8zN9gTfBLWf4No2eN7yW0hWuC66HHyP41/gxi+alCKd504M+l29DheGJnaFjyRglv+SQ+T1ZX59I4fOjja8c9pGG3cECxBwCbNnZKclrZV/Xin6l/5hBEFM8+lYy2bUQ0tH4PsnrB92FF5q879WqyJsJTD2fY0IDjSwgi/T6MEjgcRUZvv4I0K475mDlgjpuzO7ME8D5tyqOVaHbnYY6vr6YhM4MjD5DR27DtpigjRzVzXbrPqjHdlBwmw1YTKCi3ZBaTQmfhqxfUdu9dvKyBjYURddmo3jr7GO8XRhMDw9d1vjEPDdJFgaqBQaeeiHpy7/gMLGrRhZTKT6WsKtbz X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(346002)(396003)(39860400002)(136003)(451199015)(36840700001)(40470700004)(46966006)(36860700001)(426003)(83380400001)(86362001)(82740400003)(356005)(47076005)(2906002)(8936002)(41300700001)(5660300002)(44832011)(40480700001)(316002)(40460700003)(478600001)(82310400005)(6666004)(26005)(336012)(1076003)(186003)(8676002)(4326008)(2616005)(7696005)(16526019)(110136005)(70206006)(54906003)(81166007)(70586007)(36756003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:31.2360 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f789f3d8-5390-4e33-2ef5-08daee72f3f3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6734 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c index 486d9b5c1b9e..337e348d5ae4 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c @@ -250,10 +250,9 @@ static void sdma_v3_0_init_golden_registers(struct amdgpu_device *adev) static void sdma_v3_0_free_microcode(struct amdgpu_device *adev) { int i; - for (i = 0; i < adev->sdma.num_instances; i++) { - release_firmware(adev->sdma.instance[i].fw); - adev->sdma.instance[i].fw = NULL; - } + + for (i = 0; i < adev->sdma.num_instances; i++) + amdgpu_ucode_release(adev->sdma.instance[i].fw); } /** @@ -309,10 +308,7 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev) snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", chip_name); else snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma1.bin", chip_name); - err = request_firmware(&adev->sdma.instance[i].fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->sdma.instance[i].fw); + err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw, fw_name); if (err) goto out; hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma.instance[i].fw->data; @@ -332,10 +328,8 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev) out: if (err) { pr_err("sdma_v3_0: Failed to load firmware \"%s\"\n", fw_name); - for (i = 0; i < adev->sdma.num_instances; i++) { - release_firmware(adev->sdma.instance[i].fw); - adev->sdma.instance[i].fw = NULL; - } + for (i = 0; i < adev->sdma.num_instances; i++) + amdgpu_ucode_release(adev->sdma.instance[i].fw); } return err; } From patchwork Wed Jan 4 16:40:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088773 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8C1B8C46467 for ; Wed, 4 Jan 2023 16:45:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B348D10E5A8; Wed, 4 Jan 2023 16:44:55 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4D2E910E58E; Wed, 4 Jan 2023 16:44:34 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=djFgd7y2AARN9HVDt5l/W54WRcyIVwwWQ//VWz3ISRiSg+itUEMclRgcSuuZ7zdttbP8DnyWJGpUHGP3aIcSE6CTgxb8kE6auIDORGQSnDIDaawoJ/X31KQRajIoQQ+Fny4h+ILyIZNJKWLKre7j5gGS0nLzGSHbwrEl1Cf1/M8FwHnIqEHmdrKdITUfQvfZOMunxs5WxyN3nTfMoHUzyBVAdzHiO/fYeDWYbK4pLJ3OtuP5tspZJKfx61wCfL11OF0H2Pkt+3WOHpK0WPsso3Uw27Dspn8+uOiSDY9IikXuYSzOQa1MOVlPRUqXGngbarjtq6/e3cGsoAUI7pmisQ== 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=6gp7J9nNm3RvgmHR7oUD3X33XjV4/w6pE4A+M/UDhag=; b=DLn8rlnDv51WHKNTmPQCq5m9YP+X78w+gZBJQJm5Qs56qvnKR66zm7KgzSmaQmmG37WdSLCOjWWlvOTkvqowh3DnqrXEoEV/N+0+TrHbwJMytlsDiyRF4/uhKFsy+YDOKaaAwMsWLgD1A2x/n8FIVt5DGSVO+kq8IGIisPLQPFpmkoBQ6OrgxPYKv+X4+RoGQGl0YhuWZPio0vmNSnepd2iKhXvcpigP60D8EUBNiQqa5K5TLVPRSivQi5hH+dH0yHcRnsrIvquagEOAj7Ieha+U9HaSUUj7DWBE8IaUXr76N8gHJGPP6tNwRTYp95ClMaAN+GaNmcWf8DJobodcIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6gp7J9nNm3RvgmHR7oUD3X33XjV4/w6pE4A+M/UDhag=; b=2lnHRI7j0wRbtdmqNEAeymMyLgQMNDZIx6ukWW2Wf3xOfqUlBmkDfOO7kL6TbAFBgyM/tvR8X0xDJJDf6LDLnWxr+k/6z+iEZ+Dg8jVVDsGTqWDpGxvvleZgrd3pNfXZBvWgPrpjQjmQ8s21kZxlNSCZZZlEBOIJeZeQ70hrAhI= Received: from MN2PR14CA0019.namprd14.prod.outlook.com (2603:10b6:208:23e::24) by CH3PR12MB8212.namprd12.prod.outlook.com (2603:10b6:610:120::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:32 +0000 Received: from BL02EPF00010208.namprd05.prod.outlook.com (2603:10b6:208:23e:cafe::cf) by MN2PR14CA0019.outlook.office365.com (2603:10b6:208:23e::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Wed, 4 Jan 2023 16:44:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010208.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:32 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:44:31 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 37/45] drm/amd: Use `amdgpu_ucode_*` helpers for SDMA on CIK Date: Wed, 4 Jan 2023 10:40:26 -0600 Message-ID: <20230104164042.30271-38-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010208:EE_|CH3PR12MB8212:EE_ X-MS-Office365-Filtering-Correlation-Id: af8569cd-2203-4756-7139-08daee72f488 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KDXHL5rEKjjDEhguorjikRIeUszPJ986SLpQ87yjEIjyiDOSP2pBoZgpdFxpHj5A69urpIvKGb3HSYYTVLpmrcr3T8SNYXUD4a4ZIvHUV/TLey0SSyB9PqRcsIwQRWgaPYjb8KA37fvgqEox9S3zRNuJ65Ep1UMDnUHn2N82LOQzS1GaB9HAvEbLyM50WGweYUz66p2yz3TfQmSeGO53p1rB+7966eiROgnEQsC7QrBD4AZO+cTI95+K1y63zh2o67TZ1GlZN9PdvN4fE5/SBQZH09gQI/tEetVS7STzSs84zQKyMTPI87JJ/vEqAvC6lhtbZsBsWUeOMzIyvIP388Rj2EOUvJwq8/U9fWWDfn3EgGZ7TRWLKdjHi8XV+ml1cAf2SSGdmi0floFUupNh7lX3XcKoBvAplU6kSd/wnjW7hV/hAEzIlXXwQirFSkQPDP4dMEDbNO5/Hpmz3GAxl2mIL7AVyCSngSm6cbZ/PYTmqWjB+1Dqsqn+79mxU1sgW6jUjFlqE+VA75jSoX2Ji7z/WTHzxH3VpC0JmntD8n+jKaDW8DKToKJPkiDorfE2nidWkhjHkHoA/1CJARzlTq1fq/3DDpTX1Cm5cJOOCqPKWUIQJPFS7J3qUfaXe2hUtDShrFYayCZVqDZcYY+ms3TcMNn0P9lVvFp0faaMmPHTEJ9li4a/jOUbAX2QIFit0Qxz6YbbqzwD5CiiBT87eJrBuqM6iktI8sIE0YiXzJJ3IK3RW323QJBTLy2CWpfbJDEY26GOf8aJRUsX3O+GtA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(136003)(396003)(39860400002)(376002)(346002)(451199015)(40470700004)(46966006)(36840700001)(316002)(356005)(2616005)(186003)(26005)(478600001)(81166007)(40480700001)(16526019)(36756003)(7696005)(40460700003)(110136005)(86362001)(82310400005)(5660300002)(54906003)(2906002)(83380400001)(44832011)(336012)(41300700001)(8936002)(6666004)(1076003)(36860700001)(82740400003)(47076005)(4326008)(8676002)(70586007)(70206006)(426003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:32.2142 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: af8569cd-2203-4756-7139-08daee72f488 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8212 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c index cbca9866645c..25d7b80b0fcf 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c @@ -73,10 +73,9 @@ u32 amdgpu_cik_gpu_check_soft_reset(struct amdgpu_device *adev); static void cik_sdma_free_microcode(struct amdgpu_device *adev) { int i; - for (i = 0; i < adev->sdma.num_instances; i++) { - release_firmware(adev->sdma.instance[i].fw); - adev->sdma.instance[i].fw = NULL; - } + + for (i = 0; i < adev->sdma.num_instances; i++) + amdgpu_ucode_release(adev->sdma.instance[i].fw); } /* @@ -137,18 +136,15 @@ static int cik_sdma_init_microcode(struct amdgpu_device *adev) snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", chip_name); else snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma1.bin", chip_name); - err = request_firmware(&adev->sdma.instance[i].fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw, fw_name); if (err) goto out; - err = amdgpu_ucode_validate(adev->sdma.instance[i].fw); } out: if (err) { pr_err("cik_sdma: Failed to load firmware \"%s\"\n", fw_name); - for (i = 0; i < adev->sdma.num_instances; i++) { - release_firmware(adev->sdma.instance[i].fw); - adev->sdma.instance[i].fw = NULL; - } + for (i = 0; i < adev->sdma.num_instances; i++) + amdgpu_ucode_release(adev->sdma.instance[i].fw); } return err; } From patchwork Wed Jan 4 16:40:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F9F5C46467 for ; Wed, 4 Jan 2023 16:45:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0859710E5A9; Wed, 4 Jan 2023 16:44:52 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2069.outbound.protection.outlook.com [40.107.94.69]) by gabe.freedesktop.org (Postfix) with ESMTPS id A88ED10E595; Wed, 4 Jan 2023 16:44:36 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YAzwkHbA9KsGY5yhPPMIG9iZ6DZjqZEupPmPJoMfcBKYwk1CdKvnd6Ru3Hnpgt4ilC7lGh/3Gc5Vi5e/wCeNqbseTToI7tzeYceDkRoP3rON7tVwGbFPsZIUCXZMRHqRoIhyIVmrbxJ4SKiGtLfTMyz0bc0Ya3G0GbtbwgGop9c3lXAbzSYkZU1J9OuZoehLMm6Krdh+bJ0M0jAW2+xmHzNy7u1xvRGpLOAu2hLu7vYzYfIydDgMXH/pr0NOV9N/P11tFhZjXohV6h8a626Vnn7SxMhjmZjX1srJ8Qgf7EvzAxaBnt+kvykm2fGGGJoldrnxdXq6OAh3fdQ1M2+fyw== 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=XSYH0+mZnX6kj7QMvkTZsqwvN+7CMKoKWHGZjMyeZkQ=; b=jOD51Hqedn7Wyqt5znUkhxhbhSukgeLz1I/18tAjmEpd8s4gvxPkHWtvJvj2xmIVXMy7kU1rlJmZLh18lcTA6ZNh4ci0zh4XvQI8OOxwXvu6OuCxlueDBeomdEcUbXfyfPmhgtd2KMZAD1PnzuzIo+zEJKsSamcE1OqTEcCaE5wXlENgX+p6BiJoXkSVELuB+OGvEKOapVADUzaXMqTYNpdsw/9uZd7oar3vJrHYOLXGkggcevYtofMpE2FD0gunXQ7tFY0rNmEBgn/Ltq8Tnk+muwFlg7amVzBwG1mhorR4mOs942XO1m9Mpg/KGdxS22MT1VlINgaYMDu46O4ttg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XSYH0+mZnX6kj7QMvkTZsqwvN+7CMKoKWHGZjMyeZkQ=; b=3XENkLCaqJcSvpJNGnLHJT6FbrvUdd6W8tsoIWPfC//H08mdRxiA8T7PZvCaLFbfVKZu1Zyr1uRn1cILfVZx4h8k/Mc3Gpidw58hyrN1ADa8je+KqQgjvq8g4jNmoc89cY1rtxy3En8pjOSkBi5X/Am4smeGmGjHes4uKe5FB68= Received: from BN8PR15CA0020.namprd15.prod.outlook.com (2603:10b6:408:c0::33) by BL1PR12MB5222.namprd12.prod.outlook.com (2603:10b6:208:31e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:33 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:408:c0:cafe::f5) by BN8PR15CA0020.outlook.office365.com (2603:10b6:408:c0::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.20 via Frontend Transport; Wed, 4 Jan 2023 16:44:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:33 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:44:32 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 38/45] drm/amd: Use `amdgpu_ucode_*` helpers for UVD Date: Wed, 4 Jan 2023 10:40:27 -0600 Message-ID: <20230104164042.30271-39-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|BL1PR12MB5222:EE_ X-MS-Office365-Filtering-Correlation-Id: b25ac736-1d6d-461f-e643-08daee72f52d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vOcdcoV+H7vrC0BN0yg68fQS+rdsk054nwG6xlG+akkUetZ9BNFJPlcY/4KGy5nINPX9CVkJyW+u5v3Pp1D8sleqtXLqnhNJs2zfgurkL83ScYLYH7NjGlZQjhajd4RVlKXWkh8fjQDT89olt/rf7LZt25exeASo2i4MZnlZnlI0PC/PZF8jYPVSQWxZir1NvCfiL/T53DjNk65n/W9UHfXjQRCiqgVgeivTrWEwXJh4PesvF6D+1Bn/VKOsO7EoSihWGbznCgvgZm7Xk46NJm/JSyHCdPdyAOAhj1G1vE47xlarl5uu5w48V46gdX9MiCJYa/pSFTAHlZPFnAmdC1vRWVo3cX+dZ5c/ysx5cP0zdEEyF6ySvG69H5DSZVq3DJ3koDIPtfEeq08bL0oImjAB3Ijx9LxKM9wZvhDQ8RmdoHyEa07doVBRml+mcyCCVkuU2Sv1UvnaLal5GnK2SW6AdYOSEh2c5pWDubyJE3JsJ1vA0wuA5aQuBq9VvnLDy6iT/S7gsLY57e1INSBqTxQM/XRFti2lSKqx2Nm5DD51F2CZJ/1+F3eq8L4akhZ7nM24tc7OYLwnmxCbM77bnphkvM7rCHXS38gGkKkzhr8l0NZBkqKhBsu3NivBohLjfogXcWPpbmAW+mKMlblppyG1UYO4FJYgfKa0I4CsPTZfT2VJesjGSO+lizfUGvE2xrLIk2iGLIJoeMGRGu/pm1kW7Avek9Aast2Shqt483lSokZFvwMAvV3yS2pwGiobBg+23E3A3AtEtR1yAp6Ypg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(136003)(396003)(39860400002)(346002)(376002)(451199015)(46966006)(36840700001)(40470700004)(83380400001)(426003)(47076005)(1076003)(16526019)(26005)(6666004)(336012)(82310400005)(7696005)(40480700001)(86362001)(40460700003)(36860700001)(36756003)(81166007)(82740400003)(356005)(2616005)(186003)(316002)(4326008)(478600001)(41300700001)(8676002)(2906002)(5660300002)(8936002)(44832011)(70586007)(54906003)(70206006)(110136005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:33.2986 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b25ac736-1d6d-461f-e643-08daee72f52d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5222 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c index 6eac649499d3..ce19e73b75bb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c @@ -260,19 +260,11 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev) return -EINVAL; } - r = request_firmware(&adev->uvd.fw, fw_name, adev->dev); - if (r) { - dev_err(adev->dev, "amdgpu_uvd: Can't load firmware \"%s\"\n", - fw_name); - return r; - } - - r = amdgpu_ucode_validate(adev->uvd.fw); + r = amdgpu_ucode_request(adev, &adev->uvd.fw, fw_name); if (r) { dev_err(adev->dev, "amdgpu_uvd: Can't validate firmware \"%s\"\n", fw_name); - release_firmware(adev->uvd.fw); - adev->uvd.fw = NULL; + amdgpu_ucode_release(adev->uvd.fw); return r; } @@ -394,7 +386,7 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev) amdgpu_ring_fini(&adev->uvd.inst[j].ring_enc[i]); } amdgpu_bo_free_kernel(&adev->uvd.ib_bo, NULL, &addr); - release_firmware(adev->uvd.fw); + amdgpu_ucode_release(adev->uvd.fw); return 0; } From patchwork Wed Jan 4 16:40:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088769 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7226DC46467 for ; Wed, 4 Jan 2023 16:45:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D4D810E5A6; Wed, 4 Jan 2023 16:44:51 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2089.outbound.protection.outlook.com [40.107.223.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id 865C410E594; Wed, 4 Jan 2023 16:44:36 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NHsUuafHgwz8Gs34zlqbt458qkdDEr0LtwkAwhKoEmBLyIFzlfJJi0LRpYgvUuFhEELNXHb4Wj4+ifNa8fTJQmANsu6//XLSmioUh7R0MSVYtwtDy6jnFjSFT1Xe9ic32wm/0iQQJvlirneH/Ykkr4Fm6MmWmvqKOJye1KaqjDlk5nojFANN1kzpDOsAlfR4zZQQSCJfS8n2lTWLblRC2eiMyNxemizXch9p0tmMVei2DUApTwNZMsSfZoI8XLF8dQx10w/kUDzWigFGZwyoMeeA/uJDctqjb56/DMx4xcFhhMtJc2kXWy4DlsVrl2rODJ8dDJYTZIKENACmKSZgWQ== 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=MGuTatsV4PKGSiz8zb6WiZQcsevMtBD8OUcxb+n4fqI=; b=H7/heNOVUwk70kBX0W39j3OfqQd0z597nUPS9gUYO4Nv2kThWKwg2jQ56OAsvKjbN3zBkwnnER+XSd1/DdvkKPRU0FsBzRwayIMDY5uWJOtmha4235lYjqDOShEYf8GQZb7V60/OcVgTAZNxYnIOIRi8TYwX1tjV87faEw+3PzO7RQIvoPRypxUs6Gl+839i8M0F4QpoAMvf82hK4z4CUeQwr9sHfenxbrC7dE3FjZUaD2VU9330ewxb3vQCH/V4twZQNtN0P33pRN7xXDVIQIl9qnC45SN1MK5ltrL0n9mTrCLVrl9sWzdNFwN2AhCgMKaLKSVQC24GsA6wzM3slQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MGuTatsV4PKGSiz8zb6WiZQcsevMtBD8OUcxb+n4fqI=; b=gjZEFz4Ws4eEv3FYH3sfyxK7rrpxuaxBW2csLhaRzi/hvSBrmp1PBdOmqc1VHgcV/1JbhO7ReYztfahmkNSaIfVEMPEP591Us5mTNtpJtRCoRhG+Yw6szAz4jDaZfg/kM11as3zvsWW1nHoKE0dwn/UsZj4xCvt/xwLc7E4I56Q= Received: from MN2PR14CA0018.namprd14.prod.outlook.com (2603:10b6:208:23e::23) by CH2PR12MB4230.namprd12.prod.outlook.com (2603:10b6:610:aa::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:34 +0000 Received: from BL02EPF00010208.namprd05.prod.outlook.com (2603:10b6:208:23e:cafe::4c) by MN2PR14CA0018.outlook.office365.com (2603:10b6:208:23e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:44:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010208.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:34 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:44:33 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 39/45] drm/amd: Use `amdgpu_ucode_*` helpers for VCE Date: Wed, 4 Jan 2023 10:40:28 -0600 Message-ID: <20230104164042.30271-40-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010208:EE_|CH2PR12MB4230:EE_ X-MS-Office365-Filtering-Correlation-Id: 91360a0b-6f6f-42b7-c4aa-08daee72f5df X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9tfuP5XBdSI1Ph91dC33pj8HgODwnsD+V7sLR/9tWo9f7bKffHDRek6ZwwTkFDLQBMHQ2iqS6S5xIJbFCxy4/xlsmAOaggDS9S9y4TSIEtm08Z2XHukMTpvCHuJhjurSOyPYstQToLghDRWHnCJf8feHrIBibfb2k3XVUYS0JuKDrFiQJjvfEW+cx/SMRtvFPd789Wg1j2Uj8ZJHdL0Ogtk/2CHcQCPaikrUUYanbZikzmq6hZmbyYBF/J9SayIiaqTy9v/iln0VEwP63v/B/rK9JyqY5/Uft7aQRRkeMhP3ri2vuCLJ8j263565HYhWzk77Fgg/I97mJutZTvysUMnjDpFSO7DUAe3muMr82CRjNpqnvZcYqU4lWf7poPBCPXsmw1V1nHqlD6x4YZJI5bhm2efLUNVt+oo4S7Rlur+us8tXJSX08OKRVmtye1leseD/s2YgaJFt3lUZWsm2219qud6ZOMXGgqYZzbsOxgGnfZhAqXCkAIcNXyX3rGSXAULNDcuPfSnR8li21cAjpLxaVCzTd5lLNozkiv8G2FMzPyZ/IKL0E4ly6wTgGPwBPwrrcbfxi3FjLMPZxt2OMCBOBtW/bhheqrjJ7u9h3StShXzSSQYGkdr2gRyIxTuIr8WqsLWzQU5jQ/AfpoiONRV0usyduM/ENFpssKb8XpcusgVEEMKGJixDMs3gbPyRzWeDY3kNadZFwD9DtwgJ0VP4aCdiwZs47kMlAaS0HCDSaEyKDor7/s2wPqo0rq4e1v3TUT+ZA/EvTbI0CdUVXQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(396003)(136003)(376002)(39860400002)(451199015)(40470700004)(46966006)(36840700001)(70206006)(44832011)(70586007)(5660300002)(316002)(41300700001)(54906003)(2906002)(4326008)(8676002)(8936002)(36860700001)(478600001)(110136005)(82310400005)(36756003)(7696005)(6666004)(1076003)(186003)(26005)(47076005)(426003)(16526019)(2616005)(336012)(86362001)(83380400001)(81166007)(40480700001)(82740400003)(356005)(40460700003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:34.4642 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 91360a0b-6f6f-42b7-c4aa-08daee72f5df X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4230 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c index 02cb3a12dd76..019763f7881b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c @@ -158,19 +158,11 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size) return -EINVAL; } - r = request_firmware(&adev->vce.fw, fw_name, adev->dev); - if (r) { - dev_err(adev->dev, "amdgpu_vce: Can't load firmware \"%s\"\n", - fw_name); - return r; - } - - r = amdgpu_ucode_validate(adev->vce.fw); + r = amdgpu_ucode_request(adev, &adev->vce.fw, fw_name); if (r) { dev_err(adev->dev, "amdgpu_vce: Can't validate firmware \"%s\"\n", fw_name); - release_firmware(adev->vce.fw); - adev->vce.fw = NULL; + amdgpu_ucode_release(adev->vce.fw); return r; } @@ -226,7 +218,7 @@ int amdgpu_vce_sw_fini(struct amdgpu_device *adev) for (i = 0; i < adev->vce.num_rings; i++) amdgpu_ring_fini(&adev->vce.ring[i]); - release_firmware(adev->vce.fw); + amdgpu_ucode_release(adev->vce.fw); mutex_destroy(&adev->vce.idle_mutex); return 0; From patchwork Wed Jan 4 16:40:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AABDC46467 for ; Wed, 4 Jan 2023 16:44:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BFC8810E5A3; Wed, 4 Jan 2023 16:44:46 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2076.outbound.protection.outlook.com [40.107.237.76]) by gabe.freedesktop.org (Postfix) with ESMTPS id 194CA10E590; Wed, 4 Jan 2023 16:44:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BnbnTniOHtANeiD4Ge7puPWodtjLQn2DvZM5kDKl1C3+ratuDVTu/tAdA+CNeZ3Juo4/4+5XSEa3g+r1kUzrRDMsZJNC2BFc7MtZ70/f0zsWUhWvhAxPMGdCuNdyhFnrtSkbkPikctDxuzRMGuT/GWjQmXi6/TZItUaYBC92TQ4DxJDw1LjjI2SndQOjAeotH6fhQg2C/waHYN9BdWxI5GYcMlsPeJfliixzJEIqbr72xsluwpPOVrk2MNp31Q2iKb0N8aNpOEdt1cLD+SEQqmFucZAOkE/ZNawF3qUfobMsEC2HBfXXSBQm0n+lnvLXqfditZBcMPdprdqf1rWV2A== 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=R0OdBV0RYOpDJ+5mnXhWrtN8vEHDBZnpKlxrb98oruQ=; b=dw+qJZVXeJtuGFSy8IDZBZqeZJsDE/QU/nhH2wEbIOpD74h6BuyY3K4YaIojFd+GDHoUhiOIPQerMyso47x6aN2R9Lg9w5htxgvAgCNoBBJUXezMLHVXvJC1+X3toUWLOW+kIx0Bn/qdlowK3TP0FarQVgzyMllDvw2vTJ3eUVKx6tGDmcmDp5IyxiFFOcAWplWwvho2087R+rQuhPNl4QIzqP/ERvTyiV0lARi8fSOrFUbRe4uP1dV4Cj2vWJb2DOmeHa79BcGDqJ4g9mBybN1m69bFrqfBjZwGxH264n+AuHnagOlSrsjPjnyDN+z3BljadqBBzYjEPHOQskuMlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R0OdBV0RYOpDJ+5mnXhWrtN8vEHDBZnpKlxrb98oruQ=; b=X1MOBJTggC7DgZ1r2HG9JWSMLi/Fc7EfSVH+BM7NLJCehTUw7cSAe7B7sl0PIBMaUk/uRDp6pg6/uR5cihG5Tm5l3tJZlVVNWQByH+g/pXff4TwyCE3SK/uAL1ZHC22lPzQ43TyWWV76IhOFfPxE5H1bM3YyUuJV5vueBogH56A= Received: from MN2PR14CA0002.namprd14.prod.outlook.com (2603:10b6:208:23e::7) by SN7PR12MB8147.namprd12.prod.outlook.com (2603:10b6:806:32e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:36 +0000 Received: from BL02EPF00010208.namprd05.prod.outlook.com (2603:10b6:208:23e:cafe::83) by MN2PR14CA0002.outlook.office365.com (2603:10b6:208:23e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:44:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010208.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:36 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:44:34 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 40/45] drm/amd: Use `amdgpu_ucode_*` helpers for CGS Date: Wed, 4 Jan 2023 10:40:29 -0600 Message-ID: <20230104164042.30271-41-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010208:EE_|SN7PR12MB8147:EE_ X-MS-Office365-Filtering-Correlation-Id: 5646aa53-d8ce-474d-ce38-08daee72f6cb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pqXqdnGtTTrhLNYAjx4uFp2zets09uj8umBMOj0L2h6glPN7Op95rIYm6TXTM3avkrdr5EGbiwt4lR876+T8z7gdEp+j+laiOQZfL/qevl9kxG0Cam3yQJJMVo55e77hw4X0kRqjuOYudsOHKTVA8mWRgVrP9XISVwrnaVMseUy7WrfemMj8QxbmuyO/jASx5Mcg/aWPqLULlFdQuLn/wmjHkJim4ekFhncPF2QQjbI9dAaHtKn9Eo5C09HIEnwxh/Mdyc5oZpUJiF0NOzmGgiMmqIWv5buWn1CuHgn3WIAj26/m70eKME/sjIqFh2+weLhjluPoVREy38uc2A2n8kyrspIAAe5xjJPA7Lxq21v+85IS0wAPud+nLJVEP3C/++/lrGpmEziiz+7YwZ2YxVfyTp44KKIL4XRW4cN11Q1d8xbzvx9HAi9WwZk5nNMLtuOQlUATcMHW7/yrP0kAU9ZULne+6cwxe4Q/62FfQZIaQz+7JzEh3PWHbxJKng5IE+V0DUdOUBal6R7itOzHvOKxEtRspM4iijBA3kuext/C5mDYbneLGn0AZ+WjgpcjlDwKrNMQbtsc3++G+eBDhdmmYKEEwlLcNlzkosabQ209o5idqlAGlWPo2LsdIaGmU4+1LuhyAEf8sEw18btDWsGk+WsJkapX957DC+kXravE+FkUZXjE7Bc432w/p64WmE285xHxONqAT0lbFjHBRjDVIbP3+NDv6XeE3w8HkfqRZAm3S4zoFHTYMojWQIlbZv4NV2ETqUzeCqNJP+k5MQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(376002)(136003)(39860400002)(396003)(451199015)(40470700004)(46966006)(36840700001)(16526019)(6666004)(26005)(186003)(1076003)(2616005)(478600001)(110136005)(7696005)(36860700001)(70586007)(70206006)(8676002)(4326008)(8936002)(47076005)(41300700001)(426003)(336012)(83380400001)(44832011)(5660300002)(2906002)(40480700001)(82740400003)(356005)(81166007)(86362001)(40460700003)(316002)(54906003)(36756003)(82310400005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:36.0268 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5646aa53-d8ce-474d-ce38-08daee72f6cb X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8147 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c index f1a050379190..151a313fc2a1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c @@ -411,17 +411,10 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device, return -EINVAL; } - err = request_firmware(&adev->pm.fw, fw_name, adev->dev); - if (err) { - DRM_ERROR("Failed to request firmware\n"); - return err; - } - - err = amdgpu_ucode_validate(adev->pm.fw); + err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name); if (err) { DRM_ERROR("Failed to load firmware \"%s\"", fw_name); - release_firmware(adev->pm.fw); - adev->pm.fw = NULL; + amdgpu_ucode_release(adev->pm.fw); return err; } From patchwork Wed Jan 4 16:40:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088766 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F1F0C46467 for ; Wed, 4 Jan 2023 16:44:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C510510E5A1; Wed, 4 Jan 2023 16:44:44 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2089.outbound.protection.outlook.com [40.107.92.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0383210E594; Wed, 4 Jan 2023 16:44:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ww+5jUxA0xs6Pw5B/9Z438nlNV/nS6BBe9EkjNsHgNx3YlcAY1KYxsam4/YJ90YxYHZz4g24bWaehtbWgxxA7dYne3zAcIQCZnD+L37qt2wNdSZxDBHDaRN/ryi5UMCzU8R1204+x1RdkXlsyi+prt12ai41KlnTtZCy69xW8PsTJrh59Saue17jY4P6pjp3dapEW8GRHMBib9KLdtsvHa7KSs4KVN2Yrz3OHXDod+Bi/88hVtsjk5Hfe/XzAdV+KEWzLqHPNkHsLxOBRYUuwAGcD6z9znEw43xA7u7EDKDTBiiNaylNHAgwnRGI7f/edWlGlUoFdZqaSmaKAKDa4w== 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=oG8GSN2xT/clqjksKE9gqJFdnzdD92TeCz8xdRbaRE8=; b=fyw3y7LoTOM2xR+EFqJjC4fr9ZpARp+POMT9CHnY/Ca38OdunvFkduZVDLcakbIyjjGpgM8v5YY4hE+1YfbnJOaTvA46htXUD7nmzsTIU46GOt6PeFZGiOMIalIt27+c6MtI/T1w3UFeaSSWszBysd5mlMW3em/oE9IgGqTE8YVZpEVBP3o7avQIGhp5EjDuYKWHAyuLf2erT1R6hcdDYhZxLC6V1+DWfv79JaaAo0uTfWuDrKoMagLW9UF69Mp+kfEuEdAzucQ8oskTAJ+uFzSy38K7oh24+n1YouY5c+/KHYGeYCgsoHkCmG8zKYaiC/H5z+Dx6mkD0a1dtcG2uA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oG8GSN2xT/clqjksKE9gqJFdnzdD92TeCz8xdRbaRE8=; b=NXWaIwlZKBKsFBT4RSM8nUyQlhU61nSWYTZecrPN170bnirZMX7729FOrWMpcpPx48XPVpAjvKWMEOBct/fO2n7q+iijVVw03bcbs37rSsWU5ORMWvBCG4fiKRu8v941m/dongT3qV171j95Jhe9OOpk1rv/G+D84XErBSD4bug= Received: from BN9PR03CA0621.namprd03.prod.outlook.com (2603:10b6:408:106::26) by SJ0PR12MB6734.namprd12.prod.outlook.com (2603:10b6:a03:478::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:36 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:106:cafe::a3) by BN9PR03CA0621.outlook.office365.com (2603:10b6:408:106::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:44:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:36 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:44:35 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 41/45] drm/amd: Use `amdgpu_ucode_*` helpers for GPU info bin Date: Wed, 4 Jan 2023 10:40:30 -0600 Message-ID: <20230104164042.30271-42-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|SJ0PR12MB6734:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d8212a1-97c3-459b-5274-08daee72f72b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KwukuH+728Vb2QkCoVQzY2KqVowCB62ifbHOcYGjtwn4WFTTFndSLucr8GeCQQr+bCtgUHnfWRuQowLluJLO28205eJR8C3QNDKl/aAMP+oipsu3i2In8s9QARZE8hUKtT3thtRGjBoqAijHOWbUB0bNZdSfe7yREz2wzn42H5S3T722S89l1DoaL6kwm4o8y8XkUhIZ7sHBTmGe1dpNYNNTGADvd3xH99c7aDAgqscJRu85ktNUQAWFSoa5Q9Ee3BfBLqxeg8Vco22i+y/s1xUHUJeGd1SWbFiQn7ZuwWOA6vcgjFxzDSy7hGrA+gNRXEQZmQC6JosuJEJF7v3B/lmCapMboY9xBvxQEnRBt2LcW7s3KW0CYLO8RlqyhvaRnm5adbawxXVHDpUbI18HjYXL4Pd1FEH6r3Yn47cEqIi8S2NAfCGGp4OgKk6Jwxhkha29y/Olpqe7Hwj6xfEnsWn87jLZjM1JJXxx69pIWj8Pr1fFnjwrQMPgTkAmOrLqEa7TgrhyS/E85uxeubxtsf1sY4JT9kwKFVnsFhxZtsVt/ZdcwvsKjMwEihf96lYRwh6FS3aWmRZhNbAxrNmQVqnYayFMWlmlp16B/HW1MZAxnRQo5Nd0m3hBFoUpVRfSwfenh9OFCyt3OQ9pWcAzZQE2EIi5gfa6lPKrWtmFHOxWMhJeU7YhAUYlLjsmhsYmlfAPZ+NS6HJbOELGgfdo4ZDyL6PRfeNCSir/ENZEPxZJyanPUWZrWgUKBMOiiFsg7M2qUbiA4E5W3vgYh7aekw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(346002)(396003)(39860400002)(136003)(451199015)(36840700001)(40470700004)(46966006)(36860700001)(426003)(83380400001)(86362001)(82740400003)(356005)(47076005)(2906002)(8936002)(41300700001)(5660300002)(44832011)(40480700001)(316002)(40460700003)(478600001)(82310400005)(6666004)(26005)(336012)(1076003)(186003)(8676002)(4326008)(2616005)(7696005)(16526019)(110136005)(70206006)(54906003)(81166007)(70586007)(36756003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:36.6371 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1d8212a1-97c3-459b-5274-08daee72f72b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6734 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index cdb681398a99..0d70eeb75731 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -1983,17 +1983,10 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_gpu_info.bin", chip_name); - err = request_firmware(&adev->firmware.gpu_info_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->firmware.gpu_info_fw, fw_name); if (err) { dev_err(adev->dev, - "Failed to load gpu_info firmware \"%s\"\n", - fw_name); - goto out; - } - err = amdgpu_ucode_validate(adev->firmware.gpu_info_fw); - if (err) { - dev_err(adev->dev, - "Failed to validate gpu_info firmware \"%s\"\n", + "Failed to get gpu_info firmware \"%s\"\n", fw_name); goto out; } @@ -4030,8 +4023,7 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev) amdgpu_fence_driver_sw_fini(adev); amdgpu_device_ip_fini(adev); - release_firmware(adev->firmware.gpu_info_fw); - adev->firmware.gpu_info_fw = NULL; + amdgpu_ucode_release(adev->firmware.gpu_info_fw); adev->accel_working = false; dma_fence_put(rcu_dereference_protected(adev->gang_submit, true)); From patchwork Wed Jan 4 16:40:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088772 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0B8EC4332F for ; Wed, 4 Jan 2023 16:45:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AFEDC10E5AC; Wed, 4 Jan 2023 16:44:53 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2052.outbound.protection.outlook.com [40.107.94.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id 438B810E592; Wed, 4 Jan 2023 16:44:40 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ao3P3xp8sVApihMK8/luFDByBgDqmPCbD599z6e5+YkWr7UafopMrTEgKzlUNRVjAVjB6e0b/H4EGWt/GkXK8xRSO2/6GTEMa03iscI6VwcAnHDzSIqxR/X+KKsB2LmfJ2u6gcv9Rt8ir1kZvhSfBt2BV2eLLNmYqW+qSEY4A/Nm8g+9KDfAUUn+EfYvyAvug11JCAg9TyEDS+G/2R/J7f317d74oh/LkQ2XQuDz6QIYEXNtkDa+sXEyvMMCwCU8vwHW8jZaNhLYcHx3Tuw9soZgRu03Sd9a7K67jHPaTOp1R4bQ1ZiTWzEFPxdMsSIYUfrauUGzIytt6FyRWjME/g== 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=TdDo540KYk3IWe+cQKczP4f5TYkjndp0Q8wogcq2XY8=; b=DQpYdOJ1drr5f3L42o82aRBA50iWiX3t+kEmlqLHoroCoZ0iUxBOzvBxKzMChZbcj76nyczKqm47KFhDTpO0syQWkphACWfAlJhGw2n7XzEWRwWhsXBgqDs7aFyqI808EB2bVmezqs3pjPek8M+MXmyMMioW78WwXhguIn3R42Z0xcsWAXaHDRGiiVFx4KEDy0lrMFmaDk69ffO/sFMvLw2aWlwVuB8GfpCafINYoG1teUF8gxgjxGQv60OADFpgJfg3/SI4eJphf1q3hSkAeseJa0G1ipaPkiPic3zawMdu14OS/lwyPHwftEreypztB9r0mLg1OSlZoAQjLQDq3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TdDo540KYk3IWe+cQKczP4f5TYkjndp0Q8wogcq2XY8=; b=Za10zzCzeBdvOJFbYUz7LxE52R4gIUv63b3QGZWlgTKKEP+R9DkUcjg9fsVaJUqoowYzaO5DmD/729tqAw3n2xRawUorJFfBPWEKbdP7I3+aJp8mKFeOnc/8gsd3R2+GE20oQnvu00aMMhuHqcFvEg4/TxNnF5X9TSbY9g127Qo= Received: from BN8PR15CA0011.namprd15.prod.outlook.com (2603:10b6:408:c0::24) by MW4PR12MB6849.namprd12.prod.outlook.com (2603:10b6:303:20d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:38 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:408:c0:cafe::38) by BN8PR15CA0011.outlook.office365.com (2603:10b6:408:c0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.20 via Frontend Transport; Wed, 4 Jan 2023 16:44:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:37 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:44:36 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 42/45] drm/amd: Use `amdgpu_ucode_*` helpers for DMCU Date: Wed, 4 Jan 2023 10:40:31 -0600 Message-ID: <20230104164042.30271-43-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|MW4PR12MB6849:EE_ X-MS-Office365-Filtering-Correlation-Id: 398b027a-dfeb-4c4b-3e18-08daee72f7ed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yWnT2jbKcqSlPgdFu9Bl9qTbTfESE6acqlPdKoRwRNbgKD3u6uDsUNBUu8Eu4AT+7BspaAAEcND0Otj8Y2x7Sx20slc6IUbAtKMYp2hITksbW0JiijFVjsaL6tnOeI+/iv9qVhg7pxzC+O8ws5mrS0oQhw8+5/FxC1cJvoAOuQkK7Z+1zTUrf+4omfGYGKcgF4uyogkl/IXh5jxdqdFetTngE1Rc+LSDxNxoMXit9U5NqOeC70AeKMPuGMCz6K+suSH/YMB+hyUUnVfZI8rn18ZIQx+nvVJTl4K3msUAsNo2xabIXs4BSmYtdP9dtVMKYYODNJxU5HDmWSlF3EFg3aL4aMfpbsZB4K+rOWNePLV44YT1Z/BGmG6ROtvg432da+LJ1pa652RyU+Xe8uvcopyRP9eOT/l0tehD4Ucylxg6PeEsbiG38SY4OfsMfKvg6vHDkN9pln2owowY0n9hk+GPLMylvIB93nbcZdeZNMWh6cM69PZkpboSlJwL0eUA4KzXHT8BZljQZ61mTsxejAxfbuCKy2NHxGHmn+8J1f/q5npNiAhMTqwaHBdRWWFFdhj0pEc2VrrhBrmPUKG4sqIHw4ST6nXWLDvBy/xhbGH8DEQVof4Jw2AZ3Pyd20tnjySh2wpRDKWICFbhKGKlVs3PW1QHcziPBXsIUb4QIzejT2sffrKfDPa10Sw//x91YA3N8GmaArFeYvvW5fXUPVP14wnAtwP7KO8W8+FZ3wA4oyAgeF3VLHTf1Z0jBDKr X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(376002)(346002)(396003)(136003)(451199015)(40470700004)(46966006)(36840700001)(2616005)(426003)(36860700001)(336012)(83380400001)(47076005)(40480700001)(1076003)(86362001)(40460700003)(82310400005)(81166007)(36756003)(82740400003)(356005)(70206006)(2906002)(44832011)(110136005)(54906003)(41300700001)(5660300002)(4326008)(70586007)(8676002)(8936002)(316002)(26005)(186003)(478600001)(16526019)(6666004)(7696005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:37.9080 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 398b027a-dfeb-4c4b-3e18-08daee72f7ed X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6849 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Leo Li , Lazar Lijo , Rodrigo Siqueira , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 3908d715b90b..19c365283d91 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1881,20 +1881,13 @@ static int load_dmcu_fw(struct amdgpu_device *adev) return 0; } - r = request_firmware_direct(&adev->dm.fw_dmcu, fw_name_dmcu, adev->dev); - if (r == -ENOENT) { + r = amdgpu_ucode_request(adev, &adev->dm.fw_dmcu, fw_name_dmcu); + if (r == -ENODEV) { /* DMCU firmware is not necessary, so don't raise a fuss if it's missing */ DRM_DEBUG_KMS("dm: DMCU firmware not found\n"); adev->dm.fw_dmcu = NULL; return 0; } - if (r) { - dev_err(adev->dev, "amdgpu_dm: Can't load firmware \"%s\"\n", - fw_name_dmcu); - return r; - } - - r = amdgpu_ucode_validate(adev->dm.fw_dmcu); if (r) { dev_err(adev->dev, "amdgpu_dm: Can't validate firmware \"%s\"\n", fw_name_dmcu); From patchwork Wed Jan 4 16:40:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088778 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F2962C53210 for ; Wed, 4 Jan 2023 16:45:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7B9FF10E5B5; Wed, 4 Jan 2023 16:45:14 +0000 (UTC) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2042.outbound.protection.outlook.com [40.107.96.42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 24B4110E594; Wed, 4 Jan 2023 16:44:41 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TPkSSX56e00lWRe1IU7GAKP77qGtL+aCkwUc/8cpStmMOeDvCUhsqaBHX2jabSB4NFVTGWBQNPTSyNnEUe397ypfySmEKw0J0z7joFozKaD9kDdniKLn5kcjmKfBQU2UGCpBK/Rx9PHVE9KXl5cPdwTHM1DxDKJMvNtX7NKu9WuV7QYtp5Dxs+SiHK7/8FHer+wcNm/KJznqGZz6W4aG7hMaSzygC2b9jej8GMK7Gi+5+AsrqirnKpqcxA75H172vAzx5yGp+n+GI+syzbmMr4tUvgg1A4jkRpOm9tBKgx9375C8zDdDjx8c3W6i5KZEm+oPSkFsBSsoQma/gsyr3Q== 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=LgoefmYR9RWKw0Xfu4l6VGuy/avsZgAhPINyJddPdnI=; b=QDX1vObu2FH+p9JWy4xmNHvRSUkqOBXGP0QxvF0O+PRsOvJyVTmZYFqvcWvyiBZ88rkqNPmDuP8jaMrwGixiEkpTW0oLP/y0h2FB7lWy0iR5IrK9B7qf8oncn/+7R1eZPL4gQCx4l1kDRv9dMrQlAb0aovlB7vULyr72lG/mpNXmmnE4MNzQgvwHZn8+cVCs/U8RnCG2LaLyYavMcdRUNzrDuJ9OmXrcxFzJ0lgt8cnzIIY2yS4rZshhtDVeRkMpePSYgcjIkIlj8mPF+0dsRLFq5RvThXT2jP/gzrkzM6h2400i78ugQ76Qt5TU3ah4J3sjwZAwHhFRI3rF+zySMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LgoefmYR9RWKw0Xfu4l6VGuy/avsZgAhPINyJddPdnI=; b=SO+KFr57sx4z+IrA7n7oqGvTTOlCZrG4x3NA2byYgPcPZy40eEsSpV+TzEwbaCHunxu1VDG6WAFMgqP94YknmKGu5UOLkdK0/u0A6VbE1eeQzYCIIGi6PpLO4C1XRTHRPYanHMi3aXZn1EeD12Qm6N8anwsH7TdT/sFxS5vTCtQ= Received: from BN8PR15CA0018.namprd15.prod.outlook.com (2603:10b6:408:c0::31) by SN7PR12MB8433.namprd12.prod.outlook.com (2603:10b6:806:2e5::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:39 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:408:c0:cafe::74) by BN8PR15CA0018.outlook.office365.com (2603:10b6:408:c0::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.20 via Frontend Transport; Wed, 4 Jan 2023 16:44:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:39 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:44:37 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 43/45] drm/amd: Use `amdgpu_ucode_release` helper for powerplay Date: Wed, 4 Jan 2023 10:40:32 -0600 Message-ID: <20230104164042.30271-44-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|SN7PR12MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: f9eea44a-6236-496e-8595-08daee72f896 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dPeMU/MfE2cd3Hyya2QYuQctNJKXbrj1LbeCkYAbfpZHZEvRn9sTwerkpG7sOKN2r3/kU6G1VInUQCxLlsb+raTv1sRW9KhRrCZ62+aNyVnDpOrM+cFT27/3twV0a+0ujrMcXGi2M8FnMC2bDdUNVSJCbW8WjI1li/5TvVIOvl9kIy75FWGYDxc1r+AMVcJTVyjDrIGNgUjG5pwlHFM5cdrpvIVX0AKzHXfHZxyTdQ0XBotgn0S+tSiaHkgmCZqZyBUp0L5ZQ1IcpHxAMhn4f7tL8dGFcvBYFYgU8vtpfgfVV55OpRRqkYGlUMoP+Y+T/F+7l9ivLkBS7SErAziEdW+9TkaALcmfe/l/uy3IafGrOzY0luC9zfrGFfxnKTh7g0gwqLjqHqr/8eA7eq29mNPhBgtAEgkTMHymZrTErw4axbJ3kbkIVp5tPH0a87G66ZPGClVoVIGRT+PQgcRNPK+9GelXdvgOqmYnb4iNp85rYi74EackSDYaZuZqsYfxVgeQLDJoIc89/cTCERAQx7JG5+Kf264vMffRF6ezCysC0HzUl2LTpP9k0Ny5chMWZg78FBpbYLIak+c1xmr585WYX9dkYMmXdEhuYdYoaHpBRYnpxJHr8ODhz5LajWXj9XzXEjvjfcqNBcwzNL9Hboh9oxyVjpOrj+P8juMb1JFgDARneiazkYj2ydFzdzWYihQjDxyktwvEuM/dp8drpBzONpZjR6cEvbcQfJFzw3/yVgGjTfU7PTUS6pGbEJaWt2TcNr/Z8/D9SbCoa9hrgw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(396003)(136003)(39860400002)(376002)(346002)(451199015)(40470700004)(46966006)(36840700001)(36756003)(81166007)(2906002)(82740400003)(5660300002)(86362001)(356005)(41300700001)(44832011)(8936002)(4744005)(426003)(83380400001)(36860700001)(47076005)(110136005)(54906003)(70586007)(70206006)(4326008)(7696005)(40480700001)(478600001)(1076003)(6666004)(16526019)(8676002)(82310400005)(2616005)(26005)(40460700003)(336012)(316002)(186003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:39.0174 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f9eea44a-6236-496e-8595-08daee72f896 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8433 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , Evan Quan , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_release` helper is replacing all calls to release_firmware. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c index 8f2cc6310340..15f41189c911 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c @@ -111,8 +111,7 @@ static int pp_sw_fini(void *handle) hwmgr_sw_fini(hwmgr); - release_firmware(adev->pm.fw); - adev->pm.fw = NULL; + amdgpu_ucode_release(adev->pm.fw); return 0; } From patchwork Wed Jan 4 16:40:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82D21C4708E for ; Wed, 4 Jan 2023 16:45:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B243010E5B0; Wed, 4 Jan 2023 16:44:56 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id C876710E59D; Wed, 4 Jan 2023 16:44:43 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CZXBvYH+F6unS23wHuRaElEFX3zSA/pSmsVXmcqEWkLKAyJSN2S6SxTam9mOptWbfIK3rc7acV6ZE4sXF20I7+YhA5MsqoGDGREzScMEt+xCRNjyLPQVGh2JMrapD0+A9M/Bm/cnpm0MGS4x6oMIpkfiXsTiu9aL2eNTe9qkFxDnZHi8tLM2MFJJ4DnO+WLI0BCeP8CQc3WHRTi3CLv01GlxtjLN+XgLE6kVFaNXWYaezKyAWqzeKvnM9T4bP9U9bYVd1pHmUYHwi3CIQGLnplnduq1GrSPFpO8RAxpO3cSijdT0YJEce26erRdG8RIS1wKw1laDeHndoRrmIumMJQ== 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=AYtfah8psObx63uvmlkhk7Sf0R1xaDX+DdyKuxOPHH0=; b=cAo1F/2EMiGjIpXRJYurHfzKBG+6gPivf6bK2qp59OCKEZgiDQ506ZAn3mnXt4JFjJy9snVXHUqLQAaIoI51aM3yUbVs9m+FVIFf5GG+jNIEeR+CkOEP/T/o3DdSFFZ2tVf8utJkQ9EvpJO69nsp/oRULqFf6uiMAJUSjd9KWLZQV8z9FaZL5qOA54AxtdouDikCvhDwewR4a6kR75DtCaaMA6EbkLfmgrz3FYF7eWjMVEsrgIyNHX3iP7K8rViF5Wnd8pZIaPTbjAI7cS+98dVpq0TZACFc1KZLFx62zJjI+l6OhJNEag0kBQ/bn1HwPyFccaRtn/LpuyGgmA5ICw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AYtfah8psObx63uvmlkhk7Sf0R1xaDX+DdyKuxOPHH0=; b=CJP3pgW+vIudfovY1ye5VIXRRAreZqlIMnlPTlLtiZhT6Tu6QbLeZ9dxg2OSxrHqp81hYhSGRgS0LvH93w92+Isx5IEFKCHMjOFyy+ecxMmnAnpy3vR5jkOBksqj/QDIM6Muy99qM7dzI24ATTBf2NZlDzfF29CmKHidO/39p7E= Received: from MN2PR16CA0062.namprd16.prod.outlook.com (2603:10b6:208:234::31) by BL1PR12MB5062.namprd12.prod.outlook.com (2603:10b6:208:313::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:44:41 +0000 Received: from BL02EPF00010206.namprd05.prod.outlook.com (2603:10b6:208:234:cafe::20) by MN2PR16CA0062.outlook.office365.com (2603:10b6:208:234::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:44:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010206.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:44:41 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:44:39 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 44/45] drm/amd: Use `amdgpu_ucode_release` helper for si Date: Wed, 4 Jan 2023 10:40:33 -0600 Message-ID: <20230104164042.30271-45-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010206:EE_|BL1PR12MB5062:EE_ X-MS-Office365-Filtering-Correlation-Id: 1228bb6c-54bd-4c3c-678b-08daee72fa20 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Un5bJ9fojCYwcfmrm8dbf1uiYQYIbyozuYWQLi3utQVyGHIR604JLMk+arEzHfuM8mNdMdOyW/eLa2l2LznKQPiLzm6aJ57K+fv0sxcZAUGhza/qJcSTWSUHwdhWQ1+RsOeOr8NHT0wnEArb/UQqxULDIFPDpHTb3JIf87P64mr64pAU4/uBy5dduz1GUo/cmrCYCHtsHl/G+FEfYzeV0xkDcoS8FH4VZfJDChKd6ID2QYp2V35Y7aW8A8p0NrlgkmVA6e5uD1sfA7YzgGHWrUa8Ugx002rH7gwSHKBZzvdsSyOwOw2G4raKA02UsrbGSVS047ABa6QKc/b+yLL14vFEl5It2Xo0+JSxUXHMxjOrqk7Avzj2BIBjLG3ZZ5avswJafIiHJdh9gfs0KHk+ZjbNP4l1ruYlIlOIVZu6bgr4GJSAy/t4IBmmWCyrinTcdQI6SYN6jFH6LaXNqQ14BIqIFOJoY/px8zVsjRbkRXM7rlD3nSOVYIeaHcqnFSdMcLpQ/+7o0FOV00rP34BIfMEhpDPlE0y8pW1YtFHpyboy0qu4G4tpQWUzW1BmkPRuCt2nhZiiIOI9a4ubOYDi13z5pkh7IWUxXcHlTGek/FkDeyQc5hwz3Xvkhv7qCcimwGbchhf5HL1lq5X3Wde37RfX7vI/U8MQKghMsHnrs3oQb0RMzgpTQfNr+Md+V0n1Fv3oXHFfBPSuc8d+ixfZSTlWbUwbqZQzsHs/RTble3UCD7lc+3qCYot8WwcOJXKiDbvzg5KH9Ev0JjssADNbrA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(136003)(346002)(39860400002)(451199015)(40470700004)(46966006)(36840700001)(16526019)(6666004)(26005)(186003)(83380400001)(8936002)(7696005)(40480700001)(44832011)(478600001)(54906003)(316002)(40460700003)(1076003)(70586007)(2616005)(70206006)(8676002)(81166007)(4326008)(426003)(336012)(41300700001)(47076005)(36756003)(36860700001)(82740400003)(82310400005)(5660300002)(356005)(2906002)(110136005)(86362001)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:44:41.5987 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1228bb6c-54bd-4c3c-678b-08daee72fa20 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010206.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5062 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , Evan Quan , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_release` helper is replacing all calls to release_firmware. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c b/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c index 49c398ec0aaf..b4e5aac25ca7 100644 --- a/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +++ b/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c @@ -7714,20 +7714,13 @@ static int si_dpm_init_microcode(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_smc.bin", chip_name); - err = request_firmware(&adev->pm.fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->pm.fw); - -out: + err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name); if (err) { DRM_ERROR("si_smc: Failed to load firmware. err = %d\"%s\"\n", err, fw_name); - release_firmware(adev->pm.fw); - adev->pm.fw = NULL; + amdgpu_ucode_release(adev->pm.fw); } return err; - } static int si_dpm_sw_init(void *handle) From patchwork Wed Jan 4 16:40:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088777 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1B0A3C4708D for ; Wed, 4 Jan 2023 16:45:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6429910E5BB; Wed, 4 Jan 2023 16:45:13 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2066.outbound.protection.outlook.com [40.107.244.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8379C10E5B5; Wed, 4 Jan 2023 16:45:06 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EW1sfiDsrOv53PrOZB4GLMng/CNtIHh2oUHLBwNaRo/4eewjHRQQE8HLHGQ0ENWdBK8nZ+cfkGVpOu+DYijd7eKcxmFSdU2TDg4IJtsMosTdRfNenKF5fg6TzARLSCjbXIWdQ7QpeOnmsDEb2XWoaZgV+5aBoQbqsHI0vJomFt3QK6Rf3VSDIjHHJuBWBSo9AnpB2I8Hnhm+6nAzIwQlI22e0AZ5PCBjRoSPNTulJnfWCKmRoPlKoUr6+wD3kRvqISZ9qsRNyAEaHVs989TnBynrzBLTEDxS1Nb398XuXTfBsS1CXqeNaXTyohvTnv7JQADWifDIXeTimjGEfrijAA== 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=ExtgxtIGZlycjRnv/P/OsXElwLSLdwVVuaMvIuvFIf4=; b=ausaqHMvEnbdwL4g7LslutuORZHo6ZY6WH7IqgzpRhfRpWSWBWkcyfR+EO0WqS3KSLNtkQ06FUHZJFhxc+yaE+BSVYE/6TZ0dwuUDRkGpA3hRe1hhhA0YBh/mmIEjlGc46g/Udcy2jj8KPexOMOjLxUh1HpZKt3XKqcTRYlnXkxPtaRl8bCepq09gV1Nb90a97PXzrKhWbsRrgGe8pFSA42LPMGXpAniN6s022KNAc+fv9tZ0ZD2BvFv6wNPub2ApsVrOJImpXSPrHPpqjR2CF6f1Wl1w/wjF6GAnMcOYzzNIX4QuPJCz8neBeYxRe9HaB7P3YrzC+ITaPzqh11XfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ExtgxtIGZlycjRnv/P/OsXElwLSLdwVVuaMvIuvFIf4=; b=rOLv5i6D7uv5EwWb6DZBfdo6AhMWXuX6hNAgApb0Q/zOx7ouO141S+YldS9mXRsy/NwTHs0dRSMe6JkdoqB4Gi14PXPIkxOzi59U5euAen+AO626hVYHoWd/1860duNXzytOZC+OF7bw3cv8tZawM1wZyvdpyBJYISN6CI3czrI= Received: from BN8PR15CA0014.namprd15.prod.outlook.com (2603:10b6:408:c0::27) by IA1PR12MB6113.namprd12.prod.outlook.com (2603:10b6:208:3eb::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 16:45:02 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:408:c0:cafe::f3) by BN8PR15CA0014.outlook.office365.com (2603:10b6:408:c0::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 16:45:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Wed, 4 Jan 2023 16:45:02 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 10:44:40 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v5 45/45] drm/amd: make amdgpu_ucode_validate static Date: Wed, 4 Jan 2023 10:40:34 -0600 Message-ID: <20230104164042.30271-46-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104164042.30271-1-mario.limonciello@amd.com> References: <20230104164042.30271-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|IA1PR12MB6113:EE_ X-MS-Office365-Filtering-Correlation-Id: f831bcf7-82eb-4a46-8aa6-08daee730661 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FT22MuNWVL0aE181qpB545JezLErLo49is7aATYT3ytwJ5so4mCjqj+ML7YvLNlIEmlxWNiUYtE+Pdg98MzyRarfpUP4B3HS2vR6aEXqeMmm42OPjVFJAXK6mF7Yyn7KUdyS8EGneiUJbSozxKL6obMRIvC07q5oDI20c7ZS+Cld8bR9o3bFVud4ARpKk939+YRPVOwDXWqVzlPEYFEXlXCPRDLcLJk1YppPbcWdel0ilMgTD/IrpI0Ld8wSU0PmuVI+SD4W75XWDEOYmaexaWTBR4c2i4DG7G+4o2ZoOThR4IhSWgO9Md9XJxiapbaLQUzwPgz/rF35h/sIlv/rS/SI3C3Td1pUCnY4TXrbhJWv8JqlP6UIr+5m1bXAQy0wVzNnt4Hs7vJnwd6aXp8J6Vocnlzbjb3xF3rk227AGH9nuf3lW4vZqYzspSkCxqU+qkZj8QqiqRTS+0KQRJl++h8kuPJuR1RXj+ugZrTOkn3jnpK/7l3T+QikG90DixC6oQcibNNALevdmUJk50Muibx3R7jRbbua1ad/4KK/OpByYmk5A1ngX6UNEUzqDtN8wteDM963l5CUhMXHqtdrGdryl28V2tSm/rVAhAfnbfrj7Us9CpQwfXgTyb+yAaDMTmHdqX3acmZbEbyK3MZNDdVlWiLPfl7tmO4qwj8m1kR+Hn8aa7Pz+zDYbWZV7Ii0YsewTy8WlsOIAycoH0BFqX6YpQDryRr2hvQOKU9pGcc= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(396003)(136003)(376002)(346002)(39860400002)(451199015)(40470700004)(36840700001)(46966006)(82740400003)(36860700001)(83380400001)(81166007)(356005)(86362001)(5660300002)(44832011)(2906002)(4326008)(8676002)(70206006)(70586007)(82310400005)(40480700001)(41300700001)(2616005)(186003)(47076005)(6666004)(26005)(16526019)(426003)(7696005)(1076003)(336012)(110136005)(40460700003)(54906003)(8936002)(316002)(478600001)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 16:45:02.1583 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f831bcf7-82eb-4a46-8aa6-08daee730661 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6113 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Lazar Lijo , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" No consumers outside of amdgpu_ucode.c use amdgpu_ucode_validate anymore, so make the function static. Signed-off-by: Mario Limonciello Reviewed-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c index dc6af1fffdd9..b759a4300d7a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c @@ -504,7 +504,7 @@ void amdgpu_ucode_print_gpu_info_hdr(const struct common_firmware_header *hdr) } } -int amdgpu_ucode_validate(const struct firmware *fw) +static int amdgpu_ucode_validate(const struct firmware *fw) { const struct common_firmware_header *hdr = (const struct common_firmware_header *)fw->data; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h index 7fd2f04f7f98..28fc2960edfe 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h @@ -543,7 +543,6 @@ void amdgpu_ucode_print_rlc_hdr(const struct common_firmware_header *hdr); void amdgpu_ucode_print_sdma_hdr(const struct common_firmware_header *hdr); void amdgpu_ucode_print_psp_hdr(const struct common_firmware_header *hdr); void amdgpu_ucode_print_gpu_info_hdr(const struct common_firmware_header *hdr); -int amdgpu_ucode_validate(const struct firmware *fw); int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw, const char *fw_name); void amdgpu_ucode_release(const struct firmware *fw);