From: Greg Kroah-Hartman Date: Wed, 12 Jun 2024 18:29:35 +0000 (+0200) Subject: 6.1-stable patches X-Git-Tag: v4.19.316~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dc43350dad9afededd65a94629ec08fd1bcbb826;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches added patches: arm64-dts-hi3798cv200-fix-the-size-of-gicr.patch drm-amdgpu-atomfirmware-add-intergrated-info-v2.3-table.patch fbdev-savage-handle-err-return-when-savagefb_check_var-failed.patch media-mc-fix-graph-walk-in-media_pipeline_start.patch media-mc-mark-the-media-devnode-as-registered-from-the-start.patch media-mxl5xx-move-xpt-structures-off-stack.patch media-v4l2-core-hold-videodev_lock-until-dev-reg-finishes.patch mmc-core-add-mmc_gpiod_set_cd_config-function.patch mmc-sdhci-acpi-add-quirk-to-enable-pull-up-on-the-card-detect-gpio-on-asus-t100ta.patch mmc-sdhci-acpi-disable-write-protect-detection-on-toshiba-wt10-a.patch mmc-sdhci-acpi-fix-lenovo-yoga-tablet-2-pro-1380-sdcard-slot-not-working.patch mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch mmc-sdhci-add-support-for-tuning-error-interrupts.patch wifi-rtl8xxxu-fix-the-tx-power-of-rtl8192cu-rtl8723au.patch wifi-rtlwifi-rtl8192de-fix-5-ghz-tx-power.patch wifi-rtlwifi-rtl8192de-fix-endianness-issue-in-rx-path.patch wifi-rtlwifi-rtl8192de-fix-low-speed-with-wpa3-sae.patch wifi-rtw89-pci-correct-tx-resource-checking-for-pci-dma-channel-of-firmware-command.patch --- diff --git a/queue-6.1/arm64-dts-hi3798cv200-fix-the-size-of-gicr.patch b/queue-6.1/arm64-dts-hi3798cv200-fix-the-size-of-gicr.patch new file mode 100644 index 00000000000..298c790a579 --- /dev/null +++ b/queue-6.1/arm64-dts-hi3798cv200-fix-the-size-of-gicr.patch @@ -0,0 +1,43 @@ +From 428a575dc9038846ad259466d5ba109858c0a023 Mon Sep 17 00:00:00 2001 +From: Yang Xiwen +Date: Mon, 19 Feb 2024 23:05:26 +0800 +Subject: arm64: dts: hi3798cv200: fix the size of GICR + +From: Yang Xiwen + +commit 428a575dc9038846ad259466d5ba109858c0a023 upstream. + +During boot, Linux kernel complains: + +[ 0.000000] GIC: GICv2 detected, but range too small and irqchip.gicv2_force_probe not set + +This SoC is using a regular GIC-400 and the GICR space size should be +8KB rather than 256B. + +With this patch: + +[ 0.000000] GIC: Using split EOI/Deactivate mode + +So this should be the correct fix. + +Fixes: 2f20182ed670 ("arm64: dts: hisilicon: add dts files for hi3798cv200-poplar board") +Signed-off-by: Yang Xiwen +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20240219-cache-v3-1-a33c57534ae9@outlook.com +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/boot/dts/hisilicon/hi3798cv200.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/hisilicon/hi3798cv200.dtsi ++++ b/arch/arm64/boot/dts/hisilicon/hi3798cv200.dtsi +@@ -58,7 +58,7 @@ + gic: interrupt-controller@f1001000 { + compatible = "arm,gic-400"; + reg = <0x0 0xf1001000 0x0 0x1000>, /* GICD */ +- <0x0 0xf1002000 0x0 0x100>; /* GICC */ ++ <0x0 0xf1002000 0x0 0x2000>; /* GICC */ + #address-cells = <0>; + #interrupt-cells = <3>; + interrupt-controller; diff --git a/queue-6.1/drm-amdgpu-atomfirmware-add-intergrated-info-v2.3-table.patch b/queue-6.1/drm-amdgpu-atomfirmware-add-intergrated-info-v2.3-table.patch new file mode 100644 index 00000000000..7698153a4ea --- /dev/null +++ b/queue-6.1/drm-amdgpu-atomfirmware-add-intergrated-info-v2.3-table.patch @@ -0,0 +1,111 @@ +From e64e8f7c178e5228e0b2dbb504b9dc75953a319f Mon Sep 17 00:00:00 2001 +From: Li Ma +Date: Mon, 20 May 2024 18:43:55 +0800 +Subject: drm/amdgpu/atomfirmware: add intergrated info v2.3 table + +From: Li Ma + +commit e64e8f7c178e5228e0b2dbb504b9dc75953a319f upstream. + +[Why] +The vram width value is 0. +Because the integratedsysteminfo table in VBIOS has updated to 2.3. + +[How] +Driver needs a new intergrated info v2.3 table too. +Then the vram width value will be correct. + +Signed-off-by: Li Ma +Reviewed-by: Yifan Zhang +Acked-by: Alex Deucher +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 15 ++++++++ + drivers/gpu/drm/amd/include/atomfirmware.h | 43 +++++++++++++++++++++++ + 2 files changed, 58 insertions(+) + +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c +@@ -207,6 +207,7 @@ union igp_info { + struct atom_integrated_system_info_v1_11 v11; + struct atom_integrated_system_info_v1_12 v12; + struct atom_integrated_system_info_v2_1 v21; ++ struct atom_integrated_system_info_v2_3 v23; + }; + + union umc_info { +@@ -347,6 +348,20 @@ amdgpu_atomfirmware_get_vram_info(struct + if (vram_type) + *vram_type = convert_atom_mem_type_to_vram_type(adev, mem_type); + break; ++ case 3: ++ mem_channel_number = igp_info->v23.umachannelnumber; ++ if (!mem_channel_number) ++ mem_channel_number = 1; ++ mem_type = igp_info->v23.memorytype; ++ if (mem_type == LpDdr5MemType) ++ mem_channel_width = 32; ++ else ++ mem_channel_width = 64; ++ if (vram_width) ++ *vram_width = mem_channel_number * mem_channel_width; ++ if (vram_type) ++ *vram_type = convert_atom_mem_type_to_vram_type(adev, mem_type); ++ break; + default: + return -EINVAL; + } +--- a/drivers/gpu/drm/amd/include/atomfirmware.h ++++ b/drivers/gpu/drm/amd/include/atomfirmware.h +@@ -1624,6 +1624,49 @@ struct atom_integrated_system_info_v2_2 + uint32_t reserved4[189]; + }; + ++struct uma_carveout_option { ++ char optionName[29]; //max length of string is 28chars + '\0'. Current design is for "minimum", "Medium", "High". This makes entire struct size 64bits ++ uint8_t memoryCarvedGb; //memory carved out with setting ++ uint8_t memoryRemainingGb; //memory remaining on system ++ union { ++ struct _flags { ++ uint8_t Auto : 1; ++ uint8_t Custom : 1; ++ uint8_t Reserved : 6; ++ } flags; ++ uint8_t all8; ++ } uma_carveout_option_flags; ++}; ++ ++struct atom_integrated_system_info_v2_3 { ++ struct atom_common_table_header table_header; ++ uint32_t vbios_misc; // enum of atom_system_vbiosmisc_def ++ uint32_t gpucapinfo; // enum of atom_system_gpucapinf_def ++ uint32_t system_config; ++ uint32_t cpucapinfo; ++ uint16_t gpuclk_ss_percentage; // unit of 0.001%, 1000 mean 1% ++ uint16_t gpuclk_ss_type; ++ uint16_t dpphy_override; // bit vector, enum of atom_sysinfo_dpphy_override_def ++ uint8_t memorytype; // enum of atom_dmi_t17_mem_type_def, APU memory type indication. ++ uint8_t umachannelnumber; // number of memory channels ++ uint8_t htc_hyst_limit; ++ uint8_t htc_tmp_limit; ++ uint8_t reserved1; // dp_ss_control ++ uint8_t gpu_package_id; ++ struct edp_info_table edp1_info; ++ struct edp_info_table edp2_info; ++ uint32_t reserved2[8]; ++ struct atom_external_display_connection_info extdispconninfo; ++ uint8_t UMACarveoutVersion; ++ uint8_t UMACarveoutIndexMax; ++ uint8_t UMACarveoutTypeDefault; ++ uint8_t UMACarveoutIndexDefault; ++ uint8_t UMACarveoutType; //Auto or Custom ++ uint8_t UMACarveoutIndex; ++ struct uma_carveout_option UMASizeControlOption[20]; ++ uint8_t reserved3[110]; ++}; ++ + // system_config + enum atom_system_vbiosmisc_def{ + INTEGRATED_SYSTEM_INFO__GET_EDID_CALLBACK_FUNC_SUPPORT = 0x01, diff --git a/queue-6.1/fbdev-savage-handle-err-return-when-savagefb_check_var-failed.patch b/queue-6.1/fbdev-savage-handle-err-return-when-savagefb_check_var-failed.patch new file mode 100644 index 00000000000..c66c93ef3cf --- /dev/null +++ b/queue-6.1/fbdev-savage-handle-err-return-when-savagefb_check_var-failed.patch @@ -0,0 +1,37 @@ +From 6ad959b6703e2c4c5d7af03b4cfd5ff608036339 Mon Sep 17 00:00:00 2001 +From: Cai Xinchen +Date: Tue, 16 Apr 2024 06:51:37 +0000 +Subject: fbdev: savage: Handle err return when savagefb_check_var failed + +From: Cai Xinchen + +commit 6ad959b6703e2c4c5d7af03b4cfd5ff608036339 upstream. + +The commit 04e5eac8f3ab("fbdev: savage: Error out if pixclock equals zero") +checks the value of pixclock to avoid divide-by-zero error. However +the function savagefb_probe doesn't handle the error return of +savagefb_check_var. When pixclock is 0, it will cause divide-by-zero error. + +Fixes: 04e5eac8f3ab ("fbdev: savage: Error out if pixclock equals zero") +Signed-off-by: Cai Xinchen +Cc: stable@vger.kernel.org +Signed-off-by: Helge Deller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/video/fbdev/savage/savagefb_driver.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/video/fbdev/savage/savagefb_driver.c ++++ b/drivers/video/fbdev/savage/savagefb_driver.c +@@ -2277,7 +2277,10 @@ static int savagefb_probe(struct pci_dev + if (info->var.xres_virtual > 0x1000) + info->var.xres_virtual = 0x1000; + #endif +- savagefb_check_var(&info->var, info); ++ err = savagefb_check_var(&info->var, info); ++ if (err) ++ goto failed; ++ + savagefb_set_fix(info); + + /* diff --git a/queue-6.1/media-mc-fix-graph-walk-in-media_pipeline_start.patch b/queue-6.1/media-mc-fix-graph-walk-in-media_pipeline_start.patch new file mode 100644 index 00000000000..08e698a3869 --- /dev/null +++ b/queue-6.1/media-mc-fix-graph-walk-in-media_pipeline_start.patch @@ -0,0 +1,40 @@ +From 8a9d420149c477e7c97fbd6453704e4612bdd3fa Mon Sep 17 00:00:00 2001 +From: Tomi Valkeinen +Date: Mon, 18 Mar 2024 11:50:59 +0200 +Subject: media: mc: Fix graph walk in media_pipeline_start + +From: Tomi Valkeinen + +commit 8a9d420149c477e7c97fbd6453704e4612bdd3fa upstream. + +The graph walk tries to follow all links, even if they are not between +pads. This causes a crash with, e.g. a MEDIA_LNK_FL_ANCILLARY_LINK link. + +Fix this by allowing the walk to proceed only for MEDIA_LNK_FL_DATA_LINK +links. + +Signed-off-by: Tomi Valkeinen +Cc: stable@vger.kernel.org # for 6.1 and later +Fixes: ae219872834a ("media: mc: entity: Rewrite media_pipeline_start()") +Signed-off-by: Sakari Ailus +Signed-off-by: Hans Verkuil +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/mc/mc-entity.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/media/mc/mc-entity.c ++++ b/drivers/media/mc/mc-entity.c +@@ -593,6 +593,12 @@ static int media_pipeline_explore_next_l + link = list_entry(entry->links, typeof(*link), list); + last_link = media_pipeline_walk_pop(walk); + ++ if ((link->flags & MEDIA_LNK_FL_LINK_TYPE) != MEDIA_LNK_FL_DATA_LINK) { ++ dev_dbg(walk->mdev->dev, ++ "media pipeline: skipping link (not data-link)\n"); ++ return 0; ++ } ++ + dev_dbg(walk->mdev->dev, + "media pipeline: exploring link '%s':%u -> '%s':%u\n", + link->source->entity->name, link->source->index, diff --git a/queue-6.1/media-mc-mark-the-media-devnode-as-registered-from-the-start.patch b/queue-6.1/media-mc-mark-the-media-devnode-as-registered-from-the-start.patch new file mode 100644 index 00000000000..189e373677c --- /dev/null +++ b/queue-6.1/media-mc-mark-the-media-devnode-as-registered-from-the-start.patch @@ -0,0 +1,48 @@ +From 4bc60736154bc9e0e39d3b88918f5d3762ebe5e0 Mon Sep 17 00:00:00 2001 +From: Hans Verkuil +Date: Fri, 23 Feb 2024 09:46:19 +0100 +Subject: media: mc: mark the media devnode as registered from the, start + +From: Hans Verkuil + +commit 4bc60736154bc9e0e39d3b88918f5d3762ebe5e0 upstream. + +First the media device node was created, and if successful it was +marked as 'registered'. This leaves a small race condition where +an application can open the device node and get an error back +because the 'registered' flag was not yet set. + +Change the order: first set the 'registered' flag, then actually +register the media device node. If that fails, then clear the flag. + +Signed-off-by: Hans Verkuil +Acked-by: Sakari Ailus +Reviewed-by: Laurent Pinchart +Fixes: cf4b9211b568 ("[media] media: Media device node support") +Cc: stable@vger.kernel.org +Signed-off-by: Sakari Ailus +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/mc/mc-devnode.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +--- a/drivers/media/mc/mc-devnode.c ++++ b/drivers/media/mc/mc-devnode.c +@@ -246,15 +246,14 @@ int __must_check media_devnode_register( + kobject_set_name(&devnode->cdev.kobj, "media%d", devnode->minor); + + /* Part 3: Add the media and char device */ ++ set_bit(MEDIA_FLAG_REGISTERED, &devnode->flags); + ret = cdev_device_add(&devnode->cdev, &devnode->dev); + if (ret < 0) { ++ clear_bit(MEDIA_FLAG_REGISTERED, &devnode->flags); + pr_err("%s: cdev_device_add failed\n", __func__); + goto cdev_add_error; + } + +- /* Part 4: Activate this minor. The char device can now be used. */ +- set_bit(MEDIA_FLAG_REGISTERED, &devnode->flags); +- + return 0; + + cdev_add_error: diff --git a/queue-6.1/media-mxl5xx-move-xpt-structures-off-stack.patch b/queue-6.1/media-mxl5xx-move-xpt-structures-off-stack.patch new file mode 100644 index 00000000000..03cd2feabf6 --- /dev/null +++ b/queue-6.1/media-mxl5xx-move-xpt-structures-off-stack.patch @@ -0,0 +1,115 @@ +From 526f4527545b2d4ce0733733929fac7b6da09ac6 Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor +Date: Fri, 12 Jan 2024 00:40:36 +0000 +Subject: media: mxl5xx: Move xpt structures off stack + +From: Nathan Chancellor + +commit 526f4527545b2d4ce0733733929fac7b6da09ac6 upstream. + +When building for LoongArch with clang 18.0.0, the stack usage of +probe() is larger than the allowed 2048 bytes: + + drivers/media/dvb-frontends/mxl5xx.c:1698:12: warning: stack frame size (2368) exceeds limit (2048) in 'probe' [-Wframe-larger-than] + 1698 | static int probe(struct mxl *state, struct mxl5xx_cfg *cfg) + | ^ + 1 warning generated. + +This is the result of the linked LLVM commit, which changes how the +arrays of structures in config_ts() get handled with +CONFIG_INIT_STACK_ZERO and CONFIG_INIT_STACK_PATTERN, which causes the +above warning in combination with inlining, as config_ts() gets inlined +into probe(). + +This warning can be easily fixed by moving the array of structures off +of the stackvia 'static const', which is a better location for these +variables anyways because they are static data that is only ever read +from, never modified, so allocating the stack space is wasteful. + +This drops the stack usage from 2368 bytes to 256 bytes with the same +compiler and configuration. + +Link: https://lore.kernel.org/linux-media/20240111-dvb-mxl5xx-move-structs-off-stack-v1-1-ca4230e67c11@kernel.org +Cc: stable@vger.kernel.org +Closes: https://github.com/ClangBuiltLinux/linux/issues/1977 +Link: https://github.com/llvm/llvm-project/commit/afe8b93ffdfef5d8879e1894b9d7dda40dee2b8d +Signed-off-by: Nathan Chancellor +Reviewed-by: Miguel Ojeda +Tested-by: Miguel Ojeda +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/dvb-frontends/mxl5xx.c | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +--- a/drivers/media/dvb-frontends/mxl5xx.c ++++ b/drivers/media/dvb-frontends/mxl5xx.c +@@ -1381,57 +1381,57 @@ static int config_ts(struct mxl *state, + u32 nco_count_min = 0; + u32 clk_type = 0; + +- struct MXL_REG_FIELD_T xpt_sync_polarity[MXL_HYDRA_DEMOD_MAX] = { ++ static const struct MXL_REG_FIELD_T xpt_sync_polarity[MXL_HYDRA_DEMOD_MAX] = { + {0x90700010, 8, 1}, {0x90700010, 9, 1}, + {0x90700010, 10, 1}, {0x90700010, 11, 1}, + {0x90700010, 12, 1}, {0x90700010, 13, 1}, + {0x90700010, 14, 1}, {0x90700010, 15, 1} }; +- struct MXL_REG_FIELD_T xpt_clock_polarity[MXL_HYDRA_DEMOD_MAX] = { ++ static const struct MXL_REG_FIELD_T xpt_clock_polarity[MXL_HYDRA_DEMOD_MAX] = { + {0x90700010, 16, 1}, {0x90700010, 17, 1}, + {0x90700010, 18, 1}, {0x90700010, 19, 1}, + {0x90700010, 20, 1}, {0x90700010, 21, 1}, + {0x90700010, 22, 1}, {0x90700010, 23, 1} }; +- struct MXL_REG_FIELD_T xpt_valid_polarity[MXL_HYDRA_DEMOD_MAX] = { ++ static const struct MXL_REG_FIELD_T xpt_valid_polarity[MXL_HYDRA_DEMOD_MAX] = { + {0x90700014, 0, 1}, {0x90700014, 1, 1}, + {0x90700014, 2, 1}, {0x90700014, 3, 1}, + {0x90700014, 4, 1}, {0x90700014, 5, 1}, + {0x90700014, 6, 1}, {0x90700014, 7, 1} }; +- struct MXL_REG_FIELD_T xpt_ts_clock_phase[MXL_HYDRA_DEMOD_MAX] = { ++ static const struct MXL_REG_FIELD_T xpt_ts_clock_phase[MXL_HYDRA_DEMOD_MAX] = { + {0x90700018, 0, 3}, {0x90700018, 4, 3}, + {0x90700018, 8, 3}, {0x90700018, 12, 3}, + {0x90700018, 16, 3}, {0x90700018, 20, 3}, + {0x90700018, 24, 3}, {0x90700018, 28, 3} }; +- struct MXL_REG_FIELD_T xpt_lsb_first[MXL_HYDRA_DEMOD_MAX] = { ++ static const struct MXL_REG_FIELD_T xpt_lsb_first[MXL_HYDRA_DEMOD_MAX] = { + {0x9070000C, 16, 1}, {0x9070000C, 17, 1}, + {0x9070000C, 18, 1}, {0x9070000C, 19, 1}, + {0x9070000C, 20, 1}, {0x9070000C, 21, 1}, + {0x9070000C, 22, 1}, {0x9070000C, 23, 1} }; +- struct MXL_REG_FIELD_T xpt_sync_byte[MXL_HYDRA_DEMOD_MAX] = { ++ static const struct MXL_REG_FIELD_T xpt_sync_byte[MXL_HYDRA_DEMOD_MAX] = { + {0x90700010, 0, 1}, {0x90700010, 1, 1}, + {0x90700010, 2, 1}, {0x90700010, 3, 1}, + {0x90700010, 4, 1}, {0x90700010, 5, 1}, + {0x90700010, 6, 1}, {0x90700010, 7, 1} }; +- struct MXL_REG_FIELD_T xpt_enable_output[MXL_HYDRA_DEMOD_MAX] = { ++ static const struct MXL_REG_FIELD_T xpt_enable_output[MXL_HYDRA_DEMOD_MAX] = { + {0x9070000C, 0, 1}, {0x9070000C, 1, 1}, + {0x9070000C, 2, 1}, {0x9070000C, 3, 1}, + {0x9070000C, 4, 1}, {0x9070000C, 5, 1}, + {0x9070000C, 6, 1}, {0x9070000C, 7, 1} }; +- struct MXL_REG_FIELD_T xpt_err_replace_sync[MXL_HYDRA_DEMOD_MAX] = { ++ static const struct MXL_REG_FIELD_T xpt_err_replace_sync[MXL_HYDRA_DEMOD_MAX] = { + {0x9070000C, 24, 1}, {0x9070000C, 25, 1}, + {0x9070000C, 26, 1}, {0x9070000C, 27, 1}, + {0x9070000C, 28, 1}, {0x9070000C, 29, 1}, + {0x9070000C, 30, 1}, {0x9070000C, 31, 1} }; +- struct MXL_REG_FIELD_T xpt_err_replace_valid[MXL_HYDRA_DEMOD_MAX] = { ++ static const struct MXL_REG_FIELD_T xpt_err_replace_valid[MXL_HYDRA_DEMOD_MAX] = { + {0x90700014, 8, 1}, {0x90700014, 9, 1}, + {0x90700014, 10, 1}, {0x90700014, 11, 1}, + {0x90700014, 12, 1}, {0x90700014, 13, 1}, + {0x90700014, 14, 1}, {0x90700014, 15, 1} }; +- struct MXL_REG_FIELD_T xpt_continuous_clock[MXL_HYDRA_DEMOD_MAX] = { ++ static const struct MXL_REG_FIELD_T xpt_continuous_clock[MXL_HYDRA_DEMOD_MAX] = { + {0x907001D4, 0, 1}, {0x907001D4, 1, 1}, + {0x907001D4, 2, 1}, {0x907001D4, 3, 1}, + {0x907001D4, 4, 1}, {0x907001D4, 5, 1}, + {0x907001D4, 6, 1}, {0x907001D4, 7, 1} }; +- struct MXL_REG_FIELD_T xpt_nco_clock_rate[MXL_HYDRA_DEMOD_MAX] = { ++ static const struct MXL_REG_FIELD_T xpt_nco_clock_rate[MXL_HYDRA_DEMOD_MAX] = { + {0x90700044, 16, 80}, {0x90700044, 16, 81}, + {0x90700044, 16, 82}, {0x90700044, 16, 83}, + {0x90700044, 16, 84}, {0x90700044, 16, 85}, diff --git a/queue-6.1/media-v4l2-core-hold-videodev_lock-until-dev-reg-finishes.patch b/queue-6.1/media-v4l2-core-hold-videodev_lock-until-dev-reg-finishes.patch new file mode 100644 index 00000000000..c61a6ca6080 --- /dev/null +++ b/queue-6.1/media-v4l2-core-hold-videodev_lock-until-dev-reg-finishes.patch @@ -0,0 +1,50 @@ +From 1ed4477f2ea4743e7c5e1f9f3722152d14e6eeb1 Mon Sep 17 00:00:00 2001 +From: Hans Verkuil +Date: Fri, 23 Feb 2024 09:45:36 +0100 +Subject: media: v4l2-core: hold videodev_lock until dev reg, finishes + +From: Hans Verkuil + +commit 1ed4477f2ea4743e7c5e1f9f3722152d14e6eeb1 upstream. + +After the new V4L2 device node was registered, some additional +initialization was done before the device node was marked as +'registered'. During the time between creating the device node +and marking it as 'registered' it was possible to open the +device node, which would return -ENODEV since the 'registered' +flag was not yet set. + +Hold the videodev_lock mutex from just before the device node +is registered until the 'registered' flag is set. Since v4l2_open +will take the same lock, it will wait until this registration +process is finished. This resolves this race condition. + +Signed-off-by: Hans Verkuil +Reviewed-by: Sakari Ailus +Cc: # for vi4.18 and up +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/v4l2-core/v4l2-dev.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/media/v4l2-core/v4l2-dev.c ++++ b/drivers/media/v4l2-core/v4l2-dev.c +@@ -1033,8 +1033,10 @@ int __video_register_device(struct video + vdev->dev.devt = MKDEV(VIDEO_MAJOR, vdev->minor); + vdev->dev.parent = vdev->dev_parent; + dev_set_name(&vdev->dev, "%s%d", name_base, vdev->num); ++ mutex_lock(&videodev_lock); + ret = device_register(&vdev->dev); + if (ret < 0) { ++ mutex_unlock(&videodev_lock); + pr_err("%s: device_register failed\n", __func__); + goto cleanup; + } +@@ -1054,6 +1056,7 @@ int __video_register_device(struct video + + /* Part 6: Activate this minor. The char device can now be used. */ + set_bit(V4L2_FL_REGISTERED, &vdev->flags); ++ mutex_unlock(&videodev_lock); + + return 0; + diff --git a/queue-6.1/mmc-core-add-mmc_gpiod_set_cd_config-function.patch b/queue-6.1/mmc-core-add-mmc_gpiod_set_cd_config-function.patch new file mode 100644 index 00000000000..c15b25cf829 --- /dev/null +++ b/queue-6.1/mmc-core-add-mmc_gpiod_set_cd_config-function.patch @@ -0,0 +1,71 @@ +From 63a7cd660246aa36af263b85c33ecc6601bf04be Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 10 Apr 2024 21:16:34 +0200 +Subject: mmc: core: Add mmc_gpiod_set_cd_config() function + +From: Hans de Goede + +commit 63a7cd660246aa36af263b85c33ecc6601bf04be upstream. + +Some mmc host drivers may need to fixup a card-detection GPIO's config +to e.g. enable the GPIO controllers builtin pull-up resistor on devices +where the firmware description of the GPIO is broken (e.g. GpioInt with +PullNone instead of PullUp in ACPI DSDT). + +Since this is the exception rather then the rule adding a config +parameter to mmc_gpiod_request_cd() seems undesirable, so instead +add a new mmc_gpiod_set_cd_config() function. This is simply a wrapper +to call gpiod_set_config() on the card-detect GPIO acquired through +mmc_gpiod_request_cd(). + +Reviewed-by: Andy Shevchenko +Signed-off-by: Hans de Goede +Acked-by: Adrian Hunter +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20240410191639.526324-2-hdegoede@redhat.com +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/core/slot-gpio.c | 20 ++++++++++++++++++++ + include/linux/mmc/slot-gpio.h | 1 + + 2 files changed, 21 insertions(+) + +--- a/drivers/mmc/core/slot-gpio.c ++++ b/drivers/mmc/core/slot-gpio.c +@@ -206,6 +206,26 @@ int mmc_gpiod_request_cd(struct mmc_host + } + EXPORT_SYMBOL(mmc_gpiod_request_cd); + ++/** ++ * mmc_gpiod_set_cd_config - set config for card-detection GPIO ++ * @host: mmc host ++ * @config: Generic pinconf config (from pinconf_to_config_packed()) ++ * ++ * This can be used by mmc host drivers to fixup a card-detection GPIO's config ++ * (e.g. set PIN_CONFIG_BIAS_PULL_UP) after acquiring the GPIO descriptor ++ * through mmc_gpiod_request_cd(). ++ * ++ * Returns: ++ * 0 on success, or a negative errno value on error. ++ */ ++int mmc_gpiod_set_cd_config(struct mmc_host *host, unsigned long config) ++{ ++ struct mmc_gpio *ctx = host->slot.handler_priv; ++ ++ return gpiod_set_config(ctx->cd_gpio, config); ++} ++EXPORT_SYMBOL(mmc_gpiod_set_cd_config); ++ + bool mmc_can_gpio_cd(struct mmc_host *host) + { + struct mmc_gpio *ctx = host->slot.handler_priv; +--- a/include/linux/mmc/slot-gpio.h ++++ b/include/linux/mmc/slot-gpio.h +@@ -20,6 +20,7 @@ int mmc_gpiod_request_cd(struct mmc_host + unsigned int debounce); + int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id, + unsigned int idx, unsigned int debounce); ++int mmc_gpiod_set_cd_config(struct mmc_host *host, unsigned long config); + void mmc_gpio_set_cd_isr(struct mmc_host *host, + irqreturn_t (*isr)(int irq, void *dev_id)); + int mmc_gpio_set_cd_wake(struct mmc_host *host, bool on); diff --git a/queue-6.1/mmc-sdhci-acpi-add-quirk-to-enable-pull-up-on-the-card-detect-gpio-on-asus-t100ta.patch b/queue-6.1/mmc-sdhci-acpi-add-quirk-to-enable-pull-up-on-the-card-detect-gpio-on-asus-t100ta.patch new file mode 100644 index 00000000000..a887e2d2b38 --- /dev/null +++ b/queue-6.1/mmc-sdhci-acpi-add-quirk-to-enable-pull-up-on-the-card-detect-gpio-on-asus-t100ta.patch @@ -0,0 +1,89 @@ +From 431946c0f640c93421439a6c928efb3152c035a4 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 10 Apr 2024 21:16:39 +0200 +Subject: mmc: sdhci-acpi: Add quirk to enable pull-up on the card-detect GPIO on Asus T100TA + +From: Hans de Goede + +commit 431946c0f640c93421439a6c928efb3152c035a4 upstream. + +The card-detect GPIO for the microSD slot on Asus T100TA / T100TAM models +stopped working under Linux after commit 6fd03f024828 ("gpiolib: acpi: +support bias pull disable"). + +The GPIO in question is connected to a mechanical switch in the slot +which shorts the pin to GND when a card is inserted. + +The GPIO pin correctly gets configured with a 20K pull-up by the BIOS, +but there is a bug in the DSDT where the GpioInt for the card-detect is +configured with a PullNone setting: + + GpioInt (Edge, ActiveBoth, SharedAndWake, PullNone, 0x2710, + "\\_SB.GPO0", 0x00, ResourceConsumer, , + ) + { // Pin list + 0x0026 + } + +Linux now actually honors the PullNone setting and disables the 20K pull-up +configured by the BIOS. + +Add a new DMI_QUIRK_SD_CD_ENABLE_PULL_UP quirk which when set calls +mmc_gpiod_set_cd_config() to re-enable the pull-up and set this for +the Asus T100TA models to fix this. + +Fixes: 6fd03f024828 ("gpiolib: acpi: support bias pull disable") +Reviewed-by: Andy Shevchenko +Signed-off-by: Hans de Goede +Acked-by: Adrian Hunter +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20240410191639.526324-7-hdegoede@redhat.com +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/host/sdhci-acpi.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +--- a/drivers/mmc/host/sdhci-acpi.c ++++ b/drivers/mmc/host/sdhci-acpi.c +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -81,6 +82,7 @@ enum { + DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP = BIT(0), + DMI_QUIRK_SD_NO_WRITE_PROTECT = BIT(1), + DMI_QUIRK_SD_CD_ACTIVE_HIGH = BIT(2), ++ DMI_QUIRK_SD_CD_ENABLE_PULL_UP = BIT(3), + }; + + static inline void *sdhci_acpi_priv(struct sdhci_acpi_host *c) +@@ -735,6 +737,14 @@ static const struct dmi_system_id sdhci_ + .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT, + }, + { ++ /* Asus T100TA, needs pull-up for cd but DSDT GpioInt has NoPull set */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "T100TA"), ++ }, ++ .driver_data = (void *)DMI_QUIRK_SD_CD_ENABLE_PULL_UP, ++ }, ++ { + /* + * The Lenovo Miix 320-10ICR has a bug in the _PS0 method of + * the SHC1 ACPI device, this bug causes it to reprogram the +@@ -908,6 +918,9 @@ static int sdhci_acpi_probe(struct platf + goto err_free; + dev_warn(dev, "failed to setup card detect gpio\n"); + c->use_runtime_pm = false; ++ } else if (quirks & DMI_QUIRK_SD_CD_ENABLE_PULL_UP) { ++ mmc_gpiod_set_cd_config(host->mmc, ++ PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 20000)); + } + + if (quirks & DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP) diff --git a/queue-6.1/mmc-sdhci-acpi-disable-write-protect-detection-on-toshiba-wt10-a.patch b/queue-6.1/mmc-sdhci-acpi-disable-write-protect-detection-on-toshiba-wt10-a.patch new file mode 100644 index 00000000000..13f8a1e6071 --- /dev/null +++ b/queue-6.1/mmc-sdhci-acpi-disable-write-protect-detection-on-toshiba-wt10-a.patch @@ -0,0 +1,45 @@ +From ef3eab75e17191e5665f52e64e85bc29d5705a7b Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 10 Apr 2024 21:16:38 +0200 +Subject: mmc: sdhci-acpi: Disable write protect detection on Toshiba WT10-A + +From: Hans de Goede + +commit ef3eab75e17191e5665f52e64e85bc29d5705a7b upstream. + +On the Toshiba WT10-A the microSD slot always reports the card being +write-protected, just like on the Toshiba WT8-B. + +Add a DMI quirk to work around this. + +Reviewed-by: Andy Shevchenko +Signed-off-by: Hans de Goede +Acked-by: Adrian Hunter +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20240410191639.526324-6-hdegoede@redhat.com +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/host/sdhci-acpi.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/mmc/host/sdhci-acpi.c ++++ b/drivers/mmc/host/sdhci-acpi.c +@@ -779,6 +779,17 @@ static const struct dmi_system_id sdhci_ + }, + .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT, + }, ++ { ++ /* ++ * The Toshiba WT10-A's microSD slot always reports the card being ++ * write-protected. ++ */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "TOSHIBA WT10-A"), ++ }, ++ .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT, ++ }, + {} /* Terminating entry */ + }; + diff --git a/queue-6.1/mmc-sdhci-acpi-fix-lenovo-yoga-tablet-2-pro-1380-sdcard-slot-not-working.patch b/queue-6.1/mmc-sdhci-acpi-fix-lenovo-yoga-tablet-2-pro-1380-sdcard-slot-not-working.patch new file mode 100644 index 00000000000..b1836aa6b46 --- /dev/null +++ b/queue-6.1/mmc-sdhci-acpi-fix-lenovo-yoga-tablet-2-pro-1380-sdcard-slot-not-working.patch @@ -0,0 +1,72 @@ +From f3521d7cbaefff19cc656325787ed797e5f6a955 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 10 Apr 2024 21:16:37 +0200 +Subject: mmc: sdhci-acpi: Fix Lenovo Yoga Tablet 2 Pro 1380 sdcard slot not working + +From: Hans de Goede + +commit f3521d7cbaefff19cc656325787ed797e5f6a955 upstream. + +The Lenovo Yoga Tablet 2 Pro 1380 sdcard slot has an active high cd pin +and a broken wp pin which always reports the card being write-protected. + +Add a DMI quirk to address both issues. + +Reviewed-by: Andy Shevchenko +Signed-off-by: Hans de Goede +Acked-by: Adrian Hunter +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20240410191639.526324-5-hdegoede@redhat.com +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/host/sdhci-acpi.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +--- a/drivers/mmc/host/sdhci-acpi.c ++++ b/drivers/mmc/host/sdhci-acpi.c +@@ -80,6 +80,7 @@ struct sdhci_acpi_host { + enum { + DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP = BIT(0), + DMI_QUIRK_SD_NO_WRITE_PROTECT = BIT(1), ++ DMI_QUIRK_SD_CD_ACTIVE_HIGH = BIT(2), + }; + + static inline void *sdhci_acpi_priv(struct sdhci_acpi_host *c) +@@ -749,6 +750,26 @@ static const struct dmi_system_id sdhci_ + }, + { + /* ++ * Lenovo Yoga Tablet 2 Pro 1380F/L (13" Android version) this ++ * has broken WP reporting and an inverted CD signal. ++ * Note this has more or less the same BIOS as the Lenovo Yoga ++ * Tablet 2 830F/L or 1050F/L (8" and 10" Android), but unlike ++ * the 830 / 1050 models which share the same mainboard this ++ * model has a different mainboard and the inverted CD and ++ * broken WP are unique to this board. ++ */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Intel Corp."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "VALLEYVIEW C0 PLATFORM"), ++ DMI_MATCH(DMI_BOARD_NAME, "BYT-T FFD8"), ++ /* Full match so as to NOT match the 830/1050 BIOS */ ++ DMI_MATCH(DMI_BIOS_VERSION, "BLADE_21.X64.0005.R00.1504101516"), ++ }, ++ .driver_data = (void *)(DMI_QUIRK_SD_NO_WRITE_PROTECT | ++ DMI_QUIRK_SD_CD_ACTIVE_HIGH), ++ }, ++ { ++ /* + * The Toshiba WT8-B's microSD slot always reports the card being + * write-protected. + */ +@@ -867,6 +888,9 @@ static int sdhci_acpi_probe(struct platf + if (sdhci_acpi_flag(c, SDHCI_ACPI_SD_CD)) { + bool v = sdhci_acpi_flag(c, SDHCI_ACPI_SD_CD_OVERRIDE_LEVEL); + ++ if (quirks & DMI_QUIRK_SD_CD_ACTIVE_HIGH) ++ host->mmc->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH; ++ + err = mmc_gpiod_request_cd(host->mmc, NULL, 0, v, 0); + if (err) { + if (err == -EPROBE_DEFER) diff --git a/queue-6.1/mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch b/queue-6.1/mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch new file mode 100644 index 00000000000..1993f43e9e4 --- /dev/null +++ b/queue-6.1/mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch @@ -0,0 +1,66 @@ +From a92a73b1d9249d155412d8ac237142fa716803ea Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 10 Apr 2024 21:16:36 +0200 +Subject: mmc: sdhci-acpi: Sort DMI quirks alphabetically + +From: Hans de Goede + +commit a92a73b1d9249d155412d8ac237142fa716803ea upstream. + +Sort the DMI quirks alphabetically. + +Reviewed-by: Andy Shevchenko +Signed-off-by: Hans de Goede +Acked-by: Adrian Hunter +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20240410191639.526324-4-hdegoede@redhat.com +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/host/sdhci-acpi.c | 25 +++++++++++++------------ + 1 file changed, 13 insertions(+), 12 deletions(-) + +--- a/drivers/mmc/host/sdhci-acpi.c ++++ b/drivers/mmc/host/sdhci-acpi.c +@@ -719,9 +719,22 @@ static const struct acpi_device_id sdhci + }; + MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids); + ++/* Please keep this list sorted alphabetically */ + static const struct dmi_system_id sdhci_acpi_quirks[] = { + { + /* ++ * The Acer Aspire Switch 10 (SW5-012) microSD slot always ++ * reports the card being write-protected even though microSD ++ * cards do not have a write-protect switch at all. ++ */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"), ++ }, ++ .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT, ++ }, ++ { ++ /* + * The Lenovo Miix 320-10ICR has a bug in the _PS0 method of + * the SHC1 ACPI device, this bug causes it to reprogram the + * wrong LDO (DLDO3) to 1.8V if 1.8V modes are used and the +@@ -736,18 +749,6 @@ static const struct dmi_system_id sdhci_ + }, + { + /* +- * The Acer Aspire Switch 10 (SW5-012) microSD slot always +- * reports the card being write-protected even though microSD +- * cards do not have a write-protect switch at all. +- */ +- .matches = { +- DMI_MATCH(DMI_SYS_VENDOR, "Acer"), +- DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"), +- }, +- .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT, +- }, +- { +- /* + * The Toshiba WT8-B's microSD slot always reports the card being + * write-protected. + */ diff --git a/queue-6.1/mmc-sdhci-add-support-for-tuning-error-interrupts.patch b/queue-6.1/mmc-sdhci-add-support-for-tuning-error-interrupts.patch new file mode 100644 index 00000000000..8db0e70568b --- /dev/null +++ b/queue-6.1/mmc-sdhci-add-support-for-tuning-error-interrupts.patch @@ -0,0 +1,103 @@ +From b3855668d98cf9c6aec2db999dd27d872f8ba878 Mon Sep 17 00:00:00 2001 +From: Adrian Hunter +Date: Wed, 10 Apr 2024 21:16:35 +0200 +Subject: mmc: sdhci: Add support for "Tuning Error" interrupts + +From: Adrian Hunter + +commit b3855668d98cf9c6aec2db999dd27d872f8ba878 upstream. + +Most Bay Trail devices do not enable UHS modes for the external sdcard slot +the Lenovo Yoga Tablet 2 830 / 1050 and Lenovo Yoga Tablet 2 Pro 1380 (8", +10" and 13") models however do enable this. + +Using a UHS cards in these tablets results in errors like this one: + +[ 225.272001] mmc2: Unexpected interrupt 0x04000000. +[ 225.272024] mmc2: sdhci: ============ SDHCI REGISTER DUMP =========== +[ 225.272034] mmc2: sdhci: Sys addr: 0x0712c400 | Version: 0x0000b502 +[ 225.272044] mmc2: sdhci: Blk size: 0x00007200 | Blk cnt: 0x00000007 +[ 225.272054] mmc2: sdhci: Argument: 0x00000000 | Trn mode: 0x00000023 +[ 225.272064] mmc2: sdhci: Present: 0x01e20002 | Host ctl: 0x00000016 +[ 225.272073] mmc2: sdhci: Power: 0x0000000f | Blk gap: 0x00000000 +[ 225.272082] mmc2: sdhci: Wake-up: 0x00000000 | Clock: 0x00000107 +[ 225.272092] mmc2: sdhci: Timeout: 0x0000000e | Int stat: 0x00000001 +[ 225.272101] mmc2: sdhci: Int enab: 0x03ff000b | Sig enab: 0x03ff000b +[ 225.272110] mmc2: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000001 +[ 225.272119] mmc2: sdhci: Caps: 0x076864b2 | Caps_1: 0x00000004 +[ 225.272129] mmc2: sdhci: Cmd: 0x00000c1b | Max curr: 0x00000000 +[ 225.272138] mmc2: sdhci: Resp[0]: 0x00000c00 | Resp[1]: 0x00000000 +[ 225.272147] mmc2: sdhci: Resp[2]: 0x00000000 | Resp[3]: 0x00000900 +[ 225.272155] mmc2: sdhci: Host ctl2: 0x0000000c +[ 225.272164] mmc2: sdhci: ADMA Err: 0x00000003 | ADMA Ptr: 0x0712c200 +[ 225.272172] mmc2: sdhci: ============================================ + +which results in IO errors leading to issues accessing the sdcard. + +0x04000000 is a so-called "Tuning Error" which sofar the SDHCI driver +does not support / enable. Modify the IRQ handler to process these. + +This fixes UHS microsd cards not working with these tablets. + +Link: https://lore.kernel.org/r/199bb4aa-c6b5-453e-be37-58bbf468800c@intel.com +Signed-off-by: Hans de Goede +Signed-off-by: Adrian Hunter +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20240410191639.526324-3-hdegoede@redhat.com +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/host/sdhci.c | 10 ++++++++-- + drivers/mmc/host/sdhci.h | 3 ++- + 2 files changed, 10 insertions(+), 3 deletions(-) + +--- a/drivers/mmc/host/sdhci.c ++++ b/drivers/mmc/host/sdhci.c +@@ -3466,12 +3466,18 @@ static void sdhci_data_irq(struct sdhci_ + host->data->error = -EILSEQ; + if (!mmc_op_tuning(SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND)))) + sdhci_err_stats_inc(host, DAT_CRC); +- } else if ((intmask & SDHCI_INT_DATA_CRC) && ++ } else if ((intmask & (SDHCI_INT_DATA_CRC | SDHCI_INT_TUNING_ERROR)) && + SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND)) + != MMC_BUS_TEST_R) { + host->data->error = -EILSEQ; + if (!mmc_op_tuning(SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND)))) + sdhci_err_stats_inc(host, DAT_CRC); ++ if (intmask & SDHCI_INT_TUNING_ERROR) { ++ u16 ctrl2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); ++ ++ ctrl2 &= ~SDHCI_CTRL_TUNED_CLK; ++ sdhci_writew(host, ctrl2, SDHCI_HOST_CONTROL2); ++ } + } else if (intmask & SDHCI_INT_ADMA_ERROR) { + pr_err("%s: ADMA error: 0x%08x\n", mmc_hostname(host->mmc), + intmask); +@@ -4006,7 +4012,7 @@ bool sdhci_cqe_irq(struct sdhci_host *ho + } else + *cmd_error = 0; + +- if (intmask & (SDHCI_INT_DATA_END_BIT | SDHCI_INT_DATA_CRC)) { ++ if (intmask & (SDHCI_INT_DATA_END_BIT | SDHCI_INT_DATA_CRC | SDHCI_INT_TUNING_ERROR)) { + *data_error = -EILSEQ; + if (!mmc_op_tuning(SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND)))) + sdhci_err_stats_inc(host, DAT_CRC); +--- a/drivers/mmc/host/sdhci.h ++++ b/drivers/mmc/host/sdhci.h +@@ -151,6 +151,7 @@ + #define SDHCI_INT_BUS_POWER 0x00800000 + #define SDHCI_INT_AUTO_CMD_ERR 0x01000000 + #define SDHCI_INT_ADMA_ERROR 0x02000000 ++#define SDHCI_INT_TUNING_ERROR 0x04000000 + + #define SDHCI_INT_NORMAL_MASK 0x00007FFF + #define SDHCI_INT_ERROR_MASK 0xFFFF8000 +@@ -162,7 +163,7 @@ + SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL | \ + SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_DATA_CRC | \ + SDHCI_INT_DATA_END_BIT | SDHCI_INT_ADMA_ERROR | \ +- SDHCI_INT_BLK_GAP) ++ SDHCI_INT_BLK_GAP | SDHCI_INT_TUNING_ERROR) + #define SDHCI_INT_ALL_MASK ((unsigned int)-1) + + #define SDHCI_CQE_INT_ERR_MASK ( \ diff --git a/queue-6.1/series b/queue-6.1/series index b10fe897457..81cbf55d7ae 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -25,3 +25,21 @@ acpi-resource-do-irq-override-on-tongfang-gxxhrxx-and-gmxhgxx.patch arm64-tegra-correct-tegra132-i2c-alias.patch arm64-dts-qcom-qcs404-fix-bluetooth-device-address.patch md-raid5-fix-deadlock-that-raid5d-wait-for-itself-to-clear-md_sb_change_pending.patch +wifi-rtw89-pci-correct-tx-resource-checking-for-pci-dma-channel-of-firmware-command.patch +wifi-rtl8xxxu-fix-the-tx-power-of-rtl8192cu-rtl8723au.patch +wifi-rtlwifi-rtl8192de-fix-5-ghz-tx-power.patch +wifi-rtlwifi-rtl8192de-fix-low-speed-with-wpa3-sae.patch +wifi-rtlwifi-rtl8192de-fix-endianness-issue-in-rx-path.patch +arm64-dts-hi3798cv200-fix-the-size-of-gicr.patch +media-mc-fix-graph-walk-in-media_pipeline_start.patch +media-mc-mark-the-media-devnode-as-registered-from-the-start.patch +media-mxl5xx-move-xpt-structures-off-stack.patch +media-v4l2-core-hold-videodev_lock-until-dev-reg-finishes.patch +mmc-core-add-mmc_gpiod_set_cd_config-function.patch +mmc-sdhci-add-support-for-tuning-error-interrupts.patch +mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch +mmc-sdhci-acpi-fix-lenovo-yoga-tablet-2-pro-1380-sdcard-slot-not-working.patch +mmc-sdhci-acpi-disable-write-protect-detection-on-toshiba-wt10-a.patch +mmc-sdhci-acpi-add-quirk-to-enable-pull-up-on-the-card-detect-gpio-on-asus-t100ta.patch +fbdev-savage-handle-err-return-when-savagefb_check_var-failed.patch +drm-amdgpu-atomfirmware-add-intergrated-info-v2.3-table.patch diff --git a/queue-6.1/wifi-rtl8xxxu-fix-the-tx-power-of-rtl8192cu-rtl8723au.patch b/queue-6.1/wifi-rtl8xxxu-fix-the-tx-power-of-rtl8192cu-rtl8723au.patch new file mode 100644 index 00000000000..835e5405f3f --- /dev/null +++ b/queue-6.1/wifi-rtl8xxxu-fix-the-tx-power-of-rtl8192cu-rtl8723au.patch @@ -0,0 +1,90 @@ +From 08b5d052d17a89bb8706b2888277d0b682dc1610 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Mon, 15 Apr 2024 23:59:05 +0300 +Subject: wifi: rtl8xxxu: Fix the TX power of RTL8192CU, RTL8723AU + +From: Bitterblue Smith + +commit 08b5d052d17a89bb8706b2888277d0b682dc1610 upstream. + +Don't subtract 1 from the power index. This was added in commit +2fc0b8e5a17d ("rtl8xxxu: Add TX power base values for gen1 parts") +for unknown reasons. The vendor drivers don't do this. + +Also correct the calculations of values written to +REG_OFDM0_X{C,D}_TX_IQ_IMBALANCE. According to the vendor driver, +these are used for TX power training. + +With these changes rtl8xxxu sets the TX power of RTL8192CU the same +as the vendor driver. + +None of this appears to have any effect on my RTL8192CU device. + +Cc: stable@vger.kernel.org +Signed-off-by: Bitterblue Smith +Reviewed-by: Ping-Ke Shih +Signed-off-by: Ping-Ke Shih +Link: https://msgid.link/6ae5945b-644e-45e4-a78f-4c7d9c987910@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 25 +++++++----------- + 1 file changed, 10 insertions(+), 15 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -1389,13 +1389,13 @@ rtl8xxxu_gen1_set_tx_power(struct rtl8xx + u8 cck[RTL8723A_MAX_RF_PATHS], ofdm[RTL8723A_MAX_RF_PATHS]; + u8 ofdmbase[RTL8723A_MAX_RF_PATHS], mcsbase[RTL8723A_MAX_RF_PATHS]; + u32 val32, ofdm_a, ofdm_b, mcs_a, mcs_b; +- u8 val8; ++ u8 val8, base; + int group, i; + + group = rtl8xxxu_gen1_channel_to_group(channel); + +- cck[0] = priv->cck_tx_power_index_A[group] - 1; +- cck[1] = priv->cck_tx_power_index_B[group] - 1; ++ cck[0] = priv->cck_tx_power_index_A[group]; ++ cck[1] = priv->cck_tx_power_index_B[group]; + + if (priv->hi_pa) { + if (cck[0] > 0x20) +@@ -1406,10 +1406,6 @@ rtl8xxxu_gen1_set_tx_power(struct rtl8xx + + ofdm[0] = priv->ht40_1s_tx_power_index_A[group]; + ofdm[1] = priv->ht40_1s_tx_power_index_B[group]; +- if (ofdm[0]) +- ofdm[0] -= 1; +- if (ofdm[1]) +- ofdm[1] -= 1; + + ofdmbase[0] = ofdm[0] + priv->ofdm_tx_power_index_diff[group].a; + ofdmbase[1] = ofdm[1] + priv->ofdm_tx_power_index_diff[group].b; +@@ -1498,20 +1494,19 @@ rtl8xxxu_gen1_set_tx_power(struct rtl8xx + + rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS15_MCS12, + mcs_a + power_base->reg_0e1c); ++ val8 = u32_get_bits(mcs_a + power_base->reg_0e1c, 0xff000000); + for (i = 0; i < 3; i++) { +- if (i != 2) +- val8 = (mcsbase[0] > 8) ? (mcsbase[0] - 8) : 0; +- else +- val8 = (mcsbase[0] > 6) ? (mcsbase[0] - 6) : 0; ++ base = i != 2 ? 8 : 6; ++ val8 = max_t(int, val8 - base, 0); + rtl8xxxu_write8(priv, REG_OFDM0_XC_TX_IQ_IMBALANCE + i, val8); + } ++ + rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS15_MCS12, + mcs_b + power_base->reg_0868); ++ val8 = u32_get_bits(mcs_b + power_base->reg_0868, 0xff000000); + for (i = 0; i < 3; i++) { +- if (i != 2) +- val8 = (mcsbase[1] > 8) ? (mcsbase[1] - 8) : 0; +- else +- val8 = (mcsbase[1] > 6) ? (mcsbase[1] - 6) : 0; ++ base = i != 2 ? 8 : 6; ++ val8 = max_t(int, val8 - base, 0); + rtl8xxxu_write8(priv, REG_OFDM0_XD_TX_IQ_IMBALANCE + i, val8); + } + } diff --git a/queue-6.1/wifi-rtlwifi-rtl8192de-fix-5-ghz-tx-power.patch b/queue-6.1/wifi-rtlwifi-rtl8192de-fix-5-ghz-tx-power.patch new file mode 100644 index 00000000000..1018ec92697 --- /dev/null +++ b/queue-6.1/wifi-rtlwifi-rtl8192de-fix-5-ghz-tx-power.patch @@ -0,0 +1,42 @@ +From de4d4be4fa64ed7b4aa1c613061015bd8fa98b24 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Thu, 25 Apr 2024 21:09:21 +0300 +Subject: wifi: rtlwifi: rtl8192de: Fix 5 GHz TX power + +From: Bitterblue Smith + +commit de4d4be4fa64ed7b4aa1c613061015bd8fa98b24 upstream. + +Different channels have different TX power settings. rtl8192de is using +the TX power setting from the wrong channel in the 5 GHz band because +_rtl92c_phy_get_rightchnlplace expects an array which includes all the +channel numbers, but it's using an array which includes only the 5 GHz +channel numbers. + +Use the array channel_all (defined in rtl8192de/phy.c) instead of +the incorrect channel5g (defined in core.c). + +Tested only with rtl8192du, which will use the same TX power code. + +Cc: stable@vger.kernel.org +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://msgid.link/c7653517-cf88-4f57-b79a-8edb0a8b32f0@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c ++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c +@@ -892,8 +892,8 @@ static u8 _rtl92c_phy_get_rightchnlplace + u8 place = chnl; + + if (chnl > 14) { +- for (place = 14; place < ARRAY_SIZE(channel5g); place++) { +- if (channel5g[place] == chnl) { ++ for (place = 14; place < ARRAY_SIZE(channel_all); place++) { ++ if (channel_all[place] == chnl) { + place++; + break; + } diff --git a/queue-6.1/wifi-rtlwifi-rtl8192de-fix-endianness-issue-in-rx-path.patch b/queue-6.1/wifi-rtlwifi-rtl8192de-fix-endianness-issue-in-rx-path.patch new file mode 100644 index 00000000000..cfe54039366 --- /dev/null +++ b/queue-6.1/wifi-rtlwifi-rtl8192de-fix-endianness-issue-in-rx-path.patch @@ -0,0 +1,171 @@ +From 2f228d364da95ab58f63a3fedc00d5b2b7db16ab Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Thu, 25 Apr 2024 21:13:12 +0300 +Subject: wifi: rtlwifi: rtl8192de: Fix endianness issue in RX path + +From: Bitterblue Smith + +commit 2f228d364da95ab58f63a3fedc00d5b2b7db16ab upstream. + +Structs rx_desc_92d and rx_fwinfo_92d will not work for big endian +systems. + +Delete rx_desc_92d because it's big and barely used, and instead use +the get_rx_desc_rxmcs and get_rx_desc_rxht functions, which work on big +endian systems too. + +Fix rx_fwinfo_92d by duplicating four of its members in the correct +order. + +Tested only with RTL8192DU, which will use the same code. +Tested only on a little endian system. + +Cc: stable@vger.kernel.org +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://msgid.link/698463da-5ef1-40c7-b744-fa51ad847caf@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c | 16 ++-- + drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h | 65 ++----------------- + 2 files changed, 15 insertions(+), 66 deletions(-) + +--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c ++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c +@@ -35,7 +35,7 @@ static long _rtl92de_translate_todbm(str + + static void _rtl92de_query_rxphystatus(struct ieee80211_hw *hw, + struct rtl_stats *pstats, +- struct rx_desc_92d *pdesc, ++ __le32 *pdesc, + struct rx_fwinfo_92d *p_drvinfo, + bool packet_match_bssid, + bool packet_toself, +@@ -49,8 +49,10 @@ static void _rtl92de_query_rxphystatus(s + u8 i, max_spatial_stream; + u32 rssi, total_rssi = 0; + bool is_cck_rate; ++ u8 rxmcs; + +- is_cck_rate = RX_HAL_IS_CCK_RATE(pdesc->rxmcs); ++ rxmcs = get_rx_desc_rxmcs(pdesc); ++ is_cck_rate = rxmcs <= DESC_RATE11M; + pstats->packet_matchbssid = packet_match_bssid; + pstats->packet_toself = packet_toself; + pstats->packet_beacon = packet_beacon; +@@ -158,8 +160,8 @@ static void _rtl92de_query_rxphystatus(s + pstats->rx_pwdb_all = pwdb_all; + pstats->rxpower = rx_pwr_all; + pstats->recvsignalpower = rx_pwr_all; +- if (pdesc->rxht && pdesc->rxmcs >= DESC_RATEMCS8 && +- pdesc->rxmcs <= DESC_RATEMCS15) ++ if (get_rx_desc_rxht(pdesc) && rxmcs >= DESC_RATEMCS8 && ++ rxmcs <= DESC_RATEMCS15) + max_spatial_stream = 2; + else + max_spatial_stream = 1; +@@ -365,7 +367,7 @@ static void _rtl92de_process_phyinfo(str + static void _rtl92de_translate_rx_signal_stuff(struct ieee80211_hw *hw, + struct sk_buff *skb, + struct rtl_stats *pstats, +- struct rx_desc_92d *pdesc, ++ __le32 *pdesc, + struct rx_fwinfo_92d *p_drvinfo) + { + struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); +@@ -441,9 +443,7 @@ bool rtl92de_rx_query_desc(struct ieee80 + if (phystatus) { + p_drvinfo = (struct rx_fwinfo_92d *)(skb->data + + stats->rx_bufshift); +- _rtl92de_translate_rx_signal_stuff(hw, +- skb, stats, +- (struct rx_desc_92d *)pdesc, ++ _rtl92de_translate_rx_signal_stuff(hw, skb, stats, pdesc, + p_drvinfo); + } + /*rx_status->qual = stats->signal; */ +--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h ++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h +@@ -394,10 +394,17 @@ struct rx_fwinfo_92d { + u8 csi_target[2]; + u8 sigevm; + u8 max_ex_pwr; ++#ifdef __LITTLE_ENDIAN + u8 ex_intf_flag:1; + u8 sgi_en:1; + u8 rxsc:2; + u8 reserve:4; ++#else ++ u8 reserve:4; ++ u8 rxsc:2; ++ u8 sgi_en:1; ++ u8 ex_intf_flag:1; ++#endif + } __packed; + + struct tx_desc_92d { +@@ -502,64 +509,6 @@ struct tx_desc_92d { + u32 reserve_pass_pcie_mm_limit[4]; + } __packed; + +-struct rx_desc_92d { +- u32 length:14; +- u32 crc32:1; +- u32 icverror:1; +- u32 drv_infosize:4; +- u32 security:3; +- u32 qos:1; +- u32 shift:2; +- u32 phystatus:1; +- u32 swdec:1; +- u32 lastseg:1; +- u32 firstseg:1; +- u32 eor:1; +- u32 own:1; +- +- u32 macid:5; +- u32 tid:4; +- u32 hwrsvd:5; +- u32 paggr:1; +- u32 faggr:1; +- u32 a1_fit:4; +- u32 a2_fit:4; +- u32 pam:1; +- u32 pwr:1; +- u32 moredata:1; +- u32 morefrag:1; +- u32 type:2; +- u32 mc:1; +- u32 bc:1; +- +- u32 seq:12; +- u32 frag:4; +- u32 nextpktlen:14; +- u32 nextind:1; +- u32 rsvd:1; +- +- u32 rxmcs:6; +- u32 rxht:1; +- u32 amsdu:1; +- u32 splcp:1; +- u32 bandwidth:1; +- u32 htc:1; +- u32 tcpchk_rpt:1; +- u32 ipcchk_rpt:1; +- u32 tcpchk_valid:1; +- u32 hwpcerr:1; +- u32 hwpcind:1; +- u32 iv0:16; +- +- u32 iv1; +- +- u32 tsfl; +- +- u32 bufferaddress; +- u32 bufferaddress64; +- +-} __packed; +- + void rtl92de_tx_fill_desc(struct ieee80211_hw *hw, + struct ieee80211_hdr *hdr, u8 *pdesc, + u8 *pbd_desc_tx, struct ieee80211_tx_info *info, diff --git a/queue-6.1/wifi-rtlwifi-rtl8192de-fix-low-speed-with-wpa3-sae.patch b/queue-6.1/wifi-rtlwifi-rtl8192de-fix-low-speed-with-wpa3-sae.patch new file mode 100644 index 00000000000..123391d7ad4 --- /dev/null +++ b/queue-6.1/wifi-rtlwifi-rtl8192de-fix-low-speed-with-wpa3-sae.patch @@ -0,0 +1,80 @@ +From a7c0f48410f546772ac94a0f7b7291a15c4fc173 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Thu, 25 Apr 2024 21:12:38 +0300 +Subject: wifi: rtlwifi: rtl8192de: Fix low speed with WPA3-SAE + +From: Bitterblue Smith + +commit a7c0f48410f546772ac94a0f7b7291a15c4fc173 upstream. + +Some (all?) management frames are incorrectly reported to mac80211 as +decrypted when actually the hardware did not decrypt them. This results +in speeds 3-5 times lower than expected, 20-30 Mbps instead of 100 +Mbps. + +Fix this by checking the encryption type field of the RX descriptor. +rtw88 does the same thing. + +This fix was tested only with rtl8192du, which will use the same code. + +Cc: stable@vger.kernel.org +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://msgid.link/4d600435-f0ea-46b0-bdb4-e60f173da8dd@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c | 5 ++--- + drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h | 14 ++++++++++++++ + 2 files changed, 16 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c ++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c +@@ -414,7 +414,8 @@ bool rtl92de_rx_query_desc(struct ieee80 + stats->icv = (u16)get_rx_desc_icv(pdesc); + stats->crc = (u16)get_rx_desc_crc32(pdesc); + stats->hwerror = (stats->crc | stats->icv); +- stats->decrypted = !get_rx_desc_swdec(pdesc); ++ stats->decrypted = !get_rx_desc_swdec(pdesc) && ++ get_rx_desc_enc_type(pdesc) != RX_DESC_ENC_NONE; + stats->rate = (u8)get_rx_desc_rxmcs(pdesc); + stats->shortpreamble = (u16)get_rx_desc_splcp(pdesc); + stats->isampdu = (bool)(get_rx_desc_paggr(pdesc) == 1); +@@ -427,8 +428,6 @@ bool rtl92de_rx_query_desc(struct ieee80 + rx_status->band = hw->conf.chandef.chan->band; + if (get_rx_desc_crc32(pdesc)) + rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; +- if (!get_rx_desc_swdec(pdesc)) +- rx_status->flag |= RX_FLAG_DECRYPTED; + if (get_rx_desc_bw(pdesc)) + rx_status->bw = RATE_INFO_BW_40; + if (get_rx_desc_rxht(pdesc)) +--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h ++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h +@@ -14,6 +14,15 @@ + #define USB_HWDESC_HEADER_LEN 32 + #define CRCLENGTH 4 + ++enum rtl92d_rx_desc_enc { ++ RX_DESC_ENC_NONE = 0, ++ RX_DESC_ENC_WEP40 = 1, ++ RX_DESC_ENC_TKIP_WO_MIC = 2, ++ RX_DESC_ENC_TKIP_MIC = 3, ++ RX_DESC_ENC_AES = 4, ++ RX_DESC_ENC_WEP104 = 5, ++}; ++ + /* macros to read/write various fields in RX or TX descriptors */ + + static inline void set_tx_desc_pkt_size(__le32 *__pdesc, u32 __val) +@@ -246,6 +255,11 @@ static inline u32 get_rx_desc_drv_info_s + return le32_get_bits(*__pdesc, GENMASK(19, 16)); + } + ++static inline u32 get_rx_desc_enc_type(__le32 *__pdesc) ++{ ++ return le32_get_bits(*__pdesc, GENMASK(22, 20)); ++} ++ + static inline u32 get_rx_desc_shift(__le32 *__pdesc) + { + return le32_get_bits(*__pdesc, GENMASK(25, 24)); diff --git a/queue-6.1/wifi-rtw89-pci-correct-tx-resource-checking-for-pci-dma-channel-of-firmware-command.patch b/queue-6.1/wifi-rtw89-pci-correct-tx-resource-checking-for-pci-dma-channel-of-firmware-command.patch new file mode 100644 index 00000000000..63c0a7551c8 --- /dev/null +++ b/queue-6.1/wifi-rtw89-pci-correct-tx-resource-checking-for-pci-dma-channel-of-firmware-command.patch @@ -0,0 +1,68 @@ +From c6330b129786e267b14129335a08fa7c331c308d Mon Sep 17 00:00:00 2001 +From: Ping-Ke Shih +Date: Wed, 10 Apr 2024 09:13:16 +0800 +Subject: wifi: rtw89: pci: correct TX resource checking for PCI DMA channel of firmware command + +From: Ping-Ke Shih + +commit c6330b129786e267b14129335a08fa7c331c308d upstream. + +The DMA channel of firmware command doesn't use TX WD (WiFi descriptor), so +don't need to consider number of TX WD as factor of TX resource. Otherwise, +during pause state (a transient state to switch to/from low power mode) +firmware commands could be dropped and driver throws warnings suddenly: + + rtw89_8852ce 0000:04:00.0: no tx fwcmd resource + rtw89_8852ce 0000:04:00.0: failed to send h2c + +The case we met is that driver sends RSSI strength of firmware command at +RX path that could be running concurrently with switching low power mode. +The missing of this firmware command doesn't affect user experiences, +because the RSSI strength will be updated again after a while. + +The DMA descriptors of normal packets has three layers like: + + +-------+ + | TX BD | (*n elements) + +-------+ + | + | +-------+ + +-> | TX WD | (*m elements) + +-------+ + | + | +--------+ + +-> | SKB | + +--------+ + +And, firmware command queue (TXCH 12) is a special queue that has only +two layers: + + +-------+ + | TX BD | (*n elements) + +-------+ + | + | +------------------+ + +-> | firmware command | + +------------------+ + +Fixes: 4a29213cd775 ("wifi: rtw89: pci: correct TX resource checking in low power mode") +Cc: stable@vger.kernel.org +Signed-off-by: Ping-Ke Shih +Link: https://msgid.link/20240410011316.9906-1-pkshih@realtek.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/realtek/rtw89/pci.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtw89/pci.c ++++ b/drivers/net/wireless/realtek/rtw89/pci.c +@@ -948,7 +948,8 @@ u32 __rtw89_pci_check_and_reclaim_tx_res + + spin_lock_bh(&rtwpci->trx_lock); + cnt = rtw89_pci_get_avail_txbd_num(tx_ring); +- cnt = min(cnt, wd_ring->curr_num); ++ if (txch != RTW89_TXCH_CH12) ++ cnt = min(cnt, wd_ring->curr_num); + spin_unlock_bh(&rtwpci->trx_lock); + + return cnt;