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.182.15 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796321239; b=QhqBA1aG4L3T9iG9s64fggWHKeGpq3ktgeEsXNweeArJ8o/0GrAOp9/lhOsPqvYdiOjx FAgs1Ba5ZFSV8wZxYeNq4cu8CPMZIGnbRQ/RsU/mbKtdtkuyurP+2fxnagx7L2IsBjpnl fKhaozFCTgI76bro8JPsU2a+m9YwMNBsTVP9FihbhlLFWGraxstrCcZA3iqwzglx+veIm NDU6qBkzdB5nqVhiOVctiNj89RLDhjfoM9YZ34/N3o/RovJZYo0aStocXLcV23dpxuZdr Z0nUoZOI70frGahV3qw3+RG4SGyodjxpga+Q1oQRgAm6UME9UVU9bHQCUFpkfyjfR8w== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796321239; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To:X-Zoho-Virus-Status: X-Zoho-AV-Stamp:X-ZohoMailClient; bh=Fkk4/kq+/4cVPBpGUr1xAGacHTQWA+utvc5482NkPUU=; b=rGLW1lkInzKjK5kGYQrFd1IBB8i3J6oFKZC/3FQRnkwqvTSxMgkNkPIxXn6kMKPdi8cG wpXZ8CcLfMuNEjfrzzGxfaKbJRXEjbBmh/bcc1qgq7x05BX6ZjjxsJsfWSk3/+6bpkRQy qGFcAWLfM4IozkfahqRFAEd11M1UswsmQsivTDXZ1JC7p3NYf1GSStB0pwGftgspIJrI8 sQCh8qqx7ObwaCyVp4sIgr1oectDmTGVU9F/o4N1wChface/3s+VgHh1He2lf05bySqRL /W7kHKuJkLoQYR8duLZ69svrMnKOqNokhoQTX5gCXDvbAedy0JRuPJ1tPxImq7T0ZBQ== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=ziyao.cc; spf=pass smtp.mailfrom=ziyao.cc; dkim=pass header.d=ziyao.cc header.i=@ziyao.cc header.a=rsa-sha256 header.s=zmail header.b=Jd9zs002; arc=pass header.oldest-pass=0 smtp.remote-ip=165.173.182.15 Received: from sender5-op-o15.zoho.com (sender5-op-o15.zoho.com [165.173.182.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 0D537606A322; Thu, 3 Dec 2026 18:07:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0D537606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ziyao.cc Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziyao.cc Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ziyao.cc header.i=@ziyao.cc header.a=rsa-sha256 header.s=zmail header.b=Jd9zs002 ARC-Seal: i=1; a=rsa-sha256; t=1796321217; cv=none; d=zohomail.com; s=zohoarc; b=HtTwkm2VshOhkchPkdAfvqr1+cgehzY4nHpWhfyV4uJxQhB9vnAvSaxnICvbLl79pssKM4KvoIyEG+XgS/riF0GI1rusqJx7rCJzC56M7l0nMV0IV1i67TpYfquhLvVEnyWM5Tq7D7X77CxFnh/X21iXHlRFG1BnB1jrG7CdfjA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1796321217; 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=Fkk4/kq+/4cVPBpGUr1xAGacHTQWA+utvc5482NkPUU=; b=Ag2nvOpprlIqW5q4Ii9x9bV3pD0G1/IaROg1koT8xtv1BBhsbBUf3pyQTaxULLW40yeFrLIRERYBIRT2bxtso53mzC853fSUEOUUdbNsAiyFKppd68bpkAYB1QOhfMdvEdAKMICkx1FIGTL934tBjbZ9suTzEF/kOnd5WltmAVM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=ziyao.cc; spf=pass smtp.mailfrom=me@ziyao.cc; dmarc=pass header.from= DKIM-Signature: a=rsa-sha256; b=Jd9zs002xgfpJwEf5jumlbl74tVl6jb3zLlHunNTRQGqKQYP68RTgvFjGdSAnqN2794KevUHCrzqbfdkOsNAykuj98C/O94xRoB2VNG/01aY1kFw3xaSfei3X7CaPrxP9qqFmOx2oNaci2d7it6V8s7j6EB2AofiRqeZrRd2T8U=; c=relaxed/relaxed; s=zmail; d=ziyao.cc; v=1; bh=Fkk4/kq+/4cVPBpGUr1xAGacHTQWA+utvc5482NkPUU=; 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 1796321214275302.97167418094966; Thu, 3 Dec 2026 10:06:54 -0800 (PST) Date: Thu, 3 Dec 2026 18:06:44 +0000 From: Yao Zi To: Icenowy Zheng , 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 Subject: Re: [PATCH v2 0/2] clk: sophgo: sg2042: Keep gates used by firmware enabled Message-ID: References: <20261122-b4-sg2042-efi-rtc-v2-0-6d087e03e4e8@iscas.ac.cn> <179579169278.2788166.8963233310700352675.b4-review@b4> <20261202145034.GA768275-robh@kernel.org> X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Zoho-Virus-Status: 1 X-Zoho-AV-Stamp: zmail-av-0.2.28.1.5.5/296.294.99 X-ZohoMailClient: External On Thu, Dec 03, 2026 at 12:29:33AM +0800, Icenowy Zheng wrote: > 在 2026-12-02三的 08:50 -0600,Rob Herring写道: > > 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 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_READY. > > > > > > > > Let firmware list such gates in protected-clocks on the clkgen node, > > > > and keep them enabled. > > > > > > > > qcom, the only current user of protected-clocks, does not register such > > > > clocks at all. That would break the I2C controllers Linux uses, as the > > > > 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; suggestions > > > > welcome. > > > > > > > > Tested on Milk-V Pioneer. > > > > > > > > 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) > > > > > > Hey Krzysztof, > > > > > > Using protected-clocks in the way proposed in this series would give it a different > > > behavior/meaning compared to what introduced it in Qcom: > > > > > > - Qualcomm skips registering listed clocks. A consumer requesting a listed 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 releasing its enable > > > reference won’t turn off the hardware gate. > > > > > > 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. > > 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 = <0> > /* doing nothing */, <1> /* keep the corresponding assigned-clocks entry on > */;` ? If we are introducing a property to protect clocks used by firmware, it should probably protect all its states from changing, e.g., rate. The firmware might expect a specific rate for the clock, and if its rate is changed by requests to sibling clocks sharing the same parent, the firmware wouldn't be able to restore the expected state without racing with the kernel. assigned-clock-rates/parents aren't a solution here, since they're only initial settings and not exclusive. > Thanks, > Icenowy [...] -- Thanks, Yao Zi Meow-mrrp-mrow, I'm a cat.