Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp708548pxv; Thu, 15 Jul 2021 14:04:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkhtiDeKHrEPuTBNqNMihumF9EXGigFZsP4UpxEQkmXrV3RfdFoI/Yztuz1ZxSstWJGHFz X-Received: by 2002:a17:906:4d01:: with SMTP id r1mr7705626eju.143.1626383098884; Thu, 15 Jul 2021 14:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383098; cv=none; d=google.com; s=arc-20160816; b=Q+3SJg+Kd6JeYDkhp1LEZPlcBl3MFU2UH2A4BBgnyUYnzL+w//rPmV0zWT5TrS+g76 oCPudUCnRdWEqgqJzpa7uuKO8IxDEaLyfTqo4pscPIqCvBlIarTF2cPuHvKwSU4MH8Km kF2yfJ3VKl2K1emPF3cU/aTieGvnpBSCnieQHOb4KB203bVAWU1thtERBKmTFHDJr1Df J+hvm/zM9GFQfYdS9lBFQ5iDGhYEahgXiZIC+1mFMXi2ZmD+jXcjSj1RZiK4xyrxw6zr a+gzY9XlrW/ac2XVKSxMj5FMzgdHRbAXGB5rYQTlcGq/8M7vLRyXYJ1FeVLVRyR1LOLC dtQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YDyQ08esKFNXHftzC0JBWOUc62dPztrTByCvjQCnDcQ=; b=F7KnjEsuz7lKAfLVoApCW7N/M/21bl9XkjERdQ+FWJn0QKOno79CAhnSIHO2UJzkrA VBOndXNZvv5JFLDoKle3D/OyaRMEXakw+txsgtala2Pe8u1Ppk9UY8+GW+lUyLpWs3OG cNL0pY0Io+fJDz+aiFwbvElyl2XaK/n3z0XmAWG1Qd2fyZL/O0kqszcAWE6pXnRySIFD uktDP2NcCfyssMHiCVVsjQa/ZEh/nRP4lHm2xS0IWGWIU5vhZ5uyJZTuX6NTeQmJb516 SOYD6hIo7Be4IyO7QAGAn2TdZVrPj4SC+Oi9iPjw5uO0e0UtP5brY6+y5y3mvXQ47vn4 Vzrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jvJlObj7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l7si9969987edk.216.2021.07.15.14.04.35; Thu, 15 Jul 2021 14:04:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jvJlObj7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244217AbhGOTPk (ORCPT + 99 others); Thu, 15 Jul 2021 15:15:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:39760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242192AbhGOTBr (ORCPT ); Thu, 15 Jul 2021 15:01:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4400E613E9; Thu, 15 Jul 2021 18:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375508; bh=HzkaqJ8ahqU9OYMbMKA/VgYQ5vYmkdZj/qJKBcpRqV4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jvJlObj7mSBW4JCRIpLCH9iZ0UC3+ZDv/Gk4ncNASJVl5jrc1+XqOA9wpX1FuLL6s JXw+t5n7/AzS/05PPCee9dOwKnG8EtlKOk0xTYeepAnlnJkTBriDohuQ/Y3POswFSu ExEaCYlaJtJKVziUVu8NExRiCGzguUzKnDQ/cHgc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wesley Chalmers , Dmytro Laktyushkin , Stylon Wang , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.12 074/242] drm/amd/display: Fix off-by-one error in DML Date: Thu, 15 Jul 2021 20:37:16 +0200 Message-Id: <20210715182605.983697745@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wesley Chalmers [ Upstream commit e4e3678260e9734f6f41b4325aac0b171833a618 ] [WHY] For DCN30 and later, there is no data in DML arrays indexed by state at index num_states. Signed-off-by: Wesley Chalmers Reviewed-by: Dmytro Laktyushkin Acked-by: Stylon Wang Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../amd/display/dc/dml/dcn30/display_mode_vba_30.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c index da93694ec7cf..6e326290f214 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c @@ -2053,7 +2053,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman v->DISPCLKWithoutRamping, v->DISPCLKDPPCLKVCOSpeed); v->MaxDispclkRoundedToDFSGranularity = RoundToDFSGranularityDown( - v->soc.clock_limits[mode_lib->soc.num_states].dispclk_mhz, + v->soc.clock_limits[mode_lib->soc.num_states - 1].dispclk_mhz, v->DISPCLKDPPCLKVCOSpeed); if (v->DISPCLKWithoutRampingRoundedToDFSGranularity > v->MaxDispclkRoundedToDFSGranularity) { @@ -3958,20 +3958,20 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) { v->PlaneRequiredDISPCLKWithoutODMCombine = v->PixelClock[k] * (1.0 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) * (1.0 + v->DISPCLKRampingMargin / 100.0); - if ((v->PlaneRequiredDISPCLKWithoutODMCombine >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states] - && v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states])) { + if ((v->PlaneRequiredDISPCLKWithoutODMCombine >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states - 1] + && v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states - 1])) { v->PlaneRequiredDISPCLKWithoutODMCombine = v->PixelClock[k] * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0); } v->PlaneRequiredDISPCLKWithODMCombine2To1 = v->PixelClock[k] / 2 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) * (1 + v->DISPCLKRampingMargin / 100.0); - if ((v->PlaneRequiredDISPCLKWithODMCombine2To1 >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states] - && v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states])) { + if ((v->PlaneRequiredDISPCLKWithODMCombine2To1 >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states - 1] + && v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states - 1])) { v->PlaneRequiredDISPCLKWithODMCombine2To1 = v->PixelClock[k] / 2 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0); } v->PlaneRequiredDISPCLKWithODMCombine4To1 = v->PixelClock[k] / 4 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) * (1 + v->DISPCLKRampingMargin / 100.0); - if ((v->PlaneRequiredDISPCLKWithODMCombine4To1 >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states] - && v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states])) { + if ((v->PlaneRequiredDISPCLKWithODMCombine4To1 >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states - 1] + && v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states - 1])) { v->PlaneRequiredDISPCLKWithODMCombine4To1 = v->PixelClock[k] / 4 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0); } -- 2.30.2