Commit afe9555e authored by Alex Deucher's avatar Alex Deucher
Browse files

drm/amd/display: use pre-allocated temp structure for bounding box



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: 88c61827 ("drm/amd/display: dynamically allocate dml2_configuration_options structures")
Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
Tested-by: George Zhang <George.zhang@amd.com> (v1)
Suggested-by: default avatarHamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Cc: George Zhang <george.zhang@amd.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: harry.wentland@amd.com
Cc: sunpeng.li@amd.com
Cc: Rodrigo.Siqueira@amd.com
parent faa64f63
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1445,6 +1445,7 @@ struct dc {
	} scratch;

	struct dml2_configuration_options dml2_options;
	struct dml2_configuration_options dml2_tmp;
	enum dc_acpi_cm_power_state power_state;

};
+2 −6
Original line number Diff line number Diff line
@@ -2011,11 +2011,9 @@ void dcn32_calculate_wm_and_dlg(struct dc *dc, struct dc_state *context,

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

	dml2_opt = kmemdup(&dc->dml2_options, sizeof(dc->dml2_options), GFP_KERNEL);
	if (!dml2_opt)
		return;
	memcpy(dml2_opt, &dc->dml2_options, sizeof(dc->dml2_options));

	DC_FP_START();

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

	DC_FP_END();

	kfree(dml2_opt);
}

static struct resource_funcs dcn32_res_pool_funcs = {
+2 −6
Original line number Diff line number Diff line
@@ -1581,11 +1581,9 @@ static struct dc_cap_funcs cap_funcs = {

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

	dml2_opt = kmemdup(&dc->dml2_options, sizeof(dc->dml2_options), GFP_KERNEL);
	if (!dml2_opt)
		return;
	memcpy(dml2_opt, &dc->dml2_options, sizeof(dc->dml2_options));

	DC_FP_START();

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

	DC_FP_END();

	kfree(dml2_opt);
}

static struct resource_funcs dcn321_res_pool_funcs = {