Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3603766ybv; Tue, 25 Feb 2020 04:12:29 -0800 (PST) X-Google-Smtp-Source: APXvYqw2LCAqeoLan1HAaz1mjBU16Ano91Zxp7Sv4YIfFjdG5DxgabRxb72h4n/Ze/+uo0Y6gNW8 X-Received: by 2002:aca:48cd:: with SMTP id v196mr3320065oia.102.1582632748986; Tue, 25 Feb 2020 04:12:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582632748; cv=none; d=google.com; s=arc-20160816; b=Vfn6yk6Vcb7JcdZbtiQGJ3mMb3YTp0RE18VLZzJf1dFF98EZoLL72hJcrqvUk9tFtI VcLrsEU3dFY1/ab9mvGvdOzs2mWmRe7DDaIfVky7joZ6bK00NcfPXCje7R2+JcE/h/cf Vw0SQenXilaHtpCyuqbOLHuPwoCUUfIOXT0bDnWyERAW4roHvJ7g9xJTtKt9q5i7Lon0 Cy+LI3ZwfGQjGkOx5XKKJxUkv3J2cK+BcN8Q1H2a+F9S+89C0fgmYqfbleyZRPN5p2U5 1BCztktfJ1BUd0sctIOrQU2wvQgFj9RslnmU28bzOHusiQBGNa6iEiWL1tkjHbT2pzQ3 16ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=feLHE44n9vnBjySasa1NZJa0HQGuc7PDRlMc6i52jDw=; b=IMK368WuVcnIv/pq5iZgj/txD0MxLnFawItLUG2cdD86gcbv6mskCYLxnmB+26PVIy e02r3fvpDV58WxIR9TK/CYYkhL4Qt6lFkq5yUv5iB2rpSACEdUUie4CI5+ItA109EXEC RuPBq5R9IHioUTGG/aAwMr6UxE8+WPjPUWeU7rErP6YV0XoHtGffw6KJB7/q+ms5OBoK mEeQPz8e/6T+fcH5zsHfMPpxfD39ZhE3o+deZyh0rcaS9OlFEfjQUMEnT+14kQIezj1L G4A1X+G9iabno5kowgnZI+2NsZ+wI2+seQ3DXDSfBCAO7hz2AL5eKVkRLoEJMiq9u7AI bpOA== ARC-Authentication-Results: i=1; mx.google.com; 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 w11si6978791oic.62.2020.02.25.04.12.17; Tue, 25 Feb 2020 04:12:28 -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; 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 S1730234AbgBYLmg (ORCPT + 99 others); Tue, 25 Feb 2020 06:42:36 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:47102 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729178AbgBYLmg (ORCPT ); Tue, 25 Feb 2020 06:42:36 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 9E1941C208D; Tue, 25 Feb 2020 12:42:35 +0100 (CET) Date: Tue, 25 Feb 2020 12:42:34 +0100 From: Pavel Machek To: pavel@denx.de Cc: linux-kernel@vger.kernel.org, Evan Quan , Alex Deucher , Sasha Levin Subject: Re: [PATCH 4.19 184/191] drm/amdgpu/smu10: fix smu10_get_clock_by_type_with_latency Message-ID: <20200225114234.GB2591@amd> References: <20200221072250.732482588@linuxfoundation.org> <20200221072312.821201678@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+pHx0qQiF2pBVqBT" Content-Disposition: inline In-Reply-To: <20200221072312.821201678@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --+pHx0qQiF2pBVqBT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Alex Deucher >=20 > [ Upstream commit 4d0a72b66065dd7e274bad6aa450196d42fd8f84 ] >=20 > Only send non-0 clocks to DC for validation. This mirrors > what the windows driver does. > diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c b/drivers/= gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c > index 1546bc49004f8..3fa6e8123b8eb 100644 > --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c > +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c > @@ -994,12 +994,15 @@ static int smu10_get_clock_by_type_with_latency(str= uct pp_hwmgr *hwmgr, > =20 > clocks->num_levels =3D 0; > for (i =3D 0; i < pclk_vol_table->count; i++) { > - clocks->data[i].clocks_in_khz =3D pclk_vol_table->entries[i].clk * 10; > - clocks->data[i].latency_in_us =3D latency_required ? > - smu10_get_mem_latency(hwmgr, > - pclk_vol_table->entries[i].clk) : > - 0; > - clocks->num_levels++; > + if (pclk_vol_table->entries[i].clk) { > + clocks->data[clocks->num_levels].clocks_in_khz =3D > + pclk_vol_table->entries[i].clk * 10; > + clocks->data[clocks->num_levels].latency_in_us =3D latency_required ? > + smu10_get_mem_latency(hwmgr, > + pclk_vol_table->entries[i].clk) : > + 0; > + clocks->num_levels++; > + } > } This results in very ugly wrapping. Better way would be to do "if !(pclk_vol_table->entries[i].clk) continue;"... "drm/amdgpu/smu10: fix smu10_get_clock_by_type_with_voltage" could be improved in similar way. Best regards, Pavel --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --+pHx0qQiF2pBVqBT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl5VCCoACgkQMOfwapXb+vLXQgCffdt12/YTK2DTCSDvMalPYVdb lCMAmwQ257909XAf0gGoMrf1TiEyAaJT =zSlR -----END PGP SIGNATURE----- --+pHx0qQiF2pBVqBT--