2020-11-20 09:44:39

by Marc Zyngier

[permalink] [raw]
Subject: [PATCH 0/2] More meson HDMI fixes

Guillaume reported that my earlier fixes for the meson HDMI driver
broke another set of machines which are now exploding (clock not
enabled).

I have thus reconsidered the approach and came up with an alternative
fix (enable a missing clock), which Guillaume confirmed to be working.
Jerome pointed out that this driver is leaking clock references like a
sieve, so that needed addressing too.

The first patch start by fixing the clock leakage using a devm
facility.

The second patch addresses the earlier crash by reusing the
infrastructure put together in the first patch.

Tested on VIM3l.

Marc Zyngier (2):
drm/meson: dw-hdmi: Disable clocks on driver teardown
drm/meson: dw-hdmi: Enable the iahb clock early enough

drivers/gpu/drm/meson/meson_dw_hdmi.c | 51 ++++++++++++++++++---------
1 file changed, 35 insertions(+), 16 deletions(-)

--
2.28.0


2020-11-20 09:46:02

by Marc Zyngier

[permalink] [raw]
Subject: [PATCH 2/2] drm/meson: dw-hdmi: Enable the iahb clock early enough

Instead of moving meson_dw_hdmi_init() around which breaks existing
platform, let's enable the clock meson_dw_hdmi_init() depends on.
This means we don't have to worry about this clock being enabled or
not, depending on the boot-loader features.

Fixes: b33340e33acd ("drm/meson: dw-hdmi: Ensure that clocks are enabled before touching the TOP registers")
Reported-by: Guillaume Tucker <[email protected]>
Tested-by: Guillaume Tucker <[email protected]>
Signed-off-by: Marc Zyngier <[email protected]>
---
drivers/gpu/drm/meson/meson_dw_hdmi.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index 29623b309cb1..aad75a22dc33 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -1051,6 +1051,10 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
if (ret)
return ret;

+ ret = meson_enable_clk(dev, "iahb");
+ if (ret)
+ return ret;
+
ret = meson_enable_clk(dev, "venci");
if (ret)
return ret;
@@ -1086,6 +1090,8 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,

encoder->possible_crtcs = BIT(0);

+ meson_dw_hdmi_init(meson_dw_hdmi);
+
DRM_DEBUG_DRIVER("encoder initialized\n");

/* Bridge / Connector */
@@ -1110,8 +1116,6 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
if (IS_ERR(meson_dw_hdmi->hdmi))
return PTR_ERR(meson_dw_hdmi->hdmi);

