From: Greg Kroah-Hartman Date: Mon, 28 Sep 2020 13:34:27 +0000 (+0200) Subject: 5.8-stable patches X-Git-Tag: v4.4.238~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f2b3c73193ac2ec77d9af4a7c8add18c26076ddd;p=thirdparty%2Fkernel%2Fstable-queue.git 5.8-stable patches added patches: alsa-hda-realtek-couldn-t-detect-mic-if-booting-with-headset-plugged.patch alsa-hda-realtek-enable-front-panel-headset-led-on-lenovo-thinkstation-p520.patch alsa-usb-audio-add-delay-quirk-for-h570e-usb-headsets.patch arch-x86-lib-usercopy_64.c-fix-__copy_user_flushcache-cache-writeback.patch lib-string.c-implement-stpcpy.patch scsi-lpfc-fix-initial-flogi-failure-due-to-bbscn-not-supported.patch x86-ioapic-unbreak-check_timer.patch x86-irq-make-run_on_irqstack_cond-typesafe.patch --- diff --git a/queue-5.8/alsa-hda-realtek-couldn-t-detect-mic-if-booting-with-headset-plugged.patch b/queue-5.8/alsa-hda-realtek-couldn-t-detect-mic-if-booting-with-headset-plugged.patch new file mode 100644 index 00000000000..b3a2f87c81b --- /dev/null +++ b/queue-5.8/alsa-hda-realtek-couldn-t-detect-mic-if-booting-with-headset-plugged.patch @@ -0,0 +1,48 @@ +From 3f74249057827c5f6676c41c18f6be12ce1469ce Mon Sep 17 00:00:00 2001 +From: Hui Wang +Date: Mon, 14 Sep 2020 14:51:18 +0800 +Subject: ALSA: hda/realtek - Couldn't detect Mic if booting with headset plugged + +From: Hui Wang + +commit 3f74249057827c5f6676c41c18f6be12ce1469ce upstream. + +We found a Mic detection issue on many Lenovo laptops, those laptops +belong to differnt models and they have different audio design like +internal mic connects to the codec or PCH, they all have this problem, +the problem is if plugging a headset before powerup/reboot the +machine, after booting up, the headphone could be detected but Mic +couldn't. If we plug out and plug in the headset, both headphone and +Mic could be detected then. + +Through debugging we found the codec on those laptops are same, it is +alc257, and if we don't disable the 3k pulldown in alc256_shutup(), +the issue will be fixed. So far there is no pop noise or power +consumption regression on those laptops after this change. + +Cc: Kailang Yang +Cc: +Signed-off-by: Hui Wang +Link: https://lore.kernel.org/r/20200914065118.19238-1-hui.wang@canonical.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_realtek.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -3419,7 +3419,11 @@ static void alc256_shutup(struct hda_cod + + /* 3k pull low control for Headset jack. */ + /* NOTE: call this before clearing the pin, otherwise codec stalls */ +- alc_update_coef_idx(codec, 0x46, 0, 3 << 12); ++ /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly ++ * when booting with headset plugged. So skip setting it for the codec alc257 ++ */ ++ if (codec->core.vendor_id != 0x10ec0257) ++ alc_update_coef_idx(codec, 0x46, 0, 3 << 12); + + if (!spec->no_shutup_pins) + snd_hda_codec_write(codec, hp_pin, 0, diff --git a/queue-5.8/alsa-hda-realtek-enable-front-panel-headset-led-on-lenovo-thinkstation-p520.patch b/queue-5.8/alsa-hda-realtek-enable-front-panel-headset-led-on-lenovo-thinkstation-p520.patch new file mode 100644 index 00000000000..3e166636c26 --- /dev/null +++ b/queue-5.8/alsa-hda-realtek-enable-front-panel-headset-led-on-lenovo-thinkstation-p520.patch @@ -0,0 +1,55 @@ +From f73bbf639b32acb6b409e188fdde5644b301978f Mon Sep 17 00:00:00 2001 +From: Kai-Heng Feng +Date: Mon, 14 Sep 2020 15:02:29 +0800 +Subject: ALSA: hda/realtek: Enable front panel headset LED on Lenovo ThinkStation P520 + +From: Kai-Heng Feng + +commit f73bbf639b32acb6b409e188fdde5644b301978f upstream. + +On Lenovo P520, the front panel headset LED isn't lit up right now. + +Realtek states that the LED needs to be enabled by ALC233's GPIO2, so +let's do it accordingly to light the LED up. + +Signed-off-by: Kai-Heng Feng +Acked-by: Hui Wang +Cc: +Link: https://lore.kernel.org/r/20200914070231.13192-1-kai.heng.feng@canonical.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_realtek.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6066,6 +6066,7 @@ static void alc_fixup_thinkpad_acpi(stru + #include "hp_x360_helper.c" + + enum { ++ ALC269_FIXUP_GPIO2, + ALC269_FIXUP_SONY_VAIO, + ALC275_FIXUP_SONY_VAIO_GPIO2, + ALC269_FIXUP_DELL_M101Z, +@@ -6247,6 +6248,10 @@ enum { + }; + + static const struct hda_fixup alc269_fixups[] = { ++ [ALC269_FIXUP_GPIO2] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc_fixup_gpio2, ++ }, + [ALC269_FIXUP_SONY_VAIO] = { + .type = HDA_FIXUP_PINCTLS, + .v.pins = (const struct hda_pintbl[]) { +@@ -7066,6 +7071,8 @@ static const struct hda_fixup alc269_fix + [ALC233_FIXUP_LENOVO_MULTI_CODECS] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc233_alc662_fixup_lenovo_dual_codecs, ++ .chained = true, ++ .chain_id = ALC269_FIXUP_GPIO2 + }, + [ALC233_FIXUP_ACER_HEADSET_MIC] = { + .type = HDA_FIXUP_VERBS, diff --git a/queue-5.8/alsa-usb-audio-add-delay-quirk-for-h570e-usb-headsets.patch b/queue-5.8/alsa-usb-audio-add-delay-quirk-for-h570e-usb-headsets.patch new file mode 100644 index 00000000000..69950862896 --- /dev/null +++ b/queue-5.8/alsa-usb-audio-add-delay-quirk-for-h570e-usb-headsets.patch @@ -0,0 +1,40 @@ +From 315c7ad7a701baba28c628c4c5426b3d9617ceed Mon Sep 17 00:00:00 2001 +From: Joakim Tjernlund +Date: Thu, 10 Sep 2020 10:53:28 +0200 +Subject: ALSA: usb-audio: Add delay quirk for H570e USB headsets + +From: Joakim Tjernlund + +commit 315c7ad7a701baba28c628c4c5426b3d9617ceed upstream. + +Needs the same delay as H650e + +Signed-off-by: Joakim Tjernlund +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20200910085328.19188-1-joakim.tjernlund@infinera.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/usb/quirks.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1668,12 +1668,13 @@ void snd_usb_ctl_msg_quirk(struct usb_de + && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) + msleep(20); + +- /* Zoom R16/24, Logitech H650e, Jabra 550a, Kingston HyperX needs a tiny +- * delay here, otherwise requests like get/set frequency return as +- * failed despite actually succeeding. ++ /* Zoom R16/24, Logitech H650e/H570e, Jabra 550a, Kingston HyperX ++ * needs a tiny delay here, otherwise requests like get/set ++ * frequency return as failed despite actually succeeding. + */ + if ((chip->usb_id == USB_ID(0x1686, 0x00dd) || + chip->usb_id == USB_ID(0x046d, 0x0a46) || ++ chip->usb_id == USB_ID(0x046d, 0x0a56) || + chip->usb_id == USB_ID(0x0b0e, 0x0349) || + chip->usb_id == USB_ID(0x0951, 0x16ad)) && + (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) diff --git a/queue-5.8/arch-x86-lib-usercopy_64.c-fix-__copy_user_flushcache-cache-writeback.patch b/queue-5.8/arch-x86-lib-usercopy_64.c-fix-__copy_user_flushcache-cache-writeback.patch new file mode 100644 index 00000000000..a37ecc146e9 --- /dev/null +++ b/queue-5.8/arch-x86-lib-usercopy_64.c-fix-__copy_user_flushcache-cache-writeback.patch @@ -0,0 +1,49 @@ +From a1cd6c2ae47ee10ff21e62475685d5b399e2ed4a Mon Sep 17 00:00:00 2001 +From: Mikulas Patocka +Date: Fri, 25 Sep 2020 21:19:24 -0700 +Subject: arch/x86/lib/usercopy_64.c: fix __copy_user_flushcache() cache writeback + +From: Mikulas Patocka + +commit a1cd6c2ae47ee10ff21e62475685d5b399e2ed4a upstream. + +If we copy less than 8 bytes and if the destination crosses a cache +line, __copy_user_flushcache would invalidate only the first cache line. + +This patch makes it invalidate the second cache line as well. + +Fixes: 0aed55af88345b ("x86, uaccess: introduce copy_from_iter_flushcache for pmem / cache-bypass operations") +Signed-off-by: Mikulas Patocka +Signed-off-by: Andrew Morton +Reviewed-by: Dan Williams +Cc: Jan Kara +Cc: Jeff Moyer +Cc: Ingo Molnar +Cc: Christoph Hellwig +Cc: Toshi Kani +Cc: "H. Peter Anvin" +Cc: Al Viro +Cc: Thomas Gleixner +Cc: Matthew Wilcox +Cc: Ross Zwisler +Cc: Ingo Molnar +Cc: +Link: https://lkml.kernel.org/r/alpine.LRH.2.02.2009161451140.21915@file01.intranet.prod.int.rdu2.redhat.com +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/lib/usercopy_64.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/x86/lib/usercopy_64.c ++++ b/arch/x86/lib/usercopy_64.c +@@ -120,7 +120,7 @@ long __copy_user_flushcache(void *dst, c + */ + if (size < 8) { + if (!IS_ALIGNED(dest, 4) || size != 4) +- clean_cache_range(dst, 1); ++ clean_cache_range(dst, size); + } else { + if (!IS_ALIGNED(dest, 8)) { + dest = ALIGN(dest, boot_cpu_data.x86_clflush_size); diff --git a/queue-5.8/lib-string.c-implement-stpcpy.patch b/queue-5.8/lib-string.c-implement-stpcpy.patch new file mode 100644 index 00000000000..c477548ccea --- /dev/null +++ b/queue-5.8/lib-string.c-implement-stpcpy.patch @@ -0,0 +1,123 @@ +From 1e1b6d63d6340764e00356873e5794225a2a03ea Mon Sep 17 00:00:00 2001 +From: Nick Desaulniers +Date: Fri, 25 Sep 2020 21:19:18 -0700 +Subject: lib/string.c: implement stpcpy + +From: Nick Desaulniers + +commit 1e1b6d63d6340764e00356873e5794225a2a03ea upstream. + +LLVM implemented a recent "libcall optimization" that lowers calls to +`sprintf(dest, "%s", str)` where the return value is used to +`stpcpy(dest, str) - dest`. + +This generally avoids the machinery involved in parsing format strings. +`stpcpy` is just like `strcpy` except it returns the pointer to the new +tail of `dest`. This optimization was introduced into clang-12. + +Implement this so that we don't observe linkage failures due to missing +symbol definitions for `stpcpy`. + +Similar to last year's fire drill with: commit 5f074f3e192f +("lib/string.c: implement a basic bcmp") + +The kernel is somewhere between a "freestanding" environment (no full +libc) and "hosted" environment (many symbols from libc exist with the +same type, function signature, and semantics). + +As Peter Anvin notes, there's not really a great way to inform the +compiler that you're targeting a freestanding environment but would like +to opt-in to some libcall optimizations (see pr/47280 below), rather +than opt-out. + +Arvind notes, -fno-builtin-* behaves slightly differently between GCC +and Clang, and Clang is missing many __builtin_* definitions, which I +consider a bug in Clang and am working on fixing. + +Masahiro summarizes the subtle distinction between compilers justly: + To prevent transformation from foo() into bar(), there are two ways in + Clang to do that; -fno-builtin-foo, and -fno-builtin-bar. There is + only one in GCC; -fno-buitin-foo. + +(Any difference in that behavior in Clang is likely a bug from a missing +__builtin_* definition.) + +Masahiro also notes: + We want to disable optimization from foo() to bar(), + but we may still benefit from the optimization from + foo() into something else. If GCC implements the same transform, we + would run into a problem because it is not -fno-builtin-bar, but + -fno-builtin-foo that disables that optimization. + + In this regard, -fno-builtin-foo would be more future-proof than + -fno-built-bar, but -fno-builtin-foo is still potentially overkill. We + may want to prevent calls from foo() being optimized into calls to + bar(), but we still may want other optimization on calls to foo(). + +It seems that compilers today don't quite provide the fine grain control +over which libcall optimizations pseudo-freestanding environments would +prefer. + +Finally, Kees notes that this interface is unsafe, so we should not +encourage its use. As such, I've removed the declaration from any +header, but it still needs to be exported to avoid linkage errors in +modules. + +Reported-by: Sami Tolvanen +Suggested-by: Andy Lavr +Suggested-by: Arvind Sankar +Suggested-by: Joe Perches +Suggested-by: Kees Cook +Suggested-by: Masahiro Yamada +Suggested-by: Rasmus Villemoes +Signed-off-by: Nick Desaulniers +Signed-off-by: Andrew Morton +Tested-by: Nathan Chancellor +Cc: +Link: https://lkml.kernel.org/r/20200914161643.938408-1-ndesaulniers@google.com +Link: https://bugs.llvm.org/show_bug.cgi?id=47162 +Link: https://bugs.llvm.org/show_bug.cgi?id=47280 +Link: https://github.com/ClangBuiltLinux/linux/issues/1126 +Link: https://man7.org/linux/man-pages/man3/stpcpy.3.html +Link: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stpcpy.html +Link: https://reviews.llvm.org/D85963 +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + lib/string.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +--- a/lib/string.c ++++ b/lib/string.c +@@ -272,6 +272,30 @@ ssize_t strscpy_pad(char *dest, const ch + } + EXPORT_SYMBOL(strscpy_pad); + ++/** ++ * stpcpy - copy a string from src to dest returning a pointer to the new end ++ * of dest, including src's %NUL-terminator. May overrun dest. ++ * @dest: pointer to end of string being copied into. Must be large enough ++ * to receive copy. ++ * @src: pointer to the beginning of string being copied from. Must not overlap ++ * dest. ++ * ++ * stpcpy differs from strcpy in a key way: the return value is a pointer ++ * to the new %NUL-terminating character in @dest. (For strcpy, the return ++ * value is a pointer to the start of @dest). This interface is considered ++ * unsafe as it doesn't perform bounds checking of the inputs. As such it's ++ * not recommended for usage. Instead, its definition is provided in case ++ * the compiler lowers other libcalls to stpcpy. ++ */ ++char *stpcpy(char *__restrict__ dest, const char *__restrict__ src); ++char *stpcpy(char *__restrict__ dest, const char *__restrict__ src) ++{ ++ while ((*dest++ = *src++) != '\0') ++ /* nothing */; ++ return --dest; ++} ++EXPORT_SYMBOL(stpcpy); ++ + #ifndef __HAVE_ARCH_STRCAT + /** + * strcat - Append one %NUL-terminated string to another diff --git a/queue-5.8/scsi-lpfc-fix-initial-flogi-failure-due-to-bbscn-not-supported.patch b/queue-5.8/scsi-lpfc-fix-initial-flogi-failure-due-to-bbscn-not-supported.patch new file mode 100644 index 00000000000..53ce57b9c9f --- /dev/null +++ b/queue-5.8/scsi-lpfc-fix-initial-flogi-failure-due-to-bbscn-not-supported.patch @@ -0,0 +1,173 @@ +From 7f04839ec4483563f38062b4dd90253e45447198 Mon Sep 17 00:00:00 2001 +From: James Smart +Date: Fri, 11 Sep 2020 13:01:47 -0700 +Subject: scsi: lpfc: Fix initial FLOGI failure due to BBSCN not supported + +From: James Smart + +commit 7f04839ec4483563f38062b4dd90253e45447198 upstream. + +Initial FLOGIs are failing with the following message: + + lpfc 0000:13:00.1: 1:(0):0820 FLOGI Failed (x300). BBCredit Not Supported + +In a prior patch, the READ_SPARAM command was re-ordered to post after +CONFIG_LINK as the driver is expected to update the driver's copy of the +service parameters for the FLOGI payload. If the bb-credit recovery feature +is enabled, this is fine. But on adapters were bb-credit recovery isn't +enabled, it would cause the FLOGI to fail. + +Fix by restoring the original command order (READ_SPARAM before +CONFIG_LINK), and after issuing CONFIG_LINK, detect bb-credit recovery +support and reissuing READ_SPARAM to obtain the updated service parameters +(effectively adding in the fix command order). + +[mkp: corrected SHA] + +Link: https://lore.kernel.org/r/20200911200147.110826-1-james.smart@broadcom.com +Fixes: 835214f5d5f5 ("scsi: lpfc: Fix broken Credit Recovery after driver load") +CC: # v5.7+ +Co-developed-by: Dick Kennedy +Signed-off-by: Dick Kennedy +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/lpfc/lpfc_hbadisc.c | 76 ++++++++++++++++++++++++++------------- + 1 file changed, 52 insertions(+), 24 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_hbadisc.c ++++ b/drivers/scsi/lpfc/lpfc_hbadisc.c +@@ -71,6 +71,7 @@ static void lpfc_disc_timeout_handler(st + static void lpfc_disc_flush_list(struct lpfc_vport *vport); + static void lpfc_unregister_fcfi_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *); + static int lpfc_fcf_inuse(struct lpfc_hba *); ++static void lpfc_mbx_cmpl_read_sparam(struct lpfc_hba *, LPFC_MBOXQ_t *); + + void + lpfc_terminate_rport_io(struct fc_rport *rport) +@@ -1138,11 +1139,13 @@ out: + return; + } + +- + void + lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) + { + struct lpfc_vport *vport = pmb->vport; ++ LPFC_MBOXQ_t *sparam_mb; ++ struct lpfc_dmabuf *sparam_mp; ++ int rc; + + if (pmb->u.mb.mbxStatus) + goto out; +@@ -1167,12 +1170,42 @@ lpfc_mbx_cmpl_local_config_link(struct l + } + + /* Start discovery by sending a FLOGI. port_state is identically +- * LPFC_FLOGI while waiting for FLOGI cmpl. Check if sending +- * the FLOGI is being deferred till after MBX_READ_SPARAM completes. ++ * LPFC_FLOGI while waiting for FLOGI cmpl. + */ + if (vport->port_state != LPFC_FLOGI) { +- if (!(phba->hba_flag & HBA_DEFER_FLOGI)) ++ /* Issue MBX_READ_SPARAM to update CSPs before FLOGI if ++ * bb-credit recovery is in place. ++ */ ++ if (phba->bbcredit_support && phba->cfg_enable_bbcr && ++ !(phba->link_flag & LS_LOOPBACK_MODE)) { ++ sparam_mb = mempool_alloc(phba->mbox_mem_pool, ++ GFP_KERNEL); ++ if (!sparam_mb) ++ goto sparam_out; ++ ++ rc = lpfc_read_sparam(phba, sparam_mb, 0); ++ if (rc) { ++ mempool_free(sparam_mb, phba->mbox_mem_pool); ++ goto sparam_out; ++ } ++ sparam_mb->vport = vport; ++ sparam_mb->mbox_cmpl = lpfc_mbx_cmpl_read_sparam; ++ rc = lpfc_sli_issue_mbox(phba, sparam_mb, MBX_NOWAIT); ++ if (rc == MBX_NOT_FINISHED) { ++ sparam_mp = (struct lpfc_dmabuf *) ++ sparam_mb->ctx_buf; ++ lpfc_mbuf_free(phba, sparam_mp->virt, ++ sparam_mp->phys); ++ kfree(sparam_mp); ++ sparam_mb->ctx_buf = NULL; ++ mempool_free(sparam_mb, phba->mbox_mem_pool); ++ goto sparam_out; ++ } ++ ++ phba->hba_flag |= HBA_DEFER_FLOGI; ++ } else { + lpfc_initial_flogi(vport); ++ } + } else { + if (vport->fc_flag & FC_PT2PT) + lpfc_disc_start(vport); +@@ -1184,6 +1217,7 @@ out: + "0306 CONFIG_LINK mbxStatus error x%x " + "HBA state x%x\n", + pmb->u.mb.mbxStatus, vport->port_state); ++sparam_out: + mempool_free(pmb, phba->mbox_mem_pool); + + lpfc_linkdown(phba); +@@ -3239,21 +3273,6 @@ lpfc_mbx_process_link_up(struct lpfc_hba + lpfc_linkup(phba); + sparam_mbox = NULL; + +- if (!(phba->hba_flag & HBA_FCOE_MODE)) { +- cfglink_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); +- if (!cfglink_mbox) +- goto out; +- vport->port_state = LPFC_LOCAL_CFG_LINK; +- lpfc_config_link(phba, cfglink_mbox); +- cfglink_mbox->vport = vport; +- cfglink_mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link; +- rc = lpfc_sli_issue_mbox(phba, cfglink_mbox, MBX_NOWAIT); +- if (rc == MBX_NOT_FINISHED) { +- mempool_free(cfglink_mbox, phba->mbox_mem_pool); +- goto out; +- } +- } +- + sparam_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); + if (!sparam_mbox) + goto out; +@@ -3274,7 +3293,20 @@ lpfc_mbx_process_link_up(struct lpfc_hba + goto out; + } + +- if (phba->hba_flag & HBA_FCOE_MODE) { ++ if (!(phba->hba_flag & HBA_FCOE_MODE)) { ++ cfglink_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); ++ if (!cfglink_mbox) ++ goto out; ++ vport->port_state = LPFC_LOCAL_CFG_LINK; ++ lpfc_config_link(phba, cfglink_mbox); ++ cfglink_mbox->vport = vport; ++ cfglink_mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link; ++ rc = lpfc_sli_issue_mbox(phba, cfglink_mbox, MBX_NOWAIT); ++ if (rc == MBX_NOT_FINISHED) { ++ mempool_free(cfglink_mbox, phba->mbox_mem_pool); ++ goto out; ++ } ++ } else { + vport->port_state = LPFC_VPORT_UNKNOWN; + /* + * Add the driver's default FCF record at FCF index 0 now. This +@@ -3331,10 +3363,6 @@ lpfc_mbx_process_link_up(struct lpfc_hba + } + /* Reset FCF roundrobin bmask for new discovery */ + lpfc_sli4_clear_fcf_rr_bmask(phba); +- } else { +- if (phba->bbcredit_support && phba->cfg_enable_bbcr && +- !(phba->link_flag & LS_LOOPBACK_MODE)) +- phba->hba_flag |= HBA_DEFER_FLOGI; + } + + /* Prepare for LINK up registrations */ diff --git a/queue-5.8/series b/queue-5.8/series index 0f4baabc15d..0a40139f3b1 100644 --- a/queue-5.8/series +++ b/queue-5.8/series @@ -69,3 +69,11 @@ spi-bcm-qspi-fix-probe-regression-on-iproc-platforms.patch kvm-x86-reset-mmu-context-if-guest-toggles-cr4.smap-.patch kvm-svm-add-a-dedicated-invd-intercept-routine.patch mm-validate-pmd-after-splitting.patch +arch-x86-lib-usercopy_64.c-fix-__copy_user_flushcache-cache-writeback.patch +x86-irq-make-run_on_irqstack_cond-typesafe.patch +x86-ioapic-unbreak-check_timer.patch +scsi-lpfc-fix-initial-flogi-failure-due-to-bbscn-not-supported.patch +alsa-usb-audio-add-delay-quirk-for-h570e-usb-headsets.patch +alsa-hda-realtek-couldn-t-detect-mic-if-booting-with-headset-plugged.patch +alsa-hda-realtek-enable-front-panel-headset-led-on-lenovo-thinkstation-p520.patch +lib-string.c-implement-stpcpy.patch diff --git a/queue-5.8/x86-ioapic-unbreak-check_timer.patch b/queue-5.8/x86-ioapic-unbreak-check_timer.patch new file mode 100644 index 00000000000..ce11dd1f90d --- /dev/null +++ b/queue-5.8/x86-ioapic-unbreak-check_timer.patch @@ -0,0 +1,72 @@ +From 86a82ae0b5095ea24c55898a3f025791e7958b21 Mon Sep 17 00:00:00 2001 +From: Thomas Gleixner +Date: Wed, 23 Sep 2020 17:46:20 +0200 +Subject: x86/ioapic: Unbreak check_timer() + +From: Thomas Gleixner + +commit 86a82ae0b5095ea24c55898a3f025791e7958b21 upstream. + +Several people reported in the kernel bugzilla that between v4.12 and v4.13 +the magic which works around broken hardware and BIOSes to find the proper +timer interrupt delivery mode stopped working for some older affected +platforms which need to fall back to ExtINT delivery mode. + +The reason is that the core code changed to keep track of the masked and +disabled state of an interrupt line more accurately to avoid the expensive +hardware operations. + +That broke an assumption in i8259_make_irq() which invokes + + disable_irq_nosync(); + irq_set_chip_and_handler(); + enable_irq(); + +Up to v4.12 this worked because enable_irq() unconditionally unmasked the +interrupt line, but after the state tracking improvements this is not +longer the case because the IO/APIC uses lazy disabling. So the line state +is unmasked which means that enable_irq() does not call into the new irq +chip to unmask it. + +In principle this is a shortcoming of the core code, but it's more than +unclear whether the core code should try to reset state. At least this +cannot be done unconditionally as that would break other existing use cases +where the chip type is changed, e.g. when changing the trigger type, but +the callers expect the state to be preserved. + +As the way how check_timer() is switching the delivery modes is truly +unique, the obvious fix is to simply unmask the i8259 manually after +changing the mode to ExtINT delivery and switching the irq chip to the +legacy PIC. + +Note, that the fixes tag is not really precise, but identifies the commit +which broke the assumptions in the IO/APIC and i8259 code and that's the +kernel version to which this needs to be backported. + +Fixes: bf22ff45bed6 ("genirq: Avoid unnecessary low level irq function calls") +Reported-by: p_c_chan@hotmail.com +Reported-by: ecm4@mail.com +Reported-by: perdigao1@yahoo.com +Reported-by: matzes@users.sourceforge.net +Reported-by: rvelascog@gmail.com +Signed-off-by: Thomas Gleixner +Tested-by: p_c_chan@hotmail.com +Tested-by: matzes@users.sourceforge.net +Cc: stable@vger.kernel.org +Link: https://bugzilla.kernel.org/show_bug.cgi?id=197769 +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kernel/apic/io_apic.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/x86/kernel/apic/io_apic.c ++++ b/arch/x86/kernel/apic/io_apic.c +@@ -2243,6 +2243,7 @@ static inline void __init check_timer(vo + legacy_pic->init(0); + legacy_pic->make_irq(0); + apic_write(APIC_LVT0, APIC_DM_EXTINT); ++ legacy_pic->unmask(0); + + unlock_ExtINT_logic(); + diff --git a/queue-5.8/x86-irq-make-run_on_irqstack_cond-typesafe.patch b/queue-5.8/x86-irq-make-run_on_irqstack_cond-typesafe.patch new file mode 100644 index 00000000000..e28425acebe --- /dev/null +++ b/queue-5.8/x86-irq-make-run_on_irqstack_cond-typesafe.patch @@ -0,0 +1,202 @@ +From a7b3474cbb2864d5500d5e4f48dd57c903975cab Mon Sep 17 00:00:00 2001 +From: Thomas Gleixner +Date: Tue, 22 Sep 2020 09:58:52 +0200 +Subject: x86/irq: Make run_on_irqstack_cond() typesafe + +From: Thomas Gleixner + +commit a7b3474cbb2864d5500d5e4f48dd57c903975cab upstream. + +Sami reported that run_on_irqstack_cond() requires the caller to cast +functions to mismatching types, which trips indirect call Control-Flow +Integrity (CFI) in Clang. + +Instead of disabling CFI on that function, provide proper helpers for +the three call variants. The actual ASM code stays the same as that is +out of reach. + + [ bp: Fix __run_on_irqstack() prototype to match. ] + +Fixes: 931b94145981 ("x86/entry: Provide helpers for executing on the irqstack") +Reported-by: Nathan Chancellor +Reported-by: Sami Tolvanen +Signed-off-by: Thomas Gleixner +Signed-off-by: Borislav Petkov +Tested-by: Sami Tolvanen +Cc: +Link: https://github.com/ClangBuiltLinux/linux/issues/1052 +Link: https://lkml.kernel.org/r/87pn6eb5tv.fsf@nanos.tec.linutronix.de +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/entry/common.c | 2 - + arch/x86/entry/entry_64.S | 2 + + arch/x86/include/asm/idtentry.h | 2 - + arch/x86/include/asm/irq_stack.h | 70 ++++++++++++++++++++++++++++++++++----- + arch/x86/kernel/irq.c | 2 - + arch/x86/kernel/irq_64.c | 2 - + 6 files changed, 68 insertions(+), 12 deletions(-) + +--- a/arch/x86/entry/common.c ++++ b/arch/x86/entry/common.c +@@ -814,7 +814,7 @@ __visible noinstr void xen_pv_evtchn_do_ + old_regs = set_irq_regs(regs); + + instrumentation_begin(); +- run_on_irqstack_cond(__xen_pv_evtchn_do_upcall, NULL, regs); ++ run_on_irqstack_cond(__xen_pv_evtchn_do_upcall, regs); + instrumentation_begin(); + + set_irq_regs(old_regs); +--- a/arch/x86/entry/entry_64.S ++++ b/arch/x86/entry/entry_64.S +@@ -687,6 +687,8 @@ SYM_CODE_END(.Lbad_gs) + * rdx: Function argument (can be NULL if none) + */ + SYM_FUNC_START(asm_call_on_stack) ++SYM_INNER_LABEL(asm_call_sysvec_on_stack, SYM_L_GLOBAL) ++SYM_INNER_LABEL(asm_call_irq_on_stack, SYM_L_GLOBAL) + /* + * Save the frame pointer unconditionally. This allows the ORC + * unwinder to handle the stack switch. +--- a/arch/x86/include/asm/idtentry.h ++++ b/arch/x86/include/asm/idtentry.h +@@ -246,7 +246,7 @@ __visible noinstr void func(struct pt_re + instrumentation_begin(); \ + irq_enter_rcu(); \ + kvm_set_cpu_l1tf_flush_l1d(); \ +- run_on_irqstack_cond(__##func, regs, regs); \ ++ run_sysvec_on_irqstack_cond(__##func, regs); \ + irq_exit_rcu(); \ + instrumentation_end(); \ + idtentry_exit_cond_rcu(regs, rcu_exit); \ +--- a/arch/x86/include/asm/irq_stack.h ++++ b/arch/x86/include/asm/irq_stack.h +@@ -3,6 +3,7 @@ + #define _ASM_X86_IRQ_STACK_H + + #include ++#include + + #include + +@@ -12,20 +13,50 @@ static __always_inline bool irqstack_act + return __this_cpu_read(irq_count) != -1; + } + +-void asm_call_on_stack(void *sp, void *func, void *arg); ++void asm_call_on_stack(void *sp, void (*func)(void), void *arg); ++void asm_call_sysvec_on_stack(void *sp, void (*func)(struct pt_regs *regs), ++ struct pt_regs *regs); ++void asm_call_irq_on_stack(void *sp, void (*func)(struct irq_desc *desc), ++ struct irq_desc *desc); + +-static __always_inline void __run_on_irqstack(void *func, void *arg) ++static __always_inline void __run_on_irqstack(void (*func)(void)) + { + void *tos = __this_cpu_read(hardirq_stack_ptr); + + __this_cpu_add(irq_count, 1); +- asm_call_on_stack(tos - 8, func, arg); ++ asm_call_on_stack(tos - 8, func, NULL); ++ __this_cpu_sub(irq_count, 1); ++} ++ ++static __always_inline void ++__run_sysvec_on_irqstack(void (*func)(struct pt_regs *regs), ++ struct pt_regs *regs) ++{ ++ void *tos = __this_cpu_read(hardirq_stack_ptr); ++ ++ __this_cpu_add(irq_count, 1); ++ asm_call_sysvec_on_stack(tos - 8, func, regs); ++ __this_cpu_sub(irq_count, 1); ++} ++ ++static __always_inline void ++__run_irq_on_irqstack(void (*func)(struct irq_desc *desc), ++ struct irq_desc *desc) ++{ ++ void *tos = __this_cpu_read(hardirq_stack_ptr); ++ ++ __this_cpu_add(irq_count, 1); ++ asm_call_irq_on_stack(tos - 8, func, desc); + __this_cpu_sub(irq_count, 1); + } + + #else /* CONFIG_X86_64 */ + static inline bool irqstack_active(void) { return false; } +-static inline void __run_on_irqstack(void *func, void *arg) { } ++static inline void __run_on_irqstack(void (*func)(void)) { } ++static inline void __run_sysvec_on_irqstack(void (*func)(struct pt_regs *regs), ++ struct pt_regs *regs) { } ++static inline void __run_irq_on_irqstack(void (*func)(struct irq_desc *desc), ++ struct irq_desc *desc) { } + #endif /* !CONFIG_X86_64 */ + + static __always_inline bool irq_needs_irq_stack(struct pt_regs *regs) +@@ -37,17 +68,40 @@ static __always_inline bool irq_needs_ir + return !user_mode(regs) && !irqstack_active(); + } + +-static __always_inline void run_on_irqstack_cond(void *func, void *arg, ++ ++static __always_inline void run_on_irqstack_cond(void (*func)(void), + struct pt_regs *regs) + { +- void (*__func)(void *arg) = func; ++ lockdep_assert_irqs_disabled(); ++ ++ if (irq_needs_irq_stack(regs)) ++ __run_on_irqstack(func); ++ else ++ func(); ++} ++ ++static __always_inline void ++run_sysvec_on_irqstack_cond(void (*func)(struct pt_regs *regs), ++ struct pt_regs *regs) ++{ ++ lockdep_assert_irqs_disabled(); + ++ if (irq_needs_irq_stack(regs)) ++ __run_sysvec_on_irqstack(func, regs); ++ else ++ func(regs); ++} ++ ++static __always_inline void ++run_irq_on_irqstack_cond(void (*func)(struct irq_desc *desc), struct irq_desc *desc, ++ struct pt_regs *regs) ++{ + lockdep_assert_irqs_disabled(); + + if (irq_needs_irq_stack(regs)) +- __run_on_irqstack(__func, arg); ++ __run_irq_on_irqstack(func, desc); + else +- __func(arg); ++ func(desc); + } + + #endif +--- a/arch/x86/kernel/irq.c ++++ b/arch/x86/kernel/irq.c +@@ -227,7 +227,7 @@ static __always_inline void handle_irq(s + struct pt_regs *regs) + { + if (IS_ENABLED(CONFIG_X86_64)) +- run_on_irqstack_cond(desc->handle_irq, desc, regs); ++ run_irq_on_irqstack_cond(desc->handle_irq, desc, regs); + else + __handle_irq(desc, regs); + } +--- a/arch/x86/kernel/irq_64.c ++++ b/arch/x86/kernel/irq_64.c +@@ -74,5 +74,5 @@ int irq_init_percpu_irqstack(unsigned in + + void do_softirq_own_stack(void) + { +- run_on_irqstack_cond(__do_softirq, NULL, NULL); ++ run_on_irqstack_cond(__do_softirq, NULL); + }