From d69bba18a5a97fcdefb34a71fdf2255daa6e053b Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sat, 16 Dec 2023 16:00:34 -0500 Subject: [PATCH] Fixes for 6.1 Signed-off-by: Sasha Levin --- ...ndency-between-vmlinuz.efi-and-image.patch | 80 +++++++ ...nlock-fix-queued_spin_value_unlocked.patch | 51 ++++ ...comments-for-bch_btree_node_get-and-.patch | 50 ++++ ...l-checking-to-c-root-in-run_cache_se.patch | 39 ++++ ...rsize-memory-allocation-by-small-str.patch | 90 ++++++++ ...dundant-assignment-to-variable-cur_i.patch | 42 ++++ ...s-blkcg_deactivate_policy-after-dest.patch | 55 +++++ ...-lockdep-warning-of-cgroup_mutex-or-.patch | 49 ++++ ...-spinlock-for-setting-vblank-event-i.patch | 54 +++++ ...d-add-always_poll-quirk-for-apple-kb.patch | 34 +++ ...ious-fix-glorious-model-i-hid-report.patch | 135 +++++++++++ ...-const-to-read-only-outgoing-usb-buf.patch | 65 ++++++ ...et-the-backlight-brightness-level-on.patch | 67 ++++++ ...dd-quirk-for-honor-glo-gxxx-touchpad.patch | 46 ++++ ...pendency-between-vmlinuz.efi-and-vml.patch | 79 +++++++ ...ent-constant-timer-shutdown-interfac.patch | 94 ++++++++ ...fig-initialization-into-nbd_alloc_co.patch | 118 ++++++++++ ...k-to-nbd_read_reply-instead-of-index.patch | 217 ++++++++++++++++++ ...wwan-claim-interface-4-for-zte-mf290.patch | 68 ++++++ ...t-explanation-code-for-failure2-msgs.patch | 38 +++ ...-auth-unlock-mutex-in-one-place-only.patch | 34 +++ ...-errors-from-nvme_configure_metadata.patch | 83 +++++++ ...el_telemetry-fix-kernel-doc-descript.patch | 57 +++++ ...x-bpf_loop_bench-for-new-callback-ve.patch | 88 +++++++ queue-6.1/series | 27 +++ ...loongson-add-architecture-dependency.patch | 39 ++++ ...heck-packet-for-fixup-for-true-limit.patch | 58 +++++ ...he-detection-of-e820_type_pram-in-a-.patch | 92 ++++++++ 28 files changed, 1949 insertions(+) create mode 100644 queue-6.1/arm64-add-dependency-between-vmlinuz.efi-and-image.patch create mode 100644 queue-6.1/asm-generic-qspinlock-fix-queued_spin_value_unlocked.patch create mode 100644 queue-6.1/bcache-add-code-comments-for-bch_btree_node_get-and-.patch create mode 100644 queue-6.1/bcache-avoid-null-checking-to-c-root-in-run_cache_se.patch create mode 100644 queue-6.1/bcache-avoid-oversize-memory-allocation-by-small-str.patch create mode 100644 queue-6.1/bcache-remove-redundant-assignment-to-variable-cur_i.patch create mode 100644 queue-6.1/blk-cgroup-bypass-blkcg_deactivate_policy-after-dest.patch create mode 100644 queue-6.1/blk-throttle-fix-lockdep-warning-of-cgroup_mutex-or-.patch create mode 100644 queue-6.1/drm-mediatek-add-spinlock-for-setting-vblank-event-i.patch create mode 100644 queue-6.1/hid-add-always_poll-quirk-for-apple-kb.patch create mode 100644 queue-6.1/hid-glorious-fix-glorious-model-i-hid-report.patch create mode 100644 queue-6.1/hid-hid-asus-add-const-to-read-only-outgoing-usb-buf.patch create mode 100644 queue-6.1/hid-hid-asus-reset-the-backlight-brightness-level-on.patch create mode 100644 queue-6.1/hid-multitouch-add-quirk-for-honor-glo-gxxx-touchpad.patch create mode 100644 queue-6.1/loongarch-add-dependency-between-vmlinuz.efi-and-vml.patch create mode 100644 queue-6.1/loongarch-implement-constant-timer-shutdown-interfac.patch create mode 100644 queue-6.1/nbd-fold-nbd-config-initialization-into-nbd_alloc_co.patch create mode 100644 queue-6.1/nbd-pass-nbd_sock-to-nbd_read_reply-instead-of-index.patch create mode 100644 queue-6.1/net-usb-qmi_wwan-claim-interface-4-for-zte-mf290.patch create mode 100644 queue-6.1/nvme-auth-set-explanation-code-for-failure2-msgs.patch create mode 100644 queue-6.1/nvme-auth-unlock-mutex-in-one-place-only.patch create mode 100644 queue-6.1/nvme-catch-errors-from-nvme_configure_metadata.patch create mode 100644 queue-6.1/platform-x86-intel_telemetry-fix-kernel-doc-descript.patch create mode 100644 queue-6.1/selftests-bpf-fix-bpf_loop_bench-for-new-callback-ve.patch create mode 100644 queue-6.1/stmmac-dwmac-loongson-add-architecture-dependency.patch create mode 100644 queue-6.1/usb-aqc111-check-packet-for-fixup-for-true-limit.patch create mode 100644 queue-6.1/x86-hyperv-fix-the-detection-of-e820_type_pram-in-a-.patch diff --git a/queue-6.1/arm64-add-dependency-between-vmlinuz.efi-and-image.patch b/queue-6.1/arm64-add-dependency-between-vmlinuz.efi-and-image.patch new file mode 100644 index 00000000000..41c1c3d7756 --- /dev/null +++ b/queue-6.1/arm64-add-dependency-between-vmlinuz.efi-and-image.patch @@ -0,0 +1,80 @@ +From 4db92c62345c1066393f040105bb3d202d13aad8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 19 Nov 2023 14:32:34 +0900 +Subject: arm64: add dependency between vmlinuz.efi and Image + +From: Masahiro Yamada + +[ Upstream commit c0a8574204054effad6ac83cc75c02576e2985fe ] + +A common issue in Makefile is a race in parallel building. + +You need to be careful to prevent multiple threads from writing to the +same file simultaneously. + +Commit 3939f3345050 ("ARM: 8418/1: add boot image dependencies to not +generate invalid images") addressed such a bad scenario. + +A similar symptom occurs with the following command: + + $ make -j$(nproc) ARCH=arm64 Image vmlinuz.efi + [ snip ] + SORTTAB vmlinux + OBJCOPY arch/arm64/boot/Image + OBJCOPY arch/arm64/boot/Image + AS arch/arm64/boot/zboot-header.o + PAD arch/arm64/boot/vmlinux.bin + GZIP arch/arm64/boot/vmlinuz + OBJCOPY arch/arm64/boot/vmlinuz.o + LD arch/arm64/boot/vmlinuz.efi.elf + OBJCOPY arch/arm64/boot/vmlinuz.efi + +The log "OBJCOPY arch/arm64/boot/Image" is displayed twice. + +It indicates that two threads simultaneously enter arch/arm64/boot/ +and write to arch/arm64/boot/Image. + +It occasionally leads to a build failure: + + $ make -j$(nproc) ARCH=arm64 Image vmlinuz.efi + [ snip ] + SORTTAB vmlinux + OBJCOPY arch/arm64/boot/Image + PAD arch/arm64/boot/vmlinux.bin + truncate: Invalid number: 'arch/arm64/boot/vmlinux.bin' + make[2]: *** [drivers/firmware/efi/libstub/Makefile.zboot:13: + arch/arm64/boot/vmlinux.bin] Error 1 + make[2]: *** Deleting file 'arch/arm64/boot/vmlinux.bin' + make[1]: *** [arch/arm64/Makefile:163: vmlinuz.efi] Error 2 + make[1]: *** Waiting for unfinished jobs.... + make: *** [Makefile:234: __sub-make] Error 2 + +vmlinuz.efi depends on Image, but such a dependency is not specified +in arch/arm64/Makefile. + +Signed-off-by: Masahiro Yamada +Acked-by: Ard Biesheuvel +Reviewed-by: SImon Glass +Link: https://lore.kernel.org/r/20231119053234.2367621-1-masahiroy@kernel.org +Signed-off-by: Catalin Marinas +Signed-off-by: Sasha Levin +--- + arch/arm64/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile +index 5e56d26a22398..c9496539c3351 100644 +--- a/arch/arm64/Makefile ++++ b/arch/arm64/Makefile +@@ -157,7 +157,7 @@ endif + + all: $(notdir $(KBUILD_IMAGE)) + +- ++vmlinuz.efi: Image + Image vmlinuz.efi: vmlinux + $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ + +-- +2.43.0 + diff --git a/queue-6.1/asm-generic-qspinlock-fix-queued_spin_value_unlocked.patch b/queue-6.1/asm-generic-qspinlock-fix-queued_spin_value_unlocked.patch new file mode 100644 index 00000000000..368f20f87c3 --- /dev/null +++ b/queue-6.1/asm-generic-qspinlock-fix-queued_spin_value_unlocked.patch @@ -0,0 +1,51 @@ +From 17ede8e4d53a4be25510c9bc2e64c6eb3d0e7271 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Nov 2023 22:22:13 -0800 +Subject: asm-generic: qspinlock: fix queued_spin_value_unlocked() + implementation + +From: Linus Torvalds + +[ Upstream commit 125b0bb95dd6bec81b806b997a4ccb026eeecf8f ] + +We really don't want to do atomic_read() or anything like that, since we +already have the value, not the lock. The whole point of this is that +we've loaded the lock from memory, and we want to check whether the +value we loaded was a locked one or not. + +The main use of this is the lockref code, which loads both the lock and +the reference count in one atomic operation, and then works on that +combined value. With the atomic_read(), the compiler would pointlessly +spill the value to the stack, in order to then be able to read it back +"atomically". + +This is the qspinlock version of commit c6f4a9002252 ("asm-generic: +ticket-lock: Optimize arch_spin_value_unlocked()") which fixed this same +bug for ticket locks. + +Cc: Guo Ren +Cc: Ingo Molnar +Cc: Waiman Long +Link: https://lore.kernel.org/all/CAHk-=whNRv0v6kQiV5QO6DJhjH4KEL36vWQ6Re8Csrnh4zbRkQ@mail.gmail.com/ +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + include/asm-generic/qspinlock.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/asm-generic/qspinlock.h b/include/asm-generic/qspinlock.h +index 995513fa26904..0655aa5b57b29 100644 +--- a/include/asm-generic/qspinlock.h ++++ b/include/asm-generic/qspinlock.h +@@ -70,7 +70,7 @@ static __always_inline int queued_spin_is_locked(struct qspinlock *lock) + */ + static __always_inline int queued_spin_value_unlocked(struct qspinlock lock) + { +- return !atomic_read(&lock.val); ++ return !lock.val.counter; + } + + /** +-- +2.43.0 + diff --git a/queue-6.1/bcache-add-code-comments-for-bch_btree_node_get-and-.patch b/queue-6.1/bcache-add-code-comments-for-bch_btree_node_get-and-.patch new file mode 100644 index 00000000000..1cac2d6636e --- /dev/null +++ b/queue-6.1/bcache-add-code-comments-for-bch_btree_node_get-and-.patch @@ -0,0 +1,50 @@ +From e85ddfe1fc0034d49780ffca0e729d41ffe18f21 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Nov 2023 13:25:02 +0800 +Subject: bcache: add code comments for bch_btree_node_get() and + __bch_btree_node_alloc() + +From: Coly Li + +[ Upstream commit 31f5b956a197d4ec25c8a07cb3a2ab69d0c0b82f ] + +This patch adds code comments to bch_btree_node_get() and +__bch_btree_node_alloc() that NULL pointer will not be returned and it +is unnecessary to check NULL pointer by the callers of these routines. + +Signed-off-by: Coly Li +Link: https://lore.kernel.org/r/20231120052503.6122-10-colyli@suse.de +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/md/bcache/btree.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c +index 05e3157fc7b4e..6a2f57ae0f3c2 100644 +--- a/drivers/md/bcache/btree.c ++++ b/drivers/md/bcache/btree.c +@@ -974,6 +974,9 @@ static struct btree *mca_alloc(struct cache_set *c, struct btree_op *op, + * + * The btree node will have either a read or a write lock held, depending on + * level and op->lock. ++ * ++ * Note: Only error code or btree pointer will be returned, it is unncessary ++ * for callers to check NULL pointer. + */ + struct btree *bch_btree_node_get(struct cache_set *c, struct btree_op *op, + struct bkey *k, int level, bool write, +@@ -1085,6 +1088,10 @@ static void btree_node_free(struct btree *b) + mutex_unlock(&b->c->bucket_lock); + } + ++/* ++ * Only error code or btree pointer will be returned, it is unncessary for ++ * callers to check NULL pointer. ++ */ + struct btree *__bch_btree_node_alloc(struct cache_set *c, struct btree_op *op, + int level, bool wait, + struct btree *parent) +-- +2.43.0 + diff --git a/queue-6.1/bcache-avoid-null-checking-to-c-root-in-run_cache_se.patch b/queue-6.1/bcache-avoid-null-checking-to-c-root-in-run_cache_se.patch new file mode 100644 index 00000000000..4727b3e3d69 --- /dev/null +++ b/queue-6.1/bcache-avoid-null-checking-to-c-root-in-run_cache_se.patch @@ -0,0 +1,39 @@ +From 660586f420e82a2417588b3269a7fb197714a188 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Nov 2023 13:25:03 +0800 +Subject: bcache: avoid NULL checking to c->root in run_cache_set() + +From: Coly Li + +[ Upstream commit 3eba5e0b2422aec3c9e79822029599961fdcab97 ] + +In run_cache_set() after c->root returned from bch_btree_node_get(), it +is checked by IS_ERR_OR_NULL(). Indeed it is unncessary to check NULL +because bch_btree_node_get() will not return NULL pointer to caller. + +This patch replaces IS_ERR_OR_NULL() by IS_ERR() for the above reason. + +Signed-off-by: Coly Li +Link: https://lore.kernel.org/r/20231120052503.6122-11-colyli@suse.de +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/md/bcache/super.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 525871380f442..70e5bd8961d2f 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -2019,7 +2019,7 @@ static int run_cache_set(struct cache_set *c) + c->root = bch_btree_node_get(c, NULL, k, + j->btree_level, + true, NULL); +- if (IS_ERR_OR_NULL(c->root)) ++ if (IS_ERR(c->root)) + goto err; + + list_del_init(&c->root->list); +-- +2.43.0 + diff --git a/queue-6.1/bcache-avoid-oversize-memory-allocation-by-small-str.patch b/queue-6.1/bcache-avoid-oversize-memory-allocation-by-small-str.patch new file mode 100644 index 00000000000..d72e9537e09 --- /dev/null +++ b/queue-6.1/bcache-avoid-oversize-memory-allocation-by-small-str.patch @@ -0,0 +1,90 @@ +From 6d8c2366ff8f4551e4ab1a40b0c5179215154a24 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Nov 2023 13:24:54 +0800 +Subject: bcache: avoid oversize memory allocation by small stripe_size + +From: Coly Li + +[ Upstream commit baf8fb7e0e5ec54ea0839f0c534f2cdcd79bea9c ] + +Arraies bcache->stripe_sectors_dirty and bcache->full_dirty_stripes are +used for dirty data writeback, their sizes are decided by backing device +capacity and stripe size. Larger backing device capacity or smaller +stripe size make these two arraies occupies more dynamic memory space. + +Currently bcache->stripe_size is directly inherited from +queue->limits.io_opt of underlying storage device. For normal hard +drives, its limits.io_opt is 0, and bcache sets the corresponding +stripe_size to 1TB (1<<31 sectors), it works fine 10+ years. But for +devices do declare value for queue->limits.io_opt, small stripe_size +(comparing to 1TB) becomes an issue for oversize memory allocations of +bcache->stripe_sectors_dirty and bcache->full_dirty_stripes, while the +capacity of hard drives gets much larger in recent decade. + +For example a raid5 array assembled by three 20TB hardrives, the raid +device capacity is 40TB with typical 512KB limits.io_opt. After the math +calculation in bcache code, these two arraies will occupy 400MB dynamic +memory. Even worse Andrea Tomassetti reports that a 4KB limits.io_opt is +declared on a new 2TB hard drive, then these two arraies request 2GB and +512MB dynamic memory from kzalloc(). The result is that bcache device +always fails to initialize on his system. + +To avoid the oversize memory allocation, bcache->stripe_size should not +directly inherited by queue->limits.io_opt from the underlying device. +This patch defines BCH_MIN_STRIPE_SZ (4MB) as minimal bcache stripe size +and set bcache device's stripe size against the declared limits.io_opt +value from the underlying storage device, +- If the declared limits.io_opt > BCH_MIN_STRIPE_SZ, bcache device will + set its stripe size directly by this limits.io_opt value. +- If the declared limits.io_opt < BCH_MIN_STRIPE_SZ, bcache device will + set its stripe size by a value multiplying limits.io_opt and euqal or + large than BCH_MIN_STRIPE_SZ. + +Then the minimal stripe size of a bcache device will always be >= 4MB. +For a 40TB raid5 device with 512KB limits.io_opt, memory occupied by +bcache->stripe_sectors_dirty and bcache->full_dirty_stripes will be 50MB +in total. For a 2TB hard drive with 4KB limits.io_opt, memory occupied +by these two arraies will be 2.5MB in total. + +Such mount of memory allocated for bcache->stripe_sectors_dirty and +bcache->full_dirty_stripes is reasonable for most of storage devices. + +Reported-by: Andrea Tomassetti +Signed-off-by: Coly Li +Reviewed-by: Eric Wheeler +Link: https://lore.kernel.org/r/20231120052503.6122-2-colyli@suse.de +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/md/bcache/bcache.h | 1 + + drivers/md/bcache/super.c | 2 ++ + 2 files changed, 3 insertions(+) + +diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h +index aebb7ef10e631..e86fa736dc4ee 100644 +--- a/drivers/md/bcache/bcache.h ++++ b/drivers/md/bcache/bcache.h +@@ -265,6 +265,7 @@ struct bcache_device { + #define BCACHE_DEV_WB_RUNNING 3 + #define BCACHE_DEV_RATE_DW_RUNNING 4 + int nr_stripes; ++#define BCH_MIN_STRIPE_SZ ((4 << 20) >> SECTOR_SHIFT) + unsigned int stripe_size; + atomic_t *stripe_sectors_dirty; + unsigned long *full_dirty_stripes; +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 7660962e7b8b4..525871380f442 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -905,6 +905,8 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size, + + if (!d->stripe_size) + d->stripe_size = 1 << 31; ++ else if (d->stripe_size < BCH_MIN_STRIPE_SZ) ++ d->stripe_size = roundup(BCH_MIN_STRIPE_SZ, d->stripe_size); + + n = DIV_ROUND_UP_ULL(sectors, d->stripe_size); + if (!n || n > max_stripes) { +-- +2.43.0 + diff --git a/queue-6.1/bcache-remove-redundant-assignment-to-variable-cur_i.patch b/queue-6.1/bcache-remove-redundant-assignment-to-variable-cur_i.patch new file mode 100644 index 00000000000..48c41e6f85f --- /dev/null +++ b/queue-6.1/bcache-remove-redundant-assignment-to-variable-cur_i.patch @@ -0,0 +1,42 @@ +From 8d27b01cf63c07550a6a95386bd04eef94b3cdb1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Nov 2023 13:24:56 +0800 +Subject: bcache: remove redundant assignment to variable cur_idx + +From: Colin Ian King + +[ Upstream commit be93825f0e6428c2d3f03a6e4d447dc48d33d7ff ] + +Variable cur_idx is being initialized with a value that is never read, +it is being re-assigned later in a while-loop. Remove the redundant +assignment. Cleans up clang scan build warning: + +drivers/md/bcache/writeback.c:916:2: warning: Value stored to 'cur_idx' +is never read [deadcode.DeadStores] + +Signed-off-by: Colin Ian King +Reviewed-by: Coly Li +Signed-off-by: Coly Li +Link: https://lore.kernel.org/r/20231120052503.6122-4-colyli@suse.de +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/md/bcache/writeback.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c +index 01c7c6ca4789f..18c6e0d2877b5 100644 +--- a/drivers/md/bcache/writeback.c ++++ b/drivers/md/bcache/writeback.c +@@ -913,7 +913,7 @@ static int bch_dirty_init_thread(void *arg) + int cur_idx, prev_idx, skip_nr; + + k = p = NULL; +- cur_idx = prev_idx = 0; ++ prev_idx = 0; + + bch_btree_iter_init(&c->root->keys, &iter, NULL); + k = bch_btree_iter_next_filter(&iter, &c->root->keys, bch_ptr_bad); +-- +2.43.0 + diff --git a/queue-6.1/blk-cgroup-bypass-blkcg_deactivate_policy-after-dest.patch b/queue-6.1/blk-cgroup-bypass-blkcg_deactivate_policy-after-dest.patch new file mode 100644 index 00000000000..4750edb6b14 --- /dev/null +++ b/queue-6.1/blk-cgroup-bypass-blkcg_deactivate_policy-after-dest.patch @@ -0,0 +1,55 @@ +From 6be6b3956626d0c6d39f58737fee9ba65e3fc78c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Nov 2023 10:35:24 +0800 +Subject: blk-cgroup: bypass blkcg_deactivate_policy after destroying + +From: Ming Lei + +[ Upstream commit e63a57303599b17290cd8bc48e6f20b24289a8bc ] + +blkcg_deactivate_policy() can be called after blkg_destroy_all() +returns, and it isn't necessary since blkg_destroy_all has covered +policy deactivation. + +Signed-off-by: Ming Lei +Link: https://lore.kernel.org/r/20231117023527.3188627-4-ming.lei@redhat.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + block/blk-cgroup.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c +index 60f366f98fa2b..1b7fd1fc2f337 100644 +--- a/block/blk-cgroup.c ++++ b/block/blk-cgroup.c +@@ -462,6 +462,7 @@ static void blkg_destroy_all(struct gendisk *disk) + struct request_queue *q = disk->queue; + struct blkcg_gq *blkg, *n; + int count = BLKG_DESTROY_BATCH_SIZE; ++ int i; + + restart: + spin_lock_irq(&q->queue_lock); +@@ -487,6 +488,18 @@ static void blkg_destroy_all(struct gendisk *disk) + } + } + ++ /* ++ * Mark policy deactivated since policy offline has been done, and ++ * the free is scheduled, so future blkcg_deactivate_policy() can ++ * be bypassed ++ */ ++ for (i = 0; i < BLKCG_MAX_POLS; i++) { ++ struct blkcg_policy *pol = blkcg_policy[i]; ++ ++ if (pol) ++ __clear_bit(pol->plid, q->blkcg_pols); ++ } ++ + q->root_blkg = NULL; + spin_unlock_irq(&q->queue_lock); + } +-- +2.43.0 + diff --git a/queue-6.1/blk-throttle-fix-lockdep-warning-of-cgroup_mutex-or-.patch b/queue-6.1/blk-throttle-fix-lockdep-warning-of-cgroup_mutex-or-.patch new file mode 100644 index 00000000000..5888c3403ee --- /dev/null +++ b/queue-6.1/blk-throttle-fix-lockdep-warning-of-cgroup_mutex-or-.patch @@ -0,0 +1,49 @@ +From 0025fef276aa8fa14fc2a98f3063482fc55ce332 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Nov 2023 10:35:22 +0800 +Subject: blk-throttle: fix lockdep warning of "cgroup_mutex or RCU read lock + required!" + +From: Ming Lei + +[ Upstream commit 27b13e209ddca5979847a1b57890e0372c1edcee ] + +Inside blkg_for_each_descendant_pre(), both +css_for_each_descendant_pre() and blkg_lookup() requires RCU read lock, +and either cgroup_assert_mutex_or_rcu_locked() or rcu_read_lock_held() +is called. + +Fix the warning by adding rcu read lock. + +Reported-by: Changhui Zhong +Signed-off-by: Ming Lei +Link: https://lore.kernel.org/r/20231117023527.3188627-2-ming.lei@redhat.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + block/blk-throttle.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/block/blk-throttle.c b/block/blk-throttle.c +index 009b0d76bf036..62a3f62316df1 100644 +--- a/block/blk-throttle.c ++++ b/block/blk-throttle.c +@@ -1333,6 +1333,7 @@ static void tg_conf_updated(struct throtl_grp *tg, bool global) + tg_bps_limit(tg, READ), tg_bps_limit(tg, WRITE), + tg_iops_limit(tg, READ), tg_iops_limit(tg, WRITE)); + ++ rcu_read_lock(); + /* + * Update has_rules[] flags for the updated tg's subtree. A tg is + * considered to have rules if either the tg itself or any of its +@@ -1360,6 +1361,7 @@ static void tg_conf_updated(struct throtl_grp *tg, bool global) + this_tg->latency_target = max(this_tg->latency_target, + parent_tg->latency_target); + } ++ rcu_read_unlock(); + + /* + * We're already holding queue_lock and know @tg is valid. Let's +-- +2.43.0 + diff --git a/queue-6.1/drm-mediatek-add-spinlock-for-setting-vblank-event-i.patch b/queue-6.1/drm-mediatek-add-spinlock-for-setting-vblank-event-i.patch new file mode 100644 index 00000000000..71bf146288e --- /dev/null +++ b/queue-6.1/drm-mediatek-add-spinlock-for-setting-vblank-event-i.patch @@ -0,0 +1,54 @@ +From 61ce27ab1146b73ba32b89728055ad8a77a5e9e3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Sep 2023 17:06:58 +0800 +Subject: drm/mediatek: Add spinlock for setting vblank event in atomic_begin + +From: Jason-JH.Lin + +[ Upstream commit fe4c5f662097978b6c91c23a13c24ed92339a180 ] + +Add spinlock protection to avoid race condition on vblank event +between mtk_drm_crtc_atomic_begin() and mtk_drm_finish_page_flip(). + +Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.") +Signed-off-by: Jason-JH.Lin +Suggested-by: AngeloGioacchino Del Regno +Reviewed-by: Alexandre Mergnat +Reviewed-by: Fei Shao +Tested-by: Fei Shao +Reviewed-by: AngeloGioacchino Del Regno +Reviewed-by: CK Hu +Link: https://patchwork.kernel.org/project/dri-devel/patch/20230920090658.31181-1-jason-jh.lin@mediatek.com/ +Signed-off-by: Chun-Kuang Hu +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +index 7fb52a573436e..558000db4a100 100644 +--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c ++++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +@@ -736,6 +736,7 @@ static void mtk_drm_crtc_atomic_begin(struct drm_crtc *crtc, + crtc); + struct mtk_crtc_state *mtk_crtc_state = to_mtk_crtc_state(crtc_state); + struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); ++ unsigned long flags; + + if (mtk_crtc->event && mtk_crtc_state->base.event) + DRM_ERROR("new event while there is still a pending event\n"); +@@ -743,7 +744,11 @@ static void mtk_drm_crtc_atomic_begin(struct drm_crtc *crtc, + if (mtk_crtc_state->base.event) { + mtk_crtc_state->base.event->pipe = drm_crtc_index(crtc); + WARN_ON(drm_crtc_vblank_get(crtc) != 0); ++ ++ spin_lock_irqsave(&crtc->dev->event_lock, flags); + mtk_crtc->event = mtk_crtc_state->base.event; ++ spin_unlock_irqrestore(&crtc->dev->event_lock, flags); ++ + mtk_crtc_state->base.event = NULL; + } + } +-- +2.43.0 + diff --git a/queue-6.1/hid-add-always_poll-quirk-for-apple-kb.patch b/queue-6.1/hid-add-always_poll-quirk-for-apple-kb.patch new file mode 100644 index 00000000000..b9cac370d7a --- /dev/null +++ b/queue-6.1/hid-add-always_poll-quirk-for-apple-kb.patch @@ -0,0 +1,34 @@ +From 22e9aef18b05c94bb408491c7d5e107dc443e937 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Nov 2023 15:54:30 +0100 +Subject: HID: add ALWAYS_POLL quirk for Apple kb + +From: Oliver Neukum + +[ Upstream commit c55092187d9ad7b2f8f5a8645286fa03997d442f ] + +These devices disconnect if suspended without remote wakeup. They can operate +with the standard driver. + +Signed-off-by: Oliver Neukum +Signed-off-by: Jiri Kosina +Signed-off-by: Sasha Levin +--- + drivers/hid/hid-quirks.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c +index 056bb32091285..60884066362a1 100644 +--- a/drivers/hid/hid-quirks.c ++++ b/drivers/hid/hid-quirks.c +@@ -33,6 +33,7 @@ static const struct hid_device_id hid_quirks[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_AKAI, USB_DEVICE_ID_AKAI_MPKMINI2), HID_QUIRK_NO_INIT_REPORTS }, + { HID_USB_DEVICE(USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD), HID_QUIRK_BADPAD }, + { HID_USB_DEVICE(USB_VENDOR_ID_AMI, USB_DEVICE_ID_AMI_VIRT_KEYBOARD_AND_MOUSE), HID_QUIRK_ALWAYS_POLL }, ++ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI), HID_QUIRK_ALWAYS_POLL }, + { HID_USB_DEVICE(USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM), HID_QUIRK_NOGET }, + { HID_USB_DEVICE(USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC), HID_QUIRK_NOGET }, + { HID_USB_DEVICE(USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM), HID_QUIRK_NOGET }, +-- +2.43.0 + diff --git a/queue-6.1/hid-glorious-fix-glorious-model-i-hid-report.patch b/queue-6.1/hid-glorious-fix-glorious-model-i-hid-report.patch new file mode 100644 index 00000000000..9842df243ba --- /dev/null +++ b/queue-6.1/hid-glorious-fix-glorious-model-i-hid-report.patch @@ -0,0 +1,135 @@ +From 2785baaaf6789db9a0b97d913184a71357151869 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Nov 2023 18:10:38 -0700 +Subject: HID: glorious: fix Glorious Model I HID report + +From: Brett Raye + +[ Upstream commit a5e913c25b6b2b6ae02acef6d9400645ac03dfdf ] + +The Glorious Model I mouse has a buggy HID report descriptor for its +keyboard endpoint (used for programmable buttons). For report ID 2, there +is a mismatch between Logical Minimum and Usage Minimum in the array that +reports keycodes. + +The offending portion of the descriptor: (from hid-decode) + +0x95, 0x05, // Report Count (5) 30 +0x75, 0x08, // Report Size (8) 32 +0x15, 0x00, // Logical Minimum (0) 34 +0x25, 0x65, // Logical Maximum (101) 36 +0x05, 0x07, // Usage Page (Keyboard) 38 +0x19, 0x01, // Usage Minimum (1) 40 +0x29, 0x65, // Usage Maximum (101) 42 +0x81, 0x00, // Input (Data,Arr,Abs) 44 + +This bug shifts all programmed keycodes up by 1. Importantly, this causes +"empty" array indexes of 0x00 to be interpreted as 0x01, ErrorRollOver. +The presence of ErrorRollOver causes the system to ignore all keypresses +from the endpoint and breaks the ability to use the programmable buttons. + +Setting byte 41 to 0x00 fixes this, and causes keycodes to be interpreted +correctly. + +Also, USB_VENDOR_ID_GLORIOUS is changed to USB_VENDOR_ID_SINOWEALTH, +and a new ID for Laview Technology is added. Glorious seems to be +white-labeling controller boards or mice from these vendors. There isn't a +single canonical vendor ID for Glorious products. + +Signed-off-by: Brett Raye +Signed-off-by: Jiri Kosina +Signed-off-by: Sasha Levin +--- + drivers/hid/hid-glorious.c | 16 ++++++++++++++-- + drivers/hid/hid-ids.h | 11 +++++++---- + 2 files changed, 21 insertions(+), 6 deletions(-) + +diff --git a/drivers/hid/hid-glorious.c b/drivers/hid/hid-glorious.c +index 558eb08c19ef9..281b3a7187cec 100644 +--- a/drivers/hid/hid-glorious.c ++++ b/drivers/hid/hid-glorious.c +@@ -21,6 +21,10 @@ MODULE_DESCRIPTION("HID driver for Glorious PC Gaming Race mice"); + * Glorious Model O and O- specify the const flag in the consumer input + * report descriptor, which leads to inputs being ignored. Fix this + * by patching the descriptor. ++ * ++ * Glorious Model I incorrectly specifes the Usage Minimum for its ++ * keyboard HID report, causing keycodes to be misinterpreted. ++ * Fix this by setting Usage Minimum to 0 in that report. + */ + static __u8 *glorious_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int *rsize) +@@ -32,6 +36,10 @@ static __u8 *glorious_report_fixup(struct hid_device *hdev, __u8 *rdesc, + rdesc[85] = rdesc[113] = rdesc[141] = \ + HID_MAIN_ITEM_VARIABLE | HID_MAIN_ITEM_RELATIVE; + } ++ if (*rsize == 156 && rdesc[41] == 1) { ++ hid_info(hdev, "patching Glorious Model I keyboard report descriptor\n"); ++ rdesc[41] = 0; ++ } + return rdesc; + } + +@@ -44,6 +52,8 @@ static void glorious_update_name(struct hid_device *hdev) + model = "Model O"; break; + case USB_DEVICE_ID_GLORIOUS_MODEL_D: + model = "Model D"; break; ++ case USB_DEVICE_ID_GLORIOUS_MODEL_I: ++ model = "Model I"; break; + } + + snprintf(hdev->name, sizeof(hdev->name), "%s %s", "Glorious", model); +@@ -66,10 +76,12 @@ static int glorious_probe(struct hid_device *hdev, + } + + static const struct hid_device_id glorious_devices[] = { +- { HID_USB_DEVICE(USB_VENDOR_ID_GLORIOUS, ++ { HID_USB_DEVICE(USB_VENDOR_ID_SINOWEALTH, + USB_DEVICE_ID_GLORIOUS_MODEL_O) }, +- { HID_USB_DEVICE(USB_VENDOR_ID_GLORIOUS, ++ { HID_USB_DEVICE(USB_VENDOR_ID_SINOWEALTH, + USB_DEVICE_ID_GLORIOUS_MODEL_D) }, ++ { HID_USB_DEVICE(USB_VENDOR_ID_LAVIEW, ++ USB_DEVICE_ID_GLORIOUS_MODEL_I) }, + { } + }; + MODULE_DEVICE_TABLE(hid, glorious_devices); +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h +index 130fc5f341422..1be454bafcb91 100644 +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -503,10 +503,6 @@ + #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_010A 0x010a + #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_E100 0xe100 + +-#define USB_VENDOR_ID_GLORIOUS 0x258a +-#define USB_DEVICE_ID_GLORIOUS_MODEL_D 0x0033 +-#define USB_DEVICE_ID_GLORIOUS_MODEL_O 0x0036 +- + #define I2C_VENDOR_ID_GOODIX 0x27c6 + #define I2C_DEVICE_ID_GOODIX_01F0 0x01f0 + +@@ -729,6 +725,9 @@ + #define USB_VENDOR_ID_LABTEC 0x1020 + #define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006 + ++#define USB_VENDOR_ID_LAVIEW 0x22D4 ++#define USB_DEVICE_ID_GLORIOUS_MODEL_I 0x1503 ++ + #define USB_VENDOR_ID_LCPOWER 0x1241 + #define USB_DEVICE_ID_LCPOWER_LC1000 0xf767 + +@@ -1131,6 +1130,10 @@ + #define USB_VENDOR_ID_SIGMATEL 0x066F + #define USB_DEVICE_ID_SIGMATEL_STMP3780 0x3780 + ++#define USB_VENDOR_ID_SINOWEALTH 0x258a ++#define USB_DEVICE_ID_GLORIOUS_MODEL_D 0x0033 ++#define USB_DEVICE_ID_GLORIOUS_MODEL_O 0x0036 ++ + #define USB_VENDOR_ID_SIS_TOUCH 0x0457 + #define USB_DEVICE_ID_SIS9200_TOUCH 0x9200 + #define USB_DEVICE_ID_SIS817_TOUCH 0x0817 +-- +2.43.0 + diff --git a/queue-6.1/hid-hid-asus-add-const-to-read-only-outgoing-usb-buf.patch b/queue-6.1/hid-hid-asus-add-const-to-read-only-outgoing-usb-buf.patch new file mode 100644 index 00000000000..759c9a010ae --- /dev/null +++ b/queue-6.1/hid-hid-asus-add-const-to-read-only-outgoing-usb-buf.patch @@ -0,0 +1,65 @@ +From 04705b14bfb6717ef51b0f7e83d0a924baaa342e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Nov 2023 14:15:55 +1300 +Subject: HID: hid-asus: add const to read-only outgoing usb buffer + +From: Denis Benato + +[ Upstream commit 06ae5afce8cc1f7621cc5c7751e449ce20d68af7 ] + +In the function asus_kbd_set_report the parameter buf is read-only +as it gets copied in a memory portion suitable for USB transfer, +but the parameter is not marked as const: add the missing const and mark +const immutable buffers passed to that function. + +Signed-off-by: Denis Benato +Signed-off-by: Luke D. Jones +Signed-off-by: Jiri Kosina +Signed-off-by: Sasha Levin +--- + drivers/hid/hid-asus.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c +index 88dfa688f560d..220d6b2af4d3f 100644 +--- a/drivers/hid/hid-asus.c ++++ b/drivers/hid/hid-asus.c +@@ -380,7 +380,7 @@ static int asus_raw_event(struct hid_device *hdev, + return 0; + } + +-static int asus_kbd_set_report(struct hid_device *hdev, u8 *buf, size_t buf_size) ++static int asus_kbd_set_report(struct hid_device *hdev, const u8 *buf, size_t buf_size) + { + unsigned char *dmabuf; + int ret; +@@ -403,7 +403,7 @@ static int asus_kbd_set_report(struct hid_device *hdev, u8 *buf, size_t buf_size + + static int asus_kbd_init(struct hid_device *hdev) + { +- u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54, ++ const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54, + 0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 }; + int ret; + +@@ -417,7 +417,7 @@ static int asus_kbd_init(struct hid_device *hdev) + static int asus_kbd_get_functions(struct hid_device *hdev, + unsigned char *kbd_func) + { +- u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x05, 0x20, 0x31, 0x00, 0x08 }; ++ const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x05, 0x20, 0x31, 0x00, 0x08 }; + u8 *readbuf; + int ret; + +@@ -448,7 +448,7 @@ static int asus_kbd_get_functions(struct hid_device *hdev, + + static int rog_nkey_led_init(struct hid_device *hdev) + { +- u8 buf_init_start[] = { FEATURE_KBD_LED_REPORT_ID1, 0xB9 }; ++ const u8 buf_init_start[] = { FEATURE_KBD_LED_REPORT_ID1, 0xB9 }; + u8 buf_init2[] = { FEATURE_KBD_LED_REPORT_ID1, 0x41, 0x53, 0x55, 0x53, 0x20, + 0x54, 0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 }; + u8 buf_init3[] = { FEATURE_KBD_LED_REPORT_ID1, +-- +2.43.0 + diff --git a/queue-6.1/hid-hid-asus-reset-the-backlight-brightness-level-on.patch b/queue-6.1/hid-hid-asus-reset-the-backlight-brightness-level-on.patch new file mode 100644 index 00000000000..99276eb6b5d --- /dev/null +++ b/queue-6.1/hid-hid-asus-reset-the-backlight-brightness-level-on.patch @@ -0,0 +1,67 @@ +From 72dd92bb0e6d56e9b581990e11f63d7d3daaab2e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Nov 2023 14:15:56 +1300 +Subject: HID: hid-asus: reset the backlight brightness level on resume + +From: Denis Benato + +[ Upstream commit 546edbd26cff7ae990e480a59150e801a06f77b1 ] + +Some devices managed by this driver automatically set brightness to 0 +before entering a suspended state and reset it back to a default +brightness level after the resume: +this has the effect of having the kernel report wrong brightness +status after a sleep, and on some devices (like the Asus RC71L) that +brightness is the intensity of LEDs directly facing the user. + +Fix the above issue by setting back brightness to the level it had +before entering a sleep state. + +Signed-off-by: Denis Benato +Signed-off-by: Luke D. Jones +Signed-off-by: Jiri Kosina +Signed-off-by: Sasha Levin +--- + drivers/hid/hid-asus.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c +index d1094bb1aa429..88dfa688f560d 100644 +--- a/drivers/hid/hid-asus.c ++++ b/drivers/hid/hid-asus.c +@@ -1012,6 +1012,24 @@ static int asus_start_multitouch(struct hid_device *hdev) + return 0; + } + ++static int __maybe_unused asus_resume(struct hid_device *hdev) { ++ struct asus_drvdata *drvdata = hid_get_drvdata(hdev); ++ int ret = 0; ++ ++ if (drvdata->kbd_backlight) { ++ const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0xba, 0xc5, 0xc4, ++ drvdata->kbd_backlight->cdev.brightness }; ++ ret = asus_kbd_set_report(hdev, buf, sizeof(buf)); ++ if (ret < 0) { ++ hid_err(hdev, "Asus failed to set keyboard backlight: %d\n", ret); ++ goto asus_resume_err; ++ } ++ } ++ ++asus_resume_err: ++ return ret; ++} ++ + static int __maybe_unused asus_reset_resume(struct hid_device *hdev) + { + struct asus_drvdata *drvdata = hid_get_drvdata(hdev); +@@ -1303,6 +1321,7 @@ static struct hid_driver asus_driver = { + .input_configured = asus_input_configured, + #ifdef CONFIG_PM + .reset_resume = asus_reset_resume, ++ .resume = asus_resume, + #endif + .event = asus_event, + .raw_event = asus_raw_event +-- +2.43.0 + diff --git a/queue-6.1/hid-multitouch-add-quirk-for-honor-glo-gxxx-touchpad.patch b/queue-6.1/hid-multitouch-add-quirk-for-honor-glo-gxxx-touchpad.patch new file mode 100644 index 00000000000..4dcd1f31379 --- /dev/null +++ b/queue-6.1/hid-multitouch-add-quirk-for-honor-glo-gxxx-touchpad.patch @@ -0,0 +1,46 @@ +From 795a6a803d91930b8e61fcf08a1340feec190b25 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Nov 2023 20:23:11 +0800 +Subject: HID: multitouch: Add quirk for HONOR GLO-GXXX touchpad + +From: Aoba K + +[ Upstream commit 9ffccb691adb854e7b7f3ee57fbbda12ff70533f ] + +Honor MagicBook 13 2023 has a touchpad which do not switch to the multitouch +mode until the input mode feature is written by the host. The touchpad do +report the input mode at touchpad(3), while itself working under mouse mode. As +a workaround, it is possible to call MT_QUIRE_FORCE_GET_FEATURE to force set +feature in mt_set_input_mode for such device. + +The touchpad reports as BLTP7853, which cannot retrive any useful manufacture +information on the internel by this string at present. As the serial number of +the laptop is GLO-G52, while DMI info reports the laptop serial number as +GLO-GXXX, this workaround should applied to all models which has the GLO-GXXX. + +Signed-off-by: Aoba K +Signed-off-by: Jiri Kosina +Signed-off-by: Sasha Levin +--- + drivers/hid/hid-multitouch.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c +index 8db4ae05febc8..5ec1f174127a3 100644 +--- a/drivers/hid/hid-multitouch.c ++++ b/drivers/hid/hid-multitouch.c +@@ -2048,6 +2048,11 @@ static const struct hid_device_id mt_devices[] = { + MT_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT, + USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) }, + ++ /* HONOR GLO-GXXX panel */ ++ { .driver_data = MT_CLS_VTL, ++ HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, ++ 0x347d, 0x7853) }, ++ + /* Ilitek dual touch panel */ + { .driver_data = MT_CLS_NSMU, + MT_USB_DEVICE(USB_VENDOR_ID_ILITEK, +-- +2.43.0 + diff --git a/queue-6.1/loongarch-add-dependency-between-vmlinuz.efi-and-vml.patch b/queue-6.1/loongarch-add-dependency-between-vmlinuz.efi-and-vml.patch new file mode 100644 index 00000000000..08224ee2735 --- /dev/null +++ b/queue-6.1/loongarch-add-dependency-between-vmlinuz.efi-and-vml.patch @@ -0,0 +1,79 @@ +From b030555698a48f23e5cef26679c8a97a3104e913 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Nov 2023 15:03:25 +0800 +Subject: LoongArch: Add dependency between vmlinuz.efi and vmlinux.efi +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Masahiro Yamada + +[ Upstream commit d3ec75bc635cb0cb8185b63293d33a3d1b942d22 ] + +A common issue in Makefile is a race in parallel building. + +You need to be careful to prevent multiple threads from writing to the +same file simultaneously. + +Commit 3939f3345050 ("ARM: 8418/1: add boot image dependencies to not +generate invalid images") addressed such a bad scenario. + +A similar symptom occurs with the following command: + + $ make -j$(nproc) ARCH=loongarch vmlinux.efi vmlinuz.efi + [ snip ] + SORTTAB vmlinux + OBJCOPY arch/loongarch/boot/vmlinux.efi + OBJCOPY arch/loongarch/boot/vmlinux.efi + PAD arch/loongarch/boot/vmlinux.bin + GZIP arch/loongarch/boot/vmlinuz + OBJCOPY arch/loongarch/boot/vmlinuz.o + LD arch/loongarch/boot/vmlinuz.efi.elf + OBJCOPY arch/loongarch/boot/vmlinuz.efi + +The log "OBJCOPY arch/loongarch/boot/vmlinux.efi" is displayed twice. + +It indicates that two threads simultaneously enter arch/loongarch/boot/ +and write to arch/loongarch/boot/vmlinux.efi. + +It occasionally leads to a build failure: + + $ make -j$(nproc) ARCH=loongarch vmlinux.efi vmlinuz.efi + [ snip ] + SORTTAB vmlinux + OBJCOPY arch/loongarch/boot/vmlinux.efi + PAD arch/loongarch/boot/vmlinux.bin + truncate: Invalid number: ‘arch/loongarch/boot/vmlinux.bin’ + make[2]: *** [drivers/firmware/efi/libstub/Makefile.zboot:13: + arch/loongarch/boot/vmlinux.bin] Error 1 + make[2]: *** Deleting file 'arch/loongarch/boot/vmlinux.bin' + make[1]: *** [arch/loongarch/Makefile:146: vmlinuz.efi] Error 2 + make[1]: *** Waiting for unfinished jobs.... + make: *** [Makefile:234: __sub-make] Error 2 + +vmlinuz.efi depends on vmlinux.efi, but such a dependency is not +specified in arch/loongarch/Makefile. + +Signed-off-by: Masahiro Yamada +Signed-off-by: Huacai Chen +Signed-off-by: Sasha Levin +--- + arch/loongarch/Makefile | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile +index 01b57b7263225..ed47a3a87768e 100644 +--- a/arch/loongarch/Makefile ++++ b/arch/loongarch/Makefile +@@ -116,6 +116,8 @@ vdso_install: + + all: $(notdir $(KBUILD_IMAGE)) + ++vmlinuz.efi: vmlinux.efi ++ + vmlinux.elf vmlinux.efi vmlinuz.efi: vmlinux + $(Q)$(MAKE) $(build)=$(boot) $(bootvars-y) $(boot)/$@ + +-- +2.43.0 + diff --git a/queue-6.1/loongarch-implement-constant-timer-shutdown-interfac.patch b/queue-6.1/loongarch-implement-constant-timer-shutdown-interfac.patch new file mode 100644 index 00000000000..4fd1401be60 --- /dev/null +++ b/queue-6.1/loongarch-implement-constant-timer-shutdown-interfac.patch @@ -0,0 +1,94 @@ +From 8f60f2ddf8686aff9c88e65ded977e10c1140fe1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Nov 2023 15:03:25 +0800 +Subject: LoongArch: Implement constant timer shutdown interface + +From: Bibo Mao + +[ Upstream commit d43f37b73468c172bc89ac4824a1511b411f0778 ] + +When a cpu is hot-unplugged, it is put in idle state and the function +arch_cpu_idle_dead() is called. The timer interrupt for this processor +should be disabled, otherwise there will be pending timer interrupt for +the unplugged cpu, so that vcpu is prevented from giving up scheduling +when system is running in vm mode. + +This patch implements the timer shutdown interface so that the constant +timer will be properly disabled when a CPU is hot-unplugged. + +Reviewed-by: WANG Xuerui +Signed-off-by: Bibo Mao +Signed-off-by: Huacai Chen +Signed-off-by: Sasha Levin +--- + arch/loongarch/kernel/time.c | 23 +++++++++-------------- + 1 file changed, 9 insertions(+), 14 deletions(-) + +diff --git a/arch/loongarch/kernel/time.c b/arch/loongarch/kernel/time.c +index d2b7d5df132a9..150df6e17bb6a 100644 +--- a/arch/loongarch/kernel/time.c ++++ b/arch/loongarch/kernel/time.c +@@ -58,14 +58,16 @@ static int constant_set_state_oneshot(struct clock_event_device *evt) + return 0; + } + +-static int constant_set_state_oneshot_stopped(struct clock_event_device *evt) ++static int constant_set_state_periodic(struct clock_event_device *evt) + { ++ unsigned long period; + unsigned long timer_config; + + raw_spin_lock(&state_lock); + +- timer_config = csr_read64(LOONGARCH_CSR_TCFG); +- timer_config &= ~CSR_TCFG_EN; ++ period = const_clock_freq / HZ; ++ timer_config = period & CSR_TCFG_VAL; ++ timer_config |= (CSR_TCFG_PERIOD | CSR_TCFG_EN); + csr_write64(timer_config, LOONGARCH_CSR_TCFG); + + raw_spin_unlock(&state_lock); +@@ -73,16 +75,14 @@ static int constant_set_state_oneshot_stopped(struct clock_event_device *evt) + return 0; + } + +-static int constant_set_state_periodic(struct clock_event_device *evt) ++static int constant_set_state_shutdown(struct clock_event_device *evt) + { +- unsigned long period; + unsigned long timer_config; + + raw_spin_lock(&state_lock); + +- period = const_clock_freq / HZ; +- timer_config = period & CSR_TCFG_VAL; +- timer_config |= (CSR_TCFG_PERIOD | CSR_TCFG_EN); ++ timer_config = csr_read64(LOONGARCH_CSR_TCFG); ++ timer_config &= ~CSR_TCFG_EN; + csr_write64(timer_config, LOONGARCH_CSR_TCFG); + + raw_spin_unlock(&state_lock); +@@ -90,11 +90,6 @@ static int constant_set_state_periodic(struct clock_event_device *evt) + return 0; + } + +-static int constant_set_state_shutdown(struct clock_event_device *evt) +-{ +- return 0; +-} +- + static int constant_timer_next_event(unsigned long delta, struct clock_event_device *evt) + { + unsigned long timer_config; +@@ -156,7 +151,7 @@ int constant_clockevent_init(void) + cd->rating = 320; + cd->cpumask = cpumask_of(cpu); + cd->set_state_oneshot = constant_set_state_oneshot; +- cd->set_state_oneshot_stopped = constant_set_state_oneshot_stopped; ++ cd->set_state_oneshot_stopped = constant_set_state_shutdown; + cd->set_state_periodic = constant_set_state_periodic; + cd->set_state_shutdown = constant_set_state_shutdown; + cd->set_next_event = constant_timer_next_event; +-- +2.43.0 + diff --git a/queue-6.1/nbd-fold-nbd-config-initialization-into-nbd_alloc_co.patch b/queue-6.1/nbd-fold-nbd-config-initialization-into-nbd_alloc_co.patch new file mode 100644 index 00000000000..d60223f38d0 --- /dev/null +++ b/queue-6.1/nbd-fold-nbd-config-initialization-into-nbd_alloc_co.patch @@ -0,0 +1,118 @@ +From 22e4aebae42c7b2f100c29f0198ba44465bf8f29 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Nov 2023 00:23:14 +0800 +Subject: nbd: fold nbd config initialization into nbd_alloc_config() + +From: Li Nan + +[ Upstream commit 1b59860540a4018e8071dc18d4893ec389506b7d ] + +There are no functional changes, make the code cleaner and prepare to +fix null-ptr-dereference while accessing 'nbd->config'. + +Signed-off-by: Li Nan +Reviewed-by: Josef Bacik +Link: https://lore.kernel.org/r/20231116162316.1740402-2-linan666@huaweicloud.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/block/nbd.c | 41 +++++++++++++++++++---------------------- + 1 file changed, 19 insertions(+), 22 deletions(-) + +diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c +index e94d2ff6b1223..e70733c76e884 100644 +--- a/drivers/block/nbd.c ++++ b/drivers/block/nbd.c +@@ -1530,17 +1530,20 @@ static int nbd_ioctl(struct block_device *bdev, fmode_t mode, + return error; + } + +-static struct nbd_config *nbd_alloc_config(void) ++static int nbd_alloc_and_init_config(struct nbd_device *nbd) + { + struct nbd_config *config; + ++ if (WARN_ON(nbd->config)) ++ return -EINVAL; ++ + if (!try_module_get(THIS_MODULE)) +- return ERR_PTR(-ENODEV); ++ return -ENODEV; + + config = kzalloc(sizeof(struct nbd_config), GFP_NOFS); + if (!config) { + module_put(THIS_MODULE); +- return ERR_PTR(-ENOMEM); ++ return -ENOMEM; + } + + atomic_set(&config->recv_threads, 0); +@@ -1548,7 +1551,10 @@ static struct nbd_config *nbd_alloc_config(void) + init_waitqueue_head(&config->conn_wait); + config->blksize_bits = NBD_DEF_BLKSIZE_BITS; + atomic_set(&config->live_connections, 0); +- return config; ++ nbd->config = config; ++ refcount_set(&nbd->config_refs, 1); ++ ++ return 0; + } + + static int nbd_open(struct block_device *bdev, fmode_t mode) +@@ -1567,21 +1573,17 @@ static int nbd_open(struct block_device *bdev, fmode_t mode) + goto out; + } + if (!refcount_inc_not_zero(&nbd->config_refs)) { +- struct nbd_config *config; +- + mutex_lock(&nbd->config_lock); + if (refcount_inc_not_zero(&nbd->config_refs)) { + mutex_unlock(&nbd->config_lock); + goto out; + } +- config = nbd_alloc_config(); +- if (IS_ERR(config)) { +- ret = PTR_ERR(config); ++ ret = nbd_alloc_and_init_config(nbd); ++ if (ret) { + mutex_unlock(&nbd->config_lock); + goto out; + } +- nbd->config = config; +- refcount_set(&nbd->config_refs, 1); ++ + refcount_inc(&nbd->refs); + mutex_unlock(&nbd->config_lock); + if (max_part) +@@ -1990,22 +1992,17 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info) + pr_err("nbd%d already in use\n", index); + return -EBUSY; + } +- if (WARN_ON(nbd->config)) { +- mutex_unlock(&nbd->config_lock); +- nbd_put(nbd); +- return -EINVAL; +- } +- config = nbd_alloc_config(); +- if (IS_ERR(config)) { ++ ++ ret = nbd_alloc_and_init_config(nbd); ++ if (ret) { + mutex_unlock(&nbd->config_lock); + nbd_put(nbd); + pr_err("couldn't allocate config\n"); +- return PTR_ERR(config); ++ return ret; + } +- nbd->config = config; +- refcount_set(&nbd->config_refs, 1); +- set_bit(NBD_RT_BOUND, &config->runtime_flags); + ++ config = nbd->config; ++ set_bit(NBD_RT_BOUND, &config->runtime_flags); + ret = nbd_genl_size_set(info, nbd); + if (ret) + goto out; +-- +2.43.0 + diff --git a/queue-6.1/nbd-pass-nbd_sock-to-nbd_read_reply-instead-of-index.patch b/queue-6.1/nbd-pass-nbd_sock-to-nbd_read_reply-instead-of-index.patch new file mode 100644 index 00000000000..ec275b70ac4 --- /dev/null +++ b/queue-6.1/nbd-pass-nbd_sock-to-nbd_read_reply-instead-of-index.patch @@ -0,0 +1,217 @@ +From da7445e46071e2261d46fbd9832c8f310add9f3c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Sep 2023 10:33:08 +0800 +Subject: nbd: pass nbd_sock to nbd_read_reply() instead of index + +From: Li Nan + +[ Upstream commit 98c598afc22d4e43c2ad91860b65996d0c099a5d ] + +If a socket is processing ioctl 'NBD_SET_SOCK', config->socks might be +krealloc in nbd_add_socket(), and a garbage request is received now, a UAF +may occurs. + + T1 + nbd_ioctl + __nbd_ioctl + nbd_add_socket + blk_mq_freeze_queue + T2 + recv_work + nbd_read_reply + sock_xmit + krealloc config->socks + def config->socks + +Pass nbd_sock to nbd_read_reply(). And introduce a new function +sock_xmit_recv(), which differs from sock_xmit only in the way it get +socket. + +================================================================== +BUG: KASAN: use-after-free in sock_xmit+0x525/0x550 +Read of size 8 at addr ffff8880188ec428 by task kworker/u12:1/18779 + +Workqueue: knbd4-recv recv_work +Call Trace: + __dump_stack + dump_stack+0xbe/0xfd + print_address_description.constprop.0+0x19/0x170 + __kasan_report.cold+0x6c/0x84 + kasan_report+0x3a/0x50 + sock_xmit+0x525/0x550 + nbd_read_reply+0xfe/0x2c0 + recv_work+0x1c2/0x750 + process_one_work+0x6b6/0xf10 + worker_thread+0xdd/0xd80 + kthread+0x30a/0x410 + ret_from_fork+0x22/0x30 + +Allocated by task 18784: + kasan_save_stack+0x1b/0x40 + kasan_set_track + set_alloc_info + __kasan_kmalloc + __kasan_kmalloc.constprop.0+0xf0/0x130 + slab_post_alloc_hook + slab_alloc_node + slab_alloc + __kmalloc_track_caller+0x157/0x550 + __do_krealloc + krealloc+0x37/0xb0 + nbd_add_socket + +0x2d3/0x880 + __nbd_ioctl + nbd_ioctl+0x584/0x8e0 + __blkdev_driver_ioctl + blkdev_ioctl+0x2a0/0x6e0 + block_ioctl+0xee/0x130 + vfs_ioctl + __do_sys_ioctl + __se_sys_ioctl+0x138/0x190 + do_syscall_64+0x33/0x40 + entry_SYSCALL_64_after_hwframe+0x61/0xc6 + +Freed by task 18784: + kasan_save_stack+0x1b/0x40 + kasan_set_track+0x1c/0x30 + kasan_set_free_info+0x20/0x40 + __kasan_slab_free.part.0+0x13f/0x1b0 + slab_free_hook + slab_free_freelist_hook + slab_free + kfree+0xcb/0x6c0 + krealloc+0x56/0xb0 + nbd_add_socket+0x2d3/0x880 + __nbd_ioctl + nbd_ioctl+0x584/0x8e0 + __blkdev_driver_ioctl + blkdev_ioctl+0x2a0/0x6e0 + block_ioctl+0xee/0x130 + vfs_ioctl + __do_sys_ioctl + __se_sys_ioctl+0x138/0x190 + do_syscall_64+0x33/0x40 + entry_SYSCALL_64_after_hwframe+0x61/0xc6 + +Signed-off-by: Li Nan +Reviewed-by: Yu Kuai +Reviewed-by: Ming Lei +Link: https://lore.kernel.org/r/20230911023308.3467802-1-linan666@huaweicloud.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/block/nbd.c | 35 ++++++++++++++++++++++------------- + 1 file changed, 22 insertions(+), 13 deletions(-) + +diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c +index e70733c76e884..8037aaefeb2ed 100644 +--- a/drivers/block/nbd.c ++++ b/drivers/block/nbd.c +@@ -67,6 +67,7 @@ struct nbd_sock { + struct recv_thread_args { + struct work_struct work; + struct nbd_device *nbd; ++ struct nbd_sock *nsock; + int index; + }; + +@@ -489,15 +490,9 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req) + return BLK_EH_DONE; + } + +-/* +- * Send or receive packet. Return a positive value on success and +- * negtive value on failue, and never return 0. +- */ +-static int sock_xmit(struct nbd_device *nbd, int index, int send, +- struct iov_iter *iter, int msg_flags, int *sent) ++static int __sock_xmit(struct nbd_device *nbd, struct socket *sock, int send, ++ struct iov_iter *iter, int msg_flags, int *sent) + { +- struct nbd_config *config = nbd->config; +- struct socket *sock = config->socks[index]->sock; + int result; + struct msghdr msg; + unsigned int noreclaim_flag; +@@ -539,6 +534,19 @@ static int sock_xmit(struct nbd_device *nbd, int index, int send, + return result; + } + ++/* ++ * Send or receive packet. Return a positive value on success and ++ * negtive value on failure, and never return 0. ++ */ ++static int sock_xmit(struct nbd_device *nbd, int index, int send, ++ struct iov_iter *iter, int msg_flags, int *sent) ++{ ++ struct nbd_config *config = nbd->config; ++ struct socket *sock = config->socks[index]->sock; ++ ++ return __sock_xmit(nbd, sock, send, iter, msg_flags, sent); ++} ++ + /* + * Different settings for sk->sk_sndtimeo can result in different return values + * if there is a signal pending when we enter sendmsg, because reasons? +@@ -695,7 +703,7 @@ static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index) + return 0; + } + +-static int nbd_read_reply(struct nbd_device *nbd, int index, ++static int nbd_read_reply(struct nbd_device *nbd, struct socket *sock, + struct nbd_reply *reply) + { + struct kvec iov = {.iov_base = reply, .iov_len = sizeof(*reply)}; +@@ -704,7 +712,7 @@ static int nbd_read_reply(struct nbd_device *nbd, int index, + + reply->magic = 0; + iov_iter_kvec(&to, ITER_DEST, &iov, 1, sizeof(*reply)); +- result = sock_xmit(nbd, index, 0, &to, MSG_WAITALL, NULL); ++ result = __sock_xmit(nbd, sock, 0, &to, MSG_WAITALL, NULL); + if (result < 0) { + if (!nbd_disconnected(nbd->config)) + dev_err(disk_to_dev(nbd->disk), +@@ -828,14 +836,14 @@ static void recv_work(struct work_struct *work) + struct nbd_device *nbd = args->nbd; + struct nbd_config *config = nbd->config; + struct request_queue *q = nbd->disk->queue; +- struct nbd_sock *nsock; ++ struct nbd_sock *nsock = args->nsock; + struct nbd_cmd *cmd; + struct request *rq; + + while (1) { + struct nbd_reply reply; + +- if (nbd_read_reply(nbd, args->index, &reply)) ++ if (nbd_read_reply(nbd, nsock->sock, &reply)) + break; + + /* +@@ -870,7 +878,6 @@ static void recv_work(struct work_struct *work) + percpu_ref_put(&q->q_usage_counter); + } + +- nsock = config->socks[args->index]; + mutex_lock(&nsock->tx_lock); + nbd_mark_nsock_dead(nbd, nsock, 1); + mutex_unlock(&nsock->tx_lock); +@@ -1214,6 +1221,7 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg) + INIT_WORK(&args->work, recv_work); + args->index = i; + args->nbd = nbd; ++ args->nsock = nsock; + nsock->cookie++; + mutex_unlock(&nsock->tx_lock); + sockfd_put(old); +@@ -1396,6 +1404,7 @@ static int nbd_start_device(struct nbd_device *nbd) + refcount_inc(&nbd->config_refs); + INIT_WORK(&args->work, recv_work); + args->nbd = nbd; ++ args->nsock = config->socks[i]; + args->index = i; + queue_work(nbd->recv_workq, &args->work); + } +-- +2.43.0 + diff --git a/queue-6.1/net-usb-qmi_wwan-claim-interface-4-for-zte-mf290.patch b/queue-6.1/net-usb-qmi_wwan-claim-interface-4-for-zte-mf290.patch new file mode 100644 index 00000000000..d1b96729794 --- /dev/null +++ b/queue-6.1/net-usb-qmi_wwan-claim-interface-4-for-zte-mf290.patch @@ -0,0 +1,68 @@ +From d8255deb478738a75d8f97528a882a7077885de3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 18 Nov 2023 00:19:18 +0100 +Subject: net: usb: qmi_wwan: claim interface 4 for ZTE MF290 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Lech Perczak + +[ Upstream commit 99360d9620f09fb8bc15548d855011bbb198c680 ] + +Interface 4 is used by for QMI interface in stock firmware of MF28D, the +router which uses MF290 modem. Rebind it to qmi_wwan after freeing it up +from option driver. +The proper configuration is: + +Interface mapping is: +0: QCDM, 1: (unknown), 2: AT (PCUI), 2: AT (Modem), 4: QMI + +T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 4 Spd=480 MxCh= 0 +D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 +P: Vendor=19d2 ProdID=0189 Rev= 0.00 +S: Manufacturer=ZTE, Incorporated +S: Product=ZTE LTE Technologies MSM +C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA +I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms +I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms +I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms +I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=84(I) Atr=03(Int.) MxPS= 64 Ivl=2ms +E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms +I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan +E: Ad=86(I) Atr=03(Int.) MxPS= 64 Ivl=2ms +E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms + +Cc: Bjørn Mork +Signed-off-by: Lech Perczak +Link: https://lore.kernel.org/r/20231117231918.100278-3-lech.perczak@gmail.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/usb/qmi_wwan.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c +index 4fb981b8732ef..2d82481d34e6b 100644 +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -1288,6 +1288,7 @@ static const struct usb_device_id products[] = { + {QMI_FIXED_INTF(0x19d2, 0x0168, 4)}, + {QMI_FIXED_INTF(0x19d2, 0x0176, 3)}, + {QMI_FIXED_INTF(0x19d2, 0x0178, 3)}, ++ {QMI_FIXED_INTF(0x19d2, 0x0189, 4)}, /* ZTE MF290 */ + {QMI_FIXED_INTF(0x19d2, 0x0191, 4)}, /* ZTE EuFi890 */ + {QMI_FIXED_INTF(0x19d2, 0x0199, 1)}, /* ZTE MF820S */ + {QMI_FIXED_INTF(0x19d2, 0x0200, 1)}, +-- +2.43.0 + diff --git a/queue-6.1/nvme-auth-set-explanation-code-for-failure2-msgs.patch b/queue-6.1/nvme-auth-set-explanation-code-for-failure2-msgs.patch new file mode 100644 index 00000000000..b15a8cc920e --- /dev/null +++ b/queue-6.1/nvme-auth-set-explanation-code-for-failure2-msgs.patch @@ -0,0 +1,38 @@ +From c51f5ef5b395f448435566d28e27b1cc68e7888e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Oct 2023 08:45:12 +0000 +Subject: nvme-auth: set explanation code for failure2 msgs + +From: Mark O'Donovan + +[ Upstream commit 38ce1570e2c46e7e9af983aa337edd7e43723aa2 ] + +Some error cases were not setting an auth-failure-reason-code-explanation. +This means an AUTH_Failure2 message will be sent with an explanation value +of 0 which is a reserved value. + +Signed-off-by: Mark O'Donovan +Reviewed-by: Hannes Reinecke +Reviewed-by: Sagi Grimberg +Signed-off-by: Keith Busch +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/auth.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c +index 7c9dfb420c464..d67076e98b4bc 100644 +--- a/drivers/nvme/host/auth.c ++++ b/drivers/nvme/host/auth.c +@@ -835,6 +835,8 @@ static void nvme_queue_auth_work(struct work_struct *work) + } + + fail2: ++ if (chap->status == 0) ++ chap->status = NVME_AUTH_DHCHAP_FAILURE_FAILED; + dev_dbg(ctrl->device, "%s: qid %d send failure2, status %x\n", + __func__, chap->qid, chap->status); + tl = nvme_auth_set_dhchap_failure2_data(ctrl, chap); +-- +2.43.0 + diff --git a/queue-6.1/nvme-auth-unlock-mutex-in-one-place-only.patch b/queue-6.1/nvme-auth-unlock-mutex-in-one-place-only.patch new file mode 100644 index 00000000000..c33492b6713 --- /dev/null +++ b/queue-6.1/nvme-auth-unlock-mutex-in-one-place-only.patch @@ -0,0 +1,34 @@ +From e85d53548a98fef7933fc10ff03f588037cafaf9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Oct 2023 08:45:11 +0000 +Subject: nvme-auth: unlock mutex in one place only + +From: Mark O'Donovan + +[ Upstream commit 616add70bfdc0274a253e84fc78155c27aacde91 ] + +Signed-off-by: Mark O'Donovan +Reviewed-by: Christoph Hellwig +Reviewed-by: Sagi Grimberg +Reviewed-by: Hannes Reinecke +Signed-off-by: Keith Busch +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/auth.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c +index 9dfd3d0293054..7c9dfb420c464 100644 +--- a/drivers/nvme/host/auth.c ++++ b/drivers/nvme/host/auth.c +@@ -758,6 +758,7 @@ static void nvme_queue_auth_work(struct work_struct *work) + dev_dbg(ctrl->device, "%s: qid %d host response\n", + __func__, chap->qid); + ret = nvme_auth_dhchap_setup_host_response(ctrl, chap); ++ mutex_unlock(&ctrl->dhchap_auth_mutex); + if (ret) { + chap->error = ret; + goto fail2; +-- +2.43.0 + diff --git a/queue-6.1/nvme-catch-errors-from-nvme_configure_metadata.patch b/queue-6.1/nvme-catch-errors-from-nvme_configure_metadata.patch new file mode 100644 index 00000000000..cce1ca863fc --- /dev/null +++ b/queue-6.1/nvme-catch-errors-from-nvme_configure_metadata.patch @@ -0,0 +1,83 @@ +From 2fee31e58660163d64936707b9efe7f0cba4e936 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Nov 2023 14:27:01 +0100 +Subject: nvme: catch errors from nvme_configure_metadata() + +From: Hannes Reinecke + +[ Upstream commit cd9aed606088d36a7ffff3e808db4e76b1854285 ] + +nvme_configure_metadata() is issuing I/O, so we might incur an I/O +error which will cause the connection to be reset. +But in that case any further probing will race with reset and +cause UAF errors. +So return a status from nvme_configure_metadata() and abort +probing if there was an I/O error. + +Signed-off-by: Hannes Reinecke +Signed-off-by: Keith Busch +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index 5b156c5bc04a5..eb7c87b344b8f 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -1845,16 +1845,18 @@ static int nvme_init_ms(struct nvme_ns *ns, struct nvme_id_ns *id) + return ret; + } + +-static void nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) ++static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) + { + struct nvme_ctrl *ctrl = ns->ctrl; ++ int ret; + +- if (nvme_init_ms(ns, id)) +- return; ++ ret = nvme_init_ms(ns, id); ++ if (ret) ++ return ret; + + ns->features &= ~(NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS); + if (!ns->ms || !(ctrl->ops->flags & NVME_F_METADATA_SUPPORTED)) +- return; ++ return 0; + + if (ctrl->ops->flags & NVME_F_FABRICS) { + /* +@@ -1863,7 +1865,7 @@ static void nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) + * remap the separate metadata buffer from the block layer. + */ + if (WARN_ON_ONCE(!(id->flbas & NVME_NS_FLBAS_META_EXT))) +- return; ++ return 0; + + ns->features |= NVME_NS_EXT_LBAS; + +@@ -1890,6 +1892,7 @@ static void nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) + else + ns->features |= NVME_NS_METADATA_SUPPORTED; + } ++ return 0; + } + + static void nvme_set_queue_limits(struct nvme_ctrl *ctrl, +@@ -2070,7 +2073,11 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns, + ns->lba_shift = id->lbaf[lbaf].ds; + nvme_set_queue_limits(ns->ctrl, ns->queue); + +- nvme_configure_metadata(ns, id); ++ ret = nvme_configure_metadata(ns, id); ++ if (ret < 0) { ++ blk_mq_unfreeze_queue(ns->disk->queue); ++ goto out; ++ } + nvme_set_chunk_sectors(ns, id); + nvme_update_disk_info(ns->disk, ns, id); + +-- +2.43.0 + diff --git a/queue-6.1/platform-x86-intel_telemetry-fix-kernel-doc-descript.patch b/queue-6.1/platform-x86-intel_telemetry-fix-kernel-doc-descript.patch new file mode 100644 index 00000000000..7aae3dc0a2c --- /dev/null +++ b/queue-6.1/platform-x86-intel_telemetry-fix-kernel-doc-descript.patch @@ -0,0 +1,57 @@ +From 2cef39fda9c7ebdf5941863bcbb8c0289be247e7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Nov 2023 17:07:56 +0200 +Subject: platform/x86: intel_telemetry: Fix kernel doc descriptions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Andy Shevchenko + +[ Upstream commit a6584711e64d9d12ab79a450ec3628fd35e4f476 ] + +LKP found issues with a kernel doc in the driver: + +core.c:116: warning: Function parameter or member 'ioss_evtconfig' not described in 'telemetry_update_events' +core.c:188: warning: Function parameter or member 'ioss_evtconfig' not described in 'telemetry_get_eventconfig' + +It looks like it were copy'n'paste typos when these descriptions +had been introduced. Fix the typos. + +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202310070743.WALmRGSY-lkp@intel.com/ +Signed-off-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20231120150756.1661425-1-andriy.shevchenko@linux.intel.com +Reviewed-by: Rajneesh Bhardwaj +Reviewed-by: Ilpo Järvinen +Signed-off-by: Ilpo Järvinen +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/intel/telemetry/core.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/platform/x86/intel/telemetry/core.c b/drivers/platform/x86/intel/telemetry/core.c +index fdf55b5d69480..e4be40f73eebf 100644 +--- a/drivers/platform/x86/intel/telemetry/core.c ++++ b/drivers/platform/x86/intel/telemetry/core.c +@@ -102,7 +102,7 @@ static const struct telemetry_core_ops telm_defpltops = { + /** + * telemetry_update_events() - Update telemetry Configuration + * @pss_evtconfig: PSS related config. No change if num_evts = 0. +- * @pss_evtconfig: IOSS related config. No change if num_evts = 0. ++ * @ioss_evtconfig: IOSS related config. No change if num_evts = 0. + * + * This API updates the IOSS & PSS Telemetry configuration. Old config + * is overwritten. Call telemetry_reset_events when logging is over +@@ -176,7 +176,7 @@ EXPORT_SYMBOL_GPL(telemetry_reset_events); + /** + * telemetry_get_eventconfig() - Returns the pss and ioss events enabled + * @pss_evtconfig: Pointer to PSS related configuration. +- * @pss_evtconfig: Pointer to IOSS related configuration. ++ * @ioss_evtconfig: Pointer to IOSS related configuration. + * @pss_len: Number of u32 elements allocated for pss_evtconfig array + * @ioss_len: Number of u32 elements allocated for ioss_evtconfig array + * +-- +2.43.0 + diff --git a/queue-6.1/selftests-bpf-fix-bpf_loop_bench-for-new-callback-ve.patch b/queue-6.1/selftests-bpf-fix-bpf_loop_bench-for-new-callback-ve.patch new file mode 100644 index 00000000000..86db3221125 --- /dev/null +++ b/queue-6.1/selftests-bpf-fix-bpf_loop_bench-for-new-callback-ve.patch @@ -0,0 +1,88 @@ +From ec5d285061a83c0db7d84093e108cbe670ee458e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Nov 2023 04:06:53 +0200 +Subject: selftests/bpf: fix bpf_loop_bench for new callback verification + scheme +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Eduard Zingerman + +[ Upstream commit f40bfd1679446b22d321e64a1fa98b7d07d2be08 ] + +This is a preparatory change. A follow-up patch "bpf: verify callbacks +as if they are called unknown number of times" changes logic for +callbacks handling. While previously callbacks were verified as a +single function call, new scheme takes into account that callbacks +could be executed unknown number of times. + +This has dire implications for bpf_loop_bench: + + SEC("fentry/" SYS_PREFIX "sys_getpgid") + int benchmark(void *ctx) + { + for (int i = 0; i < 1000; i++) { + bpf_loop(nr_loops, empty_callback, NULL, 0); + __sync_add_and_fetch(&hits, nr_loops); + } + return 0; + } + +W/o callbacks change verifier sees it as a 1000 calls to +empty_callback(). However, with callbacks change things become +exponential: +- i=0: state exploring empty_callback is scheduled with i=0 (a); +- i=1: state exploring empty_callback is scheduled with i=1; + ... +- i=999: state exploring empty_callback is scheduled with i=999; +- state (a) is popped from stack; +- i=1: state exploring empty_callback is scheduled with i=1; + ... + +Avoid this issue by rewriting outer loop as bpf_loop(). +Unfortunately, this adds a function call to a loop at runtime, which +negatively affects performance: + + throughput latency + before: 149.919 ± 0.168 M ops/s, 6.670 ns/op + after : 137.040 ± 0.187 M ops/s, 7.297 ns/op + +Acked-by: Andrii Nakryiko +Signed-off-by: Eduard Zingerman +Link: https://lore.kernel.org/r/20231121020701.26440-4-eddyz87@gmail.com +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/bpf/progs/bpf_loop_bench.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/tools/testing/selftests/bpf/progs/bpf_loop_bench.c b/tools/testing/selftests/bpf/progs/bpf_loop_bench.c +index 4ce76eb064c41..d461746fd3c1e 100644 +--- a/tools/testing/selftests/bpf/progs/bpf_loop_bench.c ++++ b/tools/testing/selftests/bpf/progs/bpf_loop_bench.c +@@ -15,13 +15,16 @@ static int empty_callback(__u32 index, void *data) + return 0; + } + ++static int outer_loop(__u32 index, void *data) ++{ ++ bpf_loop(nr_loops, empty_callback, NULL, 0); ++ __sync_add_and_fetch(&hits, nr_loops); ++ return 0; ++} ++ + SEC("fentry/" SYS_PREFIX "sys_getpgid") + int benchmark(void *ctx) + { +- for (int i = 0; i < 1000; i++) { +- bpf_loop(nr_loops, empty_callback, NULL, 0); +- +- __sync_add_and_fetch(&hits, nr_loops); +- } ++ bpf_loop(1000, outer_loop, NULL, 0); + return 0; + } +-- +2.43.0 + diff --git a/queue-6.1/series b/queue-6.1/series index ca6842bf5a6..6d12cc43e7e 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -42,3 +42,30 @@ dpaa2-switch-do-not-ask-for-mdb-vlan-and-fdb-replay.patch net-stmmac-handle-disabled-mdio-busses-from-devicetr.patch appletalk-fix-use-after-free-in-atalk_ioctl.patch net-atlantic-fix-double-free-in-ring-reinit-logic.patch +drm-mediatek-add-spinlock-for-setting-vblank-event-i.patch +x86-hyperv-fix-the-detection-of-e820_type_pram-in-a-.patch +usb-aqc111-check-packet-for-fixup-for-true-limit.patch +stmmac-dwmac-loongson-add-architecture-dependency.patch +blk-throttle-fix-lockdep-warning-of-cgroup_mutex-or-.patch +blk-cgroup-bypass-blkcg_deactivate_policy-after-dest.patch +bcache-avoid-oversize-memory-allocation-by-small-str.patch +bcache-remove-redundant-assignment-to-variable-cur_i.patch +bcache-add-code-comments-for-bch_btree_node_get-and-.patch +bcache-avoid-null-checking-to-c-root-in-run_cache_se.patch +nbd-fold-nbd-config-initialization-into-nbd_alloc_co.patch +nvme-auth-unlock-mutex-in-one-place-only.patch +nvme-auth-set-explanation-code-for-failure2-msgs.patch +nvme-catch-errors-from-nvme_configure_metadata.patch +selftests-bpf-fix-bpf_loop_bench-for-new-callback-ve.patch +loongarch-add-dependency-between-vmlinuz.efi-and-vml.patch +loongarch-implement-constant-timer-shutdown-interfac.patch +platform-x86-intel_telemetry-fix-kernel-doc-descript.patch +hid-glorious-fix-glorious-model-i-hid-report.patch +hid-add-always_poll-quirk-for-apple-kb.patch +nbd-pass-nbd_sock-to-nbd_read_reply-instead-of-index.patch +hid-hid-asus-reset-the-backlight-brightness-level-on.patch +hid-multitouch-add-quirk-for-honor-glo-gxxx-touchpad.patch +asm-generic-qspinlock-fix-queued_spin_value_unlocked.patch +net-usb-qmi_wwan-claim-interface-4-for-zte-mf290.patch +arm64-add-dependency-between-vmlinuz.efi-and-image.patch +hid-hid-asus-add-const-to-read-only-outgoing-usb-buf.patch diff --git a/queue-6.1/stmmac-dwmac-loongson-add-architecture-dependency.patch b/queue-6.1/stmmac-dwmac-loongson-add-architecture-dependency.patch new file mode 100644 index 00000000000..7206a433ac9 --- /dev/null +++ b/queue-6.1/stmmac-dwmac-loongson-add-architecture-dependency.patch @@ -0,0 +1,39 @@ +From 229add71b0461e5019b087094b149a9806698cc3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Nov 2023 11:53:31 +0100 +Subject: stmmac: dwmac-loongson: Add architecture dependency + +From: Jean Delvare + +[ Upstream commit 7fbd5fc2b35a8f559a6b380dfa9bcd964a758186 ] + +Only present the DWMAC_LOONGSON option on architectures where it can +actually be used. + +This follows the same logic as the DWMAC_INTEL option. + +Signed-off-by: Jean Delvare +Cc: Keguang Zhang +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/stmicro/stmmac/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig +index 31ff351740342..58091ee2bfe60 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig ++++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig +@@ -256,7 +256,7 @@ config DWMAC_INTEL + config DWMAC_LOONGSON + tristate "Loongson PCI DWMAC support" + default MACH_LOONGSON64 +- depends on STMMAC_ETH && PCI ++ depends on (MACH_LOONGSON64 || COMPILE_TEST) && STMMAC_ETH && PCI + depends on COMMON_CLK + help + This selects the LOONGSON PCI bus support for the stmmac driver, +-- +2.43.0 + diff --git a/queue-6.1/usb-aqc111-check-packet-for-fixup-for-true-limit.patch b/queue-6.1/usb-aqc111-check-packet-for-fixup-for-true-limit.patch new file mode 100644 index 00000000000..afdaf983a8e --- /dev/null +++ b/queue-6.1/usb-aqc111-check-packet-for-fixup-for-true-limit.patch @@ -0,0 +1,58 @@ +From 10a38fd06500bbc08db9ba226a2e96f8549b54b3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Nov 2023 11:08:57 +0100 +Subject: usb: aqc111: check packet for fixup for true limit + +From: Oliver Neukum + +[ Upstream commit ccab434e674ca95d483788b1895a70c21b7f016a ] + +If a device sends a packet that is inbetween 0 +and sizeof(u64) the value passed to skb_trim() +as length will wrap around ending up as some very +large value. + +The driver will then proceed to parse the header +located at that position, which will either oops or +process some random value. + +The fix is to check against sizeof(u64) rather than +0, which the driver currently does. The issue exists +since the introduction of the driver. + +Signed-off-by: Oliver Neukum +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/usb/aqc111.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c +index a017e9de2119d..7b8afa589a53c 100644 +--- a/drivers/net/usb/aqc111.c ++++ b/drivers/net/usb/aqc111.c +@@ -1079,17 +1079,17 @@ static int aqc111_rx_fixup(struct usbnet *dev, struct sk_buff *skb) + u16 pkt_count = 0; + u64 desc_hdr = 0; + u16 vlan_tag = 0; +- u32 skb_len = 0; ++ u32 skb_len; + + if (!skb) + goto err; + +- if (skb->len == 0) ++ skb_len = skb->len; ++ if (skb_len < sizeof(desc_hdr)) + goto err; + +- skb_len = skb->len; + /* RX Descriptor Header */ +- skb_trim(skb, skb->len - sizeof(desc_hdr)); ++ skb_trim(skb, skb_len - sizeof(desc_hdr)); + desc_hdr = le64_to_cpup((u64 *)skb_tail_pointer(skb)); + + /* Check these packets */ +-- +2.43.0 + diff --git a/queue-6.1/x86-hyperv-fix-the-detection-of-e820_type_pram-in-a-.patch b/queue-6.1/x86-hyperv-fix-the-detection-of-e820_type_pram-in-a-.patch new file mode 100644 index 00000000000..95a025c4781 --- /dev/null +++ b/queue-6.1/x86-hyperv-fix-the-detection-of-e820_type_pram-in-a-.patch @@ -0,0 +1,92 @@ +From 69fcbf202e353f55fb23fd0b733bb716bdba83c3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 11 Nov 2023 00:37:47 -0800 +Subject: x86/hyperv: Fix the detection of E820_TYPE_PRAM in a Gen2 VM + +From: Saurabh Sengar + +[ Upstream commit 7e8037b099c0bbe8f2109dc452dbcab8d400fc53 ] + +A Gen2 VM doesn't support legacy PCI/PCIe, so both raw_pci_ops and +raw_pci_ext_ops are NULL, and pci_subsys_init() -> pcibios_init() +doesn't call pcibios_resource_survey() -> e820__reserve_resources_late(); +as a result, any emulated persistent memory of E820_TYPE_PRAM (12) via +the kernel parameter memmap=nn[KMG]!ss is not added into iomem_resource +and hence can't be detected by register_e820_pmem(). + +Fix this by directly calling e820__reserve_resources_late() in +hv_pci_init(), which is called from arch_initcall(pci_arch_init). + +It's ok to move a Gen2 VM's e820__reserve_resources_late() from +subsys_initcall(pci_subsys_init) to arch_initcall(pci_arch_init) because +the code in-between doesn't depend on the E820 resources. +e820__reserve_resources_late() depends on e820__reserve_resources(), +which has been called earlier from setup_arch(). + +For a Gen-2 VM, the new hv_pci_init() also adds any memory of +E820_TYPE_PMEM (7) into iomem_resource, and acpi_nfit_register_region() -> +acpi_nfit_insert_resource() -> region_intersects() returns +REGION_INTERSECTS, so the memory of E820_TYPE_PMEM won't get added twice. + +Changed the local variable "int gen2vm" to "bool gen2vm". + +Signed-off-by: Saurabh Sengar +Signed-off-by: Dexuan Cui +Signed-off-by: Wei Liu +Message-ID: <1699691867-9827-1-git-send-email-ssengar@linux.microsoft.com> +Signed-off-by: Sasha Levin +--- + arch/x86/hyperv/hv_init.c | 25 +++++++++++++++++++++---- + 1 file changed, 21 insertions(+), 4 deletions(-) + +diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c +index 189ae92de4d06..c18e5c764643b 100644 +--- a/arch/x86/hyperv/hv_init.c ++++ b/arch/x86/hyperv/hv_init.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -267,15 +268,31 @@ static int hv_cpu_die(unsigned int cpu) + + static int __init hv_pci_init(void) + { +- int gen2vm = efi_enabled(EFI_BOOT); ++ bool gen2vm = efi_enabled(EFI_BOOT); + + /* +- * For Generation-2 VM, we exit from pci_arch_init() by returning 0. +- * The purpose is to suppress the harmless warning: ++ * A Generation-2 VM doesn't support legacy PCI/PCIe, so both ++ * raw_pci_ops and raw_pci_ext_ops are NULL, and pci_subsys_init() -> ++ * pcibios_init() doesn't call pcibios_resource_survey() -> ++ * e820__reserve_resources_late(); as a result, any emulated persistent ++ * memory of E820_TYPE_PRAM (12) via the kernel parameter ++ * memmap=nn[KMG]!ss is not added into iomem_resource and hence can't be ++ * detected by register_e820_pmem(). Fix this by directly calling ++ * e820__reserve_resources_late() here: e820__reserve_resources_late() ++ * depends on e820__reserve_resources(), which has been called earlier ++ * from setup_arch(). Note: e820__reserve_resources_late() also adds ++ * any memory of E820_TYPE_PMEM (7) into iomem_resource, and ++ * acpi_nfit_register_region() -> acpi_nfit_insert_resource() -> ++ * region_intersects() returns REGION_INTERSECTS, so the memory of ++ * E820_TYPE_PMEM won't get added twice. ++ * ++ * We return 0 here so that pci_arch_init() won't print the warning: + * "PCI: Fatal: No config space access function found" + */ +- if (gen2vm) ++ if (gen2vm) { ++ e820__reserve_resources_late(); + return 0; ++ } + + /* For Generation-1 VM, we'll proceed in pci_arch_init(). */ + return 1; +-- +2.43.0 + -- 2.47.3