Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1256775imu; Mon, 5 Nov 2018 17:06:15 -0800 (PST) X-Google-Smtp-Source: AJdET5doEEs7bb9MLcVWc5yuFYL1TdlwMX61qLyZdoZIsninpuU0fEFXU7K4ZnWZfCOFOQwn2ETs X-Received: by 2002:a62:4586:: with SMTP id n6-v6mr23797271pfi.3.1541466375011; Mon, 05 Nov 2018 17:06:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541466374; cv=none; d=google.com; s=arc-20160816; b=zIixc/kARq5DlIG/mQi25+DaL6MqLlS3PVRYuZYa7uhypYZBg31LDpzLo5qJzm+EZm 36jK1Js05jTDEU3f4I/TMXL38+ExewdpsUMAWjsKpoCgBbY9vMtt+HQkDO3BPXvB6DF9 N52BE/hY0acuu5s+3lnwZvw5Vl02Gp4NVy5MDQI1qcy2yOE4tHudcfjSUjcYJ81MAsTU fyXg3aqGqu7NdROue7omgv9ScTGbVKEOzLUwwJ2WrVg4WopnMgGVEj2zW1PVqew/wM+G DN+54ltruR0y/POZ8hOeduKM5sTpTZWKcYtwO64Hdm1GB0GYLW65OmgEpt32d5fIp+r9 rW3g== 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:dkim-signature; bh=g+snwBo8ag6BDr74ywAd3k5kRlUVBbIn0FaoX6zyQIM=; b=h266ZAtTWv1kuVq1W9JeMcpTmD9Tkfi/+iDIHk+V8/4BjaJmn3geZbK4WhVIUzjYNR xdzD0Q1Lk5xT40CDkZbl+I7spxK5B3KhLsrS5Ji13SdQXPYn/vKD3HzqcPAhD92TD65E MhOm0ZehTn9x/HKv6/HqyrcFcRK6BfmVSFgb2F079+rPk2NLK2FyZGGxIexC0H5EFROQ +PU/ImAKS6oNXFKHnvhrtL4Uyll8bX5wXk9lal10nz/+Unp5vNe+XpPITxAC5c8eAL9G BxpkJVbONfgHR3DtYg4+QUW4lMI3ps73YXwYHWLmOQ2XWYh85mnoLvZDEx2y/zqu32Re xexw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LjKpRfuW; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x142si21758221pgx.202.2018.11.05.17.05.59; Mon, 05 Nov 2018 17:06:14 -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=@linaro.org header.s=google header.b=LjKpRfuW; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729198AbeKFK1n (ORCPT + 99 others); Tue, 6 Nov 2018 05:27:43 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:40292 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728966AbeKFK1m (ORCPT ); Tue, 6 Nov 2018 05:27:42 -0500 Received: by mail-pf1-f193.google.com with SMTP id x2-v6so1191077pfm.7 for ; Mon, 05 Nov 2018 17:05:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=g+snwBo8ag6BDr74ywAd3k5kRlUVBbIn0FaoX6zyQIM=; b=LjKpRfuWxoDRTVy65Jj8FZLGPzdX1tY5vOyiD76Rd/4FDwFDhg29MBA1jGNnRx8JLj urNjr9jkLM+InIC9vFQXnd3VDNVdX+0711bIWkqbBodOWEI8hwtsG8TRKORIxwDJRwXK 9ofOuq+ZVlV3f9FrROc68oQAcs/+xbrtumfdA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=g+snwBo8ag6BDr74ywAd3k5kRlUVBbIn0FaoX6zyQIM=; b=KZW5Igntk6pXe/YXTqvVtMQIZV60WyjONu7nASSotVJbk/ZDzfn9YP719IEk5jlAer Gy5D9zcGES+STDz4MzoDtsJC3NmghDQzNa7sPDkgWS8UrOcixnFZeHul+0EROkMXtcS6 lob2NlK/5uNKvE5f/InL2Fkj7rw7DLpgFneLBLmYHkpjJtqCJgx7p0I/M22VKKNCtG97 fF4hWwZ9VKUDQvIHbQkHa/K2B60F3EL0HVHg4en3MTWmChb5KKSE71gkKWq96MA4bEQh +f18lA4ydkHb7S2zwWkK/mEezwNxzpglEt3/aVOLf4+lBRNy/DWviQ8CXsTRZqf/vWN0 NpJg== X-Gm-Message-State: AGRZ1gKee4Sp45hcz2oEMMlKMN40K+zUEJucHwSVPTUHu9LfApwFw/b9 GBZgSzM+PzsEb/elBbav7B+CIw== X-Received: by 2002:a63:1765:: with SMTP id 37-v6mr22253058pgx.131.1541466310312; Mon, 05 Nov 2018 17:05:10 -0800 (PST) Received: from minitux (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id d24-v6sm31199826pfe.40.2018.11.05.17.05.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 17:05:09 -0800 (PST) Date: Mon, 5 Nov 2018 17:05:07 -0800 From: Bjorn Andersson To: Stephen Boyd Cc: Stephen Boyd , Michael Turquette , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Taniya Das Subject: Re: [PATCH 2/2] clk: qcom: Support 'protected-clocks' property Message-ID: <20181106010507.GY2523@minitux> References: <20181105194011.43770-1-swboyd@chromium.org> <20181105194011.43770-3-swboyd@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181105194011.43770-3-swboyd@chromium.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 05 Nov 11:40 PST 2018, Stephen Boyd wrote: > Certain firmware configurations "protect" clks and cause the entire > system to reboot when a non-secure OS such as Linux tries to read or > write protected clk registers. But other firmware configurations allow > reading or writing the same registers, and they may actually require > that the OS use the otherwise locked down clks. Support the > 'protected-clocks' property by never registering these protected clks > with the common clk framework. This way, when firmware is protecting > these clks we won't have the chance to ever read or write these > registers and take down the entire system. > > Cc: Taniya Das > Cc: Bjorn Andersson > Signed-off-by: Stephen Boyd Reviewed-by: Bjorn Andersson Tested-by: Bjorn Andersson Regards, Bjorn > --- > drivers/clk/qcom/common.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c > index db9b2471ac40..0a48ed56833b 100644 > --- a/drivers/clk/qcom/common.c > +++ b/drivers/clk/qcom/common.c > @@ -191,6 +191,22 @@ int qcom_cc_register_sleep_clk(struct device *dev) > } > EXPORT_SYMBOL_GPL(qcom_cc_register_sleep_clk); > > +/* Drop 'protected-clocks' from the list of clocks to register */ > +static void qcom_cc_drop_protected(struct device *dev, struct qcom_cc *cc) > +{ > + struct device_node *np = dev->of_node; > + struct property *prop; > + const __be32 *p; > + u32 i; > + > + of_property_for_each_u32(np, "protected-clocks", prop, p, i) { > + if (i >= cc->num_rclks) > + continue; > + > + cc->rclks[i] = NULL; > + } > +} > + > static struct clk_hw *qcom_cc_clk_hw_get(struct of_phandle_args *clkspec, > void *data) > { > @@ -251,6 +267,8 @@ int qcom_cc_really_probe(struct platform_device *pdev, > cc->rclks = rclks; > cc->num_rclks = num_clks; > > + qcom_cc_drop_protected(dev, cc); > + > for (i = 0; i < num_clks; i++) { > if (!rclks[i]) > continue; > -- > Sent by a computer through tubes >