From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.180 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796305275; b=HEeROTRKVsZJSOXaOPK3BRELFPCDyxMzLBszxnqzRg+daUWEEROj/XNtt9qtDDnRtnu9 v2YjDQkMv2GYad5UV8FTycSHIH1Crtp2VlOXBoRPUzmxV5JmHOfJKapUcsO3rXi22IaF5 y/6XSGp3HsB8n2CTYQY4aVDcEsw80ETNhw6QK3nHLyuhxdXeFncNZ/he4aNmD6GzHkyQq 7n9Z7DxEBzueOEFKjkQvKsK+O3xnT5BukXD3aLCdf+nd5DnsKHEQZsgSyfstv1mtvVME5 AIovcvIf/AxxufqDQp/sfBUb21tl54tocptc14NhI7/d4rqBuCMBsgQhHj/RrW3Ij4g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796305275; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:Content-Transfer-Encoding: In-Reply-To; bh=Ww/arpfZ27mVXeacLB2qR69V5X7hhw7l76wP7eEo5Ek=; b=WsxXOPAA3DSbJ/lsVeecZJjxkZTD3bntGNrfe9h+FRrWFlV9JseT4Zd4arjUgzIpt/1c PUnXvJawQB8hQh8KaL9TzKOwBF6R79YU7St64WnB2ss5ir+j8mWFY7IQpl8z0cFUsJyy1 Ixvh9rM+rxJS1Wlyu/9+RHfzkMt32jP4SuDA7HhIlEPLukVo13Yi8g0h1ID2BPBfKKlv4 UK2KLdAVUhebJdVKlSfcCXhaQ5zoQTW6AHOVXozTksBLg3/XDVYMUkd8BHKA33vmBikek 10NsvV0o4Opm2YIJmFCNMbDERtwRUWo67rzyU7TGDf/0801ISeYgJ9OjFwhsFRLjaSQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=RwE6vjKY; arc=none smtp.remote-ip=209.85.214.180 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42C3A606A684 for ; Thu, 3 Dec 2026 13:41:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 42C3A606A684 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=RwE6vjKY Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2f02f04a426so107900105ad.1 for ; Thu, 03 Dec 2026 05:41:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796305274; x=1796910074; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to:content-type; bh=Ww/arpfZ27mVXeacLB2qR69V5X7hhw7l76wP7eEo5Ek=; b=RwE6vjKY0NutDES4AyoOrLzr6rmXz3bVvUHh1qxj+JSQQRBEBe5I1tSoSS8jaHClG1 HLcIgmOwxK4ryPG6t2fBuCv23+Kxed8TZl4VMbR4RtGHLmAdXvkoR27+/6R1ykB0MjFB WLUpY6OJFQpq7DCDr5e71+oU2VJrWBwhMqTAJIsOcOJRLaGWo8YBOnS/+7j9zIc8xRyu AYwRPQUj2cQRrbhCT0UlUBpAn7pI67svFSONLX5KRsRg7rYtxFmfzgKeYqUcYBxQz+Xf o56PwKLk35uoudFxhMSSOyRsTDfohvObYrE6b7Zz8gWObIGdVgLBDPwERq+7U6aTnCqz RtfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796305274; x=1796910074; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=Ww/arpfZ27mVXeacLB2qR69V5X7hhw7l76wP7eEo5Ek=; b=XiC3AZPlkDQXSBn/ozg1jCrK9udSD4ybS7hHY+eMZaUt6TfjnCJVxp04aiB5ynghK0 h71t3L3surA98WWzILlbzu70tnNvzYQpUawpym0rHZDNt1UDp67VX0v3FcF5P4Oow6aw E21rtoEHDNteftvJx+4QH5p0CJLVIjMgNdx2/NHIwjZHNDlel7eBddtzQ3c3ukwMrABE bohpQ7ScuNzLKNv5JQKpV08Ymk/DSRmD5wHWQyvaZuEiLkIBQPZcQYLHvTrhaSoYAPea xeSWCpPVzj2sTiKiVfY8ADt2+Egd1q4ifZZn1NuzOPAFPkPGDrGQSPdb2saeylhYGv7g WFBw== X-Forwarded-Encrypted: i=1; AL+hErGMVb+akmgsZPtmDIwnjQjBiQmA2qeuY5xfJeTl9bgzmhzJ2gCXMPt5MGkJWGRD4Mfd3ailNHEmf3k=@vger.kernel.org X-Gm-Message-State: APuU4Z9vtKDKm/afQt9eNOsDWDNyJb7yynoiQd29jTnV7ECPKHOqZmRM tcmMVzgyC8POVcXB5mtAKN09LxEnLT0H/016y86S7u+yR/idu3u03xT8 X-Gm-Gg: AZFdTZdbE+1V0s8v7W73WZIvNoAIaVHfBTNHwI9+YbpyFf6xfTPusAxr8T8hAX9dkin cwExmYrAwXbu43AF+9cxnFLxh0TvJZPl6+czPVAiu1a8a+sPsASylO92O3mlNQhv2EcIfsSxsWm Amw16LqCTxD0fY65hl+SYrnX+Qs2ijB/uqmh4R91zfRFdlVE1O1SnUrjnqIpDp+5F8B30IoqEsB 3DhqMZZwQADhzyS5nmV2zJNoLnLZ4ryD4/OX5SWFcgrxU74G8kzkBdA7lAqqyJxLgb+8o7BPBX8 Gux5vHlAPBTkJKDORew1a6oLQvTX9Cy5IEErfUuW1+0ZGbya97oFnR5xHhTZ0uqTg2zhJ4y8TYq qM1ObtTNDu5aTjD0tCeU389cshVYIC2O36kZaJL31bWzgGmAMPGQEGsUQnmGYg9jFhl2oCVD3R4 Em9kb3kDn+MFeZMtVuBfDV7UHkXcrPi4cYBDNAj1sct3bJ7yqmMIidIzUFxMScfUUi6knRg9ES/ JeEujVVXaeAAGxL5qG939Enu0CJzqd+R/Trzz91H6zIgCldog8V4PIngy4C6Zl9EgtJTUc5qB5J xv0i4Ss58YjYlPE7vi8ME/0CUJE= X-Received: by 2002:a17:903:a8b:b0:2f0:42b6:eba8 with SMTP id d9443c01a7336-2f042b6ef73mr461364445ad.27.1796305274400; Thu, 03 Dec 2026 05:41:14 -0800 (PST) Received: from localhost ([2001:19f0:8000:4ce8:5400:7ff:fe0e:e6b2]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f070a12491sm196613345ad.8.2026.12.03.05.41.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 05:41:14 -0800 (PST) Date: Thu, 3 Dec 2026 21:41:07 +0800 From: Inochi Amaoto To: Jerome Brunet , Icenowy Zheng 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 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> <179624000421.3767986.8173736547788472972.b4-reply@b4> X-Mailing-List: linux-clk@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: <179624000421.3767986.8173736547788472972.b4-reply@b4> On Wed, Dec 02, 2026 at 08:33:24PM +0100, Jerome Brunet wrote: > On 2026-12-03 00:29 +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 > > */;` ? > > > For sure, It'd prefer if a property had single meaning regardless of the SoC so > not protected-clocks please. > > I thought this reminded me of something and we have been down that road before: > https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/tree/drivers/clk/clk.c?h=clk-next#n5600 > > So apparently there was good reason not to do this 10y ago but I don't have > the history on it. I'll try to dig. > > -- > Jerome > Hi Jerome, A new name could be a better option. My understanding is that the protected-clocks is more like requirement from the firmware, so the kernel must ignore it, whether it will hang the system or not. The usage on SG2042 is more like a negotiation between the firmware and kernel. The clock can be referenced by the kernel, but it is still controlled by the firmware. Maybe we also need a new clock flag to mark it. Mark it critial does not tell the kernel that it is controlled by others like firmware. Regards, Inochi