From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4F6EB1A5BBD; Wed, 4 Jun 2025 12:08:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749038882; cv=none; b=CF8SG9CSEqrT/AzhR9ixoVFrGfyJLRN/u5SHDxWkfZDIapZ5Q/VAyFTU9n0QKvMslNuCergZWGbEtEeBfutXmI7vLBhx+nRKh2WCyLSxDtSNyuFtsdQZYGq3FDfkj0O0KO0wu2CEAuI/cBYViefTUpCx4kjBhtX6Pv2lOdhMULM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749038882; c=relaxed/simple; bh=JGjvHMM1UBKGBFe4oZgVTLwSUN2F5OP2sQO5HIWNYtY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=kEzEF1doqfEZi16N1bw6Kt5Su8gWoDJH5IZrKlQrwMWLQBP60l0QppqrvbVVSVCkLIsFkzTO8qHXNg+9zL9Erx1cBD4lPATGitkb5TEAFaowFVY0VkIspondTSyu2nmxyFSpkZ2IYAhHr/GvfPlGOVke0K8c300fBZlIdxEXKVw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FdBrv4tr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FdBrv4tr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30703C4CEE7; Wed, 4 Jun 2025 12:07:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1749038881; bh=JGjvHMM1UBKGBFe4oZgVTLwSUN2F5OP2sQO5HIWNYtY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=FdBrv4trwT8p4QmYOPtphbxL67Hs8mAoetDvfecAQ9X7mG6NEeEg86fFwRBKIb5yw 9xxA45tU48kgDkxYCJkFKBOpwBzuEMTDJ3PQWfYiiAatmaX9jr2GtmOZCU1L+epMbz EWJMTuS3BxLWO+cCTLzndZATxUOdxrbAcvXxvfnSWsbq63nCDaWOhhZX4CorFaNO+n 32r4wf8qolXonz5q7PTShuuy0FC0HURETE7XOt5R8IuXw88ZsOVx3MfhjuQHSl3v0k 9peoZreNNQfq/ZyBjuMScg60tkc2suxcYqRBv4w5Ale/r14DjqywcHmJ0O7ZnE1NWP 48tRCM0HZeGng== Message-ID: Date: Wed, 4 Jun 2025 14:07:52 +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 v3 3/8] drm/imagination: Use pwrseq for TH1520 GPU power management To: Michal Wilczynski Cc: Drew Fustini , Guo Ren , Fu Wei , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bartosz Golaszewski , Philipp Zabel , Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Ulf Hansson , Marek Szyprowski , linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dri-devel@lists.freedesktop.org References: <20250530-apr_14_for_sending-v3-0-83d5744d997c@samsung.com> <20250530-apr_14_for_sending-v3-3-83d5744d997c@samsung.com> <20250603-whispering-jaybird-of-thunder-f87867@kuoka> From: Krzysztof Kozlowski Content-Language: en-US Autocrypt: addr=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hHFVKmvl3VBHIsBv0oDcsQWXqY+NaFahT0lRPjYtrTa1v3tem/ JoFzZ4B0p27K+qQCF2R96hVvuEyjzBmdq2esyE6zIqftdo4MOJho8uctOiWbwNNq2U9pPWmu 4vXVFBYIGmpyNPYzRm0QPwARAQABwsF8BBgBCgAmAhsMFiEEm9B+DgxR+NWWd7dUG5NDfTtB YpsFAmgXUF8FCRaWWyoACgkQG5NDfTtBYptO0w//dlXJs5/42hAXKsk+PDg3wyEFb4NpyA1v qmx7SfAzk9Hf6lWwU1O6AbqNMbh6PjEwadKUk1m04S7EjdQLsj/MBSgoQtCT3MDmWUUtHZd5 RYIPnPq3WVB47GtuO6/u375tsxhtf7vt95QSYJwCB+ZUgo4T+FV4hquZ4AsRkbgavtIzQisg Dgv76tnEv3YHV8Jn9mi/Bu0FURF+5kpdMfgo1sq6RXNQ//TVf8yFgRtTUdXxW/qHjlYURrm2 H4kutobVEIxiyu6m05q3e9eZB/TaMMNVORx+1kM3j7f0rwtEYUFzY1ygQfpcMDPl7pRYoJjB dSsm0ZuzDaCwaxg2t8hqQJBzJCezTOIkjHUsWAK+tEbU4Z4SnNpCyM3fBqsgYdJxjyC/tWVT AQ18NRLtPw7tK1rdcwCl0GFQHwSwk5pDpz1NH40e6lU+NcXSeiqkDDRkHlftKPV/dV+lQXiu jWt87ecuHlpL3uuQ0ZZNWqHgZoQLXoqC2ZV5KrtKWb/jyiFX/sxSrodALf0zf+tfHv0FZWT2 zHjUqd0t4njD/UOsuIMOQn4Ig0SdivYPfZukb5cdasKJukG1NOpbW7yRNivaCnfZz6dTawXw XRIV/KDsHQiyVxKvN73bThKhONkcX2LWuD928tAR6XMM2G5ovxLe09vuOzzfTWQDsm++9UKF a/A= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 04/06/2025 13:53, Michal Wilczynski wrote: >>> >>> The GPU node will depend on the AON node, which will be the sole >>> provider for the 'gpu-power' sequencer (based on the discussion in patch >>> 1). >>> >>> Therefore, if the AON/pwrseq driver has already completed its probe, and >>> devm_pwrseq_get() in the GPU driver subsequently returns -EPROBE_DEFER >>> (because pwrseq_get found 'no match' on the bus for 'gpu-power'), the >>> interpretation is that the AON driver did not register this optional >>> sequencer. Since AON is the only anticipated source, it implies the >>> sequencer won't become available later from its designated provider. >> >> I don't understand why you made this assumption. AON could be a module >> and this driver built-in. AON will likely probe later. > > You're absolutely right that AON could be a module and would generally > probe later in that scenario. However, the GPU device also has a > 'power-domains = <&aon TH1520_GPU_PD>' dependency. If the AON driver (as > the PM domain provider) were a late probing module, the GPU driver's > probe would hit -EPROBE_DEFER when its power domain is requested > which happens before attempting to get other resources like a power > sequencer. Huh, so basically you imply certain hardware design and certain DTS description in your driver code. Well, that's clearly fragile design to me, because you should not rely how hardware properties are presented in DTS. Will work here on th1520 with this DTS, won't work with something else. Especially that this looks like generic Imagination GPU code, common to multiple devices, not TH1520 only specific. > > So, if the GPU driver's code does reach the devm_pwrseq_get(dev, > "gpu-power") call, it strongly implies the AON driver has already > successfully probed. > > This leads to the core challenge with the optional 'gpu-power' > sequencer: Even if the AON driver has already probed, if it then chooses > not to register the "gpu-power" sequence (because it's an optional > feature), pwrseq_get() will still find "no device matched" on the > pwrseq_bus and return EPROBE_DEFER. > > If the GPU driver defers here, as it normally should for -EPROBE_DEFER, > it could wait indefinitely for an optional sequence that its > already probed AON provider will not supply. > > Anyway I think you're right, that this is probably confusing and we > shouldn't rely on this behavior. > > To solve this, and to allow the GPU driver to correctly handle > -EPROBE_DEFER when a sequencer is genuinely expected, I propose using a > boolean property on the GPU's DT node, e.g. > img,gpu-expects-power-sequencer. If the GPU node provides this property > it means the pwrseq 'gpu-power' is required. No, that would be driver design in DTS. I think the main problem is the pwrseq API: you should get via phandle, not name of the pwrseq controller. That's how all producer-consumer relationships are done in OF platforms. It's also fragile to rely on names in case of systems with multiple similar devices. This does not affect your platform and this hardware in general, but shows issues with interface: imagine multiple gpus and multiple pwr sequence devices. Which one should be obtained? gpu-power-1? But if GPUs are the same class of devices (e.g. 2x TG1520 GPU) this is just imprecise. Best regards, Krzysztof