From: Abhinav Kumar <quic_abhinavk@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>,
Stephen Boyd <swboyd@chromium.org>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
<linux-arm-msm@vger.kernel.org>,
<dri-devel@lists.freedesktop.org>,
<freedreno@lists.freedesktop.org>
Subject: Re: [PATCH v1 1/4] drm/msm/mdp5: stop overriding drvdata
Date: Wed, 31 Aug 2022 15:16:44 -0700 [thread overview]
Message-ID: <d0dfbcd5-0299-3810-9cf1-e2d0a19ce321@quicinc.com> (raw)
In-Reply-To: <047e1001-754d-0913-fcbe-a4747c5df8b8@linaro.org>
On 8/26/2022 7:23 AM, Dmitry Baryshkov wrote:
> On 24/08/2022 20:20, Abhinav Kumar wrote:
>>
>>
>> On 8/24/2022 1:29 AM, Dmitry Baryshkov wrote:
>>> On Wed, 24 Aug 2022 at 04:25, Abhinav Kumar
>>> <quic_abhinavk@quicinc.com> wrote:
>>>>
>>>>
>>>>
>>>> On 6/20/2022 2:30 PM, Dmitry Baryshkov wrote:
>>>>> The rest of the code expects that master's device drvdata is the
>>>>> struct msm_drm_private instance. Do not override the mdp5's drvdata.
>>>>>
>>>>> Fixes: 6874f48bb8b0 ("drm/msm: make mdp5/dpu devices master
>>>>> components")
>>>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>>>
>>>> Is this just for consistency across mdp5/dpu drivers?
>>>>
>>>> What issue was seen if mdp5's platform data is overwritten?
>>>
>>> I think there was a crash in mdp5_destroy, but I did not capture the
>>> log at the moment.
>>>
>>> As you can see, the mdp5_destroy() expects to get mdp5_kms pointer
>>> from the drvdata. However the msm_drv_probe sets the drvdata to
>>> msm_drm_private instance. Boom.
>>
>> Yes, I see that msm_drv_probe sets the drvdata to msm_drm_private.
>> But I also see that mdp5_init then sets it to
>>
>> platform_set_drvdata(pdev, mdp5_kms);
>>
>> Does this not override it then?
>
> It does. But then the mdp5_pm_ops use msm_pm_prepare()/_complete(). And
> these calls expect the msm_drm_private instance in the drvdata. Maybe I
> stumbled upon this. I don't remember exactly, unfortunately.
>
This explanation makes sense to me. Understood. Hence,
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
>> Also seems like the commit which introduced it is present since april,
>> this should have happened even earlier then right?
>>
>>>
>>>>
>>>>> ---
>>>>> drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 19 +++++++++----------
>>>>> 1 file changed, 9 insertions(+), 10 deletions(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
>>>>> b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
>>>>> index c668a4b27cc6..daf5b5ca7233 100644
>>>>> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
>>>>> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
>>>>> @@ -203,7 +203,7 @@ static int mdp5_set_split_display(struct
>>>>> msm_kms *kms,
>>>>> slave_encoder);
>>>>> }
>>>>>
>>>>> -static void mdp5_destroy(struct platform_device *pdev);
>>>>> +static void mdp5_destroy(struct mdp5_kms *mdp5_kms);
>>>>>
>>>>> static void mdp5_kms_destroy(struct msm_kms *kms)
>>>>> {
>>>>> @@ -223,7 +223,7 @@ static void mdp5_kms_destroy(struct msm_kms *kms)
>>>>> }
>>>>>
>>>>> mdp_kms_destroy(&mdp5_kms->base);
>>>>> - mdp5_destroy(mdp5_kms->pdev);
>>>>> + mdp5_destroy(mdp5_kms);
>>>>> }
>>>>>
>>>>> #ifdef CONFIG_DEBUG_FS
>>>>> @@ -651,9 +651,8 @@ static int mdp5_kms_init(struct drm_device *dev)
>>>>> return ret;
>>>>> }
>>>>>
>>>>> -static void mdp5_destroy(struct platform_device *pdev)
>>>>> +static void mdp5_destroy(struct mdp5_kms *mdp5_kms)
>>>>> {
>>>>> - struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev);
>>>>> int i;
>>>>>
>>>>> if (mdp5_kms->ctlm)
>>>>> @@ -667,7 +666,7 @@ static void mdp5_destroy(struct platform_device
>>>>> *pdev)
>>>>> kfree(mdp5_kms->intfs[i]);
>>>>>
>>>>> if (mdp5_kms->rpm_enabled)
>>>>> - pm_runtime_disable(&pdev->dev);
>>>>> + pm_runtime_disable(&mdp5_kms->pdev->dev);
>>>>>
>>>>> drm_atomic_private_obj_fini(&mdp5_kms->glob_state);
>>>>> drm_modeset_lock_fini(&mdp5_kms->glob_state_lock);
>>>>> @@ -816,8 +815,6 @@ static int mdp5_init(struct platform_device
>>>>> *pdev, struct drm_device *dev)
>>>>> goto fail;
>>>>> }
>>>>>
>>>>> - platform_set_drvdata(pdev, mdp5_kms);
>>>>> -
>>>>> spin_lock_init(&mdp5_kms->resource_lock);
>>>>>
>>>>> mdp5_kms->dev = dev;
>>>>> @@ -915,7 +912,7 @@ static int mdp5_init(struct platform_device
>>>>> *pdev, struct drm_device *dev)
>>>>> return 0;
>>>>> fail:
>>>>> if (mdp5_kms)
>>>>> - mdp5_destroy(pdev);
>>>>> + mdp5_destroy(mdp5_kms);
>>>>> return ret;
>>>>> }
>>>>>
>>>>> @@ -975,7 +972,8 @@ static int mdp5_dev_remove(struct
>>>>> platform_device *pdev)
>>>>> static __maybe_unused int mdp5_runtime_suspend(struct device *dev)
>>>>> {
>>>>> struct platform_device *pdev = to_platform_device(dev);
>>>>> - struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev);
>>>>> + struct msm_drm_private *priv = platform_get_drvdata(pdev);
>>>>> + struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(priv->kms));
>>>>>
>>>>> DBG("");
>>>>>
>>>>> @@ -985,7 +983,8 @@ static __maybe_unused int
>>>>> mdp5_runtime_suspend(struct device *dev)
>>>>> static __maybe_unused int mdp5_runtime_resume(struct device *dev)
>>>>> {
>>>>> struct platform_device *pdev = to_platform_device(dev);
>>>>> - struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev);
>>>>> + struct msm_drm_private *priv = platform_get_drvdata(pdev);
>>>>> + struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(priv->kms));
>>>>>
>>>>> DBG("");
>>>>>
>>>
>>>
>>>
>
next prev parent reply other threads:[~2022-08-31 22:17 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 21:30 [PATCH v1 0/4] drm/msm: move resource allocation to the _probe function Dmitry Baryshkov
2022-06-20 21:30 ` [PATCH v1 1/4] drm/msm/mdp5: stop overriding drvdata Dmitry Baryshkov
2022-08-24 1:25 ` Abhinav Kumar
2022-08-24 8:29 ` Dmitry Baryshkov
2022-08-24 17:20 ` Abhinav Kumar
2022-08-26 14:23 ` Dmitry Baryshkov
2022-08-31 22:16 ` Abhinav Kumar [this message]
2022-09-22 18:52 ` Luca Weiss
2022-06-20 21:30 ` [PATCH v1 2/4] drm/msm/dpu: move resource allocation to the _probe function Dmitry Baryshkov
2022-09-01 21:37 ` Abhinav Kumar
2022-09-02 6:01 ` Dmitry Baryshkov
2022-06-20 21:30 ` [PATCH v1 3/4] drm/msm/mdp4: " Dmitry Baryshkov
2022-09-02 0:24 ` Abhinav Kumar
2022-09-02 6:06 ` Dmitry Baryshkov
2022-09-02 17:48 ` Abhinav Kumar
2022-09-02 19:05 ` Dmitry Baryshkov
2022-09-02 19:10 ` [Freedreno] " Abhinav Kumar
2022-06-20 21:30 ` [PATCH v1 4/4] drm/msm/mdp5: " Dmitry Baryshkov
2022-09-02 1:00 ` Abhinav Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d0dfbcd5-0299-3810-9cf1-e2d0a19ce321@quicinc.com \
--to=quic_abhinavk@quicinc.com \
--cc=airlied@linux.ie \
--cc=bjorn.andersson@linaro.org \
--cc=daniel@ffwll.ch \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=swboyd@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox