[AMD Official Use Only - AMD Internal Distribution Only]

Hi Alex,

I'll a hunk for fixing DCN401 as well to this and resend it later today.


--

Regards,
Jay
________________________________
From: amd-gfx <[email protected]> on behalf of Zhang, 
George <[email protected]>
Sent: Tuesday, June 4, 2024 12:49 PM
To: Deucher, Alexander <[email protected]>; 
[email protected] <[email protected]>
Cc: Mahfooz, Hamza <[email protected]>; Arnd Bergmann <[email protected]>; 
Wentland, Harry <[email protected]>; Li, Sun peng (Leo) 
<[email protected]>; Siqueira, Rodrigo <[email protected]>
Subject: RE: [PATCH] drm/amd/display: use pre-allocated temp structure for 
bounding box

[AMD Official Use Only - AMD Internal Distribution Only]

[AMD Official Use Only - AMD Internal Distribution Only]

Tested-by: George Zhang <[email protected]>

Thanks,
George
-----Original Message-----
From: Deucher, Alexander <[email protected]>
Sent: Tuesday, June 4, 2024 11:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Mahfooz, Hamza 
<[email protected]>; Zhang, George <[email protected]>; Arnd Bergmann 
<[email protected]>; Wentland, Harry <[email protected]>; Li, Sun peng (Leo) 
<[email protected]>; Siqueira, Rodrigo <[email protected]>
Subject: [PATCH] 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

Fixes: 88c61827cedc ("drm/amd/display: dynamically allocate 
dml2_configuration_options structures")
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]
---
 drivers/gpu/drm/amd/display/dc/dc.h                       | 1 +
 .../drm/amd/display/dc/resource/dcn32/dcn32_resource.c    | 8 +++-----
 .../drm/amd/display/dc/resource/dcn321/dcn321_resource.c  | 8 +++-----
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dc.h 
b/drivers/gpu/drm/amd/display/dc/dc.h
index d0ed01ac460d..d843933ad731 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -1444,6 +1444,7 @@ struct dc {
        } scratch;

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

 };
diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c 
b/drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c
index 0f11d7c8791c..7a8aa9396dea 100644
--- a/drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c
@@ -2007,11 +2007,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();

@@ -2027,7 +2025,7 @@ static void dcn32_update_bw_bounding_box(struct dc *dc, 
struct clk_bw_params *bw

        DC_FP_END();

-       kfree(dml2_opt);
+       memcpy(&dc->dml2_options, dml2_opt, sizeof(dc->dml2_options));
 }

 static struct resource_funcs dcn32_res_pool_funcs = {
diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c 
b/drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c
index 07ca6f58447d..ef30e8632607 100644
--- a/drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c
@@ -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();

@@ -1601,7 +1599,7 @@ static void dcn321_update_bw_bounding_box(struct dc *dc, 
struct clk_bw_params *b

        DC_FP_END();

-       kfree(dml2_opt);
+       memcpy(&dc->dml2_options, dml2_opt, sizeof(dc->dml2_options));
 }

 static struct resource_funcs dcn321_res_pool_funcs = {
--
2.45.1

Reply via email to