It's a part of the upstream commit e56e3cff2a1b ("drm/amd/display: Sync
dcn42 with DC 3.2.373") needed for the following backports moving FPU
guards from DML to DC.

Signed-off-by: Xi Ruoyao <[email protected]>
---
 .../amd/display/dc/dml2_0/dml21/dml21_wrapper.c    | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper.c 
b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper.c
index 96c62bd6a37b..2623e917ec28 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper.c
@@ -9,16 +9,21 @@
 #include "dml21_utils.h"
 #include "dml21_translation_helper.h"
 #include "dml2_dc_resource_mgmt.h"
+#include "dc_fpu.h"
+
+#if !defined(DC_RUN_WITH_PREEMPTION_ENABLED)
+#define DC_RUN_WITH_PREEMPTION_ENABLED(code) code
+#endif // !DC_RUN_WITH_PREEMPTION_ENABLED
 
 #define INVALID -1
 
 static bool dml21_allocate_memory(struct dml2_context **dml_ctx)
 {
-       *dml_ctx = vzalloc(sizeof(struct dml2_context));
+       DC_RUN_WITH_PREEMPTION_ENABLED(*dml_ctx = vzalloc(sizeof(struct 
dml2_context)));
        if (!(*dml_ctx))
                return false;
 
-       (*dml_ctx)->v21.dml_init.dml2_instance = vzalloc(sizeof(struct 
dml2_instance));
+       DC_RUN_WITH_PREEMPTION_ENABLED((*dml_ctx)->v21.dml_init.dml2_instance = 
vzalloc(sizeof(struct dml2_instance)));
        if (!((*dml_ctx)->v21.dml_init.dml2_instance))
                return false;
 
@@ -28,7 +33,7 @@ static bool dml21_allocate_memory(struct dml2_context 
**dml_ctx)
        (*dml_ctx)->v21.mode_support.display_config = 
&(*dml_ctx)->v21.display_config;
        (*dml_ctx)->v21.mode_programming.display_config = 
(*dml_ctx)->v21.mode_support.display_config;
 
-       (*dml_ctx)->v21.mode_programming.programming = vzalloc(sizeof(struct 
dml2_display_cfg_programming));
+       
DC_RUN_WITH_PREEMPTION_ENABLED((*dml_ctx)->v21.mode_programming.programming = 
vzalloc(sizeof(struct dml2_display_cfg_programming)));
        if (!((*dml_ctx)->v21.mode_programming.programming))
                return false;
 
@@ -70,8 +75,9 @@ static void dml21_init(const struct dc *in_dc, struct 
dml2_context *dml_ctx, con
 bool dml21_create(const struct dc *in_dc, struct dml2_context **dml_ctx, const 
struct dml2_configuration_options *config)
 {
        /* Allocate memory for initializing DML21 instance */
-       if (!dml21_allocate_memory(dml_ctx))
+       if (!dml21_allocate_memory(dml_ctx)) {
                return false;
+       }
 
        dml21_init(in_dc, *dml_ctx, config);
 
-- 
2.54.0

Reply via email to