From patchwork Thu Jan 5 17:00:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090165 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 79140C5479D for ; Thu, 5 Jan 2023 17:02:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1FD5610E762; Thu, 5 Jan 2023 17:02:02 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2061.outbound.protection.outlook.com [40.107.220.61]) by gabe.freedesktop.org (Postfix) with ESMTPS id A8EDC10E08D; Thu, 5 Jan 2023 17:01:59 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WwSfTK1vxeli12B7AXB6oWmryAv6UxmTQ5PKcglwV9bb8nXHz8/jOWFadIstzbhWQgPeI8QpOI1vn6AIhp8+Tpac2ftmMaaEOVT6sl5O8L4IMZlymXCXT/iYZhNliDavn+CqimwEYJ+o+FjVDaeWGFRWxeIXrfm0i51SDHioPahJS0dWVsCC1gPzB28lB4CF6hUg72P5AOHpl0YhBE1wGhxWpCR5iwgd7r7I6/yYONTs2UhqsOldIhVXynT/vEfw0jsZ8v/vqEsLH7iROHpP6ZJqwO6zICmrFEOGHRvWDROrgCOtHWo1WhCAa8Jz5gH6oZANlaZK+48GGFNdr3Cq+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FTLNGpVA0h+SXLS+KiTeOahDLsAlGKgmtm5t+7ygJjY=; b=C3GRD2hzPeCaFb4AxIg/kTO6hcccCrTdUxTsKaUmAmUcoP7U6O9CNitWB4zSUkmnT21lYCivF09tLx1Pulf245sxuyvLWm/XaFE/JIHoY9v0b1UOtFk6F6NKq6RdUIjxd4vMTSzIFlH6pCAPHIcRvAy3Bn/X7FS9qF+4p3tu303hF6pc8d1kNpaJ6eoDz9+Sm4BmLicA4zI2OJtpOJMBvu350YLNQw/vFNs6xG91jv5aOHLj7kLD9nfRgVKYUA1kdr5ptCz1a7VdUGtOgAI9ww1DwlqV5IqzwHWiCKz6dM3tZGVlU98yfyMkhT5CnAPTiRU98/6oZoGLgHIcHWySvQ== 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=FTLNGpVA0h+SXLS+KiTeOahDLsAlGKgmtm5t+7ygJjY=; b=V4DZ20VnXrRVxnhwkiamPcViKOfukekj8tNOOqFki5LkFPL7/5r93Kjz1KGVXcAmEtZuMvwVY+hXwKPEAgK1LuCYbWTjGQuat4MlBfBl+/cGSdp5WUONwRmUQHzW8nDEH5A3vljZf/48qb2PGe2Nd6riQusM2ZFgtuxJNc7na/U= Received: from BN0PR02CA0009.namprd02.prod.outlook.com (2603:10b6:408:e4::14) by MW3PR12MB4412.namprd12.prod.outlook.com (2603:10b6:303:58::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:01:57 +0000 Received: from BN8NAM11FT107.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e4:cafe::53) by BN0PR02CA0009.outlook.office365.com (2603:10b6:408:e4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:01: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 BN8NAM11FT107.mail.protection.outlook.com (10.13.176.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.18 via Frontend Transport; Thu, 5 Jan 2023 17:01: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; Thu, 5 Jan 2023 11:01:55 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 01/45] drm/amd: Delay removal of the firmware framebuffer Date: Thu, 5 Jan 2023 11:00:47 -0600 Message-ID: <20230105170138.717-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT107:EE_|MW3PR12MB4412:EE_ X-MS-Office365-Filtering-Correlation-Id: 226e5475-d060-4965-ccea-08daef3e8d88 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QiNXOZsYrjQ+g2q5FC5H6zhhLmcHy7ywfsaHxWx6IF7HL/vNMoJ+LnPqSOK6ZcPMwpobPFVG2Ng4PQpB8aMi1F6jJmPg9MXjjCN7baOT6FojWEw2/EJ3rYHodQLi7hhVZ/xDhblhVZzbDOCbhY7QaVqIdwD4L4z+/5N+xKHhJWHfCSwk4c0j3GczRlVf5pgx/gbxAV9Bt3R7FJVLcy4e4I2LqcHCpUlEKCzfu/lUflmssbKNYCL4tPRM9+pAZSuCEy9uH7iQ75WW7CWlXK56n6bksUdCI9bN79/ZECRPJXI4obuCpAVo8m5tuIFJddERklJq1fHt2c7wgTPndqYqk9yunYIxSR5n3N9SvCNvq9HW6SEShne43LT7n4mMAdKYRxoF0YK8A9QsKemfv8q0IDMlNdr0AeS1WQ/k00unK1dCly3TzCVtm22Z27Z8KFhPrPOnfzUIPnCwAFMPNGnFgFDU6C2jbX35+SZy0GaQrliVHhgcUGW9Db8bNdkKztY+8YfshxcoiCMkc1DfyjLkrfEt19Ua5FuB/suCG904ntfnuk9vlmJ4yOOGpazbJVPGIG1nb83ehDE5Q4v81N3KxS/i91a7K83YldF99Sn4U+8EvgysCtEcDcvPizWVi9M44tZwLaz6CfSanNHMORjNWyL5+ac5vtCWEzO0O7RBi9RP8rP0v+l3vW/6nWpOKUUWS4d9PowN//PlswSujdC2uQwadQNH2jzvPbPVBJOrvBU= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(346002)(396003)(376002)(136003)(451199015)(36840700001)(46966006)(40470700004)(44832011)(2616005)(36860700001)(47076005)(336012)(83380400001)(426003)(40480700001)(86362001)(81166007)(82310400005)(40460700003)(82740400003)(1076003)(356005)(36756003)(54906003)(2906002)(110136005)(70206006)(316002)(41300700001)(8936002)(70586007)(8676002)(5660300002)(4326008)(186003)(26005)(6666004)(16526019)(7696005)(478600001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:01:56.7597 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 226e5475-d060-4965-ccea-08daef3e8d88 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: BN8NAM11FT107.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4412 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" , David Airlie , Lijo Lazar , 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 Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- 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 Thu Jan 5 17:00:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090166 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 F024EC54EBD for ; Thu, 5 Jan 2023 17:02:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6BFA010E766; Thu, 5 Jan 2023 17:02:04 +0000 (UTC) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2071.outbound.protection.outlook.com [40.107.243.71]) by gabe.freedesktop.org (Postfix) with ESMTPS id D394B10E762; Thu, 5 Jan 2023 17:02:01 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AjytY9IOZTzEbG2zD/OulK2O46hwCQqMHhPefpZIDev6W5msWast2qp6c/O9qeQq/1Rhmj8joQCfQPWWWsGel0ZJc+hIqBWkRIVBtAlHWDteaTbNYSEKa0aOiPRaGawLgdkQHXe9fqWN0CQCIt3l8AVtq/MFF5YAEcph9Hgh1LQTKIFF0LgZkDHStmxJbLvjpE2BZQoP05CRmTVBZv7OeKigvS3NsrVHnzJOjVdFf96TKugOe1cWmdpdrhHq+ircR+FUdK9l1SrQ7NM0jbrgxhsnNbrg5DFVl6lBrXu0sADNuS1TRk3oX83EFbxjYTDv+dzCYhbo7tWUVhBPSce3Jg== 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=l1lY2vYgSVAp2mPpxW3GHrY/ayHmaixJMwuQd82ua7U=; b=NFJUKqtA31C90t0dU3XsItiCV9RiwDJ/ie7XbNeRPooogDY8rSj/PNziYP88HZ2m2AgpcDEneJtmQ5jZKM6sy0n4ZKQnO6iGAdNq8+vVmlxFQhwuJRy7EayrNkbwj7gQ1krllqlZfUHJ25q5+e/vwY1iVuP8ZhrXwe7izqsjhLd0vQVeF3X/VZACiDBPqzJudkZHTAbt8dFSQQHCQYKuL67CD07QoSNBA71AZVYK5BKXUv7zQ/gygYAyTssJnemFFmWgfDpH4tzSmXzviFmEFsqYoPFtryzDVRkgfKpLpFOdYK4Il3w2CuqYKmE1e5QP7AVu/2sKrkIsaok13DE18A== 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=l1lY2vYgSVAp2mPpxW3GHrY/ayHmaixJMwuQd82ua7U=; b=nBTIsd8GblkqKL0rtf+FPzcnCIQK0BZYUZtbNG71O1CY2IWXciE9jbec6d3uMMCG2VThvFtp672J+7Oyj93XxNzsRoa07qso1C/XkqmREsJ1F+0EBsnZ43DnIPa+DwA40BlQ3Q3OW7PsF/MogYI2L1XMmB9SGSlGpnpWIbapnJc= Received: from BN0PR02CA0024.namprd02.prod.outlook.com (2603:10b6:408:e4::29) by PH8PR12MB7256.namprd12.prod.outlook.com (2603:10b6:510:223::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:01:59 +0000 Received: from BN8NAM11FT107.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e4:cafe::e6) by BN0PR02CA0024.outlook.office365.com (2603:10b6:408:e4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:01: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 BN8NAM11FT107.mail.protection.outlook.com (10.13.176.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.18 via Frontend Transport; Thu, 5 Jan 2023 17:01: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; Thu, 5 Jan 2023 11:01:56 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 02/45] drm/amd: Add a legacy mapping to "amdgpu_ucode_ip_version_decode" Date: Thu, 5 Jan 2023 11:00:48 -0600 Message-ID: <20230105170138.717-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT107:EE_|PH8PR12MB7256:EE_ X-MS-Office365-Filtering-Correlation-Id: 31c6ff12-e82e-4026-efb3-08daef3e8ef7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WNdtYrgQDQVOY8eIaJKDYQlmMhMJzOxzzEWObcX/w05GVX8DlE0/xPZhQJtHqKjdzi5WyW6FeNuOWrWlAyLNWpBaW6pG2CXnw8iqZa3xxyIqnouKS7svmHRVB0Fq8p2imBnnzaWRMo75Kkdh8OnWJMDJBsR11qnze0JU4faqKfNITLlFOUKSkJmaJtIWjV/egZMo3kP7e3xsJ+pNzz9lTg0sgSrvi68YO1KMuC4ZGV1lyh6f09IvEw/Vu4wExk1Iaim7tM+bHm92P4p5Fwaoob3KZnEEX7u5dCspMkTNMcFoAji9zSwl4kUvPAAMpGYqRR2PvbYoJwSDh8DcP3UyPNbektL/RFdXD6n6T0g/QbcWde2uyTNWTWG84VCmU/KfutZq8Vo4trfS6cXqoL1bX0ZW/cVJ8rIEeUZifSHwjrO8GCxJrlkEgBBJX74UUDXb16Sptayo64QPGqtyDyv/nw/qP4LuO2jFB9tt01QXBSpILXG/yrVs9clGS6ocSBFANr5WMsWB4xa38xQj1jIDLcMFC5AUS/kC4TZbapZFQnlsgX0ElRY3+eHzYf8oSN5NjpBZ+PHWpk0Jjh4ZXMjesrSgOKAAvjiIfE6NHXohEgiP3YCEUjChqoexVrKzZ07voVPyfOBjgX+UzFj5ILmlV89QBWvTgMKiR3BgAPbpKAvD6i+DgHfunnkiAgA7xLJhi5mxPqHKQgYVbllkd9q6vtAmFiEJA3j9PBm7N8uNmq0= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(346002)(136003)(376002)(396003)(451199015)(36840700001)(46966006)(40470700004)(81166007)(356005)(82740400003)(40480700001)(36756003)(82310400005)(7696005)(40460700003)(86362001)(70206006)(316002)(2616005)(16526019)(70586007)(478600001)(186003)(1076003)(26005)(5660300002)(54906003)(6666004)(110136005)(8676002)(4326008)(2906002)(36860700001)(426003)(47076005)(8936002)(44832011)(336012)(41300700001)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:01:59.1502 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 31c6ff12-e82e-4026-efb3-08daef3e8ef7 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: BN8NAM11FT107.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7256 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" , David Airlie , Lijo Lazar , 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 Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar --- 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 Thu Jan 5 17:00:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090168 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 ACB90C54EBD for ; Thu, 5 Jan 2023 17:02:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BEAB510E769; Thu, 5 Jan 2023 17:02:07 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2043.outbound.protection.outlook.com [40.107.237.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id C9ED110E766; Thu, 5 Jan 2023 17:02:02 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oNyIkU2j/WvnS5zcQlPAdWWFibF5yGGcouqultfAoYelAJ80d8PU0TOKeGi6kgZLDm0rB5f7nqRGcdfS2L88E86Kt3T4/C8EeUGQdSsxCc2wOeJOu7HIGv1lqKVZMzu+LJZd0mcvPfvpi1cv1L/YAjQ+F08D1MabMZxBpG6mpmgHecy5qqrF0pyBWStybFdyLwic8D8ZK61WYtcKZ+khAZ+la9EKOtKYbw2sLVQ2C8S7HUQir91qwcRnnvefQODEbIZiIZH3uuaBTx5x9lf+VRtrhyw8/biFzPjw4V0+YFUxVtch5txgnlwX7CrcXBgxIMG5IZv3c+hvTd2jSAhFGQ== 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=4LxjqprPsdNO7TXS/dXkGsaSJsZ7Qug/Lv33+aLspIk=; b=ierZo2xT8MhDwfLxd7aJF/pVAJGinKt3PBMMhGqUQmtCZo1nNmbd7S6FrpxuZWfbpVpM4j0JYOBNdal+Z0CD/1mz+t9Xib2oPQTTOyuri+fHv1DBa16PRZr38rGTf1//MXlVyWILCOSJLzFIyE8oYOhpn4bbdfgLAIvcUx1ABsQGxj3up9paGGcTDS1afJ5jKQD1fGAZHfRjHOhziNc64eq27vMBf36V1gN5iOsE8dBUpBg29yqSXVkz/G6NhiYJbSRkfZ+W8s4F032RUFHmRVXu/USg31Ljzu3KVlmKBY5UyUVwDiVkYeZPEMXEm0CkzBJJHv5jM/p6mZak72Go8g== 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=4LxjqprPsdNO7TXS/dXkGsaSJsZ7Qug/Lv33+aLspIk=; b=eqKjO7xuXIcZSa7SP1HQVv3ox5hJuxi53oG5gJ2psnGKzx8MJRcIoyBKoHFQkNI5uSYQNVYxg/b+IAhDUynDt72uVk7H6+icJjSUw5mJewngGq7QI+EwTCox9t7VJHHlYoZ+PhGpKs3dxgGt4RVZgRI3qrFSE8DsYQmpp2GnRsk= Received: from BN0PR02CA0016.namprd02.prod.outlook.com (2603:10b6:408:e4::21) by SN7PR12MB8001.namprd12.prod.outlook.com (2603:10b6:806:340::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:00 +0000 Received: from BN8NAM11FT107.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e4:cafe::52) by BN0PR02CA0016.outlook.office365.com (2603:10b6:408:e4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT107.mail.protection.outlook.com (10.13.176.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.18 via Frontend Transport; Thu, 5 Jan 2023 17:02:00 +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; Thu, 5 Jan 2023 11:01:58 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 03/45] drm/amd: Convert SMUv11 microcode to use `amdgpu_ucode_ip_version_decode` Date: Thu, 5 Jan 2023 11:00:49 -0600 Message-ID: <20230105170138.717-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT107:EE_|SN7PR12MB8001:EE_ X-MS-Office365-Filtering-Correlation-Id: 7bc78a42-9d45-4c36-bc7c-08daef3e8faa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fAA/98XarapfeKon5ivPt7BXjtrSoDviQJHhPLTsQJ6se5dZI2ru6EKQE8SPntbUgy8qubVwuLqAoUGRM8j5NUQsAmVretUhmK79YTaLlZvo5Ezd8pSqJjBOxG2q+2/4CDdgP5ivWTcr63+1p0QN7CwqHg03kvJNOipgJgAg8/SA5we+HnABM+HsOYenu+y3mVmYjDQdejNWBcMKpDOBO3aqeGsgXMjU5uUojA31Eyv797t0EIAedlFgHsxnfdVYCWtjlDNdztGQIRR6vNjA18krQvIIGtgebir4iI7pAd78aXWv9Bzb481iE7hcKFuWaZDjKUyIXEuTgfzTdIeRqYs+m6R7fBZrQ/XMMvRLbvePwReiZnCHvxEhcNINJr9qXG9IayFsskJQPzyvG4fTg3SAE/CfSXb3NhydYC4F7lnxnRVTc/yxDwNWiZ6SQevf/vwQmcHRz7Myq4yk+9XUXDNWjxnU+vlQKlWh40vWVwXP679gWUZ7/+ey48O9qtDMul4wS/4hZwY5CncaS7k6/Gy3BqcRJvwrV8SFNfMCZo9wBidnHtp/nXlC/nFX3jj2EvbmZu+qt1R4rL6O3AzP334F9bLNpypzMmRD2pVnXY22bgHBQLCmBVDNkiITu22BfjvAbNW8zu1Scr8iOBSyW+zPcsmd1jWo12vFs9/zU72zcT4eUh0Uv5i75IJ1CdkYTDwFKoXjdNAEwjZeajd8VYVMgrQBaZY124SQA2cHk2ekCbkDRfCB3YoHYtybYvvZxLl4O+Laf8pUyr33zNpK3g== 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)(39860400002)(376002)(396003)(451199015)(46966006)(36840700001)(40470700004)(66574015)(426003)(47076005)(82310400005)(336012)(16526019)(186003)(2616005)(1076003)(26005)(6666004)(7696005)(40480700001)(83380400001)(86362001)(40460700003)(36756003)(36860700001)(356005)(82740400003)(81166007)(41300700001)(2906002)(4326008)(8676002)(70586007)(5660300002)(44832011)(8936002)(110136005)(478600001)(70206006)(316002)(54906003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:00.3219 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7bc78a42-9d45-4c36-bc7c-08daef3e8faa 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: BN8NAM11FT107.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8001 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" , David Airlie , Lijo Lazar , 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 Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar --- .../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 Thu Jan 5 17:00:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090169 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 83B05C5479D for ; Thu, 5 Jan 2023 17:02:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 38D3A10E770; Thu, 5 Jan 2023 17:02:12 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2047.outbound.protection.outlook.com [40.107.92.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3D8E910E768; Thu, 5 Jan 2023 17:02:05 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZPIhBpgbI5HO+Wo9r1hium58X1WU9Y7b3e3aM0n8vAJGaEYxAWrNBsHgUgUxys2/7nChaLfr7jEt+QzHsQj6RBOOzm/e7UYMYHgF/iaLDsjS0SivBQywP4xt7Pj//C0Ga4hTzNq5wZTCSwOBM2JGeomEqVU4+Px8J2oagRtLzjiSCSX9/7UahrwTYUQf0pPvsmsns5JElMw2N4tfi5ECOQfl4MOkwKAsJR/svqmcFC0fyQNyujf6BoqCNcXmr6E9OfVsgL0Q8yYRg5f76gg9nwHcIQYUXTIHgiVgF0BiGzsNxl5GppyncOYNy/TWXZCTMXFe5xW8aypndfY2tHdScg== 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=OVl5UPg0zyYuJL7fJjcYrfLpGIXCd8zRUXRNY13VG0k=; b=YQmEFRgban2OpPQhHdWKOpFKkH1j/5SSfHt+jfpYdPq2eC0adtE+ZcHR3fPRpORJskb6DxIBU57Pb4vaoCtqTbpJBwHGRxFfk/OROeClu8o2vAoW20SxKJ+xIv+F8MA0X2k4rbFq+huOpXB8QcQx0CCMdmEbsK22tSTorpfVJh4GesaCx/5LvYcQEfhsbje1hKMpsLxDquAxATMaHDnXyZvBISQILp9EuTJsPeHCP3FDBtH8yfbZiUFb1BthTCEAEzIkWcBFGf3IH+IlY/grugnLTMYM0Re9t1RI/RaU0ZBkYMMjTV68k4cgSkA5nF1IZ7oErueLrBZ1Gh3WC9Ypiw== 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=OVl5UPg0zyYuJL7fJjcYrfLpGIXCd8zRUXRNY13VG0k=; b=FoghAdVjlyZgS3Kpt7pexbCNIPaErL6F3ViDRTfe5xX7T2QBiKjcaiGL9Z/uhCMLsNV7X7Jjmwk9pLjvo1gwd4QmGpxE3mxZGxJMUuMY3NAmZ80pPC8ZEP/ZuIxG8t1CfZ7U0cHSlOuhqkZ7X/uE0nudoK6wkhB7r2c3VQwF51s= Received: from BN0PR02CA0018.namprd02.prod.outlook.com (2603:10b6:408:e4::23) by MW6PR12MB7072.namprd12.prod.outlook.com (2603:10b6:303:238::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:02 +0000 Received: from BN8NAM11FT107.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e4:cafe::d6) by BN0PR02CA0018.outlook.office365.com (2603:10b6:408:e4::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:01 +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 BN8NAM11FT107.mail.protection.outlook.com (10.13.176.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.18 via Frontend Transport; Thu, 5 Jan 2023 17:02:01 +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; Thu, 5 Jan 2023 11:02:00 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 04/45] drm/amd: Convert SMUv13 microcode to use `amdgpu_ucode_ip_version_decode` Date: Thu, 5 Jan 2023 11:00:50 -0600 Message-ID: <20230105170138.717-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT107:EE_|MW6PR12MB7072:EE_ X-MS-Office365-Filtering-Correlation-Id: d1519901-e099-429c-127b-08daef3e9067 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pBRAi6zuVH+Z1nOslfbyMixT0JCVfaX5WzXaf3MleyggvBSi/1ERM559Hf/s68e8JIWA5679fjno+54cfNY45b9c/oWS9t1X1nlFfxNGd6VMWnpTRIPV9z2nHjBX7k5QNZBIdpBSNrTVXHBx7WHhJ9b3drmgF+VZzKjaIfApp4whU5+B7zl6Ojy3XpGa2rnNq/uxn75VhuvvI4Ht4k38yo8LVWBo8Zk9ln9h1PGY08rtl0S88B1NeI3GswdcV4vxjlTaruSoxVoZKoyWOQcAQKTQ15+mPOL4FImOEG6VkjXha9DZDjkqokj08eSwS8k7pasQLpj3KFhneY6k6Qx6qwlJut+fVAH9SSAq4OvH+YJV+lfiiP0JFgNQhhuRpWG0e+wDSLryGyYGGtNlLsoMiWIKNBnqRwXGeqoRZyROi/KtYV7egNkW1MjVOIR/xdN5Xr+2uRSl+Kzcinuv06l14+fHIpp/Rz1NgS78tIpHt42kz1s+ue5q4uzjwzTHDTfA1p3Qwad/tOX5sI/xyNSff/s6d21OA8kbvnceEW5aYCqSpVRbOwAQC4Y/6s+8k47BS5IST2qnqjEEYKxfdDiDiOIu7U1UhNxCq/U+m0N3Iu8PDAgXV1HiNp728qB+55qtqsZzQ13Az6LftQMPV//Q0e5mqoj10gL0tUVmaefOR+NphAy76zFTMOla59NAj8neOoM509X9oBox4NTUOBPCn6h6j7Bb1V9QyMl5zFRdPuh3gbuwmGNjRcRi4ntUwfM61kMc5o8aI3tGnSGhYuyM8w== 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)(36840700001)(40470700004)(46966006)(41300700001)(5660300002)(70586007)(70206006)(8676002)(44832011)(2906002)(54906003)(110136005)(4326008)(8936002)(7696005)(186003)(16526019)(478600001)(6666004)(26005)(426003)(40480700001)(336012)(47076005)(86362001)(36860700001)(2616005)(83380400001)(66574015)(82740400003)(81166007)(36756003)(356005)(1076003)(316002)(82310400005)(40460700003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:01.5562 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d1519901-e099-429c-127b-08daef3e9067 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: BN8NAM11FT107.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB7072 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" , David Airlie , Lijo Lazar , 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. Signed-off-by: Mario Limonciello Acked-by: Christian König Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar --- 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 Thu Jan 5 17:00:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090171 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 40D88C54EBD for ; Thu, 5 Jan 2023 17:02:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 222CC10E771; Thu, 5 Jan 2023 17:02:14 +0000 (UTC) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2067.outbound.protection.outlook.com [40.107.101.67]) by gabe.freedesktop.org (Postfix) with ESMTPS id DF4E810E76A; Thu, 5 Jan 2023 17:02:05 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gyE+N+I2Y6zBBph68mqH3Ybijk9tzg3wXZ3eIXysZ2VNanBjzrMFHnpJpldcEjgPSkfOJUdPuFxXg3/meO+eVrLOwJMcDhgW87Y1+IcX1x8M/JVP7WFnL8WeLUeP/0NvX+D/2WpWXxm2cgmFuqpCoqzIFJR9jmo/1imPduWyI3ulyEVJdv9bsR4OjsZeSHAQg5R/cBEcfVlfJrawZ6bMh0cttMI/6HW8QlFtvqpLkO/fGR1mcQdt4HZAF/XAsWDIpJkovkk4xGeDbeDRO7yOAPkGgJgx3x/j73tqiKvCQjkoQ091mLp22UY51V31CH+wdgtucf/KUcddp6/YEuNaig== 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=GdX1LM5m5PgfPkBkBzE4+IyhHoPHK1alNEFOwJpx+uo=; b=a0xXwsrv6NznlOE6Z4t79rIIWYRlXm2o5weY5vcfrUD7WeU0KI7eB5foAdC6Y4ElczGqG9Z2bmx0ALrCHnmhbyNwLgQVzeHfXQW2yPiyK2eGnPaVQgSOyurlo6xdPq3Qd986bMmXTn0Do/KiR5H991LdHBx50cD4E16qf8FgPMsvGEgJcKtbPMMciaCq6GwQACEHdFpDmFSqg2tM0GX71MeA5l4i4ucwXCTd272v+1focf+o3DLzl18516zBjrtJYKJiHz5Cwx0ATg90sKrcixhIgtF7HdArjFgsG2GAqnP4LDdPbtz5cDZVqqMO9bNyr/2vFnJTvaJpwmD7cs5HSA== 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=GdX1LM5m5PgfPkBkBzE4+IyhHoPHK1alNEFOwJpx+uo=; b=luZDOOaDyvii+nVbKNFZ+45SKuzTFh+haj+HaEt9xR35bhksSosIna3S/Z5x26W8pE4hO3EaGbnrs5nhRHqSkfAOybso/u4c3IzXMbn7GQ4ASv8X6sNph2O/ozE/egNlc4Hc2Mux5a14qkZAZ29G6kn0Zc6dNKRC+frnK1ct5zk= Received: from BN0PR02CA0012.namprd02.prod.outlook.com (2603:10b6:408:e4::17) by PH7PR12MB6490.namprd12.prod.outlook.com (2603:10b6:510:1f5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:03 +0000 Received: from BN8NAM11FT107.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e4:cafe::8c) by BN0PR02CA0012.outlook.office365.com (2603:10b6:408:e4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02:03 +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 BN8NAM11FT107.mail.protection.outlook.com (10.13.176.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.18 via Frontend Transport; Thu, 5 Jan 2023 17:02:03 +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; Thu, 5 Jan 2023 11:02:01 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 05/45] drm/amd: Add a new helper for loading/validating microcode Date: Thu, 5 Jan 2023 11:00:51 -0600 Message-ID: <20230105170138.717-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT107:EE_|PH7PR12MB6490:EE_ X-MS-Office365-Filtering-Correlation-Id: adcb65cd-9faa-4cd2-c49f-08daef3e9182 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Jx4gO2AL/KYXmB2yFVrmw+EXFFwIZO9WLJ8YBIyWRLZIL2XGnqVNNhJ/ROxc6GXQCpK6Zzwc7IYmR/Snmyd5IF6M48k9qlk3cpyapl1VUcylVIf2U53VIL42uHbNqfJkIwhVqFfYIC/xMhMar8OCGWC7zTw19imEe/LPkEnkDntHRu0iEogoIcduBYws81EXNSO0MaEB2ol9eOkpoiRBhalhBOUPjJnz/XK/ZbXBOLMFwckamuCP6lMLaWlEGh5WJL7iEhUwnrt9eD4dTSztfUdIiPWLTzaeFSkXUougYKJY0UjNWQe+G3iJrknOLiV/ZDlbQy23GNsFGMQAbSxH/72Ca0+FL8wHCDSFX5MgU3fMDUaJ/Yrmnesq1AokJ08Cz5/gxgoKgB+DoOsIIXbu/ogxp9XtAUY+vweTCGSmQt7Ox12odST6bvsjdGx0U6//sxxhUX2dZw07CU0MD0Mf9c8TNFaluEIhM6JXy/j6MTkyHZYB51zT2BEhzFUxxCPkcR91fioVV5azLKLQSKIP0DnQLSK9SP4k292SO2F3ujp3crb97mZ+nVF8mKOTRdDaXqYF98s0lJfPAqDP5/8hjYmn6EjHX5PRxtTVGURugOJ8JGZzqayGFnmJyYvM+21Haaf+kvpHX5JNzIe775CTvdLtNwdgzpa4w9rBIiJ5bqyG7tolULRvI38YlwekXU+GSDqjHVEs2VegcUZjr4lyYtZIft2Mla1zsLkie+BIVZk= 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)(8936002)(41300700001)(5660300002)(8676002)(70586007)(54906003)(110136005)(2906002)(4326008)(7696005)(70206006)(316002)(6666004)(478600001)(47076005)(336012)(86362001)(426003)(44832011)(26005)(186003)(83380400001)(16526019)(2616005)(36756003)(82740400003)(81166007)(40480700001)(356005)(1076003)(40460700003)(36860700001)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:03.4154 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: adcb65cd-9faa-4cd2-c49f-08daef3e9182 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: BN8NAM11FT107.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6490 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" , David Airlie , Lijo Lazar , 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. Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Fix argument to be ** not * --- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 36 +++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 3 ++ 2 files changed, 39 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c index eafcddce58d3..8ebfec12da87 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c @@ -1312,3 +1312,39 @@ void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type, snprintf(ucode_prefix, len, "%s_%d_%d_%d", ip_name, maj, min, rev); } + +/* + * amdgpu_ucode_request - Fetch and validate amdgpu microcode + * + * @adev: amdgpu device + * @fw: pointer to load firmware to + * @fw_name: firmware to load + * + * This is a helper that will use request_firmware and amdgpu_ucode_validate + * to load and run basic validation on firmware. If the load fails, remap + * the error code to -ENODEV, so that early_init functions will fail to load. + */ +int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw, + const char *fw_name) +{ + int err = request_firmware(fw, fw_name, adev->dev); + + if (err) + return -ENODEV; + err = amdgpu_ucode_validate(*fw); + if (err) + dev_dbg(adev->dev, "\"%s\" failed to validate\n", fw_name); + + return err; +} + +/* + * amdgpu_ucode_release - Release firmware microcode + * + * @fw: pointer to firmware to release + */ +void amdgpu_ucode_release(const struct firmware **fw) +{ + release_firmware(*fw); + *fw = NULL; +} diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h index 552e06929229..848579d4988b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h @@ -544,6 +544,9 @@ void amdgpu_ucode_print_sdma_hdr(const struct common_firmware_header *hdr); void amdgpu_ucode_print_psp_hdr(const struct common_firmware_header *hdr); void amdgpu_ucode_print_gpu_info_hdr(const struct common_firmware_header *hdr); int amdgpu_ucode_validate(const struct firmware *fw); +int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw, + const char *fw_name); +void amdgpu_ucode_release(const struct firmware **fw); bool amdgpu_ucode_hdr_version(union amdgpu_firmware_header *hdr, uint16_t hdr_major, uint16_t hdr_minor); From patchwork Thu Jan 5 17:00:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090170 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 422BAC5479D for ; Thu, 5 Jan 2023 17:02:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4BDE810E772; Thu, 5 Jan 2023 17:02:14 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2053.outbound.protection.outlook.com [40.107.94.53]) by gabe.freedesktop.org (Postfix) with ESMTPS id DE25C10E768; Thu, 5 Jan 2023 17:02:05 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U1h9m1DTVCY52CO9+hl1Y8GxYT4eajNNic19ubrgvKVF4HTznXPs6I+DkBS5BsgFg4+4mcxQUJXIs0hKbG3Ykc11Uju5/l28auXx7mIC2oRDT+xG0TUi6QxeYGHa03b0PPqa+s8Cs1eLJNjJF7dvdOLA+A6H58bOz2qb0mOw95mnrn9fzoqstNq/pc5nK1wRjr9fxMaBb1RuYn1ucH8iG7Gm3wEPAFDod7cmgX8FXJGEpZP7yeymIqc5/QDb8ksBTp37hitTfO7vb7MZ7KmTZx81paSIvSwepPOJb5vJkyY+lv+mHevGcns4iIo/2CD6ue96UPRdQywU6xG/u7kddQ== 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=8VyiVX8uG0OwppPh6fz8Sxv8sfahQNlNKEKUOhT8HpM=; b=Dwe+9cQR8ubrrUb9W5BP0LA9656UVqo1oUhKw167KkKZF45JDZIHnxfKXcka2mLkwtz4BTCT7QCS6mYEa1y8PQ/MUJSUQ1Ad0npQX2xoSHeFas5nftq+wfFXtHQjkIxl1M0EIlo3shx7oEULpp9P+1rW5aCUlqs1JhDuINvnJhl9XbhVpJns0E9fDDQ5kxeWgTI5yeqt6OTz4XxROwgyMPaaH3vYi65Rq+BpC+i+quv307R48aV8nct930Bkw3ZiTXibFs82GM6qkNx9QAS/phuEHaQ6TjATxO5fjKC6OvXusYhV758HtbCtITOCGtrXrJU4e+nFyc1/nF2IW0b++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=8VyiVX8uG0OwppPh6fz8Sxv8sfahQNlNKEKUOhT8HpM=; b=dsIn1m+IVDw9HbkXVcjuJe0aVcesJVVnHmkCkfEw1dwfQM7crumEeXRgj5q0Veo4RqezrJZYKXlmhLlNpwlJPs5fyuLp9Q7s9c6gtu8W7jIYHfUXFn5w1QvNVtu591r7qHxpbGsVsYB7bwXhZ4N0cjXDCu5/d6gcEVbP7OmmCJs= Received: from BN8PR03CA0032.namprd03.prod.outlook.com (2603:10b6:408:94::45) by SA1PR12MB8143.namprd12.prod.outlook.com (2603:10b6:806:333::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:04 +0000 Received: from BN8NAM11FT104.eop-nam11.prod.protection.outlook.com (2603:10b6:408:94:cafe::ae) by BN8PR03CA0032.outlook.office365.com (2603:10b6:408:94::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT104.mail.protection.outlook.com (10.13.177.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02:04 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 5 Jan 2023 11:02:02 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 06/45] drm/amd: Use `amdgpu_ucode_request` helper for SDMA Date: Thu, 5 Jan 2023 11:00:52 -0600 Message-ID: <20230105170138.717-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT104:EE_|SA1PR12MB8143:EE_ X-MS-Office365-Filtering-Correlation-Id: f6802bfe-a618-4580-0ab5-08daef3e91e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PCOVkcp1krYCgyvU6Ql8ODGEwN6N3c1YrJ2Mqn8J3cgPjO8fXdFB/GYsnHFR8J3MGPylEgPjbib0k0QyW0LmB0Qy1yoZpTMXNbmvQxonLTKnDuz9QR7QtV5xbLzagPxpmMvEtmU5FmoVpW+6wUsxbUUyoq1+NH6Wk+4wPK9u+fgXTgMZ7gtAj76KqOsum29M04onio4f4fxzrGs6IdS4CPu2LEzos9OPnUyrAEHHlxi4RKo5rYYQs0i0pGwnPXNY3aY3SX0k2qKsir/iw0fQEHYEgdDO0kGLSJ1xjiU3GwnEsS1faBWQ47ggid6m6uIpVMeDsUgTCA2jD6zD6o/2l+joOpEaj1N3BIqtSjfNFD/HQ06cG4LTsuct+/8ar1duP8gLqvhkPR6/kvEovMbJj5/BqZIlhgFwqWnXMpxDFQTbtQy9y+gzRkJuyNMgKw6qoNCNTL+ZSLaAQ/MXiOv68l6wb1HS+bI2gt8PGfFkcy5PBEzSbzWLJiiM16J2MHhJ9H0mWAhUW1lJgLgUt+o4TLvIfoqpZVQ+rQEehbT7XjnJ7YwgEXAifDYVOOfe9VHHEEXRC2OTi8FND/H9ip/Gt6K+Dx0sGfFIJq0v8rQiHwYReV4gmfDlAIR6+p1IASWR3f4AdLQGwBpGtg2vgrz7OtuKBhBnKe7pQU10wEuuOHfxO1uHzc14KvwwfMjsgTvPnVzHUuBmsGOGZSAg6Fxxc8O+9e3mmlerNOsWPOsDadsUS7web91YY6x3uurnU8YtvvXgE3PZOZfLD+6y4ByIrQ== 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)(376002)(39860400002)(346002)(136003)(451199015)(36840700001)(46966006)(40470700004)(5660300002)(2906002)(44832011)(41300700001)(478600001)(4326008)(8676002)(8936002)(70206006)(110136005)(70586007)(316002)(54906003)(1076003)(2616005)(336012)(26005)(16526019)(7696005)(6666004)(83380400001)(82310400005)(186003)(40480700001)(47076005)(426003)(81166007)(356005)(82740400003)(86362001)(40460700003)(36756003)(36860700001)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:04.0660 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f6802bfe-a618-4580-0ab5-08daef3e91e6 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: BN8NAM11FT104.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8143 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c index ea5278f094c0..a6a491569022 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c @@ -154,16 +154,11 @@ int amdgpu_sdma_process_ecc_irq(struct amdgpu_device *adev, static int amdgpu_sdma_init_inst_ctx(struct amdgpu_sdma_instance *sdma_inst) { - int err = 0; uint16_t version_major; const struct common_firmware_header *header = NULL; const struct sdma_firmware_header_v1_0 *hdr; const struct sdma_firmware_header_v2_0 *hdr_v2; - err = amdgpu_ucode_validate(sdma_inst->fw); - if (err) - return err; - header = (const struct common_firmware_header *) sdma_inst->fw->data; version_major = le16_to_cpu(header->header_version_major); @@ -195,7 +190,7 @@ void amdgpu_sdma_destroy_inst_ctx(struct amdgpu_device *adev, int i; for (i = 0; i < adev->sdma.num_instances; i++) { - release_firmware(adev->sdma.instance[i].fw); + amdgpu_ucode_release(&adev->sdma.instance[i].fw); if (duplicate) break; } @@ -214,7 +209,7 @@ int amdgpu_sdma_init_microcode(struct amdgpu_device *adev, const struct sdma_firmware_header_v2_0 *sdma_hdr; uint16_t version_major; - err = request_firmware(&adev->sdma.instance[instance].fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->sdma.instance[instance].fw, fw_name); if (err) goto out; From patchwork Thu Jan 5 17:00:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090174 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 47D5DC5479D for ; Thu, 5 Jan 2023 17:02:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 21D6010E777; Thu, 5 Jan 2023 17:02:16 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2044.outbound.protection.outlook.com [40.107.93.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8E6C510E76B; Thu, 5 Jan 2023 17:02:08 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DM+GYeHk77NbG6ojUy2uqIriritw1K0BhTy8X57pDWsJAVOHeKqvzObhAdgnL4GHe3EpN1ZERzO6dqONOyKTDo6IBfjD+ucxKuS4cybEBhrymVUqABZu+oO5OcnZTdoENjUVedzvLUnLh27whOx7QvROw7OebKQi1Nk8RdmzrZK2mRoVjX57SxWBZ4k1/crlaP5j7XRPhnxWo1v1WrLODL69C5Y1nxSW+RosfTom6uoWYw/F8jRsAy1ENv4HKQt6SlJZThvNMMrE9cgXyxIQyRyiFn6cDaUg9nb0Rjz484wO52G76SdRcpVK7q4lfu7Vj6LzTUtuWD8XgOLYZz2c0w== 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=M4zbsiQy/fC3u1t72Iv6DdqnTSi7tpWLz9GSdn7lK4w=; b=TtmpXY8BbWnyAAiaBghSDHrvKHu3NB6R4/2lxZpUkbsEMwJsFXyi41Dzh/E8tvh6xXp8ECX2wuU48T1lyBqVqr98yXP/aVr38o3Qtcr4Rxfs04BBu0a2s5LO2XUFtuPwredGSuc7iiPHev6mIKbq+cwDQTm8j5WldffslIMrhxgze39QM/wZEErXLXnkrayRbcA80SCIgHxzJb6o9NfPC7c5Mnx0+ukKTaPkDG+6UkHJzYGGe0o2PX5ubPDi41eLj5qfZI4VHf1M8/mqBAUrNDvMLMtYyxZYEtdAubtYWSrytUzMndS3c5+95pr/niTEHho2Rz4WbWtNuX8Inx8gPA== 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=M4zbsiQy/fC3u1t72Iv6DdqnTSi7tpWLz9GSdn7lK4w=; b=3EJwWuQEFU4r1tLiBSn0VbvflHGBV8ZPLIQIcl0TZ/tH2h45r/jwOOyhpxlEjgWz8j+9Dx0VouTKKLMMATdd4i1+N8h5CofsgprTHh1Vm+SbnotnRc6hVgziNS2i2ZrLINoj0CXfDhdIG7Au45/Kk2yqCR7sFZXwoI/pWlTwfk4= Received: from BN8PR03CA0031.namprd03.prod.outlook.com (2603:10b6:408:94::44) by PH0PR12MB5498.namprd12.prod.outlook.com (2603:10b6:510:d6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:06 +0000 Received: from BN8NAM11FT104.eop-nam11.prod.protection.outlook.com (2603:10b6:408:94:cafe::3e) by BN8PR03CA0031.outlook.office365.com (2603:10b6:408:94::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT104.mail.protection.outlook.com (10.13.177.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02:05 +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; Thu, 5 Jan 2023 11:02:04 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 07/45] drm/amd: Convert SDMA to use `amdgpu_ucode_ip_version_decode` Date: Thu, 5 Jan 2023 11:00:53 -0600 Message-ID: <20230105170138.717-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT104:EE_|PH0PR12MB5498:EE_ X-MS-Office365-Filtering-Correlation-Id: 311779a6-0f6b-403c-e3d4-08daef3e9308 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Jp/X8/wtrc5NSKIl/ajTaAKh0kT+2GHFbY74OWU3Di2PQjnWMbwTXbtleaQohjSowKXR2j03f1IxRa9MGRXzPUbOyrodA9LlH24lVnSxYPTgPUMjnxbmSzWGnnLycdqQH9gNHKJWQC8MgTKXepnRrvtDI8JXvWQ628s3atWvAfy4Jt3uP6tTwB5xNe/oLOjY/MfQZB8v9srEBuumZnsHaA+9k1Eg8gI9+flzr8CgNaAHgi5AeHnZOxGKeL923MJNO7h68GwwKo1svOcdUSH4iXtzUhwWx/kawOu6V7O8+D8KYOYH8opS9LFq5r9xu559nLnBd6zWHvuPrakC9+0bzEEPFNw43Q8Xx5+KgN/hhGomort2YHFaNAuXm5Dfa/LhrvTePoREMtH0t6PCalSvEfkmdzmuJJWIOeJ4ZlwxgmDVzfJTphmn356e0j6KH0Nfk75ayv+zV0/H3joC6QfBTj7tB6IomHHc7iYqD0nmLEVmEhmYy+5fsfvKR38SoCc1aTwcumiOhGCZb8G4INK+WWK+FPjweipnP51icPLfzL3utsS55bGDGs+lUxDhLyYMbmKTOsbmryx5zNkcB+F+0dFxvNNokO4gA23x7bdbn5UdvJmMBR13qEpF9oqFZUzvlO7uKKsI/jYcTtYAkuJmLgkHyp+MvW5aX0qfEV4ZcCd6phGAn6F8z1OwYZZejaN989PWe69ELt7yg/xDBNr3X/J/Dkztc3WGXeEwCkAIVR6KgoKdQBT1xR6b97h/YrfB 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)(136003)(396003)(451199015)(36840700001)(40470700004)(46966006)(44832011)(70586007)(5660300002)(54906003)(8676002)(316002)(2906002)(41300700001)(70206006)(4326008)(8936002)(478600001)(36756003)(36860700001)(6666004)(82310400005)(7696005)(110136005)(426003)(81166007)(2616005)(186003)(47076005)(16526019)(1076003)(83380400001)(86362001)(336012)(40480700001)(356005)(82740400003)(26005)(40460700003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:05.9721 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 311779a6-0f6b-403c-e3d4-08daef3e9308 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: BN8NAM11FT104.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5498 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" , David Airlie , Lijo Lazar , 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`. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 12 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h | 4 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 47 +------------------- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 30 +------------ drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 55 +----------------------- drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c | 25 +---------- 6 files changed, 17 insertions(+), 156 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c index a6a491569022..95e9450f3348 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c @@ -200,15 +200,21 @@ void amdgpu_sdma_destroy_inst_ctx(struct amdgpu_device *adev, } int amdgpu_sdma_init_microcode(struct amdgpu_device *adev, - char *fw_name, u32 instance, - bool duplicate) + u32 instance, bool duplicate) { struct amdgpu_firmware_info *info = NULL; const struct common_firmware_header *header = NULL; int err = 0, i; const struct sdma_firmware_header_v2_0 *sdma_hdr; uint16_t version_major; - + char ucode_prefix[30]; + char fw_name[40]; + + amdgpu_ucode_ip_version_decode(adev, SDMA0_HWIP, ucode_prefix, sizeof(ucode_prefix)); + if (instance == 0) + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix); + else + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s%d.bin", ucode_prefix, i); err = amdgpu_ucode_request(adev, &adev->sdma.instance[instance].fw, fw_name); if (err) goto out; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h index 7d99205c2e01..2d16e6d36728 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h @@ -124,8 +124,8 @@ int amdgpu_sdma_process_ras_data_cb(struct amdgpu_device *adev, int amdgpu_sdma_process_ecc_irq(struct amdgpu_device *adev, struct amdgpu_irq_src *source, struct amdgpu_iv_entry *entry); -int amdgpu_sdma_init_microcode(struct amdgpu_device *adev, - char *fw_name, u32 instance, bool duplicate); +int amdgpu_sdma_init_microcode(struct amdgpu_device *adev, u32 instance, + bool duplicate); void amdgpu_sdma_destroy_inst_ctx(struct amdgpu_device *adev, bool duplicate); void amdgpu_sdma_unset_buffer_funcs_helper(struct amdgpu_device *adev); diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c index 4d780e4430e7..017ae298558e 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c @@ -575,60 +575,17 @@ static void sdma_v4_0_setup_ulv(struct amdgpu_device *adev) // vega10 real chip need to use PSP to load firmware static int sdma_v4_0_init_microcode(struct amdgpu_device *adev) { - const char *chip_name; - char fw_name[30]; int ret, i; - DRM_DEBUG("\n"); - - switch (adev->ip_versions[SDMA0_HWIP][0]) { - case IP_VERSION(4, 0, 0): - chip_name = "vega10"; - break; - case IP_VERSION(4, 0, 1): - chip_name = "vega12"; - break; - case IP_VERSION(4, 2, 0): - chip_name = "vega20"; - break; - case IP_VERSION(4, 1, 0): - case IP_VERSION(4, 1, 1): - if (adev->apu_flags & AMD_APU_IS_RAVEN2) - chip_name = "raven2"; - else if (adev->apu_flags & AMD_APU_IS_PICASSO) - chip_name = "picasso"; - else - chip_name = "raven"; - break; - case IP_VERSION(4, 2, 2): - chip_name = "arcturus"; - break; - case IP_VERSION(4, 1, 2): - if (adev->apu_flags & AMD_APU_IS_RENOIR) - chip_name = "renoir"; - else - chip_name = "green_sardine"; - break; - case IP_VERSION(4, 4, 0): - chip_name = "aldebaran"; - break; - default: - BUG(); - } - for (i = 0; i < adev->sdma.num_instances; i++) { - if (i == 0) - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", chip_name); - else - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma%d.bin", chip_name, i); if (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(4, 2, 2) || adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(4, 4, 0)) { /* Acturus & Aldebaran will leverage the same FW memory for every SDMA instance */ - ret = amdgpu_sdma_init_microcode(adev, fw_name, 0, true); + ret = amdgpu_sdma_init_microcode(adev, 0, true); break; } else { - ret = amdgpu_sdma_init_microcode(adev, fw_name, i, false); + ret = amdgpu_sdma_init_microcode(adev, i, false); if (ret) return ret; } diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c index d4d9f196db83..1941b3b7c5d9 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c @@ -237,39 +237,13 @@ static void sdma_v5_0_init_golden_registers(struct amdgpu_device *adev) // emulation only, won't work on real chip // navi10 real chip need to use PSP to load firmware static int sdma_v5_0_init_microcode(struct amdgpu_device *adev) -{ - const char *chip_name; - char fw_name[40]; - int ret, i; +{ int ret, i; if (amdgpu_sriov_vf(adev) && (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(5, 0, 5))) return 0; - DRM_DEBUG("\n"); - - switch (adev->ip_versions[SDMA0_HWIP][0]) { - case IP_VERSION(5, 0, 0): - chip_name = "navi10"; - break; - case IP_VERSION(5, 0, 2): - chip_name = "navi14"; - break; - case IP_VERSION(5, 0, 5): - chip_name = "navi12"; - break; - case IP_VERSION(5, 0, 1): - chip_name = "cyan_skillfish2"; - break; - default: - BUG(); - } - for (i = 0; i < adev->sdma.num_instances; i++) { - if (i == 0) - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", chip_name); - else - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma1.bin", chip_name); - ret = amdgpu_sdma_init_microcode(adev, fw_name, i, false); + ret = amdgpu_sdma_init_microcode(adev, i, false); if (ret) return ret; } diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c index 65e7a710298d..8e445eb9dd49 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c @@ -89,59 +89,6 @@ static u32 sdma_v5_2_get_reg_offset(struct amdgpu_device *adev, u32 instance, u3 return base + internal_offset; } -/** - * sdma_v5_2_init_microcode - load ucode images from disk - * - * @adev: amdgpu_device pointer - * - * Use the firmware interface to load the ucode images into - * the driver (not loaded into hw). - * Returns 0 on success, error on failure. - */ - -// emulation only, won't work on real chip -// navi10 real chip need to use PSP to load firmware -static int sdma_v5_2_init_microcode(struct amdgpu_device *adev) -{ - const char *chip_name; - char fw_name[40]; - - DRM_DEBUG("\n"); - - switch (adev->ip_versions[SDMA0_HWIP][0]) { - case IP_VERSION(5, 2, 0): - chip_name = "sienna_cichlid_sdma"; - break; - case IP_VERSION(5, 2, 2): - chip_name = "navy_flounder_sdma"; - break; - case IP_VERSION(5, 2, 1): - chip_name = "vangogh_sdma"; - break; - case IP_VERSION(5, 2, 4): - chip_name = "dimgrey_cavefish_sdma"; - break; - case IP_VERSION(5, 2, 5): - chip_name = "beige_goby_sdma"; - break; - case IP_VERSION(5, 2, 3): - chip_name = "yellow_carp_sdma"; - break; - case IP_VERSION(5, 2, 6): - chip_name = "sdma_5_2_6"; - break; - case IP_VERSION(5, 2, 7): - chip_name = "sdma_5_2_7"; - break; - default: - BUG(); - } - - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", chip_name); - - return amdgpu_sdma_init_microcode(adev, fw_name, 0, true); -} - static unsigned sdma_v5_2_ring_init_cond_exec(struct amdgpu_ring *ring) { unsigned ret; @@ -1288,7 +1235,7 @@ static int sdma_v5_2_sw_init(void *handle) return r; } - r = sdma_v5_2_init_microcode(adev); + r = amdgpu_sdma_init_microcode(adev, 0, true); if (r) { DRM_ERROR("Failed to load sdma firmware!\n"); return r; diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c index 049c26a45d85..bf1fa5e8d2f9 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c @@ -78,29 +78,6 @@ static u32 sdma_v6_0_get_reg_offset(struct amdgpu_device *adev, u32 instance, u3 return base + internal_offset; } -/** - * sdma_v6_0_init_microcode - load ucode images from disk - * - * @adev: amdgpu_device pointer - * - * Use the firmware interface to load the ucode images into - * the driver (not loaded into hw). - * Returns 0 on success, error on failure. - */ -static int sdma_v6_0_init_microcode(struct amdgpu_device *adev) -{ - char fw_name[30]; - char ucode_prefix[30]; - - DRM_DEBUG("\n"); - - amdgpu_ucode_ip_version_decode(adev, SDMA0_HWIP, ucode_prefix, sizeof(ucode_prefix)); - - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix); - - return amdgpu_sdma_init_microcode(adev, fw_name, 0, true); -} - static unsigned sdma_v6_0_ring_init_cond_exec(struct amdgpu_ring *ring) { unsigned ret; @@ -1260,7 +1237,7 @@ static int sdma_v6_0_sw_init(void *handle) if (r) return r; - r = sdma_v6_0_init_microcode(adev); + r = amdgpu_sdma_init_microcode(adev, 0, true); if (r) { DRM_ERROR("Failed to load sdma firmware!\n"); return r; From patchwork Thu Jan 5 17:00:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090176 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 C05BFC5479D for ; Thu, 5 Jan 2023 17:02:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0C2A310E77B; Thu, 5 Jan 2023 17:02:22 +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 B33A410E76E; Thu, 5 Jan 2023 17:02:10 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N7pwtlZs3npGX3rYKuepY6MvPo4xfeQcX3JBx+WP/pNvoRCHOXnymuw0rdeG2sisnsPDcZKeE7Ftj6ougBhClPJbCkOdPWem5A6SeMyXnm75w5ijbxUQR6tQpobJYqJkcaY40HiZn75y3Nmbtj++SwJryCaGe2kNsxr/8JCD8hlo0to9LF9wI7zHsi+0/rbHxuawB/3LlUMLBW+2IMhm38cwxm+qd3W7QiJfPWaf1YXFtBDEvw9FaBrBTzPFCwKdrJKs7hHhO2DEWP0R/IcLt88CeK6TjZSLA5HH5n4ZvuT1crmcsMZQ0sOrbRuA+ctgIOcS+uA6vQIcYLieD2fV0A== 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=BDTeGkERtYw9vQ5FVXhBs8l0EiXLNfoEnCUEEIWy724=; b=XMtW7iMfNoUvW7Nsc6SOiKrFoqhsTFsDkMVjlG8ELlyFwEOpfW7+VhKKmSBqbiygeoWtJGtt9yfVlfgLfCgodrJXDLn6etuhBEcISK5ARCa97UnfDzjOME97W5QwnnSB9v/kRvBvYqGAxL7w50S8hrOlv41+Ymhl9IyRoWLgyR5t09CLMGIBguOg6D/tbKQ3qhRUMv/PUZBmg8qVHiVuTKGdFkRCH/5uS90WsmwAoIoW9xo/jD5TPIDDJS3F1DBWSryTCf7nhsYKPJn56NxZPIeYlL9nqSKG5VrPGeggBGEsLaIyHla8Cz0JpeDV6rt2gO9/TvMZM1wQiQhbfAWmCQ== 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=BDTeGkERtYw9vQ5FVXhBs8l0EiXLNfoEnCUEEIWy724=; b=B6BGqGAv6wmi0loHHTQs4id1otV37ikm481ABCpAE4gnSc5OWDYfV8YaOz/Rk55RMKPwSv0vdqSA5HAjt6ImLTnfJ37qMKsB5XQjqKmOx9kypY+0pMrB2vXsuPHu6qTJcZAbG+Xms7jBNW6dE9rbMufRItY3RK7u7WfoXuVFEpo= Received: from BN0PR04CA0107.namprd04.prod.outlook.com (2603:10b6:408:ec::22) by MW4PR12MB5628.namprd12.prod.outlook.com (2603:10b6:303:185::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:08 +0000 Received: from BN8NAM11FT113.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ec:cafe::dd) by BN0PR04CA0107.outlook.office365.com (2603:10b6:408:ec::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT113.mail.protection.outlook.com (10.13.176.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02:07 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 5 Jan 2023 11:02:05 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 08/45] drm/amd: Make SDMA firmware load failures less noisy. Date: Thu, 5 Jan 2023 11:00:54 -0600 Message-ID: <20230105170138.717-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT113:EE_|MW4PR12MB5628:EE_ X-MS-Office365-Filtering-Correlation-Id: e9c89f7f-1ab3-4227-29c3-08daef3e93f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sHwG2dGnusJVJDfB0ZU6c1mZtZn11UgOQ6ahDepuvkT9js0JRvvxVJGg0m5wzxiXR5vRQKO8NWJ/TVLgNe4puCvGrCJs1RVMx/Vz2fMp+N0Fejdn8WMTJsMj8OkEob8TKAI8BL1m7nzyTgsrNoUvSuJtbY4ML9On1dOqQuklGAk9tA+EeSE9vuTzMT9heGYfantYOKRnlqrKyoqZ/LPi2ZpXcJdfK4Ft2wK1YR5iM5E7MiWJkwciHDDFfQHFJgLeCx9CYp7JvRH6LoIGQTZgq4/85igQQhsyWvoR1vY9YpoPDLrtdQ4ZPeMQGLO+M0lWDeuyVPo8AAymQS/K670Z8DcDQLqPFOSiJ4bvAEt7i8xem15AoN33oD2xFooWOz1x1uleGCLSMBODXH9+zY0uLvnEeHfrI7hqwAVOagEEyxcKpCAJi+W9hc5me5T2aSokRyplEVY8L5mXC3gX9AnizQv3jC/pXnw5knQ05HTSOthvbm40I6HbN6GIbQ0XB0q5uQ1UCMblNq2G+4SBjjVBh/rioX9ch7EgyDwgU9yHk3JCnMU89LntarDTsvTrVo9emoLNEGJ+6t6IoqN1mecXT4VzUmlz7ByXaaUj7CRz84bED6uzzRJWZ/gAht6Cb4Lld8hdpwHqK5BHzxTkhmxaeVPVaZI+7YJ76+A1CC9qWbePQCf8LFrbe4qXXY8HQaaxfEWOyZ7GrJN1K5LLhYxu+YdhdfVoqf4H8sYMNCYHD/s= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(396003)(136003)(346002)(39860400002)(376002)(451199015)(36840700001)(40470700004)(46966006)(36860700001)(110136005)(16526019)(478600001)(44832011)(82740400003)(40480700001)(40460700003)(36756003)(5660300002)(2616005)(1076003)(8936002)(70586007)(70206006)(47076005)(4326008)(41300700001)(426003)(356005)(8676002)(6666004)(81166007)(316002)(26005)(82310400005)(7696005)(336012)(86362001)(54906003)(83380400001)(2906002)(186003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:07.0569 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9c89f7f-1ab3-4227-29c3-08daef3e93f1 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: BN8NAM11FT113.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5628 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" , David Airlie , Lijo Lazar , 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. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c index 95e9450f3348..0e1e2521fe25 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c @@ -280,10 +280,8 @@ int amdgpu_sdma_init_microcode(struct amdgpu_device *adev, } out: - if (err) { - DRM_ERROR("SDMA: Failed to init firmware \"%s\"\n", fw_name); + if (err) amdgpu_sdma_destroy_inst_ctx(adev, duplicate); - } return err; } From patchwork Thu Jan 5 17:00:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090173 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 7F6C3C3DA7D for ; Thu, 5 Jan 2023 17:02:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BA5C410E76E; Thu, 5 Jan 2023 17:02:16 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2048.outbound.protection.outlook.com [40.107.220.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2691410E76F; Thu, 5 Jan 2023 17:02:10 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DFVoHtam9PGOZIuqB5VQmXpZixIiz4gIUGAQ2bZgbtSXezVjJld0kCzJcZZ9CkOyFzdFDZJhnzdjAr1At4W+0xJDoQDHTc0lkyG6KQ8RR2eCVXQe8XRBiiWeUpTGpAI/vl5cH2w4TMlDlECNsTiRbwsthW/KmD294aUx+/sY/+2RCGf7ic6UJhJYLItoQ9NCEXBESGl/rlnYNJPTOQhYNdRj8BPnel7po/jKGnN5zHJmhlcLoqg0ekTU7jQF/3vtT4Xpc5b80vBv6LOmpm/NiWREuO0pM4WgRYW0sz9aSajwcn97+bE56ln+b+ocjEYS8owNcn+9bMVLHoyuR6Qqyw== 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=wo5Xw+yjszQ3IXMnYKxZWj1JMqzXR6rotKr7yTUU3jw=; b=n8tLvqgHHbmAD3GyXLEaNpJZE5ShxPiCryoxuG+A3hVwycLtwlH4v3qLLQhVE03uQ6x+LhltKCoyPTkxjiev0zeXEnW7TBD969Ub3YvfQ51qbq49xH9z5x9JpvXLcvrLkTdQO0Fmou1WTOSHUnZTwegYXlgU/irRsTEyu7ZmKc/g6Fx4DOBi0s86TzkKESTpqnu5KnB29T7085rg89S/ntBM+yclu/PZohIg4hIrFwqcU0fTbctGDUL5NgU3Hrv9g6wSkdUwXGwEyZAuilpUdGeKOZpHZrw+Panf0S8loj3VSrTbnJoP3oVrLWTJWQIZ/XczZMl1EpY3USmAUng7nA== 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=wo5Xw+yjszQ3IXMnYKxZWj1JMqzXR6rotKr7yTUU3jw=; b=gRbU8pYJI51noysIopDm16QqCNno7SbwJjjgnfr0UoF+SYxrblIrKv2/044kedLoo+yfIRgqkVBkV7xSlf8wCh5sYjeeozsTcMliDm8OMekGZNF7uPVTzLArp/r7U9ojdh5G6xkbqpw+7+yA/zBMfW89i/j/O2+eGhb8gxEgc7w= Received: from BN0PR04CA0105.namprd04.prod.outlook.com (2603:10b6:408:ec::20) by SN7PR12MB8060.namprd12.prod.outlook.com (2603:10b6:806:343::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:08 +0000 Received: from BN8NAM11FT113.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ec:cafe::38) by BN0PR04CA0105.outlook.office365.com (2603:10b6:408:ec::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT113.mail.protection.outlook.com (10.13.176.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02:08 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 5 Jan 2023 11:02:07 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 09/45] drm/amd: Use `amdgpu_ucode_*` helpers for VCN Date: Thu, 5 Jan 2023 11:00:55 -0600 Message-ID: <20230105170138.717-10-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT113:EE_|SN7PR12MB8060:EE_ X-MS-Office365-Filtering-Correlation-Id: 4045ac63-008d-4f6f-f9ad-08daef3e9484 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MNJajin5x/nysJl7K1e8swfAXQAGSFp8yQzSPnIngeZWVUA9pER17C6/w8zpEGNMA0rA0RrieEAF/oTR5WsdhV2EVadAp9uJhQq63ykrPoqnOOq5/bsCx6IHCEzJe+4BbEYUS6sfoZrk1o5H/xmpgt5+joOfHbZ+M214f7pPuEMvgt2XPa0iYr2dqnco3YgH8WwyjcSS3LYaGdhgVhRsJ+0oC8GCQngWc9TqBkQTmk5SO+rGFukeP6Qd3mhMCcAigAotSwZkKaaUX/5ptksmYdqw6DVOrkZilLJ9yMTPFNXJEQ2B84Z/r7cl61uEUX0ll7e2gLhy/gMms7UB+B6UlTEYuxE4L9/4a0MNYHpMLZaKPZ3j6ymVuDhp59fATDRh4beemeNi2Mkmz0PX0Ym9K46pPQZgrQRV4rbSOCvNI7KMdTulUVTqH+PYINSIhiPnhkvePMIc+tPEfEBAAEi6LgXIUae9QXcTx+3QFBjGZJ60U1gno/zSZkLsCZuZgaZ6XOIsLKA9+FSBjVZ9YRR7cuiVmY26wD+4KvmTLnv/QgCFJ9g+c6E2Hq+HKlhWJdNrK85RKsS5qadQtzA1NQI50sBBCo9TdwCuVykPVEZwmzurj5LtuDAKQ0U0n25uVt8Ly0fPyt8fYibQkqoxqsiHUMfEuKuokiimqWsZHrW78jl1TyfowS+4DUYq5mGM0dpAXQxm6z1DbzrRn8qn4O2HVqbr8pyqnI5XzmBd22Y1/xc7mG9SVzdoPABIMmxHHFhxhW+XjtWeWYxzS534lRDwiw== 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)(46966006)(36840700001)(81166007)(356005)(82740400003)(40480700001)(36756003)(82310400005)(7696005)(40460700003)(86362001)(2616005)(478600001)(16526019)(186003)(1076003)(110136005)(26005)(54906003)(6666004)(70206006)(316002)(4326008)(2906002)(70586007)(36860700001)(426003)(47076005)(8676002)(8936002)(83380400001)(44832011)(336012)(41300700001)(5660300002)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:08.4631 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4045ac63-008d-4f6f-f9ad-08daef3e9484 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: BN8NAM11FT113.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8060 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index a23e26b272b4..b37400107a37 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c @@ -206,19 +206,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev) return -EINVAL; } - r = request_firmware(&adev->vcn.fw, fw_name, adev->dev); + r = amdgpu_ucode_request(adev, &adev->vcn.fw, fw_name); if (r) { - dev_err(adev->dev, "amdgpu_vcn: Can't load firmware \"%s\"\n", - fw_name); - return r; - } - - r = amdgpu_ucode_validate(adev->vcn.fw); - if (r) { - dev_err(adev->dev, "amdgpu_vcn: Can't validate firmware \"%s\"\n", - fw_name); - release_firmware(adev->vcn.fw); - adev->vcn.fw = NULL; + amdgpu_ucode_release(&adev->vcn.fw); return r; } @@ -333,7 +323,7 @@ int amdgpu_vcn_sw_fini(struct amdgpu_device *adev) amdgpu_ring_fini(&adev->vcn.inst[j].ring_enc[i]); } - release_firmware(adev->vcn.fw); + amdgpu_ucode_release(&adev->vcn.fw); mutex_destroy(&adev->vcn.vcn1_jpeg1_workaround); mutex_destroy(&adev->vcn.vcn_pg_lock); From patchwork Thu Jan 5 17:00:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090172 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 D08ABC54EBD for ; Thu, 5 Jan 2023 17:02:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 34B3D10E77A; Thu, 5 Jan 2023 17:02:16 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2062.outbound.protection.outlook.com [40.107.223.62]) by gabe.freedesktop.org (Postfix) with ESMTPS id 071FA10E76E; Thu, 5 Jan 2023 17:02:13 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=erDoW6yqG0K957VTA0u5ltcZlxmkiPApy/kFvf+A8QL6/a0l7oRBcWOEHcCD2KKbNVS9WyyfJtWbwl2IAzye7sC6+Q/M73tTgjM568t6rh2tSEky1UdjoMFKuZVMtMU8QKsg/mthAZo8W88VI3JPWjwaZRZcEwtl0BNP4ypx7YllajmI4KmADWlLy8Ww+C7VxpynQur+obqb5LhhrcsEkMWoTBcojV/Get1G0TkVNGZjD09NOGMZxVe8844tXdr17+/Ey8jzeGBQfFt1c+57rLSyster95orIS7YcOKmfJDtVy8+dgtDQ/7Ya2SoG5wzFmhvLntM79938XShGiAkbQ== 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=kPslT2pJVW6R0ETsW1wEswJDQxUOgm4yjR2syhjKgvQ=; b=hyS02r9gcDHQVPmYfXu8dqm87agmnJTo0cc9Xttwu3w7PFGJqZkx7mahprmk6i36Ufe29BmvqzKlMlEF3FPiYwnJcdKNHfOX8gL0ghx4EOgvGH5e5+/BqWiPLW1ffCJmL84W0qJ3SJE4xfe4GQoMFloC7SKZWSGr5ExYi8zkXflNDi67s8EqpyV/q8Q1mXIEvdZL/IqnC2xq2etlXcfidVTb3/FgqkJTKdhDBwlM4sSw13nXwbrH/FScHBCoDDK7axCxnwKGE3KBAatds8NxJf2lejoW65elKoJAPSYVDeFYL8Cc/NtR94xMYEpdHrEcAFAve7rKkOoGZEUMJyQBjw== 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=kPslT2pJVW6R0ETsW1wEswJDQxUOgm4yjR2syhjKgvQ=; b=o1qRfVSIL3Ar+BP3A23tdB59QbEcpLeDHZml3Bu6pnr3oX418wJpNGsR6H7iDbxi4X4TIsSzezqJMCZpjmyAlc1hCmYA/PMkxwVKPCLFW/5aardbXZSFVWaL8euD6JCmal6eztotU4pr/PX47Ng2qiyFaHl2M9+GrjUG9tgyAL0= Received: from BN9PR03CA0368.namprd03.prod.outlook.com (2603:10b6:408:f7::13) by SJ0PR12MB8167.namprd12.prod.outlook.com (2603:10b6:a03:4e6::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:11 +0000 Received: from BN8NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f7:cafe::9f) by BN9PR03CA0368.outlook.office365.com (2603:10b6:408:f7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:10 +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 BN8NAM11FT023.mail.protection.outlook.com (10.13.177.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02:10 +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; Thu, 5 Jan 2023 11:02:08 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 10/45] drm/amd: Load VCN microcode during early_init Date: Thu, 5 Jan 2023 11:00:56 -0600 Message-ID: <20230105170138.717-11-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT023:EE_|SJ0PR12MB8167:EE_ X-MS-Office365-Filtering-Correlation-Id: 31cc690a-ede1-4416-a89f-08daef3e95b0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 52O0Da6ArnBvQBggASAwcnaQL+YHQnO5IywaZvzrQUgoDSY25ThGU+LfuoPEIZnU1Q7R8tiR7tM8bYsaJbJ8JB2Tmo5gwejLGeuN2f8KmBp8VEss2ZKMoheDFLxEhlA+lqWNSeTSsuohW+zsR1c/idMRHbzubEZ0JeueCpZXmQMRMrkaF+1zu9YpogJKNHk3Qmyvcb3BiIBQq3WrEIJT4uIlAUKUy3z57UgdSE/gI+m6ktnYvpYw1tcG+yIRUanf0Bu8PEXMcuXdoVzTIX1gCFxor8uMj0AoUJDsRweoodWWtXIIgFQa2oxT2i0iXtwrK0+JN1NnrUC068fxhS1Xj24VCWSBJ5vpe8Vg0UC+3DuX9AwY/FbeRuso7FvFn+8IxCZs708jNtS46gRpex9TKOvmjSs6zJbTb7h7AZ3VhtlWCb/8d6Hm/vHGBplRC3IL0QwO6cGQ4zr0OQ4whvh//TgZMXSX2aq+Sm/Y7qDoOheG66WA/7paWaeu2VbJ0Mdw2HriJr33PpMqPmS3qukU20p2sKcFywLo1ZSsD+XNfqm43kbfYJ5HJNC0izaaevNuQ6xFAIScUMlAFk8MQY+cVL+EdSvVm/wTfWLoAyEIyivIqyA4UHfyvJdO0YQU7uLQ1TAGrkRAJRpj71xn+3NiRQWWQdNtThUjKpkCltNKaDQjYOEWyCvV6v+kMJxdcqPISD2m5DNVwFMCgszGsQr9Ms+VYpBaYOfLZFw8+6cwiv4= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(136003)(376002)(396003)(39860400002)(451199015)(40470700004)(36840700001)(46966006)(426003)(47076005)(83380400001)(16526019)(1076003)(40480700001)(26005)(7696005)(2616005)(336012)(6666004)(82310400005)(186003)(86362001)(36756003)(36860700001)(82740400003)(81166007)(40460700003)(356005)(316002)(8676002)(41300700001)(4326008)(8936002)(2906002)(30864003)(5660300002)(44832011)(478600001)(110136005)(70586007)(70206006)(54906003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:10.4271 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 31cc690a-ede1-4416-a89f-08daef3e95b0 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: BN8NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB8167 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" , David Airlie , Lijo Lazar , 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. Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Fix whitespace problem in firmware file names * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 53 +++++++------------------ 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, 31 insertions(+), 48 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index b37400107a37..0fb9a6d23065 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c @@ -80,10 +80,24 @@ MODULE_FIRMWARE(FIRMWARE_VCN4_0_4); static void amdgpu_vcn_idle_work_handler(struct work_struct *work); +int amdgpu_vcn_early_init(struct amdgpu_device *adev) +{ + char ucode_prefix[30]; + char fw_name[40]; + int r; + + amdgpu_ucode_ip_version_decode(adev, UVD_HWIP, ucode_prefix, sizeof(ucode_prefix)); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix); + r = amdgpu_ucode_request(adev, &adev->vcn.fw, fw_name); + if (r) + amdgpu_ucode_release(&adev->vcn.fw); + + return r; +} + int amdgpu_vcn_sw_init(struct amdgpu_device *adev) { unsigned long bo_size; - const char *fw_name; const struct common_firmware_header *hdr; unsigned char fw_check; unsigned int fw_shared_size, log_offset; @@ -99,46 +113,27 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev) switch (adev->ip_versions[UVD_HWIP][0]) { case IP_VERSION(1, 0, 0): case IP_VERSION(1, 0, 1): - if (adev->apu_flags & AMD_APU_IS_RAVEN2) - fw_name = FIRMWARE_RAVEN2; - else if (adev->apu_flags & AMD_APU_IS_PICASSO) - fw_name = FIRMWARE_PICASSO; - else - fw_name = FIRMWARE_RAVEN; - break; case IP_VERSION(2, 5, 0): - fw_name = FIRMWARE_ARCTURUS; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(2, 2, 0): - if (adev->apu_flags & AMD_APU_IS_RENOIR) - fw_name = FIRMWARE_RENOIR; - else - fw_name = FIRMWARE_GREEN_SARDINE; - if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(2, 6, 0): - fw_name = FIRMWARE_ALDEBARAN; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(2, 0, 0): - fw_name = FIRMWARE_NAVI10; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(2, 0, 2): - if (adev->asic_type == CHIP_NAVI12) - fw_name = FIRMWARE_NAVI12; - else - fw_name = FIRMWARE_NAVI14; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; @@ -146,58 +141,46 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev) case IP_VERSION(3, 0, 0): case IP_VERSION(3, 0, 64): case IP_VERSION(3, 0, 192): - if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0)) - fw_name = FIRMWARE_SIENNA_CICHLID; - else - fw_name = FIRMWARE_NAVY_FLOUNDER; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(3, 0, 2): - fw_name = FIRMWARE_VANGOGH; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(3, 0, 16): - fw_name = FIRMWARE_DIMGREY_CAVEFISH; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(3, 0, 33): - fw_name = FIRMWARE_BEIGE_GOBY; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(3, 1, 1): - fw_name = FIRMWARE_YELLOW_CARP; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(3, 1, 2): - fw_name = FIRMWARE_VCN_3_1_2; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(4, 0, 0): - fw_name = FIRMWARE_VCN4_0_0; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(4, 0, 2): - fw_name = FIRMWARE_VCN4_0_2; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; break; case IP_VERSION(4, 0, 4): - fw_name = FIRMWARE_VCN4_0_4; if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) adev->vcn.indirect_sram = true; @@ -206,12 +189,6 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev) return -EINVAL; } - r = amdgpu_ucode_request(adev, &adev->vcn.fw, fw_name); - if (r) { - amdgpu_ucode_release(&adev->vcn.fw); - return r; - } - hdr = (const struct common_firmware_header *)adev->vcn.fw->data; adev->vcn.fw_version = le32_to_cpu(hdr->ucode_version); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h index dbb8d68a30c6..d3e2af902907 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h @@ -369,6 +369,7 @@ enum vcn_ring_type { VCN_UNIFIED_RING, }; +int amdgpu_vcn_early_init(struct amdgpu_device *adev); int amdgpu_vcn_sw_init(struct amdgpu_device *adev); int amdgpu_vcn_sw_fini(struct amdgpu_device *adev); int amdgpu_vcn_suspend(struct amdgpu_device *adev); diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c index f0fbcda76f5e..c305b2cb8490 100644 --- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c @@ -57,11 +57,12 @@ static void vcn_v1_0_idle_work_handler(struct work_struct *work); static void vcn_v1_0_ring_begin_use(struct amdgpu_ring *ring); /** - * vcn_v1_0_early_init - set function pointers + * vcn_v1_0_early_init - set function pointers and load microcode * * @handle: amdgpu_device pointer * * Set ring and irq function pointers + * Load microcode from filesystem */ static int vcn_v1_0_early_init(void *handle) { @@ -75,7 +76,7 @@ static int vcn_v1_0_early_init(void *handle) jpeg_v1_0_early_init(handle); - return 0; + return amdgpu_vcn_early_init(adev); } /** diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c index 08871bad9994..4b4cd88414e0 100644 --- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c @@ -62,11 +62,12 @@ static int vcn_v2_0_pause_dpg_mode(struct amdgpu_device *adev, int inst_idx, struct dpg_pause_state *new_state); static int vcn_v2_0_start_sriov(struct amdgpu_device *adev); /** - * vcn_v2_0_early_init - set function pointers + * vcn_v2_0_early_init - set function pointers and load microcode * * @handle: amdgpu_device pointer * * Set ring and irq function pointers + * Load microcode from filesystem */ static int vcn_v2_0_early_init(void *handle) { @@ -81,7 +82,7 @@ static int vcn_v2_0_early_init(void *handle) vcn_v2_0_set_enc_ring_funcs(adev); vcn_v2_0_set_irq_funcs(adev); - return 0; + return amdgpu_vcn_early_init(adev); } /** diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c index ec87b00f2e05..b0b0e69c6a94 100644 --- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c @@ -71,11 +71,12 @@ static int amdgpu_ih_clientid_vcns[] = { }; /** - * vcn_v2_5_early_init - set function pointers + * vcn_v2_5_early_init - set function pointers and load microcode * * @handle: amdgpu_device pointer * * Set ring and irq function pointers + * Load microcode from filesystem */ static int vcn_v2_5_early_init(void *handle) { @@ -107,7 +108,7 @@ static int vcn_v2_5_early_init(void *handle) vcn_v2_5_set_irq_funcs(adev); vcn_v2_5_set_ras_funcs(adev); - return 0; + return amdgpu_vcn_early_init(adev); } /** diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c index 9c8b5fd99037..bd228512424a 100644 --- a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c @@ -78,11 +78,12 @@ static void vcn_v3_0_dec_ring_set_wptr(struct amdgpu_ring *ring); static void vcn_v3_0_enc_ring_set_wptr(struct amdgpu_ring *ring); /** - * vcn_v3_0_early_init - set function pointers + * vcn_v3_0_early_init - set function pointers and load microcode * * @handle: amdgpu_device pointer * * Set ring and irq function pointers + * Load microcode from filesystem */ static int vcn_v3_0_early_init(void *handle) { @@ -109,7 +110,7 @@ static int vcn_v3_0_early_init(void *handle) vcn_v3_0_set_enc_ring_funcs(adev); vcn_v3_0_set_irq_funcs(adev); - return 0; + return amdgpu_vcn_early_init(adev); } /** diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c index 1e2b22299975..a79b6088374b 100644 --- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c @@ -68,11 +68,12 @@ static void vcn_v4_0_unified_ring_set_wptr(struct amdgpu_ring *ring); static void vcn_v4_0_set_ras_funcs(struct amdgpu_device *adev); /** - * vcn_v4_0_early_init - set function pointers + * vcn_v4_0_early_init - set function pointers and load microcode * * @handle: amdgpu_device pointer * * Set ring and irq function pointers + * Load microcode from filesystem */ static int vcn_v4_0_early_init(void *handle) { @@ -88,7 +89,7 @@ static int vcn_v4_0_early_init(void *handle) vcn_v4_0_set_irq_funcs(adev); vcn_v4_0_set_ras_funcs(adev); - return 0; + return amdgpu_vcn_early_init(adev); } /** From patchwork Thu Jan 5 17:00:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090177 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 C659FC3DA7D for ; Thu, 5 Jan 2023 17:02:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5BBAC10E782; Thu, 5 Jan 2023 17:02:23 +0000 (UTC) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2041.outbound.protection.outlook.com [40.107.101.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id E3C3010E775; Thu, 5 Jan 2023 17:02:16 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oduTeLER6AWCCgeslmNp5iE99+4FqK4fficliG+KAKfDNvGi1N+a7rePaD3yZiOVb9FYT3eViyVIoHeWpBo3nPeuvxw74XSSq+5Pv9KQkGZKxQtVO+mc9R4As2v70BVBKVtejbGce6WtJl1AOtcKwdaEtuwGmbu5qdJ4V0CFrjzwU7dwEQ75RXJnB+5nIVzGedOGvUONs71ypAaP5sWEHIIOhu97VmFXeZ5lt/1nmzOa+JxBlkzlea4Npe8O1Ou1ZqJsmtjsgVug8/4hP6W5RwBdKBgNj27geCvoxD1NTTg85dMCeiNQ/DtwtVH+Tow54cVDfa2hWv/WhkihU6SZ7g== 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=LgVzh8QGHal7m77YNWni86c6a9O9/MQJWN5+1u5oDf8=; b=V8bKO8F06SsSFtcDfVGr3vMhX1g48pR2AHN2nQ/3SYH0UuGF8RArLkWK4imrMRwWi+xaz5m7faXQs6GUBMMVb+E8YZitc5LmD/h8EN/mWtOAlrfNzQnAjEYmOldGDYoSoO9I4fZ2fg7Kr1hZ1zgflH1L6Xbb397bE3CZNumMLJrOpnZo2Ex4E3O6VedZoRamWyTuaU8+Vcic/IB8Yh4fzWF34qpXZkn7iwqouy6E2YAJm9gY1Zrx0Zekfuza9SulDf/aKtZrW5vXHUfu+QMKrCrUdWk31gPJ6sef8JmTbSxH+AykktiGGvw5l+SlFdaAifJXSqoTAZLNtseze49FIQ== 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=LgVzh8QGHal7m77YNWni86c6a9O9/MQJWN5+1u5oDf8=; b=P9d2a1N5lDtEkCJdOkqbZD0dFWjSc5oO6kkK9B99zepJz1uXEetzXEAv2BufqUdcSDfbJehMtE+Cyajld9JE24Dd5pHBsy2oeUGW4x83MpV7PKNB/0bV02J+kRH4IqeqUzBtITW4dDwM+g78MsmTo2XD2LACN1HccvBootgoJH8= Received: from BN9PR03CA0389.namprd03.prod.outlook.com (2603:10b6:408:f7::34) by MW3PR12MB4428.namprd12.prod.outlook.com (2603:10b6:303:57::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:14 +0000 Received: from BN8NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f7:cafe::2f) by BN9PR03CA0389.outlook.office365.com (2603:10b6:408:f7::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02:12 +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 BN8NAM11FT023.mail.protection.outlook.com (10.13.177.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02:12 +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; Thu, 5 Jan 2023 11:02:10 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 11/45] drm/amd: Load MES microcode during early_init Date: Thu, 5 Jan 2023 11:00:57 -0600 Message-ID: <20230105170138.717-12-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT023:EE_|MW3PR12MB4428:EE_ X-MS-Office365-Filtering-Correlation-Id: f37754bd-fdec-46ea-8416-08daef3e96b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mzx6j/ro2O70J2kYhN5XK1WPUdGzaComa9feN5pqWINymh6UL+dcKnUrXT/S+DHnIyMwTYXetw2JCF2NyB8+prCuKuVFpUj/aKhcERQT9gALf0RgXpU2v3rdjosxvdY8J5H4ENpIX/RTfhChmI2RC4HUMmxn+TuMKhQhCly6q2f0z7uh6RSJ8Wrhydts9VqODePJd4IPqokDhFRcqWVUzglRZVxh8Obkbe38oeikYGNnfMxksbc6sP9MAUKH4TGvieHViYOYpiCNWxjJbXGkOjc9Q72pO6kto3D3KDS0b2ob07pWbERKYhCwj/IWtnocroWX5PyxZDySR8BedPvs3DaFBeMOUo1d+3vDwHFMJLe1iiKEMs/VT+6XPZpPRLmxFG6PEQRW5kcp73L2AXKjBZbkN6KsyEfDRY3lw90mtjgt00v1S481HARIK5g59tKtrDsiz/jihaHmZpiLnrKrjeLQ/AVHEehcJVCnWgQ9KZc/dsemGFhidsSdMNXdnR/xCs9Mw6YOqkjBAcKxm9K/JkYXyerB0Xs5Y7PodKxCAK4AqZoqTpP3ZW0c8IZsTfClK2zOkbe1HjXcw3HH4Nh4E0kKmUcCKF91jsydMhSKNpC0owC9L4QaEhvuzeWz3dXMcfn1p3k7i1FFT1LAmgtUzY+KlAYH5ZfnjHWZa3A3KnLcLCsF8cnPFeVaJ7LsGFbvxqn0DOXQT/15d+dnT9yraAPyzjrdHCyYXl+Xj0Nk7ZI= 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)(396003)(346002)(376002)(451199015)(46966006)(36840700001)(40470700004)(40460700003)(40480700001)(356005)(36756003)(426003)(8676002)(336012)(1076003)(41300700001)(5660300002)(47076005)(83380400001)(30864003)(478600001)(8936002)(44832011)(6666004)(26005)(186003)(70206006)(7696005)(4326008)(16526019)(110136005)(2616005)(70586007)(316002)(81166007)(86362001)(54906003)(82310400005)(2906002)(82740400003)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:12.1301 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f37754bd-fdec-46ea-8416-08daef3e96b4 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: BN8NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4428 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" , David Airlie , Lijo Lazar , 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. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 65 +++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 1 + drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 97 +++++-------------------- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 88 +++++----------------- 4 files changed, 100 insertions(+), 151 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c index 0c546245793b..dd8f35234507 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c @@ -21,6 +21,8 @@ * */ +#include + #include "amdgpu_mes.h" #include "amdgpu.h" #include "soc15_common.h" @@ -1423,3 +1425,66 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev) kfree(vm); return 0; } + +int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe) +{ + const struct mes_firmware_header_v1_0 *mes_hdr; + struct amdgpu_firmware_info *info; + char ucode_prefix[30]; + char fw_name[40]; + int r; + + amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix)); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin", + ucode_prefix, + pipe == AMDGPU_MES_SCHED_PIPE ? "" : "1"); + r = request_firmware(&adev->mes.fw[pipe], fw_name, adev->dev); + if (r) + goto out; + + r = amdgpu_ucode_validate(adev->mes.fw[pipe]); + if (r) + goto out; + + mes_hdr = (const struct mes_firmware_header_v1_0 *) + adev->mes.fw[pipe]->data; + adev->mes.uc_start_addr[pipe] = + le32_to_cpu(mes_hdr->mes_uc_start_addr_lo) | + ((uint64_t)(le32_to_cpu(mes_hdr->mes_uc_start_addr_hi)) << 32); + adev->mes.data_start_addr[pipe] = + le32_to_cpu(mes_hdr->mes_data_start_addr_lo) | + ((uint64_t)(le32_to_cpu(mes_hdr->mes_data_start_addr_hi)) << 32); + + if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) { + int ucode, ucode_data; + + if (pipe == AMDGPU_MES_SCHED_PIPE) { + ucode = AMDGPU_UCODE_ID_CP_MES; + ucode_data = AMDGPU_UCODE_ID_CP_MES_DATA; + } else { + ucode = AMDGPU_UCODE_ID_CP_MES1; + ucode_data = AMDGPU_UCODE_ID_CP_MES1_DATA; + } + + info = &adev->firmware.ucode[ucode]; + info->ucode_id = ucode; + info->fw = adev->mes.fw[pipe]; + adev->firmware.fw_size += + ALIGN(le32_to_cpu(mes_hdr->mes_ucode_size_bytes), + PAGE_SIZE); + + info = &adev->firmware.ucode[ucode_data]; + info->ucode_id = ucode_data; + info->fw = adev->mes.fw[pipe]; + adev->firmware.fw_size += + ALIGN(le32_to_cpu(mes_hdr->mes_ucode_data_size_bytes), + PAGE_SIZE); + } + + return 0; + +out: + release_firmware(adev->mes.fw[pipe]); + adev->mes.fw[pipe] = NULL; + return r; +} diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h index 97c05d08a551..547ec35691fa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h @@ -306,6 +306,7 @@ struct amdgpu_mes_funcs { int amdgpu_mes_ctx_get_offs(struct amdgpu_ring *ring, unsigned int id_offs); +int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe); int amdgpu_mes_init(struct amdgpu_device *adev); void amdgpu_mes_fini(struct amdgpu_device *adev); diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c index 614394118a53..9c5ff8b7c202 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c @@ -379,82 +379,6 @@ static const struct amdgpu_mes_funcs mes_v10_1_funcs = { .resume_gang = mes_v10_1_resume_gang, }; -static int mes_v10_1_init_microcode(struct amdgpu_device *adev, - enum admgpu_mes_pipe pipe) -{ - const char *chip_name; - char fw_name[30]; - int err; - const struct mes_firmware_header_v1_0 *mes_hdr; - struct amdgpu_firmware_info *info; - - switch (adev->ip_versions[GC_HWIP][0]) { - case IP_VERSION(10, 1, 10): - chip_name = "navi10"; - break; - case IP_VERSION(10, 3, 0): - chip_name = "sienna_cichlid"; - break; - default: - BUG(); - } - - if (pipe == AMDGPU_MES_SCHED_PIPE) - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes.bin", - chip_name); - else - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes1.bin", - chip_name); - - err = request_firmware(&adev->mes.fw[pipe], fw_name, adev->dev); - if (err) - return err; - - err = amdgpu_ucode_validate(adev->mes.fw[pipe]); - if (err) { - release_firmware(adev->mes.fw[pipe]); - adev->mes.fw[pipe] = NULL; - return err; - } - - mes_hdr = (const struct mes_firmware_header_v1_0 *) - adev->mes.fw[pipe]->data; - adev->mes.uc_start_addr[pipe] = - le32_to_cpu(mes_hdr->mes_uc_start_addr_lo) | - ((uint64_t)(le32_to_cpu(mes_hdr->mes_uc_start_addr_hi)) << 32); - adev->mes.data_start_addr[pipe] = - le32_to_cpu(mes_hdr->mes_data_start_addr_lo) | - ((uint64_t)(le32_to_cpu(mes_hdr->mes_data_start_addr_hi)) << 32); - - if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) { - int ucode, ucode_data; - - if (pipe == AMDGPU_MES_SCHED_PIPE) { - ucode = AMDGPU_UCODE_ID_CP_MES; - ucode_data = AMDGPU_UCODE_ID_CP_MES_DATA; - } else { - ucode = AMDGPU_UCODE_ID_CP_MES1; - ucode_data = AMDGPU_UCODE_ID_CP_MES1_DATA; - } - - info = &adev->firmware.ucode[ucode]; - info->ucode_id = ucode; - info->fw = adev->mes.fw[pipe]; - adev->firmware.fw_size += - ALIGN(le32_to_cpu(mes_hdr->mes_ucode_size_bytes), - PAGE_SIZE); - - info = &adev->firmware.ucode[ucode_data]; - info->ucode_id = ucode_data; - info->fw = adev->mes.fw[pipe]; - adev->firmware.fw_size += - ALIGN(le32_to_cpu(mes_hdr->mes_ucode_data_size_bytes), - PAGE_SIZE); - } - - return 0; -} - static void mes_v10_1_free_microcode(struct amdgpu_device *adev, enum admgpu_mes_pipe pipe) { @@ -1019,10 +943,6 @@ static int mes_v10_1_sw_init(void *handle) if (!adev->enable_mes_kiq && pipe == AMDGPU_MES_KIQ_PIPE) continue; - r = mes_v10_1_init_microcode(adev, pipe); - if (r) - return r; - r = mes_v10_1_allocate_eop_buf(adev, pipe); if (r) return r; @@ -1229,6 +1149,22 @@ static int mes_v10_1_resume(void *handle) return amdgpu_mes_resume(adev); } +static int mes_v10_0_early_init(void *handle) +{ + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + int pipe, r; + + for (pipe = 0; pipe < AMDGPU_MAX_MES_PIPES; pipe++) { + if (!adev->enable_mes_kiq && pipe == AMDGPU_MES_KIQ_PIPE) + continue; + r = amdgpu_mes_init_microcode(adev, pipe); + if (r) + return r; + } + + return 0; +} + static int mes_v10_0_late_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -1241,6 +1177,7 @@ static int mes_v10_0_late_init(void *handle) static const struct amd_ip_funcs mes_v10_1_ip_funcs = { .name = "mes_v10_1", + .early_init = mes_v10_0_early_init, .late_init = mes_v10_0_late_init, .sw_init = mes_v10_1_sw_init, .sw_fini = mes_v10_1_sw_fini, diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c index 970b066b37bb..3af77a32baac 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c @@ -459,73 +459,6 @@ static const struct amdgpu_mes_funcs mes_v11_0_funcs = { .misc_op = mes_v11_0_misc_op, }; -static int mes_v11_0_init_microcode(struct amdgpu_device *adev, - enum admgpu_mes_pipe pipe) -{ - char fw_name[30]; - char ucode_prefix[30]; - int err; - const struct mes_firmware_header_v1_0 *mes_hdr; - struct amdgpu_firmware_info *info; - - amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix)); - - if (pipe == AMDGPU_MES_SCHED_PIPE) - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes.bin", - ucode_prefix); - else - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes1.bin", - ucode_prefix); - - err = request_firmware(&adev->mes.fw[pipe], fw_name, adev->dev); - if (err) - return err; - - err = amdgpu_ucode_validate(adev->mes.fw[pipe]); - if (err) { - release_firmware(adev->mes.fw[pipe]); - adev->mes.fw[pipe] = NULL; - return err; - } - - mes_hdr = (const struct mes_firmware_header_v1_0 *) - adev->mes.fw[pipe]->data; - adev->mes.uc_start_addr[pipe] = - le32_to_cpu(mes_hdr->mes_uc_start_addr_lo) | - ((uint64_t)(le32_to_cpu(mes_hdr->mes_uc_start_addr_hi)) << 32); - adev->mes.data_start_addr[pipe] = - le32_to_cpu(mes_hdr->mes_data_start_addr_lo) | - ((uint64_t)(le32_to_cpu(mes_hdr->mes_data_start_addr_hi)) << 32); - - if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) { - int ucode, ucode_data; - - if (pipe == AMDGPU_MES_SCHED_PIPE) { - ucode = AMDGPU_UCODE_ID_CP_MES; - ucode_data = AMDGPU_UCODE_ID_CP_MES_DATA; - } else { - ucode = AMDGPU_UCODE_ID_CP_MES1; - ucode_data = AMDGPU_UCODE_ID_CP_MES1_DATA; - } - - info = &adev->firmware.ucode[ucode]; - info->ucode_id = ucode; - info->fw = adev->mes.fw[pipe]; - adev->firmware.fw_size += - ALIGN(le32_to_cpu(mes_hdr->mes_ucode_size_bytes), - PAGE_SIZE); - - info = &adev->firmware.ucode[ucode_data]; - info->ucode_id = ucode_data; - info->fw = adev->mes.fw[pipe]; - adev->firmware.fw_size += - ALIGN(le32_to_cpu(mes_hdr->mes_ucode_data_size_bytes), - PAGE_SIZE); - } - - return 0; -} - static void mes_v11_0_free_microcode(struct amdgpu_device *adev, enum admgpu_mes_pipe pipe) { @@ -1100,10 +1033,6 @@ static int mes_v11_0_sw_init(void *handle) if (!adev->enable_mes_kiq && pipe == AMDGPU_MES_KIQ_PIPE) continue; - r = mes_v11_0_init_microcode(adev, pipe); - if (r) - return r; - r = mes_v11_0_allocate_eop_buf(adev, pipe); if (r) return r; @@ -1338,6 +1267,22 @@ static int mes_v11_0_resume(void *handle) return amdgpu_mes_resume(adev); } +static int mes_v11_0_early_init(void *handle) +{ + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + int pipe, r; + + for (pipe = 0; pipe < AMDGPU_MAX_MES_PIPES; pipe++) { + if (!adev->enable_mes_kiq && pipe == AMDGPU_MES_KIQ_PIPE) + continue; + r = amdgpu_mes_init_microcode(adev, pipe); + if (r) + return r; + } + + return 0; +} + static int mes_v11_0_late_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -1352,6 +1297,7 @@ static int mes_v11_0_late_init(void *handle) static const struct amd_ip_funcs mes_v11_0_ip_funcs = { .name = "mes_v11_0", + .early_init = mes_v11_0_early_init, .late_init = mes_v11_0_late_init, .sw_init = mes_v11_0_sw_init, .sw_fini = mes_v11_0_sw_fini, From patchwork Thu Jan 5 17:00:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090175 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 E8434C54EBC for ; Thu, 5 Jan 2023 17:02:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EA7F510E778; Thu, 5 Jan 2023 17:02:21 +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 166E210E77B; Thu, 5 Jan 2023 17:02:17 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TEsculBJslwqHsMT6RMrsLyBz56MBuui32iBIPLIc3SwldBYx69/N+NtzaNczWTxnq5WBNROIsDxCow2Nd3PUHz3wO1ppZlPu+3B1/CXC6xkE2LU+mfWAE5gVsRbzTnajF9wIp4OLRFPkg25cYMQbFYTn55hVYVS/BOxoLSN5JTrnp8fnOgY9v6WdJzEJi67B1oGL/DTCSwlJuC+g8ucQBi6LaRas9GVnX2/FWdWhpgOm7S3bPNQKNYTengq8aypuCPKh+4dJAkh16Mymdjs5NeQAkIZr8H2EzvhpjwxWO3iYYHo73S84Kyoto6pOa1vtiqHCuoOuv/+9s0/Mg1Kfw== 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=F5P5dGWbg82Uh7g1BUc5vpMngNBiQdDSCX9/8s9yMdY=; b=F7rK7ScN3/LSFBwlnmtW9N86bbe0UVI12Ahl4wrkoJHknNHEv/O+eAtKOQ7gbhc8sLm0DO75FRltlyy0a0NvsZHEove5bUuZcEXanEBfy5UL1uNrAgNjxZ3QeKRGi8DKkBcZVkLT9bkuKttRM09hs8/akFqqgJOJ6JSBteMRFM1Rvkxetg25JNMKLjcdkG4Y20JUaY960vtJRtmgLnMeHwSUqVkPOtwhddLdpRJc4cqEBWdv6QOICp1/9twbCrHiEOrCcfeFx0hqPPKbFmF/YVrum2MENBZWsPfBmee7SrXRUVJrd82DvSbl76cUFa7lWIuvY/4TYUt7O/8t0YAikQ== 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=F5P5dGWbg82Uh7g1BUc5vpMngNBiQdDSCX9/8s9yMdY=; b=oYDAJ1nCavKIawPVdOvpLOnzhxNlaQOyIJ3zSJgWDsEo2k+DXS0N4XmXQWogl1Q77Pxqgp9vY/G8bqAcUEwcmHdSd78YG56XRV0YOHdUZemWEHb2cRI9ZtaN5+iQlv1r6ago1wGjiHTCkYeZLNZXWiylJIeEVUKeGVDgNX4F1S0= Received: from BN9PR03CA0361.namprd03.prod.outlook.com (2603:10b6:408:f7::6) by MN0PR12MB5930.namprd12.prod.outlook.com (2603:10b6:208:37d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:14 +0000 Received: from BN8NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f7:cafe::b8) by BN9PR03CA0361.outlook.office365.com (2603:10b6:408:f7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:14 +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 BN8NAM11FT023.mail.protection.outlook.com (10.13.177.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02:14 +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; Thu, 5 Jan 2023 11:02:12 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 12/45] drm/amd: Use `amdgpu_ucode_*` helpers for MES Date: Thu, 5 Jan 2023 11:00:58 -0600 Message-ID: <20230105170138.717-13-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT023:EE_|MN0PR12MB5930:EE_ X-MS-Office365-Filtering-Correlation-Id: 89530c10-af72-440c-578e-08daef3e9834 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wCB/dqKCoZksviMLntp+NSZk/j/xNxKdoEb81furCGPt+grlwftvb1yFoEHJAh/0w8+ReQ8EM79rvhu+4H+rDac3/vlNR1HBYUhOQWrVK2ElRng2PrvqZqzmTxhA2S22QYSLJpxHstBpncBuJBzNoirDbNyhDH6tU2mx8SUdNLnllr6bM4IkIjjpukfSv7d6w2qrXEOOZKvnN5pAbyV4Qm6Mkpce9ETZdKg1laEIhSkGlWMRlYs3vC76BWIk/8hLSDh51zVhi6ILq0cD/QXQ7KcRFpTmvzLSvIAEpNimd8OHmK3nHS7Btr3LZUm4zs4YhDQMJOcrsTlH6v0Y9Sb01hzgC9JqP2l0zaFApdRLiv2vphy21ILJpz/o0ITSQ5NF3m0oAE3Fh9gagc+tPOITAnW4UN5UF6CEv4mz+lQtA341S6DW6u+OPl+ljxI3HdhqNb+60EpleDtnhML56fXPMET9yMKe0iSimRnykmPmAFP3PLVn/Zx/dgstOWSnz2UW6nojjWrOQtaYpv5WcYG/OpFQw3ZQz0trV9ebrIcjNL+qIpg/ajCqPRVYWRPY9c37SZn2PQzRPQHSqG+iZNE/ctSdufVHaz7ghytfjBRMlnfLeqN+Q52u7a+ijaRR1xrATAKk4o3u3DfGc7Nntr8iRFXOSN4onkujMbPAbAkRZuIJNohpS2+HxKhu+gcdZzYkstqdNmkjWW5YhB/6CEJcDawJZPelCwWKHpZmbnK0dP8tagQt6GgXYjFtNlwv7qSTlWOpJb+rxHC2TSM6O99s5w== 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)(39860400002)(376002)(396003)(451199015)(36840700001)(46966006)(40470700004)(70206006)(44832011)(8936002)(70586007)(5660300002)(316002)(54906003)(2906002)(41300700001)(4326008)(8676002)(36860700001)(82310400005)(6666004)(110136005)(478600001)(36756003)(186003)(336012)(26005)(1076003)(47076005)(16526019)(426003)(83380400001)(2616005)(7696005)(40480700001)(82740400003)(86362001)(81166007)(40460700003)(356005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:14.6455 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 89530c10-af72-440c-578e-08daef3e9834 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: BN8NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5930 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper provides symmetry for releasing firmware. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 10 ++-------- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 10 +--------- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 10 +--------- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c index dd8f35234507..82e27bd4f038 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c @@ -1438,11 +1438,7 @@ int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe) snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin", ucode_prefix, pipe == AMDGPU_MES_SCHED_PIPE ? "" : "1"); - r = request_firmware(&adev->mes.fw[pipe], fw_name, adev->dev); - if (r) - goto out; - - r = amdgpu_ucode_validate(adev->mes.fw[pipe]); + r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe], fw_name); if (r) goto out; @@ -1482,9 +1478,7 @@ int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe) } return 0; - out: - release_firmware(adev->mes.fw[pipe]); - adev->mes.fw[pipe] = NULL; + amdgpu_ucode_release(&adev->mes.fw[pipe]); return r; } diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c index 9c5ff8b7c202..7848b9de79ce 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c @@ -379,13 +379,6 @@ static const struct amdgpu_mes_funcs mes_v10_1_funcs = { .resume_gang = mes_v10_1_resume_gang, }; -static void mes_v10_1_free_microcode(struct amdgpu_device *adev, - enum admgpu_mes_pipe pipe) -{ - release_firmware(adev->mes.fw[pipe]); - adev->mes.fw[pipe] = NULL; -} - static int mes_v10_1_allocate_ucode_buffer(struct amdgpu_device *adev, enum admgpu_mes_pipe pipe) { @@ -979,8 +972,7 @@ static int mes_v10_1_sw_fini(void *handle) amdgpu_bo_free_kernel(&adev->mes.eop_gpu_obj[pipe], &adev->mes.eop_gpu_addr[pipe], NULL); - - mes_v10_1_free_microcode(adev, pipe); + amdgpu_ucode_release(&adev->mes.fw[pipe]); } amdgpu_bo_free_kernel(&adev->gfx.kiq.ring.mqd_obj, diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c index 3af77a32baac..a0125e103007 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c @@ -459,13 +459,6 @@ static const struct amdgpu_mes_funcs mes_v11_0_funcs = { .misc_op = mes_v11_0_misc_op, }; -static void mes_v11_0_free_microcode(struct amdgpu_device *adev, - enum admgpu_mes_pipe pipe) -{ - release_firmware(adev->mes.fw[pipe]); - adev->mes.fw[pipe] = NULL; -} - static int mes_v11_0_allocate_ucode_buffer(struct amdgpu_device *adev, enum admgpu_mes_pipe pipe) { @@ -1069,8 +1062,7 @@ static int mes_v11_0_sw_fini(void *handle) amdgpu_bo_free_kernel(&adev->mes.eop_gpu_obj[pipe], &adev->mes.eop_gpu_addr[pipe], NULL); - - mes_v11_0_free_microcode(adev, pipe); + amdgpu_ucode_release(&adev->mes.fw[pipe]); } amdgpu_bo_free_kernel(&adev->gfx.kiq.ring.mqd_obj, From patchwork Thu Jan 5 17:00:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090178 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 AAD20C5479D for ; Thu, 5 Jan 2023 17:02:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F25010E77F; Thu, 5 Jan 2023 17:02:24 +0000 (UTC) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2071.outbound.protection.outlook.com [40.107.212.71]) by gabe.freedesktop.org (Postfix) with ESMTPS id 530DA10E77D; Thu, 5 Jan 2023 17:02:17 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XCrq0l1Tqe86nbi8sK14vVkw76TRrTVHl8Lx9Fw4AohWPogbJj4u7HC41Hn1Pizs/FJr1odbMHbBe5tYyIzTW2pP5sTU6ekn+r1nUYMrjfBMb0oKI8z6LsCjh/gSmeIDtDCIZookBLX+1qKV8E6xZynNIo35s1rp2k435m48A6WKewax0P2WQaFOpKhDkEJNjGHaVpyCFKOj7M0BbGPvcAIqkT3QsKIA8SZ+rOHfPoFBSxY5mX0dUm2GuXltfWzKsEfyI3+ytR+69mUuPhR+TC0hYjtfohF8FCTBq1b/6jZ3l9rBxRMSH0j+dHERb6kCraW5Pe6y7e8VfHyV76WrjQ== 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=7+TXwvEG8zK1DNghCeTLxuq/XEH1oMG+xdv41ugskGs=; b=kYi3P8wzaf8IqLz7VxEdfyvuXBPl1VfVwWEx/Vv7ryePOGoN+1d3iq2z1DCXn5XArTXwLp93QDQwsNRCZ5V28YZTW1Ic1TkVHsNe4IinI6Cd9rm+s8SdmTMB9tj6NjwSrfODDk/nXcdTNjAmXfYxKuvdJmZJ54qOEbb+G1UrVKvbyjQ1nEHhy4eBBu13WNItRa81BtxWOCRwYozbM2jEdoNYgbSr88EzqIld9pJsxQGBWBscUy2UfNgcJHQOtTCwDzkzQ4VW/fgQTflSoNcCX2d8PuXBpAf97G6thjjlaRr1Na+bBocxsKi8waCumuuuggka3QQTH4w6efUCbMrEyQ== 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=7+TXwvEG8zK1DNghCeTLxuq/XEH1oMG+xdv41ugskGs=; b=eMEsXbk67tzdlDZ2ZWq4/QJApxSIKORIIZitgdF5eo7lAhr3wCvh7BbzvV7Xgm3SMUpgXLt9hqbOzjpUyxJ+1nwDtultiujBSBYidVjgxJB9uSuw20JfhvRHTeF+Bbyxx/EnICVViP0KDVZacpITz8zL9Bo5makJ1tfZv21g+60= Received: from BN9PR03CA0378.namprd03.prod.outlook.com (2603:10b6:408:f7::23) by PH7PR12MB8015.namprd12.prod.outlook.com (2603:10b6:510:26a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:15 +0000 Received: from BN8NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f7:cafe::c7) by BN9PR03CA0378.outlook.office365.com (2603:10b6:408:f7::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:15 +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 BN8NAM11FT023.mail.protection.outlook.com (10.13.177.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02:15 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 5 Jan 2023 11:02:13 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 13/45] drm/amd: Remove superfluous assignment for `adev->mes.adev` Date: Thu, 5 Jan 2023 11:00:59 -0600 Message-ID: <20230105170138.717-14-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT023:EE_|PH7PR12MB8015:EE_ X-MS-Office365-Filtering-Correlation-Id: 84dfd0b3-396a-4c55-2ca1-08daef3e986b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qp9wrFMwzSmS4cZDm7xcYBEefoP3jvjKZCa+p7F6abYucSlAOyR4pZt6Y51xqhJB66R71AQq2dTsAIP/EOo4KY0yxfPBC/6cyi7lra6SN7qv++s5sjz+6jFDRTBWEltRaPPHEYAsNsROI+1JEOaPQ5eNKUezwlNLRkbu5tZcVAxXVbwbaOlGC9I8drT7htpdmskW9bZUWgVqmT+BKDUAvtrRJtZpKLxcfBNVRSzow0idtBQQ93u4SQgC5kzhn45sfEdjaFIGooFfD3TJkCKxorOdooFZeq2qslxI8zOzOR1OIWFjiyCya2Q2tDZ4ikjCgL680pt19QWOMnNg3l+qFtRfli0TAIE90dhW+A8n92zDxtpeAO7RjSBiK/KP6RmNt/jRURTLTrgeDHbv0XlpKFi3k1OvacJaLU+28FFF0IITQH1JVzCn59shsLqTCJz6fCaymNFklm/Nn60nwZEmrEdqfmVrVz7Em1TtSohbZCuNN0OGinwKkSJ8UuMv5QO/V4FEdatUgJ6X5FI/EvftnoRf0BXOlDI1ncVhmQau+4okNVt+FoPgezul6tdxyXr/f/z8JHnt9maxLTOSyPWEiUnX6rkIzXgv79cnhAIOZ8fuIWJl5eRVdLigfLDW94cpjNKirF9a2WdATACDOC8wN1wb/Y/qKCYUK112yZjx6I83nUHvsoIRr0Pv8vjCaUj22kL9DcgtyXxfMMrg1yPI4QZ/WQW8Sv5xggymZtRPI5hXsORvBNx97PHoUc5X+MxLPrjNa6kVPV0fPWuUKYikxA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(136003)(346002)(39860400002)(451199015)(46966006)(40470700004)(36840700001)(81166007)(356005)(82740400003)(36756003)(40460700003)(40480700001)(82310400005)(86362001)(36860700001)(7696005)(16526019)(186003)(1076003)(47076005)(2616005)(26005)(54906003)(336012)(110136005)(70206006)(478600001)(426003)(70586007)(8936002)(2906002)(316002)(6666004)(5660300002)(41300700001)(83380400001)(4326008)(44832011)(8676002)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:15.0049 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84dfd0b3-396a-4c55-2ca1-08daef3e986b 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: BN8NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8015 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" , David Airlie , Lijo Lazar , 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. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 1 - drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c index 7848b9de79ce..2e2062636d5f 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c @@ -924,7 +924,6 @@ static int mes_v10_1_sw_init(void *handle) struct amdgpu_device *adev = (struct amdgpu_device *)handle; int pipe, r; - adev->mes.adev = adev; adev->mes.funcs = &mes_v10_1_funcs; adev->mes.kiq_hw_init = &mes_v10_1_kiq_hw_init; diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c index a0125e103007..a36b0f14ff92 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c @@ -1013,7 +1013,6 @@ static int mes_v11_0_sw_init(void *handle) struct amdgpu_device *adev = (struct amdgpu_device *)handle; int pipe, r; - adev->mes.adev = adev; adev->mes.funcs = &mes_v11_0_funcs; adev->mes.kiq_hw_init = &mes_v11_0_kiq_hw_init; adev->mes.kiq_hw_fini = &mes_v11_0_kiq_hw_fini; From patchwork Thu Jan 5 17:01:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090179 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 6320BC54EBC for ; Thu, 5 Jan 2023 17:02:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3A7AD10E785; Thu, 5 Jan 2023 17:02:25 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2085.outbound.protection.outlook.com [40.107.94.85]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0B45210E77D; Thu, 5 Jan 2023 17:02:18 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jrnqoxxs8LGLY9ppKABDzBPVN29zF2ikpAgbZESt6QABjRFyGJ7BOqCnSkrN3o+ilFgyBuQNa1OMQWAajPHaHJLYyI1uU2fu/joiiVh7i5UpSMOhTSHJWZxG5SygR94HNb5tk5xs3FEeuyDY8giB9jOeHx6/yayZIECRzftSPcNuHM5nqpw6mCjAXVauR8im5gasWKwa3XmX/h4gCDqbszo+YXA9IoLSkglg2p7ePr79pFgOyIe9hyOrp5KDI0009LCZ6GglErP0JgNXEIOrt/aLeacIHgSmSE5W8oPAeM9r66G/9MeXJEp5fDFUlC3pGj5Amyixj35VFI2pZ2EOmA== 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=Qb0NnHwlz6oKS3skKi4Y2x8wDIpeYdawgttT+cIUVv4=; b=QIDMPpWL88IYm3WZpGAod8AeOsmcTS9puQYVk8u1gUKGtZYyQUmLmuO6AmSGt3wZMpO0XC+vAiqzSsFv/jjGFxlGbeWKX4bZIvDcyin7xc60Lfj+0dTAoOw1qaF7bQrCJ44R/g9UcRMTyLqHc+GkSw26rzM8M3mbXYoDpSpb1AbS7vn5bITYF5qf6bHFuN5N8pKTsmHALHZwjvjt1mAGFC35TAR6he4E8xrWJ4y2yjgaL+270tDtFDsLmaZQqgyBwRzF5Y4EfIHzV0Dq98L3PwGUeq5s05J5tVSgGBCsxcb9mr912T4EH3iwhePpPSWIWyBXx1BHEvxiADEjgF50yw== 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=Qb0NnHwlz6oKS3skKi4Y2x8wDIpeYdawgttT+cIUVv4=; b=tqGwk2ZsGTcqaCH+6KwqWEOYOIH40TcS+tahoue/hZZCuYl8un/ExVdfLY6kOWPQ+q2SU12b52jyFBPva6xXr8smO+Txs9j8MBDpj4qEIMLCGCLeDCgCvUHiVV80zP4nVBD0PZuu0rzNllnJcPCRSraPQhyqXhYjv1f6l//hrtE= Received: from BN9PR03CA0373.namprd03.prod.outlook.com (2603:10b6:408:f7::18) by SN7PR12MB6814.namprd12.prod.outlook.com (2603:10b6:806:266::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:16 +0000 Received: from BN8NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f7:cafe::3d) by BN9PR03CA0373.outlook.office365.com (2603:10b6:408:f7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:16 +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 BN8NAM11FT023.mail.protection.outlook.com (10.13.177.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02:16 +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; Thu, 5 Jan 2023 11:02:14 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 14/45] drm/amd: Use `amdgpu_ucode_*` helpers for GFX9 Date: Thu, 5 Jan 2023 11:01:00 -0600 Message-ID: <20230105170138.717-15-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT023:EE_|SN7PR12MB6814:EE_ X-MS-Office365-Filtering-Correlation-Id: 84179e13-2301-48d0-5bfb-08daef3e9920 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4Pg4bsinvn8INrAovPHcYxeN1L9XMqnx0XOP9n9yXJoKkaOKzc5s/C79o2rmveECzVf0y6S9GIO0408O9i2fdeft3SL8cc3goyf8alzUgmUqn9/FMxblrK4E/7AGqMNRDxMm4LHkufb+IVqGbg9T/HJIGRPB3WQFM0fjbQos/I37icO+IuwmpCePMwWzdgxYYmKfgLqr2qqVxDuAwzjXR7ZN6X6ZpCMfeSpaepl0GPd7mzE3ZICTsBXKrbOK25+GLinWfO3n0ihF1VrsK+TZlwtAy2fc9JjDN6jVLNtCZ6pUAIGiQ6ObCCMO8yaPxrgovgZoBfClRtfoqoOeUuaS2ej27XfCXNGtGCVzq0R0I0xTUWmq9DpvJaEtuGWJMHFWGB1qKhl9z1RTWMpTSprf5NuZQS6xtMDGM2PxTnvSMLYD1uX8aMKZqQkP7MpSDR1LUzRDM6Y4awYn4W2BpaIlR3K+GlmiLYUHEbRkxpnhZo292kxuTuACwXkYqBlCEtcUiZG+Eqn1MfvAdYtwJBVhFjLEgib+4F/JKdaqPOya6l3S//G7S1vFUDbl66LOvaMOlucN3/Q9EqjhnS7CpkkngMKXJOer9M+BzrhGVQc29PaqEVdesOJP/3EoO5z3cIX5zI7mDXVQ/+DXvNasj4LDTVnNWdBjw9j86LfYEQFNoB1EaYn+qmdeaV24OphvifudFYZkTBUpx202JqMhKCXEo/Rr+rRnppxGgtfUJxd3bLy1axSM3zKFxHiHbYZE9mbYL7+YNbsCk7sKKR7krglt6Q== 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)(376002)(346002)(136003)(39860400002)(451199015)(36840700001)(46966006)(40470700004)(2906002)(5660300002)(44832011)(8936002)(41300700001)(478600001)(316002)(4326008)(8676002)(70206006)(110136005)(70586007)(54906003)(26005)(16526019)(6666004)(40480700001)(336012)(82310400005)(426003)(83380400001)(47076005)(1076003)(7696005)(2616005)(82740400003)(81166007)(356005)(186003)(86362001)(40460700003)(36860700001)(36756003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:16.2079 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84179e13-2301-48d0-5bfb-08daef3e9920 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: BN8NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6814 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper will provide symmetry on unload. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 82 +++++++-------------------- 1 file changed, 21 insertions(+), 61 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index f202b45c413c..ef2dbebbc90c 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c @@ -1078,18 +1078,12 @@ static int gfx_v9_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) static void gfx_v9_0_free_microcode(struct amdgpu_device *adev) { - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; - release_firmware(adev->gfx.mec2_fw); - adev->gfx.mec2_fw = NULL; + amdgpu_ucode_release(&adev->gfx.pfp_fw); + amdgpu_ucode_release(&adev->gfx.me_fw); + amdgpu_ucode_release(&adev->gfx.ce_fw); + amdgpu_ucode_release(&adev->gfx.rlc_fw); + amdgpu_ucode_release(&adev->gfx.mec_fw); + amdgpu_ucode_release(&adev->gfx.mec2_fw); kfree(adev->gfx.rlc.register_list_format); } @@ -1257,43 +1251,28 @@ static int gfx_v9_0_init_cp_gfx_microcode(struct amdgpu_device *adev, int err; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name); - err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.pfp_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_PFP); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name); - err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.me_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_ME); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name); - err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.ce_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_CE); out: if (err) { - dev_err(adev->dev, - "gfx9: Failed to init firmware \"%s\"\n", - fw_name); - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; + amdgpu_ucode_release(&adev->gfx.pfp_fw); + amdgpu_ucode_release(&adev->gfx.me_fw); + amdgpu_ucode_release(&adev->gfx.ce_fw); } return err; } @@ -1328,10 +1307,7 @@ static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev, snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_kicker_rlc.bin", chip_name); else snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); - err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.rlc_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name); if (err) goto out; rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data; @@ -1340,13 +1316,9 @@ static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev, version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor); err = amdgpu_gfx_rlc_init_microcode(adev, version_major, version_minor); out: - if (err) { - dev_err(adev->dev, - "gfx9: Failed to init firmware \"%s\"\n", - fw_name); - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; - } + if (err) + amdgpu_ucode_release(&adev->gfx.rlc_fw); + return err; } @@ -1371,12 +1343,9 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev, else snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name); - err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name); if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.mec_fw); - if (err) - goto out; + return err; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1); amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1_JT); @@ -1386,11 +1355,8 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev, else snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name); - err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name); if (!err) { - err = amdgpu_ucode_validate(adev->gfx.mec2_fw); - if (err) - goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2); amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2_JT); } else { @@ -1402,17 +1368,11 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev, adev->gfx.mec2_feature_version = adev->gfx.mec_feature_version; } -out: gfx_v9_0_check_if_need_gfxoff(adev); gfx_v9_0_check_fw_write_wait(adev); if (err) { - dev_err(adev->dev, - "gfx9: Failed to init firmware \"%s\"\n", - fw_name); - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; - release_firmware(adev->gfx.mec2_fw); - adev->gfx.mec2_fw = NULL; + amdgpu_ucode_release(&adev->gfx.mec_fw); + amdgpu_ucode_release(&adev->gfx.mec2_fw); } return err; } From patchwork Thu Jan 5 17:01:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090180 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 888F6C5479D for ; Thu, 5 Jan 2023 17:02:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 952A410E783; Thu, 5 Jan 2023 17:02:26 +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 19B1110E77F; Thu, 5 Jan 2023 17:02:22 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QENnkTlSQLw6mDExkiIkwBeiuz71VIOfX9SIO+nREO0j+vjyE0zKMFCZPfhJzq0roS+QMCwNDyV2fUHh3EeMK7Ofg/xhv6qKqOgD8JhTacuJwxxmmPL+6WeZvuu02LELYwAersB+k3NGF5vscn0BUx/w8yhA344Ram5YVMw9GkOdxhHIgOQunZY7bw28zuSdBNG6UqDpoEKqLGza0GmiWzqZIi8D5jJoIE8e9TlBYUNVlBoYvjSIA3xAT7Z0lHgqU+el0poxPubSFJ3wRdiOGkmzJ+0986Xkxj4n6dNe2/cXJ3q9p2wyfEqjDSI2j9uYeBca+/P3mKDa0gkuNNgOxA== 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=V2Q+RtAWIy3R8U+SGqlKW7qnjRA/99U8A9OYiRjJeS4=; b=Ndt+HmMEUkGgcQl+QJNRxo4ZDbc6bGMC74lScGm5dCYsR7gX9CIumQUtaZ9DduU6N1cfeQG2rqrLLxvnFDxwdExCK/5ZaRuGlCTfw28sW5TcQS8U8AxdTl7k6cleLExiuWfETKOOHg8lonAlDG1bNfTKdx/TuWJ3RN0L5S6unlF7I5U2vWw+u86KIrc3eSQSZxBriCaUaoGyq1AQibJZlpVH5NB8iFU/z6uCTJjLf5/C22zaeuhCVFeAQ/BQTSEnCbAjCxuZbIhoSwlKBbqWKeaZvHrp1+JamnskMG8s/SRFj/VIZr+BuGQDGwUE2CpXzxrvLfPQUIHQAcFef2LENQ== 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=V2Q+RtAWIy3R8U+SGqlKW7qnjRA/99U8A9OYiRjJeS4=; b=PoY/BJw0dZa885IuuqDY3IZg3SL4ocwJlkgqOO3hkZoXxWefHPmjGGulbViftsdXVwL2jwYqg2Zm6Il7KmJg91BW3afSiI7MId8E8Zn+ADy0YQstSXQb1uPTL0NLwyAotgpz0ryTNKPTZ5mLCmSFjOO66CPDcI9A9LXTH1RgFuo= Received: from BN9PR03CA0377.namprd03.prod.outlook.com (2603:10b6:408:f7::22) by CH2PR12MB4165.namprd12.prod.outlook.com (2603:10b6:610:a4::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:18 +0000 Received: from BN8NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f7:cafe::28) by BN9PR03CA0377.outlook.office365.com (2603:10b6:408:f7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:17 +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 BN8NAM11FT023.mail.protection.outlook.com (10.13.177.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02:17 +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; Thu, 5 Jan 2023 11:02:16 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 15/45] drm/amd: Load GFX9 microcode during early_init Date: Thu, 5 Jan 2023 11:01:01 -0600 Message-ID: <20230105170138.717-16-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT023:EE_|CH2PR12MB4165:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c9a0017-b4fa-45cd-ae45-08daef3e9a1a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kLrmewFr2MAG+7UZvo9BhgXlUyZpb9I70SAvp152JV+VAHmqSIhcawZm0c/33gkw20nv8PmRBQOKaET+SyjhQFt9wMcMYDceotYp1yoBvGew6QKwBJQQ2pJS3VgxPGUlVlGCgyFEmAM3EJCMrwIWsXZz1+37upP4l304yhamXuzZEm4/rkVJ2jjirEJywFaJqVB9fokNyTIUzUNcZkhPY+B9SKYPiLIW35TVUyNPdhL75KiheUnE8sC/sbb1QLrTGxP79YT9hnGsMFbCceBXdzvPx1ma6gQOh1zIbZ/TLdrK9v9ZmnlBXTBeka4iSJtGPCKYUImtPJKh8YuVE4ncS5lunhWWbeZkVx9XQ7vM1xDoxxJEcTthdAcQ4pqtqiTTgOOoGj0Er49LI3XTX52dTvVUWtRZF7C48JUC9wHaZ63+AXOdV2CI4EWmy1ZkiW8QMFu2F573sY3DpWp0VM9dh9u/fjzbxX/wimugzrPZMeJJfGivoWmEBGDHrzvQVlnfpv4mknOEYm5jBCUnapg09Q4RIN61EvZCwkiVjEKbm8DxgAdbsi4firRysi6utRzj2iwkZv3LQwoIcFtJeoYU5Wn6iDvA/QLkTTUFd7wFNbt+dISPllnrVWyS6nEuQQMgb1gslaVkWzzooLLR4PMg+oAoarYIFxObcUhLG2ZjpNwpue2SoHqY4YIWxfp6i1149ut8DI/FYYh6+/c1CrQkuFlFkKzQj9WRRg+36p/tpSk= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(376002)(136003)(346002)(396003)(451199015)(40470700004)(36840700001)(46966006)(47076005)(426003)(83380400001)(1076003)(82310400005)(26005)(186003)(16526019)(336012)(40480700001)(7696005)(6666004)(2616005)(40460700003)(86362001)(36860700001)(36756003)(81166007)(356005)(82740400003)(4326008)(41300700001)(8676002)(2906002)(5660300002)(44832011)(8936002)(478600001)(316002)(70586007)(70206006)(54906003)(110136005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:17.8328 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1c9a0017-b4fa-45cd-ae45-08daef3e9a1a 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: BN8NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4165 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" , David Airlie , Lijo Lazar , 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. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 58 +++++---------------------- 1 file changed, 9 insertions(+), 49 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index ef2dbebbc90c..0dba690cf7dd 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c @@ -1245,7 +1245,7 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev) } static int gfx_v9_0_init_cp_gfx_microcode(struct amdgpu_device *adev, - const char *chip_name) + char *chip_name) { char fw_name[30]; int err; @@ -1278,7 +1278,7 @@ static int gfx_v9_0_init_cp_gfx_microcode(struct amdgpu_device *adev, } static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev, - const char *chip_name) + char *chip_name) { char fw_name[30]; int err; @@ -1333,7 +1333,7 @@ static bool gfx_v9_0_load_mec2_fw_bin_support(struct amdgpu_device *adev) } static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev, - const char *chip_name) + char *chip_name) { char fw_name[30]; int err; @@ -1379,58 +1379,24 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev, static int gfx_v9_0_init_microcode(struct amdgpu_device *adev) { - const char *chip_name; + char ucode_prefix[30]; int r; DRM_DEBUG("\n"); - - switch (adev->ip_versions[GC_HWIP][0]) { - case IP_VERSION(9, 0, 1): - chip_name = "vega10"; - break; - case IP_VERSION(9, 2, 1): - chip_name = "vega12"; - break; - case IP_VERSION(9, 4, 0): - chip_name = "vega20"; - break; - case IP_VERSION(9, 2, 2): - case IP_VERSION(9, 1, 0): - if (adev->apu_flags & AMD_APU_IS_RAVEN2) - chip_name = "raven2"; - else if (adev->apu_flags & AMD_APU_IS_PICASSO) - chip_name = "picasso"; - else - chip_name = "raven"; - break; - case IP_VERSION(9, 4, 1): - chip_name = "arcturus"; - break; - case IP_VERSION(9, 3, 0): - if (adev->apu_flags & AMD_APU_IS_RENOIR) - chip_name = "renoir"; - else - chip_name = "green_sardine"; - break; - case IP_VERSION(9, 4, 2): - chip_name = "aldebaran"; - break; - default: - BUG(); - } + amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix)); /* No CPG in Arcturus */ if (adev->gfx.num_gfx_rings) { - r = gfx_v9_0_init_cp_gfx_microcode(adev, chip_name); + r = gfx_v9_0_init_cp_gfx_microcode(adev, ucode_prefix); if (r) return r; } - r = gfx_v9_0_init_rlc_microcode(adev, chip_name); + r = gfx_v9_0_init_rlc_microcode(adev, ucode_prefix); if (r) return r; - r = gfx_v9_0_init_cp_compute_microcode(adev, chip_name); + r = gfx_v9_0_init_cp_compute_microcode(adev, ucode_prefix); if (r) return r; @@ -2118,12 +2084,6 @@ static int gfx_v9_0_sw_init(void *handle) adev->gfx.gfx_current_status = AMDGPU_GFX_NORMAL_MODE; - r = gfx_v9_0_init_microcode(adev); - if (r) { - DRM_ERROR("Failed to load gfx firmware!\n"); - return r; - } - if (adev->gfx.rlc.funcs) { if (adev->gfx.rlc.funcs->init) { r = adev->gfx.rlc.funcs->init(adev); @@ -4565,7 +4525,7 @@ static int gfx_v9_0_early_init(void *handle) /* init rlcg reg access ctrl */ gfx_v9_0_init_rlcg_reg_access_ctrl(adev); - return 0; + return gfx_v9_0_init_microcode(adev); } static int gfx_v9_0_ecc_late_init(void *handle) From patchwork Thu Jan 5 17:01:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090182 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 9970EC3DA7D for ; Thu, 5 Jan 2023 17:03:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7921C10E784; Thu, 5 Jan 2023 17:02:27 +0000 (UTC) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2044.outbound.protection.outlook.com [40.107.243.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id F30D110E778; Thu, 5 Jan 2023 17:02:20 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iyrHdVDSxUPriaBCqX1FXIXchJZL0toSmTFEJ5Sp8M7TOrEMFeNDqPtrrgv2xsUCtJMM9qS7hWuenYBW/KKP+nYlCVW4GthFO8k5QkjclEx02paG6J7IyPwomF7TVUN7VLgGXEk7gBNGzG1DHV5EOONagV/mU2T68kuX2AvSCATD16O6BdEYH446jxL29N5yQhtbMGPWL5fFIs8CXdGszdiyOtFbLIqaQL3Q6w36ccYBWamw7hSTf2qnvXX5a1eEVQvGb892pbevt8cGjJDG8DzgdqNhS4QB9eC4RfRw4ilELb9uZoUUSqjGoBNLGAaqd7zRvAYEhjLAvMmth4Qi5Q== 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=xECfeOV7rPIK3HA3QETg4zWjWVz7viTvEkGTyXJaOZU=; b=nMwDXdGK1iXeIrwi39lYcqRjf4AE1tqX9iTKMw20dC88IuLthG9Cr3sHvQXlVEXl6UIDh0T6E26/GzzHnN9xtp77Z/vHH3RHp1du/g1dtL1RlrP+QhbUS3bl79ygoQuE9F/yQD2Rio56YH7k1kNf47To94vvc3gs3yRRgZi5E53euLNZ7JwMLle5HjyVjPyrbQPgqpWqc8nxjcANRvmg/m0Uy0YGdd2mbylGbXW3yyNcMlxLQKkKSIwg2FN6ioN1S1sFNJvCg5tWTy2CW+zdAfO1tUG1q5qgQdZAIEFtSZ6UVlDfE0RwxKXy/NAXLxzA9Rn/x5S+WiueMqjExA5IvA== 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=xECfeOV7rPIK3HA3QETg4zWjWVz7viTvEkGTyXJaOZU=; b=uwyCBXDC1ScHfaWbLNLBj7sv3LqzOdqPAyKuzdsnti9+gdkXBzxCSYcAkbyvOIkxTcEaTRfNfF8jwP1FAxYErfFABbMqG3Z7OMvWICjxBmY+OGI5vQ7LLw0GbQ4h4txJLwwUAL6SyY6YgiT57qifa9KmHD3nLcSO0Bz8NLOXIAI= Received: from BN9PR03CA0390.namprd03.prod.outlook.com (2603:10b6:408:f7::35) by CY5PR12MB6107.namprd12.prod.outlook.com (2603:10b6:930:28::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:19 +0000 Received: from BN8NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f7:cafe::8) by BN9PR03CA0390.outlook.office365.com (2603:10b6:408:f7::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02:18 +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 BN8NAM11FT023.mail.protection.outlook.com (10.13.177.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02:18 +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; Thu, 5 Jan 2023 11:02:17 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 16/45] drm/amd: Use `amdgpu_ucode_*` helpers for GFX10 Date: Thu, 5 Jan 2023 11:01:02 -0600 Message-ID: <20230105170138.717-17-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT023:EE_|CY5PR12MB6107:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c035280-34eb-4707-b8ae-08daef3e9aa9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0qq3pD2YjEtzp5BcGcqKtgIpx/b/PkjVpLiha9EgROBCeI4NygRR6qA3RngQzFGNgVAT3kvjKUHwclhO63mFgEksuEgc+vMThuZgleX9xBRZQDkdgeHlahBQ0vNpP1xvDlb5wZiKJ0MdD3mZK0nmhX6omMUXleGloaioh+0DfPsCfKNfB3pl2tv+oxTaT1gWJkhbd74e51yr/tASOV7f+lEXrFWedIVKrrB8CxeNrMG/oGWVkSgpvn4SplM8PDu6llwegEcQWIeuw7fd8eTDvAnzfv9IP1t6O4z2+uBkxjCjdxth9W39b3IqPa6DzWghFV9ux99VJ+nJkA6uooXDnDxuIlsYZQtkCzqEs3ixpeBDpN54B7/i2hV6zS76hRaNuJxH1UVHtd1Xunye0+qFKyvysp3tI1liafrboXefXiKjZ9NPHbY5gk+oiE4ielIQ+EFKtVPfKQKvKP6P4ksBt/1QuUuc21XryLC/W+aKUs5UDf2//VDg6epykEtmFTI2IzFUMVKNYNCyyFfQqV1BcFD1OVQSkWHZMgiQwfMoYwFmrokoYDhmRzD4SxRJHY9x/jGtPqZNBNCGa4LPeKRIPfVuxr9owBEIY/kl0FQpnsGoFXIwI5DajINcxwRKxXFGZym/7f8PbthQwGtMtHJ3vjp+0NF+TMvYY2/DVGEteFIYExxT03ImZHEEDDt1f6IRUwoqjK30gn9/WaGLJc6Xu0zHB226RUE2iNRdsx4t6vbYTQTqoI8ZJ2nz/dGVe92X/WK2ShOAFP+wvpLPJ1J9XQ== 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)(36840700001)(40470700004)(46966006)(36860700001)(2906002)(82740400003)(40460700003)(86362001)(36756003)(47076005)(40480700001)(16526019)(110136005)(2616005)(316002)(82310400005)(81166007)(54906003)(356005)(6666004)(4326008)(1076003)(5660300002)(8676002)(336012)(83380400001)(478600001)(70586007)(70206006)(426003)(8936002)(41300700001)(186003)(26005)(7696005)(44832011)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:18.7702 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c035280-34eb-4707-b8ae-08daef3e9aa9 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: BN8NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6107 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unload. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 71 ++++++++------------------ 1 file changed, 20 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index 49d34c7bbf20..140bb18ff768 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -3891,18 +3891,12 @@ static int gfx_v10_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) static void gfx_v10_0_free_microcode(struct amdgpu_device *adev) { - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; - release_firmware(adev->gfx.mec2_fw); - adev->gfx.mec2_fw = NULL; + amdgpu_ucode_release(&adev->gfx.pfp_fw); + amdgpu_ucode_release(&adev->gfx.me_fw); + amdgpu_ucode_release(&adev->gfx.ce_fw); + amdgpu_ucode_release(&adev->gfx.rlc_fw); + amdgpu_ucode_release(&adev->gfx.mec_fw); + amdgpu_ucode_release(&adev->gfx.mec2_fw); kfree(adev->gfx.rlc.register_list_format); } @@ -4030,41 +4024,31 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp%s.bin", chip_name, wks); - err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.pfp_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_PFP); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me%s.bin", chip_name, wks); - err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.me_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_ME); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce%s.bin", chip_name, wks); - err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.ce_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_CE); if (!amdgpu_sriov_vf(adev)) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); - err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); - if (err) - goto out; + err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name); /* don't check this. There are apparently firmwares in the wild with * incorrect size in the header */ - err = amdgpu_ucode_validate(adev->gfx.rlc_fw); + if (err == -ENODEV) + goto out; if (err) dev_dbg(adev->dev, "gfx10: amdgpu_ucode_validate() failed \"%s\"\n", @@ -4078,21 +4062,15 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec%s.bin", chip_name, wks); - err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.mec_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1); amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1_JT); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2%s.bin", chip_name, wks); - err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name); if (!err) { - err = amdgpu_ucode_validate(adev->gfx.mec2_fw); - if (err) - goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2); amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2_JT); } else { @@ -4103,21 +4081,12 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) gfx_v10_0_check_fw_write_wait(adev); out: if (err) { - dev_err(adev->dev, - "gfx10: Failed to init firmware \"%s\"\n", - fw_name); - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; - release_firmware(adev->gfx.mec2_fw); - adev->gfx.mec2_fw = NULL; + amdgpu_ucode_release(&adev->gfx.pfp_fw); + amdgpu_ucode_release(&adev->gfx.me_fw); + amdgpu_ucode_release(&adev->gfx.ce_fw); + amdgpu_ucode_release(&adev->gfx.rlc_fw); + amdgpu_ucode_release(&adev->gfx.mec_fw); + amdgpu_ucode_release(&adev->gfx.mec2_fw); } gfx_v10_0_check_gfxoff_flag(adev); From patchwork Thu Jan 5 17:01:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090181 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 3349CC54EBC for ; Thu, 5 Jan 2023 17:02:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 79C7C10E786; Thu, 5 Jan 2023 17:02:27 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2048.outbound.protection.outlook.com [40.107.223.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id D942C10E780; Thu, 5 Jan 2023 17:02:22 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eOFgPUzZIAbtXTvoPIMueUHwfvlgVj3lyH6aMiJcwLwpgsAgHZsEjSFtr3dLAulJtqDDybr26hJYR92m+RU9m194RjfhQTdTuLNgxX44l76ECSg9TPT8WguXN148sE0/yA/rBueUuZwGh0uX2mlXZE868d88/y0XJ84Iwqa0PbTSqxMnOF2cXmw4+6WYMDvJd06BHP4a6gTNqZsWlB+nxD3WmvZq3Lp01qqCupuAvV+wkChOQf7n4qjCLPuzM8XbtuLynuyTL2k4UxJrvX3iPxj4hz+TvhgeP4enQPQvwYM/Q0Z3UDqyJspMHRD37BCz5mEyvp69RRMe5i1TMdJrow== 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=xr9Os6QQD0sVxOULbzqviMYcmZjsLLWgwpt0bj8o4O4=; b=B2d7EzMIO4jE2Rus/oBo6rqHT1D0uqmd3K/rOAkmNvJ2u5sB5Y88DLT+gJBW90KYJErdyzmLdEWEjgo6vVDE0fpXYsR77dXZBQ1aHvJtkQ10Gqcim80E/RqgNJMSPSViAg83wlGN7oqmZJUzyYdZVtvxhJxSrQyP9yWYT3jWYqNz46+YEAk8l5xA+T1VQO1uan/+XYqYNno7n62YQBLRgWrMFJz4/oYkJ+EY1ZLZQtZJIzA+6c4PiqpuU7IVztiqr7rtmeK8ll1J/3ZriZQtsLTNEK1FPh9GKj74PW+vvXuU7Pa7Tiui/o/i3N2iHpXBhVvSt2wlcFnU45pyj2ksIg== 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=xr9Os6QQD0sVxOULbzqviMYcmZjsLLWgwpt0bj8o4O4=; b=NNukwxYGBV8izMtvI9TMTYPFs0Xg43hf9jSGuRlEhpOfUkV5cbeB2lYBeD/U6ud6DIClZKJyyvw7XwIAo1KGyRFCigWjTHNUGNnc2i3659lmUFhuVCNYr4tZVb2zI7LgD+Jhzf8trtq9LgN3CNI7bR0/Nxhy+xw+UZjzUd386Kc= Received: from BN9PR03CA0381.namprd03.prod.outlook.com (2603:10b6:408:f7::26) by SN7PR12MB7786.namprd12.prod.outlook.com (2603:10b6:806:349::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:20 +0000 Received: from BN8NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f7:cafe::9a) by BN9PR03CA0381.outlook.office365.com (2603:10b6:408:f7::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:20 +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 BN8NAM11FT023.mail.protection.outlook.com (10.13.177.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02:20 +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; Thu, 5 Jan 2023 11:02:18 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 17/45] drm/amd: Load GFX10 microcode during early_init Date: Thu, 5 Jan 2023 11:01:03 -0600 Message-ID: <20230105170138.717-18-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT023:EE_|SN7PR12MB7786:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ab08509-f46e-4caf-e60c-08daef3e9b7d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: epndvYq6y9oABAsm/CMpb5Ab0JPozdO2tVj8Vw014lQyifdgFw5/UKONe/a7580y/lPDi0Kp8xk8uSF/r4I4qOpL4KXVWN0aiK2fyqfLJTKgl12FCeCCTvIyaSryzj/5LzYxbOmsSXQSfGGQ9hiX6J0STr/PQ3k6UHEGvsMKoPTUIkL5fEpgiUKii9I9nl3gYklzupLDWicyGzlPgrMzgspCflRS0w7h290hX7omZqLq85Q3xI1Jfk/ic4wsAIXYsPkt7kZ1Ih/Lw+MhA6vVGPgLViMm1VY/Ns49BxzcESzA/dZH6KsDV9KxmCbjNho1jkazrU69GsdneGr8Xy4NoZfYMiYR7e5IEc+xZTG/rgSHKD/pBFmUb39C0XouyngMN5QSn6JxvhQqTT11qNJeejx35gYMA3KauiDpKR9UtPJ/u6dBNeuZMDE5T8G5ID6YTTo4xl6OU6gl7tvKXrDu61vzwk0C6q8Vm0sI3j1uwLaxDnrAjAB/EHeoLob7D58AXjpF+ZLFvS/lH1lJXxjXVvssltxeVdM0eLrTTowoKdATatO5Fu1ae8ApB22Tc3Dk3HFP/uLlA9JDCoqkDR1sCl9F821cBOAPNChQIxUypf0kpAdPC1nI+zYc+wg6sbJLYAAHRUL05v/aYVT7Y5Z7LO4gS1991GWnR7gJCFyrEHobAh0gRCYozvSmpJPMVqWXrou5n+XWv3mfHZ0C2nRzbJGmZZx2W5DVZJYQNm2xVMQ= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(376002)(136003)(396003)(39860400002)(451199015)(40470700004)(46966006)(36840700001)(426003)(186003)(26005)(83380400001)(1076003)(16526019)(336012)(86362001)(2616005)(47076005)(40480700001)(40460700003)(82310400005)(356005)(36756003)(36860700001)(44832011)(81166007)(82740400003)(54906003)(478600001)(316002)(110136005)(2906002)(8936002)(41300700001)(8676002)(5660300002)(70206006)(70586007)(4326008)(6666004)(7696005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:20.1607 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ab08509-f46e-4caf-e60c-08daef3e9b7d 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: BN8NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7786 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" , David Airlie , Lijo Lazar , 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. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 84 ++++++-------------------- 1 file changed, 18 insertions(+), 66 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index 140bb18ff768..6983acc456b2 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -3968,9 +3968,9 @@ static void gfx_v10_0_check_gfxoff_flag(struct amdgpu_device *adev) static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) { - const char *chip_name; char fw_name[40]; - char *wks = ""; + char ucode_prefix[30]; + const char *wks = ""; int err; const struct rlc_firmware_header_v2_0 *rlc_hdr; uint16_t version_major; @@ -3978,71 +3978,31 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) DRM_DEBUG("\n"); - switch (adev->ip_versions[GC_HWIP][0]) { - case IP_VERSION(10, 1, 10): - chip_name = "navi10"; - break; - case IP_VERSION(10, 1, 1): - chip_name = "navi14"; - if (!(adev->pdev->device == 0x7340 && - adev->pdev->revision != 0x00)) - wks = "_wks"; - break; - case IP_VERSION(10, 1, 2): - chip_name = "navi12"; - break; - case IP_VERSION(10, 3, 0): - chip_name = "sienna_cichlid"; - break; - case IP_VERSION(10, 3, 2): - chip_name = "navy_flounder"; - break; - case IP_VERSION(10, 3, 1): - chip_name = "vangogh"; - break; - case IP_VERSION(10, 3, 4): - chip_name = "dimgrey_cavefish"; - break; - case IP_VERSION(10, 3, 5): - chip_name = "beige_goby"; - break; - case IP_VERSION(10, 3, 3): - chip_name = "yellow_carp"; - break; - case IP_VERSION(10, 3, 6): - chip_name = "gc_10_3_6"; - break; - case IP_VERSION(10, 1, 3): - case IP_VERSION(10, 1, 4): - chip_name = "cyan_skillfish2"; - break; - case IP_VERSION(10, 3, 7): - chip_name = "gc_10_3_7"; - break; - default: - BUG(); - } + if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 1, 1) && + (!(adev->pdev->device == 0x7340 && adev->pdev->revision != 0x00))) + wks = "_wks"; + amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix)); - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp%s.bin", chip_name, wks); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp%s.bin", ucode_prefix, wks); err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_PFP); - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me%s.bin", chip_name, wks); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me%s.bin", ucode_prefix, wks); err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_ME); - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce%s.bin", chip_name, wks); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce%s.bin", ucode_prefix, wks); err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_CE); if (!amdgpu_sriov_vf(adev)) { - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", ucode_prefix); err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name); /* don't check this. There are apparently firmwares in the wild with * incorrect size in the header @@ -4051,7 +4011,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) goto out; if (err) dev_dbg(adev->dev, - "gfx10: amdgpu_ucode_validate() failed \"%s\"\n", + "gfx10: amdgpu_ucode_request() failed \"%s\"\n", fw_name); rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data; version_major = le16_to_cpu(rlc_hdr->header.header_version_major); @@ -4061,14 +4021,14 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) goto out; } - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec%s.bin", chip_name, wks); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec%s.bin", ucode_prefix, wks); err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name); if (err) goto out; amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1); amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1_JT); - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2%s.bin", chip_name, wks); + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2%s.bin", ucode_prefix, wks); err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name); if (!err) { amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2); @@ -4077,6 +4037,8 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) err = 0; adev->gfx.mec2_fw = NULL; } + amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2); + amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2_JT); gfx_v10_0_check_fw_write_wait(adev); out: @@ -4239,19 +4201,11 @@ static void gfx_v10_0_mec_fini(struct amdgpu_device *adev) amdgpu_bo_free_kernel(&adev->gfx.mec.mec_fw_obj, NULL, NULL); } -static int gfx_v10_0_me_init(struct amdgpu_device *adev) +static void gfx_v10_0_me_init(struct amdgpu_device *adev) { - int r; - bitmap_zero(adev->gfx.me.queue_bitmap, AMDGPU_MAX_GFX_QUEUES); amdgpu_gfx_graphics_queue_acquire(adev); - - r = gfx_v10_0_init_microcode(adev); - if (r) - DRM_ERROR("Failed to load gfx firmware!\n"); - - return r; } static int gfx_v10_0_mec_init(struct amdgpu_device *adev) @@ -4619,9 +4573,7 @@ static int gfx_v10_0_sw_init(void *handle) adev->gfx.gfx_current_status = AMDGPU_GFX_NORMAL_MODE; - r = gfx_v10_0_me_init(adev); - if (r) - return r; + gfx_v10_0_me_init(adev); if (adev->gfx.rlc.funcs) { if (adev->gfx.rlc.funcs->init) { @@ -7599,7 +7551,7 @@ static int gfx_v10_0_early_init(void *handle) /* init rlcg reg access ctrl */ gfx_v10_0_init_rlcg_reg_access_ctrl(adev); - return 0; + return gfx_v10_0_init_microcode(adev); } static int gfx_v10_0_late_init(void *handle) From patchwork Thu Jan 5 17:01:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090198 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 6466BC3DA7A for ; Thu, 5 Jan 2023 17:03:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3230110E7A4; Thu, 5 Jan 2023 17:02:58 +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 8A73310E78D; Thu, 5 Jan 2023 17:02:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JD1kaV5bUQTn/3RkUL68tqips5ySs90uiA696SVApdG9xBuLp6O1wpD/5IE4P9A3Kx0ix6dTrevI/FNfZo+3aRd7IXXa/bXI7Zx/qFfM4+139Pc3CADxntdtx4lYQofPUsyo6tNAhaqdKkYGLmPPDOWmnbUGC6M7b21id9qoK2lh7Rae4BB/qxfZkkmFHw1bHear8Qk5PdnbNNeyknfKJ9H2h5Vv+gt+VtgtPhez9rtEelGswo7SX/EaWVzheyiPFP/ujuYbjnNkGykllWFVhsSt+uEew80tTdC6lYYOH/c3/1fdjUfzrJpU+dMukFzKTozjcwl77GEirftyoaCLqA== 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=/1WYN48a8V8FnVsv0TSN1CAWctJHE+KQKSm+1wpWKuw=; b=AFG5hJ9qPkCS+d/HHpaBtiMd5EsvsaVv74fMVJj3dFPL9skumTTYjTUYmaLfFCDYaRGYdHGXFJPP4MwqrsVuFEVphnd7v/qcDmUU4aPLPIiOc5Kn8owHk90f+wVkyyBwGEWqDylf7a1sbdymg1NDulw4xCwax3psgCfgPzZTKR+M5Dj9UG4GulPWL7dI8bfqBOUCDQOUpyudkKo3lUI3yZc/9zJusppjr2Brf36thmB9LNiJTM/f8IwqO+ZTMzNeV89wqcQ8JAOaKoJrFpwSnxXtMFRkyQ6kdDQsEiZMlYPL/zmNfXPYtbdBaUvfYLlpha5QLmafPrcbJcPWOxNwWg== 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=/1WYN48a8V8FnVsv0TSN1CAWctJHE+KQKSm+1wpWKuw=; b=AhjNdJ03jjCmgFNFdv4aJZD33nCWexxvNcxr6+HAF/PXx37I0UX/XsW6CTsoxdQ5JDrMB07gEt0Jrpdwc/Np6rdKNGBFdkTyErfHJSFb/mWNX2CcgZ9X2MeVm3RYzhAcNyeHPFaCC0ofuSFeI+9l6X6SRtQUd8P4Tr3WxmxfU/w= Received: from BN9PR03CA0362.namprd03.prod.outlook.com (2603:10b6:408:f7::7) by CY8PR12MB7515.namprd12.prod.outlook.com (2603:10b6:930:93::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:30 +0000 Received: from BN8NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f7:cafe::bc) by BN9PR03CA0362.outlook.office365.com (2603:10b6:408:f7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT023.mail.protection.outlook.com (10.13.177.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:20 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 18/45] drm/amd: Use `amdgpu_ucode_*` helpers for GFX11 Date: Thu, 5 Jan 2023 11:01:04 -0600 Message-ID: <20230105170138.717-19-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT023:EE_|CY8PR12MB7515:EE_ X-MS-Office365-Filtering-Correlation-Id: e1fba8bb-05af-4cdc-4269-08daef3ea1ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nktarX3iF9v81XruivrIHFjlptoYDYWfIvCO5TvVjXekGjs71EUoYYLT1FTUFuYeIeNaU9Y+PpCLITzLeQ/bOsHreIm+Y1V2L6qX5scTGEwXeMf66Owu4d5zTb/Hk3msH656Td6zB8gemgmxOwOorGBb6vjx4KFs8yIZEAgjtlbP9BdD9a/wQ0kqNPNXLoe8qnSBXPeTHD8M9jE905Evl0zyt0CGdDgUAeAUi3PvUfJ56K5kTPoFgOQFzFntVzug6yIrwJjj/d+1DHQ0s2LGnXxIKUMoO+enYqMGS897A0fAz1Ejg3mvZDlvsg/iiUSsYPubtPRVuyzPq/g7mGT16OAJyPaWFHuD9j2th9eCGuXGWM4OANsT3hPWW0WonMmgWqhFoTo9SY/C0VEqb3qDAAvpNDymcTFvVLhaGFuSFAVsqujB7XuLP5v3I3jK8csXkOiT1i4loqdSVkgdovjOOfaj76+iWT9mGUXJEaIZLPDyGmLGM3NJVFagXrXMfTAc4158B2a+p/35FnUv542DJJdBnmvbyr51Ecq+evO8wS7FwQ6BsIiuLMLG9Oa8AR3AteYYhh3Dx6wAz7wE4HGXq4vprzILK6Ql+imNSu1Xqo57TMOEK8z6W5gBSBwGcS9llbm08Oqwo/Njw+LppuuUgM2RXDxI56v0NP/0cGNotz8KHCy3Xvpo3eT1N0RpVu+FSQcSruJO5XMplAumUCyYywLF5seFtsddxBulhcoMC4r4F2Ii+8QIhSN27jYNc1BR2TK6Di7JQbt7STxJsBSuJQ== 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)(396003)(376002)(451199015)(46966006)(36840700001)(40470700004)(1076003)(70206006)(426003)(4326008)(81166007)(47076005)(70586007)(8676002)(2616005)(36756003)(41300700001)(336012)(40460700003)(316002)(54906003)(356005)(110136005)(2906002)(86362001)(36860700001)(82310400005)(5660300002)(82740400003)(83380400001)(40480700001)(8936002)(7696005)(478600001)(16526019)(186003)(26005)(6666004)(44832011)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:30.7537 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1fba8bb-05af-4cdc-4269-08daef3ea1ce 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: BN8NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7515 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper will provide symmetery on unload. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 104 +++++++++---------------- drivers/gpu/drm/amd/amdgpu/imu_v11_0.c | 7 +- 2 files changed, 39 insertions(+), 72 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index a56c6e106d00..d4f67624d05b 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -431,18 +431,39 @@ static int gfx_v11_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) static void gfx_v11_0_free_microcode(struct amdgpu_device *adev) { - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; + amdgpu_ucode_release(&adev->gfx.pfp_fw); + amdgpu_ucode_release(&adev->gfx.me_fw); + amdgpu_ucode_release(&adev->gfx.rlc_fw); + amdgpu_ucode_release(&adev->gfx.mec_fw); kfree(adev->gfx.rlc.register_list_format); } +static int gfx_v11_0_init_toc_microcode(struct amdgpu_device *adev) +{ + 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 = amdgpu_ucode_request(adev, &adev->psp.toc_fw, fw_name); + if (err) + goto out; + + toc_hdr = (const struct psp_firmware_header_v1_0 *)adev->psp.toc_fw->data; + adev->psp.toc.fw_version = le32_to_cpu(toc_hdr->header.ucode_version); + adev->psp.toc.feature_version = le32_to_cpu(toc_hdr->sos.fw_version); + adev->psp.toc.size_bytes = le32_to_cpu(toc_hdr->header.ucode_size_bytes); + adev->psp.toc.start_addr = (uint8_t *)toc_hdr + + le32_to_cpu(toc_hdr->header.ucode_array_offset_bytes); + return 0; +out: + amdgpu_ucode_release(&adev->psp.toc_fw); + return err; +} + static int gfx_v11_0_init_microcode(struct amdgpu_device *adev) { char fw_name[40]; @@ -457,10 +478,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev) amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix)); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", ucode_prefix); - err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.pfp_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); if (err) goto out; /* check pfp fw hdr version to decide if enable rs64 for gfx11.*/ @@ -477,10 +495,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", ucode_prefix); - err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.me_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); if (err) goto out; if (adev->gfx.rs64_enable) { @@ -493,10 +508,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev) if (!amdgpu_sriov_vf(adev)) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", ucode_prefix); - err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.rlc_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name); if (err) goto out; rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data; @@ -508,10 +520,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", ucode_prefix); - err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.mec_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name); if (err) goto out; if (adev->gfx.rs64_enable) { @@ -530,54 +539,15 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev) out: if (err) { - dev_err(adev->dev, - "gfx11: Failed to init firmware \"%s\"\n", - fw_name); - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; + amdgpu_ucode_release(&adev->gfx.pfp_fw); + amdgpu_ucode_release(&adev->gfx.me_fw); + amdgpu_ucode_release(&adev->gfx.rlc_fw); + amdgpu_ucode_release(&adev->gfx.mec_fw); } return err; } -static int gfx_v11_0_init_toc_microcode(struct amdgpu_device *adev) -{ - const struct psp_firmware_header_v1_0 *toc_hdr; - int err = 0; - char fw_name[40]; - char ucode_prefix[30]; - - amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix)); - - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_toc.bin", ucode_prefix); - err = request_firmware(&adev->psp.toc_fw, fw_name, adev->dev); - if (err) - goto out; - - err = amdgpu_ucode_validate(adev->psp.toc_fw); - if (err) - goto out; - - toc_hdr = (const struct psp_firmware_header_v1_0 *)adev->psp.toc_fw->data; - adev->psp.toc.fw_version = le32_to_cpu(toc_hdr->header.ucode_version); - adev->psp.toc.feature_version = le32_to_cpu(toc_hdr->sos.fw_version); - adev->psp.toc.size_bytes = le32_to_cpu(toc_hdr->header.ucode_size_bytes); - adev->psp.toc.start_addr = (uint8_t *)toc_hdr + - le32_to_cpu(toc_hdr->header.ucode_array_offset_bytes); - return 0; -out: - dev_err(adev->dev, "Failed to load TOC microcode\n"); - release_firmware(adev->psp.toc_fw); - adev->psp.toc_fw = NULL; - return err; -} - static u32 gfx_v11_0_get_csb_size(struct amdgpu_device *adev) { u32 count = 0; diff --git a/drivers/gpu/drm/amd/amdgpu/imu_v11_0.c b/drivers/gpu/drm/amd/amdgpu/imu_v11_0.c index 95548c512f4f..ed0d368149aa 100644 --- a/drivers/gpu/drm/amd/amdgpu/imu_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/imu_v11_0.c @@ -49,10 +49,7 @@ static int imu_v11_0_init_microcode(struct amdgpu_device *adev) amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix)); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_imu.bin", ucode_prefix); - err = request_firmware(&adev->gfx.imu_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.imu_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, fw_name); if (err) goto out; imu_hdr = (const struct imu_firmware_header_v1_0 *)adev->gfx.imu_fw->data; @@ -77,7 +74,7 @@ static int imu_v11_0_init_microcode(struct amdgpu_device *adev) dev_err(adev->dev, "gfx11: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(adev->gfx.imu_fw); + amdgpu_ucode_release(&adev->gfx.imu_fw); } return err; From patchwork Thu Jan 5 17:01:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090183 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 BD223C54EBE for ; Thu, 5 Jan 2023 17:03:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F09E10E792; Thu, 5 Jan 2023 17:02:41 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2088.outbound.protection.outlook.com [40.107.92.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF52210E790; Thu, 5 Jan 2023 17:02:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WVZgp5pmq6Rq+AmUDamdQlgWMTfiQN81IvKluY3LCLzh3J4gPTTWZYuQMxuPRzBXh/1/DHq6VOkAbQ4BRMGeDEcSRwQkZqrG6hmo5eu3r1+ObBxf8FVom6CtaR2nUsqAFlm9/XqMwhdrT3lcwoMpAbfKJX0QTJnF/QX09R9pHTK/SKlHBebyUU3dnce0Yf41h/+FEHcyAw1Suy1KwoEcrw05YNaLViD3pcVIo6vtnYd8NcN+zsltGpUcOKtGIRKbBXbjgdmkjqLwbDoHmpRfmHPozG3gV3Xeg8hs/CbvI75UYchmL1H0/5QDvJil1Yof3whcksn6CAw0fNhSVKdjPQ== 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=ynPL55bDIBx5Nk4ox3LhpLnU0VIYc1yv64LYC31DONk=; b=NrnfpCppbIU0ULvn0xZGpX0KLZORqT8BXkGlDZbSP5fiaVwl6ADcFFCB7QM+lgXJFab1wxs2Un4X7hlAg/+UzBekJ7fpdyju9mmBuCb/aDfEQ+23Tq6DsuFLvgD/JSozRkLgQJYS4OxQoOrAmi8kb6Qr9oWCz7TI5zBYNDjMmMLApEVtwkunSbt/fbp/ER2WFcRIIVP4ixadNsKyRkrdcqzhXNBRyyemQSpVWd+7eG5K4bMpL7d6Vdv5Jj3YBox8qR9Y9nxaiWhSNEa4X0nQ1fqRT5DrK9RCtMvRnl0YRAIaNItKeC5y9JQIUl24HsZQDFaxlad6iks7AzyhUS96zg== 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=ynPL55bDIBx5Nk4ox3LhpLnU0VIYc1yv64LYC31DONk=; b=klka4UeP2fMVa8asa87OyItCTjteeohQIEowCjMcbVAkPqlRo41Ei3gEE8J2QVBY2b3fBl74/IhxYq5q0usptlHj+6lyDQHz2ELgXUob0y5fUIFzGI6yNXHNXddrxGDOUql+tWm1qxVXott8M1XJa9oPO4ot/cFEakKdnzPKwIM= Received: from BN9PR03CA0381.namprd03.prod.outlook.com (2603:10b6:408:f7::26) by DS7PR12MB6309.namprd12.prod.outlook.com (2603:10b6:8:96::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:31 +0000 Received: from BN8NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f7:cafe::95) by BN9PR03CA0381.outlook.office365.com (2603:10b6:408:f7::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT023.mail.protection.outlook.com (10.13.177.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:21 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 19/45] drm/amd: Load GFX11 microcode during early_init Date: Thu, 5 Jan 2023 11:01:05 -0600 Message-ID: <20230105170138.717-20-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT023:EE_|DS7PR12MB6309:EE_ X-MS-Office365-Filtering-Correlation-Id: 6e13cfe6-3f1a-4744-29fb-08daef3ea218 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5gDcQWDxXkCzfsGeNUgISf1gzxApHMaHXRXbhK/WhGMISCo7rkcUevjRsNM0sRw1qAY1y+xH0XbMDc13aPCwq0ZU00EIDNdyU9qR2mTLO5UD4xzgWFBNSlo8g2wAwiSzjrub34RfWgqho2wr9xRRjLYLYI4Af9eU/+OFO/8DPBcyQ9ENPPNZw60sZor3kpl0yOTPtl0Bg0NHZHGOevdMYEYCshoHYcchnSjbnCUbjJLrcl13oinf15wTXLgels9i+HVfKheNh6CWvzx9WAfuPauIn165NzZG55Oyivp6M/85piXWfzLDI5A7tMeTuPGFueQfmn90oTbVdmsnaqtDBJWLzxrI86hOjHzUAtBgngnKTjXWfzd2iPqAdNTdmHZZ1363BLQrxaflKNkF2Jka+3gdNvsx5pP75obDueI8SAq9i/kjbucLHsg9fIKW7r7Ub0m7FvFwDHvSfjRLJ1XYPGBbvgL/dIrEH/TWPtzZMBDUmRpKqPCIc77baXRK1+h3iRmVMKLuOgixkruGleKMgeFS2dM1XBzbefmp2rmRT4P+gkIIQJWYKXVHCh7WyKW4jmvGuQockXCuUKGvZBADEtuQSJLxrqgkgF3bdEku/nzvSoS/GtJgDtkKrdDF4igA320a2zKAN0TkYHE4t/VT9g8Xz4vRSbR7uzz82f+Iu5Jn6JiPH/TbhT7mtJBnZFRT7qFI9k4UqOaS0SjWPEsG3FtbfezNWnWNvnhlen+QB48= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(346002)(396003)(136003)(376002)(451199015)(46966006)(40470700004)(36840700001)(82740400003)(478600001)(40480700001)(40460700003)(36756003)(82310400005)(356005)(86362001)(81166007)(1076003)(336012)(316002)(54906003)(2906002)(2616005)(7696005)(44832011)(110136005)(8936002)(5660300002)(26005)(8676002)(4326008)(6666004)(41300700001)(70206006)(70586007)(36860700001)(47076005)(186003)(16526019)(426003)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:31.2381 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e13cfe6-3f1a-4744-29fb-08daef3ea218 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: BN8NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6309 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" , David Airlie , Lijo Lazar , 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. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Rebase on earlier changes --- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 26 +++++++------------------- 1 file changed, 7 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 d4f67624d05b..5cc329cf66c4 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -439,14 +439,12 @@ 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) +static int gfx_v11_0_init_toc_microcode(struct amdgpu_device *adev, const char *ucode_prefix) { 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 = amdgpu_ucode_request(adev, &adev->psp.toc_fw, fw_name); if (err) @@ -534,6 +532,9 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev) amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1_JT); } + if (adev->firmware.load_type == AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO) + err = gfx_v11_0_init_toc_microcode(adev, ucode_prefix); + /* only one MEC for gfx 11.0.0. */ adev->gfx.mec2_fw = NULL; @@ -684,19 +685,11 @@ static void gfx_v11_0_mec_fini(struct amdgpu_device *adev) amdgpu_bo_free_kernel(&adev->gfx.mec.mec_fw_data_obj, NULL, NULL); } -static int gfx_v11_0_me_init(struct amdgpu_device *adev) +static void gfx_v11_0_me_init(struct amdgpu_device *adev) { - int r; - bitmap_zero(adev->gfx.me.queue_bitmap, AMDGPU_MAX_GFX_QUEUES); amdgpu_gfx_graphics_queue_acquire(adev); - - r = gfx_v11_0_init_microcode(adev); - if (r) - DRM_ERROR("Failed to load gfx firmware!\n"); - - return r; } static int gfx_v11_0_mec_init(struct amdgpu_device *adev) @@ -1309,9 +1302,7 @@ static int gfx_v11_0_sw_init(void *handle) } } - r = gfx_v11_0_me_init(adev); - if (r) - return r; + gfx_v11_0_me_init(adev); r = gfx_v11_0_rlc_init(adev); if (r) { @@ -1379,9 +1370,6 @@ static int gfx_v11_0_sw_init(void *handle) /* allocate visible FB for rlc auto-loading fw */ if (adev->firmware.load_type == AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO) { - r = gfx_v11_0_init_toc_microcode(adev); - if (r) - dev_err(adev->dev, "Failed to load toc firmware!\n"); r = gfx_v11_0_rlc_autoload_buffer_init(adev); if (r) return r; @@ -4650,7 +4638,7 @@ static int gfx_v11_0_early_init(void *handle) gfx_v11_0_init_rlcg_reg_access_ctrl(adev); - return 0; + return gfx_v11_0_init_microcode(adev); } static int gfx_v11_0_ras_late_init(void *handle) From patchwork Thu Jan 5 17:01:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090191 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 5505FC5479D for ; Thu, 5 Jan 2023 17:03:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DEC2910E79E; Thu, 5 Jan 2023 17:02:50 +0000 (UTC) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2043.outbound.protection.outlook.com [40.107.95.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 474E710E78F; Thu, 5 Jan 2023 17:02:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=og6mnijsUf6pkHFA33ksfTSTphRwlx5/FL7c23yruHllA4FM8gdShFN2CMNONs1AOq4S0dSAjxpvvDQI9wRrDm68e9IFm9oD9GDOmKfvumAPkSWyLZJ7bHZKt+HU0ybgVOK6XkIdulI41Hybze7kJGO6gRb4w3PeKMyFOiSnWpymzYbrNrJLSc+4hHLk9gwmrU5/bvSUsDv41Q4vCc//LAPu4E34OCR7WH/oBm6VFBWEmO4kcw3K9KXIsmmP0/7G3YW2K3KvmlidtiLChVYhQNoiCaBM6vhmdeiGpnjMT0UokpB7WEIjUZBq9vvzZrFzuL0ED6zPNTTitxL04//bIw== 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=SQqh8mUHpk5Ga21kP5C53mZvkDqNDYuD0UBWgX2JvE8=; b=ZLrT7QMomww7B55JMKQO0I3u717xpO9bEmav+VTuIdXhdGz6Pxwamn1z+6V5K+7Snuma4V2Xx8yy4J1Voo3KRZNOSkP+nU+PliOHIDYRvs0pzZIdgTmddTqWFivMkYxmj1EWUvSXKITNseV5V4h2ZJGx2+saRWiL82gFJzVLkazhpj/I87HUYf7kcEXOQcE/xxK4Uped+qZVdqe9L6+hgvTZgeGFgJC4Vcu1IUCSsQeT9LIqU+PkeAyniylm6qmsdS3j7pLVzlVdFjcdEqUYZ6TUwi9UbmwHn9dvWMHcQ+G/QfLoSshV2wSe/A9rnHFKMdWkPCjbiMjdSTdfMS+xnw== 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=SQqh8mUHpk5Ga21kP5C53mZvkDqNDYuD0UBWgX2JvE8=; b=yCbZ65+eAbOTtGqQ7PZDVJBjXUg5NxVYeF1MpM9ktikiBeyu88WRfOpX/1JGN2IXMc0O9o/YNBqmC6I3+/s+3jyUZHnSBA5JdnL5rTAILvVbmT1qRxyfJfAAiDvbzY0kl0ZHp5nqKHB7Jxtp2wbGnUa+M7PTMF27ygnJ9FxfBYM= Received: from BN0PR03CA0010.namprd03.prod.outlook.com (2603:10b6:408:e6::15) by BY1PR12MB8448.namprd12.prod.outlook.com (2603:10b6:a03:534::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:34 +0000 Received: from BN8NAM11FT079.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e6:cafe::88) by BN0PR03CA0010.outlook.office365.com (2603:10b6:408:e6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT079.mail.protection.outlook.com (10.13.177.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.17 via Frontend Transport; Thu, 5 Jan 2023 17:02:34 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 5 Jan 2023 11:02:22 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 20/45] drm/amd: Parse both v1 and v2 TA microcode headers using same function Date: Thu, 5 Jan 2023 11:01:06 -0600 Message-ID: <20230105170138.717-21-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT079:EE_|BY1PR12MB8448:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ba4060e-7ecd-4514-9951-08daef3ea40e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K9g7GGRSZPDuOhGG83j1RloIdChzXVSfPe3MF50D67/ym6CT31kpoWfeQ4eiU/2npGOZjed9OsUnWgqxjEz2IKWMUfAcBMcbj8+ZWpKooqzWzWjm4m4SMcq/hYnKew+Ya00OWPyOZL6YZifl0Q2lyF0RzN6BX/VA28rF0qEeBmJ0ZrENInAWX0hU2uxPH9mm0dZOQHij57SCg+mMSD2F26gXKXaOTGGI+3o+myBPULNVtnlmMAJRnKOJpzV2rFPkx3TfP/UcKBMfyCBPYMPAASUfpa1bRDSiC0wiwwzp19NsSfIll+zVQ/20Ej3WxtPXEcBuvEF/X/kOpBNbScld3PY/NFJKpPfmbcJiPoWIToGLNvjQI7p6h0FvNXqJM/28Liod9DVkNSg0JJyXT0hTDjUJ8eZXQrFJV5Z7L9WpG65wsYD6QQpp4wF1BLuRLMp3ELf3xLMpzL6cgyQQdh0m4TLVdy8bf2xWTFxEdhLJV5LnanzK2KpsXsfB0YI7lP59HHHeUh8vYn65Jmy0kBbEDAW0Vf1ik/9+zjUgzidVgSjFDHu4P7zpKtWCjmz46W67gRXrbs1xLaubv5ASPNq7fRGbELS2E7APqIZzJC+s5/MHw6f0w+28quD1+Mc1zZky3TCjgLqkuvkxsNnwNKJFrsIqDvDWEgGKiSaHU5N690v6foLnu8vq1L2PrmPdbOtPF0TMdTzVbp8/+1M/yRoynNVgSVR6lhEnSzd8wzlKVYI= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(396003)(136003)(376002)(39860400002)(451199015)(36840700001)(46966006)(40470700004)(40460700003)(8676002)(5660300002)(70206006)(316002)(478600001)(70586007)(6666004)(4326008)(41300700001)(8936002)(2906002)(7696005)(110136005)(54906003)(30864003)(356005)(336012)(81166007)(82740400003)(1076003)(426003)(47076005)(16526019)(26005)(186003)(2616005)(36860700001)(36756003)(40480700001)(44832011)(86362001)(83380400001)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:34.4996 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ba4060e-7ecd-4514-9951-08daef3ea40e 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: BN8NAM11FT079.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR12MB8448 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" , David Airlie , 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 --- v6->v7: * Drop tags * Only set adev->psp.securedisplay_context.context on PSPv12 Renoir and PSP v10 which matches previous behavior. If it should match for Cezanne and PSPv11 too we can undo this part of the check. v5->v6: * Rebase on earlier patches --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 123 ++++++++++++++++++------ drivers/gpu/drm/amd/amdgpu/psp_v10_0.c | 64 +----------- drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 80 ++------------- drivers/gpu/drm/amd/amdgpu/psp_v12_0.c | 66 ++----------- 4 files changed, 115 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..bdc2bf87a286 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -3272,41 +3272,76 @@ 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; - } - 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; + 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.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.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); - err = amdgpu_ucode_validate(adev->psp.ta_fw); - if (err) - goto out; + return 0; +} + +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 +3349,46 @@ int psp_init_ta_microcode(struct psp_context *psp, &ta_hdr->ta_fw_bin[ta_index], ta_hdr); if (err) - goto out; + return err; } return 0; -out: - dev_err(adev->dev, "fail to initialize ta microcode\n"); - release_firmware(adev->psp.ta_fw); - adev->psp.ta_fw = NULL; +} + +int psp_init_ta_microcode(struct psp_context *psp, const char *chip_name) +{ + const struct common_firmware_header *hdr; + struct amdgpu_device *adev = psp->adev; + char fw_name[PSP_FW_NAME_LEN]; + int err; + + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name); + err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev); + if (err) + return err; + err = amdgpu_ucode_validate(adev->psp.ta_fw); + if (err) + return err; + + hdr = (const struct common_firmware_header *)adev->psp.ta_fw->data; + switch (le16_to_cpu(hdr->header_version_major)) { + case 1: + err = parse_ta_v1_microcode(psp); + break; + case 2: + err = parse_ta_v2_microcode(psp); + break; + default: + dev_err(adev->dev, "unsupported TA header version\n"); + err = -EINVAL; + } + + if (err) { + dev_err(adev->dev, "fail to initialize ta microcode\n"); + release_firmware(adev->psp.ta_fw); + adev->psp.ta_fw = NULL; + } + return err; } diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c index 9de46fa8f46c..f14fcfb9c425 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); + err = psp_init_asd_microcode(psp, ucode_prefix); 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 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..41e29b777666 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c @@ -89,9 +89,8 @@ 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"); @@ -129,7 +128,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]) { case IP_VERSION(11, 0, 2): @@ -140,35 +139,8 @@ 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); + adev->psp.securedisplay_context.context.bin_desc.size_bytes = 0; break; case IP_VERSION(11, 0, 0): case IP_VERSION(11, 0, 5): @@ -179,39 +151,8 @@ 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); + adev->psp.securedisplay_context.context.bin_desc.size_bytes = 0; break; case IP_VERSION(11, 0, 7): case IP_VERSION(11, 0, 11): @@ -221,26 +162,17 @@ static int psp_v11_0_init_microcode(struct psp_context *psp) if (err) return err; err = psp_init_ta_microcode(psp, chip_name); - if (err) - return err; break; case IP_VERSION(11, 5, 0): err = psp_init_asd_microcode(psp, chip_name); if (err) return err; err = psp_init_toc_microcode(psp, chip_name); - if (err) - return err; break; default: BUG(); } - return 0; - -out2: - release_firmware(adev->psp.ta_fw); - adev->psp.ta_fw = NULL; return err; } diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c index 8ed2281b6557..67118e699219 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,20 @@ 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; + err = psp_init_ta_microcode(psp, ucode_prefix); 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); - } + /* only supported on renoir */ + if (!(adev->apu_flags & AMD_APU_IS_RENOIR)) + adev->psp.securedisplay_context.context.bin_desc.size_bytes = 0; - return err; + return psp_init_ta_microcode(psp, ucode_prefix); } static int psp_v12_0_bootloader_load_sysdrv(struct psp_context *psp) From patchwork Thu Jan 5 17:01:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090187 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 C862CC3DA7A for ; Thu, 5 Jan 2023 17:03:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 105E410E79A; Thu, 5 Jan 2023 17:02:49 +0000 (UTC) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2086.outbound.protection.outlook.com [40.107.100.86]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5547310E791; Thu, 5 Jan 2023 17:02:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E6WTXTQ4qT3AFebzqfxRG3L2DOtwY/zeN+cnQ0MizBbrDL7TV2TIYlHStcEevp3jPE/d4wo9oDy2DcEg0u3uc299WtGCzkFkFUdyOoo+w2VazT3SaAoPWxXDvEJWmXC+zHe4sdPwNLADSQVLcxlVQ4PQJFg4ZUNdYFrucF0bVfdowo0qYcuOzneKv46huyw7XO0AGQtl5x2JAS5H0jRTeCWcrjsPuFQNMzv24yoGLUVuyaN9/FCtCYQxpqNCH/NcRgRuFqHvOlUoXQ3PPhzCXtDB/7bvZrKzvQMLltxxBwDJRbP4hX57NijX9SvAMWAJNZ2hiCOoPKQ2kflARPIAZA== 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=3/9pw9tosB9s0uNTOJlk36kKQor2G8SMBda25Ae3eU8=; b=D5tXgZ4DYlh+IKIfoXmyTX4b8JaZgndZnFmbO9wwcCxyQftRIpSTxQ2Fppp8JKXHZDscg2hhu4ZyrkyVCKOe9XP6/54RwqBfCP0QdRJ8cQpIRSOTVEBK8iPGkix44xIxyditjyuwGnK21NnWdUi8Y0tMYbYwnO6WfBEGs66F3Vr7QxQ4LF858zcs7ipmk/UCrErg+4WhUDHfS9STso7nzJMUFFyFELUIt6Pc0LzX0f4p48Qs3gABujHbnxj7J7cPVPd6Kd2WXsanhkhM3HIGNiOZvDOYq9H37qeOGbDhu+zsFwFI1nUeXJFpIdwKsL45btGlKz6DRG2J6R5KNv3YHg== 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=3/9pw9tosB9s0uNTOJlk36kKQor2G8SMBda25Ae3eU8=; b=HMBKcdBG6RRnHwcMyJ4S/fQ+bpOQIoY4vE8jgRecpYQ8ecrHJEWXg6n2UhMVy0nzxGOV9IgTadh+3f+8Zw9nCAWnyrRQkGcytCoTPufGIpw9lwcBMjRPRR32qMu2U2v3AIr7LVMOdcpLjtYl5umqdg79cKWwXMRAkju5xUrHB1U= Received: from BN9PR03CA0964.namprd03.prod.outlook.com (2603:10b6:408:109::9) by CH0PR12MB5299.namprd12.prod.outlook.com (2603:10b6:610:d6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:35 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::1e) by BN9PR03CA0964.outlook.office365.com (2603:10b6:408:109::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:24 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 21/45] drm/amd: Avoid BUG() for case of SRIOV missing IP version Date: Thu, 5 Jan 2023 11:01:07 -0600 Message-ID: <20230105170138.717-22-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT032:EE_|CH0PR12MB5299:EE_ X-MS-Office365-Filtering-Correlation-Id: 70c12a90-ed3f-4939-d3b0-08daef3ea48c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w3o2dav2Ha4vFWi1Qc7Mh4VYTpT80Va2xA2DfKsqZW2JGCt7BRre3EGy2bvgDn560Qz3SFaG/H//fHv0oShS0oZWg9IkGi4On1cNguJOJZLDnD8nfNEUsY1eabt1/aad9KrWHVb1ZurKPJsvFscAlJPcAIUbRGPQ/C4n1fxmjrapLk1b+x9iYjTNdvt1ubhtk0HozODYQJcgGsKoTTRJFW0UbGdNKw+ZP7BQk0OOWsZSdXL4Wh2J74ffxgRP3QOfqufUmICAIPEYOfG4hUakROVDj8tLVFHf2+Qqp1BC1u5ZlaAiGRJD5IpLrhm6EkUhPM5QemwkkwJqUb3aNViKPATCl4n2WXM7NO6hfU4hTzwtKZwIfZh26wZYEcNBwPSZpp5zzbwN/PIEi55VCQ8QzwTQ/Lw0Ns8C+QQYvFMmDe9C1pHLMdLOkvl/+dueotaXkao4Jf3rn3bM/Fx667IBvBm8Bp9AsoKSjPCzTtauYKzbzrW5BPR4aDkBLM+le5p3SQA0SN5TTs2R0TuKav8qpKm9/LPuAO6i52wEUG2N/nXjwwY7gImeLSBhVHESAhrGJAUZin4GXbVpjEq0a9+P95+YnPDwlxkfSlYpbWLByYrwR85oKrZlRVT/g21RfONaQbHowTriCo8rGwqsUHW96hala+a23L8Dlf1xArkwgUlrSKh0e9/ZDYHywdkFGt36abk1wIToCYK/9rtA0bkMYEw+huRsKxRZO3dlHgoaSTM= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(136003)(39860400002)(396003)(346002)(451199015)(40470700004)(36840700001)(46966006)(70586007)(316002)(186003)(70206006)(4326008)(2906002)(54906003)(110136005)(4744005)(5660300002)(44832011)(478600001)(26005)(6666004)(41300700001)(16526019)(7696005)(426003)(86362001)(40480700001)(36860700001)(83380400001)(336012)(2616005)(1076003)(82740400003)(81166007)(8676002)(36756003)(40460700003)(356005)(47076005)(8936002)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:35.3581 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 70c12a90-ed3f-4939-d3b0-08daef3ea48c 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: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5299 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" , David Airlie , Lijo Lazar , 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. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar 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 bdc2bf87a286..8b2f1783f93b 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 Thu Jan 5 17:01:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090190 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 428E7C3DA7A for ; Thu, 5 Jan 2023 17:03:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C925A10E79B; Thu, 5 Jan 2023 17:02:50 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2079.outbound.protection.outlook.com [40.107.223.79]) by gabe.freedesktop.org (Postfix) with ESMTPS id 10EC810E78E; Thu, 5 Jan 2023 17:02:39 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XEWynvmpZBQ2rISrm4unZKPRC9bnSLHQAmPachk5BjB1ayIgqfkS6nDML5rFvcNXcvE2ui3FuePsnzkR+GwsTwbmjEt13eqgK+p0g0KH0Gv6L1LG+3W00RqTRXeFaT6vKtg9E/dc1GQRNc57PGhUUdlatgW21jWWz+WT8R3hwskeMVplkHVunSmYF+W9KGkK2UfkFXHy2BdS7wa0u4lOVh82n8CPlsIRG96vp0IjEATb3fae4vsVst/RePtYo9n+/4Zt6oHagGfmQ0mA/xIBWCaiULmfZt9mOuCHyzHGyPJy34TNj0e9OOT8uKor+SZW1RoBGWsRLHRUuKnb+Qq74A== 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=sa/7RleEfVj2oGNQ3B27rmHmw8P5FL0NxtjT6DETd0M=; b=cRZctQBlq+BRw7BynuN8ETnmBtDDSyGaJ7vkUEK6gJAKrQVkuMZJmGqR9nsRZ1SNbdv8j8BKxWMEOMpwX1YsHzrKMmR3t1AltqNeyFvf5aXXRHjxQM/80YTzXjXReNfVeJ92oJxJUk2mTsVrzwiTrohEIqwbaW83BT1Dan79byQ+2PIHgeN4scIN0Pp2W3TOksfqyNGJntVK77tgqSGnsFcBI4zHLLF9BLmAQZJYowOvkhZASaLaloM2LRsDR3Kqk9P2zIzRu4urisb+DEzWA30LPN7DGvetDWe98smQZ3gqIvPrqK3QlwDwyySyP7/J6oJF83jxdF76duSqPdMe9Q== 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=sa/7RleEfVj2oGNQ3B27rmHmw8P5FL0NxtjT6DETd0M=; b=BTLAoGvlWYYxW1OGGBe1D0IMTfc6MHWjExtGFlgg8XJgqeSyeHYw0sps5jECbFb5nNt/b8mx3d6ppLXfhqYEtRoTx0dS+rhgAs45RL5BkqShOPNB3TEoJ5qE6cppXmgIk7WY8IrsTHgiGqmJVU7M0naor4KZs594MAnjsw1P1E4= Received: from BN9PR03CA0987.namprd03.prod.outlook.com (2603:10b6:408:109::32) by DM4PR12MB5357.namprd12.prod.outlook.com (2603:10b6:5:39b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:36 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::27) by BN9PR03CA0987.outlook.office365.com (2603:10b6:408:109::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:26 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 22/45] drm/amd: Load PSP microcode during early_init Date: Thu, 5 Jan 2023 11:01:08 -0600 Message-ID: <20230105170138.717-23-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT032:EE_|DM4PR12MB5357:EE_ X-MS-Office365-Filtering-Correlation-Id: 13377d1c-29b8-45bd-b2e1-08daef3ea552 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NfP8ruzmO9Q0w2S7otK/riRonLSrJrsaPZTB4DMvda7QQNuuZN9TP7j+GfWnEQBcRgFz3Pyn1WDG+bWA8HLo30waZD98KNu5P2crOyjOoDwrPhN16EyanFEa/kTVHCOpA0oUDFs3t9VXPhUahcd8hlg1qM0hOofauhYb53jLA57UIpD0x07DWqklFtNeTk+bwxTMbz20xHP/sHrnB4cSgngXds4gThd3sND4c4XkruOPstSoW1VO3Jyfh+UNTPxjjWGLb1otQNnlW4ATKWUw5gjZQPikZT28C+ZP4cKJuZiorZZqAMpU+4E17i6zNrQLPIZn4ICr1MvoyfIgsIzpg32UAN9T1aJiVOLXZ3mSsn6CKE6Yqsto9wDkApYDSAjbYyg5hzkge+uHClFSxQCuZJ1EvYgoRuGtyGxr9CFp060tYiRnwzC+yZ5ApvvjZrPwJzUld3Dxl24VGVoSlLkwNlv7f1AowBxgrUqlt0mKbhK3zYjL60KlOh5iU9uh87vR8HkMP2T5TJ2oPmOGDrwD2L9ewxWY67JJwEe+YjVEtJpm67Ps+Ck1hKFn25vMlaJmmYzHQnatHhGTVHmhffBqNmZbwAGyNgMummmEMUH2bKLTg0Twvw84z/xafCn7qaZSV4dERDC76ti51CFthYc5GsQB5lNERczlLxpnlPwrWpNu6+kqyGbr5305wLvJdDZxq1b2nr9h94ZAh43onT6YFFUGsV2HUwx3TIQFr4lm8Wc= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(396003)(136003)(346002)(39860400002)(376002)(451199015)(36840700001)(40470700004)(46966006)(36860700001)(110136005)(16526019)(478600001)(44832011)(82740400003)(40480700001)(40460700003)(36756003)(5660300002)(2616005)(1076003)(30864003)(8936002)(70586007)(70206006)(47076005)(4326008)(41300700001)(426003)(356005)(8676002)(6666004)(81166007)(316002)(26005)(82310400005)(7696005)(336012)(86362001)(54906003)(83380400001)(2906002)(186003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:36.6549 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 13377d1c-29b8-45bd-b2e1-08daef3ea552 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: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5357 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" , David Airlie , Lijo Lazar , 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. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v6->v7: * rebase on earlier patches --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 120 +++++++++-------------- drivers/gpu/drm/amd/amdgpu/psp_v10_0.c | 12 --- drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 51 ++-------- drivers/gpu/drm/amd/amdgpu/psp_v12_0.c | 13 +-- drivers/gpu/drm/amd/amdgpu/psp_v13_0.c | 27 ++--- drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c | 14 +-- drivers/gpu/drm/amd/amdgpu/psp_v3_1.c | 16 +-- 7 files changed, 69 insertions(+), 184 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index 8b2f1783f93b..73d67a4d0f5b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -122,6 +122,44 @@ static void psp_check_pmfw_centralized_cstate_management(struct psp_context *psp } } +static int psp_init_sriov_microcode(struct psp_context *psp) +{ + struct amdgpu_device *adev = psp->adev; + char ucode_prefix[30]; + int ret = 0; + + amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix)); + + switch (adev->ip_versions[MP0_HWIP][0]) { + case IP_VERSION(9, 0, 0): + adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; + ret = psp_init_cap_microcode(psp, ucode_prefix); + break; + case IP_VERSION(11, 0, 9): + adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; + ret = psp_init_cap_microcode(psp, ucode_prefix); + break; + case IP_VERSION(11, 0, 7): + adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; + ret = psp_init_cap_microcode(psp, ucode_prefix); + break; + case IP_VERSION(13, 0, 2): + adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; + ret = psp_init_cap_microcode(psp, ucode_prefix); + ret &= psp_init_ta_microcode(psp, ucode_prefix); + break; + case IP_VERSION(13, 0, 0): + adev->virt.autoload_ucode_id = 0; + break; + case IP_VERSION(13, 0, 10): + adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MES1_DATA; + break; + default: + return -EINVAL; + } + return ret; +} + static int psp_early_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -192,7 +230,10 @@ static int psp_early_init(void *handle) psp_check_pmfw_centralized_cstate_management(psp); - return 0; + if (amdgpu_sriov_vf(adev)) + return psp_init_sriov_microcode(psp); + else + return psp_init_microcode(psp); } void psp_ta_free_shared_buf(struct ta_mem_context *mem_ctx) @@ -350,42 +391,6 @@ static bool psp_get_runtime_db_entry(struct amdgpu_device *adev, return ret; } -static int psp_init_sriov_microcode(struct psp_context *psp) -{ - struct amdgpu_device *adev = psp->adev; - int ret = 0; - - switch (adev->ip_versions[MP0_HWIP][0]) { - case IP_VERSION(9, 0, 0): - adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; - ret = psp_init_cap_microcode(psp, "vega10"); - break; - case IP_VERSION(11, 0, 9): - adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; - ret = psp_init_cap_microcode(psp, "navi12"); - break; - case IP_VERSION(11, 0, 7): - adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; - ret = psp_init_cap_microcode(psp, "sienna_cichlid"); - break; - case IP_VERSION(13, 0, 2): - adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; - ret = psp_init_cap_microcode(psp, "aldebaran"); - ret &= psp_init_ta_microcode(psp, "aldebaran"); - break; - case IP_VERSION(13, 0, 0): - adev->virt.autoload_ucode_id = 0; - break; - case IP_VERSION(13, 0, 10): - adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MES1_DATA; - break; - default: - ret = -EINVAL; - break; - } - return ret; -} - static int psp_sw_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -401,15 +406,6 @@ static int psp_sw_init(void *handle) ret = -ENOMEM; } - if (amdgpu_sriov_vf(adev)) - ret = psp_init_sriov_microcode(psp); - else - ret = psp_init_microcode(psp); - if (ret) { - DRM_ERROR("Failed to load psp firmware!\n"); - return ret; - } - adev->psp.xgmi_context.supports_extended_data = !adev->gmc.xgmi.connected_to_cpu && adev->ip_versions[MP0_HWIP][0] == IP_VERSION(13, 0, 2); @@ -2908,19 +2904,13 @@ int psp_ring_cmd_submit(struct psp_context *psp, return 0; } -int psp_init_asd_microcode(struct psp_context *psp, - const char *chip_name) +int psp_init_asd_microcode(struct psp_context *psp, const char *chip_name) { struct amdgpu_device *adev = psp->adev; char fw_name[PSP_FW_NAME_LEN]; const struct psp_firmware_header_v1_0 *asd_hdr; int err = 0; - if (!chip_name) { - dev_err(adev->dev, "invalid chip name for asd microcode\n"); - return -EINVAL; - } - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_asd.bin", chip_name); err = request_firmware(&adev->psp.asd_fw, fw_name, adev->dev); if (err) @@ -2944,19 +2934,13 @@ int psp_init_asd_microcode(struct psp_context *psp, return err; } -int psp_init_toc_microcode(struct psp_context *psp, - const char *chip_name) +int psp_init_toc_microcode(struct psp_context *psp, const char *chip_name) { struct amdgpu_device *adev = psp->adev; char fw_name[PSP_FW_NAME_LEN]; const struct psp_firmware_header_v1_0 *toc_hdr; int err = 0; - if (!chip_name) { - dev_err(adev->dev, "invalid chip name for toc microcode\n"); - return -EINVAL; - } - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_toc.bin", chip_name); err = request_firmware(&adev->psp.toc_fw, fw_name, adev->dev); if (err) @@ -3107,8 +3091,7 @@ static int psp_init_sos_base_fw(struct amdgpu_device *adev) return 0; } -int psp_init_sos_microcode(struct psp_context *psp, - const char *chip_name) +int psp_init_sos_microcode(struct psp_context *psp, const char *chip_name) { struct amdgpu_device *adev = psp->adev; char fw_name[PSP_FW_NAME_LEN]; @@ -3121,11 +3104,6 @@ int psp_init_sos_microcode(struct psp_context *psp, uint8_t *ucode_array_start_addr; int fw_index = 0; - if (!chip_name) { - dev_err(adev->dev, "invalid chip name for sos microcode\n"); - return -EINVAL; - } - snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sos.bin", chip_name); err = request_firmware(&adev->psp.sos_fw, fw_name, adev->dev); if (err) @@ -3392,8 +3370,7 @@ int psp_init_ta_microcode(struct psp_context *psp, const char *chip_name) return err; } -int psp_init_cap_microcode(struct psp_context *psp, - const char *chip_name) +int psp_init_cap_microcode(struct psp_context *psp, const char *chip_name) { struct amdgpu_device *adev = psp->adev; char fw_name[PSP_FW_NAME_LEN]; @@ -3401,11 +3378,6 @@ int psp_init_cap_microcode(struct psp_context *psp, struct amdgpu_firmware_info *info = NULL; int err = 0; - if (!chip_name) { - dev_err(adev->dev, "invalid chip name for cap microcode\n"); - return -EINVAL; - } - if (!amdgpu_sriov_vf(adev)) { dev_err(adev->dev, "cap microcode should only be loaded under SRIOV\n"); return -EINVAL; diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c index f14fcfb9c425..e1b7fca09666 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c @@ -47,22 +47,10 @@ 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, 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 41e29b777666..8f84fe40abbb 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c @@ -88,55 +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 ucode_prefix[30]; int err = 0; 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); @@ -145,10 +110,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); @@ -158,16 +123,16 @@ 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); 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); break; default: BUG(); diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c index 67118e699219..8979e4b697cd 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; err = 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 Thu Jan 5 17:01:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090192 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 9BD41C54EBC for ; Thu, 5 Jan 2023 17:03:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AC17D10E79D; Thu, 5 Jan 2023 17:02:52 +0000 (UTC) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2070.outbound.protection.outlook.com [40.107.95.70]) by gabe.freedesktop.org (Postfix) with ESMTPS id C9BE410E78F; Thu, 5 Jan 2023 17:02:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CwKptjb2za3fcPWTHbhD7gomzxfmtwqfLJ+J3mZROfeJdvil3LD1UH/8nVMorEveFY4v745YkfQ5RSnMyLbW7h9OOkh8U/FDPeoiaf4Ka0Vmvft/E5A6y4UMyz6+YZpbywWz692Bcamvf6u5IrP5HeAaTU5MkYjuSisvu+36v0DG+p0hFWdqJ8zRXhBq6uboFQDs3jNHlCtuTY1QmR0McBQDAAj68pocHGViDnw2voGy3CJF6xa/oCx/SmP7yszWAYQuqa70/3djr+Grm/AvKRQBf4Gul3S22xy/GQDuSFqhQWlVxMAIrxCSc0JpgzrlrjWC+LrnAN+HRqKrDPlkbA== 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=1h7jZJcQoktQP2k55mbhtGouKTudgpcxF0cTuKq/CM0=; b=frdMxomHIppxQkC8kZozF4d6uQnivdSztT+kow1hNCcgTdWKWAuO4/VeS2YOSoU7uMg45YKd+PHYGzHCqoefkqA8K3e9BGbL4TWQ+DB8DQnORAaN/8gFOCrk8cqfTsPi3T5fMWdr/4uEli7ZmMTbhrOgJebeKgzZ40ZwaPs/FDuumz+oHJwUnL06es/Yb23Mtzl2lwZPiFO980lPnljyUbWtw3Pb5zeOdK5pg5A0bqm0aIflEszR57knqrJipr6SWNBJu5bceuGZ5sU7pc8e12rZ3XYPgemR4M+E4Gg7NDdNh6KwOAH2WWGXODGRko8sN+rSDJm0VyicU37Z2/1p7A== 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=1h7jZJcQoktQP2k55mbhtGouKTudgpcxF0cTuKq/CM0=; b=MhqFybFbD8j5F6kW9rJ4uY9yXgnxp2h8c3HoYroTN10zLD43scEVlGYe0HzbBDR5uRV+tKBemIdKKNTvklbDFF0asvjRNRwyy/IZixlQezsbhvfdDE3aPpnmcytlYU3othheAxy7c0uYmPQTe+LWNRMsaZqS93SSonIMOvXMrB0= Received: from BN9PR03CA0989.namprd03.prod.outlook.com (2603:10b6:408:109::34) by BL0PR12MB4884.namprd12.prod.outlook.com (2603:10b6:208:1ca::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:37 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::fc) by BN9PR03CA0989.outlook.office365.com (2603:10b6:408:109::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:27 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 23/45] drm/amd: Use `amdgpu_ucode_*` helpers for PSP Date: Thu, 5 Jan 2023 11:01:09 -0600 Message-ID: <20230105170138.717-24-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT032:EE_|BL0PR12MB4884:EE_ X-MS-Office365-Filtering-Correlation-Id: 9692f2e5-f920-4e06-87db-08daef3ea589 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V3nOqAUB+/4P6cDVEGotn+PkAM3XlUJIDnbFnLZSEEAxvUQtGyiAJiGC+wURwN+WbIoJEH4cXvo/aaJyNjUz0j5SbaBxiwNR2N3PkFanae54xtYnwcHev2ETfQzX4rdbdt05GMEjmm38bMJ3g8ZccylIzxrD3BtNbPqcljLCtVFWzN1sotlwyj5DWadI/4Ornlnz7+yl3yFE1G12mVf6DrAc7CgsCRNPYPO5fqV4+6Ewx7zZZFX+jKXfob/ixmZqgf0ljn3YXDEvqZ5PR/riBsY4etvHaQmIVlPIfzm9v3fRKR/bPllt6CVnmltGSMpB7VA/3GfhWMmQh/rz3PrFkaIymO/UBlVl+7rcFqAhqiZSKVu4uik4kLb8qagY4l+LQjbUR7LeEGOANYpVhkCrIIbIr0fgYj0DhGFfWlPhabMLvmfzMRlvYFWCW4YLY0Y5Z+k1qlRBFrtELDtKMh3fcshBVnIxmKuviewA3cajedL105AuL99A5SGPtClFOP7IM4w3U/zgI4Gq8ArynBXobfelnDX37XF5DSKSlDp7PgtrJw3YC3Ca/3nJUxeYg6DoOcfQ5gwoc7m6daYGZpXRFhIr2ITCJiYJCL9EdczRlKG3GL3ZX0j1ijyDb1rGVyyo9TzA3QuYYULp0VE0EYqKXwWjx7WdRQYM49x3bNBopwH6GRsNi+MzvH9425ybr9R4DvmQXVJ7F198X+OENNKt/nqIOR6tS+asYbYgOWkKe3Js39gkOzutxptfU2C44cxKvD/VBGwiNEC2dqBT7mKSXA== 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)(39860400002)(346002)(451199015)(46966006)(36840700001)(40470700004)(44832011)(41300700001)(8676002)(70206006)(4326008)(70586007)(54906003)(110136005)(8936002)(2906002)(316002)(7696005)(478600001)(186003)(26005)(5660300002)(6666004)(16526019)(86362001)(40480700001)(36860700001)(1076003)(83380400001)(2616005)(336012)(47076005)(426003)(82740400003)(356005)(36756003)(40460700003)(81166007)(82310400005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:36.9986 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9692f2e5-f920-4e06-87db-08daef3ea589 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: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4884 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 80 +++++++------------------ 1 file changed, 21 insertions(+), 59 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index 73d67a4d0f5b..aae76acc38e5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -510,20 +510,11 @@ static int psp_sw_fini(void *handle) psp_memory_training_fini(psp); - release_firmware(psp->sos_fw); - psp->sos_fw = NULL; - - release_firmware(psp->asd_fw); - psp->asd_fw = NULL; - - release_firmware(psp->ta_fw); - psp->ta_fw = NULL; - - release_firmware(psp->cap_fw); - psp->cap_fw = NULL; - - release_firmware(psp->toc_fw); - psp->toc_fw = NULL; + amdgpu_ucode_release(&psp->sos_fw); + amdgpu_ucode_release(&psp->asd_fw); + amdgpu_ucode_release(&psp->ta_fw); + amdgpu_ucode_release(&psp->cap_fw); + amdgpu_ucode_release(&psp->toc_fw); if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 0) || adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7)) @@ -2912,11 +2903,7 @@ int psp_init_asd_microcode(struct psp_context *psp, const char *chip_name) int err = 0; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_asd.bin", chip_name); - err = request_firmware(&adev->psp.asd_fw, fw_name, adev->dev); - if (err) - goto out; - - err = amdgpu_ucode_validate(adev->psp.asd_fw); + err = amdgpu_ucode_request(adev, &adev->psp.asd_fw, fw_name); if (err) goto out; @@ -2928,9 +2915,7 @@ int psp_init_asd_microcode(struct psp_context *psp, const char *chip_name) le32_to_cpu(asd_hdr->header.ucode_array_offset_bytes); return 0; out: - dev_err(adev->dev, "fail to initialize asd microcode\n"); - release_firmware(adev->psp.asd_fw); - adev->psp.asd_fw = NULL; + amdgpu_ucode_release(&adev->psp.asd_fw); return err; } @@ -2942,11 +2927,7 @@ int psp_init_toc_microcode(struct psp_context *psp, const char *chip_name) int err = 0; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_toc.bin", chip_name); - err = request_firmware(&adev->psp.toc_fw, fw_name, adev->dev); - if (err) - goto out; - - err = amdgpu_ucode_validate(adev->psp.toc_fw); + err = amdgpu_ucode_request(adev, &adev->psp.toc_fw, fw_name); if (err) goto out; @@ -2958,9 +2939,7 @@ int psp_init_toc_microcode(struct psp_context *psp, const char *chip_name) le32_to_cpu(toc_hdr->header.ucode_array_offset_bytes); return 0; out: - dev_err(adev->dev, "fail to request/validate toc microcode\n"); - release_firmware(adev->psp.toc_fw); - adev->psp.toc_fw = NULL; + amdgpu_ucode_release(&adev->psp.toc_fw); return err; } @@ -3105,11 +3084,7 @@ int psp_init_sos_microcode(struct psp_context *psp, const char *chip_name) int fw_index = 0; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sos.bin", chip_name); - err = request_firmware(&adev->psp.sos_fw, fw_name, adev->dev); - if (err) - goto out; - - err = amdgpu_ucode_validate(adev->psp.sos_fw); + err = amdgpu_ucode_request(adev, &adev->psp.sos_fw, fw_name); if (err) goto out; @@ -3181,10 +3156,7 @@ int psp_init_sos_microcode(struct psp_context *psp, const char *chip_name) return 0; out: - dev_err(adev->dev, - "failed to init sos firmware\n"); - release_firmware(adev->psp.sos_fw); - adev->psp.sos_fw = NULL; + amdgpu_ucode_release(&adev->psp.sos_fw); return err; } @@ -3341,10 +3313,7 @@ int psp_init_ta_microcode(struct psp_context *psp, const char *chip_name) int err; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name); - err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev); - if (err) - return err; - err = amdgpu_ucode_validate(adev->psp.ta_fw); + err = amdgpu_ucode_request(adev, &adev->psp.ta_fw, fw_name); if (err) return err; @@ -3361,11 +3330,8 @@ int psp_init_ta_microcode(struct psp_context *psp, const char *chip_name) err = -EINVAL; } - if (err) { - dev_err(adev->dev, "fail to initialize ta microcode\n"); - release_firmware(adev->psp.ta_fw); - adev->psp.ta_fw = NULL; - } + if (err) + amdgpu_ucode_release(&adev->psp.ta_fw); return err; } @@ -3384,17 +3350,14 @@ int psp_init_cap_microcode(struct psp_context *psp, const char *chip_name) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_cap.bin", chip_name); - err = request_firmware(&adev->psp.cap_fw, fw_name, adev->dev); - if (err) { - dev_warn(adev->dev, "cap microcode does not exist, skip\n"); - err = 0; - goto out; - } - - err = amdgpu_ucode_validate(adev->psp.cap_fw); + err = amdgpu_ucode_request(adev, &adev->psp.cap_fw, fw_name); if (err) { + if (err == -ENODEV) { + dev_warn(adev->dev, "cap microcode does not exist, skip\n"); + err = 0; + goto out; + } dev_err(adev->dev, "fail to initialize cap microcode\n"); - goto out; } info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CAP]; @@ -3411,8 +3374,7 @@ int psp_init_cap_microcode(struct psp_context *psp, const char *chip_name) return 0; out: - release_firmware(adev->psp.cap_fw); - adev->psp.cap_fw = NULL; + amdgpu_ucode_release(&adev->psp.cap_fw); return err; } From patchwork Thu Jan 5 17:01:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090201 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 263EEC3DA7A for ; Thu, 5 Jan 2023 17:03:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8233410E7C0; Thu, 5 Jan 2023 17:03:00 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2085.outbound.protection.outlook.com [40.107.223.85]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8401F10E78F; Thu, 5 Jan 2023 17:02:39 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cNOMaKYBNWF9EEJkxlQuw6jAlNE2SacYqcLwxMUf/x+GT3mZ2rLKUTKdcViK8jbPgmHW47YGdS4qjK36aLsZuyHLU30vhXuhWXHcewVg0guopfSGvFh+A3Mea4DeJm+XUaGXgTZlIAPtpSbvp07jfp1/FeJBsbCrwKvlYsCMyzOZiRsb2RG/jEXjq96rdLrRQo6eKK04wdvG0BL8cPL4DFINf869WM2sq/w/TODJiSmKnR8AyVQe3Bi7AYDC826Hzzc/PGBiHgFTPtW9URLnMETzrYtXfeGj+4br/bPnn3R3ZkA1/Ggw+8ADt/VoUcQ4cOn/FmJA0Frc8XoQemDr2w== 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=NVuSHKTayz7Me3m8+KFvZ1j8zsL1EFktXCXdIJrEqQE=; b=KHOTmlGPARhzrJiXNdvOvPhXtgRVSC4hMSquejpfUc1oe44BdsD3B2jZ86yM/+CApEpDGELT3nJN4gvwlHWyjQq/BfAYvMKU30HZxU8eKaXh1I3Nazdvxi4bxKDMEHebbctub/SjmvBAi/c4fmo5Ifw/aDyK1xxOsSw3K3Q3PzUyZwkaAMgtLGrBPydz/wguf2a1mnVJw5zBjTkvfJ9LsW7pl0uRsufMYCw5RnzLxFIJ/duI3rEVrubvlFuTol6IUoGgrD6fOkq718OI4a4ttFDgF7DkrPCQtmnQFQ9Yu4P43Bdn22TYdYCq8DWSfx/uuUGosSndQghZbinf93FB/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=NVuSHKTayz7Me3m8+KFvZ1j8zsL1EFktXCXdIJrEqQE=; b=FJ6FkkG6xqXVRXLdCyEuzfHrS+W2jjdfnsZW3+/4wcDPuDvxwp4pGAVA4PhCnNWzowuyUiGqOGYeUnSBFbAatuC1Pl9rEKKs8P0kzNgS7u50i3jXCzLK1lZKdFJMZv3u5GNo7RAiGyy8c6rBIiNhcbgji4nWVTHFYbJgH1Fjc6g= Received: from BN9PR03CA0989.namprd03.prod.outlook.com (2603:10b6:408:109::34) by DM6PR12MB4298.namprd12.prod.outlook.com (2603:10b6:5:21e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:37 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::fc) by BN9PR03CA0989.outlook.office365.com (2603:10b6:408:109::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:28 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 24/45] drm/amd/display: Load DMUB microcode during early_init Date: Thu, 5 Jan 2023 11:01:10 -0600 Message-ID: <20230105170138.717-25-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT032:EE_|DM6PR12MB4298:EE_ X-MS-Office365-Filtering-Correlation-Id: d9f86b6e-58a0-4744-e81a-08daef3ea5aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 56RBuaO8EIzW+17R6ePu5lAY2WYGQOH2tDsLAaBNlN5G00VJED+pJEm+ebd3XbiD3+f3kwDyB7hL61AWY6IPDNiToaw6kX6uFlChZMqDjWhhVC4eP/O0TNMQQpU9f4bryj+TwGEIGvNNYJfPIO8uFy4R3gxflHMnwJEg41cABDLzLwlDtJc0aaR8a7/Cqv5W7rfmaKkBlGzBPOruTHDDlapWFVynbNV/XLvJ3vRLjgy89tmzImPJspzbXQqVYjabslFotq1ShxJuKRyAm4oChY7s6yQsGjTIyBsV9wzyyV9pXm3VyMuoRx1U3xiC8I3qNMnQOhpz04H8vdon+i4tlRF9D1HXbxtJz/xtLpKfaCaEU1BHzJBFwdIw6CRe0G4fcfCetnpKY+fBlnDrCBC9Re6NcyHRb/bYjQihYs2bk+W3qPEzNKrAVETA9OCTIB6oOYeRHOSq0H+GLxmf1G85PGv/tKb3Yc2/pOLSxRQxLGTCEJmjPxtVneedsSYtqETz5ALJD9pFNaGUHSjc+uB2ykE6Y9fSCQiEh19Z6qLmOHmcUMnO+MYiqrZ/y7ImIBIM1GhjzCOrwz6JtpqAV3MP80FxVuRNII1kN4TYFCXyaY6QvrzzyGomSmK/ppSdvdv1t5OAjw4h+1gQYsjeJY6Cfb9G8r/oy4BEr3m8HTPHHCKPXuH/5XQMvnb3Kxg84WJWao+R/dJrM4McJO3OEiOhATxzreRxjDFFBlEWJj+S8D4= 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)(376002)(136003)(346002)(39860400002)(451199015)(46966006)(36840700001)(40470700004)(426003)(47076005)(186003)(26005)(2616005)(336012)(16526019)(40480700001)(83380400001)(86362001)(40460700003)(82310400005)(36756003)(356005)(81166007)(1076003)(36860700001)(82740400003)(44832011)(2906002)(110136005)(54906003)(316002)(41300700001)(8676002)(8936002)(5660300002)(4326008)(70206006)(70586007)(6666004)(478600001)(7696005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:37.2173 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d9f86b6e-58a0-4744-e81a-08daef3ea5aa 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: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4298 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 , Lijo Lazar , Rodrigo Siqueira , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Airlie , amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If DMUB is required for an ASIC, ensure that the microcode is available and validates during early_init. Any failures will cause the driver to fail to probe before the firmware framebuffer has been removed. Reviewed-by: Alex Deucher Reviewed-by: Harry Wentland Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 89 ++++++++++++------- 1 file changed, 58 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 4829b5431e4c..c8c5d37c8b3a 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1945,7 +1945,6 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev) struct dmub_srv_fb_info *fb_info; struct dmub_srv *dmub_srv; const struct dmcub_firmware_header_v1_0 *hdr; - const char *fw_name_dmub; enum dmub_asic dmub_asic; enum dmub_status status; int r; @@ -1953,73 +1952,46 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev) switch (adev->ip_versions[DCE_HWIP][0]) { case IP_VERSION(2, 1, 0): dmub_asic = DMUB_ASIC_DCN21; - fw_name_dmub = FIRMWARE_RENOIR_DMUB; - if (ASICREV_IS_GREEN_SARDINE(adev->external_rev_id)) - fw_name_dmub = FIRMWARE_GREEN_SARDINE_DMUB; break; case IP_VERSION(3, 0, 0): - if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0)) { + if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0)) dmub_asic = DMUB_ASIC_DCN30; - fw_name_dmub = FIRMWARE_SIENNA_CICHLID_DMUB; - } else { + else dmub_asic = DMUB_ASIC_DCN30; - fw_name_dmub = FIRMWARE_NAVY_FLOUNDER_DMUB; - } break; case IP_VERSION(3, 0, 1): dmub_asic = DMUB_ASIC_DCN301; - fw_name_dmub = FIRMWARE_VANGOGH_DMUB; break; case IP_VERSION(3, 0, 2): dmub_asic = DMUB_ASIC_DCN302; - fw_name_dmub = FIRMWARE_DIMGREY_CAVEFISH_DMUB; break; case IP_VERSION(3, 0, 3): dmub_asic = DMUB_ASIC_DCN303; - fw_name_dmub = FIRMWARE_BEIGE_GOBY_DMUB; break; case IP_VERSION(3, 1, 2): case IP_VERSION(3, 1, 3): dmub_asic = (adev->external_rev_id == YELLOW_CARP_B0) ? DMUB_ASIC_DCN31B : DMUB_ASIC_DCN31; - fw_name_dmub = FIRMWARE_YELLOW_CARP_DMUB; break; case IP_VERSION(3, 1, 4): dmub_asic = DMUB_ASIC_DCN314; - fw_name_dmub = FIRMWARE_DCN_314_DMUB; break; case IP_VERSION(3, 1, 5): dmub_asic = DMUB_ASIC_DCN315; - fw_name_dmub = FIRMWARE_DCN_315_DMUB; break; case IP_VERSION(3, 1, 6): dmub_asic = DMUB_ASIC_DCN316; - fw_name_dmub = FIRMWARE_DCN316_DMUB; break; case IP_VERSION(3, 2, 0): dmub_asic = DMUB_ASIC_DCN32; - fw_name_dmub = FIRMWARE_DCN_V3_2_0_DMCUB; break; case IP_VERSION(3, 2, 1): dmub_asic = DMUB_ASIC_DCN321; - fw_name_dmub = FIRMWARE_DCN_V3_2_1_DMCUB; break; default: /* ASIC doesn't support DMUB. */ return 0; } - r = request_firmware_direct(&adev->dm.dmub_fw, fw_name_dmub, adev->dev); - if (r) { - DRM_ERROR("DMUB firmware loading failed: %d\n", r); - return 0; - } - - r = amdgpu_ucode_validate(adev->dm.dmub_fw); - if (r) { - DRM_ERROR("Couldn't validate DMUB firmware: %d\n", r); - return 0; - } - hdr = (const struct dmcub_firmware_header_v1_0 *)adev->dm.dmub_fw->data; adev->dm.dmcub_fw_version = le32_to_cpu(hdr->header.ucode_version); @@ -4513,6 +4485,61 @@ DEVICE_ATTR_WO(s3_debug); #endif +static int dm_init_microcode(struct amdgpu_device *adev) +{ + char *fw_name_dmub; + int r; + + switch (adev->ip_versions[DCE_HWIP][0]) { + case IP_VERSION(2, 1, 0): + fw_name_dmub = FIRMWARE_RENOIR_DMUB; + if (ASICREV_IS_GREEN_SARDINE(adev->external_rev_id)) + fw_name_dmub = FIRMWARE_GREEN_SARDINE_DMUB; + break; + case IP_VERSION(3, 0, 0): + if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0)) + fw_name_dmub = FIRMWARE_SIENNA_CICHLID_DMUB; + else + fw_name_dmub = FIRMWARE_NAVY_FLOUNDER_DMUB; + break; + case IP_VERSION(3, 0, 1): + fw_name_dmub = FIRMWARE_VANGOGH_DMUB; + break; + case IP_VERSION(3, 0, 2): + fw_name_dmub = FIRMWARE_DIMGREY_CAVEFISH_DMUB; + break; + case IP_VERSION(3, 0, 3): + fw_name_dmub = FIRMWARE_BEIGE_GOBY_DMUB; + break; + case IP_VERSION(3, 1, 2): + case IP_VERSION(3, 1, 3): + fw_name_dmub = FIRMWARE_YELLOW_CARP_DMUB; + break; + case IP_VERSION(3, 1, 4): + fw_name_dmub = FIRMWARE_DCN_314_DMUB; + break; + case IP_VERSION(3, 1, 5): + fw_name_dmub = FIRMWARE_DCN_315_DMUB; + break; + case IP_VERSION(3, 1, 6): + fw_name_dmub = FIRMWARE_DCN316_DMUB; + break; + case IP_VERSION(3, 2, 0): + fw_name_dmub = FIRMWARE_DCN_V3_2_0_DMCUB; + break; + case IP_VERSION(3, 2, 1): + fw_name_dmub = FIRMWARE_DCN_V3_2_1_DMCUB; + break; + default: + /* ASIC doesn't support DMUB. */ + return 0; + } + r = amdgpu_ucode_request(adev, &adev->dm.dmub_fw, fw_name_dmub); + if (r) + DRM_ERROR("DMUB firmware loading failed: %d\n", r); + return r; +} + static int dm_early_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -4645,7 +4672,7 @@ static int dm_early_init(void *handle) #endif adev->dc_enabled = true; - return 0; + return dm_init_microcode(adev); } static bool modereset_required(struct drm_crtc_state *crtc_state) From patchwork Thu Jan 5 17:01:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090184 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 E1DBDC3DA7D for ; Thu, 5 Jan 2023 17:03:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3F1A910E796; Thu, 5 Jan 2023 17:02:47 +0000 (UTC) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2045.outbound.protection.outlook.com [40.107.102.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6D13510E794; Thu, 5 Jan 2023 17:02:42 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SSEz5tCqklOy0/eUgF8r4Xw655UfZbCqMFXtAPA65p4dClAVtNhetmxKW+TDHpl1Zz4HDt5VFK3OTYu9kBOot5rria0i1EdWUbppeEYwAC2QCvIHj516MnPLcuYrHeKD6wk1UJLIeazs9aOXEc3yVJsah1GBnlZhPYuj33sfuOHNgSYUqfPxdIaNamFJAykH2T7MV4L+mV7cdvhhOOXxPunf9QDMkEIOR4qKHIzwO0YM2qxfnT+m7yKDXrcniqV2Fp1F9eghGaQzouem24RA+KUCijdyx+A+wV/yy5m6AgRAonVtSFKs3E4Wi4syTPBqBwmwm/vJorv7nwmUVBBoXg== 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=2yRHGDLRUXxsSSXHLW3h/kwCGwYLIu0ebIvPK6hFwTc=; b=LAk0+FdNOmKErYRTq6qGI0Dj/QpjUKsFLsXUaYB89KMZXDegGymP/ucjpHobTKUc/3JF7xiqvYcTNpmhYVk7iiA4jAqX9St8giEih0u4mIikKmSn0S2kPiHCfrilhEUhZRdEs0XRnk+o630+Fv6rFNlIL9Ibp1ufhu/0tUg4SfOiUZwkH0bgVpeBdSIF04PYjOpTxJvG1m63wAOYLmqDZa//hhJMcZumHCYtZdIGrLnAjq0kILCSv6bwbef+rQkYxHv0OltUnivsnIbPV6kBS56smpQ6ug1Fla0TynlBRX5xfQ2BOsC03oV+ot47OoOaTCqH7uGdmFidNGeQZZXS7A== 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=2yRHGDLRUXxsSSXHLW3h/kwCGwYLIu0ebIvPK6hFwTc=; b=lu94uR6+4E0fFSm/WTaUaMnQFbEon2DNTIXYvIH7mBrNQvRK2GhgWUhb9ChYk/yjiCXtSCERKRHh1NuuJLZY8CXyOdc4zWhhUrb4/o7U7J72fR/xXljNDBIyfFcmOPUF7vEH+BLwQo525zHkc7T/QyNAD6A35HOK9wj7/P7BuDg= Received: from BN9PR03CA0987.namprd03.prod.outlook.com (2603:10b6:408:109::32) by IA0PR12MB7604.namprd12.prod.outlook.com (2603:10b6:208:438::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:38 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::a2) by BN9PR03CA0987.outlook.office365.com (2603:10b6:408:109::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:29 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 25/45] drm/amd: Use `amdgpu_ucode_release` helper for DMUB Date: Thu, 5 Jan 2023 11:01:11 -0600 Message-ID: <20230105170138.717-26-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT032:EE_|IA0PR12MB7604:EE_ X-MS-Office365-Filtering-Correlation-Id: 17bd2ce2-30ed-476d-1fb4-08daef3ea5e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1naLp9JHM/Say5Ewtvj42lGDtbTpGv8aWmikvsqSRJqas7Bns3aVZN36pKCnWCKwrq1Ls9Au/gfQhGgEpzcq6Co2HpxjQNipoat/LkrPg1pMJuwj7nYweMXg2qNgNPSkNoqZvRoIEqp3YXfDyl8XjUH9+wVDfXNoIy2SJWI6AwDrUCC/+xyADSSmc3xoJmJScPMTN0nENu6BK7oqyLN3oUHwFry9nebFp2WBLV+8GtIVMdXwFbrJmtDyfP+tdUqHitI5TMZBUieIcodWjIUcj3Ygr0UkFw8enSuQwTR2JtzvEGOgF0gAONiEh6HuQ9wdcvxriKZnGs2uxJWBTsgfPF8vNMesAjfcobyekMBASkcV1c3GYNVDUq5cJ+MVRavvbUg1MnhWAOJywXElueQfU1dvWU55e8v1sRvBgaA0T+hBMderBHqhgnqT1bHs4/YjEeyunGGB848lN2X3FT0fu8t5iYoB4ODldERCUffwc94bbseWHvFJiN3+j/Qc3Oi7E+ITINwg9SfoILxsWQ+qY64ZijQhmBWmZ/XjgzBRxZBQiThiWdh10/NWsX1l3JPm6w72PHkH2Ra1N8kWcIOY45+53d8B8LeQI778BHE7e1bk+zmw1xd1Mnm4RNO9STbuoE9oh31O2z4G9/BplSavpP/GUfSDRHIzIGrdb+ny/TCmql/ifXyfOqwaC3kXEJIOAKsojkfTaIr0ZkFzRHiiOXcb5fqS+1VOyeonTz6vuhSP6+x8jwnhV6/iD0820mGBszhqMnFLMX5rYk5TvKua+A== 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)(8936002)(41300700001)(5660300002)(8676002)(70586007)(54906003)(110136005)(2906002)(4326008)(7696005)(70206006)(316002)(6666004)(478600001)(47076005)(336012)(86362001)(426003)(44832011)(26005)(186003)(83380400001)(16526019)(2616005)(36756003)(82740400003)(81166007)(40480700001)(356005)(1076003)(40460700003)(36860700001)(82310400005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:37.6079 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 17bd2ce2-30ed-476d-1fb4-08daef3ea5e4 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: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7604 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 , Lijo Lazar , Rodrigo Siqueira , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Airlie , amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index c8c5d37c8b3a..61c192ead62f 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1898,8 +1898,7 @@ static int load_dmcu_fw(struct amdgpu_device *adev) if (r) { dev_err(adev->dev, "amdgpu_dm: Can't validate firmware \"%s\"\n", fw_name_dmcu); - release_firmware(adev->dm.fw_dmcu); - adev->dm.fw_dmcu = NULL; + amdgpu_ucode_release(&adev->dm.fw_dmcu); return r; } @@ -2113,11 +2112,8 @@ static int dm_sw_fini(void *handle) adev->dm.dmub_srv = NULL; } - release_firmware(adev->dm.dmub_fw); - adev->dm.dmub_fw = NULL; - - release_firmware(adev->dm.fw_dmcu); - adev->dm.fw_dmcu = NULL; + amdgpu_ucode_release(&adev->dm.dmub_fw); + amdgpu_ucode_release(&adev->dm.fw_dmcu); return 0; } From patchwork Thu Jan 5 17:01:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090185 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 7B47DC3DA7A for ; Thu, 5 Jan 2023 17:03:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D41C10E791; Thu, 5 Jan 2023 17:02:48 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2057.outbound.protection.outlook.com [40.107.223.57]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1C95610E791; Thu, 5 Jan 2023 17:02:41 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=guSR4ikdK784LTNSf9tFX4YDJ6noxGP99eUQidk7ppQc3T5xvQcmFPGPIkA7O55ngFg7zLWkieXRyxtD3fkcXM+turj0Pk+XfsZd5wCvL6+T0ZrCU34BuJ6WLU48N4Pe2du+RRZVefgbPbFsF/sn6xJzEGx308z24zt65u0MArrQi3eiTFvBYn/uTsPF/sLjR/syqGdmxr3eHSQIGfjTl0uKR9EoqRxBA7zpakAmEmoOolMK4uazC3Q72GxgUMskU64mXP7pcSEHGhdsJ7pdTdroB4VvKHdL7RmARK+17JbisqTTPmXDTmS5NZZfJmRD3piO8C/kKLuo7TLpiie6IQ== 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=BJJDZIRJksGFX9iaua//hMeHMKC/cUrSsen3cp59IkU=; b=X0t9hGCM2ngmUuK6FKCT9aCDlFb0ENQ71cl2vrDiiVtYqZXnS3vasR2R1Sv7M9Jme+ikF8CwohPymRFXYi/grEE/JIWW+V1/1fDpwL0ZNRUOV50aeSHWyI/eskIcQiWgfS/7ApjVY0AcZ03cwK1QeNvi0WcgyaXE9LJZZfT/cUD+Wwdnr8t23S/3w08eeKKzluakRjYMqufJLNaduG0Qy6M/WpmAgKTtSm0fE9xQD52Z0UxGQWPkb795uaagd2vE8mRl6iAS5hoNVA+hV9DEY3XVl4zjS8+gn+weu1qzdzw+zyOMZBo2u1R6q0NgWJD/S/8kpKT3wExjqgWDFkiD1g== 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=BJJDZIRJksGFX9iaua//hMeHMKC/cUrSsen3cp59IkU=; b=wdm+0xb7DZ+jrFz+TbfPL3vCWI5Ls6FG7eVUwi43+GqegY/u1nIQqgzQkgvtZ5MMhD5TJNAdYZURNlyiijHtN/GoIU2LbRfNXwwpWYzDl8sxrmb3ZbpB1MC5jJ9B7TPOYuHkqjXbu4v9hksbE2Gp/w8sHKq5uJ3s/toUwBBlPec= Received: from BN9PR03CA0978.namprd03.prod.outlook.com (2603:10b6:408:109::23) by SA0PR12MB4383.namprd12.prod.outlook.com (2603:10b6:806:94::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:39 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::83) by BN9PR03CA0978.outlook.office365.com (2603:10b6:408:109::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:38 +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 BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02:38 +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; Thu, 5 Jan 2023 11:02:31 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 26/45] drm/amd: Use `amdgpu_ucode_*` helpers for SMU Date: Thu, 5 Jan 2023 11:01:12 -0600 Message-ID: <20230105170138.717-27-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT032:EE_|SA0PR12MB4383:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c59a86f-441d-445f-b0b8-08daef3ea69b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OLu7CpLNVLciwOBRI7JW+iaO0r6lB7Jj9y2VOQe9p6YP43Y0OWkfiUNqYzFgNR1b+JHDxSQbKrGh5IjaODGLzv4YaS6dpNEyWJga3T4GSYv4gmVGRSeDUtKkXEpWXKYdJLaExSjc7zxZSXYs4ypJukfkk8fNZHMkceEsZdUL1r+1vtjRdjdowt8r3m1H317HNLLajSBos+01T6oNz/a1tDcqt/eGfAAGzeJci2z3jRkstCJ05+G1rxVGVWNGUJz7j39zhMtShVBYbpSG+ZPGIPIIGIEu8zMnPvmUmB239l/G+pR9Wo0xOBEv9x5Scl6OXlYBXrIhb72QPX+ZzW6nHarNNjRI0yQ1ub3rZdonlkl+MbE4Bd7AY/iKedrQ7a9cb43Qr1clovlFwjimkEINIJy57+00PpexAyjHGPuvxFdfDiFfWYOeUak/XJ9gnhjkjwUOr+z6hwOd1vVuKqytPfF81k0Tr+Sw1cl+NzCu3YVq5w4HSLlXP/2shkX04gDpoP2Ob+KnUQPhNk+7DQSrxlUPfUnCbO6FCEYhj/JTeHAufYPMte7WyHuaJKj4hwTXBxchD/H7MijGNXQ2sjvgfBsmXcbi+dyRFzRB/g8Xz9irQNftHHBJUtuVicJG6vlN2f1jor+Ib1uRbKGxX0lSXbHXPz6gSIPizLq3dINQSwPJhrHd4gKyGTDl00RILVWgB8nzZkrtuljeI+DzpmYPIXJRaMoOs2hqUB7ZkZsu9K4w4IZMHVzWJp8jIXqYI50tdoZRjV8Y6I2gRlCYoMDp4A== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(396003)(136003)(376002)(39860400002)(451199015)(36840700001)(46966006)(40470700004)(40460700003)(8676002)(5660300002)(70206006)(316002)(478600001)(70586007)(6666004)(4326008)(41300700001)(8936002)(2906002)(7696005)(110136005)(54906003)(356005)(336012)(81166007)(82740400003)(1076003)(426003)(47076005)(16526019)(26005)(186003)(2616005)(36860700001)(36756003)(40480700001)(44832011)(86362001)(83380400001)(82310400005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:38.8109 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c59a86f-441d-445f-b0b8-08daef3ea69b 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: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4383 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , Evan Quan , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 16 ++++------------ drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 16 ++++------------ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c index d4756bd30830..6492d69e2e60 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c @@ -109,10 +109,7 @@ int smu_v11_0_init_microcode(struct smu_context *smu) snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix); - err = request_firmware(&adev->pm.fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->pm.fw); + err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name); if (err) goto out; @@ -130,12 +127,8 @@ int smu_v11_0_init_microcode(struct smu_context *smu) } out: - if (err) { - DRM_ERROR("smu_v11_0: Failed to load firmware \"%s\"\n", - fw_name); - release_firmware(adev->pm.fw); - adev->pm.fw = NULL; - } + if (err) + amdgpu_ucode_release(&adev->pm.fw); return err; } @@ -143,8 +136,7 @@ void smu_v11_0_fini_microcode(struct smu_context *smu) { struct amdgpu_device *adev = smu->adev; - release_firmware(adev->pm.fw); - adev->pm.fw = NULL; + amdgpu_ucode_release(&adev->pm.fw); adev->pm.fw_version = 0; } diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c index 506a49a4b425..59d00fefc558 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c @@ -103,10 +103,7 @@ int smu_v13_0_init_microcode(struct smu_context *smu) snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix); - err = request_firmware(&adev->pm.fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->pm.fw); + err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name); if (err) goto out; @@ -124,12 +121,8 @@ int smu_v13_0_init_microcode(struct smu_context *smu) } out: - if (err) { - DRM_ERROR("smu_v13_0: Failed to load firmware \"%s\"\n", - fw_name); - release_firmware(adev->pm.fw); - adev->pm.fw = NULL; - } + if (err) + amdgpu_ucode_release(&adev->pm.fw); return err; } @@ -137,8 +130,7 @@ void smu_v13_0_fini_microcode(struct smu_context *smu) { struct amdgpu_device *adev = smu->adev; - release_firmware(adev->pm.fw); - adev->pm.fw = NULL; + amdgpu_ucode_release(&adev->pm.fw); adev->pm.fw_version = 0; } From patchwork Thu Jan 5 17:01:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090196 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 86BE3C3DA7A for ; Thu, 5 Jan 2023 17:03:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D102410E7AD; Thu, 5 Jan 2023 17:02:56 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2065.outbound.protection.outlook.com [40.107.94.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id B8D0310E791; Thu, 5 Jan 2023 17:02:41 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P8YQk4s+ibVLqZeJPTxDNZ06zCBIhbPXkOmrVxtRRDKsHJImCVxqCscjV+gR+L6N/7KfPNRM2u/F8DZhUbvbP6MwjJpCMmH5DiuFVqdlZp8TU/dKWqed2EQSkyP7PNEOxO+4HiBMMoE2ZJYcQUwL3uF65m0EiWX2bBj99n57QXMaBJQZS0eJxcZ+l5dTudCwzLlS0oWRvoYd3V7xGFYCPkkOtY+WOrWAHACt2TFhE6mM/h0EhWU+6IO9xXPUuS0QuImkElUS2ypEZdMG+8RWL7iXV88TcnefihNk8k7kVOqmGOXz5GTu3jPOT9pmufLE8kL0kKwxcZ2mMjEiVStP2Q== 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=VV5Q9ryV098KlazZ38wCpKZugkhlpM53/KjHVNDIpcg=; b=W70/3xGtJOoAdIPUtoUd9k4LeqgvJUPABdgPNnI2oQ5P1OK5rDRM91H8qE2xVAohiU3+9+NcHcGJhRAC2VJUhQBcC8ECwcFkNk7POYmYMnlQIoCqN8TpHjOdIhekcgZAM3Qk56TN/myNRE/9QFQBVNlTZiMxHyNqroPYLbmRHeF2p+2MAOSYEFt7lwug9Cciwq0hf3qYPxMl8EEX1xhNXuSfea3yWaWWAwmjyv1ObD0LgqkuMXLEJiEArx0XuNtynokSNG79qSr7NpNbl2yvvhFjkr4/m6noqIat8v2GrG0vl37e2DJzmsQZPiJ5MiDmgFZs2LpZEPbBwHBuyrQH2A== 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=VV5Q9ryV098KlazZ38wCpKZugkhlpM53/KjHVNDIpcg=; b=PvUPOQgiS2zExKyxVnEL238FgF92i/ukOIE/W3qhqjFEAia7RpAiwDf0XokfxRH+K2wdP3NvFgF8l71F4LKySbXcnSSy6eGl2dH2UUaG3+5jofe9y9Hd0aYvJQjJ/nz8kYMeCne1A5ch4TDvQ3lH7VKaw7uWXJ9B2v/qoPjAN9E= Received: from BN9PR03CA0983.namprd03.prod.outlook.com (2603:10b6:408:109::28) by DS0PR12MB7898.namprd12.prod.outlook.com (2603:10b6:8:14c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:39 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::91) by BN9PR03CA0983.outlook.office365.com (2603:10b6:408:109::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:32 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 27/45] drm/amd: Load SMU microcode during early_init Date: Thu, 5 Jan 2023 11:01:13 -0600 Message-ID: <20230105170138.717-28-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT032:EE_|DS0PR12MB7898:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f3e8cf8-3f11-491c-e5f6-08daef3ea6f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TihazTQRdaLIyWugX5CZPSldpfSKh0MBbHrdI1GFWtjwd9vQU9BzgQv4KP9WVhVX9vcrdcY7SmXmmJPoWHa4GwphC33mtdALPJuWFpnZEGOZkFdbdjTmGv9mJqpeY5IzrA+HT68Rw+3Vy0yVp7Hemifx3raTMteetakFzyUP38CSa3tp/WK6hmzF6VIhLjaXgE/+HWpOqOYlTX9jJWl4y8haGP7fu69ECUjwukk9q0GvTz+3SapHqxrCza7jXjBzOIOiZs8dwDc2ajF/t8h5Aa1iMywRBVSFJyKiUM+Y2RKEAQU8ol91pcNr5zfUc/bwjSLMqXZTHZXu5ajd7p1tR3gNPwhgtJOoaNGQmKA6loWtIvpqE/spD4/ygYYhiwWbz1NC6X5sgLSt+usGRePSqFzVzIP/LBCMPOMdvUDcSC33TCo/yDD7LpP4Q+kfR7zl8T2kjYDooTvNsIyRXFu3sqv65FQReYS3XsTyF/jSgGzf4xNcVvUs6wHZewzjO+HK9XueRshpMEztnzeR8xeRQIpRVocx1vJAy+GMUs2UtRQV3MwdBwoN6H9OnsrA4lzvDoDr+nInPOQPiyHfKQp/WPXgEzBBBzEiXtiOh3D3jMvZaLwE4XmGUzBdeu0+rVN6OmOx9EV2unqmr7zdv5ufpu8wz3pisfRJ06/beETn05yglksBVUqaSOUDMfVrT2RPe5KFUESBiapluunf+9bKV4fUhiCcXTXmZGC6OMgr2M8= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(396003)(136003)(346002)(39860400002)(376002)(451199015)(36840700001)(40470700004)(46966006)(36860700001)(110136005)(16526019)(478600001)(44832011)(82740400003)(40480700001)(40460700003)(36756003)(5660300002)(2616005)(1076003)(8936002)(70586007)(70206006)(47076005)(4326008)(41300700001)(426003)(356005)(8676002)(6666004)(81166007)(316002)(26005)(82310400005)(7696005)(336012)(86362001)(54906003)(83380400001)(2906002)(186003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:39.3890 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f3e8cf8-3f11-491c-e5f6-08daef3ea6f3 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: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7898 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , David Airlie , Lijo Lazar , 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. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c index 2fa79f892a92..ec52830dde24 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c @@ -623,6 +623,7 @@ static int smu_early_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct smu_context *smu; + int r; smu = kzalloc(sizeof(struct smu_context), GFP_KERNEL); if (!smu) @@ -640,7 +641,10 @@ static int smu_early_init(void *handle) adev->powerplay.pp_handle = smu; adev->powerplay.pp_funcs = &swsmu_pm_funcs; - return smu_set_funcs(adev); + r = smu_set_funcs(adev); + if (r) + return r; + return smu_init_microcode(smu); } static int smu_set_default_dpm_table(struct smu_context *smu) @@ -1067,12 +1071,6 @@ static int smu_sw_init(void *handle) smu->smu_dpm.dpm_level = AMD_DPM_FORCED_LEVEL_AUTO; smu->smu_dpm.requested_dpm_level = AMD_DPM_FORCED_LEVEL_AUTO; - ret = smu_init_microcode(smu); - if (ret) { - dev_err(adev->dev, "Failed to load smu firmware!\n"); - return ret; - } - ret = smu_smc_table_sw_init(smu); if (ret) { dev_err(adev->dev, "Failed to sw init smc table!\n"); From patchwork Thu Jan 5 17:01:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090197 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 F0D19C3DA7D for ; Thu, 5 Jan 2023 17:03:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4FA1F10E7B2; Thu, 5 Jan 2023 17:02:57 +0000 (UTC) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2056.outbound.protection.outlook.com [40.107.212.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 31EB810E796; Thu, 5 Jan 2023 17:02:45 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KbKLWVx9PMz4hs/TZTN746ySriHDHZyUDnBZKhvAeYEsFgjK3QUo3dmSMOJTR5YU+CsSvNjhhWIIO8DO5A3bX1jH7feirC3jCB0XdzDAZ7S9a+WWWT4+1Js6Jr/9PlYEjqU8fsJdu2nuKvqWTOPN1PZcoRo2RzaNa+ogGcDME3m8bobhi9MHu2Dfqj0BQatJmmpT1P6prk5EABeNbsQdTSMYNzSxa36OCZH3Y21fC50/+YvWKa5lcJS7qZqnlq9HKyQserh01/g3y2Z73aPqI6nkaBEM1xl3k/LKo1LHgGMAduhyPiccGN1bC0LT13FBCvzTxnARMZ/tgGe/OD5uUg== 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=lXHXobqIrNHxfwgyjbdJKj6JNNT/BgvSNFG2dkGFj8Q=; b=IUXjyQrGte27SKzd++zWeyOxf28awIJx2AAz++SR/dOjZfuh4/dE/GDgtatRgNzlZfrBOiegzYyyY7uW1y4J63NV+t/vPxxI6xSTyQCTdkJLcM9kum8AUF1Z0z3d3GexMH+pMv2jlW+ioa+5gsMG4O0RbZMnwAAVS1hEhjYqDpnWvQY0p5uEELCuJX0Y3MdDG3egN//eAfH6PcUAzRfKGd/tDjAuGZlarrtDVt1NwwW2gBiZWpfa9Ndh9Ug9dPDkCdm++AkPWVv6mn7lhstpLVyNwfD23cEa2ridWDSYAhKHg+szVEhbwIo8o4mfX4bBaw+P6dUfhiU6mlLMrUNieA== 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=lXHXobqIrNHxfwgyjbdJKj6JNNT/BgvSNFG2dkGFj8Q=; b=KFO4FNrfwTFPxzSfPrCEhXCZI6omZkYRJybbjxLU08EQj0z3nl36sFoNWmUvLH5gH8iSIl3qsx3HkRkV+PMBho7a1IlTa2NLHVA8g3o0TP58+VsCmM5FlAu0FvcvPVmk7c5cF9d2enqafmEMmsw3ozAHidp+mGpAjsN4n95jncA= Received: from BN9PR03CA0978.namprd03.prod.outlook.com (2603:10b6:408:109::23) by MW4PR12MB7309.namprd12.prod.outlook.com (2603:10b6:303:22f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:40 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::83) by BN9PR03CA0978.outlook.office365.com (2603:10b6:408:109::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:33 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 28/45] drm/amd: Optimize SRIOV switch/case for PSP microcode load Date: Thu, 5 Jan 2023 11:01:14 -0600 Message-ID: <20230105170138.717-29-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT032:EE_|MW4PR12MB7309:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f1f0c55-2da1-4169-e1d9-08daef3ea731 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Pl6J/NHz9HO5J9zJ5MzkbjPv9SVoKZCGe7tT+eSO0fBd8uWggq9+7PiNkxCL4cpLJ5h0yPeNKFWJZoFkahpcMGqnNbWRiCnZIDjWKT9BncS1nvaoQmm+8Qcs0sLL4DfmACslSAzNeA/0QCPtCwCAHt+JS1nbhSdiIO2x07iy9KrodbMxQn4OyZBGeWAQAat7vrb0xmLhaYcQ3mIF0KOEkysdNqMnrh6Q571CdpXCnbJwUsSC1ZwnduzguNHSSnhqUt8+FvOFmI8ZlN6Clj4db5kYXcLcod4EtrUd+8ZhmShbmsHWnZkiDGOYPNPS9f11gc/RpgDdSIc9ztect/7NpLfAF+VrdLxifECfn8i+qkcEI0sJMkDH6n5zkaT+p2u26TMqV/zNVsO9b2vQTy4qnnVx7NPw00CJfQXJv5trQMKl6nr1qqrfFeGQMSQuqJcP4oumLDd1vkZKM0oQ0iMyko8eKT+eMLH1DoOv/I5LdoYxOhGBRzoGHUP8LWI/YGG519f6fWXtdXsJ/zITQ6sSpRdyobVRFqR2NYlAByyicuCZbAdzapyRF6QFo/FnpIY+U6aaft7ChzV41gkp2aNnHt/kmRAodyIH33AvNdewlLaf3Guye4LqMmXzCPc/V0Jv0pM+B3lZYOVPYb5e2X8f/vJR+JYL5EX0OK5mA9kALdzo1VB5pFmPtrp7ZD19zkue4Ya8QvDAdfbPxX+09GoKRgPWzCBe5peUyR5pJDmwdsU= 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)(8936002)(41300700001)(5660300002)(8676002)(70586007)(54906003)(110136005)(2906002)(4326008)(7696005)(70206006)(316002)(6666004)(478600001)(47076005)(336012)(86362001)(426003)(44832011)(26005)(186003)(83380400001)(16526019)(2616005)(36756003)(82740400003)(81166007)(40480700001)(356005)(1076003)(40460700003)(36860700001)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:39.7952 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f1f0c55-2da1-4169-e1d9-08daef3ea731 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: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7309 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Now that IP version decoding is used, a number of case statements can be combined. Reviewed-by: Alex Deucher Reviewed-by: Christian König Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index aae76acc38e5..706cce2edfaa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -132,14 +132,8 @@ static int psp_init_sriov_microcode(struct psp_context *psp) switch (adev->ip_versions[MP0_HWIP][0]) { case IP_VERSION(9, 0, 0): - adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; - ret = psp_init_cap_microcode(psp, ucode_prefix); - break; - case IP_VERSION(11, 0, 9): - adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; - ret = psp_init_cap_microcode(psp, ucode_prefix); - break; case IP_VERSION(11, 0, 7): + case IP_VERSION(11, 0, 9): adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2; ret = psp_init_cap_microcode(psp, ucode_prefix); break; From patchwork Thu Jan 5 17:01:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090189 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 B98BAC5479D for ; Thu, 5 Jan 2023 17:03:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D518610E79C; Thu, 5 Jan 2023 17:02:49 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2069.outbound.protection.outlook.com [40.107.92.69]) by gabe.freedesktop.org (Postfix) with ESMTPS id BEA7810E796; Thu, 5 Jan 2023 17:02:42 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=msCcHLC8ksScFkjBqTHc1heC9W9NJNEKmeqZR3V6qOCQa+/u5OYvZCsa0fSnJZ5HKYRaOkHCrZnQ4dORBACvBNaOGcnrhTpVyDFXajt8osZ1K/YDMPeDNelB/IlBsQJdrdRSzF/WGTIxehB42qRuzd77F4bZcp+qKrP5iQv4B5+5rJBl/ne3RFskJVbpBUCOtkbpD5paR0XjTs9VpsZR3xU9BdNbtdOTInHkp1gDXqS+xKqld+XmBOssl6V/zhG2XlzicmucJ23UYffp19Dct2QGU+ImVoOjZiZG8rd6FJYoUrXVeQisjO/GpASYqTer/BVXpJ+TnnPnyl4cNUxwjQ== 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=yodnuGCZ87o1JuAMnZYYOGDIcQwNqxnsFF3l+uMFSN0=; b=SfujZpqjb45UyXU9gMYomeijhVJUwAKXakGkZ7lEEc4eJxQUtAIlNBeWxR/ndDuCSQuRUhr32zhao3UJfQjCvFHDmQ2Qeuabqxj1Me0yE3JNUsHU9LlAvBjFmrjHPpAPLIjRjg7eKsUeAQjTFXyYYLy0qZvQkQT+ympmAmUbnhYrxns8KHg65Ht+dyQOFQqKl8DvZumfdOvmHSeec998x0MHTB9clHWTRjr5aFE2F4895F2GhfjmMV3TRChtJ57ioZXxbZfV5vRSAvLtBV9a1s00RwbNjdaZxxvFJrWFo8WoAnL/yYhHgMBghIjKYV3hlVCbIV0s6U1GJTzom2dKGw== 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=yodnuGCZ87o1JuAMnZYYOGDIcQwNqxnsFF3l+uMFSN0=; b=lzlb+iTDkHSWtTkZpa2jzNcKepaVj3VSwHxvz2L6xtDyTwhA+YhTL1E5VMrFqbJNKViS7wSDZJcl1ei11eZdXdAf9OerFax4/4yma0lFvV1RCSNm4xF5SEcmUJBf6FSxSvGfIOTexMs8nWoqYxZeQLIfpRCfKA9rpELQLlzJDx0= Received: from BN9PR03CA0988.namprd03.prod.outlook.com (2603:10b6:408:109::33) by DS0PR12MB8041.namprd12.prod.outlook.com (2603:10b6:8:147::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:40 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::c6) by BN9PR03CA0988.outlook.office365.com (2603:10b6:408:109::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:40 +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 BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:34 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 29/45] drm/amd: Use `amdgpu_ucode_*` helpers for GFX6 Date: Thu, 5 Jan 2023 11:01:15 -0600 Message-ID: <20230105170138.717-30-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT032:EE_|DS0PR12MB8041:EE_ X-MS-Office365-Filtering-Correlation-Id: 4796421a-f869-46b4-c72f-08daef3ea79a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LCAfQfMJMFwiAXj6RM/ZoT+nsMRq2Ep9wRdF8bdNQrFnB/BBTK5q5QhTBECnukcepD4KCpeuETU1hEqwwkyuYfvo1j3lQHtJN8tsMPHTqmStbsrbLa/5O6aLbJk/wdVyQ1NeRcwLyKYBpQ/lMv/q8hEA/AVIQT2LL9QVnX/m83RCUlnadVnpkNfmU3p/DVS4diIj/EOP33WjAqmG9ymnACgupJstvA4ZZBOzwpmd7fvOm4lmYWdwfvYmpiS0TG+vuhUpybiRiLUAqwtBZ5+Bi/wi3Y/3MOsahNdIcD9P6H30tGKBgxiBtqvs/si2NBW6rYHr/zmR75+1eYfN/MnQk7XOw7YlNp+B4dBfHEQIu7nFVDYaD4vUC1ZwdiHEZ1lxCOx4872IgrhBWgq560+uGm50kdSwC568UVI2ludzR/sdCEnrLwprabOKBB6i2MIuXbckfDBiQmswuQrlAwvhiv3KwI5gHAXXO2sQgjIV+vD77Pg8g7qwZ0CXfOlbyyvUn9LFB7bsBjGt69+gaFn/xpgFUW0Q12qhG+eFPwq6uqBJGLH49JjigS2J5/PW3MVx2S1/2ScFjym1ixgctLtJxJqkQBJQgFSVDnnpzCxuh8hloMiU+ul/sGbxNGbyZFcNBtEyCUp8mr2aQV0brYc1RVjSURAkrd/ZbwCY2kSNHCiFoXQ3z2djwg0x3FQBdr3uH+BZeXc6/grW4WiiaKvjJAzL+exJFwc1Y3zb1jFjus3g+h0ovrgOGi4pNHiUDCVec30FgTFwaZ71UlTkwL0ecA== 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)(396003)(39860400002)(451199015)(46966006)(40470700004)(36840700001)(5660300002)(2906002)(44832011)(8676002)(4326008)(8936002)(41300700001)(70586007)(316002)(110136005)(70206006)(54906003)(478600001)(26005)(186003)(336012)(16526019)(7696005)(40480700001)(6666004)(426003)(47076005)(83380400001)(1076003)(81166007)(356005)(82740400003)(2616005)(86362001)(82310400005)(36756003)(40460700003)(36860700001)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:40.4827 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4796421a-f869-46b4-c72f-08daef3ea79a 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: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8041 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 30 +++++++-------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c index 204b246f0e3f..438eab348fc8 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c @@ -338,10 +338,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name); - err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.pfp_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); if (err) goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.pfp_fw->data; @@ -349,10 +346,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev) adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name); - err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.me_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); if (err) goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.me_fw->data; @@ -360,10 +354,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev) adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name); - err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.ce_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name); if (err) goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.ce_fw->data; @@ -371,10 +362,9 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev) adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); - err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name); if (err) goto out; - err = amdgpu_ucode_validate(adev->gfx.rlc_fw); rlc_hdr = (const struct rlc_firmware_header_v1_0 *)adev->gfx.rlc_fw->data; adev->gfx.rlc_fw_version = le32_to_cpu(rlc_hdr->header.ucode_version); adev->gfx.rlc_feature_version = le32_to_cpu(rlc_hdr->ucode_feature_version); @@ -382,14 +372,10 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev) out: if (err) { pr_err("gfx6: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; + amdgpu_ucode_release(&adev->gfx.pfp_fw); + amdgpu_ucode_release(&adev->gfx.me_fw); + amdgpu_ucode_release(&adev->gfx.ce_fw); + amdgpu_ucode_release(&adev->gfx.rlc_fw); } return err; } From patchwork Thu Jan 5 17:01:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090188 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 56C57C3DA7D for ; Thu, 5 Jan 2023 17:03:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9801E10E798; Thu, 5 Jan 2023 17:02:49 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2078.outbound.protection.outlook.com [40.107.244.78]) by gabe.freedesktop.org (Postfix) with ESMTPS id 975B710E791; Thu, 5 Jan 2023 17:02:43 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S4TiKY4AqaFpmltZzQm+EH12OixTcOw+WLsy8M5tTvZ4QN77O/k3v1OQd216RPW8uuSz8lPAAE13MvaywrxttaBqdtv8WU1agFJzKBz8B7EkqEVtodovPPSNCWi8nmUADZPXmEbpFB5pGTgJe50p7VhZ0OldIjU3hr8BvoGU4hUhv3Cisbr8xELz8q2FPtVOinGtRnIE5u59nt2U6eIrdtTOHmCn6UEoHi3foUW/Lll7m8ZwJRyI/jTH+3pPvNeIOu3sf8V5edJzeK8WBRVVm2FNf8ZeTd89PAr1ye9v9nzKRPJ4PUGdalf+IjXMt3zUi7nZZoZXtJOBVQ6/trkVRw== 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=0kG0dt2rNrwKROy8lnFqMy2SqGg9oke/xnqhfDgEByw=; b=GFDDGVMNzifp4Up5yKyuo9FkhSyBnA7zgkTrzQQcWIRkwTwiJl3kCAwHjUq6htA3j2mMQV75iXhXrJZcz801xsPo1TQKNavGV5GLToj6EJ6h8BYO8cO7GOxY8Qz8nB18rUAGOQMgR0wwVx624ChN6bGXTj0AZ/ee7w5pEgp6EAWW5U4x003Q2dh+oouKlXUQA/xDWj3319wnEZmo80OSNUhYCuntStLMyFpbu5lwu9uTQ4F8H1Ht+fm8KFGJrID70irH6jpD+V03EIA199RexQ9kKH5P1wxLNmlA5Qj4JmxxUv7Zuz6AKNtwuVprnELq6j9oe+pjhxlxzyHIHXnekQ== 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=0kG0dt2rNrwKROy8lnFqMy2SqGg9oke/xnqhfDgEByw=; b=VTWEzY690DEfFpY63OHxQbeTsfxYftTEy2ubr93VZyqJz6vZIiFyeFYO040yIQQlT7nJ24UxC6Dd+2eIcQMJMouH4QTn38ctXRst9Rujwx2kl5fywDvqrLaYzv876zIiZeGLKboDQRUfgt4WymKhZqtkIkta3+1pgNe3D/n49g0= Received: from BN0PR03CA0003.namprd03.prod.outlook.com (2603:10b6:408:e6::8) by SJ0PR12MB5469.namprd12.prod.outlook.com (2603:10b6:a03:37f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:42 +0000 Received: from BN8NAM11FT079.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e6:cafe::60) by BN0PR03CA0003.outlook.office365.com (2603:10b6:408:e6::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT079.mail.protection.outlook.com (10.13.177.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.17 via Frontend Transport; Thu, 5 Jan 2023 17:02:41 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 5 Jan 2023 11:02:36 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 30/45] drm/amd: Use `amdgpu_ucode_*` helpers for GFX7 Date: Thu, 5 Jan 2023 11:01:16 -0600 Message-ID: <20230105170138.717-31-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT079:EE_|SJ0PR12MB5469:EE_ X-MS-Office365-Filtering-Correlation-Id: b0aaa90e-cfd6-48f6-8c25-08daef3ea865 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M7dFoihlGTuLxG0xKzerT7Jz682rEJRnjSGo7zVtE/xAnEtPTUf5xNaG8xHOTFpSHo53b4numaUjRDRXrH1s03hta4Jkk+BZMBQTOEuWP9OEN075DA/LI71Iyw8BE5NS2KgLdc/K/hT8o+03XHGHb8U39VX54yxzPGwFi1Nxa/W1LqlVJ0N3BZsHRuIlb90Efxm0iZ6se58gZwor/l6ERGrVtFTqQJJWeqxJNBMf1uQP+YMg0cVnzEakOt0ht+qZn7ggrX0fvpFFpe6ELSxQMCgsxUuRweNVd72n5xoNpfpiN6wP8N1Fi76cB+2ORAkxxCXNcMw3xPeAVIaZK4Gn0fOj1W0I5ntv6L7t83zKX0NnOfpN/++feA2Q7Jq/6znr4GZ4gpTErLJX6nVdNYDGnhWsvsssFgCuWXAKUD92G0d5bmoI8+w+4WT9dhf728kg5AAIAEmVji1ptxCs3dK8tZukOcS5lnGd4gqAIzU+9w/s3gcYGDTGCw9v0WChROd2ffTIh8uIahPiwS7CnNIqDXY7K4vSPpkxmUs4qgq0qK7tQT6ZET425IRIb3bULlozwINPy7NQQugXXi46ebkdX19CKo3+8lFfvOQQAqhEQwAVqhsAiBLLRaC7fPfvX7Xsz0+aoCRCppoMITjHCmtoJT+wGVDE3olevoOG+LJ4FM92hVVgfhTk9huxvqxdYOO145JM5qcKnEMjC5MLX4WfFrAwq96H1e7gZF4ThEZZwuvzQkpMvMAiDflP5UUpmMqzPekTYVUGBVWarBMf/RQ/Jg== 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)(396003)(376002)(451199015)(46966006)(36840700001)(40470700004)(1076003)(70206006)(426003)(4326008)(81166007)(47076005)(70586007)(8676002)(2616005)(36756003)(41300700001)(336012)(40460700003)(316002)(54906003)(356005)(110136005)(2906002)(86362001)(36860700001)(82310400005)(5660300002)(82740400003)(83380400001)(40480700001)(8936002)(7696005)(478600001)(16526019)(186003)(26005)(6666004)(44832011)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:41.8115 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b0aaa90e-cfd6-48f6-8c25-08daef3ea865 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: BN8NAM11FT079.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB5469 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 68 +++++++-------------------- 1 file changed, 17 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c index 0f2976507e48..646999ad4f04 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c @@ -887,6 +887,16 @@ static void gfx_v7_0_get_csb_buffer(struct amdgpu_device *adev, volatile u32 *bu static void gfx_v7_0_init_pg(struct amdgpu_device *adev); static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev); +static void gfx_v7_0_free_microcode(struct amdgpu_device *adev) +{ + amdgpu_ucode_release(&adev->gfx.pfp_fw); + amdgpu_ucode_release(&adev->gfx.me_fw); + amdgpu_ucode_release(&adev->gfx.ce_fw); + amdgpu_ucode_release(&adev->gfx.mec_fw); + amdgpu_ucode_release(&adev->gfx.mec2_fw); + amdgpu_ucode_release(&adev->gfx.rlc_fw); +} + /* * Core functions */ @@ -927,88 +937,44 @@ static int gfx_v7_0_init_microcode(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name); - err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.pfp_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); if (err) goto out; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name); - err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.me_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); if (err) goto out; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name); - err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.ce_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name); if (err) goto out; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name); - err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.mec_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name); if (err) goto out; if (adev->asic_type == CHIP_KAVERI) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name); - err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.mec2_fw); + err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name); if (err) goto out; } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); - err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name); if (err) goto out; - err = amdgpu_ucode_validate(adev->gfx.rlc_fw); - out: if (err) { pr_err("gfx7: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; - release_firmware(adev->gfx.mec2_fw); - adev->gfx.mec2_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; + gfx_v7_0_free_microcode(adev); } return err; } -static void gfx_v7_0_free_microcode(struct amdgpu_device *adev) -{ - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; - release_firmware(adev->gfx.mec2_fw); - adev->gfx.mec2_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; -} - /** * gfx_v7_0_tiling_mode_table_init - init the hw tiling table * From patchwork Thu Jan 5 17:01:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090186 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 21D72C54EBC for ; Thu, 5 Jan 2023 17:03:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 543B610E799; Thu, 5 Jan 2023 17:02:48 +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 B350910E791; Thu, 5 Jan 2023 17:02:44 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BaZta0rx7wEzkiolaO2AOliyv7tcCdQU40q9BfWmfJxx8ITB8xeHHngytL6dif7sWshr/xNYW1vLJGNR8Dlg4c1OQTKOpq5GEf+tuO6XrPpJCJ9vUqfUuipy4wPiuK5oZjNUnpX/FHufHWLwTAonBzUZqPbdjGDuwYV7iqf09nmSdP42jeRG80ziOHWuGEL7ixhNkvSkwA+nrmlSoeG9Hw2NyclJBOGij559ybiBRVUpo/00PwT2ysVwMVy6oVU+lHJKujq0fuJiM0fvFILG7cub2SBu4jUSCPVaNhR87QMHyTChK9+VB2ZcnHzsz4HVg3+vJWHmpmcvMWjyi2McNQ== 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=XQuzh87n1rUAgfMp+Ps95+Q7ef0MfJ8yBfibIpRcDnU=; b=Nv8iLesmvg+VgIS0daV7S/8In1re906wT+OCP+gQ7/pKgk+banPBraUMrUwzCCw5x2oZGnNI529VqyogS5ocj6SvT+BmpNAUd3xbecyMmUYPt9PCI8O1PrhxH9hAmHPQ5rfsROEGH54XOghiw0HtH9O9ie1MUDMjczPIphsrOfLGXOD6QAIqk3V4e79p2q0n4np9NewnLn8t5999qYaLHjRuXovyJhBOmTyrsn6yJrqAkLZuAXqPxt+gePaviRXAMeCB5R+1UVeIs5Zm/GVbt6C/1yjj+/oc0IZJb988oJIuciNUAb3JDLiTNQ04W/TyXu6gQ69d6oJPA+LOamySGw== 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=XQuzh87n1rUAgfMp+Ps95+Q7ef0MfJ8yBfibIpRcDnU=; b=r7vzoLMHUCpQWuX+upg5WbIWTpRgOFMBharxC1h4SHP1eaiD0lO3n0as8ICxpqgyZ0gDK21oHiPnHKU/SeurufEazlmM5jY45213y+Pp+mWAM8VdYBDSIFKwXmJbHiU5nqSC6WUx63HNUfb+3zfn/E9PBGLmsCLzRHVED06pHEI= Received: from BN0PR03CA0015.namprd03.prod.outlook.com (2603:10b6:408:e6::20) by MN2PR12MB4301.namprd12.prod.outlook.com (2603:10b6:208:1d4::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.18; Thu, 5 Jan 2023 17:02:42 +0000 Received: from BN8NAM11FT079.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e6:cafe::9b) by BN0PR03CA0015.outlook.office365.com (2603:10b6:408:e6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT079.mail.protection.outlook.com (10.13.177.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:37 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 31/45] drm/amd: Use `amdgpu_ucode_*` helpers for GFX8 Date: Thu, 5 Jan 2023 11:01:17 -0600 Message-ID: <20230105170138.717-32-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT079:EE_|MN2PR12MB4301:EE_ X-MS-Office365-Filtering-Correlation-Id: ae112f0b-42c4-4413-d5f7-08daef3ea8b1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OnTTvO1mimVCTQV1ov7Bi4claBhf/Y08f6LnmnTTDgFf2v5imoX4/Tb4IzEXxDSo5YAx/F42ddtycb3WyGDA6HvzH8Suqixl2UU0YEp4fiC4/1yIicuy1nk2H+Yg8zFzj2DmOaldXtEYd2qwcOMKGrP2qUdslkL+/Og87IYPxAu8jAxM5z6LkPmQKfzlR5ucgLypW6jVkxNYHBMruOB7EeL/r1n++Pbtvjke8iRZG7nsXMHPhBhjeW9Ne6y9JbpaB2Al2sJ5RbFADMxzfVkupzCi1M6068tKY3Z9OQ2EghW2IqxcMJ/W0hy2P0ymdHwnrTsuBkD6BoitUE1umLZDe1/AdmporAzlcdbNdj6sal5gUUx5sfRJg2V1IXAdNnbG5OQxTCBeQFshEg4MW2jijLUIIbUTanRqfV5YRCweURWoHPYFbe27fkWCb/mIXmDpAN4LMUQ/ElDcryPKY9izoBVSM1yJGNCFIANJ7UyFaH9GMPTNVeXDng00leSVbyZFjjlFWH5gkQSqBzGUoQHm8+c4NQSHBs0sbcS6CzGh1psk4CE+9PoIIs6JVbmPBoDNTCsnPFD4hcz4mjz6ubWUJo5bir9MWx0N/Q5iO5m9odR+1VaQnk7CYdCLKnLq/Oa3FGFa6oUxiqTvrY5rDlGY0h7Kz0G7OE8xT0UJ8P59aEm3TDsIduJxLW9zDhZab6/zhzI3X44OoOQxmkYHFg5hXJ1E4TqKVKo9vxbfN4dsy0r4V8o99n74Zu6Of7v/O4k/PvincYoflRjlhGnr/ItxUg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(396003)(376002)(39860400002)(136003)(451199015)(46966006)(40470700004)(36840700001)(36860700001)(86362001)(83380400001)(40460700003)(47076005)(426003)(8936002)(41300700001)(2906002)(356005)(82740400003)(44832011)(16526019)(478600001)(4326008)(7696005)(336012)(8676002)(1076003)(26005)(40480700001)(316002)(82310400005)(6666004)(2616005)(186003)(110136005)(70206006)(81166007)(5660300002)(54906003)(70586007)(36756003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:42.3115 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ae112f0b-42c4-4413-d5f7-08daef3ea8b1 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: BN8NAM11FT079.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4301 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 94 ++++++++++----------------- 1 file changed, 33 insertions(+), 61 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index d47135606e3e..04577e5234ae 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c @@ -924,20 +924,14 @@ static int gfx_v8_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) static void gfx_v8_0_free_microcode(struct amdgpu_device *adev) { - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; + amdgpu_ucode_release(&adev->gfx.pfp_fw); + amdgpu_ucode_release(&adev->gfx.me_fw); + amdgpu_ucode_release(&adev->gfx.ce_fw); + amdgpu_ucode_release(&adev->gfx.rlc_fw); + amdgpu_ucode_release(&adev->gfx.mec_fw); if ((adev->asic_type != CHIP_STONEY) && (adev->asic_type != CHIP_TOPAZ)) - release_firmware(adev->gfx.mec2_fw); - adev->gfx.mec2_fw = NULL; + amdgpu_ucode_release(&adev->gfx.mec2_fw); kfree(adev->gfx.rlc.register_list_format); } @@ -989,18 +983,15 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp_2.bin", chip_name); - err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev); - if (err == -ENOENT) { + err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); + if (err == -ENODEV) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name); - err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); } } else { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name); - err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name); } - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.pfp_fw); if (err) goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.pfp_fw->data; @@ -1009,18 +1000,15 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me_2.bin", chip_name); - err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); - if (err == -ENOENT) { + err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); + if (err == -ENODEV) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name); - err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); } } else { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name); - err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name); } - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.me_fw); if (err) goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.me_fw->data; @@ -1030,18 +1018,15 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce_2.bin", chip_name); - err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); - if (err == -ENOENT) { + err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name); + if (err == -ENODEV) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name); - err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name); } } else { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name); - err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name); } - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.ce_fw); if (err) goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.ce_fw->data; @@ -1060,10 +1045,9 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) adev->virt.chained_ib_support = false; snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); - err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name); if (err) goto out; - err = amdgpu_ucode_validate(adev->gfx.rlc_fw); rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data; adev->gfx.rlc_fw_version = le32_to_cpu(rlc_hdr->header.ucode_version); adev->gfx.rlc_feature_version = le32_to_cpu(rlc_hdr->ucode_feature_version); @@ -1110,18 +1094,15 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec_2.bin", chip_name); - err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); - if (err == -ENOENT) { + err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name); + if (err == -ENODEV) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name); - err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name); } } else { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name); - err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name); } - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gfx.mec_fw); if (err) goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; @@ -1132,19 +1113,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) (adev->asic_type != CHIP_TOPAZ)) { if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2_2.bin", chip_name); - err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); - if (err == -ENOENT) { + err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name); + if (err == -ENODEV) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name); - err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name); } } else { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name); - err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name); } if (!err) { - err = amdgpu_ucode_validate(adev->gfx.mec2_fw); - if (err) - goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *) adev->gfx.mec2_fw->data; adev->gfx.mec2_fw_version = @@ -1219,18 +1197,12 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) dev_err(adev->dev, "gfx8: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(adev->gfx.pfp_fw); - adev->gfx.pfp_fw = NULL; - release_firmware(adev->gfx.me_fw); - adev->gfx.me_fw = NULL; - release_firmware(adev->gfx.ce_fw); - adev->gfx.ce_fw = NULL; - release_firmware(adev->gfx.rlc_fw); - adev->gfx.rlc_fw = NULL; - release_firmware(adev->gfx.mec_fw); - adev->gfx.mec_fw = NULL; - release_firmware(adev->gfx.mec2_fw); - adev->gfx.mec2_fw = NULL; + amdgpu_ucode_release(&adev->gfx.pfp_fw); + amdgpu_ucode_release(&adev->gfx.me_fw); + amdgpu_ucode_release(&adev->gfx.ce_fw); + amdgpu_ucode_release(&adev->gfx.rlc_fw); + amdgpu_ucode_release(&adev->gfx.mec_fw); + amdgpu_ucode_release(&adev->gfx.mec2_fw); } return err; } From patchwork Thu Jan 5 17:01:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090203 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 A4E00C54EBC for ; Thu, 5 Jan 2023 17:03:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7F3D310E7BF; Thu, 5 Jan 2023 17:03:15 +0000 (UTC) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2083.outbound.protection.outlook.com [40.107.102.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 64C0A10E794; Thu, 5 Jan 2023 17:02:45 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S86voKqC3bt+o7jstD1obf0k2CZ+EKVjpXWb3yLa9itXgFA582pCzS9Wm2m2igTCGbZnsOlIqlhiwzoQIbS/y4WcN8InvIox+vcxCjGKDs7TF3wTkXMU0qA/GzxhqPvEsBqmhrkhuwDbx5N8suqXt2gBQjQre4fkBLyZT7vnW3Xe0RzJqqffSGNfQLQ5kt/MnW4YDkveQlco3AUuc9W+muTt5Aze4XNhqB+nlui7s3j9VrKam/vjkfLyhEUkH6pwvuAedvotWETI6wBDJvzysCnW38YWgdY42f0jNVBMvYhxpeJvPW+8uMTiAroItdyryGhcjFZ0E8nVaaO/nPyvrA== 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=VKBnu/wN8+8k/FWCetmYXkRd4E5LYNBHFYmXSUzroiw=; b=T4Q7ZxuYqiAyAxR/v9vqVMzNg8EnQBDU1Ed/+rwjXLLYrQBKY1ld/o88b895zUi/b2dBXwaOaDba28v4k3J1R+1KWFuDPXWezht9QYGLpIoKPUJ73rtlYMAo6WZ8KfIvEjUFhuO5ubZJ30ixIa1JKLVDB0FLfMLJTLJ9xv5Ss5R39KmNFrcB5wJX4BaFN/udjqI0/bQU9TZWhP9wOgoB2nWlOqjj6FbfbTxFN41/kE+a68dtLwpYUCYzkwcNcKGfe4LQWzAPzTlRqz1szGaaw6g3pvG3gSPVSlnyUHoXDAFvOmni1+tY3J6HchdPhWlqVBDL7X+u6G8oMlAj4ISsNA== 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=VKBnu/wN8+8k/FWCetmYXkRd4E5LYNBHFYmXSUzroiw=; b=2xqu9Hf7JEDLG3nGapeGp3uM4gJZKBGB8IOI547Nj2C2/ZbGxSvg3jxiAfH6MyAj4NdB7Id8flwxWSQ5HcxoHglu/O3Pqb1FmBQ+Dp/oEAhcVYDTzGbB6S+FLhtygGJhwbTw3FGfoBL+pMMuUrGognbNgeno5O65j2vys3nu1hc= Received: from BN9PR03CA0971.namprd03.prod.outlook.com (2603:10b6:408:109::16) by SA1PR12MB7341.namprd12.prod.outlook.com (2603:10b6:806:2ba::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:43 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::10) by BN9PR03CA0971.outlook.office365.com (2603:10b6:408:109::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02:43 +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 BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:38 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 32/45] drm/amd: Use `amdgpu_ucode_*` helpers for GMC6 Date: Thu, 5 Jan 2023 11:01:18 -0600 Message-ID: <20230105170138.717-33-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT032:EE_|SA1PR12MB7341:EE_ X-MS-Office365-Filtering-Correlation-Id: ac36115d-9701-41fb-1f1c-08daef3ea962 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9EdeVzewXw1BOuE2LlXSXLoGYKcw8gk+ZtGGJavQi9V2ltSzrXlLLWszPq8GE5QUKFQzEDGzJkwdQePhRZE9Yc8s87LIhsW3Px1Z9Wifm8M10Dq/VDeVZB29UG5+IB3FpXiRel0/MYwMQlTy3rSoK5S3bgZ1r6doypiCowYgPdbufTUvJzWjKCzglnDq+vYP0ThmVhMoy0hfyPWk7ZYCR3/ii4jTP9mYk3cnk7IBwcG9R3/JNVcN3PWwYRoRahBW3WIEo6XrEom/dKA97IUoYIuAY2q5NGU3fpd885tnq6bTtOvbwYsrxuwwRkc7oNNnjAL1kPDqVGd+zWdCNfoYMt+XNDcPab4XkeLSA4U3z70iyW+m3+fa+HrEG7gfCEYjuWFIszEBovHANYb9IZxmF+WEbNU+zXsBxy4BCuBu360cv/A0aoHNOcXIaGtu9QCcH45ZjUhVi0okfkVEkmBIpT8BVKQbhdIkCeRbwBlfYOBa20UkaWEimioUlFGxWp/JfPrsntTgHhxjVEdEJ3w2DZlFbfH3yUtv1Waw+SVYYnt/+c1vAdnBIGAOww7MQZMZ1u1h/N9Trj7Fve68YoPbuE/zarMlYq6CwWZtSf1/yuGVItqjtp/TAu329U9inN8sdLbIRrouPRmGyhzEc5hd48avdtx0w1BOTG0xFNRSZU3XFo7EVsf/Re0kYlEeb/APH336nizPch4kijAiq+lZwpD8mgcqWQsPNpRmEzknKrIRewi6PsEjoZUcfnQqJZUEmas+XzC+gAz6vg//XdP7fg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(346002)(39860400002)(396003)(451199015)(40470700004)(36840700001)(46966006)(5660300002)(4326008)(316002)(41300700001)(70586007)(8676002)(8936002)(54906003)(110136005)(44832011)(2906002)(6666004)(7696005)(186003)(26005)(478600001)(70206006)(16526019)(40480700001)(86362001)(83380400001)(2616005)(1076003)(336012)(36860700001)(426003)(47076005)(82740400003)(81166007)(36756003)(356005)(82310400005)(40460700003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:43.4668 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac36115d-9701-41fb-1f1c-08daef3ea962 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: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7341 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c index ec291d28edff..d154ab48f507 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c @@ -131,19 +131,12 @@ static int gmc_v6_0_init_microcode(struct amdgpu_device *adev) snprintf(fw_name, sizeof(fw_name), "amdgpu/si58_mc.bin"); else snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mc.bin", chip_name); - err = request_firmware(&adev->gmc.fw, fw_name, adev->dev); - if (err) - goto out; - - err = amdgpu_ucode_validate(adev->gmc.fw); - -out: + err = amdgpu_ucode_request(adev, &adev->gmc.fw, fw_name); if (err) { dev_err(adev->dev, "si_mc: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(adev->gmc.fw); - adev->gmc.fw = NULL; + amdgpu_ucode_release(&adev->gmc.fw); } return err; } @@ -894,8 +887,7 @@ static int gmc_v6_0_sw_fini(void *handle) amdgpu_vm_manager_fini(adev); amdgpu_gart_table_vram_free(adev); amdgpu_bo_fini(adev); - release_firmware(adev->gmc.fw); - adev->gmc.fw = NULL; + amdgpu_ucode_release(&adev->gmc.fw); return 0; } From patchwork Thu Jan 5 17:01:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090193 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 BB35EC3DA7D for ; Thu, 5 Jan 2023 17:03:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2590910E7A2; Thu, 5 Jan 2023 17:02:53 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2060.outbound.protection.outlook.com [40.107.220.60]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6E37B10E791; Thu, 5 Jan 2023 17:02:45 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CUI0ufhPisK+6shLGC0ZDVb4GWbgkE8NEkvs0sAuDU4sUfrenfD1tiuitxgiwMrA9tlAv4nAnYaIH6nnC+SqQgPRIe3HBsrTbXtuWtFXysj5Umzv/duBs61SMxTNPzuKA3jDwoakBqIpEeg5afpVedHul1qAKhxXcVKv05NNanUe56oEljvSC7PqRat2yixqL7FstpXlU3q/HPSTOc9RkPTXoNHvdl6i0ZVdz5dn017zVaqAo8jg1wiqrUmN3OQPvdzT0BIyBQvRV18EOUxsWdHclXwyYLM1kkC5exgPIoTe8BASXLOM1dOVyht2xLiNQU/fICEWgxOMHGYwXn6z5Q== 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=V9VaEK8sMG4bgjOcSWslHozyFDc3XSXRUfQvCPvKlik=; b=nLy+wOFzFAk0zKQV1xr4qa3P7IiZ4my1OagPEcmbIZhCv+4jbM8nDtantJAQB3R+mIni1anYnSs5h+p11w658XosMAwxD8e2Rd9PJg71IEv8FfO2vlSH1HwAvVTn8zXTp6OkgrFMO6g8IBGaSer00kNaRWHBShIwRtL9Y+AKFFUAmaTws86ViVbh4luhiuguTLu+hZWQ59QywwRO4VVgn+TrHnLX6fgB4shCRikoiho98KABZQjg+rEXwZkln6v6WREbmJVBmzN/SShc9VycCkofxuWtfHR/5MAj37W/dmEuoU01a1z109i41baAMpvUsByOobovV61OV0hf3HhfHg== 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=V9VaEK8sMG4bgjOcSWslHozyFDc3XSXRUfQvCPvKlik=; b=ch/58n3IYE6Uq7erVQxlrxHvEDGDXUjrdgBJB4IMOZ5GrJ2pp7sQNpKWPAmViJjMcqG3wYlVyoBnxUFoYkZfrPbL1eDhBen/z83WJjCKJSyCkEOyPT3OjAVYp19tCIR6ASL8re9GhCLJgzDUEUGgK2sC3onRfJSuCJuQbS1BYW4= Received: from BN9PR03CA0386.namprd03.prod.outlook.com (2603:10b6:408:f7::31) by CY8PR12MB8364.namprd12.prod.outlook.com (2603:10b6:930:7f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:44 +0000 Received: from BN8NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f7:cafe::ef) by BN9PR03CA0386.outlook.office365.com (2603:10b6:408:f7::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:43 +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 BN8NAM11FT023.mail.protection.outlook.com (10.13.177.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:40 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 33/45] drm/amd: Use `amdgpu_ucode_*` helpers for GMC7 Date: Thu, 5 Jan 2023 11:01:19 -0600 Message-ID: <20230105170138.717-34-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT023:EE_|CY8PR12MB8364:EE_ X-MS-Office365-Filtering-Correlation-Id: c2de5af1-73f0-482b-4d5c-08daef3ea978 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QdMCwh94AiW33Jg1rhenZT53pxnI5ytOgq6KDybdX5if5k+UuiQbdtYgLUSEyU20f31bAVhU4qR0EWLWxbHKD02+wLohs2LEEQIfXQn/U4R5pkfqkahEi31B0b+QW5l0dQMsfVxHL3J2M2I751J5TlChGgf4aR34u0igrfk5D0IMqYKBlrRKjVWynZPKiRR+mn8PMNgwffAmCOAX7Wp+mnY3sN4fBuW5VyaOV/buyceiDmhWO7TTsf9N2OM7JeqSW/JVTkhe15icyKWrkq7XwtRYA1W7cBG07v0GKeIshhX7HO1NYbzJ7ZOtXhyKid2E7GEJ4tvPnU+3x7eljk+Dw1pi8egxxhKKfSooto+kR6gVVmA1nB7JOYIrvuEDjIzPllGnUaeQmQWwFJ/t8aqzzgHD9Zw7hyO03WBDrRnixBps4VPeb0Yc+ewuNpkvhMShmHqNxZa7b40cIHvAi6iFwKyd8Hk9f+IDzE0rgM5BLqyPOVj+pAJjc0uBh3bcggN9VV6jCf18UjvaByvGR+qi7lJbPyuMxZQJsPtXrwX1SimVrgnWCgRJrlE8faRFYQPDdpl3xFGmusTec595ZraqFpXmtdA8SIR7KQuHjIisHFDCJnSOBigefVftg0gGK7iAozxr2xPDk8weQp/wxZjLO8aDop1/6BS4DKHUcd7mSuECU2qL8fYlqYWG2XLa9Gw0Akqk7IDKoWsAu/v+RumARULUrRIcluVnF8O1U2KdjwvSXMM423Fle6zV2xzcO/BFdGCD2nulIu/nAEURNN4KnQ== 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)(39860400002)(376002)(451199015)(36840700001)(40470700004)(46966006)(5660300002)(4326008)(316002)(41300700001)(70586007)(8676002)(8936002)(54906003)(110136005)(44832011)(2906002)(6666004)(7696005)(186003)(26005)(478600001)(70206006)(16526019)(40480700001)(86362001)(1076003)(2616005)(36860700001)(426003)(336012)(47076005)(83380400001)(82740400003)(81166007)(36756003)(356005)(82310400005)(40460700003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:43.6122 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c2de5af1-73f0-482b-4d5c-08daef3ea978 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: BN8NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8364 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c index 979da6f510e8..4412e8c65726 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c @@ -156,16 +156,10 @@ static int gmc_v7_0_init_microcode(struct amdgpu_device *adev) snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mc.bin", chip_name); - err = request_firmware(&adev->gmc.fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gmc.fw); - -out: + err = amdgpu_ucode_request(adev, &adev->gmc.fw, fw_name); if (err) { pr_err("cik_mc: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(adev->gmc.fw); - adev->gmc.fw = NULL; + amdgpu_ucode_release(&adev->gmc.fw); } return err; } @@ -1081,8 +1075,7 @@ static int gmc_v7_0_sw_fini(void *handle) kfree(adev->gmc.vm_fault_info); amdgpu_gart_table_vram_free(adev); amdgpu_bo_fini(adev); - release_firmware(adev->gmc.fw); - adev->gmc.fw = NULL; + amdgpu_ucode_release(&adev->gmc.fw); return 0; } From patchwork Thu Jan 5 17:01: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: 13090194 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 90E4AC3DA7D for ; Thu, 5 Jan 2023 17:03:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 560F110E7A9; Thu, 5 Jan 2023 17:02:56 +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 9823110E791; Thu, 5 Jan 2023 17:02:46 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ULODzB0iHjYTbgJLoznJPwbUiWzYAaXNPYqVdnvx/Enk2GhQ9PyUa7G99u9c2ZiGQCH3lWS1vvSKl2wAUx70LzcSaVY1O2TuIFhBkhMvNTOA+cwZWV1JBl/JGlUQYdT0IFi6tjPLmgURPGNbCVNHBS7GZ0h7lovIntLW0400IyZz9Ww/ewfzE1jpj94q5Wk09n6VLFU3FWeiVfw/rMSzgOLRHZtxVziFr/G3KrpLq/9g8ETP+1SSYdLOC9wpQC85REZ8xIqEHYKvv/6vcTb2NqPiXj8pH7OyaNPRR7m2/sxUPDMeuze+gNgwLNnZoP3e7JZGIvJLNnpINroSalFe8Q== 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=KrtFWizcAxL/nTQlLVgjC7hYhUh0auYr2VX6N00p/y8=; b=M3V967wS4JPbeq6557Ooh/yYMBrwW749pLi8U7U7k1uaSTIt0f3LrvbhyrKLeF9QGBfl/ijHEBXSEFMzWJQRD7XYyf90UuEjlamHogyAfp8gbh+D7h9r6+t7R2SPkTfiYu4gqhIf8oa882Uuw3d42fd7r2fbMk3kFndWAZ4OGZ9CNy+lhvw+ibDHu7+MHSqbPjC1VPZQGVyolFpRU0NUGWtAG9tctfpzkNSBp3binxTxRFuqzJWjLoWF3pWQ182lOHFwZeogN20FlXoP3lO2PhcPxPfwn7FgucyKzHuzC8dNTOsJp3C+S+lNDSQjBxx2ZgfjmBkfnhKoaH5KPfxY6g== 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=KrtFWizcAxL/nTQlLVgjC7hYhUh0auYr2VX6N00p/y8=; b=PDhKxjTXNKKE3ib9GNlQEUIhc8FUa4SYQvIFxuftqGaIAjAmzveaqxKTYrwt1tcpcUqJe4EMk6IEbmjqNBmiCiUFeWa1Qo3JskBMwYj5ygOf3pLHNxFlJ4HRdsmJ8H1q7r+YrNAZuXS5rH8ZxkFNANM+9xgTAsSnET204DXHB1U= Received: from BN9PR03CA0962.namprd03.prod.outlook.com (2603:10b6:408:109::7) by SJ2PR12MB7989.namprd12.prod.outlook.com (2603:10b6:a03:4c3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:44 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::3c) by BN9PR03CA0962.outlook.office365.com (2603:10b6:408:109::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:43 +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 BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:41 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 34/45] drm/amd: Use `amdgpu_ucode_*` helpers for GMC8 Date: Thu, 5 Jan 2023 11:01:20 -0600 Message-ID: <20230105170138.717-35-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT032:EE_|SJ2PR12MB7989:EE_ X-MS-Office365-Filtering-Correlation-Id: e710ba28-df71-4481-1b03-08daef3ea9a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xRsBCZoj5e28DtPIEuD9MQGvnD94+frZVQ2b/GRCxGBl52lONvX9QhU0I35LyvXT9fbrPlND3kKxQjt+LaV/XpcMkHxmNoWB8kEfV/svD3CdpMO9M5PXYq2vaKCTnav7uw71uspKOphK7OGZRAX1quaf3s5/fufcFDQ+8JRmCTUnI5J+tFWRojE8C5xAi3khjnCWIqjuw1g7cWwofG5OK2/TLS7a9cPw8xfYbkEmUwYYi+Mr8X0DHp9t6nhId3DBE7vB4fSPJx1tBuQ4XN8XxMXDpYnMmtkx6fSY/YZCpQefwDso8pF9xazwaFku9STWDhPyyiC3Vz/ttUkMlZaxotdGZDN5XUWraJTWtzzsX6qCOltGpzAhalPn7blbhqikbhu1qY/adc5PybLWEHiVxFEF0FrRo1q4daYhsL21q2aOrJV2870lzJ5dT45RsMQF84oHLk3y6ALopyMpuguZjrMydEG9B6lh7rNYT1mZ8umJbsfAEjO0kfZh87CpqQ/0MooClyTHFQcBeNiBRwvWW/hI5uhe9utjB3UCCDVhDGFvn420rqWoqfKiUZAhdnpGNSSKB11g9ITZwT1stOfQh1n+WryDuCF3S6g+MlpFhIHCyJ+PEEhHxiLF3BMgmuwh6HDBhTKzbidV2JgrLAAp3t+XTQkaMDMsIHSg28qATBSLsd9R84K7kvRD7JlvKPgd6h9QH/4MD1QLR1B5UexFpsXj6qofPhFcOTwfm6w2uLBQ8SuZ84x1ewZUVFPUY9ldSVeREQj7+wFic8cLGAb/Kw== 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)(376002)(346002)(136003)(39860400002)(451199015)(36840700001)(46966006)(40470700004)(2906002)(5660300002)(44832011)(8936002)(41300700001)(478600001)(316002)(4326008)(8676002)(70206006)(110136005)(70586007)(54906003)(26005)(16526019)(6666004)(40480700001)(336012)(82310400005)(426003)(83380400001)(47076005)(1076003)(7696005)(2616005)(82740400003)(81166007)(356005)(186003)(86362001)(40460700003)(36860700001)(36756003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:43.8730 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e710ba28-df71-4481-1b03-08daef3ea9a0 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: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB7989 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c index 382dde1ce74c..561daac2e6f7 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c @@ -264,16 +264,10 @@ static int gmc_v8_0_init_microcode(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mc.bin", chip_name); - err = request_firmware(&adev->gmc.fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->gmc.fw); - -out: + err = amdgpu_ucode_request(adev, &adev->gmc.fw, fw_name); if (err) { pr_err("mc: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(adev->gmc.fw); - adev->gmc.fw = NULL; + amdgpu_ucode_release(&adev->gmc.fw); } return err; } @@ -1203,8 +1197,7 @@ static int gmc_v8_0_sw_fini(void *handle) kfree(adev->gmc.vm_fault_info); amdgpu_gart_table_vram_free(adev); amdgpu_bo_fini(adev); - release_firmware(adev->gmc.fw); - adev->gmc.fw = NULL; + amdgpu_ucode_release(&adev->gmc.fw); return 0; } From patchwork Thu Jan 5 17:01:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090200 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 C39D3C3DA7A for ; Thu, 5 Jan 2023 17:03:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AA4C810E7BB; Thu, 5 Jan 2023 17:03:00 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2047.outbound.protection.outlook.com [40.107.220.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0762B10E797; Thu, 5 Jan 2023 17:02:46 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RGNw3PblgmtNHxoXYwmVKI1t9Zp265Q+wGcVL41CgBdT1E72pEFOWO5MEXiMmWqAAlUFOcqQcPmPfFLWrk3dzkqM+4PNx7fZ+7WaQpGSeCZM0RNshD9hkopzDNjmStneTdPb68bBSimaTZrT/S3JElGXRwHc/CVhHSLSSIhtC083x/BL7k1W31kn57dgaY7pKUUKHCk0Nf94mPMQS3X6Sq3kjV2A8SkfDX+sQ5SNKWTIrGgVF0Ee360zGlHAov5Ftb7Nv3/Ri5Hd+zLge4+pk9ierDcySV6QPndc+CySG3DqeLTvBcp/L0ihdTVZxJQ5PCHBFXGy//tFzKRElEzivw== 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=v/sbh1dcwbcGZt7V+PxLn2SG8QtiJbvLnK/Rst4IEtA=; b=dolmFc/JzKzVe7hFVaA6sdEMa8ua2EOa0lJBAuuGDXcUSdwcD9AdblpAyDZ4RzAqHjlhjPjvSGqlIyDVy/HA16diYWz925lIu9czqMUOfbzJPVXRm2vr0HR3gXlwVLCSE52zqB7f8JBBZB7Q0l9psoIj4+GZuv/G4OOhg1ZnTx6Wf3D9XcC9XEYNHk4v+XHTmuW+1EjEHPDFmGpxWPQOZ2cn9SexT6wu+XaZOxio+XTZLf4c5HbBHDApS6HrJSWPANrlRZon6sJA+zu3g94/fajZC0ZEzHij3MFfehwoJc5HdGfrA7aS5cuYf4635GmlXCQXJo88kOJqTOOFdv4Oug== 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=v/sbh1dcwbcGZt7V+PxLn2SG8QtiJbvLnK/Rst4IEtA=; b=GZ1HUvGju9cGh54otSsdq2OhVO4A9qaknqSyRMhveyiNKH3wCWtLC2HD0FKZPOypc0ZdOQZFB1w+4JjmULWOLCdlZJGwcgmdUTzusT/pKO021Eg13I/bycLhuOUE9qFehV/jiTdnEFT/p1BxZxQr1CQCrriJnI43VkQ/T2T9ulA= Received: from BN0PR03CA0022.namprd03.prod.outlook.com (2603:10b6:408:e6::27) by BL3PR12MB6377.namprd12.prod.outlook.com (2603:10b6:208:3b0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Thu, 5 Jan 2023 17:02:44 +0000 Received: from BN8NAM11FT079.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e6:cafe::11) by BN0PR03CA0022.outlook.office365.com (2603:10b6:408:e6::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT079.mail.protection.outlook.com (10.13.177.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.17 via Frontend Transport; Thu, 5 Jan 2023 17:02:44 +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; Thu, 5 Jan 2023 11:02:42 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 35/45] drm/amd: Use `amdgpu_ucode_*` helpers for SDMA2.4 Date: Thu, 5 Jan 2023 11:01:21 -0600 Message-ID: <20230105170138.717-36-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT079:EE_|BL3PR12MB6377:EE_ X-MS-Office365-Filtering-Correlation-Id: 49480174-b69f-47ad-9cfe-08daef3ea9c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: isMCTh9YWrAoUrOs39pcc0tw/+XicTpvB/qmU4jQSvOBr4lge0U6Wdae1oUvU8vhkawjZrggr8LocMyZqFEpnY0plb5YyDnPPzaXW3VyOJt4JsFdb1OT6MTdU07y5jWTkW4K0CLeoeK8zQ7ncnPDN3GsZ8aGNvRLc4bsnD4y2XtLTeeq+Ytr/KCt7bHeto3rtJUQRFRB4Q1UQMqUDX9Bm72kEPDfkQOxu6Ks49ZBpxIpqndGvNOkx8en+NXNCPfTd3OHxKhI5wnYr7OTrUW8myBO94InMNSUQbdYR+P+qsTKtKa7ACbj/c/IsrgyRqczNgu5f5cDTskbI7tYv/SkHHr0h3HFvff8pBP850uwNzjNv7aPWXPpZAaQeYVwVEktkrnAkdp8Y6euKRQbV648w3epgVbCxY2NteRJ9nYsmNI7lapcvfxlVcsueOZLgeG2yNYyTkTdZh7pJrHY1rlkramnWIUoCiwikDrhnM4iodzyTyMNO+MUFhN5ay/vbIX+mEOvzjClaP7cohrz/adp4f5+3o8C2SHasHtYeeibAQchJ4HEnHMrNoTAwjTaF9xDViRBLMfd8+jqr7UiXhYUZ5kbVejw0mb6iWM2Mhus8NsOO4R4XxwJsdJv4RQOR/Vy1KVgyflqnQN+RstdqGRAnxOurHehQB0K0WzkPkwasFxX70PNnWPUiotXZOx9dshokYGACcqFuhOngtfCWM9yEj6rzop+jNwF8+zpSBUmTM859p49Sc667B4nNPoYfh8C 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)(316002)(36756003)(356005)(40480700001)(186003)(6666004)(2616005)(26005)(40460700003)(86362001)(54906003)(44832011)(16526019)(5660300002)(70206006)(81166007)(8936002)(4326008)(70586007)(36860700001)(478600001)(2906002)(41300700001)(8676002)(83380400001)(7696005)(82740400003)(110136005)(426003)(1076003)(82310400005)(336012)(47076005)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:44.0926 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 49480174-b69f-47ad-9cfe-08daef3ea9c1 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: BN8NAM11FT079.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6377 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c index c52d246a1d96..fd2a7b66ac56 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c @@ -113,10 +113,9 @@ static void sdma_v2_4_init_golden_registers(struct amdgpu_device *adev) static void sdma_v2_4_free_microcode(struct amdgpu_device *adev) { int i; - for (i = 0; i < adev->sdma.num_instances; i++) { - release_firmware(adev->sdma.instance[i].fw); - adev->sdma.instance[i].fw = NULL; - } + + for (i = 0; i < adev->sdma.num_instances; i++) + amdgpu_ucode_release(&adev->sdma.instance[i].fw); } /** @@ -151,10 +150,7 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev) snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", chip_name); else snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma1.bin", chip_name); - err = request_firmware(&adev->sdma.instance[i].fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->sdma.instance[i].fw); + err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw, fw_name); if (err) goto out; hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma.instance[i].fw->data; @@ -176,10 +172,8 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev) out: if (err) { pr_err("sdma_v2_4: Failed to load firmware \"%s\"\n", fw_name); - for (i = 0; i < adev->sdma.num_instances; i++) { - release_firmware(adev->sdma.instance[i].fw); - adev->sdma.instance[i].fw = NULL; - } + for (i = 0; i < adev->sdma.num_instances; i++) + amdgpu_ucode_release(&adev->sdma.instance[i].fw); } return err; } From patchwork Thu Jan 5 17:01:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090195 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 1E66DC54EBC for ; Thu, 5 Jan 2023 17:03:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8CA0010E7B3; Thu, 5 Jan 2023 17:02:57 +0000 (UTC) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2051.outbound.protection.outlook.com [40.107.100.51]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4A3CD10E798; Thu, 5 Jan 2023 17:02:48 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SCavQNizS/YgoLujhX8WmiQguuT7rnVVGBwe8GU3j9y0g8DV7saz2KcNJEuteM9cZ2LfWzg+x05EYXlPEBB37lxhCURV+IxCVygXEJzZRDQpT3wMADfhtiadsFp7vzAeRVJPamLVC2NMEcUKtfM3/T0iMV30pihSvOCWRR+5saPumikDMqIh/p6KiRUzjbrOui051PMdlgqH/gkZDda96tLhozYUwWv7MBBTS59uqXf6eAT1WybVDYU711C67x0+ZmLoru7vcyQxtOE8+jB0kVhZSOv9H67A++QR89lR1y9KsBISfH++VX4EQWgEYr8zS28TgEE2Ml8V5he7rF7E0Q== 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=rUH+VtLisRf7jpLLUErjtXm+rcxM23AFWgv2ywEexYo=; b=l1hbakXDUw79AnrM7U+nwFRxakTDp+waFCZ484O6luiVRxgjaP7WHtAuDPwJ60IbUNfhK65L19kGLu2t8iOoAylghdOP/UQxQ2Ux0reYvKiUK2bOgtTTaOBXJies1Q69xgshgQI9JsKYC0U31Ikim47AuIOZKKHhGZoPXuLUPoWoe3dPp1JDqZS7yrJyR3MnUmJ9hZdqnOeTJsHbKfcYBITsGklau9A4F4YtNuZYiPvxyoiZ/ZH8HFTy0Ejo4LcIGFVuzXp95EzI/R5Jb69k+0gT5hwi/buy2RFeAK8pXEe7o/Fg1sNJlIQgJG5VyIgMAzeDY45he2/8pGoKT2jlPg== 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=rUH+VtLisRf7jpLLUErjtXm+rcxM23AFWgv2ywEexYo=; b=0QCDZ0v4dPJnKGGLecD6LDhPQidoGCE5BThKI+z5RBy3qEXDFhER+DNdfYt4GJm8G8Aip/TBBWBKvaIrOu04997Szd1qKUI/ZO/H8DHDkWTpxlJhSF51LxB4wmwEkzlubB7xGozRPgczqvcEkKREbOwzQ2HUbMCmZbSmyyLBhr8= Received: from BN9PR03CA0768.namprd03.prod.outlook.com (2603:10b6:408:13a::23) by BL1PR12MB5189.namprd12.prod.outlook.com (2603:10b6:208:308::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:45 +0000 Received: from BN8NAM11FT095.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13a:cafe::ae) by BN9PR03CA0768.outlook.office365.com (2603:10b6:408:13a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT095.mail.protection.outlook.com (10.13.176.206) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:43 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 36/45] drm/amd: Use `amdgpu_ucode_*` helpers for SDMA3.0 Date: Thu, 5 Jan 2023 11:01:22 -0600 Message-ID: <20230105170138.717-37-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT095:EE_|BL1PR12MB5189:EE_ X-MS-Office365-Filtering-Correlation-Id: cf999545-3a0f-4a75-3ef2-08daef3eaa4d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qHz9WKSGZFAmKQU29+3AZ7maB9pPhnyRo3p4pVerewMDJf3KuJh2J/lv6tEiiIl6+i2e+nrUY6thaACNCYaPjTLXn/iHBAG/mw1jGltvJJhN2T0ARimgDQUuAgWu3DlJ8533wA94SvrcU7lgPuwQ6Xf8wByJOgoOY8izifvpHd2E5sxdoTuzkb4h+CBzSHkkm5qHRyRVFt9TvGepUarkoqk+WgTK522854CBNfGIhV23V+40qdwLH4F6ignwuTKv/B35hT7w4/qSSxP2v36HKnMwP3j56GxKgcSnDNG9qkWOAIr/tMqC3MNDOJZ98+Kj3st2K1gqcw5/mKk1m85ZVqrda9UquVELoFe37Fl5+KEKuu8vPSoz+eJ45JOErpCvV52phtyxvSoePOKWM3q1MnGTP5+QXaVDhhlfVFSYM/utGJGy0OatfN0c8NTHkfBxkwFgQ3ru3xrwPHG/ZZ3+QWBrH660LOFhNQDDXZ937qJskycg4iIp9T2dTcTSVHy/PU+Xohq596RcGlaz3bWo5sPHt6zxOtkQ1/h23mma/N9tzP/w1A0dP8Z47HYF9kFnbnLNBxuTNKtswV8Laglu0The4bNT59btWJ+zXdn7TwFzXJT0nK2UA01/22mTmCu6SjMbEqHYpXaP8VRGOw0zvdbpIoKcqCNxD6KCLsSXnJcbSQYrbsvxiWOFYAunqudbapKGrQM/jGbBBDJ2hHGOth1k7xncvm/yYhtTvH7v+1g6+6rhwD69TW0rTsdIcL52 X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(136003)(346002)(39860400002)(451199015)(40470700004)(46966006)(36840700001)(2906002)(5660300002)(8936002)(44832011)(8676002)(41300700001)(4326008)(54906003)(70586007)(70206006)(110136005)(316002)(478600001)(82310400005)(26005)(186003)(16526019)(7696005)(336012)(40480700001)(6666004)(83380400001)(426003)(47076005)(2616005)(81166007)(356005)(82740400003)(1076003)(86362001)(40460700003)(36860700001)(36756003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:45.0077 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf999545-3a0f-4a75-3ef2-08daef3eaa4d 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: BN8NAM11FT095.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5189 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c index 486d9b5c1b9e..e572389089d2 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c @@ -250,10 +250,9 @@ static void sdma_v3_0_init_golden_registers(struct amdgpu_device *adev) static void sdma_v3_0_free_microcode(struct amdgpu_device *adev) { int i; - for (i = 0; i < adev->sdma.num_instances; i++) { - release_firmware(adev->sdma.instance[i].fw); - adev->sdma.instance[i].fw = NULL; - } + + for (i = 0; i < adev->sdma.num_instances; i++) + amdgpu_ucode_release(&adev->sdma.instance[i].fw); } /** @@ -309,10 +308,7 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev) snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", chip_name); else snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma1.bin", chip_name); - err = request_firmware(&adev->sdma.instance[i].fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->sdma.instance[i].fw); + err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw, fw_name); if (err) goto out; hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma.instance[i].fw->data; @@ -332,10 +328,8 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev) out: if (err) { pr_err("sdma_v3_0: Failed to load firmware \"%s\"\n", fw_name); - for (i = 0; i < adev->sdma.num_instances; i++) { - release_firmware(adev->sdma.instance[i].fw); - adev->sdma.instance[i].fw = NULL; - } + for (i = 0; i < adev->sdma.num_instances; i++) + amdgpu_ucode_release(&adev->sdma.instance[i].fw); } return err; } From patchwork Thu Jan 5 17:01:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13090210 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 0FB34C54EBC for ; Thu, 5 Jan 2023 17:04:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0DA4310E790; Thu, 5 Jan 2023 17:03:24 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2083.outbound.protection.outlook.com [40.107.93.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1998F10E79B; Thu, 5 Jan 2023 17:02:49 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Inzei/gIVbwnT4cLKZqEUoRZvHGlxPabC9LdNCPMB39uOZ5TswX+QN2D+Nsi5rEx2TD6Hl1RpHVQahPuzv4SMhVUszbqaTD5ijx2yMm/L92jpLgEZ5D7upVQaAIy9JfQMtGySo7PckKQpcGRui+3RKCP1sPhyGNA4lxDHTLQ8y1QOA7VHctM/VaRp1FfLKfkPFMQ2LYTn56tRPAr9tTAzM2NxveJ6zAMjUXzIDSv8FWFD55t9soBS3HD2Wo5V6BYO3T8GqS8zJ20xz1SDja7OzjTfAUI3AjWNQ8i7lvVTdx7MtK8WMyrnmdowgfgwiUJdiQaFNWqKAUuKChxIKNhug== 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=qAvtQBdMCbVznYho7TwBbM+xg8H1h/wQ/PgQn1RmhQQ=; b=K1PXw2ZPhTQd89UZiuTyD2k4CsMkbpw5gK4RnDTl3LgwaM+lw86+1J0v3Yri9nTJO4weowwgbM6uSh3CZ7jM1ZjyWxQ++uTA+hcwxXAhtDt/1VWot2ffRWk4f5FhBj5tuDAr6+man75ShSkAFPmQfVIsg7JYISNBkJ4L1JlQuvNo3lOJ/59sy06XulFpcs6hZ3zmdtzRf3BJFyh1A+TyQP+N8G+fomLuWcFaJLi4RObpesq3Aq2SSF13TMP7l4rcinS/9yTRTegz3/fB56xVJQaAdF8unp9smKcXXNPByjCtLqTnDP2c9FQIlaqKhLL8GqwVqo9CV9Lpyhth6iRXtw== 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=qAvtQBdMCbVznYho7TwBbM+xg8H1h/wQ/PgQn1RmhQQ=; b=5o+WQTiWuhm1DOj1eN4vtIu8vat4iPCeZ0IKL4q5OF6r5I8JJZQJ+18bs44EBtRLs8SNO4/Dw2/xuIdBW86FCeXKzqGaqz3VPl6LgRqIFTktuqDbBZLaDFBZrvpVUkx7vXTN6r5iYeGy1Bl+LM5zKyU5jrepB9GvG8HVo5l1agc= Received: from BN0PR08CA0010.namprd08.prod.outlook.com (2603:10b6:408:142::11) by DS0PR12MB8562.namprd12.prod.outlook.com (2603:10b6:8:164::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:46 +0000 Received: from BN8NAM11FT040.eop-nam11.prod.protection.outlook.com (2603:10b6:408:142:cafe::65) by BN0PR08CA0010.outlook.office365.com (2603:10b6:408:142::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT040.mail.protection.outlook.com (10.13.177.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:45 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 37/45] drm/amd: Use `amdgpu_ucode_*` helpers for SDMA on CIK Date: Thu, 5 Jan 2023 11:01:23 -0600 Message-ID: <20230105170138.717-38-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT040:EE_|DS0PR12MB8562:EE_ X-MS-Office365-Filtering-Correlation-Id: 11d1ea55-6cf1-46ba-1f5e-08daef3eab0f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Arl4AXsToet2eQilDDTuhRW41Ewerl17bc9y2ePTCuRwtm2Z18NQNc6BUNU/2J1R5N3akm+TXCyajbzmdN01GO+Qb0NbFKKLcF043P2EEXp9dxbBJ2EpPFtB3aGM21aT5A4K2VMcipdv0IsmXI6NtGY5+32mvpdYNBEowuAddiZ7WbQLZazDGXCQE6dS8bslXrrEULjwnK7yZJtJGWu00Af4AanZEogFHAS6Q1NU/xg1xIKGkpS4CBzKeZQafoe+gMCwxGd43xIdVueR7NIcrvRnb6JaOkQWL19kLZ/LXZJYYhYfZ5ZHnQ0YWA1Dm6vUmRLtV1ZQjxQt9/b5PFzc3oHrUkepq2reLyOhtZNXzg5OJJshDKBgltBoIisgXeY5NOMEvt3UtreTXFdI08XmgtGbBESfI3DRIinSUeVtx9qgRibZgruHjWcmqVrLaUp7uuhPhXXKKPovDAPvDZRhnNQ7+qaoCqVz70OT8wnxY45Y74Y4G5l/1GP/jgL6/LAYP8RMltW8WPWN3cfhyudl4ZK4dVIjs/puc8jjTFD2+y9JsABTWkYvyzOysR5/zeZFAZFsQ3GQ1l+UQGj71a06Xy1t1ZHIMiUU3SUDiIu/JbWQ7J41Y90w0abZF3GqCyg1RpG6CqevAWWwtk1wwcGRVaPub9z5XxnqfaQSzCYVlTC21iUYM3Z9qJPGYRl93np8+hI2xKgNW8emCYGQq+uPhit1BCGXZJxFDlI/qLXeU60v6MZQ0evcLs/A/zjw+HR10tC6rOVk0ROjEpIT8vf8TA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(39860400002)(346002)(396003)(136003)(451199015)(36840700001)(40470700004)(46966006)(336012)(1076003)(47076005)(426003)(83380400001)(2616005)(36756003)(81166007)(26005)(186003)(16526019)(40460700003)(356005)(86362001)(40480700001)(82740400003)(36860700001)(82310400005)(2906002)(8936002)(110136005)(70206006)(70586007)(316002)(54906003)(8676002)(4326008)(5660300002)(44832011)(6666004)(41300700001)(7696005)(478600001)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:46.2783 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 11d1ea55-6cf1-46ba-1f5e-08daef3eab0f 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: BN8NAM11FT040.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8562 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c index cbca9866645c..67d16236b216 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c @@ -73,10 +73,9 @@ u32 amdgpu_cik_gpu_check_soft_reset(struct amdgpu_device *adev); static void cik_sdma_free_microcode(struct amdgpu_device *adev) { int i; - for (i = 0; i < adev->sdma.num_instances; i++) { - release_firmware(adev->sdma.instance[i].fw); - adev->sdma.instance[i].fw = NULL; - } + + for (i = 0; i < adev->sdma.num_instances; i++) + amdgpu_ucode_release(&adev->sdma.instance[i].fw); } /* @@ -137,18 +136,15 @@ static int cik_sdma_init_microcode(struct amdgpu_device *adev) snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", chip_name); else snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma1.bin", chip_name); - err = request_firmware(&adev->sdma.instance[i].fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw, fw_name); if (err) goto out; - err = amdgpu_ucode_validate(adev->sdma.instance[i].fw); } out: if (err) { pr_err("cik_sdma: Failed to load firmware \"%s\"\n", fw_name); - for (i = 0; i < adev->sdma.num_instances; i++) { - release_firmware(adev->sdma.instance[i].fw); - adev->sdma.instance[i].fw = NULL; - } + for (i = 0; i < adev->sdma.num_instances; i++) + amdgpu_ucode_release(&adev->sdma.instance[i].fw); } return err; } From patchwork Thu Jan 5 17:01: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: 13090204 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 289DDC54EF0 for ; Thu, 5 Jan 2023 17:03:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD85410E7C9; Thu, 5 Jan 2023 17:03:17 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2068.outbound.protection.outlook.com [40.107.220.68]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6FED610E797; Thu, 5 Jan 2023 17:02:49 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ULfTRsE1IYgUgRxAZlKUVjkMiZcC6lBvRx+wf0aoDfgKd7kW/Ue4W6eN/7b3wQzXvxlmA6bxm0M6ZQCsmrWtC2obkN1kmykC0BdYNkCaIyq4nTNcgAPPA7iQn4xOiujs9uqnkZ+dabPtKwNS0Ogf9+fYpM+IHfdOeV2ktJedDqGF+KzFkvxss/QPyX4xSOE4XKarv6PF68RnsuKQZVceCFcAdn/71lwH/NIt58GH9wdaGycTTUomnaS5RPs62lXfw7HaJeECmjvuPapb9aJG/OtOKoMxbOGNRttG+67sSDv+HC6MMR0Ha3pYEyWsNKfXG4bsy01SWbpu+qGswzXWUg== 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=qawIKoF56FYm9uU4b90E+JQYKd6nHlp5JANCBGOY/88=; b=RUV06aYBayDlqI1HRGZS5+vgC3CKLmzkPmqyHbaoVGVtpszIDFHnh5mZydoub3D1lflLd3oY8SY/WqlVUO3nhKGt2yK4Yh/79P4e0f1pYv8aJAemLjPRm1EaugS1blClb2UnmUGxqkJMMTiuRhVubzw7HwYDTzLmdrry9U6QGQfh4BP+a1+jDirj3oTMxeoEk4maepwKuownnIbTwMwWUdrtoingAtCKqBHNY/jkn93vIufyxy9vGzDVM5c04neJ5zlsEx40bQ6HYVQUq/6N2DaL6b+ok6t+9+208YtV1HxU01Jeg2JIN2d8Z46tAa5gOTN9m7a+gD3o8qcFQg0VQw== 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=qawIKoF56FYm9uU4b90E+JQYKd6nHlp5JANCBGOY/88=; b=ZkDKPfrktiudkSabgR8l3L0Q7z9+ay0DTCj6zdKv3DAsHZdXVN35ZB2NSvH7H1PcCLjWxm87WIPN24PmTDK/Utq3oXxRCOe95M3wqwJDm8CzG1R2E9Wsnd4g5yprVg49qNb34BNN2jjojcM/u8gVHF8wJnpFKe41V+dnZiBYNwM= Received: from BN0PR02CA0018.namprd02.prod.outlook.com (2603:10b6:408:e4::23) by MN0PR12MB6151.namprd12.prod.outlook.com (2603:10b6:208:3c5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:47 +0000 Received: from BN8NAM11FT100.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e4:cafe::69) by BN0PR02CA0018.outlook.office365.com (2603:10b6:408:e4::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT100.mail.protection.outlook.com (10.13.177.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:46 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 38/45] drm/amd: Use `amdgpu_ucode_*` helpers for UVD Date: Thu, 5 Jan 2023 11:01:24 -0600 Message-ID: <20230105170138.717-39-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT100:EE_|MN0PR12MB6151:EE_ X-MS-Office365-Filtering-Correlation-Id: ecab7a4b-efb2-4ae2-0669-08daef3eabc6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gU/kGcCjPKQO5zOYTt3MGaz6UDnoy7bJjdNQMSmpQN5j84S3O5GOKCfHsKzhc0DbOKpNRR6Y/T/PEtFiuaSKhJfaMYLggl/HIwSSQjAPhYnAF45KvpdnkMv3yMmgZh8ooVR+Taej9K/9nYFHPStdVfLPLbuwfi1V07RbQOKbqBwenIKLWALjwzYtKPHR2l6aBYmSaFjwMTaIlXE3Ql5nNwGvmtT9PZUCugQbZeQcLI+ex4/p2bqZ74+qV9lBYYHph1d1ARvf0afXCBfJGYfaF2+4ZlsCEeE/LVwmCtmx4/B1hGkA1EKNtwiGqcO2sbttSrma6bqZ+GDmGTo24aLJVbQBEXnnjkcEj/qTrY7UlL/QBINKeRQzwWKL9diQ5BNiGLmHxXoLpKS0F8YKCLNPnZHtLtXcVYaAv7D77x6m856QnQZ1jEDVRCc3gIAy4VZTSIouIMC4sIFC1zP8MikElnL6V+kyHW+KD9xhPwvym8/YtFaEJlHKZr8evxQFBBUiWqb95jAqZZnW57jAe6n1PBr/TxfbJlFnXRjg189m+vXplLeks19DNkoSYSLQ/rQ+ltO7uI5lE8MiqS3i0eignDzafVxqu1AdBoWEg4aDXHmdlxOtHmZSmsc8yV+ApDJcoh5G0SwVqDFqjahTSJy6Uqfa7piQ9A9keEhpcyrXXb6usBIR9S4FfuM7rNU53mZ/dzNrhmGhlDzYl8CLZVQs8spVUNt5y/Lsv9Q2tbdQglQPOagfVtcBhRuKWOMoeUpy2xUtjVL3mslgZOAl6mkskg== 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)(39860400002)(346002)(451199015)(40470700004)(46966006)(36840700001)(5660300002)(4326008)(316002)(41300700001)(70586007)(8676002)(8936002)(54906003)(110136005)(44832011)(2906002)(6666004)(7696005)(186003)(26005)(478600001)(70206006)(16526019)(40480700001)(86362001)(1076003)(83380400001)(2616005)(36860700001)(336012)(426003)(47076005)(82740400003)(81166007)(36756003)(356005)(82310400005)(40460700003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:47.4614 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ecab7a4b-efb2-4ae2-0669-08daef3eabc6 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: BN8NAM11FT100.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6151 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c index 6eac649499d3..482fcf71d1c1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c @@ -260,19 +260,11 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev) return -EINVAL; } - r = request_firmware(&adev->uvd.fw, fw_name, adev->dev); - if (r) { - dev_err(adev->dev, "amdgpu_uvd: Can't load firmware \"%s\"\n", - fw_name); - return r; - } - - r = amdgpu_ucode_validate(adev->uvd.fw); + r = amdgpu_ucode_request(adev, &adev->uvd.fw, fw_name); if (r) { dev_err(adev->dev, "amdgpu_uvd: Can't validate firmware \"%s\"\n", fw_name); - release_firmware(adev->uvd.fw); - adev->uvd.fw = NULL; + amdgpu_ucode_release(&adev->uvd.fw); return r; } @@ -394,7 +386,7 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev) amdgpu_ring_fini(&adev->uvd.inst[j].ring_enc[i]); } amdgpu_bo_free_kernel(&adev->uvd.ib_bo, NULL, &addr); - release_firmware(adev->uvd.fw); + amdgpu_ucode_release(&adev->uvd.fw); return 0; } From patchwork Thu Jan 5 17:01: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: 13090199 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 565B4C3DA7D for ; Thu, 5 Jan 2023 17:03:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9F81310E7B4; Thu, 5 Jan 2023 17:02:58 +0000 (UTC) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2061.outbound.protection.outlook.com [40.107.100.61]) by gabe.freedesktop.org (Postfix) with ESMTPS id DAE5710E79F; Thu, 5 Jan 2023 17:02:51 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bomQ5wQ3Tz2B2ESjskUyyHHM7VDe2P6YQaTtYrA/fphheozcrfq39x28AyFuuXW4QewHUJOWgwiN+I+Pmbb71hOzG6LKc5FmOmzrO821g6G+msitj7GVZvUx5iGmlRFQaFh3SMyEhVL2QG1HNfHGJmU/Nm42GBEeG4i2hCxVnKPcUOS6RgLVqqhpLkEuJhAML+CZ4RP9MwMUQtnmGaE+s9VYFFnVt2JB+ihbGgT4uNPh8Rhu0820ZeRgHEc9CJUnvZwQw6AybTPpAhGagcgDtp7RXHgu1DQnPqEoArTlbtzu6ojO5Cq2xxVzImQ3YvqtYQ64b4WgGRK9MYv8pD5iIQ== 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=tMi1raoWYJ7gp64dPGMxAPtICHOvQ9ICV8XSZP+zGVA=; b=WAi6LN0/rY1Ircup+jo6ST7hqaf2Pj7uNIwAI4e9jaJIqh5kC4u0DhJuOh0SI+XQLkCHuWnJhAKzfGZP2X8mYrtoLX1Jfp5f82y9f3ey/pgLkkjj6n1ePq5YhfvRPSufUtUlI7ngkrD9/Go6dPxf+iXAs+rW0qY75jHtbPq7k/nlZ9DeOHWB9EwH9o9bf0czuYP5IUnoH+ehC5skJZgsttSORSYIDfM16oXsswHVIkx92bmUDiAjEVTgkh1RoAQGBneq5f2SVmvoEM/+yDgPWpYYP9qOuRnxgkDSShvI+UPpWueh57eldWtbDokdPRIgqEX94UcfjRJKl5z0IJEZEQ== 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=tMi1raoWYJ7gp64dPGMxAPtICHOvQ9ICV8XSZP+zGVA=; b=eJY+Oe1j30PmnOoyH59pzRqgiXl6UATkeJoRIjrPmmsoMu3Co2+MKiFhJXggJTTz3vEkqjCBu71hFYpCbszE3lA8g9plB1mL8MgDz4DJoX1k+OVAVDtR8Cx9KTC7mn2jHzQZKJm3mNXc5uoFqIyRtq5d7UKqYkPPOVRXyW/cKvI= Received: from BN0PR04CA0009.namprd04.prod.outlook.com (2603:10b6:408:ee::14) by BY5PR12MB4052.namprd12.prod.outlook.com (2603:10b6:a03:209::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:49 +0000 Received: from BN8NAM11FT099.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ee:cafe::a0) by BN0PR04CA0009.outlook.office365.com (2603:10b6:408:ee::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT099.mail.protection.outlook.com (10.13.177.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:47 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 39/45] drm/amd: Use `amdgpu_ucode_*` helpers for VCE Date: Thu, 5 Jan 2023 11:01:25 -0600 Message-ID: <20230105170138.717-40-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT099:EE_|BY5PR12MB4052:EE_ X-MS-Office365-Filtering-Correlation-Id: 7831ea59-729a-4e66-71db-08daef3eac8b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8p3ZbJUQu0gAZ36lQCwbzQ7kFw5P5ciU6NFdveBIVmaYchl7/ewX3jbnZ4EyVwxYKClJFMoSQ7F1lv8xQN63VYmWrsVXTXlur3Bj7Yy+bmKMdlzZHIxqp+QoCxPfpFmOnwdSYnn48mI9slL5arhIMEfdi+6ETuwKWGbmgjNMDguOMuTdAxG7Tbtc8EDYCf5flNKNrhZ9dM4UCgVdKy7EqpMN1+0GJuHNIGv0uLBfXghDbLzjaHynnTaaDVfxpBMCZpASvUd26FqBMmvalPen4Gi9Wfhi4hyn1TFDpnkjilMaYCdW39lr3/OZbro0ZUBbsNShZZqQ7PhKuxjjxQcHftp6Ugik3YoLbfUGNBqhj6joFIs4PmOMRRM9xCOdYEsmZWvf986Yo3FYBl0ij8zzxJkzq0UrfVF77wPD2hZIvjA2n5hg4R6lraenDQZiEHKkaTLAeOuaDoyimdHkwKU75sHbuwQ0DhFeih8aaBjOJ27myjhFnR7V5tuHvm2Sgy+GOk1QEAHTrTAs/YMAMW76cLeaSTwHCtiNI8VqBPXHdmc8YxRbRAjikJq0C7cSfi9MxTL8GC86z4VE/ihO6SrhYO/kgkWUokd9D0/UfcNZ3t/fFZg+xj7ZpizH9Xlz1imubAMzj7+p/o7Mqy4rCw+m8Bkv9jXF6XRssGAucwAWVdTz0op4Vat9VBjP0f9NHGaXBrzvEYX9R/I3E2GU5zrZi9abt73W42uVqGBLdZ5YFa9uVnhozxkoqSr/He/26D7/XreF4smMrfcIJCgXaQafJA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(396003)(346002)(376002)(39860400002)(136003)(451199015)(40470700004)(36840700001)(46966006)(2906002)(5660300002)(44832011)(8936002)(41300700001)(478600001)(316002)(4326008)(8676002)(54906003)(70206006)(110136005)(70586007)(6666004)(26005)(16526019)(40480700001)(336012)(82310400005)(83380400001)(426003)(47076005)(1076003)(7696005)(2616005)(82740400003)(81166007)(356005)(186003)(40460700003)(86362001)(36860700001)(36756003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:48.7708 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7831ea59-729a-4e66-71db-08daef3eac8b 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: BN8NAM11FT099.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4052 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c index 02cb3a12dd76..ea78b7513182 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c @@ -158,19 +158,11 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size) return -EINVAL; } - r = request_firmware(&adev->vce.fw, fw_name, adev->dev); - if (r) { - dev_err(adev->dev, "amdgpu_vce: Can't load firmware \"%s\"\n", - fw_name); - return r; - } - - r = amdgpu_ucode_validate(adev->vce.fw); + r = amdgpu_ucode_request(adev, &adev->vce.fw, fw_name); if (r) { dev_err(adev->dev, "amdgpu_vce: Can't validate firmware \"%s\"\n", fw_name); - release_firmware(adev->vce.fw); - adev->vce.fw = NULL; + amdgpu_ucode_release(&adev->vce.fw); return r; } @@ -226,7 +218,7 @@ int amdgpu_vce_sw_fini(struct amdgpu_device *adev) for (i = 0; i < adev->vce.num_rings; i++) amdgpu_ring_fini(&adev->vce.ring[i]); - release_firmware(adev->vce.fw); + amdgpu_ucode_release(&adev->vce.fw); mutex_destroy(&adev->vce.idle_mutex); return 0; From patchwork Thu Jan 5 17:01: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: 13090205 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 03986C5479D for ; Thu, 5 Jan 2023 17:03:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 60DBD10E7E4; Thu, 5 Jan 2023 17:03:20 +0000 (UTC) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2045.outbound.protection.outlook.com [40.107.212.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C2A610E797; Thu, 5 Jan 2023 17:02:52 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LD3qUuTEG/nlmOXR97lrcCGhiwfG/kzQuBvgB+yoEV4EmzfJRESHRpxGNgBB4Ycq6M77ZiF+7eAvIMUwr4g1bGTmPJyX+0hGJvEKSeoXQyQRxAyTCDAUbkUmDybakM6CDyZTNpfZw3FGD27jtxprbIJHZW1OOOYYKGjNrVGoHVsHkw868fwDRWEFO+NSNKs2GoZMKHvyBnw8e0sFauulugISMt2pkuLfPvh27JnS5tZkNRon+8nQ/TQZJqsPjnXdpvOhH7RTA29l90LIH+UFOxTaih9gXkUTtnlJlM5Csei8F2GXMw8gw3ZR/Yf3v3TrNpJgmQfUR2bofea2PMB4Hw== 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=p7zXxZne47y4jAd7J/obdLs/bK0bvRFF5mmEw3LyeeU=; b=I3PF61UCYWNDIx7e/fZMcdBSNdaW+57wDikiliDunGGfC6SkjgmWBtYD8mggztXC0T/HGnYSzisMhCoDV3dSR4nGBEloMm0wPQLeDYGvji9X22qvbNLTCVG7sIx9CrbWj+yr8x1+NEglVNqstM2iWw4bfwg6yfuEBz7hxmqF1XU6ZeoYgIwj/fo4wKHglEgIJl0gxm+V72j3//YRZdI9fZT1TVShHakrL5lFEFGjoT3IEv52VHu5T1GzfK2F4fMg48gY9I/uSf9nD3qMgMeaVy5/b96QsEpgLGcesNWfKy8nVE5xwwxEaBa5OGP9jx75QMWnHL9+wgsWx8v0KqXHWQ== 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=p7zXxZne47y4jAd7J/obdLs/bK0bvRFF5mmEw3LyeeU=; b=Mh5Fwi3rKiiN3Ky28GCDBHfDnlhUbOfW7J1tqLTKvjyiOkzMb7YL3LVfUiMpTF/a7GrtbLqDmQmkJKikCF+nvh+Z3iK5VitzS/hrx+uUZpWwsdM8JmOWmd6A8HazkE4un/q1KBVEF2p4z5EfGFNMCutFRr686VgD4FodGNRHQ98= Received: from BN7PR02CA0004.namprd02.prod.outlook.com (2603:10b6:408:20::17) by MN0PR12MB6222.namprd12.prod.outlook.com (2603:10b6:208:3c2::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:50 +0000 Received: from BN8NAM11FT062.eop-nam11.prod.protection.outlook.com (2603:10b6:408:20:cafe::21) by BN7PR02CA0004.outlook.office365.com (2603:10b6:408:20::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT062.mail.protection.outlook.com (10.13.177.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:48 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 40/45] drm/amd: Use `amdgpu_ucode_*` helpers for CGS Date: Thu, 5 Jan 2023 11:01:26 -0600 Message-ID: <20230105170138.717-41-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT062:EE_|MN0PR12MB6222:EE_ X-MS-Office365-Filtering-Correlation-Id: 913e5e80-4a71-40d9-06a8-08daef3ead42 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +XorngsMEN+NG/uCIYfQjOcDtCg494+1wU9vK2FWwwMjrPROemYou+gJh2jJcolvZqp2iHAaHw/DymhDtE/16W26GWtZV7Be9gkZYZ3pUZv1Jex3t/SrmQsQPbKFJkSg0TW2xvnsvmK7DrifNh52c4FJA/2ng9DbrpR1ENyxq3mLzkhWm2MtBwZevQITwHKdJcvwCjLzyoeb4TULo0O1+gLYzQv/6aBjqyuurT/mblcF8XnfcikoPfkwOH/+GDeIk1r4IKRh68mUF3zFv+wroIfVX0b9FoM5+6SBwfkqkbioo+bwGZeuWARNlbrGhCrDbF7BPyaatCT7VnyP/s7F/B29AkqiNXZ5/BjoY7EBZc1ewzdWFOL5RtJMFpPpEwquUQim4GqVYoLnTZ6pe7D3OXnZK9dPmbKMcKUxeq0T4JaBeSUxjBGFXoUDi/40r9GoYH+KEydUwUrzYY1gJBAX+kAf4lh/V9xZ4dPvGrzEE45/wWY3cL+VA3w+LNuS4Bhh20kfyDU7emTW2IShiLNpuMxiV/BCCPcmYcw6uudBCGQD/qU+GKye3GYWCMeOOkkK/AZErAxSmUWtuk2hcCYD4rv+mSLaT5HWKGjnQk+7nEI4eJLx5ESI32BJT+PsbUybGiLO+MryaN0SPdltT7UpmBHqye1U/C00OeIZxETwkhnFhWEvRAC7ZfAVu7GJb72vxVw0tQM/NDhjVfjYjIXQmCtlOGv6N2JnhsE0nzbgj/pdChbLzfU7GZoM6rDYFm40lQXCct581MWxg+AhoZvY3w== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(346002)(396003)(136003)(376002)(451199015)(36840700001)(46966006)(40470700004)(83380400001)(36860700001)(47076005)(426003)(86362001)(41300700001)(44832011)(8936002)(356005)(82740400003)(2906002)(5660300002)(7696005)(82310400005)(40480700001)(4326008)(6666004)(40460700003)(26005)(316002)(186003)(336012)(8676002)(16526019)(2616005)(1076003)(478600001)(70586007)(54906003)(110136005)(81166007)(70206006)(36756003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:49.9674 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 913e5e80-4a71-40d9-06a8-08daef3ead42 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: BN8NAM11FT062.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6222 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c index f1a050379190..456e385333b6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c @@ -411,17 +411,10 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device, return -EINVAL; } - err = request_firmware(&adev->pm.fw, fw_name, adev->dev); - if (err) { - DRM_ERROR("Failed to request firmware\n"); - return err; - } - - err = amdgpu_ucode_validate(adev->pm.fw); + err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name); if (err) { DRM_ERROR("Failed to load firmware \"%s\"", fw_name); - release_firmware(adev->pm.fw); - adev->pm.fw = NULL; + amdgpu_ucode_release(&adev->pm.fw); return err; } From patchwork Thu Jan 5 17:01: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: 13090207 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 C4791C3DA7D for ; Thu, 5 Jan 2023 17:03:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 95C0610E7C6; Thu, 5 Jan 2023 17:03:21 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2066.outbound.protection.outlook.com [40.107.237.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0B4E510E7AF; Thu, 5 Jan 2023 17:02:55 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XN7wXjCbvn3yecgz9xlmPxp9NiU0VKHxlU/gGpG+wi1SdayoodNQ/SzZTWePt6Xic8xT3t5nsFz47stUM3kbzc0w27WLnGGaAwN1Anj4qh9P5L7jKMbQ3a63iJsi390P5dmc+X2SvoY9OnsuZrKdvqRHdpUcT4R4G4AFBlRGNO0Ekzg/Lxo9Pyr14MWfNCh7i08z1pdG5FIz+DlfDwb04GYRpeGmfbAXxNIuU+W+lpObwE8YpCgCUY0iAib5oLZaCm/nslts3hpybO2PlWztnDZjZvZEOKGFLA+/kZyU4D1vH+ee1RsdwgCpjdg6ER1ZeXtRq7SMMcfBM50oi8aT8Q== 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=AsWjDcawS4yZdq+sUv3zGzFYZNKhuoLJMWU0sY10XC0=; b=Zp3tiiKOi+x9G4w4b0VQ4uw5dBXun9muyLdh/CTXPAH6X0DPwYZkphedVWn+7i0eTlsMZANpnT67Ml3FgqrSIXSzIWfjCR3+kFtedbg8XojwjUiNokl97EeyccsVub7rEk8tn1k9Y6oUT7LW/9J/a90cIZSnIwqPdkauiKCYqAlDVFsnC1v4CeyAEZ6lsRMBrYYpfaAunn++zmHAj3c4lXsGKbFnMZVxloNbAxb9oND/TVn5IrKe010/w2lugfQ869I3sQt25iwL3GE+RcOquVYMMLbEAfVbDfRc6PXOYH9ZcYIt/OQ5tAH2O2SEgr3y1j1r03vXLPKxvwIYpgk0lA== 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=AsWjDcawS4yZdq+sUv3zGzFYZNKhuoLJMWU0sY10XC0=; b=wbyknZeePaSslA8ExDZhuv1TRNRtMCl+9JuYwSpUmf8Vffh6wf0kxhFOV6gSdHVfUK/iqJwcIu2RenSzy5jCI21w8VoIhJWgXM4SdVIYb/orGp0Z16jSwEeqTxoLBYBXJXzqLVkX6eHgSIFaqqHQb7iasHMSgv+kP2LuJfJqHFc= Received: from BN8PR03CA0009.namprd03.prod.outlook.com (2603:10b6:408:94::22) by DM4PR12MB5038.namprd12.prod.outlook.com (2603:10b6:5:389::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:52 +0000 Received: from BN8NAM11FT104.eop-nam11.prod.protection.outlook.com (2603:10b6:408:94:cafe::72) by BN8PR03CA0009.outlook.office365.com (2603:10b6:408:94::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT104.mail.protection.outlook.com (10.13.177.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02:52 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 5 Jan 2023 11:02:49 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 41/45] drm/amd: Use `amdgpu_ucode_*` helpers for GPU info bin Date: Thu, 5 Jan 2023 11:01:27 -0600 Message-ID: <20230105170138.717-42-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT104:EE_|DM4PR12MB5038:EE_ X-MS-Office365-Filtering-Correlation-Id: a8b9df4e-ebbf-41eb-221c-08daef3eaed5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g9HrHfukg6Ul9HuR0ngRchhaiiJDSuoinx3AvmlUUhhPa8w1rGTINNbUAV99qj1obFfYdjv0+XCZV2qMEH+BNUZLIdNfXWBZG/Vb4vfEgyaeHy+4TGUCArJ3uGv3FWWleZVGc0YEpWJ863VSIeKyAZpP4DeKP67ClRlz2i9Qp1/cFHVomIgF0XI3jApT4SAQQGS8ruLJWF4stpcIH4Mg/NuEGhiLVujVWCpVeCwf+jb4513R2xeE9r26FHs94Bs1o+CxaPuP6nr/J3ofe9Kcfbrb1ZrSdZTacKIpS6pA5uDup7Vo4UEY3EMPAC5Le8V0vUO01et/nLOvPx6MWXynAjPBj02Y6LcVikI6KpNpboMJ1az1xTdrdKs4WvIWZSpy74hyKek87R66DseAxmdXfu82pD8WbhIf+K7PmIN6gBZazw+znZc4etm+RvbdnQPb/n+EeiosR6qxFdlNVLLJjmXIJ93Tu/516Lp6ZiqIm2Sa6W7UBsqjKubW2HV8c+0akSdF+TZuXA2iD3EYLM2tw9B9sqR7VYq0jooZCCzji76v0gljCwBVzoJdDp6GCxb8r9UDEbGNe75rhzEs0FS3MzGgWcVLARKtGt1/OL8FqbEAgOFX1EXHwSSU56xjgW1cTonQa1BjMLNx3TT7GXSVv9S0sAqo6o0aghRUXZ1oTM5GcXC5xp/1iUIxKZoeRJZg6wXH+OKTdsaGN17TLVI1dcvzHJav3WVkMrvA2D4ajRkvn69GbxYc9tBkb4vyR1x+/85Vq/RLU1Kw8x/VvDuViQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(346002)(136003)(376002)(396003)(451199015)(40470700004)(46966006)(36840700001)(47076005)(83380400001)(426003)(1076003)(186003)(26005)(82310400005)(336012)(2616005)(7696005)(16526019)(6666004)(40480700001)(86362001)(36860700001)(36756003)(40460700003)(356005)(82740400003)(81166007)(110136005)(4326008)(41300700001)(8676002)(2906002)(70586007)(5660300002)(44832011)(8936002)(478600001)(316002)(70206006)(54906003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:52.5935 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a8b9df4e-ebbf-41eb-221c-08daef3eaed5 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: BN8NAM11FT104.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5038 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index cdb681398a99..406d53ac3096 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -1983,17 +1983,10 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_gpu_info.bin", chip_name); - err = request_firmware(&adev->firmware.gpu_info_fw, fw_name, adev->dev); + err = amdgpu_ucode_request(adev, &adev->firmware.gpu_info_fw, fw_name); if (err) { dev_err(adev->dev, - "Failed to load gpu_info firmware \"%s\"\n", - fw_name); - goto out; - } - err = amdgpu_ucode_validate(adev->firmware.gpu_info_fw); - if (err) { - dev_err(adev->dev, - "Failed to validate gpu_info firmware \"%s\"\n", + "Failed to get gpu_info firmware \"%s\"\n", fw_name); goto out; } @@ -4030,8 +4023,7 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev) amdgpu_fence_driver_sw_fini(adev); amdgpu_device_ip_fini(adev); - release_firmware(adev->firmware.gpu_info_fw); - adev->firmware.gpu_info_fw = NULL; + amdgpu_ucode_release(&adev->firmware.gpu_info_fw); adev->accel_working = false; dma_fence_put(rcu_dereference_protected(adev->gang_submit, true)); From patchwork Thu Jan 5 17:01: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: 13090208 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 491CEC54EBC for ; Thu, 5 Jan 2023 17:03:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B3DBE10E7C4; Thu, 5 Jan 2023 17:03:22 +0000 (UTC) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2046.outbound.protection.outlook.com [40.107.95.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id C3DC910E7AD; Thu, 5 Jan 2023 17:02:54 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i92bOR58qAwScvH1U6sOf+ch+l0MqYajVIdFyjXaZeNu/gvVhEzMKL8Txg4cc959Pg1G6q0wdXfVqI8KZzo1XhaiSqRnSMvW/2D6T9XjOlQFql1hcKiuafATINTNdnmkIMS6M++zzeR/sLe2u+3P0IBBWfOSUgoyAcxB7Ze24osKAKDJywZcN4+vBn4klOUzZyloKnak1S3gP6mrd0EGzJ4w/HOpBGVGS1iPYN7Pn1AW1R+bI+p+pG8967xhG+tasgirT884yjvtOqR+XAcP+D62d59ZKG7+G78AfavI4BCYeaMTMPKU2TUDq3WqL+7nDgrnCxL4m/qprujfySI+WA== 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=mXyOmJXDTom6NbblJzJNlsYjnpdRilWNyJSnHeV9VlQ=; b=kAzmo4MCdUT91Mx77buLKpl2KdzFcWE739wtr5T+8W6nI5HzyYpe6KoSEE/J02EgehqDrbnJ1ZhDfDkndyhKeQV8IXDElY2ZNnuTT+m1kF42uXkRZqerUio72d4zv7qGmSScFHR2vzRwVTbzDAx+HpYl8X55XTlJt2wRIBZsaW2Iwg1lC8odJ61YXQrIko+cXFqknaCFg7VVdtkOFwMyCi3Uj5702rVHa31MmzxsEn4liWUY7LUooGJlp/42KZWAnxB4JQkPbdrYJuNadg/IP7Gjij8uAOYJB7uYGaMkuHmuVbO6tLOkTTFSggmhZCS8dzPyn/b8q6mqTfl2KSJEpg== 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=mXyOmJXDTom6NbblJzJNlsYjnpdRilWNyJSnHeV9VlQ=; b=E29YRyLwYlRS33Nl+JRIwn+4tXn16OESh9bh9bSdk2RMgu56bJVwhEjPkjAIU7FehmaOQZ1aUt5kreLStNmYYzbPaY20EnBruY8O4fAoFcNG7rSAfglQuU26AQRDZczV3/vgj2pJV5mJkf+Be+vL2dG3gDSb8IyhjXL/19twkos= Received: from BN8PR03CA0020.namprd03.prod.outlook.com (2603:10b6:408:94::33) by DS0PR12MB6389.namprd12.prod.outlook.com (2603:10b6:8:cf::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:53 +0000 Received: from BN8NAM11FT104.eop-nam11.prod.protection.outlook.com (2603:10b6:408:94:cafe::9c) by BN8PR03CA0020.outlook.office365.com (2603:10b6:408:94::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.15 via Frontend Transport; Thu, 5 Jan 2023 17:02:53 +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 BN8NAM11FT104.mail.protection.outlook.com (10.13.177.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Thu, 5 Jan 2023 17:02:52 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 5 Jan 2023 11:02:51 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 42/45] drm/amd: Use `amdgpu_ucode_*` helpers for DMCU Date: Thu, 5 Jan 2023 11:01:28 -0600 Message-ID: <20230105170138.717-43-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT104:EE_|DS0PR12MB6389:EE_ X-MS-Office365-Filtering-Correlation-Id: 3976f190-3767-4e7e-3279-08daef3eaf07 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w/KU0pz4pHW2M2PmZQsFjykArSJ4S7EeGn7To4kIXI6JdLKUCJ3JRFy1Mw3B8ezojINAI2kEvmup7XenQy1RIEYxV6BxkQnYmaihe+9jhXvPv3N0uh4J0nHz8qyd7jLjU6sVCri3ZtTXgDxvD79+Wr5iSwsCQDWh8YUizMjHur/mV6uOMeh81mr36nOhkA1k11M504Eo7KUoCUsUf58EV0iXysxRu/VI0AsSZD3MKvBa3EZSZsqf/PCDOOQ1mS284ov5OizwQu25d2jLGjfA/KLY0G7XO+jyEObZkGkWUoBHzrfMUwlzo0ktfYlMLwDuk8uhTVnKhnwHOzA8ILZNDT/lpL+kNzDDxfEYcWH6FkcY81GFDx5RDZLIKLeB+4cNFCEI/Tt6g+08+JFjaBdrOPPfSCe3WjiLF7t+b1/RSrpyfciXtRy8BGEWJvhmHO5EUyENOr1k0xRXi627jcGcbhz+rRRbKAAGALgjQympO+P/K4L9vXP7ByBWvL8yWUIEVdmHTBF5IaeaYu2pSZFgOtsZt0Z/VuZ4jPndHLVW7escGQf+5AJC7LThDUO+5TIR14z6rHB9xuCI87LJ3I2hxDrX24gwp9PGqGVBWD3M9wDLSIEJ8lAycAAH8ITvG+7X7x0J/mWVCUsoYZVxrUoIkn0j5h9M3WqqXBl9wNUd6dSRjHXAVfSyq27J27JlGeVyPU8RSg/b30f1t3jxjQCBaAjasCqRel7K9LY/aAd8i1yr/EF1wyn6l7bvIDzU6i2f57lsMEr7ZsYraoN39ZXwjA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(39860400002)(396003)(136003)(346002)(451199015)(36840700001)(40470700004)(46966006)(47076005)(36860700001)(426003)(83380400001)(5660300002)(82740400003)(81166007)(2906002)(44832011)(41300700001)(356005)(8936002)(4326008)(40480700001)(7696005)(40460700003)(316002)(186003)(2616005)(336012)(8676002)(26005)(1076003)(82310400005)(16526019)(6666004)(478600001)(70586007)(54906003)(110136005)(86362001)(70206006)(36756003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:52.9373 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3976f190-3767-4e7e-3279-08daef3eaf07 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: BN8NAM11FT104.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6389 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 , Lijo Lazar , Rodrigo Siqueira , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Airlie , amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_request` helper will ensure that the return code for missing firmware is -ENODEV so that early_init can fail. The `amdgpu_ucode_release` helper is for symmetry on unloading. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 61c192ead62f..79c4652e8e40 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1881,20 +1881,13 @@ static int load_dmcu_fw(struct amdgpu_device *adev) return 0; } - r = request_firmware_direct(&adev->dm.fw_dmcu, fw_name_dmcu, adev->dev); - if (r == -ENOENT) { + r = amdgpu_ucode_request(adev, &adev->dm.fw_dmcu, fw_name_dmcu); + if (r == -ENODEV) { /* DMCU firmware is not necessary, so don't raise a fuss if it's missing */ DRM_DEBUG_KMS("dm: DMCU firmware not found\n"); adev->dm.fw_dmcu = NULL; return 0; } - if (r) { - dev_err(adev->dev, "amdgpu_dm: Can't load firmware \"%s\"\n", - fw_name_dmcu); - return r; - } - - r = amdgpu_ucode_validate(adev->dm.fw_dmcu); if (r) { dev_err(adev->dev, "amdgpu_dm: Can't validate firmware \"%s\"\n", fw_name_dmcu); From patchwork Thu Jan 5 17:01: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: 13090206 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 5AB1CC3DA7A for ; Thu, 5 Jan 2023 17:03:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 479F910E7B6; Thu, 5 Jan 2023 17:03:21 +0000 (UTC) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2041.outbound.protection.outlook.com [40.107.212.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2E30310E7AF; Thu, 5 Jan 2023 17:02:59 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dednwl63yQGQYbOHEJEz4mpupnKhgMYMYtmLZgPFR8aruOk9wnJ76P5EZiOUT7BLtXpoer/ccFnhHHV4g5nmvRl/c4oFqtYw1ag+sYvyjNPq2drQDSvRc4Pqxk1UX+rgO/4QRvUSM/9S2NfsLDEjmj26q5F2SgME+7+JxNFFAoPGPms/vxa09mfGLJ1Grnx4Ih5uYPBr1F71T2HqvSeMEU44+dxTChT7KQeWrKx4XBevwtmrF9zJdFgsqJoex3zWviqb7yxpUuXNQ0bz97DwViF+TezajJVHOEYhpcCUPgXPw65xBDf5WwSn7YPS/2hdkvSyu++0x6h5xSxMqFnV1A== 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=6kQ/L0+xBbJJ8mqE/txSRX3GQhAZ+AXJ0q037RNhi7Y=; b=jKJ/uXYTIPodhlaMDqs+7xTn+vqQ9Xi2GY2lIOP8o7B5zRI+BJ/ctV5U/TwuPltVNgq+Ib/eYGGTD6zGs0DUfaU8VvvCK2ANQAyMpgSf6BbGGbwtPOUTYYnw9ujhY86asXd0C0Why4cqjbl4ULPzpHZEQN0rpLHh89OHlFdBkTOtbN0JEvTxM9CH0DC8u6BHHmWiIBtBshb3ARwc3u817ODgv9+xMUiNyvODO87c2CMxJy5myEnBm6AkkJh8a52dIj9YNRNCbjrhPWAkTqHG/qa1GeUVB+svySuWQA/Pg1GSD7aIX8e2hJIQgSVIKd2bBUltYOERWs2NbN/Xf58gZQ== 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=6kQ/L0+xBbJJ8mqE/txSRX3GQhAZ+AXJ0q037RNhi7Y=; b=JxZ6UG6DDJJowoUueSE0v6AP3DHS74oT7yt8sXpRFVV2sUGt0nOj44X4IytfW5yMi5xNn7hZBWhLW8ODTTKd76YoNadMxz0pZhnmhTqM16QLfKz8e1JNBduoQbiJuoVzZXDFwguqOZneHJzwdd3+FeXKxVeW2er7ngyG4/RnfTE= Received: from BN9PR03CA0171.namprd03.prod.outlook.com (2603:10b6:408:f4::26) by CY8PR12MB7098.namprd12.prod.outlook.com (2603:10b6:930:62::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:56 +0000 Received: from BN8NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f4:cafe::ab) by BN9PR03CA0171.outlook.office365.com (2603:10b6:408:f4::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; Thu, 5 Jan 2023 17:02:53 +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 BN8NAM11FT014.mail.protection.outlook.com (10.13.177.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:52 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 43/45] drm/amd: Use `amdgpu_ucode_release` helper for powerplay Date: Thu, 5 Jan 2023 11:01:29 -0600 Message-ID: <20230105170138.717-44-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT014:EE_|CY8PR12MB7098:EE_ X-MS-Office365-Filtering-Correlation-Id: 79a96b7f-c672-4cc9-1e39-08daef3eaf7d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yGtEuJsUjSBHIb7LN8I8926KveHJarkeSAnHqTuDlSatsfMGKLxKKD6nG6c5gWoV8aqh20mRB+G9Ve7XKKuOMvnj08KMcpQm7Vhq3Y5huxpy+h2kdAgt9VTPmtnRJi3v+Ty6fZ1Qlhkvzxv1Dp4TUWZwTvRAAK5NBos27Xf3lTg7JoTVAR13Fh6JliIiJlsSjfAnYBZLp3N1g/UYGspti2tO8xkCULmEWYpo8N+xe9GsumBjBi4jkzf66A64793ySZGcyNVqAp6LdUFOofqo+/RB74ki/+15LfEiFvNPWH9Rnjx2Rqsf3IAmeB6ic7lQZPrBkECodnzX1hUCbaqNnEbWONfBQGeJWZ1iH1gL72jACF0m1e7u96UCOkU5XV0xO2F/a4ks2i31Wy3LmUBKg2+Ti2vjZy6k4qNBujki8ZRZhdPboCowciyunPkTu25K5Ce8yAyu5/ehXcjVjMdmtAMcj84xxaD25DzJ23hBg8hRTqh63U4sLrqvzkb6jxjjjyNnQWU3Gi+Eny6jNmjfRWXGT1wqyMXoCm5dRXCjgYiXm5FUKtBz+K1fORVeQtJNFuAk5pROqT3sLPjP5kbGW5mbKacuGrILWnnvFn0NbWZWe0df5SROKsw0La+2Iyl67CTDE5fb6GwlL07MLwQ0UGRYe4vLNncPqX8r/QFkMRDFo3Z/aQl4tfbajXy3Q88d791GiSzFodxw4ETrJkeBkkEV93BiPBFfW0cMWbBUxzSfXSHfrIyTA7dd2h4yunJKzl2yUqEabvHPplkCMLjjOQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(136003)(346002)(39860400002)(451199015)(40470700004)(46966006)(36840700001)(4744005)(2906002)(5660300002)(8936002)(44832011)(8676002)(41300700001)(4326008)(54906003)(70586007)(70206006)(110136005)(316002)(478600001)(82310400005)(26005)(186003)(16526019)(7696005)(336012)(40480700001)(6666004)(83380400001)(426003)(47076005)(2616005)(81166007)(356005)(82740400003)(1076003)(86362001)(40460700003)(36860700001)(36756003)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:53.7101 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 79a96b7f-c672-4cc9-1e39-08daef3eaf7d 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: BN8NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7098 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , Evan Quan , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_release` helper is replacing all calls to release_firmware. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c index 8f2cc6310340..11b7b4cffaae 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c @@ -111,8 +111,7 @@ static int pp_sw_fini(void *handle) hwmgr_sw_fini(hwmgr); - release_firmware(adev->pm.fw); - adev->pm.fw = NULL; + amdgpu_ucode_release(&adev->pm.fw); return 0; } From patchwork Thu Jan 5 17:01: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: 13090202 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 27DBEC5479D for ; Thu, 5 Jan 2023 17:03:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 769EC10E797; Thu, 5 Jan 2023 17:03:12 +0000 (UTC) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2078.outbound.protection.outlook.com [40.107.243.78]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9F0F810E7BA; Thu, 5 Jan 2023 17:02:59 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JSlGL1eb9vGMAtUuPy2mA0LuUg3XYntR3yWAriRmTIwoXJlizHbGpXMYj5tHFMZDpFeCrPdWiie+IY6mLWq5oF9b4vTp5tmCCStAsDD+zumQDuETZpHBUhPEctc11vZsPFWjI/xhhWUi2O95llbnshpjvQfrkJZdlVWGSviHL0DZ4Ev6Wzm109TLc0LoAlvFJulHlTJZHTgHlaGelHb/BEzPXW7cocXg7DA73g4SUTA1o206I050vcLfOk69hWTca481Q/l6XPrb9hpclZNCaD1L00d+7cZdlxQfWflagUkxSqoanx5lh+O5sece/02WvD7Ar21tMuINaUX7xnUYsg== 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=s1pwPFsYyJ2Etq+d42jFE8DbYc+NuAH9kNmF55hK1yY=; b=AlydKcu4xd3MakzFZzLrKuKDrnlO1ycTxRshdYtbltfovAgRhOd0haEfliX/QneiJiVxVa170iNbl/evkHMFoT5i6npc0UBMCLb9PxdnbXojUElJZVWLPs2Qgxtev4SE+CUEM44iKjdtIYAt9nkMgFu3En6Op4+X2oNP82Krv226O4yl/DVn3n6B0R0aI89BZDbTXzOVotl7avsDwTXeVmzTWJ58sKb1GXFlbYAEsyPjWJb9wf9OnX4p9GA0AWKB7WjAejdZa+m/pEQuxa63aJYWCxDFaTGzpB5zwAVlmrYVee/DMpebkseN9DUk3w4b5lDymgm/BKGH7o7e6Hd9OA== 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=s1pwPFsYyJ2Etq+d42jFE8DbYc+NuAH9kNmF55hK1yY=; b=dkUgW2k4Apcb1k8SIBW7il9/+1xyA22X+CxhDSLPRluOZP9JeNq0N0+izn+BkTgnOSJ+OZhM0Iy6tkvb83DAe7KsBn6zADjNWm1DcTbG4gOfDSwHBC5dC+/UuWejNcRqzGvFVYrAU1xqoOZPxexOOnY1ElQLPq+oWQLDucOYNr4= Received: from BN9PR03CA0162.namprd03.prod.outlook.com (2603:10b6:408:f4::17) by DS7PR12MB5790.namprd12.prod.outlook.com (2603:10b6:8:75::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:57 +0000 Received: from BN8NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f4:cafe::d5) by BN9PR03CA0162.outlook.office365.com (2603:10b6:408:f4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT014.mail.protection.outlook.com (10.13.177.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.17 via Frontend Transport; Thu, 5 Jan 2023 17:02:57 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 5 Jan 2023 11:02:53 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 44/45] drm/amd: Use `amdgpu_ucode_release` helper for si Date: Thu, 5 Jan 2023 11:01:30 -0600 Message-ID: <20230105170138.717-45-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT014:EE_|DS7PR12MB5790:EE_ X-MS-Office365-Filtering-Correlation-Id: bb2c82b6-61dd-485f-0979-08daef3eb1dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SyG7DJ7Uy3NAWA9mboqmnDTR4GuFqqSUqAUxySv6TntWEBkyAa+FaAGW5QNkcwNt57My7VM6M1b0UAgcCDc38ACPZJguBKEsHwLuwYiiF1KrdHz6idWfnV++Ff/zwaOMpd01sUkyHtBoLjI2Bxsr+yMyTXkeLqPZEzQJ0x83w/6VVkDt8jSKbzcaGvlUiMDXFlkwIauRT0d9W8VNugHYMfVXGv3+Xp/IjyoVsAERTHkN2f0QKurzZgD7IGL0uGpl25a3RNz/5hZLNaOh502qJ3zm+dGF9TtFaxSNF1QvUfnXPrvizI56ztA163p1UIewkrkaAoBgg0Y/BHgAhNmusS5DFXTRl/3sltqTuz+1Y0/EDKntr3MLknQio8QiwheHgY55NYsEBryGBW4hQwwxhpOg3iRs1f2VHROzLGjmIFEUz7ZTbVAMFTTpZD7tbF1/hZ5dMfgzPJAcvQRNLCRsxMkf817TQ9+Tprlx/MYfc4NPu+ypmIOeRhbqrgd6qvXgExjkIRGV6eJ7VePB2dHvhzRcUlNsXl7o0xYFtEiN3ktFK6YVR8TQxMfrqEm6j8sjSSkx+rEkoGisUCkj1MCUTlA8dcmbkKNhj1F00sytJyKySYGLF1BbyEM5lu7IBl/PI1uukxUYyhCA9kNUKc0mOvlos2IhkqnzTljQsL9QpJUCG42pqEOUlGAQAkNOZSivv98T3AT2MYBCfpHvcTq52Jhbto1deFrhvQ1IThlMkvfv+opQrwcslkf2b1Ov6vA3SbKTB2eHS9p3uUeqRJ5CGg== 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)(40470700004)(46966006)(356005)(44832011)(47076005)(5660300002)(8936002)(2906002)(426003)(36860700001)(83380400001)(41300700001)(86362001)(82310400005)(40480700001)(82740400003)(36756003)(40460700003)(54906003)(186003)(81166007)(26005)(110136005)(16526019)(6666004)(316002)(478600001)(7696005)(8676002)(2616005)(4326008)(70206006)(1076003)(70586007)(336012)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:57.6941 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bb2c82b6-61dd-485f-0979-08daef3eb1dd 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: BN8NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5790 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , Evan Quan , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `amdgpu_ucode_release` helper is replacing all calls to release_firmware. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- v5->v6: * Adjust for amdgpu_ucode_release argument change --- drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c b/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c index 49c398ec0aaf..d6d9e3b1b2c0 100644 --- a/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +++ b/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c @@ -7714,20 +7714,13 @@ static int si_dpm_init_microcode(struct amdgpu_device *adev) } snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_smc.bin", chip_name); - err = request_firmware(&adev->pm.fw, fw_name, adev->dev); - if (err) - goto out; - err = amdgpu_ucode_validate(adev->pm.fw); - -out: + err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name); if (err) { DRM_ERROR("si_smc: Failed to load firmware. err = %d\"%s\"\n", err, fw_name); - release_firmware(adev->pm.fw); - adev->pm.fw = NULL; + amdgpu_ucode_release(&adev->pm.fw); } return err; - } static int si_dpm_sw_init(void *handle) From patchwork Thu Jan 5 17:01: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: 13090209 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 C7958C5479D for ; Thu, 5 Jan 2023 17:03:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7808B10E7C5; Thu, 5 Jan 2023 17:03:23 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2048.outbound.protection.outlook.com [40.107.220.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9A42C10E7C6; Thu, 5 Jan 2023 17:03:03 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UHUWzOSuipaDtrW9MrxcB3qGh5DrW6qbtIAT3nIACu6D9KcHurCshe8PVLzBOMmFTBTUD2vLu5k7kBfoGIaYuo7phaEsfadvJKq8CjWFW9fA6ZiF3IKIohbq6bmM6DD8a1HK5IVkMBXE23qPYBwXu82yproLqtBBM5n0PPzJtx2Oxm+qxvYHeijjKruRn+yJqo46D8gQYmsH70LBEMtgnkZ/pDJNBuyr4a5HIowH4Tlei9fyFSKlIEp2aXkFPgHw5SsUN2A5gQe61DJH93dUx1xxwRDbMvjDws1JFk0Gv7gbvpBTPt1YpIGB1PFUjItmfHHddmdAIDI5stX2Yx+gzQ== 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=p5fAZZuMM1WQtjz/AbOv9TDFwhRSkYeX5tgWRrf12Co=; b=NfKy2BDsZHHoglBTfauf+HsiGxwnD8SRQmOPgC9dS+u6fbKeHTBdqS5SnQh0u4W5GMR1R+Wth9b0XxlXl9tx+Bi5FC145XC1mk0Th1EJ2Qe54virWNKUIju8utGeIEsdQPUTEV68zU2Ps8JWpcyOWCuIWKlT6Nsv9Jmskr2KciWOdBiSSIHHYi/T6aa5NI6uTPt0cHWk1RHfF3iwCcu160z+lQsCYjYV/VHyy0pZGGh0lZxWrrVmfC+0KI/f8xgfMbF61lRxfWvrsC/cfE1wm2Z8J+8qXgJGZfdPh6rDFKXhUv6OGd4wOp8FM6owaKoGq987P3W6J4MYRITVr6+qKg== 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=p5fAZZuMM1WQtjz/AbOv9TDFwhRSkYeX5tgWRrf12Co=; b=SMMMNr5G1sKeNCajk3ZKNy1NIS1qkDLSKlUS4vdWD51ImcsvI438Dj6cNZqeMG4RHI89C+m6zOUS+48yF7d190cvT1Q/EHqZxNr/9f3nIPLO+Rc5fLQYqTksSyAxpA9r4a9nDgkmcJmXt2vELWqfSEChyHO8X64n590jSpmCIi8= Received: from BN9PR03CA0177.namprd03.prod.outlook.com (2603:10b6:408:f4::32) by SA1PR12MB5637.namprd12.prod.outlook.com (2603:10b6:806:228::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 17:02:59 +0000 Received: from BN8NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f4:cafe::e6) by BN9PR03CA0177.outlook.office365.com (2603:10b6:408:f4::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Thu, 5 Jan 2023 17:02: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 BN8NAM11FT014.mail.protection.outlook.com (10.13.177.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.17 via Frontend Transport; Thu, 5 Jan 2023 17:02: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; Thu, 5 Jan 2023 11:02:55 -0600 From: Mario Limonciello To: Alex Deucher , Subject: [PATCH v7 45/45] drm/amd: make amdgpu_ucode_validate static Date: Thu, 5 Jan 2023 11:01:31 -0600 Message-ID: <20230105170138.717-46-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105170138.717-1-mario.limonciello@amd.com> References: <20230105170138.717-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT014:EE_|SA1PR12MB5637:EE_ X-MS-Office365-Filtering-Correlation-Id: 2d3ae5fa-05c7-424c-325c-08daef3eb2ef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NZ0Fh8LxAXAeqjbVNbw3cHkhVb8jruTtlXxXmJpS40gSRluUgGAEVSLfeVXlPyyHypeF5XY7EY0rOsJ3heripbr/lEzRPrm1TfubnAteaSyTSEXo1bDloi/juDycUcPea/KVT/FU85LlEAPPZWe4yvfck9JY/z5tPCoVR2fUm7GWn5HPSZaip2Qx0a6j9sVBKdSsOMPr2CTCAI5UH11CYET8gBTPXrlPnKhz5349hHorwmYjZuqdrPWewbIh2L+xUa63JxKhB7VAozTyRl6/yxE5TdTfn4az4pP7a9KA/KP90MuiCHZrL7kpdaLlQ1AUWifU1SMjyMX1dfhPfx1Ez1o5XFqoshgO49XQm0m+oG8K8+AVXZrTLp2ibZgC36rJ22ngK8k1ga7iRX46Otpfen2FYZEiIJnXlGKQd/XTUybyTIQSX/37iXvg5Nh1eHQENQUVvK0YnxHeLM3NwOPrTr9+Snw4LUTZC5lldlw6rAjkPsZFbyz7ozWO+HZ2qVQ32m17rPP3xS1gZyxRHXUFd7/5kt5WDw2vChQhti7z/tHAb0Yy0ooim3WQCGMBPDv03Aq85MUh2J/mdbxpcGbTNabpr8YiTAtKGUx7O2ZlLSEY3mygzC6PAwKAx4k7+cq5howyjHpp9J4j3sZuykx+jCezxlL+8l7JSrrJaMBztYEjjraZZSuZOaH6j+OoMToCtwCSEdwBFIJ2Wu3PL79rWCh6R6tjBDa7ZSnWI9uFqD0= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(39860400002)(396003)(136003)(346002)(451199015)(36840700001)(40470700004)(46966006)(47076005)(36860700001)(426003)(83380400001)(5660300002)(82740400003)(81166007)(2906002)(44832011)(41300700001)(356005)(8936002)(4326008)(40480700001)(7696005)(40460700003)(316002)(186003)(2616005)(336012)(8676002)(26005)(1076003)(82310400005)(16526019)(6666004)(478600001)(70586007)(54906003)(110136005)(86362001)(70206006)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 17:02:59.4909 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d3ae5fa-05c7-424c-325c-08daef3eb2ef 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: BN8NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB5637 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" , David Airlie , Lijo Lazar , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Carlos Soriano Sanchez , christian.koenig@amd.com, Mario Limonciello Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" No consumers outside of amdgpu_ucode.c use amdgpu_ucode_validate anymore, so make the function static. Reviewed-by: Alex Deucher Reviewed-by: Lijo Lazar Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c index 8ebfec12da87..47549d659d9b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c @@ -504,7 +504,7 @@ void amdgpu_ucode_print_gpu_info_hdr(const struct common_firmware_header *hdr) } } -int amdgpu_ucode_validate(const struct firmware *fw) +static int amdgpu_ucode_validate(const struct firmware *fw) { const struct common_firmware_header *hdr = (const struct common_firmware_header *)fw->data; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h index 848579d4988b..bee93ab4298f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h @@ -543,7 +543,6 @@ void amdgpu_ucode_print_rlc_hdr(const struct common_firmware_header *hdr); void amdgpu_ucode_print_sdma_hdr(const struct common_firmware_header *hdr); void amdgpu_ucode_print_psp_hdr(const struct common_firmware_header *hdr); void amdgpu_ucode_print_gpu_info_hdr(const struct common_firmware_header *hdr); -int amdgpu_ucode_validate(const struct firmware *fw); int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw, const char *fw_name); void amdgpu_ucode_release(const struct firmware **fw);