Skip to content

Commit 23f5e18

Browse files
alexdeuchergregkh
authored andcommitted
drm/amd/display: use pre-allocated temp structure for bounding box
[ Upstream commit afe9555 ] This mirrors what the driver does for older DCN generations. Should fix: BUG: sleeping function called from invalid context at include/linux/sched/mm.h:306 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 449, name: kworker/u64:8 preempt_count: 2, expected: 0 RCU nest depth: 0, expected: 0 Preemption disabled at: ffffffffc0ce1580>] dc_fpu_begin+0x30/0xd0 [amdgpu] CPU: 5 PID: 449 Comm: kworker/u64:8 Tainted: G W 6.8.0+ #35 Hardware name: System manufacturer System Product Name/ROG STRIX X570-E GAMING WIFI II, BIOS 4204 02/24/2022 Workqueue: events_unbound async_run_entry_fn v2: drop extra memcpy Fixes: 88c6182 ("drm/amd/display: dynamically allocate dml2_configuration_options structures") Reviewed-by: Harry Wentland <[email protected]> Tested-by: George Zhang <[email protected]> (v1) Suggested-by: Hamza Mahfooz <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: George Zhang <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent 898d200 commit 23f5e18

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

drivers/gpu/drm/amd/display/dc/dc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,6 +1392,7 @@ struct dc {
13921392
} scratch;
13931393

13941394
struct dml2_configuration_options dml2_options;
1395+
struct dml2_configuration_options dml2_tmp;
13951396
enum dc_acpi_cm_power_state power_state;
13961397

13971398
};

drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2006,11 +2006,9 @@ void dcn32_calculate_wm_and_dlg(struct dc *dc, struct dc_state *context,
20062006

20072007
static void dcn32_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_params)
20082008
{
2009-
struct dml2_configuration_options *dml2_opt;
2009+
struct dml2_configuration_options *dml2_opt = &dc->dml2_tmp;
20102010

2011-
dml2_opt = kmemdup(&dc->dml2_options, sizeof(dc->dml2_options), GFP_KERNEL);
2012-
if (!dml2_opt)
2013-
return;
2011+
memcpy(dml2_opt, &dc->dml2_options, sizeof(dc->dml2_options));
20142012

20152013
DC_FP_START();
20162014

@@ -2025,8 +2023,6 @@ static void dcn32_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw
20252023
dml2_reinit(dc, dml2_opt, &dc->current_state->bw_ctx.dml2_dc_power_source);
20262024

20272025
DC_FP_END();
2028-
2029-
kfree(dml2_opt);
20302026
}
20312027

20322028
static struct resource_funcs dcn32_res_pool_funcs = {

drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,11 +1581,9 @@ static struct dc_cap_funcs cap_funcs = {
15811581

15821582
static void dcn321_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_params)
15831583
{
1584-
struct dml2_configuration_options *dml2_opt;
1584+
struct dml2_configuration_options *dml2_opt = &dc->dml2_tmp;
15851585

1586-
dml2_opt = kmemdup(&dc->dml2_options, sizeof(dc->dml2_options), GFP_KERNEL);
1587-
if (!dml2_opt)
1588-
return;
1586+
memcpy(dml2_opt, &dc->dml2_options, sizeof(dc->dml2_options));
15891587

15901588
DC_FP_START();
15911589

@@ -1600,8 +1598,6 @@ static void dcn321_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *b
16001598
dml2_reinit(dc, dml2_opt, &dc->current_state->bw_ctx.dml2_dc_power_source);
16011599

16021600
DC_FP_END();
1603-
1604-
kfree(dml2_opt);
16051601
}
16061602

16071603
static struct resource_funcs dcn321_res_pool_funcs = {

0 commit comments

Comments
 (0)