From: Greg Kroah-Hartman Date: Tue, 14 Apr 2020 11:41:15 +0000 (+0200) Subject: 5.6-stable patches X-Git-Tag: v4.19.116~82 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fbe5d8d3b16ff7819b3d197055c2f7046f0a1b85;p=thirdparty%2Fkernel%2Fstable-queue.git 5.6-stable patches added patches: acpi-ec-avoid-printing-confusing-messages-in-acpi_ec_setup.patch acpi-pm-s2idle-refine-active-gpes-check.patch acpi-x86-ignore-unspecified-bit-positions-in-the-acpi-global-lock-field.patch acpica-allow-acpi_any_gpe_status_set-to-skip-one-gpe.patch efi-x86-add-tpm-related-efi-tables-to-unencrypted-mapping-checks.patch nvme-fc-revert-add-module-to-ops-template-to-allow-module-references.patch nvmet-tcp-fix-maxh2cdata-icresp-parameter.patch pci-add-boot-interrupt-quirk-mechanism-for-xeon-chipsets.patch pci-aspm-clear-the-correct-bits-when-enabling-l1-substates.patch pci-endpoint-fix-for-concurrent-memory-allocation-in-ob-address-region.patch pci-pciehp-fix-indefinite-wait-on-sysfs-requests.patch pci-qcom-fix-the-fixup-of-pci_vendor_id_qcom.patch seccomp-add-missing-compat_ioctl-for-notify.patch thermal-devfreq_cooling-inline-all-stubs-for-config_devfreq_thermal-n.patch thermal-int340x_thermal-fix-update-tiger-lake-acpi-device-ids.patch --- diff --git a/queue-5.6/acpi-ec-avoid-printing-confusing-messages-in-acpi_ec_setup.patch b/queue-5.6/acpi-ec-avoid-printing-confusing-messages-in-acpi_ec_setup.patch new file mode 100644 index 00000000000..722693226df --- /dev/null +++ b/queue-5.6/acpi-ec-avoid-printing-confusing-messages-in-acpi_ec_setup.patch @@ -0,0 +1,62 @@ +From c823c17a8ea4db4943152388a0beb9a556715716 Mon Sep 17 00:00:00 2001 +From: "Rafael J. Wysocki" +Date: Thu, 27 Feb 2020 22:51:36 +0100 +Subject: ACPI: EC: Avoid printing confusing messages in acpi_ec_setup() + +From: Rafael J. Wysocki + +commit c823c17a8ea4db4943152388a0beb9a556715716 upstream. + +It doesn't really make sense to pass ec->handle of the ECDT EC to +acpi_handle_info(), because it is set to ACPI_ROOT_OBJECT in +acpi_ec_ecdt_probe(), so rework acpi_ec_setup() to avoid using +acpi_handle_info() for printing messages. + +First, notice that the "Used as first EC" message is not really +useful, because it is immediately followed by a more meaningful one +from either acpi_ec_ecdt_probe() or acpi_ec_dsdt_probe() (the latter +also includes the EC object path), so drop it altogether. + +Second, use pr_info() for printing the EC configuration information. + +While at it, make the code in question avoid printing invalid GPE or +IRQ numbers and make it print the GPE/IRQ information only when the +driver is ready to handle events. + +Fixes: 72c77b7ea9ce ("ACPI / EC: Cleanup first_ec/boot_ec code") +Fixes: 406857f773b0 ("ACPI: EC: add support for hardware-reduced systems") +Cc: 5.5+ # 5.5+ +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/acpi/ec.c | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +--- a/drivers/acpi/ec.c ++++ b/drivers/acpi/ec.c +@@ -1584,14 +1584,19 @@ static int acpi_ec_setup(struct acpi_ec + return ret; + + /* First EC capable of handling transactions */ +- if (!first_ec) { ++ if (!first_ec) + first_ec = ec; +- acpi_handle_info(first_ec->handle, "Used as first EC\n"); ++ ++ pr_info("EC_CMD/EC_SC=0x%lx, EC_DATA=0x%lx\n", ec->command_addr, ++ ec->data_addr); ++ ++ if (test_bit(EC_FLAGS_EVENT_HANDLER_INSTALLED, &ec->flags)) { ++ if (ec->gpe >= 0) ++ pr_info("GPE=0x%x\n", ec->gpe); ++ else ++ pr_info("IRQ=%d\n", ec->irq); + } + +- acpi_handle_info(ec->handle, +- "GPE=0x%x, IRQ=%d, EC_CMD/EC_SC=0x%lx, EC_DATA=0x%lx\n", +- ec->gpe, ec->irq, ec->command_addr, ec->data_addr); + return ret; + } + diff --git a/queue-5.6/acpi-pm-s2idle-refine-active-gpes-check.patch b/queue-5.6/acpi-pm-s2idle-refine-active-gpes-check.patch new file mode 100644 index 00000000000..86efb829d7c --- /dev/null +++ b/queue-5.6/acpi-pm-s2idle-refine-active-gpes-check.patch @@ -0,0 +1,90 @@ +From d5406284ff803a578ca503373624312770319054 Mon Sep 17 00:00:00 2001 +From: "Rafael J. Wysocki" +Date: Wed, 25 Mar 2020 11:55:48 +0100 +Subject: ACPI: PM: s2idle: Refine active GPEs check +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Rafael J. Wysocki + +commit d5406284ff803a578ca503373624312770319054 upstream. + +The check for any active GPEs added by commit fdde0ff8590b ("ACPI: +PM: s2idle: Prevent spurious SCIs from waking up the system") turns +out to be insufficiently precise to prevent some systems from +resuming prematurely due to a spurious EC wakeup, so refine it +by first checking if any GPEs other than the EC GPE are active +and skipping all of the SCIs coming from the EC that do not produce +any genuine wakeup events after processing. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=206629 +Fixes: fdde0ff8590b ("ACPI: PM: s2idle: Prevent spurious SCIs from waking up the system") +Reported-by: Ondřej Caletka +Tested-by: Ondřej Caletka +Cc: 5.4+ # 5.4+ +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/acpi/ec.c | 5 +++++ + drivers/acpi/internal.h | 1 + + drivers/acpi/sleep.c | 19 ++++++++++--------- + 3 files changed, 16 insertions(+), 9 deletions(-) + +--- a/drivers/acpi/ec.c ++++ b/drivers/acpi/ec.c +@@ -2044,6 +2044,11 @@ void acpi_ec_set_gpe_wake_mask(u8 action + acpi_set_gpe_wake_mask(NULL, first_ec->gpe, action); + } + ++bool acpi_ec_other_gpes_active(void) ++{ ++ return acpi_any_gpe_status_set(first_ec ? first_ec->gpe : U32_MAX); ++} ++ + bool acpi_ec_dispatch_gpe(void) + { + u32 ret; +--- a/drivers/acpi/internal.h ++++ b/drivers/acpi/internal.h +@@ -202,6 +202,7 @@ void acpi_ec_remove_query_handler(struct + + #ifdef CONFIG_PM_SLEEP + void acpi_ec_flush_work(void); ++bool acpi_ec_other_gpes_active(void); + bool acpi_ec_dispatch_gpe(void); + #endif + +--- a/drivers/acpi/sleep.c ++++ b/drivers/acpi/sleep.c +@@ -1017,19 +1017,20 @@ static bool acpi_s2idle_wake(void) + return true; + + /* +- * If there are no EC events to process and at least one of the +- * other enabled GPEs is active, the wakeup is regarded as a +- * genuine one. +- * +- * Note that the checks below must be carried out in this order +- * to avoid returning prematurely due to a change of the EC GPE +- * status bit from unset to set between the checks with the +- * status bits of all the other GPEs unset. ++ * If the status bit is set for any enabled GPE other than the ++ * EC one, the wakeup is regarded as a genuine one. + */ +- if (acpi_any_gpe_status_set(U32_MAX) && !acpi_ec_dispatch_gpe()) ++ if (acpi_ec_other_gpes_active()) + return true; + + /* ++ * If the EC GPE status bit has not been set, the wakeup is ++ * regarded as a spurious one. ++ */ ++ if (!acpi_ec_dispatch_gpe()) ++ return false; ++ ++ /* + * Cancel the wakeup and process all pending events in case + * there are any wakeup ones in there. + * diff --git a/queue-5.6/acpi-x86-ignore-unspecified-bit-positions-in-the-acpi-global-lock-field.patch b/queue-5.6/acpi-x86-ignore-unspecified-bit-positions-in-the-acpi-global-lock-field.patch new file mode 100644 index 00000000000..45a0ee952bb --- /dev/null +++ b/queue-5.6/acpi-x86-ignore-unspecified-bit-positions-in-the-acpi-global-lock-field.patch @@ -0,0 +1,41 @@ +From ecb9c790999fd6c5af0f44783bd0217f0b89ec2b Mon Sep 17 00:00:00 2001 +From: Jan Engelhardt +Date: Thu, 5 Mar 2020 13:24:25 +0100 +Subject: acpi/x86: ignore unspecified bit positions in the ACPI global lock field + +From: Jan Engelhardt + +commit ecb9c790999fd6c5af0f44783bd0217f0b89ec2b upstream. + +The value in "new" is constructed from "old" such that all bits defined +as reserved by the ACPI spec[1] are left untouched. But if those bits +do not happen to be all zero, "new < 3" will not evaluate to true. + +The firmware of the laptop(s) Medion MD63490 / Akoya P15648 comes with +garbage inside the "FACS" ACPI table. The starting value is +old=0x4944454d, therefore new=0x4944454e, which is >= 3. Mask off +the reserved bits. + +[1] https://uefi.org/sites/default/files/resources/ACPI_6_2.pdf + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=206553 +Cc: All applicable +Signed-off-by: Jan Engelhardt +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kernel/acpi/boot.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/x86/kernel/acpi/boot.c ++++ b/arch/x86/kernel/acpi/boot.c +@@ -1740,7 +1740,7 @@ int __acpi_acquire_global_lock(unsigned + new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1)); + val = cmpxchg(lock, old, new); + } while (unlikely (val != old)); +- return (new < 3) ? -1 : 0; ++ return ((new & 0x3) < 3) ? -1 : 0; + } + + int __acpi_release_global_lock(unsigned int *lock) diff --git a/queue-5.6/acpica-allow-acpi_any_gpe_status_set-to-skip-one-gpe.patch b/queue-5.6/acpica-allow-acpi_any_gpe_status_set-to-skip-one-gpe.patch new file mode 100644 index 00000000000..f5da676da4b --- /dev/null +++ b/queue-5.6/acpica-allow-acpi_any_gpe_status_set-to-skip-one-gpe.patch @@ -0,0 +1,207 @@ +From 0ce792d660bda990c675eaf14ce09594a9b85cbf Mon Sep 17 00:00:00 2001 +From: "Rafael J. Wysocki" +Date: Wed, 25 Mar 2020 11:54:29 +0100 +Subject: ACPICA: Allow acpi_any_gpe_status_set() to skip one GPE +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Rafael J. Wysocki + +commit 0ce792d660bda990c675eaf14ce09594a9b85cbf upstream. + +The check carried out by acpi_any_gpe_status_set() is not precise enough +for the suspend-to-idle implementation in Linux and in some cases it is +necessary make it skip one GPE (specifically, the EC GPE) from the check +to prevent a race condition leading to a premature system resume from +occurring. + +For this reason, redefine acpi_any_gpe_status_set() to take the number +of a GPE to skip as an argument. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=206629 +Tested-by: Ondřej Caletka +Cc: 5.4+ # 5.4+ +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/acpi/acpica/achware.h | 2 - + drivers/acpi/acpica/evxfgpe.c | 17 ++++++++++----- + drivers/acpi/acpica/hwgpe.c | 47 +++++++++++++++++++++++++++++++++--------- + drivers/acpi/sleep.c | 2 - + include/acpi/acpixf.h | 2 - + 5 files changed, 53 insertions(+), 17 deletions(-) + +--- a/drivers/acpi/acpica/achware.h ++++ b/drivers/acpi/acpica/achware.h +@@ -101,7 +101,7 @@ acpi_status acpi_hw_enable_all_runtime_g + + acpi_status acpi_hw_enable_all_wakeup_gpes(void); + +-u8 acpi_hw_check_all_gpes(void); ++u8 acpi_hw_check_all_gpes(acpi_handle gpe_skip_device, u32 gpe_skip_number); + + acpi_status + acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, +--- a/drivers/acpi/acpica/evxfgpe.c ++++ b/drivers/acpi/acpica/evxfgpe.c +@@ -799,17 +799,19 @@ ACPI_EXPORT_SYMBOL(acpi_enable_all_wakeu + * + * FUNCTION: acpi_any_gpe_status_set + * +- * PARAMETERS: None ++ * PARAMETERS: gpe_skip_number - Number of the GPE to skip + * + * RETURN: Whether or not the status bit is set for any GPE + * +- * DESCRIPTION: Check the status bits of all enabled GPEs and return TRUE if any +- * of them is set or FALSE otherwise. ++ * DESCRIPTION: Check the status bits of all enabled GPEs, except for the one ++ * represented by the "skip" argument, and return TRUE if any of ++ * them is set or FALSE otherwise. + * + ******************************************************************************/ +-u32 acpi_any_gpe_status_set(void) ++u32 acpi_any_gpe_status_set(u32 gpe_skip_number) + { + acpi_status status; ++ acpi_handle gpe_device; + u8 ret; + + ACPI_FUNCTION_TRACE(acpi_any_gpe_status_set); +@@ -819,7 +821,12 @@ u32 acpi_any_gpe_status_set(void) + return (FALSE); + } + +- ret = acpi_hw_check_all_gpes(); ++ status = acpi_get_gpe_device(gpe_skip_number, &gpe_device); ++ if (ACPI_FAILURE(status)) { ++ gpe_device = NULL; ++ } ++ ++ ret = acpi_hw_check_all_gpes(gpe_device, gpe_skip_number); + (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); + + return (ret); +--- a/drivers/acpi/acpica/hwgpe.c ++++ b/drivers/acpi/acpica/hwgpe.c +@@ -444,12 +444,19 @@ acpi_hw_enable_wakeup_gpe_block(struct a + return (AE_OK); + } + ++struct acpi_gpe_block_status_context { ++ struct acpi_gpe_register_info *gpe_skip_register_info; ++ u8 gpe_skip_mask; ++ u8 retval; ++}; ++ + /****************************************************************************** + * + * FUNCTION: acpi_hw_get_gpe_block_status + * + * PARAMETERS: gpe_xrupt_info - GPE Interrupt info + * gpe_block - Gpe Block info ++ * context - GPE list walk context data + * + * RETURN: Success + * +@@ -460,12 +467,13 @@ acpi_hw_enable_wakeup_gpe_block(struct a + static acpi_status + acpi_hw_get_gpe_block_status(struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block, +- void *ret_ptr) ++ void *context) + { ++ struct acpi_gpe_block_status_context *c = context; + struct acpi_gpe_register_info *gpe_register_info; + u64 in_enable, in_status; + acpi_status status; +- u8 *ret = ret_ptr; ++ u8 ret_mask; + u32 i; + + /* Examine each GPE Register within the block */ +@@ -485,7 +493,11 @@ acpi_hw_get_gpe_block_status(struct acpi + continue; + } + +- *ret |= in_enable & in_status; ++ ret_mask = in_enable & in_status; ++ if (ret_mask && c->gpe_skip_register_info == gpe_register_info) { ++ ret_mask &= ~c->gpe_skip_mask; ++ } ++ c->retval |= ret_mask; + } + + return (AE_OK); +@@ -561,24 +573,41 @@ acpi_status acpi_hw_enable_all_wakeup_gp + * + * FUNCTION: acpi_hw_check_all_gpes + * +- * PARAMETERS: None ++ * PARAMETERS: gpe_skip_device - GPE devoce of the GPE to skip ++ * gpe_skip_number - Number of the GPE to skip + * + * RETURN: Combined status of all GPEs + * +- * DESCRIPTION: Check all enabled GPEs in all GPE blocks and return TRUE if the ++ * DESCRIPTION: Check all enabled GPEs in all GPE blocks, except for the one ++ * represented by the "skip" arguments, and return TRUE if the + * status bit is set for at least one of them of FALSE otherwise. + * + ******************************************************************************/ + +-u8 acpi_hw_check_all_gpes(void) ++u8 acpi_hw_check_all_gpes(acpi_handle gpe_skip_device, u32 gpe_skip_number) + { +- u8 ret = 0; ++ struct acpi_gpe_block_status_context context = { ++ .gpe_skip_register_info = NULL, ++ .retval = 0, ++ }; ++ struct acpi_gpe_event_info *gpe_event_info; ++ acpi_cpu_flags flags; + + ACPI_FUNCTION_TRACE(acpi_hw_check_all_gpes); + +- (void)acpi_ev_walk_gpe_list(acpi_hw_get_gpe_block_status, &ret); ++ flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); ++ ++ gpe_event_info = acpi_ev_get_gpe_event_info(gpe_skip_device, ++ gpe_skip_number); ++ if (gpe_event_info) { ++ context.gpe_skip_register_info = gpe_event_info->register_info; ++ context.gpe_skip_mask = acpi_hw_get_gpe_register_bit(gpe_event_info); ++ } ++ ++ acpi_os_release_lock(acpi_gbl_gpe_lock, flags); + +- return (ret != 0); ++ (void)acpi_ev_walk_gpe_list(acpi_hw_get_gpe_block_status, &context); ++ return (context.retval != 0); + } + + #endif /* !ACPI_REDUCED_HARDWARE */ +--- a/drivers/acpi/sleep.c ++++ b/drivers/acpi/sleep.c +@@ -1026,7 +1026,7 @@ static bool acpi_s2idle_wake(void) + * status bit from unset to set between the checks with the + * status bits of all the other GPEs unset. + */ +- if (acpi_any_gpe_status_set() && !acpi_ec_dispatch_gpe()) ++ if (acpi_any_gpe_status_set(U32_MAX) && !acpi_ec_dispatch_gpe()) + return true; + + /* +--- a/include/acpi/acpixf.h ++++ b/include/acpi/acpixf.h +@@ -752,7 +752,7 @@ ACPI_HW_DEPENDENT_RETURN_UINT32(u32 acpi + ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable_all_gpes(void)) + ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_runtime_gpes(void)) + ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_wakeup_gpes(void)) +-ACPI_HW_DEPENDENT_RETURN_UINT32(u32 acpi_any_gpe_status_set(void)) ++ACPI_HW_DEPENDENT_RETURN_UINT32(u32 acpi_any_gpe_status_set(u32 gpe_skip_number)) + ACPI_HW_DEPENDENT_RETURN_UINT32(u32 acpi_any_fixed_event_status_set(void)) + + ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status diff --git a/queue-5.6/efi-x86-add-tpm-related-efi-tables-to-unencrypted-mapping-checks.patch b/queue-5.6/efi-x86-add-tpm-related-efi-tables-to-unencrypted-mapping-checks.patch new file mode 100644 index 00000000000..ff782870d16 --- /dev/null +++ b/queue-5.6/efi-x86-add-tpm-related-efi-tables-to-unencrypted-mapping-checks.patch @@ -0,0 +1,45 @@ +From f10e80a19b07b58fc2adad7945f8313b01503bae Mon Sep 17 00:00:00 2001 +From: Tom Lendacky +Date: Fri, 28 Feb 2020 13:14:03 +0100 +Subject: efi/x86: Add TPM related EFI tables to unencrypted mapping checks + +From: Tom Lendacky + +commit f10e80a19b07b58fc2adad7945f8313b01503bae upstream. + +When booting with SME active, EFI tables must be mapped unencrypted since +they were built by UEFI in unencrypted memory. Update the list of tables +to be checked during early_memremap() processing to account for the EFI +TPM tables. + +This fixes a bug where an EFI TPM log table has been created by UEFI, but +it lives in memory that has been marked as usable rather than reserved. + +Signed-off-by: Tom Lendacky +Signed-off-by: Ard Biesheuvel +Signed-off-by: Ingo Molnar +Cc: linux-efi@vger.kernel.org +Cc: Ingo Molnar +Cc: Thomas Gleixner +Cc: David Hildenbrand +Cc: Heinrich Schuchardt +Cc: # v5.4+ +Link: https://lore.kernel.org/r/4144cd813f113c20cdfa511cf59500a64e6015be.1582662842.git.thomas.lendacky@amd.com +Link: https://lore.kernel.org/r/20200228121408.9075-2-ardb@kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/platform/efi/efi.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/x86/platform/efi/efi.c ++++ b/arch/x86/platform/efi/efi.c +@@ -85,6 +85,8 @@ static const unsigned long * const efi_t + #ifdef CONFIG_EFI_RCI2_TABLE + &rci2_table_phys, + #endif ++ &efi.tpm_log, ++ &efi.tpm_final_log, + }; + + u64 efi_setup; /* efi setup_data physical address */ diff --git a/queue-5.6/nvme-fc-revert-add-module-to-ops-template-to-allow-module-references.patch b/queue-5.6/nvme-fc-revert-add-module-to-ops-template-to-allow-module-references.patch new file mode 100644 index 00000000000..6621a12a9e0 --- /dev/null +++ b/queue-5.6/nvme-fc-revert-add-module-to-ops-template-to-allow-module-references.patch @@ -0,0 +1,136 @@ +From 8c5c660529209a0e324c1c1a35ce3f83d67a2aa5 Mon Sep 17 00:00:00 2001 +From: James Smart +Date: Fri, 3 Apr 2020 07:33:20 -0700 +Subject: nvme-fc: Revert "add module to ops template to allow module references" + +From: James Smart + +commit 8c5c660529209a0e324c1c1a35ce3f83d67a2aa5 upstream. + +The original patch was to resolve the lldd being able to be unloaded +while being used to talk to the boot device of the system. However, the +end result of the original patch is that any driver unload while a nvme +controller is live via the lldd is now being prohibited. Given the module +reference, the module teardown routine can't be called, thus there's no +way, other than manual actions to terminate the controllers. + +Fixes: 863fbae929c7 ("nvme_fc: add module to ops template to allow module references") +Cc: # v5.4+ +Signed-off-by: James Smart +Reviewed-by: Himanshu Madhani +Signed-off-by: Christoph Hellwig +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/nvme/host/fc.c | 14 ++------------ + drivers/nvme/target/fcloop.c | 1 - + drivers/scsi/lpfc/lpfc_nvme.c | 2 -- + drivers/scsi/qla2xxx/qla_nvme.c | 1 - + include/linux/nvme-fc-driver.h | 4 ---- + 5 files changed, 2 insertions(+), 20 deletions(-) + +--- a/drivers/nvme/host/fc.c ++++ b/drivers/nvme/host/fc.c +@@ -342,8 +342,7 @@ nvme_fc_register_localport(struct nvme_f + !template->ls_req || !template->fcp_io || + !template->ls_abort || !template->fcp_abort || + !template->max_hw_queues || !template->max_sgl_segments || +- !template->max_dif_sgl_segments || !template->dma_boundary || +- !template->module) { ++ !template->max_dif_sgl_segments || !template->dma_boundary) { + ret = -EINVAL; + goto out_reghost_failed; + } +@@ -2016,7 +2015,6 @@ nvme_fc_ctrl_free(struct kref *ref) + { + struct nvme_fc_ctrl *ctrl = + container_of(ref, struct nvme_fc_ctrl, ref); +- struct nvme_fc_lport *lport = ctrl->lport; + unsigned long flags; + + if (ctrl->ctrl.tagset) { +@@ -2043,7 +2041,6 @@ nvme_fc_ctrl_free(struct kref *ref) + if (ctrl->ctrl.opts) + nvmf_free_options(ctrl->ctrl.opts); + kfree(ctrl); +- module_put(lport->ops->module); + } + + static void +@@ -3074,15 +3071,10 @@ nvme_fc_init_ctrl(struct device *dev, st + goto out_fail; + } + +- if (!try_module_get(lport->ops->module)) { +- ret = -EUNATCH; +- goto out_free_ctrl; +- } +- + idx = ida_simple_get(&nvme_fc_ctrl_cnt, 0, 0, GFP_KERNEL); + if (idx < 0) { + ret = -ENOSPC; +- goto out_mod_put; ++ goto out_free_ctrl; + } + + ctrl->ctrl.opts = opts; +@@ -3235,8 +3227,6 @@ out_free_queues: + out_free_ida: + put_device(ctrl->dev); + ida_simple_remove(&nvme_fc_ctrl_cnt, ctrl->cnum); +-out_mod_put: +- module_put(lport->ops->module); + out_free_ctrl: + kfree(ctrl); + out_fail: +--- a/drivers/nvme/target/fcloop.c ++++ b/drivers/nvme/target/fcloop.c +@@ -850,7 +850,6 @@ fcloop_targetport_delete(struct nvmet_fc + #define FCLOOP_DMABOUND_4G 0xFFFFFFFF + + static struct nvme_fc_port_template fctemplate = { +- .module = THIS_MODULE, + .localport_delete = fcloop_localport_delete, + .remoteport_delete = fcloop_remoteport_delete, + .create_queue = fcloop_create_queue, +--- a/drivers/scsi/lpfc/lpfc_nvme.c ++++ b/drivers/scsi/lpfc/lpfc_nvme.c +@@ -1985,8 +1985,6 @@ out_unlock: + + /* Declare and initialization an instance of the FC NVME template. */ + static struct nvme_fc_port_template lpfc_nvme_template = { +- .module = THIS_MODULE, +- + /* initiator-based functions */ + .localport_delete = lpfc_nvme_localport_delete, + .remoteport_delete = lpfc_nvme_remoteport_delete, +--- a/drivers/scsi/qla2xxx/qla_nvme.c ++++ b/drivers/scsi/qla2xxx/qla_nvme.c +@@ -610,7 +610,6 @@ static void qla_nvme_remoteport_delete(s + } + + static struct nvme_fc_port_template qla_nvme_fc_transport = { +- .module = THIS_MODULE, + .localport_delete = qla_nvme_localport_delete, + .remoteport_delete = qla_nvme_remoteport_delete, + .create_queue = qla_nvme_alloc_queue, +--- a/include/linux/nvme-fc-driver.h ++++ b/include/linux/nvme-fc-driver.h +@@ -270,8 +270,6 @@ struct nvme_fc_remote_port { + * + * Host/Initiator Transport Entrypoints/Parameters: + * +- * @module: The LLDD module using the interface +- * + * @localport_delete: The LLDD initiates deletion of a localport via + * nvme_fc_deregister_localport(). However, the teardown is + * asynchronous. This routine is called upon the completion of the +@@ -385,8 +383,6 @@ struct nvme_fc_remote_port { + * Value is Mandatory. Allowed to be zero. + */ + struct nvme_fc_port_template { +- struct module *module; +- + /* initiator-based functions */ + void (*localport_delete)(struct nvme_fc_local_port *); + void (*remoteport_delete)(struct nvme_fc_remote_port *); diff --git a/queue-5.6/nvmet-tcp-fix-maxh2cdata-icresp-parameter.patch b/queue-5.6/nvmet-tcp-fix-maxh2cdata-icresp-parameter.patch new file mode 100644 index 00000000000..fa439e5a7fa --- /dev/null +++ b/queue-5.6/nvmet-tcp-fix-maxh2cdata-icresp-parameter.patch @@ -0,0 +1,34 @@ +From 9cda34e37489244a8c8628617e24b2dbc8a8edad Mon Sep 17 00:00:00 2001 +From: Sagi Grimberg +Date: Tue, 25 Feb 2020 16:42:27 -0800 +Subject: nvmet-tcp: fix maxh2cdata icresp parameter + +From: Sagi Grimberg + +commit 9cda34e37489244a8c8628617e24b2dbc8a8edad upstream. + +MAXH2CDATA is not zero based. Also no reason to limit ourselves to +1M transfers as we can do more easily. Make this an arbitrary limit +of 16M. + +Reported-by: Wenhua Liu +Cc: stable@vger.kernel.org # v5.0+ +Signed-off-by: Sagi Grimberg +Signed-off-by: Keith Busch +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/nvme/target/tcp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvme/target/tcp.c ++++ b/drivers/nvme/target/tcp.c +@@ -794,7 +794,7 @@ static int nvmet_tcp_handle_icreq(struct + icresp->hdr.pdo = 0; + icresp->hdr.plen = cpu_to_le32(icresp->hdr.hlen); + icresp->pfv = cpu_to_le16(NVME_TCP_PFV_1_0); +- icresp->maxdata = cpu_to_le32(0xffff); /* FIXME: support r2t */ ++ icresp->maxdata = cpu_to_le32(0x400000); /* 16M arbitrary limit */ + icresp->cpda = 0; + if (queue->hdr_digest) + icresp->digest |= NVME_TCP_HDR_DIGEST_ENABLE; diff --git a/queue-5.6/pci-add-boot-interrupt-quirk-mechanism-for-xeon-chipsets.patch b/queue-5.6/pci-add-boot-interrupt-quirk-mechanism-for-xeon-chipsets.patch new file mode 100644 index 00000000000..79d9bdbcb99 --- /dev/null +++ b/queue-5.6/pci-add-boot-interrupt-quirk-mechanism-for-xeon-chipsets.patch @@ -0,0 +1,168 @@ +From b88bf6c3b6ff77948c153cac4e564642b0b90632 Mon Sep 17 00:00:00 2001 +From: Sean V Kelley +Date: Thu, 20 Feb 2020 11:29:29 -0800 +Subject: PCI: Add boot interrupt quirk mechanism for Xeon chipsets + +From: Sean V Kelley + +commit b88bf6c3b6ff77948c153cac4e564642b0b90632 upstream. + +The following was observed by Kar Hin Ong with RT patchset: + + Backtrace: + irq 19: nobody cared (try booting with the "irqpoll" option) + CPU: 0 PID: 3329 Comm: irq/34-nipalk Tainted:4.14.87-rt49 #1 + Hardware name: National Instruments NI PXIe-8880/NI PXIe-8880, + BIOS 2.1.5f1 01/09/2020 + Call Trace: + + ? dump_stack+0x46/0x5e + ? __report_bad_irq+0x2e/0xb0 + ? note_interrupt+0x242/0x290 + ? nNIKAL100_memoryRead16+0x8/0x10 [nikal] + ? handle_irq_event_percpu+0x55/0x70 + ? handle_irq_event+0x4f/0x80 + ? handle_fasteoi_irq+0x81/0x180 + ? handle_irq+0x1c/0x30 + ? do_IRQ+0x41/0xd0 + ? common_interrupt+0x84/0x84 + + ... + handlers: + [] irq_default_primary_handler threaded + [] usb_hcd_irq + Disabling IRQ #19 + +The problem being that this device is triggering boot interrupts +due to threaded interrupt handling and masking of the IO-APIC. These +boot interrupts are then forwarded on to the legacy PCH's PIRQ lines +where there is no handler present for the device. + +Whenever a PCI device fires interrupt (INTx) to Pin 20 of IOAPIC 2 +(GSI 44), the kernel receives two interrupts: + + 1. Interrupt from Pin 20 of IOAPIC 2 -> Expected + 2. Interrupt from Pin 19 of IOAPIC 1 -> UNEXPECTED + +Quirks for disabling boot interrupts (preferred) or rerouting the +handler exist but do not address these Xeon chipsets' mechanism: +https://lore.kernel.org/lkml/12131949181903-git-send-email-sassmann@suse.de/ + +Add a new mechanism via PCI CFG for those chipsets supporting CIPINTRC +register's dis_intx_rout2ich bit. + +Link: https://lore.kernel.org/r/20200220192930.64820-2-sean.v.kelley@linux.intel.com +Reported-by: Kar Hin Ong +Tested-by: Kar Hin Ong +Signed-off-by: Sean V Kelley +Signed-off-by: Bjorn Helgaas +Reviewed-by: Thomas Gleixner +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pci/quirks.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 73 insertions(+), 7 deletions(-) + +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -1970,26 +1970,92 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_I + /* + * IO-APIC1 on 6300ESB generates boot interrupts, see Intel order no + * 300641-004US, section 5.7.3. ++ * ++ * Core IO on Xeon E5 1600/2600/4600, see Intel order no 326509-003. ++ * Core IO on Xeon E5 v2, see Intel order no 329188-003. ++ * Core IO on Xeon E7 v2, see Intel order no 329595-002. ++ * Core IO on Xeon E5 v3, see Intel order no 330784-003. ++ * Core IO on Xeon E7 v3, see Intel order no 332315-001US. ++ * Core IO on Xeon E5 v4, see Intel order no 333810-002US. ++ * Core IO on Xeon E7 v4, see Intel order no 332315-001US. ++ * Core IO on Xeon D-1500, see Intel order no 332051-001. ++ * Core IO on Xeon Scalable, see Intel order no 610950. + */ +-#define INTEL_6300_IOAPIC_ABAR 0x40 ++#define INTEL_6300_IOAPIC_ABAR 0x40 /* Bus 0, Dev 29, Func 5 */ + #define INTEL_6300_DISABLE_BOOT_IRQ (1<<14) + ++#define INTEL_CIPINTRC_CFG_OFFSET 0x14C /* Bus 0, Dev 5, Func 0 */ ++#define INTEL_CIPINTRC_DIS_INTX_ICH (1<<25) ++ + static void quirk_disable_intel_boot_interrupt(struct pci_dev *dev) + { + u16 pci_config_word; ++ u32 pci_config_dword; + + if (noioapicquirk) + return; + +- pci_read_config_word(dev, INTEL_6300_IOAPIC_ABAR, &pci_config_word); +- pci_config_word |= INTEL_6300_DISABLE_BOOT_IRQ; +- pci_write_config_word(dev, INTEL_6300_IOAPIC_ABAR, pci_config_word); +- ++ switch (dev->device) { ++ case PCI_DEVICE_ID_INTEL_ESB_10: ++ pci_read_config_word(dev, INTEL_6300_IOAPIC_ABAR, ++ &pci_config_word); ++ pci_config_word |= INTEL_6300_DISABLE_BOOT_IRQ; ++ pci_write_config_word(dev, INTEL_6300_IOAPIC_ABAR, ++ pci_config_word); ++ break; ++ case 0x3c28: /* Xeon E5 1600/2600/4600 */ ++ case 0x0e28: /* Xeon E5/E7 V2 */ ++ case 0x2f28: /* Xeon E5/E7 V3,V4 */ ++ case 0x6f28: /* Xeon D-1500 */ ++ case 0x2034: /* Xeon Scalable Family */ ++ pci_read_config_dword(dev, INTEL_CIPINTRC_CFG_OFFSET, ++ &pci_config_dword); ++ pci_config_dword |= INTEL_CIPINTRC_DIS_INTX_ICH; ++ pci_write_config_dword(dev, INTEL_CIPINTRC_CFG_OFFSET, ++ pci_config_dword); ++ break; ++ default: ++ return; ++ } + pci_info(dev, "disabled boot interrupts on device [%04x:%04x]\n", + dev->vendor, dev->device); + } +-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_10, quirk_disable_intel_boot_interrupt); +-DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_10, quirk_disable_intel_boot_interrupt); ++/* ++ * Device 29 Func 5 Device IDs of IO-APIC ++ * containing ABAR—APIC1 Alternate Base Address Register ++ */ ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_10, ++ quirk_disable_intel_boot_interrupt); ++DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_10, ++ quirk_disable_intel_boot_interrupt); ++ ++/* ++ * Device 5 Func 0 Device IDs of Core IO modules/hubs ++ * containing Coherent Interface Protocol Interrupt Control ++ * ++ * Device IDs obtained from volume 2 datasheets of commented ++ * families above. ++ */ ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x3c28, ++ quirk_disable_intel_boot_interrupt); ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0e28, ++ quirk_disable_intel_boot_interrupt); ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2f28, ++ quirk_disable_intel_boot_interrupt); ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x6f28, ++ quirk_disable_intel_boot_interrupt); ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2034, ++ quirk_disable_intel_boot_interrupt); ++DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, 0x3c28, ++ quirk_disable_intel_boot_interrupt); ++DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, 0x0e28, ++ quirk_disable_intel_boot_interrupt); ++DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, 0x2f28, ++ quirk_disable_intel_boot_interrupt); ++DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, 0x6f28, ++ quirk_disable_intel_boot_interrupt); ++DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, 0x2034, ++ quirk_disable_intel_boot_interrupt); + + /* Disable boot interrupts on HT-1000 */ + #define BC_HT1000_FEATURE_REG 0x64 diff --git a/queue-5.6/pci-aspm-clear-the-correct-bits-when-enabling-l1-substates.patch b/queue-5.6/pci-aspm-clear-the-correct-bits-when-enabling-l1-substates.patch new file mode 100644 index 00000000000..c1af625a81c --- /dev/null +++ b/queue-5.6/pci-aspm-clear-the-correct-bits-when-enabling-l1-substates.patch @@ -0,0 +1,42 @@ +From 58a3862a10a317a81097ab0c78aecebabb1704f5 Mon Sep 17 00:00:00 2001 +From: Yicong Yang +Date: Fri, 13 Mar 2020 17:53:47 +0800 +Subject: PCI/ASPM: Clear the correct bits when enabling L1 substates + +From: Yicong Yang + +commit 58a3862a10a317a81097ab0c78aecebabb1704f5 upstream. + +In pcie_config_aspm_l1ss(), we cleared the wrong bits when enabling ASPM L1 +Substates. Instead of the L1.x enable bits (PCI_L1SS_CTL1_L1SS_MASK, 0xf), we +cleared the Link Activation Interrupt Enable bit (PCI_L1SS_CAP_L1_PM_SS, +0x10). + +Clear the L1.x enable bits before writing the new L1.x configuration. + +[bhelgaas: changelog] +Fixes: aeda9adebab8 ("PCI/ASPM: Configure L1 substate settings") +Link: https://lore.kernel.org/r/1584093227-1292-1-git-send-email-yangyicong@hisilicon.com +Signed-off-by: Yicong Yang +Signed-off-by: Bjorn Helgaas +CC: stable@vger.kernel.org # v4.11+ +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pci/pcie/aspm.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/pci/pcie/aspm.c ++++ b/drivers/pci/pcie/aspm.c +@@ -747,9 +747,9 @@ static void pcie_config_aspm_l1ss(struct + + /* Enable what we need to enable */ + pci_clear_and_set_dword(parent, up_cap_ptr + PCI_L1SS_CTL1, +- PCI_L1SS_CAP_L1_PM_SS, val); ++ PCI_L1SS_CTL1_L1SS_MASK, val); + pci_clear_and_set_dword(child, dw_cap_ptr + PCI_L1SS_CTL1, +- PCI_L1SS_CAP_L1_PM_SS, val); ++ PCI_L1SS_CTL1_L1SS_MASK, val); + } + + static void pcie_config_aspm_dev(struct pci_dev *pdev, u32 val) diff --git a/queue-5.6/pci-endpoint-fix-for-concurrent-memory-allocation-in-ob-address-region.patch b/queue-5.6/pci-endpoint-fix-for-concurrent-memory-allocation-in-ob-address-region.patch new file mode 100644 index 00000000000..5496f758eb5 --- /dev/null +++ b/queue-5.6/pci-endpoint-fix-for-concurrent-memory-allocation-in-ob-address-region.patch @@ -0,0 +1,95 @@ +From 04e046ca57ebed3943422dee10eec9e73aec081e Mon Sep 17 00:00:00 2001 +From: Kishon Vijay Abraham I +Date: Mon, 24 Feb 2020 15:23:36 +0530 +Subject: PCI: endpoint: Fix for concurrent memory allocation in OB address region + +From: Kishon Vijay Abraham I + +commit 04e046ca57ebed3943422dee10eec9e73aec081e upstream. + +pci-epc-mem uses a bitmap to manage the Endpoint outbound (OB) address +region. This address region will be shared by multiple endpoint +functions (in the case of multi function endpoint) and it has to be +protected from concurrent access to avoid updating an inconsistent state. + +Use a mutex to protect bitmap updates to prevent the memory +allocation API from returning incorrect addresses. + +Signed-off-by: Kishon Vijay Abraham I +Signed-off-by: Lorenzo Pieralisi +Cc: stable@vger.kernel.org # v4.14+ +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pci/endpoint/pci-epc-mem.c | 10 ++++++++-- + include/linux/pci-epc.h | 3 +++ + 2 files changed, 11 insertions(+), 2 deletions(-) + +--- a/drivers/pci/endpoint/pci-epc-mem.c ++++ b/drivers/pci/endpoint/pci-epc-mem.c +@@ -79,6 +79,7 @@ int __pci_epc_mem_init(struct pci_epc *e + mem->page_size = page_size; + mem->pages = pages; + mem->size = size; ++ mutex_init(&mem->lock); + + epc->mem = mem; + +@@ -122,7 +123,7 @@ void __iomem *pci_epc_mem_alloc_addr(str + phys_addr_t *phys_addr, size_t size) + { + int pageno; +- void __iomem *virt_addr; ++ void __iomem *virt_addr = NULL; + struct pci_epc_mem *mem = epc->mem; + unsigned int page_shift = ilog2(mem->page_size); + int order; +@@ -130,15 +131,18 @@ void __iomem *pci_epc_mem_alloc_addr(str + size = ALIGN(size, mem->page_size); + order = pci_epc_mem_get_order(mem, size); + ++ mutex_lock(&mem->lock); + pageno = bitmap_find_free_region(mem->bitmap, mem->pages, order); + if (pageno < 0) +- return NULL; ++ goto ret; + + *phys_addr = mem->phys_base + ((phys_addr_t)pageno << page_shift); + virt_addr = ioremap(*phys_addr, size); + if (!virt_addr) + bitmap_release_region(mem->bitmap, pageno, order); + ++ret: ++ mutex_unlock(&mem->lock); + return virt_addr; + } + EXPORT_SYMBOL_GPL(pci_epc_mem_alloc_addr); +@@ -164,7 +168,9 @@ void pci_epc_mem_free_addr(struct pci_ep + pageno = (phys_addr - mem->phys_base) >> page_shift; + size = ALIGN(size, mem->page_size); + order = pci_epc_mem_get_order(mem, size); ++ mutex_lock(&mem->lock); + bitmap_release_region(mem->bitmap, pageno, order); ++ mutex_unlock(&mem->lock); + } + EXPORT_SYMBOL_GPL(pci_epc_mem_free_addr); + +--- a/include/linux/pci-epc.h ++++ b/include/linux/pci-epc.h +@@ -71,6 +71,7 @@ struct pci_epc_ops { + * @bitmap: bitmap to manage the PCI address space + * @pages: number of bits representing the address region + * @page_size: size of each page ++ * @lock: mutex to protect bitmap + */ + struct pci_epc_mem { + phys_addr_t phys_base; +@@ -78,6 +79,8 @@ struct pci_epc_mem { + unsigned long *bitmap; + size_t page_size; + int pages; ++ /* mutex to protect against concurrent access for memory allocation*/ ++ struct mutex lock; + }; + + /** diff --git a/queue-5.6/pci-pciehp-fix-indefinite-wait-on-sysfs-requests.patch b/queue-5.6/pci-pciehp-fix-indefinite-wait-on-sysfs-requests.patch new file mode 100644 index 00000000000..aa62e02b5ba --- /dev/null +++ b/queue-5.6/pci-pciehp-fix-indefinite-wait-on-sysfs-requests.patch @@ -0,0 +1,119 @@ +From 3e487d2e4aa466decd226353755c9d423e8fbacc Mon Sep 17 00:00:00 2001 +From: Lukas Wunner +Date: Wed, 18 Mar 2020 12:33:12 +0100 +Subject: PCI: pciehp: Fix indefinite wait on sysfs requests + +From: Lukas Wunner + +commit 3e487d2e4aa466decd226353755c9d423e8fbacc upstream. + +David Hoyer reports that powering pciehp slots up or down via sysfs may +hang: The call to wait_event() in pciehp_sysfs_enable_slot() and +_disable_slot() does not return because ctrl->ist_running remains true. + +This flag, which was introduced by commit 157c1062fcd8 ("PCI: pciehp: Avoid +returning prematurely from sysfs requests"), signifies that the IRQ thread +pciehp_ist() is running. It is set to true at the top of pciehp_ist() and +reset to false at the end. However there are two additional return +statements in pciehp_ist() before which the commit neglected to reset the +flag to false and wake up waiters for the flag. + +That omission opens up the following race when powering up the slot: + +* pciehp_ist() runs because a PCI_EXP_SLTSTA_PDC event was requested + by pciehp_sysfs_enable_slot() + +* pciehp_ist() turns on slot power via the following call stack: + pciehp_handle_presence_or_link_change() -> pciehp_enable_slot() -> + __pciehp_enable_slot() -> board_added() -> pciehp_power_on_slot() + +* after slot power is turned on, the link comes up, resulting in a + PCI_EXP_SLTSTA_DLLSC event + +* the IRQ handler pciehp_isr() stores the event in ctrl->pending_events + and returns IRQ_WAKE_THREAD + +* the IRQ thread is already woken (it's bringing up the slot), but the + genirq code remembers to re-run the IRQ thread after it has finished + (such that it can deal with the new event) by setting IRQTF_RUNTHREAD + via __handle_irq_event_percpu() -> __irq_wake_thread() + +* the IRQ thread removes PCI_EXP_SLTSTA_DLLSC from ctrl->pending_events + via board_added() -> pciehp_check_link_status() in order to deal with + presence and link flaps per commit 6c35a1ac3da6 ("PCI: pciehp: + Tolerate initially unstable link") + +* after pciehp_ist() has successfully brought up the slot, it resets + ctrl->ist_running to false and wakes up the sysfs requester + +* the genirq code re-runs pciehp_ist(), which sets ctrl->ist_running + to true but then returns with IRQ_NONE because ctrl->pending_events + is empty + +* pciehp_sysfs_enable_slot() is finally woken but notices that + ctrl->ist_running is true, hence continues waiting + +The only way to get the hung task going again is to trigger a hotplug +event which brings down the slot, e.g. by yanking out the card. + +The same race exists when powering down the slot because remove_board() +likewise clears link or presence changes in ctrl->pending_events per commit +3943af9d01e9 ("PCI: pciehp: Ignore Link State Changes after powering off a +slot") and thereby may cause a re-run of pciehp_ist() which returns with +IRQ_NONE without resetting ctrl->ist_running to false. + +Fix by adding a goto label before the teardown steps at the end of +pciehp_ist() and jumping to that label from the two return statements which +currently neglect to reset the ctrl->ist_running flag. + +Fixes: 157c1062fcd8 ("PCI: pciehp: Avoid returning prematurely from sysfs requests") +Link: https://lore.kernel.org/r/cca1effa488065cb055120aa01b65719094bdcb5.1584530321.git.lukas@wunner.de +Reported-by: David Hoyer +Signed-off-by: Lukas Wunner +Signed-off-by: Bjorn Helgaas +Reviewed-by: Keith Busch +Cc: stable@vger.kernel.org # v4.19+ +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pci/hotplug/pciehp_hpc.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +--- a/drivers/pci/hotplug/pciehp_hpc.c ++++ b/drivers/pci/hotplug/pciehp_hpc.c +@@ -625,17 +625,15 @@ static irqreturn_t pciehp_ist(int irq, v + if (atomic_fetch_and(~RERUN_ISR, &ctrl->pending_events) & RERUN_ISR) { + ret = pciehp_isr(irq, dev_id); + enable_irq(irq); +- if (ret != IRQ_WAKE_THREAD) { +- pci_config_pm_runtime_put(pdev); +- return ret; +- } ++ if (ret != IRQ_WAKE_THREAD) ++ goto out; + } + + synchronize_hardirq(irq); + events = atomic_xchg(&ctrl->pending_events, 0); + if (!events) { +- pci_config_pm_runtime_put(pdev); +- return IRQ_NONE; ++ ret = IRQ_NONE; ++ goto out; + } + + /* Check Attention Button Pressed */ +@@ -664,10 +662,12 @@ static irqreturn_t pciehp_ist(int irq, v + pciehp_handle_presence_or_link_change(ctrl, events); + up_read(&ctrl->reset_lock); + ++ ret = IRQ_HANDLED; ++out: + pci_config_pm_runtime_put(pdev); + ctrl->ist_running = false; + wake_up(&ctrl->requester); +- return IRQ_HANDLED; ++ return ret; + } + + static int pciehp_poll(void *data) diff --git a/queue-5.6/pci-qcom-fix-the-fixup-of-pci_vendor_id_qcom.patch b/queue-5.6/pci-qcom-fix-the-fixup-of-pci_vendor_id_qcom.patch new file mode 100644 index 00000000000..848d0dcaf15 --- /dev/null +++ b/queue-5.6/pci-qcom-fix-the-fixup-of-pci_vendor_id_qcom.patch @@ -0,0 +1,40 @@ +From 604f3956524a6a53c1e3dd27b4b685b664d181ec Mon Sep 17 00:00:00 2001 +From: Bjorn Andersson +Date: Thu, 26 Dec 2019 17:27:17 -0800 +Subject: PCI: qcom: Fix the fixup of PCI_VENDOR_ID_QCOM + +From: Bjorn Andersson + +commit 604f3956524a6a53c1e3dd27b4b685b664d181ec upstream. + +There exists non-bridge PCIe devices with PCI_VENDOR_ID_QCOM, so limit +the fixup to only affect the relevant PCIe bridges. + +Fixes: 322f03436692 ("PCI: qcom: Use default config space read function") +Signed-off-by: Bjorn Andersson +Signed-off-by: Lorenzo Pieralisi +Acked-by: Stanimir Varbanov +Cc: stable@vger.kernel.org # v5.2+ +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pci/controller/dwc/pcie-qcom.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/pci/controller/dwc/pcie-qcom.c ++++ b/drivers/pci/controller/dwc/pcie-qcom.c +@@ -1439,7 +1439,13 @@ static void qcom_fixup_class(struct pci_ + { + dev->class = PCI_CLASS_BRIDGE_PCI << 8; + } +-DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, PCI_ANY_ID, qcom_fixup_class); ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x0101, qcom_fixup_class); ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x0104, qcom_fixup_class); ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x0106, qcom_fixup_class); ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x0107, qcom_fixup_class); ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x0302, qcom_fixup_class); ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x1000, qcom_fixup_class); ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x1001, qcom_fixup_class); + + static struct platform_driver qcom_pcie_driver = { + .probe = qcom_pcie_probe, diff --git a/queue-5.6/seccomp-add-missing-compat_ioctl-for-notify.patch b/queue-5.6/seccomp-add-missing-compat_ioctl-for-notify.patch new file mode 100644 index 00000000000..5be78d85dfe --- /dev/null +++ b/queue-5.6/seccomp-add-missing-compat_ioctl-for-notify.patch @@ -0,0 +1,34 @@ +From 3db81afd99494a33f1c3839103f0429c8f30cb9d Mon Sep 17 00:00:00 2001 +From: Sven Schnelle +Date: Tue, 10 Mar 2020 13:33:32 +0100 +Subject: seccomp: Add missing compat_ioctl for notify + +From: Sven Schnelle + +commit 3db81afd99494a33f1c3839103f0429c8f30cb9d upstream. + +Executing the seccomp_bpf testsuite under a 64-bit kernel with 32-bit +userland (both s390 and x86) doesn't work because there's no compat_ioctl +handler defined. Add the handler. + +Signed-off-by: Sven Schnelle +Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace") +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20200310123332.42255-1-svens@linux.ibm.com +Signed-off-by: Kees Cook +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/seccomp.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/kernel/seccomp.c ++++ b/kernel/seccomp.c +@@ -1221,6 +1221,7 @@ static const struct file_operations secc + .poll = seccomp_notify_poll, + .release = seccomp_notify_release, + .unlocked_ioctl = seccomp_notify_ioctl, ++ .compat_ioctl = seccomp_notify_ioctl, + }; + + static struct file *init_listener(struct seccomp_filter *filter) diff --git a/queue-5.6/series b/queue-5.6/series index 37b891c1e01..e082bfd046d 100644 --- a/queue-5.6/series +++ b/queue-5.6/series @@ -86,3 +86,18 @@ media-venus-firmware-ignore-secure-call-error-on-first-resume.patch media-hantro-read-be32-words-starting-at-every-fourth-byte.patch media-ti-vpe-cal-fix-disable_irqs-to-only-the-intended-target.patch media-ti-vpe-cal-fix-a-kernel-oops-when-unloading-module.patch +seccomp-add-missing-compat_ioctl-for-notify.patch +acpi-ec-avoid-printing-confusing-messages-in-acpi_ec_setup.patch +acpi-x86-ignore-unspecified-bit-positions-in-the-acpi-global-lock-field.patch +acpica-allow-acpi_any_gpe_status_set-to-skip-one-gpe.patch +acpi-pm-s2idle-refine-active-gpes-check.patch +thermal-int340x_thermal-fix-update-tiger-lake-acpi-device-ids.patch +thermal-devfreq_cooling-inline-all-stubs-for-config_devfreq_thermal-n.patch +nvmet-tcp-fix-maxh2cdata-icresp-parameter.patch +nvme-fc-revert-add-module-to-ops-template-to-allow-module-references.patch +efi-x86-add-tpm-related-efi-tables-to-unencrypted-mapping-checks.patch +pci-pciehp-fix-indefinite-wait-on-sysfs-requests.patch +pci-aspm-clear-the-correct-bits-when-enabling-l1-substates.patch +pci-add-boot-interrupt-quirk-mechanism-for-xeon-chipsets.patch +pci-qcom-fix-the-fixup-of-pci_vendor_id_qcom.patch +pci-endpoint-fix-for-concurrent-memory-allocation-in-ob-address-region.patch diff --git a/queue-5.6/thermal-devfreq_cooling-inline-all-stubs-for-config_devfreq_thermal-n.patch b/queue-5.6/thermal-devfreq_cooling-inline-all-stubs-for-config_devfreq_thermal-n.patch new file mode 100644 index 00000000000..d18355df29e --- /dev/null +++ b/queue-5.6/thermal-devfreq_cooling-inline-all-stubs-for-config_devfreq_thermal-n.patch @@ -0,0 +1,48 @@ +From 3f5b9959041e0db6dacbea80bb833bff5900999f Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Fri, 3 Apr 2020 22:51:33 +0200 +Subject: thermal: devfreq_cooling: inline all stubs for CONFIG_DEVFREQ_THERMAL=n + +From: Martin Blumenstingl + +commit 3f5b9959041e0db6dacbea80bb833bff5900999f upstream. + +When CONFIG_DEVFREQ_THERMAL is disabled all functions except +of_devfreq_cooling_register_power() were already inlined. Also inline +the last function to avoid compile errors when multiple drivers call +of_devfreq_cooling_register_power() when CONFIG_DEVFREQ_THERMAL is not +set. Compilation failed with the following message: + multiple definition of `of_devfreq_cooling_register_power' +(which then lists all usages of of_devfreq_cooling_register_power()) + +Thomas Zimmermann reported this problem [0] on a kernel config with +CONFIG_DRM_LIMA={m,y}, CONFIG_DRM_PANFROST={m,y} and +CONFIG_DEVFREQ_THERMAL=n after both, the lima and panfrost drivers +gained devfreq cooling support. + +[0] https://www.spinics.net/lists/dri-devel/msg252825.html + +Fixes: a76caf55e5b356 ("thermal: Add devfreq cooling") +Cc: stable@vger.kernel.org +Reported-by: Thomas Zimmermann +Signed-off-by: Martin Blumenstingl +Tested-by: Thomas Zimmermann +Signed-off-by: Daniel Lezcano +Link: https://lore.kernel.org/r/20200403205133.1101808-1-martin.blumenstingl@googlemail.com +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/devfreq_cooling.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/include/linux/devfreq_cooling.h ++++ b/include/linux/devfreq_cooling.h +@@ -75,7 +75,7 @@ void devfreq_cooling_unregister(struct t + + #else /* !CONFIG_DEVFREQ_THERMAL */ + +-struct thermal_cooling_device * ++static inline struct thermal_cooling_device * + of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df, + struct devfreq_cooling_power *dfc_power) + { diff --git a/queue-5.6/thermal-int340x_thermal-fix-update-tiger-lake-acpi-device-ids.patch b/queue-5.6/thermal-int340x_thermal-fix-update-tiger-lake-acpi-device-ids.patch new file mode 100644 index 00000000000..efe2f30ca63 --- /dev/null +++ b/queue-5.6/thermal-int340x_thermal-fix-update-tiger-lake-acpi-device-ids.patch @@ -0,0 +1,54 @@ +From 26d8bec1e97ba218b7d82afadca1c049eb75f773 Mon Sep 17 00:00:00 2001 +From: Gayatri Kammela +Date: Fri, 27 Mar 2020 14:28:21 -0700 +Subject: thermal: int340x_thermal: fix: Update Tiger Lake ACPI device IDs + +From: Gayatri Kammela + +commit 26d8bec1e97ba218b7d82afadca1c049eb75f773 upstream. + +Tiger Lake's new unique ACPI device IDs for Intel thermal driver are not +valid because of missing 'C' in the IDs. Fix the IDs by updating them. + +After the update, the new IDs should now look like +INT1040 --> INTC1040 +INT1043 --> INTC1043 + +Fixes: 9b1b5535dfc9 ("thermal: int340x_thermal: Add Tiger Lake ACPI device IDs") +Cc: 5.6+ # 5.6+ +Suggested-by: Srinivas Pandruvada +Signed-off-by: Gayatri Kammela +Acked-by: Zhang Rui +Reviewed-by: Andy Shevchenko +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 2 +- + drivers/thermal/intel/int340x_thermal/int3403_thermal.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c ++++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +@@ -369,8 +369,8 @@ static int int3400_thermal_remove(struct + } + + static const struct acpi_device_id int3400_thermal_match[] = { +- {"INT1040", 0}, + {"INT3400", 0}, ++ {"INTC1040", 0}, + {} + }; + +--- a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c ++++ b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c +@@ -282,8 +282,8 @@ static int int3403_remove(struct platfor + } + + static const struct acpi_device_id int3403_device_ids[] = { +- {"INT1043", 0}, + {"INT3403", 0}, ++ {"INTC1043", 0}, + {"", 0}, + }; + MODULE_DEVICE_TABLE(acpi, int3403_device_ids);