From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Francisco Blas Izquierdo Riera (klondike)" <klondike@klondike.es>
Cc: linux-usb@vger.kernel.org,
Andreas Noever <andreas.noever@gmail.com>,
Michael Jamet <michael.jamet@intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Yehezkel Bernat <YehezkelShB@gmail.com>,
Kranthi Kuntala <kranthi.kuntala@intel.com>,
Rajmohan Mani <rajmohan.mani@intel.com>,
Mario.Limonciello@dell.com, Lukas Wunner <lukas@wunner.de>,
Jonathan Corbet <corbet@lwn.net>,
linux-doc@vger.kernel.org
Subject: Re: [PATCH 1/2] thunderbolt: allow vendor ID override for NVM programming
Date: Wed, 24 Nov 2021 19:26:54 +0100 [thread overview]
Message-ID: <YZ6D7vbyaf50DSCh@kroah.com> (raw)
In-Reply-To: <07bd1d90-c95f-0685-e1a8-2211c9dac251@klondike.es>
On Wed, Nov 24, 2021 at 05:37:05PM +0100, Francisco Blas Izquierdo Riera (klondike) wrote:
> Currently, the vendor ID reported by the chipset is checked before to
> avoid accidentally programming devices from unsupported vendors with
> a different NVM structure.
>
> Certain Thunderbolt devices store the vendor ID in the NVM, therefore
> if the NVM has become corrrupted the device will report an invalid
> vendor ID and reflashing will be impossible on GNU/Linux even if the
> device can boot in safe mode.
>
> This patch adds a new parameter ``switch_nvm_vendor_override`` which
> can be used to override the vendor ID used for detecting the NVM
> structure allowing to reflash (and authenticate) a new, valid
> image on the device.
>
> Signed-off-by: Francisco Blas Izquierdo Riera (klondike) <klondike@klondike.es>
> ---
> drivers/thunderbolt/switch.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
> index 3014146081..a7959c3f3f 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/moduleparam.h>
> #include "tb.h"
> @@ -34,6 +35,10 @@ struct nvm_auth_status {
> static LIST_HEAD(nvm_auth_status_cache);
> static DEFINE_MUTEX(nvm_auth_status_lock);
> +static short switch_nvm_vendor_override = -1;
> +module_param(switch_nvm_vendor_override, short, 0440);
> +MODULE_PARM_DESC(switch_nvm_vendor_override, "Override the switch vendor id on the nvm access routines");
> +
> static struct nvm_auth_status *__nvm_get_auth_status(const struct tb_switch *sw)
> {
> struct nvm_auth_status *st;
> @@ -391,7 +396,9 @@ static int tb_switch_nvm_add(struct tb_switch *sw)
> * relax this in the future when we learn other NVM formats.
> */
> if (sw->config.vendor_id != PCI_VENDOR_ID_INTEL &&
> - sw->config.vendor_id != 0x8087) {
> + sw->config.vendor_id != 0x8087 &&
> + switch_nvm_vendor_override != PCI_VENDOR_ID_INTEL &&
> + switch_nvm_vendor_override != 0x8087) {
> dev_info(&sw->dev,
> "NVM format of vendor %#x is not known, disabling NVM upgrade\n",
> sw->config.vendor_id);
Patch is corrupted :(
Anyway, module parameters are from the 1990's and should stay there.
Please use a per-device way to handle this instead, as trying to handle
module parameters is very difficult over time.
thanks,
greg k-h
next prev parent reply other threads:[~2021-11-24 18:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 16:34 [PATCH 0/2] Thunderbolt: allow vendor ID override for NVM programming Francisco Blas Izquierdo Riera (klondike)
2021-11-24 16:37 ` [PATCH 1/2] thunderbolt: " Francisco Blas Izquierdo Riera (klondike)
2021-11-24 18:26 ` Greg Kroah-Hartman [this message]
2021-11-24 18:32 ` klondike
2021-11-24 18:37 ` Greg Kroah-Hartman
2021-11-24 18:56 ` klondike
2021-11-25 6:02 ` Greg Kroah-Hartman
2021-11-25 6:16 ` Mika Westerberg
2021-11-24 16:37 ` [PATCH 2/2] Documentation: explain how to override Thunderbolt Vendor ID Francisco Blas Izquierdo Riera (klondike)
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=YZ6D7vbyaf50DSCh@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=Mario.Limonciello@dell.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=corbet@lwn.net \
--cc=klondike@klondike.es \
--cc=kranthi.kuntala@intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=michael.jamet@intel.com \
--cc=mika.westerberg@linux.intel.com \
--cc=rajmohan.mani@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 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.