diff options
author | graysky | 2023-10-07 10:04:54 -0400 |
---|---|---|
committer | graysky | 2023-10-07 10:04:54 -0400 |
commit | 36c8a26d9975829936094610b29b6186da32cba0 (patch) | |
tree | 534c5cf909f110e21a7cc7704dc0d363d2be9aee | |
parent | e44a9ba53318bf428625812c228c34cb792480e4 (diff) | |
download | aur-36c8a26d9975829936094610b29b6186da32cba0.tar.gz |
Update to 6.5.6-1
-rw-r--r-- | .SRCINFO | 30 | ||||
-rw-r--r-- | 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch | 154 | ||||
-rw-r--r-- | 0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch | 89 | ||||
-rw-r--r-- | 0003-ASoC-Intel-soc-acpi-fix-Dell-SKU-0B34.patch | 51 | ||||
-rw-r--r-- | 0004-btrfs-wait-on-uncached-block-groups-on-every-allocat.patch | 255 | ||||
-rw-r--r-- | 0005-btrfs-set-last-dir-index-to-the-current-last-index-w.patch | 86 | ||||
-rw-r--r-- | 0006-btrfs-refresh-dir-last-index-during-a-rewinddir-3-ca.patch | 103 | ||||
-rw-r--r-- | 0007-btrfs-fix-race-between-reading-a-directory-and-addin.patch | 143 | ||||
-rw-r--r-- | 0008-i915-Limit-the-length-of-an-sg-list-to-the-requested.patch | 69 | ||||
-rw-r--r-- | 0009-net-wwan-t7xx-Add-AP-CLDMA.patch | 508 | ||||
-rw-r--r-- | 0010-Revert-101bd907b424-misc-rtsx-judge-ASPM-Mode-to-set.patch | 193 | ||||
-rw-r--r-- | PKGBUILD | 47 |
12 files changed, 19 insertions, 1709 deletions
@@ -1,5 +1,5 @@ pkgbase = linux-ck - pkgver = 6.5.5 + pkgver = 6.5.6 pkgrel = 1 url = https://wiki.archlinux.org/index.php/Linux-ck arch = x86_64 @@ -14,38 +14,20 @@ pkgbase = linux-ck makedepends = tar makedepends = xz options = !strip - source = https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.5.5.tar.xz - source = https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.5.5.tar.sign + source = https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.5.6.tar.xz + source = https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.5.6.tar.sign source = config + source = https://github.com/archlinux/linux/releases/download/v6.5.6-arch2/linux-v6.5.6-arch2.patch.zst source = more-uarches-20221217.tar.gz::https://github.com/graysky2/kernel_compiler_patch/archive/20221217.tar.gz source = ck-hrtimer-6ef0e9ff5db0ed380f98cc8c7436ca9c44ea32c9.tar.gz::https://github.com/graysky2/linux-patches/archive/6ef0e9ff5db0ed380f98cc8c7436ca9c44ea32c9.tar.gz - source = 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch - source = 0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch - source = 0003-ASoC-Intel-soc-acpi-fix-Dell-SKU-0B34.patch - source = 0004-btrfs-wait-on-uncached-block-groups-on-every-allocat.patch - source = 0005-btrfs-set-last-dir-index-to-the-current-last-index-w.patch - source = 0006-btrfs-refresh-dir-last-index-during-a-rewinddir-3-ca.patch - source = 0007-btrfs-fix-race-between-reading-a-directory-and-addin.patch - source = 0008-i915-Limit-the-length-of-an-sg-list-to-the-requested.patch - source = 0009-net-wwan-t7xx-Add-AP-CLDMA.patch - source = 0010-Revert-101bd907b424-misc-rtsx-judge-ASPM-Mode-to-set.patch validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886 validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E - sha256sums = 8cf10379f7df8ea731e09bff3d0827414e4b643dd41dc99d0af339669646ef95 + sha256sums = 78e36d4214547051c24df2140f4ce09428d6c515ad9a71b38b28e8094a95d2f6 sha256sums = SKIP sha256sums = 46451dbc3305d4c2e726a2f1943bddf697c5bb6815d93e5baed80bca82e53fdc + sha256sums = 90fbe7cd6c6b3e469e0f929e6ab17f7ea07c8127b91eed813004fb9aaa03a6d7 sha256sums = f1d586e111932890ad5e0df15d092fb9b3f87bae4ea17812aae9b0ec98fe2db0 sha256sums = a86a59d089ddd4f31565ff6a27ba74f4697ffa0ab0f57dc839e1da6ab83d77a4 - sha256sums = 9277f8bd1f8450edaf36ca124d5019520cf9c6f28513dc1dab1f7159be03dfb5 - sha256sums = 5ed15d63106e050c6aa92874fcb33b1f827702d42d4281a4b0366e2387f01a07 - sha256sums = 882313cbb296e62dec0d1780aad2c3086fc0fbba86438dd5cef0a1b9519a4224 - sha256sums = fa3b984d08e4d764cb6df48d9cafe19284cce059e7856b0e860bce332e92890b - sha256sums = 3dfd78e809b04a8f1374687f5be667a6275625b08f068a44470c3f2a8a37d4a1 - sha256sums = c623b7ac173cdd19a537d0767b7b82b13f166a9705cad16896556e8b9f7d3c87 - sha256sums = b6682cec5ea11cc06c27be8c3f0dc25f0168f28308e64c84d4c53f012d02f282 - sha256sums = 6bf774b0294488c01fc9392c69c355859d3fa7ea62127c3cb2f11cedf860e848 - sha256sums = 6c4dfefacd42c571bf53ddaf031566e44832ce87480c63553ddf149620e00e4e - sha256sums = 242b8868d2a1c8a403e05c0da85f0dc48192ff22adad97e552b4213a19839676 pkgname = linux-ck pkgdesc = The Linux kernel and modules with ck's hrtimer patches diff --git a/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch b/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch deleted file mode 100644 index fa1ec075fed3..000000000000 --- a/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch +++ /dev/null @@ -1,154 +0,0 @@ -From f9fd190932aac4c6fd677adf726d3402ee8cab02 Mon Sep 17 00:00:00 2001 -From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com> -Date: Mon, 16 Sep 2019 04:53:20 +0200 -Subject: [PATCH 01/11] ZEN: Add sysctl and CONFIG to disallow unprivileged - CLONE_NEWUSER - -Our default behavior continues to match the vanilla kernel. ---- - include/linux/user_namespace.h | 4 ++++ - init/Kconfig | 16 ++++++++++++++++ - kernel/fork.c | 14 ++++++++++++++ - kernel/sysctl.c | 12 ++++++++++++ - kernel/user_namespace.c | 7 +++++++ - 5 files changed, 53 insertions(+) - -diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h -index 45f09bec02c4..87b20e2ee274 100644 ---- a/include/linux/user_namespace.h -+++ b/include/linux/user_namespace.h -@@ -148,6 +148,8 @@ static inline void set_userns_rlimit_max(struct user_namespace *ns, - - #ifdef CONFIG_USER_NS - -+extern int unprivileged_userns_clone; -+ - static inline struct user_namespace *get_user_ns(struct user_namespace *ns) - { - if (ns) -@@ -181,6 +183,8 @@ extern bool current_in_userns(const struct user_namespace *target_ns); - struct ns_common *ns_get_owner(struct ns_common *ns); - #else - -+#define unprivileged_userns_clone 0 -+ - static inline struct user_namespace *get_user_ns(struct user_namespace *ns) - { - return &init_user_ns; -diff --git a/init/Kconfig b/init/Kconfig -index 5e7d4885d1bf..13ad93775237 100644 ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1226,6 +1226,22 @@ config USER_NS - - If unsure, say N. - -+config USER_NS_UNPRIVILEGED -+ bool "Allow unprivileged users to create namespaces" -+ default y -+ depends on USER_NS -+ help -+ When disabled, unprivileged users will not be able to create -+ new namespaces. Allowing users to create their own namespaces -+ has been part of several recent local privilege escalation -+ exploits, so if you need user namespaces but are -+ paranoid^Wsecurity-conscious you want to disable this. -+ -+ This setting can be overridden at runtime via the -+ kernel.unprivileged_userns_clone sysctl. -+ -+ If unsure, say Y. -+ - config PID_NS - bool "PID Namespaces" - default y -diff --git a/kernel/fork.c b/kernel/fork.c -index f81149739eb9..36fb0b711541 100644 ---- a/kernel/fork.c -+++ b/kernel/fork.c -@@ -100,6 +100,10 @@ - #include <linux/user_events.h> - #include <linux/iommu.h> - -+#ifdef CONFIG_USER_NS -+#include <linux/user_namespace.h> -+#endif -+ - #include <asm/pgalloc.h> - #include <linux/uaccess.h> - #include <asm/mmu_context.h> -@@ -2271,6 +2275,10 @@ __latent_entropy struct task_struct *copy_process( - if ((clone_flags & (CLONE_NEWUSER|CLONE_FS)) == (CLONE_NEWUSER|CLONE_FS)) - return ERR_PTR(-EINVAL); - -+ if ((clone_flags & CLONE_NEWUSER) && !unprivileged_userns_clone) -+ if (!capable(CAP_SYS_ADMIN)) -+ return ERR_PTR(-EPERM); -+ - /* - * Thread groups must share signals as well, and detached threads - * can only be started up within the thread group. -@@ -3424,6 +3432,12 @@ int ksys_unshare(unsigned long unshare_flags) - if (unshare_flags & CLONE_NEWNS) - unshare_flags |= CLONE_FS; - -+ if ((unshare_flags & CLONE_NEWUSER) && !unprivileged_userns_clone) { -+ err = -EPERM; -+ if (!capable(CAP_SYS_ADMIN)) -+ goto bad_unshare_out; -+ } -+ - err = check_unshare_flags(unshare_flags); - if (err) - goto bad_unshare_out; -diff --git a/kernel/sysctl.c b/kernel/sysctl.c -index 354a2d294f52..5bc5605e7cdb 100644 ---- a/kernel/sysctl.c -+++ b/kernel/sysctl.c -@@ -80,6 +80,9 @@ - #ifdef CONFIG_RT_MUTEXES - #include <linux/rtmutex.h> - #endif -+#ifdef CONFIG_USER_NS -+#include <linux/user_namespace.h> -+#endif - - /* shared constants to be used in various sysctls */ - const int sysctl_vals[] = { 0, 1, 2, 3, 4, 100, 200, 1000, 3000, INT_MAX, 65535, -1 }; -@@ -1623,6 +1626,15 @@ static struct ctl_table kern_table[] = { - .mode = 0644, - .proc_handler = proc_dointvec, - }, -+#ifdef CONFIG_USER_NS -+ { -+ .procname = "unprivileged_userns_clone", -+ .data = &unprivileged_userns_clone, -+ .maxlen = sizeof(int), -+ .mode = 0644, -+ .proc_handler = proc_dointvec, -+ }, -+#endif - #ifdef CONFIG_PROC_SYSCTL - { - .procname = "tainted", -diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c -index 1d8e47bed3f1..fec01d016a35 100644 ---- a/kernel/user_namespace.c -+++ b/kernel/user_namespace.c -@@ -22,6 +22,13 @@ - #include <linux/bsearch.h> - #include <linux/sort.h> - -+/* sysctl */ -+#ifdef CONFIG_USER_NS_UNPRIVILEGED -+int unprivileged_userns_clone = 1; -+#else -+int unprivileged_userns_clone; -+#endif -+ - static struct kmem_cache *user_ns_cachep __read_mostly; - static DEFINE_MUTEX(userns_state_mutex); - --- -2.42.0 - diff --git a/0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch b/0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch deleted file mode 100644 index 873c3be2bde0..000000000000 --- a/0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch +++ /dev/null @@ -1,89 +0,0 @@ -From c25007584d35a8aa500377707ed720c65feb6cc3 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas <javierm@redhat.com> -Date: Thu, 19 May 2022 14:40:07 +0200 -Subject: [PATCH 02/11] drivers/firmware: skip simpledrm if - nvidia-drm.modeset=1 is set - -The Nvidia proprietary driver has some bugs that leads to issues if used -with the simpledrm driver. The most noticeable is that does not register -an emulated fbdev device. - -It just relies on a fbdev to be registered by another driver, that could -be that could be attached to the framebuffer console. On UEFI machines, -this is the efifb driver. - -This means that disabling the efifb driver will cause virtual consoles to -not be present in the system when using the Nvidia driver. Legacy BIOS is -not affected just because fbcon is not used there, but instead vgacon. - -Unless a VGA mode is specified using the vga= kernel command line option, -in that case the vesafb driver is used instead and its fbdev attached to -the fbcon. - -This is a problem because with CONFIG_SYSFB_SIMPLEFB=y, the sysfb platform -code attempts to register a "simple-framebuffer" platform device (that is -matched against simpledrm) and only registers either an "efi-framebuffer" -or "vesa-framebuffer" if this fails to be registered due the video modes -not being compatible. - -The Nvidia driver relying on another driver to register the fbdev is quite -fragile, since it can't really assume those will stick around. For example -there are patches posted to remove the EFI and VESA platform devices once -a real DRM or fbdev driver probes. - -But in any case, moving to a simpledrm + emulated fbdev only breaks this -assumption and causes users to not have VT if the Nvidia driver is used. - -So to prevent this, let's add a workaround and make the sysfb to skip the -"simple-framebuffer" registration when nvidia-drm.modeset=1 option is set. - -This is quite horrible, but honestly I can't think of any other approach. - -For this to work, the CONFIG_FB_EFI and CONFIG_FB_VESA config options must -be enabled besides CONFIG_DRM_SIMPLEDRM. - -Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> -Cherry-picked-for: https://bugs.archlinux.org/task/73720 ---- - drivers/firmware/sysfb.c | 18 +++++++++++++++++- - 1 file changed, 17 insertions(+), 1 deletion(-) - -diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c -index 82fcfd29bc4d..17b7e096b682 100644 ---- a/drivers/firmware/sysfb.c -+++ b/drivers/firmware/sysfb.c -@@ -34,6 +34,22 @@ - #include <linux/screen_info.h> - #include <linux/sysfb.h> - -+static int skip_simpledrm; -+ -+static int __init simpledrm_disable(char *opt) -+{ -+ if (!opt) -+ return -EINVAL; -+ -+ get_option(&opt, &skip_simpledrm); -+ -+ if (skip_simpledrm) -+ pr_info("The simpledrm driver will not be probed\n"); -+ -+ return 0; -+} -+early_param("nvidia-drm.modeset", simpledrm_disable); -+ - static struct platform_device *pd; - static DEFINE_MUTEX(disable_lock); - static bool disabled; -@@ -85,7 +101,7 @@ static __init int sysfb_init(void) - - /* try to create a simple-framebuffer device */ - compatible = sysfb_parse_mode(si, &mode); -- if (compatible) { -+ if (compatible && !skip_simpledrm) { - pd = sysfb_create_simplefb(si, &mode); - if (!IS_ERR(pd)) - goto unlock_mutex; --- -2.42.0 - diff --git a/0003-ASoC-Intel-soc-acpi-fix-Dell-SKU-0B34.patch b/0003-ASoC-Intel-soc-acpi-fix-Dell-SKU-0B34.patch deleted file mode 100644 index 12b3a59ff631..000000000000 --- a/0003-ASoC-Intel-soc-acpi-fix-Dell-SKU-0B34.patch +++ /dev/null @@ -1,51 +0,0 @@ -From e2769cbe16602a8762db15a442fa587ada5c6ba6 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> -Date: Tue, 5 Sep 2023 11:16:16 -0400 -Subject: [PATCH 03/11] ASoC: Intel: soc-acpi: fix Dell SKU 0B34 - -The rule for the SoundWire tables is that the platforms with more -devices need to be added first. We broke that rule with the Dell SKU -0B34, and caused the second amplifier for SKU 0AF3 to be ignored. - -The fix is simple, we need to move the single-amplifier entry after -the two-amplifier one. - -Fixes: b62a1a839b48 ("ASoC: Intel: soc-acpi: add tables for Dell SKU 0B34") -Closes: https://github.com/thesofproject/linux/issues/4559 -Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> ---- - sound/soc/intel/common/soc-acpi-intel-adl-match.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/sound/soc/intel/common/soc-acpi-intel-adl-match.c b/sound/soc/intel/common/soc-acpi-intel-adl-match.c -index bcd66e0094b4..c4b57cca6b22 100644 ---- a/sound/soc/intel/common/soc-acpi-intel-adl-match.c -+++ b/sound/soc/intel/common/soc-acpi-intel-adl-match.c -@@ -648,18 +648,18 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_sdw_machines[] = { - .drv_name = "sof_sdw", - .sof_tplg_filename = "sof-adl-rt1316-l2-mono-rt714-l3.tplg", - }, -- { -- .link_mask = 0x3, /* rt1316 on link1 & rt714 on link0 */ -- .links = adl_sdw_rt1316_link1_rt714_link0, -- .drv_name = "sof_sdw", -- .sof_tplg_filename = "sof-adl-rt1316-l1-mono-rt714-l0.tplg", -- }, - { - .link_mask = 0x7, /* rt714 on link0 & two rt1316s on link1 and link2 */ - .links = adl_sdw_rt1316_link12_rt714_link0, - .drv_name = "sof_sdw", - .sof_tplg_filename = "sof-adl-rt1316-l12-rt714-l0.tplg", - }, -+ { -+ .link_mask = 0x3, /* rt1316 on link1 & rt714 on link0 */ -+ .links = adl_sdw_rt1316_link1_rt714_link0, -+ .drv_name = "sof_sdw", -+ .sof_tplg_filename = "sof-adl-rt1316-l1-mono-rt714-l0.tplg", -+ }, - { - .link_mask = 0x5, /* 2 active links required */ - .links = adl_sdw_rt1316_link2_rt714_link0, --- -2.42.0 - diff --git a/0004-btrfs-wait-on-uncached-block-groups-on-every-allocat.patch b/0004-btrfs-wait-on-uncached-block-groups-on-every-allocat.patch deleted file mode 100644 index 098b223d22c4..000000000000 --- a/0004-btrfs-wait-on-uncached-block-groups-on-every-allocat.patch +++ /dev/null @@ -1,255 +0,0 @@ -From 524fd94b5cda448b96d505e3da9ef07beb51b38c Mon Sep 17 00:00:00 2001 -From: Josef Bacik <josef@toxicpanda.com> -Date: Mon, 31 Jul 2023 16:28:43 -0400 -Subject: [PATCH 04/11] btrfs: wait on uncached block groups on every - allocation loop - -My initial fix for the generic/475 hangs was related to metadata, but -our CI testing uncovered another case where we hang for similar reasons. -We again have a task with a plug that is holding an outstanding request -that is keeping the dm device from finishing it's suspend, and that task -is stuck in the allocator. - -This time it is stuck trying to allocate data, but we do not have a -block group that matches the size class. The larger loop in the -allocator looks like this (simplified of course) - - find_free_extent - for_each_block_group { - ffe_ctl->cached == btrfs_block_group_cache_done(bg) - if (!ffe_ctl->cached) - ffe_ctl->have_caching_bg = true; - do_allocation() - btrfs_wait_block_group_cache_progress(); - } - - if (loop == LOOP_CACHING_WAIT && ffe_ctl->have_caching_bg) - go search again; - -In my earlier fix we were trying to allocate from the block group, but -we weren't waiting for the progress because we were only waiting for the -free space to be >= the amount of free space we wanted. My fix made it -so we waited for forward progress to be made as well, so we would be -sure to wait. - -This time however we did not have a block group that matched our size -class, so what was happening was this - - find_free_extent - for_each_block_group { - ffe_ctl->cached == btrfs_block_group_cache_done(bg) - if (!ffe_ctl->cached) - ffe_ctl->have_caching_bg = true; - if (size_class_doesn't_match()) - goto loop; - do_allocation() - btrfs_wait_block_group_cache_progress(); - loop: - release_block_group(block_group); - } - - if (loop == LOOP_CACHING_WAIT && ffe_ctl->have_caching_bg) - go search again; - -The size_class_doesn't_match() part was true, so we'd just skip this -block group and never wait for caching, and then because we found a -caching block group we'd just go back and do the loop again. We never -sleep and thus never flush the plug and we have the same deadlock. - -Fix the logic for waiting on the block group caching to instead do it -unconditionally when we goto loop. This takes the logic out of the -allocation step, so now the loop looks more like this - - find_free_extent - for_each_block_group { - ffe_ctl->cached == btrfs_block_group_cache_done(bg) - if (!ffe_ctl->cached) - ffe_ctl->have_caching_bg = true; - if (size_class_doesn't_match()) - goto loop; - do_allocation() - btrfs_wait_block_group_cache_progress(); - loop: - if (loop > LOOP_CACHING_NOWAIT && !ffe_ctl->retry_uncached && - !ffe_ctl->cached) { - ffe_ctl->retry_uncached = true; - btrfs_wait_block_group_cache_progress(); - } - - release_block_group(block_group); - } - - if (loop == LOOP_CACHING_WAIT && ffe_ctl->have_caching_bg) - go search again; - -This simplifies the logic a lot, and makes sure that if we're hitting -uncached block groups we're always waiting on them at some point. - -I ran this through 100 iterations of generic/475, as this particular -case was harder to hit than the previous one. - -Signed-off-by: Josef Bacik <josef@toxicpanda.com> -Signed-off-by: David Sterba <dsterba@suse.com> ---- - fs/btrfs/extent-tree.c | 61 +++++++++++++----------------------------- - fs/btrfs/extent-tree.h | 13 +++------ - 2 files changed, 22 insertions(+), 52 deletions(-) - -diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c -index 0917c5f39e3d..c8a598c3e11b 100644 ---- a/fs/btrfs/extent-tree.c -+++ b/fs/btrfs/extent-tree.c -@@ -3481,7 +3481,6 @@ btrfs_release_block_group(struct btrfs_block_group *cache, - * Helper function for find_free_extent(). - * - * Return -ENOENT to inform caller that we need fallback to unclustered mode. -- * Return -EAGAIN to inform caller that we need to re-search this block group - * Return >0 to inform caller that we find nothing - * Return 0 means we have found a location and set ffe_ctl->found_offset. - */ -@@ -3562,14 +3561,6 @@ static int find_free_extent_clustered(struct btrfs_block_group *bg, - trace_btrfs_reserve_extent_cluster(bg, ffe_ctl); - return 0; - } -- } else if (!ffe_ctl->cached && ffe_ctl->loop > LOOP_CACHING_NOWAIT && -- !ffe_ctl->retry_clustered) { -- spin_unlock(&last_ptr->refill_lock); -- -- ffe_ctl->retry_clustered = true; -- btrfs_wait_block_group_cache_progress(bg, ffe_ctl->num_bytes + -- ffe_ctl->empty_cluster + ffe_ctl->empty_size); -- return -EAGAIN; - } - /* - * At this point we either didn't find a cluster or we weren't able to -@@ -3584,7 +3575,6 @@ static int find_free_extent_clustered(struct btrfs_block_group *bg, - /* - * Return >0 to inform caller that we find nothing - * Return 0 when we found an free extent and set ffe_ctrl->found_offset -- * Return -EAGAIN to inform caller that we need to re-search this block group - */ - static int find_free_extent_unclustered(struct btrfs_block_group *bg, - struct find_free_extent_ctl *ffe_ctl) -@@ -3622,25 +3612,8 @@ static int find_free_extent_unclustered(struct btrfs_block_group *bg, - offset = btrfs_find_space_for_alloc(bg, ffe_ctl->search_start, - ffe_ctl->num_bytes, ffe_ctl->empty_size, - &ffe_ctl->max_extent_size); -- -- /* -- * If we didn't find a chunk, and we haven't failed on this block group -- * before, and this block group is in the middle of caching and we are -- * ok with waiting, then go ahead and wait for progress to be made, and -- * set @retry_unclustered to true. -- * -- * If @retry_unclustered is true then we've already waited on this -- * block group once and should move on to the next block group. -- */ -- if (!offset && !ffe_ctl->retry_unclustered && !ffe_ctl->cached && -- ffe_ctl->loop > LOOP_CACHING_NOWAIT) { -- btrfs_wait_block_group_cache_progress(bg, ffe_ctl->num_bytes + -- ffe_ctl->empty_size); -- ffe_ctl->retry_unclustered = true; -- return -EAGAIN; -- } else if (!offset) { -+ if (!offset) - return 1; -- } - ffe_ctl->found_offset = offset; - return 0; - } -@@ -3654,7 +3627,7 @@ static int do_allocation_clustered(struct btrfs_block_group *block_group, - /* We want to try and use the cluster allocator, so lets look there */ - if (ffe_ctl->last_ptr && ffe_ctl->use_cluster) { - ret = find_free_extent_clustered(block_group, ffe_ctl, bg_ret); -- if (ret >= 0 || ret == -EAGAIN) -+ if (ret >= 0) - return ret; - /* ret == -ENOENT case falls through */ - } -@@ -3873,8 +3846,7 @@ static void release_block_group(struct btrfs_block_group *block_group, - { - switch (ffe_ctl->policy) { - case BTRFS_EXTENT_ALLOC_CLUSTERED: -- ffe_ctl->retry_clustered = false; -- ffe_ctl->retry_unclustered = false; -+ ffe_ctl->retry_uncached = false; - break; - case BTRFS_EXTENT_ALLOC_ZONED: - /* Nothing to do */ -@@ -4225,9 +4197,7 @@ static noinline int find_free_extent(struct btrfs_root *root, - ffe_ctl->orig_have_caching_bg = false; - ffe_ctl->index = btrfs_bg_flags_to_raid_index(ffe_ctl->flags); - ffe_ctl->loop = 0; -- /* For clustered allocation */ -- ffe_ctl->retry_clustered = false; -- ffe_ctl->retry_unclustered = false; -+ ffe_ctl->retry_uncached = false; - ffe_ctl->cached = 0; - ffe_ctl->max_extent_size = 0; - ffe_ctl->total_free_space = 0; -@@ -4378,16 +4348,12 @@ static noinline int find_free_extent(struct btrfs_root *root, - - bg_ret = NULL; - ret = do_allocation(block_group, ffe_ctl, &bg_ret); -- if (ret == 0) { -- if (bg_ret && bg_ret != block_group) { -- btrfs_release_block_group(block_group, -- ffe_ctl->delalloc); -- block_group = bg_ret; -- } -- } else if (ret == -EAGAIN) { -- goto have_block_group; -- } else if (ret > 0) { -+ if (ret > 0) - goto loop; -+ -+ if (bg_ret && bg_ret != block_group) { -+ btrfs_release_block_group(block_group, ffe_ctl->delalloc); -+ block_group = bg_ret; - } - - /* Checks */ -@@ -4428,6 +4394,15 @@ static noinline int find_free_extent(struct btrfs_root *root, - btrfs_release_block_group(block_group, ffe_ctl->delalloc); - break; - loop: -+ if (!ffe_ctl->cached && ffe_ctl->loop > LOOP_CACHING_NOWAIT && -+ !ffe_ctl->retry_uncached) { -+ ffe_ctl->retry_uncached = true; -+ btrfs_wait_block_group_cache_progress(block_group, -+ ffe_ctl->num_bytes + -+ ffe_ctl->empty_cluster + -+ ffe_ctl->empty_size); -+ goto have_block_group; -+ } - release_block_group(block_group, ffe_ctl, ffe_ctl->delalloc); - cond_resched(); - } -diff --git a/fs/btrfs/extent-tree.h b/fs/btrfs/extent-tree.h -index 429d5c570061..6bfba2f22fdd 100644 ---- a/fs/btrfs/extent-tree.h -+++ b/fs/btrfs/extent-tree.h -@@ -48,16 +48,11 @@ struct find_free_extent_ctl { - int loop; - - /* -- * Whether we're refilling a cluster, if true we need to re-search -- * current block group but don't try to refill the cluster again. -+ * Set to true if we're retrying the allocation on this block group -+ * after waiting for caching progress, this is so that we retry only -+ * once before moving on to another block group. - */ -- bool retry_clustered; -- -- /* -- * Whether we're updating free space cache, if true we need to re-search -- * current block group but don't try updating free space cache again. -- */ -- bool retry_unclustered; -+ bool retry_uncached; - - /* If current block group is cached */ - int cached; --- -2.42.0 - diff --git a/0005-btrfs-set-last-dir-index-to-the-current-last-index-w.patch b/0005-btrfs-set-last-dir-index-to-the-current-last-index-w.patch deleted file mode 100644 index 631d5d352fdb..000000000000 --- a/0005-btrfs-set-last-dir-index-to-the-current-last-index-w.patch +++ /dev/null @@ -1,86 +0,0 @@ -From bd1791908538aa7b1a6f47be1def37f9bc6eb4f3 Mon Sep 17 00:00:00 2001 -From: Filipe Manana <fdmanana@suse.com> -Date: Sat, 9 Sep 2023 11:34:40 +0100 -Subject: [PATCH 05/11] btrfs: set last dir index to the current last index - when opening dir - -When opening a directory for reading it, we set the last index where we -stop iteration to the value in struct btrfs_inode::index_cnt. That value -does not match the index of the most recently added directory entry but -it's instead the index number that will be assigned the next directory -entry. - -This means that if after the call to opendir(3) new directory entries are -added, a readdir(3) call will return the first new directory entry. This -is fine because POSIX says the following [1]: - - "If a file is removed from or added to the directory after the most - recent call to opendir() or rewinddir(), whether a subsequent call to - readdir() returns an entry for that file is unspecified." - -For example for the test script from commit 9b378f6ad48c ("btrfs: fix -infinite directory reads"), where we have 2000 files in a directory, ext4 -doesn't return any new directory entry after opendir(3), while xfs returns -the first 13 new directory entries added after the opendir(3) call. - -If we move to a shorter example with an empty directory when opendir(3) is -called, and 2 files added to the directory after the opendir(3) call, then -readdir(3) on btrfs will return the first file, ext4 and xfs return the 2 -files (but in a different order). A test program for this, reported by -Ian Johnson, is the following: - - #include <dirent.h> - #include <stdio.h> - - int main(void) { - DIR *dir = opendir("test"); - - FILE *file; - file = fopen("test/1", "w"); - fwrite("1", 1, 1, file); - fclose(file); - - file = fopen("test/2", "w"); - fwrite("2", 1, 1, file); - fclose(file); - - struct dirent *entry; - while ((entry = readdir(dir))) { - printf("%s\n", entry->d_name); - } - closedir(dir); - return 0; - } - -To make this less odd, change the behaviour to never return new entries -that were added after the opendir(3) call. This is done by setting the -last_index field of the struct btrfs_file_private attached to the -directory's file handle with a value matching btrfs_inode::index_cnt -minus 1, since that value always matches the index of the next new -directory entry and not the index of the most recently added entry. - -[1] https://pubs.opengroup.org/onlinepubs/007904875/functions/readdir_r.html - -Link: https://lore.kernel.org/linux-btrfs/YR1P0S.NGASEG570GJ8@ianjohnson.dev/ -Signed-off-by: Filipe Manana <fdmanana@suse.com> ---- - fs/btrfs/inode.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index db2b33a822fc..7db2efd65774 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -5942,7 +5942,8 @@ static int btrfs_get_dir_last_index(struct btrfs_inode *dir, u64 *index) - } - } - -- *index = dir->index_cnt; -+ /* index_cnt is the index number of next new entry, so decrement it. */ -+ *index = dir->index_cnt - 1; - - return 0; - } --- -2.42.0 - diff --git a/0006-btrfs-refresh-dir-last-index-during-a-rewinddir-3-ca.patch b/0006-btrfs-refresh-dir-last-index-during-a-rewinddir-3-ca.patch deleted file mode 100644 index d5872f37f9d1..000000000000 --- a/0006-btrfs-refresh-dir-last-index-during-a-rewinddir-3-ca.patch +++ /dev/null @@ -1,103 +0,0 @@ -From c55297deb6ebf5ba1f3b30e0c37fc05cfe7354ff Mon Sep 17 00:00:00 2001 -From: Filipe Manana <fdmanana@suse.com> -Date: Sat, 9 Sep 2023 12:12:14 +0100 -Subject: [PATCH 06/11] btrfs: refresh dir last index during a rewinddir(3) - call - -When opening a directory we find what's the index of its last entry and -then store it in the directory's file handle private data (struct -btrfs_file_private::last_index), so that in the case new directory entries -are added to a directory after an opendir(3) call we don't end up in an -infinite loop (see commit 9b378f6ad48c ("btrfs: fix infinite directory -reads")) when calling readdir(3). - -However once rewinddir(3) is called, POSIX states [1] that any new -directory entries added after the previous opendir(3) call, must be -returned by subsequent calls to readdir(3): - - "The rewinddir() function shall reset the position of the directory - stream to which dirp refers to the beginning of the directory. - It shall also cause the directory stream to refer to the current - state of the corresponding directory, as a call to opendir() would - have done." - -We currently don't refresh the last_index field of the struct -btrfs_file_private associated to the directory, so after a rewinddir(3) -we are not returning any new entries added after the opendir(3) call. - -Fix this by finding the current last index of the directory when llseek -is called agains the directory. - -This can be reproduced by the following C program provided by Ian Johnson: - - #include <dirent.h> - #include <stdio.h> - - int main(void) { - DIR *dir = opendir("test"); - - FILE *file; - file = fopen("test/1", "w"); - fwrite("1", 1, 1, file); - fclose(file); - - file = fopen("test/2", "w"); - fwrite("2", 1, 1, file); - fclose(file); - - rewinddir(dir); - - struct dirent *entry; - while ((entry = readdir(dir))) { - printf("%s\n", entry->d_name); - } - closedir(dir); - return 0; - } - -[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/rewinddir.html - -Reported-by: Ian Johnson <ian@ianjohnson.dev> -Link: https://lore.kernel.org/linux-btrfs/YR1P0S.NGASEG570GJ8@ianjohnson.dev/ -Fixes: 9b378f6ad48c ("btrfs: fix infinite directory reads") -Signed-off-by: Filipe Manana <fdmanana@suse.com> ---- - fs/btrfs/inode.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index 7db2efd65774..f498c1c4068c 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -5980,6 +5980,19 @@ static int btrfs_opendir(struct inode *inode, struct file *file) - return 0; - } - -+static loff_t btrfs_dir_llseek(struct file *file, loff_t offset, int whence) -+{ -+ struct btrfs_file_private *private = file->private_data; -+ int ret; -+ -+ ret = btrfs_get_dir_last_index(BTRFS_I(file_inode(file)), -+ &private->last_index); -+ if (ret) -+ return ret; -+ -+ return generic_file_llseek(file, offset, whence); -+} -+ - struct dir_entry { - u64 ino; - u64 offset; -@@ -11060,7 +11073,7 @@ static const struct inode_operations btrfs_dir_inode_operations = { - }; - - static const struct file_operations btrfs_dir_file_operations = { -- .llseek = generic_file_llseek, -+ .llseek = btrfs_dir_llseek, - .read = generic_read_dir, - .iterate_shared = btrfs_real_readdir, - .open = btrfs_opendir, --- -2.42.0 - diff --git a/0007-btrfs-fix-race-between-reading-a-directory-and-addin.patch b/0007-btrfs-fix-race-between-reading-a-directory-and-addin.patch deleted file mode 100644 index e4890bc98eed..000000000000 --- a/0007-btrfs-fix-race-between-reading-a-directory-and-addin.patch +++ /dev/null @@ -1,143 +0,0 @@ -From ea94fae18504d4c62f97aa0b70bc8b30e4cd6847 Mon Sep 17 00:00:00 2001 -From: Filipe Manana <fdmanana@suse.com> -Date: Tue, 12 Sep 2023 11:45:39 +0100 -Subject: [PATCH 07/11] btrfs: fix race between reading a directory and adding - entries to it - -When opening a directory (opendir(3)) or rewinding it (rewinddir(3)), we -are not holding the directory's inode locked, and this can result in later -attempting to add two entries to the directory with the same index number, -resulting in a transaction abort, with -EEXIST (-17), when inserting the -second delayed dir index. This results in a trace like the following: - - Sep 11 22:34:59 myhostname kernel: BTRFS error (device dm-3): err add delayed dir index item(name: cockroach-stderr.log) into the insertion tree of the delayed node(root id: 5, inode id: 4539217, errno: -17) - Sep 11 22:34:59 myhostname kernel: ------------[ cut here ]------------ - Sep 11 22:34:59 myhostname kernel: kernel BUG at fs/btrfs/delayed-inode.c:1504! - Sep 11 22:34:59 myhostname kernel: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI - Sep 11 22:34:59 myhostname kernel: CPU: 0 PID: 7159 Comm: cockroach Not tainted 6.4.15-200.fc38.x86_64 #1 - Sep 11 22:34:59 myhostname kernel: Hardware name: ASUS ESC500 G3/P9D WS, BIOS 2402 06/27/2018 - Sep 11 22:34:59 myhostname kernel: RIP: 0010:btrfs_insert_delayed_dir_index+0x1da/0x260 - Sep 11 22:34:59 myhostname kernel: Code: eb dd 48 (...) - Sep 11 22:34:59 myhostname kernel: RSP: 0000:ffffa9980e0fbb28 EFLAGS: 00010282 - Sep 11 22:34:59 myhostname kernel: RAX: 0000000000000000 RBX: ffff8b10b8f4a3c0 RCX: 0000000000000000 - Sep 11 22:34:59 myhostname kernel: RDX: 0000000000000000 RSI: ffff8b177ec21540 RDI: ffff8b177ec21540 - Sep 11 22:34:59 myhostname kernel: RBP: ffff8b110cf80888 R08: 0000000000000000 R09: ffffa9980e0fb938 - Sep 11 22:34:59 myhostname kernel: R10: 0000000000000003 R11: ffffffff86146508 R12: 0000000000000014 - Sep 11 22:34:59 myhostname kernel: R13: ffff8b1131ae5b40 R14: ffff8b10b8f4a418 R15: 00000000ffffffef - Sep 11 22:34:59 myhostname kernel: FS: 00007fb14a7fe6c0(0000) GS:ffff8b177ec00000(0000) knlGS:0000000000000000 - Sep 11 22:34:59 myhostname kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 - Sep 11 22:34:59 myhostname kernel: CR2: 000000c00143d000 CR3: 00000001b3b4e002 CR4: 00000000001706f0 - Sep 11 22:34:59 myhostname kernel: Call Trace: - Sep 11 22:34:59 myhostname kernel: <TASK> - Sep 11 22:34:59 myhostname kernel: ? die+0x36/0x90 - Sep 11 22:34:59 myhostname kernel: ? do_trap+0xda/0x100 - Sep 11 22:34:59 myhostname kernel: ? btrfs_insert_delayed_dir_index+0x1da/0x260 - Sep 11 22:34:59 myhostname kernel: ? do_error_trap+0x6a/0x90 - Sep 11 22:34:59 myhostname kernel: ? btrfs_insert_delayed_dir_index+0x1da/0x260 - Sep 11 22:34:59 myhostname kernel: ? exc_invalid_op+0x50/0x70 - Sep 11 22:34:59 myhostname kernel: ? btrfs_insert_delayed_dir_index+0x1da/0x260 - Sep 11 22:34:59 myhostname kernel: ? asm_exc_invalid_op+0x1a/0x20 - Sep 11 22:34:59 myhostname kernel: ? btrfs_insert_delayed_dir_index+0x1da/0x260 - Sep 11 22:34:59 myhostname kernel: ? btrfs_insert_delayed_dir_index+0x1da/0x260 - Sep 11 22:34:59 myhostname kernel: btrfs_insert_dir_item+0x200/0x280 - Sep 11 22:34:59 myhostname kernel: btrfs_add_link+0xab/0x4f0 - Sep 11 22:34:59 myhostname kernel: ? ktime_get_real_ts64+0x47/0xe0 - Sep 11 22:34:59 myhostname kernel: btrfs_create_new_inode+0x7cd/0xa80 - Sep 11 22:34:59 myhostname kernel: btrfs_symlink+0x190/0x4d0 - Sep 11 22:34:59 myhostname kernel: ? schedule+0x5e/0xd0 - Sep 11 22:34:59 myhostname kernel: ? __d_lookup+0x7e/0xc0 - Sep 11 22:34:59 myhostname kernel: vfs_symlink+0x148/0x1e0 - Sep 11 22:34:59 myhostname kernel: do_symlinkat+0x130/0x140 - Sep 11 22:34:59 myhostname kernel: __x64_sys_symlinkat+0x3d/0x50 - Sep 11 22:34:59 myhostname kernel: do_syscall_64+0x5d/0x90 - Sep 11 22:34:59 myhostname kernel: ? syscall_exit_to_user_mode+0x2b/0x40 - Sep 11 22:34:59 myhostname kernel: ? do_syscall_64+0x6c/0x90 - Sep 11 22:34:59 myhostname kernel: entry_SYSCALL_64_after_hwframe+0x72/0xdc - -The race leading to the problem happens like this: - -1) Directory inode X is loaded into memory, its ->index_cnt field is - initialized to (u64)-1 (at btrfs_alloc_inode()); - -2) Task A is adding a new file to directory X, holding its vfs inode lock, - and calls btrfs_set_inode_index() to get an index number for the entry. - - Because the inode's index_cnt field is set to (u64)-1 it calls - btrfs_inode_delayed_dir_index_count() which fails because no dir index - entries were added yet to the delayed inode and then it calls - btrfs_set_inode_index_count(). This functions finds the last dir index - key and then sets index_cnt to that index value + 1. It found that the - last index key has an offset of 100. However before it assigns a value - of 101 to index_cnt... - -3) Task B calls opendir(3), ending up at btrfs_opendir(), where the vfs - lock for inode X is not taken, so it calls btrfs_get_dir_last_index() - and sees index_cnt still with a value of (u64)-1. Because of that it - calls btrfs_inode_delayed_dir_index_count() which fails since no dir - index entries were added to the delayed inode yet, and then it also - calls btrfs_set_inode_index_count(). This also finds that the last - index key has an offset of 100, and before it assigns the value 101 - to the index_cnt field of inode X... - -4) Task A assigns a value of 101 to index_cnt. And then the code flow - goes to btrfs_set_inode_index() where it increments index_cnt from - 101 to 102. Task A then creates a delayed dir index entry with a - sequence number of 101 and adds it to the delayed inode; - -5) Task B assigns 101 to the index_cnt field of inode X; - -6) At some later point when someone tries to add a new entry to the - directory, btrfs_set_inode_index() will return 101 again and shortly - after an attempt to add another delayed dir index key with index - number 101 will fail with -EEXIST resulting in a transaction abort. - -Fix this by locking the inode at btrfs_get_dir_last_index(), which is only -only used when opening a directory or attempting to lseek on it. - -Reported-by: ken <ken@bllue.org> -Link: https://lore.kernel.org/linux-btrfs/CAE6xmH+Lp=Q=E61bU+v9eWX8gYfLvu6jLYxjxjFpo3zHVPR0EQ@mail.gmail.com/ -Reported-by: syzbot+d13490c82ad5353c779d@syzkaller.appspotmail.com -Link: https://lore.kernel.org/linux-btrfs/00000000000036e1290603e097e0@google.com/ -Fixes: 9b378f6ad48c ("btrfs: fix infinite directory reads") -Signed-off-by: Filipe Manana <fdmanana@suse.com> -Cherry-picked-for: https://bugs.archlinux.org/task/79673 ---- - fs/btrfs/inode.c | 11 +++++++---- - 1 file changed, 7 insertions(+), 4 deletions(-) - -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index f498c1c4068c..d5c112f6091b 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -5931,21 +5931,24 @@ static int btrfs_set_inode_index_count(struct btrfs_inode *inode) - - static int btrfs_get_dir_last_index(struct btrfs_inode *dir, u64 *index) - { -- if (dir->index_cnt == (u64)-1) { -- int ret; -+ int ret = 0; - -+ btrfs_inode_lock(dir, 0); -+ if (dir->index_cnt == (u64)-1) { - ret = btrfs_inode_delayed_dir_index_count(dir); - if (ret) { - ret = btrfs_set_inode_index_count(dir); - if (ret) -- return ret; -+ goto out; - } - } - - /* index_cnt is the index number of next new entry, so decrement it. */ - *index = dir->index_cnt - 1; -+out: -+ btrfs_inode_unlock(dir, 0); - -- return 0; -+ return ret; - } - - /* --- -2.42.0 - diff --git a/0008-i915-Limit-the-length-of-an-sg-list-to-the-requested.patch b/0008-i915-Limit-the-length-of-an-sg-list-to-the-requested.patch deleted file mode 100644 index d490fb6cf986..000000000000 --- a/0008-i915-Limit-the-length-of-an-sg-list-to-the-requested.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 31fa804a07c542fae71aa53f1afd2925485b1bb4 Mon Sep 17 00:00:00 2001 -From: "Matthew Wilcox (Oracle)" <willy@infradead.org> -Date: Tue, 19 Sep 2023 20:48:55 +0100 -Subject: [PATCH 08/11] i915: Limit the length of an sg list to the requested - length - -The folio conversion changed the behaviour of shmem_sg_alloc_table() to -put the entire length of the last folio into the sg list, even if the sg -list should have been shorter. gen8_ggtt_insert_entries() relied on the -list being the right langth and would overrun the end of the page tables. -Other functions may also have been affected. - -Clamp the length of the last entry in the sg list to be the expected -length. - -Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> -Fixes: 0b62af28f249 ("i915: convert shmem_sg_free_table() to use a folio_batch") -Cc: stable@vger.kernel.org # 6.5.x -Link: https://gitlab.freedesktop.org/drm/intel/-/issues/9256 -Link: https://lore.kernel.org/lkml/6287208.lOV4Wx5bFT@natalenko.name/ -Reported-by: Oleksandr Natalenko <oleksandr@natalenko.name> -Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name> -Cherry-picked-for: https://bugs.archlinux.org/task/79569 ---- - drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 11 +++++++---- - 1 file changed, 7 insertions(+), 4 deletions(-) - -diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c -index 8f1633c3fb93..73a4a4eb29e0 100644 ---- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c -+++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c -@@ -100,6 +100,7 @@ int shmem_sg_alloc_table(struct drm_i915_private *i915, struct sg_table *st, - st->nents = 0; - for (i = 0; i < page_count; i++) { - struct folio *folio; -+ unsigned long nr_pages; - const unsigned int shrink[] = { - I915_SHRINK_BOUND | I915_SHRINK_UNBOUND, - 0, -@@ -150,6 +151,8 @@ int shmem_sg_alloc_table(struct drm_i915_private *i915, struct sg_table *st, - } - } while (1); - -+ nr_pages = min_t(unsigned long, -+ folio_nr_pages(folio), page_count - i); - if (!i || - sg->length >= max_segment || - folio_pfn(folio) != next_pfn) { -@@ -157,13 +160,13 @@ int shmem_sg_alloc_table(struct drm_i915_private *i915, struct sg_table *st, - sg = sg_next(sg); - - st->nents++; -- sg_set_folio(sg, folio, folio_size(folio), 0); -+ sg_set_folio(sg, folio, nr_pages * PAGE_SIZE, 0); - } else { - /* XXX: could overflow? */ -- sg->length += folio_size(folio); -+ sg->length += nr_pages * PAGE_SIZE; - } -- next_pfn = folio_pfn(folio) + folio_nr_pages(folio); -- i += folio_nr_pages(folio) - 1; -+ next_pfn = folio_pfn(folio) + nr_pages; -+ i += nr_pages - 1; - - /* Check that the i965g/gm workaround works. */ - GEM_BUG_ON(gfp & __GFP_DMA32 && next_pfn >= 0x00100000UL); --- -2.42.0 - diff --git a/0009-net-wwan-t7xx-Add-AP-CLDMA.patch b/0009-net-wwan-t7xx-Add-AP-CLDMA.patch deleted file mode 100644 index 123e98569665..000000000000 --- a/0009-net-wwan-t7xx-Add-AP-CLDMA.patch +++ /dev/null @@ -1,508 +0,0 @@ -From d606d6dd5b99b4dd286bad35c1b9a6f40854ac56 Mon Sep 17 00:00:00 2001 -From: Jose Ignacio Tornos Martinez <jtornosm@redhat.com> -Date: Tue, 11 Jul 2023 08:28:13 +0200 -Subject: [PATCH 09/11] net: wwan: t7xx: Add AP CLDMA -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -At this moment with the current status, t7xx is not functional due to -problems like this after connection, if there is no activity: -[ 57.370534] mtk_t7xx 0000:72:00.0: [PM] SAP suspend error: -110 -[ 57.370581] mtk_t7xx 0000:72:00.0: can't suspend - (t7xx_pci_pm_runtime_suspend [mtk_t7xx] returned -110) -because after this, the traffic no longer works. - -The complete series 'net: wwan: t7xx: fw flashing & coredump support' -was reverted because of issues with the pci implementation. -In order to have at least the modem working, it would be enough if just -the first commit of the series is re-applied: -d20ef656f994 net: wwan: t7xx: Add AP CLDMA -With that, the Application Processor would be controlled, correctly -suspended and the commented problems would be fixed (I am testing here -like this with no related issue). - -This commit is independent of the others and not related to the -commented pci implementation for the new features: fw flashing and -coredump collection. - -Use v2 patch version of d20ef656f994 as JinJian Song suggests -(https://patchwork.kernel.org/project/netdevbpf/patch/20230105154215.198828-1-m.chetan.kumar@linux.intel.com/). - -Original text from the commit that would be re-applied: - - d20ef656f994 net: wwan: t7xx: Add AP CLDMA - Author: Haijun Liu <haijun.liu@mediatek.com> - Date: Tue Aug 16 09:53:28 2022 +0530 - - The t7xx device contains two Cross Layer DMA (CLDMA) interfaces to - communicate with AP and Modem processors respectively. So far only - MD-CLDMA was being used, this patch enables AP-CLDMA. - - Rename small Application Processor (sAP) to AP. - - Signed-off-by: Haijun Liu <haijun.liu@mediatek.com> - Co-developed-by: Madhusmita Sahu <madhusmita.sahu@intel.com> - Signed-off-by: Madhusmita Sahu <madhusmita.sahu@intel.com> - Signed-off-by: Moises Veleta <moises.veleta@linux.intel.com> - Signed-off-by: Devegowda Chandrashekar <chandrashekar.devegowda@intel.com> - Signed-off-by: M Chetan Kumar <m.chetan.kumar@linux.intel.com> - Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> - Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com> - Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com> - -Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com> -Reviewed-by: Simon Horman <simon.horman@corigine.com> -Link: https://lore.kernel.org/r/20230711062817.6108-1-jtornosm@redhat.com -Signed-off-by: Jakub Kicinski <kuba@kernel.org> -Cherry-picked-for: https://bugs.archlinux.org/task/79728 ---- - drivers/net/wwan/t7xx/t7xx_hif_cldma.c | 17 +++-- - drivers/net/wwan/t7xx/t7xx_hif_cldma.h | 2 +- - drivers/net/wwan/t7xx/t7xx_mhccif.h | 1 + - drivers/net/wwan/t7xx/t7xx_modem_ops.c | 76 +++++++++++++++++----- - drivers/net/wwan/t7xx/t7xx_modem_ops.h | 2 + - drivers/net/wwan/t7xx/t7xx_port.h | 6 +- - drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c | 8 ++- - drivers/net/wwan/t7xx/t7xx_port_proxy.c | 18 ++++- - drivers/net/wwan/t7xx/t7xx_reg.h | 2 +- - drivers/net/wwan/t7xx/t7xx_state_monitor.c | 13 +++- - drivers/net/wwan/t7xx/t7xx_state_monitor.h | 2 + - 11 files changed, 116 insertions(+), 31 deletions(-) - -diff --git a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c -index 7162bf38a8c9..cc70360364b7 100644 ---- a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c -+++ b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c -@@ -1066,13 +1066,18 @@ static void t7xx_hw_info_init(struct cldma_ctrl *md_ctrl) - struct t7xx_cldma_hw *hw_info = &md_ctrl->hw_info; - u32 phy_ao_base, phy_pd_base; - -- if (md_ctrl->hif_id != CLDMA_ID_MD) -- return; -- -- phy_ao_base = CLDMA1_AO_BASE; -- phy_pd_base = CLDMA1_PD_BASE; -- hw_info->phy_interrupt_id = CLDMA1_INT; - hw_info->hw_mode = MODE_BIT_64; -+ -+ if (md_ctrl->hif_id == CLDMA_ID_MD) { -+ phy_ao_base = CLDMA1_AO_BASE; -+ phy_pd_base = CLDMA1_PD_BASE; -+ hw_info->phy_interrupt_id = CLDMA1_INT; -+ } else { -+ phy_ao_base = CLDMA0_AO_BASE; -+ phy_pd_base = CLDMA0_PD_BASE; -+ hw_info->phy_interrupt_id = CLDMA0_INT; -+ } -+ - hw_info->ap_ao_base = t7xx_pcie_addr_transfer(pbase->pcie_ext_reg_base, - pbase->pcie_dev_reg_trsl_addr, phy_ao_base); - hw_info->ap_pdn_base = t7xx_pcie_addr_transfer(pbase->pcie_ext_reg_base, -diff --git a/drivers/net/wwan/t7xx/t7xx_hif_cldma.h b/drivers/net/wwan/t7xx/t7xx_hif_cldma.h -index 47a35e552da7..4410bac6993a 100644 ---- a/drivers/net/wwan/t7xx/t7xx_hif_cldma.h -+++ b/drivers/net/wwan/t7xx/t7xx_hif_cldma.h -@@ -34,7 +34,7 @@ - /** - * enum cldma_id - Identifiers for CLDMA HW units. - * @CLDMA_ID_MD: Modem control channel. -- * @CLDMA_ID_AP: Application Processor control channel (not used at the moment). -+ * @CLDMA_ID_AP: Application Processor control channel. - * @CLDMA_NUM: Number of CLDMA HW units available. - */ - enum cldma_id { -diff --git a/drivers/net/wwan/t7xx/t7xx_mhccif.h b/drivers/net/wwan/t7xx/t7xx_mhccif.h -index 209b386bc088..20c50dce9fc3 100644 ---- a/drivers/net/wwan/t7xx/t7xx_mhccif.h -+++ b/drivers/net/wwan/t7xx/t7xx_mhccif.h -@@ -25,6 +25,7 @@ - D2H_INT_EXCEPTION_CLEARQ_DONE | \ - D2H_INT_EXCEPTION_ALLQ_RESET | \ - D2H_INT_PORT_ENUM | \ -+ D2H_INT_ASYNC_AP_HK | \ - D2H_INT_ASYNC_MD_HK) - - void t7xx_mhccif_mask_set(struct t7xx_pci_dev *t7xx_dev, u32 val); -diff --git a/drivers/net/wwan/t7xx/t7xx_modem_ops.c b/drivers/net/wwan/t7xx/t7xx_modem_ops.c -index 7d0f5e4f0a78..24e7d491468e 100644 ---- a/drivers/net/wwan/t7xx/t7xx_modem_ops.c -+++ b/drivers/net/wwan/t7xx/t7xx_modem_ops.c -@@ -44,6 +44,7 @@ - #include "t7xx_state_monitor.h" - - #define RT_ID_MD_PORT_ENUM 0 -+#define RT_ID_AP_PORT_ENUM 1 - /* Modem feature query identification code - "ICCC" */ - #define MD_FEATURE_QUERY_ID 0x49434343 - -@@ -298,6 +299,7 @@ static void t7xx_md_exception(struct t7xx_modem *md, enum hif_ex_stage stage) - } - - t7xx_cldma_exception(md->md_ctrl[CLDMA_ID_MD], stage); -+ t7xx_cldma_exception(md->md_ctrl[CLDMA_ID_AP], stage); - - if (stage == HIF_EX_INIT) - t7xx_mhccif_h2d_swint_trigger(t7xx_dev, H2D_CH_EXCEPTION_ACK); -@@ -426,7 +428,7 @@ static int t7xx_parse_host_rt_data(struct t7xx_fsm_ctl *ctl, struct t7xx_sys_inf - if (ft_spt_st != MTK_FEATURE_MUST_BE_SUPPORTED) - return -EINVAL; - -- if (i == RT_ID_MD_PORT_ENUM) -+ if (i == RT_ID_MD_PORT_ENUM || i == RT_ID_AP_PORT_ENUM) - t7xx_port_enum_msg_handler(ctl->md, rt_feature->data); - } - -@@ -456,12 +458,12 @@ static int t7xx_core_reset(struct t7xx_modem *md) - return 0; - } - --static void t7xx_core_hk_handler(struct t7xx_modem *md, struct t7xx_fsm_ctl *ctl, -+static void t7xx_core_hk_handler(struct t7xx_modem *md, struct t7xx_sys_info *core_info, -+ struct t7xx_fsm_ctl *ctl, - enum t7xx_fsm_event_state event_id, - enum t7xx_fsm_event_state err_detect) - { - struct t7xx_fsm_event *event = NULL, *event_next; -- struct t7xx_sys_info *core_info = &md->core_md; - struct device *dev = &md->t7xx_dev->pdev->dev; - unsigned long flags; - int ret; -@@ -531,19 +533,33 @@ static void t7xx_md_hk_wq(struct work_struct *work) - t7xx_cldma_start(md->md_ctrl[CLDMA_ID_MD]); - t7xx_fsm_broadcast_state(ctl, MD_STATE_WAITING_FOR_HS2); - md->core_md.handshake_ongoing = true; -- t7xx_core_hk_handler(md, ctl, FSM_EVENT_MD_HS2, FSM_EVENT_MD_HS2_EXIT); -+ t7xx_core_hk_handler(md, &md->core_md, ctl, FSM_EVENT_MD_HS2, FSM_EVENT_MD_HS2_EXIT); -+} -+ -+static void t7xx_ap_hk_wq(struct work_struct *work) -+{ -+ struct t7xx_modem *md = container_of(work, struct t7xx_modem, ap_handshake_work); -+ struct t7xx_fsm_ctl *ctl = md->fsm_ctl; -+ -+ /* Clear the HS2 EXIT event appended in t7xx_core_reset(). */ -+ t7xx_fsm_clr_event(ctl, FSM_EVENT_AP_HS2_EXIT); -+ t7xx_cldma_stop(md->md_ctrl[CLDMA_ID_AP]); -+ t7xx_cldma_switch_cfg(md->md_ctrl[CLDMA_ID_AP]); -+ t7xx_cldma_start(md->md_ctrl[CLDMA_ID_AP]); -+ md->core_ap.handshake_ongoing = true; -+ t7xx_core_hk_handler(md, &md->core_ap, ctl, FSM_EVENT_AP_HS2, FSM_EVENT_AP_HS2_EXIT); - } - - void t7xx_md_event_notify(struct t7xx_modem *md, enum md_event_id evt_id) - { - struct t7xx_fsm_ctl *ctl = md->fsm_ctl; -- void __iomem *mhccif_base; - unsigned int int_sta; - unsigned long flags; - - switch (evt_id) { - case FSM_PRE_START: -- t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_PORT_ENUM); -+ t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_PORT_ENUM | D2H_INT_ASYNC_MD_HK | -+ D2H_INT_ASYNC_AP_HK); - break; - - case FSM_START: -@@ -556,16 +572,26 @@ void t7xx_md_event_notify(struct t7xx_modem *md, enum md_event_id evt_id) - ctl->exp_flg = true; - md->exp_id &= ~D2H_INT_EXCEPTION_INIT; - md->exp_id &= ~D2H_INT_ASYNC_MD_HK; -+ md->exp_id &= ~D2H_INT_ASYNC_AP_HK; - } else if (ctl->exp_flg) { - md->exp_id &= ~D2H_INT_ASYNC_MD_HK; -- } else if (md->exp_id & D2H_INT_ASYNC_MD_HK) { -- queue_work(md->handshake_wq, &md->handshake_work); -- md->exp_id &= ~D2H_INT_ASYNC_MD_HK; -- mhccif_base = md->t7xx_dev->base_addr.mhccif_rc_base; -- iowrite32(D2H_INT_ASYNC_MD_HK, mhccif_base + REG_EP2RC_SW_INT_ACK); -- t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK); -+ md->exp_id &= ~D2H_INT_ASYNC_AP_HK; - } else { -- t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_ASYNC_MD_HK); -+ void __iomem *mhccif_base = md->t7xx_dev->base_addr.mhccif_rc_base; -+ -+ if (md->exp_id & D2H_INT_ASYNC_MD_HK) { -+ queue_work(md->handshake_wq, &md->handshake_work); -+ md->exp_id &= ~D2H_INT_ASYNC_MD_HK; -+ iowrite32(D2H_INT_ASYNC_MD_HK, mhccif_base + REG_EP2RC_SW_INT_ACK); -+ t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK); -+ } -+ -+ if (md->exp_id & D2H_INT_ASYNC_AP_HK) { -+ queue_work(md->handshake_wq, &md->ap_handshake_work); -+ md->exp_id &= ~D2H_INT_ASYNC_AP_HK; -+ iowrite32(D2H_INT_ASYNC_AP_HK, mhccif_base + REG_EP2RC_SW_INT_ACK); -+ t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_AP_HK); -+ } - } - spin_unlock_irqrestore(&md->exp_lock, flags); - -@@ -578,6 +604,7 @@ void t7xx_md_event_notify(struct t7xx_modem *md, enum md_event_id evt_id) - - case FSM_READY: - t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK); -+ t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_AP_HK); - break; - - default: -@@ -629,6 +656,12 @@ static struct t7xx_modem *t7xx_md_alloc(struct t7xx_pci_dev *t7xx_dev) - md->core_md.feature_set[RT_ID_MD_PORT_ENUM] &= ~FEATURE_MSK; - md->core_md.feature_set[RT_ID_MD_PORT_ENUM] |= - FIELD_PREP(FEATURE_MSK, MTK_FEATURE_MUST_BE_SUPPORTED); -+ -+ INIT_WORK(&md->ap_handshake_work, t7xx_ap_hk_wq); -+ md->core_ap.feature_set[RT_ID_AP_PORT_ENUM] &= ~FEATURE_MSK; -+ md->core_ap.feature_set[RT_ID_AP_PORT_ENUM] |= -+ FIELD_PREP(FEATURE_MSK, MTK_FEATURE_MUST_BE_SUPPORTED); -+ - return md; - } - -@@ -640,6 +673,7 @@ int t7xx_md_reset(struct t7xx_pci_dev *t7xx_dev) - md->exp_id = 0; - t7xx_fsm_reset(md); - t7xx_cldma_reset(md->md_ctrl[CLDMA_ID_MD]); -+ t7xx_cldma_reset(md->md_ctrl[CLDMA_ID_AP]); - t7xx_port_proxy_reset(md->port_prox); - md->md_init_finish = true; - return t7xx_core_reset(md); -@@ -669,6 +703,10 @@ int t7xx_md_init(struct t7xx_pci_dev *t7xx_dev) - if (ret) - goto err_destroy_hswq; - -+ ret = t7xx_cldma_alloc(CLDMA_ID_AP, t7xx_dev); -+ if (ret) -+ goto err_destroy_hswq; -+ - ret = t7xx_fsm_init(md); - if (ret) - goto err_destroy_hswq; -@@ -681,12 +719,16 @@ int t7xx_md_init(struct t7xx_pci_dev *t7xx_dev) - if (ret) - goto err_uninit_ccmni; - -- ret = t7xx_port_proxy_init(md); -+ ret = t7xx_cldma_init(md->md_ctrl[CLDMA_ID_AP]); - if (ret) - goto err_uninit_md_cldma; - -+ ret = t7xx_port_proxy_init(md); -+ if (ret) -+ goto err_uninit_ap_cldma; -+ - ret = t7xx_fsm_append_cmd(md->fsm_ctl, FSM_CMD_START, 0); -- if (ret) /* fsm_uninit flushes cmd queue */ -+ if (ret) /* t7xx_fsm_uninit() flushes cmd queue */ - goto err_uninit_proxy; - - t7xx_md_sys_sw_init(t7xx_dev); -@@ -696,6 +738,9 @@ int t7xx_md_init(struct t7xx_pci_dev *t7xx_dev) - err_uninit_proxy: - t7xx_port_proxy_uninit(md->port_prox); - -+err_uninit_ap_cldma: -+ t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_AP]); -+ - err_uninit_md_cldma: - t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_MD]); - -@@ -722,6 +767,7 @@ void t7xx_md_exit(struct t7xx_pci_dev *t7xx_dev) - - t7xx_fsm_append_cmd(md->fsm_ctl, FSM_CMD_PRE_STOP, FSM_CMD_FLAG_WAIT_FOR_COMPLETION); - t7xx_port_proxy_uninit(md->port_prox); -+ t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_AP]); - t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_MD]); - t7xx_ccmni_exit(t7xx_dev); - t7xx_fsm_uninit(md); -diff --git a/drivers/net/wwan/t7xx/t7xx_modem_ops.h b/drivers/net/wwan/t7xx/t7xx_modem_ops.h -index 7469ed636ae8..abe633cf7adc 100644 ---- a/drivers/net/wwan/t7xx/t7xx_modem_ops.h -+++ b/drivers/net/wwan/t7xx/t7xx_modem_ops.h -@@ -66,10 +66,12 @@ struct t7xx_modem { - struct cldma_ctrl *md_ctrl[CLDMA_NUM]; - struct t7xx_pci_dev *t7xx_dev; - struct t7xx_sys_info core_md; -+ struct t7xx_sys_info core_ap; - bool md_init_finish; - bool rgu_irq_asserted; - struct workqueue_struct *handshake_wq; - struct work_struct handshake_work; -+ struct work_struct ap_handshake_work; - struct t7xx_fsm_ctl *fsm_ctl; - struct port_proxy *port_prox; - unsigned int exp_id; -diff --git a/drivers/net/wwan/t7xx/t7xx_port.h b/drivers/net/wwan/t7xx/t7xx_port.h -index 8ea9079af997..4ae8a00a8532 100644 ---- a/drivers/net/wwan/t7xx/t7xx_port.h -+++ b/drivers/net/wwan/t7xx/t7xx_port.h -@@ -36,9 +36,13 @@ - /* Channel ID and Message ID definitions. - * The channel number consists of peer_id(15:12) , channel_id(11:0) - * peer_id: -- * 0:reserved, 1: to sAP, 2: to MD -+ * 0:reserved, 1: to AP, 2: to MD - */ - enum port_ch { -+ /* to AP */ -+ PORT_CH_AP_CONTROL_RX = 0x1000, -+ PORT_CH_AP_CONTROL_TX = 0x1001, -+ - /* to MD */ - PORT_CH_CONTROL_RX = 0x2000, - PORT_CH_CONTROL_TX = 0x2001, -diff --git a/drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c b/drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c -index 68430b130a67..ae632ef96698 100644 ---- a/drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c -+++ b/drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c -@@ -167,8 +167,12 @@ static int control_msg_handler(struct t7xx_port *port, struct sk_buff *skb) - case CTL_ID_HS2_MSG: - skb_pull(skb, sizeof(*ctrl_msg_h)); - -- if (port_conf->rx_ch == PORT_CH_CONTROL_RX) { -- ret = t7xx_fsm_append_event(ctl, FSM_EVENT_MD_HS2, skb->data, -+ if (port_conf->rx_ch == PORT_CH_CONTROL_RX || -+ port_conf->rx_ch == PORT_CH_AP_CONTROL_RX) { -+ int event = port_conf->rx_ch == PORT_CH_CONTROL_RX ? -+ FSM_EVENT_MD_HS2 : FSM_EVENT_AP_HS2; -+ -+ ret = t7xx_fsm_append_event(ctl, event, skb->data, - le32_to_cpu(ctrl_msg_h->data_length)); - if (ret) - dev_err(port->dev, "Failed to append Handshake 2 event"); -diff --git a/drivers/net/wwan/t7xx/t7xx_port_proxy.c b/drivers/net/wwan/t7xx/t7xx_port_proxy.c -index 894b1d11b2c9..274846d39fbf 100644 ---- a/drivers/net/wwan/t7xx/t7xx_port_proxy.c -+++ b/drivers/net/wwan/t7xx/t7xx_port_proxy.c -@@ -48,7 +48,7 @@ - i < (proxy)->port_count; \ - i++, (p) = &(proxy)->ports[i]) - --static const struct t7xx_port_conf t7xx_md_port_conf[] = { -+static const struct t7xx_port_conf t7xx_port_conf[] = { - { - .tx_ch = PORT_CH_UART2_TX, - .rx_ch = PORT_CH_UART2_RX, -@@ -89,6 +89,14 @@ static const struct t7xx_port_conf t7xx_md_port_conf[] = { - .path_id = CLDMA_ID_MD, - .ops = &ctl_port_ops, - .name = "t7xx_ctrl", -+ }, { -+ .tx_ch = PORT_CH_AP_CONTROL_TX, -+ .rx_ch = PORT_CH_AP_CONTROL_RX, -+ .txq_index = Q_IDX_CTRL, -+ .rxq_index = Q_IDX_CTRL, -+ .path_id = CLDMA_ID_AP, -+ .ops = &ctl_port_ops, -+ .name = "t7xx_ap_ctrl", - }, - }; - -@@ -428,6 +436,9 @@ static void t7xx_proxy_init_all_ports(struct t7xx_modem *md) - if (port_conf->tx_ch == PORT_CH_CONTROL_TX) - md->core_md.ctl_port = port; - -+ if (port_conf->tx_ch == PORT_CH_AP_CONTROL_TX) -+ md->core_ap.ctl_port = port; -+ - port->t7xx_dev = md->t7xx_dev; - port->dev = &md->t7xx_dev->pdev->dev; - spin_lock_init(&port->port_update_lock); -@@ -442,7 +453,7 @@ static void t7xx_proxy_init_all_ports(struct t7xx_modem *md) - - static int t7xx_proxy_alloc(struct t7xx_modem *md) - { -- unsigned int port_count = ARRAY_SIZE(t7xx_md_port_conf); -+ unsigned int port_count = ARRAY_SIZE(t7xx_port_conf); - struct device *dev = &md->t7xx_dev->pdev->dev; - struct port_proxy *port_prox; - int i; -@@ -456,7 +467,7 @@ static int t7xx_proxy_alloc(struct t7xx_modem *md) - port_prox->dev = dev; - - for (i = 0; i < port_count; i++) -- port_prox->ports[i].port_conf = &t7xx_md_port_conf[i]; -+ port_prox->ports[i].port_conf = &t7xx_port_conf[i]; - - port_prox->port_count = port_count; - t7xx_proxy_init_all_ports(md); -@@ -481,6 +492,7 @@ int t7xx_port_proxy_init(struct t7xx_modem *md) - if (ret) - return ret; - -+ t7xx_cldma_set_recv_skb(md->md_ctrl[CLDMA_ID_AP], t7xx_port_proxy_recv_skb); - t7xx_cldma_set_recv_skb(md->md_ctrl[CLDMA_ID_MD], t7xx_port_proxy_recv_skb); - return 0; - } -diff --git a/drivers/net/wwan/t7xx/t7xx_reg.h b/drivers/net/wwan/t7xx/t7xx_reg.h -index 7c1b81091a0f..c41d7d094c08 100644 ---- a/drivers/net/wwan/t7xx/t7xx_reg.h -+++ b/drivers/net/wwan/t7xx/t7xx_reg.h -@@ -56,7 +56,7 @@ - #define D2H_INT_RESUME_ACK BIT(12) - #define D2H_INT_SUSPEND_ACK_AP BIT(13) - #define D2H_INT_RESUME_ACK_AP BIT(14) --#define D2H_INT_ASYNC_SAP_HK BIT(15) -+#define D2H_INT_ASYNC_AP_HK BIT(15) - #define D2H_INT_ASYNC_MD_HK BIT(16) - - /* Register base */ -diff --git a/drivers/net/wwan/t7xx/t7xx_state_monitor.c b/drivers/net/wwan/t7xx/t7xx_state_monitor.c -index 0bcca08ff2bd..80edb8e75a6a 100644 ---- a/drivers/net/wwan/t7xx/t7xx_state_monitor.c -+++ b/drivers/net/wwan/t7xx/t7xx_state_monitor.c -@@ -285,8 +285,9 @@ static int fsm_routine_starting(struct t7xx_fsm_ctl *ctl) - t7xx_fsm_broadcast_state(ctl, MD_STATE_WAITING_FOR_HS1); - t7xx_md_event_notify(md, FSM_START); - -- wait_event_interruptible_timeout(ctl->async_hk_wq, md->core_md.ready || ctl->exp_flg, -- HZ * 60); -+ wait_event_interruptible_timeout(ctl->async_hk_wq, -+ (md->core_md.ready && md->core_ap.ready) || -+ ctl->exp_flg, HZ * 60); - dev = &md->t7xx_dev->pdev->dev; - - if (ctl->exp_flg) -@@ -297,6 +298,13 @@ static int fsm_routine_starting(struct t7xx_fsm_ctl *ctl) - if (md->core_md.handshake_ongoing) - t7xx_fsm_append_event(ctl, FSM_EVENT_MD_HS2_EXIT, NULL, 0); - -+ fsm_routine_exception(ctl, NULL, EXCEPTION_HS_TIMEOUT); -+ return -ETIMEDOUT; -+ } else if (!md->core_ap.ready) { -+ dev_err(dev, "AP handshake timeout\n"); -+ if (md->core_ap.handshake_ongoing) -+ t7xx_fsm_append_event(ctl, FSM_EVENT_AP_HS2_EXIT, NULL, 0); -+ - fsm_routine_exception(ctl, NULL, EXCEPTION_HS_TIMEOUT); - return -ETIMEDOUT; - } -@@ -335,6 +343,7 @@ static void fsm_routine_start(struct t7xx_fsm_ctl *ctl, struct t7xx_fsm_command - return; - } - -+ t7xx_cldma_hif_hw_init(md->md_ctrl[CLDMA_ID_AP]); - t7xx_cldma_hif_hw_init(md->md_ctrl[CLDMA_ID_MD]); - fsm_finish_command(ctl, cmd, fsm_routine_starting(ctl)); - } -diff --git a/drivers/net/wwan/t7xx/t7xx_state_monitor.h b/drivers/net/wwan/t7xx/t7xx_state_monitor.h -index b1af0259d4c5..b6e76f3903c8 100644 ---- a/drivers/net/wwan/t7xx/t7xx_state_monitor.h -+++ b/drivers/net/wwan/t7xx/t7xx_state_monitor.h -@@ -38,10 +38,12 @@ enum t7xx_fsm_state { - enum t7xx_fsm_event_state { - FSM_EVENT_INVALID, - FSM_EVENT_MD_HS2, -+ FSM_EVENT_AP_HS2, - FSM_EVENT_MD_EX, - FSM_EVENT_MD_EX_REC_OK, - FSM_EVENT_MD_EX_PASS, - FSM_EVENT_MD_HS2_EXIT, -+ FSM_EVENT_AP_HS2_EXIT, - FSM_EVENT_MAX - }; - --- -2.42.0 - diff --git a/0010-Revert-101bd907b424-misc-rtsx-judge-ASPM-Mode-to-set.patch b/0010-Revert-101bd907b424-misc-rtsx-judge-ASPM-Mode-to-set.patch deleted file mode 100644 index 9b4d64a6536c..000000000000 --- a/0010-Revert-101bd907b424-misc-rtsx-judge-ASPM-Mode-to-set.patch +++ /dev/null @@ -1,193 +0,0 @@ -From 04b2ebdedf0b8bbcf106154743144fb57af6d81b Mon Sep 17 00:00:00 2001 -From: Michal Suchanek <msuchanek@suse.de> -Date: Wed, 23 Aug 2023 11:02:33 +0200 -Subject: [PATCH 10/11] Revert 101bd907b424 ("misc: rtsx: judge ASPM Mode to - set PETXCFG Reg") - -References: boo#1214428 boo#1214397 -Patch-mainline: Not yet, fix under discussion - -Causes inability to access Samsung NVMe drives. - -Source: https://bugzilla.kernel.org/show_bug.cgi?id=217802#c18 -Cherry-picked-for: https://bugs.archlinux.org/task/79439 ---- - drivers/misc/cardreader/rts5227.c | 2 +- - drivers/misc/cardreader/rts5228.c | 18 ++++++++++++++++++ - drivers/misc/cardreader/rts5249.c | 3 ++- - drivers/misc/cardreader/rts5260.c | 18 ++++++++++++++++++ - drivers/misc/cardreader/rts5261.c | 18 ++++++++++++++++++ - drivers/misc/cardreader/rtsx_pcr.c | 5 +---- - 6 files changed, 58 insertions(+), 6 deletions(-) - -diff --git a/drivers/misc/cardreader/rts5227.c b/drivers/misc/cardreader/rts5227.c -index 3dae5e3a1697..d676cf63a966 100644 ---- a/drivers/misc/cardreader/rts5227.c -+++ b/drivers/misc/cardreader/rts5227.c -@@ -195,7 +195,7 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr) - } - } - -- if (option->force_clkreq_0 && pcr->aspm_mode == ASPM_MODE_CFG) -+ if (option->force_clkreq_0) - rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, - FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW); - else -diff --git a/drivers/misc/cardreader/rts5228.c b/drivers/misc/cardreader/rts5228.c -index f4ab09439da7..cfebad51d1d8 100644 ---- a/drivers/misc/cardreader/rts5228.c -+++ b/drivers/misc/cardreader/rts5228.c -@@ -435,10 +435,17 @@ static void rts5228_init_from_cfg(struct rtsx_pcr *pcr) - option->ltr_enabled = false; - } - } -+ -+ if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN -+ | PM_L1_1_EN | PM_L1_2_EN)) -+ option->force_clkreq_0 = false; -+ else -+ option->force_clkreq_0 = true; - } - - static int rts5228_extra_init_hw(struct rtsx_pcr *pcr) - { -+ struct rtsx_cr_option *option = &pcr->option; - - rtsx_pci_write_register(pcr, RTS5228_AUTOLOAD_CFG1, - CD_RESUME_EN_MASK, CD_RESUME_EN_MASK); -@@ -469,6 +476,17 @@ static int rts5228_extra_init_hw(struct rtsx_pcr *pcr) - else - rtsx_pci_write_register(pcr, PETXCFG, 0x30, 0x00); - -+ /* -+ * If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced -+ * to drive low, and we forcibly request clock. -+ */ -+ if (option->force_clkreq_0) -+ rtsx_pci_write_register(pcr, PETXCFG, -+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW); -+ else -+ rtsx_pci_write_register(pcr, PETXCFG, -+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH); -+ - rtsx_pci_write_register(pcr, PWD_SUSPEND_EN, 0xFF, 0xFB); - - if (pcr->rtd3_en) { -diff --git a/drivers/misc/cardreader/rts5249.c b/drivers/misc/cardreader/rts5249.c -index 47ab72a43256..91d240dd68fa 100644 ---- a/drivers/misc/cardreader/rts5249.c -+++ b/drivers/misc/cardreader/rts5249.c -@@ -327,11 +327,12 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr) - } - } - -+ - /* - * If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced - * to drive low, and we forcibly request clock. - */ -- if (option->force_clkreq_0 && pcr->aspm_mode == ASPM_MODE_CFG) -+ if (option->force_clkreq_0) - rtsx_pci_write_register(pcr, PETXCFG, - FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW); - else -diff --git a/drivers/misc/cardreader/rts5260.c b/drivers/misc/cardreader/rts5260.c -index 79b18f6f73a8..9b42b20a3e5a 100644 ---- a/drivers/misc/cardreader/rts5260.c -+++ b/drivers/misc/cardreader/rts5260.c -@@ -517,10 +517,17 @@ static void rts5260_init_from_cfg(struct rtsx_pcr *pcr) - option->ltr_enabled = false; - } - } -+ -+ if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN -+ | PM_L1_1_EN | PM_L1_2_EN)) -+ option->force_clkreq_0 = false; -+ else -+ option->force_clkreq_0 = true; - } - - static int rts5260_extra_init_hw(struct rtsx_pcr *pcr) - { -+ struct rtsx_cr_option *option = &pcr->option; - - /* Set mcu_cnt to 7 to ensure data can be sampled properly */ - rtsx_pci_write_register(pcr, 0xFC03, 0x7F, 0x07); -@@ -539,6 +546,17 @@ static int rts5260_extra_init_hw(struct rtsx_pcr *pcr) - - rts5260_init_hw(pcr); - -+ /* -+ * If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced -+ * to drive low, and we forcibly request clock. -+ */ -+ if (option->force_clkreq_0) -+ rtsx_pci_write_register(pcr, PETXCFG, -+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW); -+ else -+ rtsx_pci_write_register(pcr, PETXCFG, -+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH); -+ - rtsx_pci_write_register(pcr, pcr->reg_pm_ctrl3, 0x10, 0x00); - - return 0; -diff --git a/drivers/misc/cardreader/rts5261.c b/drivers/misc/cardreader/rts5261.c -index 94af6bf8a25a..b1e76030cafd 100644 ---- a/drivers/misc/cardreader/rts5261.c -+++ b/drivers/misc/cardreader/rts5261.c -@@ -498,10 +498,17 @@ static void rts5261_init_from_cfg(struct rtsx_pcr *pcr) - option->ltr_enabled = false; - } - } -+ -+ if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN -+ | PM_L1_1_EN | PM_L1_2_EN)) -+ option->force_clkreq_0 = false; -+ else -+ option->force_clkreq_0 = true; - } - - static int rts5261_extra_init_hw(struct rtsx_pcr *pcr) - { -+ struct rtsx_cr_option *option = &pcr->option; - u32 val; - - rtsx_pci_write_register(pcr, RTS5261_AUTOLOAD_CFG1, -@@ -547,6 +554,17 @@ static int rts5261_extra_init_hw(struct rtsx_pcr *pcr) - else - rtsx_pci_write_register(pcr, PETXCFG, 0x30, 0x00); - -+ /* -+ * If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced -+ * to drive low, and we forcibly request clock. -+ */ -+ if (option->force_clkreq_0) -+ rtsx_pci_write_register(pcr, PETXCFG, -+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW); -+ else -+ rtsx_pci_write_register(pcr, PETXCFG, -+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH); -+ - rtsx_pci_write_register(pcr, PWD_SUSPEND_EN, 0xFF, 0xFB); - - if (pcr->rtd3_en) { -diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c -index a3f4b52bb159..32b7783e9d4f 100644 ---- a/drivers/misc/cardreader/rtsx_pcr.c -+++ b/drivers/misc/cardreader/rtsx_pcr.c -@@ -1326,11 +1326,8 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) - return err; - } - -- if (pcr->aspm_mode == ASPM_MODE_REG) { -+ if (pcr->aspm_mode == ASPM_MODE_REG) - rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0x30, 0x30); -- rtsx_pci_write_register(pcr, PETXCFG, -- FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH); -- } - - /* No CD interrupt if probing driver with card inserted. - * So we need to initialize pcr->card_exist here. --- -2.42.0 - @@ -71,8 +71,9 @@ _subarch= ### IMPORTANT: Do no edit below this line unless you know what you're doing pkgbase=linux-ck -pkgver=6.5.5 +pkgver=6.5.6 pkgrel=1 +_upstream=arch2 arch=(x86_64) url="https://wiki.archlinux.org/index.php/Linux-ck" license=(GPL2) @@ -99,38 +100,20 @@ _gcc_more_v=20221217 source=( "https://www.kernel.org/pub/linux/kernel/v6.x/linux-$pkgver.tar".{xz,sign} config # the main kernel config file + "https://github.com/archlinux/linux/releases/download/v$pkgver-$_upstream/linux-v$pkgver-$_upstream.patch.zst" "more-uarches-$_gcc_more_v.tar.gz::https://github.com/graysky2/kernel_compiler_patch/archive/$_gcc_more_v.tar.gz" "ck-hrtimer-$_commit.tar.gz::https://github.com/graysky2/linux-patches/archive/$_commit.tar.gz" - 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch - 0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch - 0003-ASoC-Intel-soc-acpi-fix-Dell-SKU-0B34.patch - 0004-btrfs-wait-on-uncached-block-groups-on-every-allocat.patch - 0005-btrfs-set-last-dir-index-to-the-current-last-index-w.patch - 0006-btrfs-refresh-dir-last-index-during-a-rewinddir-3-ca.patch - 0007-btrfs-fix-race-between-reading-a-directory-and-addin.patch - 0008-i915-Limit-the-length-of-an-sg-list-to-the-requested.patch - 0009-net-wwan-t7xx-Add-AP-CLDMA.patch - 0010-Revert-101bd907b424-misc-rtsx-judge-ASPM-Mode-to-set.patch ) validpgpkeys=( ABAF11C65A2970B130ABE3C479BE3E4300411886 # Linus Torvalds 647F28654894E3BD457199BE38DBBDC86092693E # Greg Kroah-Hartman ) -sha256sums=('8cf10379f7df8ea731e09bff3d0827414e4b643dd41dc99d0af339669646ef95' +sha256sums=('78e36d4214547051c24df2140f4ce09428d6c515ad9a71b38b28e8094a95d2f6' 'SKIP' '46451dbc3305d4c2e726a2f1943bddf697c5bb6815d93e5baed80bca82e53fdc' + '90fbe7cd6c6b3e469e0f929e6ab17f7ea07c8127b91eed813004fb9aaa03a6d7' 'f1d586e111932890ad5e0df15d092fb9b3f87bae4ea17812aae9b0ec98fe2db0' - 'a86a59d089ddd4f31565ff6a27ba74f4697ffa0ab0f57dc839e1da6ab83d77a4' - '9277f8bd1f8450edaf36ca124d5019520cf9c6f28513dc1dab1f7159be03dfb5' - '5ed15d63106e050c6aa92874fcb33b1f827702d42d4281a4b0366e2387f01a07' - '882313cbb296e62dec0d1780aad2c3086fc0fbba86438dd5cef0a1b9519a4224' - 'fa3b984d08e4d764cb6df48d9cafe19284cce059e7856b0e860bce332e92890b' - '3dfd78e809b04a8f1374687f5be667a6275625b08f068a44470c3f2a8a37d4a1' - 'c623b7ac173cdd19a537d0767b7b82b13f166a9705cad16896556e8b9f7d3c87' - 'b6682cec5ea11cc06c27be8c3f0dc25f0168f28308e64c84d4c53f012d02f282' - '6bf774b0294488c01fc9392c69c355859d3fa7ea62127c3cb2f11cedf860e848' - '6c4dfefacd42c571bf53ddaf031566e44832ce87480c63553ddf149620e00e4e' - '242b8868d2a1c8a403e05c0da85f0dc48192ff22adad97e552b4213a19839676') + 'a86a59d089ddd4f31565ff6a27ba74f4697ffa0ab0f57dc839e1da6ab83d77a4') prepare() { cd linux-${pkgver} @@ -139,15 +122,11 @@ prepare() { echo "-$pkgrel" > localversion.10-pkgrel echo "${pkgbase#linux}" > localversion.20-pkgname - local src - for src in "${source[@]}"; do - src="${src%%::*}" - src="${src##*/}" - src="${src%.zst}" - [[ $src = 0*.patch ]] || continue - echo "Applying patch $src..." - patch -Np1 < "../$src" - done + msg2 "Applying Arch Linux $_upstream patch set" + patch -p1 -i ../linux-v$pkgver-$_upstream.patch || exit 1 + + # remove the -archx suffix + sed -i s'/^EXTRAVERSION =.*/EXTRAVERSION =/' Makefile echo "Setting config..." cp ../config .config @@ -186,7 +165,7 @@ prepare() { # https://github.com/graysky2/kernel_gcc_patch # make sure to apply after olddefconfig to allow the next section - echo "Patching to enable GCC optimization for other uarchs..." + msg2 "Patching to enable GCC optimization for other uarchs..." patch -Np1 -i "$srcdir/kernel_compiler_patch-$_gcc_more_v/more-uarches-for-kernel-5.17+.patch" if [ -n "$_subarch" ]; then @@ -210,7 +189,7 @@ prepare() { fi make -s kernelrelease > version - echo "Prepared $pkgbase version $(<version)" + msg2 "Prepared $pkgbase version $(<version)" [[ -z "$_makenconfig" ]] || make LLVM=$_LLVM LLVM_IAS=$_LLVM nconfig |