Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3694099ybv; Mon, 10 Feb 2020 04:51:02 -0800 (PST) X-Google-Smtp-Source: APXvYqxt9+hZxmJTP8rJ2adiyfKHyD0i4rNuUgTO8e8m+K3rd+QJKKhfz9L9lta1KcPoi+5zzD4O X-Received: by 2002:a9d:51ca:: with SMTP id d10mr937462oth.76.1581339062610; Mon, 10 Feb 2020 04:51:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581339062; cv=none; d=google.com; s=arc-20160816; b=qXKZyOdP+EBC077vsdilKNhZw/rnMukO+NuxOvU8HzTEe6O26/EPRroroT/GL8Dgc4 QdSR5hPgDAU58FasGEaiitzYJKTcua6AS5+GDiK4HN7JE+X3OOjsTRtwNBSAhOXKi97m wlJc1EqJhxnhXvC+n1Lz95KPORNIFuG0hbTPJsgLfOPbalAlJqjGJECiNCf7riDu09gR zR6JZjq1MGEROrNMkXXzFw3bRAwU//0vUcliPTQjpYo3xrS/x2sf7LOtV0Svp180syH7 zIgIEf+UGtUfr5RPtznJYY0aIpgf/bjFLub9Wot9+5P30a/rDVd+R9wv4wTwQNOHeYHk x5JQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fGVev/RC5ypLz98JeFJe8RbQ4eJnlCAQ9sqvtFQy4JM=; b=w8nbBeMN/mj7aExQIgLR5rww+vzvawFEQj2yk8DO4DL0pZnVHms/1GZRcecBGcthWV /SMJU/YHFd+IEgycM0aqxxSITB0iLz+gP3cACfnN/ncd8+6XIvynCdpbU9AlFimqXl8w c+Y9r1s+539tMQ6w004pbedjSIIZ22GHrlXc1PfhrrfQdoeTngrtzv/eJ5HYlbiiSrG8 v+mxEtnwRrqe9r0S9oifWUI5kXGjJu1FaWGpu3tH9CrLJzPn9fpy0ao67DEIZJuyK6og 6Pn/iLk8I084iftsUOH+w8xJvd+ypE6+DtdLagBIXd1V3UcrGPch6zlEJH4qZwXdwDCf 5KOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XHdQOuf3; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w142si114186oia.132.2020.02.10.04.50.51; Mon, 10 Feb 2020 04:51:02 -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=XHdQOuf3; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730652AbgBJMqN (ORCPT + 99 others); Mon, 10 Feb 2020 07:46:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:43758 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730005AbgBJMl3 (ORCPT ); Mon, 10 Feb 2020 07:41:29 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 04B212085B; Mon, 10 Feb 2020 12:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338489; bh=Zf2/fN+yFVuwN+D07uFxRUj+FqdUBL7qqbUS1ZvDQ/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XHdQOuf3QKORRL3eCGlPwvpLLoD4qBsnmD1zon1heL1fdq6lWNSn1okegTctdF799 UxoIIoKXuPscVkIYuMMF6zqYDNFjc3pzjcdIhlcXpINvUwEr6qTTOcl2E1kM9Uwnk9 RIoOHErAP38I+UfquRgHZYEd61fNWEwRQX2dFju8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Quan , Alex Deucher Subject: [PATCH 5.5 272/367] drm/amdgpu/navi10: add OD_RANGE for navi overclocking Date: Mon, 10 Feb 2020 04:33:05 -0800 Message-Id: <20200210122449.378070584@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alex Deucher commit ee23a518fdc2c1dd1aaaf3a2c7ffdd6c83b396ec upstream. So users can see the range of valid values. Bug: https://gitlab.freedesktop.org/drm/amd/issues/1020 Reviewed-by: Evan Quan Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 5.5.x Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 59 +++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) --- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c +++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c @@ -710,6 +710,15 @@ static inline bool navi10_od_feature_is_ return od_table->cap[feature]; } +static void navi10_od_setting_get_range(struct smu_11_0_overdrive_table *od_table, + enum SMU_11_0_ODSETTING_ID setting, + uint32_t *min, uint32_t *max) +{ + if (min) + *min = od_table->min[setting]; + if (max) + *max = od_table->max[setting]; +} static int navi10_print_clk_levels(struct smu_context *smu, enum smu_clk_type clk_type, char *buf) @@ -728,6 +737,7 @@ static int navi10_print_clk_levels(struc OverDriveTable_t *od_table = (OverDriveTable_t *)table_context->overdrive_table; struct smu_11_0_overdrive_table *od_settings = smu->od_settings; + uint32_t min_value, max_value; switch (clk_type) { case SMU_GFXCLK: @@ -841,6 +851,55 @@ static int navi10_print_clk_levels(struc size += sprintf(buf + size, "%d: %uMHz @ %umV\n", i, curve_settings[0], curve_settings[1] / NAVI10_VOLTAGE_SCALE); } break; + case SMU_OD_RANGE: + if (!smu->od_enabled || !od_table || !od_settings) + break; + size = sprintf(buf, "%s:\n", "OD_RANGE"); + + if (navi10_od_feature_is_supported(od_settings, SMU_11_0_ODFEATURE_GFXCLK_LIMITS)) { + navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_GFXCLKFMIN, + &min_value, NULL); + navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_GFXCLKFMAX, + NULL, &max_value); + size += sprintf(buf + size, "SCLK: %7uMhz %10uMhz\n", + min_value, max_value); + } + + if (navi10_od_feature_is_supported(od_settings, SMU_11_0_ODFEATURE_UCLK_MAX)) { + navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_UCLKFMAX, + &min_value, &max_value); + size += sprintf(buf + size, "MCLK: %7uMhz %10uMhz\n", + min_value, max_value); + } + + if (navi10_od_feature_is_supported(od_settings, SMU_11_0_ODFEATURE_GFXCLK_CURVE)) { + navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_VDDGFXCURVEFREQ_P1, + &min_value, &max_value); + size += sprintf(buf + size, "VDDC_CURVE_SCLK[0]: %7uMhz %10uMhz\n", + min_value, max_value); + navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_VDDGFXCURVEVOLTAGE_P1, + &min_value, &max_value); + size += sprintf(buf + size, "VDDC_CURVE_VOLT[0]: %7dmV %11dmV\n", + min_value, max_value); + navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_VDDGFXCURVEFREQ_P2, + &min_value, &max_value); + size += sprintf(buf + size, "VDDC_CURVE_SCLK[1]: %7uMhz %10uMhz\n", + min_value, max_value); + navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_VDDGFXCURVEVOLTAGE_P2, + &min_value, &max_value); + size += sprintf(buf + size, "VDDC_CURVE_VOLT[1]: %7dmV %11dmV\n", + min_value, max_value); + navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_VDDGFXCURVEFREQ_P3, + &min_value, &max_value); + size += sprintf(buf + size, "VDDC_CURVE_SCLK[2]: %7uMhz %10uMhz\n", + min_value, max_value); + navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_VDDGFXCURVEVOLTAGE_P3, + &min_value, &max_value); + size += sprintf(buf + size, "VDDC_CURVE_VOLT[2]: %7dmV %11dmV\n", + min_value, max_value); + } + + break; default: break; }