From: Tedd Ho-Jeong An <tedd.an@linux.intel.com>
To: Kiran K <kiran.k@intel.com>, linux-bluetooth@vger.kernel.org
Cc: ravishankar.srivatsa@intel.com,
Chethan Tumkur Narayan <chethan.tumkur.narayan@intel.com>
Subject: Re: [PATCH v1] btintel: Add recovery when secure verification of firmware fails
Date: Tue, 10 Jan 2023 13:57:55 -0800 [thread overview]
Message-ID: <4e705bd4dba26a2bcb82bba12ff80238280e2b77.camel@linux.intel.com> (raw)
In-Reply-To: <20230110155905.18203-1-kiran.k@intel.com>
Hi Kiran
On Tue, 2023-01-10 at 21:29 +0530, Kiran K wrote:
> On warm reboot stress test case, firmware download failure
> has been observed with failure in secure verification of firmware
> and BT becomes completely inaccessible. This can happen due to a race
> condition in TOP registers when Wifi driver is also getting loaded
> at the same time. This patch adds a work around to load the BT firmware
> again when secure verify failure is observed.
>
> Signed-off-by: Kiran K <kiran.k@intel.com>
> Signed-off-by: Chethan Tumkur Narayan <chethan.tumkur.narayan@intel.com>
> ---
> drivers/bluetooth/btintel.c | 20 ++++++++++++++++----
> drivers/bluetooth/btintel.h | 1 +
> 2 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
> index d4e2cb9a4eb4..3f2976fb056a 100644
> --- a/drivers/bluetooth/btintel.c
> +++ b/drivers/bluetooth/btintel.c
> @@ -1700,6 +1700,11 @@ static int btintel_download_wait(struct hci_dev *hdev, ktime_t calltime, int mse
> return -ETIMEDOUT;
> }
>
> + if (btintel_test_flag(hdev, INTEL_FIRMWARE_VERIFY_FAILED)) {
> + bt_dev_err(hdev, "Firmware secure verification failed");
> + return -EAGAIN;
> + }
> +
> if (btintel_test_flag(hdev, INTEL_FIRMWARE_FAILED)) {
> bt_dev_err(hdev, "Firmware loading failed");
> return -ENOEXEC;
> @@ -1961,7 +1966,7 @@ static int btintel_download_fw(struct hci_dev *hdev,
> * of this device.
> */
> err = btintel_download_wait(hdev, calltime, 5000);
> - if (err == -ETIMEDOUT)
> + if (err == -ETIMEDOUT || err == -EAGAIN)
> btintel_reset_to_bootloader(hdev);
>
> done:
> @@ -2153,7 +2158,7 @@ static int btintel_prepare_fw_download_tlv(struct hci_dev *hdev,
> * of this device.
> */
> err = btintel_download_wait(hdev, calltime, 5000);
> - if (err == -ETIMEDOUT)
> + if (err == -ETIMEDOUT || err == -EAGAIN)
> btintel_reset_to_bootloader(hdev);
>
> done:
> @@ -2644,8 +2649,15 @@ void btintel_secure_send_result(struct hci_dev *hdev,
> if (len != sizeof(*evt))
> return;
>
> - if (evt->result)
> - btintel_set_flag(hdev, INTEL_FIRMWARE_FAILED);
> + if (evt->result) {
> + bt_dev_err(hdev, "Intel Secure Send Results event result: %u status: %u",
> + evt->result, evt->status);
> +
> + if (evt->result == 3)
Please avoid any magic number here. You can define it in btintel.h.
As Luiz suggested, let's try to add the reloading counter in btintel_data to limit the reloading try.
> + btintel_set_flag(hdev, INTEL_FIRMWARE_VERIFY_FAILED);
> + else
> + btintel_set_flag(hdev, INTEL_FIRMWARE_FAILED);
> + }
>
> if (btintel_test_and_clear_flag(hdev, INTEL_DOWNLOADING) &&
> btintel_test_flag(hdev, INTEL_FIRMWARE_LOADED))
> diff --git a/drivers/bluetooth/btintel.h b/drivers/bluetooth/btintel.h
> index e0060e58573c..10e5be7e451a 100644
> --- a/drivers/bluetooth/btintel.h
> +++ b/drivers/bluetooth/btintel.h
> @@ -147,6 +147,7 @@ enum {
> INTEL_BOOTLOADER,
> INTEL_DOWNLOADING,
> INTEL_FIRMWARE_LOADED,
> + INTEL_FIRMWARE_VERIFY_FAILED,
> INTEL_FIRMWARE_FAILED,
> INTEL_BOOTING,
> INTEL_BROKEN_INITIAL_NCMD,
Regards,
Tedd
prev parent reply other threads:[~2023-01-10 21:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-10 15:59 [PATCH v1] btintel: Add recovery when secure verification of firmware fails Kiran K
2023-01-10 15:52 ` K, Kiran
2023-01-10 16:39 ` [v1] " bluez.test.bot
2023-01-10 20:10 ` [PATCH v1] " Luiz Augusto von Dentz
2023-01-10 21:57 ` Tedd Ho-Jeong An [this message]
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=4e705bd4dba26a2bcb82bba12ff80238280e2b77.camel@linux.intel.com \
--to=tedd.an@linux.intel.com \
--cc=chethan.tumkur.narayan@intel.com \
--cc=kiran.k@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=ravishankar.srivatsa@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.