]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.6-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Jun 2024 18:29:50 +0000 (20:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Jun 2024 18:29:50 +0000 (20:29 +0200)
added patches:
arm64-dts-hi3798cv200-fix-the-size-of-gicr.patch
arm64-dts-qcom-sc8280xp-add-missing-pcie-minimum-opp.patch
arm64-dts-ti-verdin-am62-set-memory-size-to-2gb.patch
drm-amdgpu-atomfirmware-add-intergrated-info-v2.3-table.patch
drm-fbdev-generic-do-not-set-physical-framebuffer-address.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-v4l-async-don-t-set-notifier-s-v4l2-device-if-registering-fails.patch
media-v4l-async-fix-notifier-list-entry-init.patch
media-v4l-async-properly-re-initialise-notifier-entry-in-unregister.patch
media-v4l2-core-hold-videodev_lock-until-dev-reg-finishes.patch
mmc-core-add-mmc_gpiod_set_cd_config-function.patch
mmc-davinci-don-t-strip-remove-function-when-driver-is-builtin.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

26 files changed:
queue-6.6/arm64-dts-hi3798cv200-fix-the-size-of-gicr.patch [new file with mode: 0644]
queue-6.6/arm64-dts-qcom-sc8280xp-add-missing-pcie-minimum-opp.patch [new file with mode: 0644]
queue-6.6/arm64-dts-ti-verdin-am62-set-memory-size-to-2gb.patch [new file with mode: 0644]
queue-6.6/drm-amdgpu-atomfirmware-add-intergrated-info-v2.3-table.patch [new file with mode: 0644]
queue-6.6/drm-fbdev-generic-do-not-set-physical-framebuffer-address.patch [new file with mode: 0644]
queue-6.6/fbdev-savage-handle-err-return-when-savagefb_check_var-failed.patch [new file with mode: 0644]
queue-6.6/media-mc-fix-graph-walk-in-media_pipeline_start.patch [new file with mode: 0644]
queue-6.6/media-mc-mark-the-media-devnode-as-registered-from-the-start.patch [new file with mode: 0644]
queue-6.6/media-mxl5xx-move-xpt-structures-off-stack.patch [new file with mode: 0644]
queue-6.6/media-v4l-async-don-t-set-notifier-s-v4l2-device-if-registering-fails.patch [new file with mode: 0644]
queue-6.6/media-v4l-async-fix-notifier-list-entry-init.patch [new file with mode: 0644]
queue-6.6/media-v4l-async-properly-re-initialise-notifier-entry-in-unregister.patch [new file with mode: 0644]
queue-6.6/media-v4l2-core-hold-videodev_lock-until-dev-reg-finishes.patch [new file with mode: 0644]
queue-6.6/mmc-core-add-mmc_gpiod_set_cd_config-function.patch [new file with mode: 0644]
queue-6.6/mmc-davinci-don-t-strip-remove-function-when-driver-is-builtin.patch [new file with mode: 0644]
queue-6.6/mmc-sdhci-acpi-add-quirk-to-enable-pull-up-on-the-card-detect-gpio-on-asus-t100ta.patch [new file with mode: 0644]
queue-6.6/mmc-sdhci-acpi-disable-write-protect-detection-on-toshiba-wt10-a.patch [new file with mode: 0644]
queue-6.6/mmc-sdhci-acpi-fix-lenovo-yoga-tablet-2-pro-1380-sdcard-slot-not-working.patch [new file with mode: 0644]
queue-6.6/mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch [new file with mode: 0644]
queue-6.6/mmc-sdhci-add-support-for-tuning-error-interrupts.patch [new file with mode: 0644]
queue-6.6/series
queue-6.6/wifi-rtl8xxxu-fix-the-tx-power-of-rtl8192cu-rtl8723au.patch [new file with mode: 0644]
queue-6.6/wifi-rtlwifi-rtl8192de-fix-5-ghz-tx-power.patch [new file with mode: 0644]
queue-6.6/wifi-rtlwifi-rtl8192de-fix-endianness-issue-in-rx-path.patch [new file with mode: 0644]
queue-6.6/wifi-rtlwifi-rtl8192de-fix-low-speed-with-wpa3-sae.patch [new file with mode: 0644]
queue-6.6/wifi-rtw89-pci-correct-tx-resource-checking-for-pci-dma-channel-of-firmware-command.patch [new file with mode: 0644]

diff --git a/queue-6.6/arm64-dts-hi3798cv200-fix-the-size-of-gicr.patch b/queue-6.6/arm64-dts-hi3798cv200-fix-the-size-of-gicr.patch
new file mode 100644 (file)
index 0000000..298c790
--- /dev/null
@@ -0,0 +1,43 @@
+From 428a575dc9038846ad259466d5ba109858c0a023 Mon Sep 17 00:00:00 2001
+From: Yang Xiwen <forbidden405@outlook.com>
+Date: Mon, 19 Feb 2024 23:05:26 +0800
+Subject: arm64: dts: hi3798cv200: fix the size of GICR
+
+From: Yang Xiwen <forbidden405@outlook.com>
+
+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 <forbidden405@outlook.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240219-cache-v3-1-a33c57534ae9@outlook.com
+Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.6/arm64-dts-qcom-sc8280xp-add-missing-pcie-minimum-opp.patch b/queue-6.6/arm64-dts-qcom-sc8280xp-add-missing-pcie-minimum-opp.patch
new file mode 100644 (file)
index 0000000..782fe70
--- /dev/null
@@ -0,0 +1,67 @@
+From 2b621971554a94094cf489314dc1c2b65401965c Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan+linaro@kernel.org>
+Date: Wed, 6 Mar 2024 10:56:50 +0100
+Subject: arm64: dts: qcom: sc8280xp: add missing PCIe minimum OPP
+
+From: Johan Hovold <johan+linaro@kernel.org>
+
+commit 2b621971554a94094cf489314dc1c2b65401965c upstream.
+
+Add the missing PCIe CX performance level votes to avoid relying on
+other drivers (e.g. USB or UFS) to maintain the nominal performance
+level required for Gen3 speeds.
+
+Fixes: 813e83157001 ("arm64: dts: qcom: sc8280xp/sa8540p: add PCIe2-4 nodes")
+Cc: stable@vger.kernel.org      # 6.2
+Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
+Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+Link: https://lore.kernel.org/r/20240306095651.4551-5-johan+linaro@kernel.org
+Signed-off-by: Bjorn Andersson <andersson@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/arm64/boot/dts/qcom/sc8280xp.dtsi |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
++++ b/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
+@@ -1798,6 +1798,7 @@
+                       assigned-clock-rates = <100000000>;
+                       power-domains = <&gcc PCIE_4_GDSC>;
++                      required-opps = <&rpmhpd_opp_nom>;
+                       resets = <&gcc GCC_PCIE_4_PHY_BCR>;
+                       reset-names = "phy";
+@@ -1897,6 +1898,7 @@
+                       assigned-clock-rates = <100000000>;
+                       power-domains = <&gcc PCIE_3B_GDSC>;
++                      required-opps = <&rpmhpd_opp_nom>;
+                       resets = <&gcc GCC_PCIE_3B_PHY_BCR>;
+                       reset-names = "phy";
+@@ -1997,6 +1999,7 @@
+                       assigned-clock-rates = <100000000>;
+                       power-domains = <&gcc PCIE_3A_GDSC>;
++                      required-opps = <&rpmhpd_opp_nom>;
+                       resets = <&gcc GCC_PCIE_3A_PHY_BCR>;
+                       reset-names = "phy";
+@@ -2098,6 +2101,7 @@
+                       assigned-clock-rates = <100000000>;
+                       power-domains = <&gcc PCIE_2B_GDSC>;
++                      required-opps = <&rpmhpd_opp_nom>;
+                       resets = <&gcc GCC_PCIE_2B_PHY_BCR>;
+                       reset-names = "phy";
+@@ -2198,6 +2202,7 @@
+                       assigned-clock-rates = <100000000>;
+                       power-domains = <&gcc PCIE_2A_GDSC>;
++                      required-opps = <&rpmhpd_opp_nom>;
+                       resets = <&gcc GCC_PCIE_2A_PHY_BCR>;
+                       reset-names = "phy";
diff --git a/queue-6.6/arm64-dts-ti-verdin-am62-set-memory-size-to-2gb.patch b/queue-6.6/arm64-dts-ti-verdin-am62-set-memory-size-to-2gb.patch
new file mode 100644 (file)
index 0000000..8059a78
--- /dev/null
@@ -0,0 +1,34 @@
+From f70a88829723c1b462ea0fec15fa75809a0d670b Mon Sep 17 00:00:00 2001
+From: Max Krummenacher <max.krummenacher@toradex.com>
+Date: Wed, 20 Mar 2024 15:29:37 +0100
+Subject: arm64: dts: ti: verdin-am62: Set memory size to 2gb
+
+From: Max Krummenacher <max.krummenacher@toradex.com>
+
+commit f70a88829723c1b462ea0fec15fa75809a0d670b upstream.
+
+The maximum DDR RAM size stuffed on the Verdin AM62 is 2GB,
+correct the memory node accordingly.
+
+Fixes: 316b80246b16 ("arm64: dts: ti: add verdin am62")
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
+Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
+Link: https://lore.kernel.org/r/20240320142937.2028707-1-max.oss.09@gmail.com
+Signed-off-by: Nishanth Menon <nm@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi
++++ b/arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi
+@@ -60,7 +60,7 @@
+       memory@80000000 {
+               device_type = "memory";
+-              reg = <0x00000000 0x80000000 0x00000000 0x40000000>; /* 1G RAM */
++              reg = <0x00000000 0x80000000 0x00000000 0x80000000>; /* 2G RAM */
+       };
+       opp-table {
diff --git a/queue-6.6/drm-amdgpu-atomfirmware-add-intergrated-info-v2.3-table.patch b/queue-6.6/drm-amdgpu-atomfirmware-add-intergrated-info-v2.3-table.patch
new file mode 100644 (file)
index 0000000..291f5e7
--- /dev/null
@@ -0,0 +1,111 @@
+From e64e8f7c178e5228e0b2dbb504b9dc75953a319f Mon Sep 17 00:00:00 2001
+From: Li Ma <li.ma@amd.com>
+Date: Mon, 20 May 2024 18:43:55 +0800
+Subject: drm/amdgpu/atomfirmware: add intergrated info v2.3 table
+
+From: Li Ma <li.ma@amd.com>
+
+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 <li.ma@amd.com>
+Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
+Acked-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -211,6 +211,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 {
+@@ -353,6 +354,20 @@ amdgpu_atomfirmware_get_vram_info(struct
+                                       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;
++                              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;
+--- a/drivers/gpu/drm/amd/include/atomfirmware.h
++++ b/drivers/gpu/drm/amd/include/atomfirmware.h
+@@ -1625,6 +1625,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.6/drm-fbdev-generic-do-not-set-physical-framebuffer-address.patch b/queue-6.6/drm-fbdev-generic-do-not-set-physical-framebuffer-address.patch
new file mode 100644 (file)
index 0000000..55a3262
--- /dev/null
@@ -0,0 +1,55 @@
+From 87cb4a612a89690b123e68f6602d9f6581b03597 Mon Sep 17 00:00:00 2001
+From: Thomas Zimmermann <tzimmermann@suse.de>
+Date: Fri, 19 Apr 2024 10:28:54 +0200
+Subject: drm/fbdev-generic: Do not set physical framebuffer address
+
+From: Thomas Zimmermann <tzimmermann@suse.de>
+
+commit 87cb4a612a89690b123e68f6602d9f6581b03597 upstream.
+
+Framebuffer memory is allocated via vzalloc() from non-contiguous
+physical pages. The physical framebuffer start address is therefore
+meaningless. Do not set it.
+
+The value is not used within the kernel and only exported to userspace
+on dedicated ARM configs. No functional change is expected.
+
+v2:
+- refer to vzalloc() in commit message (Javier)
+
+Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
+Fixes: a5b44c4adb16 ("drm/fbdev-generic: Always use shadow buffering")
+Cc: Thomas Zimmermann <tzimmermann@suse.de>
+Cc: Javier Martinez Canillas <javierm@redhat.com>
+Cc: Zack Rusin <zackr@vmware.com>
+Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
+Cc: Maxime Ripard <mripard@kernel.org>
+Cc: <stable@vger.kernel.org> # v6.4+
+Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
+Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>
+Reviewed-by: Sui Jingfeng <sui.jingfeng@linux.dev>
+Tested-by: Sui Jingfeng <sui.jingfeng@linux.dev>
+Acked-by: Maxime Ripard <mripard@kernel.org>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240419083331.7761-2-tzimmermann@suse.de
+(cherry picked from commit 73ef0aecba78aa9ebd309b10b6cd17d94e632892)
+Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/drm_fbdev_generic.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c
+index be357f926fae..97e579c33d84 100644
+--- a/drivers/gpu/drm/drm_fbdev_generic.c
++++ b/drivers/gpu/drm/drm_fbdev_generic.c
+@@ -113,7 +113,6 @@ static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper,
+       /* screen */
+       info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
+       info->screen_buffer = screen_buffer;
+-      info->fix.smem_start = page_to_phys(vmalloc_to_page(info->screen_buffer));
+       info->fix.smem_len = screen_size;
+       /* deferred I/O */
+-- 
+2.45.2
+
diff --git a/queue-6.6/fbdev-savage-handle-err-return-when-savagefb_check_var-failed.patch b/queue-6.6/fbdev-savage-handle-err-return-when-savagefb_check_var-failed.patch
new file mode 100644 (file)
index 0000000..09dfa09
--- /dev/null
@@ -0,0 +1,37 @@
+From 6ad959b6703e2c4c5d7af03b4cfd5ff608036339 Mon Sep 17 00:00:00 2001
+From: Cai Xinchen <caixinchen1@huawei.com>
+Date: Tue, 16 Apr 2024 06:51:37 +0000
+Subject: fbdev: savage: Handle err return when savagefb_check_var failed
+
+From: Cai Xinchen <caixinchen1@huawei.com>
+
+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 <caixinchen1@huawei.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Helge Deller <deller@gmx.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -2276,7 +2276,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.6/media-mc-fix-graph-walk-in-media_pipeline_start.patch b/queue-6.6/media-mc-fix-graph-walk-in-media_pipeline_start.patch
new file mode 100644 (file)
index 0000000..c95691b
--- /dev/null
@@ -0,0 +1,40 @@
+From 8a9d420149c477e7c97fbd6453704e4612bdd3fa Mon Sep 17 00:00:00 2001
+From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
+Date: Mon, 18 Mar 2024 11:50:59 +0200
+Subject: media: mc: Fix graph walk in media_pipeline_start
+
+From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
+
+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 <tomi.valkeinen@ideasonboard.com>
+Cc: stable@vger.kernel.org # for 6.1 and later
+Fixes: ae219872834a ("media: mc: entity: Rewrite media_pipeline_start()")
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -606,6 +606,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.6/media-mc-mark-the-media-devnode-as-registered-from-the-start.patch b/queue-6.6/media-mc-mark-the-media-devnode-as-registered-from-the-start.patch
new file mode 100644 (file)
index 0000000..189e373
--- /dev/null
@@ -0,0 +1,48 @@
+From 4bc60736154bc9e0e39d3b88918f5d3762ebe5e0 Mon Sep 17 00:00:00 2001
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Date: Fri, 23 Feb 2024 09:46:19 +0100
+Subject: media: mc: mark the media devnode as registered from the, start
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+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 <hverkuil-cisco@xs4all.nl>
+Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Fixes: cf4b9211b568 ("[media] media: Media device node support")
+Cc: stable@vger.kernel.org
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.6/media-mxl5xx-move-xpt-structures-off-stack.patch b/queue-6.6/media-mxl5xx-move-xpt-structures-off-stack.patch
new file mode 100644 (file)
index 0000000..03cd2fe
--- /dev/null
@@ -0,0 +1,115 @@
+From 526f4527545b2d4ce0733733929fac7b6da09ac6 Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Fri, 12 Jan 2024 00:40:36 +0000
+Subject: media: mxl5xx: Move xpt structures off stack
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+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 <nathan@kernel.org>
+Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
+Tested-by: Miguel Ojeda <ojeda@kernel.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.6/media-v4l-async-don-t-set-notifier-s-v4l2-device-if-registering-fails.patch b/queue-6.6/media-v4l-async-don-t-set-notifier-s-v4l2-device-if-registering-fails.patch
new file mode 100644 (file)
index 0000000..0e9d271
--- /dev/null
@@ -0,0 +1,42 @@
+From 46bc0234ad38063ce550ecf135c1a52458f0a804 Mon Sep 17 00:00:00 2001
+From: Sakari Ailus <sakari.ailus@linux.intel.com>
+Date: Fri, 8 Mar 2024 15:07:45 +0200
+Subject: media: v4l: async: Don't set notifier's V4L2 device if registering fails
+
+From: Sakari Ailus <sakari.ailus@linux.intel.com>
+
+commit 46bc0234ad38063ce550ecf135c1a52458f0a804 upstream.
+
+The V4L2 device used to be set when the notifier was registered but this
+has been moved to the notifier initialisation. Don't touch the V4L2 device
+if registration fails.
+
+Fixes: b8ec754ae4c5 ("media: v4l: async: Set v4l2_device and subdev in async notifier init")
+Cc: <stable@vger.kernel.org> # for 6.6 and later
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/media/v4l2-core/v4l2-async.c |    8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+--- a/drivers/media/v4l2-core/v4l2-async.c
++++ b/drivers/media/v4l2-core/v4l2-async.c
+@@ -618,16 +618,10 @@ err_unlock:
+ int v4l2_async_nf_register(struct v4l2_async_notifier *notifier)
+ {
+-      int ret;
+-
+       if (WARN_ON(!notifier->v4l2_dev == !notifier->sd))
+               return -EINVAL;
+-      ret = __v4l2_async_nf_register(notifier);
+-      if (ret)
+-              notifier->v4l2_dev = NULL;
+-
+-      return ret;
++      return __v4l2_async_nf_register(notifier);
+ }
+ EXPORT_SYMBOL(v4l2_async_nf_register);
diff --git a/queue-6.6/media-v4l-async-fix-notifier-list-entry-init.patch b/queue-6.6/media-v4l-async-fix-notifier-list-entry-init.patch
new file mode 100644 (file)
index 0000000..0347835
--- /dev/null
@@ -0,0 +1,46 @@
+From 6d8acd02c4c6a8f917eefac1de2e035521ca119d Mon Sep 17 00:00:00 2001
+From: Alexander Stein <alexander.stein@ew.tq-group.com>
+Date: Thu, 7 Mar 2024 15:24:51 +0100
+Subject: media: v4l: async: Fix notifier list entry init
+
+From: Alexander Stein <alexander.stein@ew.tq-group.com>
+
+commit 6d8acd02c4c6a8f917eefac1de2e035521ca119d upstream.
+
+struct v4l2_async_notifier has several list_head members, but only
+waiting_list and done_list are initialized. notifier_entry was kept
+'zeroed' leading to an uninitialized list_head.
+This results in a NULL-pointer dereference if csi2_async_register() fails,
+e.g. node for remote endpoint is disabled, and returns -ENOTCONN.
+The following calls to v4l2_async_nf_unregister() results in a NULL
+pointer dereference.
+Add the missing list head initializer.
+
+Fixes: b8ec754ae4c5 ("media: v4l: async: Set v4l2_device and subdev in async notifier init")
+Cc: <stable@vger.kernel.org> # for 6.6 and later
+Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/media/v4l2-core/v4l2-async.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/media/v4l2-core/v4l2-async.c
++++ b/drivers/media/v4l2-core/v4l2-async.c
+@@ -563,6 +563,7 @@ void v4l2_async_nf_init(struct v4l2_asyn
+ {
+       INIT_LIST_HEAD(&notifier->waiting_list);
+       INIT_LIST_HEAD(&notifier->done_list);
++      INIT_LIST_HEAD(&notifier->notifier_entry);
+       notifier->v4l2_dev = v4l2_dev;
+ }
+ EXPORT_SYMBOL(v4l2_async_nf_init);
+@@ -572,6 +573,7 @@ void v4l2_async_subdev_nf_init(struct v4
+ {
+       INIT_LIST_HEAD(&notifier->waiting_list);
+       INIT_LIST_HEAD(&notifier->done_list);
++      INIT_LIST_HEAD(&notifier->notifier_entry);
+       notifier->sd = sd;
+ }
+ EXPORT_SYMBOL_GPL(v4l2_async_subdev_nf_init);
diff --git a/queue-6.6/media-v4l-async-properly-re-initialise-notifier-entry-in-unregister.patch b/queue-6.6/media-v4l-async-properly-re-initialise-notifier-entry-in-unregister.patch
new file mode 100644 (file)
index 0000000..e70f250
--- /dev/null
@@ -0,0 +1,33 @@
+From 9537a8425a7a0222999d5839a0b394b1e8834b4a Mon Sep 17 00:00:00 2001
+From: Sakari Ailus <sakari.ailus@linux.intel.com>
+Date: Fri, 8 Mar 2024 15:06:13 +0200
+Subject: media: v4l: async: Properly re-initialise notifier entry in unregister
+
+From: Sakari Ailus <sakari.ailus@linux.intel.com>
+
+commit 9537a8425a7a0222999d5839a0b394b1e8834b4a upstream.
+
+The notifier_entry of a notifier is not re-initialised after unregistering
+the notifier. This leads to dangling pointers being left there so use
+list_del_init() to return the notifier_entry an empty list.
+
+Fixes: b8ec754ae4c5 ("media: v4l: async: Set v4l2_device and subdev in async notifier init")
+Cc: <stable@vger.kernel.org> # for 6.6 and later
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/media/v4l2-core/v4l2-async.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/media/v4l2-core/v4l2-async.c
++++ b/drivers/media/v4l2-core/v4l2-async.c
+@@ -639,7 +639,7 @@ __v4l2_async_nf_unregister(struct v4l2_a
+       v4l2_async_nf_unbind_all_subdevs(notifier);
+-      list_del(&notifier->notifier_entry);
++      list_del_init(&notifier->notifier_entry);
+ }
+ void v4l2_async_nf_unregister(struct v4l2_async_notifier *notifier)
diff --git a/queue-6.6/media-v4l2-core-hold-videodev_lock-until-dev-reg-finishes.patch b/queue-6.6/media-v4l2-core-hold-videodev_lock-until-dev-reg-finishes.patch
new file mode 100644 (file)
index 0000000..513d21d
--- /dev/null
@@ -0,0 +1,50 @@
+From 1ed4477f2ea4743e7c5e1f9f3722152d14e6eeb1 Mon Sep 17 00:00:00 2001
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Date: Fri, 23 Feb 2024 09:45:36 +0100
+Subject: media: v4l2-core: hold videodev_lock until dev reg, finishes
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+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 <hverkuil-cisco@xs4all.nl>
+Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Cc: <stable@vger.kernel.org>      # for vi4.18 and up
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -1034,8 +1034,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;
+       }
+@@ -1055,6 +1057,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.6/mmc-core-add-mmc_gpiod_set_cd_config-function.patch b/queue-6.6/mmc-core-add-mmc_gpiod_set_cd_config-function.patch
new file mode 100644 (file)
index 0000000..6969970
--- /dev/null
@@ -0,0 +1,71 @@
+From 63a7cd660246aa36af263b85c33ecc6601bf04be Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Wed, 10 Apr 2024 21:16:34 +0200
+Subject: mmc: core: Add mmc_gpiod_set_cd_config() function
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+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 <andy@kernel.org>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240410191639.526324-2-hdegoede@redhat.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -221,6 +221,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
+@@ -21,6 +21,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.6/mmc-davinci-don-t-strip-remove-function-when-driver-is-builtin.patch b/queue-6.6/mmc-davinci-don-t-strip-remove-function-when-driver-is-builtin.patch
new file mode 100644 (file)
index 0000000..c666ca6
--- /dev/null
@@ -0,0 +1,54 @@
+From 55c421b364482b61c4c45313a535e61ed5ae4ea3 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
+Date: Sun, 24 Mar 2024 12:40:17 +0100
+Subject: mmc: davinci: Don't strip remove function when driver is builtin
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+
+commit 55c421b364482b61c4c45313a535e61ed5ae4ea3 upstream.
+
+Using __exit for the remove function results in the remove callback being
+discarded with CONFIG_MMC_DAVINCI=y. When such a device gets unbound (e.g.
+using sysfs or hotplug), the driver is just removed without the cleanup
+being performed. This results in resource leaks. Fix it by compiling in the
+remove callback unconditionally.
+
+This also fixes a W=1 modpost warning:
+
+WARNING: modpost: drivers/mmc/host/davinci_mmc: section mismatch in
+reference: davinci_mmcsd_driver+0x10 (section: .data) ->
+davinci_mmcsd_remove (section: .exit.text)
+
+Fixes: b4cff4549b7a ("DaVinci: MMC: MMC/SD controller driver for DaVinci family")
+Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240324114017.231936-2-u.kleine-koenig@pengutronix.de
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mmc/host/davinci_mmc.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/mmc/host/davinci_mmc.c
++++ b/drivers/mmc/host/davinci_mmc.c
+@@ -1344,7 +1344,7 @@ ioremap_fail:
+       return ret;
+ }
+-static void __exit davinci_mmcsd_remove(struct platform_device *pdev)
++static void davinci_mmcsd_remove(struct platform_device *pdev)
+ {
+       struct mmc_davinci_host *host = platform_get_drvdata(pdev);
+@@ -1399,7 +1399,7 @@ static struct platform_driver davinci_mm
+               .of_match_table = davinci_mmc_dt_ids,
+       },
+       .probe          = davinci_mmcsd_probe,
+-      .remove_new     = __exit_p(davinci_mmcsd_remove),
++      .remove_new     = davinci_mmcsd_remove,
+       .id_table       = davinci_mmc_devtype,
+ };
diff --git a/queue-6.6/mmc-sdhci-acpi-add-quirk-to-enable-pull-up-on-the-card-detect-gpio-on-asus-t100ta.patch b/queue-6.6/mmc-sdhci-acpi-add-quirk-to-enable-pull-up-on-the-card-detect-gpio-on-asus-t100ta.patch
new file mode 100644 (file)
index 0000000..a887e2d
--- /dev/null
@@ -0,0 +1,89 @@
+From 431946c0f640c93421439a6c928efb3152c035a4 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+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 <hdegoede@redhat.com>
+
+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 <andy@kernel.org>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240410191639.526324-7-hdegoede@redhat.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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 <linux/export.h>
+ #include <linux/module.h>
+ #include <linux/device.h>
++#include <linux/pinctrl/pinconf-generic.h>
+ #include <linux/platform_device.h>
+ #include <linux/ioport.h>
+ #include <linux/io.h>
+@@ -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.6/mmc-sdhci-acpi-disable-write-protect-detection-on-toshiba-wt10-a.patch b/queue-6.6/mmc-sdhci-acpi-disable-write-protect-detection-on-toshiba-wt10-a.patch
new file mode 100644 (file)
index 0000000..13f8a1e
--- /dev/null
@@ -0,0 +1,45 @@
+From ef3eab75e17191e5665f52e64e85bc29d5705a7b Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+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 <hdegoede@redhat.com>
+
+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 <andy@kernel.org>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240410191639.526324-6-hdegoede@redhat.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.6/mmc-sdhci-acpi-fix-lenovo-yoga-tablet-2-pro-1380-sdcard-slot-not-working.patch b/queue-6.6/mmc-sdhci-acpi-fix-lenovo-yoga-tablet-2-pro-1380-sdcard-slot-not-working.patch
new file mode 100644 (file)
index 0000000..b1836aa
--- /dev/null
@@ -0,0 +1,72 @@
+From f3521d7cbaefff19cc656325787ed797e5f6a955 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+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 <hdegoede@redhat.com>
+
+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 <andy@kernel.org>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240410191639.526324-5-hdegoede@redhat.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.6/mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch b/queue-6.6/mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch
new file mode 100644 (file)
index 0000000..1993f43
--- /dev/null
@@ -0,0 +1,66 @@
+From a92a73b1d9249d155412d8ac237142fa716803ea Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Wed, 10 Apr 2024 21:16:36 +0200
+Subject: mmc: sdhci-acpi: Sort DMI quirks alphabetically
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+commit a92a73b1d9249d155412d8ac237142fa716803ea upstream.
+
+Sort the DMI quirks alphabetically.
+
+Reviewed-by: Andy Shevchenko <andy@kernel.org>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240410191639.526324-4-hdegoede@redhat.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.6/mmc-sdhci-add-support-for-tuning-error-interrupts.patch b/queue-6.6/mmc-sdhci-add-support-for-tuning-error-interrupts.patch
new file mode 100644 (file)
index 0000000..3b20680
--- /dev/null
@@ -0,0 +1,103 @@
+From b3855668d98cf9c6aec2db999dd27d872f8ba878 Mon Sep 17 00:00:00 2001
+From: Adrian Hunter <adrian.hunter@intel.com>
+Date: Wed, 10 Apr 2024 21:16:35 +0200
+Subject: mmc: sdhci: Add support for "Tuning Error" interrupts
+
+From: Adrian Hunter <adrian.hunter@intel.com>
+
+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 <hdegoede@redhat.com>
+Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240410191639.526324-3-hdegoede@redhat.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -3438,12 +3438,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);
+@@ -3978,7 +3984,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
+@@ -158,6 +158,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
+@@ -169,7 +170,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 ( \
index 169538cce663d7e44bf7ad5b3cefbac7fbb91f53..32af1003699cd0679bd7efa77b0185c144113695 100644 (file)
@@ -29,3 +29,28 @@ 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-qcom-sc8280xp-add-missing-pcie-minimum-opp.patch
+arm64-dts-hi3798cv200-fix-the-size-of-gicr.patch
+arm64-dts-ti-verdin-am62-set-memory-size-to-2gb.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
+media-v4l-async-properly-re-initialise-notifier-entry-in-unregister.patch
+media-v4l-async-don-t-set-notifier-s-v4l2-device-if-registering-fails.patch
+media-v4l-async-fix-notifier-list-entry-init.patch
+mmc-davinci-don-t-strip-remove-function-when-driver-is-builtin.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
+drm-fbdev-generic-do-not-set-physical-framebuffer-address.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.6/wifi-rtl8xxxu-fix-the-tx-power-of-rtl8192cu-rtl8723au.patch b/queue-6.6/wifi-rtl8xxxu-fix-the-tx-power-of-rtl8192cu-rtl8723au.patch
new file mode 100644 (file)
index 0000000..037f635
--- /dev/null
@@ -0,0 +1,90 @@
+From 08b5d052d17a89bb8706b2888277d0b682dc1610 Mon Sep 17 00:00:00 2001
+From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+Date: Mon, 15 Apr 2024 23:59:05 +0300
+Subject: wifi: rtl8xxxu: Fix the TX power of RTL8192CU, RTL8723AU
+
+From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+
+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 <rtl8821cerfe2@gmail.com>
+Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
+Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
+Link: https://msgid.link/6ae5945b-644e-45e4-a78f-4c7d9c987910@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -1505,13 +1505,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)
+@@ -1522,10 +1522,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;
+@@ -1614,20 +1610,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.6/wifi-rtlwifi-rtl8192de-fix-5-ghz-tx-power.patch b/queue-6.6/wifi-rtlwifi-rtl8192de-fix-5-ghz-tx-power.patch
new file mode 100644 (file)
index 0000000..1018ec9
--- /dev/null
@@ -0,0 +1,42 @@
+From de4d4be4fa64ed7b4aa1c613061015bd8fa98b24 Mon Sep 17 00:00:00 2001
+From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+Date: Thu, 25 Apr 2024 21:09:21 +0300
+Subject: wifi: rtlwifi: rtl8192de: Fix 5 GHz TX power
+
+From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+
+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 <rtl8821cerfe2@gmail.com>
+Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
+Link: https://msgid.link/c7653517-cf88-4f57-b79a-8edb0a8b32f0@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.6/wifi-rtlwifi-rtl8192de-fix-endianness-issue-in-rx-path.patch b/queue-6.6/wifi-rtlwifi-rtl8192de-fix-endianness-issue-in-rx-path.patch
new file mode 100644 (file)
index 0000000..cfe5403
--- /dev/null
@@ -0,0 +1,171 @@
+From 2f228d364da95ab58f63a3fedc00d5b2b7db16ab Mon Sep 17 00:00:00 2001
+From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+Date: Thu, 25 Apr 2024 21:13:12 +0300
+Subject: wifi: rtlwifi: rtl8192de: Fix endianness issue in RX path
+
+From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+
+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 <rtl8821cerfe2@gmail.com>
+Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
+Link: https://msgid.link/698463da-5ef1-40c7-b744-fa51ad847caf@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.6/wifi-rtlwifi-rtl8192de-fix-low-speed-with-wpa3-sae.patch b/queue-6.6/wifi-rtlwifi-rtl8192de-fix-low-speed-with-wpa3-sae.patch
new file mode 100644 (file)
index 0000000..123391d
--- /dev/null
@@ -0,0 +1,80 @@
+From a7c0f48410f546772ac94a0f7b7291a15c4fc173 Mon Sep 17 00:00:00 2001
+From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+Date: Thu, 25 Apr 2024 21:12:38 +0300
+Subject: wifi: rtlwifi: rtl8192de: Fix low speed with WPA3-SAE
+
+From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+
+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 <rtl8821cerfe2@gmail.com>
+Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
+Link: https://msgid.link/4d600435-f0ea-46b0-bdb4-e60f173da8dd@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.6/wifi-rtw89-pci-correct-tx-resource-checking-for-pci-dma-channel-of-firmware-command.patch b/queue-6.6/wifi-rtw89-pci-correct-tx-resource-checking-for-pci-dma-channel-of-firmware-command.patch
new file mode 100644 (file)
index 0000000..d7a3659
--- /dev/null
@@ -0,0 +1,68 @@
+From c6330b129786e267b14129335a08fa7c331c308d Mon Sep 17 00:00:00 2001
+From: Ping-Ke Shih <pkshih@realtek.com>
+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 <pkshih@realtek.com>
+
+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 <pkshih@realtek.com>
+Link: https://msgid.link/20240410011316.9906-1-pkshih@realtek.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -958,7 +958,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;