Some AMD based ThinkPads have a firmware bug that calling "GBDC" will cause bluetooth on Intel wireless cards blocked.
Probe these models by DMI match and disable bluetooth subdriver if specified Intel wireless card exist.
Signed-off-by: Jiaxun Yang jiaxun.yang@flygoat.com --- drivers/platform/x86/thinkpad_acpi.c | 70 ++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 726341f2b638..29e835f9368a 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -79,6 +79,7 @@ #include <linux/jiffies.h> #include <linux/workqueue.h> #include <linux/acpi.h> +#include <linux/pci.h> #include <linux/pci_ids.h> #include <linux/power_supply.h> #include <sound/core.h> @@ -4501,11 +4502,80 @@ static void bluetooth_exit(void) bluetooth_shutdown(); }
+static const struct dmi_system_id bt_fwbug_list[] __initconst = { + { + .ident = "ThinkPad E485", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_BOARD_NAME, "20KU"), + }, + }, + { + .ident = "ThinkPad E585", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_BOARD_NAME, "20KV"), + }, + }, + { + .ident = "ThinkPad A285 - 20MW", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_BOARD_NAME, "20MW"), + }, + }, + { + .ident = "ThinkPad A285 - 20MX", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_BOARD_NAME, "20MX"), + }, + }, + { + .ident = "ThinkPad A485 - 20MU", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_BOARD_NAME, "20MU"), + }, + }, + { + .ident = "ThinkPad A485 - 20MV", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_BOARD_NAME, "20MV"), + }, + }, + {} +}; + +static int __init have_bt_fwbug(void) +{ + /* Some AMD based ThinkPads have a firmware bug that calling + * "GBDC" will cause bluetooth on Intel wireless cards blocked + */ + if (dmi_check_system(bt_fwbug_list)) { + if (pci_get_device(PCI_VENDOR_ID_INTEL, 0x24F3, NULL) || \ + pci_get_device(PCI_VENDOR_ID_INTEL, 0x24FD, NULL) || \ + pci_get_device(PCI_VENDOR_ID_INTEL, 0x2526, NULL)) + return 1; + else + return 0; + } else { + return 0; + } +} + static int __init bluetooth_init(struct ibm_init_struct *iibm) { int res; int status = 0;
+ if (have_bt_fwbug()) { + vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL, + FW_BUG "disable bluetooth subdriver for Intel cards\n"); + return 1; + } + vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL, "initializing bluetooth subdriver\n");
On Thu, Mar 7, 2019 at 10:09 AM Jiaxun Yang jiaxun.yang@flygoat.com wrote:
Some AMD based ThinkPads have a firmware bug that calling "GBDC" will cause bluetooth on Intel wireless cards blocked.
Probe these models by DMI match and disable bluetooth subdriver if specified Intel wireless card exist.
Thanks for a patch. My comments below.
(and take your time, there is merge window going on, so, your fix is probably material for v5.1-rc2)
@@ -79,6 +79,7 @@ #include <linux/jiffies.h> #include <linux/workqueue.h> #include <linux/acpi.h>
+#include <linux/pci.h> #include <linux/pci_ids.h>
The new include has included the old one with IDs.
#include <linux/power_supply.h> #include <sound/core.h> @@ -4501,11 +4502,80 @@ static void bluetooth_exit(void) bluetooth_shutdown(); }
+static int __init have_bt_fwbug(void) +{
/* Some AMD based ThinkPads have a firmware bug that calling
* "GBDC" will cause bluetooth on Intel wireless cards blocked
*/
/* * Comments in multi-line style example. * Should look like this one. */
if (dmi_check_system(bt_fwbug_list)) {
if (pci_get_device(PCI_VENDOR_ID_INTEL, 0x24F3, NULL) || \
pci_get_device(PCI_VENDOR_ID_INTEL, 0x24FD, NULL) || \
pci_get_device(PCI_VENDOR_ID_INTEL, 0x2526, NULL))
You can do a table and use pci_match_device(). On top of it
if (x) { if (y) ... }
equivalent to
if (x && y) { ... }
return 1;
else
return 0;
} else {
return 0;
}
+}
if (have_bt_fwbug()) {
vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL,
FW_BUG "disable bluetooth subdriver for Intel cards\n");
return 1;
} vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL, "initializing bluetooth subdriver\n");
Below I see the following: /* bluetooth not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p, G4x, R30, R31, R40e, R50e, T20-22, X20-21 */ tp_features.bluetooth = hkey_handle && acpi_evalf(hkey_handle, &status, "GBDC", "qd");
Is it possible to integrate your stuff to this one? Or can you do similar, like tp_features.bluetooth = !have_bt_fwbug(); ?
Some AMD based ThinkPads have a firmware bug that calling "GBDC" will cause bluetooth on Intel wireless cards blocked.
Probe these models by DMI match and disable bluetooth subdriver if specified Intel wireless card exist.
Cc: stable stable@vger.kernel.org # 4.14+ Signed-off-by: Jiaxun Yang jiaxun.yang@flygoat.com --- drivers/platform/x86/thinkpad_acpi.c | 73 +++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 726341f2b638..2e24ee42a3c6 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -79,7 +79,7 @@ #include <linux/jiffies.h> #include <linux/workqueue.h> #include <linux/acpi.h> -#include <linux/pci_ids.h> +#include <linux/pci.h> #include <linux/power_supply.h> #include <sound/core.h> #include <sound/control.h> @@ -4501,11 +4501,80 @@ static void bluetooth_exit(void) bluetooth_shutdown(); }
+static const struct dmi_system_id bt_fwbug_list[] __initconst = { + { + .ident = "ThinkPad E485", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_BOARD_NAME, "20KU"), + }, + }, + { + .ident = "ThinkPad E585", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_BOARD_NAME, "20KV"), + }, + }, + { + .ident = "ThinkPad A285 - 20MW", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_BOARD_NAME, "20MW"), + }, + }, + { + .ident = "ThinkPad A285 - 20MX", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_BOARD_NAME, "20MX"), + }, + }, + { + .ident = "ThinkPad A485 - 20MU", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_BOARD_NAME, "20MU"), + }, + }, + { + .ident = "ThinkPad A485 - 20MV", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_BOARD_NAME, "20MV"), + }, + }, + {} +}; + +static const struct pci_device_id fwbug_cards_ids[] __initconst = { + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x24F3) }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x24FD) }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2526) }, + {} +}; + + +static int __init have_bt_fwbug(void) +{ + /* + * Some AMD based ThinkPads have a firmware bug that calling + * "GBDC" will cause bluetooth on Intel wireless cards blocked + */ + if (dmi_check_system(bt_fwbug_list) && pci_dev_present(fwbug_cards_ids)) { + vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL, + FW_BUG "disable bluetooth subdriver for Intel cards\n"); + return 1; + } else + return 0; +} + static int __init bluetooth_init(struct ibm_init_struct *iibm) { int res; int status = 0;
+ vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL, "initializing bluetooth subdriver\n");
@@ -4513,7 +4582,7 @@ static int __init bluetooth_init(struct ibm_init_struct *iibm)
/* bluetooth not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p, G4x, R30, R31, R40e, R50e, T20-22, X20-21 */ - tp_features.bluetooth = hkey_handle && + tp_features.bluetooth = !have_bt_fwbug() && hkey_handle && acpi_evalf(hkey_handle, &status, "GBDC", "qd");
vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL,
On Thu, Mar 07, 2019 at 04:08:20PM +0800, Jiaxun Yang wrote:
Some AMD based ThinkPads have a firmware bug that calling "GBDC" will cause bluetooth on Intel wireless cards blocked.
Probe these models by DMI match and disable bluetooth subdriver if specified Intel wireless card exist.
Signed-off-by: Jiaxun Yang jiaxun.yang@flygoat.com
drivers/platform/x86/thinkpad_acpi.c | 70 ++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
<formletter>
This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html for how to do this properly.
</formletter>
在 2019/3/7 下午7:20, Greg KH 写道:
On Thu, Mar 07, 2019 at 04:08:20PM +0800, Jiaxun Yang wrote:
Some AMD based ThinkPads have a firmware bug that calling "GBDC" will cause bluetooth on Intel wireless cards blocked.
Probe these models by DMI match and disable bluetooth subdriver if specified Intel wireless card exist.
Signed-off-by: Jiaxun Yang jiaxun.yang@flygoat.com
drivers/platform/x86/thinkpad_acpi.c | 70 ++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
<formletter>
This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html for how to do this properly.
Thanks for remind.
Should I resend this patch in correct way?
</formletter>
--
Jiaxun Yang
On Thu, Mar 7, 2019 at 2:30 PM Jiaxun Yang jiaxun.yang@flygoat.com wrote:
On Thu, Mar 07, 2019 at 04:08:20PM +0800, Jiaxun Yang wrote:
Some AMD based ThinkPads have a firmware bug that calling "GBDC" will cause bluetooth on Intel wireless cards blocked.
Probe these models by DMI match and disable bluetooth subdriver if specified Intel wireless card exist.
Thanks for remind.
Should I resend this patch in correct way?
It still needs a bit of work, and as I told you, we are now during an opened merge window.
From: Jiaxun Yang
Sent: 07 March 2019 08:08
...
+static int __init have_bt_fwbug(void) +{
- /* Some AMD based ThinkPads have a firmware bug that calling
* "GBDC" will cause bluetooth on Intel wireless cards blocked
*/
- if (dmi_check_system(bt_fwbug_list)) {
if (pci_get_device(PCI_VENDOR_ID_INTEL, 0x24F3, NULL) || \
WTF if that \ ??
pci_get_device(PCI_VENDOR_ID_INTEL, 0x24FD, NULL) || \
pci_get_device(PCI_VENDOR_ID_INTEL, 0x2526, NULL))
return 1;
else
return 0;
- } else {
return 0;
- }
+}
You don't need 'else' after a 'return'. I'd also put the return nearer the test.
While the above could be written: return dmi_check_system(bt_fwbug_list) && (pci_get_device(PCI_VENDOR_ID_INTEL, 0x24F3, NULL) || pci_get_device(PCI_VENDOR_ID_INTEL, 0x24FD, NULL) || pci_get_device(PCI_VENDOR_ID_INTEL, 0x2526, NULL));
I think I'd write: if (!dmi_check_system(bt_fwbug_list)) return 0; return pci_get_device(PCI_VENDOR_ID_INTEL, 0x24F3, NULL) || pci_get_device(PCI_VENDOR_ID_INTEL, 0x24FD, NULL) || pci_get_device(PCI_VENDOR_ID_INTEL, 0x2526, NULL);
David
- Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
-----Original Message-----
From: platform-driver-x86-owner@vger.kernel.org <platform-driver-x86- owner@vger.kernel.org> On Behalf Of Jiaxun Yang Sent: Thursday, March 7, 2019 2:08 AM To: ibm-acpi@hmh.eng.br Cc: dvhart@infradead.org; andy@infradead.org; ibm-acpi- devel@lists.sourceforge.net; platform-driver-x86@vger.kernel.org; linux- kernel@vger.kernel.org; stable@vger.kernel.org; Jiaxun Yang Subject: [PATCH] platform/x86: thinkpad_acpi: disable bluetooth for some machines
[EXTERNAL EMAIL]
Some AMD based ThinkPads have a firmware bug that calling "GBDC" will cause bluetooth on Intel wireless cards blocked.
Since this is considered a firmware bug; has the OEM (and IBV) been notified? Is it fixed in a newer version of the firmware?
If so, then this should probably only match particular broken firmware versions.
Probe these models by DMI match and disable bluetooth subdriver if specified Intel wireless card exist.
Signed-off-by: Jiaxun Yang jiaxun.yang@flygoat.com
drivers/platform/x86/thinkpad_acpi.c | 70 ++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 726341f2b638..29e835f9368a 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -79,6 +79,7 @@ #include <linux/jiffies.h> #include <linux/workqueue.h> #include <linux/acpi.h> +#include <linux/pci.h> #include <linux/pci_ids.h> #include <linux/power_supply.h> #include <sound/core.h> @@ -4501,11 +4502,80 @@ static void bluetooth_exit(void) bluetooth_shutdown(); }
+static const struct dmi_system_id bt_fwbug_list[] __initconst = {
- {
.ident = "ThinkPad E485",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "20KU"),
},
- },
- {
.ident = "ThinkPad E585",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "20KV"),
},
- },
- {
.ident = "ThinkPad A285 - 20MW",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "20MW"),
},
- },
- {
.ident = "ThinkPad A285 - 20MX",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "20MX"),
},
- },
- {
.ident = "ThinkPad A485 - 20MU",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "20MU"),
},
- },
- {
.ident = "ThinkPad A485 - 20MV",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "20MV"),
},
- },
- {}
+};
+static int __init have_bt_fwbug(void) +{
- /* Some AMD based ThinkPads have a firmware bug that calling
* "GBDC" will cause bluetooth on Intel wireless cards blocked
*/
- if (dmi_check_system(bt_fwbug_list)) {
if (pci_get_device(PCI_VENDOR_ID_INTEL, 0x24F3, NULL) || \
pci_get_device(PCI_VENDOR_ID_INTEL, 0x24FD, NULL) || \
pci_get_device(PCI_VENDOR_ID_INTEL, 0x2526, NULL))
return 1;
else
return 0;
- } else {
return 0;
- }
+}
static int __init bluetooth_init(struct ibm_init_struct *iibm) { int res; int status = 0;
- if (have_bt_fwbug()) {
vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL,
FW_BUG "disable bluetooth subdriver for Intel cards\n");
return 1;
- }
- vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL, "initializing bluetooth subdriver\n");
-- 2.20.1
在 2019/3/8 上午7:14, Mario.Limonciello@dell.com 写道:
-----Original Message-----
From: platform-driver-x86-owner@vger.kernel.org <platform-driver-x86- owner@vger.kernel.org> On Behalf Of Jiaxun Yang Sent: Thursday, March 7, 2019 2:08 AM To: ibm-acpi@hmh.eng.br Cc: dvhart@infradead.org; andy@infradead.org; ibm-acpi- devel@lists.sourceforge.net; platform-driver-x86@vger.kernel.org; linux- kernel@vger.kernel.org; stable@vger.kernel.org; Jiaxun Yang Subject: [PATCH] platform/x86: thinkpad_acpi: disable bluetooth for some machines
[EXTERNAL EMAIL]
Some AMD based ThinkPads have a firmware bug that calling "GBDC" will cause bluetooth on Intel wireless cards blocked.
Hi,
Thanks for your suggestions.
Since this is considered a firmware bug; has the OEM (and IBV) been notified? Is it fixed in a newer version of the firmware?
No. I've noticed them about the bug but they said these models have no official Linux support so no plan to fix.
If so, then this should probably only match particular broken firmware versions.
Disable bluetooth subdriver on these models should be safe since Intel cards have built-in RFKill and there is no bluetooth hotkey on these machines.
Probe these models by DMI match and disable bluetooth subdriver if specified Intel wireless card exist.
Signed-off-by: Jiaxun Yang jiaxun.yang@flygoat.com
--
Jiaxun Yang
linux-stable-mirror@lists.linaro.org