]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/display: Fix GFP_ATOMIC abuse
authorAurabindo Pillai <aurabindo.pillai@amd.com>
Fri, 3 Oct 2025 20:06:53 +0000 (16:06 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 20 Oct 2025 22:26:08 +0000 (18:26 -0400)
There is a lot GFP_ATOMIC allocations which are not in interrupt
context. Change them to use GFP_KERNEL instead.

Reviewed-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/dc/dccg/dcn20/dcn20_dccg.c
drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c
drivers/gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c
drivers/gpu/drm/amd/display/dc/resource/dcn201/dcn201_resource.c

index 3ea17a3d307d22817d5a0f5a217f09b2bd2e7561..e3be2620f959c9180f420bf888f9a939b9c18175 100644 (file)
@@ -10592,7 +10592,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
                 * Here we create an empty update on each plane.
                 * To fix this, DC should permit updating only stream properties.
                 */
-               dummy_updates = kzalloc(sizeof(struct dc_surface_update) * MAX_SURFACES, GFP_ATOMIC);
+               dummy_updates = kzalloc(sizeof(struct dc_surface_update) * MAX_SURFACES, GFP_KERNEL);
                if (!dummy_updates) {
                        drm_err(adev_to_drm(adev), "Failed to allocate memory for dummy_updates.\n");
                        continue;
index 5999b2da3a018b1984e27c60657c4a463036ca2e..33d8bd91cb014102695a18bbefeb2aec8b9ea2e8 100644 (file)
@@ -148,7 +148,7 @@ struct dccg *dccg2_create(
        const struct dccg_shift *dccg_shift,
        const struct dccg_mask *dccg_mask)
 {
-       struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_ATOMIC);
+       struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL);
        struct dccg *base;
 
        if (dccg_dcn == NULL) {
index a6006776333d12f2da868c9699a1dd350ed803d5..2dcf394edf2233f9f696ac081c865e73af8bbdbd 100644 (file)
@@ -283,7 +283,7 @@ struct abm *dce_abm_create(
        const struct dce_abm_shift *abm_shift,
        const struct dce_abm_mask *abm_mask)
 {
-       struct dce_abm *abm_dce = kzalloc(sizeof(*abm_dce), GFP_ATOMIC);
+       struct dce_abm *abm_dce = kzalloc(sizeof(*abm_dce), GFP_KERNEL);
 
        if (abm_dce == NULL) {
                BREAK_TO_DEBUGGER();
index a8e79104b684ea973939439d9ff50a54d9dbe619..5f8fba45d98db2ec38ff76956e8a4ecfcf985721 100644 (file)
@@ -1126,7 +1126,7 @@ struct dmcu *dcn10_dmcu_create(
        const struct dce_dmcu_shift *dmcu_shift,
        const struct dce_dmcu_mask *dmcu_mask)
 {
-       struct dce_dmcu *dmcu_dce = kzalloc(sizeof(*dmcu_dce), GFP_ATOMIC);
+       struct dce_dmcu *dmcu_dce = kzalloc(sizeof(*dmcu_dce), GFP_KERNEL);
 
        if (dmcu_dce == NULL) {
                BREAK_TO_DEBUGGER();
@@ -1147,7 +1147,7 @@ struct dmcu *dcn20_dmcu_create(
        const struct dce_dmcu_shift *dmcu_shift,
        const struct dce_dmcu_mask *dmcu_mask)
 {
-       struct dce_dmcu *dmcu_dce = kzalloc(sizeof(*dmcu_dce), GFP_ATOMIC);
+       struct dce_dmcu *dmcu_dce = kzalloc(sizeof(*dmcu_dce), GFP_KERNEL);
 
        if (dmcu_dce == NULL) {
                BREAK_TO_DEBUGGER();
@@ -1168,7 +1168,7 @@ struct dmcu *dcn21_dmcu_create(
        const struct dce_dmcu_shift *dmcu_shift,
        const struct dce_dmcu_mask *dmcu_mask)
 {
-       struct dce_dmcu *dmcu_dce = kzalloc(sizeof(*dmcu_dce), GFP_ATOMIC);
+       struct dce_dmcu *dmcu_dce = kzalloc(sizeof(*dmcu_dce), GFP_KERNEL);
 
        if (dmcu_dce == NULL) {
                BREAK_TO_DEBUGGER();
index f4d3ff79717fe03e39c1c7fae7d850a8da0ccaa5..30f155dc54e541360b291698e95eb61ee5002f11 100644 (file)
@@ -733,7 +733,7 @@ struct dpp *dcn20_dpp_create(
        uint32_t inst)
 {
        struct dcn20_dpp *dpp =
-               kzalloc(sizeof(struct dcn20_dpp), GFP_ATOMIC);
+               kzalloc(sizeof(struct dcn20_dpp), GFP_KERNEL);
 
        if (!dpp)
                return NULL;
@@ -751,7 +751,7 @@ struct input_pixel_processor *dcn20_ipp_create(
        struct dc_context *ctx, uint32_t inst)
 {
        struct dcn10_ipp *ipp =
-               kzalloc(sizeof(struct dcn10_ipp), GFP_ATOMIC);
+               kzalloc(sizeof(struct dcn10_ipp), GFP_KERNEL);
 
        if (!ipp) {
                BREAK_TO_DEBUGGER();
@@ -768,7 +768,7 @@ struct output_pixel_processor *dcn20_opp_create(
        struct dc_context *ctx, uint32_t inst)
 {
        struct dcn20_opp *opp =
-               kzalloc(sizeof(struct dcn20_opp), GFP_ATOMIC);
+               kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL);
 
        if (!opp) {
                BREAK_TO_DEBUGGER();
@@ -785,7 +785,7 @@ struct dce_aux *dcn20_aux_engine_create(
        uint32_t inst)
 {
        struct aux_engine_dce110 *aux_engine =
-               kzalloc(sizeof(struct aux_engine_dce110), GFP_ATOMIC);
+               kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL);
 
        if (!aux_engine)
                return NULL;
@@ -823,7 +823,7 @@ struct dce_i2c_hw *dcn20_i2c_hw_create(
        uint32_t inst)
 {
        struct dce_i2c_hw *dce_i2c_hw =
-               kzalloc(sizeof(struct dce_i2c_hw), GFP_ATOMIC);
+               kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL);
 
        if (!dce_i2c_hw)
                return NULL;
@@ -835,8 +835,7 @@ struct dce_i2c_hw *dcn20_i2c_hw_create(
 }
 struct mpc *dcn20_mpc_create(struct dc_context *ctx)
 {
-       struct dcn20_mpc *mpc20 = kzalloc(sizeof(struct dcn20_mpc),
-                                         GFP_ATOMIC);
+       struct dcn20_mpc *mpc20 = kzalloc(sizeof(struct dcn20_mpc), GFP_KERNEL);
 
        if (!mpc20)
                return NULL;
@@ -853,8 +852,7 @@ struct mpc *dcn20_mpc_create(struct dc_context *ctx)
 struct hubbub *dcn20_hubbub_create(struct dc_context *ctx)
 {
        int i;
-       struct dcn20_hubbub *hubbub = kzalloc(sizeof(struct dcn20_hubbub),
-                                         GFP_ATOMIC);
+       struct dcn20_hubbub *hubbub = kzalloc(sizeof(struct dcn20_hubbub), GFP_KERNEL);
 
        if (!hubbub)
                return NULL;
@@ -882,7 +880,7 @@ struct timing_generator *dcn20_timing_generator_create(
                uint32_t instance)
 {
        struct optc *tgn10 =
-               kzalloc(sizeof(struct optc), GFP_ATOMIC);
+               kzalloc(sizeof(struct optc), GFP_KERNEL);
 
        if (!tgn10)
                return NULL;
@@ -962,7 +960,7 @@ static struct clock_source *dcn20_clock_source_create(
        bool dp_clk_src)
 {
        struct dce110_clk_src *clk_src =
-               kzalloc(sizeof(struct dce110_clk_src), GFP_ATOMIC);
+               kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
 
        if (!clk_src)
                return NULL;
@@ -1061,7 +1059,7 @@ struct display_stream_compressor *dcn20_dsc_create(
        struct dc_context *ctx, uint32_t inst)
 {
        struct dcn20_dsc *dsc =
-               kzalloc(sizeof(struct dcn20_dsc), GFP_ATOMIC);
+               kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL);
 
        if (!dsc) {
                BREAK_TO_DEBUGGER();
@@ -1198,7 +1196,7 @@ struct hubp *dcn20_hubp_create(
        uint32_t inst)
 {
        struct dcn20_hubp *hubp2 =
-               kzalloc(sizeof(struct dcn20_hubp), GFP_ATOMIC);
+               kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL);
 
        if (!hubp2)
                return NULL;
@@ -2287,7 +2285,7 @@ bool dcn20_mmhubbub_create(struct dc_context *ctx, struct resource_pool *pool)
 
 static struct pp_smu_funcs *dcn20_pp_smu_create(struct dc_context *ctx)
 {
-       struct pp_smu_funcs *pp_smu = kzalloc(sizeof(*pp_smu), GFP_ATOMIC);
+       struct pp_smu_funcs *pp_smu = kzalloc(sizeof(*pp_smu), GFP_KERNEL);
 
        if (!pp_smu)
                return pp_smu;
@@ -2766,7 +2764,7 @@ struct resource_pool *dcn20_create_resource_pool(
                struct dc *dc)
 {
        struct dcn20_resource_pool *pool =
-               kzalloc(sizeof(struct dcn20_resource_pool), GFP_ATOMIC);
+               kzalloc(sizeof(struct dcn20_resource_pool), GFP_KERNEL);
 
        if (!pool)
                return NULL;
index e4a1338d21e012278db66467e06fae0daedc7267..9a80bebcee48577ac41c35236175e26d0668522e 100644 (file)
@@ -629,7 +629,7 @@ static struct dpp *dcn201_dpp_create(
        uint32_t inst)
 {
        struct dcn201_dpp *dpp =
-               kzalloc(sizeof(struct dcn201_dpp), GFP_ATOMIC);
+               kzalloc(sizeof(struct dcn201_dpp), GFP_KERNEL);
 
        if (!dpp)
                return NULL;
@@ -646,7 +646,7 @@ static struct input_pixel_processor *dcn201_ipp_create(
        struct dc_context *ctx, uint32_t inst)
 {
        struct dcn10_ipp *ipp =
-               kzalloc(sizeof(struct dcn10_ipp), GFP_ATOMIC);
+               kzalloc(sizeof(struct dcn10_ipp), GFP_KERNEL);
 
        if (!ipp) {
                return NULL;
@@ -662,7 +662,7 @@ static struct output_pixel_processor *dcn201_opp_create(
        struct dc_context *ctx, uint32_t inst)
 {
        struct dcn201_opp *opp =
-               kzalloc(sizeof(struct dcn201_opp), GFP_ATOMIC);
+               kzalloc(sizeof(struct dcn201_opp), GFP_KERNEL);
 
        if (!opp) {
                return NULL;
@@ -677,7 +677,7 @@ static struct dce_aux *dcn201_aux_engine_create(struct dc_context *ctx,
                                                uint32_t inst)
 {
        struct aux_engine_dce110 *aux_engine =
-               kzalloc(sizeof(struct aux_engine_dce110), GFP_ATOMIC);
+               kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL);
 
        if (!aux_engine)
                return NULL;
@@ -710,7 +710,7 @@ static struct dce_i2c_hw *dcn201_i2c_hw_create(struct dc_context *ctx,
                                               uint32_t inst)
 {
        struct dce_i2c_hw *dce_i2c_hw =
-               kzalloc(sizeof(struct dce_i2c_hw), GFP_ATOMIC);
+               kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL);
 
        if (!dce_i2c_hw)
                return NULL;
@@ -723,8 +723,7 @@ static struct dce_i2c_hw *dcn201_i2c_hw_create(struct dc_context *ctx,
 
 static struct mpc *dcn201_mpc_create(struct dc_context *ctx, uint32_t num_mpcc)
 {
-       struct dcn201_mpc *mpc201 = kzalloc(sizeof(struct dcn201_mpc),
-                                           GFP_ATOMIC);
+       struct dcn201_mpc *mpc201 = kzalloc(sizeof(struct dcn201_mpc), GFP_KERNEL);
 
        if (!mpc201)
                return NULL;
@@ -740,8 +739,7 @@ static struct mpc *dcn201_mpc_create(struct dc_context *ctx, uint32_t num_mpcc)
 
 static struct hubbub *dcn201_hubbub_create(struct dc_context *ctx)
 {
-       struct dcn20_hubbub *hubbub = kzalloc(sizeof(struct dcn20_hubbub),
-                                         GFP_ATOMIC);
+       struct dcn20_hubbub *hubbub = kzalloc(sizeof(struct dcn20_hubbub), GFP_KERNEL);
 
        if (!hubbub)
                return NULL;
@@ -759,7 +757,7 @@ static struct timing_generator *dcn201_timing_generator_create(
                uint32_t instance)
 {
        struct optc *tgn10 =
-               kzalloc(sizeof(struct optc), GFP_ATOMIC);
+               kzalloc(sizeof(struct optc), GFP_KERNEL);
 
        if (!tgn10)
                return NULL;
@@ -793,7 +791,7 @@ static struct link_encoder *dcn201_link_encoder_create(
        const struct encoder_init_data *enc_init_data)
 {
        struct dcn20_link_encoder *enc20 =
-               kzalloc(sizeof(struct dcn20_link_encoder), GFP_ATOMIC);
+               kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);
        struct dcn10_link_encoder *enc10;
 
        if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs))
@@ -821,7 +819,7 @@ static struct clock_source *dcn201_clock_source_create(
        bool dp_clk_src)
 {
        struct dce110_clk_src *clk_src =
-               kzalloc(sizeof(struct dce110_clk_src), GFP_ATOMIC);
+               kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
 
        if (!clk_src)
                return NULL;
@@ -856,7 +854,7 @@ static struct stream_encoder *dcn201_stream_encoder_create(
        struct dc_context *ctx)
 {
        struct dcn10_stream_encoder *enc1 =
-               kzalloc(sizeof(struct dcn10_stream_encoder), GFP_ATOMIC);
+               kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL);
 
        if (!enc1)
                return NULL;
@@ -883,7 +881,7 @@ static const struct dce_hwseq_mask hwseq_mask = {
 static struct dce_hwseq *dcn201_hwseq_create(
        struct dc_context *ctx)
 {
-       struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_ATOMIC);
+       struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);
 
        if (hws) {
                hws->ctx = ctx;
@@ -983,7 +981,7 @@ static struct hubp *dcn201_hubp_create(
        uint32_t inst)
 {
        struct dcn201_hubp *hubp201 =
-               kzalloc(sizeof(struct dcn201_hubp), GFP_ATOMIC);
+               kzalloc(sizeof(struct dcn201_hubp), GFP_KERNEL);
 
        if (!hubp201)
                return NULL;
@@ -1303,7 +1301,7 @@ struct resource_pool *dcn201_create_resource_pool(
                struct dc *dc)
 {
        struct dcn201_resource_pool *pool =
-               kzalloc(sizeof(struct dcn201_resource_pool), GFP_ATOMIC);
+               kzalloc(sizeof(struct dcn201_resource_pool), GFP_KERNEL);
 
        if (!pool)
                return NULL;