mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Michael Stapelberg <michael+drm@stapelberg.ch>,
	Maxime Ripard <maxime@cerno.tech>
Subject: Re: [PATCH 5.15 05/32] drm/vc4: hdmi: Make sure the device is powered with CEC
Date: Sat, 5 Feb 2022 09:12:38 -0800	[thread overview]
Message-ID: <20220205171238.GA3073350@roeck-us.net> (raw)
In-Reply-To: <20220204091915.421812582@linuxfoundation.org>

On Fri, Feb 04, 2022 at 10:22:15AM +0100, Greg Kroah-Hartman wrote:
> From: Maxime Ripard <maxime@cerno.tech>
> 
> Commit 20b0dfa86bef0e80b41b0e5ac38b92f23b6f27f9 upstream.
> 
> The original commit depended on a rework commit (724fc856c09e ("drm/vc4:
> hdmi: Split the CEC disable / enable functions in two")) that
> (rightfully) didn't reach stable.
> 
> However, probably because the context changed, when the patch was
> applied to stable the pm_runtime_put called got moved to the end of the
> vc4_hdmi_cec_adap_enable function (that would have become
> vc4_hdmi_cec_disable with the rework) to vc4_hdmi_cec_init.
> 
> This means that at probe time, we now drop our reference to the clocks
> and power domains and thus end up with a CPU hang when the CPU tries to
> access registers.
> 
> The call to pm_runtime_resume_and_get() is also problematic since the
> .adap_enable CEC hook is called both to enable and to disable the
> controller. That means that we'll now call pm_runtime_resume_and_get()
> at disable time as well, messing with the reference counting.
> 
> The behaviour we should have though would be to have
> pm_runtime_resume_and_get() called when the CEC controller is enabled,
> and pm_runtime_put when it's disabled.
> 
> We need to move things around a bit to behave that way, but it aligns
> stable with upstream.
> 
> Cc: <stable@vger.kernel.org> # 5.10.x
> Cc: <stable@vger.kernel.org> # 5.15.x
> Cc: <stable@vger.kernel.org> # 5.16.x
> Reported-by: Michael Stapelberg <michael+drm@stapelberg.ch>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/gpu/drm/vc4/vc4_hdmi.c |   25 +++++++++++++------------
>  1 file changed, 13 insertions(+), 12 deletions(-)
> 
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -1738,18 +1738,18 @@ static int vc4_hdmi_cec_adap_enable(stru
>  	u32 val;
>  	int ret;
>  
> -	ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev);
> -	if (ret)
> -		return ret;
> +	if (enable) {
> +		ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev);
> +		if (ret)
> +			return ret;
>  
> -	val = HDMI_READ(HDMI_CEC_CNTRL_5);
> -	val &= ~(VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET |
> -		 VC4_HDMI_CEC_CNT_TO_4700_US_MASK |
> -		 VC4_HDMI_CEC_CNT_TO_4500_US_MASK);
> -	val |= ((4700 / usecs) << VC4_HDMI_CEC_CNT_TO_4700_US_SHIFT) |
> -	       ((4500 / usecs) << VC4_HDMI_CEC_CNT_TO_4500_US_SHIFT);
> +		val = HDMI_READ(HDMI_CEC_CNTRL_5);
> +		val &= ~(VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET |
> +			 VC4_HDMI_CEC_CNT_TO_4700_US_MASK |
> +			 VC4_HDMI_CEC_CNT_TO_4500_US_MASK);
> +		val |= ((4700 / usecs) << VC4_HDMI_CEC_CNT_TO_4700_US_SHIFT) |
> +			((4500 / usecs) << VC4_HDMI_CEC_CNT_TO_4500_US_SHIFT);

Unfortunately this is broken because it leaves the still existing
else path with

               if (!vc4_hdmi->variant->external_irq_controller)
                        HDMI_WRITE(HDMI_CEC_CPU_MASK_SET, VC4_HDMI_CPU_CEC);
                HDMI_WRITE(HDMI_CEC_CNTRL_5, val |
                           VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET);

where 'val' is now uninitialized. I don't know how to fix this up properly,
so I won't even try.

Guenter

  reply	other threads:[~2022-02-05 17:12 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-04  9:22 [PATCH 5.15 00/32] 5.15.20-rc1 review Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 01/32] PCI: pciehp: Fix infinite loop in IRQ handler upon power fault Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 02/32] selftests: mptcp: fix ipv6 routing setup Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 03/32] net: ipa: use a bitmap for endpoint replenish_enabled Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 04/32] net: ipa: prevent concurrent replenish Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 05/32] drm/vc4: hdmi: Make sure the device is powered with CEC Greg Kroah-Hartman
