From: Greg Kroah-Hartman Date: Fri, 9 Oct 2020 07:46:20 +0000 (+0200) Subject: 5.8-stable patches X-Git-Tag: v4.4.239~63 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7d931a4a65352ff4fc2907b7aafd897ba3cc7983;p=thirdparty%2Fkernel%2Fstable-queue.git 5.8-stable patches added patches: bpf-fix-sysfs-export-of-empty-btf-section.patch bpf-prevent-.btf-section-elimination.patch platform-olpc-fix-memleak-in-olpc_ec_probe.patch platform-x86-asus-wmi-fix-sw_tablet_mode-always-reporting-1-on-many-different-models.patch platform-x86-intel-vbtn-fix-sw_tablet_mode-always-reporting-1-on-the-hp-pavilion-11-x360.patch platform-x86-intel-vbtn-switch-to-an-allow-list-for-sw_tablet_mode-reporting.patch platform-x86-thinkpad_acpi-initialize-tp_nvram_state-variable.patch platform-x86-thinkpad_acpi-re-initialize-acpi-buffer-size-when-reuse.patch r8169-consider-that-phy-reset-may-still-be-in-progress-after-applying-firmware.patch --- diff --git a/queue-5.8/bpf-fix-sysfs-export-of-empty-btf-section.patch b/queue-5.8/bpf-fix-sysfs-export-of-empty-btf-section.patch new file mode 100644 index 00000000000..d40cc9b976e --- /dev/null +++ b/queue-5.8/bpf-fix-sysfs-export-of-empty-btf-section.patch @@ -0,0 +1,66 @@ +From e23bb04b0c938588eae41b7f4712b722290ed2b8 Mon Sep 17 00:00:00 2001 +From: Tony Ambardar +Date: Sat, 19 Sep 2020 22:01:33 -0700 +Subject: bpf: Fix sysfs export of empty BTF section + +From: Tony Ambardar + +commit e23bb04b0c938588eae41b7f4712b722290ed2b8 upstream. + +If BTF data is missing or removed from the ELF section it is still exported +via sysfs as a zero-length file: + + root@OpenWrt:/# ls -l /sys/kernel/btf/vmlinux + -r--r--r-- 1 root root 0 Jul 18 02:59 /sys/kernel/btf/vmlinux + +Moreover, reads from this file succeed and leak kernel data: + + root@OpenWrt:/# hexdump -C /sys/kernel/btf/vmlinux|head -10 + 000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| + * + 000cc0 00 00 00 00 00 00 00 00 00 00 00 00 80 83 b0 80 |................| + 000cd0 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| + 000ce0 00 00 00 00 00 00 00 00 00 00 00 00 57 ac 6e 9d |............W.n.| + 000cf0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| + * + 002650 00 00 00 00 00 00 00 10 00 00 00 01 00 00 00 01 |................| + 002660 80 82 9a c4 80 85 97 80 81 a9 51 68 00 00 00 02 |..........Qh....| + 002670 80 25 44 dc 80 85 97 80 81 a9 50 24 81 ab c4 60 |.%D.......P$...`| + +This situation was first observed with kernel 5.4.x, cross-compiled for a +MIPS target system. Fix by adding a sanity-check for export of zero-length +data sections. + +Fixes: 341dfcf8d78e ("btf: expose BTF info through sysfs") +Signed-off-by: Tony Ambardar +Signed-off-by: Daniel Borkmann +Acked-by: John Fastabend +Acked-by: Andrii Nakryiko +Link: https://lore.kernel.org/bpf/b38db205a66238f70823039a8c531535864eaac5.1600417359.git.Tony.Ambardar@gmail.com +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/bpf/sysfs_btf.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/kernel/bpf/sysfs_btf.c ++++ b/kernel/bpf/sysfs_btf.c +@@ -30,15 +30,15 @@ static struct kobject *btf_kobj; + + static int __init btf_vmlinux_init(void) + { +- if (!__start_BTF) ++ bin_attr_btf_vmlinux.size = __stop_BTF - __start_BTF; ++ ++ if (!__start_BTF || bin_attr_btf_vmlinux.size == 0) + return 0; + + btf_kobj = kobject_create_and_add("btf", kernel_kobj); + if (!btf_kobj) + return -ENOMEM; + +- bin_attr_btf_vmlinux.size = __stop_BTF - __start_BTF; +- + return sysfs_create_bin_file(btf_kobj, &bin_attr_btf_vmlinux); + } + diff --git a/queue-5.8/bpf-prevent-.btf-section-elimination.patch b/queue-5.8/bpf-prevent-.btf-section-elimination.patch new file mode 100644 index 00000000000..7e44b9a7b52 --- /dev/null +++ b/queue-5.8/bpf-prevent-.btf-section-elimination.patch @@ -0,0 +1,39 @@ +From 65c204398928f9c79f1a29912b410439f7052635 Mon Sep 17 00:00:00 2001 +From: Tony Ambardar +Date: Sat, 19 Sep 2020 22:01:34 -0700 +Subject: bpf: Prevent .BTF section elimination + +From: Tony Ambardar + +commit 65c204398928f9c79f1a29912b410439f7052635 upstream. + +Systems with memory or disk constraints often reduce the kernel footprint +by configuring LD_DEAD_CODE_DATA_ELIMINATION. However, this can result in +removal of any BTF information. + +Use the KEEP() macro to preserve the BTF data as done with other important +sections, while still allowing for smaller kernels. + +Fixes: 90ceddcb4950 ("bpf: Support llvm-objcopy for vmlinux BTF") +Signed-off-by: Tony Ambardar +Signed-off-by: Daniel Borkmann +Acked-by: John Fastabend +Acked-by: Andrii Nakryiko +Link: https://lore.kernel.org/bpf/a635b5d3e2da044e7b51ec1315e8910fbce0083f.1600417359.git.Tony.Ambardar@gmail.com +Signed-off-by: Greg Kroah-Hartman + +--- + include/asm-generic/vmlinux.lds.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/include/asm-generic/vmlinux.lds.h ++++ b/include/asm-generic/vmlinux.lds.h +@@ -641,7 +641,7 @@ + #define BTF \ + .BTF : AT(ADDR(.BTF) - LOAD_OFFSET) { \ + __start_BTF = .; \ +- *(.BTF) \ ++ KEEP(*(.BTF)) \ + __stop_BTF = .; \ + } + #else diff --git a/queue-5.8/platform-olpc-fix-memleak-in-olpc_ec_probe.patch b/queue-5.8/platform-olpc-fix-memleak-in-olpc_ec_probe.patch new file mode 100644 index 00000000000..e04febcd2b6 --- /dev/null +++ b/queue-5.8/platform-olpc-fix-memleak-in-olpc_ec_probe.patch @@ -0,0 +1,34 @@ +From 4fd9ac6bd3044734a7028bd993944c3617d1eede Mon Sep 17 00:00:00 2001 +From: Dinghao Liu +Date: Sun, 23 Aug 2020 19:12:11 +0800 +Subject: Platform: OLPC: Fix memleak in olpc_ec_probe + +From: Dinghao Liu + +commit 4fd9ac6bd3044734a7028bd993944c3617d1eede upstream. + +When devm_regulator_register() fails, ec should be +freed just like when olpc_ec_cmd() fails. + +Fixes: 231c0c216172a ("Platform: OLPC: Add a regulator for the DCON") +Signed-off-by: Dinghao Liu +Signed-off-by: Andy Shevchenko +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/platform/olpc/olpc-ec.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/platform/olpc/olpc-ec.c ++++ b/drivers/platform/olpc/olpc-ec.c +@@ -439,7 +439,9 @@ static int olpc_ec_probe(struct platform + &config); + if (IS_ERR(ec->dcon_rdev)) { + dev_err(&pdev->dev, "failed to register DCON regulator\n"); +- return PTR_ERR(ec->dcon_rdev); ++ err = PTR_ERR(ec->dcon_rdev); ++ kfree(ec); ++ return err; + } + + ec->dbgfs_dir = olpc_ec_setup_debugfs(); diff --git a/queue-5.8/platform-x86-asus-wmi-fix-sw_tablet_mode-always-reporting-1-on-many-different-models.patch b/queue-5.8/platform-x86-asus-wmi-fix-sw_tablet_mode-always-reporting-1-on-many-different-models.patch new file mode 100644 index 00000000000..76c9344d84e --- /dev/null +++ b/queue-5.8/platform-x86-asus-wmi-fix-sw_tablet_mode-always-reporting-1-on-many-different-models.patch @@ -0,0 +1,139 @@ +From 1797d588af15174d4a4e7159dac8c800538e4f8c Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 16 Sep 2020 16:14:39 +0200 +Subject: platform/x86: asus-wmi: Fix SW_TABLET_MODE always reporting 1 on many different models +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Hans de Goede + +commit 1797d588af15174d4a4e7159dac8c800538e4f8c upstream. + +Commit b0dbd97de1f1 ("platform/x86: asus-wmi: Add support for +SW_TABLET_MODE") added support for reporting SW_TABLET_MODE using the +Asus 0x00120063 WMI-device-id to see if various transformer models were +docked into their keyboard-dock (SW_TABLET_MODE=0) or if they were +being used as a tablet. + +The new SW_TABLET_MODE support (naively?) assumed that non Transformer +devices would either not support the 0x00120063 WMI-device-id at all, +or would NOT set ASUS_WMI_DSTS_PRESENCE_BIT in their reply when querying +the device-id. + +Unfortunately this is not true and we have received many bug reports about +this change causing the asus-wmi driver to always report SW_TABLET_MODE=1 +on non Transformer devices. This causes libinput to think that these are +360 degree hinges style 2-in-1s folded into tablet-mode. Making libinput +suppress keyboard and touchpad events from the builtin keyboard and +touchpad. So effectively this causes the keyboard and touchpad to not work +on many non Transformer Asus models. + +This commit fixes this by using the existing DMI based quirk mechanism in +asus-nb-wmi.c to allow using the 0x00120063 device-id for reporting +SW_TABLET_MODE on Transformer models and ignoring it on all other models. + +Fixes: b0dbd97de1f1 ("platform/x86: asus-wmi: Add support for SW_TABLET_MODE") +Link: https://patchwork.kernel.org/patch/11780901/ +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=209011 +BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1876997 +Reported-by: Samuel Čavoj +Signed-off-by: Hans de Goede +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/platform/x86/asus-nb-wmi.c | 32 ++++++++++++++++++++++++++++++++ + drivers/platform/x86/asus-wmi.c | 16 +++++++++------- + drivers/platform/x86/asus-wmi.h | 1 + + 3 files changed, 42 insertions(+), 7 deletions(-) + +--- a/drivers/platform/x86/asus-nb-wmi.c ++++ b/drivers/platform/x86/asus-nb-wmi.c +@@ -120,6 +120,10 @@ static struct quirk_entry quirk_asus_ga5 + .wmi_backlight_set_devstate = true, + }; + ++static struct quirk_entry quirk_asus_use_kbd_dock_devid = { ++ .use_kbd_dock_devid = true, ++}; ++ + static int dmi_matched(const struct dmi_system_id *dmi) + { + pr_info("Identified laptop model '%s'\n", dmi->ident); +@@ -493,6 +497,34 @@ static const struct dmi_system_id asus_q + }, + .driver_data = &quirk_asus_ga502i, + }, ++ { ++ .callback = dmi_matched, ++ .ident = "Asus Transformer T100TA / T100HA / T100CHI", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), ++ /* Match *T100* */ ++ DMI_MATCH(DMI_PRODUCT_NAME, "T100"), ++ }, ++ .driver_data = &quirk_asus_use_kbd_dock_devid, ++ }, ++ { ++ .callback = dmi_matched, ++ .ident = "Asus Transformer T101HA", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "T101HA"), ++ }, ++ .driver_data = &quirk_asus_use_kbd_dock_devid, ++ }, ++ { ++ .callback = dmi_matched, ++ .ident = "Asus Transformer T200TA", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "T200TA"), ++ }, ++ .driver_data = &quirk_asus_use_kbd_dock_devid, ++ }, + {}, + }; + +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -365,12 +365,14 @@ static int asus_wmi_input_init(struct as + if (err) + goto err_free_dev; + +- result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_KBD_DOCK); +- if (result >= 0) { +- input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE); +- input_report_switch(asus->inputdev, SW_TABLET_MODE, !result); +- } else if (result != -ENODEV) { +- pr_err("Error checking for keyboard-dock: %d\n", result); ++ if (asus->driver->quirks->use_kbd_dock_devid) { ++ result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_KBD_DOCK); ++ if (result >= 0) { ++ input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE); ++ input_report_switch(asus->inputdev, SW_TABLET_MODE, !result); ++ } else if (result != -ENODEV) { ++ pr_err("Error checking for keyboard-dock: %d\n", result); ++ } + } + + err = input_register_device(asus->inputdev); +@@ -2114,7 +2116,7 @@ static void asus_wmi_handle_event_code(i + return; + } + +- if (code == NOTIFY_KBD_DOCK_CHANGE) { ++ if (asus->driver->quirks->use_kbd_dock_devid && code == NOTIFY_KBD_DOCK_CHANGE) { + result = asus_wmi_get_devstate_simple(asus, + ASUS_WMI_DEVID_KBD_DOCK); + if (result >= 0) { +--- a/drivers/platform/x86/asus-wmi.h ++++ b/drivers/platform/x86/asus-wmi.h +@@ -33,6 +33,7 @@ struct quirk_entry { + bool wmi_backlight_native; + bool wmi_backlight_set_devstate; + bool wmi_force_als_set; ++ bool use_kbd_dock_devid; + int wapf; + /* + * For machines with AMD graphic chips, it will send out WMI event diff --git a/queue-5.8/platform-x86-intel-vbtn-fix-sw_tablet_mode-always-reporting-1-on-the-hp-pavilion-11-x360.patch b/queue-5.8/platform-x86-intel-vbtn-fix-sw_tablet_mode-always-reporting-1-on-the-hp-pavilion-11-x360.patch new file mode 100644 index 00000000000..15ee498a5c1 --- /dev/null +++ b/queue-5.8/platform-x86-intel-vbtn-fix-sw_tablet_mode-always-reporting-1-on-the-hp-pavilion-11-x360.patch @@ -0,0 +1,70 @@ +From d823346876a970522ff9e4d2b323c9b734dcc4de Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Sat, 12 Sep 2020 11:35:32 +0200 +Subject: platform/x86: intel-vbtn: Fix SW_TABLET_MODE always reporting 1 on the HP Pavilion 11 x360 + +From: Hans de Goede + +commit d823346876a970522ff9e4d2b323c9b734dcc4de upstream. + +Commit cfae58ed681c ("platform/x86: intel-vbtn: Only blacklist +SW_TABLET_MODE on the 9 / "Laptop" chasis-type") restored SW_TABLET_MODE +reporting on the HP stream x360 11 series on which it was previously broken +by commit de9647efeaa9 ("platform/x86: intel-vbtn: Only activate tablet +mode switch on 2-in-1's"). + +It turns out that enabling SW_TABLET_MODE reporting on devices with a +chassis-type of 10 ("Notebook") causes SW_TABLET_MODE to always report 1 +at boot on the HP Pavilion 11 x360, which causes libinput to disable the +kbd and touchpad. + +The HP Pavilion 11 x360's ACPI VGBS method sets bit 4 instead of bit 6 when +NOT in tablet mode at boot. Inspecting all the DSDTs in my DSDT collection +shows only one other model, the Medion E1239T ever setting bit 4 and it +always sets this together with bit 6. + +So lets treat bit 4 as a second bit which when set indicates the device not +being in tablet-mode, as we already do for bit 6. + +While at it also prefix all VGBS constant defines with "VGBS_". + +Fixes: cfae58ed681c ("platform/x86: intel-vbtn: Only blacklist SW_TABLET_MODE on the 9 / "Laptop" chasis-type") +Signed-off-by: Hans de Goede +Acked-by: Mark Gross +Signed-off-by: Andy Shevchenko +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/platform/x86/intel-vbtn.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +--- a/drivers/platform/x86/intel-vbtn.c ++++ b/drivers/platform/x86/intel-vbtn.c +@@ -15,9 +15,13 @@ + #include + #include + ++/* Returned when NOT in tablet mode on some HP Stream x360 11 models */ ++#define VGBS_TABLET_MODE_FLAG_ALT 0x10 + /* When NOT in tablet mode, VGBS returns with the flag 0x40 */ +-#define TABLET_MODE_FLAG 0x40 +-#define DOCK_MODE_FLAG 0x80 ++#define VGBS_TABLET_MODE_FLAG 0x40 ++#define VGBS_DOCK_MODE_FLAG 0x80 ++ ++#define VGBS_TABLET_MODE_FLAGS (VGBS_TABLET_MODE_FLAG | VGBS_TABLET_MODE_FLAG_ALT) + + MODULE_LICENSE("GPL"); + MODULE_AUTHOR("AceLan Kao"); +@@ -72,9 +76,9 @@ static void detect_tablet_mode(struct pl + if (ACPI_FAILURE(status)) + return; + +- m = !(vgbs & TABLET_MODE_FLAG); ++ m = !(vgbs & VGBS_TABLET_MODE_FLAGS); + input_report_switch(priv->input_dev, SW_TABLET_MODE, m); +- m = (vgbs & DOCK_MODE_FLAG) ? 1 : 0; ++ m = (vgbs & VGBS_DOCK_MODE_FLAG) ? 1 : 0; + input_report_switch(priv->input_dev, SW_DOCK, m); + } + diff --git a/queue-5.8/platform-x86-intel-vbtn-switch-to-an-allow-list-for-sw_tablet_mode-reporting.patch b/queue-5.8/platform-x86-intel-vbtn-switch-to-an-allow-list-for-sw_tablet_mode-reporting.patch new file mode 100644 index 00000000000..3f6ba611190 --- /dev/null +++ b/queue-5.8/platform-x86-intel-vbtn-switch-to-an-allow-list-for-sw_tablet_mode-reporting.patch @@ -0,0 +1,130 @@ +From 8169bd3e6e193497cab781acddcff8fde5d0c416 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 30 Sep 2020 15:19:05 +0200 +Subject: platform/x86: intel-vbtn: Switch to an allow-list for SW_TABLET_MODE reporting +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Hans de Goede + +commit 8169bd3e6e193497cab781acddcff8fde5d0c416 upstream. + +2 recent commits: +cfae58ed681c ("platform/x86: intel-vbtn: Only blacklist SW_TABLET_MODE +on the 9 / "Laptop" chasis-type") +1fac39fd0316 ("platform/x86: intel-vbtn: Also handle tablet-mode switch on +"Detachable" and "Portable" chassis-types") + +Enabled reporting of SW_TABLET_MODE on more devices since the vbtn ACPI +interface is used by the firmware on some of those devices to report this. + +Testing has shown that unconditionally enabling SW_TABLET_MODE reporting +on all devices with a chassis type of 8 ("Portable") or 10 ("Notebook") +which support the VGBS method is a very bad idea. + +Many of these devices are normal laptops (non 2-in-1) models with a VGBS +which always returns 0, which we translate to SW_TABLET_MODE=1. This in +turn causes userspace (libinput) to suppress events from the builtin +keyboard and touchpad, making the laptop essentially unusable. + +Since the problem of wrongly reporting SW_TABLET_MODE=1 in combination +with libinput, leads to a non-usable system. Where as OTOH many people will +not even notice when SW_TABLET_MODE is not being reported, this commit +changes intel_vbtn_has_switches() to use a DMI based allow-list. + +The new DMI based allow-list matches on the 31 ("Convertible") and +32 ("Detachable") chassis-types, as these clearly are 2-in-1s and +so far if they support the intel-vbtn ACPI interface they all have +properly working SW_TABLET_MODE reporting. + +Besides these 2 generic matches, it also contains model specific matches +for 2-in-1 models which use a different chassis-type and which are known +to have properly working SW_TABLET_MODE reporting. + +This has been tested on the following 2-in-1 devices: + +Dell Venue 11 Pro 7130 vPro +HP Pavilion X2 10-p002nd +HP Stream x360 Convertible PC 11 +Medion E1239T + +Fixes: cfae58ed681c ("platform/x86: intel-vbtn: Only blacklist SW_TABLET_MODE on the 9 / "Laptop" chasis-type") +BugLink: https://forum.manjaro.org/t/keyboard-and-touchpad-only-work-on-kernel-5-6/22668 +BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1175599 +Cc: Barnabás Pőcze +Cc: Takashi Iwai +Signed-off-by: Hans de Goede +Signed-off-by: Andy Shevchenko +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/platform/x86/intel-vbtn.c | 52 +++++++++++++++++++++++++++++++------- + 1 file changed, 43 insertions(+), 9 deletions(-) + +--- a/drivers/platform/x86/intel-vbtn.c ++++ b/drivers/platform/x86/intel-vbtn.c +@@ -171,20 +171,54 @@ static bool intel_vbtn_has_buttons(acpi_ + return ACPI_SUCCESS(status); + } + ++/* ++ * There are several laptops (non 2-in-1) models out there which support VGBS, ++ * but simply always return 0, which we translate to SW_TABLET_MODE=1. This in ++ * turn causes userspace (libinput) to suppress events from the builtin ++ * keyboard and touchpad, making the laptop essentially unusable. ++ * ++ * Since the problem of wrongly reporting SW_TABLET_MODE=1 in combination ++ * with libinput, leads to a non-usable system. Where as OTOH many people will ++ * not even notice when SW_TABLET_MODE is not being reported, a DMI based allow ++ * list is used here. This list mainly matches on the chassis-type of 2-in-1s. ++ * ++ * There are also some 2-in-1s which use the intel-vbtn ACPI interface to report ++ * SW_TABLET_MODE with a chassis-type of 8 ("Portable") or 10 ("Notebook"), ++ * these are matched on a per model basis, since many normal laptops with a ++ * possible broken VGBS ACPI-method also use these chassis-types. ++ */ ++static const struct dmi_system_id dmi_switches_allow_list[] = { ++ { ++ .matches = { ++ DMI_EXACT_MATCH(DMI_CHASSIS_TYPE, "31" /* Convertible */), ++ }, ++ }, ++ { ++ .matches = { ++ DMI_EXACT_MATCH(DMI_CHASSIS_TYPE, "32" /* Detachable */), ++ }, ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Venue 11 Pro 7130"), ++ }, ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "HP Stream x360 Convertible PC 11"), ++ }, ++ }, ++ {} /* Array terminator */ ++}; ++ + static bool intel_vbtn_has_switches(acpi_handle handle) + { +- const char *chassis_type = dmi_get_system_info(DMI_CHASSIS_TYPE); + unsigned long long vgbs; + acpi_status status; + +- /* +- * Some normal laptops have a VGBS method despite being non-convertible +- * and their VGBS method always returns 0, causing detect_tablet_mode() +- * to report SW_TABLET_MODE=1 to userspace, which causes issues. +- * These laptops have a DMI chassis_type of 9 ("Laptop"), do not report +- * switches on any devices with a DMI chassis_type of 9. +- */ +- if (chassis_type && strcmp(chassis_type, "9") == 0) ++ if (!dmi_check_system(dmi_switches_allow_list)) + return false; + + status = acpi_evaluate_integer(handle, "VGBS", NULL, &vgbs); diff --git a/queue-5.8/platform-x86-thinkpad_acpi-initialize-tp_nvram_state-variable.patch b/queue-5.8/platform-x86-thinkpad_acpi-initialize-tp_nvram_state-variable.patch new file mode 100644 index 00000000000..ec3af874ce1 --- /dev/null +++ b/queue-5.8/platform-x86-thinkpad_acpi-initialize-tp_nvram_state-variable.patch @@ -0,0 +1,41 @@ +From 5f38b06db8af3ed6c2fc1b427504ca56fae2eacc Mon Sep 17 00:00:00 2001 +From: Tom Rix +Date: Sun, 13 Sep 2020 12:02:03 -0700 +Subject: platform/x86: thinkpad_acpi: initialize tp_nvram_state variable + +From: Tom Rix + +commit 5f38b06db8af3ed6c2fc1b427504ca56fae2eacc upstream. + +clang static analysis flags this represenative problem +thinkpad_acpi.c:2523:7: warning: Branch condition evaluates + to a garbage value + if (!oldn->mute || + ^~~~~~~~~~~ + +In hotkey_kthread() mute is conditionally set by hotkey_read_nvram() +but unconditionally checked by hotkey_compare_and_issue_event(). +So the tp_nvram_state variable s[2] needs to be initialized. + +Fixes: 01e88f25985d ("ACPI: thinkpad-acpi: add CMOS NVRAM polling for hot keys (v9)") +Signed-off-by: Tom Rix +Reviewed-by: Hans de Goede +Acked-by: mark gross +Signed-off-by: Andy Shevchenko +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/platform/x86/thinkpad_acpi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/platform/x86/thinkpad_acpi.c ++++ b/drivers/platform/x86/thinkpad_acpi.c +@@ -2569,7 +2569,7 @@ static void hotkey_compare_and_issue_eve + */ + static int hotkey_kthread(void *data) + { +- struct tp_nvram_state s[2]; ++ struct tp_nvram_state s[2] = { 0 }; + u32 poll_mask, event_mask; + unsigned int si, so; + unsigned long t; diff --git a/queue-5.8/platform-x86-thinkpad_acpi-re-initialize-acpi-buffer-size-when-reuse.patch b/queue-5.8/platform-x86-thinkpad_acpi-re-initialize-acpi-buffer-size-when-reuse.patch new file mode 100644 index 00000000000..84b3867b13e --- /dev/null +++ b/queue-5.8/platform-x86-thinkpad_acpi-re-initialize-acpi-buffer-size-when-reuse.patch @@ -0,0 +1,37 @@ +From 720ef73d1a239e33c3ad8fac356b9b1348e68aaf Mon Sep 17 00:00:00 2001 +From: Aaron Ma +Date: Sat, 3 Oct 2020 01:09:16 +0800 +Subject: platform/x86: thinkpad_acpi: re-initialize ACPI buffer size when reuse + +From: Aaron Ma + +commit 720ef73d1a239e33c3ad8fac356b9b1348e68aaf upstream. + +Evaluating ACPI _BCL could fail, then ACPI buffer size will be set to 0. +When reuse this ACPI buffer, AE_BUFFER_OVERFLOW will be triggered. + +Re-initialize buffer size will make ACPI evaluate successfully. + +Fixes: 46445b6b896fd ("thinkpad-acpi: fix handle locate for video and query of _BCL") +Signed-off-by: Aaron Ma +Signed-off-by: Andy Shevchenko +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/platform/x86/thinkpad_acpi.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/platform/x86/thinkpad_acpi.c ++++ b/drivers/platform/x86/thinkpad_acpi.c +@@ -6829,8 +6829,10 @@ static int __init tpacpi_query_bcl_level + list_for_each_entry(child, &device->children, node) { + acpi_status status = acpi_evaluate_object(child->handle, "_BCL", + NULL, &buffer); +- if (ACPI_FAILURE(status)) ++ if (ACPI_FAILURE(status)) { ++ buffer.length = ACPI_ALLOCATE_BUFFER; + continue; ++ } + + obj = (union acpi_object *)buffer.pointer; + if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { diff --git a/queue-5.8/r8169-consider-that-phy-reset-may-still-be-in-progress-after-applying-firmware.patch b/queue-5.8/r8169-consider-that-phy-reset-may-still-be-in-progress-after-applying-firmware.patch new file mode 100644 index 00000000000..7ad3d8a1baf --- /dev/null +++ b/queue-5.8/r8169-consider-that-phy-reset-may-still-be-in-progress-after-applying-firmware.patch @@ -0,0 +1,47 @@ +From 47dda78671a3d5cee3fb2229e37997d2ac8a3b54 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 7 Oct 2020 13:34:51 +0200 +Subject: r8169: consider that PHY reset may still be in progress after applying firmware + +From: Heiner Kallweit + +commit 47dda78671a3d5cee3fb2229e37997d2ac8a3b54 upstream. + +Some firmware files trigger a PHY soft reset and don't wait for it to +be finished. PHY register writes directly after applying the firmware +may fail or provide unexpected results therefore. Fix this by waiting +for bit BMCR_RESET to be cleared after applying firmware. + +There's nothing wrong with the referenced change, it's just that the +fix will apply cleanly only after this change. + +Fixes: 89fbd26cca7e ("r8169: fix firmware not resetting tp->ocp_base") +Signed-off-by: Heiner Kallweit +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/realtek/r8169_main.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -2113,11 +2113,18 @@ static void rtl_release_firmware(struct + + void r8169_apply_firmware(struct rtl8169_private *tp) + { ++ int val; ++ + /* TODO: release firmware if rtl_fw_write_firmware signals failure. */ + if (tp->rtl_fw) { + rtl_fw_write_firmware(tp, tp->rtl_fw); + /* At least one firmware doesn't reset tp->ocp_base. */ + tp->ocp_base = OCP_STD_PHY_BASE; ++ ++ /* PHY soft reset may still be in progress */ ++ phy_read_poll_timeout(tp->phydev, MII_BMCR, val, ++ !(val & BMCR_RESET), ++ 50000, 600000, true); + } + } + diff --git a/queue-5.8/series b/queue-5.8/series index 7fee6021ef9..a53a70c0434 100644 --- a/queue-5.8/series +++ b/queue-5.8/series @@ -14,3 +14,12 @@ vhost-don-t-call-access_ok-when-using-iotlb.patch vhost-use-vhost_get_used_size-in-vhost_vring_set_addr.patch usermodehelper-reset-umask-to-default-before-executing-user-process.patch splice-teach-splice-pipe-reading-about-empty-pipe-buffers.patch +platform-olpc-fix-memleak-in-olpc_ec_probe.patch +platform-x86-intel-vbtn-fix-sw_tablet_mode-always-reporting-1-on-the-hp-pavilion-11-x360.patch +platform-x86-thinkpad_acpi-initialize-tp_nvram_state-variable.patch +platform-x86-asus-wmi-fix-sw_tablet_mode-always-reporting-1-on-many-different-models.patch +bpf-fix-sysfs-export-of-empty-btf-section.patch +bpf-prevent-.btf-section-elimination.patch +r8169-consider-that-phy-reset-may-still-be-in-progress-after-applying-firmware.patch +platform-x86-intel-vbtn-switch-to-an-allow-list-for-sw_tablet_mode-reporting.patch +platform-x86-thinkpad_acpi-re-initialize-acpi-buffer-size-when-reuse.patch