From patchwork Tue Jan 3 22:18: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: 13088059 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 D9655C3DA7D for ; Tue, 3 Jan 2023 22:19:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8271910E048; Tue, 3 Jan 2023 22:19:33 +0000 (UTC) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2073.outbound.protection.outlook.com [40.107.102.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8E55410E280; Tue, 3 Jan 2023 22:19:31 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gvdI0FyWQgb6r+BfPBT1Wwt98ffNvgZ5H6bTbelVF8fkqqFi8LfTA4oh8Ushy1adFLVCMvYcdUeRcHfbiydcIkiscsX7gFZ/JEdyyC2tWUE4MIrY1K4kQUr2F+1oh0WUYSKjVUpxhp+mfn6wVntBMkFs+Ib6Kwn5F47XLK685fWpaPxRsRqbogyWKvzSMYwq/BkdGoATNXS0x8vLlFUe8ShMiCTzkpIGXCxL6JRK3uxdsO9/mCyU3b19j7fOu3NfFeur8WEfqfkY5tiwKzCKlSNEShzVXh+YsHrZQ26wLUG1eRRcg3px2F/2DOhP2cP9z3A/fXYDbIFzRR26+z3xng== 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=ZEBFDgYD/g52LWJ43EKRazYa6C3BX62CThMucEPHIxw=; b=T3p70t+LJ4Fc1tyCBp4NmpvbzLaTaZo6nTRtCUJHkam1waZsb4mdw2RUeuDOiPFPgdCsUCJpbWTgx4t/RStdM00BUxmEKg+YYoPHn9I+d60qIcXGlddoWenduZEkzQyUNZcD+XjFQHOVwYpb7mDOfQfKPW5HggbeM1iWSCgPs2CWQKH2LvHFOlAr22dxPb6L6tAP7MFAueALVBerbZS6NjKMUN0Y40Uo4fyXx5oOuHUZGTDV4YibAE0HykZfo7AW+Rx8Ys+fg3apzS9Akh4RB+G00MaLjP/jpcgY0ZbPCPZYTmoq1NYPsEo1IjhTudER6h1h82qBMF8aXABIxl3EmQ== 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=ZEBFDgYD/g52LWJ43EKRazYa6C3BX62CThMucEPHIxw=; b=2gPaJ7kEH6x5567lLV7bBYK7GHY7PS4T//cJ5fNwJpTGTNcYKpuGV3WVyAqAMrrWpQ7OKGUVV0XM/nlGKzDMe65rph/DaiIAIKRheyeXewQT2uau/hP0Y8/+NJVa92eYzLbePrg22DsIx62boIAGkIaYQtwyGTFLuDFHrp8X4ss= Received: from DM6PR10CA0026.namprd10.prod.outlook.com (2603:10b6:5:60::39) by DS7PR12MB8292.namprd12.prod.outlook.com (2603:10b6:8:e2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:28 +0000 Received: from DS1PEPF0000E654.namprd02.prod.outlook.com (2603:10b6:5:60:cafe::96) by DM6PR10CA0026.outlook.office365.com (2603:10b6:5:60::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19: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 DS1PEPF0000E654.mail.protection.outlook.com (10.167.18.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19: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; Tue, 3 Jan 2023 16:19:26 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 01/27] drm/amd: Delay removal of the firmware framebuffer Date: Tue, 3 Jan 2023 16:18:20 -0600 Message-ID: <20230103221852.22813-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E654:EE_|DS7PR12MB8292:EE_ X-MS-Office365-Filtering-Correlation-Id: 26522b20-592b-4624-215d-08daedd89422 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JJBHoLcPqIXmYzU8RE6X8B/G8Ll/ndZU5w2Am2LqKHBkpOMLyLcVysO5ekusySv8S2x1Pr/LsbVVtVfoL2YArmPhMTo2FSG0ev6CVM35ImRAc85RfQQcqNddEXBOTrMLGq0OfSuW/C8R7wVR2aF+wk5C7AsZi5BzuGVNadbWKEZitzyzVswmWZB95qFHjDMKaS2IHrHBDjOVFVBQoK7iw+6pD8IhjgQV56+EI3SmQmxZ7sveMPColnW5CbfDAFLaNVTsAHs2dTkXp/UPVfhEWo0uhllFMZULe5zs6nkBbOEc2oXfUFN+9T2tjkhYaojLFHozTmJfo+OYm+hgTiEmIQ3vAPEdnyianQhV7zE+J6mDOom1EaXF4poqhCzxDZU3rDPJUjNgiQ00LMRLLWFcKio+lV0Hnqo3WegyhVDxuy7G9evadkf09ZPYSvyNBM7j5EzsujoChb8NAVfCq0DhCvJBukeHFzDX2v2CSod1FMzmpX2aEFhr2kv5cgaGCPmef4cAgZtco1FPPsdxEpqI/VieHBb+Ax/ID+evFm65eHL1DGnW+L4FV58sWHgyexkac6FH8lwOiXWQtrwA9E8L5bZ/rO47mMLFLSxmQoVpDEOxRyjsy+YHMfAhtPN0SoG21eontJRfzJGUi2tRp5sZJ0RJ3gc6XfmbcunB5nfo6mZrN7doIj6hc/JzVz7Ipqr22+Dq+wFGjbU7nhItumsFGNHAMuRwLMNbjLlWl1Zq//Us9GZERqXKdTy8VHWqDynT 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)(346002)(136003)(451199015)(36840700001)(40470700004)(46966006)(82310400005)(82740400003)(8676002)(36860700001)(8936002)(70586007)(4326008)(70206006)(41300700001)(5660300002)(86362001)(81166007)(83380400001)(356005)(1076003)(7696005)(2616005)(44832011)(316002)(110136005)(54906003)(2906002)(336012)(26005)(16526019)(40480700001)(47076005)(40460700003)(36756003)(186003)(478600001)(6666004)(426003)(22166009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:27.9548 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 26522b20-592b-4624-215d-08daedd89422 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: DS1PEPF0000E654.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8292 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 --- v3->v4: * Drop all R-b/A-b tags. * Move to after early IP init instead --- 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 Tue Jan 3 22:18:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088062 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 8389EC4708E for ; Tue, 3 Jan 2023 22:19:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B943010E28E; Tue, 3 Jan 2023 22:19:39 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2081.outbound.protection.outlook.com [40.107.244.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id 19BBB10E234; Tue, 3 Jan 2023 22:19:36 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W1nozkx9ThV2hJzHOCt2bjP5Pdw2/WXL6eXV2YtC3BpeLLRfbuGT2H0aBwl7ALZm1QWfTjxneWTfLKieYptIEiJm/weaFUddKyHrWJFEV5VTKT5PXr3r1Be4YUuPFeNkJpLmzZm4JUBXTTsjMaXJNKqZEh5d4w+GhjqAMtVvuTtW+eQlbZkKKAez5iNhqZ8h0knOpj5sZOBCkUy9chz2AQoKj+UBVkLTRFuWme8ovuTvblAfwPu25bntGN1IR1rXufoTLmBkmKLYe5T440dwkBiKpA+ULzXzhCLFBDHL6KDkqBd7x/zOHvO31m9zjtj8sFPLf6bEfVLNvJ38kH0o2w== 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=lyppqitZSKdQlbSpU3ipsKCDy/XzTWZGuEg81T3C8U8=; b=CFXnK2mO9UkKN2m9r7YSKo80Ce74Q6pm7h0UUMdabOXK0SAtjtvkwNdON4j3OlKhDMULt9uREgrEKqEPzQuiUxi5ChLaWE3z5mwg1WS9Y8TewhkZ9eQNONiRJokAasmTpVdgHQgWMHdL2I7isMxQ/iVU4dro+6u9TIaBPeoxUeMKDnUKm4nFLJDFcMLwtaYlJr+mO3Ol8RByPGmMJH6oYaaqjbW+pXPu9VkuGEuvyx9mP4JOYP830Q5GTHbYQ2Yzb+m4m10Lmm/LhSND6LMDd3zzRfIKhyqdPxwQXExxvS2/BppJBVEllQ9BypLVpPdniOr/e8VXmtw/ht7DAPkbpA== 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=lyppqitZSKdQlbSpU3ipsKCDy/XzTWZGuEg81T3C8U8=; b=rFFbLjwQPuVpKADz6EM3tZDiFXwUlUbhiBXq2kt7GNO+NojoxLokO0Vf9Q6atleyC6Ze5Gxc34bPxtIIpyCudbNbYxqEO3My0Anf2NOmGmdPOdr8TOSk5mR2Nias2lMTWGma5rlqmvyVJdY9xEr3WZot2aX784C4Gyn504s5K/A= Received: from DS7PR03CA0209.namprd03.prod.outlook.com (2603:10b6:5:3b6::34) by IA1PR12MB8553.namprd12.prod.outlook.com (2603:10b6:208:44e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:29 +0000 Received: from DS1PEPF0000E64F.namprd02.prod.outlook.com (2603:10b6:5:3b6:cafe::4f) by DS7PR03CA0209.outlook.office365.com (2603:10b6:5:3b6::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19: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 DS1PEPF0000E64F.mail.protection.outlook.com (10.167.18.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19: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; Tue, 3 Jan 2023 16:19:27 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 02/27] drm/amd: Add a legacy mapping to "amdgpu_ucode_ip_version_decode" Date: Tue, 3 Jan 2023 16:18:21 -0600 Message-ID: <20230103221852.22813-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E64F:EE_|IA1PR12MB8553:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f98dbbc-fd80-457a-73ca-08daedd894cf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RLNF3BQZg+e/k2f8djTrJheHCpvzdjCN9oU2tZ26JXPiudhPC84AYjaI2rDlUNwFWfUKDck/yzPCFKoUpwQtY8yj64l8tTg5PrEeBNgjN1K1MWP6gkjokMSEKyMwRjYWpkc30EQUiZSAnlApVqv+1BTcukIVd2H4vZWsdXCiWrbaD2BESo8Zq3Re0T/E6kWqoIUpeuV2ob15gJ+Jv3aJQJf+ZhvxM89ACy23DsXwY68JDAIBnNbBpVqWUCaHijZ6S9/1qD56r8/BtkQZ02+QejTK8XjlZlriJ+QPRFbk5PYU0yoRWuKDpVoV12jJbXPGJMJCzBQdx3kqUtIw+S2/20qTzFt9FyEprLNxyu4kqPAbcsmDFifX/v39bgZl6y1K7tKwi/GFMQwoVXkRev3fMZq0hMr4l6mXXZT1lQ5gy4sj748dXNTLnBM0S6R1ykevt/Zh7bmLFJF03En4HFanrw3SXV0ZLR3GVOstraK3j+nsK8y1BjeNsSUEOHpJRjsrQOj18Inx8v4ZEYvOKJTHZB5T4Ri+KfxOe9VCy4nn1pFOHsYSabvxwu/ujt/Wc7RQWffbYt0gZmiYQcfRzt+27V+jzK8hlybLN5IwG7EMvllZ264bamOWsdmdnOuwS1ZYof6CZWXAqfgRaciDI3wApAczBHTYWMqV9cH3B3YjwGdJ2Z9L/0VyMWF9Be35C/ob27d3u/6zhNqMN4RdtZAcdFewdrARKpNw52W0hCi1oNpqLO+P9p9c9fC/gkV7pd754Vk2GXYz+BDfvFoZUe1IRg== 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)(39860400002)(136003)(346002)(376002)(451199015)(40470700004)(36840700001)(46966006)(316002)(54906003)(110136005)(26005)(186003)(36860700001)(2616005)(6666004)(1076003)(70206006)(478600001)(16526019)(4326008)(426003)(41300700001)(5660300002)(44832011)(83380400001)(47076005)(8936002)(2906002)(336012)(70586007)(8676002)(82740400003)(40480700001)(356005)(81166007)(86362001)(7696005)(40460700003)(36756003)(82310400005)(22166009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:29.0907 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3f98dbbc-fd80-457a-73ca-08daedd894cf 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: DS1PEPF0000E64F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8553 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 --- v3->v4: * No changes v2->v3: * Fixes for GFX9 SDMA --- 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 Tue Jan 3 22:18:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088060 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 E252FC3DA7D for ; Tue, 3 Jan 2023 22:19:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E3E5D10E273; Tue, 3 Jan 2023 22:19:34 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2071.outbound.protection.outlook.com [40.107.93.71]) by gabe.freedesktop.org (Postfix) with ESMTPS id 66C0C10E234; Tue, 3 Jan 2023 22:19:32 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lspqocApMiiH5Tui1ieyPDHY7OxRsRtGb8r66molBNxcoiSsugwAGjo712fDgJ4UOfffuQbbUjTHwW/aAIwXSpTtlMNh+yvgYhuXgsJC/A+DHdgX+1il905ipfeGOr0ml2qn0rKKrJVeVL8+JPnJ2W3y5p37DmetUr7wk6uJkXa+0EUGvRyRstrKc/W49R+0MeWsvIHg9QIsCJTx2poUyXncuXKrS3+WuXVMNdkRNzTYe3YGZvIG/oaPR/6JkamAXg/xBbR+XF9W8gfp43796emDUS56xCm5ICi/iKIhVUt06KUeEuRiw1mSoDM5IOdIiHMhMAEFMSsK2K3CwZxVtA== 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=h4VCws/yUIWHH8mzjzJpCMfQ6g7vtLh4Nisn4/ZZO7E=; b=a3DgmzvS4d0rDlux0/TFTI4rGbZQtLcWvNWfNba0vVDlvTOrjKhYpPnE+q0xCNgb8axgVE892P4zPusLiuC9q+J3EB9BdtKBoVXOLDPI55yg5H1oopzwiAmirLSJZqW7i0fbYuR/q/D59edfjA40KaVkyJ0ns3hmXS9XAgQrkqzNXoxgj+YMjD/2PXK2x9b3ZsiKmG9HxszLerZlbYEwyNRUXk0vHwCTjqFvOu5xcqUrPDtLeQWZcJ76aK3GWLpyVlbyZ9YZdcoSDMmJ9snT2nC/MY2/aeVc6NC1EhvHoEbJpgAiM0swE7cSB6JXume+e4m70qPBw8SGVLkWUFumkA== 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=h4VCws/yUIWHH8mzjzJpCMfQ6g7vtLh4Nisn4/ZZO7E=; b=sk5KvTeHN/4E5kpQOHZiEt8oeKW+2mUe+LAKg1o0gBSfJXWGu8+D5JqgI5xQ5l0z5iwUJ3h6jpVjygklFHcVF/R5n7/efuU7KvxeFzADYcZpPcCa+dDjLEOTLCJJ/+LS3bN8sD441nK71tNpTwZ124gDHwHQtfcQlN6Q65i0iQA= Received: from DS7PR03CA0360.namprd03.prod.outlook.com (2603:10b6:8:55::33) by MW4PR12MB6683.namprd12.prod.outlook.com (2603:10b6:303:1e2::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:30 +0000 Received: from DS1PEPF0000E653.namprd02.prod.outlook.com (2603:10b6:8:55:cafe::96) by DS7PR03CA0360.outlook.office365.com (2603:10b6:8:55::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19: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 DS1PEPF0000E653.mail.protection.outlook.com (10.167.18.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19: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; Tue, 3 Jan 2023 16:19:29 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 03/27] drm/amd: Convert SMUv11 microcode to use `amdgpu_ucode_ip_version_decode` Date: Tue, 3 Jan 2023 16:18:22 -0600 Message-ID: <20230103221852.22813-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E653:EE_|MW4PR12MB6683:EE_ X-MS-Office365-Filtering-Correlation-Id: 47a08c0b-da36-4ca1-a4be-08daedd8957b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t0IgqVc6xa9VEwVMNYTR/PZZ8zbu9FYzM6eyzOfPVQMNlONOFpAxrgdyorNAhrDIqKaJ+D2Q4zQKySJAd2a+GAyQtycfyXHNkLJKTtIbpZTnTKbw4dtoDQht45QaMvL+PbIrZrfJpzfVQTOc0cG8Zbr4ustttEo2gTooMFdg+IIv2GsofIKgt8DOd9Tk5muO9F3rhCPAN6YxMKTXFb9YbgtJoprVlKKVla8UtKIsaRq1fBVpLL/B4uii36L/PjjQKAbn6aBuzYfAQbIxyoyNcNIjG6lfKNOn7H1HF3DEVbkn2RkO8SAmOtNL0ihb2RmBqUyjcWM9VMi+VbPzBZl00xBComf9uUeRN3vmCyH/kwu1c23b/fRzWp8yF9g1bzem22ymvwbWTuAsjKN9KSp630mA109qBzS+MCshHt1II/VhBxkrRWQ650WrOT+EbeENbrQFt8hX0AnpuQlfhT99SkNDSOibM0LQ9Rpv/N+6oRTm4La/Gr879O420g5Q9fzcZq35UczsyzKrLtPcD0anWRSUD64Wm4AAf7Ji2owOkTczzBqle7zSpOZNYs0SL66bugjF9tpdU/fgjhzTS0NVJ1BYzaP3JTITOKNFArNVxG4F+U6OH7UuHq32rloAeZf/myFbylQ69Fup8OhqS83sN1NLe2CtEj5ML2ZWWpnVZpMgY5BnrxPVnG/VoivA4saH1IljuiseNRxly30baxIfnPTCNEWnw2I9ECgqkLqwbjjoORWdlZddsxTo4FNRveK46UePH3Btl+BgEs17OEfCvdMmgpolAIWJfPLHduTGtIE= 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)(46966006)(40470700004)(36840700001)(426003)(47076005)(16526019)(66574015)(26005)(1076003)(186003)(2616005)(82740400003)(81166007)(336012)(356005)(86362001)(83380400001)(82310400005)(36756003)(36860700001)(44832011)(40480700001)(41300700001)(8936002)(70206006)(8676002)(4326008)(40460700003)(5660300002)(70586007)(316002)(6666004)(478600001)(54906003)(7696005)(2906002)(110136005)(22166009)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:30.2348 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 47a08c0b-da36-4ca1-a4be-08daedd8957b 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: DS1PEPF0000E653.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6683 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 --- v3->v4: * No changes --- .../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 Tue Jan 3 22:18:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088061 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 E18B6C3DA7D for ; Tue, 3 Jan 2023 22:19:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A65CD10E289; Tue, 3 Jan 2023 22:19:38 +0000 (UTC) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2045.outbound.protection.outlook.com [40.107.243.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id C92DE10E234; Tue, 3 Jan 2023 22:19:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Htb3eyLfKJI5M0XMx3H+zRdQ1vsoQidUcxcX7q2PGkBhwzSYNQhPQBI6+gOSrwOAbuqjEyGG9YZUbopeyumci4QdON4LixzB9tWjPalXZPkz7q4SKYVxXv3GzPbIoF70xIDiUP3eEx3EfTsH3n/Bj8u6YJVFegy5NIK3v1J6XyZTGhBZiu0MwI1je5us0YDYcYbh8dKtMcluRVs+VS+56bXhViN6t+PfyUERPruUT+gMhJEPFfwV6WmIYwCOKxLUBknM4VQBd6uUt+kirfrZk3dhpZTFA6OdbvqHlP2+ChuHrWvTA+m2zcLBlsoQt/DXDzMxBWM2TOAwa1zVHx/YmA== 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=ZnnDBP9zjHCRlVY+ohtQb+D2wN4dAle4IebnZiWUt5k=; b=hlMj7+m5ATp1ZkVr9D+gb0B955QgKMrzoo9J8PKuSs5q+eGMoh899UoxlwBG9tT6Ki9s/7hRV54NGyz0Sr7I5Loy1j6PnkBe+A8F9VCtyjfVc+FV2oeD3WQifNWAmx3hW3sJPywn59CTj5r5Eg82GZf2PC4nZRG75MwXS0+IZu3M674eVtf5YdvtdPogkfVBgZfFS3FwEbBWdlsngH4Z6rcI82lY2gZ6kO6gSzifwek4mNUuQscxo4bbm7VfQ1rn6xuX3TK8z740a3ErgHFZK+WuP/fw4fXMqg2XAW3MKRI4uZZT/q9hSAArcL2KudJX2kO3rGhqBEa1AiXsr0sLnA== 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=ZnnDBP9zjHCRlVY+ohtQb+D2wN4dAle4IebnZiWUt5k=; b=Fo/of6ZRaIjiNDO0wcx1/U1dvej6Ch/iYUGU8nFW9dC/2ycGlxmwiipG7jvCr+PV8Z6O5YmQQMG9sQ7brpGYRn8rHLLtAQf5xvwbNAzOi0rGNIwMGWGFDAvSnqvKFotVo+oWQ4u3duKVYV6BheTlHJVDdf6aMbQX0xiPLTdCMPc= Received: from DS7PR05CA0103.namprd05.prod.outlook.com (2603:10b6:8:56::18) by PH0PR12MB8174.namprd12.prod.outlook.com (2603:10b6:510:298::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:31 +0000 Received: from DS1PEPF0000E652.namprd02.prod.outlook.com (2603:10b6:8:56:cafe::a) by DS7PR05CA0103.outlook.office365.com (2603:10b6:8:56::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; Tue, 3 Jan 2023 22:19: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 DS1PEPF0000E652.mail.protection.outlook.com (10.167.18.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19: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; Tue, 3 Jan 2023 16:19:30 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 04/27] drm/amd: Convert SMUv13 microcode to use `amdgpu_ucode_ip_version_decode` Date: Tue, 3 Jan 2023 16:18:23 -0600 Message-ID: <20230103221852.22813-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E652:EE_|PH0PR12MB8174:EE_ X-MS-Office365-Filtering-Correlation-Id: 0bf1c313-0313-4f54-cd77-08daedd8962a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wYyUTMLuGJzftEtFqbq370tGAgh2BVfZIpvBSYmTSyqMfx0fafv/EV0l7aXNuj+ynt7zYI2WAdBOlBYDal35VYks+bgHXUzPfqsO9ZLDsGSYb81dZ5qMyuOpoXRdoHwMkfGdPNS/AP5LnBHquMhKwMt++asVsHmR9aCq61bJz8i91ZnF16TxI4p0PXL8TkTH46F8HkUiC8tH11GkiRluaf6Tfy5SXPLbNomDLKK7OhyFkILBituZsK9oh6y22eWGo59nA7U48C9/hKxIfYn7MVsWXTyjhy97PEjknkKJ8ITX51pkfqHxyFzyeqKOfwmMnNC1++tws7JqDMHhCWpWzOQ1qFiiWmlR0k4QjKYMVZ2K9T2ObwJISdpZkfvbGhGlcjPX9DQhp61+cOKms4hvnpnHoFCVMlibBJStflJ8QoxhH6Wp3sArgzqw1Khio1DxuyMPK5/wwHBVa+xowrQ1KDBrgKkY0wn9SIQ5j0ELPYZuCKXxKiKDSWITOnDhXoV4+iPKzIPrQJSCcBAu4dbqSq8tY8TyfuwH6q87xcHUCCFW8XcULvcPWNvWUZWbvcMSKwjzG7YH2uQqMUsnRx+qftMLQVbHtwDNhmvxey8YkQXeiOTZIQxG06A8lb0OqufJMy5NIq2feSzNP/gtd49iBeW1mZdrX0EZmCO6QM/5TeyaTEuuHakWXWT4V9grrvk9yAIY1QlwTsQbba1RdnsNSduxAM9d3FSANoVoCKBlU2fxaL6PNpxlqnM16WWxEWE1w5H7GxL7/XmTd7dk398nJZx8e6nQ+Vui57Ums9M6igc= 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)(39860400002)(396003)(451199015)(36840700001)(46966006)(40470700004)(83380400001)(47076005)(426003)(66574015)(1076003)(16526019)(336012)(26005)(82310400005)(7696005)(6666004)(40480700001)(40460700003)(86362001)(36860700001)(36756003)(81166007)(82740400003)(356005)(2616005)(186003)(478600001)(41300700001)(8676002)(4326008)(2906002)(5660300002)(8936002)(44832011)(316002)(70586007)(70206006)(110136005)(54906003)(22166009)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:31.3671 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0bf1c313-0313-4f54-cd77-08daedd8962a 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: DS1PEPF0000E652.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8174 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 --- v3->v4: * No changes --- 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 Tue Jan 3 22:18: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: 13088064 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 03F5BC5479D for ; Tue, 3 Jan 2023 22:20:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 03BA310E293; Tue, 3 Jan 2023 22:19:42 +0000 (UTC) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2068.outbound.protection.outlook.com [40.107.96.68]) by gabe.freedesktop.org (Postfix) with ESMTPS id D11BF10E234; Tue, 3 Jan 2023 22:19:34 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KY7bqZ6QqLixUMVhhMnAMnAXHO1EAnZJYFBqLKPyKV05LBLjZw78Y8AjBDOll810TgAZ6R8F+ZJ1OSB7lx7pHE+vdLd92BbqoVeOhpW+BTFklfzcjUrAMsQhK9kCK9Y47a66jtCi3EYSof5iER8SgOxvnxspQQNj6paTQ5VvDaGTsyNX5qeUpp7XIB4oW0JMmNN/tLyYOD2wJjj0/lLFowIwef2br4q5fX76kK0osaIUFDfq4asa/elynk3GB3SXVv10dqJ69vkXxvbZjeqguPmBCqAfRSBFblwMbt8pTsqHy7LrOkY53OK1dxyqorsA+HbbSWLF9TuuQo2NxWdNsg== 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=JbAsA0CchhtNCrvkwjTXiShRfvk/GpQWapts8CHXuNI=; b=F6dWqXdlTD9yxnCqR9K7+s8hAy2l33ylD+HOXEPDUEGW1UM7jPNiiq9NMb4KVTFV9akvm+TPmoI1+yIVFxrqIFudWHMjwFqg/nqxPr6kAaOpMtp22xbtSmGfDuh+MwN3fYxkLTRJoMpbeht6G+bQD38dDxsmftOMbfO4YRbHZht66Wi/5Q+4gshQ/bJVWw8C/EFHKnxHWX1Q5WZ/oZ6iZ2S8y97eRfdNS5iTveEEQ1OT/RzT80oOV9H/0qSqTyFgy9VI/V/TcdQkmQCXdh8U8FeKPn1DDqFBGeUeOIilPeFCdtfMmbRxAxnJbHUrPEz0sqeFzQ50XDw7TlFFPGZaew== 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=JbAsA0CchhtNCrvkwjTXiShRfvk/GpQWapts8CHXuNI=; b=3S5rdX/DB6fhguHlmylpI7Wf3c2y33hrVb0lLXNlhAYTJZHIr99/bzeBtSv7pYpTm/nvzyDPCdiMWKPs/80BKST2tPTk6X4yVgCO6CIsw5AQdGwWASixpq3RYUzQYD1tIbeE24m9NOEz0hhg54y+LeVCkvXZbZ2L10RH9H65jRY= Received: from DM6PR10CA0011.namprd10.prod.outlook.com (2603:10b6:5:60::24) by CH0PR12MB5154.namprd12.prod.outlook.com (2603:10b6:610:b9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:32 +0000 Received: from DS1PEPF0000E654.namprd02.prod.outlook.com (2603:10b6:5:60:cafe::ea) by DM6PR10CA0011.outlook.office365.com (2603:10b6:5:60::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; Tue, 3 Jan 2023 22:19: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 DS1PEPF0000E654.mail.protection.outlook.com (10.167.18.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19: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; Tue, 3 Jan 2023 16:19:31 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 05/27] drm/amd: Add a new helper for loading/validating microcode Date: Tue, 3 Jan 2023 16:18:24 -0600 Message-ID: <20230103221852.22813-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E654:EE_|CH0PR12MB5154:EE_ X-MS-Office365-Filtering-Correlation-Id: 302d0669-037c-4e01-b0a7-08daedd896dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pqLLh9DULg2U2NrEBqjuUhhfxQ9fJKhybE+ux8GXc0p4y/Ysqo/GGsTM8G0+JR7GaMVAlNHWGxuoOopIafo+HvQ/2F70wMqAvyZ2/X+9CMzm+EoEUs6g4bCwJLCAtqggB0EgupjxwP2WZ5qdOVAKLj8zDrcpSQYsaKI0roI5x6XOhf3IEzjjHnwYYgIdTXlGnW7DzvgiSvqzFcUc56l5jP5p5YzF7A8sQC1dRgOeWTuqRi8Lr/wlY3hDeCJ5JKg8YKekooW8k2dRkXgUMvll+/MlonoHKiE2H34vMaNJGtNuzqMZGOfBs0RErgBgRFd5Wx6YocaJSSknTCQpkvz2Yuy4OYCk3HZRMPJqyJofO7cofnQqL6Hx7WIGAOVBbYnIddZsBN1ik2Kui1Qv0ixR3t5Yqa3tbg0GXFmz4To5XOkONlP2bmCfpGJgjlMFMWUWMuRKTmSyQwwYuM97Wc7HkaQu/Q4/BzatrDyJBsBSWPrxPFgKzxdQOy6svYgGscqomJY/yyO4v5khgOf/JwSCTO9fKLSAeWdvMdgiVQOb9thHdtqhSoGoN+TJc78IiNBpxd9gFcGTW8ipGE5NpJnxOY2P+5skQ2BQ8Cxi34MmCUvVP7q+vUBA4RGVjQ3a8+4cBaAKJnD2EG8o2s2oPa1aNq5RXB8iLtj3o4ejN8l4p+I2hUrFXiWcg5qt5wkLScqm7eZwwjokqnv49OeKFjSyhcESS9TYO4issxwIepRV5qRuINq+QMWipA90jpbOjaOU 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)(346002)(376002)(396003)(451199015)(46966006)(36840700001)(40470700004)(2616005)(70586007)(8676002)(40460700003)(4326008)(81166007)(336012)(70206006)(36756003)(426003)(41300700001)(47076005)(1076003)(54906003)(316002)(82310400005)(86362001)(2906002)(356005)(36860700001)(5660300002)(82740400003)(110136005)(8936002)(40480700001)(83380400001)(478600001)(7696005)(44832011)(6666004)(16526019)(186003)(26005)(22166009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:32.5329 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 302d0669-037c-4e01-b0a7-08daedd896dc 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: DS1PEPF0000E654.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5154 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 --- v3-v4: * New patch --- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 24 +++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 1 + 2 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c index eafcddce58d3..8c4a7b09e344 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c @@ -1312,3 +1312,27 @@ 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_load - Load 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_load(struct amdgpu_device *adev, const struct firmware **fw, 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; +} diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h index 552e06929229..b9139fb44506 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h @@ -544,6 +544,7 @@ 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_load(struct amdgpu_device *adev, const struct firmware **fw, char *fw_name); bool amdgpu_ucode_hdr_version(union amdgpu_firmware_header *hdr, uint16_t hdr_major, uint16_t hdr_minor); From patchwork Tue Jan 3 22:18: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: 13088063 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 0CCAAC54EBD for ; Tue, 3 Jan 2023 22:20:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8809210E286; Tue, 3 Jan 2023 22:19:42 +0000 (UTC) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2055.outbound.protection.outlook.com [40.107.243.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id DFE2E10E286; Tue, 3 Jan 2023 22:19:36 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HL9033OEQCezVGiSZCk1vgNwYgg+dLWhBNzSobMrXOmDx/7+cwvvsMJq93SMJYGfelmih/xpxn3UbhrWr3KTujW1YutyOZkkyKy4eRgEjjaaWB3NdxudjfbJjCdRDSrhOoEBQT+PEEYGLSSqC7IEYzUv7hIHSSqeoUoBCd1iwPadr96fb+buGUFY4w70VkpYDrWK3nnPUHyKERbs3h2H+blcOzlZH3/GXaA+oViHDrmbR+hP/9VN7DqtncAns5/s3BC6Unk0O5g34ZX+B8RlVY+2aLeVZctfnaHu6XbacBcXTkxPjZ8uCLeRnJH/5uBXcXfcdpqYSaSMREUDMRTzbQ== 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=ZBjNzqzJ4+6OaHWUAPYPzFQKqCQL8JmErERNpPPbCkI=; b=CVY7kF+6DgTqjnBvGMjDfaX3e5K2ezp67ag2CCyVTrMMoALgQ9CC0EiMYRsh5hdXvG0xgjEKqvxC7Wgd2onEvCvOQ5jFgabPnL52B99SV5zsax3aGzKla/oKrBxRSMYzn/RY/T34lHV3HmFV3T8JZO3vfyiKKh/JDe/Q6b8J84AbMIobZZA5oyT79wQ85tBum3VQ9OFqH5AKurEDpA1k2A8SL/3h0JichByB/g1cM46xwIeSrVynCI7jy6fHmK3Wwg/4X0z0PMOWiKVm2c6rs3sO9DtYV73Xa0ZiMMVRsUorLvdMJFCjsorWnrTC8pF16jdX5cOc/PFlguLSWxWaEg== 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=ZBjNzqzJ4+6OaHWUAPYPzFQKqCQL8JmErERNpPPbCkI=; b=r0Q7mm1kQjGslLXHtFdwMpysRs8iuvSz18QqRqonXn/HBGVZEbVsDdPFtzRoKt5OENR8CImr+YTp07937JVx1a5554ZlGinPgjvDSECQN/I5rCSR9ID8ycm60uMdg+I2+v5sz9wV0ybYv81wtbQNJ6VNFG6Do89P6ErPW037NYc= Received: from DS7PR05CA0052.namprd05.prod.outlook.com (2603:10b6:8:2f::30) by BL1PR12MB5995.namprd12.prod.outlook.com (2603:10b6:208:39b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:33 +0000 Received: from DS1PEPF0000E651.namprd02.prod.outlook.com (2603:10b6:8:2f:cafe::93) by DS7PR05CA0052.outlook.office365.com (2603:10b6:8:2f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.13 via Frontend Transport; Tue, 3 Jan 2023 22:19: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 DS1PEPF0000E651.mail.protection.outlook.com (10.167.18.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19: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; Tue, 3 Jan 2023 16:19:32 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 06/27] drm/amd: Use `amdgpu_ucode_load` helper for SDMA Date: Tue, 3 Jan 2023 16:18:25 -0600 Message-ID: <20230103221852.22813-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E651:EE_|BL1PR12MB5995:EE_ X-MS-Office365-Filtering-Correlation-Id: 0fccc95e-aaca-4063-d75d-08daedd89781 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KH/Eot58qtq128j30AVqZ2OeYHmHs/kRfmRAmxbHU/6fl96anPXxJB3QG4JP32xqiABEwwmgZ9LHAy/Jjks15crrgQQkU+oY/E3AjYz5X4tYCQVTCaJ6WX0ZbSpye43naOsxxgeDJr6HDY1whK6luy/3lHKq9XLp0adkZoYZF8+Irko8EyraNikZvPG3oy/19iqkaubNJsu1m4L6TkrKRAkhwrkFAVXxkDaSraOg020Js9GDuxJHi9KiPSFu10D19Fx6Drlsm8vdzIPq9xCLsdUJ9DJyLYsWWCiPwRGSV+jp0fQtb8yprsiTYz4EFi04hKERNmrq5afc7TfBioQoI563jwGx+ZOLQtUwLTqiGB6wHwlXVaBjgaA/AuHolF1bGkq4rcQ5vkxNXPCIDIvDBBInUatjYngxNJXoFUYbBCtrS6FXww4jb77DQHUxtZTKu9/YSIqobegPHM1XEMZ9t9rLtrFjKslRsUOlWH1s8W24siK6eagXoRIc4M/hDJ5c0uvg+yiQR3+IGwRtQPoClSHFrA/7I4yXtehDiCVauMGyGSWQ6nRleye3Rr5Cdg0T6BBzWuzuf8BQiwkjCIxtNrcrT4V3iN/1GrSaVkcXiKAElJuYGZug6Les+pkLd7vXrNHuQGGgMCRNVst6NBP4uPorqWzNRGRtZFTp/KBvhSn7JOTcYwuSHloJT8hK7UqBzx+xCJOdhE5DiOFa6fhAeAdG25QaT/demcap7/81YdBnJiNaHTMwvIU2OB5FIJ1FrkpHfcV+Ve/BlmVLAEczBsLNM0xAWs/69MdtRewXNx0= 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)(396003)(346002)(39860400002)(451199015)(36840700001)(46966006)(40470700004)(16526019)(6666004)(54906003)(316002)(186003)(26005)(7696005)(81166007)(110136005)(4326008)(2616005)(70206006)(336012)(70586007)(1076003)(8676002)(478600001)(8936002)(41300700001)(5660300002)(83380400001)(44832011)(356005)(47076005)(426003)(2906002)(36860700001)(82740400003)(36756003)(40460700003)(86362001)(82310400005)(40480700001)(22166009)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:33.6152 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0fccc95e-aaca-4063-d75d-08daedd89781 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: DS1PEPF0000E651.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5995 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_load` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. Signed-off-by: Mario Limonciello --- v3->v4: * New patch --- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c index ea5278f094c0..9e85a078d918 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); @@ -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_load(adev, &adev->sdma.instance[instance].fw, fw_name); if (err) goto out; From patchwork Tue Jan 3 22:18: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: 13088065 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 49841C3DA7D for ; Tue, 3 Jan 2023 22:20:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EF53810E292; Tue, 3 Jan 2023 22:19:42 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2060.outbound.protection.outlook.com [40.107.237.60]) by gabe.freedesktop.org (Postfix) with ESMTPS id C977310E286; Tue, 3 Jan 2023 22:19:37 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VITETUPKjOy0jav4xlWWzn9USqxJUeL/eZD/L4YH3AL9rfUx8H6QDkR3e/RjjBE/EdbxSWDGNele4FLkuLjjoXbcUhGh3tRgK9/GLSdGBTM8z+iMWE5qBnJ9x+P+Fu4A/WXP30W4dnspnoa3fRj3LLv0vEYrv1Zi2mJLlvHPs/PgdFTTbYy2Fbj1cKIXUfO53hnYLlp27vonPO5JVprYYffHdiaOIRA4tl2PPt6JfxiEmrPb/Hp17yHzhEvRz/I7DqluR0rYHoA/30exUeF6Tu4cuYRxquOf6MuH4V3dsjpyVfS/B0WBF7TjSNGxWYnMklCPbcfrxidVFRyTSPk+dg== 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=wP2TAWcl3pRBieBor6uKgkVS+3cxnhkBqPNVymLzYzE=; b=juSmxNGBgIMyOh3zHxeMgD1YLqUYj6yKuEa/J1/uUH6WWrry1LfxOc7NsJ3c/JEoKMAwJUMoe0Xhc46NRz0yp2ZXuwNDh52/6QDO6XR5LTUeBKwRIVnpd0HReVIaTxAkjylvGfDgSCKKlFZb/SPBLy2bpBn7zTNbuQGGLry1w1p6uLUiM62fYQ243NwUmhoBI6jOiF3+LRmAgDQFlGrEU6k0a/QdhaKkr/U8afn0BxmW5B03Lo1dILx2z3BXHS5aUVownZwuYRdGvjcb1pMfPib6ZGHWFHJFJbwFBPhYZITkPm33Nw/2y6JwEywdP5aAQNlaHk9elSsNvwoTd6tZKg== 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=wP2TAWcl3pRBieBor6uKgkVS+3cxnhkBqPNVymLzYzE=; b=xYWEtz0t1KHVcEdYqNovxJH7cloSL/IGy5aP1isMOxrpqQ6IQagUnm+V3c4lfpzm20Uduz3eQ9M7FLp42LsRhh3MRoAg/rRugrzW0TtaPB6qHgUY2r0Q421giooMHvTxDvspRe0iijOyB60t380rM6vyJ1rU7ckR+3WOlfgKq2U= Received: from DS7PR03CA0342.namprd03.prod.outlook.com (2603:10b6:8:55::14) by DM6PR12MB4201.namprd12.prod.outlook.com (2603:10b6:5:216::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:35 +0000 Received: from DS1PEPF0000E653.namprd02.prod.outlook.com (2603:10b6:8:55:cafe::d4) by DS7PR03CA0342.outlook.office365.com (2603:10b6:8:55::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19:35 +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 DS1PEPF0000E653.mail.protection.outlook.com (10.167.18.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19:35 +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; Tue, 3 Jan 2023 16:19:34 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 07/27] drm/amd: Convert SDMA to use `amdgpu_ucode_ip_version_decode` Date: Tue, 3 Jan 2023 16:18:26 -0600 Message-ID: <20230103221852.22813-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E653:EE_|DM6PR12MB4201:EE_ X-MS-Office365-Filtering-Correlation-Id: bb12668a-eef6-4129-a8f3-08daedd89889 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hDrBlIGhgjRVhbwyGkOjragnBf0Nwzu/9CieCUW7Th8Qr8s/EbqT+VBWQnm1UpUPxTRQHAvhZYa1SiCEJaED+K9ysdFBEJjj4oniJfToO7aMyOdQ8fNrFVWHOredevjNG8T/lIwzbi1PdfKLaK+8SKirAKQu/HyipvHLM1Ds+XpOzI2yFunWSOXIbcnwSKq/lH1qxAwZ8V5jess4vGXqhzQNdIAfE+H0VtD7f5lyMVbslnPgyL18lS1Rt5CVPwxRJKT3aCiVQ8AwBfl7PgbWb1WxunZ66fkfgbPGxMAjGuOjgueqjAbLWTe6Q0eevzlYxK1koz3vDwemkfsrzrwMf0+gPPjA8RFXpnq5rA1MQ+PWy8tNfFFq2RhFp/oPgl5j427H99cYNM3Mt7IkroqQ35oxwSg6Ri+zFE4lSq7niAgTOOBTODcybU2ucL26DUZIQqAROJps0x/xgHp80X+XjqeGa2fbNwZWouc7G56tlft2VeDYBHjMM1hQU/09z0+rMgb4SOG5rDXVYQfb8KkBd75QmHt3+d5E0emgBPLiiv/C5LrMad5w6q1DpYXQp4/4loyeJZB8Mu86PiDhucVS+5iNkG9AXCZimR+L4FUrVoEUJMFLTMnxHxRcgFHO3dUadUj+hdszXaPbpH51eC3fuzRwLQt83YhNyAUhn511w0LmKRDIa8B2se7rMy7w1LuZeoQukxuL3vP1weFwJ+p5lLiGnImGA9IRIb+TcZczAbXnFlkYcKCCTZKNu6bfI+g/lZX9UH/E2Q+76xEWMdzUgseiEEByc1tX/PH7luTNDEc= 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)(46966006)(36840700001)(356005)(316002)(44832011)(1076003)(2616005)(7696005)(40480700001)(478600001)(16526019)(186003)(26005)(426003)(6666004)(36756003)(47076005)(40460700003)(54906003)(2906002)(110136005)(336012)(83380400001)(82740400003)(41300700001)(82310400005)(4326008)(70586007)(70206006)(81166007)(8676002)(5660300002)(86362001)(36860700001)(8936002)(22166009)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:35.3442 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bb12668a-eef6-4129-a8f3-08daedd89889 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: DS1PEPF0000E653.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4201 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 --- v3->v4: * Move out of IP discovery and instead simplify early_init v2->v3: * Fix dGPU naming scheme --- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 7 ++- 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, 13 insertions(+), 155 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c index 9e85a078d918..83e8f0dae647 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c @@ -200,15 +200,18 @@ 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)); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s%s.bin", ucode_prefix, !instance ? "" : "1"); err = amdgpu_ucode_load(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 Tue Jan 3 22:18: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: 13088066 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 D7147C54EBC for ; Tue, 3 Jan 2023 22:20:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3EC0C10E3ED; Tue, 3 Jan 2023 22:19:45 +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 12C7B10E28B; Tue, 3 Jan 2023 22:19:39 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c2Wea4CkgkXLICtwj7uDrFpBl0QzyNcr+7wSlpPPO/0FcTwRMTlIdSA7hwctdJEuZ6LoeCuDZxZRt3VfogywkLYUS3uF2gaFqWIYm11UU3XmqOzHRzJv4x8D7ipwQQ/TinyYgfY18QwuREnXRpElmeA1wwSnIdRJuOiLr26hsWFFLRJQX75KdVnHKcKhDymzCUoa+2h6we4Pcj28rpZVuWqGnaZ6l4Jkx6tYlWdQXFGFmitv0MRQeqtWetZpj+XXsVoZBmoVxAgzaM20hvyrbsCDJGh2qvMp8TlEk7ppihDLXDV6dhoNHxegPYXnE7gWiO+aBl+ehVFn5erSC/iSKg== 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=DuXZdMeRqoak+9plFioVjIaL8ECr/SlKwMHHMVCDnjA=; b=PN4VFIQztL+ZrDEEjwKf4Rm6D9Zv0ho6KpUWggsBkz/tVswJk8eYfYT/jTB6p6SwD/tt8uDywKwpkbrICu0tHQ6tBH61ZyCT+IqQ5vpNLc4N03cn0gSTueXzW3670GYhAdRd9m8tA2ozkV2+jDtREX8wQI0jeGMmrTAAxbSqfgjuyI1OEnQ4xbcivt2J7hEhUufL+xmvd6rvSu/nQJFRXlziWzULHzKU/G6vvAzZ9X6tpSV9hrJwOakJhKhL66yBP1bEOG7NQo0tVtQH/BQTqzhvhpqDLSDIoSC34TnDOdpkFCMx9jOCpLjcXEq3BParzyR21XxIPXQ3Z5lXA04WTw== 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=DuXZdMeRqoak+9plFioVjIaL8ECr/SlKwMHHMVCDnjA=; b=mZL8cPI1lmzIjWkQD91yQkWxDTfRxEbHr11jth1L0X6BfaYTNjELCse9zExFerbukU/YYvS5IFDCIcTmUO4SY7/VlTTQExf1ws5LjNVF7tKbY0BxR0lzspTZYubX9xUbu1zTllaXeF2Rm8EZ9wYKjasLjdvOkCsLAWXoTDUeFBk= Received: from DS7PR05CA0048.namprd05.prod.outlook.com (2603:10b6:8:2f::19) by DS7PR12MB5766.namprd12.prod.outlook.com (2603:10b6:8:75::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:36 +0000 Received: from DS1PEPF0000E651.namprd02.prod.outlook.com (2603:10b6:8:2f:cafe::9e) by DS7PR05CA0048.outlook.office365.com (2603:10b6:8:2f::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; Tue, 3 Jan 2023 22:19: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 DS1PEPF0000E651.mail.protection.outlook.com (10.167.18.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19: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; Tue, 3 Jan 2023 16:19:35 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 08/27] drm/amd: Make SDMA firmware load failures less noisy. Date: Tue, 3 Jan 2023 16:18:27 -0600 Message-ID: <20230103221852.22813-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E651:EE_|DS7PR12MB5766:EE_ X-MS-Office365-Filtering-Correlation-Id: 780e58b4-cbbf-4bad-5f53-08daedd89931 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fr4XtAUgzXT0NdAVSha8jexVaxn+YGzX4/G1A8RqjIZnu4CaOjAbUxqCdK0M1wnn7vrt7y7RwlmSQIqN3jaZC0Y9rtzWWeFkzzeJK42ht+mU9vAkmEpVD2gi+Ymj6pubgq7VIwOU6pfPVfgmU5IvT86AJWtbVqBD6He71PhNW+e54fVqy2JqiJvrR+M6HHZKt5GCGUWyl3mbycoeBGNoAk4Y2SAfYrD31NL0MvTZB0NNflkkRXz03g8rUJwPOKyYaCOGE4RKI8GCVTvvx0Mx1wUZG38am/3HzfHlTrLBckkypD8QI39RIhdMge3nSMOs6VTM/0e1Saolipmj4xKNeHPYQsEjTYhnCSaX57LE5hZYrxXbRX40IyEoVxvoV1ag9+Dmr5v0qqW1PmqLZfog+mZG3QR3nicj0PRYzpCciLv9zAb8AiyLQGGK6IVXSyN+WajjkBRi4lAcwAiTDUBOVuLLCfWSE0h1M5U+vt0sSzphF6Dm+YMBTZPZGqMTNRvLtbSkT3wsrN7Sw7UX1dNHmNdh2dHPv45VxGreeM04fjiEYag/ughb+7xd/vJHbcnfRu5sUVi/jYIVYlXPB7gIoephhAScS405xLQuzpuZYyY8s4QvKOSNp/zA2C8YGpptKvqXRLDUeKuw+mH9YbOOIKI26Ksv8pRH/BtKdwB1Q11cTRCTBgnRCYxNenFrfbcWaWTQmPzcV8EYuUbIcASJSB2enFS5iUJoZ6wpZAP8XD8KIvEhQAycGXV2nSK+8Q6WskrfedX93HeMDv5UE7LyJQ== 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)(396003)(346002)(451199015)(46966006)(40470700004)(36840700001)(36756003)(6666004)(478600001)(110136005)(36860700001)(82310400005)(40460700003)(86362001)(82740400003)(40480700001)(81166007)(356005)(47076005)(426003)(1076003)(26005)(186003)(16526019)(2616005)(7696005)(83380400001)(336012)(8936002)(70586007)(5660300002)(44832011)(70206006)(4326008)(8676002)(41300700001)(2906002)(316002)(54906003)(22166009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:36.4277 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 780e58b4-cbbf-4bad-5f53-08daedd89931 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: DS1PEPF0000E651.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5766 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 --- v3->v4: * New patch --- 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 83e8f0dae647..f052173ef1e7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c @@ -277,10 +277,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 Tue Jan 3 22:18: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: 13088068 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 E52C0C5479D for ; Tue, 3 Jan 2023 22:20:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E68E510E413; Tue, 3 Jan 2023 22:19:50 +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 33BA210E294; Tue, 3 Jan 2023 22:19:42 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i5pAruiDQHYPHsgskFV/qGO/07TcefvRu5d+jxklqqOF0BQDp2ZkzGydpzDsNYhX0RCbY3Riy2fKK+sNB5dF+kNwE/qItV9MNt3XwSfj6vRIypV2iEzlFMb1TRIr9mZPvO6ycVE4nvYDZXGUXaDVFQJV23JCOxepjwGHwibdxe2CGF+M0e9SQYn/zkKofEyH0iR8af7nxWIFtVOuJwkwc0fecYA1HvrXrd7OmWQGFF6WOLIVO0hteclyWGLrP8cdyFpLh7FZo8mrMdVPb0N/EPQEAQRM1J4VGzIK+d587QTCoIbg4BiU4tARdzm+cWoIYr6/pwfDjNoxMxy32W5kLA== 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=C3iM4OX/xreJdWdWJyM2q7jCgRWyPyNl4K0ErfJ5VN8=; b=EE+GLRaljr77Zv96ts2KKNfs55WzMZR6tXvdfmbCvuF1OBcmy5OHxs+5YMKM1/KjLQTfigdzIkHD7sPBdUinBWSswkC9YMVQ6jh4KuwqW9Qa1Qw0hntgX7pKA+Gghn54SkQukSLytt3+f9YOd13pNu0n0VJc66yT+K7poXTIJrzX/54oNelHTPmfw/3JEVlcCPv5NuU09ky8BdVvoLUhMWlCC+3G8inLYqGkS/f4cO2EK7eHTssiKKjUsmQ0Tj0YKJau7qidwRAFtKEBEorL1s+19vjp4IE2uAL/u7atqIHzmDHOy86kHbKl96JYLPNG4cvzEwZHyNQyxNahpvwlew== 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=C3iM4OX/xreJdWdWJyM2q7jCgRWyPyNl4K0ErfJ5VN8=; b=z1qw4ufJVZ/hsMebG4QHsBxzZ+3iARjyiBSf0sP0EbtA7m7i5CwEDAISObx28+t36+uk8kTZ+zu6YKmBafDoHixUfgemYpLq2x/wwgMfR3VJxVSztOFLm7azxfY6/mmiUzfpC608ltTGsSTX6N6+Qq01aup1CUnf7+/K0SLQ2g4= Received: from DS7PR03CA0133.namprd03.prod.outlook.com (2603:10b6:5:3b4::18) by CH3PR12MB7546.namprd12.prod.outlook.com (2603:10b6:610:149::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:37 +0000 Received: from DS1PEPF0000E655.namprd02.prod.outlook.com (2603:10b6:5:3b4:cafe::3) by DS7PR03CA0133.outlook.office365.com (2603:10b6:5:3b4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19: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 DS1PEPF0000E655.mail.protection.outlook.com (10.167.18.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19: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; Tue, 3 Jan 2023 16:19:36 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 09/27] drm/amd: Use `amdgpu_ucode_load` helper for VCN Date: Tue, 3 Jan 2023 16:18:28 -0600 Message-ID: <20230103221852.22813-10-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E655:EE_|CH3PR12MB7546:EE_ X-MS-Office365-Filtering-Correlation-Id: e707cb23-3aae-442b-77c8-08daedd899c8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YlNPRJFYakZSiZWih5/5A7UNpJj+5nTgX3zwu58IwSShX72TgYgMS/i13O0uW2XGlN70LlJshCWgmsum+YtUOw+vsBEeLZVztBbLePygxYI+ZIONHh7ASkE5y7h8HLPqjWMFljexihqpLCUuF3uOPJNP8Zsa+TW+cGW11GwXf6O6M2GJj6hWZ9hHb+TEaIuVO1oXl4kGBIoElSpDyJHwYa6MabFYi8bZMGSZB4jBYHg2m6ghV4wpiGLex99QunVBLX5q4VQbJc5YN8adT7QX5HnquhQG1Gf3mPXrUy3q/CebNqZZmriTXvQn2eu3CGRseCeMJKe1DMIRdsuFIZxSojGwczAesZMd8Dibu8SIn5QIdFilLmtcwTuyOnnBofrybgaCVfVXKuLKgvV8WpXbTpSNlRCgHCZRiNYvABx6Eb2D6cu5KLp0RWt726y+Qi1AiBbG+6GZH/8Hrtqe1qaf40iMIGtYhR07DuWDcU1PdoSYNvazkVM7d6jXnSrr9UDUA8PYwvhlMYwr/KwQhoMqkl/2IQImG6j1uM5NkHrR2DzlbjRqP6adiho9/DDr6sUQpeS/2QHeZkzQ5Ei3GicXmBqG1E9PBEO2aAmfY0v0M/M4N8rLW8rfVEEXlOWUoHmdVK/4zJqeC3kMMBR1HVUGn3KqLBOVJobP8G5jj8XkaNnPBPvHMUzDYqk3dwWvFXufNjWXhmC7d2GoeEz90Ics3xmrCFrQbTZDSEVOuR4xCI8ijIDf8CF/e+uhJaAG8a70EzROEGNwD7PyQBxSLlGBdqieyMa/U8MCODWQTTYL8PI= 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)(40470700004)(36840700001)(426003)(47076005)(83380400001)(16526019)(186003)(26005)(336012)(6666004)(7696005)(40480700001)(82310400005)(86362001)(40460700003)(36860700001)(36756003)(356005)(81166007)(82740400003)(1076003)(2616005)(8676002)(41300700001)(4326008)(8936002)(2906002)(5660300002)(44832011)(478600001)(70586007)(70206006)(316002)(54906003)(110136005)(22166009)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:37.4335 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e707cb23-3aae-442b-77c8-08daedd899c8 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: DS1PEPF0000E655.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7546 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_load` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. Signed-off-by: Mario Limonciello --- v3->v4: * New patch --- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index a23e26b272b4..6d9cb7fb67cf 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c @@ -206,19 +206,10 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev) return -EINVAL; } - r = request_firmware(&adev->vcn.fw, fw_name, adev->dev); + r = amdgpu_ucode_load(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; + if (adev->vcn.fw) + release_firmware(adev->vcn.fw); return r; } From patchwork Tue Jan 3 22:18: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: 13088067 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 B44A8C54EBE for ; Tue, 3 Jan 2023 22:20:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8CFD810E40D; Tue, 3 Jan 2023 22:19:49 +0000 (UTC) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2087.outbound.protection.outlook.com [40.107.243.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7A96010E28D; Tue, 3 Jan 2023 22:19:41 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZBkmlls2g+YptU7Jlac4OW1/Mt9SCgftSgUGax0BG8fblOYcvMirYW8g8FCFyLT26i0ip+LWLSSdp1cf3B74A1SMLyNvsJJu+4mzup6w/Nqc0ptZWcgyW7d7rnmORwSIRoYlFz+zPPbBgWaFu/Tt2xb4zo/qbvyeeZ9u27W4juvYn5eOsgf0Lp1bag/e+nt1KSAQxuMS+dR415TUEDhoa/233Gax9QCACbW/LBo/jmHZCENE6FrapvF9Ou4r3Pq5OQzsSxrxVbHr4q5wrbgFGMYMIJ7G5s325vXIqP1MHwC7br0D7Wc59DARnEcXI2S/7MU2RfU0HPKqaM+5Kp7IdA== 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=HXdxrkzDm/U7sf0oYuG779TY7C3q8TAeIL6Z3qzTWto=; b=Hx6GO+NJb/rbY8HI2rOr9WF7Cj4oSqftJcuPPLm2110oodwgCxEtV9EEIbPZ5h/ZmYuD+xWPstdQpeciNJKy7vNQqitpHpks1kuw6Dm+x/6v8OwuIQ9QGiEoUaFc82GUU+phYGgkJFs9cwNOmzLbi1Ha6DKbrr4ilvDfS0bl4gklljG+sBX+0gRRPbOxvWKgQYEs+ujvg3KdRYmp4QViM/ELd3vf9FlZa1fv5UqjuKVPPfdprhzFei+EMW2hgM5tr5n1762THs5ULKQO04/DxJtiC3JcocFys2Z0Cb3AgKWmSNWlos2bTK/8ySBAraVH8K9kgIprTXR/kdcNtu4nkw== 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=HXdxrkzDm/U7sf0oYuG779TY7C3q8TAeIL6Z3qzTWto=; b=DL0mby+TaCHYctlW39SgXXIsxDbl3eHPA/i/TcyusMZVvubZcnxGgDnkYYT2f0rjqeur4M5lyjUoa4NoLEIpm5XN/ZSHAWkQxALX/xN84ck87qK4EL5B+fmP+lXjzIiHWTvB9kwYMKWmb2Y/QyxwnWD7qxlBlniR0PXZwPs6KYw= Received: from DS7PR05CA0097.namprd05.prod.outlook.com (2603:10b6:8:56::26) by SA0PR12MB4525.namprd12.prod.outlook.com (2603:10b6:806:92::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:39 +0000 Received: from DS1PEPF0000E652.namprd02.prod.outlook.com (2603:10b6:8:56:cafe::fe) by DS7PR05CA0097.outlook.office365.com (2603:10b6:8:56::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; Tue, 3 Jan 2023 22:19: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 DS1PEPF0000E652.mail.protection.outlook.com (10.167.18.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19: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; Tue, 3 Jan 2023 16:19:38 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 10/27] drm/amd: Load VCN microcode during early_init Date: Tue, 3 Jan 2023 16:18:29 -0600 Message-ID: <20230103221852.22813-11-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E652:EE_|SA0PR12MB4525:EE_ X-MS-Office365-Filtering-Correlation-Id: 48fc5fb1-300e-430e-0add-08daedd89ada X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C4I/CkmcTtN0QHUPMWGFDHs6hbZtIkry2KwNvNAQB5rKI5RqdWremoxmpu7KKH53+tTulL/QCfTMtV4E28MeBEIjSmaAZEQokUD/X052Fs6MOOl18k/6vFyMKAP15AK7rZOOf4Hb530whelYxDhPWhKrgQRFOee9d8E2OtImJLDjA85e1JV3ShhZr0GfbB4yC+sTz3u5lCXncX1+E5mH9sRvxJWTga5FIdIReIHPWPPp1sbIffrvhuSXJL/EVvItVFrmx+zacvwt33NTCU/dUYr9U2y7oYXsbhjmCFxcj5GgsR1YyFRMBa3S5gbZnP2R+6bZEJTC+IAnId/IsD0FATagqtNmMdYpu7JrNkz6EvBGz1/TOyIl1HcFzjb0o96McU9Q1NLUDdMnKZ0VLjnifDYVsQTf8XFm75lll8R1SohIogudKPlUoms7tek4uC7z8I8q68H9YqH9mVTcggG24ZfTWLQrLlVKhYnxHoL7CrMsd7QlH3tqznKFxv1QqCTFP6cBM1uQCHTTkNhi3/dRy3xS7UQ1U8KfJD2mjaPG7KokQr+V2UhXn4gEerISY6+jRMTPcQvuoi+3kABm4IY2soVS2v1VwDqJ/xrXdy9P5ICcxdSqijaZokeHjwv8UIt2Wahyq9JuWwi/MX39S6ikaiO91PJEq1eQBb1HHyitcW44G1Da7u7jEo2yXtB7dfjrGbS1Fwm1RyXNlhihPc8X3nbAqsdXrHuPYi4NWdc90LNsLnFffm73r5dmmVig1fVoEHY0ZUvZJ9oKHFIR2zwNxQ== 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)(346002)(376002)(39860400002)(451199015)(40470700004)(36840700001)(46966006)(2906002)(2616005)(54906003)(336012)(316002)(4326008)(36860700001)(70206006)(41300700001)(8676002)(70586007)(26005)(83380400001)(6666004)(186003)(5660300002)(47076005)(426003)(16526019)(8936002)(7696005)(44832011)(30864003)(110136005)(40480700001)(478600001)(82740400003)(356005)(86362001)(1076003)(81166007)(40460700003)(82310400005)(36756003)(22166009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:39.2264 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 48fc5fb1-300e-430e-0add-08daedd89ada 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: DS1PEPF0000E652.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4525 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 --- v3->v4: * Move out of IP discovery and introduce early_init phase for VCN --- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 94 ++++++++++--------------- 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, 52 insertions(+), 68 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index 6d9cb7fb67cf..48fc9059c386 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,26 @@ 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_load(adev, &adev->vcn.fw, fw_name); + if (r) { + release_firmware(adev->vcn.fw); + adev->vcn.fw = NULL; + } + + 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 +115,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 +143,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,13 +191,6 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev) return -EINVAL; } - r = amdgpu_ucode_load(adev, &adev->vcn.fw, fw_name); - if (r) { - if (adev->vcn.fw) - release_firmware(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 Tue Jan 3 22:18: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: 13088073 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 CF920C3DA7D for ; Tue, 3 Jan 2023 22:20:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 029F110E4E5; Tue, 3 Jan 2023 22:19:55 +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 12FE710E294; Tue, 3 Jan 2023 22:19:45 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MkRuWydreh23F3dPm67uRtgV8Kq4ghZ5Fezn0z5Sl+1WIY+6i8UHFswV7nRS9nV9k85UXvYEwSKmBJinb4/mGvw0Z67KIiyCC8R5aX/mGiD0gaBC7XyiwZRsSonx7DfF5uBBT6W4hOW0Zwe3Th/ujL6AtjGqZw72eHwgNDHcQYfNlPYhPkAswvRCJmOgAwxkJ8nwINNDTOH1u2Lvp4Za6woGTwjDC+46x+j2Dl7ZYTJNxsKezA7LPBktUvhd3s30TaP10rXxYspifFxPOpRKcVrkzpyELsNsKl2i9lgwjUa+ozNOZNf1cu/ByOXQY4HLWLf5io13gdS94ach/ARE2Q== 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=PucGminggnxE9vCm95cskc0DcE2+i/qPjVRt8A/ibbs=; b=OMDIzu8BH6xHh05K5fC2AM1dto756DbDjC2EIqm1cpylzTlGQIJcHvQHE8rCChE9aV9gFNBMiIGaXONDvnWeyJG+BMOvvhVkh+vdLgJ4fwfSnXuxM4vPw+LOy8NUzhJgnaej4SRzO/UxbkPXKH3UH/mUbZTNb0UPvwj8l/9CaaggRrgI1PSnfDcOlBuZvUIduxq3WuQS2/LAYwiW6Vd48md6V5VqHSz+YpZMSpcZmHgk7bTqYl9On21QddXdjxD4qafkQQA5oE+CrNGGmy32fN9GIlsG6NHIdQDP46xlzJQVxRrtJF1gqSLVJt8aHZsBDUnSDnY4oormJTkvSf4Opw== 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=PucGminggnxE9vCm95cskc0DcE2+i/qPjVRt8A/ibbs=; b=mhxEnXPzyJHUjn0xQ5zRKcQXL3wMX14pjlNZDGKLXyZD85moGRjvWoxsHZFuL/s8wdvQ10r5mmqJVh6c9imCYidDAyYX2aui9CmJ2iOsIRQ0kB9+6HlxAocaFeG89VNUqHtUt+yb1H0OXJkRZZYYJU0HxY/yY/VVplQ7y9+jhhI= Received: from DM6PR10CA0009.namprd10.prod.outlook.com (2603:10b6:5:60::22) by SN7PR12MB7881.namprd12.prod.outlook.com (2603:10b6:806:34a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:41 +0000 Received: from DS1PEPF0000E654.namprd02.prod.outlook.com (2603:10b6:5:60:cafe::60) by DM6PR10CA0009.outlook.office365.com (2603:10b6:5:60::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19: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 DS1PEPF0000E654.mail.protection.outlook.com (10.167.18.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19:40 +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; Tue, 3 Jan 2023 16:19:39 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 11/27] drm/amd: Load MES microcode during early_init Date: Tue, 3 Jan 2023 16:18:30 -0600 Message-ID: <20230103221852.22813-12-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E654:EE_|SN7PR12MB7881:EE_ X-MS-Office365-Filtering-Correlation-Id: 41c2b319-8f0d-44c3-2356-08daedd89be4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3PBw7OYkiW0t8YHP4Zlk9C1Hfc3Nns/Bg/oaw+sfcZ6dBFiEgiTjXbLUSwfENJ837WyVOU3voXJLz0xE9Avbcd4ULhbttIn94mqkpB+ohQDARNhpSX0PzM8LX2c1qKbDjmCIPnduoQKmu9FTxAezsaZtq294oJQ4CKAEZKqZ4TgHG0biCRYxPKSnoYIMsBvIqpdiZpftZIOft1RZJKUspMBmwxNShId6+FFiSJCkrVLrwvqOXVSIf3WH9rUqNGwn0W+iXBoqyCp/66xINmkMLKSMgBop9ns7gckZMeMP2S/GPAC/0gfOCZ8Z32STHEk13sAHqgZ7sDgmcD7qD5cTUoqhnzkCrhvYRslLlulcLpfpM3qmSKYdi0jBXHqmMvHD5s4cCocwPNKXqK2DrSmN1yR2cHtt+mVFcmHp1j7uJvy+xiM3FVVoY1wAa4D5txnZKAzciVH2US8fGsCSXawJH0WSYnoV396xJnmNvYgw+PKzOkpJO5f/jDN6Z9PrRa6lFZTQf5PM0r6zrryMxJToDIAT8tXXy6B6dzUt5sexd/Tn7p6/ETRJtHWTcb6dqAv76xediQ5cv6cKif409qssyAxC0nYwGXe+agWybjptgDnUzoAMm7JDUqkdiBrxShUFAcAA4oVO4+rGU+BIaPelig0RYlK/0ZhNvZL/Zi+WyG7Nf+HI6x/vm4134X/KAPpR66OGRCxHl17WwmJhJMqexN4iJwdXL/kB2AVOqvr326m6xCLfwLhaSa08a0VDwFYIDgUFrk8Qn0LUN/yQtXN6dw== 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)(396003)(346002)(451199015)(46966006)(36840700001)(40470700004)(110136005)(54906003)(26005)(186003)(70206006)(6666004)(1076003)(2616005)(16526019)(478600001)(4326008)(83380400001)(336012)(8936002)(426003)(47076005)(8676002)(30864003)(5660300002)(41300700001)(44832011)(2906002)(36860700001)(316002)(70586007)(82740400003)(40480700001)(356005)(81166007)(86362001)(7696005)(36756003)(40460700003)(82310400005)(22166009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:40.9703 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 41c2b319-8f0d-44c3-2356-08daedd89be4 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: DS1PEPF0000E654.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7881 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 --- v3->v4: * Introduce new early_init phase for MES v2->v3: * Add a missing newline --- 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 Tue Jan 3 22:18: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: 13088070 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 4C049C4708E for ; Tue, 3 Jan 2023 22:20:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0688610E40C; Tue, 3 Jan 2023 22:19:53 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2084.outbound.protection.outlook.com [40.107.244.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id 462B210E294; Tue, 3 Jan 2023 22:19:44 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JQG/vJhzqN4+sGXJzzSOfq5J/7O480nRFI96e0USyJyAlSna9h7sEUvoK0Z1EyRTuwC0PXr3Pea+cvDb2PE/+XpD+KMFkgmXZsy8l+NhDZfQRvrLSrKaYV0RGfxYKYcSDtLgqrbKJz+Tqtzdxf99l3j88r0CCR1eHXhbTmsv/VR0srV71+c2iddChxMBmYJzinqbUyImcqiRp9S3tXCQJ3Rnq/O0AqkNZ62G1WTjXE+QIcyOzAZCtD5wnYtKECY04UHdqZzzn3KPWG/4jyCOBBY71QSgjiG2TRLf9tlJojMA606lLyVcY5Ql6xxk+51z6EmO/XSvCDQyUHXcovIXyA== 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=Lc/v5CnFXkMRGkFU4ZuqObbCevvE1ewDkotNYqfyoBQ=; b=PQqhvceAmxcQ7rBf7+2TOyabQD7I+pRseQf1zbIT9eAgbRdYQg1tgCkO55cKGZ0vD0TXe4fbi0OqsIi67ic8SCDr0yFwNDNFnO7xloPm1HJQe1OeXX8YmReCXk4c+7711GLOjDgPe0ghEIdIxwT3mxbWKBDlPvmbhJ5fiT2DbHptHyO8xfPvav6iV6+S5H1cF6QS0I0yx/EZpDP+V+a92EHB2VFPV8JzD6o5vQqTo5TxaJs1LaRSKGpdAUBR9hcGF1l5ZrhzPVznonaXX+1Qj1faGmDLkoRB72zQPO7C6A2oDr1EDTt3nA+X89W1B1Gopz6AaCyz6rdwhJJH1myMOg== 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=Lc/v5CnFXkMRGkFU4ZuqObbCevvE1ewDkotNYqfyoBQ=; b=pnyVkKqC91vEJFSKIoUaa24wObJsZTdkpmsdPgP/8ptHtDjuw09BxqI/7VRa6ed6aao88F+qu35ELR2Qsm9bqyMJypCmbWvcLJf5tm+0C3sZGIPxKorGQQcPeg3IVdEnPkRS5QYb0OTxrZPlyPMadJ/JYaCQFcPPZpjpimD/gdc= Received: from DM6PR10CA0011.namprd10.prod.outlook.com (2603:10b6:5:60::24) by CH3PR12MB8284.namprd12.prod.outlook.com (2603:10b6:610:12e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:42 +0000 Received: from DS1PEPF0000E654.namprd02.prod.outlook.com (2603:10b6:5:60:cafe::ea) by DM6PR10CA0011.outlook.office365.com (2603:10b6:5:60::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; Tue, 3 Jan 2023 22:19:42 +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 DS1PEPF0000E654.mail.protection.outlook.com (10.167.18.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19:42 +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; Tue, 3 Jan 2023 16:19:40 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 12/27] drm/amd: Use `amdgpu_ucode_load` helper for MES Date: Tue, 3 Jan 2023 16:18:31 -0600 Message-ID: <20230103221852.22813-13-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E654:EE_|CH3PR12MB8284:EE_ X-MS-Office365-Filtering-Correlation-Id: 289e3361-738b-4648-6899-08daedd89ccb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PSXHmd4LUTUonFu4E/C68qMFFHlBrNBVSlbTKCIg69LlDd8YtiC++GK/RFy/Cqwfvxw4u3qFS+JqnAiZCV3NhadUDOJxmHwyzR3LD6U5sYIw+4f6nCYxAezc6yVxoh0eo2DbGsUhYfgE1HJtDC6yJ33yTdndbnGUrW1lTHQKprS08ShTFeEDz6MFTtNL+S84yEXlTFVKTCxGdP2Vbl1VS5QrSApuvrBp70txlKUaV78LPnihAMBuMMTRsP2+/ox/Eu1A+V+2VELqW8HtbM4NjKaL6HgLa7+CA1ITrTHtE6cJSOVUVFaiU9xznWuJ1AxJeNfMPgHLLQd4YwsS6Ut7Z/MpvS6hGD8c5Kam9iINh0B5Q7pVovxC15YBg0MnEGFjcX+WOCuxE268bqAzC+36fiU/7k0ZRZMM0O7yy/HoTND2LLbpCJecqtM/PEKwVuoowpuQ0kkxZCKv1B6UNadguWzwEo6chhMcCRyT6F1y71rP/tczIvLMbZ16Li5Upr0ZJ7pdRQ5+emfsVYWTHZ1A70bD7gT8oent6/4RgvUq+wTA4sPOJqNtFRREHiLgy/gqbERK3ZqPF3cyeGHAFENXFsETkmmHIrsgfZ1ebYgDSLCfLA8/v2p3Rmg/dMAm8KlfAWFhuVdQONJhFOu73i37cwXMCLuGDwLA4nIhG00CP+bDcKesf9eogADB3plveuDXbXmWAsQFdg74VmLNt9QFJAoyKcTyKNFVpwI0aASbXw++F9F+jWrcgjEhy7NvZpNgnk4crB6P7M0mmJW3HJfF3UvRKD09zOEK+/EkUUoLbV0= 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)(36840700001)(40470700004)(46966006)(2616005)(36860700001)(83380400001)(47076005)(336012)(426003)(1076003)(40480700001)(86362001)(40460700003)(82310400005)(356005)(81166007)(36756003)(82740400003)(2906002)(44832011)(70586007)(54906003)(110136005)(316002)(41300700001)(70206006)(8676002)(4326008)(8936002)(5660300002)(186003)(26005)(6666004)(478600001)(16526019)(7696005)(22166009)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:42.4859 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 289e3361-738b-4648-6899-08daedd89ccb 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: DS1PEPF0000E654.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8284 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_load` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. Signed-off-by: Mario Limonciello --- v3->v4: * New patch --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c index dd8f35234507..df9efbca0f70 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_load(adev, &adev->mes.fw[pipe], fw_name); if (r) goto out; @@ -1482,7 +1478,6 @@ 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; From patchwork Tue Jan 3 22:18: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: 13088069 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 B4A6DC5479D for ; Tue, 3 Jan 2023 22:20:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0C4DE10E4DB; Tue, 3 Jan 2023 22:19:53 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2046.outbound.protection.outlook.com [40.107.237.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id 202AD10E40C; Tue, 3 Jan 2023 22:19:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jEXCyjFs7Kde0kZ6+gZC72iBMBdgAvccjKoGmK9VVdxmhcLgcwkX3JrgIN0T44+n7+wKSE8MTnext0f8GIjjMAhrl2bJeZwHAeTOtzZ3rLnma8Gt6E97gY020DCI2dGHJ51tlOwTe+d3Px3w+wL8c55s8oq5sRSikkaCW7DI1oG3ae1qp5DZ037eWxNAT9V/566yH2cpqQIjd+EbBV/B6/jid+oWsIjHFDMs5/uGSn86jBQ4V+wDkp10IAKk0zxPlaEMOixeo54qeIW1Uz94bipdxQr/8H6CGHKShxURKrINK9roLhMgl6W53TrymsqtIo9gW3y9jpRneIe0qOzIXA== 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=9Y2sP3PlD3eGIiSQvNh632gBhes1ynqhUIRWZGZ9J2g=; b=CHpn6v9qRgYOldaS38qjqURFkeW8bqXINfTVfNAkMYwCDF9px7dzyhEk6HeVuTsjPpjOUcmDUPSJA3KaA3OFYsQPwOJO2s2KdzL4LrjIe8/Ae2zzFwiDKJEBM0HfCZeFNu/s4ZugoI+ONMWXCSTBFYLdiqtTxHM8B4bGLhuXWoEwHfUpW6cLwKC5q2qeDPnxUOk3bABj0iPe7lgugxfa29Og+Kw51a2MI/s6XRZwU8wAWMumYQsCK1ahtqbHv6sx6UVkYv4BoRNtt9l6hpW+xeW6Z5o4Q6AkSol0yo7a8vk7zgpTI2F5bUo/I3owoGXFew50qjxz7BQwaXnvC+5tLQ== 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=9Y2sP3PlD3eGIiSQvNh632gBhes1ynqhUIRWZGZ9J2g=; b=xF550u3gdtJxA30Ns+wiNRAyxW4jDSQdwP/t1ja+2vdRIrPu4zFz0jBwpPe0y+uLqZrg5hZKVBMr37LQbqZHN5/ls8K4nQgwMXuJ4XKsxp/CdsW53pJ3CAFsYhRYI4Xq58gkhpDDE0wILtzBVqolDcSqhsT7njHLRmjvKX+6M1M= Received: from DM6PR10CA0011.namprd10.prod.outlook.com (2603:10b6:5:60::24) by CY5PR12MB6432.namprd12.prod.outlook.com (2603:10b6:930:38::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:43 +0000 Received: from DS1PEPF0000E654.namprd02.prod.outlook.com (2603:10b6:5:60:cafe::8a) by DM6PR10CA0011.outlook.office365.com (2603:10b6:5:60::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; Tue, 3 Jan 2023 22:19:42 +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 DS1PEPF0000E654.mail.protection.outlook.com (10.167.18.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19:42 +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; Tue, 3 Jan 2023 16:19:41 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 13/27] drm/amd: Remove superfluous assignment for `adev->mes.adev` Date: Tue, 3 Jan 2023 16:18:32 -0600 Message-ID: <20230103221852.22813-14-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E654:EE_|CY5PR12MB6432:EE_ X-MS-Office365-Filtering-Correlation-Id: b72f0a2f-5192-4aad-c5db-08daedd89d0b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cGHA8LOnQruHbdbUtbopH1ydqrSgrAd6JYz/K8VYVlRvJyK2mQcDj7SpgTsjGpPts/N/OYMtOmSPuadYD5ni7s6OJHxFOu2cppo+MOmgKzmjri3h4G3gsF6r2zN5evXARmis1Q+WWhD/PbxoDPLIAo5VD17c4RSRUdxy0B3fE8DZpcD1eRZm+6+Hzk/MajXva4I0wt8x8p6vYT4Bn9wmwBBAwrraVDh0Ltl8ZAYLtDdjWI6zuCYGqaXmZqPr+KAPcSqWlxbdCmvLhd97Mh9sRgBf3a06YG6GibMjDrQL14u5xGc9VaDbG27MZPidxWB0Mqwhox8Z4+M2/+Exv7EUIxKdfr7TlGLFiXOxXudgTmrQM6Dd29F1NXqNkN7qh3+SWOjbDKKbBgbUj3mBn2Z3XaaTqNJsqSrFaEeuBJAo6icSv8mrUfh0jz0zq27TsMX6JYYV2A+CZ5NCca1JwO9U4qn8SiCZoxGpFG5T+P0B7ESDz0J/PqY6x78dKD0fwCd8Z+1zTbydzfBYiwzs1t5ZNe2PKydA8T3T4fYjrPWZtKNqp6dDAq4cd97O4ePqpYwpampJvhNbRy0CUzwKDfcZf80C4Pwy9766dmWBoDIm7GuoCyFK85CchjtpVl8Iaqj11/YgAXEKUAFqy2oh1xObDLlunrCN9yKDNgJ5WdDsU8V20ILqoPk0Jw69OK9qL4LD+fhYxqa85tg4le+hLh2gPJ4em2UzUIar5HQQ9jRfglGY05fXM3dmwD6dkPBO+HWN3sOOBE6IDDh8EBpSwHYrtBFl/HnRSEPJm3pDvqZFgVc= 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)(39860400002)(346002)(136003)(451199015)(40470700004)(36840700001)(46966006)(5660300002)(2906002)(44832011)(4326008)(8676002)(41300700001)(8936002)(70586007)(70206006)(316002)(54906003)(110136005)(478600001)(1076003)(336012)(2616005)(26005)(186003)(16526019)(82310400005)(83380400001)(40480700001)(7696005)(6666004)(47076005)(426003)(82740400003)(81166007)(356005)(40460700003)(86362001)(36756003)(36860700001)(22166009)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:42.9079 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b72f0a2f-5192-4aad-c5db-08daedd89d0b 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: DS1PEPF0000E654.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6432 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 --- v4: * New patch --- 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 9c5ff8b7c202..f58debf2783c 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c @@ -931,7 +931,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 3af77a32baac..c8bdee9a66c4 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c @@ -1020,7 +1020,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 Tue Jan 3 22:18: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: 13088071 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 55425C5479D for ; Tue, 3 Jan 2023 22:20:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 85A5710E4DF; Tue, 3 Jan 2023 22:19:53 +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 A7FAF10E3F2; Tue, 3 Jan 2023 22:19:46 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hBPs7jBek3yGkCawtXp/bkM9yS1zUmcFR+EXfEcG23hSD1UR45V+jd+bwqQ9m4V/G+BuSCgHHjHDzrn4oji+HJyoEn7URjt/V8+jFSbetX3IEx5ZIBnc4FbQWRWhYM1HKltp/x8TwpVnWyud90hplwoLh1Zuh+93JCMGlof7dX4Y64OC0do+dbY8sTiP+UyJjq60rJxXgKslvZrG0wfGL1hCL3/dXOF3V6G4YaR84Lsg9iwzPYKBIo5QQ5EEv6xiAzEUORrU9pz9gMeGkjRFKZLJ52Z9ctfVV+62TCNc0N4YmeJ3u2TbjjUx2m+Xiu4dhNNXbEbtWi+ubjzCpC4cVA== 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=bdPrwj2PcjAc6pxn9nsEfI6JjZjOsAIo2fqSHxb5vBQ=; b=fEJC/HgmuDb/QaWGUvjvUCIY4zV78JJXWCGr7y5OhwPIgDF/H/FQjXqjAo5+In+rAypOCJXgQtIgLPRBwqRKX6QVXUrMUNKGv1NKW7ijr2zxdyBA+DCCnVqSEIQXLcu4jHhxhMBb0Tnmx9gRCb50GbBZQx4CzupjFwp5G6MCdSdTbmYTyWo9xO5zYxLXvXBgu53AGC1RtUSXgKg8JbLsqEgii+r200F4VYuwOW+E+zj1edz4qBxEG/xtjOuuHU46tBj7vchYrM8h74vY9a65vVWKYw/hFQgzJa0zf3FWctm9HPMPO3e6hV6vU/mLyBw/DAY4fuHWx1MXP79cuIJo+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=bdPrwj2PcjAc6pxn9nsEfI6JjZjOsAIo2fqSHxb5vBQ=; b=PmPyjnjT9zpFN77x2/0e+qQiqDgsmH1owMiwWXijISd5aPIi9l+fcNV7h33kbNZ6rHeZJNtt9Y29IDSlRUSBLysFZ/BfGm13SBEPsxc9bMmGLXu8AG3JsUBpkqceR5cSxwu+15780jOVTOJD4yDEy4m0+E25RY7k/KjvRhN2NnQ= Received: from DM6PR10CA0015.namprd10.prod.outlook.com (2603:10b6:5:60::28) by DM4PR12MB5985.namprd12.prod.outlook.com (2603:10b6:8:68::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:44 +0000 Received: from DS1PEPF0000E654.namprd02.prod.outlook.com (2603:10b6:5:60:cafe::d0) by DM6PR10CA0015.outlook.office365.com (2603:10b6:5:60::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19:44 +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 DS1PEPF0000E654.mail.protection.outlook.com (10.167.18.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19:43 +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; Tue, 3 Jan 2023 16:19:42 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 14/27] drm/amd: Use `amdgpu_ucode_load` helper for GFX9 Date: Tue, 3 Jan 2023 16:18:33 -0600 Message-ID: <20230103221852.22813-15-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E654:EE_|DM4PR12MB5985:EE_ X-MS-Office365-Filtering-Correlation-Id: 51db6c9a-4a66-402b-e585-08daedd89dad X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W6a5mjzGHx68N4U2mxIOU4INzTOpwCbiMhgtLjpUgmBaZqSunb6N/3B13aNuwoJpn7/vGpDvFSJJJwbDT9Jpstl7IU2aPyHh9RDG+OXWTSmB8kYsndANoDC/ABzhGGam8MbBFWgKJ9CkUjcROD8f5R/p5IklJnZ50B0SoZfUQWLdfHG9oEg0I3Ko40Wp7Ctce64LW5Fg/7svSl6xbQR1UJC4GlvJBEEaWcqUJID4LVoONbh+IoT5BsFJWhdUA68S1oQPbx9r4PCi0ayqsDzDRgzsR6jFK+/S2etGMX8096M11q/YIdaDyzHQGxzCAg1126uNuSqmr/qujAVEL2LHVhGTXuVMST8WMq89cRV4nS+xZg6wMBdcQkJhI4TztSdfVXiKz1PTl9Y1z0oGmqnQdTcgXN1D1PqZaHBwTAL3J6Ekql4uWoV6/SFBrVxb85qJ8Dg0C+31q9WptJ/PCn5/99LhEDX7mk+dm05ZEw1ucnodBV2Avc/LoxkVC/Q9U4Wa+8TGIAwwhVDbiZbc6LuMQXXPHUvL04jV+L9uwpEZKK4znRqJwCBB+S5pDmbhQfAs1+0eLJVboMgxOng3P1k8rqghSW34ecz/OesVkRIjbEut6atsosig/sLz3vLS+2+u/rYrSmU0qaBbjdtXE7+No3WyhRTVG5uUfgj9XqmfzdytQMfKKZaHoX+xJZxm9fdeI+/2MzEfQKcFqaT5Pi/x+WMzRXLgSp8QGjxW5s+j1I41F25QKFYbCACziORQz+qHYCEvoO0AhOifgG1bbixwvEt0pDoUuu3Cm7XtXwPJwKnwjjsGF8CDS9vVdKH27/EL7P/uhELdUVqquAgzdoJRTw== 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)(46966006)(36840700001)(40470700004)(47076005)(1076003)(83380400001)(426003)(186003)(6666004)(26005)(16526019)(82310400005)(2616005)(336012)(7696005)(40480700001)(40460700003)(86362001)(36860700001)(36756003)(82740400003)(81166007)(356005)(4326008)(8676002)(41300700001)(44832011)(2906002)(5660300002)(8936002)(478600001)(70206006)(316002)(70586007)(110136005)(54906003)(22166009)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:43.9547 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 51db6c9a-4a66-402b-e585-08daedd89dad 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: DS1PEPF0000E654.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5985 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_load` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. Signed-off-by: Mario Limonciello --- v3->v4: * new patch --- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 43 +++++---------------------- 1 file changed, 8 insertions(+), 35 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..27040821d764 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c @@ -1257,37 +1257,25 @@ 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_load(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_load(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_load(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); @@ -1328,10 +1316,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_load(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; @@ -1341,12 +1326,10 @@ static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev, 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; } + return err; } @@ -1371,12 +1354,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); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.mec_fw); + err = amdgpu_ucode_load(adev, &adev->gfx.mec_fw, fw_name); 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 +1366,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_load(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,13 +1379,9 @@ 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); From patchwork Tue Jan 3 22:18: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: 13088072 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 2FF9DC3DA7D for ; Tue, 3 Jan 2023 22:20:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9F90610E4DC; Tue, 3 Jan 2023 22:19:54 +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 67F1410E294; Tue, 3 Jan 2023 22:19:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JDfDZlCYfToefKpGyVRo8fbNW8zK20otaT/EXSgHGU476TPFU1VucNuPezd4cQK4CQG96emzYW9GRY4fV7SLY30D0bXw6ot6eFgTzn/0145GWgEnl9/UeAhOoraC0APhgEsX8oKaW928OZ88xyGjWsQY3tOPkGRZt4WCdajdk2iY+G9AyJGAJIcQ+ivm+36lqBodQ2KJPxqieNhpCOl4PwqErLyZnEu5QOuWw4MCNqYgGqe4LxLAA07ujc4BbCesqlHBfNojFZ721pwM7wFpoPyoGXzJbjLmaH0Sx2rHcbj3S2WlIH0lbdu9S0tgEsM+XxYoh431AMcQ6zUjXTK9Og== 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=fQzzWQTICRxoHs2IynlMSZNEQ3a9JsIDKjffnX20rQQ=; b=MaVOc0v9BjDuvbBvDQEok8b+Ly+RqT0A+ygG3tSKUGVCLS1fTAdoiv6QIMrkVLWW3xlZzigqn2KiAkimXV2zwCddtZQp1Kvf/ktAyaKgfEqfPs2/ZTkp78a7uQ7m9pAiddIILGRDM02HrkADlXBDY+Gj38Fy7UTycNdh/QG1rrt2mu66UjLQnjCL/qu+x5IOZ3Jlw4hCIcMSaxjfaQQbDa8etvl9M9bI2HshXth+OQo9a4vNI473DmaKeUNAQsjXM/AYMYgXzCgkPQmrmVciLnMFpvmZ5FrGlt1eM6glyoIkNSCz5mNMX6OGUuXw1jVz51aEurIe6KybdCbBuPq3YQ== 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=fQzzWQTICRxoHs2IynlMSZNEQ3a9JsIDKjffnX20rQQ=; b=ezH4BgibAONEqoepfLKLi2lGh01FrT/UggVzYhqYFVYe2NvH09VJJhe49507vfbyb1a6B0EmXBoxHxrRltD2JMOCipDbmbc9TTy8MYYXgN1XKBs24LfTIzQIZneQYozFS8BO6dDmNAO0C998VL/FdeYKchl4BVR4/iWY0mytMmE= Received: from DM6PR10CA0027.namprd10.prod.outlook.com (2603:10b6:5:60::40) by CY8PR12MB7585.namprd12.prod.outlook.com (2603:10b6:930:98::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:45 +0000 Received: from DS1PEPF0000E654.namprd02.prod.outlook.com (2603:10b6:5:60:cafe::f4) by DM6PR10CA0027.outlook.office365.com (2603:10b6:5:60::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.20 via Frontend Transport; Tue, 3 Jan 2023 22:19:45 +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 DS1PEPF0000E654.mail.protection.outlook.com (10.167.18.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19:45 +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; Tue, 3 Jan 2023 16:19:44 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 15/27] drm/amd: Load GFX9 microcode during early_init Date: Tue, 3 Jan 2023 16:18:34 -0600 Message-ID: <20230103221852.22813-16-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E654:EE_|CY8PR12MB7585:EE_ X-MS-Office365-Filtering-Correlation-Id: 09f0ac7d-c47c-4044-0354-08daedd89e6f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /9uULEQZD9x2JDYfei/akhbDv1JHyhWKljBcOaUVfmoLw7M1qdq1J7FUSZeq3VFOHpxDrmgCEPg9RwR03EJ60LhYYbCzUZeN5joHF1mRtN/WQ+HeJXJ7xY7uOcj/kmXb9CqANpkPVjzm9J3vpunqBCk0qpvlmRLRlkZEtioRz7fizSSwhPJCMPYYyyfZVPBNq379gEH+daxr459MsPkDlgkAxIKhdSTJ7M/e1+KKKqCKIJjH3rYTSgjl9zkkOJ60/R17bsD+YhYzb4nqGBKRzlhpAkhYFJloa9KlfMdC4TAbQfxfzEYZtspo8Rjltw+VLuRPhzbZeDVZbB0zvxRA0MxMovzgPF9oiD7/aSL4c8mxsqhaDQMkRH61CCB+BAIdcXjot/D5ueyQL1NnKhYvgd7TfAvdRJOVaC3HMoweYnkDgjoIZuKY8m8CSEcf04aypcNct/E1DgEZqZMh24fLJ/SxNAX9Ck+HBQsaQRXxhRMJ+IRqoX+7BXfFIwru7gKbH8vhBiRsrIjaAYw6zB8iSaRACX+gpF2x+2InEhiG/DfgInk6rCFNgF+G6+hQmK1X9J4qUf3FC6RaQOkuEKvuyzumkmViYGfmX2h5gs/tpbeesNwsHODxjhSC6QOPTzSpYbRt98FoQK5ktrzQST7/MaiE1LPSAwTzd36yXfb0gw5PQsJO4VpLJIICVheZTLcKKVRFYcr6jP7XnDF4gsplaMMFtTw6KS4iTVTwphwO3PvDKg/tJ8+sjPxSV1OKnB5G 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)(376002)(136003)(451199015)(46966006)(40470700004)(36840700001)(186003)(16526019)(7696005)(26005)(54906003)(81166007)(316002)(478600001)(110136005)(4326008)(1076003)(8676002)(6666004)(70206006)(336012)(2616005)(70586007)(82740400003)(47076005)(8936002)(44832011)(5660300002)(83380400001)(426003)(2906002)(41300700001)(356005)(36860700001)(36756003)(40460700003)(82310400005)(86362001)(40480700001)(22166009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:45.2203 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 09f0ac7d-c47c-4044-0354-08daedd89e6f 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: DS1PEPF0000E654.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7585 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 --- v3->v4: * Move microcode load phase to early init v2->v3: * Fix issues found on real hardware where num_gfx_rings not set during discovery --- 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 27040821d764..4e9c230e42ca 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c @@ -1251,7 +1251,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; @@ -1287,7 +1287,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; @@ -1344,7 +1344,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; @@ -1392,58 +1392,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; @@ -2131,12 +2097,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); @@ -4578,7 +4538,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 Tue Jan 3 22:18:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088076 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 552E8C3DA7D for ; Tue, 3 Jan 2023 22:20:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A7B9510E4E3; Tue, 3 Jan 2023 22:19:56 +0000 (UTC) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2063.outbound.protection.outlook.com [40.107.212.63]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9AB1610E3FC; Tue, 3 Jan 2023 22:19:51 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BT5Aff5bp1Y+nA85/fO/q8DUDNokwnIDC+njA0bzbyjkxEOWERbVsjPdfqlElXqBnuVoWngUcp5imD+NhCdWX/RbqFeCKwLTX0/kbO1amx4Dnv6oMMCDAKXrr+O6SwmxLx+BUv8YCw//iC9oF6xl2PMMq0wC4ICnv+D0X6FRDnCUS3B1C+F+p1d5n5DbUGjncLCfCwLjR2Iv2CRTQPqS1nJHpp6ZWhxIzqd7VBrxJPzM/MUdElx4k97azuE8bNh2GBjDfv5pehgl9J4fPWYFzLG/ZeIrAYTrEfRZPhRXSUjf5Fl/oKw0HGw/KnPwLN9JVPFHtpXBdzdDXheqLsFiMA== 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=owFI5WW0iZ7ADRKTLxiwUeFtCqLd8InZ4zFuMsMZkjU=; b=Si72h8NgM+4pv3IMZka6j2pdIEywh/RANIjrHtNWDqrVn4lqs/dIcofaUhUEtcrYcBHjtHqhSe3pCz56WJrceha9vJiH1tB9S1hdgfBHyZ4rsD3YGyNtXa4p4TlF2mljyzZKCeHX5ywW+7xEdH5vWVBtECKDTwXMYWnEFLPkjpnWKsp0PKrRhLAdMvaDUrIFPuzAuByLvL4kSm04hg+ZPeTbCI95ApiWbVfODyyp/RqZZraFbV5/vk59J1sRUQF8AMSq3R8aMpM0EvMCbN7LQD7yws/NKMesG+5bthTqLPDDqK752hpu9ecMX3och0GBdndU3UNzNUrNuYOuEVhz8g== 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=owFI5WW0iZ7ADRKTLxiwUeFtCqLd8InZ4zFuMsMZkjU=; b=3YFLN1DK20NXbWEtNinswJQ1sE+5XQjYmdpSwSHlDrYOSxqfPY6JDqwN0fTQOS2yS1tGB2OEf7ce1g2xVEZMweWrVxWIpFPJNEhFu8HvcPL7ov7BGj2K05ZKy/N7tkuehqJ++wv61rFxjGiZWEMjjbBzrK/vGfmQif/19rj8XJE= Received: from DM6PR10CA0015.namprd10.prod.outlook.com (2603:10b6:5:60::28) by IA1PR12MB8285.namprd12.prod.outlook.com (2603:10b6:208:3f6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:46 +0000 Received: from DS1PEPF0000E654.namprd02.prod.outlook.com (2603:10b6:5:60:cafe::d0) by DM6PR10CA0015.outlook.office365.com (2603:10b6:5:60::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19:46 +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 DS1PEPF0000E654.mail.protection.outlook.com (10.167.18.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19:46 +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; Tue, 3 Jan 2023 16:19:45 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 16/27] drm/amd: Use `amdgpu_ucode_load` helper for GFX10 Date: Tue, 3 Jan 2023 16:18:35 -0600 Message-ID: <20230103221852.22813-17-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E654:EE_|IA1PR12MB8285:EE_ X-MS-Office365-Filtering-Correlation-Id: dd6f8631-c0a8-4d37-7271-08daedd89f1f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bdsjxwHfYwFvLAf/azkt3ToC870S1CtxzUMrnzSDN3SebMuUwwDaT1YuJuiEpmWwflROlfyogWZyYb91vtH4311HRygF7KTJ4toC76ZrxhJTgV0DcUlu1nSFm6yH0vZJ/ywIn44IYzZzARbtmactH4WbkUwwKgydFcf+67ELq9JsJt/1p4CjLRTEhkXGp81IpXzgZl4qiQcdPGGMAOYsl+AX4JJAfrpHwrAAeVC4wepEjTpY64AEOJsJQ1Y9tlig47rUz0rLVLxUkFTHx2lWpc+4Ct3ddv1rVkVmZOOGH1CdBzjxsktym0O9cYA40AeLkJfSIp5nVINk4jf88OJ46hH0ZIXAsAAoT0LhXJ4FBTbrBDxJI2LiHWcdbPxf0GGldD+Npvu0gcPAvAS1iierZpkeJIN4GakCD1bQbWBKGA3UnqFLzmDLQiJII1PppGqeIIbAJL6cDNVxkF12NnFx3ek+WvYFMxOQjdoYbB+FHZPdgu1r/qOyvdrtSHHVyeF5/E89+4xPwFdyAQjrSDt7tB49Rh6/us+Mom3ztdVYQUW2aiuwjYIlCQP//7rguMDaZTJ4ik8/GDFMpn0Ci23LfaX8nW9QDqDewvXG1RwAhB06tpbdOvNFwt6MBFkWs+WlWlRsjGA9QyCX7PIqDajcJ1c5XOwmtkGbKC0Hi3HfRtHOLg0aEbz84Wnp20FZ5VwwHOmCnWu+ZIJKwfuV5OwHlRNqH95OCRS0HsvjXoLDos0nViAGiQuRDMYU68cRBdgKmqkx8wV9PcQ87G5F/a31roLXdqaRm2TuwL8bV7tAAoM= 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)(39860400002)(346002)(136003)(376002)(451199015)(46966006)(36840700001)(40470700004)(16526019)(26005)(6666004)(186003)(2906002)(478600001)(7696005)(54906003)(336012)(70206006)(2616005)(1076003)(4326008)(70586007)(8676002)(40460700003)(41300700001)(47076005)(426003)(316002)(40480700001)(83380400001)(5660300002)(82740400003)(36756003)(82310400005)(44832011)(110136005)(8936002)(36860700001)(81166007)(356005)(86362001)(22166009)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:46.3765 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd6f8631-c0a8-4d37-7271-08daedd89f1f 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: DS1PEPF0000E654.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8285 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_load` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. Signed-off-by: Mario Limonciello --- v3->v4: * New patch --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 35 ++++++-------------------- 1 file changed, 8 insertions(+), 27 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..5f6b59e23313 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -4030,41 +4030,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_load(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_load(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_load(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_load(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 +4068,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_load(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_load(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,9 +4087,6 @@ 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); From patchwork Tue Jan 3 22:18:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088077 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 04A48C5479D for ; Tue, 3 Jan 2023 22:20:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0DC5210E4ED; Tue, 3 Jan 2023 22:19:58 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2066.outbound.protection.outlook.com [40.107.92.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id C36A410E411; Tue, 3 Jan 2023 22:19:50 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NPhrQiW8lSFukPp0oUUPIr/SnrvQJKnFuUNTHN9g+NSNo2I41QpqRGsWibL/5OvAeKO3HHpWEtQZuwirwWcVzIcYH70SundonKC0js7iiZvb6xxyOh84ZfdBiFwF84T70/p9LCeaMw0L0jb1PopqMWbhcC16VUSxh1vPumOZj2+U0hkboVpceK9AH6Iql+JFvIHGwZZmCO70FgAJ6JUgiw2CWzN9+RrznGLp6Gd3AKdsjGAvWawxOy9prJjoj7EUr8+HrGmWmLiSu1TpqYNuZpsoEnwOqNlcOEM/uFFds+dkhz6BZJbSU4TEEZu7RezcExuBRGBHvh/B96iftx+oHA== 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=JIx147d7ohHODebsWmO1tXe7G22bL6vSyWvpn4sgxVk=; b=Xrk3ZuN59Fk3ObSuhkGgzvhhb8DBZ/VbuJXzt6YALxOEIhpXmPe/L3zLLDBjXC8hoaZ7qV+ys7kni47LYoQkTr+U8WxETrTnnjk3nx/mEajJI7SLrhDZNJfIZzs6XAoUyuaGa34CufHm/s8E/L/jDxGHBzTTzXstLuWV3/OrLMIgY4mB+Nm2uJcfIRFoa3c2JihSI5NBMcwoXDkAYlKXgyauBVaUmdFsIQJ8UrTM8b+umdmGWedvSpzBkNMUI4mwq/sKsvHjh5bIa8/qSRJ/TNHJFjldwimq7aFxrwaYDYsZimJcigt/nYjjSX8DW4C7Z9uKJajyJYPZYUqiVGV9zQ== 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=JIx147d7ohHODebsWmO1tXe7G22bL6vSyWvpn4sgxVk=; b=p823ge5kmooMN/FIGurLMulowvW20Jw/kf4Nh/9BQA9wdPmDBtyNRo3Ss/Xzd+bz8KXGMZJadeS2Y0tI5WPFza0BqNZmw7FUi00LHUT12Yd8lrwzEXHCYRl5QJB9uNGgMsuUudUOtf+zzk3MRD53tT3eDQKq05DNyO3gKPhzOVo= Received: from DS7PR05CA0101.namprd05.prod.outlook.com (2603:10b6:8:56::21) by CY8PR12MB7413.namprd12.prod.outlook.com (2603:10b6:930:5f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:47 +0000 Received: from DS1PEPF0000E652.namprd02.prod.outlook.com (2603:10b6:8:56:cafe::ee) by DS7PR05CA0101.outlook.office365.com (2603:10b6:8:56::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.13 via Frontend Transport; Tue, 3 Jan 2023 22:19:47 +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 DS1PEPF0000E652.mail.protection.outlook.com (10.167.18.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19:47 +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; Tue, 3 Jan 2023 16:19:46 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 17/27] drm/amd: Load GFX10 microcode during early_init Date: Tue, 3 Jan 2023 16:18:36 -0600 Message-ID: <20230103221852.22813-18-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E652:EE_|CY8PR12MB7413:EE_ X-MS-Office365-Filtering-Correlation-Id: d5bf681e-9145-4de6-6c8a-08daedd89fce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GtyVaA7WE4/kCAoNZnqouN50TAW3xwcxZBIdMK49GFQT3dp7WaS+VSa+Z7eDZ32JkN+4CAeUE59fDfJddh5NOHqUdsjzG3Xt/W1/s6yE/+t2krP9UOD1o3hqfHVnvsCmnhI35bI4/NB5O8AN1O+0NZggnV0ntjpIIRew0H2/jz4Prgef/HCnmPfJr98MeaaxS0yiuSFTnhjN3JwKkquUfVrVkPyaElqITqXvoWk9eiHFFVyP2Y9BlelNU9RO0yGuylBoqKx/wxRu+zIBKoQE7RmwB9le+/1b7NadVnhKuGM39WI2HjhQitqk6ewi+Ach43Zg4Gh2t8rL1WiYtLZigzFLNS4IvJCmplRJ1qn+TNoCKyDeJKRblmnUt5HfrRbMUXxI9KJaxhDWx+OQewqwtkYrQGLbOKzq+RS9Ct6bI47w7mDoh/ui17TnQNBMzRx6gpEzP0KWzuU5yvOzZDg2ityram6exi7gjdo3If3qZl59phTYYHwvnxd39dfz+srXtxnla9fT0V2XWPtc0lT8TXTMNXtdGqPuJl9iFxihvGhc7kOo5yy7fdXOgr9PxS7MjQE176LOmNnfjkdqzO958pKjk28VyTf82LJX66V9MLJDOkoHZBwZh1aD5BG7Od4XADvsm6WJlb/Zw6JWd3krbX/+I6yUT4NfaLolEeQ9V5vDdmEXJkQIPa3En3pRD7zk9gn/aC6Mt3B0AIicsPDUCsSOXXD3k+E+E05iXdV47eX0YYLHBnM2PvcoXvH7OBciHrgo9KWkpjXq/xbW8ubdhQ== 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)(39860400002)(396003)(451199015)(36840700001)(46966006)(40470700004)(83380400001)(47076005)(426003)(1076003)(16526019)(336012)(26005)(82310400005)(7696005)(6666004)(40480700001)(40460700003)(86362001)(36860700001)(36756003)(81166007)(82740400003)(356005)(2616005)(186003)(478600001)(41300700001)(8676002)(4326008)(2906002)(5660300002)(8936002)(44832011)(316002)(70586007)(70206006)(110136005)(54906003)(22166009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:47.5389 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d5bf681e-9145-4de6-6c8a-08daedd89fce 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: DS1PEPF0000E652.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7413 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 --- v3->v4: * Move out of discovery into early_init --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 82 ++++++-------------------- 1 file changed, 17 insertions(+), 65 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index 5f6b59e23313..75781722c7e9 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -3974,9 +3974,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; @@ -3984,71 +3984,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_load(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_load(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_load(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_load(adev, &adev->gfx.rlc_fw, fw_name); /* don't check this. There are apparently firmwares in the wild with * incorrect size in the header @@ -4067,14 +4027,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_load(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_load(adev, &adev->gfx.mec2_fw, fw_name); if (!err) { amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2); @@ -4083,6 +4043,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: @@ -4251,19 +4213,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) @@ -4631,9 +4585,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) { @@ -7611,7 +7563,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 Tue Jan 3 22:18:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088074 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 93108C5479D for ; Tue, 3 Jan 2023 22:20:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0FC9610E4E6; Tue, 3 Jan 2023 22:19:55 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2053.outbound.protection.outlook.com [40.107.220.53]) by gabe.freedesktop.org (Postfix) with ESMTPS id 86BD810E40F; Tue, 3 Jan 2023 22:19:50 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZGznlCaSfMTPhGUdX55xr9X/qISKyMUvQAlvKKVgS3Hz1P+jT7kW6awGqqlJJIaK+DZBVOViKcOzEg90Jzcs5pItXSB9EuS5lXCqkHeT5g3j1C0TLCJzwhB/gFbMY/0K/iwfJ/dNMgKS1tuQLcMtEjF1GBGus5O718TF/2APZlTMsqo5nJ/YSTf3P2t37hCIOyXSNcXfB4hA8s7OIlZOpppJDWB80A1l/YM/0Qoba4HnDW3+0qYy6tihZeJDpExB+r9VY2esjDD/eNZt3tczELG6NaGUaamOYdhARA4m0WuNiSEYCHDzGCTLEXBFSQ0HhgVe2oNBHai5fCZcnW0tnQ== 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=Yv8pYRi7Zez2kDJHX6DDFMxMA0cE2AkRLddJELdmfrI=; b=EMOPkH1Zih09HTIDl1jXyHfuM8eGtHV9oIlzPmPrhMd/txf2Q2ABAz4tRFpKoET9SqMPCCNDZWOljIV0+F8Rqv5c8OE8b4dTjMWYNImpnUp78xP07YTwRankn6AL6Mb+5cLoKOkKHythirW7z+B/xiqObWmO18mN0zoQy+7g3I+dE66IpUVFB+spRoAqSL/OuldUJSRKULOeEIT2HrC7kjxtBH+zCg6dhsO2BVO97b2l6MW75Gh4zaDSQ5K1KhP/mXcMEwrfor/tEGEMbAq5SbVrpcmL0UNGztrkC4RlVjNUa0pnN6IofxArozsOJVFvSCzI3PkLfJqyCUVsIr7ZWg== 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=Yv8pYRi7Zez2kDJHX6DDFMxMA0cE2AkRLddJELdmfrI=; b=0INXcLXfILG2mTSp0H8Utgn6Bj79nDT90aghY+lpMVWteeGJgyuoEo5qnR2yrnXaTStkA70Va/Owf+eNdtWnbjrxN4P+P9uNPmSNZ61WiJb98gfqr1HVBd3VxXN2RZy+uXn6DUd8XGCmZSgcUupnSwO9pOcjh0xYWpdUkBfpv8U= Received: from DS7PR03CA0198.namprd03.prod.outlook.com (2603:10b6:5:3b6::23) by SJ1PR12MB6146.namprd12.prod.outlook.com (2603:10b6:a03:45b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:48 +0000 Received: from DS1PEPF0000E64F.namprd02.prod.outlook.com (2603:10b6:5:3b6:cafe::30) by DS7PR03CA0198.outlook.office365.com (2603:10b6:5:3b6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19: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 DS1PEPF0000E64F.mail.protection.outlook.com (10.167.18.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19:48 +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; Tue, 3 Jan 2023 16:19:47 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 18/27] drm/amd: Use `amdgpu_ucode_load` helper for GFX11 Date: Tue, 3 Jan 2023 16:18:37 -0600 Message-ID: <20230103221852.22813-19-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E64F:EE_|SJ1PR12MB6146:EE_ X-MS-Office365-Filtering-Correlation-Id: 19f592d5-5c8e-4ba6-5f72-08daedd8a065 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dxFj9yqRAioliMfQ1sSBnUvR0kwE7W8rTcmMlLlfrdXDRyj1jhVOz+Aq3voDfpUDhNm6sdCUrF9xAxCDaRWnZ/DXOwCUgx7jGGRdQ7X8CUt4jeLtCrlvluuXQAbxqD7PjpY/3P/2bxN9fv/BQElve7HmUIxMZX3vIvvzKdlQKedq8b4n0GrqCMZs+I/V7HhNCSTSi54gxS0uP9s8bjXt9YQx6r3SYZfcRsPJktCamrhRgjIqbxqEcO2+8MpQ3l7zXXoFQaEq8scHTdwKtff1wRH0YsWT+tXHa40MSTLE4Xldo0cCgcNhI1q8ZAYUCSS3zCphq/WfyiZMp02ObFmpI2heJEdrOkYeJ1e7R4YmIQFynee6F9vxEQ8gsr19MgPev1D/BtU6bpR0KmuN/4pDLgQ2tYY96gzDikhzki9guH76bX0iPZy93XqG46CRpSxb7gRzSd8UANPquuUZlpKVUsZuI4A2sdXTdBSOtVpa9jcwD+mfiCFqLl3Ar/yoFUISA+mktzMinQKGz51sH4/ImTNITyen59KuQTbcC+h+4N75jPBVt4ZyVsKfOF4x0TGEOormBGtMbwH7g49Ld3l8akc2DKr/h+wIFkG9rSxTLbpRJhzI3sls6g2tr/lcrQxr/Uj0TQntQjI7BwN5eNFHYFaMKluku980tz5p6J8QPKheA8NioyLOiyagcrVyUXWdn0iMgcmNqigX+qXl2Yy4T/T1EORUG5yhQ8zQjzlG2YKk8EYAOypQxCi+jKruPsB+VijZxmlst+ARSSxCR90POzb8W835NjH7fnaSriWBQZU= 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)(39860400002)(396003)(451199015)(40470700004)(36840700001)(46966006)(5660300002)(8676002)(4326008)(6666004)(70206006)(70586007)(41300700001)(8936002)(40460700003)(316002)(54906003)(478600001)(110136005)(2906002)(7696005)(356005)(81166007)(82740400003)(2616005)(336012)(16526019)(26005)(47076005)(186003)(426003)(1076003)(36756003)(40480700001)(36860700001)(44832011)(86362001)(83380400001)(82310400005)(22166009)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:48.5438 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 19f592d5-5c8e-4ba6-5f72-08daedd8a065 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: DS1PEPF0000E64F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6146 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_load` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. Signed-off-by: Mario Limonciello --- v3->v4: * New patch --- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 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..0c77d165caf7 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -457,10 +457,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_load(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 +474,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_load(adev, &adev->gfx.me_fw, fw_name); if (err) goto out; if (adev->gfx.rs64_enable) { @@ -493,10 +487,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_load(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 +499,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_load(adev, &adev->gfx.mec_fw, fw_name); if (err) goto out; if (adev->gfx.rs64_enable) { @@ -530,9 +518,6 @@ 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); From patchwork Tue Jan 3 22:18:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088075 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 B1FE8C54EBC for ; Tue, 3 Jan 2023 22:20:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 74FCC10E4EA; Tue, 3 Jan 2023 22:19:57 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2052.outbound.protection.outlook.com [40.107.244.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4FC9F10E40C; Tue, 3 Jan 2023 22:19:52 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WjL7Tbhdwc5csaOQBuDiUrPxULAJWMj+9HcIiauUdTONptpqJDQ42YVlAgJg+VmrCCY23W4BR38sPBUy37UyHEPNzpmxRXWByRycguCBDJZhXFGyE2paIKknpPGhTjKuq2pxC4dZEOY6fbdTF4ny6a6xX/f8tJbBX3TkJrPt8d8JMQ/6ck0UI38mLqSlvdCi97HIHV7mAUSwS0wyrs9AVS2CN9jrUec17CPugMsjnpqMQzqiDIHn5oyLVamlqvcHdLVaZMHQNX5LHRkVzIDqSLDWVaE5QXE3CdyXMEL6WAvHNFEonneFK9bb3xlOLd/0DcdwLRufafMulECMmTbtOA== 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=bS9BGl34vTdY68SkfkquEF1Blr2spVYUV1YH8Wr8wOE=; b=mkEkzp0/S5zfApsqrxdc5prEj/Ih1mRMBHIdkEsy1oq9QiNnisyqFNtbPoTmCF/cP+zYNj/HohXQjNgLfn7ZRk4aQhR7zPaFrJySwiN9twYH8ErKn30/OOX512aDY4MG0xgerWKJKlE7EHrB0lVnIYLTuHrNSdzVMjBRjxpapEObZrR0znajumYLRF3xhhpBW12AaF30tZib0Bh4CnUO/rMPgDTP7ZM329aRs/lpdCteW7gQA5FZmLyd6bl/F8VkN5JYPKVlqwwy6r+yq5fwFM6g05GKKAH0K9AN6jrwbdHR572qpMiRM143l2HVuMPGmHMEBAMZcGRFcCTfTsWOwg== 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=bS9BGl34vTdY68SkfkquEF1Blr2spVYUV1YH8Wr8wOE=; b=wjErzq9+fv2Vo3qR4pn0k4zZJhm3KpQao/SzsaMrT9sK+V4n4eF4tdMxbSMyXmQ+rirKy3sVdLefEZzvs0Az5+lJBhJyyuHorc5sE0d7Pt+NYHimDbb+JOAhjbfrvlXySmMhN2BnYypCdj7C4usJW5yxCv5byo6wykT9GLZTLMo= Received: from DS7PR03CA0333.namprd03.prod.outlook.com (2603:10b6:8:55::15) by CH0PR12MB5385.namprd12.prod.outlook.com (2603:10b6:610:d4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:49 +0000 Received: from DS1PEPF0000E650.namprd02.prod.outlook.com (2603:10b6:8:55:cafe::9e) by DS7PR03CA0333.outlook.office365.com (2603:10b6:8:55::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19:49 +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 DS1PEPF0000E650.mail.protection.outlook.com (10.167.18.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19:49 +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; Tue, 3 Jan 2023 16:19:48 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 19/27] drm/amd: Load GFX11 microcode during early_init Date: Tue, 3 Jan 2023 16:18:38 -0600 Message-ID: <20230103221852.22813-20-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E650:EE_|CH0PR12MB5385:EE_ X-MS-Office365-Filtering-Correlation-Id: c337a217-6027-4a3b-14e8-08daedd8a11b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F6kii1rLjwuqkZBnRqjETw3P1+YgKA16XAl5rb5JGhVC37zozfEXZMirOh365Tylt2SetpLFFIq18kLvAfsk2RX9R3TFZgeYduRCdiGMMR3cykr8HJW5spKvWTu4plsJHUkFGkzONHk9aYcFf+Lt/Sub3gZLbGt3hZY8Z5peUF3ozY4PkbDuXRF4j9v2k3zEdBDiyL9ZYaeKz5N2AR/oH/AoSP4Kqu9Gi3nMl7V0fmX2mEbbZ1zurh1wsUfANgkvGFC2wnCVexRI7xDKrjuMP6nCfmtOYKAtNtd5rgqMUvhk2/6XTc9d+P5wK5/7TXZC0ahe1QjIc4V7Q2C4usVUwS3a8MUSALO3UoL52K2XmhZMrC26pyyEhzFVZGTsSHbXKBHvl69eI/lYhPmh1WibNa0hGkkjosthSuENtCgcugiEJdImY2wJ1KZ9lk0cGpjs1RtFmq9KuBWQaWr4woGPws7uMWeP+81wi/qNTQPL3UfX5VJmVQCFn8MsmemuBootbwt7alnCUXvGq0LLiUpNG3tI1ELxZbi4QiQLu+QqM7tIU1nqoZxO+9kIMtnJC8ChqO2n0nKgC4rGj1ZjLMMvzJ+7p2A2QAyEBefrUP3mYBNE5wAHCtf2xFUm3fAKkDNGaH8SVWxFKba+kPJXfyjGadMsKa/+8bdirVihiKWSgDJFa+JaRo/X0XYQomh7rsZKtnhFwMZ828EphhLCYEmsxkYaPWMVx6vKtnoq60E0QIfn1MV5qJd9gInBfCxGbCZk 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)(40470700004)(36840700001)(46966006)(36860700001)(426003)(47076005)(83380400001)(82740400003)(86362001)(2906002)(356005)(8936002)(44832011)(5660300002)(41300700001)(40480700001)(7696005)(336012)(82310400005)(478600001)(6666004)(1076003)(26005)(2616005)(186003)(8676002)(316002)(16526019)(4326008)(54906003)(110136005)(70206006)(81166007)(70586007)(40460700003)(36756003)(22166009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:49.7346 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c337a217-6027-4a3b-14e8-08daedd8a11b 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: DS1PEPF0000E650.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5385 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 --- v3->v4: * Move to early_init phase --- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 78 ++++++++++---------------- 1 file changed, 30 insertions(+), 48 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index 0c77d165caf7..5c7bc286618a 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -443,6 +443,30 @@ static void gfx_v11_0_free_microcode(struct amdgpu_device *adev) 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: + release_firmware(adev->psp.toc_fw); + adev->psp.toc_fw = NULL; + return err; +} + static int gfx_v11_0_init_microcode(struct amdgpu_device *adev) { char fw_name[40]; @@ -513,6 +537,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; @@ -531,38 +558,6 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev) 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; @@ -699,19 +694,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) @@ -1324,9 +1311,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) { @@ -1394,9 +1379,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; @@ -4665,7 +4647,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 Tue Jan 3 22:18:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088078 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 BEA61C54EBE for ; Tue, 3 Jan 2023 22:20:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1EDD010E4E8; Tue, 3 Jan 2023 22:20:03 +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 DC35310E4E7; Tue, 3 Jan 2023 22:19:56 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NmWw6YlwniB+uGrtOXhy6vJ3DjaEmVoqwlXz4zab8eqlSacDEagQ96fhaVbIIvryrQDdCcoF7wpAIZsdZniUMN7smpt0+V1Ab6AZ9ClxWDqRK0D0Lvgrl6cUu97lYfk75QIM9mlUT5auzhVj3aOzI1dg5Jwh8PPWGYS3X9uU80G17r1lTwXPOr2pZm/p6JmNZjp648vNjJiBEIyC+Qbyb8cn1dMTVG4rs3NROmtU26A1u5TN5Kwv/IE7DOigzUgOXGG0tiUrA7Elm3oo/JOOGoBLza85U4dtdI+8XOFvx2qOAOb1ndatAuqQW1CESxaHVOdigxPd6s+n9BuL4HmUeA== 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=cQtdTrMItagHfjCSWNeuWFYzCeL7L9kfqlhfEkaLEQ8=; b=ZoeGZxsPWf5wCGyqnq74SGJfPGlTj/UXBL1l2f8OD4DcSVbrJA4YTMeFhThLK7r2VpfMOj5LIBhAnz2CQIsiZ862M4q0ojcaH5+NhVh9qsFDeWbFxevU84YAZrnnfnMfiWW8f1/9T6pgWY1Q4Rans9yqFLUskBFmpL4Yt2kGPZ7DuvIb0nyCJgiODch7CvxNT0rUNMnMhK1YzXyB632paFxfqGur3Vi1s0tQd1F/IXbKwZ94s+d5Q7gNQ5qC/GIOIby8JM7ZjfSL9isrfZpqcI79vxksCpoRl5Dow8QxgcZzVYI1EPfo5BhdZ9Pp3tnPumYcQkrj34oNh9mz6XXulQ== 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=cQtdTrMItagHfjCSWNeuWFYzCeL7L9kfqlhfEkaLEQ8=; b=K9qJnyWasmyLHU5o2ybXMJiG0MoH8CYeIONOHgn+xtBTbuW8KCxTTJlOof5HODJB/OA0bW/zXULLPj5c4Yux49Jbmvuz3h0uLmvoydkAhYqLW31DOM4FrIBakWZZSqu6LoBFgRHppqPFJJUDn/nrpM2m69KsN/V1YPf5Q4N92fI= Received: from DS7PR03CA0132.namprd03.prod.outlook.com (2603:10b6:5:3b4::17) by CY8PR12MB7610.namprd12.prod.outlook.com (2603:10b6:930:9a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:51 +0000 Received: from DS1PEPF0000E655.namprd02.prod.outlook.com (2603:10b6:5:3b4:cafe::e7) by DS7PR03CA0132.outlook.office365.com (2603:10b6:5:3b4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19: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 DS1PEPF0000E655.mail.protection.outlook.com (10.167.18.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19: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; Tue, 3 Jan 2023 16:19:50 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 20/27] drm/amd: Parse both v1 and v2 TA microcode headers using same function Date: Tue, 3 Jan 2023 16:18:39 -0600 Message-ID: <20230103221852.22813-21-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E655:EE_|CY8PR12MB7610:EE_ X-MS-Office365-Filtering-Correlation-Id: c1ed5bc0-7ad1-4015-e8a0-08daedd8a21b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Axo/Xur55rmPTt8D5clOea1LIoohDuz5iU1qCnz3azVH6t4ZrRokn83m1FDuemb96JIwHvA3+BrSrlX2EFmBkqe+/iYpTdBrs9TqnXXUCkcgZdWIsujE90eHJYpjiLT9govpSmjzncZ7bbkKnVVkVJlCp7H4+ockzLIpMO+6l8yd0CsGyACyH4MB3xcC6jNVLhG1YT38jhZU1LKd8Gx2QLTsKx4GApO1lQrx+EE96eDJwBfKHBsrHti1kBzAR5taTWMw4TINL2fl8NYxDzTDnsdVgY4NQKnoLltZyAZRPNyFu2kTdXKyArhnk9T4Tmtaom3/a0TM8xNjEf8C6Qx6ZSn6wrLX6iqDU5bM/PVGrIZshdVZ/7GR6J64sTWAM1RCUV+y+BNl9KYp3nWYywBpC1m0lStcmq4atRvyxkrGEN+LSLWbadfSZDa0BXmB3vN0FUpl5BgRhA7tGQKYsX9myoyE8ZhdrlmOiHPbeDv0AvMwd+DO6xRuHEIAT3AEgzNg5VEi+IluXB7+JE2DWXq+ae0prM3Hh9x28FXUK8RbFocpPXMW8Xd2GxuUAFhVrT5Y+lsxKMe/LGydJq/ityp8aJhB1pbvdtvdgF/QU+toTWXBTJFvtK6sZ5BLdcPz74HoI7Ipi6eoE5uDDPGPrfX69U8VkzZdtKeBWuf9XtLeh8H+MQSMb07DtiEsQMmiNHwWkTy0CSSxUzjlck1G8luzK2k2n2Lag0twTTuJtRvhH7fFlss+qSN7EyBv7FUfoinX4GiigINvH2y7N8sz8HdifA== 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)(39860400002)(396003)(136003)(451199015)(40470700004)(46966006)(36840700001)(16526019)(26005)(83380400001)(2616005)(82740400003)(47076005)(1076003)(426003)(40480700001)(86362001)(186003)(336012)(40460700003)(82310400005)(356005)(36756003)(81166007)(30864003)(36860700001)(478600001)(2906002)(110136005)(54906003)(5660300002)(316002)(44832011)(4326008)(8676002)(41300700001)(8936002)(70586007)(70206006)(6666004)(7696005)(22166009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:51.4022 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c1ed5bc0-7ad1-4015-e8a0-08daedd8a21b 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: DS1PEPF0000E655.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7610 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 --- v3->v4: * New patch --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 120 ++++++++++++++++++------ drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 9 +- 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(+), 218 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index 7a2fc920739b..ac4d675abcb5 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, char *ucode_prefix) +{ + 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", ucode_prefix); + 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/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h index cf4f60c66122..45dc370f96bd 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h @@ -502,14 +502,7 @@ int psp_ring_cmd_submit(struct psp_context *psp, uint64_t cmd_buf_mc_addr, uint64_t fence_mc_addr, int index); -int psp_init_asd_microcode(struct psp_context *psp, - const char *chip_name); -int psp_init_toc_microcode(struct psp_context *psp, - const char *chip_name); -int psp_init_sos_microcode(struct psp_context *psp, - const char *chip_name); -int psp_init_ta_microcode(struct psp_context *psp, - const char *chip_name); +int psp_init_ta_microcode(struct psp_context *psp, char *ucode_prefix); int psp_init_cap_microcode(struct psp_context *psp, const char *chip_name); int psp_get_fw_attestation_records_addr(struct psp_context *psp, 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 Tue Jan 3 22:18:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088079 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 DD970C54EBC for ; Tue, 3 Jan 2023 22:20:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D54F110E4E7; Tue, 3 Jan 2023 22:20:04 +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 3462E10E4E8; Tue, 3 Jan 2023 22:19:57 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TdbWmP7eNHZh206JCK5pX556rzW62g610JKSTWshi+LuTSsFkOHgy5BbiEflYhjgTeaCxEN2SkGMkwsHi2uoLPPGpUyiE9R5lrxxjD57nhCMPxP7scBFU6BnTwaacNTjt7Htr9VKmMbrD9C8d2rSjNy1Py9700RIrav8IsnoYoTJgcDwTR33O5vNitJccz/Zil1XKx2usnu+fRLQ6A3S77WPgwOEmJiWOXWyy1B3EiChf6XeH8QEff5xPh5FDiatWFF4thIBw08U6Xv8p6W0n7SZ/0mpaBEhpvDdWC6nxhqZIRtmELwOwK/cJ/2eSC5NB/DT9QcNHJjHRGunfTQ2sw== 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=mOjAalb+TvZZkuEzWbDBYYoPsw1Oye/rfZgv+ScvIuU=; b=RFCeki5iHYoGZ7UAQSmmJiEDHyDgWzvViaCWoTKhEk7ofOm46eC6XIB0JLwmrwkwQwO14BzpR/HIEPrNKa1KcIlkY2VZVLhyGxyZr5t/stcRB5et0XHN8DAjEixmmKJabwaohCY2P8A0skZlP+HN/vhxhf1Y33qMzqd/iQ3bGC1valllIucmKMQ3vpmkc567jzvqIr0+cd46z7AH3yLv4hi9Eo2h9QG3ILjKSX0/VkzN9r1KCOBhuH/TIaXxsj+qZbBPYEZtSXBw06vYm76PpdGA2hGVRmE5r4qpv78RGopPNfWQeGAvxWdJXjbAE233z5ofyps2hyEA9s4XOm5Siw== 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=mOjAalb+TvZZkuEzWbDBYYoPsw1Oye/rfZgv+ScvIuU=; b=IG5RIOwvL/eClZ6Y42ztc+bfm1VZtWyy/msZA7+g7LkbZmGEiOioxjFRwhNNyyPyh7icw4PTf/ZZtXpYDmY0Tm61bTV3xVbqdzRVnXvEjMFVHVfaNU9EOsfLCCZ2zOdMadqblr++mTc6jSRWptUPCm4kH1J1PmNl8Dm6lMhlFM8= Received: from DS7PR03CA0140.namprd03.prod.outlook.com (2603:10b6:5:3b4::25) by MW4PR12MB6973.namprd12.prod.outlook.com (2603:10b6:303:20a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:54 +0000 Received: from DS1PEPF0000E655.namprd02.prod.outlook.com (2603:10b6:5:3b4:cafe::2f) by DS7PR03CA0140.outlook.office365.com (2603:10b6:5:3b4::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19: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 DS1PEPF0000E655.mail.protection.outlook.com (10.167.18.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19: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; Tue, 3 Jan 2023 16:19:51 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 21/27] drm/amd: Avoid BUG() for case of SRIOV missing IP version Date: Tue, 3 Jan 2023 16:18:40 -0600 Message-ID: <20230103221852.22813-22-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E655:EE_|MW4PR12MB6973:EE_ X-MS-Office365-Filtering-Correlation-Id: 2c65857d-4aa5-4916-4bb8-08daedd8a3a5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OsZEAW0fkfDbbP/XQ04r90EwrVIi7lvHUj+kdgcJse6VdXiwhEhcwQPEqF2BN6fm/4bVhKuFdsortHh4Glj+waZj7OTRnmxRSafo0PheOz9/gIV+8mw+rUFVa51prPXk/FhHTQgvlz1rb7rF6WP0i8ZHNgYsPzdeslYNi97f8Qx+YMQ6UMRVmyVFOZpA7t5ItLee/jPYd1OkL4pD33om6Nu8ynePSf2RJIzpzZy6xnBWlOGvU5c4ciQaz1dTTd6xGL4YlMPsh5HFBs5g7BHHYG+n2DyWHonUgELhqTaS6rhzKj4u28/MJCoE1+RLgNbZm+oPpqlZAOTVB2IFPtf6HIbYfZgJMweoQIcAOimxgYbTC4fiJ+J1jNnjNFdbwq+r73i0k2R54QxYSjnIPF4ryXxOeFFxiW3gwTZg9/4blnciKJTLTdby9yyyUXUD+ibhks3yheW8dqXfDUSAQtp1m0jW9tNh4Tzixxfve1Lw/o1lrIm+xZbtR+KmMx9rZzlExRL1LAzYGe1UJPjFg5aeOyOXYfwH6BU+akN6Kqkx99h7yirgvvjFAyQ84Zwrs+FQrvL6mw/vRKb9VTunRtIKei64RiAOpvCa4mnBJnfkrV3OTIxLG6BB+MmBAIPr2VbYOPPdusdtTEXqNTuJvsB49RafdgO+zw4xurHo/ZGqS/DfBifVTH+1Dld9SOUX/3NVJPdZry0UILDDy/XTn1u8Ukq8kT5PSds/WGt6q4DK1FBSkoaUB5lV6zbbbFYwnVGe/vabnXgN7GSpsi3sLvF4bQ== 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)(8936002)(41300700001)(8676002)(4326008)(5660300002)(70586007)(54906003)(110136005)(2906002)(316002)(70206006)(7696005)(26005)(186003)(478600001)(16526019)(6666004)(44832011)(40480700001)(86362001)(1076003)(36860700001)(2616005)(83380400001)(47076005)(426003)(336012)(82740400003)(81166007)(36756003)(356005)(4744005)(40460700003)(82310400005)(22166009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:53.9646 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2c65857d-4aa5-4916-4bb8-08daedd8a3a5 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: DS1PEPF0000E655.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6973 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 ac4d675abcb5..d51fe3431e2b 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 Tue Jan 3 22:18:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088080 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 10360C3DA7D for ; Tue, 3 Jan 2023 22:20:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5CA1A10E4E9; Tue, 3 Jan 2023 22:20:07 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2089.outbound.protection.outlook.com [40.107.237.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6C43510E516; Tue, 3 Jan 2023 22:19:59 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kQDXNWDAflGpMd3I+wkNZFeqHKboJ6svuEyOkjYH2C2d+MgR3nThBS6ENEpOUKA2a/NHXpHIIQMCvBcpQRQ9CRQDTvJDqhte6ncglC35uNVMo/VWVhmNnh1AhlY34XLDJBcwxHQdj2lTuBuujMkQ3sLdOQ+XKb1+BHr/ugyeJBqBtmn6h26faS4Pj3ueqELG+CpDd5D/7tdIJVW47MflopKp8heXBuoyIbwxab8XLhaz6BEGkNWm7rhdLcCCESm5KZJ2uOTbaCdBarh6uZVrdrLJDrOef+SZVWn8R3Vwfk0pS2eSaDpo+AOazQmwSJX0W8MK+QHTgEROGlT1vmJ28w== 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=hXh3VDGYaLQeQgWTLd4QjqvHzaHoWsTUmMVzn4nI92s=; b=alFC7tgv8ARV0YBPibL7OCrr7x/Zn/HXrqyidxiOdcVL3CwM1QirS7jel/pfVQjvNJaPjlkeyQpmoTsTzOGCh7p4jQh1jrmElGDFlgDZD3eXc8bYf84VHa2RHccZ1lg2iSxmB0QLp7dimYReiDl4sAnimngxtEER4lEBJM43KXhZh2bB5pe+cMyd+v2SSDmCxPGkZjHQ7Ah/3KiKzAKCrvyPtRqo1+j4jkGG0Gxx+H3OId4w+EI7lZnwjKVLeaO+DD3OO8cVMCKj9BWAd0VexlZt6NsPSk1Ir19UU9jwbtk6iEzkgkza6IfguqNBiN2vjeMP5NONqKL2ALmc4VxiUQ== 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=hXh3VDGYaLQeQgWTLd4QjqvHzaHoWsTUmMVzn4nI92s=; b=JM2UsyBfEtY5XW5ORm3vlyHwq4BMq4ZofwbnuZiTstpIZ1Y070/INzVNaNvgEKAbBtbJ9akgeJoTtMbZ2luVPvt4JPEk7LjpfyzGdB933lJEIe6PTiTESU6uK9gI66b+af4NSUEUo5Y+8MWV3mPajHynV2u5evxaMgM/GN+3/sg= Received: from DS7PR03CA0145.namprd03.prod.outlook.com (2603:10b6:5:3b4::30) by SA1PR12MB6945.namprd12.prod.outlook.com (2603:10b6:806:24c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:56 +0000 Received: from DS1PEPF0000E655.namprd02.prod.outlook.com (2603:10b6:5:3b4:cafe::1f) by DS7PR03CA0145.outlook.office365.com (2603:10b6:5:3b4::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19: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 DS1PEPF0000E655.mail.protection.outlook.com (10.167.18.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19: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; Tue, 3 Jan 2023 16:19:53 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 22/27] drm/amd: Load PSP microcode during early_init Date: Tue, 3 Jan 2023 16:18:41 -0600 Message-ID: <20230103221852.22813-23-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E655:EE_|SA1PR12MB6945:EE_ X-MS-Office365-Filtering-Correlation-Id: aa160586-66d5-49bd-b022-08daedd8a50f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UP7P6ufxzxKWw72U7pQ2XBkuZnbkgvw4miTTJOuxS4mMUGBFBMTtnd67Xwj13cuikQz3rcB/j/EKuFvQcesqjSuzT9hfRJqBZqzi8mQxvsh9xSjwl4GqSc38Z44PLW1/ZKSUYT+kRR+BUL3aZJ//CI0/8M/AUwikE2AmxAu+kubQBqQuyn/IEl9ENW52qKos4VHfMGCX6gLewQIeFOJQmjfvhPF/eRkACNkpL85dPBzdC0u9bPJ2D52bw16VpDpUUEjFhzCnq6Bttq6RTJN1jFGYGI1sRCwzGpBfqKaSsqKuYzkJVqumG/4QaPQwokS7DRd4P1uapjTzdZJzX+iyIfaNVaShSrfONhIPX17pVJpbC8s+0w55V8Qfwp6CcjVWw7TucD5/wa7JMCZZrvc/82aPgzTKGpcxZDCZLslhoK+VjgYJiRKABO8p3PtU9YqBPqJqpM3Y8yPge0LsCU5ttwqWrnDZQ+UmniPQU2RJgnZW1fq5RCxfM/TzBRm3C/wFjoUqWc1dPJ1cYPMOqYGRqmKg0O8A8zf1tMX8AEGDPJtN1iyfCyqRWb7Z7E71cKGcvQCL7MZfJ6ZevA1hpF2dvjI/M7/cbaT9VxWPThNVxARsabLEPhj6381tmuqZEDsC4/s1xBOMKyPlgHn9egPP+V+jHX2caeWGwIZynNw5u5qmnR2uXHhmiW6VMauk+WB16EpPHDMWvBpTJzaV5Sb/LAZWTYNEJ8tzHF2oZQ9KtYRI0CicxNWG3CZodC/2Nj/O3fe5MQN7DA9uf4nPOP66lg== 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)(136003)(39860400002)(396003)(451199015)(36840700001)(40470700004)(46966006)(16526019)(6666004)(26005)(186003)(1076003)(2616005)(7696005)(478600001)(110136005)(36860700001)(70586007)(70206006)(8676002)(4326008)(41300700001)(8936002)(47076005)(426003)(336012)(30864003)(83380400001)(5660300002)(2906002)(44832011)(40480700001)(82740400003)(356005)(81166007)(86362001)(316002)(54906003)(40460700003)(36756003)(82310400005)(22166009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:56.3553 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa160586-66d5-49bd-b022-08daedd8a50f 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: DS1PEPF0000E655.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6945 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 --- v3->v4: * new patch --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 128 +++++++++-------------- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 3 + 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 +-- 8 files changed, 79 insertions(+), 193 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index d51fe3431e2b..3b0644600a1f 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,20 +2904,14 @@ 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, char *ucode_prefix) { 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); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_asd.bin", ucode_prefix); err = request_firmware(&adev->psp.asd_fw, fw_name, adev->dev); if (err) goto out; @@ -2944,20 +2934,14 @@ 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, char *ucode_prefix) { 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); + 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; @@ -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, char *ucode_prefix) { struct amdgpu_device *adev = psp->adev; char fw_name[PSP_FW_NAME_LEN]; @@ -3121,12 +3104,7 @@ 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); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sos.bin", ucode_prefix); err = request_firmware(&adev->psp.sos_fw, fw_name, adev->dev); if (err) goto out; @@ -3391,8 +3369,7 @@ int psp_init_ta_microcode(struct psp_context *psp, char *ucode_prefix) return err; } -int psp_init_cap_microcode(struct psp_context *psp, - const char *chip_name) +int psp_init_cap_microcode(struct psp_context *psp, char *ucode_prefix) { struct amdgpu_device *adev = psp->adev; char fw_name[PSP_FW_NAME_LEN]; @@ -3400,17 +3377,12 @@ 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; } - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_cap.bin", chip_name); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_cap.bin", ucode_prefix); err = request_firmware(&adev->psp.cap_fw, fw_name, adev->dev); if (err) { dev_warn(adev->dev, "cap microcode does not exist, skip\n"); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h index 45dc370f96bd..47b88233bf94 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h @@ -502,6 +502,9 @@ int psp_ring_cmd_submit(struct psp_context *psp, uint64_t cmd_buf_mc_addr, uint64_t fence_mc_addr, int index); +int psp_init_asd_microcode(struct psp_context *psp, char *ucode_prefix); +int psp_init_toc_microcode(struct psp_context *psp, char *ucode_prefix); +int psp_init_sos_microcode(struct psp_context *psp, char *ucode_prefix); int psp_init_ta_microcode(struct psp_context *psp, char *ucode_prefix); int psp_init_cap_microcode(struct psp_context *psp, const char *chip_name); 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 Tue Jan 3 22:18:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088082 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 040DDC3DA7D for ; Tue, 3 Jan 2023 22:20:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3BC3410E4F7; Tue, 3 Jan 2023 22:20:08 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2052.outbound.protection.outlook.com [40.107.93.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id A060A10E51D; Tue, 3 Jan 2023 22:20:01 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TmhlLcTRDiCckB7bctzGSC9gCyIF7QfJRn0zfLQUe8/DCHumnzlMz/kMVPkvhEBPSHtjbwEWhIi1nJd8aZ/vSY63LexY8ialGkjzoVoILxt5Ua+sm3jHBYuau1PdAQEC8yR+238me0bP3zOYcnra1PNE73smP8YT4VMkJ5sTNc0CrlZd3tiONppb6ZHNuEOhs8F+hn3bbq4zpzkZOxZAh4JflQ5AltrWc25JfTHS1q+LETv46ilbNgI1mHSUuKRHqZkKgxu1EcDV4IGXz1qYQSgnJumD8XFsouCA1Bw7Y7hvxezWP/SMBq/dLixdGq6pu2HZtQe/d4vtpQv6kcxWSQ== 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=n4+KhdqZ/Akew/M2C/sT8R8Y9lB+yJHRXWRua6AdvLM=; b=EkouZru4IsIrqB8sJCYwg9lPp5GS8SCnETMOEEp7f3QT0tEldBoEed4QfTM0E8HCeZ0cn3Vllr3hL0Lug4iJd9OHQjbcOzewyVCxjA6p+Ot6P0dB8rJANrCKb7NQ6B9BEnp4OpJ7nRRnFfzGsdDkaUl7XhFlfQ0Hocfm/BqZEpLUQFQpyO5JFM5lhzkrXzBC2GLDoLL1u8X4O4Y0K6up0tlxExrc2ZS6TsG93YF28zw+LsEnG7SEzHTHjle2uUzoing88EnlwIlDck98hZn4oQu3B/kSscvEhD1kxZSHRzJqal5oePcEQNhlY3etnRLC6xk0Cf3r40gg8MPULADAQg== 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=n4+KhdqZ/Akew/M2C/sT8R8Y9lB+yJHRXWRua6AdvLM=; b=kzT6hhY4F1ZOxFo13UqlKKhraYS/ZOtlVu25v5Mbkuyo0edKn17WGjgdadX1e8de1JUyszOQITs5WQTIP9297/T91qQ2u6x3yWKmMAF7f5YSuhsGd8P1b4UO/lAcvTUxFJnFpvUUF0Dx0/B+NODxxN3HJGP/voJNeglORrjEigc= Received: from DS7PR03CA0144.namprd03.prod.outlook.com (2603:10b6:5:3b4::29) by BL3PR12MB6475.namprd12.prod.outlook.com (2603:10b6:208:3bb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:58 +0000 Received: from DS1PEPF0000E655.namprd02.prod.outlook.com (2603:10b6:5:3b4:cafe::d) by DS7PR03CA0144.outlook.office365.com (2603:10b6:5:3b4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19: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 DS1PEPF0000E655.mail.protection.outlook.com (10.167.18.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19: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; Tue, 3 Jan 2023 16:19:54 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 23/27] drm/amd: Use `amdgpu_ucode_load` helper for PSP Date: Tue, 3 Jan 2023 16:18:42 -0600 Message-ID: <20230103221852.22813-24-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E655:EE_|BL3PR12MB6475:EE_ X-MS-Office365-Filtering-Correlation-Id: 78d94162-2469-4ef1-dc2d-08daedd8a640 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mRz/naK8CNonH2UzLJ8VMYNk5IAO3c6erHhTCYPkXN0JAjs8Yb4Fih35bth75kQGbv2xrTbaPP6w3Dqn1rec+NNPjlv64KQ8/nZm16Eg5XTBN29ylKnNLP45gbUD49t8NatpQAyicjpB+AnvOKW6lpTYI6v7RNf2b+70XWgkjmmAcoG6vyjTNbBUoOGUH9Gp9KH2t+hgq5BXXu+DMmJN/HjEzkUYJbRIv3lL8ZEkylKnOP8uaE/5fbEckJWhH9hP3dxZdqjm6dnH3DdzhNOadE17eveZx77kMAy9RYF1kDRgAYmH96D04N/b/p5Crd4uQ0UKK9g0u/2YZobGXhPwrWN+nsRJcQ7D13Jl74jb8od4e1hb47nrA9S4UHREg+7XPTARZ4GrfIerAi727kPjHIKIi3pTD+lncvLFVSf6RaLGUqmvLl8HyPjQ1vbQ3FtcdneKy/zPjrQu6Xrk3vH/JhWWBAkkUE1LcOQQAviABMjbybxfxszYmr5WvcEgVD+Xjj2DN3lC0kBuzK8LX6TVXv7z3QQtjAZMAyQ/Do7Euye6mFZyruqwu4/WTxYno3N6AIP5LmyFDlNQB7nBj5AXWFMXJCyS+HmRO1b4scszjGG5zKOc612zHGn/JO1pm6c5ht7dGG7nhB++LAi280fbSW/Pda1X2D76wOHWgVHRl+K7w6CjSs76XZMcyZQYkSvdZtr4K/IpPHqEoey9Me0mIyOQV0wwM4udQK6TII0m4q18L89sjF5MimH18sQ2BSIgm3JfQAtuur0kQrVEjFn0KO/5czsmDqJ7rNzS8PrIhOY= 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)(39860400002)(396003)(136003)(451199015)(40470700004)(46966006)(36840700001)(16526019)(26005)(83380400001)(2616005)(82740400003)(47076005)(1076003)(426003)(40480700001)(86362001)(186003)(336012)(40460700003)(82310400005)(356005)(36756003)(81166007)(36860700001)(478600001)(2906002)(110136005)(54906003)(5660300002)(316002)(44832011)(4326008)(8676002)(41300700001)(8936002)(70586007)(70206006)(6666004)(7696005)(22166009)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:58.3553 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 78d94162-2469-4ef1-dc2d-08daedd8a640 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: DS1PEPF0000E655.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6475 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_load` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. Signed-off-by: Mario Limonciello --- v3->v4: * New patch --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 42 ++++++------------------- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 3 +- 2 files changed, 11 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index 3b0644600a1f..f45362dd8228 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -2912,11 +2912,7 @@ int psp_init_asd_microcode(struct psp_context *psp, char *ucode_prefix) int err = 0; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_asd.bin", ucode_prefix); - 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_load(adev, &adev->psp.asd_fw, fw_name); if (err) goto out; @@ -2928,7 +2924,6 @@ int psp_init_asd_microcode(struct psp_context *psp, char *ucode_prefix) 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; return err; @@ -2942,11 +2937,7 @@ int psp_init_toc_microcode(struct psp_context *psp, char *ucode_prefix) int err = 0; 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); + err = amdgpu_ucode_load(adev, &adev->psp.toc_fw, fw_name); if (err) goto out; @@ -2958,7 +2949,6 @@ int psp_init_toc_microcode(struct psp_context *psp, char *ucode_prefix) 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; return err; @@ -3105,11 +3095,7 @@ int psp_init_sos_microcode(struct psp_context *psp, char *ucode_prefix) int fw_index = 0; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sos.bin", ucode_prefix); - 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_load(adev, &adev->psp.sos_fw, fw_name); if (err) goto out; @@ -3181,8 +3167,6 @@ int psp_init_sos_microcode(struct psp_context *psp, char *ucode_prefix) return 0; out: - dev_err(adev->dev, - "failed to init sos firmware\n"); release_firmware(adev->psp.sos_fw); adev->psp.sos_fw = NULL; @@ -3340,10 +3324,7 @@ int psp_init_ta_microcode(struct psp_context *psp, char *ucode_prefix) int err; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", ucode_prefix); - 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_load(adev, &adev->psp.ta_fw, fw_name); if (err) return err; @@ -3383,17 +3364,14 @@ int psp_init_cap_microcode(struct psp_context *psp, char *ucode_prefix) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_cap.bin", ucode_prefix); - 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_load(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]; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h index 47b88233bf94..415d32306b9a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h @@ -506,8 +506,7 @@ int psp_init_asd_microcode(struct psp_context *psp, char *ucode_prefix); int psp_init_toc_microcode(struct psp_context *psp, char *ucode_prefix); int psp_init_sos_microcode(struct psp_context *psp, char *ucode_prefix); int psp_init_ta_microcode(struct psp_context *psp, char *ucode_prefix); -int psp_init_cap_microcode(struct psp_context *psp, - const char *chip_name); +int psp_init_cap_microcode(struct psp_context *psp, char *ucode_prefix); int psp_get_fw_attestation_records_addr(struct psp_context *psp, uint64_t *output_ptr); From patchwork Tue Jan 3 22:18:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088081 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 63B7CC4708E for ; Tue, 3 Jan 2023 22:20:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A9A2D10E4EC; Tue, 3 Jan 2023 22:20:07 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2058.outbound.protection.outlook.com [40.107.92.58]) by gabe.freedesktop.org (Postfix) with ESMTPS id C635610E4F8; Tue, 3 Jan 2023 22:20:01 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FBW/9OQuXiqVY8Ur8xeGtS8Bkoc8lSkQ27o6JYsebjrs3uXmBlFO9g1gKTe88AqG5gGLM1hXz+MA8rcO8TLe8Y7y/7IwUxFtPYcP7/JtnarFdgFsMFY+20938fQYCGB08cA7i4o95tz3M+Byl2jCAvZBJGSf4e07UL8oyxRVxYAYr4fuxc5ZfAjLWL/HRvrcHtiZNgKLYHz5I8s3ahXMRXN7+LBh2gyjsF3qGFsZxDhIkHHWkmGIe/9sfpcnPNvVnuWgaOUTj7967FCnqX4HjxsF03/i6TXEgeKrqF9wuZNXwY0peRBLj42kFcUbNWXd4YuT9Q/cIHT1LAU5u5yJTQ== 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=eKm809+0PaVevVhICGxvYdEif2gQRF4m7a1dzZ2fI8k=; b=M2CoohDK4OfSKnhvnmNcYc26WDYgGDuKWodqmi5wwu0DSjzP7e4MYg3E55ZAVVF3IehLShADS6cIY+wE57olr3A+uYIHkZ+GwnNOHCCVD5r51Rf6E3onRLwojZoAJEwBWjIK28FXnkuE6swREPf2j1Yj66Z73UAvHJy+wM7zypmNz6w0KID4CggkmBJ+EAjjf8m2RiN0Coy61dEhO7j2KN8m1zXBML+QlshLN8p7xk09VU2shq4/NY6TfsSf8XSartMTuYja/Isfuo90Gym0yk+Q5YwQDJPaGrSjz76OCny97hJZlQq7oeud8OznYklo/EExt2aIHmnO8uz1N25Ezw== 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=eKm809+0PaVevVhICGxvYdEif2gQRF4m7a1dzZ2fI8k=; b=l/Fiw6TGz+58fUPXlsHJk8vr0/AH92yRzOwJ7XtsLe2tYnr8tOb23JGfMPpPqcJ6YpkBmk5dm2XBgwzOVfEEvb6PAaoO9NhzGRw+FQG+JTbdNiMta1iuX61DPOzIM7mnqPGwp/bwx5f4AxTrDyZh4W4a0L7E48YiSUIVXVgX5CY= Received: from DS7PR03CA0144.namprd03.prod.outlook.com (2603:10b6:5:3b4::29) by SJ0PR12MB5453.namprd12.prod.outlook.com (2603:10b6:a03:37f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:59 +0000 Received: from DS1PEPF0000E655.namprd02.prod.outlook.com (2603:10b6:5:3b4:cafe::d) by DS7PR03CA0144.outlook.office365.com (2603:10b6:5:3b4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19: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 DS1PEPF0000E655.mail.protection.outlook.com (10.167.18.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19: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; Tue, 3 Jan 2023 16:19:55 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 24/27] drm/amd/display: Load DMUB microcode during early_init Date: Tue, 3 Jan 2023 16:18:43 -0600 Message-ID: <20230103221852.22813-25-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E655:EE_|SJ0PR12MB5453:EE_ X-MS-Office365-Filtering-Correlation-Id: 95e70b35-dd60-465f-1486-08daedd8a67a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UBJ+U5jWfQwZ9STwOYsteCqTzVFLsjX3dREKXjjuao2a0j7tHhBkTKpdjDFlqZSEg5zaP9oNqVzXs/HHlYxrBoVmx3qRU0nCbgIF6L2UBkUJyWE9rjkNfESUYqixwRHIClQgUmSyRf1VrrKkMQasqkGp5wA6cTzbuRqbrHQpNTkqYQbnD8LXSPotk/l9hClemUT+qCBJkrE7Ij4MbBjYRdgQRUC033e/n0EQvouVfvxctUtmNjD1JPLiAIHrm3p8Qbv8bQ8fZz5TPnceXdvYP7eRiqwhhpnmZPTWF3meXJ4h0jECxL8uN1jUzxsDiJYsyJBo6TpT4GhgzJF+mNm1JcB6C6JDcdEaYJ7XvMSJm/BrPpEgxCx4Vl7Q0TEyitcVOv/CC+tIAr5PMdBw/O6pIJLgxWNvt+ks37FM5H9sJCEre2jqFfRPDTNP/e5tGlKbG0lChym13WB7LuZqmQ210PWucRjmOUNDB8e3Q7FnrOSx5j6JKRETNZC3aYjtbTUGcfN9Y5XPlLNrWP4wfdmVcMHwBykRDFmzcwLDMt9V72HW7KeuEEZ/yefGha4uxHZsKUFBWsZcw81T3Cb8wirI9sZxj6OO4f6c9jZX+gC1ftyfQS2aH5SeiBnz3uu4W41haHgrIIKQHu7539ojHX/rKO26OO09BcH0Q8jFVH6HX4J+sVke66kYCT2j22++682yuwbcIlR/b0mEpCPBo1e06mP/jee2i4IRhb+ZZ+RPObE4aGqUI97dJcVYSTuXXcM4WKchTaEhBiXVIRXbWdfbMw== 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)(39860400002)(376002)(136003)(451199015)(46966006)(40470700004)(36840700001)(47076005)(36860700001)(2616005)(83380400001)(336012)(1076003)(426003)(40480700001)(86362001)(40460700003)(82310400005)(81166007)(356005)(82740400003)(36756003)(5660300002)(110136005)(54906003)(316002)(2906002)(41300700001)(44832011)(4326008)(70586007)(8936002)(8676002)(70206006)(26005)(186003)(478600001)(16526019)(6666004)(7696005)(22166009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:58.7146 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 95e70b35-dd60-465f-1486-08daedd8a67a 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: DS1PEPF0000E655.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB5453 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. Signed-off-by: Mario Limonciello Reviewed-by: Harry Wentland --- v3->v4: * New patch --- .../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..eeccc8af0320 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_load(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 Tue Jan 3 22:18:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088084 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 EC5BFC54EBC for ; Tue, 3 Jan 2023 22:20:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BD36310E4EB; Tue, 3 Jan 2023 22:20:10 +0000 (UTC) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2081.outbound.protection.outlook.com [40.107.101.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id BA2E310E4F1; Tue, 3 Jan 2023 22:20:05 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ocLE1KXpWdxvDqU2JvfzZ5YuREYdOnNDlXSE1rIPsQvAa5YRHRgL8+S73h5Taaa3qmLmVQL50R9s1ItJgfjC1j03Od0/JjM+c+jZplKQxw+540ryneA7eqGi1lqutEorFnLysGoJga/aDRRH3W9JsZhVQ2F+pOEM/Itk72cNLZkTUX/gyBVy3k2FJPJlpscf9z+4rw0/NN/WLAWwB5FZQ/Gb9peOoyiEqHuBqMXvR5uuqp/WFQpT/V9lvZAtl1YfGvifFHDKwlMGl7q7DR+5XfGrku2q1ScNKWNyzLOwl+8GoTgyisuFmfxX5X4Ek5LngYnTuM7N+KUVB0OZ1P09Qw== 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=rJ/l7d8aCxDtKk2S7pKUUy8zP3KH/r1mbvB6xAj812Q=; b=h6kHkJQQQRO4jk/8aP9yX58MZsK+hlda4LHEaFwQEYLI4BQbvhzou1xbDZ/owYKDiMtFbDHE8v0LJ3ws/0pDBMGsIJpVntALgAiGOWDq0DzpOhDTvZcnN1TXI1uWIaRCXZWD2B1lAbGO+BfQga+nZYCYn4LiA/n724KFMUUxdqGc36KWb/HGwk83z0P2n5klT/t2Hf5alTd7BRHVq/pZklhqzAF4ufPqAQHWg5CqIEzLXgL6YjYtHz/8b7f7e9eebJWW6vQ4+fe3ONIw0qQabBNGrqYgEJeyukNTsrTZV+FZcwaSF463UFTsweO7RE+7b7AeNJWBpweG7WlAsluKpg== 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=rJ/l7d8aCxDtKk2S7pKUUy8zP3KH/r1mbvB6xAj812Q=; b=D32HftlgfvpBk93p1w6OZiJ0RPfkm2lKyRe/iHcx+RhjviEzfXYQrIKABilXRTUzrvRCGmbxZWLcs+/JrtRZJGh9jmWX0lkgDDbWrUQZcsv5pCWsLiELLI1hsK05HvgwKBdCtBc56hpY5UALuHW0zCCpIzqf+k+nfSpJXjsy4ww= Received: from DS7PR03CA0129.namprd03.prod.outlook.com (2603:10b6:5:3b4::14) by DM4PR12MB6422.namprd12.prod.outlook.com (2603:10b6:8:b9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:59 +0000 Received: from DS1PEPF0000E655.namprd02.prod.outlook.com (2603:10b6:5:3b4:cafe::62) by DS7PR03CA0129.outlook.office365.com (2603:10b6:5:3b4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19:59 +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 DS1PEPF0000E655.mail.protection.outlook.com (10.167.18.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19:59 +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; Tue, 3 Jan 2023 16:19:56 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 25/27] drm/amd: Use `amdgpu_ucode_load` helper for SMU Date: Tue, 3 Jan 2023 16:18:44 -0600 Message-ID: <20230103221852.22813-26-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E655:EE_|DM4PR12MB6422:EE_ X-MS-Office365-Filtering-Correlation-Id: 2c9cf458-3062-42c7-d4b4-08daedd8a6db X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E2TYgBDmA6caTmvLoA829hRrAtGTZe18trN5bV9YcUr3ecELFEbgBdTLdi5AdZZj/JflvxMupsPct58wi4+4OHRWWqktGtarLHbmONnrRcviTXw9z43jYXy/fU8FCy0aBJ4TNOBoYUDo3ItIslQgDA9eLxqBxb5b/yjUd7Za3e4YLjBBRM0XBVJERu4pbmR/pU9MWFNkK6c5HQylR4QYobt3EINRQYBpHtE5ZpM5gDsWvP8sZfQIAZCl4wxgzFOJwD+wxob6xpklZhnJdnIF9GGBkc9XY7bbJphMI7VHngvOmgn9urWhE9gwCJCX98gatujLY3BpLY3Ki9/NHHhyXWvysOBugE3l1QKvt1sppQoZGvVgBvIRHYYz629YblgiyNsnqCdgP/AsUBO0lX4iMWDvlxUSW+2Bcfkj603yRjL2rYh1ZBLAw1ohNQcOJfqhsmne7qSjw+3mbuQn/VBy6QF2J0tQtGIqojL7Rvjk75+hj30LTXJ3Tz6I6JigCLjEKxQvgdHZjF8cxhD+9JfUW9oip+ZFuaS52aADMSZLucL9WJ7f6wV+gbSkO8pNSDa4eKQFoy9hldzMiK68X41H4iYo1+Nugoa88qVzHrteRiuEtJbQemrQ1ed8FuWyMPXZxagdaKjk8hqU6z4chtLdYv1kb3e/0YL7EUmFNsh7bkEOqOefjAG9WNdVWZmBiewOQS1YmXQeyKSFtPWv9cYzExmcyiRlLwGVY6RlyYIczyuaeWrfs9VhR01WMd2/QmdI28JKmtroUCZyJOBhrbp2oyCiIGwodD9+WEl7c5aPIdw= 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)(396003)(346002)(39860400002)(451199015)(36840700001)(46966006)(40470700004)(16526019)(6666004)(54906003)(316002)(186003)(26005)(7696005)(81166007)(110136005)(4326008)(2616005)(70206006)(336012)(70586007)(1076003)(8676002)(478600001)(8936002)(41300700001)(5660300002)(83380400001)(44832011)(356005)(47076005)(426003)(2906002)(36860700001)(82740400003)(36756003)(40460700003)(86362001)(82310400005)(40480700001)(22166009)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:59.3708 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2c9cf458-3062-42c7-d4b4-08daedd8a6db 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: DS1PEPF0000E655.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6422 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_load` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. Signed-off-by: Mario Limonciello --- v3->v4: * New patch --- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 5 +---- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 5 +---- 2 files changed, 2 insertions(+), 8 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..1d693cda5818 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_load(adev, &adev->pm.fw, fw_name); if (err) goto out; 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..845a7fc83ba8 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_load(adev, &adev->pm.fw, fw_name); if (err) goto out; From patchwork Tue Jan 3 22:18:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088083 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 7DA52C5479D for ; Tue, 3 Jan 2023 22:20:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E5A2E10E4F2; Tue, 3 Jan 2023 22:20:07 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2084.outbound.protection.outlook.com [40.107.244.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id D777E10E4FD; Tue, 3 Jan 2023 22:20:02 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N58V24LChrApydmBVeYoLK/WMGxCcqHPipwn1jYobAJm9PyK0boptGyQxygMRxaBjlRJjEBfDv/0oM/i+53JFRjOogtREsAO+ztGYgXWHF8q8J5/U+6L0pGG7C0bJmxfSEnG9TghOTZKZ8WQFE7YXMOQmdrhUGw529vwMGtXY4sWIycBXpxpPiKWVEVC+Zd7rc+hsCfPJbQ7UGF3K3ncklLCuxo7yvlD9eximc3WjL5ak+eRyb87icjUeIMg9PSf4S9OPp1bv7UQW/CYEHoxinxfdL9uvuVm+bMp5YL0objXteuKEDpzF55OvQGt85VQESc15TEqqgNa9EnPqN1Ndw== 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=evRxg9fq5Q3XgSkQOhK2ciBqpmNcuVPL3jls6lW06Ew=; b=AL7B5pFqAM9THK2OspT465JhE2719DUJcirrNQshfGOetlCme4ESy9uGXGkuPQMH66x7TYJbXTHnaOdS2NfJZ3tHhRq5bMPwf6zUw6K41KJYwYUGOs8DyukyP6fs+ImF5LOyY2w6wvugNnwsIcEd2tGBjY+/zFPLE7ufuzoBEvwJ6m65UxxG/mYEXLLO1BEtQtgFMCo1LiHJ4oDw3Fe72kEEzkTPaZBb6rj82xZ16NXHNtFevNGXTNfkTPn8s4M2FzRUn4IR/P+kiMf+54f71Q5Pg84zDL01qKc1ANug36JMUXi1uofuDQ/ZJrCWz2/UA5eyRHFegbhDzpAFY2P33A== 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=evRxg9fq5Q3XgSkQOhK2ciBqpmNcuVPL3jls6lW06Ew=; b=YQCXmyeaOtAxr+3iIrKRI11rl/GmhI8OhXWk6RcHCRIG0ny+DqW+uo3+nnBxjKjk1UQQaYfTySWrC9sZs2C9K2w47SXZ9xq74XY3k7lHTHPFN7Ped7YJyD80bhU8rztgXmDSpm/W1ju6z/URa0zCRCG9rll51CfofsxTK4sRohY= Received: from DS7PR03CA0129.namprd03.prod.outlook.com (2603:10b6:5:3b4::14) by DS0PR12MB7972.namprd12.prod.outlook.com (2603:10b6:8:14f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 22:19:59 +0000 Received: from DS1PEPF0000E655.namprd02.prod.outlook.com (2603:10b6:5:3b4:cafe::62) by DS7PR03CA0129.outlook.office365.com (2603:10b6:5:3b4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:19:59 +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 DS1PEPF0000E655.mail.protection.outlook.com (10.167.18.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19:59 +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; Tue, 3 Jan 2023 16:19:57 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 26/27] drm/amd: Load SMU microcode during early_init Date: Tue, 3 Jan 2023 16:18:45 -0600 Message-ID: <20230103221852.22813-27-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E655:EE_|DS0PR12MB7972:EE_ X-MS-Office365-Filtering-Correlation-Id: f3fa0882-0f57-4874-2160-08daedd8a709 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WQL+1U4nAAeToN5ggdv0yv1P5Isg/Egog0WPPCM6Hjjfau9j06xUrLBMkGod7FujbYLaSljALr5aXRr++p6Wz8TuikCMUWO99IaGW8hfnYiEe6jmeF4D8nlbr12EuhctqbgfkvELKIpBMnwz3YmrtOSvCaLWxA7IIG84q8pk0OU/oUszCVJYHHnkVbcSAMNG3fQl833ubbNcatZtyyyW3bOKUvZa/JaOL8TDugePmSOebmcLjGL5G+vRUosyTou4dSV5Tz42FDRSia819mJ2n9z7peGbWAq5167zcOM/uKNZ2xm4MT5V3eBn1hSBgHKXCpL4SUEuum96mjDJU/euBOXdeDaSa1X0WvTnC+bXKKksMOx75BEjgMix0RSX6KIz33O4HiNQlvrN/wrgJI7RscQMJJqMkgaNbz6ih2HSQyIxsMIxZnAWxShTHWsCI1zx+L3WoYwdyFn2M3Ch/j6RtgFlJqpEoLQr2cUxYst0ziKVHYbt/NFHSmAcNeCMY7rU+Ud3sRtjeVPoaRCH0Z27bjNeyX8krcwNnT30h5ZhkVe5LX+wP/LwyX4skrMZAXCM9yH5TdE+feul3uEaIqHJvYOE1iQ2AeI593R9JPKsyULf/uBQQxXvsNeDzeEdyOCnmxsy6xwAAQVPu4c7ADXGPaEk4FElV1csS2AyXTggbmj0fmGy5wKwXSAPD1iokiuNbjkuez+sIKjmsPjK/HRSi07RyLUdd/Dq1IwQEL1ohrHiUs+BPo1ZQgmU2O87zjmvoR9nGpLeMOdwkvL0png85g== 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)(376002)(39860400002)(396003)(451199015)(40470700004)(46966006)(36840700001)(41300700001)(40460700003)(426003)(47076005)(70206006)(316002)(336012)(8676002)(54906003)(4326008)(2616005)(70586007)(36756003)(82740400003)(36860700001)(81166007)(82310400005)(356005)(86362001)(83380400001)(44832011)(40480700001)(110136005)(5660300002)(8936002)(1076003)(2906002)(478600001)(6666004)(186003)(16526019)(26005)(7696005)(22166009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:59.6677 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3fa0882-0f57-4874-2160-08daedd8a709 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: DS1PEPF0000E655.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7972 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 --- v3->v4: * new patch --- 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 Tue Jan 3 22:18:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13088085 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 9E361C5479D for ; Tue, 3 Jan 2023 22:20:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AA41410E3F3; Tue, 3 Jan 2023 22:20:22 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2058.outbound.protection.outlook.com [40.107.93.58]) by gabe.freedesktop.org (Postfix) with ESMTPS id A504C10E514; Tue, 3 Jan 2023 22:20:02 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FXUf0C/GTKTWAlq8rr5PcpAzQDVZaovfHg4l6TNuCPY2tc0CnmsU6Zwj2H0FDB6ZVvlg4slWYiFARCOQR9MXSyzayz03QvebLlBSGboQ/39i5/l6OlHyl3Z3R8MofLLxKx3HJZYmXF4YpXUvsanbIXR5IVRmSyEuuUxqB7tavD+DazShg/6Wz2/bIgBTuxd1eNzISIjKsB4DIdMcFAF61fRHL/rZOqNq+4ia31v2NhJn9jnH3Lm6PvDO7U34gR+kiR57zeMIr7E1eT+EuQXaQ1gg2I+yAGP8eRI5YOHLLWrmZrjM/teVldh7tPsqGakG8GcLI5cWgDJA0YOrsuvUcg== 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=x/O7RPD2JYQo30CJswIa/YhQEv3VyX1NY4yMwHxewTA=; b=LJcY/vGvJAMb3myDT1EteEvFeSb+yG1fBgG4W1jkD7IwLLRV4PIhu48yGHznWmVFcxLCjVgjstolwcAaOCViRCabK0ge2jvZNaxX/KPBP9zTs6EUv8ttivbejSGtTf4agjYFymLvE9Mnt00pEhnAVggHXqL7w2M3slhjMioQb/LtORYyRgLc6uCxFzeETwIU9HtzTrAq+9zANabqSA55vOSMf/3xeE78IXfLHCcYMOxQg8LBEejnDuZuIplTDcct6Nb09kFrrvq7Q+5Rns1f6sl8kF519MdCcNYU5v3TDBNCu8o6BZAsw5QmKreRonL4ezG/6KhbS6CywR40MRpkJw== 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=x/O7RPD2JYQo30CJswIa/YhQEv3VyX1NY4yMwHxewTA=; b=G05ZIgu63G1/CKKHXSZa0MTZVpf+3cceu5kS2R7pa9CdZ1gbX/OhfaUkoJh13OTYdVH3miPakwZSHQUS5C4UI7S4H2KIJ7FUEsrBN6a/4EGObigNCdBXob05NybsSYo0QletVBIIPNsIRE+aernnZfsld68GAlQGKRGqO88pUCE= Received: from DS7PR03CA0129.namprd03.prod.outlook.com (2603:10b6:5:3b4::14) by MN2PR12MB4317.namprd12.prod.outlook.com (2603:10b6:208:1d0::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.18; Tue, 3 Jan 2023 22:20:00 +0000 Received: from DS1PEPF0000E655.namprd02.prod.outlook.com (2603:10b6:5:3b4:cafe::62) by DS7PR03CA0129.outlook.office365.com (2603:10b6:5:3b4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Tue, 3 Jan 2023 22:20:00 +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 DS1PEPF0000E655.mail.protection.outlook.com (10.167.18.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.8 via Frontend Transport; Tue, 3 Jan 2023 22:19:59 +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; Tue, 3 Jan 2023 16:19:59 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v4 27/27] drm/amd: Optimize SRIOV switch/case for PSP microcode load Date: Tue, 3 Jan 2023 16:18:46 -0600 Message-ID: <20230103221852.22813-28-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com> References: <20230103221852.22813-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E655:EE_|MN2PR12MB4317:EE_ X-MS-Office365-Filtering-Correlation-Id: a5ae0a10-7d05-4fa2-9537-08daedd8a73d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mquZa3m/B09Q1KOxGlbhKXRewyWcrLZ/z0D8U6BnoJH+hNaQX8iFr/SnZy1iIshsGqz5oiKjQttXduofen7KFyUB1QNTvE0SFLM4kclc2hD70ZMPmXppm5H+B8Fk7KARwcrtpCozOFqOYORnZ74rwWANUFpBmbKAd5RXtd8ROrW93bpW3r1acys4n6d00W0Zm3DKKEYGh3XNSk1/74X1yJHFWsj5zFMLh/vW+4Es+kzwi4f5jzJRqTwoyKpuAas8D6IeKMWDnVCjot65R/jQTbXE/z2ivj0zPopSbzrM/YFm1KKc7uqeARY2DP7P/XaRTSTi6AYBHzmK/v4zYlhNBsV3fjJ9VKXNSHfda5NzQZQdpZwo8wpwQ3fFmgkipIy2IgCIliFLskYAWnttCayYpsTWo1+SzELyOCf5yHvotM+dztYmptiaKapViZMumbe/NqT26KBzgJ6cDTszWW/W+FTfRKbuK0TgRNZuR7+dO5qbrlZszMXayTX/2AjipZn4/DMqBQIKpAw5vxtIOE2qqF9SY9usQ70KjFEGko/OkNZ7WYn/w24nw6bP7H8/pFI+KDVKfvfTIa3SOJOgpkNZtv11BsLNEFzIFJXNltUBSTdEnNopEgq+aDPabQtJwdAisJHhrU/smXnyrDfCNYKb9hPbNmECX7aqbZ78hpRkZTgsvLzhRYh1sszFJ+ixNcQiooW9+wuns/1TacPDeBGSbDWmr5q0UKIHthDc6yAR2cTKAlYvdDV2utKT2EHnrFTxbKrejFFK6Mb3DMjWpn0H7w== 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)(376002)(136003)(346002)(451199015)(36840700001)(40470700004)(46966006)(36756003)(70586007)(54906003)(70206006)(4326008)(86362001)(110136005)(41300700001)(8676002)(356005)(81166007)(82740400003)(36860700001)(186003)(7696005)(26005)(478600001)(6666004)(426003)(5660300002)(8936002)(40460700003)(2906002)(47076005)(316002)(40480700001)(82310400005)(1076003)(2616005)(83380400001)(16526019)(44832011)(336012)(22166009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 22:19:59.9958 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5ae0a10-7d05-4fa2-9537-08daedd8a73d 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: DS1PEPF0000E655.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4317 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. Signed-off-by: Mario Limonciello --- v3->v4: * New patch 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 f45362dd8228..83e253b5d928 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;