From 55c33c5155a172b17988bf331b2d11da1a25596e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 13 Oct 2022 19:17:01 +0200 Subject: [PATCH] 4.9-stable patches added patches: input-xpad-add-supported-devices-as-contributed-on-github.patch input-xpad-fix-wireless-360-controller-breaking-after-suspend.patch random-use-expired-timer-rather-than-wq-for-mixing-fast-pool.patch --- ...ted-devices-as-contributed-on-github.patch | 104 +++++++++++++++ ...60-controller-breaking-after-suspend.patch | 39 ++++++ ...-rather-than-wq-for-mixing-fast-pool.patch | 121 ++++++++++++++++++ queue-4.9/series | 3 + 4 files changed, 267 insertions(+) create mode 100644 queue-4.9/input-xpad-add-supported-devices-as-contributed-on-github.patch create mode 100644 queue-4.9/input-xpad-fix-wireless-360-controller-breaking-after-suspend.patch create mode 100644 queue-4.9/random-use-expired-timer-rather-than-wq-for-mixing-fast-pool.patch diff --git a/queue-4.9/input-xpad-add-supported-devices-as-contributed-on-github.patch b/queue-4.9/input-xpad-add-supported-devices-as-contributed-on-github.patch new file mode 100644 index 00000000000..d3a4ef71424 --- /dev/null +++ b/queue-4.9/input-xpad-add-supported-devices-as-contributed-on-github.patch @@ -0,0 +1,104 @@ +From b382c5e37344883dc97525d05f1f6b788f549985 Mon Sep 17 00:00:00 2001 +From: Pavel Rojtberg +Date: Thu, 18 Aug 2022 17:44:08 +0200 +Subject: Input: xpad - add supported devices as contributed on github + +From: Pavel Rojtberg + +commit b382c5e37344883dc97525d05f1f6b788f549985 upstream. + +This is based on multiple commits at https://github.com/paroj/xpad + +Cc: stable@vger.kernel.org +Signed-off-by: Jasper Poppe +Signed-off-by: Jeremy Palmer +Signed-off-by: Ruineka +Signed-off-by: Cleber de Mattos Casali +Signed-off-by: Kyle Gospodnetich +Signed-off-by: Pavel Rojtberg +Link: https://lore.kernel.org/r/20220818154411.510308-2-rojtberg@gmail.com +Signed-off-by: Dmitry Torokhov +Signed-off-by: Greg Kroah-Hartman +--- + drivers/input/joystick/xpad.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -129,6 +129,8 @@ static const struct xpad_device { + u8 xtype; + } xpad_device[] = { + { 0x0079, 0x18d4, "GPD Win 2 X-Box Controller", 0, XTYPE_XBOX360 }, ++ { 0x03eb, 0xff01, "Wooting One (Legacy)", 0, XTYPE_XBOX360 }, ++ { 0x03eb, 0xff02, "Wooting Two (Legacy)", 0, XTYPE_XBOX360 }, + { 0x044f, 0x0f00, "Thrustmaster Wheel", 0, XTYPE_XBOX }, + { 0x044f, 0x0f03, "Thrustmaster Wheel", 0, XTYPE_XBOX }, + { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, +@@ -259,6 +261,7 @@ static const struct xpad_device { + { 0x0f0d, 0x0063, "Hori Real Arcade Pro Hayabusa (USA) Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, + { 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE }, + { 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, ++ { 0x0f0d, 0x00c5, "Hori Fighting Commander ONE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, + { 0x0f30, 0x010b, "Philips Recoil", 0, XTYPE_XBOX }, + { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, + { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, +@@ -275,6 +278,7 @@ static const struct xpad_device { + { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, + { 0x1430, 0xf801, "RedOctane Controller", 0, XTYPE_XBOX360 }, + { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 }, ++ { 0x146b, 0x0604, "Bigben Interactive DAIJA Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x1532, 0x0037, "Razer Sabertooth", 0, XTYPE_XBOX360 }, + { 0x1532, 0x0a00, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, + { 0x1532, 0x0a03, "Razer Wildcat", 0, XTYPE_XBOXONE }, +@@ -339,6 +343,7 @@ static const struct xpad_device { + { 0x24c6, 0x5502, "Hori Fighting Stick VX Alt", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x24c6, 0x5503, "Hori Fighting Edge", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x24c6, 0x5506, "Hori SOULCALIBUR V Stick", 0, XTYPE_XBOX360 }, ++ { 0x24c6, 0x5510, "Hori Fighting Commander ONE (Xbox 360/PC Mode)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x24c6, 0x550d, "Hori GEM Xbox controller", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x550e, "Hori Real Arcade Pro V Kai 360", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x24c6, 0x551a, "PowerA FUSION Pro Controller", 0, XTYPE_XBOXONE }, +@@ -348,6 +353,14 @@ static const struct xpad_device { + { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, + { 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, ++ { 0x2563, 0x058d, "OneXPlayer Gamepad", 0, XTYPE_XBOX360 }, ++ { 0x2dc8, 0x2000, "8BitDo Pro 2 Wired Controller fox Xbox", 0, XTYPE_XBOXONE }, ++ { 0x31e3, 0x1100, "Wooting One", 0, XTYPE_XBOX360 }, ++ { 0x31e3, 0x1200, "Wooting Two", 0, XTYPE_XBOX360 }, ++ { 0x31e3, 0x1210, "Wooting Lekker", 0, XTYPE_XBOX360 }, ++ { 0x31e3, 0x1220, "Wooting Two HE", 0, XTYPE_XBOX360 }, ++ { 0x31e3, 0x1300, "Wooting 60HE (AVR)", 0, XTYPE_XBOX360 }, ++ { 0x31e3, 0x1310, "Wooting 60HE (ARM)", 0, XTYPE_XBOX360 }, + { 0x3285, 0x0607, "Nacon GC-100", 0, XTYPE_XBOX360 }, + { 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX }, + { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, +@@ -433,6 +446,7 @@ static const signed short xpad_abs_trigg + static const struct usb_device_id xpad_table[] = { + { USB_INTERFACE_INFO('X', 'B', 0) }, /* X-Box USB-IF not approved class */ + XPAD_XBOX360_VENDOR(0x0079), /* GPD Win 2 Controller */ ++ XPAD_XBOX360_VENDOR(0x03eb), /* Wooting Keyboards (Legacy) */ + XPAD_XBOX360_VENDOR(0x044f), /* Thrustmaster X-Box 360 controllers */ + XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */ + XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */ +@@ -443,6 +457,7 @@ static const struct usb_device_id xpad_t + { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ + XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */ + XPAD_XBOX360_VENDOR(0x07ff), /* Mad Catz GamePad */ ++ XPAD_XBOX360_VENDOR(0x0c12), /* Zeroplus X-Box 360 controllers */ + XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ + XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ + XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ +@@ -463,8 +478,12 @@ static const struct usb_device_id xpad_t + XPAD_XBOXONE_VENDOR(0x20d6), /* PowerA Controllers */ + XPAD_XBOX360_VENDOR(0x24c6), /* PowerA Controllers */ + XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ ++ XPAD_XBOX360_VENDOR(0x2563), /* OneXPlayer Gamepad */ ++ XPAD_XBOX360_VENDOR(0x260d), /* Dareu H101 */ ++ XPAD_XBOXONE_VENDOR(0x2dc8), /* 8BitDo Pro 2 Wired Controller for Xbox */ + XPAD_XBOXONE_VENDOR(0x2e24), /* Hyperkin Duke X-Box One pad */ + XPAD_XBOX360_VENDOR(0x2f24), /* GameSir Controllers */ ++ XPAD_XBOX360_VENDOR(0x31e3), /* Wooting Keyboards */ + XPAD_XBOX360_VENDOR(0x3285), /* Nacon GC-100 */ + { } + }; diff --git a/queue-4.9/input-xpad-fix-wireless-360-controller-breaking-after-suspend.patch b/queue-4.9/input-xpad-fix-wireless-360-controller-breaking-after-suspend.patch new file mode 100644 index 00000000000..23495e44033 --- /dev/null +++ b/queue-4.9/input-xpad-fix-wireless-360-controller-breaking-after-suspend.patch @@ -0,0 +1,39 @@ +From a17b9841152e7f4621619902b347e2cc39c32996 Mon Sep 17 00:00:00 2001 +From: Cameron Gutman +Date: Thu, 18 Aug 2022 17:44:09 +0200 +Subject: Input: xpad - fix wireless 360 controller breaking after suspend + +From: Cameron Gutman + +commit a17b9841152e7f4621619902b347e2cc39c32996 upstream. + +Suspending and resuming the system can sometimes cause the out +URB to get hung after a reset_resume. This causes LED setting +and force feedback to break on resume. To avoid this, just drop +the reset_resume callback so the USB core rebinds xpad to the +wireless pads on resume if a reset happened. + +A nice side effect of this change is the LED ring on wireless +controllers is now set correctly on system resume. + +Cc: stable@vger.kernel.org +Fixes: 4220f7db1e42 ("Input: xpad - workaround dead irq_out after suspend/ resume") +Signed-off-by: Cameron Gutman +Signed-off-by: Pavel Rojtberg +Link: https://lore.kernel.org/r/20220818154411.510308-3-rojtberg@gmail.com +Signed-off-by: Dmitry Torokhov +Signed-off-by: Greg Kroah-Hartman +--- + drivers/input/joystick/xpad.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -2000,7 +2000,6 @@ static struct usb_driver xpad_driver = { + .disconnect = xpad_disconnect, + .suspend = xpad_suspend, + .resume = xpad_resume, +- .reset_resume = xpad_resume, + .id_table = xpad_table, + }; + diff --git a/queue-4.9/random-use-expired-timer-rather-than-wq-for-mixing-fast-pool.patch b/queue-4.9/random-use-expired-timer-rather-than-wq-for-mixing-fast-pool.patch new file mode 100644 index 00000000000..0bb3f04dbff --- /dev/null +++ b/queue-4.9/random-use-expired-timer-rather-than-wq-for-mixing-fast-pool.patch @@ -0,0 +1,121 @@ +From 748bc4dd9e663f23448d8ad7e58c011a67ea1eca Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Thu, 22 Sep 2022 18:46:04 +0200 +Subject: random: use expired timer rather than wq for mixing fast pool +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jason A. Donenfeld + +commit 748bc4dd9e663f23448d8ad7e58c011a67ea1eca upstream. + +Previously, the fast pool was dumped into the main pool periodically in +the fast pool's hard IRQ handler. This worked fine and there weren't +problems with it, until RT came around. Since RT converts spinlocks into +sleeping locks, problems cropped up. Rather than switching to raw +spinlocks, the RT developers preferred we make the transformation from +originally doing: + + do_some_stuff() + spin_lock() + do_some_other_stuff() + spin_unlock() + +to doing: + + do_some_stuff() + queue_work_on(some_other_stuff_worker) + +This is an ordinary pattern done all over the kernel. However, Sherry +noticed a 10% performance regression in qperf TCP over a 40gbps +InfiniBand card. Quoting her message: + +> MT27500 Family [ConnectX-3] cards: +> Infiniband device 'mlx4_0' port 1 status: +> default gid: fe80:0000:0000:0000:0010:e000:0178:9eb1 +> base lid: 0x6 +> sm lid: 0x1 +> state: 4: ACTIVE +> phys state: 5: LinkUp +> rate: 40 Gb/sec (4X QDR) +> link_layer: InfiniBand +> +> Cards are configured with IP addresses on private subnet for IPoIB +> performance testing. +> Regression identified in this bug is in TCP latency in this stack as reported +> by qperf tcp_lat metric: +> +> We have one system listen as a qperf server: +> [root@yourQperfServer ~]# qperf +> +> Have the other system connect to qperf server as a client (in this +> case, it’s X7 server with Mellanox card): +> [root@yourQperfClient ~]# numactl -m0 -N0 qperf 20.20.20.101 -v -uu -ub --time 60 --wait_server 20 -oo msg_size:4K:1024K:*2 tcp_lat + +Rather than incur the scheduling latency from queue_work_on, we can +instead switch to running on the next timer tick, on the same core. This +also batches things a bit more -- once per jiffy -- which is okay now +that mix_interrupt_randomness() can credit multiple bits at once. + +Reported-by: Sherry Yang +Tested-by: Paul Webb +Cc: Sherry Yang +Cc: Phillip Goerl +Cc: Jack Vogel +Cc: Nicky Veitch +Cc: Colm Harrington +Cc: Ramanan Govindarajan +Cc: Sebastian Andrzej Siewior +Cc: Dominik Brodowski +Cc: Tejun Heo +Cc: Sultan Alsawaf +Cc: stable@vger.kernel.org +Fixes: 58340f8e952b ("random: defer fast pool mixing to worker") +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Greg Kroah-Hartman +--- + drivers/char/random.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -894,7 +894,7 @@ struct fast_pool { + unsigned long pool[4]; + unsigned long last; + unsigned int count; +- struct work_struct mix; ++ struct timer_list mix; + }; + + static DEFINE_PER_CPU(struct fast_pool, irq_randomness) = { +@@ -946,9 +946,9 @@ int __cold random_online_cpu(unsigned in + } + #endif + +-static void mix_interrupt_randomness(struct work_struct *work) ++static void mix_interrupt_randomness(unsigned long data) + { +- struct fast_pool *fast_pool = container_of(work, struct fast_pool, mix); ++ struct fast_pool *fast_pool = (struct fast_pool *)data; + /* + * The size of the copied stack pool is explicitly 2 longs so that we + * only ever ingest half of the siphash output each time, retaining +@@ -1000,10 +1000,14 @@ void add_interrupt_randomness(int irq) + if (new_count < 1024 && !time_is_before_jiffies(fast_pool->last + HZ)) + return; + +- if (unlikely(!fast_pool->mix.func)) +- INIT_WORK(&fast_pool->mix, mix_interrupt_randomness); ++ if (unlikely(!fast_pool->mix.data)) ++ setup_timer(&fast_pool->mix, mix_interrupt_randomness, (unsigned long)fast_pool); ++ + fast_pool->count |= MIX_INFLIGHT; +- queue_work_on(raw_smp_processor_id(), system_highpri_wq, &fast_pool->mix); ++ if (!timer_pending(&fast_pool->mix)) { ++ fast_pool->mix.expires = jiffies; ++ add_timer_on(&fast_pool->mix, raw_smp_processor_id()); ++ } + } + EXPORT_SYMBOL_GPL(add_interrupt_randomness); + diff --git a/queue-4.9/series b/queue-4.9/series index d0032980da7..c87cd46d4d3 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -35,3 +35,6 @@ usb-serial-qcserial-add-new-usb-id-for-dell-branded-em7455.patch random-avoid-reading-two-cache-lines-on-irq-randomness.patch wifi-mac80211_hwsim-avoid-mac80211-warning-on-bad-rate.patch random-restore-o_nonblock-support.patch +input-xpad-add-supported-devices-as-contributed-on-github.patch +input-xpad-fix-wireless-360-controller-breaking-after-suspend.patch +random-use-expired-timer-rather-than-wq-for-mixing-fast-pool.patch -- 2.47.3