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=1796292174; b=DZyOrn0AUiYuS6HfNp//Jh8GNAOlFUWAf4nFhchQPaoSjcHTXnf+9SPys6rQ14/6xrtT Muoh8WTALsJXCJ9aRxw3sbp1kIuG4kqH9oO4nYmngra9qKogrmtQHOJoczt0zagmIHSqw mJsxU56UbM1ltC5II5eayCWN5C1hw5sqsDqYpYQljHEBhS9Urh4A7S6MeSf4Aph9Gv899 Fnqc7N312i+9mWxgtw1mQ670OZ7FWTtCTDO6E5okjhlFAEnB1VugyZrub52Vu8V8lsPE1 4nbL06L7kk7trp5jLwyunRL/mD8fSvqxn6CLV2OAZJsnqbUlmP6tCEvxLeeBIMkdPpg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796292174; 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=cSCOzc86aA6CBFpz9VpK4V/CwlW6OZJ6bxZnlVDPThQ=; b=AUwSnyBXsMTn0k41dgmp7+qJvb5MSG0YikyTPQK+qvSOA0+ROvRMZpH0R9upuQRg5fZ8 ucI0+J+hM6W3KIIuCAix75mn4OpGZP1TJ2dSEQCIJMa5mRSskg5PhyY7Ohfm4fotzUr9M 8p7EvEYIqqCmsWkcw5H8fFcEYGqhWN9B4+cjCqfKA4a5r4iDMQ8Y62lIr6N5fxpx4pfR8 C2NsKATHlUjzPoMLahZRqgBsCJrQ+MMYsbmRkt/3lXqj0DgjFn0yvwBcLgHMwGOGeLaq0 DgCX6AVNVzU8vpmeYLmWLwvHPZ/uQRZ9XezcceuzUGcL8gn43GMiT0LIUuntdIJPZGw== 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=Cpp3Z+dp; 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 AE38C606A322; Thu, 3 Dec 2026 10:02:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AE38C606A322 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=Cpp3Z+dp ARC-Seal: i=1; a=rsa-sha256; t=1796292146; cv=none; d=zohomail.com; s=zohoarc; b=k1evK2SyoFoCFrW+q2OoRnh4uocBTXcXivmBqPih2UnDYKaQu5M4aGPv6eX7dOg/bzPYLq24bGlUA9lei9LuYod4G7udIJlO9GPkdDZcRqWHOhi+fw0PvcKlHMXfUmUiTz27O1nHk3EYB5a2pKhooOA/vgXmeWknxuYaXC2e87k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1796292146; 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=cSCOzc86aA6CBFpz9VpK4V/CwlW6OZJ6bxZnlVDPThQ=; b=K/m4RxI8K4WDfUKhdpi6Sc1RRw5uRQIhUDlIE1Zm1jWdThwPXpZbStTHcZz2FHWgvxVO8QRYy6joHUJyEKEQ8WDO20QIO7pI8X4916UtJOedguVNvpJUK1Jm8l4tcwcSWXqM9uewqe4UTLaf9RfaL66HR0Cktur3mp/r5ei9pYk= 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=Cpp3Z+dpjYUYFceiyaTCJ4JG7LZhx0b3KmNJj8/JZfWvfow50200II5uXZ2Bh/H0pu6lUzXEqiauYHY3Z2xitShQDHRM8NV2EJpW5eHwy9UW98fU5kDQ6emZ0JEmPArnC/T/iWwajDTeCHv1yIEQ09Q00+Gv22xjP6rl8Zb9NEZx1U5CUauxuH5tc/8LnlwdqpXPaGY6BqgnjFICAW08S3rxv4YIiVr8lbj79i0LrfGmAKprdxDThyxcxXyt9J2dLan9E184ckCb7y2GpOklOuV+7IZjbDN8CskQXL1arXA0LeFltS/6+LydJXS/HMPfviIkZ0GOCeJYoPMXb46sFA==; c=relaxed/relaxed; s=zmail2; d=icenowy.me; v=1; bh=cSCOzc86aA6CBFpz9VpK4V/CwlW6OZJ6bxZnlVDPThQ=; 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 1796292143490401.7239404485641; Thu, 3 Dec 2026 02:02:23 -0800 (PST) Message-ID: Subject: Re: [PATCH v2 0/2] clk: sophgo: sg2042: Keep gates used by firmware enabled From: Icenowy Zheng To: Jerome Brunet Cc: Rob Herring , 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 18:02:14 +0800 In-Reply-To: <179624000421.3767986.8173736547788472972.b4-reply@b4> References: <20261122-b4-sg2042-efi-rtc-v2-0-6d087e03e4e8@iscas.ac.cn> <179579169278.2788166.8963233310700352675.b4-review@b4> <20261202145034.GA768275-robh@kernel.org> <179624000421.3767986.8173736547788472972.b4-reply@b4> 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 20:33 +0100=EF=BC=8CJerome Brunet=E5= =86=99=E9=81=93=EF=BC=9A > On 2026-12-03 00:29 +0800, Icenowy Zheng wrote: > > =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 ser= ial > > > > > flash for its own image and EFI variables. Both sit behind clock = gates > > > > > shared with devices Linux drives, so runtime PM on the Linux side= can > > > > > turn them off under the firmware, and GetTime() returns EFI_NOT_R= EADY. > > > > >=20 > > > > > Let firmware list such gates in protected-clocks on the clkgen no= de, > > > > > and keep them enabled. > > > > >=20 > > > > > qcom, the only current user of protected-clocks, does not registe= r such > > > > > clocks at all. That would break the I2C controllers Linux uses, a= s the > > > > > DesignWare driver needs the clock rate, so here they stay registe= red and > > > > > are only kept on. I'm not sure this fits the intended use; sugges= tions > > > > > 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 giv= e it a different > > > > behavior/meaning compared to what introduced it in Qcom: > > > >=20 > > > > - Qualcomm skips registering listed clocks. A consumer requesting a= listed ID gets NULL. > > > > - SG2042 still registers listed gates and marks them CLK_IS_CRITICA= L. > > > > A consumer gets a valid clock handle, can read its rate, but rele= asing 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= , but that can only > > > > happen if the meaning is consistent. > >=20 > > Well in fact the purpose isn't the same on QCOM and SG2042 here: > >=20 > > - On Qualcomm platforms, all resources specified as "protected" in DT i= s > > really protected by the TEE. If Linux even dare to touch these resource= s, > > the TEE will consider this as tamper of TEE security and hang the syste= m, > > so these resources should never be touched by Linux. > > - On SG2042, there's no security enforcement on these resources, and Li= nux > > has the permission to access them. However this will render some part o= f > > the EFI runtime service unavailable, so for the sake of EFI runtime ser= vice > > availability these resources need to be kept on by Linux. > >=20 > > 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= . > >=20 > > Maybe a new name (instead of protected-*) could be chosen for the latte= r > > behavior. Considering it would behaves like the `assigned-clock*` famil= y > > when in the clock framework, maybe something like `assigned-clock-on = =3D <0> > > /* doing nothing */, <1> /* keep the corresponding assigned-clocks entr= y on > > */;` ? >=20 >=20 > For sure, It'd prefer if a property had single meaning regardless of the = SoC so > not protected-clocks please. >=20 > I thought this reminded me of something and we have been down that road b= efore: > https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/tree/driver= s/clk/clk.c?h=3Dclk-next#n5600 Well I think the real deprecated thing here is one-clock-per-node bindings instead of specifying critical clocks in the DT. /me remembered the transition of sunxi clock drivers to sunxi-ng clock drivers. Thanks, Icenowy >=20 > So apparently there was good reason not to do this 10y ago but I don't ha= ve > the history on it. I'll try to dig.