drm/amd: Make sure image is written to trigger VBIOS image update flow
authorMario Limonciello <mario.limonciello@amd.com>
Wed, 7 Jun 2023 06:41:22 +0000 (01:41 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Jun 2023 14:00:56 +0000 (16:00 +0200)
commitb2706d862b6577b8218bdef1c238e175624b906d
treea04b44f1f4644e44099282ae2894c9fa6f29e251
parentee8c6580c3106b0061c7cdff1804e5a1f1e1d7fe
drm/amd: Make sure image is written to trigger VBIOS image update flow

commit 3eb1a3a04056ba3df3205e169b8acc9da0c65a94 upstream.

The VBIOS image update flow requires userspace to:
1) Write the image to `psp_vbflash`
2) Read `psp_vbflash`
3) Poll `psp_vbflash_status` to check for completion

If userspace reads `psp_vbflash` before writing an image, it's
possible that it causes problems that can put the dGPU into an invalid
state.

Explicitly check that an image has been written before letting a read
succeed.

Cc: stable@vger.kernel.org
Fixes: 8424f2ccb3c0 ("drm/amdgpu/psp: Add vbflash sysfs interface support")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c