From: Greg Kroah-Hartman Date: Mon, 21 Sep 2020 12:28:22 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v4.4.237~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa90f81b9c171ecbb2d229408eb96b7dc42f969f;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: serial-8250_pci-add-realtek-816a-and-816b.patch thunderbolt-retry-drom-read-once-if-parsing-fails.patch x86-boot-compressed-disable-relocation-relaxation.patch --- diff --git a/queue-5.4/serial-8250_pci-add-realtek-816a-and-816b.patch b/queue-5.4/serial-8250_pci-add-realtek-816a-and-816b.patch new file mode 100644 index 00000000000..816961749de --- /dev/null +++ b/queue-5.4/serial-8250_pci-add-realtek-816a-and-816b.patch @@ -0,0 +1,118 @@ +From 3c5a87be170aba8ac40982182f812dcff6ed1ad1 Mon Sep 17 00:00:00 2001 +From: Tobias Diedrich +Date: Mon, 14 Sep 2020 19:36:28 +0200 +Subject: serial: 8250_pci: Add Realtek 816a and 816b + +From: Tobias Diedrich + +commit 3c5a87be170aba8ac40982182f812dcff6ed1ad1 upstream. + +These serial ports are exposed by the OOB-management-engine on +RealManage-enabled network cards (e.g. AMD DASH enabled systems using +Realtek cards). + +Because these have 3 BARs, they fail the "num_iomem <= 1" check in +serial_pci_guess_board. + +I've manually checked the two IOMEM regions and BAR 2 doesn't seem to +respond to reads, but BAR 4 seems to be an MMIO version of the IO ports +(untested). + +With this change, the ports are detected: +0000:02:00.1: ttyS0 at I/O 0x2200 (irq = 82, base_baud = 115200) is a 16550A +0000:02:00.2: ttyS1 at I/O 0x2100 (irq = 55, base_baud = 115200) is a 16550A + +lspci output: +02:00.1 0700: 10ec:816a (rev 0e) (prog-if 02 [16550]) + Subsystem: 17aa:5082 + Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- + Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort+ SERR- +Cc: stable +Link: https://lore.kernel.org/r/20200914173628.GA22508@yamamaya.is-a-geek.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/8250/8250_pci.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/tty/serial/8250/8250_pci.c ++++ b/drivers/tty/serial/8250/8250_pci.c +@@ -5568,6 +5568,17 @@ static const struct pci_device_id serial + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, pbn_wch384_4 }, + ++ /* ++ * Realtek RealManage ++ */ ++ { PCI_VENDOR_ID_REALTEK, 0x816a, ++ PCI_ANY_ID, PCI_ANY_ID, ++ 0, 0, pbn_b0_1_115200 }, ++ ++ { PCI_VENDOR_ID_REALTEK, 0x816b, ++ PCI_ANY_ID, PCI_ANY_ID, ++ 0, 0, pbn_b0_1_115200 }, ++ + /* Fintek PCI serial cards */ + { PCI_DEVICE(0x1c29, 0x1104), .driver_data = pbn_fintek_4 }, + { PCI_DEVICE(0x1c29, 0x1108), .driver_data = pbn_fintek_8 }, diff --git a/queue-5.4/series b/queue-5.4/series index c6a90e16bff..5232e7dd9d0 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -60,3 +60,6 @@ alsa-hda-realtek-the-mic-on-a-redmibook-doesn-t-work.patch percpu-fix-first-chunk-size-calculation-for-populated-bitmap.patch input-trackpoint-add-new-trackpoint-variant-ids.patch input-i8042-add-entroware-proteus-el07r4-to-nomux-and-reset-lists.patch +thunderbolt-retry-drom-read-once-if-parsing-fails.patch +serial-8250_pci-add-realtek-816a-and-816b.patch +x86-boot-compressed-disable-relocation-relaxation.patch diff --git a/queue-5.4/thunderbolt-retry-drom-read-once-if-parsing-fails.patch b/queue-5.4/thunderbolt-retry-drom-read-once-if-parsing-fails.patch new file mode 100644 index 00000000000..effdc0ef8a9 --- /dev/null +++ b/queue-5.4/thunderbolt-retry-drom-read-once-if-parsing-fails.patch @@ -0,0 +1,77 @@ +From f022ff7bf377ca94367be05de61277934d42ea74 Mon Sep 17 00:00:00 2001 +From: Mika Westerberg +Date: Mon, 7 Sep 2020 12:20:36 +0300 +Subject: thunderbolt: Retry DROM read once if parsing fails + +From: Mika Westerberg + +commit f022ff7bf377ca94367be05de61277934d42ea74 upstream. + +Kai-Heng reported that sometimes DROM parsing of ASUS PA27AC Thunderbolt 3 +monitor fails. This makes the driver to fail to add the device so only +DisplayPort tunneling is functional. + +It is not clear what exactly happens but waiting for 100 ms and retrying +the read seems to work this around so we do that here. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=206493 +Reported-by: Kai-Heng Feng +Tested-by: Kai-Heng Feng +Cc: stable@vger.kernel.org +Signed-off-by: Mika Westerberg +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/thunderbolt/eeprom.c | 20 ++++++++++++++++---- + 1 file changed, 16 insertions(+), 4 deletions(-) + +--- a/drivers/thunderbolt/eeprom.c ++++ b/drivers/thunderbolt/eeprom.c +@@ -7,6 +7,7 @@ + */ + + #include ++#include + #include + #include + #include "tb.h" +@@ -386,8 +387,8 @@ static int tb_drom_parse_entries(struct + struct tb_drom_entry_header *entry = (void *) (sw->drom + pos); + if (pos + 1 == drom_size || pos + entry->len > drom_size + || !entry->len) { +- tb_sw_warn(sw, "drom buffer overrun, aborting\n"); +- return -EIO; ++ tb_sw_warn(sw, "DROM buffer overrun\n"); ++ return -EILSEQ; + } + + switch (entry->type) { +@@ -493,7 +494,8 @@ int tb_drom_read(struct tb_switch *sw) + u16 size; + u32 crc; + struct tb_drom_header *header; +- int res; ++ int res, retries = 1; ++ + if (sw->drom) + return 0; + +@@ -581,7 +583,17 @@ parse: + tb_sw_warn(sw, "drom device_rom_revision %#x unknown\n", + header->device_rom_revision); + +- return tb_drom_parse_entries(sw); ++ res = tb_drom_parse_entries(sw); ++ /* If the DROM parsing fails, wait a moment and retry once */ ++ if (res == -EILSEQ && retries--) { ++ tb_sw_warn(sw, "parsing DROM failed, retrying\n"); ++ msleep(100); ++ res = tb_drom_read_n(sw, 0, sw->drom, size); ++ if (!res) ++ goto parse; ++ } ++ ++ return res; + err: + kfree(sw->drom); + sw->drom = NULL; diff --git a/queue-5.4/x86-boot-compressed-disable-relocation-relaxation.patch b/queue-5.4/x86-boot-compressed-disable-relocation-relaxation.patch new file mode 100644 index 00000000000..264efea8791 --- /dev/null +++ b/queue-5.4/x86-boot-compressed-disable-relocation-relaxation.patch @@ -0,0 +1,89 @@ +From 09e43968db40c33a73e9ddbfd937f46d5c334924 Mon Sep 17 00:00:00 2001 +From: Arvind Sankar +Date: Tue, 11 Aug 2020 20:43:08 -0400 +Subject: x86/boot/compressed: Disable relocation relaxation + +From: Arvind Sankar + +commit 09e43968db40c33a73e9ddbfd937f46d5c334924 upstream. + +The x86-64 psABI [0] specifies special relocation types +(R_X86_64_[REX_]GOTPCRELX) for indirection through the Global Offset +Table, semantically equivalent to R_X86_64_GOTPCREL, which the linker +can take advantage of for optimization (relaxation) at link time. This +is supported by LLD and binutils versions 2.26 onwards. + +The compressed kernel is position-independent code, however, when using +LLD or binutils versions before 2.27, it must be linked without the -pie +option. In this case, the linker may optimize certain instructions into +a non-position-independent form, by converting foo@GOTPCREL(%rip) to $foo. + +This potential issue has been present with LLD and binutils-2.26 for a +long time, but it has never manifested itself before now: + +- LLD and binutils-2.26 only relax + movq foo@GOTPCREL(%rip), %reg + to + leaq foo(%rip), %reg + which is still position-independent, rather than + mov $foo, %reg + which is permitted by the psABI when -pie is not enabled. + +- GCC happens to only generate GOTPCREL relocations on mov instructions. + +- CLang does generate GOTPCREL relocations on non-mov instructions, but + when building the compressed kernel, it uses its integrated assembler + (due to the redefinition of KBUILD_CFLAGS dropping -no-integrated-as), + which has so far defaulted to not generating the GOTPCRELX + relocations. + +Nick Desaulniers reports [1,2]: + + "A recent change [3] to a default value of configuration variable + (ENABLE_X86_RELAX_RELOCATIONS OFF -> ON) in LLVM now causes Clang's + integrated assembler to emit R_X86_64_GOTPCRELX/R_X86_64_REX_GOTPCRELX + relocations. LLD will relax instructions with these relocations based + on whether the image is being linked as position independent or not. + When not, then LLD will relax these instructions to use absolute + addressing mode (R_RELAX_GOT_PC_NOPIC). This causes kernels built with + Clang and linked with LLD to fail to boot." + +Patch series [4] is a solution to allow the compressed kernel to be +linked with -pie unconditionally, but even if merged is unlikely to be +backported. As a simple solution that can be applied to stable as well, +prevent the assembler from generating the relaxed relocation types using +the -mrelax-relocations=no option. For ease of backporting, do this +unconditionally. + +[0] https://gitlab.com/x86-psABIs/x86-64-ABI/-/blob/master/x86-64-ABI/linker-optimization.tex#L65 +[1] https://lore.kernel.org/lkml/20200807194100.3570838-1-ndesaulniers@google.com/ +[2] https://github.com/ClangBuiltLinux/linux/issues/1121 +[3] https://reviews.llvm.org/rGc41a18cf61790fc898dcda1055c3efbf442c14c0 +[4] https://lore.kernel.org/lkml/20200731202738.2577854-1-nivedita@alum.mit.edu/ + +Reported-by: Nick Desaulniers +Signed-off-by: Arvind Sankar +Signed-off-by: Ingo Molnar +Tested-by: Nick Desaulniers +Tested-by: Sedat Dilek +Acked-by: Ard Biesheuvel +Reviewed-by: Nick Desaulniers +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20200812004308.1448603-1-nivedita@alum.mit.edu +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/boot/compressed/Makefile | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/x86/boot/compressed/Makefile ++++ b/arch/x86/boot/compressed/Makefile +@@ -38,6 +38,8 @@ KBUILD_CFLAGS += $(call cc-option,-fno-s + KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) + KBUILD_CFLAGS += $(call cc-disable-warning, gnu) + KBUILD_CFLAGS += -Wno-pointer-sign ++# Disable relocation relaxation in case the link is not PIE. ++KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mrelax-relocations=no) + + KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ + GCOV_PROFILE := n