From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (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 BF7A04174A for ; Wed, 16 Apr 2025 13:32:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744810362; cv=none; b=TI12Uh6ZQaWq1Z4agFtlvqPSY295PMnOgLgIe5I5GAE2O6HA2GQF7EcJTfuD31vJm1s6UIUn6WN3qYp98JG9nVIyo5bIdI9fts3zP7QguNXVd6BzZGy6dQPL+wUvjAyvf2pBAULXVgFJfPLART3UWmD7ONfEr16VUPiAWLDB1P8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744810362; c=relaxed/simple; bh=9M2u6+1YTXcbHw1ORgX1nlnouUJ7odDXUxSaPckr8ws=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:From:In-Reply-To: Content-Type:References; b=FiR1sLNYnEjYHPGLMIcw1O6m31pjPh2Pf2wvYG/q36kwfPRYZB08Rm9DXnM/ewW2UjyMXYPfy0T5aY8PkTgNel6zWwStCnPdmN/j/Pnsy0g+RzdfSEIfeHLL7N1/YGuDhI6WByNhGV8jTspfzgX1e4X/88a+qnuuOWWeUq+QKZM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=mupRYoNx; arc=none smtp.client-ip=210.118.77.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="mupRYoNx" Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20250416133237euoutp02d7e77daee87d80099e8350af6c7115a5~2z8atvLkO0645006450euoutp02P for ; Wed, 16 Apr 2025 13:32:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20250416133237euoutp02d7e77daee87d80099e8350af6c7115a5~2z8atvLkO0645006450euoutp02P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1744810357; bh=kUFo/wLgztnLDigBiEFrgBwls65G+AeX0yLfanf6yv0=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=mupRYoNxftSMT8sljLcHjRIHg/DDpOP+gsLFvSjf9+5Bgs70dDQkmYBXLHJuQgRxg OdvJ/8xSH6MfwDiTbjFB8xHD6oH8LCggTBg1VYNWyU7v6yOAZV2a3ApUUm5r5Hc/A9 QMDcDrk2jzNVgWggOw68D5TfhAHU/k0Qs10Hq6zI= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20250416133237eucas1p1db9410bcc5acc1b3167bb93a320f6030~2z8aPC9Ga0435904359eucas1p1N; Wed, 16 Apr 2025 13:32:37 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id EE.C7.20397.571BFF76; Wed, 16 Apr 2025 14:32:37 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20250416133236eucas1p1d8f879ffa1724d77d3f8cdcefde84535~2z8ZttCPT0165501655eucas1p1o; Wed, 16 Apr 2025 13:32:36 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20250416133236eusmtrp1b0d189806d8483166b7cd28317c2a477~2z8Zs0mqn0448804488eusmtrp1W; Wed, 16 Apr 2025 13:32:36 +0000 (GMT) X-AuditID: cbfec7f5-e59c770000004fad-4e-67ffb1759f3c Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 0D.D8.19654.471BFF76; Wed, 16 Apr 2025 14:32:36 +0100 (BST) Received: from [192.168.1.44] (unknown [106.210.136.40]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20250416133235eusmtip2b6501e479374913edd639f525f91f50e~2z8YmWHan0900709007eusmtip2v; Wed, 16 Apr 2025 13:32:35 +0000 (GMT) Message-ID: Date: Wed, 16 Apr 2025 15:32:35 +0200 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/4] PM: device: Introduce platform_resources_managed flag To: "Rafael J. Wysocki" Cc: Danilo Krummrich , Pavel Machek , Drew Fustini , Guo Ren , Fu Wei , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ulf Hansson , Philipp Zabel , Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , m.szyprowski@samsung.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org Content-Language: en-US From: Michal Wilczynski In-Reply-To: Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA02Se0xTdxTH+d3e3l7Qkmu14RexY6tOGQ7Eucdvm+AeLrkJcRNdYjRZZpWb 6gQKfTidMwMGtkJhFsbUClIYAdLwKo+uEKALsrYE1ugGk2kLZoAUpAKr4MStznJx47/P+Z5z ft9zTn4kR6An1pPHU5WMPFWSLCZCcLPtkTNaZXoijR0tWo0cNyswVNvp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Nq77Mob pZ7D0ut1fzH8KSrpcVrgIO67X8dw6h63hxVyycWPQk5xHUisOP1tWsS/be+v1D07U+q3zULZ qPm101Up/vMGG36/iztygO3U58uuW3T4zj1aWDzBM3f9rH1hbfcsy4SZDnftPeP/+t/a6Ct/ pIOq/T2OaskfXhwt48rcN8lkTdAUn2232o4XrdrXGWua+dk/5p27UPxDJZbijERDLeai4kQA hHVuJcADAAA= X-CMS-MailID: 20250416133236eucas1p1d8f879ffa1724d77d3f8cdcefde84535 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20250414185314eucas1p1ae57b937773a2ed4ce8d52d5598eb028 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20250414185314eucas1p1ae57b937773a2ed4ce8d52d5598eb028 References: <20250414-apr_14_for_sending-v2-0-70c5af2af96c@samsung.com> <20250414-apr_14_for_sending-v2-1-70c5af2af96c@samsung.com> On 4/15/25 18:42, Rafael J. Wysocki wrote: > On Mon, Apr 14, 2025 at 8:53 PM Michal Wilczynski > wrote: >> >> Introduce a new dev_pm_info flag - platform_resources_managed, to >> indicate whether platform PM resources such as clocks or resets are >> managed externally (e.g. by a generic power domain driver) instead of >> directly by the consumer device driver. > > I think that this is genpd-specific and so I don't think it belongs in > struct dev_pm_info. > > There is dev->power.subsys_data->domain_data, why not use it for this? Hi Rafael, Thanks for the feedback. You're right — this behavior is specific to genpd, so embedding the flag directly in struct dev_pm_info may not be the best choice. Using dev->power.subsys_data->domain_data makes more sense and avoids bloating the core PM structure. > > Also, it should be documented way more comprehensively IMV. > > Who is supposed to set it and when? What does it mean when it is set? To clarify the intended usage, I would propose adding the following explanation to the commit message: "This flag is intended to be set by a generic PM domain driver (e.g., from within its attach_dev callback) to indicate that it will manage platform specific runtime power management resources — such as clocks and resets — on behalf of the consumer device. This implies a delegation of runtime PM control to the PM domain, typically implemented through its start and stop callbacks. When this flag is set, the consumer driver (e.g., drm/imagination) can check it and skip managing such resources in its runtime PM callbacks (runtime_suspend, runtime_resume), avoiding conflicts or redundant operations." This could also be included as a code comment near the flag definition if you think that’s appropriate. Also, as discussed earlier with Maxime and Matt [1], this is not about full "resource ownership," but more about delegating runtime control of PM resources like clocks/resets to the genpd. That nuance may be worth reflecting in the flag name as well, I would rename it to let's say 'runtime_pm_platform_res_delegated', or more concise 'runtime_pm_delegated'. [1] - https://lore.kernel.org/all/a3142259-1c72-45b9-b148-5e5e6bef87f9@samsung.com/ > >> This flag enables device drivers to cooperate with SoC-specific PM >> domains by conditionally skipping management of clocks and resets when >> the platform owns them. >> >> This idea was discussed on the mailing list [1]. >> >> [1] - https://lore.kernel.org/all/CAPDyKFq=BF5f2i_Sr1cmVqtVAMgr=0FqsksL7RHZLKn++y0uwg@mail.gmail.com/ >> >> Signed-off-by: Michal Wilczynski >> --- >> include/linux/device.h | 11 +++++++++++ >> include/linux/pm.h | 1 + >> 2 files changed, 12 insertions(+) >> >> diff --git a/include/linux/device.h b/include/linux/device.h >> index 79e49fe494b7c4c70d902886db63c4cfe5b4de4f..3e7a36dd874cfb6b98e2451c7a876989aa9f1913 100644 >> --- a/include/linux/device.h >> +++ b/include/linux/device.h >> @@ -881,6 +881,17 @@ static inline bool device_async_suspend_enabled(struct device *dev) >> return !!dev->power.async_suspend; >> } >> >> +static inline bool device_platform_resources_pm_managed(struct device *dev) > > Could this function name be shorter? Maybe: static inline bool dev_is_runtime_pm_delegated(struct device *dev); static inline void dev_set_runtime_pm_delegated(struct device *dev, bool val); Regards, Michał > >> +{ >> + return dev->power.platform_resources_managed; >> +} >> + >> +static inline void device_platform_resources_set_pm_managed(struct device *dev, >> + bool val) > > Ditto? > >> +{ >> + dev->power.platform_resources_managed = val; >> +} >> + >> static inline bool device_pm_not_required(struct device *dev) >> { >> return dev->power.no_pm; >> diff --git a/include/linux/pm.h b/include/linux/pm.h >> index f0bd8fbae4f2c09c63d780bb2528693acf2d2da1..cd6cb59686e4a5e9eaa2701d1e44af2abbfd88d1 100644 >> --- a/include/linux/pm.h >> +++ b/include/linux/pm.h >> @@ -670,6 +670,7 @@ struct dev_pm_info { >> bool no_pm:1; >> bool early_init:1; /* Owned by the PM core */ >> bool direct_complete:1; /* Owned by the PM core */ >> + bool platform_resources_managed:1; >> u32 driver_flags; >> spinlock_t lock; >> #ifdef CONFIG_PM_SLEEP >> >> -- >> 2.34.1 >> >> >