Skip to content

Commit 919c835

Browse files
Aurabindo Pillaialexdeucher
authored andcommitted
drm/amd/display: Fix GFP_ATOMIC abuse
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>
1 parent 6588766 commit 919c835

6 files changed

Lines changed: 33 additions & 37 deletions

File tree

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10592,7 +10592,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
1059210592
* Here we create an empty update on each plane.
1059310593
* To fix this, DC should permit updating only stream properties.
1059410594
*/
10595-
dummy_updates = kzalloc(sizeof(struct dc_surface_update) * MAX_SURFACES, GFP_ATOMIC);
10595+
dummy_updates = kzalloc(sizeof(struct dc_surface_update) * MAX_SURFACES, GFP_KERNEL);
1059610596
if (!dummy_updates) {
1059710597
drm_err(adev_to_drm(adev), "Failed to allocate memory for dummy_updates.\n");
1059810598
continue;

drivers/gpu/drm/amd/display/dc/dccg/dcn20/dcn20_dccg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ struct dccg *dccg2_create(
148148
const struct dccg_shift *dccg_shift,
149149
const struct dccg_mask *dccg_mask)
150150
{
151-
struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_ATOMIC);
151+
struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL);
152152
struct dccg *base;
153153

154154
if (dccg_dcn == NULL) {

drivers/gpu/drm/amd/display/dc/dce/dce_abm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ struct abm *dce_abm_create(
283283
const struct dce_abm_shift *abm_shift,
284284
const struct dce_abm_mask *abm_mask)
285285
{
286-
struct dce_abm *abm_dce = kzalloc(sizeof(*abm_dce), GFP_ATOMIC);
286+
struct dce_abm *abm_dce = kzalloc(sizeof(*abm_dce), GFP_KERNEL);
287287

288288
if (abm_dce == NULL) {
289289
BREAK_TO_DEBUGGER();

drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ struct dmcu *dcn10_dmcu_create(
11261126
const struct dce_dmcu_shift *dmcu_shift,
11271127
const struct dce_dmcu_mask *dmcu_mask)
11281128
{
1129-
struct dce_dmcu *dmcu_dce = kzalloc(sizeof(*dmcu_dce), GFP_ATOMIC);
1129+
struct dce_dmcu *dmcu_dce = kzalloc(sizeof(*dmcu_dce), GFP_KERNEL);
11301130

11311131
if (dmcu_dce == NULL) {
11321132
BREAK_TO_DEBUGGER();
@@ -1147,7 +1147,7 @@ struct dmcu *dcn20_dmcu_create(
11471147
const struct dce_dmcu_shift *dmcu_shift,
11481148
const struct dce_dmcu_mask *dmcu_mask)
11491149
{
1150-
struct dce_dmcu *dmcu_dce = kzalloc(sizeof(*dmcu_dce), GFP_ATOMIC);
1150+
struct dce_dmcu *dmcu_dce = kzalloc(sizeof(*dmcu_dce), GFP_KERNEL);
11511151

11521152
if (dmcu_dce == NULL) {
11531153
BREAK_TO_DEBUGGER();
@@ -1168,7 +1168,7 @@ struct dmcu *dcn21_dmcu_create(
11681168
const struct dce_dmcu_shift *dmcu_shift,
11691169
const struct dce_dmcu_mask *dmcu_mask)
11701170
{
1171-
struct dce_dmcu *dmcu_dce = kzalloc(sizeof(*dmcu_dce), GFP_ATOMIC);
1171+
struct dce_dmcu *dmcu_dce = kzalloc(sizeof(*dmcu_dce), GFP_KERNEL);
11721172

11731173
if (dmcu_dce == NULL) {
11741174
BREAK_TO_DEBUGGER();

drivers/gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ struct dpp *dcn20_dpp_create(
733733
uint32_t inst)
734734
{
735735
struct dcn20_dpp *dpp =
736-
kzalloc(sizeof(struct dcn20_dpp), GFP_ATOMIC);
736+
kzalloc(sizeof(struct dcn20_dpp), GFP_KERNEL);
737737

738738
if (!dpp)
739739
return NULL;
@@ -751,7 +751,7 @@ struct input_pixel_processor *dcn20_ipp_create(
751751
struct dc_context *ctx, uint32_t inst)
752752
{
753753
struct dcn10_ipp *ipp =
754-
kzalloc(sizeof(struct dcn10_ipp), GFP_ATOMIC);
754+
kzalloc(sizeof(struct dcn10_ipp), GFP_KERNEL);
755755

756756
if (!ipp) {
757757
BREAK_TO_DEBUGGER();
@@ -768,7 +768,7 @@ struct output_pixel_processor *dcn20_opp_create(
768768
struct dc_context *ctx, uint32_t inst)
769769
{
770770
struct dcn20_opp *opp =
771-
kzalloc(sizeof(struct dcn20_opp), GFP_ATOMIC);
771+
kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL);
772772

773773
if (!opp) {
774774
BREAK_TO_DEBUGGER();
@@ -785,7 +785,7 @@ struct dce_aux *dcn20_aux_engine_create(
785785
uint32_t inst)
786786
{
787787
struct aux_engine_dce110 *aux_engine =
788-
kzalloc(sizeof(struct aux_engine_dce110), GFP_ATOMIC);
788+
kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL);
789789

790790
if (!aux_engine)
791791
return NULL;
@@ -823,7 +823,7 @@ struct dce_i2c_hw *dcn20_i2c_hw_create(
823823
uint32_t inst)
824824
{
825825
struct dce_i2c_hw *dce_i2c_hw =
826-
kzalloc(sizeof(struct dce_i2c_hw), GFP_ATOMIC);
826+
kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL);
827827

828828
if (!dce_i2c_hw)
829829
return NULL;
@@ -835,8 +835,7 @@ struct dce_i2c_hw *dcn20_i2c_hw_create(
835835
}
836836
struct mpc *dcn20_mpc_create(struct dc_context *ctx)
837837
{
838-
struct dcn20_mpc *mpc20 = kzalloc(sizeof(struct dcn20_mpc),
839-
GFP_ATOMIC);
838+
struct dcn20_mpc *mpc20 = kzalloc(sizeof(struct dcn20_mpc), GFP_KERNEL);
840839

841840
if (!mpc20)
842841
return NULL;
@@ -853,8 +852,7 @@ struct mpc *dcn20_mpc_create(struct dc_context *ctx)
853852
struct hubbub *dcn20_hubbub_create(struct dc_context *ctx)
854853
{
855854
int i;
856-
struct dcn20_hubbub *hubbub = kzalloc(sizeof(struct dcn20_hubbub),
857-
GFP_ATOMIC);
855+
struct dcn20_hubbub *hubbub = kzalloc(sizeof(struct dcn20_hubbub), GFP_KERNEL);
858856

859857
if (!hubbub)
860858
return NULL;
@@ -882,7 +880,7 @@ struct timing_generator *dcn20_timing_generator_create(
882880
uint32_t instance)
883881
{
884882
struct optc *tgn10 =
885-
kzalloc(sizeof(struct optc), GFP_ATOMIC);
883+
kzalloc(sizeof(struct optc), GFP_KERNEL);
886884

887885
if (!tgn10)
888886
return NULL;
@@ -962,7 +960,7 @@ static struct clock_source *dcn20_clock_source_create(
962960
bool dp_clk_src)
963961
{
964962
struct dce110_clk_src *clk_src =
965-
kzalloc(sizeof(struct dce110_clk_src), GFP_ATOMIC);
963+
kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
966964

967965
if (!clk_src)
968966
return NULL;
@@ -1061,7 +1059,7 @@ struct display_stream_compressor *dcn20_dsc_create(
10611059
struct dc_context *ctx, uint32_t inst)
10621060
{
10631061
struct dcn20_dsc *dsc =
1064-
kzalloc(sizeof(struct dcn20_dsc), GFP_ATOMIC);
1062+
kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL);
10651063

10661064
if (!dsc) {
10671065
BREAK_TO_DEBUGGER();
@@ -1198,7 +1196,7 @@ struct hubp *dcn20_hubp_create(
11981196
uint32_t inst)
11991197
{
12001198
struct dcn20_hubp *hubp2 =
1201-
kzalloc(sizeof(struct dcn20_hubp), GFP_ATOMIC);
1199+
kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL);
12021200

12031201
if (!hubp2)
12041202
return NULL;
@@ -2287,7 +2285,7 @@ bool dcn20_mmhubbub_create(struct dc_context *ctx, struct resource_pool *pool)
22872285

22882286
static struct pp_smu_funcs *dcn20_pp_smu_create(struct dc_context *ctx)
22892287
{
2290-
struct pp_smu_funcs *pp_smu = kzalloc(sizeof(*pp_smu), GFP_ATOMIC);
2288+
struct pp_smu_funcs *pp_smu = kzalloc(sizeof(*pp_smu), GFP_KERNEL);
22912289

22922290
if (!pp_smu)
22932291
return pp_smu;
@@ -2766,7 +2764,7 @@ struct resource_pool *dcn20_create_resource_pool(
27662764
struct dc *dc)
27672765
{
27682766
struct dcn20_resource_pool *pool =
2769-
kzalloc(sizeof(struct dcn20_resource_pool), GFP_ATOMIC);
2767+
kzalloc(sizeof(struct dcn20_resource_pool), GFP_KERNEL);
27702768

27712769
if (!pool)
27722770
return NULL;

drivers/gpu/drm/amd/display/dc/resource/dcn201/dcn201_resource.c

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ static struct dpp *dcn201_dpp_create(
629629
uint32_t inst)
630630
{
631631
struct dcn201_dpp *dpp =
632-
kzalloc(sizeof(struct dcn201_dpp), GFP_ATOMIC);
632+
kzalloc(sizeof(struct dcn201_dpp), GFP_KERNEL);
633633

634634
if (!dpp)
635635
return NULL;
@@ -646,7 +646,7 @@ static struct input_pixel_processor *dcn201_ipp_create(
646646
struct dc_context *ctx, uint32_t inst)
647647
{
648648
struct dcn10_ipp *ipp =
649-
kzalloc(sizeof(struct dcn10_ipp), GFP_ATOMIC);
649+
kzalloc(sizeof(struct dcn10_ipp), GFP_KERNEL);
650650

651651
if (!ipp) {
652652
return NULL;
@@ -662,7 +662,7 @@ static struct output_pixel_processor *dcn201_opp_create(
662662
struct dc_context *ctx, uint32_t inst)
663663
{
664664
struct dcn201_opp *opp =
665-
kzalloc(sizeof(struct dcn201_opp), GFP_ATOMIC);
665+
kzalloc(sizeof(struct dcn201_opp), GFP_KERNEL);
666666

667667
if (!opp) {
668668
return NULL;
@@ -677,7 +677,7 @@ static struct dce_aux *dcn201_aux_engine_create(struct dc_context *ctx,
677677
uint32_t inst)
678678
{
679679
struct aux_engine_dce110 *aux_engine =
680-
kzalloc(sizeof(struct aux_engine_dce110), GFP_ATOMIC);
680+
kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL);
681681

682682
if (!aux_engine)
683683
return NULL;
@@ -710,7 +710,7 @@ static struct dce_i2c_hw *dcn201_i2c_hw_create(struct dc_context *ctx,
710710
uint32_t inst)
711711
{
712712
struct dce_i2c_hw *dce_i2c_hw =
713-
kzalloc(sizeof(struct dce_i2c_hw), GFP_ATOMIC);
713+
kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL);
714714

715715
if (!dce_i2c_hw)
716716
return NULL;
@@ -723,8 +723,7 @@ static struct dce_i2c_hw *dcn201_i2c_hw_create(struct dc_context *ctx,
723723

724724
static struct mpc *dcn201_mpc_create(struct dc_context *ctx, uint32_t num_mpcc)
725725
{
726-
struct dcn201_mpc *mpc201 = kzalloc(sizeof(struct dcn201_mpc),
727-
GFP_ATOMIC);
726+
struct dcn201_mpc *mpc201 = kzalloc(sizeof(struct dcn201_mpc), GFP_KERNEL);
728727

729728
if (!mpc201)
730729
return NULL;
@@ -740,8 +739,7 @@ static struct mpc *dcn201_mpc_create(struct dc_context *ctx, uint32_t num_mpcc)
740739

741740
static struct hubbub *dcn201_hubbub_create(struct dc_context *ctx)
742741
{
743-
struct dcn20_hubbub *hubbub = kzalloc(sizeof(struct dcn20_hubbub),
744-
GFP_ATOMIC);
742+
struct dcn20_hubbub *hubbub = kzalloc(sizeof(struct dcn20_hubbub), GFP_KERNEL);
745743

746744
if (!hubbub)
747745
return NULL;
@@ -759,7 +757,7 @@ static struct timing_generator *dcn201_timing_generator_create(
759757
uint32_t instance)
760758
{
761759
struct optc *tgn10 =
762-
kzalloc(sizeof(struct optc), GFP_ATOMIC);
760+
kzalloc(sizeof(struct optc), GFP_KERNEL);
763761

764762
if (!tgn10)
765763
return NULL;
@@ -793,7 +791,7 @@ static struct link_encoder *dcn201_link_encoder_create(
793791
const struct encoder_init_data *enc_init_data)
794792
{
795793
struct dcn20_link_encoder *enc20 =
796-
kzalloc(sizeof(struct dcn20_link_encoder), GFP_ATOMIC);
794+
kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);
797795
struct dcn10_link_encoder *enc10;
798796

799797
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(
821819
bool dp_clk_src)
822820
{
823821
struct dce110_clk_src *clk_src =
824-
kzalloc(sizeof(struct dce110_clk_src), GFP_ATOMIC);
822+
kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
825823

826824
if (!clk_src)
827825
return NULL;
@@ -856,7 +854,7 @@ static struct stream_encoder *dcn201_stream_encoder_create(
856854
struct dc_context *ctx)
857855
{
858856
struct dcn10_stream_encoder *enc1 =
859-
kzalloc(sizeof(struct dcn10_stream_encoder), GFP_ATOMIC);
857+
kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL);
860858

861859
if (!enc1)
862860
return NULL;
@@ -883,7 +881,7 @@ static const struct dce_hwseq_mask hwseq_mask = {
883881
static struct dce_hwseq *dcn201_hwseq_create(
884882
struct dc_context *ctx)
885883
{
886-
struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_ATOMIC);
884+
struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);
887885

888886
if (hws) {
889887
hws->ctx = ctx;
@@ -983,7 +981,7 @@ static struct hubp *dcn201_hubp_create(
983981
uint32_t inst)
984982
{
985983
struct dcn201_hubp *hubp201 =
986-
kzalloc(sizeof(struct dcn201_hubp), GFP_ATOMIC);
984+
kzalloc(sizeof(struct dcn201_hubp), GFP_KERNEL);
987985

988986
if (!hubp201)
989987
return NULL;
@@ -1303,7 +1301,7 @@ struct resource_pool *dcn201_create_resource_pool(
13031301
struct dc *dc)
13041302
{
13051303
struct dcn201_resource_pool *pool =
1306-
kzalloc(sizeof(struct dcn201_resource_pool), GFP_ATOMIC);
1304+
kzalloc(sizeof(struct dcn201_resource_pool), GFP_KERNEL);
13071305

13081306
if (!pool)
13091307
return NULL;

0 commit comments

Comments
 (0)