From nobody Sun Feb 8 23:19:15 2026 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0652221277 for ; Fri, 6 Feb 2026 00:30:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770337814; cv=none; b=W+lmVsJY/QrzlfkQ6Sqm2W5m8mvR1k/1GZL/uyVAsUgKkwV7VHwjvtUcGMQF2AhmF2TeT5SBrlhizIJOF080/nGlFmJ/haApedMITKm7myCytMSrtHhmi9ISO/Rwvur8Os5jFHuGnC/b9bCT0yNYsWWw8PrHSkAXjMWd6IuwVJw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770337814; c=relaxed/simple; bh=1jGOBqEAdToOhyDULhg4DWaXfwam16dPRiJvXBh0MIU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MW4EqgiR7y+HIzwh3Urdg6HeTK7tB5qDJKrzsIBoSIqJeptHBYgzd+GwEWDjnHWcS3Pw83oKrnlTsC+mJ4Z7KRIaoBvg/3MPKDjYqh45f4+xegIiqqT9793Wc5p1BApylLIo8bOlVTY4iGQYQsZ/DBxJc0SZ6lKVQWKeXomeJJ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=HAoR/549; arc=none smtp.client-ip=209.85.216.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (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.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="HAoR/549" Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-352dda4a34eso582320a91.1 for ; Thu, 05 Feb 2026 16:30:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1770337813; x=1770942613; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=RrN3Hy5+qjniQM1xljDClFlyW3uFR+YG06Wn9GxtVMU=; b=HAoR/549PWWkEzbdMaNeX76qbsef7aFVCwHvmkc8RB8dMLb7JAKq2l9tBuiQjNU2kK tFknZnFmuCbsZaqacm7NanOM2vRpLj9Dsx16xXRyBKXJABBz9OBNKs43te0/TJmdgpmd PI/hrwmP4/19BfwQ3/Mupw+BzRWOWmOhSkxFF7lCdY7sx+uVXGcO7AiDzMV8fNRyjtrJ GPplGXE8HTenoOfODkP5p857H0+5GYeEzpht1yU7EoiY6ZGuaSWIGNeMT+SGDXiLB3Ve 9rbVyXiLgBfnfPDeQ2W+pM51RYVqFW1+tC0jhakgvpRi3+Ti7Jw4nkieU/wpcn57E20F KhYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770337813; x=1770942613; h=cc:to:in-reply-to:references: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=RrN3Hy5+qjniQM1xljDClFlyW3uFR+YG06Wn9GxtVMU=; b=YEM+j3wDfK/NiRT6YvHIAvNHJnsYQ7cXsxPVU5I6ZA9rpApkYMvCksDPyWPxB0cTst zutU8ilf77AueM65epKD9MJDTxA0XsYIbcZtz0FxDHTHXFzrchQhly5Nkl6HUvI330jy MD8uHWG+xSWbBZyTV+JRY5A2c8DMrrDsPNdV8hA0lQ7pVSsKXfh4abnJp4UuWOn9q8JU mweRs3TKnDVivpUe9omh0ySonVIKe2aAdgIYxiNkM1XRU2cP2f5ip7IQtEjmv9CQbeko NGcAKaaAVcNl62QIiRsPppx4IXKHlZ3bx+YmuvIuvV0YZ85ollUB77OmBBNQwo30y37A 263w== X-Forwarded-Encrypted: i=1; AJvYcCVWicFpco5v/G9soKLFQEI66TpKCKaLGTwk/nXL+jv39uwFmruAC+C8C6yKiqfVTeS3Fk+WVmDmLh2A9Yk=@vger.kernel.org X-Gm-Message-State: AOJu0Yzg+1fZn1cMMmF+VrWF66jkSOrxuNcftPSSbQqzOrYnHJK3yXm6 L8/KKVPkYbWBJc24r3xNwQkMtjcU0ogn8o7ihIiEweaJOAFF5snuKiXG5kAvTKo3k5E= X-Gm-Gg: AZuq6aJKywgzye/TtSY6dE0uCqITw05GpC5KavaDtwVwdx5wMGgO+vyLiEK8H34nrca zEQBn8w+u4f5s4aCNCuK3Plj2/1P/zqfWUANOBBcTXHbDFY2iT/cTDwf13e9YMU5CVYMejNAvs9 WNzq8L5ulaHj3isIubCSDAzM1l+LT0ioeyUZZf5HA9s5unmesKFknT3dpORcSkA/usi2r1AtUTC RX00/jaKMWVzkswR/lSOVkQeMR74Yv1c2Vs+in8T+I42F3SJif4AfAp/a0euioW7+dnhK8NEixB seGU6kA/KaeOwBa9VLZ2G//CbuIMLmMq2MANzqeOkxG0pDCAXFgwHN1k0Emc7yjW3fYSXE8/8bg /cjXSOG2y8xc4E3JZAOOYEbMLF7UxqKUALIMzqXe6AYFDTEZiQ0XLBPPAbxE5s5NWcOM985iN77 bVDcT6QIPn X-Received: by 2002:a17:90b:4c8c:b0:343:684c:f8a0 with SMTP id 98e67ed59e1d1-354b3cda0f9mr723619a91.23.1770337813050; Thu, 05 Feb 2026 16:30:13 -0800 (PST) Received: from localhost ([71.212.200.220]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-354b21f9178sm795845a91.11.2026.02.05.16.30.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 16:30:12 -0800 (PST) From: "Kevin Hilman (TI)" Date: Thu, 05 Feb 2026 16:29:55 -0800 Subject: [PATCH v2 1/3] PM / QoS: add flag to indicate latency applies system-wide 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: <20260205-topic-lpm-pmdomain-device-constraints-v2-1-61f7be7d35ac@baylibre.com> References: <20260205-topic-lpm-pmdomain-device-constraints-v2-0-61f7be7d35ac@baylibre.com> In-Reply-To: <20260205-topic-lpm-pmdomain-device-constraints-v2-0-61f7be7d35ac@baylibre.com> To: "Rafael J. Wysocki" , Ulf Hansson , linux-pm@vger.kernel.org Cc: Dhruva Gole , linux-kernel@vger.kernel.org X-Mailer: b4 0.15-dev-47773 X-Developer-Signature: v=1; a=openpgp-sha256; l=850; i=khilman@baylibre.com; h=from:subject:message-id; bh=1jGOBqEAdToOhyDULhg4DWaXfwam16dPRiJvXBh0MIU=; b=owEBbQKS/ZANAwAIAVk3GJrT+8ZlAcsmYgBphTYSsed0yG8Ju3nJQEklrOCU7mygfYzJoj9nt OFJnIjrKgGJAjMEAAEIAB0WIQR7h0YOFpJ/qfW/8QxZNxia0/vGZQUCaYU2EgAKCRBZNxia0/vG ZX4ID/9uSj0cth+0hoHlHMuGLLIYCcuaJFmgLdgB18tlG8nmEMwacfl1Vh8RRD2ZVvaAQJ/tB0m 3Sitb1on4EA8p6dUvf6PgaDklZ/ylXT5Hgr13fwI+hMEYQdoibHi4M05hiaMvo7gJHtK83jOSYw sZvLqzmT2UubWRMkwjXEscxyi2G9DHqYBnREI86qQu4DA7fEyWBOHa1LWsFmwQqhnuMenbyOaRO +8ysdEsqkd1bGWEKBfmDMcd3FXteDrzaYtRd07YOQJUPozn8WYeGa6sWlYBYC0lYO/URZTqO7cz fJjCEB1I5jefrzH3C87qUArKlYraij6anODKOpE9zDSWR427mN+GYXgv5Ziz4kHZEkOLgT6AgRk Z4m47lAGCLKB5YDKctVQkIdNSqdBtfm0qxQjAEqWdQdwWk9pQRt+auefLCJPaOKyxeV6RsKIxo7 FjXXnT2sxN7sWAX1bvB96vB6gdkjMZQ9NJtd6lNakddBO+lIuPcAuWOjteIfnpCDsx8iqscL2Yf /vr47dJla6S4v8gybSiUumTT9TBDiVKdsfiJK7layLJxTViS9+vROdZsUZzIZrUac3XVuLm65s6 ts7IbQ4LH+qi/3hhfLEFxVU8ZO5It6ntIv9g5zBcR78Tt6xn9YMzBYDYAc5+i6kHc0xcDqkUNfy JbvQEEJPvvuveLg== X-Developer-Key: i=khilman@baylibre.com; a=openpgp; fpr=7B87460E16927FA9F5BFF10C5937189AD3FBC665 By default, the QoS resume latency currenly only applied to runtime PM decisions. Add new PM_QOS_FLAG_LATENCY_SYS flag to indicate that the resume latency QoS constraint should be applied to system-wide PM *in addition to* runtime PM. Signed-off-by: Kevin Hilman (TI) --- include/linux/pm_qos.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 6cea4455f867..aededda52b6b 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -37,6 +37,8 @@ enum pm_qos_flags_status { #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) =20 #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) +/* latency value applies to system-wide suspend/s2idle */ +#define PM_QOS_FLAG_LATENCY_SYS (2 << 0) =20 enum pm_qos_type { PM_QOS_UNITIALIZED, --=20 2.51.0 From nobody Sun Feb 8 23:19:15 2026 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B39C19FA93 for ; Fri, 6 Feb 2026 00:30:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770337815; cv=none; b=dEW2iyrIh+Mtd0qkAASvmUjEmAYMHpg3dCia3DpTsazDaTLRggbminVpmkGzM0mJNjfPrar7/wgwocdWe3KuWpRatUZSjKsKU9bOkun2z7YRairZ/eUk1WAm4lK4Hy9M3+n3sJn2E1Y0fbFcLHqNZsNtlCGreNxRClJbKAN8/t4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770337815; c=relaxed/simple; bh=Kgntq9uZyzEnQnUEouKXldKwCVaQgcJWIll2FInth/k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=u8xNmeXJRnADObpfWaosOtm9am5jo26s97LE+1vG/+/CLMRfHmlgbdGt0uOz6yw8Qt40xup8l70r44w9mB+yvV4PnAAzuNMEujyz1qjgmrvo4bBs6RIKzipR962Fp6TL4Gv9/krXjKHYD7soaplJgql9dTeSQiqxt0g/rl57sHg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=Lu93CKjL; arc=none smtp.client-ip=209.85.215.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (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.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="Lu93CKjL" Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-c635559e1c3so674208a12.0 for ; Thu, 05 Feb 2026 16:30:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1770337814; x=1770942614; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6VYhisuJCgn7/wzkvegovAuOQw3aJxeJXxeQKQTcm9c=; b=Lu93CKjLNL+ndGCh4YZWr/Rux3rlLfyH/0Fz6Eb4hORK41ye/pqzJdZ5EiSZbTL9Jk cweBwjHJHTPTq5DVlhoLheWbJhx+WMY/fkJxvp5hWFjjISfVpBN8HEVjLVQPcw5VlaiH JU9WlGGzpOWlb8BLtzD4+UEVSZTuOCU8Gq9hVm8ck3PaZbvaN5q/39E3GpvRjrJvvzCM xZKu5xYFg/cqabSOUt67bGfknB5ArZ7TYOX2ol/rEiLZuXcjmbmjqfFmfohT8YEyw3KQ ps2F+AdeV7/CXnegdgI3iMkFkBHySCpHHjexFeonWNpKSjVW0yHAco1fVf5IKSwwemGO GZGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770337814; x=1770942614; h=cc:to:in-reply-to:references: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=6VYhisuJCgn7/wzkvegovAuOQw3aJxeJXxeQKQTcm9c=; b=W5B7ii4OMbZrE+pl8fa84bIbyMAjzR6LqcS+dxMld5zXy7y6jf+hjSJDSSXtmL0shx qIOj22Tb3wH7m6ylLtyPxApzQXeeR6INXEGUb9N46UN/8RWmj7e77WiAvMwdYo9spg2P qnIn0p6PZfB77bR9P6EA/MCHYubTTaGDa8/llnqklJJSR7U7jgkXO3cjst5E0I1xONGt TD6GO4Rf3fNF/PId7AqDYBt95ylYOsL4BOZTEUzSX870TYXHlHI8LUfSk3w3SVvr+0Jd 8QDSodM/asV123abOlBRkWmb5CIYuZGAatTb7AYaolMu7D51tVBkG+LdhzF6CPyVSWCf KGPA== X-Forwarded-Encrypted: i=1; AJvYcCUyV7B30sZ7+JmUc5PEB8R9XzFjUmljiUz9N85Y+BCnzKqt97NiPuzkDkFp2qxNUHrqet3gODYdinwgNvU=@vger.kernel.org X-Gm-Message-State: AOJu0Yy4H/L7WOizZ831T7OcuMMeN6VmdjEHWGIYDE6h/H2FAS58HwC2 7wfnEj2ctsOR8bSajhVUn31w7WASuPtCb1x71ueUgjdGzVJli3e5jQb4P1H3AEASUv8= X-Gm-Gg: AZuq6aLBnqZv23/BxTgnUj/vlGOnL4kE9qI+npO0p8kTVVXr5FaTfmbRGYuzKgAxklX rBbEy2vCjocHHxKCUet+DZwbdiwF7+ejsQpmoj0/QEHPFXm/3cFTHhWya35tk1NsHFqoiKlmTyt Ra5Yzt4Qskj8USHd+92aAxahmzCwFAidAVI1V6gA1Silf7D9pu1vkQGu7C1fRBX0PiFK3cMGAWe dVu0CwJ825bzPAcBhlsa1kACgpkdjrL03g+H6Da5N34jEQeqPhIqT/G9FdQKKpe+pxB04xl6jvi NeDiQ0ceyBubgC/4o4qBUhGPmBaRwhUCgK3FNeer7EqKCh4JX94RC4lmkUTCVEFfFu3chYYHt4M 2KtuC58RoI4GsXZnokbTMAK6ydqtfnM2TbsQtoAAveKm+ecahg4lagleXW5lGtNmYHL2jeEpTLE XjLDKH83CH X-Received: by 2002:a17:902:ccd1:b0:2a7:8486:ef13 with SMTP id d9443c01a7336-2a9519fe104mr9108785ad.29.1770337814137; Thu, 05 Feb 2026 16:30:14 -0800 (PST) Received: from localhost ([71.212.200.220]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a951c7e31esm5555665ad.28.2026.02.05.16.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 16:30:13 -0800 (PST) From: "Kevin Hilman (TI)" Date: Thu, 05 Feb 2026 16:29:56 -0800 Subject: [PATCH v2 2/3] pmdomain: core: add genpd_for_each_child() helper 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: <20260205-topic-lpm-pmdomain-device-constraints-v2-2-61f7be7d35ac@baylibre.com> References: <20260205-topic-lpm-pmdomain-device-constraints-v2-0-61f7be7d35ac@baylibre.com> In-Reply-To: <20260205-topic-lpm-pmdomain-device-constraints-v2-0-61f7be7d35ac@baylibre.com> To: "Rafael J. Wysocki" , Ulf Hansson , linux-pm@vger.kernel.org Cc: Dhruva Gole , linux-kernel@vger.kernel.org X-Mailer: b4 0.15-dev-47773 X-Developer-Signature: v=1; a=openpgp-sha256; l=3526; i=khilman@baylibre.com; h=from:subject:message-id; bh=Kgntq9uZyzEnQnUEouKXldKwCVaQgcJWIll2FInth/k=; b=owEBbQKS/ZANAwAIAVk3GJrT+8ZlAcsmYgBphTYSOuD3/5V9Lr0GRm9Cn6aAYwd9DdjrAAtwZ MznTvfikK2JAjMEAAEIAB0WIQR7h0YOFpJ/qfW/8QxZNxia0/vGZQUCaYU2EgAKCRBZNxia0/vG ZcowD/4uh5xOW2Otf1K6v8+eritq27XJUooDMcRBQAIXcKqi4hlBszDuUvqyTDj3xntlFvCfAu3 0W8fYX34Owc38zxhlllXWWqYLncZzzi9PeG3qlynuIdkqeN+0A7EQkBFSUntu0o0Kw8QGWBqfrS 8Bi4S+R6iwyCb2o6NM8BhRAoc8gbQpxNY8yJzWnOYRW8PIjU9y69eRuT0lSQmzlwNejzyxu45+b S12yCw6wcqc7967Y0WiwiCBGdXvKE5V7icOcU30+e9JldYAKHGGl25tFYGYcRjgVs8R+7EIqE3r N7yVJHQ5x9eppu64TpxgVRWUCU+AxgcFhPsB0YZZGAmi7D520aeNX2/8ObLPoQHenMf+N8qqXqz CNnPgdKDk356jBdz7bjE8u3pjxETNQtMM6bWpj1DF1orRIhQs4LsA/zRfga4cNJcHNlm6x9c/JL 1fu3z/QkTEXCHrvBmlrxdvJFhLMOwmLsr5AgJhjGn4tPMkAPLloFaeok1XmmtVtfcPGaHD4ludc PzasCMmWMLH1eYTYCQ7FuJAgPzGbG4OVU3QntUDsRizXpWsCC1Smj4R4j/UR9UT0ugf++sQfySx xk/GNgox3UgONLYeoxKidzoUfxmaNlmNuGkwdJRqMu7dQPrWpltiMaQzI6injWobX2vZORtmRJ9 eKIbuqfKIiP7REQ== X-Developer-Key: i=khilman@baylibre.com; a=openpgp; fpr=7B87460E16927FA9F5BFF10C5937189AD3FBC665 Add a new internal helper function genpd_for_each_child() that recursively iterates over all devices in a PM domain and its child domains (subdomains). This helper is useful for governors and other core PM domain code that needs to examine or apply operations to all devices within a domain hierarchy. The function takes a callback that is invoked for each device, and supports early termination if the callback returns a non-zero value. The helper is defined in a new internal header drivers/pmdomain/core.h and implemented in drivers/pmdomain/core.c, making it available to other PM domain subsystem components. The first user of this helper is the cpu_system_power_down_ok() governor function, which uses it to check device QoS latency constraints across the entire domain hierarchy. Signed-off-by: Kevin Hilman (TI) --- drivers/pmdomain/core.c | 42 ++++++++++++++++++++++++++++++++++++++++++ drivers/pmdomain/core.h | 17 +++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c index bf82775f6a67..41c987fc5c5a 100644 --- a/drivers/pmdomain/core.c +++ b/drivers/pmdomain/core.c @@ -24,6 +24,8 @@ #include #include =20 +#include "core.h" + /* Provides a unique ID for each genpd device */ static DEFINE_IDA(genpd_ida); =20 @@ -281,6 +283,46 @@ static void genpd_sd_counter_inc(struct generic_pm_dom= ain *genpd) smp_mb__after_atomic(); } =20 +/** + * genpd_for_each_child - Recursively iterate over all devices + * in a PM domain and its subdomains. + * @genpd: PM domain to iterate over. + * @fn: Callback function to invoke for each device. + * @data: Data to pass to the callback function. + * + * This function recursively walks through all devices in the given PM dom= ain + * and all devices in its child PM domains (subdomains). For each device f= ound, + * the callback function @fn is invoked with the device and @data as argum= ents. + * + * Returns: 0 on success, or the first non-zero value returned by @fn. + */ +int genpd_for_each_child(struct generic_pm_domain *genpd, + int (*fn)(struct device *dev, void *data), + void *data) +{ + struct pm_domain_data *pdd; + struct gpd_link *link; + int ret; + + /* First, iterate over all devices in this domain */ + list_for_each_entry(pdd, &genpd->dev_list, list_node) { + ret =3D fn(pdd->dev, data); + if (ret) + return ret; + } + + /* Then, recursively iterate over all child domains (subdomains) */ + list_for_each_entry(link, &genpd->parent_links, parent_node) { + struct generic_pm_domain *child_pd =3D link->child; + + ret =3D genpd_for_each_child(child_pd, fn, data); + if (ret) + return ret; + } + + return 0; +} + #ifdef CONFIG_DEBUG_FS static struct dentry *genpd_debugfs_dir; =20 diff --git a/drivers/pmdomain/core.h b/drivers/pmdomain/core.h new file mode 100644 index 000000000000..7061891d31fb --- /dev/null +++ b/drivers/pmdomain/core.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Internal header for PM domain core + * + * Copyright (C) 2011 Rafael J. Wysocki , Renesas Electronics= Corp. + */ + +#ifndef __PM_DOMAIN_CORE_H__ +#define __PM_DOMAIN_CORE_H__ + +#include + +int genpd_for_each_child(struct generic_pm_domain *genpd, + int (*fn)(struct device *dev, void *data), + void *data); + +#endif /* __PM_DOMAIN_CORE_H__ */ --=20 2.51.0 From nobody Sun Feb 8 23:19:15 2026 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DA962236E0 for ; Fri, 6 Feb 2026 00:30:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770337816; cv=none; b=t/WrCm7GmlTAEFmeo9lYdPui6UemXH7ucdWtuEvppN4gw0qPVG5kBahxR4rAi1G/eeQY3Ou9MCqu+8H/ySwUWr210fFsP2/QT1QKSaKDF/QSWXL2MHrHl4OdHxyhdSDVZ6hryywEEaw0lnqa/4ftamUJaWZWiDPbPP/d1JUN8d0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770337816; c=relaxed/simple; bh=Lrz7PRjZrfxGJZGrfykrmYmJ95UQygKaDgQoqfbwJBg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qd5Eg/cOPpVRp4vuIIe4VgRHlFnpt8bDS/M4CI/ebJk84XLRn8WX98c7pQL2vhK0EIaFrX6w95DE3oy9QR+dYXubAxzTGPJ8WC9OAD7V7CfvuAHRb1zh7nC4IYl+y03XsEZBPskq5iODm/D4FCVQHqtsJLGAfga8STKGtd+0u7g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=20KqHhEe; arc=none smtp.client-ip=209.85.216.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (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.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="20KqHhEe" Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-354a5da7910so612772a91.0 for ; Thu, 05 Feb 2026 16:30:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1770337816; x=1770942616; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=cewjm25vyFylPVMvzSR5194JStBoD/SAV+U0NBHpisA=; b=20KqHhEe6aAoFLzb4Gf7se9PVXhuLjY6J/plAOXtrxfZI3aOdnE274OYTyO9y3SeDk HtCz0rBkttSHzmExop54HmH9pEoBERes+ZUDm4FVheL51bFkbEEXq4u8oquen1lYXcZG U2KD19zOsGOj7zggCICXchcrW9PEjU3J9wZt6PdqDZ7paDHPmE1Gzd7AxyF66i+cLVjt 9542L/NoobX4nuh04x9SduaigbZsndJhqGeaiPbYv5lfO7NJcrLnugAtZx27+42Qya9d oeeGWD16hA8caiZmIYf1lxR93U7dFcNB07LmXfkYyPn+2pwB3avwAe+bh4Pqcs63V9co tVbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770337816; x=1770942616; h=cc:to:in-reply-to:references: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=cewjm25vyFylPVMvzSR5194JStBoD/SAV+U0NBHpisA=; b=DZgZzTAjX1cXhiO7rOjjk+lNFz7KSXX4IphwXc1mlxl0z3elN/LO9vFHgwAgZXTpRP CNzi7tkgEPSKPMTwoQXolxJvlIjrftYBs+A19JxmvTZMfi3EZvpjbqkcm3yhkkTR/kPw Gc7I3YpulPvthq88vAZAiPY7cfwJV/uRxsyAp5FkkVcwiBTpcxnKUV2eu+VzlWbj499R pPF1NcIsqVQoTSIAWOORR/18u2Jw7ileYzDuo1dHZLi1DtOwXs1TxI+o3VqulPNawz74 Rhs2oDyOzXCosNFjPjXK1VAHmQyKIjdpQ9orhlJILEaskNKpD88jGw1V/F+tQD8Oj1vX m95A== X-Forwarded-Encrypted: i=1; AJvYcCXKAIDxKDuArqpaJcda12yYDKLY9qHTVf/EBsYsWeHU1pFCWHd+7eA45xKB9aoBOJ24i5d0otHGnUiI5xY=@vger.kernel.org X-Gm-Message-State: AOJu0YzT4A9mMzyF6UqNTMQ4e3R1MZn1jHu3PrCKseJdrvAsIuBTU0I2 H0PdE20kNfPpq5ZJhH/Xh4zRFokireaEcl9ZiM9ZVsxT5OaIzak3xB/ZTBZZZqRzp0c= X-Gm-Gg: AZuq6aKUxPjKvVz6T20kxl/nAOZjnVOHSQLrRaT2V1kx8kUhdCyRfdo+dHCL3/cNh05 q8jXF36iBDGhdYWde8hu9f672+ojz3TJI9OMDmXbV2M+dww6hJCo8eCHzVT4Bye75bC6ymoYfax q+DJBai2M5NQkg3CLzsrKFny4LnHapsQ+mBMeHy8athBEBantRL9kuau0GFj6T8Xm4+23ooSgzl tK/TH8ITaN9Jd7JvslWFMeP7Xywuv/lgPtrxr8H9CxW8BZJ3u3OAZuGJ+5f0up53jQDDrgidl4H FCZ4xYwfHLCsA2aFRXP5+VhoDuKgfB//qHIjs0ToVQOZSakwr27nJbb8sKlfeNHir3sBabcvP9K Y8k41Ksdn/UEWRNfGL5jgq6jnFwAfZVt1vQC6K5LVEFNxG5aBIPIjUL5ypgeb8oPxNqbmoThqwg LBHUUu4nQA X-Received: by 2002:a17:90b:384d:b0:343:7714:4ca6 with SMTP id 98e67ed59e1d1-354b3cd821emr691436a91.22.1770337815549; Thu, 05 Feb 2026 16:30:15 -0800 (PST) Received: from localhost ([71.212.200.220]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a951c4d8c4sm5468995ad.7.2026.02.05.16.30.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 16:30:15 -0800 (PST) From: "Kevin Hilman (TI)" Date: Thu, 05 Feb 2026 16:29:57 -0800 Subject: [PATCH v2 3/3] pmdommain: add support system-wide resume latency constraints 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: <20260205-topic-lpm-pmdomain-device-constraints-v2-3-61f7be7d35ac@baylibre.com> References: <20260205-topic-lpm-pmdomain-device-constraints-v2-0-61f7be7d35ac@baylibre.com> In-Reply-To: <20260205-topic-lpm-pmdomain-device-constraints-v2-0-61f7be7d35ac@baylibre.com> To: "Rafael J. Wysocki" , Ulf Hansson , linux-pm@vger.kernel.org Cc: Dhruva Gole , linux-kernel@vger.kernel.org X-Mailer: b4 0.15-dev-47773 X-Developer-Signature: v=1; a=openpgp-sha256; l=3111; i=khilman@baylibre.com; h=from:subject:message-id; bh=Lrz7PRjZrfxGJZGrfykrmYmJ95UQygKaDgQoqfbwJBg=; b=owEBbQKS/ZANAwAIAVk3GJrT+8ZlAcsmYgBphTYSpIjojiZfJLEYpkS/JqjvaZsb0vuBIrNia rdOG++dcB2JAjMEAAEIAB0WIQR7h0YOFpJ/qfW/8QxZNxia0/vGZQUCaYU2EgAKCRBZNxia0/vG ZUmFD/4gZrv07jo5HJE3PBf28gPvvrkH/2dEl99SJlKShBRdL5iM43LKZ4S3AdZf+P9P9VQYfxB xVqI1O52XCGXKM+ryoD7gvmCYv7Rwlfg/af3DuHe1DHy0KxDD/R6bAyx4RRYjzvaDM6OfVzuSur mz+7UKmmRHgGRu9d0ppvxs3UNwc5ZHiKwQiVY4DD5jzCoFO4Y1JrHZA+sZBxAraMIYxi0f9oRe3 IKM8lk1KF0Vp+PC0SQ+xlB/LbnfBelxk4U/+EAeZhw+5fEUMwUL7Ij/ae+fwnoi5p4dhNfRkYT6 8fjCtr8F6vubWJLKyilsSjJl9u3M+/pbh+ltCDMCn8rzLWKXz2XvOng36NoIsxS5p9EWK6dans2 lk5DWlcoMERSIS+QQ4nVjSfKUCqVqUcMEdSli5jeOOHJC+xZWBqsXeJYs2RXMuuKxJh0Hwvx1Bx Y/Iz6bBpXYfybPTxBGoKcUMvFXfRLhVDs2T/Dugm1KOHDm7W9VWAj41HYuDEFF6HIqAKAArnIbB 1wdrlsQ7xE5dvObubFOZa17+SxAw/IKk6vJ9yNXxt+z01eolCjNe3m8+fEDq8sti7y+RuF9frrO OBkOJ5bB9kmxOpLLjunI9Bn0AyJ0qZK6FgEiSk8j0784217tiQ9t+7Di3A+nfxIky7RZpP8AewX 5o6k+6WLxxjkHCA== X-Developer-Key: i=khilman@baylibre.com; a=openpgp; fpr=7B87460E16927FA9F5BFF10C5937189AD3FBC665 In addition to checking for CPU latency constraints when checking if OK to power down a domain, also check for QoS latency constraints in all devices of a domain and use that in determining the final latency constraint to use for the domain. Since cpu_system_power_down_ok() is used for system-wide suspend, the per-device constratints are only relevant if the LATENCY_SYS QoS flag is set. Signed-off-by: Kevin Hilman (TI) --- drivers/pmdomain/governor.c | 45 +++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 45 insertions(+) diff --git a/drivers/pmdomain/governor.c b/drivers/pmdomain/governor.c index 96737abbb496..bbf59b93c8b6 100644 --- a/drivers/pmdomain/governor.c +++ b/drivers/pmdomain/governor.c @@ -13,6 +13,8 @@ #include #include =20 +#include "core.h" + static int dev_update_qos_constraint(struct device *dev, void *data) { s64 *constraint_ns_p =3D data; @@ -425,17 +427,60 @@ static bool cpu_power_down_ok(struct dev_pm_domain *p= d) return true; } =20 +/** + * check_device_qos_latency - Callback to check device QoS latency constra= ints + * @dev: Device to check + * @data: Pointer to s32 variable holding minimum latency found so far + * + * This callback checks if the device has a system-wide resume latency QoS + * constraint and updates the minimum latency if this device has a stricter + * constraint. + * + * Returns: 0 to continue iteration. + */ +static int check_device_qos_latency(struct device *dev, void *data) +{ + s32 *min_dev_latency =3D data; + enum pm_qos_flags_status flag_status; + s32 dev_latency; + + dev_latency =3D dev_pm_qos_read_value(dev, DEV_PM_QOS_RESUME_LATENCY); + flag_status =3D dev_pm_qos_flags(dev, PM_QOS_FLAG_LATENCY_SYS); + if ((dev_latency !=3D PM_QOS_RESUME_LATENCY_NO_CONSTRAINT) && + (flag_status =3D=3D PM_QOS_FLAGS_ALL)) { + dev_dbg(dev, + "has QoS system-wide resume latency=3D%d\n", + dev_latency); + if (dev_latency < *min_dev_latency) + *min_dev_latency =3D dev_latency; + } + + return 0; +} + static bool cpu_system_power_down_ok(struct dev_pm_domain *pd) { s64 constraint_ns =3D cpu_wakeup_latency_qos_limit() * NSEC_PER_USEC; struct generic_pm_domain *genpd =3D pd_to_genpd(pd); int state_idx =3D genpd->state_count - 1; + s32 min_dev_latency =3D PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; + s64 min_dev_latency_ns =3D PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS; =20 if (!(genpd->flags & GENPD_FLAG_CPU_DOMAIN)) { genpd->state_idx =3D state_idx; return true; } =20 + genpd_for_each_child(genpd, check_device_qos_latency, + &min_dev_latency); + + /* If device latency < CPU wakeup latency, use it instead */ + if (min_dev_latency !=3D PM_QOS_RESUME_LATENCY_NO_CONSTRAINT) { + min_dev_latency_ns =3D min_dev_latency * NSEC_PER_USEC; + if (min_dev_latency_ns < constraint_ns) + constraint_ns =3D min_dev_latency_ns; + } + /* Find the deepest state for the latency constraint. */ while (state_idx >=3D 0) { s64 latency_ns =3D genpd->states[state_idx].power_off_latency_ns + --=20 2.51.0