From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=165.173.180.15 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796229021; b=Sbgb6uRQIzE/Usw7yhwT/q+X0sUx6rnMsqbjXWU4h/CKWAlI6W4fRdxqbGYP6pdZV+em gvPz5K1nC/0MqVz/NWKUTdOtG8+uxn2d2kWsHqRkqXx7NHLpSRPx2bCpL8bGnqrHsdJNl WQCKtxeY/EOIDWIi/O6vVK4Ue2Cdw0Jrt1rkJBoXvsgREYcERhOpWVVsEdKL2Z4FsyKaC gtgNXXxywI/CFhG8XEXqXxG4p/TTef6e6X+6u2qZMJIS3Bc6c+N9un2pC5GAA5WWfiNNb R70nno4CbVLu3qZIEaijDJMoGI57Z9/AVIe9KzyPbsfMv3jDLjPRrv2CwlXIf/cikfA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796229021; h=DMARC-Filter:DKIM-Signature:Received:Message-ID:Subject:From:To:Cc: Date:In-Reply-To:References:Content-Type:Content-Transfer-Encoding: User-Agent:MIME-Version:X-ZohoMailClient; bh=X/O5Nnh8Z66HlsRZd5Nwjewi2FmcbkEPMwaCSctDSk0=; b=brtB3L+qUs0nJ0o6CIHls2IUN8kkhtsZ+bu3kkdB/MnwJUXasM5ALU6pxKxVslxMj87+ Z/PVqZAVpT7XqbI+svC/UWMBOAKjZuKSOVK1mDjBZgzlrohLjlD85YjP3PsMqT5BwA7OH wvuSmO8IhuopgBXBqcXUQDn/pwhDwVbcZoVfABoaJcTmz0+SxdAdzf6iZQ99BK89Ah2tW AwWKi/bGPVqKLgZRTf032aX/V/yaI8BYACJDSzmtKxXHluK1btmkGt+2G0p47yAItArkI nKeN60yNcGl3lP84oieocTjr4PLMoYADeq7B+EwtqR7J3Jlj/RY9YSqS9dZfJKloEXQ== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=icenowy.me; spf=pass smtp.mailfrom=icenowy.me; dkim=pass header.d=icenowy.me header.i=@icenowy.me header.a=rsa-sha256 header.s=zmail2 header.b=WCzYKZI+; arc=pass header.oldest-pass=0 smtp.remote-ip=165.173.180.15 Received: from sender6-op-o15.zoho.com (sender6-op-o15.zoho.com [165.173.180.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF660606A323; Wed, 2 Dec 2026 16:30:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EF660606A323 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=icenowy.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icenowy.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icenowy.me header.i=@icenowy.me header.a=rsa-sha256 header.s=zmail2 header.b=WCzYKZI+ ARC-Seal: i=1; a=rsa-sha256; t=1796228981; cv=none; d=zohomail.com; s=zohoarc; b=kr9YkXZ3dYd30cve8/M/X0NW9u9hGoU1DdoRLMbmk7ds+iThvhth63YxWahrAY97enUxZDnULKzm3+SrFO/j/Q4i6q3ArMeK4n2gN6d7B+az+1Q47EcmGAgYwCm8L3b7wXiLvGJ1kiNyoNlGVBBSQu6aDNgrRZdmXFkx+892Ly4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1796228981; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=X/O5Nnh8Z66HlsRZd5Nwjewi2FmcbkEPMwaCSctDSk0=; b=dLUrWac9Zcr2P6cRKzrCe4pq6eIefRgb7/c4DXnnm2JN5fm+5yjW1uM/x1/03VkxrHNMFoFVNaiStkFLjbi2JG+weOdzjhj1k5DI7wtIieMwme7fJrCxeRcMyC0FAUdKu1iC6gCsBZZeYtHBpaXktwDcea1UhxWQdcGQslSvhlI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=icenowy.me; spf=pass smtp.mailfrom=uwu@icenowy.me; dmarc=pass header.from= DKIM-Signature: a=rsa-sha256; b=WCzYKZI+zBXMUjKTFThFo7fgsZzPWKP21VAb/iXUmkEstTrOozT1pZtjqLlXE90xDqMFYt0pK5soJpO2uJ7W1Z8sBGAb76dvHq1rK7rEVVZKMM6/iTsjin5CEQ+GNUg1a+jjjADoS0/xciLaK+7PuLg+YX1hPxCnI/rrXYUTR4uxKNa+qHOiPver5V77JgySCVdYXO4IwgAg0RXrgyT+B9QOBxnVmFUunLFUmCYOuQ45REBchqwMhpADQyKpDsvWHMg+XS2DlcJbdJkdhdiosMg2IYXvozszKlSpT9V3aKPihzSpskA/A2HRR20jfCNLpStJdIfr1j3UUKjOT+0r/w==; c=relaxed/relaxed; s=zmail2; d=icenowy.me; v=1; bh=X/O5Nnh8Z66HlsRZd5Nwjewi2FmcbkEPMwaCSctDSk0=; h=Content-Description:Content-ID:Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Resent-Sender:Resent-Cc:Resent-Date:Resent-To:Reply-To:Resent-Message-ID:Resent-From:Sender:Subject:To:Date:From:Message-Id:Reply-To:Subject:To:Cc; Received: by smtp.zohomail.com with SMTPS id 1796228979169540.6740492331701; Wed, 2 Dec 2026 08:29:39 -0800 (PST) Message-ID: Subject: Re: [PATCH v2 0/2] clk: sophgo: sg2042: Keep gates used by firmware enabled From: Icenowy Zheng To: Rob Herring , Jerome Brunet Cc: Han Gao , Stephen Boyd , Brian Masney , Jerome Brunet , Krzysztof Kozlowski , Conor Dooley , Chen Wang , Inochi Amaoto , Yao Zi , Chen Wang , Han Gao , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, sophgo@lists.linux.dev, linux-kernel@vger.kernel.org Date: Thu, 03 Dec 2026 00:29:33 +0800 In-Reply-To: <20261202145034.GA768275-robh@kernel.org> References: <20261122-b4-sg2042-efi-rtc-v2-0-6d087e03e4e8@iscas.ac.cn> <179579169278.2788166.8963233310700352675.b4-review@b4> <20261202145034.GA768275-robh@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-ZohoMailClient: External =E5=9C=A8 2026-12-02=E4=B8=89=E7=9A=84 08:50 -0600=EF=BC=8CRob Herring=E5= =86=99=E9=81=93=EF=BC=9A > On Fri, Nov 27, 2026 at 04:01:32PM +0100, Jerome Brunet wrote: > > > On Milk-V Pioneer, firmware uses I2C0 for the EFI RTC and the serial > > > flash for its own image and EFI variables. Both sit behind clock gate= s > > > shared with devices Linux drives, so runtime PM on the Linux side can > > > turn them off under the firmware, and GetTime() returns EFI_NOT_READY= . > > >=20 > > > Let firmware list such gates in protected-clocks on the clkgen node, > > > and keep them enabled. > > >=20 > > > qcom, the only current user of protected-clocks, does not register su= ch > > > clocks at all. That would break the I2C controllers Linux uses, as th= e > > > DesignWare driver needs the clock rate, so here they stay registered = and > > > are only kept on. I'm not sure this fits the intended use; suggestion= s > > > welcome. > > >=20 > > > Tested on Milk-V Pioneer. > > >=20 > > > Signed-off-by: Han Gao > > > --- > > > Changes in v2: > > > - Drop the EFI MMIO patch, Ard is taking it through the EFI tree > > > - Use protected-clocks instead of scanning reserved nodes under /soc > > > (Krzysztof) > >=20 > > Hey Krzysztof, > >=20 > > Using protected-clocks in the way proposed in this series would give it= a different > > behavior/meaning compared to what introduced it in Qcom: > >=20 > > - Qualcomm skips registering listed clocks. A consumer requesting a lis= ted ID gets NULL. > > - SG2042 still registers listed gates and marks them CLK_IS_CRITICAL. > > A consumer gets a valid clock handle, can read its rate, but releasin= g its enable > > reference won=E2=80=99t turn off the hardware gate. > >=20 > > Having different meaning for the same property is not ideal, is it ? > > Eventually that might be something we could fold into the framework, bu= t that can only > > happen if the meaning is consistent. Well in fact the purpose isn't the same on QCOM and SG2042 here: - On Qualcomm platforms, all resources specified as "protected" in DT is really protected by the TEE. If Linux even dare to touch these resources, the TEE will consider this as tamper of TEE security and hang the system, so these resources should never be touched by Linux. - On SG2042, there's no security enforcement on these resources, and Linux has the permission to access them. However this will render some part of the EFI runtime service unavailable, so for the sake of EFI runtime service availability these resources need to be kept on by Linux. These two behaviors are not possible to be unified, although the latter isn't restricted to SG2042 and is common on EFI-booted embedded systems. Maybe a new name (instead of protected-*) could be chosen for the latter behavior. Considering it would behaves like the `assigned-clock*` family when in the clock framework, maybe something like `assigned-clock-on =3D <0= > /* doing nothing */, <1> /* keep the corresponding assigned-clocks entry on */;` ? Thanks, Icenowy > >=20 > > IMO what they are trying to do here might be more appropriate, but Qcom= was there first. > > OTOH, actually registering the clock in Qcom would not be a breaking ch= ange DT wise, the driver > > would start returning a handle where it would previously have returned = NULL. > >=20 > > What is your view on this ? >=20 > > From a DT perspective, I don't think it matters too much if the OS=20 > behavior varies in the way you describe. It would be nice if the=20 > framework handled it rather than individual drivers though and providing= =20 > read-only clocks seems more useful than hiding the clocks. >=20 > Rob