It was reported that on kernel v6.2-rc1, we have the following stack
size issue:

[...]/display/dc/dml/dcn314/display_mode_vba_314.c: In function
'UseMinimumDCFCLK':
[...]/display/dc/dml/dcn314/display_mode_vba_314.c:7127:1: error: the
frame size of 2208 bytes is larger than 2048 bytes
[-Werror=frame-larger-than=]

This commit replaces the local DCFCLKRequiredForPeakBandwidthPerPlane
from the same version in the UseMinimumDCFCLK_vars struct.

Cc: Alex Deucher <alexdeuc...@gmail.com>
Cc: Aurabindo Pillai <aurabindo.pil...@amd.com>
Cc: Hamza Mahfooz <hamza.mahf...@amd.com>
Cc: Roman Li <roman...@amd.com>
Cc: Geert Uytterhoeven <ge...@linux-m68k.org>
Link: https://lore.kernel.org/all/20221227082932.798359-1-ge...@linux-m68k.org/
Reported-by: Geert Uytterhoeven <ge...@linux-m68k.org>
Signed-off-by: Rodrigo Siqueira <rodrigo.sique...@amd.com>
---
 .../display/dc/dml/dcn314/display_mode_vba_314.c  | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c 
b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
index f51885d3dd2d..0811b18c22c3 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
@@ -6976,7 +6976,6 @@ static void UseMinimumDCFCLK(
        NormalEfficiency = 
v->PercentOfIdealFabricAndSDPPortBWReceivedAfterUrgLatency / 100.0;
        for (i = 0; i < v->soc.num_states; ++i) {
                for (j = 0; j <= 1; ++j) {
-                       double 
DCFCLKRequiredForPeakBandwidthPerPlane[DC__NUM_DPP__MAX];
                        double DynamicMetadataVMExtraLatency[DC__NUM_DPP__MAX];
                        double MinimumTWait;
                        double NonDPTEBandwidth;
@@ -7050,14 +7049,14 @@ static void UseMinimumDCFCLK(
 
                                        ExpectedVRatioPrefetch = 
v->UseMinimumDCFCLK_stack_reduction.PrefetchPixelLinesTime[k]
                                                        / (PrefetchTime * 
v->UseMinimumDCFCLK_stack_reduction.PixelDCFCLKCyclesRequiredInPrefetch[k] / 
DCFCLKCyclesRequiredInPrefetch);
-                                       
DCFCLKRequiredForPeakBandwidthPerPlane[k] = NoOfDPPState[k] * 
v->UseMinimumDCFCLK_stack_reduction.PixelDCFCLKCyclesRequiredInPrefetch[k] / 
v->UseMinimumDCFCLK_stack_reduction.PrefetchPixelLinesTime[k]
+                                       
v->UseMinimumDCFCLK_stack_reduction.DCFCLKRequiredForPeakBandwidthPerPlane[k] = 
NoOfDPPState[k] * 
v->UseMinimumDCFCLK_stack_reduction.PixelDCFCLKCyclesRequiredInPrefetch[k] / 
v->UseMinimumDCFCLK_stack_reduction.PrefetchPixelLinesTime[k]
                                                        * dml_max(1.0, 
ExpectedVRatioPrefetch) * dml_max(1.0, ExpectedVRatioPrefetch / 4) * 
ExpectedPrefetchBWAcceleration;
                                        if (v->HostVMEnable == true || 
v->ImmediateFlipRequirement[0] == dm_immediate_flip_required) {
-                                               
DCFCLKRequiredForPeakBandwidthPerPlane[k] = 
DCFCLKRequiredForPeakBandwidthPerPlane[k]
+                                               
v->UseMinimumDCFCLK_stack_reduction.DCFCLKRequiredForPeakBandwidthPerPlane[k] = 
v->UseMinimumDCFCLK_stack_reduction.DCFCLKRequiredForPeakBandwidthPerPlane[k]
                                                                + 
NoOfDPPState[k] * DPTEBandwidth / NormalEfficiency / NormalEfficiency / 
v->ReturnBusWidth;
                                        }
                                } else {
-                                       
DCFCLKRequiredForPeakBandwidthPerPlane[k] = v->DCFCLKPerState[i];
+                                       
v->UseMinimumDCFCLK_stack_reduction.DCFCLKRequiredForPeakBandwidthPerPlane[k] = 
v->DCFCLKPerState[i];
                                }
                                if (v->DynamicMetadataEnable[k] == true) {
                                        double TSetupPipe;
@@ -7088,17 +7087,17 @@ static void UseMinimumDCFCLK(
                                        AllowedTimeForUrgentExtraLatency = 
v->MaximumVStartup[i][j][k] * v->HTotal[k] / v->PixelClock[k] - MinimumTWait - 
TSetupPipe - TdmbfPipe - TdmecPipe
                                                        - TdmsksPipe - 
DynamicMetadataVMExtraLatency[k];
                                        if (AllowedTimeForUrgentExtraLatency > 
0) {
-                                               
DCFCLKRequiredForPeakBandwidthPerPlane[k] = dml_max(
-                                                               
DCFCLKRequiredForPeakBandwidthPerPlane[k],
+                                               
v->UseMinimumDCFCLK_stack_reduction.DCFCLKRequiredForPeakBandwidthPerPlane[k] = 
dml_max(
+                                                               
v->UseMinimumDCFCLK_stack_reduction.DCFCLKRequiredForPeakBandwidthPerPlane[k],
                                                                
ExtraLatencyCycles / AllowedTimeForUrgentExtraLatency);
                                        } else {
-                                               
DCFCLKRequiredForPeakBandwidthPerPlane[k] = v->DCFCLKPerState[i];
+                                               
v->UseMinimumDCFCLK_stack_reduction.DCFCLKRequiredForPeakBandwidthPerPlane[k] = 
v->DCFCLKPerState[i];
                                        }
                                }
                        }
                        DCFCLKRequiredForPeakBandwidth = 0;
                        for (k = 0; k <= v->NumberOfActivePlanes - 1; ++k)
-                               DCFCLKRequiredForPeakBandwidth = 
DCFCLKRequiredForPeakBandwidth + DCFCLKRequiredForPeakBandwidthPerPlane[k];
+                               DCFCLKRequiredForPeakBandwidth = 
DCFCLKRequiredForPeakBandwidth + 
v->UseMinimumDCFCLK_stack_reduction.DCFCLKRequiredForPeakBandwidthPerPlane[k];
 
                        MinimumTvmPlus2Tr0 = v->UrgLatency[i]
                                        * (v->GPUVMEnable == true ?
-- 
2.39.0

Reply via email to