From: Greg Kroah-Hartman Date: Mon, 26 Aug 2024 11:47:19 +0000 (+0200) Subject: 5.15-stable patches X-Git-Tag: v6.1.107~48 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b4f0914a614e0d6e12b23a4a5187be24b8dc6830;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: drm-amdgpu-sdma5.2-limit-wptr-workaround-to-sdma-5.2.1.patch hid-microsoft-add-rumble-support-to-latest-xbox-controllers.patch hid-wacom-defer-calculation-of-resolution-until-resolution_code-is-known.patch mips-loongson64-set-timer-mode-in-cpu-probe.patch scsi-core-fix-the-return-value-of-scsi_logical_block_count.patch --- diff --git a/queue-5.15/drm-amdgpu-sdma5.2-limit-wptr-workaround-to-sdma-5.2.1.patch b/queue-5.15/drm-amdgpu-sdma5.2-limit-wptr-workaround-to-sdma-5.2.1.patch new file mode 100644 index 00000000000..dc1114dccd1 --- /dev/null +++ b/queue-5.15/drm-amdgpu-sdma5.2-limit-wptr-workaround-to-sdma-5.2.1.patch @@ -0,0 +1,50 @@ +From e3e4bf58bad1576ac732a1429f53e3d4bfb82b4b Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Wed, 14 Aug 2024 10:28:24 -0400 +Subject: drm/amdgpu/sdma5.2: limit wptr workaround to sdma 5.2.1 + +From: Alex Deucher + +commit e3e4bf58bad1576ac732a1429f53e3d4bfb82b4b upstream. + +The workaround seems to cause stability issues on other +SDMA 5.2.x IPs. + +Fixes: a03ebf116303 ("drm/amdgpu/sdma5.2: Update wptr registers as well as doorbell") +Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3556 +Acked-by: Ruijing Dong +Signed-off-by: Alex Deucher +(cherry picked from commit 2dc3851ef7d9c5439ea8e9623fc36878f3b40649) +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c ++++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +@@ -298,14 +298,16 @@ static void sdma_v5_2_ring_set_wptr(stru + DRM_DEBUG("calling WDOORBELL64(0x%08x, 0x%016llx)\n", + ring->doorbell_index, ring->wptr << 2); + WDOORBELL64(ring->doorbell_index, ring->wptr << 2); +- /* SDMA seems to miss doorbells sometimes when powergating kicks in. +- * Updating the wptr directly will wake it. This is only safe because +- * we disallow gfxoff in begin_use() and then allow it again in end_use(). +- */ +- WREG32(sdma_v5_2_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR), +- lower_32_bits(ring->wptr << 2)); +- WREG32(sdma_v5_2_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR_HI), +- upper_32_bits(ring->wptr << 2)); ++ if (amdgpu_ip_version(adev, SDMA0_HWIP, 0) == IP_VERSION(5, 2, 1)) { ++ /* SDMA seems to miss doorbells sometimes when powergating kicks in. ++ * Updating the wptr directly will wake it. This is only safe because ++ * we disallow gfxoff in begin_use() and then allow it again in end_use(). ++ */ ++ WREG32(sdma_v5_2_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR), ++ lower_32_bits(ring->wptr << 2)); ++ WREG32(sdma_v5_2_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR_HI), ++ upper_32_bits(ring->wptr << 2)); ++ } + } else { + DRM_DEBUG("Not using doorbell -- " + "mmSDMA%i_GFX_RB_WPTR == 0x%08x " diff --git a/queue-5.15/hid-microsoft-add-rumble-support-to-latest-xbox-controllers.patch b/queue-5.15/hid-microsoft-add-rumble-support-to-latest-xbox-controllers.patch new file mode 100644 index 00000000000..fe051108e07 --- /dev/null +++ b/queue-5.15/hid-microsoft-add-rumble-support-to-latest-xbox-controllers.patch @@ -0,0 +1,97 @@ +From f5554725f30475b05b5178b998366f11ecb50c7f Mon Sep 17 00:00:00 2001 +From: Siarhei Vishniakou +Date: Tue, 25 Apr 2023 09:38:44 -0700 +Subject: HID: microsoft: Add rumble support to latest xbox controllers + +From: Siarhei Vishniakou + +commit f5554725f30475b05b5178b998366f11ecb50c7f upstream. + +Currently, rumble is only supported via bluetooth on a single xbox +controller, called 'model 1708'. On the back of the device, it's named +'wireless controller for xbox one'. However, in 2021, Microsoft released +a firmware update for this controller. As part of this update, the HID +descriptor of the device changed. The product ID was also changed from +0x02fd to 0x0b20. On this controller, rumble was supported via +hid-microsoft, which matched against the old product id (0x02fd). As a +result, the firmware update broke rumble support on this controller. + +See: +https://news.xbox.com/en-us/2021/09/08/xbox-controller-firmware-update-rolling-out-to-insiders-starting-today/ + +The hid-microsoft driver actually supports rumble on the new firmware, +as well. So simply adding new product id is sufficient to bring back +this support. + +After discussing further with the xbox team, it was pointed out that +another xbox controller, xbox elite series 2, can be supported in a +similar way. + +Add rumble support for all of these devices in this patch. Two of the +devices have received firmware updates that caused their product id's to +change. Both old and new firmware versions of these devices were tested. + +The tested controllers are: + +1. 'wireless controller for xbox one', model 1708 +2. 'xbox wireless controller', model 1914. This is also sometimes + referred to as 'xbox series S|X'. +3. 'elite series 2', model 1797. + +The tested configurations are: +1. model 1708, pid 0x02fd (old firmware) +2. model 1708, pid 0x0b20 (new firmware) +3. model 1914, pid 0x0b13 +4. model 1797, pid 0x0b05 (old firmware) +5. model 1797, pid 0x0b22 (new firmware) + +I verified rumble support on both bluetooth and usb. + +Reviewed-by: Bastien Nocera +Signed-off-by: Siarhei Vishniakou +Signed-off-by: Jiri Kosina +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/hid-ids.h | 10 +++++++++- + drivers/hid/hid-microsoft.c | 11 ++++++++++- + 2 files changed, 19 insertions(+), 2 deletions(-) + +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -894,7 +894,15 @@ + #define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9 + #define USB_DEVICE_ID_MS_POWER_COVER 0x07da + #define USB_DEVICE_ID_MS_SURFACE3_COVER 0x07de +-#define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd ++/* ++ * For a description of the Xbox controller models, refer to: ++ * https://en.wikipedia.org/wiki/Xbox_Wireless_Controller#Summary ++ */ ++#define USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1708 0x02fd ++#define USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1708_BLE 0x0b20 ++#define USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1914 0x0b13 ++#define USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1797 0x0b05 ++#define USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1797_BLE 0x0b22 + #define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb + #define USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS 0x02e0 + #define USB_DEVICE_ID_MS_MOUSE_0783 0x0783 +--- a/drivers/hid/hid-microsoft.c ++++ b/drivers/hid/hid-microsoft.c +@@ -446,7 +446,16 @@ static const struct hid_device_id ms_dev + .driver_data = MS_PRESENTER }, + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, 0x091B), + .driver_data = MS_SURFACE_DIAL }, +- { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER), ++ ++ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1708), ++ .driver_data = MS_QUIRK_FF }, ++ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1708_BLE), ++ .driver_data = MS_QUIRK_FF }, ++ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1914), ++ .driver_data = MS_QUIRK_FF }, ++ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1797), ++ .driver_data = MS_QUIRK_FF }, ++ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1797_BLE), + .driver_data = MS_QUIRK_FF }, + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS), + .driver_data = MS_QUIRK_FF }, diff --git a/queue-5.15/hid-wacom-defer-calculation-of-resolution-until-resolution_code-is-known.patch b/queue-5.15/hid-wacom-defer-calculation-of-resolution-until-resolution_code-is-known.patch new file mode 100644 index 00000000000..f0cfb8814bc --- /dev/null +++ b/queue-5.15/hid-wacom-defer-calculation-of-resolution-until-resolution_code-is-known.patch @@ -0,0 +1,49 @@ +From 1b8f9c1fb464968a5b18d3acc1da8c00bad24fad Mon Sep 17 00:00:00 2001 +From: Jason Gerecke +Date: Tue, 30 Jul 2024 08:51:55 -0700 +Subject: HID: wacom: Defer calculation of resolution until resolution_code is known + +From: Jason Gerecke + +commit 1b8f9c1fb464968a5b18d3acc1da8c00bad24fad upstream. + +The Wacom driver maps the HID_DG_TWIST usage to ABS_Z (rather than ABS_RZ) +for historic reasons. When the code to support twist was introduced in +commit 50066a042da5 ("HID: wacom: generic: Add support for height, tilt, +and twist usages"), we were careful to write it in such a way that it had +HID calculate the resolution of the twist axis assuming ABS_RZ instead +(so that we would get correct angular behavior). This was broken with +the introduction of commit 08a46b4190d3 ("HID: wacom: Set a default +resolution for older tablets"), which moved the resolution calculation +to occur *before* the adjustment from ABS_Z to ABS_RZ occurred. + +This commit moves the calculation of resolution after the point that +we are finished setting things up for its proper use. + +Signed-off-by: Jason Gerecke +Fixes: 08a46b4190d3 ("HID: wacom: Set a default resolution for older tablets") +Cc: stable@vger.kernel.org +Signed-off-by: Jiri Kosina +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/wacom_wac.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/hid/wacom_wac.c ++++ b/drivers/hid/wacom_wac.c +@@ -1924,12 +1924,14 @@ static void wacom_map_usage(struct input + int fmax = field->logical_maximum; + unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid); + int resolution_code = code; +- int resolution = hidinput_calc_abs_res(field, resolution_code); ++ int resolution; + + if (equivalent_usage == HID_DG_TWIST) { + resolution_code = ABS_RZ; + } + ++ resolution = hidinput_calc_abs_res(field, resolution_code); ++ + if (equivalent_usage == HID_GD_X) { + fmin += features->offset_left; + fmax -= features->offset_right; diff --git a/queue-5.15/mips-loongson64-set-timer-mode-in-cpu-probe.patch b/queue-5.15/mips-loongson64-set-timer-mode-in-cpu-probe.patch new file mode 100644 index 00000000000..4cd46c201ad --- /dev/null +++ b/queue-5.15/mips-loongson64-set-timer-mode-in-cpu-probe.patch @@ -0,0 +1,47 @@ +From 1cb6ab446424649f03c82334634360c2e3043684 Mon Sep 17 00:00:00 2001 +From: Jiaxun Yang +Date: Tue, 23 Jul 2024 17:15:44 +0800 +Subject: MIPS: Loongson64: Set timer mode in cpu-probe + +From: Jiaxun Yang + +commit 1cb6ab446424649f03c82334634360c2e3043684 upstream. + +Loongson64 C and G processors have EXTIMER feature which +is conflicting with CP0 counter. + +Although the processor resets in EXTIMER disabled & INTIMER +enabled mode, which is compatible with MIPS CP0 compare, firmware +may attempt to enable EXTIMER and interfere CP0 compare. + +Set timer mode back to MIPS compatible mode to fix booting on +systems with such firmware before we have an actual driver for +EXTIMER. + +Cc: stable@vger.kernel.org +Signed-off-by: Jiaxun Yang +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/kernel/cpu-probe.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/arch/mips/kernel/cpu-probe.c ++++ b/arch/mips/kernel/cpu-probe.c +@@ -1782,12 +1782,16 @@ static inline void cpu_probe_loongson(st + c->ases |= (MIPS_ASE_LOONGSON_MMI | MIPS_ASE_LOONGSON_CAM | + MIPS_ASE_LOONGSON_EXT | MIPS_ASE_LOONGSON_EXT2); + c->ases &= ~MIPS_ASE_VZ; /* VZ of Loongson-3A2000/3000 is incomplete */ ++ change_c0_config6(LOONGSON_CONF6_EXTIMER | LOONGSON_CONF6_INTIMER, ++ LOONGSON_CONF6_INTIMER); + break; + case PRID_IMP_LOONGSON_64G: + __cpu_name[cpu] = "ICT Loongson-3"; + set_elf_platform(cpu, "loongson3a"); + set_isa(c, MIPS_CPU_ISA_M64R2); + decode_cpucfg(c); ++ change_c0_config6(LOONGSON_CONF6_EXTIMER | LOONGSON_CONF6_INTIMER, ++ LOONGSON_CONF6_INTIMER); + break; + default: + panic("Unknown Loongson Processor ID!"); diff --git a/queue-5.15/scsi-core-fix-the-return-value-of-scsi_logical_block_count.patch b/queue-5.15/scsi-core-fix-the-return-value-of-scsi_logical_block_count.patch new file mode 100644 index 00000000000..9790bb31ad0 --- /dev/null +++ b/queue-5.15/scsi-core-fix-the-return-value-of-scsi_logical_block_count.patch @@ -0,0 +1,36 @@ +From f03e94f23b04c2b71c0044c1534921b3975ef10c Mon Sep 17 00:00:00 2001 +From: Chaotian Jing +Date: Tue, 13 Aug 2024 13:34:10 +0800 +Subject: scsi: core: Fix the return value of scsi_logical_block_count() + +From: Chaotian Jing + +commit f03e94f23b04c2b71c0044c1534921b3975ef10c upstream. + +scsi_logical_block_count() should return the block count of a given SCSI +command. The original implementation ended up shifting twice, leading to an +incorrect count being returned. Fix the conversion between bytes and +logical blocks. + +Cc: stable@vger.kernel.org +Fixes: 6a20e21ae1e2 ("scsi: core: Add helper to return number of logical blocks in a request") +Signed-off-by: Chaotian Jing +Link: https://lore.kernel.org/r/20240813053534.7720-1-chaotian.jing@mediatek.com +Reviewed-by: Bart Van Assche +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + include/scsi/scsi_cmnd.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/include/scsi/scsi_cmnd.h ++++ b/include/scsi/scsi_cmnd.h +@@ -247,7 +247,7 @@ static inline sector_t scsi_get_lba(stru + + static inline unsigned int scsi_logical_block_count(struct scsi_cmnd *scmd) + { +- unsigned int shift = ilog2(scmd->device->sector_size) - SECTOR_SHIFT; ++ unsigned int shift = ilog2(scmd->device->sector_size); + + return blk_rq_bytes(scsi_cmd_to_rq(scmd)) >> shift; + } diff --git a/queue-5.15/series b/queue-5.15/series index 7628589b93b..9111c5d504e 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -157,3 +157,8 @@ drm-msm-dp-reset-the-link-phy-params-before-link-tra.patch drm-msm-dpu-cleanup-fb-if-dpu_format_populate_layout.patch mmc-mmc_test-fix-null-dereference-on-allocation-fail.patch bluetooth-mgmt-add-error-handling-to-pair_device.patch +scsi-core-fix-the-return-value-of-scsi_logical_block_count.patch +drm-amdgpu-sdma5.2-limit-wptr-workaround-to-sdma-5.2.1.patch +mips-loongson64-set-timer-mode-in-cpu-probe.patch +hid-wacom-defer-calculation-of-resolution-until-resolution_code-is-known.patch +hid-microsoft-add-rumble-support-to-latest-xbox-controllers.patch