Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp197853imj; Thu, 14 Feb 2019 18:29:41 -0800 (PST) X-Google-Smtp-Source: AHgI3IZeFCTo3sUP1j6nVhtuP9VkW00jcmAEm28wuAfJCGmtKkSs8XDZ4TZo83iOq2xDYsQqCHtf X-Received: by 2002:a65:6210:: with SMTP id d16mr3013929pgv.34.1550197781430; Thu, 14 Feb 2019 18:29:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550197781; cv=none; d=google.com; s=arc-20160816; b=SYFo492nSqHoMlZAHNGkJYx3WK2kyphgE89Ac2CUmpxfvDAM+i4GL6w8M3stGSGcYm DBQhyi3G09jXRDpS37KtibFvHOqTeuRrbhfmZ8Jg8Bi5WKVmuDJAnDqpeEeKt+/2xI8z 5+qT5ZzR5jTfw8j58MeCnwSChClb+9m+81j02rzNbjUngA52nH0gAkaIuwzIsA1pLNhk xgVG9uGnVtkdkY+PKSaViWjZD73tAGUwGzUj5SwN5EPpEQJim9s66nHeebJPILmyUDRF xNMSWq546jKfYwAUr3h96R1Zg9+C7EjXF3l1ANQXUoDOwFPwLXhzSnFcS3uBLZp+ia+A fUcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vzJ5WSwFTIsKjyBEr8NPTBGU6OYMDSOw1pePEDiB5ps=; b=wHOyTS6qdU+V/sHJKSXN0NWhpbB3u58j8E5ezQH7sPN85r9BHrAZ1y+7ZiG/aNpBkC +BoYp/4FsTyrvQl5gghSiWP3DVA7U32ApogK2VqBhxyUKUAS+HjINmbBpVsQoJeYFp9Q vOEevWi7kdhWZvwXhFscmyq3gyNsR0LK9ITxD1iOSCHJjlIFgJH7qZ/epZaEktQJsIaC gV0utcgxE2/BRvTH+PKjXFBLHYSZHaSZCygzHPkO2/Bgv3hAPce/FIyBYQ0t+7a6olsV ZfigZ1VYKUvb5gjgKLLWv7zgUt1BXqvstcgcNBOs9AomGz6SfVl4iQUlS64vy94Yqu/b 80cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=j0PVPyV7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f6si3890061pgd.362.2019.02.14.18.29.17; Thu, 14 Feb 2019 18:29:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=j0PVPyV7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390249AbfBOCKQ (ORCPT + 99 others); Thu, 14 Feb 2019 21:10:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:50304 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390066AbfBOCKL (ORCPT ); Thu, 14 Feb 2019 21:10:11 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E17D5222D0; Fri, 15 Feb 2019 02:10:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550196610; bh=+/w59t3EsHT/r9n7Tf7+WDEMcEU/EnS8zxrldYfrolI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j0PVPyV7lAUa4VCDcZITqEE5lJ1ZP/RtGAR/vGu9oMCH2/r/hL23o3dHqwZ3/7hRg N02WoyJpFmleriaVFuzTIg3TNQCIwktSa5xYyZwqtyXYKnjWE5FQeTBgAaOpZZRtFh ThXfoQc+KelcLT3pvo5JBsuxjnZUEF95kPrXH6xw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kenneth Feng , Alex Deucher , Sasha Levin , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 4.20 43/77] drm/amd/powerplay: OD setting fix on Vega10 Date: Thu, 14 Feb 2019 21:08:21 -0500 Message-Id: <20190215020855.176727-43-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190215020855.176727-1-sashal@kernel.org> References: <20190215020855.176727-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kenneth Feng [ Upstream commit 6d87dc97eb3341de3f7b1efa3156cb0e014f4a96 ] gfxclk for OD setting is limited to 1980M for non-acg ASICs of Vega10 Signed-off-by: Kenneth Feng Reviewed-by: Evan Quan Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../powerplay/hwmgr/vega10_processpptables.c | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c index b8747a5c9204..99d596dc0e89 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c @@ -32,6 +32,7 @@ #include "vega10_pptable.h" #define NUM_DSPCLK_LEVELS 8 +#define VEGA10_ENGINECLOCK_HARDMAX 198000 static void set_hw_cap(struct pp_hwmgr *hwmgr, bool enable, enum phm_platform_caps cap) @@ -258,7 +259,26 @@ static int init_over_drive_limits( struct pp_hwmgr *hwmgr, const ATOM_Vega10_POWERPLAYTABLE *powerplay_table) { - hwmgr->platform_descriptor.overdriveLimit.engineClock = + const ATOM_Vega10_GFXCLK_Dependency_Table *gfxclk_dep_table = + (const ATOM_Vega10_GFXCLK_Dependency_Table *) + (((unsigned long) powerplay_table) + + le16_to_cpu(powerplay_table->usGfxclkDependencyTableOffset)); + bool is_acg_enabled = false; + ATOM_Vega10_GFXCLK_Dependency_Record_V2 *patom_record_v2; + + if (gfxclk_dep_table->ucRevId == 1) { + patom_record_v2 = + (ATOM_Vega10_GFXCLK_Dependency_Record_V2 *)gfxclk_dep_table->entries; + is_acg_enabled = + (bool)patom_record_v2[gfxclk_dep_table->ucNumEntries-1].ucACGEnable; + } + + if (powerplay_table->ulMaxODEngineClock > VEGA10_ENGINECLOCK_HARDMAX && + !is_acg_enabled) + hwmgr->platform_descriptor.overdriveLimit.engineClock = + VEGA10_ENGINECLOCK_HARDMAX; + else + hwmgr->platform_descriptor.overdriveLimit.engineClock = le32_to_cpu(powerplay_table->ulMaxODEngineClock); hwmgr->platform_descriptor.overdriveLimit.memoryClock = le32_to_cpu(powerplay_table->ulMaxODMemoryClock); -- 2.19.1