From nobody Fri Sep 25 09:20:24 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 D9DD148B383 for ; Mon, 14 Sep 2026 15:02:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789398127; cv=none; b=gpPCTt2OjoBg76VYsP9CkEFzQ5U42841U4ImAvpQkKRvTrjgvSKRlHwtMukqxaAaNZrLz+dGpmzg2z+AA/JhB5mH41RJyPQ1MEK99Tvpo9aIsrsAH4pO7Tl0PW+rglXmI0WvzrGjq7XaQPoNIsSdZtepCevkDnin7HnJWtGjizU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789398127; c=relaxed/simple; bh=+iQ7jX4TKc0AkmLQompyS5lkkZ+1NA8VoW0YvwF4tNE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=piS6UKjM+wiKByGuMzT8EMcKAd98gkBT8v5LPUREv9JaQ+nrBu2xNnpJJ5J1PgivdJxBOKnyw7gs+YE8WJE9kjUfLjdiV9/hunIKkXtDc2JN4feWU+1hERnYZdOu0ZwjJ1FClM7tybxQTfC8RGHxZ0Z53CV3dpo+g+Hu5HAvi4A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=dQog9WZl; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ORvuZaPo; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="dQog9WZl"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ORvuZaPo" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68ED0kTV512759 for ; Mon, 14 Sep 2026 15:02:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=R64vMYngif0 QtgmjSIX7fHGd4GXjWW4gNyDbeqBJOZ4=; b=dQog9WZlzb0RmAq9fQAraBH78/g RimytGPnHD+yZHilPqLX6vMDTymV5ztHPrBuQb5PHISlkbBPTdZeSuDiTGwq7Dme lvuv9GN+lE69IHCYi/cmfLmy5REzEM5YrIs7WuxsxThM075iMTofkM6t4rN133nT 8N8O2pX+VW4x2V1MuL0mbcL/sb0C8HIpcBAmuXDYyLgzf+GfFdJYL8+lAL7DTSft uGz9V+TywjxK7XwxeEr1q1eC8mHlYd/8tC1Yb/UYbKP1NzOssDj+xxUq2Td0l1Sq SbZ6tpdIgGBx9chlyH0XjloeEVbTOjFXHOztRAxnqOCJcHEwdGRGAlFuCqw== Received: from mail-ua1-f72.google.com (mail-ua1-f72.google.com [209.85.222.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gpgvtgkyn-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 14 Sep 2026 15:02:02 +0000 (GMT) Received: by mail-ua1-f72.google.com with SMTP id a1e0cc1a2514c-980c3b71002so2564335241.3 for ; Mon, 14 Sep 2026 08:02:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789398122; x=1790002922; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=R64vMYngif0QtgmjSIX7fHGd4GXjWW4gNyDbeqBJOZ4=; b=ORvuZaPorPUEatLbmIAS6neVOt/xJ70rqQ7EMDKjhVw5sZ0RoMH1qwugvXGgreGGXr 2AVRpn6Yf67JAfM3vwha1aE0FxIjMquNiL4WXdIQetFFaV44mN6EauyiprMfpeQZhNvS qVobKhhlG+6HatpLmzONLdCK9hQeib4hWCWZvFBDjoascmu+HaZmec3LfdRQTIiM/+5G ssi84a7P5TD8aJuLz+2KqdfJlB4bk7XKMwdTT0/1iVZ8zfdOlNfafhoTE1hd4VCvN7IF AYqnzGmzSDzKo6ImlGp8hIXIIdlfJjSBYnkNmm1QEgahHbTFYjvrcb9dnc4eNz8wlmiw M33w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789398122; x=1790002922; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=R64vMYngif0QtgmjSIX7fHGd4GXjWW4gNyDbeqBJOZ4=; b=hnIUPR4L5MzluGbovg8huKWtJuq75kuzTHBM8RJ5wVz3vSR4hFfkk+UnMGO+pzQOvR xZfaZZ4m6GEUQrJZ3dQstK0zzevCcOZzIlhOKTpAKw0CFu1KsSseW/m0DHWnQ0R/aPRm 8bQFiHQfMqmsLna1tn4hHwBsw424SruqRcHgP/brB/dzKS+lFC0R8jMsaKPh4w34V9Ye GbzzZdWokT+ZmASyPygPvKxvReSzyn2inJSVWKjTXOktjnupAEwN42PcIjILHorhHwIo xN8m0bE06DaMRUvRj8sJLTw0k+UAcrBoIOdsOU078o3mTAV9mYQYLck9HjspM7r1JKSa Z0eA== X-Forwarded-Encrypted: i=1; AKwUvByXi0YGt4E+uC11Y/YzwtYBwIkThh8prXEUNBhG+jknw9oJRYsVecg1Q7BRqXN5oflsYsKxiRuqohl2UHU=@vger.kernel.org X-Gm-Message-State: AFuF++lokF0NkhkRmaXf/MXDxvckAz41Mloa7qz1pneTlQuzF6T0NjGB HF15Hq6ESE0FQ4KFx68rSOfoYL1PHwkR+1VrpOjLKkcmLnwGw0pBghFZshwcRTo0UPuE2pC6bWf rjleAkVgP9wxHzG3xftDaJOzRKgeXbFaUlSR4M1T68aEeuNdirHvGkJjpe/9wIn3d06M= X-Gm-Gg: AYBFou2umzQyHPe2sQ6xdgb1gBwyynNtQzRB9XB5tGwtTUIIRANfF2PnIlATvLeZYGS gdhgD/aKXOrnJKDr0+wksK+uYEzpgRaF/4cdx8TOqA4oFWpkSt5LMnWBhrNpi+IFTO3SnfhyL6P 1QpABGjtEG1lTwT7Vc5owbCtXmeSNcqRxzbivWI0zp1mlXRLgDFd58RppwURBOExEWK/lOKmzOt 7//+KwdR3a1Tx1UKUCMUVS6q+1OwS+qeyUCHtVSaWSbIit6KnZu4EpRChFRqinStTfgi4CZO8gV e2E7A//77bXmweDWGDDHGAotNJ/nNh0WWGthe4YStKu1F01WXWhEaOYIE3L9I5LQ210H8Ano3dF trIcNmUYs5Iv9Go0Y4piUu9x7dKrdkZdtDMq3OrAVdJpNXUvo7cG9/4dUMQ== X-Received: by 2002:a05:6102:149c:b0:790:cba0:960 with SMTP id ada2fe7eead31-79b5acb355emr1722520137.10.1789398121336; Mon, 14 Sep 2026 08:02:01 -0700 (PDT) X-Received: by 2002:a05:6102:149c:b0:790:cba0:960 with SMTP id ada2fe7eead31-79b5acb355emr1721166137.10.1789398116168; Mon, 14 Sep 2026 08:01:56 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c296608480esm468632666b.36.2026.09.14.08.01.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2026 08:01:55 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , "Rafael J . Wysocki" , Daniel Lezcano , linux-pm@vger.kernel.org Cc: Dhruva Gole , Abel Vesa , Lorenzo Pieralisi , Christian Loehle , Maulik Shah , Yuanfang Zhang , Sneh Mankad , Suzuki K Poulose , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/5] pmdomain: core: Rename genpd_status_on() Date: Mon, 14 Sep 2026 17:01:37 +0200 Message-ID: <20260914150146.187622-2-ulf.hansson@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260914150146.187622-1-ulf.hansson@oss.qualcomm.com> References: <20260914150146.187622-1-ulf.hansson@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=c/0+0h9l c=1 sm=1 tr=0 ts=6aa80c6a cx=c_pps a=ULNsgckmlI/WJG3HAyAuOQ==:117 a=h7aNHqOhPKB91FvYUefsSA==:17 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=pGLkceISAAAA:8 a=zIFADOUqQBSm_Ft5s84A:9 a=1WsBpfsz9X-RYQiigVTh:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE0MDIxNSBTYWx0ZWRfX/atJ5LgVYKhr 57BBA5xhOZlHtcaN7/ChcEstM11i1kMM3LR6ahqykQRfHeJOFruGPT8eds9kFqOXKBflAm7VFGm 6bnnM64sBTBM7/KEVtnwAowH1vc22qaVl+m4Hn69FtAJB8F9rQPrn02L3r4sONCRWD49wmxlvOj OnRRQGA26c8r6aKHx7VBq1sXftA3bO6jDR2CE+6sjWLmJUNllSt8KYMr7ClCmxzxBxt+6Za9Ox+ zTuFXiO7ov4lQGFgRDnMCHEbXPYKSK9QBu+oUDF5Ti782veHAUKiX6hWFqiFYkaYaiJbgrHOHE1 k0riCJkJk3sFNZPzRhsMn+teeQKfty5Pa4or/lYE8KR18Jv7mRpDx4rvUP24qTzME/IuR9G+n6j PIv9HjKihSBYP0fjFps4UJfjEBfdcEBM9P1BizaaN3bo6xmNiVes1tSkXEpDdYm2MEsW9RXpiDW 12t5DHxxn5H1LoFLcQA== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE0MDIxNSBTYWx0ZWRfX5pXfVmFrvWs9 tsggUJjNBU/8kF5HLqrT/qYPBmQoEy0ZVCzOmEodrt0CTb+cVp9Dh7kR92nr9mMuokkrSVNyIxf aB1TDrBEWTp5FdzGY8Ku84HG9Bwsnws= X-Proofpoint-ORIG-GUID: wLM2x8mbz2V2yCIUXQ7cAvjYplo5A4xI X-Proofpoint-GUID: wLM2x8mbz2V2yCIUXQ7cAvjYplo5A4xI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-14_03,2026-09-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 bulkscore=0 impostorscore=0 clxscore=1015 adultscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609140215 Content-Type: text/plain; charset="utf-8" Rename the genpd_status_on() to genpd_status_on_unlocked() to make the name available for a lock taking wrapper introduced by a subsequent change. Suggested-by: Abel Vesa Tested-by: Yuanfang Zhang Reviewed-by: Dhruva Gole Signed-off-by: Ulf Hansson --- Changes in v4: - None. Changes in v3: - Updated a comment in the code and the commit message. Changes in v2: - New patch. --- drivers/pmdomain/core.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c index 052ec478dfcc..6abe8b198949 100644 --- a/drivers/pmdomain/core.c +++ b/drivers/pmdomain/core.c @@ -173,7 +173,7 @@ static const struct genpd_lock_ops genpd_raw_spin_ops = =3D { #define genpd_lock_interruptible(p) p->lock_ops->lock_interruptible(p) #define genpd_unlock(p) p->lock_ops->unlock(p) =20 -#define genpd_status_on(genpd) (genpd->status =3D=3D GENPD_STATE_ON) +#define genpd_status_on_unlocked(genpd) (genpd->status =3D=3D GENPD_STATE_= ON) #define genpd_is_irq_safe(genpd) (genpd->flags & GENPD_FLAG_IRQ_SAFE) #define genpd_is_always_on(genpd) (genpd->flags & GENPD_FLAG_ALWAYS_ON) #define genpd_is_active_wakeup(genpd) (genpd->flags & GENPD_FLAG_ACTIVE_WA= KEUP) @@ -771,8 +771,7 @@ EXPORT_SYMBOL_GPL(dev_pm_genpd_rpm_always_on); * @dev: Device to get the current power status * * This function checks whether the generic power domain associated with t= he - * given device is on or not by verifying if genpd_status_on equals - * GENPD_STATE_ON. + * given device is on or not by checking if genpd->status equals GENPD_STA= TE_ON. * * Note: this function returns the power status of the genpd at the time o= f the * call. The power status may change after due to activity from other devi= ces @@ -791,7 +790,7 @@ bool dev_pm_genpd_is_on(struct device *dev) return false; =20 genpd_lock(genpd); - is_on =3D genpd_status_on(genpd); + is_on =3D genpd_status_on_unlocked(genpd); genpd_unlock(genpd); =20 return is_on; @@ -963,7 +962,7 @@ static void genpd_power_off(struct generic_pm_domain *g= enpd, bool one_dev_on, * The domain was on at boot and still need to stay on. * The domain has a subdomain being powered on. */ - if (!genpd_status_on(genpd) || genpd->prepared_count > 0 || + if (!genpd_status_on_unlocked(genpd) || genpd->prepared_count > 0 || genpd_is_always_on(genpd) || genpd_is_rpm_always_on(genpd) || genpd->stay_on || atomic_read(&genpd->sd_count) > 0) return; @@ -1040,7 +1039,7 @@ static int genpd_power_on(struct generic_pm_domain *g= enpd, unsigned int depth) struct gpd_link *link; int ret =3D 0; =20 - if (genpd_status_on(genpd)) + if (genpd_status_on_unlocked(genpd)) return 0; =20 /* Reflect over the entered idle-states residency for debugfs. */ @@ -1406,7 +1405,7 @@ static void genpd_sync_power_off(struct generic_pm_do= main *genpd, bool use_lock, { struct gpd_link *link; =20 - if (!genpd_status_on(genpd) || genpd_is_always_on(genpd)) + if (!genpd_status_on_unlocked(genpd) || genpd_is_always_on(genpd)) return; =20 if (genpd->suspended_count !=3D genpd->device_count @@ -1472,7 +1471,7 @@ static void genpd_sync_power_on(struct generic_pm_dom= ain *genpd, bool use_lock, { struct gpd_link *link; =20 - if (genpd_status_on(genpd)) + if (genpd_status_on_unlocked(genpd)) return; =20 list_for_each_entry(link, &genpd->child_links, child_node) { @@ -2170,7 +2169,8 @@ static int genpd_add_subdomain(struct generic_pm_doma= in *genpd, genpd_lock(subdomain); genpd_lock_nested(genpd, SINGLE_DEPTH_NESTING); =20 - if (!genpd_status_on(genpd) && genpd_status_on(subdomain)) { + if (!genpd_status_on_unlocked(genpd) && + genpd_status_on_unlocked(subdomain)) { ret =3D -EINVAL; goto out; } @@ -2186,7 +2186,7 @@ static int genpd_add_subdomain(struct generic_pm_doma= in *genpd, list_add_tail(&link->parent_node, &genpd->parent_links); link->child =3D subdomain; list_add_tail(&link->child_node, &subdomain->child_links); - if (genpd_status_on(subdomain)) + if (genpd_status_on_unlocked(subdomain)) genpd_sd_counter_inc(genpd); =20 out: @@ -2246,7 +2246,7 @@ int pm_genpd_remove_subdomain(struct generic_pm_domai= n *genpd, list_del(&link->parent_node); list_del(&link->child_node); kfree(link); - if (genpd_status_on(subdomain)) + if (genpd_status_on_unlocked(subdomain)) genpd_sd_counter_dec(genpd); =20 ret =3D 0; @@ -2441,7 +2441,7 @@ int pm_genpd_init(struct generic_pm_domain *genpd, =20 /* Always-on domains must be powered on at initialization. */ if ((genpd_is_always_on(genpd) || genpd_is_rpm_always_on(genpd)) && - !genpd_status_on(genpd)) { + !genpd_status_on_unlocked(genpd)) { pr_err("always-on PM domain %s is not on\n", genpd->name); return -EINVAL; } @@ -3839,7 +3839,7 @@ static int genpd_summary_one(struct seq_file *s, =20 if (WARN_ON(genpd->status >=3D ARRAY_SIZE(status_lookup))) goto exit; - if (!genpd_status_on(genpd)) + if (!genpd_status_on_unlocked(genpd)) snprintf(state, sizeof(state), "%s-%u", status_lookup[genpd->status], genpd->state_idx); else --=20 2.43.0 From nobody Fri Sep 25 09:20:24 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 F24E0485517 for ; Mon, 14 Sep 2026 15:02:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789398125; cv=none; b=b9xYWPb+vtM05jLYStquXdDEl13kiaYZ6Fb2z5eeFQSD1/lL5NYlVOqM0JG/5pMwTm787444u658sMOb9TNrna942FvwulSNN2N5F73W39y08l46sij10ngqkRXHiZMVZ8P8NYwrmNgplR95/IEXyl5dChxfroYSEvCzmqplTg4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789398125; c=relaxed/simple; bh=+9ewyErakjiMv+XulshtUrNOZeuqyR5bAcwr2UTRCIQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZIXcv5S7ivohMOQA3ezleo0jWOZl1u2bv3YkwaBdcblqf/RCEMbLepa5SPQ7h6knKYyzIBegzMesqy7cwFYuaY4jcnLZCoMOJaf1B0eApA57BZgaOORmAm6aBxLrMMrSTkNKtmn/R1sRaELvgzLjx44+ag2QstGtyAf5zo506iE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=R3D4A7tR; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=kEPUhY+6; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="R3D4A7tR"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="kEPUhY+6" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68ED0QxC1761276 for ; Mon, 14 Sep 2026 15:02:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=RLdSqd1j1OI 9R1VCLztteaDRbyZgd0G1W+hidlStvuM=; b=R3D4A7tR5d6I3rYhPblK/7F13xj AtTzyHRvih+2EcXm6uSQ0JMN8fWKau31PjhjVP1fKuVn4NZabhznAjLY/fZIjEwq xb13o10X7gO5PBKmqw5k32+A6sMnNShAKY2i3/aZokrEzkIrePrwASc3rpvVTSgz 6NUa5hwLodYARnjnafLyNTAGxx8cGN6mmnng1XaB+FmV8lauRVKzYpBk3/CYtIfE 9dAm3ZxGus/ox0z7V9dPmxHfs3hGhD/wrXxw7LfrdWxmBJ+Y+oFHdlBzrGV9jbTA ald+qtSAfzIPTBIbh7gnCPD5DwNqBTJtONRzYM8fEMYcUR21v0lyu5huWNw== Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gpeex98m7-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 14 Sep 2026 15:02:01 +0000 (GMT) Received: by mail-oo1-f70.google.com with SMTP id 006d021491bc7-6c34cd4bffbso1090568eaf.0 for ; Mon, 14 Sep 2026 08:02:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789398121; x=1790002921; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=RLdSqd1j1OI9R1VCLztteaDRbyZgd0G1W+hidlStvuM=; b=kEPUhY+6iipsRWYmewi/lJlewgGGx8A3kTcDuXk6By7p6Y1A0IukXFOu6bON8x2gra dHc7h29OCvSxRR57HOlL0Ea2arEI+S8cBuZf0cxuKEq5+bNtXfK6umdKat+w89zSRxMb jycO5rgta3KUR6C8dhlIfxHXxlMjaBJSYzY58Z2yght5w0QnB33JdtZe9xu0sAmRk+zx 5TXmQ0W0plU8h+3Qv7GPvihEYs2j32f88eZto6TCi6yZ2zLxuVGKJYvjPTl3tVmh8vfT nzU0ZfNzQhZHxG8j640joVh/hNnN6yp39vDO519gqnSMfhv7jq7sI69WG7JiBKTYbkmc c3gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789398121; x=1790002921; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=RLdSqd1j1OI9R1VCLztteaDRbyZgd0G1W+hidlStvuM=; b=h9mQ6536beeMT5OIG5okCslEoqSCnpDrugKVsU+T2Fzx/qu6k89XYv6KW7jduflQlY jKHyhXdTWuJ5E+pHEAb+Pv5J/gDVzPpDRa+Sajt2mQrz6KzwvPVMxw3ZEzPSyOz2LN8J c5lPCA3dv3L2N7CcVv+jHg1Jo3H8ZX5gCjunr/6dOUuKiqWp2gqCbdIuHeXwj3oGswps kHpLUIVjTmeZqxHkTYXLkPxp5UkM3kE8tndifv6nsHETHK8fI7AXMF0yQq/5jyQDg/QY 7das3IE3xaR90D37QZtNCRYG7F09qh7unXw/PhLIHA+1En+kYqFIpLjWVPZuYc9gIXsx pe3A== X-Forwarded-Encrypted: i=1; AKwUvBwQQLcpXzzA0NLciVY6lHIrb59YKlzYPJDiJQ0tfrdCrMT6DiQTpJ0DskFuidPv/GHFc/xOQ99x+mF+c+M=@vger.kernel.org X-Gm-Message-State: AFuF++kAKeSIUdgDbTku/iEOSi42SqAtm7s2l3JOcWhLixR7RfHjaEcT 3JU1OfU1JdRaa40NjqjxK2wJondmb82vFvLemvrReUikizSPIjuuNPXWpdC4mi237Byng/GMUUo HCFNk7tX84yvvFvL57CA1n79RJJZU8CxmpbU+GWveHtVUUZrGITbf3jiE9F75le9TrMA= X-Gm-Gg: AYBFou1aZ7lRH2TFzQ2QyNcecOZQ6Xu07ig88i2HgeTUfMgkaZk9rL+i1/f4vElPLQI XR7cTk/BVOs296KbbZ15eE6XAroOXPMjNBH7Fh3wGp3xnYMwVFa1hx6I3WeylPLvKF62dxua5gj TSFWuv38Xls2k2IhXbHR8xEreiL3cpJS+qSNXAObeu0iUUWZSdTmKG/C55n6uPjUF8zymabtCtO vK9hxt/nKfNrQOmTzAy3Xt3O8VPI91Dzg4RUx+NxM2/lxBzVpwsj5cuzZAKc28rcF0pscbetFjr 3i1JcBMPB/Hl1wmkWWRN7gB/m+8//nRgcm3k8leX2+2Iu5UosDx7JirA8TyerL9pQoN0G/t/b9V l7PGiz57zHHYfsZi5t+YCYRAdwOCRNQJ4Tu38EhtMdZBEnjvayxvpI6h6Fg== X-Received: by 2002:a05:6820:4b91:b0:6b7:8396:f3cf with SMTP id 006d021491bc7-6c541b451edmr1405294eaf.49.1789398120184; Mon, 14 Sep 2026 08:02:00 -0700 (PDT) X-Received: by 2002:a05:6820:4b91:b0:6b7:8396:f3cf with SMTP id 006d021491bc7-6c541b451edmr1405146eaf.49.1789398118846; Mon, 14 Sep 2026 08:01:58 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c296608480esm468632666b.36.2026.09.14.08.01.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2026 08:01:57 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , "Rafael J . Wysocki" , Daniel Lezcano , linux-pm@vger.kernel.org Cc: Dhruva Gole , Abel Vesa , Lorenzo Pieralisi , Christian Loehle , Maulik Shah , Yuanfang Zhang , Sneh Mankad , Suzuki K Poulose , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/5] pmdomain: core: Allow a non-CPU device in a CPU PM domain to do power on Date: Mon, 14 Sep 2026 17:01:38 +0200 Message-ID: <20260914150146.187622-3-ulf.hansson@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260914150146.187622-1-ulf.hansson@oss.qualcomm.com> References: <20260914150146.187622-1-ulf.hansson@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE0MDIxNSBTYWx0ZWRfXynY+ruM+vJyh 7jeOT/5+xMXJJxzhgGiKPzw+DupBMdc3ls0515caXGEkh74vb2p8oORPF8ZVZso/CODlNHhav7v UDIpcNdbu+TH5KwIyQTD2H0vfuM6NuiUSRyumGIJFmfnDDlRNuEwV0NaUMlj6BGICu8SifOBp5x psE7beMLOyETyy7BmtUViLQjI0jpXZbLAGIhe4cH7TyVd1Sc8uS24RD/YoYa8wpHoKYwaIYMNWf XvwqM7Lpk2hZh11JY8TKudmaqAqH97qmASRg+MKSHnq78ZpjNItuf1BUjPpJzhQmbq1hGEjBo6A CTsjVEj22/Y4uprUiaORhWOqEpy/rcSw++zM0OZBz0BGOaTZLfAEYaJZPwDOyTu2+5Zy9QEl+j5 r2Xmil2XELH1tzW0t3o+Voah/d0g7JYqe3mEBgkGTH49sOqllYSZMTI5eO1VyrNThbgh7boAPrz f0Noy0nGdGsybNKII4w== X-Proofpoint-GUID: vmWLARQEGd-UNteb19OSTofGmY0PGW5A X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE0MDIxNSBTYWx0ZWRfX1994XVOq+2uv kXTptHrny+XhxLSamA+30zBafWUyqw/5cR2ZfwmSTH522dVglIDKreLpaCX05xpLFGYd+Oyxafg F+naYoMxExtyy3QY+NXIjk263QF5CTQ= X-Proofpoint-ORIG-GUID: vmWLARQEGd-UNteb19OSTofGmY0PGW5A X-Authority-Analysis: v=2.4 cv=MsrHeGae c=1 sm=1 tr=0 ts=6aa80c69 cx=c_pps a=lkkFf9KBb43tY3aOjL++dA==:117 a=h7aNHqOhPKB91FvYUefsSA==:17 a=u8BtVuMVLpZXKRMe:21 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=VwQbUJbxAAAA:8 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=CAA96EveQzfqUpAuUaoA:9 a=k4UEASGLJojhI9HsvVT1:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-14_03,2026-09-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 phishscore=0 malwarescore=0 suspectscore=0 clxscore=1015 adultscore=0 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609140215 Content-Type: text/plain; charset="utf-8" A driver for a non-CPU device that is attached to a CPU PM domain (the genpd has the GENPD_FLAG_CPU_DOMAIN configuration set), is currently not able to power on the PM domain. More precisely, to power on a CPU PM domain one of its corresponding CPUs needs to be woken up if they are idle. The current support for a non-CPU device is that its driver can only prevent an already powered on CPU PM domain from being powered off. This leads to problems for a driver while probing its device or when it needs to call pm_runtime_get_sync() to turn on the power for it. From the driver point of view it looks like it all works fine, but when accessing the device it may end up with various errors as the device may not be fully powered on. To fix the behavior for these types of devices, let's adjust the behaviour in genpd_power_on() to wake up an idle CPU that belongs to it, in cases when it's needed. Link: https://lore.kernel.org/all/CAPx+jO-sCierYj8jnoKQHckJG16dOBxnNrsZVYO= =3D38R2cLV8nw@mail.gmail.com/ Reviewed-by: Abel Vesa Tested-by: Yuanfang Zhang Reviewed-by: Dhruva Gole Signed-off-by: Ulf Hansson --- Changes in v4: - Decreased the timeout. Changes in v3: - Moved to atomic polling, pointed out by Dhruva. Changes in v2: - Rename a function according to Abel's suggestion. --- drivers/pmdomain/core.c | 80 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 5 deletions(-) diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c index 6abe8b198949..c593a3479ad0 100644 --- a/drivers/pmdomain/core.c +++ b/drivers/pmdomain/core.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -19,11 +20,14 @@ #include #include #include +#include #include #include #include #include =20 +#include + /* Provides a unique ID for each genpd device */ static DEFINE_IDA(genpd_ida); =20 @@ -32,7 +36,9 @@ static const struct bus_type genpd_provider_bus_type =3D { .name =3D "genpd_provider", }; =20 -#define GENPD_RETRY_MAX_MS 250 /* Approximate */ +#define GENPD_RETRY_MAX_MS 250 /* Approximate */ +#define GENPD_CPU_ON_POLL_PERIOD_US 100 /* 100us */ +#define GENPD_CPU_ON_TIMEOUT_US 300000 /* 300ms */ =20 #define GENPD_DEV_CALLBACK(genpd, type, callback, dev) \ ({ \ @@ -1026,15 +1032,75 @@ static void genpd_power_off(struct generic_pm_domai= n *genpd, bool one_dev_on, } } =20 +static bool genpd_status_on(struct generic_pm_domain *genpd) +{ + bool is_on; + + genpd_lock(genpd); + is_on =3D genpd_status_on_unlocked(genpd); + genpd_unlock(genpd); + + return is_on; +} + +static int genpd_wakeup_cpu(struct generic_pm_domain *genpd) +{ + unsigned int cpu; + bool is_on; + int ret; + + /* Find the first online CPU in the genpd's cpumask. */ + cpu =3D cpumask_first_and(genpd->cpus, cpu_online_mask); + if (cpu >=3D nr_cpu_ids) + return -EAGAIN; + + genpd_unlock(genpd); + + /* Send a IPI to wakeup the selected CPU. */ + smp_send_reschedule(cpu); + + /* Poll to wait for it to complete the power on sequence. */ + ret =3D readx_poll_timeout_atomic(genpd_status_on, genpd, is_on, is_on, + GENPD_CPU_ON_POLL_PERIOD_US, + GENPD_CPU_ON_TIMEOUT_US); + + genpd_lock(genpd); + + /* Re-check the status as we have released the lock in between. */ + if (ret || !genpd_status_on_unlocked(genpd)) + return -EAGAIN; + + return 0; +} + +static bool genpd_need_alive_cpu(struct generic_pm_domain *genpd, + struct device *dev) +{ + if (!genpd_is_cpu_domain(genpd)) + return false; + + /* This is not for CPU devices as those are managed differently. */ + if (to_gpd_data(dev->power.subsys_data->domain_data)->cpu >=3D 0) + return false; + + /* + * If the current CPU doesn't belong to the genpd's cpumask, we need to + * wake up one of those idle CPUs to power on the CPU domain correctly. + */ + return !cpumask_test_cpu(smp_processor_id(), genpd->cpus); +} + /** * genpd_power_on - Restore power to a given PM domain and its parents. * @genpd: PM domain to power up. + * @dev: The device that needs the PM domain to power on. * @depth: nesting count for lockdep. * * Restore power to @genpd and all of its parents so that it is possible to * resume a device belonging to it. */ -static int genpd_power_on(struct generic_pm_domain *genpd, unsigned int de= pth) +static int genpd_power_on(struct generic_pm_domain *genpd, struct device *= dev, + unsigned int depth) { struct gpd_link *link; int ret =3D 0; @@ -1042,6 +1108,10 @@ static int genpd_power_on(struct generic_pm_domain *= genpd, unsigned int depth) if (genpd_status_on_unlocked(genpd)) return 0; =20 + /* Special case for a device attached to a CPU domain. */ + if (genpd_need_alive_cpu(genpd, dev)) + return genpd_wakeup_cpu(genpd); + /* Reflect over the entered idle-states residency for debugfs. */ genpd_reflect_residency(genpd); =20 @@ -1056,7 +1126,7 @@ static int genpd_power_on(struct generic_pm_domain *g= enpd, unsigned int depth) genpd_sd_counter_inc(parent); =20 genpd_lock_nested(parent, depth + 1); - ret =3D genpd_power_on(parent, depth + 1); + ret =3D genpd_power_on(parent, dev, depth + 1); genpd_unlock(parent); =20 if (ret) { @@ -1306,7 +1376,7 @@ static int genpd_runtime_resume(struct device *dev) =20 genpd_lock(genpd); genpd_restore_performance_state(dev, gpd_data->rpm_pstate); - ret =3D genpd_power_on(genpd, 0); + ret =3D genpd_power_on(genpd, dev, 0); genpd_unlock(genpd); =20 if (ret) @@ -3410,7 +3480,7 @@ static int __genpd_dev_pm_attach(struct device *dev, = struct device *base_dev, =20 if (power_on) { genpd_lock(pd); - ret =3D genpd_power_on(pd, 0); + ret =3D genpd_power_on(pd, dev, 0); genpd_unlock(pd); } =20 --=20 2.43.0 From nobody Fri Sep 25 09:20:24 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 4999E486403 for ; Mon, 14 Sep 2026 15:02:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789398128; cv=none; b=KgE6fwa0LH7XkI3td18KXphP4rC6JIpPEAj0j7t8CkHS8nW0oVQ3W+5QNrfJ/YR8p1+DUx5hsPtvsgYSswZUvwj/pNkvQHNI36pnPy1x5BFGo2i6mqb9ha+mhNuxkWgvpU5zvNNxZhL+bIL6Ct5EsLwbm9A/6y8zjL0tR3T5t/8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789398128; c=relaxed/simple; bh=2JxEexPiRwQ5O/ezc4RXBoagSQLg8sZDBQgHD+IaIMs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LaRIDg1Czahvi+fPPu+j+ORnfV0lBWTZbL5fMcen+qIa2XdEAYSSFhkZhKoGkrgypZaV8vPjdmYurgr2qR6qx8s+AKKP+zvJXO5MlKQwSl2pjxCDQ4+U87ctNPdxlHgggFcfHwwGzT8wVvbittXAe4J0tlKq2TytbYrEBHKY8IM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=TGM2mxMi; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=HiNBGscs; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="TGM2mxMi"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="HiNBGscs" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68ED0hkO1200872 for ; Mon, 14 Sep 2026 15:02:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=URETtrpK8wu vrqfyx7NJrivdefwUx3tTphYnqoPD05M=; b=TGM2mxMilAx7vd3fRxJbN0wvoHc QX1cwbvlMV4uEdNfYpqJfLnAcSSVBHfRlveU/jqBWhW7q1cy8O8aMBihyywOBMMh 3x4smFRgifFppnJXY78YJkt7v8MiAo6VCKpLe/ySZ16IhSVeEP9DIGH/QCJUiBFz 0T/pm9w2guxrf8wvaz3b1qpyE9e7xm8FJb+mwctPVmzGUtzIyYtjL+pgrZ/R0KHh qHzuioJlhSqFEamDDK0WpC3t+9AkS10xKuVViNYzHpcCuAeCTYNTCUYhFEi4GYkR 5cv+DQ/CD50L2Y6Z/G/KVIlQp1PTOVZd6bfWkQYBlmmZnwNll/Xz5/WmTXA== Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gpdevsehx-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 14 Sep 2026 15:02:04 +0000 (GMT) Received: by mail-ot1-f70.google.com with SMTP id 46e09a7af769-806ef75f2ceso1953778a34.0 for ; Mon, 14 Sep 2026 08:02:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789398124; x=1790002924; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=URETtrpK8wuvrqfyx7NJrivdefwUx3tTphYnqoPD05M=; b=HiNBGscsltshrIDyoKbLtbWNXta4FkCTNfecACmOJedhBqkPHYzNF6phspp02luIhJ pb7T9gd3IPiFhm+0CCR4kn6OZ1OxGidm2oru2Sd+Z/79pF4PbdTjUqskqtnxriEFcyv7 zVqLnmzT5ewS8vFxnBb20RVbXiF2rTCmasY9L522vgmkLnCgbqQ8Y8wtQaMha1WF46tX 1dGghE7odUhcJVynvdB+HL2mOmLja0aOjtJkNSBIxopzeqqRS7dgicE4glGy7mv7aoxh LBKl8S+SCQqVLjpJ55k91i3K+VkCeIUkoksmJND+wQ2q5czWBPm7SOdy/+y1ArdUd1o0 YiyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789398124; x=1790002924; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=URETtrpK8wuvrqfyx7NJrivdefwUx3tTphYnqoPD05M=; b=en2n9xFOtFMUVufSJTs4ZNyqkYCrUmnPZV0FZ7Gkb4AyPHVU95qRIA8dcHHeOQc4xO jneZCerrWOouS3F7AFZqd/BaYq/cSf2Foguj3OuGuOa316UCFSuHeY97JDAftXFEEgu4 O1zeAj1u39amFwezHagUb6OmODJiZavbFTn5DN6UuJf9LbwxFb8ZjXoEGcfw/jrJLxdO C9Ux2pTBwj+UtiDxSG/vOgFBWb0Zxmba2z6jQLzplVU1os5V5WFzhBR49jx18XCNYQb2 U6yMJfvqn7v0zGglKSPO+hQuxnUIsaVmjrMqY4lzZz6s2/pl1GC3f0xOu3XXM5bLb9WR QtHQ== X-Forwarded-Encrypted: i=1; AKwUvBzoQC/eOil6LwqdlO+U3HuAyMY6+c7eH7A0O6ZxVSFovxxPblKgGq11Hid7TN1+WsrFddWtjPAlYbcvWFQ=@vger.kernel.org X-Gm-Message-State: AFuF++kql4o0LbJqe53fMAXLVzLSyTzj5kG/7f65tKA6dBnV/aWVq/6z JQZpjtOEUUOUoOsIrCw/ongoUCi2v3kctmxvbWF9b+PpEhsN3n/xZFB+nO6Q3rKSsw93p5v0iOJ 2ri2KBWZpwZLYNvd8bNhIn+X7qmBTCU7i2m5DqgkerJTo6Hw12oKHNf3IZb9o2YHknKs= X-Gm-Gg: AYBFou3+IGZ6Gdb4WfbWl0d7FkeF6QHag5bF0lIcCc86yJY2UEKyijF1nSlzaxJfvH5 Q56CKHIwl2Bg9zGk/ffhziGG2OMdP9iXzAsLK3jHcR54br3U3clyDlHy1rSG8t1k8p3kln3ture yjU7fjmqLioA4NDiJvXBxVUCZSS4N73Uv+fapZKf3NP+dq8LeLgBbvxBe7wFyfEjjigHJe4cWfA n1t93Y4/43k7+4nNHPyEUZzRJwEycDJhXxBQeKe0sfaUEbg7JCtDnGg9fjGtlfRLlvbL4ZWOXvi VAkFw8Yd/Y1FIRSlBgMB/IA9/uGo8Z+YMq2C8T1UAb/FCcURBzJ1//xerA9MjBlhX23dvNH6MDW CVhxH14Wryzmeaj0VFk0/tShgy6HYhgdvIYxGX9BIxrXG0uqYlyHT1hHjng== X-Received: by 2002:a05:6820:f008:b0:6be:68eb:e0a2 with SMTP id 006d021491bc7-6c540087048mr1536969eaf.9.1789398123520; Mon, 14 Sep 2026 08:02:03 -0700 (PDT) X-Received: by 2002:a05:6820:f008:b0:6be:68eb:e0a2 with SMTP id 006d021491bc7-6c540087048mr1536758eaf.9.1789398121612; Mon, 14 Sep 2026 08:02:01 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c296608480esm468632666b.36.2026.09.14.08.01.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2026 08:02:00 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , "Rafael J . Wysocki" , Daniel Lezcano , linux-pm@vger.kernel.org Cc: Dhruva Gole , Abel Vesa , Lorenzo Pieralisi , Christian Loehle , Maulik Shah , Yuanfang Zhang , Sneh Mankad , Suzuki K Poulose , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 3/5] pmdomain: core: Add a genpd config to support unknown initial status Date: Mon, 14 Sep 2026 17:01:39 +0200 Message-ID: <20260914150146.187622-4-ulf.hansson@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260914150146.187622-1-ulf.hansson@oss.qualcomm.com> References: <20260914150146.187622-1-ulf.hansson@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: aVeo0-C5Wxc8kc1RI9OA8Gd2FS9tOzed X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE0MDIxNSBTYWx0ZWRfX5DExs78vEOI+ 64DHlFHWB0pCZmTSjdWRXuBYfPLZU9OxUa7+S/zcg+Tmiq/AwDGls7O8Hb0IEPK4yJsb4J32EHN xC7Xm2HvnuMglipatMN3wBUQ9bYD3zI= X-Proofpoint-GUID: aVeo0-C5Wxc8kc1RI9OA8Gd2FS9tOzed X-Authority-Analysis: v=2.4 cv=ftpJ914f c=1 sm=1 tr=0 ts=6aa80c6c cx=c_pps a=7uPEO8VhqeOX8vTJ3z8K6Q==:117 a=h7aNHqOhPKB91FvYUefsSA==:17 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=pGLkceISAAAA:8 a=EPyTabgPSFAr6pNicGcA:9 a=EXS-LbY8YePsIyqnH6vw:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE0MDIxNSBTYWx0ZWRfX6Nv7mAXY11Gd 4OEUGDCLDhN7WP6UEzE8Vet6z3p8hSGMQisDJxNd9U5PtX87qIA5PRGZ0kE5i/zYwhXzi0Ha9+m uuCAVAIXdSnjiwSF2UEvmZK2f39afldXuTdVebkvoiOnWWlDJi300cW7NMwRarH6pLNKCViLg3V sYIN0+tde2yotWsizAqxaL6xv4Psg0sVmVIPXPw6FUmCedAGZrlRz09T+c6Nyef6t+SK1G8AJef 9qNIMD1l5kXy6WcIVbZVKbs0TQj7VBoZIGvDVNO3zxQXL0IpDCbAqSpnjsKK7j4H+HZ6Nt7V+ri Mdd9DeJBewneTEoupW3UnC4UZQLUIhVZV7cWkTpJFh8LFWpBe7t4urH325bxEsBGVZEbh7LbdZe vPrqbf0ujjCbWm7fsvGP7Niu2pmZwWGcQ6t94TGab7EdjVzSF26qiQK7+khCVpGu2Wj+JxXjeyD P5ZeGqB6k8WbSUBvqZQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-14_03,2026-09-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 phishscore=0 adultscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609140215 Content-Type: text/plain; charset="utf-8" It's not always possible for a genpd provider to know the initial status for its corresponding PM domain(s). To register the PM domain in a safe state, the genpd provider driver may therefore have to initialize the genpd's status to be powered off, as a way to prevent the PM domain from being used when it actually could be powered off. In these cases we may end up to power on a PM domain through the genpd subsystem, while from the HW point of view it may already be powered on. Under these circumstances, it may also be required to keep the PM domain powered on until all the consumer devices have been probed. In other words, until the ->sync_state() callback for the genpd provider in question have been called. To support this behaviour for a genpd provider, let's introduce a new genpd configuration, GENPD_FLAG_POWER_UNKNOWN. Reported-by: Maulik Shah Link: https://lore.kernel.org/all/20260811-domain_off_ss3-v1-0-6a0a0fc023f5= @oss.qualcomm.com/ Reviewed-by: Abel Vesa Tested-by: Yuanfang Zhang Reviewed-by: Dhruva Gole Signed-off-by: Ulf Hansson --- Changes in v4: - None. Changes in v3: - None. Changes in v2: - Rename the config to GENPD_FLAG_POWER_UNKNOWN. --- drivers/pmdomain/core.c | 6 +++++- include/linux/pm_domain.h | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c index c593a3479ad0..e8473f5339e5 100644 --- a/drivers/pmdomain/core.c +++ b/drivers/pmdomain/core.c @@ -189,6 +189,7 @@ static const struct genpd_lock_ops genpd_raw_spin_ops = =3D { #define genpd_is_dev_name_fw(genpd) (genpd->flags & GENPD_FLAG_DEV_NAME_FW) #define genpd_is_no_sync_state(genpd) (genpd->flags & GENPD_FLAG_NO_SYNC_S= TATE) #define genpd_is_no_stay_on(genpd) (genpd->flags & GENPD_FLAG_NO_STAY_ON) +#define genpd_is_power_unknown(genpd) (genpd->flags & GENPD_FLAG_POWER_UNK= NOWN) =20 static inline bool irq_safe_dev_in_sleep_domain(struct device *dev, const struct generic_pm_domain *genpd) @@ -2445,7 +2446,10 @@ static void genpd_lock_init(struct generic_pm_domain= *genpd) #ifdef CONFIG_PM_GENERIC_DOMAINS_OF static void genpd_set_stay_on(struct generic_pm_domain *genpd, bool is_off) { - genpd->stay_on =3D !genpd_is_no_stay_on(genpd) && !is_off; + if (genpd_is_power_unknown(genpd)) + genpd->stay_on =3D is_off; + else + genpd->stay_on =3D !genpd_is_no_stay_on(genpd) && !is_off; } #else static void genpd_set_stay_on(struct generic_pm_domain *genpd, bool is_off) diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index f925614aebdb..14e0e346c610 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -121,6 +121,14 @@ struct dev_pm_domain_list { * powered-off until the ->sync_state() callback is * invoked. This flag informs genpd to allow a * power-off without waiting for ->sync_state(). + * + * GENPD_FLAG_POWER_UNKNOWN: Use this flag to inform genpd that its initial + * status for the PM domain is set to powered off, + * which may not correctly reflect the state of the + * HW, as it's unknown. If the PM domain becomes + * powered on during boot, genpd will prevent it + * from being powered off until the ->sync_state + * callback is invoked for it. */ #define GENPD_FLAG_PM_CLK (1U << 0) #define GENPD_FLAG_IRQ_SAFE (1U << 1) @@ -133,6 +141,7 @@ struct dev_pm_domain_list { #define GENPD_FLAG_DEV_NAME_FW (1U << 8) #define GENPD_FLAG_NO_SYNC_STATE (1U << 9) #define GENPD_FLAG_NO_STAY_ON (1U << 10) +#define GENPD_FLAG_POWER_UNKNOWN (1U << 11) =20 enum gpd_status { GENPD_STATE_ON =3D 0, /* PM domain is on */ --=20 2.43.0 From nobody Fri Sep 25 09:20:24 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 904C1496D4E for ; Mon, 14 Sep 2026 15:02:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789398134; cv=none; b=RHSdEQ96Pq4rMLEOX9gEpwGYyk33Fo7n6iLHwm0pH9PqzGZs4QM7YOfMmIEIMDFP5FbmgihjHWtWW9Nqj9/34VJKhwGngGNfIowFfGVKH836T0iXQ8AqXDNHK5DSkWCdb3QvNKkeklx0xkZzNkbqzuI8UuFPm18w/ika+OId3yk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789398134; c=relaxed/simple; bh=7l1jH4YEwwaB9bVTubCiHOrHrjM7s2t+ualLZn24p7o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XRhrlNvlwxtU+SO9ELnvwtO2IP/ctvCtMXGT0QJd5aouWo8fKdUMKRlezPXYGcE3v5Fa/FiTqHMNwJ/dgZ61tE2PZX3S2aTxEoBH3ntj3nAdUs/8mtdIu4sPCMZjKIme9wDNuWJXYjdp94MKdDG6z9l/s+y0nC3mQeSRIi+LdWQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=PNNrgj2x; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=D2y+KV1i; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="PNNrgj2x"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="D2y+KV1i" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68ED0QGQ674431 for ; Mon, 14 Sep 2026 15:02:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=HKDK43ay9zY tKdxpkhmpR5tzBLdv8wVtA8UrvJmZbMs=; b=PNNrgj2xk1EVdX4xt1Bn2RFQdPV ZNGqJ/gLtlYrw2aAyZoshur384XYsKMYZI4sopxxebhppb2J6ILJDyG0CRKzGbg1 NbBxFWFs9ivdli9ZMrqm2WTuX0qayLTIQYBZhN/kCRC7clqpogcQ1L7JsAmNeg8U 5+syTQqoiQhhwHfuRCyOs20S2AUGq0Z9hCXJEO2ZP9kRoOA+sYNgWhpOR4iLayUS bz0q3Y81tGiWtfVVVmi9fCIUIrHFWBL/fQQo3xvbjoax4p+k5BgK/c/sK2uZuqpI xGCSP+wwwriu2zzTsTVIeESb+foFYkHAZ2JTm75BVfH03C3sHalj060/wow== Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gpecs9a83-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 14 Sep 2026 15:02:11 +0000 (GMT) Received: by mail-oo1-f70.google.com with SMTP id 006d021491bc7-6b1b8b593a4so3392545eaf.2 for ; Mon, 14 Sep 2026 08:02:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789398126; x=1790002926; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=HKDK43ay9zYtKdxpkhmpR5tzBLdv8wVtA8UrvJmZbMs=; b=D2y+KV1iWlyoG6wZvn2fRggY51zyUCOgLNS1jbp9XbqCsP9f60xam0A9HannU9OkxD n58lcDa2iAEGysL6dSNwcP3KOHCrqXzn8J4BlG42noSZpBUmmIw30uTmr8W16V/JQahp RqKWGWcBibPkFkG8bJYTFinov1Ge4VxLNW4/FQVcH6VR/AS/g4QFk+scGQLW6P88o+aH e5XFZH1csT6hcgWW0PAXWQ5hP/uwXRgvs9I81nIu7sue47V4d6bAWZZ2U7PkFwG1hkia gG/WQz3mtO669ziMpJBWGVZcZXzQL7KrPKFx7FAaHmDU57iU3UaMhGnuV4SpZBx77ncd qtaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789398126; x=1790002926; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=HKDK43ay9zYtKdxpkhmpR5tzBLdv8wVtA8UrvJmZbMs=; b=n0OllmyPWbGfivZLew+v7m549rgpepFu3aFjPszmvh7EcLGzb56GuDpnY58WP7QLeV 0yN4F8WrLF3ALjSm4Z8cEl9hF1L0wpGtB2xAjxdJ3MFVVPgF84U+Q2YnAa4eRirF2ebs /UfxdrwAh8sHECVEFiOXcCVErFkurl7mZ026vOVSgKYQ9rYbSInCZPTU3HXEX6H/QCCx sJY0a/j+1nqkK3sFf7zhxbGJfAJlJjq7Ry2ViqXB0rCf+vW4atAI2rGVdx4uc1wikOjq nGBgMzHCJHvWMePaVX8DxcHkuOZ0DBvveMcmChUPMngx1UHzc+fcogM3zB/rD1PNiqSb q37g== X-Forwarded-Encrypted: i=1; AKwUvByjfzvbNVN3FpVIevp5F2HhvFwgDKiFEDG6E92S3+LesCSLroZmtLUR6Kbza2dt1b/n+7OZguWRV06tadY=@vger.kernel.org X-Gm-Message-State: AFuF++k8gDIXAE8gCkGapW/eBbbMuOoO+2aR7fHRdq82nViWjw5LcuVo ElGddz5/AvDhzz/uKXJ/S5vaA1jxxMfsDr9s4Y+m9A8dKH6XfYXK46HgtiT2bp9ubGSkXXyrP/5 cTiOEPDsbsnsuSFhIOveatTegS4iWX5h5fF50MgGT9z+90/j8CwBJPUjz/F7rwJShYvM= X-Gm-Gg: AYBFou2IwYDBHeqSUtsQVQr3s1dF34vzJ2VZxjseo5aAhizE8zUqYrKIIpbm9jDfyu1 UopfJH7rmVp0SEkJyA8u8xXOOFM6A9ZmC2Zrw/cDMCi9LHjorvUUdf1BjMKnOqfqglBms4z6jcB +TCY0dHMDryUN+4vl+kTBnr6ooBcKnLSvfl5QtQ3gktkVunWQi9LrDOIptfMoTEkjVxwL5OW0h0 fC8MJFnAjE+VMvztWSEH0KgZaIN2J5FiysAywbVthl8J24LYhLc+BcQdH8BfYgCl6dwqMhNC+KF dZenW+SoXY5xdBfNPuil6B4DskQAOVAREKSYwR+saprVYQmu8OWAG8pMfC/3U0PGnFLDkGK06FK 3CKDSiER3MIUWJfNjjohJYgiFIN+GJZ4FFFUSF1I7nKB0S0zCpQurTSZLvw== X-Received: by 2002:a05:6820:6ad0:b0:6be:dc4:13f0 with SMTP id 006d021491bc7-6c542926f3emr1546471eaf.49.1789398124765; Mon, 14 Sep 2026 08:02:04 -0700 (PDT) X-Received: by 2002:a05:6820:6ad0:b0:6be:dc4:13f0 with SMTP id 006d021491bc7-6c542926f3emr1546403eaf.49.1789398124319; Mon, 14 Sep 2026 08:02:04 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c296608480esm468632666b.36.2026.09.14.08.02.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2026 08:02:03 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , "Rafael J . Wysocki" , Daniel Lezcano , linux-pm@vger.kernel.org Cc: Dhruva Gole , Abel Vesa , Lorenzo Pieralisi , Christian Loehle , Maulik Shah , Yuanfang Zhang , Sneh Mankad , Suzuki K Poulose , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 4/5] cpuidle: psci: Initialize the PM domains in powered off state for OSI Date: Mon, 14 Sep 2026 17:01:40 +0200 Message-ID: <20260914150146.187622-5-ulf.hansson@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260914150146.187622-1-ulf.hansson@oss.qualcomm.com> References: <20260914150146.187622-1-ulf.hansson@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE0MDIxNSBTYWx0ZWRfX6ecq+06VKcSC 8NXpAkb49Cv7qoUjSHZoltzl3+ymsIQqULl4pvVwENAw6mTKz+upp0e+8d9X41vyjDPHe1V81IB qR7BzvR9O+vtwg1dutWx4rY+ReMopjA= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE0MDIxNSBTYWx0ZWRfX0pSL8yqUK7bt J00hsmxhKd7WV2T7HR+T2X0vUF0LAVrsHtp0pAli2JJV/aT2EkFvfLKB49IlZb4Avhk0KA4fQH2 b+OzeMuMdf6gYBhMqTEWiwCgJYcS6Tn3a9K7KmgsMEOExDhNCDhoJPRRBlP0g6NOHY21xmXYpIK KAHZjjFrLZav4ssUe0FYVBM+gsfaMhJ6Eh7+iv5o1JTFJSjYtJcZE8dU/bgETBh2zKBrVMTAZUf Y0a5bOAg2JswAnMi5MLxG6PutyZWG7x6mYAuhM0zhGCGqy6VUutppu/SbQal3ckIQKwqmq0iefi 2UI0yGMfM0rKiMDLj4nYc6ly0zgf7N8vyWmy5bQz8eG6542L/a20qJoATNcajcf3tnZuW2nPvKG Oxh0XmcFSfkjfIpjLn13mmYEgTNd07KLbUrN7FUpJuau0oDcGmOjylLddV6F/K7dKRiiOs9sn6+ 7LRLTqszCSozpX2P1XA== X-Proofpoint-GUID: A59-o6bHNC_4V0qODWQC6Df8rAr5ujrq X-Authority-Analysis: v=2.4 cv=b/cncdGx c=1 sm=1 tr=0 ts=6aa80c73 cx=c_pps a=lkkFf9KBb43tY3aOjL++dA==:117 a=h7aNHqOhPKB91FvYUefsSA==:17 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=GddhhVl5-a8N4MGu71oA:9 a=k4UEASGLJojhI9HsvVT1:22 X-Proofpoint-ORIG-GUID: A59-o6bHNC_4V0qODWQC6Df8rAr5ujrq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-14_03,2026-09-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 adultscore=0 priorityscore=1501 phishscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609140215 Content-Type: text/plain; charset="utf-8" At the point when the PM domain and the topology are registered through the genpd subsystem, it's not really known whether corresponding CPUs are online and thus if the PM domain should be initialized as powered on or not. Instead this information becomes available when the CPU devices gets attached to their respective PM domain through dt_idle_attach_cpu(). This is a problem when using PSCI OS-initiated mode, as we may end up with a PM domain that has the genpd's status indicating it to be powered on, while it in fact may not be the case. In the less severe scenario, this leads to selecting a shallower domain idle state for the PM domain than necessary. A more critical problem is when a non-CPU device shares the PM domain, leading to their corresponding drivers not being able to trust the status of it. Let's fix these problems by initializing the state for the genpd's to be powered off and in the deepest possible domain idle state, when using OS-initiated mode. The support for ->sync_state() is maintained by setting the GENPD_FLAG_POWER_UNKNOWN for the genpds in question. Reported-by: Maulik Shah Link: https://lore.kernel.org/all/20260811-domain_off_ss3-v1-0-6a0a0fc023f5= @oss.qualcomm.com/ Reviewed-by: Abel Vesa Tested-by: Yuanfang Zhang Signed-off-by: Ulf Hansson --- Changes in v4: - Drop GENPD_FLAG_RPM_ALWAYS_ON. Changes in v3: - None. Changes in v2: - Fix a bug in the call to pm_genpd_init(). --- drivers/cpuidle/cpuidle-psci-domain.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidl= e-psci-domain.c index b9e4ad7d43a3..5722365b943e 100644 --- a/drivers/cpuidle/cpuidle-psci-domain.c +++ b/drivers/cpuidle/cpuidle-psci-domain.c @@ -68,9 +68,8 @@ static int psci_pd_init(struct device_node *np, bool use_= osi) */ if (use_osi) { pd->power_off =3D psci_pd_power_off; - pd->flags |=3D GENPD_FLAG_ACTIVE_WAKEUP; - if (IS_ENABLED(CONFIG_PREEMPT_RT)) - pd->flags |=3D GENPD_FLAG_RPM_ALWAYS_ON; + pd->flags |=3D GENPD_FLAG_ACTIVE_WAKEUP | GENPD_FLAG_POWER_UNKNOWN; + pd->state_idx =3D pd->state_count ? pd->state_count - 1 : 0; } else { pd->flags |=3D GENPD_FLAG_ALWAYS_ON; } @@ -78,7 +77,7 @@ static int psci_pd_init(struct device_node *np, bool use_= osi) /* Use governor for CPU PM domains if it has some states to manage. */ pd_gov =3D pd->states ? &pm_domain_cpu_gov : NULL; =20 - ret =3D pm_genpd_init(pd, pd_gov, false); + ret =3D pm_genpd_init(pd, pd_gov, use_osi); if (ret) goto free_pd_prov; =20 --=20 2.43.0 From nobody Fri Sep 25 09:20:24 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 9D9EB4963C3 for ; Mon, 14 Sep 2026 15:02:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789398131; cv=none; b=MSM4bn7I4Ad5kJXsJBUCjckVE5wfuX6aYOJTEzzhFsV/RMpZSIo8ik0KsOYMVYQojnreBEumlONs1jYSkvCFUafBjylMR4+jtdHXct4uKx94H7tqEzhQXLj9PGYwZuoqbYp/ed9GlzZEeIJEgGs96LFWKjSInmrKLbgTnP8bTH8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789398131; c=relaxed/simple; bh=eRZchRufhj3t9s/2k/I67ScznlqWKjd4OkHFdD5fxaw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MRqv5YT2gxb6SL7EzhrYzQrMkCBWHj1vaxXRhApk3euAnOhvrkgXjaCiS/0zxwtkyiMH1FHxuYnGHKSpkI1yKJct6QM65Q7zqQ/jRbgC6q6RB3BaYTXbG46MhqGFmTrY11XPx+2Dkui8In9v5bwYvv7QOGqgyT/oTaJEubfAzBg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=RrEuUu9q; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=DfXbY3P0; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="RrEuUu9q"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="DfXbY3P0" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68ED0cjR1200557 for ; Mon, 14 Sep 2026 15:02:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=w4t3O+boQ/6 prVdjN4I3fTqFDViq1Qb1L+fZxB5u9Ng=; b=RrEuUu9q5M9qmpGHhQ8s8q7Pzl9 EpkPm/6FmCnxpjBOSLOGlCC4llT6x5+99fyOX7zFdEhdG2bIE+aelkWW825w49nR pY2ITnqj1XjmAVakfbg3jRGMmlwsUjrW3o+h0WEcufPQY+T9240rla/h6/kmxD89 6psc+Yb+beDmcVwsDS+U6+yl6MbG5AJIxgdHw4XeoTHhab5r/+D46h46fBfWb1G7 ZzaUmglfFTWoBY9GGm2162yjAoWviXpIxNHlEjEb6oJOKuyVfigZzuJDfi30gCsJ BuBv4CBNv/j4DDRtxDL8uXSqP7Oo24bB6r4vrzDoMrlb2Z7K2xy0GcDdGGQ== Received: from mail-vs1-f72.google.com (mail-vs1-f72.google.com [209.85.217.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gpdevsej8-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 14 Sep 2026 15:02:08 +0000 (GMT) Received: by mail-vs1-f72.google.com with SMTP id ada2fe7eead31-78fea4e86f5so3522746137.1 for ; Mon, 14 Sep 2026 08:02:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789398128; x=1790002928; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=w4t3O+boQ/6prVdjN4I3fTqFDViq1Qb1L+fZxB5u9Ng=; b=DfXbY3P07jgfy8YPoXX5q7lO7IHMw2IXSygglBsj5o3G6LPeM96NDTst1S0WmpSZtm vfCOsM05Sqbnc6En4zjo/YuE+ynNO+GeU4grjnwZQ1ru15AtPEuzrXCocZDbaOkCqRVB vooGl9MZXBR2FDdgGMbLEQAkFxL4Ys+v+iqKc3iO31+Xft3qH3fL+QuV1YGdLrurXj4W SJYRWfYu22GtmbNT+afgSW3hnIZuaeWS3p/wXUoafnkeBtUC/+UGiODjCDqPx5B6oBel /UnpuW+D1li7Jgimjbrx3ZPieggjGF8FfcVedPQCet/pdI+KKbosA+7SFV8vMI7ItUZT AQrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789398128; x=1790002928; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=w4t3O+boQ/6prVdjN4I3fTqFDViq1Qb1L+fZxB5u9Ng=; b=YJct/iYhvWiKQstHIq/s5sMDMGhZBXEhFK58tT2sq+evo5UEfgwTLuJS/GTN/h2n26 nILc4eEpjVJQQr7Xohz7t8UiP9X3DwWf9iTrR4JgSvveOubuUnSVcFpydWBVA8CGXepu ATxZhN/bsZSgxp0sh0QFtICxHK/+gpKJi6s6WlOw8/0HE7q5iVxkHqyKL1SueleR4sRh uU5MWttP7Rqs3OplgiLE0rAxZURdpJ67mUyJAGRxNwoJu1Ag0yaBuagMaQCXZy1J6xJH Jxi6rDsAu0aNebcMXwjYamPx1Zk9zl0QBsH8NXA36MpMmsSkk0+j2t+5k+zKovzcD+Xk 4oQA== X-Forwarded-Encrypted: i=1; AKwUvBz5HCekiJF3YeiXxJKkLVmggY7LOT9+XOyGfL3uWMld+sJTtjUUwACD7fEXIAqQ8HSezVppgvjrR/d4DsU=@vger.kernel.org X-Gm-Message-State: AFuF++lVRH3OB6Lx3xTjKy4LI8zfjjNjSszFEjcpcjRLuZ+QnfHiLPrk Mq1XWXeR8SZ1gqEBXe9aaiQAQ2bB32qArE/4IAr68YEfhC1G5khG/wPf6TNPgUq4zM6PEhvDGsG RnRugSbx8Vm8R551FxBQTHf/a7ugSlBRUPS6dW4s0Tfs9sPttb/pJ2fHYxuBsJ/GtgiA= X-Gm-Gg: AYBFou0BVZnc6bn/nzkEIfl1Ao8RK8J27M2d4a9c60DltI6C6fG8oKqusC/T69KzJjA UqMKgdtVZK/jrBlUVk5FhZdxpz1D28VO3ozLgOCNNFZLR7/9ZIUjt17BkzUHvAH2aodgBvdOliG FAoLnfND21Gf8YR5los4iiPXUCKiSc4TDfxsRVhB1ZGEsQeQVvSKQLO2fjHZZulKtYLNcTouIZ3 SNkQevvvyxPuN/JuJZFrouVxp+jc1dudvHQ8n4Qo0bN+vxLa0ZtStjqkZI/xe5jAz95elEQqF5u bjHiini4Lh39SkAIdVPTLPDJj+GETVB2ef+udx7zkfKnF5ARZennbxDFVjYXRjIPn1AiaELfI6S yRGjlKt8x0SFna+mZ20cJi95q+uNn4sdPq5Dp5K0xqbAbNhoH8m4Lai4Wrg== X-Received: by 2002:a05:6102:22d4:b0:791:740b:7ce6 with SMTP id ada2fe7eead31-798930aa611mr2058730137.11.1789398127705; Mon, 14 Sep 2026 08:02:07 -0700 (PDT) X-Received: by 2002:a05:6102:22d4:b0:791:740b:7ce6 with SMTP id ada2fe7eead31-798930aa611mr2058562137.11.1789398127096; Mon, 14 Sep 2026 08:02:07 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c296608480esm468632666b.36.2026.09.14.08.02.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2026 08:02:05 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , "Rafael J . Wysocki" , Daniel Lezcano , linux-pm@vger.kernel.org Cc: Dhruva Gole , Abel Vesa , Lorenzo Pieralisi , Christian Loehle , Maulik Shah , Yuanfang Zhang , Sneh Mankad , Suzuki K Poulose , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 5/5] cpuidle: psci: Move initialization a bit earlier in the boot sequence Date: Mon, 14 Sep 2026 17:01:41 +0200 Message-ID: <20260914150146.187622-6-ulf.hansson@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260914150146.187622-1-ulf.hansson@oss.qualcomm.com> References: <20260914150146.187622-1-ulf.hansson@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: vYxOkV6dUzJO1DxD5CY-3VfZF9LKhpAP X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE0MDIxNSBTYWx0ZWRfX024OlTvZNhmp NCxv6IYs0+MdU8km1hyfuILVGRcixxJytYlk6NpIFWTer8lwSj/sMnrPM/XykWQkHhisRFRNHSB oaT/Zp1JJH65AkHUMeivy68MwMFzG2o= X-Proofpoint-GUID: vYxOkV6dUzJO1DxD5CY-3VfZF9LKhpAP X-Authority-Analysis: v=2.4 cv=ftpJ914f c=1 sm=1 tr=0 ts=6aa80c70 cx=c_pps a=DUEm7b3gzWu7BqY5nP7+9g==:117 a=h7aNHqOhPKB91FvYUefsSA==:17 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=lJEbMRRrfWY45v_ev9wA:9 a=-aSRE8QhW-JAV6biHavz:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE0MDIxNSBTYWx0ZWRfX7AQA6gitkXmf FSTMvUSHArrZlkrRLI/UaSiEQr4XbFheP74ZKtnFmEJCq9o2FrNemo8yyrkT8msJpRUnm9T+Ego A8UMHsNMw9aYH26+K0GF78oy4p0Ce0wqxA/4yjSpegqudF52nYgManp3ZOJmjU2n3T+SZof9bCh yvM0lTrWMvK2lMXFLQ7cMsRVFdQW46seAhxuwM+lPRAzQIUvz9wj0IfNwYUFEuVDjZaOvUaP5Xr v/WaNM6hM+UZh7o9BspMhCRrwXos121j7etEKdewb2fF/H2ySK2AacUqA+MkvyeuGwVFWdDDuBq d9/oQotc/bER/DtTwbHsSmbQs9y6mvWUdvSZJ4X0YFPhKdq7H5EknePej6jrGY0fkV9fzj7uo9a d9f7D5wRbGhkfExOjrQ+9Yew5RNdUZcJbww+uyVSFoIHnTiEVbAsXjm2Be6NvwAegYP7RmG2KTY yt35dTUvvUdMTdBBahg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-14_03,2026-09-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 phishscore=0 adultscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609140215 Content-Type: text/plain; charset="utf-8" When using PSCI OS-initiated mode along with the cpuidle-psci-domain driver it's of great benefit to attach the CPU devices to their CPU PM domains as soon as possible, as other non-CPU devices sharing the same PM domains depends on it to allow their devices to be probed. Let's therefore move to a subsys_initcall, which should be soon enough after the cpuidle-psci-domain have initialized the PM domain topology. Reviewed-by: Abel Vesa Tested-by: Yuanfang Zhang Signed-off-by: Ulf Hansson --- Changes in v4: - None. Changes in v3: - None. Changes in v2: - New patch. --- drivers/cpuidle/cpuidle-psci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index b250d0dde760..0187d6a9096a 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -479,4 +479,4 @@ static int __init psci_idle_init(void) =20 return 0; } -device_initcall(psci_idle_init); +subsys_initcall(psci_idle_init); --=20 2.43.0