From: Sasha Levin Date: Thu, 19 Dec 2024 19:23:47 +0000 (-0500) Subject: Fixes for 6.1 X-Git-Tag: v6.1.122~54 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=07ff655c26bc586ae2573a265fbfb2a6867ca283;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.1 Signed-off-by: Sasha Levin --- diff --git a/queue-6.1/asoc-intel-sof_sdw-add-quirk-for-dell-sku-0b8c.patch b/queue-6.1/asoc-intel-sof_sdw-add-quirk-for-dell-sku-0b8c.patch new file mode 100644 index 00000000000..27cbdb3be02 --- /dev/null +++ b/queue-6.1/asoc-intel-sof_sdw-add-quirk-for-dell-sku-0b8c.patch @@ -0,0 +1,49 @@ +From 9193a63238895c539375f8de0da6c8b194108157 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 28 Jul 2024 12:07:54 -0400 +Subject: ASoC: Intel: sof_sdw: add quirk for Dell SKU 0B8C +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pierre-Louis Bossart + +[ Upstream commit 92d5b5930e7d55ca07b483490d6298eee828bbe4 ] + +Jack detection needs to rely on JD2, as most other Dell +AlderLake-based devices. + +Closes: https://github.com/thesofproject/linux/issues/5021 +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Péter Ujfalusi +Reviewed-by: Bard Liao +Link: https://patch.msgid.link/20240624121119.91552-4-pierre-louis.bossart@linux.intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/intel/boards/sof_sdw.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c +index cf501baf6f14..9cd85ab19c55 100644 +--- a/sound/soc/intel/boards/sof_sdw.c ++++ b/sound/soc/intel/boards/sof_sdw.c +@@ -387,6 +387,15 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { + RT711_JD2 | + SOF_SDW_FOUR_SPK), + }, ++ { ++ .callback = sof_sdw_quirk_cb, ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0B8C"), ++ }, ++ .driver_data = (void *)(SOF_SDW_TGL_HDMI | ++ RT711_JD2), ++ }, + { + .callback = sof_sdw_quirk_cb, + .matches = { +-- +2.39.5 + diff --git a/queue-6.1/asoc-intel-sof_sdw-fix-jack-detection-on-adl-n-varia.patch b/queue-6.1/asoc-intel-sof_sdw-fix-jack-detection-on-adl-n-varia.patch new file mode 100644 index 00000000000..5d8b91e64a5 --- /dev/null +++ b/queue-6.1/asoc-intel-sof_sdw-fix-jack-detection-on-adl-n-varia.patch @@ -0,0 +1,45 @@ +From 97808d400339d9ada3ae63eeec64a825fd6df653 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 28 Jul 2024 12:07:53 -0400 +Subject: ASoC: Intel: sof_sdw: fix jack detection on ADL-N variant RVP + +From: Pierre-Louis Bossart + +[ Upstream commit 65c90df918205bc84f5448550cde76a54dae5f52 ] + +Experimental tests show that JD2_100K is required, otherwise the jack +is detected always even with nothing plugged-in. + +To avoid matching with other known quirks the SKU information is used. + +Signed-off-by: Pierre-Louis Bossart +Link: https://patch.msgid.link/20240624121119.91552-2-pierre-louis.bossart@linux.intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/intel/boards/sof_sdw.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c +index d03de37e3578..cf501baf6f14 100644 +--- a/sound/soc/intel/boards/sof_sdw.c ++++ b/sound/soc/intel/boards/sof_sdw.c +@@ -267,6 +267,15 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { + SOF_BT_OFFLOAD_SSP(2) | + SOF_SSP_BT_OFFLOAD_PRESENT), + }, ++ { ++ .callback = sof_sdw_quirk_cb, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"), ++ DMI_MATCH(DMI_PRODUCT_SKU, "0000000000070000"), ++ }, ++ .driver_data = (void *)(SOF_SDW_TGL_HDMI | ++ RT711_JD2_100K), ++ }, + { + .callback = sof_sdw_quirk_cb, + .matches = { +-- +2.39.5 + diff --git a/queue-6.1/i2c-pnx-fix-timeout-in-wait-functions.patch b/queue-6.1/i2c-pnx-fix-timeout-in-wait-functions.patch new file mode 100644 index 00000000000..36c6128585a --- /dev/null +++ b/queue-6.1/i2c-pnx-fix-timeout-in-wait-functions.patch @@ -0,0 +1,48 @@ +From b5f3a7aa4a3b7293b9e2a3b37af35361064beff3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 7 Dec 2024 00:19:34 +0100 +Subject: i2c: pnx: Fix timeout in wait functions + +From: Vladimir Riabchun + +[ Upstream commit 7363f2d4c18557c99c536b70489187bb4e05c412 ] + +Since commit f63b94be6942 ("i2c: pnx: Fix potential deadlock warning +from del_timer_sync() call in isr") jiffies are stored in +i2c_pnx_algo_data.timeout, but wait_timeout and wait_reset are still +using it as milliseconds. Convert jiffies back to milliseconds to wait +for the expected amount of time. + +Fixes: f63b94be6942 ("i2c: pnx: Fix potential deadlock warning from del_timer_sync() call in isr") +Signed-off-by: Vladimir Riabchun +Signed-off-by: Andi Shyti +Signed-off-by: Sasha Levin +--- + drivers/i2c/busses/i2c-pnx.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c +index d2c09b0fdf52..ab87bef50402 100644 +--- a/drivers/i2c/busses/i2c-pnx.c ++++ b/drivers/i2c/busses/i2c-pnx.c +@@ -95,7 +95,7 @@ enum { + + static inline int wait_timeout(struct i2c_pnx_algo_data *data) + { +- long timeout = data->timeout; ++ long timeout = jiffies_to_msecs(data->timeout); + while (timeout > 0 && + (ioread32(I2C_REG_STS(data)) & mstatus_active)) { + mdelay(1); +@@ -106,7 +106,7 @@ static inline int wait_timeout(struct i2c_pnx_algo_data *data) + + static inline int wait_reset(struct i2c_pnx_algo_data *data) + { +- long timeout = data->timeout; ++ long timeout = jiffies_to_msecs(data->timeout); + while (timeout > 0 && + (ioread32(I2C_REG_CTL(data)) & mcntrl_reset)) { + mdelay(1); +-- +2.39.5 + diff --git a/queue-6.1/mips-loongson64-dts-fix-msi-node-for-ls7a.patch b/queue-6.1/mips-loongson64-dts-fix-msi-node-for-ls7a.patch new file mode 100644 index 00000000000..ebec0dfa6e1 --- /dev/null +++ b/queue-6.1/mips-loongson64-dts-fix-msi-node-for-ls7a.patch @@ -0,0 +1,36 @@ +From 666bd3270af7caed610b2c4e3995cef6fe599d3f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 28 Jul 2024 12:07:50 -0400 +Subject: MIPS: Loongson64: DTS: Fix msi node for ls7a + +From: Jiaxun Yang + +[ Upstream commit 98a9e2ac3755a353eefea8c52e23d5b0c50f3899 ] + +Add it to silent warning: +arch/mips/boot/dts/loongson/ls7a-pch.dtsi:68.16-416.5: Warning (interrupt_provider): /bus@10000000/pci@1a000000: '#interrupt-cells' found, but node is not an interrupt provider +arch/mips/boot/dts/loongson/loongson64g_4core_ls7a.dts:32.31-40.4: Warning (interrupt_provider): /bus@10000000/msi-controller@2ff00000: Missing '#interrupt-cells' in interrupt provider +arch/mips/boot/dts/loongson/loongson64g_4core_ls7a.dtb: Warning (interrupt_map): Failed prerequisite 'interrupt_provider' + +Signed-off-by: Jiaxun Yang +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Sasha Levin +--- + arch/mips/boot/dts/loongson/loongson64g_4core_ls7a.dts | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/mips/boot/dts/loongson/loongson64g_4core_ls7a.dts b/arch/mips/boot/dts/loongson/loongson64g_4core_ls7a.dts +index c945f8565d54..fb180cb2b8e2 100644 +--- a/arch/mips/boot/dts/loongson/loongson64g_4core_ls7a.dts ++++ b/arch/mips/boot/dts/loongson/loongson64g_4core_ls7a.dts +@@ -33,6 +33,7 @@ + compatible = "loongson,pch-msi-1.0"; + reg = <0 0x2ff00000 0 0x8>; + interrupt-controller; ++ #interrupt-cells = <1>; + msi-controller; + loongson,msi-base-vec = <64>; + loongson,msi-num-vecs = <192>; +-- +2.39.5 + diff --git a/queue-6.1/p2sb-do-not-scan-and-remove-the-p2sb-device-when-it-.patch b/queue-6.1/p2sb-do-not-scan-and-remove-the-p2sb-device-when-it-.patch new file mode 100644 index 00000000000..2d0f7427871 --- /dev/null +++ b/queue-6.1/p2sb-do-not-scan-and-remove-the-p2sb-device-when-it-.patch @@ -0,0 +1,136 @@ +From 089e301652850b7f2ebac2d2bf68d4fa1bf42d6d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 28 Nov 2024 09:28:36 +0900 +Subject: p2sb: Do not scan and remove the P2SB device when it is unhidden +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Shin'ichiro Kawasaki + +[ Upstream commit 360c400d0f568636c1b98d1d5f9f49aa3d420c70 ] + +When drivers access P2SB device resources, it calls p2sb_bar(). Before +the commit 5913320eb0b3 ("platform/x86: p2sb: Allow p2sb_bar() calls +during PCI device probe"), p2sb_bar() obtained the resources and then +called pci_stop_and_remove_bus_device() for clean up. Then the P2SB +device disappeared. The commit 5913320eb0b3 introduced the P2SB device +resource cache feature in the boot process. During the resource cache, +pci_stop_and_remove_bus_device() is called for the P2SB device, then the +P2SB device disappears regardless of whether p2sb_bar() is called or +not. Such P2SB device disappearance caused a confusion [1]. To avoid the +confusion, avoid the pci_stop_and_remove_bus_device() call when the BIOS +does not hide the P2SB device. + +For that purpose, cache the P2SB device resources only if the BIOS hides +the P2SB device. Call p2sb_scan_and_cache() only if p2sb_hidden_by_bios +is true. This allows removing two branches from p2sb_scan_and_cache(). +When p2sb_bar() is called, get the resources from the cache if the P2SB +device is hidden. Otherwise, read the resources from the unhidden P2SB +device. + +Reported-by: Daniel Walker (danielwa) +Closes: https://lore.kernel.org/lkml/ZzTI+biIUTvFT6NC@goliath/ [1] +Fixes: 5913320eb0b3 ("platform/x86: p2sb: Allow p2sb_bar() calls during PCI device probe") +Signed-off-by: Shin'ichiro Kawasaki +Reviewed-by: Hans de Goede +Link: https://lore.kernel.org/r/20241128002836.373745-5-shinichiro.kawasaki@wdc.com +Reviewed-by: Ilpo Järvinen +Signed-off-by: Ilpo Järvinen +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/p2sb.c | 42 +++++++++++++++++++++++++++++-------- + 1 file changed, 33 insertions(+), 9 deletions(-) + +diff --git a/drivers/platform/x86/p2sb.c b/drivers/platform/x86/p2sb.c +index 6fb76b82ecce..eff920de31c2 100644 +--- a/drivers/platform/x86/p2sb.c ++++ b/drivers/platform/x86/p2sb.c +@@ -100,10 +100,8 @@ static int p2sb_scan_and_cache(struct pci_bus *bus, unsigned int devfn) + /* + * The BIOS prevents the P2SB device from being enumerated by the PCI + * subsystem, so we need to unhide and hide it back to lookup the BAR. +- * Unhide the P2SB device here, if needed. + */ +- if (p2sb_hidden_by_bios) +- pci_bus_write_config_dword(bus, devfn, P2SBC, 0); ++ pci_bus_write_config_dword(bus, devfn, P2SBC, 0); + + /* Scan the P2SB device and cache its BAR0 */ + p2sb_scan_and_cache_devfn(bus, devfn); +@@ -112,9 +110,7 @@ static int p2sb_scan_and_cache(struct pci_bus *bus, unsigned int devfn) + if (devfn == P2SB_DEVFN_GOLDMONT) + p2sb_scan_and_cache_devfn(bus, SPI_DEVFN_GOLDMONT); + +- /* Hide the P2SB device, if it was hidden */ +- if (p2sb_hidden_by_bios) +- pci_bus_write_config_dword(bus, devfn, P2SBC, P2SBC_HIDE); ++ pci_bus_write_config_dword(bus, devfn, P2SBC, P2SBC_HIDE); + + if (!p2sb_valid_resource(&p2sb_resources[PCI_FUNC(devfn)].res)) + return -ENOENT; +@@ -141,7 +137,7 @@ static int p2sb_cache_resources(void) + u32 value = P2SBC_HIDE; + struct pci_bus *bus; + u16 class; +- int ret; ++ int ret = 0; + + /* Get devfn for P2SB device itself */ + p2sb_get_devfn(&devfn_p2sb); +@@ -167,7 +163,12 @@ static int p2sb_cache_resources(void) + pci_bus_read_config_dword(bus, devfn_p2sb, P2SBC, &value); + p2sb_hidden_by_bios = value & P2SBC_HIDE; + +- ret = p2sb_scan_and_cache(bus, devfn_p2sb); ++ /* ++ * If the BIOS does not hide the P2SB device then its resources ++ * are accesilble. Cache them only if the P2SB device is hidden. ++ */ ++ if (p2sb_hidden_by_bios) ++ ret = p2sb_scan_and_cache(bus, devfn_p2sb); + + pci_unlock_rescan_remove(); + +@@ -190,6 +191,26 @@ static int p2sb_read_from_cache(struct pci_bus *bus, unsigned int devfn, + return 0; + } + ++static int p2sb_read_from_dev(struct pci_bus *bus, unsigned int devfn, ++ struct resource *mem) ++{ ++ struct pci_dev *pdev; ++ int ret = 0; ++ ++ pdev = pci_get_slot(bus, devfn); ++ if (!pdev) ++ return -ENODEV; ++ ++ if (p2sb_valid_resource(pci_resource_n(pdev, 0))) ++ p2sb_read_bar0(pdev, mem); ++ else ++ ret = -ENOENT; ++ ++ pci_dev_put(pdev); ++ ++ return ret; ++} ++ + /** + * p2sb_bar - Get Primary to Sideband (P2SB) bridge device BAR + * @bus: PCI bus to communicate with +@@ -213,7 +234,10 @@ int p2sb_bar(struct pci_bus *bus, unsigned int devfn, struct resource *mem) + if (!devfn) + p2sb_get_devfn(&devfn); + +- return p2sb_read_from_cache(bus, devfn, mem); ++ if (p2sb_hidden_by_bios) ++ return p2sb_read_from_cache(bus, devfn, mem); ++ ++ return p2sb_read_from_dev(bus, devfn, mem); + } + EXPORT_SYMBOL_GPL(p2sb_bar); + +-- +2.39.5 + diff --git a/queue-6.1/p2sb-factor-out-p2sb_read_from_cache.patch b/queue-6.1/p2sb-factor-out-p2sb_read_from_cache.patch new file mode 100644 index 00000000000..301e5981d6f --- /dev/null +++ b/queue-6.1/p2sb-factor-out-p2sb_read_from_cache.patch @@ -0,0 +1,82 @@ +From 5611e6103273249728a9b5b6344a9999901db896 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 28 Nov 2024 09:28:33 +0900 +Subject: p2sb: Factor out p2sb_read_from_cache() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Shin'ichiro Kawasaki + +[ Upstream commit 9244524d60ddea55f4df54c51200e8fef2032447 ] + +To prepare for the following fix, factor out the code to read the P2SB +resource from the cache to the new function p2sb_read_from_cache(). + +Signed-off-by: Shin'ichiro Kawasaki +Reviewed-by: Hans de Goede +Link: https://lore.kernel.org/r/20241128002836.373745-2-shinichiro.kawasaki@wdc.com +Reviewed-by: Ilpo Järvinen +Signed-off-by: Ilpo Järvinen +Stable-dep-of: 360c400d0f56 ("p2sb: Do not scan and remove the P2SB device when it is unhidden") +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/p2sb.c | 28 +++++++++++++++++----------- + 1 file changed, 17 insertions(+), 11 deletions(-) + +diff --git a/drivers/platform/x86/p2sb.c b/drivers/platform/x86/p2sb.c +index 687e341e3206..d6ee4b34f911 100644 +--- a/drivers/platform/x86/p2sb.c ++++ b/drivers/platform/x86/p2sb.c +@@ -171,6 +171,22 @@ static int p2sb_cache_resources(void) + return ret; + } + ++static int p2sb_read_from_cache(struct pci_bus *bus, unsigned int devfn, ++ struct resource *mem) ++{ ++ struct p2sb_res_cache *cache = &p2sb_resources[PCI_FUNC(devfn)]; ++ ++ if (cache->bus_dev_id != bus->dev.id) ++ return -ENODEV; ++ ++ if (!p2sb_valid_resource(&cache->res)) ++ return -ENOENT; ++ ++ memcpy(mem, &cache->res, sizeof(*mem)); ++ ++ return 0; ++} ++ + /** + * p2sb_bar - Get Primary to Sideband (P2SB) bridge device BAR + * @bus: PCI bus to communicate with +@@ -187,8 +203,6 @@ static int p2sb_cache_resources(void) + */ + int p2sb_bar(struct pci_bus *bus, unsigned int devfn, struct resource *mem) + { +- struct p2sb_res_cache *cache; +- + bus = p2sb_get_bus(bus); + if (!bus) + return -ENODEV; +@@ -196,15 +210,7 @@ int p2sb_bar(struct pci_bus *bus, unsigned int devfn, struct resource *mem) + if (!devfn) + p2sb_get_devfn(&devfn); + +- cache = &p2sb_resources[PCI_FUNC(devfn)]; +- if (cache->bus_dev_id != bus->dev.id) +- return -ENODEV; +- +- if (!p2sb_valid_resource(&cache->res)) +- return -ENOENT; +- +- memcpy(mem, &cache->res, sizeof(*mem)); +- return 0; ++ return p2sb_read_from_cache(bus, devfn, mem); + } + EXPORT_SYMBOL_GPL(p2sb_bar); + +-- +2.39.5 + diff --git a/queue-6.1/p2sb-introduce-the-global-flag-p2sb_hidden_by_bios.patch b/queue-6.1/p2sb-introduce-the-global-flag-p2sb_hidden_by_bios.patch new file mode 100644 index 00000000000..9fba4b0f472 --- /dev/null +++ b/queue-6.1/p2sb-introduce-the-global-flag-p2sb_hidden_by_bios.patch @@ -0,0 +1,60 @@ +From b6fed515d2f977963e56975414c3f04aeb4a6c33 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 28 Nov 2024 09:28:34 +0900 +Subject: p2sb: Introduce the global flag p2sb_hidden_by_bios +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Shin'ichiro Kawasaki + +[ Upstream commit ae3e6ebc5ab046d434c05c58a3e3f7e94441fec2 ] + +To prepare for the following fix, introduce the global flag +p2sb_hidden_by_bios. Check if the BIOS hides the P2SB device and store +the result in the flag. This allows to refer to the check result across +functions. + +Signed-off-by: Shin'ichiro Kawasaki +Reviewed-by: Hans de Goede +Link: https://lore.kernel.org/r/20241128002836.373745-3-shinichiro.kawasaki@wdc.com +Reviewed-by: Ilpo Järvinen +Signed-off-by: Ilpo Järvinen +Stable-dep-of: 360c400d0f56 ("p2sb: Do not scan and remove the P2SB device when it is unhidden") +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/p2sb.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/platform/x86/p2sb.c b/drivers/platform/x86/p2sb.c +index d6ee4b34f911..d015ddc9f30e 100644 +--- a/drivers/platform/x86/p2sb.c ++++ b/drivers/platform/x86/p2sb.c +@@ -42,6 +42,7 @@ struct p2sb_res_cache { + }; + + static struct p2sb_res_cache p2sb_resources[NR_P2SB_RES_CACHE]; ++static bool p2sb_hidden_by_bios; + + static void p2sb_get_devfn(unsigned int *devfn) + { +@@ -157,13 +158,14 @@ static int p2sb_cache_resources(void) + * Unhide the P2SB device here, if needed. + */ + pci_bus_read_config_dword(bus, devfn_p2sb, P2SBC, &value); +- if (value & P2SBC_HIDE) ++ p2sb_hidden_by_bios = value & P2SBC_HIDE; ++ if (p2sb_hidden_by_bios) + pci_bus_write_config_dword(bus, devfn_p2sb, P2SBC, 0); + + ret = p2sb_scan_and_cache(bus, devfn_p2sb); + + /* Hide the P2SB device, if it was hidden */ +- if (value & P2SBC_HIDE) ++ if (p2sb_hidden_by_bios) + pci_bus_write_config_dword(bus, devfn_p2sb, P2SBC, P2SBC_HIDE); + + pci_unlock_rescan_remove(); +-- +2.39.5 + diff --git a/queue-6.1/p2sb-move-p2sb-hide-and-unhide-code-to-p2sb_scan_and.patch b/queue-6.1/p2sb-move-p2sb-hide-and-unhide-code-to-p2sb_scan_and.patch new file mode 100644 index 00000000000..f4810560a13 --- /dev/null +++ b/queue-6.1/p2sb-move-p2sb-hide-and-unhide-code-to-p2sb_scan_and.patch @@ -0,0 +1,82 @@ +From 47afd580e949ff8b8ccafb2850b73d63d9bb4be3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 28 Nov 2024 09:28:35 +0900 +Subject: p2sb: Move P2SB hide and unhide code to p2sb_scan_and_cache() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Shin'ichiro Kawasaki + +[ Upstream commit 0286070c74ee48391fc07f7f617460479472d221 ] + +To prepare for the following fix, move the code to hide and unhide the +P2SB device from p2sb_cache_resources() to p2sb_scan_and_cache(). + +Signed-off-by: Shin'ichiro Kawasaki +Reviewed-by: Hans de Goede +Link: https://lore.kernel.org/r/20241128002836.373745-4-shinichiro.kawasaki@wdc.com +Reviewed-by: Ilpo Järvinen +Signed-off-by: Ilpo Järvinen +Stable-dep-of: 360c400d0f56 ("p2sb: Do not scan and remove the P2SB device when it is unhidden") +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/p2sb.c | 23 ++++++++++++----------- + 1 file changed, 12 insertions(+), 11 deletions(-) + +diff --git a/drivers/platform/x86/p2sb.c b/drivers/platform/x86/p2sb.c +index d015ddc9f30e..6fb76b82ecce 100644 +--- a/drivers/platform/x86/p2sb.c ++++ b/drivers/platform/x86/p2sb.c +@@ -97,6 +97,14 @@ static void p2sb_scan_and_cache_devfn(struct pci_bus *bus, unsigned int devfn) + + static int p2sb_scan_and_cache(struct pci_bus *bus, unsigned int devfn) + { ++ /* ++ * The BIOS prevents the P2SB device from being enumerated by the PCI ++ * subsystem, so we need to unhide and hide it back to lookup the BAR. ++ * Unhide the P2SB device here, if needed. ++ */ ++ if (p2sb_hidden_by_bios) ++ pci_bus_write_config_dword(bus, devfn, P2SBC, 0); ++ + /* Scan the P2SB device and cache its BAR0 */ + p2sb_scan_and_cache_devfn(bus, devfn); + +@@ -104,6 +112,10 @@ static int p2sb_scan_and_cache(struct pci_bus *bus, unsigned int devfn) + if (devfn == P2SB_DEVFN_GOLDMONT) + p2sb_scan_and_cache_devfn(bus, SPI_DEVFN_GOLDMONT); + ++ /* Hide the P2SB device, if it was hidden */ ++ if (p2sb_hidden_by_bios) ++ pci_bus_write_config_dword(bus, devfn, P2SBC, P2SBC_HIDE); ++ + if (!p2sb_valid_resource(&p2sb_resources[PCI_FUNC(devfn)].res)) + return -ENOENT; + +@@ -152,22 +164,11 @@ static int p2sb_cache_resources(void) + */ + pci_lock_rescan_remove(); + +- /* +- * The BIOS prevents the P2SB device from being enumerated by the PCI +- * subsystem, so we need to unhide and hide it back to lookup the BAR. +- * Unhide the P2SB device here, if needed. +- */ + pci_bus_read_config_dword(bus, devfn_p2sb, P2SBC, &value); + p2sb_hidden_by_bios = value & P2SBC_HIDE; +- if (p2sb_hidden_by_bios) +- pci_bus_write_config_dword(bus, devfn_p2sb, P2SBC, 0); + + ret = p2sb_scan_and_cache(bus, devfn_p2sb); + +- /* Hide the P2SB device, if it was hidden */ +- if (p2sb_hidden_by_bios) +- pci_bus_write_config_dword(bus, devfn_p2sb, P2SBC, P2SBC_HIDE); +- + pci_unlock_rescan_remove(); + + return ret; +-- +2.39.5 + diff --git a/queue-6.1/pci-add-acs-quirk-for-broadcom-bcm5760x-nic.patch b/queue-6.1/pci-add-acs-quirk-for-broadcom-bcm5760x-nic.patch new file mode 100644 index 00000000000..28482043125 --- /dev/null +++ b/queue-6.1/pci-add-acs-quirk-for-broadcom-bcm5760x-nic.patch @@ -0,0 +1,51 @@ +From e569d4ef393f2b7954c44d93f8b28576d86f8576 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 28 Jul 2024 12:07:45 -0400 +Subject: PCI: Add ACS quirk for Broadcom BCM5760X NIC +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ajit Khaparde + +[ Upstream commit 524e057b2d66b61f9b63b6db30467ab7b0bb4796 ] + +The Broadcom BCM5760X NIC may be a multi-function device. + +While it does not advertise an ACS capability, peer-to-peer transactions +are not possible between the individual functions. So it is ok to treat +them as fully isolated. + +Add an ACS quirk for this device so the functions can be in independent +IOMMU groups and attached individually to userspace applications using +VFIO. + +[kwilczynski: commit log] +Link: https://lore.kernel.org/linux-pci/20240510204228.73435-1-ajit.khaparde@broadcom.com +Signed-off-by: Ajit Khaparde +Signed-off-by: Krzysztof Wilczyński +Signed-off-by: Bjorn Helgaas +Reviewed-by: Andy Gospodarek +Signed-off-by: Sasha Levin +--- + drivers/pci/quirks.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c +index d0da564ac94b..2b3df65005ca 100644 +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -5008,6 +5008,10 @@ static const struct pci_dev_acs_enabled { + { PCI_VENDOR_ID_BROADCOM, 0x1750, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0x1751, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0x1752, pci_quirk_mf_endpoint_acs }, ++ { PCI_VENDOR_ID_BROADCOM, 0x1760, pci_quirk_mf_endpoint_acs }, ++ { PCI_VENDOR_ID_BROADCOM, 0x1761, pci_quirk_mf_endpoint_acs }, ++ { PCI_VENDOR_ID_BROADCOM, 0x1762, pci_quirk_mf_endpoint_acs }, ++ { PCI_VENDOR_ID_BROADCOM, 0x1763, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0xD714, pci_quirk_brcm_acs }, + /* Amazon Annapurna Labs */ + { PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031, pci_quirk_al_acs }, +-- +2.39.5 + diff --git a/queue-6.1/pci-aer-disable-aer-service-on-suspend.patch b/queue-6.1/pci-aer-disable-aer-service-on-suspend.patch new file mode 100644 index 00000000000..6b2d152b419 --- /dev/null +++ b/queue-6.1/pci-aer-disable-aer-service-on-suspend.patch @@ -0,0 +1,68 @@ +From b3da0d2fdebfdd036616d5cf9095d798672a9438 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 28 Jul 2024 12:07:52 -0400 +Subject: PCI/AER: Disable AER service on suspend + +From: Kai-Heng Feng + +[ Upstream commit 5afc2f763edc5daae4722ee46fea4e627d01fa90 ] + +If the link is powered off during suspend, electrical noise may cause +errors that are logged via AER. If the AER interrupt is enabled and shares +an IRQ with PME, that causes a spurious wakeup during suspend. + +Disable the AER interrupt during suspend to prevent this. Clear error +status before re-enabling IRQ interrupts during resume so we don't get an +interrupt for errors that occurred during the suspend/resume process. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=209149 +Link: https://bugzilla.kernel.org/show_bug.cgi?id=216295 +Link: https://bugzilla.kernel.org/show_bug.cgi?id=218090 +Link: https://lore.kernel.org/r/20240416043225.1462548-2-kai.heng.feng@canonical.com +Signed-off-by: Kai-Heng Feng +[bhelgaas: drop pci_ancestor_pr3_present() etc, commit log] +Signed-off-by: Bjorn Helgaas +Signed-off-by: Sasha Levin +--- + drivers/pci/pcie/aer.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c +index 5426f450ce91..1b59e6fc7439 100644 +--- a/drivers/pci/pcie/aer.c ++++ b/drivers/pci/pcie/aer.c +@@ -1384,6 +1384,22 @@ static int aer_probe(struct pcie_device *dev) + return 0; + } + ++static int aer_suspend(struct pcie_device *dev) ++{ ++ struct aer_rpc *rpc = get_service_data(dev); ++ ++ aer_disable_rootport(rpc); ++ return 0; ++} ++ ++static int aer_resume(struct pcie_device *dev) ++{ ++ struct aer_rpc *rpc = get_service_data(dev); ++ ++ aer_enable_rootport(rpc); ++ return 0; ++} ++ + /** + * aer_root_reset - reset Root Port hierarchy, RCEC, or RCiEP + * @dev: pointer to Root Port, RCEC, or RCiEP +@@ -1455,6 +1471,8 @@ static struct pcie_port_service_driver aerdriver = { + .service = PCIE_PORT_SERVICE_AER, + + .probe = aer_probe, ++ .suspend = aer_suspend, ++ .resume = aer_resume, + .remove = aer_remove, + }; + +-- +2.39.5 + diff --git a/queue-6.1/pci-introduce-pci_resource_n.patch b/queue-6.1/pci-introduce-pci_resource_n.patch new file mode 100644 index 00000000000..a9e71e0e14a --- /dev/null +++ b/queue-6.1/pci-introduce-pci_resource_n.patch @@ -0,0 +1,54 @@ +From 618383908788c91e6baddfeeb7ca4e909c9237e0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Mar 2023 19:24:29 +0300 +Subject: PCI: Introduce pci_resource_n() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Andy Shevchenko + +[ Upstream commit 144d204df78e40e6250201e71ef7d0e42d2a13fc ] + +Introduce pci_resource_n() and replace open-coded implementations of it +in pci.h. + +Link: https://lore.kernel.org/r/20230330162434.35055-3-andriy.shevchenko@linux.intel.com +Signed-off-by: Andy Shevchenko +Signed-off-by: Bjorn Helgaas +Reviewed-by: Philippe Mathieu-Daudé +Stable-dep-of: 360c400d0f56 ("p2sb: Do not scan and remove the P2SB device when it is unhidden") +Signed-off-by: Sasha Levin +--- + include/linux/pci.h | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +diff --git a/include/linux/pci.h b/include/linux/pci.h +index 9e58e5400d78..28f91982402a 100644 +--- a/include/linux/pci.h ++++ b/include/linux/pci.h +@@ -1996,14 +1996,13 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma); + * These helpers provide future and backwards compatibility + * for accessing popular PCI BAR info + */ +-#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) +-#define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end) +-#define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags) +-#define pci_resource_len(dev,bar) \ +- ((pci_resource_end((dev), (bar)) == 0) ? 0 : \ +- \ +- (pci_resource_end((dev), (bar)) - \ +- pci_resource_start((dev), (bar)) + 1)) ++#define pci_resource_n(dev, bar) (&(dev)->resource[(bar)]) ++#define pci_resource_start(dev, bar) (pci_resource_n(dev, bar)->start) ++#define pci_resource_end(dev, bar) (pci_resource_n(dev, bar)->end) ++#define pci_resource_flags(dev, bar) (pci_resource_n(dev, bar)->flags) ++#define pci_resource_len(dev,bar) \ ++ (pci_resource_end((dev), (bar)) ? \ ++ resource_size(pci_resource_n((dev), (bar))) : 0) + + /* + * Similar to the helpers above, these manipulate per-pci_dev +-- +2.39.5 + diff --git a/queue-6.1/pci-use-preserve_config-in-place-of-pci_flags.patch b/queue-6.1/pci-use-preserve_config-in-place-of-pci_flags.patch new file mode 100644 index 00000000000..a6be9b35aba --- /dev/null +++ b/queue-6.1/pci-use-preserve_config-in-place-of-pci_flags.patch @@ -0,0 +1,77 @@ +From de2d639149d6e3dc0c84785146aefa5305960cd7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 28 Jul 2024 12:07:46 -0400 +Subject: PCI: Use preserve_config in place of pci_flags + +From: Vidya Sagar + +[ Upstream commit 7246a4520b4bf1494d7d030166a11b5226f6d508 ] + +Use preserve_config in place of checking for PCI_PROBE_ONLY flag to enable +support for "linux,pci-probe-only" on a per host bridge basis. + +This also obviates the use of adding PCI_REASSIGN_ALL_BUS flag if +!PCI_PROBE_ONLY, as pci_assign_unassigned_root_bus_resources() takes care +of reassigning the resources that are not already claimed. + +Link: https://lore.kernel.org/r/20240508174138.3630283-5-vidyas@nvidia.com +Signed-off-by: Vidya Sagar +Signed-off-by: Bjorn Helgaas +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/pci-host-common.c | 4 ---- + drivers/pci/probe.c | 20 +++++++++----------- + 2 files changed, 9 insertions(+), 15 deletions(-) + +diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c +index d3924a44db02..fd3020a399cf 100644 +--- a/drivers/pci/controller/pci-host-common.c ++++ b/drivers/pci/controller/pci-host-common.c +@@ -73,10 +73,6 @@ int pci_host_common_probe(struct platform_device *pdev) + if (IS_ERR(cfg)) + return PTR_ERR(cfg); + +- /* Do not reassign resources if probe only */ +- if (!pci_has_flag(PCI_PROBE_ONLY)) +- pci_add_flags(PCI_REASSIGN_ALL_BUS); +- + bridge->sysdata = cfg; + bridge->ops = (struct pci_ops *)&ops->pci_ops; + bridge->msi_domain = true; +diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c +index 5c1ab9ee65eb..fbb47954a96c 100644 +--- a/drivers/pci/probe.c ++++ b/drivers/pci/probe.c +@@ -3082,20 +3082,18 @@ int pci_host_probe(struct pci_host_bridge *bridge) + + bus = bridge->bus; + ++ /* If we must preserve the resource configuration, claim now */ ++ if (bridge->preserve_config) ++ pci_bus_claim_resources(bus); ++ + /* +- * We insert PCI resources into the iomem_resource and +- * ioport_resource trees in either pci_bus_claim_resources() +- * or pci_bus_assign_resources(). ++ * Assign whatever was left unassigned. If we didn't claim above, ++ * this will reassign everything. + */ +- if (pci_has_flag(PCI_PROBE_ONLY)) { +- pci_bus_claim_resources(bus); +- } else { +- pci_bus_size_bridges(bus); +- pci_bus_assign_resources(bus); ++ pci_assign_unassigned_root_bus_resources(bus); + +- list_for_each_entry(child, &bus->children, node) +- pcie_bus_configure_settings(child); +- } ++ list_for_each_entry(child, &bus->children, node) ++ pcie_bus_configure_settings(child); + + pci_bus_add_devices(bus); + return 0; +-- +2.39.5 + diff --git a/queue-6.1/pci-vmd-create-domain-symlink-before-pci_bus_add_dev.patch b/queue-6.1/pci-vmd-create-domain-symlink-before-pci_bus_add_dev.patch new file mode 100644 index 00000000000..22c91cb1532 --- /dev/null +++ b/queue-6.1/pci-vmd-create-domain-symlink-before-pci_bus_add_dev.patch @@ -0,0 +1,116 @@ +From 47a4d134251a6343cab148abf4f03e16c99eb5f0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 28 Jul 2024 12:07:57 -0400 +Subject: PCI: vmd: Create domain symlink before pci_bus_add_devices() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jiwei Sun + +[ Upstream commit f24c9bfcd423e2b2bb0d198456412f614ec2030a ] + +The vmd driver creates a "domain" symlink in sysfs for each VMD bridge. +Previously this symlink was created after pci_bus_add_devices() added +devices below the VMD bridge and emitted udev events to announce them to +userspace. + +This led to a race between userspace consumers of the udev events and the +kernel creation of the symlink. One such consumer is mdadm, which +assembles block devices into a RAID array, and for devices below a VMD +bridge, mdadm depends on the "domain" symlink. + +If mdadm loses the race, it may be unable to assemble a RAID array, which +may cause a boot failure or other issues, with complaints like this: + + (udev-worker)[2149]: nvme1n1: '/sbin/mdadm -I /dev/nvme1n1'(err) 'mdadm: Unable to get real path for '/sys/bus/pci/drivers/vmd/0000:c7:00.5/domain/device'' + (udev-worker)[2149]: nvme1n1: '/sbin/mdadm -I /dev/nvme1n1'(err) 'mdadm: /dev/nvme1n1 is not attached to Intel(R) RAID controller.' + (udev-worker)[2149]: nvme1n1: '/sbin/mdadm -I /dev/nvme1n1'(err) 'mdadm: No OROM/EFI properties for /dev/nvme1n1' + (udev-worker)[2149]: nvme1n1: '/sbin/mdadm -I /dev/nvme1n1'(err) 'mdadm: no RAID superblock on /dev/nvme1n1.' + (udev-worker)[2149]: nvme1n1: Process '/sbin/mdadm -I /dev/nvme1n1' failed with exit code 1. + +This symptom prevents the OS from booting successfully. + +After a NVMe disk is probed/added by the nvme driver, udevd invokes mdadm +to detect if there is a mdraid associated with this NVMe disk, and mdadm +determines if a NVMe device is connected to a particular VMD domain by +checking the "domain" symlink. For example: + + Thread A Thread B Thread mdadm + vmd_enable_domain + pci_bus_add_devices + __driver_probe_device + ... + work_on_cpu + schedule_work_on + : wakeup Thread B + nvme_probe + : wakeup scan_work + to scan nvme disk + and add nvme disk + then wakeup udevd + : udevd executes + mdadm command + flush_work main + : wait for nvme_probe done ... + __driver_probe_device find_driver_devices + : probe next nvme device : 1) Detect domain symlink + ... 2) Find domain symlink + ... from vmd sysfs + ... 3) Domain symlink not + ... created yet; failed + sysfs_create_link + : create domain symlink + +Create the VMD "domain" symlink before invoking pci_bus_add_devices() to +avoid this race. + +Suggested-by: Adrian Huang +Link: https://lore.kernel.org/linux-pci/20240605124844.24293-1-sjiwei@163.com +Signed-off-by: Jiwei Sun +Signed-off-by: Krzysztof Wilczyński +[bhelgaas: commit log] +Signed-off-by: Bjorn Helgaas +Reviewed-by: Nirmal Patel +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/vmd.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c +index 5c35884c226e..a1dd614bdc32 100644 +--- a/drivers/pci/controller/vmd.c ++++ b/drivers/pci/controller/vmd.c +@@ -870,6 +870,9 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) + dev_set_msi_domain(&vmd->bus->dev, + dev_get_msi_domain(&vmd->dev->dev)); + ++ WARN(sysfs_create_link(&vmd->dev->dev.kobj, &vmd->bus->dev.kobj, ++ "domain"), "Can't create symlink to domain\n"); ++ + vmd_acpi_begin(); + + pci_scan_child_bus(vmd->bus); +@@ -907,9 +910,6 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) + pci_bus_add_devices(vmd->bus); + + vmd_acpi_end(); +- +- WARN(sysfs_create_link(&vmd->dev->dev.kobj, &vmd->bus->dev.kobj, +- "domain"), "Can't create symlink to domain\n"); + return 0; + } + +@@ -985,8 +985,8 @@ static void vmd_remove(struct pci_dev *dev) + { + struct vmd_dev *vmd = pci_get_drvdata(dev); + +- sysfs_remove_link(&vmd->dev->dev.kobj, "domain"); + pci_stop_root_bus(vmd->bus); ++ sysfs_remove_link(&vmd->dev->dev.kobj, "domain"); + pci_remove_root_bus(vmd->bus); + vmd_cleanup_srcu(vmd); + vmd_detach_resources(vmd); +-- +2.39.5 + diff --git a/queue-6.1/platform-x86-p2sb-make-p2sb_get_devfn-return-void.patch b/queue-6.1/platform-x86-p2sb-make-p2sb_get_devfn-return-void.patch new file mode 100644 index 00000000000..010cb947f46 --- /dev/null +++ b/queue-6.1/platform-x86-p2sb-make-p2sb_get_devfn-return-void.patch @@ -0,0 +1,76 @@ +From 4d589f71d27e21941306256a74a5526fc0f42863 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 5 Mar 2024 10:45:00 +0100 +Subject: platform/x86: p2sb: Make p2sb_get_devfn() return void + +From: Hans de Goede + +[ Upstream commit 3ff5873602a874035ba28826852bd45393002a08 ] + +p2sb_get_devfn() always succeeds, make it return void and +remove error checking from its callers. + +Reviewed-by: Shin'ichiro Kawasaki +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20240305094500.23778-1-hdegoede@redhat.com +Stable-dep-of: 360c400d0f56 ("p2sb: Do not scan and remove the P2SB device when it is unhidden") +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/p2sb.c | 15 ++++----------- + 1 file changed, 4 insertions(+), 11 deletions(-) + +diff --git a/drivers/platform/x86/p2sb.c b/drivers/platform/x86/p2sb.c +index 053be5c5e0ca..687e341e3206 100644 +--- a/drivers/platform/x86/p2sb.c ++++ b/drivers/platform/x86/p2sb.c +@@ -43,7 +43,7 @@ struct p2sb_res_cache { + + static struct p2sb_res_cache p2sb_resources[NR_P2SB_RES_CACHE]; + +-static int p2sb_get_devfn(unsigned int *devfn) ++static void p2sb_get_devfn(unsigned int *devfn) + { + unsigned int fn = P2SB_DEVFN_DEFAULT; + const struct x86_cpu_id *id; +@@ -53,7 +53,6 @@ static int p2sb_get_devfn(unsigned int *devfn) + fn = (unsigned int)id->driver_data; + + *devfn = fn; +- return 0; + } + + static bool p2sb_valid_resource(const struct resource *res) +@@ -132,9 +131,7 @@ static int p2sb_cache_resources(void) + int ret; + + /* Get devfn for P2SB device itself */ +- ret = p2sb_get_devfn(&devfn_p2sb); +- if (ret) +- return ret; ++ p2sb_get_devfn(&devfn_p2sb); + + bus = p2sb_get_bus(NULL); + if (!bus) +@@ -191,17 +188,13 @@ static int p2sb_cache_resources(void) + int p2sb_bar(struct pci_bus *bus, unsigned int devfn, struct resource *mem) + { + struct p2sb_res_cache *cache; +- int ret; + + bus = p2sb_get_bus(bus); + if (!bus) + return -ENODEV; + +- if (!devfn) { +- ret = p2sb_get_devfn(&devfn); +- if (ret) +- return ret; +- } ++ if (!devfn) ++ p2sb_get_devfn(&devfn); + + cache = &p2sb_resources[PCI_FUNC(devfn)]; + if (cache->bus_dev_id != bus->dev.id) +-- +2.39.5 + diff --git a/queue-6.1/series b/queue-6.1/series index 19e6f6cda0b..3305d4cb0bb 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -1 +1,17 @@ net-sched-fix-ordering-of-qlen-adjustment.patch +pci-aer-disable-aer-service-on-suspend.patch +pci-use-preserve_config-in-place-of-pci_flags.patch +pci-vmd-create-domain-symlink-before-pci_bus_add_dev.patch +usb-cdns3-add-quirk-flag-to-enable-suspend-residency.patch +asoc-intel-sof_sdw-fix-jack-detection-on-adl-n-varia.patch +asoc-intel-sof_sdw-add-quirk-for-dell-sku-0b8c.patch +pci-add-acs-quirk-for-broadcom-bcm5760x-nic.patch +mips-loongson64-dts-fix-msi-node-for-ls7a.patch +usb-dwc2-gadget-don-t-write-invalid-mapped-sg-entrie.patch +pci-introduce-pci_resource_n.patch +platform-x86-p2sb-make-p2sb_get_devfn-return-void.patch +p2sb-factor-out-p2sb_read_from_cache.patch +p2sb-introduce-the-global-flag-p2sb_hidden_by_bios.patch +p2sb-move-p2sb-hide-and-unhide-code-to-p2sb_scan_and.patch +p2sb-do-not-scan-and-remove-the-p2sb-device-when-it-.patch +i2c-pnx-fix-timeout-in-wait-functions.patch diff --git a/queue-6.1/usb-cdns3-add-quirk-flag-to-enable-suspend-residency.patch b/queue-6.1/usb-cdns3-add-quirk-flag-to-enable-suspend-residency.patch new file mode 100644 index 00000000000..9b54609e4aa --- /dev/null +++ b/queue-6.1/usb-cdns3-add-quirk-flag-to-enable-suspend-residency.patch @@ -0,0 +1,86 @@ +From 5db31b9adac3e874199c9ab7712e8444aafabca3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 28 Jul 2024 12:07:47 -0400 +Subject: usb: cdns3: Add quirk flag to enable suspend residency + +From: Roger Quadros + +[ Upstream commit 0aca19e4037a4143273e90f1b44666b78b4dde9b ] + +Some platforms (e.g. ti,j721e-usb, ti,am64-usb) require +this bit to be set to workaround a lockup issue with PHY +short suspend intervals [1]. Add a platform quirk flag +to indicate if Suspend Residency should be enabled. + +[1] - https://www.ti.com/lit/er/sprz457h/sprz457h.pdf +i2409 - USB: USB2 PHY locks up due to short suspend + +Signed-off-by: Roger Quadros +Signed-off-by: Ravi Gunasekaran +Acked-by: Peter Chen +Link: https://lore.kernel.org/r/20240516044537.16801-2-r-gunasekaran@ti.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/cdns3/core.h | 1 + + drivers/usb/cdns3/drd.c | 10 +++++++++- + drivers/usb/cdns3/drd.h | 3 +++ + 3 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/drivers/usb/cdns3/core.h b/drivers/usb/cdns3/core.h +index 81a9c9d6be08..57d47348dc19 100644 +--- a/drivers/usb/cdns3/core.h ++++ b/drivers/usb/cdns3/core.h +@@ -44,6 +44,7 @@ struct cdns3_platform_data { + bool suspend, bool wakeup); + unsigned long quirks; + #define CDNS3_DEFAULT_PM_RUNTIME_ALLOW BIT(0) ++#define CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE BIT(1) + }; + + /** +diff --git a/drivers/usb/cdns3/drd.c b/drivers/usb/cdns3/drd.c +index 33ba30f79b33..8e19ee72c120 100644 +--- a/drivers/usb/cdns3/drd.c ++++ b/drivers/usb/cdns3/drd.c +@@ -385,7 +385,7 @@ static irqreturn_t cdns_drd_irq(int irq, void *data) + int cdns_drd_init(struct cdns *cdns) + { + void __iomem *regs; +- u32 state; ++ u32 state, reg; + int ret; + + regs = devm_ioremap_resource(cdns->dev, &cdns->otg_res); +@@ -429,6 +429,14 @@ int cdns_drd_init(struct cdns *cdns) + cdns->otg_irq_regs = (struct cdns_otg_irq_regs __iomem *) + &cdns->otg_v1_regs->ien; + writel(1, &cdns->otg_v1_regs->simulate); ++ ++ if (cdns->pdata && ++ (cdns->pdata->quirks & CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE)) { ++ reg = readl(&cdns->otg_v1_regs->susp_ctrl); ++ reg |= SUSP_CTRL_SUSPEND_RESIDENCY_ENABLE; ++ writel(reg, &cdns->otg_v1_regs->susp_ctrl); ++ } ++ + cdns->version = CDNS3_CONTROLLER_V1; + } else { + dev_err(cdns->dev, "not supporte DID=0x%08x\n", state); +diff --git a/drivers/usb/cdns3/drd.h b/drivers/usb/cdns3/drd.h +index d72370c321d3..1e2aee14d629 100644 +--- a/drivers/usb/cdns3/drd.h ++++ b/drivers/usb/cdns3/drd.h +@@ -193,6 +193,9 @@ struct cdns_otg_irq_regs { + /* OTGREFCLK - bitmasks */ + #define OTGREFCLK_STB_CLK_SWITCH_EN BIT(31) + ++/* SUPS_CTRL - bitmasks */ ++#define SUSP_CTRL_SUSPEND_RESIDENCY_ENABLE BIT(17) ++ + /* OVERRIDE - bitmasks */ + #define OVERRIDE_IDPULLUP BIT(0) + /* Only for CDNS3_CONTROLLER_V0 version */ +-- +2.39.5 + diff --git a/queue-6.1/usb-dwc2-gadget-don-t-write-invalid-mapped-sg-entrie.patch b/queue-6.1/usb-dwc2-gadget-don-t-write-invalid-mapped-sg-entrie.patch new file mode 100644 index 00000000000..017fe7f8219 --- /dev/null +++ b/queue-6.1/usb-dwc2-gadget-don-t-write-invalid-mapped-sg-entrie.patch @@ -0,0 +1,56 @@ +From c3017db311cf79d599a2563dd307654fc0dacdea Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 28 Jul 2024 12:07:48 -0400 +Subject: usb: dwc2: gadget: Don't write invalid mapped sg entries into + dma_desc with iommu enabled + +From: Peng Hongchi + +[ Upstream commit 1134289b6b93d73721340b66c310fd985385e8fa ] + +When using dma_map_sg() to map the scatterlist with iommu enabled, +the entries in the scatterlist can be mergerd into less but longer +entries in the function __finalise_sg(). So that the number of +valid mapped entries is actually smaller than ureq->num_reqs,and +there are still some invalid entries in the scatterlist with +dma_addr=0xffffffff and len=0. Writing these invalid sg entries +into the dma_desc can cause a data transmission error. + +The function dma_map_sg() returns the number of valid map entries +and the return value is assigned to usb_request::num_mapped_sgs in +function usb_gadget_map_request_by_dev(). So that just write valid +mapped entries into dma_desc according to the usb_request::num_mapped_sgs, +and set the IOC bit if it's the last valid mapped entry. + +This patch poses no risk to no-iommu situation, cause +ureq->num_mapped_sgs equals ureq->num_sgs while using dma_direct_map_sg() +to map the scatterlist whith iommu disabled. + +Signed-off-by: Peng Hongchi +Link: https://lore.kernel.org/r/20240523100315.7226-1-hongchi.peng@siengine.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/dwc2/gadget.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c +index cb29f9fae2f2..1c8141d80e25 100644 +--- a/drivers/usb/dwc2/gadget.c ++++ b/drivers/usb/dwc2/gadget.c +@@ -886,10 +886,10 @@ static void dwc2_gadget_config_nonisoc_xfer_ddma(struct dwc2_hsotg_ep *hs_ep, + } + + /* DMA sg buffer */ +- for_each_sg(ureq->sg, sg, ureq->num_sgs, i) { ++ for_each_sg(ureq->sg, sg, ureq->num_mapped_sgs, i) { + dwc2_gadget_fill_nonisoc_xfer_ddma_one(hs_ep, &desc, + sg_dma_address(sg) + sg->offset, sg_dma_len(sg), +- sg_is_last(sg)); ++ (i == (ureq->num_mapped_sgs - 1))); + desc_count += hs_ep->desc_count; + } + +-- +2.39.5 +