From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.182 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796305275; b=5mfNYwZdYqcwgbbtXElxgZiBmuFaE/CbzdqzOPd78vA7mpqS1bQUI/Zj8bxSg8ayNa4K Fkq9zkTL62cridUvylmxGUkbjoz+bAs3vJB+ixovfWmVFlAZ1uiKozJ7YKt7oGH1DAVGz j3bMb8pTQ51uMcKC1s/bRFSLy+tOAdzYZdwRrg+c4vaVZvTYqx2m5D8p7ZK/C6hiVqVZ5 K+i4g6rMVoaW2Lcq/7YbURZH6G2rXnlZuwE+zgC95W7gTwubMDXEZFtnivFv4NK+8ydKp OuTBxEuFs8I2flqG6AAPk1JqJ2DB6nBcibMwabBVwY4hu83x+FTAWyYs6J4RhXyBN2A== 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=oPmuioo7Z9uAuzRL0uvAYyZshzyVH29TmRuxw/l4oyN8dx9jjTbibOF/iHb2vE6bItZz J8HcLtPMCScuEfmjdXaIr3q9cF0YushRRtTshOEvbYn3aUVnE6CG8C3SUeupuyzzvNtrt EtLJ8LjSAviZSHEGVdv6ccqbQ8Ec/48Ec2X2sTpTrssYmwvZPFhVl7q4o+mmrii4Q1ur/ +Kuy7uSPQE8svWJ/7xWFSH0Ucw3//KiyOGztAAP+v7YedgLKvcVPk54F4C/XpUZ9cn2ad 52990oN1OGBibAb/p2taFeuFfBre8GtZXzK/qiBV7Uzo6rU9KYGX+oRbR0JRon+RCNA== 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.182 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 4ABEE606A686 for ; Thu, 3 Dec 2026 13:41:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4ABEE606A686 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-f182.google.com with SMTP id d9443c01a7336-2f01f296937so108790025ad.3 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=fZYBQVx1oYW/KH02xYal+87/NiMgxzg0quN6WG/L83lceUB1+BbqWpGvD0r8Oi1uEx /raOPO8gHbEfL15hNHBFqFt2QdIeQJ2jb5aWCXZB2tPr6OPfYgiTyyHDqG/8jCoPoUAe NTLeKfpYEq8R7swj0rBSp8yqWk+AEV7UVovKH3Ii2OeSVQfUYggizeiR95vC7E1J+XpI dS+H3C41TjyRznddH1VxVFdG3roz6ZKejeOukZiuts1y7JSLaOc/ReG2vsQc4Vz0TFs1 pGZKhH7BwwI2qfQBoUfbgGi7wRSVsP9CtO59toiFuYYLJVRkXCvEdUyMNlwvfbeekycx ZKuA== X-Forwarded-Encrypted: i=1; AL+hErF7OcQO4vhRpqOgO4UrXh/sbYVWdK4tnmTjDQhopDMUfzLu5Ufq/qNTDqqyu/OAzVeBsTc/+pWvsZB5@vger.kernel.org X-Gm-Message-State: APuU4Z9fKGmsYLkzu+dhxj5gwP8ZhHNx0fT27ZdSRMlV0nSbed3LOqRh DJPWYqnTvfl6ahJ3tZ0b5FLYcFjsm/I/w3vY9YtW0xymnsBK4Ufb+lDccbwC+7qo X-Gm-Gg: AZFdTZdNSnRSptW4aliTTRrrd/nTc4u62UQg6U7RldHgsT2iwuaDbofHL/N+ASalspS 1AVaCtUGOe5fVfWhuaqr/3uQh5T3DTwjczDBU8+JgC8bTwf7WPb3QmOjW7C6RKu/N2xKE/eqvnA d7ojxiNDDqHIf2XjKu5kPG7ey3fQuwWos3J16mQ0BkXQ8pyTIi6nO49GmhvWgDCN41YDyTiqmLd HFMhEXgQfW2G5XDtCOtSqGJ2WlEGQUQODkmXjVe5jO762STJ1iLFwVu+W/UIZ6lnapW2m3ljH8l 4GKyYBPj/wuuCraGmod268T65b+rok8PAdihhnFn78en6Ai5dk2NGLZ6jXqnz2EClANoON7JfMn 3HClesoWT7diBqxhv5jeZTzHwozFx19tWnvJRATOgvVmxobX1+ENJDl6hYj0JY/hxBlnUBmQNfC bs51LtpiF2dGa+xlHMkTX+iOr6hfrM6mDXaG/mVqBsn339WR8IuU7beCd1YCpsauAxzfDJCiGCX eXND2kY4Q4nsQWWC0pQMMIma3pLLJukP9vNxq+eYcKa0EmjaaP2rVtla2SEbHvZ1cMit75IpAmQ GvtupZhzVL7CN2GneV5w+6mEcBM= 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: 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: <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