All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Sanjay R Mehta <sanmehta@amd.com>
Cc: Sanjay R Mehta <Sanju.Mehta@amd.com>,
	andreas.noever@gmail.com, michael.jamet@intel.com,
	YehezkelShB@gmail.com, linux-usb@vger.kernel.org,
	Sanath S <Sanath.S@amd.com>
Subject: Re: [PATCH Internal] thunderbolt: Remove enabling/disabling TMU based on CLx
Date: Thu, 22 Jun 2023 07:45:04 +0300	[thread overview]
Message-ID: <20230622044504.GN45886@black.fi.intel.com> (raw)
In-Reply-To: <a1959444-9f9d-5a3e-65cf-abb681d8bc74@amd.com>

On Wed, Jun 21, 2023 at 09:37:32PM +0530, Sanjay R Mehta wrote:
> 
> 
> On 6/21/2023 6:24 PM, Mika Westerberg wrote:
> > On Wed, Jun 21, 2023 at 05:48:21PM +0530, Sanjay R Mehta wrote:
> >>
> >>
> >> On 6/21/2023 4:45 PM, Mika Westerberg wrote:
> >>> On Wed, Jun 21, 2023 at 05:37:22AM -0500, Sanjay R Mehta wrote:
> >>>> From: Sanath S <Sanath.S@amd.com>
> >>>>
> >>>> Since TMU is enabled by default on Intel SOCs for USB4 before Alpine
> >>>> Ridge, explicit enabling or disabling of TMU is not required.
> >>>>
> >>>> However, the current implementation of enabling or disabling TMU based
> >>>> on CLx state is inadequate as not all SOCs with CLx disabled have TMU
> >>>> enabled by default, such as AMD Yellow Carp and Pink Sardine.
> >>>>
> >>>> To address this, a quirk named "QUIRK_TMU_DEFAULT_ENABLED" is
> >>>> implemented to skip the enabling or disabling of TMU for SOCs where it
> >>>> is already enabled by default, such as Intel SOCs prior to Alpine Ridge.
> >>>
> >>> If it is enabled by default "enabling" it again should not be a problem.
> >>> Can you elaborate this more?
> >>
> >> Although that is correct, Mika, we are facing an issue of display
> >> flickering on Alpine Ridge and older device routers, from the second
> >> hotplug onwards. This issue arises as the TMU is enabled and disabled
> >> for each plug and unplug.
> > 
> > Okay thanks for clarifying.
> > 
> >> Upon reviewing the old code, it appears that this issue was already
> >> addressed with the following code block:
> >>
> >> /*
> >>  * No need to enable TMU on devices that don't support CLx since on
> >>  * these devices e.g. Alpine Ridge and earlier, the TMU mode HiFi
> >>  * bi-directional is enabled by default.
> >>  */
> >> if (!tb_switch_is_clx_supported(sw))
> >>         return 0;
> >>
> >>
> >> However, it seems that this code has been removed in recent changes, as
> >> the CLX-related code has been moved to a different file.
> > 
> > Yes, I removed it because TMU code should not really be calling CLx
> > functions.
> > 
> > However, we have in tb_enable_tmu() this:
> > 
> > 	/* If it is already enabled in correct mode, don't touch it */
> > 	if (tb_switch_tmu_is_enabled(sw))
> > 		return 0;
> > 
> > and tb_switch_tmu_init() reads the hardware state so this code should
> > basically leave TMU enabling untouched on Alpine Ridge for instance. I
> > wonder if you can try with the latest "next" branch and see if it works
> > there or you are already doing so?
> > 
> Yes Mika, we have already verified with the latest thunderbolt/next
> branch. This patch is built on top of next branch.

Okay.

> >> Canonical has also reported this issue and has tested this patch that
> >> appears to resolve the issue..
> > 
> > Right, however let's figure out if the problem is already solved with
> > the recent code as above or if not why it does not work as expected. I
> > don't really think we want to add any quirks for this because even in
> > the USB4 spec the TMU of TBT3 devices is expected to be enabled already
> > so this is expected functionality and the driver should be doing the
> > right thing here.
> 
> Agree. we will have to see what is going wrong in this case.

You should be able to see in the dmesg (once thunderbolt.dyndbg=+p is
passed in command line) what the initial state of TMU is and how the
driver programs it or does it skip the enabling as expected.

  reply	other threads:[~2023-06-22  4:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21 10:37 [PATCH Internal] thunderbolt: Remove enabling/disabling TMU based on CLx Sanjay R Mehta
2023-06-21 10:52 ` Greg KH
2023-06-21 10:52 ` Greg KH
2023-06-21 10:57   ` Sanjay R Mehta
2023-06-21 11:15 ` Mika Westerberg
2023-06-21 12:18   ` Sanjay R Mehta
2023-06-21 12:54     ` Mika Westerberg
2023-06-21 16:07       ` Sanjay R Mehta
2023-06-22  4:45         ` Mika Westerberg [this message]
2023-07-06 13:48         ` Sanjay R Mehta
2023-07-31  9:41           ` Mika Westerberg

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=20230622044504.GN45886@black.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=Sanath.S@amd.com \
    --cc=Sanju.Mehta@amd.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=michael.jamet@intel.com \
    --cc=sanmehta@amd.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.