public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Gil Fine <gil.fine@intel.com>
To: andreas.noever@gmail.com, michael.jamet@intel.com,
	mika.westerberg@linux.intel.com, YehezkelShB@gmail.com
Cc: gil.fine@intel.com, linux-usb@vger.kernel.org, lukas@wunner.de
Subject: [PATCH v2 7/7] thunderbolt: Add kernel param for CLx disabling
Date: Fri, 17 Dec 2021 03:16:44 +0200	[thread overview]
Message-ID: <20211217011644.21634-8-gil.fine@intel.com> (raw)
In-Reply-To: <20211217011644.21634-1-gil.fine@intel.com>

Add a module parameter that allows user to completely disable CLx
functionality in case problems are found.

Signed-off-by: Gil Fine <gil.fine@intel.com>
---
 drivers/thunderbolt/switch.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index cd6d16417a80..7224b9aa75ed 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -13,6 +13,7 @@
 #include <linux/sched/signal.h>
 #include <linux/sizes.h>
 #include <linux/slab.h>
+#include <linux/module.h>
 
 #include "tb.h"
 
@@ -26,6 +27,10 @@ struct nvm_auth_status {
 	u32 status;
 };
 
+static bool clx_enabled = true;
+module_param_named(clx, clx_enabled, bool, 0444);
+MODULE_PARM_DESC(clx, "allow CLx on the High-Speed link (default: true)");
+
 /*
  * Hold NVM authentication failure status per switch This information
  * needs to stay around even when the switch gets power cycled so we
@@ -3482,6 +3487,9 @@ int tb_switch_enable_clx(struct tb_switch *sw, enum tb_clx clx)
 {
 	struct tb_switch *root_sw = sw->tb->root_switch;
 
+	if (!clx_enabled)
+		return 0;
+
 	/* CLx is not enabled and validated on USB4 platforms before ADL */
 	if (root_sw->generation < 4 ||
 	    tb_switch_is_tiger_lake(root_sw))
@@ -3541,6 +3549,9 @@ static int tb_switch_disable_cl0s(struct tb_switch *sw)
  */
 int tb_switch_disable_clx(struct tb_switch *sw, enum tb_clx clx)
 {
+	if (!clx_enabled)
+		return 0;
+
 	switch (clx) {
 	case TB_CL0S:
 		return tb_switch_disable_cl0s(sw);
-- 
2.17.1

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


  parent reply	other threads:[~2021-12-17  1:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-17  1:16 [PATCH v2 0/7] thunderbolt: CLx support for USB4 and Titan Ridge Gil Fine
2021-12-17  1:16 ` [PATCH v2 1/7] thunderbolt: Add TMU unidirectional mode Gil Fine
2021-12-17  1:16 ` [PATCH v2 2/7] thunderbolt: Add CL0s support for USB4 Gil Fine
2021-12-17  1:16 ` [PATCH v2 3/7] thunderbolt: Move usb4_switch_wait_for_bit() to switch.c Gil Fine
2021-12-17  1:16 ` [PATCH v2 4/7] thunderbolt: Enable TMU for Titan Ridge device Gil Fine
2021-12-17  1:16 ` [PATCH v2 5/7] thunderbolt: Rename Intel VSC capability Gil Fine
2021-12-17  1:16 ` [PATCH v2 6/7] thunderbolt: Enable CL0s for Titan Ridge device Gil Fine
2021-12-17  1:16 ` Gil Fine [this message]
2021-12-22 14:18 ` [PATCH v2 0/7] thunderbolt: CLx support for USB4 and Titan Ridge Mika Westerberg
2021-12-27 16:13   ` Gil Fine
2021-12-28  7:52     ` 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=20211217011644.21634-8-gil.fine@intel.com \
    --to=gil.fine@intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=michael.jamet@intel.com \
    --cc=mika.westerberg@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox