Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp4700048imc; Mon, 25 Feb 2019 09:22:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IYdtlXbK67i9S31emWK3TV149QaU4K7LYVLvFkC7JH+0kU3LPHFmB1nt6KaD1v2BPWwTL42 X-Received: by 2002:a63:6f09:: with SMTP id k9mr19940367pgc.326.1551115365913; Mon, 25 Feb 2019 09:22:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551115365; cv=none; d=google.com; s=arc-20160816; b=WTkriSjKkKklFq0qPD7kLFqMZEeO+T1e9S/+ExxDdpb9aJqiUecd5Ve21DNGiy15Kp +b9UdzZtpBePOpC3HwSV5MyI/ohxNHUbw9MFBp7Qnyis/PUlfhrNv1jsKKJIvRK+68Gp GHAMzWHTph8Y1YJXLv48cYdeyma/s4tnfm2slkIOcv3KHATGXfsD+ZWx9RPCkJh+PGeS 8GjinDfUGtDidfNdGy8E7WrCIzTPuNDqZkdpAhDCL+1Y8E9P7yV7I0g1n7HPgZ2WkW3s mmA+d6ko5IelPXLx2Z5DYVb1np8Zr55AlZp575Cjr4fXouNxPfjcB/YMH/IdFQC/nKYM hlmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:in-reply-to:from:references :user-agent:message-id:subject:content-transfer-encoding :mime-version:dkim-signature; bh=TyuFX3/Ayk3grg8FgM1Ud2McpcrxgXnHFfULx9F5tms=; b=lmkAeHRs0e2q7NnOGEzOJT7G3miG+gkrnmK66QAqXQSEcZDFyRD+X3zZvh7SoWuCQr b8a/OGqqc8OtsxT2N5ppOWRyFcTkXrPmg8btI+LE8n8YrrftASZW/gKF/hLVqHZxucwO zB24OImZZ4YtEJuZ3VzbwU1+5/+oVDCqR/qXr5Ki+ZfiTUUowB7VomhG2MuPvcHln+2K nd8torTlPXgXcjiOBUhT474uozsYzED0VLdtgHu+dbVEcd6fmswb44cpJJnxCzz0yrg/ 4FEQKTGnVh0OY8miNYgrgGYvQzO3ebrfz07cOFIj6deijhaV3ui4WX6FdzS2YXZUi/lm +eqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JevmI0d3; 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 102si9849046plb.176.2019.02.25.09.22.30; Mon, 25 Feb 2019 09:22:45 -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=JevmI0d3; 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 S1728729AbfBYRVv (ORCPT + 99 others); Mon, 25 Feb 2019 12:21:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:35810 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728368AbfBYRVu (ORCPT ); Mon, 25 Feb 2019 12:21:50 -0500 Received: from localhost (unknown [104.132.1.66]) (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 8C57420684; Mon, 25 Feb 2019 17:21:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551115309; bh=B11qdtzD4kvPekptQ8/DwF7Tpovpen1qO75lHMRYb58=; h=Subject:References:From:In-Reply-To:To:Cc:Date:From; b=JevmI0d3htbubzraz3yIWbu8XD/A1b8k7lwL/g/JM0fU8SK6vry+byfb64hfM1+1j b7PpFKMm363LJ8m+mudNHYa3Nkn7Zv/OzhNxDnrBfYdz+3Yo1I6qj1F81FuQ9OR3gH x5MtJcpodyrqsw365DHsiso1R2a9W6c5bUkgUAEs= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: RE: [PATCH RESEND V6 2/2] clk: imx: scu: add cpu frequency scaling support Message-ID: <155111530880.77512.16435986555733393398@swboyd.mtv.corp.google.com> User-Agent: alot/0.8 References: <1550802436-13007-1-git-send-email-Anson.Huang@nxp.com> <1550802436-13007-2-git-send-email-Anson.Huang@nxp.com> <155086249004.77512.8709011386763447047@swboyd.mtv.corp.google.com> From: Stephen Boyd In-Reply-To: To: "devicetree@vger.kernel.org" , "festevam@gmail.com" , "kernel@pengutronix.de" , "linux-arm-kernel@lists.infradead.org" , "linux-clk@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "mark.rutland@arm.com" , "mturquette@baylibre.com" , "robh+dt@kernel.org" , "s.hauer@pengutronix.de" , "shawnguo@kernel.org" , Aisheng Dong , Anson Huang , Daniel Baluta Cc: dl-linux-imx Date: Mon, 25 Feb 2019 09:21:48 -0800 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Anson Huang (2019-02-22 18:32:28) > > > + cluster_id =3D 0; > >=20 > > Do we still need to check this anymore? Why not just always use cluster= _id 0? >=20 > The i.MX8QXP ONLY has 1 cluster named A35, while on i.MX8QM there will be > 2 clusters, A53 and A72, so we need to use the resource ID to initialize = the cluster_id. >=20 > >=20 > > > + > > > + /* CPU frequency scaling can ONLY be done by ARM-Trusted-Firm= ware > > */ > > > + arm_smccc_smc(IMX_SIP_CPUFREQ, IMX_SIP_SET_CPUFREQ, > > > + cluster_id, rate, 0, 0, 0, 0, &res); > >=20 > > Because not checking would make this work, vs. checking causes this cod= e to > > sometimes use an uninitialized value from the stack. >=20 > 89 + if (rsrc_id =3D=3D IMX_SC_R_A35) > 90 + init.ops =3D &clk_scu_cpu_ops; > 91 + else > 92 + init.ops =3D &clk_scu_ops; >=20 > I think it should be good. Only when plan to support cpu-freq scaling, th= en the > CPU clock will be switched to use clk_scu_cpu_ops and the clutser_id init= ialization > will be done according to CPU resource. For example, when we plan to supp= ort i.MX8QM > cpu-freq scaling, we will add A53 and A72 check here and switch the clock= ops to clk_scu_cpu_ops, > also we will add the cluster_id initialization in the SMC clock set rate. >=20 Ok. So then please make the set_rate function fail if the rsrc_id doesn't match something expected. As the code is written right now, the compiler can't figure out that cluster_id will always be assigned, so it complains that it may be using uninitialized data.