From nobody Tue Apr 7 01:26:21 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E988636F434 for ; Mon, 16 Mar 2026 22:34:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773700452; cv=none; b=e9gEhOmYjBtQ1GUhoIa4jpOlZ/6jW+Tse4yxrqjpp3+Zpa7GUTxEbGdrH2qfTt5EXmJYtVAoVGCmUswsgqEg72n3FvIKkmJ6uEhLYj9H4gzfLYgEGj/TVFQTRPrzwVk4EKCxmAj6jUVyjgKimwpQtRaNrQknh8tKszcn85B0APs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773700452; c=relaxed/simple; bh=0xCjTnQlG1U8KFxdCHLVY8uV/kewZx19MaNmIpedMpI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=QUTtNFBUp45gH3KPOK9DQMHGMvDuto5AwFMOakOZvoBZosjjQfOO6rAKpjFqkuUFt8fPf5UPAp8TK47kQnEC7zL3IYLRGwQvwA7uOiNslsUVBXn9FomQyyXdp+sDZAWltyUNbZvCmA36IHGKQ41UZgphZnSY6yCHymQILcSiSmQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=BQ3iEfey; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=LqHs7PTY; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BQ3iEfey"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="LqHs7PTY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773700450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Sx0g/lXtOSAsHLoQef9D9a+6NzioK6yUmBA2sZSWyI4=; b=BQ3iEfey3VzBxCUUkW8fr1bvztOpwWrXMV3SXs++ZuRp5IidWonEP7s/99fEQKExme+CWu JfJQFAi5cNRxDz90F4AA+cC5zP7o6Is+b34y9hE8//CqKGKeDiXKUozbH3M5NDK+xN9UuT copR10g760pATmAVEM+RUt0JVs7MFcw= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-38-X4BMddSJPuuSFUQ6MlUOZg-1; Mon, 16 Mar 2026 18:34:08 -0400 X-MC-Unique: X4BMddSJPuuSFUQ6MlUOZg-1 X-Mimecast-MFC-AGG-ID: X4BMddSJPuuSFUQ6MlUOZg_1773700448 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-509162597f9so14654501cf.2 for ; Mon, 16 Mar 2026 15:34:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1773700448; x=1774305248; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=Sx0g/lXtOSAsHLoQef9D9a+6NzioK6yUmBA2sZSWyI4=; b=LqHs7PTYmhjYdhWa5YjGW7wiKN0ntn67HZ9iT4Nw/hiPjoel9KLnKW6a0M7bnRmRfK atQCRJwSKCPemgZnYj7+ewEApHn1/jt6Y6MuhAd+mBrUBI1lkXptgJmzhwsHtsEaOXVe 7prTGLUXbKQSjvMmYoAbreG1l3ciZX5PQci+L6Wf2kpwhNvNN0ZFf8Du/iEl28x53Lao E1ifiZL2jsW25RkoV+xoaAqYtuCM21cPBAmspcN7ZMr9WJMpTWJOu/Kyd/NwUgS+DO+6 F7Vvr15AEqTMX9/hOiy3sMXYNJsYkJWK0QmoFvjV5luDcLmmFg6NOIx+haRHnbGcXUyo +mog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773700448; x=1774305248; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Sx0g/lXtOSAsHLoQef9D9a+6NzioK6yUmBA2sZSWyI4=; b=ZrHCCU0ASMkMVRhyMR9wE+hRM8DVd3eHSNjziYhqne9NfsaHHEcRgxDr6RTWj2Y99V XM0LIlmd556nQ5++ZVDqRZDEV66vEnYqsVVI88o38+oQs2e2QpAg00r29JQkhGV24ukD xv+f3ahhrpsGxBlGaugikwsX1mzghZwm9RO1/EQHKC4VI5HT0vm35D+ToBd/mJEMlcoI wuFdQ5KV7R+9w5+KNeyXvkTjD4Ut2jskooz9c7qKFVdvl2/BkvTL5omUnXfEhTQ/ES+L 4/5vUysoaN6vkSi1mI1Y2McCNrTeph6/7IM6EsanTwQIaoj4qY95wF0MGhpZy/MaOcfr zzHw== X-Forwarded-Encrypted: i=1; AJvYcCXbvN/TneCEYcaoKIGGeGGqD/TIjqULkjQflSyVzdLthirt8dNIcyd/978icr111lJzDqvrbyQ/BpkgnnY=@vger.kernel.org X-Gm-Message-State: AOJu0YzbL2Q/penYPOJ/mVaSV1+8ZiX8qfjIwQXoQyUVGsWSmW324hjX Agx93N8mCKXM/5XiTrZA/5pvHh+sBkj4agla9dU9iKJ3clZsjzHASwMYKi7pBh3vBjS1w4if15B iA0PBD3y56wTm9k2M8raY2/TT/OPIWWCbQ26VElTI8pvgV48f4FAJ1HxCCr+9vlLVR5lM9b0IEg eqqiND3UH1VPhtvr9gBqPTg9g9evoXqYeoLI6TgzWmc2rjPk0M X-Gm-Gg: ATEYQzyuthY35LTNHkycD+HTkkopfI+2MW3sN63usXD2Wa4V2AZwbSCzTAvMHt8BRO3 kD6wcjkfyTo2CSCReOiqkGBEyZ/F/xPBAvDDV3jJerW8R3GUK11G4tCQYrRONHDHsAMDV9+R9Un p3wuuElsh4N0eIZdxnU7+S3Aa6QSwRcOD9sfDBq7odFCqZB9YLd3ycRghqyjoub6u22ualxWj+L 7DjLm3STaNnZMVZA+MkrsDQVL5hj9uDUU6eP4F4mlEtZMrcm0JEuetGFFkgh0ekJwTMqzF9KiYO IM38s1AHEeZn65BmZjYuEV224aDFWB9VBFGir+fnsonkwwRtPkp612MUZMdvcvq6MB2NS1We3Rz MDPEDQZJBqhTe30vJa2M2rsCmw/J8q9+CfK9x5ri3+Cq6c+61Z8bmFZEPKGU6 X-Received: by 2002:ac8:5782:0:b0:509:1b01:8916 with SMTP id d75a77b69052e-50957cf51d8mr212788001cf.4.1773700448136; Mon, 16 Mar 2026 15:34:08 -0700 (PDT) X-Received: by 2002:ac8:5782:0:b0:509:1b01:8916 with SMTP id d75a77b69052e-50957cf51d8mr212787461cf.4.1773700447549; Mon, 16 Mar 2026 15:34:07 -0700 (PDT) Received: from [192.168.1.3] (c-73-183-52-120.hsd1.pa.comcast.net. [73.183.52.120]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-5093a0e9658sm155941071cf.21.2026.03.16.15.34.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2026 15:34:06 -0700 (PDT) From: Brian Masney Date: Mon, 16 Mar 2026 18:33:45 -0400 Subject: [PATCH] clk: add new Kconfig to control default behavior of disabling unused clocks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260316-clk-ignore-unused-kconfig-v1-1-6e95a4fb0c94@redhat.com> X-B4-Tracking: v=1; b=H4sIAAAAAAAC/x3MQQqDMBBG4avIrB2ISpPiVYoLjb/poExKglII3 r2hy2/xXqGMJMg0NoUSLskStaJrG/LvWQNY1mrqTW/N0Fn2x84SNCbwqWfGyruPuklgB+ewPJb nYCzV/pOwyff/fk33/QM/YYCTawAAAA== X-Change-ID: 20260316-clk-ignore-unused-kconfig-7e77eb5b8306 To: Jonathan Corbet , Shuah Khan , Michael Turquette , Stephen Boyd , Maxime Ripard , Abel Vesa , Hans de Goede , Saravana Kannan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Brian Masney X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6205; i=bmasney@redhat.com; s=20250903; h=from:subject:message-id; bh=0xCjTnQlG1U8KFxdCHLVY8uV/kewZx19MaNmIpedMpI=; b=owGbwMvMwCW2/dJd9di6A+2Mp9WSGDJ3tEb9e+Bsy3LH9ekkvVKOWImLrUkH7vxM7GIOkz16Z dtTb3W+jlIWBjEuBlkxRZYluUYFEamrbO/d0WSBmcPKBDKEgYtTACYyxY+R4eIa/q+eigJWS5Qz SxtLJ992r3fUyv/AsPde5lS5jI/2kgz/wwQ2fFzB8V5jefVL43fbkrZ8f1nKWWcxq0++9SLH8X9 NfAA= X-Developer-Key: i=bmasney@redhat.com; a=openpgp; fpr=A46D32705865AA3DDEDC2904B7D2DD275D7EC087 At the 2023 Linux Plumbers Conference in Richmond VA, there was a discussion about how large number of systems need to boot with clk_ignore_unused. Per the discussions at the conference, the existing behavior in the clk core is broken, and there is a desire to completely remove this functionality. This series introduces a new Kconfig called CONFIG_COMMON_CLK_DISABLE_UNUSED that when set has the existing behavior as clk_ignore_unused so that people no longer have to specify this parameter on the kernel command line. This Kconfig is disabled by default to keep compatibility with existing systems. A kernel that was compiled with this Kconfig enabled can have the clk subsystem disable the unused clocks by passing clk_ignore_unused=3D0 on the kernel command line. Note: The existing clk code calls __setup("clk_ignore_unused", ...) without the equals in the name. So someone can actually pass a kernel parameter today clk_ignore_unused_foo that'll also match the existing parameter. We can't change the existing behavior, so we need to look for the equals sign in the value. Link: https://lpc.events/event/17/contributions/1432/ Link: https://www.youtube.com/watch?v=3DtXYzM8yLIQA Signed-off-by: Brian Masney --- I searched the mailinglist archive, and couldn't find where anyone submitted something like this after LPC 2023. This was the last suggestion discussed on the LPC talk, and it sounds like around 14:40 that this is an acceptable change. I looked at adding some Kunit tests for this to clk_test.c. I planned to export clk_ignore_unused_setup() for Kunit testing, however that will require putting "=3D0" instead of just "0" in the tests. This won't match the behavior on the kernel command line. See comment in the code about the equals. --- Documentation/admin-guide/kernel-parameters.txt | 9 +++++++++ Documentation/driver-api/clk.rst | 7 +++++++ drivers/clk/Kconfig | 16 ++++++++++++++++ drivers/clk/clk.c | 17 ++++++++++++++--- 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentatio= n/admin-guide/kernel-parameters.txt index fa6171b5fdd5ff55b3203272568509bb45c69856..d559c387ca32425c0a3776bec89= 9f48a21ed3026 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -830,6 +830,15 @@ Kernel parameters platform with proper driver support. For more information, see Documentation/driver-api/clk.rst. =20 + clk_ignore_unused=3D0 + [CLK] + Force the clock framework to automatically gate unused + clocks at late init, even if CONFIG_COMMON_CLK_DISABLE_UNUSED + is enabled. This overrides the compile-time configuration + to re-enable power saving by disabling unused clocks. + + For more information, see Documentation/driver-api/clk.rst. + clock=3D [BUGS=3DX86-32, HW] gettimeofday clocksource override. [Deprecated] Forces specified clocksource (if available) to be used diff --git a/Documentation/driver-api/clk.rst b/Documentation/driver-api/cl= k.rst index 93bab5336dfda06069eea700d2830089bf3bce03..31ce4e3889f09a4f9c3b63cad7d= ed214125702f7 100644 --- a/Documentation/driver-api/clk.rst +++ b/Documentation/driver-api/clk.rst @@ -266,6 +266,13 @@ parameters:: To bypass this disabling, include "clk_ignore_unused" in the bootargs to t= he kernel. =20 +Alternatively, you can enable CONFIG_COMMON_CLK_DISABLE_UNUSED at compile = time +to prevent the automatic disabling of unused clocks by default. When this +option is enabled, unused clocks will remain enabled unless you explicitly +force their disabling by passing "clk_ignore_unused=3D0" on the kernel com= mand +line. This can be useful for platforms that require certain clocks to rema= in +enabled for proper operation, or for debugging purposes. + Locking =3D=3D=3D=3D=3D=3D=3D =20 diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 8cc300b90b5fd9fb38ce94fcb1098810c3f52c36..d7503517f6ec1ed773b2dcb9e3a= 7a0b5bcdea353 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -33,6 +33,22 @@ menuconfig COMMON_CLK =20 if COMMON_CLK =20 +config COMMON_CLK_DISABLE_UNUSED + bool "Do not automatically disable unused clocks" + help + Say Y here if you want to prevent the clock framework from + automatically disabling unused clocks at late initialization time. + This keeps clocks running even if no driver is using them, which + may be necessary for certain hardware configurations or debugging. + + By default (N), the kernel will automatically disable unused clocks + to save power. + + This behavior can be overridden at boot time on the kernel command + line with the parameter clk_ignore_unused. + + If unsure, say N. + config COMMON_CLK_WM831X tristate "Clock driver for WM831x/2x PMICs" depends on MFD_WM831X diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 47093cda9df32223c1120c3710261296027c4cd3..4afbf011de6f1727a2bf330465c= 95407e51d04ad 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1508,10 +1508,21 @@ static void __init clk_disable_unused_subtree(struc= t clk_core *core) clk_core_disable_unprepare(core->parent); } =20 -static bool clk_ignore_unused __initdata; -static int __init clk_ignore_unused_setup(char *__unused) +static bool clk_ignore_unused __initdata =3D IS_ENABLED(CONFIG_COMMON_CLK_= DISABLE_UNUSED); +static int __init clk_ignore_unused_setup(char *str) { - clk_ignore_unused =3D true; + if (!str) { + clk_ignore_unused =3D true; + } else { + /* + * Typically the equals is added to the __setup below, however we + * need to be able to support clk_ignore_unused without an equals + * since tons of systems just pass clk_ignore_unused. So look for + * the equals here. + */ + clk_ignore_unused =3D strcmp(str, "=3D0") !=3D 0; + } + return 1; } __setup("clk_ignore_unused", clk_ignore_unused_setup); --- base-commit: 95c541ddfb0815a0ea8477af778bb13bb075079a change-id: 20260316-clk-ignore-unused-kconfig-7e77eb5b8306 Best regards, --=20 Brian Masney