- meson_dw_hdmi_init(meson_dw_hdmi);
-
next_bridge = of_drm_find_bridge(pdev->dev.of_node);
if (next_bridge)
drm_bridge_attach(encoder, next_bridge,
--
2.28.0

2020-11-20 10:56:22

by Guillaume Tucker

[permalink] [raw]
Subject: Re: [PATCH 2/2] drm/meson: dw-hdmi: Enable the iahb clock early enough

On 20/11/2020 09:42, Marc Zyngier wrote:
> Instead of moving meson_dw_hdmi_init() around which breaks existing
> platform, let's enable the clock meson_dw_hdmi_init() depends on.
> This means we don't have to worry about this clock being enabled or
> not, depending on the boot-loader features.
>
> Fixes: b33340e33acd ("drm/meson: dw-hdmi: Ensure that clocks are enabled before touching the TOP registers")
> Reported-by: Guillaume Tucker <[email protected]>

Although I am triaging kernelci bisections, it was initially
found thanks to our friendly bot. So if you're OK with this, it
would most definitely appreciate a mention:

Reported-by: "kernelci.org bot" <[email protected]>

Thanks,
Guillaume

2020-11-20 11:15:25

by Marc Zyngier

[permalink] [raw]
Subject: Re: [PATCH 2/2] drm/meson: dw-hdmi: Enable the iahb clock early enough

On 2020-11-20 10:54, Guillaume Tucker wrote:
> On 20/11/2020 09:42, Marc Zyngier wrote:
>> Instead of moving meson_dw_hdmi_init() around which breaks existing
>> platform, let's enable the clock meson_dw_hdmi_init() depends on.
>> This means we don't have to worry about this clock being enabled or
>> not, depending on the boot-loader features.
>>
>> Fixes: b33340e33acd ("drm/meson: dw-hdmi: Ensure that clocks are
>> enabled before touching the TOP registers")
>> Reported-by: Guillaume Tucker <[email protected]>
>
> Although I am triaging kernelci bisections, it was initially
> found thanks to our friendly bot. So if you're OK with this, it
> would most definitely appreciate a mention:
>
> Reported-by: "kernelci.org bot" <[email protected]>

Sure. Neil can add this when (and if) he applies these patches.

Thanks,

M.
--
Jazz is not dead. It just smells funny...

2020-11-20 12:22:30

by Neil Armstrong

[permalink] [raw]
Subject: Re: [PATCH 2/2] drm/meson: dw-hdmi: Enable the iahb clock early enough

On 20/11/2020 12:10, Marc Zyngier wrote:
> On 2020-11-20 10:54, Guillaume Tucker wrote:
>> On 20/11/2020 09:42, Marc Zyngier wrote:
>>> Instead of moving meson_dw_hdmi_init() around which breaks existing
>>> platform, let's enable the clock meson_dw_hdmi_init() depends on.
>>> This means we don't have to worry about this clock being enabled or
>>> not, depending on the boot-loader features.
>>>
>>> Fixes: b33340e33acd ("drm/meson: dw-hdmi: Ensure that clocks are enabled before touching the TOP registers")
>>> Reported-by: Guillaume Tucker <[email protected]>
>>
>> Although I am triaging kernelci bisections, it was initially
>> found thanks to our friendly bot.  So if you're OK with this, it
>> would most definitely appreciate a mention:
>>
>>   Reported-by: "kernelci.org bot" <[email protected]>
>
> Sure. Neil can add this when (and if) he applies these patches.

Yep applying to drm-misc-next and switching to `Reported-by: "kernelci.org bot" <[email protected]>`

Thanks
Neil

>
> Thanks,
>
>         M.

2020-11-20 12:31:23

by Neil Armstrong

[permalink] [raw]
Subject: Re: [PATCH 2/2] drm/meson: dw-hdmi: Enable the iahb clock early enough

On 20/11/2020 10:42, Marc Zyngier wrote:
> Instead of moving meson_dw_hdmi_init() around which breaks existing
> platform, let's enable the clock meson_dw_hdmi_init() depends on.
> This means we don't have to worry about this clock being enabled or
> not, depending on the boot-loader features.
>
> Fixes: b33340e33acd ("drm/meson: dw-hdmi: Ensure that clocks are enabled before touching the TOP registers")
> Reported-by: Guillaume Tucker <[email protected]>
> Tested-by: Guillaume Tucker <[email protected]>
> Signed-off-by: Marc Zyngier <[email protected]>
> ---
> drivers/gpu/drm/meson/meson_dw_hdmi.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index 29623b309cb1..aad75a22dc33 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> @@ -1051,6 +1051,10 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
> if (ret)
> return ret;
>
> + ret = meson_enable_clk(dev, "iahb");
> + if (ret)
> + return ret;
> +
> ret = meson_enable_clk(dev, "venci");
> if (ret)
> return ret;
> @@ -1086,6 +1090,8 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>
> encoder->possible_crtcs = BIT(0);
>
> + meson_dw_hdmi_init(meson_dw_hdmi);
> +
> DRM_DEBUG_DRIVER("encoder initialized\n");
>
> /* Bridge / Connector */
> @@ -1110,8 +1116,6 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
> if (IS_ERR(meson_dw_hdmi->hdmi))
> return PTR_ERR(meson_dw_hdmi->hdmi);
>
> - meson_dw_hdmi_init(meson_dw_hdmi);
> -
> next_bridge = of_drm_find_bridge(pdev->dev.of_node);
> if (next_bridge)
> drm_bridge_attach(encoder, next_bridge,
>
Reviewed-by: Neil Armstrong <[email protected]>