From nobody Sun Feb 8 15:53:58 2026 Received: from mx08-00376f01.pphosted.com (mx08-00376f01.pphosted.com [91.207.212.86]) (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 E101E2EA48F for ; Fri, 23 Jan 2026 14:45:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.86 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769179521; cv=none; b=iLrvbKRb/SDJfctURn6e4KArdNy0J5VRmjxxIjEfPXG9XdSGHNtU3QlyIzdAXx88dRPP7dOau56QD5E0SZ92JXUeJTNh4bXi45/1owmEClW6fjRulNuBmnbO+1q+stdreoRIUJsJsMxgINgr/pdRJoYkBTwFoi6EWMBlYZvNIuI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769179521; c=relaxed/simple; bh=T/2yOTyU7RuYTjc6p9REE4wtSh9ES10BClfJR07tOwQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:To:CC; b=LQGzlY25JOKvZoYBMud8I/70QHBsd1H7rQS51k5m/V1U0XvPPUbtsaCjW4BP6QzzjDzX3xDs9damQSeaVGIbV9VfE4envWrjVNVcDmB3lrMRpZlX6/4M9p4/bqGn+p6QHJJh6tiDZdZfLMVMamQ9IUhFrCnG3Vd+m/79c4ksV3A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com; spf=pass smtp.mailfrom=imgtec.com; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b=IbO472jH; arc=none smtp.client-ip=91.207.212.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=imgtec.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b="IbO472jH" Received: from pps.filterd (m0168888.ppops.net [127.0.0.1]) by mx08-00376f01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60NDKDws1038859; Fri, 23 Jan 2026 14:45:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=dk201812; bh=DdTMT647qwDSy2XxjxYS1cD TiZiosrChRC8yZHrG18U=; b=IbO472jHZLAbD0QCcwoSTRIjXQ/2i0uYhewiCub pp/gDR4a6NksokgNuQoMvUjLN/539X0BYUVluhRjb4Ehycj15wZhzCoMvYTDIzxQ G96dZM19Dd39uLzP1o3o+iSCMrzkNDV1pLmSgX9x96iyFPTa0gcQi07m7GI/uv7Q qw3TRSBtq9KwPyceeDGHtlzhevWsWq4p4d/F/AnHs2W+yKvhn2jf+nePo5Ff8ndS o6dPuJw1Xoi+lAhmZ2Ukk4lS40EkafloGkeJMhRHWgLvDukFYGhbv4qO8dx6oij1 Nq9shbSI3AuYtPkGQX4StFpFbptsEUr1U4bO2YDt3n+3IEA== Received: from hhmail01.hh.imgtec.org (83-244-153-141.cust-83.exponential-e.net [83.244.153.141]) by mx08-00376f01.pphosted.com (PPS) with ESMTPS id 4btnawhx6u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Jan 2026 14:45:07 +0000 (GMT) Received: from 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa (172.25.4.28) by HHMAIL01.hh.imgtec.org (10.100.10.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.35; Fri, 23 Jan 2026 14:45:05 +0000 From: Matt Coster Date: Fri, 23 Jan 2026 14:44:50 +0000 Subject: [PATCH] drm/imagination: Use dev_pm_domain_attach_list() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260123-pm-domain-attach-list-v1-1-d51dd7e43253@imgtec.com> X-B4-Tracking: v=1; b=H4sIAGGJc2kC/x3MwQpAQBCA4VfRnE2ZicSryGFagymWdjcpeXeb4 3f4/weiBtMIffFA0MuiHT6DygLcKn5RtCkbuOKGuCI8d5yOXcyjpCRuxc1iQp1rdcTScUuQ2zP obPf/Hcb3/QD9KEndZwAAAA== X-Change-ID: 20251201-pm-domain-attach-list-ef4ec12a9271 To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter CC: Geert Uytterhoeven , Frank Binns , Brajesh Gupta , "Alessio Belle" , Alexandru Dadu , , , "Matt Coster" X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6382; i=matt.coster@imgtec.com; h=from:subject:message-id; bh=T/2yOTyU7RuYTjc6p9REE4wtSh9ES10BClfJR07tOwQ=; b=owGbwMvMwCFWuUfy8817WRsYT6slMWQWdxYGhev7tO70W30kbUriCjb9dfv55550X5z/sbbtc cPLX6/OdpSyMIhxMMiKKbLsWGG5Qu2PmpbEjV/FMHNYmUCGMHBxCsBEGoIZ/kcw/Y223rbfTmSu wy+xDgsDk7McZflyr7YzVLw2Y2o6NQuoQtVXJ5DJdFGFzJTnvp6TcxklouQX14ZvvCHhNK2WTZ8 ZAA== X-Developer-Key: i=matt.coster@imgtec.com; a=openpgp; fpr=05A40CFCE7269D61D97100A1747F0A9036F90DFA X-Authority-Analysis: v=2.4 cv=bYRmkePB c=1 sm=1 tr=0 ts=69738973 cx=c_pps a=AKOq//PuzOIrVTIF9yBwbA==:117 a=AKOq//PuzOIrVTIF9yBwbA==:17 a=CzDp7rjNS_MA:10 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=r_1tXGB3AAAA:8 a=3YyE6xVfhT4hD00o0wYA:9 a=QEXdDO2ut3YA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-ORIG-GUID: ZRPms88zt4ctGhFC1AqY2DPbFVn_F7gg X-Proofpoint-GUID: ZRPms88zt4ctGhFC1AqY2DPbFVn_F7gg X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIzMDExNyBTYWx0ZWRfX8mOM3d/btyhQ sxC7K9Wt72UqyP88/0ELh91fzWdueMqA13tzQ9FrdGBBf4U2H5i29yIaeExZzuaDjqr+gsGYW/E 0l1M1SVu7EtlKfRTDaGx5TEyScfqdBTqzfY7nN6miXr7K2XDhMMxZjRugEo+rfXkI/BIznknOyf eddw1ZN5xcxXOR9fYht1Zlje21eBDYJDCJQooTfWLyM43nQj8CcY4eI2X4iYWjMBdUESQovvRVR RI0PcrYd6pKYwM+qOjEL4RH6p8Sj8Xv2P/8pQ4ZYwZM6pAPiu0WIYk9Xph+Yp5vfQfEK04TouSQ pxaX0Fz2wYHmlafzkFoYXwfvN2IrRvm9nWBrkifQTjr3OAWNkk/zilrLhIGHtfg5gyDf9VClo7d E7WP7bdFH9UMrZCw2B30pITn5UV2uLStCy45tL9J3uMcBmZeCsgH/RdkmiZmUyqKyEn1N+iD5Jp /AOx/xwvG51WNe/4S8w== This helper handles the attaching and linking of the entire list of power domains. Besides making pvr_power_domains_init() simpler, this also lays the groundwork to simplify supporting the varied power domain names used in Volcanic GPU cores. Note that we still need to create the links between power domains to ensure they're brought up in a valid sequence. Signed-off-by: Matt Coster Reviewed-by: Alessio Belle --- We've had this patch kicking around internally for a while; it's been held up by discussions as to whether we actually need the dependencies between domains for the hardware to behave currectly. As it turns out, the answer is yes. Geert sent a similar patch[1] yesterday which didn't retain the inter-domain links and suggested we just send this one instead of reworking his. Thank you for the kick up the backside to progress this one! :) [1]: https://lore.kernel.org/r/194465eda54d1f852a9226cf691ddc5aa208e0a3.176= 9097977.git.geert+renesas@glider.be/ --- drivers/gpu/drm/imagination/pvr_device.h | 10 ++-- drivers/gpu/drm/imagination/pvr_power.c | 80 ++++++++++++----------------= ---- 2 files changed, 33 insertions(+), 57 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_device.h b/drivers/gpu/drm/ima= gination/pvr_device.h index cfda215e7428e..d51c57cf93323 100644 --- a/drivers/gpu/drm/imagination/pvr_device.h +++ b/drivers/gpu/drm/imagination/pvr_device.h @@ -152,15 +152,13 @@ struct pvr_device { * @power: Optional power domain devices. * * On platforms with more than one power domain for the GPU, they are - * stored here in @domain_devs, along with links between them in - * @domain_links. The size of @domain_devs is given by @domain_count, - * while the size of @domain_links is (2 * @domain_count) - 1. + * stored here in @domains, along with links between them in + * @domain_links. The size of @domain_links is one less than + * struct dev_pm_domain_list->num_pds in @domains. */ struct pvr_device_power { - struct device **domain_devs; + struct dev_pm_domain_list *domains; struct device_link **domain_links; - - u32 domain_count; } power; =20 /** diff --git a/drivers/gpu/drm/imagination/pvr_power.c b/drivers/gpu/drm/imag= ination/pvr_power.c index b9f801c63260c..a0834c550a852 100644 --- a/drivers/gpu/drm/imagination/pvr_power.c +++ b/drivers/gpu/drm/imagination/pvr_power.c @@ -593,14 +593,16 @@ pvr_watchdog_fini(struct pvr_device *pvr_dev) =20 int pvr_power_domains_init(struct pvr_device *pvr_dev) { - struct device *dev =3D from_pvr_device(pvr_dev)->dev; + static const char *const ROGUE_PD_NAMES[] =3D { "a", "b", "c", "d", "e" }; + + struct drm_device *drm_dev =3D from_pvr_device(pvr_dev); + struct device *dev =3D drm_dev->dev; =20 struct device_link **domain_links __free(kfree) =3D NULL; - struct device **domain_devs __free(kfree) =3D NULL; + struct dev_pm_domain_list *domains =3D NULL; int domain_count; int link_count; =20 - char dev_name[2] =3D "a"; int err; int i; =20 @@ -612,46 +614,33 @@ int pvr_power_domains_init(struct pvr_device *pvr_dev) if (domain_count <=3D 1) return 0; =20 - link_count =3D domain_count + (domain_count - 1); + if (domain_count > ARRAY_SIZE(ROGUE_PD_NAMES)) { + drm_err(drm_dev, "%s() only supports %zu domains on Rogue", + __func__, ARRAY_SIZE(ROGUE_PD_NAMES)); + return -EOPNOTSUPP; + } =20 - domain_devs =3D kcalloc(domain_count, sizeof(*domain_devs), GFP_KERNEL); - if (!domain_devs) - return -ENOMEM; + link_count =3D domain_count - 1; =20 domain_links =3D kcalloc(link_count, sizeof(*domain_links), GFP_KERNEL); if (!domain_links) return -ENOMEM; =20 - for (i =3D 0; i < domain_count; i++) { - struct device *domain_dev; - - dev_name[0] =3D 'a' + i; - domain_dev =3D dev_pm_domain_attach_by_name(dev, dev_name); - if (IS_ERR_OR_NULL(domain_dev)) { - err =3D domain_dev ? PTR_ERR(domain_dev) : -ENODEV; - goto err_detach; - } - - domain_devs[i] =3D domain_dev; - } - - for (i =3D 0; i < domain_count; i++) { - struct device_link *link; - - link =3D device_link_add(dev, domain_devs[i], DL_FLAG_STATELESS | DL_FLA= G_PM_RUNTIME); - if (!link) { - err =3D -ENODEV; - goto err_unlink; - } + const struct dev_pm_domain_attach_data pd_attach_data =3D { + .pd_names =3D ROGUE_PD_NAMES, + .num_pd_names =3D domain_count, + .pd_flags =3D 0, + }; =20 - domain_links[i] =3D link; - } + err =3D dev_pm_domain_attach_list(dev, &pd_attach_data, &domains); + if (err < 0) + return err; =20 - for (i =3D domain_count; i < link_count; i++) { + for (i =3D 0; i < link_count; i++) { struct device_link *link; =20 - link =3D device_link_add(domain_devs[i - domain_count + 1], - domain_devs[i - domain_count], + link =3D device_link_add(domains->pd_devs[i + 1], + domains->pd_devs[i], DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME); if (!link) { err =3D -ENODEV; @@ -662,9 +651,8 @@ int pvr_power_domains_init(struct pvr_device *pvr_dev) } =20 pvr_dev->power =3D (struct pvr_device_power){ - .domain_devs =3D no_free_ptr(domain_devs), + .domains =3D domains, .domain_links =3D no_free_ptr(domain_links), - .domain_count =3D domain_count, }; =20 return 0; @@ -673,31 +661,21 @@ int pvr_power_domains_init(struct pvr_device *pvr_dev) while (--i >=3D 0) device_link_del(domain_links[i]); =20 - i =3D domain_count; - -err_detach: - while (--i >=3D 0) - dev_pm_domain_detach(domain_devs[i], true); - return err; } =20 void pvr_power_domains_fini(struct pvr_device *pvr_dev) { - const int domain_count =3D pvr_dev->power.domain_count; + struct pvr_device_power *pvr_power =3D &pvr_dev->power; =20 - int i =3D domain_count + (domain_count - 1); + int i =3D (int)pvr_power->domains->num_pds - 1; =20 while (--i >=3D 0) - device_link_del(pvr_dev->power.domain_links[i]); - - i =3D domain_count; + device_link_del(pvr_power->domain_links[i]); =20 - while (--i >=3D 0) - dev_pm_domain_detach(pvr_dev->power.domain_devs[i], true); + dev_pm_domain_detach_list(pvr_power->domains); =20 - kfree(pvr_dev->power.domain_links); - kfree(pvr_dev->power.domain_devs); + kfree(pvr_power->domain_links); =20 - pvr_dev->power =3D (struct pvr_device_power){ 0 }; + *pvr_power =3D (struct pvr_device_power){ 0 }; } --- base-commit: 15bd2f5d52de890f745ac0c60a44cd27d095bb0d change-id: 20251201-pm-domain-attach-list-ef4ec12a9271