From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796240010; b=TtZentUmWGcNIbk4N+LO9iVM+D3NWbRXOQ9ubvK3vj130EqoGgOsmUWAh7tIEOEO68ht kmq0uEsqZEQrizwm9Ppzwl0FEtxJNsCMq98aeqKWs0Y+KnYKN3bFySh4UIuf+v8QoYCUi Sa4hZLai9cZnPcWTZaO1dhinQHyik+UddS95jJ4CY0dsu0eIPitrBryEs7RXT9T2vQ++7 SiR6cD5UOhH94/9SZx4BOFJd55IuWSliAvs+oe0hKBt9ya+hkHgG+pGFF1xilSejPXUVr mgquenuaM5nrHeKCBfdP/6zXV5xRXZYqvNIDyZA17Lw8PQQ6jB5L7Jvb+kM0WE1Q+1g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796240010; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: MIME-Version:Content-Type:Content-Transfer-Encoding:Subject:From:To: Cc:In-Reply-To:References:Date:Message-Id:X-Mailer: X-Developer-Signature:X-Developer-Key; bh=1c17NNB9an2nqqe/XZhcM9yTjxjh2SwV5bjNwxST7Yk=; b=NYJKLauml4k/GhudmFWefmsaGJfydYKKAZz6xFPK5tq1Cxi2kuWiCkL0Bip5PZldBPP5 uXHo8B4BTwUoXxSZvP2o1OnNYbwFOmsPL/fMDLziTgNCzlCTG+Q3H1JTtM+gN9pjXbPnw CsGTg/ZVwA23IcXjrH7chgUdIXz0h4qINd9wMO03lw19RN8yGfHBQ4RnFKMopPuq9qmqu xj9TDhIdjX59YXjMKzQ8WWS9h7R6AEQTWqZOAj2m4rOh92EEdjtLDM/DR68hvPqdbRt3P XfUBHTFonf4fg2GlHu/oihJwdWEO4fhp46oAVizE2tZyKW3o/oDFwZiapEYUkZBbryA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=LM9sVj7V; arc=none smtp.remote-ip=209.85.208.46 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 D3385606A32F for ; Wed, 2 Dec 2026 19:33:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D3385606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=LM9sVj7V Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-6b88d143160so15822430a12.1 for ; Wed, 02 Dec 2026 11:33:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1796240007; x=1796844807; darn=vger.kernel.org; h=message-id:date:references:in-reply-to:cc:to:from:subject :content-transfer-encoding:content-type:mime-version:from:to:cc :subject:date:message-id:reply-to:content-type; bh=1c17NNB9an2nqqe/XZhcM9yTjxjh2SwV5bjNwxST7Yk=; b=LM9sVj7VVi62irfbb5xnpGwdR+AT54dUtrVQmJwqbRss3EpGxv8eV+wzu8LHyZBqUz 4+G8NWc2NvY6A6+B30vxEmU0yMFQuQCft/rGasHb0Twg5J2vb4ymfANDGT4IQleGBoOX DO2r0oX4QJRdf9ytixqPW7dmCZidqJI9iN/0m/8zuhhDy1ctdtS30qbEcFvvr/Pr1GcP FKJ0RfxM7LVut/6aI3errkErbzmve9PJuFDrSDIcVLys3D3we8/dBMgW8IpPOk4xS+rL rlorb1QCI/nYdZAo7Kuhp6QjNTtnHj8f+7aTFRivtI7FvtYswTHkVJkq0aKjxRFtelJH kJHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796240007; x=1796844807; h=message-id:date:references:in-reply-to:cc:to:from:subject :content-transfer-encoding:content-type:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=1c17NNB9an2nqqe/XZhcM9yTjxjh2SwV5bjNwxST7Yk=; b=GD65oY8+wPgOPKK80CD6MgZKF8BJVx4nLCl8C9iSeAQxnquSkPIydb4EHM8LY4oK3c JwGVCDgYjSlPGiBeHD7J/Nucg8LlkIgseF4mcv/KyJq/ySe7RnDZ6OD+ObWsCnRgH/yd Eul4O9R7wrumZrM4qLk+/62wV3XVQoh6TVMYFPdLONdA2fInPDDdTGYNOKLHK6zNtAbE vJsi8baLRcngIVCW8HoJ3zR95nwxndEOQzPkniPsQetJLJb8M7heH2abgHeEZXvC/IRm RMJ770wrO1atUbhA2Nr4kViOn8JVtDoxEeUO83fasCeZhsREcR+uSNuIAVLzZwZGkR+A bE6Q== X-Forwarded-Encrypted: i=1; AL+hErGOh3aMCavnuCeX1FNLesRlJ7cjU/xUxtThzpaiwn9MqwyXXDwGqq0HRiPB2ftQkZQwKlV1N60k54WjiAg=@vger.kernel.org X-Gm-Message-State: APuU4Z8g1P7iXoM1LGNw8fqhR7bdBqlOqVyHrkARz8aDDoWJRrWFjlHk Tyv3RW+o9IoRT3o1VI/ofNDuBgZ5hkHltcQ1YyBhIZ99u5hP4F68jwa8qdNhhmzJ8LQ= X-Gm-Gg: AZFdTZeuX2ObX4OVcuyMqJfpiJxixTmMg0gU1ac2sBAVLAOxCP5dj24ef6hhsbtpkmY S583JFec9NHnDkjmK4mYRbOD5EjCJfwLgN2Y9BQ8GEmgXgGOVu8i4iE2Gk7z8/BJ+1Z3MUio7BZ IaIdM/15dgjkbcOQNiWXZrynB6ysHMLWoljkzxgJWukeFzREByD7YXVODDZZWb25aj4Dubq23t2 iKNPkx8PlLnMJXo5LCXU3AGpa+x70/oWjcr5Zu2IK4kWM6Q5TJ/lhN/T95k1vtd4FQ3DkvAclo8 aj6p0q0sHY1lzGgzBo9RQ0q0MwVQidG8fyrkRfA0yoF0/HXNnuji3E1GG/NyHa6rx3qHeSDhaP2 Z3blDZqOGaND2H4Vo2WYPShc9/4NQWAp59EzUTRSx8/fAl/1p8gKaLYo/CzCmoDQ122ydfCh6I1 pi9BGTXsWoBVfuPJ13wsqCK54Ye0JVWMarBWVEoeQGyWKeHTxex7LkMlfgj4qHVFiR11kdPquuQ puHMMD/eaTsmzPvGIoGlhXCflV1GmVUbvACpRqAtzDmgwU7F1PM+E0ftoVWHXZBYWtgfibro9KP 1Zqkxhd1Alt+vZElEyOsTShw+7Vz5i5EdoYhdpxo9dd9ZzuE X-Received: by 2002:aa7:db4d:0:b0:6b9:2910:423a with SMTP id 4fb4d7f45d1cf-6ba37c7bbfcmr22321851a12.2.1796240007240; Wed, 02 Dec 2026 11:33:27 -0800 (PST) Received: from localhost (82-67-6-57.subs.proxad.net. [82.67.6.57]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6ba370faeeasm17322258a12.22.2026.12.02.11.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 11:33:26 -0800 (PST) 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Subject: Re: [PATCH v2 0/2] clk: sophgo: sg2042: Keep gates used by firmware enabled From: Jerome Brunet To: Icenowy Zheng Cc: Rob Herring , Jerome Brunet , 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 In-Reply-To: References: <20261122-b4-sg2042-efi-rtc-v2-0-6d087e03e4e8@iscas.ac.cn> <179579169278.2788166.8963233310700352675.b4-review@b4> <20261202145034.GA768275-robh@kernel.org> Date: Wed, 02 Dec 2026 20:33:24 +0100 Message-Id: <179624000421.3767986.8173736547788472972.b4-reply@b4> X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3592; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=CJzoZicZTSaWgD0YhUFtPGelbl9CVtU8IbuYqn/rEBs=; b=owGbwMvMwCW2VtK+WnvWU3HG02pJDNkCRS2hrzYd3Sn19vAib/H8jGVSATe3PPn27KlQ8KFnO SblGS0tHaUsDGJcDLJiiiw13NXi7yS1vsyarnMbZg4rE8gQBi5OAZjIikKG/8EyzQkW/YtOZPiv VLp52jWq9qU0Z6n2Vq4VRTYunP94fjP8Zp9hYxTQLpmc+DwzxCxdv+K0eidvx5djRQxWTe3HnyS yAwA= X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 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