drm/amd/display: add VBIOS bounding box KUnit test

[WHAT]
Add a KUnit test for dm_dmub_get_vbios_bounding_box() covering the
default IP-version path that returns NULL without allocating GPU memory
or issuing GPINT commands.

Assisted-by: Copilot:Claude-Opus-4.8 GPT-5.5
Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Alex Hung 2026-07-06 09:27:59 -06:00 committed by Alex Deucher
parent 1d157a9aab
commit 24a10b9d5b
3 changed files with 27 additions and 1 deletions

View File

@ -385,7 +385,7 @@ dm_dmub_send_vbios_gpint_command(struct amdgpu_device *adev,
return DMUB_STATUS_TIMEOUT;
}
static void *dm_dmub_get_vbios_bounding_box(struct amdgpu_device *adev)
STATIC_IFN_KUNIT void *dm_dmub_get_vbios_bounding_box(struct amdgpu_device *adev)
{
void *bb;
long long addr;
@ -440,6 +440,7 @@ static void *dm_dmub_get_vbios_bounding_box(struct amdgpu_device *adev)
return NULL;
}
EXPORT_IF_KUNIT(dm_dmub_get_vbios_bounding_box);
enum dmub_ips_disable_type dm_get_default_ips_mode(
struct amdgpu_device *adev)

View File

@ -69,6 +69,7 @@ int dm_init_microcode(struct amdgpu_device *adev);
struct dc_context;
struct dmub_cmd_fused_request;
void *dm_dmub_get_vbios_bounding_box(struct amdgpu_device *adev);
void abort_fused_io(struct dc_context *ctx,
const struct dmub_cmd_fused_request *request);
#endif

View File

@ -932,6 +932,28 @@ static void dm_test_init_microcode_unsupported_asic(struct kunit *test)
KUNIT_EXPECT_EQ(test, dm_init_microcode(adev), 0);
}
/* Tests for dm_dmub_get_vbios_bounding_box() */
/**
* dm_test_dmub_get_vbios_bounding_box_default_null - Test default IP version returns NULL
* @test: The KUnit test context
*
* For an IP version without a bounding-box size mapping, the switch falls
* through to the default case and dm_dmub_get_vbios_bounding_box() returns
* NULL without allocating GPU memory or issuing GPINT commands.
*/
static void dm_test_dmub_get_vbios_bounding_box_default_null(struct kunit *test)
{
struct amdgpu_device *adev;
adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev);
adev->ip_versions[DCE_HWIP][0] = IP_VERSION(3, 5, 0);
KUNIT_EXPECT_NULL(test, dm_dmub_get_vbios_bounding_box(adev));
}
/* Tests for dm_execute_dmub_cmd() */
/**
@ -1369,6 +1391,8 @@ static struct kunit_case amdgpu_dm_dmub_tests[] = {
KUNIT_CASE(dm_test_dmub_sw_init_unsupported_asic),
/* dm_init_microcode() */
KUNIT_CASE(dm_test_init_microcode_unsupported_asic),
/* dm_dmub_get_vbios_bounding_box() */
KUNIT_CASE(dm_test_dmub_get_vbios_bounding_box_default_null),
/* dm_execute_dmub_cmd() */
KUNIT_CASE(dm_test_execute_dmub_cmd_null_dmub_srv),
/* amdgpu_dm_process_dmub_aux_transfer_sync() */