From: Greg Kroah-Hartman Date: Sun, 17 Dec 2023 17:56:14 +0000 (+0100) Subject: 5.10-stable patches X-Git-Tag: v5.15.144~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4c46c8871522123cdaa2809de6d89f5c89f0f481;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: alsa-hda-hdmi-add-force-connect-quirks-for-asustek-z170-variants.patch alsa-hda-realtek-apply-mute-led-quirk-for-hp15-db.patch cred-switch-to-using-atomic_long_t.patch fuse-dax-set-fc-dax-to-null-in-fuse_dax_conn_free.patch pci-loongson-limit-mrrs-to-256.patch revert-pci-acpiphp-reassign-resources-on-bridge-if-necessary.patch --- diff --git a/queue-5.10/alsa-hda-hdmi-add-force-connect-quirks-for-asustek-z170-variants.patch b/queue-5.10/alsa-hda-hdmi-add-force-connect-quirks-for-asustek-z170-variants.patch new file mode 100644 index 00000000000..061d18420db --- /dev/null +++ b/queue-5.10/alsa-hda-hdmi-add-force-connect-quirks-for-asustek-z170-variants.patch @@ -0,0 +1,43 @@ +From 924f5ca2975b2993ee81a7ecc3c809943a70f334 Mon Sep 17 00:00:00 2001 +From: Kai Vehmanen +Date: Fri, 8 Dec 2023 15:21:27 +0200 +Subject: ALSA: hda/hdmi: add force-connect quirks for ASUSTeK Z170 variants +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Kai Vehmanen + +commit 924f5ca2975b2993ee81a7ecc3c809943a70f334 upstream. + +On ASUSTeK Z170M PLUS and Z170 PRO GAMING systems, the display codec +pins are not registered properly without the force-connect quirk. The +codec will report only one pin as having external connectivity, but i915 +finds all three connectors on the system, so the two drivers are not +in sync. + +Issue found with DRM igt-gpu-tools test kms_hdmi_inject@inject-audio. + +Link: https://gitlab.freedesktop.org/drm/intel/-/issues/9801 +Cc: Ville Syrjälä +Cc: Jani Saarinen +Signed-off-by: Kai Vehmanen +Cc: +Link: https://lore.kernel.org/r/20231208132127.2438067-3-kai.vehmanen@linux.intel.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/hda/patch_hdmi.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/sound/pci/hda/patch_hdmi.c ++++ b/sound/pci/hda/patch_hdmi.c +@@ -1967,6 +1967,8 @@ static const struct snd_pci_quirk force_ + SND_PCI_QUIRK(0x103c, 0x871a, "HP", 1), + SND_PCI_QUIRK(0x103c, 0x8711, "HP", 1), + SND_PCI_QUIRK(0x103c, 0x8715, "HP", 1), ++ SND_PCI_QUIRK(0x1043, 0x86ae, "ASUS", 1), /* Z170 PRO */ ++ SND_PCI_QUIRK(0x1043, 0x86c7, "ASUS", 1), /* Z170M PLUS */ + SND_PCI_QUIRK(0x1462, 0xec94, "MS-7C94", 1), + {} + }; diff --git a/queue-5.10/alsa-hda-realtek-apply-mute-led-quirk-for-hp15-db.patch b/queue-5.10/alsa-hda-realtek-apply-mute-led-quirk-for-hp15-db.patch new file mode 100644 index 00000000000..221ce447e52 --- /dev/null +++ b/queue-5.10/alsa-hda-realtek-apply-mute-led-quirk-for-hp15-db.patch @@ -0,0 +1,34 @@ +From 9b726bf6ae11add6a7a52883a21f90ff9cbca916 Mon Sep 17 00:00:00 2001 +From: Hartmut Knaack +Date: Sat, 9 Dec 2023 15:47:07 +0100 +Subject: ALSA: hda/realtek: Apply mute LED quirk for HP15-db + +From: Hartmut Knaack + +commit 9b726bf6ae11add6a7a52883a21f90ff9cbca916 upstream. + +The HP laptop 15-db0403ng uses the ALC236 codec and controls the mute +LED using COEF 0x07 index 1. +Sound card subsystem: Hewlett-Packard Company Device [103c:84ae] + +Use the existing quirk for this model. + +Signed-off-by: Hartmut Knaack +Cc: +Link: https://lore.kernel.org/r/e61815d0-f1c7-b164-e49d-6ca84771476a@gmx.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/hda/patch_realtek.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8986,6 +8986,7 @@ static const struct snd_pci_quirk alc269 + SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3), + SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3), + SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3), ++ SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2), + SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN), + SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), + SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360), diff --git a/queue-5.10/cred-switch-to-using-atomic_long_t.patch b/queue-5.10/cred-switch-to-using-atomic_long_t.patch new file mode 100644 index 00000000000..cdec30289c9 --- /dev/null +++ b/queue-5.10/cred-switch-to-using-atomic_long_t.patch @@ -0,0 +1,246 @@ +From f8fa5d76925991976b3e7076f9d1052515ec1fca Mon Sep 17 00:00:00 2001 +From: Jens Axboe +Date: Fri, 15 Dec 2023 13:24:10 -0700 +Subject: cred: switch to using atomic_long_t + +From: Jens Axboe + +commit f8fa5d76925991976b3e7076f9d1052515ec1fca upstream. + +There are multiple ways to grab references to credentials, and the only +protection we have against overflowing it is the memory required to do +so. + +With memory sizes only moving in one direction, let's bump the reference +count to 64-bit and move it outside the realm of feasibly overflowing. + +Signed-off-by: Jens Axboe +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/cred.h | 8 +++--- + kernel/cred.c | 64 +++++++++++++++++++++++++-------------------------- + 2 files changed, 36 insertions(+), 36 deletions(-) + +--- a/include/linux/cred.h ++++ b/include/linux/cred.h +@@ -109,7 +109,7 @@ static inline int groups_search(const st + * same context as task->real_cred. + */ + struct cred { +- atomic_t usage; ++ atomic_long_t usage; + #ifdef CONFIG_DEBUG_CREDENTIALS + atomic_t subscribers; /* number of processes subscribed */ + void *put_addr; +@@ -227,7 +227,7 @@ static inline bool cap_ambient_invariant + */ + static inline struct cred *get_new_cred(struct cred *cred) + { +- atomic_inc(&cred->usage); ++ atomic_long_inc(&cred->usage); + return cred; + } + +@@ -259,7 +259,7 @@ static inline const struct cred *get_cre + struct cred *nonconst_cred = (struct cred *) cred; + if (!cred) + return NULL; +- if (!atomic_inc_not_zero(&nonconst_cred->usage)) ++ if (!atomic_long_inc_not_zero(&nonconst_cred->usage)) + return NULL; + validate_creds(cred); + nonconst_cred->non_rcu = 0; +@@ -283,7 +283,7 @@ static inline void put_cred(const struct + + if (cred) { + validate_creds(cred); +- if (atomic_dec_and_test(&(cred)->usage)) ++ if (atomic_long_dec_and_test(&(cred)->usage)) + __put_cred(cred); + } + } +--- a/kernel/cred.c ++++ b/kernel/cred.c +@@ -98,17 +98,17 @@ static void put_cred_rcu(struct rcu_head + + #ifdef CONFIG_DEBUG_CREDENTIALS + if (cred->magic != CRED_MAGIC_DEAD || +- atomic_read(&cred->usage) != 0 || ++ atomic_long_read(&cred->usage) != 0 || + read_cred_subscribers(cred) != 0) + panic("CRED: put_cred_rcu() sees %p with" +- " mag %x, put %p, usage %d, subscr %d\n", ++ " mag %x, put %p, usage %ld, subscr %d\n", + cred, cred->magic, cred->put_addr, +- atomic_read(&cred->usage), ++ atomic_long_read(&cred->usage), + read_cred_subscribers(cred)); + #else +- if (atomic_read(&cred->usage) != 0) +- panic("CRED: put_cred_rcu() sees %p with usage %d\n", +- cred, atomic_read(&cred->usage)); ++ if (atomic_long_read(&cred->usage) != 0) ++ panic("CRED: put_cred_rcu() sees %p with usage %ld\n", ++ cred, atomic_long_read(&cred->usage)); + #endif + + security_cred_free(cred); +@@ -131,11 +131,11 @@ static void put_cred_rcu(struct rcu_head + */ + void __put_cred(struct cred *cred) + { +- kdebug("__put_cred(%p{%d,%d})", cred, +- atomic_read(&cred->usage), ++ kdebug("__put_cred(%p{%ld,%d})", cred, ++ atomic_long_read(&cred->usage), + read_cred_subscribers(cred)); + +- BUG_ON(atomic_read(&cred->usage) != 0); ++ BUG_ON(atomic_long_read(&cred->usage) != 0); + #ifdef CONFIG_DEBUG_CREDENTIALS + BUG_ON(read_cred_subscribers(cred) != 0); + cred->magic = CRED_MAGIC_DEAD; +@@ -158,8 +158,8 @@ void exit_creds(struct task_struct *tsk) + { + struct cred *cred; + +- kdebug("exit_creds(%u,%p,%p,{%d,%d})", tsk->pid, tsk->real_cred, tsk->cred, +- atomic_read(&tsk->cred->usage), ++ kdebug("exit_creds(%u,%p,%p,{%ld,%d})", tsk->pid, tsk->real_cred, tsk->cred, ++ atomic_long_read(&tsk->cred->usage), + read_cred_subscribers(tsk->cred)); + + cred = (struct cred *) tsk->real_cred; +@@ -218,7 +218,7 @@ struct cred *cred_alloc_blank(void) + if (!new) + return NULL; + +- atomic_set(&new->usage, 1); ++ atomic_long_set(&new->usage, 1); + #ifdef CONFIG_DEBUG_CREDENTIALS + new->magic = CRED_MAGIC; + #endif +@@ -265,7 +265,7 @@ struct cred *prepare_creds(void) + memcpy(new, old, sizeof(struct cred)); + + new->non_rcu = 0; +- atomic_set(&new->usage, 1); ++ atomic_long_set(&new->usage, 1); + set_cred_subscribers(new, 0); + get_group_info(new->group_info); + get_uid(new->user); +@@ -348,8 +348,8 @@ int copy_creds(struct task_struct *p, un + p->real_cred = get_cred(p->cred); + get_cred(p->cred); + alter_cred_subscribers(p->cred, 2); +- kdebug("share_creds(%p{%d,%d})", +- p->cred, atomic_read(&p->cred->usage), ++ kdebug("share_creds(%p{%ld,%d})", ++ p->cred, atomic_long_read(&p->cred->usage), + read_cred_subscribers(p->cred)); + atomic_inc(&p->cred->user->processes); + return 0; +@@ -439,8 +439,8 @@ int commit_creds(struct cred *new) + struct task_struct *task = current; + const struct cred *old = task->real_cred; + +- kdebug("commit_creds(%p{%d,%d})", new, +- atomic_read(&new->usage), ++ kdebug("commit_creds(%p{%ld,%d})", new, ++ atomic_long_read(&new->usage), + read_cred_subscribers(new)); + + BUG_ON(task->cred != old); +@@ -449,7 +449,7 @@ int commit_creds(struct cred *new) + validate_creds(old); + validate_creds(new); + #endif +- BUG_ON(atomic_read(&new->usage) < 1); ++ BUG_ON(atomic_long_read(&new->usage) < 1); + + get_cred(new); /* we will require a ref for the subj creds too */ + +@@ -522,14 +522,14 @@ EXPORT_SYMBOL(commit_creds); + */ + void abort_creds(struct cred *new) + { +- kdebug("abort_creds(%p{%d,%d})", new, +- atomic_read(&new->usage), ++ kdebug("abort_creds(%p{%ld,%d})", new, ++ atomic_long_read(&new->usage), + read_cred_subscribers(new)); + + #ifdef CONFIG_DEBUG_CREDENTIALS + BUG_ON(read_cred_subscribers(new) != 0); + #endif +- BUG_ON(atomic_read(&new->usage) < 1); ++ BUG_ON(atomic_long_read(&new->usage) < 1); + put_cred(new); + } + EXPORT_SYMBOL(abort_creds); +@@ -545,8 +545,8 @@ const struct cred *override_creds(const + { + const struct cred *old = current->cred; + +- kdebug("override_creds(%p{%d,%d})", new, +- atomic_read(&new->usage), ++ kdebug("override_creds(%p{%ld,%d})", new, ++ atomic_long_read(&new->usage), + read_cred_subscribers(new)); + + validate_creds(old); +@@ -568,8 +568,8 @@ const struct cred *override_creds(const + rcu_assign_pointer(current->cred, new); + alter_cred_subscribers(old, -1); + +- kdebug("override_creds() = %p{%d,%d}", old, +- atomic_read(&old->usage), ++ kdebug("override_creds() = %p{%ld,%d}", old, ++ atomic_long_read(&old->usage), + read_cred_subscribers(old)); + return old; + } +@@ -586,8 +586,8 @@ void revert_creds(const struct cred *old + { + const struct cred *override = current->cred; + +- kdebug("revert_creds(%p{%d,%d})", old, +- atomic_read(&old->usage), ++ kdebug("revert_creds(%p{%ld,%d})", old, ++ atomic_long_read(&old->usage), + read_cred_subscribers(old)); + + validate_creds(old); +@@ -699,7 +699,7 @@ struct cred *prepare_kernel_cred(struct + + *new = *old; + new->non_rcu = 0; +- atomic_set(&new->usage, 1); ++ atomic_long_set(&new->usage, 1); + set_cred_subscribers(new, 0); + get_uid(new->user); + get_user_ns(new->user_ns); +@@ -809,8 +809,8 @@ static void dump_invalid_creds(const str + cred == tsk->cred ? "[eff]" : ""); + printk(KERN_ERR "CRED: ->magic=%x, put_addr=%p\n", + cred->magic, cred->put_addr); +- printk(KERN_ERR "CRED: ->usage=%d, subscr=%d\n", +- atomic_read(&cred->usage), ++ printk(KERN_ERR "CRED: ->usage=%ld, subscr=%d\n", ++ atomic_long_read(&cred->usage), + read_cred_subscribers(cred)); + printk(KERN_ERR "CRED: ->*uid = { %d,%d,%d,%d }\n", + from_kuid_munged(&init_user_ns, cred->uid), +@@ -882,9 +882,9 @@ EXPORT_SYMBOL(__validate_process_creds); + */ + void validate_creds_for_do_exit(struct task_struct *tsk) + { +- kdebug("validate_creds_for_do_exit(%p,%p{%d,%d})", ++ kdebug("validate_creds_for_do_exit(%p,%p{%ld,%d})", + tsk->real_cred, tsk->cred, +- atomic_read(&tsk->cred->usage), ++ atomic_long_read(&tsk->cred->usage), + read_cred_subscribers(tsk->cred)); + + __validate_process_creds(tsk, __FILE__, __LINE__); diff --git a/queue-5.10/fuse-dax-set-fc-dax-to-null-in-fuse_dax_conn_free.patch b/queue-5.10/fuse-dax-set-fc-dax-to-null-in-fuse_dax_conn_free.patch new file mode 100644 index 00000000000..f1c89770656 --- /dev/null +++ b/queue-5.10/fuse-dax-set-fc-dax-to-null-in-fuse_dax_conn_free.patch @@ -0,0 +1,36 @@ +From 7f8ed28d1401320bcb02dda81b3c23ab2dc5a6d8 Mon Sep 17 00:00:00 2001 +From: Hangyu Hua +Date: Thu, 16 Nov 2023 15:57:26 +0800 +Subject: fuse: dax: set fc->dax to NULL in fuse_dax_conn_free() + +From: Hangyu Hua + +commit 7f8ed28d1401320bcb02dda81b3c23ab2dc5a6d8 upstream. + +fuse_dax_conn_free() will be called when fuse_fill_super_common() fails +after fuse_dax_conn_alloc(). Then deactivate_locked_super() in +virtio_fs_get_tree() will call virtio_kill_sb() to release the discarded +superblock. This will call fuse_dax_conn_free() again in fuse_conn_put(), +resulting in a possible double free. + +Fixes: 1dd539577c42 ("virtiofs: add a mount option to enable dax") +Signed-off-by: Hangyu Hua +Acked-by: Vivek Goyal +Reviewed-by: Jingbo Xu +Cc: # v5.10 +Signed-off-by: Miklos Szeredi +Signed-off-by: Greg Kroah-Hartman +--- + fs/fuse/dax.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/fs/fuse/dax.c ++++ b/fs/fuse/dax.c +@@ -1228,6 +1228,7 @@ void fuse_dax_conn_free(struct fuse_conn + if (fc->dax) { + fuse_free_dax_mem_ranges(&fc->dax->free_ranges); + kfree(fc->dax); ++ fc->dax = NULL; + } + } + diff --git a/queue-5.10/pci-loongson-limit-mrrs-to-256.patch b/queue-5.10/pci-loongson-limit-mrrs-to-256.patch new file mode 100644 index 00000000000..40b4d354eaa --- /dev/null +++ b/queue-5.10/pci-loongson-limit-mrrs-to-256.patch @@ -0,0 +1,106 @@ +From ef61a0405742a9f7f6051bc6fd2f017d87d07911 Mon Sep 17 00:00:00 2001 +From: Jiaxun Yang +Date: Fri, 1 Dec 2023 11:50:28 +0000 +Subject: PCI: loongson: Limit MRRS to 256 + +From: Jiaxun Yang + +commit ef61a0405742a9f7f6051bc6fd2f017d87d07911 upstream. + +This is a partial revert of 8b3517f88ff2 ("PCI: loongson: Prevent LS7A MRRS +increases") for MIPS-based Loongson. + +Some MIPS Loongson systems don't support arbitrary Max_Read_Request_Size +(MRRS) settings. 8b3517f88ff2 ("PCI: loongson: Prevent LS7A MRRS +increases") worked around that by (1) assuming that firmware configured +MRRS to the maximum supported value and (2) preventing the PCI core from +increasing MRRS. + +Unfortunately, some firmware doesn't set that maximum MRRS correctly, which +results in devices not being initialized correctly. One symptom, from the +Debian report below, is this: + + ata4.00: exception Emask 0x0 SAct 0x20000000 SErr 0x0 action 0x6 frozen + ata4.00: failed command: WRITE FPDMA QUEUED + ata4.00: cmd 61/20:e8:00:f0:e1/00:00:00:00:00/40 tag 29 ncq dma 16384 out + res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) + ata4.00: status: { DRDY } + ata4: hard resetting link + +Limit MRRS to 256 because MIPS Loongson with higher MRRS support is +considered rare. + +This must be done at device enablement stage because the MRRS setting may +get lost if PCI_COMMAND_MASTER on the parent bridge is cleared, and we are +only sure parent bridge is enabled at this point. + +Fixes: 8b3517f88ff2 ("PCI: loongson: Prevent LS7A MRRS increases") +Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217680 +Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1035587 +Link: https://lore.kernel.org/r/20231201115028.84351-1-jiaxun.yang@flygoat.com +Signed-off-by: Jiaxun Yang +Signed-off-by: Bjorn Helgaas +Acked-by: Huacai Chen +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/controller/pci-loongson.c | 46 ++++++++++++++++++++++++++++++---- + 1 file changed, 41 insertions(+), 5 deletions(-) + +--- a/drivers/pci/controller/pci-loongson.c ++++ b/drivers/pci/controller/pci-loongson.c +@@ -65,13 +65,49 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LO + DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, + DEV_LS7A_LPC, system_bus_quirk); + ++/* ++ * Some Loongson PCIe ports have hardware limitations on their Maximum Read ++ * Request Size. They can't handle anything larger than this. Sane ++ * firmware will set proper MRRS at boot, so we only need no_inc_mrrs for ++ * bridges. However, some MIPS Loongson firmware doesn't set MRRS properly, ++ * so we have to enforce maximum safe MRRS, which is 256 bytes. ++ */ ++#ifdef CONFIG_MIPS ++static void loongson_set_min_mrrs_quirk(struct pci_dev *pdev) ++{ ++ struct pci_bus *bus = pdev->bus; ++ struct pci_dev *bridge; ++ static const struct pci_device_id bridge_devids[] = { ++ { PCI_VDEVICE(LOONGSON, DEV_LS2K_PCIE_PORT0) }, ++ { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT0) }, ++ { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT1) }, ++ { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT2) }, ++ { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT3) }, ++ { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT4) }, ++ { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT5) }, ++ { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT6) }, ++ { 0, }, ++ }; ++ ++ /* look for the matching bridge */ ++ while (!pci_is_root_bus(bus)) { ++ bridge = bus->self; ++ bus = bus->parent; ++ ++ if (pci_match_id(bridge_devids, bridge)) { ++ if (pcie_get_readrq(pdev) > 256) { ++ pci_info(pdev, "limiting MRRS to 256\n"); ++ pcie_set_readrq(pdev, 256); ++ } ++ break; ++ } ++ } ++} ++DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, loongson_set_min_mrrs_quirk); ++#endif ++ + static void loongson_mrrs_quirk(struct pci_dev *pdev) + { +- /* +- * Some Loongson PCIe ports have h/w limitations of maximum read +- * request size. They can't handle anything larger than this. So +- * force this limit on any devices attached under these ports. +- */ + struct pci_host_bridge *bridge = pci_find_host_bridge(pdev->bus); + + bridge->no_inc_mrrs = 1; diff --git a/queue-5.10/revert-pci-acpiphp-reassign-resources-on-bridge-if-necessary.patch b/queue-5.10/revert-pci-acpiphp-reassign-resources-on-bridge-if-necessary.patch new file mode 100644 index 00000000000..d3cc116cfe3 --- /dev/null +++ b/queue-5.10/revert-pci-acpiphp-reassign-resources-on-bridge-if-necessary.patch @@ -0,0 +1,77 @@ +From 5df12742b7e3aae2594a30a9d14d5d6e9e7699f4 Mon Sep 17 00:00:00 2001 +From: Bjorn Helgaas +Date: Thu, 14 Dec 2023 09:08:56 -0600 +Subject: Revert "PCI: acpiphp: Reassign resources on bridge if necessary" + +From: Bjorn Helgaas + +commit 5df12742b7e3aae2594a30a9d14d5d6e9e7699f4 upstream. + +This reverts commit 40613da52b13fb21c5566f10b287e0ca8c12c4e9 and the +subsequent fix to it: + + cc22522fd55e ("PCI: acpiphp: Use pci_assign_unassigned_bridge_resources() only for non-root bus") + +40613da52b13 fixed a problem where hot-adding a device with large BARs +failed if the bridge windows programmed by firmware were not large enough. + +cc22522fd55e ("PCI: acpiphp: Use pci_assign_unassigned_bridge_resources() +only for non-root bus") fixed a problem with 40613da52b13: an ACPI hot-add +of a device on a PCI root bus (common in the virt world) or firmware +sending ACPI Bus Check to non-existent Root Ports (e.g., on Dell Inspiron +7352/0W6WV0) caused a NULL pointer dereference and suspend/resume hangs. + +Unfortunately the combination of 40613da52b13 and cc22522fd55e caused other +problems: + + - Fiona reported that hot-add of SCSI disks in QEMU virtual machine fails + sometimes. + + - Dongli reported a similar problem with hot-add of SCSI disks. + + - Jonathan reported a console freeze during boot on bare metal due to an + error in radeon GPU initialization. + +Revert both patches to avoid adding these problems. This means we will +again see the problems with hot-adding devices with large BARs and the NULL +pointer dereferences and suspend/resume issues that 40613da52b13 and +cc22522fd55e were intended to fix. + +Fixes: 40613da52b13 ("PCI: acpiphp: Reassign resources on bridge if necessary") +Fixes: cc22522fd55e ("PCI: acpiphp: Use pci_assign_unassigned_bridge_resources() only for non-root bus") +Reported-by: Fiona Ebner +Closes: https://lore.kernel.org/r/9eb669c0-d8f2-431d-a700-6da13053ae54@proxmox.com +Reported-by: Dongli Zhang +Closes: https://lore.kernel.org/r/3c4a446a-b167-11b8-f36f-d3c1b49b42e9@oracle.com +Reported-by: Jonathan Woithe +Closes: https://lore.kernel.org/r/ZXpaNCLiDM+Kv38H@marvin.atrad.com.au +Signed-off-by: Bjorn Helgaas +Acked-by: Michael S. Tsirkin +Acked-by: Igor Mammedov +Cc: +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/hotplug/acpiphp_glue.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +--- a/drivers/pci/hotplug/acpiphp_glue.c ++++ b/drivers/pci/hotplug/acpiphp_glue.c +@@ -503,15 +503,12 @@ static void enable_slot(struct acpiphp_s + if (pass && dev->subordinate) { + check_hotplug_bridge(slot, dev); + pcibios_resource_survey_bus(dev->subordinate); +- if (pci_is_root_bus(bus)) +- __pci_bus_size_bridges(dev->subordinate, &add_list); ++ __pci_bus_size_bridges(dev->subordinate, ++ &add_list); + } + } + } +- if (pci_is_root_bus(bus)) +- __pci_bus_assign_resources(bus, &add_list, NULL); +- else +- pci_assign_unassigned_bridge_resources(bus->self); ++ __pci_bus_assign_resources(bus, &add_list, NULL); + } + + acpiphp_sanitize_bus(bus); diff --git a/queue-5.10/series b/queue-5.10/series index 0aa04d4a971..9a62fad861a 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -31,3 +31,9 @@ net-stmmac-use-dev_err_probe-for-reporting-mdio-bus-.patch net-stmmac-handle-disabled-mdio-busses-from-devicetr.patch appletalk-fix-use-after-free-in-atalk_ioctl.patch net-atlantic-fix-double-free-in-ring-reinit-logic.patch +cred-switch-to-using-atomic_long_t.patch +fuse-dax-set-fc-dax-to-null-in-fuse_dax_conn_free.patch +alsa-hda-hdmi-add-force-connect-quirks-for-asustek-z170-variants.patch +alsa-hda-realtek-apply-mute-led-quirk-for-hp15-db.patch +revert-pci-acpiphp-reassign-resources-on-bridge-if-necessary.patch +pci-loongson-limit-mrrs-to-256.patch