From nobody Fri Sep 25 23:50:55 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 1EA7E46C4DD for ; Mon, 7 Sep 2026 11:17:14 +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=1788779837; cv=none; b=eiZFTOxfa3zK6O9cwrd5AKG87Ymq5BhvCODSBlsnJlIpb8wZzDHhVnGokJCgrxTzs5B3GnlxcRo5eVQW8Xku3eCW4bXIa1oJdA28LNqF8hhukKV69iG5ki3EWpoSMwIR0x6PXCfZNguq8dJil68wC9p7H+1U7zD5pwwC89TfkvU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788779837; c=relaxed/simple; bh=rtfTi8s7RnrDdgBmfWgzW5pFKcIkk1Hq5E0Rp7CqHm8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Azah6tBWKlHqo3eC966EI08nGUtdkH1DYf5iGqxaa8iWM+qIeaeFXqSGLk2n+Gs/RazfDPaGSNKqQYjd7PMbWObOKgFrSuM5W//QC/CVoaHuR1HP005GOsBTRjTxuI1jyGG2beC2S+zKLM1rninwvbQ7ZDZulZIncHVc1kNgrR8= 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=e9E0eb5f; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=TdsctEgE; 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="e9E0eb5f"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="TdsctEgE" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 687An3Xp3230477 for ; Mon, 7 Sep 2026 11:17:13 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=uMpBv2fRBJd s8dHrhYUMdWkn5lQ9prASbg0GWZNOMRc=; b=e9E0eb5fQtChLbGgluVBn5yBJzG X0C/+XM2EPfeutvph+M/8GNqEgAIICjC0QGqwezaFPuT4bVwDncPRHhQGliD/znA SnjZjPxrs+suLrWdz+2KhEPbE1i37VCJ0HTCy7U4kk8yEYq2Wc/gUkD8Lj3WxflA Fnl/EZXHQYoL2eiKAzohK9GaC4axH0rqzpjrdRtKE6+iQSFEMh76cxxYQ2DhFHM6 96kLjObHC4lOkSWlznpnC7xF9dxDdN7+LNUgnIc7b4LFg/+h2wkZhl/pfEiNvlqr Cv706Vrz3XDtb15sUSqdX/Oa0BQh7FaufilNr835ZoHeJKRmac0811ZTZ9w== Received: from mail-vk1-f199.google.com (mail-vk1-f199.google.com [209.85.221.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ghfxktec7-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 07 Sep 2026 11:17:13 +0000 (GMT) Received: by mail-vk1-f199.google.com with SMTP id 71dfb90a1353d-5c58ce17b10so4214220e0c.1 for ; Mon, 07 Sep 2026 04:17:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1788779833; x=1789384633; 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=uMpBv2fRBJds8dHrhYUMdWkn5lQ9prASbg0GWZNOMRc=; b=TdsctEgE86HAOK1j5qHrDSI47NTxfEbC/UI27rrI0cZZyAOB9J2FEh9MSPnzyOJbWk rAwh8hS+Kv8XuTleYtvDMzYl7Fmq2owncIookJjnF1iAtaja0OIJHMdSfLxmrTcE09W1 7S75bKtiUnzd7oZjns7MOdsxshDAa9CJP8KSLjStUskcPG6TTnDQl3aG3Ws9X+tO6Tnb WqMhf1jJ4xvlDgDy8tj2GdpOI9/hemoG00p0XzfnkZxfCE0YT6YXTlO+g9HKYRgxJ2N6 JMOC2jrQs+DVzmLR7jC7yGECqJ6UqOC9dreWUBEJryKODUddNNzy+HeJ9Ah0128R5q/G 3oqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788779833; x=1789384633; 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=uMpBv2fRBJds8dHrhYUMdWkn5lQ9prASbg0GWZNOMRc=; b=TyqHwy2wT4pG+HC1aVPgLlkaDKzN22EXzmFVv8e4NqjhzzvFdPbP+qK50Dqq80VxsF BgmGtHMA4VTHHPg/jR8+8yVAKbtCul15aMF7SFn/tB5DyBeFIaFIeQvN4Aiv+E34Tzfi Ix1QP/vvnHK43kRw4ZR43Rh3F7xtr9pOqDooWqw7j10ZiJZ6yVKIJcbYoc7EOjS/fRRh fGK9oOcvaCCQzZIin2CT8mjruNKL5SKevSCWsx1xujDahNsbhno5RfZzwbLTz5sSY+9+ DPxIIyoelrDT6CJHL8ymrVgVVixumXz8QlC2vGLkQaioUJMTtmPVwpEPQsuKkRpyOtFr PL6Q== X-Forwarded-Encrypted: i=1; AKwUvBynPkAZDuqMiEpAQqbyuzyz3I6X4UCudnJMiJnx7gA5DeMojWNRaNB2n/M7Gnb3UTXd5/EaY9UGud2nCaY=@vger.kernel.org X-Gm-Message-State: AFuF++k6Dkb+JkPqAwPf7PPNElrNENf+uZpnX6hFR6EkAYweLcMyUK5U 3b13RzkhC/2zGmltdoUCOtFK0Ke79XMhXKUsMel4cnzXzdoWmyhNzaIL0PDS+cY30a3omCW2QkB mE+hU8vLQ/TZd/UpmUtntMVdi04oornVvqs9EPzC0cR3vgi3dYGmNBAJokOdeb1yOFcg= X-Gm-Gg: AYBFou1pmhNpN3TFXyFW66D32FftKq/3vY61wuDSqHfVArdV6fw+WIkAf/60HPxnJUn COUreUyZBNYCQp6GHGPMZrPiPF1Z3btVyiDQcHfw4mxHa8hp45Vn96zjdHhWoGzifl1uJQ6uIPy +PQVtlBXsxdSeirnutcsJOxxvd1G8ZfKDvq/MEtFhkg2KwwKtAUauNMWfezT6Z7OfgKUKWEP2ri N5O2rJNHyyeMqRQj6hd7xFULD29BO58sesZ367eRJXQ+HFd8tjr2LljP+8rTIftysBFY1r6zipz vhE89tANUTTbmKXGViHiIzr8C1kWk3Y4+enS3kpfxLHVtYGEqU+01nFHuMN7H/CHezSRfrptHE0 FIV/w5nsB6g6oVzQoHFzCN9GZ2xgLnBUujT4ZyBejFyIeaN8v9tx+9hIaBg== X-Received: by 2002:a05:6102:2c8e:b0:785:b0ac:54bb with SMTP id ada2fe7eead31-78a4a9eebcbmr7883341137.7.1788779832757; Mon, 07 Sep 2026 04:17:12 -0700 (PDT) X-Received: by 2002:a05:6102:2c8e:b0:785:b0ac:54bb with SMTP id ada2fe7eead31-78a4a9eebcbmr7883320137.7.1788779832329; Mon, 07 Sep 2026 04:17:12 -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-c260d5cfaa2sm456120066b.59.2026.09.07.04.17.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 04:17:11 -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 v3 1/5] pmdomain: core: Rename genpd_status_on() Date: Mon, 7 Sep 2026 13:16:51 +0200 Message-ID: <20260907111659.263324-2-ulf.hansson@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260907111659.263324-1-ulf.hansson@oss.qualcomm.com> References: <20260907111659.263324-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: AW1haW4tMjYwOTA3MDEyNCBTYWx0ZWRfX5sLPHfN2ai1A 1j9igbMphZ+jKKWvVmkrwtYUZVdnU25EOUdADvgjz7o7TE0LtBtdDLMd4DMxXv8WnvgRnDXbcv+ hY5JKy1e7If4P2WJLRPKP2x1t50lTA7UlJiEPcq6UKqPpSpKxHa3EZ9nriLn+vfhbrS/YzeGZ7o 2NbFXkWWEFX6oFo+dLKhgLJ/HNKsiTBloV1/+pQeYA97hCd98pKGftrRIuAXxqYuPswz3eb/u19 M7KeTfGhhnoGnnygeaRAOmC+5Y/phHok9bapDg3eww79pihfj540IKm5WqWE5cDKk2aWAN3EpGe 3bCruD7BJ5EuKNZbhUR/hPCER4tuvUgpXqbW846eu4+O72FdVbN7XKTFy26e2xDJggI9182R1F8 zalC5LdGXwWrJtO/47BoYugD7J+whZDUPItgOK+6b1sAEQN7F315dcK/itHTn/jDtDY99cx5zgi 5vPqiPXGGERkAlfqqwA== X-Proofpoint-GUID: wwgamDLKv40S4ImMNeqvGIzAQfdwtLQK X-Proofpoint-Spam-Info: AW1haW4tMjYwOTA3MDEyNCBTYWx0ZWRfX+HbrKM3ApI38 aGGP0N06XtG4vF0nqA8amKHgn1jZFEqRai9avHU7t3X6u5TRgVIcpYlvmvuKMo2/Y5zU2B+6iw9 RctDnnolosrZcUkgGQ2zTh6bATHnSzc= X-Authority-Analysis: v=2.4 cv=daOwG3Xe c=1 sm=1 tr=0 ts=6a9e9d39 cx=c_pps a=+D9SDfe9YZWTjADjLiQY5g==:117 a=h7aNHqOhPKB91FvYUefsSA==:17 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=pGLkceISAAAA:8 a=zIFADOUqQBSm_Ft5s84A:9 a=vmgOmaN-Xu0dpDh8OwbV:22 X-Proofpoint-ORIG-GUID: wwgamDLKv40S4ImMNeqvGIzAQfdwtLQK 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-07_03,2026-09-07_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 bulkscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 impostorscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2609070124 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 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 23:50:55 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 1131546C823 for ; Mon, 7 Sep 2026 11:17:17 +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=1788779840; cv=none; b=I+BrisjcdaLTsPEqpMJQnzFOVwOqmz7pV9vP4fLhPkEfpclt2QK2ZZutYqGOelEki7C4QGIc//SfQxQ1zvF+9E3X3J7Dzjo5PnfOmkIIW22CDFMqveD8ycICK2lNMsAW6xejcN725JINADpgOgEzVeG184GXkqVHOlPy6Aug2JU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788779840; c=relaxed/simple; bh=HksTSH5nZIdSJicXwafbbfriQ2xJFLxE5NRRSdeL95I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CchzgF6QliZMh+4VUYoucoSbDQgWS12vCHr594IikaxoA61kZPOfAzf/viE7tmDtWqWoHE5l2WtVopu28ZqkanUO0GCGH0lUw2Lf/IWLBEaAp2E56Ad9CLeTWAblk5b67easWZNMjxfwktk2FVmiWie6/L6E8etoE2f4jcVkQrE= 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=KM9RgnRB; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=OUmaZOtj; 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="KM9RgnRB"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="OUmaZOtj" 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 687AnLNr3777121 for ; Mon, 7 Sep 2026 11:17:16 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=qc3aItDznK9 eNLgbGrQcjkgrtgUZI6baFp+cJdIi190=; b=KM9RgnRBoCz1wPP+BQZ1Q5Oq01+ RazZJXqBUbpn5yUGvYC9zTiaV4Ln2eMHYutAomBj2tloDuWuxISBPUV3Ls+Nq3br GbRtdq36E7Pb9RDcD55E4DHZyDyn34bSkKRA0zaJk0o7lcdU003o+ao3yuQSPKlY RBdDij03LCuY5qN2arSlWCu94glqp7clD8AX3H5fvientMxrpUlNAu7XQUiHVJbX LSy7GZ0uJEoT17p+hDR7s1ZxpVlSk10N2ELjx+d5YnPJl/Da/XEydLDF4usR0nUw PktKGkG2CAQpREwx8hqshIxxG5c+lNT7wEybQOOGsNppayk6r4XLGHyU9zA== Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ghsfygt7k-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 07 Sep 2026 11:17:16 +0000 (GMT) Received: by mail-vs1-f71.google.com with SMTP id ada2fe7eead31-6751db2792dso389043137.3 for ; Mon, 07 Sep 2026 04:17:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1788779836; x=1789384636; 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=qc3aItDznK9eNLgbGrQcjkgrtgUZI6baFp+cJdIi190=; b=OUmaZOtjagA128yvJGrhtDZ2JErUcjlEe2XWDgXHzRrG9IUJM+Jo808TqvRg1b/h8L 8UfaaISoNv1mEYZGi34Di4EdS65G9T0c6EDp+Ge7TSKF+9iyK4IIs3GmO3YgNw4Xdcp/ oRszj42KCAumSHohHr+3SpdkAjW+AN+zeq8hcxSg8pGMqklEyG7XMrT9lJAIx7V2N/JT aQEJ6UjPVXdGShFz1Qba61yECzGdFhVWDoXuiPIFfhrwyWWQOnB+H3NwZkOilmYF7TNB VwC2kQzoYWlEvGBvCy+PiAuz1NlGpk8u4v9XFhpNQuc7cmnxvdlNi4bHC9SqCYv85hvA TXMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788779836; x=1789384636; 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=qc3aItDznK9eNLgbGrQcjkgrtgUZI6baFp+cJdIi190=; b=bs6MSYNIQJ+DRUg11OG6Mw21zJsbxDFcG4MIYya7fpflTBy4knPua48HmlGejqX8uv /NJ4PjrMZDsOXk/BiB3UuHz95T7TOzyMUxYH0DxOgqhS88yG7A+WNRlKuVUXGUcIN34b ge8aWNnemoYTKt2o0LFYUrlvpUabjFfhQcyYSjG0z/s5cRJGpBEY8SWjTd6lrbmjJU+8 u93tOCPh34O9O/WuNigdkBzXecgdw/8C2iIjE8IlWisGQ+qrMtToiw+IWa7xQ1MYjQ3p qeND/KHPamLBJ52eRzoGriSH7IHLlIYPWdwnnAgvvosll/7aiiMin/rlbxd5fWKT6Qmy Tryw== X-Forwarded-Encrypted: i=1; AKwUvBz6RVSD3Xn9JkZIBiiueitd2tbneGBHXZpmSRIUbSH2pyDsVHYtMuRg27elYjj2FujSzXgFEaBWQb6c9gc=@vger.kernel.org X-Gm-Message-State: AFuF++n30ouqf6zXD3ROXLq92ebE1ML2ZRI9rQXo6BcqYMox5p77LEBd xSt1Xmo138BXSq3tfWrdV06AZcXinbX3Dwoc/CxHnqhrBwKPsWRXuuUjmVT76W+/eH3JUqGYuPq ygU2Vq1YxRzDSpqgJGG3X1pbEUhL0IjsgYUbEwscuMzsAFFrAfsOougAiUFdzvNLKFR4= X-Gm-Gg: AYBFou1GI5dYtQfGT60rREB+gZthKRXxG5Tk+r7dTeSMv/fArklQHfqLOmUyD4pY9lw tHSbqZv160PmmxPY0poTP29dZthqH1q8h+wgiWr4rQvVPGSHDFut5PPq7t66MuL2be4gi09F8+s W5hqc2JtpHrVSsJrmYFnAhZZSNY+IiUuBcVxgsWaD7hVr3YBHwO09ng8tYXolhmwPwhOGw0mND+ tgPnYYSwjbH1CcPvmARNNCQeyOKuIkrpsU4Yu5S08+vO34Ml4WMxW25P2k32uvtI9/q9gxNNmCq /7QKMXiE4X3vQmPKENVEZvJBOdHv05G3bTmJZcR6eLZBt1ipngjjI3rDKZMxm5b+CyjlvOqc240 5RyBwSSpIs0A1iklY5NNvym2S6bQ1nZcYIQpV15rmREtRT3P0cHBMkvlYJA== X-Received: by 2002:a05:6102:5814:b0:786:b28e:f980 with SMTP id ada2fe7eead31-78a4a99f7c6mr7574446137.10.1788779835451; Mon, 07 Sep 2026 04:17:15 -0700 (PDT) X-Received: by 2002:a05:6102:5814:b0:786:b28e:f980 with SMTP id ada2fe7eead31-78a4a99f7c6mr7574414137.10.1788779834862; Mon, 07 Sep 2026 04:17:14 -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-c260d5cfaa2sm456120066b.59.2026.09.07.04.17.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 04:17:13 -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 v3 2/5] pmdomain: core: Allow a non-CPU device in a CPU PM domain to do power on Date: Mon, 7 Sep 2026 13:16:52 +0200 Message-ID: <20260907111659.263324-3-ulf.hansson@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260907111659.263324-1-ulf.hansson@oss.qualcomm.com> References: <20260907111659.263324-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: NY1xenx-0HVHiXUta8_bxy86_lPFo1hl X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTA3MDEyNCBTYWx0ZWRfX53ORwvQyQJpZ 8b28iJQ3hL/ZM58e/yasrfIuNVKMtmr7P5r+aGPv/hdEOS7Csk1bsAh8+zOzfbYQWjv3MsRjJsf bbFAKJZDxuU74a1Nmb5Oslk+iJLd8RyOAGitnIuy/K11rfSvM8Z3BC0xP6RFeuEr+OE+VNvM9uR 05MJVrZvJ5CZAdvkUX/wRxtQZ7szBX8xjb4yS8sj+sh6nVUtSkwbtaw342eP5rhkoLG6K6y7h/4 5iws0VYZE3fUgfN8rd2fXAwzcEDSXirJJrt7VGl+M3vrTvPCabjTS0tE0FJuCqLyUY2JUiljfLP uS6bErFKls+vxxSjQIJmV+kIvwixQctxq8lnc+QkVVL5naYkbenx1Q2xK/g0FKuz0VP7sNwZ4s8 tT1SgH0JUoPIyLqoP5L2t6MGMgAbsTWb6Djnpm/OdA7EQIfCpZiyvS0yCmTRlIkCo1AA3pM1VM+ rf0OKaXGvZWQZSNkZvg== X-Proofpoint-GUID: NY1xenx-0HVHiXUta8_bxy86_lPFo1hl X-Proofpoint-Spam-Info: AW1haW4tMjYwOTA3MDEyNCBTYWx0ZWRfX5izDxwYRG+Ov qLL1i9J+YJr/st18UmQud1DteCzHcwjX4rCwfIeDbuEvm9YHDp0fkOY22IlFgwHP5dM0hmwRi2l nwWhA+e1rQncUITtHBAioIHYYkW0ftY= X-Authority-Analysis: v=2.4 cv=AduB2XXG c=1 sm=1 tr=0 ts=6a9e9d3c cx=c_pps a=P2rfLEam3zuxRRdjJWA2cw==:117 a=h7aNHqOhPKB91FvYUefsSA==:17 a=u8BtVuMVLpZXKRMe:21 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=VwQbUJbxAAAA:8 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=VqZmVlX21PZHT1he1CgA:9 a=ODZdjJIeia2B_SHc_B0f: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-07_03,2026-09-07_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 adultscore=0 phishscore=0 clxscore=1015 suspectscore=0 priorityscore=1501 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2609070124 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 Signed-off-by: Ulf Hansson Reviewed-by: Dhruva Gole --- 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..b62d4e544bc5 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 5000000 /* 5s */ =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 23:50:55 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 38B8746DFE7 for ; Mon, 7 Sep 2026 11:17:19 +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=1788779843; cv=none; b=NP2rfDWw8UthmBScApvBdNOnN8jigsBASCCDCmvUOCPzX5Af3QC/59eWT0nAcf/HodxHrRyU/LRdIOaXn2j0COzyWCJe1VQ9Yremwx/EqCNWEEzYbxq28C3xJlNX7MReJX2Ieqc0KJFDgTvo62ca07Ru0zLnMhoVstUE8VIi/sQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788779843; c=relaxed/simple; bh=hqlT9anTRmD3gqufcOooFJjBVMwFzMEzazIesH8QlhU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OQbzn+NRrwP8U0yLlm4mjUgi4Vsx4SvqLErSW8mZRGIoYaHn9KxYTm1t5zhT0Noff0y0zCj90RNFieMLVOW9sFB4bmHyII3mzo4I0ahZiFsECPXn30t9t6nIU3BXs5yizjs86fsLw65xHC0Heqwasgm0upjl8BK8j1xHQ2Z7wmU= 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=BzwKXE1r; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=gvtNgbs5; 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="BzwKXE1r"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="gvtNgbs5" 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 687AnUcG3777909 for ; Mon, 7 Sep 2026 11:17:18 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=V/gIsitsveU 0a1AR6GJ+0ZzNVuCwkMUNDvqqmLHk98k=; b=BzwKXE1rj6fatD+luaFzb1NGkJC rUjn1tioQPU4HRl8eyhJhqXWXcsAFvfq+1VG3hbGpaABhG+NaGqvStlNhkgOdstm OvMUTIQJSZM0p1Dk29+xBEITPnsN5ebGi4oyT/cWJWDiYJMU6/7djULGMbfijDar ALdH2muZyC9JvdoBClIH6vqOs0KAR6o65YWuq/xPlBU3GvLFQF0uoel3cLSxA6XR t2nXGGVm+sMEKnHBZj0DAK5pt00eioc0Xuh406B2aFvyzHqdrIXhvVz/hHFiF/Bp eurgZu+sH/MQeTpaVUnlvpazenRNchNj/RyhHL85uGaZzWDoKiNCWK2lhoA== 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 4ghsfygt7q-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 07 Sep 2026 11:17:18 +0000 (GMT) Received: by mail-vs1-f72.google.com with SMTP id ada2fe7eead31-7866c4ed349so3031249137.0 for ; Mon, 07 Sep 2026 04:17:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1788779838; x=1789384638; 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=V/gIsitsveU0a1AR6GJ+0ZzNVuCwkMUNDvqqmLHk98k=; b=gvtNgbs5BkNefs3rMRKX/V3QWvy8T0CAGYrGG+5Mj+z3rLHnWzLA1f5wz4gsMmekWB DUpcnZQKVazSm2ADuCxDLllyP4SNxFw0ZH9H7DVkwVr/V10dZEYjDD2s7MLf+wqvCkbm 2QWVN63qJnnke1WgIHoGkG/C9oQZLQU/gQ0ErW8Jnwsa8teB+i+6mNqpKtSq0j329K8V aqU4qki8tQN0UEqGBB/IngHdwQg4GxGK3Xb3zRxUV1ZLnzFObo8B7dKvSnhn4i8gLMAJ eQzwD5cUS+xBcgqcl2IzIbk0GjktESdmE/WZr4S0xDJwpqZhEm5SpdGFDIRRHXFmJ2Ma Yi9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788779838; x=1789384638; 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=V/gIsitsveU0a1AR6GJ+0ZzNVuCwkMUNDvqqmLHk98k=; b=qlvgNiYMt/Lh9w3o6o0ivuSfcE7ZimaHJ9qQf89oSq+W06GNr89fkf0++JhltBOYG+ dRNztEhSCgzHUnda3MhTnP9vz8ki7SAlGwMEr33turC2IQV1cCAosA9vDzMMvDeMYseO T7ehnqMoeicHY3Rn7EaIXGCXr6bh2HoFWzZyv/0ZL+sJugvz7fXjDcflXqo3QAWLDA1Y g9AWV1DD/dZrfFxG8Igx0Vb4taVaoEljbzv4nrM3e5yCMNgLSv74kqAoagjLS/0R3NWN 3IT18F8NpnsBiPuZJoa9LB65eCiXXLFM/WNQq3FNCJy0v/Eyo6+rsXEvoKhiLDfrexy9 gwGA== X-Forwarded-Encrypted: i=1; AKwUvBwJmVwbJRJwxGzFhi3hcL1dxfo9Ab5BKBD9usrPB9KjN3t8YVhICh7g0MFRXJ9/uiavR/1sXkfAzMtECUY=@vger.kernel.org X-Gm-Message-State: AFuF++n7b3yeQkJP6US7+ugXWhL5HZ5r0uw/q6HE7EsRJuacjoIqmTOg SiiWoyqj7P2dqvHH0sWKRgT6vTkZtH6R2A/goNf9h/HHfaB3hbSLBGONVWuCHMKhJYV5mqvqNvK qOWNHolag7TqnqUwUvi0tJR8gU1MhKnKTy7wwTUVM46AUZDxi1npHbs+8aPu+ilmDUJM= X-Gm-Gg: AYBFou0Q7o2sy+4Ln8p7BFYhI/BtWwWNtK2hdvE/7wqk6FqMrcTpXOkb+/sGp8Pv7vy zjVf+V3q6Llat5qylatBS9+RVG02cLq4iXJeZx5pWh2Q1OJ/99Zu9pJWXtCquW2nPG0Xgr/rd8c /uXygUFRe/lYTAe6Ou+n5hE1i0MYEeDNLIBy4Qt8qEdK5BIqm8a9Vc3hJkzqNBIS75RfzRSz7/W XD9IqbEOxquJrL6WSYnH1rGHxXxP5a5sH/+a3riyZCR7k6RcCxrP/cZvm7GSlAq0KwwIjcFX5G5 EWuvT4P811hZbzg0oI2+2tHZwScdOgPUUp5aPzaFpFTAHZ5T2uniDiGlCxjoGmXlr9R+bv51GWx xgM9OL6iuZ1oIIKu8PGJTaSLRNj8uHl18d3kh5nhVFMNi52NvJ73DhbmCTA== X-Received: by 2002:a05:6102:509f:b0:785:e444:15e4 with SMTP id ada2fe7eead31-78a4a87d391mr9129619137.6.1788779837786; Mon, 07 Sep 2026 04:17:17 -0700 (PDT) X-Received: by 2002:a05:6102:509f:b0:785:e444:15e4 with SMTP id ada2fe7eead31-78a4a87d391mr9129592137.6.1788779837379; Mon, 07 Sep 2026 04:17:17 -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-c260d5cfaa2sm456120066b.59.2026.09.07.04.17.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 04:17:16 -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 v3 3/5] pmdomain: core: Add a genpd config to support unknown initial status Date: Mon, 7 Sep 2026 13:16:53 +0200 Message-ID: <20260907111659.263324-4-ulf.hansson@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260907111659.263324-1-ulf.hansson@oss.qualcomm.com> References: <20260907111659.263324-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: l0SZchdEHNkBmyTSjREyqTbyCbXCymRJ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTA3MDEyNCBTYWx0ZWRfX7DlsRTH8hA7a sRAXxppJouFAjPP82Gu+61QDgtHqRHal5rYvgKwY9sPMPZKYBoDPTxtuvLsE5jDrHbiLL4alCJq pKJcDZftG72Gw1cHLZ2QTp8cqNTviJmWpgEIRkC8I06tASrD3let8Ws2cPhfPEZH9yTtzM4on3C 8h7l6rzDSYIBQSV/HNbKm1T0k8q26b3iLC7g7iAL1PH5/Iwbj1/8S6yaAMArzVXqKNBDUcoJHz+ k6jnmC8jJHS5ZLs918Hl9/rJcVrrKtzxN8hq6PsDELp63xpc+Qx1lzWldT/pzL4SJftc0t9UEbh pmO8n09lnlcarGotYrNdebEWojio7rJjwp7ieTuQPZtKLkF+d8SoVJfOUjt9Aep1iU14yDiExQt FzEIMIMA/O9QT9czH/Ymo/6IDSQ2CoFrRsjRs5JR7kRnZn5JzucT3Sv+abqrvAFbPWymAUlNC6D iNeJ+aezFOnXVKQ8NGg== X-Proofpoint-GUID: l0SZchdEHNkBmyTSjREyqTbyCbXCymRJ X-Proofpoint-Spam-Info: AW1haW4tMjYwOTA3MDEyNCBTYWx0ZWRfX7Thfy0ysw94I KjG1fV7OW2+AYMlKwdsLXG5zUQrcwuIlYOJUrun2IjRRPcZyvnBJA+ONWwB1ES2zNqnmmUU40L/ 4/Q5EsfTEgzXVXeFq4eKDONR3YoIqcY= X-Authority-Analysis: v=2.4 cv=AduB2XXG c=1 sm=1 tr=0 ts=6a9e9d3e 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=ZpdpYltYx_vBUK5n70dp:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=EPyTabgPSFAr6pNicGcA:9 a=-aSRE8QhW-JAV6biHavz: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-07_03,2026-09-07_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 adultscore=0 phishscore=0 clxscore=1015 suspectscore=0 priorityscore=1501 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2609070124 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 Signed-off-by: Ulf Hansson Reviewed-by: Dhruva Gole --- 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 b62d4e544bc5..5b31ed47d3f1 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 23:50:55 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 E0CE246EF63 for ; Mon, 7 Sep 2026 11:17:22 +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=1788779845; cv=none; b=k8ileX1MWlBuXR188rJqam69EiDFUAadBe5+Pp+ZW1ImAtI4VWQauGKJNICR3ShsyQbzJlR5Zp+fgpYtnTj2BM5N3hOk6ZJRNwbNxr7Fym8tEdzyDilgbs8rq/Cy1QOjhz+OiLsb+N+OMLxYH+CF82U1tWjMJsbx7QeQ2G/Ex8k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788779845; c=relaxed/simple; bh=JtqgtDd2Rh6o3JXJUkEK1dOiQ9UhEEkpFWR+pRyPsVs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U1tOBb91QqbGwnP648mI9D09dbzxhXXOlyu6m0gYE3hjlO3SE0QIv7H1quUu6WpvzEKLh2sWMhBsTTUKEZfd/k5Q/PmbZOyq59WcAhxoYEgc7Efpu6QKaSux7kDWAuJSyOUE4cHdvXihyQe1ggUFQddIdAzDLl1U4pewtYUxxvc= 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=KnzZioYA; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Fj8lZoUW; 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="KnzZioYA"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Fj8lZoUW" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 687AnA6j4064240 for ; Mon, 7 Sep 2026 11:17:21 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=If4KmujJICE 2NXAFfEbDRw+d56OpcwRKDELWSYebh9w=; b=KnzZioYA94fARoHLzS0nDuRDl1p 7mYHCgrsxYB+pnvwjMCgn1DLfIKLb2bzB7GgFdDKURkslOrDyrtwXDYoTO9+O8QW xur2qtmoxBz7wIUIP4n3XWjcmVnehFWYYFOvzlxdDeHQBxZF4X+s6LfzGxeJ3mAn T7eUGGUmG2fOehnsGRBYXyyUXNxFZzgAMrjS5zNELXcNuS6akrJUAegQuQTFB1Yl IA5k9wewNj2wWfpyfSPIsx94NI0LiO8vTOoUG9x5K2qKYfPrzgdaQVBo/un6OqMv ihJPhTUVJ8vn64K5U6nWR26aPQSBFouJett9DPLSojdQMjPb4EvYDCRYgcA== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ghs86rwmu-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 07 Sep 2026 11:17:21 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-93903622880so737982985a.0 for ; Mon, 07 Sep 2026 04:17:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1788779840; x=1789384640; 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=If4KmujJICE2NXAFfEbDRw+d56OpcwRKDELWSYebh9w=; b=Fj8lZoUWS8F1o/LYEOwRIWh/P/XQOsJlk1Y1Hm0A/G1jOFdNpPAe8V8hPlTaeaZ0rf Qh4yhQQjciRoORbtvW92AFh9fwC0vIfvA3MAKC3z+So/rd8IgbtOZye2QdKVF/y7b7aE Lork53doSeeobTHqan7j3ERmzUs3lQE7Vc2LcYzQf4OFt2k1BMkafY8APOsXl8/clAFr +PPOvB3eQ9xOgFXAB1aIQjshZFr4k0vCsYPJ0DCAqZPFh+ZYUJZHgBCw8gS1J92D3hhE DHHCcBL3C0awnMyshLprHvoATgPMLgpwy/04KZtJ2t6fAd3CwJriX5Si0HJBkVwXnywH 9gEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788779840; x=1789384640; 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=If4KmujJICE2NXAFfEbDRw+d56OpcwRKDELWSYebh9w=; b=RaMRtwCvQ9mq36u8Arir6n8ugN6xF3ByYQKDdOyKzZjjnktR+vbqOg7cfSBinMteDc vN3rM4Aer4DGiywCJSgPcrAj0tTPf7ed983XPwMmpcElhVYwB6kn/TvUXOWbV6z9JoIt c2oGLxQhpmkfRjVmA/9ITDm6OpvjV3byN609PrCtuvZWF1UbmlTORPSh2XqedYJ7i1SG z6Ntd5pggJFlaBvDMVF38ce5E1Y56mjdk9ZtRveMHgTLuaKVcp/xB/LZw1hsNmzxJZFu cUHF1Gmh9WD4S9TLaV4afJQ6PAOvVmwQeWsKxEzFvc6lvNRRluAZVFqqSMulbROuQnJ9 BSGQ== X-Forwarded-Encrypted: i=1; AKwUvBwu2DVBdyWBu+ZbHaIlSm3STrXeYSkbswSVzy7el1tl+Hl+OqPc1sht6j7NNIKr+FM0PKT+mmMIz9Hs5u0=@vger.kernel.org X-Gm-Message-State: AFuF++lhQBAJ6NbEUZ/YRk9I9DGYp9z7r/24zjKmhVYKN2O2qKcOwIRa KXSCpd+B3sQM5L0RBXyPst7PbdHRGJsStmrQ9Dyr0NNCo8yotBa+gIJiFpmDoujsYGGNcGrE8Qr LOUEoZwNcYdOqN21us9nlcikX7LWeQbFHFrlKN/iPHKDNlgQn95WtSTlKVvEZ/LV1+FM= X-Gm-Gg: AYBFou1VHoyz3t0frMnAb09dV6wLUdu5o4Y9IeIExcx7EeZB9voXfOMTEKKx2iHOlAI 1FN5mJWUCDq6UHJY4Q9CZY3B2f23zO01DCUBt5NMRMnJjf6pKlWzdaB6kGaiZMDMqP2YKq+b1l4 wVAq8TpwhKKh8ksaaohUiGCjBv0bK2bmKQ+PjVonyIP7676akgiuSWzCrlA0P1Ra9SMd8GcrqYF 6DZLSYuZaJwp3tAPeocWpGwcpQeywBB2UgRux2VEDYlKk0TR8XXq4ZdolX1jZ7qXoDLbIrTXOzf TS3Ip2ID/ZKfpmRwBdj4z1pA141Za57/Ylawn9+4+zlfKrUjRhfwVohIYhfwZ0SPFQQYAofct5o HPLIdOVWm4SMjSdf1x5yFOFZiCAwpbCbYYRCKGuZ+3EUlM/Op+KqBMt3w7w== X-Received: by 2002:a05:620a:a90b:b0:939:319f:d6e3 with SMTP id af79cd13be357-9396deadfa0mr1869565685a.5.1788779840527; Mon, 07 Sep 2026 04:17:20 -0700 (PDT) X-Received: by 2002:a05:620a:a90b:b0:939:319f:d6e3 with SMTP id af79cd13be357-9396deadfa0mr1869560885a.5.1788779839979; Mon, 07 Sep 2026 04:17:19 -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-c260d5cfaa2sm456120066b.59.2026.09.07.04.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 04:17:19 -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 v3 4/5] cpuidle: psci: Initialize the PM domains in powered off state for OSI Date: Mon, 7 Sep 2026 13:16:54 +0200 Message-ID: <20260907111659.263324-5-ulf.hansson@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260907111659.263324-1-ulf.hansson@oss.qualcomm.com> References: <20260907111659.263324-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-GUID: iQJYvaSRwWb7BjXjxdr-RvE-hZd6epAy X-Proofpoint-ORIG-GUID: iQJYvaSRwWb7BjXjxdr-RvE-hZd6epAy X-Proofpoint-Spam-Info: AW1haW4tMjYwOTA3MDEyNCBTYWx0ZWRfX0OpQ99nKQJ0N LctVr4V4Sd6rYpptQM47nZ0/x5N7Zsbcq7tG1txh7cQj1WtRB1RMw2ySeFcWDoL+5xmHUqCp4cH a0GVp55CQFzlj5IxciFf3T35Psxhst8= X-Authority-Analysis: v=2.4 cv=LseiDHdc c=1 sm=1 tr=0 ts=6a9e9d41 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=h7aNHqOhPKB91FvYUefsSA==:17 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=GddhhVl5-a8N4MGu71oA:9 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTA3MDEyNCBTYWx0ZWRfX5/uwuK/RyKhg JnaW2LOjXU0bABxX1hBRAO1PfNSEhmvzMyRaIY0u+b7EjdqdFJ14qPrKUNXCCFNdaeLrw1v6Qyd BWc5t12n8wmmJAnnAQrcaEt8PhFdBJgOmHZZ2R0dJNWhLQPTerfePtI4bJ7qIGLOyZuf/lf2sOr I1y+49udVpazxL3T0USj57dqzoXRpuWTqpubypjM6wqhq3BeeVCv8tHF93XZXaT4VxT+bf21unc +nPBzdgmt7LIv8X3NwBJaCxd9G5LO/S9V4slYsnlyRWkn63O47YUiPlNvQozq8HKY63eb6AR3P9 sTOcnozI+f2vkHn3Mmp2Gm7i3XZ6ibg79zKyQKdiQnSY+o9QP7/dqYZeMfxSRGYCzbsozY/U/G5 dStS8U6OjG31FfLxY9WAUR8xw8lmzJJQ4LcgkC3vsbPOmkL6ai/lm5Wg1fMa8p6XPQI0vxVC3Pp ylK1VPO3U0/iJJUPfjQ== 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-07_03,2026-09-07_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2609070124 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 v3: - None. Changes in v2: - Fix a bug in the call to pm_genpd_init(). --- drivers/cpuidle/cpuidle-psci-domain.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidl= e-psci-domain.c index b9e4ad7d43a3..4d8c63d329c2 100644 --- a/drivers/cpuidle/cpuidle-psci-domain.c +++ b/drivers/cpuidle/cpuidle-psci-domain.c @@ -68,7 +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; + pd->flags |=3D GENPD_FLAG_ACTIVE_WAKEUP | GENPD_FLAG_POWER_UNKNOWN; + pd->state_idx =3D pd->state_count ? pd->state_count - 1 : 0; if (IS_ENABLED(CONFIG_PREEMPT_RT)) pd->flags |=3D GENPD_FLAG_RPM_ALWAYS_ON; } else { @@ -78,7 +79,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 23:50:55 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 C4F1B46F486 for ; Mon, 7 Sep 2026 11:17:24 +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=1788779847; cv=none; b=Uq3emlbgUfuKxXvT6IR9cvA09maQOSzdgYkYgCwVDNel4SmqYsofRxyWoJ4aV8Q4G/lIkV5v+Me6++Y+OZMjuw8nUhOThxUMwIOPTIVG9QJ1rdgBHxYbFqGQaEpXWNG+mRnjRzYWxEMM4j4909ygptif1+fa+nP29sCMhyV2qvg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788779847; c=relaxed/simple; bh=zSX96X3WCPvjM5dc/JWy2IMD1tZ0uShhAn1gR2rmBYg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QiXjjfp/jJ9F75pmLzdTB2S4bW+90KEDLanqJF2FI4uQnNMvaqaICklGF2RiIM8bmPJXaBwcsxGxrugIC19diJqJUiu/1M/Jk+CdPRi23XvZ8Qvaq7zGqfvp3rsMqs/bcgpmSK7b5fahpB6T0pnLDz23UwiMvFwHF8nkhpGjrpw= 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=g8uy6qOQ; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=WRr36WL4; 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="g8uy6qOQ"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="WRr36WL4" 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 687AnQYq217656 for ; Mon, 7 Sep 2026 11:17:23 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=9tO/GYw7p5Y IziUo24tsiXtwALlKjEcO4Fmzh7zgI8c=; b=g8uy6qOQVIGVvsD2K6GsjaXCXFG r3Ui0eAvc91yHnD5W+GmiHJHMRvQcYZLnzqrMfjN38H4MrDFlfzeQPfmDWK41dO5 nQQe1pYDQZW30w/eoJ/dXXVkHQh5kEVcx5Apm3QnlhDK6PQRz8wonyYxmQOvspux ER5MXktsOe5FXBNDy1gq3n///03usbWxWhZE+84soPMBxBogBXFN63WSsfl/4RrP bX3nf6KyqFQIEUqMYefKInvTnJeGzvQGhWb0lT2mu8YtWk27ziqOKnVMIvpIiVYD pEyz42YQtiuIVCSewASRTN5KcSUdBzZ6/9+egFztiKzeMDc8OF/THK5SFEw== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ghtdqghfk-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 07 Sep 2026 11:17:23 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-92e820609d9so570496185a.2 for ; Mon, 07 Sep 2026 04:17:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1788779843; x=1789384643; 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=9tO/GYw7p5YIziUo24tsiXtwALlKjEcO4Fmzh7zgI8c=; b=WRr36WL4spfijeCDFYneV64MuCJoUkLJzpuZUtcn7RwGurZARIXN2YztD6M0cOOvRg PCNCGj3CwIKMHBRCrowUaAj7cRdY8diAFmrOZNl4anU1y46fGsInQpP3l8BB2/RRLJBr 0QVdPkjx0VpFNa66+tou8H4V+4Aopr6xk8B+PV6LayVTBNeK3Sw/lGz8Fn2hGNo6+Qcw psWTxZ+dgm8sXvjdLoGGpqHgGazDQX2hCAu3h6yrh6SP7MZRxYtw8q29S7B3Q1RgDGAL oIwGrqoyCSPQjdeE+wDZBidzjLJnSDPvZIqRLMVcQaDSUO8E4X8e+ypTnoQZ/qF4QqD2 iHWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788779843; x=1789384643; 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=9tO/GYw7p5YIziUo24tsiXtwALlKjEcO4Fmzh7zgI8c=; b=QUp1bc/2wRZrGWDEwYXGt80P+ETyRVzfK3q4PXOFG48qO2hOMyniVpewF370I7qCQF HkXMJ2rxOwNVYHn45bgyCbx3WU1HCm7XwQJCWb612xHvBoeVZkdXRlDD//Fsj35M4uAh 6QKxaziD6YIYwQXkr3qnbFpr/T5fJanxtc30iIgioGZ75TijSatKc0419lSgXAgCGSDJ 1c62cfYsOatdHY3asRi1Mp3YssJwdcfVezClyNhNcGqBmajxlQCQYzOu2wibc1yeQfQg qB9CjHVguBqr/Aw3TMR3VhGh0COJVGejmKU8wWonQFHPJvfUIdz2Zt3w8XfikwcfloPC Lfdg== X-Forwarded-Encrypted: i=1; AKwUvBy3vqWzU2S/YGPDdO3goF71PgVyfBEW7QY9t+XlKE9Fmew/EtSpS+XuzeRgqab9JfHsLA/hyx5XWnaz8Pg=@vger.kernel.org X-Gm-Message-State: AFuF++nDP/k3M/BElTSY41Uw+OPUg/7sZRcKaWNf2Ua85JFgU6CItGkU aX6pSFPkQ9gLgKUsKM0rA/bBePAiBtUeMGdsiaqCSr/Wwsi0YSknu485F7PzFp+LTxquFTXvslJ ZtbtQalVZ9cnhDdbWlUC34nQbclwxf5F7kV1QlsfPGq1PIl2QrUUJaWG1aig6C99aFdk= X-Gm-Gg: AYBFou3VhU1V8rRsSfszCVwL45ISxPVSB1ZVGCCouktfrmLt+Bu8A5RpwW3DwZoOjts EIE9Lol7g4l7Oi/FLlzxx46Z4A5Dw8ja+zm84CakwP1gbpeVJfqx4sfUPQJCt0eCoOjyDpstG+W McJ8IMDa0GEX1U2YIllOVNu7VXzzl1pCskxm2jYA4p6HG6nyb7r4yzzPSVbDX/9FjHP11+75toO xg6pia5y82JxhSIU+j7cnIvO0tXn7V+KRD74UbxJR4zpOV7N++YjSZcsPtuZPM+W+53W5C1zJ+0 wXyu8DUFxohq+Icbw7uft74UsypoO2WIIEjDDkDyBRUXREMj46G5k0ml+DMi62enpmQCfbiAqZj KJbvjHw/pgDxwjj6VL8aDWGBBV3q9ubYOnNo8PsIoZBM2wiRE2elVVQec2g== X-Received: by 2002:a05:620a:13d7:b0:92e:8405:7ad2 with SMTP id af79cd13be357-93980462eabmr1638328185a.41.1788779842805; Mon, 07 Sep 2026 04:17:22 -0700 (PDT) X-Received: by 2002:a05:620a:13d7:b0:92e:8405:7ad2 with SMTP id af79cd13be357-93980462eabmr1638321085a.41.1788779842315; Mon, 07 Sep 2026 04:17:22 -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-c260d5cfaa2sm456120066b.59.2026.09.07.04.17.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 04:17:21 -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 v3 5/5] cpuidle: psci: Move initialization a bit earlier in the boot sequence Date: Mon, 7 Sep 2026 13:16:55 +0200 Message-ID: <20260907111659.263324-6-ulf.hansson@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260907111659.263324-1-ulf.hansson@oss.qualcomm.com> References: <20260907111659.263324-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: AW1haW4tMjYwOTA3MDEyNCBTYWx0ZWRfX7rrWEKYuepiH 8MNVnbtoLHrmqEPEiz17Xpf/tgvgw8QInFoFOBY6bQKjMrWG4CYyOV6O/N9x83FZY5mD4oram0+ aRNVWB4IcSHWgqqtGo/MHr6hNsi2h+sEgzUuNpH1n/LHODIEENSjVvUXPfCoS8uVf6GNHE/ZLcu 3wpzYuYIjnUVl0CkdRZx1fiKCdra1c7LAJiMJdlqqpM6+s4e70MDZhHG+15fRx1vOf2O5Y4e9li SBFDCL8B8IBV6ztkocsK4+FUNEEIXK8/9mQy2f0SAThNveRW1RPlLBp7j26Hh4HQozM6hokNPVv e8wheT6ed5BjEEyDbE7M0gvkJoV+z1HmhP7GJ/j/8+T6VK7w+gng9r8PL/hed2NywPrXE2SrOFe Go1c8TyGvRs6EU8M10VSLlvxZQO2Hv/TritPS7U677Qx1wi7edlYee4PWqYHBV5jTErOp2tdQXY jxc/s5mansx2nPQF6Og== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTA3MDEyNCBTYWx0ZWRfX3nLnFjMlWeZZ 6nBPfxmauMzfwlMpeZEGg8QmgkN7s9xdyfh304UhR3cfapm2vTX1QeIFfFz0jmYnid0xrRuydTE +86dPGn/+8EaeN5WOa/hKlxqBWh4qNA= X-Proofpoint-ORIG-GUID: vSUGceP6OuLs_1QPwV_Gib3BQc6nH9c2 X-Authority-Analysis: v=2.4 cv=U6aiy+ru c=1 sm=1 tr=0 ts=6a9e9d43 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==: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=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-GUID: vSUGceP6OuLs_1QPwV_Gib3BQc6nH9c2 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-07_03,2026-09-07_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 impostorscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 priorityscore=1501 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2609070124 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 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