From e287e792173c146be15508a4661fa787e4edd023 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sun, 6 Dec 2020 01:23:35 +0100 Subject: [PATCH] Update v5.9 patches Changes: - SAM: - Battery: Take UEFI battery limiter into accound when scheduling delayed update - Clean up code, minor fixes - Misc: - Drop efivarfs fix (included in upstream v5.9.12) Links: - SAM: https://github.com/linux-surface/surface-aggregator-module/commit/61b9bb859c30a8e17654c3a06696feb2691438f7 - kernel: https://github.com/linux-surface/kernel/commit/cecd2a327cc7f732cbe0fbd13a64f3c5c68e360c --- patches/5.9/0001-surface3-oemb.patch | 2 +- patches/5.9/0002-wifi.patch | 24 ++-- patches/5.9/0003-ipts.patch | 6 +- patches/5.9/0004-surface-gpe.patch | 2 +- patches/5.9/0005-surface-sam-over-hid.patch | 4 +- patches/5.9/0006-surface-sam.patch | 136 ++++++++---------- patches/5.9/0007-surface-typecover.patch | 2 +- ...t-fix-memory-leak-in-efivarfs_create.patch | 37 ----- pkg/arch/kernel/PKGBUILD | 14 +- 9 files changed, 83 insertions(+), 144 deletions(-) delete mode 100644 patches/5.9/0008-efivarfs-revert-fix-memory-leak-in-efivarfs_create.patch diff --git a/patches/5.9/0001-surface3-oemb.patch b/patches/5.9/0001-surface3-oemb.patch index daff83434..a750d5ce8 100644 --- a/patches/5.9/0001-surface3-oemb.patch +++ b/patches/5.9/0001-surface3-oemb.patch @@ -1,4 +1,4 @@ -From ceab7ae053318d9fb5c2571070e7a6b21d5e5c18 Mon Sep 17 00:00:00 2001 +From a94d8427480332ff9aeb9d3c13102774561b413b Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Sun, 18 Oct 2020 16:42:44 +0900 Subject: [PATCH] (surface3-oemb) add DMI matches for Surface 3 with broken DMI diff --git a/patches/5.9/0002-wifi.patch b/patches/5.9/0002-wifi.patch index b54d76086..c5d305bae 100644 --- a/patches/5.9/0002-wifi.patch +++ b/patches/5.9/0002-wifi.patch @@ -1,4 +1,4 @@ -From 97625fe44e3b5841372a5a005ad5bf8abe7829f5 Mon Sep 17 00:00:00 2001 +From 57db185acbe73c19418b1e382434da7769bd8dc3 Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Thu, 24 Sep 2020 18:02:06 +0900 Subject: [PATCH] mwifiex: pcie: skip cancel_work_sync() on reset failure path @@ -156,7 +156,7 @@ index fc59b522f670..048f4db6027a 100644 -- 2.29.2 -From 8a0fbe6b7e2e07f69dd93decf906e0792aff5cda Mon Sep 17 00:00:00 2001 +From 3a084897e0d1c20dbbaf71ced9ae35243aa71d07 Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Mon, 28 Sep 2020 17:46:49 +0900 Subject: [PATCH] mwifiex: pcie: add DMI-based quirk impl for Surface devices @@ -364,7 +364,7 @@ index 000000000000..5326ae7e5671 -- 2.29.2 -From a5c4c15fb7384a4fda273e93ac3af9488eaf4c88 Mon Sep 17 00:00:00 2001 +From 0fd410344281b52c2916c287b3d1b293cd4c669f Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Tue, 29 Sep 2020 17:25:22 +0900 Subject: [PATCH] mwifiex: pcie: add reset_d3cold quirk for Surface gen4+ @@ -565,7 +565,7 @@ index 5326ae7e5671..8b9dcb5070d8 100644 -- 2.29.2 -From 58abf2d704a4c2acd806b0e2cd3229e938420d03 Mon Sep 17 00:00:00 2001 +From 66b7882488fb317b85ad3d7dcf5effceaf3360cb Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Tue, 29 Sep 2020 17:32:22 +0900 Subject: [PATCH] mwifiex: pcie: add reset_wsid quirk for Surface 3 @@ -744,7 +744,7 @@ index 8b9dcb5070d8..3ef7440418e3 100644 -- 2.29.2 -From 49f96b3886f2d6e5b44e38bc4d7d28a73d7d4d9e Mon Sep 17 00:00:00 2001 +From 6b2b9a9b1af80f4c6dc5d365e58eb67d2c35a1f6 Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Wed, 30 Sep 2020 18:08:24 +0900 Subject: [PATCH] mwifiex: pcie: (OEMB) add quirk for Surface 3 with broken DMI @@ -806,7 +806,7 @@ index f0a6fa0a7ae5..34dcd84f02a6 100644 -- 2.29.2 -From 0f6308694a660583998eaaf4b085c6d9f542faa9 Mon Sep 17 00:00:00 2001 +From 121ca574ca991478cc3baac14a993e18ce83584f Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Thu, 24 Sep 2020 01:56:29 +0900 Subject: [PATCH] mwifiex: fix mwifiex_shutdown_sw() causing sw reset failure @@ -883,7 +883,7 @@ index 9ee5600351a7..5965999f1b9b 100644 -- 2.29.2 -From a6920350cb750a102f41188d8cc5593aca8022a1 Mon Sep 17 00:00:00 2001 +From 2f7075c12b95401a1c2fae4fef37add75ffbb301 Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Thu, 24 Sep 2020 01:56:34 +0900 Subject: [PATCH] mwifiex: pcie: use shutdown_sw()/reinit_sw() on @@ -1025,7 +1025,7 @@ index daae572ce94e..b46d56389c3b 100644 -- 2.29.2 -From 9273f2393ed6db40a1fd976403ece9efa43765b5 Mon Sep 17 00:00:00 2001 +From dac946f47b2437bbb823297321bafc3652f3a55b Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Mon, 24 Aug 2020 17:11:35 +0900 Subject: [PATCH] mwifiex: pcie: add enable_device_dump module parameter @@ -1074,7 +1074,7 @@ index b46d56389c3b..1847a0274991 100644 -- 2.29.2 -From 2f6a82518dc5d79343ecca57f95ce191fd8025d7 Mon Sep 17 00:00:00 2001 +From 13152180a98e9c3ef572d1739900d5fc907bff91 Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Sun, 4 Oct 2020 00:11:49 +0900 Subject: [PATCH] mwifiex: pcie: disable bridge_d3 for Surface gen4+ @@ -1229,7 +1229,7 @@ index 3ef7440418e3..a95ebac06e13 100644 -- 2.29.2 -From 9615589c153464b82d3a8d2c7063067dc8e65210 Mon Sep 17 00:00:00 2001 +From a69888a523608fef1e71052457c220b5ef2a5919 Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Sun, 4 Oct 2020 00:25:48 +0900 Subject: [PATCH] mwifiex: add allow_ps_mode module parameter @@ -1291,7 +1291,7 @@ index 96848fa0e417..786f7a197613 100644 -- 2.29.2 -From 4bf302343a4b198e67e4adb0865305e2ead3e910 Mon Sep 17 00:00:00 2001 +From 238c119cc9abeb0bb1e37d2e80ff5ad72dd83add Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Sun, 4 Oct 2020 00:38:48 +0900 Subject: [PATCH] mwifiex: print message when changing ps_mode @@ -1326,7 +1326,7 @@ index 786f7a197613..8f4b8bc5ff03 100644 -- 2.29.2 -From 07b0b38626bd636aeb4b19372f8fe7c498720121 Mon Sep 17 00:00:00 2001 +From a607f02840e79e110d1cfee0c93d1bc05b5ccb04 Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Sun, 4 Oct 2020 00:59:37 +0900 Subject: [PATCH] mwifiex: disable ps_mode explicitly by default instead diff --git a/patches/5.9/0003-ipts.patch b/patches/5.9/0003-ipts.patch index 1e270b78f..d83055e5d 100644 --- a/patches/5.9/0003-ipts.patch +++ b/patches/5.9/0003-ipts.patch @@ -1,4 +1,4 @@ -From 4ea132628789feadce39cfbb79234c72b3a46acd Mon Sep 17 00:00:00 2001 +From 2d827c549219d794114a2a919c1a645d0698a2e3 Mon Sep 17 00:00:00 2001 From: Dorian Stoll Date: Fri, 25 Sep 2020 18:06:05 +0200 Subject: [PATCH] mei: Remove client devices before shutting down @@ -27,7 +27,7 @@ index bcee77768b91..21ed765003e1 100644 -- 2.29.2 -From e50580ef381fbc3e30805396e169daf688c3f5c8 Mon Sep 17 00:00:00 2001 +From 1d27083b1f51469827bc587aa98eaf5c388f977a Mon Sep 17 00:00:00 2001 From: Dorian Stoll Date: Thu, 30 Jul 2020 13:21:53 +0200 Subject: [PATCH] misc: mei: Add missing IPTS device IDs @@ -65,7 +65,7 @@ index 1de9ef7a272b..e12484840f88 100644 -- 2.29.2 -From 1d11d7bd327f477295047f940b3a9ebda7a2b955 Mon Sep 17 00:00:00 2001 +From db4ccdd7dba32fe7dfed88efb3313dbcc6d9861e Mon Sep 17 00:00:00 2001 From: Dorian Stoll Date: Thu, 6 Aug 2020 11:20:41 +0200 Subject: [PATCH] misc: Add support for Intel Precise Touch & Stylus diff --git a/patches/5.9/0004-surface-gpe.patch b/patches/5.9/0004-surface-gpe.patch index ea4ad6f92..6cce63172 100644 --- a/patches/5.9/0004-surface-gpe.patch +++ b/patches/5.9/0004-surface-gpe.patch @@ -1,4 +1,4 @@ -From e45bc35ec79b38c1b042378ee8dea73958e9be0f Mon Sep 17 00:00:00 2001 +From d8930724c6946b346702f9e7fc81d3b93292836a Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sun, 16 Aug 2020 23:39:56 +0200 Subject: [PATCH] platform/x86: Add Driver to set up lid GPEs on MS Surface diff --git a/patches/5.9/0005-surface-sam-over-hid.patch b/patches/5.9/0005-surface-sam-over-hid.patch index d4158f78a..760b83271 100644 --- a/patches/5.9/0005-surface-sam-over-hid.patch +++ b/patches/5.9/0005-surface-sam-over-hid.patch @@ -1,4 +1,4 @@ -From 8a8d8edc71e8158cfa3fd635ab7b406c3f859c7e Mon Sep 17 00:00:00 2001 +From c004218b1668743ce8207a9cb2b33384452ed993 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sat, 25 Jul 2020 17:19:53 +0200 Subject: [PATCH] i2c: acpi: Implement RawBytes read access @@ -109,7 +109,7 @@ index 37c510d9347a..aed579942436 100644 -- 2.29.2 -From 48d1d5ac3390729e19448a44d6c5ea9e57e521e7 Mon Sep 17 00:00:00 2001 +From f9ac1b1bdb271983e1259575935a76de1a81ae07 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sun, 6 Sep 2020 04:01:19 +0200 Subject: [PATCH] platform/x86: Add driver for Surface Book 1 dGPU switch diff --git a/patches/5.9/0006-surface-sam.patch b/patches/5.9/0006-surface-sam.patch index 3ba63952f..6a0674a6b 100644 --- a/patches/5.9/0006-surface-sam.patch +++ b/patches/5.9/0006-surface-sam.patch @@ -1,4 +1,4 @@ -From fd2526a6e86754774d40a3729cf12d4343448325 Mon Sep 17 00:00:00 2001 +From 17c415ea2b79fcfb7060a655c601d7b40a7ef99b Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Thu, 29 Oct 2020 22:04:38 +0100 Subject: [PATCH] PCI: Allow D3cold for hot-plug ports on Surface Books @@ -83,7 +83,7 @@ index b2fed944903e..e288e5058520 100644 -- 2.29.2 -From 0253be4dab53b5bb18ab137e561be619916ac71f Mon Sep 17 00:00:00 2001 +From cfaac0fe00bef4c3c179711dc3ca979b71c2dc64 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Mon, 9 Nov 2020 14:23:00 +0100 Subject: [PATCH] PCI: Run platform power transition on initial D0 entry @@ -143,7 +143,7 @@ index e288e5058520..d260c0fcf2d5 100644 -- 2.29.2 -From d0c37a5d6da4148fe5290f5463101c92210204d9 Mon Sep 17 00:00:00 2001 +From e6bb44005128dcb88b9c138881fdf0112f184614 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sat, 31 Oct 2020 20:46:33 +0100 Subject: [PATCH] PCI: Add sysfs attribute for PCI device power state @@ -216,7 +216,7 @@ index 6d78df981d41..17f186ce8e87 100644 -- 2.29.2 -From 60412fae510ff6932d49c9b7c213fc8463b035a9 Mon Sep 17 00:00:00 2001 +From 7512286e41932110772357e2025e266dfbac687a Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Mon, 17 Aug 2020 01:23:20 +0200 Subject: [PATCH] misc: surface_sam: Add file2alias support for Surface SAM @@ -318,7 +318,7 @@ index 2417dd1dee33..a6c583362b92 100644 -- 2.29.2 -From 2034562da8f4d79f9fbaa30bdf8eba6d594c3e1c Mon Sep 17 00:00:00 2001 +From c6b3237cc57ac3b7c1d65f9848b6a21c46acba38 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Mon, 17 Aug 2020 01:44:30 +0200 Subject: [PATCH] misc: Add support for Surface System Aggregator Module @@ -358,7 +358,7 @@ Patchset: surface-sam .../clients/surface_acpi_notify.c | 886 ++++++ .../clients/surface_aggregator_cdev.c | 299 ++ .../clients/surface_aggregator_registry.c | 653 +++++ - .../clients/surface_battery.c | 1188 ++++++++ + .../clients/surface_battery.c | 1178 ++++++++ .../surface_aggregator/clients/surface_dtx.c | 1277 +++++++++ .../surface_aggregator/clients/surface_hid.c | 924 ++++++ .../clients/surface_hotplug.c | 267 ++ @@ -367,12 +367,12 @@ Patchset: surface-sam drivers/misc/surface_aggregator/controller.h | 285 ++ drivers/misc/surface_aggregator/core.c | 834 ++++++ drivers/misc/surface_aggregator/ssh_msgb.h | 205 ++ - .../surface_aggregator/ssh_packet_layer.c | 2055 +++++++++++++ - .../surface_aggregator/ssh_packet_layer.h | 188 ++ + .../surface_aggregator/ssh_packet_layer.c | 2046 +++++++++++++ + .../surface_aggregator/ssh_packet_layer.h | 190 ++ drivers/misc/surface_aggregator/ssh_parser.c | 228 ++ drivers/misc/surface_aggregator/ssh_parser.h | 155 + - .../surface_aggregator/ssh_request_layer.c | 1265 ++++++++ - .../surface_aggregator/ssh_request_layer.h | 141 + + .../surface_aggregator/ssh_request_layer.c | 1256 ++++++++ + .../surface_aggregator/ssh_request_layer.h | 143 + drivers/misc/surface_aggregator/trace.h | 632 ++++ include/linux/mod_devicetable.h | 5 +- include/linux/surface_acpi_notify.h | 39 + @@ -383,7 +383,7 @@ Patchset: surface-sam include/uapi/linux/surface_aggregator/dtx.h | 146 + scripts/mod/devicetable-offsets.c | 3 +- scripts/mod/file2alias.c | 10 +- - 48 files changed, 18865 insertions(+), 7 deletions(-) + 48 files changed, 18841 insertions(+), 7 deletions(-) create mode 100644 Documentation/driver-api/surface_aggregator/client-api.rst create mode 100644 Documentation/driver-api/surface_aggregator/client.rst create mode 100644 Documentation/driver-api/surface_aggregator/clients/cdev.rst @@ -4961,10 +4961,10 @@ index 000000000000..0165f350d28e +MODULE_LICENSE("GPL"); diff --git a/drivers/misc/surface_aggregator/clients/surface_battery.c b/drivers/misc/surface_aggregator/clients/surface_battery.c new file mode 100644 -index 000000000000..ac26a1094c6f +index 000000000000..f22fb2ceb786 --- /dev/null +++ b/drivers/misc/surface_aggregator/clients/surface_battery.c -@@ -0,0 +1,1188 @@ +@@ -0,0 +1,1178 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Surface battery and AC device driver. @@ -5418,26 +5418,16 @@ index 000000000000..ac26a1094c6f + +static int spwr_battery_recheck_adapter(struct spwr_battery_device *bat) +{ -+ u32 full_cap = sprw_battery_get_full_cap_safe(bat); -+ u32 remaining_cap = get_unaligned_le32(&bat->bst.remaining_cap); -+ -+ if (full_cap == 0 || full_cap == SPWR_BATTERY_VALUE_UNKNOWN) -+ return 0; -+ -+ if (remaining_cap == SPWR_BATTERY_VALUE_UNKNOWN) -+ return 0; -+ + /* -+ * Handle battery update quirk: -+ * When the battery is fully charged and the adapter is plugged in or -+ * removed, the EC does not send a separate event for the state -+ * (charging/discharging) change. Furthermore it may take some time until -+ * the state is updated on the battery. Schedule an update to solve this. ++ * Handle battery update quirk: When the battery is fully charged (or ++ * charged up to the limit imposed by the UEFI battery limit) and the ++ * adapter is plugged in or removed, the EC does not send a separate ++ * event for the state (charging/discharging) change. Furthermore it ++ * may take some time until the state is updated on the battery. ++ * Schedule an update to solve this. + */ + -+ if (remaining_cap >= full_cap) -+ schedule_delayed_work(&bat->update_work, SPWR_AC_BAT_UPDATE_DELAY); -+ ++ schedule_delayed_work(&bat->update_work, SPWR_AC_BAT_UPDATE_DELAY); + return 0; +} + @@ -8769,7 +8759,7 @@ index 000000000000..cac7227f27ea +MODULE_LICENSE("GPL"); diff --git a/drivers/misc/surface_aggregator/controller.c b/drivers/misc/surface_aggregator/controller.c new file mode 100644 -index 000000000000..e39b11c0c007 +index 000000000000..09302bfba530 --- /dev/null +++ b/drivers/misc/surface_aggregator/controller.c @@ -0,0 +1,2543 @@ @@ -8883,7 +8873,7 @@ index 000000000000..e39b11c0c007 + +/** + * ssam_event_matches_notifier() - Test if an event matches a notifier. -+ * @notif: The event notifier to test against. ++ * @n: The event notifier to test against. + * @event: The event to test. + * + * Return: Returns %true iff the given event matches the given notifier @@ -12660,10 +12650,10 @@ index 000000000000..1221f642dda1 +#endif /* _SURFACE_AGGREGATOR_SSH_MSGB_H */ diff --git a/drivers/misc/surface_aggregator/ssh_packet_layer.c b/drivers/misc/surface_aggregator/ssh_packet_layer.c new file mode 100644 -index 000000000000..96141a174792 +index 000000000000..0205be9380bf --- /dev/null +++ b/drivers/misc/surface_aggregator/ssh_packet_layer.c -@@ -0,0 +1,2055 @@ +@@ -0,0 +1,2046 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * SSH packet transport layer. @@ -13330,21 +13320,16 @@ index 000000000000..96141a174792 +{ + unsigned long delta = msecs_to_jiffies(ktime_ms_delta(expires, now)); + ktime_t aexp = ktime_add(expires, SSH_PTL_PACKET_TIMEOUT_RESOLUTION); -+ ktime_t old_exp, old_act; + -+ /* Re-adjust / schedule reaper if it is above resolution delta. */ -+ old_act = READ_ONCE(ptl->rtx_timeout.expires); -+ if (ktime_after(aexp, old_act)) -+ return; ++ spin_lock(&ptl->rtx_timeout.lock); + -+ do { -+ old_exp = old_act; -+ old_act = cmpxchg64(&ptl->rtx_timeout.expires, old_exp, expires); -+ } while (old_exp != old_act && ktime_before(aexp, old_act)); -+ -+ /* If we updated the reaper expiration, modify work timeout. */ -+ if (old_exp == old_act && old_act != expires) ++ /* Re-adjust / schedule reaper only if it is above resolution delta. */ ++ if (ktime_before(aexp, ptl->rtx_timeout.expires)) { ++ ptl->rtx_timeout.expires = expires; + mod_delayed_work(system_wq, &ptl->rtx_timeout.reaper, delta); ++ } ++ ++ spin_unlock(&ptl->rtx_timeout.lock); +} + +/* Must be called with queue lock held. */ @@ -14174,14 +14159,9 @@ index 000000000000..96141a174792 + * Mark reaper as "not pending". This is done before checking any + * packets to avoid lost-update type problems. + */ -+ WRITE_ONCE(ptl->rtx_timeout.expires, KTIME_MAX); -+ /* -+ * Ensure that the reaper is marked as deactivated before we continue -+ * checking packets to prevent lost-update problems when a packet is -+ * added to the pending set and ssh_ptl_timeout_reaper_mod is called -+ * during execution of the part below. -+ */ -+ smp_mb__after_atomic(); ++ spin_lock(&ptl->rtx_timeout.lock); ++ ptl->rtx_timeout.expires = KTIME_MAX; ++ spin_unlock(&ptl->rtx_timeout.lock); + + spin_lock(&ptl->pending.lock); + @@ -14683,6 +14663,7 @@ index 000000000000..96141a174792 + ptl->rx.thread = NULL; + init_waitqueue_head(&ptl->rx.wq); + ++ spin_lock_init(&ptl->rtx_timeout.lock); + ptl->rtx_timeout.timeout = SSH_PTL_PACKET_TIMEOUT; + ptl->rtx_timeout.expires = KTIME_MAX; + INIT_DELAYED_WORK(&ptl->rtx_timeout.reaper, ssh_ptl_timeout_reap); @@ -14721,10 +14702,10 @@ index 000000000000..96141a174792 +} diff --git a/drivers/misc/surface_aggregator/ssh_packet_layer.h b/drivers/misc/surface_aggregator/ssh_packet_layer.h new file mode 100644 -index 000000000000..c844cac0f4d7 +index 000000000000..e8757d03f279 --- /dev/null +++ b/drivers/misc/surface_aggregator/ssh_packet_layer.h -@@ -0,0 +1,188 @@ +@@ -0,0 +1,190 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * SSH packet transport layer. @@ -14795,6 +14776,7 @@ index 000000000000..c844cac0f4d7 + * @rx.blocked.seqs: Array of blocked sequence IDs. + * @rx.blocked.offset: Offset indicating where a new ID should be inserted. + * @rtx_timeout: Retransmission timeout subsystem. ++ * @rtx_timeout.lock: Lock for modifying the retransmission timeout reaper. + * @rtx_timeout.timeout: Timeout interval for retransmission. + * @rtx_timeout.expires: Time specifying when the reaper work is next scheduled. + * @rtx_timeout.reaper: Work performing timeout checks and subsequent actions. @@ -14836,6 +14818,7 @@ index 000000000000..c844cac0f4d7 + } rx; + + struct { ++ spinlock_t lock; + ktime_t timeout; + ktime_t expires; + struct delayed_work reaper; @@ -15310,10 +15293,10 @@ index 000000000000..395c61ef890b +#endif /* _SURFACE_AGGREGATOR_SSH_PARSER_h */ diff --git a/drivers/misc/surface_aggregator/ssh_request_layer.c b/drivers/misc/surface_aggregator/ssh_request_layer.c new file mode 100644 -index 000000000000..966150542ae8 +index 000000000000..bf1782c85063 --- /dev/null +++ b/drivers/misc/surface_aggregator/ssh_request_layer.c -@@ -0,0 +1,1265 @@ +@@ -0,0 +1,1256 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * SSH request transport layer. @@ -15744,21 +15727,16 @@ index 000000000000..966150542ae8 +{ + unsigned long delta = msecs_to_jiffies(ktime_ms_delta(expires, now)); + ktime_t aexp = ktime_add(expires, SSH_RTL_REQUEST_TIMEOUT_RESOLUTION); -+ ktime_t old_exp, old_act; + -+ /* Re-adjust/schedule reaper if it is above resolution delta. */ -+ old_act = READ_ONCE(rtl->rtx_timeout.expires); -+ if (ktime_after(aexp, old_act)) -+ return; ++ spin_lock(&rtl->rtx_timeout.lock); + -+ do { -+ old_exp = old_act; -+ old_act = cmpxchg64(&rtl->rtx_timeout.expires, old_exp, expires); -+ } while (old_exp != old_act && ktime_before(aexp, old_act)); -+ -+ /* If we updated the reaper expiration, modify work timeout. */ -+ if (old_exp == old_act && old_act != expires) ++ /* Re-adjust / schedule reaper only if it is above resolution delta. */ ++ if (ktime_before(aexp, rtl->rtx_timeout.expires)) { ++ rtl->rtx_timeout.expires = expires; + mod_delayed_work(system_wq, &rtl->rtx_timeout.reaper, delta); ++ } ++ ++ spin_unlock(&rtl->rtx_timeout.lock); +} + +static void ssh_rtl_timeout_start(struct ssh_request *rqst) @@ -16153,14 +16131,9 @@ index 000000000000..966150542ae8 + * Mark reaper as "not pending". This is done before checking any + * requests to avoid lost-update type problems. + */ -+ WRITE_ONCE(rtl->rtx_timeout.expires, KTIME_MAX); -+ /* -+ * Ensure that the reaper is marked as deactivated before we continue -+ * checking requests to prevent lost-update problems when a request is -+ * added to the pending set and ssh_rtl_timeout_reaper_mod is called -+ * during execution of the part below. -+ */ -+ smp_mb__after_atomic(); ++ spin_lock(&rtl->rtx_timeout.lock); ++ rtl->rtx_timeout.expires = KTIME_MAX; ++ spin_unlock(&rtl->rtx_timeout.lock); + + spin_lock(&rtl->pending.lock); + list_for_each_entry_safe(r, n, &rtl->pending.head, node) { @@ -16349,6 +16322,7 @@ index 000000000000..966150542ae8 + + INIT_WORK(&rtl->tx.work, ssh_rtl_tx_work_fn); + ++ spin_lock_init(&rtl->rtx_timeout.lock); + rtl->rtx_timeout.timeout = SSH_RTL_REQUEST_TIMEOUT; + rtl->rtx_timeout.expires = KTIME_MAX; + INIT_DELAYED_WORK(&rtl->rtx_timeout.reaper, ssh_rtl_timeout_reap); @@ -16581,10 +16555,10 @@ index 000000000000..966150542ae8 +} diff --git a/drivers/misc/surface_aggregator/ssh_request_layer.h b/drivers/misc/surface_aggregator/ssh_request_layer.h new file mode 100644 -index 000000000000..ab357b2b3735 +index 000000000000..9c2efdd8ae70 --- /dev/null +++ b/drivers/misc/surface_aggregator/ssh_request_layer.h -@@ -0,0 +1,141 @@ +@@ -0,0 +1,143 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * SSH request transport layer. @@ -16643,6 +16617,7 @@ index 000000000000..ab357b2b3735 + * @tx: Transmitter subsystem. + * @tx.work: Transmitter work item. + * @rtx_timeout: Retransmission timeout subsystem. ++ * @rtx_timeout.lock: Lock for modifying the retransmission timeout reaper. + * @rtx_timeout.timeout: Timeout interval for retransmission. + * @rtx_timeout.expires: Time specifying when the reaper work is next scheduled. + * @rtx_timeout.reaper: Work performing timeout checks and subsequent actions. @@ -16668,6 +16643,7 @@ index 000000000000..ab357b2b3735 + } tx; + + struct { ++ spinlock_t lock; + ktime_t timeout; + ktime_t expires; + struct delayed_work reaper; diff --git a/patches/5.9/0007-surface-typecover.patch b/patches/5.9/0007-surface-typecover.patch index afc393306..c13f6f337 100644 --- a/patches/5.9/0007-surface-typecover.patch +++ b/patches/5.9/0007-surface-typecover.patch @@ -1,4 +1,4 @@ -From f31c0f964fe152914e4745e0b5fd358d43127ef6 Mon Sep 17 00:00:00 2001 +From a85d786b7166dbfe0fb70c202a5ba350cc9b02a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Thu, 5 Nov 2020 13:09:45 +0100 Subject: [PATCH] hid/multitouch: Turn off Type Cover keyboard backlight when diff --git a/patches/5.9/0008-efivarfs-revert-fix-memory-leak-in-efivarfs_create.patch b/patches/5.9/0008-efivarfs-revert-fix-memory-leak-in-efivarfs_create.patch deleted file mode 100644 index b237aa67c..000000000 --- a/patches/5.9/0008-efivarfs-revert-fix-memory-leak-in-efivarfs_create.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 2dce2b10919b1e74820410e97ba13caaa4bfc05e Mon Sep 17 00:00:00 2001 -From: Ard Biesheuvel -Date: Wed, 25 Nov 2020 08:53:03 +0100 -Subject: [PATCH] efivarfs: revert "fix memory leak in efivarfs_create()" - -The memory leak addressed by commit fe5186cf12e3 is a false positive: -all allocations are recorded in a linked list, and freed when the -filesystem is unmounted. This leads to double frees, and as reported -by David, leads to crashes if SLUB is configured to self destruct when -double frees occur. - -So drop the redundant kfree() again, and instead, mark the offending -pointer variable so the allocation is ignored by kmemleak. - -Cc: Vamshi K Sthambamkadi -Fixes: fe5186cf12e3 ("efivarfs: fix memory leak in efivarfs_create()") -Reported-by: David Laight -Signed-off-by: Ard Biesheuvel ---- - fs/efivarfs/super.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c -index f943fd0b0699..15880a68faad 100644 ---- a/fs/efivarfs/super.c -+++ b/fs/efivarfs/super.c -@@ -21,7 +21,6 @@ LIST_HEAD(efivarfs_list); - static void efivarfs_evict_inode(struct inode *inode) - { - clear_inode(inode); -- kfree(inode->i_private); - } - - static const struct super_operations efivarfs_ops = { --- -2.29.2 - diff --git a/pkg/arch/kernel/PKGBUILD b/pkg/arch/kernel/PKGBUILD index 41f0bab6e..fb690985f 100644 --- a/pkg/arch/kernel/PKGBUILD +++ b/pkg/arch/kernel/PKGBUILD @@ -43,13 +43,13 @@ sha256sums=('c1751f8780d73bc77cb18514f68a387945d7ac75d7914d72ecbbc58195c8cd45' '36439a90c9d2f860298d90e141f3bf9d897dd8ece9e21cd46508f4ed7b2151bb' 'cad2f23b058938c27ccdeb1944dcc492cf8696651b1ca9c74a86eb73a039f8c1' '8cd2b019aac6d3807a5cdcbbbe0aad81e63193ff3e8dffd7a79d4a1421b858f6' - '9a95e097e220f67f42d81c6929a6069690dd09810b70c264e9d5a3fd4b608bc3' - '8776e6a97ac866ba2b33d32e3b85805c0689a715dfb39f6af3f2603324faed39' - 'a782eea056c00efc4d3a970be37e1534143b5acdcf673619ec744d4b47870a20' - 'da92c82cd32b1fa8f7ee85975d52ea9447444a75b631e861a060772e8a2ece8d' - '9d682de8a2351aeab4a237a34b4c319d31c1b241bc1c18f89f090cd477e48ddc' - '7dc6d6a8789a6260a88247fef051378ef33c74016ef31b8985119f196b3395a9' - '1bd5846516e6f414dc996a442cf742e6bc43c3814716706ab7bb41885954aeb8') + 'ac1a7430ba850e34910a7b2337819f3d69fdbe86d95207f4f6964cf890c53c3f' + 'db8031f91a896371b21ec1e4eb3da2f47a3d1b83edb4e34fcf0b2091b86b90a3' + 'a5c55e39a2816d2a67a49e10c3506b16954ecf964acc086c0dbeed42d4bc6ce1' + '9c33dcfae8d6387eac46ab561957d67eaa8793c31b680e480fce080469df9649' + '86420b15d42ed16119c0920d0d34e6f119e85a2e49dbb05021cc1e9df170173c' + 'e2109a1200a2a83e964f098426221b7299f475c774c8da0df82d4ae4dba27f46' + '098569c9bb2e9b488daf93bda09a728bee3ee63ce8f6cd3dec3a68533889667b') export KBUILD_BUILD_HOST=archlinux