diff --git a/blacklist.conf b/blacklist.conf index d9b93b2..04e9c43 100644 --- a/blacklist.conf +++ b/blacklist.conf @@ -333,7 +333,6 @@ c7211ff3be0fa98a55920f876608cc9e13c9eb5f # backport of 319a1d19471e doesn't cont a62bd63893027bfa32fccbba0e0ac067824c362c # ASoC: already cherry-picked 39a963b457b5c6cbbdc70441c9d496e39d151582 # duplicate of 82af5b6609673f1cc7d3453d0be3d292dfffc813 90670f0ef690f9c8712f236e8cf14c156c9a6365 # defconfig patch -ac65bdfef14a902b40ff69a35f5c604dba096547 # Duplicate of 09c5ab384f6fb30f834a5777888b4486dd7f015d: drm/i915: Keep rings pinned while the context is active f9a393875d3af13cc3267477746608dadb7f17c1 # Duplicate of 248f883db61283b4f5a1c92a5e27277377b09f16: drm/i915: Disable SAMPLER_STATE prefetching on all Gen11 steppings. 8dcfdfb4501012a8d36d2157dc73925715f2befb # Duplicate of 95eef14cdad150fed43147bcd4f29eea3d0a3f03: drm/i915/perf: fix ICL perf register offsets 4c888e7bd26f58deb27c2e6ddc90000b89ee9393 # Duplicate of 7d3cd66261665da491d0ee582beabe23df60f983: drm/i915: Fix various tracepoints for gen2 @@ -1088,9 +1087,6 @@ e81e0724432542af8d8c702c31e9d82f57b1ff31 # clang-specific e272f7ec070d212b9301d5a465bc8952f8dcf908 # gpio: driver gets removed later a7480c5d725c4ecfc627e70960f249c34f5d13e8 # riscv patch ffedeeb780dc554eff3d3b16e6a462a26a41d7ec # not needed in SLE -39a7661dcf655c8198fd5d72412f5030a8e58444 # Duplicate of 1e5504656e5a78d096fe59a880fe2a9eb75f50e3 -0f5cef2b2904b8d41d34ecb6c5d5bf2f00562b1b # Duplicate of 200bbb88b76c0f420ba5b537005ec0c0a5511b4e -80624263fa289b3416f7ca309491f1b75e579477 # Duplicate of 05a2c5820555b58d882bf5037d6739189a0c1b33 f97bb5272d9e95d400d6c8643ebb146b3e3e7842 # Fix is not KABI safe, alternative merged 3347acc6fcd4ee71ad18a9ff9d9dac176b517329 # Kernel building with clang is not supported a7c46c0c0e3d62f2764cd08b90934cd2aaaf8545 # GUP benchmark not enabled in Kconfig @@ -1176,3 +1172,10 @@ e400071a805d6229223a98899e9da8c6233704a1 # hid-logitech-dj: doesn't work as adve b7ccc7858a33ddb3c5516f39b104a9156957c8bb # we did the correct merge so problem doesn't exist bee1abc9cc021f50b90f22a589d9ddc816a80db0 # not applicable 4a601f109614929aee45e58ca3514ec93da070bb # net: mscc: ocelot: not needed +d0995b53130eaa6a458780179c50489b933ea31a # f2f2 documentation update +67197a4f28d28d0b073ab0427b03cb2ee5382578 # unnecessary optimization, bsc#1182660 +8faeb1ffd79593c9cd8a2a80ecdda371e3b826cb # indefinite stat error reduction only, bsc#1182671 +d0995b53130eaa6a458780179c50489b933ea31a # f2f2 documentation update +179d1600723670dc0d6ae8ce572e0e2c44b64763 # cleanup conly +c7ff651960a6ef11cef55479658aff504c34872f # cosmetic +09c5ab384f6fb30f834a5777888b4486dd7f015d # Duplicate of ac65bdfef14a902b40ff69a35f5c604dba096547: drm/i915: Keep rings pinned while the context is active diff --git a/config/arm64/default b/config/arm64/default index e40c2f3..6088c6c 100644 --- a/config/arm64/default +++ b/config/arm64/default @@ -8488,6 +8488,7 @@ CONFIG_COMMON_CLK_SI544=m CONFIG_COMMON_CLK_CDCE706=m CONFIG_COMMON_CLK_CDCE925=m CONFIG_COMMON_CLK_CS2000_CP=m +CONFIG_COMMON_CLK_FSL_FLEXSPI=m CONFIG_COMMON_CLK_FSL_SAI=y CONFIG_CLK_QORIQ=y CONFIG_CLK_LS1028A_PLLDIG=m @@ -10714,6 +10715,7 @@ CONFIG_LOCK_DEBUGGING_SUPPORT=y # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_LOCK_TORTURE_TEST is not set # CONFIG_WW_MUTEX_SELFTEST is not set +# CONFIG_CSD_LOCK_WAIT_DEBUG is not set # end of Lock Debugging (spinlocks, mutexes, etc...) CONFIG_STACKTRACE=y @@ -10873,6 +10875,7 @@ CONFIG_CORESIGHT_CATU=m CONFIG_CORESIGHT_SINK_TPIU=m CONFIG_CORESIGHT_SINK_ETBV10=m CONFIG_CORESIGHT_SOURCE_ETM4X=m +CONFIG_ETM4X_IMPDEF_FEATURE=y CONFIG_CORESIGHT_STM=m CONFIG_CORESIGHT_CPU_DEBUG=m CONFIG_CORESIGHT_CTI=m diff --git a/config/ppc64le/default b/config/ppc64le/default index f4378da..5e36ebd 100644 --- a/config/ppc64le/default +++ b/config/ppc64le/default @@ -6171,6 +6171,7 @@ CONFIG_LOCK_DEBUGGING_SUPPORT=y # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_LOCK_TORTURE_TEST is not set # CONFIG_WW_MUTEX_SELFTEST is not set +# CONFIG_CSD_LOCK_WAIT_DEBUG is not set # end of Lock Debugging (spinlocks, mutexes, etc...) CONFIG_STACKTRACE=y diff --git a/config/s390x/default b/config/s390x/default index 82a398a..4e7c1b8 100644 --- a/config/s390x/default +++ b/config/s390x/default @@ -3940,6 +3940,7 @@ CONFIG_LOCK_DEBUGGING_SUPPORT=y # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_LOCK_TORTURE_TEST is not set # CONFIG_WW_MUTEX_SELFTEST is not set +# CONFIG_CSD_LOCK_WAIT_DEBUG is not set # end of Lock Debugging (spinlocks, mutexes, etc...) CONFIG_STACKTRACE=y diff --git a/config/s390x/zfcpdump b/config/s390x/zfcpdump index 29ba54d..8d46add 100644 --- a/config/s390x/zfcpdump +++ b/config/s390x/zfcpdump @@ -1415,6 +1415,7 @@ CONFIG_LOCK_DEBUGGING_SUPPORT=y # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_LOCK_TORTURE_TEST is not set # CONFIG_WW_MUTEX_SELFTEST is not set +# CONFIG_CSD_LOCK_WAIT_DEBUG is not set # end of Lock Debugging (spinlocks, mutexes, etc...) CONFIG_STACKTRACE=y diff --git a/config/x86_64/default b/config/x86_64/default index f2247fb..85fa34f 100644 --- a/config/x86_64/default +++ b/config/x86_64/default @@ -9642,6 +9642,7 @@ CONFIG_LOCK_DEBUGGING_SUPPORT=y # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_LOCK_TORTURE_TEST is not set # CONFIG_WW_MUTEX_SELFTEST is not set +CONFIG_CSD_LOCK_WAIT_DEBUG=y # end of Lock Debugging (spinlocks, mutexes, etc...) CONFIG_STACKTRACE=y diff --git a/patches.suse/0001-dm-crypt-document-new-no_workqueue-flags.patch b/patches.suse/0001-dm-crypt-document-new-no_workqueue-flags.patch new file mode 100644 index 0000000..41681b0 --- /dev/null +++ b/patches.suse/0001-dm-crypt-document-new-no_workqueue-flags.patch @@ -0,0 +1,45 @@ +From 4a5caa4af0df5cd8f1c7f0c2f871d382662b022e Mon Sep 17 00:00:00 2001 +From: Milan Broz +Date: Thu, 20 Aug 2020 19:45:38 +0200 +Subject: [PATCH] dm crypt: document new no_workqueue flags +Git-commit: 4a5caa4af0df5cd8f1c7f0c2f871d382662b022e +Patch-mainline: v5.9-rc7 +References: git-fixes + +Commit 39d42fa96ba1 ("dm crypt: add flags to optionally bypass kcryptd +workqueues") introduced new dm-crypt 'no_read_workqueue' and +'no_write_workqueue' flags. + +Add documentation to admin guide for them. + +Fixes: 39d42fa96ba1 ("dm crypt: add flags to optionally bypass kcryptd workqueues") +Signed-off-by: Milan Broz +Signed-off-by: Mike Snitzer +Signed-off-by: Coly Li + +--- + Documentation/admin-guide/device-mapper/dm-crypt.rst | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/Documentation/admin-guide/device-mapper/dm-crypt.rst b/Documentation/admin-guide/device-mapper/dm-crypt.rst +index 8f4a3f889d43..40dc2df58cd5 100644 +--- a/Documentation/admin-guide/device-mapper/dm-crypt.rst ++++ b/Documentation/admin-guide/device-mapper/dm-crypt.rst +@@ -121,6 +121,14 @@ submit_from_crypt_cpus + thread because it benefits CFQ to have writes submitted using the + same context. + ++no_read_workqueue ++ Bypass dm-crypt internal workqueue and process read requests synchronously. ++ ++no_write_workqueue ++ Bypass dm-crypt internal workqueue and process write requests synchronously. ++ This option is automatically enabled for host-managed zoned block devices ++ (e.g. host-managed SMR hard-disks). ++ + integrity:: + The device requires additional metadata per-sector stored + in per-bio integrity structure. This metadata must by provided +-- +2.26.2 + diff --git a/patches.suse/0001-drm-i915-gem-Support-parsing-of-oversize-batches.patch b/patches.suse/0001-drm-i915-gem-Support-parsing-of-oversize-batches.patch new file mode 100644 index 0000000..9e583ee --- /dev/null +++ b/patches.suse/0001-drm-i915-gem-Support-parsing-of-oversize-batches.patch @@ -0,0 +1,74 @@ +From d5e8782129c22036425f29f9b6a254895482d7bd Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Thu, 15 Oct 2020 12:59:54 +0100 +Subject: drm/i915/gem: Support parsing of oversize batches +Git-commit: d5e8782129c22036425f29f9b6a254895482d7bd +Patch-mainline: v5.10-rc1 +References: bsc#1152489 + +Matthew Auld noted that on more recent systems (such as the parser for +gen9) we may have objects that are larger than expected by the GEM uAPI +(i.e. greater than u32). These objects would have incorrect implicit +batch lengths, causing the parser to reject them for being incomplete, +or worse. + +Based on a patch by Matthew Auld. + +Reported-by: Matthew Auld +Fixes: 435e8fc059db ("drm/i915: Allow parsing of unsized batches") +Testcase: igt/gem_exec_params/larger-than-life-batch +Signed-off-by: Chris Wilson +Cc: Matthew Auld +Cc: Mika Kuoppala +Cc: Jon Bloomfield +Reviewed-by: Matthew Auld +Cc: stable@vger.kernel.org +Link: https://patchwork.freedesktop.org/patch/msgid/20201015115954.871-1-chris@chris-wilson.co.uk +(cherry picked from commit 57b2d834bf235daab388c3ba12d035c820ae09c6) +Signed-off-by: Rodrigo Vivi +Acked-by: Thomas Zimmermann +--- + drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +@@ -278,8 +278,8 @@ struct i915_execbuffer { + u64 invalid_flags; /** Set of execobj.flags that are invalid */ + u32 context_flags; /** Set of execobj.flags to insert from the ctx */ + ++ u64 batch_len; /** Length of batch within object */ + u32 batch_start_offset; /** Location within object of batch */ +- u32 batch_len; /** Length of batch within object */ + u32 batch_flags; /** Flags composed for emit_bb_start() */ + + /** +@@ -2114,7 +2114,7 @@ static int eb_parse(struct i915_execbuff + struct drm_i915_private *i915 = eb->i915; + struct intel_gt_buffer_pool_node *pool; + struct i915_vma *shadow, *trampoline; +- unsigned int len; ++ unsigned long len; + int err; + + if (!eb_use_cmdparser(eb)) +@@ -2134,6 +2134,8 @@ static int eb_parse(struct i915_execbuff + } else { + len += I915_CMD_PARSER_TRAMPOLINE_SIZE; + } ++ if (unlikely(len < eb->batch_len)) /* last paranoid check of overflow */ ++ return -EINVAL; + + pool = intel_gt_get_buffer_pool(eb->engine->gt, len); + if (IS_ERR(pool)) +@@ -2757,6 +2759,10 @@ i915_gem_do_execbuffer(struct drm_device + + if (eb.batch_len == 0) + eb.batch_len = eb.batch->vma->size - eb.batch_start_offset; ++ if (unlikely(eb.batch_len == 0)) { /* impossible! */ ++ drm_dbg(&i915->drm, "Invalid batch length\n"); ++ return -EINVAL; ++ } + + err = eb_parse(&eb); + if (err) diff --git a/patches.suse/0001-efi-tpm-Verify-event-log-header-before-parsing.patch b/patches.suse/0001-efi-tpm-Verify-event-log-header-before-parsing.patch index 0e27f85..2b10bdd 100644 --- a/patches.suse/0001-efi-tpm-Verify-event-log-header-before-parsing.patch +++ b/patches.suse/0001-efi-tpm-Verify-event-log-header-before-parsing.patch @@ -4,7 +4,7 @@ Date: Mon, 15 Jun 2020 09:16:36 +0200 Subject: [PATCH] efi/tpm: Verify event log header before parsing Git-commit: 7dfc06a0f25b593a9f51992f540c0f80a57f3629 Patch-mainline: v5.8-rc3 -References: bsc#1173461 +References: bsc#1165773 It is possible that the first event in the event log is not actually a log header at all, but rather a normal event. This leads to the cast in diff --git a/patches.suse/0001-include-linux-memremap.h-remove-stale-comments.patch b/patches.suse/0001-include-linux-memremap.h-remove-stale-comments.patch new file mode 100644 index 0000000..a79f01e --- /dev/null +++ b/patches.suse/0001-include-linux-memremap.h-remove-stale-comments.patch @@ -0,0 +1,39 @@ +From 1d90b6491014ead775146726b81a78ed993c3188 Mon Sep 17 00:00:00 2001 +From: Ira Weiny +Date: Mon, 6 Apr 2020 20:08:46 -0700 +Subject: [PATCH] include/linux/memremap.h: remove stale comments +Git-commit: 1d90b6491014ead775146726b81a78ed993c3188 +Patch-mainline: v5.7-rc1 +References: git-fixes + +Fixes: 80a72d0af05a ("memremap: remove the data field in struct dev_pagemap") +Fixes: fdc029b19dfd ("memremap: remove the dev field in struct dev_pagemap") +Signed-off-by: Ira Weiny +Signed-off-by: Andrew Morton +Reviewed-by: Christoph Hellwig +Cc: Jason Gunthorpe +Cc: Dan Williams +Link: http://lkml.kernel.org/r/20200316213205.145333-1-ira.weiny@intel.com +Signed-off-by: Linus Torvalds +Signed-off-by: Coly Li + +--- + include/linux/memremap.h | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/include/linux/memremap.h b/include/linux/memremap.h +index 60d97e8fd3c0..8b37c4c9222c 100644 +--- a/include/linux/memremap.h ++++ b/include/linux/memremap.h +@@ -98,8 +98,6 @@ struct dev_pagemap_ops { + * @ref: reference count that pins the devm_memremap_pages() mapping + * @internal_ref: internal reference if @ref is not provided by the caller + * @done: completion for @internal_ref +- * @dev: host device of the mapping for debug +- * @data: private data pointer for page_free() + * @type: memory type: see MEMORY_* in memory_hotplug.h + * @flags: PGMAP_* flags to specify defailed behavior + * @ops: method table +-- +2.26.2 + diff --git a/patches.suse/0002-bcache-check-c-root-with-IS_ERR_OR_NULL-in-mca_reser.patch b/patches.suse/0002-bcache-check-c-root-with-IS_ERR_OR_NULL-in-mca_reser.patch new file mode 100644 index 0000000..321fc01 --- /dev/null +++ b/patches.suse/0002-bcache-check-c-root-with-IS_ERR_OR_NULL-in-mca_reser.patch @@ -0,0 +1,59 @@ +From 7e59c506c338d1e42ed19f24f1a737aff8b18fc3 Mon Sep 17 00:00:00 2001 +From: Dongsheng Yang +Date: Thu, 1 Oct 2020 14:50:43 +0800 +Subject: [PATCH] bcache: check c->root with IS_ERR_OR_NULL() in mca_reserve() +Git-commit: 7e59c506c338d1e42ed19f24f1a737aff8b18fc3 +Patch-mainline: v5.10-rc1 +References: git-fixes + +In mca_reserve(c) macro, we are checking root whether is NULL or not. +But that's not enough, when we read the root node in run_cache_set(), +if we got an error in bch_btree_node_read_done(), we will return +ERR_PTR(-EIO) to c->root. + +And then we will go continue to unregister, but before calling +unregister_shrinker(&c->shrink), there is a possibility to call +bch_mca_count(), and we would get a crash with call trace like that: + +[ 2149.876008] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000b5 +... ... +[ 2150.598931] Call trace: +[ 2150.606439] bch_mca_count+0x58/0x98 [escache] +[ 2150.615866] do_shrink_slab+0x54/0x310 +[ 2150.624429] shrink_slab+0x248/0x2d0 +[ 2150.632633] drop_slab_node+0x54/0x88 +[ 2150.640746] drop_slab+0x50/0x88 +[ 2150.648228] drop_caches_sysctl_handler+0xf0/0x118 +[ 2150.657219] proc_sys_call_handler.isra.18+0xb8/0x110 +[ 2150.666342] proc_sys_write+0x40/0x50 +[ 2150.673889] __vfs_write+0x48/0x90 +[ 2150.681095] vfs_write+0xac/0x1b8 +[ 2150.688145] ksys_write+0x6c/0xd0 +[ 2150.695127] __arm64_sys_write+0x24/0x30 +[ 2150.702749] el0_svc_handler+0xa0/0x128 +[ 2150.710296] el0_svc+0x8/0xc + +Signed-off-by: Dongsheng Yang +Signed-off-by: Coly Li +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/btree.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c +index 3d8bd0692af3..ae7611fa42bf 100644 +--- a/drivers/md/bcache/btree.c ++++ b/drivers/md/bcache/btree.c +@@ -514,7 +514,7 @@ static void bch_btree_leaf_dirty(struct btree *b, atomic_t *journal_ref) + * mca -> memory cache + */ + +-#define mca_reserve(c) (((c->root && c->root->level) \ ++#define mca_reserve(c) (((!IS_ERR_OR_NULL(c->root) && c->root->level) \ + ? c->root->level : 1) * 8 + 16) + #define mca_can_free(c) \ + max_t(int, 0, c->btree_cache_used - mca_reserve(c)) +-- +2.26.2 + diff --git a/patches.suse/0002-can-flexcan-fix-possible-deadlock-and-out-of-order-r.patch b/patches.suse/0002-can-flexcan-fix-possible-deadlock-and-out-of-order-r.patch index 0d844b5..18c8116 100644 --- a/patches.suse/0002-can-flexcan-fix-possible-deadlock-and-out-of-order-r.patch +++ b/patches.suse/0002-can-flexcan-fix-possible-deadlock-and-out-of-order-r.patch @@ -1,10 +1,11 @@ -From e707180ae2df1c87e26ec7a6fd70d07483bde7fd Mon Sep 17 00:00:00 2001 From: Sean Nyekjaer Date: Wed, 4 Dec 2019 11:36:06 +0000 -Subject: [PATCH] can: flexcan: fix possible deadlock and out-of-order reception after wakeup +Subject: can: flexcan: fix possible deadlock and out-of-order reception after + wakeup + Git-commit: e707180ae2df1c87e26ec7a6fd70d07483bde7fd Patch-mainline: v5.5-rc3 -References: git-fixes +References: jsc#SLE-12251 When suspending, and there is still CAN traffic on the interfaces the flexcan immediately wakes the platform again. As it should :-). But it @@ -45,15 +46,16 @@ Tested-by: Sean Nyekjaer Signed-off-by: Joakim Zhang Cc: linux-stable # >= v5.0 Signed-off-by: Marc Kleine-Budde -Acked-by: Takashi Iwai - +Signed-off-by: Mian Yousaf Kaukab --- - drivers/net/can/flexcan.c | 10 ++++------ + drivers/net/can/flexcan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index a929cdda9ab2..b6f675a5e2d9 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c -@@ -1667,6 +1667,9 @@ static int __maybe_unused flexcan_resume +@@ -1722,6 +1722,9 @@ static int __maybe_unused flexcan_resume(struct device *device) netif_start_queue(dev); if (device_may_wakeup(device)) { disable_irq_wake(dev->irq); @@ -61,9 +63,9 @@ Acked-by: Takashi Iwai + if (err) + return err; } else { - err = flexcan_chip_enable(priv); + err = pm_runtime_force_resume(device); if (err) -@@ -1691,14 +1694,9 @@ static int __maybe_unused flexcan_noirq_ +@@ -1767,14 +1770,9 @@ static int __maybe_unused flexcan_noirq_resume(struct device *device) { struct net_device *dev = dev_get_drvdata(device); struct flexcan_priv *priv = netdev_priv(dev); @@ -79,3 +81,6 @@ Acked-by: Takashi Iwai return 0; } +-- +2.26.2 + diff --git a/patches.suse/0002-dm-crypt-avoid-truncating-the-logical-block-size.patch b/patches.suse/0002-dm-crypt-avoid-truncating-the-logical-block-size.patch new file mode 100644 index 0000000..06624f2 --- /dev/null +++ b/patches.suse/0002-dm-crypt-avoid-truncating-the-logical-block-size.patch @@ -0,0 +1,37 @@ +From: Eric Biggers +Date: Thu, 4 Jun 2020 12:01:26 -0700 +Subject: [PATCH] dm crypt: avoid truncating the logical block size +Git-commit: 64611a15ca9da91ff532982429c44686f4593b5f +Patch-mainline: v5.8-rc1 +References: bsc#1175995,jsc#SLE-15608 + +queue_limits::logical_block_size got changed from unsigned short to +unsigned int, but it was forgotten to update crypt_io_hints() to use the +new type. Fix it. + +Fixes: ad6bf88a6c19 ("block: fix an integer overflow in logical block size") +Cc: stable@vger.kernel.org +Signed-off-by: Eric Biggers +Reviewed-by: Mikulas Patocka +Signed-off-by: Mike Snitzer +Acked-by: Hannes Reinecke +--- + drivers/md/dm-crypt.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c +index 71c651465bdd..000ddfab5ba0 100644 +--- a/drivers/md/dm-crypt.c ++++ b/drivers/md/dm-crypt.c +@@ -3312,7 +3312,7 @@ static void crypt_io_hints(struct dm_target *ti, struct queue_limits *limits) + limits->max_segment_size = PAGE_SIZE; + + limits->logical_block_size = +- max_t(unsigned short, limits->logical_block_size, cc->sector_size); ++ max_t(unsigned, limits->logical_block_size, cc->sector_size); + limits->physical_block_size = + max_t(unsigned, limits->physical_block_size, cc->sector_size); + limits->io_min = max_t(unsigned, limits->io_min, cc->sector_size); +-- +2.16.4 + diff --git a/patches.suse/0003-bcache-fix-overflow-in-offset_to_stripe.patch b/patches.suse/0003-bcache-fix-overflow-in-offset_to_stripe.patch new file mode 100644 index 0000000..42a90ff --- /dev/null +++ b/patches.suse/0003-bcache-fix-overflow-in-offset_to_stripe.patch @@ -0,0 +1,143 @@ +From 7a1481267999c02abf4a624515c1b5c7c1fccbd6 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Sat, 25 Jul 2020 20:00:22 +0800 +Subject: [PATCH] bcache: fix overflow in offset_to_stripe() +Git-commit: 7a1481267999c02abf4a624515c1b5c7c1fccbd6 +Patch-mainline: v5.9-rc1 +References: bsc#1175995, jsc#SLE-15608 + +offset_to_stripe() returns the stripe number (in type unsigned int) from +an offset (in type uint64_t) by the following calculation, + do_div(offset, d->stripe_size); +For large capacity backing device (e.g. 18TB) with small stripe size +(e.g. 4KB), the result is 4831838208 and exceeds UINT_MAX. The actual +returned value which caller receives is 536870912, due to the overflow. + +Indeed in bcache_device_init(), bcache_device->nr_stripes is limited in +range [1, INT_MAX]. Therefore all valid stripe numbers in bcache are +in range [0, bcache_dev->nr_stripes - 1]. + +This patch adds a upper limition check in offset_to_stripe(): the max +valid stripe number should be less than bcache_device->nr_stripes. If +the calculated stripe number from do_div() is equal to or larger than +bcache_device->nr_stripe, -EINVAL will be returned. (Normally nr_stripes +is less than INT_MAX, exceeding upper limitation doesn't mean overflow, +therefore -EOVERFLOW is not used as error code.) + +This patch also changes nr_stripes' type of struct bcache_device from +'unsigned int' to 'int', and return value type of offset_to_stripe() +from 'unsigned int' to 'int', to match their exact data ranges. + +All locations where bcache_device->nr_stripes and offset_to_stripe() are +referenced also get updated for the above type change. + +Reported-and-tested-by: Ken Raeburn +Signed-off-by: Coly Li +Cc: stable@vger.kernel.org +Link: https://bugzilla.redhat.com/show_bug.cgi?id=1783075 +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/bcache.h | 2 +- + drivers/md/bcache/writeback.c | 14 +++++++++----- + drivers/md/bcache/writeback.h | 19 +++++++++++++++++-- + 3 files changed, 27 insertions(+), 8 deletions(-) + +diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h +index 3c708e8b5e2d..2d1743c0217a 100644 +--- a/drivers/md/bcache/bcache.h ++++ b/drivers/md/bcache/bcache.h +@@ -264,7 +264,7 @@ struct bcache_device { + #define BCACHE_DEV_UNLINK_DONE 2 + #define BCACHE_DEV_WB_RUNNING 3 + #define BCACHE_DEV_RATE_DW_RUNNING 4 +- unsigned int nr_stripes; ++ int nr_stripes; + unsigned int stripe_size; + atomic_t *stripe_sectors_dirty; + unsigned long *full_dirty_stripes; +diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c +index 5397a2c5d6cc..4f4ad6b3d43a 100644 +--- a/drivers/md/bcache/writeback.c ++++ b/drivers/md/bcache/writeback.c +@@ -521,15 +521,19 @@ void bcache_dev_sectors_dirty_add(struct cache_set *c, unsigned int inode, + uint64_t offset, int nr_sectors) + { + struct bcache_device *d = c->devices[inode]; +- unsigned int stripe_offset, stripe, sectors_dirty; ++ unsigned int stripe_offset, sectors_dirty; ++ int stripe; + + if (!d) + return; + ++ stripe = offset_to_stripe(d, offset); ++ if (stripe < 0) ++ return; ++ + if (UUID_FLASH_ONLY(&c->uuids[inode])) + atomic_long_add(nr_sectors, &c->flash_dev_dirty_sectors); + +- stripe = offset_to_stripe(d, offset); + stripe_offset = offset & (d->stripe_size - 1); + + while (nr_sectors) { +@@ -569,12 +573,12 @@ static bool dirty_pred(struct keybuf *buf, struct bkey *k) + static void refill_full_stripes(struct cached_dev *dc) + { + struct keybuf *buf = &dc->writeback_keys; +- unsigned int start_stripe, stripe, next_stripe; ++ unsigned int start_stripe, next_stripe; ++ int stripe; + bool wrapped = false; + + stripe = offset_to_stripe(&dc->disk, KEY_OFFSET(&buf->last_scanned)); +- +- if (stripe >= dc->disk.nr_stripes) ++ if (stripe < 0) + stripe = 0; + + start_stripe = stripe; +diff --git a/drivers/md/bcache/writeback.h b/drivers/md/bcache/writeback.h +index b029843ce5b6..3f1230e22de0 100644 +--- a/drivers/md/bcache/writeback.h ++++ b/drivers/md/bcache/writeback.h +@@ -52,10 +52,22 @@ static inline uint64_t bcache_dev_sectors_dirty(struct bcache_device *d) + return ret; + } + +-static inline unsigned int offset_to_stripe(struct bcache_device *d, ++static inline int offset_to_stripe(struct bcache_device *d, + uint64_t offset) + { + do_div(offset, d->stripe_size); ++ ++ /* d->nr_stripes is in range [1, INT_MAX] */ ++ if (unlikely(offset >= d->nr_stripes)) { ++ pr_err("Invalid stripe %llu (>= nr_stripes %d).\n", ++ offset, d->nr_stripes); ++ return -EINVAL; ++ } ++ ++ /* ++ * Here offset is definitly smaller than INT_MAX, ++ * return it as int will never overflow. ++ */ + return offset; + } + +@@ -63,7 +75,10 @@ static inline bool bcache_dev_stripe_dirty(struct cached_dev *dc, + uint64_t offset, + unsigned int nr_sectors) + { +- unsigned int stripe = offset_to_stripe(&dc->disk, offset); ++ int stripe = offset_to_stripe(&dc->disk, offset); ++ ++ if (stripe < 0) ++ return false; + + while (1) { + if (atomic_read(dc->disk.stripe_sectors_dirty + stripe)) +-- +2.26.2 + diff --git a/patches.suse/0003-bcache-remove-int-n-from-parameter-list-of-bch_bucke.patch b/patches.suse/0003-bcache-remove-int-n-from-parameter-list-of-bch_bucke.patch new file mode 100644 index 0000000..c9220a8 --- /dev/null +++ b/patches.suse/0003-bcache-remove-int-n-from-parameter-list-of-bch_bucke.patch @@ -0,0 +1,157 @@ +From 17e4aed8309ff28670271546c2c3263eb12f5eb6 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Thu, 1 Oct 2020 14:50:45 +0800 +Subject: [PATCH] bcache: remove 'int n' from parameter list of + bch_bucket_alloc_set() +Git-commit: 17e4aed8309ff28670271546c2c3263eb12f5eb6 +Patch-mainline: v5.10-rc1 +References: git-fixes + +The parameter 'int n' from bch_bucket_alloc_set() is not cleared +defined. From the code comments n is the number of buckets to alloc, but +from the code itself 'n' is the maximum cache to iterate. Indeed all the +locations where bch_bucket_alloc_set() is called, 'n' is alwasy 1. + +This patch removes the confused and unnecessary 'int n' from parameter +list of bch_bucket_alloc_set(), and explicitly allocates only 1 bucket +for its caller. + +Signed-off-by: Coly Li +Reviewed-by: Hannes Reinecke +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/alloc.c | 35 +++++++++++++++-------------------- + drivers/md/bcache/bcache.h | 4 ++-- + drivers/md/bcache/btree.c | 2 +- + drivers/md/bcache/super.c | 2 +- + 4 files changed, 19 insertions(+), 24 deletions(-) + +diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c +index 52035a78d836..4493ff57476d 100644 +--- a/drivers/md/bcache/alloc.c ++++ b/drivers/md/bcache/alloc.c +@@ -49,7 +49,7 @@ + * + * bch_bucket_alloc() allocates a single bucket from a specific cache. + * +- * bch_bucket_alloc_set() allocates one or more buckets from different caches ++ * bch_bucket_alloc_set() allocates one bucket from different caches + * out of a cache set. + * + * free_some_buckets() drives all the processes described above. It's called +@@ -488,34 +488,29 @@ void bch_bucket_free(struct cache_set *c, struct bkey *k) + } + + int __bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve, +- struct bkey *k, int n, bool wait) ++ struct bkey *k, bool wait) + { +- int i; ++ struct cache *ca; ++ long b; + + /* No allocation if CACHE_SET_IO_DISABLE bit is set */ + if (unlikely(test_bit(CACHE_SET_IO_DISABLE, &c->flags))) + return -1; + + lockdep_assert_held(&c->bucket_lock); +- BUG_ON(!n || n > c->caches_loaded || n > MAX_CACHES_PER_SET); + + bkey_init(k); + +- /* sort by free space/prio of oldest data in caches */ +- +- for (i = 0; i < n; i++) { +- struct cache *ca = c->cache_by_alloc[i]; +- long b = bch_bucket_alloc(ca, reserve, wait); ++ ca = c->cache_by_alloc[0]; ++ b = bch_bucket_alloc(ca, reserve, wait); ++ if (b == -1) ++ goto err; + +- if (b == -1) +- goto err; ++ k->ptr[0] = MAKE_PTR(ca->buckets[b].gen, ++ bucket_to_sector(c, b), ++ ca->sb.nr_this_dev); + +- k->ptr[i] = MAKE_PTR(ca->buckets[b].gen, +- bucket_to_sector(c, b), +- ca->sb.nr_this_dev); +- +- SET_KEY_PTRS(k, i + 1); +- } ++ SET_KEY_PTRS(k, 1); + + return 0; + err: +@@ -525,12 +520,12 @@ int __bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve, + } + + int bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve, +- struct bkey *k, int n, bool wait) ++ struct bkey *k, bool wait) + { + int ret; + + mutex_lock(&c->bucket_lock); +- ret = __bch_bucket_alloc_set(c, reserve, k, n, wait); ++ ret = __bch_bucket_alloc_set(c, reserve, k, wait); + mutex_unlock(&c->bucket_lock); + return ret; + } +@@ -638,7 +633,7 @@ bool bch_alloc_sectors(struct cache_set *c, + + spin_unlock(&c->data_bucket_lock); + +- if (bch_bucket_alloc_set(c, watermark, &alloc.key, 1, wait)) ++ if (bch_bucket_alloc_set(c, watermark, &alloc.key, wait)) + return false; + + spin_lock(&c->data_bucket_lock); +diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h +index 4fd03d2496d8..5ff6e9573935 100644 +--- a/drivers/md/bcache/bcache.h ++++ b/drivers/md/bcache/bcache.h +@@ -994,9 +994,9 @@ void bch_bucket_free(struct cache_set *c, struct bkey *k); + + long bch_bucket_alloc(struct cache *ca, unsigned int reserve, bool wait); + int __bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve, +- struct bkey *k, int n, bool wait); ++ struct bkey *k, bool wait); + int bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve, +- struct bkey *k, int n, bool wait); ++ struct bkey *k, bool wait); + bool bch_alloc_sectors(struct cache_set *c, struct bkey *k, + unsigned int sectors, unsigned int write_point, + unsigned int write_prio, bool wait); +diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c +index ae7611fa42bf..e2bd03408e66 100644 +--- a/drivers/md/bcache/btree.c ++++ b/drivers/md/bcache/btree.c +@@ -1091,7 +1091,7 @@ struct btree *__bch_btree_node_alloc(struct cache_set *c, struct btree_op *op, + + mutex_lock(&c->bucket_lock); + retry: +- if (__bch_bucket_alloc_set(c, RESERVE_BTREE, &k.key, 1, wait)) ++ if (__bch_bucket_alloc_set(c, RESERVE_BTREE, &k.key, wait)) + goto err; + + bkey_put(c, &k.key); +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index d34495d27450..b4176b8e9571 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -486,7 +486,7 @@ static int __uuid_write(struct cache_set *c) + closure_init_stack(&cl); + lockdep_assert_held(&bch_register_lock); + +- if (bch_bucket_alloc_set(c, RESERVE_BTREE, &k.key, 1, true)) ++ if (bch_bucket_alloc_set(c, RESERVE_BTREE, &k.key, true)) + return 1; + + size = meta_bucket_pages(&c->sb) * PAGE_SECTORS; +-- +2.26.2 + diff --git a/patches.suse/0003-can-flexcan-add-low-power-enter-exit-acknowledgment-.patch b/patches.suse/0003-can-flexcan-add-low-power-enter-exit-acknowledgment-.patch index 9a2a566..5bd5503 100644 --- a/patches.suse/0003-can-flexcan-add-low-power-enter-exit-acknowledgment-.patch +++ b/patches.suse/0003-can-flexcan-add-low-power-enter-exit-acknowledgment-.patch @@ -1,10 +1,10 @@ -From b7603d080ffcf8689ec91ca300caf84d8dbed317 Mon Sep 17 00:00:00 2001 From: Joakim Zhang Date: Wed, 4 Dec 2019 11:36:11 +0000 -Subject: [PATCH] can: flexcan: add low power enter/exit acknowledgment helper +Subject: can: flexcan: add low power enter/exit acknowledgment helper + Git-commit: b7603d080ffcf8689ec91ca300caf84d8dbed317 Patch-mainline: v5.5-rc3 -References: git-fixes +References: jsc#SLE-12251 The MCR[LPMACK] read-only bit indicates that FlexCAN is in a lower-power mode (Disabled mode, Doze mode, Stop mode). @@ -16,10 +16,9 @@ code duplication for disabled mode, doze mode and stop mode. Tested-by: Sean Nyekjaer Signed-off-by: Joakim Zhang Signed-off-by: Marc Kleine-Budde -Acked-by: Takashi Iwai - +Signed-off-by: Mian Yousaf Kaukab --- - drivers/net/can/flexcan.c | 46 ++++++++++++++++++++++++++++++---------------- + drivers/net/can/flexcan.c | 46 +++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c @@ -104,5 +103,5 @@ index b6f675a5e2d9..9f3a5e56fc37 100644 static int flexcan_chip_freeze(struct flexcan_priv *priv) -- -2.16.4 +2.26.2 diff --git a/patches.suse/0004-bcache-explicitly-make-cache_set-only-have-single-ca.patch b/patches.suse/0004-bcache-explicitly-make-cache_set-only-have-single-ca.patch new file mode 100644 index 0000000..16f7adf --- /dev/null +++ b/patches.suse/0004-bcache-explicitly-make-cache_set-only-have-single-ca.patch @@ -0,0 +1,132 @@ +From 697e23495c94f0380c1ed8b11f830b92b64c99ea Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Thu, 1 Oct 2020 14:50:46 +0800 +Subject: [PATCH] bcache: explicitly make cache_set only have single cache +Git-commit: 697e23495c94f0380c1ed8b11f830b92b64c99ea +Patch-mainline: v5.10-rc1 +References: git-fixes + +Currently although the bcache code has a framework for multiple caches +in a cache set, but indeed the multiple caches never completed and users +use md raid1 for multiple copies of the cached data. + +This patch does the following change in struct cache_set, to explicitly +make a cache_set only have single cache, +- Change pointer array "*cache[MAX_CACHES_PER_SET]" to a single pointer + "*cache". +- Remove pointer array "*cache_by_alloc[MAX_CACHES_PER_SET]". +- Remove "caches_loaded". + +Now the code looks as exactly what it does in practic: only one cache is +used in the cache set. + +Signed-off-by: Coly Li +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/alloc.c | 2 +- + drivers/md/bcache/bcache.h | 8 +++----- + drivers/md/bcache/super.c | 19 ++++++++----------- + 3 files changed, 12 insertions(+), 17 deletions(-) + +diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c +index 4493ff57476d..3385f6add6df 100644 +--- a/drivers/md/bcache/alloc.c ++++ b/drivers/md/bcache/alloc.c +@@ -501,7 +501,7 @@ int __bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve, + + bkey_init(k); + +- ca = c->cache_by_alloc[0]; ++ ca = c->cache; + b = bch_bucket_alloc(ca, reserve, wait); + if (b == -1) + goto err; +diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h +index 5ff6e9573935..aa112c1adba1 100644 +--- a/drivers/md/bcache/bcache.h ++++ b/drivers/md/bcache/bcache.h +@@ -519,9 +519,7 @@ struct cache_set { + + struct cache_sb sb; + +- struct cache *cache[MAX_CACHES_PER_SET]; +- struct cache *cache_by_alloc[MAX_CACHES_PER_SET]; +- int caches_loaded; ++ struct cache *cache; + + struct bcache_device **devices; + unsigned int devices_max_used; +@@ -808,7 +806,7 @@ static inline struct cache *PTR_CACHE(struct cache_set *c, + const struct bkey *k, + unsigned int ptr) + { +- return c->cache[PTR_DEV(k, ptr)]; ++ return c->cache; + } + + static inline size_t PTR_BUCKET_NR(struct cache_set *c, +@@ -890,7 +888,7 @@ do { \ + /* Looping macros */ + + #define for_each_cache(ca, cs, iter) \ +- for (iter = 0; ca = cs->cache[iter], iter < (cs)->sb.nr_in_set; iter++) ++ for (iter = 0; ca = cs->cache, iter < 1; iter++) + + #define for_each_bucket(b, ca) \ + for (b = (ca)->buckets + (ca)->sb.first_bucket; \ +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index b4176b8e9571..739cf292554c 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -1674,7 +1674,7 @@ static void cache_set_free(struct closure *cl) + for_each_cache(ca, c, i) + if (ca) { + ca->set = NULL; +- c->cache[ca->sb.nr_this_dev] = NULL; ++ c->cache = NULL; + kobject_put(&ca->kobj); + } + +@@ -2165,7 +2165,7 @@ static const char *register_cache_set(struct cache *ca) + + list_for_each_entry(c, &bch_cache_sets, list) + if (!memcmp(c->sb.set_uuid, ca->sb.set_uuid, 16)) { +- if (c->cache[ca->sb.nr_this_dev]) ++ if (c->cache) + return "duplicate cache set member"; + + if (!can_attach_cache(ca, c)) +@@ -2215,14 +2215,11 @@ static const char *register_cache_set(struct cache *ca) + + kobject_get(&ca->kobj); + ca->set = c; +- ca->set->cache[ca->sb.nr_this_dev] = ca; +- c->cache_by_alloc[c->caches_loaded++] = ca; ++ ca->set->cache = ca; + +- if (c->caches_loaded == c->sb.nr_in_set) { +- err = "failed to run cache set"; +- if (run_cache_set(c) < 0) +- goto err; +- } ++ err = "failed to run cache set"; ++ if (run_cache_set(c) < 0) ++ goto err; + + return NULL; + err: +@@ -2239,8 +2236,8 @@ void bch_cache_release(struct kobject *kobj) + unsigned int i; + + if (ca->set) { +- BUG_ON(ca->set->cache[ca->sb.nr_this_dev] != ca); +- ca->set->cache[ca->sb.nr_this_dev] = NULL; ++ BUG_ON(ca->set->cache != ca); ++ ca->set->cache = NULL; + } + + free_pages((unsigned long) ca->disk_buckets, ilog2(meta_bucket_pages(&ca->sb))); +-- +2.26.2 + diff --git a/patches.suse/0004-can-flexcan-poll-MCR_LPM_ACK-instead-of-GPR-ACK-for-.patch b/patches.suse/0004-can-flexcan-poll-MCR_LPM_ACK-instead-of-GPR-ACK-for-.patch index a0ad35d..04a0ab7 100644 --- a/patches.suse/0004-can-flexcan-poll-MCR_LPM_ACK-instead-of-GPR-ACK-for-.patch +++ b/patches.suse/0004-can-flexcan-poll-MCR_LPM_ACK-instead-of-GPR-ACK-for-.patch @@ -1,10 +1,11 @@ -From 048e3a34a2e7669bf475eb56c7345ad9d8d2b8e3 Mon Sep 17 00:00:00 2001 From: Joakim Zhang Date: Wed, 4 Dec 2019 11:36:14 +0000 -Subject: [PATCH] can: flexcan: poll MCR_LPM_ACK instead of GPR ACK for stop mode acknowledgment +Subject: can: flexcan: poll MCR_LPM_ACK instead of GPR ACK for stop mode + acknowledgment + Git-commit: 048e3a34a2e7669bf475eb56c7345ad9d8d2b8e3 Patch-mainline: v5.5-rc3 -References: git-fixes +References: jsc#SLE-12251 Stop Mode is entered when Stop Mode is requested at chip level and MCR[LPM_ACK] is asserted by the FlexCAN. @@ -22,8 +23,7 @@ Tested-by: Sean Nyekjaer Signed-off-by: Joakim Zhang Cc: linux-stable # >= v5.0 Signed-off-by: Marc Kleine-Budde -Acked-by: Takashi Iwai - +Signed-off-by: Mian Yousaf Kaukab --- drivers/net/can/flexcan.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) @@ -80,5 +80,5 @@ index 9f3a5e56fc37..94d10ec954a0 100644 static inline void flexcan_error_irq_enable(const struct flexcan_priv *priv) -- -2.16.4 +2.26.2 diff --git a/patches.suse/0004-dm-fix-bio-splitting-and-its-bio-completion-order-fo.patch b/patches.suse/0004-dm-fix-bio-splitting-and-its-bio-completion-order-fo.patch new file mode 100644 index 0000000..893a69d --- /dev/null +++ b/patches.suse/0004-dm-fix-bio-splitting-and-its-bio-completion-order-fo.patch @@ -0,0 +1,80 @@ +From ee1dfad5325ff1cfb2239e564cd411b3bfe8667a Mon Sep 17 00:00:00 2001 +From: Mike Snitzer +Date: Mon, 14 Sep 2020 13:04:19 -0400 +Subject: [PATCH] dm: fix bio splitting and its bio completion order for + regular IO +Git-commit: ee1dfad5325ff1cfb2239e564cd411b3bfe8667a +Patch-mainline: v5.9-rc7 +References: bsc#1175995, jsc#SLE-15608 + +dm_queue_split() is removed because __split_and_process_bio() _must_ +handle splitting bios to ensure proper bio submission and completion +ordering as a bio is split. + +Otherwise, multiple recursive calls to ->submit_bio will cause multiple +split bios to be allocated from the same ->bio_split mempool at the same +time. This would result in deadlock in low memory conditions because no +progress could be made (only one bio is available in ->bio_split +mempool). + +This fix has been verified to still fix the loss of performance, due +to excess splitting, that commit 120c9257f5f1 provided. + +Fixes: 120c9257f5f1 ("Revert "dm: always call blk_queue_split() in dm_process_bio()"") +Cc: stable@vger.kernel.org # 5.0+, requires custom backport due to 5.9 changes +Reported-by: Ming Lei +Signed-off-by: Mike Snitzer +Signed-off-by: Coly Li + +--- + drivers/md/dm.c | 23 ++--------------------- + 1 file changed, 2 insertions(+), 21 deletions(-) + +diff --git a/drivers/md/dm.c b/drivers/md/dm.c +index 4a40df8af7d3..d948cd522431 100644 +--- a/drivers/md/dm.c ++++ b/drivers/md/dm.c +@@ -1724,23 +1724,6 @@ static blk_qc_t __process_bio(struct mapped_device *md, struct dm_table *map, + return ret; + } + +-static void dm_queue_split(struct mapped_device *md, struct dm_target *ti, struct bio **bio) +-{ +- unsigned len, sector_count; +- +- sector_count = bio_sectors(*bio); +- len = min_t(sector_t, max_io_len((*bio)->bi_iter.bi_sector, ti), sector_count); +- +- if (sector_count > len) { +- struct bio *split = bio_split(*bio, len, GFP_NOIO, &md->queue->bio_split); +- +- bio_chain(split, *bio); +- trace_block_split(md->queue, split, (*bio)->bi_iter.bi_sector); +- submit_bio_noacct(*bio); +- *bio = split; +- } +-} +- + static blk_qc_t dm_process_bio(struct mapped_device *md, + struct dm_table *map, struct bio *bio) + { +@@ -1768,14 +1751,12 @@ static blk_qc_t dm_process_bio(struct mapped_device *md, + if (current->bio_list) { + if (is_abnormal_io(bio)) + blk_queue_split(&bio); +- else +- dm_queue_split(md, ti, &bio); ++ /* regular IO is split by __split_and_process_bio */ + } + + if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED) + return __process_bio(md, map, bio, ti); +- else +- return __split_and_process_bio(md, map, bio); ++ return __split_and_process_bio(md, map, bio); + } + + static blk_qc_t dm_submit_bio(struct bio *bio) +-- +2.26.2 + diff --git a/patches.suse/0005-bcache-remove-for_each_cache.patch b/patches.suse/0005-bcache-remove-for_each_cache.patch new file mode 100644 index 0000000..a4f9424 --- /dev/null +++ b/patches.suse/0005-bcache-remove-for_each_cache.patch @@ -0,0 +1,901 @@ +From 08fdb2cddbdc783fecadfb606868c4498165fc30 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Thu, 1 Oct 2020 14:50:47 +0800 +Subject: [PATCH] bcache: remove for_each_cache() +Git-commit: 08fdb2cddbdc783fecadfb606868c4498165fc30 +Patch-mainline: v5.10-rc1 +References: git-fixes + +Since now each cache_set explicitly has single cache, for_each_cache() +is unnecessary. This patch removes this macro, and update all locations +where it is used, and makes sure all code logic still being consistent. + +Signed-off-by: Coly Li +Reviewed-by: Hannes Reinecke +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/alloc.c | 17 ++- + drivers/md/bcache/bcache.h | 9 +- + drivers/md/bcache/btree.c | 103 +++++++--------- + drivers/md/bcache/journal.c | 229 ++++++++++++++++------------------- + drivers/md/bcache/movinggc.c | 58 +++++---- + drivers/md/bcache/super.c | 115 ++++++++---------- + 6 files changed, 237 insertions(+), 294 deletions(-) + +diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c +index 3385f6add6df..1b8310992dd0 100644 +--- a/drivers/md/bcache/alloc.c ++++ b/drivers/md/bcache/alloc.c +@@ -88,7 +88,6 @@ void bch_rescale_priorities(struct cache_set *c, int sectors) + struct cache *ca; + struct bucket *b; + unsigned long next = c->nbuckets * c->sb.bucket_size / 1024; +- unsigned int i; + int r; + + atomic_sub(sectors, &c->rescale); +@@ -104,14 +103,14 @@ void bch_rescale_priorities(struct cache_set *c, int sectors) + + c->min_prio = USHRT_MAX; + +- for_each_cache(ca, c, i) +- for_each_bucket(b, ca) +- if (b->prio && +- b->prio != BTREE_PRIO && +- !atomic_read(&b->pin)) { +- b->prio--; +- c->min_prio = min(c->min_prio, b->prio); +- } ++ ca = c->cache; ++ for_each_bucket(b, ca) ++ if (b->prio && ++ b->prio != BTREE_PRIO && ++ !atomic_read(&b->pin)) { ++ b->prio--; ++ c->min_prio = min(c->min_prio, b->prio); ++ } + + mutex_unlock(&c->bucket_lock); + } +diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h +index aa112c1adba1..7ffe6b2d179b 100644 +--- a/drivers/md/bcache/bcache.h ++++ b/drivers/md/bcache/bcache.h +@@ -887,9 +887,6 @@ do { \ + + /* Looping macros */ + +-#define for_each_cache(ca, cs, iter) \ +- for (iter = 0; ca = cs->cache, iter < 1; iter++) +- + #define for_each_bucket(b, ca) \ + for (b = (ca)->buckets + (ca)->sb.first_bucket; \ + b < (ca)->buckets + (ca)->sb.nbuckets; b++) +@@ -931,11 +928,9 @@ static inline uint8_t bucket_gc_gen(struct bucket *b) + + static inline void wake_up_allocators(struct cache_set *c) + { +- struct cache *ca; +- unsigned int i; ++ struct cache *ca = c->cache; + +- for_each_cache(ca, c, i) +- wake_up_process(ca->alloc_thread); ++ wake_up_process(ca->alloc_thread); + } + + static inline void closure_bio_submit(struct cache_set *c, +diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c +index e2bd03408e66..f626d536981e 100644 +--- a/drivers/md/bcache/btree.c ++++ b/drivers/md/bcache/btree.c +@@ -1167,19 +1167,18 @@ static void make_btree_freeing_key(struct btree *b, struct bkey *k) + static int btree_check_reserve(struct btree *b, struct btree_op *op) + { + struct cache_set *c = b->c; +- struct cache *ca; +- unsigned int i, reserve = (c->root->level - b->level) * 2 + 1; ++ struct cache *ca = c->cache; ++ unsigned int reserve = (c->root->level - b->level) * 2 + 1; + + mutex_lock(&c->bucket_lock); + +- for_each_cache(ca, c, i) +- if (fifo_used(&ca->free[RESERVE_BTREE]) < reserve) { +- if (op) +- prepare_to_wait(&c->btree_cache_wait, &op->wait, +- TASK_UNINTERRUPTIBLE); +- mutex_unlock(&c->bucket_lock); +- return -EINTR; +- } ++ if (fifo_used(&ca->free[RESERVE_BTREE]) < reserve) { ++ if (op) ++ prepare_to_wait(&c->btree_cache_wait, &op->wait, ++ TASK_UNINTERRUPTIBLE); ++ mutex_unlock(&c->bucket_lock); ++ return -EINTR; ++ } + + mutex_unlock(&c->bucket_lock); + +@@ -1695,7 +1694,6 @@ static void btree_gc_start(struct cache_set *c) + { + struct cache *ca; + struct bucket *b; +- unsigned int i; + + if (!c->gc_mark_valid) + return; +@@ -1705,14 +1703,14 @@ static void btree_gc_start(struct cache_set *c) + c->gc_mark_valid = 0; + c->gc_done = ZERO_KEY; + +- for_each_cache(ca, c, i) +- for_each_bucket(b, ca) { +- b->last_gc = b->gen; +- if (!atomic_read(&b->pin)) { +- SET_GC_MARK(b, 0); +- SET_GC_SECTORS_USED(b, 0); +- } ++ ca = c->cache; ++ for_each_bucket(b, ca) { ++ b->last_gc = b->gen; ++ if (!atomic_read(&b->pin)) { ++ SET_GC_MARK(b, 0); ++ SET_GC_SECTORS_USED(b, 0); + } ++ } + + mutex_unlock(&c->bucket_lock); + } +@@ -1721,7 +1719,8 @@ static void bch_btree_gc_finish(struct cache_set *c) + { + struct bucket *b; + struct cache *ca; +- unsigned int i; ++ unsigned int i, j; ++ uint64_t *k; + + mutex_lock(&c->bucket_lock); + +@@ -1739,7 +1738,6 @@ static void bch_btree_gc_finish(struct cache_set *c) + struct bcache_device *d = c->devices[i]; + struct cached_dev *dc; + struct keybuf_key *w, *n; +- unsigned int j; + + if (!d || UUID_FLASH_ONLY(&c->uuids[i])) + continue; +@@ -1756,29 +1754,27 @@ static void bch_btree_gc_finish(struct cache_set *c) + rcu_read_unlock(); + + c->avail_nbuckets = 0; +- for_each_cache(ca, c, i) { +- uint64_t *i; + +- ca->invalidate_needs_gc = 0; ++ ca = c->cache; ++ ca->invalidate_needs_gc = 0; + +- for (i = ca->sb.d; i < ca->sb.d + ca->sb.keys; i++) +- SET_GC_MARK(ca->buckets + *i, GC_MARK_METADATA); ++ for (k = ca->sb.d; k < ca->sb.d + ca->sb.keys; k++) ++ SET_GC_MARK(ca->buckets + *k, GC_MARK_METADATA); + +- for (i = ca->prio_buckets; +- i < ca->prio_buckets + prio_buckets(ca) * 2; i++) +- SET_GC_MARK(ca->buckets + *i, GC_MARK_METADATA); ++ for (k = ca->prio_buckets; ++ k < ca->prio_buckets + prio_buckets(ca) * 2; k++) ++ SET_GC_MARK(ca->buckets + *k, GC_MARK_METADATA); + +- for_each_bucket(b, ca) { +- c->need_gc = max(c->need_gc, bucket_gc_gen(b)); ++ for_each_bucket(b, ca) { ++ c->need_gc = max(c->need_gc, bucket_gc_gen(b)); + +- if (atomic_read(&b->pin)) +- continue; ++ if (atomic_read(&b->pin)) ++ continue; + +- BUG_ON(!GC_MARK(b) && GC_SECTORS_USED(b)); ++ BUG_ON(!GC_MARK(b) && GC_SECTORS_USED(b)); + +- if (!GC_MARK(b) || GC_MARK(b) == GC_MARK_RECLAIMABLE) +- c->avail_nbuckets++; +- } ++ if (!GC_MARK(b) || GC_MARK(b) == GC_MARK_RECLAIMABLE) ++ c->avail_nbuckets++; + } + + mutex_unlock(&c->bucket_lock); +@@ -1830,12 +1826,10 @@ static void bch_btree_gc(struct cache_set *c) + + static bool gc_should_run(struct cache_set *c) + { +- struct cache *ca; +- unsigned int i; ++ struct cache *ca = c->cache; + +- for_each_cache(ca, c, i) +- if (ca->invalidate_needs_gc) +- return true; ++ if (ca->invalidate_needs_gc) ++ return true; + + if (atomic_read(&c->sectors_to_gc) < 0) + return true; +@@ -2081,9 +2075,8 @@ int bch_btree_check(struct cache_set *c) + + void bch_initial_gc_finish(struct cache_set *c) + { +- struct cache *ca; ++ struct cache *ca = c->cache; + struct bucket *b; +- unsigned int i; + + bch_btree_gc_finish(c); + +@@ -2098,20 +2091,18 @@ void bch_initial_gc_finish(struct cache_set *c) + * This is only safe for buckets that have no live data in them, which + * there should always be some of. + */ +- for_each_cache(ca, c, i) { +- for_each_bucket(b, ca) { +- if (fifo_full(&ca->free[RESERVE_PRIO]) && +- fifo_full(&ca->free[RESERVE_BTREE])) +- break; ++ for_each_bucket(b, ca) { ++ if (fifo_full(&ca->free[RESERVE_PRIO]) && ++ fifo_full(&ca->free[RESERVE_BTREE])) ++ break; + +- if (bch_can_invalidate_bucket(ca, b) && +- !GC_MARK(b)) { +- __bch_invalidate_one_bucket(ca, b); +- if (!fifo_push(&ca->free[RESERVE_PRIO], +- b - ca->buckets)) +- fifo_push(&ca->free[RESERVE_BTREE], +- b - ca->buckets); +- } ++ if (bch_can_invalidate_bucket(ca, b) && ++ !GC_MARK(b)) { ++ __bch_invalidate_one_bucket(ca, b); ++ if (!fifo_push(&ca->free[RESERVE_PRIO], ++ b - ca->buckets)) ++ fifo_push(&ca->free[RESERVE_BTREE], ++ b - ca->buckets); + } + } + +diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c +index c1227bdb57e7..e89ae7c4ba97 100644 +--- a/drivers/md/bcache/journal.c ++++ b/drivers/md/bcache/journal.c +@@ -179,112 +179,109 @@ int bch_journal_read(struct cache_set *c, struct list_head *list) + ret; \ + }) + +- struct cache *ca; +- unsigned int iter; ++ struct cache *ca = c->cache; + int ret = 0; ++ struct journal_device *ja = &ca->journal; ++ DECLARE_BITMAP(bitmap, SB_JOURNAL_BUCKETS); ++ unsigned int i, l, r, m; ++ uint64_t seq; + +- for_each_cache(ca, c, iter) { +- struct journal_device *ja = &ca->journal; +- DECLARE_BITMAP(bitmap, SB_JOURNAL_BUCKETS); +- unsigned int i, l, r, m; +- uint64_t seq; +- +- bitmap_zero(bitmap, SB_JOURNAL_BUCKETS); +- pr_debug("%u journal buckets\n", ca->sb.njournal_buckets); ++ bitmap_zero(bitmap, SB_JOURNAL_BUCKETS); ++ pr_debug("%u journal buckets\n", ca->sb.njournal_buckets); + ++ /* ++ * Read journal buckets ordered by golden ratio hash to quickly ++ * find a sequence of buckets with valid journal entries ++ */ ++ for (i = 0; i < ca->sb.njournal_buckets; i++) { + /* +- * Read journal buckets ordered by golden ratio hash to quickly +- * find a sequence of buckets with valid journal entries ++ * We must try the index l with ZERO first for ++ * correctness due to the scenario that the journal ++ * bucket is circular buffer which might have wrapped + */ +- for (i = 0; i < ca->sb.njournal_buckets; i++) { +- /* +- * We must try the index l with ZERO first for +- * correctness due to the scenario that the journal +- * bucket is circular buffer which might have wrapped +- */ +- l = (i * 2654435769U) % ca->sb.njournal_buckets; ++ l = (i * 2654435769U) % ca->sb.njournal_buckets; + +- if (test_bit(l, bitmap)) +- break; ++ if (test_bit(l, bitmap)) ++ break; + +- if (read_bucket(l)) +- goto bsearch; +- } ++ if (read_bucket(l)) ++ goto bsearch; ++ } + +- /* +- * If that fails, check all the buckets we haven't checked +- * already +- */ +- pr_debug("falling back to linear search\n"); ++ /* ++ * If that fails, check all the buckets we haven't checked ++ * already ++ */ ++ pr_debug("falling back to linear search\n"); + +- for_each_clear_bit(l, bitmap, ca->sb.njournal_buckets) +- if (read_bucket(l)) +- goto bsearch; ++ for_each_clear_bit(l, bitmap, ca->sb.njournal_buckets) ++ if (read_bucket(l)) ++ goto bsearch; + +- /* no journal entries on this device? */ +- if (l == ca->sb.njournal_buckets) +- continue; ++ /* no journal entries on this device? */ ++ if (l == ca->sb.njournal_buckets) ++ goto out; + bsearch: +- BUG_ON(list_empty(list)); ++ BUG_ON(list_empty(list)); + +- /* Binary search */ +- m = l; +- r = find_next_bit(bitmap, ca->sb.njournal_buckets, l + 1); +- pr_debug("starting binary search, l %u r %u\n", l, r); ++ /* Binary search */ ++ m = l; ++ r = find_next_bit(bitmap, ca->sb.njournal_buckets, l + 1); ++ pr_debug("starting binary search, l %u r %u\n", l, r); + +- while (l + 1 < r) { +- seq = list_entry(list->prev, struct journal_replay, +- list)->j.seq; ++ while (l + 1 < r) { ++ seq = list_entry(list->prev, struct journal_replay, ++ list)->j.seq; + +- m = (l + r) >> 1; +- read_bucket(m); ++ m = (l + r) >> 1; ++ read_bucket(m); + +- if (seq != list_entry(list->prev, struct journal_replay, +- list)->j.seq) +- l = m; +- else +- r = m; +- } ++ if (seq != list_entry(list->prev, struct journal_replay, ++ list)->j.seq) ++ l = m; ++ else ++ r = m; ++ } + +- /* +- * Read buckets in reverse order until we stop finding more +- * journal entries +- */ +- pr_debug("finishing up: m %u njournal_buckets %u\n", +- m, ca->sb.njournal_buckets); +- l = m; ++ /* ++ * Read buckets in reverse order until we stop finding more ++ * journal entries ++ */ ++ pr_debug("finishing up: m %u njournal_buckets %u\n", ++ m, ca->sb.njournal_buckets); ++ l = m; + +- while (1) { +- if (!l--) +- l = ca->sb.njournal_buckets - 1; ++ while (1) { ++ if (!l--) ++ l = ca->sb.njournal_buckets - 1; + +- if (l == m) +- break; ++ if (l == m) ++ break; + +- if (test_bit(l, bitmap)) +- continue; ++ if (test_bit(l, bitmap)) ++ continue; + +- if (!read_bucket(l)) +- break; +- } ++ if (!read_bucket(l)) ++ break; ++ } + +- seq = 0; ++ seq = 0; + +- for (i = 0; i < ca->sb.njournal_buckets; i++) +- if (ja->seq[i] > seq) { +- seq = ja->seq[i]; +- /* +- * When journal_reclaim() goes to allocate for +- * the first time, it'll use the bucket after +- * ja->cur_idx +- */ +- ja->cur_idx = i; +- ja->last_idx = ja->discard_idx = (i + 1) % +- ca->sb.njournal_buckets; ++ for (i = 0; i < ca->sb.njournal_buckets; i++) ++ if (ja->seq[i] > seq) { ++ seq = ja->seq[i]; ++ /* ++ * When journal_reclaim() goes to allocate for ++ * the first time, it'll use the bucket after ++ * ja->cur_idx ++ */ ++ ja->cur_idx = i; ++ ja->last_idx = ja->discard_idx = (i + 1) % ++ ca->sb.njournal_buckets; + +- } +- } ++ } + ++out: + if (!list_empty(list)) + c->journal.seq = list_entry(list->prev, + struct journal_replay, +@@ -342,12 +339,10 @@ void bch_journal_mark(struct cache_set *c, struct list_head *list) + + static bool is_discard_enabled(struct cache_set *s) + { +- struct cache *ca; +- unsigned int i; ++ struct cache *ca = s->cache; + +- for_each_cache(ca, s, i) +- if (ca->discard) +- return true; ++ if (ca->discard) ++ return true; + + return false; + } +@@ -633,9 +628,10 @@ static void do_journal_discard(struct cache *ca) + static void journal_reclaim(struct cache_set *c) + { + struct bkey *k = &c->journal.key; +- struct cache *ca; ++ struct cache *ca = c->cache; + uint64_t last_seq; +- unsigned int iter, n = 0; ++ unsigned int next; ++ struct journal_device *ja = &ca->journal; + atomic_t p __maybe_unused; + + atomic_long_inc(&c->reclaim); +@@ -647,46 +643,31 @@ static void journal_reclaim(struct cache_set *c) + + /* Update last_idx */ + +- for_each_cache(ca, c, iter) { +- struct journal_device *ja = &ca->journal; +- +- while (ja->last_idx != ja->cur_idx && +- ja->seq[ja->last_idx] < last_seq) +- ja->last_idx = (ja->last_idx + 1) % +- ca->sb.njournal_buckets; +- } ++ while (ja->last_idx != ja->cur_idx && ++ ja->seq[ja->last_idx] < last_seq) ++ ja->last_idx = (ja->last_idx + 1) % ++ ca->sb.njournal_buckets; + +- for_each_cache(ca, c, iter) +- do_journal_discard(ca); ++ do_journal_discard(ca); + + if (c->journal.blocks_free) + goto out; + +- /* +- * Allocate: +- * XXX: Sort by free journal space +- */ +- +- for_each_cache(ca, c, iter) { +- struct journal_device *ja = &ca->journal; +- unsigned int next = (ja->cur_idx + 1) % ca->sb.njournal_buckets; ++ next = (ja->cur_idx + 1) % ca->sb.njournal_buckets; ++ /* No space available on this device */ ++ if (next == ja->discard_idx) ++ goto out; + +- /* No space available on this device */ +- if (next == ja->discard_idx) +- continue; ++ ja->cur_idx = next; ++ k->ptr[0] = MAKE_PTR(0, ++ bucket_to_sector(c, ca->sb.d[ja->cur_idx]), ++ ca->sb.nr_this_dev); ++ atomic_long_inc(&c->reclaimed_journal_buckets); + +- ja->cur_idx = next; +- k->ptr[n++] = MAKE_PTR(0, +- bucket_to_sector(c, ca->sb.d[ja->cur_idx]), +- ca->sb.nr_this_dev); +- atomic_long_inc(&c->reclaimed_journal_buckets); +- } ++ bkey_init(k); ++ SET_KEY_PTRS(k, 1); ++ c->journal.blocks_free = c->sb.bucket_size >> c->block_bits; + +- if (n) { +- bkey_init(k); +- SET_KEY_PTRS(k, n); +- c->journal.blocks_free = c->sb.bucket_size >> c->block_bits; +- } + out: + if (!journal_full(&c->journal)) + __closure_wake_up(&c->journal.wait); +@@ -750,7 +731,7 @@ static void journal_write_unlocked(struct closure *cl) + __releases(c->journal.lock) + { + struct cache_set *c = container_of(cl, struct cache_set, journal.io); +- struct cache *ca; ++ struct cache *ca = c->cache; + struct journal_write *w = c->journal.cur; + struct bkey *k = &c->journal.key; + unsigned int i, sectors = set_blocks(w->data, block_bytes(c)) * +@@ -780,9 +761,7 @@ static void journal_write_unlocked(struct closure *cl) + bkey_copy(&w->data->btree_root, &c->root->key); + bkey_copy(&w->data->uuid_bucket, &c->uuid_bucket); + +- for_each_cache(ca, c, i) +- w->data->prio_bucket[ca->sb.nr_this_dev] = ca->prio_buckets[0]; +- ++ w->data->prio_bucket[ca->sb.nr_this_dev] = ca->prio_buckets[0]; + w->data->magic = jset_magic(&c->sb); + w->data->version = BCACHE_JSET_VERSION; + w->data->last_seq = last_seq(&c->journal); +diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c +index 5872d6470470..b9c3d27ec093 100644 +--- a/drivers/md/bcache/movinggc.c ++++ b/drivers/md/bcache/movinggc.c +@@ -196,50 +196,48 @@ static unsigned int bucket_heap_top(struct cache *ca) + + void bch_moving_gc(struct cache_set *c) + { +- struct cache *ca; ++ struct cache *ca = c->cache; + struct bucket *b; +- unsigned int i; ++ unsigned long sectors_to_move, reserve_sectors; + + if (!c->copy_gc_enabled) + return; + + mutex_lock(&c->bucket_lock); + +- for_each_cache(ca, c, i) { +- unsigned long sectors_to_move = 0; +- unsigned long reserve_sectors = ca->sb.bucket_size * ++ sectors_to_move = 0; ++ reserve_sectors = ca->sb.bucket_size * + fifo_used(&ca->free[RESERVE_MOVINGGC]); + +- ca->heap.used = 0; +- +- for_each_bucket(b, ca) { +- if (GC_MARK(b) == GC_MARK_METADATA || +- !GC_SECTORS_USED(b) || +- GC_SECTORS_USED(b) == ca->sb.bucket_size || +- atomic_read(&b->pin)) +- continue; +- +- if (!heap_full(&ca->heap)) { +- sectors_to_move += GC_SECTORS_USED(b); +- heap_add(&ca->heap, b, bucket_cmp); +- } else if (bucket_cmp(b, heap_peek(&ca->heap))) { +- sectors_to_move -= bucket_heap_top(ca); +- sectors_to_move += GC_SECTORS_USED(b); +- +- ca->heap.data[0] = b; +- heap_sift(&ca->heap, 0, bucket_cmp); +- } +- } ++ ca->heap.used = 0; ++ ++ for_each_bucket(b, ca) { ++ if (GC_MARK(b) == GC_MARK_METADATA || ++ !GC_SECTORS_USED(b) || ++ GC_SECTORS_USED(b) == ca->sb.bucket_size || ++ atomic_read(&b->pin)) ++ continue; + +- while (sectors_to_move > reserve_sectors) { +- heap_pop(&ca->heap, b, bucket_cmp); +- sectors_to_move -= GC_SECTORS_USED(b); ++ if (!heap_full(&ca->heap)) { ++ sectors_to_move += GC_SECTORS_USED(b); ++ heap_add(&ca->heap, b, bucket_cmp); ++ } else if (bucket_cmp(b, heap_peek(&ca->heap))) { ++ sectors_to_move -= bucket_heap_top(ca); ++ sectors_to_move += GC_SECTORS_USED(b); ++ ++ ca->heap.data[0] = b; ++ heap_sift(&ca->heap, 0, bucket_cmp); + } ++ } + +- while (heap_pop(&ca->heap, b, bucket_cmp)) +- SET_GC_MOVE(b, 1); ++ while (sectors_to_move > reserve_sectors) { ++ heap_pop(&ca->heap, b, bucket_cmp); ++ sectors_to_move -= GC_SECTORS_USED(b); + } + ++ while (heap_pop(&ca->heap, b, bucket_cmp)) ++ SET_GC_MOVE(b, 1); ++ + mutex_unlock(&c->bucket_lock); + + c->moving_gc_keys.last_scanned = ZERO_KEY; +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 739cf292554c..1eb55a600ed7 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -343,8 +343,9 @@ static void bcache_write_super_unlock(struct closure *cl) + void bcache_write_super(struct cache_set *c) + { + struct closure *cl = &c->sb_write; +- struct cache *ca; +- unsigned int i, version = BCACHE_SB_VERSION_CDEV_WITH_UUID; ++ struct cache *ca = c->cache; ++ struct bio *bio = &ca->sb_bio; ++ unsigned int version = BCACHE_SB_VERSION_CDEV_WITH_UUID; + + down(&c->sb_write_mutex); + closure_init(cl, &c->cl); +@@ -354,23 +355,19 @@ void bcache_write_super(struct cache_set *c) + if (c->sb.version > version) + version = c->sb.version; + +- for_each_cache(ca, c, i) { +- struct bio *bio = &ca->sb_bio; +- +- ca->sb.version = version; +- ca->sb.seq = c->sb.seq; +- ca->sb.last_mount = c->sb.last_mount; ++ ca->sb.version = version; ++ ca->sb.seq = c->sb.seq; ++ ca->sb.last_mount = c->sb.last_mount; + +- SET_CACHE_SYNC(&ca->sb, CACHE_SYNC(&c->sb)); ++ SET_CACHE_SYNC(&ca->sb, CACHE_SYNC(&c->sb)); + +- bio_init(bio, ca->sb_bv, 1); +- bio_set_dev(bio, ca->bdev); +- bio->bi_end_io = write_super_endio; +- bio->bi_private = ca; ++ bio_init(bio, ca->sb_bv, 1); ++ bio_set_dev(bio, ca->bdev); ++ bio->bi_end_io = write_super_endio; ++ bio->bi_private = ca; + +- closure_get(cl); +- __write_super(&ca->sb, ca->sb_disk, bio); +- } ++ closure_get(cl); ++ __write_super(&ca->sb, ca->sb_disk, bio); + + closure_return_with_destructor(cl, bcache_write_super_unlock); + } +@@ -772,26 +769,22 @@ static void bcache_device_unlink(struct bcache_device *d) + lockdep_assert_held(&bch_register_lock); + + if (d->c && !test_and_set_bit(BCACHE_DEV_UNLINK_DONE, &d->flags)) { +- unsigned int i; +- struct cache *ca; ++ struct cache *ca = d->c->cache; + + sysfs_remove_link(&d->c->kobj, d->name); + sysfs_remove_link(&d->kobj, "cache"); + +- for_each_cache(ca, d->c, i) +- bd_unlink_disk_holder(ca->bdev, d->disk); ++ bd_unlink_disk_holder(ca->bdev, d->disk); + } + } + + static void bcache_device_link(struct bcache_device *d, struct cache_set *c, + const char *name) + { +- unsigned int i; +- struct cache *ca; ++ struct cache *ca = c->cache; + int ret; + +- for_each_cache(ca, d->c, i) +- bd_link_disk_holder(ca->bdev, d->disk); ++ bd_link_disk_holder(ca->bdev, d->disk); + + snprintf(d->name, BCACHEDEVNAME_SIZE, + "%s%u", name, d->id); +@@ -1662,7 +1655,6 @@ static void cache_set_free(struct closure *cl) + { + struct cache_set *c = container_of(cl, struct cache_set, cl); + struct cache *ca; +- unsigned int i; + + debugfs_remove(c->debug); + +@@ -1671,12 +1663,12 @@ static void cache_set_free(struct closure *cl) + bch_journal_free(c); + + mutex_lock(&bch_register_lock); +- for_each_cache(ca, c, i) +- if (ca) { +- ca->set = NULL; +- c->cache = NULL; +- kobject_put(&ca->kobj); +- } ++ ca = c->cache; ++ if (ca) { ++ ca->set = NULL; ++ c->cache = NULL; ++ kobject_put(&ca->kobj); ++ } + + bch_bset_sort_state_free(&c->sort); + free_pages((unsigned long) c->uuids, ilog2(meta_bucket_pages(&c->sb))); +@@ -1702,9 +1694,8 @@ static void cache_set_free(struct closure *cl) + static void cache_set_flush(struct closure *cl) + { + struct cache_set *c = container_of(cl, struct cache_set, caching); +- struct cache *ca; ++ struct cache *ca = c->cache; + struct btree *b; +- unsigned int i; + + bch_cache_accounting_destroy(&c->accounting); + +@@ -1729,9 +1720,8 @@ static void cache_set_flush(struct closure *cl) + mutex_unlock(&b->write_lock); + } + +- for_each_cache(ca, c, i) +- if (ca->alloc_thread) +- kthread_stop(ca->alloc_thread); ++ if (ca->alloc_thread) ++ kthread_stop(ca->alloc_thread); + + if (c->journal.cur) { + cancel_delayed_work_sync(&c->journal.work); +@@ -1972,16 +1962,14 @@ static int run_cache_set(struct cache_set *c) + { + const char *err = "cannot allocate memory"; + struct cached_dev *dc, *t; +- struct cache *ca; ++ struct cache *ca = c->cache; + struct closure cl; +- unsigned int i; + LIST_HEAD(journal); + struct journal_replay *l; + + closure_init_stack(&cl); + +- for_each_cache(ca, c, i) +- c->nbuckets += ca->sb.nbuckets; ++ c->nbuckets = ca->sb.nbuckets; + set_gc_sectors(c); + + if (CACHE_SYNC(&c->sb)) { +@@ -2001,10 +1989,8 @@ static int run_cache_set(struct cache_set *c) + j = &list_entry(journal.prev, struct journal_replay, list)->j; + + err = "IO error reading priorities"; +- for_each_cache(ca, c, i) { +- if (prio_read(ca, j->prio_bucket[ca->sb.nr_this_dev])) +- goto err; +- } ++ if (prio_read(ca, j->prio_bucket[ca->sb.nr_this_dev])) ++ goto err; + + /* + * If prio_read() fails it'll call cache_set_error and we'll +@@ -2048,9 +2034,8 @@ static int run_cache_set(struct cache_set *c) + bch_journal_next(&c->journal); + + err = "error starting allocator thread"; +- for_each_cache(ca, c, i) +- if (bch_cache_allocator_start(ca)) +- goto err; ++ if (bch_cache_allocator_start(ca)) ++ goto err; + + /* + * First place it's safe to allocate: btree_check() and +@@ -2069,28 +2054,23 @@ static int run_cache_set(struct cache_set *c) + if (bch_journal_replay(c, &journal)) + goto err; + } else { +- pr_notice("invalidating existing data\n"); +- +- for_each_cache(ca, c, i) { +- unsigned int j; ++ unsigned int j; + +- ca->sb.keys = clamp_t(int, ca->sb.nbuckets >> 7, +- 2, SB_JOURNAL_BUCKETS); ++ pr_notice("invalidating existing data\n"); ++ ca->sb.keys = clamp_t(int, ca->sb.nbuckets >> 7, ++ 2, SB_JOURNAL_BUCKETS); + +- for (j = 0; j < ca->sb.keys; j++) +- ca->sb.d[j] = ca->sb.first_bucket + j; +- } ++ for (j = 0; j < ca->sb.keys; j++) ++ ca->sb.d[j] = ca->sb.first_bucket + j; + + bch_initial_gc_finish(c); + + err = "error starting allocator thread"; +- for_each_cache(ca, c, i) +- if (bch_cache_allocator_start(ca)) +- goto err; ++ if (bch_cache_allocator_start(ca)) ++ goto err; + + mutex_lock(&c->bucket_lock); +- for_each_cache(ca, c, i) +- bch_prio_write(ca, true); ++ bch_prio_write(ca, true); + mutex_unlock(&c->bucket_lock); + + err = "cannot allocate new UUID bucket"; +@@ -2465,13 +2445,14 @@ static bool bch_is_open_backing(struct block_device *bdev) + static bool bch_is_open_cache(struct block_device *bdev) + { + struct cache_set *c, *tc; +- struct cache *ca; +- unsigned int i; + +- list_for_each_entry_safe(c, tc, &bch_cache_sets, list) +- for_each_cache(ca, c, i) +- if (ca->bdev == bdev) +- return true; ++ list_for_each_entry_safe(c, tc, &bch_cache_sets, list) { ++ struct cache *ca = c->cache; ++ ++ if (ca->bdev == bdev) ++ return true; ++ } ++ + return false; + } + +-- +2.26.2 + diff --git a/patches.suse/0006-bcache-add-set_uuid-in-struct-cache_set.patch b/patches.suse/0006-bcache-add-set_uuid-in-struct-cache_set.patch new file mode 100644 index 0000000..3324443 --- /dev/null +++ b/patches.suse/0006-bcache-add-set_uuid-in-struct-cache_set.patch @@ -0,0 +1,178 @@ +From 1132e56e78e3c8f4deaf68ed760c78456a9c61f4 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Thu, 1 Oct 2020 14:50:48 +0800 +Subject: [PATCH] bcache: add set_uuid in struct cache_set +Git-commit: 1132e56e78e3c8f4deaf68ed760c78456a9c61f4 +Patch-mainline: v5.10-rc1 +References: git-fixes + +This patch adds a separated set_uuid[16] in struct cache_set, to store +the uuid of the cache set. This is the preparation to remove the +embedded struct cache_sb from struct cache_set. + +Signed-off-by: Coly Li +Reviewed-by: Hannes Reinecke +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/bcache.h | 1 + + drivers/md/bcache/debug.c | 2 +- + drivers/md/bcache/super.c | 24 ++++++++++++------------ + include/trace/events/bcache.h | 4 ++-- + 4 files changed, 16 insertions(+), 15 deletions(-) + +diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h +index 7ffe6b2d179b..94a62acac4fc 100644 +--- a/drivers/md/bcache/bcache.h ++++ b/drivers/md/bcache/bcache.h +@@ -668,6 +668,7 @@ struct cache_set { + struct mutex verify_lock; + #endif + ++ uint8_t set_uuid[16]; + unsigned int nr_uuids; + struct uuid_entry *uuids; + BKEY_PADDED(uuid_bucket); +diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c +index 336f43910383..0ccc1b0baa42 100644 +--- a/drivers/md/bcache/debug.c ++++ b/drivers/md/bcache/debug.c +@@ -238,7 +238,7 @@ void bch_debug_init_cache_set(struct cache_set *c) + if (!IS_ERR_OR_NULL(bcache_debug)) { + char name[50]; + +- snprintf(name, 50, "bcache-%pU", c->sb.set_uuid); ++ snprintf(name, 50, "bcache-%pU", c->set_uuid); + c->debug = debugfs_create_file(name, 0400, bcache_debug, c, + &cache_set_debug_ops); + } +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 1eb55a600ed7..b84487bd8a38 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -1189,8 +1189,8 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c, + struct cached_dev *exist_dc, *t; + int ret = 0; + +- if ((set_uuid && memcmp(set_uuid, c->sb.set_uuid, 16)) || +- (!set_uuid && memcmp(dc->sb.set_uuid, c->sb.set_uuid, 16))) ++ if ((set_uuid && memcmp(set_uuid, c->set_uuid, 16)) || ++ (!set_uuid && memcmp(dc->sb.set_uuid, c->set_uuid, 16))) + return -ENOENT; + + if (dc->disk.c) { +@@ -1262,7 +1262,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c, + u->first_reg = u->last_reg = rtime; + bch_uuid_write(c); + +- memcpy(dc->sb.set_uuid, c->sb.set_uuid, 16); ++ memcpy(dc->sb.set_uuid, c->set_uuid, 16); + SET_BDEV_STATE(&dc->sb, BDEV_STATE_CLEAN); + + bch_write_bdev_super(dc, &cl); +@@ -1324,7 +1324,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c, + pr_info("Caching %s as %s on set %pU\n", + dc->backing_dev_name, + dc->disk.disk->disk_name, +- dc->disk.c->sb.set_uuid); ++ dc->disk.c->set_uuid); + return 0; + } + +@@ -1631,7 +1631,7 @@ bool bch_cache_set_error(struct cache_set *c, const char *fmt, ...) + vaf.va = &args; + + pr_err("error on %pU: %pV, disabling caching\n", +- c->sb.set_uuid, &vaf); ++ c->set_uuid, &vaf); + + va_end(args); + +@@ -1684,7 +1684,7 @@ static void cache_set_free(struct closure *cl) + list_del(&c->list); + mutex_unlock(&bch_register_lock); + +- pr_info("Cache set %pU unregistered\n", c->sb.set_uuid); ++ pr_info("Cache set %pU unregistered\n", c->set_uuid); + wake_up(&unregister_wait); + + closure_debug_destroy(&c->cl); +@@ -1754,7 +1754,7 @@ static void conditional_stop_bcache_device(struct cache_set *c, + { + if (dc->stop_when_cache_set_failed == BCH_CACHED_DEV_STOP_ALWAYS) { + pr_warn("stop_when_cache_set_failed of %s is \"always\", stop it for failed cache set %pU.\n", +- d->disk->disk_name, c->sb.set_uuid); ++ d->disk->disk_name, c->set_uuid); + bcache_device_stop(d); + } else if (atomic_read(&dc->has_dirty)) { + /* +@@ -1861,7 +1861,7 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) + + bch_cache_accounting_init(&c->accounting, &c->cl); + +- memcpy(c->sb.set_uuid, sb->set_uuid, 16); ++ memcpy(c->set_uuid, sb->set_uuid, 16); + c->sb.block_size = sb->block_size; + c->sb.bucket_size = sb->bucket_size; + c->sb.nr_in_set = sb->nr_in_set; +@@ -2144,7 +2144,7 @@ static const char *register_cache_set(struct cache *ca) + struct cache_set *c; + + list_for_each_entry(c, &bch_cache_sets, list) +- if (!memcmp(c->sb.set_uuid, ca->sb.set_uuid, 16)) { ++ if (!memcmp(c->set_uuid, ca->sb.set_uuid, 16)) { + if (c->cache) + return "duplicate cache set member"; + +@@ -2162,7 +2162,7 @@ static const char *register_cache_set(struct cache *ca) + return err; + + err = "error creating kobject"; +- if (kobject_add(&c->kobj, bcache_kobj, "%pU", c->sb.set_uuid) || ++ if (kobject_add(&c->kobj, bcache_kobj, "%pU", c->set_uuid) || + kobject_add(&c->internal, &c->kobj, "internal")) + goto err; + +@@ -2187,7 +2187,7 @@ static const char *register_cache_set(struct cache *ca) + */ + if (ca->sb.seq > c->sb.seq || c->sb.seq == 0) { + c->sb.version = ca->sb.version; +- memcpy(c->sb.set_uuid, ca->sb.set_uuid, 16); ++ memcpy(c->set_uuid, ca->sb.set_uuid, 16); + c->sb.flags = ca->sb.flags; + c->sb.seq = ca->sb.seq; + pr_debug("set version = %llu\n", c->sb.version); +@@ -2702,7 +2702,7 @@ static ssize_t bch_pending_bdevs_cleanup(struct kobject *k, + list_for_each_entry_safe(pdev, tpdev, &pending_devs, list) { + list_for_each_entry_safe(c, tc, &bch_cache_sets, list) { + char *pdev_set_uuid = pdev->dc->sb.set_uuid; +- char *set_uuid = c->sb.uuid; ++ char *set_uuid = c->set_uuid; + + if (!memcmp(pdev_set_uuid, set_uuid, 16)) { + list_del(&pdev->list); +diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h +index 0bddea663b3b..e41c611d6d3b 100644 +--- a/include/trace/events/bcache.h ++++ b/include/trace/events/bcache.h +@@ -164,7 +164,7 @@ TRACE_EVENT(bcache_write, + ), + + TP_fast_assign( +- memcpy(__entry->uuid, c->sb.set_uuid, 16); ++ memcpy(__entry->uuid, c->set_uuid, 16); + __entry->inode = inode; + __entry->sector = bio->bi_iter.bi_sector; + __entry->nr_sector = bio->bi_iter.bi_size >> 9; +@@ -200,7 +200,7 @@ DECLARE_EVENT_CLASS(cache_set, + ), + + TP_fast_assign( +- memcpy(__entry->uuid, c->sb.set_uuid, 16); ++ memcpy(__entry->uuid, c->set_uuid, 16); + ), + + TP_printk("%pU", __entry->uuid) +-- +2.26.2 + diff --git a/patches.suse/0006-bcache-fix-overflow-in-offset_to_stripe.patch b/patches.suse/0006-bcache-fix-overflow-in-offset_to_stripe.patch deleted file mode 100644 index 42a90ff..0000000 --- a/patches.suse/0006-bcache-fix-overflow-in-offset_to_stripe.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 7a1481267999c02abf4a624515c1b5c7c1fccbd6 Mon Sep 17 00:00:00 2001 -From: Coly Li -Date: Sat, 25 Jul 2020 20:00:22 +0800 -Subject: [PATCH] bcache: fix overflow in offset_to_stripe() -Git-commit: 7a1481267999c02abf4a624515c1b5c7c1fccbd6 -Patch-mainline: v5.9-rc1 -References: bsc#1175995, jsc#SLE-15608 - -offset_to_stripe() returns the stripe number (in type unsigned int) from -an offset (in type uint64_t) by the following calculation, - do_div(offset, d->stripe_size); -For large capacity backing device (e.g. 18TB) with small stripe size -(e.g. 4KB), the result is 4831838208 and exceeds UINT_MAX. The actual -returned value which caller receives is 536870912, due to the overflow. - -Indeed in bcache_device_init(), bcache_device->nr_stripes is limited in -range [1, INT_MAX]. Therefore all valid stripe numbers in bcache are -in range [0, bcache_dev->nr_stripes - 1]. - -This patch adds a upper limition check in offset_to_stripe(): the max -valid stripe number should be less than bcache_device->nr_stripes. If -the calculated stripe number from do_div() is equal to or larger than -bcache_device->nr_stripe, -EINVAL will be returned. (Normally nr_stripes -is less than INT_MAX, exceeding upper limitation doesn't mean overflow, -therefore -EOVERFLOW is not used as error code.) - -This patch also changes nr_stripes' type of struct bcache_device from -'unsigned int' to 'int', and return value type of offset_to_stripe() -from 'unsigned int' to 'int', to match their exact data ranges. - -All locations where bcache_device->nr_stripes and offset_to_stripe() are -referenced also get updated for the above type change. - -Reported-and-tested-by: Ken Raeburn -Signed-off-by: Coly Li -Cc: stable@vger.kernel.org -Link: https://bugzilla.redhat.com/show_bug.cgi?id=1783075 -Signed-off-by: Jens Axboe - ---- - drivers/md/bcache/bcache.h | 2 +- - drivers/md/bcache/writeback.c | 14 +++++++++----- - drivers/md/bcache/writeback.h | 19 +++++++++++++++++-- - 3 files changed, 27 insertions(+), 8 deletions(-) - -diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h -index 3c708e8b5e2d..2d1743c0217a 100644 ---- a/drivers/md/bcache/bcache.h -+++ b/drivers/md/bcache/bcache.h -@@ -264,7 +264,7 @@ struct bcache_device { - #define BCACHE_DEV_UNLINK_DONE 2 - #define BCACHE_DEV_WB_RUNNING 3 - #define BCACHE_DEV_RATE_DW_RUNNING 4 -- unsigned int nr_stripes; -+ int nr_stripes; - unsigned int stripe_size; - atomic_t *stripe_sectors_dirty; - unsigned long *full_dirty_stripes; -diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c -index 5397a2c5d6cc..4f4ad6b3d43a 100644 ---- a/drivers/md/bcache/writeback.c -+++ b/drivers/md/bcache/writeback.c -@@ -521,15 +521,19 @@ void bcache_dev_sectors_dirty_add(struct cache_set *c, unsigned int inode, - uint64_t offset, int nr_sectors) - { - struct bcache_device *d = c->devices[inode]; -- unsigned int stripe_offset, stripe, sectors_dirty; -+ unsigned int stripe_offset, sectors_dirty; -+ int stripe; - - if (!d) - return; - -+ stripe = offset_to_stripe(d, offset); -+ if (stripe < 0) -+ return; -+ - if (UUID_FLASH_ONLY(&c->uuids[inode])) - atomic_long_add(nr_sectors, &c->flash_dev_dirty_sectors); - -- stripe = offset_to_stripe(d, offset); - stripe_offset = offset & (d->stripe_size - 1); - - while (nr_sectors) { -@@ -569,12 +573,12 @@ static bool dirty_pred(struct keybuf *buf, struct bkey *k) - static void refill_full_stripes(struct cached_dev *dc) - { - struct keybuf *buf = &dc->writeback_keys; -- unsigned int start_stripe, stripe, next_stripe; -+ unsigned int start_stripe, next_stripe; -+ int stripe; - bool wrapped = false; - - stripe = offset_to_stripe(&dc->disk, KEY_OFFSET(&buf->last_scanned)); -- -- if (stripe >= dc->disk.nr_stripes) -+ if (stripe < 0) - stripe = 0; - - start_stripe = stripe; -diff --git a/drivers/md/bcache/writeback.h b/drivers/md/bcache/writeback.h -index b029843ce5b6..3f1230e22de0 100644 ---- a/drivers/md/bcache/writeback.h -+++ b/drivers/md/bcache/writeback.h -@@ -52,10 +52,22 @@ static inline uint64_t bcache_dev_sectors_dirty(struct bcache_device *d) - return ret; - } - --static inline unsigned int offset_to_stripe(struct bcache_device *d, -+static inline int offset_to_stripe(struct bcache_device *d, - uint64_t offset) - { - do_div(offset, d->stripe_size); -+ -+ /* d->nr_stripes is in range [1, INT_MAX] */ -+ if (unlikely(offset >= d->nr_stripes)) { -+ pr_err("Invalid stripe %llu (>= nr_stripes %d).\n", -+ offset, d->nr_stripes); -+ return -EINVAL; -+ } -+ -+ /* -+ * Here offset is definitly smaller than INT_MAX, -+ * return it as int will never overflow. -+ */ - return offset; - } - -@@ -63,7 +75,10 @@ static inline bool bcache_dev_stripe_dirty(struct cached_dev *dc, - uint64_t offset, - unsigned int nr_sectors) - { -- unsigned int stripe = offset_to_stripe(&dc->disk, offset); -+ int stripe = offset_to_stripe(&dc->disk, offset); -+ -+ if (stripe < 0) -+ return false; - - while (1) { - if (atomic_read(dc->disk.stripe_sectors_dirty + stripe)) --- -2.26.2 - diff --git a/patches.suse/0007-bcache-only-use-block_bytes-on-struct-cache.patch b/patches.suse/0007-bcache-only-use-block_bytes-on-struct-cache.patch new file mode 100644 index 0000000..479d6ba --- /dev/null +++ b/patches.suse/0007-bcache-only-use-block_bytes-on-struct-cache.patch @@ -0,0 +1,263 @@ +From 4e1ebae3ee4e0ce384c33832f66e417a965b64bc Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Thu, 1 Oct 2020 14:50:49 +0800 +Subject: [PATCH] bcache: only use block_bytes() on struct cache +Git-commit: 4e1ebae3ee4e0ce384c33832f66e417a965b64bc +Patch-mainline: v5.10-rc1 +References: git-fixes + +Because struct cache_set and struct cache both have struct cache_sb, +therefore macro block_bytes() can be used on both of them. When removing +the embedded struct cache_sb from struct cache_set, this macro won't be +used on struct cache_set anymore. + +This patch unifies all block_bytes() usage only on struct cache, this is +one of the preparation to remove the embedded struct cache_sb from +struct cache_set. + +Signed-off-by: Coly Li +Reviewed-by: Hannes Reinecke +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/bcache.h | 2 +- + drivers/md/bcache/btree.c | 24 ++++++++++++------------ + drivers/md/bcache/debug.c | 8 ++++---- + drivers/md/bcache/journal.c | 8 ++++---- + drivers/md/bcache/request.c | 2 +- + drivers/md/bcache/super.c | 2 +- + drivers/md/bcache/sysfs.c | 2 +- + 7 files changed, 24 insertions(+), 24 deletions(-) + +diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h +index 94a62acac4fc..29bec61cafbb 100644 +--- a/drivers/md/bcache/bcache.h ++++ b/drivers/md/bcache/bcache.h +@@ -759,7 +759,7 @@ struct bbio { + + #define bucket_pages(c) ((c)->sb.bucket_size / PAGE_SECTORS) + #define bucket_bytes(c) ((c)->sb.bucket_size << 9) +-#define block_bytes(c) ((c)->sb.block_size << 9) ++#define block_bytes(ca) ((ca)->sb.block_size << 9) + + static inline unsigned int meta_bucket_pages(struct cache_sb *sb) + { +diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c +index f626d536981e..1f3d4870a8b2 100644 +--- a/drivers/md/bcache/btree.c ++++ b/drivers/md/bcache/btree.c +@@ -104,7 +104,7 @@ + + static inline struct bset *write_block(struct btree *b) + { +- return ((void *) btree_bset_first(b)) + b->written * block_bytes(b->c); ++ return ((void *) btree_bset_first(b)) + b->written * block_bytes(b->c->cache); + } + + static void bch_btree_init_next(struct btree *b) +@@ -173,7 +173,7 @@ void bch_btree_node_read_done(struct btree *b) + goto err; + + err = "bad btree header"; +- if (b->written + set_blocks(i, block_bytes(b->c)) > ++ if (b->written + set_blocks(i, block_bytes(b->c->cache)) > + btree_blocks(b)) + goto err; + +@@ -199,13 +199,13 @@ void bch_btree_node_read_done(struct btree *b) + + bch_btree_iter_push(iter, i->start, bset_bkey_last(i)); + +- b->written += set_blocks(i, block_bytes(b->c)); ++ b->written += set_blocks(i, block_bytes(b->c->cache)); + } + + err = "corrupted btree"; + for (i = write_block(b); + bset_sector_offset(&b->keys, i) < KEY_SIZE(&b->key); +- i = ((void *) i) + block_bytes(b->c)) ++ i = ((void *) i) + block_bytes(b->c->cache)) + if (i->seq == b->keys.set[0].data->seq) + goto err; + +@@ -347,7 +347,7 @@ static void do_btree_node_write(struct btree *b) + + b->bio->bi_end_io = btree_node_write_endio; + b->bio->bi_private = cl; +- b->bio->bi_iter.bi_size = roundup(set_bytes(i), block_bytes(b->c)); ++ b->bio->bi_iter.bi_size = roundup(set_bytes(i), block_bytes(b->c->cache)); + b->bio->bi_opf = REQ_OP_WRITE | REQ_META | REQ_FUA; + bch_bio_map(b->bio, i); + +@@ -423,10 +423,10 @@ void __bch_btree_node_write(struct btree *b, struct closure *parent) + + do_btree_node_write(b); + +- atomic_long_add(set_blocks(i, block_bytes(b->c)) * b->c->sb.block_size, ++ atomic_long_add(set_blocks(i, block_bytes(b->c->cache)) * b->c->sb.block_size, + &PTR_CACHE(b->c, &b->key, 0)->btree_sectors_written); + +- b->written += set_blocks(i, block_bytes(b->c)); ++ b->written += set_blocks(i, block_bytes(b->c->cache)); + } + + void bch_btree_node_write(struct btree *b, struct closure *parent) +@@ -1344,7 +1344,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, + + if (nodes < 2 || + __set_blocks(b->keys.set[0].data, keys, +- block_bytes(b->c)) > blocks * (nodes - 1)) ++ block_bytes(b->c->cache)) > blocks * (nodes - 1)) + return 0; + + for (i = 0; i < nodes; i++) { +@@ -1378,7 +1378,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, + k = bkey_next(k)) { + if (__set_blocks(n1, n1->keys + keys + + bkey_u64s(k), +- block_bytes(b->c)) > blocks) ++ block_bytes(b->c->cache)) > blocks) + break; + + last = k; +@@ -1394,7 +1394,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, + * though) + */ + if (__set_blocks(n1, n1->keys + n2->keys, +- block_bytes(b->c)) > ++ block_bytes(b->c->cache)) > + btree_blocks(new_nodes[i])) + goto out_unlock_nocoalesce; + +@@ -1403,7 +1403,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, + last = &r->b->key; + } + +- BUG_ON(__set_blocks(n1, n1->keys + keys, block_bytes(b->c)) > ++ BUG_ON(__set_blocks(n1, n1->keys + keys, block_bytes(b->c->cache)) > + btree_blocks(new_nodes[i])); + + if (last) +@@ -2210,7 +2210,7 @@ static int btree_split(struct btree *b, struct btree_op *op, + goto err; + + split = set_blocks(btree_bset_first(n1), +- block_bytes(n1->c)) > (btree_blocks(b) * 4) / 5; ++ block_bytes(n1->c->cache)) > (btree_blocks(b) * 4) / 5; + + if (split) { + unsigned int keys = 0; +diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c +index 0ccc1b0baa42..b00fd08d696b 100644 +--- a/drivers/md/bcache/debug.c ++++ b/drivers/md/bcache/debug.c +@@ -25,8 +25,8 @@ struct dentry *bcache_debug; + for (i = (start); \ + (void *) i < (void *) (start) + (KEY_SIZE(&b->key) << 9) &&\ + i->seq == (start)->seq; \ +- i = (void *) i + set_blocks(i, block_bytes(b->c)) * \ +- block_bytes(b->c)) ++ i = (void *) i + set_blocks(i, block_bytes(b->c->cache)) * \ ++ block_bytes(b->c->cache)) + + void bch_btree_verify(struct btree *b) + { +@@ -82,14 +82,14 @@ void bch_btree_verify(struct btree *b) + + for_each_written_bset(b, ondisk, i) { + unsigned int block = ((void *) i - (void *) ondisk) / +- block_bytes(b->c); ++ block_bytes(b->c->cache); + + pr_err("*** on disk block %u:\n", block); + bch_dump_bset(&b->keys, i, block); + } + + pr_err("*** block %zu not written\n", +- ((void *) i - (void *) ondisk) / block_bytes(b->c)); ++ ((void *) i - (void *) ondisk) / block_bytes(b->c->cache)); + + for (j = 0; j < inmemory->keys; j++) + if (inmemory->d[j] != sorted->d[j]) +diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c +index e89ae7c4ba97..ab0d06e4851d 100644 +--- a/drivers/md/bcache/journal.c ++++ b/drivers/md/bcache/journal.c +@@ -98,7 +98,7 @@ reread: left = ca->sb.bucket_size - offset; + return ret; + } + +- blocks = set_blocks(j, block_bytes(ca->set)); ++ blocks = set_blocks(j, block_bytes(ca)); + + /* + * Nodes in 'list' are in linear increasing order of +@@ -734,7 +734,7 @@ static void journal_write_unlocked(struct closure *cl) + struct cache *ca = c->cache; + struct journal_write *w = c->journal.cur; + struct bkey *k = &c->journal.key; +- unsigned int i, sectors = set_blocks(w->data, block_bytes(c)) * ++ unsigned int i, sectors = set_blocks(w->data, block_bytes(ca)) * + c->sb.block_size; + + struct bio *bio; +@@ -754,7 +754,7 @@ static void journal_write_unlocked(struct closure *cl) + return; + } + +- c->journal.blocks_free -= set_blocks(w->data, block_bytes(c)); ++ c->journal.blocks_free -= set_blocks(w->data, block_bytes(ca)); + + w->data->btree_level = c->root->level; + +@@ -847,7 +847,7 @@ static struct journal_write *journal_wait_for_write(struct cache_set *c, + struct journal_write *w = c->journal.cur; + + sectors = __set_blocks(w->data, w->data->keys + nkeys, +- block_bytes(c)) * c->sb.block_size; ++ block_bytes(c->cache)) * c->sb.block_size; + + if (sectors <= min_t(size_t, + c->journal.blocks_free * c->sb.block_size, +diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c +index 7f54ae223644..d90319d15b59 100644 +--- a/drivers/md/bcache/request.c ++++ b/drivers/md/bcache/request.c +@@ -99,7 +99,7 @@ static int bch_keylist_realloc(struct keylist *l, unsigned int u64s, + * bch_data_insert_keys() will insert the keys created so far + * and finish the rest when the keylist is empty. + */ +- if (newsize * sizeof(uint64_t) > block_bytes(c) - sizeof(struct jset)) ++ if (newsize * sizeof(uint64_t) > block_bytes(c->cache) - sizeof(struct jset)) + return -ENOMEM; + + return __bch_keylist_realloc(l, u64s); +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index b84487bd8a38..7f148489a2d8 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -1527,7 +1527,7 @@ static int flash_dev_run(struct cache_set *c, struct uuid_entry *u) + + kobject_init(&d->kobj, &bch_flash_dev_ktype); + +- if (bcache_device_init(d, block_bytes(c), u->sectors, ++ if (bcache_device_init(d, block_bytes(c->cache), u->sectors, + NULL, &bcache_flash_ops)) + goto err; + +diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c +index ac06c0bc3c0a..b9f524ab5cc8 100644 +--- a/drivers/md/bcache/sysfs.c ++++ b/drivers/md/bcache/sysfs.c +@@ -714,7 +714,7 @@ SHOW(__bch_cache_set) + sysfs_print(synchronous, CACHE_SYNC(&c->sb)); + sysfs_print(journal_delay_ms, c->journal_delay_ms); + sysfs_hprint(bucket_size, bucket_bytes(c)); +- sysfs_hprint(block_size, block_bytes(c)); ++ sysfs_hprint(block_size, block_bytes(c->cache)); + sysfs_print(tree_depth, c->root->level); + sysfs_print(root_usage_percent, bch_root_usage(c)); + +-- +2.26.2 + diff --git a/patches.suse/0008-bcache-remove-useless-alloc_bucket_pages.patch b/patches.suse/0008-bcache-remove-useless-alloc_bucket_pages.patch new file mode 100644 index 0000000..4d99814 --- /dev/null +++ b/patches.suse/0008-bcache-remove-useless-alloc_bucket_pages.patch @@ -0,0 +1,35 @@ +From 421cf1c573b18b0d770a4a47aefa3199eb5b94cf Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Thu, 1 Oct 2020 14:50:50 +0800 +Subject: [PATCH] bcache: remove useless alloc_bucket_pages() +Git-commit: 421cf1c573b18b0d770a4a47aefa3199eb5b94cf +Patch-mainline: v5.10-rc1 +References: git-fixes + +Now no one uses alloc_bucket_pages() anymore, remove it from bcache.h. + +Signed-off-by: Coly Li +Reviewed-by: Hannes Reinecke +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/super.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 7f148489a2d8..3a79790f5fab 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -1831,9 +1831,6 @@ void bch_cache_set_unregister(struct cache_set *c) + bch_cache_set_stop(c); + } + +-#define alloc_bucket_pages(gfp, c) \ +- ((void *) __get_free_pages(__GFP_ZERO|__GFP_COMP|gfp, ilog2(bucket_pages(c)))) +- + #define alloc_meta_bucket_pages(gfp, sb) \ + ((void *) __get_free_pages(__GFP_ZERO|__GFP_COMP|gfp, ilog2(meta_bucket_pages(sb)))) + +-- +2.26.2 + diff --git a/patches.suse/0009-bcache-remove-useless-bucket_pages.patch b/patches.suse/0009-bcache-remove-useless-bucket_pages.patch new file mode 100644 index 0000000..1158ccf --- /dev/null +++ b/patches.suse/0009-bcache-remove-useless-bucket_pages.patch @@ -0,0 +1,35 @@ +From 3c4fae29826c5fc588aba946189b95dd9fb5e4e9 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Thu, 1 Oct 2020 14:50:51 +0800 +Subject: [PATCH] bcache: remove useless bucket_pages() +Git-commit: 3c4fae29826c5fc588aba946189b95dd9fb5e4e9 +Patch-mainline: v5.10-rc1 +References: git-fixes + +It seems alloc_bucket_pages() is the only user of bucket_pages(). +Considering alloc_bucket_pages() is removed from bcache code, it is safe +to remove the useless macro bucket_pages() now. + +Signed-off-by: Coly Li +Reviewed-by: Hannes Reinecke +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/bcache.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h +index 29bec61cafbb..48a2585b6bbb 100644 +--- a/drivers/md/bcache/bcache.h ++++ b/drivers/md/bcache/bcache.h +@@ -757,7 +757,6 @@ struct bbio { + #define btree_default_blocks(c) \ + ((unsigned int) ((PAGE_SECTORS * (c)->btree_pages) >> (c)->block_bits)) + +-#define bucket_pages(c) ((c)->sb.bucket_size / PAGE_SECTORS) + #define bucket_bytes(c) ((c)->sb.bucket_size << 9) + #define block_bytes(ca) ((ca)->sb.block_size << 9) + +-- +2.26.2 + diff --git a/patches.suse/0010-bcache-only-use-bucket_bytes-on-struct-cache.patch b/patches.suse/0010-bcache-only-use-bucket_bytes-on-struct-cache.patch new file mode 100644 index 0000000..c7bdb82 --- /dev/null +++ b/patches.suse/0010-bcache-only-use-bucket_bytes-on-struct-cache.patch @@ -0,0 +1,55 @@ +From 63a96c05cd43ccf66cb671af039c7931a840efe8 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Thu, 1 Oct 2020 14:50:52 +0800 +Subject: [PATCH] bcache: only use bucket_bytes() on struct cache +Git-commit: 63a96c05cd43ccf66cb671af039c7931a840efe8 +Patch-mainline: v5.10-rc1 +References: git-fixes + +Because struct cache_set and struct cache both have struct cache_sb, +macro bucket_bytes() currently are used on both of them. When removing +the embedded struct cache_sb from struct cache_set, this macro won't be +used on struct cache_set anymore. + +This patch unifies all bucket_bytes() usage only on struct cache, this is +one of the preparation to remove the embedded struct cache_sb from +struct cache_set. + +Signed-off-by: Coly Li +Reviewed-by: Hannes Reinecke +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/bcache.h | 2 +- + drivers/md/bcache/sysfs.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h +index 48a2585b6bbb..94d4baf4c405 100644 +--- a/drivers/md/bcache/bcache.h ++++ b/drivers/md/bcache/bcache.h +@@ -757,7 +757,7 @@ struct bbio { + #define btree_default_blocks(c) \ + ((unsigned int) ((PAGE_SECTORS * (c)->btree_pages) >> (c)->block_bits)) + +-#define bucket_bytes(c) ((c)->sb.bucket_size << 9) ++#define bucket_bytes(ca) ((ca)->sb.bucket_size << 9) + #define block_bytes(ca) ((ca)->sb.block_size << 9) + + static inline unsigned int meta_bucket_pages(struct cache_sb *sb) +diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c +index b9f524ab5cc8..4bfe98faadcc 100644 +--- a/drivers/md/bcache/sysfs.c ++++ b/drivers/md/bcache/sysfs.c +@@ -713,7 +713,7 @@ SHOW(__bch_cache_set) + + sysfs_print(synchronous, CACHE_SYNC(&c->sb)); + sysfs_print(journal_delay_ms, c->journal_delay_ms); +- sysfs_hprint(bucket_size, bucket_bytes(c)); ++ sysfs_hprint(bucket_size, bucket_bytes(c->cache)); + sysfs_hprint(block_size, block_bytes(c->cache)); + sysfs_print(tree_depth, c->root->level); + sysfs_print(root_usage_percent, bch_root_usage(c)); +-- +2.26.2 + diff --git a/patches.suse/0011-bcache-don-t-check-seq-numbers-in-register_cache_set.patch b/patches.suse/0011-bcache-don-t-check-seq-numbers-in-register_cache_set.patch new file mode 100644 index 0000000..3d8c913 --- /dev/null +++ b/patches.suse/0011-bcache-don-t-check-seq-numbers-in-register_cache_set.patch @@ -0,0 +1,57 @@ +From 08a17828812adbe965b7af9a0e3e6a6024460cc8 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Thu, 1 Oct 2020 14:50:53 +0800 +Subject: [PATCH] bcache: don't check seq numbers in register_cache_set() +Git-commit: 08a17828812adbe965b7af9a0e3e6a6024460cc8 +Patch-mainline: v5.10-rc1 +References: git-fixes + +In order to update the partial super block of cache set, the seq numbers +of cache and cache set are checked in register_cache_set(). If cache's +seq number is larger than cache set's seq number, cache set must update +its partial super block from cache's super block. It is unncessary when +the embedded struct cache_sb is removed from struct cache set. + +This patch removed the seq numbers checking from register_cache_set(), +because later there will be no such partial super block in struct cache +set, the cache set will directly reference in-memory super block from +struct cache. This is a preparation patch for removing embedded struct +cache_sb from struct cache_set. + +Signed-off-by: Coly Li +Reviewed-by: Hannes Reinecke +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/super.c | 15 --------------- + 1 file changed, 15 deletions(-) + +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 3a79790f5fab..291a3d4a4591 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -2175,21 +2175,6 @@ static const char *register_cache_set(struct cache *ca) + sysfs_create_link(&c->kobj, &ca->kobj, buf)) + goto err; + +- /* +- * A special case is both ca->sb.seq and c->sb.seq are 0, +- * such condition happens on a new created cache device whose +- * super block is never flushed yet. In this case c->sb.version +- * and other members should be updated too, otherwise we will +- * have a mistaken super block version in cache set. +- */ +- if (ca->sb.seq > c->sb.seq || c->sb.seq == 0) { +- c->sb.version = ca->sb.version; +- memcpy(c->set_uuid, ca->sb.set_uuid, 16); +- c->sb.flags = ca->sb.flags; +- c->sb.seq = ca->sb.seq; +- pr_debug("set version = %llu\n", c->sb.version); +- } +- + kobject_get(&ca->kobj); + ca->set = c; + ca->set->cache = ca; +-- +2.26.2 + diff --git a/patches.suse/0012-bcache-remove-can_attach_cache.patch b/patches.suse/0012-bcache-remove-can_attach_cache.patch new file mode 100644 index 0000000..6c93ea2 --- /dev/null +++ b/patches.suse/0012-bcache-remove-can_attach_cache.patch @@ -0,0 +1,55 @@ +From ebaa1ac12b0c97337a5bad1d57334056791aaa88 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Thu, 1 Oct 2020 14:50:54 +0800 +Subject: [PATCH] bcache: remove can_attach_cache() +Git-commit: ebaa1ac12b0c97337a5bad1d57334056791aaa88 +Patch-mainline: v5.10-rc1 +References: git-fixes + +After removing the embedded struct cache_sb from struct cache_set, cache +set will directly reference the in-memory super block of struct cache. +It is unnecessary to compare block_size, bucket_size and nr_in_set from +the identical in-memory super block in can_attach_cache(). + +This is a preparation patch for latter removing cache_set->sb from +struct cache_set. + +Signed-off-by: Coly Li +Reviewed-by: Hannes Reinecke +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/super.c | 10 ---------- + 1 file changed, 10 deletions(-) + +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 291a3d4a4591..1450c06a0e6e 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -2127,13 +2127,6 @@ static int run_cache_set(struct cache_set *c) + return -EIO; + } + +-static bool can_attach_cache(struct cache *ca, struct cache_set *c) +-{ +- return ca->sb.block_size == c->sb.block_size && +- ca->sb.bucket_size == c->sb.bucket_size && +- ca->sb.nr_in_set == c->sb.nr_in_set; +-} +- + static const char *register_cache_set(struct cache *ca) + { + char buf[12]; +@@ -2145,9 +2138,6 @@ static const char *register_cache_set(struct cache *ca) + if (c->cache) + return "duplicate cache set member"; + +- if (!can_attach_cache(ca, c)) +- return "cache sb does not match set"; +- + if (!CACHE_SYNC(&ca->sb)) + SET_CACHE_SYNC(&c->sb, false); + +-- +2.26.2 + diff --git a/patches.suse/0013-bcache-check-and-set-sync-status-on-cache-s-in-memor.patch b/patches.suse/0013-bcache-check-and-set-sync-status-on-cache-s-in-memor.patch new file mode 100644 index 0000000..27fc173 --- /dev/null +++ b/patches.suse/0013-bcache-check-and-set-sync-status-on-cache-s-in-memor.patch @@ -0,0 +1,115 @@ +From 6f9414e0f6f35c7669dad5ac1a838ce323302f03 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Thu, 1 Oct 2020 14:50:55 +0800 +Subject: [PATCH] bcache: check and set sync status on cache's in-memory super + block +Git-commit: 6f9414e0f6f35c7669dad5ac1a838ce323302f03 +Patch-mainline: v5.10-rc1 +References: git-fixes + +Currently the cache's sync status is checked and set on cache set's in- +memory partial super block. After removing the embedded struct cache_sb +from cache set and reference cache's in-memory super block from struct +cache_set, the sync status can set and check directly on cache's super +block. + +This patch checks and sets the cache sync status directly on cache's +in-memory super block. This is a preparation for later removing embedded +struct cache_sb from struct cache_set. + +Signed-off-by: Coly Li +Reviewed-by: Hannes Reinecke +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/alloc.c | 2 +- + drivers/md/bcache/journal.c | 2 +- + drivers/md/bcache/super.c | 7 ++----- + drivers/md/bcache/sysfs.c | 6 +++--- + 4 files changed, 7 insertions(+), 10 deletions(-) + +diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c +index 1b8310992dd0..65fdbdeb5134 100644 +--- a/drivers/md/bcache/alloc.c ++++ b/drivers/md/bcache/alloc.c +@@ -361,7 +361,7 @@ static int bch_allocator_thread(void *arg) + * new stuff to them: + */ + allocator_wait(ca, !atomic_read(&ca->set->prio_blocked)); +- if (CACHE_SYNC(&ca->set->sb)) { ++ if (CACHE_SYNC(&ca->sb)) { + /* + * This could deadlock if an allocation with a btree + * node locked ever blocked - having the btree node +diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c +index ab0d06e4851d..cd46f33db507 100644 +--- a/drivers/md/bcache/journal.c ++++ b/drivers/md/bcache/journal.c +@@ -915,7 +915,7 @@ atomic_t *bch_journal(struct cache_set *c, + if (unlikely(test_bit(CACHE_SET_IO_DISABLE, &c->flags))) + return NULL; + +- if (!CACHE_SYNC(&c->sb)) ++ if (!CACHE_SYNC(&c->cache->sb)) + return NULL; + + w = journal_wait_for_write(c, bch_keylist_nkeys(keys)); +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 1450c06a0e6e..96323406fa6f 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -1969,7 +1969,7 @@ static int run_cache_set(struct cache_set *c) + c->nbuckets = ca->sb.nbuckets; + set_gc_sectors(c); + +- if (CACHE_SYNC(&c->sb)) { ++ if (CACHE_SYNC(&c->cache->sb)) { + struct bkey *k; + struct jset *j; + +@@ -2092,7 +2092,7 @@ static int run_cache_set(struct cache_set *c) + * everything is set up - fortunately journal entries won't be + * written until the SET_CACHE_SYNC() here: + */ +- SET_CACHE_SYNC(&c->sb, true); ++ SET_CACHE_SYNC(&c->cache->sb, true); + + bch_journal_next(&c->journal); + bch_journal_meta(c, &cl); +@@ -2138,9 +2138,6 @@ static const char *register_cache_set(struct cache *ca) + if (c->cache) + return "duplicate cache set member"; + +- if (!CACHE_SYNC(&ca->sb)) +- SET_CACHE_SYNC(&c->sb, false); +- + goto found; + } + +diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c +index 4bfe98faadcc..554e3afc9b68 100644 +--- a/drivers/md/bcache/sysfs.c ++++ b/drivers/md/bcache/sysfs.c +@@ -711,7 +711,7 @@ SHOW(__bch_cache_set) + { + struct cache_set *c = container_of(kobj, struct cache_set, kobj); + +- sysfs_print(synchronous, CACHE_SYNC(&c->sb)); ++ sysfs_print(synchronous, CACHE_SYNC(&c->cache->sb)); + sysfs_print(journal_delay_ms, c->journal_delay_ms); + sysfs_hprint(bucket_size, bucket_bytes(c->cache)); + sysfs_hprint(block_size, block_bytes(c->cache)); +@@ -812,8 +812,8 @@ STORE(__bch_cache_set) + if (attr == &sysfs_synchronous) { + bool sync = strtoul_or_return(buf); + +- if (sync != CACHE_SYNC(&c->sb)) { +- SET_CACHE_SYNC(&c->sb, sync); ++ if (sync != CACHE_SYNC(&c->cache->sb)) { ++ SET_CACHE_SYNC(&c->cache->sb, sync); + bcache_write_super(c); + } + } +-- +2.26.2 + diff --git a/patches.suse/0014-bcache-remove-embedded-struct-cache_sb-from-struct-c.patch b/patches.suse/0014-bcache-remove-embedded-struct-cache_sb-from-struct-c.patch new file mode 100644 index 0000000..4c49ed8 --- /dev/null +++ b/patches.suse/0014-bcache-remove-embedded-struct-cache_sb-from-struct-c.patch @@ -0,0 +1,473 @@ +From 4a784266c6a75f375e08915b35e909df19eff17f Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Thu, 1 Oct 2020 14:50:56 +0800 +Subject: [PATCH] bcache: remove embedded struct cache_sb from struct cache_set +Git-commit: 4a784266c6a75f375e08915b35e909df19eff17f +Patch-mainline: v5.10-rc1 +References: git-fixes + +Since bcache code was merged into mainline kerrnel, each cache set only +as one single cache in it. The multiple caches framework is here but the +code is far from completed. Considering the multiple copies of cached +data can also be stored on e.g. md raid1 devices, it is unnecessary to +support multiple caches in one cache set indeed. + +The previous preparation patches fix the dependencies of explicitly +making a cache set only have single cache. Now we don't have to maintain +an embedded partial super block in struct cache_set, the in-memory super +block can be directly referenced from struct cache. + +This patch removes the embedded struct cache_sb from struct cache_set, +and fixes all locations where the superb lock was referenced from this +removed super block by referencing the in-memory super block of struct +cache. + +Signed-off-by: Coly Li +Reviewed-by: Hannes Reinecke +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/alloc.c | 6 ++--- + drivers/md/bcache/bcache.h | 4 +-- + drivers/md/bcache/btree.c | 17 +++++++------ + drivers/md/bcache/btree.h | 2 +- + drivers/md/bcache/extents.c | 6 ++--- + drivers/md/bcache/features.c | 4 +-- + drivers/md/bcache/io.c | 2 +- + drivers/md/bcache/journal.c | 11 ++++---- + drivers/md/bcache/request.c | 4 +-- + drivers/md/bcache/super.c | 47 +++++++++++++---------------------- + drivers/md/bcache/writeback.c | 2 +- + 11 files changed, 46 insertions(+), 59 deletions(-) + +diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c +index 65fdbdeb5134..8c371d5eef8e 100644 +--- a/drivers/md/bcache/alloc.c ++++ b/drivers/md/bcache/alloc.c +@@ -87,7 +87,7 @@ void bch_rescale_priorities(struct cache_set *c, int sectors) + { + struct cache *ca; + struct bucket *b; +- unsigned long next = c->nbuckets * c->sb.bucket_size / 1024; ++ unsigned long next = c->nbuckets * c->cache->sb.bucket_size / 1024; + int r; + + atomic_sub(sectors, &c->rescale); +@@ -583,7 +583,7 @@ static struct open_bucket *pick_data_bucket(struct cache_set *c, + struct open_bucket, list); + found: + if (!ret->sectors_free && KEY_PTRS(alloc)) { +- ret->sectors_free = c->sb.bucket_size; ++ ret->sectors_free = c->cache->sb.bucket_size; + bkey_copy(&ret->key, alloc); + bkey_init(alloc); + } +@@ -677,7 +677,7 @@ bool bch_alloc_sectors(struct cache_set *c, + &PTR_CACHE(c, &b->key, i)->sectors_written); + } + +- if (b->sectors_free < c->sb.block_size) ++ if (b->sectors_free < c->cache->sb.block_size) + b->sectors_free = 0; + + /* +diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h +index 94d4baf4c405..1d57f48307e6 100644 +--- a/drivers/md/bcache/bcache.h ++++ b/drivers/md/bcache/bcache.h +@@ -517,8 +517,6 @@ struct cache_set { + atomic_t idle_counter; + atomic_t at_max_writeback_rate; + +- struct cache_sb sb; +- + struct cache *cache; + + struct bcache_device **devices; +@@ -799,7 +797,7 @@ static inline sector_t bucket_to_sector(struct cache_set *c, size_t b) + + static inline sector_t bucket_remainder(struct cache_set *c, sector_t s) + { +- return s & (c->sb.bucket_size - 1); ++ return s & (c->cache->sb.bucket_size - 1); + } + + static inline struct cache *PTR_CACHE(struct cache_set *c, +diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c +index 1f3d4870a8b2..910df242c83d 100644 +--- a/drivers/md/bcache/btree.c ++++ b/drivers/md/bcache/btree.c +@@ -117,7 +117,7 @@ static void bch_btree_init_next(struct btree *b) + + if (b->written < btree_blocks(b)) + bch_bset_init_next(&b->keys, write_block(b), +- bset_magic(&b->c->sb)); ++ bset_magic(&b->c->cache->sb)); + + } + +@@ -155,7 +155,7 @@ void bch_btree_node_read_done(struct btree *b) + * See the comment arount cache_set->fill_iter. + */ + iter = mempool_alloc(&b->c->fill_iter, GFP_NOIO); +- iter->size = b->c->sb.bucket_size / b->c->sb.block_size; ++ iter->size = b->c->cache->sb.bucket_size / b->c->cache->sb.block_size; + iter->used = 0; + + #ifdef CONFIG_BCACHE_DEBUG +@@ -178,7 +178,7 @@ void bch_btree_node_read_done(struct btree *b) + goto err; + + err = "bad magic"; +- if (i->magic != bset_magic(&b->c->sb)) ++ if (i->magic != bset_magic(&b->c->cache->sb)) + goto err; + + err = "bad checksum"; +@@ -219,7 +219,7 @@ void bch_btree_node_read_done(struct btree *b) + + if (b->written < btree_blocks(b)) + bch_bset_init_next(&b->keys, write_block(b), +- bset_magic(&b->c->sb)); ++ bset_magic(&b->c->cache->sb)); + out: + mempool_free(iter, &b->c->fill_iter); + return; +@@ -423,7 +423,7 @@ void __bch_btree_node_write(struct btree *b, struct closure *parent) + + do_btree_node_write(b); + +- atomic_long_add(set_blocks(i, block_bytes(b->c->cache)) * b->c->sb.block_size, ++ atomic_long_add(set_blocks(i, block_bytes(b->c->cache)) * b->c->cache->sb.block_size, + &PTR_CACHE(b->c, &b->key, 0)->btree_sectors_written); + + b->written += set_blocks(i, block_bytes(b->c->cache)); +@@ -738,7 +738,7 @@ void bch_btree_cache_free(struct cache_set *c) + if (c->verify_data) + list_move(&c->verify_data->list, &c->btree_cache); + +- free_pages((unsigned long) c->verify_ondisk, ilog2(meta_bucket_pages(&c->sb))); ++ free_pages((unsigned long) c->verify_ondisk, ilog2(meta_bucket_pages(&c->cache->sb))); + #endif + + list_splice(&c->btree_cache_freeable, +@@ -785,7 +785,8 @@ int bch_btree_cache_alloc(struct cache_set *c) + mutex_init(&c->verify_lock); + + c->verify_ondisk = (void *) +- __get_free_pages(GFP_KERNEL|__GFP_COMP, ilog2(meta_bucket_pages(&c->sb))); ++ __get_free_pages(GFP_KERNEL|__GFP_COMP, ++ ilog2(meta_bucket_pages(&c->cache->sb))); + if (!c->verify_ondisk) { + /* + * Don't worry about the mca_rereserve buckets +@@ -1108,7 +1109,7 @@ struct btree *__bch_btree_node_alloc(struct cache_set *c, struct btree_op *op, + } + + b->parent = parent; +- bch_bset_init_next(&b->keys, b->keys.set->data, bset_magic(&b->c->sb)); ++ bch_bset_init_next(&b->keys, b->keys.set->data, bset_magic(&b->c->cache->sb)); + + mutex_unlock(&c->bucket_lock); + +diff --git a/drivers/md/bcache/btree.h b/drivers/md/bcache/btree.h +index 257969980c49..50482107134f 100644 +--- a/drivers/md/bcache/btree.h ++++ b/drivers/md/bcache/btree.h +@@ -194,7 +194,7 @@ static inline unsigned int bset_block_offset(struct btree *b, struct bset *i) + + static inline void set_gc_sectors(struct cache_set *c) + { +- atomic_set(&c->sectors_to_gc, c->sb.bucket_size * c->nbuckets / 16); ++ atomic_set(&c->sectors_to_gc, c->cache->sb.bucket_size * c->nbuckets / 16); + } + + void bkey_put(struct cache_set *c, struct bkey *k); +diff --git a/drivers/md/bcache/extents.c b/drivers/md/bcache/extents.c +index 9162af5bb6ec..f4658a1f37b8 100644 +--- a/drivers/md/bcache/extents.c ++++ b/drivers/md/bcache/extents.c +@@ -54,7 +54,7 @@ static bool __ptr_invalid(struct cache_set *c, const struct bkey *k) + size_t bucket = PTR_BUCKET_NR(c, k, i); + size_t r = bucket_remainder(c, PTR_OFFSET(k, i)); + +- if (KEY_SIZE(k) + r > c->sb.bucket_size || ++ if (KEY_SIZE(k) + r > c->cache->sb.bucket_size || + bucket < ca->sb.first_bucket || + bucket >= ca->sb.nbuckets) + return true; +@@ -75,7 +75,7 @@ static const char *bch_ptr_status(struct cache_set *c, const struct bkey *k) + size_t bucket = PTR_BUCKET_NR(c, k, i); + size_t r = bucket_remainder(c, PTR_OFFSET(k, i)); + +- if (KEY_SIZE(k) + r > c->sb.bucket_size) ++ if (KEY_SIZE(k) + r > c->cache->sb.bucket_size) + return "bad, length too big"; + if (bucket < ca->sb.first_bucket) + return "bad, short offset"; +@@ -136,7 +136,7 @@ static void bch_bkey_dump(struct btree_keys *keys, const struct bkey *k) + size_t n = PTR_BUCKET_NR(b->c, k, j); + + pr_cont(" bucket %zu", n); +- if (n >= b->c->sb.first_bucket && n < b->c->sb.nbuckets) ++ if (n >= b->c->cache->sb.first_bucket && n < b->c->cache->sb.nbuckets) + pr_cont(" prio %i", + PTR_BUCKET(b->c, k, j)->prio); + } +diff --git a/drivers/md/bcache/features.c b/drivers/md/bcache/features.c +index 4442df48d28c..6469223f0b77 100644 +--- a/drivers/md/bcache/features.c ++++ b/drivers/md/bcache/features.c +@@ -30,7 +30,7 @@ static struct feature feature_list[] = { + for (f = &feature_list[0]; f->compat != 0; f++) { \ + if (f->compat != BCH_FEATURE_ ## type) \ + continue; \ +- if (BCH_HAS_ ## type ## _FEATURE(&c->sb, f->mask)) { \ ++ if (BCH_HAS_ ## type ## _FEATURE(&c->cache->sb, f->mask)) { \ + if (first) { \ + out += snprintf(out, buf + size - out, \ + "["); \ +@@ -44,7 +44,7 @@ static struct feature feature_list[] = { + \ + out += snprintf(out, buf + size - out, "%s", f->string);\ + \ +- if (BCH_HAS_ ## type ## _FEATURE(&c->sb, f->mask)) \ ++ if (BCH_HAS_ ## type ## _FEATURE(&c->cache->sb, f->mask)) \ + out += snprintf(out, buf + size - out, "]"); \ + \ + first = false; \ +diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c +index a14a445618b4..dad71a6b7889 100644 +--- a/drivers/md/bcache/io.c ++++ b/drivers/md/bcache/io.c +@@ -26,7 +26,7 @@ struct bio *bch_bbio_alloc(struct cache_set *c) + struct bbio *b = mempool_alloc(&c->bio_meta, GFP_NOIO); + struct bio *bio = &b->bio; + +- bio_init(bio, bio->bi_inline_vecs, meta_bucket_pages(&c->sb)); ++ bio_init(bio, bio->bi_inline_vecs, meta_bucket_pages(&c->cache->sb)); + + return bio; + } +diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c +index cd46f33db507..aefbdb7e003b 100644 +--- a/drivers/md/bcache/journal.c ++++ b/drivers/md/bcache/journal.c +@@ -666,7 +666,7 @@ static void journal_reclaim(struct cache_set *c) + + bkey_init(k); + SET_KEY_PTRS(k, 1); +- c->journal.blocks_free = c->sb.bucket_size >> c->block_bits; ++ c->journal.blocks_free = ca->sb.bucket_size >> c->block_bits; + + out: + if (!journal_full(&c->journal)) +@@ -735,7 +735,7 @@ static void journal_write_unlocked(struct closure *cl) + struct journal_write *w = c->journal.cur; + struct bkey *k = &c->journal.key; + unsigned int i, sectors = set_blocks(w->data, block_bytes(ca)) * +- c->sb.block_size; ++ ca->sb.block_size; + + struct bio *bio; + struct bio_list list; +@@ -762,7 +762,7 @@ static void journal_write_unlocked(struct closure *cl) + bkey_copy(&w->data->uuid_bucket, &c->uuid_bucket); + + w->data->prio_bucket[ca->sb.nr_this_dev] = ca->prio_buckets[0]; +- w->data->magic = jset_magic(&c->sb); ++ w->data->magic = jset_magic(&ca->sb); + w->data->version = BCACHE_JSET_VERSION; + w->data->last_seq = last_seq(&c->journal); + w->data->csum = csum_set(w->data); +@@ -838,6 +838,7 @@ static struct journal_write *journal_wait_for_write(struct cache_set *c, + size_t sectors; + struct closure cl; + bool wait = false; ++ struct cache *ca = c->cache; + + closure_init_stack(&cl); + +@@ -847,10 +848,10 @@ static struct journal_write *journal_wait_for_write(struct cache_set *c, + struct journal_write *w = c->journal.cur; + + sectors = __set_blocks(w->data, w->data->keys + nkeys, +- block_bytes(c->cache)) * c->sb.block_size; ++ block_bytes(ca)) * ca->sb.block_size; + + if (sectors <= min_t(size_t, +- c->journal.blocks_free * c->sb.block_size, ++ c->journal.blocks_free * ca->sb.block_size, + PAGE_SECTORS << JSET_BITS)) + return w; + +diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c +index d90319d15b59..214326383145 100644 +--- a/drivers/md/bcache/request.c ++++ b/drivers/md/bcache/request.c +@@ -394,8 +394,8 @@ static bool check_should_bypass(struct cached_dev *dc, struct bio *bio) + goto skip; + } + +- if (bio->bi_iter.bi_sector & (c->sb.block_size - 1) || +- bio_sectors(bio) & (c->sb.block_size - 1)) { ++ if (bio->bi_iter.bi_sector & (c->cache->sb.block_size - 1) || ++ bio_sectors(bio) & (c->cache->sb.block_size - 1)) { + pr_debug("skipping unaligned io\n"); + goto skip; + } +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 96323406fa6f..46a00134a36a 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -350,16 +350,10 @@ void bcache_write_super(struct cache_set *c) + down(&c->sb_write_mutex); + closure_init(cl, &c->cl); + +- c->sb.seq++; ++ ca->sb.seq++; + +- if (c->sb.version > version) +- version = c->sb.version; +- +- ca->sb.version = version; +- ca->sb.seq = c->sb.seq; +- ca->sb.last_mount = c->sb.last_mount; +- +- SET_CACHE_SYNC(&ca->sb, CACHE_SYNC(&c->sb)); ++ if (ca->sb.version < version) ++ ca->sb.version = version; + + bio_init(bio, ca->sb_bv, 1); + bio_set_dev(bio, ca->bdev); +@@ -477,7 +471,7 @@ static int __uuid_write(struct cache_set *c) + { + BKEY_PADDED(key) k; + struct closure cl; +- struct cache *ca; ++ struct cache *ca = c->cache; + unsigned int size; + + closure_init_stack(&cl); +@@ -486,13 +480,12 @@ static int __uuid_write(struct cache_set *c) + if (bch_bucket_alloc_set(c, RESERVE_BTREE, &k.key, true)) + return 1; + +- size = meta_bucket_pages(&c->sb) * PAGE_SECTORS; ++ size = meta_bucket_pages(&ca->sb) * PAGE_SECTORS; + SET_KEY_SIZE(&k.key, size); + uuid_io(c, REQ_OP_WRITE, 0, &k.key, &cl); + closure_sync(&cl); + + /* Only one bucket used for uuid write */ +- ca = PTR_CACHE(c, &k.key, 0); + atomic_long_add(ca->sb.bucket_size, &ca->meta_sectors_written); + + bkey_copy(&c->uuid_bucket, &k.key); +@@ -1205,7 +1198,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c, + return -EINVAL; + } + +- if (dc->sb.block_size < c->sb.block_size) { ++ if (dc->sb.block_size < c->cache->sb.block_size) { + /* Will die */ + pr_err("Couldn't attach %s: block size less than set's block size\n", + dc->backing_dev_name); +@@ -1663,6 +1656,9 @@ static void cache_set_free(struct closure *cl) + bch_journal_free(c); + + mutex_lock(&bch_register_lock); ++ bch_bset_sort_state_free(&c->sort); ++ free_pages((unsigned long) c->uuids, ilog2(meta_bucket_pages(&c->cache->sb))); ++ + ca = c->cache; + if (ca) { + ca->set = NULL; +@@ -1670,8 +1666,6 @@ static void cache_set_free(struct closure *cl) + kobject_put(&ca->kobj); + } + +- bch_bset_sort_state_free(&c->sort); +- free_pages((unsigned long) c->uuids, ilog2(meta_bucket_pages(&c->sb))); + + if (c->moving_gc_wq) + destroy_workqueue(c->moving_gc_wq); +@@ -1837,6 +1831,7 @@ void bch_cache_set_unregister(struct cache_set *c) + struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) + { + int iter_size; ++ struct cache *ca = container_of(sb, struct cache, sb); + struct cache_set *c = kzalloc(sizeof(struct cache_set), GFP_KERNEL); + + if (!c) +@@ -1859,23 +1854,15 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) + bch_cache_accounting_init(&c->accounting, &c->cl); + + memcpy(c->set_uuid, sb->set_uuid, 16); +- c->sb.block_size = sb->block_size; +- c->sb.bucket_size = sb->bucket_size; +- c->sb.nr_in_set = sb->nr_in_set; +- c->sb.last_mount = sb->last_mount; +- c->sb.version = sb->version; +- if (c->sb.version >= BCACHE_SB_VERSION_CDEV_WITH_FEATURES) { +- c->sb.feature_compat = sb->feature_compat; +- c->sb.feature_ro_compat = sb->feature_ro_compat; +- c->sb.feature_incompat = sb->feature_incompat; +- } + ++ c->cache = ca; ++ c->cache->set = c; + c->bucket_bits = ilog2(sb->bucket_size); + c->block_bits = ilog2(sb->block_size); +- c->nr_uuids = meta_bucket_bytes(&c->sb) / sizeof(struct uuid_entry); ++ c->nr_uuids = meta_bucket_bytes(sb) / sizeof(struct uuid_entry); + c->devices_max_used = 0; + atomic_set(&c->attached_dev_nr, 0); +- c->btree_pages = meta_bucket_pages(&c->sb); ++ c->btree_pages = meta_bucket_pages(sb); + if (c->btree_pages > BTREE_MAX_PAGES) + c->btree_pages = max_t(int, c->btree_pages / 4, + BTREE_MAX_PAGES); +@@ -1913,7 +1900,7 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) + + if (mempool_init_kmalloc_pool(&c->bio_meta, 2, + sizeof(struct bbio) + +- sizeof(struct bio_vec) * meta_bucket_pages(&c->sb))) ++ sizeof(struct bio_vec) * meta_bucket_pages(sb))) + goto err; + + if (mempool_init_kmalloc_pool(&c->fill_iter, 1, iter_size)) +@@ -1923,7 +1910,7 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) + BIOSET_NEED_BVECS|BIOSET_NEED_RESCUER)) + goto err; + +- c->uuids = alloc_meta_bucket_pages(GFP_KERNEL, &c->sb); ++ c->uuids = alloc_meta_bucket_pages(GFP_KERNEL, sb); + if (!c->uuids) + goto err; + +@@ -2103,7 +2090,7 @@ static int run_cache_set(struct cache_set *c) + goto err; + + closure_sync(&cl); +- c->sb.last_mount = (u32)ktime_get_real_seconds(); ++ c->cache->sb.last_mount = (u32)ktime_get_real_seconds(); + bcache_write_super(c); + + list_for_each_entry_safe(dc, t, &uncached_devices, list) +diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c +index 4f4ad6b3d43a..3c74996978da 100644 +--- a/drivers/md/bcache/writeback.c ++++ b/drivers/md/bcache/writeback.c +@@ -35,7 +35,7 @@ static uint64_t __calc_target_rate(struct cached_dev *dc) + * This is the size of the cache, minus the amount used for + * flash-only devices + */ +- uint64_t cache_sectors = c->nbuckets * c->sb.bucket_size - ++ uint64_t cache_sectors = c->nbuckets * c->cache->sb.bucket_size - + atomic_long_read(&c->flash_dev_dirty_sectors); + + /* +-- +2.26.2 + diff --git a/patches.suse/0015-md-fix-the-checking-of-wrong-work-queue.patch b/patches.suse/0015-md-fix-the-checking-of-wrong-work-queue.patch new file mode 100644 index 0000000..864d7c3 --- /dev/null +++ b/patches.suse/0015-md-fix-the-checking-of-wrong-work-queue.patch @@ -0,0 +1,36 @@ +From cf0b9b4821a2955f8a23813ef8f422208ced9bd7 Mon Sep 17 00:00:00 2001 +From: Guoqing Jiang +Date: Thu, 8 Oct 2020 05:19:09 +0200 +Subject: [PATCH] md: fix the checking of wrong work queue +Git-commit: cf0b9b4821a2955f8a23813ef8f422208ced9bd7 +Patch-mainline: v5.10-rc1 +References: git-fixes + +It should check md_rdev_misc_wq instead of md_misc_wq. + +Fixes: cc1ffe61c026 ("md: add new workqueue for delete rdev") +Cc: # v5.8+ +Signed-off-by: Guoqing Jiang +Signed-off-by: Song Liu +Signed-off-by: Coly Li + +--- + drivers/md/md.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/md/md.c b/drivers/md/md.c +index dfff4bb2bb20..f1c6304c79f4 100644 +--- a/drivers/md/md.c ++++ b/drivers/md/md.c +@@ -9565,7 +9565,7 @@ static int __init md_init(void) + goto err_misc_wq; + + md_rdev_misc_wq = alloc_workqueue("md_rdev_misc", 0, 0); +- if (!md_misc_wq) ++ if (!md_rdev_misc_wq) + goto err_rdev_misc_wq; + + if ((ret = register_blkdev(MD_MAJOR, "md")) < 0) +-- +2.26.2 + diff --git a/patches.suse/0016-dm-fix-missing-imposition-of-queue_limits-from-dm_wq.patch b/patches.suse/0016-dm-fix-missing-imposition-of-queue_limits-from-dm_wq.patch new file mode 100644 index 0000000..899a2a9 --- /dev/null +++ b/patches.suse/0016-dm-fix-missing-imposition-of-queue_limits-from-dm_wq.patch @@ -0,0 +1,100 @@ +From 0c2915b8c6db108b1dfb240391cc5a175f97f15b Mon Sep 17 00:00:00 2001 +From: Mike Snitzer +Date: Mon, 28 Sep 2020 13:41:36 -0400 +Subject: [PATCH] dm: fix missing imposition of queue_limits from dm_wq_work() + thread +Git-commit: 0c2915b8c6db108b1dfb240391cc5a175f97f15b +Patch-mainline: v5.10-rc1 +References: git-fixes + +If a DM device was suspended when bios were issued to it, those bios +would be deferred using queue_io(). Once the DM device was resumed +dm_process_bio() could be called by dm_wq_work() for original bio that +still needs splitting. dm_process_bio()'s check for current->bio_list +(meaning call chain is within ->submit_bio) as a prerequisite for +calling blk_queue_split() for "abnormal IO" would result in +dm_process_bio() never imposing corresponding queue_limits +(e.g. discard_granularity, discard_max_bytes, etc). + +Fix this by always having dm_wq_work() resubmit deferred bios using +submit_bio_noacct(). + +Side-effect is blk_queue_split() is always called for "abnormal IO" from +->submit_bio, be it from application thread or dm_wq_work() workqueue, +so proper bio splitting and depth-first bio submission is performed. +For sake of clarity, remove current->bio_list check before call to +blk_queue_split(). + +Also, remove dm_wq_work()'s use of dm_{get,put}_live_table() -- no +longer needed since IO will be reissued in terms of ->submit_bio. +And rename bio variable from 'c' to 'bio'. + +Fixes: cf9c37865557 ("dm: fix comment in dm_process_bio()") +Reported-by: Jeffle Xu +Reviewed-by: Mikulas Patocka +Signed-off-by: Mike Snitzer +Signed-off-by: Coly Li + +--- + drivers/md/dm.c | 34 +++++++++------------------------- + 1 file changed, 9 insertions(+), 25 deletions(-) + +--- a/drivers/md/dm.c ++++ b/drivers/md/dm.c +@@ -1744,17 +1744,11 @@ static blk_qc_t dm_process_bio(struct ma + } + + /* +- * If in ->submit_bio we need to use blk_queue_split(), otherwise +- * queue_limits for abnormal requests (e.g. discard, writesame, etc) +- * won't be imposed. +- * If called from dm_wq_work() for deferred bio processing, bio +- * was already handled by following code with previous ->submit_bio. ++ * Use blk_queue_split() for abnormal IO (e.g. discard, writesame, etc) ++ * otherwise associated queue_limits won't be imposed. + */ +- if (current->bio_list) { +- if (is_abnormal_io(bio)) +- blk_queue_split(&bio); +- /* regular IO is split by __split_and_process_bio */ +- } ++ if (is_abnormal_io(bio)) ++ blk_queue_split(&bio); + + if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED) + return __process_bio(md, map, bio, ti); +@@ -2450,29 +2444,19 @@ static int dm_wait_for_completion(struct + */ + static void dm_wq_work(struct work_struct *work) + { +- struct mapped_device *md = container_of(work, struct mapped_device, +- work); +- struct bio *c; +- int srcu_idx; +- struct dm_table *map; +- +- map = dm_get_live_table(md, &srcu_idx); ++ struct mapped_device *md = container_of(work, struct mapped_device, work); ++ struct bio *bio; + + while (!test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) { + spin_lock_irq(&md->deferred_lock); +- c = bio_list_pop(&md->deferred); ++ bio = bio_list_pop(&md->deferred); + spin_unlock_irq(&md->deferred_lock); + +- if (!c) ++ if (!bio) + break; + +- if (dm_request_based(md)) +- (void) submit_bio_noacct(c); +- else +- (void) dm_process_bio(md, map, c); ++ submit_bio_noacct(bio); + } +- +- dm_put_live_table(md, srcu_idx); + } + + static void dm_queue_flush(struct mapped_device *md) diff --git a/patches.suse/0017-dm-fix-double-RCU-unlock-in-dm_dax_zero_page_range-e.patch b/patches.suse/0017-dm-fix-double-RCU-unlock-in-dm_dax_zero_page_range-e.patch new file mode 100644 index 0000000..e803a49 --- /dev/null +++ b/patches.suse/0017-dm-fix-double-RCU-unlock-in-dm_dax_zero_page_range-e.patch @@ -0,0 +1,41 @@ +From f05c4403db5bba881d4964e731f6da35be46aabd Mon Sep 17 00:00:00 2001 +From: Mike Snitzer +Date: Fri, 4 Dec 2020 15:19:27 -0500 +Subject: [PATCH] dm: fix double RCU unlock in dm_dax_zero_page_range() error + path +Git-commit: f05c4403db5bba881d4964e731f6da35be46aabd +Patch-mainline: v5.10-rc7 +References: git-fixes + +Remove redundant dm_put_live_table() in dm_dax_zero_page_range() error +path to fix sparse warning: +drivers/md/dm.c:1208:9: warning: context imbalance in 'dm_dax_zero_page_range' - unexpected unlock + +Fixes: cdf6cdcd3b99a ("dm,dax: Add dax zero_page_range operation") +Cc: stable@vger.kernel.org +Signed-off-by: Mike Snitzer +Signed-off-by: Coly Li + +--- + drivers/md/dm.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/md/dm.c b/drivers/md/dm.c +index f7eb3d2964f3..45c623ff931a 100644 +--- a/drivers/md/dm.c ++++ b/drivers/md/dm.c +@@ -1201,11 +1201,9 @@ static int dm_dax_zero_page_range(struct dax_device *dax_dev, pgoff_t pgoff, + * ->zero_page_range() is mandatory dax operation. If we are + * here, something is wrong. + */ +- dm_put_live_table(md, srcu_idx); + goto out; + } + ret = ti->type->dax_zero_page_range(ti, pgoff, nr_pages); +- + out: + dm_put_live_table(md, srcu_idx); + +-- +2.26.2 + diff --git a/patches.suse/0018-bcache-fix-race-between-setting-bdev-state-to-none-a.patch b/patches.suse/0018-bcache-fix-race-between-setting-bdev-state-to-none-a.patch new file mode 100644 index 0000000..f58257a --- /dev/null +++ b/patches.suse/0018-bcache-fix-race-between-setting-bdev-state-to-none-a.patch @@ -0,0 +1,87 @@ +From df4ad53242158f9f1f97daf4feddbb4f8b77f080 Mon Sep 17 00:00:00 2001 +From: Dongsheng Yang +Date: Tue, 8 Dec 2020 00:39:15 +0800 +Subject: [PATCH] bcache: fix race between setting bdev state to none and new + write request direct to backing +Git-commit: df4ad53242158f9f1f97daf4feddbb4f8b77f080 +Patch-mainline: v5.11-rc1 +References: git-fixes + +There is a race condition in detaching as below: +A. detaching B. Write request +(1) writing back +(2) write back done, set bdev + state to clean. +(3) cached_dev_put() and + schedule_work(&dc->detach); + (4) write data [0 - 4K] directly + into backing and ack to user. +(5) power-failure... + +When we restart this bcache device, this bdev is clean but not detached, +and read [0 - 4K], we will get unexpected old data from cache device. + +To fix this problem, set the bdev state to none when we writeback done +in detaching, and then if power-failure happened as above, the data in +cache will not be used in next bcache device starting, it's detached, we +will read the correct data from backing derectly. + +Signed-off-by: Dongsheng Yang +Signed-off-by: Coly Li +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/super.c | 9 --------- + drivers/md/bcache/writeback.c | 9 +++++++++ + 2 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 46a00134a36a..b1a6ba9a5adb 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -1114,9 +1114,6 @@ static void cancel_writeback_rate_update_dwork(struct cached_dev *dc) + static void cached_dev_detach_finish(struct work_struct *w) + { + struct cached_dev *dc = container_of(w, struct cached_dev, detach); +- struct closure cl; +- +- closure_init_stack(&cl); + + BUG_ON(!test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)); + BUG_ON(refcount_read(&dc->count)); +@@ -1130,12 +1127,6 @@ static void cached_dev_detach_finish(struct work_struct *w) + dc->writeback_thread = NULL; + } + +- memset(&dc->sb.set_uuid, 0, 16); +- SET_BDEV_STATE(&dc->sb, BDEV_STATE_NONE); +- +- bch_write_bdev_super(dc, &cl); +- closure_sync(&cl); +- + mutex_lock(&bch_register_lock); + + calc_cached_dev_sectors(dc->disk.c); +diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c +index 3c74996978da..a129e4d2707c 100644 +--- a/drivers/md/bcache/writeback.c ++++ b/drivers/md/bcache/writeback.c +@@ -705,6 +705,15 @@ static int bch_writeback_thread(void *arg) + * bch_cached_dev_detach(). + */ + if (test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)) { ++ struct closure cl; ++ ++ closure_init_stack(&cl); ++ memset(&dc->sb.set_uuid, 0, 16); ++ SET_BDEV_STATE(&dc->sb, BDEV_STATE_NONE); ++ ++ bch_write_bdev_super(dc, &cl); ++ closure_sync(&cl); ++ + up_write(&dc->writeback_lock); + break; + } +-- +2.26.2 + diff --git a/patches.suse/0019-dm-remove-unnecessary-current-bio_list-check-when-su.patch b/patches.suse/0019-dm-remove-unnecessary-current-bio_list-check-when-su.patch new file mode 100644 index 0000000..9714a59 --- /dev/null +++ b/patches.suse/0019-dm-remove-unnecessary-current-bio_list-check-when-su.patch @@ -0,0 +1,52 @@ +From 985eabdcfe3aad1aea6fc195dafff503f303aa3a Mon Sep 17 00:00:00 2001 +From: Jeffle Xu +Date: Wed, 4 Nov 2020 11:57:56 +0800 +Subject: [PATCH] dm: remove unnecessary current->bio_list check when + submitting split bio +Git-commit: 985eabdcfe3aad1aea6fc195dafff503f303aa3a +Patch-mainline: v5.11-rc1 +References: git-fixes + +The depth-first splitting is introduced in commit 18a25da84354 ("dm: +ensure bio submission follows a depth-first tree walk"), which is used +to fix the potential deadlock in case of the misordering handling of +bios caused by bio_list. There're two paths submitting split bios, +dm_wq_work() from worker thread and submit_bio() from application. Back +upon that time, dm_wq_work() thread calls __split_and_process_bio() +directly and thus will not trigger this issue since bio_list doesn't +exist here. So this issue will only be triggered from application +calling submit_bio(), and the fix has to check if current->bio_list is +non-NULL to distinguish this case. + +However since commit 0c2915b8c6db1 ("dm: fix missing imposition of +queue_limits from dm_wq_work() thread"), dm_wq_work() thread calls +submit_bio_noacct() and thus also uses bio_list. Since then all entries +into __split_and_process_bio() are under protection of bio_list, and +thus the checking of current->bio_list when determinning if the +depth-first principle should be used, seems kind of nonsense. After all +the checking always succeeds now. + +Fixes: 0c2915b8c6db1 ("dm: fix missing imposition of queue_limits from dm_wq_work() thread") +Signed-off-by: Jeffle Xu +Signed-off-by: Mike Snitzer +Signed-off-by: Coly Li +--- + drivers/md/dm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/md/dm.c b/drivers/md/dm.c +index 4e0cbfe3f14d..9408df43ba75 100644 +--- a/drivers/md/dm.c ++++ b/drivers/md/dm.c +@@ -1590,7 +1590,7 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md, + ci.sector_count = bio_sectors(bio); + while (ci.sector_count && !error) { + error = __split_and_process_non_flush(&ci); +- if (current->bio_list && ci.sector_count && !error) { ++ if (ci.sector_count && !error) { + /* + * Remainder must be passed to submit_bio_noacct() + * so that it gets handled *after* bios already submitted +-- +2.26.2 + diff --git a/patches.suse/0020-bcache-remove-a-superfluous-check-in-register_bcache.patch b/patches.suse/0020-bcache-remove-a-superfluous-check-in-register_bcache.patch new file mode 100644 index 0000000..d81d870 --- /dev/null +++ b/patches.suse/0020-bcache-remove-a-superfluous-check-in-register_bcache.patch @@ -0,0 +1,49 @@ +From 117ae250cfa3718f21bd07df0650dfbe3bc3a823 Mon Sep 17 00:00:00 2001 +From: Yi Li +Date: Wed, 23 Dec 2020 23:04:21 +0800 +Subject: [PATCH] bcache:remove a superfluous check in register_bcache +Git-commit: 117ae250cfa3718f21bd07df0650dfbe3bc3a823 +Patch-mainline: v5.11-rc1 +References: git-fixes + +There have no reassign the bdev after check It is IS_ERR. +the double check !IS_ERR(bdev) is superfluous. + +After commit 4e7b5671c6a8 ("block: remove i_bdev"), +"Switch the block device lookup interfaces to directly work with a dev_t +so that struct block_device references are only acquired by the +blkdev_get variants (and the blk-cgroup special case). This means that +we now don't need an extra reference in the inode and can generally +simplify handling of struct block_device to keep the lookups contained +in the core block layer code." + +so after lookup_bdev call, there no need to do bdput. + +remove a superfluous check the bdev & don't call bdput after lookup_bdev. + +Fixes: 4e7b5671c6a8("block: remove i_bdev") +Signed-off-by: Yi Li +Reviewed-by: Christoph Hellwig +Signed-off-by: Coly Li +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/super.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 0e06d721cd8e..a4752ac410dc 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -2535,8 +2535,6 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr, + else + err = "device busy"; + mutex_unlock(&bch_register_lock); +- if (!IS_ERR(bdev)) +- bdput(bdev); + if (attr == &ksysfs_register_quiet) + goto done; + } +-- +2.26.2 + diff --git a/patches.suse/0021-md-bcache-convert-comma-to-semicolon.patch b/patches.suse/0021-md-bcache-convert-comma-to-semicolon.patch new file mode 100644 index 0000000..7aeac0b --- /dev/null +++ b/patches.suse/0021-md-bcache-convert-comma-to-semicolon.patch @@ -0,0 +1,35 @@ +From 46926127d76359b46659c556df7b4aa1b6325d90 Mon Sep 17 00:00:00 2001 +From: Zheng Yongjun +Date: Wed, 23 Dec 2020 23:04:22 +0800 +Subject: [PATCH] md/bcache: convert comma to semicolon +Git-commit: 46926127d76359b46659c556df7b4aa1b6325d90 +Patch-mainline: v5.11-rc1 +References: git-fixes + +Replace a comma between expression statements by a semicolon. + +Signed-off-by: Zheng Yongjun +Signed-off-by: Coly Li +Signed-off-by: Jens Axboe +Signed-off-by: Coly Li + +--- + drivers/md/bcache/sysfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c +index 554e3afc9b68..00a520c03f41 100644 +--- a/drivers/md/bcache/sysfs.c ++++ b/drivers/md/bcache/sysfs.c +@@ -404,7 +404,7 @@ STORE(__cached_dev) + if (!env) + return -ENOMEM; + add_uevent_var(env, "DRIVER=bcache"); +- add_uevent_var(env, "CACHED_UUID=%pU", dc->sb.uuid), ++ add_uevent_var(env, "CACHED_UUID=%pU", dc->sb.uuid); + add_uevent_var(env, "CACHED_LABEL=%s", buf); + kobject_uevent_env(&disk_to_dev(dc->disk.disk)->kobj, + KOBJ_CHANGE, +-- +2.26.2 + diff --git a/patches.suse/0022-bcache-set-pdev_set_uuid-before-scond-loop-iteration.patch b/patches.suse/0022-bcache-set-pdev_set_uuid-before-scond-loop-iteration.patch new file mode 100644 index 0000000..5599f4a --- /dev/null +++ b/patches.suse/0022-bcache-set-pdev_set_uuid-before-scond-loop-iteration.patch @@ -0,0 +1,36 @@ +From e80927079fd97b4d5457e3af2400a0087b561564 Mon Sep 17 00:00:00 2001 +From: Yi Li +Date: Mon, 4 Jan 2021 15:41:18 +0800 +Subject: [PATCH] bcache: set pdev_set_uuid before scond loop iteration +Git-commit: e80927079fd97b4d5457e3af2400a0087b561564 +Patch-mainline: v5.11-rc3 +References: git-fixes + +There is no need to reassign pdev_set_uuid in the second loop iteration, +so move it to the place before second loop. + +Signed-off-by: Yi Li +Signed-off-by: Coly Li +Signed-off-by: Jens Axboe + +--- + 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 a4752ac410dc..6aa23a6fb394 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -2644,8 +2644,8 @@ static ssize_t bch_pending_bdevs_cleanup(struct kobject *k, + } + + list_for_each_entry_safe(pdev, tpdev, &pending_devs, list) { ++ char *pdev_set_uuid = pdev->dc->sb.set_uuid; + list_for_each_entry_safe(c, tc, &bch_cache_sets, list) { +- char *pdev_set_uuid = pdev->dc->sb.set_uuid; + char *set_uuid = c->set_uuid; + + if (!memcmp(pdev_set_uuid, set_uuid, 16)) { +-- +2.26.2 + diff --git a/patches.suse/0023-bcache-fix-typo-from-SUUP-to-SUPP-in-features.h.patch b/patches.suse/0023-bcache-fix-typo-from-SUUP-to-SUPP-in-features.h.patch new file mode 100644 index 0000000..85147c2 --- /dev/null +++ b/patches.suse/0023-bcache-fix-typo-from-SUUP-to-SUPP-in-features.h.patch @@ -0,0 +1,43 @@ +From f7b4943dea48a572ad751ce1f18a245d43debe7e Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Mon, 4 Jan 2021 15:41:19 +0800 +Subject: [PATCH] bcache: fix typo from SUUP to SUPP in features.h +Git-commit: f7b4943dea48a572ad751ce1f18a245d43debe7e +Patch-mainline: v5.11-rc3 +References: git-fixes + +This patch fixes the following typos, +from BCH_FEATURE_COMPAT_SUUP to BCH_FEATURE_COMPAT_SUPP +from BCH_FEATURE_INCOMPAT_SUUP to BCH_FEATURE_INCOMPAT_SUPP +from BCH_FEATURE_INCOMPAT_SUUP to BCH_FEATURE_RO_COMPAT_SUPP + +Fixes: d721a43ff69c ("bcache: increase super block version for cache device and backing device") +Fixes: ffa470327572 ("bcache: add bucket_size_hi into struct cache_sb_disk for large bucket") +Signed-off-by: Coly Li +Cc: stable@vger.kernel.org # 5.9+ +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/features.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/md/bcache/features.h b/drivers/md/bcache/features.h +index a1653c478041..32c5bbda2f0d 100644 +--- a/drivers/md/bcache/features.h ++++ b/drivers/md/bcache/features.h +@@ -15,9 +15,9 @@ + /* Incompat feature set */ + #define BCH_FEATURE_INCOMPAT_LARGE_BUCKET 0x0001 /* 32bit bucket size */ + +-#define BCH_FEATURE_COMPAT_SUUP 0 +-#define BCH_FEATURE_RO_COMPAT_SUUP 0 +-#define BCH_FEATURE_INCOMPAT_SUUP BCH_FEATURE_INCOMPAT_LARGE_BUCKET ++#define BCH_FEATURE_COMPAT_SUPP 0 ++#define BCH_FEATURE_RO_COMPAT_SUPP 0 ++#define BCH_FEATURE_INCOMPAT_SUPP BCH_FEATURE_INCOMPAT_LARGE_BUCKET + + #define BCH_HAS_COMPAT_FEATURE(sb, mask) \ + ((sb)->feature_compat & (mask)) +-- +2.26.2 + diff --git a/patches.suse/0024-bcache-check-unsupported-feature-sets-for-bcache-reg.patch b/patches.suse/0024-bcache-check-unsupported-feature-sets-for-bcache-reg.patch new file mode 100644 index 0000000..2e7b38a --- /dev/null +++ b/patches.suse/0024-bcache-check-unsupported-feature-sets-for-bcache-reg.patch @@ -0,0 +1,82 @@ +From 1dfc0686c29a9bbd3a446a29f9ccde3dec3bc75a Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Mon, 4 Jan 2021 15:41:20 +0800 +Subject: [PATCH] bcache: check unsupported feature sets for bcache register +Git-commit: 1dfc0686c29a9bbd3a446a29f9ccde3dec3bc75a +Patch-mainline: v5.11-rc3 +References: git-fixes + +This patch adds the check for features which is incompatible for +current supported feature sets. + +Now if the bcache device created by bcache-tools has features that +current kernel doesn't support, read_super() will fail with error +messoage. E.g. if an unsupported incompatible feature detected, +bcache register will fail with dmesg "bcache: register_bcache() error : +Unsupported incompatible feature found". + +Fixes: d721a43ff69c ("bcache: increase super block version for cache device and backing device") +Fixes: ffa470327572 ("bcache: add bucket_size_hi into struct cache_sb_disk for large bucket") +Signed-off-by: Coly Li +Cc: stable@vger.kernel.org # 5.9+ +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/features.h | 15 +++++++++++++++ + drivers/md/bcache/super.c | 14 ++++++++++++++ + 2 files changed, 29 insertions(+) + +diff --git a/drivers/md/bcache/features.h b/drivers/md/bcache/features.h +index 32c5bbda2f0d..e73724c2b49b 100644 +--- a/drivers/md/bcache/features.h ++++ b/drivers/md/bcache/features.h +@@ -79,6 +79,21 @@ static inline void bch_clear_feature_##name(struct cache_sb *sb) \ + + BCH_FEATURE_INCOMPAT_FUNCS(large_bucket, LARGE_BUCKET); + ++static inline bool bch_has_unknown_compat_features(struct cache_sb *sb) ++{ ++ return ((sb->feature_compat & ~BCH_FEATURE_COMPAT_SUPP) != 0); ++} ++ ++static inline bool bch_has_unknown_ro_compat_features(struct cache_sb *sb) ++{ ++ return ((sb->feature_ro_compat & ~BCH_FEATURE_RO_COMPAT_SUPP) != 0); ++} ++ ++static inline bool bch_has_unknown_incompat_features(struct cache_sb *sb) ++{ ++ return ((sb->feature_incompat & ~BCH_FEATURE_INCOMPAT_SUPP) != 0); ++} ++ + int bch_print_cache_set_feature_compat(struct cache_set *c, char *buf, int size); + int bch_print_cache_set_feature_ro_compat(struct cache_set *c, char *buf, int size); + int bch_print_cache_set_feature_incompat(struct cache_set *c, char *buf, int size); +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 6aa23a6fb394..f4674a3298af 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -228,6 +228,20 @@ static const char *read_super(struct cache_sb *sb, struct block_device *bdev, + sb->feature_compat = le64_to_cpu(s->feature_compat); + sb->feature_incompat = le64_to_cpu(s->feature_incompat); + sb->feature_ro_compat = le64_to_cpu(s->feature_ro_compat); ++ ++ /* Check incompatible features */ ++ err = "Unsupported compatible feature found"; ++ if (bch_has_unknown_compat_features(sb)) ++ goto err; ++ ++ err = "Unsupported read-only compatible feature found"; ++ if (bch_has_unknown_ro_compat_features(sb)) ++ goto err; ++ ++ err = "Unsupported incompatible feature found"; ++ if (bch_has_unknown_incompat_features(sb)) ++ goto err; ++ + err = read_super_common(sb, bdev, s); + if (err) + goto err; +-- +2.26.2 + diff --git a/patches.suse/0025-bcache-introduce-BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCK.patch b/patches.suse/0025-bcache-introduce-BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCK.patch new file mode 100644 index 0000000..c81c9fc --- /dev/null +++ b/patches.suse/0025-bcache-introduce-BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCK.patch @@ -0,0 +1,151 @@ +From b16671e8f493e3df40b1fb0dff4078f391c5099a Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Mon, 4 Jan 2021 15:41:21 +0800 +Subject: [PATCH] bcache: introduce BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE + for large bucket +Git-commit: b16671e8f493e3df40b1fb0dff4078f391c5099a +Patch-mainline: v5.11-rc3 +References: git-fixes + +When large bucket feature was added, BCH_FEATURE_INCOMPAT_LARGE_BUCKET +was introduced into the incompat feature set. It used bucket_size_hi +(which was added at the tail of struct cache_sb_disk) to extend current +16bit bucket size to 32bit with existing bucket_size in struct +cache_sb_disk. + +This is not a good idea, there are two obvious problems, +- Bucket size is always value power of 2, if store log2(bucket size) in + existing bucket_size of struct cache_sb_disk, it is unnecessary to add + bucket_size_hi. +- Macro csum_set() assumes d[SB_JOURNAL_BUCKETS] is the last member in + struct cache_sb_disk, bucket_size_hi was added after d[] which makes + csum_set calculate an unexpected super block checksum. + +To fix the above problems, this patch introduces a new incompat feature +bit BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE, when this bit is set, it +means bucket_size in struct cache_sb_disk stores the order of power-of-2 +bucket size value. When user specifies a bucket size larger than 32768 +sectors, BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE will be set to +incompat feature set, and bucket_size stores log2(bucket size) more +than store the real bucket size value. + +The obsoleted BCH_FEATURE_INCOMPAT_LARGE_BUCKET won't be used anymore, +it is renamed to BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET and still only +recognized by kernel driver for legacy compatible purpose. The previous +bucket_size_hi is renmaed to obso_bucket_size_hi in struct cache_sb_disk +and not used in bcache-tools anymore. + +For cache device created with BCH_FEATURE_INCOMPAT_LARGE_BUCKET feature, +bcache-tools and kernel driver still recognize the feature string and +display it as "obso_large_bucket". + +With this change, the unnecessary extra space extend of bcache on-disk +super block can be avoided, and csum_set() may generate expected check +sum as well. + +Fixes: ffa470327572 ("bcache: add bucket_size_hi into struct cache_sb_disk for large bucket") +Signed-off-by: Coly Li +Cc: stable@vger.kernel.org # 5.9+ +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/features.c | 2 +- + drivers/md/bcache/features.h | 11 ++++++++--- + drivers/md/bcache/super.c | 22 +++++++++++++++++++--- + include/uapi/linux/bcache.h | 2 +- + 4 files changed, 29 insertions(+), 8 deletions(-) + +diff --git a/drivers/md/bcache/features.c b/drivers/md/bcache/features.c +index 6469223f0b77..d636b7b2d070 100644 +--- a/drivers/md/bcache/features.c ++++ b/drivers/md/bcache/features.c +@@ -17,7 +17,7 @@ struct feature { + }; + + static struct feature feature_list[] = { +- {BCH_FEATURE_INCOMPAT, BCH_FEATURE_INCOMPAT_LARGE_BUCKET, ++ {BCH_FEATURE_INCOMPAT, BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE, + "large_bucket"}, + {0, 0, 0 }, + }; +diff --git a/drivers/md/bcache/features.h b/drivers/md/bcache/features.h +index e73724c2b49b..84fc2c0f0101 100644 +--- a/drivers/md/bcache/features.h ++++ b/drivers/md/bcache/features.h +@@ -13,11 +13,15 @@ + + /* Feature set definition */ + /* Incompat feature set */ +-#define BCH_FEATURE_INCOMPAT_LARGE_BUCKET 0x0001 /* 32bit bucket size */ ++/* 32bit bucket size, obsoleted */ ++#define BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET 0x0001 ++/* real bucket size is (1 << bucket_size) */ ++#define BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE 0x0002 + + #define BCH_FEATURE_COMPAT_SUPP 0 + #define BCH_FEATURE_RO_COMPAT_SUPP 0 +-#define BCH_FEATURE_INCOMPAT_SUPP BCH_FEATURE_INCOMPAT_LARGE_BUCKET ++#define BCH_FEATURE_INCOMPAT_SUPP (BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET| \ ++ BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE) + + #define BCH_HAS_COMPAT_FEATURE(sb, mask) \ + ((sb)->feature_compat & (mask)) +@@ -77,7 +81,8 @@ static inline void bch_clear_feature_##name(struct cache_sb *sb) \ + ~BCH##_FEATURE_INCOMPAT_##flagname; \ + } + +-BCH_FEATURE_INCOMPAT_FUNCS(large_bucket, LARGE_BUCKET); ++BCH_FEATURE_INCOMPAT_FUNCS(obso_large_bucket, OBSO_LARGE_BUCKET); ++BCH_FEATURE_INCOMPAT_FUNCS(large_bucket, LOG_LARGE_BUCKET_SIZE); + + static inline bool bch_has_unknown_compat_features(struct cache_sb *sb) + { +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index f4674a3298af..3999641f1775 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -64,9 +64,25 @@ static unsigned int get_bucket_size(struct cache_sb *sb, struct cache_sb_disk *s + { + unsigned int bucket_size = le16_to_cpu(s->bucket_size); + +- if (sb->version >= BCACHE_SB_VERSION_CDEV_WITH_FEATURES && +- bch_has_feature_large_bucket(sb)) +- bucket_size |= le16_to_cpu(s->bucket_size_hi) << 16; ++ if (sb->version >= BCACHE_SB_VERSION_CDEV_WITH_FEATURES) { ++ if (bch_has_feature_large_bucket(sb)) { ++ unsigned int max, order; ++ ++ max = sizeof(unsigned int) * BITS_PER_BYTE - 1; ++ order = le16_to_cpu(s->bucket_size); ++ /* ++ * bcache tool will make sure the overflow won't ++ * happen, an error message here is enough. ++ */ ++ if (order > max) ++ pr_err("Bucket size (1 << %u) overflows\n", ++ order); ++ bucket_size = 1 << order; ++ } else if (bch_has_feature_obso_large_bucket(sb)) { ++ bucket_size += ++ le16_to_cpu(s->obso_bucket_size_hi) << 16; ++ } ++ } + + return bucket_size; + } +diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h +index 52e8bcb33981..cf7399f03b71 100644 +--- a/include/uapi/linux/bcache.h ++++ b/include/uapi/linux/bcache.h +@@ -213,7 +213,7 @@ struct cache_sb_disk { + __le16 keys; + }; + __le64 d[SB_JOURNAL_BUCKETS]; /* journal buckets */ +- __le16 bucket_size_hi; ++ __le16 obso_bucket_size_hi; /* obsoleted */ + }; + + /* +-- +2.26.2 + diff --git a/patches.suse/0026-bcache-set-bcache-device-into-read-only-mode-for-BCH.patch b/patches.suse/0026-bcache-set-bcache-device-into-read-only-mode-for-BCH.patch new file mode 100644 index 0000000..36413fe --- /dev/null +++ b/patches.suse/0026-bcache-set-bcache-device-into-read-only-mode-for-BCH.patch @@ -0,0 +1,87 @@ +From 5342fd4255021ef0c4ce7be52eea1c4ebda11c63 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Mon, 4 Jan 2021 15:41:22 +0800 +Subject: [PATCH] bcache: set bcache device into read-only mode for + BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET +Git-commit: 5342fd4255021ef0c4ce7be52eea1c4ebda11c63 +Patch-mainline: v5.11-rc3 +References: git-fixes + +If BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET is set in incompat feature +set, it means the cache device is created with obsoleted layout with +obso_bucket_site_hi. Now bcache does not support this feature bit, a new +BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE incompat feature bit is added +for a better layout to support large bucket size. + +For the legacy compatibility purpose, if a cache device created with +obsoleted BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET feature bit, all bcache +devices attached to this cache set should be set to read-only. Then the +dirty data can be written back to backing device before re-create the +cache device with BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE feature bit +by the latest bcache-tools. + +This patch checks BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET feature bit +when running a cache set and attach a bcache device to the cache set. If +this bit is set, +- When run a cache set, print an error kernel message to indicate all + following attached bcache device will be read-only. +- When attach a bcache device, print an error kernel message to indicate + the attached bcache device will be read-only, and ask users to update + to latest bcache-tools. + +Such change is only for cache device whose bucket size >= 32MB, this is +for the zoned SSD and almost nobody uses such large bucket size at this +moment. If you don't explicit set a large bucket size for a zoned SSD, +such change is totally transparent to your bcache device. + +Fixes: ffa470327572 ("bcache: add bucket_size_hi into struct cache_sb_disk for large bucket") +Signed-off-by: Coly Li +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/super.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 3999641f1775..2047a9cccdb5 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -1332,6 +1332,12 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c, + bcache_device_link(&dc->disk, c, "bdev"); + atomic_inc(&c->attached_dev_nr); + ++ if (bch_has_feature_obso_large_bucket(&(c->cache->sb))) { ++ pr_err("The obsoleted large bucket layout is unsupported, set the bcache device into read-only\n"); ++ pr_err("Please update to the latest bcache-tools to create the cache device\n"); ++ set_disk_ro(dc->disk.disk, 1); ++ } ++ + /* Allow the writeback thread to proceed */ + up_write(&dc->writeback_lock); + +@@ -1554,6 +1560,12 @@ static int flash_dev_run(struct cache_set *c, struct uuid_entry *u) + + bcache_device_link(d, c, "volume"); + ++ if (bch_has_feature_obso_large_bucket(&c->cache->sb)) { ++ pr_err("The obsoleted large bucket layout is unsupported, set the bcache device into read-only\n"); ++ pr_err("Please update to the latest bcache-tools to create the cache device\n"); ++ set_disk_ro(d->disk, 1); ++ } ++ + return 0; + err: + kobject_put(&d->kobj); +@@ -2113,6 +2125,9 @@ static int run_cache_set(struct cache_set *c) + c->cache->sb.last_mount = (u32)ktime_get_real_seconds(); + bcache_write_super(c); + ++ if (bch_has_feature_obso_large_bucket(&c->cache->sb)) ++ pr_err("Detect obsoleted large bucket layout, all attached bcache device will be read-only\n"); ++ + list_for_each_entry_safe(dc, t, &uncached_devices, list) + bch_cached_dev_attach(dc, c, NULL); + +-- +2.26.2 + diff --git a/patches.suse/0027-bcache-only-check-feature-sets-when-sb-version-BCACH.patch b/patches.suse/0027-bcache-only-check-feature-sets-when-sb-version-BCACH.patch new file mode 100644 index 0000000..15a38f8 --- /dev/null +++ b/patches.suse/0027-bcache-only-check-feature-sets-when-sb-version-BCACH.patch @@ -0,0 +1,59 @@ +From 0df28cad06eb41cc36bfea69d9c882fb567fd0d6 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Thu, 28 Jan 2021 18:48:47 +0800 +Subject: [PATCH] bcache: only check feature sets when sb->version >= + BCACHE_SB_VERSION_CDEV_WITH_FEATURES +Git-commit: 0df28cad06eb41cc36bfea69d9c882fb567fd0d6 +Patch-mainline: v5.11-rc6 +References: git-fixes + +For super block version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES, it +doesn't make sense to check the feature sets. This patch checks +super block version in bch_has_feature_* routines, if the version +doesn't have feature sets yet, returns 0 (false) to the caller. + +Fixes: 5342fd425502 ("bcache: set bcache device into read-only mode for BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET") +Fixes: ffa470327572 ("bcache: add bucket_size_hi into struct cache_sb_disk for large bucket") +Cc: stable@vger.kernel.org # 5.9+ +Reported-and-tested-by: Bockholdt Arne +Signed-off-by: Coly Li +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/features.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/md/bcache/features.h b/drivers/md/bcache/features.h +index 84fc2c0f0101..d1c8fd3977fc 100644 +--- a/drivers/md/bcache/features.h ++++ b/drivers/md/bcache/features.h +@@ -33,6 +33,8 @@ + #define BCH_FEATURE_COMPAT_FUNCS(name, flagname) \ + static inline int bch_has_feature_##name(struct cache_sb *sb) \ + { \ ++ if (sb->version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES) \ ++ return 0; \ + return (((sb)->feature_compat & \ + BCH##_FEATURE_COMPAT_##flagname) != 0); \ + } \ +@@ -50,6 +52,8 @@ static inline void bch_clear_feature_##name(struct cache_sb *sb) \ + #define BCH_FEATURE_RO_COMPAT_FUNCS(name, flagname) \ + static inline int bch_has_feature_##name(struct cache_sb *sb) \ + { \ ++ if (sb->version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES) \ ++ return 0; \ + return (((sb)->feature_ro_compat & \ + BCH##_FEATURE_RO_COMPAT_##flagname) != 0); \ + } \ +@@ -67,6 +71,8 @@ static inline void bch_clear_feature_##name(struct cache_sb *sb) \ + #define BCH_FEATURE_INCOMPAT_FUNCS(name, flagname) \ + static inline int bch_has_feature_##name(struct cache_sb *sb) \ + { \ ++ if (sb->version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES) \ ++ return 0; \ + return (((sb)->feature_incompat & \ + BCH##_FEATURE_INCOMPAT_##flagname) != 0); \ + } \ +-- +2.26.2 + diff --git a/patches.suse/0028-bcache-consider-the-fragmentation-when-update-the-wr.patch b/patches.suse/0028-bcache-consider-the-fragmentation-when-update-the-wr.patch new file mode 100644 index 0000000..2bb8458 --- /dev/null +++ b/patches.suse/0028-bcache-consider-the-fragmentation-when-update-the-wr.patch @@ -0,0 +1,271 @@ +From 71dda2a5625f31bc3410cb69c3d31376a2b66f28 Mon Sep 17 00:00:00 2001 +From: dongdong tao +Date: Wed, 10 Feb 2021 13:07:23 +0800 +Subject: [PATCH] bcache: consider the fragmentation when update the writeback + rate +Git-commit: 71dda2a5625f31bc3410cb69c3d31376a2b66f28 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Current way to calculate the writeback rate only considered the +dirty sectors, this usually works fine when the fragmentation +is not high, but it will give us unreasonable small rate when +we are under a situation that very few dirty sectors consumed +a lot dirty buckets. In some case, the dirty bucekts can reached +to CUTOFF_WRITEBACK_SYNC while the dirty data(sectors) not even +reached the writeback_percent, the writeback rate will still +be the minimum value (4k), thus it will cause all the writes to be +stucked in a non-writeback mode because of the slow writeback. + +We accelerate the rate in 3 stages with different aggressiveness, +the first stage starts when dirty buckets percent reach above +BCH_WRITEBACK_FRAGMENT_THRESHOLD_LOW (50), the second is +BCH_WRITEBACK_FRAGMENT_THRESHOLD_MID (57), the third is +BCH_WRITEBACK_FRAGMENT_THRESHOLD_HIGH (64). By default +the first stage tries to writeback the amount of dirty data +in one bucket (on average) in (1 / (dirty_buckets_percent - 50)) second, +the second stage tries to writeback the amount of dirty data in one bucket +in (1 / (dirty_buckets_percent - 57)) * 100 millisecond, the third +stage tries to writeback the amount of dirty data in one bucket in +(1 / (dirty_buckets_percent - 64)) millisecond. + +the initial rate at each stage can be controlled by 3 configurable +parameters writeback_rate_fp_term_{low|mid|high}, they are by default +1, 10, 1000, the hint of IO throughput that these values are trying +to achieve is described by above paragraph, the reason that +I choose those value as default is based on the testing and the +production data, below is some details: + +A. When it comes to the low stage, there is still a bit far from the 70 + threshold, so we only want to give it a little bit push by setting the + term to 1, it means the initial rate will be 170 if the fragment is 6, + it is calculated by bucket_size/fragment, this rate is very small, + but still much reasonable than the minimum 8. + For a production bcache with unheavy workload, if the cache device + is bigger than 1 TB, it may take hours to consume 1% buckets, + so it is very possible to reclaim enough dirty buckets in this stage, + thus to avoid entering the next stage. + +B. If the dirty buckets ratio didn't turn around during the first stage, + it comes to the mid stage, then it is necessary for mid stage + to be more aggressive than low stage, so i choose the initial rate + to be 10 times more than low stage, that means 1700 as the initial + rate if the fragment is 6. This is some normal rate + we usually see for a normal workload when writeback happens + because of writeback_percent. + +C. If the dirty buckets ratio didn't turn around during the low and mid + stages, it comes to the third stage, and it is the last chance that + we can turn around to avoid the horrible cutoff writeback sync issue, + then we choose 100 times more aggressive than the mid stage, that + means 170000 as the initial rate if the fragment is 6. This is also + inferred from a production bcache, I've got one week's writeback rate + data from a production bcache which has quite heavy workloads, + again, the writeback is triggered by the writeback percent, + the highest rate area is around 100000 to 240000, so I believe this + kind aggressiveness at this stage is reasonable for production. + And it should be mostly enough because the hint is trying to reclaim + 1000 bucket per second, and from that heavy production env, + it is consuming 50 bucket per second on average in one week's data. + +Option writeback_consider_fragment is to control whether we want +this feature to be on or off, it's on by default. + +Lastly, below is the performance data for all the testing result, +including the data from production env: +https://docs.google.com/document/d/1AmbIEa_2MhB9bqhC3rfga9tp7n9YX9PLn0jSUxscVW0/edit?usp=sharing + +Signed-off-by: dongdong tao +Signed-off-by: Coly Li +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/bcache.h | 4 ++++ + drivers/md/bcache/sysfs.c | 23 +++++++++++++++++++ + drivers/md/bcache/writeback.c | 42 +++++++++++++++++++++++++++++++++++ + drivers/md/bcache/writeback.h | 4 ++++ + 4 files changed, 73 insertions(+) + +diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h +index 1d57f48307e6..d7a84327b7f1 100644 +--- a/drivers/md/bcache/bcache.h ++++ b/drivers/md/bcache/bcache.h +@@ -373,6 +373,7 @@ struct cached_dev { + unsigned int partial_stripes_expensive:1; + unsigned int writeback_metadata:1; + unsigned int writeback_running:1; ++ unsigned int writeback_consider_fragment:1; + unsigned char writeback_percent; + unsigned int writeback_delay; + +@@ -385,6 +386,9 @@ struct cached_dev { + unsigned int writeback_rate_update_seconds; + unsigned int writeback_rate_i_term_inverse; + unsigned int writeback_rate_p_term_inverse; ++ unsigned int writeback_rate_fp_term_low; ++ unsigned int writeback_rate_fp_term_mid; ++ unsigned int writeback_rate_fp_term_high; + unsigned int writeback_rate_minimum; + + enum stop_on_failure stop_when_cache_set_failed; +diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c +index 00a520c03f41..eef15f8022ba 100644 +--- a/drivers/md/bcache/sysfs.c ++++ b/drivers/md/bcache/sysfs.c +@@ -117,10 +117,14 @@ rw_attribute(writeback_running); + rw_attribute(writeback_percent); + rw_attribute(writeback_delay); + rw_attribute(writeback_rate); ++rw_attribute(writeback_consider_fragment); + + rw_attribute(writeback_rate_update_seconds); + rw_attribute(writeback_rate_i_term_inverse); + rw_attribute(writeback_rate_p_term_inverse); ++rw_attribute(writeback_rate_fp_term_low); ++rw_attribute(writeback_rate_fp_term_mid); ++rw_attribute(writeback_rate_fp_term_high); + rw_attribute(writeback_rate_minimum); + read_attribute(writeback_rate_debug); + +@@ -195,6 +199,7 @@ SHOW(__bch_cached_dev) + var_printf(bypass_torture_test, "%i"); + var_printf(writeback_metadata, "%i"); + var_printf(writeback_running, "%i"); ++ var_printf(writeback_consider_fragment, "%i"); + var_print(writeback_delay); + var_print(writeback_percent); + sysfs_hprint(writeback_rate, +@@ -205,6 +210,9 @@ SHOW(__bch_cached_dev) + var_print(writeback_rate_update_seconds); + var_print(writeback_rate_i_term_inverse); + var_print(writeback_rate_p_term_inverse); ++ var_print(writeback_rate_fp_term_low); ++ var_print(writeback_rate_fp_term_mid); ++ var_print(writeback_rate_fp_term_high); + var_print(writeback_rate_minimum); + + if (attr == &sysfs_writeback_rate_debug) { +@@ -303,6 +311,7 @@ STORE(__cached_dev) + sysfs_strtoul_bool(bypass_torture_test, dc->bypass_torture_test); + sysfs_strtoul_bool(writeback_metadata, dc->writeback_metadata); + sysfs_strtoul_bool(writeback_running, dc->writeback_running); ++ sysfs_strtoul_bool(writeback_consider_fragment, dc->writeback_consider_fragment); + sysfs_strtoul_clamp(writeback_delay, dc->writeback_delay, 0, UINT_MAX); + + sysfs_strtoul_clamp(writeback_percent, dc->writeback_percent, +@@ -331,6 +340,16 @@ STORE(__cached_dev) + sysfs_strtoul_clamp(writeback_rate_p_term_inverse, + dc->writeback_rate_p_term_inverse, + 1, UINT_MAX); ++ sysfs_strtoul_clamp(writeback_rate_fp_term_low, ++ dc->writeback_rate_fp_term_low, ++ 1, dc->writeback_rate_fp_term_mid - 1); ++ sysfs_strtoul_clamp(writeback_rate_fp_term_mid, ++ dc->writeback_rate_fp_term_mid, ++ dc->writeback_rate_fp_term_low + 1, ++ dc->writeback_rate_fp_term_high - 1); ++ sysfs_strtoul_clamp(writeback_rate_fp_term_high, ++ dc->writeback_rate_fp_term_high, ++ dc->writeback_rate_fp_term_mid + 1, UINT_MAX); + sysfs_strtoul_clamp(writeback_rate_minimum, + dc->writeback_rate_minimum, + 1, UINT_MAX); +@@ -499,9 +518,13 @@ static struct attribute *bch_cached_dev_files[] = { + &sysfs_writeback_delay, + &sysfs_writeback_percent, + &sysfs_writeback_rate, ++ &sysfs_writeback_consider_fragment, + &sysfs_writeback_rate_update_seconds, + &sysfs_writeback_rate_i_term_inverse, + &sysfs_writeback_rate_p_term_inverse, ++ &sysfs_writeback_rate_fp_term_low, ++ &sysfs_writeback_rate_fp_term_mid, ++ &sysfs_writeback_rate_fp_term_high, + &sysfs_writeback_rate_minimum, + &sysfs_writeback_rate_debug, + &sysfs_io_errors, +diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c +index a129e4d2707c..82d4e0880a99 100644 +--- a/drivers/md/bcache/writeback.c ++++ b/drivers/md/bcache/writeback.c +@@ -88,6 +88,44 @@ static void __update_writeback_rate(struct cached_dev *dc) + int64_t integral_scaled; + uint32_t new_rate; + ++ /* ++ * We need to consider the number of dirty buckets as well ++ * when calculating the proportional_scaled, Otherwise we might ++ * have an unreasonable small writeback rate at a highly fragmented situation ++ * when very few dirty sectors consumed a lot dirty buckets, the ++ * worst case is when dirty buckets reached cutoff_writeback_sync and ++ * dirty data is still not even reached to writeback percent, so the rate ++ * still will be at the minimum value, which will cause the write ++ * stuck at a non-writeback mode. ++ */ ++ struct cache_set *c = dc->disk.c; ++ ++ int64_t dirty_buckets = c->nbuckets - c->avail_nbuckets; ++ ++ if (dc->writeback_consider_fragment && ++ c->gc_stats.in_use > BCH_WRITEBACK_FRAGMENT_THRESHOLD_LOW && dirty > 0) { ++ int64_t fragment = ++ div_s64((dirty_buckets * c->cache->sb.bucket_size), dirty); ++ int64_t fp_term; ++ int64_t fps; ++ ++ if (c->gc_stats.in_use <= BCH_WRITEBACK_FRAGMENT_THRESHOLD_MID) { ++ fp_term = dc->writeback_rate_fp_term_low * ++ (c->gc_stats.in_use - BCH_WRITEBACK_FRAGMENT_THRESHOLD_LOW); ++ } else if (c->gc_stats.in_use <= BCH_WRITEBACK_FRAGMENT_THRESHOLD_HIGH) { ++ fp_term = dc->writeback_rate_fp_term_mid * ++ (c->gc_stats.in_use - BCH_WRITEBACK_FRAGMENT_THRESHOLD_MID); ++ } else { ++ fp_term = dc->writeback_rate_fp_term_high * ++ (c->gc_stats.in_use - BCH_WRITEBACK_FRAGMENT_THRESHOLD_HIGH); ++ } ++ fps = div_s64(dirty, dirty_buckets) * fp_term; ++ if (fragment > 3 && fps > proportional_scaled) { ++ /* Only overrite the p when fragment > 3 */ ++ proportional_scaled = fps; ++ } ++ } ++ + if ((error < 0 && dc->writeback_rate_integral > 0) || + (error > 0 && time_before64(local_clock(), + dc->writeback_rate.next + NSEC_PER_MSEC))) { +@@ -977,6 +1015,7 @@ void bch_cached_dev_writeback_init(struct cached_dev *dc) + + dc->writeback_metadata = true; + dc->writeback_running = false; ++ dc->writeback_consider_fragment = true; + dc->writeback_percent = 10; + dc->writeback_delay = 30; + atomic_long_set(&dc->writeback_rate.rate, 1024); +@@ -984,6 +1023,9 @@ void bch_cached_dev_writeback_init(struct cached_dev *dc) + + dc->writeback_rate_update_seconds = WRITEBACK_RATE_UPDATE_SECS_DEFAULT; + dc->writeback_rate_p_term_inverse = 40; ++ dc->writeback_rate_fp_term_low = 1; ++ dc->writeback_rate_fp_term_mid = 10; ++ dc->writeback_rate_fp_term_high = 1000; + dc->writeback_rate_i_term_inverse = 10000; + + WARN_ON(test_and_clear_bit(BCACHE_DEV_WB_RUNNING, &dc->disk.flags)); +diff --git a/drivers/md/bcache/writeback.h b/drivers/md/bcache/writeback.h +index 3f1230e22de0..02b2f9df73f6 100644 +--- a/drivers/md/bcache/writeback.h ++++ b/drivers/md/bcache/writeback.h +@@ -16,6 +16,10 @@ + + #define BCH_AUTO_GC_DIRTY_THRESHOLD 50 + ++#define BCH_WRITEBACK_FRAGMENT_THRESHOLD_LOW 50 ++#define BCH_WRITEBACK_FRAGMENT_THRESHOLD_MID 57 ++#define BCH_WRITEBACK_FRAGMENT_THRESHOLD_HIGH 64 ++ + #define BCH_DIRTY_INIT_THRD_MAX 64 + /* + * 14 (16384ths) is chosen here as something that each backing device +-- +2.26.2 + diff --git a/patches.suse/0029-bcache-Fix-register_device_aync-typo.patch b/patches.suse/0029-bcache-Fix-register_device_aync-typo.patch new file mode 100644 index 0000000..e269c64 --- /dev/null +++ b/patches.suse/0029-bcache-Fix-register_device_aync-typo.patch @@ -0,0 +1,44 @@ +From d7fae7b4fa152795ab70c680d3a63c7843c9368c Mon Sep 17 00:00:00 2001 +From: Kai Krakow +Date: Wed, 10 Feb 2021 13:07:24 +0800 +Subject: [PATCH] bcache: Fix register_device_aync typo +Git-commit: d7fae7b4fa152795ab70c680d3a63c7843c9368c +Patch-mainline: v5.12-rc1 +References: git-fixes + +Should be `register_device_async`. + +Cc: Coly Li +Signed-off-by: Kai Krakow +Signed-off-by: Coly Li +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/super.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 193fe7652329..dfbaf6aa3e4f 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -2517,7 +2517,7 @@ static void register_cache_worker(struct work_struct *work) + module_put(THIS_MODULE); + } + +-static void register_device_aync(struct async_reg_args *args) ++static void register_device_async(struct async_reg_args *args) + { + if (SB_IS_BDEV(args->sb)) + INIT_DELAYED_WORK(&args->reg_work, register_bdev_worker); +@@ -2611,7 +2611,7 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr, + args->sb = sb; + args->sb_disk = sb_disk; + args->bdev = bdev; +- register_device_aync(args); ++ register_device_async(args); + /* No wait and returns to user space */ + goto async_done; + } +-- +2.26.2 + diff --git a/patches.suse/0030-Revert-bcache-Kill-btree_io_wq.patch b/patches.suse/0030-Revert-bcache-Kill-btree_io_wq.patch new file mode 100644 index 0000000..299f3cf --- /dev/null +++ b/patches.suse/0030-Revert-bcache-Kill-btree_io_wq.patch @@ -0,0 +1,123 @@ +From 9f233ffe02e5cef611100cd8c5bcf4de26ca7bef Mon Sep 17 00:00:00 2001 +From: Kai Krakow +Date: Wed, 10 Feb 2021 13:07:25 +0800 +Subject: [PATCH] Revert "bcache: Kill btree_io_wq" +Git-commit: 9f233ffe02e5cef611100cd8c5bcf4de26ca7bef +Patch-mainline: v5.12-rc1 +References: git-fixes + +This reverts commit 56b30770b27d54d68ad51eccc6d888282b568cee. + +With the btree using the `system_wq`, I seem to see a lot more desktop +latency than I should. + +After some more investigation, it looks like the original assumption +of 56b3077 no longer is true, and bcache has a very high potential of +congesting the `system_wq`. In turn, this introduces laggy desktop +performance, IO stalls (at least with btrfs), and input events may be +delayed. + +So let's revert this. It's important to note that the semantics of +using `system_wq` previously mean that `btree_io_wq` should be created +before and destroyed after other bcache wqs to keep the same +assumptions. + +Cc: Coly Li +Cc: stable@vger.kernel.org # 5.4+ +Signed-off-by: Kai Krakow +Signed-off-by: Coly Li +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/bcache.h | 2 ++ + drivers/md/bcache/btree.c | 21 +++++++++++++++++++-- + drivers/md/bcache/super.c | 4 ++++ + 3 files changed, 25 insertions(+), 2 deletions(-) + +diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h +index d7a84327b7f1..2b8c7dd2cfae 100644 +--- a/drivers/md/bcache/bcache.h ++++ b/drivers/md/bcache/bcache.h +@@ -1046,5 +1046,7 @@ void bch_debug_exit(void); + void bch_debug_init(void); + void bch_request_exit(void); + int bch_request_init(void); ++void bch_btree_exit(void); ++int bch_btree_init(void); + + #endif /* _BCACHE_H */ +diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c +index 910df242c83d..952f022db5a5 100644 +--- a/drivers/md/bcache/btree.c ++++ b/drivers/md/bcache/btree.c +@@ -99,6 +99,8 @@ + #define PTR_HASH(c, k) \ + (((k)->ptr[0] >> c->bucket_bits) | PTR_GEN(k, 0)) + ++static struct workqueue_struct *btree_io_wq; ++ + #define insert_lock(s, b) ((b)->level <= (s)->lock) + + +@@ -308,7 +310,7 @@ static void __btree_node_write_done(struct closure *cl) + btree_complete_write(b, w); + + if (btree_node_dirty(b)) +- schedule_delayed_work(&b->work, 30 * HZ); ++ queue_delayed_work(btree_io_wq, &b->work, 30 * HZ); + + closure_return_with_destructor(cl, btree_node_write_unlock); + } +@@ -481,7 +483,7 @@ static void bch_btree_leaf_dirty(struct btree *b, atomic_t *journal_ref) + BUG_ON(!i->keys); + + if (!btree_node_dirty(b)) +- schedule_delayed_work(&b->work, 30 * HZ); ++ queue_delayed_work(btree_io_wq, &b->work, 30 * HZ); + + set_btree_node_dirty(b); + +@@ -2764,3 +2766,18 @@ void bch_keybuf_init(struct keybuf *buf) + spin_lock_init(&buf->lock); + array_allocator_init(&buf->freelist); + } ++ ++void bch_btree_exit(void) ++{ ++ if (btree_io_wq) ++ destroy_workqueue(btree_io_wq); ++} ++ ++int __init bch_btree_init(void) ++{ ++ btree_io_wq = create_singlethread_workqueue("bch_btree_io"); ++ if (!btree_io_wq) ++ return -ENOMEM; ++ ++ return 0; ++} +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index dfbaf6aa3e4f..97405aec4b51 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -2821,6 +2821,7 @@ static void bcache_exit(void) + destroy_workqueue(bcache_wq); + if (bch_journal_wq) + destroy_workqueue(bch_journal_wq); ++ bch_btree_exit(); + + if (bcache_major) + unregister_blkdev(bcache_major, "bcache"); +@@ -2876,6 +2877,9 @@ static int __init bcache_init(void) + return bcache_major; + } + ++ if (bch_btree_init()) ++ goto err; ++ + bcache_wq = alloc_workqueue("bcache", WQ_MEM_RECLAIM, 0); + if (!bcache_wq) + goto err; +-- +2.26.2 + diff --git a/patches.suse/0030-dm-fix-bio-splitting-and-its-bio-completion-order-fo.patch b/patches.suse/0030-dm-fix-bio-splitting-and-its-bio-completion-order-fo.patch deleted file mode 100644 index 893a69d..0000000 --- a/patches.suse/0030-dm-fix-bio-splitting-and-its-bio-completion-order-fo.patch +++ /dev/null @@ -1,80 +0,0 @@ -From ee1dfad5325ff1cfb2239e564cd411b3bfe8667a Mon Sep 17 00:00:00 2001 -From: Mike Snitzer -Date: Mon, 14 Sep 2020 13:04:19 -0400 -Subject: [PATCH] dm: fix bio splitting and its bio completion order for - regular IO -Git-commit: ee1dfad5325ff1cfb2239e564cd411b3bfe8667a -Patch-mainline: v5.9-rc7 -References: bsc#1175995, jsc#SLE-15608 - -dm_queue_split() is removed because __split_and_process_bio() _must_ -handle splitting bios to ensure proper bio submission and completion -ordering as a bio is split. - -Otherwise, multiple recursive calls to ->submit_bio will cause multiple -split bios to be allocated from the same ->bio_split mempool at the same -time. This would result in deadlock in low memory conditions because no -progress could be made (only one bio is available in ->bio_split -mempool). - -This fix has been verified to still fix the loss of performance, due -to excess splitting, that commit 120c9257f5f1 provided. - -Fixes: 120c9257f5f1 ("Revert "dm: always call blk_queue_split() in dm_process_bio()"") -Cc: stable@vger.kernel.org # 5.0+, requires custom backport due to 5.9 changes -Reported-by: Ming Lei -Signed-off-by: Mike Snitzer -Signed-off-by: Coly Li - ---- - drivers/md/dm.c | 23 ++--------------------- - 1 file changed, 2 insertions(+), 21 deletions(-) - -diff --git a/drivers/md/dm.c b/drivers/md/dm.c -index 4a40df8af7d3..d948cd522431 100644 ---- a/drivers/md/dm.c -+++ b/drivers/md/dm.c -@@ -1724,23 +1724,6 @@ static blk_qc_t __process_bio(struct mapped_device *md, struct dm_table *map, - return ret; - } - --static void dm_queue_split(struct mapped_device *md, struct dm_target *ti, struct bio **bio) --{ -- unsigned len, sector_count; -- -- sector_count = bio_sectors(*bio); -- len = min_t(sector_t, max_io_len((*bio)->bi_iter.bi_sector, ti), sector_count); -- -- if (sector_count > len) { -- struct bio *split = bio_split(*bio, len, GFP_NOIO, &md->queue->bio_split); -- -- bio_chain(split, *bio); -- trace_block_split(md->queue, split, (*bio)->bi_iter.bi_sector); -- submit_bio_noacct(*bio); -- *bio = split; -- } --} -- - static blk_qc_t dm_process_bio(struct mapped_device *md, - struct dm_table *map, struct bio *bio) - { -@@ -1768,14 +1751,12 @@ static blk_qc_t dm_process_bio(struct mapped_device *md, - if (current->bio_list) { - if (is_abnormal_io(bio)) - blk_queue_split(&bio); -- else -- dm_queue_split(md, ti, &bio); -+ /* regular IO is split by __split_and_process_bio */ - } - - if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED) - return __process_bio(md, map, bio, ti); -- else -- return __split_and_process_bio(md, map, bio); -+ return __split_and_process_bio(md, map, bio); - } - - static blk_qc_t dm_submit_bio(struct bio *bio) --- -2.26.2 - diff --git a/patches.suse/0031-bcache-Give-btree_io_wq-correct-semantics-again.patch b/patches.suse/0031-bcache-Give-btree_io_wq-correct-semantics-again.patch new file mode 100644 index 0000000..ff5c391 --- /dev/null +++ b/patches.suse/0031-bcache-Give-btree_io_wq-correct-semantics-again.patch @@ -0,0 +1,42 @@ +From d797bd9897e3559eb48d68368550d637d32e468c Mon Sep 17 00:00:00 2001 +From: Kai Krakow +Date: Wed, 10 Feb 2021 13:07:26 +0800 +Subject: [PATCH] bcache: Give btree_io_wq correct semantics again +Git-commit: d797bd9897e3559eb48d68368550d637d32e468c +Patch-mainline: v5.12-rc1 +References: git-fixes + +Before killing `btree_io_wq`, the queue was allocated using +`create_singlethread_workqueue()` which has `WQ_MEM_RECLAIM`. After +killing it, it no longer had this property but `system_wq` is not +single threaded. + +Let's combine both worlds and make it multi threaded but able to +reclaim memory. + +Cc: Coly Li +Cc: stable@vger.kernel.org # 5.4+ +Signed-off-by: Kai Krakow +Signed-off-by: Coly Li +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/btree.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c +index 952f022db5a5..fe6dce125aba 100644 +--- a/drivers/md/bcache/btree.c ++++ b/drivers/md/bcache/btree.c +@@ -2775,7 +2775,7 @@ void bch_btree_exit(void) + + int __init bch_btree_init(void) + { +- btree_io_wq = create_singlethread_workqueue("bch_btree_io"); ++ btree_io_wq = alloc_workqueue("bch_btree_io", WQ_MEM_RECLAIM, 0); + if (!btree_io_wq) + return -ENOMEM; + +-- +2.26.2 + diff --git a/patches.suse/0032-bcache-Move-journal-work-to-new-flush-wq.patch b/patches.suse/0032-bcache-Move-journal-work-to-new-flush-wq.patch new file mode 100644 index 0000000..f60e07d --- /dev/null +++ b/patches.suse/0032-bcache-Move-journal-work-to-new-flush-wq.patch @@ -0,0 +1,106 @@ +From afe78ab46f638ecdf80a35b122ffc92c20d9ae5d Mon Sep 17 00:00:00 2001 +From: Kai Krakow +Date: Wed, 10 Feb 2021 13:07:27 +0800 +Subject: [PATCH] bcache: Move journal work to new flush wq +Git-commit: afe78ab46f638ecdf80a35b122ffc92c20d9ae5d +Patch-mainline: v5.12-rc1 +References: git-fixes + +This is potentially long running and not latency sensitive, let's get +it out of the way of other latency sensitive events. + +As observed in the previous commit, the `system_wq` comes easily +congested by bcache, and this fixes a few more stalls I was observing +every once in a while. + +Let's not make this `WQ_MEM_RECLAIM` as it showed to reduce performance +of boot and file system operations in my tests. Also, without +`WQ_MEM_RECLAIM`, I no longer see desktop stalls. This matches the +previous behavior as `system_wq` also does no memory reclaim: + +> // workqueue.c: +> system_wq = alloc_workqueue("events", 0, 0); + +Cc: Coly Li +Cc: stable@vger.kernel.org # 5.4+ +Signed-off-by: Kai Krakow +Signed-off-by: Coly Li +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/bcache.h | 1 + + drivers/md/bcache/journal.c | 4 ++-- + drivers/md/bcache/super.c | 16 ++++++++++++++++ + 3 files changed, 19 insertions(+), 2 deletions(-) + +diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h +index 2b8c7dd2cfae..848dd4db1659 100644 +--- a/drivers/md/bcache/bcache.h ++++ b/drivers/md/bcache/bcache.h +@@ -1005,6 +1005,7 @@ void bch_write_bdev_super(struct cached_dev *dc, struct closure *parent); + + extern struct workqueue_struct *bcache_wq; + extern struct workqueue_struct *bch_journal_wq; ++extern struct workqueue_struct *bch_flush_wq; + extern struct mutex bch_register_lock; + extern struct list_head bch_cache_sets; + +diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c +index aefbdb7e003b..c6613e817333 100644 +--- a/drivers/md/bcache/journal.c ++++ b/drivers/md/bcache/journal.c +@@ -932,8 +932,8 @@ atomic_t *bch_journal(struct cache_set *c, + journal_try_write(c); + } else if (!w->dirty) { + w->dirty = true; +- schedule_delayed_work(&c->journal.work, +- msecs_to_jiffies(c->journal_delay_ms)); ++ queue_delayed_work(bch_flush_wq, &c->journal.work, ++ msecs_to_jiffies(c->journal_delay_ms)); + spin_unlock(&c->journal.lock); + } else { + spin_unlock(&c->journal.lock); +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 97405aec4b51..71691f32959b 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -49,6 +49,7 @@ static int bcache_major; + static DEFINE_IDA(bcache_device_idx); + static wait_queue_head_t unregister_wait; + struct workqueue_struct *bcache_wq; ++struct workqueue_struct *bch_flush_wq; + struct workqueue_struct *bch_journal_wq; + + +@@ -2821,6 +2822,8 @@ static void bcache_exit(void) + destroy_workqueue(bcache_wq); + if (bch_journal_wq) + destroy_workqueue(bch_journal_wq); ++ if (bch_flush_wq) ++ destroy_workqueue(bch_flush_wq); + bch_btree_exit(); + + if (bcache_major) +@@ -2884,6 +2887,19 @@ static int __init bcache_init(void) + if (!bcache_wq) + goto err; + ++ /* ++ * Let's not make this `WQ_MEM_RECLAIM` for the following reasons: ++ * ++ * 1. It used `system_wq` before which also does no memory reclaim. ++ * 2. With `WQ_MEM_RECLAIM` desktop stalls, increased boot times, and ++ * reduced throughput can be observed. ++ * ++ * We still want to user our own queue to not congest the `system_wq`. ++ */ ++ bch_flush_wq = alloc_workqueue("bch_flush", 0, 0); ++ if (!bch_flush_wq) ++ goto err; ++ + bch_journal_wq = alloc_workqueue("bch_journal", WQ_MEM_RECLAIM, 0); + if (!bch_journal_wq) + goto err; +-- +2.26.2 + diff --git a/patches.suse/0033-bcache-Avoid-comma-separated-statements.patch b/patches.suse/0033-bcache-Avoid-comma-separated-statements.patch new file mode 100644 index 0000000..909dcf1 --- /dev/null +++ b/patches.suse/0033-bcache-Avoid-comma-separated-statements.patch @@ -0,0 +1,69 @@ +From 6751c1e3cff3aa763c760c08862627069a37b50e Mon Sep 17 00:00:00 2001 +From: Joe Perches +Date: Wed, 10 Feb 2021 13:07:28 +0800 +Subject: [PATCH] bcache: Avoid comma separated statements +Git-commit: 6751c1e3cff3aa763c760c08862627069a37b50e +Patch-mainline: v5.12-rc1 +References: git-fixes + +Use semicolons and braces. + +Signed-off-by: Joe Perches +Signed-off-by: Coly Li +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/bset.c | 12 ++++++++---- + drivers/md/bcache/sysfs.c | 6 ++++-- + 2 files changed, 12 insertions(+), 6 deletions(-) + +diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c +index 67a2c47f4201..94d38e8a59b3 100644 +--- a/drivers/md/bcache/bset.c ++++ b/drivers/md/bcache/bset.c +@@ -712,8 +712,10 @@ void bch_bset_build_written_tree(struct btree_keys *b) + for (j = inorder_next(0, t->size); + j; + j = inorder_next(j, t->size)) { +- while (bkey_to_cacheline(t, k) < cacheline) +- prev = k, k = bkey_next(k); ++ while (bkey_to_cacheline(t, k) < cacheline) { ++ prev = k; ++ k = bkey_next(k); ++ } + + t->prev[j] = bkey_u64s(prev); + t->tree[j].m = bkey_to_cacheline_offset(t, cacheline++, k); +@@ -901,8 +903,10 @@ unsigned int bch_btree_insert_key(struct btree_keys *b, struct bkey *k, + status = BTREE_INSERT_STATUS_INSERT; + + while (m != bset_bkey_last(i) && +- bkey_cmp(k, b->ops->is_extents ? &START_KEY(m) : m) > 0) +- prev = m, m = bkey_next(m); ++ bkey_cmp(k, b->ops->is_extents ? &START_KEY(m) : m) > 0) { ++ prev = m; ++ m = bkey_next(m); ++ } + + /* prev is in the tree, if we merge we're done */ + status = BTREE_INSERT_STATUS_BACK_MERGE; +diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c +index eef15f8022ba..cc89f3156d1a 100644 +--- a/drivers/md/bcache/sysfs.c ++++ b/drivers/md/bcache/sysfs.c +@@ -1094,8 +1094,10 @@ SHOW(__bch_cache) + --n; + + while (cached < p + n && +- *cached == BTREE_PRIO) +- cached++, n--; ++ *cached == BTREE_PRIO) { ++ cached++; ++ n--; ++ } + + for (i = 0; i < n; i++) + sum += INITIAL_PRIO - cached[i]; +-- +2.26.2 + diff --git a/patches.suse/ACPI-bus-Constify-is_acpi_node-and-friends-part-2.patch b/patches.suse/ACPI-bus-Constify-is_acpi_node-and-friends-part-2.patch new file mode 100644 index 0000000..200098d --- /dev/null +++ b/patches.suse/ACPI-bus-Constify-is_acpi_node-and-friends-part-2.patch @@ -0,0 +1,53 @@ +From ff70784ab9f89e78e67d5d172bf7644de673f61f Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Tue, 2 Mar 2021 15:35:48 +0200 +Subject: [PATCH] ACPI: bus: Constify is_acpi_node() and friends (part 2) +Git-commit: ff70784ab9f89e78e67d5d172bf7644de673f61f +Patch-mainline: v5.12-rc2 +References: git-fixes + +Commit 8b9d6802583a ("ACPI: Constify acpi_bus helper functions, +switch to macros") only changed functions for CONFIG_ACPI=y case. +This part adjusts the rest. + +Fixes: 8b9d6802583a ("ACPI: Constify acpi_bus helper functions, switch to macros") +Signed-off-by: Andy Shevchenko +Reviewed-by: Sakari Ailus +Signed-off-by: Rafael J. Wysocki +Acked-by: Takashi Iwai + +--- + include/linux/acpi.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/include/linux/acpi.h b/include/linux/acpi.h +index 3c5757d539ab..9f432411e988 100644 +--- a/include/linux/acpi.h ++++ b/include/linux/acpi.h +@@ -746,12 +746,12 @@ acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv) + + static inline void acpi_dev_put(struct acpi_device *adev) {} + +-static inline bool is_acpi_node(struct fwnode_handle *fwnode) ++static inline bool is_acpi_node(const struct fwnode_handle *fwnode) + { + return false; + } + +-static inline bool is_acpi_device_node(struct fwnode_handle *fwnode) ++static inline bool is_acpi_device_node(const struct fwnode_handle *fwnode) + { + return false; + } +@@ -761,7 +761,7 @@ static inline struct acpi_device *to_acpi_device_node(struct fwnode_handle *fwno + return NULL; + } + +-static inline bool is_acpi_data_node(struct fwnode_handle *fwnode) ++static inline bool is_acpi_data_node(const struct fwnode_handle *fwnode) + { + return false; + } +-- +2.26.2 + diff --git a/patches.suse/ALSA-ctxfi-cthw20k2-fix-mask-on-conf-to-allow-4-bits.patch b/patches.suse/ALSA-ctxfi-cthw20k2-fix-mask-on-conf-to-allow-4-bits.patch new file mode 100644 index 0000000..41b6c16 --- /dev/null +++ b/patches.suse/ALSA-ctxfi-cthw20k2-fix-mask-on-conf-to-allow-4-bits.patch @@ -0,0 +1,45 @@ +From 26a9630c72ebac7c564db305a6aee54a8edde70e Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Sat, 27 Feb 2021 00:15:27 +0000 +Subject: [PATCH] ALSA: ctxfi: cthw20k2: fix mask on conf to allow 4 bits +Git-commit: 26a9630c72ebac7c564db305a6aee54a8edde70e +Patch-mainline: v5.12-rc2 +References: git-fixes + +Currently the mask operation on variable conf is just 3 bits so +the switch statement case value of 8 is unreachable dead code. +The function daio_mgr_dao_init can be passed a 4 bit value, +function dao_rsc_init calls it with conf set to: + + conf = (desc->msr & 0x7) | (desc->passthru << 3); + +so clearly when desc->passthru is set to 1 then conf can be +at least 8. + +Fix this by changing the mask to 0xf. + +Fixes: 8cc72361481f ("ALSA: SB X-Fi driver merge") +Signed-off-by: Colin Ian King +Link: https://lore.kernel.org/r/20210227001527.1077484-1-colin.king@canonical.com +Signed-off-by: Takashi Iwai + +--- + sound/pci/ctxfi/cthw20k2.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c +index a855fb8c58bd..55af8ef29838 100644 +--- a/sound/pci/ctxfi/cthw20k2.c ++++ b/sound/pci/ctxfi/cthw20k2.c +@@ -991,7 +991,7 @@ static int daio_mgr_dao_init(void *blk, unsigned int idx, unsigned int conf) + + if (idx < 4) { + /* S/PDIF output */ +- switch ((conf & 0x7)) { ++ switch ((conf & 0xf)) { + case 1: + set_field(&ctl->txctl[idx], ATXCTL_NUC, 0); + break; +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-intel-nhlt-verify-config-type.patch b/patches.suse/ALSA-hda-intel-nhlt-verify-config-type.patch new file mode 100644 index 0000000..50f4991 --- /dev/null +++ b/patches.suse/ALSA-hda-intel-nhlt-verify-config-type.patch @@ -0,0 +1,142 @@ +From a864e8f159b13babf552aff14a5fbe11abc017e4 Mon Sep 17 00:00:00 2001 +From: Pierre-Louis Bossart +Date: Mon, 1 Mar 2021 18:01:46 -0600 +Subject: [PATCH] ALSA: hda: intel-nhlt: verify config type +Git-commit: a864e8f159b13babf552aff14a5fbe11abc017e4 +Patch-mainline: v5.12-rc2 +References: git-fixes + +Multiple bug reports report issues with the SOF and SST drivers when +dealing with single microphone cases. + +We currently read the DMIC array information unconditionally but we +don't check that the configuration type is actually a mic array. + +When the DMIC link does not rely on a mic array configuration, the +recommendation is to check the format information to infer the maximum +number of channels, and map this to the number of microphones. + +This leaves a potential for a mismatch between actual microphones +available in hardware and what the ACPI table contains, but we have no +other source of information. + +Note that single microphone configurations can alternatively be +handled with a 'mic array' configuration along with a 'vendor-defined' +geometry. + +Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201251 +Buglink: https://github.com/thesofproject/linux/issues/2725 +Fixes: 7a33ea70e1868 ('ALSA: hda: intel-nhlt: handle NHLT VENDOR_DEFINED DMIC geometry') +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Guennadi Liakhovetski +Reviewed-by: Rander Wang +Reviewed-by: Kai Vehmanen +Link: https://lore.kernel.org/r/20210302000146.1177770-1-pierre-louis.bossart@linux.intel.com +Signed-off-by: Takashi Iwai + +--- + include/sound/intel-nhlt.h | 5 ++++ + sound/hda/intel-nhlt.c | 54 +++++++++++++++++++++++++++++++------- + 2 files changed, 50 insertions(+), 9 deletions(-) + +diff --git a/include/sound/intel-nhlt.h b/include/sound/intel-nhlt.h +index 743c2f442280..d0574805865f 100644 +--- a/include/sound/intel-nhlt.h ++++ b/include/sound/intel-nhlt.h +@@ -112,6 +112,11 @@ struct nhlt_vendor_dmic_array_config { + /* TODO add vendor mic config */ + } __packed; + ++enum { ++ NHLT_CONFIG_TYPE_GENERIC = 0, ++ NHLT_CONFIG_TYPE_MIC_ARRAY = 1 ++}; ++ + enum { + NHLT_MIC_ARRAY_2CH_SMALL = 0xa, + NHLT_MIC_ARRAY_2CH_BIG = 0xb, +diff --git a/sound/hda/intel-nhlt.c b/sound/hda/intel-nhlt.c +index 059aaf04f536..d053beccfaec 100644 +--- a/sound/hda/intel-nhlt.c ++++ b/sound/hda/intel-nhlt.c +@@ -31,18 +31,44 @@ int intel_nhlt_get_dmic_geo(struct device *dev, struct nhlt_acpi_table *nhlt) + struct nhlt_endpoint *epnt; + struct nhlt_dmic_array_config *cfg; + struct nhlt_vendor_dmic_array_config *cfg_vendor; ++ struct nhlt_fmt *fmt_configs; + unsigned int dmic_geo = 0; +- u8 j; ++ u16 max_ch = 0; ++ u8 i, j; + + if (!nhlt) + return 0; + +- epnt = (struct nhlt_endpoint *)nhlt->desc; ++ for (j = 0, epnt = nhlt->desc; j < nhlt->endpoint_count; j++, ++ epnt = (struct nhlt_endpoint *)((u8 *)epnt + epnt->length)) { + +- for (j = 0; j < nhlt->endpoint_count; j++) { +- if (epnt->linktype == NHLT_LINK_DMIC) { +- cfg = (struct nhlt_dmic_array_config *) +- (epnt->config.caps); ++ if (epnt->linktype != NHLT_LINK_DMIC) ++ continue; ++ ++ cfg = (struct nhlt_dmic_array_config *)(epnt->config.caps); ++ fmt_configs = (struct nhlt_fmt *)(epnt->config.caps + epnt->config.size); ++ ++ /* find max number of channels based on format_configuration */ ++ if (fmt_configs->fmt_count) { ++ dev_dbg(dev, "%s: found %d format definitions\n", ++ __func__, fmt_configs->fmt_count); ++ ++ for (i = 0; i < fmt_configs->fmt_count; i++) { ++ struct wav_fmt_ext *fmt_ext; ++ ++ fmt_ext = &fmt_configs->fmt_config[i].fmt_ext; ++ ++ if (fmt_ext->fmt.channels > max_ch) ++ max_ch = fmt_ext->fmt.channels; ++ } ++ dev_dbg(dev, "%s: max channels found %d\n", __func__, max_ch); ++ } else { ++ dev_dbg(dev, "%s: No format information found\n", __func__); ++ } ++ ++ if (cfg->device_config.config_type != NHLT_CONFIG_TYPE_MIC_ARRAY) { ++ dmic_geo = max_ch; ++ } else { + switch (cfg->array_type) { + case NHLT_MIC_ARRAY_2CH_SMALL: + case NHLT_MIC_ARRAY_2CH_BIG: +@@ -59,13 +85,23 @@ int intel_nhlt_get_dmic_geo(struct device *dev, struct nhlt_acpi_table *nhlt) + dmic_geo = cfg_vendor->nb_mics; + break; + default: +- dev_warn(dev, "undefined DMIC array_type 0x%0x\n", +- cfg->array_type); ++ dev_warn(dev, "%s: undefined DMIC array_type 0x%0x\n", ++ __func__, cfg->array_type); ++ } ++ ++ if (dmic_geo > 0) { ++ dev_dbg(dev, "%s: Array with %d dmics\n", __func__, dmic_geo); ++ } ++ if (max_ch > dmic_geo) { ++ dev_dbg(dev, "%s: max channels %d exceed dmic number %d\n", ++ __func__, max_ch, dmic_geo); + } + } +- epnt = (struct nhlt_endpoint *)((u8 *)epnt + epnt->length); + } + ++ dev_dbg(dev, "%s: dmic number %d max_ch %d\n", ++ __func__, dmic_geo, max_ch); ++ + return dmic_geo; + } + EXPORT_SYMBOL_GPL(intel_nhlt_get_dmic_geo); +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Add-quirk-for-Clevo-NH55RZQ.patch b/patches.suse/ALSA-hda-realtek-Add-quirk-for-Clevo-NH55RZQ.patch new file mode 100644 index 0000000..afb7cbe --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Add-quirk-for-Clevo-NH55RZQ.patch @@ -0,0 +1,41 @@ +From 48698c973e6b4dde94d87cd1ded56d9436e9c97d Mon Sep 17 00:00:00 2001 +From: Eckhart Mohr +Date: Tue, 2 Mar 2021 17:25:22 +0100 +Subject: [PATCH] ALSA: hda/realtek: Add quirk for Clevo NH55RZQ +Git-commit: 48698c973e6b4dde94d87cd1ded56d9436e9c97d +Patch-mainline: v5.12-rc2 +References: git-fixes + +This applies a SND_PCI_QUIRK(...) to the Clevo NH55RZQ barebone. This +fixes the issue of the device not recognizing a pluged in microphone. + +The device has both, a microphone only jack, and a speaker + microphone +combo jack. The combo jack already works. The microphone-only jack does +not recognize when a device is pluged in without this patch. + +Signed-off-by: Eckhart Mohr +Co-developed-by: Werner Sembach +Signed-off-by: Werner Sembach +Cc: +Link: https://lore.kernel.org/r/0eee6545-5169-ef08-6cfa-5def8cd48c86@tuxedocomputers.com +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 4871507cd4bf..2b7ddb3baf93 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8141,6 +8141,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC), + SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC), ++ SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[5|7][0-9]RZ[Q]", ALC269_FIXUP_DMIC), + SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Add-quirk-for-Intel-NUC-10.patch b/patches.suse/ALSA-hda-realtek-Add-quirk-for-Intel-NUC-10.patch new file mode 100644 index 0000000..f71d784 --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Add-quirk-for-Intel-NUC-10.patch @@ -0,0 +1,67 @@ +From 73e7161eab5dee98114987239ec9c87fe8034ddb Mon Sep 17 00:00:00 2001 +From: Werner Sembach +Date: Tue, 2 Mar 2021 19:04:14 +0100 +Subject: [PATCH] ALSA: hda/realtek: Add quirk for Intel NUC 10 +Git-commit: 73e7161eab5dee98114987239ec9c87fe8034ddb +Patch-mainline: v5.12-rc2 +References: git-fixes + +This adds a new SND_PCI_QUIRK(...) and applies it to the Intel NUC 10 +devices. This fixes the issue of the devices not having audio input and +output on the headset jack because the kernel does not recognize when +something is plugged in. + +The new quirk was inspired by the quirk for the Intel NUC 8 devices, but +it turned out that the NUC 10 uses another pin. This information was +acquired by black box testing likely pins. + +Co-developed-by: Eckhart Mohr +Signed-off-by: Eckhart Mohr +Signed-off-by: Werner Sembach +Cc: +Link: https://lore.kernel.org/r/20210302180414.23194-1-wse@tuxedocomputers.com +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 2b7ddb3baf93..7c24d13181e1 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6396,6 +6396,7 @@ enum { + ALC269_FIXUP_LEMOTE_A1802, + ALC269_FIXUP_LEMOTE_A190X, + ALC256_FIXUP_INTEL_NUC8_RUGGED, ++ ALC256_FIXUP_INTEL_NUC10, + ALC255_FIXUP_XIAOMI_HEADSET_MIC, + ALC274_FIXUP_HP_MIC, + ALC274_FIXUP_HP_HEADSET_MIC, +@@ -7783,6 +7784,15 @@ static const struct hda_fixup alc269_fixups[] = { + .chained = true, + .chain_id = ALC269_FIXUP_HEADSET_MODE + }, ++ [ALC256_FIXUP_INTEL_NUC10] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC269_FIXUP_HEADSET_MODE ++ }, + [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = { + .type = HDA_FIXUP_VERBS, + .v.verbs = (const struct hda_verb[]) { +@@ -8236,6 +8246,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802), + SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X), + SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED), ++ SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10), + + #if 0 + /* Below is a quirk table taken from the old code. +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Apply-dual-codec-quirks-for-MSI-God.patch b/patches.suse/ALSA-hda-realtek-Apply-dual-codec-quirks-for-MSI-God.patch new file mode 100644 index 0000000..a3718bd --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Apply-dual-codec-quirks-for-MSI-God.patch @@ -0,0 +1,37 @@ +From 26af17722a07597d3e556eda92c6fce8d528bc9f Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 3 Mar 2021 15:23:46 +0100 +Subject: [PATCH] ALSA: hda/realtek: Apply dual codec quirks for MSI Godlike + X570 board +Git-commit: 26af17722a07597d3e556eda92c6fce8d528bc9f +Patch-mainline: v5.12-rc2 +References: git-fixes + +There is another MSI board (1462:cc34) that has dual Realtek codecs, +and we need to apply the existing quirk for fixing the conflicts of +Master control. + +Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=211743 +Cc: +Link: https://lore.kernel.org/r/20210303142346.28182-1-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 7c24d13181e1..b47504fa8dfd 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -2532,6 +2532,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { + SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), ++ SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS), + SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS), + SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), + SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Enable-headset-mic-of-Acer-SWIFT-wi.patch b/patches.suse/ALSA-hda-realtek-Enable-headset-mic-of-Acer-SWIFT-wi.patch new file mode 100644 index 0000000..c29484f --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Enable-headset-mic-of-Acer-SWIFT-wi.patch @@ -0,0 +1,69 @@ +From d0e185616a0331c87ce3aa1d7dfde8df39d6d002 Mon Sep 17 00:00:00 2001 +From: Chris Chiu +Date: Fri, 26 Feb 2021 09:04:40 +0800 +Subject: [PATCH] ALSA: hda/realtek: Enable headset mic of Acer SWIFT with + ALC256 +Git-commit: d0e185616a0331c87ce3aa1d7dfde8df39d6d002 +Patch-mainline: v5.12-rc2 +References: git-fixes + +The Acer SWIFT Swift SF314-54/55 laptops with ALC256 cannot detect +both the headset mic and the internal mic. Introduce new fixup +to enable the jack sense and the headset mic. However, the internal +mic actually connects to Intel SST audio. It still needs Intel SST +support to make internal mic capture work. + +Signed-off-by: Chris Chiu +Acked-by: Jian-Hong Pan +Cc: +Link: https://lore.kernel.org/r/20210226010440.8474-1-chris.chiu@canonical.com +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 1927605f0f7e..4871507cd4bf 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6406,6 +6406,7 @@ enum { + ALC236_FIXUP_DELL_AIO_HEADSET_MIC, + ALC282_FIXUP_ACER_DISABLE_LINEOUT, + ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST, ++ ALC256_FIXUP_ACER_HEADSET_MIC, + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -7853,6 +7854,16 @@ static const struct hda_fixup alc269_fixups[] = { + .chained = true, + .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, + }, ++ [ALC256_FIXUP_ACER_HEADSET_MIC] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */ ++ { 0x1a, 0x90a1092f }, /* use as internal mic */ ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -7879,9 +7890,11 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK), + SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS), + SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE), ++ SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), ++ SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC), +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-Add-Plantronics-C320-M-USB-ctrl-msg-delay-q.patch b/patches.suse/ALSA-usb-Add-Plantronics-C320-M-USB-ctrl-msg-delay-q.patch new file mode 100644 index 0000000..0b76e1c --- /dev/null +++ b/patches.suse/ALSA-usb-Add-Plantronics-C320-M-USB-ctrl-msg-delay-q.patch @@ -0,0 +1,47 @@ +From fc7c5c208eb7bc2df3a9f4234f14eca250001cb6 Mon Sep 17 00:00:00 2001 +From: John Ernberg +Date: Wed, 3 Mar 2021 18:14:39 +0000 +Subject: [PATCH] ALSA: usb: Add Plantronics C320-M USB ctrl msg delay quirk +References: bsc#1182552 +Git-commit: fc7c5c208eb7bc2df3a9f4234f14eca250001cb6 +Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git +Patch-mainline: Queued in subsystem maintainer repository + +The microphone in the Plantronics C320-M headset will randomly +fail to initialize properly, at least when using Microsoft Teams. +Introducing a 20ms delay on the control messages appears to +resolve the issue. + +Link: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1065 +Tested-by: Andreas Kempe +Signed-off-by: John Ernberg +Cc: +Link: https://lore.kernel.org/r/20210303181405.39835-1-john.ernberg@actia.se +Signed-off-by: Takashi Iwai + +--- + sound/usb/quirks.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c +index 737b2729c0d3..0864692d8a7b 100644 +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1670,6 +1670,14 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, + && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) + msleep(20); + ++ /* ++ * Plantronics C320-M needs a delay to avoid random ++ * microhpone failures. ++ */ ++ if (chip->usb_id == USB_ID(0x047f, 0xc025) && ++ (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) ++ msleep(20); ++ + /* Zoom R16/24, many Logitech(at least H650e/H570e/BCC950), + * Jabra 550a, Kingston HyperX needs a tiny delay here, + * otherwise requests like get/set frequency return +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-audio-Allow-modifying-parameters-with-succe.patch b/patches.suse/ALSA-usb-audio-Allow-modifying-parameters-with-succe.patch new file mode 100644 index 0000000..9c59130 --- /dev/null +++ b/patches.suse/ALSA-usb-audio-Allow-modifying-parameters-with-succe.patch @@ -0,0 +1,75 @@ +From 5f5e6a3e8b1df52f79122e447855cffbf1710540 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Sun, 28 Feb 2021 09:01:38 +0100 +Subject: [PATCH] ALSA: usb-audio: Allow modifying parameters with succeeding hw_params calls +Git-commit: 5f5e6a3e8b1df52f79122e447855cffbf1710540 +Patch-mainline: v5.12 or v5.12-rc2 (next release) +References: bsc#1182552 + +The recent fix for the hw constraints for implicit feedback streams +via commit e4ea77f8e53f ("ALSA: usb-audio: Always apply the hw +constraints for implicit fb sync") added the check of the matching +endpoints and whether those EPs are already opened. This is needed +and correct, per se, even for the normal streams without the implicit +feedback, as the endpoint setup is exclusive. + +However, it's reported that there seem applications that behave in +unexpected ways to update the hw_params without clearing the previous +setup via hw_free, and those hit a problem now: then hw_params is +called with still the previous EP setup kept, hence it's restricted +with the previous own setup. Although the obvious fix is to call +snd_pcm_hw_free() API in the application side, it's a kind of +unwelcome change. + +This patch tries to ease the situation: in the endpoint check, we add +a couple of more conditions and now skip the endpoint that is being +used only by the stream in question itself. That is, in addition to +the presence check of ep (ep->cur_audiofmt is non-NULL), when the +following conditions are met, we skip such an ep: +- ep->opened == 1, and +- ep->cur_audiofmt == subs->cur_audiofmt. + +subs->cur_audiofmt is non-NULL only if it's a re-setup of hw_params, +and ep->cur_audiofmt points to the currently set up parameters. So if +those match, it must be this stream itself. + +Fixes: e4ea77f8e53f ("ALSA: usb-audio: Always apply the hw constraints for implicit fb sync") +Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=211941 +Cc: +Link: https://lore.kernel.org/r/20210228080138.9936-1-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/usb/pcm.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c +index bf5a0f3c1fad..e5311b6bb3f6 100644 +--- a/sound/usb/pcm.c ++++ b/sound/usb/pcm.c +@@ -845,13 +845,19 @@ get_sync_ep_from_substream(struct snd_usb_substream *subs) + + list_for_each_entry(fp, &subs->fmt_list, list) { + ep = snd_usb_get_endpoint(chip, fp->endpoint); +- if (ep && ep->cur_rate) +- return ep; ++ if (ep && ep->cur_audiofmt) { ++ /* if EP is already opened solely for this substream, ++ * we still allow us to change the parameter; otherwise ++ * this substream has to follow the existing parameter ++ */ ++ if (ep->cur_audiofmt != subs->cur_audiofmt || ep->opened > 1) ++ return ep; ++ } + if (!fp->implicit_fb) + continue; + /* for the implicit fb, check the sync ep as well */ + ep = snd_usb_get_endpoint(chip, fp->sync_ep); +- if (ep && ep->cur_rate) ++ if (ep && ep->cur_audiofmt) + return ep; + } + return NULL; +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-audio-Apply-the-control-quirk-to-Plantronic.patch b/patches.suse/ALSA-usb-audio-Apply-the-control-quirk-to-Plantronic.patch new file mode 100644 index 0000000..9cc005b --- /dev/null +++ b/patches.suse/ALSA-usb-audio-Apply-the-control-quirk-to-Plantronic.patch @@ -0,0 +1,49 @@ +From 06abcb18b3a021ba1a3f2020cbefb3ed04e59e72 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 4 Mar 2021 09:50:09 +0100 +Subject: [PATCH] ALSA: usb-audio: Apply the control quirk to Plantronics + headsets +Git-commit: 06abcb18b3a021ba1a3f2020cbefb3ed04e59e72 +Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git +Patch-mainline: Queued in subsystem maintainer repository +References: bsc#1182552 + +Other Plantronics headset models seem requiring the same workaround as +C320-M to add the 20ms delay for the control messages, too. Apply the +workaround generically for devices with the vendor ID 0x047f. + +Note that the problem didn't surface before 5.11 just with luck. +Since 5.11 got a big code rewrite about the stream handling, the +parameter setup procedure has changed, and this seemed triggering the +problem more often. + +Buglink: https://bugzilla.suse.com/show_bug.cgi?id=1182552 +Cc: +Link: https://lore.kernel.org/r/20210304085009.4770-1-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/usb/quirks.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c +index 6ef73af00913..d3001fb18141 100644 +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1672,10 +1672,10 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, + msleep(20); + + /* +- * Plantronics C320-M needs a delay to avoid random +- * microhpone failures. ++ * Plantronics headsets (C320, C320-M, etc) need a delay to avoid ++ * random microhpone failures. + */ +- if (chip->usb_id == USB_ID(0x047f, 0xc025) && ++ if (USB_ID_VENDOR(chip->usb_id) == 0x047f && + (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) + msleep(20); + +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-audio-Disable-USB-autosuspend-properly-in-s.patch b/patches.suse/ALSA-usb-audio-Disable-USB-autosuspend-properly-in-s.patch new file mode 100644 index 0000000..fee9533 --- /dev/null +++ b/patches.suse/ALSA-usb-audio-Disable-USB-autosuspend-properly-in-s.patch @@ -0,0 +1,101 @@ +From 9799110825dba087c2bdce886977cf84dada2005 Mon Sep 17 00:00:00 2001 +From: Kai-Heng Feng +Date: Thu, 4 Mar 2021 12:34:16 +0800 +Subject: [PATCH] ALSA: usb-audio: Disable USB autosuspend properly in + setup_disable_autosuspend() +Git-commit: 9799110825dba087c2bdce886977cf84dada2005 +Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git +Patch-mainline: Queued in subsystem maintainer repository +References: bsc#1182552 + +Rear audio on Lenovo ThinkStation P620 stops working after commit +1965c4364bdd ("ALSA: usb-audio: Disable autosuspend for Lenovo +ThinkStation P620"): +[ 6.013526] usbcore: registered new interface driver snd-usb-audio +[ 6.023064] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1 +[ 6.023083] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4 +[ 6.023090] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1 +[ 6.023098] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4 +[ 6.023103] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1 +[ 6.023110] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4 +[ 6.045846] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1 +[ 6.045866] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4 +[ 6.045877] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1 +[ 6.045886] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4 +[ 6.045894] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1 +[ 6.045908] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4 + +I overlooked the issue because when I was working on the said commit, +only the front audio is tested. Apology for that. + +Changing supports_autosuspend in driver is too late for disabling +autosuspend, because it was already used by USB probe routine, so it can +break the balance on the following code that depends on +supports_autosuspend. + +Fix it by using usb_disable_autosuspend() helper, and balance the +suspend count in disconnect callback. + +Fixes: 1965c4364bdd ("ALSA: usb-audio: Disable autosuspend for Lenovo ThinkStation P620") +Signed-off-by: Kai-Heng Feng +Cc: +Link: https://lore.kernel.org/r/20210304043419.287191-1-kai.heng.feng@canonical.com +Signed-off-by: Takashi Iwai + +--- + sound/usb/card.c | 5 +++++ + sound/usb/quirks.c | 2 +- + sound/usb/usbaudio.h | 1 + + 3 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/sound/usb/card.c b/sound/usb/card.c +index 85ed8507e41a..08c794883299 100644 +--- a/sound/usb/card.c ++++ b/sound/usb/card.c +@@ -830,6 +830,8 @@ static int usb_audio_probe(struct usb_interface *intf, + snd_media_device_create(chip, intf); + } + ++ chip->quirk_type = quirk->type; ++ + usb_chip[chip->index] = chip; + chip->intf[chip->num_interfaces] = intf; + chip->num_interfaces++; +@@ -912,6 +914,9 @@ static void usb_audio_disconnect(struct usb_interface *intf) + } else { + mutex_unlock(®ister_mutex); + } ++ ++ if (chip->quirk_type & QUIRK_SETUP_DISABLE_AUTOSUSPEND) ++ usb_enable_autosuspend(interface_to_usbdev(intf)); + } + + /* lock the shutdown (disconnect) task and autoresume */ +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c +index 0864692d8a7b..66efedaa3aeb 100644 +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -547,7 +547,7 @@ static int setup_disable_autosuspend(struct snd_usb_audio *chip, + struct usb_driver *driver, + const struct snd_usb_audio_quirk *quirk) + { +- driver->supports_autosuspend = 0; ++ usb_disable_autosuspend(interface_to_usbdev(iface)); + return 1; /* Continue with creating streams and mixer */ + } + +diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h +index 215c1771dd57..60b9dd7df6bb 100644 +--- a/sound/usb/usbaudio.h ++++ b/sound/usb/usbaudio.h +@@ -27,6 +27,7 @@ struct snd_usb_audio { + struct snd_card *card; + struct usb_interface *intf[MAX_CARD_INTERFACES]; + u32 usb_id; ++ uint16_t quirk_type; + struct mutex mutex; + unsigned int system_suspend; + atomic_t active; +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-audio-Don-t-abort-even-if-the-clock-rate-di.patch b/patches.suse/ALSA-usb-audio-Don-t-abort-even-if-the-clock-rate-di.patch new file mode 100644 index 0000000..7f9d909 --- /dev/null +++ b/patches.suse/ALSA-usb-audio-Don-t-abort-even-if-the-clock-rate-di.patch @@ -0,0 +1,54 @@ +From dcf269b3f703f5dbc2101824d9dbe95feed87b3d Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Sat, 27 Feb 2021 09:20:02 +0100 +Subject: [PATCH] ALSA: usb-audio: Don't abort even if the clock rate differs +Git-commit: dcf269b3f703f5dbc2101824d9dbe95feed87b3d +Patch-mainline: v5.12 or v5.12-rc2 (next release) +References: bsc#1182552 + +The commit 93db51d06b32 ("ALSA: usb-audio: Check valid altsetting at +parsing rates for UAC2/3") changed the behavior of the function +set_sample_rate_v2v3() slightly to treat the inconsistent sample rate +as an error. It was done by assumption that the sample rate +validation should have been done at the parser phase as implemented in +that patch. But the validation is later selectively enabled only for +certain devices as it causes a regression (the commit fe773b8711e3 +"alsa: usb-audio: workaround for iface reset issue"), and now the +inconsistency surfaced as a fatal error while it worked in the past as +is, as reported for FiiO M3K DAC. + +For recovering from the regression, change set_sample_rate_v2v3() +again to ignore the sample rate difference as non-error. + +Buglink: https://bugzilla.opensuse.org/show_bug.cgi?id=1182633 +Fixes: 93db51d06b32 ("ALSA: usb-audio: Check valid altsetting at parsing rates for UAC2/3") +Cc: +Link: https://lore.kernel.org/r/20210227082002.21185-1-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/usb/clock.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/sound/usb/clock.c b/sound/usb/clock.c +index 8243652d5604..a746802d0ac3 100644 +--- a/sound/usb/clock.c ++++ b/sound/usb/clock.c +@@ -652,10 +652,10 @@ static int set_sample_rate_v2v3(struct snd_usb_audio *chip, + cur_rate = prev_rate; + + if (cur_rate != rate) { +- usb_audio_warn(chip, +- "%d:%d: freq mismatch (RO clock): req %d, clock runs @%d\n", +- fmt->iface, fmt->altsetting, rate, cur_rate); +- return -ENXIO; ++ usb_audio_dbg(chip, ++ "%d:%d: freq mismatch: req %d, clock runs @%d\n", ++ fmt->iface, fmt->altsetting, rate, cur_rate); ++ /* continue processing */ + } + + validation: +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-audio-Drop-bogus-dB-range-in-too-low-level.patch b/patches.suse/ALSA-usb-audio-Drop-bogus-dB-range-in-too-low-level.patch new file mode 100644 index 0000000..6d1b63a --- /dev/null +++ b/patches.suse/ALSA-usb-audio-Drop-bogus-dB-range-in-too-low-level.patch @@ -0,0 +1,55 @@ +From 21cba9c5359dd9d1bffe355336cfec0b66d1ee52 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Sat, 27 Feb 2021 11:57:37 +0100 +Subject: [PATCH] ALSA: usb-audio: Drop bogus dB range in too low level +Git-commit: 21cba9c5359dd9d1bffe355336cfec0b66d1ee52 +Patch-mainline: v5.12 or v5.12-rc2 (next release) +References: bsc#1182552 + +Some USB audio firmware seem to report broken dB values for the volume +controls, and this screws up applications like PulseAudio who blindly +trusts the given data. For example, Edifier G2000 reports a PCM +volume from -128dB to -127dB, and this results in barely inaudible +sound. + +This patch adds a sort of sanity check at parsing the dB values in +USB-audio driver and disables the dB reporting if the range looks +bogus. Here, we assume -96dB as the bottom line of the max dB. + +Note that, if one can figure out that proper dB range later, it can be +patched in the mixer maps. + +Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=211929 +Cc: +Link: https://lore.kernel.org/r/20210227105737.3656-1-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/usb/mixer.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c +index b1c78db0d470..b004b2e63a5d 100644 +--- a/sound/usb/mixer.c ++++ b/sound/usb/mixer.c +@@ -1307,6 +1307,17 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval, + /* totally crap, return an error */ + return -EINVAL; + } ++ } else { ++ /* if the max volume is too low, it's likely a bogus range; ++ * here we use -96dB as the threshold ++ */ ++ if (cval->dBmax <= -9600) { ++ usb_audio_info(cval->head.mixer->chip, ++ "%d:%d: bogus dB values (%d/%d), disabling dB reporting\n", ++ cval->head.id, mixer_ctrl_intf(cval->head.mixer), ++ cval->dBmin, cval->dBmax); ++ cval->dBmin = cval->dBmax = 0; ++ } + } + + return 0; +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-audio-Fix-cannot-get-freq-eq-errors-on-Dell.patch b/patches.suse/ALSA-usb-audio-Fix-cannot-get-freq-eq-errors-on-Dell.patch new file mode 100644 index 0000000..da53954 --- /dev/null +++ b/patches.suse/ALSA-usb-audio-Fix-cannot-get-freq-eq-errors-on-Dell.patch @@ -0,0 +1,38 @@ +From fec60c3bc5d1713db2727cdffc638d48f9c07dc3 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 4 Mar 2021 09:30:21 +0100 +Subject: [PATCH] ALSA: usb-audio: Fix "cannot get freq eq" errors on Dell + AE515 sound bar +Git-commit: fec60c3bc5d1713db2727cdffc638d48f9c07dc3 +Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git +Patch-mainline: Queued in subsystem maintainer repository +References: bsc#1182552 + +Dell AE515 sound bar (413c:a506) spews the error messages when the +driver tries to read the current sample frequency, hence it needs to +be on the list in snd_usb_get_sample_rate_quirk(). + +Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=211551 +Cc: +Link: https://lore.kernel.org/r/20210304083021.2152-1-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/usb/quirks.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c +index 66efedaa3aeb..6ef73af00913 100644 +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1520,6 +1520,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) + case USB_ID(0x1901, 0x0191): /* GE B850V3 CP2114 audio interface */ + case USB_ID(0x21b4, 0x0081): /* AudioQuest DragonFly */ + case USB_ID(0x2912, 0x30c8): /* Audioengine D1 */ ++ case USB_ID(0x413c, 0xa506): /* Dell AE515 sound bar */ + return true; + } + +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-audio-use-Corsair-Virtuoso-mapping-for-Cors.patch b/patches.suse/ALSA-usb-audio-use-Corsair-Virtuoso-mapping-for-Cors.patch new file mode 100644 index 0000000..256aa58 --- /dev/null +++ b/patches.suse/ALSA-usb-audio-use-Corsair-Virtuoso-mapping-for-Cors.patch @@ -0,0 +1,46 @@ +From 11302bb69e72d0526bc626ee5c451a3d22cde904 Mon Sep 17 00:00:00 2001 +From: Andrea Fagiani +Date: Tue, 19 Jan 2021 08:47:44 +0000 +Subject: [PATCH] ALSA: usb-audio: use Corsair Virtuoso mapping for Corsair Virtuoso SE +Git-commit: 11302bb69e72d0526bc626ee5c451a3d22cde904 +Patch-mainline: v5.12-rc2 +References: git-fixes + +The Corsair Virtuoso SE RGB Wireless is a USB headset with a mic and a +sidetone feature. Assign the Corsair Virtuoso name map to the SE product +ids as well, in order to label its mixer appropriately and allow +userspace to pick the correct volume controls. + +Signed-off-by: Andrea Fagiani +Cc: +Link: https://lore.kernel.org/r/40bbdf55-f854-e2ee-87b4-183e6451352c@gmail.com +Signed-off-by: Takashi Iwai + +--- + sound/usb/mixer_maps.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c +index a7212f16660e..646deb6244b1 100644 +--- a/sound/usb/mixer_maps.c ++++ b/sound/usb/mixer_maps.c +@@ -536,6 +536,16 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = { + .id = USB_ID(0x05a7, 0x1020), + .map = bose_companion5_map, + }, ++ { ++ /* Corsair Virtuoso SE (wired mode) */ ++ .id = USB_ID(0x1b1c, 0x0a3d), ++ .map = corsair_virtuoso_map, ++ }, ++ { ++ /* Corsair Virtuoso SE (wireless mode) */ ++ .id = USB_ID(0x1b1c, 0x0a3e), ++ .map = corsair_virtuoso_map, ++ }, + { + /* Corsair Virtuoso (wired mode) */ + .id = USB_ID(0x1b1c, 0x0a41), +-- +2.26.2 + diff --git a/patches.suse/ASoC-Intel-bytcr_rt5640-Add-new-BYT_RT5640_NO_SPEAKE.patch b/patches.suse/ASoC-Intel-bytcr_rt5640-Add-new-BYT_RT5640_NO_SPEAKE.patch new file mode 100644 index 0000000..723cf93 --- /dev/null +++ b/patches.suse/ASoC-Intel-bytcr_rt5640-Add-new-BYT_RT5640_NO_SPEAKE.patch @@ -0,0 +1,106 @@ +From 1851ccf9e155b2a6f6cca1a7bd49325f5efbd5d2 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Sat, 9 Jan 2021 22:01:17 +0100 +Subject: [PATCH] ASoC: Intel: bytcr_rt5640: Add new BYT_RT5640_NO_SPEAKERS quirk-flag +Git-commit: 1851ccf9e155b2a6f6cca1a7bd49325f5efbd5d2 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Some devices, like mini PCs/media/top-set boxes do not have any speakers +at all, an example of the is the Mele PCG03 Mini PC. + +Add a new BYT_RT5640_NO_SPEAKERS quirk-flag which when sets does not add +speaker routes and modifies the components and the (optional) long_name +strings to reflect that there are no speakers. + +Cc: Rasmus Porsager +Signed-off-by: Hans de Goede +Acked-by: Pierre-Louis Bossart +Link: https://lore.kernel.org/r/20210109210119.159032-2-hdegoede@redhat.com +Signed-off-by: Mark Brown +Acked-by: Takashi Iwai + +--- + sound/soc/intel/boards/bytcr_rt5640.c | 26 +++++++++++++++++++------- + 1 file changed, 19 insertions(+), 7 deletions(-) + +diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c +index 5520d7c80019..dce2df30d4c5 100644 +--- a/sound/soc/intel/boards/bytcr_rt5640.c ++++ b/sound/soc/intel/boards/bytcr_rt5640.c +@@ -71,6 +71,7 @@ enum { + #define BYT_RT5640_SSP0_AIF2 BIT(21) + #define BYT_RT5640_MCLK_EN BIT(22) + #define BYT_RT5640_MCLK_25MHZ BIT(23) ++#define BYT_RT5640_NO_SPEAKERS BIT(24) + + #define BYTCR_INPUT_DEFAULTS \ + (BYT_RT5640_IN3_MAP | \ +@@ -132,6 +133,8 @@ static void log_quirks(struct device *dev) + dev_info(dev, "quirk JD_NOT_INV enabled\n"); + if (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) + dev_info(dev, "quirk MONO_SPEAKER enabled\n"); ++ if (byt_rt5640_quirk & BYT_RT5640_NO_SPEAKERS) ++ dev_info(dev, "quirk NO_SPEAKERS enabled\n"); + if (byt_rt5640_quirk & BYT_RT5640_DIFF_MIC) + dev_info(dev, "quirk DIFF_MIC enabled\n"); + if (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF1) { +@@ -946,7 +949,7 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime) + ret = snd_soc_dapm_add_routes(&card->dapm, + byt_rt5640_mono_spk_map, + ARRAY_SIZE(byt_rt5640_mono_spk_map)); +- } else { ++ } else if (!(byt_rt5640_quirk & BYT_RT5640_NO_SPEAKERS)) { + ret = snd_soc_dapm_add_routes(&card->dapm, + byt_rt5640_stereo_spk_map, + ARRAY_SIZE(byt_rt5640_stereo_spk_map)); +@@ -1188,6 +1191,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; + static const char * const map_name[] = { "dmic1", "dmic2", "in1", "in3" }; ++ __maybe_unused const char *spk_type; + const struct dmi_system_id *dmi_id; + struct byt_rt5640_private *priv; + struct snd_soc_acpi_mach *mach; +@@ -1196,7 +1200,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) + bool sof_parent; + int ret_val = 0; + int dai_index = 0; +- int i; ++ int i, cfg_spk; + + is_bytcr = false; + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); +@@ -1335,16 +1339,24 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) + } + } + ++ if (byt_rt5640_quirk & BYT_RT5640_NO_SPEAKERS) { ++ cfg_spk = 0; ++ spk_type = "none"; ++ } else if (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) { ++ cfg_spk = 1; ++ spk_type = "mono"; ++ } else { ++ cfg_spk = 2; ++ spk_type = "stereo"; ++ } ++ + snprintf(byt_rt5640_components, sizeof(byt_rt5640_components), +- "cfg-spk:%s cfg-mic:%s", +- (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) ? "1" : "2", ++ "cfg-spk:%d cfg-mic:%s", cfg_spk, + map_name[BYT_RT5640_MAP(byt_rt5640_quirk)]); + byt_rt5640_card.components = byt_rt5640_components; + #if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES) + snprintf(byt_rt5640_long_name, sizeof(byt_rt5640_long_name), +- "bytcr-rt5640-%s-spk-%s-mic", +- (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) ? +- "mono" : "stereo", ++ "bytcr-rt5640-%s-spk-%s-mic", spk_type, + map_name[BYT_RT5640_MAP(byt_rt5640_quirk)]); + byt_rt5640_card.long_name = byt_rt5640_long_name; + #endif +-- +2.26.2 + diff --git a/patches.suse/ASoC-Intel-sof-sdw-indent-and-add-quirks-consistentl.patch b/patches.suse/ASoC-Intel-sof-sdw-indent-and-add-quirks-consistentl.patch new file mode 100644 index 0000000..6bf4274 --- /dev/null +++ b/patches.suse/ASoC-Intel-sof-sdw-indent-and-add-quirks-consistentl.patch @@ -0,0 +1,57 @@ +From 8caf37e2be761688c396c609880936a807af490f Mon Sep 17 00:00:00 2001 +From: Pierre-Louis Bossart +Date: Mon, 8 Feb 2021 17:33:27 -0600 +Subject: [PATCH] ASoC: Intel: sof-sdw: indent and add quirks consistently +Git-commit: 8caf37e2be761688c396c609880936a807af490f +Patch-mainline: v5.12-rc1 +References: git-fixes + +Use the same style for all quirks to avoid misses and errors + +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Guennadi Liakhovetski +Reviewed-by: Kai Vehmanen +Link: https://lore.kernel.org/r/20210208233336.59449-3-pierre-louis.bossart@linux.intel.com +Signed-off-by: Mark Brown +Acked-by: Takashi Iwai + +--- + sound/soc/intel/boards/sof_sdw.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +--- a/sound/soc/intel/boards/sof_sdw.c ++++ b/sound/soc/intel/boards/sof_sdw.c +@@ -126,9 +126,10 @@ static const struct dmi_system_id sof_sd + DMI_MATCH(DMI_PRODUCT_NAME, + "Tiger Lake Client Platform"), + }, +- .driver_data = (void *)(SOF_RT711_JD_SRC_JD1 | +- SOF_SDW_TGL_HDMI | SOF_SDW_PCH_DMIC | +- SOF_SSP_PORT(SOF_I2S_SSP2)), ++ .driver_data = (void *)(SOF_SDW_TGL_HDMI | ++ SOF_RT711_JD_SRC_JD1 | ++ SOF_SDW_PCH_DMIC | ++ SOF_SSP_PORT(SOF_I2S_SSP2)), + }, + { + .callback = sof_sdw_quirk_cb, +@@ -152,7 +153,8 @@ static const struct dmi_system_id sof_sd + DMI_MATCH(DMI_SYS_VENDOR, "Google"), + DMI_MATCH(DMI_PRODUCT_NAME, "Volteer"), + }, +- .driver_data = (void *)(SOF_SDW_TGL_HDMI | SOF_SDW_PCH_DMIC | ++ .driver_data = (void *)(SOF_SDW_TGL_HDMI | ++ SOF_SDW_PCH_DMIC | + SOF_SDW_FOUR_SPK), + }, + { +@@ -161,7 +163,8 @@ static const struct dmi_system_id sof_sd + DMI_MATCH(DMI_SYS_VENDOR, "Google"), + DMI_MATCH(DMI_PRODUCT_NAME, "Ripto"), + }, +- .driver_data = (void *)(SOF_SDW_TGL_HDMI | SOF_SDW_PCH_DMIC | ++ .driver_data = (void *)(SOF_SDW_TGL_HDMI | ++ SOF_SDW_PCH_DMIC | + SOF_SDW_FOUR_SPK), + }, + diff --git a/patches.suse/ASoC-Intel-sof_sdw-detect-DMIC-number-based-on-mach-.patch b/patches.suse/ASoC-Intel-sof_sdw-detect-DMIC-number-based-on-mach-.patch new file mode 100644 index 0000000..d67e821 --- /dev/null +++ b/patches.suse/ASoC-Intel-sof_sdw-detect-DMIC-number-based-on-mach-.patch @@ -0,0 +1,41 @@ +From f88dcb9b98d3f86ead04d2453475267910448bb8 Mon Sep 17 00:00:00 2001 +From: Rander Wang +Date: Mon, 8 Feb 2021 17:33:30 -0600 +Subject: [PATCH] ASoC: Intel: sof_sdw: detect DMIC number based on mach params +Git-commit: f88dcb9b98d3f86ead04d2453475267910448bb8 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Current driver create DMIC dai based on quirk for each platforms, +so we need to add quirk for new platforms. Now driver reports DMIC +number to machine driver and machine driver can create DMIC dai based +on this information. The old check is reserved for some platforms +may be failed to set the DMIC number in BIOS. + +Reviewed-by: Bard Liao +Signed-off-by: Rander Wang +Signed-off-by: Pierre-Louis Bossart +Link: https://lore.kernel.org/r/20210208233336.59449-6-pierre-louis.bossart@linux.intel.com +Signed-off-by: Mark Brown +Acked-by: Takashi Iwai + +--- + sound/soc/intel/boards/sof_sdw.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c +index d1251a6ac3af..06f07dd45fb4 100644 +--- a/sound/soc/intel/boards/sof_sdw.c ++++ b/sound/soc/intel/boards/sof_sdw.c +@@ -955,7 +955,7 @@ static int sof_card_dai_links_create(struct device *dev, + ctx->idisp_codec = true; + + /* enable dmic01 & dmic16k */ +- dmic_num = (sof_sdw_quirk & SOF_SDW_PCH_DMIC) ? 2 : 0; ++ dmic_num = (sof_sdw_quirk & SOF_SDW_PCH_DMIC || mach_params->dmic_num) ? 2 : 0; + comp_num += dmic_num; + + dev_dbg(dev, "sdw %d, ssp %d, dmic %d, hdmi %d", sdw_be_num, ssp_num, +-- +2.26.2 + diff --git a/patches.suse/Bluetooth-Add-new-HCI_QUIRK_NO_SUSPEND_NOTIFIER-quir.patch b/patches.suse/Bluetooth-Add-new-HCI_QUIRK_NO_SUSPEND_NOTIFIER-quir.patch new file mode 100644 index 0000000..9dd7ff3 --- /dev/null +++ b/patches.suse/Bluetooth-Add-new-HCI_QUIRK_NO_SUSPEND_NOTIFIER-quir.patch @@ -0,0 +1,92 @@ +From 219991e6be7f4a31d471611e265b72f75b2d0538 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 28 Jan 2021 17:33:12 +0100 +Subject: [PATCH] Bluetooth: Add new HCI_QUIRK_NO_SUSPEND_NOTIFIER quirk +Git-commit: 219991e6be7f4a31d471611e265b72f75b2d0538 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Some devices, e.g. the RTL8723BS bluetooth part, some USB attached devices, +completely drop from the bus on a system-suspend. These devices will +have their driver unbound and rebound on resume (when the dropping of +the bus gets detected) and will show up as a new HCI after resume. + +These devices do not benefit from the suspend / resume handling work done +by the hci_suspend_notifier. At best this unnecessarily adds some time to +the suspend/resume time. But this may also actually cause problems, if the +code doing the driver unbinding runs after the pm-notifier then the +hci_suspend_notifier code will try to talk to a device which is now in +an uninitialized state. + +This commit adds a new HCI_QUIRK_NO_SUSPEND_NOTIFIER quirk which allows +drivers to opt-out of the hci_suspend_notifier when they know beforehand +that their device will be fully re-initialized / reprobed on resume. + +Signed-off-by: Hans de Goede +Reviewed-by: Abhishek Pandit-Subedi +Signed-off-by: Marcel Holtmann +Acked-by: Takashi Iwai + +--- + include/net/bluetooth/hci.h | 8 ++++++++ + net/bluetooth/hci_core.c | 18 +++++++++++------- + 2 files changed, 19 insertions(+), 7 deletions(-) + +diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h +index c1504aa3d9cf..ba2f439bc04d 100644 +--- a/include/net/bluetooth/hci.h ++++ b/include/net/bluetooth/hci.h +@@ -238,6 +238,14 @@ enum { + * during the hdev->setup vendor callback. + */ + HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, ++ ++ /* ++ * When this quirk is set, then the hci_suspend_notifier is not ++ * registered. This is intended for devices which drop completely ++ * from the bus on system-suspend and which will show up as a new ++ * HCI after resume. ++ */ ++ HCI_QUIRK_NO_SUSPEND_NOTIFIER, + }; + + /* HCI device flags */ +diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c +index 9ac258c4dab7..b0d9c36acc03 100644 +--- a/net/bluetooth/hci_core.c ++++ b/net/bluetooth/hci_core.c +@@ -3940,10 +3940,12 @@ int hci_register_dev(struct hci_dev *hdev) + hci_sock_dev_event(hdev, HCI_DEV_REG); + hci_dev_hold(hdev); + +- hdev->suspend_notifier.notifier_call = hci_suspend_notifier; +- error = register_pm_notifier(&hdev->suspend_notifier); +- if (error) +- goto err_wqueue; ++ if (!test_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER, &hdev->quirks)) { ++ hdev->suspend_notifier.notifier_call = hci_suspend_notifier; ++ error = register_pm_notifier(&hdev->suspend_notifier); ++ if (error) ++ goto err_wqueue; ++ } + + queue_work(hdev->req_workqueue, &hdev->power_on); + +@@ -3978,9 +3980,11 @@ void hci_unregister_dev(struct hci_dev *hdev) + + cancel_work_sync(&hdev->power_on); + +- hci_suspend_clear_tasks(hdev); +- unregister_pm_notifier(&hdev->suspend_notifier); +- cancel_work_sync(&hdev->suspend_prepare); ++ if (!test_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER, &hdev->quirks)) { ++ hci_suspend_clear_tasks(hdev); ++ unregister_pm_notifier(&hdev->suspend_notifier); ++ cancel_work_sync(&hdev->suspend_prepare); ++ } + + hci_dev_do_close(hdev); + +-- +2.26.2 + diff --git a/patches.suse/Bluetooth-btusb-Some-Qualcomm-Bluetooth-adapters-sto.patch b/patches.suse/Bluetooth-btusb-Some-Qualcomm-Bluetooth-adapters-sto.patch new file mode 100644 index 0000000..78ad89b --- /dev/null +++ b/patches.suse/Bluetooth-btusb-Some-Qualcomm-Bluetooth-adapters-sto.patch @@ -0,0 +1,55 @@ +From 234f414efd1164786269849b4fbb533d6c9cdbbf Mon Sep 17 00:00:00 2001 +From: Hui Wang +Date: Mon, 8 Feb 2021 13:02:37 +0800 +Subject: [PATCH] Bluetooth: btusb: Some Qualcomm Bluetooth adapters stop working +Git-commit: 234f414efd1164786269849b4fbb533d6c9cdbbf +Patch-mainline: v5.12-rc1 +References: git-fixes + +This issue starts from linux-5.10-rc1, I reproduced this issue on my +Dell Inspiron 7447 with BT adapter 0cf3:e005, the kernel will print +Out: "Bluetooth: hci0: don't support firmware rome 0x31010000", and +someone else also reported the similar issue to bugzilla #211571. + +I found this is a regression introduced by 'commit b40f58b97386 +("bluetooth: btusb: Add Qualcomm Bluetooth SoC WCN6855 support"), the +patch assumed that if high ROM version is not zero, it is an adapter +on WCN6855, but many old adapters don't need to load rampatch or nvm, +and they have non-zero high ROM version. + +To fix it, let the driver match the rom_version in the +qca_devices_table first, if there is no entry matched, check the +high ROM version, if it is not zero, we assume this adapter is ready +to work and no need to load rampatch and nvm like previously. + +Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=211571 +Fixes: b40f58b97386 ("Bluetooth: btusb: Add Qualcomm Bluetooth SoC WCN6855 support") +Signed-off-by: Hui Wang +Signed-off-by: Marcel Holtmann +Acked-by: Takashi Iwai + +--- + drivers/bluetooth/btusb.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c +index 9c6836ee3c9b..52683fd22e05 100644 +--- a/drivers/bluetooth/btusb.c ++++ b/drivers/bluetooth/btusb.c +@@ -4273,6 +4273,13 @@ static int btusb_setup_qca(struct hci_dev *hdev) + info = &qca_devices_table[i]; + } + if (!info) { ++ /* If the rom_version is not matched in the qca_devices_table ++ * and the high ROM version is not zero, we assume this chip no ++ * need to load the rampatch and nvm. ++ */ ++ if (ver_rom & ~0xffffU) ++ return 0; ++ + bt_dev_err(hdev, "don't support firmware rome 0x%x", ver_rom); + return -ENODEV; + } +-- +2.26.2 + diff --git a/patches.suse/Bluetooth-btusb-fix-memory-leak-on-suspend-and-resum.patch b/patches.suse/Bluetooth-btusb-fix-memory-leak-on-suspend-and-resum.patch new file mode 100644 index 0000000..ffcfda7 --- /dev/null +++ b/patches.suse/Bluetooth-btusb-fix-memory-leak-on-suspend-and-resum.patch @@ -0,0 +1,139 @@ +From 5ff20cbe6752a5bc06ff58fee8aa11a0d5075819 Mon Sep 17 00:00:00 2001 +From: Vamshi K Sthambamkadi +Date: Thu, 14 Jan 2021 16:51:47 +0530 +Subject: [PATCH] Bluetooth: btusb: fix memory leak on suspend and resume +Git-commit: 5ff20cbe6752a5bc06ff58fee8aa11a0d5075819 +Patch-mainline: v5.12-rc1 +References: git-fixes + +kmemleak report: +unreferenced object 0xffff9b1127f00500 (size 208): + comm "kworker/u17:2", pid 500, jiffies 4294937470 (age 580.136s) + hex dump (first 32 bytes): + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 00 60 ed 05 11 9b ff ff 00 00 00 00 00 00 00 00 .`.............. + backtrace: + [<000000006ab3fd59>] kmem_cache_alloc_node+0x17a/0x480 + [<0000000051a5f6f9>] __alloc_skb+0x5b/0x1d0 + [<0000000037e2d252>] hci_prepare_cmd+0x32/0xc0 [bluetooth] + [<0000000010b586d5>] hci_req_add_ev+0x84/0xe0 [bluetooth] + [<00000000d2deb520>] hci_req_clear_event_filter+0x42/0x70 [bluetooth] + [<00000000f864bd8c>] hci_req_prepare_suspend+0x84/0x470 [bluetooth] + [<000000001deb2cc4>] hci_prepare_suspend+0x31/0x40 [bluetooth] + [<000000002677dd79>] process_one_work+0x209/0x3b0 + [<00000000aaa62b07>] worker_thread+0x34/0x400 + [<00000000826d176c>] kthread+0x126/0x140 + [<000000002305e558>] ret_from_fork+0x22/0x30 +unreferenced object 0xffff9b1125c6ee00 (size 512): + comm "kworker/u17:2", pid 500, jiffies 4294937470 (age 580.136s) + hex dump (first 32 bytes): + 04 00 00 00 0d 00 00 00 05 0c 01 00 11 9b ff ff ................ + 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................ + backtrace: + [<000000009f07c0cc>] slab_post_alloc_hook+0x59/0x270 + [<0000000049431dc2>] __kmalloc_node_track_caller+0x15f/0x330 + [<00000000027a42f6>] __kmalloc_reserve.isra.70+0x31/0x90 + [<00000000e8e3e76a>] __alloc_skb+0x87/0x1d0 + [<0000000037e2d252>] hci_prepare_cmd+0x32/0xc0 [bluetooth] + [<0000000010b586d5>] hci_req_add_ev+0x84/0xe0 [bluetooth] + [<00000000d2deb520>] hci_req_clear_event_filter+0x42/0x70 [bluetooth] + [<00000000f864bd8c>] hci_req_prepare_suspend+0x84/0x470 [bluetooth] + [<000000001deb2cc4>] hci_prepare_suspend+0x31/0x40 [bluetooth] + [<000000002677dd79>] process_one_work+0x209/0x3b0 + [<00000000aaa62b07>] worker_thread+0x34/0x400 + [<00000000826d176c>] kthread+0x126/0x140 + [<000000002305e558>] ret_from_fork+0x22/0x30 +unreferenced object 0xffff9b112b395788 (size 8): + comm "kworker/u17:2", pid 500, jiffies 4294937470 (age 580.136s) + hex dump (first 8 bytes): + 20 00 00 00 00 00 04 00 ....... + backtrace: + [<0000000052dc28d2>] kmem_cache_alloc_trace+0x15e/0x460 + [<0000000046147591>] alloc_ctrl_urb+0x52/0xe0 [btusb] + [<00000000a2ed3e9e>] btusb_send_frame+0x91/0x100 [btusb] + [<000000001e66030e>] hci_send_frame+0x7e/0xf0 [bluetooth] + [<00000000bf6b7269>] hci_cmd_work+0xc5/0x130 [bluetooth] + [<000000002677dd79>] process_one_work+0x209/0x3b0 + [<00000000aaa62b07>] worker_thread+0x34/0x400 + [<00000000826d176c>] kthread+0x126/0x140 + [<000000002305e558>] ret_from_fork+0x22/0x30 + +In pm sleep-resume context, while the btusb device rebinds, it enters +hci_unregister_dev(), whilst there is a possibility of hdev receiving +PM_POST_SUSPEND suspend_notifier event, leading to generation of msg +frames. When hci_unregister_dev() completes, i.e. hdev context is +destroyed/freed, those intermittently sent msg frames cause memory +leak. + +BUG details: +Below is stack trace of thread that enters hci_unregister_dev(), marks +the hdev flag HCI_UNREGISTER to 1, and then goes onto to wait on notifier +lock - refer unregister_pm_notifier(). + + hci_unregister_dev+0xa5/0x320 [bluetoot] + btusb_disconnect+0x68/0x150 [btusb] + usb_unbind_interface+0x77/0x250 + ? kernfs_remove_by_name_ns+0x75/0xa0 + device_release_driver_internal+0xfe/0x1 + device_release_driver+0x12/0x20 + bus_remove_device+0xe1/0x150 + device_del+0x192/0x3e0 + ? usb_remove_ep_devs+0x1f/0x30 + usb_disable_device+0x92/0x1b0 + usb_disconnect+0xc2/0x270 + hub_event+0x9f6/0x15d0 + ? rpm_idle+0x23/0x360 + ? rpm_idle+0x26b/0x360 + process_one_work+0x209/0x3b0 + worker_thread+0x34/0x400 + ? process_one_work+0x3b0/0x3b0 + kthread+0x126/0x140 + ? kthread_park+0x90/0x90 + ret_from_fork+0x22/0x30 + +Below is stack trace of thread executing hci_suspend_notifier() which +processes the PM_POST_SUSPEND event, while the unbinding thread is +waiting on lock. + + hci_suspend_notifier.cold.39+0x5/0x2b [bluetooth] + blocking_notifier_call_chain+0x69/0x90 + pm_notifier_call_chain+0x1a/0x20 + pm_suspend.cold.9+0x334/0x352 + state_store+0x84/0xf0 + kobj_attr_store+0x12/0x20 + sysfs_kf_write+0x3b/0x40 + kernfs_fop_write+0xda/0x1c0 + vfs_write+0xbb/0x250 + ksys_write+0x61/0xe0 + __x64_sys_write+0x1a/0x20 + do_syscall_64+0x37/0x80 + entry_SYSCALL_64_after_hwframe+0x44/0xa9 + +Fix hci_suspend_notifer(), not to act on events when flag HCI_UNREGISTER +is set. + +Signed-off-by: Vamshi K Sthambamkadi +Signed-off-by: Marcel Holtmann +Acked-by: Takashi Iwai + +--- + net/bluetooth/hci_core.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c +index 9ea6f3c80a81..9ac258c4dab7 100644 +--- a/net/bluetooth/hci_core.c ++++ b/net/bluetooth/hci_core.c +@@ -3678,7 +3678,8 @@ static int hci_suspend_notifier(struct notifier_block *nb, unsigned long action, + } + + /* Suspend notifier should only act on events when powered. */ +- if (!hdev_is_powered(hdev)) ++ if (!hdev_is_powered(hdev) || ++ hci_dev_test_flag(hdev, HCI_UNREGISTER)) + goto done; + + if (action == PM_SUSPEND_PREPARE) { +-- +2.26.2 + diff --git a/patches.suse/HID-core-detect-and-skip-invalid-inputs-to-snto32.patch b/patches.suse/HID-core-detect-and-skip-invalid-inputs-to-snto32.patch new file mode 100644 index 0000000..ebaa30b --- /dev/null +++ b/patches.suse/HID-core-detect-and-skip-invalid-inputs-to-snto32.patch @@ -0,0 +1,51 @@ +From a0312af1f94d13800e63a7d0a66e563582e39aec Mon Sep 17 00:00:00 2001 +From: Randy Dunlap +Date: Wed, 16 Dec 2020 17:12:21 -0800 +Subject: [PATCH] HID: core: detect and skip invalid inputs to snto32() +Git-commit: a0312af1f94d13800e63a7d0a66e563582e39aec +Patch-mainline: v5.12-rc1 +References: git-fixes + +Prevent invalid (0, 0) inputs to hid-core's snto32() function. + +Maybe it is just the dummy device here that is causing this, but +there are hundreds of calls to snto32(0, 0). Having n (bits count) +of 0 is causing the current UBSAN trap with a shift value of +0xffffffff (-1, or n - 1 in this function). + +Either of the value to shift being 0 or the bits count being 0 can be +handled by just returning 0 to the caller, avoiding the following +complex shift + OR operations: + + return value & (1 << (n - 1)) ? value | (~0U << n) : value; + +Fixes: dde5845a529f ("[PATCH] Generic HID layer - code split") +Signed-off-by: Randy Dunlap +Reported-by: syzbot+1e911ad71dd4ea72e04a@syzkaller.appspotmail.com +Cc: Jiri Kosina +Cc: Benjamin Tissoires +Cc: linux-input@vger.kernel.org +Signed-off-by: Jiri Kosina +Acked-by: Takashi Iwai + +--- + drivers/hid/hid-core.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c +index 56172fe6995c..4d0faf77c14b 100644 +--- a/drivers/hid/hid-core.c ++++ b/drivers/hid/hid-core.c +@@ -1307,6 +1307,9 @@ EXPORT_SYMBOL_GPL(hid_open_report); + + static s32 snto32(__u32 value, unsigned n) + { ++ if (!value || !n) ++ return 0; ++ + switch (n) { + case 8: return ((__s8)value); + case 16: return ((__s16)value); +-- +2.26.2 + diff --git a/patches.suse/HID-make-arrays-usage-and-value-to-be-the-same.patch b/patches.suse/HID-make-arrays-usage-and-value-to-be-the-same.patch new file mode 100644 index 0000000..3dffbf5 --- /dev/null +++ b/patches.suse/HID-make-arrays-usage-and-value-to-be-the-same.patch @@ -0,0 +1,62 @@ +From ed9be64eefe26d7d8b0b5b9fa3ffdf425d87a01f Mon Sep 17 00:00:00 2001 +From: Will McVicker +Date: Sat, 5 Dec 2020 00:48:48 +0000 +Subject: [PATCH] HID: make arrays usage and value to be the same +Git-commit: ed9be64eefe26d7d8b0b5b9fa3ffdf425d87a01f +Patch-mainline: v5.12-rc1 +References: git-fixes + +The HID subsystem allows an "HID report field" to have a different +number of "values" and "usages" when it is allocated. When a field +struct is created, the size of the usage array is guaranteed to be at +least as large as the values array, but it may be larger. This leads to +a potential out-of-bounds write in +__hidinput_change_resolution_multipliers() and an out-of-bounds read in +hidinput_count_leds(). + +To fix this, let's make sure that both the usage and value arrays are +the same size. + +Cc: stable@vger.kernel.org +Signed-off-by: Will McVicker +Signed-off-by: Jiri Kosina +Acked-by: Takashi Iwai + +--- + drivers/hid/hid-core.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c +index 4d0faf77c14b..097cb1ee3126 100644 +--- a/drivers/hid/hid-core.c ++++ b/drivers/hid/hid-core.c +@@ -90,7 +90,7 @@ EXPORT_SYMBOL_GPL(hid_register_report); + * Register a new field for this report. + */ + +-static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values) ++static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages) + { + struct hid_field *field; + +@@ -101,7 +101,7 @@ static struct hid_field *hid_register_field(struct hid_report *report, unsigned + + field = kzalloc((sizeof(struct hid_field) + + usages * sizeof(struct hid_usage) + +- values * sizeof(unsigned)), GFP_KERNEL); ++ usages * sizeof(unsigned)), GFP_KERNEL); + if (!field) + return NULL; + +@@ -300,7 +300,7 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign + usages = max_t(unsigned, parser->local.usage_index, + parser->global.report_count); + +- field = hid_register_field(report, usages, parser->global.report_count); ++ field = hid_register_field(report, usages); + if (!field) + return 0; + +-- +2.26.2 + diff --git a/patches.suse/HID-wacom-Ignore-attempts-to-overwrite-the-touch_max.patch b/patches.suse/HID-wacom-Ignore-attempts-to-overwrite-the-touch_max.patch new file mode 100644 index 0000000..9c94eeb --- /dev/null +++ b/patches.suse/HID-wacom-Ignore-attempts-to-overwrite-the-touch_max.patch @@ -0,0 +1,72 @@ +From 88f38846bfb1a452a3d47e38aeab20a4ceb74294 Mon Sep 17 00:00:00 2001 +From: Jason Gerecke +Date: Tue, 16 Feb 2021 11:41:54 -0800 +Subject: [PATCH] HID: wacom: Ignore attempts to overwrite the touch_max value from HID +Git-commit: 88f38846bfb1a452a3d47e38aeab20a4ceb74294 +Patch-mainline: v5.12-rc1 +References: git-fixes + +The `wacom_feature_mapping` function is careful to only set the the +touch_max value a single time, but this care does not extend to the +`wacom_wac_finger_event` function. In particular, if a device sends +multiple HID_DG_CONTACTMAX items in a single feature report, the +driver will end up retaining the value of last item. + +The HID descriptor for the Cintiq Companion 2 does exactly this. It +incorrectly sets a "Report Count" of 2, which will cause the driver +to process two HID_DG_CONTACTCOUNT items. The first item has the actual +count, while the second item should have been declared as a constant +zero. The constant zero is the value the driver ends up using, however, +since it is the last HID_DG_CONTACTCOUNT in the report. + + Report ID (16), + Usage (Contact Count Maximum), ; Contact count maximum (55h, static value) + Report Count (2), + Logical Maximum (10), + Feature (Variable), + +To address this, we add a check that the touch_max is not already set +within the `wacom_wac_finger_event` function that processes the +HID_DG_TOUCHMAX item. We emit a warning if the value is set and ignore +the updated value. + +This could potentially cause problems if there is a tablet which has +a similar issue but requires the last item to be used. This is unlikely, +however, since it would have to have a different non-zero value for +HID_DG_CONTACTMAX earlier in the same report, which makes no sense +except in the case of a firmware bug. Note that cases where the +HID_DG_CONTACTMAX items are in different reports is already handled +(and similarly ignored) by `wacom_feature_mapping` as mentioned above. + +Link: https://github.com/linuxwacom/input-wacom/issues/223 +Fixes: 184eccd40389 ("HID: wacom: generic: read HID_DG_CONTACTMAX from any feature report") +Signed-off-by: Jason Gerecke +Cc: stable@vger.kernel.org +Signed-off-by: Jiri Kosina +Acked-by: Takashi Iwai + +--- + drivers/hid/wacom_wac.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c +index 1bd0eb71559c..44d715c12f6a 100644 +--- a/drivers/hid/wacom_wac.c ++++ b/drivers/hid/wacom_wac.c +@@ -2600,7 +2600,12 @@ static void wacom_wac_finger_event(struct hid_device *hdev, + wacom_wac->is_invalid_bt_frame = !value; + return; + case HID_DG_CONTACTMAX: +- features->touch_max = value; ++ if (!features->touch_max) { ++ features->touch_max = value; ++ } else { ++ hid_warn(hdev, "%s: ignoring attempt to overwrite non-zero touch_max " ++ "%d -> %d\n", __func__, features->touch_max, value); ++ } + return; + } + +-- +2.26.2 + diff --git a/patches.suse/Input-elo-fix-an-error-code-in-elo_connect.patch b/patches.suse/Input-elo-fix-an-error-code-in-elo_connect.patch new file mode 100644 index 0000000..29d6769 --- /dev/null +++ b/patches.suse/Input-elo-fix-an-error-code-in-elo_connect.patch @@ -0,0 +1,40 @@ +From 0958351e93fa0ac142f6dd8bd844441594f30a57 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Tue, 16 Feb 2021 20:29:05 -0800 +Subject: [PATCH] Input: elo - fix an error code in elo_connect() +Git-commit: 0958351e93fa0ac142f6dd8bd844441594f30a57 +Patch-mainline: v5.12-rc1 +References: git-fixes + +If elo_setup_10() fails then this should return an error code instead +of success. + +Fixes: fae3006e4b42 ("Input: elo - add support for non-pressure-sensitive touchscreens") +Signed-off-by: Dan Carpenter +Link: https://lore.kernel.org/r/YBKFd5CvDu+jVmfW@mwanda +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/touchscreen/elo.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c +index e0bacd34866a..96173232e53f 100644 +--- a/drivers/input/touchscreen/elo.c ++++ b/drivers/input/touchscreen/elo.c +@@ -341,8 +341,10 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv) + switch (elo->id) { + + case 0: /* 10-byte protocol */ +- if (elo_setup_10(elo)) ++ if (elo_setup_10(elo)) { ++ err = -EIO; + goto fail3; ++ } + + break; + +-- +2.26.2 + diff --git a/patches.suse/Input-i8042-add-ASUS-Zenbook-Flip-to-noselftest-list.patch b/patches.suse/Input-i8042-add-ASUS-Zenbook-Flip-to-noselftest-list.patch new file mode 100644 index 0000000..ec1d35f --- /dev/null +++ b/patches.suse/Input-i8042-add-ASUS-Zenbook-Flip-to-noselftest-list.patch @@ -0,0 +1,46 @@ +From b5d6e7ab7fe7d186878142e9fc1a05e4c3b65eb9 Mon Sep 17 00:00:00 2001 +From: Marcos Paulo de Souza +Date: Fri, 19 Feb 2021 10:37:13 -0800 +Subject: [PATCH] Input: i8042 - add ASUS Zenbook Flip to noselftest list +Git-commit: b5d6e7ab7fe7d186878142e9fc1a05e4c3b65eb9 +Patch-mainline: v5.12-rc1 +References: git-fixes + +After commit 77b425399f6d ("Input: i8042 - use chassis info to skip +selftest on Asus laptops"), all modern Asus laptops have the i8042 +selftest disabled. It has done by using chassys type "10" (laptop). + +The Asus Zenbook Flip suffers from similar suspend/resume issues, but +it _sometimes_ work and sometimes it doesn't. Setting noselftest makes +it work reliably. In this case, we need to add chassis type "31" +(convertible) in order to avoid selftest in this device. + +Reported-by: Ludvig Norgren Guldhag +Signed-off-by: Marcos Paulo de Souza +Link: https://lore.kernel.org/r/20210219164638.761-1-mpdesouza@suse.com +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/serio/i8042-x86ia64io.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h +index a4c9b9652560..d3fb1bc66f43 100644 +--- a/drivers/input/serio/i8042-x86ia64io.h ++++ b/drivers/input/serio/i8042-x86ia64io.h +@@ -582,6 +582,10 @@ static const struct dmi_system_id i8042_dmi_noselftest_table[] = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */ + }, ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), ++ DMI_MATCH(DMI_CHASSIS_TYPE, "31"), /* Convertible Notebook */ ++ }, + }, + { } + }; +-- +2.26.2 + diff --git a/patches.suse/Input-joydev-prevent-potential-read-overflow-in-ioct.patch b/patches.suse/Input-joydev-prevent-potential-read-overflow-in-ioct.patch new file mode 100644 index 0000000..558f0f1 --- /dev/null +++ b/patches.suse/Input-joydev-prevent-potential-read-overflow-in-ioct.patch @@ -0,0 +1,58 @@ +From 182d679b2298d62bf42bb14b12a8067b8e17b617 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 17 Feb 2021 12:21:10 -0800 +Subject: [PATCH] Input: joydev - prevent potential read overflow in ioctl +Git-commit: 182d679b2298d62bf42bb14b12a8067b8e17b617 +Patch-mainline: v5.12-rc1 +References: git-fixes + +The problem here is that "len" might be less than "joydev->nabs" so the +loops which verfy abspam[i] and keypam[] might read beyond the buffer. + +Fixes: 999b874f4aa3 ("Input: joydev - validate axis/button maps before clobbering current ones") +Signed-off-by: Dan Carpenter +Link: https://lore.kernel.org/r/YCyzR8WvFRw4HWw6@mwanda +[dtor: additional check for len being even in joydev_handle_JSIOCSBTNMAP] +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/joydev.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c +index a2b5fbba2d3b..430dc6975004 100644 +--- a/drivers/input/joydev.c ++++ b/drivers/input/joydev.c +@@ -456,7 +456,7 @@ static int joydev_handle_JSIOCSAXMAP(struct joydev *joydev, + if (IS_ERR(abspam)) + return PTR_ERR(abspam); + +- for (i = 0; i < joydev->nabs; i++) { ++ for (i = 0; i < len && i < joydev->nabs; i++) { + if (abspam[i] > ABS_MAX) { + retval = -EINVAL; + goto out; +@@ -480,6 +480,9 @@ static int joydev_handle_JSIOCSBTNMAP(struct joydev *joydev, + int i; + int retval = 0; + ++ if (len % sizeof(*keypam)) ++ return -EINVAL; ++ + len = min(len, sizeof(joydev->keypam)); + + /* Validate the map. */ +@@ -487,7 +490,7 @@ static int joydev_handle_JSIOCSBTNMAP(struct joydev *joydev, + if (IS_ERR(keypam)) + return PTR_ERR(keypam); + +- for (i = 0; i < joydev->nkey; i++) { ++ for (i = 0; i < (len / 2) && i < joydev->nkey; i++) { + if (keypam[i] > KEY_MAX || keypam[i] < BTN_MISC) { + retval = -EINVAL; + goto out; +-- +2.26.2 + diff --git a/patches.suse/Input-raydium_ts_i2c-do-not-send-zero-length.patch b/patches.suse/Input-raydium_ts_i2c-do-not-send-zero-length.patch new file mode 100644 index 0000000..1b9f3cc --- /dev/null +++ b/patches.suse/Input-raydium_ts_i2c-do-not-send-zero-length.patch @@ -0,0 +1,45 @@ +From fafd320ae51b9c72d371585b2501f86640ea7b7d Mon Sep 17 00:00:00 2001 +From: "jeffrey.lin" +Date: Tue, 15 Dec 2020 10:50:12 -0800 +Subject: [PATCH] Input: raydium_ts_i2c - do not send zero length +Git-commit: fafd320ae51b9c72d371585b2501f86640ea7b7d +Patch-mainline: v5.12-rc1 +References: git-fixes + +Add default write command package to prevent i2c quirk error of zero +data length as Raydium touch firmware update is executed. + +Signed-off-by: jeffrey.lin +Link: https://lore.kernel.org/r/1608031217-7247-1-git-send-email-jeffrey.lin@raydium.corp-partner.google.com +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/touchscreen/raydium_i2c_ts.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c +index e694a9b2b1e5..678afac85507 100644 +--- a/drivers/input/touchscreen/raydium_i2c_ts.c ++++ b/drivers/input/touchscreen/raydium_i2c_ts.c +@@ -395,6 +395,7 @@ static int raydium_i2c_write_object(struct i2c_client *client, + enum raydium_bl_ack state) + { + int error; ++ static const u8 cmd[] = { 0xFF, 0x39 }; + + error = raydium_i2c_send(client, RM_CMD_BOOT_WRT, data, len); + if (error) { +@@ -403,7 +404,7 @@ static int raydium_i2c_write_object(struct i2c_client *client, + return error; + } + +- error = raydium_i2c_send(client, RM_CMD_BOOT_ACK, NULL, 0); ++ error = raydium_i2c_send(client, RM_CMD_BOOT_ACK, cmd, sizeof(cmd)); + if (error) { + dev_err(&client->dev, "Ack obj command failed: %d\n", error); + return error; +-- +2.26.2 + diff --git a/patches.suse/Input-sur40-fix-an-error-code-in-sur40_probe.patch b/patches.suse/Input-sur40-fix-an-error-code-in-sur40_probe.patch new file mode 100644 index 0000000..adc93a8 --- /dev/null +++ b/patches.suse/Input-sur40-fix-an-error-code-in-sur40_probe.patch @@ -0,0 +1,36 @@ +From b0b7d2815839024e5181bd2572f5d8d4f65363b3 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Tue, 16 Feb 2021 20:30:45 -0800 +Subject: [PATCH] Input: sur40 - fix an error code in sur40_probe() +Git-commit: b0b7d2815839024e5181bd2572f5d8d4f65363b3 +Patch-mainline: v5.12-rc1 +References: git-fixes + +If v4l2_ctrl_handler_setup() fails then probe() should return an error +code instead of returning success. + +Fixes: cee1e3e2ef39 ("media: add video control handlers using V4L2 control framework") +Signed-off-by: Dan Carpenter +Link: https://lore.kernel.org/r/YBKFkbATXa5fA3xj@mwanda +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/touchscreen/sur40.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c +index 620cdd7d214a..12f2562b0141 100644 +--- a/drivers/input/touchscreen/sur40.c ++++ b/drivers/input/touchscreen/sur40.c +@@ -787,6 +787,7 @@ static int sur40_probe(struct usb_interface *interface, + dev_err(&interface->dev, + "Unable to register video controls."); + v4l2_ctrl_handler_free(&sur40->hdl); ++ error = sur40->hdl.error; + goto err_unreg_v4l2; + } + +-- +2.26.2 + diff --git a/patches.suse/Input-xpad-add-support-for-PowerA-Enhanced-Wired-Con.patch b/patches.suse/Input-xpad-add-support-for-PowerA-Enhanced-Wired-Con.patch new file mode 100644 index 0000000..b229769 --- /dev/null +++ b/patches.suse/Input-xpad-add-support-for-PowerA-Enhanced-Wired-Con.patch @@ -0,0 +1,36 @@ +From 42ffcd1dba1796bcda386eb6f260df9fc23c90af Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= +Date: Fri, 5 Feb 2021 11:59:08 -0800 +Subject: [PATCH] Input: xpad - add support for PowerA Enhanced Wired Controller for Xbox Series X|S +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 42ffcd1dba1796bcda386eb6f260df9fc23c90af +Patch-mainline: v5.12-rc1 +References: git-fixes + +Signed-off-by: Olivier Crête +Link: https://lore.kernel.org/r/20210204005318.615647-1-olivier.crete@collabora.com +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/joystick/xpad.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 8cc8ca4a9ac0..9f0d07dcbf06 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -305,6 +305,7 @@ static const struct xpad_device { + { 0x1bad, 0xfd00, "Razer Onza TE", 0, XTYPE_XBOX360 }, + { 0x1bad, 0xfd01, "Razer Onza", 0, XTYPE_XBOX360 }, + { 0x20d6, 0x2001, "BDA Xbox Series X Wired Controller", 0, XTYPE_XBOXONE }, ++ { 0x20d6, 0x2009, "PowerA Enhanced Wired Controller for Xbox Series X|S", 0, XTYPE_XBOXONE }, + { 0x20d6, 0x281f, "PowerA Wired Controller For Xbox 360", 0, XTYPE_XBOX360 }, + { 0x2e24, 0x0652, "Hyperkin Duke X-Box One pad", 0, XTYPE_XBOXONE }, + { 0x24c6, 0x5000, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, +-- +2.26.2 + diff --git a/patches.suse/NET-usb-qmi_wwan-Adding-support-for-Cinterion-MV31.patch b/patches.suse/NET-usb-qmi_wwan-Adding-support-for-Cinterion-MV31.patch new file mode 100644 index 0000000..c7c2ce5 --- /dev/null +++ b/patches.suse/NET-usb-qmi_wwan-Adding-support-for-Cinterion-MV31.patch @@ -0,0 +1,46 @@ +From a4dc7eee9106a9d2a6e08b442db19677aa9699c7 Mon Sep 17 00:00:00 2001 +From: Christoph Schemmel +Date: Tue, 2 Feb 2021 09:45:23 +0100 +Subject: [PATCH] NET: usb: qmi_wwan: Adding support for Cinterion MV31 +Git-commit: a4dc7eee9106a9d2a6e08b442db19677aa9699c7 +Patch-mainline: v5.11 +References: git-fixes + +Adding support for Cinterion MV31 with PID 0x00B7. + +T: Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 11 Spd=5000 MxCh= 0 +D: Ver= 3.20 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs= 1 +P: Vendor=1e2d ProdID=00b7 Rev=04.14 +S: Manufacturer=Cinterion +S: Product=Cinterion USB Mobile Broadband +S: SerialNumber=b3246eed +C: #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=896mA +I: If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan +I: If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option +I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option +I: If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option + +Signed-off-by: Christoph Schemmel +Link: https://lore.kernel.org/r/20210202084523.4371-1-christoph.schemmel@gmail.com +Signed-off-by: Jakub Kicinski +Acked-by: Takashi Iwai + +--- + 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 cc4819282820..5a05add9b4e6 100644 +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -1309,6 +1309,7 @@ static const struct usb_device_id products[] = { + {QMI_FIXED_INTF(0x1e2d, 0x0082, 5)}, /* Cinterion PHxx,PXxx (2 RmNet) */ + {QMI_FIXED_INTF(0x1e2d, 0x0083, 4)}, /* Cinterion PHxx,PXxx (1 RmNet + USB Audio)*/ + {QMI_QUIRK_SET_DTR(0x1e2d, 0x00b0, 4)}, /* Cinterion CLS8 */ ++ {QMI_FIXED_INTF(0x1e2d, 0x00b7, 0)}, /* Cinterion MV31 RmNet */ + {QMI_FIXED_INTF(0x413c, 0x81a2, 8)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ + {QMI_FIXED_INTF(0x413c, 0x81a3, 8)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ + {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ +-- +2.26.2 + diff --git a/patches.suse/PCI-Align-checking-of-syscall-user-config-accessors.patch b/patches.suse/PCI-Align-checking-of-syscall-user-config-accessors.patch new file mode 100644 index 0000000..3a6da90 --- /dev/null +++ b/patches.suse/PCI-Align-checking-of-syscall-user-config-accessors.patch @@ -0,0 +1,80 @@ +From ef9e4005cbaf022c6251263aa27836acccaef65d Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Sun, 24 Jan 2021 16:39:32 +0100 +Subject: [PATCH] PCI: Align checking of syscall user config accessors +Git-commit: ef9e4005cbaf022c6251263aa27836acccaef65d +Patch-mainline: v5.12-rc1 +References: git-fixes + +After 34e3207205ef ("PCI: handle positive error codes"), +pci_user_read_config_*() and pci_user_write_config_*() return 0 or negative +errno values, not PCIBIOS_* values like PCIBIOS_SUCCESSFUL or +PCIBIOS_BAD_REGISTER_NUMBER. + +Remove comparisons with PCIBIOS_SUCCESSFUL and check only for non-zero. It +happens that PCIBIOS_SUCCESSFUL is zero, so this is not a functional +change, but it aligns this code with the user accessors. + +[bhelgaas: commit log] +Fixes: 34e3207205ef ("PCI: handle positive error codes") +Link: https://lore.kernel.org/r/f1220314-e518-1e18-bf94-8e6f8c703758@gmail.com +Signed-off-by: Heiner Kallweit +Signed-off-by: Bjorn Helgaas +Acked-by: Takashi Iwai + +--- + drivers/pci/syscall.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c +index 31e39558d49d..8b003c890b87 100644 +--- a/drivers/pci/syscall.c ++++ b/drivers/pci/syscall.c +@@ -20,7 +20,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn, + u16 word; + u32 dword; + long err; +- long cfg_ret; ++ int cfg_ret; + + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; +@@ -46,7 +46,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn, + } + + err = -EIO; +- if (cfg_ret != PCIBIOS_SUCCESSFUL) ++ if (cfg_ret) + goto error; + + switch (len) { +@@ -105,7 +105,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn, + if (err) + break; + err = pci_user_write_config_byte(dev, off, byte); +- if (err != PCIBIOS_SUCCESSFUL) ++ if (err) + err = -EIO; + break; + +@@ -114,7 +114,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn, + if (err) + break; + err = pci_user_write_config_word(dev, off, word); +- if (err != PCIBIOS_SUCCESSFUL) ++ if (err) + err = -EIO; + break; + +@@ -123,7 +123,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn, + if (err) + break; + err = pci_user_write_config_dword(dev, off, dword); +- if (err != PCIBIOS_SUCCESSFUL) ++ if (err) + err = -EIO; + break; + +-- +2.26.2 + diff --git a/patches.suse/PCI-Decline-to-resize-resources-if-boot-config-must-.patch b/patches.suse/PCI-Decline-to-resize-resources-if-boot-config-must-.patch new file mode 100644 index 0000000..ebf23d7 --- /dev/null +++ b/patches.suse/PCI-Decline-to-resize-resources-if-boot-config-must-.patch @@ -0,0 +1,47 @@ +From 729e3a669d1b62e9876a671ac03ccba399a23b68 Mon Sep 17 00:00:00 2001 +From: Ard Biesheuvel +Date: Sat, 9 Jan 2021 10:53:53 +0100 +Subject: [PATCH] PCI: Decline to resize resources if boot config must be preserved +Git-commit: 729e3a669d1b62e9876a671ac03ccba399a23b68 +Patch-mainline: v5.12-rc1 +References: git-fixes + +The _DSM #5 method in the ACPI host bridge object tells us whether the OS +must preserve the resource assignments done by firmware. If this is the +case, we should not permit drivers to resize BARs on the fly. Make +pci_resize_resource() take this into account. + +Link: https://lore.kernel.org/r/20210109095353.13417-1-ardb@kernel.org +Signed-off-by: Ard Biesheuvel +Signed-off-by: Bjorn Helgaas +Cc: stable@vger.kernel.org # v5.4+ +Acked-by: Takashi Iwai + +--- + drivers/pci/setup-res.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c +index 43eda101fcf4..7f1acb3918d0 100644 +--- a/drivers/pci/setup-res.c ++++ b/drivers/pci/setup-res.c +@@ -410,10 +410,16 @@ EXPORT_SYMBOL(pci_release_resource); + int pci_resize_resource(struct pci_dev *dev, int resno, int size) + { + struct resource *res = dev->resource + resno; ++ struct pci_host_bridge *host; + int old, ret; + u32 sizes; + u16 cmd; + ++ /* Check if we must preserve the firmware's resource assignment */ ++ host = pci_find_host_bridge(dev->bus); ++ if (host->preserve_config) ++ return -ENOTSUPP; ++ + /* Make sure the resource isn't assigned before resizing it. */ + if (!(res->flags & IORESOURCE_UNSET)) + return -EBUSY; +-- +2.26.2 + diff --git a/patches.suse/PCI-dwc-Add-support-to-program-ATU-for-4GB-memory.patch b/patches.suse/PCI-dwc-Add-support-to-program-ATU-for-4GB-memory.patch index 7b276aa..ac028b9 100644 --- a/patches.suse/PCI-dwc-Add-support-to-program-ATU-for-4GB-memory.patch +++ b/patches.suse/PCI-dwc-Add-support-to-program-ATU-for-4GB-memory.patch @@ -3,8 +3,7 @@ Date: Wed, 18 Nov 2020 20:16:26 +0530 Subject: PCI: dwc: Add support to program ATU for >4GB memory Git-commit: 74081de4a1f70d14870c824a70e86aa0c1414945 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 Add support to program the ATU to enable translations for >4GB sizes of @@ -19,13 +18,15 @@ Reviewed-by: Rob Herring Acked-by: Jingoo Signed-off-by: Mian Yousaf Kaukab --- - drivers/pci/controller/dwc/pcie-designware.c | 12 +++++++----- - drivers/pci/controller/dwc/pcie-designware.h | 3 ++- + drivers/pci/controller/dwc/pcie-designware.c | 12 +++++++----- + drivers/pci/controller/dwc/pcie-designware.h | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) +diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c +index c2dea8fc97c8..b5e438b70cd5 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c -@@ -228,7 +228,7 @@ static void dw_pcie_writel_ob_unroll(str +@@ -228,7 +228,7 @@ static void dw_pcie_writel_ob_unroll(struct dw_pcie *pci, u32 index, u32 reg, static void dw_pcie_prog_outbound_atu_unroll(struct dw_pcie *pci, u8 func_no, int index, int type, u64 cpu_addr, u64 pci_addr, @@ -34,7 +35,7 @@ Signed-off-by: Mian Yousaf Kaukab { u32 retries, val; u64 limit_addr = cpu_addr + size - 1; -@@ -245,8 +245,10 @@ static void dw_pcie_prog_outbound_atu_un +@@ -245,8 +245,10 @@ static void dw_pcie_prog_outbound_atu_unroll(struct dw_pcie *pci, u8 func_no, lower_32_bits(pci_addr)); dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_UPPER_TARGET, upper_32_bits(pci_addr)); @@ -47,7 +48,7 @@ Signed-off-by: Mian Yousaf Kaukab dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_REGION_CTRL2, PCIE_ATU_ENABLE); -@@ -267,7 +269,7 @@ static void dw_pcie_prog_outbound_atu_un +@@ -267,7 +269,7 @@ static void dw_pcie_prog_outbound_atu_unroll(struct dw_pcie *pci, u8 func_no, static void __dw_pcie_prog_outbound_atu(struct dw_pcie *pci, u8 func_no, int index, int type, u64 cpu_addr, @@ -56,7 +57,7 @@ Signed-off-by: Mian Yousaf Kaukab { u32 retries, val; -@@ -311,7 +313,7 @@ static void __dw_pcie_prog_outbound_atu( +@@ -311,7 +313,7 @@ static void __dw_pcie_prog_outbound_atu(struct dw_pcie *pci, u8 func_no, } void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, @@ -65,17 +66,19 @@ Signed-off-by: Mian Yousaf Kaukab { __dw_pcie_prog_outbound_atu(pci, 0, index, type, cpu_addr, pci_addr, size); +diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h +index ed19c34dd0fe..f9a20ce9ab9a 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h -@@ -84,6 +84,7 @@ - #define PCIE_ATU_REGION_INDEX1 0x1 - #define PCIE_ATU_REGION_INDEX0 0x0 +@@ -81,6 +81,7 @@ + #define PCIE_ATU_REGION_INBOUND BIT(31) + #define PCIE_ATU_REGION_OUTBOUND 0 #define PCIE_ATU_CR1 0x904 +#define PCIE_ATU_INCREASE_REGION_SIZE BIT(13) #define PCIE_ATU_TYPE_MEM 0x0 #define PCIE_ATU_TYPE_IO 0x2 #define PCIE_ATU_TYPE_CFG0 0x4 -@@ -295,7 +296,7 @@ void dw_pcie_upconfig_setup(struct dw_pc +@@ -293,7 +294,7 @@ void dw_pcie_upconfig_setup(struct dw_pcie *pci); int dw_pcie_wait_for_link(struct dw_pcie *pci); void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, u64 cpu_addr, u64 pci_addr, @@ -84,3 +87,6 @@ Signed-off-by: Mian Yousaf Kaukab void dw_pcie_prog_ep_outbound_atu(struct dw_pcie *pci, u8 func_no, int index, int type, u64 cpu_addr, u64 pci_addr, u32 size); +-- +2.26.2 + diff --git a/patches.suse/PCI-dwc-Detect-number-of-iATU-windows.patch b/patches.suse/PCI-dwc-Detect-number-of-iATU-windows.patch index 9959492..b3335f8 100644 --- a/patches.suse/PCI-dwc-Detect-number-of-iATU-windows.patch +++ b/patches.suse/PCI-dwc-Detect-number-of-iATU-windows.patch @@ -3,8 +3,7 @@ Date: Thu, 5 Nov 2020 15:11:59 -0600 Subject: PCI: dwc: Detect number of iATU windows Git-commit: 281f1f99cf3a761b45f611943721dfb1895c68a3 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 Currently the number of inbound and outbound iATU windows are determined diff --git a/patches.suse/PCI-dwc-Drop-the-.set_num_vectors-host-op.patch b/patches.suse/PCI-dwc-Drop-the-.set_num_vectors-host-op.patch index bb79df2..a54e68c 100644 --- a/patches.suse/PCI-dwc-Drop-the-.set_num_vectors-host-op.patch +++ b/patches.suse/PCI-dwc-Drop-the-.set_num_vectors-host-op.patch @@ -3,8 +3,7 @@ Date: Thu, 5 Nov 2020 15:11:50 -0600 Subject: PCI: dwc: Drop the .set_num_vectors() host op Git-commit: 331e9bcead5252364e52fc95efbbe7273667b07d -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 There's no reason for the .set_num_vectors() host op. Drivers needing a diff --git a/patches.suse/PCI-dwc-Ensure-all-outbound-ATU-windows-are-reset.patch b/patches.suse/PCI-dwc-Ensure-all-outbound-ATU-windows-are-reset.patch index 3e9e111..3e7cf7f 100644 --- a/patches.suse/PCI-dwc-Ensure-all-outbound-ATU-windows-are-reset.patch +++ b/patches.suse/PCI-dwc-Ensure-all-outbound-ATU-windows-are-reset.patch @@ -3,8 +3,7 @@ Date: Thu, 5 Nov 2020 15:11:48 -0600 Subject: PCI: dwc: Ensure all outbound ATU windows are reset Git-commit: 458ad06c4cddac4b85f70ee00c295e2c5127ff3c -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 The Layerscape driver clears the ATU registers which may have been diff --git a/patches.suse/PCI-dwc-Move-MSI-interrupt-setup-into-DWC-common-cod.patch b/patches.suse/PCI-dwc-Move-MSI-interrupt-setup-into-DWC-common-cod.patch index 866b250..028d71b 100644 --- a/patches.suse/PCI-dwc-Move-MSI-interrupt-setup-into-DWC-common-cod.patch +++ b/patches.suse/PCI-dwc-Move-MSI-interrupt-setup-into-DWC-common-cod.patch @@ -3,8 +3,7 @@ Date: Thu, 5 Nov 2020 15:11:51 -0600 Subject: PCI: dwc: Move MSI interrupt setup into DWC common code Git-commit: 5bcb1757e637a4f6d130f1f5106ce030516316b8 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 Platforms using the built-in DWC MSI controller all have a dedicated diff --git a/patches.suse/PCI-dwc-Move-dbi-dbi2-and-addr_space-resource-setup-.patch b/patches.suse/PCI-dwc-Move-dbi-dbi2-and-addr_space-resource-setup-.patch index a36d4b6..f50a2bc 100644 --- a/patches.suse/PCI-dwc-Move-dbi-dbi2-and-addr_space-resource-setup-.patch +++ b/patches.suse/PCI-dwc-Move-dbi-dbi2-and-addr_space-resource-setup-.patch @@ -4,8 +4,7 @@ Subject: PCI: dwc: Move "dbi", "dbi2", and "addr_space" resource setup into common code Git-commit: a0fd361db8e508b8ce71c284b5ae3961759a0b3b -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 Most DWC drivers use the common register resource names "dbi", "dbi2", and diff --git a/patches.suse/PCI-dwc-Move-dw_pcie_msi_init-into-core.patch b/patches.suse/PCI-dwc-Move-dw_pcie_msi_init-into-core.patch index c964ebf..553ebc0 100644 --- a/patches.suse/PCI-dwc-Move-dw_pcie_msi_init-into-core.patch +++ b/patches.suse/PCI-dwc-Move-dw_pcie_msi_init-into-core.patch @@ -3,8 +3,7 @@ Date: Thu, 5 Nov 2020 15:11:54 -0600 Subject: PCI: dwc: Move dw_pcie_msi_init() into core Git-commit: 59fbab1ae40eb048eb2bd2385a5b981051513458 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 The host drivers which call dw_pcie_msi_init() are all the ones using diff --git a/patches.suse/PCI-dwc-Move-inbound-and-outbound-windows-to-common-.patch b/patches.suse/PCI-dwc-Move-inbound-and-outbound-windows-to-common-.patch index 708e77f..a6016d7 100644 --- a/patches.suse/PCI-dwc-Move-inbound-and-outbound-windows-to-common-.patch +++ b/patches.suse/PCI-dwc-Move-inbound-and-outbound-windows-to-common-.patch @@ -3,8 +3,7 @@ Date: Thu, 5 Nov 2020 15:11:58 -0600 Subject: PCI: dwc: Move inbound and outbound windows to common struct Git-commit: 9ca17af552bcd28cb91b6317edd945b4134411fa -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 The number of inbound and outbound windows are defined by the h/w and diff --git a/patches.suse/PCI-dwc-Move-link-handling-into-common-code.patch b/patches.suse/PCI-dwc-Move-link-handling-into-common-code.patch index 44163a5..80aef9d 100644 --- a/patches.suse/PCI-dwc-Move-link-handling-into-common-code.patch +++ b/patches.suse/PCI-dwc-Move-link-handling-into-common-code.patch @@ -3,8 +3,7 @@ Date: Thu, 5 Nov 2020 15:11:53 -0600 Subject: PCI: dwc: Move link handling into common code Git-commit: 886a9c1347558f0568e87fbbe7bcc3a76102bf0b -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 All the DWC drivers do link setup and checks at roughly the same time. diff --git a/patches.suse/PCI-dwc-Remove-unnecessary-wrappers-around-dw_pcie_h.patch b/patches.suse/PCI-dwc-Remove-unnecessary-wrappers-around-dw_pcie_h.patch index 6fa57f3..fb66f33 100644 --- a/patches.suse/PCI-dwc-Remove-unnecessary-wrappers-around-dw_pcie_h.patch +++ b/patches.suse/PCI-dwc-Remove-unnecessary-wrappers-around-dw_pcie_h.patch @@ -3,8 +3,7 @@ Date: Thu, 5 Nov 2020 15:11:56 -0600 Subject: PCI: dwc: Remove unnecessary wrappers around dw_pcie_host_init() Git-commit: 60f5b73fa0f298e8f7321deeb634e618b1c3d074 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 Many calls to dw_pcie_host_init() are in a wrapper function with diff --git a/patches.suse/PCI-dwc-Rework-MSI-initialization.patch b/patches.suse/PCI-dwc-Rework-MSI-initialization.patch index ff87c5a..792ad6f 100644 --- a/patches.suse/PCI-dwc-Rework-MSI-initialization.patch +++ b/patches.suse/PCI-dwc-Rework-MSI-initialization.patch @@ -3,8 +3,7 @@ Date: Thu, 5 Nov 2020 15:11:52 -0600 Subject: PCI: dwc: Rework MSI initialization Git-commit: f78f02638af5941eb45a402fa52c0edf4ac0f507 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 There are 3 possible MSI implementations for the DWC host. The first is diff --git a/patches.suse/PCI-dwc-Support-multiple-ATU-memory-regions.patch b/patches.suse/PCI-dwc-Support-multiple-ATU-memory-regions.patch index 92b171e..8fc0023 100644 --- a/patches.suse/PCI-dwc-Support-multiple-ATU-memory-regions.patch +++ b/patches.suse/PCI-dwc-Support-multiple-ATU-memory-regions.patch @@ -3,8 +3,7 @@ Date: Mon, 26 Oct 2020 13:16:52 -0500 Subject: PCI: dwc: Support multiple ATU memory regions Git-commit: 9f9e59a4809563f24e3d1377aa804a4b7386a418 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 The current ATU setup only supports a single memory resource which @@ -29,13 +28,15 @@ Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Signed-off-by: Mian Yousaf Kaukab --- - drivers/pci/controller/dwc/pcie-designware-host.c | 54 +++++++++++++--------- - drivers/pci/controller/dwc/pcie-designware.h | 6 -- + .../pci/controller/dwc/pcie-designware-host.c | 54 +++++++++++-------- + drivers/pci/controller/dwc/pcie-designware.h | 6 +-- 2 files changed, 34 insertions(+), 26 deletions(-) +diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c +index 44c2a6572199..a6ffab9b537e 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c -@@ -464,9 +464,7 @@ static void __iomem *dw_pcie_other_conf_ +@@ -464,9 +464,7 @@ static void __iomem *dw_pcie_other_conf_map_bus(struct pci_bus *bus, type = PCIE_ATU_TYPE_CFG1; @@ -46,7 +47,7 @@ Signed-off-by: Mian Yousaf Kaukab return pp->va_cfg0_base + where; } -@@ -480,9 +478,8 @@ static int dw_pcie_rd_other_conf(struct +@@ -480,9 +478,8 @@ static int dw_pcie_rd_other_conf(struct pci_bus *bus, unsigned int devfn, ret = pci_generic_config_read(bus, devfn, where, size, val); @@ -58,7 +59,7 @@ Signed-off-by: Mian Yousaf Kaukab pp->io_bus_addr, pp->io_size); return ret; -@@ -497,9 +494,8 @@ static int dw_pcie_wr_other_conf(struct +@@ -497,9 +494,8 @@ static int dw_pcie_wr_other_conf(struct pci_bus *bus, unsigned int devfn, ret = pci_generic_config_write(bus, devfn, where, size, val); @@ -70,7 +71,7 @@ Signed-off-by: Mian Yousaf Kaukab pp->io_bus_addr, pp->io_size); return ret; -@@ -586,21 +582,35 @@ void dw_pcie_setup_rc(struct pcie_port * +@@ -586,21 +582,35 @@ void dw_pcie_setup_rc(struct pcie_port *pp) * ATU, so we should not program the ATU here. */ if (pp->bridge->child_ops == &dw_child_pcie_ops) { @@ -119,6 +120,8 @@ Signed-off-by: Mian Yousaf Kaukab } dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_0, 0); +diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h +index 9d2f511f13fa..ed19c34dd0fe 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -80,9 +80,6 @@ @@ -129,9 +132,9 @@ Signed-off-by: Mian Yousaf Kaukab -#define PCIE_ATU_REGION_INDEX1 0x1 -#define PCIE_ATU_REGION_INDEX0 0x0 #define PCIE_ATU_CR1 0x904 - #define PCIE_ATU_INCREASE_REGION_SIZE BIT(13) #define PCIE_ATU_TYPE_MEM 0x0 -@@ -267,7 +264,6 @@ struct dw_pcie { + #define PCIE_ATU_TYPE_IO 0x2 +@@ -266,7 +263,6 @@ struct dw_pcie { /* Used when iatu_unroll_enabled is true */ void __iomem *atu_base; u32 num_viewport; @@ -139,7 +142,7 @@ Signed-off-by: Mian Yousaf Kaukab struct pcie_port pp; struct dw_pcie_ep ep; const struct dw_pcie_ops *ops; -@@ -275,6 +271,8 @@ struct dw_pcie { +@@ -274,6 +270,8 @@ struct dw_pcie { int num_lanes; int link_gen; u8 n_fts[2]; @@ -148,3 +151,6 @@ Signed-off-by: Mian Yousaf Kaukab }; #define to_dw_pcie_from_pp(port) container_of((port), struct dw_pcie, pp) +-- +2.26.2 + diff --git a/patches.suse/PCI-dwc-dra7xx-Use-the-common-MSI-irq_chip.patch b/patches.suse/PCI-dwc-dra7xx-Use-the-common-MSI-irq_chip.patch index 3896d95..8b82461 100644 --- a/patches.suse/PCI-dwc-dra7xx-Use-the-common-MSI-irq_chip.patch +++ b/patches.suse/PCI-dwc-dra7xx-Use-the-common-MSI-irq_chip.patch @@ -3,8 +3,7 @@ Date: Thu, 5 Nov 2020 15:11:49 -0600 Subject: PCI: dwc/dra7xx: Use the common MSI irq_chip Git-commit: 7f170d35f58311362e8b01b6774ca1053c0641b8 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 The dra7xx MSI irq_chip implementation is identical to the default DWC one. diff --git a/patches.suse/PCI-dwc-intel-gw-Move-ATU-offset-out-of-driver-match.patch b/patches.suse/PCI-dwc-intel-gw-Move-ATU-offset-out-of-driver-match.patch index d1008cc..46cef88 100644 --- a/patches.suse/PCI-dwc-intel-gw-Move-ATU-offset-out-of-driver-match.patch +++ b/patches.suse/PCI-dwc-intel-gw-Move-ATU-offset-out-of-driver-match.patch @@ -3,8 +3,7 @@ Date: Thu, 5 Nov 2020 15:11:45 -0600 Subject: PCI: dwc/intel-gw: Move ATU offset out of driver match data Git-commit: 1d567aac46101c8743e49990b94560f86740bb1e -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 The ATU offset should be a register range in DT called 'atu', not driver diff --git a/patches.suse/PCI-dwc-intel-gw-Remove-some-unneeded-function-wrapp.patch b/patches.suse/PCI-dwc-intel-gw-Remove-some-unneeded-function-wrapp.patch index c8b7d56..f967969 100644 --- a/patches.suse/PCI-dwc-intel-gw-Remove-some-unneeded-function-wrapp.patch +++ b/patches.suse/PCI-dwc-intel-gw-Remove-some-unneeded-function-wrapp.patch @@ -3,8 +3,7 @@ Date: Thu, 5 Nov 2020 15:11:47 -0600 Subject: PCI: dwc/intel-gw: Remove some unneeded function wrappers Git-commit: 1cc9a559993a4a69e7bdfb24a2a75955d08cd542 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 Remove some of the pointless levels of functions that just wrap or group diff --git a/patches.suse/PCI-keystone-Enable-compile-testing-on-ARM.patch b/patches.suse/PCI-keystone-Enable-compile-testing-on-ARM.patch index 61b3756..520f587 100644 --- a/patches.suse/PCI-keystone-Enable-compile-testing-on-ARM.patch +++ b/patches.suse/PCI-keystone-Enable-compile-testing-on-ARM.patch @@ -3,8 +3,7 @@ Date: Sun, 6 Sep 2020 20:51:27 +0100 Subject: PCI: keystone: Enable compile-testing on !ARM Git-commit: 476b70b4d1adff4465e9ff68021c52858555ac28 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 Currently the Keystone driver can only be compile-tested on ARM, but diff --git a/patches.suse/PCI-of-Warn-if-non-prefetchable-memory-aperture-size.patch b/patches.suse/PCI-of-Warn-if-non-prefetchable-memory-aperture-size.patch index 688629f..764ab4b 100644 --- a/patches.suse/PCI-of-Warn-if-non-prefetchable-memory-aperture-size.patch +++ b/patches.suse/PCI-of-Warn-if-non-prefetchable-memory-aperture-size.patch @@ -3,8 +3,7 @@ Date: Wed, 18 Nov 2020 20:16:25 +0530 Subject: PCI: of: Warn if non-prefetchable memory aperture size is > 32-bit Git-commit: fede8526cc4880d2a1ac4cfe357c299c4e1fd848 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 As per PCIe spec r5.0, sec 7.5.1.3.8 only 32-bit BAR registers are defined diff --git a/patches.suse/PCI-qcom-Use-PHY_REFCLK_USE_PAD-only-for-ipq8064.patch b/patches.suse/PCI-qcom-Use-PHY_REFCLK_USE_PAD-only-for-ipq8064.patch new file mode 100644 index 0000000..63ed4c9 --- /dev/null +++ b/patches.suse/PCI-qcom-Use-PHY_REFCLK_USE_PAD-only-for-ipq8064.patch @@ -0,0 +1,45 @@ +From 2cfef1971aea6119ee27429181d6cb3383031ac2 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Mon, 19 Oct 2020 18:55:55 +0200 +Subject: [PATCH] PCI: qcom: Use PHY_REFCLK_USE_PAD only for ipq8064 +Git-commit: 2cfef1971aea6119ee27429181d6cb3383031ac2 +Patch-mainline: v5.12-rc1 +References: git-fixes + +The use of PHY_REFCLK_USE_PAD introduced a regression for apq8064 devices. +It was tested that while apq doesn't require the padding, ipq SoC must use +it or the kernel hangs on boot. + +Link: https://lore.kernel.org/r/20201019165555.8269-1-ansuelsmth@gmail.com +Fixes: de3c4bf64897 ("PCI: qcom: Add support for tx term offset for rev 2.1.0") +Reported-by: Ilia Mirkin +Signed-off-by: Ilia Mirkin +Signed-off-by: Ansuel Smith +Signed-off-by: Lorenzo Pieralisi +Signed-off-by: Bjorn Helgaas +Acked-by: Stanimir Varbanov +Cc: stable@vger.kernel.org # v4.19+ +Acked-by: Takashi Iwai + +--- + drivers/pci/controller/dwc/pcie-qcom.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c +index ab21aa01c95d..8a7a300163e5 100644 +--- a/drivers/pci/controller/dwc/pcie-qcom.c ++++ b/drivers/pci/controller/dwc/pcie-qcom.c +@@ -400,7 +400,9 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) + + /* enable external reference clock */ + val = readl(pcie->parf + PCIE20_PARF_PHY_REFCLK); +- val &= ~PHY_REFCLK_USE_PAD; ++ /* USE_PAD is required only for ipq806x */ ++ if (!of_device_is_compatible(node, "qcom,pcie-apq8064")) ++ val &= ~PHY_REFCLK_USE_PAD; + val |= PHY_REFCLK_SSP_EN; + writel(val, pcie->parf + PCIE20_PARF_PHY_REFCLK); + +-- +2.26.2 + diff --git a/patches.suse/PCI-rockchip-Make-ep-gpios-DT-property-optional.patch b/patches.suse/PCI-rockchip-Make-ep-gpios-DT-property-optional.patch new file mode 100644 index 0000000..ef9fdd4 --- /dev/null +++ b/patches.suse/PCI-rockchip-Make-ep-gpios-DT-property-optional.patch @@ -0,0 +1,61 @@ +From 58adbfb3ebec460e8b58875c682bafd866808e80 Mon Sep 17 00:00:00 2001 +From: Chen-Yu Tsai +Date: Fri, 22 Jan 2021 00:23:18 +0800 +Subject: [PATCH] PCI: rockchip: Make 'ep-gpios' DT property optional +Git-commit: 58adbfb3ebec460e8b58875c682bafd866808e80 +Patch-mainline: v5.12-rc1 +References: git-fixes + +The Rockchip PCIe controller DT binding clearly states that 'ep-gpios' is +an optional property. And indeed there are boards that don't require it. + +Make the driver follow the binding by using devm_gpiod_get_optional() +instead of devm_gpiod_get(). + +[bhelgaas: tidy whitespace] +Link: https://lore.kernel.org/r/20210121162321.4538-2-wens@kernel.org +Fixes: e77f847df54c ("PCI: rockchip: Add Rockchip PCIe controller support") +Fixes: 956cd99b35a8 ("PCI: rockchip: Separate common code from RC driver") +Fixes: 964bac9455be ("PCI: rockchip: Split out rockchip_pcie_parse_dt() to parse DT") +Signed-off-by: Chen-Yu Tsai +Signed-off-by: Lorenzo Pieralisi +Signed-off-by: Bjorn Helgaas +Acked-by: Takashi Iwai + +--- + drivers/pci/controller/pcie-rockchip.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/pci/controller/pcie-rockchip.c b/drivers/pci/controller/pcie-rockchip.c +index 904dec0d3a88..990a00e08bc5 100644 +--- a/drivers/pci/controller/pcie-rockchip.c ++++ b/drivers/pci/controller/pcie-rockchip.c +@@ -82,7 +82,7 @@ int rockchip_pcie_parse_dt(struct rockchip_pcie *rockchip) + } + + rockchip->mgmt_sticky_rst = devm_reset_control_get_exclusive(dev, +- "mgmt-sticky"); ++ "mgmt-sticky"); + if (IS_ERR(rockchip->mgmt_sticky_rst)) { + if (PTR_ERR(rockchip->mgmt_sticky_rst) != -EPROBE_DEFER) + dev_err(dev, "missing mgmt-sticky reset property in node\n"); +@@ -118,11 +118,11 @@ int rockchip_pcie_parse_dt(struct rockchip_pcie *rockchip) + } + + if (rockchip->is_rc) { +- rockchip->ep_gpio = devm_gpiod_get(dev, "ep", GPIOD_OUT_HIGH); +- if (IS_ERR(rockchip->ep_gpio)) { +- dev_err(dev, "missing ep-gpios property in node\n"); +- return PTR_ERR(rockchip->ep_gpio); +- } ++ rockchip->ep_gpio = devm_gpiod_get_optional(dev, "ep", ++ GPIOD_OUT_HIGH); ++ if (IS_ERR(rockchip->ep_gpio)) ++ return dev_err_probe(dev, PTR_ERR(rockchip->ep_gpio), ++ "failed to get ep GPIO\n"); + } + + rockchip->aclk_pcie = devm_clk_get(dev, "aclk"); +-- +2.26.2 + diff --git a/patches.suse/PCI-tegra-Check-return-value-of-tegra_pcie_init_cont.patch b/patches.suse/PCI-tegra-Check-return-value-of-tegra_pcie_init_cont.patch index 945682e..50c21c0 100644 --- a/patches.suse/PCI-tegra-Check-return-value-of-tegra_pcie_init_cont.patch +++ b/patches.suse/PCI-tegra-Check-return-value-of-tegra_pcie_init_cont.patch @@ -3,8 +3,7 @@ Date: Thu, 3 Dec 2020 19:04:50 +0530 Subject: PCI: tegra: Check return value of tegra_pcie_init_controller() Git-commit: 3d710af75bcdea2e9cb8cdb2f7663cef7b133f5e -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 The return value of tegra_pcie_init_controller() must be checked before diff --git a/patches.suse/PCI-tegra-Continue-unconfig-sequence-even-if-parts-f.patch b/patches.suse/PCI-tegra-Continue-unconfig-sequence-even-if-parts-f.patch index e65546d..74b2140 100644 --- a/patches.suse/PCI-tegra-Continue-unconfig-sequence-even-if-parts-f.patch +++ b/patches.suse/PCI-tegra-Continue-unconfig-sequence-even-if-parts-f.patch @@ -3,8 +3,7 @@ Date: Thu, 3 Dec 2020 19:04:49 +0530 Subject: PCI: tegra: Continue unconfig sequence even if parts fail Git-commit: b8f0d67149acf762861f9b02bc3d5bd49b2f72bd -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 Currently the driver checks for error value of different APIs during the diff --git a/patches.suse/PCI-tegra-Disable-LTSSM-during-L2-entry.patch b/patches.suse/PCI-tegra-Disable-LTSSM-during-L2-entry.patch index 234e696..3de3750 100644 --- a/patches.suse/PCI-tegra-Disable-LTSSM-during-L2-entry.patch +++ b/patches.suse/PCI-tegra-Disable-LTSSM-during-L2-entry.patch @@ -3,8 +3,7 @@ Date: Thu, 3 Dec 2020 19:04:51 +0530 Subject: PCI: tegra: Disable LTSSM during L2 entry Git-commit: cf68e3b7a6b75d8f0e68c80fb353cde1878ef682 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 PCIe cards like Marvell SATA controller and some of the Samsung NVMe diff --git a/patches.suse/PCI-tegra-Fix-ASPM-L1SS-advertisement-disable-code.patch b/patches.suse/PCI-tegra-Fix-ASPM-L1SS-advertisement-disable-code.patch index 06914b7..2fe619e 100644 --- a/patches.suse/PCI-tegra-Fix-ASPM-L1SS-advertisement-disable-code.patch +++ b/patches.suse/PCI-tegra-Fix-ASPM-L1SS-advertisement-disable-code.patch @@ -3,8 +3,7 @@ Date: Thu, 3 Dec 2020 19:04:47 +0530 Subject: PCI: tegra: Fix ASPM-L1SS advertisement disable code Git-commit: 6b6fafc1abc7c046c57732a8cd1d2443fd60b370 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 If the absence of CLKREQ# signal is indicated by the absence of diff --git a/patches.suse/PCI-tegra-Move-dbi-accesses-to-post-common-DWC-initi.patch b/patches.suse/PCI-tegra-Move-dbi-accesses-to-post-common-DWC-initi.patch index 542669b..fefee09 100644 --- a/patches.suse/PCI-tegra-Move-dbi-accesses-to-post-common-DWC-initi.patch +++ b/patches.suse/PCI-tegra-Move-dbi-accesses-to-post-common-DWC-initi.patch @@ -3,8 +3,7 @@ Date: Thu, 26 Nov 2020 00:52:34 +0530 Subject: PCI: tegra: Move "dbi" accesses to post common DWC initialization Git-commit: 369b868f4a2ef89ee1c929d630058eac83015189 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 commit a0fd361db8e5 ("PCI: dwc: Move "dbi", "dbi2", and "addr_space" diff --git a/patches.suse/PCI-tegra-Read-dbi-base-address-to-program-in-applic.patch b/patches.suse/PCI-tegra-Read-dbi-base-address-to-program-in-applic.patch index c5e9e47..ad046b1 100644 --- a/patches.suse/PCI-tegra-Read-dbi-base-address-to-program-in-applic.patch +++ b/patches.suse/PCI-tegra-Read-dbi-base-address-to-program-in-applic.patch @@ -3,8 +3,7 @@ Date: Thu, 26 Nov 2020 00:55:54 +0530 Subject: PCI: tegra: Read "dbi" base address to program in application logic Git-commit: d5353c00cfd93b1c03fb16a5e6b5b49026534755 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 PCIe controller in Tegra194 requires the "dbi" region base address to be diff --git a/patches.suse/PCI-tegra-Set-DesignWare-IP-version.patch b/patches.suse/PCI-tegra-Set-DesignWare-IP-version.patch index 79099a8..5ad2c37 100644 --- a/patches.suse/PCI-tegra-Set-DesignWare-IP-version.patch +++ b/patches.suse/PCI-tegra-Set-DesignWare-IP-version.patch @@ -3,8 +3,7 @@ Date: Thu, 3 Dec 2020 19:04:48 +0530 Subject: PCI: tegra: Set DesignWare IP version Git-commit: 01254b6d6bb3e202650817ccb0a1386b5afd7e51 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: bsc#1179344 Set the DesignWare IP version for Tegra194 to 0x490A. This would be used diff --git a/patches.suse/PM-runtime-Update-device-status-before-letting-suppl.patch b/patches.suse/PM-runtime-Update-device-status-before-letting-suppl.patch new file mode 100644 index 0000000..bb1f5c1 --- /dev/null +++ b/patches.suse/PM-runtime-Update-device-status-before-letting-suppl.patch @@ -0,0 +1,126 @@ +From 44cc89f764646b2f1f2ea5d1a08b230131707851 Mon Sep 17 00:00:00 2001 +From: "Rafael J. Wysocki" +Date: Thu, 25 Feb 2021 19:23:27 +0100 +Subject: [PATCH] PM: runtime: Update device status before letting suppliers suspend +Git-commit: 44cc89f764646b2f1f2ea5d1a08b230131707851 +Patch-mainline: v5.12-rc2 +References: git-fixes + +Because the PM-runtime status of the device is not updated in +__rpm_callback(), attempts to suspend the suppliers of the given +device triggered by rpm_put_suppliers() called by it may fail. + +Fix this by making __rpm_callback() update the device's status to +RPM_SUSPENDED before calling rpm_put_suppliers() if the current +status of the device is RPM_SUSPENDING and the callback just invoked +by it has returned 0 (success). + +While at it, modify the code in __rpm_callback() to always check +the device's PM-runtime status under its PM lock. + +Link: https://lore.kernel.org/linux-pm/CAPDyKFqm06KDw_p8WXsM4dijDbho4bb6T4k50UqqvR1_COsp8g@mail.gmail.com/ +Fixes: 21d5c57b3726 ("PM / runtime: Use device links") +Reported-by: Elaine Zhang +Diagnosed-by: Ulf Hansson +Signed-off-by: Rafael J. Wysocki +Tested-by: Elaine Zhang +Reviewed-by: Ulf Hansson +Cc: 4.10+ # 4.10+ +Acked-by: Takashi Iwai + +--- + drivers/base/power/runtime.c | 62 +++++++++++++++++++++--------------- + 1 file changed, 37 insertions(+), 25 deletions(-) + +diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c +index a46a7e30881b..18b82427d0cb 100644 +--- a/drivers/base/power/runtime.c ++++ b/drivers/base/power/runtime.c +@@ -325,22 +325,22 @@ static void rpm_put_suppliers(struct device *dev) + static int __rpm_callback(int (*cb)(struct device *), struct device *dev) + __releases(&dev->power.lock) __acquires(&dev->power.lock) + { +- int retval, idx; + bool use_links = dev->power.links_count > 0; ++ bool get = false; ++ int retval, idx; ++ bool put; + + if (dev->power.irq_safe) { + spin_unlock(&dev->power.lock); ++ } else if (!use_links) { ++ spin_unlock_irq(&dev->power.lock); + } else { ++ get = dev->power.runtime_status == RPM_RESUMING; ++ + spin_unlock_irq(&dev->power.lock); + +- /* +- * Resume suppliers if necessary. +- * +- * The device's runtime PM status cannot change until this +- * routine returns, so it is safe to read the status outside of +- * the lock. +- */ +- if (use_links && dev->power.runtime_status == RPM_RESUMING) { ++ /* Resume suppliers if necessary. */ ++ if (get) { + idx = device_links_read_lock(); + + retval = rpm_get_suppliers(dev); +@@ -355,24 +355,36 @@ static int __rpm_callback(int (*cb)(struct device *), struct device *dev) + + if (dev->power.irq_safe) { + spin_lock(&dev->power.lock); +- } else { +- /* +- * If the device is suspending and the callback has returned +- * success, drop the usage counters of the suppliers that have +- * been reference counted on its resume. +- * +- * Do that if resume fails too. +- */ +- if (use_links +- && ((dev->power.runtime_status == RPM_SUSPENDING && !retval) +- || (dev->power.runtime_status == RPM_RESUMING && retval))) { +- idx = device_links_read_lock(); ++ return retval; ++ } + +- fail: +- rpm_put_suppliers(dev); ++ spin_lock_irq(&dev->power.lock); + +- device_links_read_unlock(idx); +- } ++ if (!use_links) ++ return retval; ++ ++ /* ++ * If the device is suspending and the callback has returned success, ++ * drop the usage counters of the suppliers that have been reference ++ * counted on its resume. ++ * ++ * Do that if the resume fails too. ++ */ ++ put = dev->power.runtime_status == RPM_SUSPENDING && !retval; ++ if (put) ++ __update_runtime_status(dev, RPM_SUSPENDED); ++ else ++ put = get && retval; ++ ++ if (put) { ++ spin_unlock_irq(&dev->power.lock); ++ ++ idx = device_links_read_lock(); ++ ++fail: ++ rpm_put_suppliers(dev); ++ ++ device_links_read_unlock(idx); + + spin_lock_irq(&dev->power.lock); + } +-- +2.26.2 + diff --git a/patches.suse/RDMA-hns-Disable-RQ-inline-by-default.patch b/patches.suse/RDMA-hns-Disable-RQ-inline-by-default.patch new file mode 100644 index 0000000..9c9db46 --- /dev/null +++ b/patches.suse/RDMA-hns-Disable-RQ-inline-by-default.patch @@ -0,0 +1,29 @@ +From: Lijun Ou +Date: Fri, 5 Feb 2021 17:39:26 +0800 +Subject: RDMA/hns: Disable RQ inline by default +Patch-mainline: v5.12-rc1 +Git-commit: 7373de9adb19aebed2781d3fdde576533d626d7a +References: jsc#SLE-8449 + +This feature should only be enabled by querying capability from firmware. + +Fixes: ba6bb7e97421 ("RDMA/hns: Add interfaces to get pf capabilities from firmware") +Link: https://lore.kernel.org/r/1612517974-31867-5-git-send-email-liweihang@huawei.com +Signed-off-by: Lijun Ou +Signed-off-by: Weihang Li +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c ++++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +@@ -1669,7 +1669,6 @@ static void set_default_caps(struct hns_ + + caps->flags = HNS_ROCE_CAP_FLAG_REREG_MR | + HNS_ROCE_CAP_FLAG_ROCE_V1_V2 | +- HNS_ROCE_CAP_FLAG_RQ_INLINE | + HNS_ROCE_CAP_FLAG_RECORD_DB | + HNS_ROCE_CAP_FLAG_SQ_RECORD_DB; + diff --git a/patches.suse/RDMA-hns-Fix-type-of-sq_signal_bits.patch b/patches.suse/RDMA-hns-Fix-type-of-sq_signal_bits.patch new file mode 100644 index 0000000..c468c41 --- /dev/null +++ b/patches.suse/RDMA-hns-Fix-type-of-sq_signal_bits.patch @@ -0,0 +1,31 @@ +From: Weihang Li +Date: Fri, 5 Feb 2021 17:39:24 +0800 +Subject: RDMA/hns: Fix type of sq_signal_bits +Patch-mainline: v5.12-rc1 +Git-commit: ea4092f3b56b236d08890ea589506ebd76248c53 +References: jsc#SLE-8449 + +This bit should be in type of enum ib_sig_type, or there will be a sparse +warning. + +Fixes: bfe860351e31 ("RDMA/hns: Fix cast from or to restricted __le32 for driver") +Link: https://lore.kernel.org/r/1612517974-31867-3-git-send-email-liweihang@huawei.com +Reported-by: kernel test robot +Signed-off-by: Weihang Li +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/hw/hns/hns_roce_device.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/infiniband/hw/hns/hns_roce_device.h ++++ b/drivers/infiniband/hw/hns/hns_roce_device.h +@@ -630,7 +630,7 @@ struct hns_roce_qp { + struct hns_roce_db sdb; + unsigned long en_flags; + u32 doorbell_qpn; +- u32 sq_signal_bits; ++ enum ib_sig_type sq_signal_bits; + struct hns_roce_wq sq; + + struct hns_roce_mtr mtr; diff --git a/patches.suse/RDMA-mlx5-Allow-creating-all-QPs-even-when-non-RDMA-.patch b/patches.suse/RDMA-mlx5-Allow-creating-all-QPs-even-when-non-RDMA-.patch new file mode 100644 index 0000000..1baebac --- /dev/null +++ b/patches.suse/RDMA-mlx5-Allow-creating-all-QPs-even-when-non-RDMA-.patch @@ -0,0 +1,84 @@ +From: Mark Bloch +Date: Mon, 25 Jan 2021 14:07:09 +0200 +Subject: RDMA/mlx5: Allow creating all QPs even when non RDMA profile is used +Patch-mainline: v5.12-rc1 +Git-commit: 2614488d1f3cd5989375042286b11424208e20c8 +References: jsc#SLE-15175 + +The cited commit disallowed creating any QP which isn't raw ethernet, reg +umr or the special UD qp for testing WC, this proved too strict. + +While modify can't be done (no GIDS/GID table for example) just creating a +QP is okay. + +This patch partially reverts the bellow mentioned commit and places the +restriction at the modify QP stage and not at the creation. DEVX commands +should be used to manipulate such QPs. + +Fixes: 42caf9cb5937 ("RDMA/mlx5: Allow only raw Ethernet QPs when RoCE isn't enabled") +Link: https://lore.kernel.org/r/20210125120709.836718-1-leon@kernel.org +Signed-off-by: Mark Bloch +Reviewed-by: Maor Gottlieb +Signed-off-by: Leon Romanovsky +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/hw/mlx5/qp.c | 26 ++++++++++++++++++++------ + 1 file changed, 20 insertions(+), 6 deletions(-) + +--- a/drivers/infiniband/hw/mlx5/qp.c ++++ b/drivers/infiniband/hw/mlx5/qp.c +@@ -2453,8 +2453,6 @@ static int check_qp_type(struct mlx5_ib_ + case MLX5_IB_QPT_HW_GSI: + case IB_QPT_DRIVER: + case IB_QPT_GSI: +- if (dev->profile == &raw_eth_profile) +- goto out; + case IB_QPT_RAW_PACKET: + case IB_QPT_UD: + case MLX5_IB_QPT_REG_UMR: +@@ -2661,10 +2659,6 @@ static int process_create_flags(struct m + int create_flags = attr->create_flags; + bool cond; + +- if (qp->type == IB_QPT_UD && dev->profile == &raw_eth_profile) +- if (create_flags & ~MLX5_IB_QP_CREATE_WC_TEST) +- return -EINVAL; +- + if (qp_type == MLX5_IB_QPT_DCT) + return (create_flags) ? -EINVAL : 0; + +@@ -4212,6 +4206,23 @@ static int mlx5_ib_modify_dct(struct ib_ + return 0; + } + ++static bool mlx5_ib_modify_qp_allowed(struct mlx5_ib_dev *dev, ++ struct mlx5_ib_qp *qp, ++ enum ib_qp_type qp_type) ++{ ++ if (dev->profile != &raw_eth_profile) ++ return true; ++ ++ if (qp_type == IB_QPT_RAW_PACKET || qp_type == MLX5_IB_QPT_REG_UMR) ++ return true; ++ ++ /* Internal QP used for wc testing, with NOPs in wq */ ++ if (qp->flags & MLX5_IB_QP_CREATE_WC_TEST) ++ return true; ++ ++ return false; ++} ++ + int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, + int attr_mask, struct ib_udata *udata) + { +@@ -4224,6 +4235,9 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp + int err = -EINVAL; + int port; + ++ if (!mlx5_ib_modify_qp_allowed(dev, qp, ibqp->qp_type)) ++ return -EOPNOTSUPP; ++ + if (ibqp->rwq_ind_tbl) + return -ENOSYS; + diff --git a/patches.suse/RDMA-rtrs-Call-kobject_put-in-the-failure-path.patch b/patches.suse/RDMA-rtrs-Call-kobject_put-in-the-failure-path.patch new file mode 100644 index 0000000..c71d55d --- /dev/null +++ b/patches.suse/RDMA-rtrs-Call-kobject_put-in-the-failure-path.patch @@ -0,0 +1,62 @@ +From: Guoqing Jiang +Date: Thu, 17 Dec 2020 15:19:03 +0100 +Subject: RDMA/rtrs: Call kobject_put in the failure path +Patch-mainline: v5.12-rc1 +Git-commit: 424774c9f3fa100ef7d9cfb9ee211e2ba1cd5119 +References: jsc#SLE-15176 + +Per the comment of kobject_init_and_add, we need to free the memory +by call kobject_put. + +Fixes: 215378b838df ("RDMA/rtrs: client: sysfs interface functions") +Fixes: 91b11610af8d ("RDMA/rtrs: server: sysfs interface functions") +Link: https://lore.kernel.org/r/20201217141915.56989-8-jinpu.wang@cloud.ionos.com +Signed-off-by: Guoqing Jiang +Reviewed-by: Md Haris Iqbal +Reviewed-by: Gioh Kim +Signed-off-by: Jack Wang +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c | 2 ++ + drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 3 ++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c +@@ -408,6 +408,7 @@ int rtrs_clt_create_sess_files(struct rt + "%s", str); + if (err) { + pr_err("kobject_init_and_add: %d\n", err); ++ kobject_put(&sess->kobj); + return err; + } + err = sysfs_create_group(&sess->kobj, &rtrs_clt_sess_attr_group); +@@ -419,6 +420,7 @@ int rtrs_clt_create_sess_files(struct rt + &sess->kobj, "stats"); + if (err) { + pr_err("kobject_init_and_add: %d\n", err); ++ kobject_put(&sess->stats->kobj_stats); + goto remove_group; + } + +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c +@@ -239,6 +239,7 @@ static int rtrs_srv_create_stats_files(s + &sess->kobj, "stats"); + if (err) { + rtrs_err(s, "kobject_init_and_add(): %d\n", err); ++ kobject_put(&sess->stats->kobj_stats); + return err; + } + err = sysfs_create_group(&sess->stats->kobj_stats, +@@ -295,8 +296,8 @@ remove_group: + sysfs_remove_group(&sess->kobj, &rtrs_srv_sess_attr_group); + put_kobj: + kobject_del(&sess->kobj); +- kobject_put(&sess->kobj); + destroy_root: ++ kobject_put(&sess->kobj); + rtrs_srv_destroy_once_sysfs_root_folders(sess); + + return err; diff --git a/patches.suse/RDMA-rtrs-Do-not-signal-for-heatbeat.patch b/patches.suse/RDMA-rtrs-Do-not-signal-for-heatbeat.patch new file mode 100644 index 0000000..45eee14 --- /dev/null +++ b/patches.suse/RDMA-rtrs-Do-not-signal-for-heatbeat.patch @@ -0,0 +1,63 @@ +From: Jack Wang +Date: Thu, 17 Dec 2020 15:19:11 +0100 +Subject: RDMA/rtrs: Do not signal for heatbeat +Patch-mainline: v5.12-rc1 +Git-commit: b38041d50add1c881fbc60eb2be93b58fc58ea21 +References: jsc#SLE-15176 + +For HB, there is no need to generate signal for completion. + +Also remove a comment accordingly. + +Fixes: c0894b3ea69d ("RDMA/rtrs: core: lib functions shared between client and server modules") +Link: https://lore.kernel.org/r/20201217141915.56989-16-jinpu.wang@cloud.ionos.com +Signed-off-by: Jack Wang +Reported-by: Gioh Kim +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-clt.c | 1 - + drivers/infiniband/ulp/rtrs/rtrs-srv.c | 1 - + drivers/infiniband/ulp/rtrs/rtrs.c | 4 ++-- + 3 files changed, 2 insertions(+), 4 deletions(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c +@@ -670,7 +670,6 @@ static void rtrs_clt_rdma_done(struct ib + case IB_WC_RDMA_WRITE: + /* + * post_send() RDMA write completions of IO reqs (read/write) +- * and hb + */ + break; + +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c +@@ -1255,7 +1255,6 @@ static void rtrs_srv_rdma_done(struct ib + case IB_WC_SEND: + /* + * post_send() RDMA write completions of IO reqs (read/write) +- * and hb + */ + atomic_add(srv->queue_depth, &con->sq_wr_avail); + +--- a/drivers/infiniband/ulp/rtrs/rtrs.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs.c +@@ -310,7 +310,7 @@ void rtrs_send_hb_ack(struct rtrs_sess * + + imm = rtrs_to_imm(RTRS_HB_ACK_IMM, 0); + err = rtrs_post_rdma_write_imm_empty(usr_con, sess->hb_cqe, imm, +- IB_SEND_SIGNALED, NULL); ++ 0, NULL); + if (err) { + sess->hb_err_handler(usr_con); + return; +@@ -339,7 +339,7 @@ static void hb_work(struct work_struct * + } + imm = rtrs_to_imm(RTRS_HB_MSG_IMM, 0); + err = rtrs_post_rdma_write_imm_empty(usr_con, sess->hb_cqe, imm, +- IB_SEND_SIGNALED, NULL); ++ 0, NULL); + if (err) { + sess->hb_err_handler(usr_con); + return; diff --git a/patches.suse/RDMA-rtrs-Extend-ibtrs_cq_qp_create.patch b/patches.suse/RDMA-rtrs-Extend-ibtrs_cq_qp_create.patch new file mode 100644 index 0000000..5dbbf56 --- /dev/null +++ b/patches.suse/RDMA-rtrs-Extend-ibtrs_cq_qp_create.patch @@ -0,0 +1,123 @@ +From: Jack Wang +Date: Thu, 17 Dec 2020 15:18:57 +0100 +Subject: RDMA/rtrs: Extend ibtrs_cq_qp_create +Patch-mainline: v5.12-rc1 +Git-commit: 7490fd1fe836ba3c7eda7a4b1cfd9e44389ffda5 +References: jsc#SLE-15176 + +rtrs does not have same limit for both max_send_wr and max_recv_wr, +To allow client and server set different values, export in a separate +parameter for rtrs_cq_qp_create. + +Also fix the type accordingly, u32 should be used instead of u16. + +Fixes: c0894b3ea69d ("RDMA/rtrs: core: lib functions shared between client and server modules") +Link: https://lore.kernel.org/r/20201217141915.56989-2-jinpu.wang@cloud.ionos.com +Signed-off-by: Jack Wang +Reviewed-by: Md Haris Iqbal +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-clt.c | 4 ++-- + drivers/infiniband/ulp/rtrs/rtrs-pri.h | 5 +++-- + drivers/infiniband/ulp/rtrs/rtrs-srv.c | 5 +++-- + drivers/infiniband/ulp/rtrs/rtrs.c | 14 ++++++++------ + 4 files changed, 16 insertions(+), 12 deletions(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c +@@ -1517,7 +1517,7 @@ static void destroy_con(struct rtrs_clt_ + static int create_con_cq_qp(struct rtrs_clt_con *con) + { + struct rtrs_clt_sess *sess = to_clt_sess(con->c.sess); +- u16 wr_queue_size; ++ u32 wr_queue_size; + int err, cq_vector; + struct rtrs_msg_rkey_rsp *rsp; + +@@ -1579,7 +1579,7 @@ static int create_con_cq_qp(struct rtrs_ + cq_vector = con->cpu % sess->s.dev->ib_dev->num_comp_vectors; + err = rtrs_cq_qp_create(&sess->s, &con->c, sess->max_send_sge, + cq_vector, wr_queue_size, wr_queue_size, +- IB_POLL_SOFTIRQ); ++ wr_queue_size, IB_POLL_SOFTIRQ); + /* + * In case of error we do not bother to clean previous allocations, + * since destroy_con_cq_qp() must be called. +--- a/drivers/infiniband/ulp/rtrs/rtrs-pri.h ++++ b/drivers/infiniband/ulp/rtrs/rtrs-pri.h +@@ -304,8 +304,9 @@ int rtrs_post_rdma_write_imm_empty(struc + struct ib_send_wr *head); + + int rtrs_cq_qp_create(struct rtrs_sess *rtrs_sess, struct rtrs_con *con, +- u32 max_send_sge, int cq_vector, u16 cq_size, +- u16 wr_queue_size, enum ib_poll_context poll_ctx); ++ u32 max_send_sge, int cq_vector, int cq_size, ++ u32 max_send_wr, u32 max_recv_wr, ++ enum ib_poll_context poll_ctx); + void rtrs_cq_qp_destroy(struct rtrs_con *con); + + void rtrs_init_hb(struct rtrs_sess *sess, struct ib_cqe *cqe, +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c +@@ -1599,7 +1599,7 @@ static int create_con(struct rtrs_srv_se + struct rtrs_sess *s = &sess->s; + struct rtrs_srv_con *con; + +- u16 cq_size, wr_queue_size; ++ u32 cq_size, wr_queue_size; + int err, cq_vector; + + con = kzalloc(sizeof(*con), GFP_KERNEL); +@@ -1643,7 +1643,8 @@ static int create_con(struct rtrs_srv_se + + /* TODO: SOFTIRQ can be faster, but be careful with softirq context */ + err = rtrs_cq_qp_create(&sess->s, &con->c, 1, cq_vector, cq_size, +- wr_queue_size, IB_POLL_WORKQUEUE); ++ wr_queue_size, wr_queue_size, ++ IB_POLL_WORKQUEUE); + if (err) { + rtrs_err(s, "rtrs_cq_qp_create(), err: %d\n", err); + goto free_con; +--- a/drivers/infiniband/ulp/rtrs/rtrs.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs.c +@@ -231,14 +231,14 @@ static int create_cq(struct rtrs_con *co + } + + static int create_qp(struct rtrs_con *con, struct ib_pd *pd, +- u16 wr_queue_size, u32 max_sge) ++ u32 max_send_wr, u32 max_recv_wr, u32 max_sge) + { + struct ib_qp_init_attr init_attr = {NULL}; + struct rdma_cm_id *cm_id = con->cm_id; + int ret; + +- init_attr.cap.max_send_wr = wr_queue_size; +- init_attr.cap.max_recv_wr = wr_queue_size; ++ init_attr.cap.max_send_wr = max_send_wr; ++ init_attr.cap.max_recv_wr = max_recv_wr; + init_attr.cap.max_recv_sge = 1; + init_attr.event_handler = qp_event_handler; + init_attr.qp_context = con; +@@ -260,8 +260,9 @@ static int create_qp(struct rtrs_con *co + } + + int rtrs_cq_qp_create(struct rtrs_sess *sess, struct rtrs_con *con, +- u32 max_send_sge, int cq_vector, u16 cq_size, +- u16 wr_queue_size, enum ib_poll_context poll_ctx) ++ u32 max_send_sge, int cq_vector, int cq_size, ++ u32 max_send_wr, u32 max_recv_wr, ++ enum ib_poll_context poll_ctx) + { + int err; + +@@ -269,7 +270,8 @@ int rtrs_cq_qp_create(struct rtrs_sess * + if (err) + return err; + +- err = create_qp(con, sess->dev->ib_pd, wr_queue_size, max_send_sge); ++ err = create_qp(con, sess->dev->ib_pd, max_send_wr, max_recv_wr, ++ max_send_sge); + if (err) { + ib_free_cq(con->cq); + con->cq = NULL; diff --git a/patches.suse/RDMA-rtrs-Fix-KASAN-stack-out-of-bounds-bug.patch b/patches.suse/RDMA-rtrs-Fix-KASAN-stack-out-of-bounds-bug.patch new file mode 100644 index 0000000..de8194d --- /dev/null +++ b/patches.suse/RDMA-rtrs-Fix-KASAN-stack-out-of-bounds-bug.patch @@ -0,0 +1,95 @@ +From: Jack Wang +Date: Thu, 17 Dec 2020 15:19:15 +0100 +Subject: RDMA/rtrs: Fix KASAN: stack-out-of-bounds bug +Patch-mainline: v5.12-rc1 +Git-commit: 7fbc3c373eefc291ff96d48496106c106b7f81c6 +References: jsc#SLE-15176 + +When KASAN is enabled, we notice warning below: +[ 483.436975] ================================================================== +[ 483.437234] BUG: KASAN: stack-out-of-bounds in _mlx5_ib_post_send+0x188a/0x2560 [mlx5_ib] +[ 483.437430] Read of size 4 at addr ffff88a195fd7d30 by task kworker/1:3/6954 + +[ 483.437731] CPU: 1 PID: 6954 Comm: kworker/1:3 Kdump: loaded Tainted: G O 5.4.82-pserver #5.4.82-1+feature+linux+5.4.y+dbg+20201210.1532+987e7a6~deb10 +[ 483.437976] Hardware name: Supermicro Super Server/X11DDW-L, BIOS 3.3 02/21/2020 +[ 483.438168] Workqueue: rtrs_server_wq hb_work [rtrs_core] +[ 483.438323] Call Trace: +[ 483.438486] dump_stack+0x96/0xe0 +[ 483.438646] ? _mlx5_ib_post_send+0x188a/0x2560 [mlx5_ib] +[ 483.438802] print_address_description.constprop.6+0x1b/0x220 +[ 483.438966] ? _mlx5_ib_post_send+0x188a/0x2560 [mlx5_ib] +[ 483.439133] ? _mlx5_ib_post_send+0x188a/0x2560 [mlx5_ib] +[ 483.439285] __kasan_report.cold.9+0x1a/0x32 +[ 483.439444] ? _mlx5_ib_post_send+0x188a/0x2560 [mlx5_ib] +[ 483.439597] kasan_report+0x10/0x20 +[ 483.439752] _mlx5_ib_post_send+0x188a/0x2560 [mlx5_ib] +[ 483.439910] ? update_sd_lb_stats+0xfb1/0xfc0 +[ 483.440073] ? set_reg_wr+0x520/0x520 [mlx5_ib] +[ 483.440222] ? update_group_capacity+0x340/0x340 +[ 483.440377] ? find_busiest_group+0x314/0x870 +[ 483.440526] ? update_sd_lb_stats+0xfc0/0xfc0 +[ 483.440683] ? __bitmap_and+0x6f/0x100 +[ 483.440832] ? __lock_acquire+0xa2/0x2150 +[ 483.440979] ? __lock_acquire+0xa2/0x2150 +[ 483.441128] ? __lock_acquire+0xa2/0x2150 +[ 483.441279] ? debug_lockdep_rcu_enabled+0x23/0x60 +[ 483.441430] ? lock_downgrade+0x390/0x390 +[ 483.441582] ? __lock_acquire+0xa2/0x2150 +[ 483.441729] ? __lock_acquire+0xa2/0x2150 +[ 483.441876] ? newidle_balance+0x425/0x8f0 +[ 483.442024] ? __lock_acquire+0xa2/0x2150 +[ 483.442172] ? debug_lockdep_rcu_enabled+0x23/0x60 +[ 483.442330] hb_work+0x15d/0x1d0 [rtrs_core] +[ 483.442479] ? schedule_hb+0x50/0x50 [rtrs_core] +[ 483.442627] ? lock_downgrade+0x390/0x390 +[ 483.442781] ? process_one_work+0x40d/0xa50 +[ 483.442931] process_one_work+0x4ee/0xa50 +[ 483.443082] ? pwq_dec_nr_in_flight+0x110/0x110 +[ 483.443231] ? do_raw_spin_lock+0x119/0x1d0 +[ 483.443383] worker_thread+0x65/0x5c0 +[ 483.443532] ? process_one_work+0xa50/0xa50 +[ 483.451839] kthread+0x1e2/0x200 +[ 483.451983] ? kthread_create_on_node+0xc0/0xc0 +[ 483.452139] ret_from_fork+0x3a/0x50 + +The problem is we use wrong type when send wr, hw driver expect the type +of IB_WR_RDMA_WRITE_WITH_IMM wr should be ib_rdma_wr, and doing +container_of to access member. The fix is simple use ib_rdma_wr instread +of ib_send_wr. + +Fixes: c0894b3ea69d ("RDMA/rtrs: core: lib functions shared between client and server modules") +Link: https://lore.kernel.org/r/20201217141915.56989-20-jinpu.wang@cloud.ionos.com +Signed-off-by: Jack Wang +Reviewed-by: Gioh Kim +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs.c +@@ -182,16 +182,16 @@ int rtrs_post_rdma_write_imm_empty(struc + u32 imm_data, enum ib_send_flags flags, + struct ib_send_wr *head) + { +- struct ib_send_wr wr; ++ struct ib_rdma_wr wr; + +- wr = (struct ib_send_wr) { +- .wr_cqe = cqe, +- .send_flags = flags, +- .opcode = IB_WR_RDMA_WRITE_WITH_IMM, +- .ex.imm_data = cpu_to_be32(imm_data), ++ wr = (struct ib_rdma_wr) { ++ .wr.wr_cqe = cqe, ++ .wr.send_flags = flags, ++ .wr.opcode = IB_WR_RDMA_WRITE_WITH_IMM, ++ .wr.ex.imm_data = cpu_to_be32(imm_data), + }; + +- return rtrs_post_send(con->qp, head, &wr); ++ return rtrs_post_send(con->qp, head, &wr.wr); + } + EXPORT_SYMBOL_GPL(rtrs_post_rdma_write_imm_empty); + diff --git a/patches.suse/RDMA-rtrs-Introduce-rtrs_post_send.patch b/patches.suse/RDMA-rtrs-Introduce-rtrs_post_send.patch new file mode 100644 index 0000000..1f8f570 --- /dev/null +++ b/patches.suse/RDMA-rtrs-Introduce-rtrs_post_send.patch @@ -0,0 +1,101 @@ +From: Guoqing Jiang +Date: Fri, 23 Oct 2020 09:43:52 +0200 +Subject: RDMA/rtrs: Introduce rtrs_post_send +Patch-mainline: v5.11-rc1 +Git-commit: e6ab8cf50fa1c38652feba3e4921c60538236f30 +References: jsc#SLE-15176 + +Since the three functions share the similar logic, let's introduce one +common function for it. + +Link: https://lore.kernel.org/r/20201023074353.21946-12-jinpu.wang@cloud.ionos.com +Signed-off-by: Guoqing Jiang +Signed-off-by: Jack Wang +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs.c | 52 +++++++++++++------------------------ + 1 file changed, 19 insertions(+), 33 deletions(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs.c +@@ -104,6 +104,22 @@ int rtrs_post_recv_empty(struct rtrs_con + } + EXPORT_SYMBOL_GPL(rtrs_post_recv_empty); + ++static int rtrs_post_send(struct ib_qp *qp, struct ib_send_wr *head, ++ struct ib_send_wr *wr) ++{ ++ if (head) { ++ struct ib_send_wr *tail = head; ++ ++ while (tail->next) ++ tail = tail->next; ++ tail->next = wr; ++ } else { ++ head = wr; ++ } ++ ++ return ib_post_send(qp, head, NULL); ++} ++ + int rtrs_iu_post_send(struct rtrs_con *con, struct rtrs_iu *iu, size_t size, + struct ib_send_wr *head) + { +@@ -126,17 +142,7 @@ int rtrs_iu_post_send(struct rtrs_con *c + .send_flags = IB_SEND_SIGNALED, + }; + +- if (head) { +- struct ib_send_wr *tail = head; +- +- while (tail->next) +- tail = tail->next; +- tail->next = ≀ +- } else { +- head = ≀ +- } +- +- return ib_post_send(con->qp, head, NULL); ++ return rtrs_post_send(con->qp, head, &wr); + } + EXPORT_SYMBOL_GPL(rtrs_iu_post_send); + +@@ -168,17 +174,7 @@ int rtrs_iu_post_rdma_write_imm(struct r + if (WARN_ON(sge[i].length == 0)) + return -EINVAL; + +- if (head) { +- struct ib_send_wr *tail = head; +- +- while (tail->next) +- tail = tail->next; +- tail->next = &wr.wr; +- } else { +- head = &wr.wr; +- } +- +- return ib_post_send(con->qp, head, NULL); ++ return rtrs_post_send(con->qp, head, &wr.wr); + } + EXPORT_SYMBOL_GPL(rtrs_iu_post_rdma_write_imm); + +@@ -195,17 +191,7 @@ int rtrs_post_rdma_write_imm_empty(struc + .ex.imm_data = cpu_to_be32(imm_data), + }; + +- if (head) { +- struct ib_send_wr *tail = head; +- +- while (tail->next) +- tail = tail->next; +- tail->next = ≀ +- } else { +- head = ≀ +- } +- +- return ib_post_send(con->qp, head, NULL); ++ return rtrs_post_send(con->qp, head, &wr); + } + EXPORT_SYMBOL_GPL(rtrs_post_rdma_write_imm_empty); + diff --git a/patches.suse/RDMA-rtrs-Only-allow-addition-of-path-to-an-already-.patch b/patches.suse/RDMA-rtrs-Only-allow-addition-of-path-to-an-already-.patch new file mode 100644 index 0000000..9bc02d6 --- /dev/null +++ b/patches.suse/RDMA-rtrs-Only-allow-addition-of-path-to-an-already-.patch @@ -0,0 +1,157 @@ +From: Md Haris Iqbal +Date: Fri, 12 Feb 2021 14:45:23 +0100 +Subject: RDMA/rtrs: Only allow addition of path to an already established + session +Patch-mainline: v5.12-rc1 +Git-commit: 03e9b33a0fd677f554b03352646c13459bf60458 +References: jsc#SLE-15176 + +While adding a path from the client side to an already established +session, it was possible to provide the destination IP to a different +server. This is dangerous. + +This commit adds an extra member to the rtrs_msg_conn_req structure, named +first_conn; which is supposed to notify if the connection request is the +first for that session or not. + +On the server side, if a session does not exist but the first_conn +received inside the rtrs_msg_conn_req structure is 1, the connection +request is failed. This signifies that the connection request is for an +already existing session, and since the server did not find one, it is an +wrong connection request. + +Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality") +Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality") +Link: https://lore.kernel.org/r/20210212134525.103456-3-jinpu.wang@cloud.ionos.com +Signed-off-by: Md Haris Iqbal +Reviewed-by: Lutz Pogrell +Signed-off-by: Jack Wang +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-clt.c | 7 +++++++ + drivers/infiniband/ulp/rtrs/rtrs-clt.h | 1 + + drivers/infiniband/ulp/rtrs/rtrs-pri.h | 4 +++- + drivers/infiniband/ulp/rtrs/rtrs-srv.c | 21 +++++++++++++++------ + 4 files changed, 26 insertions(+), 7 deletions(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c +@@ -31,6 +31,8 @@ + */ + #define RTRS_RECONNECT_SEED 8 + ++#define FIRST_CONN 0x01 ++ + MODULE_DESCRIPTION("RDMA Transport Client"); + MODULE_LICENSE("GPL"); + +@@ -1667,6 +1669,7 @@ static int rtrs_rdma_route_resolved(stru + .cid_num = cpu_to_le16(sess->s.con_num), + .recon_cnt = cpu_to_le16(sess->s.recon_cnt), + }; ++ msg.first_conn = sess->for_new_clt ? FIRST_CONN : 0; + uuid_copy(&msg.sess_uuid, &sess->s.uuid); + uuid_copy(&msg.paths_uuid, &clt->paths_uuid); + +@@ -1752,6 +1755,8 @@ static int rtrs_rdma_conn_established(st + scnprintf(sess->hca_name, sizeof(sess->hca_name), + sess->s.dev->ib_dev->name); + sess->s.src_addr = con->c.cm_id->route.addr.src_addr; ++ /* set for_new_clt, to allow future reconnect on any path */ ++ sess->for_new_clt = 1; + } + + return 0; +@@ -2681,6 +2686,8 @@ struct rtrs_clt *rtrs_clt_open(struct rt + err = PTR_ERR(sess); + goto close_all_sess; + } ++ if (!i) ++ sess->for_new_clt = 1; + list_add_tail_rcu(&sess->s.entry, &clt->paths_list); + + err = init_sess(sess); +--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.h ++++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.h +@@ -143,6 +143,7 @@ struct rtrs_clt_sess { + int max_send_sge; + u32 flags; + struct kobject kobj; ++ u8 for_new_clt; + struct rtrs_clt_stats *stats; + /* cache hca_port and hca_name to display in sysfs */ + u8 hca_port; +--- a/drivers/infiniband/ulp/rtrs/rtrs-pri.h ++++ b/drivers/infiniband/ulp/rtrs/rtrs-pri.h +@@ -189,7 +189,9 @@ struct rtrs_msg_conn_req { + __le16 recon_cnt; + uuid_t sess_uuid; + uuid_t paths_uuid; +- u8 reserved[12]; ++ u8 first_conn : 1; ++ u8 reserved_bits : 7; ++ u8 reserved[11]; + }; + + /** +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c +@@ -1346,7 +1346,8 @@ static void free_srv(struct rtrs_srv *sr + } + + static struct rtrs_srv *get_or_create_srv(struct rtrs_srv_ctx *ctx, +- const uuid_t *paths_uuid) ++ const uuid_t *paths_uuid, ++ bool first_conn) + { + struct rtrs_srv *srv; + int i; +@@ -1359,12 +1360,20 @@ static struct rtrs_srv *get_or_create_sr + return srv; + } + } ++ /* ++ * If this request is not the first connection request from the ++ * client for this session then fail and return error. ++ */ ++ if (!first_conn) { ++ mutex_unlock(&ctx->srv_mutex); ++ return ERR_PTR(-ENXIO); ++ } + + /* need to allocate a new srv */ + srv = kzalloc(sizeof(*srv), GFP_KERNEL); + if (!srv) { + mutex_unlock(&ctx->srv_mutex); +- return NULL; ++ return ERR_PTR(-ENOMEM); + } + + INIT_LIST_HEAD(&srv->paths_list); +@@ -1399,7 +1408,7 @@ err_free_chunks: + + err_free_srv: + kfree(srv); +- return NULL; ++ return ERR_PTR(-ENOMEM); + } + + static void put_srv(struct rtrs_srv *srv) +@@ -1800,13 +1809,13 @@ static int rtrs_rdma_connect(struct rdma + goto reject_w_econnreset; + } + recon_cnt = le16_to_cpu(msg->recon_cnt); +- srv = get_or_create_srv(ctx, &msg->paths_uuid); ++ srv = get_or_create_srv(ctx, &msg->paths_uuid, msg->first_conn); + /* + * "refcount == 0" happens if a previous thread calls get_or_create_srv + * allocate srv, but chunks of srv are not allocated yet. + */ +- if (!srv || refcount_read(&srv->refcount) == 0) { +- err = -ENOMEM; ++ if (IS_ERR(srv) || refcount_read(&srv->refcount) == 0) { ++ err = PTR_ERR(srv); + goto reject_w_err; + } + mutex_lock(&srv->paths_mutex); diff --git a/patches.suse/RDMA-rtrs-Remove-unnecessary-argument-dir-of-rtrs_iu.patch b/patches.suse/RDMA-rtrs-Remove-unnecessary-argument-dir-of-rtrs_iu.patch new file mode 100644 index 0000000..66ac9ec --- /dev/null +++ b/patches.suse/RDMA-rtrs-Remove-unnecessary-argument-dir-of-rtrs_iu.patch @@ -0,0 +1,182 @@ +From: Gioh Kim +Date: Fri, 23 Oct 2020 09:43:48 +0200 +Subject: RDMA/rtrs: Remove unnecessary argument dir of rtrs_iu_free +Patch-mainline: v5.11-rc1 +Git-commit: 8bd372ace32ec88fe3ad1421929ae1604f2a2c2c +References: jsc#SLE-15176 + +The direction of DMA operation is already in the rtrs_iu + +Link: https://lore.kernel.org/r/20201023074353.21946-8-jinpu.wang@cloud.ionos.com +Signed-off-by: Gioh Kim +Signed-off-by: Jack Wang +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-clt.c | 14 ++++++-------- + drivers/infiniband/ulp/rtrs/rtrs-pri.h | 3 +-- + drivers/infiniband/ulp/rtrs/rtrs-srv.c | 14 ++++++-------- + drivers/infiniband/ulp/rtrs/rtrs.c | 9 ++++----- + 4 files changed, 17 insertions(+), 23 deletions(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c +@@ -1236,8 +1236,7 @@ static void free_sess_reqs(struct rtrs_c + if (req->mr) + ib_dereg_mr(req->mr); + kfree(req->sge); +- rtrs_iu_free(req->iu, DMA_TO_DEVICE, +- sess->s.dev->ib_dev, 1); ++ rtrs_iu_free(req->iu, sess->s.dev->ib_dev, 1); + } + kfree(sess->reqs); + sess->reqs = NULL; +@@ -1599,8 +1598,7 @@ static void destroy_con_cq_qp(struct rtr + lockdep_assert_held(&con->con_mutex); + rtrs_cq_qp_destroy(&con->c); + if (con->rsp_ius) { +- rtrs_iu_free(con->rsp_ius, DMA_FROM_DEVICE, +- sess->s.dev->ib_dev, con->queue_size); ++ rtrs_iu_free(con->rsp_ius, sess->s.dev->ib_dev, con->queue_size); + con->rsp_ius = NULL; + con->queue_size = 0; + } +@@ -2245,7 +2243,7 @@ static void rtrs_clt_info_req_done(struc + struct rtrs_iu *iu; + + iu = container_of(wc->wr_cqe, struct rtrs_iu, cqe); +- rtrs_iu_free(iu, DMA_TO_DEVICE, sess->s.dev->ib_dev, 1); ++ rtrs_iu_free(iu, sess->s.dev->ib_dev, 1); + + if (unlikely(wc->status != IB_WC_SUCCESS)) { + rtrs_err(sess->clt, "Sess info request send failed: %s\n", +@@ -2374,7 +2372,7 @@ static void rtrs_clt_info_rsp_done(struc + + out: + rtrs_clt_update_wc_stats(con); +- rtrs_iu_free(iu, DMA_FROM_DEVICE, sess->s.dev->ib_dev, 1); ++ rtrs_iu_free(iu, sess->s.dev->ib_dev, 1); + rtrs_clt_change_state(sess, state); + } + +@@ -2436,9 +2434,9 @@ static int rtrs_send_sess_info(struct rt + + out: + if (tx_iu) +- rtrs_iu_free(tx_iu, DMA_TO_DEVICE, sess->s.dev->ib_dev, 1); ++ rtrs_iu_free(tx_iu, sess->s.dev->ib_dev, 1); + if (rx_iu) +- rtrs_iu_free(rx_iu, DMA_FROM_DEVICE, sess->s.dev->ib_dev, 1); ++ rtrs_iu_free(rx_iu, sess->s.dev->ib_dev, 1); + if (unlikely(err)) + /* If we've never taken async path because of malloc problems */ + rtrs_clt_change_state(sess, RTRS_CLT_CONNECTING_ERR); +--- a/drivers/infiniband/ulp/rtrs/rtrs-pri.h ++++ b/drivers/infiniband/ulp/rtrs/rtrs-pri.h +@@ -288,8 +288,7 @@ struct rtrs_msg_rdma_hdr { + struct rtrs_iu *rtrs_iu_alloc(u32 queue_size, size_t size, gfp_t t, + struct ib_device *dev, enum dma_data_direction, + void (*done)(struct ib_cq *cq, struct ib_wc *wc)); +-void rtrs_iu_free(struct rtrs_iu *iu, enum dma_data_direction dir, +- struct ib_device *dev, u32 queue_size); ++void rtrs_iu_free(struct rtrs_iu *iu, struct ib_device *dev, u32 queue_size); + int rtrs_iu_post_recv(struct rtrs_con *con, struct rtrs_iu *iu); + int rtrs_iu_post_send(struct rtrs_con *con, struct rtrs_iu *iu, size_t size, + struct ib_send_wr *head); +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c +@@ -577,8 +577,7 @@ static void unmap_cont_bufs(struct rtrs_ + struct rtrs_srv_mr *srv_mr; + + srv_mr = &sess->mrs[i]; +- rtrs_iu_free(srv_mr->iu, DMA_TO_DEVICE, +- sess->s.dev->ib_dev, 1); ++ rtrs_iu_free(srv_mr->iu, sess->s.dev->ib_dev, 1); + ib_dereg_mr(srv_mr->mr); + ib_dma_unmap_sg(sess->s.dev->ib_dev, srv_mr->sgt.sgl, + srv_mr->sgt.nents, DMA_BIDIRECTIONAL); +@@ -682,8 +681,7 @@ err: + sgt = &srv_mr->sgt; + mr = srv_mr->mr; + free_iu: +- rtrs_iu_free(srv_mr->iu, DMA_TO_DEVICE, +- sess->s.dev->ib_dev, 1); ++ rtrs_iu_free(srv_mr->iu, sess->s.dev->ib_dev, 1); + dereg_mr: + ib_dereg_mr(mr); + unmap_sg: +@@ -735,7 +733,7 @@ static void rtrs_srv_info_rsp_done(struc + struct rtrs_iu *iu; + + iu = container_of(wc->wr_cqe, struct rtrs_iu, cqe); +- rtrs_iu_free(iu, DMA_TO_DEVICE, sess->s.dev->ib_dev, 1); ++ rtrs_iu_free(iu, sess->s.dev->ib_dev, 1); + + if (unlikely(wc->status != IB_WC_SUCCESS)) { + rtrs_err(s, "Sess info response send failed: %s\n", +@@ -861,7 +859,7 @@ static int process_info_req(struct rtrs_ + if (unlikely(err)) { + rtrs_err(s, "rtrs_iu_post_send(), err: %d\n", err); + iu_free: +- rtrs_iu_free(tx_iu, DMA_TO_DEVICE, sess->s.dev->ib_dev, 1); ++ rtrs_iu_free(tx_iu, sess->s.dev->ib_dev, 1); + } + rwr_free: + kfree(rwr); +@@ -906,7 +904,7 @@ static void rtrs_srv_info_req_done(struc + goto close; + + out: +- rtrs_iu_free(iu, DMA_FROM_DEVICE, sess->s.dev->ib_dev, 1); ++ rtrs_iu_free(iu, sess->s.dev->ib_dev, 1); + return; + close: + close_sess(sess); +@@ -929,7 +927,7 @@ static int post_recv_info_req(struct rtr + err = rtrs_iu_post_recv(&con->c, rx_iu); + if (unlikely(err)) { + rtrs_err(s, "rtrs_iu_post_recv(), err: %d\n", err); +- rtrs_iu_free(rx_iu, DMA_FROM_DEVICE, sess->s.dev->ib_dev, 1); ++ rtrs_iu_free(rx_iu, sess->s.dev->ib_dev, 1); + return err; + } + +--- a/drivers/infiniband/ulp/rtrs/rtrs.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs.c +@@ -31,6 +31,7 @@ struct rtrs_iu *rtrs_iu_alloc(u32 queue_ + return NULL; + for (i = 0; i < queue_size; i++) { + iu = &ius[i]; ++ iu->direction = dir; + iu->buf = kzalloc(size, gfp_mask); + if (!iu->buf) + goto err; +@@ -41,17 +42,15 @@ struct rtrs_iu *rtrs_iu_alloc(u32 queue_ + + iu->cqe.done = done; + iu->size = size; +- iu->direction = dir; + } + return ius; + err: +- rtrs_iu_free(ius, dir, dma_dev, i); ++ rtrs_iu_free(ius, dma_dev, i); + return NULL; + } + EXPORT_SYMBOL_GPL(rtrs_iu_alloc); + +-void rtrs_iu_free(struct rtrs_iu *ius, enum dma_data_direction dir, +- struct ib_device *ibdev, u32 queue_size) ++void rtrs_iu_free(struct rtrs_iu *ius, struct ib_device *ibdev, u32 queue_size) + { + struct rtrs_iu *iu; + int i; +@@ -61,7 +60,7 @@ void rtrs_iu_free(struct rtrs_iu *ius, e + + for (i = 0; i < queue_size; i++) { + iu = &ius[i]; +- ib_dma_unmap_single(ibdev, iu->dma_addr, iu->size, dir); ++ ib_dma_unmap_single(ibdev, iu->dma_addr, iu->size, iu->direction); + kfree(iu->buf); + } + kfree(ius); diff --git a/patches.suse/RDMA-rtrs-clt-Refactor-the-failure-cases-in-alloc_cl.patch b/patches.suse/RDMA-rtrs-clt-Refactor-the-failure-cases-in-alloc_cl.patch new file mode 100644 index 0000000..0ebf594 --- /dev/null +++ b/patches.suse/RDMA-rtrs-clt-Refactor-the-failure-cases-in-alloc_cl.patch @@ -0,0 +1,82 @@ +From: Guoqing Jiang +Date: Thu, 17 Dec 2020 15:19:10 +0100 +Subject: RDMA/rtrs-clt: Refactor the failure cases in alloc_clt +Patch-mainline: v5.12-rc1 +Git-commit: eab098246625e91c1cbd6e8f75b09e4c9c28a9fc +References: jsc#SLE-15176 + +Make all failure cases go to the common path to avoid duplicate code. +And some issued existed before. + +1. clt need to be freed to avoid memory leak. + +2. return ERR_PTR(-ENOMEM) if kobject_create_and_add fails, because + rtrs_clt_open checks the return value of by call "IS_ERR(clt)". + +Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality") +Link: https://lore.kernel.org/r/20201217141915.56989-15-jinpu.wang@cloud.ionos.com +Signed-off-by: Guoqing Jiang +Reviewed-by: Md Haris Iqbal +Signed-off-by: Jack Wang +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-clt.c | 25 ++++++++++++------------- + 1 file changed, 12 insertions(+), 13 deletions(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c +@@ -2576,11 +2576,8 @@ static struct rtrs_clt *alloc_clt(const + clt->dev.class = rtrs_clt_dev_class; + clt->dev.release = rtrs_clt_dev_release; + err = dev_set_name(&clt->dev, "%s", sessname); +- if (err) { +- free_percpu(clt->pcpu_path); +- kfree(clt); +- return ERR_PTR(err); +- } ++ if (err) ++ goto err; + /* + * Suppress user space notification until + * sysfs files are created +@@ -2588,29 +2585,31 @@ static struct rtrs_clt *alloc_clt(const + dev_set_uevent_suppress(&clt->dev, true); + err = device_register(&clt->dev); + if (err) { +- free_percpu(clt->pcpu_path); + put_device(&clt->dev); +- return ERR_PTR(err); ++ goto err; + } + + clt->kobj_paths = kobject_create_and_add("paths", &clt->dev.kobj); + if (!clt->kobj_paths) { +- free_percpu(clt->pcpu_path); +- device_unregister(&clt->dev); +- return NULL; ++ err = -ENOMEM; ++ goto err_dev; + } + err = rtrs_clt_create_sysfs_root_files(clt); + if (err) { +- free_percpu(clt->pcpu_path); + kobject_del(clt->kobj_paths); + kobject_put(clt->kobj_paths); +- device_unregister(&clt->dev); +- return ERR_PTR(err); ++ goto err_dev; + } + dev_set_uevent_suppress(&clt->dev, false); + kobject_uevent(&clt->dev.kobj, KOBJ_ADD); + + return clt; ++err_dev: ++ device_unregister(&clt->dev); ++err: ++ free_percpu(clt->pcpu_path); ++ kfree(clt); ++ return ERR_PTR(err); + } + + static void wait_for_inflight_permits(struct rtrs_clt *clt) diff --git a/patches.suse/RDMA-rtrs-clt-Set-mininum-limit-when-create-QP.patch b/patches.suse/RDMA-rtrs-clt-Set-mininum-limit-when-create-QP.patch new file mode 100644 index 0000000..aeb412b --- /dev/null +++ b/patches.suse/RDMA-rtrs-clt-Set-mininum-limit-when-create-QP.patch @@ -0,0 +1,83 @@ +From: Jack Wang +Date: Thu, 17 Dec 2020 15:19:01 +0100 +Subject: RDMA/rtrs-clt: Set mininum limit when create QP +Patch-mainline: v5.12-rc1 +Git-commit: f47e4e3e71724f625958b0059f6c8ac5d44d27ef +References: jsc#SLE-15176 + +Currently rtrs when create_qp use a coarse numbers (bigger in general), +which leads to hardware create more resources which only waste memory +with no benefits. + +- SERVICE con, +For max_send_wr/max_recv_wr, it's 2 times SERVICE_CON_QUEUE_DEPTH + 2 + +- IO con +For max_send_wr/max_recv_wr, it's sess->queue_depth * 3 + 1 + +Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality") +Link: https://lore.kernel.org/r/20201217141915.56989-6-jinpu.wang@cloud.ionos.com +Signed-off-by: Jack Wang +Reviewed-by: Md Haris Iqbal +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-clt.c | 19 ++++++++++++------- + 1 file changed, 12 insertions(+), 7 deletions(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c +@@ -1517,7 +1517,7 @@ static void destroy_con(struct rtrs_clt_ + static int create_con_cq_qp(struct rtrs_clt_con *con) + { + struct rtrs_clt_sess *sess = to_clt_sess(con->c.sess); +- u32 wr_queue_size; ++ u32 max_send_wr, max_recv_wr, cq_size; + int err, cq_vector; + struct rtrs_msg_rkey_rsp *rsp; + +@@ -1529,7 +1529,8 @@ static int create_con_cq_qp(struct rtrs_ + * + 2 for drain and heartbeat + * in case qp gets into error state + */ +- wr_queue_size = SERVICE_CON_QUEUE_DEPTH * 3 + 2; ++ max_send_wr = SERVICE_CON_QUEUE_DEPTH * 2 + 2; ++ max_recv_wr = SERVICE_CON_QUEUE_DEPTH * 2 + 2; + /* We must be the first here */ + if (WARN_ON(sess->s.dev)) + return -EINVAL; +@@ -1561,25 +1562,29 @@ static int create_con_cq_qp(struct rtrs_ + + /* Shared between connections */ + sess->s.dev_ref++; +- wr_queue_size = ++ max_send_wr = + min_t(int, sess->s.dev->ib_dev->attrs.max_qp_wr, + /* QD * (REQ + RSP + FR REGS or INVS) + drain */ + sess->queue_depth * 3 + 1); ++ max_recv_wr = ++ min_t(int, sess->s.dev->ib_dev->attrs.max_qp_wr, ++ sess->queue_depth * 3 + 1); + } + /* alloc iu to recv new rkey reply when server reports flags set */ + if (sess->flags == RTRS_MSG_NEW_RKEY_F || con->c.cid == 0) { +- con->rsp_ius = rtrs_iu_alloc(wr_queue_size, sizeof(*rsp), ++ con->rsp_ius = rtrs_iu_alloc(max_recv_wr, sizeof(*rsp), + GFP_KERNEL, sess->s.dev->ib_dev, + DMA_FROM_DEVICE, + rtrs_clt_rdma_done); + if (!con->rsp_ius) + return -ENOMEM; +- con->queue_size = wr_queue_size; ++ con->queue_size = max_recv_wr; + } ++ cq_size = max_send_wr + max_recv_wr; + cq_vector = con->cpu % sess->s.dev->ib_dev->num_comp_vectors; + err = rtrs_cq_qp_create(&sess->s, &con->c, sess->max_send_sge, +- cq_vector, wr_queue_size, wr_queue_size, +- wr_queue_size, IB_POLL_SOFTIRQ); ++ cq_vector, cq_size, max_send_wr, ++ max_recv_wr, IB_POLL_SOFTIRQ); + /* + * In case of error we do not bother to clean previous allocations, + * since destroy_con_cq_qp() must be called. diff --git a/patches.suse/RDMA-rtrs-clt-Use-bitmask-to-check-sess-flags.patch b/patches.suse/RDMA-rtrs-clt-Use-bitmask-to-check-sess-flags.patch new file mode 100644 index 0000000..16e0b6e --- /dev/null +++ b/patches.suse/RDMA-rtrs-clt-Use-bitmask-to-check-sess-flags.patch @@ -0,0 +1,81 @@ +From: Jack Wang +Date: Thu, 17 Dec 2020 15:19:12 +0100 +Subject: RDMA/rtrs-clt: Use bitmask to check sess->flags +Patch-mainline: v5.12-rc1 +Git-commit: aaed465f761700dace9ab39521013cddaae4f5a3 +References: jsc#SLE-15176 + +We may want to add new flags, so it's better to use bitmask to check flags. + +Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality") +Link: https://lore.kernel.org/r/20201217141915.56989-17-jinpu.wang@cloud.ionos.com +Signed-off-by: Jack Wang +Signed-off-by: Gioh Kim +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-clt.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c +@@ -500,7 +500,7 @@ static void rtrs_clt_recv_done(struct rt + int err; + struct rtrs_clt_sess *sess = to_clt_sess(con->c.sess); + +- WARN_ON(sess->flags != RTRS_MSG_NEW_RKEY_F); ++ WARN_ON((sess->flags & RTRS_MSG_NEW_RKEY_F) == 0); + iu = container_of(wc->wr_cqe, struct rtrs_iu, + cqe); + err = rtrs_iu_post_recv(&con->c, iu); +@@ -520,7 +520,7 @@ static void rtrs_clt_rkey_rsp_done(struc + u32 buf_id; + int err; + +- WARN_ON(sess->flags != RTRS_MSG_NEW_RKEY_F); ++ WARN_ON((sess->flags & RTRS_MSG_NEW_RKEY_F) == 0); + + iu = container_of(wc->wr_cqe, struct rtrs_iu, cqe); + +@@ -627,12 +627,12 @@ static void rtrs_clt_rdma_done(struct ib + } else if (imm_type == RTRS_HB_MSG_IMM) { + WARN_ON(con->c.cid); + rtrs_send_hb_ack(&sess->s); +- if (sess->flags == RTRS_MSG_NEW_RKEY_F) ++ if (sess->flags & RTRS_MSG_NEW_RKEY_F) + return rtrs_clt_recv_done(con, wc); + } else if (imm_type == RTRS_HB_ACK_IMM) { + WARN_ON(con->c.cid); + sess->s.hb_missed_cnt = 0; +- if (sess->flags == RTRS_MSG_NEW_RKEY_F) ++ if (sess->flags & RTRS_MSG_NEW_RKEY_F) + return rtrs_clt_recv_done(con, wc); + } else { + rtrs_wrn(con->c.sess, "Unknown IMM type %u\n", +@@ -660,7 +660,7 @@ static void rtrs_clt_rdma_done(struct ib + WARN_ON(!(wc->wc_flags & IB_WC_WITH_INVALIDATE || + wc->wc_flags & IB_WC_WITH_IMM)); + WARN_ON(wc->wr_cqe->done != rtrs_clt_rdma_done); +- if (sess->flags == RTRS_MSG_NEW_RKEY_F) { ++ if (sess->flags & RTRS_MSG_NEW_RKEY_F) { + if (wc->wc_flags & IB_WC_WITH_INVALIDATE) + return rtrs_clt_recv_done(con, wc); + +@@ -685,7 +685,7 @@ static int post_recv_io(struct rtrs_clt_ + struct rtrs_clt_sess *sess = to_clt_sess(con->c.sess); + + for (i = 0; i < q_size; i++) { +- if (sess->flags == RTRS_MSG_NEW_RKEY_F) { ++ if (sess->flags & RTRS_MSG_NEW_RKEY_F) { + struct rtrs_iu *iu = &con->rsp_ius[i]; + + err = rtrs_iu_post_recv(&con->c, iu); +@@ -1570,7 +1570,7 @@ static int create_con_cq_qp(struct rtrs_ + sess->queue_depth * 3 + 1); + } + /* alloc iu to recv new rkey reply when server reports flags set */ +- if (sess->flags == RTRS_MSG_NEW_RKEY_F || con->c.cid == 0) { ++ if (sess->flags & RTRS_MSG_NEW_RKEY_F || con->c.cid == 0) { + con->rsp_ius = rtrs_iu_alloc(max_recv_wr, sizeof(*rsp), + GFP_KERNEL, sess->s.dev->ib_dev, + DMA_FROM_DEVICE, diff --git a/patches.suse/RDMA-rtrs-srv-Do-not-pass-a-valid-pointer-to-PTR_ERR.patch b/patches.suse/RDMA-rtrs-srv-Do-not-pass-a-valid-pointer-to-PTR_ERR.patch new file mode 100644 index 0000000..2b9ac71 --- /dev/null +++ b/patches.suse/RDMA-rtrs-srv-Do-not-pass-a-valid-pointer-to-PTR_ERR.patch @@ -0,0 +1,88 @@ +From: Jack Wang +Date: Tue, 16 Feb 2021 15:38:07 +0100 +Subject: RDMA/rtrs-srv: Do not pass a valid pointer to PTR_ERR() +Patch-mainline: v5.12-rc1 +Git-commit: ed408529679737a9a7ad816c8de5d59ba104bb11 +References: jsc#SLE-15176 + +smatch gives the warning: + + drivers/infiniband/ulp/rtrs/rtrs-srv.c:1805 rtrs_rdma_connect() warn: passing zero to 'PTR_ERR' + +Which is trying to say smatch has shown that srv is not an error pointer +and thus cannot be passed to PTR_ERR. + +The solution is to move the list_add() down after full initilization of +rtrs_srv. To avoid holding the srv_mutex too long, only hold it during the +list operation as suggested by Leon. + +Fixes: 03e9b33a0fd6 ("RDMA/rtrs: Only allow addition of path to an already established session") +Link: https://lore.kernel.org/r/20210216143807.65923-1-jinpu.wang@cloud.ionos.com +Reported-by: kernel test robot +Reported-by: Dan Carpenter +Signed-off-by: Jack Wang +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-srv.c | 20 +++++++------------- + 1 file changed, 7 insertions(+), 13 deletions(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c +@@ -1360,21 +1360,18 @@ static struct rtrs_srv *get_or_create_sr + return srv; + } + } ++ mutex_unlock(&ctx->srv_mutex); + /* + * If this request is not the first connection request from the + * client for this session then fail and return error. + */ +- if (!first_conn) { +- mutex_unlock(&ctx->srv_mutex); ++ if (!first_conn) + return ERR_PTR(-ENXIO); +- } + + /* need to allocate a new srv */ + srv = kzalloc(sizeof(*srv), GFP_KERNEL); +- if (!srv) { +- mutex_unlock(&ctx->srv_mutex); ++ if (!srv) + return ERR_PTR(-ENOMEM); +- } + + INIT_LIST_HEAD(&srv->paths_list); + mutex_init(&srv->paths_mutex); +@@ -1384,8 +1381,6 @@ static struct rtrs_srv *get_or_create_sr + srv->ctx = ctx; + device_initialize(&srv->dev); + srv->dev.release = rtrs_srv_dev_release; +- list_add(&srv->ctx_list, &ctx->srv_list); +- mutex_unlock(&ctx->srv_mutex); + + srv->chunks = kcalloc(srv->queue_depth, sizeof(*srv->chunks), + GFP_KERNEL); +@@ -1398,6 +1393,9 @@ static struct rtrs_srv *get_or_create_sr + goto err_free_chunks; + } + refcount_set(&srv->refcount, 1); ++ mutex_lock(&ctx->srv_mutex); ++ list_add(&srv->ctx_list, &ctx->srv_list); ++ mutex_unlock(&ctx->srv_mutex); + + return srv; + +@@ -1812,11 +1810,7 @@ static int rtrs_rdma_connect(struct rdma + } + recon_cnt = le16_to_cpu(msg->recon_cnt); + srv = get_or_create_srv(ctx, &msg->paths_uuid, msg->first_conn); +- /* +- * "refcount == 0" happens if a previous thread calls get_or_create_srv +- * allocate srv, but chunks of srv are not allocated yet. +- */ +- if (IS_ERR(srv) || refcount_read(&srv->refcount) == 0) { ++ if (IS_ERR(srv)) { + err = PTR_ERR(srv); + goto reject_w_err; + } diff --git a/patches.suse/RDMA-rtrs-srv-Do-not-signal-REG_MR.patch b/patches.suse/RDMA-rtrs-srv-Do-not-signal-REG_MR.patch new file mode 100644 index 0000000..2424eef --- /dev/null +++ b/patches.suse/RDMA-rtrs-srv-Do-not-signal-REG_MR.patch @@ -0,0 +1,31 @@ +From: Jack Wang +Date: Thu, 17 Dec 2020 15:19:13 +0100 +Subject: RDMA/rtrs-srv: Do not signal REG_MR +Patch-mainline: v5.12-rc1 +Git-commit: e8ae7ddb48a1b81fd1e67da34a0cb59daf0445d6 +References: jsc#SLE-15176 + +We do not need to wait for REG_MR completion, so remove the +SIGNAL flag. + +Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality") +Link: https://lore.kernel.org/r/20201217141915.56989-18-jinpu.wang@cloud.ionos.com +Signed-off-by: Jack Wang +Signed-off-by: Gioh Kim +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-srv.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c +@@ -831,7 +831,7 @@ static int process_info_req(struct rtrs_ + rwr[mri].wr.opcode = IB_WR_REG_MR; + rwr[mri].wr.wr_cqe = &local_reg_cqe; + rwr[mri].wr.num_sge = 0; +- rwr[mri].wr.send_flags = mri ? 0 : IB_SEND_SIGNALED; ++ rwr[mri].wr.send_flags = 0; + rwr[mri].mr = mr; + rwr[mri].key = mr->rkey; + rwr[mri].access = (IB_ACCESS_LOCAL_WRITE | diff --git a/patches.suse/RDMA-rtrs-srv-Fix-missing-wr_cqe.patch b/patches.suse/RDMA-rtrs-srv-Fix-missing-wr_cqe.patch new file mode 100644 index 0000000..faa1ba4 --- /dev/null +++ b/patches.suse/RDMA-rtrs-srv-Fix-missing-wr_cqe.patch @@ -0,0 +1,63 @@ +From: Jack Wang +Date: Thu, 17 Dec 2020 15:19:09 +0100 +Subject: RDMA/rtrs-srv: Fix missing wr_cqe +Patch-mainline: v5.12-rc1 +Git-commit: 8537f2de6519945890a2b0f3739b23f32b5c0a89 +References: jsc#SLE-15176 + +We had a few places wr_cqe is not set, which could lead to NULL pointer +deref or GPF in error case. + +Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality") +Link: https://lore.kernel.org/r/20201217141915.56989-14-jinpu.wang@cloud.ionos.com +Signed-off-by: Jack Wang +Reviewed-by: Md Haris Iqbal +Signed-off-by: Guoqing Jiang +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-srv.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c +@@ -277,6 +277,7 @@ static int rdma_write_sg(struct rtrs_srv + WARN_ON_ONCE(rkey != wr->rkey); + + wr->wr.opcode = IB_WR_RDMA_WRITE; ++ wr->wr.wr_cqe = &io_comp_cqe; + wr->wr.ex.imm_data = 0; + wr->wr.send_flags = 0; + +@@ -304,6 +305,7 @@ static int rdma_write_sg(struct rtrs_srv + inv_wr.sg_list = NULL; + inv_wr.num_sge = 0; + inv_wr.opcode = IB_WR_SEND_WITH_INV; ++ inv_wr.wr_cqe = &io_comp_cqe; + inv_wr.send_flags = 0; + inv_wr.ex.invalidate_rkey = rkey; + } +@@ -314,6 +316,7 @@ static int rdma_write_sg(struct rtrs_srv + + srv_mr = &sess->mrs[id->msg_id]; + rwr.wr.opcode = IB_WR_REG_MR; ++ rwr.wr.wr_cqe = &local_reg_cqe; + rwr.wr.num_sge = 0; + rwr.mr = srv_mr->mr; + rwr.wr.send_flags = 0; +@@ -389,6 +392,7 @@ static int send_io_resp_imm(struct rtrs_ + + if (need_inval) { + if (likely(sg_cnt)) { ++ inv_wr.wr_cqe = &io_comp_cqe; + inv_wr.sg_list = NULL; + inv_wr.num_sge = 0; + inv_wr.opcode = IB_WR_SEND_WITH_INV; +@@ -431,6 +435,7 @@ static int send_io_resp_imm(struct rtrs_ + srv_mr = &sess->mrs[id->msg_id]; + rwr.wr.next = &imm_wr; + rwr.wr.opcode = IB_WR_REG_MR; ++ rwr.wr.wr_cqe = &local_reg_cqe; + rwr.wr.num_sge = 0; + rwr.wr.send_flags = 0; + rwr.mr = srv_mr->mr; diff --git a/patches.suse/RDMA-rtrs-srv-Fix-stack-out-of-bounds.patch b/patches.suse/RDMA-rtrs-srv-Fix-stack-out-of-bounds.patch new file mode 100644 index 0000000..40e1c43 --- /dev/null +++ b/patches.suse/RDMA-rtrs-srv-Fix-stack-out-of-bounds.patch @@ -0,0 +1,198 @@ +From: Jack Wang +Date: Fri, 12 Feb 2021 14:45:22 +0100 +Subject: RDMA/rtrs-srv: Fix stack-out-of-bounds +Patch-mainline: v5.12-rc1 +Git-commit: e6daa8f61d8def10f0619fe51b4c794f69598e4f +References: jsc#SLE-15176 + + BUG: KASAN: stack-out-of-bounds in _mlx4_ib_post_send+0x1bd2/0x2770 [mlx4_ib] + Read of size 4 at addr ffff8880d5a7f980 by task kworker/0:1H/565 + + CPU: 0 PID: 565 Comm: kworker/0:1H Tainted: G O 5.4.84-storage #5.4.84-1+feature+linux+5.4.y+dbg+20201216.1319+b6b887b~deb10 + Hardware name: Supermicro H8QG6/H8QG6, BIOS 3.00 09/04/2012 + Workqueue: ib-comp-wq ib_cq_poll_work [ib_core] + Call Trace: + dump_stack+0x96/0xe0 + print_address_description.constprop.4+0x1f/0x300 + ? irq_work_claim+0x2e/0x50 + __kasan_report.cold.8+0x78/0x92 + ? _mlx4_ib_post_send+0x1bd2/0x2770 [mlx4_ib] + kasan_report+0x10/0x20 + _mlx4_ib_post_send+0x1bd2/0x2770 [mlx4_ib] + ? check_chain_key+0x1d7/0x2e0 + ? _mlx4_ib_post_recv+0x630/0x630 [mlx4_ib] + ? lockdep_hardirqs_on+0x1a8/0x290 + ? stack_depot_save+0x218/0x56e + ? do_profile_hits.isra.6.cold.13+0x1d/0x1d + ? check_chain_key+0x1d7/0x2e0 + ? save_stack+0x4d/0x80 + ? save_stack+0x19/0x80 + ? __kasan_slab_free+0x125/0x170 + ? kfree+0xe7/0x3b0 + rdma_write_sg+0x5b0/0x950 [rtrs_server] + +The problem is when we send imm_wr, the type should be ib_rdma_wr, so hw +driver like mlx4 can do rdma_wr(wr), so fix it by use the ib_rdma_wr as +type for imm_wr. + +Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality") +Link: https://lore.kernel.org/r/20210212134525.103456-2-jinpu.wang@cloud.ionos.com +Signed-off-by: Jack Wang +Reviewed-by: Gioh Kim +Reviewed-by: Leon Romanovsky +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-srv.c | 64 +++++++++++++++++---------------- + 1 file changed, 33 insertions(+), 31 deletions(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c +@@ -232,7 +232,8 @@ static int rdma_write_sg(struct rtrs_srv + dma_addr_t dma_addr = sess->dma_addr[id->msg_id]; + struct rtrs_srv_mr *srv_mr; + struct rtrs_srv *srv = sess->srv; +- struct ib_send_wr inv_wr, imm_wr; ++ struct ib_send_wr inv_wr; ++ struct ib_rdma_wr imm_wr; + struct ib_rdma_wr *wr = NULL; + enum ib_send_flags flags; + size_t sg_cnt; +@@ -284,15 +285,15 @@ static int rdma_write_sg(struct rtrs_srv + if (need_inval && always_invalidate) { + wr->wr.next = &rwr.wr; + rwr.wr.next = &inv_wr; +- inv_wr.next = &imm_wr; ++ inv_wr.next = &imm_wr.wr; + } else if (always_invalidate) { + wr->wr.next = &rwr.wr; +- rwr.wr.next = &imm_wr; ++ rwr.wr.next = &imm_wr.wr; + } else if (need_inval) { + wr->wr.next = &inv_wr; +- inv_wr.next = &imm_wr; ++ inv_wr.next = &imm_wr.wr; + } else { +- wr->wr.next = &imm_wr; ++ wr->wr.next = &imm_wr.wr; + } + /* + * From time to time we have to post signaled sends, +@@ -310,7 +311,7 @@ static int rdma_write_sg(struct rtrs_srv + inv_wr.ex.invalidate_rkey = rkey; + } + +- imm_wr.next = NULL; ++ imm_wr.wr.next = NULL; + if (always_invalidate) { + struct rtrs_msg_rkey_rsp *msg; + +@@ -331,22 +332,22 @@ static int rdma_write_sg(struct rtrs_srv + list.addr = srv_mr->iu->dma_addr; + list.length = sizeof(*msg); + list.lkey = sess->s.dev->ib_pd->local_dma_lkey; +- imm_wr.sg_list = &list; +- imm_wr.num_sge = 1; +- imm_wr.opcode = IB_WR_SEND_WITH_IMM; ++ imm_wr.wr.sg_list = &list; ++ imm_wr.wr.num_sge = 1; ++ imm_wr.wr.opcode = IB_WR_SEND_WITH_IMM; + ib_dma_sync_single_for_device(sess->s.dev->ib_dev, + srv_mr->iu->dma_addr, + srv_mr->iu->size, DMA_TO_DEVICE); + } else { +- imm_wr.sg_list = NULL; +- imm_wr.num_sge = 0; +- imm_wr.opcode = IB_WR_RDMA_WRITE_WITH_IMM; ++ imm_wr.wr.sg_list = NULL; ++ imm_wr.wr.num_sge = 0; ++ imm_wr.wr.opcode = IB_WR_RDMA_WRITE_WITH_IMM; + } +- imm_wr.send_flags = flags; +- imm_wr.ex.imm_data = cpu_to_be32(rtrs_to_io_rsp_imm(id->msg_id, ++ imm_wr.wr.send_flags = flags; ++ imm_wr.wr.ex.imm_data = cpu_to_be32(rtrs_to_io_rsp_imm(id->msg_id, + 0, need_inval)); + +- imm_wr.wr_cqe = &io_comp_cqe; ++ imm_wr.wr.wr_cqe = &io_comp_cqe; + ib_dma_sync_single_for_device(sess->s.dev->ib_dev, dma_addr, + offset, DMA_BIDIRECTIONAL); + +@@ -373,7 +374,8 @@ static int send_io_resp_imm(struct rtrs_ + { + struct rtrs_sess *s = con->c.sess; + struct rtrs_srv_sess *sess = to_srv_sess(s); +- struct ib_send_wr inv_wr, imm_wr, *wr = NULL; ++ struct ib_send_wr inv_wr, *wr = NULL; ++ struct ib_rdma_wr imm_wr; + struct ib_reg_wr rwr; + struct rtrs_srv *srv = sess->srv; + struct rtrs_srv_mr *srv_mr; +@@ -410,15 +412,15 @@ static int send_io_resp_imm(struct rtrs_ + if (need_inval && always_invalidate) { + wr = &inv_wr; + inv_wr.next = &rwr.wr; +- rwr.wr.next = &imm_wr; ++ rwr.wr.next = &imm_wr.wr; + } else if (always_invalidate) { + wr = &rwr.wr; +- rwr.wr.next = &imm_wr; ++ rwr.wr.next = &imm_wr.wr; + } else if (need_inval) { + wr = &inv_wr; +- inv_wr.next = &imm_wr; ++ inv_wr.next = &imm_wr.wr; + } else { +- wr = &imm_wr; ++ wr = &imm_wr.wr; + } + /* + * From time to time we have to post signalled sends, +@@ -427,13 +429,13 @@ static int send_io_resp_imm(struct rtrs_ + flags = (atomic_inc_return(&con->wr_cnt) % srv->queue_depth) ? + 0 : IB_SEND_SIGNALED; + imm = rtrs_to_io_rsp_imm(id->msg_id, errno, need_inval); +- imm_wr.next = NULL; ++ imm_wr.wr.next = NULL; + if (always_invalidate) { + struct ib_sge list; + struct rtrs_msg_rkey_rsp *msg; + + srv_mr = &sess->mrs[id->msg_id]; +- rwr.wr.next = &imm_wr; ++ rwr.wr.next = &imm_wr.wr; + rwr.wr.opcode = IB_WR_REG_MR; + rwr.wr.wr_cqe = &local_reg_cqe; + rwr.wr.num_sge = 0; +@@ -450,21 +452,21 @@ static int send_io_resp_imm(struct rtrs_ + list.addr = srv_mr->iu->dma_addr; + list.length = sizeof(*msg); + list.lkey = sess->s.dev->ib_pd->local_dma_lkey; +- imm_wr.sg_list = &list; +- imm_wr.num_sge = 1; +- imm_wr.opcode = IB_WR_SEND_WITH_IMM; ++ imm_wr.wr.sg_list = &list; ++ imm_wr.wr.num_sge = 1; ++ imm_wr.wr.opcode = IB_WR_SEND_WITH_IMM; + ib_dma_sync_single_for_device(sess->s.dev->ib_dev, + srv_mr->iu->dma_addr, + srv_mr->iu->size, DMA_TO_DEVICE); + } else { +- imm_wr.sg_list = NULL; +- imm_wr.num_sge = 0; +- imm_wr.opcode = IB_WR_RDMA_WRITE_WITH_IMM; ++ imm_wr.wr.sg_list = NULL; ++ imm_wr.wr.num_sge = 0; ++ imm_wr.wr.opcode = IB_WR_RDMA_WRITE_WITH_IMM; + } +- imm_wr.send_flags = flags; +- imm_wr.wr_cqe = &io_comp_cqe; ++ imm_wr.wr.send_flags = flags; ++ imm_wr.wr.wr_cqe = &io_comp_cqe; + +- imm_wr.ex.imm_data = cpu_to_be32(imm); ++ imm_wr.wr.ex.imm_data = cpu_to_be32(imm); + + err = ib_post_send(id->con->c.qp, wr, NULL); + if (unlikely(err)) diff --git a/patches.suse/RDMA-rtrs-srv-Init-wr_cnt-as-1.patch b/patches.suse/RDMA-rtrs-srv-Init-wr_cnt-as-1.patch new file mode 100644 index 0000000..8ec26eb --- /dev/null +++ b/patches.suse/RDMA-rtrs-srv-Init-wr_cnt-as-1.patch @@ -0,0 +1,34 @@ +From: Jack Wang +Date: Thu, 17 Dec 2020 15:19:14 +0100 +Subject: RDMA/rtrs-srv: Init wr_cnt as 1 +Patch-mainline: v5.12-rc1 +Git-commit: 6f5d1b3016d650f351e65c645a5eee5394547dd0 +References: jsc#SLE-15176 + +Fix up wr_avail accounting. if wr_cnt is 0, then we do SIGNAL for first +wr, in completion we add queue_depth back, which is not right in the +sense of tracking for available wr. + +So fix it by init wr_cnt to 1. + +Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality") +Link: https://lore.kernel.org/r/20201217141915.56989-19-jinpu.wang@cloud.ionos.com +Signed-off-by: Jack Wang +Signed-off-by: Gioh Kim +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-srv.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c +@@ -1616,7 +1616,7 @@ static int create_con(struct rtrs_srv_se + con->c.cm_id = cm_id; + con->c.sess = &sess->s; + con->c.cid = cid; +- atomic_set(&con->wr_cnt, 0); ++ atomic_set(&con->wr_cnt, 1); + + if (con->c.cid == 0) { + /* diff --git a/patches.suse/RDMA-rtrs-srv-Jump-to-dereg_mr-label-if-allocate-iu-.patch b/patches.suse/RDMA-rtrs-srv-Jump-to-dereg_mr-label-if-allocate-iu-.patch new file mode 100644 index 0000000..454f05b --- /dev/null +++ b/patches.suse/RDMA-rtrs-srv-Jump-to-dereg_mr-label-if-allocate-iu-.patch @@ -0,0 +1,40 @@ +From: Guoqing Jiang +Date: Thu, 17 Dec 2020 15:19:02 +0100 +Subject: RDMA/rtrs-srv: Jump to dereg_mr label if allocate iu fails +Patch-mainline: v5.12-rc1 +Git-commit: f77c4839ee8f4612dcb6601602329096030bd813 +References: jsc#SLE-15176 + +The rtrs_iu_free is called in rtrs_iu_alloc if memory is limited, so we +don't need to free the same iu again. + +Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality") +Link: https://lore.kernel.org/r/20201217141915.56989-7-jinpu.wang@cloud.ionos.com +Signed-off-by: Guoqing Jiang +Reviewed-by: Gioh Kim +Signed-off-by: Jack Wang +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-srv.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c +@@ -664,7 +664,7 @@ static int map_cont_bufs(struct rtrs_srv + if (!srv_mr->iu) { + err = -ENOMEM; + rtrs_err(ss, "rtrs_iu_alloc(), err: %d\n", err); +- goto free_iu; ++ goto dereg_mr; + } + } + /* Eventually dma addr for each chunk can be cached */ +@@ -680,7 +680,6 @@ err: + srv_mr = &sess->mrs[mri]; + sgt = &srv_mr->sgt; + mr = srv_mr->mr; +-free_iu: + rtrs_iu_free(srv_mr->iu, sess->s.dev->ib_dev, 1); + dereg_mr: + ib_dereg_mr(mr); diff --git a/patches.suse/RDMA-rtrs-srv-Release-lock-before-call-into-close_se.patch b/patches.suse/RDMA-rtrs-srv-Release-lock-before-call-into-close_se.patch new file mode 100644 index 0000000..e817f7f --- /dev/null +++ b/patches.suse/RDMA-rtrs-srv-Release-lock-before-call-into-close_se.patch @@ -0,0 +1,31 @@ +From: Jack Wang +Date: Thu, 17 Dec 2020 15:18:59 +0100 +Subject: RDMA/rtrs-srv: Release lock before call into close_sess +Patch-mainline: v5.12-rc1 +Git-commit: 99f0c3807973359bba8f37d9198eea59fe38c32a +References: jsc#SLE-15176 + +In this error case, we don't need hold mutex to call close_sess. + +Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality") +Link: https://lore.kernel.org/r/20201217141915.56989-4-jinpu.wang@cloud.ionos.com +Signed-off-by: Jack Wang +Tested-by: Lutz Pogrell +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-srv.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c +@@ -1876,8 +1876,8 @@ reject_w_econnreset: + return rtrs_rdma_do_reject(cm_id, -ECONNRESET); + + close_and_return_err: +- close_sess(sess); + mutex_unlock(&srv->paths_mutex); ++ close_sess(sess); + + return err; + } diff --git a/patches.suse/RDMA-rtrs-srv-Use-sysfs_remove_file_self-for-disconn.patch b/patches.suse/RDMA-rtrs-srv-Use-sysfs_remove_file_self-for-disconn.patch new file mode 100644 index 0000000..7d22773 --- /dev/null +++ b/patches.suse/RDMA-rtrs-srv-Use-sysfs_remove_file_self-for-disconn.patch @@ -0,0 +1,31 @@ +From: Jack Wang +Date: Thu, 17 Dec 2020 15:19:00 +0100 +Subject: RDMA/rtrs-srv: Use sysfs_remove_file_self for disconnect +Patch-mainline: v5.12-rc1 +Git-commit: f991fdac813f1598a9bb17b602ce04812ba9148c +References: jsc#SLE-15176 + +Remove self first to avoid deadlock, we don't want to +use close_work to remove sess sysfs. + +Fixes: 91b11610af8d ("RDMA/rtrs: server: sysfs interface functions") +Link: https://lore.kernel.org/r/20201217141915.56989-5-jinpu.wang@cloud.ionos.com +Signed-off-by: Jack Wang +Tested-by: Lutz Pogrell +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c +@@ -53,6 +53,8 @@ static ssize_t rtrs_srv_disconnect_store + sockaddr_to_str((struct sockaddr *)&sess->s.dst_addr, str, sizeof(str)); + + rtrs_info(s, "disconnect for path %s requested\n", str); ++ /* first remove sysfs itself to avoid deadlock */ ++ sysfs_remove_file_self(&sess->kobj, &attr->attr); + close_sess(sess); + + return count; diff --git a/patches.suse/RDMA-rtrs-srv-fix-memory-leak-by-missing-kobject-fre.patch b/patches.suse/RDMA-rtrs-srv-fix-memory-leak-by-missing-kobject-fre.patch new file mode 100644 index 0000000..0c3faeb --- /dev/null +++ b/patches.suse/RDMA-rtrs-srv-fix-memory-leak-by-missing-kobject-fre.patch @@ -0,0 +1,77 @@ +From: Gioh Kim +Date: Fri, 12 Feb 2021 14:45:24 +0100 +Subject: RDMA/rtrs-srv: fix memory leak by missing kobject free +Patch-mainline: v5.12-rc1 +Git-commit: f7452a7e96c120d73100387d5f87de9fce7133cb +References: jsc#SLE-15176 + +kmemleak reported an error as below: + + unreferenced object 0xffff8880674b7640 (size 64): + comm "kworker/4:1H", pid 113, jiffies 4296403507 (age 507.840s) + hex dump (first 32 bytes): + 69 70 3a 31 39 32 2e 31 36 38 2e 31 32 32 2e 31 ip:192.168.122.1 + 31 30 40 69 70 3a 31 39 32 2e 31 36 38 2e 31 32 10@ip:192.168.12 + backtrace: + [<0000000054413611>] kstrdup+0x2e/0x60 + [<0000000078e3120a>] kobject_set_name_vargs+0x2f/0xb0 + [<00000000ca2be3ee>] kobject_init_and_add+0xb0/0x120 + [<0000000062ba5e78>] rtrs_srv_create_sess_files+0x14c/0x314 [rtrs_server] + [<00000000b45b7217>] rtrs_srv_info_req_done+0x5b1/0x800 [rtrs_server] + [<000000008fc5aa8f>] __ib_process_cq+0x94/0x100 [ib_core] + [<00000000a9599cb4>] ib_cq_poll_work+0x32/0xc0 [ib_core] + [<00000000cfc376be>] process_one_work+0x4bc/0x980 + [<0000000016e5c96a>] worker_thread+0x78/0x5c0 + [<00000000c20b8be0>] kthread+0x191/0x1e0 + [<000000006c9c0003>] ret_from_fork+0x3a/0x50 + +It is caused by the not-freed kobject of rtrs_srv_sess. The kobject +embedded in rtrs_srv_sess has ref-counter 2 after calling +process_info_req(). Therefore it must call kobject_put twice. Currently +it calls kobject_put only once at rtrs_srv_destroy_sess_files because +kobject_del removes the state_in_sysfs flag and then kobject_put in +free_sess() is not called. + +This patch moves kobject_del() into free_sess() so that the kobject of +rtrs_srv_sess can be freed. And also this patch adds the missing call of +sysfs_remove_group() to clean-up the sysfs directory. + +Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality") +Link: https://lore.kernel.org/r/20210212134525.103456-4-jinpu.wang@cloud.ionos.com +Signed-off-by: Gioh Kim +Signed-off-by: Jack Wang +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 2 +- + drivers/infiniband/ulp/rtrs/rtrs-srv.c | 6 ++++-- + 2 files changed, 5 insertions(+), 3 deletions(-) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c +@@ -308,7 +308,7 @@ void rtrs_srv_destroy_sess_files(struct + if (sess->kobj.state_in_sysfs) { + kobject_del(&sess->stats->kobj_stats); + kobject_put(&sess->stats->kobj_stats); +- kobject_del(&sess->kobj); ++ sysfs_remove_group(&sess->kobj, &rtrs_srv_sess_attr_group); + kobject_put(&sess->kobj); + + rtrs_srv_destroy_once_sysfs_root_folders(sess); +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c +@@ -1488,10 +1488,12 @@ static bool __is_path_w_addr_exists(stru + + static void free_sess(struct rtrs_srv_sess *sess) + { +- if (sess->kobj.state_in_sysfs) ++ if (sess->kobj.state_in_sysfs) { ++ kobject_del(&sess->kobj); + kobject_put(&sess->kobj); +- else ++ } else { + kfree(sess); ++ } + } + + static void rtrs_srv_close_work(struct work_struct *work) diff --git a/patches.suse/RDMA-rtrs-srv-sysfs-fix-missing-put_device.patch b/patches.suse/RDMA-rtrs-srv-sysfs-fix-missing-put_device.patch new file mode 100644 index 0000000..b549f46 --- /dev/null +++ b/patches.suse/RDMA-rtrs-srv-sysfs-fix-missing-put_device.patch @@ -0,0 +1,59 @@ +From: Gioh Kim +Date: Fri, 12 Feb 2021 14:45:25 +0100 +Subject: RDMA/rtrs-srv-sysfs: fix missing put_device +Patch-mainline: v5.12-rc1 +Git-commit: e2853c49477d104c01d3c7944e1fb5074eb11d9f +References: jsc#SLE-15176 + +put_device() decreases the ref-count and then the device will be +cleaned-up, while at is also add missing put_device in +rtrs_srv_create_once_sysfs_root_folders + +This patch solves a kmemleak error as below: + + unreferenced object 0xffff88809a7a0710 (size 8): + comm "kworker/4:1H", pid 113, jiffies 4295833049 (age 6212.380s) + hex dump (first 8 bytes): + 62 6c 61 00 6b 6b 6b a5 bla.kkk. + backtrace: + [<0000000054413611>] kstrdup+0x2e/0x60 + [<0000000078e3120a>] kobject_set_name_vargs+0x2f/0xb0 + [<00000000f1a17a6b>] dev_set_name+0xab/0xe0 + [<00000000d5502e32>] rtrs_srv_create_sess_files+0x2fb/0x314 [rtrs_server] + [<00000000ed11a1ef>] rtrs_srv_info_req_done+0x631/0x800 [rtrs_server] + [<000000008fc5aa8f>] __ib_process_cq+0x94/0x100 [ib_core] + [<00000000a9599cb4>] ib_cq_poll_work+0x32/0xc0 [ib_core] + [<00000000cfc376be>] process_one_work+0x4bc/0x980 + [<0000000016e5c96a>] worker_thread+0x78/0x5c0 + [<00000000c20b8be0>] kthread+0x191/0x1e0 + [<000000006c9c0003>] ret_from_fork+0x3a/0x50 + +Fixes: baa5b28b7a47 ("RDMA/rtrs-srv: Replace device_register with device_initialize and device_add") +Link: https://lore.kernel.org/r/20210212134525.103456-5-jinpu.wang@cloud.ionos.com +Signed-off-by: Gioh Kim +Signed-off-by: Jack Wang +Reviewed-by: Leon Romanovsky +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c +@@ -186,6 +186,7 @@ static int rtrs_srv_create_once_sysfs_ro + err = -ENOMEM; + pr_err("kobject_create_and_add(): %d\n", err); + device_del(&srv->dev); ++ put_device(&srv->dev); + goto unlock; + } + dev_set_uevent_suppress(&srv->dev, false); +@@ -211,6 +212,7 @@ rtrs_srv_destroy_once_sysfs_root_folders + kobject_put(srv->kobj_paths); + mutex_unlock(&srv->paths_mutex); + device_del(&srv->dev); ++ put_device(&srv->dev); + } else { + mutex_unlock(&srv->paths_mutex); + } diff --git a/patches.suse/RDMA-ucma-Fix-use-after-free-bug-in-ucma_create_ueve.patch b/patches.suse/RDMA-ucma-Fix-use-after-free-bug-in-ucma_create_ueve.patch new file mode 100644 index 0000000..51c7db8 --- /dev/null +++ b/patches.suse/RDMA-ucma-Fix-use-after-free-bug-in-ucma_create_ueve.patch @@ -0,0 +1,231 @@ +From: Avihai Horon +Date: Thu, 11 Feb 2021 11:05:17 +0200 +Subject: RDMA/ucma: Fix use-after-free bug in ucma_create_uevent +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Patch-mainline: v5.12-rc1 +Git-commit: fe454dc31e84f8c14cb8942fcb61666c9f40745b +References: bsc#1181147 + +ucma_process_join() allocates struct ucma_multicast mc and frees it if an +error occurs during its run. Specifically, if an error occurs in +copy_to_user(), a use-after-free might happen in the following scenario: + +1. mc struct is allocated. +2. rdma_join_multicast() is called and succeeds. During its run, + cma_iboe_join_multicast() enqueues a work that will later use the + aforementioned mc struct. +3. copy_to_user() is called and fails. +4. mc struct is deallocated. +5. The work that was enqueued by cma_iboe_join_multicast() is run and + calls ucma_create_uevent() which tries to access mc struct (which is + freed by now). + +Fix this bug by cancelling the work enqueued by cma_iboe_join_multicast(). +Since cma_work_handler() frees struct cma_work, we don't use it in +cma_iboe_join_multicast() so we can safely cancel the work later. + +The following syzkaller report revealed it: + + BUG: KASAN: use-after-free in ucma_create_uevent+0x2dd/0x;3f0 drivers/infiniband/core/ucma.c:272 + Read of size 8 at addr ffff88810b3ad110 by task kworker/u8:1/108 + + CPU: 1 PID: 108 Comm: kworker/u8:1 Not tainted 5.10.0-rc6+ #257 + Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 + Workqueue: rdma_cm cma_work_handler + Call Trace: + __dump_stack lib/dump_stack.c:77 [inline] + dump_stack+0xbe/0xf9 lib/dump_stack.c:118 + print_address_description.constprop.0+0x3e/0×60 mm/kasan/report.c:385 + __kasan_report mm/kasan/report.c:545 [inline] + kasan_report.cold+0x1f/0×37 mm/kasan/report.c:562 + ucma_create_uevent+0x2dd/0×3f0 drivers/infiniband/core/ucma.c:272 + ucma_event_handler+0xb7/0×3c0 drivers/infiniband/core/ucma.c:349 + cma_cm_event_handler+0x5d/0×1c0 drivers/infiniband/core/cma.c:1977 + cma_work_handler+0xfa/0×190 drivers/infiniband/core/cma.c:2718 + process_one_work+0x54c/0×930 kernel/workqueue.c:2272 + worker_thread+0x82/0×830 kernel/workqueue.c:2418 + kthread+0x1ca/0×220 kernel/kthread.c:292 + ret_from_fork+0x1f/0×30 arch/x86/entry/entry_64.S:296 + + Allocated by task 359: + kasan_save_stack+0x1b/0×40 mm/kasan/common.c:48 + kasan_set_track mm/kasan/common.c:56 [inline] + __kasan_kmalloc mm/kasan/common.c:461 [inline] + __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:434 + kmalloc include/linux/slab.h:552 [inline] + kzalloc include/linux/slab.h:664 [inline] + ucma_process_join+0x16e/0×3f0 drivers/infiniband/core/ucma.c:1453 + ucma_join_multicast+0xda/0×140 drivers/infiniband/core/ucma.c:1538 + ucma_write+0x1f7/0×280 drivers/infiniband/core/ucma.c:1724 + vfs_write fs/read_write.c:603 [inline] + vfs_write+0x191/0×4c0 fs/read_write.c:585 + ksys_write+0x1a1/0×1e0 fs/read_write.c:658 + do_syscall_64+0x2d/0×40 arch/x86/entry/common.c:46 + entry_SYSCALL_64_after_hwframe+0x44/0xa9 + + Freed by task 359: + kasan_save_stack+0x1b/0×40 mm/kasan/common.c:48 + kasan_set_track+0x1c/0×30 mm/kasan/common.c:56 + kasan_set_free_info+0x1b/0×30 mm/kasan/generic.c:355 + __kasan_slab_free+0x112/0×160 mm/kasan/common.c:422 + slab_free_hook mm/slub.c:1544 [inline] + slab_free_freelist_hook mm/slub.c:1577 [inline] + slab_free mm/slub.c:3142 [inline] + kfree+0xb3/0×3e0 mm/slub.c:4124 + ucma_process_join+0x22d/0×3f0 drivers/infiniband/core/ucma.c:1497 + ucma_join_multicast+0xda/0×140 drivers/infiniband/core/ucma.c:1538 + ucma_write+0x1f7/0×280 drivers/infiniband/core/ucma.c:1724 + vfs_write fs/read_write.c:603 [inline] + vfs_write+0x191/0×4c0 fs/read_write.c:585 + ksys_write+0x1a1/0×1e0 fs/read_write.c:658 + do_syscall_64+0x2d/0×40 arch/x86/entry/common.c:46 + entry_SYSCALL_64_after_hwframe+0x44/0xa9 + The buggy address belongs to the object at ffff88810b3ad100 + which belongs to the cache kmalloc-192 of size 192 + The buggy address is located 16 bytes inside of + 192-byte region [ffff88810b3ad100, ffff88810b3ad1c0) + +Fixes: b5de0c60cc30 ("RDMA/cma: Fix use after free race in roce multicast join") +Link: https://lore.kernel.org/r/20210211090517.1278415-1-leon@kernel.org +Reported-by: Amit Matityahu +Signed-off-by: Avihai Horon +Signed-off-by: Leon Romanovsky +Signed-off-by: Jason Gunthorpe +Acked-by: Thomas Bogendoerfer +--- + drivers/infiniband/core/cma.c | 70 ++++++++++++++++++++++++------------------ + 1 file changed, 41 insertions(+), 29 deletions(-) + +--- a/drivers/infiniband/core/cma.c ++++ b/drivers/infiniband/core/cma.c +@@ -348,7 +348,13 @@ struct ib_device *cma_get_ib_dev(struct + + struct cma_multicast { + struct rdma_id_private *id_priv; +- struct ib_sa_multicast *sa_mc; ++ union { ++ struct ib_sa_multicast *sa_mc; ++ struct { ++ struct work_struct work; ++ struct rdma_cm_event event; ++ } iboe_join; ++ }; + struct list_head list; + void *context; + struct sockaddr_storage addr; +@@ -1787,6 +1793,8 @@ static void destroy_mc(struct rdma_id_pr + cma_igmp_send(ndev, &mgid, false); + dev_put(ndev); + } ++ ++ cancel_work_sync(&mc->iboe_join.work); + } + kfree(mc); + } +@@ -2650,6 +2658,28 @@ static int cma_query_ib_route(struct rdm + return (id_priv->query_id < 0) ? id_priv->query_id : 0; + } + ++static void cma_iboe_join_work_handler(struct work_struct *work) ++{ ++ struct cma_multicast *mc = ++ container_of(work, struct cma_multicast, iboe_join.work); ++ struct rdma_cm_event *event = &mc->iboe_join.event; ++ struct rdma_id_private *id_priv = mc->id_priv; ++ int ret; ++ ++ mutex_lock(&id_priv->handler_mutex); ++ if (READ_ONCE(id_priv->state) == RDMA_CM_DESTROYING || ++ READ_ONCE(id_priv->state) == RDMA_CM_DEVICE_REMOVAL) ++ goto out_unlock; ++ ++ ret = cma_cm_event_handler(id_priv, event); ++ WARN_ON(ret); ++ ++out_unlock: ++ mutex_unlock(&id_priv->handler_mutex); ++ if (event->event == RDMA_CM_EVENT_MULTICAST_JOIN) ++ rdma_destroy_ah_attr(&event->param.ud.ah_attr); ++} ++ + static void cma_work_handler(struct work_struct *_work) + { + struct cma_work *work = container_of(_work, struct cma_work, work); +@@ -4431,10 +4461,7 @@ static int cma_ib_mc_handler(int status, + cma_make_mc_event(status, id_priv, multicast, &event, mc); + ret = cma_cm_event_handler(id_priv, &event); + rdma_destroy_ah_attr(&event.param.ud.ah_attr); +- if (ret) { +- destroy_id_handler_unlock(id_priv); +- return 0; +- } ++ WARN_ON(ret); + + out: + mutex_unlock(&id_priv->handler_mutex); +@@ -4557,7 +4584,6 @@ static void cma_iboe_set_mgid(struct soc + static int cma_iboe_join_multicast(struct rdma_id_private *id_priv, + struct cma_multicast *mc) + { +- struct cma_work *work; + struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr; + int err = 0; + struct sockaddr *addr = (struct sockaddr *)&mc->addr; +@@ -4571,10 +4597,6 @@ static int cma_iboe_join_multicast(struc + if (cma_zero_addr(addr)) + return -EINVAL; + +- work = kzalloc(sizeof *work, GFP_KERNEL); +- if (!work) +- return -ENOMEM; +- + gid_type = id_priv->cma_dev->default_gid_type[id_priv->id.port_num - + rdma_start_port(id_priv->cma_dev->device)]; + cma_iboe_set_mgid(addr, &ib.rec.mgid, gid_type); +@@ -4585,10 +4607,9 @@ static int cma_iboe_join_multicast(struc + + if (dev_addr->bound_dev_if) + ndev = dev_get_by_index(dev_addr->net, dev_addr->bound_dev_if); +- if (!ndev) { +- err = -ENODEV; +- goto err_free; +- } ++ if (!ndev) ++ return -ENODEV; ++ + ib.rec.rate = iboe_get_rate(ndev); + ib.rec.hop_limit = 1; + ib.rec.mtu = iboe_get_mtu(ndev->mtu); +@@ -4606,24 +4627,15 @@ static int cma_iboe_join_multicast(struc + err = -ENOTSUPP; + } + dev_put(ndev); +- if (err || !ib.rec.mtu) { +- if (!err) +- err = -EINVAL; +- goto err_free; +- } ++ if (err || !ib.rec.mtu) ++ return err ?: -EINVAL; ++ + rdma_ip2gid((struct sockaddr *)&id_priv->id.route.addr.src_addr, + &ib.rec.port_gid); +- work->id = id_priv; +- INIT_WORK(&work->work, cma_work_handler); +- cma_make_mc_event(0, id_priv, &ib, &work->event, mc); +- /* Balances with cma_id_put() in cma_work_handler */ +- cma_id_get(id_priv); +- queue_work(cma_wq, &work->work); ++ INIT_WORK(&mc->iboe_join.work, cma_iboe_join_work_handler); ++ cma_make_mc_event(0, id_priv, &ib, &mc->iboe_join.event, mc); ++ queue_work(cma_wq, &mc->iboe_join.work); + return 0; +- +-err_free: +- kfree(work); +- return err; + } + + int rdma_join_multicast(struct rdma_cm_id *id, struct sockaddr *addr, diff --git a/patches.suse/Revert-net-bcmgenet-remove-unused-function-in-bcmgen.patch b/patches.suse/Revert-net-bcmgenet-remove-unused-function-in-bcmgen.patch new file mode 100644 index 0000000..3b838c0 --- /dev/null +++ b/patches.suse/Revert-net-bcmgenet-remove-unused-function-in-bcmgen.patch @@ -0,0 +1,158 @@ +From bb635be2e34831433f533ce4f87f8d4eb67ff684 Mon Sep 17 00:00:00 2001 +From: Doug Berger +Date: Wed, 29 Apr 2020 13:02:03 -0700 +Subject: [PATCH 4/9] Revert "net: bcmgenet: remove unused function in + bcmgenet.c" +Git-commit: 14da1510fedc2d72ca81344a0f62939e0a1bc648 +Patch-mainline: v5.8-rc1 +References: git-fixes + +This reverts commit e2072600a24161b7ddcfb26814f69f5fbc8ef85a. + +This commit restores the previous implementation of Hardware Filter +Block functions to the file for use in subsequent commits. + +Signed-off-by: Doug Berger +Acked-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/broadcom/genet/bcmgenet.c | 122 +++++++++++++++++++++++++ + 1 file changed, 122 insertions(+) + +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c +index c8f49247d500..f00d480d8303 100644 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c +@@ -2819,6 +2819,128 @@ static void bcmgenet_enable_dma(struct bcmgenet_priv *priv, u32 dma_ctrl) + bcmgenet_tdma_writel(priv, reg, DMA_CTRL); + } + ++static bool bcmgenet_hfb_is_filter_enabled(struct bcmgenet_priv *priv, ++ u32 f_index) ++{ ++ u32 offset; ++ u32 reg; ++ ++ offset = HFB_FLT_ENABLE_V3PLUS + (f_index < 32) * sizeof(u32); ++ reg = bcmgenet_hfb_reg_readl(priv, offset); ++ return !!(reg & (1 << (f_index % 32))); ++} ++ ++static void bcmgenet_hfb_enable_filter(struct bcmgenet_priv *priv, u32 f_index) ++{ ++ u32 offset; ++ u32 reg; ++ ++ offset = HFB_FLT_ENABLE_V3PLUS + (f_index < 32) * sizeof(u32); ++ reg = bcmgenet_hfb_reg_readl(priv, offset); ++ reg |= (1 << (f_index % 32)); ++ bcmgenet_hfb_reg_writel(priv, reg, offset); ++} ++ ++static void bcmgenet_hfb_set_filter_rx_queue_mapping(struct bcmgenet_priv *priv, ++ u32 f_index, u32 rx_queue) ++{ ++ u32 offset; ++ u32 reg; ++ ++ offset = f_index / 8; ++ reg = bcmgenet_rdma_readl(priv, DMA_INDEX2RING_0 + offset); ++ reg &= ~(0xF << (4 * (f_index % 8))); ++ reg |= ((rx_queue & 0xF) << (4 * (f_index % 8))); ++ bcmgenet_rdma_writel(priv, reg, DMA_INDEX2RING_0 + offset); ++} ++ ++static void bcmgenet_hfb_set_filter_length(struct bcmgenet_priv *priv, ++ u32 f_index, u32 f_length) ++{ ++ u32 offset; ++ u32 reg; ++ ++ offset = HFB_FLT_LEN_V3PLUS + ++ ((priv->hw_params->hfb_filter_cnt - 1 - f_index) / 4) * ++ sizeof(u32); ++ reg = bcmgenet_hfb_reg_readl(priv, offset); ++ reg &= ~(0xFF << (8 * (f_index % 4))); ++ reg |= ((f_length & 0xFF) << (8 * (f_index % 4))); ++ bcmgenet_hfb_reg_writel(priv, reg, offset); ++} ++ ++static int bcmgenet_hfb_find_unused_filter(struct bcmgenet_priv *priv) ++{ ++ u32 f_index; ++ ++ for (f_index = 0; f_index < priv->hw_params->hfb_filter_cnt; f_index++) ++ if (!bcmgenet_hfb_is_filter_enabled(priv, f_index)) ++ return f_index; ++ ++ return -ENOMEM; ++} ++ ++/* bcmgenet_hfb_add_filter ++ * ++ * Add new filter to Hardware Filter Block to match and direct Rx traffic to ++ * desired Rx queue. ++ * ++ * f_data is an array of unsigned 32-bit integers where each 32-bit integer ++ * provides filter data for 2 bytes (4 nibbles) of Rx frame: ++ * ++ * bits 31:20 - unused ++ * bit 19 - nibble 0 match enable ++ * bit 18 - nibble 1 match enable ++ * bit 17 - nibble 2 match enable ++ * bit 16 - nibble 3 match enable ++ * bits 15:12 - nibble 0 data ++ * bits 11:8 - nibble 1 data ++ * bits 7:4 - nibble 2 data ++ * bits 3:0 - nibble 3 data ++ * ++ * Example: ++ * In order to match: ++ * - Ethernet frame type = 0x0800 (IP) ++ * - IP version field = 4 ++ * - IP protocol field = 0x11 (UDP) ++ * ++ * The following filter is needed: ++ * u32 hfb_filter_ipv4_udp[] = { ++ * Rx frame offset 0x00: 0x00000000, 0x00000000, 0x00000000, 0x00000000, ++ * Rx frame offset 0x08: 0x00000000, 0x00000000, 0x000F0800, 0x00084000, ++ * Rx frame offset 0x10: 0x00000000, 0x00000000, 0x00000000, 0x00030011, ++ * }; ++ * ++ * To add the filter to HFB and direct the traffic to Rx queue 0, call: ++ * bcmgenet_hfb_add_filter(priv, hfb_filter_ipv4_udp, ++ * ARRAY_SIZE(hfb_filter_ipv4_udp), 0); ++ */ ++int bcmgenet_hfb_add_filter(struct bcmgenet_priv *priv, u32 *f_data, ++ u32 f_length, u32 rx_queue) ++{ ++ int f_index; ++ u32 i; ++ ++ f_index = bcmgenet_hfb_find_unused_filter(priv); ++ if (f_index < 0) ++ return -ENOMEM; ++ ++ if (f_length > priv->hw_params->hfb_filter_size) ++ return -EINVAL; ++ ++ for (i = 0; i < f_length; i++) ++ bcmgenet_hfb_writel(priv, f_data[i], ++ (f_index * priv->hw_params->hfb_filter_size + i) * ++ sizeof(u32)); ++ ++ bcmgenet_hfb_set_filter_length(priv, f_index, 2 * f_length); ++ bcmgenet_hfb_set_filter_rx_queue_mapping(priv, f_index, rx_queue); ++ bcmgenet_hfb_enable_filter(priv, f_index); ++ bcmgenet_hfb_reg_writel(priv, 0x1, HFB_CTRL); ++ ++ return 0; ++} ++ + /* bcmgenet_hfb_clear + * + * Clear Hardware Filter Block and disable all filtering. +-- +2.16.4 + diff --git a/patches.suse/USB-quirks-sort-quirk-entries.patch b/patches.suse/USB-quirks-sort-quirk-entries.patch new file mode 100644 index 0000000..30b749a --- /dev/null +++ b/patches.suse/USB-quirks-sort-quirk-entries.patch @@ -0,0 +1,48 @@ +From 43861d29c0810a70792bf69d37482efb7bb6677d Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 10 Feb 2021 12:17:46 +0100 +Subject: [PATCH] USB: quirks: sort quirk entries +Git-commit: 43861d29c0810a70792bf69d37482efb7bb6677d +Patch-mainline: v5.12-rc1 +References: git-fixes + +Move the last entry to its proper place to maintain the VID/PID sort +order. + +Cc: stable@vger.kernel.org +Signed-off-by: Johan Hovold +Link: https://lore.kernel.org/r/20210210111746.13360-1-johan@kernel.org +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/core/quirks.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c +index 1b4eb7046b07..66a0dc618dfc 100644 +--- a/drivers/usb/core/quirks.c ++++ b/drivers/usb/core/quirks.c +@@ -415,6 +415,9 @@ static const struct usb_device_id usb_quirk_list[] = { + { USB_DEVICE(0x10d6, 0x2200), .driver_info = + USB_QUIRK_STRING_FETCH_255 }, + ++ /* novation SoundControl XL */ ++ { USB_DEVICE(0x1235, 0x0061), .driver_info = USB_QUIRK_RESET_RESUME }, ++ + /* Huawei 4G LTE module */ + { USB_DEVICE(0x12d1, 0x15bb), .driver_info = + USB_QUIRK_DISCONNECT_SUSPEND }, +@@ -495,9 +498,6 @@ static const struct usb_device_id usb_quirk_list[] = { + /* INTEL VALUE SSD */ + { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, + +- /* novation SoundControl XL */ +- { USB_DEVICE(0x1235, 0x0061), .driver_info = USB_QUIRK_RESET_RESUME }, +- + { } /* terminating entry must be last */ + }; + +-- +2.26.2 + diff --git a/patches.suse/USB-serial-ftdi_sio-fix-FTX-sub-integer-prescaler.patch b/patches.suse/USB-serial-ftdi_sio-fix-FTX-sub-integer-prescaler.patch new file mode 100644 index 0000000..2c62878 --- /dev/null +++ b/patches.suse/USB-serial-ftdi_sio-fix-FTX-sub-integer-prescaler.patch @@ -0,0 +1,42 @@ +From 528222d0c8ce93e435a95cd1e476b60409dd5381 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Tue, 26 Jan 2021 14:59:17 +0100 +Subject: [PATCH] USB: serial: ftdi_sio: fix FTX sub-integer prescaler +Git-commit: 528222d0c8ce93e435a95cd1e476b60409dd5381 +Patch-mainline: v5.12-rc1 +References: git-fixes + +The most-significant bit of the sub-integer-prescaler index is set in +the high byte of the baudrate request wIndex also for FTX devices. + +This fixes rates like 1152000 which got mapped to 1.2 MBd. + +Reported-by: Vladimir +Link: https://bugzilla.kernel.org/show_bug.cgi?id=210351 +Cc: stable@vger.kernel.org +Signed-off-by: Johan Hovold +Acked-by: Takashi Iwai + +--- + drivers/usb/serial/ftdi_sio.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c +index 94398f89e600..4168801b9595 100644 +--- a/drivers/usb/serial/ftdi_sio.c ++++ b/drivers/usb/serial/ftdi_sio.c +@@ -1386,8 +1386,9 @@ static int change_speed(struct tty_struct *tty, struct usb_serial_port *port) + index_value = get_ftdi_divisor(tty, port); + value = (u16)index_value; + index = (u16)(index_value >> 16); +- if ((priv->chip_type == FT2232C) || (priv->chip_type == FT2232H) || +- (priv->chip_type == FT4232H) || (priv->chip_type == FT232H)) { ++ if (priv->chip_type == FT2232C || priv->chip_type == FT2232H || ++ priv->chip_type == FT4232H || priv->chip_type == FT232H || ++ priv->chip_type == FTX) { + /* Probably the BM type needs the MSB of the encoded fractional + * divider also moved like for the chips above. Any infos? */ + index = (u16)((index << 8) | priv->interface); +-- +2.26.2 + diff --git a/patches.suse/USB-serial-option-update-interface-mapping-for-ZTE-P.patch b/patches.suse/USB-serial-option-update-interface-mapping-for-ZTE-P.patch new file mode 100644 index 0000000..3766249 --- /dev/null +++ b/patches.suse/USB-serial-option-update-interface-mapping-for-ZTE-P.patch @@ -0,0 +1,83 @@ +From 6420a569504e212d618d4a4736e2c59ed80a8478 Mon Sep 17 00:00:00 2001 +From: Lech Perczak +Date: Sun, 7 Feb 2021 01:54:43 +0100 +Subject: [PATCH] USB: serial: option: update interface mapping for ZTE P685M +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 6420a569504e212d618d4a4736e2c59ed80a8478 +Patch-mainline: v5.12-rc1 +References: git-fixes + +This patch prepares for qmi_wwan driver support for the device. +Previously "option" driver mapped itself to interfaces 0 and 3 (matching +ff/ff/ff), while interface 3 is in fact a QMI port. +Interfaces 1 and 2 (matching ff/00/00) expose AT commands, +and weren't supported previously at all. +Without this patch, a possible conflict would exist if device ID was +added to qmi_wwan driver for interface 3. + +Update and simplify device ID to match interfaces 0-2 directly, +to expose QCDM (0), PCUI (1), and modem (2) ports and avoid conflict +with QMI (3), and ADB (4). + +The modem is used inside ZTE MF283+ router and carriers identify it as +such. +Interface mapping is: +0: QCDM, 1: AT (PCUI), 2: AT (Modem), 3: QMI, 4: ADB + +T: Bus=02 Lev=02 Prnt=02 Port=05 Cnt=01 Dev#= 3 Spd=480 MxCh= 0 +D: Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 +P: Vendor=19d2 ProdID=1275 Rev=f0.00 +S: Manufacturer=ZTE,Incorporated +S: Product=ZTE Technologies MSM +S: SerialNumber=P685M510ZTED0000CP&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&0 +C:* #Ifs= 5 Cfg#= 1 Atr=a0 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=0ms +I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option +E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option +E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan +E: Ad=87(I) Atr=03(Int.) MxPS= 8 Ivl=32ms +E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) +E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms + +Cc: Johan Hovold +Cc: Bjørn Mork +Signed-off-by: Lech Perczak +Link: https://lore.kernel.org/r/20210207005443.12936-1-lech.perczak@gmail.com +Cc: stable@vger.kernel.org +Signed-off-by: Johan Hovold +Acked-by: Takashi Iwai + +--- + drivers/usb/serial/option.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c +index 3fe959104311..6716dfcf2610 100644 +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -1567,7 +1567,8 @@ static const struct usb_device_id option_ids[] = { + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1272, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1273, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1274, 0xff, 0xff, 0xff) }, +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1275, 0xff, 0xff, 0xff) }, ++ { USB_DEVICE(ZTE_VENDOR_ID, 0x1275), /* ZTE P685M */ ++ .driver_info = RSVD(3) | RSVD(4) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1276, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1277, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1278, 0xff, 0xff, 0xff) }, +-- +2.26.2 + diff --git a/patches.suse/VMCI-Use-set_page_dirty_lock-when-unregistering-gues.patch b/patches.suse/VMCI-Use-set_page_dirty_lock-when-unregistering-gues.patch new file mode 100644 index 0000000..1887445 --- /dev/null +++ b/patches.suse/VMCI-Use-set_page_dirty_lock-when-unregistering-gues.patch @@ -0,0 +1,43 @@ +From 5a16c535409f8dcb7568e20737309e3027ae3e49 Mon Sep 17 00:00:00 2001 +From: Jorgen Hansen +Date: Wed, 20 Jan 2021 08:32:40 -0800 +Subject: [PATCH] VMCI: Use set_page_dirty_lock() when unregistering guest memory +Git-commit: 5a16c535409f8dcb7568e20737309e3027ae3e49 +Patch-mainline: v5.12-rc1 +References: git-fixes + +When the VMCI host support releases guest memory in the case where +the VM was killed, the pinned guest pages aren't locked. Use +set_page_dirty_lock() instead of set_page_dirty(). + +Testing done: Killed VM while having an active VMCI based vSocket +connection and observed warning from ext4. With this fix, no +warning was observed. Ran various vSocket tests without issues. + +Fixes: 06164d2b72aa ("VMCI: queue pairs implementation.") +Reviewed-by: Vishnu Dasa +Signed-off-by: Jorgen Hansen +Link: https://lore.kernel.org/r/1611160360-30299-1-git-send-email-jhansen@vmware.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/misc/vmw_vmci/vmci_queue_pair.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c +index a3691c16d45a..525ef96d3a07 100644 +--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c ++++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c +@@ -630,7 +630,7 @@ static void qp_release_pages(struct page **pages, + + for (i = 0; i < num_pages; i++) { + if (dirty) +- set_page_dirty(pages[i]); ++ set_page_dirty_lock(pages[i]); + + put_page(pages[i]); + pages[i] = NULL; +-- +2.26.2 + diff --git a/patches.suse/bnxt_en-Fix-devlink-info-s-stored-fw.psid-version-fo.patch b/patches.suse/bnxt_en-Fix-devlink-info-s-stored-fw.psid-version-fo.patch new file mode 100644 index 0000000..58c4167 --- /dev/null +++ b/patches.suse/bnxt_en-Fix-devlink-info-s-stored-fw.psid-version-fo.patch @@ -0,0 +1,35 @@ +From: Vasundhara Volam +Date: Thu, 11 Feb 2021 02:24:24 -0500 +Subject: bnxt_en: Fix devlink info's stored fw.psid version format. +Patch-mainline: v5.12-rc1 +Git-commit: db28b6c77f4050f62599267a886b61fbd6504633 +References: jsc#SLE-16649 + +The running fw.psid version is in decimal format but the stored +fw.psid is in hex format. This can mislead the user to reset the +NIC to activate the stored version to become the running version. + +Fix it to display the stored fw.psid in decimal format. + +Fixes: 1388875b3916 ("bnxt_en: Add stored FW version info to devlink info_get cb.") +Signed-off-by: Vasundhara Volam +Signed-off-by: Michael Chan +Signed-off-by: David S. Miller +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +@@ -474,8 +474,8 @@ static int bnxt_dl_info_get(struct devli + if (BNXT_PF(bp) && !bnxt_hwrm_get_nvm_cfg_ver(bp, &nvm_cfg_ver)) { + u32 ver = nvm_cfg_ver.vu32; + +- sprintf(buf, "%X.%X.%X", (ver >> 16) & 0xF, (ver >> 8) & 0xF, +- ver & 0xF); ++ sprintf(buf, "%d.%d.%d", (ver >> 16) & 0xf, (ver >> 8) & 0xf, ++ ver & 0xf); + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_STORED, + DEVLINK_INFO_VERSION_GENERIC_FW_PSID, + buf); diff --git a/patches.suse/bpf-Add-bpf_patch_call_args-prototype-to-include-lin.patch b/patches.suse/bpf-Add-bpf_patch_call_args-prototype-to-include-lin.patch new file mode 100644 index 0000000..1c62a65 --- /dev/null +++ b/patches.suse/bpf-Add-bpf_patch_call_args-prototype-to-include-lin.patch @@ -0,0 +1,35 @@ +From: Andrii Nakryiko +Date: Mon, 11 Jan 2021 23:55:14 -0800 +Subject: bpf: Add bpf_patch_call_args prototype to include/linux/bpf.h +Patch-mainline: v5.12-rc1 +Git-commit: a643bff752dcf72a07e1b2ab2f8587e4f51118be +References: bsc#1177028 + +Add bpf_patch_call_args() prototype. This function is called from BPF verifier +and only if CONFIG_BPF_JIT_ALWAYS_ON is not defined. This fixes compiler +warning about missing prototype in some kernel configurations. + +Fixes: 1ea47e01ad6e ("bpf: add support for bpf_call to interpreter") +Reported-by: kernel test robot +Signed-off-by: Andrii Nakryiko +Signed-off-by: Alexei Starovoitov +Acked-by: Yonghong Song +Link: https://lore.kernel.org/bpf/20210112075520.4103414-2-andrii@kernel.org +Acked-by: Gary Lin +--- + include/linux/bpf.h | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/include/linux/bpf.h ++++ b/include/linux/bpf.h +@@ -1290,7 +1290,10 @@ static inline void bpf_long_memcpy(void + /* verify correctness of eBPF program */ + int bpf_check(struct bpf_prog **fp, union bpf_attr *attr, + union bpf_attr __user *uattr); ++ ++#ifndef CONFIG_BPF_JIT_ALWAYS_ON + void bpf_patch_call_args(struct bpf_insn *insn, u32 stack_depth); ++#endif + + /* Map specifics */ + struct xdp_buff; diff --git a/patches.suse/bpf-Clear-subreg_def-for-global-function-return-valu.patch b/patches.suse/bpf-Clear-subreg_def-for-global-function-return-valu.patch new file mode 100644 index 0000000..d9d6c91 --- /dev/null +++ b/patches.suse/bpf-Clear-subreg_def-for-global-function-return-valu.patch @@ -0,0 +1,52 @@ +From: Ilya Leoshkevich +Date: Fri, 12 Feb 2021 05:04:08 +0100 +Subject: bpf: Clear subreg_def for global function return values +Patch-mainline: v5.12-rc1 +Git-commit: 45159b27637b0fef6d5ddb86fc7c46b13c77960f +References: bsc#1177028 + +test_global_func4 fails on s390 as reported by Yauheni in [1]. + +The immediate problem is that the zext code includes the instruction, +whose result needs to be zero-extended, into the zero-extension +patchlet, and if this instruction happens to be a branch, then its +delta is not adjusted. As a result, the verifier rejects the program +later. + +However, according to [2], as far as the verifier's algorithm is +concerned and as specified by the insn_no_def() function, branching +insns do not define anything. This includes call insns, even though +one might argue that they define %r0. + +This means that the real problem is that zero extension kicks in at +all. This happens because clear_caller_saved_regs() sets BPF_REG_0's +subreg_def after global function calls. This can be fixed in many +ways; this patch mimics what helper function call handling already +does. + + [1] https://lore.kernel.org/bpf/20200903140542.156624-1-yauheni.kaliuta@redhat.com/ + [2] https://lore.kernel.org/bpf/CAADnVQ+2RPKcftZw8d+B1UwB35cpBhpF5u3OocNh90D9pETPwg@mail.gmail.com/ + +Fixes: 51c39bb1d5d1 ("bpf: Introduce function-by-function verification") +Reported-by: Yauheni Kaliuta +Signed-off-by: Ilya Leoshkevich +Signed-off-by: Daniel Borkmann +Link: https://lore.kernel.org/bpf/20210212040408.90109-1-iii@linux.ibm.com +Acked-by: Gary Lin +--- + kernel/bpf/verifier.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/kernel/bpf/verifier.c ++++ b/kernel/bpf/verifier.c +@@ -4580,8 +4580,9 @@ static int check_func_call(struct bpf_ve + subprog); + clear_caller_saved_regs(env, caller->regs); + +- /* All global functions return SCALAR_VALUE */ ++ /* All global functions return a 64-bit SCALAR_VALUE */ + mark_reg_unknown(env, caller->regs, BPF_REG_0); ++ caller->regs[BPF_REG_0].subreg_def = DEF_NOT_SUBREG; + + /* continue with next insn after call */ + return 0; diff --git a/patches.suse/bpf-Fix-32-bit-src-register-truncation-on-div-mod.patch b/patches.suse/bpf-Fix-32-bit-src-register-truncation-on-div-mod.patch new file mode 100644 index 0000000..ffb7fb8 --- /dev/null +++ b/patches.suse/bpf-Fix-32-bit-src-register-truncation-on-div-mod.patch @@ -0,0 +1,126 @@ +From: Daniel Borkmann +Date: Tue, 9 Feb 2021 18:46:10 +0000 +Subject: bpf: Fix 32 bit src register truncation on div/mod +Patch-mainline: v5.11 +Git-commit: e88b2c6e5a4d9ce30d75391e4d950da74bb2bd90 +References: bsc#1177028 + +While reviewing a different fix, John and I noticed an oddity in one of the +BPF program dumps that stood out, for example: + + # bpftool p d x i 13 + 0: (b7) r0 = 808464450 + 1: (b4) w4 = 808464432 + 2: (bc) w0 = w0 + 3: (15) if r0 == 0x0 goto pc+1 + 4: (9c) w4 %= w0 + [...] + +In line 2 we noticed that the mov32 would 32 bit truncate the original src +register for the div/mod operation. While for the two operations the dst +register is typically marked unknown e.g. from adjust_scalar_min_max_vals() +the src register is not, and thus verifier keeps tracking original bounds, +simplified: + + 0: R1=ctx(id=0,off=0,imm=0) R10=fp0 + 0: (b7) r0 = -1 + 1: R0_w=invP-1 R1=ctx(id=0,off=0,imm=0) R10=fp0 + 1: (b7) r1 = -1 + 2: R0_w=invP-1 R1_w=invP-1 R10=fp0 + 2: (3c) w0 /= w1 + 3: R0_w=invP(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R1_w=invP-1 R10=fp0 + 3: (77) r1 >>= 32 + 4: R0_w=invP(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R1_w=invP4294967295 R10=fp0 + 4: (bf) r0 = r1 + 5: R0_w=invP4294967295 R1_w=invP4294967295 R10=fp0 + 5: (95) exit + processed 6 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0 + +Runtime result of r0 at exit is 0 instead of expected -1. Remove the +verifier mov32 src rewrite in div/mod and replace it with a jmp32 test +instead. After the fix, we result in the following code generation when +having dividend r1 and divisor r6: + + div, 64 bit: div, 32 bit: + + 0: (b7) r6 = 8 0: (b7) r6 = 8 + 1: (b7) r1 = 8 1: (b7) r1 = 8 + 2: (55) if r6 != 0x0 goto pc+2 2: (56) if w6 != 0x0 goto pc+2 + 3: (ac) w1 ^= w1 3: (ac) w1 ^= w1 + 4: (05) goto pc+1 4: (05) goto pc+1 + 5: (3f) r1 /= r6 5: (3c) w1 /= w6 + 6: (b7) r0 = 0 6: (b7) r0 = 0 + 7: (95) exit 7: (95) exit + + mod, 64 bit: mod, 32 bit: + + 0: (b7) r6 = 8 0: (b7) r6 = 8 + 1: (b7) r1 = 8 1: (b7) r1 = 8 + 2: (15) if r6 == 0x0 goto pc+1 2: (16) if w6 == 0x0 goto pc+1 + 3: (9f) r1 %= r6 3: (9c) w1 %= w6 + 4: (b7) r0 = 0 4: (b7) r0 = 0 + 5: (95) exit 5: (95) exit + +x86 in particular can throw a 'divide error' exception for div +instruction not only for divisor being zero, but also for the case +when the quotient is too large for the designated register. For the +edx:eax and rdx:rax dividend pair it is not an issue in x86 BPF JIT +since we always zero edx (rdx). Hence really the only protection +needed is against divisor being zero. + +Fixes: 68fda450a7df ("bpf: fix 32-bit divide by zero") +Co-developed-by: John Fastabend +Signed-off-by: John Fastabend +Signed-off-by: Daniel Borkmann +Acked-by: Alexei Starovoitov +Acked-by: Gary Lin +--- + kernel/bpf/verifier.c | 28 +++++++++++++--------------- + 1 file changed, 13 insertions(+), 15 deletions(-) + +--- a/kernel/bpf/verifier.c ++++ b/kernel/bpf/verifier.c +@@ -10343,30 +10343,28 @@ static int fixup_bpf_calls(struct bpf_ve + insn->code == (BPF_ALU | BPF_MOD | BPF_X) || + insn->code == (BPF_ALU | BPF_DIV | BPF_X)) { + bool is64 = BPF_CLASS(insn->code) == BPF_ALU64; +- struct bpf_insn mask_and_div[] = { +- BPF_MOV32_REG(insn->src_reg, insn->src_reg), ++ bool isdiv = BPF_OP(insn->code) == BPF_DIV; ++ struct bpf_insn *patchlet; ++ struct bpf_insn chk_and_div[] = { + /* Rx div 0 -> 0 */ +- BPF_JMP_IMM(BPF_JNE, insn->src_reg, 0, 2), ++ BPF_RAW_INSN((is64 ? BPF_JMP : BPF_JMP32) | ++ BPF_JNE | BPF_K, insn->src_reg, ++ 0, 2, 0), + BPF_ALU32_REG(BPF_XOR, insn->dst_reg, insn->dst_reg), + BPF_JMP_IMM(BPF_JA, 0, 0, 1), + *insn, + }; +- struct bpf_insn mask_and_mod[] = { +- BPF_MOV32_REG(insn->src_reg, insn->src_reg), ++ struct bpf_insn chk_and_mod[] = { + /* Rx mod 0 -> Rx */ +- BPF_JMP_IMM(BPF_JEQ, insn->src_reg, 0, 1), ++ BPF_RAW_INSN((is64 ? BPF_JMP : BPF_JMP32) | ++ BPF_JEQ | BPF_K, insn->src_reg, ++ 0, 1, 0), + *insn, + }; +- struct bpf_insn *patchlet; + +- if (insn->code == (BPF_ALU64 | BPF_DIV | BPF_X) || +- insn->code == (BPF_ALU | BPF_DIV | BPF_X)) { +- patchlet = mask_and_div + (is64 ? 1 : 0); +- cnt = ARRAY_SIZE(mask_and_div) - (is64 ? 1 : 0); +- } else { +- patchlet = mask_and_mod + (is64 ? 1 : 0); +- cnt = ARRAY_SIZE(mask_and_mod) - (is64 ? 1 : 0); +- } ++ patchlet = isdiv ? chk_and_div : chk_and_mod; ++ cnt = isdiv ? ARRAY_SIZE(chk_and_div) : ++ ARRAY_SIZE(chk_and_mod); + + new_prog = bpf_patch_insn_data(env, i + delta, patchlet, cnt); + if (!new_prog) diff --git a/patches.suse/bpf-Fix-truncation-handling-for-mod32-dst-reg-wrt-ze.patch b/patches.suse/bpf-Fix-truncation-handling-for-mod32-dst-reg-wrt-ze.patch new file mode 100644 index 0000000..00a3a5f --- /dev/null +++ b/patches.suse/bpf-Fix-truncation-handling-for-mod32-dst-reg-wrt-ze.patch @@ -0,0 +1,118 @@ +From: Daniel Borkmann +Date: Wed, 10 Feb 2021 14:14:42 +0100 +Subject: bpf: Fix truncation handling for mod32 dst reg wrt zero +Patch-mainline: v5.12-rc1 +Git-commit: 9b00f1b78809309163dda2d044d9e94a3c0248a3 +References: bsc#1177028 + +Recently noticed that when mod32 with a known src reg of 0 is performed, +then the dst register is 32-bit truncated in verifier: + + 0: R1=ctx(id=0,off=0,imm=0) R10=fp0 + 0: (b7) r0 = 0 + 1: R0_w=inv0 R1=ctx(id=0,off=0,imm=0) R10=fp0 + 1: (b7) r1 = -1 + 2: R0_w=inv0 R1_w=inv-1 R10=fp0 + 2: (b4) w2 = -1 + 3: R0_w=inv0 R1_w=inv-1 R2_w=inv4294967295 R10=fp0 + 3: (9c) w1 %= w0 + 4: R0_w=inv0 R1_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R2_w=inv4294967295 R10=fp0 + 4: (b7) r0 = 1 + 5: R0_w=inv1 R1_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R2_w=inv4294967295 R10=fp0 + 5: (1d) if r1 == r2 goto pc+1 + R0_w=inv1 R1_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R2_w=inv4294967295 R10=fp0 + 6: R0_w=inv1 R1_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R2_w=inv4294967295 R10=fp0 + 6: (b7) r0 = 2 + 7: R0_w=inv2 R1_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R2_w=inv4294967295 R10=fp0 + 7: (95) exit + 7: R0=inv1 R1=inv(id=0,umin_value=4294967295,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R2=inv4294967295 R10=fp0 + 7: (95) exit + +However, as a runtime result, we get 2 instead of 1, meaning the dst +register does not contain (u32)-1 in this case. The reason is fairly +straight forward given the 0 test leaves the dst register as-is: + + # ./bpftool p d x i 23 + 0: (b7) r0 = 0 + 1: (b7) r1 = -1 + 2: (b4) w2 = -1 + 3: (16) if w0 == 0x0 goto pc+1 + 4: (9c) w1 %= w0 + 5: (b7) r0 = 1 + 6: (1d) if r1 == r2 goto pc+1 + 7: (b7) r0 = 2 + 8: (95) exit + +This was originally not an issue given the dst register was marked as +completely unknown (aka 64 bit unknown). However, after 468f6eafa6c4 +("bpf: fix 32-bit ALU op verification") the verifier casts the register +output to 32 bit, and hence it becomes 32 bit unknown. Note that for +the case where the src register is unknown, the dst register is marked +64 bit unknown. After the fix, the register is truncated by the runtime +and the test passes: + + # ./bpftool p d x i 23 + 0: (b7) r0 = 0 + 1: (b7) r1 = -1 + 2: (b4) w2 = -1 + 3: (16) if w0 == 0x0 goto pc+2 + 4: (9c) w1 %= w0 + 5: (05) goto pc+1 + 6: (bc) w1 = w1 + 7: (b7) r0 = 1 + 8: (1d) if r1 == r2 goto pc+1 + 9: (b7) r0 = 2 + 10: (95) exit + +Semantics also match with {R,W}x mod{64,32} 0 -> {R,W}x. Invalid div +has always been {R,W}x div{64,32} 0 -> 0. Rewrites are as follows: + + mod32: mod64: + + (16) if w0 == 0x0 goto pc+2 (15) if r0 == 0x0 goto pc+1 + (9c) w1 %= w0 (9f) r1 %= r0 + (05) goto pc+1 + (bc) w1 = w1 + +Fixes: 468f6eafa6c4 ("bpf: fix 32-bit ALU op verification") +Signed-off-by: Daniel Borkmann +Reviewed-by: John Fastabend +Acked-by: Alexei Starovoitov +Acked-by: Gary Lin +--- + kernel/bpf/verifier.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +--- a/kernel/bpf/verifier.c ++++ b/kernel/bpf/verifier.c +@@ -10347,7 +10347,7 @@ static int fixup_bpf_calls(struct bpf_ve + bool isdiv = BPF_OP(insn->code) == BPF_DIV; + struct bpf_insn *patchlet; + struct bpf_insn chk_and_div[] = { +- /* Rx div 0 -> 0 */ ++ /* [R,W]x div 0 -> 0 */ + BPF_RAW_INSN((is64 ? BPF_JMP : BPF_JMP32) | + BPF_JNE | BPF_K, insn->src_reg, + 0, 2, 0), +@@ -10356,16 +10356,18 @@ static int fixup_bpf_calls(struct bpf_ve + *insn, + }; + struct bpf_insn chk_and_mod[] = { +- /* Rx mod 0 -> Rx */ ++ /* [R,W]x mod 0 -> [R,W]x */ + BPF_RAW_INSN((is64 ? BPF_JMP : BPF_JMP32) | + BPF_JEQ | BPF_K, insn->src_reg, +- 0, 1, 0), ++ 0, 1 + (is64 ? 0 : 1), 0), + *insn, ++ BPF_JMP_IMM(BPF_JA, 0, 0, 1), ++ BPF_MOV32_REG(insn->dst_reg, insn->dst_reg), + }; + + patchlet = isdiv ? chk_and_div : chk_and_mod; + cnt = isdiv ? ARRAY_SIZE(chk_and_div) : +- ARRAY_SIZE(chk_and_mod); ++ ARRAY_SIZE(chk_and_mod) - (is64 ? 2 : 0); + + new_prog = bpf_patch_insn_data(env, i + delta, patchlet, cnt); + if (!new_prog) diff --git a/patches.suse/bpf-Fix-verifier-jmp32-pruning-decision-logic.patch b/patches.suse/bpf-Fix-verifier-jmp32-pruning-decision-logic.patch new file mode 100644 index 0000000..00d6f34 --- /dev/null +++ b/patches.suse/bpf-Fix-verifier-jmp32-pruning-decision-logic.patch @@ -0,0 +1,143 @@ +From: Daniel Borkmann +Date: Fri, 5 Feb 2021 20:48:21 +0100 +Subject: bpf: Fix verifier jmp32 pruning decision logic +Patch-mainline: v5.11 +Git-commit: fd675184fc7abfd1e1c52d23e8e900676b5a1c1a +References: bsc#1177028 + +Anatoly has been fuzzing with kBdysch harness and reported a hang in +one of the outcomes: + + func#0 @0 + 0: R1=ctx(id=0,off=0,imm=0) R10=fp0 + 0: (b7) r0 = 808464450 + 1: R0_w=invP808464450 R1=ctx(id=0,off=0,imm=0) R10=fp0 + 1: (b4) w4 = 808464432 + 2: R0_w=invP808464450 R1=ctx(id=0,off=0,imm=0) R4_w=invP808464432 R10=fp0 + 2: (9c) w4 %= w0 + 3: R0_w=invP808464450 R1=ctx(id=0,off=0,imm=0) R4_w=invP(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R10=fp0 + 3: (66) if w4 s> 0x30303030 goto pc+0 + R0_w=invP808464450 R1=ctx(id=0,off=0,imm=0) R4_w=invP(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff),s32_max_value=808464432) R10=fp0 + 4: R0_w=invP808464450 R1=ctx(id=0,off=0,imm=0) R4_w=invP(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff),s32_max_value=808464432) R10=fp0 + 4: (7f) r0 >>= r0 + 5: R0_w=invP(id=0) R1=ctx(id=0,off=0,imm=0) R4_w=invP(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff),s32_max_value=808464432) R10=fp0 + 5: (9c) w4 %= w0 + 6: R0_w=invP(id=0) R1=ctx(id=0,off=0,imm=0) R4_w=invP(id=0) R10=fp0 + 6: (66) if w0 s> 0x3030 goto pc+0 + R0_w=invP(id=0,s32_max_value=12336) R1=ctx(id=0,off=0,imm=0) R4_w=invP(id=0) R10=fp0 + 7: R0=invP(id=0,s32_max_value=12336) R1=ctx(id=0,off=0,imm=0) R4=invP(id=0) R10=fp0 + 7: (d6) if w0 s<= 0x303030 goto pc+1 + 9: R0=invP(id=0,s32_max_value=12336) R1=ctx(id=0,off=0,imm=0) R4=invP(id=0) R10=fp0 + 9: (95) exit + propagating r0 + + from 6 to 7: safe + 4: R0_w=invP808464450 R1=ctx(id=0,off=0,imm=0) R4_w=invP(id=0,umin_value=808464433,umax_value=2147483647,var_off=(0x0; 0x7fffffff)) R10=fp0 + 4: (7f) r0 >>= r0 + 5: R0_w=invP(id=0) R1=ctx(id=0,off=0,imm=0) R4_w=invP(id=0,umin_value=808464433,umax_value=2147483647,var_off=(0x0; 0x7fffffff)) R10=fp0 + 5: (9c) w4 %= w0 + 6: R0_w=invP(id=0) R1=ctx(id=0,off=0,imm=0) R4_w=invP(id=0) R10=fp0 + 6: (66) if w0 s> 0x3030 goto pc+0 + R0_w=invP(id=0,s32_max_value=12336) R1=ctx(id=0,off=0,imm=0) R4_w=invP(id=0) R10=fp0 + propagating r0 + 7: safe + propagating r0 + + from 6 to 7: safe + processed 15 insns (limit 1000000) max_states_per_insn 0 total_states 1 peak_states 1 mark_read 1 + +The underlying program was xlated as follows: + + # bpftool p d x i 10 + 0: (b7) r0 = 808464450 + 1: (b4) w4 = 808464432 + 2: (bc) w0 = w0 + 3: (15) if r0 == 0x0 goto pc+1 + 4: (9c) w4 %= w0 + 5: (66) if w4 s> 0x30303030 goto pc+0 + 6: (7f) r0 >>= r0 + 7: (bc) w0 = w0 + 8: (15) if r0 == 0x0 goto pc+1 + 9: (9c) w4 %= w0 + 10: (66) if w0 s> 0x3030 goto pc+0 + 11: (d6) if w0 s<= 0x303030 goto pc+1 + 12: (05) goto pc-1 + 13: (95) exit + +The verifier rewrote original instructions it recognized as dead code with +'goto pc-1', but reality differs from verifier simulation in that we are +actually able to trigger a hang due to hitting the 'goto pc-1' instructions. + +Taking a closer look at the verifier analysis, the reason is that it misjudges +its pruning decision at the first 'from 6 to 7: safe' occasion. What happens +is that while both old/cur registers are marked as precise, they get misjudged +for the jmp32 case as range_within() yields true, meaning that the prior +verification path with a wider register bound could be verified successfully +and therefore the current path with a narrower register bound is deemed safe +as well whereas in reality it's not. R0 old/cur path's bounds compare as +follows: + + old: smin_value=0x8000000000000000,smax_value=0x7fffffffffffffff,umin_value=0x0,umax_value=0xffffffffffffffff,var_off=(0x0; 0xffffffffffffffff) + cur: smin_value=0x8000000000000000,smax_value=0x7fffffff7fffffff,umin_value=0x0,umax_value=0xffffffff7fffffff,var_off=(0x0; 0xffffffff7fffffff) + + old: s32_min_value=0x80000000,s32_max_value=0x00003030,u32_min_value=0x00000000,u32_max_value=0xffffffff + cur: s32_min_value=0x00003031,s32_max_value=0x7fffffff,u32_min_value=0x00003031,u32_max_value=0x7fffffff + +The 64 bit bounds generally look okay and while the information that got +propagated from 32 to 64 bit looks correct as well, it's not precise enough +for judging a conditional jmp32. Given the latter only operates on subregisters +we also need to take these into account as well for a range_within() probe +in order to be able to prune paths. Extending the range_within() constraint +to both bounds will be able to tell us that the old signed 32 bit bounds are +not wider than the cur signed 32 bit bounds. + +With the fix in place, the program will now verify the 'goto' branch case as +it should have been: + + [...] + 6: R0_w=invP(id=0) R1=ctx(id=0,off=0,imm=0) R4_w=invP(id=0) R10=fp0 + 6: (66) if w0 s> 0x3030 goto pc+0 + R0_w=invP(id=0,s32_max_value=12336) R1=ctx(id=0,off=0,imm=0) R4_w=invP(id=0) R10=fp0 + 7: R0=invP(id=0,s32_max_value=12336) R1=ctx(id=0,off=0,imm=0) R4=invP(id=0) R10=fp0 + 7: (d6) if w0 s<= 0x303030 goto pc+1 + 9: R0=invP(id=0,s32_max_value=12336) R1=ctx(id=0,off=0,imm=0) R4=invP(id=0) R10=fp0 + 9: (95) exit + + 7: R0_w=invP(id=0,smax_value=9223372034707292159,umax_value=18446744071562067967,var_off=(0x0; 0xffffffff7fffffff),s32_min_value=12337,u32_min_value=12337,u32_max_value=2147483647) R1=ctx(id=0,off=0,imm=0) R4_w=invP(id=0) R10=fp0 + 7: (d6) if w0 s<= 0x303030 goto pc+1 + R0_w=invP(id=0,smax_value=9223372034707292159,umax_value=18446744071562067967,var_off=(0x0; 0xffffffff7fffffff),s32_min_value=3158065,u32_min_value=3158065,u32_max_value=2147483647) R1=ctx(id=0,off=0,imm=0) R4_w=invP(id=0) R10=fp0 + 8: R0_w=invP(id=0,smax_value=9223372034707292159,umax_value=18446744071562067967,var_off=(0x0; 0xffffffff7fffffff),s32_min_value=3158065,u32_min_value=3158065,u32_max_value=2147483647) R1=ctx(id=0,off=0,imm=0) R4_w=invP(id=0) R10=fp0 + 8: (30) r0 = *(u8 *)skb[808464432] + BPF_LD_[ABS|IND] uses reserved fields + processed 11 insns (limit 1000000) max_states_per_insn 1 total_states 1 peak_states 1 mark_read 1 + +The bug is quite subtle in the sense that when verifier would determine that +a given branch is dead code, it would (here: wrongly) remove these instructions +from the program and hard-wire the taken branch for privileged programs instead +of the 'goto pc-1' rewrites which will cause hard to debug problems. + +Fixes: 3f50f132d840 ("bpf: Verifier, do explicit ALU32 bounds tracking") +Reported-by: Anatoly Trosinenko +Signed-off-by: Daniel Borkmann +Reviewed-by: John Fastabend +Acked-by: Alexei Starovoitov +Acked-by: Gary Lin +--- + kernel/bpf/verifier.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/kernel/bpf/verifier.c ++++ b/kernel/bpf/verifier.c +@@ -8125,7 +8125,11 @@ static bool range_within(struct bpf_reg_ + return old->umin_value <= cur->umin_value && + old->umax_value >= cur->umax_value && + old->smin_value <= cur->smin_value && +- old->smax_value >= cur->smax_value; ++ old->smax_value >= cur->smax_value && ++ old->u32_min_value <= cur->u32_min_value && ++ old->u32_max_value >= cur->u32_max_value && ++ old->s32_min_value <= cur->s32_min_value && ++ old->s32_max_value >= cur->s32_max_value; + } + + /* Maximum number of register states that can exist at once */ diff --git a/patches.suse/bpf-Fix-verifier-jsgt-branch-analysis-on-max-bound.patch b/patches.suse/bpf-Fix-verifier-jsgt-branch-analysis-on-max-bound.patch new file mode 100644 index 0000000..1b40e76 --- /dev/null +++ b/patches.suse/bpf-Fix-verifier-jsgt-branch-analysis-on-max-bound.patch @@ -0,0 +1,48 @@ +From: Daniel Borkmann +Date: Fri, 5 Feb 2021 17:20:14 +0100 +Subject: bpf: Fix verifier jsgt branch analysis on max bound +Patch-mainline: v5.11 +Git-commit: ee114dd64c0071500345439fc79dd5e0f9d106ed +References: bsc#1177028 + +Fix incorrect is_branch{32,64}_taken() analysis for the jsgt case. The return +code for both will tell the caller whether a given conditional jump is taken +or not, e.g. 1 means branch will be taken [for the involved registers] and the +goto target will be executed, 0 means branch will not be taken and instead we +fall-through to the next insn, and last but not least a -1 denotes that it is +not known at verification time whether a branch will be taken or not. Now while +the jsgt has the branch-taken case correct with reg->s32_min_value > sval, the +branch-not-taken case is off-by-one when testing for reg->s32_max_value < sval +since the branch will also be taken for reg->s32_max_value == sval. The jgt +branch analysis, for example, gets this right. + +Fixes: 3f50f132d840 ("bpf: Verifier, do explicit ALU32 bounds tracking") +Fixes: 4f7b3e82589e ("bpf: improve verifier branch analysis") +Signed-off-by: Daniel Borkmann +Reviewed-by: John Fastabend +Acked-by: Alexei Starovoitov +Acked-by: Gary Lin +--- + kernel/bpf/verifier.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/kernel/bpf/verifier.c ++++ b/kernel/bpf/verifier.c +@@ -6569,7 +6569,7 @@ static int is_branch32_taken(struct bpf_ + case BPF_JSGT: + if (reg->s32_min_value > sval) + return 1; +- else if (reg->s32_max_value < sval) ++ else if (reg->s32_max_value <= sval) + return 0; + break; + case BPF_JLT: +@@ -6642,7 +6642,7 @@ static int is_branch64_taken(struct bpf_ + case BPF_JSGT: + if (reg->smin_value > sval) + return 1; +- else if (reg->smax_value < sval) ++ else if (reg->smax_value <= sval) + return 0; + break; + case BPF_JLT: diff --git a/patches.suse/bpf-devmap-Use-GFP_KERNEL-for-xdp-bulk-queue-allocat.patch b/patches.suse/bpf-devmap-Use-GFP_KERNEL-for-xdp-bulk-queue-allocat.patch new file mode 100644 index 0000000..595c6f8 --- /dev/null +++ b/patches.suse/bpf-devmap-Use-GFP_KERNEL-for-xdp-bulk-queue-allocat.patch @@ -0,0 +1,44 @@ +From: Jun'ichi Nomura +Date: Tue, 9 Feb 2021 08:24:52 +0000 +Subject: bpf, devmap: Use GFP_KERNEL for xdp bulk queue allocation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Patch-mainline: v5.12-rc1 +Git-commit: 7d4553b69fb335496c597c31590e982485ebe071 +References: bsc#1177028 + +The devmap bulk queue is allocated with GFP_ATOMIC and the allocation +may fail if there is no available space in existing percpu pool. + +Since commit 75ccae62cb8d42 ("xdp: Move devmap bulk queue into struct net_device") +moved the bulk queue allocation to NETDEV_REGISTER callback, whose context +is allowed to sleep, use GFP_KERNEL instead of GFP_ATOMIC to let percpu +allocator extend the pool when needed and avoid possible failure of netdev +registration. + +As the required alignment is natural, we can simply use alloc_percpu(). + +Fixes: 75ccae62cb8d42 ("xdp: Move devmap bulk queue into struct net_device") +Signed-off-by: Jun'ichi Nomura +Signed-off-by: Daniel Borkmann +Cc: Toke Høiland-Jørgensen +Link: https://lore.kernel.org/bpf/20210209082451.GA44021@jeru.linux.bs1.fc.nec.co.jp +Acked-by: Gary Lin +--- + kernel/bpf/devmap.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/kernel/bpf/devmap.c ++++ b/kernel/bpf/devmap.c +@@ -814,9 +814,7 @@ static int dev_map_notification(struct n + break; + + /* will be freed in free_netdev() */ +- netdev->xdp_bulkq = +- __alloc_percpu_gfp(sizeof(struct xdp_dev_bulk_queue), +- sizeof(void *), GFP_ATOMIC); ++ netdev->xdp_bulkq = alloc_percpu(struct xdp_dev_bulk_queue); + if (!netdev->xdp_bulkq) + return NOTIFY_BAD; + diff --git a/patches.suse/btrfs-cleanup-try_flush_qgroup.patch b/patches.suse/btrfs-cleanup-try_flush_qgroup.patch new file mode 100644 index 0000000..0845f6e --- /dev/null +++ b/patches.suse/btrfs-cleanup-try_flush_qgroup.patch @@ -0,0 +1,77 @@ +From: Nikolay Borisov +Date: Fri, 19 Feb 2021 12:36:26 +0200 +Subject: btrfs: Cleanup try_flush_qgroup +Patch-mainline: Submitted, 23.0.2021 - btrfs mailing list +References: bsc#1182047 + +It's no longer expected to call this function with an open transaction +so all the hacks concerning this can be removed. In fact it'll +constitute a bug to call this function with a transaction already held +so WARN in this case. + +Acked-by: Nikolay Borisov +--- + fs/btrfs/qgroup.c | 35 +++++++---------------------------- + 1 file changed, 7 insertions(+), 28 deletions(-) + +diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c +index fbef95bc3557..c9e82e0c88e3 100644 +--- a/fs/btrfs/qgroup.c ++++ b/fs/btrfs/qgroup.c +@@ -3535,37 +3535,19 @@ static int try_flush_qgroup(struct btrfs_root *root) + { + struct btrfs_trans_handle *trans; + int ret; +- bool can_commit = true; + +- /* +- * If current process holds a transaction, we shouldn't flush, as we +- * assume all space reservation happens before a transaction handle is +- * held. +- * +- * But there are cases like btrfs_delayed_item_reserve_metadata() where +- * we try to reserve space with one transction handle already held. +- * In that case we can't commit transaction, but at least try to end it +- * and hope the started data writes can free some space. +- */ +- if (current->journal_info && +- current->journal_info != BTRFS_SEND_TRANS_STUB) +- can_commit = false; ++ /* Can't hold an open transaction or we run the risk of deadlocking. */ ++ ASSERT(current->journal_info == NULL || ++ current->journal_info == BTRFS_SEND_TRANS_STUB); ++ if (WARN_ON(current->journal_info && ++ current->journal_info != BTRFS_SEND_TRANS_STUB)) ++ return 0; + + /* + * We don't want to run flush again and again, so if there is a running + * one, we won't try to start a new flush, but exit directly. + */ + if (test_and_set_bit(BTRFS_ROOT_QGROUP_FLUSHING, &root->state)) { +- /* +- * We are already holding a transaction, thus we can block other +- * threads from flushing. So exit right now. This increases +- * the chance of EDQUOT for heavy load and near limit cases. +- * But we can argue that if we're already near limit, EDQUOT is +- * unavoidable anyway. +- */ +- if (!can_commit) +- return 0; +- + wait_event(root->qgroup_flush_wait, + !test_bit(BTRFS_ROOT_QGROUP_FLUSHING, &root->state)); + return 0; +@@ -3582,10 +3564,7 @@ static int try_flush_qgroup(struct btrfs_root *root) + goto out; + } + +- if (can_commit) +- ret = btrfs_commit_transaction(trans); +- else +- ret = btrfs_end_transaction(trans); ++ ret = btrfs_commit_transaction(trans); + out: + clear_bit(BTRFS_ROOT_QGROUP_FLUSHING, &root->state); + wake_up(&root->qgroup_flush_wait); + diff --git a/patches.suse/btrfs-don-t-flush-from-btrfs_delayed_inode_reserve_metadata.patch b/patches.suse/btrfs-don-t-flush-from-btrfs_delayed_inode_reserve_metadata.patch new file mode 100644 index 0000000..c016925 --- /dev/null +++ b/patches.suse/btrfs-don-t-flush-from-btrfs_delayed_inode_reserve_metadata.patch @@ -0,0 +1,135 @@ +From: Nikolay Borisov +Date: Fri, 19 Feb 2021 12:09:43 +0200 +Subject: btrfs: Don't flush from btrfs_delayed_inode_reserve_metadata +Patch-mainline: Submitted, 23.02.2021 - btrfs mailing list +References: bsc#1182047 + +Calling btrfs_qgroup_reserve_meta_prealloc from +btrfs_delayed_inode_reserve_metadata can result in flushing delalloc +while holding a transaction and delayed node locks. This is is dead-lock +prone. In the past multiple commits: + + * ae5e070eaca9 ("btrfs: qgroup: don't try to wait flushing if we're +already holding a transaction") + + * 6f23277a49e6 ("btrfs: qgroup: don't commit transaction when we already + hold the handle") + +Tried to solve various aspects of this but this was always a +whack-a-mole game. Unfortunately those 2 fixes don't solve a deadlock +scenario involving btrfs_delayed_node::mutex. Namely, one thread +can call btrfs_dirty_inode as a result of reading a file and modifying +its atime: + +> PID: 6963 TASK: ffff8c7f3f94c000 CPU: 2 COMMAND: "http-0.0.0.0-62" +> #0 [ffffaedd02a67a00] __schedule at ffffffffa529e07d +> #1 [ffffaedd02a67a90] schedule at ffffffffa529e4ff +> #2 [ffffaedd02a67aa0] schedule_timeout at ffffffffa52a1bdd +> #3 [ffffaedd02a67b18] wait_for_completion at ffffffffa529eeea <-- sleeps with delayed node mutex held +> #4 [ffffaedd02a67b68] start_delalloc_inodes at ffffffffc0380db5 [btrfs] +> #5 [ffffaedd02a67be8] btrfs_start_delalloc_snapshot at ffffffffc0393836 [btrfs] +> #6 [ffffaedd02a67bf0] try_flush_qgroup at ffffffffc03f04b2 [btrfs] +> #7 [ffffaedd02a67c40] __btrfs_qgroup_reserve_meta at ffffffffc03f5bb6 [btrfs] <-- tries to reserve space and starts delalloc inodes. +> #8 [ffffaedd02a67c68] btrfs_delayed_update_inode at ffffffffc03e31aa [btrfs] <-- Acquires delayed node mutex +> #9 [ffffaedd02a67cc0] btrfs_update_inode at ffffffffc0385ba8 [btrfs] +> #10 [ffffaedd02a67ce8] btrfs_dirty_inode at ffffffffc038627b [btrfs] <-- TRANSACTIION OPENED +> #11 [ffffaedd02a67d18] touch_atime at ffffffffa4cf0000 +> #12 [ffffaedd02a67d58] generic_file_read_iter at ffffffffa4c1f123 +> #13 [ffffaedd02a67e40] new_sync_read at ffffffffa4ccdc8a +> #14 [ffffaedd02a67ec8] vfs_read at ffffffffa4cd0849 +> #15 [ffffaedd02a67ef8] ksys_read at ffffffffa4cd0bd1 +> #16 [ffffaedd02a67f38] do_syscall_64 at ffffffffa4a052eb +> #17 [ffffaedd02a67f50] entry_SYSCALL_64_after_hwframe at ffffffffa540008c + +This will cause an asynchronous work to flush the delalloc inodes to +happen which can try to acquire the same delayed_node mutex: + +> PID: 455 TASK: ffff8c8085fa4000 CPU: 5 COMMAND: "kworker/u16:30" +> #0 [ffffaedd009f77b0] __schedule at ffffffffa529e07d +> #1 [ffffaedd009f7840] schedule at ffffffffa529e4ff +> #2 [ffffaedd009f7850] schedule_preempt_disabled at ffffffffa529e80a +> #3 [ffffaedd009f7858] __mutex_lock at ffffffffa529fdcb <--- goes to sleep, never wakes up. +> #4 [ffffaedd009f78f8] btrfs_delayed_update_inode at ffffffffc03e3143 [btrfs] <-- tries to acquire the mutex +> #5 [ffffaedd009f7950] btrfs_update_inode at ffffffffc0385ba8 [btrfs] <-- This is the same inode that pid 6963 is holding +> #6 [ffffaedd009f7978] cow_file_range_inline.constprop.78 at ffffffffc0386be7 [btrfs] +> #7 [ffffaedd009f7a30] cow_file_range at ffffffffc03879c1 [btrfs] +> #8 [ffffaedd009f7ab8] btrfs_run_delalloc_range at ffffffffc038894c [btrfs] +> #9 [ffffaedd009f7b40] writepage_delalloc at ffffffffc03a3c8f [btrfs] +> #10 [ffffaedd009f7ba0] __extent_writepage at ffffffffc03a4c01 [btrfs] +> #11 [ffffaedd009f7c08] extent_write_cache_pages at ffffffffc03a500b [btrfs] +> #12 [ffffaedd009f7d08] extent_writepages at ffffffffc03a6de2 [btrfs] +> #13 [ffffaedd009f7d38] do_writepages at ffffffffa4c277eb +> #14 [ffffaedd009f7db8] __filemap_fdatawrite_range at ffffffffa4c1e5bb +> #15 [ffffaedd009f7e40] btrfs_run_delalloc_work at ffffffffc0380987 [btrfs] <-- starts running delayed nodes +> #16 [ffffaedd009f7e58] normal_work_helper at ffffffffc03b706c [btrfs] +> #17 [ffffaedd009f7e98] process_one_work at ffffffffa4aba4e4 +> #18 [ffffaedd009f7ed8] worker_thread at ffffffffa4aba6fd +> #19 [ffffaedd009f7f10] kthread at ffffffffa4ac0a3d +> #20 [ffffaedd009f7f50] ret_from_fork at ffffffffa54001ff + +To fully address those cases the complete fix is to never issue any +flushing while holding the transaction or the delayed node lock. This +patch achieves it by calling qgroup_reserve_meta directly which will +either succeed without flushing or will fail and return -EDQUOT. In the +latter case that return value is going to be propagated to +btrfs_dirty_inode which will fallback to start a new transaction. That's +fine as the majority of time we expect the inode will have +BTRFS_DELAYED_NODE_INODE_DIRTY flag set which will result in directly +copying the in-memory state. + +Acked-by: Nikolay Borisov +--- + fs/btrfs/delayed-inode.c | 3 ++- + fs/btrfs/inode.c | 2 +- + fs/btrfs/qgroup.c | 4 ++-- + fs/btrfs/qgroup.h | 3 +++ + 4 files changed, 8 insertions(+), 4 deletions(-) + +--- a/fs/btrfs/delayed-inode.c ++++ b/fs/btrfs/delayed-inode.c +@@ -625,7 +625,8 @@ static int btrfs_delayed_inode_reserve_m + */ + if (!src_rsv || (!trans->bytes_reserved && + src_rsv->type != BTRFS_BLOCK_RSV_DELALLOC)) { +- ret = btrfs_qgroup_reserve_meta_prealloc(root, num_bytes, true); ++ ret = qgroup_reserve_meta(root, num_bytes, ++ BTRFS_QGROUP_RSV_META_PREALLOC, true); + if (ret < 0) + return ret; + ret = btrfs_block_rsv_add(root, dst_rsv, num_bytes, +--- a/fs/btrfs/inode.c ++++ b/fs/btrfs/inode.c +@@ -6333,7 +6333,7 @@ static int btrfs_dirty_inode(struct inod + return PTR_ERR(trans); + + ret = btrfs_update_inode(trans, root, inode); +- if (ret && ret == -ENOSPC) { ++ if (ret && (ret == -ENOSPC || ret == -EDQUOT)) { + /* whoops, lets try again with the full transaction */ + btrfs_end_transaction(trans); + trans = btrfs_start_transaction(root, 1); +--- a/fs/btrfs/qgroup.c ++++ b/fs/btrfs/qgroup.c +@@ -3742,8 +3742,8 @@ static int sub_root_meta_rsv(struct btrf + return num_bytes; + } + +-static int qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, +- enum btrfs_qgroup_rsv_type type, bool enforce) ++int qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, ++ enum btrfs_qgroup_rsv_type type, bool enforce) + { + struct btrfs_fs_info *fs_info = root->fs_info; + int ret; +--- a/fs/btrfs/qgroup.h ++++ b/fs/btrfs/qgroup.h +@@ -343,6 +343,9 @@ int btrfs_verify_qgroup_counts(struct bt + u64 rfer, u64 excl); + #endif + ++int qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, ++ enum btrfs_qgroup_rsv_type type, bool enforce); ++ + /* New io_tree based accurate qgroup reserve API */ + int btrfs_qgroup_reserve_data(struct inode *inode, + struct extent_changeset **reserved, u64 start, u64 len); diff --git a/patches.suse/btrfs-free-correct-amount-of-space-in-btrfs_delayed_inode_reserve_metadata.patch b/patches.suse/btrfs-free-correct-amount-of-space-in-btrfs_delayed_inode_reserve_metadata.patch new file mode 100644 index 0000000..68316d6 --- /dev/null +++ b/patches.suse/btrfs-free-correct-amount-of-space-in-btrfs_delayed_inode_reserve_metadata.patch @@ -0,0 +1,33 @@ +From: Nikolay Borisov +Date: Tue, 16 Feb 2021 17:28:16 +0200 +Subject: btrfs: Free correct amount of space in btrfs_delayed_inode_reserve_metadata +Patch-mainline: Submitted, 23.02.2020 - btrfs mailing list +References: bsc#1182047 + +Following commit f218ea6c4792 ("btrfs: delayed-inode: Remove wrong +qgroup meta reservation calls") this function now reserves num_bytes, +rather than the fixed amount of nodesize. As such this requires the +same amount to be freed in case of failure. Fix this by adjusting +the amount we are freeing. + +Fixes f218ea6c4792 ("btrfs: delayed-inode: Remove wrong qgroup meta reservation calls") + +Acked-by: Nikolay Borisov +--- + fs/btrfs/delayed-inode.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c +index ec0b50b8c5d6..ac9966e76a2f 100644 +--- a/fs/btrfs/delayed-inode.c ++++ b/fs/btrfs/delayed-inode.c +@@ -649,7 +649,7 @@ static int btrfs_delayed_inode_reserve_metadata( + btrfs_ino(inode), + num_bytes, 1); + } else { +- btrfs_qgroup_free_meta_prealloc(root, fs_info->nodesize); ++ btrfs_qgroup_free_meta_prealloc(root, num_bytes); + } + return ret; + } + diff --git a/patches.suse/btrfs-remove-btrfs_inode-from-btrfs_delayed_inode_reserve_metadata.patch b/patches.suse/btrfs-remove-btrfs_inode-from-btrfs_delayed_inode_reserve_metadata.patch new file mode 100644 index 0000000..325129b --- /dev/null +++ b/patches.suse/btrfs-remove-btrfs_inode-from-btrfs_delayed_inode_reserve_metadata.patch @@ -0,0 +1,52 @@ +From: Nikolay Borisov +Date: Tue, 16 Feb 2021 17:37:13 +0200 +Subject: btrfs: Remove btrfs_inode from btrfs_delayed_inode_reserve_metadata +Patch-mainline: Submitted, 23.02.2021 - btrfs mailing list +References: bsc#1182047 + +It's only used for tracepoint to obtain the ino, but we already have +the ino from btrfs_delayed_node::inode_id. + +Acked-by: Nikolay Borisov +--- + fs/btrfs/delayed-inode.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +--- a/fs/btrfs/delayed-inode.c ++++ b/fs/btrfs/delayed-inode.c +@@ -600,7 +600,6 @@ static void btrfs_delayed_item_release_m + static int btrfs_delayed_inode_reserve_metadata( + struct btrfs_trans_handle *trans, + struct btrfs_root *root, +- struct btrfs_inode *inode, + struct btrfs_delayed_node *node) + { + struct btrfs_fs_info *fs_info = root->fs_info; +@@ -645,7 +644,7 @@ static int btrfs_delayed_inode_reserve_m + node->bytes_reserved = num_bytes; + trace_btrfs_space_reservation(fs_info, + "delayed_inode", +- btrfs_ino(inode), ++ node->inode_id, + num_bytes, 1); + } else { + btrfs_qgroup_free_meta_prealloc(root, num_bytes); +@@ -656,7 +655,7 @@ static int btrfs_delayed_inode_reserve_m + ret = btrfs_block_rsv_migrate(src_rsv, dst_rsv, num_bytes, true); + if (!ret) { + trace_btrfs_space_reservation(fs_info, "delayed_inode", +- btrfs_ino(inode), num_bytes, 1); ++ node->inode_id, num_bytes, 1); + node->bytes_reserved = num_bytes; + } + +@@ -1830,8 +1829,7 @@ int btrfs_delayed_update_inode(struct bt + goto release_node; + } + +- ret = btrfs_delayed_inode_reserve_metadata(trans, root, BTRFS_I(inode), +- delayed_node); ++ ret = btrfs_delayed_inode_reserve_metadata(trans, root, delayed_node); + if (ret) + goto release_node; + diff --git a/patches.suse/btrfs-simplify-code-flow-in-btrfs_delayed_inode_reserve_metadata.patch b/patches.suse/btrfs-simplify-code-flow-in-btrfs_delayed_inode_reserve_metadata.patch new file mode 100644 index 0000000..ec96ee5 --- /dev/null +++ b/patches.suse/btrfs-simplify-code-flow-in-btrfs_delayed_inode_reserve_metadata.patch @@ -0,0 +1,53 @@ +From: Nikolay Borisov +Date: Wed, 17 Feb 2021 09:30:31 +0200 +Subject: btrfs: Simplify code flow in btrfs_delayed_inode_reserve_metadata +Patch-mainline: Submitted, 23.02.2021 - btrfs mailing list +References: bsc#1182047 + +btrfs_block_rsv_add can return only ENOSPC since it's called with +NO_FLUSH modifier. This so simplify the logic in +btrfs_delayed_inode_reserve_metadata to exploit this invariant. + +Acked-by: Nikolay Borisov +--- + fs/btrfs/delayed-inode.c | 23 +++-------------------- + 1 file changed, 3 insertions(+), 20 deletions(-) + +diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c +index 875daca63d5d..92843105ebd8 100644 +--- a/fs/btrfs/delayed-inode.c ++++ b/fs/btrfs/delayed-inode.c +@@ -632,29 +632,12 @@ static int btrfs_delayed_inode_reserve_metadata( + return ret; + ret = btrfs_block_rsv_add(root, dst_rsv, num_bytes, + BTRFS_RESERVE_NO_FLUSH); +- /* +- * Since we're under a transaction reserve_metadata_bytes could +- * try to commit the transaction which will make it return +- * EAGAIN to make us stop the transaction we have, so return +- * ENOSPC instead so that btrfs_dirty_inode knows what to do. +- */ +- if (ret == -EAGAIN) { +- ret = -ENOSPC; +- btrfs_qgroup_free_meta_prealloc(root, num_bytes); +- } +- if (!ret) { +- node->bytes_reserved = num_bytes; +- trace_btrfs_space_reservation(fs_info, +- "delayed_inode", +- node->inode_id, +- num_bytes, 1); +- } else { ++ if (ret) + btrfs_qgroup_free_meta_prealloc(root, num_bytes); +- } +- return ret; ++ } else { ++ ret = btrfs_block_rsv_migrate(src_rsv, dst_rsv, num_bytes, true); + } + +- ret = btrfs_block_rsv_migrate(src_rsv, dst_rsv, num_bytes, true); + if (!ret) { + trace_btrfs_space_reservation(fs_info, "delayed_inode", + node->inode_id, num_bytes, 1); + diff --git a/patches.suse/btrfs-unlock-extents-in-btrfs_zero_range-in-case-of-errors.patch b/patches.suse/btrfs-unlock-extents-in-btrfs_zero_range-in-case-of-errors.patch new file mode 100644 index 0000000..7ee8cf1 --- /dev/null +++ b/patches.suse/btrfs-unlock-extents-in-btrfs_zero_range-in-case-of-errors.patch @@ -0,0 +1,33 @@ +From: Nikolay Borisov +Date: Tue, 23 Feb 2021 15:17:43 +0200 +Subject: btrfs: Unlock extents in btrfs_zero_range in case of errors +Patch-mainline: Submitted, 23.02.2021 - btrfs mailing list +References: bsc#1182047 + +If btrfs_qgroup_reserve_data returns an error (i.e quota limit reached) +the handling logic directly goes to the 'out' label without first +unlocking the extent range between lockstart, lockend. This results in +deadlocks as processes try to lock the same extent. + +Fixes: a7f8b1c2ac21 ("btrfs: file: reserve qgroup space after the hole punch range is locked") + +Acked-by: Nikolay Borisov +--- + fs/btrfs/file.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/fs/btrfs/file.c ++++ b/fs/btrfs/file.c +@@ -3154,8 +3154,11 @@ reserve_space: + goto out; + ret = btrfs_qgroup_reserve_data(inode, &data_reserved, + alloc_start, bytes_to_reserve); +- if (ret) ++ if (ret) { ++ unlock_extent_cached(&BTRFS_I(inode)->io_tree, lockstart, ++ lockend, &cached_state); + goto out; ++ } + ret = btrfs_prealloc_file_range(inode, mode, alloc_start, + alloc_end - alloc_start, + i_blocksize(inode), diff --git a/patches.suse/bus-fsl-mc-Fix-test-for-end-of-loop.patch b/patches.suse/bus-fsl-mc-Fix-test-for-end-of-loop.patch new file mode 100644 index 0000000..52acabf --- /dev/null +++ b/patches.suse/bus-fsl-mc-Fix-test-for-end-of-loop.patch @@ -0,0 +1,41 @@ +From ef0fec22146ba874a1a64d4dd0303183e26a5b6f Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Mon, 8 Feb 2021 19:09:47 +0200 +Subject: [PATCH] bus: fsl-mc: Fix test for end of loop +Git-commit: ef0fec22146ba874a1a64d4dd0303183e26a5b6f +Patch-mainline: v5.12-rc1 +References: git-fixes + +The "desc" pointer can't possibly be NULL here. If we can't find the +correct "desc" then tt points to the last element of the +fsl_mc_accepted_cmds[] array. Fix this by testing if +"i == FSL_MC_NUM_ACCEPTED_CMDS" instead. + +Fixes: 2cf1e703f066 ("bus: fsl-mc: add fsl-mc userspace support") +Acked-by: Laurentiu Tudor +Signed-off-by: Ioana Ciornei +Signed-off-by: Dan Carpenter +Link: https://lore.kernel.org/r/20210208170949.3070898-2-ciorneiioana@gmail.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/bus/fsl-mc/fsl-mc-uapi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/bus/fsl-mc/fsl-mc-uapi.c b/drivers/bus/fsl-mc/fsl-mc-uapi.c +index eeb988c9f4bb..bdcd9d983a78 100644 +--- a/drivers/bus/fsl-mc/fsl-mc-uapi.c ++++ b/drivers/bus/fsl-mc/fsl-mc-uapi.c +@@ -338,7 +338,7 @@ static int fsl_mc_command_check(struct fsl_mc_device *mc_dev, + if ((cmdid & desc->cmdid_mask) == desc->cmdid_value) + break; + } +- if (!desc) { ++ if (i == FSL_MC_NUM_ACCEPTED_CMDS) { + dev_err(&mc_dev->dev, "MC command 0x%04x: cmdid not accepted\n", cmdid); + return -EACCES; + } +-- +2.26.2 + diff --git a/patches.suse/bus-fsl-mc-add-autorescan-sysfs.patch b/patches.suse/bus-fsl-mc-add-autorescan-sysfs.patch index 4493f5d..2b3edc2 100644 --- a/patches.suse/bus-fsl-mc-add-autorescan-sysfs.patch +++ b/patches.suse/bus-fsl-mc-add-autorescan-sysfs.patch @@ -3,8 +3,7 @@ Date: Thu, 14 Jan 2021 19:07:52 +0200 Subject: bus: fsl-mc: add autorescan sysfs Git-commit: 296c6264d4b19554dc8367e3f409bd248f504c2d -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.12-rc1 References: jsc#SLE-12251 Add the autorescan sysfs in order to enable/disable the DPRC IRQs on diff --git a/patches.suse/bus-fsl-mc-add-bus-rescan-attribute.patch b/patches.suse/bus-fsl-mc-add-bus-rescan-attribute.patch index c48dd5e..fe2fa65 100644 --- a/patches.suse/bus-fsl-mc-add-bus-rescan-attribute.patch +++ b/patches.suse/bus-fsl-mc-add-bus-rescan-attribute.patch @@ -3,8 +3,7 @@ Date: Thu, 14 Jan 2021 19:07:51 +0200 Subject: bus: fsl-mc: add bus rescan attribute Git-commit: 3f6099438181d269d56f9d4040d93ffae65f9e4c -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.12-rc1 References: jsc#SLE-12251 Introduce the rescan attribute as a bus attribute to diff --git a/patches.suse/bus-fsl-mc-add-fsl-mc-userspace-support.patch b/patches.suse/bus-fsl-mc-add-fsl-mc-userspace-support.patch index 532c4f2..4d08a89 100644 --- a/patches.suse/bus-fsl-mc-add-fsl-mc-userspace-support.patch +++ b/patches.suse/bus-fsl-mc-add-fsl-mc-userspace-support.patch @@ -3,8 +3,7 @@ Date: Thu, 14 Jan 2021 19:07:50 +0200 Subject: bus: fsl-mc: add fsl-mc userspace support Git-commit: 2cf1e703f066cfa82eb5a358ae84c29fe15a3b3a -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.12-rc1 References: jsc#SLE-12251 Adding userspace support for the MC (Management Complex) means exporting diff --git a/patches.suse/bus-fsl-mc-add-missing-__iomem-attribute.patch b/patches.suse/bus-fsl-mc-add-missing-__iomem-attribute.patch index 2e72c22..e560f49 100644 --- a/patches.suse/bus-fsl-mc-add-missing-__iomem-attribute.patch +++ b/patches.suse/bus-fsl-mc-add-missing-__iomem-attribute.patch @@ -3,8 +3,7 @@ Date: Wed, 16 Dec 2020 18:10:15 +0200 Subject: bus: fsl-mc: add missing __iomem attribute Git-commit: 59b26d2e96c473b7b65cfe19381444d034e91715 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.12-rc1 References: jsc#SLE-12251 This pointer to an i/o register block is missing the __iomem attribute, diff --git a/patches.suse/bus-fsl-mc-export-mc_cmd_hdr_read_cmdid-to-the-fsl-m.patch b/patches.suse/bus-fsl-mc-export-mc_cmd_hdr_read_cmdid-to-the-fsl-m.patch index f329b6e..35c1cc6 100644 --- a/patches.suse/bus-fsl-mc-export-mc_cmd_hdr_read_cmdid-to-the-fsl-m.patch +++ b/patches.suse/bus-fsl-mc-export-mc_cmd_hdr_read_cmdid-to-the-fsl-m.patch @@ -3,8 +3,7 @@ Date: Thu, 14 Jan 2021 19:07:49 +0200 Subject: bus: fsl-mc: export mc_cmd_hdr_read_cmdid() to the fsl-mc bus Git-commit: 46707989269a251e5e4ca295975525605bc8afef -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.12-rc1 References: jsc#SLE-12251 Export the mc_cmd_hdr_read_cmdid() function to the entire fsl-mc bus diff --git a/patches.suse/bus-fsl-mc-move-fsl_mc_command-struct-in-a-uapi-head.patch b/patches.suse/bus-fsl-mc-move-fsl_mc_command-struct-in-a-uapi-head.patch index 6b5bb27..087221a 100644 --- a/patches.suse/bus-fsl-mc-move-fsl_mc_command-struct-in-a-uapi-head.patch +++ b/patches.suse/bus-fsl-mc-move-fsl_mc_command-struct-in-a-uapi-head.patch @@ -3,8 +3,7 @@ Date: Thu, 14 Jan 2021 19:07:48 +0200 Subject: bus: fsl-mc: move fsl_mc_command struct in a uapi header Git-commit: 8544717cdacc2f33f0f53a3b34c5125b37e13ce9 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.12-rc1 References: jsc#SLE-12251 Define "struct fsl_mc_command" as a structure that can cross the diff --git a/patches.suse/bus-fsl-mc-return-EPROBE_DEFER-when-a-device-is-not-.patch b/patches.suse/bus-fsl-mc-return-EPROBE_DEFER-when-a-device-is-not-.patch index d0953b2..0448e2f 100644 --- a/patches.suse/bus-fsl-mc-return-EPROBE_DEFER-when-a-device-is-not-.patch +++ b/patches.suse/bus-fsl-mc-return-EPROBE_DEFER-when-a-device-is-not-.patch @@ -3,8 +3,7 @@ Date: Fri, 8 Jan 2021 11:07:24 +0200 Subject: bus: fsl-mc: return -EPROBE_DEFER when a device is not yet discovered Git-commit: ef57e6c9f7d988c550111d73fe337211da3d5100 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.12-rc1 References: jsc#SLE-12251 The fsl_mc_get_endpoint() should return a pointer to the connected diff --git a/patches.suse/can-flexcan-Ack-wakeup-interrupt-separately.patch b/patches.suse/can-flexcan-Ack-wakeup-interrupt-separately.patch new file mode 100644 index 0000000..28e89aa --- /dev/null +++ b/patches.suse/can-flexcan-Ack-wakeup-interrupt-separately.patch @@ -0,0 +1,53 @@ +From: Joakim Zhang +Date: Wed, 4 Dec 2019 11:36:08 +0000 +Subject: can: flexcan: Ack wakeup interrupt separately + +Git-commit: ab60523a76a4d40051ece11b23b099e273f9a485 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +As FLEXCAN_ESR_ALL_INT is for all bus errors and state change IRQ +sources, strictly speaking FLEXCAN_ESR_WAK_INT does not belong to these. +So add wakeup interrupt ack separately to existing ack of the +interrupts. + +Suggested-by: Marc Kleine-Budde +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20191204113249.3381-3-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index b180dd1ba763..06cddc468739 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -134,8 +134,7 @@ + (FLEXCAN_ESR_ERR_BUS | FLEXCAN_ESR_ERR_STATE) + #define FLEXCAN_ESR_ALL_INT \ + (FLEXCAN_ESR_TWRN_INT | FLEXCAN_ESR_RWRN_INT | \ +- FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT | \ +- FLEXCAN_ESR_WAK_INT) ++ FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT) + + /* FLEXCAN interrupt flag register (IFLAG) bits */ + /* Errata ERR005829 step7: Reserve first valid MB */ +@@ -979,10 +978,10 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) + + reg_esr = priv->read(®s->esr); + +- /* ACK all bus error and state change IRQ sources */ +- if (reg_esr & FLEXCAN_ESR_ALL_INT) { ++ /* ACK all bus error, state change and wake IRQ sources */ ++ if (reg_esr & (FLEXCAN_ESR_ALL_INT | FLEXCAN_ESR_WAK_INT)) { + handled = IRQ_HANDLED; +- priv->write(reg_esr & FLEXCAN_ESR_ALL_INT, ®s->esr); ++ priv->write(reg_esr & (FLEXCAN_ESR_ALL_INT | FLEXCAN_ESR_WAK_INT), ®s->esr); + } + + /* state change interrupt or broken error state quirk fix is enabled */ +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-Add-check-for-transceiver-maximum-bitrat.patch b/patches.suse/can-flexcan-Add-check-for-transceiver-maximum-bitrat.patch new file mode 100644 index 0000000..706d746 --- /dev/null +++ b/patches.suse/can-flexcan-Add-check-for-transceiver-maximum-bitrat.patch @@ -0,0 +1,34 @@ +From: Joakim Zhang +Date: Wed, 30 Oct 2019 06:45:57 +0000 +Subject: can: flexcan: Add check for transceiver maximum bitrate limitation + +Git-commit: ee97302d78654eebc1decc80d70c6a7de0217545 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +CAN FD can transmit up to 8Mbps, but some transceivers only can support +5Mbps, so add check in driver. + +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20191030064245.12923-2-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 52b53ff223f4..5c6903e23c01 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -1674,6 +1674,7 @@ static int flexcan_probe(struct platform_device *pdev) + goto failed_register; + } + ++ of_can_transceiver(dev); + devm_can_led_init(dev); + + if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE) { +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-add-CAN-FD-BRS-support.patch b/patches.suse/can-flexcan-add-CAN-FD-BRS-support.patch new file mode 100644 index 0000000..826067c --- /dev/null +++ b/patches.suse/can-flexcan-add-CAN-FD-BRS-support.patch @@ -0,0 +1,50 @@ +From: Joakim Zhang +Date: Fri, 12 Jul 2019 08:02:47 +0000 +Subject: can: flexcan: add CAN FD BRS support + +Git-commit: 0542920c3f0a666457a43625f4fa31cf6f059b94 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +This patch adds CAN FD BitRate Switch (BRS) support to driver. + +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20190712075926.7357-5-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index e3ecce80eadb..fc0e9d5fd02b 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -723,9 +723,13 @@ static netdev_tx_t flexcan_start_xmit(struct sk_buff *skb, struct net_device *de + if (cfd->can_id & CAN_RTR_FLAG) + ctrl |= FLEXCAN_MB_CNT_RTR; + +- if (can_is_canfd_skb(skb)) ++ if (can_is_canfd_skb(skb)) { + ctrl |= FLEXCAN_MB_CNT_EDL; + ++ if (cfd->flags & CANFD_BRS) ++ ctrl |= FLEXCAN_MB_CNT_BRS; ++ } ++ + for (i = 0; i < cfd->len; i += sizeof(u32)) { + data = be32_to_cpup((__be32 *)&cfd->data[i]); + priv->write(data, &priv->tx_mb->data[i / sizeof(u32)]); +@@ -956,6 +960,9 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload, + + if (reg_ctrl & FLEXCAN_MB_CNT_EDL) { + cfd->len = can_dlc2len(get_canfd_dlc((reg_ctrl >> 16) & 0xf)); ++ ++ if (reg_ctrl & FLEXCAN_MB_CNT_BRS) ++ cfd->flags |= CANFD_BRS; + } else { + cfd->len = get_can_dlc((reg_ctrl >> 16) & 0xf); + +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-add-CAN-FD-mode-support.patch b/patches.suse/can-flexcan-add-CAN-FD-mode-support.patch new file mode 100644 index 0000000..be0350b --- /dev/null +++ b/patches.suse/can-flexcan-add-CAN-FD-mode-support.patch @@ -0,0 +1,385 @@ +From: Joakim Zhang +Date: Fri, 12 Jul 2019 08:02:44 +0000 +Subject: can: flexcan: add CAN-FD mode support + +Git-commit: eadf6ca918f6963cd8f3575a2f328018e1a16443 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +This patch adds CAN-FD mode support to the driver, it means that +payload size can extend up to 64 bytes. + +Bit timing always set in the CBT register, not in the CTRL1 register any +more. This has an extend range of all CAN bit timing variables (PRESDIV, +PROPSEG, PSEG1, PSEG2 and RJW), which will improve the bit timing +accuracy. + +Signed-off-by: Joakim Zhang +[mkl: move cbt-based bitrate support into separate function] +Link: https://lore.kernel.org/r/20200922144429.2613631-16-mkl@pengutronix.de +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 220 ++++++++++++++++++++++++++++++++++++-- + 1 file changed, 212 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 20c845c265e1..8dca553fa545 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -9,6 +9,7 @@ + // + // Based on code originally by Andrey Volkov + ++#include + #include + #include + #include +@@ -53,6 +54,7 @@ + #define FLEXCAN_MCR_IRMQ BIT(16) + #define FLEXCAN_MCR_LPRIO_EN BIT(13) + #define FLEXCAN_MCR_AEN BIT(12) ++#define FLEXCAN_MCR_FDEN BIT(11) + /* MCR_MAXMB: maximum used MBs is MAXMB + 1 */ + #define FLEXCAN_MCR_MAXMB(x) ((x) & 0x7f) + #define FLEXCAN_MCR_IDAM_A (0x0 << 8) +@@ -137,6 +139,30 @@ + (FLEXCAN_ESR_TWRN_INT | FLEXCAN_ESR_RWRN_INT | \ + FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT) + ++/* FLEXCAN Bit Timing register (CBT) bits */ ++#define FLEXCAN_CBT_BTF BIT(31) ++#define FLEXCAN_CBT_EPRESDIV_MASK GENMASK(30, 21) ++#define FLEXCAN_CBT_ERJW_MASK GENMASK(20, 16) ++#define FLEXCAN_CBT_EPROPSEG_MASK GENMASK(15, 10) ++#define FLEXCAN_CBT_EPSEG1_MASK GENMASK(9, 5) ++#define FLEXCAN_CBT_EPSEG2_MASK GENMASK(4, 0) ++ ++/* FLEXCAN FD control register (FDCTRL) bits */ ++#define FLEXCAN_FDCTRL_FDRATE BIT(31) ++#define FLEXCAN_FDCTRL_MBDSR1 GENMASK(20, 19) ++#define FLEXCAN_FDCTRL_MBDSR0 GENMASK(17, 16) ++#define FLEXCAN_FDCTRL_MBDSR_8 0x0 ++#define FLEXCAN_FDCTRL_MBDSR_12 0x1 ++#define FLEXCAN_FDCTRL_MBDSR_32 0x2 ++#define FLEXCAN_FDCTRL_MBDSR_64 0x3 ++ ++/* FLEXCAN FD Bit Timing register (FDCBT) bits */ ++#define FLEXCAN_FDCBT_FPRESDIV_MASK GENMASK(29, 20) ++#define FLEXCAN_FDCBT_FRJW_MASK GENMASK(18, 16) ++#define FLEXCAN_FDCBT_FPROPSEG_MASK GENMASK(14, 10) ++#define FLEXCAN_FDCBT_FPSEG1_MASK GENMASK(7, 5) ++#define FLEXCAN_FDCBT_FPSEG2_MASK GENMASK(2, 0) ++ + /* FLEXCAN interrupt flag register (IFLAG) bits */ + /* Errata ERR005829 step7: Reserve first valid MB */ + #define FLEXCAN_TX_MB_RESERVED_OFF_FIFO 8 +@@ -161,6 +187,9 @@ + #define FLEXCAN_MB_CODE_TX_DATA (0xc << 24) + #define FLEXCAN_MB_CODE_TX_TANSWER (0xe << 24) + ++#define FLEXCAN_MB_CNT_EDL BIT(31) ++#define FLEXCAN_MB_CNT_BRS BIT(30) ++#define FLEXCAN_MB_CNT_ESI BIT(29) + #define FLEXCAN_MB_CNT_SRR BIT(22) + #define FLEXCAN_MB_CNT_IDE BIT(21) + #define FLEXCAN_MB_CNT_RTR BIT(20) +@@ -201,6 +230,8 @@ + #define FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN BIT(7) + /* Setup stop mode to support wakeup */ + #define FLEXCAN_QUIRK_SETUP_STOP_MODE BIT(8) ++/* Support CAN-FD mode */ ++#define FLEXCAN_QUIRK_SUPPORT_FD BIT(9) + + /* Structure of the message buffer */ + struct flexcan_mb { +@@ -356,6 +387,30 @@ static const struct can_bittiming_const flexcan_bittiming_const = { + .brp_inc = 1, + }; + ++static const struct can_bittiming_const flexcan_fd_bittiming_const = { ++ .name = DRV_NAME, ++ .tseg1_min = 2, ++ .tseg1_max = 96, ++ .tseg2_min = 2, ++ .tseg2_max = 32, ++ .sjw_max = 16, ++ .brp_min = 1, ++ .brp_max = 1024, ++ .brp_inc = 1, ++}; ++ ++static const struct can_bittiming_const flexcan_fd_data_bittiming_const = { ++ .name = DRV_NAME, ++ .tseg1_min = 2, ++ .tseg1_max = 39, ++ .tseg2_min = 2, ++ .tseg2_max = 8, ++ .sjw_max = 4, ++ .brp_min = 1, ++ .brp_max = 1024, ++ .brp_inc = 1, ++}; ++ + /* FlexCAN module is essentially modelled as a little-endian IP in most + * SoCs, i.e the registers as well as the message buffer areas are + * implemented in a little-endian fashion. +@@ -649,7 +704,7 @@ static netdev_tx_t flexcan_start_xmit(struct sk_buff *skb, struct net_device *de + struct canfd_frame *cfd = (struct canfd_frame *)skb->data; + u32 can_id; + u32 data; +- u32 ctrl = FLEXCAN_MB_CODE_TX_DATA | (cfd->len << 16); ++ u32 ctrl = FLEXCAN_MB_CODE_TX_DATA | ((can_len2dlc(cfd->len)) << 16); + int i; + + if (can_dropped_invalid_skb(dev, skb)) +@@ -667,6 +722,9 @@ static netdev_tx_t flexcan_start_xmit(struct sk_buff *skb, struct net_device *de + if (cfd->can_id & CAN_RTR_FLAG) + ctrl |= FLEXCAN_MB_CNT_RTR; + ++ if (can_is_canfd_skb(skb)) ++ ctrl |= FLEXCAN_MB_CNT_EDL; ++ + for (i = 0; i < cfd->len; i += sizeof(u32)) { + data = be32_to_cpup((__be32 *)&cfd->data[i]); + priv->write(data, &priv->tx_mb->data[i / sizeof(u32)]); +@@ -877,7 +935,10 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload, + reg_ctrl = priv->read(&mb->can_ctrl); + } + +- skb = alloc_can_skb(offload->dev, (struct can_frame **)&cfd); ++ if (reg_ctrl & FLEXCAN_MB_CNT_EDL) ++ skb = alloc_canfd_skb(offload->dev, &cfd); ++ else ++ skb = alloc_can_skb(offload->dev, (struct can_frame **)&cfd); + if (unlikely(!skb)) { + skb = ERR_PTR(-ENOMEM); + goto mark_as_read; +@@ -892,9 +953,17 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload, + else + cfd->can_id = (reg_id >> 18) & CAN_SFF_MASK; + +- if (reg_ctrl & FLEXCAN_MB_CNT_RTR) +- cfd->can_id |= CAN_RTR_FLAG; +- cfd->len = get_can_dlc((reg_ctrl >> 16) & 0xf); ++ if (reg_ctrl & FLEXCAN_MB_CNT_EDL) { ++ cfd->len = can_dlc2len(get_canfd_dlc((reg_ctrl >> 16) & 0xf)); ++ } else { ++ cfd->len = get_can_dlc((reg_ctrl >> 16) & 0xf); ++ ++ if (reg_ctrl & FLEXCAN_MB_CNT_RTR) ++ cfd->can_id |= CAN_RTR_FLAG; ++ } ++ ++ if (reg_ctrl & FLEXCAN_MB_CNT_ESI) ++ cfd->flags |= CANFD_ESI; + + for (i = 0; i < cfd->len; i += sizeof(u32)) { + __be32 data = cpu_to_be32(priv->read(&mb->data[i / sizeof(u32)])); +@@ -1065,6 +1134,83 @@ static void flexcan_set_bittiming_ctrl(const struct net_device *dev) + priv->read(®s->mcr), priv->read(®s->ctrl)); + } + ++static void flexcan_set_bittiming_cbt(const struct net_device *dev) ++{ ++ struct flexcan_priv *priv = netdev_priv(dev); ++ struct can_bittiming *bt = &priv->can.bittiming; ++ struct can_bittiming *dbt = &priv->can.data_bittiming; ++ struct flexcan_regs __iomem *regs = priv->regs; ++ u32 reg_cbt, reg_fdctrl; ++ ++ /* CBT */ ++ /* CBT[EPSEG1] is 5 bit long and CBT[EPROPSEG] is 6 bit ++ * long. The can_calc_bittiming() tries to divide the tseg1 ++ * equally between phase_seg1 and prop_seg, which may not fit ++ * in CBT register. Therefore, if phase_seg1 is more than ++ * possible value, increase prop_seg and decrease phase_seg1. ++ */ ++ if (bt->phase_seg1 > 0x20) { ++ bt->prop_seg += (bt->phase_seg1 - 0x20); ++ bt->phase_seg1 = 0x20; ++ } ++ ++ reg_cbt = FLEXCAN_CBT_BTF | ++ FIELD_PREP(FLEXCAN_CBT_EPRESDIV_MASK, bt->brp - 1) | ++ FIELD_PREP(FLEXCAN_CBT_ERJW_MASK, bt->sjw - 1) | ++ FIELD_PREP(FLEXCAN_CBT_EPROPSEG_MASK, bt->prop_seg - 1) | ++ FIELD_PREP(FLEXCAN_CBT_EPSEG1_MASK, bt->phase_seg1 - 1) | ++ FIELD_PREP(FLEXCAN_CBT_EPSEG2_MASK, bt->phase_seg2 - 1); ++ ++ netdev_dbg(dev, "writing cbt=0x%08x\n", reg_cbt); ++ priv->write(reg_cbt, ®s->cbt); ++ ++ if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { ++ u32 reg_fdcbt; ++ ++ if (bt->brp != dbt->brp) ++ netdev_warn(dev, "Data brp=%d and brp=%d don't match, this may result in a phase error. Consider using different bitrate and/or data bitrate.\n", ++ dbt->brp, bt->brp); ++ ++ /* FDCBT */ ++ /* FDCBT[FPSEG1] is 3 bit long and FDCBT[FPROPSEG] is ++ * 5 bit long. The can_calc_bittiming tries to divide ++ * the tseg1 equally between phase_seg1 and prop_seg, ++ * which may not fit in FDCBT register. Therefore, if ++ * phase_seg1 is more than possible value, increase ++ * prop_seg and decrease phase_seg1 ++ */ ++ if (dbt->phase_seg1 > 0x8) { ++ dbt->prop_seg += (dbt->phase_seg1 - 0x8); ++ dbt->phase_seg1 = 0x8; ++ } ++ ++ reg_fdcbt = FIELD_PREP(FLEXCAN_FDCBT_FPRESDIV_MASK, dbt->brp - 1) | ++ FIELD_PREP(FLEXCAN_FDCBT_FRJW_MASK, dbt->sjw - 1) | ++ FIELD_PREP(FLEXCAN_FDCBT_FPROPSEG_MASK, dbt->prop_seg) | ++ FIELD_PREP(FLEXCAN_FDCBT_FPSEG1_MASK, dbt->phase_seg1 - 1) | ++ FIELD_PREP(FLEXCAN_FDCBT_FPSEG2_MASK, dbt->phase_seg2 - 1); ++ ++ netdev_dbg(dev, "writing fdcbt=0x%08x\n", reg_fdcbt); ++ priv->write(reg_fdcbt, ®s->fdcbt); ++ } ++ ++ /* FDCTRL */ ++ reg_fdctrl = priv->read(®s->fdctrl); ++ reg_fdctrl &= ~FLEXCAN_FDCTRL_FDRATE; ++ ++ if (priv->can.ctrlmode & CAN_CTRLMODE_FD) ++ reg_fdctrl |= FLEXCAN_FDCTRL_FDRATE; ++ ++ netdev_dbg(dev, "writing fdctrl=0x%08x\n", reg_fdctrl); ++ priv->write(reg_fdctrl, ®s->fdctrl); ++ ++ netdev_dbg(dev, "%s: mcr=0x%08x ctrl=0x%08x fdctrl=0x%08x cbt=0x%08x fdcbt=0x%08x\n", ++ __func__, ++ priv->read(®s->mcr), priv->read(®s->ctrl), ++ priv->read(®s->fdctrl), priv->read(®s->cbt), ++ priv->read(®s->fdcbt)); ++} ++ + static void flexcan_set_bittiming(struct net_device *dev) + { + const struct flexcan_priv *priv = netdev_priv(dev); +@@ -1085,7 +1231,10 @@ static void flexcan_set_bittiming(struct net_device *dev) + netdev_dbg(dev, "writing ctrl=0x%08x\n", reg); + priv->write(reg, ®s->ctrl); + +- return flexcan_set_bittiming_ctrl(dev); ++ if (priv->can.ctrlmode_supported & CAN_CTRLMODE_FD) ++ return flexcan_set_bittiming_cbt(dev); ++ else ++ return flexcan_set_bittiming_ctrl(dev); + } + + /* flexcan_chip_start +@@ -1158,6 +1307,12 @@ static int flexcan_chip_start(struct net_device *dev) + else + reg_mcr |= FLEXCAN_MCR_SRX_DIS; + ++ /* MCR - CAN-FD */ ++ if (priv->can.ctrlmode & CAN_CTRLMODE_FD) ++ reg_mcr |= FLEXCAN_MCR_FDEN; ++ else ++ reg_mcr &= ~FLEXCAN_MCR_FDEN; ++ + netdev_dbg(dev, "%s: writing mcr=0x%08x", __func__, reg_mcr); + priv->write(reg_mcr, ®s->mcr); + +@@ -1200,6 +1355,32 @@ static int flexcan_chip_start(struct net_device *dev) + priv->write(reg_ctrl2, ®s->ctrl2); + } + ++ if (priv->can.ctrlmode_supported & CAN_CTRLMODE_FD) { ++ u32 reg_fdctrl; ++ ++ reg_fdctrl = priv->read(®s->fdctrl); ++ reg_fdctrl &= ~(FIELD_PREP(FLEXCAN_FDCTRL_MBDSR1, 0x3) | ++ FIELD_PREP(FLEXCAN_FDCTRL_MBDSR0, 0x3)); ++ ++ if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { ++ reg_fdctrl |= ++ FIELD_PREP(FLEXCAN_FDCTRL_MBDSR1, ++ FLEXCAN_FDCTRL_MBDSR_64) | ++ FIELD_PREP(FLEXCAN_FDCTRL_MBDSR0, ++ FLEXCAN_FDCTRL_MBDSR_64); ++ } else { ++ reg_fdctrl |= ++ FIELD_PREP(FLEXCAN_FDCTRL_MBDSR1, ++ FLEXCAN_FDCTRL_MBDSR_8) | ++ FIELD_PREP(FLEXCAN_FDCTRL_MBDSR0, ++ FLEXCAN_FDCTRL_MBDSR_8); ++ } ++ ++ netdev_dbg(dev, "%s: writing fdctrl=0x%08x", ++ __func__, reg_fdctrl); ++ priv->write(reg_fdctrl, ®s->fdctrl); ++ } ++ + if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { + for (i = priv->offload.mb_first; i <= priv->offload.mb_last; i++) { + mb = flexcan_get_mb(priv, i); +@@ -1356,6 +1537,12 @@ static int flexcan_open(struct net_device *dev) + struct flexcan_priv *priv = netdev_priv(dev); + int err; + ++ if ((priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) && ++ (priv->can.ctrlmode & CAN_CTRLMODE_FD)) { ++ netdev_err(dev, "Three Samples mode and CAN-FD mode can't be used together\n"); ++ return -EINVAL; ++ } ++ + err = pm_runtime_get_sync(priv->dev); + if (err < 0) + return err; +@@ -1368,7 +1555,10 @@ static int flexcan_open(struct net_device *dev) + if (err) + goto out_close; + +- priv->mb_size = sizeof(struct flexcan_mb) + CAN_MAX_DLEN; ++ if (priv->can.ctrlmode & CAN_CTRLMODE_FD) ++ priv->mb_size = sizeof(struct flexcan_mb) + CANFD_MAX_DLEN; ++ else ++ priv->mb_size = sizeof(struct flexcan_mb) + CAN_MAX_DLEN; + priv->mb_count = (sizeof(priv->regs->mb[0]) / priv->mb_size) + + (sizeof(priv->regs->mb[1]) / priv->mb_size); + +@@ -1678,6 +1868,12 @@ static int flexcan_probe(struct platform_device *pdev) + return -ENODEV; + } + ++ if ((devtype_data->quirks & FLEXCAN_QUIRK_SUPPORT_FD) && ++ !(devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP)) { ++ dev_err(&pdev->dev, "CAN-FD mode doesn't work with FIFO mode!\n"); ++ return -EINVAL; ++ } ++ + dev = alloc_candev(sizeof(struct flexcan_priv), 1); + if (!dev) + return -ENOMEM; +@@ -1702,7 +1898,6 @@ static int flexcan_probe(struct platform_device *pdev) + + priv->dev = &pdev->dev; + priv->can.clock.freq = clock_freq; +- priv->can.bittiming_const = &flexcan_bittiming_const; + priv->can.do_set_mode = flexcan_set_mode; + priv->can.do_get_berr_counter = flexcan_get_berr_counter; + priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK | +@@ -1715,6 +1910,15 @@ static int flexcan_probe(struct platform_device *pdev) + priv->devtype_data = devtype_data; + priv->reg_xceiver = reg_xceiver; + ++ if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SUPPORT_FD) { ++ priv->can.ctrlmode_supported |= CAN_CTRLMODE_FD; ++ priv->can.bittiming_const = &flexcan_fd_bittiming_const; ++ priv->can.data_bittiming_const = ++ &flexcan_fd_data_bittiming_const; ++ } else { ++ priv->can.bittiming_const = &flexcan_bittiming_const; ++ } ++ + pm_runtime_get_noresume(&pdev->dev); + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-add-ECC-initialization-for-LX2160A.patch b/patches.suse/can-flexcan-add-ECC-initialization-for-LX2160A.patch new file mode 100644 index 0000000..85a26e2 --- /dev/null +++ b/patches.suse/can-flexcan-add-ECC-initialization-for-LX2160A.patch @@ -0,0 +1,51 @@ +From: Joakim Zhang +Date: Tue, 20 Oct 2020 23:53:56 +0800 +Subject: can: flexcan: add ECC initialization for LX2160A + +Git-commit: 91a22bfe928fe2ef975580cbcc75e233bc4fe0d0 +Patch-mainline: v5.10-rc3 +References: jsc#SLE-12251 + +After double check with Layerscape CAN owner (Pankaj Bansal), confirm +that LX2160A indeed supports ECC feature, so correct the feature table. + +For SoCs with ECC supported, even use FLEXCAN_QUIRK_DISABLE_MECR quirk to +disable non-correctable errors interrupt and freeze mode, had better use +FLEXCAN_QUIRK_SUPPORT_ECC quirk to initialize all memory. + +Fixes: 2c19bb43e5572 ("can: flexcan: add lx2160ar1 support") +Cc: Pankaj Bansal +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20201020155402.30318-5-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 586e1417a697..c2330eab3595 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -217,7 +217,7 @@ + * MX8MP FlexCAN3 03.00.17.01 yes yes no yes yes yes + * VF610 FlexCAN3 ? no yes no yes yes? no + * LS1021A FlexCAN2 03.00.04.00 no yes no no yes no +- * LX2160A FlexCAN3 03.00.23.00 no yes no no yes yes ++ * LX2160A FlexCAN3 03.00.23.00 no yes no yes yes yes + * + * Some SOCs do not have the RX_WARN & TX_WARN interrupt line connected. + */ +@@ -411,7 +411,8 @@ static const struct flexcan_devtype_data fsl_ls1021a_r2_devtype_data = { + static const struct flexcan_devtype_data fsl_lx2160a_r1_devtype_data = { + .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | + FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_BROKEN_PERR_STATE | +- FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | FLEXCAN_QUIRK_SUPPORT_FD, ++ FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | FLEXCAN_QUIRK_SUPPORT_FD | ++ FLEXCAN_QUIRK_SUPPORT_ECC, + }; + + static const struct can_bittiming_const flexcan_bittiming_const = { +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-add-ECC-initialization-for-VF610.patch b/patches.suse/can-flexcan-add-ECC-initialization-for-VF610.patch new file mode 100644 index 0000000..8f27cd8 --- /dev/null +++ b/patches.suse/can-flexcan-add-ECC-initialization-for-VF610.patch @@ -0,0 +1,37 @@ +From: Joakim Zhang +Date: Tue, 20 Oct 2020 23:53:57 +0800 +Subject: can: flexcan: add ECC initialization for VF610 + +Git-commit: 5fdf04a9fdc27fc6cd37bb2ae44a84a282323773 +Patch-mainline: v5.10-rc3 +References: jsc#SLE-12251 + +For SoCs with ECC supported, even use FLEXCAN_QUIRK_DISABLE_MECR quirk to +disable non-correctable errors interrupt and freeze mode, had better use +FLEXCAN_QUIRK_SUPPORT_ECC quirk to initialize all memory. + +Fixes: cdce844865bea ("can: flexcan: add vf610 support for FlexCAN") +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20201020155402.30318-6-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index c2330eab3595..06f94b6f0ebe 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -400,7 +400,7 @@ static struct flexcan_devtype_data fsl_imx8mp_devtype_data = { + static const struct flexcan_devtype_data fsl_vf610_devtype_data = { + .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | + FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | +- FLEXCAN_QUIRK_BROKEN_PERR_STATE, ++ FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SUPPORT_ECC, + }; + + static const struct flexcan_devtype_data fsl_ls1021a_r2_devtype_data = { +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-add-ISO-CAN-FD-feature-support.patch b/patches.suse/can-flexcan-add-ISO-CAN-FD-feature-support.patch new file mode 100644 index 0000000..75e4da3 --- /dev/null +++ b/patches.suse/can-flexcan-add-ISO-CAN-FD-feature-support.patch @@ -0,0 +1,109 @@ +From: Joakim Zhang +Date: Fri, 12 Jul 2019 08:02:51 +0000 +Subject: can: flexcan: add ISO CAN FD feature support + +Git-commit: ce885a192f1cca7ab6aeffa37fa6228db966b632 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +ISO CAN FD is introduced to increase the failture detection capability +than non-ISO CAN FD. The non-ISO CAN FD is still supported by FlexCAN so +that it can be used mainly during an intermediate phase, for evaluation +and development purposes. + +Therefore, it is strongly recommended to configure FlexCAN to the ISO +CAN FD protocol by setting the ISOCANFDEN field in the CTRL2 register. + +NOTE: If you only set "fd on", driver will use ISO FD mode by default. +You should set "fd-non-iso on" after setting "fd on" if you want to use +NON ISO FD mode. + +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20190712075926.7357-6-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 30 ++++++++++++++++++++++++------ + 1 file changed, 24 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 8dca553fa545..e3ecce80eadb 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -94,6 +94,7 @@ + #define FLEXCAN_CTRL2_MRP BIT(18) + #define FLEXCAN_CTRL2_RRS BIT(17) + #define FLEXCAN_CTRL2_EACEN BIT(16) ++#define FLEXCAN_CTRL2_ISOCANFDEN BIT(12) + + /* FLEXCAN memory error control register (MECR) bits */ + #define FLEXCAN_MECR_ECRWRDIS BIT(31) +@@ -1165,7 +1166,7 @@ static void flexcan_set_bittiming_cbt(const struct net_device *dev) + priv->write(reg_cbt, ®s->cbt); + + if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { +- u32 reg_fdcbt; ++ u32 reg_fdcbt, reg_ctrl2; + + if (bt->brp != dbt->brp) + netdev_warn(dev, "Data brp=%d and brp=%d don't match, this may result in a phase error. Consider using different bitrate and/or data bitrate.\n", +@@ -1184,7 +1185,14 @@ static void flexcan_set_bittiming_cbt(const struct net_device *dev) + dbt->phase_seg1 = 0x8; + } + +- reg_fdcbt = FIELD_PREP(FLEXCAN_FDCBT_FPRESDIV_MASK, dbt->brp - 1) | ++ reg_fdcbt = priv->read(®s->fdcbt); ++ reg_fdcbt &= ~(FIELD_PREP(FLEXCAN_FDCBT_FPRESDIV_MASK, 0x3ff) | ++ FIELD_PREP(FLEXCAN_FDCBT_FRJW_MASK, 0x7) | ++ FIELD_PREP(FLEXCAN_FDCBT_FPROPSEG_MASK, 0x1f) | ++ FIELD_PREP(FLEXCAN_FDCBT_FPSEG1_MASK, 0x7) | ++ FIELD_PREP(FLEXCAN_FDCBT_FPSEG2_MASK, 0x7)); ++ ++ reg_fdcbt |= FIELD_PREP(FLEXCAN_FDCBT_FPRESDIV_MASK, dbt->brp - 1) | + FIELD_PREP(FLEXCAN_FDCBT_FRJW_MASK, dbt->sjw - 1) | + FIELD_PREP(FLEXCAN_FDCBT_FPROPSEG_MASK, dbt->prop_seg) | + FIELD_PREP(FLEXCAN_FDCBT_FPSEG1_MASK, dbt->phase_seg1 - 1) | +@@ -1192,6 +1200,15 @@ static void flexcan_set_bittiming_cbt(const struct net_device *dev) + + netdev_dbg(dev, "writing fdcbt=0x%08x\n", reg_fdcbt); + priv->write(reg_fdcbt, ®s->fdcbt); ++ ++ /* CTRL2 */ ++ reg_ctrl2 = priv->read(®s->ctrl2); ++ reg_ctrl2 &= ~FLEXCAN_CTRL2_ISOCANFDEN; ++ if (!(priv->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO)) ++ reg_ctrl2 |= FLEXCAN_CTRL2_ISOCANFDEN; ++ ++ netdev_dbg(dev, "writing ctrl2=0x%08x\n", reg_ctrl2); ++ priv->write(reg_ctrl2, ®s->ctrl2); + } + + /* FDCTRL */ +@@ -1204,11 +1221,11 @@ static void flexcan_set_bittiming_cbt(const struct net_device *dev) + netdev_dbg(dev, "writing fdctrl=0x%08x\n", reg_fdctrl); + priv->write(reg_fdctrl, ®s->fdctrl); + +- netdev_dbg(dev, "%s: mcr=0x%08x ctrl=0x%08x fdctrl=0x%08x cbt=0x%08x fdcbt=0x%08x\n", ++ netdev_dbg(dev, "%s: mcr=0x%08x ctrl=0x%08x ctrl2=0x%08x fdctrl=0x%08x cbt=0x%08x fdcbt=0x%08x\n", + __func__, + priv->read(®s->mcr), priv->read(®s->ctrl), +- priv->read(®s->fdctrl), priv->read(®s->cbt), +- priv->read(®s->fdcbt)); ++ priv->read(®s->ctrl2), priv->read(®s->fdctrl), ++ priv->read(®s->cbt), priv->read(®s->fdcbt)); + } + + static void flexcan_set_bittiming(struct net_device *dev) +@@ -1911,7 +1928,8 @@ static int flexcan_probe(struct platform_device *pdev) + priv->reg_xceiver = reg_xceiver; + + if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SUPPORT_FD) { +- priv->can.ctrlmode_supported |= CAN_CTRLMODE_FD; ++ priv->can.ctrlmode_supported |= CAN_CTRLMODE_FD | ++ CAN_CTRLMODE_FD_NON_ISO; + priv->can.bittiming_const = &flexcan_fd_bittiming_const; + priv->can.data_bittiming_const = + &flexcan_fd_data_bittiming_const; +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-add-LPSR-mode-support.patch b/patches.suse/can-flexcan-add-LPSR-mode-support.patch new file mode 100644 index 0000000..b0a369f --- /dev/null +++ b/patches.suse/can-flexcan-add-LPSR-mode-support.patch @@ -0,0 +1,102 @@ +From: Joakim Zhang +Date: Wed, 4 Dec 2019 11:36:19 +0000 +Subject: can: flexcan: add LPSR mode support + +Git-commit: 1434d04349626d7b4da49b99f79d6391b9a67f16 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +On the i.MX7D in LPSR mode, the controller will be powered off and the +configuration state is lost after system resume. Upcoming i.MX8QM/QXP +will also completely power off the domain, the controller state is lost +and needs restore, too. So we need to set the pinctrl state again and +re-start chip to re-configuration after resume. + +For the wakeup case, it should not set pinctrl to sleep state by +pinctrl_pm_select_sleep_state. + +If the interface is down before suspend, we don't need to re-configure +it as it will be configured if the interface is brought up later. + +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20191204113249.3381-7-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 23 +++++++++++++++++------ + 1 file changed, 17 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index ed2ead7c21ef..35d0fa59e957 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1742,7 +1743,7 @@ static int __maybe_unused flexcan_suspend(struct device *device) + { + struct net_device *dev = dev_get_drvdata(device); + struct flexcan_priv *priv = netdev_priv(dev); +- int err = 0; ++ int err; + + if (netif_running(dev)) { + /* if wakeup is enabled, enter stop mode +@@ -1754,7 +1755,11 @@ static int __maybe_unused flexcan_suspend(struct device *device) + if (err) + return err; + } else { +- err = flexcan_chip_disable(priv); ++ err = flexcan_chip_stop(dev); ++ if (err) ++ return err; ++ ++ err = pinctrl_pm_select_sleep_state(device); + if (err) + return err; + } +@@ -1763,14 +1768,14 @@ static int __maybe_unused flexcan_suspend(struct device *device) + } + priv->can.state = CAN_STATE_SLEEPING; + +- return err; ++ return 0; + } + + static int __maybe_unused flexcan_resume(struct device *device) + { + struct net_device *dev = dev_get_drvdata(device); + struct flexcan_priv *priv = netdev_priv(dev); +- int err = 0; ++ int err; + + priv->can.state = CAN_STATE_ERROR_ACTIVE; + if (netif_running(dev)) { +@@ -1782,11 +1787,17 @@ static int __maybe_unused flexcan_resume(struct device *device) + if (err) + return err; + } else { +- err = flexcan_chip_enable(priv); ++ err = pinctrl_pm_select_default_state(device); ++ if (err) ++ return err; ++ ++ err = flexcan_chip_start(dev); ++ if (err) ++ return err; + } + } + +- return err; ++ return 0; + } + + static int __maybe_unused flexcan_runtime_suspend(struct device *device) +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-add-Transceiver-Delay-Compensation-suppo.patch b/patches.suse/can-flexcan-add-Transceiver-Delay-Compensation-suppo.patch new file mode 100644 index 0000000..f063415 --- /dev/null +++ b/patches.suse/can-flexcan-add-Transceiver-Delay-Compensation-suppo.patch @@ -0,0 +1,69 @@ +From: Joakim Zhang +Date: Fri, 12 Jul 2019 08:02:56 +0000 +Subject: can: flexcan: add Transceiver Delay Compensation support + +Git-commit: ef5f6312087e18ce55cbd067c7c12e7e7e3fb528 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +The CAN-FD protocol allows the transmission and reception of data at a +higher bit rate than the nominal rate used in the arbitration phase when +the message's BRS bit is set. + +The TDC mechanism is effective only during the data phase of FD frames +having BRS bit set. It has no effect either on non-FD frames, or on FD +frames transmitted at normal bit rate. + +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20190712075926.7357-7-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 21 +++++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index fc0e9d5fd02b..fc98b5d521f2 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -156,6 +156,10 @@ + #define FLEXCAN_FDCTRL_MBDSR_12 0x1 + #define FLEXCAN_FDCTRL_MBDSR_32 0x2 + #define FLEXCAN_FDCTRL_MBDSR_64 0x3 ++#define FLEXCAN_FDCTRL_TDCEN BIT(15) ++#define FLEXCAN_FDCTRL_TDCFAIL BIT(14) ++#define FLEXCAN_FDCTRL_TDCOFF GENMASK(12, 8) ++#define FLEXCAN_FDCTRL_TDCVAL GENMASK(5, 0) + + /* FLEXCAN FD Bit Timing register (FDCBT) bits */ + #define FLEXCAN_FDCBT_FPRESDIV_MASK GENMASK(29, 20) +@@ -1220,11 +1224,24 @@ static void flexcan_set_bittiming_cbt(const struct net_device *dev) + + /* FDCTRL */ + reg_fdctrl = priv->read(®s->fdctrl); +- reg_fdctrl &= ~FLEXCAN_FDCTRL_FDRATE; ++ reg_fdctrl &= ~(FLEXCAN_FDCTRL_FDRATE | ++ FIELD_PREP(FLEXCAN_FDCTRL_TDCOFF, 0x1f)); + +- if (priv->can.ctrlmode & CAN_CTRLMODE_FD) ++ if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { + reg_fdctrl |= FLEXCAN_FDCTRL_FDRATE; + ++ if (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK) { ++ /* TDC must be disabled for Loop Back mode */ ++ reg_fdctrl &= ~FLEXCAN_FDCTRL_TDCEN; ++ } else { ++ reg_fdctrl |= FLEXCAN_FDCTRL_TDCEN | ++ FIELD_PREP(FLEXCAN_FDCTRL_TDCOFF, ++ ((dbt->phase_seg1 - 1) + ++ dbt->prop_seg + 2) * ++ ((dbt->brp - 1 ) + 1)); ++ } ++ } ++ + netdev_dbg(dev, "writing fdctrl=0x%08x\n", reg_fdctrl); + priv->write(reg_fdctrl, ®s->fdctrl); + +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-add-correctable-errors-correction-when-H.patch b/patches.suse/can-flexcan-add-correctable-errors-correction-when-H.patch new file mode 100644 index 0000000..b8f08b0 --- /dev/null +++ b/patches.suse/can-flexcan-add-correctable-errors-correction-when-H.patch @@ -0,0 +1,107 @@ +From: Joakim Zhang +Date: Thu, 16 Apr 2020 17:31:25 +0800 +Subject: can: flexcan: add correctable errors correction when HW supports ECC + +Git-commit: 15ef2072189ce1191b6315c5ed97b6f8cd7bbc84 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +commit cdce844865be ("can: flexcan: add vf610 support for FlexCAN") +From above commit by Stefan Agner, the patch just disables +non-correctable errors interrupt and freeze mode. It still can correct +the correctable errors since ECC enabled by default after reset (MECR[ECCDIS]=0, +enable memory error correct) if HW supports ECC. + +commit 5e269324db5a ("can: flexcan: disable completely the ECC mechanism") +From above commit by Joakim Zhang, the patch disables ECC completely (assert +MECR[ECCDIS]) according to the explanation of FLEXCAN_QUIRK_DISABLE_MECR that +disable memory error detection. This cause correctable errors cannot be +corrected even HW supports ECC. + +The error correction mechanism ensures that in this 13-bit word, errors +in one bit can be corrected (correctable errors) and errors in two bits can +be detected but not corrected (non-correctable errors). Errors in more than +two bits may not be detected. + +If HW supports ECC, we can use this to correct the correctable errors detected +from FlexCAN memory. Then disable non-correctable errors interrupt and freeze +mode to avoid that put FlexCAN in freeze mode. + +This patch adds correctable errors correction when HW supports ECC, and +modify explanation for FLEXCAN_QUIRK_DISABLE_MECR. + +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20200416093126.15242-1-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 31 +++++++++++++++++++++++-------- + 1 file changed, 23 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 5c6903e23c01..52d73115c7fd 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -190,7 +190,7 @@ + #define FLEXCAN_QUIRK_DISABLE_RXFG BIT(2) + /* Enable EACEN and RRS bit in ctrl2 */ + #define FLEXCAN_QUIRK_ENABLE_EACEN_RRS BIT(3) +-/* Disable Memory error detection */ ++/* Disable non-correctable errors interrupt and freeze mode */ + #define FLEXCAN_QUIRK_DISABLE_MECR BIT(4) + /* Use timestamp based offloading */ + #define FLEXCAN_QUIRK_USE_OFF_TIMESTAMP BIT(5) +@@ -1221,28 +1221,43 @@ static int flexcan_chip_start(struct net_device *dev) + for (i = 0; i < priv->mb_count; i++) + priv->write(0, ®s->rximr[i]); + +- /* On Vybrid, disable memory error detection interrupts +- * and freeze mode. +- * This also works around errata e5295 which generates +- * false positive memory errors and put the device in +- * freeze mode. ++ /* On Vybrid, disable non-correctable errors interrupt and ++ * freeze mode. It still can correct the correctable errors ++ * when HW supports ECC. ++ * ++ * This also works around errata e5295 which generates false ++ * positive memory errors and put the device in freeze mode. + */ + if (priv->devtype_data->quirks & FLEXCAN_QUIRK_DISABLE_MECR) { + /* Follow the protocol as described in "Detection + * and Correction of Memory Errors" to write to +- * MECR register ++ * MECR register (step 1 - 5) ++ * ++ * 1. By default, CTRL2[ECRWRE] = 0, MECR[ECRWRDIS] = 1 ++ * 2. set CTRL2[ECRWRE] + */ + reg_ctrl2 = priv->read(®s->ctrl2); + reg_ctrl2 |= FLEXCAN_CTRL2_ECRWRE; + priv->write(reg_ctrl2, ®s->ctrl2); + ++ /* 3. clear MECR[ECRWRDIS] */ + reg_mecr = priv->read(®s->mecr); + reg_mecr &= ~FLEXCAN_MECR_ECRWRDIS; + priv->write(reg_mecr, ®s->mecr); +- reg_mecr |= FLEXCAN_MECR_ECCDIS; ++ ++ /* 4. all writes to MECR must keep MECR[ECRWRDIS] cleared */ + reg_mecr &= ~(FLEXCAN_MECR_NCEFAFRZ | FLEXCAN_MECR_HANCEI_MSK | + FLEXCAN_MECR_FANCEI_MSK); + priv->write(reg_mecr, ®s->mecr); ++ ++ /* 5. after configuration done, lock MECR by either ++ * setting MECR[ECRWRDIS] or clearing CTRL2[ECRWRE] ++ */ ++ reg_mecr |= FLEXCAN_MECR_ECRWRDIS; ++ priv->write(reg_mecr, ®s->mecr); ++ ++ reg_ctrl2 &= ~FLEXCAN_CTRL2_ECRWRE; ++ priv->write(reg_ctrl2, ®s->ctrl2); + } + + err = flexcan_transceiver_enable(priv); +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-add-flexcan-driver-for-i.MX8MP.patch b/patches.suse/can-flexcan-add-flexcan-driver-for-i.MX8MP.patch new file mode 100644 index 0000000..c7d5396 --- /dev/null +++ b/patches.suse/can-flexcan-add-flexcan-driver-for-i.MX8MP.patch @@ -0,0 +1,55 @@ +From: Joakim Zhang +Date: Wed, 30 Sep 2020 05:15:56 +0800 +Subject: can: flexcan: add flexcan driver for i.MX8MP + +Git-commit: 3aa2539536b323d17b12ebc15b1fbfdd33f020f7 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +Add flexcan driver for i.MX8MP, which supports CAN FD and ECC. + +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20200929211557.14153-3-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 19a29618f0c0..9cf1de42f428 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -214,6 +214,7 @@ + * MX53 FlexCAN2 03.00.00.00 yes no no no no no + * MX6s FlexCAN3 10.00.12.00 yes yes no no yes no + * MX8QM FlexCAN3 03.00.23.00 yes yes no no yes yes ++ * MX8MP FlexCAN3 03.00.17.01 yes yes no yes yes yes + * VF610 FlexCAN3 ? no yes no yes yes? no + * LS1021A FlexCAN2 03.00.04.00 no yes no no yes no + * LX2160A FlexCAN3 03.00.23.00 no yes no no yes yes +@@ -391,6 +392,13 @@ static const struct flexcan_devtype_data fsl_imx8qm_devtype_data = { + FLEXCAN_QUIRK_SUPPORT_FD, + }; + ++static struct flexcan_devtype_data fsl_imx8mp_devtype_data = { ++ .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | ++ FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | ++ FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SETUP_STOP_MODE | ++ FLEXCAN_QUIRK_SUPPORT_FD | FLEXCAN_QUIRK_SUPPORT_ECC, ++}; ++ + static const struct flexcan_devtype_data fsl_vf610_devtype_data = { + .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | + FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | +@@ -1894,6 +1902,7 @@ static int flexcan_setup_stop_mode(struct platform_device *pdev) + + static const struct of_device_id flexcan_of_match[] = { + { .compatible = "fsl,imx8qm-flexcan", .data = &fsl_imx8qm_devtype_data, }, ++ { .compatible = "fsl,imx8mp-flexcan", .data = &fsl_imx8mp_devtype_data, }, + { .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, }, + { .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, }, + { .compatible = "fsl,imx53-flexcan", .data = &fsl_imx25_devtype_data, }, +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-add-imx8qm-support.patch b/patches.suse/can-flexcan-add-imx8qm-support.patch new file mode 100644 index 0000000..60ea924 --- /dev/null +++ b/patches.suse/can-flexcan-add-imx8qm-support.patch @@ -0,0 +1,72 @@ +From: Joakim Zhang +Date: Fri, 12 Jul 2019 08:02:59 +0000 +Subject: can: flexcan: add imx8qm support + +Git-commit: 2a1993eadf8c66228e5777fbf507efeef8d82f7d +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +The Flexcan on i.MX8QM supports CAN FD protocol. + +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20190712075926.7357-8-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 26 +++++++++++++++++--------- + 1 file changed, 17 insertions(+), 9 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index fc98b5d521f2..5f778c961a0c 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -206,15 +206,16 @@ + /* FLEXCAN hardware feature flags + * + * Below is some version info we got: +- * SOC Version IP-Version Glitch- [TR]WRN_INT IRQ Err Memory err RTR re- +- * Filter? connected? Passive detection ception in MB +- * MX25 FlexCAN2 03.00.00.00 no no no no no +- * MX28 FlexCAN2 03.00.04.00 yes yes no no no +- * MX35 FlexCAN2 03.00.00.00 no no no no no +- * MX53 FlexCAN2 03.00.00.00 yes no no no no +- * MX6s FlexCAN3 10.00.12.00 yes yes no no yes +- * VF610 FlexCAN3 ? no yes no yes yes? +- * LS1021A FlexCAN2 03.00.04.00 no yes no no yes ++ * SOC Version IP-Version Glitch- [TR]WRN_INT IRQ Err Memory err RTR rece- FD Mode ++ * Filter? connected? Passive detection ption in MB Supported? ++ * MX25 FlexCAN2 03.00.00.00 no no no no no no ++ * MX28 FlexCAN2 03.00.04.00 yes yes no no no no ++ * MX35 FlexCAN2 03.00.00.00 no no no no no no ++ * MX53 FlexCAN2 03.00.00.00 yes no no no no no ++ * MX6s FlexCAN3 10.00.12.00 yes yes no no yes no ++ * MX8QM FlexCAN3 03.00.23.00 yes yes no no yes yes ++ * VF610 FlexCAN3 ? no yes no yes yes? no ++ * LS1021A FlexCAN2 03.00.04.00 no yes no no yes no + * + * Some SOCs do not have the RX_WARN & TX_WARN interrupt line connected. + */ +@@ -368,6 +369,12 @@ static const struct flexcan_devtype_data fsl_imx6q_devtype_data = { + FLEXCAN_QUIRK_SETUP_STOP_MODE, + }; + ++static const struct flexcan_devtype_data fsl_imx8qm_devtype_data = { ++ .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | ++ FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | FLEXCAN_QUIRK_BROKEN_PERR_STATE | ++ FLEXCAN_QUIRK_SUPPORT_FD, ++}; ++ + static const struct flexcan_devtype_data fsl_vf610_devtype_data = { + .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | + FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | +@@ -1830,6 +1837,7 @@ static int flexcan_setup_stop_mode(struct platform_device *pdev) + } + + static const struct of_device_id flexcan_of_match[] = { ++ { .compatible = "fsl,imx8qm-flexcan", .data = &fsl_imx8qm_devtype_data, }, + { .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, }, + { .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, }, + { .compatible = "fsl,imx53-flexcan", .data = &fsl_imx25_devtype_data, }, +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-add-lx2160ar1-support.patch b/patches.suse/can-flexcan-add-lx2160ar1-support.patch new file mode 100644 index 0000000..533ed3a --- /dev/null +++ b/patches.suse/can-flexcan-add-lx2160ar1-support.patch @@ -0,0 +1,54 @@ +From: Joakim Zhang +Date: Fri, 12 Jul 2019 08:03:01 +0000 +Subject: can: flexcan: add lx2160ar1 support + +Git-commit: 2c19bb43e5572929f00f186d43e99bfd6d7ee3b2 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +The Flexcan on lx2160ar1 supports CAN FD protocol. + +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20190712075926.7357-9-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 5f778c961a0c..e86925134009 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -216,6 +216,7 @@ + * MX8QM FlexCAN3 03.00.23.00 yes yes no no yes yes + * VF610 FlexCAN3 ? no yes no yes yes? no + * LS1021A FlexCAN2 03.00.04.00 no yes no no yes no ++ * LX2160A FlexCAN3 03.00.23.00 no yes no no yes yes + * + * Some SOCs do not have the RX_WARN & TX_WARN interrupt line connected. + */ +@@ -387,6 +388,12 @@ static const struct flexcan_devtype_data fsl_ls1021a_r2_devtype_data = { + FLEXCAN_QUIRK_USE_OFF_TIMESTAMP, + }; + ++static const struct flexcan_devtype_data fsl_lx2160a_r1_devtype_data = { ++ .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | ++ FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_BROKEN_PERR_STATE | ++ FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | FLEXCAN_QUIRK_SUPPORT_FD, ++}; ++ + static const struct can_bittiming_const flexcan_bittiming_const = { + .name = DRV_NAME, + .tseg1_min = 4, +@@ -1846,6 +1853,7 @@ static const struct of_device_id flexcan_of_match[] = { + { .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, }, + { .compatible = "fsl,vf610-flexcan", .data = &fsl_vf610_devtype_data, }, + { .compatible = "fsl,ls1021ar2-flexcan", .data = &fsl_ls1021a_r2_devtype_data, }, ++ { .compatible = "fsl,lx2160ar1-flexcan", .data = &fsl_lx2160a_r1_devtype_data, }, + { /* sentinel */ }, + }; + MODULE_DEVICE_TABLE(of, flexcan_of_match); +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-add-support-for-DT-property-wakeup-sourc.patch b/patches.suse/can-flexcan-add-support-for-DT-property-wakeup-sourc.patch new file mode 100644 index 0000000..f4b6929 --- /dev/null +++ b/patches.suse/can-flexcan-add-support-for-DT-property-wakeup-sourc.patch @@ -0,0 +1,33 @@ +From: Sean Nyekjaer +Date: Tue, 9 Apr 2019 10:39:48 +0200 +Subject: can: flexcan: add support for DT property 'wakeup-source' + +Git-commit: 915f9666421cf65cc30668fd42760b6f78f9744d +Patch-mainline: v5.4-rc1 +References: jsc#SLE-12251 + +The flexcan controller can be forced as a wakeup source by +stating that explicitly in the device's .dts file using the +"wakeup-source" boolean property. + +Signed-off-by: Sean Nyekjaer +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -1491,6 +1491,11 @@ static int flexcan_setup_stop_mode(struc + + device_set_wakeup_capable(&pdev->dev, true); + ++ if (of_property_read_bool(np, "wakeup-source")) ++ device_set_wakeup_enable(&pdev->dev, true); ++ ++ return 0; ++ + out_put_node: + of_node_put(gpr_np); + return ret; diff --git a/patches.suse/can-flexcan-add-support-for-PE-clock-source-select.patch b/patches.suse/can-flexcan-add-support-for-PE-clock-source-select.patch new file mode 100644 index 0000000..17c8233 --- /dev/null +++ b/patches.suse/can-flexcan-add-support-for-PE-clock-source-select.patch @@ -0,0 +1,79 @@ +From: Dong Aisheng +Date: Thu, 13 Dec 2018 07:08:00 +0000 +Subject: can: flexcan: add support for PE clock source select + +Git-commit: 8c306bec2d09c8436eea989b1be2a381cae93418 +Patch-mainline: v5.4-rc1 +References: jsc#SLE-12251 + +Add support to select the clock source for CAN Protocol Engine (PE). +It's SoC Implementation dependent. Refer to RM for detailed definition +of each SoC. We select clock source 1 (peripheral clock) by default in +driver now, this patch adds support to parse the clock source from the DT. + +Signed-off-by: Dong Aisheng +Signed-off-by: Joakim Zhang +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 228ac5d1f3b4..bcc39512f342 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -275,6 +275,8 @@ struct flexcan_priv { + u8 tx_mb_idx; + u8 mb_count; + u8 mb_size; ++ u8 clk_src; /* clock source of CAN Protocol Engine */ ++ + u32 reg_ctrl_default; + u32 reg_imask1_default; + u32 reg_imask2_default; +@@ -1369,7 +1371,10 @@ static int register_flexcandev(struct net_device *dev) + goto out_clks_disable; + + reg = priv->read(®s->ctrl); +- reg |= FLEXCAN_CTRL_CLK_SRC; ++ if (priv->clk_src) ++ reg |= FLEXCAN_CTRL_CLK_SRC; ++ else ++ reg &= ~FLEXCAN_CTRL_CLK_SRC; + priv->write(reg, ®s->ctrl); + + err = flexcan_chip_enable(priv); +@@ -1501,6 +1506,7 @@ static int flexcan_probe(struct platform_device *pdev) + struct clk *clk_ipg = NULL, *clk_per = NULL; + struct flexcan_regs __iomem *regs; + int err, irq; ++ u8 clk_src = 1; + u32 clock_freq = 0; + + reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver"); +@@ -1509,9 +1515,12 @@ static int flexcan_probe(struct platform_device *pdev) + else if (IS_ERR(reg_xceiver)) + reg_xceiver = NULL; + +- if (pdev->dev.of_node) ++ if (pdev->dev.of_node) { + of_property_read_u32(pdev->dev.of_node, + "clock-frequency", &clock_freq); ++ of_property_read_u8(pdev->dev.of_node, ++ "fsl,clk-source", &clk_src); ++ } + + if (!clock_freq) { + clk_ipg = devm_clk_get(&pdev->dev, "ipg"); +@@ -1580,6 +1589,7 @@ static int flexcan_probe(struct platform_device *pdev) + priv->regs = regs; + priv->clk_ipg = clk_ipg; + priv->clk_per = clk_per; ++ priv->clk_src = clk_src; + priv->devtype_data = devtype_data; + priv->reg_xceiver = reg_xceiver; + +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-convert-struct-flexcan_priv-rx_mask-1-2-.patch b/patches.suse/can-flexcan-convert-struct-flexcan_priv-rx_mask-1-2-.patch new file mode 100644 index 0000000..7b3fc0a --- /dev/null +++ b/patches.suse/can-flexcan-convert-struct-flexcan_priv-rx_mask-1-2-.patch @@ -0,0 +1,115 @@ +From: Marc Kleine-Budde +Date: Fri, 1 Mar 2019 12:17:30 +0100 +Subject: can: flexcan: convert struct flexcan_priv::rx_mask{1,2} to rx_mask + +Git-commit: 8ce5139e3db829d53c2f33ff812cea4f1f075e9c +Patch-mainline: v5.5-rc1 +References: jsc#SLE-12251 + +The flexcan IP core has up to 64 mailboxes, each one has a corresponding +interrupt bit in the iflag1 or iflag2 registers and a mask bit in the +imask1 or imask2 registers. + +In the timestamp (i.e. non FIFO) mode the driver needs to mask out all non RX +interrupt sources and uses the precomputed values rx_mask1 and rx_mask2 of +struct flexcan_priv for this. + +This patch merges the two u32 rx_mask1 and rx_mask2 to a single u64 rx_mask +variable, which simplifies the code a bit. + +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 30 +++++++++++++----------------- + 1 file changed, 13 insertions(+), 17 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 29d1dbe89351..c3fdd47c5cdb 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -142,6 +142,7 @@ + #define FLEXCAN_TX_MB_RESERVED_OFF_FIFO 8 + #define FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP 0 + #define FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST (FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP + 1) ++#define FLEXCAN_IFLAG_MB(x) BIT_ULL(x) + #define FLEXCAN_IFLAG2_MB(x) BIT((x) & 0x1f) + #define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7) + #define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6) +@@ -277,9 +278,8 @@ struct flexcan_priv { + u8 mb_size; + u8 clk_src; /* clock source of CAN Protocol Engine */ + ++ u64 rx_mask; + u32 reg_ctrl_default; +- u32 rx_mask1; +- u32 rx_mask2; + + struct clk *clk_ipg; + struct clk *clk_per; +@@ -872,16 +872,15 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload, + return skb; + } + +- + static inline u64 flexcan_read_reg_iflag_rx(struct flexcan_priv *priv) + { + struct flexcan_regs __iomem *regs = priv->regs; +- u32 iflag1, iflag2; ++ u64 iflag; + +- iflag2 = priv->read(®s->iflag2) & priv->rx_mask2; +- iflag1 = priv->read(®s->iflag1) & priv->rx_mask1; ++ iflag = (u64)priv->read(®s->iflag2) << 32 | ++ priv->read(®s->iflag1); + +- return (u64)iflag2 << 32 | iflag1; ++ return iflag & priv->rx_mask; + } + + static irqreturn_t flexcan_irq(int irq, void *dev_id) +@@ -1052,6 +1051,7 @@ static int flexcan_chip_start(struct net_device *dev) + struct flexcan_priv *priv = netdev_priv(dev); + struct flexcan_regs __iomem *regs = priv->regs; + u32 reg_mcr, reg_ctrl, reg_ctrl2, reg_mecr; ++ u64 reg_imask; + int err, i; + struct flexcan_mb __iomem *mb; + +@@ -1226,8 +1226,9 @@ static int flexcan_chip_start(struct net_device *dev) + /* enable interrupts atomically */ + disable_irq(dev->irq); + priv->write(priv->reg_ctrl_default, ®s->ctrl); +- priv->write(priv->rx_mask1, ®s->imask1); +- priv->write(priv->rx_mask2 | FLEXCAN_IFLAG2_MB(priv->tx_mb_idx), ®s->imask2); ++ reg_imask = priv->rx_mask | FLEXCAN_IFLAG_MB(priv->tx_mb_idx); ++ priv->write(upper_32_bits(reg_imask), ®s->imask2); ++ priv->write(lower_32_bits(reg_imask), ®s->imask1); + enable_irq(dev->irq); + + /* print chip status */ +@@ -1299,19 +1300,14 @@ static int flexcan_open(struct net_device *dev) + priv->offload.mailbox_read = flexcan_mailbox_read; + + if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { +- u64 imask; +- + priv->offload.mb_first = FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST; + priv->offload.mb_last = priv->mb_count - 2; + +- imask = GENMASK_ULL(priv->offload.mb_last, +- priv->offload.mb_first); +- priv->rx_mask1 = imask; +- priv->rx_mask2 = imask >> 32; +- ++ priv->rx_mask = GENMASK_ULL(priv->offload.mb_last, ++ priv->offload.mb_first); + err = can_rx_offload_add_timestamp(dev, &priv->offload); + } else { +- priv->rx_mask1 = FLEXCAN_IFLAG_RX_FIFO_OVERFLOW | ++ priv->rx_mask = FLEXCAN_IFLAG_RX_FIFO_OVERFLOW | + FLEXCAN_IFLAG_RX_FIFO_AVAILABLE; + err = can_rx_offload_add_fifo(dev, &priv->offload, + FLEXCAN_NAPI_WEIGHT); +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-convert-the-driver-to-DT-only.patch b/patches.suse/can-flexcan-convert-the-driver-to-DT-only.patch new file mode 100644 index 0000000..5fd85bb --- /dev/null +++ b/patches.suse/can-flexcan-convert-the-driver-to-DT-only.patch @@ -0,0 +1,68 @@ +From: Fabio Estevam +Date: Sat, 28 Nov 2020 10:28:55 -0300 +Subject: can: flexcan: convert the driver to DT-only + +Git-commit: 2c0ac9208135c75b9afec67b2819329ff41a5355 +Patch-mainline: v5.11-rc1 +References: jsc#SLE-12251 + +The flexcan driver runs only on DT platforms, so simplify the code by using +of_device_get_match_data() to retrieve the driver data and also by removing the +unused id_table. + +Signed-off-by: Fabio Estevam +Link: https://lore.kernel.org/r/20201128132855.7724-1-festevam@gmail.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 18 +----------------- + 1 file changed, 1 insertion(+), 17 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index e85f20d18d67..038fe1036df2 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -1940,15 +1940,8 @@ static const struct of_device_id flexcan_of_match[] = { + }; + MODULE_DEVICE_TABLE(of, flexcan_of_match); + +-static const struct platform_device_id flexcan_id_table[] = { +- { .name = "flexcan", .driver_data = (kernel_ulong_t)&fsl_p1010_devtype_data, }, +- { /* sentinel */ }, +-}; +-MODULE_DEVICE_TABLE(platform, flexcan_id_table); +- + static int flexcan_probe(struct platform_device *pdev) + { +- const struct of_device_id *of_id; + const struct flexcan_devtype_data *devtype_data; + struct net_device *dev; + struct flexcan_priv *priv; +@@ -1997,15 +1990,7 @@ static int flexcan_probe(struct platform_device *pdev) + if (IS_ERR(regs)) + return PTR_ERR(regs); + +- of_id = of_match_device(flexcan_of_match, &pdev->dev); +- if (of_id) { +- devtype_data = of_id->data; +- } else if (platform_get_device_id(pdev)->driver_data) { +- devtype_data = (struct flexcan_devtype_data *) +- platform_get_device_id(pdev)->driver_data; +- } else { +- return -ENODEV; +- } ++ devtype_data = of_device_get_match_data(&pdev->dev); + + if ((devtype_data->quirks & FLEXCAN_QUIRK_SUPPORT_FD) && + !(devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP)) { +@@ -2235,7 +2220,6 @@ static struct platform_driver flexcan_driver = { + }, + .probe = flexcan_probe, + .remove = flexcan_remove, +- .id_table = flexcan_id_table, + }; + + module_platform_driver(flexcan_driver); +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-disable-clocks-during-stop-mode.patch b/patches.suse/can-flexcan-disable-clocks-during-stop-mode.patch new file mode 100644 index 0000000..4286d73 --- /dev/null +++ b/patches.suse/can-flexcan-disable-clocks-during-stop-mode.patch @@ -0,0 +1,84 @@ +From: Joakim Zhang +Date: Tue, 10 Dec 2019 09:00:13 +0000 +Subject: can: flexcan: disable clocks during stop mode + +Git-commit: 02f71c6605e1f8259c07f16178330db766189a74 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +Disable clocks while CAN core is in stop mode. + +Signed-off-by: Joakim Zhang +Tested-by: Sean Nyekjaer +Link: https://lore.kernel.org/r/20191210085721.9853-2-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 30 ++++++++++++++++++++---------- + 1 file changed, 20 insertions(+), 10 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 4be73ce7518e..ed2ead7c21ef 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -1757,8 +1757,6 @@ static int __maybe_unused flexcan_suspend(struct device *device) + err = flexcan_chip_disable(priv); + if (err) + return err; +- +- err = pm_runtime_force_suspend(device); + } + netif_stop_queue(dev); + netif_device_detach(dev); +@@ -1784,10 +1782,6 @@ static int __maybe_unused flexcan_resume(struct device *device) + if (err) + return err; + } else { +- err = pm_runtime_force_resume(device); +- if (err) +- return err; +- + err = flexcan_chip_enable(priv); + } + } +@@ -1818,8 +1812,16 @@ static int __maybe_unused flexcan_noirq_suspend(struct device *device) + struct net_device *dev = dev_get_drvdata(device); + struct flexcan_priv *priv = netdev_priv(dev); + +- if (netif_running(dev) && device_may_wakeup(device)) +- flexcan_enable_wakeup_irq(priv, true); ++ if (netif_running(dev)) { ++ int err; ++ ++ if (device_may_wakeup(device)) ++ flexcan_enable_wakeup_irq(priv, true); ++ ++ err = pm_runtime_force_suspend(device); ++ if (err) ++ return err; ++ } + + return 0; + } +@@ -1829,8 +1831,16 @@ static int __maybe_unused flexcan_noirq_resume(struct device *device) + struct net_device *dev = dev_get_drvdata(device); + struct flexcan_priv *priv = netdev_priv(dev); + +- if (netif_running(dev) && device_may_wakeup(device)) +- flexcan_enable_wakeup_irq(priv, false); ++ if (netif_running(dev)) { ++ int err; ++ ++ err = pm_runtime_force_resume(device); ++ if (err) ++ return err; ++ ++ if (device_may_wakeup(device)) ++ flexcan_enable_wakeup_irq(priv, false); ++ } + + return 0; + } +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-disable-completely-the-ECC-mechanism.patch b/patches.suse/can-flexcan-disable-completely-the-ECC-mechanism.patch index 5122ca1..013524a 100644 --- a/patches.suse/can-flexcan-disable-completely-the-ECC-mechanism.patch +++ b/patches.suse/can-flexcan-disable-completely-the-ECC-mechanism.patch @@ -1,10 +1,10 @@ -From 5e269324db5adb2f5f6ec9a93a9c7b0672932b47 Mon Sep 17 00:00:00 2001 From: Joakim Zhang Date: Thu, 15 Aug 2019 08:00:26 +0000 -Subject: [PATCH] can: flexcan: disable completely the ECC mechanism +Subject: can: flexcan: disable completely the ECC mechanism + Git-commit: 5e269324db5adb2f5f6ec9a93a9c7b0672932b47 Patch-mainline: v5.4-rc7 -References: git-fixes bnc#1151927 5.3.11 +References: jsc#SLE-12251 The ECC (memory error detection and correction) mechanism can be activated or not, controlled by the ECCDIS bit in CAN_MECR. When @@ -16,8 +16,7 @@ Fixes: cdce844865be ("can: flexcan: add vf610 support for FlexCAN") Signed-off-by: Joakim Zhang Cc: linux-stable Signed-off-by: Marc Kleine-Budde -Acked-by: Takashi Iwai - +Signed-off-by: Mian Yousaf Kaukab --- drivers/net/can/flexcan.c | 1 + 1 file changed, 1 insertion(+) @@ -35,5 +34,5 @@ index dc5695dffc2e..1cd5179cb876 100644 FLEXCAN_MECR_FANCEI_MSK); priv->write(reg_mecr, ®s->mecr); -- -2.16.4 +2.26.2 diff --git a/patches.suse/can-flexcan-disable-runtime-PM-if-register-flexcande.patch b/patches.suse/can-flexcan-disable-runtime-PM-if-register-flexcande.patch new file mode 100644 index 0000000..39f570e --- /dev/null +++ b/patches.suse/can-flexcan-disable-runtime-PM-if-register-flexcande.patch @@ -0,0 +1,35 @@ +From: Joakim Zhang +Date: Wed, 30 Sep 2020 05:15:57 +0800 +Subject: can: flexcan: disable runtime PM if register flexcandev failed + +Git-commit: 5a9323f55d52c9246ce85f2c9c6a8ec45413b1d0 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +Disable runtime PM if register flexcandev failed, and balance reference +of usage_count. + +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20200929211557.14153-4-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 9cf1de42f428..fbdd9a8c9374 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -2057,6 +2057,8 @@ static int flexcan_probe(struct platform_device *pdev) + return 0; + + failed_register: ++ pm_runtime_put_noidle(&pdev->dev); ++ pm_runtime_disable(&pdev->dev); + free_candev(dev); + return err; + } +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-factor-out-enabling-and-disabling-of-int.patch b/patches.suse/can-flexcan-factor-out-enabling-and-disabling-of-int.patch new file mode 100644 index 0000000..d88246e --- /dev/null +++ b/patches.suse/can-flexcan-factor-out-enabling-and-disabling-of-int.patch @@ -0,0 +1,102 @@ +From: Marc Kleine-Budde +Date: Thu, 19 Nov 2020 11:09:13 +0100 +Subject: can: flexcan: factor out enabling and disabling of interrupts into + separate function + +Git-commit: 1c5e6dbe4c4f83bb44735656f52a501ebbe3281a +Patch-mainline: v5.11-rc1 +References: jsc#SLE-12251 + +The upcoming patches are going to move the enabling and disabling of the +interrupts. Introduce convenience functions to make these patches simpler. + +Link: https://lore.kernel.org/r/20201119100917.3013281-2-mkl@pengutronix.de +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 41 ++++++++++++++++++++++++++------------- + 1 file changed, 27 insertions(+), 14 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 56a6bcc6d9d7..681a4d82681c 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -1346,6 +1346,31 @@ static void flexcan_ram_init(struct net_device *dev) + priv->write(reg_ctrl2, ®s->ctrl2); + } + ++static void flexcan_chip_interrupts_enable(const struct net_device *dev) ++{ ++ const struct flexcan_priv *priv = netdev_priv(dev); ++ struct flexcan_regs __iomem *regs = priv->regs; ++ u64 reg_imask; ++ ++ disable_irq(dev->irq); ++ priv->write(priv->reg_ctrl_default, ®s->ctrl); ++ reg_imask = priv->rx_mask | priv->tx_mask; ++ priv->write(upper_32_bits(reg_imask), ®s->imask2); ++ priv->write(lower_32_bits(reg_imask), ®s->imask1); ++ enable_irq(dev->irq); ++} ++ ++static void flexcan_chip_interrupts_disable(const struct net_device *dev) ++{ ++ const struct flexcan_priv *priv = netdev_priv(dev); ++ struct flexcan_regs __iomem *regs = priv->regs; ++ ++ priv->write(0, ®s->imask2); ++ priv->write(0, ®s->imask1); ++ priv->write(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL, ++ ®s->ctrl); ++} ++ + /* flexcan_chip_start + * + * this functions is entered with clocks enabled +@@ -1356,7 +1381,6 @@ static int flexcan_chip_start(struct net_device *dev) + struct flexcan_priv *priv = netdev_priv(dev); + struct flexcan_regs __iomem *regs = priv->regs; + u32 reg_mcr, reg_ctrl, reg_ctrl2, reg_mecr; +- u64 reg_imask; + int err, i; + struct flexcan_mb __iomem *mb; + +@@ -1574,13 +1598,7 @@ static int flexcan_chip_start(struct net_device *dev) + + priv->can.state = CAN_STATE_ERROR_ACTIVE; + +- /* enable interrupts atomically */ +- disable_irq(dev->irq); +- priv->write(priv->reg_ctrl_default, ®s->ctrl); +- reg_imask = priv->rx_mask | priv->tx_mask; +- priv->write(upper_32_bits(reg_imask), ®s->imask2); +- priv->write(lower_32_bits(reg_imask), ®s->imask1); +- enable_irq(dev->irq); ++ flexcan_chip_interrupts_enable(dev); + + /* print chip status */ + netdev_dbg(dev, "%s: reading mcr=0x%08x ctrl=0x%08x\n", __func__, +@@ -1600,7 +1618,6 @@ static int flexcan_chip_start(struct net_device *dev) + static int __flexcan_chip_stop(struct net_device *dev, bool disable_on_error) + { + struct flexcan_priv *priv = netdev_priv(dev); +- struct flexcan_regs __iomem *regs = priv->regs; + int err; + + /* freeze + disable module */ +@@ -1611,11 +1628,7 @@ static int __flexcan_chip_stop(struct net_device *dev, bool disable_on_error) + if (err && !disable_on_error) + goto out_chip_unfreeze; + +- /* Disable all interrupts */ +- priv->write(0, ®s->imask2); +- priv->write(0, ®s->imask1); +- priv->write(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL, +- ®s->ctrl); ++ flexcan_chip_interrupts_disable(dev); + + priv->can.state = CAN_STATE_STOPPED; + +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-fix-failure-handling-of-pm_runtime_get_s.patch b/patches.suse/can-flexcan-fix-failure-handling-of-pm_runtime_get_s.patch new file mode 100644 index 0000000..07bc315 --- /dev/null +++ b/patches.suse/can-flexcan-fix-failure-handling-of-pm_runtime_get_s.patch @@ -0,0 +1,58 @@ +From: Zhang Qilong +Date: Sun, 8 Nov 2020 16:30:00 +0800 +Subject: can: flexcan: fix failure handling of pm_runtime_get_sync() + +Git-commit: b7ee5bc3e1006433601a058a6a7c24c5272635f4 +Patch-mainline: v5.10-rc5 +References: jsc#SLE-12251 + +pm_runtime_get_sync() will increment pm usage at first and it will resume the +device later. If runtime of the device has error or device is in inaccessible +state(or other error state), resume operation will fail. If we do not call put +operation to decrease the reference, it will result in reference leak in the +two functions flexcan_get_berr_counter() and flexcan_open(). + +Moreover, this device cannot enter the idle state and always stay busy or other +non-idle state later. So we should fix it through adding +pm_runtime_put_noidle(). + +Fixes: ca10989632d88 ("can: flexcan: implement can Runtime PM") +Signed-off-by: Zhang Qilong +Link: https://lore.kernel.org/r/20201108083000.2599705-1-zhangqilong3@huawei.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 4e8fdb6064bd..d6a9cf0e9b60 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -728,8 +728,10 @@ static int flexcan_get_berr_counter(const struct net_device *dev, + int err; + + err = pm_runtime_get_sync(priv->dev); +- if (err < 0) ++ if (err < 0) { ++ pm_runtime_put_noidle(priv->dev); + return err; ++ } + + err = __flexcan_get_berr_counter(dev, bec); + +@@ -1654,8 +1656,10 @@ static int flexcan_open(struct net_device *dev) + } + + err = pm_runtime_get_sync(priv->dev); +- if (err < 0) ++ if (err < 0) { ++ pm_runtime_put_noidle(priv->dev); + return err; ++ } + + err = open_candev(dev); + if (err) +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-fix-spelling-mistake-reserverd-reserved.patch b/patches.suse/can-flexcan-fix-spelling-mistake-reserverd-reserved.patch new file mode 100644 index 0000000..fd96b9c --- /dev/null +++ b/patches.suse/can-flexcan-fix-spelling-mistake-reserverd-reserved.patch @@ -0,0 +1,34 @@ +From: Alexandre Belloni +Date: Fri, 14 Feb 2020 15:17:51 +0100 +Subject: can: flexcan: fix spelling mistake "reserverd" -> "reserved" + +Git-commit: 6850863999334748f5c5a16ff2dd1f06cd7c95ab +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +Fix a mistake in a register layout description. + +Signed-off-by: Alexandre Belloni +Link: https://lore.kernel.org/r/20200214141751.21168-1-alexandre.belloni@bootlin.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 94d10ec954a0..19403e88daa3 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -230,7 +230,7 @@ struct flexcan_regs { + /* FIFO-mode: + * MB + * 0x080...0x08f 0 RX message buffer +- * 0x090...0x0df 1-5 reserverd ++ * 0x090...0x0df 1-5 reserved + * 0x0e0...0x0ff 6-7 8 entry ID table + * (mx25, mx28, mx35, mx53) + * 0x0e0...0x2df 6-7..37 8..128 entry ID table +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-flexcan_chip_start-fix-erroneous-flexcan.patch b/patches.suse/can-flexcan-flexcan_chip_start-fix-erroneous-flexcan.patch new file mode 100644 index 0000000..37be8d3 --- /dev/null +++ b/patches.suse/can-flexcan-flexcan_chip_start-fix-erroneous-flexcan.patch @@ -0,0 +1,106 @@ +From: Marc Kleine-Budde +Date: Wed, 18 Nov 2020 16:01:48 +0100 +Subject: can: flexcan: flexcan_chip_start(): fix erroneous + flexcan_transceiver_enable() during bus-off recovery + +Git-commit: cd9f13c59461351d7a5fd07924264fb49b287359 +Patch-mainline: v5.10-rc5 +References: jsc#SLE-12251 + +If the CAN controller goes into bus off, the do_set_mode() callback with +CAN_MODE_START can be used to recover the controller, which then calls +flexcan_chip_start(). If configured, this is done automatically by the +framework or manually by the user. + +In flexcan_chip_start() there is an explicit call to +flexcan_transceiver_enable(), which does a regulator_enable() on the +transceiver regulator. This results in a net usage counter increase, as there +is no corresponding flexcan_transceiver_disable() in the bus off code path. +This further leads to the transceiver stuck enabled, even if the CAN interface +is shut down. + +To fix this problem the +flexcan_transceiver_enable()/flexcan_transceiver_disable() are moved out of +flexcan_chip_start()/flexcan_chip_stop() into flexcan_open()/flexcan_close(). + +Fixes: e955cead0311 ("CAN: Add Flexcan CAN controller driver") +Link: https://lore.kernel.org/r/20201118150148.2664024-1-mkl@pengutronix.de +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index d6a9cf0e9b60..99e5f272205d 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -1567,14 +1567,10 @@ static int flexcan_chip_start(struct net_device *dev) + priv->write(reg_ctrl2, ®s->ctrl2); + } + +- err = flexcan_transceiver_enable(priv); +- if (err) +- goto out_chip_disable; +- + /* synchronize with the can bus */ + err = flexcan_chip_unfreeze(priv); + if (err) +- goto out_transceiver_disable; ++ goto out_chip_disable; + + priv->can.state = CAN_STATE_ERROR_ACTIVE; + +@@ -1592,8 +1588,6 @@ static int flexcan_chip_start(struct net_device *dev) + + return 0; + +- out_transceiver_disable: +- flexcan_transceiver_disable(priv); + out_chip_disable: + flexcan_chip_disable(priv); + return err; +@@ -1623,7 +1617,6 @@ static int __flexcan_chip_stop(struct net_device *dev, bool disable_on_error) + priv->write(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL, + ®s->ctrl); + +- flexcan_transceiver_disable(priv); + priv->can.state = CAN_STATE_STOPPED; + + return 0; +@@ -1665,10 +1658,14 @@ static int flexcan_open(struct net_device *dev) + if (err) + goto out_runtime_put; + +- err = request_irq(dev->irq, flexcan_irq, IRQF_SHARED, dev->name, dev); ++ err = flexcan_transceiver_enable(priv); + if (err) + goto out_close; + ++ err = request_irq(dev->irq, flexcan_irq, IRQF_SHARED, dev->name, dev); ++ if (err) ++ goto out_transceiver_disable; ++ + if (priv->can.ctrlmode & CAN_CTRLMODE_FD) + priv->mb_size = sizeof(struct flexcan_mb) + CANFD_MAX_DLEN; + else +@@ -1720,6 +1717,8 @@ static int flexcan_open(struct net_device *dev) + can_rx_offload_del(&priv->offload); + out_free_irq: + free_irq(dev->irq, dev); ++ out_transceiver_disable: ++ flexcan_transceiver_disable(priv); + out_close: + close_candev(dev); + out_runtime_put: +@@ -1738,6 +1737,7 @@ static int flexcan_close(struct net_device *dev) + + can_rx_offload_del(&priv->offload); + free_irq(dev->irq, dev); ++ flexcan_transceiver_disable(priv); + + close_candev(dev); + pm_runtime_put(priv->dev); +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-flexcan_chip_stop-add-error-handling-and.patch b/patches.suse/can-flexcan-flexcan_chip_stop-add-error-handling-and.patch index 39e0b7e..d855a12 100644 --- a/patches.suse/can-flexcan-flexcan_chip_stop-add-error-handling-and.patch +++ b/patches.suse/can-flexcan-flexcan_chip_stop-add-error-handling-and.patch @@ -1,10 +1,11 @@ -From 9ad02c7f4f279504bdd38ab706fdc97d5f2b2a9c Mon Sep 17 00:00:00 2001 From: Joakim Zhang Date: Tue, 22 Sep 2020 16:44:19 +0200 -Subject: [PATCH] can: flexcan: flexcan_chip_stop(): add error handling and propagate error value +Subject: can: flexcan: flexcan_chip_stop(): add error handling and propagate + error value + Git-commit: 9ad02c7f4f279504bdd38ab706fdc97d5f2b2a9c Patch-mainline: v5.10-rc1 -References: git-fixes +References: jsc#SLE-12251 This patch implements error handling and propagates the error value of flexcan_chip_stop(). This function will be called from flexcan_suspend() @@ -17,8 +18,7 @@ Signed-off-by: Joakim Zhang [mkl: introduce flexcan_chip_stop_disable_on_error() and use it in flexcan_close()] Signed-off-by: Marc Kleine-Budde Link: https://lore.kernel.org/r/20200922144429.2613631-11-mkl@pengutronix.de -Acked-by: Takashi Iwai - +Signed-off-by: Mian Yousaf Kaukab --- drivers/net/can/flexcan.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) @@ -90,5 +90,5 @@ index 52d73115c7fd..4be73ce7518e 100644 can_rx_offload_del(&priv->offload); free_irq(dev->irq, dev); -- -2.16.4 +2.26.2 diff --git a/patches.suse/can-flexcan-flexcan_close-change-order-if-commands-t.patch b/patches.suse/can-flexcan-flexcan_close-change-order-if-commands-t.patch new file mode 100644 index 0000000..e20b534 --- /dev/null +++ b/patches.suse/can-flexcan-flexcan_close-change-order-if-commands-t.patch @@ -0,0 +1,70 @@ +From: Marc Kleine-Budde +Date: Thu, 19 Nov 2020 11:09:17 +0100 +Subject: can: flexcan: flexcan_close(): change order if commands to properly + shut down the controller + +Git-commit: 6b6e986864fd356e7f7d442ea36e58dde058b5e7 +Patch-mainline: v5.11-rc1 +References: jsc#SLE-12251 + +There haven been reports, that the flexcan_close() soradically hangs during +simultanious ifdown, sending of CAN messages and probably open CAN bus: + +| (__schedule) from [<808bbd34>] (schedule+0x90/0xb8) +| (schedule) from [<808bf274>] (schedule_timeout+0x1f8/0x24c) +| (schedule_timeout) from [<8016be44>] (msleep+0x18/0x1c) +| (msleep) from [<80746a64>] (napi_disable+0x60/0x70) +| (napi_disable) from [<8052fdd0>] (flexcan_close+0x2c/0x140) +| (flexcan_close) from [<80744930>] (__dev_close_many+0xb8/0xd8) +| (__dev_close_many) from [<8074db9c>] (__dev_change_flags+0xd0/0x1a0) +| (__dev_change_flags) from [<8074dc84>] (dev_change_flags+0x18/0x48) +| (dev_change_flags) from [<80760c24>] (do_setlink+0x44c/0x7b4) +| (do_setlink) from [<80761560>] (rtnl_newlink+0x374/0x68c) + +I was unable to reproduce the issue, but a cleanup of the flexcan close +sequence has probably fixed the problem at the reporting user. + +This patch changes the sequence in flexcan_close() to: +- stop the TX queue +- disable the interrupts on the chip level and wait via free_irq() + synchronously for the interrupt handler to finish +- disable RX offload, which disables synchronously NAPI +- disable the flexcan on the chip level +- free RX offload +- disable the transceiver +- close the CAN device +- disable the clocks + +Link: https://lore.kernel.org/r/20201119100917.3013281-6-mkl@pengutronix.de +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index e98368be1669..e85f20d18d67 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -1754,15 +1754,15 @@ static int flexcan_close(struct net_device *dev) + struct flexcan_priv *priv = netdev_priv(dev); + + netif_stop_queue(dev); ++ flexcan_chip_interrupts_disable(dev); ++ free_irq(dev->irq, dev); + can_rx_offload_disable(&priv->offload); + flexcan_chip_stop_disable_on_error(dev); +- flexcan_chip_interrupts_disable(dev); + + can_rx_offload_del(&priv->offload); +- free_irq(dev->irq, dev); + flexcan_transceiver_disable(priv); +- + close_candev(dev); ++ + pm_runtime_put(priv->dev); + + can_led_event(dev, CAN_LED_EVENT_STOP); +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-flexcan_exit_stop_mode-remove-stray-empt.patch b/patches.suse/can-flexcan-flexcan_exit_stop_mode-remove-stray-empt.patch new file mode 100644 index 0000000..6875630 --- /dev/null +++ b/patches.suse/can-flexcan-flexcan_exit_stop_mode-remove-stray-empt.patch @@ -0,0 +1,33 @@ +From: Marc Kleine-Budde +Date: Tue, 22 Sep 2020 16:44:11 +0200 +Subject: can: flexcan: flexcan_exit_stop_mode(): remove stray empty line + +Git-commit: ce90e073d64511f866e4029dff64c2a18546e680 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +This patch removes a stray empty line from the flexcan_exit_stop_mode() +function. + +Signed-off-by: Marc Kleine-Budde +Link: https://lore.kernel.org/r/20200922144429.2613631-3-mkl@pengutronix.de +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 6198319d8fac..43fa38033383 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -457,7 +457,6 @@ static inline int flexcan_exit_stop_mode(struct flexcan_priv *priv) + regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr, + 1 << priv->stm.req_bit, 0); + +- + reg_mcr = priv->read(®s->mcr); + reg_mcr &= ~FLEXCAN_MCR_SLF_WAK; + priv->write(reg_mcr, ®s->mcr); +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-flexcan_irq-add-support-for-TX-mailbox-i.patch b/patches.suse/can-flexcan-flexcan_irq-add-support-for-TX-mailbox-i.patch new file mode 100644 index 0000000..12a55c2 --- /dev/null +++ b/patches.suse/can-flexcan-flexcan_irq-add-support-for-TX-mailbox-i.patch @@ -0,0 +1,81 @@ +From: Marc Kleine-Budde +Date: Fri, 1 Mar 2019 15:38:05 +0100 +Subject: can: flexcan: flexcan_irq(): add support for TX mailbox in iflag1 + +Git-commit: b87c28b726daaa5ac315b59a0ae04282c265580b +Patch-mainline: v5.5-rc1 +References: jsc#SLE-12251 + +The flexcan IP core has up to 64 mailboxes, each one has a corresponding +interrupt bit in the iflag1 or iflag2 registers and a mask bit in the +imask1 or imask2 registers. + +The driver will always use the last mailbox for TX, which falls into the iflag2 +register. + +To support CANFD the payload size has to increase to 64 bytes and the number of +mailboxes will decrease so much that the TX mailbox will be handled in the +iflag1 register. + +This patch add support to handle the TX mailbox independent whether it's +in iflag1 or iflag2 by introducing th flexcan_read_reg_iflag_tx() +function, similar to flexcan_read_reg_iflag_rx(), for the read path. + +For the write path the function flexcan_write64() is added. + +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index f6c3613485af..79696430dedf 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -790,11 +790,24 @@ static inline u64 flexcan_read64_mask(struct flexcan_priv *priv, void __iomem *a + return reg & mask; + } + ++static inline void flexcan_write64(struct flexcan_priv *priv, u64 val, void __iomem *addr) ++{ ++ if (upper_32_bits(val)) ++ priv->write(upper_32_bits(val), addr - 4); ++ if (lower_32_bits(val)) ++ priv->write(lower_32_bits(val), addr); ++} ++ + static inline u64 flexcan_read_reg_iflag_rx(struct flexcan_priv *priv) + { + return flexcan_read64_mask(priv, &priv->regs->iflag1, priv->rx_mask); + } + ++static inline u64 flexcan_read_reg_iflag_tx(struct flexcan_priv *priv) ++{ ++ return flexcan_read64_mask(priv, &priv->regs->iflag1, priv->tx_mask); ++} ++ + static inline struct flexcan_priv *rx_offload_to_priv(struct can_rx_offload *offload) + { + return container_of(offload, struct flexcan_priv, offload); +@@ -931,7 +944,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) + } + } + +- reg_iflag_tx = (u64)priv->read(®s->iflag2) << 32; ++ reg_iflag_tx = flexcan_read_reg_iflag_tx(priv); + + /* transmission complete interrupt */ + if (reg_iflag_tx & priv->tx_mask) { +@@ -946,7 +959,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) + /* after sending a RTR frame MB is in RX mode */ + priv->write(FLEXCAN_MB_CODE_TX_INACTIVE, + &priv->tx_mb->can_ctrl); +- priv->write(priv->tx_mask >> 32, ®s->iflag2); ++ flexcan_write64(priv, priv->tx_mask, ®s->iflag1); + netif_wake_queue(dev); + } + +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-flexcan_irq-rename-variable-reg_iflag-re.patch b/patches.suse/can-flexcan-flexcan_irq-rename-variable-reg_iflag-re.patch new file mode 100644 index 0000000..b9dd056 --- /dev/null +++ b/patches.suse/can-flexcan-flexcan_irq-rename-variable-reg_iflag-re.patch @@ -0,0 +1,44 @@ +From: Marc Kleine-Budde +Date: Fri, 1 Mar 2019 16:29:47 +0100 +Subject: can: flexcan: flexcan_irq(): rename variable reg_iflag -> + reg_iflag_rx + +Git-commit: 4e26598a7d3cd1bf6a0843042997963f9828a6ba +Patch-mainline: v5.5-rc1 +References: jsc#SLE-12251 + +This patch renames the variable reg_iflag in the flexcan_irq() function +to reg_iflag_rx. This better reflects the contents of the varibale. It +does not hold the unmodified iflag registers, instead all non RX +interrupts have been masked. + +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 4b2275b3c8e0..be81c8439a32 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -897,13 +897,13 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) + + /* reception interrupt */ + if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { +- u64 reg_iflag; ++ u64 reg_iflag_rx; + int ret; + +- while ((reg_iflag = flexcan_read_reg_iflag_rx(priv))) { ++ while ((reg_iflag_rx = flexcan_read_reg_iflag_rx(priv))) { + handled = IRQ_HANDLED; + ret = can_rx_offload_irq_offload_timestamp(&priv->offload, +- reg_iflag); ++ reg_iflag_rx); + if (!ret) + break; + } +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-flexcan_irq_state-only-read-timestamp-if.patch b/patches.suse/can-flexcan-flexcan_irq_state-only-read-timestamp-if.patch new file mode 100644 index 0000000..d14389d --- /dev/null +++ b/patches.suse/can-flexcan-flexcan_irq_state-only-read-timestamp-if.patch @@ -0,0 +1,46 @@ +From: Marc Kleine-Budde +Date: Wed, 9 Oct 2019 15:15:37 +0200 +Subject: can: flexcan: flexcan_irq_state(): only read timestamp if needed + +Git-commit: 58ed8e77d3123acb6ece7d016c8db393d5c0d488 +Patch-mainline: v5.5-rc1 +References: jsc#SLE-12251 + +The function flexcan_irq_state() checks the controller for CAN state +changes and pushes a skb with the new state and a timestamp into the +rx-offload framework. + +This patch optimizes the function by only reading the timestamp, if a +state change is detected. + +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 362ed90c701f..148c0a3fab24 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -743,8 +743,6 @@ static void flexcan_irq_state(struct net_device *dev, u32 reg_esr) + u32 timestamp; + int err; + +- timestamp = priv->read(®s->timer) << 16; +- + flt = reg_esr & FLEXCAN_ESR_FLT_CONF_MASK; + if (likely(flt == FLEXCAN_ESR_FLT_CONF_ACTIVE)) { + tx_state = unlikely(reg_esr & FLEXCAN_ESR_TX_WRN) ? +@@ -764,6 +762,8 @@ static void flexcan_irq_state(struct net_device *dev, u32 reg_esr) + if (likely(new_state == priv->can.state)) + return; + ++ timestamp = priv->read(®s->timer) << 16; ++ + skb = alloc_can_err_skb(dev, &cf); + if (unlikely(!skb)) + return; +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-flexcan_mailbox_read-make-use-of-flexcan.patch b/patches.suse/can-flexcan-flexcan_mailbox_read-make-use-of-flexcan.patch new file mode 100644 index 0000000..6b4afdf --- /dev/null +++ b/patches.suse/can-flexcan-flexcan_mailbox_read-make-use-of-flexcan.patch @@ -0,0 +1,46 @@ +From: Marc Kleine-Budde +Date: Fri, 1 Mar 2019 16:27:59 +0100 +Subject: can: flexcan: flexcan_mailbox_read() make use of flexcan_write64() to + mark the mailbox as read + +Git-commit: b9468ad8ff65e6dcfeb69cab15deecafdb883643 +Patch-mainline: v5.5-rc1 +References: jsc#SLE-12251 + +In the previous patch the function flexcan_write64() was introduced. + +This patch replaces the open coded variant in flexcan_mailbox_read() +that marks a mailbox as read, by a single call to flexcan_write64(). + +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 11 +++-------- + 1 file changed, 3 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 79696430dedf..a929cdda9ab2 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -883,15 +883,10 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload, + } + + mark_as_read: +- if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { +- /* Clear IRQ */ +- if (n < 32) +- priv->write(BIT(n), ®s->iflag1); +- else +- priv->write(BIT(n - 32), ®s->iflag2); +- } else { ++ if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) ++ flexcan_write64(priv, FLEXCAN_IFLAG_MB(n), ®s->iflag1); ++ else + priv->write(FLEXCAN_IFLAG_RX_FIFO_AVAILABLE, ®s->iflag1); +- } + + /* Read the Free Running Timer. It is optional but recommended + * to unlock Mailbox as soon as possible and make it available +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-flexcan_open-completely-initialize-contr.patch b/patches.suse/can-flexcan-flexcan_open-completely-initialize-contr.patch new file mode 100644 index 0000000..10affc2 --- /dev/null +++ b/patches.suse/can-flexcan-flexcan_open-completely-initialize-contr.patch @@ -0,0 +1,71 @@ +From: Marc Kleine-Budde +Date: Thu, 19 Nov 2020 11:09:16 +0100 +Subject: can: flexcan: flexcan_open(): completely initialize controller before + requesting IRQ + +Git-commit: 648a34b1d57d65d01784ca3659558794d5c00ae1 +Patch-mainline: v5.11-rc1 +References: jsc#SLE-12251 + +This patch changes the order in which the flexcan controller is brought up +during flexcan_open(). It makes sure that the chip is completely initialized +before the IRQs are requested and finally enabled. + +Link: https://lore.kernel.org/r/20201119100917.3013281-5-mkl@pengutronix.de +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 21 +++++++++++---------- + 1 file changed, 11 insertions(+), 10 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 0705b6384e49..e98368be1669 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -1712,32 +1712,33 @@ static int flexcan_open(struct net_device *dev) + if (err) + goto out_close; + +- err = request_irq(dev->irq, flexcan_irq, IRQF_SHARED, dev->name, dev); ++ err = flexcan_rx_offload_setup(dev); + if (err) + goto out_transceiver_disable; + +- err = flexcan_rx_offload_setup(dev); ++ err = flexcan_chip_start(dev); + if (err) +- goto out_free_irq; ++ goto out_can_rx_offload_del; + +- /* start chip and queuing */ +- err = flexcan_chip_start(dev); ++ can_rx_offload_enable(&priv->offload); ++ ++ err = request_irq(dev->irq, flexcan_irq, IRQF_SHARED, dev->name, dev); + if (err) +- goto out_offload_del; ++ goto out_can_rx_offload_disable; + + flexcan_chip_interrupts_enable(dev); + + can_led_event(dev, CAN_LED_EVENT_OPEN); + +- can_rx_offload_enable(&priv->offload); + netif_start_queue(dev); + + return 0; + +- out_offload_del: ++ out_can_rx_offload_disable: ++ can_rx_offload_disable(&priv->offload); ++ flexcan_chip_stop(dev); ++ out_can_rx_offload_del: + can_rx_offload_del(&priv->offload); +- out_free_irq: +- free_irq(dev->irq, dev); + out_transceiver_disable: + flexcan_transceiver_disable(priv); + out_close: +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-flexcan_probe-make-regulator-xceiver-opt.patch b/patches.suse/can-flexcan-flexcan_probe-make-regulator-xceiver-opt.patch new file mode 100644 index 0000000..fcb8487 --- /dev/null +++ b/patches.suse/can-flexcan-flexcan_probe-make-regulator-xceiver-opt.patch @@ -0,0 +1,43 @@ +From: Marc Kleine-Budde +Date: Tue, 22 Sep 2020 16:44:16 +0200 +Subject: can: flexcan: flexcan_probe(): make regulator xceiver optional + +Git-commit: 3d60f33a7a7afa7ba02b96ecc835c3450bf234b1 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +As the transcevier regulator is optional, this patch switches from +devm_regulator_get() to devm_regulator_get_optional(). This gets rid of "using +dummy regulator" warning message from the regulator core, if no regulator is +available. + +Signed-off-by: Marc Kleine-Budde +Link: https://lore.kernel.org/r/20200922144429.2613631-8-mkl@pengutronix.de +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 06cddc468739..52b53ff223f4 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -1579,11 +1579,13 @@ static int flexcan_probe(struct platform_device *pdev) + u8 clk_src = 1; + u32 clock_freq = 0; + +- reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver"); ++ reg_xceiver = devm_regulator_get_optional(&pdev->dev, "xceiver"); + if (PTR_ERR(reg_xceiver) == -EPROBE_DEFER) + return -EPROBE_DEFER; +- else if (IS_ERR(reg_xceiver)) ++ else if (PTR_ERR(reg_xceiver) == -ENODEV) + reg_xceiver = NULL; ++ else if (IS_ERR(reg_xceiver)) ++ return PTR_ERR(reg_xceiver); + + if (pdev->dev.of_node) { + of_property_read_u32(pdev->dev.of_node, +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-flexcan_read_reg_iflag_rx-optimize-readi.patch b/patches.suse/can-flexcan-flexcan_read_reg_iflag_rx-optimize-readi.patch new file mode 100644 index 0000000..a0c73bd --- /dev/null +++ b/patches.suse/can-flexcan-flexcan_read_reg_iflag_rx-optimize-readi.patch @@ -0,0 +1,77 @@ +From: Marc Kleine-Budde +Date: Fri, 1 Mar 2019 15:38:05 +0100 +Subject: can: flexcan: flexcan_read_reg_iflag_rx(): optimize reading + +Git-commit: d3a51507e45e06b22ea892fccfba4b42f704f859 +Patch-mainline: v5.5-rc1 +References: jsc#SLE-12251 + +The flexcan IP core has up to 64 mailboxes, each one has a corresponding +interrupt bit in the iflag1 or iflag2 registers and a mask bit in the +imask1 or imask2 registers. + +In the timestamp (i.e. non FIFO) mode the driver needs to mask all non RX +interrupt sources, it uses the precomputed value rx_mask of struct flexcan_priv +for this. + +In certain use cases, for example the CANFD mode, the contents of the iflag2 +register is completely masked. + +This patch optimizes the flexcan_read_reg_iflag_rx() function by not reading +the iflag1 or iflag2 register if the contents is masked. + +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 28 +++++++++++++++++----------- + 1 file changed, 17 insertions(+), 11 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index c2843571b46e..f6c3613485af 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -778,6 +778,23 @@ static void flexcan_irq_state(struct net_device *dev, u32 reg_esr) + dev->stats.rx_fifo_errors++; + } + ++static inline u64 flexcan_read64_mask(struct flexcan_priv *priv, void __iomem *addr, u64 mask) ++{ ++ u64 reg = 0; ++ ++ if (upper_32_bits(mask)) ++ reg = (u64)priv->read(addr - 4) << 32; ++ if (lower_32_bits(mask)) ++ reg |= priv->read(addr); ++ ++ return reg & mask; ++} ++ ++static inline u64 flexcan_read_reg_iflag_rx(struct flexcan_priv *priv) ++{ ++ return flexcan_read64_mask(priv, &priv->regs->iflag1, priv->rx_mask); ++} ++ + static inline struct flexcan_priv *rx_offload_to_priv(struct can_rx_offload *offload) + { + return container_of(offload, struct flexcan_priv, offload); +@@ -872,17 +889,6 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload, + return skb; + } + +-static inline u64 flexcan_read_reg_iflag_rx(struct flexcan_priv *priv) +-{ +- struct flexcan_regs __iomem *regs = priv->regs; +- u64 iflag; +- +- iflag = (u64)priv->read(®s->iflag2) << 32 | +- priv->read(®s->iflag1); +- +- return iflag & priv->rx_mask; +-} +- + static irqreturn_t flexcan_irq(int irq, void *dev_id) + { + struct net_device *dev = dev_id; +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-flexcan_remove-disable-wakeup-completely.patch b/patches.suse/can-flexcan-flexcan_remove-disable-wakeup-completely.patch index 452b7ff..b58acc1 100644 --- a/patches.suse/can-flexcan-flexcan_remove-disable-wakeup-completely.patch +++ b/patches.suse/can-flexcan-flexcan_remove-disable-wakeup-completely.patch @@ -1,10 +1,10 @@ -From ab07ff1c92fa60f29438e655a1b4abab860ed0b6 Mon Sep 17 00:00:00 2001 From: Joakim Zhang Date: Wed, 21 Oct 2020 02:45:27 +0800 -Subject: [PATCH] can: flexcan: flexcan_remove(): disable wakeup completely +Subject: can: flexcan: flexcan_remove(): disable wakeup completely + Git-commit: ab07ff1c92fa60f29438e655a1b4abab860ed0b6 Patch-mainline: v5.10-rc3 -References: git-fixes +References: jsc#SLE-12251 With below sequence, we can see wakeup default is enabled after re-load module, if it was enabled before, so we need disable wakeup in flexcan_remove(). @@ -25,20 +25,24 @@ Signed-off-by: Joakim Zhang Link: https://lore.kernel.org/r/20201020184527.8190-1-qiangqing.zhang@nxp.com [mkl: streamlined commit message] Signed-off-by: Marc Kleine-Budde -Acked-by: Takashi Iwai - +Signed-off-by: Mian Yousaf Kaukab --- - drivers/net/can/flexcan.c | 2 ++ + drivers/net/can/flexcan.c | 2 ++ 1 file changed, 2 insertions(+) +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 06f94b6f0ebe..881799bd9c5e 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c -@@ -1638,6 +1638,8 @@ static int flexcan_remove(struct platfor +@@ -2062,6 +2062,8 @@ static int flexcan_remove(struct platform_device *pdev) { struct net_device *dev = platform_get_drvdata(pdev); + device_set_wakeup_enable(&pdev->dev, false); + device_set_wakeup_capable(&pdev->dev, false); unregister_flexcandev(dev); + pm_runtime_disable(&pdev->dev); free_candev(dev); - +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-flexcan_rx_offload_setup-factor-out-mail.patch b/patches.suse/can-flexcan-flexcan_rx_offload_setup-factor-out-mail.patch new file mode 100644 index 0000000..056a2fa --- /dev/null +++ b/patches.suse/can-flexcan-flexcan_rx_offload_setup-factor-out-mail.patch @@ -0,0 +1,114 @@ +From: Marc Kleine-Budde +Date: Thu, 19 Nov 2020 11:09:15 +0100 +Subject: can: flexcan: flexcan_rx_offload_setup(): factor out mailbox and + rx-offload setup into separate function + +Git-commit: f3f2a5466578e297f5eeff940c9eb98c4ea5f0b3 +Patch-mainline: v5.11-rc1 +References: jsc#SLE-12251 + +In an upcoming patch the order of operations in flexcan_open() are changed. +Introduce convenience function to make that patch simpler. + +Link: https://lore.kernel.org/r/20201119100917.3013281-4-mkl@pengutronix.de +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 74 ++++++++++++++++++++++----------------- + 1 file changed, 42 insertions(+), 32 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 64c174aa868b..0705b6384e49 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -1346,6 +1346,47 @@ static void flexcan_ram_init(struct net_device *dev) + priv->write(reg_ctrl2, ®s->ctrl2); + } + ++static int flexcan_rx_offload_setup(struct net_device *dev) ++{ ++ struct flexcan_priv *priv = netdev_priv(dev); ++ int err; ++ ++ if (priv->can.ctrlmode & CAN_CTRLMODE_FD) ++ priv->mb_size = sizeof(struct flexcan_mb) + CANFD_MAX_DLEN; ++ else ++ priv->mb_size = sizeof(struct flexcan_mb) + CAN_MAX_DLEN; ++ priv->mb_count = (sizeof(priv->regs->mb[0]) / priv->mb_size) + ++ (sizeof(priv->regs->mb[1]) / priv->mb_size); ++ ++ if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) ++ priv->tx_mb_reserved = ++ flexcan_get_mb(priv, FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP); ++ else ++ priv->tx_mb_reserved = ++ flexcan_get_mb(priv, FLEXCAN_TX_MB_RESERVED_OFF_FIFO); ++ priv->tx_mb_idx = priv->mb_count - 1; ++ priv->tx_mb = flexcan_get_mb(priv, priv->tx_mb_idx); ++ priv->tx_mask = FLEXCAN_IFLAG_MB(priv->tx_mb_idx); ++ ++ priv->offload.mailbox_read = flexcan_mailbox_read; ++ ++ if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { ++ priv->offload.mb_first = FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST; ++ priv->offload.mb_last = priv->mb_count - 2; ++ ++ priv->rx_mask = GENMASK_ULL(priv->offload.mb_last, ++ priv->offload.mb_first); ++ err = can_rx_offload_add_timestamp(dev, &priv->offload); ++ } else { ++ priv->rx_mask = FLEXCAN_IFLAG_RX_FIFO_OVERFLOW | ++ FLEXCAN_IFLAG_RX_FIFO_AVAILABLE; ++ err = can_rx_offload_add_fifo(dev, &priv->offload, ++ FLEXCAN_NAPI_WEIGHT); ++ } ++ ++ return err; ++} ++ + static void flexcan_chip_interrupts_enable(const struct net_device *dev) + { + const struct flexcan_priv *priv = netdev_priv(dev); +@@ -1675,38 +1716,7 @@ static int flexcan_open(struct net_device *dev) + if (err) + goto out_transceiver_disable; + +- if (priv->can.ctrlmode & CAN_CTRLMODE_FD) +- priv->mb_size = sizeof(struct flexcan_mb) + CANFD_MAX_DLEN; +- else +- priv->mb_size = sizeof(struct flexcan_mb) + CAN_MAX_DLEN; +- priv->mb_count = (sizeof(priv->regs->mb[0]) / priv->mb_size) + +- (sizeof(priv->regs->mb[1]) / priv->mb_size); +- +- if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) +- priv->tx_mb_reserved = +- flexcan_get_mb(priv, FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP); +- else +- priv->tx_mb_reserved = +- flexcan_get_mb(priv, FLEXCAN_TX_MB_RESERVED_OFF_FIFO); +- priv->tx_mb_idx = priv->mb_count - 1; +- priv->tx_mb = flexcan_get_mb(priv, priv->tx_mb_idx); +- priv->tx_mask = FLEXCAN_IFLAG_MB(priv->tx_mb_idx); +- +- priv->offload.mailbox_read = flexcan_mailbox_read; +- +- if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { +- priv->offload.mb_first = FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST; +- priv->offload.mb_last = priv->mb_count - 2; +- +- priv->rx_mask = GENMASK_ULL(priv->offload.mb_last, +- priv->offload.mb_first); +- err = can_rx_offload_add_timestamp(dev, &priv->offload); +- } else { +- priv->rx_mask = FLEXCAN_IFLAG_RX_FIFO_OVERFLOW | +- FLEXCAN_IFLAG_RX_FIFO_AVAILABLE; +- err = can_rx_offload_add_fifo(dev, &priv->offload, +- FLEXCAN_NAPI_WEIGHT); +- } ++ err = flexcan_rx_offload_setup(dev); + if (err) + goto out_free_irq; + +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-flexcan_set_bittiming-move-setup-of-CAN-.patch b/patches.suse/can-flexcan-flexcan_set_bittiming-move-setup-of-CAN-.patch new file mode 100644 index 0000000..d4b7e1a --- /dev/null +++ b/patches.suse/can-flexcan-flexcan_set_bittiming-move-setup-of-CAN-.patch @@ -0,0 +1,84 @@ +From: Marc Kleine-Budde +Date: Tue, 22 Sep 2020 16:44:22 +0200 +Subject: can: flexcan: flexcan_set_bittiming(): move setup of CAN-2.0 bitiming + into separate function + +Git-commit: 890599bc8618b72ba5e061d6c776cc8dce08c753 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +This is a patch prepares for the CAN-FD support. In a later patch the +setup for canfd bittiming will be added, with this patch the change is +easier to read. + +Signed-off-by: Marc Kleine-Budde +Link: https://lore.kernel.org/r/20200922144429.2613631-14-mkl@pengutronix.de +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 29 +++++++++++++++++++++-------- + 1 file changed, 21 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 35d0fa59e957..a9908deae411 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -1037,7 +1037,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) + return handled; + } + +-static void flexcan_set_bittiming(struct net_device *dev) ++static void flexcan_set_bittiming_ctrl(const struct net_device *dev) + { + const struct flexcan_priv *priv = netdev_priv(dev); + const struct can_bittiming *bt = &priv->can.bittiming; +@@ -1049,10 +1049,7 @@ static void flexcan_set_bittiming(struct net_device *dev) + FLEXCAN_CTRL_RJW(0x3) | + FLEXCAN_CTRL_PSEG1(0x7) | + FLEXCAN_CTRL_PSEG2(0x7) | +- FLEXCAN_CTRL_PROPSEG(0x7) | +- FLEXCAN_CTRL_LPB | +- FLEXCAN_CTRL_SMP | +- FLEXCAN_CTRL_LOM); ++ FLEXCAN_CTRL_PROPSEG(0x7)); + + reg |= FLEXCAN_CTRL_PRESDIV(bt->brp - 1) | + FLEXCAN_CTRL_PSEG1(bt->phase_seg1 - 1) | +@@ -1060,6 +1057,24 @@ static void flexcan_set_bittiming(struct net_device *dev) + FLEXCAN_CTRL_RJW(bt->sjw - 1) | + FLEXCAN_CTRL_PROPSEG(bt->prop_seg - 1); + ++ netdev_dbg(dev, "writing ctrl=0x%08x\n", reg); ++ priv->write(reg, ®s->ctrl); ++ ++ /* print chip status */ ++ netdev_dbg(dev, "%s: mcr=0x%08x ctrl=0x%08x\n", __func__, ++ priv->read(®s->mcr), priv->read(®s->ctrl)); ++} ++ ++static void flexcan_set_bittiming(struct net_device *dev) ++{ ++ const struct flexcan_priv *priv = netdev_priv(dev); ++ struct flexcan_regs __iomem *regs = priv->regs; ++ u32 reg; ++ ++ reg = priv->read(®s->ctrl); ++ reg &= ~(FLEXCAN_CTRL_LPB | FLEXCAN_CTRL_SMP | ++ FLEXCAN_CTRL_LOM); ++ + if (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK) + reg |= FLEXCAN_CTRL_LPB; + if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) +@@ -1070,9 +1085,7 @@ static void flexcan_set_bittiming(struct net_device *dev) + netdev_dbg(dev, "writing ctrl=0x%08x\n", reg); + priv->write(reg, ®s->ctrl); + +- /* print chip status */ +- netdev_dbg(dev, "%s: mcr=0x%08x ctrl=0x%08x\n", __func__, +- priv->read(®s->mcr), priv->read(®s->ctrl)); ++ return flexcan_set_bittiming_ctrl(dev); + } + + /* flexcan_chip_start +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-flexcan_setup_stop_mode-add-missing-req_.patch b/patches.suse/can-flexcan-flexcan_setup_stop_mode-add-missing-req_.patch index bdbb806..9866160 100644 --- a/patches.suse/can-flexcan-flexcan_setup_stop_mode-add-missing-req_.patch +++ b/patches.suse/can-flexcan-flexcan_setup_stop_mode-add-missing-req_.patch @@ -1,10 +1,11 @@ -From 499aa923c56769274f81e60414b8de4912864b8d Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Wed, 14 Oct 2020 13:41:36 +0200 -Subject: [PATCH] can: flexcan: flexcan_setup_stop_mode(): add missing "req_bit" to stop mode property comment +Subject: can: flexcan: flexcan_setup_stop_mode(): add missing "req_bit" to + stop mode property comment + Git-commit: 499aa923c56769274f81e60414b8de4912864b8d Patch-mainline: v5.10-rc5 -References: git-fixes +References: jsc#SLE-12251 In the patch @@ -19,8 +20,7 @@ Fixes: d9b081e3fc4b ("can: flexcan: remove ack_grp and ack_bit handling from dri Reported-by: Joakim Zhang Link: http://lore.kernel.org/r/20201014114810.2911135-1-mkl@pengutronix.de Signed-off-by: Marc Kleine-Budde -Acked-by: Takashi Iwai - +Signed-off-by: Mian Yousaf Kaukab --- drivers/net/can/flexcan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) @@ -39,5 +39,5 @@ index 881799bd9c5e..4e8fdb6064bd 100644 ret = of_property_read_u32_array(np, "fsl,stop-mode", out_val, ARRAY_SIZE(out_val)); -- -2.16.4 +2.26.2 diff --git a/patches.suse/can-flexcan-implement-can-Runtime-PM.patch b/patches.suse/can-flexcan-implement-can-Runtime-PM.patch new file mode 100644 index 0000000..601ca21 --- /dev/null +++ b/patches.suse/can-flexcan-implement-can-Runtime-PM.patch @@ -0,0 +1,307 @@ +From: Aisheng Dong +Date: Fri, 30 Nov 2018 08:53:26 +0000 +Subject: can: flexcan: implement can Runtime PM + +Git-commit: ca10989632d8820749fad37e13843750198e450a +Patch-mainline: v5.4-rc1 +References: jsc#SLE-12251 + +Flexcan will be disabled during suspend if no wakeup function required and +enabled after resume accordingly. During this period, we could explicitly +disable clocks. +Since PM is optional, the clock is enabled at probe to guarante the +clock is running when PM is not enabled in the kernel. + +Implement Runtime PM which will: +1) Without CONFIG_PM, clock is running whether Flexcan up or down. +2) With CONFIG_PM, clock enabled while Flexcan up and disabled when + Flexcan down. +3) Disable clock when do system suspend and enable clock while system + resume. +4) Make Power Domain framework be able to shutdown the corresponding + power domain of this device. + +Signed-off-by: Aisheng Dong +Signed-off-by: Joakim Zhang +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 119 ++++++++++++++++++++++++++------------ + 1 file changed, 81 insertions(+), 38 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index f2fe344593d5..228ac5d1f3b4 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -266,6 +267,7 @@ struct flexcan_stop_mode { + struct flexcan_priv { + struct can_priv can; + struct can_rx_offload offload; ++ struct device *dev; + + struct flexcan_regs __iomem *regs; + struct flexcan_mb __iomem *tx_mb; +@@ -444,6 +446,27 @@ static inline void flexcan_error_irq_disable(const struct flexcan_priv *priv) + priv->write(reg_ctrl, ®s->ctrl); + } + ++static int flexcan_clks_enable(const struct flexcan_priv *priv) ++{ ++ int err; ++ ++ err = clk_prepare_enable(priv->clk_ipg); ++ if (err) ++ return err; ++ ++ err = clk_prepare_enable(priv->clk_per); ++ if (err) ++ clk_disable_unprepare(priv->clk_ipg); ++ ++ return err; ++} ++ ++static void flexcan_clks_disable(const struct flexcan_priv *priv) ++{ ++ clk_disable_unprepare(priv->clk_per); ++ clk_disable_unprepare(priv->clk_ipg); ++} ++ + static inline int flexcan_transceiver_enable(const struct flexcan_priv *priv) + { + if (!priv->reg_xceiver) +@@ -570,19 +593,13 @@ static int flexcan_get_berr_counter(const struct net_device *dev, + const struct flexcan_priv *priv = netdev_priv(dev); + int err; + +- err = clk_prepare_enable(priv->clk_ipg); +- if (err) ++ err = pm_runtime_get_sync(priv->dev); ++ if (err < 0) + return err; + +- err = clk_prepare_enable(priv->clk_per); +- if (err) +- goto out_disable_ipg; +- + err = __flexcan_get_berr_counter(dev, bec); + +- clk_disable_unprepare(priv->clk_per); +- out_disable_ipg: +- clk_disable_unprepare(priv->clk_ipg); ++ pm_runtime_put(priv->dev); + + return err; + } +@@ -1215,17 +1232,13 @@ static int flexcan_open(struct net_device *dev) + struct flexcan_priv *priv = netdev_priv(dev); + int err; + +- err = clk_prepare_enable(priv->clk_ipg); +- if (err) ++ err = pm_runtime_get_sync(priv->dev); ++ if (err < 0) + return err; + +- err = clk_prepare_enable(priv->clk_per); +- if (err) +- goto out_disable_ipg; +- + err = open_candev(dev); + if (err) +- goto out_disable_per; ++ goto out_runtime_put; + + err = request_irq(dev->irq, flexcan_irq, IRQF_SHARED, dev->name, dev); + if (err) +@@ -1288,10 +1301,8 @@ static int flexcan_open(struct net_device *dev) + free_irq(dev->irq, dev); + out_close: + close_candev(dev); +- out_disable_per: +- clk_disable_unprepare(priv->clk_per); +- out_disable_ipg: +- clk_disable_unprepare(priv->clk_ipg); ++ out_runtime_put: ++ pm_runtime_put(priv->dev); + + return err; + } +@@ -1306,10 +1317,9 @@ static int flexcan_close(struct net_device *dev) + + can_rx_offload_del(&priv->offload); + free_irq(dev->irq, dev); +- clk_disable_unprepare(priv->clk_per); +- clk_disable_unprepare(priv->clk_ipg); + + close_candev(dev); ++ pm_runtime_put(priv->dev); + + can_led_event(dev, CAN_LED_EVENT_STOP); + +@@ -1349,18 +1359,15 @@ static int register_flexcandev(struct net_device *dev) + struct flexcan_regs __iomem *regs = priv->regs; + u32 reg, err; + +- err = clk_prepare_enable(priv->clk_ipg); ++ err = flexcan_clks_enable(priv); + if (err) + return err; + +- err = clk_prepare_enable(priv->clk_per); +- if (err) +- goto out_disable_ipg; +- + /* select "bus clock", chip must be disabled */ + err = flexcan_chip_disable(priv); + if (err) +- goto out_disable_per; ++ goto out_clks_disable; ++ + reg = priv->read(®s->ctrl); + reg |= FLEXCAN_CTRL_CLK_SRC; + priv->write(reg, ®s->ctrl); +@@ -1388,15 +1395,21 @@ static int register_flexcandev(struct net_device *dev) + } + + err = register_candev(dev); ++ if (err) ++ goto out_chip_disable; + +- /* disable core and turn off clocks */ +- out_chip_disable: ++ /* Disable core and let pm_runtime_put() disable the clocks. ++ * If CONFIG_PM is not enabled, the clocks will stay powered. ++ */ + flexcan_chip_disable(priv); +- out_disable_per: +- clk_disable_unprepare(priv->clk_per); +- out_disable_ipg: +- clk_disable_unprepare(priv->clk_ipg); ++ pm_runtime_put(priv->dev); ++ ++ return 0; + ++ out_chip_disable: ++ flexcan_chip_disable(priv); ++ out_clks_disable: ++ flexcan_clks_disable(priv); + return err; + } + +@@ -1556,6 +1569,7 @@ static int flexcan_probe(struct platform_device *pdev) + priv->write = flexcan_write_le; + } + ++ priv->dev = &pdev->dev; + priv->can.clock.freq = clock_freq; + priv->can.bittiming_const = &flexcan_bittiming_const; + priv->can.do_set_mode = flexcan_set_mode; +@@ -1569,6 +1583,10 @@ static int flexcan_probe(struct platform_device *pdev) + priv->devtype_data = devtype_data; + priv->reg_xceiver = reg_xceiver; + ++ pm_runtime_get_noresume(&pdev->dev); ++ pm_runtime_set_active(&pdev->dev); ++ pm_runtime_enable(&pdev->dev); ++ + err = register_flexcandev(dev); + if (err) { + dev_err(&pdev->dev, "registering netdev failed\n"); +@@ -1595,6 +1613,7 @@ static int flexcan_remove(struct platform_device *pdev) + struct net_device *dev = platform_get_drvdata(pdev); + + unregister_flexcandev(dev); ++ pm_runtime_disable(&pdev->dev); + free_candev(dev); + + return 0; +@@ -1604,7 +1623,7 @@ static int __maybe_unused flexcan_suspend(struct device *device) + { + struct net_device *dev = dev_get_drvdata(device); + struct flexcan_priv *priv = netdev_priv(dev); +- int err; ++ int err = 0; + + if (netif_running(dev)) { + /* if wakeup is enabled, enter stop mode +@@ -1617,20 +1636,22 @@ static int __maybe_unused flexcan_suspend(struct device *device) + err = flexcan_chip_disable(priv); + if (err) + return err; ++ ++ err = pm_runtime_force_suspend(device); + } + netif_stop_queue(dev); + netif_device_detach(dev); + } + priv->can.state = CAN_STATE_SLEEPING; + +- return 0; ++ return err; + } + + static int __maybe_unused flexcan_resume(struct device *device) + { + struct net_device *dev = dev_get_drvdata(device); + struct flexcan_priv *priv = netdev_priv(dev); +- int err; ++ int err = 0; + + priv->can.state = CAN_STATE_ERROR_ACTIVE; + if (netif_running(dev)) { +@@ -1639,14 +1660,35 @@ static int __maybe_unused flexcan_resume(struct device *device) + if (device_may_wakeup(device)) { + disable_irq_wake(dev->irq); + } else { +- err = flexcan_chip_enable(priv); ++ err = pm_runtime_force_resume(device); + if (err) + return err; ++ ++ err = flexcan_chip_enable(priv); + } + } ++ ++ return err; ++} ++ ++static int __maybe_unused flexcan_runtime_suspend(struct device *device) ++{ ++ struct net_device *dev = dev_get_drvdata(device); ++ struct flexcan_priv *priv = netdev_priv(dev); ++ ++ flexcan_clks_disable(priv); ++ + return 0; + } + ++static int __maybe_unused flexcan_runtime_resume(struct device *device) ++{ ++ struct net_device *dev = dev_get_drvdata(device); ++ struct flexcan_priv *priv = netdev_priv(dev); ++ ++ return flexcan_clks_enable(priv); ++} ++ + static int __maybe_unused flexcan_noirq_suspend(struct device *device) + { + struct net_device *dev = dev_get_drvdata(device); +@@ -1673,6 +1715,7 @@ static int __maybe_unused flexcan_noirq_resume(struct device *device) + + static const struct dev_pm_ops flexcan_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(flexcan_suspend, flexcan_resume) ++ SET_RUNTIME_PM_OPS(flexcan_runtime_suspend, flexcan_runtime_resume, NULL) + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(flexcan_noirq_suspend, flexcan_noirq_resume) + }; + +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-increase-error-counters-if-skb-enqueuein.patch b/patches.suse/can-flexcan-increase-error-counters-if-skb-enqueuein.patch index fd9803c..4a85e8b 100644 --- a/patches.suse/can-flexcan-increase-error-counters-if-skb-enqueuein.patch +++ b/patches.suse/can-flexcan-increase-error-counters-if-skb-enqueuein.patch @@ -5,9 +5,10 @@ Subject: can: flexcan: increase error counters if skb enqueueing via MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + Git-commit: 758124335a9dd649ab820bfb5b328170919ee7dc -Patch-mainline: 5.4-rc7 -References: bnc#1151927 5.3.15 +Patch-mainline: v5.4-rc7 +References: jsc#SLE-12251 The call to can_rx_offload_queue_sorted() may fail and return an error (in the current implementation due to resource shortage). The passed skb @@ -18,14 +19,16 @@ the device statistics reflect that there's a problem. Reported-by: Martin Hundebøll Signed-off-by: Marc Kleine-Budde -Signed-off-by: Jiri Slaby +Signed-off-by: Mian Yousaf Kaukab --- - drivers/net/can/flexcan.c | 10 ++++++++-- + drivers/net/can/flexcan.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 1cd5179cb876..57f9a2f51085 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c -@@ -658,6 +658,7 @@ static void flexcan_irq_bus_err(struct n +@@ -677,6 +677,7 @@ static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr) struct can_frame *cf; bool rx_errors = false, tx_errors = false; u32 timestamp; @@ -33,7 +36,7 @@ Signed-off-by: Jiri Slaby timestamp = priv->read(®s->timer) << 16; -@@ -706,7 +707,9 @@ static void flexcan_irq_bus_err(struct n +@@ -725,7 +726,9 @@ static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr) if (tx_errors) dev->stats.tx_errors++; @@ -44,7 +47,7 @@ Signed-off-by: Jiri Slaby } static void flexcan_irq_state(struct net_device *dev, u32 reg_esr) -@@ -719,6 +722,7 @@ static void flexcan_irq_state(struct net +@@ -738,6 +741,7 @@ static void flexcan_irq_state(struct net_device *dev, u32 reg_esr) int flt; struct can_berr_counter bec; u32 timestamp; @@ -52,7 +55,7 @@ Signed-off-by: Jiri Slaby timestamp = priv->read(®s->timer) << 16; -@@ -750,7 +754,9 @@ static void flexcan_irq_state(struct net +@@ -769,7 +773,9 @@ static void flexcan_irq_state(struct net_device *dev, u32 reg_esr) if (unlikely(new_state == CAN_STATE_BUS_OFF)) can_bus_off(dev); @@ -63,3 +66,6 @@ Signed-off-by: Jiri Slaby } static inline struct flexcan_priv *rx_offload_to_priv(struct can_rx_offload *offload) +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-initialize-all-flexcan-memory-for-ECC-fu.patch b/patches.suse/can-flexcan-initialize-all-flexcan-memory-for-ECC-fu.patch new file mode 100644 index 0000000..84b0f55 --- /dev/null +++ b/patches.suse/can-flexcan-initialize-all-flexcan-memory-for-ECC-fu.patch @@ -0,0 +1,149 @@ +From: Joakim Zhang +Date: Wed, 30 Sep 2020 05:15:55 +0800 +Subject: can: flexcan: initialize all flexcan memory for ECC function + +Git-commit: a6597121d672a27886d266357569efa7af552a73 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +One issue was reported at a baremetal environment, which is used for +FPGA verification. "The first transfer will fail for extended ID +format(for both 2.0B and FD format), following frames can be transmitted +and received successfully for extended format, and standard format don't +have this issue. This issue occurred randomly with high possiblity, when +it occurs, the transmitter will detect a BIT1 error, the receiver a CRC +error. According to the spec, a non-correctable error may cause this +transfer failure." + +With FLEXCAN_QUIRK_DISABLE_MECR quirk, it supports correctable errors, +disable non-correctable errors interrupt and freeze mode. Platform has +ECC hardware support, but select this quirk, this issue may not come to +light. Initialize all FlexCAN memory before accessing them, at least it +can avoid non-correctable errors detected due to memory uninitialized. +The internal region can't be initialized when the hardware doesn't support +ECC. + +According to IMX8MPRM, Rev.C, 04/2020. There is a NOTE at the section +11.8.3.13 Detection and correction of memory errors: +"All FlexCAN memory must be initialized before starting its operation in +order to have the parity bits in memory properly updated. CTRL2[WRMFRZ] +grants write access to all memory positions that require initialization, +ranging from 0x080 to 0xADF and from 0xF28 to 0xFFF when the CAN FD feature +is enabled. The RXMGMASK, RX14MASK, RX15MASK, and RXFGMASK registers need to +be initialized as well. MCR[RFEN] must not be set during memory initialization." + +Memory range from 0x080 to 0xADF, there are reserved memory (unimplemented +by hardware, e.g. only configure 64 MBs), these memory can be initialized or not. +In this patch, initialize all flexcan memory which includes reserved memory. + +In this patch, create FLEXCAN_QUIRK_SUPPORT_ECC for platforms which has ECC +feature. If you have a ECC platform in your hand, please select this +qurik to initialize all flexcan memory firstly, then you can select +FLEXCAN_QUIRK_DISABLE_MECR to only enable correctable errors. + +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20200929211557.14153-2-qiangqing.zhang@nxp.com +[mkl: wrap long lines] +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 53 +++++++++++++++++++++++++++++++++++++-- + 1 file changed, 51 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index e86925134009..19a29618f0c0 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -239,6 +239,8 @@ + #define FLEXCAN_QUIRK_SETUP_STOP_MODE BIT(8) + /* Support CAN-FD mode */ + #define FLEXCAN_QUIRK_SUPPORT_FD BIT(9) ++/* support memory detection and correction */ ++#define FLEXCAN_QUIRK_SUPPORT_ECC BIT(10) + + /* Structure of the message buffer */ + struct flexcan_mb { +@@ -292,7 +294,16 @@ struct flexcan_regs { + u32 rximr[64]; /* 0x880 - Not affected by Soft Reset */ + u32 _reserved5[24]; /* 0x980 */ + u32 gfwr_mx6; /* 0x9e0 - MX6 */ +- u32 _reserved6[63]; /* 0x9e4 */ ++ u32 _reserved6[39]; /* 0x9e4 */ ++ u32 _rxfir[6]; /* 0xa80 */ ++ u32 _reserved8[2]; /* 0xa98 */ ++ u32 _rxmgmask; /* 0xaa0 */ ++ u32 _rxfgmask; /* 0xaa4 */ ++ u32 _rx14mask; /* 0xaa8 */ ++ u32 _rx15mask; /* 0xaac */ ++ u32 tx_smb[4]; /* 0xab0 */ ++ u32 rx_smb0[4]; /* 0xac0 */ ++ u32 rx_smb1[4]; /* 0xad0 */ + u32 mecr; /* 0xae0 */ + u32 erriar; /* 0xae4 */ + u32 erridpr; /* 0xae8 */ +@@ -305,9 +316,13 @@ struct flexcan_regs { + u32 fdctrl; /* 0xc00 - Not affected by Soft Reset */ + u32 fdcbt; /* 0xc04 - Not affected by Soft Reset */ + u32 fdcrc; /* 0xc08 */ ++ u32 _reserved9[199]; /* 0xc0c */ ++ u32 tx_smb_fd[18]; /* 0xf28 */ ++ u32 rx_smb0_fd[18]; /* 0xf70 */ ++ u32 rx_smb1_fd[18]; /* 0xfb8 */ + }; + +-static_assert(sizeof(struct flexcan_regs) == 0x4 + 0xc08); ++static_assert(sizeof(struct flexcan_regs) == 0x4 * 18 + 0xfb8); + + struct flexcan_devtype_data { + u32 quirks; /* quirks needed for different IP cores */ +@@ -1292,6 +1307,37 @@ static void flexcan_set_bittiming(struct net_device *dev) + return flexcan_set_bittiming_ctrl(dev); + } + ++static void flexcan_ram_init(struct net_device *dev) ++{ ++ struct flexcan_priv *priv = netdev_priv(dev); ++ struct flexcan_regs __iomem *regs = priv->regs; ++ u32 reg_ctrl2; ++ ++ /* 11.8.3.13 Detection and correction of memory errors: ++ * CTRL2[WRMFRZ] grants write access to all memory positions ++ * that require initialization, ranging from 0x080 to 0xADF ++ * and from 0xF28 to 0xFFF when the CAN FD feature is enabled. ++ * The RXMGMASK, RX14MASK, RX15MASK, and RXFGMASK registers ++ * need to be initialized as well. MCR[RFEN] must not be set ++ * during memory initialization. ++ */ ++ reg_ctrl2 = priv->read(®s->ctrl2); ++ reg_ctrl2 |= FLEXCAN_CTRL2_WRMFRZ; ++ priv->write(reg_ctrl2, ®s->ctrl2); ++ ++ memset_io(®s->mb[0][0], 0, ++ offsetof(struct flexcan_regs, rx_smb1[3]) - ++ offsetof(struct flexcan_regs, mb[0][0]) + 0x4); ++ ++ if (priv->can.ctrlmode & CAN_CTRLMODE_FD) ++ memset_io(®s->tx_smb_fd[0], 0, ++ offsetof(struct flexcan_regs, rx_smb1_fd[17]) - ++ offsetof(struct flexcan_regs, tx_smb_fd[0]) + 0x4); ++ ++ reg_ctrl2 &= ~FLEXCAN_CTRL2_WRMFRZ; ++ priv->write(reg_ctrl2, ®s->ctrl2); ++} ++ + /* flexcan_chip_start + * + * this functions is entered with clocks enabled +@@ -1316,6 +1362,9 @@ static int flexcan_chip_start(struct net_device *dev) + if (err) + goto out_chip_disable; + ++ if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SUPPORT_ECC) ++ flexcan_ram_init(dev); ++ + flexcan_set_bittiming(dev); + + /* MCR +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-introduce-struct-flexcan_priv-tx_mask-an.patch b/patches.suse/can-flexcan-introduce-struct-flexcan_priv-tx_mask-an.patch new file mode 100644 index 0000000..c53e1ac --- /dev/null +++ b/patches.suse/can-flexcan-introduce-struct-flexcan_priv-tx_mask-an.patch @@ -0,0 +1,99 @@ +From: Marc Kleine-Budde +Date: Fri, 1 Mar 2019 13:54:19 +0100 +Subject: can: flexcan: introduce struct flexcan_priv::tx_mask and make use of + it + +Git-commit: 0ca64f02de380e0b75b9555d325e6dcfe36470ef +Patch-mainline: v5.5-rc1 +References: jsc#SLE-12251 + +The current driver uses FLEXCAN_IFLAG2_MB() to generate the mask to check for +the TX complete interrupt. This works well, as the driver will always use the +last mailbox for TX, which falls into the iflag2 register. + +To support CANFD the payload size has to increase to 64 bytes and the +number of mailboxes will decrease so much that the TX mailbox will be +handled in the iflag1 register. + +This patch introduces a tx_mask in the struct flexcan_priv (similar to rx_mask) +and makes use of it. The actual support to handle the TX mailbox in iflag1 will +be added in the next patches. + +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index c3fdd47c5cdb..c2843571b46e 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -143,7 +143,6 @@ + #define FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP 0 + #define FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST (FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP + 1) + #define FLEXCAN_IFLAG_MB(x) BIT_ULL(x) +-#define FLEXCAN_IFLAG2_MB(x) BIT((x) & 0x1f) + #define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7) + #define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6) + #define FLEXCAN_IFLAG_RX_FIFO_AVAILABLE BIT(5) +@@ -279,6 +278,7 @@ struct flexcan_priv { + u8 clk_src; /* clock source of CAN Protocol Engine */ + + u64 rx_mask; ++ u64 tx_mask; + u32 reg_ctrl_default; + + struct clk *clk_ipg; +@@ -890,7 +890,8 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) + struct flexcan_priv *priv = netdev_priv(dev); + struct flexcan_regs __iomem *regs = priv->regs; + irqreturn_t handled = IRQ_NONE; +- u32 reg_iflag2, reg_esr; ++ u64 reg_iflag_tx; ++ u32 reg_esr; + enum can_state last_state = priv->can.state; + + /* reception interrupt */ +@@ -924,10 +925,10 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) + } + } + +- reg_iflag2 = priv->read(®s->iflag2); ++ reg_iflag_tx = (u64)priv->read(®s->iflag2) << 32; + + /* transmission complete interrupt */ +- if (reg_iflag2 & FLEXCAN_IFLAG2_MB(priv->tx_mb_idx)) { ++ if (reg_iflag_tx & priv->tx_mask) { + u32 reg_ctrl = priv->read(&priv->tx_mb->can_ctrl); + + handled = IRQ_HANDLED; +@@ -939,7 +940,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) + /* after sending a RTR frame MB is in RX mode */ + priv->write(FLEXCAN_MB_CODE_TX_INACTIVE, + &priv->tx_mb->can_ctrl); +- priv->write(FLEXCAN_IFLAG2_MB(priv->tx_mb_idx), ®s->iflag2); ++ priv->write(priv->tx_mask >> 32, ®s->iflag2); + netif_wake_queue(dev); + } + +@@ -1226,7 +1227,7 @@ static int flexcan_chip_start(struct net_device *dev) + /* enable interrupts atomically */ + disable_irq(dev->irq); + priv->write(priv->reg_ctrl_default, ®s->ctrl); +- reg_imask = priv->rx_mask | FLEXCAN_IFLAG_MB(priv->tx_mb_idx); ++ reg_imask = priv->rx_mask | priv->tx_mask; + priv->write(upper_32_bits(reg_imask), ®s->imask2); + priv->write(lower_32_bits(reg_imask), ®s->imask1); + enable_irq(dev->irq); +@@ -1296,6 +1297,7 @@ static int flexcan_open(struct net_device *dev) + flexcan_get_mb(priv, FLEXCAN_TX_MB_RESERVED_OFF_FIFO); + priv->tx_mb_idx = priv->mb_count - 1; + priv->tx_mb = flexcan_get_mb(priv, priv->tx_mb_idx); ++ priv->tx_mask = FLEXCAN_IFLAG_MB(priv->tx_mb_idx); + + priv->offload.mailbox_read = flexcan_mailbox_read; + +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-more-register-names.patch b/patches.suse/can-flexcan-more-register-names.patch new file mode 100644 index 0000000..cc96a73 --- /dev/null +++ b/patches.suse/can-flexcan-more-register-names.patch @@ -0,0 +1,62 @@ +From: Marc Kleine-Budde +Date: Tue, 22 Sep 2020 16:44:12 +0200 +Subject: can: flexcan: more register names + +Git-commit: 4b702878afc375979be48c8da427455eb8496b15 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +This patch adds some new register names and tries to ensure with a +static_assert that the documented offset is correct. + +Signed-off-by: Marc Kleine-Budde +Link: https://lore.kernel.org/r/20200922144429.2613631-4-mkl@pengutronix.de +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 43fa38033383..c24d7b63e1b9 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -205,7 +205,7 @@ struct flexcan_regs { + u32 mcr; /* 0x00 */ + u32 ctrl; /* 0x04 */ + u32 timer; /* 0x08 */ +- u32 _reserved1; /* 0x0c */ ++ u32 tcr; /* 0x0c */ + u32 rxgmask; /* 0x10 */ + u32 rx14mask; /* 0x14 */ + u32 rx15mask; /* 0x18 */ +@@ -225,7 +225,11 @@ struct flexcan_regs { + u32 crcr; /* 0x44 */ + u32 rxfgmask; /* 0x48 */ + u32 rxfir; /* 0x4c */ +- u32 _reserved3[12]; /* 0x50 */ ++ u32 cbt; /* 0x50 */ ++ u32 _reserved2; /* 0x54 */ ++ u32 dbg1; /* 0x58 */ ++ u32 dbg2; /* 0x5c */ ++ u32 _reserved3[8]; /* 0x60 */ + u8 mb[2][512]; /* 0x80 */ + /* FIFO-mode: + * MB +@@ -250,8 +254,14 @@ struct flexcan_regs { + u32 rerrdr; /* 0xaf4 */ + u32 rerrsynr; /* 0xaf8 */ + u32 errsr; /* 0xafc */ ++ u32 _reserved7[64]; /* 0xb00 */ ++ u32 fdctrl; /* 0xc00 */ ++ u32 fdcbt; /* 0xc04 */ ++ u32 fdcrc; /* 0xc08 */ + }; + ++static_assert(sizeof(struct flexcan_regs) == 0x4 + 0xc08); ++ + struct flexcan_devtype_data { + u32 quirks; /* quirks needed for different IP cores */ + }; +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-move-enabling-disabling-of-interrupts-fr.patch b/patches.suse/can-flexcan-move-enabling-disabling-of-interrupts-fr.patch new file mode 100644 index 0000000..f73e83c --- /dev/null +++ b/patches.suse/can-flexcan-move-enabling-disabling-of-interrupts-fr.patch @@ -0,0 +1,98 @@ +From: Marc Kleine-Budde +Date: Thu, 19 Nov 2020 11:09:14 +0100 +Subject: can: flexcan: move enabling/disabling of interrupts from + flexcan_chip_{start,stop}() to callers + +Git-commit: 49dea0443918da38f1cce94e74e17d2972c03016 +Patch-mainline: v5.11-rc1 +References: jsc#SLE-12251 + +The function flexcan_chip_start() first configures the CAN controller and then +enables the interrupt, flexcan_chip_stop() does the opposite. + +In an upcoming patch the order of operations in flexcan_open() and +flexcan_close() are changed. This requires +flexcan_chip_start()/flexcan_chip_stop_disable_on_error() and +flexcan_chip_interrupts_{enable,disable}() to be independent of each other. + +This patch moves the enabling of the interrupts from flexcan_chip_start() to +its callers flexcan_open() and flexcan_resume(). Likewise the disabling of the +interrupts is moved from __flexcan_chip_stop() to its indirect callers +flexcan_close() and flexcan_suspend(). + +Link: https://lore.kernel.org/r/20201119100917.3013281-3-mkl@pengutronix.de +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 681a4d82681c..64c174aa868b 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -1598,8 +1598,6 @@ static int flexcan_chip_start(struct net_device *dev) + + priv->can.state = CAN_STATE_ERROR_ACTIVE; + +- flexcan_chip_interrupts_enable(dev); +- + /* print chip status */ + netdev_dbg(dev, "%s: reading mcr=0x%08x ctrl=0x%08x\n", __func__, + priv->read(®s->mcr), priv->read(®s->ctrl)); +@@ -1628,8 +1626,6 @@ static int __flexcan_chip_stop(struct net_device *dev, bool disable_on_error) + if (err && !disable_on_error) + goto out_chip_unfreeze; + +- flexcan_chip_interrupts_disable(dev); +- + priv->can.state = CAN_STATE_STOPPED; + + return 0; +@@ -1719,6 +1715,8 @@ static int flexcan_open(struct net_device *dev) + if (err) + goto out_offload_del; + ++ flexcan_chip_interrupts_enable(dev); ++ + can_led_event(dev, CAN_LED_EVENT_OPEN); + + can_rx_offload_enable(&priv->offload); +@@ -1747,6 +1745,7 @@ static int flexcan_close(struct net_device *dev) + netif_stop_queue(dev); + can_rx_offload_disable(&priv->offload); + flexcan_chip_stop_disable_on_error(dev); ++ flexcan_chip_interrupts_disable(dev); + + can_rx_offload_del(&priv->offload); + free_irq(dev->irq, dev); +@@ -1770,6 +1769,8 @@ static int flexcan_set_mode(struct net_device *dev, enum can_mode mode) + if (err) + return err; + ++ flexcan_chip_interrupts_enable(dev); ++ + netif_wake_queue(dev); + break; + +@@ -2108,6 +2109,8 @@ static int __maybe_unused flexcan_suspend(struct device *device) + if (err) + return err; + ++ flexcan_chip_interrupts_disable(dev); ++ + err = pinctrl_pm_select_sleep_state(device); + if (err) + return err; +@@ -2143,6 +2146,8 @@ static int __maybe_unused flexcan_resume(struct device *device) + err = flexcan_chip_start(dev); + if (err) + return err; ++ ++ flexcan_chip_interrupts_enable(dev); + } + } + +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-quirks-get-rid-of-long-lines.patch b/patches.suse/can-flexcan-quirks-get-rid-of-long-lines.patch new file mode 100644 index 0000000..cf9379c --- /dev/null +++ b/patches.suse/can-flexcan-quirks-get-rid-of-long-lines.patch @@ -0,0 +1,56 @@ +From: Marc Kleine-Budde +Date: Tue, 22 Sep 2020 16:44:14 +0200 +Subject: can: flexcan: quirks: get rid of long lines + +Git-commit: ef4b623b141f113b67dfd12294695a3b1111ad6c +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +This patch reformats the quirks to get rid of long lines. + +Signed-off-by: Marc Kleine-Budde +Link: https://lore.kernel.org/r/20200922144429.2613631-6-mkl@pengutronix.de +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 25 +++++++++++++++++-------- + 1 file changed, 17 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 224000f53a88..b180dd1ba763 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -184,14 +184,23 @@ + * + * Some SOCs do not have the RX_WARN & TX_WARN interrupt line connected. + */ +-#define FLEXCAN_QUIRK_BROKEN_WERR_STATE BIT(1) /* [TR]WRN_INT not connected */ +-#define FLEXCAN_QUIRK_DISABLE_RXFG BIT(2) /* Disable RX FIFO Global mask */ +-#define FLEXCAN_QUIRK_ENABLE_EACEN_RRS BIT(3) /* Enable EACEN and RRS bit in ctrl2 */ +-#define FLEXCAN_QUIRK_DISABLE_MECR BIT(4) /* Disable Memory error detection */ +-#define FLEXCAN_QUIRK_USE_OFF_TIMESTAMP BIT(5) /* Use timestamp based offloading */ +-#define FLEXCAN_QUIRK_BROKEN_PERR_STATE BIT(6) /* No interrupt for error passive */ +-#define FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN BIT(7) /* default to BE register access */ +-#define FLEXCAN_QUIRK_SETUP_STOP_MODE BIT(8) /* Setup stop mode to support wakeup */ ++ ++/* [TR]WRN_INT not connected */ ++#define FLEXCAN_QUIRK_BROKEN_WERR_STATE BIT(1) ++ /* Disable RX FIFO Global mask */ ++#define FLEXCAN_QUIRK_DISABLE_RXFG BIT(2) ++/* Enable EACEN and RRS bit in ctrl2 */ ++#define FLEXCAN_QUIRK_ENABLE_EACEN_RRS BIT(3) ++/* Disable Memory error detection */ ++#define FLEXCAN_QUIRK_DISABLE_MECR BIT(4) ++/* Use timestamp based offloading */ ++#define FLEXCAN_QUIRK_USE_OFF_TIMESTAMP BIT(5) ++/* No interrupt for error passive */ ++#define FLEXCAN_QUIRK_BROKEN_PERR_STATE BIT(6) ++/* default to BE register access */ ++#define FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN BIT(7) ++/* Setup stop mode to support wakeup */ ++#define FLEXCAN_QUIRK_SETUP_STOP_MODE BIT(8) + + /* Structure of the message buffer */ + struct flexcan_mb { +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-remove-FLEXCAN_QUIRK_DISABLE_MECR-quirk-.patch b/patches.suse/can-flexcan-remove-FLEXCAN_QUIRK_DISABLE_MECR-quirk-.patch index a0fd5a8..bacf8c2 100644 --- a/patches.suse/can-flexcan-remove-FLEXCAN_QUIRK_DISABLE_MECR-quirk-.patch +++ b/patches.suse/can-flexcan-remove-FLEXCAN_QUIRK_DISABLE_MECR-quirk-.patch @@ -1,10 +1,10 @@ -From 018799649071a1638c0c130526af36747df4355a Mon Sep 17 00:00:00 2001 From: Joakim Zhang Date: Tue, 20 Oct 2020 23:53:55 +0800 -Subject: [PATCH] can: flexcan: remove FLEXCAN_QUIRK_DISABLE_MECR quirk for LS1021A +Subject: can: flexcan: remove FLEXCAN_QUIRK_DISABLE_MECR quirk for LS1021A + Git-commit: 018799649071a1638c0c130526af36747df4355a Patch-mainline: v5.10-rc3 -References: git-fixes +References: jsc#SLE-12251 After double check with Layerscape CAN owner (Pankaj Bansal), confirm that LS1021A doesn't support ECC feature, so remove FLEXCAN_QUIRK_DISABLE_MECR @@ -15,15 +15,16 @@ Cc: Pankaj Bansal Signed-off-by: Joakim Zhang Link: https://lore.kernel.org/r/20201020155402.30318-4-qiangqing.zhang@nxp.com Signed-off-by: Marc Kleine-Budde -Acked-by: Takashi Iwai - +Signed-off-by: Mian Yousaf Kaukab --- - drivers/net/can/flexcan.c | 3 +-- + drivers/net/can/flexcan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 4d594e977497..586e1417a697 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c -@@ -315,8 +315,7 @@ static const struct flexcan_devtype_data +@@ -405,8 +405,7 @@ static const struct flexcan_devtype_data fsl_vf610_devtype_data = { static const struct flexcan_devtype_data fsl_ls1021a_r2_devtype_data = { .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | @@ -32,4 +33,7 @@ Acked-by: Takashi Iwai + FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP, }; - static const struct can_bittiming_const flexcan_bittiming_const = { + static const struct flexcan_devtype_data fsl_lx2160a_r1_devtype_data = { +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-remove-TX-mailbox-bit-from-struct-flexca.patch b/patches.suse/can-flexcan-remove-TX-mailbox-bit-from-struct-flexca.patch new file mode 100644 index 0000000..d158035 --- /dev/null +++ b/patches.suse/can-flexcan-remove-TX-mailbox-bit-from-struct-flexca.patch @@ -0,0 +1,80 @@ +From: Marc Kleine-Budde +Date: Fri, 1 Mar 2019 10:22:26 +0100 +Subject: can: flexcan: remove TX mailbox bit from struct + flexcan_priv::rx_mask{1,2} + +Git-commit: 9ed63c60c9e3ace16e4307866cc01e8ddf296155 +Patch-mainline: v5.5-rc1 +References: jsc#SLE-12251 + +The flexcan IP core has up to 64 mailboxes, each one has a corresponding +interrupt bit in the iflag1 or iflag2 registers and a mask bit in the +imask1 or imask2 registers. + +In the timestamp (i.e. non FIFO) mode the driver needs to mask out all +non RX interrupt sources and uses the precomputed values rx_mask1 and +rx_mask2 of struct flexcan_priv for this. + +Currently these values cannot be used directly, as they contain the TX +mailbox flag. This patch removes the TX flag from flexcan_priv::rx_mask1 +and flexcan_priv::rx_mask2, and sets the TX flag directly when writing +the regs->iflag1 and regs->iflag2 into the hardware. + +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 14 +++++--------- + 1 file changed, 5 insertions(+), 9 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 44ac211af7eb..29d1dbe89351 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -878,8 +878,7 @@ static inline u64 flexcan_read_reg_iflag_rx(struct flexcan_priv *priv) + struct flexcan_regs __iomem *regs = priv->regs; + u32 iflag1, iflag2; + +- iflag2 = priv->read(®s->iflag2) & priv->rx_mask2 & +- ~FLEXCAN_IFLAG2_MB(priv->tx_mb_idx); ++ iflag2 = priv->read(®s->iflag2) & priv->rx_mask2; + iflag1 = priv->read(®s->iflag1) & priv->rx_mask1; + + return (u64)iflag2 << 32 | iflag1; +@@ -1228,7 +1227,7 @@ static int flexcan_chip_start(struct net_device *dev) + disable_irq(dev->irq); + priv->write(priv->reg_ctrl_default, ®s->ctrl); + priv->write(priv->rx_mask1, ®s->imask1); +- priv->write(priv->rx_mask2, ®s->imask2); ++ priv->write(priv->rx_mask2 | FLEXCAN_IFLAG2_MB(priv->tx_mb_idx), ®s->imask2); + enable_irq(dev->irq); + + /* print chip status */ +@@ -1297,9 +1296,6 @@ static int flexcan_open(struct net_device *dev) + priv->tx_mb_idx = priv->mb_count - 1; + priv->tx_mb = flexcan_get_mb(priv, priv->tx_mb_idx); + +- priv->rx_mask1 = 0; +- priv->rx_mask2 = FLEXCAN_IFLAG2_MB(priv->tx_mb_idx); +- + priv->offload.mailbox_read = flexcan_mailbox_read; + + if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { +@@ -1310,12 +1306,12 @@ static int flexcan_open(struct net_device *dev) + + imask = GENMASK_ULL(priv->offload.mb_last, + priv->offload.mb_first); +- priv->rx_mask1 |= imask; +- priv->rx_mask2 |= imask >> 32; ++ priv->rx_mask1 = imask; ++ priv->rx_mask2 = imask >> 32; + + err = can_rx_offload_add_timestamp(dev, &priv->offload); + } else { +- priv->rx_mask1 |= FLEXCAN_IFLAG_RX_FIFO_OVERFLOW | ++ priv->rx_mask1 = FLEXCAN_IFLAG_RX_FIFO_OVERFLOW | + FLEXCAN_IFLAG_RX_FIFO_AVAILABLE; + err = can_rx_offload_add_fifo(dev, &priv->offload, + FLEXCAN_NAPI_WEIGHT); +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-remove-ack_grp-and-ack_bit-handling-from.patch b/patches.suse/can-flexcan-remove-ack_grp-and-ack_bit-handling-from.patch index 113646f..929acde 100644 --- a/patches.suse/can-flexcan-remove-ack_grp-and-ack_bit-handling-from.patch +++ b/patches.suse/can-flexcan-remove-ack_grp-and-ack_bit-handling-from.patch @@ -1,10 +1,10 @@ -From d9b081e3fc4bdc33e672dcb7bb256394909432fc Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Sun, 14 Jun 2020 21:09:20 +0200 -Subject: [PATCH] can: flexcan: remove ack_grp and ack_bit handling from driver +Subject: can: flexcan: remove ack_grp and ack_bit handling from driver + Git-commit: d9b081e3fc4bdc33e672dcb7bb256394909432fc Patch-mainline: v5.10-rc1 -References: git-fixes +References: jsc#SLE-12251 Since commit: @@ -20,8 +20,7 @@ Link: http://lore.kernel.org/r/20201006203748.1750156-15-mkl@pengutronix.de Fixes: 048e3a34a2e7 ("can: flexcan: poll MCR_LPM_ACK instead of GPR ACK for stop mode acknowledgment") Cc: Joakim Zhang Signed-off-by: Marc Kleine-Budde -Acked-by: Takashi Iwai - +Signed-off-by: Mian Yousaf Kaukab --- drivers/net/can/flexcan.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) @@ -73,5 +72,5 @@ index fbdd9a8c9374..4d594e977497 100644 device_set_wakeup_capable(&pdev->dev, true); -- -2.16.4 +2.26.2 diff --git a/patches.suse/can-flexcan-rename-macro-FLEXCAN_IFLAG_MB-FLEXCAN_IF.patch b/patches.suse/can-flexcan-rename-macro-FLEXCAN_IFLAG_MB-FLEXCAN_IF.patch new file mode 100644 index 0000000..3ffd866 --- /dev/null +++ b/patches.suse/can-flexcan-rename-macro-FLEXCAN_IFLAG_MB-FLEXCAN_IF.patch @@ -0,0 +1,69 @@ +From: Marc Kleine-Budde +Date: Fri, 1 Mar 2019 11:12:13 +0100 +Subject: can: flexcan: rename macro FLEXCAN_IFLAG_MB() -> FLEXCAN_IFLAG2_MB() + +Git-commit: b36d3c0f7e70dff646b87e2c3d4ee0ac953d8b49 +Patch-mainline: v5.5-rc1 +References: jsc#SLE-12251 + +The macro FLEXCAN_IFLAG_MB() is always used for the iflag2 register, so +rename it to FLEXCAN_IFLAG2_MB() + +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 148c0a3fab24..4b2275b3c8e0 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -142,7 +142,7 @@ + #define FLEXCAN_TX_MB_RESERVED_OFF_FIFO 8 + #define FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP 0 + #define FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST (FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP + 1) +-#define FLEXCAN_IFLAG_MB(x) BIT((x) & 0x1f) ++#define FLEXCAN_IFLAG2_MB(x) BIT((x) & 0x1f) + #define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7) + #define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6) + #define FLEXCAN_IFLAG_RX_FIFO_AVAILABLE BIT(5) +@@ -879,7 +879,7 @@ static inline u64 flexcan_read_reg_iflag_rx(struct flexcan_priv *priv) + u32 iflag1, iflag2; + + iflag2 = priv->read(®s->iflag2) & priv->reg_imask2_default & +- ~FLEXCAN_IFLAG_MB(priv->tx_mb_idx); ++ ~FLEXCAN_IFLAG2_MB(priv->tx_mb_idx); + iflag1 = priv->read(®s->iflag1) & priv->reg_imask1_default; + + return (u64)iflag2 << 32 | iflag1; +@@ -929,7 +929,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) + reg_iflag2 = priv->read(®s->iflag2); + + /* transmission complete interrupt */ +- if (reg_iflag2 & FLEXCAN_IFLAG_MB(priv->tx_mb_idx)) { ++ if (reg_iflag2 & FLEXCAN_IFLAG2_MB(priv->tx_mb_idx)) { + u32 reg_ctrl = priv->read(&priv->tx_mb->can_ctrl); + + handled = IRQ_HANDLED; +@@ -941,7 +941,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) + /* after sending a RTR frame MB is in RX mode */ + priv->write(FLEXCAN_MB_CODE_TX_INACTIVE, + &priv->tx_mb->can_ctrl); +- priv->write(FLEXCAN_IFLAG_MB(priv->tx_mb_idx), ®s->iflag2); ++ priv->write(FLEXCAN_IFLAG2_MB(priv->tx_mb_idx), ®s->iflag2); + netif_wake_queue(dev); + } + +@@ -1298,7 +1298,7 @@ static int flexcan_open(struct net_device *dev) + priv->tx_mb = flexcan_get_mb(priv, priv->tx_mb_idx); + + priv->reg_imask1_default = 0; +- priv->reg_imask2_default = FLEXCAN_IFLAG_MB(priv->tx_mb_idx); ++ priv->reg_imask2_default = FLEXCAN_IFLAG2_MB(priv->tx_mb_idx); + + priv->offload.mailbox_read = flexcan_mailbox_read; + +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-rename-macro-FLEXCAN_QUIRK_SETUP_STOP_MO.patch b/patches.suse/can-flexcan-rename-macro-FLEXCAN_QUIRK_SETUP_STOP_MO.patch new file mode 100644 index 0000000..2e14cf3 --- /dev/null +++ b/patches.suse/can-flexcan-rename-macro-FLEXCAN_QUIRK_SETUP_STOP_MO.patch @@ -0,0 +1,69 @@ +From: Joakim Zhang +Date: Fri, 6 Nov 2020 18:56:25 +0800 +Subject: can: flexcan: rename macro FLEXCAN_QUIRK_SETUP_STOP_MODE -> + FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR + +Git-commit: 1457998a6d3a507d6e213623f915c919297c37b1 +Patch-mainline: v5.11-rc1 +References: jsc#SLE-12251 + +This patch intends to rename FLEXCAN_QUIRK_SETUP_STOP_MODE quirk +to FLEXCAN_QUIRK_SETUP_STOP_MODE_GRP for non-scu SoCs, coming patch will +add quirk for scu SoCs. + +For non-scu SoCs, setup stop mode with GPR register. +For scu SoCs, setup stop mode with SCU firmware. + +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20201106105627.31061-4-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 6f3555381230..56a6bcc6d9d7 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -236,8 +236,8 @@ + #define FLEXCAN_QUIRK_BROKEN_PERR_STATE BIT(6) + /* default to BE register access */ + #define FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN BIT(7) +-/* Setup stop mode to support wakeup */ +-#define FLEXCAN_QUIRK_SETUP_STOP_MODE BIT(8) ++/* Setup stop mode with GPR to support wakeup */ ++#define FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR BIT(8) + /* Support CAN-FD mode */ + #define FLEXCAN_QUIRK_SUPPORT_FD BIT(9) + /* support memory detection and correction */ +@@ -381,7 +381,7 @@ static const struct flexcan_devtype_data fsl_imx28_devtype_data = { + static const struct flexcan_devtype_data fsl_imx6q_devtype_data = { + .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | + FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | FLEXCAN_QUIRK_BROKEN_PERR_STATE | +- FLEXCAN_QUIRK_SETUP_STOP_MODE, ++ FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR, + }; + + static const struct flexcan_devtype_data fsl_imx8qm_devtype_data = { +@@ -393,7 +393,7 @@ static const struct flexcan_devtype_data fsl_imx8qm_devtype_data = { + static struct flexcan_devtype_data fsl_imx8mp_devtype_data = { + .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | + FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | +- FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SETUP_STOP_MODE | ++ FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR | + FLEXCAN_QUIRK_SUPPORT_FD | FLEXCAN_QUIRK_SUPPORT_ECC, + }; + +@@ -2047,7 +2047,7 @@ static int flexcan_probe(struct platform_device *pdev) + of_can_transceiver(dev); + devm_can_led_init(dev); + +- if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE) { ++ if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR) { + err = flexcan_setup_stop_mode(pdev); + if (err) + dev_dbg(&pdev->dev, "failed to setup stop-mode\n"); +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-rename-struct-flexcan_priv-reg_imask-1-2.patch b/patches.suse/can-flexcan-rename-struct-flexcan_priv-reg_imask-1-2.patch new file mode 100644 index 0000000..5f6b474 --- /dev/null +++ b/patches.suse/can-flexcan-rename-struct-flexcan_priv-reg_imask-1-2.patch @@ -0,0 +1,110 @@ +From: Marc Kleine-Budde +Date: Fri, 1 Mar 2019 09:18:54 +0100 +Subject: can: flexcan: rename struct flexcan_priv::reg_imask{1,2}_default to + rx_mask{1,2} + +Git-commit: 07c054d3e53fe27025dae5e232465c8ecf658ebf +Patch-mainline: v5.5-rc1 +References: jsc#SLE-12251 + +The flexcan IP core has up to 64 mailboxes, each one has a corresponding +interrupt bit in the iflag1 or iflag2 registers and a mask bit in the +imask1 or imask2 registers. + +In the timestamp (i.e. non FIFO) mode the driver needs to mask out all +non RX interrupt sources and uses the precomputed values +reg_imask1_default and reg_imask2_default of struct flexcan_priv for +this. + +However in the current driver the reg_imask{1,2}_default cannot be used +directly to get the pending RX interrupts. The TX interrupt is part of +these variables, so it needs to be masked out, too. + +This is a preparation patch to clean up calculation of the pending RX +interrupts, it only renames the variables from + + reg_imask{1,2}_default + +to + + rx_mask{1,2} + +To better reflect their meaning after the complete conversion. This +change is done with the following sed command: + + sed -i -e "s/reg_imask\(1\|2\)_default/rx_mask\1/" drivers/net/can/flexcan.c + +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index be81c8439a32..44ac211af7eb 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -278,8 +278,8 @@ struct flexcan_priv { + u8 clk_src; /* clock source of CAN Protocol Engine */ + + u32 reg_ctrl_default; +- u32 reg_imask1_default; +- u32 reg_imask2_default; ++ u32 rx_mask1; ++ u32 rx_mask2; + + struct clk *clk_ipg; + struct clk *clk_per; +@@ -878,9 +878,9 @@ static inline u64 flexcan_read_reg_iflag_rx(struct flexcan_priv *priv) + struct flexcan_regs __iomem *regs = priv->regs; + u32 iflag1, iflag2; + +- iflag2 = priv->read(®s->iflag2) & priv->reg_imask2_default & ++ iflag2 = priv->read(®s->iflag2) & priv->rx_mask2 & + ~FLEXCAN_IFLAG2_MB(priv->tx_mb_idx); +- iflag1 = priv->read(®s->iflag1) & priv->reg_imask1_default; ++ iflag1 = priv->read(®s->iflag1) & priv->rx_mask1; + + return (u64)iflag2 << 32 | iflag1; + } +@@ -1227,8 +1227,8 @@ static int flexcan_chip_start(struct net_device *dev) + /* enable interrupts atomically */ + disable_irq(dev->irq); + priv->write(priv->reg_ctrl_default, ®s->ctrl); +- priv->write(priv->reg_imask1_default, ®s->imask1); +- priv->write(priv->reg_imask2_default, ®s->imask2); ++ priv->write(priv->rx_mask1, ®s->imask1); ++ priv->write(priv->rx_mask2, ®s->imask2); + enable_irq(dev->irq); + + /* print chip status */ +@@ -1297,8 +1297,8 @@ static int flexcan_open(struct net_device *dev) + priv->tx_mb_idx = priv->mb_count - 1; + priv->tx_mb = flexcan_get_mb(priv, priv->tx_mb_idx); + +- priv->reg_imask1_default = 0; +- priv->reg_imask2_default = FLEXCAN_IFLAG2_MB(priv->tx_mb_idx); ++ priv->rx_mask1 = 0; ++ priv->rx_mask2 = FLEXCAN_IFLAG2_MB(priv->tx_mb_idx); + + priv->offload.mailbox_read = flexcan_mailbox_read; + +@@ -1310,12 +1310,12 @@ static int flexcan_open(struct net_device *dev) + + imask = GENMASK_ULL(priv->offload.mb_last, + priv->offload.mb_first); +- priv->reg_imask1_default |= imask; +- priv->reg_imask2_default |= imask >> 32; ++ priv->rx_mask1 |= imask; ++ priv->rx_mask2 |= imask >> 32; + + err = can_rx_offload_add_timestamp(dev, &priv->offload); + } else { +- priv->reg_imask1_default |= FLEXCAN_IFLAG_RX_FIFO_OVERFLOW | ++ priv->rx_mask1 |= FLEXCAN_IFLAG_RX_FIFO_OVERFLOW | + FLEXCAN_IFLAG_RX_FIFO_AVAILABLE; + err = can_rx_offload_add_fifo(dev, &priv->offload, + FLEXCAN_NAPI_WEIGHT); +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-sort-include-files-alphabetically.patch b/patches.suse/can-flexcan-sort-include-files-alphabetically.patch new file mode 100644 index 0000000..e352756 --- /dev/null +++ b/patches.suse/can-flexcan-sort-include-files-alphabetically.patch @@ -0,0 +1,47 @@ +From: Marc Kleine-Budde +Date: Tue, 22 Sep 2020 16:44:10 +0200 +Subject: can: flexcan: sort include files alphabetically + +Git-commit: 555f6e568dfbbc0891c823261d55d5edb89b1397 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +This patch sorts the include files alphabetically. + +Signed-off-by: Marc Kleine-Budde +Link: https://lore.kernel.org/r/20200922144429.2613631-2-mkl@pengutronix.de +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 19403e88daa3..6198319d8fac 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -9,7 +9,6 @@ + // + // Based on code originally by Andrey Volkov + +-#include + #include + #include + #include +@@ -21,12 +20,13 @@ + #include + #include + #include ++#include + #include + #include + #include + #include +-#include + #include ++#include + + #define DRV_NAME "flexcan" + +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-struct-flexcan_regs-document-registers-n.patch b/patches.suse/can-flexcan-struct-flexcan_regs-document-registers-n.patch new file mode 100644 index 0000000..af6a4d4 --- /dev/null +++ b/patches.suse/can-flexcan-struct-flexcan_regs-document-registers-n.patch @@ -0,0 +1,88 @@ +From: Marc Kleine-Budde +Date: Tue, 22 Sep 2020 16:44:13 +0200 +Subject: can: flexcan: struct flexcan_regs: document registers not affected by + soft reset + +Git-commit: fe63a0661023a600e2b5cff7eff2500bf191a161 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +This patch documents which registers are not affected by a soft reset of the +flexcan IP core. + +Signed-off-by: Marc Kleine-Budde +Link: https://lore.kernel.org/r/20200922144429.2613631-5-mkl@pengutronix.de +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index c24d7b63e1b9..224000f53a88 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -203,12 +203,12 @@ struct flexcan_mb { + /* Structure of the hardware registers */ + struct flexcan_regs { + u32 mcr; /* 0x00 */ +- u32 ctrl; /* 0x04 */ ++ u32 ctrl; /* 0x04 - Not affected by Soft Reset */ + u32 timer; /* 0x08 */ + u32 tcr; /* 0x0c */ +- u32 rxgmask; /* 0x10 */ +- u32 rx14mask; /* 0x14 */ +- u32 rx15mask; /* 0x18 */ ++ u32 rxgmask; /* 0x10 - Not affected by Soft Reset */ ++ u32 rx14mask; /* 0x14 - Not affected by Soft Reset */ ++ u32 rx15mask; /* 0x18 - Not affected by Soft Reset */ + u32 ecr; /* 0x1c */ + u32 esr; /* 0x20 */ + u32 imask2; /* 0x24 */ +@@ -217,20 +217,20 @@ struct flexcan_regs { + u32 iflag1; /* 0x30 */ + union { /* 0x34 */ + u32 gfwr_mx28; /* MX28, MX53 */ +- u32 ctrl2; /* MX6, VF610 */ ++ u32 ctrl2; /* MX6, VF610 - Not affected by Soft Reset */ + }; + u32 esr2; /* 0x38 */ + u32 imeur; /* 0x3c */ + u32 lrfr; /* 0x40 */ + u32 crcr; /* 0x44 */ + u32 rxfgmask; /* 0x48 */ +- u32 rxfir; /* 0x4c */ +- u32 cbt; /* 0x50 */ ++ u32 rxfir; /* 0x4c - Not affected by Soft Reset */ ++ u32 cbt; /* 0x50 - Not affected by Soft Reset */ + u32 _reserved2; /* 0x54 */ + u32 dbg1; /* 0x58 */ + u32 dbg2; /* 0x5c */ + u32 _reserved3[8]; /* 0x60 */ +- u8 mb[2][512]; /* 0x80 */ ++ u8 mb[2][512]; /* 0x80 - Not affected by Soft Reset */ + /* FIFO-mode: + * MB + * 0x080...0x08f 0 RX message buffer +@@ -242,7 +242,7 @@ struct flexcan_regs { + * (mx6, vf610) + */ + u32 _reserved4[256]; /* 0x480 */ +- u32 rximr[64]; /* 0x880 */ ++ u32 rximr[64]; /* 0x880 - Not affected by Soft Reset */ + u32 _reserved5[24]; /* 0x980 */ + u32 gfwr_mx6; /* 0x9e0 - MX6 */ + u32 _reserved6[63]; /* 0x9e4 */ +@@ -255,8 +255,8 @@ struct flexcan_regs { + u32 rerrsynr; /* 0xaf8 */ + u32 errsr; /* 0xafc */ + u32 _reserved7[64]; /* 0xb00 */ +- u32 fdctrl; /* 0xc00 */ +- u32 fdcbt; /* 0xc04 */ ++ u32 fdctrl; /* 0xc00 - Not affected by Soft Reset */ ++ u32 fdcbt; /* 0xc04 - Not affected by Soft Reset */ + u32 fdcrc; /* 0xc08 */ + }; + +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-use-devm_platform_ioremap_resource-to-si.patch b/patches.suse/can-flexcan-use-devm_platform_ioremap_resource-to-si.patch new file mode 100644 index 0000000..56650cd --- /dev/null +++ b/patches.suse/can-flexcan-use-devm_platform_ioremap_resource-to-si.patch @@ -0,0 +1,49 @@ +From: Joakim Zhang +Date: Sun, 29 Sep 2019 08:32:09 +0000 +Subject: can: flexcan: use devm_platform_ioremap_resource() to simplify code + +Git-commit: a4721f27b94a807205d96a24c9f70fe7caf81b3b +Patch-mainline: v5.5-rc1 +References: jsc#SLE-12251 + +Use the new helper devm_platform_ioremap_resource() which wraps the +platform_get_resource() and devm_ioremap_resource() together to simplify +the code. + +Signed-off-by: Joakim Zhang +Reviewed-by: Sean Nyekjaer +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index 1a8198163b80..362ed90c701f 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -1547,7 +1547,6 @@ static int flexcan_probe(struct platform_device *pdev) + struct net_device *dev; + struct flexcan_priv *priv; + struct regulator *reg_xceiver; +- struct resource *mem; + struct clk *clk_ipg = NULL, *clk_per = NULL; + struct flexcan_regs __iomem *regs; + int err, irq; +@@ -1582,12 +1581,11 @@ static int flexcan_probe(struct platform_device *pdev) + clock_freq = clk_get_rate(clk_per); + } + +- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + irq = platform_get_irq(pdev, 0); + if (irq <= 0) + return -ENODEV; + +- regs = devm_ioremap_resource(&pdev->dev, mem); ++ regs = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(regs)) + return PTR_ERR(regs); + +-- +2.26.2 + diff --git a/patches.suse/can-flexcan-use-struct-canfd_frame-for-CAN-classic-f.patch b/patches.suse/can-flexcan-use-struct-canfd_frame-for-CAN-classic-f.patch new file mode 100644 index 0000000..88f15d1 --- /dev/null +++ b/patches.suse/can-flexcan-use-struct-canfd_frame-for-CAN-classic-f.patch @@ -0,0 +1,108 @@ +From: Joakim Zhang +Date: Fri, 12 Jul 2019 08:02:41 +0000 +Subject: can: flexcan: use struct canfd_frame for CAN classic frame + +Git-commit: d9b90b05fd78f7a7482ee22a6a6c5581695b4beb +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +This patch prepares for CAN FD mode, using struct canfd_frame can both +for classic format frame and fd format frame. + +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20190712075926.7357-3-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 34 +++++++++++++++++----------------- + 1 file changed, 17 insertions(+), 17 deletions(-) + +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c +index a9908deae411..20c845c265e1 100644 +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -646,10 +646,10 @@ static int flexcan_get_berr_counter(const struct net_device *dev, + static netdev_tx_t flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev) + { + const struct flexcan_priv *priv = netdev_priv(dev); +- struct can_frame *cf = (struct can_frame *)skb->data; ++ struct canfd_frame *cfd = (struct canfd_frame *)skb->data; + u32 can_id; + u32 data; +- u32 ctrl = FLEXCAN_MB_CODE_TX_DATA | (cf->can_dlc << 16); ++ u32 ctrl = FLEXCAN_MB_CODE_TX_DATA | (cfd->len << 16); + int i; + + if (can_dropped_invalid_skb(dev, skb)) +@@ -657,18 +657,18 @@ static netdev_tx_t flexcan_start_xmit(struct sk_buff *skb, struct net_device *de + + netif_stop_queue(dev); + +- if (cf->can_id & CAN_EFF_FLAG) { +- can_id = cf->can_id & CAN_EFF_MASK; ++ if (cfd->can_id & CAN_EFF_FLAG) { ++ can_id = cfd->can_id & CAN_EFF_MASK; + ctrl |= FLEXCAN_MB_CNT_IDE | FLEXCAN_MB_CNT_SRR; + } else { +- can_id = (cf->can_id & CAN_SFF_MASK) << 18; ++ can_id = (cfd->can_id & CAN_SFF_MASK) << 18; + } + +- if (cf->can_id & CAN_RTR_FLAG) ++ if (cfd->can_id & CAN_RTR_FLAG) + ctrl |= FLEXCAN_MB_CNT_RTR; + +- for (i = 0; i < cf->can_dlc; i += sizeof(u32)) { +- data = be32_to_cpup((__be32 *)&cf->data[i]); ++ for (i = 0; i < cfd->len; i += sizeof(u32)) { ++ data = be32_to_cpup((__be32 *)&cfd->data[i]); + priv->write(data, &priv->tx_mb->data[i / sizeof(u32)]); + } + +@@ -840,7 +840,7 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload, + struct flexcan_regs __iomem *regs = priv->regs; + struct flexcan_mb __iomem *mb; + struct sk_buff *skb; +- struct can_frame *cf; ++ struct canfd_frame *cfd; + u32 reg_ctrl, reg_id, reg_iflag1; + int i; + +@@ -877,8 +877,8 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload, + reg_ctrl = priv->read(&mb->can_ctrl); + } + +- skb = alloc_can_skb(offload->dev, &cf); +- if (!skb) { ++ skb = alloc_can_skb(offload->dev, (struct can_frame **)&cfd); ++ if (unlikely(!skb)) { + skb = ERR_PTR(-ENOMEM); + goto mark_as_read; + } +@@ -888,17 +888,17 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload, + + reg_id = priv->read(&mb->can_id); + if (reg_ctrl & FLEXCAN_MB_CNT_IDE) +- cf->can_id = ((reg_id >> 0) & CAN_EFF_MASK) | CAN_EFF_FLAG; ++ cfd->can_id = ((reg_id >> 0) & CAN_EFF_MASK) | CAN_EFF_FLAG; + else +- cf->can_id = (reg_id >> 18) & CAN_SFF_MASK; ++ cfd->can_id = (reg_id >> 18) & CAN_SFF_MASK; + + if (reg_ctrl & FLEXCAN_MB_CNT_RTR) +- cf->can_id |= CAN_RTR_FLAG; +- cf->can_dlc = get_can_dlc((reg_ctrl >> 16) & 0xf); ++ cfd->can_id |= CAN_RTR_FLAG; ++ cfd->len = get_can_dlc((reg_ctrl >> 16) & 0xf); + +- for (i = 0; i < cf->can_dlc; i += sizeof(u32)) { ++ for (i = 0; i < cfd->len; i += sizeof(u32)) { + __be32 data = cpu_to_be32(priv->read(&mb->data[i / sizeof(u32)])); +- *(__be32 *)(cf->data + i) = data; ++ *(__be32 *)(cfd->data + i) = data; + } + + mark_as_read: +-- +2.26.2 + diff --git a/patches.suse/can-rx-offload-Prepare-for-CAN-FD-support.patch b/patches.suse/can-rx-offload-Prepare-for-CAN-FD-support.patch new file mode 100644 index 0000000..7dc1ba2 --- /dev/null +++ b/patches.suse/can-rx-offload-Prepare-for-CAN-FD-support.patch @@ -0,0 +1,210 @@ +From: Joakim Zhang +Date: Fri, 12 Jul 2019 08:02:38 +0000 +Subject: can: rx-offload: Prepare for CAN FD support + +Git-commit: 4e9c9484b085dbba60b299182dd490eaeb84d18a +Patch-mainline: v5.5-rc1 +References: jsc#SLE-12251 + +The skbs for classic CAN and CAN FD frames are allocated with seperate +functions: alloc_can_skb() and alloc_canfd_skb(). + +In order to support CAN FD frames via the rx-offload helper, the driver +itself has to allocate the skb (depending whether it received a classic +CAN or CAN FD frame), as the rx-offload helper cannot know which kind of +CAN frame the driver has received. + +This patch moves the allocation of the skb into the struct +can_rx_offload::mailbox_read callbacks of the the flexcan and ti_hecc +driver and adjusts the rx-offload helper accordingly. + +Signed-off-by: Joakim Zhang +Signed-off-by: Marc Kleine-Budde +[Yousaf]: Drop hunk in drivers/net/can/ti_hecc.c +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/flexcan.c | 27 +++++++++++---- + drivers/net/can/rx-offload.c | 70 +++++++++-------------------------------- + include/linux/can/rx-offload.h | 5 +- + 3 files changed, 40 insertions(+), 62 deletions(-) + +--- a/drivers/net/can/flexcan.c ++++ b/drivers/net/can/flexcan.c +@@ -783,16 +783,23 @@ static inline struct flexcan_priv *rx_of + return container_of(offload, struct flexcan_priv, offload); + } + +-static unsigned int flexcan_mailbox_read(struct can_rx_offload *offload, +- struct can_frame *cf, +- u32 *timestamp, unsigned int n) ++static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload, ++ unsigned int n, u32 *timestamp, ++ bool drop) + { + struct flexcan_priv *priv = rx_offload_to_priv(offload); + struct flexcan_regs __iomem *regs = priv->regs; + struct flexcan_mb __iomem *mb; ++ struct sk_buff *skb; ++ struct can_frame *cf; + u32 reg_ctrl, reg_id, reg_iflag1; + int i; + ++ if (unlikely(drop)) { ++ skb = ERR_PTR(-ENOBUFS); ++ goto mark_as_read; ++ } ++ + mb = flexcan_get_mb(priv, n); + + if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { +@@ -806,7 +813,7 @@ static unsigned int flexcan_mailbox_read + code = reg_ctrl & FLEXCAN_MB_CODE_MASK; + if ((code != FLEXCAN_MB_CODE_RX_FULL) && + (code != FLEXCAN_MB_CODE_RX_OVERRUN)) +- return 0; ++ return NULL; + + if (code == FLEXCAN_MB_CODE_RX_OVERRUN) { + /* This MB was overrun, we lost data */ +@@ -816,11 +823,17 @@ static unsigned int flexcan_mailbox_read + } else { + reg_iflag1 = priv->read(®s->iflag1); + if (!(reg_iflag1 & FLEXCAN_IFLAG_RX_FIFO_AVAILABLE)) +- return 0; ++ return NULL; + + reg_ctrl = priv->read(&mb->can_ctrl); + } + ++ skb = alloc_can_skb(offload->dev, &cf); ++ if (!skb) { ++ skb = ERR_PTR(-ENOMEM); ++ goto mark_as_read; ++ } ++ + /* increase timstamp to full 32 bit */ + *timestamp = reg_ctrl << 16; + +@@ -839,7 +852,7 @@ static unsigned int flexcan_mailbox_read + *(__be32 *)(cf->data + i) = data; + } + +- /* mark as read */ ++ mark_as_read: + if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { + /* Clear IRQ */ + if (n < 32) +@@ -856,7 +869,7 @@ static unsigned int flexcan_mailbox_read + */ + priv->read(®s->timer); + +- return 1; ++ return skb; + } + + +--- a/drivers/net/can/rx-offload.c ++++ b/drivers/net/can/rx-offload.c +@@ -139,71 +139,35 @@ static int can_rx_offload_compare(struct + static struct sk_buff * + can_rx_offload_offload_one(struct can_rx_offload *offload, unsigned int n) + { +- struct sk_buff *skb = NULL, *skb_error = NULL; ++ struct sk_buff *skb; + struct can_rx_offload_cb *cb; +- struct can_frame *cf; +- int ret; ++ bool drop = false; ++ u32 timestamp; + +- if (likely(skb_queue_len(&offload->skb_queue) < +- offload->skb_queue_len_max)) { +- skb = alloc_can_skb(offload->dev, &cf); +- if (unlikely(!skb)) +- skb_error = ERR_PTR(-ENOMEM); /* skb alloc failed */ +- } else { +- skb_error = ERR_PTR(-ENOBUFS); /* skb_queue is full */ +- } +- +- /* If queue is full or skb not available, drop by reading into +- * overflow buffer. +- */ +- if (unlikely(skb_error)) { +- struct can_frame cf_overflow; +- u32 timestamp; +- +- ret = offload->mailbox_read(offload, &cf_overflow, +- ×tamp, n); +- +- /* Mailbox was empty. */ +- if (unlikely(!ret)) +- return NULL; +- +- /* Mailbox has been read and we're dropping it or +- * there was a problem reading the mailbox. +- * +- * Increment error counters in any case. +- */ +- offload->dev->stats.rx_dropped++; +- offload->dev->stats.rx_fifo_errors++; +- +- /* There was a problem reading the mailbox, propagate +- * error value. +- */ +- if (unlikely(ret < 0)) +- return ERR_PTR(ret); +- +- return skb_error; +- } +- +- cb = can_rx_offload_get_cb(skb); +- ret = offload->mailbox_read(offload, cf, &cb->timestamp, n); ++ /* If queue is full drop frame */ ++ if (unlikely(skb_queue_len(&offload->skb_queue) > ++ offload->skb_queue_len_max)) ++ drop = true; + ++ skb = offload->mailbox_read(offload, n, ×tamp, drop); + /* Mailbox was empty. */ +- if (unlikely(!ret)) { +- kfree_skb(skb); ++ if (unlikely(!skb)) + return NULL; +- } +- +- /* There was a problem reading the mailbox, propagate error value. */ +- if (unlikely(ret < 0)) { +- kfree_skb(skb); + ++ /* There was a problem reading the mailbox, propagate ++ * error value. ++ */ ++ if (unlikely(IS_ERR(skb))) { + offload->dev->stats.rx_dropped++; + offload->dev->stats.rx_fifo_errors++; + +- return ERR_PTR(ret); ++ return skb; + } + + /* Mailbox was read. */ ++ cb = can_rx_offload_get_cb(skb); ++ cb->timestamp = timestamp; ++ + return skb; + } + +--- a/include/linux/can/rx-offload.h ++++ b/include/linux/can/rx-offload.h +@@ -15,8 +15,9 @@ + struct can_rx_offload { + struct net_device *dev; + +- unsigned int (*mailbox_read)(struct can_rx_offload *offload, struct can_frame *cf, +- u32 *timestamp, unsigned int mb); ++ struct sk_buff *(*mailbox_read)(struct can_rx_offload *offload, ++ unsigned int mb, u32 *timestamp, ++ bool drop); + + struct sk_buff_head skb_queue; + u32 skb_queue_len_max; diff --git a/patches.suse/can-rx-offload-can_rx_offload_compare-fix-typo.patch b/patches.suse/can-rx-offload-can_rx_offload_compare-fix-typo.patch new file mode 100644 index 0000000..26773dc --- /dev/null +++ b/patches.suse/can-rx-offload-can_rx_offload_compare-fix-typo.patch @@ -0,0 +1,32 @@ +From: Marc Kleine-Budde +Date: Mon, 7 Oct 2019 10:00:25 +0200 +Subject: can: rx-offload: can_rx_offload_compare(): fix typo + +Git-commit: a7b70e2d62d86fcb3f665d325dbc6f0303ee3c51 +Patch-mainline: v5.5-rc1 +References: jsc#SLE-12251 + +This patch fixes a typo found by checkpatch. + +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/rx-offload.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c +index 62393b029e4e..c277c5151153 100644 +--- a/drivers/net/can/rx-offload.c ++++ b/drivers/net/can/rx-offload.c +@@ -109,7 +109,7 @@ static int can_rx_offload_compare(struct sk_buff *a, struct sk_buff *b) + cb_a = can_rx_offload_get_cb(a); + cb_b = can_rx_offload_get_cb(b); + +- /* Substract two u32 and return result as int, to keep ++ /* Subtract two u32 and return result as int, to keep + * difference steady around the u32 overflow. + */ + return cb_b->timestamp - cb_a->timestamp; +-- +2.26.2 + diff --git a/patches.suse/can-rx-offload-can_rx_offload_irq_offload_timestamp-2.patch b/patches.suse/can-rx-offload-can_rx_offload_irq_offload_timestamp-2.patch new file mode 100644 index 0000000..7ff4a08 --- /dev/null +++ b/patches.suse/can-rx-offload-can_rx_offload_irq_offload_timestamp-2.patch @@ -0,0 +1,35 @@ +From: Marc Kleine-Budde +Date: Mon, 7 Oct 2019 10:00:52 +0200 +Subject: can: rx-offload: can_rx_offload_irq_offload_timestamp(): don't use + assignment in if condition + +Git-commit: f1242cd981e36385169281bf7b978e2bfa942eb5 +Patch-mainline: v5.5-rc1 +References: jsc#SLE-12251 + +This patch moves the assignment of queue_len out of the if condition. + +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/rx-offload.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c +index c277c5151153..412a8cec5d18 100644 +--- a/drivers/net/can/rx-offload.c ++++ b/drivers/net/can/rx-offload.c +@@ -238,8 +238,8 @@ int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, + skb_queue_splice_tail(&skb_queue, &offload->skb_queue); + spin_unlock_irqrestore(&offload->skb_queue.lock, flags); + +- if ((queue_len = skb_queue_len(&offload->skb_queue)) > +- (offload->skb_queue_len_max / 8)) ++ queue_len = skb_queue_len(&offload->skb_queue); ++ if (queue_len > offload->skb_queue_len_max / 8) + netdev_dbg(offload->dev, "%s: queue_len=%d\n", + __func__, queue_len); + +-- +2.26.2 + diff --git a/patches.suse/can-rx-offload-can_rx_offload_reset-remove-no-op-fun.patch b/patches.suse/can-rx-offload-can_rx_offload_reset-remove-no-op-fun.patch new file mode 100644 index 0000000..b7dbbe9 --- /dev/null +++ b/patches.suse/can-rx-offload-can_rx_offload_reset-remove-no-op-fun.patch @@ -0,0 +1,62 @@ +From: Marc Kleine-Budde +Date: Mon, 7 Oct 2019 13:36:58 +0200 +Subject: can: rx-offload: can_rx_offload_reset(): remove no-op function + +Git-commit: 61d2350615c2c42f7af65d9a575f5dbf9738a10e +Patch-mainline: v5.5-rc1 +References: jsc#SLE-12251 + +This patch removes the function can_rx_offload_reset(), as it does +nothing. If we ever need this function, add it back again. + +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/rx-offload.c | 7 ------- + include/linux/can/rx-offload.h | 1 - + 2 files changed, 8 deletions(-) + +diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c +index 412a8cec5d18..8d120a3750fa 100644 +--- a/drivers/net/can/rx-offload.c ++++ b/drivers/net/can/rx-offload.c +@@ -348,7 +348,6 @@ static int can_rx_offload_init_queue(struct net_device *dev, + offload->skb_queue_len_max *= 4; + skb_queue_head_init(&offload->skb_queue); + +- can_rx_offload_reset(offload); + netif_napi_add(dev, &offload->napi, can_rx_offload_napi_poll, weight); + + dev_dbg(dev->dev.parent, "%s: skb_queue_len_max=%d\n", +@@ -390,7 +389,6 @@ EXPORT_SYMBOL_GPL(can_rx_offload_add_fifo); + + void can_rx_offload_enable(struct can_rx_offload *offload) + { +- can_rx_offload_reset(offload); + napi_enable(&offload->napi); + } + EXPORT_SYMBOL_GPL(can_rx_offload_enable); +@@ -401,8 +399,3 @@ void can_rx_offload_del(struct can_rx_offload *offload) + skb_queue_purge(&offload->skb_queue); + } + EXPORT_SYMBOL_GPL(can_rx_offload_del); +- +-void can_rx_offload_reset(struct can_rx_offload *offload) +-{ +-} +-EXPORT_SYMBOL_GPL(can_rx_offload_reset); +diff --git a/include/linux/can/rx-offload.h b/include/linux/can/rx-offload.h +index 01219f2902bf..fc75e9a7ad2f 100644 +--- a/include/linux/can/rx-offload.h ++++ b/include/linux/can/rx-offload.h +@@ -44,7 +44,6 @@ unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload, + unsigned int idx, u32 timestamp); + int can_rx_offload_queue_tail(struct can_rx_offload *offload, + struct sk_buff *skb); +-void can_rx_offload_reset(struct can_rx_offload *offload); + void can_rx_offload_del(struct can_rx_offload *offload); + void can_rx_offload_enable(struct can_rx_offload *offload); + +-- +2.26.2 + diff --git a/patches.suse/can-rx-offload-fix-long-lines.patch b/patches.suse/can-rx-offload-fix-long-lines.patch new file mode 100644 index 0000000..c4db6dd --- /dev/null +++ b/patches.suse/can-rx-offload-fix-long-lines.patch @@ -0,0 +1,129 @@ +From: Marc Kleine-Budde +Date: Mon, 7 Oct 2019 09:59:49 +0200 +Subject: can: rx-offload: fix long lines + +Git-commit: 54dd0b8904ac4c70df7616d39b80390835fede80 +Patch-mainline: v5.5-rc1 +References: jsc#SLE-12251 + +This patch fixes the checkpatch warnings about too long lines. + +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/net/can/rx-offload.c | 39 ++++++++++++++++++++++++------------ + 1 file changed, 26 insertions(+), 13 deletions(-) + +diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c +index 84cae167e42f..62393b029e4e 100644 +--- a/drivers/net/can/rx-offload.c ++++ b/drivers/net/can/rx-offload.c +@@ -1,7 +1,8 @@ + // SPDX-License-Identifier: GPL-2.0-only +-/* +- * Copyright (c) 2014 David Jander, Protonic Holland +- * Copyright (C) 2014-2017 Pengutronix, Marc Kleine-Budde ++/* Copyright (c) 2014 Protonic Holland, ++ * David Jander ++ * Copyright (C) 2014-2017 Pengutronix, ++ * Marc Kleine-Budde + */ + + #include +@@ -11,14 +12,17 @@ struct can_rx_offload_cb { + u32 timestamp; + }; + +-static inline struct can_rx_offload_cb *can_rx_offload_get_cb(struct sk_buff *skb) ++static inline struct can_rx_offload_cb * ++can_rx_offload_get_cb(struct sk_buff *skb) + { + BUILD_BUG_ON(sizeof(struct can_rx_offload_cb) > sizeof(skb->cb)); + + return (struct can_rx_offload_cb *)skb->cb; + } + +-static inline bool can_rx_offload_le(struct can_rx_offload *offload, unsigned int a, unsigned int b) ++static inline bool ++can_rx_offload_le(struct can_rx_offload *offload, ++ unsigned int a, unsigned int b) + { + if (offload->inc) + return a <= b; +@@ -26,7 +30,8 @@ static inline bool can_rx_offload_le(struct can_rx_offload *offload, unsigned in + return a >= b; + } + +-static inline unsigned int can_rx_offload_inc(struct can_rx_offload *offload, unsigned int *val) ++static inline unsigned int ++can_rx_offload_inc(struct can_rx_offload *offload, unsigned int *val) + { + if (offload->inc) + return (*val)++; +@@ -36,7 +41,9 @@ static inline unsigned int can_rx_offload_inc(struct can_rx_offload *offload, un + + static int can_rx_offload_napi_poll(struct napi_struct *napi, int quota) + { +- struct can_rx_offload *offload = container_of(napi, struct can_rx_offload, napi); ++ struct can_rx_offload *offload = container_of(napi, ++ struct can_rx_offload, ++ napi); + struct net_device *dev = offload->dev; + struct net_device_stats *stats = &dev->stats; + struct sk_buff *skb; +@@ -65,8 +72,9 @@ static int can_rx_offload_napi_poll(struct napi_struct *napi, int quota) + return work_done; + } + +-static inline void __skb_queue_add_sort(struct sk_buff_head *head, struct sk_buff *new, +- int (*compare)(struct sk_buff *a, struct sk_buff *b)) ++static inline void ++__skb_queue_add_sort(struct sk_buff_head *head, struct sk_buff *new, ++ int (*compare)(struct sk_buff *a, struct sk_buff *b)) + { + struct sk_buff *pos, *insert = NULL; + +@@ -199,7 +207,8 @@ can_rx_offload_offload_one(struct can_rx_offload *offload, unsigned int n) + return skb; + } + +-int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, u64 pending) ++int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, ++ u64 pending) + { + struct sk_buff_head skb_queue; + unsigned int i; +@@ -328,7 +337,9 @@ int can_rx_offload_queue_tail(struct can_rx_offload *offload, + } + EXPORT_SYMBOL_GPL(can_rx_offload_queue_tail); + +-static int can_rx_offload_init_queue(struct net_device *dev, struct can_rx_offload *offload, unsigned int weight) ++static int can_rx_offload_init_queue(struct net_device *dev, ++ struct can_rx_offload *offload, ++ unsigned int weight) + { + offload->dev = dev; + +@@ -346,7 +357,8 @@ static int can_rx_offload_init_queue(struct net_device *dev, struct can_rx_offlo + return 0; + } + +-int can_rx_offload_add_timestamp(struct net_device *dev, struct can_rx_offload *offload) ++int can_rx_offload_add_timestamp(struct net_device *dev, ++ struct can_rx_offload *offload) + { + unsigned int weight; + +@@ -366,7 +378,8 @@ int can_rx_offload_add_timestamp(struct net_device *dev, struct can_rx_offload * + } + EXPORT_SYMBOL_GPL(can_rx_offload_add_timestamp); + +-int can_rx_offload_add_fifo(struct net_device *dev, struct can_rx_offload *offload, unsigned int weight) ++int can_rx_offload_add_fifo(struct net_device *dev, ++ struct can_rx_offload *offload, unsigned int weight) + { + if (!offload->mailbox_read) + return -EINVAL; +-- +2.26.2 + diff --git a/patches.suse/ceph-fix-flush_snap-logic-after-putting-caps.patch b/patches.suse/ceph-fix-flush_snap-logic-after-putting-caps.patch new file mode 100644 index 0000000..769141c --- /dev/null +++ b/patches.suse/ceph-fix-flush_snap-logic-after-putting-caps.patch @@ -0,0 +1,46 @@ +From: Jeff Layton +Date: Thu, 10 Dec 2020 13:35:46 -0500 +Subject: ceph: fix flush_snap logic after putting caps +Git-commit: 64f36da5625f7f9853b86750eaa89d499d16a2e9 +Patch-mainline: v5.12-rc1 +References: bsc#1182853 + +A primary reason for skipping ceph_check_caps after putting the +references was to avoid the locking in ceph_check_caps during a +reconnect. __ceph_put_cap_refs can still call ceph_flush_snaps in that +case though, and that takes many of the same inconvenient locks. + +Fix the logic in __ceph_put_cap_refs to skip flushing snaps when the +skip_checking_caps flag is set. + +Fixes: e64f44a88465 ("ceph: skip checking caps when session reconnecting and releasing reqs") +Signed-off-by: Jeff Layton +Reviewed-by: Ilya Dryomov +Signed-off-by: Ilya Dryomov +Acked-by: Luis Henriques +--- + fs/ceph/caps.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c +index 255a512f1277..638d18c198ea 100644 +--- a/fs/ceph/caps.c ++++ b/fs/ceph/caps.c +@@ -3093,10 +3093,12 @@ static void __ceph_put_cap_refs(struct ceph_inode_info *ci, int had, + dout("put_cap_refs %p had %s%s%s\n", inode, ceph_cap_string(had), + last ? " last" : "", put ? " put" : ""); + +- if (last && !skip_checking_caps) +- ceph_check_caps(ci, 0, NULL); +- else if (flushsnaps) +- ceph_flush_snaps(ci, NULL); ++ if (!skip_checking_caps) { ++ if (last) ++ ceph_check_caps(ci, 0, NULL); ++ else if (flushsnaps) ++ ceph_flush_snaps(ci, NULL); ++ } + if (wake) + wake_up_all(&ci->i_cap_wq); + while (put-- > 0) + diff --git a/patches.suse/certs-Fix-blacklist-flag-type-confusion.patch b/patches.suse/certs-Fix-blacklist-flag-type-confusion.patch new file mode 100644 index 0000000..daa6d54 --- /dev/null +++ b/patches.suse/certs-Fix-blacklist-flag-type-confusion.patch @@ -0,0 +1,107 @@ +From 4993e1f9479a4161fd7d93e2b8b30b438f00cb0f Mon Sep 17 00:00:00 2001 +From: David Howells +Date: Fri, 20 Nov 2020 19:04:23 +0100 +Subject: [PATCH] certs: Fix blacklist flag type confusion +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 4993e1f9479a4161fd7d93e2b8b30b438f00cb0f +Patch-mainline: v5.12-rc1 +References: git-fixes + +KEY_FLAG_KEEP is not meant to be passed to keyring_alloc() or key_alloc(), +as these only take KEY_ALLOC_* flags. KEY_FLAG_KEEP has the same value as +KEY_ALLOC_BYPASS_RESTRICTION, but fortunately only key_create_or_update() +uses it. LSMs using the key_alloc hook don't check that flag. + +KEY_FLAG_KEEP is then ignored but fortunately (again) the root user cannot +write to the blacklist keyring, so it is not possible to remove a key/hash +from it. + +Fix this by adding a KEY_ALLOC_SET_KEEP flag that tells key_alloc() to set +KEY_FLAG_KEEP on the new key. blacklist_init() can then, correctly, pass +this to keyring_alloc(). + +We can also use this in ima_mok_init() rather than setting the flag +manually. + +Note that this doesn't fix an observable bug with the current +implementation but it is required to allow addition of new hashes to the +blacklist in the future without making it possible for them to be removed. + +Fixes: 734114f8782f ("KEYS: Add a system blacklist keyring") +Reported-by: Mickaël Salaün +Signed-off-by: David Howells +Cc: Mickaël Salaün +Cc: Mimi Zohar +Cc: David Woodhouse +Acked-by: Takashi Iwai + +--- + certs/blacklist.c | 2 +- + include/linux/key.h | 1 + + security/integrity/ima/ima_mok.c | 5 ++--- + security/keys/key.c | 2 ++ + 4 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/certs/blacklist.c b/certs/blacklist.c +index a888b934a1cd..029471947838 100644 +--- a/certs/blacklist.c ++++ b/certs/blacklist.c +@@ -162,7 +162,7 @@ static int __init blacklist_init(void) + KEY_USR_VIEW | KEY_USR_READ | + KEY_USR_SEARCH, + KEY_ALLOC_NOT_IN_QUOTA | +- KEY_FLAG_KEEP, ++ KEY_ALLOC_SET_KEEP, + NULL, NULL); + if (IS_ERR(blacklist_keyring)) + panic("Can't allocate system blacklist keyring\n"); +diff --git a/include/linux/key.h b/include/linux/key.h +index 1b0837c975b9..7febc4881363 100644 +--- a/include/linux/key.h ++++ b/include/linux/key.h +@@ -289,6 +289,7 @@ extern struct key *key_alloc(struct key_type *type, + #define KEY_ALLOC_BUILT_IN 0x0004 /* Key is built into kernel */ + #define KEY_ALLOC_BYPASS_RESTRICTION 0x0008 /* Override the check on restricted keyrings */ + #define KEY_ALLOC_UID_KEYRING 0x0010 /* allocating a user or user session keyring */ ++#define KEY_ALLOC_SET_KEEP 0x0020 /* Set the KEEP flag on the key/keyring */ + + extern void key_revoke(struct key *key); + extern void key_invalidate(struct key *key); +diff --git a/security/integrity/ima/ima_mok.c b/security/integrity/ima/ima_mok.c +index 36cadadbfba4..1e5c01916173 100644 +--- a/security/integrity/ima/ima_mok.c ++++ b/security/integrity/ima/ima_mok.c +@@ -38,13 +38,12 @@ __init int ima_mok_init(void) + (KEY_POS_ALL & ~KEY_POS_SETATTR) | + KEY_USR_VIEW | KEY_USR_READ | + KEY_USR_WRITE | KEY_USR_SEARCH, +- KEY_ALLOC_NOT_IN_QUOTA, ++ KEY_ALLOC_NOT_IN_QUOTA | ++ KEY_ALLOC_SET_KEEP, + restriction, NULL); + + if (IS_ERR(ima_blacklist_keyring)) + panic("Can't allocate IMA blacklist keyring."); +- +- set_bit(KEY_FLAG_KEEP, &ima_blacklist_keyring->flags); + return 0; + } + device_initcall(ima_mok_init); +diff --git a/security/keys/key.c b/security/keys/key.c +index ebe752b137aa..c45afdd1dfbb 100644 +--- a/security/keys/key.c ++++ b/security/keys/key.c +@@ -303,6 +303,8 @@ struct key *key_alloc(struct key_type *type, const char *desc, + key->flags |= 1 << KEY_FLAG_BUILTIN; + if (flags & KEY_ALLOC_UID_KEYRING) + key->flags |= 1 << KEY_FLAG_UID_KEYRING; ++ if (flags & KEY_ALLOC_SET_KEEP) ++ key->flags |= 1 << KEY_FLAG_KEEP; + + #ifdef KEY_DEBUGGING + key->magic = KEY_DEBUG_MAGIC; +-- +2.26.2 + diff --git a/patches.suse/cgroup-fix-memory-leak-when-parsing-multiple-source-parameters.patch b/patches.suse/cgroup-fix-memory-leak-when-parsing-multiple-source-parameters.patch new file mode 100644 index 0000000..6f85931 --- /dev/null +++ b/patches.suse/cgroup-fix-memory-leak-when-parsing-multiple-source-parameters.patch @@ -0,0 +1,48 @@ +From: Qinglang Miao +Date: Thu, 10 Dec 2020 09:29:43 +0800 +Subject: cgroup: Fix memory leak when parsing multiple source parameters +Git-commit: 2d18e54dd8662442ef5898c6bdadeaf90b3cebbc +Patch-mainline: v5.11-rc2 +References: bsc#1182683 + +A memory leak is found in cgroup1_parse_param() when multiple source +parameters overwrite fc->source in the fs_context struct without free. + +unreferenced object 0xffff888100d930e0 (size 16): + comm "mount", pid 520, jiffies 4303326831 (age 152.783s) + hex dump (first 16 bytes): + 74 65 73 74 6c 65 61 6b 00 00 00 00 00 00 00 00 testleak........ + backtrace: + [<000000003e5023ec>] kmemdup_nul+0x2d/0xa0 + [<00000000377dbdaa>] vfs_parse_fs_string+0xc0/0x150 + [<00000000cb2b4882>] generic_parse_monolithic+0x15a/0x1d0 + [<000000000f750198>] path_mount+0xee1/0x1820 + [<0000000004756de2>] do_mount+0xea/0x100 + [<0000000094cafb0a>] __x64_sys_mount+0x14b/0x1f0 + +Fix this bug by permitting a single source parameter and rejecting with +an error all subsequent ones. + +Fixes: 8d2451f4994f ("cgroup1: switch to option-by-option parsing") +Reported-by: Hulk Robot +Signed-off-by: Qinglang Miao +Reviewed-by: Zefan Li +Signed-off-by: Tejun Heo +[mkoutny: s/invalfc/cg_invalf/] +Acked-by: Michal Koutný +--- + kernel/cgroup/cgroup-v1.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/kernel/cgroup/cgroup-v1.c ++++ b/kernel/cgroup/cgroup-v1.c +@@ -933,6 +933,8 @@ int cgroup1_parse_param(struct fs_contex + opt = fs_parse(fc, &cgroup1_fs_parameters, param, &result); + if (opt == -ENOPARAM) { + if (strcmp(param->key, "source") == 0) { ++ if (fc->source) ++ return cg_invalf(fc, "Multiple sources not supported"); + fc->source = param->string; + param->string = NULL; + return 0; + diff --git a/patches.suse/cgroup-fix-psi-monitor-for-root-cgroup.patch b/patches.suse/cgroup-fix-psi-monitor-for-root-cgroup.patch new file mode 100644 index 0000000..c8665bc --- /dev/null +++ b/patches.suse/cgroup-fix-psi-monitor-for-root-cgroup.patch @@ -0,0 +1,52 @@ +From: Odin Ugedal +Date: Sat, 16 Jan 2021 18:36:33 +0100 +Subject: cgroup: fix psi monitor for root cgroup +Git-commit: 385aac1519417b89cb91b77c22e4ca21db563cd0 +Patch-mainline: v5.11 +References: bsc#1182686 + +Fix NULL pointer dereference when adding new psi monitor to the root +cgroup. PSI files for root cgroup was introduced in df5ba5be742 by using +system wide psi struct when reading, but file write/monitor was not +properly fixed. Since the PSI config for the root cgroup isn't +initialized, the current implementation tries to lock a NULL ptr, +resulting in a crash. + +Can be triggered by running this as root: +$ tee /sys/fs/cgroup/cpu.pressure <<< "some 10000 1000000" + +Signed-off-by: Odin Ugedal +Reviewed-by: Suren Baghdasaryan +Acked-by: Dan Schatzberg +Fixes: df5ba5be7425 ("kernel/sched/psi.c: expose pressure metrics on root cgroup") +Acked-by: Johannes Weiner +Cc: stable@vger.kernel.org # 5.2+ +Signed-off-by: Tejun Heo +Acked-by: Michal Koutný +--- + kernel/cgroup/cgroup.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c +index 613845769103..1ea995f801ec 100644 +--- a/kernel/cgroup/cgroup.c ++++ b/kernel/cgroup/cgroup.c +@@ -3564,6 +3564,7 @@ static ssize_t cgroup_pressure_write(struct kernfs_open_file *of, char *buf, + { + struct psi_trigger *new; + struct cgroup *cgrp; ++ struct psi_group *psi; + + cgrp = cgroup_kn_lock_live(of->kn, false); + if (!cgrp) +@@ -3572,7 +3573,8 @@ static ssize_t cgroup_pressure_write(struct kernfs_open_file *of, char *buf, + cgroup_get(cgrp); + cgroup_kn_unlock(of->kn); + +- new = psi_trigger_create(&cgrp->psi, buf, nbytes, res); ++ psi = cgroup_ino(cgrp) == 1 ? &psi_system : &cgrp->psi; ++ new = psi_trigger_create(psi, buf, nbytes, res); + if (IS_ERR(new)) { + cgroup_put(cgrp); + return PTR_ERR(new); + diff --git a/patches.suse/cgroup-v1-add-disabled-controller-check-in-cgroup1_parse_param.patch b/patches.suse/cgroup-v1-add-disabled-controller-check-in-cgroup1_parse_param.patch new file mode 100644 index 0000000..00047fc --- /dev/null +++ b/patches.suse/cgroup-v1-add-disabled-controller-check-in-cgroup1_parse_param.patch @@ -0,0 +1,47 @@ +From: Chen Zhou +Date: Fri, 15 Jan 2021 17:37:17 +0800 +Subject: cgroup-v1: add disabled controller check in cgroup1_parse_param() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Git-commit: 61e960b07b637f0295308ad91268501d744c21b5 +Patch-mainline: v5.11 +References: bsc#1182684 + +When mounting a cgroup hierarchy with disabled controller in cgroup v1, +all available controllers will be attached. +For example, boot with cgroup_no_v1=cpu or cgroup_disable=cpu, and then +mount with "mount -t cgroup -ocpu cpu /sys/fs/cgroup/cpu", then all +enabled controllers will be attached except cpu. + +Fix this by adding disabled controller check in cgroup1_parse_param(). +If the specified controller is disabled, just return error with information +"Disabled controller xx" rather than attaching all the other enabled +controllers. + +Fixes: f5dfb5315d34 ("cgroup: take options parsing into ->parse_monolithic()") +Signed-off-by: Chen Zhou +Reviewed-by: Zefan Li +Reviewed-by: Michal Koutný +Signed-off-by: Tejun Heo +[mkoutny: s/invalfc/cg_invalf/] +Acked-by: Michal Koutný +--- + kernel/cgroup/cgroup-v1.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c +index 32596fdbcd5b..a5751784ad74 100644 +--- a/kernel/cgroup/cgroup-v1.c ++++ b/kernel/cgroup/cgroup-v1.c +@@ -917,6 +917,9 @@ int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param) + for_each_subsys(ss, i) { + if (strcmp(param->key, ss->legacy_name)) + continue; ++ if (!cgroup_ssid_enabled(i) || cgroup1_ssid_disabled(i)) ++ return cg_invalf(fc, "Disabled controller '%s'", ++ param->key); + ctx->subsys_mask |= (1 << i); + return 0; + } + diff --git a/patches.suse/cifs-check-all-path-components-in-resolved-dfs-target.patch b/patches.suse/cifs-check-all-path-components-in-resolved-dfs-target.patch new file mode 100644 index 0000000..8936b8c --- /dev/null +++ b/patches.suse/cifs-check-all-path-components-in-resolved-dfs-target.patch @@ -0,0 +1,146 @@ +From: Paulo Alcantara +Date: Thu, 25 Feb 2021 14:15:53 -0300 +Subject: [PATCH] cifs: check all path components in resolved dfs target +Git-commit: ff2c54a04097dee0b8899c485360719844d923f8 +References: bsc#1181710 +Patch-mainline: v5.12-rc1 + +Handle the case where a resolved target share is like +//server/users/dir, and the user "foo" has no read permission to +access the parent folder "users" but has access to the final path +component "dir". + +is_path_remote() already implements that, so call it directly. + +Signed-off-by: Paulo Alcantara (SUSE) +Cc: stable@vger.kernel.org # 5.11 +Signed-off-by: Steve French +Acked-by: Paulo Alcantara +--- + fs/cifs/connect.c | 93 +++++++++++++++++------------------------------ + 1 file changed, 33 insertions(+), 60 deletions(-) + +diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c +index 44f9cce57099..e480ca56816d 100644 +--- a/fs/cifs/connect.c ++++ b/fs/cifs/connect.c +@@ -4559,73 +4559,46 @@ static void put_root_ses(struct cifs_ses *ses) + cifs_put_smb_ses(ses); + } + +-/* Check if a path component is remote and then update @dfs_path accordingly */ +-static int check_dfs_prepath(struct cifs_sb_info *cifs_sb, struct smb_vol *vol, +- const unsigned int xid, struct TCP_Server_Info *server, +- struct cifs_tcon *tcon, char **dfs_path) ++/* Set up next dfs prefix path in @dfs_path */ ++static int next_dfs_prepath(struct cifs_sb_info *cifs_sb, struct smb_vol *vol, ++ const unsigned int xid, struct TCP_Server_Info *server, ++ struct cifs_tcon *tcon, char **dfs_path) + { +- char *path, *s; +- char sep = CIFS_DIR_SEP(cifs_sb), tmp; +- char *npath; +- int rc = 0; +- int added_treename = tcon->Flags & SMB_SHARE_IS_IN_DFS; +- int skip = added_treename; ++ char *path, *npath; ++ int added_treename = is_tcon_dfs(tcon); ++ int rc; + + path = cifs_build_path_to_root(vol, cifs_sb, tcon, added_treename); + if (!path) + return -ENOMEM; + +- /* +- * Walk through the path components in @path and check if they're accessible. In case any of +- * the components is -EREMOTE, then update @dfs_path with the next DFS referral request path +- * (NOT including the remaining components). +- */ +- s = path; +- do { +- /* skip separators */ +- while (*s && *s == sep) +- s++; +- if (!*s) +- break; +- /* next separator */ +- while (*s && *s != sep) +- s++; +- /* +- * if the treename is added, we then have to skip the first +- * part within the separators +- */ +- if (skip) { +- skip = 0; +- continue; ++ rc = is_path_remote(cifs_sb, vol, xid, server, tcon); ++ if (rc == -EREMOTE) { ++ struct smb_vol v = {NULL}; ++ /* if @path contains a tree name, skip it in the prefix path */ ++ if (added_treename) { ++ rc = cifs_parse_devname(path, &v); ++ if (rc) ++ goto out; ++ npath = build_unc_path_to_root(&v, cifs_sb, true); ++ cifs_cleanup_volume_info_contents(&v); ++ } else { ++ v.UNC = vol->UNC; ++ v.prepath = path + 1; ++ npath = build_unc_path_to_root(&v, cifs_sb, true); + } +- tmp = *s; +- *s = 0; +- rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, path); +- if (rc && rc == -EREMOTE) { +- struct smb_vol v = {NULL}; +- /* if @path contains a tree name, skip it in the prefix path */ +- if (added_treename) { +- rc = cifs_parse_devname(path, &v); +- if (rc) +- break; +- rc = -EREMOTE; +- npath = build_unc_path_to_root(&v, cifs_sb, true); +- cifs_cleanup_volume_info_contents(&v); +- } else { +- v.UNC = vol->UNC; +- v.prepath = path + 1; +- npath = build_unc_path_to_root(&v, cifs_sb, true); +- } +- if (IS_ERR(npath)) { +- rc = PTR_ERR(npath); +- break; +- } +- kfree(*dfs_path); +- *dfs_path = npath; ++ ++ if (IS_ERR(npath)) { ++ rc = PTR_ERR(npath); ++ goto out; + } +- *s = tmp; +- } while (rc == 0); + ++ kfree(*dfs_path); ++ *dfs_path = npath; ++ rc = -EREMOTE; ++ } ++ ++out: + kfree(path); + return rc; + } +@@ -4710,8 +4683,8 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *vol) + put_root_ses(root_ses); + set_root_ses(cifs_sb, ses, &root_ses); + } +- /* Check for remaining path components and then continue chasing them (-EREMOTE) */ +- rc = check_dfs_prepath(cifs_sb, vol, xid, server, tcon, &ref_path); ++ /* Get next dfs path and then continue chasing them if -EREMOTE */ ++ rc = next_dfs_prepath(cifs_sb, vol, xid, server, tcon, &ref_path); + /* Prevent recursion on broken link referrals */ + if (rc == -EREMOTE && ++count > MAX_NESTED_LINKS) + rc = -ELOOP; +-- +2.30.1 + + diff --git a/patches.suse/cifs-fix-nodfs-mount-option.patch b/patches.suse/cifs-fix-nodfs-mount-option.patch new file mode 100644 index 0000000..8410bf8 --- /dev/null +++ b/patches.suse/cifs-fix-nodfs-mount-option.patch @@ -0,0 +1,47 @@ +From: Paulo Alcantara +Date: Thu, 25 Feb 2021 14:16:15 -0300 +Subject: [PATCH] cifs: fix nodfs mount option +Git-commit: d01132ae50207bb6fd94e08e80c2d7b839408086 +References: bsc#1181710 +Patch-mainline: v5.12-rc1 + +Skip DFS resolving when mounting with 'nodfs' even if +CONFIG_CIFS_DFS_UPCALL is enabled. + +Signed-off-by: Paulo Alcantara (SUSE) +Cc: stable@vger.kernel.org # 5.11 +Reviewed-by: Shyam Prasad N +Signed-off-by: Steve French +Acked-by: Paulo Alcantara +--- + fs/cifs/connect.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c +index 54465069770e..72b6ccfc0cf5 100644 +--- a/fs/cifs/connect.c ++++ b/fs/cifs/connect.c +@@ -4645,15 +4645,15 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *vol) + + rc = mount_get_conns(vol, cifs_sb, &xid, &server, &ses, &tcon); + /* +- * Unconditionally try to get an DFS referral (even cached) to determine whether it is an +- * DFS mount. ++ * If called with 'nodfs' mount option, then skip DFS resolving. Otherwise unconditionally ++ * try to get an DFS referral (even cached) to determine whether it is an DFS mount. + * + * Skip prefix path to provide support for DFS referrals from w2k8 servers which don't seem + * to respond with PATH_NOT_COVERED to requests that include the prefix. + */ +- if (dfs_cache_find(xid, ses, cifs_sb->local_nls, cifs_remap(cifs_sb), vol->UNC + 1, NULL, ++ if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_DFS) || ++ dfs_cache_find(xid, ses, cifs_sb->local_nls, cifs_remap(cifs_sb), vol->UNC + 1, NULL, + NULL)) { +- /* No DFS referral was returned. Looks like a regular share. */ + if (rc) + goto error; + /* Check if it is fully accessible and then mount it */ +-- +2.30.1 + + diff --git a/patches.suse/cifs-introduce-helper-for-finding-referral-server.patch b/patches.suse/cifs-introduce-helper-for-finding-referral-server.patch new file mode 100644 index 0000000..bdb8915 --- /dev/null +++ b/patches.suse/cifs-introduce-helper-for-finding-referral-server.patch @@ -0,0 +1,169 @@ +From: Paulo Alcantara +Date: Thu, 25 Feb 2021 14:16:04 -0300 +Subject: [PATCH] cifs: introduce helper for finding referral server +Git-commit: 5ff2836ed3a5c24420a7235be25a462594cdc4ea +References: bsc#1181710 +Patch-mainline: v5.12-rc1 + +Some servers seem to mistakenly report different values for +capabilities and share flags, so we can't always rely on those values +to decide whether the resolved target can handle any new DFS +referrals. + +Add a new helper is_referral_server() to check if all resolved targets +can handle new DFS referrals by directly looking at the +GET_DFS_REFERRAL.ReferralHeaderFlags value as specified in MS-DFSC +2.2.4 RESP_GET_DFS_REFERRAL in addition to is_tcon_dfs(). + +Signed-off-by: Paulo Alcantara (SUSE) +Cc: stable@vger.kernel.org # 5.11 +Signed-off-by: Steve French +Acked-by: Paulo Alcantara +--- + fs/cifs/connect.c | 35 ++++++++++++++++++++++++++++++++++- + fs/cifs/dfs_cache.c | 43 ++++++++++++++++++++++--------------------- + 2 files changed, 56 insertions(+), 22 deletions(-) + +--- a/fs/cifs/connect.c ++++ b/fs/cifs/connect.c +@@ -4729,6 +4729,33 @@ out: + return rc; + } + ++/* Check if resolved targets can handle any DFS referrals */ ++static int is_referral_server(const char *ref_path, struct cifs_tcon *tcon, bool *ref_server) ++{ ++ int rc; ++ struct dfs_info3_param ref = {0}; ++ ++ if (is_tcon_dfs(tcon)) { ++ *ref_server = true; ++ } else { ++ cifs_dbg(FYI, "%s: ref_path=%s\n", __func__, ref_path); ++ ++ rc = dfs_cache_noreq_find(ref_path, &ref, NULL); ++ if (rc) { ++ cifs_dbg(VFS, "%s: dfs_cache_noreq_find: failed (rc=%d)\n", __func__, rc); ++ return rc; ++ } ++ cifs_dbg(FYI, "%s: ref.flags=0x%x\n", __func__, ref.flags); ++ /* ++ * Check if all targets are capable of handling DFS referrals as per ++ * MS-DFSC 2.2.4 RESP_GET_DFS_REFERRAL. ++ */ ++ *ref_server = !!(ref.flags & DFSREF_REFERRAL_SERVER); ++ free_dfs_info_param(&ref); ++ } ++ return 0; ++} ++ + int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *vol) + { + int rc = 0; +@@ -4740,6 +4767,7 @@ int cifs_mount(struct cifs_sb_info *cifs + char *ref_path = NULL, *full_path = NULL; + char *oldmnt = NULL; + char *mntdata = NULL; ++ bool ref_server = false; + + rc = mount_get_conns(vol, cifs_sb, &xid, &server, &ses, &tcon); + /* +@@ -4804,11 +4832,16 @@ int cifs_mount(struct cifs_sb_info *cifs + break; + if (!tcon) + continue; ++ + /* Make sure that requests go through new root servers */ +- if (is_tcon_dfs(tcon)) { ++ rc = is_referral_server(ref_path + 1, tcon, &ref_server); ++ if (rc) ++ break; ++ if (ref_server) { + put_root_ses(root_ses); + set_root_ses(cifs_sb, ses, &root_ses); + } ++ + /* Get next dfs path and then continue chasing them if -EREMOTE */ + rc = next_dfs_prepath(cifs_sb, vol, xid, server, tcon, &ref_path); + /* Prevent recursion on broken link referrals */ +--- a/fs/cifs/dfs_cache.c ++++ b/fs/cifs/dfs_cache.c +@@ -35,11 +35,12 @@ struct cache_dfs_tgt { + struct cache_entry { + struct hlist_node hlist; + const char *path; +- int ttl; +- int srvtype; +- int flags; ++ int hdr_flags; /* RESP_GET_DFS_REFERRAL.ReferralHeaderFlags */ ++ int ttl; /* DFS_REREFERRAL_V3.TimeToLive */ ++ int srvtype; /* DFS_REREFERRAL_V3.ServerType */ ++ int ref_flags; /* DFS_REREFERRAL_V3.ReferralEntryFlags */ + struct timespec64 etime; +- int path_consumed; ++ int path_consumed; /* RESP_GET_DFS_REFERRAL.PathConsumed */ + int numtgts; + struct list_head tlist; + struct cache_dfs_tgt *tgthint; +@@ -164,14 +165,11 @@ static int dfscache_proc_show(struct seq + continue; + + seq_printf(m, +- "cache entry: path=%s,type=%s,ttl=%d,etime=%ld," +- "interlink=%s,path_consumed=%d,expired=%s\n", +- ce->path, +- ce->srvtype == DFS_TYPE_ROOT ? "root" : "link", +- ce->ttl, ce->etime.tv_nsec, +- IS_INTERLINK_SET(ce->flags) ? "yes" : "no", +- ce->path_consumed, +- cache_entry_expired(ce) ? "yes" : "no"); ++ "cache entry: path=%s,type=%s,ttl=%d,etime=%ld,hdr_flags=0x%x,ref_flags=0x%x,interlink=%s,path_consumed=%d,expired=%s\n", ++ ce->path, ce->srvtype == DFS_TYPE_ROOT ? "root" : "link", ++ ce->ttl, ce->etime.tv_nsec, ce->ref_flags, ce->hdr_flags, ++ IS_INTERLINK_SET(ce->hdr_flags) ? "yes" : "no", ++ ce->path_consumed, cache_entry_expired(ce) ? "yes" : "no"); + + list_for_each_entry(t, &ce->tlist, list) { + seq_printf(m, " %s%s\n", +@@ -234,13 +232,14 @@ static inline void dump_tgts(const struc + + static inline void dump_ce(const struct cache_entry *ce) + { +- cifs_dbg(FYI, "cache entry: path=%s,type=%s,ttl=%d,etime=%ld," +- "interlink=%s,path_consumed=%d,expired=%s\n", ce->path, +- ce->srvtype == DFS_TYPE_ROOT ? "root" : "link", ce->ttl, +- ce->etime.tv_nsec, +- IS_INTERLINK_SET(ce->flags) ? "yes" : "no", +- ce->path_consumed, +- cache_entry_expired(ce) ? "yes" : "no"); ++ cifs_dbg(FYI, "cache entry: path=%s,type=%s,ttl=%d,etime=%ld,hdr_flags=0x%x,ref_flags=0x%x,interlink=%s,path_consumed=%d,expired=%s\n", ++ ce->path, ++ ce->srvtype == DFS_TYPE_ROOT ? "root" : "link", ce->ttl, ++ ce->etime.tv_nsec, ++ ce->hdr_flags, ce->ref_flags, ++ IS_INTERLINK_SET(ce->hdr_flags) ? "yes" : "no", ++ ce->path_consumed, ++ cache_entry_expired(ce) ? "yes" : "no"); + dump_tgts(ce); + } + +@@ -379,7 +378,8 @@ static int copy_ref_data(const struct df + ce->ttl = refs[0].ttl; + ce->etime = get_expire_time(ce->ttl); + ce->srvtype = refs[0].server_type; +- ce->flags = refs[0].ref_flag; ++ ce->hdr_flags = refs[0].flags; ++ ce->ref_flags = refs[0].ref_flag; + ce->path_consumed = refs[0].path_consumed; + + for (i = 0; i < numrefs; i++) { +@@ -797,7 +797,8 @@ static int setup_referral(const char *pa + ref->path_consumed = ce->path_consumed; + ref->ttl = ce->ttl; + ref->server_type = ce->srvtype; +- ref->ref_flag = ce->flags; ++ ref->ref_flag = ce->ref_flags; ++ ref->flags = ce->hdr_flags; + + return 0; + diff --git a/patches.suse/clk-fsl-flexspi-new-driver.patch b/patches.suse/clk-fsl-flexspi-new-driver.patch new file mode 100644 index 0000000..33d0116 --- /dev/null +++ b/patches.suse/clk-fsl-flexspi-new-driver.patch @@ -0,0 +1,194 @@ +From fcf77be87eacb8f305528d24d892dfcf15cf0341 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Sun, 8 Nov 2020 19:51:11 +0100 +Subject: [PATCH] clk: fsl-flexspi: new driver + +Git-commit: fcf77be87eacb8f305528d24d892dfcf15cf0341 +Patch-mainline: v5.11-rc1 +References: bsc#1182743 + +Add support for the FlexSPI clock on Freescale Layerscape SoCs. The +clock is a simple divider based one and is located inside the device +configuration space (DCFG). + +This will allow switching the SCK frequencies for the FlexSPI interface +on the LS1028A and the LX2160A. + +Signed-off-by: Michael Walle +Link: https://lore.kernel.org/r/20201108185113.31377-8-michael@walle.cc +[sboyd@kernel.org: Drop modalias, add module table] +Signed-off-by: Stephen Boyd +[Yousaf]: Adapt for v5.3 +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/clk/Kconfig | 8 +++ + drivers/clk/Makefile | 1 + + drivers/clk/clk-fsl-flexspi.c | 125 ++++++++++++++++++++++++++++++++++ + 3 files changed, 134 insertions(+) + create mode 100644 drivers/clk/clk-fsl-flexspi.c + +diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig +index 5bc72db9bc73..1cf343fe8096 100644 +--- a/drivers/clk/Kconfig ++++ b/drivers/clk/Kconfig +@@ -171,6 +171,14 @@ config COMMON_CLK_CS2000_CP + help + If you say yes here you get support for the CS2000 clock multiplier. + ++config COMMON_CLK_FSL_FLEXSPI ++ tristate "Clock driver for FlexSPI on Layerscape SoCs" ++ depends on ARCH_LAYERSCAPE || COMPILE_TEST ++ default ARCH_LAYERSCAPE && SPI_NXP_FLEXSPI ++ help ++ On Layerscape SoCs there is a special clock for the FlexSPI ++ interface. ++ + config COMMON_CLK_FSL_SAI + bool "Clock driver for BCLK of Freescale SAI cores" + depends on ARCH_LAYERSCAPE || COMPILE_TEST +diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile +index 6f2c554c992e..2d2d383ddf00 100644 +--- a/drivers/clk/Makefile ++++ b/drivers/clk/Makefile +@@ -28,6 +28,7 @@ obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o + obj-$(CONFIG_COMMON_CLK_CS2000_CP) += clk-cs2000-cp.o + obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o + obj-$(CONFIG_COMMON_CLK_FIXED_MMIO) += clk-fixed-mmio.o ++obj-$(CONFIG_COMMON_CLK_FSL_FLEXSPI) += clk-fsl-flexspi.o + obj-$(CONFIG_COMMON_CLK_FSL_SAI) += clk-fsl-sai.o + obj-$(CONFIG_COMMON_CLK_GEMINI) += clk-gemini.o + obj-$(CONFIG_COMMON_CLK_ASPEED) += clk-aspeed.o +diff --git a/drivers/clk/clk-fsl-flexspi.c b/drivers/clk/clk-fsl-flexspi.c +new file mode 100644 +index 000000000000..9cea0db2e725 +--- /dev/null ++++ b/drivers/clk/clk-fsl-flexspi.c +@@ -0,0 +1,125 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Layerscape FlexSPI clock driver ++ * ++ * Copyright 2020 Michael Walle ++ */ ++ ++#include ++#include ++#include ++#include ++ ++static const struct clk_div_table ls1028a_flexspi_divs[] = { ++ { .val = 0, .div = 1, }, ++ { .val = 1, .div = 2, }, ++ { .val = 2, .div = 3, }, ++ { .val = 3, .div = 4, }, ++ { .val = 4, .div = 5, }, ++ { .val = 5, .div = 6, }, ++ { .val = 6, .div = 7, }, ++ { .val = 7, .div = 8, }, ++ { .val = 11, .div = 12, }, ++ { .val = 15, .div = 16, }, ++ { .val = 16, .div = 20, }, ++ { .val = 17, .div = 24, }, ++ { .val = 18, .div = 28, }, ++ { .val = 19, .div = 32, }, ++ { .val = 20, .div = 80, }, ++ {} ++}; ++ ++static const struct clk_div_table lx2160a_flexspi_divs[] = { ++ { .val = 1, .div = 2, }, ++ { .val = 3, .div = 4, }, ++ { .val = 5, .div = 6, }, ++ { .val = 7, .div = 8, }, ++ { .val = 11, .div = 12, }, ++ { .val = 15, .div = 16, }, ++ { .val = 16, .div = 20, }, ++ { .val = 17, .div = 24, }, ++ { .val = 18, .div = 28, }, ++ { .val = 19, .div = 32, }, ++ { .val = 20, .div = 80, }, ++ {} ++}; ++ ++static int fsl_flexspi_clk_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *np = dev->of_node; ++ const char *clk_name = np->name; ++ const char *clk_parent; ++ struct resource *res; ++ void __iomem *reg; ++ struct clk_hw *hw; ++ const struct clk_div_table *divs; ++ int ret; ++ ++ divs = device_get_match_data(dev); ++ if (!divs) ++ return -ENOENT; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!res) ++ return -ENOENT; ++ ++ /* ++ * Can't use devm_ioremap_resource() or devm_of_iomap() because the ++ * resource might already be taken by the parent device. ++ */ ++ reg = devm_ioremap(dev, res->start, resource_size(res)); ++ if (!reg) ++ return -ENOMEM; ++ ++ clk_parent = of_clk_get_parent_name(np, 0); ++ if (!clk_parent) ++ return -EINVAL; ++ ++ of_property_read_string(np, "clock-output-names", &clk_name); ++ ++ hw = clk_hw_register_divider_table(dev, clk_name, clk_parent, 0, ++ reg, 0, 5, 0, divs, NULL); ++ if (IS_ERR(hw)) ++ return PTR_ERR(hw); ++ ++ platform_set_drvdata(pdev, hw); ++ ++ ret = of_clk_add_hw_provider(pdev->dev.of_node, of_clk_hw_simple_get, hw); ++ if (ret) ++ clk_hw_unregister_divider(hw); ++ ++ return ret; ++} ++ ++static int fsl_flexspi_clk_remove(struct platform_device *pdev) ++{ ++ struct clk_hw *hw = platform_get_drvdata(pdev); ++ ++ of_clk_del_provider(pdev->dev.of_node); ++ ++ clk_hw_unregister_divider(hw); ++ ++ return 0; ++} ++ ++static const struct of_device_id fsl_flexspi_clk_dt_ids[] = { ++ { .compatible = "fsl,ls1028a-flexspi-clk", .data = &ls1028a_flexspi_divs }, ++ { .compatible = "fsl,lx2160a-flexspi-clk", .data = &lx2160a_flexspi_divs }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, fsl_flexspi_clk_dt_ids); ++ ++static struct platform_driver fsl_flexspi_clk_driver = { ++ .driver = { ++ .name = "fsl-flexspi-clk", ++ .of_match_table = fsl_flexspi_clk_dt_ids, ++ }, ++ .probe = fsl_flexspi_clk_probe, ++ .remove = fsl_flexspi_clk_remove, ++}; ++module_platform_driver(fsl_flexspi_clk_driver); ++ ++MODULE_DESCRIPTION("FlexSPI clock driver for Layerscape SoCs"); ++MODULE_AUTHOR("Michael Walle "); ++MODULE_LICENSE("GPL"); +-- +2.26.2 + diff --git a/patches.suse/clk-qoriq-provide-constants-for-the-type.patch b/patches.suse/clk-qoriq-provide-constants-for-the-type.patch new file mode 100644 index 0000000..aca5124 --- /dev/null +++ b/patches.suse/clk-qoriq-provide-constants-for-the-type.patch @@ -0,0 +1,99 @@ +From: Michael Walle +Date: Sun, 8 Nov 2020 19:51:07 +0100 +Subject: clk: qoriq: provide constants for the type + +Git-commit: 4cb15934ba05b49784d9d47778af308e7ea50b69 +Patch-mainline: v5.11-rc1 +References: bsc#1182743 + +To avoid future mistakes in the device tree for the clockgen module, add +constants for the clockgen subtype as well as a macro for the PLL +divider. + +Signed-off-by: Michael Walle +Acked-by: Rob Herring +Link: https://lore.kernel.org/r/20201108185113.31377-4-michael@walle.cc +Signed-off-by: Stephen Boyd +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/clk/clk-qoriq.c | 13 +++++++------ + include/dt-bindings/clock/fsl,qoriq-clockgen.h | 15 +++++++++++++++ + 2 files changed, 22 insertions(+), 6 deletions(-) + create mode 100644 include/dt-bindings/clock/fsl,qoriq-clockgen.h + +diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c +index 46101c6a20f2..70aa521e7e7f 100644 +--- a/drivers/clk/clk-qoriq.c ++++ b/drivers/clk/clk-qoriq.c +@@ -7,6 +7,7 @@ + + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + ++#include + #include + #include + #include +@@ -1368,33 +1369,33 @@ static struct clk *clockgen_clk_get(struct of_phandle_args *clkspec, void *data) + idx = clkspec->args[1]; + + switch (type) { +- case 0: ++ case QORIQ_CLK_SYSCLK: + if (idx != 0) + goto bad_args; + clk = cg->sysclk; + break; +- case 1: ++ case QORIQ_CLK_CMUX: + if (idx >= ARRAY_SIZE(cg->cmux)) + goto bad_args; + clk = cg->cmux[idx]; + break; +- case 2: ++ case QORIQ_CLK_HWACCEL: + if (idx >= ARRAY_SIZE(cg->hwaccel)) + goto bad_args; + clk = cg->hwaccel[idx]; + break; +- case 3: ++ case QORIQ_CLK_FMAN: + if (idx >= ARRAY_SIZE(cg->fman)) + goto bad_args; + clk = cg->fman[idx]; + break; +- case 4: ++ case QORIQ_CLK_PLATFORM_PLL: + pll = &cg->pll[PLATFORM_PLL]; + if (idx >= ARRAY_SIZE(pll->div)) + goto bad_args; + clk = pll->div[idx].clk; + break; +- case 5: ++ case QORIQ_CLK_CORECLK: + if (idx != 0) + goto bad_args; + clk = cg->coreclk; +diff --git a/include/dt-bindings/clock/fsl,qoriq-clockgen.h b/include/dt-bindings/clock/fsl,qoriq-clockgen.h +new file mode 100644 +index 000000000000..ddec7d0bdc7f +--- /dev/null ++++ b/include/dt-bindings/clock/fsl,qoriq-clockgen.h +@@ -0,0 +1,15 @@ ++/* SPDX-License-Identifier: GPL-2.0-only */ ++ ++#ifndef DT_CLOCK_FSL_QORIQ_CLOCKGEN_H ++#define DT_CLOCK_FSL_QORIQ_CLOCKGEN_H ++ ++#define QORIQ_CLK_SYSCLK 0 ++#define QORIQ_CLK_CMUX 1 ++#define QORIQ_CLK_HWACCEL 2 ++#define QORIQ_CLK_FMAN 3 ++#define QORIQ_CLK_PLATFORM_PLL 4 ++#define QORIQ_CLK_CORECLK 5 ++ ++#define QORIQ_CLK_PLL_DIV(x) ((x) - 1) ++ ++#endif /* DT_CLOCK_FSL_QORIQ_CLOCKGEN_H */ +-- +2.26.2 + diff --git a/patches.suse/clk-tegra-bpmp-Clamp-clock-rates-on-requests.patch b/patches.suse/clk-tegra-bpmp-Clamp-clock-rates-on-requests.patch index 1c72833..8bc0a6b 100644 --- a/patches.suse/clk-tegra-bpmp-Clamp-clock-rates-on-requests.patch +++ b/patches.suse/clk-tegra-bpmp-Clamp-clock-rates-on-requests.patch @@ -3,8 +3,7 @@ Date: Wed, 21 Oct 2020 13:10:54 +0300 Subject: clk: tegra: bpmp: Clamp clock rates on requests Git-commit: a886c310d9fcb0e66253d4af225cba13f9bdf5d2 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: jsc#SLE-15847 BPMP firmware ABI expects the rate inputs in int64_t. However, diff --git a/patches.suse/coresight-Fix-uninitialised-pointer-bug-in-etm_setup.patch b/patches.suse/coresight-Fix-uninitialised-pointer-bug-in-etm_setup.patch index 143a983..eae66b2 100644 --- a/patches.suse/coresight-Fix-uninitialised-pointer-bug-in-etm_setup.patch +++ b/patches.suse/coresight-Fix-uninitialised-pointer-bug-in-etm_setup.patch @@ -2,9 +2,8 @@ From: Mike Leach Date: Wed, 28 Oct 2020 17:43:01 +0000 Subject: coresight: Fix uninitialised pointer bug in etm_setup_aux() -Git-commit: 1e5504656e5a78d096fe59a880fe2a9eb75f50e3 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Git-commit: 39a7661dcf655c8198fd5d72412f5030a8e58444 +Patch-mainline: v5.10-rc2 References: jsc#SLE-13629,jsc#SLE-14776 Commit [bb1860efc817] changed the sink handling code introducing an diff --git a/patches.suse/coresight-Remove-unnecessary-THIS_MODULE-of-funnel-a.patch b/patches.suse/coresight-Remove-unnecessary-THIS_MODULE-of-funnel-a.patch index 9c01112..dc1add4 100644 --- a/patches.suse/coresight-Remove-unnecessary-THIS_MODULE-of-funnel-a.patch +++ b/patches.suse/coresight-Remove-unnecessary-THIS_MODULE-of-funnel-a.patch @@ -3,9 +3,8 @@ Date: Tue, 3 Nov 2020 21:21:48 +0800 Subject: coresight: Remove unnecessary THIS_MODULE of funnel and replicator driver -Git-commit: 457c731a901e473c21f0bb0cacaf21e87ad8fe8e -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Git-commit: a4ecf0e047c66382de1463d2e47d5683b934e008 +Patch-mainline: v5.11-rc1 References: jsc#SLE-13629,jsc#SLE-14776 As THIS_MODULE has been set in platform_driver_register(), so remove it diff --git a/patches.suse/coresight-add-module-license.patch b/patches.suse/coresight-add-module-license.patch index 7221b9f..c7ca7df 100644 --- a/patches.suse/coresight-add-module-license.patch +++ b/patches.suse/coresight-add-module-license.patch @@ -2,9 +2,8 @@ From: Arnd Bergmann Date: Mon, 26 Oct 2020 17:01:54 +0100 Subject: coresight: add module license -Git-commit: 200bbb88b76c0f420ba5b537005ec0c0a5511b4e -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Git-commit: 0f5cef2b2904b8d41d34ecb6c5d5bf2f00562b1b +Patch-mainline: v5.10-rc2 References: jsc#SLE-13629,jsc#SLE-14776 When built as a loadable module, coresight now causes a warning about diff --git a/patches.suse/coresight-core-Remove-unneeded-semicolon.patch b/patches.suse/coresight-core-Remove-unneeded-semicolon.patch index aa0424a..d6ab8d7 100644 --- a/patches.suse/coresight-core-Remove-unneeded-semicolon.patch +++ b/patches.suse/coresight-core-Remove-unneeded-semicolon.patch @@ -2,9 +2,8 @@ From: Zou Wei Date: Thu, 29 Oct 2020 10:25:48 +0800 Subject: coresight: core: Remove unneeded semicolon -Git-commit: 02e94a827973ab789d534a2e31c2f3bc9e97998b -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Git-commit: 3ac1e0069b2c4fafce1317b389e7d1cfac69a039 +Patch-mainline: v5.11-rc1 References: jsc#SLE-13629,jsc#SLE-14776 Fixes coccicheck warning: diff --git a/patches.suse/coresight-cti-Initialize-dynamic-sysfs-attributes.patch b/patches.suse/coresight-cti-Initialize-dynamic-sysfs-attributes.patch index ff388a8..8a591f4 100644 --- a/patches.suse/coresight-cti-Initialize-dynamic-sysfs-attributes.patch +++ b/patches.suse/coresight-cti-Initialize-dynamic-sysfs-attributes.patch @@ -2,9 +2,8 @@ From: Suzuki K Poulose Date: Wed, 28 Oct 2020 10:54:53 +0000 Subject: coresight: cti: Initialize dynamic sysfs attributes -Git-commit: 05a2c5820555b58d882bf5037d6739189a0c1b33 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Git-commit: 80624263fa289b3416f7ca309491f1b75e579477 +Patch-mainline: v5.10-rc2 References: jsc#SLE-13629,jsc#SLE-14776 With LOCKDEP enabled, CTI driver triggers the following splat due diff --git a/patches.suse/coresight-etb10-Fix-possible-NULL-ptr-dereference-in.patch b/patches.suse/coresight-etb10-Fix-possible-NULL-ptr-dereference-in.patch index 9f816d8..1df7a93 100644 --- a/patches.suse/coresight-etb10-Fix-possible-NULL-ptr-dereference-in.patch +++ b/patches.suse/coresight-etb10-Fix-possible-NULL-ptr-dereference-in.patch @@ -3,9 +3,8 @@ Date: Wed, 7 Oct 2020 18:30:25 +0530 Subject: coresight: etb10: Fix possible NULL ptr dereference in etb_enable_perf() -Git-commit: b5882e904ce1eaf07cf3699c4b889b82628a5750 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Git-commit: 22b2beaa7f166f550424cbb3b988aeaa7ef0425a +Patch-mainline: v5.11-rc1 References: jsc#SLE-13629,jsc#SLE-14776 There was a report of NULL pointer dereference in ETF enable diff --git a/patches.suse/coresight-etm4x-Fix-accesses-to-TRCCIDCTLR1.patch b/patches.suse/coresight-etm4x-Fix-accesses-to-TRCCIDCTLR1.patch index c6d9ebb..5d2f960 100644 --- a/patches.suse/coresight-etm4x-Fix-accesses-to-TRCCIDCTLR1.patch +++ b/patches.suse/coresight-etm4x-Fix-accesses-to-TRCCIDCTLR1.patch @@ -2,9 +2,8 @@ From: Suzuki K Poulose Date: Wed, 28 Oct 2020 22:09:21 +0000 Subject: coresight: etm4x: Fix accesses to TRCCIDCTLR1 -Git-commit: e8288b41bce91de20f43c353d9d8f53f950686a1 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Git-commit: f2603b22e3d2dcffd8b0736e5c68df497af6bc84 +Patch-mainline: v5.11-rc1 References: jsc#SLE-13629,jsc#SLE-14776 The TRCCIDCTLR1 is only implemented if TRCIDR4.NUMCIDC > 4. diff --git a/patches.suse/coresight-etm4x-Fix-accesses-to-TRCPROCSELR.patch b/patches.suse/coresight-etm4x-Fix-accesses-to-TRCPROCSELR.patch index 87f5f9a..67d828f 100644 --- a/patches.suse/coresight-etm4x-Fix-accesses-to-TRCPROCSELR.patch +++ b/patches.suse/coresight-etm4x-Fix-accesses-to-TRCPROCSELR.patch @@ -2,9 +2,8 @@ From: Suzuki K Poulose Date: Wed, 28 Oct 2020 22:09:23 +0000 Subject: coresight: etm4x: Fix accesses to TRCPROCSELR -Git-commit: 1dec6c5df5f34964e82af339e13510a020063e20 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Git-commit: 6288b4ceca868eac4bf729532f8d845e3ecbed98 +Patch-mainline: v5.11-rc1 References: jsc#SLE-13629,jsc#SLE-14776 TRCPROCSELR is not implemented if the TRCIDR3.NUMPROC == 0. Skip diff --git a/patches.suse/coresight-etm4x-Fix-accesses-to-TRCVMIDCTLR1.patch b/patches.suse/coresight-etm4x-Fix-accesses-to-TRCVMIDCTLR1.patch index ec45e42..5a7da71 100644 --- a/patches.suse/coresight-etm4x-Fix-accesses-to-TRCVMIDCTLR1.patch +++ b/patches.suse/coresight-etm4x-Fix-accesses-to-TRCVMIDCTLR1.patch @@ -2,9 +2,8 @@ From: Suzuki K Poulose Date: Wed, 28 Oct 2020 22:09:20 +0000 Subject: coresight: etm4x: Fix accesses to TRCVMIDCTLR1 -Git-commit: 855885b69419ef970bd3f0dad41bc278b285efff -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Git-commit: 93dd64404cbe63b0afba371acd8db36e84b286c7 +Patch-mainline: v5.11-rc1 References: jsc#SLE-13629,jsc#SLE-14776 TRCVMIDCTRL1 is only implemented only if the TRCIDR4.NUMVMIDC > 4. diff --git a/patches.suse/coresight-etm4x-Handle-TRCVIPCSSCTLR-accesses.patch b/patches.suse/coresight-etm4x-Handle-TRCVIPCSSCTLR-accesses.patch index 2a2b9ec..e1a4b86 100644 --- a/patches.suse/coresight-etm4x-Handle-TRCVIPCSSCTLR-accesses.patch +++ b/patches.suse/coresight-etm4x-Handle-TRCVIPCSSCTLR-accesses.patch @@ -2,9 +2,8 @@ From: Suzuki K Poulose Date: Wed, 28 Oct 2020 22:09:24 +0000 Subject: coresight: etm4x: Handle TRCVIPCSSCTLR accesses -Git-commit: 7aef456716dc4cb1a98739ff88b70ab10d54eedc -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Git-commit: 60c519c5d3629c21ba356782434d5b612d312de4 +Patch-mainline: v5.11-rc1 References: jsc#SLE-13629,jsc#SLE-14776 TRCVIPCSSCTLR is not present if the TRCIDR4.NUMPC > 0. Thus we diff --git a/patches.suse/coresight-etm4x-Modify-core-commit-to-avoid-HiSilico.patch b/patches.suse/coresight-etm4x-Modify-core-commit-to-avoid-HiSilico.patch new file mode 100644 index 0000000..cb9ec76 --- /dev/null +++ b/patches.suse/coresight-etm4x-Modify-core-commit-to-avoid-HiSilico.patch @@ -0,0 +1,236 @@ +From: Qi Liu +Date: Tue, 8 Dec 2020 11:26:51 -0700 +Subject: coresight: etm4x: Modify core-commit to avoid HiSilicon ETM overflow + +Git-commit: e72550928ff052ca721777875bd23a7abf3efb13 +Patch-mainline: v5.11-rc1 +References: jsc#SLE-14776 + +The ETM device can't keep up with the core pipeline when cpu core +is at full speed. This may cause overflow within core and its ETM. +This is a common phenomenon on ETM devices. + +On HiSilicon Hip08 platform, a specific feature is added to set +core pipeline. So commit rate can be reduced manually to avoid ETM +overflow. + +Reviewed-by: Suzuki K Poulose +Signed-off-by: Qi Liu +[Modified changelog title and Kconfig description] +Signed-off-by: Mathieu Poirier +Link: https://lore.kernel.org/r/20201208182651.1597945-4-mathieu.poirier@linaro.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/hwtracing/coresight/Kconfig | 8 ++ + .../coresight/coresight-etm4x-core.c | 98 +++++++++++++++++++ + drivers/hwtracing/coresight/coresight-etm4x.h | 8 ++ + 3 files changed, 114 insertions(+) + +diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig +index c1198245461d..7b44ba22cbe1 100644 +--- a/drivers/hwtracing/coresight/Kconfig ++++ b/drivers/hwtracing/coresight/Kconfig +@@ -110,6 +110,14 @@ config CORESIGHT_SOURCE_ETM4X + To compile this driver as a module, choose M here: the + module will be called coresight-etm4x. + ++config ETM4X_IMPDEF_FEATURE ++ bool "Control implementation defined overflow support in ETM 4.x driver" ++ depends on CORESIGHT_SOURCE_ETM4X ++ help ++ This control provides implementation define control for CoreSight ++ ETM 4.x tracer module that can't reduce commit rate automatically. ++ This avoids overflow between the ETM tracer module and the cpu core. ++ + config CORESIGHT_STM + tristate "CoreSight System Trace Macrocell driver" + depends on (ARM && !(CPU_32v3 || CPU_32v4 || CPU_32v4T)) || ARM64 +diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c +index 3ad5c2a01033..b20b6ff17cf6 100644 +--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c ++++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c +@@ -3,6 +3,7 @@ + * Copyright (c) 2014, The Linux Foundation. All rights reserved. + */ + ++#include + #include + #include + #include +@@ -28,7 +29,9 @@ + #include + #include + #include ++ + #include ++#include + #include + #include + +@@ -103,6 +106,97 @@ struct etm4_enable_arg { + int rc; + }; + ++#ifdef CONFIG_ETM4X_IMPDEF_FEATURE ++ ++#define HISI_HIP08_AMBA_ID 0x000b6d01 ++#define ETM4_AMBA_MASK 0xfffff ++#define HISI_HIP08_CORE_COMMIT_MASK 0x3000 ++#define HISI_HIP08_CORE_COMMIT_SHIFT 12 ++#define HISI_HIP08_CORE_COMMIT_FULL 0b00 ++#define HISI_HIP08_CORE_COMMIT_LVL_1 0b01 ++#define HISI_HIP08_CORE_COMMIT_REG sys_reg(3, 1, 15, 2, 5) ++ ++struct etm4_arch_features { ++ void (*arch_callback)(bool enable); ++}; ++ ++static bool etm4_hisi_match_pid(unsigned int id) ++{ ++ return (id & ETM4_AMBA_MASK) == HISI_HIP08_AMBA_ID; ++} ++ ++static void etm4_hisi_config_core_commit(bool enable) ++{ ++ u8 commit = enable ? HISI_HIP08_CORE_COMMIT_LVL_1 : ++ HISI_HIP08_CORE_COMMIT_FULL; ++ u64 val; ++ ++ /* ++ * bit 12 and 13 of HISI_HIP08_CORE_COMMIT_REG are used together ++ * to set core-commit, 2'b00 means cpu is at full speed, 2'b01, ++ * 2'b10, 2'b11 mean reduce pipeline speed, and 2'b01 means level-1 ++ * speed(minimun value). So bit 12 and 13 should be cleared together. ++ */ ++ val = read_sysreg_s(HISI_HIP08_CORE_COMMIT_REG); ++ val &= ~HISI_HIP08_CORE_COMMIT_MASK; ++ val |= commit << HISI_HIP08_CORE_COMMIT_SHIFT; ++ write_sysreg_s(val, HISI_HIP08_CORE_COMMIT_REG); ++} ++ ++static struct etm4_arch_features etm4_features[] = { ++ [ETM4_IMPDEF_HISI_CORE_COMMIT] = { ++ .arch_callback = etm4_hisi_config_core_commit, ++ }, ++ {}, ++}; ++ ++static void etm4_enable_arch_specific(struct etmv4_drvdata *drvdata) ++{ ++ struct etm4_arch_features *ftr; ++ int bit; ++ ++ for_each_set_bit(bit, drvdata->arch_features, ETM4_IMPDEF_FEATURE_MAX) { ++ ftr = &etm4_features[bit]; ++ ++ if (ftr->arch_callback) ++ ftr->arch_callback(true); ++ } ++} ++ ++static void etm4_disable_arch_specific(struct etmv4_drvdata *drvdata) ++{ ++ struct etm4_arch_features *ftr; ++ int bit; ++ ++ for_each_set_bit(bit, drvdata->arch_features, ETM4_IMPDEF_FEATURE_MAX) { ++ ftr = &etm4_features[bit]; ++ ++ if (ftr->arch_callback) ++ ftr->arch_callback(false); ++ } ++} ++ ++static void etm4_check_arch_features(struct etmv4_drvdata *drvdata, ++ unsigned int id) ++{ ++ if (etm4_hisi_match_pid(id)) ++ set_bit(ETM4_IMPDEF_HISI_CORE_COMMIT, drvdata->arch_features); ++} ++#else ++static void etm4_enable_arch_specific(struct etmv4_drvdata *drvdata) ++{ ++} ++ ++static void etm4_disable_arch_specific(struct etmv4_drvdata *drvdata) ++{ ++} ++ ++static void etm4_check_arch_features(struct etmv4_drvdata *drvdata, ++ unsigned int id) ++{ ++} ++#endif /* CONFIG_ETM4X_IMPDEF_FEATURE */ ++ + static int etm4_enable_hw(struct etmv4_drvdata *drvdata) + { + int i, rc; +@@ -110,6 +204,7 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata) + struct device *etm_dev = &drvdata->csdev->dev; + + CS_UNLOCK(drvdata->base); ++ etm4_enable_arch_specific(drvdata); + + etm4_os_unlock(drvdata); + +@@ -479,6 +574,7 @@ static void etm4_disable_hw(void *info) + int i; + + CS_UNLOCK(drvdata->base); ++ etm4_disable_arch_specific(drvdata); + + if (!drvdata->skip_power_up) { + /* power can be removed from the trace unit now */ +@@ -1563,6 +1659,8 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) + drvdata->boot_enable = true; + } + ++ etm4_check_arch_features(drvdata, id->id); ++ + return 0; + } + +diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h +index eefc7371c6c4..3dd3e0633328 100644 +--- a/drivers/hwtracing/coresight/coresight-etm4x.h ++++ b/drivers/hwtracing/coresight/coresight-etm4x.h +@@ -8,6 +8,7 @@ + + #include + #include ++#include + #include "coresight-priv.h" + + /* +@@ -203,6 +204,11 @@ + /* Interpretation of resource numbers change at ETM v4.3 architecture */ + #define ETM4X_ARCH_4V3 0x43 + ++enum etm_impdef_type { ++ ETM4_IMPDEF_HISI_CORE_COMMIT, ++ ETM4_IMPDEF_FEATURE_MAX, ++}; ++ + /** + * struct etmv4_config - configuration information related to an ETMv4 + * @mode: Controls various modes supported by this ETM. +@@ -415,6 +421,7 @@ struct etmv4_save_state { + * @state_needs_restore: True when there is context to restore after PM exit + * @skip_power_up: Indicates if an implementation can skip powering up + * the trace unit. ++ * @arch_features: Bitmap of arch features of etmv4 devices. + */ + struct etmv4_drvdata { + void __iomem *base; +@@ -463,6 +470,7 @@ struct etmv4_drvdata { + struct etmv4_save_state *save_state; + bool state_needs_restore; + bool skip_power_up; ++ DECLARE_BITMAP(arch_features, ETM4_IMPDEF_FEATURE_MAX); + }; + + /* Address comparator access types */ +-- +2.26.2 + diff --git a/patches.suse/coresight-etm4x-Skip-accessing-TRCPDCR-in-save-resto.patch b/patches.suse/coresight-etm4x-Skip-accessing-TRCPDCR-in-save-resto.patch new file mode 100644 index 0000000..007eb10 --- /dev/null +++ b/patches.suse/coresight-etm4x-Skip-accessing-TRCPDCR-in-save-resto.patch @@ -0,0 +1,73 @@ +From: Suzuki K Poulose +Date: Mon, 1 Feb 2021 11:13:24 -0700 +Subject: coresight: etm4x: Skip accessing TRCPDCR in save/restore + +Git-commit: df81b43802f43c0954a55e5d513e8750a1ab4d31 +Patch-mainline: v5.12-rc1 +References: git-fixes + +When the ETM is affected by Qualcomm errata, modifying the +TRCPDCR could cause the system hang. Even though this is +taken care of during enable/disable ETM, the ETM state +save/restore could still access the TRCPDCR. Make sure +we skip the access during the save/restore. + +Found by code inspection. + +Link: https://lore.kernel.org/r/20210110224850.1880240-3-suzuki.poulose@arm.com +Fixes: 02510a5aa78d ("coresight: etm4x: Add support to skip trace unit power up") +Cc: Mathieu Poirier +Cc: Mike Leach +Cc: Sai Prakash Ranjan +Cc: Tingwei Zhang +Tested-by: Sai Prakash Ranjan +Reviewed-by: Sai Prakash Ranjan +Signed-off-by: Suzuki K Poulose +Signed-off-by: Mathieu Poirier +Link: https://lore.kernel.org/r/20210201181351.1475223-5-mathieu.poirier@linaro.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/hwtracing/coresight/coresight-etm4x-core.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c +index 4b615e9f3d76..0924c376e35a 100644 +--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c ++++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c +@@ -1373,7 +1373,8 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) + + state->trcclaimset = readl(drvdata->base + TRCCLAIMCLR); + +- state->trcpdcr = readl(drvdata->base + TRCPDCR); ++ if (!drvdata->skip_power_up) ++ state->trcpdcr = readl(drvdata->base + TRCPDCR); + + /* wait for TRCSTATR.IDLE to go up */ + if (coresight_timeout(drvdata->base, TRCSTATR, TRCSTATR_IDLE_BIT, 1)) { +@@ -1391,9 +1392,9 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) + * potentially save power on systems that respect the TRCPDCR_PU + * despite requesting software to save/restore state. + */ +- writel_relaxed((state->trcpdcr & ~TRCPDCR_PU), +- drvdata->base + TRCPDCR); +- ++ if (!drvdata->skip_power_up) ++ writel_relaxed((state->trcpdcr & ~TRCPDCR_PU), ++ drvdata->base + TRCPDCR); + out: + CS_LOCK(drvdata->base); + return ret; +@@ -1488,7 +1489,8 @@ static void etm4_cpu_restore(struct etmv4_drvdata *drvdata) + + writel_relaxed(state->trcclaimset, drvdata->base + TRCCLAIMSET); + +- writel_relaxed(state->trcpdcr, drvdata->base + TRCPDCR); ++ if (!drvdata->skip_power_up) ++ writel_relaxed(state->trcpdcr, drvdata->base + TRCPDCR); + + drvdata->state_needs_restore = false; + +-- +2.26.2 + diff --git a/patches.suse/coresight-etm4x-Update-TRCIDR3.NUMPROCS-handling-to-.patch b/patches.suse/coresight-etm4x-Update-TRCIDR3.NUMPROCS-handling-to-.patch index bccd9e4..ee43feb 100644 --- a/patches.suse/coresight-etm4x-Update-TRCIDR3.NUMPROCS-handling-to-.patch +++ b/patches.suse/coresight-etm4x-Update-TRCIDR3.NUMPROCS-handling-to-.patch @@ -2,9 +2,8 @@ From: Suzuki K Poulose Date: Wed, 28 Oct 2020 22:09:22 +0000 Subject: coresight: etm4x: Update TRCIDR3.NUMPROCS handling to match v4.2 -Git-commit: 1522cc7e2560a9f473eeabf6a3efb989ab4d861f -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Git-commit: 4e2187274fe8f3ddf55870e7e6b1aa7d65ba12eb +Patch-mainline: v5.11-rc1 References: jsc#SLE-13629,jsc#SLE-14776 Since ETMv4.2, TRCIDR3.NUMPROCS has been extended to a 5bit field diff --git a/patches.suse/coresight-tmc-etf-Fix-NULL-ptr-dereference-in-tmc_en.patch b/patches.suse/coresight-tmc-etf-Fix-NULL-ptr-dereference-in-tmc_en.patch index 22b86d6..59f688f 100644 --- a/patches.suse/coresight-tmc-etf-Fix-NULL-ptr-dereference-in-tmc_en.patch +++ b/patches.suse/coresight-tmc-etf-Fix-NULL-ptr-dereference-in-tmc_en.patch @@ -3,9 +3,8 @@ Date: Wed, 7 Oct 2020 18:30:24 +0530 Subject: coresight: tmc-etf: Fix NULL ptr dereference in tmc_enable_etf_sink_perf() -Git-commit: aa58fe487d4b0a2ebc882054b869e39b6c558a7f -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Git-commit: 868663dd5d69fef05bfb004f91da5c30e9b93461 +Patch-mainline: v5.11-rc1 References: jsc#SLE-13629,jsc#SLE-14776 There was a report of NULL pointer dereference in ETF enable diff --git a/patches.suse/coresight-tmc-etr-Assign-boolean-values-to-a-bool-va.patch b/patches.suse/coresight-tmc-etr-Assign-boolean-values-to-a-bool-va.patch index 2c44164..464f3a2 100644 --- a/patches.suse/coresight-tmc-etr-Assign-boolean-values-to-a-bool-va.patch +++ b/patches.suse/coresight-tmc-etr-Assign-boolean-values-to-a-bool-va.patch @@ -2,9 +2,8 @@ From: Kaixu Xia Date: Tue, 10 Nov 2020 11:39:15 +0800 Subject: coresight: tmc-etr: Assign boolean values to a bool variable -Git-commit: c04e5d7bbf6f92a346d6b36770705e7f034df42d -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Git-commit: 92815c0041ffd16799b408ff9fce9bae697e2bf8 +Patch-mainline: v5.11-rc1 References: jsc#SLE-13629,jsc#SLE-14776 Fix the following coccinelle warnings: diff --git a/patches.suse/cpuset-fix-race-between-hotplug-work-and-later-cpu-offline.patch b/patches.suse/cpuset-fix-race-between-hotplug-work-and-later-cpu-offline.patch new file mode 100644 index 0000000..6f0229a --- /dev/null +++ b/patches.suse/cpuset-fix-race-between-hotplug-work-and-later-cpu-offline.patch @@ -0,0 +1,125 @@ +From: Daniel Jordan +Date: Thu, 12 Nov 2020 12:17:11 -0500 +Subject: cpuset: fix race between hotplug work and later CPU offline +Git-commit: 406100f3da08066c00105165db8520bbc7694a36 +Patch-mainline: v5.11-rc1 +References: bsc#1182676 + +One of our machines keeled over trying to rebuild the scheduler domains. +Mainline produces the same splat: + + BUG: unable to handle page fault for address: 0000607f820054db + CPU: 2 PID: 149 Comm: kworker/1:1 Not tainted 5.10.0-rc1-master+ #6 + Workqueue: events cpuset_hotplug_workfn + RIP: build_sched_domains + Call Trace: + partition_sched_domains_locked + rebuild_sched_domains_locked + cpuset_hotplug_workfn + +It happens with cgroup2 and exclusive cpusets only. This reproducer +triggers it on an 8-cpu vm and works most effectively with no +preexisting child cgroups: + + cd $UNIFIED_ROOT + mkdir cg1 + echo 4-7 > cg1/cpuset.cpus + echo root > cg1/cpuset.cpus.partition + + # with smt/control reading 'on', + echo off > /sys/devices/system/cpu/smt/control + +RIP maps to + + sd->shared = *per_cpu_ptr(sdd->sds, sd_id); + +from sd_init(). sd_id is calculated earlier in the same function: + + cpumask_and(sched_domain_span(sd), cpu_map, tl->mask(cpu)); + sd_id = cpumask_first(sched_domain_span(sd)); + +tl->mask(cpu), which reads cpu_sibling_map on x86, returns an empty mask +and so cpumask_first() returns >= nr_cpu_ids, which leads to the bogus +value from per_cpu_ptr() above. + +The problem is a race between cpuset_hotplug_workfn() and a later +offline of CPU N. cpuset_hotplug_workfn() updates the effective masks +when N is still online, the offline clears N from cpu_sibling_map, and +then the worker uses the stale effective masks that still have N to +generate the scheduling domains, leading the worker to read +N's empty cpu_sibling_map in sd_init(). + +rebuild_sched_domains_locked() prevented the race during the cgroup2 +cpuset series up until the Fixes commit changed its check. Make the +check more robust so that it can detect an offline CPU in any exclusive +cpuset's effective mask, not just the top one. + +Fixes: 0ccea8feb980 ("cpuset: Make generate_sched_domains() work with partition") +Signed-off-by: Daniel Jordan +Signed-off-by: Peter Zijlstra (Intel) +Acked-by: Tejun Heo +Cc: stable@vger.kernel.org +Link: https://lkml.kernel.org/r/20201112171711.639541-1-daniel.m.jordan@oracle.com +[mkoutny: Adjust for cpu hotplug lock/cpuset rwsem swap in d74b27d63a8b ("cgroup/cpuset: Change cpuset_rwsem and hotplug lock order")] +Acked-by: Michal Koutný +--- + kernel/cgroup/cpuset.c | 33 ++++++++++++++++++++++++++++----- + 1 file changed, 28 insertions(+), 5 deletions(-) + +--- a/kernel/cgroup/cpuset.c ++++ b/kernel/cgroup/cpuset.c +@@ -970,25 +970,48 @@ partition_and_rebuild_sched_domains(int + */ + static void rebuild_sched_domains_locked(void) + { ++ struct cgroup_subsys_state *pos_css; + struct sched_domain_attr *attr; + cpumask_var_t *doms; ++ struct cpuset *cs; + int ndoms; + + percpu_rwsem_assert_held(&cpuset_rwsem); + get_online_cpus(); + + /* +- * We have raced with CPU hotplug. Don't do anything to avoid ++ * If we have raced with CPU hotplug, return early to avoid + * passing doms with offlined cpu to partition_sched_domains(). +- * Anyways, hotplug work item will rebuild sched domains. ++ * Anyways, cpuset_hotplug_workfn() will rebuild sched domains. ++ * ++ * With no CPUs in any subpartitions, top_cpuset's effective CPUs ++ * should be the same as the active CPUs, so checking only top_cpuset ++ * is enough to detect racing CPU offlines. + */ + if (!top_cpuset.nr_subparts_cpus && + !cpumask_equal(top_cpuset.effective_cpus, cpu_active_mask)) + goto out; + +- if (top_cpuset.nr_subparts_cpus && +- !cpumask_subset(top_cpuset.effective_cpus, cpu_active_mask)) +- goto out; ++ /* ++ * With subpartition CPUs, however, the effective CPUs of a partition ++ * root should be only a subset of the active CPUs. Since a CPU in any ++ * partition root could be offlined, all must be checked. ++ */ ++ if (top_cpuset.nr_subparts_cpus) { ++ rcu_read_lock(); ++ cpuset_for_each_descendant_pre(cs, pos_css, &top_cpuset) { ++ if (!is_partition_root(cs)) { ++ pos_css = css_rightmost_descendant(pos_css); ++ continue; ++ } ++ if (!cpumask_subset(cs->effective_cpus, ++ cpu_active_mask)) { ++ rcu_read_unlock(); ++ goto out; ++ } ++ } ++ rcu_read_unlock(); ++ } + + /* Generate domain masks and attrs */ + ndoms = generate_sched_domains(&doms, &attr); + diff --git a/patches.suse/crypto-Kconfig-CRYPTO_MANAGER_EXTRA_TESTS-requires-t.patch b/patches.suse/crypto-Kconfig-CRYPTO_MANAGER_EXTRA_TESTS-requires-t.patch new file mode 100644 index 0000000..4c970d7 --- /dev/null +++ b/patches.suse/crypto-Kconfig-CRYPTO_MANAGER_EXTRA_TESTS-requires-t.patch @@ -0,0 +1,32 @@ +From: "Jason A. Donenfeld" +Date: Mon, 2 Nov 2020 14:48:15 +0100 +Subject: crypto: Kconfig - CRYPTO_MANAGER_EXTRA_TESTS requires the manager +Patch-mainline: v5.11-rc1 +Git-commit: 6569e3097f1c4a490bdf2b23d326855e04942dfd +References: git-fixes + +The extra tests in the manager actually require the manager to be +selected too. Otherwise the linker gives errors like: + +ld: arch/x86/crypto/chacha_glue.o: in function `chacha_simd_stream_xor': +chacha_glue.c:(.text+0x422): undefined reference to `crypto_simd_disabled_for_test' + +Fixes: 2343d1529aff ("crypto: Kconfig - allow tests to be disabled when manager is disabled") +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Herbert Xu +Acked-by: Daniel Wagner +--- + crypto/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/crypto/Kconfig ++++ b/crypto/Kconfig +@@ -145,7 +145,7 @@ config CRYPTO_MANAGER_DISABLE_TESTS + + config CRYPTO_MANAGER_EXTRA_TESTS + bool "Enable extra run-time crypto self tests" +- depends on DEBUG_KERNEL && !CRYPTO_MANAGER_DISABLE_TESTS ++ depends on DEBUG_KERNEL && !CRYPTO_MANAGER_DISABLE_TESTS && CRYPTO_MANAGER + help + Enable extra run-time self tests of registered crypto algorithms, + including randomized fuzz tests. diff --git a/patches.suse/crypto-aesni-prevent-misaligned-buffers-on-the-stack.patch b/patches.suse/crypto-aesni-prevent-misaligned-buffers-on-the-stack.patch new file mode 100644 index 0000000..9876638 --- /dev/null +++ b/patches.suse/crypto-aesni-prevent-misaligned-buffers-on-the-stack.patch @@ -0,0 +1,129 @@ +From a13ed1d15b07a04b1f74b2df61ff7a5e47f45dd8 Mon Sep 17 00:00:00 2001 +From: Ard Biesheuvel +Date: Mon, 4 Jan 2021 16:55:46 +0100 +Subject: [PATCH] crypto: aesni - prevent misaligned buffers on the stack +Git-commit: a13ed1d15b07a04b1f74b2df61ff7a5e47f45dd8 +Patch-mainline: v5.12-rc1 +References: git-fixes + +The GCM mode driver uses 16 byte aligned buffers on the stack to pass +the IV to the asm helpers, but unfortunately, the x86 port does not +guarantee that the stack pointer is 16 byte aligned upon entry in the +first place. Since the compiler is not aware of this, it will not emit +the additional stack realignment sequence that is needed, and so the +alignment is not guaranteed to be more than 8 bytes. + +So instead, allocate some padding on the stack, and realign the IV +pointer by hand. + +Cc: +Signed-off-by: Ard Biesheuvel +Signed-off-by: Herbert Xu +Acked-by: Takashi Iwai + +--- + arch/x86/crypto/aesni-intel_glue.c | 28 ++++++++++++++++------------ + 1 file changed, 16 insertions(+), 12 deletions(-) + +diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c +index 2116bc2b9507..880f9f8b5153 100644 +--- a/arch/x86/crypto/aesni-intel_glue.c ++++ b/arch/x86/crypto/aesni-intel_glue.c +@@ -710,7 +710,8 @@ static int gcmaes_crypt_by_sg(bool enc, struct aead_request *req, + struct crypto_aead *tfm = crypto_aead_reqtfm(req); + unsigned long auth_tag_len = crypto_aead_authsize(tfm); + const struct aesni_gcm_tfm_s *gcm_tfm = aesni_gcm_tfm; +- struct gcm_context_data data AESNI_ALIGN_ATTR; ++ u8 databuf[sizeof(struct gcm_context_data) + (AESNI_ALIGN - 8)] __aligned(8); ++ struct gcm_context_data *data = PTR_ALIGN((void *)databuf, AESNI_ALIGN); + struct scatter_walk dst_sg_walk = {}; + unsigned long left = req->cryptlen; + unsigned long len, srclen, dstlen; +@@ -759,8 +760,7 @@ static int gcmaes_crypt_by_sg(bool enc, struct aead_request *req, + } + + kernel_fpu_begin(); +- gcm_tfm->init(aes_ctx, &data, iv, +- hash_subkey, assoc, assoclen); ++ gcm_tfm->init(aes_ctx, data, iv, hash_subkey, assoc, assoclen); + if (req->src != req->dst) { + while (left) { + src = scatterwalk_map(&src_sg_walk); +@@ -770,10 +770,10 @@ static int gcmaes_crypt_by_sg(bool enc, struct aead_request *req, + len = min(srclen, dstlen); + if (len) { + if (enc) +- gcm_tfm->enc_update(aes_ctx, &data, ++ gcm_tfm->enc_update(aes_ctx, data, + dst, src, len); + else +- gcm_tfm->dec_update(aes_ctx, &data, ++ gcm_tfm->dec_update(aes_ctx, data, + dst, src, len); + } + left -= len; +@@ -791,10 +791,10 @@ static int gcmaes_crypt_by_sg(bool enc, struct aead_request *req, + len = scatterwalk_clamp(&src_sg_walk, left); + if (len) { + if (enc) +- gcm_tfm->enc_update(aes_ctx, &data, ++ gcm_tfm->enc_update(aes_ctx, data, + src, src, len); + else +- gcm_tfm->dec_update(aes_ctx, &data, ++ gcm_tfm->dec_update(aes_ctx, data, + src, src, len); + } + left -= len; +@@ -803,7 +803,7 @@ static int gcmaes_crypt_by_sg(bool enc, struct aead_request *req, + scatterwalk_done(&src_sg_walk, 1, left); + } + } +- gcm_tfm->finalize(aes_ctx, &data, authTag, auth_tag_len); ++ gcm_tfm->finalize(aes_ctx, data, authTag, auth_tag_len); + kernel_fpu_end(); + + if (!assocmem) +@@ -852,7 +852,8 @@ static int helper_rfc4106_encrypt(struct aead_request *req) + struct crypto_aead *tfm = crypto_aead_reqtfm(req); + struct aesni_rfc4106_gcm_ctx *ctx = aesni_rfc4106_gcm_ctx_get(tfm); + void *aes_ctx = &(ctx->aes_key_expanded); +- u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN))); ++ u8 ivbuf[16 + (AESNI_ALIGN - 8)] __aligned(8); ++ u8 *iv = PTR_ALIGN(&ivbuf[0], AESNI_ALIGN); + unsigned int i; + __be32 counter = cpu_to_be32(1); + +@@ -879,7 +880,8 @@ static int helper_rfc4106_decrypt(struct aead_request *req) + struct crypto_aead *tfm = crypto_aead_reqtfm(req); + struct aesni_rfc4106_gcm_ctx *ctx = aesni_rfc4106_gcm_ctx_get(tfm); + void *aes_ctx = &(ctx->aes_key_expanded); +- u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN))); ++ u8 ivbuf[16 + (AESNI_ALIGN - 8)] __aligned(8); ++ u8 *iv = PTR_ALIGN(&ivbuf[0], AESNI_ALIGN); + unsigned int i; + + if (unlikely(req->assoclen != 16 && req->assoclen != 20)) +@@ -1149,7 +1151,8 @@ static int generic_gcmaes_encrypt(struct aead_request *req) + struct crypto_aead *tfm = crypto_aead_reqtfm(req); + struct generic_gcmaes_ctx *ctx = generic_gcmaes_ctx_get(tfm); + void *aes_ctx = &(ctx->aes_key_expanded); +- u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN))); ++ u8 ivbuf[16 + (AESNI_ALIGN - 8)] __aligned(8); ++ u8 *iv = PTR_ALIGN(&ivbuf[0], AESNI_ALIGN); + __be32 counter = cpu_to_be32(1); + + memcpy(iv, req->iv, 12); +@@ -1165,7 +1168,8 @@ static int generic_gcmaes_decrypt(struct aead_request *req) + struct crypto_aead *tfm = crypto_aead_reqtfm(req); + struct generic_gcmaes_ctx *ctx = generic_gcmaes_ctx_get(tfm); + void *aes_ctx = &(ctx->aes_key_expanded); +- u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN))); ++ u8 ivbuf[16 + (AESNI_ALIGN - 8)] __aligned(8); ++ u8 *iv = PTR_ALIGN(&ivbuf[0], AESNI_ALIGN); + + memcpy(iv, req->iv, 12); + *((__be32 *)(iv+12)) = counter; +-- +2.26.2 + diff --git a/patches.suse/crypto-arm64-poly1305-neon-reorder-PAC-authenticatio.patch b/patches.suse/crypto-arm64-poly1305-neon-reorder-PAC-authenticatio.patch new file mode 100644 index 0000000..b21ad43 --- /dev/null +++ b/patches.suse/crypto-arm64-poly1305-neon-reorder-PAC-authenticatio.patch @@ -0,0 +1,60 @@ +From: Ard Biesheuvel +Date: Tue, 27 Oct 2020 00:00:27 +0100 +Subject: crypto: arm64/poly1305-neon - reorder PAC authentication with SP + update +Patch-mainline: v5.11-rc1 +Git-commit: 519a0d7e495a6d3ce62594e485aea2a3a4a2ca0a +References: git-fixes + +PAC pointer authentication signs the return address against the value +of the stack pointer, to prevent stack overrun exploits from corrupting +the control flow. However, this requires that the AUTIASP is issued with +SP holding the same value as it held when the PAC value was generated. +The Poly1305 NEON code got this wrong, resulting in crashes on PAC +capable hardware. + +Fixes: f569ca164751 ("crypto: arm64/poly1305 - incorporate OpenSSL/CRYPTOGAMS ...") +Signed-off-by: Ard Biesheuvel +Signed-off-by: Herbert Xu +Acked-by: Daniel Wagner +--- + arch/arm64/crypto/poly1305-armv8.pl | 2 +- + arch/arm64/crypto/poly1305-core.S_shipped | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/arm64/crypto/poly1305-armv8.pl ++++ b/arch/arm64/crypto/poly1305-armv8.pl +@@ -840,7 +840,6 @@ my $is_base2_26 = $zeros; # borrow + ldp d14,d15,[sp,#64] + addp $ACC2,$ACC2,$ACC2 + ldr x30,[sp,#8] +- .inst 0xd50323bf // autiasp + + //////////////////////////////////////////////////////////////// + // lazy reduction, but without narrowing +@@ -882,6 +881,7 @@ my $is_base2_26 = $zeros; # borrow + str x4,[$ctx,#8] // set is_base2_26 + + ldr x29,[sp],#80 ++ .inst 0xd50323bf // autiasp + ret + .size poly1305_blocks_neon,.-poly1305_blocks_neon + +--- a/arch/arm64/crypto/poly1305-core.S_shipped ++++ b/arch/arm64/crypto/poly1305-core.S_shipped +@@ -779,7 +779,6 @@ + ldp d14,d15,[sp,#64] + addp v21.2d,v21.2d,v21.2d + ldr x30,[sp,#8] +- .inst 0xd50323bf // autiasp + + //////////////////////////////////////////////////////////////// + // lazy reduction, but without narrowing +@@ -821,6 +820,7 @@ + str x4,[x0,#8] // set is_base2_26 + + ldr x29,[sp],#80 ++ .inst 0xd50323bf // autiasp + ret + .size poly1305_blocks_neon,.-poly1305_blocks_neon + diff --git a/patches.suse/crypto-arm64-sha-add-missing-module-aliases.patch b/patches.suse/crypto-arm64-sha-add-missing-module-aliases.patch new file mode 100644 index 0000000..f0654e1 --- /dev/null +++ b/patches.suse/crypto-arm64-sha-add-missing-module-aliases.patch @@ -0,0 +1,88 @@ +From 0df07d8117c3576f1603b05b84089742a118d10a Mon Sep 17 00:00:00 2001 +From: Ard Biesheuvel +Date: Thu, 14 Jan 2021 19:10:10 +0100 +Subject: [PATCH] crypto: arm64/sha - add missing module aliases +Git-commit: 0df07d8117c3576f1603b05b84089742a118d10a +Patch-mainline: v5.12-rc1 +References: git-fixes + +The accelerated, instruction based implementations of SHA1, SHA2 and +SHA3 are autoloaded based on CPU capabilities, given that the code is +modest in size, and widely used, which means that resolving the algo +name, loading all compatible modules and picking the one with the +highest priority is taken to be suboptimal. + +However, if these algorithms are requested before this CPU feature +based matching and autoloading occurs, these modules are not even +considered, and we end up with suboptimal performance. + +So add the missing module aliases for the various SHA implementations. + +Cc: +Signed-off-by: Ard Biesheuvel +Signed-off-by: Herbert Xu +Acked-by: Takashi Iwai + +--- + arch/arm64/crypto/sha1-ce-glue.c | 1 + + arch/arm64/crypto/sha2-ce-glue.c | 2 ++ + arch/arm64/crypto/sha3-ce-glue.c | 4 ++++ + arch/arm64/crypto/sha512-ce-glue.c | 2 ++ + 4 files changed, 9 insertions(+) + +diff --git a/arch/arm64/crypto/sha1-ce-glue.c b/arch/arm64/crypto/sha1-ce-glue.c +index c93121bcfdeb..c1362861765f 100644 +--- a/arch/arm64/crypto/sha1-ce-glue.c ++++ b/arch/arm64/crypto/sha1-ce-glue.c +@@ -19,6 +19,7 @@ + MODULE_DESCRIPTION("SHA1 secure hash using ARMv8 Crypto Extensions"); + MODULE_AUTHOR("Ard Biesheuvel "); + MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS_CRYPTO("sha1"); + + struct sha1_ce_state { + struct sha1_state sst; +diff --git a/arch/arm64/crypto/sha2-ce-glue.c b/arch/arm64/crypto/sha2-ce-glue.c +index 31ba3da5e61b..ded3a6488f81 100644 +--- a/arch/arm64/crypto/sha2-ce-glue.c ++++ b/arch/arm64/crypto/sha2-ce-glue.c +@@ -19,6 +19,8 @@ + MODULE_DESCRIPTION("SHA-224/SHA-256 secure hash using ARMv8 Crypto Extensions"); + MODULE_AUTHOR("Ard Biesheuvel "); + MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS_CRYPTO("sha224"); ++MODULE_ALIAS_CRYPTO("sha256"); + + struct sha256_ce_state { + struct sha256_state sst; +diff --git a/arch/arm64/crypto/sha3-ce-glue.c b/arch/arm64/crypto/sha3-ce-glue.c +index e5a2936f0886..7288d3046354 100644 +--- a/arch/arm64/crypto/sha3-ce-glue.c ++++ b/arch/arm64/crypto/sha3-ce-glue.c +@@ -23,6 +23,10 @@ + MODULE_DESCRIPTION("SHA3 secure hash using ARMv8 Crypto Extensions"); + MODULE_AUTHOR("Ard Biesheuvel "); + MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS_CRYPTO("sha3-224"); ++MODULE_ALIAS_CRYPTO("sha3-256"); ++MODULE_ALIAS_CRYPTO("sha3-384"); ++MODULE_ALIAS_CRYPTO("sha3-512"); + + asmlinkage void sha3_ce_transform(u64 *st, const u8 *data, int blocks, + int md_len); +diff --git a/arch/arm64/crypto/sha512-ce-glue.c b/arch/arm64/crypto/sha512-ce-glue.c +index faa83f6cf376..a6b1adf31c56 100644 +--- a/arch/arm64/crypto/sha512-ce-glue.c ++++ b/arch/arm64/crypto/sha512-ce-glue.c +@@ -23,6 +23,8 @@ + MODULE_DESCRIPTION("SHA-384/SHA-512 secure hash using ARMv8 Crypto Extensions"); + MODULE_AUTHOR("Ard Biesheuvel "); + MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS_CRYPTO("sha384"); ++MODULE_ALIAS_CRYPTO("sha512"); + + asmlinkage void sha512_ce_transform(struct sha512_state *sst, u8 const *src, + int blocks); +-- +2.26.2 + diff --git a/patches.suse/crypto-bcm-Rename-struct-device_private-to-bcm_devic.patch b/patches.suse/crypto-bcm-Rename-struct-device_private-to-bcm_devic.patch new file mode 100644 index 0000000..bd4824a --- /dev/null +++ b/patches.suse/crypto-bcm-Rename-struct-device_private-to-bcm_devic.patch @@ -0,0 +1,83 @@ +From f7f2b43eaf6b4cfe54c75100709be31d5c4b52c8 Mon Sep 17 00:00:00 2001 +From: Jiri Olsa +Date: Tue, 5 Jan 2021 00:02:37 +0100 +Subject: [PATCH] crypto: bcm - Rename struct device_private to bcm_device_private +Git-commit: f7f2b43eaf6b4cfe54c75100709be31d5c4b52c8 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Renaming 'struct device_private' to 'struct bcm_device_private', +because it clashes with 'struct device_private' from +'drivers/base/base.h'. + +While it's not a functional problem, it's causing two distinct +type hierarchies in BTF data. It also breaks build with options: + CONFIG_DEBUG_INFO_BTF=y + CONFIG_CRYPTO_DEV_BCM_SPU=y + +as reported by Qais Yousef [1]. + +[1] https://lore.kernel.org/lkml/20201229151352.6hzmjvu3qh6p2qgg@e107158-lin/ + +Fixes: 9d12ba86f818 ("crypto: brcm - Add Broadcom SPU driver") +Signed-off-by: Jiri Olsa +Tested-by: Qais Yousef +Signed-off-by: Herbert Xu +Acked-by: Takashi Iwai + +--- + drivers/crypto/bcm/cipher.c | 2 +- + drivers/crypto/bcm/cipher.h | 4 ++-- + drivers/crypto/bcm/util.c | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c +index 30390a7324b2..0e5537838ef3 100644 +--- a/drivers/crypto/bcm/cipher.c ++++ b/drivers/crypto/bcm/cipher.c +@@ -42,7 +42,7 @@ + + /* ================= Device Structure ================== */ + +-struct device_private iproc_priv; ++struct bcm_device_private iproc_priv; + + /* ==================== Parameters ===================== */ + +diff --git a/drivers/crypto/bcm/cipher.h b/drivers/crypto/bcm/cipher.h +index 0ad5892b445d..71281a3bdbdc 100644 +--- a/drivers/crypto/bcm/cipher.h ++++ b/drivers/crypto/bcm/cipher.h +@@ -420,7 +420,7 @@ struct spu_hw { + u32 num_chan; + }; + +-struct device_private { ++struct bcm_device_private { + struct platform_device *pdev; + + struct spu_hw spu; +@@ -467,6 +467,6 @@ struct device_private { + struct mbox_chan **mbox; + }; + +-extern struct device_private iproc_priv; ++extern struct bcm_device_private iproc_priv; + + #endif +diff --git a/drivers/crypto/bcm/util.c b/drivers/crypto/bcm/util.c +index 2b304fc78059..77aeedb84055 100644 +--- a/drivers/crypto/bcm/util.c ++++ b/drivers/crypto/bcm/util.c +@@ -348,7 +348,7 @@ char *spu_alg_name(enum spu_cipher_alg alg, enum spu_cipher_mode mode) + static ssize_t spu_debugfs_read(struct file *filp, char __user *ubuf, + size_t count, loff_t *offp) + { +- struct device_private *ipriv; ++ struct bcm_device_private *ipriv; + char *buf; + ssize_t ret, out_offset, out_count; + int i; +-- +2.26.2 + diff --git a/patches.suse/crypto-qat-replace-CRYPTO_AES-with-CRYPTO_LIB_AES-in.patch b/patches.suse/crypto-qat-replace-CRYPTO_AES-with-CRYPTO_LIB_AES-in.patch new file mode 100644 index 0000000..078df6b --- /dev/null +++ b/patches.suse/crypto-qat-replace-CRYPTO_AES-with-CRYPTO_LIB_AES-in.patch @@ -0,0 +1,39 @@ +From 4f1a02e75a2eedfddd10222c0fe61d2a04d80099 Mon Sep 17 00:00:00 2001 +From: Marco Chiappero +Date: Mon, 4 Jan 2021 15:35:15 +0000 +Subject: [PATCH] crypto: qat - replace CRYPTO_AES with CRYPTO_LIB_AES in + Kconfig +Git-commit: 4f1a02e75a2eedfddd10222c0fe61d2a04d80099 +References: git-fixes +Patch-mainline: v5.12-rc1 + +Use CRYPTO_LIB_AES in place of CRYPTO_AES in the dependences for the QAT +common code. + +Fixes: c0e583ab2016 ("crypto: qat - add CRYPTO_AES to Kconfig dependencies") +Reported-by: Ard Biesheuvel +Signed-off-by: Marco Chiappero +Acked-by: Ard Biesheuvel +Reviewed-by: Giovanni Cabiddu +Signed-off-by: Herbert Xu +Signed-off-by: Oliver Neukum +--- + drivers/crypto/qat/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/crypto/qat/Kconfig b/drivers/crypto/qat/Kconfig +index 846a3d90b41a..77783feb62b2 100644 +--- a/drivers/crypto/qat/Kconfig ++++ b/drivers/crypto/qat/Kconfig +@@ -11,7 +11,7 @@ config CRYPTO_DEV_QAT + select CRYPTO_SHA1 + select CRYPTO_SHA256 + select CRYPTO_SHA512 +- select CRYPTO_AES ++ select CRYPTO_LIB_AES + select FW_LOADER + + config CRYPTO_DEV_QAT_DH895xCC +-- +2.26.2 + diff --git a/patches.suse/dm-crypt-avoid-truncating-the-logical-block-size.patch b/patches.suse/dm-crypt-avoid-truncating-the-logical-block-size.patch deleted file mode 100644 index 06624f2..0000000 --- a/patches.suse/dm-crypt-avoid-truncating-the-logical-block-size.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Eric Biggers -Date: Thu, 4 Jun 2020 12:01:26 -0700 -Subject: [PATCH] dm crypt: avoid truncating the logical block size -Git-commit: 64611a15ca9da91ff532982429c44686f4593b5f -Patch-mainline: v5.8-rc1 -References: bsc#1175995,jsc#SLE-15608 - -queue_limits::logical_block_size got changed from unsigned short to -unsigned int, but it was forgotten to update crypt_io_hints() to use the -new type. Fix it. - -Fixes: ad6bf88a6c19 ("block: fix an integer overflow in logical block size") -Cc: stable@vger.kernel.org -Signed-off-by: Eric Biggers -Reviewed-by: Mikulas Patocka -Signed-off-by: Mike Snitzer -Acked-by: Hannes Reinecke ---- - drivers/md/dm-crypt.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c -index 71c651465bdd..000ddfab5ba0 100644 ---- a/drivers/md/dm-crypt.c -+++ b/drivers/md/dm-crypt.c -@@ -3312,7 +3312,7 @@ static void crypt_io_hints(struct dm_target *ti, struct queue_limits *limits) - limits->max_segment_size = PAGE_SIZE; - - limits->logical_block_size = -- max_t(unsigned short, limits->logical_block_size, cc->sector_size); -+ max_t(unsigned, limits->logical_block_size, cc->sector_size); - limits->physical_block_size = - max_t(unsigned, limits->physical_block_size, cc->sector_size); - limits->io_min = max_t(unsigned, limits->io_min, cc->sector_size); --- -2.16.4 - diff --git a/patches.suse/dmaengine-fsldma-Fix-a-resource-leak-in-an-error-han.patch b/patches.suse/dmaengine-fsldma-Fix-a-resource-leak-in-an-error-han.patch new file mode 100644 index 0000000..6ceebfa --- /dev/null +++ b/patches.suse/dmaengine-fsldma-Fix-a-resource-leak-in-an-error-han.patch @@ -0,0 +1,50 @@ +From b202d4e82531a62a33a6b14d321dd2aad491578e Mon Sep 17 00:00:00 2001 +From: Christophe JAILLET +Date: Sat, 12 Dec 2020 17:06:14 +0100 +Subject: [PATCH] dmaengine: fsldma: Fix a resource leak in an error handling path of the probe function +Git-commit: b202d4e82531a62a33a6b14d321dd2aad491578e +Patch-mainline: v5.12-rc1 +References: git-fixes + +In case of error, the previous 'fsl_dma_chan_probe()' calls must be undone +by some 'fsl_dma_chan_remove()', as already done in the remove function. + +It was added in the remove function in commit 77cd62e8082b ("fsldma: allow +Freescale Elo DMA driver to be compiled as a module") + +Fixes: d3f620b2c4fe ("fsldma: simplify IRQ probing and handling") +Signed-off-by: Christophe JAILLET +Link: https://lore.kernel.org/r/20201212160614.92576-1-christophe.jaillet@wanadoo.fr +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/dma/fsldma.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c +index 554f70a0c18c..f8459cc5315d 100644 +--- a/drivers/dma/fsldma.c ++++ b/drivers/dma/fsldma.c +@@ -1214,6 +1214,7 @@ static int fsldma_of_probe(struct platform_device *op) + { + struct fsldma_device *fdev; + struct device_node *child; ++ unsigned int i; + int err; + + fdev = kzalloc(sizeof(*fdev), GFP_KERNEL); +@@ -1292,6 +1293,10 @@ static int fsldma_of_probe(struct platform_device *op) + return 0; + + out_free_fdev: ++ for (i = 0; i < FSL_DMA_MAX_CHANS_PER_DEVICE; i++) { ++ if (fdev->chan[i]) ++ fsl_dma_chan_remove(fdev->chan[i]); ++ } + irq_dispose_mapping(fdev->irq); + iounmap(fdev->regs); + out_free: +-- +2.26.2 + diff --git a/patches.suse/dmaengine-fsldma-Fix-a-resource-leak-in-the-remove-f.patch b/patches.suse/dmaengine-fsldma-Fix-a-resource-leak-in-the-remove-f.patch new file mode 100644 index 0000000..9715604 --- /dev/null +++ b/patches.suse/dmaengine-fsldma-Fix-a-resource-leak-in-the-remove-f.patch @@ -0,0 +1,42 @@ +From cbc0ad004c03ad7971726a5db3ec84dba3dcb857 Mon Sep 17 00:00:00 2001 +From: Christophe JAILLET +Date: Sat, 12 Dec 2020 17:05:16 +0100 +Subject: [PATCH] dmaengine: fsldma: Fix a resource leak in the remove function +Git-commit: cbc0ad004c03ad7971726a5db3ec84dba3dcb857 +Patch-mainline: v5.12-rc1 +References: git-fixes + +A 'irq_dispose_mapping()' call is missing in the remove function. +Add it. + +This is needed to undo the 'irq_of_parse_and_map() call from the probe +function and already part of the error handling path of the probe function. + +It was added in the probe function only in commit d3f620b2c4fe ("fsldma: +simplify IRQ probing and handling") + +Fixes: 77cd62e8082b ("fsldma: allow Freescale Elo DMA driver to be compiled as a module") +Signed-off-by: Christophe JAILLET +Link: https://lore.kernel.org/r/20201212160516.92515-1-christophe.jaillet@wanadoo.fr +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/dma/fsldma.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c +index 0feb323bae1e..554f70a0c18c 100644 +--- a/drivers/dma/fsldma.c ++++ b/drivers/dma/fsldma.c +@@ -1314,6 +1314,7 @@ static int fsldma_of_remove(struct platform_device *op) + if (fdev->chan[i]) + fsl_dma_chan_remove(fdev->chan[i]); + } ++ irq_dispose_mapping(fdev->irq); + + iounmap(fdev->regs); + kfree(fdev); +-- +2.26.2 + diff --git a/patches.suse/dmaengine-hsu-disable-spurious-interrupt.patch b/patches.suse/dmaengine-hsu-disable-spurious-interrupt.patch new file mode 100644 index 0000000..2824487 --- /dev/null +++ b/patches.suse/dmaengine-hsu-disable-spurious-interrupt.patch @@ -0,0 +1,76 @@ +From 035b73b2b3b2e074a56489a7bf84b6a8012c0e0d Mon Sep 17 00:00:00 2001 +From: Ferry Toth +Date: Tue, 12 Jan 2021 23:37:49 +0100 +Subject: [PATCH] dmaengine: hsu: disable spurious interrupt +Git-commit: 035b73b2b3b2e074a56489a7bf84b6a8012c0e0d +Patch-mainline: v5.12-rc1 +References: git-fixes + +On Intel Tangier B0 and Anniedale the interrupt line, disregarding +to have different numbers, is shared between HSU DMA and UART IPs. +Thus on such SoCs we are expecting that IRQ handler is called in +UART driver only. hsu_pci_irq was handling the spurious interrupt +from HSU DMA by returning immediately. This wastes CPU time and +since HSU DMA and HSU UART interrupt occur simultaneously they race +to be handled causing delay to the HSU UART interrupt handling. +Fix this by disabling the interrupt entirely. + +Fixes: 4831e0d9054c ("serial: 8250_mid: handle interrupt correctly in DMA case") +Signed-off-by: Ferry Toth +Reviewed-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20210112223749.97036-1-ftoth@exalondelft.nl +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/dma/hsu/pci.c | 21 +++++++++++---------- + 1 file changed, 11 insertions(+), 10 deletions(-) + +diff --git a/drivers/dma/hsu/pci.c b/drivers/dma/hsu/pci.c +index 07cc7320a614..9045a6f7f589 100644 +--- a/drivers/dma/hsu/pci.c ++++ b/drivers/dma/hsu/pci.c +@@ -26,22 +26,12 @@ + static irqreturn_t hsu_pci_irq(int irq, void *dev) + { + struct hsu_dma_chip *chip = dev; +- struct pci_dev *pdev = to_pci_dev(chip->dev); + u32 dmaisr; + u32 status; + unsigned short i; + int ret = 0; + int err; + +- /* +- * On Intel Tangier B0 and Anniedale the interrupt line, disregarding +- * to have different numbers, is shared between HSU DMA and UART IPs. +- * Thus on such SoCs we are expecting that IRQ handler is called in +- * UART driver only. +- */ +- if (pdev->device == PCI_DEVICE_ID_INTEL_MRFLD_HSU_DMA) +- return IRQ_HANDLED; +- + dmaisr = readl(chip->regs + HSU_PCI_DMAISR); + for (i = 0; i < chip->hsu->nr_channels; i++) { + if (dmaisr & 0x1) { +@@ -105,6 +95,17 @@ static int hsu_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) + if (ret) + goto err_register_irq; + ++ /* ++ * On Intel Tangier B0 and Anniedale the interrupt line, disregarding ++ * to have different numbers, is shared between HSU DMA and UART IPs. ++ * Thus on such SoCs we are expecting that IRQ handler is called in ++ * UART driver only. Instead of handling the spurious interrupt ++ * from HSU DMA here and waste CPU time and delay HSU UART interrupt ++ * handling, disable the interrupt entirely. ++ */ ++ if (pdev->device == PCI_DEVICE_ID_INTEL_MRFLD_HSU_DMA) ++ disable_irq_nosync(chip->irq); ++ + pci_set_drvdata(pdev, chip); + + return 0; +-- +2.26.2 + diff --git a/patches.suse/dmaengine-ioat-Support-in-use-unbind.patch b/patches.suse/dmaengine-ioat-Support-in-use-unbind.patch new file mode 100644 index 0000000..accf0cf --- /dev/null +++ b/patches.suse/dmaengine-ioat-Support-in-use-unbind.patch @@ -0,0 +1,114 @@ +From bf453a0a18b224f1379658245c892fd9e1907580 Mon Sep 17 00:00:00 2001 +From: Logan Gunthorpe +Date: Mon, 16 Dec 2019 12:01:20 -0700 +Subject: [PATCH] dmaengine: ioat: Support in-use unbind +Git-commit: bf453a0a18b224f1379658245c892fd9e1907580 +Patch-mainline: v5.6-rc1 +References: bsc#1182992 + +Don't allocate memory using the devm infrastructure and instead call +kfree with the new dmaengine device_release call back. This ensures +the structures are available until the last reference is dropped. + +We also need to ensure we call ioat_shutdown() in ioat_remove() so +that all the channels are quiesced and further transaction fails. + +Signed-off-by: Logan Gunthorpe +Acked-by: Dave Jiang +Link: https://lore.kernel.org/r/20191216190120.21374-6-logang@deltatee.com +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/dma/ioat/init.c | 38 ++++++++++++++++++++++++++------------ + 1 file changed, 26 insertions(+), 12 deletions(-) + +diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c +index a6a6dc432db8..60e9afbb896c 100644 +--- a/drivers/dma/ioat/init.c ++++ b/drivers/dma/ioat/init.c +@@ -556,10 +556,6 @@ static void ioat_dma_remove(struct ioatdma_device *ioat_dma) + ioat_kobject_del(ioat_dma); + + dma_async_device_unregister(dma); +- +- dma_pool_destroy(ioat_dma->completion_pool); +- +- INIT_LIST_HEAD(&dma->channels); + } + + /** +@@ -589,7 +585,7 @@ static void ioat_enumerate_channels(struct ioatdma_device *ioat_dma) + dev_dbg(dev, "%s: xfercap = %d\n", __func__, 1 << xfercap_log); + + for (i = 0; i < dma->chancnt; i++) { +- ioat_chan = devm_kzalloc(dev, sizeof(*ioat_chan), GFP_KERNEL); ++ ioat_chan = kzalloc(sizeof(*ioat_chan), GFP_KERNEL); + if (!ioat_chan) + break; + +@@ -624,12 +620,16 @@ static void ioat_free_chan_resources(struct dma_chan *c) + return; + + ioat_stop(ioat_chan); +- ioat_reset_hw(ioat_chan); + +- /* Put LTR to idle */ +- if (ioat_dma->version >= IOAT_VER_3_4) +- writeb(IOAT_CHAN_LTR_SWSEL_IDLE, +- ioat_chan->reg_base + IOAT_CHAN_LTR_SWSEL_OFFSET); ++ if (!test_bit(IOAT_CHAN_DOWN, &ioat_chan->state)) { ++ ioat_reset_hw(ioat_chan); ++ ++ /* Put LTR to idle */ ++ if (ioat_dma->version >= IOAT_VER_3_4) ++ writeb(IOAT_CHAN_LTR_SWSEL_IDLE, ++ ioat_chan->reg_base + ++ IOAT_CHAN_LTR_SWSEL_OFFSET); ++ } + + spin_lock_bh(&ioat_chan->cleanup_lock); + spin_lock_bh(&ioat_chan->prep_lock); +@@ -1322,16 +1322,28 @@ static struct pci_driver ioat_pci_driver = { + .err_handler = &ioat_err_handler, + }; + ++static void release_ioatdma(struct dma_device *device) ++{ ++ struct ioatdma_device *d = to_ioatdma_device(device); ++ int i; ++ ++ for (i = 0; i < IOAT_MAX_CHANS; i++) ++ kfree(d->idx[i]); ++ ++ dma_pool_destroy(d->completion_pool); ++ kfree(d); ++} ++ + static struct ioatdma_device * + alloc_ioatdma(struct pci_dev *pdev, void __iomem *iobase) + { +- struct device *dev = &pdev->dev; +- struct ioatdma_device *d = devm_kzalloc(dev, sizeof(*d), GFP_KERNEL); ++ struct ioatdma_device *d = kzalloc(sizeof(*d), GFP_KERNEL); + + if (!d) + return NULL; + d->pdev = pdev; + d->reg_base = iobase; ++ d->dma_dev.device_release = release_ioatdma; + return d; + } + +@@ -1400,6 +1412,8 @@ static void ioat_remove(struct pci_dev *pdev) + if (!device) + return; + ++ ioat_shutdown(pdev); ++ + dev_err(&pdev->dev, "Removing dma and dca services\n"); + if (device->dca) { + unregister_dca_provider(device->dca, &pdev->dev); +-- +2.26.2 + diff --git a/patches.suse/dmaengine-move-.device_release-missing-log-warning-t.patch b/patches.suse/dmaengine-move-.device_release-missing-log-warning-t.patch new file mode 100644 index 0000000..7abd355 --- /dev/null +++ b/patches.suse/dmaengine-move-.device_release-missing-log-warning-t.patch @@ -0,0 +1,38 @@ +From f91da3bd21721c05cc7054156fa993edbb16777a Mon Sep 17 00:00:00 2001 +From: Vinod Koul +Date: Fri, 6 Mar 2020 19:20:18 +0530 +Subject: [PATCH] dmaengine: move .device_release missing log warning to debug level +Git-commit: f91da3bd21721c05cc7054156fa993edbb16777a +Patch-mainline: v5.6 +References: bsc#1182992 + +Dmaengine core warns the drivers registering for missing .device_release +implementation. The warning is accurate for dmaengine controllers which +hotplug but not for rest. + +So reduce this to a debug log. + +Link: https://lore.kernel.org/r/20200306135018.2286959-1-vkoul@kernel.org +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/dma/dmaengine.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c +index c3b1283b6d31..17909fd1820f 100644 +--- a/drivers/dma/dmaengine.c ++++ b/drivers/dma/dmaengine.c +@@ -1151,7 +1151,7 @@ int dma_async_device_register(struct dma_device *device) + } + + if (!device->device_release) +- dev_warn(device->dev, ++ dev_dbg(device->dev, + "WARN: Device release is not defined so it is not safe to unbind this driver while in use\n"); + + kref_init(&device->ref); +-- +2.26.2 + diff --git a/patches.suse/dmaengine-owl-dma-Fix-a-resource-leak-in-the-remove-.patch b/patches.suse/dmaengine-owl-dma-Fix-a-resource-leak-in-the-remove-.patch new file mode 100644 index 0000000..dd0d9be --- /dev/null +++ b/patches.suse/dmaengine-owl-dma-Fix-a-resource-leak-in-the-remove-.patch @@ -0,0 +1,38 @@ +From 1f0a16f04113f9f0ab0c8e6d3abe661edab549e6 Mon Sep 17 00:00:00 2001 +From: Christophe JAILLET +Date: Sat, 12 Dec 2020 17:25:35 +0100 +Subject: [PATCH] dmaengine: owl-dma: Fix a resource leak in the remove function +Git-commit: 1f0a16f04113f9f0ab0c8e6d3abe661edab549e6 +Patch-mainline: v5.12-rc1 +References: git-fixes + +A 'dma_pool_destroy()' call is missing in the remove function. +Add it. + +This call is already made in the error handling path of the probe function. + +Fixes: 47e20577c24d ("dmaengine: Add Actions Semi Owl family S900 DMA driver") +Signed-off-by: Christophe JAILLET +Link: https://lore.kernel.org/r/20201212162535.95727-1-christophe.jaillet@wanadoo.fr +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/dma/owl-dma.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/owl-dma.c b/drivers/dma/owl-dma.c +index 25cbd363e513..1f0bbaed4643 100644 +--- a/drivers/dma/owl-dma.c ++++ b/drivers/dma/owl-dma.c +@@ -1246,6 +1246,7 @@ static int owl_dma_remove(struct platform_device *pdev) + owl_dma_free(od); + + clk_disable_unprepare(od->clk); ++ dma_pool_destroy(od->lli_pool); + + return 0; + } +-- +2.26.2 + diff --git a/patches.suse/docs-filesystems-vfs-correct-flag-name.patch b/patches.suse/docs-filesystems-vfs-correct-flag-name.patch new file mode 100644 index 0000000..9b69e01 --- /dev/null +++ b/patches.suse/docs-filesystems-vfs-correct-flag-name.patch @@ -0,0 +1,35 @@ +From: Julia Lawall +Date: Sun, 26 Jul 2020 20:43:40 +0200 +Subject: docs: filesystems: vfs: correct flag name +Git-commit: cb56ecae4c991947aa1dcf0ff876705ccab2e442 +Patch-mainline: v5.9-rc1 +References: bsc#1182857 + +There is no flag REMAP_CAN_SHORTEN. Commit eca3654e3cc7 ("vfs: enable +remap callers that can handle short operations") that introduces this +text also introduces the flag REMAP_FILE_CAN_SHORTEN. Change the name +in the documentation accordingly. + +Signed-off-by: Julia Lawall +Fixes: eca3654e3cc7 ("vfs: enable remap callers that can handle short operations") +Link: https://lore.kernel.org/r/1595789020-12941-1-git-send-email-Julia.Lawall@inria.fr +Signed-off-by: Jonathan Corbet +Acked-by: Luis Henriques +--- + Documentation/filesystems/vfs.rst | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst +index 57e9b516dae1..ca52c82e5bb5 100644 +--- a/Documentation/filesystems/vfs.rst ++++ b/Documentation/filesystems/vfs.rst +@@ -1116,7 +1116,7 @@ otherwise noted. + before any bytes were remapped. The remap_flags parameter + accepts REMAP_FILE_* flags. If REMAP_FILE_DEDUP is set then the + implementation must only remap if the requested file ranges have +- identical contents. If REMAP_CAN_SHORTEN is set, the caller is ++ identical contents. If REMAP_FILE_CAN_SHORTEN is set, the caller is + ok with the implementation shortening the request length to + satisfy alignment or EOF requirements (or any other reason). + + diff --git a/patches.suse/drivers-misc-vmw_vmci-restrict-too-big-queue-size-in.patch b/patches.suse/drivers-misc-vmw_vmci-restrict-too-big-queue-size-in.patch new file mode 100644 index 0000000..2614d67 --- /dev/null +++ b/patches.suse/drivers-misc-vmw_vmci-restrict-too-big-queue-size-in.patch @@ -0,0 +1,56 @@ +From 2fd10bcf0310b9525b2af9e1f7aa9ddd87c3772e Mon Sep 17 00:00:00 2001 +From: Sabyrzhan Tasbolatov +Date: Tue, 9 Feb 2021 16:26:12 +0600 +Subject: [PATCH] drivers/misc/vmw_vmci: restrict too big queue size in qp_host_alloc_queue +Git-commit: 2fd10bcf0310b9525b2af9e1f7aa9ddd87c3772e +Patch-mainline: v5.12-rc1 +References: git-fixes + +syzbot found WARNING in qp_broker_alloc[1] in qp_host_alloc_queue() +when num_pages is 0x100001, giving queue_size + queue_page_size +bigger than KMALLOC_MAX_SIZE for kzalloc(), resulting order >= MAX_ORDER +condition. + +queue_size + queue_page_size=0x8000d8, where KMALLOC_MAX_SIZE=0x400000. + +[1] +Call Trace: + alloc_pages include/linux/gfp.h:547 [inline] + kmalloc_order+0x40/0x130 mm/slab_common.c:837 + kmalloc_order_trace+0x15/0x70 mm/slab_common.c:853 + kmalloc_large include/linux/slab.h:481 [inline] + __kmalloc+0x257/0x330 mm/slub.c:3959 + kmalloc include/linux/slab.h:557 [inline] + kzalloc include/linux/slab.h:682 [inline] + qp_host_alloc_queue drivers/misc/vmw_vmci/vmci_queue_pair.c:540 [inline] + qp_broker_create drivers/misc/vmw_vmci/vmci_queue_pair.c:1351 [inline] + qp_broker_alloc+0x936/0x2740 drivers/misc/vmw_vmci/vmci_queue_pair.c:1739 + +Reported-by: syzbot+15ec7391f3d6a1a7cc7d@syzkaller.appspotmail.com +Signed-off-by: Sabyrzhan Tasbolatov +Link: https://lore.kernel.org/r/20210209102612.2112247-1-snovitoll@gmail.com +Cc: stable +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/misc/vmw_vmci/vmci_queue_pair.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c +index d787ddecee77..880c33ab9f47 100644 +--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c ++++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c +@@ -539,6 +539,9 @@ static struct vmci_queue *qp_host_alloc_queue(u64 size) + + queue_page_size = num_pages * sizeof(*queue->kernel_if->u.h.page); + ++ if (queue_size + queue_page_size > KMALLOC_MAX_SIZE) ++ return NULL; ++ + queue = kzalloc(queue_size + queue_page_size, GFP_KERNEL); + if (queue) { + queue->q_header = NULL; +-- +2.26.2 + diff --git a/patches.suse/drivers-net-davinci_mdio-fix-potential-NULL-derefere.patch b/patches.suse/drivers-net-davinci_mdio-fix-potential-NULL-derefere.patch new file mode 100644 index 0000000..8fcedd7 --- /dev/null +++ b/patches.suse/drivers-net-davinci_mdio-fix-potential-NULL-derefere.patch @@ -0,0 +1,50 @@ +From b89abd103c2059c7cea94ce2630507c3e224a08f Mon Sep 17 00:00:00 2001 +From: Wei Yongjun +Date: Wed, 29 Apr 2020 02:52:20 +0000 +Subject: [PATCH 6/9] drivers: net: davinci_mdio: fix potential NULL + dereference in davinci_mdio_probe() +Git-commit: e00edb4efbbc07425441a3be2aa87abaf5800d96 +Patch-mainline: v5.8-rc1 +References: git-fixes + +platform_get_resource() may fail and return NULL, so we should +better check it's return value to avoid a NULL pointer dereference +since devm_ioremap() does not check input parameters for null. + +This is detected by Coccinelle semantic patch. + +@@ +expression pdev, res, n, t, e, e1, e2; +@@ + +res = \(platform_get_resource\|platform_get_resource_byname\)(pdev, t, n); ++ if (!res) ++ return -EINVAL; +... when != res == NULL +e = devm_ioremap(e1, res->start, e2); + +Fixes: 03f66f067560 ("net: ethernet: ti: davinci_mdio: use devm_ioremap()") +Signed-off-by: Wei Yongjun +Reviewed-by: Grygorii Strashko +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/ti/davinci_mdio.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c +index 38b7f6d35759..702fdc393da0 100644 +--- a/drivers/net/ethernet/ti/davinci_mdio.c ++++ b/drivers/net/ethernet/ti/davinci_mdio.c +@@ -397,6 +397,8 @@ static int davinci_mdio_probe(struct platform_device *pdev) + data->dev = dev; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!res) ++ return -EINVAL; + data->regs = devm_ioremap(dev, res->start, resource_size(res)); + if (!data->regs) + return -ENOMEM; +-- +2.16.4 + diff --git a/patches.suse/drm-amd-display-Add-FPU-wrappers-to-dcn21_validate_b.patch b/patches.suse/drm-amd-display-Add-FPU-wrappers-to-dcn21_validate_b.patch new file mode 100644 index 0000000..ed55497 --- /dev/null +++ b/patches.suse/drm-amd-display-Add-FPU-wrappers-to-dcn21_validate_b.patch @@ -0,0 +1,79 @@ +From 41401ac67791810dd880345962339aa1bedd3c0d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jan=20Kokem=C3=BCller?= +Date: Thu, 11 Feb 2021 19:28:43 +0100 +Subject: [PATCH] drm/amd/display: Add FPU wrappers to dcn21_validate_bandwidth() +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 41401ac67791810dd880345962339aa1bedd3c0d +Patch-mainline: v5.12-rc1 +References: git-fixes + +dcn21_validate_bandwidth() calls functions that use floating point math. +On my machine this sometimes results in simd exceptions when there are +other FPU users such as KVM virtual machines running. The screen freezes +completely in this case. + +Wrapping the function with DC_FP_START()/DC_FP_END() seems to solve the +problem. This mirrors the approach used for dcn20_validate_bandwidth. + +Tested on a AMD Ryzen 7 PRO 4750U (Renoir). + +Bug: https://bugzilla.kernel.org/show_bug.cgi?id=206987 +Signed-off-by: Jan Kokemüller +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 2 - + drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 20 ++++++++++++++++-- + 2 files changed, 19 insertions(+), 3 deletions(-) + +--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +@@ -3248,7 +3248,7 @@ restore_dml_state: + bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context, + bool fast_validate) + { +- bool voltage_supported = false; ++ bool voltage_supported; + DC_FP_START(); + voltage_supported = dcn20_validate_bandwidth_fp(dc, context, fast_validate); + DC_FP_END(); +--- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +@@ -1171,8 +1171,8 @@ void dcn21_calculate_wm( + } + + +-bool dcn21_validate_bandwidth(struct dc *dc, struct dc_state *context, +- bool fast_validate) ++static noinline bool dcn21_validate_bandwidth_fp(struct dc *dc, ++ struct dc_state *context, bool fast_validate) + { + bool out = false; + +@@ -1225,6 +1225,22 @@ validate_out: + + return out; + } ++ ++/* ++ * Some of the functions further below use the FPU, so we need to wrap this ++ * with DC_FP_START()/DC_FP_END(). Use the same approach as for ++ * dcn20_validate_bandwidth in dcn20_resource.c. ++ */ ++bool dcn21_validate_bandwidth(struct dc *dc, struct dc_state *context, ++ bool fast_validate) ++{ ++ bool voltage_supported; ++ DC_FP_START(); ++ voltage_supported = dcn21_validate_bandwidth_fp(dc, context, fast_validate); ++ DC_FP_END(); ++ return voltage_supported; ++} ++ + static void dcn21_destroy_resource_pool(struct resource_pool **pool) + { + struct dcn21_resource_pool *dcn21_pool = TO_DCN21_RES_POOL(*pool); diff --git a/patches.suse/drm-amd-display-Add-a-backlight-module-option.patch b/patches.suse/drm-amd-display-Add-a-backlight-module-option.patch new file mode 100644 index 0000000..cb43bc2 --- /dev/null +++ b/patches.suse/drm-amd-display-Add-a-backlight-module-option.patch @@ -0,0 +1,73 @@ +From 00b493aca016eadbc9ba8f1d4e4f24adf7ee61dc Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 4 Mar 2021 12:41:03 -0500 +Subject: [PATCH 4/4] drm/amd/display: Add a backlight module option +References: bsc#1180749 +Patch-mainline: Submitted, amd-gfx ML + +There seem devices that don't work with the aux channel backlight +control. For allowing such users to test with the other backlight +control method, provide a new module option, aux_backlight, to specify +enabling or disabling the aux backport support explicitly. As +default, the aux support is detected by the hardware capability. + +V2: make the backlight option generic in case we add future +backlight types (Alex) + +Buglink: https://bugzilla.opensuse.org/show_bug.cgi?id=1180749 +Buglink: https://gitlab.freedesktop.org/drm/amd/-/issues/1438 +Signed-off-by: Takashi Iwai +Signed-off-by: Alex Deucher + +--- + drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +++++ + 3 files changed, 10 insertions(+) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h +index b6879d97c9c9..49267eb64302 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h +@@ -180,6 +180,7 @@ extern uint amdgpu_smu_memory_pool_size; + extern uint amdgpu_dc_feature_mask; + extern uint amdgpu_dc_debug_mask; + extern uint amdgpu_dm_abm_level; ++extern int amdgpu_backlight; + extern struct amdgpu_mgpu_info mgpu_info; + extern int amdgpu_ras_enable; + extern uint amdgpu_ras_mask; +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +index 4575192d9b08..b26e2fd1c538 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +@@ -781,6 +781,10 @@ uint amdgpu_dm_abm_level; + MODULE_PARM_DESC(abmlevel, "ABM level (0 = off (default), 1-4 = backlight reduction level) "); + module_param_named(abmlevel, amdgpu_dm_abm_level, uint, 0444); + ++int amdgpu_backlight = -1; ++MODULE_PARM_DESC(backlight, "Backlight control (0 = pwm, 1 = aux, -1 auto (default))"); ++module_param_named(backlight, amdgpu_backlight, bint, 0444); ++ + /** + * DOC: tmz (int) + * Trusted Memory Zone (TMZ) is a method to protect data being written +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +index 0bc9a06b3f15..0523be612a48 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -2267,6 +2267,11 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector) + caps->ext_caps->bits.hdr_aux_backlight_control == 1) + caps->aux_support = true; + ++ if (amdgpu_backlight == 0) ++ caps->aux_support = false; ++ else if (amdgpu_backlight == 1) ++ caps->aux_support = true; ++ + /* From the specification (CTA-861-G), for calculating the maximum + * luminance we need to use: + * Luminance = 50*2**(CV/32) +-- +2.26.2 + diff --git a/patches.suse/drm-amd-display-Add-vupdate_no_lock-interrupts-for-D.patch b/patches.suse/drm-amd-display-Add-vupdate_no_lock-interrupts-for-D.patch new file mode 100644 index 0000000..3f1bc02 --- /dev/null +++ b/patches.suse/drm-amd-display-Add-vupdate_no_lock-interrupts-for-D.patch @@ -0,0 +1,77 @@ +From 688f97ed3f5e339c0c2c09d9ee7ff23d5807b0a7 Mon Sep 17 00:00:00 2001 +From: Rodrigo Siqueira +Date: Fri, 5 Feb 2021 14:15:11 -0500 +Subject: [PATCH] drm/amd/display: Add vupdate_no_lock interrupts for DCN2.1 +Git-commit: 688f97ed3f5e339c0c2c09d9ee7ff23d5807b0a7 +Patch-mainline: v5.12-rc1 +References: git-fixes + +When run igt@kms_vrr in a device that uses DCN2.1 architecture, we +noticed multiple failures. Furthermore, when we tested a VRR demo, we +noticed a system hang where the mouse pointer still works, but the +entire system freezes; in this case, we don't see any dmesg warning or +failure messages kernel. This happens due to a lack of vupdate_no_lock +interrupt, making the userspace wait eternally to get the event back. +For fixing this issue, we need to add the vupdate_no_lock interrupt in +the interrupt list. + +Signed-off-by: Rodrigo Siqueira +Acked-by: Bindu Ramamurthy +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Acked-by: Takashi Iwai + +--- + .../display/dc/irq/dcn21/irq_service_dcn21.c | 22 +++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c b/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c +index 1b971265418b..0e0f494fbb5e 100644 +--- a/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c ++++ b/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c +@@ -168,6 +168,11 @@ static const struct irq_source_info_funcs vblank_irq_info_funcs = { + .ack = NULL + }; + ++static const struct irq_source_info_funcs vupdate_no_lock_irq_info_funcs = { ++ .set = NULL, ++ .ack = NULL ++}; ++ + #undef BASE_INNER + #define BASE_INNER(seg) DMU_BASE__INST0_SEG ## seg + +@@ -230,6 +235,17 @@ static const struct irq_source_info_funcs vblank_irq_info_funcs = { + .funcs = &vblank_irq_info_funcs\ + } + ++/* vupdate_no_lock_int_entry maps to DC_IRQ_SOURCE_VUPDATEx, to match semantic ++ * of DCE's DC_IRQ_SOURCE_VUPDATEx. ++ */ ++#define vupdate_no_lock_int_entry(reg_num)\ ++ [DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\ ++ IRQ_REG_ENTRY(OTG, reg_num,\ ++ OTG_GLOBAL_SYNC_STATUS, VUPDATE_NO_LOCK_INT_EN,\ ++ OTG_GLOBAL_SYNC_STATUS, VUPDATE_NO_LOCK_EVENT_CLEAR),\ ++ .funcs = &vupdate_no_lock_irq_info_funcs\ ++ } ++ + #define vblank_int_entry(reg_num)\ + [DC_IRQ_SOURCE_VBLANK1 + reg_num] = {\ + IRQ_REG_ENTRY(OTG, reg_num,\ +@@ -338,6 +354,12 @@ irq_source_info_dcn21[DAL_IRQ_SOURCES_NUMBER] = { + vupdate_int_entry(3), + vupdate_int_entry(4), + vupdate_int_entry(5), ++ vupdate_no_lock_int_entry(0), ++ vupdate_no_lock_int_entry(1), ++ vupdate_no_lock_int_entry(2), ++ vupdate_no_lock_int_entry(3), ++ vupdate_no_lock_int_entry(4), ++ vupdate_no_lock_int_entry(5), + vblank_int_entry(0), + vblank_int_entry(1), + vblank_int_entry(2), +-- +2.26.2 + diff --git a/patches.suse/drm-amd-display-Remove-Assert-from-dcn10_get_dig_fro.patch b/patches.suse/drm-amd-display-Remove-Assert-from-dcn10_get_dig_fro.patch new file mode 100644 index 0000000..3d201f1 --- /dev/null +++ b/patches.suse/drm-amd-display-Remove-Assert-from-dcn10_get_dig_fro.patch @@ -0,0 +1,57 @@ +From 83e6667b675f101fb66659dfa72e45d08773d763 Mon Sep 17 00:00:00 2001 +From: Eric Bernstein +Date: Fri, 5 Feb 2021 13:53:31 -0500 +Subject: [PATCH] drm/amd/display: Remove Assert from dcn10_get_dig_frontend +Git-commit: 83e6667b675f101fb66659dfa72e45d08773d763 +Patch-mainline: v5.12-rc1 +References: git-fixes + +[Why] +In some cases, this function is called when DIG BE is not +connected to DIG FE, in which case a value of zero isn't +invalid and assert should not be hit. + +[How] +Remove assert and handle ENGINE_ID_UNKNOWN result in calling +function. + +Signed-off-by: Eric Bernstein +Acked-by: Bindu Ramamurthy +Tested-by: Daniel Wheeler +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c | 1 - + drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 2 ++ + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c +index 59024653430c..e4701825b5a0 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c +@@ -480,7 +480,6 @@ unsigned int dcn10_get_dig_frontend(struct link_encoder *enc) + break; + default: + // invalid source select DIG +- ASSERT(false); + result = ENGINE_ID_UNKNOWN; + } + +diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +index 9620fb8a27dc..06dc1e2e8383 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +@@ -539,6 +539,8 @@ void dcn30_init_hw(struct dc *dc) + + fe = dc->links[i]->link_enc->funcs->get_dig_frontend( + dc->links[i]->link_enc); ++ if (fe == ENGINE_ID_UNKNOWN) ++ continue; + + for (j = 0; j < dc->res_pool->stream_enc_count; j++) { + if (fe == dc->res_pool->stream_enc[j]->id) { +-- +2.26.2 + diff --git a/patches.suse/drm-amdgpu-Set-reference-clock-to-100Mhz-on-Renoir-v.patch b/patches.suse/drm-amdgpu-Set-reference-clock-to-100Mhz-on-Renoir-v.patch new file mode 100644 index 0000000..cf6c1f0 --- /dev/null +++ b/patches.suse/drm-amdgpu-Set-reference-clock-to-100Mhz-on-Renoir-v.patch @@ -0,0 +1,42 @@ +From 6e80fb8ab04f6c4f377e2fd422bdd1855beb7371 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Tue, 16 Feb 2021 10:57:00 -0500 +Subject: [PATCH] drm/amdgpu: Set reference clock to 100Mhz on Renoir (v2) +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 6e80fb8ab04f6c4f377e2fd422bdd1855beb7371 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Fixes the rlc reference clock used for GPU timestamps. +Value is 100Mhz. Confirmed with hardware team. + +V2: reword commit message. + +Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1480 +Acked-by: Christian König +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/amd/amdgpu/soc15.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c +index e865495d3ead..1221aa6b40a9 100644 +--- a/drivers/gpu/drm/amd/amdgpu/soc15.c ++++ b/drivers/gpu/drm/amd/amdgpu/soc15.c +@@ -233,6 +233,8 @@ static u32 soc15_get_xclk(struct amdgpu_device *adev) + { + u32 reference_clock = adev->clock.spll.reference_freq; + ++ if (adev->asic_type == CHIP_RENOIR) ++ return 10000; + if (adev->asic_type == CHIP_RAVEN) + return reference_clock / 4; + +-- +2.26.2 + diff --git a/patches.suse/drm-amdgpu-disable-DCN-and-VCN-for-Navi14-0x7340-C9-.patch b/patches.suse/drm-amdgpu-disable-DCN-and-VCN-for-Navi14-0x7340-C9-.patch new file mode 100644 index 0000000..df4c7dd --- /dev/null +++ b/patches.suse/drm-amdgpu-disable-DCN-and-VCN-for-Navi14-0x7340-C9-.patch @@ -0,0 +1,38 @@ +From dd657888e00ebc9a3f7a98fe155dcc597939a358 Mon Sep 17 00:00:00 2001 +From: Flora Cui +Date: Tue, 27 Oct 2020 14:58:19 +0800 +Subject: [PATCH] drm/amdgpu: disable DCN and VCN for Navi14 0x7340/C9 SKU +Git-commit: dd657888e00ebc9a3f7a98fe155dcc597939a358 +Patch-mainline: v5.11-rc1 +References: git-fixes + +Navi14 0x7340/C9 SKU has no display and video support, remove them. + +Signed-off-by: Flora Cui +Reviewed-by: Guchun Chen +Signed-off-by: Alex Deucher +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/amd/amdgpu/nv.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c +index b7fc9ebdf1c1..23446aceea1d 100644 +--- a/drivers/gpu/drm/amd/amdgpu/nv.c ++++ b/drivers/gpu/drm/amd/amdgpu/nv.c +@@ -495,8 +495,9 @@ void nv_set_virt_ops(struct amdgpu_device *adev) + + static bool nv_is_blockchain_sku(struct pci_dev *pdev) + { +- if (pdev->device == 0x731E && +- (pdev->revision == 0xC6 || pdev->revision == 0xC7)) ++ if ((pdev->device == 0x731E && ++ (pdev->revision == 0xC6 || pdev->revision == 0xC7)) || ++ (pdev->device == 0x7340 && pdev->revision == 0xC9)) + return true; + return false; + } +-- +2.26.2 + diff --git a/patches.suse/drm-amdgpu-disable-VCN-for-Navi12-SKU.patch b/patches.suse/drm-amdgpu-disable-VCN-for-Navi12-SKU.patch new file mode 100644 index 0000000..3438212 --- /dev/null +++ b/patches.suse/drm-amdgpu-disable-VCN-for-Navi12-SKU.patch @@ -0,0 +1,47 @@ +From 0c61ac8134ffc851681ce5d4bd60d97c3d5aed27 Mon Sep 17 00:00:00 2001 +From: "Asher.Song" +Date: Wed, 24 Feb 2021 18:41:34 +0800 +Subject: [PATCH] drm/amdgpu:disable VCN for Navi12 SKU +Git-commit: 0c61ac8134ffc851681ce5d4bd60d97c3d5aed27 +Patch-mainline: v5.12-rc2 +References: git-fixes + +Navi12 0x7360/C7 SKU has no video support, so remove it. + +Reviewed-by: Guchun Chen +Signed-off-by: Asher.Song +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/amd/amdgpu/nv.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c +index 160fa5f59805..c625c5d8ed89 100644 +--- a/drivers/gpu/drm/amd/amdgpu/nv.c ++++ b/drivers/gpu/drm/amd/amdgpu/nv.c +@@ -558,7 +558,8 @@ static bool nv_is_headless_sku(struct pci_dev *pdev) + { + if ((pdev->device == 0x731E && + (pdev->revision == 0xC6 || pdev->revision == 0xC7)) || +- (pdev->device == 0x7340 && pdev->revision == 0xC9)) ++ (pdev->device == 0x7340 && pdev->revision == 0xC9) || ++ (pdev->device == 0x7360 && pdev->revision == 0xC7)) + return true; + return false; + } +@@ -634,7 +635,8 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) + if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT && + !amdgpu_sriov_vf(adev)) + amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block); +- amdgpu_device_ip_block_add(adev, &vcn_v2_0_ip_block); ++ if (!nv_is_headless_sku(adev->pdev)) ++ amdgpu_device_ip_block_add(adev, &vcn_v2_0_ip_block); + if (!amdgpu_sriov_vf(adev)) + amdgpu_device_ip_block_add(adev, &jpeg_v2_0_ip_block); + break; +-- +2.26.2 + diff --git a/patches.suse/drm-amdgpu-display-don-t-assert-in-set-backlight-fun.patch b/patches.suse/drm-amdgpu-display-don-t-assert-in-set-backlight-fun.patch new file mode 100644 index 0000000..0c72cad --- /dev/null +++ b/patches.suse/drm-amdgpu-display-don-t-assert-in-set-backlight-fun.patch @@ -0,0 +1,32 @@ +From dd7e3903c892fab20db204eaba8e8aebe42329f4 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Thu, 4 Mar 2021 12:41:01 -0500 +Subject: [PATCH 2/4] drm/amdgpu/display: don't assert in set backlight + function +References: bsc#1180749 +Patch-mainline: Submitted, amd-gfx ML + +It just spams the logs. + +Signed-off-by: Alex Deucher +Signed-off-by: Takashi Iwai + +--- + drivers/gpu/drm/amd/display/dc/core/dc_link.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c +index fa5059f71727..bd0101013ec8 100644 +--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c ++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c +@@ -2602,7 +2602,6 @@ bool dc_link_set_backlight_level(const struct dc_link *link, + if (pipe_ctx->plane_state == NULL) + frame_ramp = 0; + } else { +- ASSERT(false); + return false; + } + +-- +2.26.2 + diff --git a/patches.suse/drm-amdgpu-display-handle-aux-backlight-in-backlight.patch b/patches.suse/drm-amdgpu-display-handle-aux-backlight-in-backlight.patch new file mode 100644 index 0000000..594e2aa --- /dev/null +++ b/patches.suse/drm-amdgpu-display-handle-aux-backlight-in-backlight.patch @@ -0,0 +1,56 @@ +From cbbc3435fa06d156db6e7f451ef8ef1f51270552 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Thu, 4 Mar 2021 12:41:02 -0500 +Subject: [PATCH 3/4] drm/amdgpu/display: handle aux backlight in + backlight_get_brightness +References: bsc#1180749 +Patch-mainline: Submitted, amd-gfx ML + +Need to fetch it via aux. + +Signed-off-by: Alex Deucher +Signed-off-by: Takashi Iwai + +--- + .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 24 +++++++++++++++---- + 1 file changed, 20 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +index 78720a25c13f..0bc9a06b3f15 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -3258,11 +3258,27 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd) + static int amdgpu_dm_backlight_get_brightness(struct backlight_device *bd) + { + struct amdgpu_display_manager *dm = bl_get_data(bd); +- int ret = dc_link_get_backlight_level(dm->backlight_link); ++ struct amdgpu_dm_backlight_caps caps; ++ ++ amdgpu_dm_update_backlight_caps(dm); ++ caps = dm->backlight_caps; + +- if (ret == DC_ERROR_UNEXPECTED) +- return bd->props.brightness; +- return convert_brightness_to_user(&dm->backlight_caps, ret); ++ if (caps.aux_support) { ++ struct dc_link *link = (struct dc_link *)dm->backlight_link; ++ u32 avg, peak; ++ bool rc; ++ ++ rc = dc_link_get_backlight_level_nits(link, &avg, &peak); ++ if (!rc) ++ return bd->props.brightness; ++ return convert_brightness_to_user(&caps, avg); ++ } else { ++ int ret = dc_link_get_backlight_level(dm->backlight_link); ++ ++ if (ret == DC_ERROR_UNEXPECTED) ++ return bd->props.brightness; ++ return convert_brightness_to_user(&caps, ret); ++ } + } + + static const struct backlight_ops amdgpu_dm_backlight_ops = { +-- +2.26.2 + diff --git a/patches.suse/drm-amdgpu-display-simplify-backlight-setting.patch b/patches.suse/drm-amdgpu-display-simplify-backlight-setting.patch new file mode 100644 index 0000000..eb2b304 --- /dev/null +++ b/patches.suse/drm-amdgpu-display-simplify-backlight-setting.patch @@ -0,0 +1,57 @@ +From c80a0581e0a6d4f539e94488751334fa1113cf31 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Thu, 4 Mar 2021 12:41:00 -0500 +Subject: [PATCH 1/4] drm/amdgpu/display: simplify backlight setting +References: bsc#1180749 +Patch-mainline: Submitted, amd-gfx ML + +Avoid the extra wrapper function. + +Signed-off-by: Alex Deucher +Signed-off-by: Takashi Iwai + +--- + .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 20 ++++--------------- + 1 file changed, 4 insertions(+), 16 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +index 3e1fd1e7d09f..78720a25c13f 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -3185,19 +3185,6 @@ static void amdgpu_dm_update_backlight_caps(struct amdgpu_display_manager *dm) + #endif + } + +-static int set_backlight_via_aux(struct dc_link *link, uint32_t brightness) +-{ +- bool rc; +- +- if (!link) +- return 1; +- +- rc = dc_link_set_backlight_level_nits(link, true, brightness, +- AUX_BL_DEFAULT_TRANSITION_TIME_MS); +- +- return rc ? 0 : 1; +-} +- + static int get_brightness_range(const struct amdgpu_dm_backlight_caps *caps, + unsigned *min, unsigned *max) + { +@@ -3260,9 +3247,10 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd) + brightness = convert_brightness_from_user(&caps, bd->props.brightness); + // Change brightness based on AUX property + if (caps.aux_support) +- return set_backlight_via_aux(link, brightness); +- +- rc = dc_link_set_backlight_level(dm->backlight_link, brightness, 0); ++ rc = dc_link_set_backlight_level_nits(link, true, brightness, ++ AUX_BL_DEFAULT_TRANSITION_TIME_MS); ++ else ++ rc = dc_link_set_backlight_level(dm->backlight_link, brightness, 0); + + return rc ? 0 : 1; + } +-- +2.26.2 + diff --git a/patches.suse/drm-amdgpu-enable-DCN-for-navi10-headless-SKU.patch b/patches.suse/drm-amdgpu-enable-DCN-for-navi10-headless-SKU.patch new file mode 100644 index 0000000..d62d95e --- /dev/null +++ b/patches.suse/drm-amdgpu-enable-DCN-for-navi10-headless-SKU.patch @@ -0,0 +1,42 @@ +From 8301f6b990ada8f5e9b23ed7d4a0d60b00d49238 Mon Sep 17 00:00:00 2001 +From: "Tianci.Yin" +Date: Fri, 6 Nov 2020 14:56:35 +0800 +Subject: [PATCH] drm/amdgpu: enable DCN for navi10 headless SKU +Git-commit: 8301f6b990ada8f5e9b23ed7d4a0d60b00d49238 +Patch-mainline: v5.11-rc1 +References: git-fixes + +There is a NULL pointer crash when DCN disabled on headless SKU. +On normal SKU, the variable adev->ddev.mode_config.funcs is +initialized in dm_hw_init(), and it is fine to access it in +amdgpu_device_resume(). But on headless SKU, DCN is disabled, +the funcs variable is not initialized, then crash arises. +Enable DCN to fix this issue. + +Reviewed-by: Alex Deucher +Reviewed-by: Guchun Chen +Signed-off-by: Tianci.Yin +Signed-off-by: Alex Deucher +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/amd/amdgpu/nv.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c +index e33d8022cc32..67375b2948f5 100644 +--- a/drivers/gpu/drm/amd/amdgpu/nv.c ++++ b/drivers/gpu/drm/amd/amdgpu/nv.c +@@ -535,8 +535,7 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) + if (adev->enable_virtual_display || amdgpu_sriov_vf(adev)) + amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block); + #if defined(CONFIG_DRM_AMD_DC) +- else if (amdgpu_device_has_dc_support(adev) && +- !nv_is_headless_sku(adev->pdev)) ++ else if (amdgpu_device_has_dc_support(adev)) + amdgpu_device_ip_block_add(adev, &dm_ip_block); + #endif + amdgpu_device_ip_block_add(adev, &gfx_v10_0_ip_block); +-- +2.26.2 + diff --git a/patches.suse/drm-amdgpu-rename-nv_is_headless_sku.patch b/patches.suse/drm-amdgpu-rename-nv_is_headless_sku.patch new file mode 100644 index 0000000..518b595 --- /dev/null +++ b/patches.suse/drm-amdgpu-rename-nv_is_headless_sku.patch @@ -0,0 +1,53 @@ +From 9c94b5ef75b5e5144829cd4e74ba55771613b71f Mon Sep 17 00:00:00 2001 +From: Flora Cui +Date: Wed, 28 Oct 2020 14:04:29 +0800 +Subject: [PATCH] drm/amdgpu: rename nv_is_headless_sku() +Git-commit: 9c94b5ef75b5e5144829cd4e74ba55771613b71f +Patch-mainline: v5.11-rc1 +References: git-fixes + +for headless NAVI ASICs + +Signed-off-by: Flora Cui +Reviewed-by: Guchun Chen +Signed-off-by: Alex Deucher +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/amd/amdgpu/nv.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c +index 23446aceea1d..c65b4462bf5e 100644 +--- a/drivers/gpu/drm/amd/amdgpu/nv.c ++++ b/drivers/gpu/drm/amd/amdgpu/nv.c +@@ -493,7 +493,7 @@ void nv_set_virt_ops(struct amdgpu_device *adev) + adev->virt.ops = &xgpu_nv_virt_ops; + } + +-static bool nv_is_blockchain_sku(struct pci_dev *pdev) ++static bool nv_is_headless_sku(struct pci_dev *pdev) + { + if ((pdev->device == 0x731E && + (pdev->revision == 0xC6 || pdev->revision == 0xC7)) || +@@ -536,7 +536,7 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) + amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block); + #if defined(CONFIG_DRM_AMD_DC) + else if (amdgpu_device_has_dc_support(adev) && +- !nv_is_blockchain_sku(adev->pdev)) ++ !nv_is_headless_sku(adev->pdev)) + amdgpu_device_ip_block_add(adev, &dm_ip_block); + #endif + amdgpu_device_ip_block_add(adev, &gfx_v10_0_ip_block); +@@ -544,7 +544,7 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) + if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT && + !amdgpu_sriov_vf(adev)) + amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block); +- if (!nv_is_blockchain_sku(adev->pdev)) ++ if (!nv_is_headless_sku(adev->pdev)) + amdgpu_device_ip_block_add(adev, &vcn_v2_0_ip_block); + amdgpu_device_ip_block_add(adev, &jpeg_v2_0_ip_block); + if (adev->enable_mes) +-- +2.26.2 + diff --git a/patches.suse/drm-amdkfd-Fix-recursive-lock-warnings.patch b/patches.suse/drm-amdkfd-Fix-recursive-lock-warnings.patch new file mode 100644 index 0000000..f0b38e0 --- /dev/null +++ b/patches.suse/drm-amdkfd-Fix-recursive-lock-warnings.patch @@ -0,0 +1,45 @@ +From 1fb8b1fc4dd1035a264c81d15d41f05884cc8058 Mon Sep 17 00:00:00 2001 +From: Felix Kuehling +Date: Thu, 4 Feb 2021 00:11:17 -0500 +Subject: [PATCH] drm/amdkfd: Fix recursive lock warnings +Git-commit: 1fb8b1fc4dd1035a264c81d15d41f05884cc8058 +Patch-mainline: v5.12-rc1 +References: git-fixes + +memalloc_nofs_save/restore are no longer sufficient to prevent recursive +lock warnings when holding locks that can be taken in MMU notifiers. Use +memalloc_noreclaim_save/restore instead. + +Fixes: f920e413ff9c ("mm: track mmu notifiers in fs_reclaim_acquire/release") +Cc: Daniel Vetter +Reviewed-by: Philip Yang +Signed-off-by: Felix Kuehling +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org # 5.10.x +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +index 16262e5d93f5..7351dd195274 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +@@ -243,11 +243,11 @@ get_sh_mem_bases_nybble_64(struct kfd_process_device *pdd) + static inline void dqm_lock(struct device_queue_manager *dqm) + { + mutex_lock(&dqm->lock_hidden); +- dqm->saved_flags = memalloc_nofs_save(); ++ dqm->saved_flags = memalloc_noreclaim_save(); + } + static inline void dqm_unlock(struct device_queue_manager *dqm) + { +- memalloc_nofs_restore(dqm->saved_flags); ++ memalloc_noreclaim_restore(dqm->saved_flags); + mutex_unlock(&dqm->lock_hidden); + } + +-- +2.26.2 + diff --git a/patches.suse/drm-i915-Reject-446-480MHz-HDMI-clock-on-GLK.patch b/patches.suse/drm-i915-Reject-446-480MHz-HDMI-clock-on-GLK.patch new file mode 100644 index 0000000..ec3e874 --- /dev/null +++ b/patches.suse/drm-i915-Reject-446-480MHz-HDMI-clock-on-GLK.patch @@ -0,0 +1,48 @@ +From 7a6c6243b44a439bda4bf099032be35ebcf53406 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= +Date: Wed, 3 Feb 2021 11:30:44 +0200 +Subject: [PATCH] drm/i915: Reject 446-480MHz HDMI clock on GLK +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 7a6c6243b44a439bda4bf099032be35ebcf53406 +Patch-mainline: v5.12-rc1 +No-fix: 41751b3e5c1ac656a86f8d45a8891115281b729e +References: git-fixes + +The BXT/GLK DPLL can't generate certain frequencies. We already +reject the 233-240MHz range on both. But on GLK the DPLL max +frequency was bumped from 300MHz to 594MHz, so now we get to +also worry about the 446-480MHz range (double the original +problem range). Reject any frequency within the higher +problematic range as well. + +Cc: stable@vger.kernel.org +Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/3000 +Signed-off-by: Ville Syrjälä +Link: https://patchwork.freedesktop.org/patch/msgid/20210203093044.30532-1-ville.syrjala@linux.intel.com +Reviewed-by: Mika Kahola +(cherry picked from commit 41751b3e5c1ac656a86f8d45a8891115281b729e) + +Signed-off-by: Rodrigo Vivi +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/i915/display/intel_hdmi.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/i915/display/intel_hdmi.c ++++ b/drivers/gpu/drm/i915/display/intel_hdmi.c +@@ -2210,7 +2210,11 @@ hdmi_port_clock_valid(struct intel_hdmi + has_hdmi_sink)) + return MODE_CLOCK_HIGH; + +- /* BXT DPLL can't generate 223-240 MHz */ ++ /* GLK DPLL can't generate 446-480 MHz */ ++ if (IS_GEMINILAKE(dev_priv) && clock > 446666 && clock < 480000) ++ return MODE_CLOCK_RANGE; ++ ++ /* BXT/GLK DPLL can't generate 223-240 MHz */ + if (IS_GEN9_LP(dev_priv) && clock > 223333 && clock < 240000) + return MODE_CLOCK_RANGE; + diff --git a/patches.suse/drm-modes-Switch-to-64bit-maths-to-avoid-integer-ove.patch b/patches.suse/drm-modes-Switch-to-64bit-maths-to-avoid-integer-ove.patch new file mode 100644 index 0000000..4997f4c --- /dev/null +++ b/patches.suse/drm-modes-Switch-to-64bit-maths-to-avoid-integer-ove.patch @@ -0,0 +1,52 @@ +From 5b34ab52401f0f1f191bcb83a182c83b506f4763 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= +Date: Thu, 22 Oct 2020 22:42:56 +0300 +Subject: [PATCH] drm/modes: Switch to 64bit maths to avoid integer overflow +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 5b34ab52401f0f1f191bcb83a182c83b506f4763 +Patch-mainline: v5.12-rc1 +References: git-fixes + +The new >8k CEA modes have dotclocks reaching 5.94 GHz, which +means our clock*1000 will now overflow the 32bit unsigned +integer. Switch to 64bit maths to avoid it. + +Cc: stable@vger.kernel.org +Reported-by: Randy Dunlap +Signed-off-by: Ville Syrjälä +Link: https://patchwork.freedesktop.org/patch/msgid/20201022194256.30978-1-ville.syrjala@linux.intel.com +Tested-by: Randy Dunlap +Reviewed-by: Chris Wilson +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/drm_modes.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c +index 33fb2f05ce66..1ac67d4505e0 100644 +--- a/drivers/gpu/drm/drm_modes.c ++++ b/drivers/gpu/drm/drm_modes.c +@@ -762,7 +762,7 @@ int drm_mode_vrefresh(const struct drm_display_mode *mode) + if (mode->htotal == 0 || mode->vtotal == 0) + return 0; + +- num = mode->clock * 1000; ++ num = mode->clock; + den = mode->htotal * mode->vtotal; + + if (mode->flags & DRM_MODE_FLAG_INTERLACE) +@@ -772,7 +772,7 @@ int drm_mode_vrefresh(const struct drm_display_mode *mode) + if (mode->vscan > 1) + den *= mode->vscan; + +- return DIV_ROUND_CLOSEST(num, den); ++ return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(num, 1000), den); + } + EXPORT_SYMBOL(drm_mode_vrefresh); + +-- +2.26.2 + diff --git a/patches.suse/drm-msm-Fix-race-of-GPU-init-vs-timestamp-power-mana.patch b/patches.suse/drm-msm-Fix-race-of-GPU-init-vs-timestamp-power-mana.patch new file mode 100644 index 0000000..cfdcb33 --- /dev/null +++ b/patches.suse/drm-msm-Fix-race-of-GPU-init-vs-timestamp-power-mana.patch @@ -0,0 +1,125 @@ +From 7a7cbf2a819740674455ad36155c662367261296 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Thu, 28 Jan 2021 13:03:30 -0800 +Subject: [PATCH] drm/msm: Fix race of GPU init vs timestamp power management. +Git-commit: 7a7cbf2a819740674455ad36155c662367261296 +Patch-mainline: v5.12-rc1 +References: git-fixes + +We were using the same force-poweron bit in the two codepaths, so they +could race to have one of them lose GPU power early. + +freedreno CI was seeing intermittent errors like: +[drm:_a6xx_gmu_set_oob] *ERROR* Timeout waiting for GMU OOB set GPU_SET: 0x0 +and this issue could have contributed to it. + +Signed-off-by: Eric Anholt +Fixes: 4b565ca5a2cb ("drm/msm: Add A6XX device support") +Reviewed-by: Jordan Crouse +Signed-off-by: Rob Clark +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 25 ++++++++++++++++++++++--- + drivers/gpu/drm/msm/adreno/a6xx_gmu.h | 8 ++++++++ + drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 ++-- + 3 files changed, 32 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +index e6703ae98760..b3318f86aabc 100644 +--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c ++++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +@@ -264,6 +264,16 @@ int a6xx_gmu_set_oob(struct a6xx_gmu *gmu, enum a6xx_gmu_oob_state state) + } + name = "GPU_SET"; + break; ++ case GMU_OOB_PERFCOUNTER_SET: ++ if (gmu->legacy) { ++ request = GMU_OOB_PERFCOUNTER_REQUEST; ++ ack = GMU_OOB_PERFCOUNTER_ACK; ++ } else { ++ request = GMU_OOB_PERFCOUNTER_REQUEST_NEW; ++ ack = GMU_OOB_PERFCOUNTER_ACK_NEW; ++ } ++ name = "PERFCOUNTER"; ++ break; + case GMU_OOB_BOOT_SLUMBER: + request = GMU_OOB_BOOT_SLUMBER_REQUEST; + ack = GMU_OOB_BOOT_SLUMBER_ACK; +@@ -301,9 +311,14 @@ int a6xx_gmu_set_oob(struct a6xx_gmu *gmu, enum a6xx_gmu_oob_state state) + void a6xx_gmu_clear_oob(struct a6xx_gmu *gmu, enum a6xx_gmu_oob_state state) + { + if (!gmu->legacy) { +- WARN_ON(state != GMU_OOB_GPU_SET); +- gmu_write(gmu, REG_A6XX_GMU_HOST2GMU_INTR_SET, +- 1 << GMU_OOB_GPU_SET_CLEAR_NEW); ++ if (state == GMU_OOB_GPU_SET) { ++ gmu_write(gmu, REG_A6XX_GMU_HOST2GMU_INTR_SET, ++ 1 << GMU_OOB_GPU_SET_CLEAR_NEW); ++ } else { ++ WARN_ON(state != GMU_OOB_PERFCOUNTER_SET); ++ gmu_write(gmu, REG_A6XX_GMU_HOST2GMU_INTR_SET, ++ 1 << GMU_OOB_PERFCOUNTER_CLEAR_NEW); ++ } + return; + } + +@@ -312,6 +327,10 @@ void a6xx_gmu_clear_oob(struct a6xx_gmu *gmu, enum a6xx_gmu_oob_state state) + gmu_write(gmu, REG_A6XX_GMU_HOST2GMU_INTR_SET, + 1 << GMU_OOB_GPU_SET_CLEAR); + break; ++ case GMU_OOB_PERFCOUNTER_SET: ++ gmu_write(gmu, REG_A6XX_GMU_HOST2GMU_INTR_SET, ++ 1 << GMU_OOB_PERFCOUNTER_CLEAR); ++ break; + case GMU_OOB_BOOT_SLUMBER: + gmu_write(gmu, REG_A6XX_GMU_HOST2GMU_INTR_SET, + 1 << GMU_OOB_BOOT_SLUMBER_CLEAR); +diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h +index c6d2bced8e5d..9fa278de2106 100644 +--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h ++++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h +@@ -156,6 +156,7 @@ enum a6xx_gmu_oob_state { + GMU_OOB_BOOT_SLUMBER = 0, + GMU_OOB_GPU_SET, + GMU_OOB_DCVS_SET, ++ GMU_OOB_PERFCOUNTER_SET, + }; + + /* These are the interrupt / ack bits for each OOB request that are set +@@ -190,6 +191,13 @@ enum a6xx_gmu_oob_state { + #define GMU_OOB_GPU_SET_ACK_NEW 31 + #define GMU_OOB_GPU_SET_CLEAR_NEW 31 + ++#define GMU_OOB_PERFCOUNTER_REQUEST 17 ++#define GMU_OOB_PERFCOUNTER_ACK 25 ++#define GMU_OOB_PERFCOUNTER_CLEAR 25 ++ ++#define GMU_OOB_PERFCOUNTER_REQUEST_NEW 28 ++#define GMU_OOB_PERFCOUNTER_ACK_NEW 30 ++#define GMU_OOB_PERFCOUNTER_CLEAR_NEW 30 + + void a6xx_hfi_init(struct a6xx_gmu *gmu); + int a6xx_hfi_start(struct a6xx_gmu *gmu, int boot_state); +diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +index 0a51cad42642..9be15cf169c9 100644 +--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c ++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +@@ -1172,12 +1172,12 @@ static int a6xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value) + struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); + + /* Force the GPU power on so we can read this register */ +- a6xx_gmu_set_oob(&a6xx_gpu->gmu, GMU_OOB_GPU_SET); ++ a6xx_gmu_set_oob(&a6xx_gpu->gmu, GMU_OOB_PERFCOUNTER_SET); + + *value = gpu_read64(gpu, REG_A6XX_RBBM_PERFCTR_CP_0_LO, + REG_A6XX_RBBM_PERFCTR_CP_0_HI); + +- a6xx_gmu_clear_oob(&a6xx_gpu->gmu, GMU_OOB_GPU_SET); ++ a6xx_gmu_clear_oob(&a6xx_gpu->gmu, GMU_OOB_PERFCOUNTER_SET); + return 0; + } + +-- +2.26.2 + diff --git a/patches.suse/drm-msm-Fix-races-managing-the-OOB-state-for-timesta.patch b/patches.suse/drm-msm-Fix-races-managing-the-OOB-state-for-timesta.patch new file mode 100644 index 0000000..9da0fdc --- /dev/null +++ b/patches.suse/drm-msm-Fix-races-managing-the-OOB-state-for-timesta.patch @@ -0,0 +1,56 @@ +From 5f98b33b04c02c0d9088c7486c59d058696782f9 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Thu, 28 Jan 2021 13:03:31 -0800 +Subject: [PATCH] drm/msm: Fix races managing the OOB state for timestamp vs timestamps. +Git-commit: 5f98b33b04c02c0d9088c7486c59d058696782f9 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Now that we're not racing with GPU setup, also fix races of timestamps +against other timestamps. In freedreno CI, we were seeing this path trigger +timeouts on setting the GMU bit, producing: + +[drm:_a6xx_gmu_set_oob] *ERROR* Timeout waiting for GMU OOB set GPU_SET: 0x0 + +and this triggered especially on the first set of tests right after +boot (it's probably easier to lose the race than one might think, +given that we start many tests in parallel, and waiting for NFS to +page in code probably means that lots of tests hit the same point of +screen init at the same time). As of this patch, the message seems to +have completely gone away. + +Signed-off-by: Eric Anholt +Fixes: 4b565ca5a2cb ("drm/msm: Add A6XX device support") +Reviewed-by: Jordan Crouse +Signed-off-by: Rob Clark +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +index 9be15cf169c9..ba8e9d3cf0fe 100644 +--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c ++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +@@ -1170,6 +1170,9 @@ static int a6xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value) + { + struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); + struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); ++ static DEFINE_MUTEX(perfcounter_oob); ++ ++ mutex_lock(&perfcounter_oob); + + /* Force the GPU power on so we can read this register */ + a6xx_gmu_set_oob(&a6xx_gpu->gmu, GMU_OOB_PERFCOUNTER_SET); +@@ -1178,6 +1181,7 @@ static int a6xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value) + REG_A6XX_RBBM_PERFCTR_CP_0_HI); + + a6xx_gmu_clear_oob(&a6xx_gpu->gmu, GMU_OOB_PERFCOUNTER_SET); ++ mutex_unlock(&perfcounter_oob); + return 0; + } + +-- +2.26.2 + diff --git a/patches.suse/drm-msm-dsi-Correct-io_start-for-MSM8994-20nm-PHY.patch b/patches.suse/drm-msm-dsi-Correct-io_start-for-MSM8994-20nm-PHY.patch new file mode 100644 index 0000000..986be49 --- /dev/null +++ b/patches.suse/drm-msm-dsi-Correct-io_start-for-MSM8994-20nm-PHY.patch @@ -0,0 +1,37 @@ +From 33a7808ce1aea6e2edc1af25db25928137940c02 Mon Sep 17 00:00:00 2001 +From: Konrad Dybcio +Date: Mon, 18 Jan 2021 17:15:58 +0100 +Subject: [PATCH] drm/msm/dsi: Correct io_start for MSM8994 (20nm PHY) +Git-commit: 33a7808ce1aea6e2edc1af25db25928137940c02 +Patch-mainline: v5.12-rc1 +References: git-fixes + +The previous registers were *almost* correct, but instead of +PHYs, they were pointing at DSI PLLs, resulting in the PHY id +autodetection failing miserably. + +Fixes: dcefc117cc19 ("drm/msm/dsi: Add support for msm8x94") +Signed-off-by: Konrad Dybcio +Signed-off-by: Rob Clark +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c +index 1afb7c579dbb..eca86bf448f7 100644 +--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c ++++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c +@@ -139,7 +139,7 @@ const struct msm_dsi_phy_cfg dsi_phy_20nm_cfgs = { + .disable = dsi_20nm_phy_disable, + .init = msm_dsi_phy_init_common, + }, +- .io_start = { 0xfd998300, 0xfd9a0300 }, ++ .io_start = { 0xfd998500, 0xfd9a0500 }, + .num_dsi_phy = 2, + }; + +-- +2.26.2 + diff --git a/patches.suse/drm-msm-mdp5-Fix-wait-for-commit-for-cmd-panels.patch b/patches.suse/drm-msm-mdp5-Fix-wait-for-commit-for-cmd-panels.patch new file mode 100644 index 0000000..3b529d2 --- /dev/null +++ b/patches.suse/drm-msm-mdp5-Fix-wait-for-commit-for-cmd-panels.patch @@ -0,0 +1,43 @@ +From 68e4f01fddb4ead80e8c7084db489307f22c9cbb Mon Sep 17 00:00:00 2001 +From: Iskren Chernev +Date: Wed, 27 Jan 2021 17:24:40 +0200 +Subject: [PATCH] drm/msm/mdp5: Fix wait-for-commit for cmd panels +Git-commit: 68e4f01fddb4ead80e8c7084db489307f22c9cbb +Patch-mainline: v5.12-rc1 +References: git-fixes + +Before the offending commit in msm_atomic_commit_tail wait_flush was +called once per frame, after the commit was submitted. After it +wait_flush is also called at the beginning to ensure previous +potentially async commits are done. + +For cmd panels the source of wait_flush is a ping-pong irq notifying +a completion. The completion needs to be notified with complete_all so +multiple waiting parties (new async committers) can proceed. + +Signed-off-by: Iskren Chernev +Suggested-by: Rob Clark +Fixes: 2d99ced787e3d ("drm/msm: async commit support") +Signed-off-by: Rob Clark +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +index 0c8f9f88301f..f5d71b274079 100644 +--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c ++++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +@@ -1180,7 +1180,7 @@ static void mdp5_crtc_pp_done_irq(struct mdp_irq *irq, uint32_t irqstatus) + struct mdp5_crtc *mdp5_crtc = container_of(irq, struct mdp5_crtc, + pp_done); + +- complete(&mdp5_crtc->pp_completion); ++ complete_all(&mdp5_crtc->pp_completion); + } + + static void mdp5_crtc_wait_for_pp_done(struct drm_crtc *crtc) +-- +2.26.2 + diff --git a/patches.suse/drm-nouveau-kms-handle-mDP-connectors.patch b/patches.suse/drm-nouveau-kms-handle-mDP-connectors.patch new file mode 100644 index 0000000..7e4af2d --- /dev/null +++ b/patches.suse/drm-nouveau-kms-handle-mDP-connectors.patch @@ -0,0 +1,57 @@ +From d1f5a3fc85566e9ddce9361ef180f070367e6eab Mon Sep 17 00:00:00 2001 +From: Karol Herbst +Date: Fri, 27 Nov 2020 19:39:09 +0100 +Subject: [PATCH] drm/nouveau/kms: handle mDP connectors +Git-commit: d1f5a3fc85566e9ddce9361ef180f070367e6eab +Patch-mainline: v5.12-rc1 +References: git-fixes + +In some cases we have the handle those explicitly as the fallback +connector type detection fails and marks those as eDP connectors. + +Attempting to use such a connector with mutter leads to a crash of mutter +as it ends up with two eDP displays. + +Information is taken from the official DCB documentation. + +Cc: stable@vger.kernel.org +Cc: dri-devel@lists.freedesktop.org +Cc: Ben Skeggs +Reported-by: Mark Pearson +Tested-by: Mark Pearson +Signed-off-by: Karol Herbst +Signed-off-by: Ben Skeggs +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/conn.h | 1 + + drivers/gpu/drm/nouveau/nouveau_connector.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/conn.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/conn.h +index f5f59261ea81..d1beaad0c82b 100644 +--- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/conn.h ++++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/conn.h +@@ -14,6 +14,7 @@ enum dcb_connector_type { + DCB_CONNECTOR_LVDS_SPWG = 0x41, + DCB_CONNECTOR_DP = 0x46, + DCB_CONNECTOR_eDP = 0x47, ++ DCB_CONNECTOR_mDP = 0x48, + DCB_CONNECTOR_HDMI_0 = 0x60, + DCB_CONNECTOR_HDMI_1 = 0x61, + DCB_CONNECTOR_HDMI_C = 0x63, +diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c +index 14c29e68db8f..61e6d7412505 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_connector.c ++++ b/drivers/gpu/drm/nouveau/nouveau_connector.c +@@ -1212,6 +1212,7 @@ drm_conntype_from_dcb(enum dcb_connector_type dcb) + case DCB_CONNECTOR_DMS59_DP0: + case DCB_CONNECTOR_DMS59_DP1: + case DCB_CONNECTOR_DP : ++ case DCB_CONNECTOR_mDP : + case DCB_CONNECTOR_USB_C : return DRM_MODE_CONNECTOR_DisplayPort; + case DCB_CONNECTOR_eDP : return DRM_MODE_CONNECTOR_eDP; + case DCB_CONNECTOR_HDMI_0 : +-- +2.26.2 + diff --git a/patches.suse/drm-panel-kd35t133-allow-using-non-continuous-dsi-cl.patch b/patches.suse/drm-panel-kd35t133-allow-using-non-continuous-dsi-cl.patch new file mode 100644 index 0000000..5082332 --- /dev/null +++ b/patches.suse/drm-panel-kd35t133-allow-using-non-continuous-dsi-cl.patch @@ -0,0 +1,47 @@ +From d922d58fedcd98ba625e89b625a98e222b090b10 Mon Sep 17 00:00:00 2001 +From: Heiko Stuebner +Date: Sat, 6 Feb 2021 14:50:20 +0100 +Subject: [PATCH] drm/panel: kd35t133: allow using non-continuous dsi clock +Git-commit: d922d58fedcd98ba625e89b625a98e222b090b10 +Patch-mainline: v5.12-rc1 +References: git-fixes + +The panel is able to work when dsi clock is non-continuous, thus +the system power consumption can be reduced using such feature. + +Add MIPI_DSI_CLOCK_NON_CONTINUOUS to panel's mode_flags. + +Also the flag actually becomes necessary after +commit c6d94e37bdbb ("drm/bridge/synopsys: dsi: add support for non-continuous HS clock") +and without it the panel only emits stripes instead of output. + +Fixes: c6d94e37bdbb ("drm/bridge/synopsys: dsi: add support for non-continuous HS clock") +Cc: stable@vger.kernel.org # 5.10+ +Signed-off-by: Heiko Stuebner +Tested-by: Ezequiel Garcia +Reviewed-by: Christopher Morgan +Link: https://patchwork.freedesktop.org/patch/msgid/20210206135020.1991820-1-heiko@sntech.de +Signed-off-by: Maarten Lankhorst +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/panel/panel-elida-kd35t133.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c +index bc36aa3c1123..fe5ac3ef9018 100644 +--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c ++++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c +@@ -265,7 +265,8 @@ static int kd35t133_probe(struct mipi_dsi_device *dsi) + dsi->lanes = 1; + dsi->format = MIPI_DSI_FMT_RGB888; + dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | +- MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET; ++ MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET | ++ MIPI_DSI_CLOCK_NON_CONTINUOUS; + + drm_panel_init(&ctx->panel, &dsi->dev, &kd35t133_funcs, + DRM_MODE_CONNECTOR_DSI); +-- +2.26.2 + diff --git a/patches.suse/drm-rockchip-Require-the-YTR-modifier-for-AFBC.patch b/patches.suse/drm-rockchip-Require-the-YTR-modifier-for-AFBC.patch new file mode 100644 index 0000000..cda233c --- /dev/null +++ b/patches.suse/drm-rockchip-Require-the-YTR-modifier-for-AFBC.patch @@ -0,0 +1,66 @@ +From 5f94e3571459abb626077aedb65d71264c2a58c0 Mon Sep 17 00:00:00 2001 +From: Alyssa Rosenzweig +Date: Tue, 11 Aug 2020 16:26:31 -0400 +Subject: [PATCH] drm/rockchip: Require the YTR modifier for AFBC +Git-commit: 5f94e3571459abb626077aedb65d71264c2a58c0 +Patch-mainline: v5.12-rc1 +References: git-fixes + +The AFBC decoder used in the Rockchip VOP assumes the use of the +YUV-like colourspace transform (YTR). YTR is lossless for RGB(A) +buffers, which covers the RGBA8 and RGB565 formats supported in +vop_convert_afbc_format. Use of YTR is signaled with the +AFBC_FORMAT_MOD_YTR modifier, which prior to this commit was missing. As +such, a producer would have to generate buffers that do not use YTR, +which the VOP would erroneously decode as YTR, leading to severe visual +corruption. + +The upstream AFBC support was developed against a captured frame, which +failed to exercise modifier support. Prior to bring-up of AFBC in Mesa +(in the Panfrost driver), no open userspace respected modifier +reporting. As such, this change is not expected to affect broken +userspaces. + +Tested on RK3399 with Panfrost and Weston. + +Fixes: 7707f7227f09 ("drm/rockchip: Add support for afbc") +Cc: stable@vger.kernel.org +Signed-off-by: Alyssa Rosenzweig +Acked-by: Daniel Stone +Signed-off-by: Heiko Stuebner +Link: https://patchwork.freedesktop.org/patch/msgid/20200811202631.3603-1-alyssa.rosenzweig@collabora.com +Signed-off-by: Maarten Lankhorst +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +index 4a2099cb582e..857d97cdc67c 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +@@ -17,9 +17,20 @@ + + #define NUM_YUV2YUV_COEFFICIENTS 12 + ++/* AFBC supports a number of configurable modes. Relevant to us is block size ++ * (16x16 or 32x8), storage modifiers (SPARSE, SPLIT), and the YUV-like ++ * colourspace transform (YTR). 16x16 SPARSE mode is always used. SPLIT mode ++ * could be enabled via the hreg_block_split register, but is not currently ++ * handled. The colourspace transform is implicitly always assumed by the ++ * decoder, so consumers must use this transform as well. ++ * ++ * Failure to match modifiers will cause errors displaying AFBC buffers ++ * produced by conformant AFBC producers, including Mesa. ++ */ + #define ROCKCHIP_AFBC_MOD \ + DRM_FORMAT_MOD_ARM_AFBC( \ + AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 | AFBC_FORMAT_MOD_SPARSE \ ++ | AFBC_FORMAT_MOD_YTR \ + ) + + enum vop_data_format { +-- +2.26.2 + diff --git a/patches.suse/drm-sched-Cancel-and-flush-all-outstanding-jobs-befo.patch b/patches.suse/drm-sched-Cancel-and-flush-all-outstanding-jobs-befo.patch new file mode 100644 index 0000000..c95ddfe --- /dev/null +++ b/patches.suse/drm-sched-Cancel-and-flush-all-outstanding-jobs-befo.patch @@ -0,0 +1,41 @@ +From e582951baabba3e278c97169d0acc1e09b24a72e Mon Sep 17 00:00:00 2001 +From: Andrey Grodzovsky +Date: Mon, 18 Jan 2021 16:01:13 -0500 +Subject: [PATCH] drm/sched: Cancel and flush all outstanding jobs before finish. +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: e582951baabba3e278c97169d0acc1e09b24a72e +Patch-mainline: v5.12-rc1 +References: git-fixes + +To avoid any possible use after free. + +Signed-off-by: Andrey Grodzovsky +Reviewed-by: Christian König +Link: https://patchwork.freedesktop.org/patch/414814/ +Cc: stable@vger.kernel.org +Signed-off-by: Christian König +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/scheduler/sched_main.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c +index 997aa15dd8d9..92637b70c9bf 100644 +--- a/drivers/gpu/drm/scheduler/sched_main.c ++++ b/drivers/gpu/drm/scheduler/sched_main.c +@@ -899,6 +899,9 @@ void drm_sched_fini(struct drm_gpu_scheduler *sched) + if (sched->thread) + kthread_stop(sched->thread); + ++ /* Confirm no work left behind accessing device structures */ ++ cancel_delayed_work_sync(&sched->work_tdr); ++ + sched->ready = false; + } + EXPORT_SYMBOL(drm_sched_fini); +-- +2.26.2 + diff --git a/patches.suse/drm-virtio-use-kvmalloc-for-large-allocations.patch b/patches.suse/drm-virtio-use-kvmalloc-for-large-allocations.patch new file mode 100644 index 0000000..8303031 --- /dev/null +++ b/patches.suse/drm-virtio-use-kvmalloc-for-large-allocations.patch @@ -0,0 +1,37 @@ +From ea86f3defd55f141a44146e66cbf8ffb683d60da Mon Sep 17 00:00:00 2001 +From: Sergey Senozhatsky +Date: Thu, 5 Nov 2020 10:47:44 +0900 +Subject: [PATCH] drm/virtio: use kvmalloc for large allocations +Git-commit: ea86f3defd55f141a44146e66cbf8ffb683d60da +Patch-mainline: v5.11-rc1 +References: git-fixes + +We observed that some of virtio_gpu_object_shmem_init() allocations +can be rather costly - order 6 - which can be difficult to fulfill +under memory pressure conditions. Switch to kvmalloc_array() in +virtio_gpu_object_shmem_init() and let the kernel vmalloc the entries +array. + +Signed-off-by: Sergey Senozhatsky +Link: http://patchwork.freedesktop.org/patch/msgid/20201105014744.1662226-1-senozhatsky@chromium.org +Signed-off-by: Gerd Hoffmann +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/virtio/virtgpu_object.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/virtio/virtgpu_object.c ++++ b/drivers/gpu/drm/virtio/virtgpu_object.c +@@ -173,8 +173,9 @@ static int virtio_gpu_object_shmem_init( + *nents = shmem->pages->nents; + } + +- *ents = kmalloc_array(*nents, sizeof(struct virtio_gpu_mem_entry), +- GFP_KERNEL); ++ *ents = kvmalloc_array(*nents, ++ sizeof(struct virtio_gpu_mem_entry), ++ GFP_KERNEL); + if (!(*ents)) { + DRM_ERROR("failed to allocate ent list\n"); + return -ENOMEM; diff --git a/patches.suse/drm-xlnx-fix-kmemleak-by-sending-vblank_event-in-ato.patch b/patches.suse/drm-xlnx-fix-kmemleak-by-sending-vblank_event-in-ato.patch new file mode 100644 index 0000000..b1066a9 --- /dev/null +++ b/patches.suse/drm-xlnx-fix-kmemleak-by-sending-vblank_event-in-ato.patch @@ -0,0 +1,110 @@ +From a7e02f7796c163ac8297b30223bf24bade9f8a50 Mon Sep 17 00:00:00 2001 +From: Quanyang Wang +Date: Tue, 2 Feb 2021 14:41:21 +0800 +Subject: [PATCH] drm/xlnx: fix kmemleak by sending vblank_event in atomic_disable +Git-commit: a7e02f7796c163ac8297b30223bf24bade9f8a50 +Patch-mainline: v5.11 +References: git-fixes + +When running xrandr to change resolution of DP, the kmemleak as below +can be observed: + +unreferenced object 0xffff00080a351000 (size 256): + comm "Xorg", pid 248, jiffies 4294899614 (age 19.960s) + hex dump (first 32 bytes): + 98 a0 bc 01 08 00 ff ff 01 00 00 00 00 00 00 00 ................ + ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 ................ + backtrace: + [<00000000e0bd0f69>] kmemleak_alloc+0x30/0x40 + [<00000000cde2f318>] kmem_cache_alloc+0x3d4/0x588 + [<0000000088ea9bd7>] drm_atomic_helper_setup_commit+0x84/0x5f8 + [<000000002290a264>] drm_atomic_helper_commit+0x58/0x388 + [<00000000f6ea78c3>] drm_atomic_commit+0x4c/0x60 + [<00000000c8e0725e>] drm_atomic_connector_commit_dpms+0xe8/0x110 + [<0000000020ade187>] drm_mode_obj_set_property_ioctl+0x1b0/0x450 + [<00000000918206d6>] drm_connector_property_set_ioctl+0x3c/0x68 + [<000000008d51e7a5>] drm_ioctl_kernel+0xc4/0x118 + [<000000002a819b75>] drm_ioctl+0x214/0x448 + [<000000008ca4e588>] __arm64_sys_ioctl+0xa8/0xf0 + [<0000000034e15a35>] el0_svc_common.constprop.0+0x74/0x190 + [<000000001b93d916>] do_el0_svc+0x24/0x90 + [<00000000ce9230e0>] el0_svc+0x14/0x20 + [<00000000e3607d82>] el0_sync_handler+0xb0/0xb8 + [<000000003e79c15f>] el0_sync+0x174/0x180 + +This is because there is a scenario that a drm_crtc_commit commit is +allocated but not freed. The drm subsystem require/release references +to a CRTC commit by calling drm_crtc_commit_get/put, and when +drm_crtc_commit_put find that commit.ref.refcount is zero, it will +call __drm_crtc_commit_free to free this CRTC commit. Among these +drm_crtc_commit_get/put pairs, there is a drm_crtc_commit_get in +drm_atomic_helper_setup_commit as below: + +... +new_crtc_state->event->base.completion = &commit->flip_done; +new_crtc_state->event->base.completion_release = release_crtc_commit; +drm_crtc_commit_get(commit); +... + +This reference to the CRTC commit should be released at the function +release_crtc_commit by calling e->completion_release(e->completion) in +drm_send_event_locked. So we need to call drm_send_event_locked at +two places: handling vblank event in the irq handler and the crtc disable +helper. But in zynqmp_disp_crtc_atomic_disable, it only marks the flip +is done and not call drm_crtc_commit_put. This result that the refcount +of this commit is always non-zero and this commit will never be freed. + +Since the function drm_crtc_send_vblank_event has operations both sending +a flip_done signal and releasing reference to the CRTC commit, let's use +it instead. + +Signed-off-by: Quanyang Wang +Signed-off-by: Daniel Vetter +Link: https://patchwork.freedesktop.org/patch/msgid/20210202064121.173362-1-quanyang.wang@windriver.com +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/xlnx/zynqmp_disp.c | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c +index c685d94409b0..148add0ca1d6 100644 +--- a/drivers/gpu/drm/xlnx/zynqmp_disp.c ++++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c +@@ -1396,19 +1396,11 @@ static void zynqmp_disp_enable(struct zynqmp_disp *disp) + */ + static void zynqmp_disp_disable(struct zynqmp_disp *disp) + { +- struct drm_crtc *crtc = &disp->crtc; +- + zynqmp_disp_audio_disable(&disp->audio); + + zynqmp_disp_avbuf_disable_audio(&disp->avbuf); + zynqmp_disp_avbuf_disable_channels(&disp->avbuf); + zynqmp_disp_avbuf_disable(&disp->avbuf); +- +- /* Mark the flip is done as crtc is disabled anyway */ +- if (crtc->state->event) { +- complete_all(crtc->state->event->base.completion); +- crtc->state->event = NULL; +- } + } + + static inline struct zynqmp_disp *crtc_to_disp(struct drm_crtc *crtc) +@@ -1499,6 +1491,13 @@ zynqmp_disp_crtc_atomic_disable(struct drm_crtc *crtc, + + drm_crtc_vblank_off(&disp->crtc); + ++ spin_lock_irq(&crtc->dev->event_lock); ++ if (crtc->state->event) { ++ drm_crtc_send_vblank_event(crtc, crtc->state->event); ++ crtc->state->event = NULL; ++ } ++ spin_unlock_irq(&crtc->dev->event_lock); ++ + clk_disable_unprepare(disp->pclk); + pm_runtime_put_sync(disp->dev); + } +-- +2.26.2 + diff --git a/patches.suse/dt-bindings-can-add-can-controller.yaml.patch b/patches.suse/dt-bindings-can-add-can-controller.yaml.patch new file mode 100644 index 0000000..3dcc22d --- /dev/null +++ b/patches.suse/dt-bindings-can-add-can-controller.yaml.patch @@ -0,0 +1,47 @@ +From: Oleksij Rempel +Date: Thu, 22 Oct 2020 09:52:17 +0200 +Subject: dt-bindings: can: add can-controller.yaml + +Git-commit: 1f9234401ce0aa7a05857db43c5aef290d5177e2 +Patch-mainline: v5.10-rc3 +References: jsc#SLE-12251 + +For now we have only node name as common rule for all CAN controllers + +Signed-off-by: Oleksij Rempel +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20201022075218.11880-2-o.rempel@pengutronix.de +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + .../bindings/net/can/can-controller.yaml | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + create mode 100644 Documentation/devicetree/bindings/net/can/can-controller.yaml + +diff --git a/Documentation/devicetree/bindings/net/can/can-controller.yaml b/Documentation/devicetree/bindings/net/can/can-controller.yaml +new file mode 100644 +index 000000000000..9cf2ae097156 +--- /dev/null ++++ b/Documentation/devicetree/bindings/net/can/can-controller.yaml +@@ -0,0 +1,18 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/net/can/can-controller.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: CAN Controller Generic Binding ++ ++maintainers: ++ - Marc Kleine-Budde ++ ++properties: ++ $nodename: ++ pattern: "^can(@.*)?$" ++ ++additionalProperties: true ++ ++... +-- +2.26.2 + diff --git a/patches.suse/dt-bindings-can-flexcan-add-PE-clock-source-property.patch b/patches.suse/dt-bindings-can-flexcan-add-PE-clock-source-property.patch new file mode 100644 index 0000000..eab5925 --- /dev/null +++ b/patches.suse/dt-bindings-can-flexcan-add-PE-clock-source-property.patch @@ -0,0 +1,47 @@ +From: Dong Aisheng +Date: Thu, 13 Dec 2018 07:07:57 +0000 +Subject: dt-bindings: can: flexcan: add PE clock source property to device + tree + +Git-commit: 9d733992772dc04ce5e8839f867b4ff83ee75c34 +Patch-mainline: v5.4-rc1 +References: jsc#SLE-12251 + +The FlexCAN controller can parse clock source property from DTS file to +select PE clock source. + +Signed-off-by: Dong Aisheng +Signed-off-by: Joakim Zhang +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + Documentation/devicetree/bindings/net/can/fsl-flexcan.txt | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt +index bc77477c6878..a04168605998 100644 +--- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt ++++ b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt +@@ -32,6 +32,13 @@ Optional properties: + ack_gpr is the gpr register offset of CAN stop acknowledge. + ack_bit is the bit offset of CAN stop acknowledge. + ++- fsl,clk-source: Select the clock source to the CAN Protocol Engine (PE). ++ It's SoC Implementation dependent. Refer to RM for detailed ++ definition. If this property is not set in device tree node ++ then driver selects clock source 1 by default. ++ 0: clock source 0 (oscillator clock) ++ 1: clock source 1 (peripheral clock) ++ + Example: + + can@1c000 { +@@ -40,4 +47,5 @@ Example: + interrupts = <48 0x2>; + interrupt-parent = <&mpic>; + clock-frequency = <200000000>; // filled in by bootloader ++ fsl,clk-source = <0>; // select clock source 0 for PE + }; +-- +2.26.2 + diff --git a/patches.suse/dt-bindings-can-flexcan-add-can-wakeup-property.patch b/patches.suse/dt-bindings-can-flexcan-add-can-wakeup-property.patch new file mode 100644 index 0000000..a728204 --- /dev/null +++ b/patches.suse/dt-bindings-can-flexcan-add-can-wakeup-property.patch @@ -0,0 +1,34 @@ +From: Sean Nyekjaer +Date: Tue, 9 Apr 2019 10:39:49 +0200 +Subject: dt-bindings: can: flexcan: add can wakeup property + +Git-commit: 10e0c525fc41c1a80d33e3075d6f7f5902e74bbd +Patch-mainline: v5.4-rc1 +References: jsc#SLE-12251 + +This patch adds the wakeup-source boolean property. + +Signed-off-by: Sean Nyekjaer +Reviewed-by: Rob Herring +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + Documentation/devicetree/bindings/net/can/fsl-flexcan.txt | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt +index a04168605998..94c0f8bf4deb 100644 +--- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt ++++ b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt +@@ -39,6 +39,8 @@ Optional properties: + 0: clock source 0 (oscillator clock) + 1: clock source 1 (peripheral clock) + ++- wakeup-source: enable CAN remote wakeup ++ + Example: + + can@1c000 { +-- +2.26.2 + diff --git a/patches.suse/dt-bindings-can-flexcan-convert-fsl-flexcan-bindings.patch b/patches.suse/dt-bindings-can-flexcan-convert-fsl-flexcan-bindings.patch new file mode 100644 index 0000000..1d29b81 --- /dev/null +++ b/patches.suse/dt-bindings-can-flexcan-convert-fsl-flexcan-bindings.patch @@ -0,0 +1,230 @@ +From: Oleksij Rempel +Date: Thu, 22 Oct 2020 09:52:18 +0200 +Subject: dt-bindings: can: flexcan: convert fsl,*flexcan bindings to yaml + +Git-commit: e5ab9aa7e49b39c34d110d6303b917c14a277200 +Patch-mainline: v5.10-rc3 +References: jsc#SLE-12251 + +In order to automate the verification of DT nodes convert +fsl-flexcan.txt to fsl,flexcan.yaml + +Signed-off-by: Oleksij Rempel +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20201022075218.11880-3-o.rempel@pengutronix.de +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + .../bindings/net/can/fsl,flexcan.yaml | 135 ++++++++++++++++++ + .../bindings/net/can/fsl-flexcan.txt | 57 -------- + 2 files changed, 135 insertions(+), 57 deletions(-) + create mode 100644 Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml + delete mode 100644 Documentation/devicetree/bindings/net/can/fsl-flexcan.txt + +diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml +new file mode 100644 +index 000000000000..43df15ba8fa4 +--- /dev/null ++++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml +@@ -0,0 +1,135 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/net/can/fsl,flexcan.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: ++ Flexcan CAN controller on Freescale's ARM and PowerPC system-on-a-chip (SOC). ++ ++maintainers: ++ - Marc Kleine-Budde ++ ++allOf: ++ - $ref: can-controller.yaml# ++ ++properties: ++ compatible: ++ oneOf: ++ - enum: ++ - fsl,imx8qm-flexcan ++ - fsl,imx8mp-flexcan ++ - fsl,imx6q-flexcan ++ - fsl,imx53-flexcan ++ - fsl,imx35-flexcan ++ - fsl,imx28-flexcan ++ - fsl,imx25-flexcan ++ - fsl,p1010-flexcan ++ - fsl,vf610-flexcan ++ - fsl,ls1021ar2-flexcan ++ - fsl,lx2160ar1-flexcan ++ - items: ++ - enum: ++ - fsl,imx7d-flexcan ++ - fsl,imx6ul-flexcan ++ - fsl,imx6sx-flexcan ++ - const: fsl,imx6q-flexcan ++ - items: ++ - enum: ++ - fsl,ls1028ar1-flexcan ++ - const: fsl,lx2160ar1-flexcan ++ ++ reg: ++ maxItems: 1 ++ ++ interrupts: ++ maxItems: 1 ++ ++ clocks: ++ maxItems: 2 ++ ++ clock-names: ++ items: ++ - const: ipg ++ - const: per ++ ++ clock-frequency: ++ description: | ++ The oscillator frequency driving the flexcan device, filled in by the ++ boot loader. This property should only be used the used operating system ++ doesn't support the clocks and clock-names property. ++ ++ xceiver-supply: ++ description: Regulator that powers the CAN transceiver. ++ ++ big-endian: ++ $ref: /schemas/types.yaml#/definitions/flag ++ description: | ++ This means the registers of FlexCAN controller are big endian. This is ++ optional property.i.e. if this property is not present in device tree ++ node then controller is assumed to be little endian. If this property is ++ present then controller is assumed to be big endian. ++ ++ fsl,stop-mode: ++ description: | ++ Register bits of stop mode control. ++ ++ The format should be as follows: ++ ++ gpr is the phandle to general purpose register node. ++ req_gpr is the gpr register offset of CAN stop request. ++ req_bit is the bit offset of CAN stop request. ++ $ref: /schemas/types.yaml#/definitions/phandle-array ++ items: ++ - description: The 'gpr' is the phandle to general purpose register node. ++ - description: The 'req_gpr' is the gpr register offset of CAN stop request. ++ maximum: 0xff ++ - description: The 'req_bit' is the bit offset of CAN stop request. ++ maximum: 0x1f ++ ++ fsl,clk-source: ++ description: | ++ Select the clock source to the CAN Protocol Engine (PE). It's SoC ++ implementation dependent. Refer to RM for detailed definition. If this ++ property is not set in device tree node then driver selects clock source 1 ++ by default. ++ 0: clock source 0 (oscillator clock) ++ 1: clock source 1 (peripheral clock) ++ $ref: /schemas/types.yaml#/definitions/uint32 ++ default: 1 ++ minimum: 0 ++ maximum: 1 ++ ++ wakeup-source: ++ $ref: /schemas/types.yaml#/definitions/flag ++ description: ++ Enable CAN remote wakeup. ++ ++required: ++ - compatible ++ - reg ++ - interrupts ++ ++additionalProperties: false ++ ++examples: ++ - | ++ can@1c000 { ++ compatible = "fsl,p1010-flexcan"; ++ reg = <0x1c000 0x1000>; ++ interrupts = <48 0x2>; ++ interrupt-parent = <&mpic>; ++ clock-frequency = <200000000>; ++ fsl,clk-source = <0>; ++ }; ++ - | ++ #include ++ ++ can@2090000 { ++ compatible = "fsl,imx6q-flexcan"; ++ reg = <0x02090000 0x4000>; ++ interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&clks 1>, <&clks 2>; ++ clock-names = "ipg", "per"; ++ fsl,stop-mode = <&gpr 0x34 28>; ++ }; +diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt +deleted file mode 100644 +index e10b6eb955e1..000000000000 +--- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt ++++ /dev/null +@@ -1,57 +0,0 @@ +-Flexcan CAN controller on Freescale's ARM and PowerPC system-on-a-chip (SOC). +- +-Required properties: +- +-- compatible : Should be "fsl,-flexcan" +- +- where is imx8qm, imx6q, imx28, imx53, imx35, imx25, p1010, +- vf610, ls1021ar2, lx2160ar1, ls1028ar1. +- +- The ls1028ar1 must be followed by lx2160ar1, e.g. +- - "fsl,ls1028ar1-flexcan", "fsl,lx2160ar1-flexcan" +- +- An implementation should also claim any of the following compatibles +- that it is fully backwards compatible with: +- +- - fsl,p1010-flexcan +- +-- reg : Offset and length of the register set for this device +-- interrupts : Interrupt tuple for this device +- +-Optional properties: +- +-- clock-frequency : The oscillator frequency driving the flexcan device +- +-- xceiver-supply: Regulator that powers the CAN transceiver +- +-- big-endian: This means the registers of FlexCAN controller are big endian. +- This is optional property.i.e. if this property is not present in +- device tree node then controller is assumed to be little endian. +- if this property is present then controller is assumed to be big +- endian. +- +-- fsl,stop-mode: register bits of stop mode control, the format is +- <&gpr req_gpr req_bit>. +- gpr is the phandle to general purpose register node. +- req_gpr is the gpr register offset of CAN stop request. +- req_bit is the bit offset of CAN stop request. +- +-- fsl,clk-source: Select the clock source to the CAN Protocol Engine (PE). +- It's SoC Implementation dependent. Refer to RM for detailed +- definition. If this property is not set in device tree node +- then driver selects clock source 1 by default. +- 0: clock source 0 (oscillator clock) +- 1: clock source 1 (peripheral clock) +- +-- wakeup-source: enable CAN remote wakeup +- +-Example: +- +- can@1c000 { +- compatible = "fsl,p1010-flexcan"; +- reg = <0x1c000 0x1000>; +- interrupts = <48 0x2>; +- interrupt-parent = <&mpic>; +- clock-frequency = <200000000>; // filled in by bootloader +- fsl,clk-source = <0>; // select clock source 0 for PE +- }; +-- +2.26.2 + diff --git a/patches.suse/dt-bindings-can-flexcan-list-supported-processors.patch b/patches.suse/dt-bindings-can-flexcan-list-supported-processors.patch new file mode 100644 index 0000000..98fa286 --- /dev/null +++ b/patches.suse/dt-bindings-can-flexcan-list-supported-processors.patch @@ -0,0 +1,39 @@ +From: Michael Walle +Date: Thu, 1 Oct 2020 11:11:29 +0200 +Subject: dt-bindings: can: flexcan: list supported processors + +Git-commit: a62fc7ff903c1620c0536b6a549d6cf044f17023 +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +The compatible is a pattern match. Explicitly list all possible values. +Also mention that the ls1028ar1 must be followed by lx2160ar1. + +Signed-off-by: Michael Walle +Link: https://lore.kernel.org/r/20201001091131.30514-2-michael@walle.cc +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + Documentation/devicetree/bindings/net/can/fsl-flexcan.txt | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt +index 94c0f8bf4deb..c6152dc2d2d0 100644 +--- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt ++++ b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt +@@ -4,6 +4,12 @@ Required properties: + + - compatible : Should be "fsl,-flexcan" + ++ where is imx8qm, imx6q, imx28, imx53, imx35, imx25, p1010, ++ vf610, ls1021ar2, lx2160ar1, ls1028ar1. ++ ++ The ls1028ar1 must be followed by lx2160ar1, e.g. ++ - "fsl,ls1028ar1-flexcan", "fsl,lx2160ar1-flexcan" ++ + An implementation should also claim any of the following compatibles + that it is fully backwards compatible with: + +-- +2.26.2 + diff --git a/patches.suse/dt-bindings-can-flexcan-remove-ack_grp-and-ack_bit-f.patch b/patches.suse/dt-bindings-can-flexcan-remove-ack_grp-and-ack_bit-f.patch new file mode 100644 index 0000000..f44cb2f --- /dev/null +++ b/patches.suse/dt-bindings-can-flexcan-remove-ack_grp-and-ack_bit-f.patch @@ -0,0 +1,52 @@ +From: Marc Kleine-Budde +Date: Sun, 14 Jun 2020 21:10:38 +0200 +Subject: dt-bindings: can: flexcan: remove ack_grp and ack_bit from + fsl,stop-mode + +Git-commit: e4245bbca91da17c7e8c026d2aecf10687519a2b +Patch-mainline: v5.10-rc1 +References: jsc#SLE-12251 + +Since commit: + + 048e3a34a2e7 can: flexcan: poll MCR_LPM_ACK instead of GPR ACK for stop mode acknowledgment + +the driver polls the IP core's internal bit MCR[LPM_ACK] as stop mode +acknowledge and not the acknowledgment on chip level. + +This means the 4th and 5th value of the property "fsl,stop-mode" isn't used +anymore. It will be removed from the driver in the next patch, so remove it +from the binding documentation. + +Link: http://lore.kernel.org/r/20201006203748.1750156-14-mkl@pengutronix.de +Fixes: 048e3a34a2e7 ("can: flexcan: poll MCR_LPM_ACK instead of GPR ACK for stop mode acknowledgment") +Cc: devicetree +Cc: Joakim Zhang +Reviewed-by: Rob Herring +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + Documentation/devicetree/bindings/net/can/fsl-flexcan.txt | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt +index c6152dc2d2d0..e10b6eb955e1 100644 +--- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt ++++ b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt +@@ -31,12 +31,10 @@ Optional properties: + endian. + + - fsl,stop-mode: register bits of stop mode control, the format is +- <&gpr req_gpr req_bit ack_gpr ack_bit>. ++ <&gpr req_gpr req_bit>. + gpr is the phandle to general purpose register node. + req_gpr is the gpr register offset of CAN stop request. + req_bit is the bit offset of CAN stop request. +- ack_gpr is the gpr register offset of CAN stop acknowledge. +- ack_bit is the bit offset of CAN stop acknowledge. + + - fsl,clk-source: Select the clock source to the CAN Protocol Engine (PE). + It's SoC Implementation dependent. Refer to RM for detailed +-- +2.26.2 + diff --git a/patches.suse/dt-bindings-can-fsl-flexcan-add-fsl-scu-index-proper.patch b/patches.suse/dt-bindings-can-fsl-flexcan-add-fsl-scu-index-proper.patch new file mode 100644 index 0000000..5a6ed2a --- /dev/null +++ b/patches.suse/dt-bindings-can-fsl-flexcan-add-fsl-scu-index-proper.patch @@ -0,0 +1,50 @@ +From: Joakim Zhang +Date: Fri, 6 Nov 2020 18:56:24 +0800 +Subject: dt-bindings: can: fsl,flexcan: add fsl,scu-index property to indicate + a resource + +Git-commit: 8b76621b8917a87a8da5fd19f615ff573abf27a3 +Patch-mainline: v5.12-rc1 +References: jsc#SLE-12251 + +For SoCs with SCU support, need setup stop mode via SCU firmware, so this +property can help indicate a resource in SCU firmware. + +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20201106105627.31061-3-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + .../devicetree/bindings/net/can/fsl,flexcan.yaml | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml +index 0d2df30f19db..fe6a949a2eab 100644 +--- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml ++++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml +@@ -110,6 +110,16 @@ properties: + description: + Enable CAN remote wakeup. + ++ fsl,scu-index: ++ description: | ++ The scu index of CAN instance. ++ For SoCs with SCU support, need setup stop mode via SCU firmware, so this ++ property can help indicate a resource. It supports up to 3 CAN instances ++ now. ++ $ref: /schemas/types.yaml#/definitions/uint8 ++ minimum: 0 ++ maximum: 2 ++ + required: + - compatible + - reg +@@ -137,4 +147,5 @@ examples: + clocks = <&clks 1>, <&clks 2>; + clock-names = "ipg", "per"; + fsl,stop-mode = <&gpr 0x34 28>; ++ fsl,scu-index = /bits/ 8 <1>; + }; +-- +2.26.2 + diff --git a/patches.suse/dt-bindings-can-fsl-flexcan-add-uint32-reference-to-.patch b/patches.suse/dt-bindings-can-fsl-flexcan-add-uint32-reference-to-.patch new file mode 100644 index 0000000..068eaa3 --- /dev/null +++ b/patches.suse/dt-bindings-can-fsl-flexcan-add-uint32-reference-to-.patch @@ -0,0 +1,37 @@ +From: Marc Kleine-Budde +Date: Wed, 11 Nov 2020 09:08:28 +0100 +Subject: dt-bindings: can: fsl,flexcan: add uint32 reference to + clock-frequency property + +Git-commit: 4e20b3a1b02eb64c10c2d2c8b7e026a679fdb1c8 +Patch-mainline: v5.11-rc1 +References: jsc#SLE-12251 + +This patch adds the missing reference to the clock-frequency property. The +driver uses a of_property_read_u32() to read the property to mark it as uint32. + +Fixes: e5ab9aa7e49b ("dt-bindings: can: flexcan: convert fsl,*flexcan bindings to yaml") +Link: https://lore.kernel.org/r/20201119073357.2858925-1-mkl@pengutronix.de +Cc: Joakim Zhang +Cc: Oleksij Rempel +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml +index 13875eab2ed6..0133d777e78e 100644 +--- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml ++++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml +@@ -57,6 +57,7 @@ properties: + - const: per + + clock-frequency: ++ $ref: /schemas/types.yaml#/definitions/uint32 + description: | + The oscillator frequency driving the flexcan device, filled in by the + boot loader. This property should only be used the used operating system +-- +2.26.2 + diff --git a/patches.suse/dt-bindings-can-fsl-flexcan-fix-fsl-clk-source-prope.patch b/patches.suse/dt-bindings-can-fsl-flexcan-fix-fsl-clk-source-prope.patch new file mode 100644 index 0000000..614010b --- /dev/null +++ b/patches.suse/dt-bindings-can-fsl-flexcan-fix-fsl-clk-source-prope.patch @@ -0,0 +1,45 @@ +From: Joakim Zhang +Date: Fri, 6 Nov 2020 18:56:23 +0800 +Subject: dt-bindings: can: fsl,flexcan: fix fsl,clk-source property + +Git-commit: 07b6b3e23cbd531977535b4d1bbef741d13af264 +Patch-mainline: v5.11-rc1 +References: jsc#SLE-12251 + +Correct fsl,clk-source example since flexcan driver uses "of_property_read_u8" +to get this property. + +Fixes: 9d733992772d ("dt-bindings: can: flexcan: add PE clock source property to device tree") +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20201106105627.31061-2-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml +index 0133d777e78e..0d2df30f19db 100644 +--- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml ++++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml +@@ -100,7 +100,7 @@ properties: + by default. + 0: clock source 0 (oscillator clock) + 1: clock source 1 (peripheral clock) +- $ref: /schemas/types.yaml#/definitions/uint32 ++ $ref: /schemas/types.yaml#/definitions/uint8 + default: 1 + minimum: 0 + maximum: 1 +@@ -125,7 +125,7 @@ examples: + interrupts = <48 0x2>; + interrupt-parent = <&mpic>; + clock-frequency = <200000000>; +- fsl,clk-source = <0>; ++ fsl,clk-source = /bits/ 8 <0>; + }; + - | + #include +-- +2.26.2 + diff --git a/patches.suse/dt-bindings-can-fsl-flexcan.yaml-fix-compatible-for-.patch b/patches.suse/dt-bindings-can-fsl-flexcan.yaml-fix-compatible-for-.patch new file mode 100644 index 0000000..b3be3ab --- /dev/null +++ b/patches.suse/dt-bindings-can-fsl-flexcan.yaml-fix-compatible-for-.patch @@ -0,0 +1,70 @@ +From: Marc Kleine-Budde +Date: Wed, 11 Nov 2020 14:05:06 +0100 +Subject: dt-bindings: can: fsl,flexcan.yaml: fix compatible for i.MX35 and + i.MX53 + +Git-commit: 3bbb73f8e60f505aced2ae820436cdacdbb19bca +Patch-mainline: v5.10-rc4 +References: jsc#SLE-12251 + +As both the i.MX35 and i.MX53 flexcan IP cores are compatible to the i.MX25, +they are listed as: + + compatible = "fsl,imx35-flexcan", "fsl,imx25-flexcan"; + +and: + + compatible = "fsl,imx53-flexcan", "fsl,imx25-flexcan"; + +in the SoC device trees. + +This patch fixes the following errors, which shows up during a dtbs_check: + +arch/arm/boot/dts/imx53-ard.dt.yaml: can@53fc8000: compatible: 'oneOf' conditional failed, one must be fixed: + ['fsl,imx53-flexcan', 'fsl,imx25-flexcan'] is too long + Additional items are not allowed ('fsl,imx25-flexcan' was unexpected) + 'fsl,imx53-flexcan' is not one of ['fsl,imx7d-flexcan', 'fsl,imx6ul-flexcan', 'fsl,imx6sx-flexcan'] + 'fsl,imx53-flexcan' is not one of ['fsl,ls1028ar1-flexcan'] + 'fsl,imx6q-flexcan' was expected + 'fsl,lx2160ar1-flexcan' was expected + From schema: Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml + +Fixes: e5ab9aa7e49b ("dt-bindings: can: flexcan: convert fsl,*flexcan bindings to yaml") +Reported-by: Rob Herring +Cc: Oleksij Rempel +Signed-off-by: Marc Kleine-Budde +Link: https://lore.kernel.org/r/20201111130507.1560881-4-mkl@pengutronix.de +[robh: drop singular fsl,imx53-flexcan and fsl,imx35-flexcan] +Signed-off-by: Rob Herring +Signed-off-by: Mian Yousaf Kaukab +--- + Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml +index 3093c22e761c..13875eab2ed6 100644 +--- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml ++++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml +@@ -20,14 +20,17 @@ properties: + - fsl,imx8qm-flexcan + - fsl,imx8mp-flexcan + - fsl,imx6q-flexcan +- - fsl,imx53-flexcan +- - fsl,imx35-flexcan + - fsl,imx28-flexcan + - fsl,imx25-flexcan + - fsl,p1010-flexcan + - fsl,vf610-flexcan + - fsl,ls1021ar2-flexcan + - fsl,lx2160ar1-flexcan ++ - items: ++ - enum: ++ - fsl,imx53-flexcan ++ - fsl,imx35-flexcan ++ - const: fsl,imx25-flexcan + - items: + - enum: + - fsl,imx7d-flexcan +-- +2.26.2 + diff --git a/patches.suse/dt-bindings-can-fsl-flexcan.yaml-fix-fsl-stop-mode.patch b/patches.suse/dt-bindings-can-fsl-flexcan.yaml-fix-fsl-stop-mode.patch new file mode 100644 index 0000000..6e28fdf --- /dev/null +++ b/patches.suse/dt-bindings-can-fsl-flexcan.yaml-fix-fsl-stop-mode.patch @@ -0,0 +1,54 @@ +From: Marc Kleine-Budde +Date: Wed, 11 Nov 2020 14:05:07 +0100 +Subject: dt-bindings: can: fsl,flexcan.yaml: fix fsl,stop-mode + +Git-commit: 49c3e714ff4391144d8bb3fa99d0b460f8dbfd86 +Patch-mainline: v5.10-rc4 +References: jsc#SLE-12251 + +The fsl,stop-mode property is a phandle-array and should consist of one phandle +and two 32 bit integers, e.g.: + + fsl,stop-mode = <&gpr 0x34 28>; + +This patch fixes the following errors, which shows up during a dtbs_check: + +arch/arm/boot/dts/imx6dl-apf6dev.dt.yaml: can@2090000: fsl,stop-mode: [[1, 52, 28]] is too short + From schema: Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml + +Fixes: e5ab9aa7e49b ("dt-bindings: can: flexcan: convert fsl,*flexcan bindings to yaml") +Reported-by: Rob Herring +Cc: Oleksij Rempel +Signed-off-by: Marc Kleine-Budde +Link: https://lore.kernel.org/r/20201111130507.1560881-5-mkl@pengutronix.de +Signed-off-by: Rob Herring +Signed-off-by: Mian Yousaf Kaukab +--- + .../devicetree/bindings/net/can/fsl,flexcan.yaml | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml +index 43df15ba8fa4..3093c22e761c 100644 +--- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml ++++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml +@@ -81,11 +81,12 @@ properties: + req_bit is the bit offset of CAN stop request. + $ref: /schemas/types.yaml#/definitions/phandle-array + items: +- - description: The 'gpr' is the phandle to general purpose register node. +- - description: The 'req_gpr' is the gpr register offset of CAN stop request. +- maximum: 0xff +- - description: The 'req_bit' is the bit offset of CAN stop request. +- maximum: 0x1f ++ items: ++ - description: The 'gpr' is the phandle to general purpose register node. ++ - description: The 'req_gpr' is the gpr register offset of CAN stop request. ++ maximum: 0xff ++ - description: The 'req_bit' is the bit offset of CAN stop request. ++ maximum: 0x1f + + fsl,clk-source: + description: | +-- +2.26.2 + diff --git a/patches.suse/dt-bindings-clock-document-the-fsl-flexspi-clk-devic.patch b/patches.suse/dt-bindings-clock-document-the-fsl-flexspi-clk-devic.patch new file mode 100644 index 0000000..5dae5ac --- /dev/null +++ b/patches.suse/dt-bindings-clock-document-the-fsl-flexspi-clk-devic.patch @@ -0,0 +1,83 @@ +From: Michael Walle +Date: Sun, 8 Nov 2020 19:51:10 +0100 +Subject: dt-bindings: clock: document the fsl-flexspi-clk device + +Git-commit: e577af82c72fa928a4ab670fe5ac2b0b7b14fceb +Patch-mainline: v5.11-rc1 +References: bsc#1182743 + +Signed-off-by: Michael Walle +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20201108185113.31377-7-michael@walle.cc +[sboyd@kernel.org: DT bindings aren't drivers] +Signed-off-by: Stephen Boyd +Signed-off-by: Mian Yousaf Kaukab +--- + .../bindings/clock/fsl,flexspi-clock.yaml | 55 +++++++++++++++++++ + 1 file changed, 55 insertions(+) + create mode 100644 Documentation/devicetree/bindings/clock/fsl,flexspi-clock.yaml + +diff --git a/Documentation/devicetree/bindings/clock/fsl,flexspi-clock.yaml b/Documentation/devicetree/bindings/clock/fsl,flexspi-clock.yaml +new file mode 100644 +index 000000000000..1fa390ee7b9b +--- /dev/null ++++ b/Documentation/devicetree/bindings/clock/fsl,flexspi-clock.yaml +@@ -0,0 +1,55 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/clock/fsl,flexspi-clock.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Freescale FlexSPI clock driver for Layerscape SoCs ++ ++maintainers: ++ - Michael Walle ++ ++description: ++ The Freescale Layerscape SoCs have a special FlexSPI clock which is ++ derived from the platform PLL. ++ ++properties: ++ compatible: ++ enum: ++ - fsl,ls1028a-flexspi-clk ++ - fsl,lx2160a-flexspi-clk ++ ++ reg: ++ maxItems: 1 ++ ++ clocks: ++ maxItems: 1 ++ ++ '#clock-cells': ++ const: 0 ++ ++ clock-output-names: ++ maxItems: 1 ++ ++required: ++ - compatible ++ - reg ++ - clocks ++ - '#clock-cells' ++ ++additionalProperties: false ++ ++examples: ++ - | ++ dcfg { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ fspi_clk: clock-controller@900 { ++ compatible = "fsl,ls1028a-flexspi-clk"; ++ reg = <0x900 0x4>; ++ #clock-cells = <0>; ++ clocks = <&parentclk>; ++ clock-output-names = "fspi_clk"; ++ }; ++ }; +-- +2.26.2 + diff --git a/patches.suse/dt-bindings-firmware-add-IMX_SC_R_CAN-x-macro-for-CA.patch b/patches.suse/dt-bindings-firmware-add-IMX_SC_R_CAN-x-macro-for-CA.patch new file mode 100644 index 0000000..c98f174 --- /dev/null +++ b/patches.suse/dt-bindings-firmware-add-IMX_SC_R_CAN-x-macro-for-CA.patch @@ -0,0 +1,35 @@ +From: Joakim Zhang +Date: Fri, 6 Nov 2020 18:56:26 +0800 +Subject: dt-bindings: firmware: add IMX_SC_R_CAN(x) macro for CAN + +Git-commit: cefd754d131a65756ff6c2b428b935240c7a0a10 +Patch-mainline: v5.11-rc1 +References: jsc#SLE-12251 + +Add IMX_SC_R_CAN(x) macro for CAN. + +Suggested-by: Marc Kleine-Budde +Acked-by: Shawn Guo +Signed-off-by: Joakim Zhang +Link: https://lore.kernel.org/r/20201106105627.31061-5-qiangqing.zhang@nxp.com +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Mian Yousaf Kaukab +--- + include/dt-bindings/firmware/imx/rsrc.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/dt-bindings/firmware/imx/rsrc.h b/include/dt-bindings/firmware/imx/rsrc.h +index 54278d5c1856..43885056557c 100644 +--- a/include/dt-bindings/firmware/imx/rsrc.h ++++ b/include/dt-bindings/firmware/imx/rsrc.h +@@ -111,6 +111,7 @@ + #define IMX_SC_R_CAN_0 105 + #define IMX_SC_R_CAN_1 106 + #define IMX_SC_R_CAN_2 107 ++#define IMX_SC_R_CAN(x) (IMX_SC_R_CAN_0 + (x)) + #define IMX_SC_R_DMA_1_CH0 108 + #define IMX_SC_R_DMA_1_CH1 109 + #define IMX_SC_R_DMA_1_CH2 110 +-- +2.26.2 + diff --git a/patches.suse/exfat-add-missing-MODULE_ALIAS_FS.patch b/patches.suse/exfat-add-missing-MODULE_ALIAS_FS.patch new file mode 100644 index 0000000..f9b7db3 --- /dev/null +++ b/patches.suse/exfat-add-missing-MODULE_ALIAS_FS.patch @@ -0,0 +1,34 @@ +From cd76ac258cd92a6425cb68f95a76d6abdce5395a Mon Sep 17 00:00:00 2001 +From: Thomas Backlund +Date: Sat, 4 Apr 2020 23:29:43 +0300 +Subject: [PATCH] exfat: add missing MODULE_ALIAS_FS() +Git-commit: cd76ac258cd92a6425cb68f95a76d6abdce5395a +Patch-mainline: v5.7-rc3 +References: bsc#1182989 + +This adds the necessary MODULE_ALIAS_FS() to exfat so the module gets +automatically loaded when an exfat filesystem is mounted. + +Signed-off-by: Thomas Backlund +Signed-off-by: Namjae Jeon +Acked-by: Takashi Iwai + +--- + fs/exfat/super.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/fs/exfat/super.c b/fs/exfat/super.c +index 30e914ad17b5..86c875606024 100644 +--- a/fs/exfat/super.c ++++ b/fs/exfat/super.c +@@ -718,6 +718,7 @@ static void __exit exit_exfat_fs(void) + module_init(init_exfat_fs); + module_exit(exit_exfat_fs); + ++MODULE_ALIAS_FS("exfat"); + MODULE_LICENSE("GPL"); + MODULE_DESCRIPTION("exFAT filesystem support"); + MODULE_AUTHOR("Samsung Electronics Co., Ltd."); +-- +2.26.2 + diff --git a/patches.suse/exfat-add-the-dummy-mount-options-to-be-backward-com.patch b/patches.suse/exfat-add-the-dummy-mount-options-to-be-backward-com.patch new file mode 100644 index 0000000..9114a9e --- /dev/null +++ b/patches.suse/exfat-add-the-dummy-mount-options-to-be-backward-com.patch @@ -0,0 +1,75 @@ +From 907fa893258ba6076f5fff32900a461decb9e8c5 Mon Sep 17 00:00:00 2001 +From: Namjae Jeon +Date: Fri, 22 May 2020 08:10:10 +0900 +Subject: [PATCH] exfat: add the dummy mount options to be backward compatible with staging/exfat +Git-commit: 907fa893258ba6076f5fff32900a461decb9e8c5 +Patch-mainline: v5.7-rc7 +References: bsc#1182989 + +[ backport note: __fsparam() lines are adjusted to fit with the old 5.3 + syntax -- tiwai ] + +As Ubuntu and Fedora release new version used kernel version equal to or +higher than v5.4, They started to support kernel exfat filesystem. + +Linus reported a mount error with new version of exfat on Fedora: + + exfat: Unknown parameter 'namecase' + +This is because there is a difference in mount option between old +staging/exfat and new exfat. And utf8, debug, and codepage options as +well as namecase have been removed from new exfat. + +This patch add the dummy mount options as deprecated option to be +backward compatible with old one. + +Reported-by: Linus Torvalds +Signed-off-by: Namjae Jeon +Cc: Matthew Wilcox +Cc: Al Viro +Cc: Eric Sandeen +Signed-off-by: Linus Torvalds +Acked-by: Takashi Iwai + +--- + fs/exfat/super.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/fs/exfat/super.c ++++ b/fs/exfat/super.c +@@ -212,6 +212,12 @@ enum { + Opt_errors, + Opt_discard, + Opt_time_offset, ++ ++ /* Deprecated options */ ++ Opt_utf8, ++ Opt_debug, ++ Opt_namecase, ++ Opt_codepage, + }; + + static const struct fs_parameter_spec exfat_param_specs[] = { +@@ -225,6 +231,10 @@ static const struct fs_parameter_spec ex + fsparam_enum("errors", Opt_errors), + fsparam_flag("discard", Opt_discard), + fsparam_s32("time_offset", Opt_time_offset), ++ __fsparam(fs_param_is_flag, "utf8", Opt_utf8, fs_param_deprecated), ++ __fsparam(fs_param_is_flag, "debug", Opt_debug, fs_param_deprecated), ++ __fsparam(fs_param_is_u32, "namecase", Opt_namecase, fs_param_deprecated), ++ __fsparam(fs_param_is_u32, "codepage", Opt_codepage, fs_param_deprecated), + {} + }; + +@@ -292,6 +302,11 @@ static int exfat_parse_param(struct fs_c + return -EINVAL; + opts->time_offset = result.int_32; + break; ++ case Opt_utf8: ++ case Opt_debug: ++ case Opt_namecase: ++ case Opt_codepage: ++ break; + default: + return -EINVAL; + } diff --git a/patches.suse/fbdev-aty-SPARC64-requires-FB_ATY_CT.patch b/patches.suse/fbdev-aty-SPARC64-requires-FB_ATY_CT.patch new file mode 100644 index 0000000..d111a1a --- /dev/null +++ b/patches.suse/fbdev-aty-SPARC64-requires-FB_ATY_CT.patch @@ -0,0 +1,62 @@ +From c6c90c70db4d9a0989111d6b994d545659410f7a Mon Sep 17 00:00:00 2001 +From: Randy Dunlap +Date: Thu, 26 Nov 2020 19:17:52 -0800 +Subject: [PATCH] fbdev: aty: SPARC64 requires FB_ATY_CT +Git-commit: c6c90c70db4d9a0989111d6b994d545659410f7a +Patch-mainline: v5.12-rc1 +References: git-fixes + +It looks like SPARC64 requires FB_ATY_CT to build without errors, +so have FB_ATY select FB_ATY_CT if both SPARC64 and PCI are enabled +instead of using "default y if SPARC64 && PCI", which is not strong +enough to prevent build errors. + +As it currently is, FB_ATY_CT can be disabled, resulting in build +Errors: + +Error: modpost: "aty_postdividers" [drivers/video/fbdev/aty/atyfb.ko] undefined! +Error: modpost: "aty_ld_pll_ct" [drivers/video/fbdev/aty/atyfb.ko] undefined! + +Reviewed-by: Geert Uytterhoeven +Fixes: f7018c213502 ("video: move fbdev to drivers/video/fbdev") +Signed-off-by: Randy Dunlap +Cc: "David S. Miller" +Cc: sparclinux@vger.kernel.org +Cc: Tomi Valkeinen +Cc: dri-devel@lists.freedesktop.org +Cc: linux-fbdev@vger.kernel.org +Cc: Daniel Vetter +Cc: David Airlie +Cc: Bartlomiej Zolnierkiewicz +Cc: Geert Uytterhoeven +Signed-off-by: Daniel Vetter +Link: https://patchwork.freedesktop.org/patch/msgid/20201127031752.10371-1-rdunlap@infradead.org +Acked-by: Takashi Iwai + +--- + drivers/video/fbdev/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig +index cfb7f5612ef0..4f02db65dede 100644 +--- a/drivers/video/fbdev/Kconfig ++++ b/drivers/video/fbdev/Kconfig +@@ -1269,6 +1269,7 @@ config FB_ATY + select FB_CFB_IMAGEBLIT + select FB_BACKLIGHT if FB_ATY_BACKLIGHT + select FB_MACMODES if PPC ++ select FB_ATY_CT if SPARC64 && PCI + help + This driver supports graphics boards with the ATI Mach64 chips. + Say Y if you have such a graphics board. +@@ -1279,7 +1280,6 @@ config FB_ATY + config FB_ATY_CT + bool "Mach64 CT/VT/GT/LT (incl. 3D RAGE) support" + depends on PCI && FB_ATY +- default y if SPARC64 && PCI + help + Say Y here to support use of ATI's 64-bit Rage boards (or other + boards based on the Mach64 CT, VT, GT, and LT chipsets) as a +-- +2.26.2 + diff --git a/patches.suse/gpiolib-acpi-Add-ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER-qui.patch b/patches.suse/gpiolib-acpi-Add-ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER-qui.patch new file mode 100644 index 0000000..35a2efa --- /dev/null +++ b/patches.suse/gpiolib-acpi-Add-ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER-qui.patch @@ -0,0 +1,68 @@ +From 62d5247d239d4b48762192a251c647d7c997616a Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Thu, 25 Feb 2021 18:33:18 +0200 +Subject: [PATCH] gpiolib: acpi: Add ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER quirk +Git-commit: 62d5247d239d4b48762192a251c647d7c997616a +Patch-mainline: v5.12-rc3 +References: git-fixes + +On some systems the ACPI tables has wrong pin number and instead of +having a relative one it provides an absolute one in the global GPIO +number space. + +Add ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER quirk to cope with such cases. + +Fixes: ba8c90c61847 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2") +Depends-on: 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip") +Signed-off-by: Andy Shevchenko +Acked-by: Mika Westerberg +Acked-by: Linus Walleij +Acked-by: Takashi Iwai + +--- + drivers/gpio/gpiolib-acpi.c | 7 ++++++- + include/linux/gpio/consumer.h | 2 ++ + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c +index 86efa2d9bf7f..0fa0127d50ec 100644 +--- a/drivers/gpio/gpiolib-acpi.c ++++ b/drivers/gpio/gpiolib-acpi.c +@@ -677,6 +677,7 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data) + if (!lookup->desc) { + const struct acpi_resource_gpio *agpio = &ares->data.gpio; + bool gpioint = agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT; ++ struct gpio_desc *desc; + u16 pin_index; + + if (lookup->info.quirks & ACPI_GPIO_QUIRK_ONLY_GPIOIO && gpioint) +@@ -689,8 +690,12 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data) + if (pin_index >= agpio->pin_table_length) + return 1; + +- lookup->desc = acpi_get_gpiod(agpio->resource_source.string_ptr, ++ if (lookup->info.quirks & ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER) ++ desc = gpio_to_desc(agpio->pin_table[pin_index]); ++ else ++ desc = acpi_get_gpiod(agpio->resource_source.string_ptr, + agpio->pin_table[pin_index]); ++ lookup->desc = desc; + lookup->info.pin_config = agpio->pin_config; + lookup->info.debounce = agpio->debounce_timeout; + lookup->info.gpioint = gpioint; +diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h +index ef49307611d2..c73b25bc9213 100644 +--- a/include/linux/gpio/consumer.h ++++ b/include/linux/gpio/consumer.h +@@ -674,6 +674,8 @@ struct acpi_gpio_mapping { + * get GpioIo type explicitly, this quirk may be used. + */ + #define ACPI_GPIO_QUIRK_ONLY_GPIOIO BIT(1) ++/* Use given pin as an absolute GPIO number in the system */ ++#define ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER BIT(2) + + unsigned int quirks; + }; +-- +2.26.2 + diff --git a/patches.suse/gpiolib-acpi-Allow-to-find-GpioInt-resource-by-name-.patch b/patches.suse/gpiolib-acpi-Allow-to-find-GpioInt-resource-by-name-.patch new file mode 100644 index 0000000..c62382f --- /dev/null +++ b/patches.suse/gpiolib-acpi-Allow-to-find-GpioInt-resource-by-name-.patch @@ -0,0 +1,108 @@ +From 809390219fb9c2421239afe5c9eb862d73978ba0 Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Thu, 25 Feb 2021 18:33:19 +0200 +Subject: [PATCH] gpiolib: acpi: Allow to find GpioInt() resource by name and index +Git-commit: 809390219fb9c2421239afe5c9eb862d73978ba0 +Patch-mainline: v5.12-rc3 +References: git-fixes + +Currently only search by index is supported. However, in some cases +we might need to pass the quirks to the acpi_dev_gpio_irq_get(). + +For this, split out acpi_dev_gpio_irq_get_by() and replace +acpi_dev_gpio_irq_get() by calling above with NULL for name parameter. + +Fixes: ba8c90c61847 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2") +Depends-on: 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip") +Signed-off-by: Andy Shevchenko +Acked-by: Mika Westerberg +Acked-by: Linus Walleij +Acked-by: Takashi Iwai + +--- + drivers/gpio/gpiolib-acpi.c | 12 ++++++++---- + include/linux/acpi.h | 10 ++++++++-- + 2 files changed, 16 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c +index 0fa0127d50ec..1aacd2a5a1fd 100644 +--- a/drivers/gpio/gpiolib-acpi.c ++++ b/drivers/gpio/gpiolib-acpi.c +@@ -945,8 +945,9 @@ struct gpio_desc *acpi_node_get_gpiod(struct fwnode_handle *fwnode, + } + + /** +- * acpi_dev_gpio_irq_get() - Find GpioInt and translate it to Linux IRQ number ++ * acpi_dev_gpio_irq_get_by() - Find GpioInt and translate it to Linux IRQ number + * @adev: pointer to a ACPI device to get IRQ from ++ * @name: optional name of GpioInt resource + * @index: index of GpioInt resource (starting from %0) + * + * If the device has one or more GpioInt resources, this function can be +@@ -956,9 +957,12 @@ struct gpio_desc *acpi_node_get_gpiod(struct fwnode_handle *fwnode, + * The function is idempotent, though each time it runs it will configure GPIO + * pin direction according to the flags in GpioInt resource. + * ++ * The function takes optional @name parameter. If the resource has a property ++ * name, then only those will be taken into account. ++ * + * Return: Linux IRQ number (> %0) on success, negative errno on failure. + */ +-int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) ++int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, int index) + { + int idx, i; + unsigned int irq_flags; +@@ -968,7 +972,7 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) + struct acpi_gpio_info info; + struct gpio_desc *desc; + +- desc = acpi_get_gpiod_by_index(adev, NULL, i, &info); ++ desc = acpi_get_gpiod_by_index(adev, name, i, &info); + + /* Ignore -EPROBE_DEFER, it only matters if idx matches */ + if (IS_ERR(desc) && PTR_ERR(desc) != -EPROBE_DEFER) +@@ -1013,7 +1017,7 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) + } + return -ENOENT; + } +-EXPORT_SYMBOL_GPL(acpi_dev_gpio_irq_get); ++EXPORT_SYMBOL_GPL(acpi_dev_gpio_irq_get_by); + + static acpi_status + acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, +diff --git a/include/linux/acpi.h b/include/linux/acpi.h +index 9f432411e988..fcdaab723916 100644 +--- a/include/linux/acpi.h ++++ b/include/linux/acpi.h +@@ -1079,19 +1079,25 @@ void __acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle, const c + #if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB) + bool acpi_gpio_get_irq_resource(struct acpi_resource *ares, + struct acpi_resource_gpio **agpio); +-int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index); ++int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, int index); + #else + static inline bool acpi_gpio_get_irq_resource(struct acpi_resource *ares, + struct acpi_resource_gpio **agpio) + { + return false; + } +-static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) ++static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, ++ const char *name, int index) + { + return -ENXIO; + } + #endif + ++static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) ++{ ++ return acpi_dev_gpio_irq_get_by(adev, NULL, index); ++} ++ + /* Device properties */ + + #ifdef CONFIG_ACPI +-- +2.26.2 + diff --git a/patches.suse/i2c-brcmstb-Fix-brcmstd_send_i2c_cmd-condition.patch b/patches.suse/i2c-brcmstb-Fix-brcmstd_send_i2c_cmd-condition.patch new file mode 100644 index 0000000..ca06cd4 --- /dev/null +++ b/patches.suse/i2c-brcmstb-Fix-brcmstd_send_i2c_cmd-condition.patch @@ -0,0 +1,40 @@ +From a1858ce0cfe31368b23ba55794e409fb57ced4a4 Mon Sep 17 00:00:00 2001 +From: Maxime Ripard +Date: Thu, 25 Feb 2021 17:11:01 +0100 +Subject: [PATCH] i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition +Git-commit: a1858ce0cfe31368b23ba55794e409fb57ced4a4 +Patch-mainline: v5.12-rc1 +References: git-fixes + +The brcmstb_send_i2c_cmd currently has a condition that is (CMD_RD || +CMD_WR) which always evaluates to true, while the obvious fix is to test +whether the cmd variable passed as parameter holds one of these two +values. + +Fixes: dd1aa2524bc5 ("i2c: brcmstb: Add Broadcom settop SoC i2c controller driver") +Reported-by: Dave Stevenson +Signed-off-by: Maxime Ripard +Acked-by: Florian Fainelli +Signed-off-by: Wolfram Sang +Acked-by: Takashi Iwai + +--- + drivers/i2c/busses/i2c-brcmstb.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c +index d4e0a0f6732a..ba766d24219e 100644 +--- a/drivers/i2c/busses/i2c-brcmstb.c ++++ b/drivers/i2c/busses/i2c-brcmstb.c +@@ -316,7 +316,7 @@ static int brcmstb_send_i2c_cmd(struct brcmstb_i2c_dev *dev, + goto cmd_out; + } + +- if ((CMD_RD || CMD_WR) && ++ if ((cmd == CMD_RD || cmd == CMD_WR) && + bsc_readl(dev, iic_enable) & BSC_IIC_EN_NOACK_MASK) { + rc = -EREMOTEIO; + dev_dbg(dev->device, "controller received NOACK intr for %s\n", +-- +2.26.2 + diff --git a/patches.suse/i2c-exynos5-Preserve-high-speed-master-code.patch b/patches.suse/i2c-exynos5-Preserve-high-speed-master-code.patch new file mode 100644 index 0000000..0932520 --- /dev/null +++ b/patches.suse/i2c-exynos5-Preserve-high-speed-master-code.patch @@ -0,0 +1,58 @@ +From f4ff0104d4c807a7f96aa3358c03d694895ee8ea Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?M=C3=A5rten=20Lindahl?= +Date: Tue, 16 Feb 2021 23:25:38 +0100 +Subject: [PATCH] i2c: exynos5: Preserve high speed master code +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: f4ff0104d4c807a7f96aa3358c03d694895ee8ea +Patch-mainline: v5.12-rc1 +References: git-fixes + +When the driver starts to send a message with the MASTER_ID field +set (high speed), the whole I2C_ADDR register is overwritten including +MASTER_ID as the SLV_ADDR_MAS field is set. + +This patch preserves already written fields in I2C_ADDR when writing +SLV_ADDR_MAS. + +Fixes: 8a73cd4cfa15 ("i2c: exynos5: add High Speed I2C controller driver") +Signed-off-by: MÃ¥rten Lindahl +Reviewed-by: Krzysztof Kozlowski +Tested-by: Krzysztof Kozlowski +Signed-off-by: Wolfram Sang +Acked-by: Takashi Iwai + +--- + drivers/i2c/busses/i2c-exynos5.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c +index 20a9881a0d6c..5ac30d95650c 100644 +--- a/drivers/i2c/busses/i2c-exynos5.c ++++ b/drivers/i2c/busses/i2c-exynos5.c +@@ -606,6 +606,7 @@ static void exynos5_i2c_message_start(struct exynos5_i2c *i2c, int stop) + u32 i2c_ctl; + u32 int_en = 0; + u32 i2c_auto_conf = 0; ++ u32 i2c_addr = 0; + u32 fifo_ctl; + unsigned long flags; + unsigned short trig_lvl; +@@ -640,7 +641,12 @@ static void exynos5_i2c_message_start(struct exynos5_i2c *i2c, int stop) + int_en |= HSI2C_INT_TX_ALMOSTEMPTY_EN; + } + +- writel(HSI2C_SLV_ADDR_MAS(i2c->msg->addr), i2c->regs + HSI2C_ADDR); ++ i2c_addr = HSI2C_SLV_ADDR_MAS(i2c->msg->addr); ++ ++ if (i2c->op_clock >= I2C_MAX_FAST_MODE_PLUS_FREQ) ++ i2c_addr |= HSI2C_MASTER_ID(MASTER_ID(i2c->adap.nr)); ++ ++ writel(i2c_addr, i2c->regs + HSI2C_ADDR); + + writel(fifo_ctl, i2c->regs + HSI2C_FIFO_CTL); + writel(i2c_ctl, i2c->regs + HSI2C_CTL); +-- +2.26.2 + diff --git a/patches.suse/ibmvnic-Fix-possibly-uninitialized-old_num_tx_queues.patch b/patches.suse/ibmvnic-Fix-possibly-uninitialized-old_num_tx_queues.patch new file mode 100644 index 0000000..ed16056 --- /dev/null +++ b/patches.suse/ibmvnic-Fix-possibly-uninitialized-old_num_tx_queues.patch @@ -0,0 +1,55 @@ +From 6881b07fdd24850def1f03761c66042b983ff86e Mon Sep 17 00:00:00 2001 +From: Michal Suchanek +Date: Tue, 2 Mar 2021 20:47:47 +0100 +Subject: [PATCH] ibmvnic: Fix possibly uninitialized old_num_tx_queues + variable warning. + +References: jsc#SLE-17268 +Patch-mainline: queued +Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git +Git-commit: 6881b07fdd24850def1f03761c66042b983ff86e + +GCC 7.5 reports: +../drivers/net/ethernet/ibm/ibmvnic.c: In function 'ibmvnic_reset_init': +../drivers/net/ethernet/ibm/ibmvnic.c:5373:51: warning: 'old_num_tx_queues' may be used uninitialized in this function [-Wmaybe-uninitialized] +../drivers/net/ethernet/ibm/ibmvnic.c:5373:6: warning: 'old_num_rx_queues' may be used uninitialized in this function [-Wmaybe-uninitialized] + +The variable is initialized only if(reset) and used only if(reset && +something) so this is a false positive. However, there is no reason to +not initialize the variables unconditionally avoiding the warning. + +Fixes: 635e442f4a48 ("ibmvnic: merge ibmvnic_reset_init and ibmvnic_init") +Signed-off-by: Michal Suchanek +Reviewed-by: Sukadev Bhattiprolu +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/ibm/ibmvnic.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c +index 118a4bd3f877..3bad762083c5 100644 +--- a/drivers/net/ethernet/ibm/ibmvnic.c ++++ b/drivers/net/ethernet/ibm/ibmvnic.c +@@ -5219,16 +5219,14 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter, bool reset) + { + struct device *dev = &adapter->vdev->dev; + unsigned long timeout = msecs_to_jiffies(20000); +- u64 old_num_rx_queues, old_num_tx_queues; ++ u64 old_num_rx_queues = adapter->req_rx_queues; ++ u64 old_num_tx_queues = adapter->req_tx_queues; + int rc; + + adapter->from_passive_init = false; + +- if (reset) { +- old_num_rx_queues = adapter->req_rx_queues; +- old_num_tx_queues = adapter->req_tx_queues; ++ if (reset) + reinit_completion(&adapter->init_done); +- } + + adapter->init_done_rc = 0; + rc = ibmvnic_send_crq_init(adapter); +-- +2.26.2 + diff --git a/patches.suse/ibmvnic-fix-a-race-between-open-and-reset.patch b/patches.suse/ibmvnic-fix-a-race-between-open-and-reset.patch index 88e91a3..766aa80 100644 --- a/patches.suse/ibmvnic-fix-a-race-between-open-and-reset.patch +++ b/patches.suse/ibmvnic-fix-a-race-between-open-and-reset.patch @@ -4,8 +4,7 @@ Date: Tue, 23 Feb 2021 21:02:29 -0800 Subject: [PATCH] ibmvnic: fix a race between open and reset References: bsc#1176855 ltc#187293 -Patch-mainline: queued -Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git +Patch-mainline: v5.12-rc1 Git-commit: 8f1c0fd2c84c8bf738b7139d09d4ea53027f47c3 __ibmvnic_reset() currently reads the adapter->state before getting the diff --git a/patches.suse/ice-Fix-state-bits-on-LLDP-mode-switch.patch b/patches.suse/ice-Fix-state-bits-on-LLDP-mode-switch.patch new file mode 100644 index 0000000..c19de13 --- /dev/null +++ b/patches.suse/ice-Fix-state-bits-on-LLDP-mode-switch.patch @@ -0,0 +1,79 @@ +From: Dave Ertman +Date: Fri, 20 Nov 2020 16:38:35 -0800 +Subject: ice: Fix state bits on LLDP mode switch +Patch-mainline: v5.12-rc1 +Git-commit: 0d4907f65dc8fc5e897ad19956fca1acb3b33bc8 +References: jsc#SLE-7926 + +DCBX_CAP bits were not being adjusted when switching +between SW and FW controlled LLDP. + +Adjust bits to correctly indicate which mode the +LLDP logic is in. + +Fixes: b94b013eb626 ("ice: Implement DCBNL support") +Signed-off-by: Dave Ertman +Tested-by: Tony Brelinski +Signed-off-by: Tony Nguyen +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/intel/ice/ice.h | 2 -- + drivers/net/ethernet/intel/ice/ice_dcb_nl.c | 4 ++++ + drivers/net/ethernet/intel/ice/ice_ethtool.c | 7 +++++++ + 3 files changed, 11 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/intel/ice/ice.h ++++ b/drivers/net/ethernet/intel/ice/ice.h +@@ -445,9 +445,7 @@ struct ice_pf { + struct ice_hw_port_stats stats_prev; + struct ice_hw hw; + u8 stat_prev_loaded:1; /* has previous stats been loaded */ +-#ifdef CONFIG_DCB + u16 dcbx_cap; +-#endif /* CONFIG_DCB */ + u32 tx_timeout_count; + unsigned long tx_timeout_last_recovery; + u32 tx_timeout_recovery_level; +--- a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c ++++ b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c +@@ -160,6 +160,10 @@ static u8 ice_dcbnl_setdcbx(struct net_d + { + struct ice_pf *pf = ice_netdev_to_pf(netdev); + ++ /* if FW LLDP agent is running, DCBNL not allowed to change mode */ ++ if (test_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags)) ++ return ICE_DCB_NO_HW_CHG; ++ + /* No support for LLD_MANAGED modes or CEE+IEEE */ + if ((mode & DCB_CAP_DCBX_LLD_MANAGED) || + ((mode & DCB_CAP_DCBX_VER_IEEE) && (mode & DCB_CAP_DCBX_VER_CEE)) || +--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c ++++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c +@@ -8,6 +8,7 @@ + #include "ice_fltr.h" + #include "ice_lib.h" + #include "ice_dcb_lib.h" ++#include + + struct ice_stats { + char stat_string[ETH_GSTRING_LEN]; +@@ -1239,6 +1240,9 @@ static int ice_set_priv_flags(struct net + status = ice_init_pf_dcb(pf, true); + if (status) + dev_warn(dev, "Fail to init DCB\n"); ++ ++ pf->dcbx_cap &= ~DCB_CAP_DCBX_LLD_MANAGED; ++ pf->dcbx_cap |= DCB_CAP_DCBX_HOST; + } else { + enum ice_status status; + bool dcbx_agent_status; +@@ -1281,6 +1285,9 @@ static int ice_set_priv_flags(struct net + if (status) + dev_dbg(dev, "Fail to enable MIB change events\n"); + ++ pf->dcbx_cap &= ~DCB_CAP_DCBX_HOST; ++ pf->dcbx_cap |= DCB_CAP_DCBX_LLD_MANAGED; ++ + ice_nway_reset(netdev); + } + } diff --git a/patches.suse/ice-Set-trusted-VF-as-default-VSI-when-setting-allmu.patch b/patches.suse/ice-Set-trusted-VF-as-default-VSI-when-setting-allmu.patch new file mode 100644 index 0000000..67643b3 --- /dev/null +++ b/patches.suse/ice-Set-trusted-VF-as-default-VSI-when-setting-allmu.patch @@ -0,0 +1,35 @@ +From: Brett Creeley +Date: Thu, 17 Sep 2020 13:13:37 -0700 +Subject: ice: Set trusted VF as default VSI when setting allmulti on +Patch-mainline: v5.12-rc1 +Git-commit: 37b52be260024069f7f5bdcf304b5d72f77b022a +References: jsc#SLE-12878 + +Currently the PF will only set a trusted VF as the default VSI when it +requests FLAG_VF_UNICAST_PROMISC over VIRTCHNL. However, when +FLAG_VF_MULTICAST_PROMISC is set it's expected that the trusted VF will +see multicast packets that don't have a matching destination MAC in the +devices internal switch. Fix this by setting the trusted VF as the +default VSI if either FLAG_VF_UNICAST_PROMISC or +FLAG_VF_MULTICAST_PROMISC is set. + +Fixes: 01b5e89aab49 ("ice: Add VF promiscuous support") +Signed-off-by: Brett Creeley +Tested-by: Tony Brelinski +Signed-off-by: Tony Nguyen +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c ++++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +@@ -2380,7 +2380,7 @@ static int ice_vc_cfg_promiscuous_mode_m + } + + if (!test_bit(ICE_FLAG_VF_TRUE_PROMISC_ENA, pf->flags)) { +- bool set_dflt_vsi = !!(info->flags & FLAG_VF_UNICAST_PROMISC); ++ bool set_dflt_vsi = alluni || allmulti; + + if (set_dflt_vsi && !ice_is_dflt_vsi_in_use(pf->first_sw)) + /* only attempt to set the default forwarding VSI if diff --git a/patches.suse/ice-log-message-when-trusted-VF-goes-in-out-of-promi.patch b/patches.suse/ice-log-message-when-trusted-VF-goes-in-out-of-promi.patch new file mode 100644 index 0000000..cfe33bd --- /dev/null +++ b/patches.suse/ice-log-message-when-trusted-VF-goes-in-out-of-promi.patch @@ -0,0 +1,92 @@ +From: Brett Creeley +Date: Thu, 17 Sep 2020 13:13:36 -0700 +Subject: ice: log message when trusted VF goes in/out of promisc mode +Patch-mainline: v5.12-rc1 +Git-commit: 382e0a6880e78e1ab7b5930f871f36c695d1d92a +References: jsc#SLE-12878 + +Currently there is no message printed on the host when a VF goes in and +out of promiscuous mode. This is causing confusion because this is the +expected behavior based on i40e. Fix this. + +Signed-off-by: Brett Creeley +Tested-by: Tony Brelinski +Signed-off-by: Tony Nguyen +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 34 +++++++++++++---------- + 1 file changed, 20 insertions(+), 14 deletions(-) + +--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c ++++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +@@ -2312,12 +2312,12 @@ bool ice_is_any_vf_in_promisc(struct ice + static int ice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg) + { + enum virtchnl_status_code v_ret = VIRTCHNL_STATUS_SUCCESS; ++ bool rm_promisc, alluni = false, allmulti = false; + struct virtchnl_promisc_info *info = + (struct virtchnl_promisc_info *)msg; + struct ice_pf *pf = vf->pf; + struct ice_vsi *vsi; + struct device *dev; +- bool rm_promisc; + int ret = 0; + + if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) { +@@ -2344,8 +2344,13 @@ static int ice_vc_cfg_promiscuous_mode_m + goto error_param; + } + +- rm_promisc = !(info->flags & FLAG_VF_UNICAST_PROMISC) && +- !(info->flags & FLAG_VF_MULTICAST_PROMISC); ++ if (info->flags & FLAG_VF_UNICAST_PROMISC) ++ alluni = true; ++ ++ if (info->flags & FLAG_VF_MULTICAST_PROMISC) ++ allmulti = true; ++ ++ rm_promisc = !allmulti && !alluni; + + if (vsi->num_vlan || vf->port_vlan_info) { + struct ice_vsi *pf_vsi = ice_get_main_vsi(pf); +@@ -2399,12 +2404,12 @@ static int ice_vc_cfg_promiscuous_mode_m + enum ice_status status; + u8 promisc_m; + +- if (info->flags & FLAG_VF_UNICAST_PROMISC) { ++ if (alluni) { + if (vf->port_vlan_info || vsi->num_vlan) + promisc_m = ICE_UCAST_VLAN_PROMISC_BITS; + else + promisc_m = ICE_UCAST_PROMISC_BITS; +- } else if (info->flags & FLAG_VF_MULTICAST_PROMISC) { ++ } else if (allmulti) { + if (vf->port_vlan_info || vsi->num_vlan) + promisc_m = ICE_MCAST_VLAN_PROMISC_BITS; + else +@@ -2432,15 +2437,16 @@ static int ice_vc_cfg_promiscuous_mode_m + } + } + +- if (info->flags & FLAG_VF_MULTICAST_PROMISC) +- set_bit(ICE_VF_STATE_MC_PROMISC, vf->vf_states); +- else +- clear_bit(ICE_VF_STATE_MC_PROMISC, vf->vf_states); +- +- if (info->flags & FLAG_VF_UNICAST_PROMISC) +- set_bit(ICE_VF_STATE_UC_PROMISC, vf->vf_states); +- else +- clear_bit(ICE_VF_STATE_UC_PROMISC, vf->vf_states); ++ if (allmulti && ++ !test_and_set_bit(ICE_VF_STATE_MC_PROMISC, vf->vf_states)) ++ dev_info(dev, "VF %u successfully set multicast promiscuous mode\n", vf->vf_id); ++ else if (!allmulti && test_and_clear_bit(ICE_VF_STATE_MC_PROMISC, vf->vf_states)) ++ dev_info(dev, "VF %u successfully unset multicast promiscuous mode\n", vf->vf_id); ++ ++ if (alluni && !test_and_set_bit(ICE_VF_STATE_UC_PROMISC, vf->vf_states)) ++ dev_info(dev, "VF %u successfully set unicast promiscuous mode\n", vf->vf_id); ++ else if (!alluni && test_and_clear_bit(ICE_VF_STATE_UC_PROMISC, vf->vf_states)) ++ dev_info(dev, "VF %u successfully unset unicast promiscuous mode\n", vf->vf_id); + + error_param: + return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE, diff --git a/patches.suse/ice-report-correct-max-number-of-TCs.patch b/patches.suse/ice-report-correct-max-number-of-TCs.patch new file mode 100644 index 0000000..87adc15 --- /dev/null +++ b/patches.suse/ice-report-correct-max-number-of-TCs.patch @@ -0,0 +1,35 @@ +From: Dave Ertman +Date: Wed, 2 Sep 2020 08:53:44 -0700 +Subject: ice: report correct max number of TCs +Patch-mainline: v5.12-rc1 +Git-commit: 7dcf7aa01c7b9f18727cbe0f9cb4136f1c6cdcc2 +References: jsc#SLE-7926 + +In the driver currently, we are reporting max number of TCs +to the DCBNL callback as a kernel define set to 8. This is +preventing userspace applications performing DCBx to correctly +down map the TCs from requested to actual values. + +Report the actual max TC value to userspace from the capability +struct. + +Fixes: b94b013eb626 ("ice: Implement DCBNL support") +Signed-off-by: Dave Ertman +Tested-by: Tony Brelinski +Signed-off-by: Tony Nguyen +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/intel/ice/ice_dcb_nl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c ++++ b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c +@@ -139,7 +139,7 @@ ice_dcbnl_getnumtcs(struct net_device *d + if (!test_bit(ICE_FLAG_DCB_CAPABLE, pf->flags)) + return -EINVAL; + +- *num = IEEE_8021QAZ_MAX_TCS; ++ *num = pf->hw.func_caps.common_cap.maxtc; + return 0; + } + diff --git a/patches.suse/ice-update-the-number-of-available-RSS-queues.patch b/patches.suse/ice-update-the-number-of-available-RSS-queues.patch new file mode 100644 index 0000000..98b073b --- /dev/null +++ b/patches.suse/ice-update-the-number-of-available-RSS-queues.patch @@ -0,0 +1,76 @@ +From: Henry Tieman +Date: Thu, 3 Dec 2020 09:20:24 -0800 +Subject: ice: update the number of available RSS queues +Patch-mainline: v5.12-rc1 +Git-commit: 0393e46ac48a6832b1011c233ebcef84f8dbe4f5 +References: jsc#SLE-7926 + +It was possible to have Rx queues that were not available for use +by RSS. This would happen when increasing the number of Rx queues +while there was a user defined RSS LUT. + +Always update the number of available RSS queues when changing the +number of Rx queues. + +Fixes: 87324e747fde ("ice: Implement ethtool ops for channels") +Signed-off-by: Henry Tieman +Tested-by: Tony Brelinski +Signed-off-by: Tony Nguyen +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/intel/ice/ice_ethtool.c | 27 +++++++++++++++++++-------- + 1 file changed, 19 insertions(+), 8 deletions(-) + +--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c ++++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c +@@ -3330,6 +3330,18 @@ ice_get_channels(struct net_device *dev, + } + + /** ++ * ice_get_valid_rss_size - return valid number of RSS queues ++ * @hw: pointer to the HW structure ++ * @new_size: requested RSS queues ++ */ ++static int ice_get_valid_rss_size(struct ice_hw *hw, int new_size) ++{ ++ struct ice_hw_common_caps *caps = &hw->func_caps.common_cap; ++ ++ return min_t(int, new_size, BIT(caps->rss_table_entry_width)); ++} ++ ++/** + * ice_vsi_set_dflt_rss_lut - set default RSS LUT with requested RSS size + * @vsi: VSI to reconfigure RSS LUT on + * @req_rss_size: requested range of queue numbers for hashing +@@ -3356,14 +3368,10 @@ static int ice_vsi_set_dflt_rss_lut(stru + return -ENOMEM; + + /* set RSS LUT parameters */ +- if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) { ++ if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) + vsi->rss_size = 1; +- } else { +- struct ice_hw_common_caps *caps = &hw->func_caps.common_cap; +- +- vsi->rss_size = min_t(int, req_rss_size, +- BIT(caps->rss_table_entry_width)); +- } ++ else ++ vsi->rss_size = ice_get_valid_rss_size(hw, req_rss_size); + + /* create/set RSS LUT */ + ice_fill_rss_lut(lut, vsi->rss_table_size, vsi->rss_size); +@@ -3442,9 +3450,12 @@ static int ice_set_channels(struct net_d + + ice_vsi_recfg_qs(vsi, new_rx, new_tx); + +- if (new_rx && !netif_is_rxfh_configured(dev)) ++ if (!netif_is_rxfh_configured(dev)) + return ice_vsi_set_dflt_rss_lut(vsi, new_rx); + ++ /* Update rss_size due to change in Rx queues */ ++ vsi->rss_size = ice_get_valid_rss_size(&pf->hw, new_rx); ++ + return 0; + } + diff --git a/patches.suse/kernel-smp-Provide-CSD-lock-timeout-diagnostics.patch b/patches.suse/kernel-smp-Provide-CSD-lock-timeout-diagnostics.patch new file mode 100644 index 0000000..3441d18 --- /dev/null +++ b/patches.suse/kernel-smp-Provide-CSD-lock-timeout-diagnostics.patch @@ -0,0 +1,240 @@ +Patch-mainline: v5.10-rc1 +Git-commit: 35feb60474bf4f7fa7840e14fc7fd344996b919d +References: bsc#1180846 +From: "Paul E. McKenney" +Date: Tue, 30 Jun 2020 13:22:54 -0700 +Subject: [PATCH] kernel/smp: Provide CSD lock timeout diagnostics + +This commit causes csd_lock_wait() to emit diagnostics when a CPU +fails to respond quickly enough to one of the smp_call_function() +family of function calls. These diagnostics are enabled by a new +CSD_LOCK_WAIT_DEBUG Kconfig option that depends on DEBUG_KERNEL. + +This commit was inspired by an earlier patch by Josef Bacik. + +[ paulmck: Fix for syzbot+0f719294463916a3fc0e@syzkaller.appspotmail.com ] +[ paulmck: Fix KASAN use-after-free issue reported by Qian Cai. ] +[ paulmck: Fix botched nr_cpu_ids comparison per Dan Carpenter. ] +[ paulmck: Apply Peter Zijlstra feedback. ] +Link: https://lore.kernel.org/lkml/00000000000042f21905a991ecea@google.com +Link: https://lore.kernel.org/lkml/0000000000002ef21705a9933cf3@google.com +Cc: Peter Zijlstra +Cc: Ingo Molnar +Cc: Thomas Gleixner +Cc: Sebastian Andrzej Siewior +Signed-off-by: Paul E. McKenney +Signed-off-by: Juergen Gross +--- + kernel/smp.c | 132 +++++++++++++++++++++++++++++++++++++++++++++- + lib/Kconfig.debug | 11 ++++ + 2 files changed, 141 insertions(+), 2 deletions(-) + +diff --git a/kernel/smp.c b/kernel/smp.c +index 865a876f83ce..c5d31885bd30 100644 +--- a/kernel/smp.c ++++ b/kernel/smp.c +@@ -20,6 +20,9 @@ + #include + #include + #include ++#include ++#include ++#include + + #include "smpboot.h" + +@@ -97,6 +100,90 @@ void __init call_function_init(void) + smpcfd_prepare_cpu(smp_processor_id()); + } + ++#ifdef CONFIG_CSD_LOCK_WAIT_DEBUG ++ ++static DEFINE_PER_CPU(call_single_data_t *, cur_csd); ++static DEFINE_PER_CPU(smp_call_func_t, cur_csd_func); ++static DEFINE_PER_CPU(void *, cur_csd_info); ++ ++#define CSD_LOCK_TIMEOUT (5ULL * NSEC_PER_SEC) ++atomic_t csd_bug_count = ATOMIC_INIT(0); ++ ++/* Record current CSD work for current CPU, NULL to erase. */ ++static void csd_lock_record(call_single_data_t *csd) ++{ ++ if (!csd) { ++ smp_mb(); /* NULL cur_csd after unlock. */ ++ __this_cpu_write(cur_csd, NULL); ++ return; ++ } ++ __this_cpu_write(cur_csd_func, csd->func); ++ __this_cpu_write(cur_csd_info, csd->info); ++ smp_wmb(); /* func and info before csd. */ ++ __this_cpu_write(cur_csd, csd); ++ smp_mb(); /* Update cur_csd before function call. */ ++ /* Or before unlock, as the case may be. */ ++} ++ ++/* ++ * Complain if too much time spent waiting. ++ */ ++static __always_inline bool csd_lock_wait_toolong(call_single_data_t *csd, u64 ts0, u64 *ts1, int *bug_id) ++{ ++ int cpu = -1; ++ int cpux; ++ bool firsttime; ++ u64 ts2, ts_delta; ++ call_single_data_t *cpu_cur_csd; ++ unsigned int flags = READ_ONCE(csd->flags); ++ ++ if (!(flags & CSD_FLAG_LOCK)) { ++ if (!unlikely(*bug_id)) ++ return true; ++ pr_alert("csd: CSD lock (#%d) got unstuck on CPU#%02d, CPU#%02d released the lock.\n", ++ *bug_id, raw_smp_processor_id(), csd->dst); ++ return true; ++ } ++ ++ ts2 = sched_clock(); ++ ts_delta = ts2 - *ts1; ++ if (likely(ts_delta <= CSD_LOCK_TIMEOUT)) ++ return false; ++ ++ firsttime = !*bug_id; ++ if (firsttime) ++ *bug_id = atomic_inc_return(&csd_bug_count); ++ cpu = csd->dst; ++ if (WARN_ONCE(cpu < 0 || cpu >= nr_cpu_ids, "%s: cpu = %d\n", __func__, cpu)) ++ cpux = 0; ++ else ++ cpux = cpu; ++ cpu_cur_csd = smp_load_acquire(&per_cpu(cur_csd, cpux)); /* Before func and info. */ ++ pr_alert("csd: %s non-responsive CSD lock (#%d) on CPU#%d, waiting %llu ns for CPU#%02d %pS(%ps).\n", ++ firsttime ? "Detected" : "Continued", *bug_id, raw_smp_processor_id(), ts2 - ts0, ++ cpu, csd->func, csd->info); ++ if (cpu_cur_csd && csd != cpu_cur_csd) { ++ pr_alert("\tcsd: CSD lock (#%d) handling prior %pS(%ps) request.\n", ++ *bug_id, READ_ONCE(per_cpu(cur_csd_func, cpux)), ++ READ_ONCE(per_cpu(cur_csd_info, cpux))); ++ } else { ++ pr_alert("\tcsd: CSD lock (#%d) %s.\n", ++ *bug_id, !cpu_cur_csd ? "unresponsive" : "handling this request"); ++ } ++ if (cpu >= 0) { ++ if (!trigger_single_cpu_backtrace(cpu)) ++ dump_cpu_task(cpu); ++ if (!cpu_cur_csd) { ++ pr_alert("csd: Re-sending CSD lock (#%d) IPI from CPU#%02d to CPU#%02d\n", *bug_id, raw_smp_processor_id(), cpu); ++ arch_send_call_function_single_ipi(cpu); ++ } ++ } ++ dump_stack(); ++ *ts1 = ts2; ++ ++ return false; ++} ++ + /* + * csd_lock/csd_unlock used to serialize access to per-cpu csd resources + * +@@ -104,10 +191,30 @@ void __init call_function_init(void) + * previous function call. For multi-cpu calls its even more interesting + * as we'll have to ensure no other cpu is observing our csd. + */ ++static __always_inline void csd_lock_wait(call_single_data_t *csd) ++{ ++ int bug_id = 0; ++ u64 ts0, ts1; ++ ++ ts1 = ts0 = sched_clock(); ++ for (;;) { ++ if (csd_lock_wait_toolong(csd, ts0, &ts1, &bug_id)) ++ break; ++ cpu_relax(); ++ } ++ smp_acquire__after_ctrl_dep(); ++} ++ ++#else ++static void csd_lock_record(call_single_data_t *csd) ++{ ++} ++ + static __always_inline void csd_lock_wait(call_single_data_t *csd) + { + smp_cond_load_acquire(&csd->flags, !(VAL & CSD_FLAG_LOCK)); + } ++#endif + + static __always_inline void csd_lock(call_single_data_t *csd) + { +@@ -149,9 +256,11 @@ static int generic_exec_single(int cpu, call_single_data_t *csd) + * We can unlock early even for the synchronous on-stack case, + * since we're doing this from the same CPU.. + */ ++ csd_lock_record(csd); + csd_unlock(csd); + local_irq_save(flags); + func(info); ++ csd_lock_record(NULL); + local_irq_restore(flags); + return 0; + } +@@ -164,7 +277,8 @@ int smp_call_function_single(int cpu, smp_call_func_t func, void *info, + + csd->func = func; + csd->info = info; +-#ifdef CONFIG_64BIT ++#ifdef CONFIG_CSD_LOCK_WAIT_DEBUG ++ csd->src = smp_processor_id(); + csd->dst = cpu; + #endif + +@@ -242,6 +351,7 @@ static void flush_smp_call_function_queue(bool warn_cpu_offline) + smp_call_func_t func = csd->func; + void *info = csd->info; + ++ csd_lock_record(csd); + /* Do we wait until *after* callback? */ + if (csd->flags & CSD_FLAG_SYNCHRONOUS) { + func(info); +@@ -250,6 +360,7 @@ static void flush_smp_call_function_queue(bool warn_cpu_offline) + csd_unlock(csd); + func(info); + } ++ csd_lock_record(NULL); + } + + /* +@@ -543,7 +657,8 @@ static void smp_call_function_many_cond(const struct cpumask *mask, + csd->flags |= CSD_FLAG_SYNCHRONOUS; + csd->func = func; + csd->info = info; +-#ifdef CONFIG_64BIT ++#ifdef CONFIG_CSD_LOCK_WAIT_DEBUG ++ csd->src = smp_processor_id(); + csd->dst = cpu; + #endif + if (llist_add(&csd->llist, &per_cpu(call_single_queue, cpu))) +diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug +index e068c3c7189a..86a35fdfe021 100644 +--- a/lib/Kconfig.debug ++++ b/lib/Kconfig.debug +@@ -1367,6 +1367,17 @@ config WW_MUTEX_SELFTEST + Say M if you want these self tests to build as a module. + Say N if you are unsure. + ++config CSD_LOCK_WAIT_DEBUG ++ bool "Debugging for csd_lock_wait(), called from smp_call_function*()" ++ depends on DEBUG_KERNEL ++ depends on 64BIT ++ default n ++ help ++ This option enables debug prints when CPUs are slow to respond ++ to the smp_call_function*() IPI wrappers. These debug prints ++ include the IPI handler function currently executing (if any) ++ and relevant stack traces. ++ + endmenu # lock debugging + + config TRACE_IRQFLAGS +-- +2.26.2 + diff --git a/patches.suse/kernel-smp-add-boot-parameter-for-controlling-CSD.patch b/patches.suse/kernel-smp-add-boot-parameter-for-controlling-CSD.patch new file mode 100644 index 0000000..77f1638 --- /dev/null +++ b/patches.suse/kernel-smp-add-boot-parameter-for-controlling-CSD.patch @@ -0,0 +1,132 @@ +Patch-mainline: Submitted, 1 Mar 2021 14:17:33, lkml +References: bsc#1180846 +From: Juergen Gross +Date: Mon, 1 Mar 2021 14:17:33 +0100 +Subject: [PATCH 1/4] kernel/smp: add boot parameter for controlling CSD + lock debugging + +Currently CSD lock debugging can be switched on and off via a kernel +config option only. Unfortunately there is at least one problem with +CSD lock handling pending for about 2 years now, which has been seen +in different environments (mostly when running virtualized under KVM +or Xen, at least once on bare metal). Multiple attempts to catch this +issue have finally led to introduction of CSD lock debug code, but +this code is not in use in most distros as it has some impact on +performance. + +In order to be able to ship kernels with CONFIG_CSD_LOCK_WAIT_DEBUG +enabled even for production use, add a boot parameter for switching +the debug functionality on. This will reduce any performance impact +of the debug coding to a bare minimum when not being used. + +Signed-off-by: Juergen Gross +--- + .../admin-guide/kernel-parameters.txt | 6 +++ + kernel/smp.c | 38 +++++++++++++++++-- + 2 files changed, 40 insertions(+), 4 deletions(-) + +diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt +index 04545725f187..31dbf7b2f0e8 100644 +--- a/Documentation/admin-guide/kernel-parameters.txt ++++ b/Documentation/admin-guide/kernel-parameters.txt +@@ -784,6 +784,12 @@ + cs89x0_media= [HW,NET] + Format: { rj45 | aui | bnc } + ++ csdlock_debug= [KNL] Enable debug add-ons of cross-cpu function call ++ handling. When switched on additional debug data is ++ printed to the console in case a hanging cpu is ++ detected and that cpu is pinged again in order to try ++ to resolve the hang situation. ++ + dasd= [HW,NET] + See header of drivers/s390/block/dasd_devmap.c. + +diff --git a/kernel/smp.c b/kernel/smp.c +index aeb0adfa0606..d5f0b21ab55e 100644 +--- a/kernel/smp.c ++++ b/kernel/smp.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + #include "smpboot.h" + +@@ -102,6 +103,20 @@ void __init call_function_init(void) + + #ifdef CONFIG_CSD_LOCK_WAIT_DEBUG + ++static DEFINE_STATIC_KEY_FALSE(csdlock_debug_enabled); ++ ++static int __init csdlock_debug(char *str) ++{ ++ unsigned int val = 0; ++ ++ get_option(&str, &val); ++ if (val) ++ static_branch_enable(&csdlock_debug_enabled); ++ ++ return 0; ++} ++early_param("csdlock_debug", csdlock_debug); ++ + static DEFINE_PER_CPU(call_single_data_t *, cur_csd); + static DEFINE_PER_CPU(smp_call_func_t, cur_csd_func); + static DEFINE_PER_CPU(void *, cur_csd_info); +@@ -110,7 +125,7 @@ static DEFINE_PER_CPU(void *, cur_csd_info); + atomic_t csd_bug_count = ATOMIC_INIT(0); + + /* Record current CSD work for current CPU, NULL to erase. */ +-static void csd_lock_record(call_single_data_t *csd) ++static void __csd_lock_record(call_single_data_t *csd) + { + if (!csd) { + smp_mb(); /* NULL cur_csd after unlock. */ +@@ -125,10 +140,16 @@ static void csd_lock_record(call_single_data_t *csd) + /* Or before unlock, as the case may be. */ + } + ++static __always_inline void csd_lock_record(call_single_data_t *csd) ++{ ++ if (static_branch_unlikely(&csdlock_debug_enabled)) ++ __csd_lock_record(csd); ++} ++ + /* + * Complain if too much time spent waiting. + */ +-static __always_inline bool csd_lock_wait_toolong(call_single_data_t *csd, u64 ts0, u64 *ts1, int *bug_id) ++static bool csd_lock_wait_toolong(call_single_data_t *csd, u64 ts0, u64 *ts1, int *bug_id) + { + int cpu = -1; + int cpux; +@@ -204,7 +225,7 @@ static __always_inline bool csd_lock_wait_toolong(call_single_data_t *csd, u64 t + * previous function call. For multi-cpu calls its even more interesting + * as we'll have to ensure no other cpu is observing our csd. + */ +-static __always_inline void csd_lock_wait(call_single_data_t *csd) ++static void __csd_lock_wait(call_single_data_t *csd) + { + int bug_id = 0; + u64 ts0, ts1; +@@ -218,6 +239,15 @@ static __always_inline void csd_lock_wait(call_single_data_t *csd) + smp_acquire__after_ctrl_dep(); + } + ++static __always_inline void csd_lock_wait(call_single_data_t *csd) ++{ ++ if (static_branch_unlikely(&csdlock_debug_enabled)) { ++ __csd_lock_wait(csd); ++ return; ++ } ++ ++ smp_cond_load_acquire(&csd->flags, !(VAL & CSD_FLAG_LOCK)); ++} + #else + static void csd_lock_record(call_single_data_t *csd) + { +-- +2.26.2 + diff --git a/patches.suse/kernel-smp-add-more-data-to-CSD-lock-debugging.patch b/patches.suse/kernel-smp-add-more-data-to-CSD-lock-debugging.patch new file mode 100644 index 0000000..a0bde90 --- /dev/null +++ b/patches.suse/kernel-smp-add-more-data-to-CSD-lock-debugging.patch @@ -0,0 +1,431 @@ +Patch-mainline: Submitted, 1 Mar 2021 14:17:33, lkml +References: bsc#1180846 +From: Juergen Gross +Date: Mon, 1 Mar 2021 14:17:33 +0100 +Subject: [PATCH 3/4] kernel/smp: add more data to CSD lock debugging + +In order to help identifying problems with IPI handling and remote +function execution add some more data to IPI debugging code. + +There have been multiple reports of cpus looping long times (many +seconds) in smp_call_function_many() waiting for another cpu executing +a function like tlb flushing. Most of these reports have been for +cases where the kernel was running as a guest on top of KVM or Xen +(there are rumours of that happening under VMWare, too, and even on +bare metal). + +Finding the root cause hasn't been successful yet, even after more than +2 years of chasing this bug by different developers. + +Commit 35feb60474bf4f7 ("kernel/smp: Provide CSD lock timeout +diagnostics") tried to address this by adding some debug code and by +issuing another IPI when a hang was detected. This helped mitigating +the problem (the repeated IPI unlocks the hang), but the root cause is +still unknown. + +Current available data suggests that either an IPI wasn't sent when it +should have been, or that the IPI didn't result in the target cpu +executing the queued function (due to the IPI not reaching the cpu, +the IPI handler not being called, or the handler not seeing the queued +request). + +Try to add more diagnostic data by introducing a global atomic counter +which is being incremented when doing critical operations (before and +after queueing a new request, when sending an IPI, and when dequeueing +a request). The counter value is stored in percpu variables which can +be printed out when a hang is detected. + +The data of the last event (consisting of sequence counter, source +cpu, target cpu, and event type) is stored in a global variable. When +a new event is to be traced, the data of the last event is stored in +the event related percpu location and the global data is updated with +the new event's data. This allows to track two events in one data +location: one by the value of the event data (the event before the +current one), and one by the location itself (the current event). + +A typical printout with a detected hang will look like this: + +csd: Detected non-responsive CSD lock (#1) on CPU#1, waiting 5000000003 ns for CPU#06 scf_handler_1+0x0/0x50(0xffffa2a881bb1410). + csd: CSD lock (#1) handling prior scf_handler_1+0x0/0x50(0xffffa2a8813823c0) request. + csd: cnt(00008cc): ffff->0000 dequeue (src cpu 0 == empty) + csd: cnt(00008cd): ffff->0006 idle + csd: cnt(0003668): 0001->0006 queue + csd: cnt(0003669): 0001->0006 ipi + csd: cnt(0003e0f): 0007->000a queue + csd: cnt(0003e10): 0001->ffff ping + csd: cnt(0003e71): 0003->0000 ping + csd: cnt(0003e72): ffff->0006 gotipi + csd: cnt(0003e73): ffff->0006 handle + csd: cnt(0003e74): ffff->0006 dequeue (src cpu 0 == empty) + csd: cnt(0003e7f): 0004->0006 ping + csd: cnt(0003e80): 0001->ffff pinged + csd: cnt(0003eb2): 0005->0001 noipi + csd: cnt(0003eb3): 0001->0006 queue + csd: cnt(0003eb4): 0001->0006 noipi + csd: cnt now: 0003f00 + +This example (being an artificial one, produced with a previous version +of this patch without the "hdlend" event), shows that cpu#6 started to +handle an IPI (cnt 3e72-3e74), bit didn't start to handle another IPI +(sent by cpu#4, cnt 3e7f). The next request from cpu#1 for cpu#6 was +queued (3eb3), but no IPI was needed (cnt 3eb4, there was the event +from cpu#4 in the queue already). + +The idea is to print only relevant entries. Those are all events which +are associated with the hang (so sender side events for the source cpu +of the hanging request, and receiver side events for the target cpu), +and the related events just before those (for adding data needed to +identify a possible race). Printing all available data would be +possible, but this would add large amounts of data printed on larger +configurations. + +Signed-off-by: Juergen Gross +Tested-by: Paul E. McKenney +--- + .../admin-guide/kernel-parameters.txt | 4 + + kernel/smp.c | 228 +++++++++++++++++- + 2 files changed, 228 insertions(+), 4 deletions(-) + +diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt +index 31dbf7b2f0e8..80c72f8e780d 100644 +--- a/Documentation/admin-guide/kernel-parameters.txt ++++ b/Documentation/admin-guide/kernel-parameters.txt +@@ -789,6 +789,10 @@ + printed to the console in case a hanging cpu is + detected and that cpu is pinged again in order to try + to resolve the hang situation. ++ 0: disable csdlock debugging (default) ++ 1: enable basic csdlock debugging (minor impact) ++ ext: enable extended csdlock debugging (more impact, ++ but more data) + + dasd= [HW,NET] + See header of drivers/s390/block/dasd_devmap.c. +diff --git a/kernel/smp.c b/kernel/smp.c +index 6d7e6dbe33dc..1a96691dbf7f 100644 +--- a/kernel/smp.c ++++ b/kernel/smp.c +@@ -31,8 +31,59 @@ + CSD_FLAG_SYNCHRONOUS = 0x02, + }; + ++#ifdef CONFIG_CSD_LOCK_WAIT_DEBUG ++union cfd_seq_cnt { ++ u64 val; ++ struct { ++ u64 src:16; ++ u64 dst:16; ++#define CFD_SEQ_NOCPU 0xffff ++ u64 type:4; ++#define CFD_SEQ_QUEUE 0 ++#define CFD_SEQ_IPI 1 ++#define CFD_SEQ_NOIPI 2 ++#define CFD_SEQ_PING 3 ++#define CFD_SEQ_PINGED 4 ++#define CFD_SEQ_HANDLE 5 ++#define CFD_SEQ_DEQUEUE 6 ++#define CFD_SEQ_IDLE 7 ++#define CFD_SEQ_GOTIPI 8 ++#define CFD_SEQ_HDLEND 9 ++ u64 cnt:28; ++ } u; ++}; ++ ++static char *seq_type[] = { ++ [CFD_SEQ_QUEUE] = "queue", ++ [CFD_SEQ_IPI] = "ipi", ++ [CFD_SEQ_NOIPI] = "noipi", ++ [CFD_SEQ_PING] = "ping", ++ [CFD_SEQ_PINGED] = "pinged", ++ [CFD_SEQ_HANDLE] = "handle", ++ [CFD_SEQ_DEQUEUE] = "dequeue (src cpu 0 == empty)", ++ [CFD_SEQ_IDLE] = "idle", ++ [CFD_SEQ_GOTIPI] = "gotipi", ++ [CFD_SEQ_HDLEND] = "hdlend (src cpu 0 == early)", ++}; ++ ++struct cfd_seq_local { ++ u64 ping; ++ u64 pinged; ++ u64 handle; ++ u64 dequeue; ++ u64 idle; ++ u64 gotipi; ++ u64 hdlend; ++}; ++#endif ++ + struct cfd_percpu { + call_single_data_t csd; ++#ifdef CONFIG_CSD_LOCK_WAIT_DEBUG ++ u64 seq_queue; ++ u64 seq_ipi; ++ u64 seq_noipi; ++#endif + }; + + struct call_function_data { +@@ -108,12 +159,18 @@ void __init call_function_init(void) + #ifdef CONFIG_CSD_LOCK_WAIT_DEBUG + + static DEFINE_STATIC_KEY_FALSE(csdlock_debug_enabled); ++static DEFINE_STATIC_KEY_FALSE(csdlock_debug_extended); + + static int __init csdlock_debug(char *str) + { + unsigned int val = 0; + +- get_option(&str, &val); ++ if (str && !strcmp(str, "ext")) { ++ val = 1; ++ static_branch_enable(&csdlock_debug_extended); ++ } else ++ get_option(&str, &val); ++ + if (val) + static_branch_enable(&csdlock_debug_enabled); + +@@ -124,9 +181,34 @@ early_param("csdlock_debug", csdlock_debug); + static DEFINE_PER_CPU(call_single_data_t *, cur_csd); + static DEFINE_PER_CPU(smp_call_func_t, cur_csd_func); + static DEFINE_PER_CPU(void *, cur_csd_info); ++static DEFINE_PER_CPU(struct cfd_seq_local, cfd_seq_local); + + #define CSD_LOCK_TIMEOUT (5ULL * NSEC_PER_SEC) + atomic_t csd_bug_count = ATOMIC_INIT(0); ++static u64 cfd_seq; ++ ++#define CFD_SEQ(s, d, t, c) \ ++ (union cfd_seq_cnt){ .u.src = s, .u.dst = d, .u.type = t, .u.cnt = c } ++ ++static u64 cfd_seq_inc(unsigned int src, unsigned int dst, unsigned int type) ++{ ++ union cfd_seq_cnt new, old; ++ ++ new = CFD_SEQ(src, dst, type, 0); ++ ++ do { ++ old.val = READ_ONCE(cfd_seq); ++ new.u.cnt = old.u.cnt + 1; ++ } while (cmpxchg(&cfd_seq, old.val, new.val) != old.val); ++ ++ return old.val; ++} ++ ++#define cfd_seq_store(var, src, dst, type) \ ++ do { \ ++ if (static_branch_unlikely(&csdlock_debug_extended)) \ ++ var = cfd_seq_inc(src, dst, type); \ ++ } while (0) + + /* Record current CSD work for current CPU, NULL to erase. */ + static void __csd_lock_record(call_single_data_t *csd) +@@ -160,6 +242,88 @@ static __always_inline void csd_lock_record(call_single_data_t *csd) + __csd_lock_record(csd); + } + ++static void cfd_seq_data_add(u64 val, unsigned int src, unsigned int dst, ++ unsigned int type, union cfd_seq_cnt *data, ++ unsigned int *n_data, unsigned int now) ++{ ++ union cfd_seq_cnt new[2]; ++ unsigned int i, j, k; ++ ++ new[0].val = val; ++ new[1] = CFD_SEQ(src, dst, type, new[0].u.cnt + 1); ++ ++ for (i = 0; i < 2; i++) { ++ if (new[i].u.cnt <= now) ++ new[i].u.cnt |= 0x80000000U; ++ for (j = 0; j < *n_data; j++) { ++ if (new[i].u.cnt == data[j].u.cnt) { ++ /* Direct read value trumps generated one. */ ++ if (i == 0) ++ data[j].val = new[i].val; ++ break; ++ } ++ if (new[i].u.cnt < data[j].u.cnt) { ++ for (k = *n_data; k > j; k--) ++ data[k].val = data[k - 1].val; ++ data[j].val = new[i].val; ++ (*n_data)++; ++ break; ++ } ++ } ++ if (j == *n_data) { ++ data[j].val = new[i].val; ++ (*n_data)++; ++ } ++ } ++} ++ ++static const char *csd_lock_get_type(unsigned int type) ++{ ++ return (type >= ARRAY_SIZE(seq_type)) ? "?" : seq_type[type]; ++} ++ ++static void csd_lock_print_extended(call_single_data_t *csd, int cpu) ++{ ++ struct cfd_seq_local *seq = &per_cpu(cfd_seq_local, cpu); ++ unsigned int srccpu = csd->src; ++ struct call_function_data *cfd = per_cpu_ptr(&cfd_data, srccpu); ++ struct cfd_percpu *pcpu = per_cpu_ptr(cfd->pcpu, cpu); ++ unsigned int now; ++ union cfd_seq_cnt data[2 * ARRAY_SIZE(seq_type)]; ++ unsigned int n_data = 0, i; ++ ++ data[0].val = READ_ONCE(cfd_seq); ++ now = data[0].u.cnt; ++ ++ cfd_seq_data_add(pcpu->seq_queue, srccpu, cpu, ++ CFD_SEQ_QUEUE, data, &n_data, now); ++ cfd_seq_data_add(pcpu->seq_ipi, srccpu, cpu, ++ CFD_SEQ_IPI, data, &n_data, now); ++ cfd_seq_data_add(pcpu->seq_noipi, srccpu, cpu, ++ CFD_SEQ_NOIPI, data, &n_data, now); ++ cfd_seq_data_add(per_cpu(cfd_seq_local.ping, srccpu), srccpu, ++ CFD_SEQ_NOCPU, CFD_SEQ_PING, data, &n_data, now); ++ cfd_seq_data_add(per_cpu(cfd_seq_local.pinged, srccpu), srccpu, ++ CFD_SEQ_NOCPU, CFD_SEQ_PINGED, data, &n_data, now); ++ cfd_seq_data_add(seq->idle, CFD_SEQ_NOCPU, cpu, ++ CFD_SEQ_IDLE, data, &n_data, now); ++ cfd_seq_data_add(seq->gotipi, CFD_SEQ_NOCPU, cpu, ++ CFD_SEQ_GOTIPI, data, &n_data, now); ++ cfd_seq_data_add(seq->handle, CFD_SEQ_NOCPU, cpu, ++ CFD_SEQ_HANDLE, data, &n_data, now); ++ cfd_seq_data_add(seq->dequeue, CFD_SEQ_NOCPU, cpu, ++ CFD_SEQ_DEQUEUE, data, &n_data, now); ++ cfd_seq_data_add(seq->hdlend, CFD_SEQ_NOCPU, cpu, ++ CFD_SEQ_HDLEND, data, &n_data, now); ++ ++ for (i = 0; i < n_data; i++) { ++ pr_alert("\tcsd: cnt(%07x): %04x->%04x %s\n", ++ data[i].u.cnt & ~0x80000000U, data[i].u.src, ++ data[i].u.dst, csd_lock_get_type(data[i].u.type)); ++ } ++ pr_alert("\tcsd: cnt now: %07x\n", now); ++} ++ + /* + * Complain if too much time spent waiting. + */ +@@ -209,6 +373,8 @@ static bool csd_lock_wait_toolong(call_single_data_t *csd, u64 ts0, u64 *ts1, in + *bug_id, !cpu_cur_csd ? "unresponsive" : "handling this request"); + } + if (cpu >= 0) { ++ if (static_branch_unlikely(&csdlock_debug_extended)) ++ csd_lock_print_extended(csd, cpu); + if (!trigger_single_cpu_backtrace(cpu)) + dump_cpu_task(cpu); + if (!cpu_cur_csd) { +@@ -252,7 +418,27 @@ static __always_inline void csd_lock_wait(call_single_data_t *csd) + + smp_cond_load_acquire(&csd->flags, !(VAL & CSD_FLAG_LOCK)); + } ++ ++static void __smp_call_single_queue_debug(int cpu, struct llist_node *node) ++{ ++ unsigned int this_cpu = smp_processor_id(); ++ struct cfd_seq_local *seq = this_cpu_ptr(&cfd_seq_local); ++ struct call_function_data *cfd = this_cpu_ptr(&cfd_data); ++ struct cfd_percpu *pcpu = per_cpu_ptr(cfd->pcpu, cpu); ++ ++ cfd_seq_store(pcpu->seq_queue, this_cpu, cpu, CFD_SEQ_QUEUE); ++ if (llist_add(node, &per_cpu(call_single_queue, cpu))) { ++ cfd_seq_store(pcpu->seq_ipi, this_cpu, cpu, CFD_SEQ_IPI); ++ cfd_seq_store(seq->ping, this_cpu, cpu, CFD_SEQ_PING); ++ arch_send_call_function_single_ipi(cpu); ++ cfd_seq_store(seq->pinged, this_cpu, cpu, CFD_SEQ_PINGED); ++ } else { ++ cfd_seq_store(pcpu->seq_noipi, this_cpu, cpu, CFD_SEQ_NOIPI); ++ } ++} + #else ++#define cfd_seq_store(var, src, dst, type) ++ + static void csd_lock_record(call_single_data_t *csd) + { + } +@@ -335,6 +521,13 @@ static int generic_exec_single(int cpu, call_single_data_t *csd) + csd->dst = cpu; + #endif + ++#ifdef CONFIG_CSD_LOCK_WAIT_DEBUG ++ if (static_branch_unlikely(&csdlock_debug_extended)) { ++ __smp_call_single_queue_debug(cpu, &csd->llist); ++ return 0; ++ } ++#endif ++ + /* + * The list addition should be visible before sending the IPI + * handler locks the list to pull the entry off it because of +@@ -348,6 +541,8 @@ static int generic_exec_single(int cpu, call_single_data_t *csd) + */ + void generic_smp_call_function_single_interrupt(void) + { ++ cfd_seq_store(this_cpu_ptr(&cfd_seq_local)->gotipi, CFD_SEQ_NOCPU, ++ smp_processor_id(), CFD_SEQ_GOTIPI); + flush_smp_call_function_queue(true); + } + +@@ -375,7 +570,13 @@ static void flush_smp_call_function_queue(bool warn_cpu_offline) + lockdep_assert_irqs_disabled(); + + head = this_cpu_ptr(&call_single_queue); ++ cfd_seq_store(this_cpu_ptr(&cfd_seq_local)->handle, CFD_SEQ_NOCPU, ++ smp_processor_id(), CFD_SEQ_HANDLE); + entry = llist_del_all(head); ++ cfd_seq_store(this_cpu_ptr(&cfd_seq_local)->dequeue, ++ /* Special meaning of source cpu: 0 == queue empty */ ++ entry ? CFD_SEQ_NOCPU : 0, ++ smp_processor_id(), CFD_SEQ_DEQUEUE); + entry = llist_reverse_order(entry); + + /* There shouldn't be any pending callbacks on an offline CPU. */ +@@ -473,6 +678,9 @@ static void flush_smp_call_function_queue(bool warn_cpu_offline) + * for them. + */ + irq_work_run(); ++ ++ cfd_seq_store(this_cpu_ptr(&cfd_seq_local)->hdlend, CFD_SEQ_NOCPU, ++ smp_processor_id(), CFD_SEQ_HDLEND); + } + + /* +@@ -698,7 +908,8 @@ static void smp_call_function_many(const struct cpumask *mask, + + cpumask_clear(cfd->cpumask_ipi); + for_each_cpu(cpu, cfd->cpumask) { +- call_single_data_t *csd = &per_cpu_ptr(cfd->pcpu, cpu)->csd; ++ struct cfd_percpu *pcpu = per_cpu_ptr(cfd->pcpu, cpu); ++ call_single_data_t *csd = &pcpu->csd; + + csd_lock(csd); + if (wait) +@@ -712,12 +923,21 @@ static void smp_call_function_many_cond(const struct cpumask *mask, + csd->src = smp_processor_id(); + csd->dst = cpu; + #endif +- if (llist_add(&csd->llist, &per_cpu(call_single_queue, cpu))) ++ cfd_seq_store(pcpu->seq_queue, this_cpu, cpu, CFD_SEQ_QUEUE); ++ if (llist_add(&csd->llist, &per_cpu(call_single_queue, cpu))) { + __cpumask_set_cpu(cpu, cfd->cpumask_ipi); ++ cfd_seq_store(pcpu->seq_ipi, this_cpu, cpu, CFD_SEQ_IPI); ++ } else { ++ cfd_seq_store(pcpu->seq_noipi, this_cpu, cpu, CFD_SEQ_NOIPI); ++ } + } + + /* Send a message to all CPUs in the map */ ++ cfd_seq_store(this_cpu_ptr(&cfd_seq_local)->ping, this_cpu, ++ CFD_SEQ_NOCPU, CFD_SEQ_PING); + arch_send_call_function_ipi_mask(cfd->cpumask_ipi); ++ cfd_seq_store(this_cpu_ptr(&cfd_seq_local)->pinged, this_cpu, ++ CFD_SEQ_NOCPU, CFD_SEQ_PINGED); + + if (wait) { + for_each_cpu(cpu, cfd->cpumask) { +-- +2.26.2 + diff --git a/patches.suse/kernel-smp-prepare-more-CSD-lock-debugging.patch b/patches.suse/kernel-smp-prepare-more-CSD-lock-debugging.patch new file mode 100644 index 0000000..8d072ca --- /dev/null +++ b/patches.suse/kernel-smp-prepare-more-CSD-lock-debugging.patch @@ -0,0 +1,73 @@ +Patch-mainline: Submitted, 1 Mar 2021 14:17:33, lkml +References: bsc#1180846 +From: Juergen Gross +Subject: [PATCH 2/4] kernel/smp: prepare more CSD lock debugging + +In order to be able to easily add more CSD lock debugging data to +struct call_function_data->csd move the call_single_data_t element +into a sub-structure. + +Signed-off-by: Juergen Gross +--- + kernel/smp.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/kernel/smp.c b/kernel/smp.c +index d5f0b21ab55e..6d7e6dbe33dc 100644 +--- a/kernel/smp.c ++++ b/kernel/smp.c +@@ -31,8 +31,12 @@ + CSD_FLAG_SYNCHRONOUS = 0x02, + }; + ++struct cfd_percpu { ++ call_single_data_t csd; ++}; ++ + struct call_function_data { +- call_single_data_t __percpu *csd; ++ struct cfd_percpu __percpu *pcpu; + cpumask_var_t cpumask; + cpumask_var_t cpumask_ipi; + }; +@@ -55,8 +59,8 @@ int smpcfd_prepare_cpu(unsigned int cpu) + free_cpumask_var(cfd->cpumask); + return -ENOMEM; + } +- cfd->csd = alloc_percpu(call_single_data_t); +- if (!cfd->csd) { ++ cfd->pcpu = alloc_percpu(struct cfd_percpu); ++ if (!cfd->pcpu) { + free_cpumask_var(cfd->cpumask); + free_cpumask_var(cfd->cpumask_ipi); + return -ENOMEM; +@@ -71,7 +75,7 @@ int smpcfd_dead_cpu(unsigned int cpu) + + free_cpumask_var(cfd->cpumask); + free_cpumask_var(cfd->cpumask_ipi); +- free_percpu(cfd->csd); ++ free_percpu(cfd->pcpu); + return 0; + } + +@@ -694,7 +698,7 @@ static void smp_call_function_many(const struct cpumask *mask, + + cpumask_clear(cfd->cpumask_ipi); + for_each_cpu(cpu, cfd->cpumask) { +- call_single_data_t *csd = per_cpu_ptr(cfd->csd, cpu); ++ call_single_data_t *csd = &per_cpu_ptr(cfd->pcpu, cpu)->csd; + + csd_lock(csd); + if (wait) +@@ -719,7 +723,7 @@ static void smp_call_function_many(const struct cpumask *mask, + for_each_cpu(cpu, cfd->cpumask) { + call_single_data_t *csd; + +- csd = per_cpu_ptr(cfd->csd, cpu); ++ csd = &per_cpu_ptr(cfd->pcpu, cpu)->csd; + csd_lock_wait(csd); + } + } +-- +2.26.2 + diff --git a/patches.suse/kvm-tracing-fix-unmatched-kvm_entry-and-kvm_exit-events b/patches.suse/kvm-tracing-fix-unmatched-kvm_entry-and-kvm_exit-events new file mode 100644 index 0000000..e1ae3b5 --- /dev/null +++ b/patches.suse/kvm-tracing-fix-unmatched-kvm_entry-and-kvm_exit-events @@ -0,0 +1,85 @@ +From: Lorenzo Brescia +Date: Wed, 23 Dec 2020 14:45:07 +0000 +Subject: kvm: tracing: Fix unmatched kvm_entry and kvm_exit events +Git-commit: d95df9510679757bdfc22376d351cdf367b3a604 +Patch-mainline: v5.11-rc6 +References: bsc#1182770 + +On VMX, if we exit and then re-enter immediately without leaving +the vmx_vcpu_run() function, the kvm_entry event is not logged. +That means we will see one (or more) kvm_exit, without its (their) +corresponding kvm_entry, as shown here: + + CPU-1979 [002] 89.871187: kvm_entry: vcpu 1 + CPU-1979 [002] 89.871218: kvm_exit: reason MSR_WRITE + CPU-1979 [002] 89.871259: kvm_exit: reason MSR_WRITE + +It also seems possible for a kvm_entry event to be logged, but then +we leave vmx_vcpu_run() right away (if vmx->emulation_required is +true). In this case, we will have a spurious kvm_entry event in the +trace. + +Fix these situations by moving trace_kvm_entry() inside vmx_vcpu_run() +(where trace_kvm_exit() already is). + +A trace obtained with this patch applied looks like this: + + CPU-14295 [000] 8388.395387: kvm_entry: vcpu 0 + CPU-14295 [000] 8388.395392: kvm_exit: reason MSR_WRITE + CPU-14295 [000] 8388.395393: kvm_entry: vcpu 0 + CPU-14295 [000] 8388.395503: kvm_exit: reason EXTERNAL_INTERRUPT + +Of course, not calling trace_kvm_entry() in common x86 code any +longer means that we need to adjust the SVM side of things too. + +Signed-off-by: Lorenzo Brescia +Signed-off-by: Dario Faggioli +Message-Id: <160873470698.11652.13483635328769030605.stgit@Wayrath> +Signed-off-by: Paolo Bonzini +--- + arch/x86/kvm/svm/svm.c | 2 ++ + arch/x86/kvm/vmx/vmx.c | 2 ++ + arch/x86/kvm/x86.c | 3 +-- + 3 files changed, 5 insertions(+), 2 deletions(-) + +--- a/arch/x86/kvm/vmx/vmx.c ++++ b/arch/x86/kvm/vmx/vmx.c +@@ -6608,6 +6608,8 @@ + if (vmx->emulation_required) + return; + ++ trace_kvm_entry(vcpu); ++ + if (vmx->ple_window_dirty) { + vmx->ple_window_dirty = false; + vmcs_write32(PLE_WINDOW, vmx->ple_window); +--- a/arch/x86/kvm/x86.c ++++ b/arch/x86/kvm/x86.c +@@ -8113,7 +8113,6 @@ + kvm_x86_ops->request_immediate_exit(vcpu); + } + +- trace_kvm_entry(vcpu->vcpu_id); + guest_enter_irqoff(); + + fpregs_assert_state_consistent(); +@@ -10220,6 +10219,7 @@ + EXPORT_SYMBOL_GPL(kvm_arch_no_poll); + + ++EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_entry); + EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_exit); + EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_fast_mmio); + EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_inj_virq); +--- a/arch/x86/kvm/svm.c ++++ b/arch/x86/kvm/svm.c +@@ -5665,6 +5665,8 @@ + { + struct vcpu_svm *svm = to_svm(vcpu); + ++ trace_kvm_entry(vcpu); ++ + svm->vmcb->save.rax = vcpu->arch.regs[VCPU_REGS_RAX]; + svm->vmcb->save.rsp = vcpu->arch.regs[VCPU_REGS_RSP]; + svm->vmcb->save.rip = vcpu->arch.regs[VCPU_REGS_RIP]; + diff --git a/patches.suse/kvm-vmx-condition-encls-exiting-enabling-on-cpu-support-for-sgx1 b/patches.suse/kvm-vmx-condition-encls-exiting-enabling-on-cpu-support-for-sgx1 new file mode 100644 index 0000000..bb2b2a7 --- /dev/null +++ b/patches.suse/kvm-vmx-condition-encls-exiting-enabling-on-cpu-support-for-sgx1 @@ -0,0 +1,73 @@ +From: Sean Christopherson +Date: Thu, 12 Mar 2020 11:04:16 -0700 +Subject: KVM: VMX: Condition ENCLS-exiting enabling on CPU support for SGX1 +Git-commit: 7a57c09bb1cb89239f38f690b87cdf2c7db76c34 +Patch-mainline: v5.6-rc6 +References: bsc#1182798 + +Enable ENCLS-exiting (and thus set vmcs.ENCLS_EXITING_BITMAP) only if +the CPU supports SGX1. Per Intel's SDM, all ENCLS leafs #UD if SGX1 +is not supported[*], i.e. intercepting ENCLS to inject a #UD is +unnecessary. + +Avoiding ENCLS-exiting even when it is reported as supported by the CPU +works around a reported issue where SGX is "hard" disabled after an S3 +suspend/resume cycle, i.e. CPUID.0x7.SGX=0 and the VMCS field/control +are enumerated as unsupported. While the root cause of the S3 issue is +unknown, it's definitely _not_ a KVM (or kernel) bug, i.e. this is a +workaround for what is most likely a hardware or firmware issue. As a +bonus side effect, KVM saves a VMWRITE when first preparing vmcs01 and +vmcs02. + +Note, SGX must be disabled in BIOS to take advantage of this workaround + +[*] The additional ENCLS CPUID check on SGX1 exists so that SGX can be + globally "soft" disabled post-reset, e.g. if #MC bits in MCi_CTL are + cleared. Soft disabled meaning disabling SGX without clearing the + primary CPUID bit (in leaf 0x7) and without poking into non-SGX + CPU paths, e.g. for the VMCS controls. + +Fixes: 0b665d304028 ("KVM: vmx: Inject #UD for SGX ENCLS instruction in guest") +Reported-by: Toni Spets +Signed-off-by: Sean Christopherson +Signed-off-by: Paolo Bonzini +Acked-by: Dario Faggioli +--- + arch/x86/kvm/vmx/vmx.c | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c +index 40b1e6138cd5..26f8f31563e9 100644 +--- a/arch/x86/kvm/vmx/vmx.c ++++ b/arch/x86/kvm/vmx/vmx.c +@@ -2338,6 +2338,17 @@ static void hardware_disable(void) + kvm_cpu_vmxoff(); + } + ++/* ++ * There is no X86_FEATURE for SGX yet, but anyway we need to query CPUID ++ * directly instead of going through cpu_has(), to ensure KVM is trapping ++ * ENCLS whenever it's supported in hardware. It does not matter whether ++ * the host OS supports or has enabled SGX. ++ */ ++static bool cpu_has_sgx(void) ++{ ++ return cpuid_eax(0) >= 0x12 && (cpuid_eax(0x12) & BIT(0)); ++} ++ + static __init int adjust_vmx_controls(u32 ctl_min, u32 ctl_opt, + u32 msr, u32 *result) + { +@@ -2418,8 +2429,9 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf, + SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE | + SECONDARY_EXEC_PT_USE_GPA | + SECONDARY_EXEC_PT_CONCEAL_VMX | +- SECONDARY_EXEC_ENABLE_VMFUNC | +- SECONDARY_EXEC_ENCLS_EXITING; ++ SECONDARY_EXEC_ENABLE_VMFUNC; ++ if (cpu_has_sgx()) ++ opt2 |= SECONDARY_EXEC_ENCLS_EXITING; + if (adjust_vmx_controls(min2, opt2, + MSR_IA32_VMX_PROCBASED_CTLS2, + &_cpu_based_2nd_exec_control) < 0) + diff --git a/patches.suse/kvm-x86-add-rip-to-the-kvm_entry-i-e-vm-enter-tracepoint b/patches.suse/kvm-x86-add-rip-to-the-kvm_entry-i-e-vm-enter-tracepoint new file mode 100644 index 0000000..57cbca4 --- /dev/null +++ b/patches.suse/kvm-x86-add-rip-to-the-kvm_entry-i-e-vm-enter-tracepoint @@ -0,0 +1,50 @@ +From: Sean Christopherson +Date: Wed, 23 Sep 2020 13:13:43 -0700 +Subject: KVM: x86: Add RIP to the kvm_entry, i.e. VM-Enter, tracepoint +Git-commit: b2d522552ca02de3b0f72104705fb2e62fcf1ce6 +Patch-mainline: v5.10-rc1 +References: bsc#1182770 + +Add RIP to the kvm_entry tracepoint to help debug if the kvm_exit +tracepoint is disabled or if VM-Enter fails, in which case the kvm_exit +tracepoint won't be hit. + +Read RIP from within the tracepoint itself to avoid a potential VMREAD +and retpoline if the guest's RIP isn't available. + +Signed-off-by: Sean Christopherson +Message-Id: <20200923201349.16097-2-sean.j.christopherson@intel.com> +Signed-off-by: Paolo Bonzini +Acked-by: Dario Faggioli +--- + arch/x86/kvm/trace.h | 10 ++++++---- + arch/x86/kvm/x86.c | 2 +- + 2 files changed, 7 insertions(+), 5 deletions(-) + +--- a/arch/x86/kvm/trace.h ++++ b/arch/x86/kvm/trace.h +@@ -15,18 +15,20 @@ + * Tracepoint for guest mode entry. + */ + TRACE_EVENT(kvm_entry, +- TP_PROTO(unsigned int vcpu_id), +- TP_ARGS(vcpu_id), ++ TP_PROTO(struct kvm_vcpu *vcpu), ++ TP_ARGS(vcpu), + + TP_STRUCT__entry( + __field( unsigned int, vcpu_id ) ++ __field( unsigned long, rip ) + ), + + TP_fast_assign( +- __entry->vcpu_id = vcpu_id; ++ __entry->vcpu_id = vcpu->vcpu_id; ++ __entry->rip = kvm_rip_read(vcpu); + ), + +- TP_printk("vcpu %u", __entry->vcpu_id) ++ TP_printk("vcpu %u, rip 0x%lx", __entry->vcpu_id, __entry->rip) + ); + + /* diff --git a/patches.suse/kvm-x86-allocate-new-rmap-and-large-page-tracking-when-moving-memslot b/patches.suse/kvm-x86-allocate-new-rmap-and-large-page-tracking-when-moving-memslot new file mode 100644 index 0000000..2072782 --- /dev/null +++ b/patches.suse/kvm-x86-allocate-new-rmap-and-large-page-tracking-when-moving-memslot @@ -0,0 +1,103 @@ +From: Sean Christopherson +Date: Tue, 18 Feb 2020 13:07:15 -0800 +Subject: KVM: x86: Allocate new rmap and large page tracking when moving + memslot +Git-commit: edd4fa37baa6ee8e44dc65523b27bd6fe44c94de +Patch-mainline: v5.7-rc1 +References: bsc#1182800 + +Reallocate a rmap array and recalcuate large page compatibility when +moving an existing memslot to correctly handle the alignment properties +of the new memslot. The number of rmap entries required at each level +is dependent on the alignment of the memslot's base gfn with respect to +that level, e.g. moving a large-page aligned memslot so that it becomes +unaligned will increase the number of rmap entries needed at the now +unaligned level. + +Not updating the rmap array is the most obvious bug, as KVM accesses +garbage data beyond the end of the rmap. KVM interprets the bad data as +pointers, leading to non-canonical #GPs, unexpected #PFs, etc... + + general protection fault: 0000 [#1] SMP + CPU: 0 PID: 1909 Comm: move_memory_reg Not tainted 5.4.0-rc7+ #139 + Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 + RIP: 0010:rmap_get_first+0x37/0x50 [kvm] + Code: <48> 8b 3b 48 85 ff 74 ec e8 6c f4 ff ff 85 c0 74 e3 48 89 d8 5b c3 + RSP: 0018:ffffc9000021bbc8 EFLAGS: 00010246 + RAX: ffff00617461642e RBX: ffff00617461642e RCX: 0000000000000012 + RDX: ffff88827400f568 RSI: ffffc9000021bbe0 RDI: ffff88827400f570 + RBP: 0010000000000000 R08: ffffc9000021bd00 R09: ffffc9000021bda8 + R10: ffffc9000021bc48 R11: 0000000000000000 R12: 0030000000000000 + R13: 0000000000000000 R14: ffff88827427d700 R15: ffffc9000021bce8 + FS: 00007f7eda014700(0000) GS:ffff888277a00000(0000) knlGS:0000000000000000 + CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 + CR2: 00007f7ed9216ff8 CR3: 0000000274391003 CR4: 0000000000162eb0 + Call Trace: + kvm_mmu_slot_set_dirty+0xa1/0x150 [kvm] + __kvm_set_memory_region.part.64+0x559/0x960 [kvm] + kvm_set_memory_region+0x45/0x60 [kvm] + kvm_vm_ioctl+0x30f/0x920 [kvm] + do_vfs_ioctl+0xa1/0x620 + ksys_ioctl+0x66/0x70 + __x64_sys_ioctl+0x16/0x20 + do_syscall_64+0x4c/0x170 + entry_SYSCALL_64_after_hwframe+0x44/0xa9 + RIP: 0033:0x7f7ed9911f47 + Code: <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 21 6f 2c 00 f7 d8 64 89 01 48 + RSP: 002b:00007ffc00937498 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 + RAX: ffffffffffffffda RBX: 0000000001ab0010 RCX: 00007f7ed9911f47 + RDX: 0000000001ab1350 RSI: 000000004020ae46 RDI: 0000000000000004 + RBP: 000000000000000a R08: 0000000000000000 R09: 00007f7ed9214700 + R10: 00007f7ed92149d0 R11: 0000000000000246 R12: 00000000bffff000 + R13: 0000000000000003 R14: 00007f7ed9215000 R15: 0000000000000000 + Modules linked in: kvm_intel kvm irqbypass + ---[ end trace 0c5f570b3358ca89 ]--- + +The disallow_lpage tracking is more subtle. Failure to update results +in KVM creating large pages when it shouldn't, either due to stale data +or again due to indexing beyond the end of the metadata arrays, which +can lead to memory corruption and/or leaking data to guest/userspace. + +Note, the arrays for the old memslot are freed by the unconditional call +to kvm_free_memslot() in __kvm_set_memory_region(). + +Fixes: 05da45583de9b ("KVM: MMU: large page support") +Cc: stable@vger.kernel.org +Signed-off-by: Sean Christopherson +Reviewed-by: Peter Xu +Signed-off-by: Paolo Bonzini +Acked-by: Dario Faggioli +--- + arch/x86/kvm/x86.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c +index 4f026f877fc1..6387917d08ec 100644 +--- a/arch/x86/kvm/x86.c ++++ b/arch/x86/kvm/x86.c +@@ -9878,6 +9878,13 @@ int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot, + { + int i; + ++ /* ++ * Clear out the previous array pointers for the KVM_MR_MOVE case. The ++ * old arrays will be freed by __kvm_set_memory_region() if installing ++ * the new memslot is successful. ++ */ ++ memset(&slot->arch, 0, sizeof(slot->arch)); ++ + for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) { + struct kvm_lpage_info *linfo; + unsigned long ugfn; +@@ -9959,6 +9966,10 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, + const struct kvm_userspace_memory_region *mem, + enum kvm_mr_change change) + { ++ if (change == KVM_MR_MOVE) ++ return kvm_arch_create_memslot(kvm, memslot, ++ mem->memory_size >> PAGE_SHIFT); ++ + return 0; + } + + diff --git a/patches.suse/kvm-x86-gracefully-handle-_vmalloc-failure-during-vm-allocation b/patches.suse/kvm-x86-gracefully-handle-_vmalloc-failure-during-vm-allocation new file mode 100644 index 0000000..f5237fd --- /dev/null +++ b/patches.suse/kvm-x86-gracefully-handle-_vmalloc-failure-during-vm-allocation @@ -0,0 +1,52 @@ +From: Sean Christopherson +Date: Sun, 26 Jan 2020 16:41:11 -0800 +Subject: KVM: x86: Gracefully handle __vmalloc() failure during VM allocation +Git-commit: d18b2f43b9147c8005ae0844fb445d8cc6a87e31 +Patch-mainline: v5.7-rc1 +References: bsc#1182801 + +Check the result of __vmalloc() to avoid dereferencing a NULL pointer in +the event that allocation failres. + +Fixes: d1e5b0e98ea27 ("kvm: Make VM ioctl do valloc for some archs") +Cc: stable@vger.kernel.org +Signed-off-by: Sean Christopherson +Reviewed-by: Vitaly Kuznetsov +Signed-off-by: Paolo Bonzini +Acked-by: Dario Faggioli +--- + arch/x86/kvm/svm.c | 4 ++++ + arch/x86/kvm/vmx/vmx.c | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c +index ad3f5b178a03..0455bd105bbe 100644 +--- a/arch/x86/kvm/svm.c ++++ b/arch/x86/kvm/svm.c +@@ -1949,6 +1949,10 @@ static struct kvm *svm_vm_alloc(void) + struct kvm_svm *kvm_svm = __vmalloc(sizeof(struct kvm_svm), + GFP_KERNEL_ACCOUNT | __GFP_ZERO, + PAGE_KERNEL); ++ ++ if (!kvm_svm) ++ return NULL; ++ + return &kvm_svm->kvm; + } + +diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c +index 15ddaf857552..933c72b97b50 100644 +--- a/arch/x86/kvm/vmx/vmx.c ++++ b/arch/x86/kvm/vmx/vmx.c +@@ -6684,6 +6684,10 @@ static struct kvm *vmx_vm_alloc(void) + struct kvm_vmx *kvm_vmx = __vmalloc(sizeof(struct kvm_vmx), + GFP_KERNEL_ACCOUNT | __GFP_ZERO, + PAGE_KERNEL); ++ ++ if (!kvm_vmx) ++ return NULL; ++ + return &kvm_vmx->kvm; + } + + diff --git a/patches.suse/libbpf-Ignore-non-function-pointer-member-in-struct_.patch b/patches.suse/libbpf-Ignore-non-function-pointer-member-in-struct_.patch new file mode 100644 index 0000000..2efdfcb --- /dev/null +++ b/patches.suse/libbpf-Ignore-non-function-pointer-member-in-struct_.patch @@ -0,0 +1,84 @@ +From: Martin KaFai Lau +Date: Thu, 11 Feb 2021 18:10:30 -0800 +Subject: libbpf: Ignore non function pointer member in struct_ops +Patch-mainline: v5.12-rc1 +Git-commit: d2836dddc95d5dd82c7cb23726c97d8c9147f050 +References: bsc#1177028 + +When libbpf initializes the kernel's struct_ops in +"bpf_map__init_kern_struct_ops()", it enforces all +pointer types must be a function pointer and rejects +others. It turns out to be too strict. For example, +when directly using "struct tcp_congestion_ops" from vmlinux.h, +it has a "struct module *owner" member and it is set to NULL +in a bpf_tcp_cc.o. + +Instead, it only needs to ensure the member is a function +pointer if it has been set (relocated) to a bpf-prog. +This patch moves the "btf_is_func_proto(kern_mtype)" check +after the existing "if (!prog) { continue; }". The original debug +message in "if (!prog) { continue; }" is also removed since it is +no longer valid. Beside, there is a later debug message to tell +which function pointer is set. + +The "btf_is_func_proto(mtype)" has already been guaranteed +in "bpf_object__collect_st_ops_relos()" which has been run +before "bpf_map__init_kern_struct_ops()". Thus, this check +is removed. + +v2: +- Remove outdated debug message (Andrii) + Remove because there is a later debug message to tell + which function pointer is set. +- Following mtype->type is no longer needed. Remove: + "skip_mods_and_typedefs(btf, mtype->type, &mtype_id)" +- Do "if (!prog)" test before skip_mods_and_typedefs. + +Fixes: 590a00888250 ("bpf: libbpf: Add STRUCT_OPS support") +Signed-off-by: Martin KaFai Lau +Signed-off-by: Andrii Nakryiko +Acked-by: Andrii Nakryiko +Link: https://lore.kernel.org/bpf/20210212021030.266932-1-kafai@fb.com +Acked-by: Gary Lin +--- + tools/lib/bpf/libbpf.c | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +--- a/tools/lib/bpf/libbpf.c ++++ b/tools/lib/bpf/libbpf.c +@@ -859,24 +859,24 @@ static int bpf_map__init_kern_struct_ops + if (btf_is_ptr(mtype)) { + struct bpf_program *prog; + +- mtype = skip_mods_and_typedefs(btf, mtype->type, &mtype_id); ++ prog = st_ops->progs[i]; ++ if (!prog) ++ continue; ++ + kern_mtype = skip_mods_and_typedefs(kern_btf, + kern_mtype->type, + &kern_mtype_id); +- if (!btf_is_func_proto(mtype) || +- !btf_is_func_proto(kern_mtype)) { +- pr_warning("struct_ops init_kern %s: non func ptr %s is not supported\n", ++ ++ /* mtype->type must be a func_proto which was ++ * guaranteed in bpf_object__collect_st_ops_relos(), ++ * so only check kern_mtype for func_proto here. ++ */ ++ if (!btf_is_func_proto(kern_mtype)) { ++ pr_warning("struct_ops init_kern %s: kernel member %s is not a func ptr\n", + map->name, mname); + return -ENOTSUP; + } + +- prog = st_ops->progs[i]; +- if (!prog) { +- pr_debug("struct_ops init_kern %s: func ptr %s is not set\n", +- map->name, mname); +- continue; +- } +- + prog->attach_btf_id = kern_type_id; + prog->expected_attach_type = kern_member_idx; + diff --git a/patches.suse/media-mceusb-Fix-potential-out-of-bounds-shift.patch b/patches.suse/media-mceusb-Fix-potential-out-of-bounds-shift.patch new file mode 100644 index 0000000..b44b259 --- /dev/null +++ b/patches.suse/media-mceusb-Fix-potential-out-of-bounds-shift.patch @@ -0,0 +1,41 @@ +From 1b43bad31fb0e00f45baf5b05bd21eb8d8ce7f58 Mon Sep 17 00:00:00 2001 +From: James Reynolds +Date: Tue, 22 Dec 2020 13:07:04 +0100 +Subject: [PATCH] media: mceusb: Fix potential out-of-bounds shift +Git-commit: 1b43bad31fb0e00f45baf5b05bd21eb8d8ce7f58 +Patch-mainline: v5.12-rc1 +References: git-fixes + +When processing a MCE_RSP_GETPORTSTATUS command, the bit index to set in +ir->txports_cabled comes from response data, and isn't validated. + +As ir->txports_cabled is a u8, nothing should be done if the bit index +is greater than 7. + +Cc: stable@vger.kernel.org +Reported-by: syzbot+ec3b3128c576e109171d@syzkaller.appspotmail.com +Signed-off-by: James Reynolds +Signed-off-by: Sean Young +Signed-off-by: Mauro Carvalho Chehab +Acked-by: Takashi Iwai + +--- + drivers/media/rc/mceusb.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c +index f1dbd059ed08..c8d63673e131 100644 +--- a/drivers/media/rc/mceusb.c ++++ b/drivers/media/rc/mceusb.c +@@ -1169,7 +1169,7 @@ static void mceusb_handle_command(struct mceusb_dev *ir, u8 *buf_in) + switch (subcmd) { + /* the one and only 5-byte return value command */ + case MCE_RSP_GETPORTSTATUS: +- if (buf_in[5] == 0) ++ if (buf_in[5] == 0 && *hi < 8) + ir->txports_cabled |= 1 << *hi; + break; + +-- +2.26.2 + diff --git a/patches.suse/mei-hbm-call-mei_set_devstate-on-hbm-stop-response.patch b/patches.suse/mei-hbm-call-mei_set_devstate-on-hbm-stop-response.patch new file mode 100644 index 0000000..68bf781 --- /dev/null +++ b/patches.suse/mei-hbm-call-mei_set_devstate-on-hbm-stop-response.patch @@ -0,0 +1,38 @@ +From 3a77df62deb2e62de0dc26c1cb763cc152329287 Mon Sep 17 00:00:00 2001 +From: Alexander Usyskin +Date: Fri, 29 Jan 2021 14:07:48 +0200 +Subject: [PATCH] mei: hbm: call mei_set_devstate() on hbm stop response +Git-commit: 3a77df62deb2e62de0dc26c1cb763cc152329287 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Use mei_set_devstate() wrapper upon hbm stop command response, +to trigger sysfs event. + +Fixes: 43b8a7ed4739 ("mei: expose device state in sysfs") +Signed-off-by: Alexander Usyskin +Signed-off-by: Tomas Winkler +Link: https://lore.kernel.org/r/20210129120752.850325-3-tomas.winkler@intel.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/misc/mei/hbm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c +index 686e8b6a4c55..0cba3c6dfb14 100644 +--- a/drivers/misc/mei/hbm.c ++++ b/drivers/misc/mei/hbm.c +@@ -1373,7 +1373,7 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) + return -EPROTO; + } + +- dev->dev_state = MEI_DEV_POWER_DOWN; ++ mei_set_devstate(dev, MEI_DEV_POWER_DOWN); + dev_info(dev->dev, "hbm: stop response: resetting.\n"); + /* force the reset */ + return -EPROTO; +-- +2.26.2 + diff --git a/patches.suse/misc-eeprom_93xx46-Add-module-alias-to-avoid-breakin.patch b/patches.suse/misc-eeprom_93xx46-Add-module-alias-to-avoid-breakin.patch new file mode 100644 index 0000000..6213aea --- /dev/null +++ b/patches.suse/misc-eeprom_93xx46-Add-module-alias-to-avoid-breakin.patch @@ -0,0 +1,31 @@ +From: Aswath Govindraju +Date: Wed, 13 Jan 2021 10:42:52 +0530 +Subject: misc: eeprom_93xx46: Add module alias to avoid breaking support for non device tree users +Patch-mainline: v5.12-rc1 +Git-commit: 4540b9fbd8ebb21bb3735796d300a1589ee5fbf2 +References: git-fixes + +Module alias "spi:93xx46" is used by non device tree users like +drivers/misc/eeprom/digsy_mtc_eeprom.c and removing it will +break support for them. + +Fix this by adding back the module alias "spi:93xx46". + +Fixes: 13613a2246bf ("misc: eeprom_93xx46: Fix module alias to enable module autoprobe") +Signed-off-by: Aswath Govindraju +Link: https://lore.kernel.org/r/20210113051253.15061-1-a-govindraju@ti.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Michal Kubecek + +--- + drivers/misc/eeprom/eeprom_93xx46.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/misc/eeprom/eeprom_93xx46.c ++++ b/drivers/misc/eeprom/eeprom_93xx46.c +@@ -510,4 +510,5 @@ module_spi_driver(eeprom_93xx46_driver); + MODULE_LICENSE("GPL"); + MODULE_DESCRIPTION("Driver for 93xx46 EEPROMs"); + MODULE_AUTHOR("Anatolij Gustschin "); ++MODULE_ALIAS("spi:93xx46"); + MODULE_ALIAS("spi:eeprom-93xx46"); diff --git a/patches.suse/misc-eeprom_93xx46-Fix-module-alias-to-enable-module.patch b/patches.suse/misc-eeprom_93xx46-Fix-module-alias-to-enable-module.patch new file mode 100644 index 0000000..4eaac33 --- /dev/null +++ b/patches.suse/misc-eeprom_93xx46-Fix-module-alias-to-enable-module.patch @@ -0,0 +1,34 @@ +From 13613a2246bf531f5fc04e8e62e8f21a3d39bf1c Mon Sep 17 00:00:00 2001 +From: Aswath Govindraju +Date: Thu, 7 Jan 2021 22:09:53 +0530 +Subject: [PATCH] misc: eeprom_93xx46: Fix module alias to enable module autoprobe +Git-commit: 13613a2246bf531f5fc04e8e62e8f21a3d39bf1c +Patch-mainline: v5.12-rc1 +References: git-fixes + +Fix module autoprobe by correcting module alias to match the string from +/sys/class/.../spi1.0/modalias content. + +Fixes: 06b4501e88ad ("misc/eeprom: add driver for microwire 93xx46 EEPROMs") +Signed-off-by: Aswath Govindraju +Link: https://lore.kernel.org/r/20210107163957.28664-2-a-govindraju@ti.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/misc/eeprom/eeprom_93xx46.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c +index 7c45f82b4302..206d920dc92f 100644 +--- a/drivers/misc/eeprom/eeprom_93xx46.c ++++ b/drivers/misc/eeprom/eeprom_93xx46.c +@@ -511,4 +511,4 @@ module_spi_driver(eeprom_93xx46_driver); + MODULE_LICENSE("GPL"); + MODULE_DESCRIPTION("Driver for 93xx46 EEPROMs"); + MODULE_AUTHOR("Anatolij Gustschin "); +-MODULE_ALIAS("spi:93xx46"); ++MODULE_ALIAS("spi:eeprom-93xx46"); +-- +2.26.2 + diff --git a/patches.suse/misc-rtsx-init-of-rts522a-add-OCP-power-off-when-no-.patch b/patches.suse/misc-rtsx-init-of-rts522a-add-OCP-power-off-when-no-.patch new file mode 100644 index 0000000..386713c --- /dev/null +++ b/patches.suse/misc-rtsx-init-of-rts522a-add-OCP-power-off-when-no-.patch @@ -0,0 +1,40 @@ +From 920fd8a70619074eac7687352c8f1c6f3c2a64a5 Mon Sep 17 00:00:00 2001 +From: Ricky Wu +Date: Thu, 4 Feb 2021 16:31:15 +0800 +Subject: [PATCH] misc: rtsx: init of rts522a add OCP power off when no card is present +Git-commit: 920fd8a70619074eac7687352c8f1c6f3c2a64a5 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Power down OCP for power consumption +when no SD/MMC card is present + +Cc: stable@vger.kernel.org +Signed-off-by: Ricky Wu +Link: https://lore.kernel.org/r/20210204083115.9471-1-ricky_wu@realtek.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/misc/cardreader/rts5227.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/misc/cardreader/rts5227.c b/drivers/misc/cardreader/rts5227.c +index 8859011672cb..8200af22b529 100644 +--- a/drivers/misc/cardreader/rts5227.c ++++ b/drivers/misc/cardreader/rts5227.c +@@ -398,6 +398,11 @@ static int rts522a_extra_init_hw(struct rtsx_pcr *pcr) + { + rts5227_extra_init_hw(pcr); + ++ /* Power down OCP for power consumption */ ++ if (!pcr->card_exist) ++ rtsx_pci_write_register(pcr, FPDCTL, OC_POWER_DOWN, ++ OC_POWER_DOWN); ++ + rtsx_pci_write_register(pcr, FUNC_FORCE_CTL, FUNC_FORCE_UPME_XMT_DBG, + FUNC_FORCE_UPME_XMT_DBG); + rtsx_pci_write_register(pcr, PCLK_CTL, 0x04, 0x04); +-- +2.26.2 + diff --git a/patches.suse/mmc-sdhci-esdhc-imx-fix-kernel-panic-when-remove-mod.patch b/patches.suse/mmc-sdhci-esdhc-imx-fix-kernel-panic-when-remove-mod.patch new file mode 100644 index 0000000..b5c8c40 --- /dev/null +++ b/patches.suse/mmc-sdhci-esdhc-imx-fix-kernel-panic-when-remove-mod.patch @@ -0,0 +1,87 @@ +From a56f44138a2c57047f1ea94ea121af31c595132b Mon Sep 17 00:00:00 2001 +From: Frank Li +Date: Wed, 10 Feb 2021 12:19:33 -0600 +Subject: [PATCH] mmc: sdhci-esdhc-imx: fix kernel panic when remove module +Git-commit: a56f44138a2c57047f1ea94ea121af31c595132b +Patch-mainline: v5.12-rc1 +References: git-fixes + +In sdhci_esdhc_imx_remove() the SDHCI_INT_STATUS in read. Under some +circumstances, this may be done while the device is runtime suspended, +triggering the below splat. + +Fix the problem by adding a pm_runtime_get_sync(), before reading the +register, which will turn on clocks etc making the device accessible again. + +[ 1811.323148] mmc1: card aaaa removed +[ 1811.347483] Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP +[ 1811.354988] Modules linked in: sdhci_esdhc_imx(-) sdhci_pltfm sdhci cqhci mmc_block mmc_core [last unloaded: mmc_core] +[ 1811.365726] CPU: 0 PID: 3464 Comm: rmmod Not tainted 5.10.1-sd-99871-g53835a2e8186 #5 +[ 1811.373559] Hardware name: Freescale i.MX8DXL EVK (DT) +[ 1811.378705] pstate: 60000005 (nZCv daif -PAN -UAO -TCO BTYPE=--) +[ 1811.384723] pc : sdhci_esdhc_imx_remove+0x28/0x15c [sdhci_esdhc_imx] +[ 1811.391090] lr : platform_drv_remove+0x2c/0x50 +[ 1811.395536] sp : ffff800012c7bcb0 +[ 1811.398855] x29: ffff800012c7bcb0 x28: ffff00002c72b900 +[ 1811.404181] x27: 0000000000000000 x26: 0000000000000000 +[ 1811.409497] x25: 0000000000000000 x24: 0000000000000000 +[ 1811.414814] x23: ffff0000042b3890 x22: ffff800009127120 +[ 1811.420131] x21: ffff00002c4c9580 x20: ffff0000042d0810 +[ 1811.425456] x19: ffff0000042d0800 x18: 0000000000000020 +[ 1811.430773] x17: 0000000000000000 x16: 0000000000000000 +[ 1811.436089] x15: 0000000000000004 x14: ffff000004019c10 +[ 1811.441406] x13: 0000000000000000 x12: 0000000000000020 +[ 1811.446723] x11: 0101010101010101 x10: 7f7f7f7f7f7f7f7f +[ 1811.452040] x9 : fefefeff6364626d x8 : 7f7f7f7f7f7f7f7f +[ 1811.457356] x7 : 78725e6473607372 x6 : 0000000080808080 +[ 1811.462673] x5 : 0000000000000000 x4 : 0000000000000000 +[ 1811.467990] x3 : ffff800011ac1cb0 x2 : 0000000000000000 +[ 1811.473307] x1 : ffff8000091214d4 x0 : ffff8000133a0030 +[ 1811.478624] Call trace: +[ 1811.481081] sdhci_esdhc_imx_remove+0x28/0x15c [sdhci_esdhc_imx] +[ 1811.487098] platform_drv_remove+0x2c/0x50 +[ 1811.491198] __device_release_driver+0x188/0x230 +[ 1811.495818] driver_detach+0xc0/0x14c +[ 1811.499487] bus_remove_driver+0x5c/0xb0 +[ 1811.503413] driver_unregister+0x30/0x60 +[ 1811.507341] platform_driver_unregister+0x14/0x20 +[ 1811.512048] sdhci_esdhc_imx_driver_exit+0x1c/0x3a8 [sdhci_esdhc_imx] +[ 1811.518495] __arm64_sys_delete_module+0x19c/0x230 +[ 1811.523291] el0_svc_common.constprop.0+0x78/0x1a0 +[ 1811.528086] do_el0_svc+0x24/0x90 +[ 1811.531405] el0_svc+0x14/0x20 +[ 1811.534461] el0_sync_handler+0x1a4/0x1b0 +[ 1811.538474] el0_sync+0x174/0x180 +[ 1811.541801] Code: a9025bf5 f9403e95 f9400ea0 9100c000 (b9400000) +[ 1811.547902] ---[ end trace 3fb1a3bd48ff7be5 ]--- + +Signed-off-by: Frank Li +Cc: stable@vger.kernel.org # v4.0+ +Link: https://lore.kernel.org/r/20210210181933.29263-1-Frank.Li@nxp.com +[ulf: Clarified the commit message a bit] +Signed-off-by: Ulf Hansson +Acked-by: Takashi Iwai + +--- + drivers/mmc/host/sdhci-esdhc-imx.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c +index 16ed19f47939..a20459744d21 100644 +--- a/drivers/mmc/host/sdhci-esdhc-imx.c ++++ b/drivers/mmc/host/sdhci-esdhc-imx.c +@@ -1666,9 +1666,10 @@ static int sdhci_esdhc_imx_remove(struct platform_device *pdev) + struct sdhci_host *host = platform_get_drvdata(pdev); + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host); +- int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff); ++ int dead; + + pm_runtime_get_sync(&pdev->dev); ++ dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff); + pm_runtime_disable(&pdev->dev); + pm_runtime_put_noidle(&pdev->dev); + +-- +2.26.2 + diff --git a/patches.suse/msft-hv-2226-Drivers-hv-vmbus-Avoid-use-after-free-in-vmbus_onoff.patch b/patches.suse/msft-hv-2226-Drivers-hv-vmbus-Avoid-use-after-free-in-vmbus_onoff.patch new file mode 100644 index 0000000..57a648d --- /dev/null +++ b/patches.suse/msft-hv-2226-Drivers-hv-vmbus-Avoid-use-after-free-in-vmbus_onoff.patch @@ -0,0 +1,39 @@ +From: "Andrea Parri (Microsoft)" +Date: Wed, 9 Dec 2020 08:08:25 +0100 +Patch-mainline: v5.12-rc1 +Subject: Drivers: hv: vmbus: Avoid use-after-free in vmbus_onoffer_rescind() +Git-commit: e3fa4b747f085d2cda09bba0533b86fa76038635 +References: git-fixes + +When channel->device_obj is non-NULL, vmbus_onoffer_rescind() could +invoke put_device(), that will eventually release the device and free +the channel object (cf. vmbus_device_release()). However, a pointer +to the object is dereferenced again later to load the primary_channel. +The use-after-free can be avoided by noticing that this load/check is +redundant if device_obj is non-NULL: primary_channel must be NULL if +device_obj is non-NULL, cf. vmbus_add_channel_work(). + +Fixes: 54a66265d6754b ("Drivers: hv: vmbus: Fix rescind handling") +Reported-by: Juan Vazquez +Signed-off-by: Andrea Parri (Microsoft) +Reviewed-by: Michael Kelley +Link: https://lore.kernel.org/r/20201209070827.29335-5-parri.andrea@gmail.com +Signed-off-by: Wei Liu +Acked-by: Olaf Hering +--- + drivers/hv/channel_mgmt.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c +--- a/drivers/hv/channel_mgmt.c ++++ b/drivers/hv/channel_mgmt.c +@@ -1116,8 +1116,7 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr) + vmbus_device_unregister(channel->device_obj); + put_device(dev); + } +- } +- if (channel->primary_channel != NULL) { ++ } else if (channel->primary_channel != NULL) { + /* + * Sub-channel is being rescinded. Following is the channel + * close sequence when initiated from the driveri (refer to diff --git a/patches.suse/net-ag71xx-add-missed-clk_disable_unprepare-in-error.patch b/patches.suse/net-ag71xx-add-missed-clk_disable_unprepare-in-error.patch new file mode 100644 index 0000000..42d679c --- /dev/null +++ b/patches.suse/net-ag71xx-add-missed-clk_disable_unprepare-in-error.patch @@ -0,0 +1,38 @@ +From 646cf988fa0948874af7e498ceba5b269abc7957 Mon Sep 17 00:00:00 2001 +From: Huang Guobin +Date: Sun, 19 Jul 2020 21:46:14 -0400 +Subject: [PATCH 09/15] net: ag71xx: add missed clk_disable_unprepare in error + path of probe +Patch-mainline: v5.8-rc7 +Git-commit: befc113c56a76ae7be3986034a0e476d3385e265 +References: git-fixes + +The ag71xx_mdio_probe() forgets to call clk_disable_unprepare() when +of_reset_control_get_exclusive() failed. Add the missed call to fix it. + +Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver") +Reported-by: Hulk Robot +Signed-off-by: Huang Guobin +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/atheros/ag71xx.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c +index d1101eea15c2..27b50c560fef 100644 +--- a/drivers/net/ethernet/atheros/ag71xx.c ++++ b/drivers/net/ethernet/atheros/ag71xx.c +@@ -553,7 +553,8 @@ static int ag71xx_mdio_probe(struct ag71xx *ag) + ag->mdio_reset = of_reset_control_get_exclusive(np, "mdio"); + if (IS_ERR(ag->mdio_reset)) { + netif_err(ag, probe, ndev, "Failed to get reset mdio.\n"); +- return PTR_ERR(ag->mdio_reset); ++ err = PTR_ERR(ag->mdio_reset); ++ goto mdio_err_put_clk; + } + + mii_bus->name = "ag71xx_mdio"; +-- +2.16.4 + diff --git a/patches.suse/net-bcmgenet-Fix-WoL-with-password-after-deep-sleep.patch b/patches.suse/net-bcmgenet-Fix-WoL-with-password-after-deep-sleep.patch new file mode 100644 index 0000000..57369d1 --- /dev/null +++ b/patches.suse/net-bcmgenet-Fix-WoL-with-password-after-deep-sleep.patch @@ -0,0 +1,146 @@ +From f1b3aa3c5fedd2a7dfde3a05bb8500b57ae25c95 Mon Sep 17 00:00:00 2001 +From: Doug Berger +Date: Wed, 29 Apr 2020 13:02:01 -0700 +Subject: [PATCH 3/9] net: bcmgenet: Fix WoL with password after deep sleep +Git-commit: 6f7689057a0f10a6c967b9f2759d7a3dc948b930 +Patch-mainline: v5.8-rc1 +References: git-fixes + +Broadcom STB chips support a deep sleep mode where all register contents +are lost. Because we were stashing the MagicPacket password into some of +these registers a suspend into that deep sleep then a resumption would +not lead to being able to wake-up from MagicPacket with password again. + +Fix this by keeping a software copy of the password and program it +during suspend. + +Fixes: c51de7f3976b ("net: bcmgenet: add Wake-on-LAN support code") +Suggested-by: Florian Fainelli +Signed-off-by: Doug Berger +Acked-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/broadcom/genet/bcmgenet.h | 2 ++ + drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c | 39 ++++++++++------------ + 2 files changed, 20 insertions(+), 21 deletions(-) + +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h +index a5659197598f..8ac5c32a41ff 100644 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + + /* total number of Buffer Descriptors, same for Rx/Tx */ + #define TOTAL_DESC 256 +@@ -675,6 +676,7 @@ struct bcmgenet_priv { + /* WOL */ + struct clk *clk_wol; + u32 wolopts; ++ u8 sopass[SOPASS_MAX]; + + struct bcmgenet_mib_counters mib; + +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c +index c9a43695b182..597c0498689a 100644 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c +@@ -41,18 +41,13 @@ + void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) + { + struct bcmgenet_priv *priv = netdev_priv(dev); +- u32 reg; + + wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE; + wol->wolopts = priv->wolopts; + memset(wol->sopass, 0, sizeof(wol->sopass)); + +- if (wol->wolopts & WAKE_MAGICSECURE) { +- reg = bcmgenet_umac_readl(priv, UMAC_MPD_PW_MS); +- put_unaligned_be16(reg, &wol->sopass[0]); +- reg = bcmgenet_umac_readl(priv, UMAC_MPD_PW_LS); +- put_unaligned_be32(reg, &wol->sopass[2]); +- } ++ if (wol->wolopts & WAKE_MAGICSECURE) ++ memcpy(wol->sopass, priv->sopass, sizeof(priv->sopass)); + } + + /* ethtool function - set WOL (Wake on LAN) settings. +@@ -62,7 +57,6 @@ int bcmgenet_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) + { + struct bcmgenet_priv *priv = netdev_priv(dev); + struct device *kdev = &priv->pdev->dev; +- u32 reg; + + if (!device_can_wakeup(kdev)) + return -ENOTSUPP; +@@ -70,17 +64,8 @@ int bcmgenet_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) + if (wol->wolopts & ~(WAKE_MAGIC | WAKE_MAGICSECURE)) + return -EINVAL; + +- reg = bcmgenet_umac_readl(priv, UMAC_MPD_CTRL); +- if (wol->wolopts & WAKE_MAGICSECURE) { +- bcmgenet_umac_writel(priv, get_unaligned_be16(&wol->sopass[0]), +- UMAC_MPD_PW_MS); +- bcmgenet_umac_writel(priv, get_unaligned_be32(&wol->sopass[2]), +- UMAC_MPD_PW_LS); +- reg |= MPD_PW_EN; +- } else { +- reg &= ~MPD_PW_EN; +- } +- bcmgenet_umac_writel(priv, reg, UMAC_MPD_CTRL); ++ if (wol->wolopts & WAKE_MAGICSECURE) ++ memcpy(priv->sopass, wol->sopass, sizeof(priv->sopass)); + + /* Flag the device and relevant IRQ as wakeup capable */ + if (wol->wolopts) { +@@ -120,6 +105,14 @@ static int bcmgenet_poll_wol_status(struct bcmgenet_priv *priv) + return retries; + } + ++static void bcmgenet_set_mpd_password(struct bcmgenet_priv *priv) ++{ ++ bcmgenet_umac_writel(priv, get_unaligned_be16(&priv->sopass[0]), ++ UMAC_MPD_PW_MS); ++ bcmgenet_umac_writel(priv, get_unaligned_be32(&priv->sopass[2]), ++ UMAC_MPD_PW_LS); ++} ++ + int bcmgenet_wol_power_down_cfg(struct bcmgenet_priv *priv, + enum bcmgenet_power_mode mode) + { +@@ -144,13 +137,17 @@ int bcmgenet_wol_power_down_cfg(struct bcmgenet_priv *priv, + + reg = bcmgenet_umac_readl(priv, UMAC_MPD_CTRL); + reg |= MPD_EN; ++ if (priv->wolopts & WAKE_MAGICSECURE) { ++ bcmgenet_set_mpd_password(priv); ++ reg |= MPD_PW_EN; ++ } + bcmgenet_umac_writel(priv, reg, UMAC_MPD_CTRL); + + /* Do not leave UniMAC in MPD mode only */ + retries = bcmgenet_poll_wol_status(priv); + if (retries < 0) { + reg = bcmgenet_umac_readl(priv, UMAC_MPD_CTRL); +- reg &= ~MPD_EN; ++ reg &= ~(MPD_EN | MPD_PW_EN); + bcmgenet_umac_writel(priv, reg, UMAC_MPD_CTRL); + return retries; + } +@@ -189,7 +186,7 @@ void bcmgenet_wol_power_up_cfg(struct bcmgenet_priv *priv, + reg = bcmgenet_umac_readl(priv, UMAC_MPD_CTRL); + if (!(reg & MPD_EN)) + return; /* already powered up so skip the rest */ +- reg &= ~MPD_EN; ++ reg &= ~(MPD_EN | MPD_PW_EN); + bcmgenet_umac_writel(priv, reg, UMAC_MPD_CTRL); + + /* Disable CRC Forward */ +-- +2.16.4 + diff --git a/patches.suse/net-bcmgenet-re-remove-bcmgenet_hfb_add_filter.patch b/patches.suse/net-bcmgenet-re-remove-bcmgenet_hfb_add_filter.patch new file mode 100644 index 0000000..31c8275 --- /dev/null +++ b/patches.suse/net-bcmgenet-re-remove-bcmgenet_hfb_add_filter.patch @@ -0,0 +1,165 @@ +From 62dc8280cdcc68fbada4eadfcb0ec3d5d651af94 Mon Sep 17 00:00:00 2001 +From: Doug Berger +Date: Wed, 24 Jun 2020 18:14:53 -0700 +Subject: [PATCH 1/2] net: bcmgenet: re-remove bcmgenet_hfb_add_filter +Git-commit: 673bafd5b8b0ec9b1e2eedca2a2be6b44ee5ba9c +Patch-mainline: v5.8-rc3 +References: git-fixes + +This function was originally removed by Baoyou Xie in +commit e2072600a241 ("net: bcmgenet: remove unused function in +bcmgenet.c") to prevent a build warning. + +Some of the functions removed by Baoyou Xie are now used for +WAKE_FILTER support so his commit was reverted, but this function +is still unused and the kbuild test robot dutifully reported the +warning. + +This commit once again removes the remaining unused hfb functions. + +Fixes: 14da1510fedc ("Revert "net: bcmgenet: remove unused function in bcmgenet.c"") +Reported-by: kbuild test robot +Signed-off-by: Doug Berger +Acked-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/broadcom/genet/bcmgenet.c | 122 ------------------------- + 1 file changed, 122 deletions(-) + +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c +index f00d480d8303..c8f49247d500 100644 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c +@@ -2819,128 +2819,6 @@ static void bcmgenet_enable_dma(struct bcmgenet_priv *priv, u32 dma_ctrl) + bcmgenet_tdma_writel(priv, reg, DMA_CTRL); + } + +-static bool bcmgenet_hfb_is_filter_enabled(struct bcmgenet_priv *priv, +- u32 f_index) +-{ +- u32 offset; +- u32 reg; +- +- offset = HFB_FLT_ENABLE_V3PLUS + (f_index < 32) * sizeof(u32); +- reg = bcmgenet_hfb_reg_readl(priv, offset); +- return !!(reg & (1 << (f_index % 32))); +-} +- +-static void bcmgenet_hfb_enable_filter(struct bcmgenet_priv *priv, u32 f_index) +-{ +- u32 offset; +- u32 reg; +- +- offset = HFB_FLT_ENABLE_V3PLUS + (f_index < 32) * sizeof(u32); +- reg = bcmgenet_hfb_reg_readl(priv, offset); +- reg |= (1 << (f_index % 32)); +- bcmgenet_hfb_reg_writel(priv, reg, offset); +-} +- +-static void bcmgenet_hfb_set_filter_rx_queue_mapping(struct bcmgenet_priv *priv, +- u32 f_index, u32 rx_queue) +-{ +- u32 offset; +- u32 reg; +- +- offset = f_index / 8; +- reg = bcmgenet_rdma_readl(priv, DMA_INDEX2RING_0 + offset); +- reg &= ~(0xF << (4 * (f_index % 8))); +- reg |= ((rx_queue & 0xF) << (4 * (f_index % 8))); +- bcmgenet_rdma_writel(priv, reg, DMA_INDEX2RING_0 + offset); +-} +- +-static void bcmgenet_hfb_set_filter_length(struct bcmgenet_priv *priv, +- u32 f_index, u32 f_length) +-{ +- u32 offset; +- u32 reg; +- +- offset = HFB_FLT_LEN_V3PLUS + +- ((priv->hw_params->hfb_filter_cnt - 1 - f_index) / 4) * +- sizeof(u32); +- reg = bcmgenet_hfb_reg_readl(priv, offset); +- reg &= ~(0xFF << (8 * (f_index % 4))); +- reg |= ((f_length & 0xFF) << (8 * (f_index % 4))); +- bcmgenet_hfb_reg_writel(priv, reg, offset); +-} +- +-static int bcmgenet_hfb_find_unused_filter(struct bcmgenet_priv *priv) +-{ +- u32 f_index; +- +- for (f_index = 0; f_index < priv->hw_params->hfb_filter_cnt; f_index++) +- if (!bcmgenet_hfb_is_filter_enabled(priv, f_index)) +- return f_index; +- +- return -ENOMEM; +-} +- +-/* bcmgenet_hfb_add_filter +- * +- * Add new filter to Hardware Filter Block to match and direct Rx traffic to +- * desired Rx queue. +- * +- * f_data is an array of unsigned 32-bit integers where each 32-bit integer +- * provides filter data for 2 bytes (4 nibbles) of Rx frame: +- * +- * bits 31:20 - unused +- * bit 19 - nibble 0 match enable +- * bit 18 - nibble 1 match enable +- * bit 17 - nibble 2 match enable +- * bit 16 - nibble 3 match enable +- * bits 15:12 - nibble 0 data +- * bits 11:8 - nibble 1 data +- * bits 7:4 - nibble 2 data +- * bits 3:0 - nibble 3 data +- * +- * Example: +- * In order to match: +- * - Ethernet frame type = 0x0800 (IP) +- * - IP version field = 4 +- * - IP protocol field = 0x11 (UDP) +- * +- * The following filter is needed: +- * u32 hfb_filter_ipv4_udp[] = { +- * Rx frame offset 0x00: 0x00000000, 0x00000000, 0x00000000, 0x00000000, +- * Rx frame offset 0x08: 0x00000000, 0x00000000, 0x000F0800, 0x00084000, +- * Rx frame offset 0x10: 0x00000000, 0x00000000, 0x00000000, 0x00030011, +- * }; +- * +- * To add the filter to HFB and direct the traffic to Rx queue 0, call: +- * bcmgenet_hfb_add_filter(priv, hfb_filter_ipv4_udp, +- * ARRAY_SIZE(hfb_filter_ipv4_udp), 0); +- */ +-int bcmgenet_hfb_add_filter(struct bcmgenet_priv *priv, u32 *f_data, +- u32 f_length, u32 rx_queue) +-{ +- int f_index; +- u32 i; +- +- f_index = bcmgenet_hfb_find_unused_filter(priv); +- if (f_index < 0) +- return -ENOMEM; +- +- if (f_length > priv->hw_params->hfb_filter_size) +- return -EINVAL; +- +- for (i = 0; i < f_length; i++) +- bcmgenet_hfb_writel(priv, f_data[i], +- (f_index * priv->hw_params->hfb_filter_size + i) * +- sizeof(u32)); +- +- bcmgenet_hfb_set_filter_length(priv, f_index, 2 * f_length); +- bcmgenet_hfb_set_filter_rx_queue_mapping(priv, f_index, rx_queue); +- bcmgenet_hfb_enable_filter(priv, f_index); +- bcmgenet_hfb_reg_writel(priv, 0x1, HFB_CTRL); +- +- return 0; +-} +- + /* bcmgenet_hfb_clear + * + * Clear Hardware Filter Block and disable all filtering. +-- +2.16.4 + diff --git a/patches.suse/net-bcmgenet-set-Rx-mode-before-starting-netif.patch b/patches.suse/net-bcmgenet-set-Rx-mode-before-starting-netif.patch new file mode 100644 index 0000000..526caa3 --- /dev/null +++ b/patches.suse/net-bcmgenet-set-Rx-mode-before-starting-netif.patch @@ -0,0 +1,50 @@ +From 5c39fb783407533f87aa3e51d7f29c8df4b838f7 Mon Sep 17 00:00:00 2001 +From: Doug Berger +Date: Wed, 29 Apr 2020 13:02:00 -0700 +Subject: [PATCH 2/9] net: bcmgenet: set Rx mode before starting netif +Git-commit: 72f96347628e73dbb61b307f18dd19293cc6792a +Patch-mainline: v5.8-rc1 +References: git-fixes + +This commit explicitly calls the bcmgenet_set_rx_mode() function when +the network interface is started. This function is normally called by +ndo_set_rx_mode when the flags are changed, but apparently not when +the driver is suspended and resumed. + +This change ensures that address filtering or promiscuous mode are +properly restored by the driver after the MAC may have been reset. + +Fixes: b6e978e50444 ("net: bcmgenet: add suspend/resume callbacks") +Signed-off-by: Doug Berger +Acked-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c +index bade6cd84d2d..c8f49247d500 100644 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c +@@ -69,6 +69,9 @@ + #define GENET_RDMA_REG_OFF (priv->hw_params->rdma_offset + \ + TOTAL_DESC * DMA_DESC_SIZE) + ++/* Forward declarations */ ++static void bcmgenet_set_rx_mode(struct net_device *dev); ++ + static inline void bcmgenet_writel(u32 value, void __iomem *offset) + { + /* MIPS chips strapped for BE will automagically configure the +@@ -2853,6 +2856,7 @@ static void bcmgenet_netif_start(struct net_device *dev) + struct bcmgenet_priv *priv = netdev_priv(dev); + + /* Start the network engine */ ++ bcmgenet_set_rx_mode(dev); + bcmgenet_enable_rx_napi(priv); + + umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, true); +-- +2.16.4 + diff --git a/patches.suse/net-bcmgenet-use-hardware-padding-of-runt-frames.patch b/patches.suse/net-bcmgenet-use-hardware-padding-of-runt-frames.patch new file mode 100644 index 0000000..63aaf3a --- /dev/null +++ b/patches.suse/net-bcmgenet-use-hardware-padding-of-runt-frames.patch @@ -0,0 +1,64 @@ +From 3252044180e09b5c9e5d2a4abaa6e0b44aa359e8 Mon Sep 17 00:00:00 2001 +From: Doug Berger +Date: Wed, 24 Jun 2020 18:14:55 -0700 +Subject: [PATCH 01/15] net: bcmgenet: use hardware padding of runt frames +Patch-mainline: v5.8-rc3 +Git-commit: 20d1f2d1b024f6be199a3bedf1578a1d21592bc5 +References: git-fixes + +When commit 474ea9cafc45 ("net: bcmgenet: correctly pad short +packets") added the call to skb_padto() it should have been +located before the nr_frags parameter was read since that value +could be changed when padding packets with lengths between 55 +and 59 bytes (inclusive). + +The use of a stale nr_frags value can cause corruption of the +pad data when tx-scatter-gather is enabled. This corruption of +the pad can cause invalid checksum computation when hardware +offload of tx-checksum is also enabled. + +Since the original reason for the padding was corrected by +commit 7dd399130efb ("net: bcmgenet: fix skb_len in +bcmgenet_xmit_single()") we can remove the software padding all +together and make use of hardware padding of short frames as +long as the hardware also always appends the FCS value to the +frame. + +Fixes: 474ea9cafc45 ("net: bcmgenet: correctly pad short packets") +Signed-off-by: Doug Berger +Acked-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/broadcom/genet/bcmgenet.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c +index c8f49247d500..b7decc2096b2 100644 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c +@@ -1591,11 +1591,6 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) + goto out; + } + +- if (skb_padto(skb, ETH_ZLEN)) { +- ret = NETDEV_TX_OK; +- goto out; +- } +- + /* Retain how many bytes will be sent on the wire, without TSB inserted + * by transmit checksum offload + */ +@@ -1644,6 +1639,9 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) + len_stat = (size << DMA_BUFLENGTH_SHIFT) | + (priv->hw_params->qtag_mask << DMA_TX_QTAG_SHIFT); + ++ /* Note: if we ever change from DMA_TX_APPEND_CRC below we ++ * will need to restore software padding of "runt" packets ++ */ + if (!i) { + len_stat |= DMA_TX_APPEND_CRC | DMA_SOP; + if (skb->ip_summed == CHECKSUM_PARTIAL) +-- +2.16.4 + diff --git a/patches.suse/net-dsa-lantiq_gswip-fix-and-improve-the-unsupported.patch b/patches.suse/net-dsa-lantiq_gswip-fix-and-improve-the-unsupported.patch new file mode 100644 index 0000000..d2a88ce --- /dev/null +++ b/patches.suse/net-dsa-lantiq_gswip-fix-and-improve-the-unsupported.patch @@ -0,0 +1,46 @@ +From b0f0fd02c68b60b3798032d3c25b35d3b8381056 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sun, 7 Jun 2020 15:02:58 +0200 +Subject: [PATCH 9/9] net: dsa: lantiq_gswip: fix and improve the unsupported + interface error +Git-commit: 4d3da2d8d91f66988a829a18a0ce59945e8ae4fb +Patch-mainline: v5.8-rc1 +References: git-fixes + +While trying to use the lantiq_gswip driver on one of my boards I made +a mistake when specifying the phy-mode (because the out-of-tree driver +wants phy-mode "gmii" or "mii" for the internal PHYs). In this case the +following error is printed multiple times: + Unsupported interface: 3 + +While it gives at least a hint at what may be wrong it is not very user +friendly. Print the human readable phy-mode and also which port is +configured incorrectly (this hardware supports ports 0..6) to improve +the cases where someone made a mistake. + +Fixes: 14fceff4771e51 ("net: dsa: Add Lantiq / Intel DSA driver for vrx200") +Signed-off-by: Martin Blumenstingl +Acked-by: Hauke Mehrtens +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/dsa/lantiq_gswip.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c +index 4e64835deac2..ecaa6690f159 100644 +--- a/drivers/net/dsa/lantiq_gswip.c ++++ b/drivers/net/dsa/lantiq_gswip.c +@@ -1445,7 +1445,8 @@ static void gswip_phylink_validate(struct dsa_switch *ds, int port, + + unsupported: + bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); +- dev_err(ds->dev, "Unsupported interface: %d\n", state->interface); ++ dev_err(ds->dev, "Unsupported interface '%s' for port %d\n", ++ phy_modes(state->interface), port); + return; + } + +-- +2.16.4 + diff --git a/patches.suse/net-dsa-mt7530-set-CPU-port-to-fallback-mode.patch b/patches.suse/net-dsa-mt7530-set-CPU-port-to-fallback-mode.patch new file mode 100644 index 0000000..c43feb7 --- /dev/null +++ b/patches.suse/net-dsa-mt7530-set-CPU-port-to-fallback-mode.patch @@ -0,0 +1,76 @@ +From f4f8af696b9198aab947415894305556377edd06 Mon Sep 17 00:00:00 2001 +From: DENG Qingfang +Date: Wed, 13 May 2020 23:37:17 +0800 +Subject: [PATCH 7/9] net: dsa: mt7530: set CPU port to fallback mode +Git-commit: 38152ea37d8bdaffa22603e0a5b5b86cfa8714c9 +Patch-mainline: v5.8-rc1 +References: git-fixes + +Currently, setting a bridge's self PVID to other value and deleting +the default VID 1 renders untagged ports of that VLAN unable to talk to +the CPU port: + + bridge vlan add dev br0 vid 2 pvid untagged self + bridge vlan del dev br0 vid 1 self + bridge vlan add dev sw0p0 vid 2 pvid untagged + bridge vlan del dev sw0p0 vid 1 + # br0 cannot send untagged frames out of sw0p0 anymore + +That is because the CPU port is set to security mode and its PVID is +still 1, and untagged frames are dropped due to VLAN member violation. + +Set the CPU port to fallback mode so untagged frames can pass through. + +Fixes: 83163f7dca56 ("net: dsa: mediatek: add VLAN support for MT7530") +Signed-off-by: DENG Qingfang +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/dsa/mt7530.c | 11 ++++++++--- + drivers/net/dsa/mt7530.h | 6 ++++++ + 2 files changed, 14 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c +index bcefe3e62656..5b63c52582db 100644 +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -877,10 +877,15 @@ mt7530_port_set_vlan_aware(struct dsa_switch *ds, int port) + PCR_MATRIX_MASK, PCR_MATRIX(MT7530_ALL_MEMBERS)); + + /* Trapped into security mode allows packet forwarding through VLAN +- * table lookup. ++ * table lookup. CPU port is set to fallback mode to let untagged ++ * frames pass through. + */ +- mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, +- MT7530_PORT_SECURITY_MODE); ++ if (dsa_is_cpu_port(ds, port)) ++ mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, ++ MT7530_PORT_FALLBACK_MODE); ++ else ++ mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, ++ MT7530_PORT_SECURITY_MODE); + + /* Set the port as a user port which is to be able to recognize VID + * from incoming packets before fetching entry within the VLAN table. +diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h +index 8b164e3fcefc..475cf34c0e80 100644 +--- a/drivers/net/dsa/mt7530.h ++++ b/drivers/net/dsa/mt7530.h +@@ -148,6 +148,12 @@ enum mt7530_port_mode { + /* Port Matrix Mode: Frames are forwarded by the PCR_MATRIX members. */ + MT7530_PORT_MATRIX_MODE = PORT_VLAN(0), + ++ /* Fallback Mode: Forward received frames with ingress ports that do ++ * not belong to the VLAN member. Frames whose VID is not listed on ++ * the VLAN table are forwarded by the PCR_MATRIX members. ++ */ ++ MT7530_PORT_FALLBACK_MODE = PORT_VLAN(1), ++ + /* Security Mode: Discard any frame due to ingress membership + * violation or VID missed on the VLAN table. + */ +-- +2.16.4 + diff --git a/patches.suse/net-ethernet-ave-Fix-error-returns-in-ave_init.patch b/patches.suse/net-ethernet-ave-Fix-error-returns-in-ave_init.patch new file mode 100644 index 0000000..264756b --- /dev/null +++ b/patches.suse/net-ethernet-ave-Fix-error-returns-in-ave_init.patch @@ -0,0 +1,38 @@ +From 6b427dbcb397f6310a4ac467c65347b4fadf1bb7 Mon Sep 17 00:00:00 2001 +From: Wang Hai +Date: Fri, 17 Jul 2020 10:50:49 +0800 +Subject: [PATCH 10/15] net: ethernet: ave: Fix error returns in ave_init +Patch-mainline: v5.8-rc7 +Git-commit: 1264d7fa3a64d8bea7aebb77253f917947ffda25 +References: git-fixes + +When regmap_update_bits failed in ave_init(), calls of the functions +reset_control_assert() and clk_disable_unprepare() were missed. +Add goto out_reset_assert to do this. + +Fixes: 57878f2f4697 ("net: ethernet: ave: add support for phy-mode setting of system controller") +Reported-by: Hulk Robot +Signed-off-by: Wang Hai +Reviewed-by: Kunihiko Hayashi +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/socionext/sni_ave.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c +index 4eb406f74022..86a00067b3f0 100644 +--- a/drivers/net/ethernet/socionext/sni_ave.c ++++ b/drivers/net/ethernet/socionext/sni_ave.c +@@ -1191,7 +1191,7 @@ static int ave_init(struct net_device *ndev) + ret = regmap_update_bits(priv->regmap, SG_ETPINMODE, + priv->pinmode_mask, priv->pinmode_val); + if (ret) +- return ret; ++ goto out_reset_assert; + + ave_global_reset(ndev); + +-- +2.16.4 + diff --git a/patches.suse/net-gemini-Fix-missing-clk_disable_unprepare-in-erro.patch b/patches.suse/net-gemini-Fix-missing-clk_disable_unprepare-in-erro.patch new file mode 100644 index 0000000..330831d --- /dev/null +++ b/patches.suse/net-gemini-Fix-missing-clk_disable_unprepare-in-erro.patch @@ -0,0 +1,48 @@ +From 3dc6ad722e4359b4e42583cfda5f08ce9fe0c3ac Mon Sep 17 00:00:00 2001 +From: Wang Hai +Date: Thu, 30 Jul 2020 15:30:00 +0800 +Subject: [PATCH 15/15] net: gemini: Fix missing clk_disable_unprepare() in + error path of gemini_ethernet_port_probe() +Patch-mainline: v5.8 +Git-commit: 85496a29224188051b6135eb38da8afd4c584765 +References: git-fixes + +Fix the missing clk_disable_unprepare() before return +from gemini_ethernet_port_probe() in the error handling case. + +Fixes: 4d5ae32f5e1e ("net: ethernet: Add a driver for Gemini gigabit ethernet") +Reported-by: Hulk Robot +Signed-off-by: Wang Hai +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/cortina/gemini.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c +index 2814b96751b4..01ae113f122a 100644 +--- a/drivers/net/ethernet/cortina/gemini.c ++++ b/drivers/net/ethernet/cortina/gemini.c +@@ -2445,6 +2445,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) + port->reset = devm_reset_control_get_exclusive(dev, NULL); + if (IS_ERR(port->reset)) { + dev_err(dev, "no reset\n"); ++ clk_disable_unprepare(port->pclk); + return PTR_ERR(port->reset); + } + reset_control_reset(port->reset); +@@ -2500,8 +2501,10 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) + IRQF_SHARED, + port_names[port->id], + port); +- if (ret) ++ if (ret) { ++ clk_disable_unprepare(port->pclk); + return ret; ++ } + + ret = register_netdev(netdev); + if (!ret) { +-- +2.16.4 + diff --git a/patches.suse/net-lpc-enet-fix-error-return-code-in-lpc_mii_init.patch b/patches.suse/net-lpc-enet-fix-error-return-code-in-lpc_mii_init.patch new file mode 100644 index 0000000..d124c0b --- /dev/null +++ b/patches.suse/net-lpc-enet-fix-error-return-code-in-lpc_mii_init.patch @@ -0,0 +1,37 @@ +From f44d4eb97928e218b94d1f29ec7f6878ffd6aa8c Mon Sep 17 00:00:00 2001 +From: Wei Yongjun +Date: Mon, 27 Apr 2020 12:15:07 +0000 +Subject: [PATCH 5/9] net: lpc-enet: fix error return code in lpc_mii_init() +Git-commit: 88ec7cb22ddde725ed4ce15991f0bd9dd817fd85 +Patch-mainline: v5.8-rc1 +References: git-fixes + +Fix to return a negative error code from the error handling +case instead of 0, as done elsewhere in this function. + +Fixes: b7370112f519 ("lpc32xx: Added ethernet driver") +Signed-off-by: Wei Yongjun +Acked-by: Vladimir Zapolskiy +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/nxp/lpc_eth.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c +index b0c8be127bee..2f71e697f382 100644 +--- a/drivers/net/ethernet/nxp/lpc_eth.c ++++ b/drivers/net/ethernet/nxp/lpc_eth.c +@@ -817,7 +817,8 @@ static int lpc_mii_init(struct netdata_local *pldat) + if (mdiobus_register(pldat->mii_bus)) + goto err_out_unregister_bus; + +- if (lpc_mii_probe(pldat->ndev) != 0) ++ err = lpc_mii_probe(pldat->ndev); ++ if (err) + goto err_out_unregister_bus; + + return 0; +-- +2.16.4 + diff --git a/patches.suse/net-macb-fix-call-to-pm_runtime-in-the-suspend-resum.patch b/patches.suse/net-macb-fix-call-to-pm_runtime-in-the-suspend-resum.patch new file mode 100644 index 0000000..f2b9199 --- /dev/null +++ b/patches.suse/net-macb-fix-call-to-pm_runtime-in-the-suspend-resum.patch @@ -0,0 +1,47 @@ +From e49b8428d4b3494c9397701405ef9b5f09cd1344 Mon Sep 17 00:00:00 2001 +From: Nicolas Ferre +Date: Fri, 10 Jul 2020 14:46:45 +0200 +Subject: [PATCH 07/15] net: macb: fix call to pm_runtime in the suspend/resume + functions +Patch-mainline: v5.8-rc5 +Git-commit: 6c8f85cac98a4c6b767c4c4f6af7283724c32b47 +References: git-fixes + +The calls to pm_runtime_force_suspend/resume() functions are only +relevant if the device is not configured to act as a WoL wakeup source. +Add the device_may_wakeup() test before calling them. + +Fixes: 3e2a5e153906 ("net: macb: add wake-on-lan support via magic packet") +Cc: Claudiu Beznea +Cc: Harini Katakam +Cc: Sergio Prado +Reviewed-by: Florian Fainelli +Signed-off-by: Nicolas Ferre +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/cadence/macb_main.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/cadence/macb_main.c ++++ b/drivers/net/ethernet/cadence/macb_main.c +@@ -4606,7 +4606,8 @@ static int __maybe_unused macb_suspend(s + + if (bp->ptp_info) + bp->ptp_info->ptp_remove(netdev); +- pm_runtime_force_suspend(dev); ++ if (!device_may_wakeup(dev)) ++ pm_runtime_force_suspend(dev); + + return 0; + } +@@ -4621,7 +4622,8 @@ static int __maybe_unused macb_resume(st + if (!netif_running(netdev)) + return 0; + +- pm_runtime_force_resume(dev); ++ if (!device_may_wakeup(dev)) ++ pm_runtime_force_resume(dev); + + if (bp->wol & MACB_WOL_ENABLED) { + macb_writel(bp, IDR, MACB_BIT(WOL)); diff --git a/patches.suse/net-macb-fix-wakeup-test-in-runtime-suspend-resume-r.patch b/patches.suse/net-macb-fix-wakeup-test-in-runtime-suspend-resume-r.patch new file mode 100644 index 0000000..bd2254c --- /dev/null +++ b/patches.suse/net-macb-fix-wakeup-test-in-runtime-suspend-resume-r.patch @@ -0,0 +1,53 @@ +From c6e49d70998794434d7471cf162a2c91e7e96330 Mon Sep 17 00:00:00 2001 +From: Nicolas Ferre +Date: Fri, 10 Jul 2020 14:46:41 +0200 +Subject: [PATCH 05/15] net: macb: fix wakeup test in runtime suspend/resume + routines +Patch-mainline: v5.8-rc5 +Git-commit: 515a10a701d570e26dfbe6ee373f77c8bf11053f +References: git-fixes + +Use the proper struct device pointer to check if the wakeup flag +and wakeup source are positioned. +Use the one passed by function call which is equivalent to +&bp->dev->dev.parent. + +It's preventing the trigger of a spurious interrupt in case the +Wake-on-Lan feature is used. + +Fixes: d54f89af6cc4 ("net: macb: Add pm runtime support") +Cc: Claudiu Beznea +Cc: Harini Katakam +Reviewed-by: Florian Fainelli +Signed-off-by: Nicolas Ferre +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/cadence/macb_main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c +index 3a4a6b31563a..c4f075f478e7 100644 +--- a/drivers/net/ethernet/cadence/macb_main.c ++++ b/drivers/net/ethernet/cadence/macb_main.c +@@ -4512,7 +4512,7 @@ static int __maybe_unused macb_runtime_suspend(struct device *dev) + struct net_device *netdev = dev_get_drvdata(dev); + struct macb *bp = netdev_priv(netdev); + +- if (!(device_may_wakeup(&bp->dev->dev))) { ++ if (!(device_may_wakeup(dev))) { + clk_disable_unprepare(bp->tx_clk); + clk_disable_unprepare(bp->hclk); + clk_disable_unprepare(bp->pclk); +@@ -4528,7 +4528,7 @@ static int __maybe_unused macb_runtime_resume(struct device *dev) + struct net_device *netdev = dev_get_drvdata(dev); + struct macb *bp = netdev_priv(netdev); + +- if (!(device_may_wakeup(&bp->dev->dev))) { ++ if (!(device_may_wakeup(dev))) { + clk_prepare_enable(bp->pclk); + clk_prepare_enable(bp->hclk); + clk_prepare_enable(bp->tx_clk); +-- +2.16.4 + diff --git a/patches.suse/net-macb-mark-device-wake-capable-when-magic-packet-.patch b/patches.suse/net-macb-mark-device-wake-capable-when-magic-packet-.patch new file mode 100644 index 0000000..2226309 --- /dev/null +++ b/patches.suse/net-macb-mark-device-wake-capable-when-magic-packet-.patch @@ -0,0 +1,49 @@ +From b2dee3330c1a9f7816c6fe1a69b8bba2acc45f8a Mon Sep 17 00:00:00 2001 +From: Nicolas Ferre +Date: Fri, 10 Jul 2020 14:46:42 +0200 +Subject: [PATCH 06/15] net: macb: mark device wake capable when "magic-packet" + property present +Patch-mainline: v5.8-rc5 +Git-commit: ced4799d06375929e013eea04ba6908207afabbe +References: git-fixes + +Change the way the "magic-packet" DT property is handled in the +macb_probe() function, matching DT binding documentation. +Now we mark the device as "wakeup capable" instead of calling the +device_init_wakeup() function that would enable the wakeup source. + +For Ethernet WoL, enabling the wakeup_source is done by +using ethtool and associated macb_set_wol() function that +already calls device_set_wakeup_enable() for this purpose. + +That would reduce power consumption by cutting more clocks if +"magic-packet" property is set but WoL is not configured by ethtool. + +Fixes: 3e2a5e153906 ("net: macb: add wake-on-lan support via magic packet") +Cc: Claudiu Beznea +Cc: Harini Katakam +Cc: Sergio Prado +Reviewed-by: Florian Fainelli +Signed-off-by: Nicolas Ferre +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/cadence/macb_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c +index c4f075f478e7..d7d022c94fa8 100644 +--- a/drivers/net/ethernet/cadence/macb_main.c ++++ b/drivers/net/ethernet/cadence/macb_main.c +@@ -4265,7 +4265,7 @@ static int macb_probe(struct platform_device *pdev) + bp->wol = 0; + if (of_get_property(np, "magic-packet", NULL)) + bp->wol |= MACB_WOL_HAS_MAGIC_PACKET; +- device_init_wakeup(&pdev->dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET); ++ device_set_wakeup_capable(&pdev->dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET); + + spin_lock_init(&bp->lock); + +-- +2.16.4 + diff --git a/patches.suse/net-mlx5-Disable-devlink-reload-for-lag-devices.patch b/patches.suse/net-mlx5-Disable-devlink-reload-for-lag-devices.patch new file mode 100644 index 0000000..97de49e --- /dev/null +++ b/patches.suse/net-mlx5-Disable-devlink-reload-for-lag-devices.patch @@ -0,0 +1,34 @@ +From: Shay Drory +Date: Thu, 31 Dec 2020 15:04:08 +0200 +Subject: net/mlx5: Disable devlink reload for lag devices +Patch-mainline: v5.12-rc1 +Git-commit: edac23c2b3d3ac64cfcd351087295893671adbf5 +References: jsc#SLE-8464 + +Devlink reload can't be allowed on lag devices since reloading one lag +device will cause traffic on the bond to get stucked. +Users who wish to reload a lag device, need to remove the device from +the bond, and only then reload it. + +Fixes: 4383cfcc65e7 ("net/mlx5: Add devlink reload") +Signed-off-by: Shay Drory +Reviewed-by: Moshe Shemesh +Signed-off-by: Saeed Mahameed +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c +@@ -101,6 +101,10 @@ static int mlx5_devlink_reload_up(struct + { + struct mlx5_core_dev *dev = devlink_priv(devlink); + ++ if (mlx5_lag_is_active(dev)) { ++ NL_SET_ERR_MSG_MOD(extack, "reload is unsupported in Lag mode\n"); ++ return -EOPNOTSUPP; ++ } + return mlx5_load_one(dev, false); + } + diff --git a/patches.suse/net-mlx5-Disable-devlink-reload-for-multi-port-slave.patch b/patches.suse/net-mlx5-Disable-devlink-reload-for-multi-port-slave.patch new file mode 100644 index 0000000..4421bc6 --- /dev/null +++ b/patches.suse/net-mlx5-Disable-devlink-reload-for-multi-port-slave.patch @@ -0,0 +1,34 @@ +From: Shay Drory +Date: Wed, 30 Dec 2020 09:58:32 +0200 +Subject: net/mlx5: Disable devlink reload for multi port slave device +Patch-mainline: v5.12-rc1 +Git-commit: d89ddaae1766f8fe571ea6eb63ec098ff556f1dd +References: jsc#SLE-8464 + +Devlink reload can't be allowed on a multi port slave device, because +reload of slave device doesn't take effect. + +The right flow is to disable devlink reload for multi port slave +device. Hence, disabling it in mlx5_core probing. + +Fixes: 4383cfcc65e7 ("net/mlx5: Add devlink reload") +Signed-off-by: Shay Drory +Reviewed-by: Moshe Shemesh +Signed-off-by: Saeed Mahameed +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/mellanox/mlx5/core/main.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c +@@ -1367,7 +1367,8 @@ static int init_one(struct pci_dev *pdev + dev_err(&pdev->dev, "mlx5_crdump_enable failed with error code %d\n", err); + + pci_save_state(pdev); +- devlink_reload_enable(devlink); ++ if (!mlx5_core_is_mp_slave(dev)) ++ devlink_reload_enable(devlink); + return 0; + + err_load_one: diff --git a/patches.suse/net-mlx5-Disallow-RoCE-on-lag-device.patch b/patches.suse/net-mlx5-Disallow-RoCE-on-lag-device.patch new file mode 100644 index 0000000..fa7b0da --- /dev/null +++ b/patches.suse/net-mlx5-Disallow-RoCE-on-lag-device.patch @@ -0,0 +1,33 @@ +From: Shay Drory +Date: Sun, 3 Jan 2021 10:09:59 +0200 +Subject: net/mlx5: Disallow RoCE on lag device +Patch-mainline: v5.12-rc1 +Git-commit: 7ab91f2b03367f9d25dd807ebdfb0d67295e0e41 +References: jsc#SLE-8464 + +In lag mode, setting roce enabled/disable of lag device have no effect. +e.g.: bond device (roce/vf_lag) roce status remain unchanged. +Therefore disable it and add an error message. + +Fixes: cc9defcbb8fa ("net/mlx5: Handle "enable_roce" devlink param") +Signed-off-by: Shay Drory +Reviewed-by: Moshe Shemesh +Signed-off-by: Saeed Mahameed +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c +@@ -209,8 +209,8 @@ static int mlx5_devlink_enable_roce_vali + NL_SET_ERR_MSG_MOD(extack, "Device doesn't support RoCE"); + return -EOPNOTSUPP; + } +- if (mlx5_core_is_mp_slave(dev)) { +- NL_SET_ERR_MSG_MOD(extack, "Multi port slave device can't configure RoCE"); ++ if (mlx5_core_is_mp_slave(dev) || mlx5_lag_is_active(dev)) { ++ NL_SET_ERR_MSG_MOD(extack, "Multi port slave/Lag device can't configure RoCE"); + return -EOPNOTSUPP; + } + diff --git a/patches.suse/net-mlx5-Disallow-RoCE-on-multi-port-slave-device.patch b/patches.suse/net-mlx5-Disallow-RoCE-on-multi-port-slave-device.patch new file mode 100644 index 0000000..c5f940c --- /dev/null +++ b/patches.suse/net-mlx5-Disallow-RoCE-on-multi-port-slave-device.patch @@ -0,0 +1,35 @@ +From: Shay Drory +Date: Wed, 30 Dec 2020 10:58:34 +0200 +Subject: net/mlx5: Disallow RoCE on multi port slave device +Patch-mainline: v5.12-rc1 +Git-commit: c70f8597fcc1399ef6d5b5ce648a31d887d5dba2 +References: jsc#SLE-8464 + +In dual port mode, setting roce enabled/disable for the slave device +have no effect. e.g.: the slave device roce status remain unchanged. +Therefore disable it and add an error message. +Enable or disable roce of the master device affect both master and slave +devices. + +Fixes: cc9defcbb8fa ("net/mlx5: Handle "enable_roce" devlink param") +Signed-off-by: Shay Drory +Reviewed-by: Moshe Shemesh +Signed-off-by: Saeed Mahameed +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c +@@ -209,6 +209,10 @@ static int mlx5_devlink_enable_roce_vali + NL_SET_ERR_MSG_MOD(extack, "Device doesn't support RoCE"); + return -EOPNOTSUPP; + } ++ if (mlx5_core_is_mp_slave(dev)) { ++ NL_SET_ERR_MSG_MOD(extack, "Multi port slave device can't configure RoCE"); ++ return -EOPNOTSUPP; ++ } + + return 0; + } diff --git a/patches.suse/net-mlx5e-Change-interrupt-moderation-channel-params.patch b/patches.suse/net-mlx5e-Change-interrupt-moderation-channel-params.patch new file mode 100644 index 0000000..39763aa --- /dev/null +++ b/patches.suse/net-mlx5e-Change-interrupt-moderation-channel-params.patch @@ -0,0 +1,67 @@ +From: Maxim Mikityanskiy +Date: Wed, 3 Feb 2021 18:01:03 +0200 +Subject: net/mlx5e: Change interrupt moderation channel params also when + channels are closed +Patch-mainline: v5.12-rc1 +Git-commit: 65ba8594a238c20e458b3d2d39d91067cbffd0b1 +References: jsc#SLE-15172 + +struct mlx5e_params contains fields ({rx,tx}_cq_moderation) that depend +on two things: whether DIM is enabled and the state of a private flag +(MLX5E_PFLAG_{RX,TX}_CQE_BASED_MODER). Whenever the DIM state changes, +mlx5e_reset_{rx,tx}_moderation is called to update the fields, however, +only if the channels are open. The flow where the channels are closed +misses the required update of the fields. This commit moves the calls of +mlx5e_reset_{rx,tx}_moderation, so that they run in both flows. + +Fixes: ebeaf084ad5c ("net/mlx5e: Properly set default values when disabling adaptive moderation") +Signed-off-by: Maxim Mikityanskiy +Reviewed-by: Tariq Toukan +Signed-off-by: Saeed Mahameed +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 23 +++++++++---------- + 1 file changed, 11 insertions(+), 12 deletions(-) + +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +@@ -584,21 +584,9 @@ int mlx5e_ethtool_set_coalesce(struct ml + tx_moder->pkts = coal->tx_max_coalesced_frames; + new_channels.params.tx_dim_enabled = !!coal->use_adaptive_tx_coalesce; + +- if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) { +- priv->channels.params = new_channels.params; +- goto out; +- } +- /* we are opened */ +- + reset_rx = !!coal->use_adaptive_rx_coalesce != priv->channels.params.rx_dim_enabled; + reset_tx = !!coal->use_adaptive_tx_coalesce != priv->channels.params.tx_dim_enabled; + +- if (!reset_rx && !reset_tx) { +- mlx5e_set_priv_channels_coalesce(priv, coal); +- priv->channels.params = new_channels.params; +- goto out; +- } +- + if (reset_rx) { + u8 mode = MLX5E_GET_PFLAG(&new_channels.params, + MLX5E_PFLAG_RX_CQE_BASED_MODER); +@@ -612,6 +600,17 @@ int mlx5e_ethtool_set_coalesce(struct ml + mlx5e_reset_tx_moderation(&new_channels.params, mode); + } + ++ if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) { ++ priv->channels.params = new_channels.params; ++ goto out; ++ } ++ ++ if (!reset_rx && !reset_tx) { ++ mlx5e_set_priv_channels_coalesce(priv, coal); ++ priv->channels.params = new_channels.params; ++ goto out; ++ } ++ + err = mlx5e_safe_switch_channels(priv, &new_channels, NULL, NULL); + + out: diff --git a/patches.suse/net-mlx5e-E-switch-Fix-rate-calculation-for-overflow-0e22bfb7.patch b/patches.suse/net-mlx5e-E-switch-Fix-rate-calculation-for-overflow-0e22bfb7.patch new file mode 100644 index 0000000..e319c8f --- /dev/null +++ b/patches.suse/net-mlx5e-E-switch-Fix-rate-calculation-for-overflow-0e22bfb7.patch @@ -0,0 +1,34 @@ +From: Parav Pandit +Date: Tue, 12 Jan 2021 16:13:22 +0200 +Subject: net/mlx5e: E-switch, Fix rate calculation for overflow +Patch-mainline: v5.12-rc1 +Git-commit: 0e22bfb7c046e7c8ae339f396e78a0976633698c +References: jsc#SLE-8464 + +rate_bytes_ps is a 64-bit field. It passed as 32-bit field to +apply_police_params(). Due to this when police rate is higher +than 4Gbps, 32-bit calculation ignores the carry. This results +in incorrect rate configurationn the device. + +Fix it by performing 64-bit calculation. + +Fixes: fcb64c0f5640 ("net/mlx5: E-Switch, add ingress rate support") +Signed-off-by: Parav Pandit +Reviewed-by: Eli Cohen +Signed-off-by: Saeed Mahameed +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +@@ -4075,7 +4075,7 @@ static int apply_police_params(struct ml + */ + if (rate) { + rate = (rate * BITS_PER_BYTE) + 500000; +- rate_mbps = max_t(u32, do_div(rate, 1000000), 1); ++ rate_mbps = max_t(u64, do_div(rate, 1000000), 1); + } + + err = mlx5_esw_modify_vport_rate(esw, vport_num, rate_mbps); diff --git a/patches.suse/net-mlx5e-Enable-XDP-for-Connect-X-IPsec-capable-dev.patch b/patches.suse/net-mlx5e-Enable-XDP-for-Connect-X-IPsec-capable-dev.patch new file mode 100644 index 0000000..4c5bfc4 --- /dev/null +++ b/patches.suse/net-mlx5e-Enable-XDP-for-Connect-X-IPsec-capable-dev.patch @@ -0,0 +1,40 @@ +From: Raed Salem +Date: Mon, 25 Jan 2021 09:58:22 +0200 +Subject: net/mlx5e: Enable XDP for Connect-X IPsec capable devices +Patch-mainline: v5.12-rc1 +Git-commit: e33f9f5f2d3a5fa97728a43708f41da2d4faae65 +References: jsc#SLE-15172 + +This limitation was inherited by previous Innova (FPGA) IPsec +implementation, it uses its private set of RQ handlers which +does not support XDP, for Connect-X this is no longer true. + +Fix by keeping this limitation only for Innova IPsec supporting devices, +as otherwise this limitation effectively wrongly blocks XDP for all +future Connect-X devices for all flows even if IPsec offload is not +used. + +Fixes: 2d64663cd559 ("net/mlx5: IPsec: Add HW crypto offload support") +Signed-off-by: Raed Salem +Reviewed-by: Alaa Hleihel +Reviewed-by: Tariq Toukan +Signed-off-by: Saeed Mahameed +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +@@ -4367,8 +4367,9 @@ static int mlx5e_xdp_allowed(struct mlx5 + return -EINVAL; + } + +- if (MLX5_IPSEC_DEV(priv->mdev)) { +- netdev_warn(netdev, "can't set XDP with IPSec offload\n"); ++ if (mlx5_fpga_is_ipsec_device(priv->mdev)) { ++ netdev_warn(netdev, ++ "XDP is not available on Innova cards with IPsec support\n"); + return -EINVAL; + } + diff --git a/patches.suse/net-mlx5e-Enable-striding-RQ-for-Connect-X-IPsec-cap.patch b/patches.suse/net-mlx5e-Enable-striding-RQ-for-Connect-X-IPsec-cap.patch new file mode 100644 index 0000000..228a3cd --- /dev/null +++ b/patches.suse/net-mlx5e-Enable-striding-RQ-for-Connect-X-IPsec-cap.patch @@ -0,0 +1,98 @@ +From: Raed Salem +Date: Sun, 24 Jan 2021 22:40:23 +0200 +Subject: net/mlx5e: Enable striding RQ for Connect-X IPsec capable devices +Patch-mainline: v5.12-rc1 +Git-commit: e4484d9df5000a18916e0bbcee50828eac8e293e +References: jsc#SLE-15172 + +This limitation was inherited by previous Innova (FPGA) IPsec +implementation, it uses its private set of RQ handlers which does +not support striding rq, for Connect-X this is no longer true. + +Fix by keeping this limitation only for Innova IPsec supporting devices, +as otherwise this limitation effectively wrongly blocks striding RQs for +all future Connect-X devices for all flows even if IPsec offload is not +used. + +Fixes: 2d64663cd559 ("net/mlx5: IPsec: Add HW crypto offload support") +Signed-off-by: Raed Salem +Reviewed-by: Tariq Toukan +Signed-off-by: Saeed Mahameed +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 +++-- + drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 4 ++-- + drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c | 2 +- + drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.h | 2 ++ + 4 files changed, 8 insertions(+), 5 deletions(-) + +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +@@ -64,6 +64,7 @@ + #include "en/hv_vhca_stats.h" + #include "en/devlink.h" + #include "lib/mlx5.h" ++#include "fpga/ipsec.h" + + bool mlx5e_check_fragmented_striding_rq_cap(struct mlx5_core_dev *mdev) + { +@@ -105,7 +106,7 @@ bool mlx5e_striding_rq_possible(struct m + if (!mlx5e_check_fragmented_striding_rq_cap(mdev)) + return false; + +- if (MLX5_IPSEC_DEV(mdev)) ++ if (mlx5_fpga_is_ipsec_device(mdev)) + return false; + + if (params->xdp_prog) { +@@ -2060,7 +2061,7 @@ static void mlx5e_build_rq_frags_info(st + int i; + + #ifdef CONFIG_MLX5_EN_IPSEC +- if (MLX5_IPSEC_DEV(mdev)) ++ if (mlx5_fpga_is_ipsec_device(mdev)) + byte_count += MLX5E_METADATA_ETHER_LEN; + #endif + +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +@@ -1772,8 +1772,8 @@ int mlx5e_rq_set_handlers(struct mlx5e_r + + rq->handle_rx_cqe = c->priv->profile->rx_handlers->handle_rx_cqe_mpwqe; + #ifdef CONFIG_MLX5_EN_IPSEC +- if (MLX5_IPSEC_DEV(mdev)) { +- netdev_err(c->netdev, "MPWQE RQ with IPSec offload not supported\n"); ++ if (mlx5_fpga_is_ipsec_device(mdev)) { ++ netdev_err(c->netdev, "MPWQE RQ with Innova IPSec offload not supported\n"); + return -EINVAL; + } + #endif +--- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c +@@ -124,7 +124,7 @@ struct mlx5_fpga_ipsec { + struct ida halloc; + }; + +-static bool mlx5_fpga_is_ipsec_device(struct mlx5_core_dev *mdev) ++bool mlx5_fpga_is_ipsec_device(struct mlx5_core_dev *mdev) + { + if (!mdev->fpga || !MLX5_CAP_GEN(mdev, fpga)) + return false; +--- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.h ++++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.h +@@ -43,6 +43,7 @@ u32 mlx5_fpga_ipsec_device_caps(struct m + const struct mlx5_flow_cmds * + mlx5_fs_cmd_get_default_ipsec_fpga_cmds(enum fs_flow_table_type type); + void mlx5_fpga_ipsec_build_fs_cmds(void); ++bool mlx5_fpga_is_ipsec_device(struct mlx5_core_dev *mdev); + #else + static inline + const struct mlx5_accel_ipsec_ops *mlx5_fpga_ipsec_ops(struct mlx5_core_dev *mdev) +@@ -55,6 +56,7 @@ mlx5_fs_cmd_get_default_ipsec_fpga_cmds( + } + + static inline void mlx5_fpga_ipsec_build_fs_cmds(void) {}; ++static inline bool mlx5_fpga_is_ipsec_device(struct mlx5_core_dev *mdev) { return false; } + + #endif /* CONFIG_MLX5_FPGA_IPSEC */ + #endif /* __MLX5_FPGA_IPSEC_H__ */ diff --git a/patches.suse/net-mlx5e-Fix-CQ-params-of-ICOSQ-and-async-ICOSQ.patch b/patches.suse/net-mlx5e-Fix-CQ-params-of-ICOSQ-and-async-ICOSQ.patch new file mode 100644 index 0000000..a1469c8 --- /dev/null +++ b/patches.suse/net-mlx5e-Fix-CQ-params-of-ICOSQ-and-async-ICOSQ.patch @@ -0,0 +1,48 @@ +From: Maxim Mikityanskiy +Date: Wed, 10 Feb 2021 09:25:28 +0200 +Subject: net/mlx5e: Fix CQ params of ICOSQ and async ICOSQ +Patch-mainline: v5.12-rc1 +Git-commit: ebf79b6be67c0a77a9ab7cdf74c43fd7d9619f0c +References: jsc#SLE-15172 + +The commit mentioned below has split the parameters of ICOSQ and async +ICOSQ, but it contained a typo: the CQ parameters were swapped for ICOSQ +and async ICOSQ. Async ICOSQ is longer than the normal ICOSQ, and the CQ +size must be the same as the size of the corresponding SQ, but due to +this bug, the CQ of async ICOSQ was much shorter than async ICOSQ +itself. It led to overflows of the CQ with such messages in dmesg, in +particular, when running multiple kTLS-offloaded streams: + +mlx5_core 0000:08:00.0: cq_err_event_notifier:529:(pid 9422): CQ error +on CQN 0x406, syndrome 0x1 +mlx5_core 0000:08:00.0 eth2: mlx5e_cq_error_event: cqn=0x000406 +event=0x04 + +This commit fixes the issue by using the corresponding parameters for +ICOSQ and async ICOSQ. + +Fixes: c293ac927fbb ("net/mlx5e: Refactor build channel params") +Signed-off-by: Maxim Mikityanskiy +Reviewed-by: Tariq Toukan +Signed-off-by: Saeed Mahameed +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +@@ -1823,10 +1823,12 @@ static int mlx5e_open_queues(struct mlx5 + int err; + + err = mlx5e_open_cq(c, icocq_moder, &cparam->icosq.cqp, &c->async_icosq.cq); ++ err = mlx5e_open_cq(c, icocq_moder, &cparam->async_icosq.cqp, ++ &c->async_icosq.cq); + if (err) + return err; + +- err = mlx5e_open_cq(c, icocq_moder, &cparam->async_icosq.cqp, &c->icosq.cq); ++ err = mlx5e_open_cq(c, icocq_moder, &cparam->icosq.cqp, &c->icosq.cq); + if (err) + goto err_close_async_icosq_cq; + diff --git a/patches.suse/net-mlx5e-Replace-synchronize_rcu-with-synchronize_n.patch b/patches.suse/net-mlx5e-Replace-synchronize_rcu-with-synchronize_n.patch new file mode 100644 index 0000000..11c4718 --- /dev/null +++ b/patches.suse/net-mlx5e-Replace-synchronize_rcu-with-synchronize_n.patch @@ -0,0 +1,102 @@ +From: Maxim Mikityanskiy +Date: Mon, 1 Feb 2021 14:01:27 +0200 +Subject: net/mlx5e: Replace synchronize_rcu with synchronize_net +Patch-mainline: v5.12-rc1 +Git-commit: 4d6e6b0c6d4bed8a7128500701354e2dc6098fa3 +References: jsc#SLE-15172 + +The commit cited below switched from using napi_synchronize to +synchronize_rcu to have a guarantee that it will finish in finite time. +However, on average, synchronize_rcu takes more time than +napi_synchronize. Given that it's called multiple times per channel on +deactivation, it accumulates to a significant amount, which causes +timeouts in some applications (for example, when using bonding with +NetworkManager). + +This commit replaces synchronize_rcu with synchronize_net, which is +faster when called under rtnl_lock, allowing to speed up the described +flow. + +Fixes: 9c25a22dfb00 ("net/mlx5e: Use synchronize_rcu to sync with NAPI") +Signed-off-by: Maxim Mikityanskiy +Reviewed-by: Tariq Toukan +Signed-off-by: Saeed Mahameed +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h | 2 +- + drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c | 2 +- + drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c | 2 +- + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 8 ++++---- + 4 files changed, 7 insertions(+), 7 deletions(-) + +--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h +@@ -98,7 +98,7 @@ static inline void mlx5e_xdp_tx_disable( + + clear_bit(MLX5E_STATE_XDP_TX_ENABLED, &priv->state); + /* Let other device's napi(s) and XSK wakeups see our new state. */ +- synchronize_rcu(); ++ synchronize_net(); + } + + static inline bool mlx5e_xdp_tx_is_enabled(struct mlx5e_priv *priv) +--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c +@@ -106,7 +106,7 @@ err_free_cparam: + void mlx5e_close_xsk(struct mlx5e_channel *c) + { + clear_bit(MLX5E_CHANNEL_STATE_XSK, c->state); +- synchronize_rcu(); /* Sync with the XSK wakeup and with NAPI. */ ++ synchronize_net(); /* Sync with the XSK wakeup and with NAPI. */ + + mlx5e_close_rq(&c->xskrq); + mlx5e_close_cq(&c->xskrq.cq); +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c +@@ -663,7 +663,7 @@ void mlx5e_ktls_del_rx(struct net_device + priv_rx = mlx5e_get_ktls_rx_priv_ctx(tls_ctx); + set_bit(MLX5E_PRIV_RX_FLAG_DELETING, priv_rx->flags); + mlx5e_set_ktls_rx_priv_ctx(tls_ctx, NULL); +- synchronize_rcu(); /* Sync with NAPI */ ++ synchronize_net(); /* Sync with NAPI */ + if (!cancel_work_sync(&priv_rx->rule.work)) + /* completion is needed, as the priv_rx in the add flow + * is maintained on the wqe info (wi), not on the socket. +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +@@ -913,7 +913,7 @@ void mlx5e_activate_rq(struct mlx5e_rq * + void mlx5e_deactivate_rq(struct mlx5e_rq *rq) + { + clear_bit(MLX5E_RQ_STATE_ENABLED, &rq->state); +- synchronize_rcu(); /* Sync with NAPI to prevent mlx5e_post_rx_wqes. */ ++ synchronize_net(); /* Sync with NAPI to prevent mlx5e_post_rx_wqes. */ + } + + void mlx5e_close_rq(struct mlx5e_rq *rq) +@@ -1361,7 +1361,7 @@ static void mlx5e_deactivate_txqsq(struc + struct mlx5_wq_cyc *wq = &sq->wq; + + clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state); +- synchronize_rcu(); /* Sync with NAPI to prevent netif_tx_wake_queue. */ ++ synchronize_net(); /* Sync with NAPI to prevent netif_tx_wake_queue. */ + + mlx5e_tx_disable_queue(sq->txq); + +@@ -1437,7 +1437,7 @@ void mlx5e_activate_icosq(struct mlx5e_i + void mlx5e_deactivate_icosq(struct mlx5e_icosq *icosq) + { + clear_bit(MLX5E_SQ_STATE_ENABLED, &icosq->state); +- synchronize_rcu(); /* Sync with NAPI. */ ++ synchronize_net(); /* Sync with NAPI. */ + } + + void mlx5e_close_icosq(struct mlx5e_icosq *sq) +@@ -1516,7 +1516,7 @@ void mlx5e_close_xdpsq(struct mlx5e_xdps + struct mlx5e_channel *c = sq->channel; + + clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state); +- synchronize_rcu(); /* Sync with NAPI. */ ++ synchronize_net(); /* Sync with NAPI. */ + + mlx5e_destroy_sq(c->mdev, sq->sqn); + mlx5e_free_xdpsq_descs(sq); diff --git a/patches.suse/net-mlx5e-kTLS-Use-refcounts-to-free-kTLS-RX-priv-co.patch b/patches.suse/net-mlx5e-kTLS-Use-refcounts-to-free-kTLS-RX-priv-co.patch new file mode 100644 index 0000000..a96965e --- /dev/null +++ b/patches.suse/net-mlx5e-kTLS-Use-refcounts-to-free-kTLS-RX-priv-co.patch @@ -0,0 +1,153 @@ +From: Maxim Mikityanskiy +Date: Fri, 22 Jan 2021 18:42:29 +0200 +Subject: net/mlx5e: kTLS, Use refcounts to free kTLS RX priv context +Patch-mainline: v5.12-rc1 +Git-commit: b850bbff965129c34f50962638c0a66c82563536 +References: jsc#SLE-15172 + +wait_for_resync is unreliable - if it timeouts, priv_rx will be freed +anyway. However, mlx5e_ktls_handle_get_psv_completion will be called +sooner or later, leading to use-after-free. For example, it can happen +if a CQ error happened, and ICOSQ stopped, but later on the queues are +destroyed, and ICOSQ is flushed with mlx5e_free_icosq_descs. + +This patch converts the lifecycle of priv_rx to fully refcount-based, so +that the struct won't be freed before the refcount goes to zero. + +Fixes: 0419d8c9d8f8 ("net/mlx5e: kTLS, Add kTLS RX resync support") +Signed-off-by: Maxim Mikityanskiy +Reviewed-by: Tariq Toukan +Signed-off-by: Saeed Mahameed +Acked-by: Thomas Bogendoerfer +--- + drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c | 64 ++++++------- + 1 file changed, 30 insertions(+), 34 deletions(-) + +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c +@@ -57,6 +57,20 @@ struct mlx5e_ktls_offload_context_rx { + struct mlx5e_ktls_rx_resync_ctx resync; + }; + ++static bool mlx5e_ktls_priv_rx_put(struct mlx5e_ktls_offload_context_rx *priv_rx) ++{ ++ if (!refcount_dec_and_test(&priv_rx->resync.refcnt)) ++ return false; ++ ++ kfree(priv_rx); ++ return true; ++} ++ ++static void mlx5e_ktls_priv_rx_get(struct mlx5e_ktls_offload_context_rx *priv_rx) ++{ ++ refcount_inc(&priv_rx->resync.refcnt); ++} ++ + static int mlx5e_ktls_create_tir(struct mlx5_core_dev *mdev, u32 *tirn, u32 rqtn) + { + int err, inlen; +@@ -326,7 +340,7 @@ static void resync_handle_work(struct wo + priv_rx = container_of(resync, struct mlx5e_ktls_offload_context_rx, resync); + + if (unlikely(test_bit(MLX5E_PRIV_RX_FLAG_DELETING, priv_rx->flags))) { +- refcount_dec(&resync->refcnt); ++ mlx5e_ktls_priv_rx_put(priv_rx); + return; + } + +@@ -334,7 +348,7 @@ static void resync_handle_work(struct wo + sq = &c->async_icosq; + + if (resync_post_get_progress_params(sq, priv_rx)) +- refcount_dec(&resync->refcnt); ++ mlx5e_ktls_priv_rx_put(priv_rx); + } + + static void resync_init(struct mlx5e_ktls_rx_resync_ctx *resync, +@@ -377,7 +391,11 @@ unlock: + return err; + } + +-/* Function is called with elevated refcount, it decreases it. */ ++/* Function can be called with the refcount being either elevated or not. ++ * It decreases the refcount and may free the kTLS priv context. ++ * Refcount is not elevated only if tls_dev_del has been called, but GET_PSV was ++ * already in flight. ++ */ + void mlx5e_ktls_handle_get_psv_completion(struct mlx5e_icosq_wqe_info *wi, + struct mlx5e_icosq *sq) + { +@@ -410,7 +428,7 @@ void mlx5e_ktls_handle_get_psv_completio + tls_offload_rx_resync_async_request_end(priv_rx->sk, cpu_to_be32(hw_seq)); + priv_rx->stats->tls_resync_req_end++; + out: +- refcount_dec(&resync->refcnt); ++ mlx5e_ktls_priv_rx_put(priv_rx); + dma_unmap_single(dev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE); + kfree(buf); + } +@@ -431,9 +449,9 @@ static bool resync_queue_get_psv(struct + return false; + + resync = &priv_rx->resync; +- refcount_inc(&resync->refcnt); ++ mlx5e_ktls_priv_rx_get(priv_rx); + if (unlikely(!queue_work(resync->priv->tls->rx_wq, &resync->work))) +- refcount_dec(&resync->refcnt); ++ mlx5e_ktls_priv_rx_put(priv_rx); + + return true; + } +@@ -625,31 +643,6 @@ err_create_key: + return err; + } + +-/* Elevated refcount on the resync object means there are +- * outstanding operations (uncompleted GET_PSV WQEs) that +- * will read the resync / priv_rx objects once completed. +- * Wait for them to avoid use-after-free. +- */ +-static void wait_for_resync(struct net_device *netdev, +- struct mlx5e_ktls_rx_resync_ctx *resync) +-{ +-#define MLX5E_KTLS_RX_RESYNC_TIMEOUT 20000 /* msecs */ +- unsigned long exp_time = jiffies + msecs_to_jiffies(MLX5E_KTLS_RX_RESYNC_TIMEOUT); +- unsigned int refcnt; +- +- do { +- refcnt = refcount_read(&resync->refcnt); +- if (refcnt == 1) +- return; +- +- msleep(20); +- } while (time_before(jiffies, exp_time)); +- +- netdev_warn(netdev, +- "Failed waiting for kTLS RX resync refcnt to be released (%u).\n", +- refcnt); +-} +- + void mlx5e_ktls_del_rx(struct net_device *netdev, struct tls_context *tls_ctx) + { + struct mlx5e_ktls_offload_context_rx *priv_rx; +@@ -671,8 +664,7 @@ void mlx5e_ktls_del_rx(struct net_device + wait_for_completion(&priv_rx->add_ctx); + resync = &priv_rx->resync; + if (cancel_work_sync(&resync->work)) +- refcount_dec(&resync->refcnt); +- wait_for_resync(netdev, resync); ++ mlx5e_ktls_priv_rx_put(priv_rx); + + priv_rx->stats->tls_del++; + if (priv_rx->rule.rule) +@@ -680,5 +672,9 @@ void mlx5e_ktls_del_rx(struct net_device + + mlx5_core_destroy_tir(mdev, priv_rx->tirn); + mlx5_ktls_destroy_key(mdev, priv_rx->key_id); +- kfree(priv_rx); ++ /* priv_rx should normally be freed here, but if there is an outstanding ++ * GET_PSV, deallocation will be delayed until the CQE for GET_PSV is ++ * processed. ++ */ ++ mlx5e_ktls_priv_rx_put(priv_rx); + } diff --git a/patches.suse/net-nixge-fix-potential-memory-leak-in-nixge_probe.patch b/patches.suse/net-nixge-fix-potential-memory-leak-in-nixge_probe.patch new file mode 100644 index 0000000..71680c1 --- /dev/null +++ b/patches.suse/net-nixge-fix-potential-memory-leak-in-nixge_probe.patch @@ -0,0 +1,53 @@ +From b7c1b6b34d2217a8cdf1cc3e9c33cfcf50a44b2a Mon Sep 17 00:00:00 2001 +From: Lu Wei +Date: Wed, 29 Jul 2020 11:50:05 +0800 +Subject: [PATCH 14/15] net: nixge: fix potential memory leak in nixge_probe() +Patch-mainline: v5.8 +Git-commit: 366228ed01f6882cc203e3d5b40010dfae0be1c3 +References: git-fixes + +If some processes in nixge_probe() fail, free_netdev(dev) +needs to be called to aviod a memory leak. + +Fixes: 87ab207981ec ("net: nixge: Separate ctrl and dma resources") +Fixes: abcd3d6fc640 ("net: nixge: Fix error path for obtaining mac address") +Reported-by: Hulk Robot +Signed-off-by: Lu Wei +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/ni/nixge.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c +index 2761f3a3ae50..56f285985b43 100644 +--- a/drivers/net/ethernet/ni/nixge.c ++++ b/drivers/net/ethernet/ni/nixge.c +@@ -1318,19 +1318,21 @@ static int nixge_probe(struct platform_device *pdev) + netif_napi_add(ndev, &priv->napi, nixge_poll, NAPI_POLL_WEIGHT); + err = nixge_of_get_resources(pdev); + if (err) +- return err; ++ goto free_netdev; + __nixge_hw_set_mac_address(ndev); + + priv->tx_irq = platform_get_irq_byname(pdev, "tx"); + if (priv->tx_irq < 0) { + netdev_err(ndev, "could not find 'tx' irq"); +- return priv->tx_irq; ++ err = priv->tx_irq; ++ goto free_netdev; + } + + priv->rx_irq = platform_get_irq_byname(pdev, "rx"); + if (priv->rx_irq < 0) { + netdev_err(ndev, "could not find 'rx' irq"); +- return priv->rx_irq; ++ err = priv->rx_irq; ++ goto free_netdev; + } + + priv->coalesce_count_rx = XAXIDMA_DFT_RX_THRESHOLD; +-- +2.16.4 + diff --git a/patches.suse/net-octeon-mgmt-Repair-filling-of-RX-ring.patch b/patches.suse/net-octeon-mgmt-Repair-filling-of-RX-ring.patch new file mode 100644 index 0000000..ed2233a --- /dev/null +++ b/patches.suse/net-octeon-mgmt-Repair-filling-of-RX-ring.patch @@ -0,0 +1,46 @@ +From 240ebf303276af0676b2d46ce232292d269d19a9 Mon Sep 17 00:00:00 2001 +From: Alexander Sverdlin +Date: Fri, 29 May 2020 14:17:10 +0200 +Subject: [PATCH 8/9] net: octeon: mgmt: Repair filling of RX ring +Git-commit: 0c34bb598c510e070160029f34efeeb217000f8d +Patch-mainline: v5.8-rc1 +References: git-fixes + +The removal of mips_swiotlb_ops exposed a problem in octeon_mgmt Ethernet +driver. mips_swiotlb_ops had an mb() after most of the operations and the +removal of the ops had broken the receive functionality of the driver. +My code inspection has shown no other places except +octeon_mgmt_rx_fill_ring() where an explicit barrier would be obviously +missing. The latter function however has to make sure that "ringing the +bell" doesn't happen before RX ring entry is really written. + +The patch has been successfully tested on Octeon II. + +Fixes: a999933db9ed ("MIPS: remove mips_swiotlb_ops") +Cc: stable@vger.kernel.org +Signed-off-by: Alexander Sverdlin +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/cavium/octeon/octeon_mgmt.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c +index cdd7e5da4a74..d375e438d805 100644 +--- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c ++++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c +@@ -235,6 +235,11 @@ static void octeon_mgmt_rx_fill_ring(struct net_device *netdev) + + /* Put it in the ring. */ + p->rx_ring[p->rx_next_fill] = re.d64; ++ /* Make sure there is no reorder of filling the ring and ringing ++ * the bell ++ */ ++ wmb(); ++ + dma_sync_single_for_device(p->dev, p->rx_ring_handle, + ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE), + DMA_BIDIRECTIONAL); +-- +2.16.4 + diff --git a/patches.suse/net-phy-marvell10g-fix-null-pointer-dereference.patch b/patches.suse/net-phy-marvell10g-fix-null-pointer-dereference.patch new file mode 100644 index 0000000..ff4001f --- /dev/null +++ b/patches.suse/net-phy-marvell10g-fix-null-pointer-dereference.patch @@ -0,0 +1,89 @@ +From ecba5154a52ab34327989e272e630786aa7e97ff Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Beh=C3=BAn?= +Date: Mon, 10 Aug 2020 17:01:58 +0200 +Subject: [PATCH 2/2] net: phy: marvell10g: fix null pointer dereference +Git-commit: 1b8ef1423dbfd34de2439a2db457b84480b7c8a8 +Patch-mainline: v5.9-rc1 +References: git-fixes + +Commit c3e302edca24 ("net: phy: marvell10g: fix temperature sensor on 2110") +added a check for PHY ID via phydev->drv->phy_id in a function which is +called by devres at a time when phydev->drv is already set to null by +phy_remove function. + +This null pointer dereference can be triggered via SFP subsystem with a +SFP module containing this Marvell PHY. When the SFP interface is put +down, the SFP subsystem removes the PHY. + +Fixes: c3e302edca24 ("net: phy: marvell10g: fix temperature sensor on 2110") +Signed-off-by: Marek Behún +Cc: Maxime Chevallier +Cc: Andrew Lunn +Cc: Baruch Siach +Cc: Russell King +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/phy/marvell10g.c | 18 +++++++----------- + 1 file changed, 7 insertions(+), 11 deletions(-) + +diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c +index 9c8ac9188fbd..e0de693a1bd1 100644 +--- a/drivers/net/phy/marvell10g.c ++++ b/drivers/net/phy/marvell10g.c +@@ -179,13 +179,6 @@ static int mv3310_hwmon_config(struct phy_device *phydev, bool enable) + MV_V2_TEMP_CTRL_MASK, val); + } + +-static void mv3310_hwmon_disable(void *data) +-{ +- struct phy_device *phydev = data; +- +- mv3310_hwmon_config(phydev, false); +-} +- + static int mv3310_hwmon_probe(struct phy_device *phydev) + { + struct device *dev = &phydev->mdio.dev; +@@ -209,10 +202,6 @@ static int mv3310_hwmon_probe(struct phy_device *phydev) + if (ret) + return ret; + +- ret = devm_add_action_or_reset(dev, mv3310_hwmon_disable, phydev); +- if (ret) +- return ret; +- + priv->hwmon_dev = devm_hwmon_device_register_with_info(dev, + priv->hwmon_name, phydev, + &mv3310_hwmon_chip_info, NULL); +@@ -286,6 +275,11 @@ static int mv3310_probe(struct phy_device *phydev) + return phy_sfp_probe(phydev, &mv3310_sfp_ops); + } + ++static void mv3310_remove(struct phy_device *phydev) ++{ ++ mv3310_hwmon_config(phydev, false); ++} ++ + static int mv3310_suspend(struct phy_device *phydev) + { + return phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL, +@@ -537,6 +531,7 @@ static struct phy_driver mv3310_drivers[] = { + .config_aneg = mv3310_config_aneg, + .aneg_done = mv3310_aneg_done, + .read_status = mv3310_read_status, ++ .remove = mv3310_remove, + }, + { + .phy_id = MARVELL_PHY_ID_88E2110, +@@ -550,6 +545,7 @@ static struct phy_driver mv3310_drivers[] = { + .config_aneg = mv3310_config_aneg, + .aneg_done = mv3310_aneg_done, + .read_status = mv3310_read_status, ++ .remove = mv3310_remove, + }, + }; + +-- +2.16.4 + diff --git a/patches.suse/net-phy-marvell10g-fix-temperature-sensor-on-2110.patch b/patches.suse/net-phy-marvell10g-fix-temperature-sensor-on-2110.patch new file mode 100644 index 0000000..769f83d --- /dev/null +++ b/patches.suse/net-phy-marvell10g-fix-temperature-sensor-on-2110.patch @@ -0,0 +1,84 @@ +From 530f7bda3e275d0195b33a3208767295583b5e02 Mon Sep 17 00:00:00 2001 +From: Baruch Siach +Date: Sun, 26 Apr 2020 09:22:06 +0300 +Subject: [PATCH 1/9] net: phy: marvell10g: fix temperature sensor on 2110 +Git-commit: c3e302edca2457bbd0c958c445a7538fbf6a6ac8 +Patch-mainline: v5.7-rc5 +References: git-fixes + +Read the temperature sensor register from the correct location for the +88E2110 PHY. There is no enable/disable bit on 2110, so make +mv3310_hwmon_config() run on 88X3310 only. + +Fixes: 62d01535474b61 ("net: phy: marvell10g: add support for the 88x2110 PHY") +Cc: Maxime Chevallier +Reviewed-by: Andrew Lunn +Signed-off-by: Baruch Siach +Reviewed-by: Russell King +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/phy/marvell10g.c | 26 +++++++++++++++++++++++++- + 1 file changed, 25 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c +index 1bf13017d288..9c8ac9188fbd 100644 +--- a/drivers/net/phy/marvell10g.c ++++ b/drivers/net/phy/marvell10g.c +@@ -44,6 +44,9 @@ enum { + MV_PCS_PAIRSWAP_AB = 0x0002, + MV_PCS_PAIRSWAP_NONE = 0x0003, + ++ /* Temperature read register (88E2110 only) */ ++ MV_PCS_TEMP = 0x8042, ++ + /* These registers appear at 0x800X and 0xa00X - the 0xa00X control + * registers appear to set themselves to the 0x800X when AN is + * restarted, but status registers appear readable from either. +@@ -79,6 +82,24 @@ static umode_t mv3310_hwmon_is_visible(const void *data, + return 0; + } + ++static int mv3310_hwmon_read_temp_reg(struct phy_device *phydev) ++{ ++ return phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_TEMP); ++} ++ ++static int mv2110_hwmon_read_temp_reg(struct phy_device *phydev) ++{ ++ return phy_read_mmd(phydev, MDIO_MMD_PCS, MV_PCS_TEMP); ++} ++ ++static int mv10g_hwmon_read_temp_reg(struct phy_device *phydev) ++{ ++ if (phydev->drv->phy_id == MARVELL_PHY_ID_88X3310) ++ return mv3310_hwmon_read_temp_reg(phydev); ++ else /* MARVELL_PHY_ID_88E2110 */ ++ return mv2110_hwmon_read_temp_reg(phydev); ++} ++ + static int mv3310_hwmon_read(struct device *dev, enum hwmon_sensor_types type, + u32 attr, int channel, long *value) + { +@@ -91,7 +112,7 @@ static int mv3310_hwmon_read(struct device *dev, enum hwmon_sensor_types type, + } + + if (type == hwmon_temp && attr == hwmon_temp_input) { +- temp = phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_TEMP); ++ temp = mv10g_hwmon_read_temp_reg(phydev); + if (temp < 0) + return temp; + +@@ -144,6 +165,9 @@ static int mv3310_hwmon_config(struct phy_device *phydev, bool enable) + u16 val; + int ret; + ++ if (phydev->drv->phy_id != MARVELL_PHY_ID_88X3310) ++ return 0; ++ + ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, MV_V2_TEMP, + MV_V2_TEMP_UNKNOWN); + if (ret < 0) +-- +2.16.4 + diff --git a/patches.suse/net-smc91x-Fix-possible-memory-leak-in-smc_drv_probe.patch b/patches.suse/net-smc91x-Fix-possible-memory-leak-in-smc_drv_probe.patch new file mode 100644 index 0000000..cc1223e --- /dev/null +++ b/patches.suse/net-smc91x-Fix-possible-memory-leak-in-smc_drv_probe.patch @@ -0,0 +1,47 @@ +From 5e82359a3157f3078be1598140909ace236990fd Mon Sep 17 00:00:00 2001 +From: Wang Hai +Date: Thu, 16 Jul 2020 11:50:38 +0800 +Subject: [PATCH 08/15] net: smc91x: Fix possible memory leak in + smc_drv_probe() +Patch-mainline: v5.8-rc7 +Git-commit: bca9749b1aa23d964d3ab930938af66dbf887f15 +References: git-fixes + +If try_toggle_control_gpio() failed in smc_drv_probe(), free_netdev(ndev) +should be called to free the ndev created earlier. Otherwise, a memleak +will occur. + +Fixes: 7d2911c43815 ("net: smc91x: Fix gpios for device tree based booting") +Reported-by: Hulk Robot +Signed-off-by: Wang Hai +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/smsc/smc91x.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c +index 3a6761131f4c..2248d2674612 100644 +--- a/drivers/net/ethernet/smsc/smc91x.c ++++ b/drivers/net/ethernet/smsc/smc91x.c +@@ -2274,7 +2274,7 @@ static int smc_drv_probe(struct platform_device *pdev) + ret = try_toggle_control_gpio(&pdev->dev, &lp->power_gpio, + "power", 0, 0, 100); + if (ret) +- return ret; ++ goto out_free_netdev; + + /* + * Optional reset GPIO configured? Minimum 100 ns reset needed +@@ -2283,7 +2283,7 @@ static int smc_drv_probe(struct platform_device *pdev) + ret = try_toggle_control_gpio(&pdev->dev, &lp->reset_gpio, + "reset", 0, 0, 100); + if (ret) +- return ret; ++ goto out_free_netdev; + + /* + * Need to wait for optional EEPROM to load, max 750 us according +-- +2.16.4 + diff --git a/patches.suse/objtool-fix-cold-section-suffix-check-for-newer-versions-of-gcc.patch b/patches.suse/objtool-fix-cold-section-suffix-check-for-newer-versions-of-gcc.patch new file mode 100644 index 0000000..b6ec9d7 --- /dev/null +++ b/patches.suse/objtool-fix-cold-section-suffix-check-for-newer-versions-of-gcc.patch @@ -0,0 +1,39 @@ +From: Josh Poimboeuf +Date: Thu, 21 Jan 2021 15:29:19 -0600 +Subject: objtool: Fix ".cold" section suffix check for newer versions of GCC +Git-commit: 34ca59e109bdf69704c33b8eeffaa4c9f71076e5 +Patch-mainline: v5.12-rc1 +References: bsc#1169514 + +With my version of GCC 9.3.1 the ".cold" subfunctions no longer have a +numbered suffix, so the trailing period is no longer there. + +Presumably this doesn't yet trigger a user-visible bug since most of the +subfunction detection logic is duplicated. I only found it when +testing vmlinux.o validation. + +Fixes: 54262aa28301 ("objtool: Fix sibling call detection") +Signed-off-by: Josh Poimboeuf +Link: https://lore.kernel.org/r/ca0b5a57f08a2fbb48538dd915cc253b5edabb40.1611263461.git.jpoimboe@redhat.com + +Acked-by: Miroslav Benes +--- + tools/objtool/check.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tools/objtool/check.c b/tools/objtool/check.c +index 081572170f6b..c964cd56b557 100644 +--- a/tools/objtool/check.c ++++ b/tools/objtool/check.c +@@ -846,8 +846,8 @@ static int add_jump_destinations(struct objtool_file *file) + * case where the parent function's only reference to a + * subfunction is through a jump table. + */ +- if (!strstr(insn->func->name, ".cold.") && +- strstr(insn->jump_dest->func->name, ".cold.")) { ++ if (!strstr(insn->func->name, ".cold") && ++ strstr(insn->jump_dest->func->name, ".cold")) { + insn->func->cfunc = insn->jump_dest->func; + insn->jump_dest->func->pfunc = insn->func; + + diff --git a/patches.suse/objtool-fix-error-handling-for-std-cld-warnings.patch b/patches.suse/objtool-fix-error-handling-for-std-cld-warnings.patch new file mode 100644 index 0000000..0ffb0a6 --- /dev/null +++ b/patches.suse/objtool-fix-error-handling-for-std-cld-warnings.patch @@ -0,0 +1,46 @@ +From: Josh Poimboeuf +Date: Thu, 21 Jan 2021 15:29:17 -0600 +Subject: objtool: Fix error handling for STD/CLD warnings +Git-commit: 6f567c9300a5ebd7b18c26dda1c8d6ffbdd0debd +Patch-mainline: v5.12-rc1 +References: bsc#1169514 + +Actually return an error (and display a backtrace, if requested) for +directional bit warnings. + +Fixes: 2f0f9e9ad7b3 ("objtool: Add Direction Flag validation") +Signed-off-by: Josh Poimboeuf +Link: https://lore.kernel.org/r/dc70f2adbc72f09526f7cab5b6feb8bf7f6c5ad4.1611263461.git.jpoimboe@redhat.com + +Acked-by: Miroslav Benes +--- + tools/objtool/check.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/tools/objtool/check.c b/tools/objtool/check.c +index 270b507e7098..3bdd946c2027 100644 +--- a/tools/objtool/check.c ++++ b/tools/objtool/check.c +@@ -2651,15 +2651,19 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, + break; + + case INSN_STD: +- if (state.df) ++ if (state.df) { + WARN_FUNC("recursive STD", sec, insn->offset); ++ return 1; ++ } + + state.df = true; + break; + + case INSN_CLD: +- if (!state.df && func) ++ if (!state.df && func) { + WARN_FUNC("redundant CLD", sec, insn->offset); ++ return 1; ++ } + + state.df = false; + break; + diff --git a/patches.suse/objtool-fix-retpoline-detection-in-asm-code.patch b/patches.suse/objtool-fix-retpoline-detection-in-asm-code.patch new file mode 100644 index 0000000..e2630f5 --- /dev/null +++ b/patches.suse/objtool-fix-retpoline-detection-in-asm-code.patch @@ -0,0 +1,62 @@ +From: Josh Poimboeuf +Date: Thu, 21 Jan 2021 15:29:18 -0600 +Subject: objtool: Fix retpoline detection in asm code +Git-commit: 1f9a1b74942485a0a29e7c4a9a9f2fe8aea17766 +Patch-mainline: v5.12-rc1 +References: bsc#1169514 + +The JMP_NOSPEC macro branches to __x86_retpoline_*() rather than the +__x86_indirect_thunk_*() wrappers used by C code. Detect jumps to +__x86_retpoline_*() as retpoline dynamic jumps. + +Presumably this doesn't trigger a user-visible bug. I only found it +when testing vmlinux.o validation. + +Fixes: 39b735332cb8 ("objtool: Detect jumps to retpoline thunks") +Signed-off-by: Josh Poimboeuf +Link: https://lore.kernel.org/r/31f5833e2e4f01e3d755889ac77e3661e906c09f.1611263461.git.jpoimboe@redhat.com + +Acked-by: Miroslav Benes +--- + tools/objtool/check.c | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +--- a/tools/objtool/check.c ++++ b/tools/objtool/check.c +@@ -103,6 +103,17 @@ static bool is_static_jump(struct instru + insn->type == INSN_JUMP_UNCONDITIONAL; + } + ++static inline bool is_dynamic_jump(struct instruction *insn) ++{ ++ return insn->type == INSN_JUMP_DYNAMIC || ++ insn->type == INSN_JUMP_DYNAMIC_CONDITIONAL; ++} ++ ++static inline bool is_jump(struct instruction *insn) ++{ ++ return is_static_jump(insn) || is_dynamic_jump(insn); ++} ++ + static bool is_sibling_call(struct instruction *insn) + { + /* An indirect jump is either a sibling call or a jump to a table. */ +@@ -580,7 +591,8 @@ static int add_jump_destinations(struct + } else if (rela->sym->sec->idx) { + dest_sec = rela->sym->sec; + dest_off = rela->sym->sym.st_value + rela->addend + 4; +- } else if (strstr(rela->sym->name, "_indirect_thunk_")) { ++ } else if (!strncmp(rela->sym->name, "__x86_indirect_thunk_", 21) || ++ !strncmp(rela->sym->name, "__x86_retpoline_", 16)) { + /* + * Retpoline jumps are really dynamic jumps in + * disguise, so convert them accordingly. +@@ -790,7 +802,7 @@ static int handle_group_alt(struct objto + * replacement group. + */ + if ((insn->offset != special_alt->new_off || +- (insn->type != INSN_CALL && !is_static_jump(insn))) && ++ (insn->type != INSN_CALL && !is_jump(insn))) && + find_rela_by_dest_range(insn->sec, insn->offset, insn->len)) { + + WARN_FUNC("unsupported relocation in alternatives section", diff --git a/patches.suse/phy-rockchip-emmc-emmc_phy_init-always-return-0.patch b/patches.suse/phy-rockchip-emmc-emmc_phy_init-always-return-0.patch new file mode 100644 index 0000000..e3a55b4 --- /dev/null +++ b/patches.suse/phy-rockchip-emmc-emmc_phy_init-always-return-0.patch @@ -0,0 +1,52 @@ +From 39961bd6b70e5a5d7c4b5483ad8e1db6b5765c60 Mon Sep 17 00:00:00 2001 +From: Chris Ruehl +Date: Thu, 10 Dec 2020 16:04:54 +0800 +Subject: [PATCH] phy: rockchip-emmc: emmc_phy_init() always return 0 +Git-commit: 39961bd6b70e5a5d7c4b5483ad8e1db6b5765c60 +Patch-mainline: v5.12-rc1 +References: git-fixes + +rockchip_emmc_phy_init() return variable is not set with the error value +if clk_get() failed. 'emmcclk' is optional, thus use clk_get_optional() +and if the return value != NULL make error processing and set the +return code accordingly. + +Fixes: 52c0624a10cce phy: rockchip-emmc: Set phyctrl_frqsel based on card clock +Signed-off-by: Chris Ruehl +Reviewed-by: Douglas Anderson +Link: https://lore.kernel.org/r/20201210080454.17379-1-chris.ruehl@gtsys.com.hk +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/phy/rockchip/phy-rockchip-emmc.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockchip/phy-rockchip-emmc.c +index 1e424f263e7a..496d199852af 100644 +--- a/drivers/phy/rockchip/phy-rockchip-emmc.c ++++ b/drivers/phy/rockchip/phy-rockchip-emmc.c +@@ -248,15 +248,17 @@ static int rockchip_emmc_phy_init(struct phy *phy) + * - SDHCI driver to get the PHY + * - SDHCI driver to init the PHY + * +- * The clock is optional, so upon any error we just set to NULL. ++ * The clock is optional, using clk_get_optional() to get the clock ++ * and do error processing if the return value != NULL + * + * NOTE: we don't do anything special for EPROBE_DEFER here. Given the + * above expected use case, EPROBE_DEFER isn't sensible to expect, so + * it's just like any other error. + */ +- rk_phy->emmcclk = clk_get(&phy->dev, "emmcclk"); ++ rk_phy->emmcclk = clk_get_optional(&phy->dev, "emmcclk"); + if (IS_ERR(rk_phy->emmcclk)) { +- dev_dbg(&phy->dev, "Error getting emmcclk: %d\n", ret); ++ ret = PTR_ERR(rk_phy->emmcclk); ++ dev_err(&phy->dev, "Error getting emmcclk: %d\n", ret); + rk_phy->emmcclk = NULL; + } + +-- +2.26.2 + diff --git a/patches.suse/phy-tegra-xusb-Fix-usb_phy-device-driver-field.patch b/patches.suse/phy-tegra-xusb-Fix-usb_phy-device-driver-field.patch index f9afc3e..d242da1 100644 --- a/patches.suse/phy-tegra-xusb-Fix-usb_phy-device-driver-field.patch +++ b/patches.suse/phy-tegra-xusb-Fix-usb_phy-device-driver-field.patch @@ -3,8 +3,7 @@ Date: Tue, 17 Nov 2020 16:38:03 +0800 Subject: phy: tegra: xusb: Fix usb_phy device driver field Git-commit: 4ea0bf2a52f1eea76578eac5a9148d95f5e181c0 -Patch-mainline: Queued -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +Patch-mainline: v5.11-rc1 References: jsc#SLE-15847 In commit "phy: tegra: xusb: Add usb-phy support", an OTG capable PHY diff --git a/patches.suse/powerpc-Fix-build-error-in-paravirt.h.patch b/patches.suse/powerpc-Fix-build-error-in-paravirt.h.patch index d690849..ea7ee12 100644 --- a/patches.suse/powerpc-Fix-build-error-in-paravirt.h.patch +++ b/patches.suse/powerpc-Fix-build-error-in-paravirt.h.patch @@ -1,12 +1,11 @@ -From 3aa193c6a2a8bb8b44a66b2ae43315410a0f8dfc Mon Sep 17 00:00:00 2001 +From 9899a56f1eca964cd0de21008a9fa1523a571231 Mon Sep 17 00:00:00 2001 From: Michal Suchanek -Date: Wed, 20 Jan 2021 12:57:28 +0100 +Date: Wed, 20 Jan 2021 14:28:38 +0100 Subject: [PATCH] powerpc: Fix build error in paravirt.h -To: linuxppc-dev@lists.ozlabs.org -Cc: Juergen Gross , Deep Shah , "VMware, Inc." , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Waiman Long , Srikar Dronamraju , virtualization@lists.linux-foundation.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: bsc#1181148 ltc#190702 -Patch-mainline: submitted https://lore.kernel.org/linuxppc-dev/20210120132838.15589-1-msuchanek@suse.de/T/#u +Patch-mainline: v5.12-rc1 +Git-commit: 9899a56f1eca964cd0de21008a9fa1523a571231 ./arch/powerpc/include/asm/paravirt.h:83:44: error: implicit declaration of function 'smp_processor_id'; did you mean 'raw_smp_processor_id'? @@ -18,6 +17,8 @@ it only works by chance in mainline. Fixes: ca3f969dcb11 ("powerpc/paravirt: Use is_kvm_guest() in vcpu_is_preempted()") Signed-off-by: Michal Suchanek +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20210120132838.15589-1-msuchanek@suse.de --- arch/powerpc/include/asm/paravirt.h | 1 + 1 file changed, 1 insertion(+) diff --git a/patches.suse/powerpc-optprobes-Remove-unused-routine-patch_imm32_.patch b/patches.suse/powerpc-optprobes-Remove-unused-routine-patch_imm32_.patch new file mode 100644 index 0000000..32fc4a8 --- /dev/null +++ b/patches.suse/powerpc-optprobes-Remove-unused-routine-patch_imm32_.patch @@ -0,0 +1,62 @@ +From d47d307f1049be545d45cf0f2332495ec9a89cc0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= +Date: Mon, 4 Jan 2021 15:31:53 +0100 +Subject: [PATCH] powerpc/optprobes: Remove unused routine + patch_imm32_load_insns() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +References: jsc#SLE-13847 +Patch-mainline: v5.12-rc1 +Git-commit: d47d307f1049be545d45cf0f2332495ec9a89cc0 + +Commit 650b55b707fd ("powerpc: Add prefixed instructions to instruction +data type") removed the use of patch_imm32_load_insns(). Clean it up +to fix this W=1 compile error : + +../arch/powerpc/kernel/optprobes.c:149:6: error: no previous prototype for ‘patch_imm32_load_insns’ [-Werror=missing-prototypes] + 149 | void patch_imm32_load_insns(unsigned int val, kprobe_opcode_t *addr) + +Fixes: 650b55b707fd ("powerpc: Add prefixed instructions to instruction data type") +Signed-off-by: Cédric Le Goater +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20210104143206.695198-11-clg@kaod.org +Acked-by: Michal Suchanek +--- + arch/powerpc/kernel/optprobes.c | 19 ------------------- + 1 file changed, 19 deletions(-) + +diff --git a/arch/powerpc/kernel/optprobes.c b/arch/powerpc/kernel/optprobes.c +index 69bfe96884e2..da6b88b80ba4 100644 +--- a/arch/powerpc/kernel/optprobes.c ++++ b/arch/powerpc/kernel/optprobes.c +@@ -141,25 +141,6 @@ void arch_remove_optimized_kprobe(struct optimized_kprobe *op) + } + } + +-/* +- * emulate_step() requires insn to be emulated as +- * second parameter. Load register 'r4' with the +- * instruction. +- */ +-void patch_imm32_load_insns(unsigned int val, kprobe_opcode_t *addr) +-{ +- /* addis r4,0,(insn)@h */ +- patch_instruction((struct ppc_inst *)addr, +- ppc_inst(PPC_INST_ADDIS | ___PPC_RT(4) | +- ((val >> 16) & 0xffff))); +- addr++; +- +- /* ori r4,r4,(insn)@l */ +- patch_instruction((struct ppc_inst *)addr, +- ppc_inst(PPC_INST_ORI | ___PPC_RA(4) | +- ___PPC_RS(4) | (val & 0xffff))); +-} +- + /* + * Generate instructions to load provided immediate 64-bit value + * to register 'reg' and patch these instructions at 'addr'. +-- +2.26.2 + diff --git a/patches.suse/powerpc-pseries-eeh-Make-pseries_pcibios_bus_add_dev.patch b/patches.suse/powerpc-pseries-eeh-Make-pseries_pcibios_bus_add_dev.patch new file mode 100644 index 0000000..4b24609 --- /dev/null +++ b/patches.suse/powerpc-pseries-eeh-Make-pseries_pcibios_bus_add_dev.patch @@ -0,0 +1,43 @@ +From 44159329e0ad160af7cc7e84fa6d97531c8ed78f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= +Date: Mon, 4 Jan 2021 15:31:46 +0100 +Subject: [PATCH] powerpc/pseries/eeh: Make pseries_pcibios_bus_add_device() + static +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +References: FATE#324970, bsc#1078720, git-fixes +Patch-mainline: v5.12-rc1 +Git-commit: 44159329e0ad160af7cc7e84fa6d97531c8ed78f + +pseries_pcibios_bus_add_device() is a local routine defining the +pcibios_bus_add_device() handler of the pseries machine in +eeh_pseries_init(). It doesn't need to be external. + +It fixes this W=1 compile error: + +../arch/powerpc/platforms/pseries/eeh_pseries.c:46:6: error: no previous prototype for ‘pseries_pcibios_bus_add_device’ [-Werror=missing-prototypes] + 46 | void pseries_pcibios_bus_add_device(struct pci_dev *pdev) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Fixes: dae7253f9f78 ("powerpc/pseries: Add pseries SR-IOV Machine dependent calls") +Signed-off-by: Cédric Le Goater +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20210104143206.695198-4-clg@kaod.org +Acked-by: Michal Suchanek +--- + arch/powerpc/platforms/pseries/eeh_pseries.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/powerpc/platforms/pseries/eeh_pseries.c ++++ b/arch/powerpc/platforms/pseries/eeh_pseries.c +@@ -57,7 +57,7 @@ static int ibm_get_config_addr_info2; + static int ibm_configure_pe; + + #ifdef CONFIG_PCI_IOV +-void pseries_pcibios_bus_add_device(struct pci_dev *pdev) ++static void pseries_pcibios_bus_add_device(struct pci_dev *pdev) + { + struct pci_dn *pdn = pci_get_pdn(pdev); + struct pci_dn *physfn_pdn; diff --git a/patches.suse/powerpc-pseries-ras-Make-init_ras_hotplug_IRQ-static.patch b/patches.suse/powerpc-pseries-ras-Make-init_ras_hotplug_IRQ-static.patch new file mode 100644 index 0000000..4d5b14f --- /dev/null +++ b/patches.suse/powerpc-pseries-ras-Make-init_ras_hotplug_IRQ-static.patch @@ -0,0 +1,46 @@ +From 90db8bf24d133654032a1c7dd46aa5096627b9ff Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= +Date: Mon, 4 Jan 2021 15:31:47 +0100 +Subject: [PATCH] powerpc/pseries/ras: Make init_ras_hotplug_IRQ() static +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +References: FATE#322022, bsc#1065729. git-fixes +Patch-mainline: v5.12-rc1 +Git-commit: 90db8bf24d133654032a1c7dd46aa5096627b9ff + +init_ras_hotplug_IRQ() is a local routine used by a machine init call +and it doesn't need to be external. + +It fixes this W=1 compile error: + +../arch/powerpc/platforms/pseries/ras.c:125:12: error: no previous prototype for ‘init_ras_hotplug_IRQ’ [-Werror=missing-prototypes] + 125 | int __init init_ras_hotplug_IRQ(void) + | ^~~~~~~~~~~~~~~~~~~~ + +Fixes: c9dccf1d074a ("powerpc/pseries: Enable RAS hotplug events later") +Signed-off-by: Cédric Le Goater +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20210104143206.695198-5-clg@kaod.org +Acked-by: Michal Suchanek +--- + arch/powerpc/platforms/pseries/ras.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c +index bcb614ffce6a..d2fca1aa6742 100644 +--- a/arch/powerpc/platforms/pseries/ras.c ++++ b/arch/powerpc/platforms/pseries/ras.c +@@ -122,7 +122,7 @@ static inline u8 rtas_mc_error_sub_type(const struct pseries_mc_errorlog *mlog) + * devices or systems (e.g. hugepages) that have not been initialized at the + * subsys stage. + */ +-int __init init_ras_hotplug_IRQ(void) ++static int __init init_ras_hotplug_IRQ(void) + { + struct device_node *np; + +-- +2.26.2 + diff --git a/patches.suse/printk-fix-deadlock-when-kernel-panic.patch b/patches.suse/printk-fix-deadlock-when-kernel-panic.patch new file mode 100644 index 0000000..7e2c592 --- /dev/null +++ b/patches.suse/printk-fix-deadlock-when-kernel-panic.patch @@ -0,0 +1,113 @@ +From 8a8109f303e25a27f92c1d8edd67d7cbbc60a4eb Mon Sep 17 00:00:00 2001 +From: Muchun Song +Date: Wed, 10 Feb 2021 11:48:23 +0800 +Subject: [PATCH] printk: fix deadlock when kernel panic +Git-commit: 8a8109f303e25a27f92c1d8edd67d7cbbc60a4eb +Patch-mainline: v5.12-rc1 +References: bsc#1183018 + +printk_safe_flush_on_panic() caused the following deadlock on our +server: + +CPU0: CPU1: +panic rcu_dump_cpu_stacks + kdump_nmi_shootdown_cpus nmi_trigger_cpumask_backtrace + register_nmi_handler(crash_nmi_callback) printk_safe_flush + __printk_safe_flush + raw_spin_lock_irqsave(&read_lock) + // send NMI to other processors + apic_send_IPI_allbutself(NMI_VECTOR) + // NMI interrupt, dead loop + crash_nmi_callback + printk_safe_flush_on_panic + printk_safe_flush + __printk_safe_flush + // deadlock + raw_spin_lock_irqsave(&read_lock) + +DEADLOCK: read_lock is taken on CPU1 and will never get released. + +It happens when panic() stops a CPU by NMI while it has been in +the middle of printk_safe_flush(). + +Handle the lock the same way as logbuf_lock. The printk_safe buffers +are flushed only when both locks can be safely taken. It can avoid +the deadlock _in this particular case_ at expense of losing contents +of printk_safe buffers. + +Note: It would actually be safe to re-init the locks when all CPUs were + stopped by NMI. But it would require passing this information + from arch-specific code. It is not worth the complexity. + Especially because logbuf_lock and printk_safe buffers have been + obsoleted by the lockless ring buffer. + +Fixes: cf9b1106c81c ("printk/nmi: flush NMI messages on the system panic") +Signed-off-by: Muchun Song +Reviewed-by: Petr Mladek +Cc: +Acked-by: Sergey Senozhatsky +Signed-off-by: Petr Mladek +Link: https://lore.kernel.org/r/20210210034823.64867-1-songmuchun@bytedance.com + +--- + kernel/printk/printk_safe.c | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/kernel/printk/printk_safe.c b/kernel/printk/printk_safe.c +index a0e6f746de6c..2e9e3ed7d63e 100644 +--- a/kernel/printk/printk_safe.c ++++ b/kernel/printk/printk_safe.c +@@ -45,6 +45,8 @@ struct printk_safe_seq_buf { + static DEFINE_PER_CPU(struct printk_safe_seq_buf, safe_print_seq); + static DEFINE_PER_CPU(int, printk_context); + ++static DEFINE_RAW_SPINLOCK(safe_read_lock); ++ + #ifdef CONFIG_PRINTK_NMI + static DEFINE_PER_CPU(struct printk_safe_seq_buf, nmi_print_seq); + #endif +@@ -180,8 +182,6 @@ static void report_message_lost(struct printk_safe_seq_buf *s) + */ + static void __printk_safe_flush(struct irq_work *work) + { +- static raw_spinlock_t read_lock = +- __RAW_SPIN_LOCK_INITIALIZER(read_lock); + struct printk_safe_seq_buf *s = + container_of(work, struct printk_safe_seq_buf, work); + unsigned long flags; +@@ -195,7 +195,7 @@ static void __printk_safe_flush(struct irq_work *work) + * different CPUs. This is especially important when printing + * a backtrace. + */ +- raw_spin_lock_irqsave(&read_lock, flags); ++ raw_spin_lock_irqsave(&safe_read_lock, flags); + + i = 0; + more: +@@ -232,7 +232,7 @@ static void __printk_safe_flush(struct irq_work *work) + + out: + report_message_lost(s); +- raw_spin_unlock_irqrestore(&read_lock, flags); ++ raw_spin_unlock_irqrestore(&safe_read_lock, flags); + } + + /** +@@ -278,6 +278,14 @@ void printk_safe_flush_on_panic(void) + raw_spin_lock_init(&logbuf_lock); + } + ++ if (raw_spin_is_locked(&safe_read_lock)) { ++ if (num_online_cpus() > 1) ++ return; ++ ++ debug_locks_off(); ++ raw_spin_lock_init(&safe_read_lock); ++ } ++ + printk_safe_flush(); + } + +-- +2.26.2 + diff --git a/patches.suse/pwm-rockchip-rockchip_pwm_probe-Remove-superfluous-c.patch b/patches.suse/pwm-rockchip-rockchip_pwm_probe-Remove-superfluous-c.patch new file mode 100644 index 0000000..3e44d13 --- /dev/null +++ b/patches.suse/pwm-rockchip-rockchip_pwm_probe-Remove-superfluous-c.patch @@ -0,0 +1,42 @@ +From d5d8d675865ccddfe4da26c85f22c55cec663bf2 Mon Sep 17 00:00:00 2001 +From: Simon South +Date: Tue, 19 Jan 2021 11:12:06 -0500 +Subject: [PATCH] pwm: rockchip: rockchip_pwm_probe(): Remove superfluous clk_unprepare() +Git-commit: d5d8d675865ccddfe4da26c85f22c55cec663bf2 +Patch-mainline: v5.12-rc1 +References: git-fixes + +If rockchip_pwm_probe() fails to register a PWM device it calls +clk_unprepare() for the device's PWM clock, without having first disabled +the clock and before jumping to an error handler that also unprepares +it. This is likely to produce warnings from the kernel about the clock +being unprepared when it is still enabled, and then being unprepared when +it has already been unprepared. + +Prevent these warnings by removing this unnecessary call to +clk_unprepare(). + +Fixes: 48cf973cae33 ("pwm: rockchip: Avoid glitches on already running PWMs") +Signed-off-by: Simon South +Signed-off-by: Thierry Reding +Acked-by: Takashi Iwai + +--- + drivers/pwm/pwm-rockchip.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c +index e6929bc73968..90f969f9f5e2 100644 +--- a/drivers/pwm/pwm-rockchip.c ++++ b/drivers/pwm/pwm-rockchip.c +@@ -351,7 +351,6 @@ static int rockchip_pwm_probe(struct platform_device *pdev) + + ret = pwmchip_add(&pc->chip); + if (ret < 0) { +- clk_unprepare(pc->clk); + dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret); + goto err_pclk; + } +-- +2.26.2 + diff --git a/patches.suse/quota-Fix-memory-leak-when-handling-corrupted-quota-.patch b/patches.suse/quota-Fix-memory-leak-when-handling-corrupted-quota-.patch new file mode 100644 index 0000000..e18da6c --- /dev/null +++ b/patches.suse/quota-Fix-memory-leak-when-handling-corrupted-quota-.patch @@ -0,0 +1,55 @@ +From a4db1072e1a3bd7a8d9c356e1902b13ac5deb8ef Mon Sep 17 00:00:00 2001 +From: Jan Kara +Date: Tue, 22 Dec 2020 12:09:53 +0100 +Subject: [PATCH] quota: Fix memory leak when handling corrupted quota file +Git-commit: a4db1072e1a3bd7a8d9c356e1902b13ac5deb8ef +Patch-mainline: v5.12-rc1 +References: bsc#1182650 + +When checking corrupted quota file we can bail out and leak allocated +info structure. Properly free info structure on error return. + +Reported-by: syzbot+77779c9b52ab78154b08@syzkaller.appspotmail.com +Fixes: 11c514a99bb9 ("quota: Sanity-check quota file headers on load") +Signed-off-by: Jan Kara +Acked-by: Jan Kara + +--- + fs/quota/quota_v2.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c +index c21106557a37..b1467f3921c2 100644 +--- a/fs/quota/quota_v2.c ++++ b/fs/quota/quota_v2.c +@@ -164,19 +164,24 @@ static int v2_read_file_info(struct super_block *sb, int type) + quota_error(sb, "Number of blocks too big for quota file size (%llu > %llu).", + (loff_t)qinfo->dqi_blocks << qinfo->dqi_blocksize_bits, + i_size_read(sb_dqopt(sb)->files[type])); +- goto out; ++ goto out_free; + } + if (qinfo->dqi_free_blk >= qinfo->dqi_blocks) { + quota_error(sb, "Free block number too big (%u >= %u).", + qinfo->dqi_free_blk, qinfo->dqi_blocks); +- goto out; ++ goto out_free; + } + if (qinfo->dqi_free_entry >= qinfo->dqi_blocks) { + quota_error(sb, "Block with free entry too big (%u >= %u).", + qinfo->dqi_free_entry, qinfo->dqi_blocks); +- goto out; ++ goto out_free; + } + ret = 0; ++out_free: ++ if (ret) { ++ kfree(info->dqi_priv); ++ info->dqi_priv = NULL; ++ } + out: + up_read(&dqopt->dqio_sem); + return ret; +-- +2.26.2 + diff --git a/patches.suse/r8169-Add-support-for-another-RTL8168FP.patch b/patches.suse/r8169-Add-support-for-another-RTL8168FP.patch new file mode 100644 index 0000000..d6e0b80 --- /dev/null +++ b/patches.suse/r8169-Add-support-for-another-RTL8168FP.patch @@ -0,0 +1,128 @@ +From e6d6ca6e12049dfbff6ac8b029678d2d2c55c34f Mon Sep 17 00:00:00 2001 +From: Kai-Heng Feng +Date: Tue, 2 Feb 2021 12:48:12 +0800 +Subject: [PATCH] r8169: Add support for another RTL8168FP +Git-commit: e6d6ca6e12049dfbff6ac8b029678d2d2c55c34f +Patch-mainline: v5.12-rc1 +References: git-fixes + +According to the vendor driver, the new chip with XID 0x54b is +essentially the same as the one with XID 0x54a, but it doesn't need the +firmware. + +So add support accordingly. + +Signed-off-by: Kai-Heng Feng +Reviewed-by: Heiner Kallweit +Link: https://lore.kernel.org/r/20210202044813.1304266-1-kai.heng.feng@canonical.com +Signed-off-by: Jakub Kicinski +Acked-by: Takashi Iwai + +--- + drivers/net/ethernet/realtek/r8169.h | 1 + + drivers/net/ethernet/realtek/r8169_main.c | 17 +++++++++++------ + drivers/net/ethernet/realtek/r8169_phy_config.c | 1 + + 3 files changed, 13 insertions(+), 6 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169.h ++++ b/drivers/net/ethernet/realtek/r8169.h +@@ -63,6 +63,7 @@ enum mac_version { + RTL_GIGA_MAC_VER_50, + RTL_GIGA_MAC_VER_51, + RTL_GIGA_MAC_VER_52, ++ RTL_GIGA_MAC_VER_53, + RTL_GIGA_MAC_VER_60, + RTL_GIGA_MAC_VER_61, + RTL_GIGA_MAC_VER_63, +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -146,6 +146,7 @@ static const struct { + [RTL_GIGA_MAC_VER_50] = {"RTL8168ep/8111ep" }, + [RTL_GIGA_MAC_VER_51] = {"RTL8168ep/8111ep" }, + [RTL_GIGA_MAC_VER_52] = {"RTL8168fp/RTL8117", FIRMWARE_8168FP_3}, ++ [RTL_GIGA_MAC_VER_53] = {"RTL8168fp/RTL8117", }, + [RTL_GIGA_MAC_VER_60] = {"RTL8125A" }, + [RTL_GIGA_MAC_VER_61] = {"RTL8125A", FIRMWARE_8125A_3}, + /* reserve 62 for CFG_METHOD_4 in the vendor driver */ +@@ -699,7 +700,7 @@ static bool rtl_is_8168evl_up(struct rtl + { + return tp->mac_version >= RTL_GIGA_MAC_VER_34 && + tp->mac_version != RTL_GIGA_MAC_VER_39 && +- tp->mac_version <= RTL_GIGA_MAC_VER_52; ++ tp->mac_version <= RTL_GIGA_MAC_VER_53; + } + + static bool rtl_supports_eee(struct rtl8169_private *tp) +@@ -1029,7 +1030,9 @@ static u16 rtl_ephy_read(struct rtl8169_ + static void r8168fp_adjust_ocp_cmd(struct rtl8169_private *tp, u32 *cmd, int type) + { + /* based on RTL8168FP_OOBMAC_BASE in vendor driver */ +- if (tp->mac_version == RTL_GIGA_MAC_VER_52 && type == ERIAR_OOB) ++ if (type == ERIAR_OOB && ++ (tp->mac_version == RTL_GIGA_MAC_VER_52 || ++ tp->mac_version == RTL_GIGA_MAC_VER_53)) + *cmd |= 0x7f0 << 18; + } + +@@ -1222,7 +1225,7 @@ static enum rtl_dash_type rtl_check_dash + case RTL_GIGA_MAC_VER_28: + case RTL_GIGA_MAC_VER_31: + return r8168dp_check_dash(tp) ? RTL_DASH_DP : RTL_DASH_NONE; +- case RTL_GIGA_MAC_VER_49 ... RTL_GIGA_MAC_VER_52: ++ case RTL_GIGA_MAC_VER_49 ... RTL_GIGA_MAC_VER_53: + return r8168ep_check_dash(tp) ? RTL_DASH_EP : RTL_DASH_NONE; + default: + return RTL_DASH_NONE; +@@ -1938,6 +1941,7 @@ static enum mac_version rtl8169_get_mac_ + { 0x7c8, 0x608, RTL_GIGA_MAC_VER_61 }, + + /* RTL8117 */ ++ { 0x7cf, 0x54b, RTL_GIGA_MAC_VER_53 }, + { 0x7cf, 0x54a, RTL_GIGA_MAC_VER_52 }, + + /* 8168EP family. */ +@@ -2284,7 +2288,7 @@ static void rtl_init_rxcfg(struct rtl816 + case RTL_GIGA_MAC_VER_38: + RTL_W32(tp, RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); + break; +- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_52: ++ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_53: + RTL_W32(tp, RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST | RX_EARLY_OFF); + break; + case RTL_GIGA_MAC_VER_60 ... RTL_GIGA_MAC_VER_63: +@@ -2459,7 +2463,7 @@ DECLARE_RTL_COND(rtl_rxtx_empty_cond_2) + static void rtl_wait_txrx_fifo_empty(struct rtl8169_private *tp) + { + switch (tp->mac_version) { +- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_52: ++ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_53: + rtl_loop_wait_high(tp, &rtl_txcfg_empty_cond, 100, 42); + rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond, 100, 42); + break; +@@ -3718,6 +3722,7 @@ static void rtl_hw_config(struct rtl8169 + [RTL_GIGA_MAC_VER_50] = rtl_hw_start_8168ep_2, + [RTL_GIGA_MAC_VER_51] = rtl_hw_start_8168ep_3, + [RTL_GIGA_MAC_VER_52] = rtl_hw_start_8117, ++ [RTL_GIGA_MAC_VER_53] = rtl_hw_start_8117, + [RTL_GIGA_MAC_VER_60] = rtl_hw_start_8125a_1, + [RTL_GIGA_MAC_VER_61] = rtl_hw_start_8125a_2, + [RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b, +@@ -5232,7 +5237,7 @@ static void rtl_hw_init_8125(struct rtl8 + static void rtl_hw_initialize(struct rtl8169_private *tp) + { + switch (tp->mac_version) { +- case RTL_GIGA_MAC_VER_49 ... RTL_GIGA_MAC_VER_52: ++ case RTL_GIGA_MAC_VER_49 ... RTL_GIGA_MAC_VER_53: + rtl8168ep_stop_cmac(tp); + /* fall through */ + case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48: +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -1358,6 +1358,7 @@ void r8169_hw_phy_config(struct rtl8169_ + [RTL_GIGA_MAC_VER_50] = rtl8168ep_2_hw_phy_config, + [RTL_GIGA_MAC_VER_51] = rtl8168ep_2_hw_phy_config, + [RTL_GIGA_MAC_VER_52] = rtl8117_hw_phy_config, ++ [RTL_GIGA_MAC_VER_53] = rtl8117_hw_phy_config, + [RTL_GIGA_MAC_VER_60] = rtl8125a_1_hw_phy_config, + [RTL_GIGA_MAC_VER_61] = rtl8125a_2_hw_phy_config, + [RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config, diff --git a/patches.suse/r8169-fix-jumbo-packet-handling-on-RTL8168e.patch b/patches.suse/r8169-fix-jumbo-packet-handling-on-RTL8168e.patch new file mode 100644 index 0000000..ed7a468 --- /dev/null +++ b/patches.suse/r8169-fix-jumbo-packet-handling-on-RTL8168e.patch @@ -0,0 +1,53 @@ +From 6cf739131a15e4177e58a1b4f2bede9d5da78552 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 25 Feb 2021 16:05:19 +0100 +Subject: [PATCH] r8169: fix jumbo packet handling on RTL8168e +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 6cf739131a15e4177e58a1b4f2bede9d5da78552 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Josef reported [0] that using jumbo packets fails on RTL8168e. +Aligning the values for register MaxTxPacketSize with the +vendor driver fixes the problem. + +[0] https://bugzilla.kernel.org/show_bug.cgi?id=211827 + +Fixes: d58d46b5d851 ("r8169: jumbo fixes.") +Reported-by: Josef OÅ¡kera +Tested-by: Josef OÅ¡kera +Signed-off-by: Heiner Kallweit +Link: https://lore.kernel.org/r/b15ddef7-0d50-4320-18f4-6a3f86fbfd3e@gmail.com +Signed-off-by: Jakub Kicinski +Acked-by: Takashi Iwai + +--- + drivers/net/ethernet/realtek/r8169_main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c +index 0a20dae32184..f704da3f214c 100644 +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -2285,14 +2285,14 @@ static void r8168dp_hw_jumbo_disable(struct rtl8169_private *tp) + + static void r8168e_hw_jumbo_enable(struct rtl8169_private *tp) + { +- RTL_W8(tp, MaxTxPacketSize, 0x3f); ++ RTL_W8(tp, MaxTxPacketSize, 0x24); + RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0); + RTL_W8(tp, Config4, RTL_R8(tp, Config4) | 0x01); + } + + static void r8168e_hw_jumbo_disable(struct rtl8169_private *tp) + { +- RTL_W8(tp, MaxTxPacketSize, 0x0c); ++ RTL_W8(tp, MaxTxPacketSize, 0x3f); + RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0); + RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~0x01); + } +-- +2.26.2 + diff --git a/patches.suse/r8169-fix-r8168fp_adjust_ocp_cmd-function.patch b/patches.suse/r8169-fix-r8168fp_adjust_ocp_cmd-function.patch new file mode 100644 index 0000000..67554bb --- /dev/null +++ b/patches.suse/r8169-fix-r8168fp_adjust_ocp_cmd-function.patch @@ -0,0 +1,36 @@ +From abbf9a0ef8848dca58c5b97750c1c59bbee45637 Mon Sep 17 00:00:00 2001 +From: Hayes Wang +Date: Fri, 5 Mar 2021 17:34:41 +0800 +Subject: [PATCH] r8169: fix r8168fp_adjust_ocp_cmd function +Git-commit: abbf9a0ef8848dca58c5b97750c1c59bbee45637 +Patch-mainline: v5.12-rc3 +References: git-fixes + +The (0xBAF70000 & 0x00FFF000) << 6 should be (0xf70 << 18). + +Fixes: 561535b0f239 ("r8169: fix OCP access on RTL8117") +Signed-off-by: Hayes Wang +Acked-by: Heiner Kallweit +Signed-off-by: David S. Miller +Acked-by: Takashi Iwai + +--- + drivers/net/ethernet/realtek/r8169_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c +index f704da3f214c..7aad0ba53372 100644 +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -767,7 +767,7 @@ static void r8168fp_adjust_ocp_cmd(struct rtl8169_private *tp, u32 *cmd, int typ + if (type == ERIAR_OOB && + (tp->mac_version == RTL_GIGA_MAC_VER_52 || + tp->mac_version == RTL_GIGA_MAC_VER_53)) +- *cmd |= 0x7f0 << 18; ++ *cmd |= 0xf70 << 18; + } + + DECLARE_RTL_COND(rtl_eriar_cond) +-- +2.26.2 + diff --git a/patches.suse/r8169-improve-DASH-support.patch b/patches.suse/r8169-improve-DASH-support.patch new file mode 100644 index 0000000..35ec7bd --- /dev/null +++ b/patches.suse/r8169-improve-DASH-support.patch @@ -0,0 +1,155 @@ +From e0d38b5880758432f74fe17fea8281691d1eb3c0 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Tue, 12 Jan 2021 09:31:20 +0100 +Subject: [PATCH] r8169: improve DASH support +Git-commit: e0d38b5880758432f74fe17fea8281691d1eb3c0 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Instead of doing the full DASH check each time r8168_check_dash() is +called, let's do it once in probe and store DASH capabilities in a +new rtl8169_private member. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Saeed Mahameed +Signed-off-by: Jakub Kicinski +Acked-by: Takashi Iwai + +--- + drivers/net/ethernet/realtek/r8169_main.c | 53 ++++++++++++------------------ + 1 file changed, 22 insertions(+), 31 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -591,6 +591,12 @@ struct rtl8169_stats { + struct u64_stats_sync syncp; + }; + ++enum rtl_dash_type { ++ RTL_DASH_NONE, ++ RTL_DASH_DP, ++ RTL_DASH_EP, ++}; ++ + struct rtl8169_private { + void __iomem *mmio_addr; /* memory map physical address */ + struct pci_dev *pci_dev; +@@ -598,6 +604,7 @@ struct rtl8169_private { + struct phy_device *phydev; + struct napi_struct napi; + enum mac_version mac_version; ++ enum rtl_dash_type dash_type; + u32 cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */ + u32 cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */ + u32 dirty_tx; +@@ -1168,19 +1175,10 @@ static void rtl8168ep_driver_start(struc + + static void rtl8168_driver_start(struct rtl8169_private *tp) + { +- switch (tp->mac_version) { +- case RTL_GIGA_MAC_VER_27: +- case RTL_GIGA_MAC_VER_28: +- case RTL_GIGA_MAC_VER_31: ++ if (tp->dash_type == RTL_DASH_DP) + rtl8168dp_driver_start(tp); +- break; +- case RTL_GIGA_MAC_VER_49 ... RTL_GIGA_MAC_VER_52: ++ else + rtl8168ep_driver_start(tp); +- break; +- default: +- BUG(); +- break; +- } + } + + static void rtl8168dp_driver_stop(struct rtl8169_private *tp) +@@ -1199,44 +1197,35 @@ static void rtl8168ep_driver_stop(struct + + static void rtl8168_driver_stop(struct rtl8169_private *tp) + { +- switch (tp->mac_version) { +- case RTL_GIGA_MAC_VER_27: +- case RTL_GIGA_MAC_VER_28: +- case RTL_GIGA_MAC_VER_31: ++ if (tp->dash_type == RTL_DASH_DP) + rtl8168dp_driver_stop(tp); +- break; +- case RTL_GIGA_MAC_VER_49 ... RTL_GIGA_MAC_VER_52: ++ else + rtl8168ep_driver_stop(tp); +- break; +- default: +- BUG(); +- break; +- } + } + + static bool r8168dp_check_dash(struct rtl8169_private *tp) + { + u16 reg = rtl8168_get_ocp_reg(tp); + +- return !!(r8168dp_ocp_read(tp, reg) & 0x00008000); ++ return r8168dp_ocp_read(tp, reg) & BIT(15); + } + + static bool r8168ep_check_dash(struct rtl8169_private *tp) + { +- return r8168ep_ocp_read(tp, 0x128) & 0x00000001; ++ return r8168ep_ocp_read(tp, 0x128) & BIT(0); + } + +-static bool r8168_check_dash(struct rtl8169_private *tp) ++static enum rtl_dash_type rtl_check_dash(struct rtl8169_private *tp) + { + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_27: + case RTL_GIGA_MAC_VER_28: + case RTL_GIGA_MAC_VER_31: +- return r8168dp_check_dash(tp); ++ return r8168dp_check_dash(tp) ? RTL_DASH_DP : RTL_DASH_NONE; + case RTL_GIGA_MAC_VER_49 ... RTL_GIGA_MAC_VER_52: +- return r8168ep_check_dash(tp); ++ return r8168ep_check_dash(tp) ? RTL_DASH_EP : RTL_DASH_NONE; + default: +- return false; ++ return RTL_DASH_NONE; + } + } + +@@ -2212,7 +2201,7 @@ static void rtl_wol_suspend_quirk(struct + + static void rtl_pll_power_down(struct rtl8169_private *tp) + { +- if (r8168_check_dash(tp)) ++ if (tp->dash_type != RTL_DASH_NONE) + return; + + if (tp->mac_version == RTL_GIGA_MAC_VER_32 || +@@ -5051,7 +5040,7 @@ static void rtl_remove_one(struct pci_de + unregister_netdev(tp->dev); + mdiobus_unregister(tp->phydev->mdio.bus); + +- if (r8168_check_dash(tp)) ++ if (tp->dash_type != RTL_DASH_NONE) + rtl8168_driver_stop(tp); + + rtl_release_firmware(tp); +@@ -5410,6 +5399,8 @@ static int rtl_init_one(struct pci_dev * + + tp->mac_version = chipset; + ++ tp->dash_type = rtl_check_dash(tp); ++ + tp->cp_cmd = RTL_R16(tp, CPlusCmd) & CPCMD_MASK; + + if (sizeof(dma_addr_t) > 4 && tp->mac_version >= RTL_GIGA_MAC_VER_18 && +@@ -5517,7 +5508,7 @@ static int rtl_init_one(struct pci_dev * + jumbo_max, tp->mac_version <= RTL_GIGA_MAC_VER_06 ? + "ok" : "ko"); + +- if (r8168_check_dash(tp)) { ++ if (tp->dash_type != RTL_DASH_NONE) { + netdev_info(dev, "DASH enabled\n"); + rtl8168_driver_start(tp); + } diff --git a/patches.suse/random-fix-the-RNDRESEEDCRNG-ioctl.patch b/patches.suse/random-fix-the-RNDRESEEDCRNG-ioctl.patch new file mode 100644 index 0000000..318af14 --- /dev/null +++ b/patches.suse/random-fix-the-RNDRESEEDCRNG-ioctl.patch @@ -0,0 +1,44 @@ +From 11a0b5e0ec8c13bef06f7414f9e914506140d5cb Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Tue, 12 Jan 2021 11:28:18 -0800 +Subject: [PATCH] random: fix the RNDRESEEDCRNG ioctl +Git-commit: 11a0b5e0ec8c13bef06f7414f9e914506140d5cb +Patch-mainline: v5.12-rc1 +References: git-fixes + +The RNDRESEEDCRNG ioctl reseeds the primary_crng from itself, which +doesn't make sense. Reseed it from the input_pool instead. + +Fixes: d848e5f8e1eb ("random: add new ioctl RNDRESEEDCRNG") +Cc: stable@vger.kernel.org +Cc: linux-crypto@vger.kernel.org +Cc: Andy Lutomirski +Cc: Jann Horn +Cc: Theodore Ts'o +Reviewed-by: Jann Horn +Acked-by: Ard Biesheuvel +Signed-off-by: Eric Biggers +Link: https://lore.kernel.org/r/20210112192818.69921-1-ebiggers@kernel.org +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/char/random.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/char/random.c b/drivers/char/random.c +index 5f3b8ac9d97b..a894c0559a8c 100644 +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -1972,7 +1972,7 @@ static long random_ioctl(struct file *f, unsigned int cmd, unsigned long arg) + return -EPERM; + if (crng_init < 2) + return -ENODATA; +- crng_reseed(&primary_crng, NULL); ++ crng_reseed(&primary_crng, &input_pool); + crng_global_init_time = jiffies - 1; + return 0; + default: +-- +2.26.2 + diff --git a/patches.suse/rcu-Pull-deferred-rcuog-wake-up-to-rcu_eqs_enter-cal.patch b/patches.suse/rcu-Pull-deferred-rcuog-wake-up-to-rcu_eqs_enter-cal.patch new file mode 100644 index 0000000..0870ea4 --- /dev/null +++ b/patches.suse/rcu-Pull-deferred-rcuog-wake-up-to-rcu_eqs_enter-cal.patch @@ -0,0 +1,54 @@ +From 54b7429efffc99e845ba9381bee3244f012a06c2 Mon Sep 17 00:00:00 2001 +From: Frederic Weisbecker +Date: Mon, 1 Feb 2021 00:05:44 +0100 +Subject: [PATCH] rcu: Pull deferred rcuog wake up to rcu_eqs_enter() callers +Git-commit: 54b7429efffc99e845ba9381bee3244f012a06c2 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Deferred wakeup of rcuog kthreads upon RCU idle mode entry is going to +be handled differently whether initiated by idle, user or guest. Prepare +with pulling that control up to rcu_eqs_enter() callers. + +Signed-off-by: Frederic Weisbecker +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Ingo Molnar +Cc: stable@vger.kernel.org +Link: https://lkml.kernel.org/r/20210131230548.32970-2-frederic@kernel.org +Signed-off-by: Frederic Weisbecker +--- + kernel/rcu/tree.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/kernel/rcu/tree.c ++++ b/kernel/rcu/tree.c +@@ -572,7 +572,6 @@ static void rcu_eqs_enter(bool user) + trace_rcu_dyntick(TPS("Start"), rdp->dynticks_nesting, 0, atomic_read(&rdp->dynticks)); + WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) && !user && !is_idle_task(current)); + rdp = this_cpu_ptr(&rcu_data); +- do_nocb_deferred_wakeup(rdp); + rcu_prepare_for_idle(); + rcu_preempt_deferred_qs(current); + WRITE_ONCE(rdp->dynticks_nesting, 0); /* Avoid irq-access tearing. */ +@@ -593,7 +592,10 @@ static void rcu_eqs_enter(bool user) + */ + void rcu_idle_enter(void) + { ++ struct rcu_data *rdp = this_cpu_ptr(&rcu_data); ++ + lockdep_assert_irqs_disabled(); ++ do_nocb_deferred_wakeup(rdp); + rcu_eqs_enter(false); + } + +@@ -611,7 +613,10 @@ void rcu_idle_enter(void) + */ + void rcu_user_enter(void) + { ++ struct rcu_data *rdp = this_cpu_ptr(&rcu_data); ++ + lockdep_assert_irqs_disabled(); ++ do_nocb_deferred_wakeup(rdp); + rcu_eqs_enter(true); + } + #endif /* CONFIG_NO_HZ_FULL */ diff --git a/patches.suse/rcu-nocb-Perform-deferred-wake-up-before-last-idle-s.patch b/patches.suse/rcu-nocb-Perform-deferred-wake-up-before-last-idle-s.patch new file mode 100644 index 0000000..06806fd --- /dev/null +++ b/patches.suse/rcu-nocb-Perform-deferred-wake-up-before-last-idle-s.patch @@ -0,0 +1,90 @@ +From 43789ef3f7d61aa7bed0cb2764e588fc990c30ef Mon Sep 17 00:00:00 2001 +From: Frederic Weisbecker +Date: Mon, 1 Feb 2021 00:05:45 +0100 +Subject: [PATCH] rcu/nocb: Perform deferred wake up before last idle's + need_resched() check +Git-commit: 43789ef3f7d61aa7bed0cb2764e588fc990c30ef +Patch-mainline: v5.12-rc1 +References: git-fixes + +Entering RCU idle mode may cause a deferred wake up of an RCU NOCB_GP +kthread (rcuog) to be serviced. + +Usually a local wake up happening while running the idle task is handled +in one of the need_resched() checks carefully placed within the idle +loop that can break to the scheduler. + +Unfortunately the call to rcu_idle_enter() is already beyond the last +generic need_resched() check and we may halt the CPU with a resched +request unhandled, leaving the task hanging. + +Fix this with splitting the rcuog wakeup handling from rcu_idle_enter() +and place it before the last generic need_resched() check in the idle +loop. It is then assumed that no call to call_rcu() will be performed +after that in the idle loop until the CPU is put in low power mode. + +Fixes: 96d3fd0d315a (rcu: Break call_rcu() deadlock involving scheduler and perf) +Reported-by: Paul E. McKenney +Signed-off-by: Frederic Weisbecker +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Ingo Molnar +Cc: stable@vger.kernel.org +Link: https://lkml.kernel.org/r/20210131230548.32970-3-frederic@kernel.org +Signed-off-by: Frederic Weisbecker +--- + include/linux/rcupdate.h | 2 ++ + kernel/rcu/tree.c | 3 --- + kernel/rcu/tree_plugin.h | 5 +++++ + kernel/sched/idle.c | 1 + + 4 files changed, 8 insertions(+), 3 deletions(-) + +--- a/include/linux/rcupdate.h ++++ b/include/linux/rcupdate.h +@@ -96,8 +96,10 @@ static inline void rcu_user_exit(void) { + + #ifdef CONFIG_RCU_NOCB_CPU + void rcu_init_nohz(void); ++void rcu_nocb_flush_deferred_wakeup(void); + #else /* #ifdef CONFIG_RCU_NOCB_CPU */ + static inline void rcu_init_nohz(void) { } ++static inline void rcu_nocb_flush_deferred_wakeup(void) { } + #endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */ + + /** +--- a/kernel/rcu/tree.c ++++ b/kernel/rcu/tree.c +@@ -592,10 +592,7 @@ static void rcu_eqs_enter(bool user) + */ + void rcu_idle_enter(void) + { +- struct rcu_data *rdp = this_cpu_ptr(&rcu_data); +- + lockdep_assert_irqs_disabled(); +- do_nocb_deferred_wakeup(rdp); + rcu_eqs_enter(false); + } + +--- a/kernel/rcu/tree_plugin.h ++++ b/kernel/rcu/tree_plugin.h +@@ -2020,6 +2020,11 @@ static void do_nocb_deferred_wakeup(stru + do_nocb_deferred_wakeup_common(rdp); + } + ++void rcu_nocb_flush_deferred_wakeup(void) ++{ ++ do_nocb_deferred_wakeup(this_cpu_ptr(&rcu_data)); ++} ++ + void __init rcu_init_nohz(void) + { + int cpu; +--- a/kernel/sched/idle.c ++++ b/kernel/sched/idle.c +@@ -250,6 +250,7 @@ static void do_idle(void) + } + + arch_cpu_idle_enter(); ++ rcu_nocb_flush_deferred_wakeup(); + + /* + * In poll mode we reenable interrupts and spin. Also if we diff --git a/patches.suse/rcu-nocb-Trigger-self-IPI-on-late-deferred-wake-up-b.patch b/patches.suse/rcu-nocb-Trigger-self-IPI-on-late-deferred-wake-up-b.patch new file mode 100644 index 0000000..8137da3 --- /dev/null +++ b/patches.suse/rcu-nocb-Trigger-self-IPI-on-late-deferred-wake-up-b.patch @@ -0,0 +1,170 @@ +From f8bb5cae9616224a39cbb399de382d36ac41df10 Mon Sep 17 00:00:00 2001 +From: Frederic Weisbecker +Date: Mon, 1 Feb 2021 00:05:46 +0100 +Subject: [PATCH] rcu/nocb: Trigger self-IPI on late deferred wake up before + user resume +Git-commit: f8bb5cae9616224a39cbb399de382d36ac41df10 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Entering RCU idle mode may cause a deferred wake up of an RCU NOCB_GP +kthread (rcuog) to be serviced. + +Unfortunately the call to rcu_user_enter() is already past the last +rescheduling opportunity before we resume to userspace or to guest mode. +We may escape there with the woken task ignored. + +The ultimate resort to fix every callsites is to trigger a self-IPI +(nohz_full depends on arch to implement arch_irq_work_raise()) that will +trigger a reschedule on IRQ tail or guest exit. + +Eventually every site that want a saner treatment will need to carefully +place a call to rcu_nocb_flush_deferred_wakeup() before the last explicit +need_resched() check upon resume. + +Fixes: 96d3fd0d315a (rcu: Break call_rcu() deadlock involving scheduler and perf) +Reported-by: Paul E. McKenney +Signed-off-by: Frederic Weisbecker +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Ingo Molnar +Cc: stable@vger.kernel.org +Link: https://lkml.kernel.org/r/20210131230548.32970-4-frederic@kernel.org +Signed-off-by: Frederic Weisbecker +--- + kernel/rcu/tree.c | 22 +++++++++++++++++++++- + kernel/rcu/tree.h | 2 +- + kernel/rcu/tree_plugin.h | 23 +++++++++++++++-------- + 3 files changed, 37 insertions(+), 10 deletions(-) + +--- a/kernel/rcu/tree.c ++++ b/kernel/rcu/tree.c +@@ -597,6 +597,19 @@ void rcu_idle_enter(void) + } + + #ifdef CONFIG_NO_HZ_FULL ++ ++/* ++ * An empty function that will trigger a reschedule on ++ * IRQ tail once IRQs get re-enabled on userspace resume. ++ */ ++static void late_wakeup_func(struct irq_work *work) ++{ ++} ++ ++static DEFINE_PER_CPU(struct irq_work, late_wakeup_work) = { ++ .func = late_wakeup_func, ++}; ++ + /** + * rcu_user_enter - inform RCU that we are resuming userspace. + * +@@ -613,7 +626,14 @@ void rcu_user_enter(void) + struct rcu_data *rdp = this_cpu_ptr(&rcu_data); + + lockdep_assert_irqs_disabled(); +- do_nocb_deferred_wakeup(rdp); ++ /* ++ * We may be past the last rescheduling opportunity in the entry code. ++ * Trigger a self IPI that will fire and reschedule once we resume to ++ * user/guest mode. ++ */ ++ if (do_nocb_deferred_wakeup(rdp) && need_resched()) ++ irq_work_queue(this_cpu_ptr(&late_wakeup_work)); ++ + rcu_eqs_enter(true); + } + #endif /* CONFIG_NO_HZ_FULL */ +--- a/kernel/rcu/tree.h ++++ b/kernel/rcu/tree.h +@@ -429,7 +429,7 @@ static bool rcu_nocb_adopt_orphan_cbs(st + struct rcu_data *rdp, + unsigned long flags); + static int rcu_nocb_need_deferred_wakeup(struct rcu_data *rdp); +-static void do_nocb_deferred_wakeup(struct rcu_data *rdp); ++static bool do_nocb_deferred_wakeup(struct rcu_data *rdp); + static void rcu_boot_init_nocb_percpu_data(struct rcu_data *rdp); + static void rcu_spawn_cpu_nocb_kthread(int cpu); + static void __init rcu_spawn_nocb_kthreads(void); +--- a/kernel/rcu/tree_plugin.h ++++ b/kernel/rcu/tree_plugin.h +@@ -1543,7 +1543,7 @@ bool rcu_is_nocb_cpu(int cpu) + * Kick the leader kthread for this NOCB group. Caller holds ->nocb_lock + * and this function releases it. + */ +-static void __wake_nocb_leader(struct rcu_data *rdp, bool force, ++static bool __wake_nocb_leader(struct rcu_data *rdp, bool force, + unsigned long flags) + __releases(rdp->nocb_lock) + { +@@ -1552,7 +1552,7 @@ static void __wake_nocb_leader(struct rc + lockdep_assert_held(&rdp->nocb_lock); + if (!READ_ONCE(rdp_leader->nocb_kthread)) { + raw_spin_unlock_irqrestore(&rdp->nocb_lock, flags); +- return; ++ return false; + } + if (rdp_leader->nocb_leader_sleep || force) { + /* Prior smp_mb__after_atomic() orders against prior enqueue. */ +@@ -1561,8 +1561,10 @@ static void __wake_nocb_leader(struct rc + raw_spin_unlock_irqrestore(&rdp->nocb_lock, flags); + smp_mb(); /* ->nocb_leader_sleep before swake_up_one(). */ + swake_up_one(&rdp_leader->nocb_wq); ++ return true; + } else { + raw_spin_unlock_irqrestore(&rdp->nocb_lock, flags); ++ return false; + } + } + +@@ -1985,20 +1987,23 @@ static int rcu_nocb_need_deferred_wakeup + } + + /* Do a deferred wakeup of rcu_nocb_kthread(). */ +-static void do_nocb_deferred_wakeup_common(struct rcu_data *rdp) ++static bool do_nocb_deferred_wakeup_common(struct rcu_data *rdp) + { + unsigned long flags; + int ndw; ++ int ret; + + raw_spin_lock_irqsave(&rdp->nocb_lock, flags); + if (!rcu_nocb_need_deferred_wakeup(rdp)) { + raw_spin_unlock_irqrestore(&rdp->nocb_lock, flags); +- return; ++ return false; + } + ndw = READ_ONCE(rdp->nocb_defer_wakeup); + WRITE_ONCE(rdp->nocb_defer_wakeup, RCU_NOCB_WAKE_NOT); +- __wake_nocb_leader(rdp, ndw == RCU_NOCB_WAKE_FORCE, flags); ++ ret = __wake_nocb_leader(rdp, ndw == RCU_NOCB_WAKE_FORCE, flags); + trace_rcu_nocb_wake(rcu_state.name, rdp->cpu, TPS("DeferredWake")); ++ ++ return ret; + } + + /* Do a deferred wakeup of rcu_nocb_kthread() from a timer handler. */ +@@ -2014,10 +2019,11 @@ static void do_nocb_deferred_wakeup_time + * This means we do an inexact common-case check. Note that if + * we miss, ->nocb_timer will eventually clean things up. + */ +-static void do_nocb_deferred_wakeup(struct rcu_data *rdp) ++static bool do_nocb_deferred_wakeup(struct rcu_data *rdp) + { + if (rcu_nocb_need_deferred_wakeup(rdp)) +- do_nocb_deferred_wakeup_common(rdp); ++ return do_nocb_deferred_wakeup_common(rdp); ++ return false; + } + + void rcu_nocb_flush_deferred_wakeup(void) +@@ -2276,8 +2282,9 @@ static int rcu_nocb_need_deferred_wakeup + return false; + } + +-static void do_nocb_deferred_wakeup(struct rcu_data *rdp) ++static bool do_nocb_deferred_wakeup(struct rcu_data *rdp) + { ++ return false; + } + + static void rcu_spawn_cpu_nocb_kthread(int cpu) diff --git a/patches.suse/regmap-sdw-use-_no_pm-functions-in-regmap_read-write.patch b/patches.suse/regmap-sdw-use-_no_pm-functions-in-regmap_read-write.patch new file mode 100644 index 0000000..444773a --- /dev/null +++ b/patches.suse/regmap-sdw-use-_no_pm-functions-in-regmap_read-write.patch @@ -0,0 +1,60 @@ +From d288a5712ef961e16d588bbdb2d846e00b5ef154 Mon Sep 17 00:00:00 2001 +From: Bard Liao +Date: Fri, 22 Jan 2021 15:06:30 +0800 +Subject: [PATCH] regmap: sdw: use _no_pm functions in regmap_read/write +Git-commit: d288a5712ef961e16d588bbdb2d846e00b5ef154 +Patch-mainline: v5.12-rc1 +References: git-fixes + +sdw_update_slave_status will be invoked when a codec is attached, +and the codec driver will initialize the codec with regmap functions +while the codec device is pm_runtime suspended. + +regmap routines currently rely on regular SoundWire IO functions, +which will call pm_runtime_get_sync()/put_autosuspend. + +This causes a deadlock where the resume routine waits for an +initialization complete signal that while the initialization complete +can only be reached when the resume completes. + +The only solution if we allow regmap functions to be used in resume +operations as well as during codec initialization is to use _no_pm +routines. The duty of making sure the bus is operational needs to be +handled above the regmap level. + +Fixes: 7c22ce6e21840 ('regmap: Add SoundWire bus support') +Signed-off-by: Bard Liao +Acked-by: Mark Brown +Link: https://lore.kernel.org/r/20210122070634.12825-6-yung-chuan.liao@linux.intel.com +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/base/regmap/regmap-sdw.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/base/regmap/regmap-sdw.c b/drivers/base/regmap/regmap-sdw.c +index c83be26434e7..966de8a136d9 100644 +--- a/drivers/base/regmap/regmap-sdw.c ++++ b/drivers/base/regmap/regmap-sdw.c +@@ -13,7 +13,7 @@ static int regmap_sdw_write(void *context, unsigned int reg, unsigned int val) + struct device *dev = context; + struct sdw_slave *slave = dev_to_sdw_dev(dev); + +- return sdw_write(slave, reg, val); ++ return sdw_write_no_pm(slave, reg, val); + } + + static int regmap_sdw_read(void *context, unsigned int reg, unsigned int *val) +@@ -22,7 +22,7 @@ static int regmap_sdw_read(void *context, unsigned int reg, unsigned int *val) + struct sdw_slave *slave = dev_to_sdw_dev(dev); + int read; + +- read = sdw_read(slave, reg); ++ read = sdw_read_no_pm(slave, reg); + if (read < 0) + return read; + +-- +2.26.2 + diff --git a/patches.suse/rsxx-Return-EFAULT-if-copy_to_user-fails.patch b/patches.suse/rsxx-Return-EFAULT-if-copy_to_user-fails.patch new file mode 100644 index 0000000..738e708 --- /dev/null +++ b/patches.suse/rsxx-Return-EFAULT-if-copy_to_user-fails.patch @@ -0,0 +1,50 @@ +From 77516d25f54912a7baedeeac1b1b828b6f285152 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 3 Mar 2021 13:59:12 +0300 +Subject: [PATCH] rsxx: Return -EFAULT if copy_to_user() fails +Git-commit: 77516d25f54912a7baedeeac1b1b828b6f285152 +Patch-mainline: v5.12-rc2 +References: git-fixes + +The copy_to_user() function returns the number of bytes remaining but +we want to return -EFAULT to the user if it can't complete the copy. +The "st" variable only holds zero on success or negative error codes on +failure so the type should be int. + +Fixes: 36f988e978f8 ("rsxx: Adding in debugfs entries.") +Signed-off-by: Dan Carpenter +Signed-off-by: Jens Axboe +Acked-by: Takashi Iwai + +--- + drivers/block/rsxx/core.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c +index 63f549889f87..5ac1881396af 100644 +--- a/drivers/block/rsxx/core.c ++++ b/drivers/block/rsxx/core.c +@@ -165,15 +165,17 @@ static ssize_t rsxx_cram_read(struct file *fp, char __user *ubuf, + { + struct rsxx_cardinfo *card = file_inode(fp)->i_private; + char *buf; +- ssize_t st; ++ int st; + + buf = kzalloc(cnt, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + st = rsxx_creg_read(card, CREG_ADD_CRAM + (u32)*ppos, cnt, buf, 1); +- if (!st) +- st = copy_to_user(ubuf, buf, cnt); ++ if (!st) { ++ if (copy_to_user(ubuf, buf, cnt)) ++ st = -EFAULT; ++ } + kfree(buf); + if (st) + return st; +-- +2.26.2 + diff --git a/patches.suse/sched-Reenable-interrupts-in-do_sched_yield.patch b/patches.suse/sched-Reenable-interrupts-in-do_sched_yield.patch new file mode 100644 index 0000000..e723bf0 --- /dev/null +++ b/patches.suse/sched-Reenable-interrupts-in-do_sched_yield.patch @@ -0,0 +1,44 @@ +From 345a957fcc95630bf5535d7668a59ed983eb49a7 Mon Sep 17 00:00:00 2001 +From: Thomas Gleixner +Date: Tue, 20 Oct 2020 16:46:55 +0200 +Subject: [PATCH] sched: Reenable interrupts in do_sched_yield() +Git-commit: 345a957fcc95630bf5535d7668a59ed983eb49a7 +Patch-mainline: v5.11-rc1 +References: git-fixes + +do_sched_yield() invokes schedule() with interrupts disabled which is +not allowed. This goes back to the pre git era to commit a6efb709806c +("[PATCH] irqlock patch 2.5.27-H6") in the history tree. + +Reenable interrupts and remove the misleading comment which "explains" it. + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Signed-off-by: Thomas Gleixner +Signed-off-by: Peter Zijlstra (Intel) +Link: https://lkml.kernel.org/r/87r1pt7y5c.fsf@nanos.tec.linutronix.de +Signed-off-by: Frederic Weisbecker +--- + kernel/sched/core.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index d2003a7d5ab5..6f533bb7d3b9 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -6094,12 +6094,8 @@ static void do_sched_yield(void) + schedstat_inc(rq->yld_count); + current->sched_class->yield_task(rq); + +- /* +- * Since we are going to call schedule() anyway, there's +- * no need to preempt or enable interrupts: +- */ + preempt_disable(); +- rq_unlock(rq, &rf); ++ rq_unlock_irq(rq, &rf); + sched_preempt_enable_no_resched(); + + schedule(); +-- +2.25.1 + diff --git a/patches.suse/selftests-bpf-Convert-test_xdp_redirect.sh-to-bash.patch b/patches.suse/selftests-bpf-Convert-test_xdp_redirect.sh-to-bash.patch new file mode 100644 index 0000000..8bb4a69 --- /dev/null +++ b/patches.suse/selftests-bpf-Convert-test_xdp_redirect.sh-to-bash.patch @@ -0,0 +1,56 @@ +From: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= +Date: Thu, 11 Feb 2021 09:20:29 +0100 +Subject: selftests/bpf: Convert test_xdp_redirect.sh to bash +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Patch-mainline: v5.12-rc1 +Git-commit: 732fa32330667a80ce4985ca81b6e9d6b2ad2072 +References: bsc#1177028 + +The test_xdp_redirect.sh script uses a bash feature, '&>'. On systems, +e.g. Debian, where '/bin/sh' is dash, this will not work as +expected. Use bash in the shebang to get the expected behavior. + +Further, using 'set -e' means that the error of a command cannot be +captured without the command being executed with '&&' or '||'. Let us +restructure the ping-commands, and use them as an if-expression, so +that we can capture the return value. + +v4: Added missing Fixes:, and removed local variables. (Andrii) +v3: Reintroduced /bin/bash, and kept 'set -e'. (Andrii) +v2: Kept /bin/sh and removed bashisms. (Randy) + +Fixes: 996139e801fd ("selftests: bpf: add a test for XDP redirect") +Signed-off-by: Björn Töpel +Signed-off-by: Daniel Borkmann +Acked-by: Andrii Nakryiko +Link: https://lore.kernel.org/bpf/20210211082029.1687666-1-bjorn.topel@gmail.com +Acked-by: Gary Lin +--- + tools/testing/selftests/bpf/test_xdp_redirect.sh | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +--- a/tools/testing/selftests/bpf/test_xdp_redirect.sh ++++ b/tools/testing/selftests/bpf/test_xdp_redirect.sh +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!/bin/bash + # Create 2 namespaces with two veth peers, and + # forward packets in-between using generic XDP + # +@@ -57,12 +57,8 @@ test_xdp_redirect() + ip link set dev veth1 $xdpmode obj test_xdp_redirect.o sec redirect_to_222 &> /dev/null + ip link set dev veth2 $xdpmode obj test_xdp_redirect.o sec redirect_to_111 &> /dev/null + +- ip netns exec ns1 ping -c 1 10.1.1.22 &> /dev/null +- local ret1=$? +- ip netns exec ns2 ping -c 1 10.1.1.11 &> /dev/null +- local ret2=$? +- +- if [ $ret1 -eq 0 -a $ret2 -eq 0 ]; then ++ if ip netns exec ns1 ping -c 1 10.1.1.22 &> /dev/null && ++ ip netns exec ns2 ping -c 1 10.1.1.11 &> /dev/null; then + echo "selftests: test_xdp_redirect $xdpmode [PASS]"; + else + ret=1 diff --git a/patches.suse/smp-Add-source-and-destination-CPUs-to-__call_single.patch b/patches.suse/smp-Add-source-and-destination-CPUs-to-__call_single.patch new file mode 100644 index 0000000..7fb5824 --- /dev/null +++ b/patches.suse/smp-Add-source-and-destination-CPUs-to-__call_single.patch @@ -0,0 +1,74 @@ +Patch-mainline: v5.10-rc1 +Git-commit: e48c15b796d412ede883bb2ef7779b2a142f7962 +References: bsc#1180846 +From: "Paul E. McKenney" +Date: Mon, 29 Jun 2020 17:21:32 -0700 +Subject: [PATCH] smp: Add source and destination CPUs to __call_single_data + +This commit adds a destination CPU to __call_single_data, and is inspired +by an earlier commit by Peter Zijlstra. This version adds #ifdef to +permit use by 32-bit systems and supplying the destination CPU for all +smp_call_function*() requests, not just smp_call_function_single(). + +If need be, 32-bit systems could be accommodated by shrinking the flags +field to 16 bits (the atomic_t variant is currently unused) and by +providing only eight bits for CPU on such systems. + +It is not clear that the addition of the fields to __call_single_node +are really needed. + +[ paulmck: Apply Boqun Feng feedback on 32-bit builds. ] +Link: https://lore.kernel.org/lkml/20200615164048.GC2531@hirez.programming.kicks-ass.net/ +Cc: Peter Zijlstra +Cc: Ingo Molnar +Cc: Thomas Gleixner +Cc: Sebastian Andrzej Siewior +Cc: Frederic Weisbecker +Signed-off-by: Paul E. McKenney +Signed-off-by: Juergen Gross +--- + include/linux/smp.h | 3 +++ + kernel/smp.c | 6 ++++++ + 2 files changed, 9 insertions(+) + +diff --git a/include/linux/smp.h b/include/linux/smp.h +index 80d557ef8a11..9f13966d3d92 100644 +--- a/include/linux/smp.h ++++ b/include/linux/smp.h +@@ -20,6 +20,9 @@ struct __call_single_data { + smp_call_func_t func; + void *info; + unsigned int flags; ++#ifdef CONFIG_64BIT ++ u16 src, dst; ++#endif + }; + + /* Use __aligned() to avoid to use 2 cache lines for 1 csd */ +diff --git a/kernel/smp.c b/kernel/smp.c +index d0ae8eb6bf8b..865a876f83ce 100644 +--- a/kernel/smp.c ++++ b/kernel/smp.c +@@ -164,6 +164,9 @@ int generic_exec_single(int cpu, call_single_data_t *csd, + + csd->func = func; + csd->info = info; ++#ifdef CONFIG_64BIT ++ csd->dst = cpu; ++#endif + + /* + * The list addition should be visible before sending the IPI +@@ -470,6 +473,9 @@ static void smp_call_function_many(const struct cpumask *mask, + csd->flags |= CSD_FLAG_SYNCHRONOUS; + csd->func = func; + csd->info = info; ++#ifdef CONFIG_64BIT ++ csd->dst = cpu; ++#endif + if (llist_add(&csd->llist, &per_cpu(call_single_queue, cpu))) + __cpumask_set_cpu(cpu, cfd->cpumask_ipi); + } +-- +2.26.2 + diff --git a/patches.suse/smsc95xx-avoid-memory-leak-in-smsc95xx_bind.patch b/patches.suse/smsc95xx-avoid-memory-leak-in-smsc95xx_bind.patch new file mode 100644 index 0000000..023e511 --- /dev/null +++ b/patches.suse/smsc95xx-avoid-memory-leak-in-smsc95xx_bind.patch @@ -0,0 +1,38 @@ +From 7f49f982e6408e3a02379b0b24f31c6fcde59bd6 Mon Sep 17 00:00:00 2001 +From: Andre Edich +Date: Mon, 6 Jul 2020 10:39:35 +0200 +Subject: [PATCH 03/15] smsc95xx: avoid memory leak in smsc95xx_bind +Patch-mainline: v5.8-rc5 +Git-commit: 3ed58f96a70b85ef646d5427258f677f1395b62f +References: git-fixes + +In a case where the ID_REV register read is failed, the memory for a +private data structure has to be freed before returning error from the +function smsc95xx_bind. + +Fixes: bbd9f9ee69242 ("smsc95xx: add wol support for more frame types") +Signed-off-by: Andre Edich +Signed-off-by: Parthiban Veerasooran +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/usb/smsc95xx.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index eb404bb74e18..bb4ccbda031a 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -1293,7 +1293,8 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) + /* detect device revision as different features may be available */ + ret = smsc95xx_read_reg(dev, ID_REV, &val); + if (ret < 0) +- return ret; ++ goto free_pdata; ++ + val >>= 16; + pdata->chip_id = val; + pdata->mdix_ctrl = get_mdix_status(dev->net); +-- +2.16.4 + diff --git a/patches.suse/smsc95xx-check-return-value-of-smsc95xx_reset.patch b/patches.suse/smsc95xx-check-return-value-of-smsc95xx_reset.patch new file mode 100644 index 0000000..b17db2a --- /dev/null +++ b/patches.suse/smsc95xx-check-return-value-of-smsc95xx_reset.patch @@ -0,0 +1,47 @@ +From 355e7d2f355d02feb15894599f9a6a88d51597c5 Mon Sep 17 00:00:00 2001 +From: Andre Edich +Date: Mon, 6 Jul 2020 10:39:34 +0200 +Subject: [PATCH 02/15] smsc95xx: check return value of smsc95xx_reset +Patch-mainline: v5.8-rc5 +Git-commit: 7c8b1e855f94f88a0c569be6309fc8d5c8844cd1 +References: git-fixes + +The return value of the function smsc95xx_reset() must be checked +to avoid returning false success from the function smsc95xx_bind(). + +Fixes: 2f7ca802bdae2 ("net: Add SMSC LAN9500 USB2.0 10/100 ethernet adapter driver") +Signed-off-by: Andre Edich +Signed-off-by: Parthiban Veerasooran +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/usb/smsc95xx.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 3cf4dc3433f9..eb404bb74e18 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -1287,6 +1287,8 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) + + /* Init all registers */ + ret = smsc95xx_reset(dev); ++ if (ret) ++ goto free_pdata; + + /* detect device revision as different features may be available */ + ret = smsc95xx_read_reg(dev, ID_REV, &val); +@@ -1317,6 +1319,10 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) + schedule_delayed_work(&pdata->carrier_check, CARRIER_CHECK_DELAY); + + return 0; ++ ++free_pdata: ++ kfree(pdata); ++ return ret; + } + + static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf) +-- +2.16.4 + diff --git a/patches.suse/soundwire-bus-fix-confusion-on-device-used-by-pm_run.patch b/patches.suse/soundwire-bus-fix-confusion-on-device-used-by-pm_run.patch new file mode 100644 index 0000000..68e0093 --- /dev/null +++ b/patches.suse/soundwire-bus-fix-confusion-on-device-used-by-pm_run.patch @@ -0,0 +1,99 @@ +From 973794e85610d9a716a897baa9007ff56e192826 Mon Sep 17 00:00:00 2001 +From: Pierre-Louis Bossart +Date: Fri, 22 Jan 2021 15:06:33 +0800 +Subject: [PATCH] soundwire: bus: fix confusion on device used by pm_runtime +Git-commit: 973794e85610d9a716a897baa9007ff56e192826 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Intel stress-tests routinely report IO timeouts and invalid power +management transitions. Upon further analysis, we seem to be using the +wrong devices in pm_runtime calls. + +Before reading and writing registers, we first need to make sure the +Slave is fully resumed. The existing code attempts to do such that, +however because of a confusion dating from 2017 and copy/paste, we +end-up resuming the parent only instead of resuming the codec device. + +This can lead to accesses to the Slave registers while the bus is +still being configured and the Slave not enumerated, and as a result +IO errors occur. + +This is a classic problem, similar confusions happened for HDaudio +between bus and codec device, leading to power management issues. + +Fix by using the relevant device for all uses of pm_runtime functions. + +Fixes: 60ee9be255712 ('soundwire: bus: add PM/no-PM versions of read/write functions') +Fixes: aa79293517b39 ('soundwire: bus: fix io error when processing alert event') +Fixes: 9d715fa005ebc ('soundwire: Add IO transfer') +Reported-by: Bard Liao +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Rander Wang +Signed-off-by: Bard Liao +Link: https://lore.kernel.org/r/20210122070634.12825-9-yung-chuan.liao@linux.intel.com +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/soundwire/bus.c | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c +index 45e9fc9f472a..ca12b6d6434d 100644 +--- a/drivers/soundwire/bus.c ++++ b/drivers/soundwire/bus.c +@@ -515,16 +515,16 @@ int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val) + { + int ret; + +- ret = pm_runtime_get_sync(slave->bus->dev); ++ ret = pm_runtime_get_sync(&slave->dev); + if (ret < 0 && ret != -EACCES) { +- pm_runtime_put_noidle(slave->bus->dev); ++ pm_runtime_put_noidle(&slave->dev); + return ret; + } + + ret = sdw_nread_no_pm(slave, addr, count, val); + +- pm_runtime_mark_last_busy(slave->bus->dev); +- pm_runtime_put(slave->bus->dev); ++ pm_runtime_mark_last_busy(&slave->dev); ++ pm_runtime_put(&slave->dev); + + return ret; + } +@@ -541,16 +541,16 @@ int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, u8 *val) + { + int ret; + +- ret = pm_runtime_get_sync(slave->bus->dev); ++ ret = pm_runtime_get_sync(&slave->dev); + if (ret < 0 && ret != -EACCES) { +- pm_runtime_put_noidle(slave->bus->dev); ++ pm_runtime_put_noidle(&slave->dev); + return ret; + } + + ret = sdw_nwrite_no_pm(slave, addr, count, val); + +- pm_runtime_mark_last_busy(slave->bus->dev); +- pm_runtime_put(slave->bus->dev); ++ pm_runtime_mark_last_busy(&slave->dev); ++ pm_runtime_put(&slave->dev); + + return ret; + } +@@ -1451,7 +1451,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) + ret = pm_runtime_get_sync(&slave->dev); + if (ret < 0 && ret != -EACCES) { + dev_err(&slave->dev, "Failed to resume device: %d\n", ret); +- pm_runtime_put_noidle(slave->bus->dev); ++ pm_runtime_put_noidle(&slave->dev); + return ret; + } + +-- +2.26.2 + diff --git a/patches.suse/soundwire-bus-use-sdw_update_no_pm-when-initializing.patch b/patches.suse/soundwire-bus-use-sdw_update_no_pm-when-initializing.patch new file mode 100644 index 0000000..d225e10 --- /dev/null +++ b/patches.suse/soundwire-bus-use-sdw_update_no_pm-when-initializing.patch @@ -0,0 +1,69 @@ +From b04c975e654cfdea6d691cd403b5a81cce7e593d Mon Sep 17 00:00:00 2001 +From: Pierre-Louis Bossart +Date: Fri, 22 Jan 2021 15:06:26 +0800 +Subject: [PATCH] soundwire: bus: use sdw_update_no_pm when initializing a device +Git-commit: b04c975e654cfdea6d691cd403b5a81cce7e593d +Patch-mainline: v5.12-rc1 +References: git-fixes + +When a Slave device is resumed, it may resume the bus and restart the +enumeration. During that process, we absolutely don't want to call +regular read/write routines which will wait for the resume to +complete, otherwise a deadlock occurs. + +Fixes: 60ee9be25571 ('soundwire: bus: add PM/no-PM versions of read/write functions') +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Rander Wang +Signed-off-by: Bard Liao +Link: https://lore.kernel.org/r/20210122070634.12825-2-yung-chuan.liao@linux.intel.com +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/soundwire/bus.c | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c +index d9deafdcf495..6933edbbeff6 100644 +--- a/drivers/soundwire/bus.c ++++ b/drivers/soundwire/bus.c +@@ -491,6 +491,18 @@ sdw_read_no_pm(struct sdw_slave *slave, u32 addr) + return buf; + } + ++static int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val) ++{ ++ int tmp; ++ ++ tmp = sdw_read_no_pm(slave, addr); ++ if (tmp < 0) ++ return tmp; ++ ++ tmp = (tmp & ~mask) | val; ++ return sdw_write_no_pm(slave, addr, tmp); ++} ++ + /** + * sdw_nread() - Read "n" contiguous SDW Slave registers + * @slave: SDW Slave +@@ -1254,7 +1266,7 @@ static int sdw_initialize_slave(struct sdw_slave *slave) + val = slave->prop.scp_int1_mask; + + /* Enable SCP interrupts */ +- ret = sdw_update(slave, SDW_SCP_INTMASK1, val, val); ++ ret = sdw_update_no_pm(slave, SDW_SCP_INTMASK1, val, val); + if (ret < 0) { + dev_err(slave->bus->dev, + "SDW_SCP_INTMASK1 write failed:%d\n", ret); +@@ -1269,7 +1281,7 @@ static int sdw_initialize_slave(struct sdw_slave *slave) + val = prop->dp0_prop->imp_def_interrupts; + val |= SDW_DP0_INT_PORT_READY | SDW_DP0_INT_BRA_FAILURE; + +- ret = sdw_update(slave, SDW_DP0_INTMASK, val, val); ++ ret = sdw_update_no_pm(slave, SDW_DP0_INTMASK, val, val); + if (ret < 0) + dev_err(slave->bus->dev, + "SDW_DP0_INTMASK read failed:%d\n", ret); +-- +2.26.2 + diff --git a/patches.suse/soundwire-bus-use-sdw_write_no_pm-when-setting-the-b.patch b/patches.suse/soundwire-bus-use-sdw_write_no_pm-when-setting-the-b.patch new file mode 100644 index 0000000..f5979fa --- /dev/null +++ b/patches.suse/soundwire-bus-use-sdw_write_no_pm-when-setting-the-b.patch @@ -0,0 +1,60 @@ +From 299e9780b9196bcb15b26dfdccd3244eb072d560 Mon Sep 17 00:00:00 2001 +From: Pierre-Louis Bossart +Date: Fri, 22 Jan 2021 15:06:27 +0800 +Subject: [PATCH] soundwire: bus: use sdw_write_no_pm when setting the bus scale registers +Git-commit: 299e9780b9196bcb15b26dfdccd3244eb072d560 +Patch-mainline: v5.12-rc1 +References: git-fixes + +When a Slave device is resumed, it may resume the bus and restart the +enumeration. During that process, we absolutely don't want to call +regular read/write routines which will wait for the resume to +complete, otherwise a deadlock occurs. + +This patch fixes the same problem as the previous one, but is split to +make the life of linux-stable maintainers less painful. + +Fixes: 29d158f90690 ('soundwire: bus: initialize bus clock base and scale registers') +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Rander Wang +Signed-off-by: Bard Liao +Link: https://lore.kernel.org/r/20210122070634.12825-3-yung-chuan.liao@linux.intel.com +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/soundwire/bus.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c +index 6933edbbeff6..b8b578191a3b 100644 +--- a/drivers/soundwire/bus.c ++++ b/drivers/soundwire/bus.c +@@ -1220,7 +1220,7 @@ static int sdw_slave_set_frequency(struct sdw_slave *slave) + } + scale_index++; + +- ret = sdw_write(slave, SDW_SCP_BUS_CLOCK_BASE, base); ++ ret = sdw_write_no_pm(slave, SDW_SCP_BUS_CLOCK_BASE, base); + if (ret < 0) { + dev_err(&slave->dev, + "SDW_SCP_BUS_CLOCK_BASE write failed:%d\n", ret); +@@ -1228,13 +1228,13 @@ static int sdw_slave_set_frequency(struct sdw_slave *slave) + } + + /* initialize scale for both banks */ +- ret = sdw_write(slave, SDW_SCP_BUSCLOCK_SCALE_B0, scale_index); ++ ret = sdw_write_no_pm(slave, SDW_SCP_BUSCLOCK_SCALE_B0, scale_index); + if (ret < 0) { + dev_err(&slave->dev, + "SDW_SCP_BUSCLOCK_SCALE_B0 write failed:%d\n", ret); + return ret; + } +- ret = sdw_write(slave, SDW_SCP_BUSCLOCK_SCALE_B1, scale_index); ++ ret = sdw_write_no_pm(slave, SDW_SCP_BUSCLOCK_SCALE_B1, scale_index); + if (ret < 0) + dev_err(&slave->dev, + "SDW_SCP_BUSCLOCK_SCALE_B1 write failed:%d\n", ret); +-- +2.26.2 + diff --git a/patches.suse/soundwire-cadence-fix-ACK-NAK-handling.patch b/patches.suse/soundwire-cadence-fix-ACK-NAK-handling.patch new file mode 100644 index 0000000..98d6479 --- /dev/null +++ b/patches.suse/soundwire-cadence-fix-ACK-NAK-handling.patch @@ -0,0 +1,54 @@ +From db9d9f944f95e7f3aa60ac00cbd502415152c421 Mon Sep 17 00:00:00 2001 +From: Pierre-Louis Bossart +Date: Fri, 15 Jan 2021 13:37:37 +0800 +Subject: [PATCH] soundwire: cadence: fix ACK/NAK handling +Git-commit: db9d9f944f95e7f3aa60ac00cbd502415152c421 +Patch-mainline: v5.12-rc1 +References: git-fixes + +The existing code reports a NAK only when ACK=0 +This is not aligned with the SoundWire 1.x specifications. + +Table 32 in the SoundWire 1.2 specification shows that a Device shall +not set NAK=1 if ACK=1. But Table 33 shows the Combined Response +may very well be NAK=1/ACK=1, e.g. if another Device than the one +addressed reports a parity error. + +NAK=1 signals a 'Command_Aborted', regardless of the ACK bit value. + +Move the tests for NAK so that the NAK=1/ACK=1 combination is properly +detected according to the specification. + +Fixes: 956baa1992f9a ('soundwire: cdns: Add sdw_master_ops and IO transfer support') +Signed-off-by: Pierre-Louis Bossart +Signed-off-by: Bard Liao +Link: https://lore.kernel.org/r/20210115053738.22630-5-yung-chuan.liao@linux.intel.com +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/soundwire/cadence_master.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c +index 3a363ba4bfef..be6c9eaacef9 100644 +--- a/drivers/soundwire/cadence_master.c ++++ b/drivers/soundwire/cadence_master.c +@@ -484,10 +484,10 @@ cdns_fill_msg_resp(struct sdw_cdns *cdns, + if (!(cdns->response_buf[i] & CDNS_MCP_RESP_ACK)) { + no_ack = 1; + dev_dbg_ratelimited(cdns->dev, "Msg Ack not received\n"); +- if (cdns->response_buf[i] & CDNS_MCP_RESP_NACK) { +- nack = 1; +- dev_err_ratelimited(cdns->dev, "Msg NACK received\n"); +- } ++ } ++ if (cdns->response_buf[i] & CDNS_MCP_RESP_NACK) { ++ nack = 1; ++ dev_err_ratelimited(cdns->dev, "Msg NACK received\n"); + } + } + +-- +2.26.2 + diff --git a/patches.suse/soundwire-debugfs-use-controller-id-instead-of-link_.patch b/patches.suse/soundwire-debugfs-use-controller-id-instead-of-link_.patch new file mode 100644 index 0000000..45f06bf --- /dev/null +++ b/patches.suse/soundwire-debugfs-use-controller-id-instead-of-link_.patch @@ -0,0 +1,42 @@ +From 6d5e7af1f6f5924de5dd1ebe97675c2363100878 Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Fri, 15 Jan 2021 16:25:59 +0000 +Subject: [PATCH] soundwire: debugfs: use controller id instead of link_id +Git-commit: 6d5e7af1f6f5924de5dd1ebe97675c2363100878 +Patch-mainline: v5.12-rc1 +References: git-fixes + +link_id can be zero and if we have multiple controller instances +in a system like Qualcomm debugfs will end-up with duplicate namespace +resulting in incorrect debugfs entries. + +Using id should give a unique debugfs directory entry and should fix below +warning too. +"debugfs: Directory 'master-0' with parent 'soundwire' already present!" + +Fixes: bf03473d5bcc ("soundwire: add debugfs support") +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210115162559.20869-1-srinivas.kandagatla@linaro.org +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/soundwire/debugfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/soundwire/debugfs.c b/drivers/soundwire/debugfs.c +index b6cad0d59b7b..5f9efa42bb25 100644 +--- a/drivers/soundwire/debugfs.c ++++ b/drivers/soundwire/debugfs.c +@@ -19,7 +19,7 @@ void sdw_bus_debugfs_init(struct sdw_bus *bus) + return; + + /* create the debugfs master-N */ +- snprintf(name, sizeof(name), "master-%d", bus->link_id); ++ snprintf(name, sizeof(name), "master-%d", bus->id); + bus->debugfs = debugfs_create_dir(name, sdw_debugfs_root); + } + +-- +2.26.2 + diff --git a/patches.suse/soundwire-export-sdw_write-read_no_pm-functions.patch b/patches.suse/soundwire-export-sdw_write-read_no_pm-functions.patch new file mode 100644 index 0000000..c13dca3 --- /dev/null +++ b/patches.suse/soundwire-export-sdw_write-read_no_pm-functions.patch @@ -0,0 +1,74 @@ +From 167790abb90fa073d8341ee0e408ccad3d2109cd Mon Sep 17 00:00:00 2001 +From: Bard Liao +Date: Fri, 22 Jan 2021 15:06:29 +0800 +Subject: [PATCH] soundwire: export sdw_write/read_no_pm functions +Git-commit: 167790abb90fa073d8341ee0e408ccad3d2109cd +Patch-mainline: v5.12-rc1 +References: git-fixes + +sdw_write_no_pm and sdw_read_no_pm are useful when we want to do IO +without touching PM. + +Fixes: 0231453bc08f ('soundwire: bus: add clock stop helpers') +Fixes: 60ee9be25571 ('soundwire: bus: add PM/no-PM versions of read/write functions') +Signed-off-by: Bard Liao +Link: https://lore.kernel.org/r/20210122070634.12825-5-yung-chuan.liao@linux.intel.com +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/soundwire/bus.c | 7 ++++--- + include/linux/soundwire/sdw.h | 2 ++ + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c +index 675d028e923d..45e9fc9f472a 100644 +--- a/drivers/soundwire/bus.c ++++ b/drivers/soundwire/bus.c +@@ -407,10 +407,11 @@ sdw_nwrite_no_pm(struct sdw_slave *slave, u32 addr, size_t count, u8 *val) + return sdw_transfer(slave->bus, &msg); + } + +-static int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value) ++int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value) + { + return sdw_nwrite_no_pm(slave, addr, 1, &value); + } ++EXPORT_SYMBOL(sdw_write_no_pm); + + static int + sdw_bread_no_pm(struct sdw_bus *bus, u16 dev_num, u32 addr) +@@ -478,8 +479,7 @@ int sdw_bwrite_no_pm_unlocked(struct sdw_bus *bus, u16 dev_num, u32 addr, u8 val + } + EXPORT_SYMBOL(sdw_bwrite_no_pm_unlocked); + +-static int +-sdw_read_no_pm(struct sdw_slave *slave, u32 addr) ++int sdw_read_no_pm(struct sdw_slave *slave, u32 addr) + { + u8 buf; + int ret; +@@ -490,6 +490,7 @@ sdw_read_no_pm(struct sdw_slave *slave, u32 addr) + else + return buf; + } ++EXPORT_SYMBOL(sdw_read_no_pm); + + static int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val) + { +diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h +index f0b01b728640..d08039d65825 100644 +--- a/include/linux/soundwire/sdw.h ++++ b/include/linux/soundwire/sdw.h +@@ -1005,6 +1005,8 @@ int sdw_bus_exit_clk_stop(struct sdw_bus *bus); + + int sdw_read(struct sdw_slave *slave, u32 addr); + int sdw_write(struct sdw_slave *slave, u32 addr, u8 value); ++int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value); ++int sdw_read_no_pm(struct sdw_slave *slave, u32 addr); + int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val); + int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, u8 *val); + +-- +2.26.2 + diff --git a/patches.suse/staging-gdm724x-Fix-DMA-from-stack.patch b/patches.suse/staging-gdm724x-Fix-DMA-from-stack.patch new file mode 100644 index 0000000..880b0c8 --- /dev/null +++ b/patches.suse/staging-gdm724x-Fix-DMA-from-stack.patch @@ -0,0 +1,58 @@ +From 7c3a0635cd008eaca9a734dc802709ee0b81cac5 Mon Sep 17 00:00:00 2001 +From: Amey Narkhede +Date: Thu, 11 Feb 2021 11:08:19 +0530 +Subject: [PATCH] staging: gdm724x: Fix DMA from stack +Git-commit: 7c3a0635cd008eaca9a734dc802709ee0b81cac5 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Stack allocated buffers cannot be used for DMA +on all architectures so allocate hci_packet buffer +using kmalloc. + +Reviewed-by: Dan Carpenter +Signed-off-by: Amey Narkhede +Link: https://lore.kernel.org/r/20210211053819.34858-1-ameynarkhede03@gmail.com +Cc: stable +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/staging/gdm724x/gdm_usb.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/drivers/staging/gdm724x/gdm_usb.c b/drivers/staging/gdm724x/gdm_usb.c +index dc4da66c3695..54bdb64f52e8 100644 +--- a/drivers/staging/gdm724x/gdm_usb.c ++++ b/drivers/staging/gdm724x/gdm_usb.c +@@ -56,20 +56,24 @@ static int gdm_usb_recv(void *priv_dev, + + static int request_mac_address(struct lte_udev *udev) + { +- u8 buf[16] = {0,}; +- struct hci_packet *hci = (struct hci_packet *)buf; ++ struct hci_packet *hci; + struct usb_device *usbdev = udev->usbdev; + int actual; + int ret = -1; + ++ hci = kmalloc(struct_size(hci, data, 1), GFP_KERNEL); ++ if (!hci) ++ return -ENOMEM; ++ + hci->cmd_evt = gdm_cpu_to_dev16(udev->gdm_ed, LTE_GET_INFORMATION); + hci->len = gdm_cpu_to_dev16(udev->gdm_ed, 1); + hci->data[0] = MAC_ADDRESS; + +- ret = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 2), buf, 5, ++ ret = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 2), hci, 5, + &actual, 1000); + + udev->request_mac_addr = 1; ++ kfree(hci); + + return ret; + } +-- +2.26.2 + diff --git a/patches.suse/staging-rtl8188eu-Add-Edimax-EW-7811UN-V2-to-device-.patch b/patches.suse/staging-rtl8188eu-Add-Edimax-EW-7811UN-V2-to-device-.patch new file mode 100644 index 0000000..ca1b217 --- /dev/null +++ b/patches.suse/staging-rtl8188eu-Add-Edimax-EW-7811UN-V2-to-device-.patch @@ -0,0 +1,36 @@ +From 7a8d2f1908a59003e55ef8691d09efb7fbc51625 Mon Sep 17 00:00:00 2001 +From: Martin Kaiser +Date: Thu, 4 Feb 2021 09:52:17 +0100 +Subject: [PATCH] staging: rtl8188eu: Add Edimax EW-7811UN V2 to device table +Git-commit: 7a8d2f1908a59003e55ef8691d09efb7fbc51625 +Patch-mainline: v5.12-rc1 +References: git-fixes + +The Edimax EW-7811UN V2 uses an RTL8188EU chipset and works with this +driver. + +Signed-off-by: Martin Kaiser +Cc: stable +Link: https://lore.kernel.org/r/20210204085217.9743-1-martin@kaiser.cx +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c +index 43ebd11b53fe..efad43d8e465 100644 +--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c ++++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c +@@ -41,6 +41,7 @@ static const struct usb_device_id rtw_usb_id_tbl[] = { + {USB_DEVICE(0x2357, 0x0111)}, /* TP-Link TL-WN727N v5.21 */ + {USB_DEVICE(0x2C4E, 0x0102)}, /* MERCUSYS MW150US v2 */ + {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ ++ {USB_DEVICE(0x7392, 0xb811)}, /* Edimax EW-7811UN V2 */ + {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */ + {} /* Terminating entry */ + }; +-- +2.26.2 + diff --git a/patches.suse/usb-dwc3-gadget-Fix-dep-interval-for-fullspeed-inter.patch b/patches.suse/usb-dwc3-gadget-Fix-dep-interval-for-fullspeed-inter.patch new file mode 100644 index 0000000..56271f1 --- /dev/null +++ b/patches.suse/usb-dwc3-gadget-Fix-dep-interval-for-fullspeed-inter.patch @@ -0,0 +1,44 @@ +From 4b049f55ed95cd889bcdb3034fd75e1f01852b38 Mon Sep 17 00:00:00 2001 +From: Thinh Nguyen +Date: Mon, 8 Feb 2021 13:53:16 -0800 +Subject: [PATCH] usb: dwc3: gadget: Fix dep->interval for fullspeed interrupt +Git-commit: 4b049f55ed95cd889bcdb3034fd75e1f01852b38 +Patch-mainline: v5.12-rc1 +References: git-fixes + +[ backport note: adjusted the gadget object access (from dwc->gadget->speed to dwc->gadget.speed) for 5.3.x kernel base -- tiwai ] + +The dep->interval captures the number of frames/microframes per interval +from bInterval. Fullspeed interrupt endpoint bInterval is the number of +frames per interval and not 2^(bInterval - 1). So fix it here. This +change is only for debugging purpose and should not affect the interrupt +endpoint operation. + +Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver") +Cc: +Signed-off-by: Thinh Nguyen +Link: https://lore.kernel.org/r/1263b563dedc4ab8b0fb854fba06ce4bc56bd495.1612820995.git.Thinh.Nguyen@synopsys.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/dwc3/gadget.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -603,8 +603,13 @@ static int dwc3_gadget_set_ep_config(str + if (dwc->gadget.speed == USB_SPEED_FULL) + bInterval_m1 = 0; + ++ if (usb_endpoint_type(desc) == USB_ENDPOINT_XFER_INT && ++ dwc->gadget.speed == USB_SPEED_FULL) ++ dep->interval = desc->bInterval; ++ else ++ dep->interval = 1 << (desc->bInterval - 1); ++ + params.param1 |= DWC3_DEPCFG_BINTERVAL_M1(bInterval_m1); +- dep->interval = 1 << (desc->bInterval - 1); + } + + return dwc3_send_gadget_ep_cmd(dep, DWC3_DEPCMD_SETEPCONFIG, ¶ms); diff --git a/patches.suse/usb-dwc3-gadget-Fix-setting-of-DEPCFG.bInterval_m1.patch b/patches.suse/usb-dwc3-gadget-Fix-setting-of-DEPCFG.bInterval_m1.patch new file mode 100644 index 0000000..1f669cd --- /dev/null +++ b/patches.suse/usb-dwc3-gadget-Fix-setting-of-DEPCFG.bInterval_m1.patch @@ -0,0 +1,47 @@ +From a1679af85b2ae35a2b78ad04c18bb069c37330cc Mon Sep 17 00:00:00 2001 +From: Thinh Nguyen +Date: Mon, 8 Feb 2021 13:53:10 -0800 +Subject: [PATCH] usb: dwc3: gadget: Fix setting of DEPCFG.bInterval_m1 +Git-commit: a1679af85b2ae35a2b78ad04c18bb069c37330cc +Patch-mainline: v5.12-rc1 +References: git-fixes + +[ backport note: adjusted the gadget object access (from dwc->gadget->speed + to dwc->gadget.speed) for 5.3.x kernel base -- tiwai ] + +Valid range for DEPCFG.bInterval_m1 is from 0 to 13, and it must be set +to 0 when the controller operates in full-speed. See the programming +guide for DEPCFG command section 3.2.2.1 (v3.30a). + +Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver") +Cc: +Signed-off-by: Thinh Nguyen +Link: https://lore.kernel.org/r/3f57026f993c0ce71498dbb06e49b3a47c4d0265.1612820995.git.Thinh.Nguyen@synopsys.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/dwc3/gadget.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -593,7 +593,17 @@ static int dwc3_gadget_set_ep_config(str + params.param0 |= DWC3_DEPCFG_FIFO_NUMBER(dep->number >> 1); + + if (desc->bInterval) { +- params.param1 |= DWC3_DEPCFG_BINTERVAL_M1(desc->bInterval - 1); ++ u8 bInterval_m1; ++ ++ /* ++ * Valid range for DEPCFG.bInterval_m1 is from 0 to 13, and it ++ * must be set to 0 when the controller operates in full-speed. ++ */ ++ bInterval_m1 = min_t(u8, desc->bInterval - 1, 13); ++ if (dwc->gadget.speed == USB_SPEED_FULL) ++ bInterval_m1 = 0; ++ ++ params.param1 |= DWC3_DEPCFG_BINTERVAL_M1(bInterval_m1); + dep->interval = 1 << (desc->bInterval - 1); + } + diff --git a/patches.suse/usb-quirks-add-quirk-to-start-video-capture-on-ELMO-.patch b/patches.suse/usb-quirks-add-quirk-to-start-video-capture-on-ELMO-.patch new file mode 100644 index 0000000..06edc14 --- /dev/null +++ b/patches.suse/usb-quirks-add-quirk-to-start-video-capture-on-ELMO-.patch @@ -0,0 +1,39 @@ +From 1ebe718bb48278105816ba03a0408ecc2d6cf47f Mon Sep 17 00:00:00 2001 +From: Stefan Ursella +Date: Wed, 10 Feb 2021 15:07:11 +0100 +Subject: [PATCH] usb: quirks: add quirk to start video capture on ELMO L-12F document camera reliable +Git-commit: 1ebe718bb48278105816ba03a0408ecc2d6cf47f +Patch-mainline: v5.12-rc1 +References: git-fixes + +Without this quirk starting a video capture from the device often fails with + +Kernel: uvcvideo: Failed to set UVC probe control : -110 (exp. 34). + +Signed-off-by: Stefan Ursella +Link: https://lore.kernel.org/r/20210210140713.18711-1-stefan.ursella@wolfvision.net +Cc: stable +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/core/quirks.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c +index 66a0dc618dfc..6ade3daf7858 100644 +--- a/drivers/usb/core/quirks.c ++++ b/drivers/usb/core/quirks.c +@@ -391,6 +391,9 @@ static const struct usb_device_id usb_quirk_list[] = { + /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ + { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, + ++ /* ELMO L-12F document camera */ ++ { USB_DEVICE(0x09a1, 0x0028), .driver_info = USB_QUIRK_DELAY_CTRL_MSG }, ++ + /* Broadcom BCM92035DGROM BT dongle */ + { USB_DEVICE(0x0a5c, 0x2021), .driver_info = USB_QUIRK_RESET_RESUME }, + +-- +2.26.2 + diff --git a/patches.suse/virt-vbox-Do-not-use-wait_event_interruptible-when-c.patch b/patches.suse/virt-vbox-Do-not-use-wait_event_interruptible-when-c.patch new file mode 100644 index 0000000..88b5be5 --- /dev/null +++ b/patches.suse/virt-vbox-Do-not-use-wait_event_interruptible-when-c.patch @@ -0,0 +1,72 @@ +From c35901b39ddc20077f4ae7b9f7bf344487f62212 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 21 Jan 2021 16:07:54 +0100 +Subject: [PATCH] virt: vbox: Do not use wait_event_interruptible when called from kernel context +Git-commit: c35901b39ddc20077f4ae7b9f7bf344487f62212 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Do not use wait_event_interruptible when vbg_hgcm_call() gets called from +kernel-context, such as it being called by the vboxsf filesystem code. + +This fixes some filesystem related system calls on shared folders +unexpectedly failing with -EINTR. + +Fixes: 0532a1b0d045 ("virt: vbox: Implement passing requestor info to the host for VirtualBox 6.0.x") +Reported-by: Ludovic Pouzenc +Signed-off-by: Hans de Goede +Cc: stable +Link: https://lore.kernel.org/r/20210121150754.147598-1-hdegoede@redhat.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/virt/vboxguest/vboxguest_utils.c | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +diff --git a/drivers/virt/vboxguest/vboxguest_utils.c b/drivers/virt/vboxguest/vboxguest_utils.c +index ea05af41ec69..8d195e3f8301 100644 +--- a/drivers/virt/vboxguest/vboxguest_utils.c ++++ b/drivers/virt/vboxguest/vboxguest_utils.c +@@ -468,7 +468,7 @@ static int hgcm_cancel_call(struct vbg_dev *gdev, struct vmmdev_hgcm_call *call) + * Cancellation fun. + */ + static int vbg_hgcm_do_call(struct vbg_dev *gdev, struct vmmdev_hgcm_call *call, +- u32 timeout_ms, bool *leak_it) ++ u32 timeout_ms, bool interruptible, bool *leak_it) + { + int rc, cancel_rc, ret; + long timeout; +@@ -495,10 +495,15 @@ static int vbg_hgcm_do_call(struct vbg_dev *gdev, struct vmmdev_hgcm_call *call, + else + timeout = msecs_to_jiffies(timeout_ms); + +- timeout = wait_event_interruptible_timeout( +- gdev->hgcm_wq, +- hgcm_req_done(gdev, &call->header), +- timeout); ++ if (interruptible) { ++ timeout = wait_event_interruptible_timeout(gdev->hgcm_wq, ++ hgcm_req_done(gdev, &call->header), ++ timeout); ++ } else { ++ timeout = wait_event_timeout(gdev->hgcm_wq, ++ hgcm_req_done(gdev, &call->header), ++ timeout); ++ } + + /* timeout > 0 means hgcm_req_done has returned true, so success */ + if (timeout > 0) +@@ -631,7 +636,8 @@ int vbg_hgcm_call(struct vbg_dev *gdev, u32 requestor, u32 client_id, + hgcm_call_init_call(call, client_id, function, parms, parm_count, + bounce_bufs); + +- ret = vbg_hgcm_do_call(gdev, call, timeout_ms, &leak_it); ++ ret = vbg_hgcm_do_call(gdev, call, timeout_ms, ++ requestor & VMMDEV_REQUESTOR_USERMODE, &leak_it); + if (ret == 0) { + *vbox_status = call->header.result; + ret = hgcm_call_copy_back_result(call, parms, parm_count, +-- +2.26.2 + diff --git a/patches.suse/watchdog-mei_wdt-request-stop-on-unregister.patch b/patches.suse/watchdog-mei_wdt-request-stop-on-unregister.patch new file mode 100644 index 0000000..bd0d973 --- /dev/null +++ b/patches.suse/watchdog-mei_wdt-request-stop-on-unregister.patch @@ -0,0 +1,48 @@ +From 740c0a57b8f1e36301218bf549f3c9cc833a60be Mon Sep 17 00:00:00 2001 +From: Alexander Usyskin +Date: Sun, 24 Jan 2021 13:49:38 +0200 +Subject: [PATCH] watchdog: mei_wdt: request stop on unregister +Git-commit: 740c0a57b8f1e36301218bf549f3c9cc833a60be +Patch-mainline: v5.12-rc1 +References: git-fixes + +The MEI bus has a special behavior on suspend it destroys +all the attached devices, this is due to the fact that also +firmware context is not persistent across power flows. + +If watchdog on MEI bus is ticking before suspending the firmware +times out and reports that the OS is missing watchdog tick. +Send the stop command to the firmware on watchdog unregistered +to eliminate the false event on suspend. +This does not make the things worse from the user-space perspective +as a user-space should re-open watchdog device after +suspending before this patch. + +Cc: +Signed-off-by: Alexander Usyskin +Signed-off-by: Tomas Winkler +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/20210124114938.373885-1-tomas.winkler@intel.com +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Acked-by: Takashi Iwai + +--- + drivers/watchdog/mei_wdt.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/watchdog/mei_wdt.c b/drivers/watchdog/mei_wdt.c +index 5391bf3e6b11..c5967d8b4256 100644 +--- a/drivers/watchdog/mei_wdt.c ++++ b/drivers/watchdog/mei_wdt.c +@@ -382,6 +382,7 @@ static int mei_wdt_register(struct mei_wdt *wdt) + + watchdog_set_drvdata(&wdt->wdd, wdt); + watchdog_stop_on_reboot(&wdt->wdd); ++ watchdog_stop_on_unregister(&wdt->wdd); + + ret = watchdog_register_device(&wdt->wdd); + if (ret) +-- +2.26.2 + diff --git a/patches.suse/wireguard-device-do-not-generate-ICMP-for-non-IP-pac.patch b/patches.suse/wireguard-device-do-not-generate-ICMP-for-non-IP-pac.patch new file mode 100644 index 0000000..5cbddc4 --- /dev/null +++ b/patches.suse/wireguard-device-do-not-generate-ICMP-for-non-IP-pac.patch @@ -0,0 +1,47 @@ +From: "Jason A. Donenfeld" +Date: Mon, 22 Feb 2021 17:25:47 +0100 +Subject: wireguard: device: do not generate ICMP for non-IP packets +Patch-mainline: v5.12-rc1 +Git-commit: 99fff5264e7ab06f45b0ad60243475be0a8d0559 +References: git-fixes + +If skb->protocol doesn't match the actual skb->data header, it's +probably not a good idea to pass it off to icmp{,v6}_ndo_send, which is +expecting to reply to a valid IP packet. So this commit has that early +mismatch case jump to a later error label. + +Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Jakub Kicinski +Acked-by: Daniel Wagner +--- + drivers/net/wireguard/device.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireguard/device.c ++++ b/drivers/net/wireguard/device.c +@@ -138,7 +138,7 @@ static netdev_tx_t wg_xmit(struct sk_buf + else if (skb->protocol == htons(ETH_P_IPV6)) + net_dbg_ratelimited("%s: No peer has allowed IPs matching %pI6\n", + dev->name, &ipv6_hdr(skb)->daddr); +- goto err; ++ goto err_icmp; + } + + family = READ_ONCE(peer->endpoint.addr.sa_family); +@@ -201,12 +201,13 @@ static netdev_tx_t wg_xmit(struct sk_buf + + err_peer: + wg_peer_put(peer); +-err: +- ++dev->stats.tx_errors; ++err_icmp: + if (skb->protocol == htons(ETH_P_IP)) + icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0); + else if (skb->protocol == htons(ETH_P_IPV6)) + icmpv6_ndo_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0); ++err: ++ ++dev->stats.tx_errors; + kfree_skb(skb); + return ret; + } diff --git a/patches.suse/wireguard-kconfig-use-arm-chacha-even-with-no-neon.patch b/patches.suse/wireguard-kconfig-use-arm-chacha-even-with-no-neon.patch new file mode 100644 index 0000000..d26e33e --- /dev/null +++ b/patches.suse/wireguard-kconfig-use-arm-chacha-even-with-no-neon.patch @@ -0,0 +1,30 @@ +From: "Jason A. Donenfeld" +Date: Mon, 22 Feb 2021 17:25:49 +0100 +Subject: wireguard: kconfig: use arm chacha even with no neon +Patch-mainline: v5.12-rc1 +Git-commit: bce2473927af8de12ad131a743f55d69d358c0b9 +References: git-fixes + +The condition here was incorrect: a non-neon fallback implementation is +available on arm32 when NEON is not supported. + +Reported-by: Ilya Lipnitskiy +Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Jakub Kicinski +Acked-by: Daniel Wagner +--- + drivers/net/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/Kconfig ++++ b/drivers/net/Kconfig +@@ -87,7 +87,7 @@ config WIREGUARD + select CRYPTO_CURVE25519_X86 if X86 && 64BIT + select ARM_CRYPTO if ARM + select ARM64_CRYPTO if ARM64 +- select CRYPTO_CHACHA20_NEON if (ARM || ARM64) && KERNEL_MODE_NEON ++ select CRYPTO_CHACHA20_NEON if ARM || (ARM64 && KERNEL_MODE_NEON) + select CRYPTO_POLY1305_NEON if ARM64 && KERNEL_MODE_NEON + select CRYPTO_POLY1305_ARM if ARM + select CRYPTO_CURVE25519_NEON if ARM && KERNEL_MODE_NEON diff --git a/patches.suse/wireguard-selftests-test-multiple-parallel-streams.patch b/patches.suse/wireguard-selftests-test-multiple-parallel-streams.patch new file mode 100644 index 0000000..87628ad --- /dev/null +++ b/patches.suse/wireguard-selftests-test-multiple-parallel-streams.patch @@ -0,0 +1,52 @@ +From: "Jason A. Donenfeld" +Date: Mon, 22 Feb 2021 17:25:45 +0100 +Subject: wireguard: selftests: test multiple parallel streams +Patch-mainline: v5.12-rc1 +Git-commit: d5a49aa6c3e264a93a7d08485d66e346be0969dd +References: git-fixes + +In order to test ndo_start_xmit being called in parallel, explicitly add +separate tests, which should all run on different cores. This should +help tease out bugs associated with queueing up packets from different +cores in parallel. Currently, it hasn't found those types of bugs, but +given future planned work, this is a useful regression to avoid. + +Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Jakub Kicinski +Acked-by: Daniel Wagner +--- + tools/testing/selftests/wireguard/netns.sh | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +--- a/tools/testing/selftests/wireguard/netns.sh ++++ b/tools/testing/selftests/wireguard/netns.sh +@@ -39,7 +39,7 @@ ip0() { pretty 0 "ip $*"; ip -n $netns0 + ip1() { pretty 1 "ip $*"; ip -n $netns1 "$@"; } + ip2() { pretty 2 "ip $*"; ip -n $netns2 "$@"; } + sleep() { read -t "$1" -N 1 || true; } +-waitiperf() { pretty "${1//*-}" "wait for iperf:5201 pid $2"; while [[ $(ss -N "$1" -tlpH 'sport = 5201') != *\"iperf3\",pid=$2,fd=* ]]; do sleep 0.1; done; } ++waitiperf() { pretty "${1//*-}" "wait for iperf:${3:-5201} pid $2"; while [[ $(ss -N "$1" -tlpH "sport = ${3:-5201}") != *\"iperf3\",pid=$2,fd=* ]]; do sleep 0.1; done; } + waitncatudp() { pretty "${1//*-}" "wait for udp:1111 pid $2"; while [[ $(ss -N "$1" -ulpH 'sport = 1111') != *\"ncat\",pid=$2,fd=* ]]; do sleep 0.1; done; } + waitiface() { pretty "${1//*-}" "wait for $2 to come up"; ip netns exec "$1" bash -c "while [[ \$(< \"/sys/class/net/$2/operstate\") != up ]]; do read -t .1 -N 0 || true; done;"; } + +@@ -141,6 +141,19 @@ tests() { + n2 iperf3 -s -1 -B fd00::2 & + waitiperf $netns2 $! + n1 iperf3 -Z -t 3 -b 0 -u -c fd00::2 ++ ++ # TCP over IPv4, in parallel ++ for max in 4 5 50; do ++ local pids=( ) ++ for ((i=0; i < max; ++i)) do ++ n2 iperf3 -p $(( 5200 + i )) -s -1 -B 192.168.241.2 & ++ pids+=( $! ); waitiperf $netns2 $! $(( 5200 + i )) ++ done ++ for ((i=0; i < max; ++i)) do ++ n1 iperf3 -Z -t 3 -p $(( 5200 + i )) -c 192.168.241.2 & ++ done ++ wait "${pids[@]}" ++ done + } + + [[ $(ip1 link show dev wg0) =~ mtu\ ([0-9]+) ]] && orig_mtu="${BASH_REMATCH[1]}" diff --git a/rpm/macros.kernel-source b/rpm/macros.kernel-source index 4dbbcb5..8901145 100644 --- a/rpm/macros.kernel-source +++ b/rpm/macros.kernel-source @@ -77,7 +77,7 @@ esac) : -n is actually passed to the macro. Fix this here, so that : we do not have to modify the modsign-repackage script sed "s|@CERTS@|$cert|g; s|%%{-n.}|%{-n*}%{!-n:%name}|g" /usr/lib/rpm/kernel-cert-subpackage \ - echo "%%global __spec_build_pre %%__spec_build_pre mkdir -p %%buildroot/etc/uefi/certs; openssl x509 -in %{-c*} -inform $fmt -out %%buildroot/$cert -outform DER" } \ + echo "%%global __spec_install_pre %%__spec_install_pre mkdir -p %%buildroot/etc/uefi/certs; openssl x509 -in %{-c*} -inform $fmt -out %%buildroot/$cert -outform DER" } \ )} # kernel_module_package: simply pass on all options and arguments. diff --git a/series.conf b/series.conf index a66a67e..cc0dc83 100644 --- a/series.conf +++ b/series.conf @@ -2051,6 +2051,11 @@ patches.suse/nfp-flower-offload-MPLS-pop-action.patch patches.suse/nfp-flower-offload-MPLS-set-action.patch patches.suse/drivers-net-xgene-Remove-acpi_has_method-calls.patch + patches.suse/can-flexcan-implement-can-Runtime-PM.patch + patches.suse/dt-bindings-can-flexcan-add-PE-clock-source-property.patch + patches.suse/can-flexcan-add-support-for-PE-clock-source-select.patch + patches.suse/dt-bindings-can-flexcan-add-can-wakeup-property.patch + patches.suse/can-flexcan-add-support-for-DT-property-wakeup-sourc.patch patches.suse/sfc-Use-dev_get_drvdata-where-possible.patch patches.suse/sfc-falcon-Use-dev_get_drvdata-where-possible.patch patches.suse/Build-fixes-for-skb_frag_size-conversion.patch @@ -10183,6 +10188,22 @@ patches.suse/selftests-Add-a-test-of-large-binary-to-devlink-heal.patch patches.suse/net-sched-actions-remove-unused-order.patch patches.suse/sfc-trace_xdp_exception-on-XDP-failure.patch + patches.suse/can-rx-offload-fix-long-lines.patch + patches.suse/can-rx-offload-can_rx_offload_compare-fix-typo.patch + patches.suse/can-rx-offload-can_rx_offload_irq_offload_timestamp-2.patch + patches.suse/can-rx-offload-can_rx_offload_reset-remove-no-op-fun.patch + patches.suse/can-rx-offload-Prepare-for-CAN-FD-support.patch + patches.suse/can-flexcan-use-devm_platform_ioremap_resource-to-si.patch + patches.suse/can-flexcan-flexcan_irq_state-only-read-timestamp-if.patch + patches.suse/can-flexcan-rename-macro-FLEXCAN_IFLAG_MB-FLEXCAN_IF.patch + patches.suse/can-flexcan-flexcan_irq-rename-variable-reg_iflag-re.patch + patches.suse/can-flexcan-rename-struct-flexcan_priv-reg_imask-1-2.patch + patches.suse/can-flexcan-remove-TX-mailbox-bit-from-struct-flexca.patch + patches.suse/can-flexcan-convert-struct-flexcan_priv-rx_mask-1-2-.patch + patches.suse/can-flexcan-introduce-struct-flexcan_priv-tx_mask-an.patch + patches.suse/can-flexcan-flexcan_read_reg_iflag_rx-optimize-readi.patch + patches.suse/can-flexcan-flexcan_irq-add-support-for-TX-mailbox-i.patch + patches.suse/can-flexcan-flexcan_mailbox_read-make-use-of-flexcan.patch patches.suse/Bluetooth-btrtl-remove-unneeded-semicolon.patch patches.suse/Bluetooth-hci_bcm-Add-compatible-string-for-BCM43540.patch patches.suse/Bluetooth-Fix-using-advertising-instance-duration-as.patch @@ -16421,6 +16442,7 @@ patches.suse/dmaengine-Call-module_put-after-device_free_chan_res.patch patches.suse/dmaengine-Move-dma_channel_rebalance-infrastructure-.patch patches.suse/dmaengine-Add-reference-counting-to-dma_device-struc.patch + patches.suse/dmaengine-ioat-Support-in-use-unbind.patch patches.suse/dmaengine-move-module_-dma_device_put-after-route-fr.patch patches.suse/dmaengine-print-more-meaningful-error-message.patch patches.suse/dmaengine-imx-sdma-rename-function.patch @@ -22621,6 +22643,7 @@ patches.suse/clk-imx8mn-fix-incorrect-clock-defines.patch patches.suse/kvm-x86-clear-stale-x86_emulate_ctxt-intercept-value patches.suse/kvm-x86-remove-stale-comment-from-struct-x86_emulate_ctxt + patches.suse/kvm-vmx-condition-encls-exiting-enabling-on-cpu-support-for-sgx1 patches.suse/0006-kvm-s390-also-reset-registers-in-sync-regs-for-initial-cpu-reset patches.suse/watchdog-iTCO_wdt-Export-vendorsupport.patch patches.suse/watchdog-iTCO_wdt-Make-ICH_RES_IO_SMI-optional.patch @@ -22727,6 +22750,7 @@ patches.suse/x86-mm-split-vmalloc_sync_all.patch patches.suse/btrfs-fix-log-context-list-corruption-after-rename-w.patch patches.suse/crypto-arm64-chacha-correctly-walk-through-blocks.patch + patches.suse/dmaengine-move-.device_release-missing-log-warning-t.patch patches.suse/dmaengine-idxd-fix-off-by-one-on-cdev-dwq-refcount.patch patches.suse/gpiolib-Fix-irq_disable-semantics.patch patches.suse/gpiolib-acpi-Correct-comment-for-HP-x2-10-honor_wake.patch @@ -26988,7 +27012,9 @@ patches.suse/mm-compaction-fully-assume-capture-is-not-null-in-compact_zone_order.patch patches.suse/mm-mempolicy-require-at-least-one-nodeid-for-MPOL_PREFERRED.patch patches.suse/ima-add-a-new-CONFIG-for-loading-arch-specific-polic.patch + patches.suse/kvm-x86-allocate-new-rmap-and-large-page-tracking-when-moving-memslot patches.suse/KVM-Reinstall-old-memslots-if-arch-preparation-fails.patch + patches.suse/kvm-x86-gracefully-handle-_vmalloc-failure-during-vm-allocation patches.suse/kvm-x86-trace-the-original-requested-cpuid-function-in-kvm_cpuid patches.suse/kvm-x86-fix-cpuid-range-checks-for-hypervisor-and-centaur-classes patches.suse/0008-s390-protvirt-introduce-host-side-setup @@ -28125,6 +28151,7 @@ patches.suse/mm-page_reporting-rotate-reported-pages-to-the-tail-of-the-list.patch patches.suse/mm-page_reporting-add-budget-limit-on-how-many-pages-can-be-reported-per-pass.patch patches.suse/mm-page_reporting-add-free-page-reporting-documentation.patch + patches.suse/0001-include-linux-memremap.h-remove-stale-comments.patch patches.suse/ubsan-check-panic_on_warn.patch patches.suse/ipc-mqueue.c-fix-a-brace-coding-style-issue.patch patches.suse/ipc-shm.c-make-compat_ksys_shmctl-static.patch @@ -28641,6 +28668,7 @@ patches.suse/coredump-fix-null-pointer-dereference-on-coredump.patch patches.suse/audit-check-the-length-of-userspace-generated-audit-.patch patches.suse/remoteproc-qcom_q6v5_mss-fix-a-bug-in-q6v5_probe.patch + patches.suse/exfat-add-missing-MODULE_ALIAS_FS.patch patches.suse/nfsd-memory-corruption-in-nfsd4_lock.patch patches.suse/SUNRPC-Fix-backchannel-RPC-soft-lockups.patch patches.suse/svcrdma-fix-trace-point-use-after-free-race.patch @@ -28974,6 +29002,7 @@ patches.suse/net-tls-Fix-sk_psock-refcnt-leak-when-in-tls_data_re.patch patches.suse/fq_codel-fix-TCA_FQ_CODEL_DROP_BATCH_SIZE-sanity-che.patch patches.suse/sch_choke-avoid-potential-panic-in-choke_reset.patch + patches.suse/net-phy-marvell10g-fix-temperature-sensor-on-2110.patch patches.suse/bnxt_en-Fix-VF-anti-spoof-filter-setup.patch patches.suse/bnxt_en-Reduce-BNXT_MSIX_VEC_MAX-value-to-supported-.patch patches.suse/bnxt_en-Improve-AER-slot-reset.patch @@ -29292,6 +29321,7 @@ patches.suse/dmaengine-idxd-fix-interrupt-completion-after-unmask.patch patches.suse/dmaengine-dmatest-Restore-default-for-channel.patch patches.suse/dmaengine-tegra210-adma-Fix-an-error-handling-path-i.patch + patches.suse/exfat-add-the-dummy-mount-options-to-be-backward-com.patch patches.suse/apparmor-Fix-use-after-free-in-aa_audit_rule_init.patch patches.suse/ALSA-pcm-fix-incorrect-hw_base-increase.patch patches.suse/ALSA-hda-realtek-Fix-silent-output-on-Gigabyte-X5702.patch @@ -31659,6 +31689,9 @@ patches.suse/netfilter-nft_nat-set-flags-from-initialization-path.patch patches.suse/netfilter-nft_nat-add-helper-function-to-set-up-NAT-.patch patches.suse/netfilter-nft_nat-add-netmap-support.patch + patches.suse/net-bcmgenet-set-Rx-mode-before-starting-netif.patch + patches.suse/net-bcmgenet-Fix-WoL-with-password-after-deep-sleep.patch + patches.suse/Revert-net-bcmgenet-remove-unused-function-in-bcmgen.patch patches.suse/hinic-make-a-bunch-of-functions-static.patch patches.suse/hinic-Use-ARRAY_SIZE-for-nic_vf_cmd_msg_handler.patch patches.suse/net-smc-add-event-based-llc_flow-framework @@ -31760,6 +31793,7 @@ patches.suse/ptp_qoriq-output-PPS-signal-on-FIPER2-in-default.patch patches.suse/dpaa_eth-Fix-comparing-pointer-to-0.patch patches.suse/ice-Fix-error-return-code-in-ice_add_prof.patch + patches.suse/net-lpc-enet-fix-error-return-code-in-lpc_mii_init.patch patches.suse/dpaa2-eth-fix-error-return-code-in-setup_dpni.patch patches.suse/r8169-improve-max-jumbo-packet-size-definition.patch patches.suse/r8169-configure-PME_SIGNAL-for-RTL8125-too.patch @@ -31770,6 +31804,7 @@ patches.suse/r8169-simplify-counter-handling.patch patches.suse/r8169-remove-out-of-memory-error-message-from-rtl_re.patch patches.suse/r8169-switch-from-netif_xxx-message-functions-to-net.patch + patches.suse/drivers-net-davinci_mdio-fix-potential-NULL-derefere.patch patches.suse/0050-net-atlantic-update-company-name-in-the-driver-descr.patch patches.suse/0051-net-atlantic-add-A2-device-IDs.patch patches.suse/0052-net-atlantic-add-defines-for-10M-and-EEE-100M-link-m.patch @@ -32228,6 +32263,7 @@ patches.suse/Bluetooth-Handle-Inquiry-Cancel-error-after-Inquiry-.patch patches.suse/Bluetooth-L2CAP-add-support-for-waiting-disconnectio.patch patches.suse/sfc-fix-dereference-of-table-before-it-is-null-check.patch + patches.suse/net-dsa-mt7530-set-CPU-port-to-fallback-mode.patch patches.suse/selftests-fix-flower-parent-qdisc.patch patches.suse/r8152-Use-MAC-address-from-device-tree-if-available.patch patches.suse/net-hns3-modify-some-incorrect-spelling.patch @@ -33150,6 +33186,7 @@ patches.suse/nfp-update-indirect-block-support.patch patches.suse/bnxt_tc-update-indirect-block-support.patch patches.suse/net-remove-indirect-block-netdev-event-registration.patch + patches.suse/net-octeon-mgmt-Repair-filling-of-RX-ring.patch patches.suse/net-fec-disable-correct-clk-in-the-err-path-of-fec_enet_clk_enable.patch patches.suse/netfilter-ctnetlink-add-kernel-side-filtering-for-du.patch patches.suse/netfilter-nf_tables-generalise-flowtable-hook-parsin.patch @@ -34325,7 +34362,7 @@ patches.suse/dm-mpath-restrict-queue_if_no_path-state-machine.patch patches.suse/dm-mpath-enhance-queue_if_no_path-debugging.patch patches.suse/dm-mpath-add-DM-device-name-to-Failing-Reinstating-p.patch - patches.suse/dm-crypt-avoid-truncating-the-logical-block-size.patch + patches.suse/0002-dm-crypt-avoid-truncating-the-logical-block-size.patch patches.suse/ext4-fix-EXT_MAX_EXTENT-INDEX-to-check-for-zeroed-eh.patch patches.suse/ext4-Avoid-freeing-inodes-on-dirty-list.patch patches.suse/ext4-fix-error-pointer-dereference.patch @@ -34689,6 +34726,7 @@ patches.suse/cxgb4-Use-kfree-instead-kvfree-where-appropriate.patch patches.suse/rhashtable-Drop-raw-RCU-deref-in-nested_table_free.patch patches.suse/mlxsw-core-Use-different-get_trend-callbacks-for-dif.patch + patches.suse/net-dsa-lantiq_gswip-fix-and-improve-the-unsupported.patch patches.suse/drm-nouveau-disp-gm200-fix-NV_PDISP_SOR_HDMI2_CTRL-n.patch patches.suse/1253-drm-nouveau-kms-gt215-fix-race-with-audio-driver-run.patch patches.suse/1254-drm-nouveau-disp-provide-hint-to-OR-allocation-about.patch @@ -35508,6 +35546,8 @@ patches.suse/net-phylink-ensure-manual-pause-mode-configuration-t.patch patches.suse/openvswitch-take-into-account-de-fragmentation-gso_s.patch patches.suse/qed-add-missing-error-test-for-DBG_STATUS_NO_MATCHIN.patch + patches.suse/net-bcmgenet-re-remove-bcmgenet_hfb_add_filter.patch + patches.suse/net-bcmgenet-use-hardware-padding-of-runt-frames.patch patches.suse/tcp-don-t-ignore-ECN-CWR-on-pure-ACK.patch patches.suse/net-bridge-enfore-alignment-for-ethernet-address.patch patches.suse/netfilter-ipset-fix-unaligned-atomic-access.patch @@ -35881,6 +35921,8 @@ patches.suse/hinic-fix-sending-mailbox-timeout-in-aeq-event-work.patch patches.suse/net-rmnet-fix-lower-interface-leak.patch patches.suse/net-rmnet-do-not-allow-to-add-multiple-bridge-interf.patch + patches.suse/smsc95xx-check-return-value-of-smsc95xx_reset.patch + patches.suse/smsc95xx-avoid-memory-leak-in-smsc95xx_bind.patch patches.suse/net-hns3-check-reset-pending-after-FLR-prepare.patch patches.suse/net-hns3-fix-for-mishandle-of-asserting-VF-reset-fai.patch patches.suse/net-hns3-add-a-missing-uninit-debugfs-when-unload-dr.patch @@ -35925,8 +35967,11 @@ patches.suse/selftests-bpf-Fix-detach-from-sockmap-tests.patch patches.suse/libbpf-Fix-libbpf-hashmap-on-I-LP32-architectures.patch patches.suse/bnxt_en-fix-NULL-dereference-in-case-SR-IOV-configur.patch + patches.suse/net-macb-fix-wakeup-test-in-runtime-suspend-resume-r.patch + patches.suse/net-macb-mark-device-wake-capable-when-magic-packet-.patch patches.suse/net-macb-fix-macb_get-set_wol-when-moving-to-phylink.patch patches.suse/net-macb-fix-macb_suspend-by-removing-call-to-netif_.patch + patches.suse/net-macb-fix-call-to-pm_runtime-in-the-suspend-resum.patch patches.suse/mlxsw-spectrum_router-Remove-inappropriate-usage-of-.patch patches.suse/mlxsw-pci-Fix-use-after-free-in-case-of-failed-devli.patch patches.suse/libnvdimm-security-Fix-key-lookup-permissions.patch @@ -36146,6 +36191,7 @@ patches.suse/net-fec-fix-hardware-time-stamping-by-external-devices.patch patches.suse/net-dp83640-fix-SIOCSHWTSTAMP-to-update-the-struct-w.patch patches.suse/rtnetlink-Fix-memory-net_device-leak-when-newlink-fa.patch + patches.suse/net-smc91x-Fix-possible-memory-leak-in-smc_drv_probe.patch patches.suse/nfc-nci-add-missed-destroy_workqueue-in-nci_register.patch patches.suse/0091-net-atlantic-disable-PTP-on-AQC111-AQC112.patch patches.suse/rhashtable-drop-duplicated-word-in-linux-rhashtable..patch @@ -36176,6 +36222,7 @@ patches.suse/crypto-chtls-correct-net_device-reference-count.patch patches.suse/nfc-s3fwrn5-add-missing-release-on-skb-in-s3fwrn5_re.patch patches.suse/net-sched-act_ct-fix-restore-the-qdisc_skb_cb-after-.patch + patches.suse/net-ag71xx-add-missed-clk_disable_unprepare-in-error.patch patches.suse/udp-Copy-has_conns-in-reuseport_grow.patch patches.suse/udp-Improve-load-balancing-for-SO_REUSEPORT.patch patches.suse/net-sysfs-add-a-newline-when-printing-tx_timeout-by-.patch @@ -36189,6 +36236,7 @@ patches.suse/qed-suppress-don-t-support-RoCE-iWARP-flooding-on-HW.patch patches.suse/qed-suppress-false-positives-interrupt-error-message.patch patches.suse/drivers-net-wan-x25_asy-Fix-to-make-it-work.patch + patches.suse/net-ethernet-ave-Fix-error-returns-in-ave_init.patch patches.suse/enetc-Remove-the-mdio-bus-on-PF-probe-bailout.patch patches.suse/AX.25-Fix-out-of-bounds-read-in-ax25_connect.patch patches.suse/sctp-shrink-stream-outq-only-when-new-outcnt-old-out.patch @@ -36320,9 +36368,11 @@ patches.suse/selftests-bpf-fix-netdevsim-trap_flow_action_cookie-.patch patches.suse/rxrpc-Fix-race-between-recvmsg-and-sendmsg-on-immedi.patch patches.suse/devlink-ignore-EOPNOTSUPP-errors-on-dumpit.patch + patches.suse/net-nixge-fix-potential-memory-leak-in-nixge_probe.patch patches.suse/net-ethernet-mtk_eth_soc-fix-MTU-warnings.patch patches.suse/atm-fix-atm_dev-refcnt-leaks-in-atmtcp_remove_persis.patch patches.suse/ionic-unlock-queue-mutex-in-error-path.patch + patches.suse/net-gemini-Fix-missing-clk_disable_unprepare-in-erro.patch patches.suse/mac80211-fix-warning-in-6-GHz-IE-addition-in-mesh-mo.patch patches.suse/mac80211-mesh-Free-ie-data-when-leaving-mesh.patch patches.suse/mac80211-mesh-Free-pending-skb-when-destroying-a-mpa.patch @@ -36822,6 +36872,7 @@ patches.suse/0005-Documentation-gpu-drm-uapi-eliminate-duplicated-word.patch patches.suse/docs-bpf-index.rst-Add-ringbuf.rst.patch patches.suse/docs-bpf-bpf_devel_QA.rst-fix-reference-to-nonexiste.patch + patches.suse/docs-filesystems-vfs-correct-flag-name.patch patches.suse/nvme-core-use-u16-type-for-directives.patch patches.suse/nvme-core-use-u16-type-for-ctrl-sqsize.patch patches.suse/nvme-pci-use-unsigned-for-io-queue-depth.patch @@ -36878,7 +36929,7 @@ patches.suse/0003-bcache-movinggc-Use-struct_size-helper-in-kzalloc.patch patches.suse/0004-bcache-Use-struct_size-in-kzalloc.patch patches.suse/0005-bcache-avoid-nr_stripes-overflow-in-bcache_device_in.patch - patches.suse/0006-bcache-fix-overflow-in-offset_to_stripe.patch + patches.suse/0003-bcache-fix-overflow-in-offset_to_stripe.patch patches.suse/0007-bcache-add-read_super_common-to-read-major-part-of-s.patch patches.suse/0008-bcache-add-more-accurate-error-information-in-read_s.patch patches.suse/0009-bcache-disassemble-the-big-if-checks-in-bch_cache_se.patch @@ -41506,6 +41557,7 @@ patches.suse/net-nfc-rawsock.c-add-CAP_NET_RAW-check.patch patches.suse/ionic_lif-Use-devm_kcalloc-in-ionic_qcq_alloc.patch patches.suse/net-Fix-potential-memory-leak-in-proto_register.patch + patches.suse/net-phy-marvell10g-fix-null-pointer-dereference.patch patches.suse/net-refactor-bind_bucket-fastreuse-into-helper.patch patches.suse/net-initialize-fastreuse-on-inet_inherit_port.patch patches.suse/sfc-fix-ef100-design-param-checking.patch @@ -42425,8 +42477,9 @@ patches.suse/net-mlx5e-mlx5e_fec_in_caps-returns-a-boolean.patch patches.suse/net-bridge-br_vlan_get_pvid_rcu-should-dereference-t.patch patches.suse/btrfs-fix-overflow-when-copying-corrupt-csums-for-a-.patch - patches.suse/0030-dm-fix-bio-splitting-and-its-bio-completion-order-fo.patch + patches.suse/0004-dm-fix-bio-splitting-and-its-bio-completion-order-fo.patch patches.suse/0031-dm-fix-comment-in-dm_process_bio.patch + patches.suse/0001-dm-crypt-document-new-no_workqueue-flags.patch patches.suse/ALSA-asihpi-fix-iounmap-in-error-handler.patch patches.suse/ALSA-hda-realtek-Couldn-t-detect-Mic-if-booting-with.patch patches.suse/ALSA-hda-realtek-Enable-front-panel-headset-LED-on-L.patch @@ -42890,11 +42943,25 @@ patches.suse/ata-ahci-mvebu-Make-SATA-PHY-optional-for-Armada-372.patch patches.suse/nvmet-fc-fix-missing-check-for-no-hostport-struct.patch patches.suse/nvme-fix-error-handling-in-nvme_ns_report_zones.patch + patches.suse/0002-bcache-check-c-root-with-IS_ERR_OR_NULL-in-mca_reser.patch + patches.suse/0003-bcache-remove-int-n-from-parameter-list-of-bch_bucke.patch + patches.suse/0004-bcache-explicitly-make-cache_set-only-have-single-ca.patch + patches.suse/0005-bcache-remove-for_each_cache.patch + patches.suse/0006-bcache-add-set_uuid-in-struct-cache_set.patch + patches.suse/0007-bcache-only-use-block_bytes-on-struct-cache.patch + patches.suse/0008-bcache-remove-useless-alloc_bucket_pages.patch + patches.suse/0009-bcache-remove-useless-bucket_pages.patch + patches.suse/0010-bcache-only-use-bucket_bytes-on-struct-cache.patch + patches.suse/0011-bcache-don-t-check-seq-numbers-in-register_cache_set.patch + patches.suse/0012-bcache-remove-can_attach_cache.patch + patches.suse/0013-bcache-check-and-set-sync-status-on-cache-s-in-memor.patch + patches.suse/0014-bcache-remove-embedded-struct-cache_sb-from-struct-c.patch patches.suse/scsi-Add-host-and-host-template-flag-host_tagset.patch patches.suse/scsi-core-Show-nr_hw_queues-in-sysfs.patch patches.suse/scsi-scsi_debug-Support-host-tagset.patch patches.suse/0004-md-bitmap-md_bitmap_read_sb-uses-wrong-bitmap-blocks.patch patches.suse/0005-md-bitmap-md_bitmap_get_counter-returns-wrong-blocks.patch + patches.suse/0015-md-fix-the-checking-of-wrong-work-queue.patch patches.suse/0006-md-bitmap-fix-memory-leak-of-temporary-bitmap.patch patches.suse/0022-x86-numa-cleanup-configuration-dependent-command-lin.patch patches.suse/0023-x86-numa-add-nohmat-option.patch @@ -43093,6 +43160,7 @@ patches.suse/xfs-force-the-log-after-remapping-a-synchronous-writ.patch patches.suse/ipmi_si-Fix-wrong-return-value-in-try_smi_init.patch patches.suse/0002-dm-crypt-don-t-use-drivers-that-have-CRYPTO_ALG_ALLO.patch + patches.suse/0016-dm-fix-missing-imposition-of-queue_limits-from-dm_wq.patch patches.suse/scsi-mpt3sas-memset-config_cmds-reply-buffer-with-zeros patches.suse/scsi-mpt3sas-dump-system-registers-for-debugging patches.suse/scsi-mpt3sas-cancel-the-running-work-during-host-reset @@ -43976,6 +44044,7 @@ patches.suse/net-ena-Change-RSS-related-macros-and-variables-name.patch patches.suse/net-ena-Fix-all-static-chekers-warnings.patch patches.suse/mac80211-add-missing-queue-hash-initialization-to-80.patch + patches.suse/can-flexcan-fix-spelling-mistake-reserverd-reserved.patch patches.suse/s390-qeth-don-t-init-refcount-twice-for-mcast-ips patches.suse/s390-qeth-relax-locking-for-ipato-config-data patches.suse/s390-qeth-clean-up-string-ops-in-qeth_l3_parse_ipatoe @@ -43985,7 +44054,26 @@ patches.suse/s390-qeth-consolidate-online-code patches.suse/s390-qeth-consolidate-teardown-code patches.suse/s390-qeth-remove-forward-declarations-in-l2-code + patches.suse/can-flexcan-sort-include-files-alphabetically.patch + patches.suse/can-flexcan-flexcan_exit_stop_mode-remove-stray-empt.patch + patches.suse/can-flexcan-more-register-names.patch + patches.suse/can-flexcan-struct-flexcan_regs-document-registers-n.patch + patches.suse/can-flexcan-quirks-get-rid-of-long-lines.patch + patches.suse/can-flexcan-Ack-wakeup-interrupt-separately.patch + patches.suse/can-flexcan-flexcan_probe-make-regulator-xceiver-opt.patch + patches.suse/can-flexcan-Add-check-for-transceiver-maximum-bitrat.patch + patches.suse/can-flexcan-add-correctable-errors-correction-when-H.patch patches.suse/can-flexcan-flexcan_chip_stop-add-error-handling-and.patch + patches.suse/can-flexcan-disable-clocks-during-stop-mode.patch + patches.suse/can-flexcan-add-LPSR-mode-support.patch + patches.suse/can-flexcan-flexcan_set_bittiming-move-setup-of-CAN-.patch + patches.suse/can-flexcan-use-struct-canfd_frame-for-CAN-classic-f.patch + patches.suse/can-flexcan-add-CAN-FD-mode-support.patch + patches.suse/can-flexcan-add-ISO-CAN-FD-feature-support.patch + patches.suse/can-flexcan-add-CAN-FD-BRS-support.patch + patches.suse/can-flexcan-add-Transceiver-Delay-Compensation-suppo.patch + patches.suse/can-flexcan-add-imx8qm-support.patch + patches.suse/can-flexcan-add-lx2160ar1-support.patch patches.suse/bpf-Avoid-iterating-duplicated-files-for-task_file-i.patch patches.suse/libbpf-Ensure-ELF-symbols-table-is-found-before-furt.patch patches.suse/libbpf-Parse-multi-function-sections-into-multiple-B.patch @@ -44089,6 +44177,9 @@ patches.suse/net-ionic-Remove-WARN_ON-in_interrupt.patch patches.suse/ionic-stop-watchdog-timer-earlier-on-remove.patch patches.suse/ionic-prevent-early-watchdog-check.patch + patches.suse/can-flexcan-initialize-all-flexcan-memory-for-ECC-fu.patch + patches.suse/can-flexcan-add-flexcan-driver-for-i.MX8MP.patch + patches.suse/can-flexcan-disable-runtime-PM-if-register-flexcande.patch patches.suse/bpf-disallow-attaching-modify_return-tracing-functio.patch patches.suse/selftests-Remove-fmod_ret-from-test_overhead.patch patches.suse/xsk-Fix-a-documentation-mistake-in-xsk_queue.h.patch @@ -44149,6 +44240,8 @@ patches.suse/ice-fix-adding-IP4-IP6-Flow-Director-rules.patch patches.suse/can-softing-softing_card_shutdown-add-braces-around-.patch patches.suse/can-c_can-reg_map_-c-d-_can-mark-as-__maybe_unused.patch + patches.suse/dt-bindings-can-flexcan-list-supported-processors.patch + patches.suse/dt-bindings-can-flexcan-remove-ack_grp-and-ack_bit-f.patch patches.suse/can-flexcan-remove-ack_grp-and-ack_bit-handling-from.patch patches.suse/net-smc-consolidate-unlocking-in-same-function patches.suse/net-smc-cleanup-buffer-usage-in-smc_listen_work @@ -44385,6 +44478,8 @@ patches.suse/ubifs-dent-Fix-some-potential-memory-leaks-while-ite.patch patches.suse/ubifs-journal-Make-sure-to-not-dirty-twice-for-auth-.patch patches.suse/mailbox-avoid-timer-start-from-callback.patch + patches.suse/smp-Add-source-and-destination-CPUs-to-__call_single.patch + patches.suse/kernel-smp-Provide-CSD-lock-timeout-diagnostics.patch patches.suse/0015-fuse-fix-page-dereference-after-free.patch patches.suse/xfs-limit-entries-returned-when-counting-fsmap-recor.patch patches.suse/xfs-fix-high-key-handling-in-the-rt-allocator-s-quer.patch @@ -44521,6 +44616,7 @@ patches.suse/msft-hv-2162-KVM-x86-hyper-v-disallow-configuring-SynIC-timers-wi.patch patches.suse/KVM-x86-mmu-Commit-zap-of-remaining-invalid-pages-wh.patch patches.suse/kvm-nvmx-reload-vmcs01-if-getting-vmcs12-s-pages-fails + patches.suse/kvm-x86-add-rip-to-the-kvm_entry-i-e-vm-enter-tracepoint patches.suse/0001-KVM-SVM-Initialize-prev_ga_tag-before-use.patch patches.suse/Convert-trailing-spaces-and-periods-in-path-components.patch patches.suse/cifs-Return-the-error-from-crypt_message-when-enc-dec-key-not-found.patch @@ -44555,6 +44651,7 @@ patches.suse/drm-i915-dp-Tweak-initial-dpcd-backlight.enabled-val.patch patches.suse/drm-i915-gt-Initialize-reserved-and-unspecified-MOCS.patch patches.suse/drm-i915-Mark-ininitial-fb-obj-as-WT-on-eLLC-machine.patch + patches.suse/0001-drm-i915-gem-Support-parsing-of-oversize-batches.patch patches.suse/drm-i915-gt-Delay-execlist-processing-for-tgl.patch patches.suse/drm-i915-gt-Undo-forced-context-restores-after-trivi.patch patches.suse/drm-i915-Use-the-active-reference-on-the-vma-while-c.patch @@ -44712,6 +44809,9 @@ patches.suse/staging-octeon-Drop-on-uncorrectable-alignment-or-FC.patch patches.suse/staging-comedi-cb_pcidas-Allow-2-channel-commands-fo.patch patches.suse/docs-ABI-sysfs-c2port-remove-a-duplicated-entry.patch + patches.suse/coresight-add-module-license.patch + patches.suse/coresight-Fix-uninitialised-pointer-bug-in-etm_setup.patch + patches.suse/coresight-cti-Initialize-dynamic-sysfs-attributes.patch patches.suse/futex-Fix-incorrect-should_fail_futex-handling.patch patches.suse/time-Prevent-undefined-behaviour-in-timespec64_to_ns.patch patches.suse/lib-crc32test-remove-extra-local_irq_disable-enable.patch @@ -44746,6 +44846,8 @@ patches.suse/chelsio-chtls-fix-memory-leaks-caused-by-a-race.patch patches.suse/chelsio-chtls-fix-always-leaking-ctrl_skb.patch patches.suse/xfrm-interface-fix-the-priorities-for-ipip-and-ipv6-.patch + patches.suse/dt-bindings-can-add-can-controller.yaml.patch + patches.suse/dt-bindings-can-flexcan-convert-fsl-flexcan-bindings.patch patches.suse/can-rx-offload-don-t-call-kfree_skb-from-IRQ-context.patch patches.suse/can-dev-can_get_echo_skb-prevent-call-to-kfree_skb-i.patch patches.suse/can-dev-__can_get_echo_skb-fix-real-payload-length-r.patch @@ -44754,6 +44856,8 @@ patches.suse/can-peak_usb-peak_usb_get_ts_time-fix-timestamp-wrap.patch patches.suse/can-peak_canfd-pucan_handle_can_rx-fix-echo-manageme.patch patches.suse/can-flexcan-remove-FLEXCAN_QUIRK_DISABLE_MECR-quirk-.patch + patches.suse/can-flexcan-add-ECC-initialization-for-LX2160A.patch + patches.suse/can-flexcan-add-ECC-initialization-for-VF610.patch patches.suse/can-flexcan-flexcan_remove-disable-wakeup-completely.patch patches.suse/r8169-work-around-short-packet-hw-bug-on-RTL8125.patch patches.suse/ionic-check-port-ptr-before-use.patch @@ -44903,6 +45007,8 @@ patches.suse/pinctrl-amd-use-higher-precision-for-512-RtcClk.patch patches.suse/pinctrl-intel-Fix-2-kOhm-bias-which-is-833-Ohm.patch patches.suse/pinctrl-intel-Set-default-bias-in-case-no-particular.patch + patches.suse/dt-bindings-can-fsl-flexcan.yaml-fix-fsl-stop-mode.patch + patches.suse/dt-bindings-can-fsl-flexcan.yaml-fix-compatible-for-.patch patches.suse/xfs-fix-flags-argument-to-rmap-lookup-when-convertin.patch patches.suse/xfs-set-the-unwritten-bit-in-rmap-lookup-flags-in-xc.patch patches.suse/xfs-fix-rmap-key-and-record-comparison-functions.patch @@ -44978,6 +45084,7 @@ patches.suse/can-mcba_usb-mcba_usb_start_xmit-first-fill-skb-then.patch patches.suse/can-peak_usb-fix-potential-integer-overflow-on-shift.patch patches.suse/can-flexcan-flexcan_setup_stop_mode-add-missing-req_.patch + patches.suse/can-flexcan-fix-failure-handling-of-pm_runtime_get_s.patch patches.suse/can-m_can-m_can_handle_state_change-fix-state-change.patch patches.suse/can-m_can-m_can_stop-set-device-to-software-init-mod.patch patches.suse/bnxt_en-read-EEPROM-A2h-address-using-page-0.patch @@ -44998,6 +45105,7 @@ patches.suse/net-mlx5-E-Switch-Fail-mlx5_esw_modify_vport_rate-if.patch patches.suse/net-mlx4_core-Fix-init_hca-fields-offset.patch patches.suse/can-kvaser_usb-kvaser_usb_hydra-Fix-KCAN-bittiming-l.patch + patches.suse/can-flexcan-flexcan_chip_start-fix-erroneous-flexcan.patch patches.suse/net-smc-fix-matching-of-existing-link-groups patches.suse/net-smc-fix-direct-access-to-ib_gid_addr-ndev-in-smc_ib_determine_gid patches.suse/libbpf-Don-t-attempt-to-load-unused-subprog-as-an-en.patch @@ -45237,6 +45345,7 @@ patches.suse/drm-rockchip-Avoid-uninitialized-use-of-endpoint-id-.patch patches.suse/drm-panel-sony-acx565akm-Fix-race-condition-in-probe.patch patches.suse/drm-omap-sdi-fix-bridge-enable-disable.patch + patches.suse/0017-dm-fix-double-RCU-unlock-in-dm_dax_zero_page_range-e.patch patches.suse/msft-hv-2173-scsi-storvsc-Fix-error-return-in-storvsc_probe.patch patches.suse/powerpc-64s-Fix-hash-ISA-v3.0-TLBIEL-instruction-gen.patch patches.suse/powerpc-64s-pseries-Fix-hash-tlbiel_all_isa300-for-g.patch @@ -45338,12 +45447,15 @@ patches.suse/drm-panfrost-Support-cache-coherent-integrations.patch patches.suse/drm-panfrost-Don-t-corrupt-the-queue-mutex-on-open-c.patch patches.suse/drm-panfrost-Remove-unused-variables-in-panfrost_job.patch + patches.suse/drm-virtio-use-kvmalloc-for-large-allocations.patch patches.suse/drm-bridge-tpd12s015-Fix-irq-registering-in-tpd12s01.patch patches.suse/drm-edid-Fix-uninitialized-variable-in-drm_cvt_modes.patch patches.suse/drm-bridge-sii902x-Refactor-init-code-into-separate-.patch patches.suse/drm-bridge-sii902x-Enable-I-O-and-core-VCC-supplies-.patch patches.suse/drm-panel-simple-Add-flags-to-boe_nv133fhm_n61.patch patches.suse/drm-i915-tgl-Fix-Combo-PHY-DPLL-fractional-divider-f.patch + patches.suse/drm-amdgpu-disable-DCN-and-VCN-for-Navi14-0x7340-C9-.patch + patches.suse/drm-amdgpu-rename-nv_is_headless_sku.patch patches.suse/drm-amd-display-remove-useless-if-else.patch patches.suse/drm-amdgpu-fix-incorrect-enum-type.patch patches.suse/drm-amdgpu-fix-build_coefficients-argument.patch @@ -45361,6 +45473,7 @@ patches.suse/drm-msm-dpu-Add-newline-to-printks.patch patches.suse/drm-msm-dsi_pll_10nm-restore-VCO-rate-during-restore.patch patches.suse/drm-msm-dsi_phy_10nm-implement-PHY-disabling.patch + patches.suse/drm-amdgpu-enable-DCN-for-navi10-headless-SKU.patch patches.suse/drm-amdgpu-fix-compute-queue-priority-if-num_kcq-is-.patch patches.suse/drm-amdkfd-Put-ACPI-table-after-using-it.patch patches.suse/drm-amd-display-Update-dram_clock_change_latency-for.patch @@ -45423,8 +45536,10 @@ patches.suse/crypto-qat-allow-for-instances-in-different-banks.patch patches.suse/crypto-qat-extend-ae_mask.patch patches.suse/crypto-af_alg-avoid-undefined-behavior-accessing-sal.patch + patches.suse/crypto-arm64-poly1305-neon-reorder-PAC-authenticatio.patch patches.suse/crypto-qat-remove-unneeded-semicolon.patch patches.suse/crypto-caam-fix-printing-on-xts-fallback-allocation-error-path.patch + patches.suse/crypto-Kconfig-CRYPTO_MANAGER_EXTRA_TESTS-requires-t.patch patches.suse/crypto-qat-remove-cast-for-mailbox-CSR.patch patches.suse/crypto-qat-replace-pci-with-PCI-in-comments.patch patches.suse/crypto-qat-support-for-mof-format-in-fw-loader.patch @@ -45497,7 +45612,9 @@ patches.suse/clocksource-drivers-cadence_ttc-Fix-memory-leak-in-t.patch patches.suse/clocksource-drivers-arm_arch_timer-Use-stable-count-.patch patches.suse/clocksource-drivers-arm_arch_timer-Correct-fault-pro.patch + patches.suse/sched-Reenable-interrupts-in-do_sched_yield.patch patches.suse/sched-fair-Check-for-idle-core-in-wake_affine.patch + patches.suse/cpuset-fix-race-between-hotplug-work-and-later-cpu-offline.patch patches.suse/x86-apic-fix-x2apic-enablement-without-interrupt-remapping.patch patches.suse/0003-x86-msi-Only-use-high-bits-of-MSI-address-for-DMAR-u.patch patches.suse/0004-x86-apic-uv-Fix-inconsistent-destination-mode.patch @@ -45560,6 +45677,15 @@ patches.suse/ibmvnic-Correctly-re-enable-interrupts-in-NAPI-polli.patch patches.suse/ibmvnic-Use-netdev_alloc_skb-instead-of-alloc_skb-to.patch patches.suse/ibmvnic-Do-not-replenish-RX-buffers-after-every-poll.patch + patches.suse/dt-bindings-can-fsl-flexcan-add-uint32-reference-to-.patch + patches.suse/dt-bindings-can-fsl-flexcan-fix-fsl-clk-source-prope.patch + patches.suse/dt-bindings-firmware-add-IMX_SC_R_CAN-x-macro-for-CA.patch + patches.suse/can-flexcan-rename-macro-FLEXCAN_QUIRK_SETUP_STOP_MO.patch + patches.suse/can-flexcan-factor-out-enabling-and-disabling-of-int.patch + patches.suse/can-flexcan-move-enabling-disabling-of-interrupts-fr.patch + patches.suse/can-flexcan-flexcan_rx_offload_setup-factor-out-mail.patch + patches.suse/can-flexcan-flexcan_open-completely-initialize-contr.patch + patches.suse/can-flexcan-flexcan_close-change-order-if-commands-t.patch patches.suse/i40e-remove-redundant-assignment.patch patches.suse/net-sched-fix-miss-init-the-mru-in-qdisc_skb_cb.patch patches.suse/net-smc-use-helper-smc_conn_abort-in-listen-processing @@ -45607,6 +45733,7 @@ patches.suse/Bluetooth-Fix-attempting-to-set-RPA-timeout-when-uns.patch patches.suse/Bluetooth-btusb-Fix-detection-of-some-fake-CSR-contr.patch patches.suse/ibmvnic-fix-rx-buffer-tracking-and-index-management-.patch + patches.suse/can-flexcan-convert-the-driver-to-DT-only.patch patches.suse/nl80211-validate-key-indexes-for-cfg80211_registered.patch patches.suse/mac80211-don-t-set-set-TDLS-STA-bandwidth-wider-than.patch patches.suse/mwifiex-Fix-possible-buffer-overflows-in-mwifiex_2.patch @@ -45819,6 +45946,16 @@ patches.suse/driver-core-Fix-list-corruption-after-device_del.patch patches.suse/slimbus-qcom-ngd-ctrl-Avoid-sending-power-requests-w.patch patches.suse/coresight-etm4x-Skip-setting-LPOVERRIDE-bit-for-qcom.patch + patches.suse/coresight-core-Remove-unneeded-semicolon.patch + patches.suse/coresight-etm4x-Fix-accesses-to-TRCVMIDCTLR1.patch + patches.suse/coresight-etm4x-Fix-accesses-to-TRCCIDCTLR1.patch + patches.suse/coresight-etm4x-Update-TRCIDR3.NUMPROCS-handling-to-.patch + patches.suse/coresight-etm4x-Fix-accesses-to-TRCPROCSELR.patch + patches.suse/coresight-etm4x-Handle-TRCVIPCSSCTLR-accesses.patch + patches.suse/coresight-Remove-unnecessary-THIS_MODULE-of-funnel-a.patch + patches.suse/coresight-tmc-etf-Fix-NULL-ptr-dereference-in-tmc_en.patch + patches.suse/coresight-etb10-Fix-possible-NULL-ptr-dereference-in.patch + patches.suse/coresight-tmc-etr-Assign-boolean-values-to-a-bool-va.patch patches.suse/soundwire-bus-add-comments-to-explain-interrupt-loop.patch patches.suse/soundwire-bus-reset-slave_notify-status-at-each-loop.patch patches.suse/soundwire-registers-add-definitions-for-clearable-in.patch @@ -45827,7 +45964,9 @@ patches.suse/soundwire-qcom-Fix-build-failure-when-slimbus-is-mod.patch patches.suse/soundwire-master-use-pm_runtime_set_active-on-add.patch patches.suse/soundwire-intel-fix-another-unused-function-warning.patch + patches.suse/coresight-etm4x-Modify-core-commit-to-avoid-HiSilico.patch patches.suse/phy-tegra-Don-t-warn-on-probe-deferral.patch + patches.suse/phy-tegra-xusb-Fix-usb_phy-device-driver-field.patch patches.suse/speakup-fix-uninitialized-flush_lock.patch patches.suse/misc-vmw_vmci-fix-kernel-info-leak-by-initializing-d.patch patches.suse/bus-fsl-mc-add-back-accidentally-dropped-error-check.patch @@ -45920,7 +46059,31 @@ patches.suse/PCI-Fix-pci_slot_release-NULL-pointer-dereference.patch patches.suse/PCI-Fix-overflow-in-command-line-resource-alignment-.patch patches.suse/PCI-brcmstb-Initialize-tmp-before-use.patch + patches.suse/PCI-dwc-Support-multiple-ATU-memory-regions.patch + patches.suse/PCI-of-Warn-if-non-prefetchable-memory-aperture-size.patch + patches.suse/PCI-dwc-Add-support-to-program-ATU-for-4GB-memory.patch + patches.suse/PCI-dwc-intel-gw-Move-ATU-offset-out-of-driver-match.patch + patches.suse/PCI-dwc-Move-dbi-dbi2-and-addr_space-resource-setup-.patch + patches.suse/PCI-dwc-intel-gw-Remove-some-unneeded-function-wrapp.patch + patches.suse/PCI-dwc-Ensure-all-outbound-ATU-windows-are-reset.patch + patches.suse/PCI-dwc-dra7xx-Use-the-common-MSI-irq_chip.patch + patches.suse/PCI-dwc-Drop-the-.set_num_vectors-host-op.patch + patches.suse/PCI-dwc-Move-MSI-interrupt-setup-into-DWC-common-cod.patch + patches.suse/PCI-dwc-Rework-MSI-initialization.patch + patches.suse/PCI-dwc-Move-link-handling-into-common-code.patch + patches.suse/PCI-dwc-Move-dw_pcie_msi_init-into-core.patch + patches.suse/PCI-dwc-Remove-unnecessary-wrappers-around-dw_pcie_h.patch + patches.suse/PCI-dwc-Move-inbound-and-outbound-windows-to-common-.patch + patches.suse/PCI-dwc-Detect-number-of-iATU-windows.patch + patches.suse/PCI-tegra-Move-dbi-accesses-to-post-common-DWC-initi.patch + patches.suse/PCI-tegra-Read-dbi-base-address-to-program-in-applic.patch + patches.suse/PCI-tegra-Fix-ASPM-L1SS-advertisement-disable-code.patch + patches.suse/PCI-tegra-Set-DesignWare-IP-version.patch + patches.suse/PCI-tegra-Continue-unconfig-sequence-even-if-parts-f.patch + patches.suse/PCI-tegra-Check-return-value-of-tegra_pcie_init_cont.patch + patches.suse/PCI-tegra-Disable-LTSSM-during-L2-entry.patch patches.suse/PCI-iproc-Fix-out-of-bound-array-accesses.patch + patches.suse/PCI-keystone-Enable-compile-testing-on-ARM.patch patches.suse/remoteproc-q6v5-mss-fix-error-handling-in-q6v5_pds_e.patch patches.suse/remoteproc-qcom-fix-reference-leak-in-adsp_start.patch patches.suse/remoteproc-qcom-Fix-potential-NULL-dereference-in-ad.patch @@ -45950,6 +46113,7 @@ patches.suse/md-fix-a-warning-caused-by-a-race-between-concurrent.patch patches.suse/0007-md-cluster-block-reshape-with-remote-resync-job.patch patches.suse/0008-md-cluster-fix-deadlock-when-node-is-doing-resync-jo.patch + patches.suse/0018-bcache-fix-race-between-setting-bdev-state-to-none-a.patch patches.suse/scsi-Remove-unneeded-break-statements.patch patches.suse/scsi-lpfc-Fix-invalid-sleeping-context-in-lpfc_sli4_.patch patches.suse/scsi-lpfc-Fix-scheduling-call-while-in-softirq-conte.patch @@ -46057,6 +46221,8 @@ patches.suse/RDMA-rtrs-clt-Missing-error-from-rtrs_rdma_conn_esta.patch patches.suse/RDMA-rtrs-srv-Don-t-guard-the-whole-__alloc_srv-with.patch patches.suse/RDMA-rtrs-srv-Fix-typo.patch + patches.suse/RDMA-rtrs-Remove-unnecessary-argument-dir-of-rtrs_iu.patch + patches.suse/RDMA-rtrs-Introduce-rtrs_post_send.patch patches.suse/RDMA-cma-Add-missing-error-handling-of-listen_id.patch patches.suse/RDMA-cma-Fix-deadlock-on-lock-in-rdma_cma_listen_on_.patch patches.suse/RDMA-hns-Bugfix-for-calculation-of-extended-sge.patch @@ -46250,7 +46416,11 @@ patches.suse/x86-enumerate-avx512-fp16-cpuid-feature-flag.patch patches.suse/kvm-x86-expose-avx512_fp16-for-supported-cpuid.patch patches.suse/clk-fsl-sai-fix-memory-leak.patch + patches.suse/clk-qoriq-provide-constants-for-the-type.patch + patches.suse/dt-bindings-clock-document-the-fsl-flexspi-clk-devic.patch + patches.suse/clk-fsl-flexspi-new-driver.patch patches.suse/clk-tegra-Do-not-return-0-on-failure.patch + patches.suse/clk-tegra-bpmp-Clamp-clock-rates-on-requests.patch patches.suse/clk-tegra-Fix-duplicated-SE-clock-entry.patch patches.suse/clk-mediatek-Make-mtk_clk_register_mux-a-static-func.patch patches.suse/clk-ti-Fix-memleak-in-ti_fapll_synth_setup.patch @@ -46261,6 +46431,7 @@ patches.suse/clk-sunxi-ng-Make-sure-divider-tables-have-sentinel.patch patches.suse/clk-mvebu-a3700-fix-the-XTAL-MODE-pin-to-MPP1_9.patch patches.suse/exfat-Avoid-allocating-upcase-table-using-kcalloc.patch + patches.suse/0019-dm-remove-unnecessary-current-bio_list-check-when-su.patch patches.suse/ACPI-PNP-compare-the-string-length-in-the-matching_i.patch patches.suse/watchdog-armada_37xx-Add-missing-dependency-on-HAS_I.patch patches.suse/watchdog-sirfsoc-Add-missing-dependency-on-HAS_IOMEM.patch @@ -46288,6 +46459,8 @@ patches.suse/s390-dasd-prevent-inconsistent-lcu-device-data patches.suse/s390-dasd-fix-list-corruption-of-pavgroup-group-list patches.suse/s390-dasd-fix-list-corruption-of-lcu-list + patches.suse/0020-bcache-remove-a-superfluous-check-in-register_bcache.patch + patches.suse/0021-md-bcache-convert-comma-to-semicolon.patch patches.suse/powerpc-smp-Add-__init-to-init_big_cores.patch patches.suse/ext4-fix-a-memory-leak-of-ext4_free_data.patch patches.suse/ext4-fix-deadlock-with-fs-freezing-and-EA-inodes.patch @@ -46296,6 +46469,7 @@ patches.suse/crypto-qat-add-CRYPTO_AES-to-Kconfig-dependencies.patch patches.suse/ntb-idt-fix-error-check-in-ntb_hw_idt.c.patch patches.suse/ntb-intel-add-Intel-NTB-LTR-vendor-support-for-gen4-.patch + patches.suse/cgroup-fix-memory-leak-when-parsing-multiple-source-parameters.patch patches.suse/lib-genalloc-fix-the-overflow-when-size-is-too-big.patch patches.suse/lib-zlib-fix-inflating-zlib-streams-on-s390 patches.suse/zlib-move-export_symbol-and-module_license-out-of-dfltcc_syms-c @@ -46428,6 +46602,11 @@ patches.suse/usb-gadget-enable-super-speed-plus.patch patches.suse/usb-typec-Fix-copy-paste-error-for-NVIDIA-alt-mode-d.patch patches.suse/blk-mq-debugfs-Add-decode-for-BLK_MQ_F_TAG_HCTX_SHAR.patch + patches.suse/0022-bcache-set-pdev_set_uuid-before-scond-loop-iteration.patch + patches.suse/0023-bcache-fix-typo-from-SUUP-to-SUPP-in-features.h.patch + patches.suse/0024-bcache-check-unsupported-feature-sets-for-bcache-reg.patch + patches.suse/0025-bcache-introduce-BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCK.patch + patches.suse/0026-bcache-set-bcache-device-into-read-only-mode-for-BCH.patch patches.suse/msft-hv-2201-x86-hyperv-Fix-kexec-panic-hang-issues.patch patches.suse/tracing-kprobes-do-the-notrace-functions-check-without-kprobes-on-ftrace.patch patches.suse/target-fix-XCOPY-NAA-identifier-lookup.patch @@ -46577,6 +46756,7 @@ patches.suse/0001-nvme-tcp-avoid-request-double-completion-for-concurr.patch patches.suse/regulator-core-avoid-regulator_resolve_supply-race-c.patch patches.suse/regulator-Fix-lockdep-warning-resolving-supplies.patch + patches.suse/kvm-tracing-fix-unmatched-kvm_entry-and-kvm_exit-events patches.suse/ALSA-hda-realtek-Enable-headset-of-ASUS-B1400CEPE-wi.patch patches.suse/ALSA-pcm-One-more-dependency-for-hw-constraints.patch patches.suse/ALSA-usb-audio-workaround-for-iface-reset-issue.patch @@ -46671,6 +46851,7 @@ patches.suse/PM-hibernate-flush-swap-writer-after-marking.patch patches.suse/s390-dasd-fix-inconsistent-kobject-removal patches.suse/nbd-freeze-the-queue-while-we-re-adding-connections.patch + patches.suse/0027-bcache-only-check-feature-sets-when-sb-version-BCACH.patch patches.suse/nvme-multipath-Early-exit-if-no-path-is-available.patch patches.suse/ACPI-IORT-Do-not-blindly-trust-DMA-masks-from-firmwa.patch patches.suse/s390-vfio-ap-clean-up-vfio_ap-resources-when-kvm-pointer-invalidated @@ -46739,11 +46920,15 @@ patches.suse/squashfs-add-more-sanity-checks-in-inode-lookup.patch patches.suse/squashfs-add-more-sanity-checks-in-xattr-id-lookup.patch patches.suse/firmware_loader-align-.builtin_fw-to-8.patch + patches.suse/NET-usb-qmi_wwan-Adding-support-for-Cinterion-MV31.patch patches.suse/netback-avoid-race-in-xenvif_rx_ring_slots_avail.patch patches.suse/net-gro-do-not-keep-too-many-GRO-packets-in-napi-rx_.patch patches.suse/mt76-dma-fix-a-possible-memory-leak-in-mt76_add_frag.patch patches.suse/ibmvnic-Clear-failover_pending-if-unable-to-schedule.patch patches.suse/net-hns3-add-a-check-for-queue_id-in-hclge_reset_vf_.patch + patches.suse/bpf-Fix-verifier-jsgt-branch-analysis-on-max-bound.patch + patches.suse/bpf-Fix-verifier-jmp32-pruning-decision-logic.patch + patches.suse/bpf-Fix-32-bit-src-register-truncation-on-div-mod.patch patches.suse/dmaengine-idxd-Fix-list-corruption-in-description-co.patch patches.suse/dmaengine-idxd-fix-misc-interrupt-completion.patch patches.suse/dmaengine-move-channel-device_node-deletion-to-drive.patch @@ -46755,14 +46940,21 @@ patches.suse/drm-i915-tgl-Make-sure-TypeC-FIA-is-powered-up-when-.patch patches.suse/0001-drm-i915-Fix-overlay-frontbuffer-tracking.patch patches.suse/0002-drm-vc4-hvs-Fix-buffer-overflow-with-the-dlist-handl.patch + patches.suse/drm-xlnx-fix-kmemleak-by-sending-vblank_event-in-ato.patch patches.suse/0001-drm-dp_mst-Don-t-report-ports-connected-if-nothing-i.patch patches.suse/0003-drm-sun4i-tcon-set-sync-polarity-for-tcon1-channel.patch patches.suse/0004-drm-sun4i-dw-hdmi-always-set-clock-rate.patch patches.suse/0005-drm-sun4i-Fix-H6-HDMI-PHY-configuration.patch patches.suse/0006-drm-sun4i-dw-hdmi-Fix-max.-frequency-for-H6.patch patches.suse/i2c-stm32f7-fix-configuration-of-the-digital-filter.patch + patches.suse/cgroup-v1-add-disabled-controller-check-in-cgroup1_parse_param.patch + patches.suse/cgroup-fix-psi-monitor-for-root-cgroup.patch patches.suse/clk-sunxi-ng-mp-fix-parent-rate-change-flag-check.patch patches.suse/x86-pci-Create-PCI-MSI-irqdomain-after-x86_init.pci..patch + patches.suse/dt-bindings-can-fsl-flexcan-add-fsl-scu-index-proper.patch + patches.suse/bus-fsl-mc-return-EPROBE_DEFER-when-a-device-is-not-.patch + patches.suse/r8169-improve-DASH-support.patch + patches.suse/bpf-Add-bpf_patch_call_args-prototype-to-include-lin.patch patches.suse/net-netdevice-Add-operation-ndo_sk_get_lower_dev.patch patches.suse/net-bonding-Take-IP-hash-logic-into-a-helper.patch patches.suse/net-bonding-Implement-ndo_sk_get_lower_dev.patch @@ -46772,7 +46964,9 @@ patches.suse/net-tls-Device-offload-to-use-lowest-netdevice-in-ch.patch patches.suse/net-tls-Except-bond-interface-from-some-TLS-checks.patch patches.suse/vmxnet3-Remove-buf_info-from-device-accessible-struc.patch + patches.suse/r8169-Add-support-for-another-RTL8168FP.patch patches.suse/ath10k-Fix-error-handling-in-case-of-CE-pipe-init-fa.patch + patches.suse/ice-log-message-when-trusted-VF-goes-in-out-of-promi.patch patches.suse/xen-netback-fix-spurious-event-detection-for-common-.patch patches.suse/Bluetooth-btqcomsmd-Fix-a-resource-leak-in-error-han.patch patches.suse/Bluetooth-btusb-Always-fallback-to-alt-1-for-WBS.patch @@ -46781,7 +46975,10 @@ patches.suse/Bluetooth-hci_qca-Fix-memleak-in-qca_controller_memd.patch patches.suse/Bluetooth-drop-HCI-device-reference-before-return.patch patches.suse/Bluetooth-Put-HCI-device-if-inquiry-procedure-interr.patch + patches.suse/Bluetooth-btusb-fix-memory-leak-on-suspend-and-resum.patch + patches.suse/Bluetooth-Add-new-HCI_QUIRK_NO_SUSPEND_NOTIFIER-quir.patch patches.suse/Bluetooth-btusb-Fix-memory-leak-in-btusb_mtk_wmt_rec.patch + patches.suse/Bluetooth-btusb-Some-Qualcomm-Bluetooth-adapters-sto.patch patches.suse/mt76-mt7915-fix-endianness-warning-in-mt7915_mcu_set.patch patches.suse/ath10k-Fix-suspicious-RCU-usage-warning-in-ath10k_wm.patch patches.suse/ath10k-Fix-lockdep-assertion-warning-in-ath10k_sta_s.patch @@ -46789,7 +46986,24 @@ patches.suse/mac80211-fix-potential-overflow-when-multiplying-to-.patch patches.suse/ibmvnic-simplify-reset_long_term_buff-function.patch patches.suse/ibmvnic-substitute-mb-with-dma_wmb-for-send_-crq-fun.patch + patches.suse/libbpf-Ignore-non-function-pointer-member-in-struct_.patch + patches.suse/bpf-devmap-Use-GFP_KERNEL-for-xdp-bulk-queue-allocat.patch + patches.suse/bpf-Clear-subreg_def-for-global-function-return-valu.patch patches.suse/ibmvnic-Set-to-CLOSED-state-even-on-error.patch + patches.suse/bnxt_en-Fix-devlink-info-s-stored-fw.psid-version-fo.patch + patches.suse/net-mlx5e-E-switch-Fix-rate-calculation-for-overflow-0e22bfb7.patch + patches.suse/net-mlx5e-Enable-striding-RQ-for-Connect-X-IPsec-cap.patch + patches.suse/net-mlx5e-Enable-XDP-for-Connect-X-IPsec-capable-dev.patch + patches.suse/net-mlx5e-Change-interrupt-moderation-channel-params.patch + patches.suse/net-mlx5e-Replace-synchronize_rcu-with-synchronize_n.patch + patches.suse/net-mlx5e-Fix-CQ-params-of-ICOSQ-and-async-ICOSQ.patch + patches.suse/net-mlx5e-kTLS-Use-refcounts-to-free-kTLS-RX-priv-co.patch + patches.suse/net-mlx5-Disable-devlink-reload-for-multi-port-slave.patch + patches.suse/net-mlx5-Disallow-RoCE-on-multi-port-slave-device.patch + patches.suse/net-mlx5-Disallow-RoCE-on-lag-device.patch + patches.suse/net-mlx5-Disable-devlink-reload-for-lag-devices.patch + patches.suse/selftests-bpf-Convert-test_xdp_redirect.sh-to-bash.patch + patches.suse/bpf-Fix-truncation-handling-for-mod32-dst-reg-wrt-ze.patch patches.suse/ibmvnic-change-IBMVNIC_MAX_IND_DESCS-to-16.patch patches.suse/b43-N-PHY-Fix-the-update-of-coef-for-the-PHY-revisio.patch patches.suse/r8169-fix-resuming-from-suspend-on-RTL8105e-if-machi.patch @@ -46805,10 +47019,18 @@ patches.suse/usb-dwc2-Abort-transaction-after-errors-with-unknown.patch patches.suse/usb-dwc2-Make-trimming-xfer-length-a-debug-message.patch patches.suse/usb-musb-Fix-runtime-PM-race-in-musb_queue_resume_wo.patch + patches.suse/usb-dwc3-gadget-Fix-setting-of-DEPCFG.bInterval_m1.patch + patches.suse/usb-dwc3-gadget-Fix-dep-interval-for-fullspeed-inter.patch + patches.suse/USB-quirks-sort-quirk-entries.patch patches.suse/USB-serial-mos7720-improve-OOM-handling-in-read_mos_.patch patches.suse/USB-serial-mos7840-fix-error-code-in-mos7840_write.patch patches.suse/USB-serial-mos7720-fix-error-code-in-mos7720_write.patch + patches.suse/USB-serial-ftdi_sio-fix-FTX-sub-integer-prescaler.patch + patches.suse/USB-serial-option-update-interface-mapping-for-ZTE-P.patch + patches.suse/usb-quirks-add-quirk-to-start-video-capture-on-ELMO-.patch patches.suse/staging-rtl8723bs-wifi_regd.c-Fix-incorrect-number-o.patch + patches.suse/staging-rtl8188eu-Add-Edimax-EW-7811UN-V2-to-device-.patch + patches.suse/staging-gdm724x-Fix-DMA-from-stack.patch patches.suse/cpufreq-brcmstb-avs-cpufreq-Free-resources-in-error-.patch patches.suse/cpufreq-brcmstb-avs-cpufreq-Fix-resource-leaks-in-re.patch patches.suse/ACPICA-Fix-exception-code-class-checks.patch @@ -46822,8 +47044,17 @@ patches.suse/xfs-fix-an-ABBA-deadlock-in-xfs_rename.patch patches.suse/xfs-reduce-quota-reservation-when-doing-a-dax-unwrit.patch patches.suse/ata-ahci_brcm-Add-back-regulators-management.patch + patches.suse/0028-bcache-consider-the-fragmentation-when-update-the-wr.patch + patches.suse/0029-bcache-Fix-register_device_aync-typo.patch + patches.suse/0030-Revert-bcache-Kill-btree_io_wq.patch + patches.suse/0031-bcache-Give-btree_io_wq-correct-semantics-again.patch + patches.suse/0032-bcache-Move-journal-work-to-new-flush-wq.patch + patches.suse/0033-bcache-Avoid-comma-separated-statements.patch patches.suse/nvme-hwmon-rework-to-avoid-devm-allocation.patch patches.suse/mm-proc-Invalidate-TLB-after-clearing-soft-dirty-pag.patch + patches.suse/rcu-Pull-deferred-rcuog-wake-up-to-rcu_eqs_enter-cal.patch + patches.suse/rcu-nocb-Perform-deferred-wake-up-before-last-idle-s.patch + patches.suse/rcu-nocb-Trigger-self-IPI-on-late-deferred-wake-up-b.patch patches.suse/0001-Xen-x86-don-t-bail-early-from-clear_foreign_p2m_mapp.patch patches.suse/0002-Xen-x86-also-check-kernel-mapping-in-set_foreign_p2m.patch patches.suse/0003-Xen-gntdev-correct-dev_bus_addr-handling-in-gntdev_m.patch @@ -46833,6 +47064,7 @@ patches.suse/0007-xen-netback-don-t-handle-error-by-BUG.patch patches.suse/0008-xen-scsiback-don-t-handle-error-by-BUG.patch patches.suse/0009-xen-blkback-fix-error-handling-in-xen_blkbk_map.patch + patches.suse/msft-hv-2226-Drivers-hv-vmbus-Avoid-use-after-free-in-vmbus_onoff.patch patches.suse/mtd-parser-imagetag-fix-error-codes-in-bcm963xx_pars.patch patches.suse/mtd-parsers-afs-Fix-freeing-the-part-name-memory-in-.patch patches.suse/mtd-spi-nor-hisi-sfc-Put-child-node-np-on-error-path.patch @@ -46850,6 +47082,7 @@ patches.suse/media-tm6000-Fix-memleak-in-tm6000_start_stream.patch patches.suse/media-pwc-Use-correct-device-for-DMA.patch patches.suse/media-aspeed-fix-error-return-code-in-aspeed_video_s.patch + patches.suse/media-mceusb-Fix-potential-out-of-bounds-shift.patch patches.suse/media-software_node-Fix-refcounts-in-software_node_g.patch patches.suse/media-lmedm04-Fix-misuse-of-comma.patch patches.suse/media-qm1d1c0042-fix-error-return-code-in-qm1d1c0042.patch @@ -46884,9 +47117,13 @@ patches.suse/ASoC-rt5682-Fix-panic-in-rt5682_jack_detect_handler-.patch patches.suse/ASoC-SOF-debug-Fix-a-potential-issue-on-string-buffe.patch patches.suse/ASoC-SOF-sof-pci-dev-add-missing-Up-Extreme-quirk.patch + patches.suse/ASoC-Intel-bytcr_rt5640-Add-new-BYT_RT5640_NO_SPEAKE.patch patches.suse/ASoC-cs42l56-fix-up-error-handling-in-probe.patch patches.suse/ASoC-qcom-qdsp6-Move-frontend-AIFs-to-q6asm-dai.patch + patches.suse/ASoC-Intel-sof-sdw-indent-and-add-quirks-consistentl.patch + patches.suse/ASoC-Intel-sof_sdw-detect-DMIC-number-based-on-mach-.patch patches.suse/ASoC-simple-card-utils-Fix-device-module-clock.patch + patches.suse/fbdev-aty-SPARC64-requires-FB_ATY_CT.patch patches.suse/drm-gma500-Fix-error-return-code-in-psb_driver_load.patch patches.suse/gma500-clean-up-error-handling-in-init.patch patches.suse/drm-fb-helper-Add-missed-unlocks-in-setcmap_legacy.patch @@ -46898,8 +47135,11 @@ patches.suse/drm-virtio-make-sure-context-is-created-in-gem-open.patch patches.suse/drm-fourcc-fix-Amlogic-format-modifier-masks.patch patches.suse/drm-sun4i-tcon-fix-inverted-DCLK-polarity.patch + patches.suse/drm-modes-Switch-to-64bit-maths-to-avoid-integer-ove.patch + patches.suse/drm-sched-Cancel-and-flush-all-outstanding-jobs-befo.patch patches.suse/drm-amdgpu-toggle-on-DF-Cstate-after-finishing-xgmi-.patch patches.suse/drm-i915-gt-One-more-flush-for-Baytrail-clear-residu.patch + patches.suse/drm-nouveau-kms-handle-mDP-connectors.patch patches.suse/drm-mediatek-Check-if-fb-is-null.patch patches.suse/drm-amd-display-Fix-10-12-bpc-setup-in-DCE-output-bi.patch patches.suse/drm-amd-display-Fix-HDMI-deep-color-output-for-DCE-6.patch @@ -46912,7 +47152,11 @@ patches.suse/drm-dp_mst-Don-t-cache-EDIDs-for-physical-ports.patch patches.suse/drm-amdgpu-cleanup-struct-amdgpu_ring.patch patches.suse/drm-amdgpu-display-remove-hdcp_srm-sysfs-on-device-r.patch + patches.suse/drm-amd-display-Add-FPU-wrappers-to-dcn21_validate_b.patch + patches.suse/drm-amdkfd-Fix-recursive-lock-warnings.patch + patches.suse/drm-amdgpu-Set-reference-clock-to-100Mhz-on-Renoir-v.patch patches.suse/drm-i915-gt-Flush-before-changing-register-state.patch + patches.suse/drm-i915-Reject-446-480MHz-HDMI-clock-on-GLK.patch patches.suse/drm-i915-gt-Correct-surface-base-address-for-renderc.patch patches.suse/ima-Free-IMA-measurement-buffer-on-error.patch patches.suse/ima-Free-IMA-measurement-buffer-after-kexec-syscall.patch @@ -46922,6 +47166,10 @@ patches.suse/KEYS-trusted-Fix-incorrect-handling-of-tpm_get_rando.patch patches.suse/KEYS-trusted-Fix-migratable-1-failing.patch patches.suse/KEYS-trusted-Reserve-TPM-for-seal-and-unseal-operati.patch + patches.suse/crypto-qat-replace-CRYPTO_AES-with-CRYPTO_LIB_AES-in.patch + patches.suse/crypto-aesni-prevent-misaligned-buffers-on-the-stack.patch + patches.suse/crypto-bcm-Rename-struct-device_private-to-bcm_devic.patch + patches.suse/crypto-arm64-sha-add-missing-module-aliases.patch patches.suse/crypto-talitos-Work-around-SEC6-ERRATA-AES-CTR-mode-.patch patches.suse/hwrng-timeriomem-Fix-cooldown-period-calculation.patch patches.suse/crypto-ecdh_helper-Ensure-len-secret.len-in-decode_k.patch @@ -46935,6 +47183,8 @@ patches.suse/mmc-sdhci-sprd-Fix-some-resource-leaks-in-the-remove.patch patches.suse/mmc-usdhi6rol0-Fix-a-resource-leak-in-the-error-hand.patch patches.suse/mmc-renesas_sdhi_internal_dmac-Fix-DMA-buffer-alignm.patch + patches.suse/mmc-sdhci-esdhc-imx-fix-kernel-panic-when-remove-mod.patch + patches.suse/watchdog-mei_wdt-request-stop-on-unregister.patch patches.suse/regulator-axp20x-Fix-reference-cout-leak.patch patches.suse/regulator-s5m8767-Fix-reference-count-leak.patch patches.suse/regulator-s5m8767-Drop-regulators-OF-node-reference.patch @@ -47002,29 +47252,143 @@ patches.suse/scsi-ibmvfc-Enable-MQ-and-set-reasonable-defaults.patch patches.suse/scsi-ibmvfc-Provide-modules-parameters-for-MQ-settin.patch patches.suse/scsi-ibmvfc-Fix-spelling-mistake-succeded-succeeded.patch + patches.suse/RDMA-rtrs-Extend-ibtrs_cq_qp_create.patch + patches.suse/RDMA-rtrs-srv-Release-lock-before-call-into-close_se.patch + patches.suse/RDMA-rtrs-srv-Use-sysfs_remove_file_self-for-disconn.patch + patches.suse/RDMA-rtrs-clt-Set-mininum-limit-when-create-QP.patch + patches.suse/RDMA-rtrs-srv-Jump-to-dereg_mr-label-if-allocate-iu-.patch + patches.suse/RDMA-rtrs-Call-kobject_put-in-the-failure-path.patch + patches.suse/RDMA-rtrs-srv-Fix-missing-wr_cqe.patch + patches.suse/RDMA-rtrs-clt-Refactor-the-failure-cases-in-alloc_cl.patch + patches.suse/RDMA-rtrs-Do-not-signal-for-heatbeat.patch + patches.suse/RDMA-rtrs-clt-Use-bitmask-to-check-sess-flags.patch + patches.suse/RDMA-rtrs-srv-Do-not-signal-REG_MR.patch + patches.suse/RDMA-rtrs-srv-Init-wr_cnt-as-1.patch + patches.suse/RDMA-rtrs-Fix-KASAN-stack-out-of-bounds-bug.patch patches.suse/RDMA-bnxt_re-Code-refactor-while-populating-user-MRs.patch patches.suse/RDMA-bnxt_re-Allow-bigger-MR-creation.patch + patches.suse/RDMA-mlx5-Allow-creating-all-QPs-even-when-non-RDMA-.patch + patches.suse/RDMA-hns-Fix-type-of-sq_signal_bits.patch + patches.suse/RDMA-hns-Disable-RQ-inline-by-default.patch + patches.suse/RDMA-ucma-Fix-use-after-free-bug-in-ucma_create_ueve.patch + patches.suse/RDMA-rtrs-srv-Fix-stack-out-of-bounds.patch + patches.suse/RDMA-rtrs-Only-allow-addition-of-path-to-an-already-.patch + patches.suse/RDMA-rtrs-srv-fix-memory-leak-by-missing-kobject-fre.patch + patches.suse/RDMA-rtrs-srv-sysfs-fix-missing-put_device.patch + patches.suse/RDMA-rtrs-srv-Do-not-pass-a-valid-pointer-to-PTR_ERR.patch + patches.suse/printk-fix-deadlock-when-kernel-panic.patch patches.suse/lib-vsprintf-no_hash_pointers-prints-all-addresses-a.patch + patches.suse/quota-Fix-memory-leak-when-handling-corrupted-quota-.patch + patches.suse/ceph-fix-flush_snap-logic-after-putting-caps.patch patches.suse/clocksource-drivers-ixp4xx-Select-TIMER_OF-when-need.patch patches.suse/clocksource-drivers-mxs_timer-Add-missing-semicolon-.patch patches.suse/amba-Fix-resource-leak-for-drivers-without-.remove.patch patches.suse/powerpc-perf-hv-24x7-Dont-create-sysfs-event-files-f.patch + patches.suse/powerpc-pseries-eeh-Make-pseries_pcibios_bus_add_dev.patch + patches.suse/powerpc-pseries-ras-Make-init_ras_hotplug_IRQ-static.patch + patches.suse/powerpc-optprobes-Remove-unused-routine-patch_imm32_.patch patches.suse/powerpc-prom-Fix-ibm-arch-vec-5-platform-support-sca.patch + patches.suse/powerpc-Fix-build-error-in-paravirt.h.patch patches.suse/powerpc-pseries-dlpar-handle-ibm-configure-connector.patch patches.suse/powerpc-kexec_file-fix-FDT-size-estimation-for-kdump.patch + patches.suse/objtool-fix-error-handling-for-std-cld-warnings.patch + patches.suse/objtool-fix-retpoline-detection-in-asm-code.patch + patches.suse/objtool-fix-cold-section-suffix-check-for-newer-versions-of-gcc.patch + patches.suse/HID-wacom-Ignore-attempts-to-overwrite-the-touch_max.patch + patches.suse/HID-core-detect-and-skip-invalid-inputs-to-snto32.patch + patches.suse/HID-make-arrays-usage-and-value-to-be-the-same.patch + patches.suse/Input-xpad-add-support-for-PowerA-Enhanced-Wired-Con.patch + patches.suse/Input-raydium_ts_i2c-do-not-send-zero-length.patch + patches.suse/Input-sur40-fix-an-error-code-in-sur40_probe.patch + patches.suse/Input-elo-fix-an-error-code-in-elo_connect.patch + patches.suse/Input-joydev-prevent-potential-read-overflow-in-ioct.patch + patches.suse/Input-i8042-add-ASUS-Zenbook-Flip-to-noselftest-list.patch + patches.suse/dmaengine-fsldma-Fix-a-resource-leak-in-the-remove-f.patch + patches.suse/dmaengine-fsldma-Fix-a-resource-leak-in-an-error-han.patch + patches.suse/dmaengine-owl-dma-Fix-a-resource-leak-in-the-remove-.patch + patches.suse/dmaengine-hsu-disable-spurious-interrupt.patch patches.suse/dmaengine-idxd-set-DMA-channel-to-be-private.patch patches.suse/keys-Remove-outdated-__user-annotations.patch + patches.suse/certs-Fix-blacklist-flag-type-confusion.patch + patches.suse/misc-eeprom_93xx46-Fix-module-alias-to-enable-module.patch + patches.suse/bus-fsl-mc-add-missing-__iomem-attribute.patch + patches.suse/misc-eeprom_93xx46-Add-module-alias-to-avoid-breakin.patch + patches.suse/VMCI-Use-set_page_dirty_lock-when-unregistering-gues.patch + patches.suse/virt-vbox-Do-not-use-wait_event_interruptible-when-c.patch + patches.suse/bus-fsl-mc-move-fsl_mc_command-struct-in-a-uapi-head.patch + patches.suse/bus-fsl-mc-export-mc_cmd_hdr_read_cmdid-to-the-fsl-m.patch + patches.suse/bus-fsl-mc-add-fsl-mc-userspace-support.patch + patches.suse/bus-fsl-mc-add-bus-rescan-attribute.patch + patches.suse/bus-fsl-mc-add-autorescan-sysfs.patch + patches.suse/mei-hbm-call-mei_set_devstate-on-hbm-stop-response.patch + patches.suse/random-fix-the-RNDRESEEDCRNG-ioctl.patch + patches.suse/coresight-etm4x-Skip-accessing-TRCPDCR-in-save-resto.patch + patches.suse/misc-rtsx-init-of-rts522a-add-OCP-power-off-when-no-.patch + patches.suse/soundwire-debugfs-use-controller-id-instead-of-link_.patch + patches.suse/soundwire-cadence-fix-ACK-NAK-handling.patch + patches.suse/soundwire-bus-use-sdw_update_no_pm-when-initializing.patch + patches.suse/soundwire-bus-use-sdw_write_no_pm-when-setting-the-b.patch + patches.suse/soundwire-export-sdw_write-read_no_pm-functions.patch + patches.suse/soundwire-bus-fix-confusion-on-device-used-by-pm_run.patch + patches.suse/bus-fsl-mc-Fix-test-for-end-of-loop.patch + patches.suse/drivers-misc-vmw_vmci-restrict-too-big-queue-size-in.patch + patches.suse/phy-rockchip-emmc-emmc_phy_init-always-return-0.patch + patches.suse/regmap-sdw-use-_no_pm-functions-in-regmap_read-write.patch + patches.suse/PCI-Decline-to-resize-resources-if-boot-config-must-.patch + patches.suse/PCI-Align-checking-of-syscall-user-config-accessors.patch + patches.suse/PCI-qcom-Use-PHY_REFCLK_USE_PAD-only-for-ipq8064.patch + patches.suse/PCI-rockchip-Make-ep-gpios-DT-property-optional.patch + patches.suse/wireguard-selftests-test-multiple-parallel-streams.patch + patches.suse/wireguard-device-do-not-generate-ICMP-for-non-IP-pac.patch + patches.suse/wireguard-kconfig-use-arm-chacha-even-with-no-neon.patch + patches.suse/ice-report-correct-max-number-of-TCs.patch + patches.suse/ice-Set-trusted-VF-as-default-VSI-when-setting-allmu.patch + patches.suse/ice-Fix-state-bits-on-LLDP-mode-switch.patch + patches.suse/ice-update-the-number-of-available-RSS-queues.patch + patches.suse/ibmvnic-fix-a-race-between-open-and-reset.patch + patches.suse/r8169-fix-jumbo-packet-handling-on-RTL8168e.patch + patches.suse/drm-msm-dsi-Correct-io_start-for-MSM8994-20nm-PHY.patch + patches.suse/drm-msm-mdp5-Fix-wait-for-commit-for-cmd-panels.patch + patches.suse/drm-msm-Fix-race-of-GPU-init-vs-timestamp-power-mana.patch + patches.suse/drm-msm-Fix-races-managing-the-OOB-state-for-timesta.patch + patches.suse/drm-rockchip-Require-the-YTR-modifier-for-AFBC.patch + patches.suse/drm-panel-kd35t133-allow-using-non-continuous-dsi-cl.patch + patches.suse/drm-amd-display-Add-vupdate_no_lock-interrupts-for-D.patch + patches.suse/drm-amd-display-Remove-Assert-from-dcn10_get_dig_fro.patch + patches.suse/pwm-rockchip-rockchip_pwm_probe-Remove-superfluous-c.patch + patches.suse/cifs-fix-nodfs-mount-option.patch + patches.suse/cifs-check-all-path-components-in-resolved-dfs-target.patch + patches.suse/cifs-introduce-helper-for-finding-referral-server.patch + patches.suse/i2c-brcmstb-Fix-brcmstd_send_i2c_cmd-condition.patch + patches.suse/i2c-exynos5-Preserve-high-speed-master-code.patch + patches.suse/ALSA-usb-audio-Don-t-abort-even-if-the-clock-rate-di.patch + patches.suse/ALSA-usb-audio-Drop-bogus-dB-range-in-too-low-level.patch + patches.suse/ALSA-usb-audio-Allow-modifying-parameters-with-succe.patch + patches.suse/ALSA-ctxfi-cthw20k2-fix-mask-on-conf-to-allow-4-bits.patch + patches.suse/ALSA-hda-realtek-Enable-headset-mic-of-Acer-SWIFT-wi.patch + patches.suse/ALSA-usb-audio-use-Corsair-Virtuoso-mapping-for-Cors.patch + patches.suse/ALSA-hda-intel-nhlt-verify-config-type.patch + patches.suse/ALSA-hda-realtek-Add-quirk-for-Clevo-NH55RZQ.patch + patches.suse/ALSA-hda-realtek-Add-quirk-for-Intel-NUC-10.patch + patches.suse/ALSA-hda-realtek-Apply-dual-codec-quirks-for-MSI-God.patch patches.suse/Xen-gnttab-handle-p2m-update-errors-on-a-per-slot-ba.patch patches.suse/xen-netback-respect-gnttab_map_refs-s-return-value.patch patches.suse/scsi-iscsi-restrict-sessions-and-handles-to-admin-capabilities patches.suse/scsi-iscsi-ensure-sysfs-attributes-are-limited-to-page_size patches.suse/scsi-iscsi-verify-lengths-on-passthrough-pdus + patches.suse/drm-amdgpu-disable-VCN-for-Navi12-SKU.patch + patches.suse/ACPI-bus-Constify-is_acpi_node-and-friends-part-2.patch + patches.suse/PM-runtime-Update-device-status-before-letting-suppl.patch + patches.suse/rsxx-Return-EFAULT-if-copy_to_user-fails.patch patches.suse/powerpc-pseries-Don-t-enforce-MSI-affinity-with-kdum.patch patches.suse/powerpc-sstep-Fix-VSX-instruction-emulation.patch + patches.suse/gpiolib-acpi-Add-ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER-qui.patch + patches.suse/gpiolib-acpi-Allow-to-find-GpioInt-resource-by-name-.patch patches.suse/ibmvnic-remove-excessive-irqsave.patch + patches.suse/r8169-fix-r8168fp_adjust_ocp_cmd-function.patch # netdev/net - patches.suse/ibmvnic-fix-a-race-between-open-and-reset.patch + patches.suse/ibmvnic-Fix-possibly-uninitialized-old_num_tx_queues.patch patches.suse/ibmvnic-always-store-valid-MAC-address.patch # out-of-tree patches @@ -47063,10 +47427,22 @@ patches.suse/nvme-fc-avoid-calling-_nvme_fc_abort_outstanding_ios-from-interrupt-context.patch patches.suse/cifs-set_root_ses-ipc.patch patches.suse/edac-amd64-do-not-load-on-family-0x15-model-0x13.patch - patches.suse/powerpc-Fix-build-error-in-paravirt.h.patch patches.suse/floppy-reintroduce-O_NDELAY-fix.patch patches.suse/powerpc-pseries-extract-host-bridge-from-pci_bus-pri.patch patches.suse/mm-pmem-avoid-inserting-hugepage-pte-entry-with-fsdax-if-hugepage-support-is-disabled.patch + patches.suse/btrfs-free-correct-amount-of-space-in-btrfs_delayed_inode_reserve_metadata.patch + patches.suse/btrfs-don-t-flush-from-btrfs_delayed_inode_reserve_metadata.patch + patches.suse/btrfs-cleanup-try_flush_qgroup.patch + patches.suse/btrfs-remove-btrfs_inode-from-btrfs_delayed_inode_reserve_metadata.patch + patches.suse/btrfs-simplify-code-flow-in-btrfs_delayed_inode_reserve_metadata.patch + patches.suse/btrfs-unlock-extents-in-btrfs_zero_range-in-case-of-errors.patch + patches.suse/kernel-smp-add-boot-parameter-for-controlling-CSD.patch + patches.suse/kernel-smp-prepare-more-CSD-lock-debugging.patch + patches.suse/kernel-smp-add-more-data-to-CSD-lock-debugging.patch + patches.suse/ALSA-usb-Add-Plantronics-C320-M-USB-ctrl-msg-delay-q.patch + patches.suse/ALSA-usb-audio-Disable-USB-autosuspend-properly-in-s.patch + patches.suse/ALSA-usb-audio-Fix-cannot-get-freq-eq-errors-on-Dell.patch + patches.suse/ALSA-usb-audio-Apply-the-control-quirk-to-Plantronic.patch patches.suse/PCI-RCEC-Add-RCEC-class-code-and-extended-capability.patch patches.suse/PCI-RCEC-Bind-RCEC-devices-to-the-Root-Port-driver.patch @@ -47093,6 +47469,10 @@ patches.suse/0003-arm64-ima-add-ima_arch-support.patch patches.suse/ahci-Add-Intel-Emmitsburg-PCH-RAID-PCI-IDs.patch patches.suse/ahci-Add-support-for-Dell-S140-and-later.patch + patches.suse/drm-amdgpu-display-simplify-backlight-setting.patch + patches.suse/drm-amdgpu-display-don-t-assert-in-set-backlight-fun.patch + patches.suse/drm-amdgpu-display-handle-aux-backlight-in-backlight.patch + patches.suse/drm-amd-display-Add-a-backlight-module-option.patch ######################################################## # kbuild/module infrastructure fixes @@ -47467,21 +47847,6 @@ patches.suse/PCI-IOV-Mark-VFs-as-not-implementing-PCI_COMMAND_MEM.patch patches.suse/vfio-pci-Decouple-PCI_COMMAND_MEMORY-bit-checks-from.patch - # Coresight - patches.suse/coresight-add-module-license.patch - patches.suse/coresight-cti-Initialize-dynamic-sysfs-attributes.patch - patches.suse/coresight-Fix-uninitialised-pointer-bug-in-etm_setup.patch - patches.suse/coresight-core-Remove-unneeded-semicolon.patch - patches.suse/coresight-etm4x-Fix-accesses-to-TRCVMIDCTLR1.patch - patches.suse/coresight-etm4x-Fix-accesses-to-TRCCIDCTLR1.patch - patches.suse/coresight-etm4x-Update-TRCIDR3.NUMPROCS-handling-to-.patch - patches.suse/coresight-etm4x-Fix-accesses-to-TRCPROCSELR.patch - patches.suse/coresight-etm4x-Handle-TRCVIPCSSCTLR-accesses.patch - patches.suse/coresight-Remove-unnecessary-THIS_MODULE-of-funnel-a.patch - patches.suse/coresight-tmc-etf-Fix-NULL-ptr-dereference-in-tmc_en.patch - patches.suse/coresight-etb10-Fix-possible-NULL-ptr-dereference-in.patch - patches.suse/coresight-tmc-etr-Assign-boolean-values-to-a-bool-va.patch - #RPi4 firmware drivers patches.suse/clk-bcm-rpi-release-firmware-handle-on-unbind.patch patches.suse/firmware-raspberrypi-introduce-devm_rpi_firmware_get.patch @@ -47498,48 +47863,10 @@ patches.suse/drm-v3d-add-support-for-bcm2711.patch patches.suse/soc-bcm-bcm2835-pm-add-support-for-bcm2711.patch - # DWC PCIe - patches.suse/PCI-of-Warn-if-non-prefetchable-memory-aperture-size.patch - patches.suse/PCI-dwc-Add-support-to-program-ATU-for-4GB-memory.patch - patches.suse/PCI-dwc-Support-multiple-ATU-memory-regions.patch - patches.suse/PCI-keystone-Enable-compile-testing-on-ARM.patch - patches.suse/PCI-dwc-intel-gw-Move-ATU-offset-out-of-driver-match.patch - patches.suse/PCI-dwc-Move-dbi-dbi2-and-addr_space-resource-setup-.patch - patches.suse/PCI-dwc-intel-gw-Remove-some-unneeded-function-wrapp.patch - patches.suse/PCI-dwc-Ensure-all-outbound-ATU-windows-are-reset.patch - patches.suse/PCI-dwc-dra7xx-Use-the-common-MSI-irq_chip.patch - patches.suse/PCI-dwc-Drop-the-.set_num_vectors-host-op.patch - patches.suse/PCI-dwc-Move-MSI-interrupt-setup-into-DWC-common-cod.patch - patches.suse/PCI-dwc-Rework-MSI-initialization.patch - patches.suse/PCI-dwc-Move-link-handling-into-common-code.patch - patches.suse/PCI-dwc-Move-dw_pcie_msi_init-into-core.patch - patches.suse/PCI-dwc-Remove-unnecessary-wrappers-around-dw_pcie_h.patch - patches.suse/PCI-dwc-Move-inbound-and-outbound-windows-to-common-.patch - patches.suse/PCI-dwc-Detect-number-of-iATU-windows.patch - patches.suse/PCI-tegra-Move-dbi-accesses-to-post-common-DWC-initi.patch - patches.suse/PCI-tegra-Read-dbi-base-address-to-program-in-applic.patch - patches.suse/PCI-tegra-Fix-ASPM-L1SS-advertisement-disable-code.patch - patches.suse/PCI-tegra-Set-DesignWare-IP-version.patch - patches.suse/PCI-tegra-Continue-unconfig-sequence-even-if-parts-f.patch - patches.suse/PCI-tegra-Check-return-value-of-tegra_pcie_init_cont.patch - patches.suse/PCI-tegra-Disable-LTSSM-during-L2-entry.patch - - patches.suse/clk-tegra-bpmp-Clamp-clock-rates-on-requests.patch - patches.suse/phy-tegra-xusb-Fix-usb_phy-device-driver-field.patch - # Media patches.suse/media-dvb-usb-Fix-memory-leak-at-error-in-dvb_usb_de.patch patches.suse/media-dvb-usb-Fix-use-after-free-access.patch - # NXP restool supprot - patches.suse/bus-fsl-mc-add-missing-__iomem-attribute.patch - patches.suse/bus-fsl-mc-return-EPROBE_DEFER-when-a-device-is-not-.patch - patches.suse/bus-fsl-mc-move-fsl_mc_command-struct-in-a-uapi-head.patch - patches.suse/bus-fsl-mc-export-mc_cmd_hdr_read_cmdid-to-the-fsl-m.patch - patches.suse/bus-fsl-mc-add-fsl-mc-userspace-support.patch - patches.suse/bus-fsl-mc-add-bus-rescan-attribute.patch - patches.suse/bus-fsl-mc-add-autorescan-sysfs.patch - ######################################################## # Debugging ######################################################## diff --git a/supported.conf b/supported.conf index 1b2e78d..ff2c622 100644 --- a/supported.conf +++ b/supported.conf @@ -462,6 +462,7 @@ drivers/char/xillybus/* drivers/clk/bcm/clk-bcm2711-dvp drivers/clk/bcm/clk-raspberrypi + drivers/clk/clk-fsl-flexspi drivers/clk/clk-max77686 # Jetson AGX Xavier drivers/clk/clk-plldig # NXP LS1028A drivers/clk/clk-rk808