]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: Call FP Protect Before Mode Programming/Mode Support
authorAustin Zheng <Austin.Zheng@amd.com>
Thu, 17 Apr 2025 14:24:29 +0000 (10:24 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 5 May 2025 16:58:36 +0000 (12:58 -0400)
[Why]
Memory allocation occurs within dml21_validate() for adding phantom planes.
May cause kernel to be tainted due to usage of FP Start.

[How]
Move FP start from dml21_validate to before mode programming/mode support.
Calculations requiring floating point are all done within mode programming
or mode support.

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Signed-off-by: Austin Zheng <Austin.Zheng@amd.com>
Signed-off-by: Ray Wu <ray.wu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c

index 5d16f36ec95c8b330eb6222da177e3fe563435c8..ed6584535e898ed1377d46d308a348f093128e7d 100644 (file)
@@ -234,7 +234,9 @@ static bool dml21_mode_check_and_programming(const struct dc *in_dc, struct dc_s
        if (!result)
                return false;
 
+       DC_FP_START();
        result = dml2_build_mode_programming(mode_programming);
+       DC_FP_END();
        if (!result)
                return false;
 
@@ -277,7 +279,9 @@ static bool dml21_check_mode_support(const struct dc *in_dc, struct dc_state *co
        mode_support->dml2_instance = dml_init->dml2_instance;
        dml21_map_dc_state_into_dml_display_cfg(in_dc, context, dml_ctx);
        dml_ctx->v21.mode_programming.dml2_instance->scratch.build_mode_programming_locals.mode_programming_params.programming = dml_ctx->v21.mode_programming.programming;
+       DC_FP_START();
        is_supported = dml2_check_mode_supported(mode_support);
+       DC_FP_END();
        if (!is_supported)
                return false;
 
@@ -288,16 +292,12 @@ bool dml21_validate(const struct dc *in_dc, struct dc_state *context, struct dml
 {
        bool out = false;
 
-       DC_FP_START();
-
        /* Use dml_validate_only for fast_validate path */
        if (fast_validate)
                out = dml21_check_mode_support(in_dc, context, dml_ctx);
        else
                out = dml21_mode_check_and_programming(in_dc, context, dml_ctx);
 
-       DC_FP_END();
-
        return out;
 }