Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4869036pjb; Mon, 27 Jul 2020 07:14:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx74sBrFvburZOjB5KYQvR+/nScK8FZLuz4LO6y4OQOj1ge8z89sXafOOjXgOk66SscMGh3 X-Received: by 2002:a17:907:20af:: with SMTP id pw15mr22153812ejb.204.1595859244287; Mon, 27 Jul 2020 07:14:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595859244; cv=none; d=google.com; s=arc-20160816; b=EhzW5lmRIq8C3HSDrawZKFnEB7T7cydDKBAtVEYlDboMPSTyqTq3Ja9b0SYzwyB2Ga hj2L/ansW+f3DnlqXvpgUbICosao6ct3o1slMDj+txXapXDxrk1sLki/AZdlzcdXeRRT IWadaJFxeCY29J6D6vP/PqOlF8B0xhQ6dzOEA7AkhQWtOMe7DMRET1qOGX9mDu5O86h6 sVgbeLMmwO1KnEAyryGe0ZjsUoDwbEp4TL65BLlwpcr7FMCbBXcFmqkah5d5M8Mj5/IE N8J1Wvx5+f7YaH2EB0aVWWsZGXSN0NU7MWS7dqDRwTF8IIl8Ex1pIqy4LL3XMP9BDE49 ixQA== 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=fkUPP2g8SnnvAW+j2IFPYE9Ivg0L86m7UZcO5r+P/Vo=; b=SeafakI0ZkxHLEnfz119N945WZVGrGkE4/wVU/9XkLAIJfzd2WaVhHsTaDMcAeyxQQ SyP+Z0tAGC829PRcK0HISM55p7hjLeQd5iaEchWEiivAElAFKYSlJCm1g3QeZQ89uO48 A9hnTylQDzWzlZNS4kQPTjucY758qfhKrlvO6yMgUB1V6AK1DpgMccIJXBwauq2+8HVS npc0yC0X9j06oxCzpqH3U2obDp36YLrhBDlMAqbkp07QgcLACZB1GNjcJU+gzy4lG2mt LIO4CXXRFgzSZfzKhku5WSeIeugtDrewduDJsB/vXQsQ388dpQ+W5S4kqeVa2w7nPv0E 8G6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Vv80Y1ah; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h4si5564423eje.121.2020.07.27.07.13.41; Mon, 27 Jul 2020 07:14:04 -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=@kernel.org header.s=default header.b=Vv80Y1ah; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730184AbgG0OMS (ORCPT + 99 others); Mon, 27 Jul 2020 10:12:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:36440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730182AbgG0OMQ (ORCPT ); Mon, 27 Jul 2020 10:12:16 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 8AA1C2173E; Mon, 27 Jul 2020 14:12:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859135; bh=3OHby8XDBx0VTjGkXODfmyS4uUhnDdD6Mf6sVeCoxnM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vv80Y1ahYxyBalsvrahQ5tIaeVbI6dbbaq7aSbRpk6Ov6MWB4yLhPZxBDXaOxWpx4 SejlHWd6m+tLoOfO+EYG7OtYletb4wUfMYYr3Ft0KiP32GonvPqXwS0Qu0/MYLo99Y ZbVgvSwrNmfdV6lGBE12PoWY+Mn7y08u26F3APa0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Quan , Qiu Wenbo , Alex Deucher Subject: [PATCH 4.19 79/86] drm/amd/powerplay: fix a crash when overclocking Vega M Date: Mon, 27 Jul 2020 16:04:53 +0200 Message-Id: <20200727134918.363029745@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134914.312934924@linuxfoundation.org> References: <20200727134914.312934924@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: Qiu Wenbo commit 88bb16ad998a0395fe4b346b7d3f621aaa0a2324 upstream. Avoid kernel crash when vddci_control is SMU7_VOLTAGE_CONTROL_NONE and vddci_voltage_table is empty. It has been tested on Intel Hades Canyon (i7-8809G). Bug: https://bugzilla.kernel.org/show_bug.cgi?id=208489 Fixes: ac7822b0026f ("drm/amd/powerplay: add smumgr support for VEGAM (v2)") Reviewed-by: Evan Quan Signed-off-by: Qiu Wenbo Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c +++ b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c @@ -643,9 +643,6 @@ static int vegam_get_dependency_volt_by_ /* sclk is bigger than max sclk in the dependence table */ *voltage |= (dep_table->entries[i - 1].vddc * VOLTAGE_SCALE) << VDDC_SHIFT; - vddci = phm_find_closest_vddci(&(data->vddci_voltage_table), - (dep_table->entries[i - 1].vddc - - (uint16_t)VDDC_VDDCI_DELTA)); if (SMU7_VOLTAGE_CONTROL_NONE == data->vddci_control) *voltage |= (data->vbios_boot_state.vddci_bootup_value * @@ -653,8 +650,13 @@ static int vegam_get_dependency_volt_by_ else if (dep_table->entries[i - 1].vddci) *voltage |= (dep_table->entries[i - 1].vddci * VOLTAGE_SCALE) << VDDC_SHIFT; - else + else { + vddci = phm_find_closest_vddci(&(data->vddci_voltage_table), + (dep_table->entries[i - 1].vddc - + (uint16_t)VDDC_VDDCI_DELTA)); + *voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT; + } if (SMU7_VOLTAGE_CONTROL_NONE == data->mvdd_control) *mvdd = data->vbios_boot_state.mvdd_bootup_value * VOLTAGE_SCALE;