Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp90432pxf; Wed, 10 Mar 2021 00:58:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJykSIvXj2JbgUBLaXosGCV9RidVW+m2f+b8R7E/S3/WzmSGbEqdnJhC+ADOhZ5lTjtefdrQ X-Received: by 2002:a05:6402:46:: with SMTP id f6mr2097951edu.252.1615366719903; Wed, 10 Mar 2021 00:58:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615366719; cv=none; d=google.com; s=arc-20160816; b=INDCHPpCQXFyXfUeOoXiha4NNAkQmQYYdFgYBUOM15det6erygZf1rgWFIj3L1DBuv SDRwg7AAoKXvrKSCMYIWZn2avMTlzQB+Tk9CV5uucrUwbLIB6o8ZSezCos9wk/fhQPIL +nwmGD6Qydd0ubXxPJPJqrpNdJdRvAxXGkklKEfgYw2L2FsNuE01UzZyXPlBLAAmWGdl OqWyzx8Tg5iQ0L+5s3QrpJTNTKRBj6x2Xh7UBjOMeKu06BKcHejIOGk4uqrhb0FO6MYw 3xvnB5IJGxFndW0j4W6lB+RO56oGBu58f6ndbWmdwQxDG/rgRahqlLqoXY1yBtZteC8D v8Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=dhpbj3Bm/YirP1Wo9nWvDfpHcaC0BIpgfsBiWqT5VhM=; b=iShKM4cuvWgUKPtkLIQyBv+xlP7yTbvE13mzID1R21YpxYOyPc9V508RPL4Lat2SjQ Uh7nOIZrg+8o1L7QsAifeHZdijS8rWKG3+oGFAq/xDd/eWNqG4zcrWmuYNqGY6QJ1I2F XAuSmBJlBRqop7xnSZjCzoMQnOFSHDsYrRE83B5FHkci0PhwjtRPVHCSxBjCjlUyOa9I P2imuU360eJFRuUPB5WpnTHIDbcpf+PYxzkC9XYuFuvM+OHN0uQjLHyw++uCEaN5gZm5 y7kDXGFrnmSHv6acDQ0c5uOLmzAuxBEAPXrqdg0hLARrITC5zhF4A86WpDEYsqkVo5PB tAFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=jOk+Wux6; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=IpY7Ghk7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y21si11572771edo.16.2021.03.10.00.58.17; Wed, 10 Mar 2021 00:58:39 -0800 (PST) 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=@cerno.tech header.s=fm2 header.b=jOk+Wux6; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=IpY7Ghk7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231149AbhCJI4v (ORCPT + 99 others); Wed, 10 Mar 2021 03:56:51 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:32881 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231899AbhCJI4r (ORCPT ); Wed, 10 Mar 2021 03:56:47 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B69C25C00A9; Wed, 10 Mar 2021 03:56:46 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 10 Mar 2021 03:56:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=dhpbj3Bm/YirP1Wo9nWvDfpHcaC 0BIpgfsBiWqT5VhM=; b=jOk+Wux6scGrrEpkS3VDNcm3SsnlMVrfOQ8VPilI2XI OuTqbmgtn+skq3mnH2rCS2pPHm/SEY0kWXPLVwUNW35U0R1XQQaJpn18xwjYI7DE yiLIpCjYGdkCx6u0NpwKzwvnwUW0hwi6ldJrLvr2SiMWiDISpUOUWeKdhZLoJ1qo a2Xz4MrB5SI8mKREozfnqAeXsTMtWUQV7VwSWJ4ugr3d8wqTSj3sOcA6CuW2yxxC BsSJ0fMdzCN5/wgEFiDDIX1rzCfWU8rjTS8iaQ5PVk1qDxOad/DoK6OhDAFDLcsj zy0uyrm9cLqq81LOtyn1jDwmQH9JpFHEMbXb2xF0A+Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=dhpbj3 Bm/YirP1Wo9nWvDfpHcaC0BIpgfsBiWqT5VhM=; b=IpY7Ghk7pDzKLLowJWTUBi qaBbvYsAO5VVBf4l9p6a2ZgbIIkxuymOTb+vBhV8/ZgeTBLJv8WP9O5cExRpwsuM o71nkNbpFEeDg2d62TgInTPVdoGygfVOJ8d3dV9VFEn0FCMJMoAqZv4bijrWRs/N mXBPKh/CDzVrNe2HyfCRMudA33SrvtE86Fm0ps3s0VIriJnXGisQaDEdGKeiqKm/ B75WdPZ1T6BBMSXLY1ChWUJLWTsxyXC4FH+rEuLZwU72dgW1yLqG2rPKxpO3NQPS nGtZeXVVsyrSU+3k9wHDS1+bIyoKmWn3FofEbqhVvxqjh2KBKqK0vMfLG/a+bwfQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledruddujedguddugecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeeuueelieeugeelvdehhfffteetgfehieejhffgtdegvdehgfeuveehjeej lefgveenucffohhmrghinhepshhpihhnihgtshdrnhgvthdpkhgvrhhnvghlrdhorhhgne cukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 34EF21080063; Wed, 10 Mar 2021 03:56:45 -0500 (EST) Date: Wed, 10 Mar 2021 09:56:42 +0100 From: Maxime Ripard To: Rasmus Villemoes Cc: Samuel Holland , Stephen Boyd , Michael Turquette , Andy Gross , Bjorn Andersson , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring Subject: Re: [PATCH RESEND 0/2] Common protected-clocks implementation Message-ID: <20210310085642.ugywtfct66x2bo5j@gilmour> References: <20200903040015.5627-1-samuel@sholland.org> <9363f63f-8584-2d84-71fd-baca13e16164@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="supdipipenbcn226" Content-Disposition: inline In-Reply-To: <9363f63f-8584-2d84-71fd-baca13e16164@rasmusvillemoes.dk> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --supdipipenbcn226 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Tue, Mar 09, 2021 at 09:03:14AM +0100, Rasmus Villemoes wrote: > On 03/09/2020 06.00, Samuel Holland wrote: > > Stephen, Maxime, > >=20 > > You previously asked me to implement the protected-clocks property in a > > driver-independent way: > >=20 > > https://www.spinics.net/lists/arm-kernel/msg753832.html > >=20 > > I provided an implementation 6 months ago, which I am resending now: > >=20 > > https://patchwork.kernel.org/patch/11398629/ > >=20 > > Do you have any comments on it? >=20 > I'm also interested [1] in getting something like this supported in a > generic fashion - i.e., being able to mark a clock as > protected/critical/whatnot by just adding an appropriate property in the > clock provider's DT node, but without modifying the driver to opt-in to > handling it. >=20 > Now, as to this implementation, the commit 48d7f160b1 which added the > common protected-clocks binding says >=20 > For example, on some Qualcomm firmwares reading or writing certain clk > registers causes the entire system to reboot, >=20 > so I'm not sure handling protected-clocks by translating it to > CLK_CRITICAL and thus calling prepare/enable on it is the right thing to > do - clks that behave like above are truly "hands off, kernel", so the > current driver-specific implementation of simply not registering those > clocks seems to be the right thing to do - or at least the clk framework > would need to be taught to not actually call any methods on such > protected clocks. The idea to use CLK_CRITICAL was also there to allow any clock to be marked as protected, and not just the root ones. Indeed, by just ignoring that clock, the parent clock could end up in a situation where it doesn't have any (registered) child and thus would be disabled, disabling the ignored clock as well. Reparenting could cause the same issue. Calling clk_prepare_enable just allows the kernel to track that it (and thus its parent) should never be disabled, ever. > For my use case, either "hands off kernel" or "make sure this clock is > enabled" would work since the bootloader anyway enables the clock. The current protected clocks semantics have been that the clock shouldn't be disabled by the kernel, but "hands off kernel" clocks imply a slightly different one. I would expect that the bootloader in this case wouldn't expect any parent or rate (or phase, or any other parameter really) change, while it might be ok for some other use cases (like the one Samuel was trying to address for example). And even if we wanted the kernel to behave that way (making sure there's no way to change the rate, parents, phase, etc.), the kernel would have to have knowledge of it to also propagate that restriction to the whole chain of parents. Maxim --supdipipenbcn226 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYEiJygAKCRDj7w1vZxhR xQR8AQD/+TN0gj9knlLqLn2CHZlAnj0A92xKow/bZnO58HhvwQEA6M0KautXexRL iinBv4Y7M5goEbbXeZtBJkB3c56USg4= =it6C -----END PGP SIGNATURE----- --supdipipenbcn226--