2022-02-05 17:12   ` Guenter Roeck [this message]
2022-02-05 17:56     ` Greg Kroah-Hartman
2022-02-05 18:41       ` Guenter Roeck
2022-02-06 12:09         ` Greg Kroah-Hartman
2022-02-06 17:32           ` Guenter Roeck
2022-02-04  9:22 ` [PATCH 5.15 06/32] cgroup-v1: Require capabilities to set release_agent Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 07/32] Revert "mm/gup: small refactoring: simplify try_grab_page()" Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 08/32] ovl: dont fail copy up if no fileattr support on upper Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 09/32] lockd: fix server crash on reboot of client holding lock Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 10/32] lockd: fix failure to cleanup client locks Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 11/32] net/mlx5e: IPsec: Fix tunnel mode crypto offload for non TCP/UDP traffic Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 12/32] net/mlx5: Bridge, take rtnl lock in init error handler Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 13/32] net/mlx5: Bridge, ensure dev_name is null-terminated Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 14/32] net/mlx5e: Fix handling of wrong devices during bond netevent Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 15/32] net/mlx5: Use del_timer_sync in fw reset flow of halting poll Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 16/32] net/mlx5e: Fix module EEPROM query Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 17/32] net/mlx5: Fix offloading with ESWITCH_IPV4_TTL_MODIFY_ENABLE Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 18/32] net/mlx5e: Dont treat small ceil values as unlimited in HTB offload Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 19/32] net/mlx5: Bridge, Fix devlink deadlock on net namespace deletion Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 20/32] net/mlx5: E-Switch, Fix uninitialized variable modact Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 21/32] ipheth: fix EOVERFLOW in ipheth_rcvbulk_callback Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 22/32] i40e: Fix reset bw limit when DCB enabled with 1 TC Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 23/32] i40e: Fix reset path while removing the driver Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 24/32] net: amd-xgbe: ensure to reset the tx_timer_active flag Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 25/32] net: amd-xgbe: Fix skb data length underflow Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 26/32] fanotify: Fix stale file descriptor in copy_event_to_user() Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 27/32] net: sched: fix use-after-free in tc_new_tfilter() Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 28/32] rtnetlink: make sure to refresh master_dev/m_ops in __rtnl_newlink() Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 29/32] cpuset: Fix the bug that subpart_cpus updated wrongly in update_cpumask() Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 30/32] e1000e: Handshake with CSME starts from ADL platforms Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 31/32] af_packet: fix data-race in packet_setsockopt / packet_setsockopt Greg Kroah-Hartman
2022-02-04  9:22 ` [PATCH 5.15 32/32] tcp: add missing tcp_skb_can_collapse() test in tcp_shift_skb_data() Greg Kroah-Hartman
2022-02-04 12:21 ` [PATCH 5.15 00/32] 5.15.20-rc1 review Bagas Sanjaya
2022-02-04 17:48 ` Florian Fainelli
2022-02-04 20:31 ` Shuah Khan
2022-02-04 21:08 ` Guenter Roeck
2022-02-04 22:42 ` Ron Economos
2022-02-04 23:04 ` Justin Forbes
2022-02-05  0:18 ` Fox Chen
2022-02-05  5:07 ` Slade Watkins
2022-02-05  6:51 ` Naresh Kamboju
2022-02-05 14:32 ` Sudip Mukherjee

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=20220205171238.GA3073350@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime@cerno.tech \
    --cc=michael+drm@stapelberg.ch \
    --cc=stable@vger.kernel.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

all inboxes | Powered by JetHome®