From: Harry Wentland <harry.wentland@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
linux-kernel@vger.kernel.org
Cc: Javier Martinez Canillas <javierm@redhat.com>,
Carlos Soriano Sanchez <csoriano@redhat.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
christian.koenig@amd.com, Lazar Lijo <Lijo.Lazar@amd.com>,
Leo Li <sunpeng.li@amd.com>,
Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>,
"Pan, Xinhui" <Xinhui.Pan@amd.com>
Subject: Re: [PATCH v4 24/27] drm/amd/display: Load DMUB microcode during early_init
Date: Wed, 4 Jan 2023 10:52:52 -0500 [thread overview]
Message-ID: <4d87ae7c-457e-ffce-cc3c-d586e0513698@amd.com> (raw)
In-Reply-To: <20230103221852.22813-25-mario.limonciello@amd.com>
On 1/3/23 17:18, Mario Limonciello wrote:
> If DMUB is required for an ASIC, ensure that the microcode is available
> and validates during early_init.
>
> Any failures will cause the driver to fail to probe before the firmware
> framebuffer has been removed.
>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
In addition to changing the FW load order this also changes
request_firmware_direct to request_firmware but this seems to
be the correct thing here anyways, since DMUB is not optional.
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Harry
> ---
> v3->v4:
> * New patch
> ---
> .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 89 ++++++++++++-------
> 1 file changed, 58 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 4829b5431e4c..eeccc8af0320 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -1945,7 +1945,6 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev)
> struct dmub_srv_fb_info *fb_info;
> struct dmub_srv *dmub_srv;
> const struct dmcub_firmware_header_v1_0 *hdr;
> - const char *fw_name_dmub;
> enum dmub_asic dmub_asic;
> enum dmub_status status;
> int r;
> @@ -1953,73 +1952,46 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev)
> switch (adev->ip_versions[DCE_HWIP][0]) {
> case IP_VERSION(2, 1, 0):
> dmub_asic = DMUB_ASIC_DCN21;
> - fw_name_dmub = FIRMWARE_RENOIR_DMUB;
> - if (ASICREV_IS_GREEN_SARDINE(adev->external_rev_id))
> - fw_name_dmub = FIRMWARE_GREEN_SARDINE_DMUB;
> break;
> case IP_VERSION(3, 0, 0):
> - if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0)) {
> + if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0))
> dmub_asic = DMUB_ASIC_DCN30;
> - fw_name_dmub = FIRMWARE_SIENNA_CICHLID_DMUB;
> - } else {
> + else
> dmub_asic = DMUB_ASIC_DCN30;
> - fw_name_dmub = FIRMWARE_NAVY_FLOUNDER_DMUB;
> - }
> break;
> case IP_VERSION(3, 0, 1):
> dmub_asic = DMUB_ASIC_DCN301;
> - fw_name_dmub = FIRMWARE_VANGOGH_DMUB;
> break;
> case IP_VERSION(3, 0, 2):
> dmub_asic = DMUB_ASIC_DCN302;
> - fw_name_dmub = FIRMWARE_DIMGREY_CAVEFISH_DMUB;
> break;
> case IP_VERSION(3, 0, 3):
> dmub_asic = DMUB_ASIC_DCN303;
> - fw_name_dmub = FIRMWARE_BEIGE_GOBY_DMUB;
> break;
> case IP_VERSION(3, 1, 2):
> case IP_VERSION(3, 1, 3):
> dmub_asic = (adev->external_rev_id == YELLOW_CARP_B0) ? DMUB_ASIC_DCN31B : DMUB_ASIC_DCN31;
> - fw_name_dmub = FIRMWARE_YELLOW_CARP_DMUB;
> break;
> case IP_VERSION(3, 1, 4):
> dmub_asic = DMUB_ASIC_DCN314;
> - fw_name_dmub = FIRMWARE_DCN_314_DMUB;
> break;
> case IP_VERSION(3, 1, 5):
> dmub_asic = DMUB_ASIC_DCN315;
> - fw_name_dmub = FIRMWARE_DCN_315_DMUB;
> break;
> case IP_VERSION(3, 1, 6):
> dmub_asic = DMUB_ASIC_DCN316;
> - fw_name_dmub = FIRMWARE_DCN316_DMUB;
> break;
> case IP_VERSION(3, 2, 0):
> dmub_asic = DMUB_ASIC_DCN32;
> - fw_name_dmub = FIRMWARE_DCN_V3_2_0_DMCUB;
> break;
> case IP_VERSION(3, 2, 1):
> dmub_asic = DMUB_ASIC_DCN321;
> - fw_name_dmub = FIRMWARE_DCN_V3_2_1_DMCUB;
> break;
> default:
> /* ASIC doesn't support DMUB. */
> return 0;
> }
>
> - r = request_firmware_direct(&adev->dm.dmub_fw, fw_name_dmub, adev->dev);
> - if (r) {
> - DRM_ERROR("DMUB firmware loading failed: %d\n", r);
> - return 0;
> - }
> -
> - r = amdgpu_ucode_validate(adev->dm.dmub_fw);
> - if (r) {
> - DRM_ERROR("Couldn't validate DMUB firmware: %d\n", r);
> - return 0;
> - }
> -
> hdr = (const struct dmcub_firmware_header_v1_0 *)adev->dm.dmub_fw->data;
> adev->dm.dmcub_fw_version = le32_to_cpu(hdr->header.ucode_version);
>
> @@ -4513,6 +4485,61 @@ DEVICE_ATTR_WO(s3_debug);
>
> #endif
>
> +static int dm_init_microcode(struct amdgpu_device *adev)
> +{
> + char *fw_name_dmub;
> + int r;
> +
> + switch (adev->ip_versions[DCE_HWIP][0]) {
> + case IP_VERSION(2, 1, 0):
> + fw_name_dmub = FIRMWARE_RENOIR_DMUB;
> + if (ASICREV_IS_GREEN_SARDINE(adev->external_rev_id))
> + fw_name_dmub = FIRMWARE_GREEN_SARDINE_DMUB;
> + break;
> + case IP_VERSION(3, 0, 0):
> + if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0))
> + fw_name_dmub = FIRMWARE_SIENNA_CICHLID_DMUB;
> + else
> + fw_name_dmub = FIRMWARE_NAVY_FLOUNDER_DMUB;
> + break;
> + case IP_VERSION(3, 0, 1):
> + fw_name_dmub = FIRMWARE_VANGOGH_DMUB;
> + break;
> + case IP_VERSION(3, 0, 2):
> + fw_name_dmub = FIRMWARE_DIMGREY_CAVEFISH_DMUB;
> + break;
> + case IP_VERSION(3, 0, 3):
> + fw_name_dmub = FIRMWARE_BEIGE_GOBY_DMUB;
> + break;
> + case IP_VERSION(3, 1, 2):
> + case IP_VERSION(3, 1, 3):
> + fw_name_dmub = FIRMWARE_YELLOW_CARP_DMUB;
> + break;
> + case IP_VERSION(3, 1, 4):
> + fw_name_dmub = FIRMWARE_DCN_314_DMUB;
> + break;
> + case IP_VERSION(3, 1, 5):
> + fw_name_dmub = FIRMWARE_DCN_315_DMUB;
> + break;
> + case IP_VERSION(3, 1, 6):
> + fw_name_dmub = FIRMWARE_DCN316_DMUB;
> + break;
> + case IP_VERSION(3, 2, 0):
> + fw_name_dmub = FIRMWARE_DCN_V3_2_0_DMCUB;
> + break;
> + case IP_VERSION(3, 2, 1):
> + fw_name_dmub = FIRMWARE_DCN_V3_2_1_DMCUB;
> + break;
> + default:
> + /* ASIC doesn't support DMUB. */
> + return 0;
> + }
> + r = amdgpu_ucode_load(adev, &adev->dm.dmub_fw, fw_name_dmub);
> + if (r)
> + DRM_ERROR("DMUB firmware loading failed: %d\n", r);
> + return r;
> +}
> +
> static int dm_early_init(void *handle)
> {
> struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> @@ -4645,7 +4672,7 @@ static int dm_early_init(void *handle)
> #endif
> adev->dc_enabled = true;
>
> - return 0;
> + return dm_init_microcode(adev);
> }
>
> static bool modereset_required(struct drm_crtc_state *crtc_state)
next prev parent reply other threads:[~2023-01-04 15:53 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-03 22:18 [PATCH v4 00/27] Recover from failure to probe GPU Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 01/27] drm/amd: Delay removal of the firmware framebuffer Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 02/27] drm/amd: Add a legacy mapping to "amdgpu_ucode_ip_version_decode" Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 03/27] drm/amd: Convert SMUv11 microcode to use `amdgpu_ucode_ip_version_decode` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 04/27] drm/amd: Convert SMUv13 " Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 05/27] drm/amd: Add a new helper for loading/validating microcode Mario Limonciello
2023-01-04 4:53 ` Lazar, Lijo
2023-01-04 9:37 ` Christian König
2023-01-03 22:18 ` [PATCH v4 06/27] drm/amd: Use `amdgpu_ucode_load` helper for SDMA Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 07/27] drm/amd: Convert SDMA to use `amdgpu_ucode_ip_version_decode` Mario Limonciello
2023-01-04 4:54 ` Lazar, Lijo
2023-01-03 22:18 ` [PATCH v4 08/27] drm/amd: Make SDMA firmware load failures less noisy Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 09/27] drm/amd: Use `amdgpu_ucode_load` helper for VCN Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 10/27] drm/amd: Load VCN microcode during early_init Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 11/27] drm/amd: Load MES " Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 12/27] drm/amd: Use `amdgpu_ucode_load` helper for MES Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 13/27] drm/amd: Remove superfluous assignment for `adev->mes.adev` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 14/27] drm/amd: Use `amdgpu_ucode_load` helper for GFX9 Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 15/27] drm/amd: Load GFX9 microcode during early_init Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 16/27] drm/amd: Use `amdgpu_ucode_load` helper for GFX10 Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 17/27] drm/amd: Load GFX10 microcode during early_init Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 18/27] drm/amd: Use `amdgpu_ucode_load` helper for GFX11 Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 19/27] drm/amd: Load GFX11 microcode during early_init Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 20/27] drm/amd: Parse both v1 and v2 TA microcode headers using same function Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 21/27] drm/amd: Avoid BUG() for case of SRIOV missing IP version Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 22/27] drm/amd: Load PSP microcode during early_init Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 23/27] drm/amd: Use `amdgpu_ucode_load` helper for PSP Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 24/27] drm/amd/display: Load DMUB microcode during early_init Mario Limonciello
2023-01-04 15:52 ` Harry Wentland [this message]
2023-01-03 22:18 ` [PATCH v4 25/27] drm/amd: Use `amdgpu_ucode_load` helper for SMU Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 26/27] drm/amd: Load SMU microcode during early_init Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 27/27] drm/amd: Optimize SRIOV switch/case for PSP microcode load Mario Limonciello
2023-01-04 13:18 ` Christian König
2023-01-04 15:42 ` Limonciello, Mario
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4d87ae7c-457e-ffce-cc3c-d586e0513698@amd.com \
--to=harry.wentland@amd.com \
--cc=Lijo.Lazar@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=csoriano@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=sunpeng.li@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox