From 2786c8b5d1f882556fa2a0633c30b438a5c87937 Mon Sep 17 00:00:00 2001 From: Davidlohr Bueso Date: May 04 2021 16:43:28 +0000 Subject: Merge branch 'SLE15-SP2' (ba3c2e92ac74) into 'SLE15-SP2-RT' No -rt specific changes this merge. --- diff --git a/blacklist.conf b/blacklist.conf index 5940332..5f64a49 100644 --- a/blacklist.conf +++ b/blacklist.conf @@ -330,8 +330,6 @@ d3ef5536274faf89e626276b833be122a16bdb81 # reverted by 10c70d95c0f2 ("block: rem cb6b771b05c3026a85ed4817c1b87c5e6f41d136 # reverted by 10c70d95c0f2 ("block: remove the bd_openers checks in blk_drop_partitions") 10c70d95c0f2f9a6f52d0e33243d2877370cef51 # reverts previous commits: d3ef5536274f ("block: fix busy device checking in blk_drop_partitions") and cb6b771b05c3 ("block: fix busy device checking in blk_drop_partitions again") 34719de919af07682861cb0fa2bcf64da33ecf44 # cannot change into module -37b4100180641968056cb4e034cebc38338e8652 # fixes something we didn't apply -671ffde1752f594c60ccdfd75378defacfaf7c83 # we don't support XSPI mode 88743470668ef5eb6b7ba9e0f99888e5999bf172 # 32-bit only 55e8c8eb2c7b6bf30e99423ccfe7ca032f498f59 # Needs extra dependency, historical/theoretical bug c4e0f3b240041bf504e3a25e300eadb88f6a68eb # sparse fix only @@ -570,3 +568,14 @@ dd926880da8dbbe409e709c1d3c1620729a94732 # commit message says "does not affect 66c1b6d74cd7035e85c426f0af4aede19e805c8a # not really needed define move 163f0ec1df33cf468509ff38cbcbb5eb0d7fac60 # debug patch for syzbot eb363edace688898956b99e48daa8d7e05cee795 # dts patch +d09845e98a05850a8094ea8fd6dd09a8e6824fff # designed to alter kABI +5a35b040d0567f9dce6e801e6e3b575b9c463028 # breaks kABI +d17d9227c332b7deca59b35fa9ff08e597666c2a # cosmetic fix +9f12bebd512c560e9e667a6ac3cf0e04d9d7f43e # fixes a compiler warning only +9cec1d547cb739f8bac2de833487116e0fe896d2 # fixes a compiler warning only +505623a2be48b36de533951ced130876a76a2d55 # 6ce898593705 applied +58a91d96d0bfdcbed7f9795220e42e02ed3f2f89 # prerequisites break kABI +60a707d0c99aff4eadb7fd334c5fd21df386723e # kuap/uaccess fixes not applicable to SP2 code +7d506ca97b665b95e698a53697dad99fae813c1a # kuap/uaccess fixes not applicable to SP2 code +de4ffc653f370e56d74994ae5247e39a100b4ff7 # kuap/uaccess fixes not applicable to SP2 code +8524e2e76441fc615a3b5c1415823e051cc79eae # kuap/uaccess fixes not applicable to SP2 code diff --git a/patches.kabi/reintroduce-cqhci_suspend-for-kABI.patch b/patches.kabi/reintroduce-cqhci_suspend-for-kABI.patch new file mode 100644 index 0000000..28b4769 --- /dev/null +++ b/patches.kabi/reintroduce-cqhci_suspend-for-kABI.patch @@ -0,0 +1,53 @@ +From 2581b9a2377ae411392ebdf56fbccb9eaed3b3d6 Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Thu, 29 Apr 2021 11:20:25 +0200 +Subject: [PATCH] reintroduce cqhci_suspend for kABI +Patch-mainline: Never, kABI fixup +References: git-fixes + +Basically undo the patch introducing deactivate() +and duplicating the symbol. + +Signed-off-by: Oliver Neukum +--- + drivers/mmc/host/cqhci.c | 7 +++++++ + drivers/mmc/host/cqhci.h | 5 +---- + 2 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/drivers/mmc/host/cqhci.c b/drivers/mmc/host/cqhci.c +index 2d65b32d2..a879a2fb1 100644 +--- a/drivers/mmc/host/cqhci.c ++++ b/drivers/mmc/host/cqhci.c +@@ -1148,6 +1148,13 @@ int cqhci_init(struct cqhci_host *cq_host, struct mmc_host *mmc, + } + EXPORT_SYMBOL(cqhci_init); + ++int cqhci_suspend(struct mmc_host *mmc) ++{ ++ return cqhci_deactivate(mmc); ++} ++ ++EXPORT_SYMBOL(cqhci_suspend); ++ + MODULE_AUTHOR("Venkat Gopalakrishnan "); + MODULE_DESCRIPTION("Command Queue Host Controller Interface driver"); + MODULE_LICENSE("GPL v2"); +diff --git a/drivers/mmc/host/cqhci.h b/drivers/mmc/host/cqhci.h +index 437700179..e062b42ad 100644 +--- a/drivers/mmc/host/cqhci.h ++++ b/drivers/mmc/host/cqhci.h +@@ -231,10 +231,7 @@ irqreturn_t cqhci_irq(struct mmc_host *mmc, u32 intmask, int cmd_error, + int cqhci_init(struct cqhci_host *cq_host, struct mmc_host *mmc, bool dma64); + struct cqhci_host *cqhci_pltfm_init(struct platform_device *pdev); + int cqhci_deactivate(struct mmc_host *mmc); +-static inline int cqhci_suspend(struct mmc_host *mmc) +-{ +- return cqhci_deactivate(mmc); +-} ++int cqhci_suspend(struct mmc_host *mmc); + int cqhci_resume(struct mmc_host *mmc); + + #endif +-- +2.26.2 + diff --git a/patches.suse/0001-btrfs-track-qgroup-released-data-in-own-variable-in-.patch b/patches.suse/0001-btrfs-track-qgroup-released-data-in-own-variable-in-.patch new file mode 100644 index 0000000..76fa6ad --- /dev/null +++ b/patches.suse/0001-btrfs-track-qgroup-released-data-in-own-variable-in-.patch @@ -0,0 +1,77 @@ +From fbf48bb0b197e6894a04c714728c952af7153bf3 Mon Sep 17 00:00:00 2001 +From: Qu Wenruo +Date: Wed, 3 Mar 2021 18:41:51 +0800 +Patch-mainline: v5.12-rc4 +Git-commit: fbf48bb0b197e6894a04c714728c952af7153bf3 +References: bsc#1185549 +Subject: [PATCH 1/2] btrfs: track qgroup released data in own variable in + insert_prealloc_file_extent + +There is a piece of weird code in insert_prealloc_file_extent(), which +looks like: + + ret = btrfs_qgroup_release_data(inode, file_offset, len); + if (ret < 0) + return ERR_PTR(ret); + if (trans) { + ret = insert_reserved_file_extent(trans, inode, + file_offset, &stack_fi, + true, ret); + ... + } + extent_info.is_new_extent = true; + extent_info.qgroup_reserved = ret; + ... + +Note how the variable @ret is abused here, and if anyone is adding code +just after btrfs_qgroup_release_data() call, it's super easy to +overwrite the @ret and cause tons of qgroup related bugs. + +Fix such abuse by introducing new variable @qgroup_released, so that we +won't reuse the existing variable @ret. + +Signed-off-by: Qu Wenruo +Reviewed-by: David Sterba +Signed-off-by: David Sterba +--- + fs/btrfs/inode.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +--- a/fs/btrfs/inode.c ++++ b/fs/btrfs/inode.c +@@ -10476,6 +10476,7 @@ static struct btrfs_trans_handle *insert + struct btrfs_path *path; + u64 start = ins->objectid; + u64 len = ins->offset; ++ int qgroup_released; + int ret; + + memset(&stack_fi, 0, sizeof(stack_fi)); +@@ -10488,13 +10489,14 @@ static struct btrfs_trans_handle *insert + btrfs_set_stack_file_extent_compression(&stack_fi, BTRFS_COMPRESS_NONE); + /* Encryption and other encoding is reserved and all 0 */ + +- ret = btrfs_qgroup_release_data(inode, file_offset, len); +- if (ret < 0) +- return ERR_PTR(ret); ++ qgroup_released = btrfs_qgroup_release_data(inode, file_offset, len); ++ if (qgroup_released < 0) ++ return ERR_PTR(qgroup_released); + + if (trans) { + ret = insert_reserved_file_extent(trans, inode, +- file_offset, &stack_fi, ret); ++ file_offset, &stack_fi, ++ qgroup_released); + if (ret) + return ERR_PTR(ret); + return trans; +@@ -10507,7 +10509,7 @@ static struct btrfs_trans_handle *insert + extent_info.file_offset = file_offset; + extent_info.extent_buf = (char *)&stack_fi; + extent_info.is_new_extent = true; +- extent_info.qgroup_reserved = ret; ++ extent_info.qgroup_reserved = qgroup_released; + extent_info.insertions = 0; + + path = btrfs_alloc_path(); diff --git a/patches.suse/0002-btrfs-fix-qgroup-data-rsv-leak-caused-by-falloc-fail.patch b/patches.suse/0002-btrfs-fix-qgroup-data-rsv-leak-caused-by-falloc-fail.patch new file mode 100644 index 0000000..e978487 --- /dev/null +++ b/patches.suse/0002-btrfs-fix-qgroup-data-rsv-leak-caused-by-falloc-fail.patch @@ -0,0 +1,129 @@ +From a3ee79bd8fe17812d2305ccc4bf81bfeab395576 Mon Sep 17 00:00:00 2001 +From: Qu Wenruo +Date: Wed, 3 Mar 2021 18:41:52 +0800 +Patch-mainline: v5.12-rc4 +Git-commit: a3ee79bd8fe17812d2305ccc4bf81bfeab395576 +References: bsc#1185549 +Subject: [PATCH 2/2] btrfs: fix qgroup data rsv leak caused by falloc failure + +[BUG] +When running fsstress with only falloc workload, and a very low qgroup +limit set, we can get qgroup data rsv leak at unmount time. + + BTRFS warning (device dm-0): qgroup 0/5 has unreleased space, type 0 rsv 20480 + BTRFS error (device dm-0): qgroup reserved space leaked + +The minimal reproducer looks like: + + #!/bin/bash + dev=/dev/test/test + mnt="/mnt/btrfs" + fsstress=~/xfstests-dev/ltp/fsstress + runtime=8 + + workload() + { + umount $dev &> /dev/null + umount $mnt &> /dev/null + mkfs.btrfs -f $dev > /dev/null + mount $dev $mnt + + btrfs quota en $mnt + btrfs quota rescan -w $mnt + btrfs qgroup limit 16m 0/5 $mnt + + $fsstress -w -z -f creat=10 -f fallocate=10 -p 2 -n 100 \ + -d $mnt -v > /tmp/fsstress + + umount $mnt + if dmesg | grep leak ; then + echo "!!! FAILED !!!" + exit 1 + fi + } + + for (( i=0; i < $runtime; i++)); do + echo "=== $i/$runtime===" + workload + done + +Normally it would fail before round 4. + +[CAUSE] +In function insert_prealloc_file_extent(), we first call +btrfs_qgroup_release_data() to know how many bytes are reserved for +qgroup data rsv. + +Then use that @qgroup_released number to continue our work. + +But after we call btrfs_qgroup_release_data(), we should either queue +@qgroup_released to delayed ref or free them manually in error path. + +Unfortunately, we lack the error handling to free the released bytes, +leaking qgroup data rsv. + +All the error handling function outside won't help at all, as we have +released the range, meaning in inode io tree, the EXTENT_QGROUP_RESERVED +bit is already cleared, thus all btrfs_qgroup_free_data() call won't +free any data rsv. + +[FIX] +Add free_qgroup tag to manually free the released qgroup data rsv. + +Reported-by: Nikolay Borisov +Reported-by: David Sterba +Fixes: 9729f10a608f ("btrfs: inode: move qgroup reserved space release to the callers of insert_reserved_file_extent()") +CC: stable@vger.kernel.org # 5.10+ +Signed-off-by: Qu Wenruo +Signed-off-by: David Sterba +--- + fs/btrfs/inode.c | 24 +++++++++++++++++++----- + 1 file changed, 19 insertions(+), 5 deletions(-) + +--- a/fs/btrfs/inode.c ++++ b/fs/btrfs/inode.c +@@ -10498,7 +10498,7 @@ static struct btrfs_trans_handle *insert + file_offset, &stack_fi, + qgroup_released); + if (ret) +- return ERR_PTR(ret); ++ goto free_qgroup; + return trans; + } + +@@ -10513,17 +10513,31 @@ static struct btrfs_trans_handle *insert + extent_info.insertions = 0; + + path = btrfs_alloc_path(); +- if (!path) +- return ERR_PTR(-ENOMEM); ++ if (!path) { ++ ret = -ENOMEM; ++ goto free_qgroup; ++ } + + ret = btrfs_replace_file_extents(inode, path, file_offset, + file_offset + len - 1, &extent_info, + &trans); + btrfs_free_path(path); + if (ret) +- return ERR_PTR(ret); +- ++ goto free_qgroup; + return trans; ++ ++free_qgroup: ++ /* ++ * We have released qgroup data range at the beginning of the function, ++ * and normally qgroup_released bytes will be freed when committing ++ * transaction. ++ * But if we error out early, we have to free what we have released ++ * or we leak qgroup data reservation. ++ */ ++ btrfs_qgroup_free_refroot(BTRFS_I(inode)->root->fs_info, ++ BTRFS_I(inode)->root->root_key.objectid, qgroup_released, ++ BTRFS_QGROUP_RSV_DATA); ++ return ERR_PTR(ret); + } + + static int __btrfs_prealloc_file_range(struct inode *inode, int mode, diff --git a/patches.suse/0002-kernel-smp-make-csdlock-timeout-depend-on-boot-param.patch b/patches.suse/0002-kernel-smp-make-csdlock-timeout-depend-on-boot-param.patch new file mode 100644 index 0000000..7fec10e --- /dev/null +++ b/patches.suse/0002-kernel-smp-make-csdlock-timeout-depend-on-boot-param.patch @@ -0,0 +1,56 @@ +From 93a97bce23d6b4a7955e71e2881e4bad70657b13 Mon Sep 17 00:00:00 2001 +From: Juergen Gross +Date: Thu, 25 Mar 2021 12:01:19 +0100 +Patch-mainline: never, SUSE debugging +References: bsc#1180846 +Subject: [PATCH v2 2/2] kernel/smp: make csdlock timeout depend on boot + parameter + +Add a csdlock_timeout parameter for being able to specify csdlock +timeout in milliseconds. Default is 5000 (5 seconds). + +Signed-off-by: Juergen Gross +--- + kernel/smp.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/kernel/smp.c b/kernel/smp.c +index 4480fd47b88a..c59fd2958295 100644 +--- a/kernel/smp.c ++++ b/kernel/smp.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #include "smpboot.h" + +@@ -193,12 +194,14 @@ static int __init csdlock_debug(char *str) + } + early_param("csdlock_debug", csdlock_debug); + ++static int csdlock_timeout = 5000; ++core_param(csdlock_timeout, csdlock_timeout, int, 0644); ++ + 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; + +@@ -391,7 +394,7 @@ static bool csd_lock_wait_toolong(call_single_data_t *csd, u64 ts0, u64 *ts1, in + + ts2 = sched_clock(); + ts_delta = ts2 - *ts1; +- if (likely(ts_delta <= CSD_LOCK_TIMEOUT)) ++ if (likely(ts_delta <= (u64)csdlock_timeout * NSEC_PER_MSEC)) + return false; + + firsttime = !*bug_id; +-- +2.26.2 + diff --git a/patches.suse/ACPI-CPPC-Replace-cppc_attr-with-kobj_attribute.patch b/patches.suse/ACPI-CPPC-Replace-cppc_attr-with-kobj_attribute.patch new file mode 100644 index 0000000..24b4bc2 --- /dev/null +++ b/patches.suse/ACPI-CPPC-Replace-cppc_attr-with-kobj_attribute.patch @@ -0,0 +1,90 @@ +From 2bc6262c6117dd18106d5aa50d53e945b5d99c51 Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor +Date: Wed, 7 Apr 2021 14:30:48 -0700 +Subject: [PATCH] ACPI: CPPC: Replace cppc_attr with kobj_attribute +Git-commit: 2bc6262c6117dd18106d5aa50d53e945b5d99c51 +Patch-mainline: v5.13-rc1 +References: git-fixes + +All of the CPPC sysfs show functions are called via indirect call in +kobj_attr_show(), where they should be of type + +ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr, char *buf); + +because that is the type of the ->show() member in +'struct kobj_attribute' but they are actually of type + +ssize_t (*show)(struct kobject *kobj, struct attribute *attr, char *buf); + +because of the ->show() member in 'struct cppc_attr', resulting in a +Control Flow Integrity violation [1]. + +$ cat /sys/devices/system/cpu/cpu0/acpi_cppc/highest_perf +3400 + +$ dmesg | grep "CFI failure" +[ 175.970559] CFI failure (target: show_highest_perf+0x0/0x8): + +As far as I can tell, the only difference between 'struct cppc_attr' +and 'struct kobj_attribute' aside from the type of the attr parameter +is the type of the count parameter in the ->store() member (ssize_t vs. +size_t), which does not actually matter because all of these nodes are +read-only. + +Eliminate 'struct cppc_attr' in favor of 'struct kobj_attribute' to fix +the violation. + +[1]: https://lore.kernel.org/r/20210401233216.2540591-1-samitolvanen@google.com/ + +Fixes: 158c998ea44b ("ACPI / CPPC: add sysfs support to compute delivered performance") +Link: https://github.com/ClangBuiltLinux/linux/issues/1343 +Signed-off-by: Nathan Chancellor +Signed-off-by: Rafael J. Wysocki +Acked-by: Takashi Iwai + +--- + drivers/acpi/cppc_acpi.c | 14 +++----------- + 1 file changed, 3 insertions(+), 11 deletions(-) + +diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c +index d20092815c39..2c2748041cef 100644 +--- a/drivers/acpi/cppc_acpi.c ++++ b/drivers/acpi/cppc_acpi.c +@@ -118,23 +118,15 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr); + */ + #define NUM_RETRIES 500ULL + +-struct cppc_attr { +- struct attribute attr; +- ssize_t (*show)(struct kobject *kobj, +- struct attribute *attr, char *buf); +- ssize_t (*store)(struct kobject *kobj, +- struct attribute *attr, const char *c, ssize_t count); +-}; +- + #define define_one_cppc_ro(_name) \ +-static struct cppc_attr _name = \ ++static struct kobj_attribute _name = \ + __ATTR(_name, 0444, show_##_name, NULL) + + #define to_cpc_desc(a) container_of(a, struct cpc_desc, kobj) + + #define show_cppc_data(access_fn, struct_name, member_name) \ + static ssize_t show_##member_name(struct kobject *kobj, \ +- struct attribute *attr, char *buf) \ ++ struct kobj_attribute *attr, char *buf) \ + { \ + struct cpc_desc *cpc_ptr = to_cpc_desc(kobj); \ + struct struct_name st_name = {0}; \ +@@ -160,7 +152,7 @@ show_cppc_data(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, reference_perf); + show_cppc_data(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, wraparound_time); + + static ssize_t show_feedback_ctrs(struct kobject *kobj, +- struct attribute *attr, char *buf) ++ struct kobj_attribute *attr, char *buf) + { + struct cpc_desc *cpc_ptr = to_cpc_desc(kobj); + struct cppc_perf_fb_ctrs fb_ctrs = {0}; +-- +2.26.2 + diff --git a/patches.suse/ALSA-core-remove-redundant-spin_lock-pair-in-snd_car.patch b/patches.suse/ALSA-core-remove-redundant-spin_lock-pair-in-snd_car.patch new file mode 100644 index 0000000..8cbace2 --- /dev/null +++ b/patches.suse/ALSA-core-remove-redundant-spin_lock-pair-in-snd_car.patch @@ -0,0 +1,39 @@ +From abc21649b3e5c34b143bf86f0c78e33d5815e250 Mon Sep 17 00:00:00 2001 +From: Jia Zhou +Date: Tue, 30 Mar 2021 13:19:23 +0200 +Subject: [PATCH] ALSA: core: remove redundant spin_lock pair in snd_card_disconnect +Git-commit: abc21649b3e5c34b143bf86f0c78e33d5815e250 +Patch-mainline: v5.13-rc1 +References: git-fixes + +modification in commit 2a3f7221acdd ("ALSA: core: Fix card races between +register and disconnect") resulting in this problem. + +Fixes: 2a3f7221acdd ("ALSA: core: Fix card races between register and disconnect") +Signed-off-by: Jia Zhou +Signed-off-by: Yi Wang +Link: https://lore.kernel.org/r/1616989007-34429-1-git-send-email-wang.yi59@zte.com.cn +Signed-off-by: Takashi Iwai + +--- + sound/core/init.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/sound/core/init.c b/sound/core/init.c +index 45f4b01de23f..ef41f5b3a240 100644 +--- a/sound/core/init.c ++++ b/sound/core/init.c +@@ -398,10 +398,8 @@ int snd_card_disconnect(struct snd_card *card) + return 0; + } + card->shutdown = 1; +- spin_unlock(&card->files_lock); + + /* replace file->f_op with special dummy operations */ +- spin_lock(&card->files_lock); + list_for_each_entry(mfile, &card->files_list, list) { + /* it's critical part, use endless loop */ + /* we have no room to fail */ +-- +2.26.2 + diff --git a/patches.suse/ALSA-emu8000-Fix-a-use-after-free-in-snd_emu8000_cre.patch b/patches.suse/ALSA-emu8000-Fix-a-use-after-free-in-snd_emu8000_cre.patch new file mode 100644 index 0000000..a8efad8 --- /dev/null +++ b/patches.suse/ALSA-emu8000-Fix-a-use-after-free-in-snd_emu8000_cre.patch @@ -0,0 +1,48 @@ +From 1c98f574403dbcf2eb832d5535a10d967333ef2d Mon Sep 17 00:00:00 2001 +From: Lv Yunlong +Date: Mon, 26 Apr 2021 06:11:29 -0700 +Subject: [PATCH] ALSA: emu8000: Fix a use after free in snd_emu8000_create_mixer +Git-commit: 1c98f574403dbcf2eb832d5535a10d967333ef2d +Patch-mainline: v5.13-rc1 +References: git-fixes + +Our code analyzer reported a uaf. + +In snd_emu8000_create_mixer, the callee snd_ctl_add(..,emu->controls[i]) +calls snd_ctl_add_replace(.., kcontrol,..). Inside snd_ctl_add_replace(), +if error happens, kcontrol will be freed by snd_ctl_free_one(kcontrol). +Then emu->controls[i] points to a freed memory, and the execution comes +to __error branch of snd_emu8000_create_mixer. The freed emu->controls[i] +is used in snd_ctl_remove(card, emu->controls[i]). + +My patch set emu->controls[i] to NULL if snd_ctl_add() failed to avoid +the uaf. + +Signed-off-by: Lv Yunlong +Cc: +Link: https://lore.kernel.org/r/20210426131129.4796-1-lyl2019@mail.ustc.edu.cn +Signed-off-by: Takashi Iwai + +--- + sound/isa/sb/emu8000.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c +index 0aa545ac6e60..1c90421a88dc 100644 +--- a/sound/isa/sb/emu8000.c ++++ b/sound/isa/sb/emu8000.c +@@ -1029,8 +1029,10 @@ snd_emu8000_create_mixer(struct snd_card *card, struct snd_emu8000 *emu) + + memset(emu->controls, 0, sizeof(emu->controls)); + for (i = 0; i < EMU8000_NUM_CONTROLS; i++) { +- if ((err = snd_ctl_add(card, emu->controls[i] = snd_ctl_new1(mixer_defs[i], emu))) < 0) ++ if ((err = snd_ctl_add(card, emu->controls[i] = snd_ctl_new1(mixer_defs[i], emu))) < 0) { ++ emu->controls[i] = NULL; + goto __error; ++ } + } + return 0; + +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-cirrus-Add-Headphone-and-Headset-MIC-Volume.patch b/patches.suse/ALSA-hda-cirrus-Add-Headphone-and-Headset-MIC-Volume.patch new file mode 100644 index 0000000..a575a0f --- /dev/null +++ b/patches.suse/ALSA-hda-cirrus-Add-Headphone-and-Headset-MIC-Volume.patch @@ -0,0 +1,282 @@ +From b9dd23bb03fe241ccb774c59b05d5cbac07895dc Mon Sep 17 00:00:00 2001 +From: Stefan Binding +Date: Sat, 6 Mar 2021 11:19:34 +0000 +Subject: [PATCH] ALSA: hda/cirrus: Add Headphone and Headset MIC Volume Control +Git-commit: b9dd23bb03fe241ccb774c59b05d5cbac07895dc +Patch-mainline: v5.13-rc1 +References: git-fixes + +CS8409 does not support Volume Control for NIDs 0x24 (the Headphones), +or 0x34 (The Headset Mic). +However, CS42L42 codec does support gain control for both. +We can add support for Volume Controls, by writing the the CS42L42 +regmap via i2c commands, using custom info, get and put volume +functions, saved in the control. + +Tested on DELL Inspiron-3500, DELL Inspiron-3501, DELL Inspiron-3500 + +Signed-off-by: Stefan Binding +Signed-off-by: Vitaly Rodionov +Link: https://lore.kernel.org/r/20210306111934.4832-5-vitalyr@opensource.cirrus.com +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_cirrus.c | 200 +++++++++++++++++++++++++++++++++++ + 1 file changed, 200 insertions(+) + +diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c +index 1d2f6a1224e6..6a9e5c803977 100644 +--- a/sound/pci/hda/patch_cirrus.c ++++ b/sound/pci/hda/patch_cirrus.c +@@ -21,6 +21,9 @@ + /* + */ + ++#define CS42L42_HP_CH (2U) ++#define CS42L42_HS_MIC_CH (1U) ++ + struct cs_spec { + struct hda_gen_spec gen; + +@@ -42,6 +45,9 @@ struct cs_spec { + + unsigned int cs42l42_hp_jack_in:1; + unsigned int cs42l42_mic_jack_in:1; ++ unsigned int cs42l42_volume_init:1; ++ char cs42l42_hp_volume[CS42L42_HP_CH]; ++ char cs42l42_hs_mic_volume[CS42L42_HS_MIC_CH]; + + struct mutex cs8409_i2c_mux; + +@@ -1260,6 +1266,14 @@ static int patch_cs4213(struct hda_codec *codec) + #define CIR_I2C_QWRITE 0x005D + #define CIR_I2C_QREAD 0x005E + ++#define CS8409_CS42L42_HP_VOL_REAL_MIN (-63) ++#define CS8409_CS42L42_HP_VOL_REAL_MAX (0) ++#define CS8409_CS42L42_AMIC_VOL_REAL_MIN (-97) ++#define CS8409_CS42L42_AMIC_VOL_REAL_MAX (12) ++#define CS8409_CS42L42_REG_HS_VOLUME_CHA (0x2301) ++#define CS8409_CS42L42_REG_HS_VOLUME_CHB (0x2303) ++#define CS8409_CS42L42_REG_AMIC_VOLUME (0x1D03) ++ + struct cs8409_i2c_param { + unsigned int addr; + unsigned int reg; +@@ -1580,6 +1594,165 @@ static unsigned int cs8409_i2c_write(struct hda_codec *codec, + return retval; + } + ++static int cs8409_cs42l42_volume_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ struct hda_codec *codec = snd_kcontrol_chip(kcontrol); ++ u16 nid = get_amp_nid(kcontrol); ++ u8 chs = get_amp_channels(kcontrol); ++ ++ codec_dbg(codec, "%s() nid: %d\n", __func__, nid); ++ switch (nid) { ++ case CS8409_CS42L42_HP_PIN_NID: ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; ++ uinfo->count = chs == 3 ? 2 : 1; ++ uinfo->value.integer.min = CS8409_CS42L42_HP_VOL_REAL_MIN; ++ uinfo->value.integer.max = CS8409_CS42L42_HP_VOL_REAL_MAX; ++ break; ++ case CS8409_CS42L42_AMIC_PIN_NID: ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; ++ uinfo->count = chs == 3 ? 2 : 1; ++ uinfo->value.integer.min = CS8409_CS42L42_AMIC_VOL_REAL_MIN; ++ uinfo->value.integer.max = CS8409_CS42L42_AMIC_VOL_REAL_MAX; ++ break; ++ default: ++ break; ++ } ++ return 0; ++} ++ ++static void cs8409_cs42l42_update_volume(struct hda_codec *codec) ++{ ++ struct cs_spec *spec = codec->spec; ++ ++ mutex_lock(&spec->cs8409_i2c_mux); ++ spec->cs42l42_hp_volume[0] = -(cs8409_i2c_read(codec, CS42L42_I2C_ADDR, ++ CS8409_CS42L42_REG_HS_VOLUME_CHA, 1)); ++ spec->cs42l42_hp_volume[1] = -(cs8409_i2c_read(codec, CS42L42_I2C_ADDR, ++ CS8409_CS42L42_REG_HS_VOLUME_CHB, 1)); ++ spec->cs42l42_hs_mic_volume[0] = -(cs8409_i2c_read(codec, CS42L42_I2C_ADDR, ++ CS8409_CS42L42_REG_AMIC_VOLUME, 1)); ++ mutex_unlock(&spec->cs8409_i2c_mux); ++ spec->cs42l42_volume_init = 1; ++} ++ ++static int cs8409_cs42l42_volume_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct hda_codec *codec = snd_kcontrol_chip(kcontrol); ++ struct cs_spec *spec = codec->spec; ++ hda_nid_t nid = get_amp_nid(kcontrol); ++ int chs = get_amp_channels(kcontrol); ++ long *valp = ucontrol->value.integer.value; ++ ++ if (!spec->cs42l42_volume_init) { ++ snd_hda_power_up(codec); ++ cs8409_cs42l42_update_volume(codec); ++ snd_hda_power_down(codec); ++ } ++ switch (nid) { ++ case CS8409_CS42L42_HP_PIN_NID: ++ if (chs & 1) ++ *valp++ = spec->cs42l42_hp_volume[0]; ++ if (chs & 2) ++ *valp++ = spec->cs42l42_hp_volume[1]; ++ break; ++ case CS8409_CS42L42_AMIC_PIN_NID: ++ if (chs & 1) ++ *valp++ = spec->cs42l42_hs_mic_volume[0]; ++ break; ++ default: ++ break; ++ } ++ return 0; ++} ++ ++static int cs8409_cs42l42_volume_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct hda_codec *codec = snd_kcontrol_chip(kcontrol); ++ struct cs_spec *spec = codec->spec; ++ hda_nid_t nid = get_amp_nid(kcontrol); ++ int chs = get_amp_channels(kcontrol); ++ long *valp = ucontrol->value.integer.value; ++ int change = 0; ++ char vol = 0; ++ ++ snd_hda_power_up(codec); ++ switch (nid) { ++ case CS8409_CS42L42_HP_PIN_NID: ++ mutex_lock(&spec->cs8409_i2c_mux); ++ if (chs & 1) { ++ vol = -(*valp); ++ change = cs8409_i2c_write(codec, CS42L42_I2C_ADDR, ++ CS8409_CS42L42_REG_HS_VOLUME_CHA, vol, 1); ++ valp++; ++ } ++ if (chs & 2) { ++ vol = -(*valp); ++ change |= cs8409_i2c_write(codec, CS42L42_I2C_ADDR, ++ CS8409_CS42L42_REG_HS_VOLUME_CHB, vol, 1); ++ } ++ mutex_unlock(&spec->cs8409_i2c_mux); ++ break; ++ case CS8409_CS42L42_AMIC_PIN_NID: ++ mutex_lock(&spec->cs8409_i2c_mux); ++ if (chs & 1) { ++ change = cs8409_i2c_write( ++ codec, CS42L42_I2C_ADDR, ++ CS8409_CS42L42_REG_AMIC_VOLUME, (char)*valp, 1); ++ valp++; ++ } ++ mutex_unlock(&spec->cs8409_i2c_mux); ++ break; ++ default: ++ break; ++ } ++ cs8409_cs42l42_update_volume(codec); ++ snd_hda_power_down(codec); ++ return change; ++} ++ ++static const DECLARE_TLV_DB_SCALE( ++ cs8409_cs42l42_hp_db_scale, ++ CS8409_CS42L42_HP_VOL_REAL_MIN * 100, 100, 1); ++ ++static const DECLARE_TLV_DB_SCALE( ++ cs8409_cs42l42_amic_db_scale, ++ CS8409_CS42L42_AMIC_VOL_REAL_MIN * 100, 100, 1); ++ ++static const struct snd_kcontrol_new cs8409_cs42l42_hp_volume_mixer = { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ++ .index = 0, ++ .name = "Headphone Playback Volume", ++ .subdevice = (HDA_SUBDEV_AMP_FLAG | HDA_SUBDEV_NID_FLAG), ++ .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE ++ | SNDRV_CTL_ELEM_ACCESS_TLV_READ), ++ .info = cs8409_cs42l42_volume_info, ++ .get = cs8409_cs42l42_volume_get, ++ .put = cs8409_cs42l42_volume_put, ++ .tlv = { .p = cs8409_cs42l42_hp_db_scale }, ++ .private_value = HDA_COMPOSE_AMP_VAL( ++ CS8409_CS42L42_HP_PIN_NID, 3, 0, HDA_OUTPUT) ++ | HDA_AMP_VAL_MIN_MUTE ++}; ++ ++static const struct snd_kcontrol_new cs8409_cs42l42_amic_volume_mixer = { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ++ .index = 0, ++ .name = "Headset Mic Capture Volume", ++ .subdevice = (HDA_SUBDEV_AMP_FLAG | HDA_SUBDEV_NID_FLAG), ++ .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE ++ | SNDRV_CTL_ELEM_ACCESS_TLV_READ), ++ .info = cs8409_cs42l42_volume_info, ++ .get = cs8409_cs42l42_volume_get, ++ .put = cs8409_cs42l42_volume_put, ++ .tlv = { .p = cs8409_cs42l42_amic_db_scale }, ++ .private_value = HDA_COMPOSE_AMP_VAL( ++ CS8409_CS42L42_AMIC_PIN_NID, 1, 0, HDA_INPUT) ++ | HDA_AMP_VAL_MIN_MUTE ++}; ++ + /* Assert/release RTS# line to CS42L42 */ + static void cs8409_cs42l42_reset(struct hda_codec *codec) + { +@@ -1900,6 +2073,24 @@ static int cs8409_cs42l42_hw_init(struct hda_codec *codec) + cs_vendor_coef_set(codec, 0x09, 0x0003); + } + ++ /* Restore Volumes after Resume */ ++ if (spec->cs42l42_volume_init) { ++ mutex_lock(&spec->cs8409_i2c_mux); ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, ++ CS8409_CS42L42_REG_HS_VOLUME_CHA, -spec->cs42l42_hp_volume[0], ++ 1); ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, ++ CS8409_CS42L42_REG_HS_VOLUME_CHB, -spec->cs42l42_hp_volume[1], ++ 1); ++ cs8409_i2c_write( ++ codec, CS42L42_I2C_ADDR, ++ CS8409_CS42L42_REG_AMIC_VOLUME, spec->cs42l42_hs_mic_volume[0], ++ 1); ++ mutex_unlock(&spec->cs8409_i2c_mux); ++ } ++ ++ cs8409_cs42l42_update_volume(codec); ++ + cs8409_cs42l42_enable_jack_detect(codec); + + /* Enable Unsolicited Response */ +@@ -1991,6 +2182,14 @@ static int cs8409_cs42l42_fixup(struct hda_codec *codec) + if (err < 0) + return err; + ++ if (!snd_hda_gen_add_kctl( ++ &spec->gen, NULL, &cs8409_cs42l42_hp_volume_mixer)) ++ return -1; ++ ++ if (!snd_hda_gen_add_kctl( ++ &spec->gen, NULL, &cs8409_cs42l42_amic_volume_mixer)) ++ return -1; ++ + snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); + + return err; +@@ -2072,6 +2271,7 @@ static int patch_cs8409(struct hda_codec *codec) + + spec->gen.suppress_auto_mute = 1; + spec->gen.no_primary_hp = 1; ++ spec->gen.suppress_vmaster = 1; + /* GPIO 5 out, 3,4 in */ + spec->gpio_dir = GPIO5_INT; + spec->gpio_data = 0; +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-cirrus-Add-error-handling-into-CS8409-I2C-f.patch b/patches.suse/ALSA-hda-cirrus-Add-error-handling-into-CS8409-I2C-f.patch new file mode 100644 index 0000000..300427f --- /dev/null +++ b/patches.suse/ALSA-hda-cirrus-Add-error-handling-into-CS8409-I2C-f.patch @@ -0,0 +1,282 @@ +From fb3447d5842b71ec960da1b8a3ca5ee5f46a5327 Mon Sep 17 00:00:00 2001 +From: Stefan Binding +Date: Mon, 15 Mar 2021 19:07:13 +0000 +Subject: [PATCH] ALSA: hda/cirrus: Add error handling into CS8409 I2C functions +Git-commit: fb3447d5842b71ec960da1b8a3ca5ee5f46a5327 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Also removing 2 redundant cs8409_i2c_read() calls, as we already did read +them in a code above. + +Tested on DELL Inspiron-3505, DELL Inspiron-3501, DELL Inspiron-3500 + +Signed-off-by: Stefan Binding +Signed-off-by: Vitaly Rodionov +Link: https://lore.kernel.org/r/20210315190716.47686-2-vitalyr@opensource.cirrus.com +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_cirrus.c | 136 +++++++++++++++++++++++------------ + 1 file changed, 91 insertions(+), 45 deletions(-) + +diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c +index 6a9e5c803977..d95478ea2fb2 100644 +--- a/sound/pci/hda/patch_cirrus.c ++++ b/sound/pci/hda/patch_cirrus.c +@@ -1493,22 +1493,34 @@ static const struct cs8409_cir_param cs8409_cs42l42_hw_cfg[] = { + {} /* Terminator */ + }; + +-/* Enable I2C clocks */ +-static void cs8409_enable_i2c_clock(struct hda_codec *codec, unsigned int flag) ++/** ++ * cs8409_enable_i2c_clock - Enable I2C clocks ++ * @codec: the codec instance ++ * @enable: Enable or disable I2C clocks ++ * ++ * Enable or Disable I2C clocks. ++ */ ++static void cs8409_enable_i2c_clock(struct hda_codec *codec, unsigned int enable) + { + unsigned int retval = 0; + unsigned int newval = 0; + + retval = cs_vendor_coef_get(codec, 0x0); +- newval = (flag) ? (retval | 0x8) : (retval & 0xfffffff7); ++ newval = (enable) ? (retval | 0x8) : (retval & 0xfffffff7); + cs_vendor_coef_set(codec, 0x0, newval); + } + +-/* Wait I2C transaction */ ++/** ++ * cs8409_i2c_wait_complete - Wait for I2C transaction ++ * @codec: the codec instance ++ * ++ * Wait for I2C transaction to complete. ++ * Return -1 if transaction wait times out. ++ */ + static int cs8409_i2c_wait_complete(struct hda_codec *codec) + { + int repeat = 5; +- unsigned int retval = 0; ++ unsigned int retval; + + do { + retval = cs_vendor_coef_get(codec, CIR_I2C_STATUS); +@@ -1516,82 +1528,103 @@ static int cs8409_i2c_wait_complete(struct hda_codec *codec) + usleep_range(2000, 4000); + --repeat; + } else +- break; ++ return 0; + + } while (repeat); + +- return repeat > 0 ? 0 : -1; ++ return -1; + } + +-/* CS8409 slave i2cRead */ +-static unsigned int cs8409_i2c_read(struct hda_codec *codec, ++/** ++ * cs8409_i2c_read - CS8409 I2C Read. ++ * @codec: the codec instance ++ * @i2c_address: I2C Address ++ * @i2c_reg: Register to read ++ * @paged: Is a paged transaction ++ * ++ * CS8409 I2C Read. ++ * Returns negative on error, otherwise returns read value in bits 0-7. ++ */ ++static int cs8409_i2c_read(struct hda_codec *codec, + unsigned int i2c_address, + unsigned int i2c_reg, + unsigned int paged) + { + unsigned int i2c_reg_data; +- unsigned int retval = 0; ++ unsigned int read_data; + + cs8409_enable_i2c_clock(codec, 1); + cs_vendor_coef_set(codec, CIR_I2C_ADDR, i2c_address); + + if (paged) { + cs_vendor_coef_set(codec, CIR_I2C_QWRITE, i2c_reg >> 8); +- if (cs8409_i2c_wait_complete(codec) == -1) { ++ if (cs8409_i2c_wait_complete(codec) < 0) { + codec_err(codec, +- "%s() Paged Transaction Failed 0x%02x : 0x%04x = 0x%02x\n", +- __func__, i2c_address, i2c_reg, retval); ++ "%s() Paged Transaction Failed 0x%02x : 0x%04x\n", ++ __func__, i2c_address, i2c_reg); ++ return -EIO; + } + } + + i2c_reg_data = (i2c_reg << 8) & 0x0ffff; + cs_vendor_coef_set(codec, CIR_I2C_QREAD, i2c_reg_data); +- if (cs8409_i2c_wait_complete(codec) == -1) { +- codec_err(codec, "%s() Transaction Failed 0x%02x : 0x%04x = 0x%02x\n", +- __func__, i2c_address, i2c_reg, retval); ++ if (cs8409_i2c_wait_complete(codec) < 0) { ++ codec_err(codec, "%s() Transaction Failed 0x%02x : 0x%04x\n", ++ __func__, i2c_address, i2c_reg); ++ return -EIO; + } + + /* Register in bits 15-8 and the data in 7-0 */ +- retval = cs_vendor_coef_get(codec, CIR_I2C_QREAD); +- retval &= 0x0ff; ++ read_data = cs_vendor_coef_get(codec, CIR_I2C_QREAD); + + cs8409_enable_i2c_clock(codec, 0); + +- return retval; ++ return read_data & 0x0ff; + } + +-/* CS8409 slave i2cWrite */ +-static unsigned int cs8409_i2c_write(struct hda_codec *codec, ++/** ++ * cs8409_i2c_write - CS8409 I2C Write. ++ * @codec: the codec instance ++ * @i2c_address: I2C Address ++ * @i2c_reg: Register to write to ++ * @i2c_data: Data to write ++ * @paged: Is a paged transaction ++ * ++ * CS8409 I2C Write. ++ * Returns negative on error, otherwise returns 0. ++ */ ++static int cs8409_i2c_write(struct hda_codec *codec, + unsigned int i2c_address, unsigned int i2c_reg, + unsigned int i2c_data, + unsigned int paged) + { +- unsigned int retval = 0; +- unsigned int i2c_reg_data = 0; ++ unsigned int i2c_reg_data; + + cs8409_enable_i2c_clock(codec, 1); + cs_vendor_coef_set(codec, CIR_I2C_ADDR, i2c_address); + + if (paged) { + cs_vendor_coef_set(codec, CIR_I2C_QWRITE, i2c_reg >> 8); +- if (cs8409_i2c_wait_complete(codec) == -1) { ++ if (cs8409_i2c_wait_complete(codec) < 0) { + codec_err(codec, +- "%s() Paged Transaction Failed 0x%02x : 0x%04x = 0x%02x\n", +- __func__, i2c_address, i2c_reg, retval); ++ "%s() Paged Transaction Failed 0x%02x : 0x%04x\n", ++ __func__, i2c_address, i2c_reg); ++ return -EIO; + } + } + + i2c_reg_data = ((i2c_reg << 8) & 0x0ff00) | (i2c_data & 0x0ff); + cs_vendor_coef_set(codec, CIR_I2C_QWRITE, i2c_reg_data); + +- if (cs8409_i2c_wait_complete(codec) == -1) { +- codec_err(codec, "%s() Transaction Failed 0x%02x : 0x%04x = 0x%02x\n", +- __func__, i2c_address, i2c_reg, retval); ++ if (cs8409_i2c_wait_complete(codec) < 0) { ++ codec_err(codec, "%s() Transaction Failed 0x%02x : 0x%04x\n", ++ __func__, i2c_address, i2c_reg); ++ return -EIO; + } + + cs8409_enable_i2c_clock(codec, 0); + +- return retval; ++ return 0; + } + + static int cs8409_cs42l42_volume_info(struct snd_kcontrol *kcontrol, +@@ -1624,14 +1657,27 @@ static int cs8409_cs42l42_volume_info(struct snd_kcontrol *kcontrol, + static void cs8409_cs42l42_update_volume(struct hda_codec *codec) + { + struct cs_spec *spec = codec->spec; ++ int data; + + mutex_lock(&spec->cs8409_i2c_mux); +- spec->cs42l42_hp_volume[0] = -(cs8409_i2c_read(codec, CS42L42_I2C_ADDR, +- CS8409_CS42L42_REG_HS_VOLUME_CHA, 1)); +- spec->cs42l42_hp_volume[1] = -(cs8409_i2c_read(codec, CS42L42_I2C_ADDR, +- CS8409_CS42L42_REG_HS_VOLUME_CHB, 1)); +- spec->cs42l42_hs_mic_volume[0] = -(cs8409_i2c_read(codec, CS42L42_I2C_ADDR, +- CS8409_CS42L42_REG_AMIC_VOLUME, 1)); ++ data = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, ++ CS8409_CS42L42_REG_HS_VOLUME_CHA, 1); ++ if (data >= 0) ++ spec->cs42l42_hp_volume[0] = -data; ++ else ++ spec->cs42l42_hp_volume[0] = CS8409_CS42L42_HP_VOL_REAL_MIN; ++ data = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, ++ CS8409_CS42L42_REG_HS_VOLUME_CHB, 1); ++ if (data >= 0) ++ spec->cs42l42_hp_volume[1] = -data; ++ else ++ spec->cs42l42_hp_volume[1] = CS8409_CS42L42_HP_VOL_REAL_MIN; ++ data = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, ++ CS8409_CS42L42_REG_AMIC_VOLUME, 1); ++ if (data >= 0) ++ spec->cs42l42_hs_mic_volume[0] = -data; ++ else ++ spec->cs42l42_hs_mic_volume[0] = CS8409_CS42L42_AMIC_VOL_REAL_MIN; + mutex_unlock(&spec->cs8409_i2c_mux); + spec->cs42l42_volume_init = 1; + } +@@ -1782,7 +1828,7 @@ static void cs8409_cs42l42_reset(struct hda_codec *codec) + } + + /* Configure CS42L42 slave codec for jack autodetect */ +-static int cs8409_cs42l42_enable_jack_detect(struct hda_codec *codec) ++static void cs8409_cs42l42_enable_jack_detect(struct hda_codec *codec) + { + struct cs_spec *spec = codec->spec; + +@@ -1804,8 +1850,6 @@ static int cs8409_cs42l42_enable_jack_detect(struct hda_codec *codec) + cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1b79, 0x00, 1); + + mutex_unlock(&spec->cs8409_i2c_mux); +- +- return 0; + } + + /* Enable and run CS42L42 slave codec jack auto detect */ +@@ -1860,9 +1904,9 @@ static void cs8409_jack_unsol_event(struct hda_codec *codec, unsigned int res) + { + struct cs_spec *spec = codec->spec; + int status_changed = 0; +- unsigned int reg_cdc_status = 0; +- unsigned int reg_hs_status = 0; +- unsigned int reg_ts_status = 0; ++ int reg_cdc_status; ++ int reg_hs_status; ++ int reg_ts_status; + int type = 0; + struct hda_jack_tbl *jk; + +@@ -1881,13 +1925,15 @@ static void cs8409_jack_unsol_event(struct hda_codec *codec, unsigned int res) + reg_hs_status = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1124, 1); + reg_ts_status = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130f, 1); + +- /* Clear interrupts */ ++ /* Clear interrupts, by reading interrupt status registers */ + cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1b7b, 1); +- cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1308, 1); +- cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130f, 1); + + mutex_unlock(&spec->cs8409_i2c_mux); + ++ /* If status values are < 0, read error has occurred. */ ++ if (reg_cdc_status < 0 || reg_hs_status < 0 || reg_ts_status < 0) ++ return; ++ + /* HSDET_AUTO_DONE */ + if (reg_cdc_status & CS42L42_HSDET_AUTO_DONE) { + +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-cirrus-Add-jack-detect-interrupt-support-fr.patch b/patches.suse/ALSA-hda-cirrus-Add-jack-detect-interrupt-support-fr.patch new file mode 100644 index 0000000..f905b10 --- /dev/null +++ b/patches.suse/ALSA-hda-cirrus-Add-jack-detect-interrupt-support-fr.patch @@ -0,0 +1,474 @@ +From b73df04187ebb52edf3f7e502bb245c5ccab2763 Mon Sep 17 00:00:00 2001 +From: Vitaly Rodionov +Date: Sat, 6 Mar 2021 11:19:33 +0000 +Subject: [PATCH] ALSA: hda/cirrus: Add jack detect interrupt support from CS42L42 companion codec. +Git-commit: b73df04187ebb52edf3f7e502bb245c5ccab2763 +Patch-mainline: v5.13-rc1 +References: git-fixes + +In the case of CS8409 we do not have unsol events from NID's 0x24 and 0x34 +where hs mic and hp are connected. Companion codec CS42L42 will generate +interrupt via gpio 4 to notify jack events. We have to overwrite standard +snd_hda_jack_unsol_event(), read CS42L42 jack detect status registers and +then notify status via generic snd_hda_jack_unsol_event() call. + +Tested on DELL Inspiron-3500, DELL Inspiron-3501, DELL Inspiron-3505. + +Signed-off-by: Vitaly Rodionov +Link: https://lore.kernel.org/r/20210306111934.4832-4-vitalyr@opensource.cirrus.com +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_cirrus.c | 309 ++++++++++++++++++++++++++++++++++- + 1 file changed, 307 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c +index d664eed5c3cf..1d2f6a1224e6 100644 +--- a/sound/pci/hda/patch_cirrus.c ++++ b/sound/pci/hda/patch_cirrus.c +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -38,6 +39,15 @@ struct cs_spec { + /* for MBP SPDIF control */ + int (*spdif_sw_put)(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol); ++ ++ unsigned int cs42l42_hp_jack_in:1; ++ unsigned int cs42l42_mic_jack_in:1; ++ ++ struct mutex cs8409_i2c_mux; ++ ++ /* verb exec op override */ ++ int (*exec_verb)(struct hdac_device *dev, unsigned int cmd, ++ unsigned int flags, unsigned int *res); + }; + + /* available models with CS420x */ +@@ -1229,6 +1239,13 @@ static int patch_cs4213(struct hda_codec *codec) + #define CS8409_CS42L42_SPK_PIN_NID 0x2c + #define CS8409_CS42L42_AMIC_PIN_NID 0x34 + #define CS8409_CS42L42_DMIC_PIN_NID 0x44 ++#define CS8409_CS42L42_DMIC_ADC_PIN_NID 0x22 ++ ++#define CS42L42_HSDET_AUTO_DONE 0x02 ++#define CS42L42_HSTYPE_MASK 0x03 ++ ++#define CS42L42_JACK_INSERTED 0x0C ++#define CS42L42_JACK_REMOVED 0x00 + + #define GPIO3_INT (1 << 3) + #define GPIO4_INT (1 << 4) +@@ -1429,6 +1446,7 @@ static const struct cs8409_i2c_param cs42l42_init_reg_seq[] = { + { 0x1C03, 0xC0 }, + { 0x1105, 0x00 }, + { 0x1112, 0xC0 }, ++ { 0x1101, 0x02 }, + {} /* Terminator */ + }; + +@@ -1565,6 +1583,8 @@ static unsigned int cs8409_i2c_write(struct hda_codec *codec, + /* Assert/release RTS# line to CS42L42 */ + static void cs8409_cs42l42_reset(struct hda_codec *codec) + { ++ struct cs_spec *spec = codec->spec; ++ + /* Assert RTS# line */ + snd_hda_codec_write(codec, + codec->core.afg, 0, AC_VERB_SET_GPIO_DATA, 0); +@@ -1576,21 +1596,190 @@ static void cs8409_cs42l42_reset(struct hda_codec *codec) + /* wait ~10ms */ + usleep_range(10000, 15000); + +- /* Clear interrupts status */ ++ mutex_lock(&spec->cs8409_i2c_mux); ++ ++ /* Clear interrupts, by reading interrupt status registers */ + cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1308, 1); + cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1309, 1); + cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130A, 1); + cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130F, 1); + ++ mutex_unlock(&spec->cs8409_i2c_mux); ++ ++} ++ ++/* Configure CS42L42 slave codec for jack autodetect */ ++static int cs8409_cs42l42_enable_jack_detect(struct hda_codec *codec) ++{ ++ struct cs_spec *spec = codec->spec; ++ ++ mutex_lock(&spec->cs8409_i2c_mux); ++ ++ /* Set TIP_SENSE_EN for analog front-end of tip sense. */ ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1b70, 0x0020, 1); ++ /* Clear WAKE# */ ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1b71, 0x0001, 1); ++ /* Wait ~2.5ms */ ++ usleep_range(2500, 3000); ++ /* Set mode WAKE# output follows the combination logic directly */ ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1b71, 0x0020, 1); ++ /* Clear interrupts status */ ++ cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130f, 1); ++ cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1b7b, 1); ++ /* Enable interrupt */ ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1320, 0x03, 1); ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1b79, 0x00, 1); ++ ++ mutex_unlock(&spec->cs8409_i2c_mux); ++ ++ return 0; ++} ++ ++/* Enable and run CS42L42 slave codec jack auto detect */ ++static void cs8409_cs42l42_run_jack_detect(struct hda_codec *codec) ++{ ++ struct cs_spec *spec = codec->spec; ++ ++ mutex_lock(&spec->cs8409_i2c_mux); ++ ++ /* Clear interrupts */ ++ cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1308, 1); ++ cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1b77, 1); ++ ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1102, 0x87, 1); ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1f06, 0x86, 1); ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1b74, 0x07, 1); ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x131b, 0x01, 1); ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1120, 0x80, 1); ++ /* Wait ~110ms*/ ++ usleep_range(110000, 200000); ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x111f, 0x77, 1); ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1120, 0xc0, 1); ++ /* Wait ~10ms */ ++ usleep_range(10000, 25000); ++ ++ mutex_unlock(&spec->cs8409_i2c_mux); ++ + } + + static void cs8409_cs42l42_reg_setup(struct hda_codec *codec) + { + const struct cs8409_i2c_param *seq = cs42l42_init_reg_seq; ++ struct cs_spec *spec = codec->spec; ++ ++ mutex_lock(&spec->cs8409_i2c_mux); + + for (; seq->addr; seq++) + cs8409_i2c_write(codec, CS42L42_I2C_ADDR, seq->addr, seq->reg, 1); + ++ mutex_unlock(&spec->cs8409_i2c_mux); ++ ++} ++ ++/* ++ * In the case of CS8409 we do not have unsolicited events from NID's 0x24 ++ * and 0x34 where hs mic and hp are connected. Companion codec CS42L42 will ++ * generate interrupt via gpio 4 to notify jack events. We have to overwrite ++ * generic snd_hda_jack_unsol_event(), read CS42L42 jack detect status registers ++ * and then notify status via generic snd_hda_jack_unsol_event() call. ++ */ ++static void cs8409_jack_unsol_event(struct hda_codec *codec, unsigned int res) ++{ ++ struct cs_spec *spec = codec->spec; ++ int status_changed = 0; ++ unsigned int reg_cdc_status = 0; ++ unsigned int reg_hs_status = 0; ++ unsigned int reg_ts_status = 0; ++ int type = 0; ++ struct hda_jack_tbl *jk; ++ ++ /* jack_unsol_event() will be called every time gpio line changing state. ++ * In this case gpio4 line goes up as a result of reading interrupt status ++ * registers in previous cs8409_jack_unsol_event() call. ++ * We don't need to handle this event, ignoring... ++ */ ++ if ((res & (1 << 4))) ++ return; ++ ++ mutex_lock(&spec->cs8409_i2c_mux); ++ ++ /* Read jack detect status registers */ ++ reg_cdc_status = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1308, 1); ++ reg_hs_status = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1124, 1); ++ reg_ts_status = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130f, 1); ++ ++ /* Clear interrupts */ ++ cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1b7b, 1); ++ cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1308, 1); ++ cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130f, 1); ++ ++ mutex_unlock(&spec->cs8409_i2c_mux); ++ ++ /* HSDET_AUTO_DONE */ ++ if (reg_cdc_status & CS42L42_HSDET_AUTO_DONE) { ++ ++ type = ((reg_hs_status & CS42L42_HSTYPE_MASK) + 1); ++ /* CS42L42 reports optical jack as type 4 ++ * We don't handle optical jack ++ */ ++ if (type != 4) { ++ if (!spec->cs42l42_hp_jack_in) { ++ status_changed = 1; ++ spec->cs42l42_hp_jack_in = 1; ++ } ++ /* type = 3 has no mic */ ++ if ((!spec->cs42l42_mic_jack_in) && (type != 3)) { ++ status_changed = 1; ++ spec->cs42l42_mic_jack_in = 1; ++ } ++ } else { ++ if (spec->cs42l42_hp_jack_in || spec->cs42l42_mic_jack_in) { ++ status_changed = 1; ++ spec->cs42l42_hp_jack_in = 0; ++ spec->cs42l42_mic_jack_in = 0; ++ } ++ } ++ ++ } else { ++ /* TIP_SENSE INSERT/REMOVE */ ++ switch (reg_ts_status) { ++ case CS42L42_JACK_INSERTED: ++ cs8409_cs42l42_run_jack_detect(codec); ++ break; ++ ++ case CS42L42_JACK_REMOVED: ++ if (spec->cs42l42_hp_jack_in || spec->cs42l42_mic_jack_in) { ++ status_changed = 1; ++ spec->cs42l42_hp_jack_in = 0; ++ spec->cs42l42_mic_jack_in = 0; ++ } ++ break; ++ ++ default: ++ /* jack in transition */ ++ status_changed = 0; ++ break; ++ } ++ } ++ ++ if (status_changed) { ++ ++ snd_hda_set_pin_ctl(codec, CS8409_CS42L42_SPK_PIN_NID, ++ (spec->cs42l42_hp_jack_in)?0 : PIN_OUT); ++ ++ /* Report jack*/ ++ jk = snd_hda_jack_tbl_get_mst(codec, CS8409_CS42L42_HP_PIN_NID, 0); ++ if (jk) { ++ snd_hda_jack_unsol_event(codec, ++ (jk->tag << AC_UNSOL_RES_TAG_SHIFT) & AC_UNSOL_RES_TAG); ++ } ++ /* Report jack*/ ++ jk = snd_hda_jack_tbl_get_mst(codec, CS8409_CS42L42_AMIC_PIN_NID, 0); ++ if (jk) { ++ snd_hda_jack_unsol_event(codec, ++ (jk->tag << AC_UNSOL_RES_TAG_SHIFT) & AC_UNSOL_RES_TAG); ++ } ++ } + } + + static int cs8409_cs42l42_build_controls(struct hda_codec *codec) +@@ -1603,6 +1792,13 @@ static int cs8409_cs42l42_build_controls(struct hda_codec *codec) + + snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); + ++ /* Run jack auto detect first time on boot ++ * after controls have been added, to check if jack has ++ * been already plugged in ++ */ ++ cs8409_cs42l42_run_jack_detect(codec); ++ usleep_range(100000, 150000); ++ + return 0; + } + +@@ -1610,14 +1806,61 @@ static int cs8409_cs42l42_build_controls(struct hda_codec *codec) + /* Manage PDREF, when transition to D3hot */ + static int cs8409_suspend(struct hda_codec *codec) + { ++ struct cs_spec *spec = codec->spec; ++ ++ mutex_lock(&spec->cs8409_i2c_mux); ++ /* Power down CS42L42 ASP/EQ/MIX/HP */ ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1101, 0xfe, 1); ++ mutex_unlock(&spec->cs8409_i2c_mux); + /* Assert CS42L42 RTS# line */ + snd_hda_codec_write(codec, + codec->core.afg, 0, AC_VERB_SET_GPIO_DATA, 0); ++ + snd_hda_shutup_pins(codec); ++ + return 0; + } + #endif + ++static void cs8409_cs42l42_cap_sync_hook(struct hda_codec *codec, ++ struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct cs_spec *spec = codec->spec; ++ unsigned int curval, expval; ++ /* CS8409 DMIC Pin only allows the setting of the Stream Parameters in ++ * Power State D0. When a headset is unplugged, and the path is switched to ++ * the DMIC, the Stream is restarted with the new ADC, but this is done in ++ * Power State D3. Restart the Stream now DMIC is in D0. ++ */ ++ if (spec->gen.cur_adc == CS8409_CS42L42_DMIC_ADC_PIN_NID) { ++ curval = snd_hda_codec_read(codec, spec->gen.cur_adc, ++ 0, AC_VERB_GET_CONV, 0); ++ expval = (spec->gen.cur_adc_stream_tag << 4) | 0; ++ if (curval != expval) { ++ codec_dbg(codec, "%s Restarting Stream after DMIC switch\n", __func__); ++ __snd_hda_codec_cleanup_stream(codec, spec->gen.cur_adc, 1); ++ snd_hda_codec_setup_stream(codec, spec->gen.cur_adc, ++ spec->gen.cur_adc_stream_tag, 0, ++ spec->gen.cur_adc_format); ++ } ++ } ++} ++ ++/* Enable/Disable Unsolicited Response for gpio(s) 3,4 */ ++static void cs8409_enable_ur(struct hda_codec *codec, int flag) ++{ ++ /* GPIO4 INT# and GPIO3 WAKE# */ ++ snd_hda_codec_write(codec, codec->core.afg, ++ 0, AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, ++ flag?(GPIO3_INT | GPIO4_INT) : 0); ++ ++ snd_hda_codec_write(codec, codec->core.afg, ++ 0, AC_VERB_SET_UNSOLICITED_ENABLE, ++ flag?AC_UNSOL_ENABLED : 0); ++ ++} ++ + /* Vendor specific HW configuration + * PLL, ASP, I2C, SPI, GPIOs, DMIC etc... + */ +@@ -1638,6 +1881,9 @@ static int cs8409_cs42l42_hw_init(struct hda_codec *codec) + for (; seq->nid; seq++) + cs_vendor_coef_set(codec, seq->cir, seq->coeff); + ++ /* Disable Unsolicited Response during boot */ ++ cs8409_enable_ur(codec, 0); ++ + /* Reset CS42L42 */ + cs8409_cs42l42_reset(codec); + +@@ -1647,11 +1893,18 @@ static int cs8409_cs42l42_hw_init(struct hda_codec *codec) + if (codec->fixup_id == CS8409_WARLOCK || + codec->fixup_id == CS8409_CYBORG) { + /* FULL_SCALE_VOL = 0 for Warlock / Cyborg */ ++ mutex_lock(&spec->cs8409_i2c_mux); + cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x2001, 0x01, 1); ++ mutex_unlock(&spec->cs8409_i2c_mux); + /* DMIC1_MO=00b, DMIC1/2_SR=1 */ + cs_vendor_coef_set(codec, 0x09, 0x0003); + } + ++ cs8409_cs42l42_enable_jack_detect(codec); ++ ++ /* Enable Unsolicited Response */ ++ cs8409_enable_ur(codec, 1); ++ + return 1; + } + +@@ -1671,6 +1924,8 @@ static int cs8409_cs42l42_init(struct hda_codec *codec) + + cs8409_cs42l42_hw_init(codec); + ++ cs8409_cs42l42_run_jack_detect(codec); ++ usleep_range(100000, 150000); + } + + return ret; +@@ -1681,7 +1936,7 @@ static const struct hda_codec_ops cs8409_cs42l42_patch_ops = { + .build_pcms = snd_hda_gen_build_pcms, + .init = cs8409_cs42l42_init, + .free = cs_free, +- .unsol_event = snd_hda_jack_unsol_event, ++ .unsol_event = cs8409_jack_unsol_event, + #ifdef CONFIG_PM + .suspend = cs8409_suspend, + #endif +@@ -1741,6 +1996,45 @@ static int cs8409_cs42l42_fixup(struct hda_codec *codec) + return err; + } + ++static int cs8409_cs42l42_exec_verb(struct hdac_device *dev, ++ unsigned int cmd, unsigned int flags, unsigned int *res) ++{ ++ struct hda_codec *codec = container_of(dev, struct hda_codec, core); ++ struct cs_spec *spec = codec->spec; ++ ++ unsigned int nid = 0; ++ unsigned int verb = 0; ++ ++ nid = ((cmd >> 20) & 0x07f); ++ verb = ((cmd >> 8) & 0x0fff); ++ ++ /* CS8409 pins have no AC_PINSENSE_PRESENCE ++ * capabilities. We have to intercept 2 calls for pins 0x24 and 0x34 ++ * and return correct pin sense values for read_pin_sense() call from ++ * hda_jack based on CS42L42 jack detect status. ++ */ ++ switch (nid) { ++ case CS8409_CS42L42_HP_PIN_NID: ++ if (verb == AC_VERB_GET_PIN_SENSE) { ++ *res = (spec->cs42l42_hp_jack_in) ? AC_PINSENSE_PRESENCE : 0; ++ return 0; ++ } ++ break; ++ ++ case CS8409_CS42L42_AMIC_PIN_NID: ++ if (verb == AC_VERB_GET_PIN_SENSE) { ++ *res = (spec->cs42l42_mic_jack_in) ? AC_PINSENSE_PRESENCE : 0; ++ return 0; ++ } ++ break; ++ ++ default: ++ break; ++ } ++ ++ return spec->exec_verb(dev, cmd, flags, res); ++} ++ + static int patch_cs8409(struct hda_codec *codec) + { + struct cs_spec *spec; +@@ -1766,8 +2060,16 @@ static int patch_cs8409(struct hda_codec *codec) + + snd_hda_add_verbs(codec, cs8409_cs42l42_add_verbs); + ++ /* verb exec op override */ ++ spec->exec_verb = codec->core.exec_verb; ++ codec->core.exec_verb = cs8409_cs42l42_exec_verb; ++ ++ mutex_init(&spec->cs8409_i2c_mux); ++ + codec->patch_ops = cs8409_cs42l42_patch_ops; + ++ spec->gen.cap_sync_hook = cs8409_cs42l42_cap_sync_hook; ++ + spec->gen.suppress_auto_mute = 1; + spec->gen.no_primary_hp = 1; + /* GPIO 5 out, 3,4 in */ +@@ -1775,6 +2077,9 @@ static int patch_cs8409(struct hda_codec *codec) + spec->gpio_data = 0; + spec->gpio_mask = 0x03f; + ++ spec->cs42l42_hp_jack_in = 0; ++ spec->cs42l42_mic_jack_in = 0; ++ + err = cs8409_cs42l42_fixup(codec); + + if (err > 0) +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-cirrus-Add-support-for-CS8409-HDA-bridge-an.patch b/patches.suse/ALSA-hda-cirrus-Add-support-for-CS8409-HDA-bridge-an.patch new file mode 100644 index 0000000..10ca705 --- /dev/null +++ b/patches.suse/ALSA-hda-cirrus-Add-support-for-CS8409-HDA-bridge-an.patch @@ -0,0 +1,671 @@ +From 6cc7e93f46a5ce9f65ad3c6c6f645f1d831a8fa4 Mon Sep 17 00:00:00 2001 +From: Vitaly Rodionov +Date: Sat, 6 Mar 2021 11:19:32 +0000 +Subject: [PATCH] ALSA: hda/cirrus: Add support for CS8409 HDA bridge and CS42L42 companion codec. +Git-commit: 6cc7e93f46a5ce9f65ad3c6c6f645f1d831a8fa4 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Dell's laptops Inspiron 3500, Inspiron 3501, Inspiron 3505 are using Cirrus Logic +CS8409 HDA bridge with CS42L42 companion codec. + +The CS8409 is a multichannel HD audio routing controller. +CS8409 includes support for four channels of digital +microphone data and two bidirectional ASPs for up to 32 +channels of TDM data or 4 channels of I2S data. The CS8409 is +intended to be used with a remote companion codec that implements +high performance analog functions in close physical +proximity to the end-equipment audio port or speaker driver. + +The CS42L42 is a low-power audio codec with integrated MIPI +SoundWire interface or I2C/I2S/TDM interfaces designed +for portable applications. It provides a high-dynamic range, +stereo DAC for audio playback and a mono high-dynamic-range +ADC for audio capture + +CS42L42 is connected to CS8409 HDA bridge via I2C and I2S. + +CS8409 CS42L42 + +------- -------- +ASP1.A TX --> ASP_SDIN +ASP1.A RX <-- ASP_SDOUT +GPIO5 --> RST# +GPIO4 <-- INT# +GPIO3 <-- WAKE# +GPIO7 <-> I2C SDA +GPIO6 --> I2C CLK + +Tested on DELL Inspiron-3500, DELL Inspiron-3501, DELL Inspiron-3505 + +This patch will register CS8409 with sound card and create +input/output paths and two input devices, initialise CS42L42 +companion codec and configure it for ASP TX/RX TDM mode, +24bit, 48kHz. + +cat /proc/asound/pcm +00-00: CS8409 Analog : CS8409 Analog : playback 1 : capture 1 +00-03: HDMI 0 : HDMI 0 : playback 1 + +dmesg +snd_hda_codec_cirrus hdaudioC0D0: autoconfig for CS8409: line_outs=1 (0x2c/0x0/0x0/0x0/0x0) type:speaker +snd_hda_codec_cirrus hdaudioC0D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) +snd_hda_codec_cirrus hdaudioC0D0: hp_outs=1 (0x24/0x0/0x0/0x0/0x0) +snd_hda_codec_cirrus hdaudioC0D0: mono: mono_out=0x0 +snd_hda_codec_cirrus hdaudioC0D0: inputs: +snd_hda_codec_cirrus hdaudioC0D0: Internal Mic=0x44 +snd_hda_codec_cirrus hdaudioC0D0: Mic=0x34 +input: HDA Intel PCH Headphone as /devices/pci0000:00/0000:00:1f.3/sound/card0/input8 +input: HDA Intel PCH Headset Mic as /devices/pci0000:00/0000:00:1f.3/sound/card0/input9 + +Signed-off-by: Vitaly Rodionov +Link: https://lore.kernel.org/r/20210306111934.4832-3-vitalyr@opensource.cirrus.com +Signed-off-by: Takashi Iwai +--- + sound/pci/hda/patch_cirrus.c | 576 +++++++++++++++++++++++++++++++++++ + 1 file changed, 576 insertions(+) + +diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c +index f46204ab0b90..d664eed5c3cf 100644 +--- a/sound/pci/hda/patch_cirrus.c ++++ b/sound/pci/hda/patch_cirrus.c +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + #include + #include + #include "hda_local.h" +@@ -1219,6 +1220,580 @@ static int patch_cs4213(struct hda_codec *codec) + return err; + } + ++/* Cirrus Logic CS8409 HDA bridge with ++ * companion codec CS42L42 ++ */ ++#define CS8409_VENDOR_NID 0x47 ++ ++#define CS8409_CS42L42_HP_PIN_NID 0x24 ++#define CS8409_CS42L42_SPK_PIN_NID 0x2c ++#define CS8409_CS42L42_AMIC_PIN_NID 0x34 ++#define CS8409_CS42L42_DMIC_PIN_NID 0x44 ++ ++#define GPIO3_INT (1 << 3) ++#define GPIO4_INT (1 << 4) ++#define GPIO5_INT (1 << 5) ++ ++#define CS42L42_I2C_ADDR (0x48 << 1) ++ ++#define CIR_I2C_ADDR 0x0059 ++#define CIR_I2C_DATA 0x005A ++#define CIR_I2C_CTRL 0x005B ++#define CIR_I2C_STATUS 0x005C ++#define CIR_I2C_QWRITE 0x005D ++#define CIR_I2C_QREAD 0x005E ++ ++struct cs8409_i2c_param { ++ unsigned int addr; ++ unsigned int reg; ++}; ++ ++struct cs8409_cir_param { ++ unsigned int nid; ++ unsigned int cir; ++ unsigned int coeff; ++}; ++ ++enum { ++ CS8409_BULLSEYE, ++ CS8409_WARLOCK, ++ CS8409_CYBORG, ++ CS8409_VERBS, ++}; ++ ++/* Dell Inspiron models with cs8409/cs42l42 */ ++static const struct hda_model_fixup cs8409_models[] = { ++ { .id = CS8409_BULLSEYE, .name = "bullseye" }, ++ { .id = CS8409_WARLOCK, .name = "warlock" }, ++ { .id = CS8409_CYBORG, .name = "cyborg" }, ++ {} ++}; ++ ++/* Dell Inspiron platforms ++ * with cs8409 bridge and cs42l42 codec ++ */ ++static const struct snd_pci_quirk cs8409_fixup_tbl[] = { ++ SND_PCI_QUIRK(0x1028, 0x0A11, "Bullseye", CS8409_BULLSEYE), ++ SND_PCI_QUIRK(0x1028, 0x0A12, "Bullseye", CS8409_BULLSEYE), ++ SND_PCI_QUIRK(0x1028, 0x0A23, "Bullseye", CS8409_BULLSEYE), ++ SND_PCI_QUIRK(0x1028, 0x0A24, "Bullseye", CS8409_BULLSEYE), ++ SND_PCI_QUIRK(0x1028, 0x0A25, "Bullseye", CS8409_BULLSEYE), ++ SND_PCI_QUIRK(0x1028, 0x0A29, "Bullseye", CS8409_BULLSEYE), ++ SND_PCI_QUIRK(0x1028, 0x0A2A, "Bullseye", CS8409_BULLSEYE), ++ SND_PCI_QUIRK(0x1028, 0x0A2B, "Bullseye", CS8409_BULLSEYE), ++ SND_PCI_QUIRK(0x1028, 0x0AB0, "Warlock", CS8409_WARLOCK), ++ SND_PCI_QUIRK(0x1028, 0x0AB2, "Warlock", CS8409_WARLOCK), ++ SND_PCI_QUIRK(0x1028, 0x0AB1, "Warlock", CS8409_WARLOCK), ++ SND_PCI_QUIRK(0x1028, 0x0AB3, "Warlock", CS8409_WARLOCK), ++ SND_PCI_QUIRK(0x1028, 0x0AB4, "Warlock", CS8409_WARLOCK), ++ SND_PCI_QUIRK(0x1028, 0x0AB5, "Warlock", CS8409_WARLOCK), ++ SND_PCI_QUIRK(0x1028, 0x0AD9, "Warlock", CS8409_WARLOCK), ++ SND_PCI_QUIRK(0x1028, 0x0ADA, "Warlock", CS8409_WARLOCK), ++ SND_PCI_QUIRK(0x1028, 0x0ADB, "Warlock", CS8409_WARLOCK), ++ SND_PCI_QUIRK(0x1028, 0x0ADC, "Warlock", CS8409_WARLOCK), ++ SND_PCI_QUIRK(0x1028, 0x0AF4, "Warlock", CS8409_WARLOCK), ++ SND_PCI_QUIRK(0x1028, 0x0AF5, "Warlock", CS8409_WARLOCK), ++ SND_PCI_QUIRK(0x1028, 0x0A77, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0A78, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0A79, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0A7A, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0A7D, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0A7E, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0A7F, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0A80, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0ADF, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0AE0, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0AE1, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0AE2, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0AE9, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0AEA, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0AEB, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0AEC, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0AED, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0AEE, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0AEF, "Cyborg", CS8409_CYBORG), ++ SND_PCI_QUIRK(0x1028, 0x0AF0, "Cyborg", CS8409_CYBORG), ++ {} /* terminator */ ++}; ++ ++static const struct hda_verb cs8409_cs42l42_init_verbs[] = { ++ { 0x01, AC_VERB_SET_GPIO_WAKE_MASK, 0x0018 }, /* WAKE from GPIO 3,4 */ ++ { 0x47, AC_VERB_SET_PROC_STATE, 0x0001 }, /* Enable VPW processing */ ++ { 0x47, AC_VERB_SET_COEF_INDEX, 0x0002 }, /* Configure GPIO 6,7 */ ++ { 0x47, AC_VERB_SET_PROC_COEF, 0x0080 }, /* I2C mode */ ++ { 0x47, AC_VERB_SET_COEF_INDEX, 0x005b }, /* Set I2C bus speed */ ++ { 0x47, AC_VERB_SET_PROC_COEF, 0x0200 }, /* 100kHz I2C_STO = 2 */ ++ {} /* terminator */ ++}; ++ ++static const struct hda_pintbl cs8409_cs42l42_pincfgs[] = { ++ { 0x24, 0x042120f0 }, /* ASP-1-TX */ ++ { 0x34, 0x04a12050 }, /* ASP-1-RX */ ++ { 0x2c, 0x901000f0 }, /* ASP-2-TX */ ++ { 0x44, 0x90a00090 }, /* DMIC-1 */ ++ {} /* terminator */ ++}; ++ ++static const struct hda_verb cs8409_cs42l42_add_verbs[] = { ++ { 0x24, 0x71c, 0xF0 }, /* Widget node ASP-1-TX */ ++ { 0x24, 0x71d, 0x20 }, ++ { 0x24, 0x71e, 0x21 }, ++ { 0x24, 0x71f, 0x04 }, ++ { 0x34, 0x71c, 0x50 }, /* Widget node ASP-1-RX0 */ ++ { 0x34, 0x71d, 0x20 }, ++ { 0x34, 0x71e, 0xa1 }, ++ { 0x34, 0x71f, 0x04 }, ++ { 0x2C, 0x71c, 0xF0 }, /* Widget node ASP-2-TX */ ++ { 0x2C, 0x71d, 0x00 }, ++ { 0x2C, 0x71e, 0x10 }, ++ { 0x2C, 0x71f, 0x90 }, ++ { 0x44, 0x71c, 0x90 }, /* Widget node DMIC-1 */ ++ { 0x44, 0x71d, 0x00 }, ++ { 0x44, 0x71e, 0xA0 }, ++ { 0x44, 0x71f, 0x90 }, ++ {} /* terminator */ ++}; ++ ++static const struct hda_fixup cs8409_fixups[] = { ++ [CS8409_BULLSEYE] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = cs8409_cs42l42_pincfgs, ++ .chained = true, ++ .chain_id = CS8409_VERBS, ++ }, ++ [CS8409_WARLOCK] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = cs8409_cs42l42_pincfgs, ++ .chained = true, ++ .chain_id = CS8409_VERBS, ++ }, ++ [CS8409_CYBORG] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = cs8409_cs42l42_pincfgs, ++ .chained = true, ++ .chain_id = CS8409_VERBS, ++ }, ++ [CS8409_VERBS] = { ++ .type = HDA_FIXUP_VERBS, ++ .v.verbs = cs8409_cs42l42_add_verbs, ++ }, ++}; ++ ++/* Vendor specific HW configuration for CS42L42 */ ++static const struct cs8409_i2c_param cs42l42_init_reg_seq[] = { ++ { 0x1010, 0xB0 }, ++ { 0x1D01, 0x00 }, ++ { 0x1D02, 0x06 }, ++ { 0x1D03, 0x00 }, ++ { 0x1107, 0x01 }, ++ { 0x1009, 0x02 }, ++ { 0x1007, 0x03 }, ++ { 0x1201, 0x00 }, ++ { 0x1208, 0x13 }, ++ { 0x1205, 0xFF }, ++ { 0x1206, 0x00 }, ++ { 0x1207, 0x20 }, ++ { 0x1202, 0x0D }, ++ { 0x2A02, 0x02 }, ++ { 0x2A03, 0x00 }, ++ { 0x2A04, 0x00 }, ++ { 0x2A05, 0x02 }, ++ { 0x2A06, 0x00 }, ++ { 0x2A07, 0x20 }, ++ { 0x2A08, 0x02 }, ++ { 0x2A09, 0x00 }, ++ { 0x2A0A, 0x80 }, ++ { 0x2A0B, 0x02 }, ++ { 0x2A0C, 0x00 }, ++ { 0x2A0D, 0xA0 }, ++ { 0x2A01, 0x0C }, ++ { 0x2902, 0x01 }, ++ { 0x2903, 0x02 }, ++ { 0x2904, 0x00 }, ++ { 0x2905, 0x00 }, ++ { 0x2901, 0x01 }, ++ { 0x1101, 0x0A }, ++ { 0x1102, 0x84 }, ++ { 0x2301, 0x00 }, ++ { 0x2303, 0x00 }, ++ { 0x2302, 0x3f }, ++ { 0x2001, 0x03 }, ++ { 0x1B75, 0xB6 }, ++ { 0x1B73, 0xC2 }, ++ { 0x1129, 0x01 }, ++ { 0x1121, 0xF3 }, ++ { 0x1103, 0x20 }, ++ { 0x1105, 0x00 }, ++ { 0x1112, 0xC0 }, ++ { 0x1113, 0x80 }, ++ { 0x1C03, 0xC0 }, ++ { 0x1105, 0x00 }, ++ { 0x1112, 0xC0 }, ++ {} /* Terminator */ ++}; ++ ++/* Vendor specific hw configuration for CS8409 */ ++static const struct cs8409_cir_param cs8409_cs42l42_hw_cfg[] = { ++ { 0x47, 0x00, 0xb008 }, /* +PLL1/2_EN, +I2C_EN */ ++ { 0x47, 0x01, 0x0002 }, /* ASP1/2_EN=0, ASP1_STP=1 */ ++ { 0x47, 0x02, 0x0a80 }, /* ASP1/2_BUS_IDLE=10, +GPIO_I2C */ ++ { 0x47, 0x19, 0x0800 }, /* ASP1.A: TX.LAP=0, TX.LSZ=24 bits, TX.LCS=0 */ ++ { 0x47, 0x1a, 0x0820 }, /* ASP1.A: TX.RAP=0, TX.RSZ=24 bits, TX.RCS=32 */ ++ { 0x47, 0x29, 0x0800 }, /* ASP2.A: TX.LAP=0, TX.LSZ=24 bits, TX.LCS=0 */ ++ { 0x47, 0x2a, 0x2800 }, /* ASP2.A: TX.RAP=1, TX.RSZ=24 bits, TX.RCS=0 */ ++ { 0x47, 0x39, 0x0800 }, /* ASP1.A: RX.LAP=0, RX.LSZ=24 bits, RX.LCS=0 */ ++ { 0x47, 0x3a, 0x0800 }, /* ASP1.A: RX.RAP=0, RX.RSZ=24 bits, RX.RCS=0 */ ++ { 0x47, 0x03, 0x8000 }, /* ASP1: LCHI = 00h */ ++ { 0x47, 0x04, 0x28ff }, /* ASP1: MC/SC_SRCSEL=PLL1, LCPR=FFh */ ++ { 0x47, 0x05, 0x0062 }, /* ASP1: MCEN=0, FSD=011, SCPOL_IN/OUT=0, SCDIV=1:4 */ ++ { 0x47, 0x06, 0x801f }, /* ASP2: LCHI=1Fh */ ++ { 0x47, 0x07, 0x283f }, /* ASP2: MC/SC_SRCSEL=PLL1, LCPR=3Fh */ ++ { 0x47, 0x08, 0x805c }, /* ASP2: 5050=1, MCEN=0, FSD=010, SCPOL_IN/OUT=1, SCDIV=1:16 */ ++ { 0x47, 0x09, 0x0023 }, /* DMIC1_MO=10b, DMIC1/2_SR=1 */ ++ { 0x47, 0x0a, 0x0000 }, /* ASP1/2_BEEP=0 */ ++ { 0x47, 0x01, 0x0062 }, /* ASP1/2_EN=1, ASP1_STP=1 */ ++ { 0x47, 0x00, 0x9008 }, /* -PLL2_EN */ ++ { 0x47, 0x68, 0x0000 }, /* TX2.A: pre-scale att.=0 dB */ ++ { 0x47, 0x82, 0xfc03 }, /* ASP1/2_xxx_EN=1, ASP1/2_MCLK_EN=0, DMIC1_SCL_EN=1 */ ++ { 0x47, 0xc0, 0x9999 }, /* test mode on */ ++ { 0x47, 0xc5, 0x0000 }, /* GPIO hysteresis = 30 us */ ++ { 0x47, 0xc0, 0x0000 }, /* test mode off */ ++ {} /* Terminator */ ++}; ++ ++/* Enable I2C clocks */ ++static void cs8409_enable_i2c_clock(struct hda_codec *codec, unsigned int flag) ++{ ++ unsigned int retval = 0; ++ unsigned int newval = 0; ++ ++ retval = cs_vendor_coef_get(codec, 0x0); ++ newval = (flag) ? (retval | 0x8) : (retval & 0xfffffff7); ++ cs_vendor_coef_set(codec, 0x0, newval); ++} ++ ++/* Wait I2C transaction */ ++static int cs8409_i2c_wait_complete(struct hda_codec *codec) ++{ ++ int repeat = 5; ++ unsigned int retval = 0; ++ ++ do { ++ retval = cs_vendor_coef_get(codec, CIR_I2C_STATUS); ++ if ((retval & 0x18) != 0x18) { ++ usleep_range(2000, 4000); ++ --repeat; ++ } else ++ break; ++ ++ } while (repeat); ++ ++ return repeat > 0 ? 0 : -1; ++} ++ ++/* CS8409 slave i2cRead */ ++static unsigned int cs8409_i2c_read(struct hda_codec *codec, ++ unsigned int i2c_address, ++ unsigned int i2c_reg, ++ unsigned int paged) ++{ ++ unsigned int i2c_reg_data; ++ unsigned int retval = 0; ++ ++ cs8409_enable_i2c_clock(codec, 1); ++ cs_vendor_coef_set(codec, CIR_I2C_ADDR, i2c_address); ++ ++ if (paged) { ++ cs_vendor_coef_set(codec, CIR_I2C_QWRITE, i2c_reg >> 8); ++ if (cs8409_i2c_wait_complete(codec) == -1) { ++ codec_err(codec, ++ "%s() Paged Transaction Failed 0x%02x : 0x%04x = 0x%02x\n", ++ __func__, i2c_address, i2c_reg, retval); ++ } ++ } ++ ++ i2c_reg_data = (i2c_reg << 8) & 0x0ffff; ++ cs_vendor_coef_set(codec, CIR_I2C_QREAD, i2c_reg_data); ++ if (cs8409_i2c_wait_complete(codec) == -1) { ++ codec_err(codec, "%s() Transaction Failed 0x%02x : 0x%04x = 0x%02x\n", ++ __func__, i2c_address, i2c_reg, retval); ++ } ++ ++ /* Register in bits 15-8 and the data in 7-0 */ ++ retval = cs_vendor_coef_get(codec, CIR_I2C_QREAD); ++ retval &= 0x0ff; ++ ++ cs8409_enable_i2c_clock(codec, 0); ++ ++ return retval; ++} ++ ++/* CS8409 slave i2cWrite */ ++static unsigned int cs8409_i2c_write(struct hda_codec *codec, ++ unsigned int i2c_address, unsigned int i2c_reg, ++ unsigned int i2c_data, ++ unsigned int paged) ++{ ++ unsigned int retval = 0; ++ unsigned int i2c_reg_data = 0; ++ ++ cs8409_enable_i2c_clock(codec, 1); ++ cs_vendor_coef_set(codec, CIR_I2C_ADDR, i2c_address); ++ ++ if (paged) { ++ cs_vendor_coef_set(codec, CIR_I2C_QWRITE, i2c_reg >> 8); ++ if (cs8409_i2c_wait_complete(codec) == -1) { ++ codec_err(codec, ++ "%s() Paged Transaction Failed 0x%02x : 0x%04x = 0x%02x\n", ++ __func__, i2c_address, i2c_reg, retval); ++ } ++ } ++ ++ i2c_reg_data = ((i2c_reg << 8) & 0x0ff00) | (i2c_data & 0x0ff); ++ cs_vendor_coef_set(codec, CIR_I2C_QWRITE, i2c_reg_data); ++ ++ if (cs8409_i2c_wait_complete(codec) == -1) { ++ codec_err(codec, "%s() Transaction Failed 0x%02x : 0x%04x = 0x%02x\n", ++ __func__, i2c_address, i2c_reg, retval); ++ } ++ ++ cs8409_enable_i2c_clock(codec, 0); ++ ++ return retval; ++} ++ ++/* Assert/release RTS# line to CS42L42 */ ++static void cs8409_cs42l42_reset(struct hda_codec *codec) ++{ ++ /* Assert RTS# line */ ++ snd_hda_codec_write(codec, ++ codec->core.afg, 0, AC_VERB_SET_GPIO_DATA, 0); ++ /* wait ~10ms */ ++ usleep_range(10000, 15000); ++ /* Release RTS# line */ ++ snd_hda_codec_write(codec, ++ codec->core.afg, 0, AC_VERB_SET_GPIO_DATA, GPIO5_INT); ++ /* wait ~10ms */ ++ usleep_range(10000, 15000); ++ ++ /* Clear interrupts status */ ++ cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1308, 1); ++ cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1309, 1); ++ cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130A, 1); ++ cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130F, 1); ++ ++} ++ ++static void cs8409_cs42l42_reg_setup(struct hda_codec *codec) ++{ ++ const struct cs8409_i2c_param *seq = cs42l42_init_reg_seq; ++ ++ for (; seq->addr; seq++) ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, seq->addr, seq->reg, 1); ++ ++} ++ ++static int cs8409_cs42l42_build_controls(struct hda_codec *codec) ++{ ++ int err; ++ ++ err = snd_hda_gen_build_controls(codec); ++ if (err < 0) ++ return err; ++ ++ snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); ++ ++ return 0; ++} ++ ++#ifdef CONFIG_PM ++/* Manage PDREF, when transition to D3hot */ ++static int cs8409_suspend(struct hda_codec *codec) ++{ ++ /* Assert CS42L42 RTS# line */ ++ snd_hda_codec_write(codec, ++ codec->core.afg, 0, AC_VERB_SET_GPIO_DATA, 0); ++ snd_hda_shutup_pins(codec); ++ return 0; ++} ++#endif ++ ++/* Vendor specific HW configuration ++ * PLL, ASP, I2C, SPI, GPIOs, DMIC etc... ++ */ ++static int cs8409_cs42l42_hw_init(struct hda_codec *codec) ++{ ++ const struct cs8409_cir_param *seq = cs8409_cs42l42_hw_cfg; ++ struct cs_spec *spec = codec->spec; ++ ++ if (spec->gpio_mask) { ++ snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, ++ spec->gpio_mask); ++ snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION, ++ spec->gpio_dir); ++ snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, ++ spec->gpio_data); ++ } ++ ++ for (; seq->nid; seq++) ++ cs_vendor_coef_set(codec, seq->cir, seq->coeff); ++ ++ /* Reset CS42L42 */ ++ cs8409_cs42l42_reset(codec); ++ ++ /* Initialise CS42L42 companion codec */ ++ cs8409_cs42l42_reg_setup(codec); ++ ++ if (codec->fixup_id == CS8409_WARLOCK || ++ codec->fixup_id == CS8409_CYBORG) { ++ /* FULL_SCALE_VOL = 0 for Warlock / Cyborg */ ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x2001, 0x01, 1); ++ /* DMIC1_MO=00b, DMIC1/2_SR=1 */ ++ cs_vendor_coef_set(codec, 0x09, 0x0003); ++ } ++ ++ return 1; ++} ++ ++static int cs8409_cs42l42_init(struct hda_codec *codec) ++{ ++ int ret = 0; ++ ++ ret = snd_hda_gen_init(codec); ++ ++ if (!ret) { ++ /* On Dell platforms with suspend D3 mode support we ++ * have to re-initialise cs8409 bridge and companion ++ * cs42l42 codec ++ */ ++ snd_hda_sequence_write(codec, cs8409_cs42l42_init_verbs); ++ snd_hda_sequence_write(codec, cs8409_cs42l42_add_verbs); ++ ++ cs8409_cs42l42_hw_init(codec); ++ ++ } ++ ++ return ret; ++} ++ ++static const struct hda_codec_ops cs8409_cs42l42_patch_ops = { ++ .build_controls = cs8409_cs42l42_build_controls, ++ .build_pcms = snd_hda_gen_build_pcms, ++ .init = cs8409_cs42l42_init, ++ .free = cs_free, ++ .unsol_event = snd_hda_jack_unsol_event, ++#ifdef CONFIG_PM ++ .suspend = cs8409_suspend, ++#endif ++}; ++ ++static int cs8409_cs42l42_fixup(struct hda_codec *codec) ++{ ++ int err = 0; ++ struct cs_spec *spec = codec->spec; ++ unsigned int pincap = 0; ++ ++ /* Basic initial sequence for specific hw configuration */ ++ snd_hda_sequence_write(codec, cs8409_cs42l42_init_verbs); ++ ++ /* CS8409 is simple HDA bridge and intended to be used with a remote ++ * companion codec. Most of input/output PIN(s) have only basic ++ * capabilities. NID(s) 0x24 and 0x34 have only OUTC and INC ++ * capabilities and no presence detect capable (PDC) and call to ++ * snd_hda_gen_build_controls() will mark them as non detectable ++ * phantom jacks. However, in this configuration companion codec ++ * CS42L42 is connected to these pins and it has jack detect ++ * capabilities. We have to override pin capabilities, ++ * otherwise they will not be created as input devices. ++ */ ++ _snd_hdac_read_parm(&codec->core, ++ CS8409_CS42L42_HP_PIN_NID, AC_PAR_PIN_CAP, &pincap); ++ ++ snd_hdac_override_parm(&codec->core, ++ CS8409_CS42L42_HP_PIN_NID, AC_PAR_PIN_CAP, ++ (pincap | (AC_PINCAP_IMP_SENSE | AC_PINCAP_PRES_DETECT))); ++ ++ _snd_hdac_read_parm(&codec->core, CS8409_CS42L42_AMIC_PIN_NID, ++ AC_PAR_PIN_CAP, &pincap); ++ ++ snd_hdac_override_parm(&codec->core, ++ CS8409_CS42L42_AMIC_PIN_NID, AC_PAR_PIN_CAP, ++ (pincap | (AC_PINCAP_IMP_SENSE | AC_PINCAP_PRES_DETECT))); ++ ++ snd_hda_override_wcaps(codec, CS8409_CS42L42_HP_PIN_NID, ++ (get_wcaps(codec, CS8409_CS42L42_HP_PIN_NID) | AC_WCAP_UNSOL_CAP)); ++ ++ snd_hda_override_wcaps(codec, CS8409_CS42L42_AMIC_PIN_NID, ++ (get_wcaps(codec, CS8409_CS42L42_AMIC_PIN_NID) | AC_WCAP_UNSOL_CAP)); ++ ++ snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); ++ ++ err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, 0, 0); ++ if (err < 0) ++ return err; ++ ++ err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); ++ if (err < 0) ++ return err; ++ ++ snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); ++ ++ return err; ++} ++ ++static int patch_cs8409(struct hda_codec *codec) ++{ ++ struct cs_spec *spec; ++ int err = -EINVAL; ++ ++ spec = cs_alloc_spec(codec, CS8409_VENDOR_NID); ++ if (!spec) ++ return -ENOMEM; ++ ++ snd_hda_pick_fixup(codec, ++ cs8409_models, cs8409_fixup_tbl, cs8409_fixups); ++ ++ codec_dbg(codec, "Picked ID=%d, VID=%08x, DEV=%08x\n", ++ codec->fixup_id, ++ codec->bus->pci->subsystem_vendor, ++ codec->bus->pci->subsystem_device); ++ ++ switch (codec->fixup_id) { ++ /* Dell platforms with CS42L42 companion codec */ ++ case CS8409_BULLSEYE: ++ case CS8409_WARLOCK: ++ case CS8409_CYBORG: ++ ++ snd_hda_add_verbs(codec, cs8409_cs42l42_add_verbs); ++ ++ codec->patch_ops = cs8409_cs42l42_patch_ops; ++ ++ spec->gen.suppress_auto_mute = 1; ++ spec->gen.no_primary_hp = 1; ++ /* GPIO 5 out, 3,4 in */ ++ spec->gpio_dir = GPIO5_INT; ++ spec->gpio_data = 0; ++ spec->gpio_mask = 0x03f; ++ ++ err = cs8409_cs42l42_fixup(codec); ++ ++ if (err > 0) ++ err = cs8409_cs42l42_hw_init(codec); ++ break; ++ ++ default: ++ codec_err(codec, "VID=%08x, DEV=%08x not supported\n", ++ codec->bus->pci->subsystem_vendor, ++ codec->bus->pci->subsystem_device); ++ break; ++ } ++ if (err < 0) ++ cs_free(codec); ++ else ++ snd_hda_codec_set_name(codec, "CS8409/CS42L42"); ++ ++ return err; ++} + + /* + * patch entries +@@ -1229,6 +1804,7 @@ static const struct hda_device_id snd_hda_id_cirrus[] = { + HDA_CODEC_ENTRY(0x10134208, "CS4208", patch_cs4208), + HDA_CODEC_ENTRY(0x10134210, "CS4210", patch_cs4210), + HDA_CODEC_ENTRY(0x10134213, "CS4213", patch_cs4213), ++ HDA_CODEC_ENTRY(0x10138409, "CS8409", patch_cs8409), + {} /* terminator */ + }; + MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_cirrus); +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-cirrus-Cleanup-patch_cirrus.c-code.patch b/patches.suse/ALSA-hda-cirrus-Cleanup-patch_cirrus.c-code.patch new file mode 100644 index 0000000..8e9ca7a --- /dev/null +++ b/patches.suse/ALSA-hda-cirrus-Cleanup-patch_cirrus.c-code.patch @@ -0,0 +1,452 @@ +From 61a9aba19f4482984dc7ec5c04c54bf51166cff2 Mon Sep 17 00:00:00 2001 +From: Stefan Binding +Date: Mon, 15 Mar 2021 19:07:14 +0000 +Subject: [PATCH] ALSA: hda/cirrus: Cleanup patch_cirrus.c code. +Git-commit: 61a9aba19f4482984dc7ec5c04c54bf51166cff2 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Minor changes, clean up code, remove unnecessary +initialization of variables, reduced number of +warnings from ./scripts/checkpatch.pl from 19 to 0 + +Tested on DELL Inspiron-3505, DELL Inspiron-3501, DELL Inspiron-3500 + +Signed-off-by: Stefan Binding +Signed-off-by: Vitaly Rodionov +Link: https://lore.kernel.org/r/20210315190716.47686-3-vitalyr@opensource.cirrus.com +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_cirrus.c | 147 +++++++++++++++++------------------ + 1 file changed, 72 insertions(+), 75 deletions(-) + +diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c +index d95478ea2fb2..275bba02cc05 100644 +--- a/sound/pci/hda/patch_cirrus.c ++++ b/sound/pci/hda/patch_cirrus.c +@@ -127,7 +127,7 @@ enum { + * 1 DAC => HP(sense) / Speakers, + * 1 ADC <= LineIn(sense) / MicIn / DMicIn, + * 1 SPDIF OUT => SPDIF Trasmitter(sense) +-*/ ++ */ + #define CS4210_DAC_NID 0x02 + #define CS4210_ADC_NID 0x03 + #define CS4210_VENDOR_NID 0x0B +@@ -146,6 +146,7 @@ enum { + static inline int cs_vendor_coef_get(struct hda_codec *codec, unsigned int idx) + { + struct cs_spec *spec = codec->spec; ++ + snd_hda_codec_write(codec, spec->vendor_nid, 0, + AC_VERB_SET_COEF_INDEX, idx); + return snd_hda_codec_read(codec, spec->vendor_nid, 0, +@@ -156,6 +157,7 @@ static inline void cs_vendor_coef_set(struct hda_codec *codec, unsigned int idx, + unsigned int coef) + { + struct cs_spec *spec = codec->spec; ++ + snd_hda_codec_write(codec, spec->vendor_nid, 0, + AC_VERB_SET_COEF_INDEX, idx); + snd_hda_codec_write(codec, spec->vendor_nid, 0, +@@ -192,6 +194,7 @@ static void cs_automute(struct hda_codec *codec) + static bool is_active_pin(struct hda_codec *codec, hda_nid_t nid) + { + unsigned int val; ++ + val = snd_hda_codec_get_pincfg(codec, nid); + return (get_defcfg_connect(val) != AC_JACK_PORT_NONE); + } +@@ -210,7 +213,7 @@ static void init_input_coef(struct hda_codec *codec) + coef |= 1 << 3; /* DMIC1 2 chan on, GPIO0 off + * No effect if SPDIF_OUT2 is + * selected in IDX_SPDIF_CTL. +- */ ++ */ + + cs_vendor_coef_set(codec, IDX_BEEP_CFG, coef); + } +@@ -284,13 +287,6 @@ static const struct hda_verb cs_errata_init_verbs[] = { + {0x11, AC_VERB_SET_COEF_INDEX, 0x0001}, + {0x11, AC_VERB_SET_PROC_COEF, 0x0008}, + {0x11, AC_VERB_SET_PROC_STATE, 0x00}, +- +-#if 0 /* Don't to set to D3 as we are in power-up sequence */ +- {0x07, AC_VERB_SET_POWER_STATE, 0x03}, /* S/PDIF Rx: D3 */ +- {0x08, AC_VERB_SET_POWER_STATE, 0x03}, /* S/PDIF Tx: D3 */ +- /*{0x01, AC_VERB_SET_POWER_STATE, 0x03},*/ /* AFG: D3 This is already handled */ +-#endif +- + {} /* terminator */ + }; + +@@ -378,8 +374,10 @@ static int cs_parse_auto_config(struct hda_codec *codec) + /* keep the ADCs powered up when it's dynamically switchable */ + if (spec->gen.dyn_adc_switch) { + unsigned int done = 0; ++ + for (i = 0; i < spec->gen.input_mux.num_items; i++) { + int idx = spec->gen.dyn_adc_idx[i]; ++ + if (done & (1 << idx)) + continue; + snd_hda_gen_fix_pin_power(codec, +@@ -513,6 +511,7 @@ static void cs420x_fixup_gpio_13(struct hda_codec *codec, + { + if (action == HDA_FIXUP_ACT_PRE_PROBE) { + struct cs_spec *spec = codec->spec; ++ + spec->gpio_eapd_hp = 2; /* GPIO1 = headphones */ + spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ + spec->gpio_mask = spec->gpio_dir = +@@ -525,6 +524,7 @@ static void cs420x_fixup_gpio_23(struct hda_codec *codec, + { + if (action == HDA_FIXUP_ACT_PRE_PROBE) { + struct cs_spec *spec = codec->spec; ++ + spec->gpio_eapd_hp = 4; /* GPIO2 = headphones */ + spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ + spec->gpio_mask = spec->gpio_dir = +@@ -669,6 +669,7 @@ static void cs4208_fixup_gpio0(struct hda_codec *codec, + { + if (action == HDA_FIXUP_ACT_PRE_PROBE) { + struct cs_spec *spec = codec->spec; ++ + spec->gpio_eapd_hp = 0; + spec->gpio_eapd_speaker = 1; + spec->gpio_mask = spec->gpio_dir = +@@ -823,7 +824,7 @@ static int patch_cs4208(struct hda_codec *codec) + * 1 DAC => HP(sense) / Speakers, + * 1 ADC <= LineIn(sense) / MicIn / DMicIn, + * 1 SPDIF OUT => SPDIF Trasmitter(sense) +-*/ ++ */ + + /* CS4210 board names */ + static const struct hda_model_fixup cs421x_models[] = { +@@ -866,6 +867,7 @@ static void cs421x_fixup_sense_b(struct hda_codec *codec, + const struct hda_fixup *fix, int action) + { + struct cs_spec *spec = codec->spec; ++ + if (action == HDA_FIXUP_ACT_PRE_PROBE) + spec->sense_b = 1; + } +@@ -891,9 +893,9 @@ static const struct hda_verb cs421x_coef_init_verbs[] = { + {0x0B, AC_VERB_SET_PROC_STATE, 1}, + {0x0B, AC_VERB_SET_COEF_INDEX, CS421X_IDX_DEV_CFG}, + /* +- Disable Coefficient Index Auto-Increment(DAI)=1, +- PDREF=0 +- */ ++ * Disable Coefficient Index Auto-Increment(DAI)=1, ++ * PDREF=0 ++ */ + {0x0B, AC_VERB_SET_PROC_COEF, 0x0001 }, + + {0x0B, AC_VERB_SET_COEF_INDEX, CS421X_IDX_ADC_CFG}, +@@ -980,12 +982,12 @@ static int cs421x_boost_vol_put(struct snd_kcontrol *kcontrol, + + coef &= ~0x0003; + coef |= (vol & 0x0003); +- if (original_coef == coef) +- return 0; +- else { ++ if (original_coef != coef) { + cs_vendor_coef_set(codec, CS421X_IDX_SPK_CTL, coef); + return 1; + } ++ ++ return 0; + } + + static const struct snd_kcontrol_new cs421x_speaker_boost_ctl = { +@@ -1024,8 +1026,8 @@ static void cs4210_pinmux_init(struct hda_codec *codec) + is_active_pin(codec, CS421X_DMIC_PIN_NID)) { + + /* +- GPIO or SENSE_B forced - disconnect the DMIC pin. +- */ ++ * GPIO or SENSE_B forced - disconnect the DMIC pin. ++ */ + def_conf = snd_hda_codec_get_pincfg(codec, CS421X_DMIC_PIN_NID); + def_conf &= ~AC_DEFCFG_PORT_CONN; + def_conf |= (AC_JACK_PORT_NONE << AC_DEFCFG_PORT_CONN_SHIFT); +@@ -1064,6 +1066,7 @@ static void parse_cs421x_digital(struct hda_codec *codec) + + for (i = 0; i < cfg->dig_outs; i++) { + hda_nid_t nid = cfg->dig_out_pins[i]; ++ + if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { + spec->spdif_detect = 1; + snd_hda_jack_detect_enable_callback(codec, nid, +@@ -1142,9 +1145,9 @@ static int cs421x_parse_auto_config(struct hda_codec *codec) + + #ifdef CONFIG_PM + /* +- Manage PDREF, when transitioning to D3hot +- (DAC,ADC) -> D3, PDREF=1, AFG->D3 +-*/ ++ * Manage PDREF, when transitioning to D3hot ++ * (DAC,ADC) -> D3, PDREF=1, AFG->D3 ++ */ + static int cs421x_suspend(struct hda_codec *codec) + { + struct cs_spec *spec = codec->spec; +@@ -1195,10 +1198,10 @@ static int patch_cs4210(struct hda_codec *codec) + snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); + + /* +- Update the GPIO/DMIC/SENSE_B pinmux before the configuration +- is auto-parsed. If GPIO or SENSE_B is forced, DMIC input +- is disabled. +- */ ++ * Update the GPIO/DMIC/SENSE_B pinmux before the configuration ++ * is auto-parsed. If GPIO or SENSE_B is forced, DMIC input ++ * is disabled. ++ */ + cs4210_pinmux_init(codec); + + err = cs421x_parse_auto_config(codec); +@@ -1502,8 +1505,8 @@ static const struct cs8409_cir_param cs8409_cs42l42_hw_cfg[] = { + */ + static void cs8409_enable_i2c_clock(struct hda_codec *codec, unsigned int enable) + { +- unsigned int retval = 0; +- unsigned int newval = 0; ++ unsigned int retval; ++ unsigned int newval; + + retval = cs_vendor_coef_get(codec, 0x0); + newval = (enable) ? (retval | 0x8) : (retval & 0xfffffff7); +@@ -1698,13 +1701,13 @@ static int cs8409_cs42l42_volume_get(struct snd_kcontrol *kcontrol, + } + switch (nid) { + case CS8409_CS42L42_HP_PIN_NID: +- if (chs & 1) ++ if (chs & BIT(0)) + *valp++ = spec->cs42l42_hp_volume[0]; +- if (chs & 2) ++ if (chs & BIT(1)) + *valp++ = spec->cs42l42_hp_volume[1]; + break; + case CS8409_CS42L42_AMIC_PIN_NID: +- if (chs & 1) ++ if (chs & BIT(0)) + *valp++ = spec->cs42l42_hs_mic_volume[0]; + break; + default: +@@ -1722,19 +1725,19 @@ static int cs8409_cs42l42_volume_put(struct snd_kcontrol *kcontrol, + int chs = get_amp_channels(kcontrol); + long *valp = ucontrol->value.integer.value; + int change = 0; +- char vol = 0; ++ char vol; + + snd_hda_power_up(codec); + switch (nid) { + case CS8409_CS42L42_HP_PIN_NID: + mutex_lock(&spec->cs8409_i2c_mux); +- if (chs & 1) { ++ if (chs & BIT(0)) { + vol = -(*valp); + change = cs8409_i2c_write(codec, CS42L42_I2C_ADDR, + CS8409_CS42L42_REG_HS_VOLUME_CHA, vol, 1); + valp++; + } +- if (chs & 2) { ++ if (chs & BIT(1)) { + vol = -(*valp); + change |= cs8409_i2c_write(codec, CS42L42_I2C_ADDR, + CS8409_CS42L42_REG_HS_VOLUME_CHB, vol, 1); +@@ -1743,7 +1746,7 @@ static int cs8409_cs42l42_volume_put(struct snd_kcontrol *kcontrol, + break; + case CS8409_CS42L42_AMIC_PIN_NID: + mutex_lock(&spec->cs8409_i2c_mux); +- if (chs & 1) { ++ if (chs & BIT(0)) { + change = cs8409_i2c_write( + codec, CS42L42_I2C_ADDR, + CS8409_CS42L42_REG_AMIC_VOLUME, (char)*valp, 1); +@@ -1907,7 +1910,7 @@ static void cs8409_jack_unsol_event(struct hda_codec *codec, unsigned int res) + int reg_cdc_status; + int reg_hs_status; + int reg_ts_status; +- int type = 0; ++ int type; + struct hda_jack_tbl *jk; + + /* jack_unsol_event() will be called every time gpio line changing state. +@@ -1984,7 +1987,7 @@ static void cs8409_jack_unsol_event(struct hda_codec *codec, unsigned int res) + if (status_changed) { + + snd_hda_set_pin_ctl(codec, CS8409_CS42L42_SPK_PIN_NID, +- (spec->cs42l42_hp_jack_in)?0 : PIN_OUT); ++ spec->cs42l42_hp_jack_in ? 0 : PIN_OUT); + + /* Report jack*/ + jk = snd_hda_jack_tbl_get_mst(codec, CS8409_CS42L42_HP_PIN_NID, 0); +@@ -2072,18 +2075,18 @@ static void cs8409_enable_ur(struct hda_codec *codec, int flag) + /* GPIO4 INT# and GPIO3 WAKE# */ + snd_hda_codec_write(codec, codec->core.afg, + 0, AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, +- flag?(GPIO3_INT | GPIO4_INT) : 0); ++ flag ? (GPIO3_INT | GPIO4_INT) : 0); + + snd_hda_codec_write(codec, codec->core.afg, + 0, AC_VERB_SET_UNSOLICITED_ENABLE, +- flag?AC_UNSOL_ENABLED : 0); ++ flag ? AC_UNSOL_ENABLED : 0); + + } + + /* Vendor specific HW configuration + * PLL, ASP, I2C, SPI, GPIOs, DMIC etc... + */ +-static int cs8409_cs42l42_hw_init(struct hda_codec *codec) ++static void cs8409_cs42l42_hw_init(struct hda_codec *codec) + { + const struct cs8409_cir_param *seq = cs8409_cs42l42_hw_cfg; + struct cs_spec *spec = codec->spec; +@@ -2123,14 +2126,16 @@ static int cs8409_cs42l42_hw_init(struct hda_codec *codec) + if (spec->cs42l42_volume_init) { + mutex_lock(&spec->cs8409_i2c_mux); + cs8409_i2c_write(codec, CS42L42_I2C_ADDR, +- CS8409_CS42L42_REG_HS_VOLUME_CHA, -spec->cs42l42_hp_volume[0], ++ CS8409_CS42L42_REG_HS_VOLUME_CHA, ++ -spec->cs42l42_hp_volume[0], + 1); + cs8409_i2c_write(codec, CS42L42_I2C_ADDR, +- CS8409_CS42L42_REG_HS_VOLUME_CHB, -spec->cs42l42_hp_volume[1], ++ CS8409_CS42L42_REG_HS_VOLUME_CHB, ++ -spec->cs42l42_hp_volume[1], + 1); +- cs8409_i2c_write( +- codec, CS42L42_I2C_ADDR, +- CS8409_CS42L42_REG_AMIC_VOLUME, spec->cs42l42_hs_mic_volume[0], ++ cs8409_i2c_write(codec, CS42L42_I2C_ADDR, ++ CS8409_CS42L42_REG_AMIC_VOLUME, ++ spec->cs42l42_hs_mic_volume[0], + 1); + mutex_unlock(&spec->cs8409_i2c_mux); + } +@@ -2141,15 +2146,11 @@ static int cs8409_cs42l42_hw_init(struct hda_codec *codec) + + /* Enable Unsolicited Response */ + cs8409_enable_ur(codec, 1); +- +- return 1; + } + + static int cs8409_cs42l42_init(struct hda_codec *codec) + { +- int ret = 0; +- +- ret = snd_hda_gen_init(codec); ++ int ret = snd_hda_gen_init(codec); + + if (!ret) { + /* On Dell platforms with suspend D3 mode support we +@@ -2181,9 +2182,9 @@ static const struct hda_codec_ops cs8409_cs42l42_patch_ops = { + + static int cs8409_cs42l42_fixup(struct hda_codec *codec) + { +- int err = 0; ++ int err; + struct cs_spec *spec = codec->spec; +- unsigned int pincap = 0; ++ int caps; + + /* Basic initial sequence for specific hw configuration */ + snd_hda_sequence_write(codec, cs8409_cs42l42_init_verbs); +@@ -2198,25 +2199,25 @@ static int cs8409_cs42l42_fixup(struct hda_codec *codec) + * capabilities. We have to override pin capabilities, + * otherwise they will not be created as input devices. + */ +- _snd_hdac_read_parm(&codec->core, +- CS8409_CS42L42_HP_PIN_NID, AC_PAR_PIN_CAP, &pincap); +- +- snd_hdac_override_parm(&codec->core, ++ caps = snd_hdac_read_parm(&codec->core, CS8409_CS42L42_HP_PIN_NID, ++ AC_PAR_PIN_CAP); ++ if (caps >= 0) ++ snd_hdac_override_parm(&codec->core, + CS8409_CS42L42_HP_PIN_NID, AC_PAR_PIN_CAP, +- (pincap | (AC_PINCAP_IMP_SENSE | AC_PINCAP_PRES_DETECT))); ++ (caps | (AC_PINCAP_IMP_SENSE | AC_PINCAP_PRES_DETECT))); + +- _snd_hdac_read_parm(&codec->core, CS8409_CS42L42_AMIC_PIN_NID, +- AC_PAR_PIN_CAP, &pincap); +- +- snd_hdac_override_parm(&codec->core, ++ caps = snd_hdac_read_parm(&codec->core, CS8409_CS42L42_AMIC_PIN_NID, ++ AC_PAR_PIN_CAP); ++ if (caps >= 0) ++ snd_hdac_override_parm(&codec->core, + CS8409_CS42L42_AMIC_PIN_NID, AC_PAR_PIN_CAP, +- (pincap | (AC_PINCAP_IMP_SENSE | AC_PINCAP_PRES_DETECT))); ++ (caps | (AC_PINCAP_IMP_SENSE | AC_PINCAP_PRES_DETECT))); + + snd_hda_override_wcaps(codec, CS8409_CS42L42_HP_PIN_NID, +- (get_wcaps(codec, CS8409_CS42L42_HP_PIN_NID) | AC_WCAP_UNSOL_CAP)); ++ (get_wcaps(codec, CS8409_CS42L42_HP_PIN_NID) | AC_WCAP_UNSOL_CAP)); + + snd_hda_override_wcaps(codec, CS8409_CS42L42_AMIC_PIN_NID, +- (get_wcaps(codec, CS8409_CS42L42_AMIC_PIN_NID) | AC_WCAP_UNSOL_CAP)); ++ (get_wcaps(codec, CS8409_CS42L42_AMIC_PIN_NID) | AC_WCAP_UNSOL_CAP)); + + snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); + +@@ -2238,7 +2239,7 @@ static int cs8409_cs42l42_fixup(struct hda_codec *codec) + + snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); + +- return err; ++ return 0; + } + + static int cs8409_cs42l42_exec_verb(struct hdac_device *dev, +@@ -2247,11 +2248,8 @@ static int cs8409_cs42l42_exec_verb(struct hdac_device *dev, + struct hda_codec *codec = container_of(dev, struct hda_codec, core); + struct cs_spec *spec = codec->spec; + +- unsigned int nid = 0; +- unsigned int verb = 0; +- +- nid = ((cmd >> 20) & 0x07f); +- verb = ((cmd >> 8) & 0x0fff); ++ unsigned int nid = ((cmd >> 20) & 0x07f); ++ unsigned int verb = ((cmd >> 8) & 0x0fff); + + /* CS8409 pins have no AC_PINSENSE_PRESENCE + * capabilities. We have to intercept 2 calls for pins 0x24 and 0x34 +@@ -2327,9 +2325,6 @@ static int patch_cs8409(struct hda_codec *codec) + spec->cs42l42_mic_jack_in = 0; + + err = cs8409_cs42l42_fixup(codec); +- +- if (err > 0) +- err = cs8409_cs42l42_hw_init(codec); + break; + + default: +@@ -2338,10 +2333,12 @@ static int patch_cs8409(struct hda_codec *codec) + codec->bus->pci->subsystem_device); + break; + } +- if (err < 0) +- cs_free(codec); +- else ++ ++ if (!err) { ++ cs8409_cs42l42_hw_init(codec); + snd_hda_codec_set_name(codec, "CS8409/CS42L42"); ++ } else ++ cs_free(codec); + + return err; + } +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-cirrus-Fix-CS42L42-Headset-Mic-volume-contr.patch b/patches.suse/ALSA-hda-cirrus-Fix-CS42L42-Headset-Mic-volume-contr.patch new file mode 100644 index 0000000..cdff240 --- /dev/null +++ b/patches.suse/ALSA-hda-cirrus-Fix-CS42L42-Headset-Mic-volume-contr.patch @@ -0,0 +1,41 @@ +From 9f8de3b7d789693008b65a4849bc444e81fcfe5a Mon Sep 17 00:00:00 2001 +From: Stefan Binding +Date: Mon, 15 Mar 2021 19:07:15 +0000 +Subject: [PATCH] ALSA: hda/cirrus: Fix CS42L42 Headset Mic volume control name +Git-commit: 9f8de3b7d789693008b65a4849bc444e81fcfe5a +Patch-mainline: v5.13-rc1 +References: git-fixes + +Existing name "Headset Mic Volume Control" causes multiple Microphone +entries to appear in UI. Using name "Mic Volume Control" ensures only a +single Microphone entry exists when the Headset is connected. + +Tested on DELL Inspiron-3505, DELL Inspiron-3501, DELL Inspiron-3500 + +Signed-off-by: Stefan Binding +Signed-off-by: Vitaly Rodionov +Buglink: https://bugs.launchpad.net/bugs/1918378 +Reported-and-tested-by: You-Sheng Yang +Link: https://lore.kernel.org/r/20210315190716.47686-4-vitalyr@opensource.cirrus.com +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_cirrus.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c +index 275bba02cc05..c99ec5e485af 100644 +--- a/sound/pci/hda/patch_cirrus.c ++++ b/sound/pci/hda/patch_cirrus.c +@@ -1789,7 +1789,7 @@ static const struct snd_kcontrol_new cs8409_cs42l42_hp_volume_mixer = { + static const struct snd_kcontrol_new cs8409_cs42l42_amic_volume_mixer = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .index = 0, +- .name = "Headset Mic Capture Volume", ++ .name = "Mic Capture Volume", + .subdevice = (HDA_SUBDEV_AMP_FLAG | HDA_SUBDEV_NID_FLAG), + .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE + | SNDRV_CTL_ELEM_ACCESS_TLV_READ), +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-cirrus-Make-CS8409-driver-more-generic-by-u.patch b/patches.suse/ALSA-hda-cirrus-Make-CS8409-driver-more-generic-by-u.patch new file mode 100644 index 0000000..e92684a --- /dev/null +++ b/patches.suse/ALSA-hda-cirrus-Make-CS8409-driver-more-generic-by-u.patch @@ -0,0 +1,419 @@ +From 7a114444af813ee35dbe0ef6d26ffb56b309549b Mon Sep 17 00:00:00 2001 +From: Stefan Binding +Date: Mon, 15 Mar 2021 19:07:16 +0000 +Subject: [PATCH] ALSA: hda/cirrus: Make CS8409 driver more generic by using fixups. +Git-commit: 7a114444af813ee35dbe0ef6d26ffb56b309549b +Patch-mainline: v5.13-rc1 +References: git-fixes + +CS8409/CS42L42 Driver currently does most of the platform specific +setup inside the main body of the code, however, this setup can be +moved into fixup functions, to make the driver more generic. + +Making the driver more generic, allows the driver to use the +cs_parse_auto_config function in the patch function. This function +forces all of the ADCs to be permanently powered, which means the +cap_sync_hook function is no longer needed to restart the stream, when +the jack has been ejected. + +Since the codec is re-initialized on every init/resume, there is no +need to add specific verbs to be run on init, and instead these can +be combined with the initialization verbs, which are run on init. + +In addition, the extra fixup verbs are no longer required, since this +is taken care of elsewhere. + +Tested on DELL Inspiron-3505, DELL Inspiron-3501, DELL Inspiron-3500 + +[ Use fallthrough macro instead of comment -- tiwai ] + +Signed-off-by: Stefan Binding +Signed-off-by: Vitaly Rodionov +Link: https://lore.kernel.org/r/20210315190716.47686-5-vitalyr@opensource.cirrus.com +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_cirrus.c | 280 ++++++++++++----------------------- + 1 file changed, 98 insertions(+), 182 deletions(-) + +diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c +index c99ec5e485af..5d57096b3a95 100644 +--- a/sound/pci/hda/patch_cirrus.c ++++ b/sound/pci/hda/patch_cirrus.c +@@ -1292,9 +1292,14 @@ enum { + CS8409_BULLSEYE, + CS8409_WARLOCK, + CS8409_CYBORG, +- CS8409_VERBS, ++ CS8409_FIXUPS, + }; + ++static void cs8409_cs42l42_fixups(struct hda_codec *codec, ++ const struct hda_fixup *fix, int action); ++static int cs8409_cs42l42_exec_verb(struct hdac_device *dev, ++ unsigned int cmd, unsigned int flags, unsigned int *res); ++ + /* Dell Inspiron models with cs8409/cs42l42 */ + static const struct hda_model_fixup cs8409_models[] = { + { .id = CS8409_BULLSEYE, .name = "bullseye" }, +@@ -1368,48 +1373,28 @@ static const struct hda_pintbl cs8409_cs42l42_pincfgs[] = { + {} /* terminator */ + }; + +-static const struct hda_verb cs8409_cs42l42_add_verbs[] = { +- { 0x24, 0x71c, 0xF0 }, /* Widget node ASP-1-TX */ +- { 0x24, 0x71d, 0x20 }, +- { 0x24, 0x71e, 0x21 }, +- { 0x24, 0x71f, 0x04 }, +- { 0x34, 0x71c, 0x50 }, /* Widget node ASP-1-RX0 */ +- { 0x34, 0x71d, 0x20 }, +- { 0x34, 0x71e, 0xa1 }, +- { 0x34, 0x71f, 0x04 }, +- { 0x2C, 0x71c, 0xF0 }, /* Widget node ASP-2-TX */ +- { 0x2C, 0x71d, 0x00 }, +- { 0x2C, 0x71e, 0x10 }, +- { 0x2C, 0x71f, 0x90 }, +- { 0x44, 0x71c, 0x90 }, /* Widget node DMIC-1 */ +- { 0x44, 0x71d, 0x00 }, +- { 0x44, 0x71e, 0xA0 }, +- { 0x44, 0x71f, 0x90 }, +- {} /* terminator */ +-}; +- + static const struct hda_fixup cs8409_fixups[] = { + [CS8409_BULLSEYE] = { + .type = HDA_FIXUP_PINS, + .v.pins = cs8409_cs42l42_pincfgs, + .chained = true, +- .chain_id = CS8409_VERBS, ++ .chain_id = CS8409_FIXUPS, + }, + [CS8409_WARLOCK] = { + .type = HDA_FIXUP_PINS, + .v.pins = cs8409_cs42l42_pincfgs, + .chained = true, +- .chain_id = CS8409_VERBS, ++ .chain_id = CS8409_FIXUPS, + }, + [CS8409_CYBORG] = { + .type = HDA_FIXUP_PINS, + .v.pins = cs8409_cs42l42_pincfgs, + .chained = true, +- .chain_id = CS8409_VERBS, ++ .chain_id = CS8409_FIXUPS, + }, +- [CS8409_VERBS] = { +- .type = HDA_FIXUP_VERBS, +- .v.verbs = cs8409_cs42l42_add_verbs, ++ [CS8409_FIXUPS] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = cs8409_cs42l42_fixups, + }, + }; + +@@ -2004,26 +1989,6 @@ static void cs8409_jack_unsol_event(struct hda_codec *codec, unsigned int res) + } + } + +-static int cs8409_cs42l42_build_controls(struct hda_codec *codec) +-{ +- int err; +- +- err = snd_hda_gen_build_controls(codec); +- if (err < 0) +- return err; +- +- snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); +- +- /* Run jack auto detect first time on boot +- * after controls have been added, to check if jack has +- * been already plugged in +- */ +- cs8409_cs42l42_run_jack_detect(codec); +- usleep_range(100000, 150000); +- +- return 0; +-} +- + #ifdef CONFIG_PM + /* Manage PDREF, when transition to D3hot */ + static int cs8409_suspend(struct hda_codec *codec) +@@ -2044,31 +2009,6 @@ static int cs8409_suspend(struct hda_codec *codec) + } + #endif + +-static void cs8409_cs42l42_cap_sync_hook(struct hda_codec *codec, +- struct snd_kcontrol *kcontrol, +- struct snd_ctl_elem_value *ucontrol) +-{ +- struct cs_spec *spec = codec->spec; +- unsigned int curval, expval; +- /* CS8409 DMIC Pin only allows the setting of the Stream Parameters in +- * Power State D0. When a headset is unplugged, and the path is switched to +- * the DMIC, the Stream is restarted with the new ADC, but this is done in +- * Power State D3. Restart the Stream now DMIC is in D0. +- */ +- if (spec->gen.cur_adc == CS8409_CS42L42_DMIC_ADC_PIN_NID) { +- curval = snd_hda_codec_read(codec, spec->gen.cur_adc, +- 0, AC_VERB_GET_CONV, 0); +- expval = (spec->gen.cur_adc_stream_tag << 4) | 0; +- if (curval != expval) { +- codec_dbg(codec, "%s Restarting Stream after DMIC switch\n", __func__); +- __snd_hda_codec_cleanup_stream(codec, spec->gen.cur_adc, 1); +- snd_hda_codec_setup_stream(codec, spec->gen.cur_adc, +- spec->gen.cur_adc_stream_tag, 0, +- spec->gen.cur_adc_format); +- } +- } +-} +- + /* Enable/Disable Unsolicited Response for gpio(s) 3,4 */ + static void cs8409_enable_ur(struct hda_codec *codec, int flag) + { +@@ -2152,25 +2092,14 @@ static int cs8409_cs42l42_init(struct hda_codec *codec) + { + int ret = snd_hda_gen_init(codec); + +- if (!ret) { +- /* On Dell platforms with suspend D3 mode support we +- * have to re-initialise cs8409 bridge and companion +- * cs42l42 codec +- */ +- snd_hda_sequence_write(codec, cs8409_cs42l42_init_verbs); +- snd_hda_sequence_write(codec, cs8409_cs42l42_add_verbs); +- +- cs8409_cs42l42_hw_init(codec); +- +- cs8409_cs42l42_run_jack_detect(codec); +- usleep_range(100000, 150000); +- } ++ if (!ret) ++ snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); + + return ret; + } + + static const struct hda_codec_ops cs8409_cs42l42_patch_ops = { +- .build_controls = cs8409_cs42l42_build_controls, ++ .build_controls = cs_build_controls, + .build_pcms = snd_hda_gen_build_pcms, + .init = cs8409_cs42l42_init, + .free = cs_free, +@@ -2180,66 +2109,91 @@ static const struct hda_codec_ops cs8409_cs42l42_patch_ops = { + #endif + }; + +-static int cs8409_cs42l42_fixup(struct hda_codec *codec) ++static void cs8409_cs42l42_fixups(struct hda_codec *codec, ++ const struct hda_fixup *fix, int action) + { +- int err; + struct cs_spec *spec = codec->spec; + int caps; + +- /* Basic initial sequence for specific hw configuration */ +- snd_hda_sequence_write(codec, cs8409_cs42l42_init_verbs); +- +- /* CS8409 is simple HDA bridge and intended to be used with a remote +- * companion codec. Most of input/output PIN(s) have only basic +- * capabilities. NID(s) 0x24 and 0x34 have only OUTC and INC +- * capabilities and no presence detect capable (PDC) and call to +- * snd_hda_gen_build_controls() will mark them as non detectable +- * phantom jacks. However, in this configuration companion codec +- * CS42L42 is connected to these pins and it has jack detect +- * capabilities. We have to override pin capabilities, +- * otherwise they will not be created as input devices. +- */ +- caps = snd_hdac_read_parm(&codec->core, CS8409_CS42L42_HP_PIN_NID, +- AC_PAR_PIN_CAP); +- if (caps >= 0) +- snd_hdac_override_parm(&codec->core, +- CS8409_CS42L42_HP_PIN_NID, AC_PAR_PIN_CAP, +- (caps | (AC_PINCAP_IMP_SENSE | AC_PINCAP_PRES_DETECT))); +- +- caps = snd_hdac_read_parm(&codec->core, CS8409_CS42L42_AMIC_PIN_NID, +- AC_PAR_PIN_CAP); +- if (caps >= 0) +- snd_hdac_override_parm(&codec->core, +- CS8409_CS42L42_AMIC_PIN_NID, AC_PAR_PIN_CAP, +- (caps | (AC_PINCAP_IMP_SENSE | AC_PINCAP_PRES_DETECT))); +- +- snd_hda_override_wcaps(codec, CS8409_CS42L42_HP_PIN_NID, +- (get_wcaps(codec, CS8409_CS42L42_HP_PIN_NID) | AC_WCAP_UNSOL_CAP)); +- +- snd_hda_override_wcaps(codec, CS8409_CS42L42_AMIC_PIN_NID, +- (get_wcaps(codec, CS8409_CS42L42_AMIC_PIN_NID) | AC_WCAP_UNSOL_CAP)); ++ switch (action) { ++ case HDA_FIXUP_ACT_PRE_PROBE: ++ snd_hda_add_verbs(codec, cs8409_cs42l42_init_verbs); ++ /* verb exec op override */ ++ spec->exec_verb = codec->core.exec_verb; ++ codec->core.exec_verb = cs8409_cs42l42_exec_verb; + +- snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); ++ mutex_init(&spec->cs8409_i2c_mux); + +- err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, 0, 0); +- if (err < 0) +- return err; ++ codec->patch_ops = cs8409_cs42l42_patch_ops; + +- err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); +- if (err < 0) +- return err; ++ spec->gen.suppress_auto_mute = 1; ++ spec->gen.no_primary_hp = 1; ++ spec->gen.suppress_vmaster = 1; + +- if (!snd_hda_gen_add_kctl( +- &spec->gen, NULL, &cs8409_cs42l42_hp_volume_mixer)) +- return -1; ++ /* GPIO 5 out, 3,4 in */ ++ spec->gpio_dir = GPIO5_INT; ++ spec->gpio_data = 0; ++ spec->gpio_mask = 0x03f; + +- if (!snd_hda_gen_add_kctl( +- &spec->gen, NULL, &cs8409_cs42l42_amic_volume_mixer)) +- return -1; ++ spec->cs42l42_hp_jack_in = 0; ++ spec->cs42l42_mic_jack_in = 0; + +- snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); ++ /* Basic initial sequence for specific hw configuration */ ++ snd_hda_sequence_write(codec, cs8409_cs42l42_init_verbs); + +- return 0; ++ /* CS8409 is simple HDA bridge and intended to be used with a remote ++ * companion codec. Most of input/output PIN(s) have only basic ++ * capabilities. NID(s) 0x24 and 0x34 have only OUTC and INC ++ * capabilities and no presence detect capable (PDC) and call to ++ * snd_hda_gen_build_controls() will mark them as non detectable ++ * phantom jacks. However, in this configuration companion codec ++ * CS42L42 is connected to these pins and it has jack detect ++ * capabilities. We have to override pin capabilities, ++ * otherwise they will not be created as input devices. ++ */ ++ caps = snd_hdac_read_parm(&codec->core, CS8409_CS42L42_HP_PIN_NID, ++ AC_PAR_PIN_CAP); ++ if (caps >= 0) ++ snd_hdac_override_parm(&codec->core, ++ CS8409_CS42L42_HP_PIN_NID, AC_PAR_PIN_CAP, ++ (caps | (AC_PINCAP_IMP_SENSE | AC_PINCAP_PRES_DETECT))); ++ ++ caps = snd_hdac_read_parm(&codec->core, CS8409_CS42L42_AMIC_PIN_NID, ++ AC_PAR_PIN_CAP); ++ if (caps >= 0) ++ snd_hdac_override_parm(&codec->core, ++ CS8409_CS42L42_AMIC_PIN_NID, AC_PAR_PIN_CAP, ++ (caps | (AC_PINCAP_IMP_SENSE | AC_PINCAP_PRES_DETECT))); ++ ++ snd_hda_override_wcaps(codec, CS8409_CS42L42_HP_PIN_NID, ++ (get_wcaps(codec, CS8409_CS42L42_HP_PIN_NID) | AC_WCAP_UNSOL_CAP)); ++ ++ snd_hda_override_wcaps(codec, CS8409_CS42L42_AMIC_PIN_NID, ++ (get_wcaps(codec, CS8409_CS42L42_AMIC_PIN_NID) | AC_WCAP_UNSOL_CAP)); ++ break; ++ case HDA_FIXUP_ACT_PROBE: ++ snd_hda_gen_add_kctl(&spec->gen, ++ NULL, &cs8409_cs42l42_hp_volume_mixer); ++ snd_hda_gen_add_kctl(&spec->gen, ++ NULL, &cs8409_cs42l42_amic_volume_mixer); ++ cs8409_cs42l42_hw_init(codec); ++ snd_hda_codec_set_name(codec, "CS8409/CS42L42"); ++ break; ++ case HDA_FIXUP_ACT_INIT: ++ cs8409_cs42l42_hw_init(codec); ++ fallthrough; ++ case HDA_FIXUP_ACT_BUILD: ++ /* Run jack auto detect first time on boot ++ * after controls have been added, to check if jack has ++ * been already plugged in. ++ * Run immediately after init. ++ */ ++ cs8409_cs42l42_run_jack_detect(codec); ++ usleep_range(100000, 150000); ++ break; ++ default: ++ break; ++ } + } + + static int cs8409_cs42l42_exec_verb(struct hdac_device *dev, +@@ -2280,11 +2234,9 @@ static int cs8409_cs42l42_exec_verb(struct hdac_device *dev, + + static int patch_cs8409(struct hda_codec *codec) + { +- struct cs_spec *spec; +- int err = -EINVAL; ++ int err; + +- spec = cs_alloc_spec(codec, CS8409_VENDOR_NID); +- if (!spec) ++ if (!cs_alloc_spec(codec, CS8409_VENDOR_NID)) + return -ENOMEM; + + snd_hda_pick_fixup(codec, +@@ -2295,52 +2247,16 @@ static int patch_cs8409(struct hda_codec *codec) + codec->bus->pci->subsystem_vendor, + codec->bus->pci->subsystem_device); + +- switch (codec->fixup_id) { +- /* Dell platforms with CS42L42 companion codec */ +- case CS8409_BULLSEYE: +- case CS8409_WARLOCK: +- case CS8409_CYBORG: +- +- snd_hda_add_verbs(codec, cs8409_cs42l42_add_verbs); +- +- /* verb exec op override */ +- spec->exec_verb = codec->core.exec_verb; +- codec->core.exec_verb = cs8409_cs42l42_exec_verb; +- +- mutex_init(&spec->cs8409_i2c_mux); +- +- codec->patch_ops = cs8409_cs42l42_patch_ops; +- +- spec->gen.cap_sync_hook = cs8409_cs42l42_cap_sync_hook; +- +- spec->gen.suppress_auto_mute = 1; +- spec->gen.no_primary_hp = 1; +- spec->gen.suppress_vmaster = 1; +- /* GPIO 5 out, 3,4 in */ +- spec->gpio_dir = GPIO5_INT; +- spec->gpio_data = 0; +- spec->gpio_mask = 0x03f; +- +- spec->cs42l42_hp_jack_in = 0; +- spec->cs42l42_mic_jack_in = 0; +- +- err = cs8409_cs42l42_fixup(codec); +- break; +- +- default: +- codec_err(codec, "VID=%08x, DEV=%08x not supported\n", +- codec->bus->pci->subsystem_vendor, +- codec->bus->pci->subsystem_device); +- break; +- } ++ snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); + +- if (!err) { +- cs8409_cs42l42_hw_init(codec); +- snd_hda_codec_set_name(codec, "CS8409/CS42L42"); +- } else ++ err = cs_parse_auto_config(codec); ++ if (err < 0) { + cs_free(codec); ++ return err; ++ } + +- return err; ++ snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); ++ return 0; + } + + /* +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-cirrus-Set-Initial-DMIC-volume-for-Bullseye.patch b/patches.suse/ALSA-hda-cirrus-Set-Initial-DMIC-volume-for-Bullseye.patch new file mode 100644 index 0000000..5bdd03d --- /dev/null +++ b/patches.suse/ALSA-hda-cirrus-Set-Initial-DMIC-volume-for-Bullseye.patch @@ -0,0 +1,44 @@ +From 0e853a9c3937caa9f13fdde547d6202f92457c2b Mon Sep 17 00:00:00 2001 +From: Stefan Binding +Date: Mon, 26 Apr 2021 17:37:48 +0100 +Subject: [PATCH] ALSA: hda/cirrus: Set Initial DMIC volume for Bullseye to -26 dB +Git-commit: 0e853a9c3937caa9f13fdde547d6202f92457c2b +Patch-mainline: v5.13-rc1 +References: git-fixes + +After booting for first time on Bullseye, the DMIC is currently muted. +Instead, the DMIC volume should be set to a valid initial value. + +Tested on DELL Inspiron-3505, DELL Inspiron-3501, DELL Inspiron-3500 + +Signed-off-by: Stefan Binding +Signed-off-by: Vitaly Rodionov +Buglink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1923557 +Reported-and-tested-by: You-Sheng Yang +Cc: +Link: https://lore.kernel.org/r/20210426163749.196153-2-vitalyr@opensource.cirrus.com +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_cirrus.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c +index 5d57096b3a95..a4f82f147ff3 100644 +--- a/sound/pci/hda/patch_cirrus.c ++++ b/sound/pci/hda/patch_cirrus.c +@@ -2172,6 +2172,11 @@ static void cs8409_cs42l42_fixups(struct hda_codec *codec, + (get_wcaps(codec, CS8409_CS42L42_AMIC_PIN_NID) | AC_WCAP_UNSOL_CAP)); + break; + case HDA_FIXUP_ACT_PROBE: ++ ++ /* Set initial volume on Bullseye to -26 dB */ ++ if (codec->fixup_id == CS8409_BULLSEYE) ++ snd_hda_codec_amp_init_stereo(codec, CS8409_CS42L42_DMIC_ADC_PIN_NID, ++ HDA_INPUT, 0, 0xff, 0x19); + snd_hda_gen_add_kctl(&spec->gen, + NULL, &cs8409_cs42l42_hp_volume_mixer); + snd_hda_gen_add_kctl(&spec->gen, +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-cirrus-Use-CS8409-filter-to-fix-abnormal-so.patch b/patches.suse/ALSA-hda-cirrus-Use-CS8409-filter-to-fix-abnormal-so.patch new file mode 100644 index 0000000..bba71a6 --- /dev/null +++ b/patches.suse/ALSA-hda-cirrus-Use-CS8409-filter-to-fix-abnormal-so.patch @@ -0,0 +1,90 @@ +From 45b14fe200ba0611b6c3874aa5bba584dc979fb9 Mon Sep 17 00:00:00 2001 +From: Stefan Binding +Date: Mon, 26 Apr 2021 17:37:49 +0100 +Subject: [PATCH] ALSA: hda/cirrus: Use CS8409 filter to fix abnormal sounds on Bullseye +Git-commit: 45b14fe200ba0611b6c3874aa5bba584dc979fb9 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Cracking noises have been reported on the built-in speaker for certain +Bullseye platforms, when volume is > 80%. + +This issue is caused by the specific combination of Codec and AMP in +this platform, and cannot be fixed by the AMP, so indead must be fixed +at codec level, by adding attenuation to the volume. + +Tested on DELL Inspiron-3505, DELL Inspiron-3501, DELL Inspiron-3500 + +Signed-off-by: Stefan Binding +Signed-off-by: Vitaly Rodionov +Buglink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1924997 +Reported-and-tested-by: You-Sheng Yang +Cc: +Link: https://lore.kernel.org/r/20210426163749.196153-3-vitalyr@opensource.cirrus.com +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_cirrus.c | 33 +++++++++++++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + +diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c +index a4f82f147ff3..726507d0b04c 100644 +--- a/sound/pci/hda/patch_cirrus.c ++++ b/sound/pci/hda/patch_cirrus.c +@@ -1481,6 +1481,34 @@ static const struct cs8409_cir_param cs8409_cs42l42_hw_cfg[] = { + {} /* Terminator */ + }; + ++static const struct cs8409_cir_param cs8409_cs42l42_bullseye_atn[] = { ++ { 0x47, 0x65, 0x4000 }, /* EQ_SEL=1, EQ1/2_EN=0 */ ++ { 0x47, 0x64, 0x4000 }, /* +EQ_ACC */ ++ { 0x47, 0x65, 0x4010 }, /* +EQ2_EN */ ++ { 0x47, 0x63, 0x0647 }, /* EQ_DATA_HI=0x0647 */ ++ { 0x47, 0x64, 0xc0c7 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=0, EQ_DATA_LO=0x67 */ ++ { 0x47, 0x63, 0x0647 }, /* EQ_DATA_HI=0x0647 */ ++ { 0x47, 0x64, 0xc1c7 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=1, EQ_DATA_LO=0x67 */ ++ { 0x47, 0x63, 0xf370 }, /* EQ_DATA_HI=0xf370 */ ++ { 0x47, 0x64, 0xc271 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=2, EQ_DATA_LO=0x71 */ ++ { 0x47, 0x63, 0x1ef8 }, /* EQ_DATA_HI=0x1ef8 */ ++ { 0x47, 0x64, 0xc348 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=3, EQ_DATA_LO=0x48 */ ++ { 0x47, 0x63, 0xc110 }, /* EQ_DATA_HI=0xc110 */ ++ { 0x47, 0x64, 0xc45a }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=4, EQ_DATA_LO=0x5a */ ++ { 0x47, 0x63, 0x1f29 }, /* EQ_DATA_HI=0x1f29 */ ++ { 0x47, 0x64, 0xc574 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=5, EQ_DATA_LO=0x74 */ ++ { 0x47, 0x63, 0x1d7a }, /* EQ_DATA_HI=0x1d7a */ ++ { 0x47, 0x64, 0xc653 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=6, EQ_DATA_LO=0x53 */ ++ { 0x47, 0x63, 0xc38c }, /* EQ_DATA_HI=0xc38c */ ++ { 0x47, 0x64, 0xc714 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=7, EQ_DATA_LO=0x14 */ ++ { 0x47, 0x63, 0x1ca3 }, /* EQ_DATA_HI=0x1ca3 */ ++ { 0x47, 0x64, 0xc8c7 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=8, EQ_DATA_LO=0xc7 */ ++ { 0x47, 0x63, 0xc38c }, /* EQ_DATA_HI=0xc38c */ ++ { 0x47, 0x64, 0xc914 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=9, EQ_DATA_LO=0x14 */ ++ { 0x47, 0x64, 0x0000 }, /* -EQ_ACC, -EQ_WRT */ ++ {} /* Terminator */ ++}; ++ + /** + * cs8409_enable_i2c_clock - Enable I2C clocks + * @codec: the codec instance +@@ -2029,6 +2057,7 @@ static void cs8409_enable_ur(struct hda_codec *codec, int flag) + static void cs8409_cs42l42_hw_init(struct hda_codec *codec) + { + const struct cs8409_cir_param *seq = cs8409_cs42l42_hw_cfg; ++ const struct cs8409_cir_param *seq_bullseye = cs8409_cs42l42_bullseye_atn; + struct cs_spec *spec = codec->spec; + + if (spec->gpio_mask) { +@@ -2043,6 +2072,10 @@ static void cs8409_cs42l42_hw_init(struct hda_codec *codec) + for (; seq->nid; seq++) + cs_vendor_coef_set(codec, seq->cir, seq->coeff); + ++ if (codec->fixup_id == CS8409_BULLSEYE) ++ for (; seq_bullseye->nid; seq_bullseye++) ++ cs_vendor_coef_set(codec, seq_bullseye->cir, seq_bullseye->coeff); ++ + /* Disable Unsolicited Response during boot */ + cs8409_enable_ur(codec, 0); + +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Add-quirk-for-Intel-Clevo-PCx0Dx.patch b/patches.suse/ALSA-hda-realtek-Add-quirk-for-Intel-Clevo-PCx0Dx.patch new file mode 100644 index 0000000..3510627 --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Add-quirk-for-Intel-Clevo-PCx0Dx.patch @@ -0,0 +1,44 @@ +From 970e3012c04c96351c413f193a9c909e6d871ce2 Mon Sep 17 00:00:00 2001 +From: Eckhart Mohr +Date: Tue, 27 Apr 2021 17:30:25 +0200 +Subject: [PATCH] ALSA: hda/realtek: Add quirk for Intel Clevo PCx0Dx +Git-commit: 970e3012c04c96351c413f193a9c909e6d871ce2 +Patch-mainline: v5.13-rc1 +References: git-fixes + +This applies a SND_PCI_QUIRK(...) to the Clevo PCx0Dx barebones. This +fix enables audio output over the headset jack and ensures that a +microphone connected via the headset combo jack is correctly recognized +when pluged in. + +[ Rearranged the list entries in a sorted order -- tiwai ] + +Signed-off-by: Eckhart Mohr +Co-developed-by: Werner Sembach +Signed-off-by: Werner Sembach +Cc: +Link: https://lore.kernel.org/r/20210427153025.451118-1-wse@tuxedocomputers.com +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index f4c2b10aeb68..4a3939c45a12 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -2552,8 +2552,10 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { + SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), + SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), + SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), + SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), + SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), + SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), + SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS), + SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-GA503-use-same-quirks-as-GA401.patch b/patches.suse/ALSA-hda-realtek-GA503-use-same-quirks-as-GA401.patch new file mode 100644 index 0000000..2f677a6 --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-GA503-use-same-quirks-as-GA401.patch @@ -0,0 +1,36 @@ +From 76fae6185f5456865ff1bcb647709d44fd987eb6 Mon Sep 17 00:00:00 2001 +From: Luke D Jones +Date: Mon, 19 Apr 2021 15:04:11 +1200 +Subject: [PATCH] ALSA: hda/realtek: GA503 use same quirks as GA401 +Git-commit: 76fae6185f5456865ff1bcb647709d44fd987eb6 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The GA503 has almost exactly the same default setup as the GA401 +model with the same issues. The GA401 quirks solve all the issues +so we will use the full quirk chain. + +Signed-off-by: Luke D Jones +Cc: +Link: https://lore.kernel.org/r/20210419030411.28304-1-luke@ljones.dev +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 67aeed5d25b6..1ad1bb740c32 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8167,6 +8167,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), + SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), ++ SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), + SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Headset-Mic-issue-on-HP-platform.patch b/patches.suse/ALSA-hda-realtek-Headset-Mic-issue-on-HP-platform.patch new file mode 100644 index 0000000..3520992 --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Headset-Mic-issue-on-HP-platform.patch @@ -0,0 +1,35 @@ +From 1c9d9dfd2d254211cb37b1513b1da3e6835b8f00 Mon Sep 17 00:00:00 2001 +From: Kailang Yang +Date: Tue, 20 Apr 2021 14:17:34 +0800 +Subject: [PATCH] ALSA: hda/realtek - Headset Mic issue on HP platform +Git-commit: 1c9d9dfd2d254211cb37b1513b1da3e6835b8f00 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Boot with plugged headset, the Headset Mic will be gone. + +Signed-off-by: Kailang Yang +Cc: +Link: https://lore.kernel.org/r/207eecfc3189466a820720bc0c409ea9@realtek.com +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 1ad1bb740c32..77cb72fe3b1b 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8104,6 +8104,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC), + SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE), ++ SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC), ++ SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC), + SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), + SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC), + SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360), +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Re-order-ALC269-ASUS-quirk-table-en.patch b/patches.suse/ALSA-hda-realtek-Re-order-ALC269-ASUS-quirk-table-en.patch new file mode 100644 index 0000000..2b6a2a4 --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Re-order-ALC269-ASUS-quirk-table-en.patch @@ -0,0 +1,63 @@ +From 3cd0ed636dd19e7fbe3ebe8de8476e1718d5a8f1 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 28 Apr 2021 13:26:58 +0200 +Subject: [PATCH] ALSA: hda/realtek: Re-order ALC269 ASUS quirk table entries +Git-commit: 3cd0ed636dd19e7fbe3ebe8de8476e1718d5a8f1 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Just re-order the alc269_fixup_tbl[] entries for ASUS devices for +avoiding the oversight of the duplicated or unapplied item in future. +No functional changes. + +Also Cc-to-stable for the further patch applications. + +Cc: +Link: https://lore.kernel.org/r/20210428112704.23967-8-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 7e1accdd990f..d99666c706b7 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8151,16 +8151,18 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), + SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), ++ SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE), +- SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC), ++ SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK), + SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A), + SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), + SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK), ++ SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), + SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC), + SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC), + SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE), +@@ -8173,13 +8175,11 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), + SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), +- SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), + SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), + SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), +- SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), + SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), + SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), + SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Re-order-ALC269-Acer-quirk-table-en.patch b/patches.suse/ALSA-hda-realtek-Re-order-ALC269-Acer-quirk-table-en.patch new file mode 100644 index 0000000..7231585 --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Re-order-ALC269-Acer-quirk-table-en.patch @@ -0,0 +1,43 @@ +From 433f894ec7fbd3b4bf1f3187b2ddd566078c4aef Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 28 Apr 2021 13:26:56 +0200 +Subject: [PATCH] ALSA: hda/realtek: Re-order ALC269 Acer quirk table entries +Git-commit: 433f894ec7fbd3b4bf1f3187b2ddd566078c4aef +Patch-mainline: v5.13-rc1 +References: git-fixes + +Just re-order the alc269_fixup_tbl[] entries for Acer devices for +avoiding the oversight of the duplicated or unapplied item in future. +No functional changes. + +Also Cc-to-stable for the further patch applications. + +Cc: +Link: https://lore.kernel.org/r/20210428112704.23967-6-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 5c594b8b8723..fd7255490635 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -7971,12 +7971,12 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC), + SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700), + SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC), +- SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK), + SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK), + SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), + SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), + SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS), ++ SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF), + SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK), + SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Re-order-ALC269-Dell-quirk-table-en.patch b/patches.suse/ALSA-hda-realtek-Re-order-ALC269-Dell-quirk-table-en.patch new file mode 100644 index 0000000..8b50cd4 --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Re-order-ALC269-Dell-quirk-table-en.patch @@ -0,0 +1,49 @@ +From aa143ad39a52d968ac69e426d329bb74f270e6ca Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 28 Apr 2021 13:26:57 +0200 +Subject: [PATCH] ALSA: hda/realtek: Re-order ALC269 Dell quirk table entries +Git-commit: aa143ad39a52d968ac69e426d329bb74f270e6ca +Patch-mainline: v5.13-rc1 +References: git-fixes + +Just re-order the alc269_fixup_tbl[] entries for Dell devices for +avoiding the oversight of the duplicated or unapplied item in future. +No functional changes. + +Also Cc-to-stable for the further patch applications. + +Cc: +Link: https://lore.kernel.org/r/20210428112704.23967-7-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index fd7255490635..7e1accdd990f 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8032,8 +8032,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP), + SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME), + SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME), +- SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3), + SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER), ++ SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3), + SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), + SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), +@@ -8043,8 +8043,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), +- SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK), + SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK), ++ SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK), + SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC), +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Re-order-ALC269-HP-quirk-table-entr.patch b/patches.suse/ALSA-hda-realtek-Re-order-ALC269-HP-quirk-table-entr.patch new file mode 100644 index 0000000..21272c1 --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Re-order-ALC269-HP-quirk-table-entr.patch @@ -0,0 +1,117 @@ +From 45461e3b554c75ddff9703539f3711cc3dfb0422 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 28 Apr 2021 13:26:55 +0200 +Subject: [PATCH] ALSA: hda/realtek: Re-order ALC269 HP quirk table entries +Git-commit: 45461e3b554c75ddff9703539f3711cc3dfb0422 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Just re-order the alc269_fixup_tbl[] entries for HP devices for +avoiding the oversight of the duplicated or unapplied item in future. +No functional changes. + +Formerly, some entries were grouped for the actual codec, but this +doesn't seem reasonable to keep in that way. So now we simply keep +the PCI SSID order for the whole. + +Also Cc-to-stable for the further patch applications. + +Cc: +Link: https://lore.kernel.org/r/20210428112704.23967-5-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 44 +++++++++++++++++------------------ + 1 file changed, 21 insertions(+), 23 deletions(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 5eee67d443c2..5c594b8b8723 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8055,35 +8055,18 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), + SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED), +- SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY), +- /* ALC282 */ + SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), + SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), + SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), ++ SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), ++ SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC), ++ SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), ++ SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), + SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), + SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), + SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), + SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), + SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), +- SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), +- SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), +- SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), +- SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), +- SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED), +- SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS), +- SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS), +- SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), +- SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), +- SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), +- SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), +- SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), +- SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M), +- SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), +- SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), +- /* ALC290 */ +- SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), +- SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), +- SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), + SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), + SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), + SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), +@@ -8091,26 +8074,41 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), + SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), + SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED), ++ SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY), + SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), + SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), + SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), + SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), ++ SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), ++ SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), ++ SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), ++ SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), ++ SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), ++ SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS), + SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), ++ SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS), + SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), + SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), + SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), + SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), + SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), ++ SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), ++ SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), ++ SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), ++ SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), ++ SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), + SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), + SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), + SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), +- SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), ++ SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), ++ SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M), ++ SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), ++ SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), + SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), + SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), + SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), + SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), +- SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC), + SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC), +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Re-order-ALC269-Lenovo-quirk-table-.patch b/patches.suse/ALSA-hda-realtek-Re-order-ALC269-Lenovo-quirk-table-.patch new file mode 100644 index 0000000..83a9cd8 --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Re-order-ALC269-Lenovo-quirk-table-.patch @@ -0,0 +1,56 @@ +From f552ff54c2a700616a02b038e4bf3cbf859f65b7 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 28 Apr 2021 13:27:00 +0200 +Subject: [PATCH] ALSA: hda/realtek: Re-order ALC269 Lenovo quirk table entries +Git-commit: f552ff54c2a700616a02b038e4bf3cbf859f65b7 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Just re-order the alc269_fixup_tbl[] entries for Lenovo devices for +avoiding the oversight of the duplicated or unapplied item in future. +No functional changes. + +Also Cc-to-stable for the further patch applications. + +Cc: +Link: https://lore.kernel.org/r/20210428112704.23967-10-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 53967d50d382..539bae66a4ba 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8266,9 +8266,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), + SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), + SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), ++ SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK), + SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST), + SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK), +- SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK), + SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK), + SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK), + SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK), +@@ -8313,6 +8313,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI), + SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), + SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI), ++ SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), + SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), + SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC), + SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK), +@@ -8331,7 +8332,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), + SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), + SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), +- SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), + SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), + SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS), + SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20), +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Re-order-ALC269-Sony-quirk-table-en.patch b/patches.suse/ALSA-hda-realtek-Re-order-ALC269-Sony-quirk-table-en.patch new file mode 100644 index 0000000..b4cf998 --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Re-order-ALC269-Sony-quirk-table-en.patch @@ -0,0 +1,44 @@ +From cab561f8d4bc9b196ae20c960aa5da89fd786ab5 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 28 Apr 2021 13:26:59 +0200 +Subject: [PATCH] ALSA: hda/realtek: Re-order ALC269 Sony quirk table entries +Git-commit: cab561f8d4bc9b196ae20c960aa5da89fd786ab5 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Just re-order the alc269_fixup_tbl[] entries for Sony devices for +avoiding the oversight of the duplicated or unapplied item in future. +No functional changes. + +Also Cc-to-stable for the further patch applications. + +Cc: +Link: https://lore.kernel.org/r/20210428112704.23967-9-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index d99666c706b7..53967d50d382 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8186,12 +8186,12 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC), + SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC), + SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101), +- SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE), +- SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), + SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), + SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), + SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX), ++ SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE), ++ SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), + SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT), + SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN), +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Re-order-ALC662-quirk-table-entries.patch b/patches.suse/ALSA-hda-realtek-Re-order-ALC662-quirk-table-entries.patch new file mode 100644 index 0000000..10283ea --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Re-order-ALC662-quirk-table-entries.patch @@ -0,0 +1,57 @@ +From 9edeb1109d05953b2f0e24e5b2341a98c3fa78d5 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 28 Apr 2021 13:27:02 +0200 +Subject: [PATCH] ALSA: hda/realtek: Re-order ALC662 quirk table entries +Git-commit: 9edeb1109d05953b2f0e24e5b2341a98c3fa78d5 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Just re-order the alc662_fixup_tbl[] entries for Acer and ASUS devices +for avoiding the oversight of the duplicated or unapplied item in +future. +No functional changes. + +Also Cc-to-stable for the further patch applications. + +Cc: +Link: https://lore.kernel.org/r/20210428112704.23967-12-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 11f731b95eef..cbed3c610170 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -10086,6 +10086,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { + SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), + SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC), + SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), ++ SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS), + SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE), + SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE), + SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), +@@ -10102,9 +10103,9 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { + SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2), + SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE), + SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50), +- SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A), + SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50), + SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751), ++ SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A), + SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), + SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16), + SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51), +@@ -10124,7 +10125,6 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { + SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON), + SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26), + SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), +- SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS), + + #if 0 + /* Below is a quirk table taken from the old code. +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Re-order-ALC882-Acer-quirk-table-en.patch b/patches.suse/ALSA-hda-realtek-Re-order-ALC882-Acer-quirk-table-en.patch new file mode 100644 index 0000000..43cf022 --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Re-order-ALC882-Acer-quirk-table-en.patch @@ -0,0 +1,46 @@ +From b265047ac56bad8c4f3d0c8bf9cb4e828ee0d28e Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 28 Apr 2021 13:26:52 +0200 +Subject: [PATCH] ALSA: hda/realtek: Re-order ALC882 Acer quirk table entries +Git-commit: b265047ac56bad8c4f3d0c8bf9cb4e828ee0d28e +Patch-mainline: v5.13-rc1 +References: git-fixes + +Just re-order the alc882_fixup_tbl[] entries for Acer devices for +avoiding the oversight of the duplicated or unapplied item in future. +No functional changes. + +Also Cc-to-stable for the further patch applications. + +Cc: +Link: https://lore.kernel.org/r/20210428112704.23967-2-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 4a3939c45a12..bc4136b2b82f 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -2470,13 +2470,13 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { + ALC882_FIXUP_ACER_ASPIRE_8930G), + SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", + ALC882_FIXUP_ACER_ASPIRE_8930G), ++ SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", ++ ALC882_FIXUP_ACER_ASPIRE_4930G), ++ SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), + SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", + ALC882_FIXUP_ACER_ASPIRE_4930G), + SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", + ALC882_FIXUP_ACER_ASPIRE_4930G), +- SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", +- ALC882_FIXUP_ACER_ASPIRE_4930G), +- SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), + SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G", + ALC882_FIXUP_ACER_ASPIRE_4930G), + SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE), +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Re-order-ALC882-Clevo-quirk-table-e.patch b/patches.suse/ALSA-hda-realtek-Re-order-ALC882-Clevo-quirk-table-e.patch new file mode 100644 index 0000000..0352ff2 --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Re-order-ALC882-Clevo-quirk-table-e.patch @@ -0,0 +1,69 @@ +From 13e1a4cd490b959a4c72c9f4fb502ef56b190062 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 28 Apr 2021 13:26:54 +0200 +Subject: [PATCH] ALSA: hda/realtek: Re-order ALC882 Clevo quirk table entries +Git-commit: 13e1a4cd490b959a4c72c9f4fb502ef56b190062 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Just re-order the alc882_fixup_tbl[] entries for Clevo devices for +avoiding the oversight of the duplicated or unapplied item in future. +No functional changes. + +Also, user lower hex letters in the entry. + +Also Cc-to-stable for the further patch applications. + +Cc: +Link: https://lore.kernel.org/r/20210428112704.23967-4-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 61a7c2f7a648..5eee67d443c2 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -2536,9 +2536,19 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { + 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), ++ SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS), + SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950), +- SND_PCI_QUIRK(0x1558, 0x950A, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950), ++ SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950), +@@ -2548,16 +2558,6 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { + SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950), +- SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), +- SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), +- SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), +- SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), +- SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), +- SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), +- SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), +- SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), +- SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), +- SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS), + SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), + SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), + SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Re-order-ALC882-Sony-quirk-table-en.patch b/patches.suse/ALSA-hda-realtek-Re-order-ALC882-Sony-quirk-table-en.patch new file mode 100644 index 0000000..37feff2 --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Re-order-ALC882-Sony-quirk-table-en.patch @@ -0,0 +1,43 @@ +From b7529c18feecb1af92f9db08c8e7fe446a82d96d Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 28 Apr 2021 13:26:53 +0200 +Subject: [PATCH] ALSA: hda/realtek: Re-order ALC882 Sony quirk table entries +Git-commit: b7529c18feecb1af92f9db08c8e7fe446a82d96d +Patch-mainline: v5.13-rc1 +References: git-fixes + +Just re-order the alc882_fixup_tbl[] entries for Sony devices for +avoiding the oversight of the duplicated or unapplied item in future. +No functional changes. + +Also Cc-to-stable for the further patch applications. + +Cc: +Link: https://lore.kernel.org/r/20210428112704.23967-3-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index bc4136b2b82f..61a7c2f7a648 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -2489,11 +2489,11 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), + SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS), + SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3), ++ SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), ++ SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP), + SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), + SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), + SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP), +- SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), +- SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP), + + /* All Apple entries are in codec SSIDs */ + SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF), +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Re-order-remaining-ALC269-quirk-tab.patch b/patches.suse/ALSA-hda-realtek-Re-order-remaining-ALC269-quirk-tab.patch new file mode 100644 index 0000000..18087fd --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Re-order-remaining-ALC269-quirk-tab.patch @@ -0,0 +1,70 @@ +From c656f747df151a0a89756a5312f4ca2116758ba4 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 28 Apr 2021 13:27:01 +0200 +Subject: [PATCH] ALSA: hda/realtek: Re-order remaining ALC269 quirk table entries +Git-commit: c656f747df151a0a89756a5312f4ca2116758ba4 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Just re-order the alc269_fixup_tbl[] entries for FSC, Medion, Samsung +and Lemote devices for avoiding the oversight of the duplicated or +unapplied item in future. +No functional changes. + +Also Cc-to-stable for the further patch applications. + +Cc: +Link: https://lore.kernel.org/r/20210428112704.23967-11-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 539bae66a4ba..11f731b95eef 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8195,10 +8195,11 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), + SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT), + SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN), +- SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN), + SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC), ++ SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN), + SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), + SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE), ++ SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE), + SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), + SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), + SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), +@@ -8208,9 +8209,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), + SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), + SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), +- SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), + SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8), + SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), ++ SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), + SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC), + SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC), + SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC), +@@ -8338,13 +8339,12 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI), + SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101), + SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */ ++ 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(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC), + SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC), + SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC), +- SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE), +- 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, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC), + 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), +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-Remove-redundant-entry-for-ALC861-H.patch b/patches.suse/ALSA-hda-realtek-Remove-redundant-entry-for-ALC861-H.patch new file mode 100644 index 0000000..bcf0b74 --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-Remove-redundant-entry-for-ALC861-H.patch @@ -0,0 +1,40 @@ +From defce244b01ee12534910a4544e11be5eb927d25 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 28 Apr 2021 13:27:03 +0200 +Subject: [PATCH] ALSA: hda/realtek: Remove redundant entry for ALC861 Haier/Uniwill devices +Git-commit: defce244b01ee12534910a4544e11be5eb927d25 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The quirk entry for Uniwill ECS M31EI is with the PCI SSID device 0, +which means matching with all. That is, it's essentially equivalent +with SND_PCI_QUIRK_VENDOR(0x1584), which also matches with the +previous entry for Haier W18 applying the very same quirk. + +Let's unify them with the single vendor-quirk entry. + +Cc: +Link: https://lore.kernel.org/r/20210428112704.23967-13-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index cbed3c610170..bd7bfd7c9ee7 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -9290,8 +9290,7 @@ static const struct snd_pci_quirk alc861_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP), + SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F), + SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT), +- SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F), +- SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F), ++ SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F), + SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505), + {} + }; +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-fix-mic-boost-on-Intel-NUC-8.patch b/patches.suse/ALSA-hda-realtek-fix-mic-boost-on-Intel-NUC-8.patch new file mode 100644 index 0000000..9fe922e --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-fix-mic-boost-on-Intel-NUC-8.patch @@ -0,0 +1,81 @@ +From d1ee66c5d3c5a0498dd5e3f2af5b8c219a98bba5 Mon Sep 17 00:00:00 2001 +From: Phil Calvin +Date: Thu, 15 Apr 2021 18:01:29 -0400 +Subject: [PATCH] ALSA: hda/realtek: fix mic boost on Intel NUC 8 +Git-commit: d1ee66c5d3c5a0498dd5e3f2af5b8c219a98bba5 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Fix two bugs with the Intel HDA Realtek ALC233 sound codec +present in Intel NUC NUC8i7BEH and probably a few other similar +NUC models. + +These codecs advertise a 4-level microphone input boost amplifier on +pin 0x19, but the highest two boost settings do not work correctly, +and produce only low analog noise that does not seem to contain any +discernible signal. There is an existing fixup for this exact problem +but for a different PCI subsystem ID, so we re-use that logic. + +Changing the boost level also triggers a DC spike in the input signal +that bleeds off over about a second and overwhelms any input during +that time. Thankfully, the existing fixup has the side effect of +making the boost control show up in userspace as a mute/unmute switch, +and this keeps (e.g.) PulseAudio from fiddling with it during normal +input volume adjustments. + +Finally, the NUC hardware has built-in inverted stereo mics. This +patch also enables the usual fixup for this so the two channels cancel +noise instead of the actual signal. + +[ Re-ordered the quirk entry point by tiwai ] + +Signed-off-by: Phil Calvin +Cc: +Link: https://lore.kernel.org/r/80dc5663-7734-e7e5-25ef-15b5df24511a@philcalvin.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 00a15e7cfdb9..50437ec1b9af 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6422,6 +6422,8 @@ enum { + ALC269_FIXUP_LEMOTE_A1802, + ALC269_FIXUP_LEMOTE_A190X, + ALC256_FIXUP_INTEL_NUC8_RUGGED, ++ ALC233_FIXUP_INTEL_NUC8_DMIC, ++ ALC233_FIXUP_INTEL_NUC8_BOOST, + ALC256_FIXUP_INTEL_NUC10, + ALC255_FIXUP_XIAOMI_HEADSET_MIC, + ALC274_FIXUP_HP_MIC, +@@ -7143,6 +7145,16 @@ static const struct hda_fixup alc269_fixups[] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc233_fixup_lenovo_line2_mic_hotkey, + }, ++ [ALC233_FIXUP_INTEL_NUC8_DMIC] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc_fixup_inv_dmic, ++ .chained = true, ++ .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST, ++ }, ++ [ALC233_FIXUP_INTEL_NUC8_BOOST] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc269_fixup_limit_int_mic_boost ++ }, + [ALC255_FIXUP_DELL_SPK_NOISE] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc_fixup_disable_aamix, +@@ -8286,6 +8298,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE), + 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, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC), + 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), + +-- +2.26.2 + diff --git a/patches.suse/ALSA-hda-realtek-fix-static-noise-on-ALC285-Lenovo-l.patch b/patches.suse/ALSA-hda-realtek-fix-static-noise-on-ALC285-Lenovo-l.patch new file mode 100644 index 0000000..e2cbf6e --- /dev/null +++ b/patches.suse/ALSA-hda-realtek-fix-static-noise-on-ALC285-Lenovo-l.patch @@ -0,0 +1,57 @@ +From 9bbb94e57df135ef61bef075d9c99b8d9e89e246 Mon Sep 17 00:00:00 2001 +From: Sami Loone +Date: Sun, 25 Apr 2021 22:37:12 +0200 +Subject: [PATCH] ALSA: hda/realtek: fix static noise on ALC285 Lenovo laptops +Git-commit: 9bbb94e57df135ef61bef075d9c99b8d9e89e246 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Remove a duplicate vendor+subvendor pin fixup entry as one is masking +the other and making it unreachable. Consider the more specific newcomer +as a second chance instead. + +The generic entry is made less strict to also match for laptops with +slightly different 0x12 pin configuration. Tested on Lenovo Yoga 6 (AMD) +where 0x12 is 0x40000000. + +Fixes: 607184cb1635 ("ALSA: hda/realtek - Add supported for more Lenovo ALC285 Headset Button") +Signed-off-by: Sami Loone +Cc: +Link: https://lore.kernel.org/r/YIXS+GT/dGI/LtK6@yoga +Signed-off-by: Takashi Iwai + +--- + sound/pci/hda/patch_realtek.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 97473e67716b..f4c2b10aeb68 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8800,12 +8800,7 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { + {0x12, 0x90a60130}, + {0x19, 0x03a11020}, + {0x21, 0x0321101f}), +- SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK, +- {0x14, 0x90170110}, +- {0x19, 0x04a11040}, +- {0x21, 0x04211020}), + SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE, +- {0x12, 0x90a60130}, + {0x14, 0x90170110}, + {0x19, 0x04a11040}, + {0x21, 0x04211020}), +@@ -8976,6 +8971,10 @@ static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = { + SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, + {0x19, 0x40000000}, + {0x1a, 0x40000000}), ++ SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK, ++ {0x14, 0x90170110}, ++ {0x19, 0x04a11040}, ++ {0x21, 0x04211020}), + {} + }; + +-- +2.26.2 + diff --git a/patches.suse/ALSA-sb-Fix-two-use-after-free-in-snd_sb_qsound_buil.patch b/patches.suse/ALSA-sb-Fix-two-use-after-free-in-snd_sb_qsound_buil.patch new file mode 100644 index 0000000..16d858b --- /dev/null +++ b/patches.suse/ALSA-sb-Fix-two-use-after-free-in-snd_sb_qsound_buil.patch @@ -0,0 +1,54 @@ +From 4fb44dd2c1dda18606348acdfdb97e8759dde9df Mon Sep 17 00:00:00 2001 +From: Lv Yunlong +Date: Mon, 26 Apr 2021 07:55:41 -0700 +Subject: [PATCH] ALSA: sb: Fix two use after free in snd_sb_qsound_build +Git-commit: 4fb44dd2c1dda18606348acdfdb97e8759dde9df +Patch-mainline: v5.13-rc1 +References: git-fixes + +In snd_sb_qsound_build, snd_ctl_add(..,p->qsound_switch...) and +snd_ctl_add(..,p->qsound_space..) are called. But the second +arguments of snd_ctl_add() could be freed via snd_ctl_add_replace() +->snd_ctl_free_one(). After the error code is returned, +snd_sb_qsound_destroy(p) is called in __error branch. + +But in snd_sb_qsound_destroy(), the freed p->qsound_switch and +p->qsound_space are still used by snd_ctl_remove(). + +My patch set p->qsound_switch and p->qsound_space to NULL if +snd_ctl_add() failed to avoid the uaf bugs. But these codes need +to further be improved with the code style. + +Signed-off-by: Lv Yunlong +Cc: +Link: https://lore.kernel.org/r/20210426145541.8070-1-lyl2019@mail.ustc.edu.cn +Signed-off-by: Takashi Iwai + +--- + sound/isa/sb/sb16_csp.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c +index 8635a2b6b36b..4789345a8fdd 100644 +--- a/sound/isa/sb/sb16_csp.c ++++ b/sound/isa/sb/sb16_csp.c +@@ -1045,10 +1045,14 @@ static int snd_sb_qsound_build(struct snd_sb_csp * p) + + spin_lock_init(&p->q_lock); + +- if ((err = snd_ctl_add(card, p->qsound_switch = snd_ctl_new1(&snd_sb_qsound_switch, p))) < 0) ++ if ((err = snd_ctl_add(card, p->qsound_switch = snd_ctl_new1(&snd_sb_qsound_switch, p))) < 0) { ++ p->qsound_switch = NULL; + goto __error; +- if ((err = snd_ctl_add(card, p->qsound_space = snd_ctl_new1(&snd_sb_qsound_space, p))) < 0) ++ } ++ if ((err = snd_ctl_add(card, p->qsound_space = snd_ctl_new1(&snd_sb_qsound_space, p))) < 0) { ++ p->qsound_space = NULL; + goto __error; ++ } + + return 0; + +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-audio-Add-DJM450-to-Pioneer-format-quirk.patch b/patches.suse/ALSA-usb-audio-Add-DJM450-to-Pioneer-format-quirk.patch new file mode 100644 index 0000000..46d4751 --- /dev/null +++ b/patches.suse/ALSA-usb-audio-Add-DJM450-to-Pioneer-format-quirk.patch @@ -0,0 +1,68 @@ +From 3b85f5fc75d564a9eb4171dcb6b8687b080cd4d5 Mon Sep 17 00:00:00 2001 +From: Olivia Mackintosh +Date: Tue, 2 Feb 2021 13:42:26 +0000 +Subject: [PATCH] ALSA: usb-audio: Add DJM450 to Pioneer format quirk +Git-commit: 3b85f5fc75d564a9eb4171dcb6b8687b080cd4d5 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Like the DJM-750, ensure that the format control message is passed to +the device when opening a stream. It seems as though fmt->sync_ep is not +always set when this function is called hence the passing of the value +at the call site. If this can be fixed, fmt->sync_up should be used as +the wvalue. + +There doesn't seem to be a "cpu_to_le24" type function defined hence for +the open code but I did see a similar thing done in Bluez lib. Perhaps +we can get these definitions defined in byteorder.h. See hci_cpu_to_le24 +in include/net/bluetooth/hci.h:2543 for similar usage. + +Signed-off-by: Olivia Mackintosh +Link: https://lore.kernel.org/r/20210202134225.3217-2-livvy@base.nu +Signed-off-by: Takashi Iwai + +--- + sound/usb/quirks.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c +index e196e364cef1..9ba4682ebc48 100644 +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1470,6 +1470,23 @@ static void set_format_emu_quirk(struct snd_usb_substream *subs, + subs->pkt_offset_adj = (emu_samplerate_id >= EMU_QUIRK_SR_176400HZ) ? 4 : 0; + } + ++static int pioneer_djm_set_format_quirk(struct snd_usb_substream *subs, ++ u16 windex) ++{ ++ unsigned int cur_rate = subs->data_endpoint->cur_rate; ++ u8 sr[3]; ++ // Convert to little endian ++ sr[0] = cur_rate & 0xff; ++ sr[1] = (cur_rate >> 8) & 0xff; ++ sr[2] = (cur_rate >> 16) & 0xff; ++ usb_set_interface(subs->dev, 0, 1); ++ // we should derive windex from fmt-sync_ep but it's not set ++ snd_usb_ctl_msg(subs->stream->chip->dev, ++ usb_rcvctrlpipe(subs->stream->chip->dev, 0), ++ 0x01, 0x22, 0x0100, windex, &sr, 0x0003); ++ return 0; ++} ++ + void snd_usb_set_format_quirk(struct snd_usb_substream *subs, + const struct audioformat *fmt) + { +@@ -1483,6 +1500,9 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs, + case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */ + subs->stream_offset_adj = 2; + break; ++ case USB_ID(0x2b73, 0x0013): /* Pioneer DJM-450 */ ++ pioneer_djm_set_format_quirk(subs, 0x0082); ++ break; + } + } + +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-audio-Add-MIDI-quirk-for-Vox-ToneLab-EX.patch b/patches.suse/ALSA-usb-audio-Add-MIDI-quirk-for-Vox-ToneLab-EX.patch new file mode 100644 index 0000000..4123238 --- /dev/null +++ b/patches.suse/ALSA-usb-audio-Add-MIDI-quirk-for-Vox-ToneLab-EX.patch @@ -0,0 +1,44 @@ +From 64f40f9be14106e7df0098c427cb60be645bddb7 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 7 Apr 2021 16:45:49 +0200 +Subject: [PATCH] ALSA: usb-audio: Add MIDI quirk for Vox ToneLab EX +Git-commit: 64f40f9be14106e7df0098c427cb60be645bddb7 +Patch-mainline: v5.13-rc1 +References: git-fixes + +ToneLab EX guitar pedal device requires the same quirk like ToneLab ST +for supporting the MIDI. + +Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=212593 +Cc: +Link: https://lore.kernel.org/r/20210407144549.1530-1-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/usb/quirks-table.h | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h +index 92f525b1c992..bdba37d0faab 100644 +--- a/sound/usb/quirks-table.h ++++ b/sound/usb/quirks-table.h +@@ -2397,6 +2397,16 @@ YAMAHA_DEVICE(0x7010, "UB99"), + } + }, + ++{ ++ USB_DEVICE_VENDOR_SPEC(0x0944, 0x0204), ++ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { ++ .vendor_name = "KORG, Inc.", ++ /* .product_name = "ToneLab EX", */ ++ .ifnum = 3, ++ .type = QUIRK_MIDI_STANDARD_INTERFACE, ++ } ++}, ++ + /* AKAI devices */ + { + USB_DEVICE(0x09e8, 0x0062), +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-audio-Add-error-checks-for-usb_driver_claim.patch b/patches.suse/ALSA-usb-audio-Add-error-checks-for-usb_driver_claim.patch new file mode 100644 index 0000000..338df68 --- /dev/null +++ b/patches.suse/ALSA-usb-audio-Add-error-checks-for-usb_driver_claim.patch @@ -0,0 +1,134 @@ +From 5fb45414ae03421255593fd5556aa2d1d82303aa Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 6 Apr 2021 13:35:34 +0200 +Subject: [PATCH] ALSA: usb-audio: Add error checks for usb_driver_claim_interface() calls +Git-commit: 5fb45414ae03421255593fd5556aa2d1d82303aa +Patch-mainline: v5.13-rc1 +References: git-fixes + +There are a few calls of usb_driver_claim_interface() but all of those +miss the proper error checks, as reported by Coverity. This patch +adds those missing checks. + +Along with it, replace the magic pointer with -1 with a constant +USB_AUDIO_IFACE_UNUSED for better readability. + +Reported-by: coverity-bot +Addresses-coverity-id: 1475943 ("Error handling issues") +Addresses-coverity-id: 1475944 ("Error handling issues") +Addresses-coverity-id: 1475945 ("Error handling issues") +Fixes: b1ce7ba619d9 ("ALSA: usb-audio: claim autodetected PCM interfaces all at once") +Fixes: e5779998bf8b ("ALSA: usb-audio: refactor code") +Link: https://lore.kernel.org/r/202104051059.FB7F3016@keescook +Link: https://lore.kernel.org/r/20210406113534.30455-1-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/usb/card.c | 14 +++++++------- + sound/usb/quirks.c | 16 ++++++++++++---- + sound/usb/usbaudio.h | 2 ++ + 3 files changed, 21 insertions(+), 11 deletions(-) + +diff --git a/sound/usb/card.c b/sound/usb/card.c +index 0826a437f8fc..7b7526d3a56e 100644 +--- a/sound/usb/card.c ++++ b/sound/usb/card.c +@@ -181,9 +181,8 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int + ctrlif, interface); + return -EINVAL; + } +- usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L); +- +- return 0; ++ return usb_driver_claim_interface(&usb_audio_driver, iface, ++ USB_AUDIO_IFACE_UNUSED); + } + + if ((altsd->bInterfaceClass != USB_CLASS_AUDIO && +@@ -203,7 +202,8 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int + + if (! snd_usb_parse_audio_interface(chip, interface)) { + usb_set_interface(dev, interface, 0); /* reset the current interface */ +- usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L); ++ return usb_driver_claim_interface(&usb_audio_driver, iface, ++ USB_AUDIO_IFACE_UNUSED); + } + + return 0; +@@ -862,7 +862,7 @@ static void usb_audio_disconnect(struct usb_interface *intf) + struct snd_card *card; + struct list_head *p; + +- if (chip == (void *)-1L) ++ if (chip == USB_AUDIO_IFACE_UNUSED) + return; + + card = chip->card; +@@ -992,7 +992,7 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) + struct usb_mixer_interface *mixer; + struct list_head *p; + +- if (chip == (void *)-1L) ++ if (chip == USB_AUDIO_IFACE_UNUSED) + return 0; + + if (!chip->num_suspended_intf++) { +@@ -1022,7 +1022,7 @@ static int __usb_audio_resume(struct usb_interface *intf, bool reset_resume) + struct list_head *p; + int err = 0; + +- if (chip == (void *)-1L) ++ if (chip == USB_AUDIO_IFACE_UNUSED) + return 0; + + atomic_inc(&chip->active); /* avoid autopm */ +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c +index 9e5e37eff10e..232fbc0d37bd 100644 +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -55,8 +55,12 @@ static int create_composite_quirk(struct snd_usb_audio *chip, + if (!iface) + continue; + if (quirk->ifnum != probed_ifnum && +- !usb_interface_claimed(iface)) +- usb_driver_claim_interface(driver, iface, (void *)-1L); ++ !usb_interface_claimed(iface)) { ++ err = usb_driver_claim_interface(driver, iface, ++ USB_AUDIO_IFACE_UNUSED); ++ if (err < 0) ++ return err; ++ } + } + + return 0; +@@ -426,8 +430,12 @@ static int create_autodetect_quirks(struct snd_usb_audio *chip, + continue; + + err = create_autodetect_quirk(chip, iface, driver); +- if (err >= 0) +- usb_driver_claim_interface(driver, iface, (void *)-1L); ++ if (err >= 0) { ++ err = usb_driver_claim_interface(driver, iface, ++ USB_AUDIO_IFACE_UNUSED); ++ if (err < 0) ++ return err; ++ } + } + + return 0; +diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h +index 60b9dd7df6bb..8794c8658ab9 100644 +--- a/sound/usb/usbaudio.h ++++ b/sound/usb/usbaudio.h +@@ -61,6 +61,8 @@ struct snd_usb_audio { + struct media_intf_devnode *ctl_intf_media_devnode; + }; + ++#define USB_AUDIO_IFACE_UNUSED ((void *)-1L) ++ + #define usb_audio_err(chip, fmt, args...) \ + dev_err(&(chip)->dev->dev, fmt, ##args) + #define usb_audio_warn(chip, fmt, args...) \ +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-audio-Configure-Pioneer-DJM-850-samplerate.patch b/patches.suse/ALSA-usb-audio-Configure-Pioneer-DJM-850-samplerate.patch new file mode 100644 index 0000000..393fa94 --- /dev/null +++ b/patches.suse/ALSA-usb-audio-Configure-Pioneer-DJM-850-samplerate.patch @@ -0,0 +1,39 @@ +From 1a2a94a4392d5d1e5e25cc127573452f4c7fa9b8 Mon Sep 17 00:00:00 2001 +From: Nicolas MURE +Date: Mon, 1 Mar 2021 16:27:28 +0100 +Subject: [PATCH] ALSA: usb-audio: Configure Pioneer DJM-850 samplerate +Git-commit: 1a2a94a4392d5d1e5e25cc127573452f4c7fa9b8 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Send an `URB_CONTROL out` USB frame to the device to configure its +samplerate. This should be done before using the device for audio +streaming (capture or playback). + +See https://github.com/nm2107/Pioneer-DJM-850-driver-reverse-engineering/blob/172fb9a61055960c88c67b7c416fe5bf3609807b/doc/windows-dvs/framerate-setting/README.md + +Signed-off-by: Nicolas MURE +Link: https://lore.kernel.org/r/20210301152729.18094-4-nicolas.mure2019@gmail.com +Signed-off-by: Takashi Iwai + +--- + sound/usb/quirks.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c +index 737b2729c0d3..d02dac5fcd40 100644 +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1503,6 +1503,9 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs, + case USB_ID(0x2b73, 0x0013): /* Pioneer DJM-450 */ + pioneer_djm_set_format_quirk(subs, 0x0082); + break; ++ case USB_ID(0x08e4, 0x0163): /* Pioneer DJM-850 */ ++ pioneer_djm_set_format_quirk(subs, 0x0086); ++ break; + } + } + +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-audio-DJM-750-ensure-format-is-set.patch b/patches.suse/ALSA-usb-audio-DJM-750-ensure-format-is-set.patch new file mode 100644 index 0000000..f6e0746 --- /dev/null +++ b/patches.suse/ALSA-usb-audio-DJM-750-ensure-format-is-set.patch @@ -0,0 +1,36 @@ +From e7df7df5a3809d733888db6ce6592a644acaac19 Mon Sep 17 00:00:00 2001 +From: Olivia Mackintosh +Date: Sun, 18 Apr 2021 17:59:01 +0100 +Subject: [PATCH] ALSA: usb-audio: DJM-750: ensure format is set +Git-commit: e7df7df5a3809d733888db6ce6592a644acaac19 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Add case statement to set sample-rate for the DJM-750 Pioneer +mixer. This was included as part of another patch but I think it has +been archived on Patchwork and hasn't been merged. + +Signed-off-by: Olivia Mackintosh +Cc: +Link: https://lore.kernel.org/r/20210418165901.25776-1-livvy@base.nu +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 63f27ce64bcb..8b8bee3c3dd6 100644 +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1511,6 +1511,7 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs, + case USB_ID(0x2b73, 0x0013): /* Pioneer DJM-450 */ + pioneer_djm_set_format_quirk(subs, 0x0082); + break; ++ case USB_ID(0x08e4, 0x017f): /* Pioneer DJM-750 */ + case USB_ID(0x08e4, 0x0163): /* Pioneer DJM-850 */ + pioneer_djm_set_format_quirk(subs, 0x0086); + break; +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-audio-Explicitly-set-up-the-clock-selector.patch b/patches.suse/ALSA-usb-audio-Explicitly-set-up-the-clock-selector.patch new file mode 100644 index 0000000..3e16335 --- /dev/null +++ b/patches.suse/ALSA-usb-audio-Explicitly-set-up-the-clock-selector.patch @@ -0,0 +1,90 @@ +From d2e8f641257d0d3af6e45d6ac2d6f9d56b8ea964 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 13 Apr 2021 10:41:52 +0200 +Subject: [PATCH] ALSA: usb-audio: Explicitly set up the clock selector +Git-commit: d2e8f641257d0d3af6e45d6ac2d6f9d56b8ea964 +Patch-mainline: v5.13-rc1 +References: git-fixes + +In the current code, we have some assumption that the audio clock +selector has been set up implicitly and don't want to touch it unless +it's really needed for the fallback autoclock setup. This works for +most devices but some seem having a problem. Partially this was +covered for the devices with a single connector at the initialization +phase (commit 086b957cc17f "ALSA: usb-audio: Skip the clock selector +inquiry for single connections"), but also there are cases where the +wrong clock set up is kept silently. The latter seems to be the cause +of the noises on Behringer devices. + +In this patch, we explicitly set up the audio clock selector whenever +the appropriate node is found. + +Reported-by: Geraldo Nascimento +Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=199327 +Link: https://lore.kernel.org/r/CAEsQvcvF7LnO8PxyyCxuRCx=7jNeSCvFAd-+dE0g_rd1rOxxdw@mail.gmail.com +Cc: +Link: https://lore.kernel.org/r/20210413084152.32325-1-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/usb/clock.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/sound/usb/clock.c b/sound/usb/clock.c +index a746802d0ac3..17bbde73d4d1 100644 +--- a/sound/usb/clock.c ++++ b/sound/usb/clock.c +@@ -296,7 +296,7 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip, + + selector = snd_usb_find_clock_selector(chip->ctrl_intf, entity_id); + if (selector) { +- int ret, i, cur; ++ int ret, i, cur, err; + + if (selector->bNrInPins == 1) { + ret = 1; +@@ -324,13 +324,17 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip, + ret = __uac_clock_find_source(chip, fmt, + selector->baCSourceID[ret - 1], + visited, validate); ++ if (ret > 0) { ++ err = uac_clock_selector_set_val(chip, entity_id, cur); ++ if (err < 0) ++ return err; ++ } ++ + if (!validate || ret > 0 || !chip->autoclock) + return ret; + + /* The current clock source is invalid, try others. */ + for (i = 1; i <= selector->bNrInPins; i++) { +- int err; +- + if (i == cur) + continue; + +@@ -396,7 +400,7 @@ static int __uac3_clock_find_source(struct snd_usb_audio *chip, + + selector = snd_usb_find_clock_selector_v3(chip->ctrl_intf, entity_id); + if (selector) { +- int ret, i, cur; ++ int ret, i, cur, err; + + /* the entity ID we are looking for is a selector. + * find out what it currently selects */ +@@ -418,6 +422,12 @@ static int __uac3_clock_find_source(struct snd_usb_audio *chip, + ret = __uac3_clock_find_source(chip, fmt, + selector->baCSourceID[ret - 1], + visited, validate); ++ if (ret > 0) { ++ err = uac_clock_selector_set_val(chip, entity_id, cur); ++ if (err < 0) ++ return err; ++ } ++ + if (!validate || ret > 0 || !chip->autoclock) + return ret; + +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-audio-Fix-Pioneer-DJM-devices-URB_CONTROL-r.patch b/patches.suse/ALSA-usb-audio-Fix-Pioneer-DJM-devices-URB_CONTROL-r.patch new file mode 100644 index 0000000..0520db1 --- /dev/null +++ b/patches.suse/ALSA-usb-audio-Fix-Pioneer-DJM-devices-URB_CONTROL-r.patch @@ -0,0 +1,36 @@ +From 2c9119001dcb1dc7027257c5d8960d30f5ba58be Mon Sep 17 00:00:00 2001 +From: Nicolas MURE +Date: Mon, 1 Mar 2021 15:29:27 +0100 +Subject: [PATCH] ALSA: usb-audio: Fix Pioneer DJM devices URB_CONTROL request direction to set samplerate +Git-commit: 2c9119001dcb1dc7027257c5d8960d30f5ba58be +Patch-mainline: v5.12-rc2 +References: git-fixes + +This commit only contains the fix about the `URB_CONTROL` request +direction to set the samplerate of Pioneer DJM devices (`URB_CONTROL out`). + +Fixes: 3b85f5fc75d5 ("ALSA: usb-audio: Add DJM450 to Pioneer format quirk") +Signed-off-by: Nicolas MURE +Link: https://lore.kernel.org/r/20210301142927.14552-1-nicolas.mure2019@gmail.com +Signed-off-by: Takashi Iwai + +--- + sound/usb/quirks.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c +index 9ba4682ebc48..737b2729c0d3 100644 +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1482,7 +1482,7 @@ static int pioneer_djm_set_format_quirk(struct snd_usb_substream *subs, + usb_set_interface(subs->dev, 0, 1); + // we should derive windex from fmt-sync_ep but it's not set + snd_usb_ctl_msg(subs->stream->chip->dev, +- usb_rcvctrlpipe(subs->stream->chip->dev, 0), ++ usb_sndctrlpipe(subs->stream->chip->dev, 0), + 0x01, 0x22, 0x0100, windex, &sr, 0x0003); + return 0; + } +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-audio-Fix-implicit-sync-clearance-at-stoppi.patch b/patches.suse/ALSA-usb-audio-Fix-implicit-sync-clearance-at-stoppi.patch new file mode 100644 index 0000000..85e6685 --- /dev/null +++ b/patches.suse/ALSA-usb-audio-Fix-implicit-sync-clearance-at-stoppi.patch @@ -0,0 +1,52 @@ +From 988cc17552606be67a956cf8cd6ff504cfc5d643 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Mon, 26 Apr 2021 08:33:49 +0200 +Subject: [PATCH] ALSA: usb-audio: Fix implicit sync clearance at stopping stream +Git-commit: 988cc17552606be67a956cf8cd6ff504cfc5d643 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The recent endpoint management change for implicit feedback mode added +a clearance of ep->sync_sink (formerly ep->sync_slave) pointer at +snd_usb_endpoint_stop() to assure no leftover for the feedback from +the already stopped capture stream. This turned out to cause a +regression, however, when full-duplex streams were running and only a +capture was stopped. Because of the above clearance of ep->sync_sink +pointer, no more feedback is done, hence the playback will stall. + +This patch fixes the ep->sync_sink clearance to be done only after all +endpoints are released, for addressing the regression. + +Reported-and-tested-by: Lucas Endres +Fixes: bf6313a0ff76 ("ALSA: usb-audio: Refactor endpoint management") +Cc: +Link: https://lore.kernel.org/r/20210426063349.18601-1-tiwai@suse.de +Signed-off-by: Takashi Iwai + +--- + sound/usb/endpoint.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c +index f4c3d2b38abb..014c43862826 100644 +--- a/sound/usb/endpoint.c ++++ b/sound/usb/endpoint.c +@@ -1443,11 +1443,11 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep) + if (snd_BUG_ON(!atomic_read(&ep->running))) + return; + +- if (ep->sync_source) +- WRITE_ONCE(ep->sync_source->sync_sink, NULL); +- +- if (!atomic_dec_return(&ep->running)) ++ if (!atomic_dec_return(&ep->running)) { ++ if (ep->sync_source) ++ WRITE_ONCE(ep->sync_source->sync_sink, NULL); + stop_urbs(ep, false); ++ } + } + + /** +-- +2.26.2 + diff --git a/patches.suse/ALSA-usb-midi-don-t-return-ENOMEM-when-usb_urb_ep_ty.patch b/patches.suse/ALSA-usb-midi-don-t-return-ENOMEM-when-usb_urb_ep_ty.patch new file mode 100644 index 0000000..9b0a787 --- /dev/null +++ b/patches.suse/ALSA-usb-midi-don-t-return-ENOMEM-when-usb_urb_ep_ty.patch @@ -0,0 +1,41 @@ +From cfd577acb769301b19c31361d45ae1f145318b7a Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Tue, 20 Apr 2021 14:47:19 +0100 +Subject: [PATCH] ALSA: usb: midi: don't return -ENOMEM when usb_urb_ep_type_check fails +Git-commit: cfd577acb769301b19c31361d45ae1f145318b7a +Patch-mainline: v5.13-rc1 +References: git-fixes + +Currently when the call to usb_urb_ep_type_check fails (returning -EINVAL) +the error return path returns -ENOMEM via the exit label "error". Other +uses of the same error exit label set the err variable to -ENOMEM but this +is not being used. I believe the original intent was for the error exit +path to return the value in err rather than the hard coded -ENOMEM, so +return this rather than the hard coded -ENOMEM. + +Addresses-coverity: ("Unused value") +Fixes: 738d9edcfd44 ("ALSA: usb-audio: Add sanity checks for invalid EPs") +Signed-off-by: Colin Ian King +Link: https://lore.kernel.org/r/20210420134719.381409-1-colin.king@canonical.com +Signed-off-by: Takashi Iwai + +--- + sound/usb/midi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/usb/midi.c b/sound/usb/midi.c +index 9efda4b06acb..a10ac75969a8 100644 +--- a/sound/usb/midi.c ++++ b/sound/usb/midi.c +@@ -1316,7 +1316,7 @@ static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi *umidi, + + error: + snd_usbmidi_in_endpoint_delete(ep); +- return -ENOMEM; ++ return err; + } + + /* +-- +2.26.2 + diff --git a/patches.suse/ASoC-Intel-kbl_da7219_max98927-Fix-kabylake_ssp_fixu.patch b/patches.suse/ASoC-Intel-kbl_da7219_max98927-Fix-kabylake_ssp_fixu.patch new file mode 100644 index 0000000..19a7b69 --- /dev/null +++ b/patches.suse/ASoC-Intel-kbl_da7219_max98927-Fix-kabylake_ssp_fixu.patch @@ -0,0 +1,101 @@ +From a523ef731ac6674dc07574f31bf44cc5bfa14e4d Mon Sep 17 00:00:00 2001 +From: Lukasz Majczak +Date: Thu, 15 Apr 2021 14:43:47 +0200 +Subject: [PATCH] ASoC: Intel: kbl_da7219_max98927: Fix kabylake_ssp_fixup function +Git-commit: a523ef731ac6674dc07574f31bf44cc5bfa14e4d +Patch-mainline: v5.13-rc1 +References: git-fixes + +kabylake_ssp_fixup function uses snd_soc_dpcm to identify the +codecs DAIs. The HW parameters are changed based on the codec DAI of the +stream. The earlier approach to get snd_soc_dpcm was using container_of() +macro on snd_pcm_hw_params. + +The structures have been modified over time and snd_soc_dpcm does not have +snd_pcm_hw_params as a reference but as a copy. This causes the current +driver to crash when used. + +This patch changes the way snd_soc_dpcm is extracted. snd_soc_pcm_runtime +holds 2 dpcm instances (one for playback and one for capture). 2 codecs +on the SSP are dmic (capture) and speakers (playback). Based on the +stream direction, snd_soc_dpcm is extracted from snd_soc_pcm_runtime. + +Tested for all use cases of the driver. +Based on similar fix in kbl_rt5663_rt5514_max98927.c +from Harsha Priya and +Vamshi Krishna Gopal + +Cc: # 5.4+ +Signed-off-by: Lukasz Majczak +Acked-by: Pierre-Louis Bossart +Link: https://lore.kernel.org/r/20210415124347.475432-1-lma@semihalf.com +Signed-off-by: Mark Brown +Acked-by: Takashi Iwai + +--- + sound/soc/intel/boards/kbl_da7219_max98927.c | 38 +++++++++++++++++++++------ + 1 file changed, 30 insertions(+), 8 deletions(-) + +--- a/sound/soc/intel/boards/kbl_da7219_max98927.c ++++ b/sound/soc/intel/boards/kbl_da7219_max98927.c +@@ -282,12 +282,34 @@ static int kabylake_ssp_fixup(struct snd + struct snd_interval *channels = hw_param_interval(params, + SNDRV_PCM_HW_PARAM_CHANNELS); + struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); +- struct snd_soc_dpcm *dpcm = container_of( +- params, struct snd_soc_dpcm, hw_params); +- struct snd_soc_dai_link *fe_dai_link = dpcm->fe->dai_link; +- struct snd_soc_dai_link *be_dai_link = dpcm->be->dai_link; ++ struct snd_soc_dpcm *dpcm, *rtd_dpcm = NULL; + + /* ++ * The following loop will be called only for playback stream ++ * In this platform, there is only one playback device on every SSP ++ */ ++ for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_PLAYBACK, dpcm) { ++ rtd_dpcm = dpcm; ++ break; ++ } ++ ++ /* ++ * This following loop will be called only for capture stream ++ * In this platform, there is only one capture device on every SSP ++ */ ++ for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_CAPTURE, dpcm) { ++ rtd_dpcm = dpcm; ++ break; ++ } ++ ++ if (!rtd_dpcm) ++ return -EINVAL; ++ ++ /* ++ * The above 2 loops are mutually exclusive based on the stream direction, ++ * thus rtd_dpcm variable will never be overwritten ++ */ ++ /* + * Topology for kblda7219m98373 & kblmax98373 supports only S24_LE, + * where as kblda7219m98927 & kblmax98927 supports S16_LE by default. + * Skipping the port wise FE and BE configuration for kblda7219m98373 & +@@ -309,9 +331,9 @@ static int kabylake_ssp_fixup(struct snd + /* + * The ADSP will convert the FE rate to 48k, stereo, 24 bit + */ +- if (!strcmp(fe_dai_link->name, "Kbl Audio Port") || +- !strcmp(fe_dai_link->name, "Kbl Audio Headset Playback") || +- !strcmp(fe_dai_link->name, "Kbl Audio Capture Port")) { ++ if (!strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Port") || ++ !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Headset Playback") || ++ !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Capture Port")) { + rate->min = rate->max = 48000; + channels->min = channels->max = 2; + snd_mask_none(fmt); +@@ -322,7 +344,7 @@ static int kabylake_ssp_fixup(struct snd + * The speaker on the SSP0 supports S16_LE and not S24_LE. + * thus changing the mask here + */ +- if (!strcmp(be_dai_link->name, "SSP0-Codec")) ++ if (!strcmp(rtd_dpcm->be->dai_link->name, "SSP0-Codec")) + snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE); + + return 0; diff --git a/patches.suse/ASoC-ak5558-Fix-s-show-slow-typo.patch b/patches.suse/ASoC-ak5558-Fix-s-show-slow-typo.patch new file mode 100644 index 0000000..87acc6a --- /dev/null +++ b/patches.suse/ASoC-ak5558-Fix-s-show-slow-typo.patch @@ -0,0 +1,38 @@ +From a43508995a913893c5f303e56415d06432b15619 Mon Sep 17 00:00:00 2001 +From: Shengjiu Wang +Date: Sat, 3 Apr 2021 21:59:25 +0800 +Subject: [PATCH] ASoC: ak5558: Fix s/show/slow/ typo +Git-commit: a43508995a913893c5f303e56415d06432b15619 +Patch-mainline: v5.13-rc1 +References: git-fixes + +s/show/slow/ + +Fixes: 920884777480 ("ASoC: ak5558: Add support for AK5558 ADC driver") +Signed-off-by: Shengjiu Wang +Link: https://lore.kernel.org/r/1617458365-23393-1-git-send-email-shengjiu.wang@nxp.com +Signed-off-by: Mark Brown +Acked-by: Takashi Iwai + +--- + sound/soc/codecs/ak5558.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/codecs/ak5558.c b/sound/soc/codecs/ak5558.c +index 3ac62a281807..8e4dca753f0b 100644 +--- a/sound/soc/codecs/ak5558.c ++++ b/sound/soc/codecs/ak5558.c +@@ -75,8 +75,8 @@ static const struct soc_enum ak5552_mono_enum[] = { + }; + + static const char * const digfil_texts[] = { +- "Sharp Roll-Off", "Show Roll-Off", +- "Short Delay Sharp Roll-Off", "Short Delay Show Roll-Off", ++ "Sharp Roll-Off", "Slow Roll-Off", ++ "Short Delay Sharp Roll-Off", "Short Delay Slow Roll-Off", + }; + + static const struct soc_enum ak5558_adcset_enum[] = { +-- +2.26.2 + diff --git a/patches.suse/ASoC-ak5558-correct-reset-polarity.patch b/patches.suse/ASoC-ak5558-correct-reset-polarity.patch new file mode 100644 index 0000000..1847d23 --- /dev/null +++ b/patches.suse/ASoC-ak5558-correct-reset-polarity.patch @@ -0,0 +1,46 @@ +From 0b93bbc977af55fd10687f2c96c807cba95cb927 Mon Sep 17 00:00:00 2001 +From: Shengjiu Wang +Date: Wed, 14 Apr 2021 14:33:43 +0800 +Subject: [PATCH] ASoC: ak5558: correct reset polarity +Git-commit: 0b93bbc977af55fd10687f2c96c807cba95cb927 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Reset (aka power off) happens when the reset gpio is made active. +The reset gpio is GPIO_ACTIVE_LOW + +Fixes: 920884777480 ("ASoC: ak5558: Add support for AK5558 ADC driver") +Signed-off-by: Shengjiu Wang +Link: https://lore.kernel.org/r/1618382024-31725-1-git-send-email-shengjiu.wang@nxp.com +Signed-off-by: Mark Brown +Acked-by: Takashi Iwai + +--- + sound/soc/codecs/ak5558.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/codecs/ak5558.c b/sound/soc/codecs/ak5558.c +index 8e4dca753f0b..f24d91b728dd 100644 +--- a/sound/soc/codecs/ak5558.c ++++ b/sound/soc/codecs/ak5558.c +@@ -323,7 +323,7 @@ static void ak5558_power_off(struct ak5558_priv *ak5558) + if (!ak5558->reset_gpiod) + return; + +- gpiod_set_value_cansleep(ak5558->reset_gpiod, 0); ++ gpiod_set_value_cansleep(ak5558->reset_gpiod, 1); + usleep_range(1000, 2000); + } + +@@ -332,7 +332,7 @@ static void ak5558_power_on(struct ak5558_priv *ak5558) + if (!ak5558->reset_gpiod) + return; + +- gpiod_set_value_cansleep(ak5558->reset_gpiod, 1); ++ gpiod_set_value_cansleep(ak5558->reset_gpiod, 0); + usleep_range(1000, 2000); + } + +-- +2.26.2 + diff --git a/patches.suse/ASoC-samsung-tm2_wm5110-check-of-of_parse-return-val.patch b/patches.suse/ASoC-samsung-tm2_wm5110-check-of-of_parse-return-val.patch new file mode 100644 index 0000000..db9eed0 --- /dev/null +++ b/patches.suse/ASoC-samsung-tm2_wm5110-check-of-of_parse-return-val.patch @@ -0,0 +1,59 @@ +From d58970da324732686529655c21791cef0ee547c4 Mon Sep 17 00:00:00 2001 +From: Pierre-Louis Bossart +Date: Fri, 12 Mar 2021 12:02:30 -0600 +Subject: [PATCH] ASoC: samsung: tm2_wm5110: check of of_parse return value +Git-commit: d58970da324732686529655c21791cef0ee547c4 +Patch-mainline: v5.13-rc1 +References: git-fixes + +cppcheck warning: + +sound/soc/samsung/tm2_wm5110.c:605:6: style: Variable 'ret' is +reassigned a value before the old one has been +used. [redundantAssignment] + ret = devm_snd_soc_register_component(dev, &tm2_component, + ^ +sound/soc/samsung/tm2_wm5110.c:554:7: note: ret is assigned + ret = of_parse_phandle_with_args(dev->of_node, "i2s-controller", + ^ +sound/soc/samsung/tm2_wm5110.c:605:6: note: ret is overwritten + ret = devm_snd_soc_register_component(dev, &tm2_component, + ^ + +The args is a stack variable, so it could have junk (uninitialized) +therefore args.np could have a non-NULL and random value even though +property was missing. Later could trigger invalid pointer dereference. + +There's no need to check for args.np because args.np won't be +initialized on errors. + +Fixes: 8d1513cef51a ("ASoC: samsung: Add support for HDMI audio on TM2 board") +Cc: +Suggested-by: Krzysztof Kozlowski +Reviewed-by: Krzysztof Kozlowski +Reviewed-by: Sylwester Nawrocki +Signed-off-by: Pierre-Louis Bossart +Link: https://lore.kernel.org/r/20210312180231.2741-2-pierre-louis.bossart@linux.intel.com +Signed-off-by: Mark Brown +Acked-by: Takashi Iwai + +--- + sound/soc/samsung/tm2_wm5110.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/samsung/tm2_wm5110.c b/sound/soc/samsung/tm2_wm5110.c +index 9300fef9bf26..125e07f65d2b 100644 +--- a/sound/soc/samsung/tm2_wm5110.c ++++ b/sound/soc/samsung/tm2_wm5110.c +@@ -553,7 +553,7 @@ static int tm2_probe(struct platform_device *pdev) + + ret = of_parse_phandle_with_args(dev->of_node, "i2s-controller", + cells_name, i, &args); +- if (!args.np) { ++ if (ret) { + dev_err(dev, "i2s-controller property parse error: %d\n", i); + ret = -EINVAL; + goto dai_node_put; +-- +2.26.2 + diff --git a/patches.suse/ASoC-simple-card-fix-possible-uninitialized-single_c.patch b/patches.suse/ASoC-simple-card-fix-possible-uninitialized-single_c.patch new file mode 100644 index 0000000..484943f --- /dev/null +++ b/patches.suse/ASoC-simple-card-fix-possible-uninitialized-single_c.patch @@ -0,0 +1,50 @@ +From fa74c223b6fd78a5314b4c61b9abdbed3c2185b4 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Wed, 7 Apr 2021 11:20:27 +0200 +Subject: [PATCH] ASoC: simple-card: fix possible uninitialized single_cpu local variable +Git-commit: fa74c223b6fd78a5314b4c61b9abdbed3c2185b4 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The 'single_cpu' local variable is assigned by asoc_simple_parse_dai() +and later used in a asoc_simple_canonicalize_cpu() call, assuming the +entire function did not exit on errors. + +However the first function returns 0 if passed device_node is NULL, +thus leaving the variable uninitialized and reporting success. + +Addresses-coverity: Uninitialized scalar variable +Fixes: 8f7f298a3337 ("ASoC: simple-card-utils: separate asoc_simple_card_parse_dai()") +Signed-off-by: Krzysztof Kozlowski +Acked-by: Sameer Pujar +Link: https://lore.kernel.org/r/20210407092027.60769-1-krzysztof.kozlowski@canonical.com +Signed-off-by: Mark Brown +Acked-by: Takashi Iwai + +--- + sound/soc/generic/audio-graph-card.c | 2 +- + sound/soc/generic/simple-card.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/sound/soc/generic/audio-graph-card.c ++++ b/sound/soc/generic/audio-graph-card.c +@@ -321,7 +321,7 @@ static int graph_dai_link_of(struct asoc + struct device_node *top = dev->of_node; + struct asoc_simple_dai *cpu_dai; + struct asoc_simple_dai *codec_dai; +- int ret, single_cpu; ++ int ret, single_cpu = 0; + + /* Do it only CPU turn */ + if (!li->cpu) +--- a/sound/soc/generic/simple-card.c ++++ b/sound/soc/generic/simple-card.c +@@ -240,7 +240,7 @@ static int simple_dai_link_of(struct aso + struct device_node *plat = NULL; + char prop[128]; + char *prefix = ""; +- int ret, single_cpu; ++ int ret, single_cpu = 0; + + /* + * |CPU |Codec : turn diff --git a/patches.suse/HID-alps-fix-error-return-code-in-alps_input_configu.patch b/patches.suse/HID-alps-fix-error-return-code-in-alps_input_configu.patch new file mode 100644 index 0000000..894c035 --- /dev/null +++ b/patches.suse/HID-alps-fix-error-return-code-in-alps_input_configu.patch @@ -0,0 +1,35 @@ +From fa8ba6e5dc0e78e409e503ddcfceef5dd96527f4 Mon Sep 17 00:00:00 2001 +From: Jia-Ju Bai +Date: Thu, 4 Mar 2021 05:19:57 -0800 +Subject: [PATCH] HID: alps: fix error return code in alps_input_configured() +Git-commit: fa8ba6e5dc0e78e409e503ddcfceef5dd96527f4 +Patch-mainline: v5.12-rc8 +References: git-fixes + +When input_register_device() fails, no error return code is assigned. +To fix this bug, ret is assigned with -ENOENT as error return code. + +Reported-by: TOTE Robot +Signed-off-by: Jia-Ju Bai +Signed-off-by: Jiri Kosina +Acked-by: Takashi Iwai + +--- + drivers/hid/hid-alps.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c +index 3feaece13ade..6b665931147d 100644 +--- a/drivers/hid/hid-alps.c ++++ b/drivers/hid/hid-alps.c +@@ -761,6 +761,7 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi) + + if (input_register_device(data->input2)) { + input_free_device(input2); ++ ret = -ENOENT; + goto exit; + } + } +-- +2.26.2 + diff --git a/patches.suse/HID-google-add-don-USB-id.patch b/patches.suse/HID-google-add-don-USB-id.patch new file mode 100644 index 0000000..4ee036b --- /dev/null +++ b/patches.suse/HID-google-add-don-USB-id.patch @@ -0,0 +1,40 @@ +From 36b87cf302a4f13f8b4344bcf98f67405a145e2f Mon Sep 17 00:00:00 2001 +From: Shou-Chieh Hsu +Date: Tue, 2 Mar 2021 11:58:01 +0800 +Subject: [PATCH] HID: google: add don USB id +Git-commit: 36b87cf302a4f13f8b4344bcf98f67405a145e2f +Patch-mainline: v5.12-rc8 +References: git-fixes + +Add 1 additional hammer-like device. + +Signed-off-by: Shou-Chieh Hsu +Signed-off-by: Jiri Kosina +Acked-by: Takashi Iwai + +--- + drivers/hid/hid-google-hammer.c | 2 ++ + drivers/hid/hid-ids.h | 1 + + 2 files changed, 3 insertions(+) + +--- a/drivers/hid/hid-google-hammer.c ++++ b/drivers/hid/hid-google-hammer.c +@@ -468,6 +468,8 @@ static int hammer_probe(struct hid_devic + + static const struct hid_device_id hammer_devices[] = { + { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, ++ USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_DON) }, ++ { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, + USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_HAMMER) }, + { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, + USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_MAGNEMITE) }, +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -481,6 +481,7 @@ + #define USB_DEVICE_ID_GOOGLE_MASTERBALL 0x503c + #define USB_DEVICE_ID_GOOGLE_MAGNEMITE 0x503d + #define USB_DEVICE_ID_GOOGLE_MOONBALL 0x5044 ++#define USB_DEVICE_ID_GOOGLE_DON 0x5050 + + #define USB_VENDOR_ID_GOTOP 0x08f2 + #define USB_DEVICE_ID_SUPER_Q2 0x007f diff --git a/patches.suse/HID-plantronics-Workaround-for-double-volume-key-pre.patch b/patches.suse/HID-plantronics-Workaround-for-double-volume-key-pre.patch new file mode 100644 index 0000000..f84f98e --- /dev/null +++ b/patches.suse/HID-plantronics-Workaround-for-double-volume-key-pre.patch @@ -0,0 +1,181 @@ +From f567d6ef8606fb427636e824c867229ecb5aefab Mon Sep 17 00:00:00 2001 +From: Maxim Mikityanskiy +Date: Sun, 7 Feb 2021 16:47:40 +0200 +Subject: [PATCH] HID: plantronics: Workaround for double volume key presses +Git-commit: f567d6ef8606fb427636e824c867229ecb5aefab +Patch-mainline: v5.13-rc1 +References: git-fixes + +Plantronics Blackwire 3220 Series (047f:c056) sends HID reports twice +for each volume key press. This patch adds a quirk to hid-plantronics +for this product ID, which will ignore the second volume key press if +it happens within 5 ms from the last one that was handled. + +The patch was tested on the mentioned model only, it shouldn't affect +other models, however, this quirk might be needed for them too. +Auto-repeat (when a key is held pressed) is not affected, because the +rate is about 3 times per second, which is far less frequent than once +in 5 ms. + +Fixes: 81bb773faed7 ("HID: plantronics: Update to map volume up/down controls") +Signed-off-by: Maxim Mikityanskiy +Signed-off-by: Jiri Kosina +Acked-by: Takashi Iwai + +--- + drivers/hid/hid-ids.h | 1 + + drivers/hid/hid-plantronics.c | 60 +++++++++++++++++++++++++++++++++-- + include/linux/hid.h | 2 ++ + 3 files changed, 61 insertions(+), 2 deletions(-) + +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h +index e42aaae3138f..4c74d8706b51 100644 +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -944,6 +944,7 @@ + #define USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S 0x8003 + + #define USB_VENDOR_ID_PLANTRONICS 0x047f ++#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES 0xc056 + + #define USB_VENDOR_ID_PANASONIC 0x04da + #define USB_DEVICE_ID_PANABOARD_UBT780 0x1044 +diff --git a/drivers/hid/hid-plantronics.c b/drivers/hid/hid-plantronics.c +index 85b685efc12f..e81b7cec2d12 100644 +--- a/drivers/hid/hid-plantronics.c ++++ b/drivers/hid/hid-plantronics.c +@@ -13,6 +13,7 @@ + + #include + #include ++#include + + #define PLT_HID_1_0_PAGE 0xffa00000 + #define PLT_HID_2_0_PAGE 0xffa20000 +@@ -36,6 +37,16 @@ + #define PLT_ALLOW_CONSUMER (field->application == HID_CP_CONSUMERCONTROL && \ + (usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER) + ++#define PLT_QUIRK_DOUBLE_VOLUME_KEYS BIT(0) ++ ++#define PLT_DOUBLE_KEY_TIMEOUT 5 /* ms */ ++ ++struct plt_drv_data { ++ unsigned long device_type; ++ unsigned long last_volume_key_ts; ++ u32 quirks; ++}; ++ + static int plantronics_input_mapping(struct hid_device *hdev, + struct hid_input *hi, + struct hid_field *field, +@@ -43,7 +54,8 @@ static int plantronics_input_mapping(struct hid_device *hdev, + unsigned long **bit, int *max) + { + unsigned short mapped_key; +- unsigned long plt_type = (unsigned long)hid_get_drvdata(hdev); ++ struct plt_drv_data *drv_data = hid_get_drvdata(hdev); ++ unsigned long plt_type = drv_data->device_type; + + /* special case for PTT products */ + if (field->application == HID_GD_JOYSTICK) +@@ -105,6 +117,30 @@ static int plantronics_input_mapping(struct hid_device *hdev, + return 1; + } + ++static int plantronics_event(struct hid_device *hdev, struct hid_field *field, ++ struct hid_usage *usage, __s32 value) ++{ ++ struct plt_drv_data *drv_data = hid_get_drvdata(hdev); ++ ++ if (drv_data->quirks & PLT_QUIRK_DOUBLE_VOLUME_KEYS) { ++ unsigned long prev_ts, cur_ts; ++ ++ /* Usages are filtered in plantronics_usages. */ ++ ++ if (!value) /* Handle key presses only. */ ++ return 0; ++ ++ prev_ts = drv_data->last_volume_key_ts; ++ cur_ts = jiffies; ++ if (jiffies_to_msecs(cur_ts - prev_ts) <= PLT_DOUBLE_KEY_TIMEOUT) ++ return 1; /* Ignore the repeated key. */ ++ ++ drv_data->last_volume_key_ts = cur_ts; ++ } ++ ++ return 0; ++} ++ + static unsigned long plantronics_device_type(struct hid_device *hdev) + { + unsigned i, col_page; +@@ -133,15 +169,24 @@ static unsigned long plantronics_device_type(struct hid_device *hdev) + static int plantronics_probe(struct hid_device *hdev, + const struct hid_device_id *id) + { ++ struct plt_drv_data *drv_data; + int ret; + ++ drv_data = devm_kzalloc(&hdev->dev, sizeof(*drv_data), GFP_KERNEL); ++ if (!drv_data) ++ return -ENOMEM; ++ + ret = hid_parse(hdev); + if (ret) { + hid_err(hdev, "parse failed\n"); + goto err; + } + +- hid_set_drvdata(hdev, (void *)plantronics_device_type(hdev)); ++ drv_data->device_type = plantronics_device_type(hdev); ++ drv_data->quirks = id->driver_data; ++ drv_data->last_volume_key_ts = jiffies - msecs_to_jiffies(PLT_DOUBLE_KEY_TIMEOUT); ++ ++ hid_set_drvdata(hdev, drv_data); + + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | + HID_CONNECT_HIDINPUT_FORCE | HID_CONNECT_HIDDEV_FORCE); +@@ -153,15 +198,26 @@ static int plantronics_probe(struct hid_device *hdev, + } + + static const struct hid_device_id plantronics_devices[] = { ++ { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, ++ USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES), ++ .driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS }, + { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) }, + { } + }; + MODULE_DEVICE_TABLE(hid, plantronics_devices); + ++static const struct hid_usage_id plantronics_usages[] = { ++ { HID_CP_VOLUMEUP, EV_KEY, HID_ANY_ID }, ++ { HID_CP_VOLUMEDOWN, EV_KEY, HID_ANY_ID }, ++ { HID_TERMINATOR, HID_TERMINATOR, HID_TERMINATOR } ++}; ++ + static struct hid_driver plantronics_driver = { + .name = "plantronics", + .id_table = plantronics_devices, ++ .usage_table = plantronics_usages, + .input_mapping = plantronics_input_mapping, ++ .event = plantronics_event, + .probe = plantronics_probe, + }; + module_hid_driver(plantronics_driver); +diff --git a/include/linux/hid.h b/include/linux/hid.h +index ef702b3f56e3..3e33eb14118c 100644 +--- a/include/linux/hid.h ++++ b/include/linux/hid.h +@@ -262,6 +262,8 @@ struct hid_item { + #define HID_CP_SELECTION 0x000c0080 + #define HID_CP_MEDIASELECTION 0x000c0087 + #define HID_CP_SELECTDISC 0x000c00ba ++#define HID_CP_VOLUMEUP 0x000c00e9 ++#define HID_CP_VOLUMEDOWN 0x000c00ea + #define HID_CP_PLAYBACKSPEED 0x000c00f1 + #define HID_CP_PROXIMITY 0x000c0109 + #define HID_CP_SPEAKERSYSTEM 0x000c0160 +-- +2.26.2 + diff --git a/patches.suse/HID-wacom-Assign-boolean-values-to-a-bool-variable.patch b/patches.suse/HID-wacom-Assign-boolean-values-to-a-bool-variable.patch new file mode 100644 index 0000000..ba8c83c --- /dev/null +++ b/patches.suse/HID-wacom-Assign-boolean-values-to-a-bool-variable.patch @@ -0,0 +1,38 @@ +From e29c62ffb008829dc8bcc0a2ec438adc25a8255e Mon Sep 17 00:00:00 2001 +From: Jiapeng Zhong +Date: Wed, 20 Jan 2021 15:34:30 +0800 +Subject: [PATCH] HID: wacom: Assign boolean values to a bool variable +Git-commit: e29c62ffb008829dc8bcc0a2ec438adc25a8255e +Patch-mainline: v5.12-rc8 +References: git-fixes + +Fix the following coccicheck warnings: + +./drivers/hid/wacom_wac.c:2536:2-6: WARNING: Assignment of +0/1 to bool variable. + +Reported-by: Abaci Robot +Signed-off-by: Jiapeng Zhong +Signed-off-by: Jiri Kosina +Acked-by: Takashi Iwai + +--- + drivers/hid/wacom_wac.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c +index 44d715c12f6a..bdd9ba577150 100644 +--- a/drivers/hid/wacom_wac.c ++++ b/drivers/hid/wacom_wac.c +@@ -2533,7 +2533,7 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac, + !wacom_wac->shared->is_touch_on) { + if (!wacom_wac->shared->touch_down) + return; +- prox = 0; ++ prox = false; + } + + wacom_wac->hid_data.num_received++; +-- +2.26.2 + diff --git a/patches.suse/KVM-PPC-Book3S-HV-P9-Restore-host-CTRL-SPR-after-gue.patch b/patches.suse/KVM-PPC-Book3S-HV-P9-Restore-host-CTRL-SPR-after-gue.patch new file mode 100644 index 0000000..9218991 --- /dev/null +++ b/patches.suse/KVM-PPC-Book3S-HV-P9-Restore-host-CTRL-SPR-after-gue.patch @@ -0,0 +1,55 @@ +From 5088eb4092df12d701af8e0e92860b7186365279 Mon Sep 17 00:00:00 2001 +From: Nicholas Piggin +Date: Mon, 12 Apr 2021 11:48:34 +1000 +Subject: [PATCH] KVM: PPC: Book3S HV P9: Restore host CTRL SPR after guest + exit + +References: bsc#1156395 +Patch-mainline: v5.13-rc1 +Git-commit: 5088eb4092df12d701af8e0e92860b7186365279 + +The host CTRL (runlatch) value is not restored after guest exit. The +host CTRL should always be 1 except in CPU idle code, so this can result +in the host running with runlatch clear, and potentially switching to +a different vCPU which then runs with runlatch clear as well. + +This has little effect on P9 machines, CTRL is only responsible for some +PMU counter logic in the host and so other than corner cases of software +relying on that, or explicitly reading the runlatch value (Linux does +not appear to be affected but it's possible non-Linux guests could be), +there should be no execution correctness problem, though it could be +used as a covert channel between guests. + +There may be microcontrollers, firmware or monitoring tools that sample +the runlatch value out-of-band, however since the register is writable +by guests, these values would (should) not be relied upon for correct +operation of the host, so suboptimal performance or incorrect reporting +should be the worst problem. + +Fixes: 95a6432ce9038 ("KVM: PPC: Book3S HV: Streamlined guest entry/exit path on P9 for radix guests") +Signed-off-by: Nicholas Piggin +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20210412014845.1517916-2-npiggin@gmail.com +Acked-by: Michal Suchanek +--- + arch/powerpc/kvm/book3s_hv.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c +index 13bad6bf4c95..208a053c9adf 100644 +--- a/arch/powerpc/kvm/book3s_hv.c ++++ b/arch/powerpc/kvm/book3s_hv.c +@@ -3728,7 +3728,10 @@ static int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit, + vcpu->arch.dec_expires = dec + tb; + vcpu->cpu = -1; + vcpu->arch.thread_cpu = -1; ++ /* Save guest CTRL register, set runlatch to 1 */ + vcpu->arch.ctrl = mfspr(SPRN_CTRLF); ++ if (!(vcpu->arch.ctrl & 1)) ++ mtspr(SPRN_CTRLT, vcpu->arch.ctrl | 1); + + vcpu->arch.iamr = mfspr(SPRN_IAMR); + vcpu->arch.pspb = mfspr(SPRN_PSPB); +-- +2.26.2 + diff --git a/patches.suse/KVM-PPC-Make-the-VMX-instruction-emulation-routines-.patch b/patches.suse/KVM-PPC-Make-the-VMX-instruction-emulation-routines-.patch new file mode 100644 index 0000000..2bae700 --- /dev/null +++ b/patches.suse/KVM-PPC-Make-the-VMX-instruction-emulation-routines-.patch @@ -0,0 +1,79 @@ +From 9236f57a9e51c72ce426ccd2e53e123de7196a0f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= +Date: Mon, 4 Jan 2021 15:32:01 +0100 +Subject: [PATCH] KVM: PPC: Make the VMX instruction emulation routines static +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +References: bsc#1156395 +Patch-mainline: v5.12-rc1 +Git-commit: 9236f57a9e51c72ce426ccd2e53e123de7196a0f + +These are only used locally. It fixes these W=1 compile errors : + +../arch/powerpc/kvm/powerpc.c:1521:5: error: no previous prototype for ‘kvmppc_get_vmx_dword’ [-Werror=missing-prototypes] + 1521 | int kvmppc_get_vmx_dword(struct kvm_vcpu *vcpu, int index, u64 *val) + | ^~~~~~~~~~~~~~~~~~~~ +../arch/powerpc/kvm/powerpc.c:1539:5: error: no previous prototype for ‘kvmppc_get_vmx_word’ [-Werror=missing-prototypes] + 1539 | int kvmppc_get_vmx_word(struct kvm_vcpu *vcpu, int index, u64 *val) + | ^~~~~~~~~~~~~~~~~~~ +../arch/powerpc/kvm/powerpc.c:1557:5: error: no previous prototype for ‘kvmppc_get_vmx_hword’ [-Werror=missing-prototypes] + 1557 | int kvmppc_get_vmx_hword(struct kvm_vcpu *vcpu, int index, u64 *val) + | ^~~~~~~~~~~~~~~~~~~~ +../arch/powerpc/kvm/powerpc.c:1575:5: error: no previous prototype for ‘kvmppc_get_vmx_byte’ [-Werror=missing-prototypes] + 1575 | int kvmppc_get_vmx_byte(struct kvm_vcpu *vcpu, int index, u64 *val) + | ^~~~~~~~~~~~~~~~~~~ + +Fixes: acc9eb9305fe ("KVM: PPC: Reimplement LOAD_VMX/STORE_VMX instruction mmio emulation with analyse_instr() input") +Signed-off-by: Cédric Le Goater +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20210104143206.695198-19-clg@kaod.org +Acked-by: Michal Suchanek +--- + arch/powerpc/kvm/powerpc.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c +index cf52d26f49cd..25966ae3271e 100644 +--- a/arch/powerpc/kvm/powerpc.c ++++ b/arch/powerpc/kvm/powerpc.c +@@ -1518,7 +1518,7 @@ int kvmppc_handle_vmx_load(struct kvm_vcpu *vcpu, + return emulated; + } + +-int kvmppc_get_vmx_dword(struct kvm_vcpu *vcpu, int index, u64 *val) ++static int kvmppc_get_vmx_dword(struct kvm_vcpu *vcpu, int index, u64 *val) + { + union kvmppc_one_reg reg; + int vmx_offset = 0; +@@ -1536,7 +1536,7 @@ int kvmppc_get_vmx_dword(struct kvm_vcpu *vcpu, int index, u64 *val) + return result; + } + +-int kvmppc_get_vmx_word(struct kvm_vcpu *vcpu, int index, u64 *val) ++static int kvmppc_get_vmx_word(struct kvm_vcpu *vcpu, int index, u64 *val) + { + union kvmppc_one_reg reg; + int vmx_offset = 0; +@@ -1554,7 +1554,7 @@ int kvmppc_get_vmx_word(struct kvm_vcpu *vcpu, int index, u64 *val) + return result; + } + +-int kvmppc_get_vmx_hword(struct kvm_vcpu *vcpu, int index, u64 *val) ++static int kvmppc_get_vmx_hword(struct kvm_vcpu *vcpu, int index, u64 *val) + { + union kvmppc_one_reg reg; + int vmx_offset = 0; +@@ -1572,7 +1572,7 @@ int kvmppc_get_vmx_hword(struct kvm_vcpu *vcpu, int index, u64 *val) + return result; + } + +-int kvmppc_get_vmx_byte(struct kvm_vcpu *vcpu, int index, u64 *val) ++static int kvmppc_get_vmx_byte(struct kvm_vcpu *vcpu, int index, u64 *val) + { + union kvmppc_one_reg reg; + int vmx_offset = 0; +-- +2.26.2 + diff --git a/patches.suse/PM-runtime-Add-documentation-for-pm_runtime_resume_a.patch b/patches.suse/PM-runtime-Add-documentation-for-pm_runtime_resume_a.patch new file mode 100644 index 0000000..aefa196 --- /dev/null +++ b/patches.suse/PM-runtime-Add-documentation-for-pm_runtime_resume_a.patch @@ -0,0 +1,41 @@ +From 2c412337cfe655bcc6adff8904fc653a1678f70f Mon Sep 17 00:00:00 2001 +From: Alan Stern +Date: Thu, 8 Apr 2021 11:22:09 -0400 +Subject: [PATCH] PM: runtime: Add documentation for pm_runtime_resume_and_get() +Git-commit: 2c412337cfe655bcc6adff8904fc653a1678f70f +Patch-mainline: v5.13-rc1 +References: git-fixes + +Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to +deal with usage counter") added a new runtime-PM API function without +updating the documentation in runtime_pm.rst. + +Add the missing documentation. + +Signed-off-by: Alan Stern +Fixes: dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") +Signed-off-by: Rafael J. Wysocki +Acked-by: Takashi Iwai + +--- + Documentation/power/runtime_pm.rst | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/Documentation/power/runtime_pm.rst b/Documentation/power/runtime_pm.rst +index d9c777b18f7a..18ae21bf7f92 100644 +--- a/Documentation/power/runtime_pm.rst ++++ b/Documentation/power/runtime_pm.rst +@@ -339,6 +339,10 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h: + checked additionally, and -EACCES means that 'power.disable_depth' is + different from 0 + ++ `int pm_runtime_resume_and_get(struct device *dev);` ++ - run pm_runtime_resume(dev) and if successful, increment the device's ++ usage counter; return the result of pm_runtime_resume ++ + `int pm_request_idle(struct device *dev);` + - submit a request to execute the subsystem-level idle callback for the + device (the request is represented by a work item in pm_wq); returns 0 on +-- +2.26.2 + diff --git a/patches.suse/Revert-USB-cdc-acm-fix-rounding-error-in-TIOCSSERIAL.patch b/patches.suse/Revert-USB-cdc-acm-fix-rounding-error-in-TIOCSSERIAL.patch new file mode 100644 index 0000000..4f3e4e0 --- /dev/null +++ b/patches.suse/Revert-USB-cdc-acm-fix-rounding-error-in-TIOCSSERIAL.patch @@ -0,0 +1,75 @@ +From 729f7955cb987c5b7d7e54c87c5ad71c789934f7 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Thu, 8 Apr 2021 15:16:00 +0200 +Subject: [PATCH] Revert "USB: cdc-acm: fix rounding error in TIOCSSERIAL" +Git-commit: 729f7955cb987c5b7d7e54c87c5ad71c789934f7 +Patch-mainline: v5.13-rc1 +References: git-fixes + +This reverts commit b401f8c4f492cbf74f3f59c9141e5be3071071bb. + +The offending commit claimed that trying to set the values reported back +by TIOCGSERIAL as a regular user could result in an -EPERM error when HZ +is 250, but that was never the case. + +With HZ=250, the default 0.5 second value of close_delay is converted to +125 jiffies when set and is converted back to 50 centiseconds by +TIOCGSERIAL as expected (not 12 cs as was claimed, even if that was the +case before an earlier fix). + +Comparing the internal current and new jiffies values is just fine to +determine if the value is about to change so drop the bogus workaround +(which was also backported to stable). + +For completeness: With different default values for these parameters or +with a HZ value not divisible by two, the lack of rounding when setting +the default values in tty_port_init() could result in an -EPERM being +returned, but this is hardly something we need to worry about. + +Cc: Anthony Mallet +Cc: stable@vger.kernel.org +Acked-by: Oliver Neukum +Signed-off-by: Johan Hovold +Link: https://lore.kernel.org/r/20210408131602.27956-2-johan@kernel.org +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/class/cdc-acm.c | 11 ++--------- + 1 file changed, 2 insertions(+), 9 deletions(-) + +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c +index 3fda1ec961d7..96e221803fa6 100644 +--- a/drivers/usb/class/cdc-acm.c ++++ b/drivers/usb/class/cdc-acm.c +@@ -942,7 +942,6 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss) + { + struct acm *acm = tty->driver_data; + unsigned int closing_wait, close_delay; +- unsigned int old_closing_wait, old_close_delay; + int retval = 0; + + close_delay = msecs_to_jiffies(ss->close_delay * 10); +@@ -950,17 +949,11 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss) + ASYNC_CLOSING_WAIT_NONE : + msecs_to_jiffies(ss->closing_wait * 10); + +- /* we must redo the rounding here, so that the values match */ +- old_close_delay = jiffies_to_msecs(acm->port.close_delay) / 10; +- old_closing_wait = acm->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ? +- ASYNC_CLOSING_WAIT_NONE : +- jiffies_to_msecs(acm->port.closing_wait) / 10; +- + mutex_lock(&acm->port.mutex); + + if (!capable(CAP_SYS_ADMIN)) { +- if ((ss->close_delay != old_close_delay) || +- (ss->closing_wait != old_closing_wait)) ++ if ((close_delay != acm->port.close_delay) || ++ (closing_wait != acm->port.closing_wait)) + retval = -EPERM; + else + retval = -EOPNOTSUPP; +-- +2.26.2 + diff --git a/patches.suse/USB-CDC-ACM-fix-poison-unpoison-imbalance.patch b/patches.suse/USB-CDC-ACM-fix-poison-unpoison-imbalance.patch new file mode 100644 index 0000000..9c57565 --- /dev/null +++ b/patches.suse/USB-CDC-ACM-fix-poison-unpoison-imbalance.patch @@ -0,0 +1,47 @@ +From a8b3b519618f30a87a304c4e120267ce6f8dc68a Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Wed, 21 Apr 2021 09:45:13 +0200 +Subject: [PATCH] USB: CDC-ACM: fix poison/unpoison imbalance +Git-commit: a8b3b519618f30a87a304c4e120267ce6f8dc68a +Patch-mainline: v5.13-rc1 +References: bsc#1184984 git-fixes + +suspend() does its poisoning conditionally, resume() does it +unconditionally. On a device with combined interfaces this +will balance, on a device with two interfaces the counter will +go negative and resubmission will fail. + +Both actions need to be done conditionally. + +Fixes: 6069e3e927c8f ("USB: cdc-acm: untangle a circular dependency between callback and softint") +Signed-off-by: Oliver Neukum +Cc: stable +Link: https://lore.kernel.org/r/20210421074513.4327-1-oneukum@suse.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai +--- + drivers/usb/class/cdc-acm.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c +index b74713518b3a..c103961c3fae 100644 +--- a/drivers/usb/class/cdc-acm.c ++++ b/drivers/usb/class/cdc-acm.c +@@ -1624,12 +1624,13 @@ static int acm_resume(struct usb_interface *intf) + struct urb *urb; + int rv = 0; + +- acm_unpoison_urbs(acm); + spin_lock_irq(&acm->write_lock); + + if (--acm->susp_count) + goto out; + ++ acm_unpoison_urbs(acm); ++ + if (tty_port_initialized(&acm->port)) { + rv = usb_submit_urb(acm->ctrlurb, GFP_ATOMIC); + +-- +2.26.2 + diff --git a/patches.suse/USB-cdc-acm-fix-TIOCGSERIAL-implementation.patch b/patches.suse/USB-cdc-acm-fix-TIOCGSERIAL-implementation.patch new file mode 100644 index 0000000..daa4cbc --- /dev/null +++ b/patches.suse/USB-cdc-acm-fix-TIOCGSERIAL-implementation.patch @@ -0,0 +1,58 @@ +From 496960274153bdeb9d1f904ff1ea875cef8232c1 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Thu, 8 Apr 2021 15:16:02 +0200 +Subject: [PATCH] USB: cdc-acm: fix TIOCGSERIAL implementation +Git-commit: 496960274153bdeb9d1f904ff1ea875cef8232c1 +Patch-mainline: v5.13-rc1 +References: git-fixes + +TIOCSSERIAL is a horrid, underspecified, legacy interface which for most +serial devices is only useful for setting the close_delay and +closing_wait parameters. + +The xmit_fifo_size parameter could be used to set the hardware transmit +fifo size of a legacy UART when it could not be detected, but the +interface is limited to eight bits and should be left unset when it is +not used. + +Similarly, baud_base could be used to set the UART base clock when it +could not be detected, but might as well be left unset when it is not +known (which is the case for CDC). + +Fix the cdc-acm TIOCGSERIAL implementation by dropping its custom +interpretation of the unused xmit_fifo_size and baud_base fields, which +overflowed the former with the URB buffer size and set the latter to the +current line speed. Also return the port line number, which is the only +other value used besides the close parameters. + +Note that the current line speed can still be retrieved through the +standard termios interfaces. + +Fixes: 18c75720e667 ("USB: allow users to run setserial with cdc-acm") +Acked-by: Oliver Neukum +Signed-off-by: Johan Hovold +Link: https://lore.kernel.org/r/20210408131602.27956-4-johan@kernel.org +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/class/cdc-acm.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c +index 43e31dad4831..b74713518b3a 100644 +--- a/drivers/usb/class/cdc-acm.c ++++ b/drivers/usb/class/cdc-acm.c +@@ -929,8 +929,7 @@ static int get_serial_info(struct tty_struct *tty, struct serial_struct *ss) + { + struct acm *acm = tty->driver_data; + +- ss->xmit_fifo_size = acm->writesize; +- ss->baud_base = le32_to_cpu(acm->line.dwDTERate); ++ ss->line = acm->minor; + ss->close_delay = jiffies_to_msecs(acm->port.close_delay) / 10; + ss->closing_wait = acm->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ? + ASYNC_CLOSING_WAIT_NONE : +-- +2.26.2 + diff --git a/patches.suse/USB-cdc-acm-fix-unprivileged-TIOCCSERIAL.patch b/patches.suse/USB-cdc-acm-fix-unprivileged-TIOCCSERIAL.patch new file mode 100644 index 0000000..37ade0b --- /dev/null +++ b/patches.suse/USB-cdc-acm-fix-unprivileged-TIOCCSERIAL.patch @@ -0,0 +1,48 @@ +From dd5619582d60007139f0447382d2839f4f9e339b Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Thu, 8 Apr 2021 15:16:01 +0200 +Subject: [PATCH] USB: cdc-acm: fix unprivileged TIOCCSERIAL +Git-commit: dd5619582d60007139f0447382d2839f4f9e339b +Patch-mainline: v5.13-rc1 +References: git-fixes + +TIOCSSERIAL is a horrid, underspecified, legacy interface which for most +serial devices is only useful for setting the close_delay and +closing_wait parameters. + +A non-privileged user has only ever been able to set the since long +deprecated ASYNC_SPD flags and trying to change any other *supported* +feature should result in -EPERM being returned. Setting the current +values for any supported features should return success. + +Fix the cdc-acm implementation which instead indicated that the +TIOCSSERIAL ioctl was not even implemented when a non-privileged user +set the current values. + +Fixes: ba2d8ce9db0a ("cdc-acm: implement TIOCSSERIAL to avoid blocking close(2)") +Acked-by: Oliver Neukum +Signed-off-by: Johan Hovold +Link: https://lore.kernel.org/r/20210408131602.27956-3-johan@kernel.org +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/class/cdc-acm.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c +index 96e221803fa6..43e31dad4831 100644 +--- a/drivers/usb/class/cdc-acm.c ++++ b/drivers/usb/class/cdc-acm.c +@@ -955,8 +955,6 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss) + if ((close_delay != acm->port.close_delay) || + (closing_wait != acm->port.closing_wait)) + retval = -EPERM; +- else +- retval = -EOPNOTSUPP; + } else { + acm->port.close_delay = close_delay; + acm->port.closing_wait = closing_wait; +-- +2.26.2 + diff --git a/patches.suse/USB-gadget-udc-fix-wrong-pointer-passed-to-IS_ERR-an.patch b/patches.suse/USB-gadget-udc-fix-wrong-pointer-passed-to-IS_ERR-an.patch new file mode 100644 index 0000000..458b8e3 --- /dev/null +++ b/patches.suse/USB-gadget-udc-fix-wrong-pointer-passed-to-IS_ERR-an.patch @@ -0,0 +1,40 @@ +From 2e3d055bf27d70204cae349335a62a4f9b7c165a Mon Sep 17 00:00:00 2001 +From: Yang Yingliang +Date: Tue, 30 Mar 2021 21:01:59 +0800 +Subject: [PATCH] USB: gadget: udc: fix wrong pointer passed to IS_ERR() and PTR_ERR() +Git-commit: 2e3d055bf27d70204cae349335a62a4f9b7c165a +Patch-mainline: v5.13-rc1 +References: git-fixes + +IS_ERR() and PTR_ERR() use wrong pointer, it should be +udc->virt_addr, fix it. + +Fixes: 1b9f35adb0ff ("usb: gadget: udc: Add Synopsys UDC Platform driver") +Reported-by: Hulk Robot +Signed-off-by: Yang Yingliang +Link: https://lore.kernel.org/r/20210330130159.1051979-1-yangyingliang@huawei.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/gadget/udc/snps_udc_plat.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/gadget/udc/snps_udc_plat.c b/drivers/usb/gadget/udc/snps_udc_plat.c +index 32f1d3e90c26..99805d60a7ab 100644 +--- a/drivers/usb/gadget/udc/snps_udc_plat.c ++++ b/drivers/usb/gadget/udc/snps_udc_plat.c +@@ -114,8 +114,8 @@ static int udc_plat_probe(struct platform_device *pdev) + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + udc->virt_addr = devm_ioremap_resource(dev, res); +- if (IS_ERR(udc->regs)) +- return PTR_ERR(udc->regs); ++ if (IS_ERR(udc->virt_addr)) ++ return PTR_ERR(udc->virt_addr); + + /* udc csr registers base */ + udc->csr = udc->virt_addr + UDC_CSR_ADDR; +-- +2.26.2 + diff --git a/patches.suse/USB-serial-ark3116-fix-TIOCGSERIAL-implementation.patch b/patches.suse/USB-serial-ark3116-fix-TIOCGSERIAL-implementation.patch new file mode 100644 index 0000000..60b5de0 --- /dev/null +++ b/patches.suse/USB-serial-ark3116-fix-TIOCGSERIAL-implementation.patch @@ -0,0 +1,52 @@ +From 9d76b10ac643f1115121d2054f0d47f2e295f743 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 7 Apr 2021 12:39:02 +0200 +Subject: [PATCH] USB: serial: ark3116: fix TIOCGSERIAL implementation +Git-commit: 9d76b10ac643f1115121d2054f0d47f2e295f743 +Patch-mainline: v5.13-rc1 +References: git-fixes + +TIOCSSERIAL is a horrid, underspecified, legacy interface which for most +serial devices is only useful for setting the close_delay and +closing_wait parameters. + +The port parameter is used to set the I/O port and does not make any +sense to use for USB serial devices. + +The baud_base parameter could be used to set the UART base clock when it +could not be detected but might as well be left unset when it is not +known. + +The close_delay and closing_wait parameters returned by TIOCGSERIAL are +specified in centiseconds. The driver does not yet support changing +these, but let's report back the default values actually used (0.5 and +30 seconds, respectively). + +Fixes: 2f430b4bbae7 ("USB: ark3116: Add TIOCGSERIAL and TIOCSSERIAL ioctl calls.") +Reviewed-by: Greg Kroah-Hartman +Signed-off-by: Johan Hovold +Acked-by: Takashi Iwai + +--- + drivers/usb/serial/ark3116.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c +index b9bedfe9bd09..957cdd694b1f 100644 +--- a/drivers/usb/serial/ark3116.c ++++ b/drivers/usb/serial/ark3116.c +@@ -392,8 +392,9 @@ static int ark3116_get_serial_info(struct tty_struct *tty, + + ss->type = PORT_16654; + ss->line = port->minor; +- ss->port = port->port_number; +- ss->baud_base = 460800; ++ ss->close_delay = 50; ++ ss->closing_wait = 3000; ++ + return 0; + } + +-- +2.26.2 + diff --git a/patches.suse/USB-serial-f81232-fix-TIOCGSERIAL-implementation.patch b/patches.suse/USB-serial-f81232-fix-TIOCGSERIAL-implementation.patch new file mode 100644 index 0000000..14ecf83 --- /dev/null +++ b/patches.suse/USB-serial-f81232-fix-TIOCGSERIAL-implementation.patch @@ -0,0 +1,48 @@ +From 5486a9dd37f424750b540633d809f1dfef605788 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 7 Apr 2021 12:39:03 +0200 +Subject: [PATCH] USB: serial: f81232: fix TIOCGSERIAL implementation +Git-commit: 5486a9dd37f424750b540633d809f1dfef605788 +Patch-mainline: v5.13-rc1 +References: git-fixes + +TIOCSSERIAL is a horrid, underspecified, legacy interface which for most +serial devices is only useful for setting the close_delay and +closing_wait parameters. + +The port parameter is used to set the I/O port and does not make any +sense to use for USB serial devices. + +The close_delay and closing_wait parameters returned by TIOCGSERIAL are +specified in centiseconds. The driver does not yet support changing +these, but let's report back the default values actually used (0.5 and +30 seconds, respectively). + +Fixes: aac1fc386fa1 ("USB: serial: add Fintek F81232 usb to serial driver") +Reviewed-by: Greg Kroah-Hartman +Signed-off-by: Johan Hovold +Acked-by: Takashi Iwai + +--- + drivers/usb/serial/f81232.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c +index 6a8f39147d8e..af0fe2a82eb2 100644 +--- a/drivers/usb/serial/f81232.c ++++ b/drivers/usb/serial/f81232.c +@@ -828,8 +828,10 @@ static int f81232_get_serial_info(struct tty_struct *tty, + + ss->type = PORT_16550A; + ss->line = port->minor; +- ss->port = port->port_number; + ss->baud_base = priv->baud_base; ++ ss->close_delay = 50; ++ ss->closing_wait = 3000; ++ + return 0; + } + +-- +2.26.2 + diff --git a/patches.suse/USB-serial-f81534-fix-TIOCGSERIAL-implementation.patch b/patches.suse/USB-serial-f81534-fix-TIOCGSERIAL-implementation.patch new file mode 100644 index 0000000..1900b68 --- /dev/null +++ b/patches.suse/USB-serial-f81534-fix-TIOCGSERIAL-implementation.patch @@ -0,0 +1,49 @@ +From 5c1426df9bb4363ed06bfbb35aaa7cf6076e9953 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 7 Apr 2021 12:39:04 +0200 +Subject: [PATCH] USB: serial: f81534: fix TIOCGSERIAL implementation +Git-commit: 5c1426df9bb4363ed06bfbb35aaa7cf6076e9953 +Patch-mainline: v5.13-rc1 +References: git-fixes + +TIOCSSERIAL is a horrid, underspecified, legacy interface which for most +serial devices is only useful for setting the close_delay and +closing_wait parameters. + +The port parameter is used to set the I/O port and does not make any +sense to use for USB serial devices. + +The close_delay and closing_wait parameters returned by TIOCGSERIAL are +specified in centiseconds. The driver does not yet support changing +these, but let's report back the default values actually used (0.5 and +30 seconds, respectively). + +Fixes: aac1fc386fa1 ("USB: serial: add Fintek F81232 usb to serial driver") +Reviewed-by: Greg Kroah-Hartman +Signed-off-by: Johan Hovold +Acked-by: Takashi Iwai + +--- + drivers/usb/serial/f81534.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/usb/serial/f81534.c b/drivers/usb/serial/f81534.c +index a763b362f081..c9f90d437e3a 100644 +--- a/drivers/usb/serial/f81534.c ++++ b/drivers/usb/serial/f81534.c +@@ -1149,9 +1149,11 @@ static int f81534_get_serial_info(struct tty_struct *tty, + port_priv = usb_get_serial_port_data(port); + + ss->type = PORT_16550A; +- ss->port = port->port_number; + ss->line = port->minor; + ss->baud_base = port_priv->baud_base; ++ ss->close_delay = 50; ++ ss->closing_wait = 3000; ++ + return 0; + } + +-- +2.26.2 + diff --git a/patches.suse/USB-serial-fix-return-value-for-unsupported-ioctls.patch b/patches.suse/USB-serial-fix-return-value-for-unsupported-ioctls.patch new file mode 100644 index 0000000..715bcb8 --- /dev/null +++ b/patches.suse/USB-serial-fix-return-value-for-unsupported-ioctls.patch @@ -0,0 +1,62 @@ +From 5f92aee93a68c3f3b13dc28a7e220adbdc3433b0 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 7 Apr 2021 12:39:20 +0200 +Subject: [PATCH] USB: serial: fix return value for unsupported ioctls +Git-commit: 5f92aee93a68c3f3b13dc28a7e220adbdc3433b0 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Drivers should return -ENOTTY ("Inappropriate I/O control operation") +when an ioctl isn't supported, while -EINVAL is used for invalid +arguments. + +Fix up the TIOCMGET, TIOCMSET and TIOCGICOUNT helpers which returned +-EINVAL when a USB serial driver did not implement the corresponding +methods. + +Note that the TIOCMGET and TIOCMSET helpers predate git and do not get a +corresponding Fixes tag below. + +Fixes: d281da7ff6f7 ("tty: Make tiocgicount a handler") +Reviewed-by: Greg Kroah-Hartman +Signed-off-by: Johan Hovold +Acked-by: Takashi Iwai + +--- + drivers/usb/serial/usb-serial.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c +index aaae71a0bbff..f53a830f4094 100644 +--- a/drivers/usb/serial/usb-serial.c ++++ b/drivers/usb/serial/usb-serial.c +@@ -540,7 +540,7 @@ static int serial_tiocmget(struct tty_struct *tty) + + if (port->serial->type->tiocmget) + return port->serial->type->tiocmget(tty); +- return -EINVAL; ++ return -ENOTTY; + } + + static int serial_tiocmset(struct tty_struct *tty, +@@ -552,7 +552,7 @@ static int serial_tiocmset(struct tty_struct *tty, + + if (port->serial->type->tiocmset) + return port->serial->type->tiocmset(tty, set, clear); +- return -EINVAL; ++ return -ENOTTY; + } + + static int serial_get_icount(struct tty_struct *tty, +@@ -564,7 +564,7 @@ static int serial_get_icount(struct tty_struct *tty, + + if (port->serial->type->get_icount) + return port->serial->type->get_icount(tty, icount); +- return -EINVAL; ++ return -ENOTTY; + } + + /* +-- +2.26.2 + diff --git a/patches.suse/USB-serial-mos7720-fix-TIOCGSERIAL-implementation.patch b/patches.suse/USB-serial-mos7720-fix-TIOCGSERIAL-implementation.patch new file mode 100644 index 0000000..016eddc --- /dev/null +++ b/patches.suse/USB-serial-mos7720-fix-TIOCGSERIAL-implementation.patch @@ -0,0 +1,66 @@ +From 8458e35443d30ec97ecc4b969eca77f2990d0d32 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 7 Apr 2021 12:39:08 +0200 +Subject: [PATCH] USB: serial: mos7720: fix TIOCGSERIAL implementation +Git-commit: 8458e35443d30ec97ecc4b969eca77f2990d0d32 +Patch-mainline: v5.13-rc1 +References: git-fixes + +TIOCSSERIAL is a horrid, underspecified, legacy interface which for most +serial devices is only useful for setting the close_delay and +closing_wait parameters. + +The port parameter is used to set the I/O port and does not make any +sense to use for USB serial devices. + +The xmit_fifo_size parameter could be used to set the hardware transmit +fifo size of a legacy UART when it could not be detected, but the +interface is limited to eight bits and should be left unset when not +used. + +Similarly, baud_base could be used to set the UART base clock when it +could not be detected but might as well be left unset when it is not +known. + +The close_delay and closing_wait parameters returned by TIOCGSERIAL are +specified in centiseconds (not jiffies). The driver does not yet support +changing these, but let's report back the default values actually used +(0.5 and 30 seconds, respectively). + +Fixes: 0f64478cbc7a ("USB: add USB serial mos7720 driver") +Reviewed-by: Greg Kroah-Hartman +Signed-off-by: Johan Hovold +Acked-by: Takashi Iwai + +--- + drivers/usb/serial/mos7720.c | 12 ++++-------- + 1 file changed, 4 insertions(+), 8 deletions(-) + +diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c +index 701dfb32b129..7289d46c3164 100644 +--- a/drivers/usb/serial/mos7720.c ++++ b/drivers/usb/serial/mos7720.c +@@ -1638,16 +1638,12 @@ static int get_serial_info(struct tty_struct *tty, + struct serial_struct *ss) + { + struct usb_serial_port *port = tty->driver_data; +- struct moschip_port *mos7720_port = usb_get_serial_port_data(port); + + ss->type = PORT_16550A; +- ss->line = mos7720_port->port->minor; +- ss->port = mos7720_port->port->port_number; +- ss->irq = 0; +- ss->xmit_fifo_size = NUM_URBS * URB_TRANSFER_BUFFER_SIZE; +- ss->baud_base = 9600; +- ss->close_delay = 5*HZ; +- ss->closing_wait = 30*HZ; ++ ss->line = port->minor; ++ ss->close_delay = 50; ++ ss->closing_wait = 3000; ++ + return 0; + } + +-- +2.26.2 + diff --git a/patches.suse/USB-serial-opticon-fix-TIOCGSERIAL-implementation.patch b/patches.suse/USB-serial-opticon-fix-TIOCGSERIAL-implementation.patch new file mode 100644 index 0000000..d1ba0ec --- /dev/null +++ b/patches.suse/USB-serial-opticon-fix-TIOCGSERIAL-implementation.patch @@ -0,0 +1,58 @@ +From aa6a45850224fc19dbc6058598a9dc57db45b530 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 7 Apr 2021 12:39:10 +0200 +Subject: [PATCH] USB: serial: opticon: fix TIOCGSERIAL implementation +Git-commit: aa6a45850224fc19dbc6058598a9dc57db45b530 +Patch-mainline: v5.13-rc1 +References: git-fixes + +TIOCSSERIAL is a horrid, underspecified, legacy interface which for most +serial devices is only useful for setting the close_delay and +closing_wait parameters. + +The xmit_fifo_size parameter could be used to set the hardware transmit +fifo size of a legacy UART when it could not be detected, but the +interface is limited to eight bits and should be left unset when not +used. + +Similarly, baud_base could be used to set the UART base clock when it +could not be detected but might as well be left unset when it is not +known. + +The close_delay and closing_wait parameters returned by TIOCGSERIAL are +specified in centiseconds (not jiffies). The driver does not yet support +changing these, but let's report back the default values actually used +(0.5 and 30 seconds, respectively). + +Fixes: faac64ad9c7b ("USB: serial: opticon: add serial line ioctls") +Reviewed-by: Greg Kroah-Hartman +Signed-off-by: Johan Hovold +Acked-by: Takashi Iwai + +--- + drivers/usb/serial/opticon.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c +index eecb72aef83e..1c7e5dc2c272 100644 +--- a/drivers/usb/serial/opticon.c ++++ b/drivers/usb/serial/opticon.c +@@ -360,12 +360,9 @@ static int get_serial_info(struct tty_struct *tty, + /* fake emulate a 16550 uart to make userspace code happy */ + ss->type = PORT_16550A; + ss->line = port->minor; +- ss->port = 0; +- ss->irq = 0; +- ss->xmit_fifo_size = 1024; +- ss->baud_base = 9600; +- ss->close_delay = 5*HZ; +- ss->closing_wait = 30*HZ; ++ ss->close_delay = 50; ++ ss->closing_wait = 3000; ++ + return 0; + } + +-- +2.26.2 + diff --git a/patches.suse/USB-serial-quatech2-fix-TIOCGSERIAL-implementation.patch b/patches.suse/USB-serial-quatech2-fix-TIOCGSERIAL-implementation.patch new file mode 100644 index 0000000..bb6fb8d --- /dev/null +++ b/patches.suse/USB-serial-quatech2-fix-TIOCGSERIAL-implementation.patch @@ -0,0 +1,58 @@ +From 4065158c4897533abc430c02f5071d2e3ddbb191 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 7 Apr 2021 12:39:12 +0200 +Subject: [PATCH] USB: serial: quatech2: fix TIOCGSERIAL implementation +Git-commit: 4065158c4897533abc430c02f5071d2e3ddbb191 +Patch-mainline: v5.13-rc1 +References: git-fixes + +TIOCSSERIAL is a horrid, underspecified, legacy interface which for most +serial devices is only useful for setting the close_delay and +closing_wait parameters. + +The xmit_fifo_size parameter could be used to set the hardware transmit +fifo size of a legacy UART when it could not be detected, but the +interface is limited to eight bits and should be left unset when not +used. + +Similarly, baud_base could be used to set the UART base clock when it +could not be detected but might as well be left unset when it is not +known. + +The close_delay and closing_wait parameters returned by TIOCGSERIAL are +specified in centiseconds (not jiffies). The driver does not yet support +changing these, but let's report back the default values actually used +(0.5 and 30 seconds, respectively). + +Fixes: f7a33e608d9a ("USB: serial: add quatech2 usb to serial driver") +Reviewed-by: Greg Kroah-Hartman +Signed-off-by: Johan Hovold +Acked-by: Takashi Iwai + +--- + drivers/usb/serial/quatech2.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c +index 599dcb2e374d..0d23e565e0d2 100644 +--- a/drivers/usb/serial/quatech2.c ++++ b/drivers/usb/serial/quatech2.c +@@ -459,12 +459,9 @@ static int get_serial_info(struct tty_struct *tty, + struct usb_serial_port *port = tty->driver_data; + + ss->line = port->minor; +- ss->port = 0; +- ss->irq = 0; +- ss->xmit_fifo_size = port->bulk_out_size; +- ss->baud_base = 9600; +- ss->close_delay = 5*HZ; +- ss->closing_wait = 30*HZ; ++ ss->close_delay = 50; ++ ss->closing_wait = 3000; ++ + return 0; + } + +-- +2.26.2 + diff --git a/patches.suse/USB-serial-ssu100-fix-TIOCGSERIAL-implementation.patch b/patches.suse/USB-serial-ssu100-fix-TIOCGSERIAL-implementation.patch new file mode 100644 index 0000000..48149bf --- /dev/null +++ b/patches.suse/USB-serial-ssu100-fix-TIOCGSERIAL-implementation.patch @@ -0,0 +1,58 @@ +From 67a948779067f5b2e4e0c5aa67d010c525c8a0ad Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 7 Apr 2021 12:39:13 +0200 +Subject: [PATCH] USB: serial: ssu100: fix TIOCGSERIAL implementation +Git-commit: 67a948779067f5b2e4e0c5aa67d010c525c8a0ad +Patch-mainline: v5.13-rc1 +References: git-fixes + +TIOCSSERIAL is a horrid, underspecified, legacy interface which for most +serial devices is only useful for setting the close_delay and +closing_wait parameters. + +The xmit_fifo_size parameter could be used to set the hardware transmit +fifo size of a legacy UART when it could not be detected, but the +interface is limited to eight bits and should be left unset when not +used. + +Similarly, baud_base could be used to set the UART base clock when it +could not be detected but might as well be left unset when it is not +known. + +The close_delay and closing_wait parameters returned by TIOCGSERIAL are +specified in centiseconds (not jiffies). The driver does not yet support +changing these, but let's report back the default values actually used +(0.5 and 30 seconds, respectively). + +Fixes: 52af95459939 ("USB: add USB serial ssu100 driver") +Reviewed-by: Greg Kroah-Hartman +Signed-off-by: Johan Hovold +Acked-by: Takashi Iwai + +--- + drivers/usb/serial/ssu100.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c +index 89fdc5c19285..c4616c37f33f 100644 +--- a/drivers/usb/serial/ssu100.c ++++ b/drivers/usb/serial/ssu100.c +@@ -337,12 +337,9 @@ static int get_serial_info(struct tty_struct *tty, + struct usb_serial_port *port = tty->driver_data; + + ss->line = port->minor; +- ss->port = 0; +- ss->irq = 0; +- ss->xmit_fifo_size = port->bulk_out_size; +- ss->baud_base = 9600; +- ss->close_delay = 5*HZ; +- ss->closing_wait = 30*HZ; ++ ss->close_delay = 50; ++ ss->closing_wait = 3000; ++ + return 0; + } + +-- +2.26.2 + diff --git a/patches.suse/USB-serial-usb_wwan-fix-TIOCGSERIAL-implementation.patch b/patches.suse/USB-serial-usb_wwan-fix-TIOCGSERIAL-implementation.patch new file mode 100644 index 0000000..6e356e4 --- /dev/null +++ b/patches.suse/USB-serial-usb_wwan-fix-TIOCGSERIAL-implementation.patch @@ -0,0 +1,48 @@ +From b6be55625138c07627d7559ecdd11333545436ae Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 7 Apr 2021 12:39:18 +0200 +Subject: [PATCH] USB: serial: usb_wwan: fix TIOCGSERIAL implementation +Git-commit: b6be55625138c07627d7559ecdd11333545436ae +Patch-mainline: v5.13-rc1 +References: git-fixes + +TIOCSSERIAL is a horrid, underspecified, legacy interface which for most +serial devices is only useful for setting the close_delay and +closing_wait parameters. + +The port parameter is used to set the I/O port and does not make any +sense to use for USB serial devices. + +The baud_base parameter could be used to set the UART base clock when it +could not be detected but might as well be left unset when it is not +known. + +Fix the usb_wwan TIOCGSERIAL implementation by dropping its custom +interpretation of the unused port and baud_base fields, which were set +to the port index and current line speed, respectively. + +Fixes: 02303f73373a ("usb-wwan: implement TIOCGSERIAL and TIOCSSERIAL to avoid blocking close(2)") +Reviewed-by: Greg Kroah-Hartman +Signed-off-by: Johan Hovold +Acked-by: Takashi Iwai + +--- + drivers/usb/serial/usb_wwan.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c +index e71c828682f5..4ea315e5e69b 100644 +--- a/drivers/usb/serial/usb_wwan.c ++++ b/drivers/usb/serial/usb_wwan.c +@@ -138,8 +138,6 @@ int usb_wwan_get_serial_info(struct tty_struct *tty, + struct usb_serial_port *port = tty->driver_data; + + ss->line = port->minor; +- ss->port = port->port_number; +- ss->baud_base = tty_get_baud_rate(port->port.tty); + ss->close_delay = jiffies_to_msecs(port->port.close_delay) / 10; + ss->closing_wait = port->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ? + ASYNC_CLOSING_WAIT_NONE : +-- +2.26.2 + diff --git a/patches.suse/USB-serial-usb_wwan-fix-TIOCSSERIAL-jiffies-conversi.patch b/patches.suse/USB-serial-usb_wwan-fix-TIOCSSERIAL-jiffies-conversi.patch new file mode 100644 index 0000000..723fbfa --- /dev/null +++ b/patches.suse/USB-serial-usb_wwan-fix-TIOCSSERIAL-jiffies-conversi.patch @@ -0,0 +1,57 @@ +From 3d732690d2267f4d0e19077b178dffbedafdf0c9 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 7 Apr 2021 12:39:16 +0200 +Subject: [PATCH] USB: serial: usb_wwan: fix TIOCSSERIAL jiffies conversions +Git-commit: 3d732690d2267f4d0e19077b178dffbedafdf0c9 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The port close_delay and closing_wait parameters set by TIOCSSERIAL are +specified in jiffies and not milliseconds. + +Add the missing conversions so that the TIOCSSERIAL works as expected +also when HZ is not 1000. + +Fixes: 02303f73373a ("usb-wwan: implement TIOCGSERIAL and TIOCSSERIAL to avoid blocking close(2)") +Cc: stable@vger.kernel.org # 2.6.38 +Reviewed-by: Greg Kroah-Hartman +Signed-off-by: Johan Hovold +Acked-by: Takashi Iwai + +--- + drivers/usb/serial/usb_wwan.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c +index 46d46a4f99c9..4e9c994a972a 100644 +--- a/drivers/usb/serial/usb_wwan.c ++++ b/drivers/usb/serial/usb_wwan.c +@@ -140,10 +140,10 @@ int usb_wwan_get_serial_info(struct tty_struct *tty, + ss->line = port->minor; + ss->port = port->port_number; + ss->baud_base = tty_get_baud_rate(port->port.tty); +- ss->close_delay = port->port.close_delay / 10; ++ ss->close_delay = jiffies_to_msecs(port->port.close_delay) / 10; + ss->closing_wait = port->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ? + ASYNC_CLOSING_WAIT_NONE : +- port->port.closing_wait / 10; ++ jiffies_to_msecs(port->port.closing_wait) / 10; + return 0; + } + EXPORT_SYMBOL(usb_wwan_get_serial_info); +@@ -155,9 +155,10 @@ int usb_wwan_set_serial_info(struct tty_struct *tty, + unsigned int closing_wait, close_delay; + int retval = 0; + +- close_delay = ss->close_delay * 10; ++ close_delay = msecs_to_jiffies(ss->close_delay * 10); + closing_wait = ss->closing_wait == ASYNC_CLOSING_WAIT_NONE ? +- ASYNC_CLOSING_WAIT_NONE : ss->closing_wait * 10; ++ ASYNC_CLOSING_WAIT_NONE : ++ msecs_to_jiffies(ss->closing_wait * 10); + + mutex_lock(&port->port.mutex); + +-- +2.26.2 + diff --git a/patches.suse/USB-serial-usb_wwan-fix-unprivileged-TIOCCSERIAL.patch b/patches.suse/USB-serial-usb_wwan-fix-unprivileged-TIOCCSERIAL.patch new file mode 100644 index 0000000..acdb1ec --- /dev/null +++ b/patches.suse/USB-serial-usb_wwan-fix-unprivileged-TIOCCSERIAL.patch @@ -0,0 +1,46 @@ +From a3cb01e2fe3793b8ffcb9cc7f7c7f2ca55793e62 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 7 Apr 2021 12:39:17 +0200 +Subject: [PATCH] USB: serial: usb_wwan: fix unprivileged TIOCCSERIAL +Git-commit: a3cb01e2fe3793b8ffcb9cc7f7c7f2ca55793e62 +Patch-mainline: v5.13-rc1 +References: git-fixes + +TIOCSSERIAL is a horrid, underspecified, legacy interface which for most +serial devices is only useful for setting the close_delay and +closing_wait parameters. + +A non-privileged user has only ever been able to set the since long +deprecated ASYNC_SPD flags and trying to change any other *supported* +feature should result in -EPERM being returned. Setting the current +values for any supported features should return success. + +Fix the usb_wwan implementation which instead indicated that the +TIOCSSERIAL ioctl was not even implemented when a non-privileged user +set the current values. + +Fixes: 02303f73373a ("usb-wwan: implement TIOCGSERIAL and TIOCSSERIAL to avoid blocking close(2)") +Reviewed-by: Greg Kroah-Hartman +Signed-off-by: Johan Hovold +Acked-by: Takashi Iwai + +--- + drivers/usb/serial/usb_wwan.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c +index 4e9c994a972a..e71c828682f5 100644 +--- a/drivers/usb/serial/usb_wwan.c ++++ b/drivers/usb/serial/usb_wwan.c +@@ -166,8 +166,6 @@ int usb_wwan_set_serial_info(struct tty_struct *tty, + if ((close_delay != port->port.close_delay) || + (closing_wait != port->port.closing_wait)) + retval = -EPERM; +- else +- retval = -EOPNOTSUPP; + } else { + port->port.close_delay = close_delay; + port->port.closing_wait = closing_wait; +-- +2.26.2 + diff --git a/patches.suse/ata-libahci_platform-fix-IRQ-check.patch b/patches.suse/ata-libahci_platform-fix-IRQ-check.patch new file mode 100644 index 0000000..7d77bcb --- /dev/null +++ b/patches.suse/ata-libahci_platform-fix-IRQ-check.patch @@ -0,0 +1,44 @@ +From b30d0040f06159de97ad9c0b1536f47250719d7d Mon Sep 17 00:00:00 2001 +From: Sergey Shtylyov +Date: Mon, 15 Mar 2021 23:15:06 +0300 +Subject: [PATCH] ata: libahci_platform: fix IRQ check +Git-commit: b30d0040f06159de97ad9c0b1536f47250719d7d +Patch-mainline: v5.13-rc1 +References: git-fixes + +Iff platform_get_irq() returns 0, ahci_platform_init_host() would return 0 +early (as if the call was successful). Override IRQ0 with -EINVAL instead +as the 'libata' regards 0 as "no IRQ" (thus polling) anyway... + +Fixes: c034640a32f8 ("ata: libahci: properly propagate return value of platform_get_irq()") +Signed-off-by: Sergey Shtylyov +Link: https://lore.kernel.org/r/4448c8cc-331f-2915-0e17-38ea34e251c8@omprussia.ru +Signed-off-by: Jens Axboe +Acked-by: Takashi Iwai + +--- + drivers/ata/libahci_platform.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c +index de638dafce21..b2f552088291 100644 +--- a/drivers/ata/libahci_platform.c ++++ b/drivers/ata/libahci_platform.c +@@ -582,11 +582,13 @@ int ahci_platform_init_host(struct platform_device *pdev, + int i, irq, n_ports, rc; + + irq = platform_get_irq(pdev, 0); +- if (irq <= 0) { ++ if (irq < 0) { + if (irq != -EPROBE_DEFER) + dev_err(dev, "no irq\n"); + return irq; + } ++ if (!irq) ++ return -EINVAL; + + hpriv->irq = irq; + +-- +2.26.2 + diff --git a/patches.suse/ath10k-Fix-ath10k_wmi_tlv_op_pull_peer_stats_info-un.patch b/patches.suse/ath10k-Fix-ath10k_wmi_tlv_op_pull_peer_stats_info-un.patch new file mode 100644 index 0000000..a61b550 --- /dev/null +++ b/patches.suse/ath10k-Fix-ath10k_wmi_tlv_op_pull_peer_stats_info-un.patch @@ -0,0 +1,42 @@ +From eaaf52e4b866f265eb791897d622961293fd48c1 Mon Sep 17 00:00:00 2001 +From: Shuah Khan +Date: Tue, 6 Apr 2021 17:02:28 -0600 +Subject: [PATCH] ath10k: Fix ath10k_wmi_tlv_op_pull_peer_stats_info() unlock without lock +Git-commit: eaaf52e4b866f265eb791897d622961293fd48c1 +Patch-mainline: v5.13-rc1 +References: git-fixes + +ath10k_wmi_tlv_op_pull_peer_stats_info() could try to unlock RCU lock +winthout locking it first when peer reason doesn't match the valid +cases for this function. + +Add a default case to return without unlocking. + +Fixes: 09078368d516 ("ath10k: hold RCU lock when calling ieee80211_find_sta_by_ifaddr()") +Reported-by: Pavel Machek +Signed-off-by: Shuah Khan +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20210406230228.31301-1-skhan@linuxfoundation.org +Acked-by: Takashi Iwai + +--- + drivers/net/wireless/ath/ath10k/wmi-tlv.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c +index d97b33f789e4..7efbe03fbca8 100644 +--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c ++++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c +@@ -592,6 +592,9 @@ static void ath10k_wmi_event_tdls_peer(struct ath10k *ar, struct sk_buff *skb) + GFP_ATOMIC + ); + break; ++ default: ++ kfree(tb); ++ return; + } + + exit: +-- +2.26.2 + diff --git a/patches.suse/ath9k-Fix-error-check-in-ath9k_hw_read_revisions-for.patch b/patches.suse/ath9k-Fix-error-check-in-ath9k_hw_read_revisions-for.patch new file mode 100644 index 0000000..44f2a62 --- /dev/null +++ b/patches.suse/ath9k-Fix-error-check-in-ath9k_hw_read_revisions-for.patch @@ -0,0 +1,61 @@ +From 7dd9a40fd6e0d0f1fd8e1931c007e080801dfdce Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= +Date: Fri, 26 Mar 2021 19:08:19 +0100 +Subject: [PATCH] ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 7dd9a40fd6e0d0f1fd8e1931c007e080801dfdce +Patch-mainline: v5.13-rc1 +References: git-fixes + +When the error check in ath9k_hw_read_revisions() was added, it checked for +-EIO which is what ath9k_regread() in the ath9k_htc driver uses. However, +for plain ath9k, the register read function uses ioread32(), which just +returns -1 on error. So if such a read fails, it still gets passed through +and ends up as a weird mac revision in the log output. + +Fix this by changing ath9k_regread() to return -1 on error like ioread32() +does, and fix the error check to look for that instead of -EIO. + +Fixes: 2f90c7e5d094 ("ath9k: Check for errors when reading SREV register") +Signed-off-by: Toke Høiland-Jørgensen +Reviewed-by: Lorenzo Bianconi +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20210326180819.142480-1-toke@redhat.com +Acked-by: Takashi Iwai + +--- + drivers/net/wireless/ath/ath9k/htc_drv_init.c | 2 +- + drivers/net/wireless/ath/ath9k/hw.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c +index db0c6fa9c9dc..ff61ae34ecdf 100644 +--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c +@@ -246,7 +246,7 @@ static unsigned int ath9k_regread(void *hw_priv, u32 reg_offset) + if (unlikely(r)) { + ath_dbg(common, WMI, "REGISTER READ FAILED: (0x%04x, %d)\n", + reg_offset, r); +- return -EIO; ++ return -1; + } + + return be32_to_cpu(val); +diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c +index 5abc2a5526ec..2ca3b86714a9 100644 +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -286,7 +286,7 @@ static bool ath9k_hw_read_revisions(struct ath_hw *ah) + + srev = REG_READ(ah, AR_SREV); + +- if (srev == -EIO) { ++ if (srev == -1) { + ath_err(ath9k_hw_common(ah), + "Failed to read SREV register"); + return false; +-- +2.26.2 + diff --git a/patches.suse/backlight-journada720-Fix-Wmisleading-indentation-wa.patch b/patches.suse/backlight-journada720-Fix-Wmisleading-indentation-wa.patch new file mode 100644 index 0000000..5cf1c87 --- /dev/null +++ b/patches.suse/backlight-journada720-Fix-Wmisleading-indentation-wa.patch @@ -0,0 +1,91 @@ +From 04758386757c1ef339b18d996976911be61d5efb Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Mon, 22 Mar 2021 17:41:28 +0100 +Subject: [PATCH] backlight: journada720: Fix Wmisleading-indentation warning +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 04758386757c1ef339b18d996976911be61d5efb +Patch-mainline: v5.13-rc1 +References: git-fixes + +With gcc-11, we get a warning about code that looks correct +but badly indented: + +Drivers/video/backlight/jornada720_bl.c: In function ‘jornada_bl_update_status’: +drivers/video/backlight/jornada720_bl.c:66:11: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation] + 66 | } else /* turn on backlight */ + | ^~~~ + +Change the formatting according to our normal conventions. + +Fixes: 13a7b5dc0d17 ("backlight: Adds HP Jornada 700 series backlight driver") +Signed-off-by: Arnd Bergmann +Reviewed-by: Daniel Thompson +Signed-off-by: Lee Jones +Acked-by: Takashi Iwai + +--- + drivers/video/backlight/jornada720_bl.c | 44 ++++++++++++------------- + 1 file changed, 22 insertions(+), 22 deletions(-) + +diff --git a/drivers/video/backlight/jornada720_bl.c b/drivers/video/backlight/jornada720_bl.c +index 996f7ba3b373..066d0dc98f60 100644 +--- a/drivers/video/backlight/jornada720_bl.c ++++ b/drivers/video/backlight/jornada720_bl.c +@@ -66,30 +66,30 @@ static int jornada_bl_update_status(struct backlight_device *bd) + } else /* turn on backlight */ + PPSR |= PPC_LDD1; + +- /* send command to our mcu */ +- if (jornada_ssp_byte(SETBRIGHTNESS) != TXDUMMY) { +- dev_info(&bd->dev, "failed to set brightness\n"); +- ret = -ETIMEDOUT; +- goto out; +- } ++ /* send command to our mcu */ ++ if (jornada_ssp_byte(SETBRIGHTNESS) != TXDUMMY) { ++ dev_info(&bd->dev, "failed to set brightness\n"); ++ ret = -ETIMEDOUT; ++ goto out; ++ } + +- /* +- * at this point we expect that the mcu has accepted +- * our command and is waiting for our new value +- * please note that maximum brightness is 255, +- * but due to physical layout it is equal to 0, so we simply +- * invert the value (MAX VALUE - NEW VALUE). +- */ +- if (jornada_ssp_byte(BL_MAX_BRIGHT - bd->props.brightness) +- != TXDUMMY) { +- dev_err(&bd->dev, "set brightness failed\n"); +- ret = -ETIMEDOUT; +- } ++ /* ++ * at this point we expect that the mcu has accepted ++ * our command and is waiting for our new value ++ * please note that maximum brightness is 255, ++ * but due to physical layout it is equal to 0, so we simply ++ * invert the value (MAX VALUE - NEW VALUE). ++ */ ++ if (jornada_ssp_byte(BL_MAX_BRIGHT - bd->props.brightness) ++ != TXDUMMY) { ++ dev_err(&bd->dev, "set brightness failed\n"); ++ ret = -ETIMEDOUT; ++ } + +- /* +- * If infact we get an TXDUMMY as output we are happy and dont +- * make any further comments about it +- */ ++ /* ++ * If infact we get an TXDUMMY as output we are happy and dont ++ * make any further comments about it ++ */ + out: + jornada_ssp_end(); + +-- +2.26.2 + diff --git a/patches.suse/bluetooth-eliminate-the-potential-race-condition-whe.patch b/patches.suse/bluetooth-eliminate-the-potential-race-condition-whe.patch new file mode 100644 index 0000000..5b89704 --- /dev/null +++ b/patches.suse/bluetooth-eliminate-the-potential-race-condition-whe.patch @@ -0,0 +1,59 @@ +From e2cb6b891ad2b8caa9131e3be70f45243df82a80 Mon Sep 17 00:00:00 2001 +From: Lin Ma +Date: Mon, 12 Apr 2021 19:17:57 +0800 +Subject: [PATCH] bluetooth: eliminate the potential race condition when removing the HCI controller +Git-commit: e2cb6b891ad2b8caa9131e3be70f45243df82a80 +Patch-mainline: v5.13-rc1 +References: git-fixes + +There is a possible race condition vulnerability between issuing a HCI +command and removing the cont. Specifically, functions hci_req_sync() +and hci_dev_do_close() can race each other like below: + +thread-A in hci_req_sync() | thread-B in hci_dev_do_close() + | hci_req_sync_lock(hdev); +test_bit(HCI_UP, &hdev->flags); | +... | test_and_clear_bit(HCI_UP, &hdev->flags) +hci_req_sync_lock(hdev); | + | +In this commit we alter the sequence in function hci_req_sync(). Hence, +the thread-A cannot issue th. + +Signed-off-by: Lin Ma +Cc: Marcel Holtmann +Fixes: 7c6a329e4447 ("[Bluetooth] Fix regression from using default link policy") +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + net/bluetooth/hci_request.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c +index e55976db4403..805ce546b813 100644 +--- a/net/bluetooth/hci_request.c ++++ b/net/bluetooth/hci_request.c +@@ -272,12 +272,16 @@ int hci_req_sync(struct hci_dev *hdev, int (*req)(struct hci_request *req, + { + int ret; + +- if (!test_bit(HCI_UP, &hdev->flags)) +- return -ENETDOWN; +- + /* Serialize all requests */ + hci_req_sync_lock(hdev); +- ret = __hci_req_sync(hdev, req, opt, timeout, hci_status); ++ /* check the state after obtaing the lock to protect the HCI_UP ++ * against any races from hci_dev_do_close when the controller ++ * gets removed. ++ */ ++ if (test_bit(HCI_UP, &hdev->flags)) ++ ret = __hci_req_sync(hdev, req, opt, timeout, hci_status); ++ else ++ ret = -ENETDOWN; + hci_req_sync_unlock(hdev); + + return ret; +-- +2.26.2 + diff --git a/patches.suse/btrfs-fix-race-between-swap-file-activation-and-snap.patch b/patches.suse/btrfs-fix-race-between-swap-file-activation-and-snap.patch new file mode 100644 index 0000000..fdbde8f --- /dev/null +++ b/patches.suse/btrfs-fix-race-between-swap-file-activation-and-snap.patch @@ -0,0 +1,112 @@ +From: Filipe Manana +Date: Fri, 5 Feb 2021 12:55:38 +0000 +Git-commit: dd0734f2a866f9d619d4abf97c3d71bcdee40ea9 +Patch-mainline: v5.12-rc2 +Subject: [PATCH] btrfs: fix race between swap file activation and snapshot + creation +References: bsc#1185587 + +When creating a snapshot we check if the current number of swap files, in +the root, is non-zero, and if it is, we error out and warn that we can not +create the snapshot because there are active swap files. + +However this is racy because when a task started activation of a swap +file, another task might have started already snapshot creation and might +have seen the counter for the number of swap files as zero. This means +that after the swap file is activated we may end up with a snapshot of the +same root successfully created, and therefore when the first write to the +swap file happens it has to fall back into COW mode, which should never +happen for active swap files. + +Basically what can happen is: + +1) Task A starts snapshot creation and enters ioctl.c:create_snapshot(). + There it sees that root->nr_swapfiles has a value of 0 so it continues; + +2) Task B enters btrfs_swap_activate(). It is not aware that another task + started snapshot creation but it did not finish yet. It increments + root->nr_swapfiles from 0 to 1; + +3) Task B checks that the file meets all requirements to be an active + swap file - it has NOCOW set, there are no snapshots for the inode's + root at the moment, no file holes, no reflinked extents, etc; + +4) Task B returns success and now the file is an active swap file; + +5) Task A commits the transaction to create the snapshot and finishes. + The swap file's extents are now shared between the original root and + the snapshot; + +6) A write into an extent of the swap file is attempted - there is a + snapshot of the file's root, so we fall back to COW mode and therefore + the physical location of the extent changes on disk. + +So fix this by taking the snapshot lock during swap file activation before +locking the extent range, as that is the order in which we lock these +during buffered writes. + +Fixes: ed46ff3d42378 ("Btrfs: support swap files") +CC: stable@vger.kernel.org # 5.4+ +Reviewed-by: Anand Jain +Reviewed-by: Josef Bacik +Signed-off-by: Filipe Manana +Signed-off-by: David Sterba +--- + fs/btrfs/inode.c | 21 +++++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c +index c8a7b2e08..872e5c78b 100644 +--- a/fs/btrfs/inode.c ++++ b/fs/btrfs/inode.c +@@ -10901,7 +10901,8 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file, + sector_t *span) + { + struct inode *inode = file_inode(file); +- struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info; ++ struct btrfs_root *root = BTRFS_I(inode)->root; ++ struct btrfs_fs_info *fs_info = root->fs_info; + struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; + struct extent_state *cached_state = NULL; + struct extent_map *em = NULL; +@@ -10952,13 +10953,27 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file, + "cannot activate swapfile while exclusive operation is running"); + return -EBUSY; + } ++ ++ /* ++ * Prevent snapshot creation while we are activating the swap file. ++ * We do not want to race with snapshot creation. If snapshot creation ++ * already started before we bumped nr_swapfiles from 0 to 1 and ++ * completes before the first write into the swap file after it is ++ * activated, than that write would fallback to COW. ++ */ ++ if (!btrfs_start_write_no_snapshotting(root)) { ++ clear_bit(BTRFS_FS_EXCL_OP, &fs_info->flags); ++ btrfs_warn(fs_info, ++ "cannot activate swapfile because snapshot creation is in progress"); ++ return -EINVAL; ++ } + /* + * Snapshots can create extents which require COW even if NODATACOW is + * set. We use this counter to prevent snapshots. We must increment it + * before walking the extents because we don't want a concurrent + * snapshot to run after we've already checked the extents. + */ +- atomic_inc(&BTRFS_I(inode)->root->nr_swapfiles); ++ atomic_inc(&root->nr_swapfiles); + + isize = ALIGN_DOWN(inode->i_size, fs_info->sectorsize); + +@@ -11104,6 +11119,8 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file, + if (ret) + btrfs_swap_deactivate(file); + ++ btrfs_end_write_no_snapshotting(root); ++ + clear_bit(BTRFS_FS_EXCL_OP, &fs_info->flags); + + if (ret) +-- +2.26.2 + diff --git a/patches.suse/btrfs-fix-race-between-writes-to-swap-files-and-scru.patch b/patches.suse/btrfs-fix-race-between-writes-to-swap-files-and-scru.patch new file mode 100644 index 0000000..031d1d2 --- /dev/null +++ b/patches.suse/btrfs-fix-race-between-writes-to-swap-files-and-scru.patch @@ -0,0 +1,238 @@ +From: Filipe Manana +Date: Fri, 5 Feb 2021 12:55:37 +0000 +Git-commit: 195a49eaf655eb914896c92cecd96bc863c9feb3 +Patch-mainline: v5.12-rc2 +Subject: [PATCH] btrfs: fix race between writes to swap files and scrub +References: bsc#1185586 + +When we active a swap file, at btrfs_swap_activate(), we acquire the +exclusive operation lock to prevent the physical location of the swap +file extents to be changed by operations such as balance and device +replace/resize/remove. We also call there can_nocow_extent() which, +among other things, checks if the block group of a swap file extent is +currently RO, and if it is we can not use the extent, since a write +into it would result in COWing the extent. + +However we have no protection against a scrub operation running after we +activate the swap file, which can result in the swap file extents to be +COWed while the scrub is running and operating on the respective block +group, because scrub turns a block group into RO before it processes it +and then back again to RW mode after processing it. That means an attempt +to write into a swap file extent while scrub is processing the respective +block group, will result in COWing the extent, changing its physical +location on disk. + +Fix this by making sure that block groups that have extents that are used +by active swap files can not be turned into RO mode, therefore making it +not possible for a scrub to turn them into RO mode. When a scrub finds a +block group that can not be turned to RO due to the existence of extents +used by swap files, it proceeds to the next block group and logs a warning +message that mentions the block group was skipped due to active swap +files - this is the same approach we currently use for balance. + +Fixes: ed46ff3d42378 ("Btrfs: support swap files") +CC: stable@vger.kernel.org # 5.4+ +Reviewed-by: Anand Jain +Reviewed-by: Josef Bacik +Signed-off-by: Filipe Manana +Signed-off-by: David Sterba +--- + fs/btrfs/block-group.c | 33 ++++++++++++++++++++++++++++++++- + fs/btrfs/block-group.h | 9 +++++++++ + fs/btrfs/ctree.h | 5 +++++ + fs/btrfs/inode.c | 19 ++++++++++++++++++- + fs/btrfs/scrub.c | 9 ++++++++- + 5 files changed, 72 insertions(+), 3 deletions(-) + +diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c +index 4e678ab8c..d38a43f7b 100644 +--- a/fs/btrfs/block-group.c ++++ b/fs/btrfs/block-group.c +@@ -1212,6 +1212,11 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, int force) + spin_lock(&sinfo->lock); + spin_lock(&cache->lock); + ++ if (cache->swap_extents) { ++ ret = -ETXTBSY; ++ goto out; ++ } ++ + if (cache->ro) { + cache->ro++; + ret = 0; +@@ -2159,7 +2164,7 @@ int btrfs_inc_block_group_ro(struct btrfs_block_group *cache, + } + + ret = inc_block_group_ro(cache, 0); +- if (!do_chunk_alloc) ++ if (!do_chunk_alloc || ret == -ETXTBSY) + goto unlock_out; + if (!ret) + goto out; +@@ -2168,6 +2173,8 @@ int btrfs_inc_block_group_ro(struct btrfs_block_group *cache, + if (ret < 0) + goto out; + ret = inc_block_group_ro(cache, 0); ++ if (ret == -ETXTBSY) ++ goto unlock_out; + out: + if (cache->flags & BTRFS_BLOCK_GROUP_SYSTEM) { + alloc_flags = update_block_group_flags(fs_info, cache->flags); +@@ -3236,6 +3243,7 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info) + ASSERT(list_empty(&block_group->io_list)); + ASSERT(list_empty(&block_group->bg_list)); + ASSERT(atomic_read(&block_group->count) == 1); ++ ASSERT(block_group->swap_extents == 0); + btrfs_put_block_group(block_group); + + spin_lock(&info->block_group_cache_lock); +@@ -3321,3 +3329,26 @@ void btrfs_unfreeze_block_group(struct btrfs_block_group *block_group) + __btrfs_remove_free_space_cache(block_group->free_space_ctl); + } + } ++ ++bool btrfs_inc_block_group_swap_extents(struct btrfs_block_group *bg) ++{ ++ bool ret = true; ++ ++ spin_lock(&bg->lock); ++ if (bg->ro) ++ ret = false; ++ else ++ bg->swap_extents++; ++ spin_unlock(&bg->lock); ++ ++ return ret; ++} ++ ++void btrfs_dec_block_group_swap_extents(struct btrfs_block_group *bg, int amount) ++{ ++ spin_lock(&bg->lock); ++ ASSERT(!bg->ro); ++ ASSERT(bg->swap_extents >= amount); ++ bg->swap_extents -= amount; ++ spin_unlock(&bg->lock); ++} +diff --git a/fs/btrfs/block-group.h b/fs/btrfs/block-group.h +index 9fbe91a2c..a44e51a8e 100644 +--- a/fs/btrfs/block-group.h ++++ b/fs/btrfs/block-group.h +@@ -160,6 +160,12 @@ struct btrfs_block_group { + */ + int needs_free_space; + ++ /* ++ * Number of extents in this block group used for swap files. ++ * All accesses protected by the spinlock 'lock'. ++ */ ++ int swap_extents; ++ + /* Record locked full stripes for RAID5/6 block group */ + struct btrfs_full_stripe_locks_tree full_stripe_locks_root; + }; +@@ -261,4 +267,7 @@ void btrfs_unfreeze_block_group(struct btrfs_block_group *cache); + int __btrfs_inc_block_group_ro(struct btrfs_block_group *cache, int force); + u64 btrfs_get_restripe_target(struct btrfs_fs_info *fs_info, u64 flags); + ++bool btrfs_inc_block_group_swap_extents(struct btrfs_block_group *bg); ++void btrfs_dec_block_group_swap_extents(struct btrfs_block_group *bg, int amount); ++ + #endif /* BTRFS_BLOCK_GROUP_H */ +diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h +index daf5c4d90..80eae1053 100644 +--- a/fs/btrfs/ctree.h ++++ b/fs/btrfs/ctree.h +@@ -524,6 +524,11 @@ struct btrfs_swapfile_pin { + * points to a struct btrfs_device. + */ + bool is_block_group; ++ /* ++ * Only used when 'is_block_group' is true and it is the number of ++ * extents used by a swapfile for this block group ('ptr' field). ++ */ ++ int bg_extent_count; + }; + + bool btrfs_pinned_by_swapfile(struct btrfs_fs_info *fs_info, void *ptr); +diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c +index 22d4d7977..c8a7b2e08 100644 +--- a/fs/btrfs/inode.c ++++ b/fs/btrfs/inode.c +@@ -10795,6 +10795,7 @@ static int btrfs_add_swapfile_pin(struct inode *inode, void *ptr, + sp->ptr = ptr; + sp->inode = inode; + sp->is_block_group = is_block_group; ++ sp->bg_extent_count = 1; + + spin_lock(&fs_info->swapfile_pins_lock); + p = &fs_info->swapfile_pins.rb_node; +@@ -10808,6 +10809,8 @@ static int btrfs_add_swapfile_pin(struct inode *inode, void *ptr, + (sp->ptr == entry->ptr && sp->inode > entry->inode)) { + p = &(*p)->rb_right; + } else { ++ if (is_block_group) ++ entry->bg_extent_count++; + spin_unlock(&fs_info->swapfile_pins_lock); + kfree(sp); + return 1; +@@ -10833,8 +10836,11 @@ static void btrfs_free_swapfile_pins(struct inode *inode) + sp = rb_entry(node, struct btrfs_swapfile_pin, node); + if (sp->inode == inode) { + rb_erase(&sp->node, &fs_info->swapfile_pins); +- if (sp->is_block_group) ++ if (sp->is_block_group) { ++ btrfs_dec_block_group_swap_extents(sp->ptr, ++ sp->bg_extent_count); + btrfs_put_block_group(sp->ptr); ++ } + kfree(sp); + } + node = next; +@@ -11049,6 +11055,17 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file, + goto out; + } + ++ if (!btrfs_inc_block_group_swap_extents(bg)) { ++ btrfs_warn(fs_info, ++ "block group for swapfile at %llu is read-only%s", ++ bg->start, ++ atomic_read(&fs_info->scrubs_running) ? ++ " (scrub running)" : ""); ++ btrfs_put_block_group(bg); ++ ret = -EINVAL; ++ goto out; ++ } ++ + ret = btrfs_add_swapfile_pin(inode, bg, true); + if (ret) { + btrfs_put_block_group(bg); +diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c +index a1d5129c6..aae421702 100644 +--- a/fs/btrfs/scrub.c ++++ b/fs/btrfs/scrub.c +@@ -3630,6 +3630,13 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx, + * commit_transactions. + */ + ro_set = 0; ++ } else if (ret == -ETXTBSY) { ++ btrfs_warn(fs_info, ++ "skipping scrub of block group %llu due to active swapfile", ++ cache->start); ++ scrub_pause_off(fs_info); ++ ret = 0; ++ goto skip_unfreeze; + } else { + btrfs_warn(fs_info, + "failed setting block group ro: %d", ret); +@@ -3715,7 +3722,7 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx, + } else { + spin_unlock(&cache->lock); + } +- ++skip_unfreeze: + btrfs_unfreeze_block_group(cache); + btrfs_put_block_group(cache); + if (ret) +-- +2.26.2 + diff --git a/patches.suse/bus-qcom-Put-child-node-before-return.patch b/patches.suse/bus-qcom-Put-child-node-before-return.patch new file mode 100644 index 0000000..8d9a4f4 --- /dev/null +++ b/patches.suse/bus-qcom-Put-child-node-before-return.patch @@ -0,0 +1,43 @@ +From ac6ad7c2a862d682bb584a4bc904d89fa7721af8 Mon Sep 17 00:00:00 2001 +From: Pan Bian +Date: Thu, 21 Jan 2021 03:49:07 -0800 +Subject: [PATCH] bus: qcom: Put child node before return +Git-commit: ac6ad7c2a862d682bb584a4bc904d89fa7721af8 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Put child node before return to fix potential reference count leak. +Generally, the reference count of child is incremented and decremented +automatically in the macro for_each_available_child_of_node() and should +be decremented manually if the loop is broken in loop body. + +Reviewed-by: Linus Walleij +Fixes: 335a12754808 ("bus: qcom: add EBI2 driver") +Signed-off-by: Pan Bian +Link: https://lore.kernel.org/r/20210121114907.109267-1-bianpan2016@163.com +Signed-off-by: Bjorn Andersson +Acked-by: Takashi Iwai + +--- + drivers/bus/qcom-ebi2.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/bus/qcom-ebi2.c b/drivers/bus/qcom-ebi2.c +index 03ddcf426887..0b8f53a688b8 100644 +--- a/drivers/bus/qcom-ebi2.c ++++ b/drivers/bus/qcom-ebi2.c +@@ -353,8 +353,10 @@ static int qcom_ebi2_probe(struct platform_device *pdev) + + /* Figure out the chipselect */ + ret = of_property_read_u32(child, "reg", &csindex); +- if (ret) ++ if (ret) { ++ of_node_put(child); + return ret; ++ } + + if (csindex > 5) { + dev_err(dev, +-- +2.26.2 + diff --git a/patches.suse/clk-exynos7-Mark-aclk_fsys1_200-as-critical.patch b/patches.suse/clk-exynos7-Mark-aclk_fsys1_200-as-critical.patch new file mode 100644 index 0000000..52aeffd --- /dev/null +++ b/patches.suse/clk-exynos7-Mark-aclk_fsys1_200-as-critical.patch @@ -0,0 +1,55 @@ +From 34138a59b92c1a30649a18ec442d2e61f3bc34dd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pawe=C5=82=20Chmiel?= +Date: Sat, 24 Oct 2020 17:43:46 +0200 +Subject: [PATCH] clk: exynos7: Mark aclk_fsys1_200 as critical +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 34138a59b92c1a30649a18ec442d2e61f3bc34dd +Patch-mainline: v5.13-rc1 +References: git-fixes + +This clock must be always enabled to allow access to any registers in +fsys1 CMU. Until proper solution based on runtime PM is applied +(similar to what was done for Exynos5433), mark that clock as critical +so it won't be disabled. + +It was observed on Samsung Galaxy S6 device (based on Exynos7420), where +UFS module is probed before pmic used to power that device. +In this case defer probe was happening and that clock was disabled by +UFS driver, causing whole boot to hang on next CMU access. + +Fixes: 753195a749a6 ("clk: samsung: exynos7: Correct CMU_FSYS1 clocks names") +Signed-off-by: Paweł Chmiel +Acked-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/linux-clk/20201024154346.9589-1-pawel.mikolaj.chmiel@gmail.com +[s.nawrocki: Added comment in the code] +Signed-off-by: Sylwester Nawrocki +Acked-by: Takashi Iwai + +--- + drivers/clk/samsung/clk-exynos7.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/clk/samsung/clk-exynos7.c b/drivers/clk/samsung/clk-exynos7.c +index 87ee1bad9a9a..4a5d2a914bd6 100644 +--- a/drivers/clk/samsung/clk-exynos7.c ++++ b/drivers/clk/samsung/clk-exynos7.c +@@ -537,8 +537,13 @@ static const struct samsung_gate_clock top1_gate_clks[] __initconst = { + GATE(CLK_ACLK_FSYS0_200, "aclk_fsys0_200", "dout_aclk_fsys0_200", + ENABLE_ACLK_TOP13, 28, CLK_SET_RATE_PARENT | + CLK_IS_CRITICAL, 0), ++ /* ++ * This clock is required for the CMU_FSYS1 registers access, keep it ++ * enabled permanently until proper runtime PM support is added. ++ */ + GATE(CLK_ACLK_FSYS1_200, "aclk_fsys1_200", "dout_aclk_fsys1_200", +- ENABLE_ACLK_TOP13, 24, CLK_SET_RATE_PARENT, 0), ++ ENABLE_ACLK_TOP13, 24, CLK_SET_RATE_PARENT | ++ CLK_IS_CRITICAL, 0), + + GATE(CLK_SCLK_PHY_FSYS1_26M, "sclk_phy_fsys1_26m", + "dout_sclk_phy_fsys1_26m", ENABLE_SCLK_TOP1_FSYS11, +-- +2.26.2 + diff --git a/patches.suse/clk-mvebu-armada-37xx-periph-Fix-switching-CPU-freq-.patch b/patches.suse/clk-mvebu-armada-37xx-periph-Fix-switching-CPU-freq-.patch new file mode 100644 index 0000000..47cbf57 --- /dev/null +++ b/patches.suse/clk-mvebu-armada-37xx-periph-Fix-switching-CPU-freq-.patch @@ -0,0 +1,73 @@ +From 4decb9187589f61fe9fc2bc4d9b01160b0a610c5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Thu, 8 Apr 2021 13:42:18 +0200 +Subject: [PATCH] clk: mvebu: armada-37xx-periph: Fix switching CPU freq from 250 Mhz to 1 GHz +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 4decb9187589f61fe9fc2bc4d9b01160b0a610c5 +Patch-mainline: v5.13-rc1 +References: git-fixes + +It was observed that the workaround introduced by commit 61c40f35f5cd +("clk: mvebu: armada-37xx-periph: Fix switching CPU rate from 300Mhz to +1.2GHz") when base CPU frequency is 1.2 GHz is also required when base +CPU frequency is 1 GHz. Otherwise switching CPU frequency directly from +L2 (250 MHz) to L0 (1 GHz) causes a crash. + +When base CPU frequency is just 800 MHz no crashed were observed during +switch from L2 to L0. + +Signed-off-by: Pali Rohár +Acked-by: Stephen Boyd +Acked-by: Gregory CLEMENT +Tested-by: Tomasz Maciej Nowak +Tested-by: Anders Trier Olesen +Tested-by: Philip Soares +Fixes: 2089dc33ea0e ("clk: mvebu: armada-37xx-periph: add DVFS support for cpu clocks") +Signed-off-by: Viresh Kumar +Acked-by: Takashi Iwai + +--- + drivers/clk/mvebu/armada-37xx-periph.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c +index 6507bd2c5f31..b15e177bea7e 100644 +--- a/drivers/clk/mvebu/armada-37xx-periph.c ++++ b/drivers/clk/mvebu/armada-37xx-periph.c +@@ -487,8 +487,10 @@ static long clk_pm_cpu_round_rate(struct clk_hw *hw, unsigned long rate, + } + + /* +- * Switching the CPU from the L2 or L3 frequencies (300 and 200 Mhz +- * respectively) to L0 frequency (1.2 Ghz) requires a significant ++ * Workaround when base CPU frequnecy is 1000 or 1200 MHz ++ * ++ * Switching the CPU from the L2 or L3 frequencies (250/300 or 200 MHz ++ * respectively) to L0 frequency (1/1.2 GHz) requires a significant + * amount of time to let VDD stabilize to the appropriate + * voltage. This amount of time is large enough that it cannot be + * covered by the hardware countdown register. Due to this, the CPU +@@ -498,15 +500,15 @@ static long clk_pm_cpu_round_rate(struct clk_hw *hw, unsigned long rate, + * To work around this problem, we prevent switching directly from the + * L2/L3 frequencies to the L0 frequency, and instead switch to the L1 + * frequency in-between. The sequence therefore becomes: +- * 1. First switch from L2/L3(200/300MHz) to L1(600MHZ) ++ * 1. First switch from L2/L3 (200/250/300 MHz) to L1 (500/600 MHz) + * 2. Sleep 20ms for stabling VDD voltage +- * 3. Then switch from L1(600MHZ) to L0(1200Mhz). ++ * 3. Then switch from L1 (500/600 MHz) to L0 (1000/1200 MHz). + */ + static void clk_pm_cpu_set_rate_wa(unsigned long rate, struct regmap *base) + { + unsigned int cur_level; + +- if (rate != 1200 * 1000 * 1000) ++ if (rate < 1000 * 1000 * 1000) + return; + + regmap_read(base, ARMADA_37XX_NB_CPU_LOAD, &cur_level); +-- +2.26.2 + diff --git a/patches.suse/clk-mvebu-armada-37xx-periph-Fix-workaround-for-swit.patch b/patches.suse/clk-mvebu-armada-37xx-periph-Fix-workaround-for-swit.patch new file mode 100644 index 0000000..e561fac --- /dev/null +++ b/patches.suse/clk-mvebu-armada-37xx-periph-Fix-workaround-for-swit.patch @@ -0,0 +1,121 @@ +From e93033aff684641f71a436ca7a9d2a742126baaf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Thu, 8 Apr 2021 13:42:19 +0200 +Subject: [PATCH] clk: mvebu: armada-37xx-periph: Fix workaround for switching from L1 to L0 +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: e93033aff684641f71a436ca7a9d2a742126baaf +Patch-mainline: v5.13-rc1 +References: git-fixes + +When CPU frequency is at 250 MHz and set_rate() is called with 500 MHz (L1) +quickly followed by a call with 1 GHz (L0), the CPU does not necessarily +stay in L1 for at least 20ms as is required by Marvell errata. + +This situation happens frequently with the ondemand cpufreq governor and +can be also reproduced with userspace governor. In most cases it causes CPU +to crash. + +This change fixes the above issue and ensures that the CPU always stays in +L1 for at least 20ms when switching from any state to L0. + +Signed-off-by: Marek Behún +Signed-off-by: Pali Rohár +Acked-by: Stephen Boyd +Acked-by: Gregory CLEMENT +Tested-by: Tomasz Maciej Nowak +Tested-by: Anders Trier Olesen +Tested-by: Philip Soares +Fixes: 61c40f35f5cd ("clk: mvebu: armada-37xx-periph: Fix switching CPU rate from 300Mhz to 1.2GHz") +Signed-off-by: Viresh Kumar +Acked-by: Takashi Iwai + +--- + drivers/clk/mvebu/armada-37xx-periph.c | 45 ++++++++++++++++++++++---- + 1 file changed, 39 insertions(+), 6 deletions(-) + +diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c +index b15e177bea7e..32ac6b6b7530 100644 +--- a/drivers/clk/mvebu/armada-37xx-periph.c ++++ b/drivers/clk/mvebu/armada-37xx-periph.c +@@ -84,6 +84,7 @@ struct clk_pm_cpu { + void __iomem *reg_div; + u8 shift_div; + struct regmap *nb_pm_base; ++ unsigned long l1_expiration; + }; + + #define to_clk_double_div(_hw) container_of(_hw, struct clk_double_div, hw) +@@ -504,22 +505,52 @@ static long clk_pm_cpu_round_rate(struct clk_hw *hw, unsigned long rate, + * 2. Sleep 20ms for stabling VDD voltage + * 3. Then switch from L1 (500/600 MHz) to L0 (1000/1200 MHz). + */ +-static void clk_pm_cpu_set_rate_wa(unsigned long rate, struct regmap *base) ++static void clk_pm_cpu_set_rate_wa(struct clk_pm_cpu *pm_cpu, ++ unsigned int new_level, unsigned long rate, ++ struct regmap *base) + { + unsigned int cur_level; + +- if (rate < 1000 * 1000 * 1000) +- return; +- + regmap_read(base, ARMADA_37XX_NB_CPU_LOAD, &cur_level); + cur_level &= ARMADA_37XX_NB_CPU_LOAD_MASK; +- if (cur_level <= ARMADA_37XX_DVFS_LOAD_1) ++ ++ if (cur_level == new_level) ++ return; ++ ++ /* ++ * System wants to go to L1 on its own. If we are going from L2/L3, ++ * remember when 20ms will expire. If from L0, set the value so that ++ * next switch to L0 won't have to wait. ++ */ ++ if (new_level == ARMADA_37XX_DVFS_LOAD_1) { ++ if (cur_level == ARMADA_37XX_DVFS_LOAD_0) ++ pm_cpu->l1_expiration = jiffies; ++ else ++ pm_cpu->l1_expiration = jiffies + msecs_to_jiffies(20); + return; ++ } ++ ++ /* ++ * If we are setting to L2/L3, just invalidate L1 expiration time, ++ * sleeping is not needed. ++ */ ++ if (rate < 1000*1000*1000) ++ goto invalidate_l1_exp; ++ ++ /* ++ * We are going to L0 with rate >= 1GHz. Check whether we have been at ++ * L1 for long enough time. If not, go to L1 for 20ms. ++ */ ++ if (pm_cpu->l1_expiration && jiffies >= pm_cpu->l1_expiration) ++ goto invalidate_l1_exp; + + regmap_update_bits(base, ARMADA_37XX_NB_CPU_LOAD, + ARMADA_37XX_NB_CPU_LOAD_MASK, + ARMADA_37XX_DVFS_LOAD_1); + msleep(20); ++ ++invalidate_l1_exp: ++ pm_cpu->l1_expiration = 0; + } + + static int clk_pm_cpu_set_rate(struct clk_hw *hw, unsigned long rate, +@@ -553,7 +584,9 @@ static int clk_pm_cpu_set_rate(struct clk_hw *hw, unsigned long rate, + reg = ARMADA_37XX_NB_CPU_LOAD; + mask = ARMADA_37XX_NB_CPU_LOAD_MASK; + +- clk_pm_cpu_set_rate_wa(rate, base); ++ /* Apply workaround when base CPU frequency is 1000 or 1200 MHz */ ++ if (parent_rate >= 1000*1000*1000) ++ clk_pm_cpu_set_rate_wa(pm_cpu, load_level, rate, base); + + regmap_update_bits(base, reg, mask, load_level); + +-- +2.26.2 + diff --git a/patches.suse/clk-mvebu-armada-37xx-periph-remove-.set_parent-meth.patch b/patches.suse/clk-mvebu-armada-37xx-periph-remove-.set_parent-meth.patch new file mode 100644 index 0000000..100d6a5 --- /dev/null +++ b/patches.suse/clk-mvebu-armada-37xx-periph-remove-.set_parent-meth.patch @@ -0,0 +1,82 @@ +From 4e435a9dd26c46ac018997cc0562d50b1a96f372 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Beh=C3=BAn?= +Date: Thu, 8 Apr 2021 13:42:16 +0200 +Subject: [PATCH] clk: mvebu: armada-37xx-periph: remove .set_parent method for CPU PM clock +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 4e435a9dd26c46ac018997cc0562d50b1a96f372 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Remove the .set_parent method in clk_pm_cpu_ops. + +This method was supposed to be needed by the armada-37xx-cpufreq driver, +but was never actually called due to wrong assumptions in the cpufreq +driver. After this was fixed in the cpufreq driver, this method is not +needed anymore. + +Signed-off-by: Marek Behún +Acked-by: Stephen Boyd +Acked-by: Gregory CLEMENT +Tested-by: Pali Rohár +Tested-by: Tomasz Maciej Nowak +Tested-by: Anders Trier Olesen +Tested-by: Philip Soares +Fixes: 2089dc33ea0e ("clk: mvebu: armada-37xx-periph: add DVFS support for cpu clocks") +Signed-off-by: Viresh Kumar +Acked-by: Takashi Iwai + +--- + drivers/clk/mvebu/armada-37xx-periph.c | 28 -------------------------- + 1 file changed, 28 deletions(-) + +diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c +index f5746f9ea929..6507bd2c5f31 100644 +--- a/drivers/clk/mvebu/armada-37xx-periph.c ++++ b/drivers/clk/mvebu/armada-37xx-periph.c +@@ -440,33 +440,6 @@ static u8 clk_pm_cpu_get_parent(struct clk_hw *hw) + return val; + } + +-static int clk_pm_cpu_set_parent(struct clk_hw *hw, u8 index) +-{ +- struct clk_pm_cpu *pm_cpu = to_clk_pm_cpu(hw); +- struct regmap *base = pm_cpu->nb_pm_base; +- int load_level; +- +- /* +- * We set the clock parent only if the DVFS is available but +- * not enabled. +- */ +- if (IS_ERR(base) || armada_3700_pm_dvfs_is_enabled(base)) +- return -EINVAL; +- +- /* Set the parent clock for all the load level */ +- for (load_level = 0; load_level < LOAD_LEVEL_NR; load_level++) { +- unsigned int reg, mask, val, +- offset = ARMADA_37XX_NB_TBG_SEL_OFF; +- +- armada_3700_pm_dvfs_update_regs(load_level, ®, &offset); +- +- val = index << offset; +- mask = ARMADA_37XX_NB_TBG_SEL_MASK << offset; +- regmap_update_bits(base, reg, mask, val); +- } +- return 0; +-} +- + static unsigned long clk_pm_cpu_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) + { +@@ -592,7 +565,6 @@ static int clk_pm_cpu_set_rate(struct clk_hw *hw, unsigned long rate, + + static const struct clk_ops clk_pm_cpu_ops = { + .get_parent = clk_pm_cpu_get_parent, +- .set_parent = clk_pm_cpu_set_parent, + .round_rate = clk_pm_cpu_round_rate, + .set_rate = clk_pm_cpu_set_rate, + .recalc_rate = clk_pm_cpu_recalc_rate, +-- +2.26.2 + diff --git a/patches.suse/clk-qcom-a53-pll-Add-missing-MODULE_DEVICE_TABLE.patch b/patches.suse/clk-qcom-a53-pll-Add-missing-MODULE_DEVICE_TABLE.patch new file mode 100644 index 0000000..a6d6351 --- /dev/null +++ b/patches.suse/clk-qcom-a53-pll-Add-missing-MODULE_DEVICE_TABLE.patch @@ -0,0 +1,39 @@ +From 790b516ada10a4dcc0f0a56dc0ced475d86d5820 Mon Sep 17 00:00:00 2001 +From: Chen Hui +Date: Fri, 9 Apr 2021 16:23:51 +0800 +Subject: [PATCH] clk: qcom: a53-pll: Add missing MODULE_DEVICE_TABLE +Git-commit: 790b516ada10a4dcc0f0a56dc0ced475d86d5820 +Patch-mainline: v5.13-rc1 +References: git-fixes + +CONFIG_QCOM_A53PLL is tristate option and therefore this driver can be +compiled as a module. This patch adds missing MODULE_DEVICE_TABLE +definition which generates correct modalias for automatic loading of +this driver when it is built as an external module. + +Fixes: 0c6ab1b8f894 ("clk: qcom: Add A53 PLL support") +Signed-off-by: Chen Hui +Reviewed-by: Manivannan Sadhasivam +Link: https://lore.kernel.org/r/20210409082352.233810-3-clare.chenhui@huawei.com +Signed-off-by: Stephen Boyd +Acked-by: Takashi Iwai + +--- + drivers/clk/qcom/a53-pll.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/clk/qcom/a53-pll.c b/drivers/clk/qcom/a53-pll.c +index 45cfc57bff92..af6ac17c7dae 100644 +--- a/drivers/clk/qcom/a53-pll.c ++++ b/drivers/clk/qcom/a53-pll.c +@@ -93,6 +93,7 @@ static const struct of_device_id qcom_a53pll_match_table[] = { + { .compatible = "qcom,msm8916-a53pll" }, + { } + }; ++MODULE_DEVICE_TABLE(of, qcom_a53pll_match_table); + + static struct platform_driver qcom_a53pll_driver = { + .probe = qcom_a53pll_probe, +-- +2.26.2 + diff --git a/patches.suse/clk-uniphier-Fix-potential-infinite-loop.patch b/patches.suse/clk-uniphier-Fix-potential-infinite-loop.patch new file mode 100644 index 0000000..36602be --- /dev/null +++ b/patches.suse/clk-uniphier-Fix-potential-infinite-loop.patch @@ -0,0 +1,47 @@ +From f6b1340dc751a6caa2a0567b667d0f4f4172cd58 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Fri, 9 Apr 2021 10:01:03 +0100 +Subject: [PATCH] clk: uniphier: Fix potential infinite loop +Git-commit: f6b1340dc751a6caa2a0567b667d0f4f4172cd58 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The for-loop iterates with a u8 loop counter i and compares this +with the loop upper limit of num_parents that is an int type. +There is a potential infinite loop if num_parents is larger than +the u8 loop counter. Fix this by making the loop counter the same +type as num_parents. Also make num_parents an unsigned int to +match the return type of the call to clk_hw_get_num_parents. + +Addresses-coverity: ("Infinite loop") +Fixes: 734d82f4a678 ("clk: uniphier: add core support code for UniPhier clock driver") +Signed-off-by: Colin Ian King +Reviewed-by: Masahiro Yamada +Link: https://lore.kernel.org/r/20210409090104.629722-1-colin.king@canonical.com +Signed-off-by: Stephen Boyd +Acked-by: Takashi Iwai + +--- + drivers/clk/uniphier/clk-uniphier-mux.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/clk/uniphier/clk-uniphier-mux.c b/drivers/clk/uniphier/clk-uniphier-mux.c +index 462c84321b2d..1998e9d4cfc0 100644 +--- a/drivers/clk/uniphier/clk-uniphier-mux.c ++++ b/drivers/clk/uniphier/clk-uniphier-mux.c +@@ -31,10 +31,10 @@ static int uniphier_clk_mux_set_parent(struct clk_hw *hw, u8 index) + static u8 uniphier_clk_mux_get_parent(struct clk_hw *hw) + { + struct uniphier_clk_mux *mux = to_uniphier_clk_mux(hw); +- int num_parents = clk_hw_get_num_parents(hw); ++ unsigned int num_parents = clk_hw_get_num_parents(hw); + int ret; + unsigned int val; +- u8 i; ++ unsigned int i; + + ret = regmap_read(mux->regmap, mux->reg, &val); + if (ret) +-- +2.26.2 + diff --git a/patches.suse/clk-zynqmp-move-zynqmp_pll_set_mode-out-of-round_rat.patch b/patches.suse/clk-zynqmp-move-zynqmp_pll_set_mode-out-of-round_rat.patch new file mode 100644 index 0000000..5c64920 --- /dev/null +++ b/patches.suse/clk-zynqmp-move-zynqmp_pll_set_mode-out-of-round_rat.patch @@ -0,0 +1,52 @@ +From d7fd3f9f53df8bb2212dff70f66f12cae0e1a653 Mon Sep 17 00:00:00 2001 +From: Quanyang Wang +Date: Tue, 6 Apr 2021 23:40:15 +0800 +Subject: [PATCH] clk: zynqmp: move zynqmp_pll_set_mode out of round_rate callback +Git-commit: d7fd3f9f53df8bb2212dff70f66f12cae0e1a653 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The round_rate callback should only perform rate calculation and not +involve calling zynqmp_pll_set_mode to change the pll mode. So let's +move zynqmp_pll_set_mode out of round_rate and to set_rate callback. + +Fixes: 3fde0e16d016 ("drivers: clk: Add ZynqMP clock driver") +Reported-by: Laurent Pinchart +Signed-off-by: Quanyang Wang +Link: https://lore.kernel.org/r/20210406154015.602779-1-quanyang.wang@windriver.com +Signed-off-by: Stephen Boyd +Acked-by: Takashi Iwai + +--- + drivers/clk/zynqmp/pll.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/clk/zynqmp/pll.c ++++ b/drivers/clk/zynqmp/pll.c +@@ -103,9 +103,7 @@ static long zynqmp_pll_round_rate(struct + /* Enable the fractional mode if needed */ + rate_div = (rate * FRAC_DIV) / *prate; + f = rate_div % FRAC_DIV; +- zynqmp_pll_set_mode(hw, !!f); +- +- if (zynqmp_pll_get_mode(hw) == PLL_MODE_FRAC) { ++ if (f) { + if (rate > PS_PLL_VCO_MAX) { + fbdiv = rate / PS_PLL_VCO_MAX; + rate = rate / (fbdiv + 1); +@@ -179,10 +177,12 @@ static int zynqmp_pll_set_rate(struct cl + int ret; + const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops(); + +- if (zynqmp_pll_get_mode(hw) == PLL_MODE_FRAC) { +- rate_div = (rate * FRAC_DIV) / parent_rate; ++ rate_div = (rate * FRAC_DIV) / parent_rate; ++ f = rate_div % FRAC_DIV; ++ zynqmp_pll_set_mode(hw, !!f); ++ ++ if (f) { + m = rate_div / FRAC_DIV; +- f = rate_div % FRAC_DIV; + m = clamp_t(u32, m, (PLL_FBDIV_MIN), (PLL_FBDIV_MAX)); + rate = parent_rate * m; + frac = (parent_rate * f) / FRAC_DIV; diff --git a/patches.suse/cpufreq-Kconfig-fix-documentation-links.patch b/patches.suse/cpufreq-Kconfig-fix-documentation-links.patch new file mode 100644 index 0000000..9c7197e --- /dev/null +++ b/patches.suse/cpufreq-Kconfig-fix-documentation-links.patch @@ -0,0 +1,124 @@ +From 733dda9cc849895349b2a64f398aeb56e437f99f Mon Sep 17 00:00:00 2001 +From: Alexander Monakov +Date: Tue, 20 Apr 2021 00:57:07 +0300 +Subject: [PATCH] cpufreq: Kconfig: fix documentation links +Git-commit: 733dda9cc849895349b2a64f398aeb56e437f99f +Patch-mainline: v5.13-rc1 +References: git-fixes + +User documentation for cpufreq governors and drivers has been moved to +admin-guide; adjust references from Kconfig entries accordingly. + +Remove references from undocumented cpufreq drivers, as well as the +'userspace' cpufreq governor, for which no additional details are +provided in the admin-guide text. + +Fixes: 2a0e49279850 ("cpufreq: User/admin documentation update and consolidation") +Signed-off-by: Alexander Monakov +Signed-off-by: Rafael J. Wysocki +Acked-by: Takashi Iwai + +--- + drivers/cpufreq/Kconfig | 23 ++++++----------------- + 1 file changed, 6 insertions(+), 17 deletions(-) + +diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig +index 85de313ddec2..c3038cdc6865 100644 +--- a/drivers/cpufreq/Kconfig ++++ b/drivers/cpufreq/Kconfig +@@ -13,7 +13,8 @@ config CPU_FREQ + clock speed, you need to either enable a dynamic cpufreq governor + (see below) after boot, or use a userspace tool. + +- For details, take a look at . ++ For details, take a look at ++ . + + If in doubt, say N. + +@@ -140,8 +141,6 @@ config CPU_FREQ_GOV_USERSPACE + To compile this driver as a module, choose M here: the + module will be called cpufreq_userspace. + +- For details, take a look at . +- + If in doubt, say Y. + + config CPU_FREQ_GOV_ONDEMAND +@@ -158,7 +157,8 @@ config CPU_FREQ_GOV_ONDEMAND + To compile this driver as a module, choose M here: the + module will be called cpufreq_ondemand. + +- For details, take a look at linux/Documentation/cpu-freq. ++ For details, take a look at ++ . + + If in doubt, say N. + +@@ -182,7 +182,8 @@ config CPU_FREQ_GOV_CONSERVATIVE + To compile this driver as a module, choose M here: the + module will be called cpufreq_conservative. + +- For details, take a look at linux/Documentation/cpu-freq. ++ For details, take a look at ++ . + + If in doubt, say N. + +@@ -246,8 +247,6 @@ config IA64_ACPI_CPUFREQ + This driver adds a CPUFreq driver which utilizes the ACPI + Processor Performance States. + +- For details, take a look at . +- + If in doubt, say N. + endif + +@@ -271,8 +270,6 @@ config LOONGSON2_CPUFREQ + + Loongson2F and it's successors support this feature. + +- For details, take a look at . +- + If in doubt, say N. + + config LOONGSON1_CPUFREQ +@@ -282,8 +279,6 @@ config LOONGSON1_CPUFREQ + This option adds a CPUFreq driver for loongson1 processors which + support software configurable cpu frequency. + +- For details, take a look at . +- + If in doubt, say N. + endif + +@@ -293,8 +288,6 @@ config SPARC_US3_CPUFREQ + help + This adds the CPUFreq driver for UltraSPARC-III processors. + +- For details, take a look at . +- + If in doubt, say N. + + config SPARC_US2E_CPUFREQ +@@ -302,8 +295,6 @@ config SPARC_US2E_CPUFREQ + help + This adds the CPUFreq driver for UltraSPARC-IIe processors. + +- For details, take a look at . +- + If in doubt, say N. + endif + +@@ -318,8 +309,6 @@ config SH_CPU_FREQ + will also generate a notice in the boot log before disabling + itself if the CPU in question is not capable of rate rounding. + +- For details, take a look at . +- + If unsure, say N. + endif + +-- +2.26.2 + diff --git a/patches.suse/cpufreq-armada-37xx-Fix-determining-base-CPU-frequen.patch b/patches.suse/cpufreq-armada-37xx-Fix-determining-base-CPU-frequen.patch new file mode 100644 index 0000000..62abb7b --- /dev/null +++ b/patches.suse/cpufreq-armada-37xx-Fix-determining-base-CPU-frequen.patch @@ -0,0 +1,52 @@ +From 8bad3bf23cbc40abe1d24cec08a114df6facf858 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Thu, 8 Apr 2021 13:42:21 +0200 +Subject: [PATCH] cpufreq: armada-37xx: Fix determining base CPU frequency +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 8bad3bf23cbc40abe1d24cec08a114df6facf858 +Patch-mainline: v5.13-rc1 +References: git-fixes + +When current CPU load is not L0 then loading armada-37xx-cpufreq.ko driver +fails with following error: + + # modprobe armada-37xx-cpufreq + [ 502.702097] Unsupported CPU frequency 250 MHz + +This issue was partially fixed by commit 8db82563451f ("cpufreq: +Armada-37xx: fix frequency calculation for opp"), but only for calculating +CPU frequency for opp. + +Fix this also for determination of base CPU frequency. + +Signed-off-by: Pali Rohár +Acked-by: Gregory CLEMENT +Tested-by: Tomasz Maciej Nowak +Tested-by: Anders Trier Olesen +Tested-by: Philip Soares +Fixes: 92ce45fb875d ("cpufreq: Add DVFS support for Armada 37xx") +Signed-off-by: Viresh Kumar +Acked-by: Takashi Iwai + +--- + drivers/cpufreq/armada-37xx-cpufreq.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/cpufreq/armada-37xx-cpufreq.c b/drivers/cpufreq/armada-37xx-cpufreq.c +index 1ab2113daef5..e4782f562e7a 100644 +--- a/drivers/cpufreq/armada-37xx-cpufreq.c ++++ b/drivers/cpufreq/armada-37xx-cpufreq.c +@@ -469,7 +469,7 @@ static int __init armada37xx_cpufreq_driver_init(void) + return -EINVAL; + } + +- dvfs = armada_37xx_cpu_freq_info_get(cur_frequency); ++ dvfs = armada_37xx_cpu_freq_info_get(base_frequency); + if (!dvfs) { + clk_put(clk); + return -EINVAL; +-- +2.26.2 + diff --git a/patches.suse/cpufreq-armada-37xx-Fix-driver-cleanup-when-registra.patch b/patches.suse/cpufreq-armada-37xx-Fix-driver-cleanup-when-registra.patch new file mode 100644 index 0000000..bfc3edd --- /dev/null +++ b/patches.suse/cpufreq-armada-37xx-Fix-driver-cleanup-when-registra.patch @@ -0,0 +1,47 @@ +From 92963903a8e11b9576eb7249f8e81eefa93b6f96 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Thu, 8 Apr 2021 13:42:20 +0200 +Subject: [PATCH] cpufreq: armada-37xx: Fix driver cleanup when registration failed +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 92963903a8e11b9576eb7249f8e81eefa93b6f96 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Commit 8db82563451f ("cpufreq: armada-37xx: fix frequency calculation for +opp") changed calculation of frequency passed to the dev_pm_opp_add() +function call. But the code for dev_pm_opp_remove() function call was not +updated, so the driver cleanup phase does not work when registration fails. + +This fixes the issue by using the same frequency in both calls. + +Signed-off-by: Pali Rohár +Acked-by: Gregory CLEMENT +Tested-by: Tomasz Maciej Nowak +Tested-by: Anders Trier Olesen +Tested-by: Philip Soares +Fixes: 8db82563451f ("cpufreq: armada-37xx: fix frequency calculation for opp") +Signed-off-by: Viresh Kumar +Acked-by: Takashi Iwai + +--- + drivers/cpufreq/armada-37xx-cpufreq.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/cpufreq/armada-37xx-cpufreq.c b/drivers/cpufreq/armada-37xx-cpufreq.c +index c7683d447b11..1ab2113daef5 100644 +--- a/drivers/cpufreq/armada-37xx-cpufreq.c ++++ b/drivers/cpufreq/armada-37xx-cpufreq.c +@@ -521,7 +521,7 @@ static int __init armada37xx_cpufreq_driver_init(void) + remove_opp: + /* clean-up the already added opp before leaving */ + while (load_lvl-- > ARMADA_37XX_DVFS_LOAD_0) { +- freq = cur_frequency / dvfs->divider[load_lvl]; ++ freq = base_frequency / dvfs->divider[load_lvl]; + dev_pm_opp_remove(cpu_dev, freq); + } + +-- +2.26.2 + diff --git a/patches.suse/cpufreq-armada-37xx-Fix-setting-TBG-parent-for-load-.patch b/patches.suse/cpufreq-armada-37xx-Fix-setting-TBG-parent-for-load-.patch new file mode 100644 index 0000000..374038b --- /dev/null +++ b/patches.suse/cpufreq-armada-37xx-Fix-setting-TBG-parent-for-load-.patch @@ -0,0 +1,151 @@ +From 22592df194e31baf371906cc720da38fa0ab68f5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Beh=C3=BAn?= +Date: Thu, 8 Apr 2021 13:42:15 +0200 +Subject: [PATCH] cpufreq: armada-37xx: Fix setting TBG parent for load levels +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 22592df194e31baf371906cc720da38fa0ab68f5 +Patch-mainline: v5.13-rc1 +References: git-fixes + +With CPU frequency determining software [1] we have discovered that +after this driver does one CPU frequency change, the base frequency of +the CPU is set to the frequency of TBG-A-P clock, instead of the TBG +that is parent to the CPU. + +This can be reproduced on EspressoBIN and Turris MOX: + cd /sys/devices/system/cpu/cpufreq/policy0 + echo powersave >scaling_governor + echo performance >scaling_governor + +Running the mhz tool before this driver is loaded reports 1000 MHz, and +after loading the driver and executing commands above the tool reports +800 MHz. + +The change of TBG clock selector is supposed to happen in function +armada37xx_cpufreq_dvfs_setup. Before the function returns, it does +This: parent = clk_get_parent(clk); clk_set_parent(clk, parent); + +The armada-37xx-periph clock driver has the .set_parent method +implemented correctly for this, so if the method was actually called, +this would work. But since the introduction of the common clock +framework in commit b2476490ef11 ("clk: introduce the common clock..."), +the clk_set_parent function checks whether the parent is actually +changing, and if the requested new parent is same as the old parent +(which is obviously the case for the code above), the .set_parent method +is not called at all. + +This patch fixes this issue by filling the correct TBG clock selector +directly in the armada37xx_cpufreq_dvfs_setup during the filling of +other registers at the same address. But the determination of CPU TBG +index cannot be done via the common clock framework, therefore we need +to access the North Bridge Peripheral Clock registers directly in this +driver. + +[1] https://github.com/wtarreau/mhz + +Signed-off-by: Marek Behún +Acked-by: Gregory CLEMENT +Tested-by: Pali Rohár +Tested-by: Tomasz Maciej Nowak +Tested-by: Anders Trier Olesen +Tested-by: Philip Soares +Fixes: 92ce45fb875d ("cpufreq: Add DVFS support for Armada 37xx") +Signed-off-by: Viresh Kumar +Acked-by: Takashi Iwai + +--- + drivers/cpufreq/armada-37xx-cpufreq.c | 35 ++++++++++++++++++--------- + 1 file changed, 23 insertions(+), 12 deletions(-) + +diff --git a/drivers/cpufreq/armada-37xx-cpufreq.c b/drivers/cpufreq/armada-37xx-cpufreq.c +index b4af4094309b..b8dc6c849579 100644 +--- a/drivers/cpufreq/armada-37xx-cpufreq.c ++++ b/drivers/cpufreq/armada-37xx-cpufreq.c +@@ -25,6 +25,10 @@ + + #include "cpufreq-dt.h" + ++/* Clk register set */ ++#define ARMADA_37XX_CLK_TBG_SEL 0 ++#define ARMADA_37XX_CLK_TBG_SEL_CPU_OFF 22 ++ + /* Power management in North Bridge register set */ + #define ARMADA_37XX_NB_L0L1 0x18 + #define ARMADA_37XX_NB_L2L3 0x1C +@@ -120,10 +124,15 @@ static struct armada_37xx_dvfs *armada_37xx_cpu_freq_info_get(u32 freq) + * will be configured then the DVFS will be enabled. + */ + static void __init armada37xx_cpufreq_dvfs_setup(struct regmap *base, +- struct clk *clk, u8 *divider) ++ struct regmap *clk_base, u8 *divider) + { ++ u32 cpu_tbg_sel; + int load_lvl; +- struct clk *parent; ++ ++ /* Determine to which TBG clock is CPU connected */ ++ regmap_read(clk_base, ARMADA_37XX_CLK_TBG_SEL, &cpu_tbg_sel); ++ cpu_tbg_sel >>= ARMADA_37XX_CLK_TBG_SEL_CPU_OFF; ++ cpu_tbg_sel &= ARMADA_37XX_NB_TBG_SEL_MASK; + + for (load_lvl = 0; load_lvl < LOAD_LEVEL_NR; load_lvl++) { + unsigned int reg, mask, val, offset = 0; +@@ -142,6 +151,11 @@ static void __init armada37xx_cpufreq_dvfs_setup(struct regmap *base, + mask = (ARMADA_37XX_NB_CLK_SEL_MASK + << ARMADA_37XX_NB_CLK_SEL_OFF); + ++ /* Set TBG index, for all levels we use the same TBG */ ++ val = cpu_tbg_sel << ARMADA_37XX_NB_TBG_SEL_OFF; ++ mask = (ARMADA_37XX_NB_TBG_SEL_MASK ++ << ARMADA_37XX_NB_TBG_SEL_OFF); ++ + /* + * Set cpu divider based on the pre-computed array in + * order to have balanced step. +@@ -160,14 +174,6 @@ static void __init armada37xx_cpufreq_dvfs_setup(struct regmap *base, + + regmap_update_bits(base, reg, mask, val); + } +- +- /* +- * Set cpu clock source, for all the level we keep the same +- * clock source that the one already configured. For this one +- * we need to use the clock framework +- */ +- parent = clk_get_parent(clk); +- clk_set_parent(clk, parent); + } + + /* +@@ -358,11 +364,16 @@ static int __init armada37xx_cpufreq_driver_init(void) + struct platform_device *pdev; + unsigned long freq; + unsigned int cur_frequency, base_frequency; +- struct regmap *nb_pm_base, *avs_base; ++ struct regmap *nb_clk_base, *nb_pm_base, *avs_base; + struct device *cpu_dev; + int load_lvl, ret; + struct clk *clk, *parent; + ++ nb_clk_base = ++ syscon_regmap_lookup_by_compatible("marvell,armada-3700-periph-clock-nb"); ++ if (IS_ERR(nb_clk_base)) ++ return -ENODEV; ++ + nb_pm_base = + syscon_regmap_lookup_by_compatible("marvell,armada-3700-nb-pm"); + +@@ -439,7 +450,7 @@ static int __init armada37xx_cpufreq_driver_init(void) + armada37xx_cpufreq_avs_configure(avs_base, dvfs); + armada37xx_cpufreq_avs_setup(avs_base, dvfs); + +- armada37xx_cpufreq_dvfs_setup(nb_pm_base, clk, dvfs->divider); ++ armada37xx_cpufreq_dvfs_setup(nb_pm_base, nb_clk_base, dvfs->divider); + clk_put(clk); + + for (load_lvl = ARMADA_37XX_DVFS_LOAD_0; load_lvl < LOAD_LEVEL_NR; +-- +2.26.2 + diff --git a/patches.suse/cpufreq-armada-37xx-Fix-the-AVS-value-for-load-L1.patch b/patches.suse/cpufreq-armada-37xx-Fix-the-AVS-value-for-load-L1.patch new file mode 100644 index 0000000..652fc71 --- /dev/null +++ b/patches.suse/cpufreq-armada-37xx-Fix-the-AVS-value-for-load-L1.patch @@ -0,0 +1,127 @@ +From d118ac2062b5b8331c8768ac81e016617e0996ee Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Thu, 8 Apr 2021 13:42:17 +0200 +Subject: [PATCH] cpufreq: armada-37xx: Fix the AVS value for load L1 +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: d118ac2062b5b8331c8768ac81e016617e0996ee +Patch-mainline: v5.13-rc1 +References: git-fixes + +The original CPU voltage value for load L1 is too low for Armada 37xx SoC +when base CPU frequency is 1000 or 1200 MHz. It leads to instabilities +where CPU gets stuck soon after dynamic voltage scaling from load L1 to L0. + +Update the CPU voltage value for load L1 accordingly when base frequency is +1000 or 1200 MHz. The minimal L1 value for base CPU frequency 1000 MHz is +updated from the original 1.05V to 1.108V and for 1200 MHz is updated to +1.155V. This minimal L1 value is used only in the case when it is lower +than value for L0. + +This change fixes CPU instability issues on 1 GHz and 1.2 GHz variants of +Espressobin and 1 GHz Turris Mox. + +Marvell previously for 1 GHz variant of Espressobin provided a patch [1] +suitable only for their Marvell Linux kernel 4.4 fork which workarounded +this issue. Patch forced CPU voltage value to 1.108V in all loads. But +such change does not fix CPU instability issues on 1.2 GHz variants of +Armada 3720 SoC. + +During testing we come to the conclusion that using 1.108V as minimal +value for L1 load makes 1 GHz variants of Espressobin and Turris Mox boards +stable. And similarly 1.155V for 1.2 GHz variant of Espressobin. + +These two values 1.108V and 1.155V are documented in Armada 3700 Hardware +Specifications as typical initial CPU voltage values. + +Discussion about this issue is also at the Armbian forum [2]. + +[1] - https://github.com/MarvellEmbeddedProcessors/linux-marvell/commit/dc33b62c90696afb6adc7dbcc4ebbd48bedec269 +[2] - https://forum.armbian.com/topic/10429-how-to-make-espressobin-v7-stable/ + +Signed-off-by: Pali Rohár +Acked-by: Gregory CLEMENT +Tested-by: Tomasz Maciej Nowak +Tested-by: Anders Trier Olesen +Tested-by: Philip Soares +Fixes: 1c3528232f4b ("cpufreq: armada-37xx: Add AVS support") +Signed-off-by: Viresh Kumar +Acked-by: Takashi Iwai + +--- + drivers/cpufreq/armada-37xx-cpufreq.c | 37 +++++++++++++++++++++++++++ + 1 file changed, 37 insertions(+) + +diff --git a/drivers/cpufreq/armada-37xx-cpufreq.c b/drivers/cpufreq/armada-37xx-cpufreq.c +index b8dc6c849579..c7683d447b11 100644 +--- a/drivers/cpufreq/armada-37xx-cpufreq.c ++++ b/drivers/cpufreq/armada-37xx-cpufreq.c +@@ -73,6 +73,8 @@ + #define LOAD_LEVEL_NR 4 + + #define MIN_VOLT_MV 1000 ++#define MIN_VOLT_MV_FOR_L1_1000MHZ 1108 ++#define MIN_VOLT_MV_FOR_L1_1200MHZ 1155 + + /* AVS value for the corresponding voltage (in mV) */ + static int avs_map[] = { +@@ -208,6 +210,8 @@ static u32 armada_37xx_avs_val_match(int target_vm) + * - L2 & L3 voltage should be about 150mv smaller than L0 voltage. + * This function calculates L1 & L2 & L3 AVS values dynamically based + * on L0 voltage and fill all AVS values to the AVS value table. ++ * When base CPU frequency is 1000 or 1200 MHz then there is additional ++ * minimal avs value for load L1. + */ + static void __init armada37xx_cpufreq_avs_configure(struct regmap *base, + struct armada_37xx_dvfs *dvfs) +@@ -239,6 +243,19 @@ static void __init armada37xx_cpufreq_avs_configure(struct regmap *base, + for (load_level = 1; load_level < LOAD_LEVEL_NR; load_level++) + dvfs->avs[load_level] = avs_min; + ++ /* ++ * Set the avs values for load L0 and L1 when base CPU frequency ++ * is 1000/1200 MHz to its typical initial values according to ++ * the Armada 3700 Hardware Specifications. ++ */ ++ if (dvfs->cpu_freq_max >= 1000*1000*1000) { ++ if (dvfs->cpu_freq_max >= 1200*1000*1000) ++ avs_min = armada_37xx_avs_val_match(MIN_VOLT_MV_FOR_L1_1200MHZ); ++ else ++ avs_min = armada_37xx_avs_val_match(MIN_VOLT_MV_FOR_L1_1000MHZ); ++ dvfs->avs[0] = dvfs->avs[1] = avs_min; ++ } ++ + return; + } + +@@ -258,6 +275,26 @@ static void __init armada37xx_cpufreq_avs_configure(struct regmap *base, + target_vm = avs_map[l0_vdd_min] - 150; + target_vm = target_vm > MIN_VOLT_MV ? target_vm : MIN_VOLT_MV; + dvfs->avs[2] = dvfs->avs[3] = armada_37xx_avs_val_match(target_vm); ++ ++ /* ++ * Fix the avs value for load L1 when base CPU frequency is 1000/1200 MHz, ++ * otherwise the CPU gets stuck when switching from load L1 to load L0. ++ * Also ensure that avs value for load L1 is not higher than for L0. ++ */ ++ if (dvfs->cpu_freq_max >= 1000*1000*1000) { ++ u32 avs_min_l1; ++ ++ if (dvfs->cpu_freq_max >= 1200*1000*1000) ++ avs_min_l1 = armada_37xx_avs_val_match(MIN_VOLT_MV_FOR_L1_1200MHZ); ++ else ++ avs_min_l1 = armada_37xx_avs_val_match(MIN_VOLT_MV_FOR_L1_1000MHZ); ++ ++ if (avs_min_l1 > dvfs->avs[0]) ++ avs_min_l1 = dvfs->avs[0]; ++ ++ if (dvfs->avs[1] < avs_min_l1) ++ dvfs->avs[1] = avs_min_l1; ++ } + } + + static void __init armada37xx_cpufreq_avs_setup(struct regmap *base, +-- +2.26.2 + diff --git a/patches.suse/crypto-arm-curve25519-Move-.fpu-after-.arch.patch b/patches.suse/crypto-arm-curve25519-Move-.fpu-after-.arch.patch new file mode 100644 index 0000000..12ac9b8 --- /dev/null +++ b/patches.suse/crypto-arm-curve25519-Move-.fpu-after-.arch.patch @@ -0,0 +1,72 @@ +From 44200f2d9b8b52389c70e6c7bbe51e0dc6eaf938 Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor +Date: Fri, 9 Apr 2021 15:11:55 -0700 +Subject: [PATCH] crypto: arm/curve25519 - Move '.fpu' after '.arch' +Git-commit: 44200f2d9b8b52389c70e6c7bbe51e0dc6eaf938 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Debian's clang carries a patch that makes the default FPU mode +'vfp3-d16' instead of 'neon' for 'armv7-a' to avoid generating NEON +instructions on hardware that does not support them: + +https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/raw/5a61ca6f21b4ad8c6ac4970e5ea5a7b5b4486d22/debian/patches/clang-arm-default-vfp3-on-armv7a.patch +https://bugs.debian.org/841474 +https://bugs.debian.org/842142 +https://bugs.debian.org/914268 + +This results in the following build error when clang's integrated +assembler is used because the '.arch' directive overrides the '.fpu' +Directive: + +arch/arm/crypto/curve25519-core.S:25:2: error: instruction requires: NEON + vmov.i32 q0, #1 + ^ +arch/arm/crypto/curve25519-core.S:26:2: error: instruction requires: NEON + vshr.u64 q1, q0, #7 + ^ +arch/arm/crypto/curve25519-core.S:27:2: error: instruction requires: NEON + vshr.u64 q0, q0, #8 + ^ +arch/arm/crypto/curve25519-core.S:28:2: error: instruction requires: NEON + vmov.i32 d4, #19 + ^ + +Shuffle the order of the '.arch' and '.fpu' directives so that the code +builds regardless of the default FPU mode. This has been tested against +both clang with and without Debian's patch and GCC. + +Cc: stable@vger.kernel.org +Fixes: d8f1308a025f ("crypto: arm/curve25519 - wire up NEON implementation") +Link: https://github.com/ClangBuiltLinux/continuous-integration2/issues/118 +Reported-by: Arnd Bergmann +Suggested-by: Arnd Bergmann +Suggested-by: Jessica Clarke +Signed-off-by: Nathan Chancellor +Acked-by: Jason A. Donenfeld +Reviewed-by: Nick Desaulniers +Tested-by: Nick Desaulniers +Signed-off-by: Herbert Xu +Acked-by: Takashi Iwai + +--- + arch/arm/crypto/curve25519-core.S | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/crypto/curve25519-core.S b/arch/arm/crypto/curve25519-core.S +index be18af52e7dc..b697fa5d059a 100644 +--- a/arch/arm/crypto/curve25519-core.S ++++ b/arch/arm/crypto/curve25519-core.S +@@ -10,8 +10,8 @@ + #include + + .text +-.fpu neon + .arch armv7-a ++.fpu neon + .align 4 + + ENTRY(curve25519_neon) +-- +2.26.2 + diff --git a/patches.suse/crypto-rng-fix-crypto_rng_reset-refcounting-when-CRY.patch b/patches.suse/crypto-rng-fix-crypto_rng_reset-refcounting-when-CRY.patch new file mode 100644 index 0000000..f786cc4 --- /dev/null +++ b/patches.suse/crypto-rng-fix-crypto_rng_reset-refcounting-when-CRY.patch @@ -0,0 +1,59 @@ +From 30d0f6a956fc74bb2e948398daf3278c6b08c7e9 Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Sun, 21 Mar 2021 22:07:48 -0700 +Subject: [PATCH] crypto: rng - fix crypto_rng_reset() refcounting when !CRYPTO_STATS +Git-commit: 30d0f6a956fc74bb2e948398daf3278c6b08c7e9 +Patch-mainline: v5.13-rc1 +References: git-fixes + +crypto_stats_get() is a no-op when the kernel is compiled without +CONFIG_CRYPTO_STATS, so pairing it with crypto_alg_put() unconditionally +(as crypto_rng_reset() does) is wrong. + +Fix this by moving the call to crypto_stats_get() to just before the +actual algorithm operation which might need it. This makes it always +paired with crypto_stats_rng_seed(). + +Fixes: eed74b3eba9e ("crypto: rng - Fix a refcounting bug in crypto_rng_reset()") +Cc: stable@vger.kernel.org +Signed-off-by: Eric Biggers +Signed-off-by: Herbert Xu +Acked-by: Takashi Iwai + +--- + crypto/rng.c | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +diff --git a/crypto/rng.c b/crypto/rng.c +index a888d84b524a..fea082b25fe4 100644 +--- a/crypto/rng.c ++++ b/crypto/rng.c +@@ -34,22 +34,18 @@ int crypto_rng_reset(struct crypto_rng *tfm, const u8 *seed, unsigned int slen) + u8 *buf = NULL; + int err; + +- crypto_stats_get(alg); + if (!seed && slen) { + buf = kmalloc(slen, GFP_KERNEL); +- if (!buf) { +- crypto_alg_put(alg); ++ if (!buf) + return -ENOMEM; +- } + + err = get_random_bytes_wait(buf, slen); +- if (err) { +- crypto_alg_put(alg); ++ if (err) + goto out; +- } + seed = buf; + } + ++ crypto_stats_get(alg); + err = crypto_rng_alg(tfm)->seed(tfm, seed, slen); + crypto_stats_rng_seed(alg, err); + out: +-- +2.26.2 + diff --git a/patches.suse/drm-amdkfd-fix-build-error-with-AMD_IOMMU_V2-m.patch b/patches.suse/drm-amdkfd-fix-build-error-with-AMD_IOMMU_V2-m.patch new file mode 100644 index 0000000..c158653 --- /dev/null +++ b/patches.suse/drm-amdkfd-fix-build-error-with-AMD_IOMMU_V2-m.patch @@ -0,0 +1,106 @@ +From 1e87068570a2cc4db5f95a881686add71729e769 Mon Sep 17 00:00:00 2001 +From: Felix Kuehling +Date: Mon, 8 Mar 2021 22:15:42 -0500 +Subject: [PATCH] drm/amdkfd: fix build error with AMD_IOMMU_V2=m +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 1e87068570a2cc4db5f95a881686add71729e769 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Using 'imply AMD_IOMMU_V2' does not guarantee that the driver can link +against the exported functions. If the GPU driver is built-in but the +IOMMU driver is a loadable module, the kfd_iommu.c file is indeed +built but does not work: + +X86_64-linux-ld: drivers/gpu/drm/amd/amdkfd/kfd_iommu.o: in function `kfd_iommu_bind_process_to_device': +kfd_iommu.c:(.text+0x516): undefined reference to `amd_iommu_bind_pasid' +X86_64-linux-ld: drivers/gpu/drm/amd/amdkfd/kfd_iommu.o: in function `kfd_iommu_unbind_process': +kfd_iommu.c:(.text+0x691): undefined reference to `amd_iommu_unbind_pasid' +X86_64-linux-ld: drivers/gpu/drm/amd/amdkfd/kfd_iommu.o: in function `kfd_iommu_suspend': +kfd_iommu.c:(.text+0x966): undefined reference to `amd_iommu_set_invalidate_ctx_cb' +X86_64-linux-ld: kfd_iommu.c:(.text+0x97f): undefined reference to `amd_iommu_set_invalid_ppr_cb' +X86_64-linux-ld: kfd_iommu.c:(.text+0x9a4): undefined reference to `amd_iommu_free_device' +X86_64-linux-ld: drivers/gpu/drm/amd/amdkfd/kfd_iommu.o: in function `kfd_iommu_resume': +kfd_iommu.c:(.text+0xa9a): undefined reference to `amd_iommu_init_device' +X86_64-linux-ld: kfd_iommu.c:(.text+0xadc): undefined reference to `amd_iommu_set_invalidate_ctx_cb' +X86_64-linux-ld: kfd_iommu.c:(.text+0xaff): undefined reference to `amd_iommu_set_invalid_ppr_cb' +X86_64-linux-ld: kfd_iommu.c:(.text+0xc72): undefined reference to `amd_iommu_bind_pasid' +X86_64-linux-ld: kfd_iommu.c:(.text+0xe08): undefined reference to `amd_iommu_set_invalidate_ctx_cb' +X86_64-linux-ld: kfd_iommu.c:(.text+0xe26): undefined reference to `amd_iommu_set_invalid_ppr_cb' +X86_64-linux-ld: kfd_iommu.c:(.text+0xe42): undefined reference to `amd_iommu_free_device' + +Use IS_REACHABLE to only build IOMMU-V2 support if the amd_iommu symbols +are reachable by the amdkfd driver. Output a warning if they are not, +because that may not be what the user was expecting. + +Fixes: 64d1c3a43a6f ("drm/amdkfd: Centralize IOMMUv2 code and make it conditional") +Reported-by: Arnd Bergmann +Signed-off-by: Felix Kuehling +Reviewed-by: Christian König +Signed-off-by: Alex Deucher +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/amd/amdkfd/kfd_iommu.c | 6 ++++++ + drivers/gpu/drm/amd/amdkfd/kfd_iommu.h | 9 +++++++-- + 2 files changed, 13 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_iommu.c b/drivers/gpu/drm/amd/amdkfd/kfd_iommu.c +index 66bbca61e3ef..9318936aa805 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_iommu.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_iommu.c +@@ -20,6 +20,10 @@ + * OTHER DEALINGS IN THE SOFTWARE. + */ + ++#include ++ ++#if IS_REACHABLE(CONFIG_AMD_IOMMU_V2) ++ + #include + #include + #include +@@ -355,3 +359,5 @@ int kfd_iommu_add_perf_counters(struct kfd_topology_device *kdev) + + return 0; + } ++ ++#endif +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_iommu.h b/drivers/gpu/drm/amd/amdkfd/kfd_iommu.h +index dd23d9fdf6a8..afd420b01a0c 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_iommu.h ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_iommu.h +@@ -23,7 +23,9 @@ + #ifndef __KFD_IOMMU_H__ + #define __KFD_IOMMU_H__ + +-#if defined(CONFIG_AMD_IOMMU_V2_MODULE) || defined(CONFIG_AMD_IOMMU_V2) ++#include ++ ++#if IS_REACHABLE(CONFIG_AMD_IOMMU_V2) + + #define KFD_SUPPORT_IOMMU_V2 + +@@ -46,6 +48,9 @@ static inline int kfd_iommu_check_device(struct kfd_dev *kfd) + } + static inline int kfd_iommu_device_init(struct kfd_dev *kfd) + { ++#if IS_MODULE(CONFIG_AMD_IOMMU_V2) ++ WARN_ONCE(1, "iommu_v2 module is not usable by built-in KFD"); ++#endif + return 0; + } + +@@ -73,6 +78,6 @@ static inline int kfd_iommu_add_perf_counters(struct kfd_topology_device *kdev) + return 0; + } + +-#endif /* defined(CONFIG_AMD_IOMMU_V2) */ ++#endif /* IS_REACHABLE(CONFIG_AMD_IOMMU_V2) */ + + #endif /* __KFD_IOMMU_H__ */ +-- +2.26.2 + diff --git a/patches.suse/drm-ast-AST2500-fixups.patch b/patches.suse/drm-ast-AST2500-fixups.patch new file mode 100644 index 0000000..d83ef72 --- /dev/null +++ b/patches.suse/drm-ast-AST2500-fixups.patch @@ -0,0 +1,171 @@ +From c2cbdb9c9367388d72b50fae7a901f866350a92a Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 21 Apr 2021 13:12:48 +0200 +Subject: [PATCH 07/11] drm/ast: AST2500 fixups +Patch-mainline: Never, temporary fixes until upstream resolution +References: bsc#1174416 + +A code snippet forward-ported from A-Speed downstream driver. + +Signed-off-by: Takashi Iwai + +--- + drivers/gpu/drm/ast/ast_drv.h | 1 + drivers/gpu/drm/ast/ast_main.c | 4 + + drivers/gpu/drm/ast/ast_post.c | 84 +++++++++++++++++++++++++++-------------- + 3 files changed, 61 insertions(+), 28 deletions(-) + +--- a/drivers/gpu/drm/ast/ast_drv.h ++++ b/drivers/gpu/drm/ast/ast_drv.h +@@ -324,6 +324,7 @@ bool ast_is_vga_enabled(struct drm_devic + void ast_post_gpu(struct drm_device *dev); + u32 ast_mindwm(struct ast_private *ast, u32 r); + void ast_moutdwm(struct ast_private *ast, u32 r, u32 v); ++void patch_ahb_ast2500(struct ast_private *ast); + /* ast dp501 */ + void ast_set_dp501_video_output(struct drm_device *dev, u8 mode); + bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size); +--- a/drivers/gpu/drm/ast/ast_main.c ++++ b/drivers/gpu/drm/ast/ast_main.c +@@ -91,6 +91,10 @@ static void ast_detect_config_mode(struc + jregd0 = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff); + jregd1 = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd1, 0xff); + if (!(jregd0 & 0x80) || !(jregd1 & 0x10)) { ++ /* Patch AST2500 */ ++ if ((dev->pdev->revision & 0xF0) == 0x40 && (jregd0 & 0xC0) == 0) ++ patch_ahb_ast2500(ast); ++ + /* Double check it's actually working */ + if ((dev->pdev->revision & 0xF0) >= 0x30) { + /* AST2400 and newer */ +--- a/drivers/gpu/drm/ast/ast_post.c ++++ b/drivers/gpu/drm/ast/ast_post.c +@@ -1842,13 +1842,20 @@ static void set_mpll_2500(struct ast_pri + + static void reset_mmc_2500(struct ast_private *ast) + { ++ u32 data; ++ + ast_moutdwm(ast, 0x1E78505C, 0x00000004); + ast_moutdwm(ast, 0x1E785044, 0x00000001); + ast_moutdwm(ast, 0x1E785048, 0x00004755); + ast_moutdwm(ast, 0x1E78504C, 0x00000013); + mdelay(100); ++ ast_moutdwm(ast, 0x1E78505c, 0x023FFFF3); + ast_moutdwm(ast, 0x1E785054, 0x00000077); +- ast_moutdwm(ast, 0x1E6E0000, 0xFC600309); ++ do { ++ ast_moutdwm(ast, 0x1E6E0000, 0xFC600309); ++ data = ast_mindwm(ast, 0x1E6E0000); ++ } while (data == 0); ++ ast_moutdwm(ast, 0x1E6E0034, 0x00020000); + } + + static void ddr3_init_2500(struct ast_private *ast, const u32 *ddr_table) +@@ -1913,7 +1920,7 @@ static void ddr4_init_2500(struct ast_pr + + /* DDR PHY Setting */ + ast_moutdwm(ast, 0x1E6E0200, 0x42492AAE); +- ast_moutdwm(ast, 0x1E6E0204, 0x09002000); ++ ast_moutdwm(ast, 0x1E6E0204, 0x09002800); /* modify at V1.3 */ + ast_moutdwm(ast, 0x1E6E020C, 0x55E00B0B); + ast_moutdwm(ast, 0x1E6E0210, 0x20000000); + ast_moutdwm(ast, 0x1E6E0214, ddr_table[REGIDX_214]); +@@ -2029,10 +2036,37 @@ static bool ast_dram_init_2500(struct as + /* Patch code */ + data = ast_mindwm(ast, 0x1E6E200C) & 0xF9FFFFFF; + ast_moutdwm(ast, 0x1E6E200C, data | 0x10000000); ++ /* Version Number */ ++ data = ast_mindwm(ast, 0x1E6E0004); /* add at V1.3 */ ++ ast_moutdwm(ast, 0x1E6E0004, data | 0x08300000); /* add at V1.3 */ ++ ast_moutdwm(ast, 0x1E6E0088, 0x20161229); /* add at V1.3 */ + + return true; + } + ++void patch_ahb_ast2500(struct ast_private *ast) ++{ ++ u32 data; ++ ++ /* Clear bus lock condition */ ++ ast_moutdwm(ast, 0x1e600000, 0xAEED1A03); ++ ast_moutdwm(ast, 0x1e600084, 0x00010000); ++ ast_moutdwm(ast, 0x1e600088, 0x00000000); ++ ast_moutdwm(ast, 0x1e6e2000, 0x1688A8A8); ++ data = ast_mindwm(ast, 0x1e6e2070); ++ if (data & 0x08000000) { /* check fast reset */ ++ ast_moutdwm(ast, 0x1E785004, 0x00000010); ++ ast_moutdwm(ast, 0x1E785008, 0x00004755); ++ ast_moutdwm(ast, 0x1E78500c, 0x00000033); ++ udelay(1000); ++ } ++ do { ++ ast_moutdwm(ast, 0x1e6e2000, 0x1688A8A8); ++ data = ast_mindwm(ast, 0x1e6e2000); ++ } while (data != 1); ++ ast_moutdwm(ast, 0x1e6e207c, 0x08000000); /* clear fast reset */ ++} ++ + void ast_post_chip_2500(struct drm_device *dev) + { + struct ast_private *ast = dev->dev_private; +@@ -2040,39 +2074,33 @@ void ast_post_chip_2500(struct drm_devic + u8 reg; + + reg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff); +- if ((reg & 0x80) == 0) {/* vga only */ ++ if ((reg & 0xC0) == 0) {/* vga only */ + /* Clear bus lock condition */ +- ast_moutdwm(ast, 0x1e600000, 0xAEED1A03); +- ast_moutdwm(ast, 0x1e600084, 0x00010000); +- ast_moutdwm(ast, 0x1e600088, 0x00000000); +- ast_moutdwm(ast, 0x1e6e2000, 0x1688A8A8); +- ast_write32(ast, 0xf004, 0x1e6e0000); +- ast_write32(ast, 0xf000, 0x1); +- ast_write32(ast, 0x12000, 0x1688a8a8); +- while (ast_read32(ast, 0x12000) != 0x1) +- ; +- +- ast_write32(ast, 0x10000, 0xfc600309); +- while (ast_read32(ast, 0x10000) != 0x1) +- ; ++ patch_ahb_ast2500(ast); ++ ++ /* Disable watchdog */ ++ ast_moutdwm(ast, 0x1E78502C, 0x00000000); ++ ast_moutdwm(ast, 0x1E78504C, 0x00000000); ++ ++ /* Reset USB port */ ++ ast_moutdwm(ast, 0x1E6E2090, 0x20000000); ++ ast_moutdwm(ast, 0x1E6E2094, 0x00004000); ++ if (ast_mindwm(ast, 0x1E6E2070) & 0x00800000) { ++ ast_moutdwm(ast, 0x1E6E207C, 0x00800000); ++ mdelay(100); ++ ast_moutdwm(ast, 0x1E6E2070, 0x00800000); ++ } ++ ++ /* Modify eSPI reset pin */ ++ temp = ast_mindwm(ast, 0x1E6E2070); ++ if (temp & 0x02000000) ++ ast_moutdwm(ast, 0x1E6E207C, 0x00004000); + + /* Slow down CPU/AHB CLK in VGA only mode */ + temp = ast_read32(ast, 0x12008); + temp |= 0x73; + ast_write32(ast, 0x12008, temp); + +- /* Reset USB port to patch USB unknown device issue */ +- ast_moutdwm(ast, 0x1e6e2090, 0x20000000); +- temp = ast_mindwm(ast, 0x1e6e2094); +- temp |= 0x00004000; +- ast_moutdwm(ast, 0x1e6e2094, temp); +- temp = ast_mindwm(ast, 0x1e6e2070); +- if (temp & 0x00800000) { +- ast_moutdwm(ast, 0x1e6e207c, 0x00800000); +- mdelay(100); +- ast_moutdwm(ast, 0x1e6e2070, 0x00800000); +- } +- + if (!ast_dram_init_2500(ast)) + DRM_ERROR("DRAM init failed !\n"); + diff --git a/patches.suse/drm-ast-Add-25MHz-refclk-support.patch b/patches.suse/drm-ast-Add-25MHz-refclk-support.patch new file mode 100644 index 0000000..7793762 --- /dev/null +++ b/patches.suse/drm-ast-Add-25MHz-refclk-support.patch @@ -0,0 +1,127 @@ +From f45403fc7aabdd9dfa79a87b479c33e95251a021 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 21 Apr 2021 13:12:48 +0200 +Subject: [PATCH 11/11] drm/ast: Add 25MHz refclk support +Patch-mainline: Never, temporary fixes until upstream resolution +References: bsc#1174416 + +A code snippet forward-ported from A-Speed downstream driver. + +Signed-off-by: Takashi Iwai + +--- + drivers/gpu/drm/ast/ast_drv.h | 1 + drivers/gpu/drm/ast/ast_mode.c | 15 +++++++-- + drivers/gpu/drm/ast/ast_tables.h | 60 +++++++++++++++++++++++++++++++++++++++ + 3 files changed, 72 insertions(+), 4 deletions(-) + +--- a/drivers/gpu/drm/ast/ast_drv.h ++++ b/drivers/gpu/drm/ast/ast_drv.h +@@ -106,6 +106,7 @@ struct ast_private { + struct drm_gem_object *cursor_cache; + int next_cursor; + bool support_newvga_mode; ++ bool refclk_25mhz; + enum { + ast_use_p2a, + ast_use_dt, +--- a/drivers/gpu/drm/ast/ast_mode.c ++++ b/drivers/gpu/drm/ast/ast_mode.c +@@ -402,10 +402,17 @@ static void ast_set_dclk_reg(struct drm_ + struct ast_private *ast = dev->dev_private; + const struct ast_vbios_dclk_info *clk_info; + +- if (ast->chip == AST2500) +- clk_info = &dclk_table_ast2500[vbios_mode->enh_table->dclk_index]; +- else +- clk_info = &dclk_table[vbios_mode->enh_table->dclk_index]; ++ if (ast->chip == AST2500) { ++ if (ast->refclk_25mhz) ++ clk_info = &dclk_table_ast2500_25mhz[vbios_mode->enh_table->dclk_index]; ++ else ++ clk_info = &dclk_table_ast2500[vbios_mode->enh_table->dclk_index]; ++ } else { ++ if (ast->refclk_25mhz) ++ clk_info = &dclk_table_25mhz[vbios_mode->enh_table->dclk_index]; ++ else ++ clk_info = &dclk_table[vbios_mode->enh_table->dclk_index]; ++ } + + ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc0, 0x00, clk_info->param1); + ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc1, 0x00, clk_info->param2); +--- a/drivers/gpu/drm/ast/ast_tables.h ++++ b/drivers/gpu/drm/ast/ast_tables.h +@@ -109,6 +109,36 @@ static const struct ast_vbios_dclk_info + {0x3b, 0x2c, 0x81}, /* 1A: VCLK118_25 */ + }; + ++static const struct ast_vbios_dclk_info dclk_table_25mhz[] = { ++ {0x2C, 0xE7, 0x03}, /* 00: VCLK25_175 */ ++ {0x95, 0x62, 0x03}, /* 01: VCLK28_322 */ ++ {0x67, 0x63, 0x01}, /* 02: VCLK31_5 */ ++ {0x76, 0x63, 0x01}, /* 03: VCLK36 */ ++ {0xEE, 0x67, 0x01}, /* 04: VCLK40 */ ++ {0x82, 0x62, 0x01}, /* 05: VCLK49_5 */ ++ {0xC6, 0x64, 0x01}, /* 06: VCLK50 */ ++ {0x94, 0x62, 0x01}, /* 07: VCLK56_25 */ ++ {0x80, 0x64, 0x00}, /* 08: VCLK65 */ ++ {0x7B, 0x63, 0x00}, /* 09: VCLK75 */ ++ {0x67, 0x62, 0x00}, /* 0A: VCLK78_75 */ ++ {0x7C, 0x62, 0x00}, /* 0B: VCLK94_5 */ ++ {0x8E, 0x62, 0x00}, /* 0C: VCLK108 */ ++ {0x85, 0x24, 0x00}, /* 0D: VCLK135 */ ++ {0x67, 0x22, 0x00}, /* 0E: VCLK157_5 */ ++ {0x6A, 0x22, 0x00}, /* 0F: VCLK162 */ ++ {0x25, 0x46, 0x80}, /* 10: VCLK154 */ ++ {0x14, 0x63, 0x80}, /* 11: VCLK83.5 */ ++ {0x11, 0x44, 0x80}, /* 12: VCLK106.5 */ ++ {0x23, 0x46, 0x80}, /* 13: VCLK146.25 */ ++ {0x4d, 0x4d, 0x80}, /* 14: VCLK148.5 */ ++ {0x11, 0x63, 0x80}, /* 15: VCLK71 */ ++ {0x47, 0x6a, 0x80}, /* 16: VCLK88.75 */ ++ {0x13, 0x44, 0x80}, /* 17: VCLK119 */ ++ {0x29, 0x66, 0x80}, /* 18: VCLK85_5 */ ++ {0x2f, 0x66, 0x80}, /* 19: VCLK97_75 */ ++ {0x21, 0x47, 0x80}, /* 1A: VCLK118_25 */ ++}; ++ + static const struct ast_vbios_dclk_info dclk_table_ast2500[] = { + {0x2C, 0xE7, 0x03}, /* 00: VCLK25_175 */ + {0x95, 0x62, 0x03}, /* 01: VCLK28_322 */ +@@ -139,6 +169,36 @@ static const struct ast_vbios_dclk_info + {0x44, 0x20, 0x43}, /* 1A: VCLK118_25 */ + }; + ++static const struct ast_vbios_dclk_info dclk_table_ast2500_25mhz[] = { ++ {0x2C, 0xE7, 0x03}, /* 00: VCLK25_175 */ ++ {0x95, 0x62, 0x03}, /* 01: VCLK28_322 */ ++ {0x67, 0x63, 0x01}, /* 02: VCLK31_5 */ ++ {0x76, 0x63, 0x01}, /* 03: VCLK36 */ ++ {0xEE, 0x67, 0x01}, /* 04: VCLK40 */ ++ {0x82, 0x62, 0x01}, /* 05: VCLK49_5 */ ++ {0xC6, 0x64, 0x01}, /* 06: VCLK50 */ ++ {0x94, 0x62, 0x01}, /* 07: VCLK56_25 */ ++ {0x80, 0x64, 0x00}, /* 08: VCLK65 */ ++ {0x7B, 0x63, 0x00}, /* 09: VCLK75 */ ++ {0x67, 0x62, 0x00}, /* 0A: VCLK78_75 */ ++ {0x7C, 0x62, 0x00}, /* 0B: VCLK94_5 */ ++ {0x8E, 0x62, 0x00}, /* 0C: VCLK108 */ ++ {0x85, 0x24, 0x00}, /* 0D: VCLK135 */ ++ {0x67, 0x22, 0x00}, /* 0E: VCLK157_5 */ ++ {0x6A, 0x22, 0x00}, /* 0F: VCLK162 */ ++ {0x4d, 0x4c, 0x80}, /* 10: VCLK154 */ ++ {0x68, 0x6f, 0x80}, /* 11: VCLK83.5 */ ++ {0x28, 0x49, 0x80}, /* 12: VCLK106.5 */ ++ {0x37, 0x49, 0x80}, /* 13: VCLK146.25 */ ++ {0x1f, 0x45, 0x80}, /* 14: VCLK148.5 */ ++ {0x47, 0x6c, 0x80}, /* 15: VCLK71 */ ++ {0x25, 0x65, 0x80}, /* 16: VCLK88.75 */ ++ {0x38, 0x60, 0x42}, /* 17: VCLK119 */ ++ {0x32, 0x67, 0x80}, /* 18: VCLK85_5 */ ++ {0x6a, 0x6d, 0x80}, /* 19: VCLK97_75 */ ++ {0x41, 0x20, 0x43}, /* 1A: VCLK118_25 */ ++}; ++ + static const struct ast_vbios_stdtable vbios_stdtable[] = { + /* MD_2_3_400 */ + { diff --git a/patches.suse/drm-ast-Add-support-for-1152x864-mode.patch b/patches.suse/drm-ast-Add-support-for-1152x864-mode.patch new file mode 100644 index 0000000..550cb3d --- /dev/null +++ b/patches.suse/drm-ast-Add-support-for-1152x864-mode.patch @@ -0,0 +1,112 @@ +From 418b7581212ec736eb1bcc985bd98158b8f67234 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 21 Apr 2021 13:12:48 +0200 +Subject: [PATCH 10/11] drm/ast: Add support for 1152x864 mode +Patch-mainline: Never, temporary fixes until upstream resolution +References: bsc#1174416 + +A code snippet forward-ported from A-Speed downstream driver. + +Signed-off-by: Takashi Iwai + +--- + drivers/gpu/drm/ast/ast_drv.h | 2 +- + drivers/gpu/drm/ast/ast_main.c | 18 +++++++++--------- + drivers/gpu/drm/ast/ast_mode.c | 7 ++++++- + drivers/gpu/drm/ast/ast_tables.h | 7 +++++++ + 4 files changed, 23 insertions(+), 11 deletions(-) + +--- a/drivers/gpu/drm/ast/ast_drv.h ++++ b/drivers/gpu/drm/ast/ast_drv.h +@@ -105,7 +105,7 @@ struct ast_private { + + struct drm_gem_object *cursor_cache; + int next_cursor; +- bool support_wide_screen; ++ bool support_newvga_mode; + enum { + ast_use_p2a, + ast_use_dt, +--- a/drivers/gpu/drm/ast/ast_main.c ++++ b/drivers/gpu/drm/ast/ast_main.c +@@ -196,32 +196,32 @@ static int ast_detect_chip(struct drm_de + } + } + +- /* Check if we support wide screen */ ++ /* Check if we newvga mode & support wide screen */ + switch (ast->chip) { + case AIP200: + case AST1180: +- ast->support_wide_screen = true; ++ ast->support_newvga_mode = true; + break; + case AST2000: +- ast->support_wide_screen = false; ++ ast->support_newvga_mode = false; + break; + default: + jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff); + if (!(jreg & 0x80)) +- ast->support_wide_screen = true; ++ ast->support_newvga_mode = true; + else if (jreg & 0x01) +- ast->support_wide_screen = true; ++ ast->support_newvga_mode = true; + else { +- ast->support_wide_screen = false; ++ ast->support_newvga_mode = false; + if (ast->chip == AST2300 && + (scu_rev & 0x300) == 0x0) /* ast1300 */ +- ast->support_wide_screen = true; ++ ast->support_newvga_mode = true; + if (ast->chip == AST2400 && + (scu_rev & 0x300) == 0x100) /* ast1400 */ +- ast->support_wide_screen = true; ++ ast->support_newvga_mode = true; + if (ast->chip == AST2500 && + scu_rev == 0x100) /* ast2510 */ +- ast->support_wide_screen = true; ++ ast->support_newvga_mode = true; + } + break; + } +--- a/drivers/gpu/drm/ast/ast_mode.c ++++ b/drivers/gpu/drm/ast/ast_mode.c +@@ -117,6 +117,9 @@ static bool ast_get_vbios_mode_info(stru + case 1024: + vbios_mode->enh_table = &res_1024x768[refresh_rate_index]; + break; ++ case 1152: ++ vbios_mode->enh_table = &res_1152x864[refresh_rate_index]; ++ break; + case 1280: + if (crtc->mode.crtc_vdisplay == 800) + vbios_mode->enh_table = &res_1280x800[refresh_rate_index]; +@@ -808,7 +811,9 @@ static enum drm_mode_status ast_mode_val + int flags = MODE_NOMODE; + uint32_t jtemp; + +- if (ast->support_wide_screen) { ++ if (ast->support_newvga_mode) { ++ if ((mode->hdisplay == 1152) && (mode->vdisplay == 864)) ++ return MODE_OK; + if ((mode->hdisplay == 1680) && (mode->vdisplay == 1050)) + return MODE_OK; + if ((mode->hdisplay == 1280) && (mode->vdisplay == 800)) +--- a/drivers/gpu/drm/ast/ast_tables.h ++++ b/drivers/gpu/drm/ast/ast_tables.h +@@ -272,6 +272,13 @@ static const struct ast_vbios_enhtable r + (SyncPP | Charx8Dot), 0xFF, 1, 0x33 }, + }; + ++static const struct ast_vbios_enhtable res_1152x864[] = { ++ {1600, 1152, 64, 128, 900, 864, 1, 3, VCLK108, /* 75Hz */ ++ (SyncPP | Charx8Dot | NewModeInfo), 75, 1, 0x3B }, ++ {1600, 1152, 64, 128, 900, 864, 1, 3, VCLK108, /* end */ ++ (SyncPP | Charx8Dot | NewModeInfo), 0xFF, 1, 0x3B }, ++}; ++ + /* 16:9 */ + static const struct ast_vbios_enhtable res_1360x768[] = { + {1792, 1360, 64, 112, 795, 768, 3, 6, VCLK85_5, /* 60Hz */ diff --git a/patches.suse/drm-ast-Add-support-for-AIP200.patch b/patches.suse/drm-ast-Add-support-for-AIP200.patch new file mode 100644 index 0000000..88858fc --- /dev/null +++ b/patches.suse/drm-ast-Add-support-for-AIP200.patch @@ -0,0 +1,116 @@ +From 510f653f55381cb0efa3be157b2a62571cb3d219 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 21 Apr 2021 13:12:48 +0200 +Subject: [PATCH 09/11] drm/ast: Add support for AIP200 +Patch-mainline: Never, temporary fixes until upstream resolution +References: bsc#1174416 + +A code snippet forward-ported from A-Speed downstream driver. + +Signed-off-by: Takashi Iwai + +--- + drivers/gpu/drm/ast/ast_drv.c | 1 + + drivers/gpu/drm/ast/ast_drv.h | 2 ++ + drivers/gpu/drm/ast/ast_main.c | 5 +++++ + drivers/gpu/drm/ast/ast_mode.c | 5 +++-- + drivers/gpu/drm/ast/ast_post.c | 4 ++-- + 5 files changed, 13 insertions(+), 4 deletions(-) + +--- a/drivers/gpu/drm/ast/ast_drv.c ++++ b/drivers/gpu/drm/ast/ast_drv.c +@@ -55,6 +55,7 @@ static struct drm_driver driver; + static const struct pci_device_id pciidlist[] = { + AST_VGA_DEVICE(PCI_CHIP_AST2000, NULL), + AST_VGA_DEVICE(PCI_CHIP_AST2100, NULL), ++ AST_VGA_DEVICE(PCI_CHIP_AIP200, NULL), + /* AST_VGA_DEVICE(PCI_CHIP_AST1180, NULL), - don't bind to 1180 for now */ + {0, 0, 0}, + }; +--- a/drivers/gpu/drm/ast/ast_drv.h ++++ b/drivers/gpu/drm/ast/ast_drv.h +@@ -52,6 +52,7 @@ + #define PCI_CHIP_AST2000 0x2000 + #define PCI_CHIP_AST2100 0x2010 + #define PCI_CHIP_AST1180 0x1180 ++#define PCI_CHIP_AIP200 0xA200 + + + enum ast_chip { +@@ -64,6 +65,7 @@ enum ast_chip { + AST2400, + AST2500, + AST1180, ++ AIP200, + }; + + enum ast_tx_chip { +--- a/drivers/gpu/drm/ast/ast_main.c ++++ b/drivers/gpu/drm/ast/ast_main.c +@@ -157,6 +157,9 @@ static int ast_detect_chip(struct drm_de + if (dev->pdev->device == PCI_CHIP_AST1180) { + ast->chip = AST1100; + DRM_INFO("AST 1180 detected\n"); ++ } else if (dev->pdev->device == PCI_CHIP_AIP200) { ++ ast->chip = AIP200; ++ DRM_INFO("AIP 200 detected\n"); + } else { + if (dev->pdev->revision >= 0x40) { + ast->chip = AST2500; +@@ -195,6 +198,7 @@ static int ast_detect_chip(struct drm_de + + /* Check if we support wide screen */ + switch (ast->chip) { ++ case AIP200: + case AST1180: + ast->support_wide_screen = true; + break; +@@ -579,6 +583,7 @@ int ast_driver_load(struct drm_device *d + ast->chip == AST2300 || + ast->chip == AST2400 || + ast->chip == AST2500 || ++ ast->chip == AIP200 || + ast->chip == AST1180) { + dev->mode_config.max_width = 1920; + dev->mode_config.max_height = 2048; +--- a/drivers/gpu/drm/ast/ast_mode.c ++++ b/drivers/gpu/drm/ast/ast_mode.c +@@ -443,7 +443,7 @@ static void ast_set_ext_reg(struct drm_c + + /* Set Threshold */ + if (ast->chip == AST2300 || ast->chip == AST2400 || +- ast->chip == AST2500) { ++ ast->chip == AST2500 || ast->chip == AIP200) { + ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x78); + ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x60); + } else if (ast->chip == AST2100 || +@@ -822,7 +822,8 @@ static enum drm_mode_status ast_mode_val + + if ((ast->chip == AST2100) || (ast->chip == AST2200) || + (ast->chip == AST2300) || (ast->chip == AST2400) || +- (ast->chip == AST2500) || (ast->chip == AST1180)) { ++ (ast->chip == AST2500) || (ast->chip == AST1180) || ++ (ast->chip == AIP200)) { + if ((mode->hdisplay == 1920) && (mode->vdisplay == 1080)) + return MODE_OK; + +--- a/drivers/gpu/drm/ast/ast_post.c ++++ b/drivers/gpu/drm/ast/ast_post.c +@@ -82,7 +82,7 @@ ast_set_def_ext_reg(struct drm_device *d + ast_set_index_reg(ast, AST_IO_CRTC_PORT, i, 0x00); + + if (ast->chip == AST2300 || ast->chip == AST2400 || +- ast->chip == AST2500) { ++ ast->chip == AST2500 || ast->chip == AIP200) { + if (dev->pdev->revision >= 0x20) + ext_reg_info = extreginfo_ast2300; + else +@@ -107,7 +107,7 @@ ast_set_def_ext_reg(struct drm_device *d + /* Enable RAMDAC for A1 */ + reg = 0x04; + if (ast->chip == AST2300 || ast->chip == AST2400 || +- ast->chip == AST2500) ++ ast->chip == AST2500 || ast->chip == AIP200) + reg |= 0x20; + ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0xff, reg); + diff --git a/patches.suse/drm-ast-Correct-mode-table-for-AST2500-precatch.patch b/patches.suse/drm-ast-Correct-mode-table-for-AST2500-precatch.patch new file mode 100644 index 0000000..2146ed9 --- /dev/null +++ b/patches.suse/drm-ast-Correct-mode-table-for-AST2500-precatch.patch @@ -0,0 +1,36 @@ +From c1443b63cf14b17fcd8ae06273ac9ae64d550865 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 21 Apr 2021 13:12:48 +0200 +Subject: [PATCH 08/11] drm/ast: Correct mode table for AST2500 precatch +Patch-mainline: Never, temporary fixes until upstream resolution +References: bsc#1174416 + +A code snippet forward-ported from A-Speed downstream driver. + +Signed-off-by: Takashi Iwai + +--- + drivers/gpu/drm/ast/ast_tables.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/ast/ast_tables.h b/drivers/gpu/drm/ast/ast_tables.h +index d665dd5af5dd..91399e2a86bf 100644 +--- a/drivers/gpu/drm/ast/ast_tables.h ++++ b/drivers/gpu/drm/ast/ast_tables.h +@@ -275,10 +275,10 @@ static const struct ast_vbios_enhtable res_1600x1200[] = { + /* 16:9 */ + static const struct ast_vbios_enhtable res_1360x768[] = { + {1792, 1360, 64, 112, 795, 768, 3, 6, VCLK85_5, /* 60Hz */ +- (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x39 }, +- {1792, 1360, 64, 112, 795, 768, 3, 6, VCLK85_5, /* end */ + (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo | +- AST2500PreCatchCRT), 0xFF, 1, 0x39 }, ++ AST2500PreCatchCRT), 60, 1, 0x39 }, ++ {1792, 1360, 64, 112, 795, 768, 3, 6, VCLK85_5, /* end */ ++ (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x39 }, + }; + + static const struct ast_vbios_enhtable res_1600x900[] = { +-- +2.26.2 + diff --git a/patches.suse/drm-ast-Disable-VGA-decoding-while-driver-is-active.patch b/patches.suse/drm-ast-Disable-VGA-decoding-while-driver-is-active.patch new file mode 100644 index 0000000..7b377ce --- /dev/null +++ b/patches.suse/drm-ast-Disable-VGA-decoding-while-driver-is-active.patch @@ -0,0 +1,32 @@ +From b26039d1642c15ea841a1d7da4e7fdabf67acbf3 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 21 Apr 2021 13:12:47 +0200 +Subject: [PATCH 01/11] drm/ast: Disable VGA decoding while driver is active +Patch-mainline: Never, temporary fixes until upstream resolution +References: bsc#1174416 + +A code snippet forward-ported from A-Speed downstream driver. + +Signed-off-by: Takashi Iwai + +--- + drivers/gpu/drm/ast/ast_main.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c +index 6a9fba051d13..93df685e5773 100644 +--- a/drivers/gpu/drm/ast/ast_main.c ++++ b/drivers/gpu/drm/ast/ast_main.c +@@ -137,6 +137,9 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) + ast_open_key(ast); + ast_enable_mmio(dev); + ++ /* disable standard VGA decode */ ++ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06); ++ + /* Find out whether P2A works or whether to use device-tree */ + ast_detect_config_mode(dev, &scu_rev); + +-- +2.26.2 + diff --git a/patches.suse/drm-ast-Disable-screen-on-register-init.patch b/patches.suse/drm-ast-Disable-screen-on-register-init.patch new file mode 100644 index 0000000..f10bdc2 --- /dev/null +++ b/patches.suse/drm-ast-Disable-screen-on-register-init.patch @@ -0,0 +1,33 @@ +From af3f4f56cabfd8a2dd7003a4ac15cf0573ee51a9 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 21 Apr 2021 13:12:48 +0200 +Subject: [PATCH 03/11] drm/ast: Disable screen on register init +Patch-mainline: Never, temporary fixes until upstream resolution +References: bsc#1174416 + +A code snippet forward-ported from A-Speed downstream driver. + +Signed-off-by: Takashi Iwai + +--- + drivers/gpu/drm/ast/ast_post.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c +index 6423d08afd8a..1b132c17fe5d 100644 +--- a/drivers/gpu/drm/ast/ast_post.c ++++ b/drivers/gpu/drm/ast/ast_post.c +@@ -109,6 +109,10 @@ ast_set_def_ext_reg(struct drm_device *dev) + ast->chip == AST2500) + reg |= 0x20; + ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0xff, reg); ++ ++ /* Screen off */ ++ ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x01, 0xff, 0x20); ++ udelay(10); + } + + u32 ast_mindwm(struct ast_private *ast, u32 r) +-- +2.26.2 + diff --git a/patches.suse/drm-ast-Fix-P2A-config-detection.patch b/patches.suse/drm-ast-Fix-P2A-config-detection.patch new file mode 100644 index 0000000..fc36425 --- /dev/null +++ b/patches.suse/drm-ast-Fix-P2A-config-detection.patch @@ -0,0 +1,40 @@ +From dd413ac8fce0cb656e6c71bda32bc59d587cb35b Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 21 Apr 2021 13:12:48 +0200 +Subject: [PATCH 06/11] drm/ast: Fix P2A config detection +Patch-mainline: Never, temporary fixes until upstream resolution +References: bsc#1174416 + +A code snippet forward-ported from A-Speed downstream driver. + +Signed-off-by: Takashi Iwai + +--- + drivers/gpu/drm/ast/ast_main.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c +index e16ea888d012..42083e2447d4 100644 +--- a/drivers/gpu/drm/ast/ast_main.c ++++ b/drivers/gpu/drm/ast/ast_main.c +@@ -95,7 +95,16 @@ static void ast_detect_config_mode(struct drm_device *dev, u32 *scu_rev) + jregd1 = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd1, 0xff); + if (!(jregd0 & 0x80) || !(jregd1 & 0x10)) { + /* Double check it's actually working */ +- data = ast_read32(ast, 0xf004); ++ if ((dev->pdev->revision & 0xF0) >= 0x30) { ++ /* AST2400 and newer */ ++ data = ast_read32(ast, 0xf004); ++ } else { ++ /* AST2300 and older */ ++ ast_write32(ast, 0xf004, 0x1e6e0000); ++ ast_write32(ast, 0xf000, 0x1); ++ data = ast_read32(ast, 0x1207c); ++ } ++ + if (data != 0xFFFFFFFF) { + /* P2A works, grab silicon revision */ + ast->config_mode = ast_use_p2a; +-- +2.26.2 + diff --git a/patches.suse/drm-ast-Fix-register-access-in-non-P2A-mode-for-DP50.patch b/patches.suse/drm-ast-Fix-register-access-in-non-P2A-mode-for-DP50.patch new file mode 100644 index 0000000..80fca27 --- /dev/null +++ b/patches.suse/drm-ast-Fix-register-access-in-non-P2A-mode-for-DP50.patch @@ -0,0 +1,161 @@ +From b821d19a29bfa2d7a8b47307f88f5e9fa92a96cb Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 21 Apr 2021 13:12:48 +0200 +Subject: [PATCH 05/11] drm/ast: Fix register access in non-P2A mode for DP501 +Patch-mainline: Never, temporary fixes until upstream resolution +References: bsc#1174416 + +A code snippet forward-ported from A-Speed downstream driver. + +Signed-off-by: Takashi Iwai + +--- + drivers/gpu/drm/ast/ast_dp501.c | 53 ++++++++++++++++++++++++++++------------ + drivers/gpu/drm/ast/ast_drv.h | 1 + drivers/gpu/drm/ast/ast_main.c | 13 +++++++++ + 3 files changed, 52 insertions(+), 15 deletions(-) + +--- a/drivers/gpu/drm/ast/ast_dp501.c ++++ b/drivers/gpu/drm/ast/ast_dp501.c +@@ -176,6 +176,9 @@ bool ast_backup_fw(struct drm_device *de + u32 i, data; + u32 boot_address; + ++ if (ast->config_mode != ast_use_p2a) ++ return false; ++ + data = ast_mindwm(ast, 0x1e6e2100) & 0x01; + if (data) { + boot_address = get_fw_base(ast); +@@ -194,6 +197,9 @@ static bool ast_launch_m68k(struct drm_d + u8 *fw_addr = NULL; + u8 jreg; + ++ if (ast->config_mode != ast_use_p2a) ++ return false; ++ + data = ast_mindwm(ast, 0x1e6e2100) & 0x01; + if (!data) { + +@@ -250,23 +256,36 @@ static bool ast_launch_m68k(struct drm_d + return true; + } + ++static u32 ast_peek(struct ast_private *ast, u32 address, u32 offset) ++{ ++ if (ast->config_mode == ast_use_p2a) ++ return ast_mindwm(ast, address + offset); ++ else ++ return *(u32 *) (ast->reservedbuffer + offset); ++} ++ + u8 ast_get_dp501_max_clk(struct drm_device *dev) + { + struct ast_private *ast = dev->dev_private; +- u32 boot_address, offset, data; ++ u32 boot_address, data; + u8 linkcap[4], linkrate, linklanes, maxclk = 0xff; + +- boot_address = get_fw_base(ast); ++ if (ast->config_mode == ast_use_p2a) { ++ boot_address = get_fw_base(ast); ++ } else { ++ boot_address = 0; ++ if (!ast->reservedbuffer) ++ return 65; /* 1024x768 as default */ ++ ast_peek(ast, boot_address, 0x0000); /* dummy read */ ++ } + + /* validate FW version */ +- offset = 0xf000; +- data = ast_mindwm(ast, boot_address + offset); ++ data = ast_peek(ast, boot_address, 0xf000); + if ((data & 0xf0) != 0x10) /* version: 1x */ + return maxclk; + + /* Read Link Capability */ +- offset = 0xf014; +- *(u32 *)linkcap = ast_mindwm(ast, boot_address + offset); ++ *(u32 *)linkcap = ast_peek(ast, boot_address, 0xf014); + if (linkcap[2] == 0) { + linkrate = linkcap[0]; + linklanes = linkcap[1]; +@@ -281,26 +300,30 @@ u8 ast_get_dp501_max_clk(struct drm_devi + bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata) + { + struct ast_private *ast = dev->dev_private; +- u32 i, boot_address, offset, data; +- +- boot_address = get_fw_base(ast); ++ u32 i, boot_address, data; + ++ if (ast->config_mode == ast_use_p2a) { ++ boot_address = get_fw_base(ast); ++ } else { ++ boot_address = 0; ++ if (!ast->reservedbuffer) ++ return false; ++ ast_peek(ast, boot_address, 0x0000); /* dummy read */ ++ } ++ + /* validate FW version */ +- offset = 0xf000; +- data = ast_mindwm(ast, boot_address + offset); ++ data = ast_peek(ast, boot_address, 0xf000); + if ((data & 0xf0) != 0x10) + return false; + + /* validate PnP Monitor */ +- offset = 0xf010; +- data = ast_mindwm(ast, boot_address + offset); ++ data = ast_peek(ast, boot_address, 0xf010); + if (!(data & 0x01)) + return false; + + /* Read EDID */ +- offset = 0xf020; + for (i = 0; i < 128; i += 4) { +- data = ast_mindwm(ast, boot_address + offset + i); ++ data = ast_peek(ast, boot_address, 0xf020 + i); + *(u32 *)(ediddata + i) = data; + } + +--- a/drivers/gpu/drm/ast/ast_drv.h ++++ b/drivers/gpu/drm/ast/ast_drv.h +@@ -88,6 +88,7 @@ struct ast_private { + + void __iomem *regs; + void __iomem *ioregs; ++ void __iomem *reservedbuffer; + + enum ast_chip chip; + bool vga2_clone; +--- a/drivers/gpu/drm/ast/ast_main.c ++++ b/drivers/gpu/drm/ast/ast_main.c +@@ -541,6 +541,17 @@ int ast_driver_load(struct drm_device *d + if (ret) + goto out_free; + ++ /* map reserved buffer */ ++ if (ast->vram_size < pci_resource_len(dev->pdev, 0)) { ++ ast->reservedbuffer = ++ ioremap_nocache(pci_resource_start(ast->dev->pdev, 0) + ++ ast->vram_size, ++ pci_resource_len(dev->pdev, 0) - ++ ast->vram_size); ++ if (!ast->reservedbuffer) ++ DRM_INFO("failed to map reserved buffer\n"); ++ } ++ + drm_mode_config_init(dev); + + dev->mode_config.funcs = (void *)&ast_mode_funcs; +@@ -592,6 +603,8 @@ void ast_driver_unload(struct drm_device + drm_mode_config_cleanup(dev); + + ast_mm_fini(ast); ++ if (ast->reservedbuffer) ++ iounmap(ast->reservedbuffer); + if (ast->ioregs != ast->regs + AST_IO_MM_OFFSET) + pci_iounmap(dev->pdev, ast->ioregs); + pci_iounmap(dev->pdev, ast->regs); diff --git a/patches.suse/drm-ast-Keep-MISC-fields-when-enabling-VGA.patch b/patches.suse/drm-ast-Keep-MISC-fields-when-enabling-VGA.patch new file mode 100644 index 0000000..c10d575 --- /dev/null +++ b/patches.suse/drm-ast-Keep-MISC-fields-when-enabling-VGA.patch @@ -0,0 +1,30 @@ +From 6c5ba2d3c4f06793dc27711e2d8ebb8968946d87 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 21 Apr 2021 13:12:48 +0200 +Subject: [PATCH 02/11] drm/ast: Keep MISC fields when enabling VGA +Patch-mainline: Never, temporary fixes until upstream resolution +References: bsc#1174416 + +A code snippet forward-ported from A-Speed downstream driver. + +Signed-off-by: Takashi Iwai + +--- + drivers/gpu/drm/ast/ast_post.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/ast/ast_post.c ++++ b/drivers/gpu/drm/ast/ast_post.c +@@ -37,9 +37,11 @@ static void ast_post_chip_2500(struct dr + void ast_enable_vga(struct drm_device *dev) + { + struct ast_private *ast = dev->dev_private; ++ u8 ch; + + ast_io_write8(ast, AST_IO_VGA_ENABLE_PORT, 0x01); +- ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, 0x01); ++ ch = ast_io_read8(ast, AST_IO_MISC_PORT_READ); ++ ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, ch | 0x01); + } + + void ast_enable_mmio(struct drm_device *dev) diff --git a/patches.suse/drm-ast-drm-ast-Fix-boot-address-for-AST2500.patch b/patches.suse/drm-ast-drm-ast-Fix-boot-address-for-AST2500.patch new file mode 100644 index 0000000..16c9467 --- /dev/null +++ b/patches.suse/drm-ast-drm-ast-Fix-boot-address-for-AST2500.patch @@ -0,0 +1,77 @@ +From 7bd3bc15a64ae364aab1309d3503f3f04a390a60 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 21 Apr 2021 13:12:48 +0200 +Subject: [PATCH 04/11] drm/ast: drm/ast: Fix boot address for AST2500 +Patch-mainline: Never, temporary fixes until upstream resolution +References: bsc#1174416 + +A code snippet forward-ported from A-Speed downstream driver. + +Signed-off-by: Takashi Iwai + +--- + drivers/gpu/drm/ast/ast_dp501.c | 34 ++++++++++++++++----------------- + 1 file changed, 17 insertions(+), 17 deletions(-) + +diff --git a/drivers/gpu/drm/ast/ast_dp501.c b/drivers/gpu/drm/ast/ast_dp501.c +index 4b85a504825a..8427bc8a9bd1 100644 +--- a/drivers/gpu/drm/ast/ast_dp501.c ++++ b/drivers/gpu/drm/ast/ast_dp501.c +@@ -167,7 +167,10 @@ void ast_set_dp501_video_output(struct drm_device *dev, u8 mode) + + static u32 get_fw_base(struct ast_private *ast) + { +- return ast_mindwm(ast, 0x1e6e2104) & 0x7fffffff; ++ if (ast->chip == AST2500) ++ return ast_mindwm(ast, 0x1e6e2104) & 0xfffffffe; ++ else ++ return ast_mindwm(ast, 0x1e6e2104) & 0x7fffffff; + } + + bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size) +@@ -211,21 +214,15 @@ static bool ast_launch_m68k(struct drm_device *dev) + /* Get BootAddress */ + ast_moutdwm(ast, 0x1e6e2000, 0x1688a8a8); + data = ast_mindwm(ast, 0x1e6e0004); +- switch (data & 0x03) { +- case 0: +- boot_address = 0x44000000; +- break; +- default: +- case 1: +- boot_address = 0x48000000; +- break; +- case 2: +- boot_address = 0x50000000; +- break; +- case 3: +- boot_address = 0x60000000; +- break; +- } ++ if (ast->chip == AST2500) ++ boot_address = 0x8000000; /* 128MB */ ++ else ++ boot_address = 0x4000000; /* 64MB */ ++ boot_address <<= (data & 0x03); ++ if (ast->chip == AST2500) ++ boot_address |= 0x80000000; /* Base = 0x80000000 */ ++ else ++ boot_address |= 0x40000000; /* Base = 0x40000000 */ + boot_address -= 0x200000; /* -2MB */ + + /* copy image to buffer */ +@@ -238,7 +235,10 @@ static bool ast_launch_m68k(struct drm_device *dev) + ast_moutdwm(ast, 0x1e6e2000, 0x1688a8a8); + + /* Launch FW */ +- ast_moutdwm(ast, 0x1e6e2104, 0x80000000 + boot_address); ++ if (ast->chip == AST2500) ++ ast_moutdwm(ast, 0x1e6e2104, boot_address | 0x00000001); ++ else ++ ast_moutdwm(ast, 0x1e6e2104, boot_address | 0x80000000); + ast_moutdwm(ast, 0x1e6e2100, 1); + + /* Update Scratch */ +-- +2.26.2 + diff --git a/patches.suse/drm-i915-gvt-Fix-error-code-in-intel_gvt_init_device.patch b/patches.suse/drm-i915-gvt-Fix-error-code-in-intel_gvt_init_device.patch new file mode 100644 index 0000000..1503f49 --- /dev/null +++ b/patches.suse/drm-i915-gvt-Fix-error-code-in-intel_gvt_init_device.patch @@ -0,0 +1,68 @@ +From 329328ec6a87f2c1275f50d979d55513de458409 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 14 Apr 2021 09:01:38 +0300 +Subject: [PATCH] drm/i915/gvt: Fix error code in intel_gvt_init_device() +Git-commit: 329328ec6a87f2c1275f50d979d55513de458409 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The intel_gvt_init_vgpu_type_groups() function is only called from +intel_gvt_init_device(). If it fails then the intel_gvt_init_device() +prints the error code and propagates it back again. That's a bug +because false is zero/success. The fix is to modify it to return zero +or negative error codes and make everything consistent. + +Fixes: c5d71cb31723 ("drm/i915/gvt: Move vGPU type related code into gvt file") +Signed-off-by: Dan Carpenter +Signed-off-by: Zhenyu Wang +Link: http://patchwork.freedesktop.org/patch/msgid/YHaFQtk/DIVYK1u5@mwanda +Reviewed-by: Zhenyu Wang +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/i915/gvt/gvt.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm/i915/gvt/gvt.c +index d1d8ee4a5f16..57578bf28d77 100644 +--- a/drivers/gpu/drm/i915/gvt/gvt.c ++++ b/drivers/gpu/drm/i915/gvt/gvt.c +@@ -126,7 +126,7 @@ static bool intel_get_gvt_attrs(struct attribute_group ***intel_vgpu_type_groups + return true; + } + +-static bool intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt) ++static int intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt) + { + int i, j; + struct intel_vgpu_type *type; +@@ -144,7 +144,7 @@ static bool intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt) + gvt_vgpu_type_groups[i] = group; + } + +- return true; ++ return 0; + + unwind: + for (j = 0; j < i; j++) { +@@ -152,7 +152,7 @@ static bool intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt) + kfree(group); + } + +- return false; ++ return -ENOMEM; + } + + static void intel_gvt_cleanup_vgpu_type_groups(struct intel_gvt *gvt) +@@ -360,7 +360,7 @@ int intel_gvt_init_device(struct drm_i915_private *i915) + goto out_clean_thread; + + ret = intel_gvt_init_vgpu_type_groups(gvt); +- if (ret == false) { ++ if (ret) { + gvt_err("failed to init vgpu type groups: %d\n", ret); + goto out_clean_types; + } +-- +2.26.2 + diff --git a/patches.suse/drm-omap-fix-misleading-indentation-in-pixinc.patch b/patches.suse/drm-omap-fix-misleading-indentation-in-pixinc.patch new file mode 100644 index 0000000..5aeaa7e --- /dev/null +++ b/patches.suse/drm-omap-fix-misleading-indentation-in-pixinc.patch @@ -0,0 +1,58 @@ +From 417fc6123b4a60c60b770e756cc3e001d764e480 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Mon, 22 Mar 2021 17:41:57 +0100 +Subject: [PATCH] drm/omap: fix misleading indentation in pixinc() +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 417fc6123b4a60c60b770e756cc3e001d764e480 +Patch-mainline: v5.13-rc1 +References: git-fixes + +An old patch added a 'return' statement after each BUG() in this driver, +which was necessary at the time, but has become redundant after the BUG() +definition was updated to handle this properly. + +gcc-11 now warns about one such instance, where the 'return' statement +was incorrectly indented: + +Drivers/gpu/drm/omapdrm/dss/dispc.c: In function ‘pixinc’: +drivers/gpu/drm/omapdrm/dss/dispc.c:2093:9: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation] + 2093 | else + | ^~~~ +drivers/gpu/drm/omapdrm/dss/dispc.c:2095:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’ + 2095 | return 0; + | ^~~~~~ + +Address this by removing the return again and changing the BUG() +to be unconditional to make this more intuitive. + +Fixes: c6eee968d40d ("OMAPDSS: remove compiler warnings when CONFIG_BUG=n") +Signed-off-by: Arnd Bergmann +Signed-off-by: Tomi Valkeinen +Link: https://patchwork.freedesktop.org/patch/msgid/20210322164203.827324-1-arnd@kernel.org +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/omapdrm/dss/dispc.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c +index f4cbef8ccace..5619420cc2cc 100644 +--- a/drivers/gpu/drm/omapdrm/dss/dispc.c ++++ b/drivers/gpu/drm/omapdrm/dss/dispc.c +@@ -2090,9 +2090,8 @@ static s32 pixinc(int pixels, u8 ps) + return 1 + (pixels - 1) * ps; + else if (pixels < 0) + return 1 - (-pixels + 1) * ps; +- else +- BUG(); +- return 0; ++ ++ BUG(); + } + + static void calc_offset(u16 screen_width, u16 width, +-- +2.26.2 + diff --git a/patches.suse/drm-radeon-fix-copy-of-uninitialized-variable-back-t.patch b/patches.suse/drm-radeon-fix-copy-of-uninitialized-variable-back-t.patch new file mode 100644 index 0000000..9eede4d --- /dev/null +++ b/patches.suse/drm-radeon-fix-copy-of-uninitialized-variable-back-t.patch @@ -0,0 +1,44 @@ +From 8dbc2ccac5a65c5b57e3070e36a3dc97c7970d96 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Wed, 3 Mar 2021 00:27:59 +0000 +Subject: [PATCH] drm/radeon: fix copy of uninitialized variable back to userspace +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 8dbc2ccac5a65c5b57e3070e36a3dc97c7970d96 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Currently the ioctl command RADEON_INFO_SI_BACKEND_ENABLED_MASK can +copy back uninitialised data in value_tmp that pointer *value points +to. This can occur when rdev->family is less than CHIP_BONAIRE and +less than CHIP_TAHITI. Fix this by adding in a missing -EINVAL +so that no invalid value is copied back to userspace. + +Addresses-coverity: ("Uninitialized scalar variable) +Cc: stable@vger.kernel.org # 3.13+ +Fixes: 439a1cfffe2c ("drm/radeon: expose render backend mask to the userspace") +Reviewed-by: Christian König +Signed-off-by: Colin Ian King +Signed-off-by: Alex Deucher +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/radeon/radeon_kms.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c +index 2479d6ab7a36..58876bb4ef2a 100644 +--- a/drivers/gpu/drm/radeon/radeon_kms.c ++++ b/drivers/gpu/drm/radeon/radeon_kms.c +@@ -518,6 +518,7 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) + *value = rdev->config.si.backend_enable_mask; + } else { + DRM_DEBUG_KMS("BACKEND_ENABLED_MASK is si+ only!\n"); ++ return -EINVAL; + } + break; + case RADEON_INFO_MAX_SCLK: +-- +2.26.2 + diff --git a/patches.suse/firmware-qcom-scm-Fix-QCOM_SCM-configuration.patch b/patches.suse/firmware-qcom-scm-Fix-QCOM_SCM-configuration.patch new file mode 100644 index 0000000..8ef7b96 --- /dev/null +++ b/patches.suse/firmware-qcom-scm-Fix-QCOM_SCM-configuration.patch @@ -0,0 +1,42 @@ +From 2954a6f12f250890ec2433cec03ba92784d613e8 Mon Sep 17 00:00:00 2001 +From: He Ying +Date: Tue, 6 Apr 2021 05:42:00 -0400 +Subject: [PATCH] firmware: qcom-scm: Fix QCOM_SCM configuration +Git-commit: 2954a6f12f250890ec2433cec03ba92784d613e8 +Patch-mainline: v5.13-rc1 +References: git-fixes + +When CONFIG_QCOM_SCM is y and CONFIG_HAVE_ARM_SMCCC +is not set, compiling errors are encountered as follows: + +Drivers/firmware/qcom_scm-smc.o: In function `__scm_smc_do_quirk': +qcom_scm-smc.c:(.text+0x36): undefined reference to `__arm_smccc_smc' +Drivers/firmware/qcom_scm-legacy.o: In function `scm_legacy_call': +qcom_scm-legacy.c:(.text+0xe2): undefined reference to `__arm_smccc_smc' +Drivers/firmware/qcom_scm-legacy.o: In function `scm_legacy_call_atomic': +qcom_scm-legacy.c:(.text+0x1f0): undefined reference to `__arm_smccc_smc' + +Note that __arm_smccc_smc is defined when HAVE_ARM_SMCCC is y. +So add dependency on HAVE_ARM_SMCCC in QCOM_SCM configuration. + +Fixes: 916f743da354 ("firmware: qcom: scm: Move the scm driver to drivers/firmware") +Reported-by: Hulk Robot +Signed-off-by: He Ying +Link: https://lore.kernel.org/r/20210406094200.60952-1-heying24@huawei.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/firmware/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/firmware/Kconfig ++++ b/drivers/firmware/Kconfig +@@ -220,6 +220,7 @@ config INTEL_STRATIX10_SERVICE + config QCOM_SCM + bool + depends on ARM || ARM64 ++ depends on HAVE_ARM_SMCCC + select RESET_CONTROLLER + + config QCOM_SCM_32 diff --git a/patches.suse/fnic-use-blk_mq_tagset_busy_iter-to-traverse-commands.patch b/patches.suse/fnic-use-blk_mq_tagset_busy_iter-to-traverse-commands.patch new file mode 100644 index 0000000..7f2815e --- /dev/null +++ b/patches.suse/fnic-use-blk_mq_tagset_busy_iter-to-traverse-commands.patch @@ -0,0 +1,970 @@ +From 1465b2a3c2ab560aa8d6daf0a9321c8768aadb68 Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Wed, 11 Mar 2020 00:25:36 +0800 +Subject: [PATCH] fnic: use scsi_host_busy_iter() to traverse commands +References: bsc#1179851 +Patch-mainline: Submitted to linux-scsi, 2021-02-22 + +Use scsi_host_busy_iter() to traverse commands instead of +hand-crafted routines walking the command list. + +diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c +--- a/drivers/scsi/fnic/fnic_scsi.c ++++ b/drivers/scsi/fnic/fnic_scsi.c +@@ -101,7 +101,7 @@ + return fcpio_status_str[status]; + } + +-static void fnic_cleanup_io(struct fnic *fnic, int exclude_id); ++static void fnic_cleanup_io(struct fnic *fnic); + + static inline spinlock_t *fnic_io_lock_hash(struct fnic *fnic, + struct scsi_cmnd *sc) +@@ -637,7 +637,7 @@ + atomic64_inc(&reset_stats->fw_reset_completions); + + /* Clean up all outstanding io requests */ +- fnic_cleanup_io(fnic, SCSI_NO_TAG); ++ fnic_cleanup_io(fnic); + + atomic64_set(&fnic->fnic_stats.fw_stats.active_fw_reqs, 0); + atomic64_set(&fnic->fnic_stats.io_stats.active_ios, 0); +@@ -1359,93 +1359,92 @@ + return wq_work_done; + } + +-static void fnic_cleanup_io(struct fnic *fnic, int exclude_id) ++static bool fnic_cleanup_io_iter(struct scsi_cmnd *sc, void *data, ++ bool reserved) + { +- int i; ++ struct fnic *fnic = data; + struct fnic_io_req *io_req; + unsigned long flags = 0; +- struct scsi_cmnd *sc; + spinlock_t *io_lock; + unsigned long start_time = 0; + struct fnic_stats *fnic_stats = &fnic->fnic_stats; + +- for (i = 0; i < fnic->fnic_max_tag_id; i++) { +- if (i == exclude_id) +- continue; ++ io_lock = fnic_io_lock_tag(fnic, sc->request->tag); ++ spin_lock_irqsave(io_lock, flags); + +- io_lock = fnic_io_lock_tag(fnic, i); +- spin_lock_irqsave(io_lock, flags); +- sc = scsi_host_find_tag(fnic->lport->host, i); +- if (!sc) { +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } ++ io_req = (struct fnic_io_req *)CMD_SP(sc); ++ if ((CMD_FLAGS(sc) & FNIC_DEVICE_RESET) && ++ !(CMD_FLAGS(sc) & FNIC_DEV_RST_DONE)) { + +- io_req = (struct fnic_io_req *)CMD_SP(sc); +- if ((CMD_FLAGS(sc) & FNIC_DEVICE_RESET) && +- !(CMD_FLAGS(sc) & FNIC_DEV_RST_DONE)) { +- /* +- * We will be here only when FW completes reset +- * without sending completions for outstanding ios. +- */ +- CMD_FLAGS(sc) |= FNIC_DEV_RST_DONE; +- if (io_req && io_req->dr_done) +- complete(io_req->dr_done); +- else if (io_req && io_req->abts_done) +- complete(io_req->abts_done); +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } else if (CMD_FLAGS(sc) & FNIC_DEVICE_RESET) { +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } +- if (!io_req) { +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } ++ /* ++ * We will be here only when FW completes reset ++ * without sending completions for outstanding ios. ++ */ ++ CMD_FLAGS(sc) |= FNIC_DEV_RST_DONE; ++ if (io_req && io_req->dr_done) ++ complete(io_req->dr_done); ++ else if (io_req && io_req->abts_done) ++ complete(io_req->abts_done); ++ spin_unlock_irqrestore(io_lock, flags); ++ return true; ++ } else if (CMD_FLAGS(sc) & FNIC_DEVICE_RESET) { ++ spin_unlock_irqrestore(io_lock, flags); ++ return true; ++ } ++ if (!io_req) { ++ spin_unlock_irqrestore(io_lock, flags); ++ goto cleanup_scsi_cmd; ++ } + +- CMD_SP(sc) = NULL; ++ CMD_SP(sc) = NULL; + +- spin_unlock_irqrestore(io_lock, flags); ++ spin_unlock_irqrestore(io_lock, flags); + +- /* +- * If there is a scsi_cmnd associated with this io_req, then +- * free the corresponding state +- */ +- start_time = io_req->start_time; +- fnic_release_ioreq_buf(fnic, io_req, sc); +- mempool_free(io_req, fnic->io_req_pool); ++ /* ++ * If there is a scsi_cmnd associated with this io_req, then ++ * free the corresponding state ++ */ ++ start_time = io_req->start_time; ++ fnic_release_ioreq_buf(fnic, io_req, sc); ++ mempool_free(io_req, fnic->io_req_pool); + +- sc->result = DID_TRANSPORT_DISRUPTED << 16; +- FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, +- "%s: tag:0x%x : sc:0x%p duration = %lu DID_TRANSPORT_DISRUPTED\n", +- __func__, sc->request->tag, sc, +- (jiffies - start_time)); ++cleanup_scsi_cmd: ++ sc->result = DID_TRANSPORT_DISRUPTED << 16; ++ FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, ++ "fnic_cleanup_io: tag:0x%x : sc:0x%p duration = %lu DID_TRANSPORT_DISRUPTED\n", ++ sc->request->tag, sc, (jiffies - start_time)); + +- if (atomic64_read(&fnic->io_cmpl_skip)) +- atomic64_dec(&fnic->io_cmpl_skip); +- else +- atomic64_inc(&fnic_stats->io_stats.io_completions); ++ if (atomic64_read(&fnic->io_cmpl_skip)) ++ atomic64_dec(&fnic->io_cmpl_skip); ++ else ++ atomic64_inc(&fnic_stats->io_stats.io_completions); + +- /* Complete the command to SCSI */ +- if (sc->scsi_done) { +- if (!(CMD_FLAGS(sc) & FNIC_IO_ISSUED)) +- shost_printk(KERN_ERR, fnic->lport->host, +- "Calling done for IO not issued to fw: tag:0x%x sc:0x%p\n", +- sc->request->tag, sc); ++ /* Complete the command to SCSI */ ++ if (sc->scsi_done) { ++ if (!(CMD_FLAGS(sc) & FNIC_IO_ISSUED)) ++ shost_printk(KERN_ERR, fnic->lport->host, ++ "Calling done for IO not issued to fw: tag:0x%x sc:0x%p\n", ++ sc->request->tag, sc); + +- FNIC_TRACE(fnic_cleanup_io, +- sc->device->host->host_no, i, sc, +- jiffies_to_msecs(jiffies - start_time), +- 0, ((u64)sc->cmnd[0] << 32 | +- (u64)sc->cmnd[2] << 24 | +- (u64)sc->cmnd[3] << 16 | +- (u64)sc->cmnd[4] << 8 | sc->cmnd[5]), +- (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc))); ++ FNIC_TRACE(fnic_cleanup_io, ++ sc->device->host->host_no, sc->request->tag, sc, ++ jiffies_to_msecs(jiffies - start_time), ++ 0, ((u64)sc->cmnd[0] << 32 | ++ (u64)sc->cmnd[2] << 24 | ++ (u64)sc->cmnd[3] << 16 | ++ (u64)sc->cmnd[4] << 8 | sc->cmnd[5]), ++ (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc))); + +- sc->scsi_done(sc); +- } +- } ++ sc->scsi_done(sc); ++ } ++ return true; ++} ++ ++ ++static void fnic_cleanup_io(struct fnic *fnic) ++{ ++ scsi_host_busy_iter(fnic->lport->host, ++ fnic_cleanup_io_iter, fnic); + } + + void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq, +@@ -1556,143 +1555,140 @@ + return 0; + } + +-static void fnic_rport_exch_reset(struct fnic *fnic, u32 port_id) +-{ +- int tag; +- int abt_tag; +- int term_cnt = 0; ++struct fnic_rport_abort_io_iter_data { ++ struct fnic *fnic; ++ u32 port_id; ++ int term_cnt; ++}; ++ ++static bool fnic_rport_abort_io(struct scsi_cmnd *sc, void *data, bool reserved) ++{ ++ struct fnic_rport_abort_io_iter_data *iter_data = data; ++ struct fnic *fnic = iter_data->fnic; ++ int abt_tag = sc->request->tag; + struct fnic_io_req *io_req; + spinlock_t *io_lock; + unsigned long flags; +- struct scsi_cmnd *sc; + struct reset_stats *reset_stats = &fnic->fnic_stats.reset_stats; + struct terminate_stats *term_stats = &fnic->fnic_stats.term_stats; + struct scsi_lun fc_lun; + enum fnic_ioreq_state old_ioreq_state; + +- FNIC_SCSI_DBG(KERN_DEBUG, +- fnic->lport->host, +- "fnic_rport_exch_reset called portid 0x%06x\n", +- port_id); +- +- if (fnic->in_remove) +- return; +- +- for (tag = 0; tag < fnic->fnic_max_tag_id; tag++) { +- abt_tag = tag; +- io_lock = fnic_io_lock_tag(fnic, tag); +- spin_lock_irqsave(io_lock, flags); +- sc = scsi_host_find_tag(fnic->lport->host, tag); +- if (!sc) { +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } ++ io_lock = fnic_io_lock_tag(fnic, abt_tag); ++ spin_lock_irqsave(io_lock, flags); + +- io_req = (struct fnic_io_req *)CMD_SP(sc); ++ io_req = (struct fnic_io_req *)CMD_SP(sc); + +- if (!io_req || io_req->port_id != port_id) { +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } ++ if (!io_req || io_req->port_id != iter_data->port_id) { ++ spin_unlock_irqrestore(io_lock, flags); ++ return true; ++ } + +- if ((CMD_FLAGS(sc) & FNIC_DEVICE_RESET) && +- (!(CMD_FLAGS(sc) & FNIC_DEV_RST_ISSUED))) { +- FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, ++ if ((CMD_FLAGS(sc) & FNIC_DEVICE_RESET) && ++ (!(CMD_FLAGS(sc) & FNIC_DEV_RST_ISSUED))) { ++ FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, + "fnic_rport_exch_reset dev rst not pending sc 0x%p\n", + sc); +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } ++ spin_unlock_irqrestore(io_lock, flags); ++ return true; ++ } + +- /* +- * Found IO that is still pending with firmware and +- * belongs to rport that went away +- */ +- if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING) { +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } +- if (io_req->abts_done) { +- shost_printk(KERN_ERR, fnic->lport->host, ++ /* ++ * Found IO that is still pending with firmware and ++ * belongs to rport that went away ++ */ ++ if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING) { ++ spin_unlock_irqrestore(io_lock, flags); ++ return true; ++ } ++ if (io_req->abts_done) { ++ shost_printk(KERN_ERR, fnic->lport->host, + "fnic_rport_exch_reset: io_req->abts_done is set " + "state is %s\n", + fnic_ioreq_state_to_str(CMD_STATE(sc))); +- } ++ } + +- if (!(CMD_FLAGS(sc) & FNIC_IO_ISSUED)) { +- shost_printk(KERN_ERR, fnic->lport->host, +- "rport_exch_reset " +- "IO not yet issued %p tag 0x%x flags " +- "%x state %d\n", +- sc, tag, CMD_FLAGS(sc), CMD_STATE(sc)); +- } +- old_ioreq_state = CMD_STATE(sc); +- CMD_STATE(sc) = FNIC_IOREQ_ABTS_PENDING; +- CMD_ABTS_STATUS(sc) = FCPIO_INVALID_CODE; +- if (CMD_FLAGS(sc) & FNIC_DEVICE_RESET) { +- atomic64_inc(&reset_stats->device_reset_terminates); +- abt_tag = (tag | FNIC_TAG_DEV_RST); +- FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, +- "fnic_rport_exch_reset dev rst sc 0x%p\n", +- sc); +- } ++ if (!(CMD_FLAGS(sc) & FNIC_IO_ISSUED)) { ++ shost_printk(KERN_ERR, fnic->lport->host, ++ "rport_exch_reset " ++ "IO not yet issued %p tag 0x%x flags " ++ "%x state %d\n", ++ sc, abt_tag, CMD_FLAGS(sc), CMD_STATE(sc)); ++ } ++ old_ioreq_state = CMD_STATE(sc); ++ CMD_STATE(sc) = FNIC_IOREQ_ABTS_PENDING; ++ CMD_ABTS_STATUS(sc) = FCPIO_INVALID_CODE; ++ if (CMD_FLAGS(sc) & FNIC_DEVICE_RESET) { ++ atomic64_inc(&reset_stats->device_reset_terminates); ++ abt_tag |= FNIC_TAG_DEV_RST; ++ } ++ FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, ++ "fnic_rport_exch_reset dev rst sc 0x%p\n", sc); ++ BUG_ON(io_req->abts_done); ++ ++ FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, ++ "fnic_rport_reset_exch: Issuing abts\n"); + +- BUG_ON(io_req->abts_done); ++ spin_unlock_irqrestore(io_lock, flags); + +- FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, +- "fnic_rport_reset_exch: Issuing abts\n"); ++ /* Now queue the abort command to firmware */ ++ int_to_scsilun(sc->device->lun, &fc_lun); + ++ if (fnic_queue_abort_io_req(fnic, abt_tag, ++ FCPIO_ITMF_ABT_TASK_TERM, ++ fc_lun.scsi_lun, io_req)) { ++ /* ++ * Revert the cmd state back to old state, if ++ * it hasn't changed in between. This cmd will get ++ * aborted later by scsi_eh, or cleaned up during ++ * lun reset ++ */ ++ spin_lock_irqsave(io_lock, flags); ++ if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING) ++ CMD_STATE(sc) = old_ioreq_state; + spin_unlock_irqrestore(io_lock, flags); ++ } else { ++ spin_lock_irqsave(io_lock, flags); ++ if (CMD_FLAGS(sc) & FNIC_DEVICE_RESET) ++ CMD_FLAGS(sc) |= FNIC_DEV_RST_TERM_ISSUED; ++ else ++ CMD_FLAGS(sc) |= FNIC_IO_INTERNAL_TERM_ISSUED; ++ spin_unlock_irqrestore(io_lock, flags); ++ atomic64_inc(&term_stats->terminates); ++ iter_data->term_cnt++; ++ } ++ return true; ++} + +- /* Now queue the abort command to firmware */ +- int_to_scsilun(sc->device->lun, &fc_lun); ++static void fnic_rport_exch_reset(struct fnic *fnic, u32 port_id) ++{ ++ struct terminate_stats *term_stats = &fnic->fnic_stats.term_stats; ++ struct fnic_rport_abort_io_iter_data iter_data = { ++ .fnic = fnic, ++ .port_id = port_id, ++ .term_cnt = 0, ++ }; + +- if (fnic_queue_abort_io_req(fnic, abt_tag, +- FCPIO_ITMF_ABT_TASK_TERM, +- fc_lun.scsi_lun, io_req)) { +- /* +- * Revert the cmd state back to old state, if +- * it hasn't changed in between. This cmd will get +- * aborted later by scsi_eh, or cleaned up during +- * lun reset +- */ +- spin_lock_irqsave(io_lock, flags); +- if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING) +- CMD_STATE(sc) = old_ioreq_state; +- spin_unlock_irqrestore(io_lock, flags); +- } else { +- spin_lock_irqsave(io_lock, flags); +- if (CMD_FLAGS(sc) & FNIC_DEVICE_RESET) +- CMD_FLAGS(sc) |= FNIC_DEV_RST_TERM_ISSUED; +- else +- CMD_FLAGS(sc) |= FNIC_IO_INTERNAL_TERM_ISSUED; +- spin_unlock_irqrestore(io_lock, flags); +- atomic64_inc(&term_stats->terminates); +- term_cnt++; +- } +- } +- if (term_cnt > atomic64_read(&term_stats->max_terminates)) +- atomic64_set(&term_stats->max_terminates, term_cnt); ++ FNIC_SCSI_DBG(KERN_DEBUG, ++ fnic->lport->host, ++ "fnic_rport_exch_reset called portid 0x%06x\n", ++ port_id); ++ ++ if (fnic->in_remove) ++ return; ++ ++ scsi_host_busy_iter(fnic->lport->host, fnic_rport_abort_io, ++ &iter_data); ++ if (iter_data.term_cnt > atomic64_read(&term_stats->max_terminates)) ++ atomic64_set(&term_stats->max_terminates, iter_data.term_cnt); + + } + + void fnic_terminate_rport_io(struct fc_rport *rport) + { +- int tag; +- int abt_tag; +- int term_cnt = 0; +- struct fnic_io_req *io_req; +- spinlock_t *io_lock; +- unsigned long flags; +- struct scsi_cmnd *sc; +- struct scsi_lun fc_lun; + struct fc_rport_libfc_priv *rdata; + struct fc_lport *lport; + struct fnic *fnic; +- struct fc_rport *cmd_rport; +- struct reset_stats *reset_stats; +- struct terminate_stats *term_stats; +- enum fnic_ioreq_state old_ioreq_state; + + if (!rport) { + printk(KERN_ERR "fnic_terminate_rport_io: rport is NULL\n"); +@@ -1720,108 +1716,7 @@ + if (fnic->in_remove) + return; + +- reset_stats = &fnic->fnic_stats.reset_stats; +- term_stats = &fnic->fnic_stats.term_stats; +- +- for (tag = 0; tag < fnic->fnic_max_tag_id; tag++) { +- abt_tag = tag; +- io_lock = fnic_io_lock_tag(fnic, tag); +- spin_lock_irqsave(io_lock, flags); +- sc = scsi_host_find_tag(fnic->lport->host, tag); +- if (!sc) { +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } +- +- io_req = (struct fnic_io_req *)CMD_SP(sc); +- if (!io_req) { +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } +- +- cmd_rport = starget_to_rport(scsi_target(sc->device)); +- if (rport != cmd_rport) { +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } +- +- if ((CMD_FLAGS(sc) & FNIC_DEVICE_RESET) && +- (!(CMD_FLAGS(sc) & FNIC_DEV_RST_ISSUED))) { +- FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, +- "fnic_terminate_rport_io dev rst not pending sc 0x%p\n", +- sc); +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } +- /* +- * Found IO that is still pending with firmware and +- * belongs to rport that went away +- */ +- if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING) { +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } +- if (io_req->abts_done) { +- shost_printk(KERN_ERR, fnic->lport->host, +- "fnic_terminate_rport_io: io_req->abts_done is set " +- "state is %s\n", +- fnic_ioreq_state_to_str(CMD_STATE(sc))); +- } +- if (!(CMD_FLAGS(sc) & FNIC_IO_ISSUED)) { +- FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, +- "fnic_terminate_rport_io " +- "IO not yet issued %p tag 0x%x flags " +- "%x state %d\n", +- sc, tag, CMD_FLAGS(sc), CMD_STATE(sc)); +- } +- old_ioreq_state = CMD_STATE(sc); +- CMD_STATE(sc) = FNIC_IOREQ_ABTS_PENDING; +- CMD_ABTS_STATUS(sc) = FCPIO_INVALID_CODE; +- if (CMD_FLAGS(sc) & FNIC_DEVICE_RESET) { +- atomic64_inc(&reset_stats->device_reset_terminates); +- abt_tag = (tag | FNIC_TAG_DEV_RST); +- FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, +- "fnic_terminate_rport_io dev rst sc 0x%p\n", sc); +- } +- +- BUG_ON(io_req->abts_done); +- +- FNIC_SCSI_DBG(KERN_DEBUG, +- fnic->lport->host, +- "fnic_terminate_rport_io: Issuing abts\n"); +- +- spin_unlock_irqrestore(io_lock, flags); +- +- /* Now queue the abort command to firmware */ +- int_to_scsilun(sc->device->lun, &fc_lun); +- +- if (fnic_queue_abort_io_req(fnic, abt_tag, +- FCPIO_ITMF_ABT_TASK_TERM, +- fc_lun.scsi_lun, io_req)) { +- /* +- * Revert the cmd state back to old state, if +- * it hasn't changed in between. This cmd will get +- * aborted later by scsi_eh, or cleaned up during +- * lun reset +- */ +- spin_lock_irqsave(io_lock, flags); +- if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING) +- CMD_STATE(sc) = old_ioreq_state; +- spin_unlock_irqrestore(io_lock, flags); +- } else { +- spin_lock_irqsave(io_lock, flags); +- if (CMD_FLAGS(sc) & FNIC_DEVICE_RESET) +- CMD_FLAGS(sc) |= FNIC_DEV_RST_TERM_ISSUED; +- else +- CMD_FLAGS(sc) |= FNIC_IO_INTERNAL_TERM_ISSUED; +- spin_unlock_irqrestore(io_lock, flags); +- atomic64_inc(&term_stats->terminates); +- term_cnt++; +- } +- } +- if (term_cnt > atomic64_read(&term_stats->max_terminates)) +- atomic64_set(&term_stats->max_terminates, term_cnt); +- ++ fnic_rport_exch_reset(fnic, rport->port_id); + } + + /* +@@ -2116,165 +2011,176 @@ + return ret; + } + +-/* +- * Clean up any pending aborts on the lun +- * For each outstanding IO on this lun, whose abort is not completed by fw, +- * issue a local abort. Wait for abort to complete. Return 0 if all commands +- * successfully aborted, 1 otherwise +- */ +-static int fnic_clean_pending_aborts(struct fnic *fnic, +- struct scsi_cmnd *lr_sc, +- bool new_sc) ++struct fnic_pending_aborts_iter_data { ++ struct fnic *fnic; ++ struct scsi_device *lun_dev; ++ int ret; ++}; ++ ++static bool fnic_pending_aborts_iter(struct scsi_cmnd *sc, ++ void *data, bool reserved) + + { +- int tag, abt_tag; ++ struct fnic_pending_aborts_iter_data *iter_data = data; ++ struct fnic *fnic = iter_data->fnic; ++ struct scsi_device *lun_dev = iter_data->lun_dev; ++ int abt_tag = sc->request->tag; + struct fnic_io_req *io_req; + spinlock_t *io_lock; + unsigned long flags; +- int ret = 0; +- struct scsi_cmnd *sc; + struct scsi_lun fc_lun; +- struct scsi_device *lun_dev = lr_sc->device; + DECLARE_COMPLETION_ONSTACK(tm_done); + enum fnic_ioreq_state old_ioreq_state; + +- for (tag = 0; tag < fnic->fnic_max_tag_id; tag++) { +- io_lock = fnic_io_lock_tag(fnic, tag); +- spin_lock_irqsave(io_lock, flags); +- sc = scsi_host_find_tag(fnic->lport->host, tag); +- /* +- * ignore this lun reset cmd if issued using new SC +- * or cmds that do not belong to this lun +- */ +- if (!sc || ((sc == lr_sc) && new_sc) || sc->device != lun_dev) { +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } +- +- io_req = (struct fnic_io_req *)CMD_SP(sc); +- +- if (!io_req || sc->device != lun_dev) { +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } +- +- /* +- * Found IO that is still pending with firmware and +- * belongs to the LUN that we are resetting +- */ +- FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, +- "Found IO in %s on lun\n", +- fnic_ioreq_state_to_str(CMD_STATE(sc))); ++ if (sc->device != lun_dev) ++ return true; ++ if (reserved) ++ return true; + +- if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING) { +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } +- if ((CMD_FLAGS(sc) & FNIC_DEVICE_RESET) && +- (!(CMD_FLAGS(sc) & FNIC_DEV_RST_ISSUED))) { +- FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, +- "%s dev rst not pending sc 0x%p\n", __func__, +- sc); +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } ++ io_lock = fnic_io_lock_tag(fnic, abt_tag); ++ spin_lock_irqsave(io_lock, flags); ++ io_req = (struct fnic_io_req *)CMD_SP(sc); ++ if (!io_req) { ++ spin_unlock_irqrestore(io_lock, flags); ++ return true; ++ } + +- if (io_req->abts_done) +- shost_printk(KERN_ERR, fnic->lport->host, +- "%s: io_req->abts_done is set state is %s\n", +- __func__, fnic_ioreq_state_to_str(CMD_STATE(sc))); +- old_ioreq_state = CMD_STATE(sc); +- /* +- * Any pending IO issued prior to reset is expected to be +- * in abts pending state, if not we need to set +- * FNIC_IOREQ_ABTS_PENDING to indicate the IO is abort pending. +- * When IO is completed, the IO will be handed over and +- * handled in this function. +- */ +- CMD_STATE(sc) = FNIC_IOREQ_ABTS_PENDING; ++ /* ++ * Found IO that is still pending with firmware and ++ * belongs to the LUN that we are resetting ++ */ ++ FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, ++ "Found IO in %s on lun\n", ++ fnic_ioreq_state_to_str(CMD_STATE(sc))); + +- BUG_ON(io_req->abts_done); ++ if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING) { ++ spin_unlock_irqrestore(io_lock, flags); ++ return true; ++ } ++ if ((CMD_FLAGS(sc) & FNIC_DEVICE_RESET) && ++ (!(CMD_FLAGS(sc) & FNIC_DEV_RST_ISSUED))) { ++ FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, ++ "%s dev rst not pending sc 0x%p\n", __func__, ++ sc); ++ spin_unlock_irqrestore(io_lock, flags); ++ return true; ++ } + +- abt_tag = tag; +- if (CMD_FLAGS(sc) & FNIC_DEVICE_RESET) { +- abt_tag |= FNIC_TAG_DEV_RST; +- FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, +- "%s: dev rst sc 0x%p\n", __func__, sc); +- } ++ if (io_req->abts_done) ++ shost_printk(KERN_ERR, fnic->lport->host, ++ "%s: io_req->abts_done is set state is %s\n", ++ __func__, fnic_ioreq_state_to_str(CMD_STATE(sc))); ++ old_ioreq_state = CMD_STATE(sc); ++ /* ++ * Any pending IO issued prior to reset is expected to be ++ * in abts pending state, if not we need to set ++ * FNIC_IOREQ_ABTS_PENDING to indicate the IO is abort pending. ++ * When IO is completed, the IO will be handed over and ++ * handled in this function. ++ */ ++ CMD_STATE(sc) = FNIC_IOREQ_ABTS_PENDING; ++ ++ BUG_ON(io_req->abts_done); + +- CMD_ABTS_STATUS(sc) = FCPIO_INVALID_CODE; +- io_req->abts_done = &tm_done; +- spin_unlock_irqrestore(io_lock, flags); ++ if (CMD_FLAGS(sc) & FNIC_DEVICE_RESET) { ++ abt_tag |= FNIC_TAG_DEV_RST; ++ FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, ++ "%s: dev rst sc 0x%p\n", __func__, sc); ++ } + +- /* Now queue the abort command to firmware */ +- int_to_scsilun(sc->device->lun, &fc_lun); ++ CMD_ABTS_STATUS(sc) = FCPIO_INVALID_CODE; ++ io_req->abts_done = &tm_done; ++ spin_unlock_irqrestore(io_lock, flags); + +- if (fnic_queue_abort_io_req(fnic, abt_tag, +- FCPIO_ITMF_ABT_TASK_TERM, +- fc_lun.scsi_lun, io_req)) { +- spin_lock_irqsave(io_lock, flags); +- io_req = (struct fnic_io_req *)CMD_SP(sc); +- if (io_req) +- io_req->abts_done = NULL; +- if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING) +- CMD_STATE(sc) = old_ioreq_state; +- spin_unlock_irqrestore(io_lock, flags); +- ret = 1; +- goto clean_pending_aborts_end; +- } else { +- spin_lock_irqsave(io_lock, flags); +- if (CMD_FLAGS(sc) & FNIC_DEVICE_RESET) +- CMD_FLAGS(sc) |= FNIC_DEV_RST_TERM_ISSUED; +- spin_unlock_irqrestore(io_lock, flags); +- } +- CMD_FLAGS(sc) |= FNIC_IO_INTERNAL_TERM_ISSUED; ++ /* Now queue the abort command to firmware */ ++ int_to_scsilun(sc->device->lun, &fc_lun); + +- wait_for_completion_timeout(&tm_done, +- msecs_to_jiffies +- (fnic->config.ed_tov)); ++ if (fnic_queue_abort_io_req(fnic, abt_tag, ++ FCPIO_ITMF_ABT_TASK_TERM, ++ fc_lun.scsi_lun, io_req)) { + +- /* Recheck cmd state to check if it is now aborted */ + spin_lock_irqsave(io_lock, flags); + io_req = (struct fnic_io_req *)CMD_SP(sc); +- if (!io_req) { +- spin_unlock_irqrestore(io_lock, flags); +- CMD_FLAGS(sc) |= FNIC_IO_ABT_TERM_REQ_NULL; +- continue; +- } ++ if (io_req) ++ io_req->abts_done = NULL; ++ if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING) ++ CMD_STATE(sc) = old_ioreq_state; ++ spin_unlock_irqrestore(io_lock, flags); ++ return false; ++ } else { ++ spin_lock_irqsave(io_lock, flags); ++ if (CMD_FLAGS(sc) & FNIC_DEVICE_RESET) ++ CMD_FLAGS(sc) |= FNIC_DEV_RST_TERM_ISSUED; ++ spin_unlock_irqrestore(io_lock, flags); ++ } ++ CMD_FLAGS(sc) |= FNIC_IO_INTERNAL_TERM_ISSUED; + +- io_req->abts_done = NULL; ++ wait_for_completion_timeout(&tm_done, msecs_to_jiffies ++ (fnic->config.ed_tov)); + +- /* if abort is still pending with fw, fail */ +- if (CMD_ABTS_STATUS(sc) == FCPIO_INVALID_CODE) { +- spin_unlock_irqrestore(io_lock, flags); +- CMD_FLAGS(sc) |= FNIC_IO_ABT_TERM_DONE; +- ret = 1; +- goto clean_pending_aborts_end; +- } +- CMD_STATE(sc) = FNIC_IOREQ_ABTS_COMPLETE; + +- /* original sc used for lr is handled by dev reset code */ +- if (sc != lr_sc) +- CMD_SP(sc) = NULL; ++ /* Recheck cmd state to check if it is now aborted */ ++ spin_lock_irqsave(io_lock, flags); ++ io_req = (struct fnic_io_req *)CMD_SP(sc); ++ if (!io_req) { + spin_unlock_irqrestore(io_lock, flags); ++ CMD_FLAGS(sc) |= FNIC_IO_ABT_TERM_REQ_NULL; ++ return true; ++ } + +- /* original sc used for lr is handled by dev reset code */ +- if (sc != lr_sc) { +- fnic_release_ioreq_buf(fnic, io_req, sc); +- mempool_free(io_req, fnic->io_req_pool); +- } ++ io_req->abts_done = NULL; + +- /* +- * Any IO is returned during reset, it needs to call scsi_done +- * to return the scsi_cmnd to upper layer. +- */ +- if (sc->scsi_done) { +- /* Set result to let upper SCSI layer retry */ +- sc->result = DID_RESET << 16; +- sc->scsi_done(sc); +- } ++ /* if abort is still pending with fw, fail */ ++ if (CMD_ABTS_STATUS(sc) == FCPIO_INVALID_CODE) { ++ spin_unlock_irqrestore(io_lock, flags); ++ CMD_FLAGS(sc) |= FNIC_IO_ABT_TERM_DONE; ++ iter_data->ret = FAILED; ++ return false; ++ } ++ CMD_STATE(sc) = FNIC_IOREQ_ABTS_COMPLETE; ++ ++ /* original sc used for lr is handled by dev reset code */ ++ CMD_SP(sc) = NULL; ++ spin_unlock_irqrestore(io_lock, flags); ++ ++ /* original sc used for lr is handled by dev reset code */ ++ fnic_release_ioreq_buf(fnic, io_req, sc); ++ mempool_free(io_req, fnic->io_req_pool); ++ ++ /* ++ * Any IO is returned during reset, it needs to call scsi_done ++ * to return the scsi_cmnd to upper layer. ++ */ ++ if (sc->scsi_done) { ++ /* Set result to let upper SCSI layer retry */ ++ sc->result = DID_RESET << 16; ++ sc->scsi_done(sc); + } ++ return true; ++} + ++/* ++ * Clean up any pending aborts on the lun ++ * For each outstanding IO on this lun, whose abort is not completed by fw, ++ * issue a local abort. Wait for abort to complete. Return 0 if all commands ++ * successfully aborted, 1 otherwise ++ */ ++static int fnic_clean_pending_aborts(struct fnic *fnic, ++ struct scsi_cmnd *lr_sc) ++{ ++ int ret = SUCCESS; ++ struct fnic_pending_aborts_iter_data iter_data = { ++ .fnic = fnic, ++ .lun_dev = lr_sc->device, ++ .ret = SUCCESS, ++ }; ++ ++ scsi_host_busy_iter(fnic->lport->host, ++ fnic_pending_aborts_iter, &iter_data); ++ if (iter_data.ret == FAILED) { ++ ret = iter_data.ret; ++ goto clean_pending_aborts_end; ++ } + schedule_timeout(msecs_to_jiffies(2 * fnic->config.ed_tov)); + + /* walk again to check, if IOs are still pending in fw */ +@@ -2515,7 +2421,7 @@ + * the lun reset cmd. If all cmds get cleaned, the lun reset + * succeeds + */ +- if (fnic_clean_pending_aborts(fnic, sc, new_sc)) { ++ if (fnic_clean_pending_aborts(fnic, sc)) { + spin_lock_irqsave(io_lock, flags); + io_req = (struct fnic_io_req *)CMD_SP(sc); + FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, +@@ -2773,6 +2679,43 @@ + + } + ++static bool fnic_abts_pending_iter(struct scsi_cmnd *sc, void *data, ++ bool reserved) ++{ ++ struct fnic_pending_aborts_iter_data *iter_data = data; ++ struct fnic *fnic = iter_data->fnic; ++ int cmd_state; ++ struct fnic_io_req *io_req; ++ spinlock_t *io_lock; ++ unsigned long flags; ++ ++ if (iter_data->lun_dev && sc->device != iter_data->lun_dev) ++ return true; ++ ++ io_lock = fnic_io_lock_hash(fnic, sc); ++ spin_lock_irqsave(io_lock, flags); ++ ++ io_req = (struct fnic_io_req *)CMD_SP(sc); ++ if (!io_req) { ++ spin_unlock_irqrestore(io_lock, flags); ++ return true; ++ } ++ ++ /* ++ * Found IO that is still pending with firmware and ++ * belongs to the LUN that we are resetting ++ */ ++ FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, ++ "Found IO in %s on lun\n", ++ fnic_ioreq_state_to_str(CMD_STATE(sc))); ++ cmd_state = CMD_STATE(sc); ++ spin_unlock_irqrestore(io_lock, flags); ++ if (cmd_state == FNIC_IOREQ_ABTS_PENDING) ++ iter_data->ret = 1; ++ ++ return iter_data->ret ? false : true; ++} ++ + /* + * fnic_is_abts_pending() is a helper function that + * walks through tag map to check if there is any IOs pending,if there is one, +@@ -2782,49 +2725,18 @@ + */ + int fnic_is_abts_pending(struct fnic *fnic, struct scsi_cmnd *lr_sc) + { +- int tag; +- struct fnic_io_req *io_req; +- spinlock_t *io_lock; +- unsigned long flags; +- int ret = 0; +- struct scsi_cmnd *sc; +- struct scsi_device *lun_dev = NULL; ++ struct fnic_pending_aborts_iter_data iter_data = { ++ .fnic = fnic, ++ .lun_dev = NULL, ++ .ret = 0, ++ }; + + if (lr_sc) +- lun_dev = lr_sc->device; ++ iter_data.lun_dev = lr_sc->device; + + /* walk again to check, if IOs are still pending in fw */ +- for (tag = 0; tag < fnic->fnic_max_tag_id; tag++) { +- sc = scsi_host_find_tag(fnic->lport->host, tag); +- /* +- * ignore this lun reset cmd or cmds that do not belong to +- * this lun +- */ +- if (!sc || (lr_sc && (sc->device != lun_dev || sc == lr_sc))) +- continue; +- +- io_lock = fnic_io_lock_hash(fnic, sc); +- spin_lock_irqsave(io_lock, flags); +- +- io_req = (struct fnic_io_req *)CMD_SP(sc); ++ scsi_host_busy_iter(fnic->lport->host, ++ fnic_abts_pending_iter, &iter_data); + +- if (!io_req || sc->device != lun_dev) { +- spin_unlock_irqrestore(io_lock, flags); +- continue; +- } +- +- /* +- * Found IO that is still pending with firmware and +- * belongs to the LUN that we are resetting +- */ +- FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, +- "Found IO in %s on lun\n", +- fnic_ioreq_state_to_str(CMD_STATE(sc))); +- +- if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING) +- ret = 1; +- spin_unlock_irqrestore(io_lock, flags); +- } +- +- return ret; ++ return iter_data.ret; + } diff --git a/patches.suse/fotg210-udc-Complete-OUT-requests-on-short-packets.patch b/patches.suse/fotg210-udc-Complete-OUT-requests-on-short-packets.patch new file mode 100644 index 0000000..2e19b69 --- /dev/null +++ b/patches.suse/fotg210-udc-Complete-OUT-requests-on-short-packets.patch @@ -0,0 +1,47 @@ +From 75bb93be0027123b5db6cbcce89eb62f0f6b3c5b Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Wed, 24 Mar 2021 15:11:15 +0100 +Subject: [PATCH] fotg210-udc: Complete OUT requests on short packets +Git-commit: 75bb93be0027123b5db6cbcce89eb62f0f6b3c5b +Patch-mainline: v5.13-rc1 +References: git-fixes + +A short packet indicates the end of a transfer and marks the request as +complete. + +Fixes: b84a8dee23fd ("usb: gadget: add Faraday fotg210_udc driver") +Signed-off-by: Fabian Vogt +Link: https://lore.kernel.org/r/20210324141115.9384-8-fabian@ritter-vogt.de +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/gadget/udc/fotg210-udc.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c +index e4036a689adb..fdca28e72a3b 100644 +--- a/drivers/usb/gadget/udc/fotg210-udc.c ++++ b/drivers/usb/gadget/udc/fotg210-udc.c +@@ -849,12 +849,16 @@ static void fotg210_out_fifo_handler(struct fotg210_ep *ep) + { + struct fotg210_request *req = list_entry(ep->queue.next, + struct fotg210_request, queue); ++ int disgr1 = ioread32(ep->fotg210->reg + FOTG210_DISGR1); + + fotg210_start_dma(ep, req); + +- /* finish out transfer */ ++ /* Complete the request when it's full or a short packet arrived. ++ * Like other drivers, short_not_ok isn't handled. ++ */ ++ + if (req->req.length == req->req.actual || +- req->req.actual < ep->ep.maxpacket) ++ (disgr1 & DISGR1_SPK_INT(ep->epnum - 1))) + fotg210_done(ep, req, 0); + } + +-- +2.26.2 + diff --git a/patches.suse/fotg210-udc-Don-t-DMA-more-than-the-buffer-can-take.patch b/patches.suse/fotg210-udc-Don-t-DMA-more-than-the-buffer-can-take.patch new file mode 100644 index 0000000..32eef14 --- /dev/null +++ b/patches.suse/fotg210-udc-Don-t-DMA-more-than-the-buffer-can-take.patch @@ -0,0 +1,40 @@ +From 3e7c2510bdfe89a9ec223dd7acd6bfc8bb1cbeb6 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Wed, 24 Mar 2021 15:11:14 +0100 +Subject: [PATCH] fotg210-udc: Don't DMA more than the buffer can take +Git-commit: 3e7c2510bdfe89a9ec223dd7acd6bfc8bb1cbeb6 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Before this, it wrote as much as available into the buffer, even if it +didn't fit. + +Fixes: b84a8dee23fd ("usb: gadget: add Faraday fotg210_udc driver") +Signed-off-by: Fabian Vogt +Link: https://lore.kernel.org/r/20210324141115.9384-7-fabian@ritter-vogt.de +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/gadget/udc/fotg210-udc.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c +index 38e24c199136..e4036a689adb 100644 +--- a/drivers/usb/gadget/udc/fotg210-udc.c ++++ b/drivers/usb/gadget/udc/fotg210-udc.c +@@ -338,8 +338,9 @@ static void fotg210_start_dma(struct fotg210_ep *ep, + } else { + buffer = req->req.buf + req->req.actual; + length = ioread32(ep->fotg210->reg + +- FOTG210_FIBCR(ep->epnum - 1)); +- length &= FIBCR_BCFX; ++ FOTG210_FIBCR(ep->epnum - 1)) & FIBCR_BCFX; ++ if (length > req->req.length - req->req.actual) ++ length = req->req.length - req->req.actual; + } + } else { + buffer = req->req.buf + req->req.actual; +-- +2.26.2 + diff --git a/patches.suse/fotg210-udc-Fix-DMA-on-EP0-for-length-max-packet-siz.patch b/patches.suse/fotg210-udc-Fix-DMA-on-EP0-for-length-max-packet-siz.patch new file mode 100644 index 0000000..0334e16 --- /dev/null +++ b/patches.suse/fotg210-udc-Fix-DMA-on-EP0-for-length-max-packet-siz.patch @@ -0,0 +1,40 @@ +From 755915fc28edfc608fa89a163014acb2f31c1e19 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Wed, 24 Mar 2021 15:11:09 +0100 +Subject: [PATCH] fotg210-udc: Fix DMA on EP0 for length > max packet size +Git-commit: 755915fc28edfc608fa89a163014acb2f31c1e19 +Patch-mainline: v5.13-rc1 +References: git-fixes + +For a 75 Byte request, it would send the first 64 separately, then detect +that the remaining 11 Byte fit into a single DMA, but due to this bug set +the length to the original 75 Bytes. This leads to a DMA failure (which is +ignored...) and the request completes without the remaining bytes having +been sent. + +Fixes: b84a8dee23fd ("usb: gadget: add Faraday fotg210_udc driver") +Signed-off-by: Fabian Vogt +Link: https://lore.kernel.org/r/20210324141115.9384-2-fabian@ritter-vogt.de +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/gadget/udc/fotg210-udc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c +index d6ca50f01985..39260007ebf8 100644 +--- a/drivers/usb/gadget/udc/fotg210-udc.c ++++ b/drivers/usb/gadget/udc/fotg210-udc.c +@@ -346,7 +346,7 @@ static void fotg210_start_dma(struct fotg210_ep *ep, + if (req->req.length - req->req.actual > ep->ep.maxpacket) + length = ep->ep.maxpacket; + else +- length = req->req.length; ++ length = req->req.length - req->req.actual; + } + + d = dma_map_single(dev, buffer, length, +-- +2.26.2 + diff --git a/patches.suse/fotg210-udc-Fix-EP0-IN-requests-bigger-than-two-pack.patch b/patches.suse/fotg210-udc-Fix-EP0-IN-requests-bigger-than-two-pack.patch new file mode 100644 index 0000000..d9b5ce6 --- /dev/null +++ b/patches.suse/fotg210-udc-Fix-EP0-IN-requests-bigger-than-two-pack.patch @@ -0,0 +1,38 @@ +From 078ba935651e149c92c41161e0322e3372cc2705 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Wed, 24 Mar 2021 15:11:10 +0100 +Subject: [PATCH] fotg210-udc: Fix EP0 IN requests bigger than two packets +Git-commit: 078ba935651e149c92c41161e0322e3372cc2705 +Patch-mainline: v5.13-rc1 +References: git-fixes + +For a 134 Byte packet, it sends the first two 64 Byte packets just fine, +but then notice that less than a packet is remaining and call fotg210_done +without actually sending the rest. + +Fixes: b84a8dee23fd ("usb: gadget: add Faraday fotg210_udc driver") +Signed-off-by: Fabian Vogt +Link: https://lore.kernel.org/r/20210324141115.9384-3-fabian@ritter-vogt.de +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/gadget/udc/fotg210-udc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c +index 39260007ebf8..345827cf1b64 100644 +--- a/drivers/usb/gadget/udc/fotg210-udc.c ++++ b/drivers/usb/gadget/udc/fotg210-udc.c +@@ -820,7 +820,7 @@ static void fotg210_ep0in(struct fotg210_udc *fotg210) + if (req->req.length) + fotg210_start_dma(ep, req); + +- if ((req->req.length - req->req.actual) < ep->ep.maxpacket) ++ if (req->req.actual == req->req.length) + fotg210_done(ep, req, 0); + } else { + fotg210_set_cxdone(fotg210); +-- +2.26.2 + diff --git a/patches.suse/fotg210-udc-Mask-GRP2-interrupts-we-don-t-handle.patch b/patches.suse/fotg210-udc-Mask-GRP2-interrupts-we-don-t-handle.patch new file mode 100644 index 0000000..42b6b60 --- /dev/null +++ b/patches.suse/fotg210-udc-Mask-GRP2-interrupts-we-don-t-handle.patch @@ -0,0 +1,42 @@ +From 9aee3a23d6455200702f3a57e731fa11e8408667 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Wed, 24 Mar 2021 15:11:12 +0100 +Subject: [PATCH] fotg210-udc: Mask GRP2 interrupts we don't handle +Git-commit: 9aee3a23d6455200702f3a57e731fa11e8408667 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Currently it leaves unhandled interrupts unmasked, but those are never +acked. In the case of a "device idle" interrupt, this leads to an +effectively frozen system until plugging it in. + +Fixes: b84a8dee23fd ("usb: gadget: add Faraday fotg210_udc driver") +Signed-off-by: Fabian Vogt +Link: https://lore.kernel.org/r/20210324141115.9384-5-fabian@ritter-vogt.de +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/gadget/udc/fotg210-udc.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c +index a3ad93bfd256..bbcc92376307 100644 +--- a/drivers/usb/gadget/udc/fotg210-udc.c ++++ b/drivers/usb/gadget/udc/fotg210-udc.c +@@ -1026,6 +1026,12 @@ static void fotg210_init(struct fotg210_udc *fotg210) + value &= ~DMCR_GLINT_EN; + iowrite32(value, fotg210->reg + FOTG210_DMCR); + ++ /* enable only grp2 irqs we handle */ ++ iowrite32(~(DISGR2_DMA_ERROR | DISGR2_RX0BYTE_INT | DISGR2_TX0BYTE_INT ++ | DISGR2_ISO_SEQ_ABORT_INT | DISGR2_ISO_SEQ_ERR_INT ++ | DISGR2_RESM_INT | DISGR2_SUSP_INT | DISGR2_USBRST_INT), ++ fotg210->reg + FOTG210_DMISGR2); ++ + /* disable all fifo interrupt */ + iowrite32(~(u32)0, fotg210->reg + FOTG210_DMISGR1); + +-- +2.26.2 + diff --git a/patches.suse/fotg210-udc-Remove-a-dubious-condition-leading-to-fo.patch b/patches.suse/fotg210-udc-Remove-a-dubious-condition-leading-to-fo.patch new file mode 100644 index 0000000..39440ff --- /dev/null +++ b/patches.suse/fotg210-udc-Remove-a-dubious-condition-leading-to-fo.patch @@ -0,0 +1,40 @@ +From c7f755b243494d6043aadcd9a2989cb157958b95 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Wed, 24 Mar 2021 15:11:11 +0100 +Subject: [PATCH] fotg210-udc: Remove a dubious condition leading to fotg210_done +Git-commit: c7f755b243494d6043aadcd9a2989cb157958b95 +Patch-mainline: v5.13-rc1 +References: git-fixes + +When the EP0 IN request was not completed but less than a packet sent, +it would complete the request successfully. That doesn't make sense +and can't really happen as fotg210_start_dma always sends +min(length, maxpkt) bytes. + +Fixes: b84a8dee23fd ("usb: gadget: add Faraday fotg210_udc driver") +Signed-off-by: Fabian Vogt +Link: https://lore.kernel.org/r/20210324141115.9384-4-fabian@ritter-vogt.de +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/gadget/udc/fotg210-udc.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c +index 345827cf1b64..a3ad93bfd256 100644 +--- a/drivers/usb/gadget/udc/fotg210-udc.c ++++ b/drivers/usb/gadget/udc/fotg210-udc.c +@@ -379,8 +379,7 @@ static void fotg210_ep0_queue(struct fotg210_ep *ep, + } + if (ep->dir_in) { /* if IN */ + fotg210_start_dma(ep, req); +- if ((req->req.length == req->req.actual) || +- (req->req.actual < ep->ep.maxpacket)) ++ if (req->req.length == req->req.actual) + fotg210_done(ep, req, 0); + } else { /* OUT */ + u32 value = ioread32(ep->fotg210->reg + FOTG210_DMISGR0); +-- +2.26.2 + diff --git a/patches.suse/gpio-omap-Save-and-restore-sysconfig.patch b/patches.suse/gpio-omap-Save-and-restore-sysconfig.patch new file mode 100644 index 0000000..6ee3d72 --- /dev/null +++ b/patches.suse/gpio-omap-Save-and-restore-sysconfig.patch @@ -0,0 +1,118 @@ +From ddd8d94ca31e768c76cf8bfe34ba7b10136b3694 Mon Sep 17 00:00:00 2001 +From: Tony Lindgren +Date: Sat, 17 Apr 2021 11:38:39 +0300 +Subject: [PATCH] gpio: omap: Save and restore sysconfig +Git-commit: ddd8d94ca31e768c76cf8bfe34ba7b10136b3694 +Patch-mainline: v5.12 +References: git-fixes + +As we are using cpu_pm to save and restore context, we must also save and +restore the GPIO sysconfig register. This is needed because we are not +calling PM runtime functions at all with cpu_pm. + +We need to save the sysconfig on idle as it's value can get reconfigured by +PM runtime and can be different from the init time value. Device specific +flags like "ti,no-idle-on-init" can affect the init value. + +Fixes: b764a5863fd8 ("gpio: omap: Remove custom PM calls and use cpu_pm instead") +Cc: Aaro Koskinen +Cc: Adam Ford +Cc: Andreas Kemnade +Cc: Grygorii Strashko +Cc: Peter Ujfalusi +Signed-off-by: Tony Lindgren +Acked-by: Grygorii Strashko +Signed-off-by: Bartosz Golaszewski +Acked-by: Takashi Iwai + +--- + drivers/gpio/gpio-omap.c | 9 +++++++++ + include/linux/platform_data/gpio-omap.h | 3 +++ + 2 files changed, 12 insertions(+) + +diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c +index 41952bb818ad..56152263ab38 100644 +--- a/drivers/gpio/gpio-omap.c ++++ b/drivers/gpio/gpio-omap.c +@@ -29,6 +29,7 @@ + #define OMAP4_GPIO_DEBOUNCINGTIME_MASK 0xFF + + struct gpio_regs { ++ u32 sysconfig; + u32 irqenable1; + u32 irqenable2; + u32 wake_en; +@@ -1069,6 +1070,7 @@ static void omap_gpio_init_context(struct gpio_bank *p) + const struct omap_gpio_reg_offs *regs = p->regs; + void __iomem *base = p->base; + ++ p->context.sysconfig = readl_relaxed(base + regs->sysconfig); + p->context.ctrl = readl_relaxed(base + regs->ctrl); + p->context.oe = readl_relaxed(base + regs->direction); + p->context.wake_en = readl_relaxed(base + regs->wkup_en); +@@ -1088,6 +1090,7 @@ static void omap_gpio_restore_context(struct gpio_bank *bank) + const struct omap_gpio_reg_offs *regs = bank->regs; + void __iomem *base = bank->base; + ++ writel_relaxed(bank->context.sysconfig, base + regs->sysconfig); + writel_relaxed(bank->context.wake_en, base + regs->wkup_en); + writel_relaxed(bank->context.ctrl, base + regs->ctrl); + writel_relaxed(bank->context.leveldetect0, base + regs->leveldetect0); +@@ -1115,6 +1118,10 @@ static void omap_gpio_idle(struct gpio_bank *bank, bool may_lose_context) + + bank->saved_datain = readl_relaxed(base + bank->regs->datain); + ++ /* Save syconfig, it's runtime value can be different from init value */ ++ if (bank->loses_context) ++ bank->context.sysconfig = readl_relaxed(base + bank->regs->sysconfig); ++ + if (!bank->enabled_non_wakeup_gpios) + goto update_gpio_context_count; + +@@ -1279,6 +1286,7 @@ static int gpio_omap_cpu_notifier(struct notifier_block *nb, + + static const struct omap_gpio_reg_offs omap2_gpio_regs = { + .revision = OMAP24XX_GPIO_REVISION, ++ .sysconfig = OMAP24XX_GPIO_SYSCONFIG, + .direction = OMAP24XX_GPIO_OE, + .datain = OMAP24XX_GPIO_DATAIN, + .dataout = OMAP24XX_GPIO_DATAOUT, +@@ -1302,6 +1310,7 @@ static const struct omap_gpio_reg_offs omap2_gpio_regs = { + + static const struct omap_gpio_reg_offs omap4_gpio_regs = { + .revision = OMAP4_GPIO_REVISION, ++ .sysconfig = OMAP4_GPIO_SYSCONFIG, + .direction = OMAP4_GPIO_OE, + .datain = OMAP4_GPIO_DATAIN, + .dataout = OMAP4_GPIO_DATAOUT, +diff --git a/include/linux/platform_data/gpio-omap.h b/include/linux/platform_data/gpio-omap.h +index 8b30b14b47d3..f377817ce75c 100644 +--- a/include/linux/platform_data/gpio-omap.h ++++ b/include/linux/platform_data/gpio-omap.h +@@ -85,6 +85,7 @@ + * omap2+ specific GPIO registers + */ + #define OMAP24XX_GPIO_REVISION 0x0000 ++#define OMAP24XX_GPIO_SYSCONFIG 0x0010 + #define OMAP24XX_GPIO_IRQSTATUS1 0x0018 + #define OMAP24XX_GPIO_IRQSTATUS2 0x0028 + #define OMAP24XX_GPIO_IRQENABLE2 0x002c +@@ -108,6 +109,7 @@ + #define OMAP24XX_GPIO_SETDATAOUT 0x0094 + + #define OMAP4_GPIO_REVISION 0x0000 ++#define OMAP4_GPIO_SYSCONFIG 0x0010 + #define OMAP4_GPIO_EOI 0x0020 + #define OMAP4_GPIO_IRQSTATUSRAW0 0x0024 + #define OMAP4_GPIO_IRQSTATUSRAW1 0x0028 +@@ -148,6 +150,7 @@ + #ifndef __ASSEMBLER__ + struct omap_gpio_reg_offs { + u16 revision; ++ u16 sysconfig; + u16 direction; + u16 datain; + u16 dataout; +-- +2.26.2 + diff --git a/patches.suse/i2c-cadence-add-IRQ-check.patch b/patches.suse/i2c-cadence-add-IRQ-check.patch new file mode 100644 index 0000000..bb41d2d --- /dev/null +++ b/patches.suse/i2c-cadence-add-IRQ-check.patch @@ -0,0 +1,42 @@ +From 5581c2c5d02bc63a0edb53e061c8e97cd490646e Mon Sep 17 00:00:00 2001 +From: Sergey Shtylyov +Date: Sat, 10 Apr 2021 23:14:35 +0300 +Subject: [PATCH] i2c: cadence: add IRQ check +Git-commit: 5581c2c5d02bc63a0edb53e061c8e97cd490646e +Patch-mainline: v5.13-rc1 +References: git-fixes + +The driver neglects to check the result of platform_get_irq()'s call and +blithely passes the negative error codes to devm_request_irq() (which +takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding +an original error code. Stop calling devm_request_irq() with invalid +IRQ #s. + +Fixes: df8eb5691c48 ("i2c: Add driver for Cadence I2C controller") +Signed-off-by: Sergey Shtylyov +Signed-off-by: Wolfram Sang +Acked-by: Takashi Iwai + +--- + drivers/i2c/busses/i2c-cadence.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c +index e8eae8725900..c1bbc4caeb5c 100644 +--- a/drivers/i2c/busses/i2c-cadence.c ++++ b/drivers/i2c/busses/i2c-cadence.c +@@ -1200,7 +1200,10 @@ static int cdns_i2c_probe(struct platform_device *pdev) + if (IS_ERR(id->membase)) + return PTR_ERR(id->membase); + +- id->irq = platform_get_irq(pdev, 0); ++ ret = platform_get_irq(pdev, 0); ++ if (ret < 0) ++ return ret; ++ id->irq = ret; + + id->adap.owner = THIS_MODULE; + id->adap.dev.of_node = pdev->dev.of_node; +-- +2.26.2 + diff --git a/patches.suse/i2c-emev2-add-IRQ-check.patch b/patches.suse/i2c-emev2-add-IRQ-check.patch new file mode 100644 index 0000000..86ca0ab --- /dev/null +++ b/patches.suse/i2c-emev2-add-IRQ-check.patch @@ -0,0 +1,42 @@ +From bb6129c32867baa7988f7fd2066cf18ed662d240 Mon Sep 17 00:00:00 2001 +From: Sergey Shtylyov +Date: Sat, 10 Apr 2021 23:16:41 +0300 +Subject: [PATCH] i2c: emev2: add IRQ check +Git-commit: bb6129c32867baa7988f7fd2066cf18ed662d240 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The driver neglects to check the result of platform_get_irq()'s call and +blithely passes the negative error codes to devm_request_irq() (which +takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding +an original error code. Stop calling devm_request_irq() with invalid +IRQ #s. + +Fixes: 5faf6e1f58b4 ("i2c: emev2: add driver") +Signed-off-by: Sergey Shtylyov +Signed-off-by: Wolfram Sang +Acked-by: Takashi Iwai + +--- + drivers/i2c/busses/i2c-emev2.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/i2c/busses/i2c-emev2.c b/drivers/i2c/busses/i2c-emev2.c +index a08554c1a570..bdff0e6345d9 100644 +--- a/drivers/i2c/busses/i2c-emev2.c ++++ b/drivers/i2c/busses/i2c-emev2.c +@@ -395,7 +395,10 @@ static int em_i2c_probe(struct platform_device *pdev) + + em_i2c_reset(&priv->adap); + +- priv->irq = platform_get_irq(pdev, 0); ++ ret = platform_get_irq(pdev, 0); ++ if (ret < 0) ++ goto err_clk; ++ priv->irq = ret; + ret = devm_request_irq(&pdev->dev, priv->irq, em_i2c_irq_handler, 0, + "em_i2c", priv); + if (ret) +-- +2.26.2 + diff --git a/patches.suse/i2c-img-scb-fix-reference-leak-when-pm_runtime_get_s.patch b/patches.suse/i2c-img-scb-fix-reference-leak-when-pm_runtime_get_s.patch new file mode 100644 index 0000000..1f0ab95 --- /dev/null +++ b/patches.suse/i2c-img-scb-fix-reference-leak-when-pm_runtime_get_s.patch @@ -0,0 +1,53 @@ +From 223125e37af8a641ea4a09747a6a52172fc4b903 Mon Sep 17 00:00:00 2001 +From: Qinglang Miao +Date: Tue, 1 Dec 2020 17:31:39 +0800 +Subject: [PATCH] i2c: img-scb: fix reference leak when pm_runtime_get_sync fails +Git-commit: 223125e37af8a641ea4a09747a6a52172fc4b903 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The PM reference count is not expected to be incremented on +return in functions img_i2c_xfer and img_i2c_init. + +However, pm_runtime_get_sync will increment the PM reference +count even failed. Forgetting to putting operation will result +in a reference leak here. + +Replace it with pm_runtime_resume_and_get to keep usage +counter balanced. + +Fixes: 93222bd9b966 ("i2c: img-scb: Add runtime PM") +Reported-by: Hulk Robot +Signed-off-by: Qinglang Miao +Signed-off-by: Wolfram Sang +Acked-by: Takashi Iwai + +--- + drivers/i2c/busses/i2c-img-scb.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c +index 98a89301ed2a..8e987945ed45 100644 +--- a/drivers/i2c/busses/i2c-img-scb.c ++++ b/drivers/i2c/busses/i2c-img-scb.c +@@ -1057,7 +1057,7 @@ static int img_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, + atomic = true; + } + +- ret = pm_runtime_get_sync(adap->dev.parent); ++ ret = pm_runtime_resume_and_get(adap->dev.parent); + if (ret < 0) + return ret; + +@@ -1158,7 +1158,7 @@ static int img_i2c_init(struct img_i2c *i2c) + u32 rev; + int ret; + +- ret = pm_runtime_get_sync(i2c->adap.dev.parent); ++ ret = pm_runtime_resume_and_get(i2c->adap.dev.parent); + if (ret < 0) + return ret; + +-- +2.26.2 + diff --git a/patches.suse/i2c-imx-lpi2c-fix-reference-leak-when-pm_runtime_get.patch b/patches.suse/i2c-imx-lpi2c-fix-reference-leak-when-pm_runtime_get.patch new file mode 100644 index 0000000..e52c31f --- /dev/null +++ b/patches.suse/i2c-imx-lpi2c-fix-reference-leak-when-pm_runtime_get.patch @@ -0,0 +1,44 @@ +From 278e5bbdb9a94fa063c0f9bcde2479d0b8042462 Mon Sep 17 00:00:00 2001 +From: Qinglang Miao +Date: Tue, 1 Dec 2020 17:31:40 +0800 +Subject: [PATCH] i2c: imx-lpi2c: fix reference leak when pm_runtime_get_sync fails +Git-commit: 278e5bbdb9a94fa063c0f9bcde2479d0b8042462 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The PM reference count is not expected to be incremented on +return in lpi2c_imx_master_enable. + +However, pm_runtime_get_sync will increment the PM reference +count even failed. Forgetting to putting operation will result +in a reference leak here. + +Replace it with pm_runtime_resume_and_get to keep usage +counter balanced. + +Fixes: 13d6eb20fc79 ("i2c: imx-lpi2c: add runtime pm support") +Reported-by: Hulk Robot +Signed-off-by: Qinglang Miao +Signed-off-by: Wolfram Sang +Acked-by: Takashi Iwai + +--- + drivers/i2c/busses/i2c-imx-lpi2c.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c +index 9db6ccded5e9..8b9ba055c418 100644 +--- a/drivers/i2c/busses/i2c-imx-lpi2c.c ++++ b/drivers/i2c/busses/i2c-imx-lpi2c.c +@@ -259,7 +259,7 @@ static int lpi2c_imx_master_enable(struct lpi2c_imx_struct *lpi2c_imx) + unsigned int temp; + int ret; + +- ret = pm_runtime_get_sync(lpi2c_imx->adapter.dev.parent); ++ ret = pm_runtime_resume_and_get(lpi2c_imx->adapter.dev.parent); + if (ret < 0) + return ret; + +-- +2.26.2 + diff --git a/patches.suse/i2c-jz4780-add-IRQ-check.patch b/patches.suse/i2c-jz4780-add-IRQ-check.patch new file mode 100644 index 0000000..8d004c1 --- /dev/null +++ b/patches.suse/i2c-jz4780-add-IRQ-check.patch @@ -0,0 +1,42 @@ +From c5e5f7a8d931fb4beba245bdbc94734175fda9de Mon Sep 17 00:00:00 2001 +From: Sergey Shtylyov +Date: Sat, 10 Apr 2021 23:18:31 +0300 +Subject: [PATCH] i2c: jz4780: add IRQ check +Git-commit: c5e5f7a8d931fb4beba245bdbc94734175fda9de +Patch-mainline: v5.13-rc1 +References: git-fixes + +The driver neglects to check the result of platform_get_irq()'s call and +blithely passes the negative error codes to devm_request_irq() (which +takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding +an original error code. Stop calling devm_request_irq() with invalid +IRQ #s. + +Fixes: ba92222ed63a ("i2c: jz4780: Add i2c bus controller driver for Ingenic JZ4780") +Signed-off-by: Sergey Shtylyov +Signed-off-by: Wolfram Sang +Acked-by: Takashi Iwai + +--- + drivers/i2c/busses/i2c-jz4780.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c +index 8509c5f11356..331a4b567849 100644 +--- a/drivers/i2c/busses/i2c-jz4780.c ++++ b/drivers/i2c/busses/i2c-jz4780.c +@@ -825,7 +825,10 @@ static int jz4780_i2c_probe(struct platform_device *pdev) + + jz4780_i2c_writew(i2c, JZ4780_I2C_INTM, 0x0); + +- i2c->irq = platform_get_irq(pdev, 0); ++ ret = platform_get_irq(pdev, 0); ++ if (ret < 0) ++ goto err; ++ i2c->irq = ret; + ret = devm_request_irq(&pdev->dev, i2c->irq, jz4780_i2c_irq, 0, + dev_name(&pdev->dev), i2c); + if (ret) +-- +2.26.2 + diff --git a/patches.suse/i2c-omap-fix-reference-leak-when-pm_runtime_get_sync.patch b/patches.suse/i2c-omap-fix-reference-leak-when-pm_runtime_get_sync.patch new file mode 100644 index 0000000..ae6e58c --- /dev/null +++ b/patches.suse/i2c-omap-fix-reference-leak-when-pm_runtime_get_sync.patch @@ -0,0 +1,71 @@ +From 780f629741257ed6c54bd3eb53b57f648eabf200 Mon Sep 17 00:00:00 2001 +From: Qinglang Miao +Date: Tue, 1 Dec 2020 17:31:43 +0800 +Subject: [PATCH] i2c: omap: fix reference leak when pm_runtime_get_sync fails +Git-commit: 780f629741257ed6c54bd3eb53b57f648eabf200 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The PM reference count is not expected to be incremented on +return in omap_i2c_probe() and omap_i2c_remove(). + +However, pm_runtime_get_sync will increment the PM reference +count even failed. Forgetting to putting operation will result +in a reference leak here. I Replace it with pm_runtime_resume_and_get +to keep usage counter balanced. + +What's more, error path 'err_free_mem' seems not like a proper +name any more. So I change the name to err_disable_pm and move +pm_runtime_disable below, for pm_runtime of 'pdev->dev' should +be disabled when pm_runtime_resume_and_get fails. + +Fixes: 3b0fb97c8dc4 ("I2C: OMAP: Handle error check for pm runtime") +Reported-by: Hulk Robot +Signed-off-by: Qinglang Miao +Reviewed-by: Grygorii Strashko +Reviewed-by: Vignesh Raghavendra +Signed-off-by: Wolfram Sang +Acked-by: Takashi Iwai + +--- + drivers/i2c/busses/i2c-omap.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c +index 12ac4212aded..d4f6c6d60683 100644 +--- a/drivers/i2c/busses/i2c-omap.c ++++ b/drivers/i2c/busses/i2c-omap.c +@@ -1404,9 +1404,9 @@ omap_i2c_probe(struct platform_device *pdev) + pm_runtime_set_autosuspend_delay(omap->dev, OMAP_I2C_PM_TIMEOUT); + pm_runtime_use_autosuspend(omap->dev); + +- r = pm_runtime_get_sync(omap->dev); ++ r = pm_runtime_resume_and_get(omap->dev); + if (r < 0) +- goto err_free_mem; ++ goto err_disable_pm; + + /* + * Read the Rev hi bit-[15:14] ie scheme this is 1 indicates ver2. +@@ -1513,8 +1513,8 @@ omap_i2c_probe(struct platform_device *pdev) + omap_i2c_write_reg(omap, OMAP_I2C_CON_REG, 0); + pm_runtime_dont_use_autosuspend(omap->dev); + pm_runtime_put_sync(omap->dev); ++err_disable_pm: + pm_runtime_disable(&pdev->dev); +-err_free_mem: + + return r; + } +@@ -1525,7 +1525,7 @@ static int omap_i2c_remove(struct platform_device *pdev) + int ret; + + i2c_del_adapter(&omap->adapter); +- ret = pm_runtime_get_sync(&pdev->dev); ++ ret = pm_runtime_resume_and_get(&pdev->dev); + if (ret < 0) + return ret; + +-- +2.26.2 + diff --git a/patches.suse/i2c-sh7760-add-IRQ-check.patch b/patches.suse/i2c-sh7760-add-IRQ-check.patch new file mode 100644 index 0000000..3865278 --- /dev/null +++ b/patches.suse/i2c-sh7760-add-IRQ-check.patch @@ -0,0 +1,42 @@ +From e5b2e3e742015dd2aa6bc7bcef2cb59b2de1221c Mon Sep 17 00:00:00 2001 +From: Sergey Shtylyov +Date: Sat, 10 Apr 2021 23:25:10 +0300 +Subject: [PATCH] i2c: sh7760: add IRQ check +Git-commit: e5b2e3e742015dd2aa6bc7bcef2cb59b2de1221c +Patch-mainline: v5.13-rc1 +References: git-fixes + +The driver neglects to check the result of platform_get_irq()'s call and +blithely passes the negative error codes to devm_request_irq() (which +takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding +an original error code. Stop calling devm_request_irq() with invalid +IRQ #s. + +Fixes: a26c20b1fa6d ("i2c: Renesas SH7760 I2C master driver") +Signed-off-by: Sergey Shtylyov +Signed-off-by: Wolfram Sang +Acked-by: Takashi Iwai + +--- + drivers/i2c/busses/i2c-sh7760.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c +index c2005c789d2b..c79c9f542c5a 100644 +--- a/drivers/i2c/busses/i2c-sh7760.c ++++ b/drivers/i2c/busses/i2c-sh7760.c +@@ -471,7 +471,10 @@ static int sh7760_i2c_probe(struct platform_device *pdev) + goto out2; + } + +- id->irq = platform_get_irq(pdev, 0); ++ ret = platform_get_irq(pdev, 0); ++ if (ret < 0) ++ return ret; ++ id->irq = ret; + + id->adap.nr = pdev->id; + id->adap.algo = &sh7760_i2c_algo; +-- +2.26.2 + diff --git a/patches.suse/i2c-sh7760-fix-IRQ-error-path.patch b/patches.suse/i2c-sh7760-fix-IRQ-error-path.patch new file mode 100644 index 0000000..6f50435 --- /dev/null +++ b/patches.suse/i2c-sh7760-fix-IRQ-error-path.patch @@ -0,0 +1,38 @@ +From 92dfb27240fea2776f61c5422472cb6defca7767 Mon Sep 17 00:00:00 2001 +From: Sergey Shtylyov +Date: Sat, 17 Apr 2021 22:05:05 +0300 +Subject: [PATCH] i2c: sh7760: fix IRQ error path +Git-commit: 92dfb27240fea2776f61c5422472cb6defca7767 +Patch-mainline: v5.13-rc1 +References: git-fixes + +While adding the invalid IRQ check after calling platform_get_irq(), +I managed to overlook that the driver has a complex error path in its +probe() method, thus a simple *return* couldn't be used. Use a proper +*goto* instead! + +Fixes: e5b2e3e74201 ("i2c: sh7760: add IRQ check") +Signed-off-by: Sergey Shtylyov +Signed-off-by: Wolfram Sang +Acked-by: Takashi Iwai + +--- + drivers/i2c/busses/i2c-sh7760.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c +index c79c9f542c5a..319d1fa617c8 100644 +--- a/drivers/i2c/busses/i2c-sh7760.c ++++ b/drivers/i2c/busses/i2c-sh7760.c +@@ -473,7 +473,7 @@ static int sh7760_i2c_probe(struct platform_device *pdev) + + ret = platform_get_irq(pdev, 0); + if (ret < 0) +- return ret; ++ goto out3; + id->irq = ret; + + id->adap.nr = pdev->id; +-- +2.26.2 + diff --git a/patches.suse/i2c-sprd-fix-reference-leak-when-pm_runtime_get_sync.patch b/patches.suse/i2c-sprd-fix-reference-leak-when-pm_runtime_get_sync.patch new file mode 100644 index 0000000..5b89c7a --- /dev/null +++ b/patches.suse/i2c-sprd-fix-reference-leak-when-pm_runtime_get_sync.patch @@ -0,0 +1,53 @@ +From 3a4f326463117cee3adcb72999ca34a9aaafda93 Mon Sep 17 00:00:00 2001 +From: Qinglang Miao +Date: Tue, 1 Dec 2020 17:31:44 +0800 +Subject: [PATCH] i2c: sprd: fix reference leak when pm_runtime_get_sync fails +Git-commit: 3a4f326463117cee3adcb72999ca34a9aaafda93 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The PM reference count is not expected to be incremented on +return in sprd_i2c_master_xfer() and sprd_i2c_remove(). + +However, pm_runtime_get_sync will increment the PM reference +count even failed. Forgetting to putting operation will result +in a reference leak here. + +Replace it with pm_runtime_resume_and_get to keep usage +counter balanced. + +Fixes: 8b9ec0719834 ("i2c: Add Spreadtrum I2C controller driver") +Reported-by: Hulk Robot +Signed-off-by: Qinglang Miao +Signed-off-by: Wolfram Sang +Acked-by: Takashi Iwai + +--- + drivers/i2c/busses/i2c-sprd.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-sprd.c b/drivers/i2c/busses/i2c-sprd.c +index 9f77d1ddbaf8..4fe15cd78907 100644 +--- a/drivers/i2c/busses/i2c-sprd.c ++++ b/drivers/i2c/busses/i2c-sprd.c +@@ -290,7 +290,7 @@ static int sprd_i2c_master_xfer(struct i2c_adapter *i2c_adap, + struct sprd_i2c *i2c_dev = i2c_adap->algo_data; + int im, ret; + +- ret = pm_runtime_get_sync(i2c_dev->dev); ++ ret = pm_runtime_resume_and_get(i2c_dev->dev); + if (ret < 0) + return ret; + +@@ -576,7 +576,7 @@ static int sprd_i2c_remove(struct platform_device *pdev) + struct sprd_i2c *i2c_dev = platform_get_drvdata(pdev); + int ret; + +- ret = pm_runtime_get_sync(i2c_dev->dev); ++ ret = pm_runtime_resume_and_get(i2c_dev->dev); + if (ret < 0) + return ret; + +-- +2.26.2 + diff --git a/patches.suse/ibmvnic-avoid-calling-napi_disable-twice.patch b/patches.suse/ibmvnic-avoid-calling-napi_disable-twice.patch new file mode 100644 index 0000000..3a676db --- /dev/null +++ b/patches.suse/ibmvnic-avoid-calling-napi_disable-twice.patch @@ -0,0 +1,46 @@ +From 0775ebc4cf8554bdcd2c212669a0868ab68df5c0 Mon Sep 17 00:00:00 2001 +From: Lijun Pan +Date: Wed, 14 Apr 2021 02:46:14 -0500 +Subject: [PATCH] ibmvnic: avoid calling napi_disable() twice + +References: bsc#1065729 +Patch-mainline: v5.12-rc8 +Git-commit: 0775ebc4cf8554bdcd2c212669a0868ab68df5c0 + +__ibmvnic_open calls napi_disable without checking whether NAPI polling +has already been disabled or not. This could cause napi_disable +being called twice, which could generate deadlock. For example, +the first napi_disable will spin until NAPI_STATE_SCHED is cleared +by napi_complete_done, then set it again. +When napi_disable is called the second time, it will loop infinitely +because no dev->poll will be running to clear NAPI_STATE_SCHED. + +To prevent above scenario from happening, call ibmvnic_napi_disable() +which checks if napi is disabled or not before calling napi_disable. + +Fixes: bfc32f297337 ("ibmvnic: Move resource initialization to its own routine") +Suggested-by: Thomas Falcon +Signed-off-by: Lijun Pan +Signed-off-by: David S. Miller +Acked-by: Michal Suchanek +--- + drivers/net/ethernet/ibm/ibmvnic.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c +index 110a0d0eaabb..2d27f8aa0d4b 100644 +--- a/drivers/net/ethernet/ibm/ibmvnic.c ++++ b/drivers/net/ethernet/ibm/ibmvnic.c +@@ -1149,8 +1149,7 @@ static int __ibmvnic_open(struct net_device *netdev) + + rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_UP); + if (rc) { +- for (i = 0; i < adapter->req_rx_queues; i++) +- napi_disable(&adapter->napi[i]); ++ ibmvnic_napi_disable(adapter); + release_resources(adapter); + return rc; + } +-- +2.26.2 + diff --git a/patches.suse/ibmvnic-clean-up-the-remaining-debugfs-data-structur.patch b/patches.suse/ibmvnic-clean-up-the-remaining-debugfs-data-structur.patch new file mode 100644 index 0000000..47aea6f --- /dev/null +++ b/patches.suse/ibmvnic-clean-up-the-remaining-debugfs-data-structur.patch @@ -0,0 +1,143 @@ +From c82eaa4064f3c59f8b026a6b6e5f8693b5be92da Mon Sep 17 00:00:00 2001 +From: Lijun Pan +Date: Mon, 12 Apr 2021 02:40:59 -0500 +Subject: [PATCH] ibmvnic: clean up the remaining debugfs data structures + +References: bsc#1065729 +Patch-mainline: v5.13-rc1 +Git-commit: c82eaa4064f3c59f8b026a6b6e5f8693b5be92da + +Commit e704f0434ea6 ("ibmvnic: Remove debugfs support") did not +clean up everything. Remove the remaining code. + +Signed-off-by: Lijun Pan +Signed-off-by: David S. Miller +Acked-by: Michal Suchanek +--- + drivers/net/ethernet/ibm/ibmvnic.h | 94 ------------------------------ + 1 file changed, 94 deletions(-) + +diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h +index 806aa75a4e86..c1d39a748546 100644 +--- a/drivers/net/ethernet/ibm/ibmvnic.h ++++ b/drivers/net/ethernet/ibm/ibmvnic.h +@@ -412,77 +412,6 @@ struct ibmvnic_control_ip_offload { + struct ibmvnic_rc rc; + } __packed __aligned(8); + +-struct ibmvnic_request_dump_size { +- u8 first; +- u8 cmd; +- u8 reserved[6]; +- __be32 len; +- struct ibmvnic_rc rc; +-} __packed __aligned(8); +- +-struct ibmvnic_request_dump { +- u8 first; +- u8 cmd; +- u8 reserved1[2]; +- __be32 ioba; +- __be32 len; +- u8 reserved2[4]; +-} __packed __aligned(8); +- +-struct ibmvnic_request_dump_rsp { +- u8 first; +- u8 cmd; +- u8 reserved[6]; +- __be32 dumped_len; +- struct ibmvnic_rc rc; +-} __packed __aligned(8); +- +-struct ibmvnic_request_ras_comp_num { +- u8 first; +- u8 cmd; +- u8 reserved1[2]; +- __be32 num_components; +- u8 reserved2[4]; +- struct ibmvnic_rc rc; +-} __packed __aligned(8); +- +-struct ibmvnic_request_ras_comps { +- u8 first; +- u8 cmd; +- u8 reserved[2]; +- __be32 ioba; +- __be32 len; +- struct ibmvnic_rc rc; +-} __packed __aligned(8); +- +-struct ibmvnic_control_ras { +- u8 first; +- u8 cmd; +- u8 correlator; +- u8 level; +- u8 op; +-#define IBMVNIC_TRACE_LEVEL 1 +-#define IBMVNIC_ERROR_LEVEL 2 +-#define IBMVNIC_TRACE_PAUSE 3 +-#define IBMVNIC_TRACE_RESUME 4 +-#define IBMVNIC_TRACE_ON 5 +-#define IBMVNIC_TRACE_OFF 6 +-#define IBMVNIC_CHG_TRACE_BUFF_SZ 7 +- u8 trace_buff_sz[3]; +- u8 reserved[4]; +- struct ibmvnic_rc rc; +-} __packed __aligned(8); +- +-struct ibmvnic_collect_fw_trace { +- u8 first; +- u8 cmd; +- u8 correlator; +- u8 reserved; +- __be32 ioba; +- __be32 len; +- struct ibmvnic_rc rc; +-} __packed __aligned(8); +- + struct ibmvnic_request_statistics { + u8 first; + u8 cmd; +@@ -494,15 +423,6 @@ struct ibmvnic_request_statistics { + u8 reserved[4]; + } __packed __aligned(8); + +-struct ibmvnic_request_debug_stats { +- u8 first; +- u8 cmd; +- u8 reserved[2]; +- __be32 ioba; +- __be32 len; +- struct ibmvnic_rc rc; +-} __packed __aligned(8); +- + struct ibmvnic_error_indication { + u8 first; + u8 cmd; +@@ -677,22 +597,8 @@ union ibmvnic_crq { + struct ibmvnic_query_ip_offload query_ip_offload_rsp; + struct ibmvnic_control_ip_offload control_ip_offload; + struct ibmvnic_control_ip_offload control_ip_offload_rsp; +- struct ibmvnic_request_dump_size request_dump_size; +- struct ibmvnic_request_dump_size request_dump_size_rsp; +- struct ibmvnic_request_dump request_dump; +- struct ibmvnic_request_dump_rsp request_dump_rsp; +- struct ibmvnic_request_ras_comp_num request_ras_comp_num; +- struct ibmvnic_request_ras_comp_num request_ras_comp_num_rsp; +- struct ibmvnic_request_ras_comps request_ras_comps; +- struct ibmvnic_request_ras_comps request_ras_comps_rsp; +- struct ibmvnic_control_ras control_ras; +- struct ibmvnic_control_ras control_ras_rsp; +- struct ibmvnic_collect_fw_trace collect_fw_trace; +- struct ibmvnic_collect_fw_trace collect_fw_trace_rsp; + struct ibmvnic_request_statistics request_statistics; + struct ibmvnic_generic_crq request_statistics_rsp; +- struct ibmvnic_request_debug_stats request_debug_stats; +- struct ibmvnic_request_debug_stats request_debug_stats_rsp; + struct ibmvnic_error_indication error_indication; + struct ibmvnic_link_state_indication link_state_indication; + struct ibmvnic_change_mac_addr change_mac_addr; +-- +2.26.2 + diff --git a/patches.suse/ibmvnic-improve-failover-sysfs-entry.patch b/patches.suse/ibmvnic-improve-failover-sysfs-entry.patch new file mode 100644 index 0000000..99a83e5 --- /dev/null +++ b/patches.suse/ibmvnic-improve-failover-sysfs-entry.patch @@ -0,0 +1,62 @@ +From 334c4241472916851d97aae209aedf1927ec84e3 Mon Sep 17 00:00:00 2001 +From: Lijun Pan +Date: Tue, 13 Apr 2021 03:31:44 -0500 +Subject: [PATCH] ibmvnic: improve failover sysfs entry + +References: bsc#1043990 ltc#155681 git-fixes +Patch-mainline: v5.13-rc1 +Git-commit: 334c4241472916851d97aae209aedf1927ec84e3 + +The current implementation relies on H_IOCTL call to issue a +H_SESSION_ERR_DETECTED command to let the hypervisor to send a failover +signal. However, it may not work if there is no backup device or if +the vnic is already in error state, +e.g., "ibmvnic 30000003 env3: rx buffer returned with rc 6". +Add a last resort, that is to schedule a failover reset via CRQ command. + +Signed-off-by: Lijun Pan +Signed-off-by: David S. Miller +Acked-by: Michal Suchanek +--- + drivers/net/ethernet/ibm/ibmvnic.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c +index ee9bf18c597f..0961d36833d5 100644 +--- a/drivers/net/ethernet/ibm/ibmvnic.c ++++ b/drivers/net/ethernet/ibm/ibmvnic.c +@@ -5503,7 +5503,7 @@ static ssize_t failover_store(struct device *dev, struct device_attribute *attr, + if (rc) { + netdev_err(netdev, "Couldn't retrieve session token, rc %ld\n", + rc); +- return -EINVAL; ++ goto last_resort; + } + + session_token = (__be64)retbuf[0]; +@@ -5511,15 +5511,17 @@ static ssize_t failover_store(struct device *dev, struct device_attribute *attr, + be64_to_cpu(session_token)); + rc = plpar_hcall_norets(H_VIOCTL, adapter->vdev->unit_address, + H_SESSION_ERR_DETECTED, session_token, 0, 0); +- if (rc) { +- netdev_err(netdev, "Client initiated failover failed, rc %ld\n", ++ if (rc) ++ netdev_err(netdev, ++ "H_VIOCTL initiated failover failed, rc %ld\n", + rc); +- return -EINVAL; +- } ++ ++last_resort: ++ netdev_dbg(netdev, "Trying to send CRQ_CMD, the last resort\n"); ++ ibmvnic_reset(adapter, VNIC_RESET_FAILOVER); + + return count; + } +- + static DEVICE_ATTR_WO(failover); + + static unsigned long ibmvnic_get_desired_dma(struct vio_dev *vdev) +-- +2.26.2 + diff --git a/patches.suse/ibmvnic-print-adapter-state-as-a-string.patch b/patches.suse/ibmvnic-print-adapter-state-as-a-string.patch new file mode 100644 index 0000000..bb8512d --- /dev/null +++ b/patches.suse/ibmvnic-print-adapter-state-as-a-string.patch @@ -0,0 +1,162 @@ +From 0666ef7f61ca763897fdcd385d65555dd4764514 Mon Sep 17 00:00:00 2001 +From: Lijun Pan +Date: Mon, 12 Apr 2021 02:41:28 -0500 +Subject: [PATCH] ibmvnic: print adapter state as a string + +References: bsc#1152457 ltc#174432 git-fixes +Patch-mainline: v5.13-rc1 +Git-commit: 0666ef7f61ca763897fdcd385d65555dd4764514 + +The adapter state can be added or deleted over different versions +of the source code. Print a string instead of a number. + +Signed-off-by: Lijun Pan +Signed-off-by: David S. Miller +Acked-by: Michal Suchanek +--- + drivers/net/ethernet/ibm/ibmvnic.c | 67 ++++++++++++++++++++++-------- + 1 file changed, 49 insertions(+), 18 deletions(-) + +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c +--- a/drivers/net/ethernet/ibm/ibmvnic.c ++++ b/drivers/net/ethernet/ibm/ibmvnic.c +@@ -827,6 +827,30 @@ static void release_napi(struct ibmvnic_adapter *adapter) + adapter->napi_enabled = false; + } + ++static const char *adapter_state_to_string(enum vnic_state state) ++{ ++ switch (state) { ++ case VNIC_PROBING: ++ return "PROBING"; ++ case VNIC_PROBED: ++ return "PROBED"; ++ case VNIC_OPENING: ++ return "OPENING"; ++ case VNIC_OPEN: ++ return "OPEN"; ++ case VNIC_CLOSING: ++ return "CLOSING"; ++ case VNIC_CLOSED: ++ return "CLOSED"; ++ case VNIC_REMOVING: ++ return "REMOVING"; ++ case VNIC_REMOVED: ++ return "REMOVED"; ++ default: ++ return "UNKNOWN"; ++ } ++} ++ + static int ibmvnic_login(struct net_device *netdev) + { + struct ibmvnic_adapter *adapter = netdev_priv(netdev); +@@ -905,7 +929,7 @@ static int ibmvnic_login(struct net_device *netdev) + + __ibmvnic_set_mac(netdev, adapter->mac_addr); + +- netdev_dbg(netdev, "[S:%d] Login succeeded\n", adapter->state); ++ netdev_dbg(netdev, "[S:%s] Login succeeded\n", adapter_state_to_string(adapter->state)); + return 0; + } + +@@ -1185,8 +1209,9 @@ static int ibmvnic_open(struct net_device *netdev) + * honor our setting below. + */ + if (adapter->failover_pending || (test_bit(0, &adapter->resetting))) { +- netdev_dbg(netdev, "[S:%d FOP:%d] Resetting, deferring open\n", +- adapter->state, adapter->failover_pending); ++ netdev_dbg(netdev, "[S:%s FOP:%d] Resetting, deferring open\n", ++ adapter_state_to_string(adapter->state), ++ adapter->failover_pending); + adapter->state = VNIC_OPEN; + rc = 0; + goto out; +@@ -1350,8 +1375,9 @@ static int ibmvnic_close(struct net_device *netdev) + struct ibmvnic_adapter *adapter = netdev_priv(netdev); + int rc; + +- netdev_dbg(netdev, "[S:%d FOP:%d FRR:%d] Closing\n", +- adapter->state, adapter->failover_pending, ++ netdev_dbg(netdev, "[S:%s FOP:%d FRR:%d] Closing\n", ++ adapter_state_to_string(adapter->state), ++ adapter->failover_pending, + adapter->force_reset_recovery); + + /* If device failover is pending, just set device state and return. +@@ -1944,9 +1970,11 @@ static int do_reset(struct ibmvnic_adapter *adapter, + int rc; + + netdev_dbg(adapter->netdev, +- "[S:%d FOP:%d] Reset reason: %s, reset_state %d\n", +- adapter->state, adapter->failover_pending, +- reset_reason_to_string(rwi->reset_reason), reset_state); ++ "[S:%s FOP:%d] Reset reason: %s, reset_state: %s\n", ++ adapter_state_to_string(adapter->state), ++ adapter->failover_pending, ++ reset_reason_to_string(rwi->reset_reason), ++ adapter_state_to_string(reset_state)); + + adapter->reset_reason = rwi->reset_reason; + /* requestor of VNIC_RESET_CHANGE_PARAM already has the rtnl lock */ +@@ -2006,8 +2034,8 @@ static int do_reset(struct ibmvnic_adapter *adapter, + * from VNIC_CLOSING state. + */ + netdev_dbg(netdev, +- "Open changed state from %d, updating.\n", +- reset_state); ++ "Open changed state from %s, updating.\n", ++ adapter_state_to_string(reset_state)); + reset_state = VNIC_OPEN; + adapter->state = VNIC_CLOSING; + } +@@ -2148,8 +2176,9 @@ static int do_reset(struct ibmvnic_adapter *adapter, + if (!(adapter->reset_reason == VNIC_RESET_CHANGE_PARAM)) + rtnl_unlock(); + +- netdev_dbg(adapter->netdev, "[S:%d FOP:%d] Reset done, rc %d\n", +- adapter->state, adapter->failover_pending, rc); ++ netdev_dbg(adapter->netdev, "[S:%s FOP:%d] Reset done, rc %d\n", ++ adapter_state_to_string(adapter->state), ++ adapter->failover_pending, rc); + return rc; + } + +@@ -2226,8 +2255,9 @@ static int do_hard_reset(struct ibmvnic_adapter *adapter, + /* restore adapter state if reset failed */ + if (rc) + adapter->state = reset_state; +- netdev_dbg(adapter->netdev, "[S:%d FOP:%d] Hard reset done, rc %d\n", +- adapter->state, adapter->failover_pending, rc); ++ netdev_dbg(adapter->netdev, "[S:%s FOP:%d] Hard reset done, rc %d\n", ++ adapter_state_to_string(adapter->state), ++ adapter->failover_pending, rc); + return rc; + } + +@@ -2306,8 +2336,8 @@ static void __ibmvnic_reset(struct work_struct *work) + if (rc) { + /* give backing device time to settle down */ + netdev_dbg(adapter->netdev, +- "[S:%d] Hard reset failed, waiting 60 secs\n", +- adapter->state); ++ "[S:%s] Hard reset failed, waiting 60 secs\n", ++ adapter_state_to_string(adapter->state)); + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout(60 * HZ); + } +@@ -2335,8 +2365,9 @@ static void __ibmvnic_reset(struct work_struct *work) + clear_bit_unlock(0, &adapter->resetting); + + netdev_dbg(adapter->netdev, +- "[S:%d FRR:%d WFR:%d] Done processing resets\n", +- adapter->state, adapter->force_reset_recovery, ++ "[S:%s FRR:%d WFR:%d] Done processing resets\n", ++ adapter_state_to_string(adapter->state), ++ adapter->force_reset_recovery, + adapter->wait_for_reset); + } + +-- +2.26.2 + diff --git a/patches.suse/ibmvnic-print-reset-reason-as-a-string.patch b/patches.suse/ibmvnic-print-reset-reason-as-a-string.patch new file mode 100644 index 0000000..4235e64 --- /dev/null +++ b/patches.suse/ibmvnic-print-reset-reason-as-a-string.patch @@ -0,0 +1,96 @@ +From caee7bf5b0a9a1b0956b5910f0c44278ec1a9bb4 Mon Sep 17 00:00:00 2001 +From: Lijun Pan +Date: Mon, 12 Apr 2021 02:41:27 -0500 +Subject: [PATCH] ibmvnic: print reset reason as a string + +References: bsc#1152457 ltc#174432 git-fixes +Patch-mainline: v5.13-rc1 +Git-commit: caee7bf5b0a9a1b0956b5910f0c44278ec1a9bb4 + +The reset reason can be added or deleted over different versions +of the source code. Print a string instead of a number. + +Signed-off-by: Lijun Pan +Signed-off-by: David S. Miller +Acked-by: Michal Suchanek +--- + drivers/net/ethernet/ibm/ibmvnic.c | 35 ++++++++++++++++++++++++------ + 1 file changed, 28 insertions(+), 7 deletions(-) + +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c +--- a/drivers/net/ethernet/ibm/ibmvnic.c ++++ b/drivers/net/ethernet/ibm/ibmvnic.c +@@ -1911,6 +1911,26 @@ static int ibmvnic_set_mac(struct net_device *netdev, void *p) + return rc; + } + ++static const char *reset_reason_to_string(enum ibmvnic_reset_reason reason) ++{ ++ switch (reason) { ++ case VNIC_RESET_FAILOVER: ++ return "FAILOVER"; ++ case VNIC_RESET_MOBILITY: ++ return "MOBILITY"; ++ case VNIC_RESET_FATAL: ++ return "FATAL"; ++ case VNIC_RESET_NON_FATAL: ++ return "NON_FATAL"; ++ case VNIC_RESET_TIMEOUT: ++ return "TIMEOUT"; ++ case VNIC_RESET_CHANGE_PARAM: ++ return "CHANGE_PARAM"; ++ default: ++ return "UNKNOWN"; ++ } ++} ++ + /* + * do_reset returns zero if we are able to keep processing reset events, or + * non-zero if we hit a fatal error and must halt. +@@ -1924,9 +1944,9 @@ static int do_reset(struct ibmvnic_adapter *adapter, + int rc; + + netdev_dbg(adapter->netdev, +- "[S:%d FOP:%d] Reset reason %d, reset_state %d\n", ++ "[S:%d FOP:%d] Reset reason: %s, reset_state %d\n", + adapter->state, adapter->failover_pending, +- rwi->reset_reason, reset_state); ++ reset_reason_to_string(rwi->reset_reason), reset_state); + + adapter->reset_reason = rwi->reset_reason; + /* requestor of VNIC_RESET_CHANGE_PARAM already has the rtnl lock */ +@@ -2139,8 +2159,8 @@ static int do_hard_reset(struct ibmvnic_adapter *adapter, + struct net_device *netdev = adapter->netdev; + int rc; + +- netdev_dbg(adapter->netdev, "Hard resetting driver (%d)\n", +- rwi->reset_reason); ++ netdev_dbg(adapter->netdev, "Hard resetting driver (%s)\n", ++ reset_reason_to_string(rwi->reset_reason)); + + /* read the state and check (again) after getting rtnl */ + reset_state = adapter->state; +@@ -2363,8 +2383,8 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter, + list_for_each(entry, &adapter->rwi_list) { + tmp = list_entry(entry, struct ibmvnic_rwi, list); + if (tmp->reset_reason == reason) { +- netdev_dbg(netdev, "Skipping matching reset, reason=%d\n", +- reason); ++ netdev_dbg(netdev, "Skipping matching reset, reason=%s\n", ++ reset_reason_to_string(reason)); + ret = EBUSY; + goto err; + } +@@ -2384,7 +2404,8 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter, + } + rwi->reset_reason = reason; + list_add_tail(&rwi->list, &adapter->rwi_list); +- netdev_dbg(adapter->netdev, "Scheduling reset (reason %d)\n", reason); ++ netdev_dbg(adapter->netdev, "Scheduling reset (reason %s)\n", ++ reset_reason_to_string(reason)); + schedule_work(&adapter->ibmvnic_reset); + + ret = 0; +-- +2.26.2 + diff --git a/patches.suse/ibmvnic-queue-reset-work-in-system_long_wq.patch b/patches.suse/ibmvnic-queue-reset-work-in-system_long_wq.patch new file mode 100644 index 0000000..f4cb504 --- /dev/null +++ b/patches.suse/ibmvnic-queue-reset-work-in-system_long_wq.patch @@ -0,0 +1,52 @@ +From 870e04ae45ea2e569d1ca2780439b16e988da08d Mon Sep 17 00:00:00 2001 +From: Lijun Pan +Date: Tue, 13 Apr 2021 14:33:39 -0500 +Subject: [PATCH] ibmvnic: queue reset work in system_long_wq + +References: bsc#1152457 ltc#174432 git-fixes +Patch-mainline: v5.13-rc1 +Git-commit: 870e04ae45ea2e569d1ca2780439b16e988da08d + +The reset process for ibmvnic commonly takes multiple seconds, clearly +making it inappropriate for schedule_work/system_wq. The reason to make +this change is that ibmvnic's use of the default system-wide workqueue +for a relatively long-running work item can negatively affect other +workqueue users. So, queue the relatively slow reset job to the +system_long_wq. + +Suggested-by: Nathan Lynch +Signed-off-by: Lijun Pan +Signed-off-by: David S. Miller +Acked-by: Michal Suchanek +--- + drivers/net/ethernet/ibm/ibmvnic.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c +index 0961d36833d5..b72159ccca3a 100644 +--- a/drivers/net/ethernet/ibm/ibmvnic.c ++++ b/drivers/net/ethernet/ibm/ibmvnic.c +@@ -2292,8 +2292,9 @@ static void __ibmvnic_reset(struct work_struct *work) + adapter = container_of(work, struct ibmvnic_adapter, ibmvnic_reset); + + if (test_and_set_bit_lock(0, &adapter->resetting)) { +- schedule_delayed_work(&adapter->ibmvnic_delayed_reset, +- IBMVNIC_RESET_DELAY); ++ queue_delayed_work(system_long_wq, ++ &adapter->ibmvnic_delayed_reset, ++ IBMVNIC_RESET_DELAY); + return; + } + +@@ -2437,7 +2438,7 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter, + list_add_tail(&rwi->list, &adapter->rwi_list); + netdev_dbg(adapter->netdev, "Scheduling reset (reason %s)\n", + reset_reason_to_string(reason)); +- schedule_work(&adapter->ibmvnic_reset); ++ queue_work(system_long_wq, &adapter->ibmvnic_reset); + + ret = 0; + err: +-- +2.26.2 + diff --git a/patches.suse/ibmvnic-remove-duplicate-napi_schedule-call-in-do_re.patch b/patches.suse/ibmvnic-remove-duplicate-napi_schedule-call-in-do_re.patch new file mode 100644 index 0000000..566b0a8 --- /dev/null +++ b/patches.suse/ibmvnic-remove-duplicate-napi_schedule-call-in-do_re.patch @@ -0,0 +1,52 @@ +From d3a6abccbd272aea7dc2c6f984bb5a2c11278e44 Mon Sep 17 00:00:00 2001 +From: Lijun Pan +Date: Wed, 14 Apr 2021 02:46:15 -0500 +Subject: [PATCH] ibmvnic: remove duplicate napi_schedule call in do_reset + function + +References: bsc#1065729 +Patch-mainline: v5.12-rc8 +Git-commit: d3a6abccbd272aea7dc2c6f984bb5a2c11278e44 + +During adapter reset, do_reset/do_hard_reset calls ibmvnic_open(), +which will calls napi_schedule if previous state is VNIC_CLOSED +(i.e, the reset case, and "ifconfig down" case). So there is no need +for do_reset to call napi_schedule again at the end of the function +though napi_schedule will neglect the request if napi is already +scheduled. + +Fixes: ed651a10875f ("ibmvnic: Updated reset handling") +Signed-off-by: Lijun Pan +Signed-off-by: David S. Miller +Acked-by: Michal Suchanek +--- + drivers/net/ethernet/ibm/ibmvnic.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c +index 2d27f8aa0d4b..f4bd63216672 100644 +--- a/drivers/net/ethernet/ibm/ibmvnic.c ++++ b/drivers/net/ethernet/ibm/ibmvnic.c +@@ -1921,7 +1921,7 @@ static int do_reset(struct ibmvnic_adapter *adapter, + u64 old_num_rx_queues, old_num_tx_queues; + u64 old_num_rx_slots, old_num_tx_slots; + struct net_device *netdev = adapter->netdev; +- int i, rc; ++ int rc; + + netdev_dbg(adapter->netdev, + "[S:%d FOP:%d] Reset reason %d, reset_state %d\n", +@@ -2110,10 +2110,6 @@ static int do_reset(struct ibmvnic_adapter *adapter, + /* refresh device's multicast list */ + ibmvnic_set_multi(netdev); + +- /* kick napi */ +- for (i = 0; i < adapter->req_rx_queues; i++) +- napi_schedule(&adapter->napi[i]); +- + if (adapter->reset_reason == VNIC_RESET_FAILOVER || + adapter->reset_reason == VNIC_RESET_MOBILITY) + __netdev_notify_peers(netdev); +-- +2.26.2 + diff --git a/patches.suse/ibmvnic-remove-duplicate-napi_schedule-call-in-open-.patch b/patches.suse/ibmvnic-remove-duplicate-napi_schedule-call-in-open-.patch new file mode 100644 index 0000000..fbd6333 --- /dev/null +++ b/patches.suse/ibmvnic-remove-duplicate-napi_schedule-call-in-open-.patch @@ -0,0 +1,40 @@ +From 7c451f3ef676c805a4b77a743a01a5c21a250a73 Mon Sep 17 00:00:00 2001 +From: Lijun Pan +Date: Wed, 14 Apr 2021 02:46:16 -0500 +Subject: [PATCH] ibmvnic: remove duplicate napi_schedule call in open function + +References: bsc#1065729 +Patch-mainline: v5.12-rc8 +Git-commit: 7c451f3ef676c805a4b77a743a01a5c21a250a73 + +Remove the unnecessary napi_schedule() call in __ibmvnic_open() since +interrupt_rx() calls napi_schedule_prep/__napi_schedule during every +receive interrupt. + +Fixes: ed651a10875f ("ibmvnic: Updated reset handling") +Signed-off-by: Lijun Pan +Signed-off-by: David S. Miller +Acked-by: Michal Suchanek +--- + drivers/net/ethernet/ibm/ibmvnic.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c +index f4bd63216672..ffb2a91750c7 100644 +--- a/drivers/net/ethernet/ibm/ibmvnic.c ++++ b/drivers/net/ethernet/ibm/ibmvnic.c +@@ -1156,11 +1156,6 @@ static int __ibmvnic_open(struct net_device *netdev) + + netif_tx_start_all_queues(netdev); + +- if (prev_state == VNIC_CLOSED) { +- for (i = 0; i < adapter->req_rx_queues; i++) +- napi_schedule(&adapter->napi[i]); +- } +- + adapter->state = VNIC_OPEN; + return rc; + } +-- +2.26.2 + diff --git a/patches.suse/iio-accel-adis16201-Fix-wrong-axis-assignment-that-p.patch b/patches.suse/iio-accel-adis16201-Fix-wrong-axis-assignment-that-p.patch new file mode 100644 index 0000000..91aac33 --- /dev/null +++ b/patches.suse/iio-accel-adis16201-Fix-wrong-axis-assignment-that-p.patch @@ -0,0 +1,52 @@ +From 4e102429f3dc62dce546f6107e34a4284634196d Mon Sep 17 00:00:00 2001 +From: Jonathan Cameron +Date: Sun, 21 Mar 2021 18:29:56 +0000 +Subject: [PATCH] iio:accel:adis16201: Fix wrong axis assignment that prevents loading +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 4e102429f3dc62dce546f6107e34a4284634196d +Patch-mainline: v5.13-rc1 +References: git-fixes + +Whilst running some basic tests as part of writing up the dt-bindings for +this driver (to follow), it became clear it doesn't actually load +currently. + +iio iio:device1: tried to double register : in_incli_x_index +adis16201 spi0.0: Failed to create buffer sysfs interfaces +Adis16201: probe of spi0.0 failed with error -16 + +Looks like a cut and paste / update bug. Fixes tag obviously not accurate +but we don't want to bother carry thing back to before the driver moved +out of staging. + +Fixes: 591298e54cea ("Staging: iio: accel: adis16201: Move adis16201 driver out of staging") +Signed-off-by: Jonathan Cameron +Cc: +Cc: Himanshu Jha +Cc: Nuno Sá +Reviewed-by: Alexandru Ardelean +Link: https://lore.kernel.org/r/20210321182956.844652-1-jic23@kernel.org +Acked-by: Takashi Iwai + +--- + drivers/iio/accel/adis16201.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/iio/accel/adis16201.c b/drivers/iio/accel/adis16201.c +index 3633a4e302c6..fe225990de24 100644 +--- a/drivers/iio/accel/adis16201.c ++++ b/drivers/iio/accel/adis16201.c +@@ -215,7 +215,7 @@ static const struct iio_chan_spec adis16201_channels[] = { + ADIS_AUX_ADC_CHAN(ADIS16201_AUX_ADC_REG, ADIS16201_SCAN_AUX_ADC, 0, 12), + ADIS_INCLI_CHAN(X, ADIS16201_XINCL_OUT_REG, ADIS16201_SCAN_INCLI_X, + BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), +- ADIS_INCLI_CHAN(X, ADIS16201_YINCL_OUT_REG, ADIS16201_SCAN_INCLI_Y, ++ ADIS_INCLI_CHAN(Y, ADIS16201_YINCL_OUT_REG, ADIS16201_SCAN_INCLI_Y, + BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), + IIO_CHAN_SOFT_TIMESTAMP(7) + }; +-- +2.26.2 + diff --git a/patches.suse/ima-free-ima-measurement-buffer-after-kexec-syscall b/patches.suse/ima-free-ima-measurement-buffer-after-kexec-syscall new file mode 100644 index 0000000..c99b7c3 --- /dev/null +++ b/patches.suse/ima-free-ima-measurement-buffer-after-kexec-syscall @@ -0,0 +1,69 @@ +From: Lakshmi Ramasubramanian +Date: Thu, 4 Feb 2021 09:49:51 -0800 +Subject: ima: Free IMA measurement buffer after kexec syscall +Git-commit: f31e3386a4e92ba6eda7328cb508462956c94c64 +Patch-mainline: v5.12-rc1 +References: git-fixes + +IMA allocates kernel virtual memory to carry forward the measurement +list, from the current kernel to the next kernel on kexec system call, +in ima_add_kexec_buffer() function. This buffer is not freed before +completing the kexec system call resulting in memory leak. + +Add ima_buffer field in "struct kimage" to store the virtual address +of the buffer allocated for the IMA measurement list. +Free the memory allocated for the IMA measurement list in +kimage_file_post_load_cleanup() function. + +Signed-off-by: Lakshmi Ramasubramanian +Suggested-by: Tyler Hicks +Reviewed-by: Thiago Jung Bauermann +Reviewed-by: Tyler Hicks +Fixes: 7b8589cc29e7 ("ima: on soft reboot, save the measurement list") +Signed-off-by: Mimi Zohar +Acked-by: Petr Tesarik +--- + include/linux/kexec.h | 5 +++++ + kernel/kexec_file.c | 5 +++++ + security/integrity/ima/ima_kexec.c | 2 ++ + 3 files changed, 12 insertions(+) + +--- a/include/linux/kexec.h ++++ b/include/linux/kexec.h +@@ -291,6 +291,11 @@ struct kimage { + /* Information for loading purgatory */ + struct purgatory_info purgatory_info; + #endif ++ ++#ifdef CONFIG_IMA_KEXEC ++ /* Virtual address of IMA measurement buffer for kexec syscall */ ++ void *ima_buffer; ++#endif + }; + + /* kexec interface functions */ +--- a/kernel/kexec_file.c ++++ b/kernel/kexec_file.c +@@ -165,6 +165,11 @@ void kimage_file_post_load_cleanup(struc + vfree(pi->sechdrs); + pi->sechdrs = NULL; + ++#ifdef CONFIG_IMA_KEXEC ++ vfree(image->ima_buffer); ++ image->ima_buffer = NULL; ++#endif /* CONFIG_IMA_KEXEC */ ++ + /* See if architecture has anything to cleanup post load */ + arch_kimage_file_post_load_cleanup(image); + +--- a/security/integrity/ima/ima_kexec.c ++++ b/security/integrity/ima/ima_kexec.c +@@ -129,6 +129,8 @@ void ima_add_kexec_buffer(struct kimage + return; + } + ++ image->ima_buffer = kexec_buffer; ++ + pr_debug("kexec measurement buffer for the loaded kernel at 0x%lx.\n", + kbuf.mem); + } diff --git a/patches.suse/ipw2x00-potential-buffer-overflow-in-libipw_wx_set_e.patch b/patches.suse/ipw2x00-potential-buffer-overflow-in-libipw_wx_set_e.patch new file mode 100644 index 0000000..81fcb14 --- /dev/null +++ b/patches.suse/ipw2x00-potential-buffer-overflow-in-libipw_wx_set_e.patch @@ -0,0 +1,43 @@ +From 260a9ad9446723d4063ed802989758852809714d Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 14 Apr 2021 11:29:55 +0300 +Subject: [PATCH] ipw2x00: potential buffer overflow in libipw_wx_set_encodeext() +Git-commit: 260a9ad9446723d4063ed802989758852809714d +Patch-mainline: v5.13-rc1 +References: git-fixes + +The "ext->key_len" is a u16 that comes from the user. If it's over +SCM_KEY_LEN (32) that could lead to memory corruption. + +Fixes: e0d369d1d969 ("[PATCH] ieee82011: Added WE-18 support to default wireless extension handler") +Cc: stable@vger.kernel.org +Signed-off-by: Dan Carpenter +Acked-by: Stanislav Yakovlev +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/YHaoA1i+8uT4ir4h@mwanda +Acked-by: Takashi Iwai + +--- + drivers/net/wireless/intel/ipw2x00/libipw_wx.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_wx.c b/drivers/net/wireless/intel/ipw2x00/libipw_wx.c +index a0cf78c418ac..903de34028ef 100644 +--- a/drivers/net/wireless/intel/ipw2x00/libipw_wx.c ++++ b/drivers/net/wireless/intel/ipw2x00/libipw_wx.c +@@ -633,8 +633,10 @@ int libipw_wx_set_encodeext(struct libipw_device *ieee, + } + + if (ext->alg != IW_ENCODE_ALG_NONE) { +- memcpy(sec.keys[idx], ext->key, ext->key_len); +- sec.key_sizes[idx] = ext->key_len; ++ int key_len = clamp_val(ext->key_len, 0, SCM_KEY_LEN); ++ ++ memcpy(sec.keys[idx], ext->key, key_len); ++ sec.key_sizes[idx] = key_len; + sec.flags |= (1 << idx); + if (ext->alg == IW_ENCODE_ALG_WEP) { + sec.encode_alg[idx] = SEC_ALG_WEP; +-- +2.26.2 + diff --git a/patches.suse/liquidio-Fix-unintented-sign-extension-of-a-left-shi.patch b/patches.suse/liquidio-Fix-unintented-sign-extension-of-a-left-shi.patch new file mode 100644 index 0000000..0ce402a --- /dev/null +++ b/patches.suse/liquidio-Fix-unintented-sign-extension-of-a-left-shi.patch @@ -0,0 +1,48 @@ +From 298b58f00c0f86868ea717426beb5c1198772f81 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Wed, 7 Apr 2021 11:12:48 +0100 +Subject: [PATCH] liquidio: Fix unintented sign extension of a left shift of a u16 +Git-commit: 298b58f00c0f86868ea717426beb5c1198772f81 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The macro CN23XX_PEM_BAR1_INDEX_REG is being used to shift oct->pcie_port +(a u16) left 24 places. There are two subtle issues here, first the +shift gets promoted to an signed int and then sign extended to a u64. +If oct->pcie_port is 0x80 or more then the upper bits get sign extended +to 1. Secondly shfiting a u16 24 bits will lead to an overflow so it +needs to be cast to a u64 for all the bits to not overflow. + +It is entirely possible that the u16 port value is never large enough +for this to fail, but it is useful to fix unintended overflows such +as this. + +Fix this by casting the port parameter to the macro to a u64 before +the shift. + +Addresses-coverity: ("Unintended sign extension") +Fixes: 5bc67f587ba7 ("liquidio: CN23XX register definitions") +Signed-off-by: Colin Ian King +Signed-off-by: David S. Miller +Acked-by: Takashi Iwai + +--- + drivers/net/ethernet/cavium/liquidio/cn23xx_pf_regs.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_regs.h b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_regs.h +index e6d4ad99cc38..3f1c189646f4 100644 +--- a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_regs.h ++++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_regs.h +@@ -521,7 +521,7 @@ + #define CN23XX_BAR1_INDEX_OFFSET 3 + + #define CN23XX_PEM_BAR1_INDEX_REG(port, idx) \ +- (CN23XX_PEM_BAR1_INDEX_START + ((port) << CN23XX_PEM_OFFSET) + \ ++ (CN23XX_PEM_BAR1_INDEX_START + (((u64)port) << CN23XX_PEM_OFFSET) + \ + ((idx) << CN23XX_BAR1_INDEX_OFFSET)) + + /*############################ DPI #########################*/ +-- +2.26.2 + diff --git a/patches.suse/mac80211-bail-out-if-cipher-schemes-are-invalid.patch b/patches.suse/mac80211-bail-out-if-cipher-schemes-are-invalid.patch new file mode 100644 index 0000000..cf010db --- /dev/null +++ b/patches.suse/mac80211-bail-out-if-cipher-schemes-are-invalid.patch @@ -0,0 +1,44 @@ +From db878e27a98106a70315d264cc92230d84009e72 Mon Sep 17 00:00:00 2001 +From: Johannes Berg +Date: Thu, 8 Apr 2021 14:31:50 +0200 +Subject: [PATCH] mac80211: bail out if cipher schemes are invalid +Git-commit: db878e27a98106a70315d264cc92230d84009e72 +Patch-mainline: v5.13-rc1 +References: git-fixes + +If any of the cipher schemes specified by the driver are invalid, bail +out and fail the registration rather than just warning. Otherwise, we +might later crash when we try to use the invalid cipher scheme, e.g. +if the hdr_len is (significantly) less than the pn_offs + pn_len, we'd +have an out-of-bounds access in RX validation. + +Fixes: 2475b1cc0d52 ("mac80211: add generic cipher scheme support") +Link: https://lore.kernel.org/r/20210408143149.38a3a13a1b19.I6b7f5790fa0958ed8049cf02ac2a535c61e9bc96@changeid +Signed-off-by: Johannes Berg +Acked-by: Takashi Iwai + +--- + net/mac80211/main.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/net/mac80211/main.c b/net/mac80211/main.c +index 1b9c82616606..0331f3a3c40e 100644 +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -1141,8 +1141,11 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) + if (local->hw.wiphy->max_scan_ie_len) + local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len; + +- WARN_ON(!ieee80211_cs_list_valid(local->hw.cipher_schemes, +- local->hw.n_cipher_schemes)); ++ if (WARN_ON(!ieee80211_cs_list_valid(local->hw.cipher_schemes, ++ local->hw.n_cipher_schemes))) { ++ result = -EINVAL; ++ goto fail_workqueue; ++ } + + result = ieee80211_init_cipher_suites(local); + if (result < 0) +-- +2.26.2 + diff --git a/patches.suse/media-dvbdev-Fix-memory-leak-in-dvb_media_device_fre.patch b/patches.suse/media-dvbdev-Fix-memory-leak-in-dvb_media_device_fre.patch new file mode 100644 index 0000000..bc18cd5 --- /dev/null +++ b/patches.suse/media-dvbdev-Fix-memory-leak-in-dvb_media_device_fre.patch @@ -0,0 +1,42 @@ +From bf9a40ae8d722f281a2721779595d6df1c33a0bf Mon Sep 17 00:00:00 2001 +From: Peilin Ye +Date: Fri, 11 Dec 2020 09:30:39 +0100 +Subject: [PATCH] media: dvbdev: Fix memory leak in dvb_media_device_free() +Git-commit: bf9a40ae8d722f281a2721779595d6df1c33a0bf +Patch-mainline: v5.13-rc1 +References: git-fixes + +dvb_media_device_free() is leaking memory. Free `dvbdev->adapter->conn` +before setting it to NULL, as documented in include/media/media-device.h: +"The media_entity instance itself must be freed explicitly by the driver +if required." + +Link: https://syzkaller.appspot.com/bug?id=9bbe4b842c98f0ed05c5eed77a226e9de33bf298 + +Link: https://lore.kernel.org/linux-media/20201211083039.521617-1-yepeilin.cs@gmail.com +Cc: stable@vger.kernel.org +Fixes: 0230d60e4661 ("[media] dvbdev: Add RF connector if needed") +Reported-by: syzbot+7f09440acc069a0d38ac@syzkaller.appspotmail.com +Signed-off-by: Peilin Ye +Signed-off-by: Mauro Carvalho Chehab +Acked-by: Takashi Iwai + +--- + drivers/media/dvb-core/dvbdev.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c +index 5ff7bedee247..3862ddc86ec4 100644 +--- a/drivers/media/dvb-core/dvbdev.c ++++ b/drivers/media/dvb-core/dvbdev.c +@@ -241,6 +241,7 @@ static void dvb_media_device_free(struct dvb_device *dvbdev) + + if (dvbdev->adapter->conn) { + media_device_unregister_entity(dvbdev->adapter->conn); ++ kfree(dvbdev->adapter->conn); + dvbdev->adapter->conn = NULL; + kfree(dvbdev->adapter->conn_pads); + dvbdev->adapter->conn_pads = NULL; +-- +2.26.2 + diff --git a/patches.suse/media-m88rs6000t-avoid-potential-out-of-bounds-reads.patch b/patches.suse/media-m88rs6000t-avoid-potential-out-of-bounds-reads.patch new file mode 100644 index 0000000..37562b5 --- /dev/null +++ b/patches.suse/media-m88rs6000t-avoid-potential-out-of-bounds-reads.patch @@ -0,0 +1,56 @@ +From 9baa3d64e8e2373ddd11c346439e5dfccb2cbb0d Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Wed, 7 Oct 2020 14:16:28 +0200 +Subject: [PATCH] media: m88rs6000t: avoid potential out-of-bounds reads on arrays +Git-commit: 9baa3d64e8e2373ddd11c346439e5dfccb2cbb0d +Patch-mainline: v5.13-rc1 +References: git-fixes + +There a 3 array for-loops that don't check the upper bounds of the +index into arrays and this may lead to potential out-of-bounds +reads. Fix this by adding array size upper bounds checks to be +full safe. + +Addresses-coverity: ("Out-of-bounds read") + +Link: https://lore.kernel.org/linux-media/20201007121628.20676-1-colin.king@canonical.com +Fixes: 333829110f1d ("[media] m88rs6000t: add new dvb-s/s2 tuner for integrated chip M88RS6000") +Signed-off-by: Colin Ian King +Signed-off-by: Mauro Carvalho Chehab +Acked-by: Takashi Iwai + +--- + drivers/media/tuners/m88rs6000t.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/media/tuners/m88rs6000t.c b/drivers/media/tuners/m88rs6000t.c +index b3505f402476..8647c50b66e5 100644 +--- a/drivers/media/tuners/m88rs6000t.c ++++ b/drivers/media/tuners/m88rs6000t.c +@@ -525,7 +525,7 @@ static int m88rs6000t_get_rf_strength(struct dvb_frontend *fe, u16 *strength) + PGA2_cri = PGA2_GC >> 2; + PGA2_crf = PGA2_GC & 0x03; + +- for (i = 0; i <= RF_GC; i++) ++ for (i = 0; i <= RF_GC && i < ARRAY_SIZE(RFGS); i++) + RFG += RFGS[i]; + + if (RF_GC == 0) +@@ -537,12 +537,12 @@ static int m88rs6000t_get_rf_strength(struct dvb_frontend *fe, u16 *strength) + if (RF_GC == 3) + RFG += 100; + +- for (i = 0; i <= IF_GC; i++) ++ for (i = 0; i <= IF_GC && i < ARRAY_SIZE(IFGS); i++) + IFG += IFGS[i]; + + TIAG = TIA_GC * TIA_GS; + +- for (i = 0; i <= BB_GC; i++) ++ for (i = 0; i <= BB_GC && i < ARRAY_SIZE(BBGS); i++) + BBG += BBGS[i]; + + PGA2G = PGA2_cri * PGA2_cri_GS + PGA2_crf * PGA2_crf_GS; +-- +2.26.2 + diff --git a/patches.suse/media-mantis-remove-orphan-mantis_core.c.patch b/patches.suse/media-mantis-remove-orphan-mantis_core.c.patch new file mode 100644 index 0000000..0080c8f --- /dev/null +++ b/patches.suse/media-mantis-remove-orphan-mantis_core.c.patch @@ -0,0 +1,262 @@ +From 519648bed470441eac680314724ee4128f422a92 Mon Sep 17 00:00:00 2001 +From: Necip Fazil Yildiran +Date: Tue, 22 Sep 2020 15:22:22 +0200 +Subject: [PATCH] media: mantis: remove orphan mantis_core.c +Git-commit: 519648bed470441eac680314724ee4128f422a92 +Patch-mainline: v5.13-rc1 +References: git-fixes + +There is no Makefile rule to have drivers/media/pci/mantis/mantis_core.o +in build since the code overhaul with commit b3b961448f70 +("V4L/DVB (13795): [Mantis/Hopper] Code overhaul, add Hopper devices into the PCI ID list"). + +It looks like drivers/media/pci/mantis/mantis_core.c is a leftover. + +Remove the orphan code. + +Link: https://lore.kernel.org/linux-media/20200922132221.2051769-1-fazilyildiran@gmail.com +Fixes: b3b961448f70 ("V4L/DVB (13795): [Mantis/Hopper] Code overhaul, add Hopper devices into the PCI ID list"). +Signed-off-by: Necip Fazil Yildiran +Signed-off-by: Mauro Carvalho Chehab +Acked-by: Takashi Iwai + +--- + drivers/media/pci/mantis/mantis_ca.c | 1 - + drivers/media/pci/mantis/mantis_core.c | 200 ------------------------- + drivers/media/pci/mantis/mantis_core.h | 2 - + 3 files changed, 203 deletions(-) + delete mode 100644 drivers/media/pci/mantis/mantis_core.c + +diff --git a/drivers/media/pci/mantis/mantis_ca.c b/drivers/media/pci/mantis/mantis_ca.c +index f2baf5e5c921..0fad0a923e35 100644 +--- a/drivers/media/pci/mantis/mantis_ca.c ++++ b/drivers/media/pci/mantis/mantis_ca.c +@@ -109,7 +109,6 @@ static int mantis_ts_control(struct dvb_ca_en50221 *en50221, int slot) + struct mantis_pci *mantis = ca->ca_priv; + + dprintk(MANTIS_DEBUG, 1, "Slot(%d): TS control", slot); +-/* mantis_set_direction(mantis, 1); */ /* Enable TS through CAM */ + + return 0; + } +diff --git a/drivers/media/pci/mantis/mantis_core.c b/drivers/media/pci/mantis/mantis_core.c +deleted file mode 100644 +index f303f68d4ef2..000000000000 +--- a/drivers/media/pci/mantis/mantis_core.c ++++ /dev/null +@@ -1,200 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0-or-later +-/* +- Mantis PCI bridge driver +- +- Copyright (C) Manu Abraham (abraham.manu@gmail.com) +- +-*/ +- +-#include "mantis_common.h" +-#include "mantis_core.h" +-#include "mantis_vp1033.h" +-#include "mantis_vp1034.h" +-#include "mantis_vp1041.h" +-#include "mantis_vp2033.h" +-#include "mantis_vp2040.h" +-#include "mantis_vp3030.h" +- +-static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length) +-{ +- int err; +- struct i2c_msg msg[] = { +- { +- .addr = 0x50, +- .flags = 0, +- .buf = data, +- .len = 1 +- }, { +- .addr = 0x50, +- .flags = I2C_M_RD, +- .buf = data, +- .len = length +- }, +- }; +- +- err = i2c_transfer(&mantis->adapter, msg, 2); +- if (err < 0) { +- dprintk(verbose, MANTIS_ERROR, 1, +- "ERROR: i2c read: < err=%i d0=0x%02x d1=0x%02x >", +- err, data[0], data[1]); +- +- return err; +- } +- +- return 0; +-} +- +-static int get_mac_address(struct mantis_pci *mantis) +-{ +- int err; +- +- mantis->mac_address[0] = 0x08; +- err = read_eeprom_byte(mantis, &mantis->mac_address[0], 6); +- if (err < 0) { +- dprintk(verbose, MANTIS_ERROR, 1, "Mantis EEPROM read error"); +- +- return err; +- } +- dprintk(verbose, MANTIS_ERROR, 0, +- " MAC Address=[%pM]\n", mantis->mac_address); +- +- return 0; +-} +- +-#define MANTIS_MODEL_UNKNOWN "UNKNOWN" +-#define MANTIS_DEV_UNKNOWN "UNKNOWN" +- +-struct mantis_hwconfig unknown_device = { +- .model_name = MANTIS_MODEL_UNKNOWN, +- .dev_type = MANTIS_DEV_UNKNOWN, +-}; +- +-static void mantis_load_config(struct mantis_pci *mantis) +-{ +- switch (mantis->subsystem_device) { +- case MANTIS_VP_1033_DVB_S: /* VP-1033 */ +- mantis->hwconfig = &vp1033_mantis_config; +- break; +- case MANTIS_VP_1034_DVB_S: /* VP-1034 */ +- mantis->hwconfig = &vp1034_mantis_config; +- break; +- case MANTIS_VP_1041_DVB_S2: /* VP-1041 */ +- case TECHNISAT_SKYSTAR_HD2: +- mantis->hwconfig = &vp1041_mantis_config; +- break; +- case MANTIS_VP_2033_DVB_C: /* VP-2033 */ +- mantis->hwconfig = &vp2033_mantis_config; +- break; +- case MANTIS_VP_2040_DVB_C: /* VP-2040 */ +- case CINERGY_C: /* VP-2040 clone */ +- case TECHNISAT_CABLESTAR_HD2: +- mantis->hwconfig = &vp2040_mantis_config; +- break; +- case MANTIS_VP_3030_DVB_T: /* VP-3030 */ +- mantis->hwconfig = &vp3030_mantis_config; +- break; +- default: +- mantis->hwconfig = &unknown_device; +- break; +- } +-} +- +-int mantis_core_init(struct mantis_pci *mantis) +-{ +- int err = 0; +- +- mantis_load_config(mantis); +- dprintk(verbose, MANTIS_ERROR, 0, "found a %s PCI %s device on (%02x:%02x.%x),\n", +- mantis->hwconfig->model_name, mantis->hwconfig->dev_type, +- mantis->pdev->bus->number, PCI_SLOT(mantis->pdev->devfn), PCI_FUNC(mantis->pdev->devfn)); +- dprintk(verbose, MANTIS_ERROR, 0, " Mantis Rev %d [%04x:%04x], ", +- mantis->revision, +- mantis->subsystem_vendor, mantis->subsystem_device); +- dprintk(verbose, MANTIS_ERROR, 0, +- "irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p\n", +- mantis->pdev->irq, mantis->latency, +- mantis->mantis_addr, mantis->mantis_mmio); +- +- err = mantis_i2c_init(mantis); +- if (err < 0) { +- dprintk(verbose, MANTIS_ERROR, 1, "Mantis I2C init failed"); +- return err; +- } +- err = get_mac_address(mantis); +- if (err < 0) { +- dprintk(verbose, MANTIS_ERROR, 1, "get MAC address failed"); +- return err; +- } +- err = mantis_dma_init(mantis); +- if (err < 0) { +- dprintk(verbose, MANTIS_ERROR, 1, "Mantis DMA init failed"); +- return err; +- } +- err = mantis_dvb_init(mantis); +- if (err < 0) { +- dprintk(verbose, MANTIS_DEBUG, 1, "Mantis DVB init failed"); +- return err; +- } +- err = mantis_uart_init(mantis); +- if (err < 0) { +- dprintk(verbose, MANTIS_DEBUG, 1, "Mantis UART init failed"); +- return err; +- } +- +- return 0; +-} +- +-int mantis_core_exit(struct mantis_pci *mantis) +-{ +- mantis_dma_stop(mantis); +- dprintk(verbose, MANTIS_ERROR, 1, "DMA engine stopping"); +- +- mantis_uart_exit(mantis); +- dprintk(verbose, MANTIS_ERROR, 1, "UART exit failed"); +- +- if (mantis_dma_exit(mantis) < 0) +- dprintk(verbose, MANTIS_ERROR, 1, "DMA exit failed"); +- if (mantis_dvb_exit(mantis) < 0) +- dprintk(verbose, MANTIS_ERROR, 1, "DVB exit failed"); +- if (mantis_i2c_exit(mantis) < 0) +- dprintk(verbose, MANTIS_ERROR, 1, "I2C adapter delete.. failed"); +- +- return 0; +-} +- +-/* Turn the given bit on or off. */ +-void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value) +-{ +- u32 cur; +- +- cur = mmread(MANTIS_GPIF_ADDR); +- if (value) +- mantis->gpio_status = cur | (1 << bitpos); +- else +- mantis->gpio_status = cur & (~(1 << bitpos)); +- +- mmwrite(mantis->gpio_status, MANTIS_GPIF_ADDR); +- mmwrite(0x00, MANTIS_GPIF_DOUT); +- udelay(100); +-} +- +-/* direction = 0 , no CI passthrough ; 1 , CI passthrough */ +-void mantis_set_direction(struct mantis_pci *mantis, int direction) +-{ +- u32 reg; +- +- reg = mmread(0x28); +- dprintk(verbose, MANTIS_DEBUG, 1, "TS direction setup"); +- if (direction == 0x01) { +- /* to CI */ +- reg |= 0x04; +- mmwrite(reg, 0x28); +- reg &= 0xff - 0x04; +- mmwrite(reg, 0x28); +- } else { +- reg &= 0xff - 0x04; +- mmwrite(reg, 0x28); +- reg |= 0x04; +- mmwrite(reg, 0x28); +- } +-} +diff --git a/drivers/media/pci/mantis/mantis_core.h b/drivers/media/pci/mantis/mantis_core.h +index 1b0468ff791c..93c89a10a2c7 100644 +--- a/drivers/media/pci/mantis/mantis_core.h ++++ b/drivers/media/pci/mantis/mantis_core.h +@@ -39,7 +39,5 @@ extern void mantis_dma_start(struct mantis_pci *mantis); + extern void mantis_dma_stop(struct mantis_pci *mantis); + extern int mantis_i2c_init(struct mantis_pci *mantis); + extern int mantis_i2c_exit(struct mantis_pci *mantis); +-extern int mantis_core_init(struct mantis_pci *mantis); +-extern int mantis_core_exit(struct mantis_pci *mantis); + + #endif /* __MANTIS_CORE_H */ +-- +2.26.2 + diff --git a/patches.suse/media-omap4iss-return-error-code-when-omap4iss_get-f.patch b/patches.suse/media-omap4iss-return-error-code-when-omap4iss_get-f.patch new file mode 100644 index 0000000..49a24ca --- /dev/null +++ b/patches.suse/media-omap4iss-return-error-code-when-omap4iss_get-f.patch @@ -0,0 +1,40 @@ +From 8938c48fa25b491842ece9eb38f0bea0fcbaca44 Mon Sep 17 00:00:00 2001 +From: Yang Yingliang +Date: Tue, 17 Nov 2020 03:50:41 +0100 +Subject: [PATCH] media: omap4iss: return error code when omap4iss_get() failed +Git-commit: 8938c48fa25b491842ece9eb38f0bea0fcbaca44 +Patch-mainline: v5.13-rc1 +References: git-fixes + +If omap4iss_get() failed, it need return error code in iss_probe(). + +Fixes: 59f0ad807681 ("[media] v4l: omap4iss: Add support for OMAP4...") +Reported-by: Hulk Robot +Signed-off-by: Yang Yingliang +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Acked-by: Takashi Iwai + +--- + drivers/staging/media/omap4iss/iss.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c +index dae9073e7d3c..085397045b36 100644 +--- a/drivers/staging/media/omap4iss/iss.c ++++ b/drivers/staging/media/omap4iss/iss.c +@@ -1236,8 +1236,10 @@ static int iss_probe(struct platform_device *pdev) + if (ret < 0) + goto error; + +- if (!omap4iss_get(iss)) ++ if (!omap4iss_get(iss)) { ++ ret = -EINVAL; + goto error; ++ } + + ret = iss_reset(iss); + if (ret < 0) +-- +2.26.2 + diff --git a/patches.suse/media-platform-sunxi-sun6i-csi-fix-error-return-code.patch b/patches.suse/media-platform-sunxi-sun6i-csi-fix-error-return-code.patch new file mode 100644 index 0000000..e9320bb --- /dev/null +++ b/patches.suse/media-platform-sunxi-sun6i-csi-fix-error-return-code.patch @@ -0,0 +1,43 @@ +From f3d384e36630e2a552d874e422835606d9cf230a Mon Sep 17 00:00:00 2001 +From: Jia-Ju Bai +Date: Sat, 6 Mar 2021 15:15:28 +0100 +Subject: [PATCH] media: platform: sunxi: sun6i-csi: fix error return code of sun6i_video_start_streaming() +Git-commit: f3d384e36630e2a552d874e422835606d9cf230a +Patch-mainline: v5.13-rc1 +References: git-fixes + +When sun6i_video_remote_subdev() returns NULL to subdev, no error return +code of sun6i_video_start_streaming() is assigned. +To fix this bug, ret is assigned with -EINVAL in this case. + +Reported-by: TOTE Robot +Signed-off-by: Jia-Ju Bai +Fixes: 5cc7522d8965 ("media: sun6i: Add support for Allwinner CSI V3s") +Acked-by: Chen-Yu Tsai +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Acked-by: Takashi Iwai + +--- + drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c +index b55de9ab64d8..3181d0781b61 100644 +--- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c ++++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c +@@ -151,8 +151,10 @@ static int sun6i_video_start_streaming(struct vb2_queue *vq, unsigned int count) + } + + subdev = sun6i_video_remote_subdev(video, NULL); +- if (!subdev) ++ if (!subdev) { ++ ret = -EINVAL; + goto stop_media_pipeline; ++ } + + config.pixelformat = video->fmt.fmt.pix.pixelformat; + config.code = video->mbus_code; +-- +2.26.2 + diff --git a/patches.suse/media-staging-intel-ipu3-Fix-memory-leak-in-imu_fmt.patch b/patches.suse/media-staging-intel-ipu3-Fix-memory-leak-in-imu_fmt.patch new file mode 100644 index 0000000..e1dd2ef --- /dev/null +++ b/patches.suse/media-staging-intel-ipu3-Fix-memory-leak-in-imu_fmt.patch @@ -0,0 +1,54 @@ +From 3630901933afba1d16c462b04d569b7576339223 Mon Sep 17 00:00:00 2001 +From: Ricardo Ribalda +Date: Mon, 15 Mar 2021 13:34:05 +0100 +Subject: [PATCH] media: staging/intel-ipu3: Fix memory leak in imu_fmt +Git-commit: 3630901933afba1d16c462b04d569b7576339223 +Patch-mainline: v5.13-rc1 +References: git-fixes + +We are losing the reference to an allocated memory if try. Change the +order of the check to avoid that. + +Cc: stable@vger.kernel.org +Fixes: 6d5f26f2e045 ("media: staging/intel-ipu3-v4l: reduce kernel stack usage") +Signed-off-by: Ricardo Ribalda +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Acked-by: Takashi Iwai + +--- + drivers/staging/media/ipu3/ipu3-v4l2.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c +index e8944e489c56..9e8980b34547 100644 +--- a/drivers/staging/media/ipu3/ipu3-v4l2.c ++++ b/drivers/staging/media/ipu3/ipu3-v4l2.c +@@ -694,6 +694,13 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, + if (inode == IMGU_NODE_STAT_3A || inode == IMGU_NODE_PARAMS) + continue; + ++ /* CSS expects some format on OUT queue */ ++ if (i != IPU3_CSS_QUEUE_OUT && ++ !imgu_pipe->nodes[inode].enabled) { ++ fmts[i] = NULL; ++ continue; ++ } ++ + if (try) { + fmts[i] = kmemdup(&imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp, + sizeof(struct v4l2_pix_format_mplane), +@@ -706,10 +713,6 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, + fmts[i] = &imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp; + } + +- /* CSS expects some format on OUT queue */ +- if (i != IPU3_CSS_QUEUE_OUT && +- !imgu_pipe->nodes[inode].enabled) +- fmts[i] = NULL; + } + + if (!try) { +-- +2.26.2 + diff --git a/patches.suse/media-staging-intel-ipu3-Fix-race-condition-during-s.patch b/patches.suse/media-staging-intel-ipu3-Fix-race-condition-during-s.patch new file mode 100644 index 0000000..1967e1a --- /dev/null +++ b/patches.suse/media-staging-intel-ipu3-Fix-race-condition-during-s.patch @@ -0,0 +1,110 @@ +From dccfe2548746ca9cca3a20401ece4cf255d1f171 Mon Sep 17 00:00:00 2001 +From: Ricardo Ribalda +Date: Fri, 9 Apr 2021 10:41:35 +0200 +Subject: [PATCH] media: staging/intel-ipu3: Fix race condition during set_fmt +Git-commit: dccfe2548746ca9cca3a20401ece4cf255d1f171 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Do not modify imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp, until the +format has been correctly validated. + +Otherwise, even if we use a backup variable, there is a period of time +where imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp might have an invalid +value that can be used by other functions. + +Cc: stable@vger.kernel.org +Fixes: ad91849996f9 ("media: staging/intel-ipu3: Fix set_fmt error handling") +Reviewed-by: Tomasz Figa +Signed-off-by: Ricardo Ribalda +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Acked-by: Takashi Iwai + +--- + drivers/staging/media/ipu3/ipu3-v4l2.c | 30 ++++++++++++-------------- + 1 file changed, 14 insertions(+), 16 deletions(-) + +diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c +index 9e8980b34547..6d9c49b39531 100644 +--- a/drivers/staging/media/ipu3/ipu3-v4l2.c ++++ b/drivers/staging/media/ipu3/ipu3-v4l2.c +@@ -669,7 +669,6 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, + struct imgu_css_pipe *css_pipe = &imgu->css.pipes[pipe]; + struct imgu_media_pipe *imgu_pipe = &imgu->imgu_pipe[pipe]; + struct imgu_v4l2_subdev *imgu_sd = &imgu_pipe->imgu_sd; +- struct v4l2_pix_format_mplane fmt_backup; + + dev_dbg(dev, "set fmt node [%u][%u](try = %u)", pipe, node, try); + +@@ -687,6 +686,7 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, + + dev_dbg(dev, "IPU3 pipe %u pipe_id = %u", pipe, css_pipe->pipe_id); + ++ css_q = imgu_node_to_queue(node); + for (i = 0; i < IPU3_CSS_QUEUES; i++) { + unsigned int inode = imgu_map_node(imgu, i); + +@@ -701,6 +701,11 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, + continue; + } + ++ if (i == css_q) { ++ fmts[i] = &f->fmt.pix_mp; ++ continue; ++ } ++ + if (try) { + fmts[i] = kmemdup(&imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp, + sizeof(struct v4l2_pix_format_mplane), +@@ -729,39 +734,32 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, + rects[IPU3_CSS_RECT_GDC]->height = pad_fmt.height; + } + +- /* +- * imgu doesn't set the node to the value given by user +- * before we return success from this function, so set it here. +- */ +- css_q = imgu_node_to_queue(node); + if (!fmts[css_q]) { + ret = -EINVAL; + goto out; + } +- fmt_backup = *fmts[css_q]; +- *fmts[css_q] = f->fmt.pix_mp; + + if (try) + ret = imgu_css_fmt_try(&imgu->css, fmts, rects, pipe); + else + ret = imgu_css_fmt_set(&imgu->css, fmts, rects, pipe); + +- if (try || ret < 0) +- *fmts[css_q] = fmt_backup; +- + /* ret is the binary number in the firmware blob */ + if (ret < 0) + goto out; + +- if (try) +- f->fmt.pix_mp = *fmts[css_q]; +- else +- f->fmt = imgu_pipe->nodes[node].vdev_fmt.fmt; ++ /* ++ * imgu doesn't set the node to the value given by user ++ * before we return success from this function, so set it here. ++ */ ++ if (!try) ++ imgu_pipe->nodes[node].vdev_fmt.fmt.pix_mp = f->fmt.pix_mp; + + out: + if (try) { + for (i = 0; i < IPU3_CSS_QUEUES; i++) +- kfree(fmts[i]); ++ if (i != css_q) ++ kfree(fmts[i]); + } + + return ret; +-- +2.26.2 + diff --git a/patches.suse/media-staging-intel-ipu3-Fix-set_fmt-error-handling.patch b/patches.suse/media-staging-intel-ipu3-Fix-set_fmt-error-handling.patch new file mode 100644 index 0000000..3887c89 --- /dev/null +++ b/patches.suse/media-staging-intel-ipu3-Fix-set_fmt-error-handling.patch @@ -0,0 +1,62 @@ +From ad91849996f9dd79741a961fd03585a683b08356 Mon Sep 17 00:00:00 2001 +From: Ricardo Ribalda +Date: Wed, 10 Mar 2021 01:16:46 +0100 +Subject: [PATCH] media: staging/intel-ipu3: Fix set_fmt error handling +Git-commit: ad91849996f9dd79741a961fd03585a683b08356 +Patch-mainline: v5.13-rc1 +References: git-fixes + +If there in an error during a set_fmt, do not overwrite the previous +sizes with the invalid config. + +Without this patch, v4l2-compliance ends up allocating 4GiB of RAM and +causing the following OOPs + +[ 38.662975] ipu3-imgu 0000:00:05.0: swiotlb buffer is full (sz: 4096 bytes) +[ 38.662980] DMA: Out of SW-IOMMU space for 4096 bytes at device 0000:00:05.0 +[ 38.663010] general protection fault: 0000 [#1] PREEMPT SMP + +Cc: stable@vger.kernel.org +Fixes: 6d5f26f2e045 ("media: staging/intel-ipu3-v4l: reduce kernel stack usage") +Signed-off-by: Ricardo Ribalda +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Acked-by: Takashi Iwai + +--- + drivers/staging/media/ipu3/ipu3-v4l2.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c +index 60aa02eb7d2a..e8944e489c56 100644 +--- a/drivers/staging/media/ipu3/ipu3-v4l2.c ++++ b/drivers/staging/media/ipu3/ipu3-v4l2.c +@@ -669,6 +669,7 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, + struct imgu_css_pipe *css_pipe = &imgu->css.pipes[pipe]; + struct imgu_media_pipe *imgu_pipe = &imgu->imgu_pipe[pipe]; + struct imgu_v4l2_subdev *imgu_sd = &imgu_pipe->imgu_sd; ++ struct v4l2_pix_format_mplane fmt_backup; + + dev_dbg(dev, "set fmt node [%u][%u](try = %u)", pipe, node, try); + +@@ -734,6 +735,7 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, + ret = -EINVAL; + goto out; + } ++ fmt_backup = *fmts[css_q]; + *fmts[css_q] = f->fmt.pix_mp; + + if (try) +@@ -741,6 +743,9 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, + else + ret = imgu_css_fmt_set(&imgu->css, fmts, rects, pipe); + ++ if (try || ret < 0) ++ *fmts[css_q] = fmt_backup; ++ + /* ret is the binary number in the firmware blob */ + if (ret < 0) + goto out; +-- +2.26.2 + diff --git a/patches.suse/media-v4l2-ctrls.c-fix-race-condition-in-hdl-request.patch b/patches.suse/media-v4l2-ctrls.c-fix-race-condition-in-hdl-request.patch new file mode 100644 index 0000000..a3434d7 --- /dev/null +++ b/patches.suse/media-v4l2-ctrls.c-fix-race-condition-in-hdl-request.patch @@ -0,0 +1,113 @@ +From be7e8af98f3af729aa9f08b1053f9533a5cceb91 Mon Sep 17 00:00:00 2001 +From: Hans Verkuil +Date: Sat, 27 Mar 2021 12:27:40 +0100 +Subject: [PATCH] media: v4l2-ctrls.c: fix race condition in hdl->requests list +Git-commit: be7e8af98f3af729aa9f08b1053f9533a5cceb91 +Patch-mainline: v5.13-rc1 +References: git-fixes + +When a request is re-inited it will release all control handler +objects that are still in the request. It does that by unbinding +and putting all those objects. When the object is unbound the +obj->req pointer is set to NULL, and the object's unbind op is +called. When the object it put the object's release op is called +to free the memory. + +For a request object that contains a control handler that means +that v4l2_ctrl_handler_free() is called in the release op. + +A control handler used in a request has a pointer to the main +control handler that is created by the driver and contains the +current state of all controls. If the device is unbound (due to +rmmod or a forced unbind), then that main handler is freed, again +by calling v4l2_ctrl_handler_free(), and any outstanding request +objects that refer to that main handler have to be unbound and put +as well. + +It does that by this test: + + if (!hdl->req_obj.req && !list_empty(&hdl->requests)) { + +I.e. the handler has no pointer to a request, so is the main +handler, and one or more request objects refer to this main +handler. + +However, this test is wrong since hdl->req_obj.req is actually +NULL when re-initing a request (the object unbind will set req to +NULL), and the only reason this seemingly worked is that the +requests list is typically empty since the request's unbind op +will remove the handler from the requests list. + +But if another thread is at the same time adding a new control +to a request, then there is a race condition where one thread +is removing a control handler object from the requests list and +another thread is adding one. The result is that hdl->requests +is no longer empty and the code thinks that a main handler is +being freed instead of a control handler that is part of a request. + +There are two bugs here: first the test for hdl->req_obj.req: this +should be hdl->req_obj.ops since only the main control handler will +have a NULL pointer there. + +The second is that adding or deleting request objects from the +requests list of the main handler isn't protected by taking the +main handler's lock. + +Signed-off-by: Hans Verkuil +Reported-by: John Cox +Fixes: 6fa6f831f095 ("media: v4l2-ctrls: add core request support") +Tested-by: John Cox +Signed-off-by: Mauro Carvalho Chehab +Acked-by: Takashi Iwai + +--- + drivers/media/v4l2-core/v4l2-ctrls.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c +index e7fcbaeec0ae..c7bcc5c25771 100644 +--- a/drivers/media/v4l2-core/v4l2-ctrls.c ++++ b/drivers/media/v4l2-core/v4l2-ctrls.c +@@ -2650,7 +2650,15 @@ void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl) + if (hdl == NULL || hdl->buckets == NULL) + return; + +- if (!hdl->req_obj.req && !list_empty(&hdl->requests)) { ++ /* ++ * If the main handler is freed and it is used by handler objects in ++ * outstanding requests, then unbind and put those objects before ++ * freeing the main handler. ++ * ++ * The main handler can be identified by having a NULL ops pointer in ++ * the request object. ++ */ ++ if (!hdl->req_obj.ops && !list_empty(&hdl->requests)) { + struct v4l2_ctrl_handler *req, *next_req; + + list_for_each_entry_safe(req, next_req, &hdl->requests, requests) { +@@ -3730,8 +3738,8 @@ static void v4l2_ctrl_request_unbind(struct media_request_object *obj) + container_of(obj, struct v4l2_ctrl_handler, req_obj); + struct v4l2_ctrl_handler *main_hdl = obj->priv; + +- list_del_init(&hdl->requests); + mutex_lock(main_hdl->lock); ++ list_del_init(&hdl->requests); + if (hdl->request_is_queued) { + list_del_init(&hdl->requests_queued); + hdl->request_is_queued = false; +@@ -3790,8 +3798,11 @@ static int v4l2_ctrl_request_bind(struct media_request *req, + if (!ret) { + ret = media_request_object_bind(req, &req_ops, + from, false, &hdl->req_obj); +- if (!ret) ++ if (!ret) { ++ mutex_lock(from->lock); + list_add_tail(&hdl->requests, &from->requests); ++ mutex_unlock(from->lock); ++ } + } + return ret; + } +-- +2.26.2 + diff --git a/patches.suse/memory-gpmc-fix-out-of-bounds-read-and-dereference-o.patch b/patches.suse/memory-gpmc-fix-out-of-bounds-read-and-dereference-o.patch new file mode 100644 index 0000000..b780027 --- /dev/null +++ b/patches.suse/memory-gpmc-fix-out-of-bounds-read-and-dereference-o.patch @@ -0,0 +1,53 @@ +From e004c3e67b6459c99285b18366a71af467d869f5 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Tue, 23 Feb 2021 19:38:21 +0000 +Subject: [PATCH] memory: gpmc: fix out of bounds read and dereference on gpmc_cs[] +Git-commit: e004c3e67b6459c99285b18366a71af467d869f5 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Currently the array gpmc_cs is indexed by cs before it cs is range checked +and the pointer read from this out-of-index read is dereferenced. Fix this +by performing the range check on cs before the read and the following +pointer dereference. + +Addresses-coverity: ("Negative array index read") +Fixes: 9ed7a776eb50 ("ARM: OMAP2+: Fix support for multiple devices on a GPMC chip select") +Signed-off-by: Colin Ian King +Reviewed-by: Tony Lindgren +Link: https://lore.kernel.org/r/20210223193821.17232-1-colin.king@canonical.com +Signed-off-by: Krzysztof Kozlowski +Acked-by: Takashi Iwai + +--- + drivers/memory/omap-gpmc.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c +index cfa730cfd145..f80c2ea39ca4 100644 +--- a/drivers/memory/omap-gpmc.c ++++ b/drivers/memory/omap-gpmc.c +@@ -1009,8 +1009,8 @@ EXPORT_SYMBOL(gpmc_cs_request); + + void gpmc_cs_free(int cs) + { +- struct gpmc_cs_data *gpmc = &gpmc_cs[cs]; +- struct resource *res = &gpmc->mem; ++ struct gpmc_cs_data *gpmc; ++ struct resource *res; + + spin_lock(&gpmc_mem_lock); + if (cs >= gpmc_cs_num || cs < 0 || !gpmc_cs_reserved(cs)) { +@@ -1018,6 +1018,9 @@ void gpmc_cs_free(int cs) + spin_unlock(&gpmc_mem_lock); + return; + } ++ gpmc = &gpmc_cs[cs]; ++ res = &gpmc->mem; ++ + gpmc_cs_disable_mem(cs); + if (res->flags) + release_resource(res); +-- +2.26.2 + diff --git a/patches.suse/memory-pl353-fix-mask-of-ECC-page_size-config-regist.patch b/patches.suse/memory-pl353-fix-mask-of-ECC-page_size-config-regist.patch new file mode 100644 index 0000000..6a2f5c5 --- /dev/null +++ b/patches.suse/memory-pl353-fix-mask-of-ECC-page_size-config-regist.patch @@ -0,0 +1,37 @@ +From 25dcca7fedcd4e31cb368ad846bfd738c0c6307c Mon Sep 17 00:00:00 2001 +From: gexueyuan +Date: Wed, 31 Mar 2021 11:10:56 +0800 +Subject: [PATCH] memory: pl353: fix mask of ECC page_size config register +Git-commit: 25dcca7fedcd4e31cb368ad846bfd738c0c6307c +Patch-mainline: v5.13-rc1 +References: git-fixes + +The mask for page size of ECC Configuration Register should be 0x3, +according to the datasheet of PL353 smc. + +Fixes: fee10bd22678 ("memory: pl353: Add driver for arm pl353 static memory controller") +Signed-off-by: gexueyuan +Link: https://lore.kernel.org/r/20210331031056.5326-1-gexueyuan@gmail.com +Signed-off-by: Krzysztof Kozlowski +Acked-by: Takashi Iwai + +--- + drivers/memory/pl353-smc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/memory/pl353-smc.c b/drivers/memory/pl353-smc.c +index 3b5b1045edd9..9c0a28416777 100644 +--- a/drivers/memory/pl353-smc.c ++++ b/drivers/memory/pl353-smc.c +@@ -63,7 +63,7 @@ + /* ECC memory config register specific constants */ + #define PL353_SMC_ECC_MEMCFG_MODE_MASK 0xC + #define PL353_SMC_ECC_MEMCFG_MODE_SHIFT 2 +-#define PL353_SMC_ECC_MEMCFG_PGSIZE_MASK 0xC ++#define PL353_SMC_ECC_MEMCFG_PGSIZE_MASK 0x3 + + #define PL353_SMC_DC_UPT_NAND_REGS ((4 << 23) | /* CS: NAND chip */ \ + (2 << 21)) /* UpdateRegs operation */ +-- +2.26.2 + diff --git a/patches.suse/mfd-lpc_sch-Partially-revert-Add-support-for-Intel-Q.patch b/patches.suse/mfd-lpc_sch-Partially-revert-Add-support-for-Intel-Q.patch new file mode 100644 index 0000000..e753a6b --- /dev/null +++ b/patches.suse/mfd-lpc_sch-Partially-revert-Add-support-for-Intel-Q.patch @@ -0,0 +1,135 @@ +From 922e8ce883e59b52786b2c11656d84dc58ef084a Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Wed, 3 Mar 2021 18:49:44 +0200 +Subject: [PATCH] mfd: lpc_sch: Partially revert "Add support for Intel Quark X1000" +Git-commit: 922e8ce883e59b52786b2c11656d84dc58ef084a +Patch-mainline: v5.13-rc1 +References: git-fixes + +The IRQ support for SCH GPIO is not specific to the Intel Quark SoC. +Moreover the IRQ routing is quite interesting there, so while it's +needs a special support, the driver haven't it anyway yet. + +Due to above remove basically redundant code of IRQ support. + +This reverts commit ec689a8a8155ce8b966bd5d7737a3916f5e48be3. + +Signed-off-by: Andy Shevchenko +Signed-off-by: Lee Jones +Acked-by: Takashi Iwai + +--- + drivers/mfd/lpc_sch.c | 32 ++++++-------------------------- + 1 file changed, 6 insertions(+), 26 deletions(-) + +diff --git a/drivers/mfd/lpc_sch.c b/drivers/mfd/lpc_sch.c +index f27eb8dabc1c..428a526cbe86 100644 +--- a/drivers/mfd/lpc_sch.c ++++ b/drivers/mfd/lpc_sch.c +@@ -26,9 +26,6 @@ + #define GPIO_IO_SIZE 64 + #define GPIO_IO_SIZE_CENTERTON 128 + +-/* Intel Quark X1000 GPIO IRQ Number */ +-#define GPIO_IRQ_QUARK_X1000 9 +- + #define WDTBASE 0x84 + #define WDT_IO_SIZE 64 + +@@ -43,30 +40,25 @@ struct lpc_sch_info { + unsigned int io_size_smbus; + unsigned int io_size_gpio; + unsigned int io_size_wdt; +- int irq_gpio; + }; + + static struct lpc_sch_info sch_chipset_info[] = { + [LPC_SCH] = { + .io_size_smbus = SMBUS_IO_SIZE, + .io_size_gpio = GPIO_IO_SIZE, +- .irq_gpio = -1, + }, + [LPC_ITC] = { + .io_size_smbus = SMBUS_IO_SIZE, + .io_size_gpio = GPIO_IO_SIZE, + .io_size_wdt = WDT_IO_SIZE, +- .irq_gpio = -1, + }, + [LPC_CENTERTON] = { + .io_size_smbus = SMBUS_IO_SIZE, + .io_size_gpio = GPIO_IO_SIZE_CENTERTON, + .io_size_wdt = WDT_IO_SIZE, +- .irq_gpio = -1, + }, + [LPC_QUARK_X1000] = { + .io_size_gpio = GPIO_IO_SIZE, +- .irq_gpio = GPIO_IRQ_QUARK_X1000, + .io_size_wdt = WDT_IO_SIZE, + }, + }; +@@ -113,13 +105,13 @@ static int lpc_sch_get_io(struct pci_dev *pdev, int where, const char *name, + } + + static int lpc_sch_populate_cell(struct pci_dev *pdev, int where, +- const char *name, int size, int irq, +- int id, struct mfd_cell *cell) ++ const char *name, int size, int id, ++ struct mfd_cell *cell) + { + struct resource *res; + int ret; + +- res = devm_kcalloc(&pdev->dev, 2, sizeof(*res), GFP_KERNEL); ++ res = devm_kzalloc(&pdev->dev, sizeof(*res), GFP_KERNEL); + if (!res) + return -ENOMEM; + +@@ -135,18 +127,6 @@ static int lpc_sch_populate_cell(struct pci_dev *pdev, int where, + cell->ignore_resource_conflicts = true; + cell->id = id; + +- /* Check if we need to add an IRQ resource */ +- if (irq < 0) +- return 0; +- +- res++; +- +- res->start = irq; +- res->end = irq; +- res->flags = IORESOURCE_IRQ; +- +- cell->num_resources++; +- + return 0; + } + +@@ -158,7 +138,7 @@ static int lpc_sch_probe(struct pci_dev *dev, const struct pci_device_id *id) + int ret; + + ret = lpc_sch_populate_cell(dev, SMBASE, "isch_smbus", +- info->io_size_smbus, -1, ++ info->io_size_smbus, + id->device, &lpc_sch_cells[cells]); + if (ret < 0) + return ret; +@@ -166,7 +146,7 @@ static int lpc_sch_probe(struct pci_dev *dev, const struct pci_device_id *id) + cells++; + + ret = lpc_sch_populate_cell(dev, GPIOBASE, "sch_gpio", +- info->io_size_gpio, info->irq_gpio, ++ info->io_size_gpio, + id->device, &lpc_sch_cells[cells]); + if (ret < 0) + return ret; +@@ -174,7 +154,7 @@ static int lpc_sch_probe(struct pci_dev *dev, const struct pci_device_id *id) + cells++; + + ret = lpc_sch_populate_cell(dev, WDTBASE, "ie6xx_wdt", +- info->io_size_wdt, -1, ++ info->io_size_wdt, + id->device, &lpc_sch_cells[cells]); + if (ret < 0) + return ret; +-- +2.26.2 + diff --git a/patches.suse/mfd-stm32-timers-Avoid-clearing-auto-reload-register.patch b/patches.suse/mfd-stm32-timers-Avoid-clearing-auto-reload-register.patch new file mode 100644 index 0000000..74aeced --- /dev/null +++ b/patches.suse/mfd-stm32-timers-Avoid-clearing-auto-reload-register.patch @@ -0,0 +1,53 @@ +From 4917e498c6894ba077867aff78f82cffd5ffbb5c Mon Sep 17 00:00:00 2001 +From: Fabrice Gasnier +Date: Wed, 3 Mar 2021 18:51:35 +0100 +Subject: [PATCH] mfd: stm32-timers: Avoid clearing auto reload register +Git-commit: 4917e498c6894ba077867aff78f82cffd5ffbb5c +Patch-mainline: v5.13-rc1 +References: git-fixes + +The ARR register is cleared unconditionally upon probing, after the maximum +value has been read. This initial condition is rather not intuitive, when +considering the counter child driver. It rather expects the maximum value +by default: +- The counter interface shows a zero value by default for 'ceiling' + attribute. +- Enabling the counter without any prior configuration makes it doesn't + count. + +The reset value of ARR register is the maximum. So Choice here +is to backup it, and restore it then, instead of clearing its value. +It also fixes the initial condition seen by the counter driver. + +Fixes: d0f949e220fd ("mfd: Add STM32 Timers driver") +Signed-off-by: Fabrice Gasnier +Acked-by: William Breathitt Gray +Signed-off-by: Lee Jones +Acked-by: Takashi Iwai + +--- + drivers/mfd/stm32-timers.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/mfd/stm32-timers.c ++++ b/drivers/mfd/stm32-timers.c +@@ -158,13 +158,18 @@ static const struct regmap_config stm32_ + + static void stm32_timers_get_arr_size(struct stm32_timers *ddata) + { ++ u32 arr; ++ ++ /* Backup ARR to restore it after getting the maximum value */ ++ regmap_read(ddata->regmap, TIM_ARR, &arr); ++ + /* + * Only the available bits will be written so when readback + * we get the maximum value of auto reload register + */ + regmap_write(ddata->regmap, TIM_ARR, ~0L); + regmap_read(ddata->regmap, TIM_ARR, &ddata->max_arr); +- regmap_write(ddata->regmap, TIM_ARR, 0x0); ++ regmap_write(ddata->regmap, TIM_ARR, arr); + } + + static void stm32_timers_dma_probe(struct device *dev, diff --git a/patches.suse/misc-lis3lv02d-Fix-false-positive-WARN-on-various-HP.patch b/patches.suse/misc-lis3lv02d-Fix-false-positive-WARN-on-various-HP.patch new file mode 100644 index 0000000..f56204f --- /dev/null +++ b/patches.suse/misc-lis3lv02d-Fix-false-positive-WARN-on-various-HP.patch @@ -0,0 +1,106 @@ +From 3641762c1c9c7cfd84a7061a0a73054f09b412e3 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 17 Feb 2021 11:24:59 +0100 +Subject: [PATCH] misc: lis3lv02d: Fix false-positive WARN on various HP models +Git-commit: 3641762c1c9c7cfd84a7061a0a73054f09b412e3 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Before this commit lis3lv02d_get_pwron_wait() had a WARN_ONCE() to catch +a potential divide by 0. WARN macros should only be used to catch internal +kernel bugs and that is not the case here. We have been receiving a lot of +bug reports about kernel backtraces caused by this WARN. + +The div value being checked comes from the lis3->odrs[] array. Which +is sized to be a power-of-2 matching the number of bits in lis3->odr_mask. + +The only lis3 model where this array is not entirely filled with non zero +values. IOW the only model where we can hit the div == 0 check is the +3dc ("8 bits 3DC sensor") model: + +int lis3_3dc_rates[16] = {0, 1, 10, 25, 50, 100, 200, 400, 1600, 5000}; + +Note the 0 value at index 0, according to the datasheet an odr index of 0 +means "Power-down mode". HP typically uses a lis3 accelerometer for HDD +fall protection. What I believe is happening here is that on newer +HP devices, which only contain a SDD, the BIOS is leaving the lis3 device +powered-down since it is not used for HDD fall protection. + +Note that the lis3_3dc_rates array initializer only specifies 10 values, +which matches the datasheet. So it also contains 6 zero values at the end. + +Replace the WARN with a normal check, which treats an odr index of 0 +as power-down and uses a normal dev_err() to report the error in case +odr index point past the initialized part of the array. + +Fixes: 1510dd5954be ("lis3lv02d: avoid divide by zero due to unchecked") +Cc: stable@vger.kernel.org +Signed-off-by: Hans de Goede +Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=785814 +Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1817027 +Buglink: https://bugs.centos.org/view.php?id=10720 +Link: https://lore.kernel.org/r/20210217102501.31758-1-hdegoede@redhat.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/misc/lis3lv02d/lis3lv02d.c | 21 ++++++++++++++++----- + 1 file changed, 16 insertions(+), 5 deletions(-) + +diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c +index dd65cedf3b12..9d14bf444481 100644 +--- a/drivers/misc/lis3lv02d/lis3lv02d.c ++++ b/drivers/misc/lis3lv02d/lis3lv02d.c +@@ -208,7 +208,7 @@ static int lis3_3dc_rates[16] = {0, 1, 10, 25, 50, 100, 200, 400, 1600, 5000}; + static int lis3_3dlh_rates[4] = {50, 100, 400, 1000}; + + /* ODR is Output Data Rate */ +-static int lis3lv02d_get_odr(struct lis3lv02d *lis3) ++static int lis3lv02d_get_odr_index(struct lis3lv02d *lis3) + { + u8 ctrl; + int shift; +@@ -216,15 +216,23 @@ static int lis3lv02d_get_odr(struct lis3lv02d *lis3) + lis3->read(lis3, CTRL_REG1, &ctrl); + ctrl &= lis3->odr_mask; + shift = ffs(lis3->odr_mask) - 1; +- return lis3->odrs[(ctrl >> shift)]; ++ return (ctrl >> shift); + } + + static int lis3lv02d_get_pwron_wait(struct lis3lv02d *lis3) + { +- int div = lis3lv02d_get_odr(lis3); ++ int odr_idx = lis3lv02d_get_odr_index(lis3); ++ int div = lis3->odrs[odr_idx]; + +- if (WARN_ONCE(div == 0, "device returned spurious data")) ++ if (div == 0) { ++ if (odr_idx == 0) { ++ /* Power-down mode, not sampling no need to sleep */ ++ return 0; ++ } ++ ++ dev_err(&lis3->pdev->dev, "Error unknown odrs-index: %d\n", odr_idx); + return -ENXIO; ++ } + + /* LIS3 power on delay is quite long */ + msleep(lis3->pwron_delay / div); +@@ -816,9 +824,12 @@ static ssize_t lis3lv02d_rate_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct lis3lv02d *lis3 = dev_get_drvdata(dev); ++ int odr_idx; + + lis3lv02d_sysfs_poweron(lis3); +- return sprintf(buf, "%d\n", lis3lv02d_get_odr(lis3)); ++ ++ odr_idx = lis3lv02d_get_odr_index(lis3); ++ return sprintf(buf, "%d\n", lis3->odrs[odr_idx]); + } + + static ssize_t lis3lv02d_rate_set(struct device *dev, +-- +2.26.2 + diff --git a/patches.suse/misc-vmw_vmci-explicitly-initialize-vmci_datagram-pa.patch b/patches.suse/misc-vmw_vmci-explicitly-initialize-vmci_datagram-pa.patch new file mode 100644 index 0000000..959426a --- /dev/null +++ b/patches.suse/misc-vmw_vmci-explicitly-initialize-vmci_datagram-pa.patch @@ -0,0 +1,98 @@ +From b2192cfeba8481224da0a4ec3b4a7ccd80b1623b Mon Sep 17 00:00:00 2001 +From: Tetsuo Handa +Date: Fri, 2 Apr 2021 21:17:42 +0900 +Subject: [PATCH] misc: vmw_vmci: explicitly initialize vmci_datagram payload +Git-commit: b2192cfeba8481224da0a4ec3b4a7ccd80b1623b +Patch-mainline: v5.13-rc1 +References: git-fixes + +KMSAN complains that vmci_check_host_caps() left the payload part of +check_msg uninitialized. + + ===================================================== + BUG: KMSAN: uninit-value in kmsan_check_memory+0xd/0x10 + CPU: 1 PID: 1 Comm: swapper/0 Tainted: G B 5.11.0-rc7+ #4 + Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 02/27/2020 + Call Trace: + dump_stack+0x21c/0x280 + kmsan_report+0xfb/0x1e0 + kmsan_internal_check_memory+0x202/0x520 + kmsan_check_memory+0xd/0x10 + iowrite8_rep+0x86/0x380 + vmci_guest_probe_device+0xf0b/0x1e70 + pci_device_probe+0xab3/0xe70 + really_probe+0xd16/0x24d0 + driver_probe_device+0x29d/0x3a0 + device_driver_attach+0x25a/0x490 + __driver_attach+0x78c/0x840 + bus_for_each_dev+0x210/0x340 + driver_attach+0x89/0xb0 + bus_add_driver+0x677/0xc40 + driver_register+0x485/0x8e0 + __pci_register_driver+0x1ff/0x350 + vmci_guest_init+0x3e/0x41 + vmci_drv_init+0x1d6/0x43f + do_one_initcall+0x39c/0x9a0 + do_initcall_level+0x1d7/0x259 + do_initcalls+0x127/0x1cb + do_basic_setup+0x33/0x36 + kernel_init_freeable+0x29a/0x3ed + kernel_init+0x1f/0x840 + ret_from_fork+0x1f/0x30 + + Uninit was created at: + kmsan_internal_poison_shadow+0x5c/0xf0 + kmsan_slab_alloc+0x8d/0xe0 + kmem_cache_alloc+0x84f/0xe30 + vmci_guest_probe_device+0xd11/0x1e70 + pci_device_probe+0xab3/0xe70 + really_probe+0xd16/0x24d0 + driver_probe_device+0x29d/0x3a0 + device_driver_attach+0x25a/0x490 + __driver_attach+0x78c/0x840 + bus_for_each_dev+0x210/0x340 + driver_attach+0x89/0xb0 + bus_add_driver+0x677/0xc40 + driver_register+0x485/0x8e0 + __pci_register_driver+0x1ff/0x350 + vmci_guest_init+0x3e/0x41 + vmci_drv_init+0x1d6/0x43f + do_one_initcall+0x39c/0x9a0 + do_initcall_level+0x1d7/0x259 + do_initcalls+0x127/0x1cb + do_basic_setup+0x33/0x36 + kernel_init_freeable+0x29a/0x3ed + kernel_init+0x1f/0x840 + ret_from_fork+0x1f/0x30 + + Bytes 28-31 of 36 are uninitialized + Memory access of size 36 starts at ffff8881675e5f00 + ===================================================== + +Fixes: 1f166439917b69d3 ("VMCI: guest side driver implementation.") +Cc: +Signed-off-by: Tetsuo Handa +Link: https://lore.kernel.org/r/20210402121742.3917-2-penguin-kernel@I-love.SAKURA.ne.jp +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/misc/vmw_vmci/vmci_guest.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c +index cc8eeb361fcd..1018dc77269d 100644 +--- a/drivers/misc/vmw_vmci/vmci_guest.c ++++ b/drivers/misc/vmw_vmci/vmci_guest.c +@@ -168,7 +168,7 @@ static int vmci_check_host_caps(struct pci_dev *pdev) + VMCI_UTIL_NUM_RESOURCES * sizeof(u32); + struct vmci_datagram *check_msg; + +- check_msg = kmalloc(msg_size, GFP_KERNEL); ++ check_msg = kzalloc(msg_size, GFP_KERNEL); + if (!check_msg) { + dev_err(&pdev->dev, "%s: Insufficient memory\n", __func__); + return -ENOMEM; +-- +2.26.2 + diff --git a/patches.suse/misc-vmw_vmci-explicitly-initialize-vmci_notify_bm_s.patch b/patches.suse/misc-vmw_vmci-explicitly-initialize-vmci_notify_bm_s.patch new file mode 100644 index 0000000..7bb3e02 --- /dev/null +++ b/patches.suse/misc-vmw_vmci-explicitly-initialize-vmci_notify_bm_s.patch @@ -0,0 +1,80 @@ +From 376565b9717c30cd58ad33860fa42697615fa2e4 Mon Sep 17 00:00:00 2001 +From: Tetsuo Handa +Date: Fri, 2 Apr 2021 21:17:41 +0900 +Subject: [PATCH] misc: vmw_vmci: explicitly initialize vmci_notify_bm_set_msg struct +Git-commit: 376565b9717c30cd58ad33860fa42697615fa2e4 +Patch-mainline: v5.13-rc1 +References: git-fixes + +KMSAN complains that the vmci_use_ppn64() == false path in +vmci_dbell_register_notification_bitmap() left upper 32bits of +bitmap_set_msg.bitmap_ppn64 member uninitialized. + + ===================================================== + BUG: KMSAN: uninit-value in kmsan_check_memory+0xd/0x10 + CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.11.0-rc7+ #4 + Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 02/27/2020 + Call Trace: + dump_stack+0x21c/0x280 + kmsan_report+0xfb/0x1e0 + kmsan_internal_check_memory+0x484/0x520 + kmsan_check_memory+0xd/0x10 + iowrite8_rep+0x86/0x380 + vmci_send_datagram+0x150/0x280 + vmci_dbell_register_notification_bitmap+0x133/0x1e0 + vmci_guest_probe_device+0xcab/0x1e70 + pci_device_probe+0xab3/0xe70 + really_probe+0xd16/0x24d0 + driver_probe_device+0x29d/0x3a0 + device_driver_attach+0x25a/0x490 + __driver_attach+0x78c/0x840 + bus_for_each_dev+0x210/0x340 + driver_attach+0x89/0xb0 + bus_add_driver+0x677/0xc40 + driver_register+0x485/0x8e0 + __pci_register_driver+0x1ff/0x350 + vmci_guest_init+0x3e/0x41 + vmci_drv_init+0x1d6/0x43f + do_one_initcall+0x39c/0x9a0 + do_initcall_level+0x1d7/0x259 + do_initcalls+0x127/0x1cb + do_basic_setup+0x33/0x36 + kernel_init_freeable+0x29a/0x3ed + kernel_init+0x1f/0x840 + ret_from_fork+0x1f/0x30 + + Local variable ----bitmap_set_msg@vmci_dbell_register_notification_bitmap created at: + vmci_dbell_register_notification_bitmap+0x50/0x1e0 + vmci_dbell_register_notification_bitmap+0x50/0x1e0 + + Bytes 28-31 of 32 are uninitialized + Memory access of size 32 starts at ffff88810098f570 + ===================================================== + +Fixes: 83e2ec765be03e8a ("VMCI: doorbell implementation.") +Cc: +Signed-off-by: Tetsuo Handa +Link: https://lore.kernel.org/r/20210402121742.3917-1-penguin-kernel@I-love.SAKURA.ne.jp +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/misc/vmw_vmci/vmci_doorbell.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/misc/vmw_vmci/vmci_doorbell.c b/drivers/misc/vmw_vmci/vmci_doorbell.c +index 345addd9306d..fa8a7fce4481 100644 +--- a/drivers/misc/vmw_vmci/vmci_doorbell.c ++++ b/drivers/misc/vmw_vmci/vmci_doorbell.c +@@ -326,7 +326,7 @@ int vmci_dbell_host_context_notify(u32 src_cid, struct vmci_handle handle) + bool vmci_dbell_register_notification_bitmap(u64 bitmap_ppn) + { + int result; +- struct vmci_notify_bm_set_msg bitmap_set_msg; ++ struct vmci_notify_bm_set_msg bitmap_set_msg = { }; + + bitmap_set_msg.hdr.dst = vmci_make_handle(VMCI_HYPERVISOR_CONTEXT_ID, + VMCI_SET_NOTIFY_BITMAP); +-- +2.26.2 + diff --git a/patches.suse/mmc-core-Correct-descriptions-in-mmc_of_parse.patch b/patches.suse/mmc-core-Correct-descriptions-in-mmc_of_parse.patch new file mode 100644 index 0000000..aad2268 --- /dev/null +++ b/patches.suse/mmc-core-Correct-descriptions-in-mmc_of_parse.patch @@ -0,0 +1,34 @@ +From 0f2c771e74b56e8c0101cac2b8671bcf6feccd96 Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Mon, 19 Apr 2021 14:24:54 +0300 +Subject: [PATCH] mmc: core: Correct descriptions in mmc_of_parse() +Git-commit: 0f2c771e74b56e8c0101cac2b8671bcf6feccd96 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Since it has been converted to use device property API, the function +and field descriptions become outdated. Correct them. + +Fixes: 73a47a9bb3e2 ("mmc: core: Use device_property_read instead of of_property_read") +Signed-off-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20210419112459.25241-1-andriy.shevchenko@linux.intel.com +Signed-off-by: Ulf Hansson +Acked-by: Takashi Iwai + +--- + drivers/mmc/core/host.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/mmc/core/host.c ++++ b/drivers/mmc/core/host.c +@@ -162,8 +162,8 @@ static void mmc_retune_timer(struct time + } + + /** +- * mmc_of_parse() - parse host's device-tree node +- * @host: host whose node should be parsed. ++ * mmc_of_parse() - parse host's device properties ++ * @host: host whose properties should be parsed. + * + * To keep the rest of the MMC subsystem unaware of whether DT has been + * used to to instantiate and configure this host instance or not, we diff --git a/patches.suse/mmc-cqhci-Add-cqhci_deactivate.patch b/patches.suse/mmc-cqhci-Add-cqhci_deactivate.patch new file mode 100644 index 0000000..df17251 --- /dev/null +++ b/patches.suse/mmc-cqhci-Add-cqhci_deactivate.patch @@ -0,0 +1,66 @@ +From 0ffa6cfbd94982e6c028a8924b06a96c1b91bed8 Mon Sep 17 00:00:00 2001 +From: Adrian Hunter +Date: Fri, 6 Mar 2020 19:38:42 +0530 +Subject: [PATCH] mmc: cqhci: Add cqhci_deactivate() +Git-commit: 0ffa6cfbd94982e6c028a8924b06a96c1b91bed8 +References: git-fixes +Patch-mainline: v5.7-rc1 + +Host controllers can reset CQHCI either directly or as a consequence of +host controller reset. Add cqhci_deactivate() which puts the CQHCI +driver into a state that is consistent with that. + +Signed-off-by: Adrian Hunter +Signed-off-by: Veerabhadrarao Badiganti +Link: https://lore.kernel.org/r/1583503724-13943-2-git-send-email-vbadigan@codeaurora.org +Signed-off-by: Ulf Hansson +Signed-off-by: Oliver Neukum +--- + drivers/mmc/host/cqhci.c | 6 +++--- + drivers/mmc/host/cqhci.h | 6 +++++- + 2 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/drivers/mmc/host/cqhci.c b/drivers/mmc/host/cqhci.c +index e2ea2c4b6b94..d8d024a1682b 100644 +--- a/drivers/mmc/host/cqhci.c ++++ b/drivers/mmc/host/cqhci.c +@@ -298,16 +298,16 @@ static void __cqhci_disable(struct cqhci_host *cq_host) + cq_host->activated = false; + } + +-int cqhci_suspend(struct mmc_host *mmc) ++int cqhci_deactivate(struct mmc_host *mmc) + { + struct cqhci_host *cq_host = mmc->cqe_private; + +- if (cq_host->enabled) ++ if (cq_host->enabled && cq_host->activated) + __cqhci_disable(cq_host); + + return 0; + } +-EXPORT_SYMBOL(cqhci_suspend); ++EXPORT_SYMBOL(cqhci_deactivate); + + int cqhci_resume(struct mmc_host *mmc) + { +diff --git a/drivers/mmc/host/cqhci.h b/drivers/mmc/host/cqhci.h +index def76e9b5cac..437700179de4 100644 +--- a/drivers/mmc/host/cqhci.h ++++ b/drivers/mmc/host/cqhci.h +@@ -230,7 +230,11 @@ irqreturn_t cqhci_irq(struct mmc_host *mmc, u32 intmask, int cmd_error, + int data_error); + int cqhci_init(struct cqhci_host *cq_host, struct mmc_host *mmc, bool dma64); + struct cqhci_host *cqhci_pltfm_init(struct platform_device *pdev); +-int cqhci_suspend(struct mmc_host *mmc); ++int cqhci_deactivate(struct mmc_host *mmc); ++static inline int cqhci_suspend(struct mmc_host *mmc) ++{ ++ return cqhci_deactivate(mmc); ++} + int cqhci_resume(struct mmc_host *mmc); + + #endif +-- +2.26.2 + diff --git a/patches.suse/mmc-mmc_spi-Drop-unused-NO_IRQ-definition.patch b/patches.suse/mmc-mmc_spi-Drop-unused-NO_IRQ-definition.patch new file mode 100644 index 0000000..60c1e53 --- /dev/null +++ b/patches.suse/mmc-mmc_spi-Drop-unused-NO_IRQ-definition.patch @@ -0,0 +1,40 @@ +From 6738fbc08f302a965080fd404f7408759caf8cd2 Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Mon, 19 Apr 2021 14:24:57 +0300 +Subject: [PATCH] mmc: mmc_spi: Drop unused NO_IRQ definition +Git-commit: 6738fbc08f302a965080fd404f7408759caf8cd2 +Patch-mainline: v5.13-rc1 +References: git-fixes + +After the commit 073350f7b562 ("mmc: mmc_spi: Fix return value evaluation of +irq_of_parse_and_map()") the NO_IRQ is not used anymore, drop it for good. + +Fixes: 073350f7b562 ("mmc: mmc_spi: Fix return value evaluation of irq_of_parse_and_map()") +Signed-off-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20210419112459.25241-4-andriy.shevchenko@linux.intel.com +Signed-off-by: Ulf Hansson +Acked-by: Takashi Iwai + +--- + drivers/mmc/host/of_mmc_spi.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c +index 843ec3db891b..0b038f5c392a 100644 +--- a/drivers/mmc/host/of_mmc_spi.c ++++ b/drivers/mmc/host/of_mmc_spi.c +@@ -19,11 +19,6 @@ + #include + #include + +-/* For archs that don't support NO_IRQ (such as mips), provide a dummy value */ +-#ifndef NO_IRQ +-#define NO_IRQ 0 +-#endif +- + MODULE_LICENSE("GPL"); + + struct of_mmc_spi { +-- +2.26.2 + diff --git a/patches.suse/mmc-sdhci-Use-Auto-CMD-Auto-Select-only-when-v4_mode.patch b/patches.suse/mmc-sdhci-Use-Auto-CMD-Auto-Select-only-when-v4_mode.patch new file mode 100644 index 0000000..fa49e0b --- /dev/null +++ b/patches.suse/mmc-sdhci-Use-Auto-CMD-Auto-Select-only-when-v4_mode.patch @@ -0,0 +1,54 @@ +From b3e1ea16fb39fb6e1a1cf1dbdd6738531de3dc7d Mon Sep 17 00:00:00 2001 +From: Jisheng Zhang +Date: Thu, 15 Oct 2020 17:41:15 +0800 +Subject: [PATCH] mmc: sdhci: Use Auto CMD Auto Select only when v4_mode is + true +Git-commit: b3e1ea16fb39fb6e1a1cf1dbdd6738531de3dc7d +References: git-fixes +Patch-mainline: v5.10-rc2 + +sdhci-of-dwcmshc meets an eMMC read performance regression with below +command after commit 427b6514d095 ("mmc: sdhci: Add Auto CMD Auto +Select support"): + +dd if=/dev/mmcblk0 of=/dev/null bs=8192 count=100000 + +Before the commit, the above command gives 120MB/s +After the commit, the above command gives 51.3 MB/s + +So it looks like sdhci-of-dwcmshc expects Version 4 Mode for Auto +CMD Auto Select. Fix the performance degradation by ensuring v4_mode +is true to use Auto CMD Auto Select. + +Fixes: 427b6514d095 ("mmc: sdhci: Add Auto CMD Auto Select support") +Signed-off-by: Jisheng Zhang +Acked-by: Adrian Hunter +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20201015174115.4cf2c19a@xhacker.debian +Signed-off-by: Ulf Hansson +Signed-off-by: Oliver Neukum +--- + drivers/mmc/host/sdhci.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c +index 592a55a34b58..3561ae8a481a 100644 +--- a/drivers/mmc/host/sdhci.c ++++ b/drivers/mmc/host/sdhci.c +@@ -1384,9 +1384,11 @@ static inline void sdhci_auto_cmd_select(struct sdhci_host *host, + /* + * In case of Version 4.10 or later, use of 'Auto CMD Auto + * Select' is recommended rather than use of 'Auto CMD12 +- * Enable' or 'Auto CMD23 Enable'. ++ * Enable' or 'Auto CMD23 Enable'. We require Version 4 Mode ++ * here because some controllers (e.g sdhci-of-dwmshc) expect it. + */ +- if (host->version >= SDHCI_SPEC_410 && (use_cmd12 || use_cmd23)) { ++ if (host->version >= SDHCI_SPEC_410 && host->v4_mode && ++ (use_cmd12 || use_cmd23)) { + *mode |= SDHCI_TRNS_AUTO_SEL; + + ctrl2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); +-- +2.26.2 + diff --git a/patches.suse/mmc-sdhci-of-arasan-Add-missed-checks-for-devm_clk_r.patch b/patches.suse/mmc-sdhci-of-arasan-Add-missed-checks-for-devm_clk_r.patch new file mode 100644 index 0000000..3535279 --- /dev/null +++ b/patches.suse/mmc-sdhci-of-arasan-Add-missed-checks-for-devm_clk_r.patch @@ -0,0 +1,36 @@ +From c99e1d0c91ac8d7db3062ea1af315f21295701d7 Mon Sep 17 00:00:00 2001 +From: Chuhong Yuan +Date: Tue, 9 Jun 2020 00:22:26 +0800 +Subject: [PATCH] mmc: sdhci-of-arasan: Add missed checks for + devm_clk_register() +Git-commit: c99e1d0c91ac8d7db3062ea1af315f21295701d7 +References: git-fixes +Patch-mainline: v5.9-rc1 + +These functions do not check the return value of devm_clk_register(): + - sdhci_arasan_register_sdcardclk() + - sdhci_arasan_register_sampleclk() + +Therefore, add the missed checks to fix them. + +Fixes: c390f2110adf1 ("mmc: sdhci-of-arasan: Add ability to export card clock") +Signed-off-by: Chuhong Yuan +Reviewed-by: Douglas Anderson +Link: https://lore.kernel.org/r/20200608162226.3259186-1-hslester96@gmail.com +Signed-off-by: Ulf Hansson +Signed-off-by: Oliver Neukum +--- + drivers/mmc/host/sdhci-of-arasan.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/mmc/host/sdhci-of-arasan.c ++++ b/drivers/mmc/host/sdhci-of-arasan.c +@@ -643,6 +643,8 @@ static int sdhci_arasan_register_sdclk(s + sdhci_arasan->sdcardclk_hw.init = &sdcardclk_init; + sdhci_arasan->sdcardclk = + devm_clk_register(dev, &sdhci_arasan->sdcardclk_hw); ++ if (IS_ERR(sdhci_arasan->sdcardclk)) ++ return PTR_ERR(sdhci_arasan->sdcardclk); + sdhci_arasan->sdcardclk_hw.init = NULL; + + ret = of_clk_add_provider(np, of_clk_src_simple_get, diff --git a/patches.suse/mmc-sdhci-of-dwcmshc-fix-rpmb-access.patch b/patches.suse/mmc-sdhci-of-dwcmshc-fix-rpmb-access.patch new file mode 100644 index 0000000..2ac86cf --- /dev/null +++ b/patches.suse/mmc-sdhci-of-dwcmshc-fix-rpmb-access.patch @@ -0,0 +1,89 @@ +From ca1219c0a7432272324660fc9f61a9940f90c50b Mon Sep 17 00:00:00 2001 +From: Jisheng Zhang +Date: Tue, 29 Dec 2020 16:16:25 +0800 +Subject: [PATCH] mmc: sdhci-of-dwcmshc: fix rpmb access +Git-commit: ca1219c0a7432272324660fc9f61a9940f90c50b +Patch-mainline: v5.11-rc5 +References: git-fixes + +Commit a44f7cb93732 ("mmc: core: use mrq->sbc when sending CMD23 for +RPMB") began to use ACMD23 for RPMB if the host supports ACMD23. In +RPMB ACM23 case, we need to set bit 31 to CMD23 argument, otherwise +RPMB write operation will return general fail. + +However, no matter V4 is enabled or not, the dwcmshc's ARGUMENT2 +register is 32-bit block count register which doesn't support stuff +bits of CMD23 argument. So let's handle this specific ACMD23 case. + +From another side, this patch also prepare for future v4 enabling +for dwcmshc, because from the 4.10 spec, the ARGUMENT2 register is +redefined as 32bit block count which doesn't support stuff bits of +CMD23 argument. + +Fixes: a44f7cb93732 ("mmc: core: use mrq->sbc when sending CMD23 for RPMB") +Signed-off-by: Jisheng Zhang +Acked-by: Adrian Hunter +Link: https://lore.kernel.org/r/20201229161625.38255233@xhacker.debian +Cc: stable@vger.kernel.org +Signed-off-by: Ulf Hansson +Acked-by: Takashi Iwai + +--- + drivers/mmc/host/sdhci-of-dwcmshc.c | 27 +++++++++++++++++++++++++++ + 1 file changed, 27 insertions(+) + +diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c +index 4b673792b5a4..d90020ed3622 100644 +--- a/drivers/mmc/host/sdhci-of-dwcmshc.c ++++ b/drivers/mmc/host/sdhci-of-dwcmshc.c +@@ -16,6 +16,8 @@ + + #include "sdhci-pltfm.h" + ++#define SDHCI_DWCMSHC_ARG2_STUFF GENMASK(31, 16) ++ + /* DWCMSHC specific Mode Select value */ + #define DWCMSHC_CTRL_HS400 0x7 + +@@ -49,6 +51,29 @@ static void dwcmshc_adma_write_desc(struct sdhci_host *host, void **desc, + sdhci_adma_write_desc(host, desc, addr, len, cmd); + } + ++static void dwcmshc_check_auto_cmd23(struct mmc_host *mmc, ++ struct mmc_request *mrq) ++{ ++ struct sdhci_host *host = mmc_priv(mmc); ++ ++ /* ++ * No matter V4 is enabled or not, ARGUMENT2 register is 32-bit ++ * block count register which doesn't support stuff bits of ++ * CMD23 argument on dwcmsch host controller. ++ */ ++ if (mrq->sbc && (mrq->sbc->arg & SDHCI_DWCMSHC_ARG2_STUFF)) ++ host->flags &= ~SDHCI_AUTO_CMD23; ++ else ++ host->flags |= SDHCI_AUTO_CMD23; ++} ++ ++static void dwcmshc_request(struct mmc_host *mmc, struct mmc_request *mrq) ++{ ++ dwcmshc_check_auto_cmd23(mmc, mrq); ++ ++ sdhci_request(mmc, mrq); ++} ++ + static void dwcmshc_set_uhs_signaling(struct sdhci_host *host, + unsigned int timing) + { +@@ -133,6 +158,8 @@ static int dwcmshc_probe(struct platform_device *pdev) + + sdhci_get_of_property(pdev); + ++ host->mmc_host_ops.request = dwcmshc_request; ++ + err = sdhci_add_host(host); + if (err) + goto err_clk; +-- +2.26.2 + diff --git a/patches.suse/mmc-sdhci-of-dwcmshc-implement-specific-set_uhs_sign.patch b/patches.suse/mmc-sdhci-of-dwcmshc-implement-specific-set_uhs_sign.patch new file mode 100644 index 0000000..c69a35a --- /dev/null +++ b/patches.suse/mmc-sdhci-of-dwcmshc-implement-specific-set_uhs_sign.patch @@ -0,0 +1,74 @@ +From 554232e8d59f3df842fdd9cc68a22e827b286d52 Mon Sep 17 00:00:00 2001 +From: Jisheng Zhang +Date: Wed, 13 May 2020 18:26:02 +0800 +Subject: [PATCH] mmc: sdhci-of-dwcmshc: implement specific set_uhs_signaling +Git-commit: 554232e8d59f3df842fdd9cc68a22e827b286d52 +References: git-fixes +Patch-mainline: v5.8-rc1 + +We need a different set_uhs_signaling implementation for +MMC_TIMING_MMC_HS and MMC_TIMING_MMC_HS400. + +Signed-off-by: Jisheng Zhang +Link: https://lore.kernel.org/r/20200513182602.3636a551@xhacker.debian +Signed-off-by: Ulf Hansson +Signed-off-by: Oliver Neukum +--- + drivers/mmc/host/sdhci-of-dwcmshc.c | 31 ++++++++++++++++++++++++++++- + 1 file changed, 30 insertions(+), 1 deletion(-) + +diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c +index a5137845a1c7..a9ed0e006e06 100644 +--- a/drivers/mmc/host/sdhci-of-dwcmshc.c ++++ b/drivers/mmc/host/sdhci-of-dwcmshc.c +@@ -16,6 +16,9 @@ + + #include "sdhci-pltfm.h" + ++/* DWCMSHC specific Mode Select value */ ++#define DWCMSHC_CTRL_HS400 0x7 ++ + #define BOUNDARY_OK(addr, len) \ + ((addr | (SZ_128M - 1)) == ((addr + len - 1) | (SZ_128M - 1))) + +@@ -46,10 +49,36 @@ static void dwcmshc_adma_write_desc(struct sdhci_host *host, void **desc, + sdhci_adma_write_desc(host, desc, addr, len, cmd); + } + ++static void dwcmshc_set_uhs_signaling(struct sdhci_host *host, ++ unsigned int timing) ++{ ++ u16 ctrl_2; ++ ++ ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); ++ /* Select Bus Speed Mode for host */ ++ ctrl_2 &= ~SDHCI_CTRL_UHS_MASK; ++ if ((timing == MMC_TIMING_MMC_HS200) || ++ (timing == MMC_TIMING_UHS_SDR104)) ++ ctrl_2 |= SDHCI_CTRL_UHS_SDR104; ++ else if (timing == MMC_TIMING_UHS_SDR12) ++ ctrl_2 |= SDHCI_CTRL_UHS_SDR12; ++ else if ((timing == MMC_TIMING_UHS_SDR25) || ++ (timing == MMC_TIMING_MMC_HS)) ++ ctrl_2 |= SDHCI_CTRL_UHS_SDR25; ++ else if (timing == MMC_TIMING_UHS_SDR50) ++ ctrl_2 |= SDHCI_CTRL_UHS_SDR50; ++ else if ((timing == MMC_TIMING_UHS_DDR50) || ++ (timing == MMC_TIMING_MMC_DDR52)) ++ ctrl_2 |= SDHCI_CTRL_UHS_DDR50; ++ else if (timing == MMC_TIMING_MMC_HS400) ++ ctrl_2 |= DWCMSHC_CTRL_HS400; ++ sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); ++} ++ + static const struct sdhci_ops sdhci_dwcmshc_ops = { + .set_clock = sdhci_set_clock, + .set_bus_width = sdhci_set_bus_width, +- .set_uhs_signaling = sdhci_set_uhs_signaling, ++ .set_uhs_signaling = dwcmshc_set_uhs_signaling, + .get_max_clock = sdhci_pltfm_clk_get_max_clock, + .reset = sdhci_reset, + .adma_write_desc = dwcmshc_adma_write_desc, +-- +2.26.2 + diff --git a/patches.suse/mmc-sdhci-of-esdhc-make-sure-delay-chain-locked-for-.patch b/patches.suse/mmc-sdhci-of-esdhc-make-sure-delay-chain-locked-for-.patch new file mode 100644 index 0000000..e20ffe9 --- /dev/null +++ b/patches.suse/mmc-sdhci-of-esdhc-make-sure-delay-chain-locked-for-.patch @@ -0,0 +1,78 @@ +From 011fde48394b7dc8dfd6660d1013b26a00157b80 Mon Sep 17 00:00:00 2001 +From: Yangbo Lu +Date: Tue, 20 Oct 2020 16:11:16 +0800 +Subject: [PATCH] mmc: sdhci-of-esdhc: make sure delay chain locked for HS400 +Git-commit: 011fde48394b7dc8dfd6660d1013b26a00157b80 +References: git-fixes +Patch-mainline: v5.10-rc2 + +For eMMC HS400 mode initialization, the DLL reset is a required step +if DLL is enabled to use previously, like in bootloader. +This step has not been documented in reference manual, but the RM will +be fixed sooner or later. + +This patch is to add the step of DLL reset, and make sure delay chain +locked for HS400. + +Signed-off-by: Yangbo Lu +Acked-by: Adrian Hunter +Link: https://lore.kernel.org/r/20201020081116.20918-1-yangbo.lu@nxp.com +Fixes: 54e08d9a95ca ("mmc: sdhci-of-esdhc: add hs400 mode support") +Cc: stable@vger.kernel.org +Signed-off-by: Ulf Hansson +Signed-off-by: Oliver Neukum +--- + drivers/mmc/host/sdhci-esdhc.h | 1 + + drivers/mmc/host/sdhci-of-esdhc.c | 17 +++++++++++++++++ + 2 files changed, 18 insertions(+) + +--- a/drivers/mmc/host/sdhci-esdhc.h ++++ b/drivers/mmc/host/sdhci-esdhc.h +@@ -87,6 +87,7 @@ + /* DLL Config 0 Register */ + #define ESDHC_DLLCFG0 0x160 + #define ESDHC_DLL_ENABLE 0x80000000 ++#define ESDHC_DLL_RESET 0x40000000 + #define ESDHC_DLL_FREQ_SEL 0x08000000 + + /* DLL Config 1 Register */ +--- a/drivers/mmc/host/sdhci-of-esdhc.c ++++ b/drivers/mmc/host/sdhci-of-esdhc.c +@@ -4,6 +4,7 @@ + * + * Copyright (c) 2007, 2010, 2012 Freescale Semiconductor, Inc. + * Copyright (c) 2009 MontaVista Software, Inc. ++ * Copyright 2020 NXP + * + * Authors: Xiaobo Xie + * Anton Vorontsov +@@ -19,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include "sdhci-pltfm.h" +@@ -706,6 +708,21 @@ static void esdhc_of_set_clock(struct sd + if (host->mmc->actual_clock == MMC_HS200_MAX_DTR) + temp |= ESDHC_DLL_FREQ_SEL; + sdhci_writel(host, temp, ESDHC_DLLCFG0); ++ ++ temp |= ESDHC_DLL_RESET; ++ sdhci_writel(host, temp, ESDHC_DLLCFG0); ++ udelay(1); ++ temp &= ~ESDHC_DLL_RESET; ++ sdhci_writel(host, temp, ESDHC_DLLCFG0); ++ ++ /* Wait max 20 ms */ ++ if (read_poll_timeout(sdhci_readl, temp, ++ temp & ESDHC_DLL_STS_SLV_LOCK, ++ 10, 20000, false, ++ host, ESDHC_DLLSTAT0)) ++ pr_err("%s: timeout for delay chain lock.\n", ++ mmc_hostname(host->mmc)); ++ + temp = sdhci_readl(host, ESDHC_TBCTL); + sdhci_writel(host, temp | ESDHC_HS400_WNDW_ADJUST, ESDHC_TBCTL); + diff --git a/patches.suse/mmc-sdhci-of-esdhc-set-timeout-to-max-before-tuning.patch b/patches.suse/mmc-sdhci-of-esdhc-set-timeout-to-max-before-tuning.patch new file mode 100644 index 0000000..3a9ba90 --- /dev/null +++ b/patches.suse/mmc-sdhci-of-esdhc-set-timeout-to-max-before-tuning.patch @@ -0,0 +1,60 @@ +From 0add6e9b88d0632a25323aaf4987dbacb0e4ae64 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Fri, 23 Oct 2020 00:23:37 +0200 +Subject: [PATCH] mmc: sdhci-of-esdhc: set timeout to max before tuning +Git-commit: 0add6e9b88d0632a25323aaf4987dbacb0e4ae64 +References: git-fixes +Patch-mainline: v5.10-rc2 + +On rare occations there is the following error: + + mmc0: Tuning timeout, falling back to fixed sampling clock + +There are SD cards which takes a significant longer time to reply to the +first CMD19 command. The eSDHC takes the data timeout value into account +during the tuning period. The SDHCI core doesn't explicitly set this +timeout for the tuning procedure. Thus on the slow cards, there might be +a spurious "Buffer Read Ready" interrupt, which in turn triggers a wrong +sequence of events. In the end this will lead to an unsuccessful tuning +procedure and to the above error. + +To workaround this, set the timeout to the maximum value (which is the +best we can do) and the SDHCI core will take care of the proper timeout +handling. + +Fixes: ba49cbd0936e ("mmc: sdhci-of-esdhc: add tuning support") +Signed-off-by: Michael Walle +Acked-by: Adrian Hunter +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20201022222337.19857-1-michael@walle.cc +Signed-off-by: Ulf Hansson +Signed-off-by: Oliver Neukum +--- + drivers/mmc/host/sdhci-of-esdhc.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c +index 0b45eff6fed4..baf7801a1804 100644 +--- a/drivers/mmc/host/sdhci-of-esdhc.c ++++ b/drivers/mmc/host/sdhci-of-esdhc.c +@@ -1052,6 +1052,17 @@ static int esdhc_execute_tuning(struct mmc_host *mmc, u32 opcode) + + esdhc_tuning_block_enable(host, true); + ++ /* ++ * The eSDHC controller takes the data timeout value into account ++ * during tuning. If the SD card is too slow sending the response, the ++ * timer will expire and a "Buffer Read Ready" interrupt without data ++ * is triggered. This leads to tuning errors. ++ * ++ * Just set the timeout to the maximum value because the core will ++ * already take care of it in sdhci_send_tuning(). ++ */ ++ sdhci_writeb(host, 0xe, SDHCI_TIMEOUT_CONTROL); ++ + hs400_tuning = host->flags & SDHCI_HS400_TUNING; + + do { +-- +2.26.2 + diff --git a/patches.suse/mmc-sdhci-pci-Fix-SDHCI_RESET_ALL-for-CQHCI-for-Inte.patch b/patches.suse/mmc-sdhci-pci-Fix-SDHCI_RESET_ALL-for-CQHCI-for-Inte.patch new file mode 100644 index 0000000..1837186 --- /dev/null +++ b/patches.suse/mmc-sdhci-pci-Fix-SDHCI_RESET_ALL-for-CQHCI-for-Inte.patch @@ -0,0 +1,64 @@ +From df57d73276b863af1debc48546b0e59e44998a55 Mon Sep 17 00:00:00 2001 +From: Adrian Hunter +Date: Wed, 19 Aug 2020 15:18:48 +0300 +Subject: [PATCH] mmc: sdhci-pci: Fix SDHCI_RESET_ALL for CQHCI for Intel + GLK-based controllers +Git-commit: df57d73276b863af1debc48546b0e59e44998a55 +References: git-fixes +Patch-mainline: v5.9-rc4 + +For Intel controllers, SDHCI_RESET_ALL resets also CQHCI registers. +Normally, SDHCI_RESET_ALL is not used while CQHCI is enabled, but that can +happen on the error path. e.g. if mmc_cqe_recovery() fails, mmc_blk_reset() +is called which, for a eMMC that does not support HW Reset, will cycle the +bus power and the driver will perform SDHCI_RESET_ALL. + +So whenever performing SDHCI_RESET_ALL ensure CQHCI is deactivated. +That will force the driver to reinitialize CQHCI when it is next used. + +A similar change was done already for sdhci-msm, and other drivers using +CQHCI might benefit from a similar change, if they also have CQHCI reset +by SDHCI_RESET_ALL. + +Fixes: 8ee82bda230fc9 ("mmc: sdhci-pci: Add CQHCI support for Intel GLK") +Cc: stable@vger.kernel.org # 5.4.x: 0ffa6cfbd949: mmc: cqhci: Add cqhci_deactivate() +Cc: stable@vger.kernel.org # 5.4+ +Signed-off-by: Adrian Hunter +Link: https://lore.kernel.org/r/20200819121848.16967-1-adrian.hunter@intel.com +Signed-off-by: Ulf Hansson +Signed-off-by: Oliver Neukum +--- + drivers/mmc/host/sdhci-pci-core.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c +index bb6802448b2f..af413805bbf1 100644 +--- a/drivers/mmc/host/sdhci-pci-core.c ++++ b/drivers/mmc/host/sdhci-pci-core.c +@@ -232,6 +232,14 @@ static void sdhci_pci_dumpregs(struct mmc_host *mmc) + sdhci_dumpregs(mmc_priv(mmc)); + } + ++static void sdhci_cqhci_reset(struct sdhci_host *host, u8 mask) ++{ ++ if ((host->mmc->caps2 & MMC_CAP2_CQE) && (mask & SDHCI_RESET_ALL) && ++ host->mmc->cqe_private) ++ cqhci_deactivate(host->mmc); ++ sdhci_reset(host, mask); ++} ++ + /*****************************************************************************\ + * * + * Hardware specific quirk handling * +@@ -718,7 +726,7 @@ static const struct sdhci_ops sdhci_intel_glk_ops = { + .set_power = sdhci_intel_set_power, + .enable_dma = sdhci_pci_enable_dma, + .set_bus_width = sdhci_set_bus_width, +- .reset = sdhci_reset, ++ .reset = sdhci_cqhci_reset, + .set_uhs_signaling = sdhci_set_uhs_signaling, + .hw_reset = sdhci_pci_hw_reset, + .irq = sdhci_cqhci_irq, +-- +2.26.2 + diff --git a/patches.suse/mmc-sdhci-pci-Prefer-SDR25-timing-for-High-Speed-mod.patch b/patches.suse/mmc-sdhci-pci-Prefer-SDR25-timing-for-High-Speed-mod.patch index a980586..c0f715f 100644 --- a/patches.suse/mmc-sdhci-pci-Prefer-SDR25-timing-for-High-Speed-mod.patch +++ b/patches.suse/mmc-sdhci-pci-Prefer-SDR25-timing-for-High-Speed-mod.patch @@ -26,7 +26,7 @@ Acked-by: Takashi Iwai --- a/drivers/mmc/host/sdhci-pci-core.c +++ b/drivers/mmc/host/sdhci-pci-core.c -@@ -661,6 +661,15 @@ static void sdhci_intel_set_power(struct +@@ -669,6 +669,15 @@ static void sdhci_intel_set_power(struct } } @@ -42,7 +42,7 @@ Acked-by: Takashi Iwai #define INTEL_HS400_ES_REG 0x78 #define INTEL_HS400_ES_BIT BIT(0) -@@ -717,7 +726,7 @@ static const struct sdhci_ops sdhci_inte +@@ -725,7 +734,7 @@ static const struct sdhci_ops sdhci_inte .enable_dma = sdhci_pci_enable_dma, .set_bus_width = sdhci_set_bus_width, .reset = sdhci_reset, @@ -51,10 +51,10 @@ Acked-by: Takashi Iwai .hw_reset = sdhci_pci_hw_reset, }; -@@ -727,7 +736,7 @@ static const struct sdhci_ops sdhci_inte +@@ -735,7 +744,7 @@ static const struct sdhci_ops sdhci_inte .enable_dma = sdhci_pci_enable_dma, .set_bus_width = sdhci_set_bus_width, - .reset = sdhci_reset, + .reset = sdhci_cqhci_reset, - .set_uhs_signaling = sdhci_set_uhs_signaling, + .set_uhs_signaling = sdhci_intel_set_uhs_signaling, .hw_reset = sdhci_pci_hw_reset, diff --git a/patches.suse/mmc-uniphier-sd-Fix-a-resource-leak-in-the-remove-fu.patch b/patches.suse/mmc-uniphier-sd-Fix-a-resource-leak-in-the-remove-fu.patch new file mode 100644 index 0000000..573f5ff --- /dev/null +++ b/patches.suse/mmc-uniphier-sd-Fix-a-resource-leak-in-the-remove-fu.patch @@ -0,0 +1,42 @@ +From e29c84857e2d51aa017ce04284b962742fb97d9e Mon Sep 17 00:00:00 2001 +From: Christophe JAILLET +Date: Sat, 20 Feb 2021 15:29:53 +0100 +Subject: [PATCH] mmc: uniphier-sd: Fix a resource leak in the remove function +Git-commit: e29c84857e2d51aa017ce04284b962742fb97d9e +Patch-mainline: v5.13-rc1 +References: git-fixes + +A 'tmio_mmc_host_free()' call is missing in the remove function, in order +to balance a 'tmio_mmc_host_alloc()' call in the probe. +This is done in the error handling path of the probe, but not in the remove +function. + +Add the missing call. + +Fixes: 3fd784f745dd ("mmc: uniphier-sd: add UniPhier SD/eMMC controller driver") +Signed-off-by: Christophe JAILLET +Reviewed-by: Masahiro Yamada +Link: https://lore.kernel.org/r/20210220142953.918608-1-christophe.jaillet@wanadoo.fr +Cc: stable@vger.kernel.org +Signed-off-by: Ulf Hansson +Acked-by: Takashi Iwai + +--- + drivers/mmc/host/uniphier-sd.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/mmc/host/uniphier-sd.c b/drivers/mmc/host/uniphier-sd.c +index 6f0f05466917..ccbf9885a52b 100644 +--- a/drivers/mmc/host/uniphier-sd.c ++++ b/drivers/mmc/host/uniphier-sd.c +@@ -660,6 +660,7 @@ static int uniphier_sd_remove(struct platform_device *pdev) + + tmio_mmc_host_remove(host); + uniphier_sd_clk_disable(host); ++ tmio_mmc_host_free(host); + + return 0; + } +-- +2.26.2 + diff --git a/patches.suse/mmc-uniphier-sd-Fix-an-error-handling-path-in-uniphi.patch b/patches.suse/mmc-uniphier-sd-Fix-an-error-handling-path-in-uniphi.patch new file mode 100644 index 0000000..e0700ad --- /dev/null +++ b/patches.suse/mmc-uniphier-sd-Fix-an-error-handling-path-in-uniphi.patch @@ -0,0 +1,52 @@ +From b03aec1c1f337dfdae44cdb0645ecac34208ae0a Mon Sep 17 00:00:00 2001 +From: Christophe JAILLET +Date: Sat, 20 Feb 2021 15:29:35 +0100 +Subject: [PATCH] mmc: uniphier-sd: Fix an error handling path in uniphier_sd_probe() +Git-commit: b03aec1c1f337dfdae44cdb0645ecac34208ae0a +Patch-mainline: v5.13-rc1 +References: git-fixes + +A 'uniphier_sd_clk_enable()' call should be balanced by a corresponding +'uniphier_sd_clk_disable()' call. +This is done in the remove function, but not in the error handling path of +the probe. + +Add the missing call. + +Fixes: 3fd784f745dd ("mmc: uniphier-sd: add UniPhier SD/eMMC controller driver") +Signed-off-by: Christophe JAILLET +Reviewed-by: Masahiro Yamada +Link: https://lore.kernel.org/r/20210220142935.918554-1-christophe.jaillet@wanadoo.fr +Cc: stable@vger.kernel.org +Signed-off-by: Ulf Hansson +Acked-by: Takashi Iwai + +--- + drivers/mmc/host/uniphier-sd.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/mmc/host/uniphier-sd.c b/drivers/mmc/host/uniphier-sd.c +index 2413b6750cec..6f0f05466917 100644 +--- a/drivers/mmc/host/uniphier-sd.c ++++ b/drivers/mmc/host/uniphier-sd.c +@@ -635,7 +635,7 @@ static int uniphier_sd_probe(struct platform_device *pdev) + + ret = tmio_mmc_host_probe(host); + if (ret) +- goto free_host; ++ goto disable_clk; + + ret = devm_request_irq(dev, irq, tmio_mmc_irq, IRQF_SHARED, + dev_name(dev), host); +@@ -646,6 +646,8 @@ static int uniphier_sd_probe(struct platform_device *pdev) + + remove_host: + tmio_mmc_host_remove(host); ++disable_clk: ++ uniphier_sd_clk_disable(host); + free_host: + tmio_mmc_host_free(host); + +-- +2.26.2 + diff --git a/patches.suse/mt7601u-fix-always-true-expression.patch b/patches.suse/mt7601u-fix-always-true-expression.patch new file mode 100644 index 0000000..7d73ce9 --- /dev/null +++ b/patches.suse/mt7601u-fix-always-true-expression.patch @@ -0,0 +1,47 @@ +From 87fce88658ba047ae62e83497d3f3c5dc22fa6f9 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Thu, 25 Feb 2021 18:32:41 +0000 +Subject: [PATCH] mt7601u: fix always true expression +Git-commit: 87fce88658ba047ae62e83497d3f3c5dc22fa6f9 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Currently the expression ~nic_conf1 is always true because nic_conf1 +is a u16 and according to 6.5.3.3 of the C standard the ~ operator +promotes the u16 to an integer before flipping all the bits. Thus +the top 16 bits of the integer result are all set so the expression +is always true. If the intention was to flip all the bits of nic_conf1 +then casting the integer result back to a u16 is a suitabel fix. + +Interestingly static analyzers seem to thing a bitwise ! should be +used instead of ~ for this scenario, so I think the original intent +of the expression may need some extra consideration. + +Addresses-coverity: ("Logical vs. bitwise operator") +Fixes: c869f77d6abb ("add mt7601u driver") +Signed-off-by: Colin Ian King +Acked-by: Jakub Kicinski +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20210225183241.1002129-1-colin.king@canonical.com +Acked-by: Takashi Iwai + +--- + drivers/net/wireless/mediatek/mt7601u/eeprom.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/mediatek/mt7601u/eeprom.c b/drivers/net/wireless/mediatek/mt7601u/eeprom.c +index c868582c5d22..aa3b64902cf9 100644 +--- a/drivers/net/wireless/mediatek/mt7601u/eeprom.c ++++ b/drivers/net/wireless/mediatek/mt7601u/eeprom.c +@@ -99,7 +99,7 @@ mt7601u_has_tssi(struct mt7601u_dev *dev, u8 *eeprom) + { + u16 nic_conf1 = get_unaligned_le16(eeprom + MT_EE_NIC_CONF_1); + +- return ~nic_conf1 && (nic_conf1 & MT_EE_NIC_CONF_1_TX_ALC_EN); ++ return (u16)~nic_conf1 && (nic_conf1 & MT_EE_NIC_CONF_1_TX_ALC_EN); + } + + static void +-- +2.26.2 + diff --git a/patches.suse/mtd-Handle-possible-EPROBE_DEFER-from-parse_mtd_part.patch b/patches.suse/mtd-Handle-possible-EPROBE_DEFER-from-parse_mtd_part.patch new file mode 100644 index 0000000..bad6b0b --- /dev/null +++ b/patches.suse/mtd-Handle-possible-EPROBE_DEFER-from-parse_mtd_part.patch @@ -0,0 +1,49 @@ +From 08608adb520e51403be7592c2214846fa440a23a Mon Sep 17 00:00:00 2001 +From: Manivannan Sadhasivam +Date: Tue, 2 Mar 2021 18:57:56 +0530 +Subject: [PATCH] mtd: Handle possible -EPROBE_DEFER from parse_mtd_partitions() +Git-commit: 08608adb520e51403be7592c2214846fa440a23a +Patch-mainline: v5.13-rc1 +References: git-fixes + +There are chances that the parse_mtd_partitions() function will return +-EPROBE_DEFER in mtd_device_parse_register(). This might happen when +the dependency is not available for the parser. For instance, on SDX55 +the MTD_QCOMSMEM_PARTS parser depends on the QCOM_SMEM driver to parse +the partitions defined in the shared memory region. With the current +flow, the error returned from parse_mtd_partitions() will be discarded +in favor of trying to add the fallback partition. + +This will prevent the driver to end up in probe deferred pool and the +partitions won't be parsed even after the QCOM_SMEM driver is available. + +Fix this issue by bailing out of mtd_device_parse_register() when +-EPROBE_DEFER error is returned from parse_mtd_partitions() function and +propagate the error code to the driver core for probing later. + +Fixes: 5ac67ce36cfe ("mtd: move code adding (registering) partitions to the parse_mtd_partitions()") +Signed-off-by: Manivannan Sadhasivam +Signed-off-by: Miquel Raynal +Acked-by: Takashi Iwai + +--- + drivers/mtd/mtdcore.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c +index 2d6423d89a17..d97ddc65b5d4 100644 +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -820,6 +820,9 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types, + + /* Prefer parsed partitions over driver-provided fallback */ + ret = parse_mtd_partitions(mtd, types, parser_data); ++ if (ret == -EPROBE_DEFER) ++ goto out; ++ + if (ret > 0) + ret = 0; + else if (nr_parts) +-- +2.26.2 + diff --git a/patches.suse/mtd-rawnand-atmel-Update-ecc_stats.corrected-counter.patch b/patches.suse/mtd-rawnand-atmel-Update-ecc_stats.corrected-counter.patch new file mode 100644 index 0000000..9a859c1 --- /dev/null +++ b/patches.suse/mtd-rawnand-atmel-Update-ecc_stats.corrected-counter.patch @@ -0,0 +1,44 @@ +From 33cebf701e98dd12b01d39d1c644387b27c1a627 Mon Sep 17 00:00:00 2001 +From: "Kai Stuhlemmer (ebee Engineering)" +Date: Mon, 22 Mar 2021 17:07:14 +0200 +Subject: [PATCH] mtd: rawnand: atmel: Update ecc_stats.corrected counter +Git-commit: 33cebf701e98dd12b01d39d1c644387b27c1a627 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Update MTD ECC statistics with the number of corrected bits. + +Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver") +Cc: stable@vger.kernel.org +Signed-off-by: Kai Stuhlemmer (ebee Engineering) +Signed-off-by: Tudor Ambarus +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210322150714.101585-1-tudor.ambarus@microchip.com +Acked-by: Takashi Iwai + +--- + drivers/mtd/nand/raw/atmel/nand-controller.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c +index e6ceec8f50dc..8aab1017b460 100644 +--- a/drivers/mtd/nand/raw/atmel/nand-controller.c ++++ b/drivers/mtd/nand/raw/atmel/nand-controller.c +@@ -883,10 +883,12 @@ static int atmel_nand_pmecc_correct_data(struct nand_chip *chip, void *buf, + NULL, 0, + chip->ecc.strength); + +- if (ret >= 0) ++ if (ret >= 0) { ++ mtd->ecc_stats.corrected += ret; + max_bitflips = max(ret, max_bitflips); +- else ++ } else { + mtd->ecc_stats.failed++; ++ } + + databuf += chip->ecc.size; + eccbuf += chip->ecc.bytes; +-- +2.26.2 + diff --git a/patches.suse/mtd-rawnand-brcmnand-fix-OOB-R-W-with-Hamming-ECC.patch b/patches.suse/mtd-rawnand-brcmnand-fix-OOB-R-W-with-Hamming-ECC.patch new file mode 100644 index 0000000..8c0de79 --- /dev/null +++ b/patches.suse/mtd-rawnand-brcmnand-fix-OOB-R-W-with-Hamming-ECC.patch @@ -0,0 +1,48 @@ +From f5200c14242fb8fa4a9b93f7fd4064d237e58785 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Feb 2021 09:02:10 +0100 +Subject: [PATCH] mtd: rawnand: brcmnand: fix OOB R/W with Hamming ECC +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: f5200c14242fb8fa4a9b93f7fd4064d237e58785 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Hamming ECC doesn't cover the OOB data, so reading or writing OOB shall +always be done without ECC enabled. +This is a problem when adding JFFS2 cleanmarkers to erased blocks. If JFFS2 +clenmarkers are added to the OOB with ECC enabled, OOB bytes will be changed +from ff ff ff to 00 00 00, reporting incorrect ECC errors. + +Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller") +Signed-off-by: Álvaro Fernández Rojas +Acked-by: Brian Norris +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210224080210.23686-1-noltari@gmail.com +Acked-by: Takashi Iwai + +--- + drivers/mtd/nand/raw/brcmnand/brcmnand.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c +index 659eaa6f0980..5ff4291380c5 100644 +--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c ++++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c +@@ -2688,6 +2688,12 @@ static int brcmnand_attach_chip(struct nand_chip *chip) + + ret = brcmstb_choose_ecc_layout(host); + ++ /* If OOB is written with ECC enabled it will cause ECC errors */ ++ if (is_hamming_ecc(host->ctrl, &host->hwcfg)) { ++ chip->ecc.write_oob = brcmnand_write_oob_raw; ++ chip->ecc.read_oob = brcmnand_read_oob_raw; ++ } ++ + return ret; + } + +-- +2.26.2 + diff --git a/patches.suse/mtd-rawnand-fsmc-Fix-error-code-in-fsmc_nand_probe.patch b/patches.suse/mtd-rawnand-fsmc-Fix-error-code-in-fsmc_nand_probe.patch new file mode 100644 index 0000000..1918ed4 --- /dev/null +++ b/patches.suse/mtd-rawnand-fsmc-Fix-error-code-in-fsmc_nand_probe.patch @@ -0,0 +1,42 @@ +From e7a97528e3c787802d8c643d6ab2f428511bb047 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Mon, 15 Feb 2021 18:58:49 +0300 +Subject: [PATCH] mtd: rawnand: fsmc: Fix error code in fsmc_nand_probe() +Git-commit: e7a97528e3c787802d8c643d6ab2f428511bb047 +Patch-mainline: v5.13-rc1 +References: git-fixes + +If dma_request_channel() fails then the probe fails and it should +return a negative error code, but currently it returns success. + +Fixes: 4774fb0a48aa ("mtd: nand/fsmc: Add DMA support") +Signed-off-by: Dan Carpenter +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/YCqaOZ83OvPOzLwh@mwanda +Acked-by: Takashi Iwai + +--- + drivers/mtd/nand/raw/fsmc_nand.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c +index 0101c0fab50a..a24e2f57fa68 100644 +--- a/drivers/mtd/nand/raw/fsmc_nand.c ++++ b/drivers/mtd/nand/raw/fsmc_nand.c +@@ -1077,11 +1077,13 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) + host->read_dma_chan = dma_request_channel(mask, filter, NULL); + if (!host->read_dma_chan) { + dev_err(&pdev->dev, "Unable to get read dma channel\n"); ++ ret = -ENODEV; + goto disable_clk; + } + host->write_dma_chan = dma_request_channel(mask, filter, NULL); + if (!host->write_dma_chan) { + dev_err(&pdev->dev, "Unable to get write dma channel\n"); ++ ret = -ENODEV; + goto release_dma_read_chan; + } + } +-- +2.26.2 + diff --git a/patches.suse/mtd-rawnand-gpmi-Fix-a-double-free-in-gpmi_nand_init.patch b/patches.suse/mtd-rawnand-gpmi-Fix-a-double-free-in-gpmi_nand_init.patch new file mode 100644 index 0000000..64189c3 --- /dev/null +++ b/patches.suse/mtd-rawnand-gpmi-Fix-a-double-free-in-gpmi_nand_init.patch @@ -0,0 +1,47 @@ +From 076de75de1e53160e9b099f75872c1f9adf41a0b Mon Sep 17 00:00:00 2001 +From: Lv Yunlong +Date: Fri, 2 Apr 2021 23:09:05 -0700 +Subject: [PATCH] mtd: rawnand: gpmi: Fix a double free in gpmi_nand_init +Git-commit: 076de75de1e53160e9b099f75872c1f9adf41a0b +Patch-mainline: v5.13-rc1 +References: git-fixes + +If the callee gpmi_alloc_dma_buffer() failed to alloc memory for +this->raw_buffer, gpmi_free_dma_buffer() will be called to free +this->auxiliary_virt. But this->auxiliary_virt is still a non-NULL +and valid ptr. + +Then gpmi_alloc_dma_buffer() returns err and gpmi_free_dma_buffer() +is called again to free this->auxiliary_virt in err_out. This causes +a double free. + +As gpmi_free_dma_buffer() has already called in gpmi_alloc_dma_buffer's +error path, so it should return err directly instead of releasing the dma +buffer again. + +Fixes: 4d02423e9afe6 ("mtd: nand: gpmi: Fix gpmi_nand_init() error path") +Signed-off-by: Lv Yunlong +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210403060905.5251-1-lyl2019@mail.ustc.edu.cn +Acked-by: Takashi Iwai + +--- + drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +index 3fa8c22d3f36..4d08e4ab5c1b 100644 +--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c ++++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +@@ -2449,7 +2449,7 @@ static int gpmi_nand_init(struct gpmi_nand_data *this) + this->bch_geometry.auxiliary_size = 128; + ret = gpmi_alloc_dma_buffer(this); + if (ret) +- goto err_out; ++ return ret; + + nand_controller_init(&this->base); + this->base.ops = &gpmi_nand_controller_ops; +-- +2.26.2 + diff --git a/patches.suse/mtd-rawnand-qcom-Return-actual-error-code-instead-of.patch b/patches.suse/mtd-rawnand-qcom-Return-actual-error-code-instead-of.patch new file mode 100644 index 0000000..9185fe2 --- /dev/null +++ b/patches.suse/mtd-rawnand-qcom-Return-actual-error-code-instead-of.patch @@ -0,0 +1,53 @@ +From 55fbb9ba4f06cb6aff32daca1e1910173c13ec51 Mon Sep 17 00:00:00 2001 +From: Manivannan Sadhasivam +Date: Tue, 2 Mar 2021 18:57:57 +0530 +Subject: [PATCH] mtd: rawnand: qcom: Return actual error code instead of -ENODEV +Git-commit: 55fbb9ba4f06cb6aff32daca1e1910173c13ec51 +Patch-mainline: v5.13-rc1 +References: git-fixes + +In qcom_probe_nand_devices() function, the error code returned by +qcom_nand_host_init_and_register() is converted to -ENODEV in the case +of failure. This poses issue if -EPROBE_DEFER is returned when the +dependency is not available for a component like parser. + +So let's restructure the error handling logic a bit and return the +actual error code in case of qcom_nand_host_init_and_register() failure. + +Fixes: c76b78d8ec05 ("mtd: nand: Qualcomm NAND controller driver") +Signed-off-by: Manivannan Sadhasivam +Signed-off-by: Miquel Raynal +Acked-by: Takashi Iwai + +--- + drivers/mtd/nand/raw/qcom_nandc.c | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c +index 34d31c7c2dcf..b9194680cd3c 100644 +--- a/drivers/mtd/nand/raw/qcom_nandc.c ++++ b/drivers/mtd/nand/raw/qcom_nandc.c +@@ -2959,7 +2959,7 @@ static int qcom_probe_nand_devices(struct qcom_nand_controller *nandc) + struct device *dev = nandc->dev; + struct device_node *dn = dev->of_node, *child; + struct qcom_nand_host *host; +- int ret; ++ int ret = -ENODEV; + + for_each_available_child_of_node(dn, child) { + host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); +@@ -2977,10 +2977,7 @@ static int qcom_probe_nand_devices(struct qcom_nand_controller *nandc) + list_add_tail(&host->node, &nandc->host_list); + } + +- if (list_empty(&nandc->host_list)) +- return -ENODEV; +- +- return 0; ++ return ret; + } + + /* parse custom DT properties here */ +-- +2.26.2 + diff --git a/patches.suse/mtd-require-write-permissions-for-locking-and-badblo.patch b/patches.suse/mtd-require-write-permissions-for-locking-and-badblo.patch new file mode 100644 index 0000000..bc8c2ef --- /dev/null +++ b/patches.suse/mtd-require-write-permissions-for-locking-and-badblo.patch @@ -0,0 +1,69 @@ +From 1e97743fd180981bef5f01402342bb54bf1c6366 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Wed, 3 Mar 2021 16:57:35 +0100 +Subject: [PATCH] mtd: require write permissions for locking and badblock ioctls +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 1e97743fd180981bef5f01402342bb54bf1c6366 +Patch-mainline: v5.13-rc1 +References: git-fixes + +MEMLOCK, MEMUNLOCK and OTPLOCK modify protection bits. Thus require +write permission. Depending on the hardware MEMLOCK might even be +write-once, e.g. for SPI-NOR flashes with their WP# tied to GND. OTPLOCK +is always write-once. + +MEMSETBADBLOCK modifies the bad block table. + +Fixes: f7e6b19bc764 ("mtd: properly check all write ioctls for permissions") +Signed-off-by: Michael Walle +Reviewed-by: Greg Kroah-Hartman +Acked-by: Rafał Miłecki +Acked-by: Richard Weinberger +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210303155735.25887-1-michael@walle.cc +Acked-by: Takashi Iwai + +--- + drivers/mtd/mtdchar.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c +index 998d86f46488..870f7a19ad9d 100644 +--- a/drivers/mtd/mtdchar.c ++++ b/drivers/mtd/mtdchar.c +@@ -643,16 +643,12 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) + case MEMGETINFO: + case MEMREADOOB: + case MEMREADOOB64: +- case MEMLOCK: +- case MEMUNLOCK: + case MEMISLOCKED: + case MEMGETOOBSEL: + case MEMGETBADBLOCK: +- case MEMSETBADBLOCK: + case OTPSELECT: + case OTPGETREGIONCOUNT: + case OTPGETREGIONINFO: +- case OTPLOCK: + case ECCGETLAYOUT: + case ECCGETSTATS: + case MTDFILEMODE: +@@ -663,9 +659,13 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) + /* "dangerous" commands */ + case MEMERASE: + case MEMERASE64: ++ case MEMLOCK: ++ case MEMUNLOCK: ++ case MEMSETBADBLOCK: + case MEMWRITEOOB: + case MEMWRITEOOB64: + case MEMWRITE: ++ case OTPLOCK: + if (!(file->f_mode & FMODE_WRITE)) + return -EPERM; + break; +-- +2.26.2 + diff --git a/patches.suse/mtd-spi-nor-Rename-n25q512a-to-mt25qu512a-n25q512a.patch b/patches.suse/mtd-spi-nor-Rename-n25q512a-to-mt25qu512a-n25q512a.patch new file mode 100644 index 0000000..4be5d99 --- /dev/null +++ b/patches.suse/mtd-spi-nor-Rename-n25q512a-to-mt25qu512a-n25q512a.patch @@ -0,0 +1,54 @@ +From: Ashish Kumar +Date: Thu, 29 Aug 2019 17:37:25 +0530 +Subject: mtd: spi-nor: Rename "n25q512a" to "mt25qu512a (n25q512a)" + +Git-commit: 9607af6f857ff062b29562fc1fe36d22b16b9d27 +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +n25q512a was rebranded to mt25qu512a after its spin off from STM. +mt25qu512a is different only in terms of operating frequency, the +JEDEC id is the same as in n25q512a. + +Dual reads are supported (0x3b, 0x3c), set the SPI_NOR_DUAL_READ flag. +4-byte opcodes are supported, set the SPI_NOR_4B_OPCODES flag. + +Tested Single I/O and QUAD I/O mode on LS1046FRWY. + +Signed-off-by: Kuldeep Singh +Signed-off-by: Ashish Kumar +Reviewed-by: Vignesh Raghavendra +[tudor.ambarus@microchip.com: rename entry to "mt25qu512a (n25q512a)", +reword commit message, order entry by size, drop comment as it looked +redundant] +Signed-off-by: Tudor Ambarus +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/mtd/spi-nor/spi-nor.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c +index 2129cddc1a87..1d8621d43160 100644 +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -2309,13 +2309,16 @@ static const struct flash_info spi_nor_ids[] = { + { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ) }, + { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, + { "n25q256ax1", INFO(0x20bb19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ) }, +- { "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) }, + { "n25q512ax3", INFO(0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) }, + { "n25q00", INFO(0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) }, + { "n25q00a", INFO(0x20bb21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) }, + { "mt25ql02g", INFO(0x20ba22, 0, 64 * 1024, 4096, + SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | + NO_CHIP_ERASE) }, ++ { "mt25qu512a (n25q512a)", INFO(0x20bb20, 0, 64 * 1024, 1024, ++ SECT_4K | USE_FSR | SPI_NOR_DUAL_READ | ++ SPI_NOR_QUAD_READ | ++ SPI_NOR_4B_OPCODES) }, + { "mt25qu02g", INFO(0x20bb22, 0, 64 * 1024, 4096, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) }, + + /* Micron */ +-- +2.26.2 + diff --git a/patches.suse/mtd-spi-nor-Split-mt25qu512a-n25q512a-entry-into-two.patch b/patches.suse/mtd-spi-nor-Split-mt25qu512a-n25q512a-entry-into-two.patch new file mode 100644 index 0000000..697ba7e --- /dev/null +++ b/patches.suse/mtd-spi-nor-Split-mt25qu512a-n25q512a-entry-into-two.patch @@ -0,0 +1,51 @@ +From: Vignesh Raghavendra +Date: Thu, 5 Dec 2019 12:29:33 +0530 +Subject: mtd: spi-nor: Split mt25qu512a (n25q512a) entry into two + +Git-commit: bd8a6e31b87b39a03ab11820776363640440dbe0 +Patch-mainline: v5.6-rc1 +References: bsc#1167260 + +mt25q family is different from n25q family of devices, even though manf +ID and device IDs are same. mt25q flash has bit 6 set in 5th byte of +READ ID response which can be used to distinguish it from n25q variant. +mt25q flashes support stateless 4 Byte addressing opcodes where as n25q +flashes don't. Therefore, have two separate entries for mt25qu512a and +n25q512a. + +Fixes: 9607af6f857f ("mtd: spi-nor: Rename "n25q512a" to "mt25qu512a (n25q512a)"") +Signed-off-by: Vignesh Raghavendra +Signed-off-by: Tudor Ambarus +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/mtd/spi-nor/spi-nor.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c +index d1c41afa5d8b..c9e054c8d437 100644 +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -2481,15 +2481,16 @@ static const struct flash_info spi_nor_ids[] = { + { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, + { "n25q256ax1", INFO(0x20bb19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ) }, + { "n25q512ax3", INFO(0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) }, ++ { "mt25qu512a", INFO6(0x20bb20, 0x104400, 64 * 1024, 1024, ++ SECT_4K | USE_FSR | SPI_NOR_DUAL_READ | ++ SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, ++ { "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K | ++ SPI_NOR_QUAD_READ) }, + { "n25q00", INFO(0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) }, + { "n25q00a", INFO(0x20bb21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) }, + { "mt25ql02g", INFO(0x20ba22, 0, 64 * 1024, 4096, + SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | + NO_CHIP_ERASE) }, +- { "mt25qu512a (n25q512a)", INFO(0x20bb20, 0, 64 * 1024, 1024, +- SECT_4K | USE_FSR | SPI_NOR_DUAL_READ | +- SPI_NOR_QUAD_READ | +- SPI_NOR_4B_OPCODES) }, + { "mt25qu02g", INFO(0x20bb22, 0, 64 * 1024, 4096, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) }, + + /* Micron */ +-- +2.26.2 + diff --git a/patches.suse/mtd-spinand-core-add-missing-MODULE_DEVICE_TABLE.patch b/patches.suse/mtd-spinand-core-add-missing-MODULE_DEVICE_TABLE.patch new file mode 100644 index 0000000..b543f39 --- /dev/null +++ b/patches.suse/mtd-spinand-core-add-missing-MODULE_DEVICE_TABLE.patch @@ -0,0 +1,46 @@ +From 25fefc88c71f47db0466570335e3f75f10952e7a Mon Sep 17 00:00:00 2001 +From: Alexander Lobakin +Date: Tue, 23 Mar 2021 17:37:19 +0000 +Subject: [PATCH] mtd: spinand: core: add missing MODULE_DEVICE_TABLE() +Git-commit: 25fefc88c71f47db0466570335e3f75f10952e7a +Patch-mainline: v5.13-rc1 +References: git-fixes + +The module misses MODULE_DEVICE_TABLE() for both SPI and OF ID tables +and thus never autoloads on ID matches. +Add the missing declarations. +Present since day-0 of spinand framework introduction. + +Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs") +Cc: stable@vger.kernel.org # 4.19+ +Signed-off-by: Alexander Lobakin +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210323173714.317884-1-alobakin@pm.me +Acked-by: Takashi Iwai + +--- + drivers/mtd/nand/spi/core.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c +index 61d932c1b718..17f63f95f4a2 100644 +--- a/drivers/mtd/nand/spi/core.c ++++ b/drivers/mtd/nand/spi/core.c +@@ -1263,12 +1263,14 @@ static const struct spi_device_id spinand_ids[] = { + { .name = "spi-nand" }, + { /* sentinel */ }, + }; ++MODULE_DEVICE_TABLE(spi, spinand_ids); + + #ifdef CONFIG_OF + static const struct of_device_id spinand_of_ids[] = { + { .compatible = "spi-nand" }, + { /* sentinel */ }, + }; ++MODULE_DEVICE_TABLE(of, spinand_of_ids); + #endif + + static struct spi_mem_driver spinand_drv = { +-- +2.26.2 + diff --git a/patches.suse/net-geneve-check-skb-is-large-enough-for-IPv4-IPv6-h.patch b/patches.suse/net-geneve-check-skb-is-large-enough-for-IPv4-IPv6-h.patch new file mode 100644 index 0000000..519a69b --- /dev/null +++ b/patches.suse/net-geneve-check-skb-is-large-enough-for-IPv4-IPv6-h.patch @@ -0,0 +1,47 @@ +From 6628ddfec7580882f11fdc5c194a8ea781fdadfa Mon Sep 17 00:00:00 2001 +From: Phillip Potter +Date: Sun, 11 Apr 2021 12:28:24 +0100 +Subject: [PATCH] net: geneve: check skb is large enough for IPv4/IPv6 header +Git-commit: 6628ddfec7580882f11fdc5c194a8ea781fdadfa +Patch-mainline: v5.12-rc8 +References: git-fixes + +Check within geneve_xmit_skb/geneve6_xmit_skb that sk_buff structure +is large enough to include IPv4 or IPv6 header, and reject if not. The +geneve_xmit_skb portion and overall idea was contributed by Eric Dumazet. +Fixes a KMSAN-found uninit-value bug reported by syzbot at: +https://syzkaller.appspot.com/bug?id=abe95dc3e3e9667fc23b8d81f29ecad95c6f106f + +Suggested-by: Eric Dumazet +Reported-by: syzbot+2e406a9ac75bb71d4b7a@syzkaller.appspotmail.com +Signed-off-by: Phillip Potter +Signed-off-by: Eric Dumazet +Signed-off-by: David S. Miller +Acked-by: Takashi Iwai + +--- + drivers/net/geneve.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/net/geneve.c ++++ b/drivers/net/geneve.c +@@ -892,6 +892,9 @@ static int geneve_xmit_skb(struct sk_buf + __be16 sport; + int err; + ++ if (!pskb_network_may_pull(skb, sizeof(struct iphdr))) ++ return -EINVAL; ++ + sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); + rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info, + geneve->info.key.tp_dst, sport); +@@ -955,6 +958,9 @@ static int geneve6_xmit_skb(struct sk_bu + __be16 sport; + int err; + ++ if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr))) ++ return -EINVAL; ++ + sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); + dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info, + geneve->info.key.tp_dst, sport); diff --git a/patches.suse/net-geneve-modify-IP-header-check-in-geneve6_xmit_sk.patch b/patches.suse/net-geneve-modify-IP-header-check-in-geneve6_xmit_sk.patch new file mode 100644 index 0000000..6d00869 --- /dev/null +++ b/patches.suse/net-geneve-modify-IP-header-check-in-geneve6_xmit_sk.patch @@ -0,0 +1,56 @@ +From d13f048dd40e8577260cd43faea8ec9b77520197 Mon Sep 17 00:00:00 2001 +From: Phillip Potter +Date: Fri, 23 Apr 2021 00:49:45 +0100 +Subject: [PATCH] net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb +Git-commit: d13f048dd40e8577260cd43faea8ec9b77520197 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Modify the header size check in geneve6_xmit_skb and geneve_xmit_skb +to use pskb_inet_may_pull rather than pskb_network_may_pull. This fixes +two kernel selftest failures introduced by the commit introducing the +Checks: +IPv4 over geneve6: PMTU exceptions +IPv4 over geneve6: PMTU exceptions - nexthop objects + +It does this by correctly accounting for the fact that IPv4 packets may +transit over geneve IPv6 tunnels (and vice versa), and still fixes the +uninit-value bug fixed by the original commit. + +Reported-by: kernel test robot +Fixes: 6628ddfec758 ("net: geneve: check skb is large enough for IPv4/IPv6 header") +Suggested-by: Sabrina Dubroca +Signed-off-by: Phillip Potter +Acked-by: Sabrina Dubroca +Signed-off-by: David S. Miller +Acked-by: Takashi Iwai + +--- + drivers/net/geneve.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c +index 42f31c681846..61cd3dd4deab 100644 +--- a/drivers/net/geneve.c ++++ b/drivers/net/geneve.c +@@ -891,7 +891,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, + __be16 sport; + int err; + +- if (!pskb_network_may_pull(skb, sizeof(struct iphdr))) ++ if (!pskb_inet_may_pull(skb)) + return -EINVAL; + + sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); +@@ -988,7 +988,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, + __be16 sport; + int err; + +- if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr))) ++ if (!pskb_inet_may_pull(skb)) + return -EINVAL; + + sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); +-- +2.26.2 + diff --git a/patches.suse/net-nfc-digital-Fix-a-double-free-in-digital_tg_recv.patch b/patches.suse/net-nfc-digital-Fix-a-double-free-in-digital_tg_recv.patch new file mode 100644 index 0000000..9aa90b4 --- /dev/null +++ b/patches.suse/net-nfc-digital-Fix-a-double-free-in-digital_tg_recv.patch @@ -0,0 +1,41 @@ +From 75258586793efc521e5dd52a5bf6c7a4cf7002be Mon Sep 17 00:00:00 2001 +From: Lv Yunlong +Date: Tue, 27 Apr 2021 09:22:58 -0700 +Subject: [PATCH] net:nfc:digital: Fix a double free in digital_tg_recv_dep_req +Git-commit: 75258586793efc521e5dd52a5bf6c7a4cf7002be +Patch-mainline: v5.13-rc1 +References: git-fixes + +In digital_tg_recv_dep_req, it calls nfc_tm_data_received(..,resp). +If nfc_tm_data_received() failed, the callee will free the resp via +kfree_skb() and return error. But in the exit branch, the resp +will be freed again. + +My patch sets resp to NULL if nfc_tm_data_received() failed, to +avoid the double free. + +Fixes: 1c7a4c24fbfd9 ("NFC Digital: Add target NFC-DEP support") +Signed-off-by: Lv Yunlong +Signed-off-by: David S. Miller +Acked-by: Takashi Iwai + +--- + net/nfc/digital_dep.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/net/nfc/digital_dep.c b/net/nfc/digital_dep.c +index 1150731126e2..3982fa084737 100644 +--- a/net/nfc/digital_dep.c ++++ b/net/nfc/digital_dep.c +@@ -1273,6 +1273,8 @@ static void digital_tg_recv_dep_req(struct nfc_digital_dev *ddev, void *arg, + } + + rc = nfc_tm_data_received(ddev->nfc_dev, resp); ++ if (rc) ++ resp = NULL; + + exit: + kfree_skb(ddev->chaining_skb); +-- +2.26.2 + diff --git a/patches.suse/net-phy-intel-xway-enable-integrated-led-functions.patch b/patches.suse/net-phy-intel-xway-enable-integrated-led-functions.patch new file mode 100644 index 0000000..9d785a1 --- /dev/null +++ b/patches.suse/net-phy-intel-xway-enable-integrated-led-functions.patch @@ -0,0 +1,71 @@ +From 357a07c26697a770d39d28b6b111f978deb4017d Mon Sep 17 00:00:00 2001 +From: Martin Schiller +Date: Wed, 21 Apr 2021 07:50:47 +0200 +Subject: [PATCH] net: phy: intel-xway: enable integrated led functions +Git-commit: 357a07c26697a770d39d28b6b111f978deb4017d +Patch-mainline: v5.13-rc1 +References: git-fixes + +The Intel xway phys offer the possibility to deactivate the integrated +LED function and to control the LEDs manually. +If this was set by the bootloader, it must be ensured that the +integrated LED function is enabled for all LEDs when loading the driver. + +Before commit 6e2d85ec0559 ("net: phy: Stop with excessive soft reset") +the LEDs were enabled by a soft-reset of the PHY (using +genphy_soft_reset). Initialize the XWAY_MDIO_LED with it's default +value (which is applied during a soft reset) instead of adding back +the soft reset. This brings back the default LED configuration while +still preventing an excessive amount of soft resets. + +Fixes: 6e2d85ec0559 ("net: phy: Stop with excessive soft reset") +Signed-off-by: Martin Schiller +Signed-off-by: David S. Miller +Acked-by: Takashi Iwai + +--- + drivers/net/phy/intel-xway.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/drivers/net/phy/intel-xway.c b/drivers/net/phy/intel-xway.c +index 6eac50d4b42f..d453ec016168 100644 +--- a/drivers/net/phy/intel-xway.c ++++ b/drivers/net/phy/intel-xway.c +@@ -11,6 +11,18 @@ + + #define XWAY_MDIO_IMASK 0x19 /* interrupt mask */ + #define XWAY_MDIO_ISTAT 0x1A /* interrupt status */ ++#define XWAY_MDIO_LED 0x1B /* led control */ ++ ++/* bit 15:12 are reserved */ ++#define XWAY_MDIO_LED_LED3_EN BIT(11) /* Enable the integrated function of LED3 */ ++#define XWAY_MDIO_LED_LED2_EN BIT(10) /* Enable the integrated function of LED2 */ ++#define XWAY_MDIO_LED_LED1_EN BIT(9) /* Enable the integrated function of LED1 */ ++#define XWAY_MDIO_LED_LED0_EN BIT(8) /* Enable the integrated function of LED0 */ ++/* bit 7:4 are reserved */ ++#define XWAY_MDIO_LED_LED3_DA BIT(3) /* Direct Access to LED3 */ ++#define XWAY_MDIO_LED_LED2_DA BIT(2) /* Direct Access to LED2 */ ++#define XWAY_MDIO_LED_LED1_DA BIT(1) /* Direct Access to LED1 */ ++#define XWAY_MDIO_LED_LED0_DA BIT(0) /* Direct Access to LED0 */ + + #define XWAY_MDIO_INIT_WOL BIT(15) /* Wake-On-LAN */ + #define XWAY_MDIO_INIT_MSRE BIT(14) +@@ -159,6 +171,15 @@ static int xway_gphy_config_init(struct phy_device *phydev) + /* Clear all pending interrupts */ + phy_read(phydev, XWAY_MDIO_ISTAT); + ++ /* Ensure that integrated led function is enabled for all leds */ ++ err = phy_write(phydev, XWAY_MDIO_LED, ++ XWAY_MDIO_LED_LED0_EN | ++ XWAY_MDIO_LED_LED1_EN | ++ XWAY_MDIO_LED_LED2_EN | ++ XWAY_MDIO_LED_LED3_EN); ++ if (err) ++ return err; ++ + phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDCH, + XWAY_MMD_LEDCH_NACS_NONE | + XWAY_MMD_LEDCH_SBF_F02HZ | +-- +2.26.2 + diff --git a/patches.suse/net-phy-marvell-fix-m88e1011_set_downshift.patch b/patches.suse/net-phy-marvell-fix-m88e1011_set_downshift.patch new file mode 100644 index 0000000..0dfe82c --- /dev/null +++ b/patches.suse/net-phy-marvell-fix-m88e1011_set_downshift.patch @@ -0,0 +1,72 @@ +From 990875b299b8612aeb85cb2e2751796f1add65ff Mon Sep 17 00:00:00 2001 +From: Maxim Kochetkov +Date: Thu, 22 Apr 2021 13:46:43 +0300 +Subject: [PATCH] net: phy: marvell: fix m88e1011_set_downshift +Git-commit: 990875b299b8612aeb85cb2e2751796f1add65ff +Patch-mainline: v5.13-rc1 +References: git-fixes + +Changing downshift params without software reset has no effect, +so call genphy_soft_reset() after change downshift params. + +As the datasheet says: +Changes to these bits are disruptive to the normal operation therefore, +any changes to these registers must be followed by software reset +to take effect. + +Fixes: 911af5e149bb ("net: phy: marvell: fix downshift function naming") +Signed-off-by: Maxim Kochetkov +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +Acked-by: Takashi Iwai + +--- + drivers/net/phy/marvell.c | 26 ++++++++++++++++---------- + 1 file changed, 16 insertions(+), 10 deletions(-) + +diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c +index 8018ddf7f316..723f25f6138d 100644 +--- a/drivers/net/phy/marvell.c ++++ b/drivers/net/phy/marvell.c +@@ -1025,22 +1025,28 @@ static int m88e1011_get_downshift(struct phy_device *phydev, u8 *data) + + static int m88e1011_set_downshift(struct phy_device *phydev, u8 cnt) + { +- int val; ++ int val, err; + + if (cnt > MII_M1011_PHY_SCR_DOWNSHIFT_MAX) + return -E2BIG; + +- if (!cnt) +- return phy_clear_bits(phydev, MII_M1011_PHY_SCR, +- MII_M1011_PHY_SCR_DOWNSHIFT_EN); ++ if (!cnt) { ++ err = phy_clear_bits(phydev, MII_M1011_PHY_SCR, ++ MII_M1011_PHY_SCR_DOWNSHIFT_EN); ++ } else { ++ val = MII_M1011_PHY_SCR_DOWNSHIFT_EN; ++ val |= FIELD_PREP(MII_M1011_PHY_SCR_DOWNSHIFT_MASK, cnt - 1); + +- val = MII_M1011_PHY_SCR_DOWNSHIFT_EN; +- val |= FIELD_PREP(MII_M1011_PHY_SCR_DOWNSHIFT_MASK, cnt - 1); ++ err = phy_modify(phydev, MII_M1011_PHY_SCR, ++ MII_M1011_PHY_SCR_DOWNSHIFT_EN | ++ MII_M1011_PHY_SCR_DOWNSHIFT_MASK, ++ val); ++ } + +- return phy_modify(phydev, MII_M1011_PHY_SCR, +- MII_M1011_PHY_SCR_DOWNSHIFT_EN | +- MII_M1011_PHY_SCR_DOWNSHIFT_MASK, +- val); ++ if (err < 0) ++ return err; ++ ++ return genphy_soft_reset(phydev); + } + + static int m88e1011_get_tunable(struct phy_device *phydev, +-- +2.26.2 + diff --git a/patches.suse/net-phy-marvell-fix-m88e1111_set_downshift.patch b/patches.suse/net-phy-marvell-fix-m88e1111_set_downshift.patch new file mode 100644 index 0000000..93e62dc --- /dev/null +++ b/patches.suse/net-phy-marvell-fix-m88e1111_set_downshift.patch @@ -0,0 +1,72 @@ +From e7679c55a7249f1315256cfc672d53e84072e223 Mon Sep 17 00:00:00 2001 +From: Maxim Kochetkov +Date: Thu, 22 Apr 2021 13:46:44 +0300 +Subject: [PATCH] net: phy: marvell: fix m88e1111_set_downshift +Git-commit: e7679c55a7249f1315256cfc672d53e84072e223 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Changing downshift params without software reset has no effect, +so call genphy_soft_reset() after change downshift params. + +As the datasheet says: +Changes to these bits are disruptive to the normal operation therefore, +any changes to these registers must be followed by software reset +to take effect. + +Fixes: 5c6bc5199b5d ("net: phy: marvell: add downshift support for M88E1111") +Signed-off-by: Maxim Kochetkov +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +Acked-by: Takashi Iwai + +--- + drivers/net/phy/marvell.c | 26 ++++++++++++++++---------- + 1 file changed, 16 insertions(+), 10 deletions(-) + +diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c +index 723f25f6138d..f86c9ddc609e 100644 +--- a/drivers/net/phy/marvell.c ++++ b/drivers/net/phy/marvell.c +@@ -967,22 +967,28 @@ static int m88e1111_get_downshift(struct phy_device *phydev, u8 *data) + + static int m88e1111_set_downshift(struct phy_device *phydev, u8 cnt) + { +- int val; ++ int val, err; + + if (cnt > MII_M1111_PHY_EXT_CR_DOWNSHIFT_MAX) + return -E2BIG; + +- if (!cnt) +- return phy_clear_bits(phydev, MII_M1111_PHY_EXT_CR, +- MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN); ++ if (!cnt) { ++ err = phy_clear_bits(phydev, MII_M1111_PHY_EXT_CR, ++ MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN); ++ } else { ++ val = MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN; ++ val |= FIELD_PREP(MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK, cnt - 1); + +- val = MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN; +- val |= FIELD_PREP(MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK, cnt - 1); ++ err = phy_modify(phydev, MII_M1111_PHY_EXT_CR, ++ MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN | ++ MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK, ++ val); ++ } + +- return phy_modify(phydev, MII_M1111_PHY_EXT_CR, +- MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN | +- MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK, +- val); ++ if (err < 0) ++ return err; ++ ++ return genphy_soft_reset(phydev); + } + + static int m88e1111_get_tunable(struct phy_device *phydev, +-- +2.26.2 + diff --git a/patches.suse/nfc-pn533-prevent-potential-memory-corruption.patch b/patches.suse/nfc-pn533-prevent-potential-memory-corruption.patch new file mode 100644 index 0000000..c3b43d2 --- /dev/null +++ b/patches.suse/nfc-pn533-prevent-potential-memory-corruption.patch @@ -0,0 +1,39 @@ +From ca4d4c34ae9aa5c3c0da76662c5e549d2fc0cc86 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Fri, 2 Apr 2021 14:44:42 +0300 +Subject: [PATCH] nfc: pn533: prevent potential memory corruption +Git-commit: ca4d4c34ae9aa5c3c0da76662c5e549d2fc0cc86 +Patch-mainline: v5.13-rc1 +References: git-fixes + +If the "type_a->nfcid_len" is too large then it would lead to memory +corruption in pn533_target_found_type_a() when we do: + + memcpy(nfc_tgt->nfcid1, tgt_type_a->nfcid_data, nfc_tgt->nfcid1_len); + +Fixes: c3b1e1e8a76f ("NFC: Export NFCID1 from pn533") +Signed-off-by: Dan Carpenter +Signed-off-by: David S. Miller +Acked-by: Takashi Iwai + +--- + drivers/nfc/pn533/pn533.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c +index f1469ac8ff42..3fe5b81eda2d 100644 +--- a/drivers/nfc/pn533/pn533.c ++++ b/drivers/nfc/pn533/pn533.c +@@ -706,6 +706,9 @@ static bool pn533_target_type_a_is_valid(struct pn533_target_type_a *type_a, + if (PN533_TYPE_A_SEL_CASCADE(type_a->sel_res) != 0) + return false; + ++ if (type_a->nfcid_len > NFC_NFCID1_MAXSIZE) ++ return false; ++ + return true; + } + +-- +2.26.2 + diff --git a/patches.suse/node-fix-device-cleanups-in-error-handling-code.patch b/patches.suse/node-fix-device-cleanups-in-error-handling-code.patch new file mode 100644 index 0000000..12dd23b --- /dev/null +++ b/patches.suse/node-fix-device-cleanups-in-error-handling-code.patch @@ -0,0 +1,92 @@ +From 4ce535ec0084f0d712317cb99d383cad3288e713 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Fri, 9 Apr 2021 14:01:57 +0300 +Subject: [PATCH] node: fix device cleanups in error handling code +Git-commit: 4ce535ec0084f0d712317cb99d383cad3288e713 +Patch-mainline: v5.13-rc1 +References: git-fixes + +We can't use kfree() to free device managed resources so the kfree(dev) +is against the rules. + +It's easier to write this code if we open code the device_register() as +a device_initialize() and device_add(). That way if dev_set_name() set +name fails we can call put_device() and it will clean up correctly. + +Fixes: acc02a109b04 ("node: Add memory-side caching attributes") +Signed-off-by: Dan Carpenter +Link: https://lore.kernel.org/r/YHA0JUra+F64+NpB@mwanda +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/base/node.c | 26 ++++++++++++-------------- + 1 file changed, 12 insertions(+), 14 deletions(-) + +diff --git a/drivers/base/node.c b/drivers/base/node.c +index f449dbb2c746..2c36f61d30bc 100644 +--- a/drivers/base/node.c ++++ b/drivers/base/node.c +@@ -268,21 +268,20 @@ static void node_init_cache_dev(struct node *node) + if (!dev) + return; + ++ device_initialize(dev); + dev->parent = &node->dev; + dev->release = node_cache_release; + if (dev_set_name(dev, "memory_side_cache")) +- goto free_dev; ++ goto put_device; + +- if (device_register(dev)) +- goto free_name; ++ if (device_add(dev)) ++ goto put_device; + + pm_runtime_no_callbacks(dev); + node->cache_dev = dev; + return; +-free_name: +- kfree_const(dev->kobj.name); +-free_dev: +- kfree(dev); ++put_device: ++ put_device(dev); + } + + /** +@@ -319,25 +318,24 @@ void node_add_cache(unsigned int nid, struct node_cache_attrs *cache_attrs) + return; + + dev = &info->dev; ++ device_initialize(dev); + dev->parent = node->cache_dev; + dev->release = node_cacheinfo_release; + dev->groups = cache_groups; + if (dev_set_name(dev, "index%d", cache_attrs->level)) +- goto free_cache; ++ goto put_device; + + info->cache_attrs = *cache_attrs; +- if (device_register(dev)) { ++ if (device_add(dev)) { + dev_warn(&node->dev, "failed to add cache level:%d\n", + cache_attrs->level); +- goto free_name; ++ goto put_device; + } + pm_runtime_no_callbacks(dev); + list_add_tail(&info->node, &node->cache_attrs); + return; +-free_name: +- kfree_const(dev->kobj.name); +-free_cache: +- kfree(info); ++put_device: ++ put_device(dev); + } + + static void node_remove_caches(struct node *node) +-- +2.26.2 + diff --git a/patches.suse/pata_arasan_cf-fix-IRQ-check.patch b/patches.suse/pata_arasan_cf-fix-IRQ-check.patch new file mode 100644 index 0000000..a67cccd --- /dev/null +++ b/patches.suse/pata_arasan_cf-fix-IRQ-check.patch @@ -0,0 +1,51 @@ +From c7e8f404d56b99c80990b19a402c3f640d74be05 Mon Sep 17 00:00:00 2001 +From: Sergey Shtylyov +Date: Thu, 25 Mar 2021 23:50:24 +0300 +Subject: [PATCH] pata_arasan_cf: fix IRQ check +Git-commit: c7e8f404d56b99c80990b19a402c3f640d74be05 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The driver's probe() method is written as if platform_get_irq() returns 0 +on error, while actually it returns a negative error code (with all the +other values considered valid IRQs). Rewrite the driver's IRQ checking code +to pass the positive IRQ #s to ata_host_activate(), propagate upstream +-EPROBE_DEFER, and set up the driver to polling mode on (negative) errors +and IRQ0 (libata treats IRQ #0 as a polling mode anyway)... + +Fixes: a480167b23ef ("pata_arasan_cf: Adding support for arasan compact flash host controller") +Signed-off-by: Sergey Shtylyov +Acked-by: Viresh Kumar +Signed-off-by: Jens Axboe +Acked-by: Takashi Iwai + +--- + drivers/ata/pata_arasan_cf.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +--- a/drivers/ata/pata_arasan_cf.c ++++ b/drivers/ata/pata_arasan_cf.c +@@ -817,12 +817,19 @@ static int arasan_cf_probe(struct platfo + else + quirk = CF_BROKEN_UDMA; /* as it is on spear1340 */ + +- /* if irq is 0, support only PIO */ +- acdev->irq = platform_get_irq(pdev, 0); +- if (acdev->irq) ++ /* ++ * If there's an error getting IRQ (or we do get IRQ0), ++ * support only PIO ++ */ ++ ret = platform_get_irq(pdev, 0); ++ if (ret > 0) { ++ acdev->irq = ret; + irq_handler = arasan_cf_interrupt; +- else ++ } else if (ret == -EPROBE_DEFER) { ++ return ret; ++ } else { + quirk |= CF_BROKEN_MWDMA | CF_BROKEN_UDMA; ++ } + + acdev->pbase = res->start; + acdev->vbase = devm_ioremap_nocache(&pdev->dev, res->start, diff --git a/patches.suse/pata_ipx4xx_cf-fix-IRQ-check.patch b/patches.suse/pata_ipx4xx_cf-fix-IRQ-check.patch new file mode 100644 index 0000000..50715bf --- /dev/null +++ b/patches.suse/pata_ipx4xx_cf-fix-IRQ-check.patch @@ -0,0 +1,45 @@ +From e379b40cc0f179403ce0b82b7e539f635a568da5 Mon Sep 17 00:00:00 2001 +From: Sergey Shtylyov +Date: Thu, 25 Mar 2021 23:51:10 +0300 +Subject: [PATCH] pata_ipx4xx_cf: fix IRQ check +Git-commit: e379b40cc0f179403ce0b82b7e539f635a568da5 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The driver's probe() method is written as if platform_get_irq() returns 0 +on error, while actually it returns a negative error code (with all the +other values considered valid IRQs). Rewrite the driver's IRQ checking +code to pass the positive IRQ #s to ata_host_activate(), propagate errors +upstream, and treat IRQ0 as error, returning -EINVAL, as the libata code +treats 0 as an indication that polling should be used anyway... + +Fixes: 0df0d0a0ea9f ("[libata] ARM: add ixp4xx PATA driver") +Signed-off-by: Sergey Shtylyov +Signed-off-by: Jens Axboe +Acked-by: Takashi Iwai + +--- + drivers/ata/pata_ixp4xx_cf.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c +index d1644a8ef9fa..abc0e87ca1a8 100644 +--- a/drivers/ata/pata_ixp4xx_cf.c ++++ b/drivers/ata/pata_ixp4xx_cf.c +@@ -165,8 +165,12 @@ static int ixp4xx_pata_probe(struct platform_device *pdev) + return -ENOMEM; + + irq = platform_get_irq(pdev, 0); +- if (irq) ++ if (irq > 0) + irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING); ++ else if (irq < 0) ++ return irq; ++ else ++ return -EINVAL; + + /* Setup expansion bus chip selects */ + *data->cs0_cfg = data->cs0_bits; +-- +2.26.2 + diff --git a/patches.suse/phy-marvell-ARMADA375_USBCLUSTER_PHY-should-not-defa.patch b/patches.suse/phy-marvell-ARMADA375_USBCLUSTER_PHY-should-not-defa.patch new file mode 100644 index 0000000..8a3cc92 --- /dev/null +++ b/patches.suse/phy-marvell-ARMADA375_USBCLUSTER_PHY-should-not-defa.patch @@ -0,0 +1,40 @@ +From 6cb17707aad869de163d7bf42c253caf501be4e2 Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Mon, 8 Feb 2021 16:02:52 +0100 +Subject: [PATCH] phy: marvell: ARMADA375_USBCLUSTER_PHY should not default to y, unconditionally +Git-commit: 6cb17707aad869de163d7bf42c253caf501be4e2 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Merely enabling CONFIG_COMPILE_TEST should not enable additional code. +To fix this, restrict the automatic enabling of ARMADA375_USBCLUSTER_PHY +to MACH_ARMADA_375, and ask the user in case of compile-testing. + +Fixes: eee47538ec1f2619 ("phy: add support for USB cluster on the Armada 375 SoC") +Signed-off-by: Geert Uytterhoeven +Link: https://lore.kernel.org/r/20210208150252.424706-1-geert+renesas@glider.be +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/phy/marvell/Kconfig | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/phy/marvell/Kconfig b/drivers/phy/marvell/Kconfig +index 9208839019bd..c5651ef70666 100644 +--- a/drivers/phy/marvell/Kconfig ++++ b/drivers/phy/marvell/Kconfig +@@ -3,8 +3,8 @@ + # Phy drivers for Marvell platforms + # + config ARMADA375_USBCLUSTER_PHY +- def_bool y +- depends on MACH_ARMADA_375 || COMPILE_TEST ++ bool "Armada 375 USB cluster PHY support" if COMPILE_TEST ++ default y if MACH_ARMADA_375 + depends on OF && HAS_IOMEM + select GENERIC_PHY + +-- +2.26.2 + diff --git a/patches.suse/pinctrl-Ingenic-Add-missing-pins-to-the-JZ4770-MAC-M.patch b/patches.suse/pinctrl-Ingenic-Add-missing-pins-to-the-JZ4770-MAC-M.patch new file mode 100644 index 0000000..91b328b --- /dev/null +++ b/patches.suse/pinctrl-Ingenic-Add-missing-pins-to-the-JZ4770-MAC-M.patch @@ -0,0 +1,40 @@ +From 65afd97630a9d6dd9ea83ff182dfdb15bc58c5d1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=E5=91=A8=E7=90=B0=E6=9D=B0=20=28Zhou=20Yanjie=29?= +Date: Sun, 18 Apr 2021 22:44:22 +0800 +Subject: [PATCH] pinctrl: Ingenic: Add missing pins to the JZ4770 MAC MII group. +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 65afd97630a9d6dd9ea83ff182dfdb15bc58c5d1 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The MII group of JZ4770's MAC should have 7 pins, add missing +pins to the MII group. + +Fixes: 5de1a73e78ed ("Pinctrl: Ingenic: Add missing parts for JZ4770 and JZ4780.") +Cc: +Signed-off-by: 周琰杰 (Zhou Yanjie) +Reviewed-by: Andy Shevchenko +Reviewed-by: Paul Cercueil +Link: https://lore.kernel.org/r/1618757073-1724-2-git-send-email-zhouyanjie@wanyeetech.com +Signed-off-by: Linus Walleij +Acked-by: Takashi Iwai + +--- + drivers/pinctrl/pinctrl-ingenic.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/pinctrl/pinctrl-ingenic.c ++++ b/drivers/pinctrl/pinctrl-ingenic.c +@@ -413,7 +413,9 @@ static int jz4770_pwm_pwm7_pins[] = { 0x + static int jz4770_mac_rmii_pins[] = { + 0xa9, 0xab, 0xaa, 0xac, 0xa5, 0xa4, 0xad, 0xae, 0xa6, 0xa8, + }; +-static int jz4770_mac_mii_pins[] = { 0xa7, 0xaf, }; ++static int jz4770_mac_mii_pins[] = { ++ 0x7b, 0x7a, 0x7d, 0x7c, 0xa7, 0x24, 0xaf, ++}; + + static int jz4770_uart0_data_funcs[] = { 0, 0, }; + static int jz4770_uart0_hwflow_funcs[] = { 0, 0, }; diff --git a/patches.suse/pinctrl-core-Fix-kernel-doc-string-for-pin_get_name.patch b/patches.suse/pinctrl-core-Fix-kernel-doc-string-for-pin_get_name.patch new file mode 100644 index 0000000..a37e7de --- /dev/null +++ b/patches.suse/pinctrl-core-Fix-kernel-doc-string-for-pin_get_name.patch @@ -0,0 +1,35 @@ +From 11f054c114f261ae04fc0b2ad9c1d4e1becd8b14 Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Thu, 15 Apr 2021 15:35:21 +0300 +Subject: [PATCH] pinctrl: core: Fix kernel doc string for pin_get_name() +Git-commit: 11f054c114f261ae04fc0b2ad9c1d4e1becd8b14 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The kernel doc string mistakenly advertises the pin_get_name_from_id(). +Fix it, otherwise kernel doc validator is not happy: + +.../core.c:168: warning: expecting prototype for pin_get_name_from_id(). Prototype was for pin_get_name() instead + +Fixes: dcb5dbc305b9 ("pinctrl: show pin name for pingroups in sysfs") +Cc: Dong Aisheng +Signed-off-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20210415123521.86894-1-andriy.shevchenko@linux.intel.com +Signed-off-by: Linus Walleij +Acked-by: Takashi Iwai + +--- + drivers/pinctrl/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/pinctrl/core.c ++++ b/drivers/pinctrl/core.c +@@ -159,7 +159,7 @@ int pin_get_from_name(struct pinctrl_dev + } + + /** +- * pin_get_name_from_id() - look up a pin name from a pin id ++ * pin_get_name() - look up a pin name from a pin id + * @pctldev: the pin control device to lookup the pin on + * @name: the name of the pin to look up + */ diff --git a/patches.suse/pinctrl-lewisburg-Update-number-of-pins-in-community.patch b/patches.suse/pinctrl-lewisburg-Update-number-of-pins-in-community.patch new file mode 100644 index 0000000..07fc34f --- /dev/null +++ b/patches.suse/pinctrl-lewisburg-Update-number-of-pins-in-community.patch @@ -0,0 +1,40 @@ +From 196d941753297d0ca73c563ccd7d00be049ec226 Mon Sep 17 00:00:00 2001 +From: Yuanyuan Zhong +Date: Mon, 12 Apr 2021 17:17:59 -0600 +Subject: [PATCH] pinctrl: lewisburg: Update number of pins in community +Git-commit: 196d941753297d0ca73c563ccd7d00be049ec226 +Patch-mainline: v5.12 +References: git-fixes + +When updating pin names for Intel Lewisburg, the numbers of pins were +left behind. Update them accordingly. + +Fixes: e66ff71fd0db ("pinctrl: lewisburg: Update pin list according to v1.1v6") +Signed-off-by: Yuanyuan Zhong +Signed-off-by: Andy Shevchenko +Acked-by: Takashi Iwai + +--- + drivers/pinctrl/intel/pinctrl-lewisburg.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/pinctrl/intel/pinctrl-lewisburg.c b/drivers/pinctrl/intel/pinctrl-lewisburg.c +index 7fdf4257df1e..ad4b446d588e 100644 +--- a/drivers/pinctrl/intel/pinctrl-lewisburg.c ++++ b/drivers/pinctrl/intel/pinctrl-lewisburg.c +@@ -299,9 +299,9 @@ static const struct pinctrl_pin_desc lbg_pins[] = { + static const struct intel_community lbg_communities[] = { + LBG_COMMUNITY(0, 0, 71), + LBG_COMMUNITY(1, 72, 132), +- LBG_COMMUNITY(3, 133, 144), +- LBG_COMMUNITY(4, 145, 180), +- LBG_COMMUNITY(5, 181, 246), ++ LBG_COMMUNITY(3, 133, 143), ++ LBG_COMMUNITY(4, 144, 178), ++ LBG_COMMUNITY(5, 179, 246), + }; + + static const struct intel_pinctrl_soc_data lbg_soc_data = { +-- +2.26.2 + diff --git a/patches.suse/platform-x86-pmc_atom-Match-all-Beckhoff-Automation-.patch b/patches.suse/platform-x86-pmc_atom-Match-all-Beckhoff-Automation-.patch new file mode 100644 index 0000000..ae294b9 --- /dev/null +++ b/patches.suse/platform-x86-pmc_atom-Match-all-Beckhoff-Automation-.patch @@ -0,0 +1,73 @@ +From d21e5abd3a005253eb033090aab2e43bce090d89 Mon Sep 17 00:00:00 2001 +From: Steffen Dirkwinkel +Date: Mon, 12 Apr 2021 15:30:06 +0200 +Subject: [PATCH] platform/x86: pmc_atom: Match all Beckhoff Automation baytrail boards with critclk_systems DMI table +Git-commit: d21e5abd3a005253eb033090aab2e43bce090d89 +Patch-mainline: v5.13-rc1 +References: git-fixes + +pmc_plt_clk* clocks are used for ethernet controllers, so need to stay +turned on. This adds the affected board family to critclk_systems DMI +table, so the clocks are marked as CLK_CRITICAL and not turned off. + +This replaces the previously listed boards with a match for the whole +device family CBxx63. CBxx63 matches only baytrail devices. +There are new affected boards that would otherwise need to be listed. +There are unaffected boards in the family, but having the clocks +turned on is not an issue. + +Fixes: 648e921888ad ("clk: x86: Stop marking clocks as CLK_IS_CRITICAL") +Reviewed-by: Andy Shevchenko +Signed-off-by: Steffen Dirkwinkel +Link: https://lore.kernel.org/r/20210412133006.397679-1-linux-kernel-dev@beckhoff.com +Signed-off-by: Hans de Goede +Acked-by: Takashi Iwai + +--- + drivers/platform/x86/pmc_atom.c | 28 ++-------------------------- + 1 file changed, 2 insertions(+), 26 deletions(-) + +diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c +index ca684ed760d1..a9d2a4b98e57 100644 +--- a/drivers/platform/x86/pmc_atom.c ++++ b/drivers/platform/x86/pmc_atom.c +@@ -393,34 +393,10 @@ static const struct dmi_system_id critclk_systems[] = { + }, + { + /* pmc_plt_clk* - are used for ethernet controllers */ +- .ident = "Beckhoff CB3163", ++ .ident = "Beckhoff Baytrail", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Beckhoff Automation"), +- DMI_MATCH(DMI_BOARD_NAME, "CB3163"), +- }, +- }, +- { +- /* pmc_plt_clk* - are used for ethernet controllers */ +- .ident = "Beckhoff CB4063", +- .matches = { +- DMI_MATCH(DMI_SYS_VENDOR, "Beckhoff Automation"), +- DMI_MATCH(DMI_BOARD_NAME, "CB4063"), +- }, +- }, +- { +- /* pmc_plt_clk* - are used for ethernet controllers */ +- .ident = "Beckhoff CB6263", +- .matches = { +- DMI_MATCH(DMI_SYS_VENDOR, "Beckhoff Automation"), +- DMI_MATCH(DMI_BOARD_NAME, "CB6263"), +- }, +- }, +- { +- /* pmc_plt_clk* - are used for ethernet controllers */ +- .ident = "Beckhoff CB6363", +- .matches = { +- DMI_MATCH(DMI_SYS_VENDOR, "Beckhoff Automation"), +- DMI_MATCH(DMI_BOARD_NAME, "CB6363"), ++ DMI_MATCH(DMI_PRODUCT_FAMILY, "CBxx63"), + }, + }, + { +-- +2.26.2 + diff --git a/patches.suse/powerpc-64s-Fix-pte-update-for-kernel-memory-on-radi.patch b/patches.suse/powerpc-64s-Fix-pte-update-for-kernel-memory-on-radi.patch new file mode 100644 index 0000000..1ef8b29 --- /dev/null +++ b/patches.suse/powerpc-64s-Fix-pte-update-for-kernel-memory-on-radi.patch @@ -0,0 +1,148 @@ +From b8b2f37cf632434456182e9002d63cbc4cccc50c Mon Sep 17 00:00:00 2001 +From: Jordan Niethe +Date: Mon, 8 Feb 2021 14:29:56 +1100 +Subject: [PATCH] powerpc/64s: Fix pte update for kernel memory on radix + +References: bsc#1055117 git-fixes +Patch-mainline: v5.13-rc1 +Git-commit: b8b2f37cf632434456182e9002d63cbc4cccc50c + +When adding a PTE a ptesync is needed to order the update of the PTE +with subsequent accesses otherwise a spurious fault may be raised. + +radix__set_pte_at() does not do this for performance gains. For +non-kernel memory this is not an issue as any faults of this kind are +corrected by the page fault handler. For kernel memory these faults +are not handled. The current solution is that there is a ptesync in +flush_cache_vmap() which should be called when mapping from the +vmalloc region. + +However, map_kernel_page() does not call flush_cache_vmap(). This is +troublesome in particular for code patching with Strict RWX on radix. +In do_patch_instruction() the page frame that contains the instruction +to be patched is mapped and then immediately patched. With no ordering +or synchronization between setting up the PTE and writing to the page +it is possible for faults. + +As the code patching is done using __put_user_asm_goto() the resulting +fault is obscured - but using a normal store instead it can be seen: + + BUG: Unable to handle kernel data access on write at 0xc008000008f24a3c + Faulting instruction address: 0xc00000000008bd74 + Oops: Kernel access of bad area, sig: 11 [#1] + LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA PowerNV + Modules linked in: nop_module(PO+) [last unloaded: nop_module] + CPU: 4 PID: 757 Comm: sh Tainted: P O 5.10.0-rc5-01361-ge3c1b78c8440-dirty #43 + NIP: c00000000008bd74 LR: c00000000008bd50 CTR: c000000000025810 + REGS: c000000016f634a0 TRAP: 0300 Tainted: P O (5.10.0-rc5-01361-ge3c1b78c8440-dirty) + MSR: 9000000000009033 CR: 44002884 XER: 00000000 + CFAR: c00000000007c68c DAR: c008000008f24a3c DSISR: 42000000 IRQMASK: 1 + +This results in the kind of issue reported here: + https://lore.kernel.org/linuxppc-dev/15AC5B0E-A221-4B8C-9039-FA96B8EF7C88@lca.pw/ + +Chris Riedl suggested a reliable way to reproduce the issue: + $ mount -t debugfs none /sys/kernel/debug + $ (while true; do echo function > /sys/kernel/debug/tracing/current_tracer ; echo nop > /sys/kernel/debug/tracing/current_tracer ; done) & + +Turning ftrace on and off does a large amount of code patching which +in usually less then 5min will crash giving a trace like: + + ftrace-powerpc: (____ptrval____): replaced (4b473b11) != old (60000000) + ------------[ ftrace bug ]------------ + ftrace failed to modify + [] napi_busy_loop+0xc/0x390 + actual: 11:3b:47:4b + Setting ftrace call site to call ftrace function + ftrace record flags: 80000001 + (1) + expected tramp: c00000000006c96c + ------------[ cut here ]------------ + WARNING: CPU: 4 PID: 809 at kernel/trace/ftrace.c:2065 ftrace_bug+0x28c/0x2e8 + Modules linked in: nop_module(PO-) [last unloaded: nop_module] + CPU: 4 PID: 809 Comm: sh Tainted: P O 5.10.0-rc5-01360-gf878ccaf250a #1 + NIP: c00000000024f334 LR: c00000000024f330 CTR: c0000000001a5af0 + REGS: c000000004c8b760 TRAP: 0700 Tainted: P O (5.10.0-rc5-01360-gf878ccaf250a) + MSR: 900000000282b033 CR: 28008848 XER: 20040000 + CFAR: c0000000001a9c98 IRQMASK: 0 + GPR00: c00000000024f330 c000000004c8b9f0 c000000002770600 0000000000000022 + GPR04: 00000000ffff7fff c000000004c8b6d0 0000000000000027 c0000007fe9bcdd8 + GPR08: 0000000000000023 ffffffffffffffd8 0000000000000027 c000000002613118 + GPR12: 0000000000008000 c0000007fffdca00 0000000000000000 0000000000000000 + GPR16: 0000000023ec37c5 0000000000000000 0000000000000000 0000000000000008 + GPR20: c000000004c8bc90 c0000000027a2d20 c000000004c8bcd0 c000000002612fe8 + GPR24: 0000000000000038 0000000000000030 0000000000000028 0000000000000020 + GPR28: c000000000ff1b68 c000000000bf8e5c c00000000312f700 c000000000fbb9b0 + NIP ftrace_bug+0x28c/0x2e8 + LR ftrace_bug+0x288/0x2e8 + Call Trace: + ftrace_bug+0x288/0x2e8 (unreliable) + ftrace_modify_all_code+0x168/0x210 + arch_ftrace_update_code+0x18/0x30 + ftrace_run_update_code+0x44/0xc0 + ftrace_startup+0xf8/0x1c0 + register_ftrace_function+0x4c/0xc0 + function_trace_init+0x80/0xb0 + tracing_set_tracer+0x2a4/0x4f0 + tracing_set_trace_write+0xd4/0x130 + vfs_write+0xf0/0x330 + ksys_write+0x84/0x140 + system_call_exception+0x14c/0x230 + system_call_common+0xf0/0x27c + +To fix this when updating kernel memory PTEs using ptesync. + +Fixes: f1cb8f9beba8 ("powerpc/64s/radix: avoid ptesync after set_pte and ptep_set_access_flags") +Signed-off-by: Jordan Niethe +Reviewed-by: Nicholas Piggin +[mpe: Tidy up change log slightly] +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20210208032957.1232102-1-jniethe5@gmail.com +Acked-by: Michal Suchanek +--- + arch/powerpc/include/asm/book3s/64/radix.h | 6 ++++-- + arch/powerpc/mm/book3s64/radix_pgtable.c | 4 ++-- + 2 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/arch/powerpc/include/asm/book3s/64/radix.h b/arch/powerpc/include/asm/book3s/64/radix.h +index c7813dc628fc..59cab558e2f0 100644 +--- a/arch/powerpc/include/asm/book3s/64/radix.h ++++ b/arch/powerpc/include/asm/book3s/64/radix.h +@@ -222,8 +222,10 @@ static inline void radix__set_pte_at(struct mm_struct *mm, unsigned long addr, + * from ptesync, it should probably go into update_mmu_cache, rather + * than set_pte_at (which is used to set ptes unrelated to faults). + * +- * Spurious faults to vmalloc region are not tolerated, so there is +- * a ptesync in flush_cache_vmap. ++ * Spurious faults from the kernel memory are not tolerated, so there ++ * is a ptesync in flush_cache_vmap, and __map_kernel_page() follows ++ * the pte update sequence from ISA Book III 6.10 Translation Table ++ * Update Synchronization Requirements. + */ + } + +diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c +index 8b8f1451e944..55f26c0e389e 100644 +--- a/arch/powerpc/mm/book3s64/radix_pgtable.c ++++ b/arch/powerpc/mm/book3s64/radix_pgtable.c +@@ -108,7 +108,7 @@ static int early_map_kernel_page(unsigned long ea, unsigned long pa, + + set_the_pte: + set_pte_at(&init_mm, ea, ptep, pfn_pte(pfn, flags)); +- smp_wmb(); ++ asm volatile("ptesync": : :"memory"); + return 0; + } + +@@ -168,7 +168,7 @@ static int __map_kernel_page(unsigned long ea, unsigned long pa, + + set_the_pte: + set_pte_at(&init_mm, ea, ptep, pfn_pte(pfn, flags)); +- smp_wmb(); ++ asm volatile("ptesync": : :"memory"); + return 0; + } + +-- +2.26.2 + diff --git a/patches.suse/powerpc-asm-offsets-GPR14-is-not-needed-either.patch b/patches.suse/powerpc-asm-offsets-GPR14-is-not-needed-either.patch new file mode 100644 index 0000000..eebb6c6 --- /dev/null +++ b/patches.suse/powerpc-asm-offsets-GPR14-is-not-needed-either.patch @@ -0,0 +1,42 @@ +From 6eeca7a11379e9dd05493bbdba57515b36a2e3cf Mon Sep 17 00:00:00 2001 +From: Christophe Leroy +Date: Mon, 15 Mar 2021 11:01:26 +0000 +Subject: [PATCH] powerpc/asm-offsets: GPR14 is not needed either + +References: bsc#1065729 +Patch-mainline: v5.13-rc1 +Git-commit: 6eeca7a11379e9dd05493bbdba57515b36a2e3cf + +Commit aac6a91fea93 ("powerpc/asm: Remove unused symbols in +asm-offsets.c") removed GPR15 to GPR31 but kept GPR14, +probably because it pops up in a couple of comments when doing +a grep. + +However, it was never used either, so remove it as well. + +Fixes: aac6a91fea93 ("powerpc/asm: Remove unused symbols in asm-offsets.c") +Signed-off-by: Christophe Leroy +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/9881c68fbca004f9ea18fc9473f630e11ccd6417.1615806071.git.christophe.leroy@csgroup.eu +Acked-by: Michal Suchanek +--- + arch/powerpc/kernel/asm-offsets.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c +index 85ba2b0bc8d8..d2f1b94e944d 100644 +--- a/arch/powerpc/kernel/asm-offsets.c ++++ b/arch/powerpc/kernel/asm-offsets.c +@@ -320,9 +320,6 @@ int main(void) + STACK_PT_REGS_OFFSET(GPR11, gpr[11]); + STACK_PT_REGS_OFFSET(GPR12, gpr[12]); + STACK_PT_REGS_OFFSET(GPR13, gpr[13]); +-#ifndef CONFIG_PPC64 +- STACK_PT_REGS_OFFSET(GPR14, gpr[14]); +-#endif /* CONFIG_PPC64 */ + /* + * Note: these symbols include _ because they overlap with special + * register names +-- +2.26.2 + diff --git a/patches.suse/powerpc-eeh-Fix-EEH-handling-for-hugepages-in-iorema.patch b/patches.suse/powerpc-eeh-Fix-EEH-handling-for-hugepages-in-iorema.patch new file mode 100644 index 0000000..5972479 --- /dev/null +++ b/patches.suse/powerpc-eeh-Fix-EEH-handling-for-hugepages-in-iorema.patch @@ -0,0 +1,124 @@ +From 5ae5bc12d0728db60a0aa9b62160ffc038875f1a Mon Sep 17 00:00:00 2001 +From: Mahesh Salgaonkar +Date: Mon, 12 Apr 2021 13:22:50 +0530 +Subject: [PATCH] powerpc/eeh: Fix EEH handling for hugepages in ioremap space. + +References: bsc#1156395 +Patch-mainline: v5.13-rc1 +Git-commit: 5ae5bc12d0728db60a0aa9b62160ffc038875f1a + +During the EEH MMIO error checking, the current implementation fails to map +the (virtual) MMIO address back to the pci device on radix with hugepage +mappings for I/O. This results into failure to dispatch EEH event with no +recovery even when EEH capability has been enabled on the device. + +eeh_check_failure(token) # token = virtual MMIO address + addr = eeh_token_to_phys(token); + edev = eeh_addr_cache_get_dev(addr); + if (!edev) + return 0; + eeh_dev_check_failure(edev); <= Dispatch the EEH event + +In case of hugepage mappings, eeh_token_to_phys() has a bug in virt -> phys +translation that results in wrong physical address, which is then passed to +eeh_addr_cache_get_dev() to match it against cached pci I/O address ranges +to get to a PCI device. Hence, it fails to find a match and the EEH event +never gets dispatched leaving the device in failed state. + +The commit 33439620680be ("powerpc/eeh: Handle hugepages in ioremap space") +introduced following logic to translate virt to phys for hugepage mappings: + +eeh_token_to_phys(): ++ pa = pte_pfn(*ptep); ++ ++ /* On radix we can do hugepage mappings for io, so handle that */ ++ if (hugepage_shift) { ++ pa <<= hugepage_shift; <= This is wrong ++ pa |= token & ((1ul << hugepage_shift) - 1); ++ } + +This patch fixes the virt -> phys translation in eeh_token_to_phys() +function. + + $ cat /sys/kernel/debug/powerpc/eeh_address_cache + mem addr range [0x0000040080000000-0x00000400807fffff]: 0030:01:00.1 + mem addr range [0x0000040080800000-0x0000040080ffffff]: 0030:01:00.1 + mem addr range [0x0000040081000000-0x00000400817fffff]: 0030:01:00.0 + mem addr range [0x0000040081800000-0x0000040081ffffff]: 0030:01:00.0 + mem addr range [0x0000040082000000-0x000004008207ffff]: 0030:01:00.1 + mem addr range [0x0000040082080000-0x00000400820fffff]: 0030:01:00.0 + mem addr range [0x0000040082100000-0x000004008210ffff]: 0030:01:00.1 + mem addr range [0x0000040082110000-0x000004008211ffff]: 0030:01:00.0 + +Above is the list of cached io address ranges of pci 0030:01:00.. + +Before this patch: + +Tracing 'arg1' of function eeh_addr_cache_get_dev() during error injection +clearly shows that 'addr=' contains wrong physical address: + + kworker/u16:0-7 [001] .... 108.883775: eeh_addr_cache_get_dev: + (eeh_addr_cache_get_dev+0xc/0xf0) addr=0x80103000a510 + +dmesg shows no EEH recovery messages: + + [ 108.563768] bnx2x: [bnx2x_timer:5801(eth2)]MFW seems hanged: drv_pulse (0x9ae) != mcp_pulse (0x7fff) + [ 108.563788] bnx2x: [bnx2x_hw_stats_update:870(eth2)]NIG timer max (4294967295) + [ 108.883788] bnx2x: [bnx2x_acquire_hw_lock:2013(eth1)]lock_status 0xffffffff resource_bit 0x1 + [ 108.884407] bnx2x 0030:01:00.0 eth1: MDC/MDIO access timeout + [ 108.884976] bnx2x 0030:01:00.0 eth1: MDC/MDIO access timeout + <..> + +After this patch: + +eeh_addr_cache_get_dev() trace shows correct physical address: + + -0 [001] ..s. 1043.123828: eeh_addr_cache_get_dev: + (eeh_addr_cache_get_dev+0xc/0xf0) addr=0x40080bc7cd8 + +dmesg logs shows EEH recovery getting triggerred: + + [ 964.323980] bnx2x: [bnx2x_timer:5801(eth2)]MFW seems hanged: drv_pulse (0x746f) != mcp_pulse (0x7fff) + [ 964.323991] EEH: Recovering PHB#30-PE#10000 + [ 964.324002] EEH: PE location: N/A, PHB location: N/A + [ 964.324006] EEH: Frozen PHB#30-PE#10000 detected + <..> + +Fixes: 33439620680b ("powerpc/eeh: Handle hugepages in ioremap space") +Cc: stable@vger.kernel.org # v5.3+ +Reported-by: Dominic DeMarco +Signed-off-by: Mahesh Salgaonkar +Signed-off-by: Aneesh Kumar K.V +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/161821396263.48361.2796709239866588652.stgit@jupiter +Acked-by: Michal Suchanek +--- + arch/powerpc/kernel/eeh.c | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c +index 01dbb44a0fe3..9058a26df29c 100644 +--- a/arch/powerpc/kernel/eeh.c ++++ b/arch/powerpc/kernel/eeh.c +@@ -362,14 +362,11 @@ static inline unsigned long eeh_token_to_phys(unsigned long token) + pa = pte_pfn(*ptep); + + /* On radix we can do hugepage mappings for io, so handle that */ +- if (hugepage_shift) { +- pa <<= hugepage_shift; +- pa |= token & ((1ul << hugepage_shift) - 1); +- } else { +- pa <<= PAGE_SHIFT; +- pa |= token & (PAGE_SIZE - 1); +- } ++ if (!hugepage_shift) ++ hugepage_shift = PAGE_SHIFT; + ++ pa <<= PAGE_SHIFT; ++ pa |= token & ((1ul << hugepage_shift) - 1); + return pa; + } + +-- +2.26.2 + diff --git a/patches.suse/powerpc-fadump-Mark-fadump_calculate_reserve_size-as.patch b/patches.suse/powerpc-fadump-Mark-fadump_calculate_reserve_size-as.patch new file mode 100644 index 0000000..62325a4 --- /dev/null +++ b/patches.suse/powerpc-fadump-Mark-fadump_calculate_reserve_size-as.patch @@ -0,0 +1,56 @@ +From fbced1546eaaab57a32e56c974ea8acf10c6abd8 Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor +Date: Tue, 2 Mar 2021 12:50:14 -0700 +Subject: [PATCH] powerpc/fadump: Mark fadump_calculate_reserve_size as __init + +References: bsc#1065729 +Patch-mainline: v5.13-rc1 +Git-commit: fbced1546eaaab57a32e56c974ea8acf10c6abd8 + +If fadump_calculate_reserve_size() is not inlined, there is a modpost +warning: + +WARNING: modpost: vmlinux.o(.text+0x5196c): Section mismatch in +reference from the function fadump_calculate_reserve_size() to the +function .init.text:parse_crashkernel() +The function fadump_calculate_reserve_size() references +the function __init parse_crashkernel(). +This is often because fadump_calculate_reserve_size lacks a __init +annotation or the annotation of parse_crashkernel is wrong. + +fadump_calculate_reserve_size() calls parse_crashkernel(), which is +marked as __init and fadump_calculate_reserve_size() is called from +within fadump_reserve_mem(), which is also marked as __init. + +Mark fadump_calculate_reserve_size() as __init to fix the section +mismatch. Additionally, remove the inline keyword as it is not necessary +to inline this function; the compiler is still free to do so if it feels +it is worthwhile since commit 889b3c1245de ("compiler: remove +CONFIG_OPTIMIZE_INLINING entirely"). + +Fixes: 11550dc0a00b ("powerpc/fadump: reuse crashkernel parameter for fadump memory reservation") +Signed-off-by: Nathan Chancellor +Signed-off-by: Michael Ellerman +Link: https://github.com/ClangBuiltLinux/linux/issues/1300 +Link: https://lore.kernel.org/r/20210302195013.2626335-1-nathan@kernel.org +Acked-by: Michal Suchanek +--- + arch/powerpc/kernel/fadump.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c +index 8482739d42f3..eddf362caedc 100644 +--- a/arch/powerpc/kernel/fadump.c ++++ b/arch/powerpc/kernel/fadump.c +@@ -292,7 +292,7 @@ static void fadump_show_config(void) + * that is required for a kernel to boot successfully. + * + */ +-static inline u64 fadump_calculate_reserve_size(void) ++static __init u64 fadump_calculate_reserve_size(void) + { + u64 base, size, bootmem_min; + int ret; +-- +2.26.2 + diff --git a/patches.suse/powerpc-mm-Add-cond_resched-while-removing-hpte-mapp.patch b/patches.suse/powerpc-mm-Add-cond_resched-while-removing-hpte-mapp.patch index 3435f31..5ad7ed5 100644 --- a/patches.suse/powerpc-mm-Add-cond_resched-while-removing-hpte-mapp.patch +++ b/patches.suse/powerpc-mm-Add-cond_resched-while-removing-hpte-mapp.patch @@ -4,8 +4,7 @@ Date: Sun, 4 Apr 2021 22:01:48 +0530 Subject: [PATCH] powerpc/mm: Add cond_resched() while removing hpte mappings References: bsc#1183289 ltc#191637 -Patch-mainline: queued -Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git +Patch-mainline: v5.13-rc1 Git-commit: a5d6a3e73acbd619dd5b7b831762b755f9e2db80 While removing large number of mappings from hash page tables for diff --git a/patches.suse/powerpc-papr_scm-Fix-build-error-due-to-wrong-printf.patch b/patches.suse/powerpc-papr_scm-Fix-build-error-due-to-wrong-printf.patch index f0bfc70..ca864fc 100644 --- a/patches.suse/powerpc-papr_scm-Fix-build-error-due-to-wrong-printf.patch +++ b/patches.suse/powerpc-papr_scm-Fix-build-error-due-to-wrong-printf.patch @@ -5,8 +5,7 @@ Subject: [PATCH] powerpc/papr_scm: Fix build error due to wrong printf specifier References: bsc#1184969 -Patch-mainline: queued -Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git +Patch-mainline: v5.13-rc1 Git-commit: 7767d9ac89cee29c68f5dd278b3bb411d1c69287 When I changed the rc variable to be long rather than int64_t I diff --git a/patches.suse/powerpc-papr_scm-Implement-support-for-H_SCM_FLUSH-h.patch b/patches.suse/powerpc-papr_scm-Implement-support-for-H_SCM_FLUSH-h.patch index e8297fe..181f30f 100644 --- a/patches.suse/powerpc-papr_scm-Implement-support-for-H_SCM_FLUSH-h.patch +++ b/patches.suse/powerpc-papr_scm-Implement-support-for-H_SCM_FLUSH-h.patch @@ -4,8 +4,7 @@ Date: Mon, 29 Mar 2021 13:36:43 -0400 Subject: [PATCH] powerpc/papr_scm: Implement support for H_SCM_FLUSH hcall References: bsc#1184969 -Patch-mainline: queued -Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git +Patch-mainline: v5.13-rc1 Git-commit: 75b7c05ebf902632f7f540c3eb0a8945c2d74aab Add support for ND_REGION_ASYNC capability if the device tree diff --git a/patches.suse/powerpc-perf-Fix-PMU-constraint-check-for-EBB-events.patch b/patches.suse/powerpc-perf-Fix-PMU-constraint-check-for-EBB-events.patch new file mode 100644 index 0000000..36e3ce6 --- /dev/null +++ b/patches.suse/powerpc-perf-Fix-PMU-constraint-check-for-EBB-events.patch @@ -0,0 +1,66 @@ +From 10f8f96179ecc7f69c927f6d231f6d02736cea83 Mon Sep 17 00:00:00 2001 +From: Athira Rajeev +Date: Tue, 6 Apr 2021 12:16:01 -0400 +Subject: [PATCH] powerpc/perf: Fix PMU constraint check for EBB events + +References: bsc#1065729 +Patch-mainline: v5.13-rc1 +Git-commit: 10f8f96179ecc7f69c927f6d231f6d02736cea83 + +The power PMU group constraints includes check for EBB events to make +sure all events in a group must agree on EBB. This will prevent +scheduling EBB and non-EBB events together. But in the existing check, +settings for constraint mask and value is interchanged. Patch fixes the +same. + +Before the patch, PMU selftest "cpu_event_pinned_vs_ebb_test" fails with +below in dmesg logs. This happens because EBB event gets enabled along +with a non-EBB cpu event. + + [35600.453346] cpu_event_pinne[41326]: illegal instruction (4) + at 10004a18 nip 10004a18 lr 100049f8 code 1 in + cpu_event_pinned_vs_ebb_test[10000000+10000] + +Test results after the patch: + + $ ./pmu/ebb/cpu_event_pinned_vs_ebb_test + test: cpu_event_pinned_vs_ebb + tags: git_version:v5.12-rc5-93-gf28c3125acd3-dirty + Binding to cpu 8 + EBB Handler is at 0x100050c8 + read error on event 0x7fffe6bd4040! + PM_RUN_INST_CMPL: result 9872 running/enabled 37930432 + success: cpu_event_pinned_vs_ebb + +This bug was hidden by other logic until commit 1908dc911792 (perf: +Tweak perf_event_attr::exclusive semantics). + +Fixes: 4df489991182 ("powerpc/perf: Add power8 EBB support") +Reported-by: Thadeu Lima de Souza Cascardo +Signed-off-by: Athira Rajeev +[mpe: Mention commit 1908dc911792] +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/1617725761-1464-1-git-send-email-atrajeev@linux.vnet.ibm.com +Acked-by: Michal Suchanek +--- + arch/powerpc/perf/isa207-common.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/powerpc/perf/isa207-common.c b/arch/powerpc/perf/isa207-common.c +index e4f577da33d8..8b5eeb6fb2fb 100644 +--- a/arch/powerpc/perf/isa207-common.c ++++ b/arch/powerpc/perf/isa207-common.c +@@ -447,8 +447,8 @@ int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp, + * EBB events are pinned & exclusive, so this should never actually + * hit, but we leave it as a fallback in case. + */ +- mask |= CNST_EBB_VAL(ebb); +- value |= CNST_EBB_MASK; ++ mask |= CNST_EBB_MASK; ++ value |= CNST_EBB_VAL(ebb); + + *maskp = mask; + *valp = value; +-- +2.26.2 + diff --git a/patches.suse/powerpc-prom-Mark-identical_pvr_fixup-as-__init.patch b/patches.suse/powerpc-prom-Mark-identical_pvr_fixup-as-__init.patch new file mode 100644 index 0000000..f4cbe03 --- /dev/null +++ b/patches.suse/powerpc-prom-Mark-identical_pvr_fixup-as-__init.patch @@ -0,0 +1,60 @@ +From 1ef1dd9c7ed27b080445e1576e8a05957e0e4dfc Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor +Date: Tue, 2 Mar 2021 13:08:29 -0700 +Subject: [PATCH] powerpc/prom: Mark identical_pvr_fixup as __init + +References: bsc#1065729 +Patch-mainline: v5.13-rc1 +Git-commit: 1ef1dd9c7ed27b080445e1576e8a05957e0e4dfc + +If identical_pvr_fixup() is not inlined, there are two modpost warnings: + +WARNING: modpost: vmlinux.o(.text+0x54e8): Section mismatch in reference +from the function identical_pvr_fixup() to the function +.init.text:of_get_flat_dt_prop() +The function identical_pvr_fixup() references +the function __init of_get_flat_dt_prop(). +This is often because identical_pvr_fixup lacks a __init +annotation or the annotation of of_get_flat_dt_prop is wrong. + +WARNING: modpost: vmlinux.o(.text+0x551c): Section mismatch in reference +from the function identical_pvr_fixup() to the function +.init.text:identify_cpu() +The function identical_pvr_fixup() references +the function __init identify_cpu(). +This is often because identical_pvr_fixup lacks a __init +annotation or the annotation of identify_cpu is wrong. + +identical_pvr_fixup() calls two functions marked as __init and is only +called by a function marked as __init so it should be marked as __init +as well. At the same time, remove the inline keywork as it is not +necessary to inline this function. The compiler is still free to do so +if it feels it is worthwhile since commit 889b3c1245de ("compiler: +remove CONFIG_OPTIMIZE_INLINING entirely"). + +Fixes: 14b3d926a22b ("[POWERPC] 4xx: update 440EP(x)/440GR(x) identical PVR issue workaround") +Signed-off-by: Nathan Chancellor +Signed-off-by: Michael Ellerman +Link: https://github.com/ClangBuiltLinux/linux/issues/1316 +Link: https://lore.kernel.org/r/20210302200829.2680663-1-nathan@kernel.org +Acked-by: Michal Suchanek +--- + arch/powerpc/kernel/prom.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c +index 9a4797d1d40d..a8b2d6bfc1ca 100644 +--- a/arch/powerpc/kernel/prom.c ++++ b/arch/powerpc/kernel/prom.c +@@ -267,7 +267,7 @@ static struct feature_property { + }; + + #if defined(CONFIG_44x) && defined(CONFIG_PPC_FPU) +-static inline void identical_pvr_fixup(unsigned long node) ++static __init void identical_pvr_fixup(unsigned long node) + { + unsigned int pvr; + const char *model = of_get_flat_dt_prop(node, "model", NULL); +-- +2.26.2 + diff --git a/patches.suse/powerpc-pseries-Add-shutdown-to-vio_driver-and-vio_b.patch b/patches.suse/powerpc-pseries-Add-shutdown-to-vio_driver-and-vio_b.patch index a94aa2a..5b9086e 100644 --- a/patches.suse/powerpc-pseries-Add-shutdown-to-vio_driver-and-vio_b.patch +++ b/patches.suse/powerpc-pseries-Add-shutdown-to-vio_driver-and-vio_b.patch @@ -4,8 +4,7 @@ Date: Thu, 1 Apr 2021 18:13:25 -0600 Subject: [PATCH] powerpc/pseries: Add shutdown() to vio_driver and vio_bus References: bsc#1184209 ltc#190917 -Patch-mainline: queued -Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git +Patch-mainline: v5.13-rc1 Git-commit: 39d0099f94390eb7a677e1a5c9bb56a4daa242a1 Currently, neither the vio_bus or vio_driver structures provide support diff --git a/patches.suse/powerpc-time-Enable-sched-clock-for-irqtime.patch b/patches.suse/powerpc-time-Enable-sched-clock-for-irqtime.patch new file mode 100644 index 0000000..b0b7c00 --- /dev/null +++ b/patches.suse/powerpc-time-Enable-sched-clock-for-irqtime.patch @@ -0,0 +1,49 @@ +From b709e32ef570b8b91dfbcb63cffac4324c87799f Mon Sep 17 00:00:00 2001 +From: Pingfan Liu +Date: Thu, 22 Oct 2020 14:51:19 +0800 +Subject: [PATCH] powerpc/time: Enable sched clock for irqtime + +References: bsc#1156395 +Patch-mainline: v5.12-rc1 +Git-commit: b709e32ef570b8b91dfbcb63cffac4324c87799f + +When CONFIG_IRQ_TIME_ACCOUNTING and CONFIG_VIRT_CPU_ACCOUNTING_GEN, powerpc +does not enable "sched_clock_irqtime" and can not utilize irq time +accounting. + +Like x86, powerpc does not use the sched_clock_register() interface. So it +needs an dedicated call to enable_sched_clock_irqtime() to enable irq time +accounting. + +Fixes: 518470fe962e ("powerpc: Add HAVE_IRQ_TIME_ACCOUNTING") +Signed-off-by: Pingfan Liu +[mpe: Add fixes tag] +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/1603349479-26185-1-git-send-email-kernelfans@gmail.com +Acked-by: Michal Suchanek +--- + arch/powerpc/kernel/time.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c +--- a/arch/powerpc/kernel/time.c ++++ b/arch/powerpc/kernel/time.c +@@ -53,6 +53,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -1030,6 +1031,7 @@ void __init time_init(void) + #ifdef CONFIG_COMMON_CLK + of_clk_init(NULL); + #endif ++ enable_sched_clock_irqtime(); + } + + /* +-- +2.26.2 + diff --git a/patches.suse/regmap-set-debugfs_name-to-NULL-after-it-is-freed.patch b/patches.suse/regmap-set-debugfs_name-to-NULL-after-it-is-freed.patch new file mode 100644 index 0000000..c413dac --- /dev/null +++ b/patches.suse/regmap-set-debugfs_name-to-NULL-after-it-is-freed.patch @@ -0,0 +1,45 @@ +From e41a962f82e7afb5b1ee644f48ad0b3aee656268 Mon Sep 17 00:00:00 2001 +From: Meng Li +Date: Fri, 26 Feb 2021 10:17:37 +0800 +Subject: [PATCH] regmap: set debugfs_name to NULL after it is freed +Git-commit: e41a962f82e7afb5b1ee644f48ad0b3aee656268 +Patch-mainline: v5.13-rc1 +References: git-fixes + +There is a upstream commit cffa4b2122f5("regmap:debugfs: +Fix a memory leak when calling regmap_attach_dev") that +adds a if condition when create name for debugfs_name. +With below function invoking logical, debugfs_name is +freed in regmap_debugfs_exit(), but it is not created again +because of the if condition introduced by above commit. +regmap_reinit_cache() + regmap_debugfs_exit() + ... + regmap_debugfs_init() +So, set debugfs_name to NULL after it is freed. + +Fixes: cffa4b2122f5 ("regmap: debugfs: Fix a memory leak when calling regmap_attach_dev") +Signed-off-by: Meng Li +Link: https://lore.kernel.org/r/20210226021737.7690-1-Meng.Li@windriver.com +Signed-off-by: Mark Brown +Acked-by: Takashi Iwai + +--- + drivers/base/regmap/regmap-debugfs.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c +index ff2ee87987c7..211a335a608d 100644 +--- a/drivers/base/regmap/regmap-debugfs.c ++++ b/drivers/base/regmap/regmap-debugfs.c +@@ -660,6 +660,7 @@ void regmap_debugfs_exit(struct regmap *map) + regmap_debugfs_free_dump_cache(map); + mutex_unlock(&map->cache_lock); + kfree(map->debugfs_name); ++ map->debugfs_name = NULL; + } else { + struct regmap_debugfs_node *node, *tmp; + +-- +2.26.2 + diff --git a/patches.suse/regulator-Avoid-a-double-of_node_get-in-regulator_of.patch b/patches.suse/regulator-Avoid-a-double-of_node_get-in-regulator_of.patch new file mode 100644 index 0000000..8262ca2 --- /dev/null +++ b/patches.suse/regulator-Avoid-a-double-of_node_get-in-regulator_of.patch @@ -0,0 +1,44 @@ +From 8a065ce92b218e453742b745162d75a6f86fb768 Mon Sep 17 00:00:00 2001 +From: Christophe JAILLET +Date: Tue, 20 Apr 2021 21:31:51 +0200 +Subject: [PATCH] regulator: Avoid a double 'of_node_get' in 'regulator_of_get_init_node()' +Git-commit: 8a065ce92b218e453742b745162d75a6f86fb768 +Patch-mainline: v5.13-rc1 +References: git-fixes + +'for_each_available_child_of_node()' already performs an 'of_node_get()' +on child, so there is no need to perform another one before returning. +Otherwise, a double 'get' is performed and a resource may never be +released. + +Fixes: 925c85e21ed8 ("regulator: Factor out location of init data OF node") +Signed-off-by: Christophe JAILLET +Acked-by: Charles Keepax +Link: https://lore.kernel.org/r/a79f0068812b89ff412d572a1171f22109c24132.1618947049.git.christophe.jaillet@wanadoo.fr +Signed-off-by: Mark Brown +Acked-by: Takashi Iwai + +--- + drivers/regulator/of_regulator.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c +index 564f928eb1db..49f6c05fee34 100644 +--- a/drivers/regulator/of_regulator.c ++++ b/drivers/regulator/of_regulator.c +@@ -422,7 +422,11 @@ device_node *regulator_of_get_init_node(struct device *dev, + + if (!strcmp(desc->of_match, name)) { + of_node_put(search); +- return of_node_get(child); ++ /* ++ * 'of_node_get(child)' is already performed by the ++ * for_each loop. ++ */ ++ return child; + } + } + +-- +2.26.2 + diff --git a/patches.suse/rsi-Use-resume_noirq-for-SDIO.patch b/patches.suse/rsi-Use-resume_noirq-for-SDIO.patch new file mode 100644 index 0000000..dc5feae --- /dev/null +++ b/patches.suse/rsi-Use-resume_noirq-for-SDIO.patch @@ -0,0 +1,51 @@ +From c434e5e48dc4e626364491455f97e2db0aa137b1 Mon Sep 17 00:00:00 2001 +From: Marek Vasut +Date: Sun, 28 Mar 2021 00:59:32 +0100 +Subject: [PATCH] rsi: Use resume_noirq for SDIO +Git-commit: c434e5e48dc4e626364491455f97e2db0aa137b1 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The rsi_resume() does access the bus to enable interrupts on the RSI +SDIO WiFi card, however when calling sdio_claim_host() in the resume +path, it is possible the bus is already claimed and sdio_claim_host() +spins indefinitelly. Enable the SDIO card interrupts in resume_noirq +instead to prevent anything else from claiming the SDIO bus first. + +Fixes: 20db07332736 ("rsi: sdio suspend and resume support") +Signed-off-by: Marek Vasut +Cc: Amitkumar Karwar +Cc: Angus Ainslie +Cc: David S. Miller +Cc: Jakub Kicinski +Cc: Kalle Valo +Cc: Karun Eagalapati +Cc: Martin Kepplinger +Cc: Sebastian Krzyszkowiak +Cc: Siva Rebbagondla +Cc: netdev@vger.kernel.org +Cc: stable@vger.kernel.org +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20210327235932.175896-1-marex@denx.de +Acked-by: Takashi Iwai + +--- + drivers/net/wireless/rsi/rsi_91x_sdio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c +index fe0287b22a25..e0c502bc4270 100644 +--- a/drivers/net/wireless/rsi/rsi_91x_sdio.c ++++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c +@@ -1513,7 +1513,7 @@ static int rsi_restore(struct device *dev) + } + static const struct dev_pm_ops rsi_pm_ops = { + .suspend = rsi_suspend, +- .resume = rsi_resume, ++ .resume_noirq = rsi_resume, + .freeze = rsi_freeze, + .thaw = rsi_thaw, + .restore = rsi_restore, +-- +2.26.2 + diff --git a/patches.suse/rsxx-remove-extraneous-const-qualifier.patch b/patches.suse/rsxx-remove-extraneous-const-qualifier.patch new file mode 100644 index 0000000..90884aa --- /dev/null +++ b/patches.suse/rsxx-remove-extraneous-const-qualifier.patch @@ -0,0 +1,42 @@ +From f66116f7b2138b584b9fa4ddeedb4bcc670f1942 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Tue, 23 Mar 2021 22:57:26 +0100 +Subject: [PATCH] rsxx: remove extraneous 'const' qualifier +Git-commit: f66116f7b2138b584b9fa4ddeedb4bcc670f1942 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The returned string from rsxx_card_state_to_str is 'const', +but the other qualifier doesn't change anything here except +causing a warning with 'clang -Wextra': + +drivers/block/rsxx/core.c:393:21: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] +static const char * const rsxx_card_state_to_str(unsigned int state) + +Fixes: f37912039eb0 ("block: IBM RamSan 70/80 trivial changes.") +Reviewed-by: Nick Desaulniers +Signed-off-by: Arnd Bergmann +Link: https://lore.kernel.org/r/20210323215753.281668-1-arnd@kernel.org +Signed-off-by: Jens Axboe +Acked-by: Takashi Iwai + +--- + drivers/block/rsxx/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c +index 227e1be4c6f9..83636714b8d7 100644 +--- a/drivers/block/rsxx/core.c ++++ b/drivers/block/rsxx/core.c +@@ -392,7 +392,7 @@ static irqreturn_t rsxx_isr(int irq, void *pdata) + } + + /*----------------- Card Event Handler -------------------*/ +-static const char * const rsxx_card_state_to_str(unsigned int state) ++static const char *rsxx_card_state_to_str(unsigned int state) + { + static const char * const state_strings[] = { + "Unknown", "Shutdown", "Starting", "Formatting", +-- +2.26.2 + diff --git a/patches.suse/rtc-ds1307-Fix-wday-settings-for-rx8130.patch b/patches.suse/rtc-ds1307-Fix-wday-settings-for-rx8130.patch new file mode 100644 index 0000000..0c101df --- /dev/null +++ b/patches.suse/rtc-ds1307-Fix-wday-settings-for-rx8130.patch @@ -0,0 +1,53 @@ +From 204756f016726a380bafe619438ed979088bd04a Mon Sep 17 00:00:00 2001 +From: Nobuhiro Iwamatsu +Date: Tue, 20 Apr 2021 11:39:17 +0900 +Subject: [PATCH] rtc: ds1307: Fix wday settings for rx8130 +Git-commit: 204756f016726a380bafe619438ed979088bd04a +Patch-mainline: v5.13-rc1 +References: git-fixes + +rx8130 wday specifies the bit position, not BCD. + +Fixes: ee0981be7704 ("rtc: ds1307: Add support for Epson RX8130CE") +Signed-off-by: Nobuhiro Iwamatsu +Signed-off-by: Alexandre Belloni +Link: https://lore.kernel.org/r/20210420023917.1949066-1-nobuhiro1.iwamatsu@toshiba.co.jp +Acked-by: Takashi Iwai + +--- + drivers/rtc/rtc-ds1307.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c +index 089509d0a3a0..336cb9aa5e33 100644 +--- a/drivers/rtc/rtc-ds1307.c ++++ b/drivers/rtc/rtc-ds1307.c +@@ -293,7 +293,11 @@ static int ds1307_get_time(struct device *dev, struct rtc_time *t) + t->tm_min = bcd2bin(regs[DS1307_REG_MIN] & 0x7f); + tmp = regs[DS1307_REG_HOUR] & 0x3f; + t->tm_hour = bcd2bin(tmp); +- t->tm_wday = bcd2bin(regs[DS1307_REG_WDAY] & 0x07) - 1; ++ /* rx8130 is bit position, not BCD */ ++ if (ds1307->type == rx_8130) ++ t->tm_wday = fls(regs[DS1307_REG_WDAY] & 0x7f); ++ else ++ t->tm_wday = bcd2bin(regs[DS1307_REG_WDAY] & 0x07) - 1; + t->tm_mday = bcd2bin(regs[DS1307_REG_MDAY] & 0x3f); + tmp = regs[DS1307_REG_MONTH] & 0x1f; + t->tm_mon = bcd2bin(tmp) - 1; +@@ -340,7 +344,11 @@ static int ds1307_set_time(struct device *dev, struct rtc_time *t) + regs[DS1307_REG_SECS] = bin2bcd(t->tm_sec); + regs[DS1307_REG_MIN] = bin2bcd(t->tm_min); + regs[DS1307_REG_HOUR] = bin2bcd(t->tm_hour); +- regs[DS1307_REG_WDAY] = bin2bcd(t->tm_wday + 1); ++ /* rx8130 is bit position, not BCD */ ++ if (ds1307->type == rx_8130) ++ regs[DS1307_REG_WDAY] = 1 << t->tm_wday; ++ else ++ regs[DS1307_REG_WDAY] = bin2bcd(t->tm_wday + 1); + regs[DS1307_REG_MDAY] = bin2bcd(t->tm_mday); + regs[DS1307_REG_MONTH] = bin2bcd(t->tm_mon + 1); + +-- +2.26.2 + diff --git a/patches.suse/rtc-fsl-ftm-alarm-add-MODULE_TABLE.patch b/patches.suse/rtc-fsl-ftm-alarm-add-MODULE_TABLE.patch new file mode 100644 index 0000000..c871640 --- /dev/null +++ b/patches.suse/rtc-fsl-ftm-alarm-add-MODULE_TABLE.patch @@ -0,0 +1,36 @@ +From: Michael Walle +Date: Wed, 14 Apr 2021 10:40:06 +0200 +Subject: rtc: fsl-ftm-alarm: add MODULE_TABLE() + +Git-commit: 7fcb86185978661c9188397d474f90364745b8d9 +Patch-mainline: Queued +Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git +References: bsc#1185454 + +The module doesn't load automatically. Fix it by adding the missing +MODULE_TABLE(). + +Fixes: 7b0b551dbc1e ("rtc: fsl-ftm-alarm: add FTM alarm driver") +Signed-off-by: Michael Walle +Signed-off-by: Alexandre Belloni +Link: https://lore.kernel.org/r/20210414084006.17933-1-michael@walle.cc +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/rtc/rtc-fsl-ftm-alarm.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c +index 57cc09d0a806..c0df49fb978c 100644 +--- a/drivers/rtc/rtc-fsl-ftm-alarm.c ++++ b/drivers/rtc/rtc-fsl-ftm-alarm.c +@@ -310,6 +310,7 @@ static const struct of_device_id ftm_rtc_match[] = { + { .compatible = "fsl,lx2160a-ftm-alarm", }, + { }, + }; ++MODULE_DEVICE_TABLE(of, ftm_rtc_match); + + static const struct acpi_device_id ftm_imx_acpi_ids[] = { + {"NXP0014",}, +-- +2.26.2 + diff --git a/patches.suse/rtc-fsl-ftm-alarm-avoid-struct-rtc_time-conversions.patch b/patches.suse/rtc-fsl-ftm-alarm-avoid-struct-rtc_time-conversions.patch new file mode 100644 index 0000000..f4fd9c3 --- /dev/null +++ b/patches.suse/rtc-fsl-ftm-alarm-avoid-struct-rtc_time-conversions.patch @@ -0,0 +1,45 @@ +From: Alexandre Belloni +Date: Wed, 16 Oct 2019 22:12:23 +0200 +Subject: rtc: fsl-ftm-alarm: avoid struct rtc_time conversions + +Git-commit: bb451661db2462709674d156e8ca137fbfd3da6c +Patch-mainline: v5.5-rc1 +References: bsc#1185454 + +Directly call ktime_get_real_seconds instead of converting the result to a +struct rtc_time and then back to a time64_t. + +Link: https://lore.kernel.org/r/20191016201223.30568-4-alexandre.belloni@bootlin.com +Signed-off-by: Alexandre Belloni +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/rtc/rtc-fsl-ftm-alarm.c | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c +index 039bd2f1a7ee..9e6e994cce99 100644 +--- a/drivers/rtc/rtc-fsl-ftm-alarm.c ++++ b/drivers/rtc/rtc-fsl-ftm-alarm.c +@@ -203,17 +203,14 @@ static int ftm_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) + */ + static int ftm_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) + { +- struct rtc_time tm; +- time64_t now, alm_time; ++ time64_t alm_time; + unsigned long long cycle; + struct ftm_rtc *rtc = dev_get_drvdata(dev); + +- ftm_rtc_read_time(dev, &tm); +- now = rtc_tm_to_time64(&tm); + alm_time = rtc_tm_to_time64(&alm->time); + + ftm_clean_alarm(rtc); +- cycle = (alm_time - now) * rtc->alarm_freq; ++ cycle = (alm_time - ktime_get_real_seconds()) * rtc->alarm_freq; + if (cycle > MAX_COUNT_VAL) { + pr_err("Out of alarm range {0~262} seconds.\n"); + return -ERANGE; +-- +2.26.2 + diff --git a/patches.suse/rtc-fsl-ftm-alarm-enable-acpi-support.patch b/patches.suse/rtc-fsl-ftm-alarm-enable-acpi-support.patch new file mode 100644 index 0000000..a266a0a --- /dev/null +++ b/patches.suse/rtc-fsl-ftm-alarm-enable-acpi-support.patch @@ -0,0 +1,82 @@ +From: Peng Ma +Date: Wed, 18 Mar 2020 10:53:54 +0800 +Subject: rtc: fsl-ftm-alarm: enable acpi support + +Git-commit: 929a3270488956316214d70cd4e2ba3fa56ffe31 +Patch-mainline: v5.7-rc1 +References: bsc#1185454 + +This patch enables ACPI support in Rtc Flex timer driver. + +Signed-off-by: Peng Ma +Link: https://lore.kernel.org/r/20200318025354.6447-1-peng.ma@nxp.com +Link: https://lore.kernel.org/r/20200323072956.38263-1-peng.ma@nxp.com +Signed-off-by: Alexandre Belloni +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/rtc/rtc-fsl-ftm-alarm.c | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) + +--- a/drivers/rtc/rtc-fsl-ftm-alarm.c ++++ b/drivers/rtc/rtc-fsl-ftm-alarm.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + #define FTM_SC_CLK(c) ((c) << FTM_SC_CLK_MASK_SHIFT) + +@@ -242,7 +243,6 @@ static const struct rtc_class_ops ftm_rt + + static int ftm_rtc_probe(struct platform_device *pdev) + { +- struct device_node *np = pdev->dev.of_node; + struct resource *r; + int irq; + int ret; +@@ -272,10 +272,10 @@ static int ftm_rtc_probe(struct platform + return PTR_ERR(rtc->base); + } + +- irq = irq_of_parse_and_map(np, 0); +- if (irq <= 0) { +- dev_err(&pdev->dev, "unable to get IRQ from DT, %d\n", irq); +- return -EINVAL; ++ irq = platform_get_irq(pdev, 0); ++ if (irq < 0) { ++ dev_err(&pdev->dev, "can't get irq number\n"); ++ return irq; + } + + ret = devm_request_irq(&pdev->dev, irq, ftm_rtc_alarm_interrupt, +@@ -285,7 +285,9 @@ static int ftm_rtc_probe(struct platform + return ret; + } + +- rtc->big_endian = of_property_read_bool(np, "big-endian"); ++ rtc->big_endian = ++ device_property_read_bool(&pdev->dev, "big-endian"); ++ + rtc->alarm_freq = (u32)FIXED_FREQ_CLK / (u32)MAX_FREQ_DIV; + rtc->rtc_dev->ops = &ftm_rtc_ops; + +@@ -312,11 +314,18 @@ static const struct of_device_id ftm_rtc + { }, + }; + ++static const struct acpi_device_id ftm_imx_acpi_ids[] = { ++ {"NXP0011",}, ++ { } ++}; ++MODULE_DEVICE_TABLE(acpi, ftm_imx_acpi_ids); ++ + static struct platform_driver ftm_rtc_driver = { + .probe = ftm_rtc_probe, + .driver = { + .name = "ftm-alarm", + .of_match_table = ftm_rtc_match, ++ .acpi_match_table = ACPI_PTR(ftm_imx_acpi_ids), + }, + }; + diff --git a/patches.suse/rtc-fsl-ftm-alarm-fix-freeze-s2idle-failed-to-wake.patch b/patches.suse/rtc-fsl-ftm-alarm-fix-freeze-s2idle-failed-to-wake.patch new file mode 100644 index 0000000..2147f32 --- /dev/null +++ b/patches.suse/rtc-fsl-ftm-alarm-fix-freeze-s2idle-failed-to-wake.patch @@ -0,0 +1,48 @@ +From: Ran Wang +Date: Mon, 1 Jun 2020 15:19:14 +0800 +Subject: rtc: fsl-ftm-alarm: fix freeze(s2idle) failed to wake + +Git-commit: 3a8ce46ce15accad53b39837735c12d886964211 +Patch-mainline: v5.8-rc1 +References: bsc#1185454 + +Use dev_pm_set_wake_irq() instead of flag IRQF_NO_SUSPEND to enable +wakeup system feature for both freeze(s2idle) and mem(deep). + +Signed-off-by: Ran Wang +Signed-off-by: Alexandre Belloni +Link: https://lore.kernel.org/r/20200601071914.36444-1-ran.wang_1@nxp.com +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/rtc/rtc-fsl-ftm-alarm.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/rtc/rtc-fsl-ftm-alarm.c ++++ b/drivers/rtc/rtc-fsl-ftm-alarm.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #define FTM_SC_CLK(c) ((c) << FTM_SC_CLK_MASK_SHIFT) + +@@ -281,7 +282,7 @@ static int ftm_rtc_probe(struct platform + } + + ret = devm_request_irq(&pdev->dev, irq, ftm_rtc_alarm_interrupt, +- IRQF_NO_SUSPEND, dev_name(&pdev->dev), rtc); ++ 0, dev_name(&pdev->dev), rtc); + if (ret < 0) { + dev_err(&pdev->dev, "failed to request irq\n"); + return ret; +@@ -294,6 +295,9 @@ static int ftm_rtc_probe(struct platform + rtc->rtc_dev->ops = &ftm_rtc_ops; + + device_init_wakeup(&pdev->dev, true); ++ ret = dev_pm_set_wake_irq(&pdev->dev, irq); ++ if (ret) ++ dev_err(&pdev->dev, "failed to enable irq wake\n"); + + ret = rtc_register_device(rtc->rtc_dev); + if (ret) { diff --git a/patches.suse/rtc-fsl-ftm-alarm-report-alarm-to-core.patch b/patches.suse/rtc-fsl-ftm-alarm-report-alarm-to-core.patch new file mode 100644 index 0000000..57dc6fe --- /dev/null +++ b/patches.suse/rtc-fsl-ftm-alarm-report-alarm-to-core.patch @@ -0,0 +1,34 @@ +From: Biwen Li +Date: Fri, 27 Mar 2020 16:44:57 +0800 +Subject: rtc: fsl-ftm-alarm: report alarm to core + +Git-commit: 9c328c9dd84a10d4c96a5bfaa0bee43c94b11def +Patch-mainline: v5.7-rc1 +References: bsc#1185454 + +Report interrupt state to the RTC core. + +Signed-off-by: Biwen Li +Link: https://lore.kernel.org/r/20200327084457.45161-1-biwen.li@nxp.com +Signed-off-by: Alexandre Belloni +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/rtc/rtc-fsl-ftm-alarm.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c +index 0f4142b35f38..756af62b0486 100644 +--- a/drivers/rtc/rtc-fsl-ftm-alarm.c ++++ b/drivers/rtc/rtc-fsl-ftm-alarm.c +@@ -152,6 +152,8 @@ static irqreturn_t ftm_rtc_alarm_interrupt(int irq, void *dev) + { + struct ftm_rtc *rtc = dev; + ++ rtc_update_irq(rtc->rtc_dev, 1, RTC_IRQF | RTC_AF); ++ + ftm_irq_acknowledge(rtc); + ftm_irq_disable(rtc); + ftm_clean_alarm(rtc); +-- +2.26.2 + diff --git a/patches.suse/rtc-fsl-ftm-alarm-switch-to-ktime_get_real_seconds.patch b/patches.suse/rtc-fsl-ftm-alarm-switch-to-ktime_get_real_seconds.patch new file mode 100644 index 0000000..74f8c19 --- /dev/null +++ b/patches.suse/rtc-fsl-ftm-alarm-switch-to-ktime_get_real_seconds.patch @@ -0,0 +1,37 @@ +From: Alexandre Belloni +Date: Wed, 16 Oct 2019 22:12:21 +0200 +Subject: rtc: fsl-ftm-alarm: switch to ktime_get_real_seconds + +Git-commit: db2a4af115c4d421bbde6ffedb67112134e3ccd2 +Patch-mainline: v5.5-rc1 +References: bsc#1185454 + +The driver drops the nanoseconds part of the timespec64, there is no need +to call ktime_get_real_ts64. + +Link: https://lore.kernel.org/r/20191016201223.30568-2-alexandre.belloni@bootlin.com +Signed-off-by: Alexandre Belloni +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/rtc/rtc-fsl-ftm-alarm.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c +index b83f7afa8311..e954c51bf39b 100644 +--- a/drivers/rtc/rtc-fsl-ftm-alarm.c ++++ b/drivers/rtc/rtc-fsl-ftm-alarm.c +@@ -180,10 +180,7 @@ static int ftm_rtc_alarm_irq_enable(struct device *dev, + */ + static int ftm_rtc_read_time(struct device *dev, struct rtc_time *tm) + { +- struct timespec64 ts64; +- +- ktime_get_real_ts64(&ts64); +- rtc_time_to_tm(ts64.tv_sec, tm); ++ rtc_time_to_tm(ktime_get_real_seconds(), tm); + + return 0; + } +-- +2.26.2 + diff --git a/patches.suse/rtc-fsl-ftm-alarm-switch-to-rtc_time64_to_tm-rtc_tm_.patch b/patches.suse/rtc-fsl-ftm-alarm-switch-to-rtc_time64_to_tm-rtc_tm_.patch new file mode 100644 index 0000000..3f32cc1 --- /dev/null +++ b/patches.suse/rtc-fsl-ftm-alarm-switch-to-rtc_time64_to_tm-rtc_tm_.patch @@ -0,0 +1,50 @@ +From: Alexandre Belloni +Date: Wed, 16 Oct 2019 22:12:22 +0200 +Subject: rtc: fsl-ftm-alarm: switch to rtc_time64_to_tm/rtc_tm_to_time64 + +Git-commit: 9323e9631c8502a08a92b831db55ce9c7434d1bd +Patch-mainline: v5.5-rc1 +References: bsc#1185454 + +Call the 64bit versions of rtc_tm time conversion to avoid the y2038 issue. + +Link: https://lore.kernel.org/r/20191016201223.30568-3-alexandre.belloni@bootlin.com +Signed-off-by: Alexandre Belloni +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/rtc/rtc-fsl-ftm-alarm.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c +index e954c51bf39b..039bd2f1a7ee 100644 +--- a/drivers/rtc/rtc-fsl-ftm-alarm.c ++++ b/drivers/rtc/rtc-fsl-ftm-alarm.c +@@ -180,7 +180,7 @@ static int ftm_rtc_alarm_irq_enable(struct device *dev, + */ + static int ftm_rtc_read_time(struct device *dev, struct rtc_time *tm) + { +- rtc_time_to_tm(ktime_get_real_seconds(), tm); ++ rtc_time64_to_tm(ktime_get_real_seconds(), tm); + + return 0; + } +@@ -204,12 +204,13 @@ static int ftm_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) + static int ftm_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) + { + struct rtc_time tm; +- unsigned long now, alm_time, cycle; ++ time64_t now, alm_time; ++ unsigned long long cycle; + struct ftm_rtc *rtc = dev_get_drvdata(dev); + + ftm_rtc_read_time(dev, &tm); +- rtc_tm_to_time(&tm, &now); +- rtc_tm_to_time(&alm->time, &alm_time); ++ now = rtc_tm_to_time64(&tm); ++ alm_time = rtc_tm_to_time64(&alm->time); + + ftm_clean_alarm(rtc); + cycle = (alm_time - now) * rtc->alarm_freq; +-- +2.26.2 + diff --git a/patches.suse/rtc-fsl-ftm-alarm-update-acpi-device-id.patch b/patches.suse/rtc-fsl-ftm-alarm-update-acpi-device-id.patch new file mode 100644 index 0000000..6eaabbb --- /dev/null +++ b/patches.suse/rtc-fsl-ftm-alarm-update-acpi-device-id.patch @@ -0,0 +1,44 @@ +From: Peng Ma +Date: Tue, 18 Aug 2020 14:36:09 +0800 +Subject: rtc: fsl-ftm-alarm: update acpi device id + +Git-commit: 0d982de3e27e8091dfa62368cd3eefbc7c17c8a2 +Patch-mainline: v5.10-rc1 +References: bsc#1185454 + +Original device id would conflict with crypto driver, change it. + +Signed-off-by: Peng Ma +Signed-off-by: Ran Wang +Signed-off-by: Alexandre Belloni +Link: https://lore.kernel.org/r/20200818063609.39859-1-ran.wang_1@nxp.com +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/rtc/rtc-fsl-ftm-alarm.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c +index 68f0a1801a2e..48d3b38ea348 100644 +--- a/drivers/rtc/rtc-fsl-ftm-alarm.c ++++ b/drivers/rtc/rtc-fsl-ftm-alarm.c +@@ -3,7 +3,7 @@ + * Freescale FlexTimer Module (FTM) alarm device driver. + * + * Copyright 2014 Freescale Semiconductor, Inc. +- * Copyright 2019 NXP ++ * Copyright 2019-2020 NXP + * + */ + +@@ -312,7 +312,7 @@ static const struct of_device_id ftm_rtc_match[] = { + }; + + static const struct acpi_device_id ftm_imx_acpi_ids[] = { +- {"NXP0011",}, ++ {"NXP0014",}, + { } + }; + MODULE_DEVICE_TABLE(acpi, ftm_imx_acpi_ids); +-- +2.26.2 + diff --git a/patches.suse/rtlwifi-8821ae-upgrade-PHY-and-RF-parameters.patch b/patches.suse/rtlwifi-8821ae-upgrade-PHY-and-RF-parameters.patch new file mode 100644 index 0000000..6e74424 --- /dev/null +++ b/patches.suse/rtlwifi-8821ae-upgrade-PHY-and-RF-parameters.patch @@ -0,0 +1,830 @@ +From 18fb0bedb5fc2fddc057dbe48b7360a6ffda34b3 Mon Sep 17 00:00:00 2001 +From: Ping-Ke Shih +Date: Fri, 19 Feb 2021 13:26:07 +0800 +Subject: [PATCH] rtlwifi: 8821ae: upgrade PHY and RF parameters +Git-commit: 18fb0bedb5fc2fddc057dbe48b7360a6ffda34b3 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The signal strength of 5G is quite low, so user can't connect to an AP far +away. New parameters with new format and its parser are updated by the commit +84d26fda52e2 ("rtlwifi: Update 8821ae new phy parameters and its parser."), but +some parameters are missing. Use this commit to update to the novel parameters +that use new format. + +Fixes: 84d26fda52e2 ("rtlwifi: Update 8821ae new phy parameters and its parser") +Signed-off-by: Ping-Ke Shih +Tested-by: Kai-Heng Feng +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20210219052607.7323-1-pkshih@realtek.com +Acked-by: Takashi Iwai + +--- + .../realtek/rtlwifi/rtl8821ae/table.c | 500 +++++++++++++----- + 1 file changed, 370 insertions(+), 130 deletions(-) + +diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.c +index 27c8a5d96520..fcaaf664cbec 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.c ++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.c +@@ -249,7 +249,7 @@ u32 RTL8821AE_PHY_REG_ARRAY[] = { + 0x824, 0x00030FE0, + 0x828, 0x00000000, + 0x82C, 0x002081DD, +- 0x830, 0x2AAA8E24, ++ 0x830, 0x2AAAEEC8, + 0x834, 0x0037A706, + 0x838, 0x06489B44, + 0x83C, 0x0000095B, +@@ -324,10 +324,10 @@ u32 RTL8821AE_PHY_REG_ARRAY[] = { + 0x9D8, 0x00000000, + 0x9DC, 0x00000000, + 0x9E0, 0x00005D00, +- 0x9E4, 0x00000002, ++ 0x9E4, 0x00000003, + 0x9E8, 0x00000001, + 0xA00, 0x00D047C8, +- 0xA04, 0x01FF000C, ++ 0xA04, 0x01FF800C, + 0xA08, 0x8C8A8300, + 0xA0C, 0x2E68000F, + 0xA10, 0x9500BB78, +@@ -1320,7 +1320,11 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x083, 0x00021800, + 0x084, 0x00028000, + 0x085, 0x00048000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x086, 0x0009483A, ++ 0xA0000000, 0x00000000, + 0x086, 0x00094838, ++ 0xB0000000, 0x00000000, + 0x087, 0x00044980, + 0x088, 0x00048000, + 0x089, 0x0000D480, +@@ -1409,36 +1413,32 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x03C, 0x000CA000, + 0x0EF, 0x00000000, + 0x0EF, 0x00001100, +- 0xFF0F0104, 0xABCD, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x0004ADF3, + 0x034, 0x00049DF0, +- 0xFF0F0204, 0xCDEF, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x0004ADF3, + 0x034, 0x00049DF0, +- 0xFF0F0404, 0xCDEF, +- 0x034, 0x0004ADF3, +- 0x034, 0x00049DF0, +- 0xFF0F0200, 0xCDEF, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x0004ADF5, + 0x034, 0x00049DF2, +- 0xFF0F02C0, 0xCDEF, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004A0F3, ++ 0x034, 0x000490B1, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x0004A0F3, + 0x034, 0x000490B1, +- 0xCDCDCDCD, 0xCDCD, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004ADF5, ++ 0x034, 0x00049DF2, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004ADF3, ++ 0x034, 0x00049DF0, ++ 0xA0000000, 0x00000000, + 0x034, 0x0004ADF7, + 0x034, 0x00049DF3, +- 0xFF0F0104, 0xDEAD, +- 0xFF0F0104, 0xABCD, +- 0x034, 0x00048DED, +- 0x034, 0x00047DEA, +- 0x034, 0x00046DE7, +- 0x034, 0x00045CE9, +- 0x034, 0x00044CE6, +- 0x034, 0x000438C6, +- 0x034, 0x00042886, +- 0x034, 0x00041486, +- 0x034, 0x00040447, +- 0xFF0F0204, 0xCDEF, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x00048DED, + 0x034, 0x00047DEA, + 0x034, 0x00046DE7, +@@ -1448,7 +1448,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x034, 0x00042886, + 0x034, 0x00041486, + 0x034, 0x00040447, +- 0xFF0F0404, 0xCDEF, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x00048DED, + 0x034, 0x00047DEA, + 0x034, 0x00046DE7, +@@ -1458,7 +1458,17 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x034, 0x00042886, + 0x034, 0x00041486, + 0x034, 0x00040447, +- 0xFF0F02C0, 0xCDEF, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x000480AE, ++ 0x034, 0x000470AB, ++ 0x034, 0x0004608B, ++ 0x034, 0x00045069, ++ 0x034, 0x00044048, ++ 0x034, 0x00043045, ++ 0x034, 0x00042026, ++ 0x034, 0x00041023, ++ 0x034, 0x00040002, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x000480AE, + 0x034, 0x000470AB, + 0x034, 0x0004608B, +@@ -1468,7 +1478,17 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x034, 0x00042026, + 0x034, 0x00041023, + 0x034, 0x00040002, +- 0xCDCDCDCD, 0xCDCD, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00048DED, ++ 0x034, 0x00047DEA, ++ 0x034, 0x00046DE7, ++ 0x034, 0x00045CE9, ++ 0x034, 0x00044CE6, ++ 0x034, 0x000438C6, ++ 0x034, 0x00042886, ++ 0x034, 0x00041486, ++ 0x034, 0x00040447, ++ 0xA0000000, 0x00000000, + 0x034, 0x00048DEF, + 0x034, 0x00047DEC, + 0x034, 0x00046DE9, +@@ -1478,38 +1498,36 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x034, 0x0004248A, + 0x034, 0x0004108D, + 0x034, 0x0004008A, +- 0xFF0F0104, 0xDEAD, +- 0xFF0F0200, 0xABCD, ++ 0xB0000000, 0x00000000, ++ 0x80000210, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x0002ADF4, +- 0xFF0F02C0, 0xCDEF, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0002A0F3, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x0002A0F3, +- 0xCDCDCDCD, 0xCDCD, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0002ADF4, ++ 0xA0000000, 0x00000000, + 0x034, 0x0002ADF7, +- 0xFF0F0200, 0xDEAD, +- 0xFF0F0104, 0xABCD, +- 0x034, 0x00029DF4, +- 0xFF0F0204, 0xCDEF, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x00029DF4, +- 0xFF0F0404, 0xCDEF, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x00029DF4, +- 0xFF0F0200, 0xCDEF, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x00029DF1, +- 0xFF0F02C0, 0xCDEF, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x000290F0, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x000290F0, +- 0xCDCDCDCD, 0xCDCD, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00029DF1, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00029DF4, ++ 0xA0000000, 0x00000000, + 0x034, 0x00029DF2, +- 0xFF0F0104, 0xDEAD, +- 0xFF0F0104, 0xABCD, +- 0x034, 0x00028DF1, +- 0x034, 0x00027DEE, +- 0x034, 0x00026DEB, +- 0x034, 0x00025CEC, +- 0x034, 0x00024CE9, +- 0x034, 0x000238CA, +- 0x034, 0x00022889, +- 0x034, 0x00021489, +- 0x034, 0x0002044A, +- 0xFF0F0204, 0xCDEF, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x00028DF1, + 0x034, 0x00027DEE, + 0x034, 0x00026DEB, +@@ -1519,7 +1537,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x034, 0x00022889, + 0x034, 0x00021489, + 0x034, 0x0002044A, +- 0xFF0F0404, 0xCDEF, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x00028DF1, + 0x034, 0x00027DEE, + 0x034, 0x00026DEB, +@@ -1529,7 +1547,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x034, 0x00022889, + 0x034, 0x00021489, + 0x034, 0x0002044A, +- 0xFF0F02C0, 0xCDEF, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x000280AF, + 0x034, 0x000270AC, + 0x034, 0x0002608B, +@@ -1539,7 +1557,27 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x034, 0x00022026, + 0x034, 0x00021023, + 0x034, 0x00020002, +- 0xCDCDCDCD, 0xCDCD, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x000280AF, ++ 0x034, 0x000270AC, ++ 0x034, 0x0002608B, ++ 0x034, 0x00025069, ++ 0x034, 0x00024048, ++ 0x034, 0x00023045, ++ 0x034, 0x00022026, ++ 0x034, 0x00021023, ++ 0x034, 0x00020002, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00028DF1, ++ 0x034, 0x00027DEE, ++ 0x034, 0x00026DEB, ++ 0x034, 0x00025CEC, ++ 0x034, 0x00024CE9, ++ 0x034, 0x000238CA, ++ 0x034, 0x00022889, ++ 0x034, 0x00021489, ++ 0x034, 0x0002044A, ++ 0xA0000000, 0x00000000, + 0x034, 0x00028DEE, + 0x034, 0x00027DEB, + 0x034, 0x00026CCD, +@@ -1549,27 +1587,24 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x034, 0x00022849, + 0x034, 0x00021449, + 0x034, 0x0002004D, +- 0xFF0F0104, 0xDEAD, +- 0xFF0F02C0, 0xABCD, ++ 0xB0000000, 0x00000000, ++ 0x8000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0000A0D7, ++ 0x034, 0x000090D3, ++ 0x034, 0x000080B1, ++ 0x034, 0x000070AE, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x0000A0D7, + 0x034, 0x000090D3, + 0x034, 0x000080B1, + 0x034, 0x000070AE, +- 0xCDCDCDCD, 0xCDCD, ++ 0xA0000000, 0x00000000, + 0x034, 0x0000ADF7, + 0x034, 0x00009DF4, + 0x034, 0x00008DF1, + 0x034, 0x00007DEE, +- 0xFF0F02C0, 0xDEAD, +- 0xFF0F0104, 0xABCD, +- 0x034, 0x00006DEB, +- 0x034, 0x00005CEC, +- 0x034, 0x00004CE9, +- 0x034, 0x000038CA, +- 0x034, 0x00002889, +- 0x034, 0x00001489, +- 0x034, 0x0000044A, +- 0xFF0F0204, 0xCDEF, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x00006DEB, + 0x034, 0x00005CEC, + 0x034, 0x00004CE9, +@@ -1577,7 +1612,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x034, 0x00002889, + 0x034, 0x00001489, + 0x034, 0x0000044A, +- 0xFF0F0404, 0xCDEF, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x00006DEB, + 0x034, 0x00005CEC, + 0x034, 0x00004CE9, +@@ -1585,7 +1620,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x034, 0x00002889, + 0x034, 0x00001489, + 0x034, 0x0000044A, +- 0xFF0F02C0, 0xCDEF, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, + 0x034, 0x0000608D, + 0x034, 0x0000506B, + 0x034, 0x0000404A, +@@ -1593,7 +1628,23 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x034, 0x00002044, + 0x034, 0x00001025, + 0x034, 0x00000004, +- 0xCDCDCDCD, 0xCDCD, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0000608D, ++ 0x034, 0x0000506B, ++ 0x034, 0x0000404A, ++ 0x034, 0x00003047, ++ 0x034, 0x00002044, ++ 0x034, 0x00001025, ++ 0x034, 0x00000004, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00006DEB, ++ 0x034, 0x00005CEC, ++ 0x034, 0x00004CE9, ++ 0x034, 0x000038CA, ++ 0x034, 0x00002889, ++ 0x034, 0x00001489, ++ 0x034, 0x0000044A, ++ 0xA0000000, 0x00000000, + 0x034, 0x00006DCD, + 0x034, 0x00005CCD, + 0x034, 0x00004CCA, +@@ -1601,11 +1652,11 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x034, 0x00002888, + 0x034, 0x00001488, + 0x034, 0x00000486, +- 0xFF0F0104, 0xDEAD, ++ 0xB0000000, 0x00000000, + 0x0EF, 0x00000000, + 0x018, 0x0001712A, + 0x0EF, 0x00000040, +- 0xFF0F0104, 0xABCD, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, + 0x035, 0x00000187, + 0x035, 0x00008187, + 0x035, 0x00010187, +@@ -1615,7 +1666,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x035, 0x00040188, + 0x035, 0x00048188, + 0x035, 0x00050188, +- 0xFF0F0204, 0xCDEF, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, + 0x035, 0x00000187, + 0x035, 0x00008187, + 0x035, 0x00010187, +@@ -1625,7 +1676,37 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x035, 0x00040188, + 0x035, 0x00048188, + 0x035, 0x00050188, +- 0xFF0F0404, 0xCDEF, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x035, 0x00000128, ++ 0x035, 0x00008128, ++ 0x035, 0x00010128, ++ 0x035, 0x000201C8, ++ 0x035, 0x000281C8, ++ 0x035, 0x000301C8, ++ 0x035, 0x000401C8, ++ 0x035, 0x000481C8, ++ 0x035, 0x000501C8, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x035, 0x00000145, ++ 0x035, 0x00008145, ++ 0x035, 0x00010145, ++ 0x035, 0x00020196, ++ 0x035, 0x00028196, ++ 0x035, 0x00030196, ++ 0x035, 0x000401C7, ++ 0x035, 0x000481C7, ++ 0x035, 0x000501C7, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x035, 0x00000128, ++ 0x035, 0x00008128, ++ 0x035, 0x00010128, ++ 0x035, 0x000201C8, ++ 0x035, 0x000281C8, ++ 0x035, 0x000301C8, ++ 0x035, 0x000401C8, ++ 0x035, 0x000481C8, ++ 0x035, 0x000501C8, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, + 0x035, 0x00000187, + 0x035, 0x00008187, + 0x035, 0x00010187, +@@ -1635,7 +1716,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x035, 0x00040188, + 0x035, 0x00048188, + 0x035, 0x00050188, +- 0xCDCDCDCD, 0xCDCD, ++ 0xA0000000, 0x00000000, + 0x035, 0x00000145, + 0x035, 0x00008145, + 0x035, 0x00010145, +@@ -1645,11 +1726,11 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x035, 0x000401C7, + 0x035, 0x000481C7, + 0x035, 0x000501C7, +- 0xFF0F0104, 0xDEAD, ++ 0xB0000000, 0x00000000, + 0x0EF, 0x00000000, + 0x018, 0x0001712A, + 0x0EF, 0x00000010, +- 0xFF0F0104, 0xABCD, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, + 0x036, 0x00085733, + 0x036, 0x0008D733, + 0x036, 0x00095733, +@@ -1662,7 +1743,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x036, 0x000CE4B4, + 0x036, 0x000D64B4, + 0x036, 0x000DE4B4, +- 0xFF0F0204, 0xCDEF, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, + 0x036, 0x00085733, + 0x036, 0x0008D733, + 0x036, 0x00095733, +@@ -1675,7 +1756,46 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x036, 0x000CE4B4, + 0x036, 0x000D64B4, + 0x036, 0x000DE4B4, +- 0xFF0F0404, 0xCDEF, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x036, 0x000063B5, ++ 0x036, 0x0000E3B5, ++ 0x036, 0x000163B5, ++ 0x036, 0x0001E3B5, ++ 0x036, 0x000263B5, ++ 0x036, 0x0002E3B5, ++ 0x036, 0x000363B5, ++ 0x036, 0x0003E3B5, ++ 0x036, 0x000463B5, ++ 0x036, 0x0004E3B5, ++ 0x036, 0x000563B5, ++ 0x036, 0x0005E3B5, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x036, 0x000056B3, ++ 0x036, 0x0000D6B3, ++ 0x036, 0x000156B3, ++ 0x036, 0x0001D6B3, ++ 0x036, 0x00026634, ++ 0x036, 0x0002E634, ++ 0x036, 0x00036634, ++ 0x036, 0x0003E634, ++ 0x036, 0x000467B4, ++ 0x036, 0x0004E7B4, ++ 0x036, 0x000567B4, ++ 0x036, 0x0005E7B4, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x036, 0x000063B5, ++ 0x036, 0x0000E3B5, ++ 0x036, 0x000163B5, ++ 0x036, 0x0001E3B5, ++ 0x036, 0x000263B5, ++ 0x036, 0x0002E3B5, ++ 0x036, 0x000363B5, ++ 0x036, 0x0003E3B5, ++ 0x036, 0x000463B5, ++ 0x036, 0x0004E3B5, ++ 0x036, 0x000563B5, ++ 0x036, 0x0005E3B5, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, + 0x036, 0x00085733, + 0x036, 0x0008D733, + 0x036, 0x00095733, +@@ -1688,7 +1808,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x036, 0x000CE4B4, + 0x036, 0x000D64B4, + 0x036, 0x000DE4B4, +- 0xCDCDCDCD, 0xCDCD, ++ 0xA0000000, 0x00000000, + 0x036, 0x000056B3, + 0x036, 0x0000D6B3, + 0x036, 0x000156B3, +@@ -1701,103 +1821,162 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x036, 0x0004E7B4, + 0x036, 0x000567B4, + 0x036, 0x0005E7B4, +- 0xFF0F0104, 0xDEAD, ++ 0xB0000000, 0x00000000, + 0x0EF, 0x00000000, + 0x0EF, 0x00000008, +- 0xFF0F0104, 0xABCD, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, + 0x03C, 0x000001C8, + 0x03C, 0x00000492, +- 0xFF0F0204, 0xCDEF, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, + 0x03C, 0x000001C8, + 0x03C, 0x00000492, +- 0xFF0F0404, 0xCDEF, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x000001B6, ++ 0x03C, 0x00000492, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x0000022A, ++ 0x03C, 0x00000594, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x000001B6, ++ 0x03C, 0x00000492, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, + 0x03C, 0x000001C8, + 0x03C, 0x00000492, +- 0xCDCDCDCD, 0xCDCD, ++ 0xA0000000, 0x00000000, + 0x03C, 0x0000022A, + 0x03C, 0x00000594, +- 0xFF0F0104, 0xDEAD, +- 0xFF0F0104, 0xABCD, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, + 0x03C, 0x00000800, +- 0xFF0F0204, 0xCDEF, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, + 0x03C, 0x00000800, +- 0xFF0F0404, 0xCDEF, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, + 0x03C, 0x00000800, +- 0xFF0F02C0, 0xCDEF, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, + 0x03C, 0x00000820, +- 0xCDCDCDCD, 0xCDCD, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x00000820, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x00000800, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x00000800, ++ 0xA0000000, 0x00000000, + 0x03C, 0x00000900, +- 0xFF0F0104, 0xDEAD, ++ 0xB0000000, 0x00000000, + 0x0EF, 0x00000000, + 0x018, 0x0001712A, + 0x0EF, 0x00000002, +- 0xFF0F0104, 0xABCD, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, + 0x008, 0x0004E400, +- 0xFF0F0204, 0xCDEF, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, + 0x008, 0x0004E400, +- 0xFF0F0404, 0xCDEF, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x008, 0x00002000, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x008, 0x00002000, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x008, 0x00002000, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x008, 0x00002000, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, + 0x008, 0x0004E400, +- 0xCDCDCDCD, 0xCDCD, ++ 0xA0000000, 0x00000000, + 0x008, 0x00002000, +- 0xFF0F0104, 0xDEAD, ++ 0xB0000000, 0x00000000, + 0x0EF, 0x00000000, + 0x0DF, 0x000000C0, +- 0x01F, 0x00040064, +- 0xFF0F0104, 0xABCD, ++ 0x01F, 0x00000064, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, + 0x058, 0x000A7284, + 0x059, 0x000600EC, +- 0xFF0F0204, 0xCDEF, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, + 0x058, 0x000A7284, + 0x059, 0x000600EC, +- 0xFF0F0404, 0xCDEF, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x058, 0x00081184, ++ 0x059, 0x0006016C, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x058, 0x00081184, ++ 0x059, 0x0006016C, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x058, 0x00081184, ++ 0x059, 0x0006016C, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, + 0x058, 0x000A7284, + 0x059, 0x000600EC, +- 0xCDCDCDCD, 0xCDCD, ++ 0xA0000000, 0x00000000, + 0x058, 0x00081184, + 0x059, 0x0006016C, +- 0xFF0F0104, 0xDEAD, +- 0xFF0F0104, 0xABCD, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, + 0x061, 0x000E8D73, + 0x062, 0x00093FC5, +- 0xFF0F0204, 0xCDEF, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, + 0x061, 0x000E8D73, + 0x062, 0x00093FC5, +- 0xFF0F0404, 0xCDEF, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x061, 0x000EFD83, ++ 0x062, 0x00093FCC, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x061, 0x000EAD53, ++ 0x062, 0x00093BC4, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x061, 0x000EFD83, ++ 0x062, 0x00093FCC, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, + 0x061, 0x000E8D73, + 0x062, 0x00093FC5, +- 0xCDCDCDCD, 0xCDCD, ++ 0xA0000000, 0x00000000, + 0x061, 0x000EAD53, + 0x062, 0x00093BC4, +- 0xFF0F0104, 0xDEAD, +- 0xFF0F0104, 0xABCD, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, + 0x063, 0x000110E9, +- 0xFF0F0204, 0xCDEF, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, + 0x063, 0x000110E9, +- 0xFF0F0404, 0xCDEF, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x063, 0x000110EB, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, + 0x063, 0x000110E9, +- 0xFF0F0200, 0xCDEF, +- 0x063, 0x000710E9, +- 0xFF0F02C0, 0xCDEF, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, + 0x063, 0x000110E9, +- 0xCDCDCDCD, 0xCDCD, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x063, 0x000110EB, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x063, 0x000110E9, ++ 0xA0000000, 0x00000000, + 0x063, 0x000714E9, +- 0xFF0F0104, 0xDEAD, +- 0xFF0F0104, 0xABCD, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x064, 0x0001C27C, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x064, 0x0001C27C, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, + 0x064, 0x0001C27C, +- 0xFF0F0204, 0xCDEF, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x064, 0x0001C67C, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, + 0x064, 0x0001C27C, +- 0xFF0F0404, 0xCDEF, ++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, + 0x064, 0x0001C27C, +- 0xCDCDCDCD, 0xCDCD, ++ 0xA0000000, 0x00000000, + 0x064, 0x0001C67C, +- 0xFF0F0104, 0xDEAD, +- 0xFF0F0200, 0xABCD, ++ 0xB0000000, 0x00000000, ++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x065, 0x00091016, ++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x065, 0x00091016, ++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, + 0x065, 0x00093016, +- 0xFF0F02C0, 0xCDEF, ++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, + 0x065, 0x00093015, +- 0xCDCDCDCD, 0xCDCD, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x065, 0x00093015, ++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x065, 0x00093016, ++ 0xA0000000, 0x00000000, + 0x065, 0x00091016, +- 0xFF0F0200, 0xDEAD, ++ 0xB0000000, 0x00000000, + 0x018, 0x00000006, + 0x0EF, 0x00002000, + 0x03B, 0x0003824B, +@@ -1895,9 +2074,10 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { + 0x0B4, 0x0001214C, + 0x0B7, 0x0003000C, + 0x01C, 0x000539D2, ++ 0x0C4, 0x000AFE00, + 0x018, 0x0001F12A, +- 0x0FE, 0x00000000, +- 0x0FE, 0x00000000, ++ 0xFFE, 0x00000000, ++ 0xFFE, 0x00000000, + 0x018, 0x0001712A, + + }; +@@ -2017,6 +2197,7 @@ u32 RTL8812AE_MAC_REG_ARRAY[] = { + u32 RTL8812AE_MAC_1T_ARRAYLEN = ARRAY_SIZE(RTL8812AE_MAC_REG_ARRAY); + + u32 RTL8821AE_MAC_REG_ARRAY[] = { ++ 0x421, 0x0000000F, + 0x428, 0x0000000A, + 0x429, 0x00000010, + 0x430, 0x00000000, +@@ -2485,7 +2666,7 @@ u32 RTL8821AE_AGC_TAB_ARRAY[] = { + 0x81C, 0xA6360001, + 0x81C, 0xA5380001, + 0x81C, 0xA43A0001, +- 0x81C, 0xA33C0001, ++ 0x81C, 0x683C0001, + 0x81C, 0x673E0001, + 0x81C, 0x66400001, + 0x81C, 0x65420001, +@@ -2519,7 +2700,66 @@ u32 RTL8821AE_AGC_TAB_ARRAY[] = { + 0x81C, 0x017A0001, + 0x81C, 0x017C0001, + 0x81C, 0x017E0001, +- 0xFF0F02C0, 0xABCD, ++ 0x8000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x81C, 0xFB000101, ++ 0x81C, 0xFA020101, ++ 0x81C, 0xF9040101, ++ 0x81C, 0xF8060101, ++ 0x81C, 0xF7080101, ++ 0x81C, 0xF60A0101, ++ 0x81C, 0xF50C0101, ++ 0x81C, 0xF40E0101, ++ 0x81C, 0xF3100101, ++ 0x81C, 0xF2120101, ++ 0x81C, 0xF1140101, ++ 0x81C, 0xF0160101, ++ 0x81C, 0xEF180101, ++ 0x81C, 0xEE1A0101, ++ 0x81C, 0xED1C0101, ++ 0x81C, 0xEC1E0101, ++ 0x81C, 0xEB200101, ++ 0x81C, 0xEA220101, ++ 0x81C, 0xE9240101, ++ 0x81C, 0xE8260101, ++ 0x81C, 0xE7280101, ++ 0x81C, 0xE62A0101, ++ 0x81C, 0xE52C0101, ++ 0x81C, 0xE42E0101, ++ 0x81C, 0xE3300101, ++ 0x81C, 0xA5320101, ++ 0x81C, 0xA4340101, ++ 0x81C, 0xA3360101, ++ 0x81C, 0x87380101, ++ 0x81C, 0x863A0101, ++ 0x81C, 0x853C0101, ++ 0x81C, 0x843E0101, ++ 0x81C, 0x69400101, ++ 0x81C, 0x68420101, ++ 0x81C, 0x67440101, ++ 0x81C, 0x66460101, ++ 0x81C, 0x49480101, ++ 0x81C, 0x484A0101, ++ 0x81C, 0x474C0101, ++ 0x81C, 0x2A4E0101, ++ 0x81C, 0x29500101, ++ 0x81C, 0x28520101, ++ 0x81C, 0x27540101, ++ 0x81C, 0x26560101, ++ 0x81C, 0x25580101, ++ 0x81C, 0x245A0101, ++ 0x81C, 0x235C0101, ++ 0x81C, 0x055E0101, ++ 0x81C, 0x04600101, ++ 0x81C, 0x03620101, ++ 0x81C, 0x02640101, ++ 0x81C, 0x01660101, ++ 0x81C, 0x01680101, ++ 0x81C, 0x016A0101, ++ 0x81C, 0x016C0101, ++ 0x81C, 0x016E0101, ++ 0x81C, 0x01700101, ++ 0x81C, 0x01720101, ++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, + 0x81C, 0xFB000101, + 0x81C, 0xFA020101, + 0x81C, 0xF9040101, +@@ -2578,7 +2818,7 @@ u32 RTL8821AE_AGC_TAB_ARRAY[] = { + 0x81C, 0x016E0101, + 0x81C, 0x01700101, + 0x81C, 0x01720101, +- 0xCDCDCDCD, 0xCDCD, ++ 0xA0000000, 0x00000000, + 0x81C, 0xFF000101, + 0x81C, 0xFF020101, + 0x81C, 0xFE040101, +@@ -2637,7 +2877,7 @@ u32 RTL8821AE_AGC_TAB_ARRAY[] = { + 0x81C, 0x046E0101, + 0x81C, 0x03700101, + 0x81C, 0x02720101, +- 0xFF0F02C0, 0xDEAD, ++ 0xB0000000, 0x00000000, + 0x81C, 0x01740101, + 0x81C, 0x01760101, + 0x81C, 0x01780101, +-- +2.26.2 + diff --git a/patches.suse/rtw88-Fix-array-overrun-in-rtw_get_tx_power_params.patch b/patches.suse/rtw88-Fix-array-overrun-in-rtw_get_tx_power_params.patch new file mode 100644 index 0000000..68518be --- /dev/null +++ b/patches.suse/rtw88-Fix-array-overrun-in-rtw_get_tx_power_params.patch @@ -0,0 +1,108 @@ +From 2ff25985ea9ccc6c9af2c77b0b49045adcc62e0e Mon Sep 17 00:00:00 2001 +From: Ping-Ke Shih +Date: Thu, 1 Apr 2021 14:27:17 -0500 +Subject: [PATCH] rtw88: Fix array overrun in rtw_get_tx_power_params() +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: 2ff25985ea9ccc6c9af2c77b0b49045adcc62e0e +Patch-mainline: v5.13-rc1 +References: git-fixes + +Using a kernel with the Undefined Behaviour Sanity Checker (UBSAN) enabled, the +following array overrun is logged: + +================================================================================ +Ubsan: array-index-out-of-bounds in /home/finger/wireless-drivers-next/drivers/net/wireless/realtek/rtw88/phy.c:1789:34 +index 5 is out of range for type 'u8 [5]' +Cpu: 2 PID: 84 Comm: kworker/u16:3 Tainted: G O 5.12.0-rc5-00086-gd88bba47038e-dirty #651 +Hardware name: TOSHIBA TECRA A50-A/TECRA A50-A, BIOS Version 4.50 09/29/2014 +Workqueue: phy0 ieee80211_scan_work [mac80211] +Call Trace: + dump_stack+0x64/0x7c + ubsan_epilogue+0x5/0x40 + __ubsan_handle_out_of_bounds.cold+0x43/0x48 + rtw_get_tx_power_params+0x83a/drivers/net/wireless/realtek/rtw88/0xad0 [rtw_core] + ? rtw_pci_read16+0x20/0x20 [rtw_pci] + ? check_hw_ready+0x50/0x90 [rtw_core] + rtw_phy_get_tx_power_index+0x4d/0xd0 [rtw_core] + rtw_phy_set_tx_power_level+0xee/0x1b0 [rtw_core] + rtw_set_channel+0xab/0x110 [rtw_core] + rtw_ops_config+0x87/0xc0 [rtw_core] + ieee80211_hw_config+0x9d/0x130 [mac80211] + ieee80211_scan_state_set_channel+0x81/0x170 [mac80211] + ieee80211_scan_work+0x19f/0x2a0 [mac80211] + process_one_work+0x1dd/0x3a0 + worker_thread+0x49/0x330 + ? rescuer_thread+0x3a0/0x3a0 + kthread+0x134/0x150 + ? kthread_create_worker_on_cpu+0x70/0x70 + ret_from_fork+0x22/0x30 +================================================================================ + +The statement where an array is being overrun is shown in the following snippet: + + if (rate <= DESC_RATE11M) + tx_power = pwr_idx_2g->cck_base[group]; + else +====> tx_power = pwr_idx_2g->bw40_base[group]; + +The associated arrays are defined in main.h as follows: + +struct rtw_2g_txpwr_idx { + u8 cck_base[6]; + u8 bw40_base[5]; + struct rtw_2g_1s_pwr_idx_diff ht_1s_diff; + struct rtw_2g_ns_pwr_idx_diff ht_2s_diff; + struct rtw_2g_ns_pwr_idx_diff ht_3s_diff; + struct rtw_2g_ns_pwr_idx_diff ht_4s_diff; +}; + +The problem arises because the value of group is 5 for channel 14. The trivial +increase in the dimension of bw40_base fails as this struct must match the layout of +efuse. The fix is to add the rate as an argument to rtw_get_channel_group() and set +the group for channel 14 to 4 if rate <= DESC_RATE11M. + +This patch fixes commit fa6dfe6bff24 ("rtw88: resolve order of tx power setting routines") + +Fixes: fa6dfe6bff24 ("rtw88: resolve order of tx power setting routines") +Reported-by: Богдан Пилипенко +Signed-off-by: Larry Finger +Signed-off-by: Ping-Ke Shih +Cc: Stable +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20210401192717.28927-1-Larry.Finger@lwfinger.net +Acked-by: Takashi Iwai + +--- + drivers/net/wireless/realtek/rtw88/phy.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/realtek/rtw88/phy.c ++++ b/drivers/net/wireless/realtek/rtw88/phy.c +@@ -1352,7 +1352,7 @@ void rtw_phy_load_tables(struct rtw_dev + } + } + +-static u8 rtw_get_channel_group(u8 channel) ++static u8 rtw_get_channel_group(u8 channel, u8 rate) + { + switch (channel) { + default: +@@ -1396,6 +1396,7 @@ static u8 rtw_get_channel_group(u8 chann + case 106: + return 4; + case 14: ++ return rate <= DESC_RATE11M ? 5 : 4; + case 108: + case 110: + case 112: +@@ -1614,7 +1615,7 @@ void rtw_get_tx_power_params(struct rtw_ + s8 *limit = &pwr_param->pwr_limit; + + pwr_idx = &rtwdev->efuse.txpwr_idx_table[path]; +- group = rtw_get_channel_group(ch); ++ group = rtw_get_channel_group(ch, rate); + + /* base power index for 2.4G/5G */ + if (ch <= 14) { diff --git a/patches.suse/sata_mv-add-IRQ-checks.patch b/patches.suse/sata_mv-add-IRQ-checks.patch new file mode 100644 index 0000000..e9f531f --- /dev/null +++ b/patches.suse/sata_mv-add-IRQ-checks.patch @@ -0,0 +1,47 @@ +From e6471a65fdd5efbb8dd2732dd0f063f960685ceb Mon Sep 17 00:00:00 2001 +From: Sergey Shtylyov +Date: Sun, 28 Mar 2021 00:13:49 +0300 +Subject: [PATCH] sata_mv: add IRQ checks +Git-commit: e6471a65fdd5efbb8dd2732dd0f063f960685ceb +Patch-mainline: v5.13-rc1 +References: git-fixes + +The function mv_platform_probe() neglects to check the results of the +calls to platform_get_irq() and irq_of_parse_and_map() and blithely +passes them to ata_host_activate() -- while the latter only checks +for IRQ0 (treating it as a polling mode indicattion) and passes the +negative values to devm_request_irq() causing it to fail as it takes +unsigned values for the IRQ #... + +Add to mv_platform_probe() the proper IRQ checks to pass the positive IRQ +#s to ata_host_activate(), propagate upstream the negative error codes, +and override the IRQ0 with -EINVAL (as we don't want the polling mode). + +Fixes: f351b2d638c3 ("sata_mv: Support SoC controllers") +Signed-off-by: Sergey Shtylyov +Link: https://lore.kernel.org/r/51436f00-27a1-e20b-c21b-0e817e0a7c86@omprussia.ru +Signed-off-by: Jens Axboe +Acked-by: Takashi Iwai + +--- + drivers/ata/sata_mv.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c +index bd23d63435cb..c8867c12c0b8 100644 +--- a/drivers/ata/sata_mv.c ++++ b/drivers/ata/sata_mv.c +@@ -4097,6 +4097,10 @@ static int mv_platform_probe(struct platform_device *pdev) + n_ports = mv_platform_data->n_ports; + irq = platform_get_irq(pdev, 0); + } ++ if (irq < 0) ++ return irq; ++ if (!irq) ++ return -EINVAL; + + host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); + hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); +-- +2.26.2 + diff --git a/patches.suse/scsi-core-Only-return-started-requests-from-scsi_hos.patch b/patches.suse/scsi-core-Only-return-started-requests-from-scsi_hos.patch new file mode 100644 index 0000000..9acab85 --- /dev/null +++ b/patches.suse/scsi-core-Only-return-started-requests-from-scsi_hos.patch @@ -0,0 +1,42 @@ +From: Hannes Reinecke +Date: Mon, 22 Jun 2020 08:30:22 +0200 +Subject: scsi: core: Only return started requests from scsi_host_find_tag() +Patch-mainline: v5.9-rc1 +Git-commit: e73a5e8e8003978e65d368f5475e36e1e2a0613b +References: 1179851 + +scsi_host_find_tag() is used by the drivers to return a scsi command based +on the command tag. Typically it's used from the interrupt handler to fetch +the command associated with a value returned from hardware. Some drivers +like fnic or qla4xxx, however, also use it also to traverse outstanding +commands. With the current implementation scsi_host_find_tag() will return +commands even if they are not started (i.e. passed to the driver). This +will result in random errors with those drivers. With this patch +scsi_host_find_tag() will only return 'started' commands (i.e. commands +which have been passed to the drivers) thus avoiding the above issue. The +other use cases will be unaffected as the interrupt handler naturally will +only ever return 'started' requests. + +Link: https://lore.kernel.org/r/20200622063022.67891-1-hare@suse.de +Signed-off-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +--- + include/scsi/scsi_tcq.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h +index 6053d46e794e..ea7848e74d25 100644 +--- a/include/scsi/scsi_tcq.h ++++ b/include/scsi/scsi_tcq.h +@@ -34,7 +34,7 @@ static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost, + blk_mq_unique_tag_to_tag(tag)); + } + +- if (!req) ++ if (!req || !blk_mq_request_started(req)) + return NULL; + return blk_mq_rq_to_pdu(req); + } +-- +2.31.1 + diff --git a/patches.suse/scsi-lpfc-Change-wording-of-invalid-pci-reset-log-me.patch b/patches.suse/scsi-lpfc-Change-wording-of-invalid-pci-reset-log-me.patch index ac71f6e..214d3ad 100644 --- a/patches.suse/scsi-lpfc-Change-wording-of-invalid-pci-reset-log-me.patch +++ b/patches.suse/scsi-lpfc-Change-wording-of-invalid-pci-reset-log-me.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:17 -0800 Subject: scsi: lpfc: Change wording of invalid pci reset log message -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: a94a40eb64f15f8374699a114cd24fbbf48048ed References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Copyright-updates-for-12.8.0.9-patches.patch b/patches.suse/scsi-lpfc-Copyright-updates-for-12.8.0.9-patches.patch new file mode 100644 index 0000000..5382b04 --- /dev/null +++ b/patches.suse/scsi-lpfc-Copyright-updates-for-12.8.0.9-patches.patch @@ -0,0 +1,66 @@ +From: James Smart +Date: Sun, 11 Apr 2021 18:31:27 -0700 +Subject: scsi: lpfc: Copyright updates for 12.8.0.9 patches +Patch-mainline: v5.13-rc1 +Git-commit: cf270817cafb394547b1d301edfda8222030a26e +References: bsc#1185472 + +Update copyrights to 2021 for files modified in the 12.8.0.9 patch set. + +Link: https://lore.kernel.org/r/20210412013127.2387-17-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_bsg.c | 2 +- + drivers/scsi/lpfc/lpfc_ct.c | 2 +- + drivers/scsi/lpfc/lpfc_hw4.h | 2 +- + drivers/scsi/lpfc/lpfc_mbox.c | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_bsg.c ++++ b/drivers/scsi/lpfc/lpfc_bsg.c +@@ -1,7 +1,7 @@ + /******************************************************************* + * This file is part of the Emulex Linux Device Driver for * + * Fibre Channel Host Bus Adapters. * +- * Copyright (C) 2017-2020 Broadcom. All Rights Reserved. The term * ++ * Copyright (C) 2017-2021 Broadcom. All Rights Reserved. The term * + * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * + * Copyright (C) 2009-2015 Emulex. All rights reserved. * + * EMULEX and SLI are trademarks of Emulex. * +--- a/drivers/scsi/lpfc/lpfc_ct.c ++++ b/drivers/scsi/lpfc/lpfc_ct.c +@@ -1,7 +1,7 @@ + /******************************************************************* + * This file is part of the Emulex Linux Device Driver for * + * Fibre Channel Host Bus Adapters. * +- * Copyright (C) 2017-2020 Broadcom. All Rights Reserved. The term * ++ * Copyright (C) 2017-2021 Broadcom. All Rights Reserved. The term * + * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * + * Copyright (C) 2004-2016 Emulex. All rights reserved. * + * EMULEX and SLI are trademarks of Emulex. * +--- a/drivers/scsi/lpfc/lpfc_hw4.h ++++ b/drivers/scsi/lpfc/lpfc_hw4.h +@@ -1,7 +1,7 @@ + /******************************************************************* + * This file is part of the Emulex Linux Device Driver for * + * Fibre Channel Host Bus Adapters. * +- * Copyright (C) 2017-2020 Broadcom. All Rights Reserved. The term * ++ * Copyright (C) 2017-2021 Broadcom. All Rights Reserved. The term * + * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * + * Copyright (C) 2009-2016 Emulex. All rights reserved. * + * EMULEX and SLI are trademarks of Emulex. * +--- a/drivers/scsi/lpfc/lpfc_mbox.c ++++ b/drivers/scsi/lpfc/lpfc_mbox.c +@@ -1,7 +1,7 @@ + /******************************************************************* + * This file is part of the Emulex Linux Device Driver for * + * Fibre Channel Host Bus Adapters. * +- * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term * ++ * Copyright (C) 2017-2021 Broadcom. All Rights Reserved. The term * + * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * + * Copyright (C) 2004-2016 Emulex. All rights reserved. * + * EMULEX and SLI are trademarks of Emulex. * diff --git a/patches.suse/scsi-lpfc-Correct-function-header-comments-related-t.patch b/patches.suse/scsi-lpfc-Correct-function-header-comments-related-t.patch index 5430dc6..b27415a 100644 --- a/patches.suse/scsi-lpfc-Correct-function-header-comments-related-t.patch +++ b/patches.suse/scsi-lpfc-Correct-function-header-comments-related-t.patch @@ -2,8 +2,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:19 -0800 Subject: scsi: lpfc: Correct function header comments related to ndlp reference counting -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: 69b8eff25c8beb8073d82ebb4cfb8a241540feba References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Eliminate-use-of-LPFC_DRIVER_NAME-in-lpfc_.patch b/patches.suse/scsi-lpfc-Eliminate-use-of-LPFC_DRIVER_NAME-in-lpfc_.patch new file mode 100644 index 0000000..43f9516 --- /dev/null +++ b/patches.suse/scsi-lpfc-Eliminate-use-of-LPFC_DRIVER_NAME-in-lpfc_.patch @@ -0,0 +1,76 @@ +From: James Smart +Date: Sun, 11 Apr 2021 18:31:25 -0700 +Subject: scsi: lpfc: Eliminate use of LPFC_DRIVER_NAME in lpfc_attr.c +Patch-mainline: v5.13-rc1 +Git-commit: 5b1f5089b6e65a8a146ae9d0c69708d369c349e4 +References: bsc#1185472 + +During code inspection, several cases of creating a dynamic attribute names +in logs messages using a define was found. This is unnecessary. + +Place the native symbol name in the log messages. + +Link: https://lore.kernel.org/r/20210412013127.2387-15-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_attr.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_attr.c ++++ b/drivers/scsi/lpfc/lpfc_attr.c +@@ -2272,14 +2272,14 @@ lpfc_enable_bbcr_set(struct lpfc_hba *ph + { + if (lpfc_rangecheck(val, 0, 1) && phba->sli_rev == LPFC_SLI_REV4) { + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, +- "3068 %s_enable_bbcr changed from %d to %d\n", +- LPFC_DRIVER_NAME, phba->cfg_enable_bbcr, val); ++ "3068 lpfc_enable_bbcr changed from %d to " ++ "%d\n", phba->cfg_enable_bbcr, val); + phba->cfg_enable_bbcr = val; + return 0; + } + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, +- "0451 %s_enable_bbcr cannot set to %d, range is 0, 1\n", +- LPFC_DRIVER_NAME, val); ++ "0451 lpfc_enable_bbcr cannot set to %d, range is 0, " ++ "1\n", val); + return -EINVAL; + } + +@@ -2722,8 +2722,8 @@ lpfc_soft_wwn_enable_store(struct device + */ + if (vvvl == 1 && cpu_to_be32(*fawwpn_key) == FAPWWN_KEY_VENDOR) { + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, +- "0051 "LPFC_DRIVER_NAME" soft wwpn can not" +- " be enabled: fawwpn is enabled\n"); ++ "0051 lpfc soft wwpn can not be enabled: " ++ "fawwpn is enabled\n"); + return -EINVAL; + } + +@@ -5208,8 +5208,8 @@ lpfc_cq_max_proc_limit_init(struct lpfc_ + } + + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, +- "0371 "LPFC_DRIVER_NAME"_cq_max_proc_limit: " +- "%d out of range, using default\n", ++ "0371 lpfc_cq_max_proc_limit: %d out of range, using " ++ "default\n", + phba->cfg_cq_max_proc_limit); + + return 0; +@@ -6043,8 +6043,8 @@ lpfc_sg_seg_cnt_init(struct lpfc_hba *ph + return 0; + } + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, +- "0409 "LPFC_DRIVER_NAME"_sg_seg_cnt attribute cannot " +- "be set to %d, allowed range is [%d, %d]\n", ++ "0409 lpfc_sg_seg_cnt attribute cannot be set to %d, " ++ "allowed range is [%d, %d]\n", + val, LPFC_MIN_SG_SEG_CNT, LPFC_MAX_SG_SEG_CNT); + phba->cfg_sg_seg_cnt = LPFC_DEFAULT_SG_SEG_CNT; + return -EINVAL; diff --git a/patches.suse/scsi-lpfc-Fix-ADISC-handling-that-never-frees-nodes.patch b/patches.suse/scsi-lpfc-Fix-ADISC-handling-that-never-frees-nodes.patch index 40a9354..85efe8c 100644 --- a/patches.suse/scsi-lpfc-Fix-ADISC-handling-that-never-frees-nodes.patch +++ b/patches.suse/scsi-lpfc-Fix-ADISC-handling-that-never-frees-nodes.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:13 -0800 Subject: scsi: lpfc: Fix ADISC handling that never frees nodes -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: 309b477462df7542355ac984674a6e89c01c89aa References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Fix-DMA-virtual-address-ptr-assignment-in-.patch b/patches.suse/scsi-lpfc-Fix-DMA-virtual-address-ptr-assignment-in-.patch new file mode 100644 index 0000000..1b1d561 --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-DMA-virtual-address-ptr-assignment-in-.patch @@ -0,0 +1,36 @@ +From: James Smart +Date: Wed, 21 Apr 2021 16:44:48 -0700 +Subject: scsi: lpfc: Fix DMA virtual address ptr assignment in bsg +Patch-mainline: Queued in subsystem maintainer repository +Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git +Git-commit: 83adbba746d1c8b6e3b07d73ae7815044804c96e +References: bsc#1185365 + +lpfc_bsg_ct_unsol_event() routine acts assigns a ct_request to the wrong +structure address, resulting in a bad address that results in bsg related +timeouts. + +Correct the ct_request assignment to use the kernel virtual buffer address +(not the control structure address). + +Link: https://lore.kernel.org/r/20210421234448.102132-1-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_bsg.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/lpfc/lpfc_bsg.c ++++ b/drivers/scsi/lpfc/lpfc_bsg.c +@@ -934,7 +934,7 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba + INIT_LIST_HEAD(&head); + list_add_tail(&head, &piocbq->list); + +- ct_req = (struct lpfc_sli_ct_request *)bdeBuf1; ++ ct_req = (struct lpfc_sli_ct_request *)bdeBuf1->virt; + evt_req_id = ct_req->FsType; + cmd = ct_req->CommandResponse.bits.CmdRsp; + diff --git a/patches.suse/scsi-lpfc-Fix-FLOGI-failure-due-to-accessing-a-freed.patch b/patches.suse/scsi-lpfc-Fix-FLOGI-failure-due-to-accessing-a-freed.patch index c4ddf1f..38402d5 100644 --- a/patches.suse/scsi-lpfc-Fix-FLOGI-failure-due-to-accessing-a-freed.patch +++ b/patches.suse/scsi-lpfc-Fix-FLOGI-failure-due-to-accessing-a-freed.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:04 -0800 Subject: scsi: lpfc: Fix FLOGI failure due to accessing a freed node -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: 618e2ee146d414481c39af61fb018f50bee4ad33 References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Fix-NMI-crash-during-rmmod-due-to-circular.patch b/patches.suse/scsi-lpfc-Fix-NMI-crash-during-rmmod-due-to-circular.patch new file mode 100644 index 0000000..a11d544 --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-NMI-crash-during-rmmod-due-to-circular.patch @@ -0,0 +1,253 @@ +From: James Smart +Date: Sun, 11 Apr 2021 18:31:15 -0700 +Subject: scsi: lpfc: Fix NMI crash during rmmod due to circular hbalock + dependency +Patch-mainline: v5.13-rc1 +Git-commit: a789241e49b6adce84cdba7a24c92ecc845aface +References: bsc#1185472 + +Remove hbalock dependency for lpfc_abts_els_sgl_list and +lpfc_abts_nvmet_ctx_list. The lists are adaquately synchronized with the +sgl_list_lock and abts_nvmet_buf_list_lock. + +Link: https://lore.kernel.org/r/20210412013127.2387-5-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_els.c | 24 +++++++++--------------- + drivers/scsi/lpfc/lpfc_init.c | 26 ++++++++++---------------- + drivers/scsi/lpfc/lpfc_nvmet.c | 26 +++++++++++--------------- + 3 files changed, 30 insertions(+), 46 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_els.c ++++ b/drivers/scsi/lpfc/lpfc_els.c +@@ -10072,8 +10072,7 @@ lpfc_sli4_vport_delete_els_xri_aborted(s + struct lpfc_sglq *sglq_entry = NULL, *sglq_next = NULL; + unsigned long iflag = 0; + +- spin_lock_irqsave(&phba->hbalock, iflag); +- spin_lock(&phba->sli4_hba.sgl_list_lock); ++ spin_lock_irqsave(&phba->sli4_hba.sgl_list_lock, iflag); + list_for_each_entry_safe(sglq_entry, sglq_next, + &phba->sli4_hba.lpfc_abts_els_sgl_list, list) { + if (sglq_entry->ndlp && sglq_entry->ndlp->vport == vport) { +@@ -10081,8 +10080,7 @@ lpfc_sli4_vport_delete_els_xri_aborted(s + sglq_entry->ndlp = NULL; + } + } +- spin_unlock(&phba->sli4_hba.sgl_list_lock); +- spin_unlock_irqrestore(&phba->hbalock, iflag); ++ spin_unlock_irqrestore(&phba->sli4_hba.sgl_list_lock, iflag); + return; + } + +@@ -10109,8 +10107,7 @@ lpfc_sli4_els_xri_aborted(struct lpfc_hb + + pring = lpfc_phba_elsring(phba); + +- spin_lock_irqsave(&phba->hbalock, iflag); +- spin_lock(&phba->sli4_hba.sgl_list_lock); ++ spin_lock_irqsave(&phba->sli4_hba.sgl_list_lock, iflag); + list_for_each_entry_safe(sglq_entry, sglq_next, + &phba->sli4_hba.lpfc_abts_els_sgl_list, list) { + if (sglq_entry->sli4_xritag == xri) { +@@ -10120,8 +10117,8 @@ lpfc_sli4_els_xri_aborted(struct lpfc_hb + list_add_tail(&sglq_entry->list, + &phba->sli4_hba.lpfc_els_sgl_list); + sglq_entry->state = SGL_FREED; +- spin_unlock(&phba->sli4_hba.sgl_list_lock); +- spin_unlock_irqrestore(&phba->hbalock, iflag); ++ spin_unlock_irqrestore(&phba->sli4_hba.sgl_list_lock, ++ iflag); + + if (ndlp) { + lpfc_set_rrq_active(phba, ndlp, +@@ -10136,21 +10133,18 @@ lpfc_sli4_els_xri_aborted(struct lpfc_hb + return; + } + } +- spin_unlock(&phba->sli4_hba.sgl_list_lock); ++ spin_unlock_irqrestore(&phba->sli4_hba.sgl_list_lock, iflag); + lxri = lpfc_sli4_xri_inrange(phba, xri); +- if (lxri == NO_XRI) { +- spin_unlock_irqrestore(&phba->hbalock, iflag); ++ if (lxri == NO_XRI) + return; +- } +- spin_lock(&phba->sli4_hba.sgl_list_lock); ++ ++ spin_lock_irqsave(&phba->hbalock, iflag); + sglq_entry = __lpfc_get_active_sglq(phba, lxri); + if (!sglq_entry || (sglq_entry->sli4_xritag != xri)) { +- spin_unlock(&phba->sli4_hba.sgl_list_lock); + spin_unlock_irqrestore(&phba->hbalock, iflag); + return; + } + sglq_entry->state = SGL_XRI_ABORTED; +- spin_unlock(&phba->sli4_hba.sgl_list_lock); + spin_unlock_irqrestore(&phba->hbalock, iflag); + return; + } +--- a/drivers/scsi/lpfc/lpfc_init.c ++++ b/drivers/scsi/lpfc/lpfc_init.c +@@ -1043,12 +1043,11 @@ lpfc_hba_down_post_s4(struct lpfc_hba *p + * driver is unloading or reposted if the driver is restarting + * the port. + */ +- spin_lock_irq(&phba->hbalock); /* required for lpfc_els_sgl_list and */ +- /* scsl_buf_list */ ++ + /* sgl_list_lock required because worker thread uses this + * list. + */ +- spin_lock(&phba->sli4_hba.sgl_list_lock); ++ spin_lock_irq(&phba->sli4_hba.sgl_list_lock); + list_for_each_entry(sglq_entry, + &phba->sli4_hba.lpfc_abts_els_sgl_list, list) + sglq_entry->state = SGL_FREED; +@@ -1057,11 +1056,12 @@ lpfc_hba_down_post_s4(struct lpfc_hba *p + &phba->sli4_hba.lpfc_els_sgl_list); + + +- spin_unlock(&phba->sli4_hba.sgl_list_lock); ++ spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); + + /* abts_xxxx_buf_list_lock required because worker thread uses this + * list. + */ ++ spin_lock_irq(&phba->hbalock); + cnt = 0; + for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { + qp = &phba->sli4_hba.hdwq[idx]; +@@ -3804,12 +3804,10 @@ lpfc_sli4_els_sgl_update(struct lpfc_hba + sglq_entry->state = SGL_FREED; + list_add_tail(&sglq_entry->list, &els_sgl_list); + } +- spin_lock_irq(&phba->hbalock); +- spin_lock(&phba->sli4_hba.sgl_list_lock); ++ spin_lock_irq(&phba->sli4_hba.sgl_list_lock); + list_splice_init(&els_sgl_list, + &phba->sli4_hba.lpfc_els_sgl_list); +- spin_unlock(&phba->sli4_hba.sgl_list_lock); +- spin_unlock_irq(&phba->hbalock); ++ spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); + } else if (els_xri_cnt < phba->sli4_hba.els_xri_cnt) { + /* els xri-sgl shrinked */ + xri_cnt = phba->sli4_hba.els_xri_cnt - els_xri_cnt; +@@ -3817,8 +3815,7 @@ lpfc_sli4_els_sgl_update(struct lpfc_hba + "3158 ELS xri-sgl count decreased from " + "%d to %d\n", phba->sli4_hba.els_xri_cnt, + els_xri_cnt); +- spin_lock_irq(&phba->hbalock); +- spin_lock(&phba->sli4_hba.sgl_list_lock); ++ spin_lock_irq(&phba->sli4_hba.sgl_list_lock); + list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, + &els_sgl_list); + /* release extra els sgls from list */ +@@ -3833,8 +3830,7 @@ lpfc_sli4_els_sgl_update(struct lpfc_hba + } + list_splice_init(&els_sgl_list, + &phba->sli4_hba.lpfc_els_sgl_list); +- spin_unlock(&phba->sli4_hba.sgl_list_lock); +- spin_unlock_irq(&phba->hbalock); ++ spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); + } else + lpfc_printf_log(phba, KERN_INFO, LOG_SLI, + "3163 ELS xri-sgl count unchanged: %d\n", +@@ -7388,11 +7384,9 @@ lpfc_free_els_sgl_list(struct lpfc_hba * + LIST_HEAD(sglq_list); + + /* Retrieve all els sgls from driver list */ +- spin_lock_irq(&phba->hbalock); +- spin_lock(&phba->sli4_hba.sgl_list_lock); ++ spin_lock_irq(&phba->sli4_hba.sgl_list_lock); + list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, &sglq_list); +- spin_unlock(&phba->sli4_hba.sgl_list_lock); +- spin_unlock_irq(&phba->hbalock); ++ spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); + + /* Now free the sgl list */ + lpfc_free_sgl_list(phba, &sglq_list); +--- a/drivers/scsi/lpfc/lpfc_nvmet.c ++++ b/drivers/scsi/lpfc/lpfc_nvmet.c +@@ -1440,7 +1440,10 @@ static void + list_del_init(&ctx_buf->list); + spin_unlock(&phba->sli4_hba.abts_nvmet_buf_list_lock); + ++ spin_lock(&phba->hbalock); + __lpfc_clear_active_sglq(phba, ctx_buf->sglq->sli4_lxritag); ++ spin_unlock(&phba->hbalock); ++ + ctx_buf->sglq->state = SGL_FREED; + ctx_buf->sglq->ndlp = NULL; + +@@ -1787,8 +1790,7 @@ lpfc_sli4_nvmet_xri_aborted(struct lpfc_ + atomic_inc(&tgtp->xmt_fcp_xri_abort_cqe); + } + +- spin_lock_irqsave(&phba->hbalock, iflag); +- spin_lock(&phba->sli4_hba.abts_nvmet_buf_list_lock); ++ spin_lock_irqsave(&phba->sli4_hba.abts_nvmet_buf_list_lock, iflag); + list_for_each_entry_safe(ctxp, next_ctxp, + &phba->sli4_hba.lpfc_abts_nvmet_ctx_list, + list) { +@@ -1806,10 +1808,10 @@ lpfc_sli4_nvmet_xri_aborted(struct lpfc_ + } + ctxp->flag &= ~LPFC_NVME_XBUSY; + spin_unlock(&ctxp->ctxlock); +- spin_unlock(&phba->sli4_hba.abts_nvmet_buf_list_lock); ++ spin_unlock_irqrestore(&phba->sli4_hba.abts_nvmet_buf_list_lock, ++ iflag); + + rrq_empty = list_empty(&phba->active_rrq_list); +- spin_unlock_irqrestore(&phba->hbalock, iflag); + ndlp = lpfc_findnode_did(phba->pport, ctxp->sid); + if (ndlp && + (ndlp->nlp_state == NLP_STE_UNMAPPED_NODE || +@@ -1830,9 +1832,7 @@ lpfc_sli4_nvmet_xri_aborted(struct lpfc_ + lpfc_worker_wake_up(phba); + return; + } +- spin_unlock(&phba->sli4_hba.abts_nvmet_buf_list_lock); +- spin_unlock_irqrestore(&phba->hbalock, iflag); +- ++ spin_unlock_irqrestore(&phba->sli4_hba.abts_nvmet_buf_list_lock, iflag); + ctxp = lpfc_nvmet_get_ctx_for_xri(phba, xri); + if (ctxp) { + /* +@@ -1876,8 +1876,7 @@ lpfc_nvmet_rcv_unsol_abort(struct lpfc_v + sid = sli4_sid_from_fc_hdr(fc_hdr); + oxid = be16_to_cpu(fc_hdr->fh_ox_id); + +- spin_lock_irqsave(&phba->hbalock, iflag); +- spin_lock(&phba->sli4_hba.abts_nvmet_buf_list_lock); ++ spin_lock_irqsave(&phba->sli4_hba.abts_nvmet_buf_list_lock, iflag); + list_for_each_entry_safe(ctxp, next_ctxp, + &phba->sli4_hba.lpfc_abts_nvmet_ctx_list, + list) { +@@ -1886,9 +1885,8 @@ lpfc_nvmet_rcv_unsol_abort(struct lpfc_v + + xri = ctxp->ctxbuf->sglq->sli4_xritag; + +- spin_unlock(&phba->sli4_hba.abts_nvmet_buf_list_lock); +- spin_unlock_irqrestore(&phba->hbalock, iflag); +- ++ spin_unlock_irqrestore(&phba->sli4_hba.abts_nvmet_buf_list_lock, ++ iflag); + spin_lock_irqsave(&ctxp->ctxlock, iflag); + ctxp->flag |= LPFC_NVME_ABTS_RCV; + spin_unlock_irqrestore(&ctxp->ctxlock, iflag); +@@ -1907,9 +1905,7 @@ lpfc_nvmet_rcv_unsol_abort(struct lpfc_v + lpfc_sli4_seq_abort_rsp(vport, fc_hdr, 1); + return 0; + } +- spin_unlock(&phba->sli4_hba.abts_nvmet_buf_list_lock); +- spin_unlock_irqrestore(&phba->hbalock, iflag); +- ++ spin_unlock_irqrestore(&phba->sli4_hba.abts_nvmet_buf_list_lock, iflag); + /* check the wait list */ + if (phba->sli4_hba.nvmet_io_wait_cnt) { + struct rqb_dmabuf *nvmebuf; diff --git a/patches.suse/scsi-lpfc-Fix-PLOGI-ACC-to-be-transmit-after-REG_LOG.patch b/patches.suse/scsi-lpfc-Fix-PLOGI-ACC-to-be-transmit-after-REG_LOG.patch index 35d708b..075f684 100644 --- a/patches.suse/scsi-lpfc-Fix-PLOGI-ACC-to-be-transmit-after-REG_LOG.patch +++ b/patches.suse/scsi-lpfc-Fix-PLOGI-ACC-to-be-transmit-after-REG_LOG.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:12 -0800 Subject: scsi: lpfc: Fix PLOGI ACC to be transmit after REG_LOGIN -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: 143753059b8b957f1cf4355338a3e3a32f3a85bf References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Fix-a-bunch-of-kernel-doc-issues.patch b/patches.suse/scsi-lpfc-Fix-a-bunch-of-kernel-doc-issues.patch new file mode 100644 index 0000000..ec581d4 --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-a-bunch-of-kernel-doc-issues.patch @@ -0,0 +1,96 @@ +From: Lee Jones +Date: Wed, 3 Mar 2021 14:46:18 +0000 +Subject: scsi: lpfc: Fix a bunch of kernel-doc issues +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Patch-mainline: v5.13-rc1 +Git-commit: 8514e2f1e2c6d78537eb66585b69ab59138e0220 +References: bsc#1185472 + +Fixes the following W=1 kernel build warning(s): + + drivers/scsi/lpfc/lpfc_sli.c:9654: warning: expecting prototype for lpfc_sli_iocb2wqe(). Prototype was for lpfc_sli4_iocb2wqe() instead + drivers/scsi/lpfc/lpfc_sli.c:10439: warning: Function parameter or member 'phba' not described in 'lpfc_sli_issue_fcp_io' + drivers/scsi/lpfc/lpfc_sli.c:10439: warning: Function parameter or member 'ring_number' not described in 'lpfc_sli_issue_fcp_io' + drivers/scsi/lpfc/lpfc_sli.c:10439: warning: Function parameter or member 'piocb' not described in 'lpfc_sli_issue_fcp_io' + drivers/scsi/lpfc/lpfc_sli.c:10439: warning: Function parameter or member 'flag' not described in 'lpfc_sli_issue_fcp_io' + drivers/scsi/lpfc/lpfc_sli.c:14189: warning: expecting prototype for lpfc_sli4_sp_process_cq(). Prototype was for __lpfc_sli4_sp_process_cq() instead + drivers/scsi/lpfc/lpfc_sli.c:14754: warning: expecting prototype for lpfc_sli4_hba_process_cq(). Prototype was for lpfc_sli4_dly_hba_process_cq() instead + drivers/scsi/lpfc/lpfc_sli.c:17230: warning: expecting prototype for lpfc_sli4_free_xri(). Prototype was for __lpfc_sli4_free_xri() instead + drivers/scsi/lpfc/lpfc_sli.c:18950: warning: expecting prototype for lpfc_sli4_free_rpi(). Prototype was for __lpfc_sli4_free_rpi() instead + +Link: https://lore.kernel.org/r/20210303144631.3175331-18-lee.jones@linaro.org +Cc: James Smart +Cc: Dick Kennedy +Cc: "James E.J. Bottomley" +Cc: "Martin K. Petersen" +Cc: Sumit Semwal +Cc: "Christian König" +Cc: linux-scsi@vger.kernel.org +Cc: linux-media@vger.kernel.org +Cc: dri-devel@lists.freedesktop.org +Cc: linaro-mm-sig@lists.linaro.org +Signed-off-by: Lee Jones +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_sli.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_sli.c ++++ b/drivers/scsi/lpfc/lpfc_sli.c +@@ -9632,7 +9632,7 @@ lpfc_sli4_bpl2sgl(struct lpfc_hba *phba, + } + + /** +- * lpfc_sli_iocb2wqe - Convert the IOCB to a work queue entry. ++ * lpfc_sli4_iocb2wqe - Convert the IOCB to a work queue entry. + * @phba: Pointer to HBA context object. + * @iocbq: Pointer to command iocb. + * @wqe: Pointer to the work queue entry. +@@ -10418,7 +10418,7 @@ static int + return 0; + } + +-/** ++/* + * lpfc_sli_issue_fcp_io - Wrapper func for issuing fcp i/o + * + * This routine wraps the actual fcp i/o function for issusing WQE for sli-4 +@@ -14167,7 +14167,7 @@ static bool + } + + /** +- * lpfc_sli4_sp_process_cq - Process a slow-path event queue entry ++ * __lpfc_sli4_sp_process_cq - Process a slow-path event queue entry + * @cq: pointer to CQ to process + * + * This routine calls the cq processing routine with a handler specific +@@ -14741,7 +14741,7 @@ lpfc_sli4_hba_process_cq(struct work_str + } + + /** +- * lpfc_sli4_hba_process_cq - fast-path work handler when started by timer ++ * lpfc_sli4_dly_hba_process_cq - fast-path work handler when started by timer + * @work: pointer to work element + * + * translates from the work handler and calls the fast-path handler. +@@ -17215,7 +17215,7 @@ lpfc_sli4_alloc_xri(struct lpfc_hba *phb + } + + /** +- * lpfc_sli4_free_xri - Release an xri for reuse. ++ * __lpfc_sli4_free_xri - Release an xri for reuse. + * @phba: pointer to lpfc hba data structure. + * @xri: xri to release. + * +@@ -18935,7 +18935,7 @@ lpfc_sli4_alloc_rpi(struct lpfc_hba *phb + } + + /** +- * lpfc_sli4_free_rpi - Release an rpi for reuse. ++ * __lpfc_sli4_free_rpi - Release an rpi for reuse. + * @phba: pointer to lpfc hba data structure. + * @rpi: rpi to free + * diff --git a/patches.suse/scsi-lpfc-Fix-a-bunch-of-kernel-doc-misdemeanours.patch b/patches.suse/scsi-lpfc-Fix-a-bunch-of-kernel-doc-misdemeanours.patch new file mode 100644 index 0000000..29067ca --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-a-bunch-of-kernel-doc-misdemeanours.patch @@ -0,0 +1,139 @@ +From: Lee Jones +Date: Fri, 12 Mar 2021 09:47:11 +0000 +Subject: scsi: lpfc: Fix a bunch of kernel-doc misdemeanours +Patch-mainline: v5.13-rc1 +Git-commit: 0bb87e01d81575bf6b0007752e637f3253410553 +References: bsc#1185472 + +Fixes the following W=1 kernel build warning(s): + + drivers/scsi/lpfc/lpfc_scsi.c:746: warning: expecting prototype for lpfc_release_scsi_buf(). Prototype was for lpfc_release_scsi_buf_s3() instead + drivers/scsi/lpfc/lpfc_scsi.c:979: warning: expecting prototype for App checking is required for(). Prototype was for BG_ERR_CHECK() instead + drivers/scsi/lpfc/lpfc_scsi.c:3701: warning: Function parameter or member 'vport' not described in 'lpfc_scsi_prep_cmnd_buf' + drivers/scsi/lpfc/lpfc_scsi.c:3701: warning: Excess function parameter 'phba' description in 'lpfc_scsi_prep_cmnd_buf' + drivers/scsi/lpfc/lpfc_scsi.c:3717: warning: Function parameter or member 'fcpi_parm' not described in 'lpfc_send_scsi_error_event' + drivers/scsi/lpfc/lpfc_scsi.c:3717: warning: Excess function parameter 'rsp_iocb' description in 'lpfc_send_scsi_error_event' + drivers/scsi/lpfc/lpfc_scsi.c:3837: warning: Function parameter or member 'fcpi_parm' not described in 'lpfc_handle_fcp_err' + drivers/scsi/lpfc/lpfc_scsi.c:3837: warning: expecting prototype for lpfc_handler_fcp_err(). Prototype was for lpfc_handle_fcp_err() instead + drivers/scsi/lpfc/lpfc_scsi.c:4021: warning: Function parameter or member 'wcqe' not described in 'lpfc_fcp_io_cmd_wqe_cmpl' + drivers/scsi/lpfc/lpfc_scsi.c:4021: warning: Excess function parameter 'pwqeOut' description in 'lpfc_fcp_io_cmd_wqe_cmpl' + drivers/scsi/lpfc/lpfc_scsi.c:4621: warning: Function parameter or member 'vport' not described in 'lpfc_scsi_prep_cmnd_buf_s3' + drivers/scsi/lpfc/lpfc_scsi.c:4621: warning: Excess function parameter 'phba' description in 'lpfc_scsi_prep_cmnd_buf_s3' + drivers/scsi/lpfc/lpfc_scsi.c:4698: warning: Function parameter or member 'vport' not described in 'lpfc_scsi_prep_cmnd_buf_s4' + drivers/scsi/lpfc/lpfc_scsi.c:4698: warning: Excess function parameter 'phba' description in 'lpfc_scsi_prep_cmnd_buf_s4' + drivers/scsi/lpfc/lpfc_scsi.c:4954: warning: expecting prototype for lpfc_taskmgmt_def_cmpl(). Prototype was for lpfc_tskmgmt_def_cmpl() instead + drivers/scsi/lpfc/lpfc_scsi.c:5094: warning: expecting prototype for lpfc_poll_rearm_time(). Prototype was for lpfc_poll_rearm_timer() instead + +Link: https://lore.kernel.org/r/20210312094738.2207817-4-lee.jones@linaro.org +Cc: James Smart +Cc: Dick Kennedy +Cc: "James E.J. Bottomley" +Cc: "Martin K. Petersen" +Cc: linux-scsi@vger.kernel.org +Signed-off-by: Lee Jones +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_scsi.c | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_scsi.c ++++ b/drivers/scsi/lpfc/lpfc_scsi.c +@@ -736,7 +736,7 @@ lpfc_get_scsi_buf(struct lpfc_hba *phba, + } + + /** +- * lpfc_release_scsi_buf - Return a scsi buffer back to hba scsi buf list ++ * lpfc_release_scsi_buf_s3 - Return a scsi buffer back to hba scsi buf list + * @phba: The Hba for which this call is being executed. + * @psb: The scsi buffer which is being released. + * +@@ -974,10 +974,10 @@ lpfc_scsi_prep_dma_buf_s3(struct lpfc_hb + #define BG_ERR_TGT 0x2 + /* Return BG_ERR_SWAP if swapping CSUM<-->CRC is required for error injection */ + #define BG_ERR_SWAP 0x10 +-/** ++/* + * Return BG_ERR_CHECK if disabling Guard/Ref/App checking is required for + * error injection +- **/ ++ */ + #define BG_ERR_CHECK 0x20 + + /** +@@ -3699,7 +3699,7 @@ lpfc_bg_scsi_prep_dma_buf(struct lpfc_hb + /** + * lpfc_scsi_prep_cmnd_buf - Wrapper function for IOCB/WQE mapping of scsi + * buffer +- * @phba: The Hba for which this call is being executed. ++ * @vport: Pointer to vport object. + * @lpfc_cmd: The scsi buffer which is going to be mapped. + * @tmo: Timeout value for IO + * +@@ -3721,7 +3721,7 @@ lpfc_scsi_prep_cmnd_buf(struct lpfc_vpor + * @phba: Pointer to hba context object. + * @vport: Pointer to vport object. + * @lpfc_cmd: Pointer to lpfc scsi command which reported the error. +- * @rsp_iocb: Pointer to response iocb object which reported error. ++ * @fcpi_parm: FCP Initiator parameter. + * + * This function posts an event when there is a SCSI command reporting + * error from the scsi device. +@@ -3836,10 +3836,10 @@ lpfc_scsi_unprep_dma_buf(struct lpfc_hba + } + + /** +- * lpfc_handler_fcp_err - FCP response handler ++ * lpfc_handle_fcp_err - FCP response handler + * @vport: The virtual port for which this call is being executed. + * @lpfc_cmd: Pointer to lpfc_io_buf data structure. +- * @rsp_iocb: The response IOCB which contains FCP error. ++ * @fcpi_parm: FCP Initiator parameter. + * + * This routine is called to process response IOCB with status field + * IOSTAT_FCP_RSP_ERROR. This routine sets result field of scsi command +@@ -4023,7 +4023,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *v + * lpfc_fcp_io_cmd_wqe_cmpl - Complete a FCP IO + * @phba: The hba for which this call is being executed. + * @pwqeIn: The command WQE for the scsi cmnd. +- * @pwqeOut: The response WQE for the scsi cmnd. ++ * @wcqe: Pointer to driver response CQE object. + * + * This routine assigns scsi command result by looking into response WQE + * status field appropriately. This routine handles QUEUE FULL condition as +@@ -4619,7 +4619,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba + + /** + * lpfc_scsi_prep_cmnd_buf_s3 - SLI-3 IOCB init for the IO +- * @phba: Pointer to vport object for which I/O is executed ++ * @vport: Pointer to vport object. + * @lpfc_cmd: The scsi buffer which is going to be prep'ed. + * @tmo: timeout value for the IO + * +@@ -4696,7 +4696,7 @@ static int lpfc_scsi_prep_cmnd_buf_s3(st + + /** + * lpfc_scsi_prep_cmnd_buf_s4 - SLI-4 WQE init for the IO +- * @phba: Pointer to vport object for which I/O is executed ++ * @vport: Pointer to vport object. + * @lpfc_cmd: The scsi buffer which is going to be prep'ed. + * @tmo: timeout value for the IO + * +@@ -4953,7 +4953,7 @@ lpfc_scsi_api_table_setup(struct lpfc_hb + } + + /** +- * lpfc_taskmgmt_def_cmpl - IOCB completion routine for task management command ++ * lpfc_tskmgmt_def_cmpl - IOCB completion routine for task management command + * @phba: The Hba for which this call is being executed. + * @cmdiocbq: Pointer to lpfc_iocbq data structure. + * @rspiocbq: Pointer to lpfc_iocbq data structure. +@@ -5098,7 +5098,7 @@ lpfc_info(struct Scsi_Host *host) + } + + /** +- * lpfc_poll_rearm_time - Routine to modify fcp_poll timer of hba ++ * lpfc_poll_rearm_timer - Routine to modify fcp_poll timer of hba + * @phba: The Hba for which this call is being executed. + * + * This routine modifies fcp_poll_timer field of @phba by cfg_poll_tmo. diff --git a/patches.suse/scsi-lpfc-Fix-a-bunch-of-misnamed-functions.patch b/patches.suse/scsi-lpfc-Fix-a-bunch-of-misnamed-functions.patch new file mode 100644 index 0000000..64404e6 --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-a-bunch-of-misnamed-functions.patch @@ -0,0 +1,85 @@ +From: Lee Jones +Date: Fri, 12 Mar 2021 09:47:12 +0000 +Subject: scsi: lpfc: Fix a bunch of misnamed functions +Patch-mainline: v5.13-rc1 +Git-commit: a3dbf5145d01cdb41b726283afa10a6ff8b0977c +References: bsc#1185472 + +Fixes the following W=1 kernel build warning(s): + + drivers/scsi/lpfc/lpfc_attr.c:880: warning: expecting prototype for lpfc_state_show(). Prototype was for lpfc_link_state_show() instead + drivers/scsi/lpfc/lpfc_attr.c:3834: warning: expecting prototype for lpfc_tgt_queue_depth_store(). Prototype was for lpfc_tgt_queue_depth_set() instead + drivers/scsi/lpfc/lpfc_attr.c:4027: warning: expecting prototype for lpfc_topology_set(). Prototype was for lpfc_topology_store() instead + drivers/scsi/lpfc/lpfc_attr.c:4481: warning: expecting prototype for lpfc_link_speed_set(). Prototype was for lpfc_link_speed_store() instead + drivers/scsi/lpfc/lpfc_attr.c:4879: warning: expecting prototype for lpfc_request_firmware_store(). Prototype was for lpfc_request_firmware_upgrade_store() instead + drivers/scsi/lpfc/lpfc_attr.c:5235: warning: expecting prototype for lpfc_state_show(). Prototype was for lpfc_fcp_cpu_map_show() instead + +Link: https://lore.kernel.org/r/20210312094738.2207817-5-lee.jones@linaro.org +Cc: James Smart +Cc: Dick Kennedy +Cc: "James E.J. Bottomley" +Cc: "Martin K. Petersen" +Cc: linux-scsi@vger.kernel.org +Signed-off-by: Lee Jones +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_attr.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_attr.c ++++ b/drivers/scsi/lpfc/lpfc_attr.c +@@ -864,7 +864,7 @@ lpfc_option_rom_version_show(struct devi + } + + /** +- * lpfc_state_show - Return the link state of the port ++ * lpfc_link_state_show - Return the link state of the port + * @dev: class converted to a Scsi_host structure. + * @attr: device attribute, not used. + * @buf: on return contains text describing the state of the link. +@@ -3819,7 +3819,7 @@ lpfc_vport_param_init(tgt_queue_depth, L + LPFC_MIN_TGT_QDEPTH, LPFC_MAX_TGT_QDEPTH); + + /** +- * lpfc_tgt_queue_depth_store: Sets an attribute value. ++ * lpfc_tgt_queue_depth_set: Sets an attribute value. + * @vport: lpfc vport structure pointer. + * @val: integer attribute value. + * +@@ -4004,7 +4004,7 @@ LPFC_ATTR(topology, 0, 0, 6, + "Select Fibre Channel topology"); + + /** +- * lpfc_topology_set - Set the adapters topology field ++ * lpfc_topology_store - Set the adapters topology field + * @dev: class device that is converted into a scsi_host. + * @attr:device attribute, not used. + * @buf: buffer for passing information. +@@ -4457,7 +4457,7 @@ static struct bin_attribute sysfs_drvr_s + # Value range is [0,16]. Default value is 0. + */ + /** +- * lpfc_link_speed_set - Set the adapters link speed ++ * lpfc_link_speed_store - Set the adapters link speed + * @dev: Pointer to class device. + * @attr: Unused. + * @buf: Data buffer. +@@ -4858,7 +4858,7 @@ lpfc_param_show(sriov_nr_virtfn) + static DEVICE_ATTR_RW(lpfc_sriov_nr_virtfn); + + /** +- * lpfc_request_firmware_store - Request for Linux generic firmware upgrade ++ * lpfc_request_firmware_upgrade_store - Request for Linux generic firmware upgrade + * + * @dev: class device that is converted into a Scsi_host. + * @attr: device attribute, not used. +@@ -5222,7 +5222,7 @@ lpfc_cq_max_proc_limit_init(struct lpfc_ + static DEVICE_ATTR_RW(lpfc_cq_max_proc_limit); + + /** +- * lpfc_state_show - Display current driver CPU affinity ++ * lpfc_fcp_cpu_map_show - Display current driver CPU affinity + * @dev: class converted to a Scsi_host structure. + * @attr: device attribute, not used. + * @buf: on return contains text describing the state of the link. diff --git a/patches.suse/scsi-lpfc-Fix-a-few-incorrectly-named-functions.patch b/patches.suse/scsi-lpfc-Fix-a-few-incorrectly-named-functions.patch new file mode 100644 index 0000000..4aa4458 --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-a-few-incorrectly-named-functions.patch @@ -0,0 +1,55 @@ +From: Lee Jones +Date: Fri, 12 Mar 2021 09:47:21 +0000 +Subject: scsi: lpfc: Fix a few incorrectly named functions +Patch-mainline: v5.13-rc1 +Git-commit: 3145d2d69e1600d924aaf23199e63995b1ea108b +References: bsc#1185472 + +Fixes the following W=1 kernel build warning(s): + + drivers/scsi/lpfc/lpfc_bsg.c:3591: warning: expecting prototype for lpfc_bsg_mbox_ext_cleanup(). Prototype was for lpfc_bsg_mbox_ext_session_reset() instead + drivers/scsi/lpfc/lpfc_bsg.c:3885: warning: expecting prototype for lpfc_bsg_sli_cfg_mse_read_cmd_ext(). Prototype was for lpfc_bsg_sli_cfg_read_cmd_ext() instead + drivers/scsi/lpfc/lpfc_bsg.c:4371: warning: expecting prototype for lpfc_bsg_mbox_ext_abort_req(). Prototype was for lpfc_bsg_mbox_ext_abort() instead + +Link: https://lore.kernel.org/r/20210312094738.2207817-14-lee.jones@linaro.org +Cc: James Smart +Cc: Dick Kennedy +Cc: "James E.J. Bottomley" +Cc: "Martin K. Petersen" +Cc: linux-scsi@vger.kernel.org +Signed-off-by: Lee Jones +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_bsg.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_bsg.c ++++ b/drivers/scsi/lpfc/lpfc_bsg.c +@@ -3580,7 +3580,7 @@ static int lpfc_bsg_check_cmd_access(str + } + + /** +- * lpfc_bsg_mbox_ext_cleanup - clean up context of multi-buffer mbox session ++ * lpfc_bsg_mbox_ext_session_reset - clean up context of multi-buffer mbox session + * @phba: Pointer to HBA context object. + * + * This is routine clean up and reset BSG handling of multi-buffer mbox +@@ -3869,7 +3869,7 @@ lpfc_bsg_sli_cfg_dma_desc_setup(struct l + } + + /** +- * lpfc_bsg_sli_cfg_mse_read_cmd_ext - sli_config non-embedded mailbox cmd read ++ * lpfc_bsg_sli_cfg_read_cmd_ext - sli_config non-embedded mailbox cmd read + * @phba: Pointer to HBA context object. + * @job: Pointer to the job object. + * @nemb_tp: Enumerate of non-embedded mailbox command type. +@@ -4360,7 +4360,7 @@ lpfc_bsg_handle_sli_cfg_mbox(struct lpfc + } + + /** +- * lpfc_bsg_mbox_ext_abort_req - request to abort mbox command with ext buffers ++ * lpfc_bsg_mbox_ext_abort - request to abort mbox command with ext buffers + * @phba: Pointer to HBA context object. + * + * This routine is for requesting to abort a pass-through mailbox command with diff --git a/patches.suse/scsi-lpfc-Fix-a-typo-f1891f9b.patch b/patches.suse/scsi-lpfc-Fix-a-typo-f1891f9b.patch new file mode 100644 index 0000000..2179485 --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-a-typo-f1891f9b.patch @@ -0,0 +1,28 @@ +From: Bhaskar Chowdhury +Date: Wed, 24 Mar 2021 12:18:29 +0530 +Subject: scsi: lpfc: Fix a typo +Patch-mainline: v5.13-rc1 +Git-commit: f1891f9bbc46f83099cbd0911b81b7225258ac03 +References: bsc#1185472 + +s/conditons/conditions/ + +Link: https://lore.kernel.org/r/20210324064829.32092-1-unixbhaskar@gmail.com +Signed-off-by: Bhaskar Chowdhury +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_els.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/lpfc/lpfc_els.c ++++ b/drivers/scsi/lpfc/lpfc_els.c +@@ -1888,7 +1888,7 @@ lpfc_cmpl_els_rrq(struct lpfc_hba *phba, + * ndlp on the vport node list that matches the remote node ID from the + * PLOGI response IOCB. If such ndlp does not exist, the PLOGI is simply + * ignored and command IOCB released. The PLOGI response IOCB status is +- * checked for error conditons. If there is error status reported, PLOGI ++ * checked for error conditions. If there is error status reported, PLOGI + * retry shall be attempted by invoking the lpfc_els_retry() routine. + * Otherwise, the lpfc_plogi_confirm_nport() routine shall be invoked on + * the ndlp and the NLP_EVT_CMPL_PLOGI state to the Discover State Machine diff --git a/patches.suse/scsi-lpfc-Fix-a-typo.patch b/patches.suse/scsi-lpfc-Fix-a-typo.patch new file mode 100644 index 0000000..77a5bf4 --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-a-typo.patch @@ -0,0 +1,47 @@ +From: wengjianfeng +Date: Mon, 22 Mar 2021 15:56:45 +0800 +Subject: scsi: lpfc: Fix a typo +Patch-mainline: v5.13-rc1 +Git-commit: 89bbf550eafccd120eb9c6c962f6eeda3b8a254c +References: bsc#1185472 + +Change 'lenth' to 'length'. + +Link: https://lore.kernel.org/r/20210322075645.25636-1-samirweng1979@163.com +Acked-by: Randy Dunlap +Signed-off-by: wengjianfeng +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_debugfs.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_debugfs.c ++++ b/drivers/scsi/lpfc/lpfc_debugfs.c +@@ -5154,7 +5154,7 @@ lpfc_idiag_mbxacc_write(struct file *fil + * This routine is to get the available extent information. + * + * Returns: +- * overall lenth of the data read into the internal buffer. ++ * overall length of the data read into the internal buffer. + **/ + static int + lpfc_idiag_extacc_avail_get(struct lpfc_hba *phba, char *pbuffer, int len) +@@ -5205,7 +5205,7 @@ lpfc_idiag_extacc_avail_get(struct lpfc_ + * This routine is to get the allocated extent information. + * + * Returns: +- * overall lenth of the data read into the internal buffer. ++ * overall length of the data read into the internal buffer. + **/ + static int + lpfc_idiag_extacc_alloc_get(struct lpfc_hba *phba, char *pbuffer, int len) +@@ -5277,7 +5277,7 @@ lpfc_idiag_extacc_alloc_get(struct lpfc_ + * This routine is to get the driver extent information. + * + * Returns: +- * overall lenth of the data read into the internal buffer. ++ * overall length of the data read into the internal buffer. + **/ + static int + lpfc_idiag_extacc_drivr_get(struct lpfc_hba *phba, char *pbuffer, int len) diff --git a/patches.suse/scsi-lpfc-Fix-crash-caused-by-switch-reboot.patch b/patches.suse/scsi-lpfc-Fix-crash-caused-by-switch-reboot.patch index f800607..9a0147b 100644 --- a/patches.suse/scsi-lpfc-Fix-crash-caused-by-switch-reboot.patch +++ b/patches.suse/scsi-lpfc-Fix-crash-caused-by-switch-reboot.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:16 -0800 Subject: scsi: lpfc: Fix crash caused by switch reboot -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: 9628aace0d1f74f81baaa353f38e929fb4580248 References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Fix-crash-when-a-REG_RPI-mailbox-fails-tri.patch b/patches.suse/scsi-lpfc-Fix-crash-when-a-REG_RPI-mailbox-fails-tri.patch new file mode 100644 index 0000000..8928e26 --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-crash-when-a-REG_RPI-mailbox-fails-tri.patch @@ -0,0 +1,51 @@ +From: James Smart +Date: Sun, 11 Apr 2021 18:31:13 -0700 +Subject: scsi: lpfc: Fix crash when a REG_RPI mailbox fails triggering a LOGO + response +Patch-mainline: v5.13-rc1 +Git-commit: fffd18ec6579c2d9c72b212169259062fe747888 +References: bsc#1185472 + +Fix a crash caused by a double put on the node when the driver completed an +ACC for an unsolicted abort on the same node. The second put was executed +by lpfc_nlp_not_used() and is wrong because the completion routine executes +the nlp_put when the iocbq was released. Additionally, the driver is +issuing a LOGO then immediately calls lpfc_nlp_set_state to put the node +into NPR. This call does nothing. + +Remove the lpfc_nlp_not_used call and additional set_state in the +completion routine. Remove the lpfc_nlp_set_state post issue_logo. Isn't +necessary. + +Link: https://lore.kernel.org/r/20210412013127.2387-3-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_nportdisc.c | 2 -- + drivers/scsi/lpfc/lpfc_sli.c | 1 - + 2 files changed, 3 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_nportdisc.c ++++ b/drivers/scsi/lpfc/lpfc_nportdisc.c +@@ -1901,8 +1901,6 @@ lpfc_cmpl_reglogin_reglogin_issue(struct + ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; + + lpfc_issue_els_logo(vport, ndlp, 0); +- ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; +- lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); + return ndlp->nlp_state; + } + +--- a/drivers/scsi/lpfc/lpfc_sli.c ++++ b/drivers/scsi/lpfc/lpfc_sli.c +@@ -18071,7 +18071,6 @@ lpfc_sli4_seq_abort_rsp_cmpl(struct lpfc + if (cmd_iocbq) { + ndlp = (struct lpfc_nodelist *)cmd_iocbq->context1; + lpfc_nlp_put(ndlp); +- lpfc_nlp_not_used(ndlp); + lpfc_sli_release_iocbq(phba, cmd_iocbq); + } + diff --git a/patches.suse/scsi-lpfc-Fix-dropped-FLOGI-during-pt2pt-discovery-r.patch b/patches.suse/scsi-lpfc-Fix-dropped-FLOGI-during-pt2pt-discovery-r.patch index 36f1d9f..7ff11ed 100644 --- a/patches.suse/scsi-lpfc-Fix-dropped-FLOGI-during-pt2pt-discovery-r.patch +++ b/patches.suse/scsi-lpfc-Fix-dropped-FLOGI-during-pt2pt-discovery-r.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:11 -0800 Subject: scsi: lpfc: Fix dropped FLOGI during pt2pt discovery recovery -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: 9dd83f75fc8c2403508d4dbe4b9ebde15ee0bbab References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Fix-error-handling-for-mailboxes-completed.patch b/patches.suse/scsi-lpfc-Fix-error-handling-for-mailboxes-completed.patch new file mode 100644 index 0000000..d49b40e --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-error-handling-for-mailboxes-completed.patch @@ -0,0 +1,288 @@ +From: James Smart +Date: Sun, 11 Apr 2021 18:31:17 -0700 +Subject: scsi: lpfc: Fix error handling for mailboxes completed in MBX_POLL + mode +Patch-mainline: v5.13-rc1 +Git-commit: 304ee43238fed517faa123e034b593905b8679f8 +References: bsc#1185472 + +In SLI-4, when performing a mailbox command with MBX_POLL, the driver uses +the BMBX register to send the command rather than the MQ. A flag is set +indicating the BMBX register is active and saves the mailbox job struct +(mboxq) in the mbox_active element of the adapter. The routine then waits +for completion or timeout. The mailbox job struct is not freed by the +routine. In cases of timeout, the adapter will be reset. The +lpfc_sli_mbox_sys_flush() routine will clean up the mbox in preparation for +the reset. It clears the BMBX active flag and marks the job structure as +MBX_NOT_FINISHED. But, it never frees the mboxq job structure. Expectation +in both normal completion and timeout cases is that the issuer of the mbx +command will free the structure. Unfortunately, not all calling paths are +freeing the memory in cases of error. + +All calling paths were looked at and updated, if missing, to free the mboxq +memory regardless of completion status. + +Link: https://lore.kernel.org/r/20210412013127.2387-7-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_attr.c | 75 +++++++++++++++++++++++++----------------- + drivers/scsi/lpfc/lpfc_init.c | 9 +---- + drivers/scsi/lpfc/lpfc_sli.c | 42 ++++++++++++----------- + 3 files changed, 70 insertions(+), 56 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_attr.c ++++ b/drivers/scsi/lpfc/lpfc_attr.c +@@ -1685,8 +1685,7 @@ lpfc_set_trunking(struct lpfc_hba *phba, + lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, + "0071 Set trunk mode failed with status: %d", + rc); +- if (rc != MBX_TIMEOUT) +- mempool_free(mbox, phba->mbox_mem_pool); ++ mempool_free(mbox, phba->mbox_mem_pool); + + return 0; + } +@@ -6791,15 +6790,19 @@ lpfc_get_stats(struct Scsi_Host *shost) + pmboxq->ctx_buf = NULL; + pmboxq->vport = vport; + +- if (vport->fc_flag & FC_OFFLINE_MODE) ++ if (vport->fc_flag & FC_OFFLINE_MODE) { + rc = lpfc_sli_issue_mbox(phba, pmboxq, MBX_POLL); +- else +- rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); +- +- if (rc != MBX_SUCCESS) { +- if (rc != MBX_TIMEOUT) ++ if (rc != MBX_SUCCESS) { + mempool_free(pmboxq, phba->mbox_mem_pool); +- return NULL; ++ return NULL; ++ } ++ } else { ++ rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); ++ if (rc != MBX_SUCCESS) { ++ if (rc != MBX_TIMEOUT) ++ mempool_free(pmboxq, phba->mbox_mem_pool); ++ return NULL; ++ } + } + + memset(hs, 0, sizeof (struct fc_host_statistics)); +@@ -6823,15 +6826,19 @@ lpfc_get_stats(struct Scsi_Host *shost) + pmboxq->ctx_buf = NULL; + pmboxq->vport = vport; + +- if (vport->fc_flag & FC_OFFLINE_MODE) ++ if (vport->fc_flag & FC_OFFLINE_MODE) { + rc = lpfc_sli_issue_mbox(phba, pmboxq, MBX_POLL); +- else +- rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); +- +- if (rc != MBX_SUCCESS) { +- if (rc != MBX_TIMEOUT) ++ if (rc != MBX_SUCCESS) { + mempool_free(pmboxq, phba->mbox_mem_pool); +- return NULL; ++ return NULL; ++ } ++ } else { ++ rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); ++ if (rc != MBX_SUCCESS) { ++ if (rc != MBX_TIMEOUT) ++ mempool_free(pmboxq, phba->mbox_mem_pool); ++ return NULL; ++ } + } + + hs->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; +@@ -6904,15 +6911,19 @@ lpfc_reset_stats(struct Scsi_Host *shost + pmboxq->vport = vport; + + if ((vport->fc_flag & FC_OFFLINE_MODE) || +- (!(psli->sli_flag & LPFC_SLI_ACTIVE))) ++ (!(psli->sli_flag & LPFC_SLI_ACTIVE))) { + rc = lpfc_sli_issue_mbox(phba, pmboxq, MBX_POLL); +- else +- rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); +- +- if (rc != MBX_SUCCESS) { +- if (rc != MBX_TIMEOUT) ++ if (rc != MBX_SUCCESS) { + mempool_free(pmboxq, phba->mbox_mem_pool); +- return; ++ return; ++ } ++ } else { ++ rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); ++ if (rc != MBX_SUCCESS) { ++ if (rc != MBX_TIMEOUT) ++ mempool_free(pmboxq, phba->mbox_mem_pool); ++ return; ++ } + } + + memset(pmboxq, 0, sizeof(LPFC_MBOXQ_t)); +@@ -6922,15 +6933,19 @@ lpfc_reset_stats(struct Scsi_Host *shost + pmboxq->vport = vport; + + if ((vport->fc_flag & FC_OFFLINE_MODE) || +- (!(psli->sli_flag & LPFC_SLI_ACTIVE))) ++ (!(psli->sli_flag & LPFC_SLI_ACTIVE))) { + rc = lpfc_sli_issue_mbox(phba, pmboxq, MBX_POLL); +- else ++ if (rc != MBX_SUCCESS) { ++ mempool_free(pmboxq, phba->mbox_mem_pool); ++ return; ++ } ++ } else { + rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); +- +- if (rc != MBX_SUCCESS) { +- if (rc != MBX_TIMEOUT) +- mempool_free( pmboxq, phba->mbox_mem_pool); +- return; ++ if (rc != MBX_SUCCESS) { ++ if (rc != MBX_TIMEOUT) ++ mempool_free(pmboxq, phba->mbox_mem_pool); ++ return; ++ } + } + + lso->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; +--- a/drivers/scsi/lpfc/lpfc_init.c ++++ b/drivers/scsi/lpfc/lpfc_init.c +@@ -9654,8 +9654,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *p + "3250 QUERY_FW_CFG mailbox failed with status " + "x%x add_status x%x, mbx status x%x\n", + shdr_status, shdr_add_status, rc); +- if (rc != MBX_TIMEOUT) +- mempool_free(mboxq, phba->mbox_mem_pool); ++ mempool_free(mboxq, phba->mbox_mem_pool); + rc = -ENXIO; + goto out_error; + } +@@ -9671,8 +9670,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *p + "ulp1_mode:x%x\n", phba->sli4_hba.fw_func_mode, + phba->sli4_hba.ulp0_mode, phba->sli4_hba.ulp1_mode); + +- if (rc != MBX_TIMEOUT) +- mempool_free(mboxq, phba->mbox_mem_pool); ++ mempool_free(mboxq, phba->mbox_mem_pool); + + /* + * Set up HBA Event Queues (EQs) +@@ -10270,8 +10268,7 @@ lpfc_pci_function_reset(struct lpfc_hba + shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); + shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, + &shdr->response); +- if (rc != MBX_TIMEOUT) +- mempool_free(mboxq, phba->mbox_mem_pool); ++ mempool_free(mboxq, phba->mbox_mem_pool); + if (shdr_status || shdr_add_status || rc) { + lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, + "0495 SLI_FUNCTION_RESET mailbox " +--- a/drivers/scsi/lpfc/lpfc_sli.c ++++ b/drivers/scsi/lpfc/lpfc_sli.c +@@ -5680,12 +5680,10 @@ lpfc_sli4_get_ctl_attr(struct lpfc_hba * + phba->sli4_hba.lnk_info.lnk_no, + phba->BIOSVersion); + out_free_mboxq: +- if (rc != MBX_TIMEOUT) { +- if (bf_get(lpfc_mqe_command, &mboxq->u.mqe) == MBX_SLI4_CONFIG) +- lpfc_sli4_mbox_cmd_free(phba, mboxq); +- else +- mempool_free(mboxq, phba->mbox_mem_pool); +- } ++ if (bf_get(lpfc_mqe_command, &mboxq->u.mqe) == MBX_SLI4_CONFIG) ++ lpfc_sli4_mbox_cmd_free(phba, mboxq); ++ else ++ mempool_free(mboxq, phba->mbox_mem_pool); + return rc; + } + +@@ -5786,12 +5784,10 @@ lpfc_sli4_retrieve_pport_name(struct lpf + } + + out_free_mboxq: +- if (rc != MBX_TIMEOUT) { +- if (bf_get(lpfc_mqe_command, &mboxq->u.mqe) == MBX_SLI4_CONFIG) +- lpfc_sli4_mbox_cmd_free(phba, mboxq); +- else +- mempool_free(mboxq, phba->mbox_mem_pool); +- } ++ if (bf_get(lpfc_mqe_command, &mboxq->u.mqe) == MBX_SLI4_CONFIG) ++ lpfc_sli4_mbox_cmd_free(phba, mboxq); ++ else ++ mempool_free(mboxq, phba->mbox_mem_pool); + return rc; + } + +@@ -17079,8 +17075,7 @@ lpfc_rq_destroy(struct lpfc_hba *phba, s + "2509 RQ_DESTROY mailbox failed with " + "status x%x add_status x%x, mbx status x%x\n", + shdr_status, shdr_add_status, rc); +- if (rc != MBX_TIMEOUT) +- mempool_free(mbox, hrq->phba->mbox_mem_pool); ++ mempool_free(mbox, hrq->phba->mbox_mem_pool); + return -ENXIO; + } + bf_set(lpfc_mbx_rq_destroy_q_id, &mbox->u.mqe.un.rq_destroy.u.request, +@@ -17177,7 +17172,9 @@ lpfc_sli4_post_sgl(struct lpfc_hba *phba + shdr = (union lpfc_sli4_cfg_shdr *) &post_sgl_pages->header.cfg_shdr; + shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); + shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); +- if (rc != MBX_TIMEOUT) ++ if (!phba->sli4_hba.intr_enable) ++ mempool_free(mbox, phba->mbox_mem_pool); ++ else if (rc != MBX_TIMEOUT) + mempool_free(mbox, phba->mbox_mem_pool); + if (shdr_status || shdr_add_status || rc) { + lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, +@@ -17374,7 +17371,9 @@ lpfc_sli4_post_sgl_list(struct lpfc_hba + shdr = (union lpfc_sli4_cfg_shdr *) &sgl->cfg_shdr; + shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); + shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); +- if (rc != MBX_TIMEOUT) ++ if (!phba->sli4_hba.intr_enable) ++ lpfc_sli4_mbox_cmd_free(phba, mbox); ++ else if (rc != MBX_TIMEOUT) + lpfc_sli4_mbox_cmd_free(phba, mbox); + if (shdr_status || shdr_add_status || rc) { + lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, +@@ -17487,7 +17486,9 @@ lpfc_sli4_post_io_sgl_block(struct lpfc_ + shdr = (union lpfc_sli4_cfg_shdr *)&sgl->cfg_shdr; + shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); + shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); +- if (rc != MBX_TIMEOUT) ++ if (!phba->sli4_hba.intr_enable) ++ lpfc_sli4_mbox_cmd_free(phba, mbox); ++ else if (rc != MBX_TIMEOUT) + lpfc_sli4_mbox_cmd_free(phba, mbox); + if (shdr_status || shdr_add_status || rc) { + lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, +@@ -18837,8 +18838,7 @@ lpfc_sli4_post_rpi_hdr(struct lpfc_hba * + shdr = (union lpfc_sli4_cfg_shdr *) &hdr_tmpl->header.cfg_shdr; + shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); + shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); +- if (rc != MBX_TIMEOUT) +- mempool_free(mboxq, phba->mbox_mem_pool); ++ mempool_free(mboxq, phba->mbox_mem_pool); + if (shdr_status || shdr_add_status || rc) { + lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, + "2514 POST_RPI_HDR mailbox failed with " +@@ -20082,7 +20082,9 @@ lpfc_wr_object(struct lpfc_hba *phba, st + break; + } + } +- if (rc != MBX_TIMEOUT) ++ if (!phba->sli4_hba.intr_enable) ++ mempool_free(mbox, phba->mbox_mem_pool); ++ else if (rc != MBX_TIMEOUT) + mempool_free(mbox, phba->mbox_mem_pool); + if (shdr_status || shdr_add_status || rc) { + lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, diff --git a/patches.suse/scsi-lpfc-Fix-formatting-and-misspelling-issues.patch b/patches.suse/scsi-lpfc-Fix-formatting-and-misspelling-issues.patch new file mode 100644 index 0000000..b6cd2a3 --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-formatting-and-misspelling-issues.patch @@ -0,0 +1,56 @@ +From: Lee Jones +Date: Wed, 3 Mar 2021 14:46:26 +0000 +Subject: scsi: lpfc: Fix formatting and misspelling issues +Patch-mainline: v5.13-rc1 +Git-commit: 964bc8c4adb343c1142749a7e7276ef293c2d7af +References: bsc#1185472 + +Fixes the following W=1 kernel build warning(s): + + drivers/scsi/lpfc/lpfc_ct.c:153: warning: Function parameter or member 'ct_req' not described in 'lpfc_ct_reject_event' + drivers/scsi/lpfc/lpfc_ct.c:153: warning: Function parameter or member 'rx_id' not described in 'lpfc_ct_reject_event' + drivers/scsi/lpfc/lpfc_ct.c:153: warning: Function parameter or member 'ox_id' not described in 'lpfc_ct_reject_event' + drivers/scsi/lpfc/lpfc_ct.c:283: warning: Function parameter or member 'ctiocbq' not described in 'lpfc_ct_handle_mibreq' + drivers/scsi/lpfc/lpfc_ct.c:283: warning: Excess function parameter 'ctiocb' description in 'lpfc_ct_handle_mibreq' + +Link: https://lore.kernel.org/r/20210303144631.3175331-26-lee.jones@linaro.org +Cc: James Smart +Cc: Dick Kennedy +Cc: "James E.J. Bottomley" +Cc: "Martin K. Petersen" +Cc: linux-scsi@vger.kernel.org +Signed-off-by: Lee Jones +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_ct.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_ct.c ++++ b/drivers/scsi/lpfc/lpfc_ct.c +@@ -137,11 +137,11 @@ lpfc_ct_unsol_cmpl(struct lpfc_hba *phba + } + + /** +- * lpfc_ct_reject_event : Issue reject for unhandled CT MIB commands +- * @ndlp : pointer to a node-list data structure. +- * ct_req : pointer to the CT request data structure. +- * rx_id : rx_id of the received UNSOL CT command +- * ox_id : ox_id of the UNSOL CT command ++ * lpfc_ct_reject_event - Issue reject for unhandled CT MIB commands ++ * @ndlp: pointer to a node-list data structure. ++ * @ct_req: pointer to the CT request data structure. ++ * @rx_id: rx_id of the received UNSOL CT command ++ * @ox_id: ox_id of the UNSOL CT command + * + * This routine is invoked by the lpfc_ct_handle_mibreq routine for sending + * a reject response. Reject response is sent for the unhandled commands. +@@ -272,7 +272,7 @@ lpfc_ct_reject_event(struct lpfc_nodelis + /** + * lpfc_ct_handle_mibreq - Process an unsolicited CT MIB request data buffer + * @phba: pointer to lpfc hba data structure. +- * @ctiocb: pointer to lpfc CT command iocb data structure. ++ * @ctiocbq: pointer to lpfc CT command iocb data structure. + * + * This routine is used for processing the IOCB associated with a unsolicited + * CT MIB request. It first determines whether there is an existing ndlp that diff --git a/patches.suse/scsi-lpfc-Fix-gcc-Wstringop-overread-warning.patch b/patches.suse/scsi-lpfc-Fix-gcc-Wstringop-overread-warning.patch new file mode 100644 index 0000000..d361afe --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-gcc-Wstringop-overread-warning.patch @@ -0,0 +1,46 @@ +From: Arnd Bergmann +Date: Mon, 22 Mar 2021 17:02:47 +0100 +Subject: scsi: lpfc: Fix gcc -Wstringop-overread warning +Patch-mainline: v5.13-rc1 +Git-commit: ada48ba70f6b98b7e93eea56770d6e6932734783 +References: bsc#1185472 + +gcc-11 warns about an strnlen with a length larger than the size of the +passed buffer: + +drivers/scsi/lpfc/lpfc_attr.c: In function 'lpfc_nvme_info_show': +drivers/scsi/lpfc/lpfc_attr.c:518:25: error: 'strnlen' specified bound 4095 exceeds source size 24 [-Werror=stringop-overread] + 518 | strnlen(LPFC_NVME_INFO_MORE_STR, PAGE_SIZE - 1) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In this case, the code is entirely valid, as the string is properly +terminated, and the size argument is only there out of extra caution in +case it exceeds a page. + +This cannot really happen here, so just simplify it to a sizeof(). + +Link: https://lore.kernel.org/r/20210322160253.4032422-10-arnd@kernel.org +Fixes: afff0d2321ea ("scsi: lpfc: Add Buffer overflow check, when nvme_info larger than PAGE_SIZE") +Signed-off-by: Arnd Bergmann +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_attr.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_attr.c ++++ b/drivers/scsi/lpfc/lpfc_attr.c +@@ -512,11 +512,9 @@ lpfc_nvme_info_show(struct device *dev, + "6314 Catching potential buffer " + "overflow > PAGE_SIZE = %lu bytes\n", + PAGE_SIZE); +- strlcpy(buf + PAGE_SIZE - 1 - +- strnlen(LPFC_NVME_INFO_MORE_STR, PAGE_SIZE - 1), ++ strlcpy(buf + PAGE_SIZE - 1 - sizeof(LPFC_NVME_INFO_MORE_STR), + LPFC_NVME_INFO_MORE_STR, +- strnlen(LPFC_NVME_INFO_MORE_STR, PAGE_SIZE - 1) +- + 1); ++ sizeof(LPFC_NVME_INFO_MORE_STR) + 1); + } + + return len; diff --git a/patches.suse/scsi-lpfc-Fix-illegal-memory-access-on-Abort-IOCBs.patch b/patches.suse/scsi-lpfc-Fix-illegal-memory-access-on-Abort-IOCBs.patch new file mode 100644 index 0000000..82ef66d --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-illegal-memory-access-on-Abort-IOCBs.patch @@ -0,0 +1,54 @@ +From: James Smart +Date: Wed, 21 Apr 2021 16:44:33 -0700 +Subject: scsi: lpfc: Fix illegal memory access on Abort IOCBs +Patch-mainline: Queued in subsystem maintainer repository +Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git +Git-commit: e1364711359f3ced054bda9920477c8bf93b74c5 +References: bsc#1183203 + +In devloss timer handler and in backend calls to terminate remote port I/O, +there is logic to walk through all active IOCBs and validate them to +potentially trigger an abort request. This logic is causing illegal memory +accesses which leads to a crash. Abort IOCBs, which may be on the list, do +not have an associated lpfc_io_buf struct. The driver is trying to map an +lpfc_io_buf struct on the IOCB and which results in a bogus address thus +the issue. + +Fix by skipping over ABORT IOCBs (CLOSE IOCBs are ABORTS that don't send +ABTS) in the IOCB scan logic. + +Link: https://lore.kernel.org/r/20210421234433.102079-1-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_sli.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_sli.c ++++ b/drivers/scsi/lpfc/lpfc_sli.c +@@ -11804,13 +11804,20 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_i + lpfc_ctx_cmd ctx_cmd) + { + struct lpfc_io_buf *lpfc_cmd; ++ IOCB_t *icmd = NULL; + int rc = 1; + + if (!iocbq || iocbq->vport != vport) + return rc; + +- if (!(iocbq->iocb_flag & LPFC_IO_FCP) || +- !(iocbq->iocb_flag & LPFC_IO_ON_TXCMPLQ)) ++ if (!(iocbq->iocb_flag & LPFC_IO_FCP) || ++ !(iocbq->iocb_flag & LPFC_IO_ON_TXCMPLQ) || ++ iocbq->iocb_flag & LPFC_DRIVER_ABORTED) ++ return rc; ++ ++ icmd = &iocbq->iocb; ++ if (icmd->ulpCommand == CMD_ABORT_XRI_CN || ++ icmd->ulpCommand == CMD_CLOSE_XRI_CN) + return rc; + + lpfc_cmd = container_of(iocbq, struct lpfc_io_buf, cur_iocbq); diff --git a/patches.suse/scsi-lpfc-Fix-incorrect-dbde-assignment-when-buildin.patch b/patches.suse/scsi-lpfc-Fix-incorrect-dbde-assignment-when-buildin.patch index 01325a3..e758896 100644 --- a/patches.suse/scsi-lpfc-Fix-incorrect-dbde-assignment-when-buildin.patch +++ b/patches.suse/scsi-lpfc-Fix-incorrect-dbde-assignment-when-buildin.patch @@ -2,8 +2,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:00 -0800 Subject: scsi: lpfc: Fix incorrect dbde assignment when building target abts wqe -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: 9302154c07bff4e7f7f43c506a1ac84540303d06 References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Fix-incorrect-naming-of-__lpfc_update_fcf_.patch b/patches.suse/scsi-lpfc-Fix-incorrect-naming-of-__lpfc_update_fcf_.patch new file mode 100644 index 0000000..e3a7353 --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-incorrect-naming-of-__lpfc_update_fcf_.patch @@ -0,0 +1,35 @@ +From: Lee Jones +Date: Wed, 3 Mar 2021 14:46:28 +0000 +Subject: scsi: lpfc: Fix incorrect naming of __lpfc_update_fcf_record() +Patch-mainline: v5.13-rc1 +Git-commit: 3884ce1539b0875a2860fd8d2c2d39c2ddcfa35b +References: bsc#1185472 + +Fixes the following W=1 kernel build warning(s): + + drivers/scsi/lpfc/lpfc_hbadisc.c:1505: warning: expecting prototype for lpfc_update_fcf_record(). Prototype was for __lpfc_update_fcf_record() instead + +Link: https://lore.kernel.org/r/20210303144631.3175331-28-lee.jones@linaro.org +Cc: James Smart +Cc: Dick Kennedy +Cc: "James E.J. Bottomley" +Cc: "Martin K. Petersen" +Cc: linux-scsi@vger.kernel.org +Signed-off-by: Lee Jones +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_hbadisc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/lpfc/lpfc_hbadisc.c ++++ b/drivers/scsi/lpfc/lpfc_hbadisc.c +@@ -1487,7 +1487,7 @@ lpfc_copy_fcf_record(struct lpfc_fcf_rec + } + + /** +- * lpfc_update_fcf_record - Update driver fcf record ++ * __lpfc_update_fcf_record - Update driver fcf record + * @phba: pointer to lpfc hba data structure. + * @fcf_rec: pointer to driver fcf record. + * @new_fcf_record: pointer to hba fcf record. diff --git a/patches.suse/scsi-lpfc-Fix-incorrectly-documented-function-lpfc_d.patch b/patches.suse/scsi-lpfc-Fix-incorrectly-documented-function-lpfc_d.patch new file mode 100644 index 0000000..010495a --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-incorrectly-documented-function-lpfc_d.patch @@ -0,0 +1,36 @@ +From: Lee Jones +Date: Fri, 12 Mar 2021 09:47:20 +0000 +Subject: scsi: lpfc: Fix incorrectly documented function + lpfc_debugfs_commonxripools_data() +Patch-mainline: v5.13-rc1 +Git-commit: 2c6400b7824323326e591d42ab2620d0b7b90b0b +References: bsc#1185472 + +Fixes the following W=1 kernel build warning(s): + + drivers/scsi/lpfc/lpfc_debugfs.c:405: warning: expecting prototype for lpfc_debugfs_common_xri_data(). Prototype was for lpfc_debugfs_commonxripools_data() instead + +Link: https://lore.kernel.org/r/20210312094738.2207817-13-lee.jones@linaro.org +Cc: James Smart +Cc: Dick Kennedy +Cc: "James E.J. Bottomley" +Cc: "Martin K. Petersen" +Cc: linux-scsi@vger.kernel.org +Signed-off-by: Lee Jones +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_debugfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/lpfc/lpfc_debugfs.c ++++ b/drivers/scsi/lpfc/lpfc_debugfs.c +@@ -381,7 +381,7 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hb + static int lpfc_debugfs_last_xripool; + + /** +- * lpfc_debugfs_common_xri_data - Dump Hardware Queue info to a buffer ++ * lpfc_debugfs_commonxripools_data - Dump Hardware Queue info to a buffer + * @phba: The HBA to gather host buffer info from. + * @buf: The buffer to dump log into. + * @size: The maximum amount of data to process. diff --git a/patches.suse/scsi-lpfc-Fix-kernel-doc-formatting-issue.patch b/patches.suse/scsi-lpfc-Fix-kernel-doc-formatting-issue.patch new file mode 100644 index 0000000..439487b --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-kernel-doc-formatting-issue.patch @@ -0,0 +1,35 @@ +From: Lee Jones +Date: Fri, 12 Mar 2021 09:47:23 +0000 +Subject: scsi: lpfc: Fix kernel-doc formatting issue +Patch-mainline: v5.13-rc1 +Git-commit: f6b35a75042b212c8eb81846ece1da6b471e5b56 +References: bsc#1185472 + +Fixes the following W=1 kernel build warning(s): + + drivers/scsi/lpfc/lpfc_nvme.c:2021: warning: Function parameter or member 'vport' not described in 'lpfc_nvme_create_localport' + +Link: https://lore.kernel.org/r/20210312094738.2207817-16-lee.jones@linaro.org +Cc: James Smart +Cc: Dick Kennedy +Cc: "James E.J. Bottomley" +Cc: "Martin K. Petersen" +Cc: linux-scsi@vger.kernel.org +Signed-off-by: Lee Jones +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_nvme.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/lpfc/lpfc_nvme.c ++++ b/drivers/scsi/lpfc/lpfc_nvme.c +@@ -2002,7 +2002,7 @@ lpfc_release_nvme_buf(struct lpfc_hba *p + + /** + * lpfc_nvme_create_localport - Create/Bind an nvme localport instance. +- * @vport - the lpfc_vport instance requesting a localport. ++ * @vport: the lpfc_vport instance requesting a localport. + * + * This routine is invoked to create an nvme localport instance to bind + * to the nvme_fc_transport. It is called once during driver load diff --git a/patches.suse/scsi-lpfc-Fix-lack-of-device-removal-on-port-swaps-w.patch b/patches.suse/scsi-lpfc-Fix-lack-of-device-removal-on-port-swaps-w.patch new file mode 100644 index 0000000..b33e29e --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-lack-of-device-removal-on-port-swaps-w.patch @@ -0,0 +1,43 @@ +From: James Smart +Date: Sun, 11 Apr 2021 18:31:16 -0700 +Subject: scsi: lpfc: Fix lack of device removal on port swaps with PRLIs +Patch-mainline: v5.13-rc1 +Git-commit: 4e76d4a9a226e3c7d453675f22359aba34e73ec4 +References: bsc#1185472 + +During target port-swap testing with link flips, the initiator could +encounter PRLI errors. If the target node disappears permanently, the ndlp +is found stuck in UNUSED state with ref count of 1. The rmmod of the driver +will hang waiting for this node to be freed. + +While handling a link error in PRLI completion path, the code intends to +skip triggering the discovery state machine. However this is causing the +final reference release path to be skipped. This causes the node to be +stuck with ref count of 1 + +Fix by ensuring the code path triggers the device removal event on the node +state machine. + +Link: https://lore.kernel.org/r/20210412013127.2387-6-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_els.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_els.c ++++ b/drivers/scsi/lpfc/lpfc_els.c +@@ -2233,9 +2233,7 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba + irsp->un.ulpWord[4], ndlp->fc4_prli_sent); + + /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ +- if (lpfc_error_lost_link(irsp)) +- goto out; +- else ++ if (!lpfc_error_lost_link(irsp)) + lpfc_disc_state_machine(vport, ndlp, cmdiocb, + NLP_EVT_CMPL_PRLI); + diff --git a/patches.suse/scsi-lpfc-Fix-lpfc_els_retry-possible-null-pointer-d.patch b/patches.suse/scsi-lpfc-Fix-lpfc_els_retry-possible-null-pointer-d.patch index e0f70b5..caba6c5 100644 --- a/patches.suse/scsi-lpfc-Fix-lpfc_els_retry-possible-null-pointer-d.patch +++ b/patches.suse/scsi-lpfc-Fix-lpfc_els_retry-possible-null-pointer-d.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:05 -0800 Subject: scsi: lpfc: Fix lpfc_els_retry() possible null pointer dereference -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: 6b6eaf8a5330a4ab37a0d562f24228226e6ac630 References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Fix-lpfc_hdw_queue-attribute-being-ignored.patch b/patches.suse/scsi-lpfc-Fix-lpfc_hdw_queue-attribute-being-ignored.patch new file mode 100644 index 0000000..460367a --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-lpfc_hdw_queue-attribute-being-ignored.patch @@ -0,0 +1,69 @@ +From: James Smart +Date: Sun, 11 Apr 2021 18:31:21 -0700 +Subject: scsi: lpfc: Fix lpfc_hdw_queue attribute being ignored +Patch-mainline: v5.13-rc1 +Git-commit: d3de0d11a219f32b185d525cca2568817e22d3a1 +References: bsc#1185472 + +The lpfc_hdw_queue attribute is to set the number of hardware queues to be +created on the adapter. Normally, the value is set to a default, which +allows the hw queue count to be sized dynamically based on adapter +capabilities, CPU/platform architecture, or CPU type. Currently, when +lpfc_hdw_queue is set to a specific value, is has no effect and the dynamic +sizing occurs. + +The routine checking whether parameters are default or not ignores the +lpfc_hdw_queue setting and invokes the dynamic logic. + +Fix the routine to additionally check the lpfc_hdw_queue attribute value +before using dynamic scaling. Additionally, SLI-3 supports only a small +number of queues with dedicated functions, thus it needs to be exempted +from the variable scaling and set to the expected values. + +Link: https://lore.kernel.org/r/20210412013127.2387-11-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_attr.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_attr.c ++++ b/drivers/scsi/lpfc/lpfc_attr.c +@@ -5813,7 +5813,9 @@ lpfc_irq_chann_init(struct lpfc_hba *phb + } + + /* Check if default setting was passed */ +- if (val == LPFC_IRQ_CHANN_DEF) ++ if (val == LPFC_IRQ_CHANN_DEF && ++ phba->cfg_hdw_queue == LPFC_HBA_HDWQ_DEF && ++ phba->sli_rev == LPFC_SLI_REV4) + lpfc_assign_default_irq_chann(phba); + + if (phba->irq_chann_mode != NORMAL_MODE) { +@@ -5852,7 +5854,12 @@ lpfc_irq_chann_init(struct lpfc_hba *phb + phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; + return -EINVAL; + } +- phba->cfg_irq_chann = val; ++ if (phba->sli_rev == LPFC_SLI_REV4) { ++ phba->cfg_irq_chann = val; ++ } else { ++ phba->cfg_irq_chann = 2; ++ phba->cfg_hdw_queue = 1; ++ } + } + + return 0; +@@ -7409,7 +7416,8 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) + phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu; + if (phba->cfg_irq_chann == 0) + phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu; +- if (phba->cfg_irq_chann > phba->cfg_hdw_queue) ++ if (phba->cfg_irq_chann > phba->cfg_hdw_queue && ++ phba->sli_rev == LPFC_SLI_REV4) + phba->cfg_irq_chann = phba->cfg_hdw_queue; + + phba->cfg_soft_wwnn = 0L; diff --git a/patches.suse/scsi-lpfc-Fix-missing-FDMI-registrations-after-Mgmt-.patch b/patches.suse/scsi-lpfc-Fix-missing-FDMI-registrations-after-Mgmt-.patch new file mode 100644 index 0000000..c60e8f1 --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-missing-FDMI-registrations-after-Mgmt-.patch @@ -0,0 +1,112 @@ +From: James Smart +Date: Sun, 11 Apr 2021 18:31:20 -0700 +Subject: scsi: lpfc: Fix missing FDMI registrations after Mgmt Svc login +Patch-mainline: v5.13-rc1 +Git-commit: a314dec37c0e3879e964b574564b205b3529daa5 +References: bsc#1185472 + +FDMI registration needs to be performed after every login with the FC Mgmt +service. The flag the driver is using to track registration is cleared on +link up, but never on Mgmt service logout/re-login. + +Fix by clearing the flag whenever a new login is completed with the FC Mgmt +service. + +While perusing the flag use, logging was performed as if FDMI registration +occurred on vports. However, it is limited to the physical port only. +Revise the logging to reflect physical port based. + +Link: https://lore.kernel.org/r/20210412013127.2387-10-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_ct.c | 28 ++++++++++++++++------------ + drivers/scsi/lpfc/lpfc_hbadisc.c | 6 ++++-- + 2 files changed, 20 insertions(+), 14 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_ct.c ++++ b/drivers/scsi/lpfc/lpfc_ct.c +@@ -2253,12 +2253,12 @@ lpfc_cmpl_ct_disc_fdmi(struct lpfc_hba * + return; + + case SLI_MGMT_RPA: +- /* No retry on Vendor RPA */ ++ /* No retry on Vendor, RPA only done on physical port */ + if (phba->link_flag & LS_CT_VEN_RPA) { +- lpfc_printf_vlog(vport, KERN_ERR, +- LOG_DISCOVERY | LOG_ELS, +- "6460 VEN FDMI RPA failure\n"); + phba->link_flag &= ~LS_CT_VEN_RPA; ++ lpfc_printf_log(phba, KERN_ERR, ++ LOG_DISCOVERY | LOG_ELS, ++ "6460 VEN FDMI RPA failure\n"); + return; + } + if (vport->fdmi_port_mask == LPFC_FDMI2_PORT_ATTR) { +@@ -2306,23 +2306,24 @@ lpfc_cmpl_ct_disc_fdmi(struct lpfc_hba * + if (phba->link_flag & LS_CT_VEN_RPA) { + lpfc_printf_vlog(vport, KERN_INFO, + LOG_DISCOVERY | LOG_ELS, +- "6449 VEN RPA Success\n"); ++ "6449 VEN RPA FDMI Success\n"); ++ phba->link_flag &= ~LS_CT_VEN_RPA; + break; + } + + if (lpfc_fdmi_cmd(vport, ndlp, cmd, + LPFC_FDMI_VENDOR_ATTR_mi) == 0) + phba->link_flag |= LS_CT_VEN_RPA; +- lpfc_printf_vlog(vport, KERN_INFO, ++ lpfc_printf_log(phba, KERN_INFO, + LOG_DISCOVERY | LOG_ELS, + "6458 Send MI FDMI:%x Flag x%x\n", + phba->sli4_hba.pc_sli4_params.mi_value, + phba->link_flag); + } else { +- lpfc_printf_vlog(vport, KERN_INFO, +- LOG_DISCOVERY | LOG_ELS, +- "6459 No FDMI VEN MI support - " +- "RPA Success\n"); ++ lpfc_printf_log(phba, KERN_INFO, ++ LOG_DISCOVERY | LOG_ELS, ++ "6459 No FDMI VEN MI support - " ++ "RPA Success\n"); + } + break; + } +@@ -2369,10 +2370,13 @@ lpfc_fdmi_change_check(struct lpfc_vport + * DHBA -> DPRT -> RHBA -> RPA (physical port) + * DPRT -> RPRT (vports) + */ +- if (vport->port_type == LPFC_PHYSICAL_PORT) ++ if (vport->port_type == LPFC_PHYSICAL_PORT) { ++ /* For extra Vendor RPA */ ++ phba->link_flag &= ~LS_CT_VEN_RPA; + lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA, 0); +- else ++ } else { + lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DPRT, 0); ++ } + + /* Since this code path registers all the port attributes + * we can just return without further checking. +--- a/drivers/scsi/lpfc/lpfc_hbadisc.c ++++ b/drivers/scsi/lpfc/lpfc_hbadisc.c +@@ -5954,10 +5954,12 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc + * DHBA -> DPRT -> RHBA -> RPA (physical port) + * DPRT -> RPRT (vports) + */ +- if (vport->port_type == LPFC_PHYSICAL_PORT) ++ if (vport->port_type == LPFC_PHYSICAL_PORT) { ++ phba->link_flag &= ~LS_CT_VEN_RPA; /* For extra Vendor RPA */ + lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA, 0); +- else ++ } else { + lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DPRT, 0); ++ } + + + /* decrement the node reference count held for this callback diff --git a/patches.suse/scsi-lpfc-Fix-nodeinfo-debugfs-output.patch b/patches.suse/scsi-lpfc-Fix-nodeinfo-debugfs-output.patch index ef595cf..655af3b 100644 --- a/patches.suse/scsi-lpfc-Fix-nodeinfo-debugfs-output.patch +++ b/patches.suse/scsi-lpfc-Fix-nodeinfo-debugfs-output.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:14 -0800 Subject: scsi: lpfc: Fix nodeinfo debugfs output -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: bb6fd33e3a0cf4325a8114f2f2fece881713973c References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Fix-null-pointer-dereference-in-lpfc_prep_.patch b/patches.suse/scsi-lpfc-Fix-null-pointer-dereference-in-lpfc_prep_.patch index 17aad13..b91d979 100644 --- a/patches.suse/scsi-lpfc-Fix-null-pointer-dereference-in-lpfc_prep_.patch +++ b/patches.suse/scsi-lpfc-Fix-null-pointer-dereference-in-lpfc_prep_.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:08 -0800 Subject: scsi: lpfc: Fix null pointer dereference in lpfc_prep_els_iocb() -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: 8dd1c125f7f838abad009b64bff5f0a11afe3cb6 References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Fix-pt2pt-connection-does-not-recover-afte.patch b/patches.suse/scsi-lpfc-Fix-pt2pt-connection-does-not-recover-afte.patch index 8e2bd04..56d6169 100644 --- a/patches.suse/scsi-lpfc-Fix-pt2pt-connection-does-not-recover-afte.patch +++ b/patches.suse/scsi-lpfc-Fix-pt2pt-connection-does-not-recover-afte.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:06 -0800 Subject: scsi: lpfc: Fix pt2pt connection does not recover after LOGO -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: bd4f5100424d17d4e560d6653902ef8e49b2fc1f References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Fix-pt2pt-state-transition-causing-rmmod-h.patch b/patches.suse/scsi-lpfc-Fix-pt2pt-state-transition-causing-rmmod-h.patch index fa6e826..28b97db 100644 --- a/patches.suse/scsi-lpfc-Fix-pt2pt-state-transition-causing-rmmod-h.patch +++ b/patches.suse/scsi-lpfc-Fix-pt2pt-state-transition-causing-rmmod-h.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:15 -0800 Subject: scsi: lpfc: Fix pt2pt state transition causing rmmod hang -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: debbc1e2b978bbacd629e30d93d8eaba1592c358 References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Fix-reference-counting-errors-in-lpfc_cmpl.patch b/patches.suse/scsi-lpfc-Fix-reference-counting-errors-in-lpfc_cmpl.patch new file mode 100644 index 0000000..c777bdc --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-reference-counting-errors-in-lpfc_cmpl.patch @@ -0,0 +1,141 @@ +From: James Smart +Date: Sun, 11 Apr 2021 18:31:14 -0700 +Subject: scsi: lpfc: Fix reference counting errors in lpfc_cmpl_els_rsp() +Patch-mainline: v5.13-rc1 +Git-commit: f866eb06c087125619457b53e9211a9e758f64f7 +References: bsc#1185472 + +Call traces are being seen that result from a nodelist structure ref +counting error. They are typically seen after transmission of an LS_RJT ELS +response. + +Aged code in lpfc_cmpl_els_rsp() calls lpfc_nlp_not_used() which, if the +ndlp reference count is exactly 1, will decrement the reference count. +Previously lpfc_nlp_put() was within lpfc_els_free_iocb(), and the 'put' +within the free would only be invoked if cmdiocb->context1 was not NULL. +Since the nodelist structure reference count is decremented when exiting +lpfc_cmpl_els_rsp() the lpfc_nlp_not_used() calls are no longer required. +Calling them is causing the reference count issue. + +Fix by removing the lpfc_nlp_not_used() calls. + +Link: https://lore.kernel.org/r/20210412013127.2387-4-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_els.c | 64 ------------------------------------------- + 1 file changed, 1 insertion(+), 63 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_els.c ++++ b/drivers/scsi/lpfc/lpfc_els.c +@@ -4444,10 +4444,7 @@ lpfc_mbx_cmpl_dflt_rpi(struct lpfc_hba * + * nlp_flag bitmap in the ndlp data structure, if the mbox command reference + * field in the command IOCB is not NULL, the referred mailbox command will + * be send out, and then invokes the lpfc_els_free_iocb() routine to release +- * the IOCB. Under error conditions, such as when a LS_RJT is returned or a +- * link down event occurred during the discovery, the lpfc_nlp_not_used() +- * routine shall be invoked trying to release the ndlp if no other threads +- * are currently referring it. ++ * the IOCB. + **/ + static void + lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, +@@ -4457,10 +4454,8 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, + struct lpfc_vport *vport = ndlp ? ndlp->vport : NULL; + struct Scsi_Host *shost = vport ? lpfc_shost_from_vport(vport) : NULL; + IOCB_t *irsp; +- uint8_t *pcmd; + LPFC_MBOXQ_t *mbox = NULL; + struct lpfc_dmabuf *mp = NULL; +- uint32_t ls_rjt = 0; + + irsp = &rspiocb->iocb; + +@@ -4472,18 +4467,6 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, + if (cmdiocb->context_un.mbox) + mbox = cmdiocb->context_un.mbox; + +- /* First determine if this is a LS_RJT cmpl. Note, this callback +- * function can have cmdiocb->contest1 (ndlp) field set to NULL. +- */ +- pcmd = (uint8_t *) (((struct lpfc_dmabuf *) cmdiocb->context2)->virt); +- if (ndlp && (*((uint32_t *) (pcmd)) == ELS_CMD_LS_RJT)) { +- /* A LS_RJT associated with Default RPI cleanup has its own +- * separate code path. +- */ +- if (!(ndlp->nlp_flag & NLP_RM_DFLT_RPI)) +- ls_rjt = 1; +- } +- + /* Check to see if link went down during discovery */ + if (!ndlp || lpfc_els_chk_latt(vport)) { + if (mbox) { +@@ -4494,15 +4477,6 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, + } + mempool_free(mbox, phba->mbox_mem_pool); + } +- if (ndlp && (ndlp->nlp_flag & NLP_RM_DFLT_RPI)) +- if (lpfc_nlp_not_used(ndlp)) { +- ndlp = NULL; +- /* Indicate the node has already released, +- * should not reference to it from within +- * the routine lpfc_els_free_iocb. +- */ +- cmdiocb->context1 = NULL; +- } + goto out; + } + +@@ -4580,29 +4554,6 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, + "Data: x%x x%x x%x\n", + ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, + ndlp->nlp_rpi); +- +- if (lpfc_nlp_not_used(ndlp)) { +- ndlp = NULL; +- /* Indicate node has already been released, +- * should not reference to it from within +- * the routine lpfc_els_free_iocb. +- */ +- cmdiocb->context1 = NULL; +- } +- } else { +- /* Do not drop node for lpfc_els_abort'ed ELS cmds */ +- if (!lpfc_error_lost_link(irsp) && +- ndlp->nlp_flag & NLP_ACC_REGLOGIN) { +- if (lpfc_nlp_not_used(ndlp)) { +- ndlp = NULL; +- /* Indicate node has already been +- * released, should not reference +- * to it from within the routine +- * lpfc_els_free_iocb. +- */ +- cmdiocb->context1 = NULL; +- } +- } + } + mp = (struct lpfc_dmabuf *)mbox->ctx_buf; + if (mp) { +@@ -4618,19 +4569,6 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, + ndlp->nlp_flag &= ~NLP_ACC_REGLOGIN; + ndlp->nlp_flag &= ~NLP_RM_DFLT_RPI; + spin_unlock_irq(&ndlp->lock); +- +- /* If the node is not being used by another discovery thread, +- * and we are sending a reject, we are done with it. +- * Release driver reference count here and free associated +- * resources. +- */ +- if (ls_rjt) +- if (lpfc_nlp_not_used(ndlp)) +- /* Indicate node has already been released, +- * should not reference to it from within +- * the routine lpfc_els_free_iocb. +- */ +- cmdiocb->context1 = NULL; + } + + /* Release the originating I/O reference. */ diff --git a/patches.suse/scsi-lpfc-Fix-reftag-generation-sizing-errors.patch b/patches.suse/scsi-lpfc-Fix-reftag-generation-sizing-errors.patch index 65ce192..711f21f 100644 --- a/patches.suse/scsi-lpfc-Fix-reftag-generation-sizing-errors.patch +++ b/patches.suse/scsi-lpfc-Fix-reftag-generation-sizing-errors.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:02 -0800 Subject: scsi: lpfc: Fix reftag generation sizing errors -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: 68a6a66c5168f3995baed3fc5bee2d4515eb16d0 References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Fix-rmmod-crash-due-to-bad-ring-pointers-t.patch b/patches.suse/scsi-lpfc-Fix-rmmod-crash-due-to-bad-ring-pointers-t.patch new file mode 100644 index 0000000..d132655 --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-rmmod-crash-due-to-bad-ring-pointers-t.patch @@ -0,0 +1,154 @@ +From: James Smart +Date: Sun, 11 Apr 2021 18:31:12 -0700 +Subject: scsi: lpfc: Fix rmmod crash due to bad ring pointers to abort_iotag +Patch-mainline: v5.13-rc1 +Git-commit: 078c68b87a717b9fcd8e0f2109f73456fbc55490 +References: bsc#1185472 + +Rmmod on SLI-4 adapters is sometimes hitting a bad ptr dereference in +lpfc_els_free_iocb(). + +A prior patch refactored the lpfc_sli_abort_iocb() routine. One of the +changes was to convert from building/sending an abort within the routine to +using a common routine. The reworked routine passes, without modification, +the pring ptr to the new common routine. The older routine had logic to +check SLI-3 vs SLI-4 and adapt the pring ptr if necessary as callers were +passing SLI-3 pointers even when not on an SLI-4 adapter. The new routine +is missing this check and adapt, so the SLI-3 ring pointers are being used +in SLI-4 paths. + +Fix by cleaning up the calling routines. In review, there is no need to +pass the ring ptr argument to abort_iocb at all. The routine can look at +the adapter type itself and reference the proper ring. + +Link: https://lore.kernel.org/r/20210412013127.2387-2-jsmart2021@gmail.com +Fixes: db7531d2b377 ("scsi: lpfc: Convert abort handling to SLI-3 and SLI-4 handlers") +Cc: # v5.11+ +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_crtn.h | 4 ++-- + drivers/scsi/lpfc/lpfc_hbadisc.c | 10 +++------- + drivers/scsi/lpfc/lpfc_nportdisc.c | 4 +--- + drivers/scsi/lpfc/lpfc_sli.c | 20 +++++++++++++++----- + 4 files changed, 21 insertions(+), 17 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_crtn.h ++++ b/drivers/scsi/lpfc/lpfc_crtn.h +@@ -353,8 +353,8 @@ int lpfc_sli_hbq_size(void); + int lpfc_sli_issue_abort_iotag(struct lpfc_hba *, struct lpfc_sli_ring *, + struct lpfc_iocbq *, void *); + int lpfc_sli_sum_iocb(struct lpfc_vport *, uint16_t, uint64_t, lpfc_ctx_cmd); +-int lpfc_sli_abort_iocb(struct lpfc_vport *, struct lpfc_sli_ring *, uint16_t, +- uint64_t, lpfc_ctx_cmd); ++int lpfc_sli_abort_iocb(struct lpfc_vport *vport, u16 tgt_id, u64 lun_id, ++ lpfc_ctx_cmd abort_cmd); + int + lpfc_sli_abort_taskmgmt(struct lpfc_vport *, struct lpfc_sli_ring *, + uint16_t, uint64_t, lpfc_ctx_cmd); +--- a/drivers/scsi/lpfc/lpfc_hbadisc.c ++++ b/drivers/scsi/lpfc/lpfc_hbadisc.c +@@ -140,11 +140,8 @@ lpfc_terminate_rport_io(struct fc_rport + "rport terminate: sid:x%x did:x%x flg:x%x", + ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag); + +- if (ndlp->nlp_sid != NLP_NO_SID) { +- lpfc_sli_abort_iocb(vport, +- &vport->phba->sli.sli3_ring[LPFC_FCP_RING], +- ndlp->nlp_sid, 0, LPFC_CTX_TGT); +- } ++ if (ndlp->nlp_sid != NLP_NO_SID) ++ lpfc_sli_abort_iocb(vport, ndlp->nlp_sid, 0, LPFC_CTX_TGT); + } + + /* +@@ -299,8 +296,7 @@ lpfc_dev_loss_tmo_handler(struct lpfc_no + + if (ndlp->nlp_sid != NLP_NO_SID) { + warn_on = 1; +- lpfc_sli_abort_iocb(vport, &phba->sli.sli3_ring[LPFC_FCP_RING], +- ndlp->nlp_sid, 0, LPFC_CTX_TGT); ++ lpfc_sli_abort_iocb(vport, ndlp->nlp_sid, 0, LPFC_CTX_TGT); + } + + if (warn_on) { +--- a/drivers/scsi/lpfc/lpfc_nportdisc.c ++++ b/drivers/scsi/lpfc/lpfc_nportdisc.c +@@ -2559,12 +2559,10 @@ static uint32_t + lpfc_rcv_prlo_mapped_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, + void *arg, uint32_t evt) + { +- struct lpfc_hba *phba = vport->phba; + struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; + + /* flush the target */ +- lpfc_sli_abort_iocb(vport, &phba->sli.sli3_ring[LPFC_FCP_RING], +- ndlp->nlp_sid, 0, LPFC_CTX_TGT); ++ lpfc_sli_abort_iocb(vport, ndlp->nlp_sid, 0, LPFC_CTX_TGT); + + /* Treat like rcv logo */ + lpfc_rcv_logo(vport, ndlp, cmdiocb, ELS_CMD_PRLO); +--- a/drivers/scsi/lpfc/lpfc_sli.c ++++ b/drivers/scsi/lpfc/lpfc_sli.c +@@ -11644,7 +11644,7 @@ lpfc_sli_issue_abort_iotag(struct lpfc_h + icmd = &cmdiocb->iocb; + if (icmd->ulpCommand == CMD_ABORT_XRI_CN || + icmd->ulpCommand == CMD_CLOSE_XRI_CN || +- (cmdiocb->iocb_flag & LPFC_DRIVER_ABORTED) != 0) ++ cmdiocb->iocb_flag & LPFC_DRIVER_ABORTED) + return IOCB_ABORTING; + + if (!pring) { +@@ -11942,7 +11942,6 @@ lpfc_sli_abort_fcp_cmpl(struct lpfc_hba + /** + * lpfc_sli_abort_iocb - issue abort for all commands on a host/target/LUN + * @vport: Pointer to virtual port. +- * @pring: Pointer to driver SLI ring object. + * @tgt_id: SCSI ID of the target. + * @lun_id: LUN ID of the scsi device. + * @abort_cmd: LPFC_CTX_LUN/LPFC_CTX_TGT/LPFC_CTX_HOST. +@@ -11957,18 +11956,22 @@ lpfc_sli_abort_fcp_cmpl(struct lpfc_hba + * FCP iocbs associated with SCSI target specified by tgt_id parameter. + * When abort_cmd == LPFC_CTX_HOST, the function sends abort to all + * FCP iocbs associated with virtual port. ++ * The pring used for SLI3 is sli3_ring[LPFC_FCP_RING], for SLI4 ++ * lpfc_sli4_calc_ring is used. + * This function returns number of iocbs it failed to abort. + * This function is called with no locks held. + **/ + int +-lpfc_sli_abort_iocb(struct lpfc_vport *vport, struct lpfc_sli_ring *pring, +- uint16_t tgt_id, uint64_t lun_id, lpfc_ctx_cmd abort_cmd) ++lpfc_sli_abort_iocb(struct lpfc_vport *vport, u16 tgt_id, u64 lun_id, ++ lpfc_ctx_cmd abort_cmd) + { + struct lpfc_hba *phba = vport->phba; ++ struct lpfc_sli_ring *pring = NULL; + struct lpfc_iocbq *iocbq; + int errcnt = 0, ret_val = 0; + unsigned long iflags; + int i; ++ void *fcp_cmpl = NULL; + + /* all I/Os are in process of being flushed */ + if (phba->hba_flag & HBA_IOQ_FLUSH) +@@ -11982,8 +11985,15 @@ lpfc_sli_abort_iocb(struct lpfc_vport *v + continue; + + spin_lock_irqsave(&phba->hbalock, iflags); ++ if (phba->sli_rev == LPFC_SLI_REV3) { ++ pring = &phba->sli.sli3_ring[LPFC_FCP_RING]; ++ fcp_cmpl = lpfc_sli_abort_fcp_cmpl; ++ } else if (phba->sli_rev == LPFC_SLI_REV4) { ++ pring = lpfc_sli4_calc_ring(phba, iocbq); ++ fcp_cmpl = lpfc_sli4_abort_fcp_cmpl; ++ } + ret_val = lpfc_sli_issue_abort_iotag(phba, pring, iocbq, +- lpfc_sli_abort_fcp_cmpl); ++ fcp_cmpl); + spin_unlock_irqrestore(&phba->hbalock, iflags); + if (ret_val != IOCB_SUCCESS) + errcnt++; diff --git a/patches.suse/scsi-lpfc-Fix-silent-memory-allocation-failure-in-lp.patch b/patches.suse/scsi-lpfc-Fix-silent-memory-allocation-failure-in-lp.patch new file mode 100644 index 0000000..8b2eee9 --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-silent-memory-allocation-failure-in-lp.patch @@ -0,0 +1,38 @@ +From: James Smart +Date: Sun, 11 Apr 2021 18:31:19 -0700 +Subject: scsi: lpfc: Fix silent memory allocation failure in + lpfc_sli4_bsg_link_diag_test() +Patch-mainline: v5.13-rc1 +Git-commit: a1a553e31a994be6f68d3123c0546a84c04a7f6c +References: bsc#1185472 + +In the unlikely case of a failure to allocate an LPFC_MBOXQ_t structure, no +return status is set, thus the routine never logs an error and returns +success to the callee. + +Fix by setting a return code on failure. + +Link: https://lore.kernel.org/r/20210412013127.2387-9-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_bsg.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/scsi/lpfc/lpfc_bsg.c ++++ b/drivers/scsi/lpfc/lpfc_bsg.c +@@ -2435,8 +2435,10 @@ lpfc_sli4_bsg_link_diag_test(struct bsg_ + goto job_error; + + pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); +- if (!pmboxq) ++ if (!pmboxq) { ++ rc = -ENOMEM; + goto link_diag_test_exit; ++ } + + req_len = (sizeof(struct lpfc_mbx_set_link_diag_state) - + sizeof(struct lpfc_sli4_cfg_mhdr)); diff --git a/patches.suse/scsi-lpfc-Fix-some-error-codes-in-debugfs.patch b/patches.suse/scsi-lpfc-Fix-some-error-codes-in-debugfs.patch new file mode 100644 index 0000000..a7c550a --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-some-error-codes-in-debugfs.patch @@ -0,0 +1,39 @@ +From: Dan Carpenter +Date: Fri, 12 Mar 2021 10:42:11 +0300 +Subject: scsi: lpfc: Fix some error codes in debugfs +Patch-mainline: v5.12-rc4 +Git-commit: 19f1bc7edf0f97186810e13a88f5b62069d89097 +References: bsc#1185472 + +If copy_from_user() or kstrtoull() fail then the correct behavior is to +return a negative error code. + +Link: https://lore.kernel.org/r/YEsbU/UxYypVrC7/@mwanda +Fixes: f9bb2da11db8 ("[SCSI] lpfc 8.3.27: T10 additions for SLI4") +Signed-off-by: Dan Carpenter +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_debugfs.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_debugfs.c ++++ b/drivers/scsi/lpfc/lpfc_debugfs.c +@@ -2421,7 +2421,7 @@ lpfc_debugfs_dif_err_write(struct file * + memset(dstbuf, 0, 33); + size = (nbytes < 32) ? nbytes : 32; + if (copy_from_user(dstbuf, buf, size)) +- return 0; ++ return -EFAULT; + + if (dent == phba->debug_InjErrLBA) { + if ((dstbuf[0] == 'o') && (dstbuf[1] == 'f') && +@@ -2430,7 +2430,7 @@ lpfc_debugfs_dif_err_write(struct file * + } + + if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp))) +- return 0; ++ return -EINVAL; + + if (dent == phba->debug_writeGuard) + phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp; diff --git a/patches.suse/scsi-lpfc-Fix-stale-node-accesses-on-stale-RRQ-reque.patch b/patches.suse/scsi-lpfc-Fix-stale-node-accesses-on-stale-RRQ-reque.patch index a31de3d..1b32df7 100644 --- a/patches.suse/scsi-lpfc-Fix-stale-node-accesses-on-stale-RRQ-reque.patch +++ b/patches.suse/scsi-lpfc-Fix-stale-node-accesses-on-stale-RRQ-reque.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:03 -0800 Subject: scsi: lpfc: Fix stale node accesses on stale RRQ request -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: 2693f5deed16e302297fa591862dd9cc560ec3b5 References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Fix-status-returned-in-lpfc_els_retry-erro.patch b/patches.suse/scsi-lpfc-Fix-status-returned-in-lpfc_els_retry-erro.patch index 0811ec6..d4ab82f 100644 --- a/patches.suse/scsi-lpfc-Fix-status-returned-in-lpfc_els_retry-erro.patch +++ b/patches.suse/scsi-lpfc-Fix-status-returned-in-lpfc_els_retry-erro.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:10 -0800 Subject: scsi: lpfc: Fix status returned in lpfc_els_retry() error exit path -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: 148bc64d38fe314475a074c4f757ec9d84537d1c References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Fix-unnecessary-null-check-in-lpfc_release.patch b/patches.suse/scsi-lpfc-Fix-unnecessary-null-check-in-lpfc_release.patch index 86d884c..99894da 100644 --- a/patches.suse/scsi-lpfc-Fix-unnecessary-null-check-in-lpfc_release.patch +++ b/patches.suse/scsi-lpfc-Fix-unnecessary-null-check-in-lpfc_release.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:07 -0800 Subject: scsi: lpfc: Fix unnecessary null check in lpfc_release_scsi_buf -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: ae960d78ec3ab19023d19d134b066eb453aff602 References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Fix-use-after-free-in-lpfc_els_free_iocb.patch b/patches.suse/scsi-lpfc-Fix-use-after-free-in-lpfc_els_free_iocb.patch index 38672a6..67a0ff3 100644 --- a/patches.suse/scsi-lpfc-Fix-use-after-free-in-lpfc_els_free_iocb.patch +++ b/patches.suse/scsi-lpfc-Fix-use-after-free-in-lpfc_els_free_iocb.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:09 -0800 Subject: scsi: lpfc: Fix use after free in lpfc_els_free_iocb -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: 8e9a3250dc61ac1a3b8e4c98ed255fdb4d40cddc References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Fix-use-after-free-on-unused-nodes-after-p.patch b/patches.suse/scsi-lpfc-Fix-use-after-free-on-unused-nodes-after-p.patch new file mode 100644 index 0000000..775754a --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-use-after-free-on-unused-nodes-after-p.patch @@ -0,0 +1,59 @@ +From: James Smart +Date: Sun, 11 Apr 2021 18:31:18 -0700 +Subject: scsi: lpfc: Fix use-after-free on unused nodes after port swap +Patch-mainline: v5.13-rc1 +Git-commit: 724f6b43a3492b02e2ebc88f9fb749d1405098e2 +References: bsc#1185472 + +During target port swap, the swap logic ignores the DROPPED flag in the +nodes. As a node then moves into the UNUSED state, the reference count will +be dropped. If a node is later reused and moved out of the UNUSED state, an +access can result in a use-after-free assert. + +Fix by having the port swap logic propagate the DROPPED flag when switching +nodes. This will avoid reference from being dropped. + +Link: https://lore.kernel.org/r/20210412013127.2387-8-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_els.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +--- a/drivers/scsi/lpfc/lpfc_els.c ++++ b/drivers/scsi/lpfc/lpfc_els.c +@@ -1691,6 +1691,15 @@ lpfc_plogi_confirm_nport(struct lpfc_hba + else + new_ndlp->nlp_flag &= ~NLP_RPI_REGISTERED; + ++ /* ++ * Retain the DROPPED flag. This will take care of the init ++ * refcount when affecting the state change ++ */ ++ if (keep_new_nlp_flag & NLP_DROPPED) ++ new_ndlp->nlp_flag |= NLP_DROPPED; ++ else ++ new_ndlp->nlp_flag &= ~NLP_DROPPED; ++ + ndlp->nlp_flag = keep_new_nlp_flag; + + /* if ndlp had NLP_UNREG_INP set, keep it */ +@@ -1705,6 +1714,15 @@ lpfc_plogi_confirm_nport(struct lpfc_hba + else + ndlp->nlp_flag &= ~NLP_RPI_REGISTERED; + ++ /* ++ * Retain the DROPPED flag. This will take care of the init ++ * refcount when affecting the state change ++ */ ++ if (keep_nlp_flag & NLP_DROPPED) ++ ndlp->nlp_flag |= NLP_DROPPED; ++ else ++ ndlp->nlp_flag &= ~NLP_DROPPED; ++ + spin_unlock_irq(&new_ndlp->lock); + spin_unlock_irq(&ndlp->lock); + diff --git a/patches.suse/scsi-lpfc-Fix-various-trivial-errors-in-comments-and.patch b/patches.suse/scsi-lpfc-Fix-various-trivial-errors-in-comments-and.patch new file mode 100644 index 0000000..9682fda --- /dev/null +++ b/patches.suse/scsi-lpfc-Fix-various-trivial-errors-in-comments-and.patch @@ -0,0 +1,223 @@ +From: James Smart +Date: Sun, 11 Apr 2021 18:31:23 -0700 +Subject: scsi: lpfc: Fix various trivial errors in comments and log messages +Patch-mainline: v5.13-rc1 +Git-commit: 3bfab8a026b393d5836e6e5abdc201d510dda857 +References: bsc#1185472 + +Clean up minor issues spotted by tools and code review: + + - Spelling Errors + + - Spurious characters and errors in function headers + + - nvme_info wqerr and err fields source data reversed + + - Extraneous new line in log message 0466 + + - Spacing error in log message 0109 + + - Messages 0140 and 0141 have portname and nodename reversed + + - Incorrect function labelling in comment + +Link: https://lore.kernel.org/r/20210412013127.2387-13-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_attr.c | 11 +++++------ + drivers/scsi/lpfc/lpfc_bsg.c | 16 ++++++++-------- + drivers/scsi/lpfc/lpfc_els.c | 4 ++-- + drivers/scsi/lpfc/lpfc_nportdisc.c | 4 ++-- + drivers/scsi/lpfc/lpfc_sli.c | 8 ++++---- + 5 files changed, 21 insertions(+), 22 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_attr.c ++++ b/drivers/scsi/lpfc/lpfc_attr.c +@@ -487,8 +487,8 @@ lpfc_nvme_info_show(struct device *dev, + atomic_read(&lport->xmt_fcp_noxri), + atomic_read(&lport->xmt_fcp_bad_ndlp), + atomic_read(&lport->xmt_fcp_qdepth), +- atomic_read(&lport->xmt_fcp_err), +- atomic_read(&lport->xmt_fcp_wqerr)); ++ atomic_read(&lport->xmt_fcp_wqerr), ++ atomic_read(&lport->xmt_fcp_err)); + if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) + goto buffer_done; + +@@ -1174,8 +1174,7 @@ lpfc_emptyq_wait(struct lpfc_hba *phba, + msleep(20); + if (cnt++ > 250) { /* 5 secs */ + lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, +- "0466 %s %s\n", +- "Outstanding IO when ", ++ "0466 Outstanding IO when " + "bringing Adapter offline\n"); + return 0; + } +@@ -5927,7 +5926,7 @@ LPFC_ATTR_RW(XLanePriority, 0, 0x0, 0x7f + LPFC_ATTR_R(enable_bg, 0, 0, 1, "Enable BlockGuard Support"); + + /* +-# lpfc_prot_mask: i ++# lpfc_prot_mask: + # - Bit mask of host protection capabilities used to register with the + # SCSI mid-layer + # - Only meaningful if BG is turned on (lpfc_enable_bg=1). +@@ -5952,7 +5951,7 @@ LPFC_ATTR(prot_mask, + "T10-DIF host protection capabilities mask"); + + /* +-# lpfc_prot_guard: i ++# lpfc_prot_guard: + # - Bit mask of protection guard types to register with the SCSI mid-layer + # - Guard types are currently either 1) T10-DIF CRC 2) IP checksum + # - Allows you to ultimately specify which profiles to use +--- a/drivers/scsi/lpfc/lpfc_bsg.c ++++ b/drivers/scsi/lpfc/lpfc_bsg.c +@@ -3878,7 +3878,7 @@ lpfc_bsg_sli_cfg_dma_desc_setup(struct l + * @dmabuf: Pointer to a DMA buffer descriptor. + * + * This routine performs SLI_CONFIG (0x9B) read mailbox command operation with +- * non-embedded external bufffers. ++ * non-embedded external buffers. + **/ + static int + lpfc_bsg_sli_cfg_read_cmd_ext(struct lpfc_hba *phba, struct bsg_job *job, +@@ -4067,7 +4067,7 @@ lpfc_bsg_sli_cfg_read_cmd_ext(struct lpf + * @dmabuf: Pointer to a DMA buffer descriptor. + * + * This routine performs SLI_CONFIG (0x9B) write mailbox command operation with +- * non-embedded external bufffers. ++ * non-embedded external buffers. + **/ + static int + lpfc_bsg_sli_cfg_write_cmd_ext(struct lpfc_hba *phba, struct bsg_job *job, +@@ -4211,7 +4211,7 @@ lpfc_bsg_sli_cfg_write_cmd_ext(struct lp + goto job_error; + } + +- /* wait for additoinal external buffers */ ++ /* wait for additional external buffers */ + + bsg_reply->result = 0; + bsg_job_done(job, bsg_reply->result, +@@ -4233,8 +4233,8 @@ lpfc_bsg_sli_cfg_write_cmd_ext(struct lp + * @dmabuf: Pointer to a DMA buffer descriptor. + * + * This routine handles SLI_CONFIG (0x9B) mailbox command with non-embedded +- * external bufffers, including both 0x9B with non-embedded MSEs and 0x9B +- * with embedded sussystem 0x1 and opcodes with external HBDs. ++ * external buffers, including both 0x9B with non-embedded MSEs and 0x9B ++ * with embedded subsystem 0x1 and opcodes with external HBDs. + **/ + static int + lpfc_bsg_handle_sli_cfg_mbox(struct lpfc_hba *phba, struct bsg_job *job, +@@ -4559,7 +4559,7 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba + goto job_error; + } + +- /* wait for additoinal external buffers */ ++ /* wait for additional external buffers */ + bsg_reply->result = 0; + bsg_job_done(job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len); +@@ -4625,7 +4625,7 @@ lpfc_bsg_handle_sli_cfg_ebuf(struct lpfc + * @job: Pointer to the job object. + * @dmabuf: Pointer to a DMA buffer descriptor. + * +- * This routine checkes and handles non-embedded multi-buffer SLI_CONFIG ++ * This routine checks and handles non-embedded multi-buffer SLI_CONFIG + * (0x9B) mailbox commands and external buffers. + **/ + static int +@@ -4703,7 +4703,7 @@ lpfc_bsg_handle_sli_cfg_ext(struct lpfc_ + * from the mailbox pool, copy the caller mailbox command. + * + * If offline and the sli is active we need to poll for the command (port is +- * being reset) and com-plete the job, otherwise issue the mailbox command and ++ * being reset) and complete the job, otherwise issue the mailbox command and + * let our completion handler finish the command. + **/ + static int +--- a/drivers/scsi/lpfc/lpfc_els.c ++++ b/drivers/scsi/lpfc/lpfc_els.c +@@ -4378,7 +4378,7 @@ lpfc_cmpl_els_logo_acc(struct lpfc_hba * + irsp->ulpStatus, irsp->un.ulpWord[4], ndlp->nlp_DID); + /* ACC to LOGO completes to NPort */ + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, +- "0109 ACC to LOGO completes to NPort x%x refcnt %d" ++ "0109 ACC to LOGO completes to NPort x%x refcnt %d " + "Data: x%x x%x x%x\n", + ndlp->nlp_DID, kref_read(&ndlp->kref), ndlp->nlp_flag, + ndlp->nlp_state, ndlp->nlp_rpi); +@@ -4783,7 +4783,7 @@ lpfc_els_rsp_acc(struct lpfc_vport *vpor + } + + /** +- * lpfc_els_rsp_reject - Propare and issue a rjt response iocb command ++ * lpfc_els_rsp_reject - Prepare and issue a rjt response iocb command + * @vport: pointer to a virtual N_Port data structure. + * @rejectError: reject response to issue + * @oldiocb: pointer to the original lpfc command iocb data structure. +--- a/drivers/scsi/lpfc/lpfc_nportdisc.c ++++ b/drivers/scsi/lpfc/lpfc_nportdisc.c +@@ -340,7 +340,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, + sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t)); + if (wwn_to_u64(sp->portName.u.wwn) == 0) { + lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, +- "0140 PLOGI Reject: invalid nname\n"); ++ "0140 PLOGI Reject: invalid pname\n"); + stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC; + stat.un.b.lsRjtRsnCodeExp = LSEXP_INVALID_PNAME; + lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, +@@ -349,7 +349,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, + } + if (wwn_to_u64(sp->nodeName.u.wwn) == 0) { + lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, +- "0141 PLOGI Reject: invalid pname\n"); ++ "0141 PLOGI Reject: invalid nname\n"); + stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC; + stat.un.b.lsRjtRsnCodeExp = LSEXP_INVALID_NNAME; + lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, +--- a/drivers/scsi/lpfc/lpfc_sli.c ++++ b/drivers/scsi/lpfc/lpfc_sli.c +@@ -935,7 +935,7 @@ struct lpfc_iocbq * + * @phba: Pointer to HBA context object. + * @xritag: XRI value. + * +- * This function clears the sglq pointer from the array of acive ++ * This function clears the sglq pointer from the array of active + * sglq's. The xritag that is passed in is used to index into the + * array. Before the xritag can be used it needs to be adjusted + * by subtracting the xribase. +@@ -957,7 +957,7 @@ struct lpfc_sglq * + * @phba: Pointer to HBA context object. + * @xritag: XRI value. + * +- * This function returns the sglq pointer from the array of acive ++ * This function returns the sglq pointer from the array of active + * sglq's. The xritag that is passed in is used to index into the + * array. Before the xritag can be used it needs to be adjusted + * by subtracting the xribase. +@@ -14851,7 +14851,7 @@ lpfc_sli4_hba_intr_handler(int irq, void + } + + return IRQ_HANDLED; +-} /* lpfc_sli4_fp_intr_handler */ ++} /* lpfc_sli4_hba_intr_handler */ + + /** + * lpfc_sli4_intr_handler - Device-level interrupt handler for SLI-4 device +@@ -18106,7 +18106,7 @@ lpfc_sli4_xri_inrange(struct lpfc_hba *p + + /** + * lpfc_sli4_seq_abort_rsp - bls rsp to sequence abort +- * @vport: pointer to a vitural port. ++ * @vport: pointer to a virtual port. + * @fc_hdr: pointer to a FC frame header. + * @aborted: was the partially assembled receive sequence successfully aborted + * diff --git a/patches.suse/scsi-lpfc-Fix-vport-indices-in-lpfc_find_vport_by_vp.patch b/patches.suse/scsi-lpfc-Fix-vport-indices-in-lpfc_find_vport_by_vp.patch index 3780722..b631a14 100644 --- a/patches.suse/scsi-lpfc-Fix-vport-indices-in-lpfc_find_vport_by_vp.patch +++ b/patches.suse/scsi-lpfc-Fix-vport-indices-in-lpfc_find_vport_by_vp.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:01 -0800 Subject: scsi: lpfc: Fix vport indices in lpfc_find_vport_by_vpid() -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: 58c36e80ee2d3836080b22ba965aa09454c070d6 References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Reduce-LOG_TRACE_EVENT-logging-for-vports.patch b/patches.suse/scsi-lpfc-Reduce-LOG_TRACE_EVENT-logging-for-vports.patch index 7a0cc72..452b340 100644 --- a/patches.suse/scsi-lpfc-Reduce-LOG_TRACE_EVENT-logging-for-vports.patch +++ b/patches.suse/scsi-lpfc-Reduce-LOG_TRACE_EVENT-logging-for-vports.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:18 -0800 Subject: scsi: lpfc: Reduce LOG_TRACE_EVENT logging for vports -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: cdf811606bd8cac4b0c6fe140acc6511d37542f9 References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Remove-unsupported-mbox-PORT_CAPABILITIES-.patch b/patches.suse/scsi-lpfc-Remove-unsupported-mbox-PORT_CAPABILITIES-.patch new file mode 100644 index 0000000..e6ae8c3 --- /dev/null +++ b/patches.suse/scsi-lpfc-Remove-unsupported-mbox-PORT_CAPABILITIES-.patch @@ -0,0 +1,418 @@ +From: James Smart +Date: Sun, 11 Apr 2021 18:31:22 -0700 +Subject: scsi: lpfc: Remove unsupported mbox PORT_CAPABILITIES logic +Patch-mainline: v5.13-rc1 +Git-commit: b62232ba8caccaf1954e197058104a6478fac1af +References: bsc#1185472 + +SLI-4 does not contain a PORT_CAPABILITIES mailbox command (only SLI-3 +does, and SLI-3 doesn't use it), yet there are SLI-4 code paths that have +code to issue the command. The command will always fail. + +Remove the code for the mailbox command and leave only the resulting +"failure path" logic. + +Link: https://lore.kernel.org/r/20210412013127.2387-12-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_crtn.h | 3 + drivers/scsi/lpfc/lpfc_hw4.h | 174 ------------------------------------------ + drivers/scsi/lpfc/lpfc_init.c | 103 ------------------------ + drivers/scsi/lpfc/lpfc_mbox.c | 36 -------- + 4 files changed, 3 insertions(+), 313 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_crtn.h ++++ b/drivers/scsi/lpfc/lpfc_crtn.h +@@ -55,9 +55,6 @@ void lpfc_register_new_vport(struct lpfc + void lpfc_unreg_vpi(struct lpfc_hba *, uint16_t, LPFC_MBOXQ_t *); + void lpfc_init_link(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t); + void lpfc_request_features(struct lpfc_hba *, struct lpfcMboxq *); +-void lpfc_supported_pages(struct lpfcMboxq *); +-void lpfc_pc_sli4_params(struct lpfcMboxq *); +-int lpfc_pc_sli4_params_get(struct lpfc_hba *, LPFC_MBOXQ_t *); + int lpfc_sli4_mbox_rsrc_extent(struct lpfc_hba *, struct lpfcMboxq *, + uint16_t, uint16_t, bool); + int lpfc_get_sli4_parameters(struct lpfc_hba *, LPFC_MBOXQ_t *); +--- a/drivers/scsi/lpfc/lpfc_hw4.h ++++ b/drivers/scsi/lpfc/lpfc_hw4.h +@@ -124,6 +124,7 @@ struct lpfc_sli_intf { + /* Define SLI4 Alignment requirements. */ + #define LPFC_ALIGN_16_BYTE 16 + #define LPFC_ALIGN_64_BYTE 64 ++#define SLI4_PAGE_SIZE 4096 + + /* Define SLI4 specific definitions. */ + #define LPFC_MQ_CQE_BYTE_OFFSET 256 +@@ -2976,62 +2977,6 @@ struct lpfc_mbx_request_features { + #define lpfc_mbx_rq_ftr_rsp_mrqp_WORD word3 + }; + +-struct lpfc_mbx_supp_pages { +- uint32_t word1; +-#define qs_SHIFT 0 +-#define qs_MASK 0x00000001 +-#define qs_WORD word1 +-#define wr_SHIFT 1 +-#define wr_MASK 0x00000001 +-#define wr_WORD word1 +-#define pf_SHIFT 8 +-#define pf_MASK 0x000000ff +-#define pf_WORD word1 +-#define cpn_SHIFT 16 +-#define cpn_MASK 0x000000ff +-#define cpn_WORD word1 +- uint32_t word2; +-#define list_offset_SHIFT 0 +-#define list_offset_MASK 0x000000ff +-#define list_offset_WORD word2 +-#define next_offset_SHIFT 8 +-#define next_offset_MASK 0x000000ff +-#define next_offset_WORD word2 +-#define elem_cnt_SHIFT 16 +-#define elem_cnt_MASK 0x000000ff +-#define elem_cnt_WORD word2 +- uint32_t word3; +-#define pn_0_SHIFT 24 +-#define pn_0_MASK 0x000000ff +-#define pn_0_WORD word3 +-#define pn_1_SHIFT 16 +-#define pn_1_MASK 0x000000ff +-#define pn_1_WORD word3 +-#define pn_2_SHIFT 8 +-#define pn_2_MASK 0x000000ff +-#define pn_2_WORD word3 +-#define pn_3_SHIFT 0 +-#define pn_3_MASK 0x000000ff +-#define pn_3_WORD word3 +- uint32_t word4; +-#define pn_4_SHIFT 24 +-#define pn_4_MASK 0x000000ff +-#define pn_4_WORD word4 +-#define pn_5_SHIFT 16 +-#define pn_5_MASK 0x000000ff +-#define pn_5_WORD word4 +-#define pn_6_SHIFT 8 +-#define pn_6_MASK 0x000000ff +-#define pn_6_WORD word4 +-#define pn_7_SHIFT 0 +-#define pn_7_MASK 0x000000ff +-#define pn_7_WORD word4 +- uint32_t rsvd[27]; +-#define LPFC_SUPP_PAGES 0 +-#define LPFC_BLOCK_GUARD_PROFILES 1 +-#define LPFC_SLI4_PARAMETERS 2 +-}; +- + struct lpfc_mbx_memory_dump_type3 { + uint32_t word1; + #define lpfc_mbx_memory_dump_type3_type_SHIFT 0 +@@ -3248,121 +3193,6 @@ struct user_eeprom { + uint8_t reserved191[57]; + }; + +-struct lpfc_mbx_pc_sli4_params { +- uint32_t word1; +-#define qs_SHIFT 0 +-#define qs_MASK 0x00000001 +-#define qs_WORD word1 +-#define wr_SHIFT 1 +-#define wr_MASK 0x00000001 +-#define wr_WORD word1 +-#define pf_SHIFT 8 +-#define pf_MASK 0x000000ff +-#define pf_WORD word1 +-#define cpn_SHIFT 16 +-#define cpn_MASK 0x000000ff +-#define cpn_WORD word1 +- uint32_t word2; +-#define if_type_SHIFT 0 +-#define if_type_MASK 0x00000007 +-#define if_type_WORD word2 +-#define sli_rev_SHIFT 4 +-#define sli_rev_MASK 0x0000000f +-#define sli_rev_WORD word2 +-#define sli_family_SHIFT 8 +-#define sli_family_MASK 0x000000ff +-#define sli_family_WORD word2 +-#define featurelevel_1_SHIFT 16 +-#define featurelevel_1_MASK 0x000000ff +-#define featurelevel_1_WORD word2 +-#define featurelevel_2_SHIFT 24 +-#define featurelevel_2_MASK 0x0000001f +-#define featurelevel_2_WORD word2 +- uint32_t word3; +-#define fcoe_SHIFT 0 +-#define fcoe_MASK 0x00000001 +-#define fcoe_WORD word3 +-#define fc_SHIFT 1 +-#define fc_MASK 0x00000001 +-#define fc_WORD word3 +-#define nic_SHIFT 2 +-#define nic_MASK 0x00000001 +-#define nic_WORD word3 +-#define iscsi_SHIFT 3 +-#define iscsi_MASK 0x00000001 +-#define iscsi_WORD word3 +-#define rdma_SHIFT 4 +-#define rdma_MASK 0x00000001 +-#define rdma_WORD word3 +- uint32_t sge_supp_len; +-#define SLI4_PAGE_SIZE 4096 +- uint32_t word5; +-#define if_page_sz_SHIFT 0 +-#define if_page_sz_MASK 0x0000ffff +-#define if_page_sz_WORD word5 +-#define loopbk_scope_SHIFT 24 +-#define loopbk_scope_MASK 0x0000000f +-#define loopbk_scope_WORD word5 +-#define rq_db_window_SHIFT 28 +-#define rq_db_window_MASK 0x0000000f +-#define rq_db_window_WORD word5 +- uint32_t word6; +-#define eq_pages_SHIFT 0 +-#define eq_pages_MASK 0x0000000f +-#define eq_pages_WORD word6 +-#define eqe_size_SHIFT 8 +-#define eqe_size_MASK 0x000000ff +-#define eqe_size_WORD word6 +- uint32_t word7; +-#define cq_pages_SHIFT 0 +-#define cq_pages_MASK 0x0000000f +-#define cq_pages_WORD word7 +-#define cqe_size_SHIFT 8 +-#define cqe_size_MASK 0x000000ff +-#define cqe_size_WORD word7 +- uint32_t word8; +-#define mq_pages_SHIFT 0 +-#define mq_pages_MASK 0x0000000f +-#define mq_pages_WORD word8 +-#define mqe_size_SHIFT 8 +-#define mqe_size_MASK 0x000000ff +-#define mqe_size_WORD word8 +-#define mq_elem_cnt_SHIFT 16 +-#define mq_elem_cnt_MASK 0x000000ff +-#define mq_elem_cnt_WORD word8 +- uint32_t word9; +-#define wq_pages_SHIFT 0 +-#define wq_pages_MASK 0x0000ffff +-#define wq_pages_WORD word9 +-#define wqe_size_SHIFT 8 +-#define wqe_size_MASK 0x000000ff +-#define wqe_size_WORD word9 +- uint32_t word10; +-#define rq_pages_SHIFT 0 +-#define rq_pages_MASK 0x0000ffff +-#define rq_pages_WORD word10 +-#define rqe_size_SHIFT 8 +-#define rqe_size_MASK 0x000000ff +-#define rqe_size_WORD word10 +- uint32_t word11; +-#define hdr_pages_SHIFT 0 +-#define hdr_pages_MASK 0x0000000f +-#define hdr_pages_WORD word11 +-#define hdr_size_SHIFT 8 +-#define hdr_size_MASK 0x0000000f +-#define hdr_size_WORD word11 +-#define hdr_pp_align_SHIFT 16 +-#define hdr_pp_align_MASK 0x0000ffff +-#define hdr_pp_align_WORD word11 +- uint32_t word12; +-#define sgl_pages_SHIFT 0 +-#define sgl_pages_MASK 0x0000000f +-#define sgl_pages_WORD word12 +-#define sgl_pp_align_SHIFT 16 +-#define sgl_pp_align_MASK 0x0000ffff +-#define sgl_pp_align_WORD word12 +- uint32_t rsvd_13_63[51]; +-}; + #define SLI4_PAGE_ALIGN(addr) (((addr)+((SLI4_PAGE_SIZE)-1)) \ + &(~((SLI4_PAGE_SIZE)-1))) + +@@ -3994,8 +3824,6 @@ struct lpfc_mqe { + struct lpfc_mbx_post_hdr_tmpl hdr_tmpl; + struct lpfc_mbx_query_fw_config query_fw_cfg; + struct lpfc_mbx_set_beacon_config beacon_config; +- struct lpfc_mbx_supp_pages supp_pages; +- struct lpfc_mbx_pc_sli4_params sli4_params; + struct lpfc_mbx_get_sli4_parameters get_sli4_parameters; + struct lpfc_mbx_set_link_diag_state link_diag_state; + struct lpfc_mbx_set_link_diag_loopback link_diag_loopback; +--- a/drivers/scsi/lpfc/lpfc_init.c ++++ b/drivers/scsi/lpfc/lpfc_init.c +@@ -6569,8 +6569,6 @@ lpfc_sli4_driver_resource_setup(struct l + LPFC_MBOXQ_t *mboxq; + MAILBOX_t *mb; + int rc, i, max_buf_size; +- uint8_t pn_page[LPFC_MAX_SUPPORTED_PAGES] = {0}; +- struct lpfc_mqe *mqe; + int longs; + int extra; + uint64_t wwn; +@@ -6804,32 +6802,6 @@ lpfc_sli4_driver_resource_setup(struct l + + lpfc_nvme_mod_param_dep(phba); + +- /* Get the Supported Pages if PORT_CAPABILITIES is supported by port. */ +- lpfc_supported_pages(mboxq); +- rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); +- if (!rc) { +- mqe = &mboxq->u.mqe; +- memcpy(&pn_page[0], ((uint8_t *)&mqe->un.supp_pages.word3), +- LPFC_MAX_SUPPORTED_PAGES); +- for (i = 0; i < LPFC_MAX_SUPPORTED_PAGES; i++) { +- switch (pn_page[i]) { +- case LPFC_SLI4_PARAMETERS: +- phba->sli4_hba.pc_sli4_params.supported = 1; +- break; +- default: +- break; +- } +- } +- /* Read the port's SLI4 Parameters capabilities if supported. */ +- if (phba->sli4_hba.pc_sli4_params.supported) +- rc = lpfc_pc_sli4_params_get(phba, mboxq); +- if (rc) { +- mempool_free(mboxq, phba->mbox_mem_pool); +- rc = -EIO; +- goto out_free_bsmbx; +- } +- } +- + /* + * Get sli4 parameters that override parameters from Port capabilities. + * If this call fails, it isn't critical unless the SLI4 parameters come +@@ -12066,78 +12038,6 @@ lpfc_sli4_hba_unset(struct lpfc_hba *phb + phba->pport->work_port_events = 0; + } + +- /** +- * lpfc_pc_sli4_params_get - Get the SLI4_PARAMS port capabilities. +- * @phba: Pointer to HBA context object. +- * @mboxq: Pointer to the mailboxq memory for the mailbox command response. +- * +- * This function is called in the SLI4 code path to read the port's +- * sli4 capabilities. +- * +- * This function may be be called from any context that can block-wait +- * for the completion. The expectation is that this routine is called +- * typically from probe_one or from the online routine. +- **/ +-int +-lpfc_pc_sli4_params_get(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) +-{ +- int rc; +- struct lpfc_mqe *mqe; +- struct lpfc_pc_sli4_params *sli4_params; +- uint32_t mbox_tmo; +- +- rc = 0; +- mqe = &mboxq->u.mqe; +- +- /* Read the port's SLI4 Parameters port capabilities */ +- lpfc_pc_sli4_params(mboxq); +- if (!phba->sli4_hba.intr_enable) +- rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); +- else { +- mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); +- rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); +- } +- +- if (unlikely(rc)) +- return 1; +- +- sli4_params = &phba->sli4_hba.pc_sli4_params; +- sli4_params->if_type = bf_get(if_type, &mqe->un.sli4_params); +- sli4_params->sli_rev = bf_get(sli_rev, &mqe->un.sli4_params); +- sli4_params->sli_family = bf_get(sli_family, &mqe->un.sli4_params); +- sli4_params->featurelevel_1 = bf_get(featurelevel_1, +- &mqe->un.sli4_params); +- sli4_params->featurelevel_2 = bf_get(featurelevel_2, +- &mqe->un.sli4_params); +- sli4_params->proto_types = mqe->un.sli4_params.word3; +- sli4_params->sge_supp_len = mqe->un.sli4_params.sge_supp_len; +- sli4_params->if_page_sz = bf_get(if_page_sz, &mqe->un.sli4_params); +- sli4_params->rq_db_window = bf_get(rq_db_window, &mqe->un.sli4_params); +- sli4_params->loopbk_scope = bf_get(loopbk_scope, &mqe->un.sli4_params); +- sli4_params->eq_pages_max = bf_get(eq_pages, &mqe->un.sli4_params); +- sli4_params->eqe_size = bf_get(eqe_size, &mqe->un.sli4_params); +- sli4_params->cq_pages_max = bf_get(cq_pages, &mqe->un.sli4_params); +- sli4_params->cqe_size = bf_get(cqe_size, &mqe->un.sli4_params); +- sli4_params->mq_pages_max = bf_get(mq_pages, &mqe->un.sli4_params); +- sli4_params->mqe_size = bf_get(mqe_size, &mqe->un.sli4_params); +- sli4_params->mq_elem_cnt = bf_get(mq_elem_cnt, &mqe->un.sli4_params); +- sli4_params->wq_pages_max = bf_get(wq_pages, &mqe->un.sli4_params); +- sli4_params->wqe_size = bf_get(wqe_size, &mqe->un.sli4_params); +- sli4_params->rq_pages_max = bf_get(rq_pages, &mqe->un.sli4_params); +- sli4_params->rqe_size = bf_get(rqe_size, &mqe->un.sli4_params); +- sli4_params->hdr_pages_max = bf_get(hdr_pages, &mqe->un.sli4_params); +- sli4_params->hdr_size = bf_get(hdr_size, &mqe->un.sli4_params); +- sli4_params->hdr_pp_align = bf_get(hdr_pp_align, &mqe->un.sli4_params); +- sli4_params->sgl_pages_max = bf_get(sgl_pages, &mqe->un.sli4_params); +- sli4_params->sgl_pp_align = bf_get(sgl_pp_align, &mqe->un.sli4_params); +- +- /* Make sure that sge_supp_len can be handled by the driver */ +- if (sli4_params->sge_supp_len > LPFC_MAX_SGE_SIZE) +- sli4_params->sge_supp_len = LPFC_MAX_SGE_SIZE; +- +- return rc; +-} +- + /** + * lpfc_get_sli4_parameters - Get the SLI4 Config PARAMETERS. + * @phba: Pointer to HBA context object. +@@ -12196,7 +12096,8 @@ lpfc_get_sli4_parameters(struct lpfc_hba + else + phba->sli3_options &= ~LPFC_SLI4_PHWQ_ENABLED; + sli4_params->sge_supp_len = mbx_sli4_parameters->sge_supp_len; +- sli4_params->loopbk_scope = bf_get(loopbk_scope, mbx_sli4_parameters); ++ sli4_params->loopbk_scope = bf_get(cfg_loopbk_scope, ++ mbx_sli4_parameters); + sli4_params->oas_supported = bf_get(cfg_oas, mbx_sli4_parameters); + sli4_params->cqv = bf_get(cfg_cqv, mbx_sli4_parameters); + sli4_params->mqv = bf_get(cfg_mqv, mbx_sli4_parameters); +--- a/drivers/scsi/lpfc/lpfc_mbox.c ++++ b/drivers/scsi/lpfc/lpfc_mbox.c +@@ -2624,39 +2624,3 @@ lpfc_resume_rpi(struct lpfcMboxq *mbox, + resume_rpi->event_tag = ndlp->phba->fc_eventTag; + } + +-/** +- * lpfc_supported_pages - Initialize the PORT_CAPABILITIES supported pages +- * mailbox command. +- * @mbox: pointer to lpfc mbox command to initialize. +- * +- * The PORT_CAPABILITIES supported pages mailbox command is issued to +- * retrieve the particular feature pages supported by the port. +- **/ +-void +-lpfc_supported_pages(struct lpfcMboxq *mbox) +-{ +- struct lpfc_mbx_supp_pages *supp_pages; +- +- memset(mbox, 0, sizeof(*mbox)); +- supp_pages = &mbox->u.mqe.un.supp_pages; +- bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_PORT_CAPABILITIES); +- bf_set(cpn, supp_pages, LPFC_SUPP_PAGES); +-} +- +-/** +- * lpfc_pc_sli4_params - Initialize the PORT_CAPABILITIES SLI4 Params mbox cmd. +- * @mbox: pointer to lpfc mbox command to initialize. +- * +- * The PORT_CAPABILITIES SLI4 parameters mailbox command is issued to +- * retrieve the particular SLI4 features supported by the port. +- **/ +-void +-lpfc_pc_sli4_params(struct lpfcMboxq *mbox) +-{ +- struct lpfc_mbx_pc_sli4_params *sli4_params; +- +- memset(mbox, 0, sizeof(*mbox)); +- sli4_params = &mbox->u.mqe.un.sli4_params; +- bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_PORT_CAPABILITIES); +- bf_set(cpn, sli4_params, LPFC_SLI4_PARAMETERS); +-} diff --git a/patches.suse/scsi-lpfc-Standardize-discovery-object-logging-forma.patch b/patches.suse/scsi-lpfc-Standardize-discovery-object-logging-forma.patch new file mode 100644 index 0000000..4d2a72d --- /dev/null +++ b/patches.suse/scsi-lpfc-Standardize-discovery-object-logging-forma.patch @@ -0,0 +1,209 @@ +From: James Smart +Date: Sun, 11 Apr 2021 18:31:24 -0700 +Subject: scsi: lpfc: Standardize discovery object logging format +Patch-mainline: v5.13-rc1 +Git-commit: f115612528b8e25ff01b6749e0ac61ff6a0f51a0 +References: bsc#1185472 + +Code inspection showed lpfc was using three different pointer formats when +logging discovery object pointers. + +Standardize the pointer format to x%px. + +Note: %px use is limited to discovery objects in order to aid core +analysis. + +Link: https://lore.kernel.org/r/20210412013127.2387-14-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_ct.c | 2 +- + drivers/scsi/lpfc/lpfc_hbadisc.c | 10 +++++----- + drivers/scsi/lpfc/lpfc_init.c | 2 +- + drivers/scsi/lpfc/lpfc_nvme.c | 16 ++++++++-------- + drivers/scsi/lpfc/lpfc_scsi.c | 2 +- + drivers/scsi/lpfc/lpfc_sli.c | 6 +++--- + 6 files changed, 19 insertions(+), 19 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_ct.c ++++ b/drivers/scsi/lpfc/lpfc_ct.c +@@ -777,7 +777,7 @@ lpfc_prep_node_fc4type(struct lpfc_vport + + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, + "0239 Skip x%06x NameServer Rsp " +- "Data: x%x x%x %p\n", ++ "Data: x%x x%x x%px\n", + Did, vport->fc_flag, + vport->fc_rscn_id_cnt, ndlp); + } +--- a/drivers/scsi/lpfc/lpfc_hbadisc.c ++++ b/drivers/scsi/lpfc/lpfc_hbadisc.c +@@ -102,20 +102,20 @@ lpfc_rport_invalid(struct fc_rport *rpor + + rdata = rport->dd_data; + if (!rdata) { +- pr_err("**** %s: NULL dd_data on rport %p SID x%x\n", ++ pr_err("**** %s: NULL dd_data on rport x%px SID x%x\n", + __func__, rport, rport->scsi_target_id); + return -EINVAL; + } + + ndlp = rdata->pnode; + if (!rdata->pnode) { +- pr_err("**** %s: NULL ndlp on rport %p SID x%x\n", ++ pr_err("**** %s: NULL ndlp on rport x%px SID x%x\n", + __func__, rport, rport->scsi_target_id); + return -EINVAL; + } + + if (!ndlp->vport) { +- pr_err("**** %s: Null vport on ndlp %p, DID x%x rport %p " ++ pr_err("**** %s: Null vport on ndlp x%px, DID x%x rport x%px " + "SID x%x\n", __func__, ndlp, ndlp->nlp_DID, rport, + rport->scsi_target_id); + return -EINVAL; +@@ -168,7 +168,7 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport + ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag); + + lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, +- "3181 dev_loss_callbk x%06x, rport %p flg x%x " ++ "3181 dev_loss_callbk x%06x, rport x%px flg x%x " + "load_flag x%x refcnt %d\n", + ndlp->nlp_DID, ndlp->rport, ndlp->nlp_flag, + vport->load_flag, kref_read(&ndlp->kref)); +@@ -6170,7 +6170,7 @@ lpfc_nlp_release(struct kref *kref) + ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type); + + lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, +- "0279 %s: ndlp:%p did %x refcnt:%d rpi:%x\n", ++ "0279 %s: ndlp: x%px did %x refcnt:%d rpi:%x\n", + __func__, ndlp, ndlp->nlp_DID, + kref_read(&ndlp->kref), ndlp->nlp_rpi); + +--- a/drivers/scsi/lpfc/lpfc_init.c ++++ b/drivers/scsi/lpfc/lpfc_init.c +@@ -3552,7 +3552,7 @@ lpfc_offline_prep(struct lpfc_hba *phba, + lpfc_printf_vlog(vports[i], KERN_INFO, + LOG_NODE | LOG_DISCOVERY, + "0011 Free RPI x%x on " +- "ndlp: %p did x%x\n", ++ "ndlp: x%px did x%x\n", + ndlp->nlp_rpi, ndlp, + ndlp->nlp_DID); + lpfc_sli4_free_rpi(phba, ndlp->nlp_rpi); +--- a/drivers/scsi/lpfc/lpfc_nvme.c ++++ b/drivers/scsi/lpfc/lpfc_nvme.c +@@ -190,14 +190,14 @@ lpfc_nvme_remoteport_delete(struct nvme_ + + ndlp = rport->ndlp; + if (!ndlp) { +- pr_err("**** %s: NULL ndlp on rport %p remoteport %p\n", ++ pr_err("**** %s: NULL ndlp on rport x%px remoteport x%px\n", + __func__, rport, remoteport); + goto rport_err; + } + + vport = ndlp->vport; + if (!vport) { +- pr_err("**** %s: Null vport on ndlp %p, ste x%x rport %p\n", ++ pr_err("**** %s: Null vport on ndlp x%px, ste x%x rport x%px\n", + __func__, ndlp, ndlp->nlp_state, rport); + goto rport_err; + } +@@ -209,7 +209,7 @@ lpfc_nvme_remoteport_delete(struct nvme_ + * calling state machine to remove the node. + */ + lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC, +- "6146 remoteport delete of remoteport %p\n", ++ "6146 remoteport delete of remoteport x%px\n", + remoteport); + spin_lock_irq(&ndlp->lock); + +@@ -317,7 +317,7 @@ void + status = bf_get(lpfc_wcqe_c_status, wcqe) & LPFC_IOCB_STATUS_MASK; + + lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC, +- "6047 NVMEx LS REQ %px cmpl DID %x Xri: %x " ++ "6047 NVMEx LS REQ x%px cmpl DID %x Xri: %x " + "status %x reason x%x cmd:x%px lsreg:x%px bmp:x%px " + "ndlp:x%px\n", + pnvme_lsreq, ndlp ? ndlp->nlp_DID : 0, +@@ -339,7 +339,7 @@ void + else + lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, + "6046 NVMEx cmpl without done call back? " +- "Data %px DID %x Xri: %x status %x\n", ++ "Data x%px DID %x Xri: %x status %x\n", + pnvme_lsreq, ndlp ? ndlp->nlp_DID : 0, + cmdwqe->sli4_xritag, status); + if (ndlp) { +@@ -707,7 +707,7 @@ int + + lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC | LOG_NVME_ABTS, + "6040 NVMEx LS REQ Abort: Issue LS_ABORT for lsreq " +- "x%p rqstlen:%d rsplen:%d %pad %pad\n", ++ "x%px rqstlen:%d rsplen:%d %pad %pad\n", + pnvme_lsreq, pnvme_lsreq->rqstlen, + pnvme_lsreq->rsplen, &pnvme_lsreq->rqstdma, + &pnvme_lsreq->rspdma); +@@ -736,7 +736,7 @@ int + return 0; + + lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC | LOG_NVME_ABTS, +- "6213 NVMEx LS REQ Abort: Unable to locate req x%p\n", ++ "6213 NVMEx LS REQ Abort: Unable to locate req x%px\n", + pnvme_lsreq); + return -EINVAL; + } +@@ -1839,7 +1839,7 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local + lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, + "6144 Outstanding NVME I/O Abort Request " + "still pending on nvme_fcreq x%px, " +- "lpfc_ncmd %px xri x%x\n", ++ "lpfc_ncmd x%px xri x%x\n", + pnvme_fcreq, lpfc_nbuf, + nvmereq_wqe->sli4_xritag); + goto out_unlock; +--- a/drivers/scsi/lpfc/lpfc_scsi.c ++++ b/drivers/scsi/lpfc/lpfc_scsi.c +@@ -4292,7 +4292,7 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba + u32 *lp = (u32 *)cmd->sense_buffer; + + lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, +- "9039 Iodone <%d/%llu> cmd x%p, error " ++ "9039 Iodone <%d/%llu> cmd x%px, error " + "x%x SNS x%x x%x Data: x%x x%x\n", + cmd->device->id, cmd->device->lun, cmd, + cmd->result, *lp, *(lp + 3), cmd->retries, +--- a/drivers/scsi/lpfc/lpfc_sli.c ++++ b/drivers/scsi/lpfc/lpfc_sli.c +@@ -2656,7 +2656,7 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba * + vport, + KERN_INFO, LOG_MBOX | LOG_DISCOVERY, + "1438 UNREG cmpl deferred mbox x%x " +- "on NPort x%x Data: x%x x%x %px x%x x%x\n", ++ "on NPort x%x Data: x%x x%x x%px x%x x%x\n", + ndlp->nlp_rpi, ndlp->nlp_DID, + ndlp->nlp_flag, ndlp->nlp_defer_did, + ndlp, vport->load_flag, kref_read(&ndlp->kref)); +@@ -2721,7 +2721,7 @@ lpfc_sli4_unreg_rpi_cmpl_clr(struct lpfc + vport, KERN_INFO, LOG_MBOX | LOG_SLI, + "0010 UNREG_LOGIN vpi:%x " + "rpi:%x DID:%x defer x%x flg x%x " +- "%px\n", ++ "x%px\n", + vport->vpi, ndlp->nlp_rpi, + ndlp->nlp_DID, ndlp->nlp_defer_did, + ndlp->nlp_flag, +@@ -3023,7 +3023,7 @@ lpfc_nvme_unsol_ls_handler(struct lpfc_h + goto out_fail; + + lpfc_printf_log(phba, KERN_ERR, LOG_NODE, +- "6206 NVMET unsol ls_req ndlp %p " ++ "6206 NVMET unsol ls_req ndlp x%px " + "DID x%x xflags x%x refcnt %d\n", + ndlp, ndlp->nlp_DID, + ndlp->fc4_xpt_flags, diff --git a/patches.suse/scsi-lpfc-Update-copyrights-for-12.8.0.7-and-12.8.0..patch b/patches.suse/scsi-lpfc-Update-copyrights-for-12.8.0.7-and-12.8.0..patch index 61fc65b..9695785 100644 --- a/patches.suse/scsi-lpfc-Update-copyrights-for-12.8.0.7-and-12.8.0..patch +++ b/patches.suse/scsi-lpfc-Update-copyrights-for-12.8.0.7-and-12.8.0..patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:21 -0800 Subject: scsi: lpfc: Update copyrights for 12.8.0.7 and 12.8.0.8 changes -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: 67073c69c8902d5f23845b3689360853826fcfb8 References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Update-lpfc-version-to-12.8.0.8.patch b/patches.suse/scsi-lpfc-Update-lpfc-version-to-12.8.0.8.patch index 9b733b0..8697e7d 100644 --- a/patches.suse/scsi-lpfc-Update-lpfc-version-to-12.8.0.8.patch +++ b/patches.suse/scsi-lpfc-Update-lpfc-version-to-12.8.0.8.patch @@ -1,8 +1,7 @@ From: James Smart Date: Mon, 1 Mar 2021 09:18:20 -0800 Subject: scsi: lpfc: Update lpfc version to 12.8.0.8 -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: ef53d5e1b8e49c673672db9c3c2e6c64dd7a0fbb References: bsc#1182574 diff --git a/patches.suse/scsi-lpfc-Update-lpfc-version-to-12.8.0.9.patch b/patches.suse/scsi-lpfc-Update-lpfc-version-to-12.8.0.9.patch new file mode 100644 index 0000000..2aad589 --- /dev/null +++ b/patches.suse/scsi-lpfc-Update-lpfc-version-to-12.8.0.9.patch @@ -0,0 +1,30 @@ +From: James Smart +Date: Sun, 11 Apr 2021 18:31:26 -0700 +Subject: scsi: lpfc: Update lpfc version to 12.8.0.9 +Patch-mainline: v5.13-rc1 +Git-commit: 3ebd25b0a44359befbbfb17c545d96a10d84e77a +References: bsc#1185472 + +Update lpfc version to 12.8.0.9 + +Link: https://lore.kernel.org/r/20210412013127.2387-16-jsmart2021@gmail.com +Co-developed-by: Justin Tee +Signed-off-by: Justin Tee +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_version.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/lpfc/lpfc_version.h ++++ b/drivers/scsi/lpfc/lpfc_version.h +@@ -20,7 +20,7 @@ + * included with this package. * + *******************************************************************/ + +-#define LPFC_DRIVER_VERSION "12.8.0.8" ++#define LPFC_DRIVER_VERSION "12.8.0.9" + #define LPFC_DRIVER_NAME "lpfc" + + /* Used for SLI 2/3 */ diff --git a/patches.suse/scsi-qla2xxx-Add-H-C-T-info-in-the-log-message-for-f.patch b/patches.suse/scsi-qla2xxx-Add-H-C-T-info-in-the-log-message-for-f.patch new file mode 100644 index 0000000..fb338b7 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Add-H-C-T-info-in-the-log-message-for-f.patch @@ -0,0 +1,42 @@ +From: Arun Easi +Date: Mon, 29 Mar 2021 01:52:19 -0700 +Subject: scsi: qla2xxx: Add H:C:T info in the log message for fc ports +Patch-mainline: v5.13-rc1 +Git-commit: a63f4c45414951ad4fbaeb5b744e37ffd137b689 +References: bsc#1185491 + +The host:channel:scsi_target_id information is helpful in matching an FC +port with a SCSI device, so add it. For initiator FC ports, a -1 would be +displayed for "target" part. + +Link: https://lore.kernel.org/r/20210329085229.4367-3-njavali@marvell.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Arun Easi +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_init.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -5513,13 +5513,14 @@ qla2x00_reg_remote_port(scsi_qla_host_t + if (fcport->port_type & FCT_NVME_DISCOVERY) + rport_ids.roles |= FC_PORT_ROLE_NVME_DISCOVERY; + ++ fc_remote_port_rolechg(rport, rport_ids.roles); ++ + ql_dbg(ql_dbg_disc, vha, 0x20ee, +- "%s %8phN. rport %p is %s mode\n", +- __func__, fcport->port_name, rport, ++ "%s: %8phN. rport %ld:0:%d (%p) is %s mode\n", ++ __func__, fcport->port_name, vha->host_no, ++ rport->scsi_target_id, rport, + (fcport->port_type == FCT_TARGET) ? "tgt" : + ((fcport->port_type & FCT_NVME) ? "nvme" : "ini")); +- +- fc_remote_port_rolechg(rport, rport_ids.roles); + } + + /* diff --git a/patches.suse/scsi-qla2xxx-Add-error-counters-to-debugfs-node.patch b/patches.suse/scsi-qla2xxx-Add-error-counters-to-debugfs-node.patch new file mode 100644 index 0000000..58682f8 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Add-error-counters-to-debugfs-node.patch @@ -0,0 +1,63 @@ +From: Saurav Kashyap +Date: Mon, 11 Jan 2021 01:31:29 -0800 +Subject: scsi: qla2xxx: Add error counters to debugfs node +Patch-mainline: v5.12-rc1 +Git-commit: 307862e6697a153a5645c75d86682b75ea471369 +References: bsc#1185491 + +Display error counters via debugfs node. + +Link: https://lore.kernel.org/r/20210111093134.1206-3-njavali@marvell.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Saurav Kashyap +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_dfs.c | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +--- a/drivers/scsi/qla2xxx/qla_dfs.c ++++ b/drivers/scsi/qla2xxx/qla_dfs.c +@@ -287,6 +287,10 @@ qla_dfs_tgt_counters_show(struct seq_fil + core_qla_snd_status, qla_core_ret_sta_ctio, core_qla_free_cmd, + num_q_full_sent, num_alloc_iocb_failed, num_term_xchg_sent; + u16 i; ++ fc_port_t *fcport = NULL; ++ ++ if (qla2x00_chip_is_down(vha)) ++ return 0; + + qla_core_sbt_cmd = qpair->tgt_counters.qla_core_sbt_cmd; + core_qla_que_buf = qpair->tgt_counters.core_qla_que_buf; +@@ -350,6 +354,30 @@ qla_dfs_tgt_counters_show(struct seq_fil + vha->qla_stats.qla_dif_stats.dif_ref_tag_err); + seq_printf(s, "DIF App tag err = %d\n", + vha->qla_stats.qla_dif_stats.dif_app_tag_err); ++ ++ seq_puts(s, "\n"); ++ seq_puts(s, "Initiator Error Counters\n"); ++ seq_printf(s, "HW Error Count = %14lld\n", ++ vha->hw_err_cnt); ++ seq_printf(s, "Link Down Count = %14lld\n", ++ vha->short_link_down_cnt); ++ seq_printf(s, "Interface Err Count = %14lld\n", ++ vha->interface_err_cnt); ++ seq_printf(s, "Cmd Timeout Count = %14lld\n", ++ vha->cmd_timeout_cnt); ++ seq_printf(s, "Reset Count = %14lld\n", ++ vha->reset_cmd_err_cnt); ++ seq_puts(s, "\n"); ++ ++ list_for_each_entry(fcport, &vha->vp_fcports, list) { ++ if (!fcport || !fcport->rport) ++ continue; ++ ++ seq_printf(s, "Target Num = %7d Link Down Count = %14lld\n", ++ fcport->rport->number, fcport->tgt_short_link_down_cnt); ++ } ++ seq_puts(s, "\n"); ++ + return 0; + } + diff --git a/patches.suse/scsi-qla2xxx-Always-check-the-return-value-of-qla24x.patch b/patches.suse/scsi-qla2xxx-Always-check-the-return-value-of-qla24x.patch new file mode 100644 index 0000000..988c5a8 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Always-check-the-return-value-of-qla24x.patch @@ -0,0 +1,52 @@ +From: Bart Van Assche +Date: Sat, 20 Mar 2021 16:23:58 -0700 +Subject: scsi: qla2xxx: Always check the return value of + qla24xx_get_isp_stats() +Patch-mainline: v5.13-rc1 +Git-commit: a2b2cc660822cae08c351c7f6b452bfd1330a4f7 +References: bsc#1185491 + +This patch fixes the following Coverity warning: + + CID 361199 (#1 of 1): Unchecked return value (CHECKED_RETURN) + 3. check_return: Calling qla24xx_get_isp_stats without checking return + value (as is done elsewhere 4 out of 5 times). + +Link: https://lore.kernel.org/r/20210320232359.941-7-bvanassche@acm.org +Cc: Quinn Tran +Cc: Mike Christie +Cc: Himanshu Madhani +Cc: Daniel Wagner +Cc: Lee Duncan +Reviewed-by: Daniel Wagner +Reviewed-by: Himanshu Madhani +Signed-off-by: Bart Van Assche +Signed-off-by: Martin K. Petersen +--- + drivers/scsi/qla2xxx/qla_attr.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_attr.c ++++ b/drivers/scsi/qla2xxx/qla_attr.c +@@ -2865,6 +2865,8 @@ qla2x00_reset_host_stats(struct Scsi_Hos + vha->qla_stats.jiffies_at_last_reset = get_jiffies_64(); + + if (IS_FWI2_CAPABLE(ha)) { ++ int rval; ++ + stats = dma_alloc_coherent(&ha->pdev->dev, + sizeof(*stats), &stats_dma, GFP_KERNEL); + if (!stats) { +@@ -2874,7 +2876,11 @@ qla2x00_reset_host_stats(struct Scsi_Hos + } + + /* reset firmware statistics */ +- qla24xx_get_isp_stats(base_vha, stats, stats_dma, BIT_0); ++ rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma, BIT_0); ++ if (rval != QLA_SUCCESS) ++ ql_log(ql_log_warn, vha, 0x70de, ++ "Resetting ISP statistics failed: rval = %d\n", ++ rval); + + dma_free_coherent(&ha->pdev->dev, sizeof(*stats), + stats, stats_dma); diff --git a/patches.suse/scsi-qla2xxx-Assign-boolean-values-to-a-bool-variabl.patch b/patches.suse/scsi-qla2xxx-Assign-boolean-values-to-a-bool-variabl.patch new file mode 100644 index 0000000..8929428 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Assign-boolean-values-to-a-bool-variabl.patch @@ -0,0 +1,41 @@ +From: Jiapeng Zhong +Date: Wed, 20 Jan 2021 15:31:59 +0800 +Subject: scsi: qla2xxx: Assign boolean values to a bool variable +Patch-mainline: v5.12-rc1 +Git-commit: 71311be1cd3e2dfd75381ef8840a88ac79256ca1 +References: bsc#1185491 + +Fix the following coccicheck warnings: + +./drivers/scsi/qla2xxx/qla_isr.c:780:2-18: WARNING: Assignment +of 0/1 to bool variable. + +Link: https://lore.kernel.org/r/1611127919-56551-1-git-send-email-abaci-bugfix@linux.alibaba.com +Reported-by: Abaci Robot +Signed-off-by: Jiapeng Zhong +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_isr.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_isr.c ++++ b/drivers/scsi/qla2xxx/qla_isr.c +@@ -763,7 +763,7 @@ static void + qla27xx_handle_8200_aen(scsi_qla_host_t *vha, uint16_t *mb) + { + struct qla_hw_data *ha = vha->hw; +- bool reset_isp_needed = 0; ++ bool reset_isp_needed = false; + + ql_log(ql_log_warn, vha, 0x02f0, + "MPI Heartbeat stop. MPI reset is%s needed. " +@@ -779,7 +779,7 @@ qla27xx_handle_8200_aen(scsi_qla_host_t + + if (ql2xfulldump_on_mpifail) { + ha->isp_ops->fw_dump(vha); +- reset_isp_needed = 1; ++ reset_isp_needed = true; + } + + ha->isp_ops->mpi_fw_dump(vha, 1); diff --git a/patches.suse/scsi-qla2xxx-Check-kzalloc-return-value.patch b/patches.suse/scsi-qla2xxx-Check-kzalloc-return-value.patch new file mode 100644 index 0000000..1b30946 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Check-kzalloc-return-value.patch @@ -0,0 +1,41 @@ +From: Bart Van Assche +Date: Sat, 20 Mar 2021 16:23:59 -0700 +Subject: scsi: qla2xxx: Check kzalloc() return value +Patch-mainline: v5.13-rc1 +Git-commit: e5406d8ad4a1659f4d4d1b39fe203855c4eaef2d +References: bsc#1185491 + +Instead of crashing if kzalloc() fails, make qla2x00_get_host_stats() +return -ENOMEM. + +Link: https://lore.kernel.org/r/20210320232359.941-8-bvanassche@acm.org +Fixes: dbf1f53cfd23 ("scsi: qla2xxx: Implementation to get and manage host, target stats and initiator port") +Cc: Himanshu Madhani +Cc: Saurav Kashyap +Cc: Nilesh Javali +Cc: Quinn Tran +Cc: Mike Christie +Cc: Daniel Wagner +Cc: Lee Duncan +Reviewed-by: Daniel Wagner +Reviewed-by: Himanshu Madhani +Acked-by: Saurav Kashyap +Signed-off-by: Bart Van Assche +Signed-off-by: Martin K. Petersen +--- + drivers/scsi/qla2xxx/qla_bsg.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/scsi/qla2xxx/qla_bsg.c ++++ b/drivers/scsi/qla2xxx/qla_bsg.c +@@ -2584,6 +2584,10 @@ qla2x00_get_host_stats(struct bsg_job *b + } + + data = kzalloc(response_len, GFP_KERNEL); ++ if (!data) { ++ kfree(req_data); ++ return -ENOMEM; ++ } + + ret = qla2xxx_get_ini_stats(fc_bsg_to_shost(bsg_job), req_data->stat_type, + data, response_len); diff --git a/patches.suse/scsi-qla2xxx-Consolidate-zio-threshold-setting-for-b.patch b/patches.suse/scsi-qla2xxx-Consolidate-zio-threshold-setting-for-b.patch new file mode 100644 index 0000000..8f7dbbc --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Consolidate-zio-threshold-setting-for-b.patch @@ -0,0 +1,91 @@ +From: Quinn Tran +Date: Mon, 29 Mar 2021 01:52:21 -0700 +Subject: scsi: qla2xxx: Consolidate zio threshold setting for both FCP & NVMe +Patch-mainline: v5.13-rc1 +Git-commit: 5777fef788a59f5ac9ab6661988a95a045fc0574 +References: bsc#1185491 + +Consolidate zio threshold setting for both FCP & NVMe to prevent one +protocol from clobbering the setting of the other protocol. + +Link: https://lore.kernel.org/r/20210329085229.4367-5-njavali@marvell.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Quinn Tran +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_def.h | 1 - + drivers/scsi/qla2xxx/qla_os.c | 34 ++++++++++++++-------------------- + 2 files changed, 14 insertions(+), 21 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_def.h ++++ b/drivers/scsi/qla2xxx/qla_def.h +@@ -4728,7 +4728,6 @@ typedef struct scsi_qla_host { + #define FX00_CRITEMP_RECOVERY 25 + #define FX00_HOST_INFO_RESEND 26 + #define QPAIR_ONLINE_CHECK_NEEDED 27 +-#define SET_NVME_ZIO_THRESHOLD_NEEDED 28 + #define DETECT_SFP_CHANGE 29 + #define N2N_LOGIN_NEEDED 30 + #define IOCB_WORK_ACTIVE 31 +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -6969,28 +6969,23 @@ qla2x00_do_dpc(void *data) + mutex_unlock(&ha->mq_lock); + } + +- if (test_and_clear_bit(SET_NVME_ZIO_THRESHOLD_NEEDED, +- &base_vha->dpc_flags)) { ++ if (test_and_clear_bit(SET_ZIO_THRESHOLD_NEEDED, ++ &base_vha->dpc_flags)) { ++ u16 threshold = ha->nvme_last_rptd_aen + ha->last_zio_threshold; ++ ++ if (threshold > ha->orig_fw_xcb_count) ++ threshold = ha->orig_fw_xcb_count; ++ + ql_log(ql_log_info, base_vha, 0xffffff, +- "nvme: SET ZIO Activity exchange threshold to %d.\n", +- ha->nvme_last_rptd_aen); +- if (qla27xx_set_zio_threshold(base_vha, +- ha->nvme_last_rptd_aen)) { ++ "SET ZIO Activity exchange threshold to %d.\n", ++ threshold); ++ if (qla27xx_set_zio_threshold(base_vha, threshold)) { + ql_log(ql_log_info, base_vha, 0xffffff, +- "nvme: Unable to SET ZIO Activity exchange threshold to %d.\n", +- ha->nvme_last_rptd_aen); ++ "Unable to SET ZIO Activity exchange threshold to %d.\n", ++ threshold); + } + } + +- if (test_and_clear_bit(SET_ZIO_THRESHOLD_NEEDED, +- &base_vha->dpc_flags)) { +- ql_log(ql_log_info, base_vha, 0xffffff, +- "SET ZIO Activity exchange threshold to %d.\n", +- ha->last_zio_threshold); +- qla27xx_set_zio_threshold(base_vha, +- ha->last_zio_threshold); +- } +- + if (!IS_QLAFX00(ha)) + qla2x00_do_dpc_all_vps(base_vha); + +@@ -7218,14 +7213,13 @@ qla2x00_timer(struct timer_list *t) + index = atomic_read(&ha->nvme_active_aen_cnt); + if (!vha->vp_idx && + (index != ha->nvme_last_rptd_aen) && +- (index >= DEFAULT_ZIO_THRESHOLD) && + ha->zio_mode == QLA_ZIO_MODE_6 && + !ha->flags.host_shutting_down) { ++ ha->nvme_last_rptd_aen = atomic_read(&ha->nvme_active_aen_cnt); + ql_log(ql_log_info, vha, 0x3002, + "nvme: Sched: Set ZIO exchange threshold to %d.\n", + ha->nvme_last_rptd_aen); +- ha->nvme_last_rptd_aen = atomic_read(&ha->nvme_active_aen_cnt); +- set_bit(SET_NVME_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); ++ set_bit(SET_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); + start_dpc++; + } + diff --git a/patches.suse/scsi-qla2xxx-Constify-struct-qla_tgt_func_tmpl.patch b/patches.suse/scsi-qla2xxx-Constify-struct-qla_tgt_func_tmpl.patch new file mode 100644 index 0000000..ff62898 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Constify-struct-qla_tgt_func_tmpl.patch @@ -0,0 +1,45 @@ +From: Bart Van Assche +Date: Sat, 20 Mar 2021 16:23:54 -0700 +Subject: scsi: qla2xxx: Constify struct qla_tgt_func_tmpl +Patch-mainline: v5.13-rc1 +Git-commit: 634b9774d335020e2cd55950a6c1242e7e3bd1e7 +References: bsc#1185491 + +Since the target function pointers are not modified at runtime, declare the +data structure with the target function pointers const. + +Link: https://lore.kernel.org/r/20210320232359.941-3-bvanassche@acm.org +Cc: Quinn Tran +Cc: Mike Christie +Reviewed-by: Daniel Wagner +Reviewed-by: Himanshu Madhani +Reviewed-by: Lee Duncan +Signed-off-by: Bart Van Assche +Signed-off-by: Martin K. Petersen +--- + drivers/scsi/qla2xxx/qla_def.h | 2 +- + drivers/scsi/qla2xxx/tcm_qla2xxx.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_def.h ++++ b/drivers/scsi/qla2xxx/qla_def.h +@@ -3816,7 +3816,7 @@ struct qlt_hw_data { + __le32 __iomem *atio_q_in; + __le32 __iomem *atio_q_out; + +- struct qla_tgt_func_tmpl *tgt_ops; ++ const struct qla_tgt_func_tmpl *tgt_ops; + struct qla_tgt_vp_map *tgt_vp_map; + + int saved_set; +--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c ++++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c +@@ -1574,7 +1574,7 @@ static void tcm_qla2xxx_update_sess(stru + /* + * Calls into tcm_qla2xxx used by qla2xxx LLD I/O path. + */ +-static struct qla_tgt_func_tmpl tcm_qla2xxx_template = { ++static const struct qla_tgt_func_tmpl tcm_qla2xxx_template = { + .find_cmd_by_tag = tcm_qla2xxx_find_cmd_by_tag, + .handle_cmd = tcm_qla2xxx_handle_cmd, + .handle_data = tcm_qla2xxx_handle_data, diff --git a/patches.suse/scsi-qla2xxx-Do-logout-even-if-fabric-scan-retries-g.patch b/patches.suse/scsi-qla2xxx-Do-logout-even-if-fabric-scan-retries-g.patch new file mode 100644 index 0000000..6ecf8b1 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Do-logout-even-if-fabric-scan-retries-g.patch @@ -0,0 +1,34 @@ +From: Quinn Tran +Date: Mon, 29 Mar 2021 01:52:28 -0700 +Subject: scsi: qla2xxx: Do logout even if fabric scan retries got exhausted +Patch-mainline: v5.13-rc1 +Git-commit: 022a2d211ce0eb410a2f4d0d0903a5ddf7687b55 +References: bsc#1185491 + +Perform logout of all remote ports so that all I/Os with driver are +requeued with midlayer for retry. + +Link: https://lore.kernel.org/r/20210329085229.4367-12-njavali@marvell.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Quinn Tran +Signed-off-by: Saurav Kashyap +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_gs.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/scsi/qla2xxx/qla_gs.c ++++ b/drivers/scsi/qla2xxx/qla_gs.c +@@ -3444,6 +3444,10 @@ void qla24xx_async_gnnft_done(scsi_qla_h + list_for_each_entry(fcport, &vha->vp_fcports, list) { + if ((fcport->flags & FCF_FABRIC_DEVICE) != 0) { + fcport->scan_state = QLA_FCPORT_SCAN; ++ if (fcport->loop_id == FC_NO_LOOP_ID) ++ fcport->logout_on_delete = 0; ++ else ++ fcport->logout_on_delete = 1; + } + } + goto login_logout; diff --git a/patches.suse/scsi-qla2xxx-Enable-NVMe-CONF-BIT_7-when-enabling-SL.patch b/patches.suse/scsi-qla2xxx-Enable-NVMe-CONF-BIT_7-when-enabling-SL.patch new file mode 100644 index 0000000..ca71a6b --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Enable-NVMe-CONF-BIT_7-when-enabling-SL.patch @@ -0,0 +1,30 @@ +From: Saurav Kashyap +Date: Mon, 11 Jan 2021 01:31:33 -0800 +Subject: scsi: qla2xxx: Enable NVMe CONF (BIT_7) when enabling SLER +Patch-mainline: v5.12-rc1 +Git-commit: ffa018e3a5b4a8d53dd2400fb60b5150588b57d7 +References: bsc#1185491 + +Enable NVMe confirmation bit in PRLI. + +Link: https://lore.kernel.org/r/20210111093134.1206-7-njavali@marvell.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Saurav Kashyap +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_iocb.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/scsi/qla2xxx/qla_iocb.c ++++ b/drivers/scsi/qla2xxx/qla_iocb.c +@@ -2379,6 +2379,8 @@ qla24xx_prli_iocb(srb_t *sp, struct logi + logio->io_parameter[0] = + cpu_to_le32(NVME_PRLI_SP_FIRST_BURST); + if (sp->vha->flags.nvme2_enabled) { ++ /* Set service parameter BIT_7 for NVME CONF support */ ++ logio->io_parameter[0] |= NVME_PRLI_SP_CONF; + /* Set service parameter BIT_8 for SLER support */ + logio->io_parameter[0] |= + cpu_to_le32(NVME_PRLI_SP_SLER); diff --git a/patches.suse/scsi-qla2xxx-Fix-IOPS-drop-seen-in-some-adapters.patch b/patches.suse/scsi-qla2xxx-Fix-IOPS-drop-seen-in-some-adapters.patch new file mode 100644 index 0000000..1c0e8d8 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-IOPS-drop-seen-in-some-adapters.patch @@ -0,0 +1,89 @@ +From: Arun Easi +Date: Mon, 29 Mar 2021 01:52:18 -0700 +Subject: scsi: qla2xxx: Fix IOPS drop seen in some adapters +Patch-mainline: v5.13-rc1 +Git-commit: bcafad6c2d520df42c86f28357d639deac15bad7 +References: bsc#1185491 + +Removing the response queue processing in the send path is showing IOPS +drop. Add back the process_response_queue() call in the send path. + +Link: https://lore.kernel.org/r/20210329085229.4367-2-njavali@marvell.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Arun Easi +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_iocb.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +--- a/drivers/scsi/qla2xxx/qla_iocb.c ++++ b/drivers/scsi/qla2xxx/qla_iocb.c +@@ -1601,12 +1601,14 @@ qla24xx_start_scsi(srb_t *sp) + uint16_t req_cnt; + uint16_t tot_dsds; + struct req_que *req = NULL; ++ struct rsp_que *rsp; + struct scsi_cmnd *cmd = GET_CMD_SP(sp); + struct scsi_qla_host *vha = sp->vha; + struct qla_hw_data *ha = vha->hw; + + /* Setup device pointers. */ + req = vha->req; ++ rsp = req->rsp; + + /* So we know we haven't pci_map'ed anything yet */ + tot_dsds = 0; +@@ -1708,6 +1710,11 @@ qla24xx_start_scsi(srb_t *sp) + /* Set chip new ring index. */ + wrt_reg_dword(req->req_q_in, req->ring_index); + ++ /* Manage unprocessed RIO/ZIO commands in response queue. */ ++ if (vha->flags.process_response_queue && ++ rsp->ring_ptr->signature != RESPONSE_PROCESSED) ++ qla24xx_process_response_queue(vha, rsp); ++ + spin_unlock_irqrestore(&ha->hardware_lock, flags); + return QLA_SUCCESS; + +@@ -1898,6 +1905,11 @@ qla24xx_dif_start_scsi(srb_t *sp) + /* Set chip new ring index. */ + wrt_reg_dword(req->req_q_in, req->ring_index); + ++ /* Manage unprocessed RIO/ZIO commands in response queue. */ ++ if (vha->flags.process_response_queue && ++ rsp->ring_ptr->signature != RESPONSE_PROCESSED) ++ qla24xx_process_response_queue(vha, rsp); ++ + spin_unlock_irqrestore(&ha->hardware_lock, flags); + + return QLA_SUCCESS; +@@ -1932,6 +1944,7 @@ qla2xxx_start_scsi_mq(srb_t *sp) + uint16_t req_cnt; + uint16_t tot_dsds; + struct req_que *req = NULL; ++ struct rsp_que *rsp; + struct scsi_cmnd *cmd = GET_CMD_SP(sp); + struct scsi_qla_host *vha = sp->fcport->vha; + struct qla_hw_data *ha = vha->hw; +@@ -1942,6 +1955,7 @@ qla2xxx_start_scsi_mq(srb_t *sp) + + /* Setup qpair pointers */ + req = qpair->req; ++ rsp = qpair->rsp; + + /* So we know we haven't pci_map'ed anything yet */ + tot_dsds = 0; +@@ -2042,6 +2056,11 @@ qla2xxx_start_scsi_mq(srb_t *sp) + /* Set chip new ring index. */ + wrt_reg_dword(req->req_q_in, req->ring_index); + ++ /* Manage unprocessed RIO/ZIO commands in response queue. */ ++ if (vha->flags.process_response_queue && ++ rsp->ring_ptr->signature != RESPONSE_PROCESSED) ++ qla24xx_process_response_queue(vha, rsp); ++ + spin_unlock_irqrestore(&qpair->qp_lock, flags); + return QLA_SUCCESS; + diff --git a/patches.suse/scsi-qla2xxx-Fix-RISC-RESET-completion-polling.patch b/patches.suse/scsi-qla2xxx-Fix-RISC-RESET-completion-polling.patch new file mode 100644 index 0000000..beadb72 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-RISC-RESET-completion-polling.patch @@ -0,0 +1,114 @@ +From: Quinn Tran +Date: Mon, 29 Mar 2021 01:52:24 -0700 +Subject: scsi: qla2xxx: Fix RISC RESET completion polling +Patch-mainline: v5.13-rc1 +Git-commit: 610d027b1e6372ffe3e85e8e095a562e920fd5cd +References: bsc#1185491 + +After RISC RESET, the poll time for completion is too short. Fix the +completion polling time. + +Link: https://lore.kernel.org/r/20210329085229.4367-8-njavali@marvell.com +Tested-by: Laurence Oberman +Reviewed-by: Himanshu Madhani +Signed-off-by: Quinn Tran +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_init.c | 65 ++++++++++++++++++++++++++++++++++++---- + 1 file changed, 59 insertions(+), 6 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -2768,6 +2768,49 @@ qla81xx_reset_mpi(scsi_qla_host_t *vha) + return qla81xx_write_mpi_register(vha, mb); + } + ++static int ++qla_chk_risc_recovery(scsi_qla_host_t *vha) ++{ ++ struct qla_hw_data *ha = vha->hw; ++ struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; ++ __le16 __iomem *mbptr = ®->mailbox0; ++ int i; ++ u16 mb[32]; ++ int rc = QLA_SUCCESS; ++ ++ if (!IS_QLA27XX(ha) && !IS_QLA28XX(ha)) ++ return rc; ++ ++ /* this check is only valid after RISC reset */ ++ mb[0] = rd_reg_word(mbptr); ++ mbptr++; ++ if (mb[0] == 0xf) { ++ rc = QLA_FUNCTION_FAILED; ++ ++ for (i = 1; i < 32; i++) { ++ mb[i] = rd_reg_word(mbptr); ++ mbptr++; ++ } ++ ++ ql_log(ql_log_warn, vha, 0x1015, ++ "RISC reset failed. mb[0-7] %04xh %04xh %04xh %04xh %04xh %04xh %04xh %04xh\n", ++ mb[0], mb[1], mb[2], mb[3], mb[4], mb[5], mb[6], mb[7]); ++ ql_log(ql_log_warn, vha, 0x1015, ++ "RISC reset failed. mb[8-15] %04xh %04xh %04xh %04xh %04xh %04xh %04xh %04xh\n", ++ mb[8], mb[9], mb[10], mb[11], mb[12], mb[13], mb[14], ++ mb[15]); ++ ql_log(ql_log_warn, vha, 0x1015, ++ "RISC reset failed. mb[16-23] %04xh %04xh %04xh %04xh %04xh %04xh %04xh %04xh\n", ++ mb[16], mb[17], mb[18], mb[19], mb[20], mb[21], mb[22], ++ mb[23]); ++ ql_log(ql_log_warn, vha, 0x1015, ++ "RISC reset failed. mb[24-31] %04xh %04xh %04xh %04xh %04xh %04xh %04xh %04xh\n", ++ mb[24], mb[25], mb[26], mb[27], mb[28], mb[29], mb[30], ++ mb[31]); ++ } ++ return rc; ++} ++ + /** + * qla24xx_reset_risc() - Perform full reset of ISP24xx RISC. + * @vha: HA context +@@ -2784,6 +2827,7 @@ qla24xx_reset_risc(scsi_qla_host_t *vha) + uint16_t wd; + static int abts_cnt; /* ISP abort retry counts */ + int rval = QLA_SUCCESS; ++ int print = 1; + + spin_lock_irqsave(&ha->hardware_lock, flags); + +@@ -2872,17 +2916,26 @@ qla24xx_reset_risc(scsi_qla_host_t *vha) + rd_reg_dword(®->hccr); + + wrt_reg_dword(®->hccr, HCCRX_CLR_RISC_RESET); ++ mdelay(10); + rd_reg_dword(®->hccr); + +- rd_reg_word(®->mailbox0); +- for (cnt = 60; rd_reg_word(®->mailbox0) != 0 && +- rval == QLA_SUCCESS; cnt--) { ++ wd = rd_reg_word(®->mailbox0); ++ for (cnt = 300; wd != 0 && rval == QLA_SUCCESS; cnt--) { + barrier(); +- if (cnt) +- udelay(5); +- else ++ if (cnt) { ++ mdelay(1); ++ if (print && qla_chk_risc_recovery(vha)) ++ print = 0; ++ ++ wd = rd_reg_word(®->mailbox0); ++ } else { + rval = QLA_FUNCTION_TIMEOUT; ++ ++ ql_log(ql_log_warn, vha, 0x015e, ++ "RISC reset timeout\n"); ++ } + } ++ + if (rval == QLA_SUCCESS) + set_bit(RISC_RDY_AFT_RESET, &ha->fw_dump_cap_flags); + diff --git a/patches.suse/scsi-qla2xxx-Fix-a-couple-of-misdocumented-functions.patch b/patches.suse/scsi-qla2xxx-Fix-a-couple-of-misdocumented-functions.patch new file mode 100644 index 0000000..86d75d0 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-a-couple-of-misdocumented-functions.patch @@ -0,0 +1,48 @@ +From: Lee Jones +Date: Fri, 12 Mar 2021 09:47:19 +0000 +Subject: scsi: qla2xxx: Fix a couple of misdocumented functions +Patch-mainline: v5.13-rc1 +Git-commit: dc49ab48a77c48b3334ec57c2163f92721b06b5e +References: bsc#1185491 + +Fixes the following W=1 kernel build warning(s): + + drivers/scsi/qla2xxx/qla_target.c:6476: warning: expecting prototype for qla_tgt_lport_register(). Prototype was for qlt_lport_register() instead + drivers/scsi/qla2xxx/qla_target.c:6546: warning: expecting prototype for qla_tgt_lport_deregister(). Prototype was for qlt_lport_deregister() instead + +Link: https://lore.kernel.org/r/20210312094738.2207817-12-lee.jones@linaro.org +Cc: Nilesh Javali +Cc: GR-QLogic-Storage-Upstream@marvell.com +Cc: "James E.J. Bottomley" +Cc: "Martin K. Petersen" +Cc: Vladislav Bolkhovitin +Cc: Nathaniel Clark +Cc: "Nicholas A. Bellinger" +Cc: linux-scsi@vger.kernel.org +Signed-off-by: Lee Jones +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_target.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_target.c ++++ b/drivers/scsi/qla2xxx/qla_target.c +@@ -6459,7 +6459,7 @@ static void qlt_lport_dump(struct scsi_q + } + + /** +- * qla_tgt_lport_register - register lport with external module ++ * qlt_lport_register - register lport with external module + * + * @target_lport_ptr: pointer for tcm_qla2xxx specific lport data + * @phys_wwpn: physical port WWPN +@@ -6535,7 +6535,7 @@ int qlt_lport_register(void *target_lpor + EXPORT_SYMBOL(qlt_lport_register); + + /** +- * qla_tgt_lport_deregister - Degister lport ++ * qlt_lport_deregister - Degister lport + * + * @vha: Registered scsi_qla_host pointer + */ diff --git a/patches.suse/scsi-qla2xxx-Fix-a-couple-of-misnamed-functions.patch b/patches.suse/scsi-qla2xxx-Fix-a-couple-of-misnamed-functions.patch new file mode 100644 index 0000000..c8a7e27 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-a-couple-of-misnamed-functions.patch @@ -0,0 +1,45 @@ +From: Lee Jones +Date: Fri, 12 Mar 2021 09:47:16 +0000 +Subject: scsi: qla2xxx: Fix a couple of misnamed functions +Patch-mainline: v5.13-rc1 +Git-commit: 381095668d51387657e456e2962f0bcc3e1044e3 +References: bsc#1185491 + +Fixes the following W=1 kernel build warning(s): + + drivers/scsi/qla2xxx/qla_mr.c:525: warning: expecting prototype for qlafx00_warm_reset(). Prototype was for qlafx00_soc_cpu_reset() instead + drivers/scsi/qla2xxx/qla_mr.c:2869: warning: expecting prototype for qlafx00x_mbx_completion(). Prototype was for qlafx00_mbx_completion() instead + +Link: https://lore.kernel.org/r/20210312094738.2207817-9-lee.jones@linaro.org +Cc: Nilesh Javali +Cc: GR-QLogic-Storage-Upstream@marvell.com +Cc: "James E.J. Bottomley" +Cc: "Martin K. Petersen" +Cc: linux-scsi@vger.kernel.org +Signed-off-by: Lee Jones +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_mr.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_mr.c ++++ b/drivers/scsi/qla2xxx/qla_mr.c +@@ -517,7 +517,7 @@ qlafx00_pci_config(scsi_qla_host_t *vha) + } + + /** +- * qlafx00_warm_reset() - Perform warm reset of iSA(CPUs being reset on SOC). ++ * qlafx00_soc_cpu_reset() - Perform warm reset of iSA(CPUs being reset on SOC). + * @vha: HA context + * + */ +@@ -2861,7 +2861,7 @@ qlafx00_async_event(scsi_qla_host_t *vha + } + + /** +- * qlafx00x_mbx_completion() - Process mailbox command completions. ++ * qlafx00_mbx_completion() - Process mailbox command completions. + * @vha: SCSI driver HA context + * @mb0: value to be written into mailbox register 0 + */ diff --git a/patches.suse/scsi-qla2xxx-Fix-broken-endif-placement.patch b/patches.suse/scsi-qla2xxx-Fix-broken-endif-placement.patch new file mode 100644 index 0000000..21f603e --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-broken-endif-placement.patch @@ -0,0 +1,37 @@ +From: Alexey Dobriyan +Date: Sun, 14 Mar 2021 18:32:46 +0300 +Subject: scsi: qla2xxx: Fix broken #endif placement +Patch-mainline: v5.12-rc4 +Git-commit: 5999b9e5b1f8a2f5417b755130919b3ac96f5550 +References: bsc#1185491 + +Only half of the file is under include guard because terminating #endif +is placed too early. + +Link: https://lore.kernel.org/r/YE4snvoW1SuwcXAn@localhost.localdomain +Reviewed-by: Himanshu Madhani +Signed-off-by: Alexey Dobriyan +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_target.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_target.h ++++ b/drivers/scsi/qla2xxx/qla_target.h +@@ -116,7 +116,6 @@ + (min(1270, ((ql) > 0) ? (QLA_TGT_DATASEGS_PER_CMD_24XX + \ + QLA_TGT_DATASEGS_PER_CONT_24XX*((ql) - 1)) : 0)) + #endif +-#endif + + #define GET_TARGET_ID(ha, iocb) ((HAS_EXTENDED_IDS(ha)) \ + ? le16_to_cpu((iocb)->u.isp2x.target.extended) \ +@@ -244,6 +243,7 @@ struct ctio_to_2xxx { + #ifndef CTIO_RET_TYPE + #define CTIO_RET_TYPE 0x17 /* CTIO return entry */ + #define ATIO_TYPE7 0x06 /* Accept target I/O entry for 24xx */ ++#endif + + struct fcp_hdr { + uint8_t r_ctl; diff --git a/patches.suse/scsi-qla2xxx-Fix-crash-in-PCIe-error-handling.patch b/patches.suse/scsi-qla2xxx-Fix-crash-in-PCIe-error-handling.patch new file mode 100644 index 0000000..52526b6 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-crash-in-PCIe-error-handling.patch @@ -0,0 +1,811 @@ +From: Quinn Tran +Date: Mon, 29 Mar 2021 01:52:25 -0700 +Subject: scsi: qla2xxx: Fix crash in PCIe error handling +Patch-mainline: v5.13-rc1 +Git-commit: f7a0ed479e66ab177801301a1a72c37775c40450 +References: bsc#1185491 + +BUG: unable to handle kernel NULL pointer dereference at (null) +IP: qla2x00_abort_isp+0x21/0x6b0 [qla2xxx] PGD 0 P4D 0 +Oops: 0000 [#1] SMP PTI +CPU: 0 PID: 1715 Comm: kworker/0:2 +Tainted: GOE 4.12.14-122.37-default #1 SLE12-SP5 +Hardware name: HPE Superdome Flex/Superdome Flex, BIOS +Bundle:3.30.100 SFW:IP147.007.004.017.000.2009211957 09/21/2020 +Workqueue: events aer_recover_work_func +task: ffff9e399c14ca80 task.stack: ffffc1c58e4ac000 +RIP: 0010:qla2x00_abort_isp+0x21/0x6b0 [qla2xxx] +RSP: 0018:ffffc1c58e4afd50 EFLAGS: 00010282 +RAX: 0000000000000000 RBX: ffff9e419cdef480 RCX: 0000000000000000 +RDX: ffff9e399c14ca80 RSI: 0000000000000246 RDI: ffff9e419bbc27b8 +RBP: ffff9e419bbc27b8 R08: 0000000000000004 R09: 00000000a0440000 +R10: 0000000000000000 R11: ffff9e399416d1a0 R12: ffff9e419cdef000 +R13: ffff9e3a7cfae800 R14: ffff9e3a7cfae800 R15: 00000000000000c0 +FS: 0000000000000000(0000) GS:ffff9e39a0000000(0000) knlGS:0000000000000000 +CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +CR2: 0000000000000000 CR3: 00000006cd00a005 CR4: 00000000007606f0 +DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 +DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 +PKRU: 55555554 +Call Trace: + qla2xxx_pci_slot_reset+0x141/0x160 [qla2xxx] + report_slot_reset+0x41/0x80 + ? merge_result.part.4+0x30/0x30 + pci_walk_bus+0x70/0x90 + pcie_do_recovery+0x1db/0x2e0 + aer_recover_work_func+0xc2/0xf0 + process_one_work+0x14c/0x390 + +Disable board_disable logic where driver resources are freed while OS is in +the process of recovering the adapter. + +Link: https://lore.kernel.org/r/20210329085229.4367-9-njavali@marvell.com +Tested-by: Laurence Oberman +Signed-off-by: Quinn Tran +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_dbg.c | 16 +++ + drivers/scsi/qla2xxx/qla_def.h | 10 ++ + drivers/scsi/qla2xxx/qla_gbl.h | 3 + drivers/scsi/qla2xxx/qla_init.c | 40 +++++--- + drivers/scsi/qla2xxx/qla_inline.h | 46 ++++++++++ + drivers/scsi/qla2xxx/qla_iocb.c | 60 ++++++++++--- + drivers/scsi/qla2xxx/qla_isr.c | 9 - + drivers/scsi/qla2xxx/qla_mbx.c | 3 + drivers/scsi/qla2xxx/qla_nvme.c | 10 +- + drivers/scsi/qla2xxx/qla_os.c | 173 ++++++++++++++++++++++---------------- + 10 files changed, 265 insertions(+), 105 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_dbg.c ++++ b/drivers/scsi/qla2xxx/qla_dbg.c +@@ -114,8 +114,13 @@ qla27xx_dump_mpi_ram(struct qla_hw_data + uint32_t stat; + ulong i, j, timer = 6000000; + int rval = QLA_FUNCTION_FAILED; ++ scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); + + clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); ++ ++ if (qla_pci_disconnected(vha, reg)) ++ return rval; ++ + for (i = 0; i < ram_dwords; i += dwords, addr += dwords) { + if (i + dwords > ram_dwords) + dwords = ram_dwords - i; +@@ -139,6 +144,9 @@ qla27xx_dump_mpi_ram(struct qla_hw_data + while (timer--) { + udelay(5); + ++ if (qla_pci_disconnected(vha, reg)) ++ return rval; ++ + stat = rd_reg_dword(®->host_status); + /* Check for pending interrupts. */ + if (!(stat & HSRX_RISC_INT)) +@@ -193,9 +201,13 @@ qla24xx_dump_ram(struct qla_hw_data *ha, + uint32_t dwords = qla2x00_gid_list_size(ha) / 4; + uint32_t stat; + ulong i, j, timer = 6000000; ++ scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); + + clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); + ++ if (qla_pci_disconnected(vha, reg)) ++ return rval; ++ + for (i = 0; i < ram_dwords; i += dwords, addr += dwords) { + if (i + dwords > ram_dwords) + dwords = ram_dwords - i; +@@ -217,8 +229,10 @@ qla24xx_dump_ram(struct qla_hw_data *ha, + ha->flags.mbox_int = 0; + while (timer--) { + udelay(5); +- stat = rd_reg_dword(®->host_status); ++ if (qla_pci_disconnected(vha, reg)) ++ return rval; + ++ stat = rd_reg_dword(®->host_status); + /* Check for pending interrupts. */ + if (!(stat & HSRX_RISC_INT)) + continue; +--- a/drivers/scsi/qla2xxx/qla_def.h ++++ b/drivers/scsi/qla2xxx/qla_def.h +@@ -397,6 +397,7 @@ typedef union { + } b; + } port_id_t; + #define INVALID_PORT_ID 0xFFFFFF ++#define ISP_REG16_DISCONNECT 0xFFFF + + static inline le_id_t be_id_to_le(be_id_t id) + { +@@ -3858,6 +3859,13 @@ struct qla_hw_data_stat { + u32 num_mpi_reset; + }; + ++/* refer to pcie_do_recovery reference */ ++typedef enum { ++ QLA_PCI_RESUME, ++ QLA_PCI_ERR_DETECTED, ++ QLA_PCI_MMIO_ENABLED, ++ QLA_PCI_SLOT_RESET, ++} pci_error_state_t; + /* + * Qlogic host adapter specific data structure. + */ +@@ -4608,6 +4616,7 @@ struct qla_hw_data { + #define DEFAULT_ZIO_THRESHOLD 5 + + struct qla_hw_data_stat stat; ++ pci_error_state_t pci_error_state; + }; + + struct active_regions { +@@ -4728,6 +4737,7 @@ typedef struct scsi_qla_host { + #define FX00_CRITEMP_RECOVERY 25 + #define FX00_HOST_INFO_RESEND 26 + #define QPAIR_ONLINE_CHECK_NEEDED 27 ++#define DO_EEH_RECOVERY 28 + #define DETECT_SFP_CHANGE 29 + #define N2N_LOGIN_NEEDED 30 + #define IOCB_WORK_ACTIVE 31 +--- a/drivers/scsi/qla2xxx/qla_gbl.h ++++ b/drivers/scsi/qla2xxx/qla_gbl.h +@@ -225,6 +225,7 @@ extern int qla2x00_post_uevent_work(stru + + extern int qla2x00_post_uevent_work(struct scsi_qla_host *, u32); + extern void qla2x00_disable_board_on_pci_error(struct work_struct *); ++extern void qla_eeh_work(struct work_struct *); + extern void qla2x00_sp_compl(srb_t *sp, int); + extern void qla2xxx_qpair_sp_free_dma(srb_t *sp); + extern void qla2xxx_qpair_sp_compl(srb_t *sp, int); +@@ -236,6 +237,8 @@ int qla24xx_post_relogin_work(struct scs + void qla2x00_wait_for_sess_deletion(scsi_qla_host_t *); + void qla24xx_process_purex_rdp(struct scsi_qla_host *vha, + struct purex_item *pkt); ++void qla_pci_set_eeh_busy(struct scsi_qla_host *); ++void qla_schedule_eeh_work(struct scsi_qla_host *); + + /* + * Global Functions in qla_mid.c source file. +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -6933,22 +6933,18 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_ + } + spin_unlock_irqrestore(&ha->vport_slock, flags); + +- if (!ha->flags.eeh_busy) { +- /* Make sure for ISP 82XX IO DMA is complete */ +- if (IS_P3P_TYPE(ha)) { +- qla82xx_chip_reset_cleanup(vha); +- ql_log(ql_log_info, vha, 0x00b4, +- "Done chip reset cleanup.\n"); +- +- /* Done waiting for pending commands. +- * Reset the online flag. +- */ +- vha->flags.online = 0; +- } ++ /* Make sure for ISP 82XX IO DMA is complete */ ++ if (IS_P3P_TYPE(ha)) { ++ qla82xx_chip_reset_cleanup(vha); ++ ql_log(ql_log_info, vha, 0x00b4, ++ "Done chip reset cleanup.\n"); + +- /* Requeue all commands in outstanding command list. */ +- qla2x00_abort_all_cmds(vha, DID_RESET << 16); ++ /* Done waiting for pending commands. Reset online flag */ ++ vha->flags.online = 0; + } ++ ++ /* Requeue all commands in outstanding command list. */ ++ qla2x00_abort_all_cmds(vha, DID_RESET << 16); + /* memory barrier */ + wmb(); + } +@@ -6979,6 +6975,12 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) + if (vha->hw->flags.port_isolated) + return status; + ++ if (qla2x00_isp_reg_stat(ha)) { ++ ql_log(ql_log_info, vha, 0x803f, ++ "ISP Abort - ISP reg disconnect, exiting.\n"); ++ return status; ++ } ++ + if (test_and_clear_bit(ISP_ABORT_TO_ROM, &vha->dpc_flags)) { + ha->flags.chip_reset_done = 1; + vha->flags.online = 1; +@@ -7018,8 +7020,18 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) + + ha->isp_ops->get_flash_version(vha, req->ring); + ++ if (qla2x00_isp_reg_stat(ha)) { ++ ql_log(ql_log_info, vha, 0x803f, ++ "ISP Abort - ISP reg disconnect pre nvram config, exiting.\n"); ++ return status; ++ } + ha->isp_ops->nvram_config(vha); + ++ if (qla2x00_isp_reg_stat(ha)) { ++ ql_log(ql_log_info, vha, 0x803f, ++ "ISP Abort - ISP reg disconnect post nvmram config, exiting.\n"); ++ return status; ++ } + if (!qla2x00_restart_isp(vha)) { + clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); + +--- a/drivers/scsi/qla2xxx/qla_inline.h ++++ b/drivers/scsi/qla2xxx/qla_inline.h +@@ -433,3 +433,49 @@ qla_put_iocbs(struct qla_qpair *qp, stru + } + iores->res_type = RESOURCE_NONE; + } ++ ++#define ISP_REG_DISCONNECT 0xffffffffU ++/************************************************************************** ++ * qla2x00_isp_reg_stat ++ * ++ * Description: ++ * Read the host status register of ISP before aborting the command. ++ * ++ * Input: ++ * ha = pointer to host adapter structure. ++ * ++ * ++ * Returns: ++ * Either true or false. ++ * ++ * Note: Return true if there is register disconnect. ++ **************************************************************************/ ++static inline ++uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha) ++{ ++ struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; ++ struct device_reg_82xx __iomem *reg82 = &ha->iobase->isp82; ++ ++ if (IS_P3P_TYPE(ha)) ++ return ((rd_reg_dword(®82->host_int)) == ISP_REG_DISCONNECT); ++ else ++ return ((rd_reg_dword(®->host_status)) == ++ ISP_REG_DISCONNECT); ++} ++ ++static inline ++bool qla_pci_disconnected(struct scsi_qla_host *vha, ++ struct device_reg_24xx __iomem *reg) ++{ ++ uint32_t stat; ++ bool ret = false; ++ ++ stat = rd_reg_dword(®->host_status); ++ if (stat == 0xffffffff) { ++ ql_log(ql_log_info, vha, 0x8041, ++ "detected PCI disconnect.\n"); ++ qla_schedule_eeh_work(vha); ++ ret = true; ++ } ++ return ret; ++} +--- a/drivers/scsi/qla2xxx/qla_iocb.c ++++ b/drivers/scsi/qla2xxx/qla_iocb.c +@@ -1646,8 +1646,14 @@ qla24xx_start_scsi(srb_t *sp) + goto queuing_error; + + if (req->cnt < (req_cnt + 2)) { +- cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr : +- rd_reg_dword_relaxed(req->req_q_out); ++ if (IS_SHADOW_REG_CAPABLE(ha)) { ++ cnt = *req->out_ptr; ++ } else { ++ cnt = rd_reg_dword_relaxed(req->req_q_out); ++ if (qla2x00_check_reg16_for_disconnect(vha, cnt)) ++ goto queuing_error; ++ } ++ + if (req->ring_index < cnt) + req->cnt = cnt - req->ring_index; + else +@@ -1843,8 +1849,13 @@ qla24xx_dif_start_scsi(srb_t *sp) + goto queuing_error; + + if (req->cnt < (req_cnt + 2)) { +- cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr : +- rd_reg_dword_relaxed(req->req_q_out); ++ if (IS_SHADOW_REG_CAPABLE(ha)) { ++ cnt = *req->out_ptr; ++ } else { ++ cnt = rd_reg_dword_relaxed(req->req_q_out); ++ if (qla2x00_check_reg16_for_disconnect(vha, cnt)) ++ goto queuing_error; ++ } + if (req->ring_index < cnt) + req->cnt = cnt - req->ring_index; + else +@@ -1923,6 +1934,7 @@ qla24xx_dif_start_scsi(srb_t *sp) + + qla_put_iocbs(sp->qpair, &sp->iores); + spin_unlock_irqrestore(&ha->hardware_lock, flags); ++ + return QLA_FUNCTION_FAILED; + } + +@@ -1992,8 +2004,14 @@ qla2xxx_start_scsi_mq(srb_t *sp) + goto queuing_error; + + if (req->cnt < (req_cnt + 2)) { +- cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr : +- rd_reg_dword_relaxed(req->req_q_out); ++ if (IS_SHADOW_REG_CAPABLE(ha)) { ++ cnt = *req->out_ptr; ++ } else { ++ cnt = rd_reg_dword_relaxed(req->req_q_out); ++ if (qla2x00_check_reg16_for_disconnect(vha, cnt)) ++ goto queuing_error; ++ } ++ + if (req->ring_index < cnt) + req->cnt = cnt - req->ring_index; + else +@@ -2204,8 +2222,14 @@ qla2xxx_dif_start_scsi_mq(srb_t *sp) + goto queuing_error; + + if (req->cnt < (req_cnt + 2)) { +- cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr : +- rd_reg_dword_relaxed(req->req_q_out); ++ if (IS_SHADOW_REG_CAPABLE(ha)) { ++ cnt = *req->out_ptr; ++ } else { ++ cnt = rd_reg_dword_relaxed(req->req_q_out); ++ if (qla2x00_check_reg16_for_disconnect(vha, cnt)) ++ goto queuing_error; ++ } ++ + if (req->ring_index < cnt) + req->cnt = cnt - req->ring_index; + else +@@ -2282,6 +2306,7 @@ qla2xxx_dif_start_scsi_mq(srb_t *sp) + + qla_put_iocbs(sp->qpair, &sp->iores); + spin_unlock_irqrestore(&qpair->qp_lock, flags); ++ + return QLA_FUNCTION_FAILED; + } + +@@ -2326,6 +2351,11 @@ void * + cnt = qla2x00_debounce_register( + ISP_REQ_Q_OUT(ha, ®->isp)); + ++ if (!qpair->use_shadow_reg && cnt == ISP_REG16_DISCONNECT) { ++ qla_schedule_eeh_work(vha); ++ return NULL; ++ } ++ + if (req->ring_index < cnt) + req->cnt = cnt - req->ring_index; + else +@@ -3741,6 +3771,9 @@ qla2x00_start_sp(srb_t *sp) + void *pkt; + unsigned long flags; + ++ if (vha->hw->flags.eeh_busy) ++ return -EIO; ++ + spin_lock_irqsave(qp->qp_lock_ptr, flags); + pkt = __qla2x00_alloc_iocbs(sp->qpair, sp); + if (!pkt) { +@@ -3958,8 +3991,14 @@ qla2x00_start_bidir(srb_t *sp, struct sc + + /* Check for room on request queue. */ + if (req->cnt < req_cnt + 2) { +- cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr : +- rd_reg_dword_relaxed(req->req_q_out); ++ if (IS_SHADOW_REG_CAPABLE(ha)) { ++ cnt = *req->out_ptr; ++ } else { ++ cnt = rd_reg_dword_relaxed(req->req_q_out); ++ if (qla2x00_check_reg16_for_disconnect(vha, cnt)) ++ goto queuing_error; ++ } ++ + if (req->ring_index < cnt) + req->cnt = cnt - req->ring_index; + else +@@ -3998,5 +4037,6 @@ qla2x00_start_bidir(srb_t *sp, struct sc + qla2x00_start_iocbs(vha, req); + queuing_error: + spin_unlock_irqrestore(&ha->hardware_lock, flags); ++ + return rval; + } +--- a/drivers/scsi/qla2xxx/qla_isr.c ++++ b/drivers/scsi/qla2xxx/qla_isr.c +@@ -271,12 +271,7 @@ qla2x00_check_reg32_for_disconnect(scsi_ + if (!test_and_set_bit(PFLG_DISCONNECTED, &vha->pci_flags) && + !test_bit(PFLG_DRIVER_REMOVING, &vha->pci_flags) && + !test_bit(PFLG_DRIVER_PROBING, &vha->pci_flags)) { +- /* +- * Schedule this (only once) on the default system +- * workqueue so that all the adapter workqueues and the +- * DPC thread can be shutdown cleanly. +- */ +- schedule_work(&vha->hw->board_disable); ++ qla_schedule_eeh_work(vha); + } + return true; + } else +@@ -1658,8 +1653,6 @@ qla2x00_async_event(scsi_qla_host_t *vha + case MBA_TEMPERATURE_ALERT: + ql_dbg(ql_dbg_async, vha, 0x505e, + "TEMPERATURE ALERT: %04x %04x %04x\n", mb[1], mb[2], mb[3]); +- if (mb[1] == 0x12) +- schedule_work(&ha->board_disable); + break; + + case MBA_TRANS_INSERT: +--- a/drivers/scsi/qla2xxx/qla_mbx.c ++++ b/drivers/scsi/qla2xxx/qla_mbx.c +@@ -162,7 +162,8 @@ qla2x00_mailbox_command(scsi_qla_host_t + /* check if ISP abort is active and return cmd with timeout */ + if ((test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || + test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || +- test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) && ++ test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) || ++ ha->flags.eeh_busy) && + !is_rom_cmd(mcp->mb[0])) { + ql_log(ql_log_info, vha, 0x1005, + "Cmd 0x%x aborted with timeout since ISP Abort is pending\n", +--- a/drivers/scsi/qla2xxx/qla_nvme.c ++++ b/drivers/scsi/qla2xxx/qla_nvme.c +@@ -399,8 +399,13 @@ static inline int qla2x00_start_nvme_mq( + } + req_cnt = qla24xx_calc_iocbs(vha, tot_dsds); + if (req->cnt < (req_cnt + 2)) { +- cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr : +- rd_reg_dword_relaxed(req->req_q_out); ++ if (IS_SHADOW_REG_CAPABLE(ha)) { ++ cnt = *req->out_ptr; ++ } else { ++ cnt = rd_reg_dword_relaxed(req->req_q_out); ++ if (qla2x00_check_reg16_for_disconnect(vha, cnt)) ++ goto queuing_error; ++ } + + if (req->ring_index < cnt) + req->cnt = cnt - req->ring_index; +@@ -537,6 +542,7 @@ static inline int qla2x00_start_nvme_mq( + + queuing_error: + spin_unlock_irqrestore(&qpair->qp_lock, flags); ++ + return rval; + } + +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -972,6 +972,13 @@ qla2xxx_mqueuecommand(struct Scsi_Host * + goto qc24_fail_command; + } + ++ if (!qpair->online) { ++ ql_dbg(ql_dbg_io, vha, 0x3077, ++ "qpair not online. eeh_busy=%d.\n", ha->flags.eeh_busy); ++ cmd->result = DID_NO_CONNECT << 16; ++ goto qc24_fail_command; ++ } ++ + if (!fcport || fcport->deleted) { + cmd->result = DID_IMM_RETRY << 16; + goto qc24_fail_command; +@@ -1201,35 +1208,6 @@ qla2x00_wait_for_chip_reset(scsi_qla_hos + return return_status; + } + +-#define ISP_REG_DISCONNECT 0xffffffffU +-/************************************************************************** +-* qla2x00_isp_reg_stat +-* +-* Description: +-* Read the host status register of ISP before aborting the command. +-* +-* Input: +-* ha = pointer to host adapter structure. +-* +-* +-* Returns: +-* Either true or false. +-* +-* Note: Return true if there is register disconnect. +-**************************************************************************/ +-static inline +-uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha) +-{ +- struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; +- struct device_reg_82xx __iomem *reg82 = &ha->iobase->isp82; +- +- if (IS_P3P_TYPE(ha)) +- return ((rd_reg_dword(®82->host_int)) == ISP_REG_DISCONNECT); +- else +- return ((rd_reg_dword(®->host_status)) == +- ISP_REG_DISCONNECT); +-} +- + /************************************************************************** + * qla2xxx_eh_abort + * +@@ -1263,6 +1241,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) + if (qla2x00_isp_reg_stat(ha)) { + ql_log(ql_log_info, vha, 0x8042, + "PCI/Register disconnect, exiting.\n"); ++ qla_pci_set_eeh_busy(vha); + return FAILED; + } + +@@ -1456,6 +1435,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd + if (qla2x00_isp_reg_stat(ha)) { + ql_log(ql_log_info, vha, 0x803e, + "PCI/Register disconnect, exiting.\n"); ++ qla_pci_set_eeh_busy(vha); + return FAILED; + } + +@@ -1472,6 +1452,7 @@ qla2xxx_eh_target_reset(struct scsi_cmnd + if (qla2x00_isp_reg_stat(ha)) { + ql_log(ql_log_info, vha, 0x803f, + "PCI/Register disconnect, exiting.\n"); ++ qla_pci_set_eeh_busy(vha); + return FAILED; + } + +@@ -1507,6 +1488,7 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *c + if (qla2x00_isp_reg_stat(ha)) { + ql_log(ql_log_info, vha, 0x8040, + "PCI/Register disconnect, exiting.\n"); ++ qla_pci_set_eeh_busy(vha); + return FAILED; + } + +@@ -1584,7 +1566,7 @@ qla2xxx_eh_host_reset(struct scsi_cmnd * + if (qla2x00_isp_reg_stat(ha)) { + ql_log(ql_log_info, vha, 0x8041, + "PCI/Register disconnect, exiting.\n"); +- schedule_work(&ha->board_disable); ++ qla_pci_set_eeh_busy(vha); + return SUCCESS; + } + +@@ -6669,6 +6651,9 @@ qla2x00_do_dpc(void *data) + + schedule(); + ++ if (test_and_clear_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags)) ++ qla_pci_set_eeh_busy(base_vha); ++ + if (!base_vha->flags.init_done || ha->flags.mbox_busy) + goto end_loop; + +@@ -7385,6 +7370,8 @@ static void qla_pci_error_cleanup(scsi_q + int i; + unsigned long flags; + ++ ql_dbg(ql_dbg_aer, vha, 0x9000, ++ "%s\n", __func__); + ha->chip_reset++; + + ha->base_qpair->chip_reset = ha->chip_reset; +@@ -7394,28 +7381,16 @@ static void qla_pci_error_cleanup(scsi_q + ha->base_qpair->chip_reset; + } + +- /* purge MBox commands */ +- if (atomic_read(&ha->num_pend_mbx_stage3)) { +- clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); +- complete(&ha->mbx_intr_comp); +- } +- +- i = 0; +- +- while (atomic_read(&ha->num_pend_mbx_stage3) || +- atomic_read(&ha->num_pend_mbx_stage2) || +- atomic_read(&ha->num_pend_mbx_stage1)) { +- msleep(20); +- i++; +- if (i > 50) +- break; +- } +- +- ha->flags.purge_mbox = 0; ++ /* ++ * purge mailbox might take a while. Slot Reset/chip reset ++ * will take care of the purge ++ */ + + mutex_lock(&ha->mq_lock); ++ ha->base_qpair->online = 0; + list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) + qpair->online = 0; ++ wmb(); + mutex_unlock(&ha->mq_lock); + + qla2x00_mark_all_devices_lost(vha); +@@ -7452,14 +7427,17 @@ qla2xxx_pci_error_detected(struct pci_de + { + scsi_qla_host_t *vha = pci_get_drvdata(pdev); + struct qla_hw_data *ha = vha->hw; ++ pci_ers_result_t ret = PCI_ERS_RESULT_NEED_RESET; + +- ql_dbg(ql_dbg_aer, vha, 0x9000, +- "PCI error detected, state %x.\n", state); ++ ql_log(ql_log_warn, vha, 0x9000, ++ "PCI error detected, state %x.\n", state); ++ ha->pci_error_state = QLA_PCI_ERR_DETECTED; + + if (!atomic_read(&pdev->enable_cnt)) { + ql_log(ql_log_info, vha, 0xffff, + "PCI device is disabled,state %x\n", state); +- return PCI_ERS_RESULT_NEED_RESET; ++ ret = PCI_ERS_RESULT_NEED_RESET; ++ goto out; + } + + switch (state) { +@@ -7469,11 +7447,12 @@ qla2xxx_pci_error_detected(struct pci_de + set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); + qla2xxx_wake_dpc(vha); + } +- return PCI_ERS_RESULT_CAN_RECOVER; ++ ret = PCI_ERS_RESULT_CAN_RECOVER; ++ break; + case pci_channel_io_frozen: +- ha->flags.eeh_busy = 1; +- qla_pci_error_cleanup(vha); +- return PCI_ERS_RESULT_NEED_RESET; ++ qla_pci_set_eeh_busy(vha); ++ ret = PCI_ERS_RESULT_NEED_RESET; ++ break; + case pci_channel_io_perm_failure: + ha->flags.pci_channel_io_perm_failure = 1; + qla2x00_abort_all_cmds(vha, DID_NO_CONNECT << 16); +@@ -7481,9 +7460,12 @@ qla2xxx_pci_error_detected(struct pci_de + set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); + qla2xxx_wake_dpc(vha); + } +- return PCI_ERS_RESULT_DISCONNECT; ++ ret = PCI_ERS_RESULT_DISCONNECT; + } +- return PCI_ERS_RESULT_NEED_RESET; ++out: ++ ql_dbg(ql_dbg_aer, vha, 0x600d, ++ "PCI error detected returning [%x].\n", ret); ++ return ret; + } + + static pci_ers_result_t +@@ -7497,6 +7479,10 @@ qla2xxx_pci_mmio_enabled(struct pci_dev + struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; + struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24; + ++ ql_log(ql_log_warn, base_vha, 0x9000, ++ "mmio enabled\n"); ++ ++ ha->pci_error_state = QLA_PCI_MMIO_ENABLED; + if (IS_QLA82XX(ha)) + return PCI_ERS_RESULT_RECOVERED; + +@@ -7520,10 +7506,11 @@ qla2xxx_pci_mmio_enabled(struct pci_dev + ql_log(ql_log_info, base_vha, 0x9003, + "RISC paused -- mmio_enabled, Dumping firmware.\n"); + qla2xxx_dump_fw(base_vha); +- +- return PCI_ERS_RESULT_NEED_RESET; +- } else +- return PCI_ERS_RESULT_RECOVERED; ++ } ++ /* set PCI_ERS_RESULT_NEED_RESET to trigger call to qla2xxx_pci_slot_reset */ ++ ql_dbg(ql_dbg_aer, base_vha, 0x600d, ++ "mmio enabled returning.\n"); ++ return PCI_ERS_RESULT_NEED_RESET; + } + + static pci_ers_result_t +@@ -7535,9 +7522,10 @@ qla2xxx_pci_slot_reset(struct pci_dev *p + int rc; + struct qla_qpair *qpair = NULL; + +- ql_dbg(ql_dbg_aer, base_vha, 0x9004, +- "Slot Reset.\n"); ++ ql_log(ql_log_warn, base_vha, 0x9004, ++ "Slot Reset.\n"); + ++ ha->pci_error_state = QLA_PCI_SLOT_RESET; + /* Workaround: qla2xxx driver which access hardware earlier + * needs error state to be pci_channel_io_online. + * Otherwise mailbox command timesout. +@@ -7571,16 +7559,24 @@ qla2xxx_pci_slot_reset(struct pci_dev *p + qpair->online = 1; + mutex_unlock(&ha->mq_lock); + ++ ha->flags.eeh_busy = 0; + base_vha->flags.online = 1; + set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); +- if (ha->isp_ops->abort_isp(base_vha) == QLA_SUCCESS) +- ret = PCI_ERS_RESULT_RECOVERED; ++ ha->isp_ops->abort_isp(base_vha); + clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); + ++ if (qla2x00_isp_reg_stat(ha)) { ++ ha->flags.eeh_busy = 1; ++ qla_pci_error_cleanup(base_vha); ++ ql_log(ql_log_warn, base_vha, 0x9005, ++ "Device unable to recover from PCI error.\n"); ++ } else { ++ ret = PCI_ERS_RESULT_RECOVERED; ++ } + + exit_slot_reset: + ql_dbg(ql_dbg_aer, base_vha, 0x900e, +- "slot_reset return %x.\n", ret); ++ "Slot Reset returning %x.\n", ret); + + return ret; + } +@@ -7592,16 +7588,55 @@ qla2xxx_pci_resume(struct pci_dev *pdev) + struct qla_hw_data *ha = base_vha->hw; + int ret; + +- ql_dbg(ql_dbg_aer, base_vha, 0x900f, +- "pci_resume.\n"); ++ ql_log(ql_log_warn, base_vha, 0x900f, ++ "Pci Resume.\n"); + +- ha->flags.eeh_busy = 0; + + ret = qla2x00_wait_for_hba_online(base_vha); + if (ret != QLA_SUCCESS) { + ql_log(ql_log_fatal, base_vha, 0x9002, + "The device failed to resume I/O from slot/link_reset.\n"); + } ++ ha->pci_error_state = QLA_PCI_RESUME; ++ ql_dbg(ql_dbg_aer, base_vha, 0x600d, ++ "Pci Resume returning.\n"); ++} ++ ++void qla_pci_set_eeh_busy(struct scsi_qla_host *vha) ++{ ++ struct qla_hw_data *ha = vha->hw; ++ struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); ++ bool do_cleanup = false; ++ unsigned long flags; ++ ++ if (ha->flags.eeh_busy) ++ return; ++ ++ spin_lock_irqsave(&base_vha->work_lock, flags); ++ if (!ha->flags.eeh_busy) { ++ ha->flags.eeh_busy = 1; ++ do_cleanup = true; ++ } ++ spin_unlock_irqrestore(&base_vha->work_lock, flags); ++ ++ if (do_cleanup) ++ qla_pci_error_cleanup(base_vha); ++} ++ ++/* ++ * this routine will schedule a task to pause IO from interrupt context ++ * if caller sees a PCIE error event (register read = 0xf's) ++ */ ++void qla_schedule_eeh_work(struct scsi_qla_host *vha) ++{ ++ struct qla_hw_data *ha = vha->hw; ++ struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); ++ ++ if (ha->flags.eeh_busy) ++ return; ++ ++ set_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags); ++ qla2xxx_wake_dpc(base_vha); + } + + static void diff --git a/patches.suse/scsi-qla2xxx-Fix-crash-in-qla2xxx_mqueuecommand.patch b/patches.suse/scsi-qla2xxx-Fix-crash-in-qla2xxx_mqueuecommand.patch new file mode 100644 index 0000000..284f43f --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-crash-in-qla2xxx_mqueuecommand.patch @@ -0,0 +1,55 @@ +From: Arun Easi +Date: Mon, 29 Mar 2021 01:52:23 -0700 +Subject: scsi: qla2xxx: Fix crash in qla2xxx_mqueuecommand() +Patch-mainline: v5.13-rc1 +Git-commit: 6641df81ab799f28a5d564f860233dd26cca0d93 +References: bsc#1185491 + + RIP: 0010:kmem_cache_free+0xfa/0x1b0 + Call Trace: + qla2xxx_mqueuecommand+0x2b5/0x2c0 [qla2xxx] + scsi_queue_rq+0x5e2/0xa40 + __blk_mq_try_issue_directly+0x128/0x1d0 + blk_mq_request_issue_directly+0x4e/0xb0 + +Fix incorrect call to free srb in qla2xxx_mqueuecommand(), as srb is now +allocated by upper layers. This fixes smatch warning of srb unintended +free. + +Link: https://lore.kernel.org/r/20210329085229.4367-7-njavali@marvell.com +Fixes: af2a0c51b120 ("scsi: qla2xxx: Fix SRB leak on switch command timeout") +Cc: stable@vger.kernel.org # 5.5 +Reported-by: Laurence Oberman +Reported-by: Dan Carpenter +Reviewed-by: Himanshu Madhani +Signed-off-by: Arun Easi +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_os.c | 7 ------- + 1 file changed, 7 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -1014,8 +1014,6 @@ qla2xxx_mqueuecommand(struct Scsi_Host * + if (rval != QLA_SUCCESS) { + ql_dbg(ql_dbg_io + ql_dbg_verbose, vha, 0x3078, + "Start scsi failed rval=%d for cmd=%p.\n", rval, cmd); +- if (rval == QLA_INTERFACE_ERROR) +- goto qc24_free_sp_fail_command; + goto qc24_host_busy_free_sp; + } + +@@ -1027,11 +1025,6 @@ qla2xxx_mqueuecommand(struct Scsi_Host * + qc24_target_busy: + return SCSI_MLQUEUE_TARGET_BUSY; + +-qc24_free_sp_fail_command: +- sp->free(sp); +- CMD_SP(cmd) = NULL; +- qla2xxx_rel_qpair_sp(sp->qpair, sp); +- + qc24_fail_command: + cmd->scsi_done(cmd); + diff --git a/patches.suse/scsi-qla2xxx-Fix-endianness-annotations.patch b/patches.suse/scsi-qla2xxx-Fix-endianness-annotations.patch new file mode 100644 index 0000000..c64bd5b --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-endianness-annotations.patch @@ -0,0 +1,85 @@ +From: Bart Van Assche +Date: Sat, 20 Mar 2021 16:23:55 -0700 +Subject: scsi: qla2xxx: Fix endianness annotations +Patch-mainline: v5.13-rc1 +Git-commit: 37ce4f3531d4a38f3f598fab45d80be5b46aee3c +References: bsc#1185491 + +Fix all recently introduced endianness annotation issues. + +Link: https://lore.kernel.org/r/20210320232359.941-4-bvanassche@acm.org +Cc: Quinn Tran +Cc: Mike Christie +Reviewed-by: Daniel Wagner +Reviewed-by: Himanshu Madhani +Reviewed-by: Lee Duncan +Signed-off-by: Bart Van Assche +Signed-off-by: Martin K. Petersen +--- + drivers/scsi/qla2xxx/qla_def.h | 2 +- + drivers/scsi/qla2xxx/qla_iocb.c | 3 ++- + drivers/scsi/qla2xxx/qla_isr.c | 2 +- + drivers/scsi/qla2xxx/qla_sup.c | 9 +++++---- + 4 files changed, 9 insertions(+), 7 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_def.h ++++ b/drivers/scsi/qla2xxx/qla_def.h +@@ -1528,7 +1528,7 @@ struct init_sf_cb { + * BIT_12 = Remote Write Optimization (1 - Enabled, 0 - Disabled) + * BIT 11-0 = Reserved + */ +- uint16_t flags; ++ __le16 flags; + uint8_t reserved1[32]; + uint16_t discard_OHRB_timeout_value; + uint16_t remote_write_opt_queue_num; +--- a/drivers/scsi/qla2xxx/qla_iocb.c ++++ b/drivers/scsi/qla2xxx/qla_iocb.c +@@ -2380,7 +2380,8 @@ qla24xx_prli_iocb(srb_t *sp, struct logi + cpu_to_le32(NVME_PRLI_SP_FIRST_BURST); + if (sp->vha->flags.nvme2_enabled) { + /* Set service parameter BIT_7 for NVME CONF support */ +- logio->io_parameter[0] |= NVME_PRLI_SP_CONF; ++ logio->io_parameter[0] |= ++ cpu_to_le32(NVME_PRLI_SP_CONF); + /* Set service parameter BIT_8 for SLER support */ + logio->io_parameter[0] |= + cpu_to_le32(NVME_PRLI_SP_SLER); +--- a/drivers/scsi/qla2xxx/qla_isr.c ++++ b/drivers/scsi/qla2xxx/qla_isr.c +@@ -3441,7 +3441,7 @@ qla24xx_abort_iocb_entry(scsi_qla_host_t + return; + + abt = &sp->u.iocb_cmd; +- abt->u.abt.comp_status = le16_to_cpu(pkt->comp_status); ++ abt->u.abt.comp_status = pkt->comp_status; + orig_sp = sp->cmd_sp; + /* Need to pass original sp */ + if (orig_sp) +--- a/drivers/scsi/qla2xxx/qla_sup.c ++++ b/drivers/scsi/qla2xxx/qla_sup.c +@@ -2622,10 +2622,11 @@ qla24xx_read_optrom_data(struct scsi_qla + } + + static int +-qla28xx_extract_sfub_and_verify(struct scsi_qla_host *vha, uint32_t *buf, ++qla28xx_extract_sfub_and_verify(struct scsi_qla_host *vha, __le32 *buf, + uint32_t len, uint32_t buf_size_without_sfub, uint8_t *sfub_buf) + { +- uint32_t *p, check_sum = 0; ++ uint32_t check_sum = 0; ++ __le32 *p; + int i; + + p = buf + buf_size_without_sfub; +@@ -2791,8 +2792,8 @@ qla28xx_write_flash_data(scsi_qla_host_t + goto done; + } + +- rval = qla28xx_extract_sfub_and_verify(vha, dwptr, dwords, +- buf_size_without_sfub, (uint8_t *)sfub); ++ rval = qla28xx_extract_sfub_and_verify(vha, (__le32 *)dwptr, ++ dwords, buf_size_without_sfub, (uint8_t *)sfub); + + if (rval != QLA_SUCCESS) + goto done; diff --git a/patches.suse/scsi-qla2xxx-Fix-incorrectly-named-function-qla8044_.patch b/patches.suse/scsi-qla2xxx-Fix-incorrectly-named-function-qla8044_.patch new file mode 100644 index 0000000..1de1e13 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-incorrectly-named-function-qla8044_.patch @@ -0,0 +1,35 @@ +From: Lee Jones +Date: Fri, 12 Mar 2021 09:47:18 +0000 +Subject: scsi: qla2xxx: Fix incorrectly named function qla8044_check_temp() +Patch-mainline: v5.13-rc1 +Git-commit: a736e44904422ade7af4ac50c64f58617ae4b7ba +References: bsc#1185491 + +Fixes the following W=1 kernel build warning(s): + + drivers/scsi/qla2xxx/qla_nx2.c:2038: warning: expecting prototype for qla4_8xxx_check_temp(). Prototype was for qla8044_check_temp() instead + +Link: https://lore.kernel.org/r/20210312094738.2207817-11-lee.jones@linaro.org +Cc: Nilesh Javali +Cc: GR-QLogic-Storage-Upstream@marvell.com +Cc: "James E.J. Bottomley" +Cc: "Martin K. Petersen" +Cc: linux-scsi@vger.kernel.org +Signed-off-by: Lee Jones +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_nx2.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_nx2.c ++++ b/drivers/scsi/qla2xxx/qla_nx2.c +@@ -2029,7 +2029,7 @@ qla8044_device_state_handler(struct scsi + } + + /** +- * qla4_8xxx_check_temp - Check the ISP82XX temperature. ++ * qla8044_check_temp - Check the ISP82XX temperature. + * @vha: adapter block pointer. + * + * Note: The caller should not hold the idc lock. diff --git a/patches.suse/scsi-qla2xxx-Fix-mailbox-Ch-erroneous-error.patch b/patches.suse/scsi-qla2xxx-Fix-mailbox-Ch-erroneous-error.patch new file mode 100644 index 0000000..076c57e --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-mailbox-Ch-erroneous-error.patch @@ -0,0 +1,46 @@ +From: Quinn Tran +Date: Mon, 11 Jan 2021 01:31:32 -0800 +Subject: scsi: qla2xxx: Fix mailbox Ch erroneous error +Patch-mainline: v5.12-rc1 +Git-commit: 044c218b04503858ca4e17f61899c8baa0ae9ba1 +References: bsc#1185491 + +Mailbox Ch/dump ram extend expects mb register 10 to be set. If not +set/clear, firmware can pick up garbage from previous invocation of this +mailbox. Example: mctp dump can set mb10. On subsequent flash read which +use mailbox cmd Ch, mb10 can retain previous value. + +Link: https://lore.kernel.org/r/20210111093134.1206-6-njavali@marvell.com +Cc: stable@vger.kernel.org +Reviewed-by: Himanshu Madhani +Signed-off-by: Quinn Tran +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_dbg.c | 1 + + drivers/scsi/qla2xxx/qla_mbx.c | 3 ++- + 2 files changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_dbg.c ++++ b/drivers/scsi/qla2xxx/qla_dbg.c +@@ -203,6 +203,7 @@ qla24xx_dump_ram(struct qla_hw_data *ha, + wrt_reg_word(®->mailbox0, MBC_DUMP_RISC_RAM_EXTENDED); + wrt_reg_word(®->mailbox1, LSW(addr)); + wrt_reg_word(®->mailbox8, MSW(addr)); ++ wrt_reg_word(®->mailbox10, 0); + + wrt_reg_word(®->mailbox2, MSW(LSD(dump_dma))); + wrt_reg_word(®->mailbox3, LSW(LSD(dump_dma))); +--- a/drivers/scsi/qla2xxx/qla_mbx.c ++++ b/drivers/scsi/qla2xxx/qla_mbx.c +@@ -4292,7 +4292,8 @@ qla2x00_dump_ram(scsi_qla_host_t *vha, d + if (MSW(addr) || IS_FWI2_CAPABLE(vha->hw)) { + mcp->mb[0] = MBC_DUMP_RISC_RAM_EXTENDED; + mcp->mb[8] = MSW(addr); +- mcp->out_mb = MBX_8|MBX_0; ++ mcp->mb[10] = 0; ++ mcp->out_mb = MBX_10|MBX_8|MBX_0; + } else { + mcp->mb[0] = MBC_DUMP_RISC_RAM; + mcp->out_mb = MBX_0; diff --git a/patches.suse/scsi-qla2xxx-Fix-mailbox-recovery-during-PCIe-error.patch b/patches.suse/scsi-qla2xxx-Fix-mailbox-recovery-during-PCIe-error.patch new file mode 100644 index 0000000..2e4850a --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-mailbox-recovery-during-PCIe-error.patch @@ -0,0 +1,126 @@ +From: Quinn Tran +Date: Mon, 29 Mar 2021 01:52:26 -0700 +Subject: scsi: qla2xxx: Fix mailbox recovery during PCIe error +Patch-mainline: v5.13-rc1 +Git-commit: daafc8d33ff62009e52225106f1a6c20fe1b6ccd +References: bsc#1185491 + +For the mailbox thread that encounters a PCIe error, pause that thread +until PCIe link reset/recovery has completed to prevent the thread from +possibly unmapping any type of DMA resource that might be in progress. + +Link: https://lore.kernel.org/r/20210329085229.4367-10-njavali@marvell.com +Tested-by: Laurence Oberman +Reviewed-by: Himanshu Madhani +Signed-off-by: Quinn Tran +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_mbx.c | 39 ++++++++++++++++++++++++++++++--------- + 1 file changed, 30 insertions(+), 9 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_mbx.c ++++ b/drivers/scsi/qla2xxx/qla_mbx.c +@@ -103,7 +103,7 @@ qla2x00_mailbox_command(scsi_qla_host_t + int rval, i; + unsigned long flags = 0; + device_reg_t *reg; +- uint8_t abort_active; ++ uint8_t abort_active, eeh_delay; + uint8_t io_lock_on; + uint16_t command = 0; + uint16_t *iptr; +@@ -137,7 +137,7 @@ qla2x00_mailbox_command(scsi_qla_host_t + "PCI error, exiting.\n"); + return QLA_FUNCTION_TIMEOUT; + } +- ++ eeh_delay = 0; + reg = ha->iobase; + io_lock_on = base_vha->flags.init_done; + +@@ -160,11 +160,10 @@ qla2x00_mailbox_command(scsi_qla_host_t + } + + /* check if ISP abort is active and return cmd with timeout */ +- if ((test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || +- test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || +- test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) || +- ha->flags.eeh_busy) && +- !is_rom_cmd(mcp->mb[0])) { ++ if (((test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || ++ test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || ++ test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) && ++ !is_rom_cmd(mcp->mb[0])) || ha->flags.eeh_busy) { + ql_log(ql_log_info, vha, 0x1005, + "Cmd 0x%x aborted with timeout since ISP Abort is pending\n", + mcp->mb[0]); +@@ -187,7 +186,11 @@ qla2x00_mailbox_command(scsi_qla_host_t + return QLA_FUNCTION_TIMEOUT; + } + atomic_dec(&ha->num_pend_mbx_stage1); +- if (ha->flags.purge_mbox || chip_reset != ha->chip_reset) { ++ if (ha->flags.purge_mbox || chip_reset != ha->chip_reset || ++ ha->flags.eeh_busy) { ++ ql_log(ql_log_warn, vha, 0xd035, ++ "Error detected: purge[%d] eeh[%d] cmd=0x%x, Exiting.\n", ++ ha->flags.purge_mbox, ha->flags.eeh_busy, mcp->mb[0]); + rval = QLA_ABORTED; + goto premature_exit; + } +@@ -267,6 +270,8 @@ qla2x00_mailbox_command(scsi_qla_host_t + if (!wait_for_completion_timeout(&ha->mbx_intr_comp, + mcp->tov * HZ)) { + if (chip_reset != ha->chip_reset) { ++ eeh_delay = ha->flags.eeh_busy ? 1 : 0; ++ + spin_lock_irqsave(&ha->hardware_lock, flags); + ha->flags.mbox_busy = 0; + spin_unlock_irqrestore(&ha->hardware_lock, +@@ -284,6 +289,8 @@ qla2x00_mailbox_command(scsi_qla_host_t + + } else if (ha->flags.purge_mbox || + chip_reset != ha->chip_reset) { ++ eeh_delay = ha->flags.eeh_busy ? 1 : 0; ++ + spin_lock_irqsave(&ha->hardware_lock, flags); + ha->flags.mbox_busy = 0; + spin_unlock_irqrestore(&ha->hardware_lock, flags); +@@ -325,6 +332,8 @@ qla2x00_mailbox_command(scsi_qla_host_t + while (!ha->flags.mbox_int) { + if (ha->flags.purge_mbox || + chip_reset != ha->chip_reset) { ++ eeh_delay = ha->flags.eeh_busy ? 1 : 0; ++ + spin_lock_irqsave(&ha->hardware_lock, flags); + ha->flags.mbox_busy = 0; + spin_unlock_irqrestore(&ha->hardware_lock, +@@ -533,7 +542,8 @@ qla2x00_mailbox_command(scsi_qla_host_t + clear_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); + /* Allow next mbx cmd to come in. */ + complete(&ha->mbx_cmd_comp); +- if (ha->isp_ops->abort_isp(vha)) { ++ if (ha->isp_ops->abort_isp(vha) && ++ !ha->flags.eeh_busy) { + /* Failed. retry later. */ + set_bit(ISP_ABORT_NEEDED, + &vha->dpc_flags); +@@ -586,6 +596,17 @@ qla2x00_mailbox_command(scsi_qla_host_t + ql_dbg(ql_dbg_mbx, base_vha, 0x1021, "Done %s.\n", __func__); + } + ++ i = 500; ++ while (i && eeh_delay && (ha->pci_error_state < QLA_PCI_SLOT_RESET)) { ++ /* ++ * The caller of this mailbox encounter pci error. ++ * Hold the thread until PCIE link reset complete to make ++ * sure caller does not unmap dma while recovery is ++ * in progress. ++ */ ++ msleep(1); ++ i--; ++ } + return rval; + } + diff --git a/patches.suse/scsi-qla2xxx-Fix-some-incorrect-formatting-spelling-.patch b/patches.suse/scsi-qla2xxx-Fix-some-incorrect-formatting-spelling-.patch new file mode 100644 index 0000000..5f30bde --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-some-incorrect-formatting-spelling-.patch @@ -0,0 +1,76 @@ +From: Lee Jones +Date: Wed, 3 Mar 2021 14:46:24 +0000 +Subject: scsi: qla2xxx: Fix some incorrect formatting/spelling issues +Patch-mainline: v5.13-rc1 +Git-commit: f11c8b42423f3b32c30bd985333e7378226b832d +References: bsc#1185491 + +Fixes the following W=1 kernel build warning(s): + + drivers/scsi/qla2xxx/qla_gs.c:1259: warning: expecting prototype for qla2x00_snd_rft_id(). Prototype was for qla2x00_sns_rft_id() instead + drivers/scsi/qla2xxx/qla_gs.c:1492: warning: expecting prototype for qla2x00_prep_ct_req(). Prototype was for qla2x00_prep_ct_fdmi_req() instead + drivers/scsi/qla2xxx/qla_gs.c:1596: warning: expecting prototype for perform HBA attributes registration(). Prototype was for qla2x00_hba_attributes() instead + drivers/scsi/qla2xxx/qla_gs.c:1851: warning: expecting prototype for perform Port attributes registration(). Prototype was for qla2x00_port_attributes() instead + drivers/scsi/qla2xxx/qla_gs.c:2284: warning: expecting prototype for perform RPRT registration(). Prototype was for qla2x00_fdmi_rprt() instead + +Link: https://lore.kernel.org/r/20210303144631.3175331-24-lee.jones@linaro.org +Cc: Nilesh Javali +Cc: GR-QLogic-Storage-Upstream@marvell.com +Cc: "James E.J. Bottomley" +Cc: "Martin K. Petersen" +Cc: linux-scsi@vger.kernel.org +Acked-by: Nilesh Javali +Signed-off-by: Lee Jones +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_gs.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_gs.c ++++ b/drivers/scsi/qla2xxx/qla_gs.c +@@ -1248,7 +1248,7 @@ qla2x00_sns_gnn_id(scsi_qla_host_t *vha, + } + + /** +- * qla2x00_snd_rft_id() - SNS Register FC-4 TYPEs (RFT_ID) supported by the HBA. ++ * qla2x00_sns_rft_id() - SNS Register FC-4 TYPEs (RFT_ID) supported by the HBA. + * @vha: HA context + * + * This command uses the old Exectute SNS Command mailbox routine. +@@ -1480,7 +1480,7 @@ qla2x00_update_ms_fdmi_iocb(scsi_qla_hos + } + + /** +- * qla2x00_prep_ct_req() - Prepare common CT request fields for SNS query. ++ * qla2x00_prep_ct_fdmi_req() - Prepare common CT request fields for SNS query. + * @p: CT request buffer + * @cmd: GS command + * @rsp_size: response size in bytes +@@ -1583,7 +1583,7 @@ qla25xx_fdmi_port_speed_currently(struct + } + + /** +- * qla2x00_hba_attributes() perform HBA attributes registration ++ * qla2x00_hba_attributes() - perform HBA attributes registration + * @vha: HA context + * @entries: number of entries to use + * @callopt: Option to issue extended or standard FDMI +@@ -1838,7 +1838,7 @@ qla2x00_hba_attributes(scsi_qla_host_t * + } + + /** +- * qla2x00_port_attributes() perform Port attributes registration ++ * qla2x00_port_attributes() - perform Port attributes registration + * @vha: HA context + * @entries: number of entries to use + * @callopt: Option to issue extended or standard FDMI +@@ -2273,7 +2273,7 @@ qla2x00_fdmi_dhba(scsi_qla_host_t *vha) + } + + /** +- * qla2x00_fdmi_rprt() perform RPRT registration ++ * qla2x00_fdmi_rprt() - perform RPRT registration + * @vha: HA context + * @callopt: Option to issue extended or standard FDMI + * command parameter diff --git a/patches.suse/scsi-qla2xxx-Fix-some-memory-corruption.patch b/patches.suse/scsi-qla2xxx-Fix-some-memory-corruption.patch new file mode 100644 index 0000000..683d471 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-some-memory-corruption.patch @@ -0,0 +1,31 @@ +From: Dan Carpenter +Date: Mon, 25 Jan 2021 11:44:02 +0300 +Subject: scsi: qla2xxx: Fix some memory corruption +Patch-mainline: v5.12-rc1 +Git-commit: bc2b4e68023174e508a4a9605384a7fda475f8a8 +References: bsc#1185491 + +This was supposed to be "data" instead of "&data". The current code will +corrupt the stack. + +Link: https://lore.kernel.org/r/YA6E0geUlL9Hs04A@mwanda +Fixes: dbf1f53cfd23 ("scsi: qla2xxx: Implementation to get and manage host, target stats and initiator port") +Acked-by: Saurav Kashyap +Signed-off-by: Dan Carpenter +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_bsg.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_bsg.c ++++ b/drivers/scsi/qla2xxx/qla_bsg.c +@@ -2668,7 +2668,7 @@ qla2x00_get_tgt_stats(struct bsg_job *bs + + bsg_reply->reply_payload_rcv_len = + sg_copy_from_buffer(bsg_job->reply_payload.sg_list, +- bsg_job->reply_payload.sg_cnt, &data, ++ bsg_job->reply_payload.sg_cnt, data, + sizeof(struct ql_vnd_tgt_stats_resp)); + + bsg_reply->result = DID_OK; diff --git a/patches.suse/scsi-qla2xxx-Fix-stuck-session.patch b/patches.suse/scsi-qla2xxx-Fix-stuck-session.patch new file mode 100644 index 0000000..4ec558c --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-stuck-session.patch @@ -0,0 +1,48 @@ +From: Quinn Tran +Date: Mon, 29 Mar 2021 01:52:20 -0700 +Subject: scsi: qla2xxx: Fix stuck session +Patch-mainline: v5.13-rc1 +Git-commit: c358a3d92b32be89ea1c44fe75721448c0a0fec1 +References: bsc#1185491 + +Session was stuck due to explicit logout to target timing out. The target +was in an unresponsive state. This timeout induced an error to the GNL +command from moving forward. + +Link: https://lore.kernel.org/r/20210329085229.4367-4-njavali@marvell.com +Tested-by: Laurence Oberman +Signed-off-by: Quinn Tran +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_init.c | 1 + + drivers/scsi/qla2xxx/qla_target.c | 7 ++++++- + 2 files changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -719,6 +719,7 @@ static void qla24xx_handle_gnl_done_even + ql_dbg(ql_dbg_disc, vha, 0x20e0, + "%s %8phC login gen changed\n", + __func__, fcport->port_name); ++ set_bit(RELOGIN_NEEDED, &vha->dpc_flags); + return; + } + +--- a/drivers/scsi/qla2xxx/qla_target.c ++++ b/drivers/scsi/qla2xxx/qla_target.c +@@ -1029,7 +1029,12 @@ void qlt_free_session_done(struct work_s + } + msleep(100); + cnt++; +- if (cnt > 200) ++ /* ++ * Driver timeout is set to 22 Sec, update count value to loop ++ * long enough for log-out to complete before advancing. Otherwise, ++ * straddling logout can interfere with re-login attempt. ++ */ ++ if (cnt > 230) + break; + } + diff --git a/patches.suse/scsi-qla2xxx-Fix-use-after-free-in-bsg.patch b/patches.suse/scsi-qla2xxx-Fix-use-after-free-in-bsg.patch new file mode 100644 index 0000000..8ad1116 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-use-after-free-in-bsg.patch @@ -0,0 +1,54 @@ +From: Quinn Tran +Date: Mon, 29 Mar 2021 01:52:22 -0700 +Subject: scsi: qla2xxx: Fix use after free in bsg +Patch-mainline: v5.13-rc1 +Git-commit: 2ce35c0821afc2acd5ee1c3f60d149f8b2520ce8 +References: bsc#1185491 + +On bsg command completion, bsg_job_done() was called while qla driver +continued to access the bsg_job buffer. bsg_job_done() would free up +resources that ended up being reused by other task while the driver +continued to access the buffers. As a result, driver was reading garbage +data. + +localhost kernel: BUG: KASAN: use-after-free in sg_next+0x64/0x80 +localhost kernel: Read of size 8 at addr ffff8883228a3330 by task swapper/26/0 +localhost kernel: +localhost kernel: CPU: 26 PID: 0 Comm: swapper/26 Kdump: +loaded Tainted: G OE --------- - - 4.18.0-193.el8.x86_64+debug #1 +localhost kernel: Hardware name: HP ProLiant DL360 +Gen9/ProLiant DL360 Gen9, BIOS P89 08/12/2016 +localhost kernel: Call Trace: +localhost kernel: +localhost kernel: dump_stack+0x9a/0xf0 +localhost kernel: print_address_description.cold.3+0x9/0x23b +localhost kernel: kasan_report.cold.4+0x65/0x95 +localhost kernel: debug_dma_unmap_sg.part.12+0x10d/0x2d0 +localhost kernel: qla2x00_bsg_sp_free+0xaf6/0x1010 [qla2xxx] + +Link: https://lore.kernel.org/r/20210329085229.4367-6-njavali@marvell.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Quinn Tran +Signed-off-by: Saurav Kashyap +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_bsg.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_bsg.c ++++ b/drivers/scsi/qla2xxx/qla_bsg.c +@@ -26,10 +26,11 @@ void qla2x00_bsg_job_done(srb_t *sp, int + struct bsg_job *bsg_job = sp->u.bsg_job; + struct fc_bsg_reply *bsg_reply = bsg_job->reply; + ++ sp->free(sp); ++ + bsg_reply->result = res; + bsg_job_done(bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len); +- sp->free(sp); + } + + void qla2x00_bsg_sp_free(srb_t *sp) diff --git a/patches.suse/scsi-qla2xxx-Implementation-to-get-and-manage-host-t.patch b/patches.suse/scsi-qla2xxx-Implementation-to-get-and-manage-host-t.patch new file mode 100644 index 0000000..7bb5803 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Implementation-to-get-and-manage-host-t.patch @@ -0,0 +1,1100 @@ +From: Saurav Kashyap +Date: Mon, 11 Jan 2021 01:31:28 -0800 +Subject: scsi: qla2xxx: Implementation to get and manage host, target stats + and initiator port +Patch-mainline: v5.12-rc1 +Git-commit: dbf1f53cfd238090c69f92725b91208b97eb53fe +References: bsc#1185491 + +This statistics will help in debugging process and checking specific error +counts. It also provides a capability to isolate the port or bring it out +of isolation. + +Link: https://lore.kernel.org/r/20210111093134.1206-2-njavali@marvell.com +Reported-by: kernel test robot +Reviewed-by: Himanshu Madhani +Signed-off-by: Saurav Kashyap +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_attr.c | 9 + + drivers/scsi/qla2xxx/qla_bsg.c | 342 ++++++++++++++++++++++++++++++++++++++++ + drivers/scsi/qla2xxx/qla_bsg.h | 5 + drivers/scsi/qla2xxx/qla_def.h | 71 ++++++++ + drivers/scsi/qla2xxx/qla_gbl.h | 23 ++ + drivers/scsi/qla2xxx/qla_gs.c | 1 + drivers/scsi/qla2xxx/qla_init.c | 216 +++++++++++++++++++++++++ + drivers/scsi/qla2xxx/qla_isr.c | 22 ++ + drivers/scsi/qla2xxx/qla_mbx.c | 9 + + drivers/scsi/qla2xxx/qla_os.c | 20 ++ + 10 files changed, 718 insertions(+) + +--- a/drivers/scsi/qla2xxx/qla_attr.c ++++ b/drivers/scsi/qla2xxx/qla_attr.c +@@ -711,6 +711,12 @@ qla2x00_sysfs_write_reset(struct file *f + ql_log(ql_log_info, vha, 0x706e, + "Issuing ISP reset.\n"); + ++ if (vha->hw->flags.port_isolated) { ++ ql_log(ql_log_info, vha, 0x706e, ++ "Port is isolated, returning.\n"); ++ return -EINVAL; ++ } ++ + scsi_block_requests(vha->host); + if (IS_QLA82XX(ha)) { + ha->flags.isp82xx_no_md_cap = 1; +@@ -2718,6 +2724,9 @@ qla2x00_issue_lip(struct Scsi_Host *shos + if (IS_QLAFX00(vha->hw)) + return 0; + ++ if (vha->hw->flags.port_isolated) ++ return 0; ++ + qla2x00_loop_reset(vha); + return 0; + } +--- a/drivers/scsi/qla2xxx/qla_bsg.c ++++ b/drivers/scsi/qla2xxx/qla_bsg.c +@@ -5,6 +5,7 @@ + * See LICENSE.qla2xxx for copyright and licensing details. + */ + #include "qla_def.h" ++#include "qla_gbl.h" + + #include + #include +@@ -2446,6 +2447,323 @@ qla2x00_get_flash_image_status(struct bs + } + + static int ++qla2x00_manage_host_stats(struct bsg_job *bsg_job) ++{ ++ scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job)); ++ struct fc_bsg_reply *bsg_reply = bsg_job->reply; ++ struct ql_vnd_mng_host_stats_param *req_data; ++ struct ql_vnd_mng_host_stats_resp rsp_data; ++ u32 req_data_len; ++ int ret = 0; ++ ++ if (!vha->flags.online) { ++ ql_log(ql_log_warn, vha, 0x0000, "Host is not online.\n"); ++ return -EIO; ++ } ++ ++ req_data_len = bsg_job->request_payload.payload_len; ++ ++ if (req_data_len != sizeof(struct ql_vnd_mng_host_stats_param)) { ++ ql_log(ql_log_warn, vha, 0x0000, "req_data_len invalid.\n"); ++ return -EIO; ++ } ++ ++ req_data = kzalloc(sizeof(*req_data), GFP_KERNEL); ++ if (!req_data) { ++ ql_log(ql_log_warn, vha, 0x0000, "req_data memory allocation failure.\n"); ++ return -ENOMEM; ++ } ++ ++ /* Copy the request buffer in req_data */ ++ sg_copy_to_buffer(bsg_job->request_payload.sg_list, ++ bsg_job->request_payload.sg_cnt, req_data, ++ req_data_len); ++ ++ switch (req_data->action) { ++ case QLA_STOP: ++ ret = qla2xxx_stop_stats(vha->host, req_data->stat_type); ++ break; ++ case QLA_START: ++ ret = qla2xxx_start_stats(vha->host, req_data->stat_type); ++ break; ++ case QLA_CLEAR: ++ ret = qla2xxx_reset_stats(vha->host, req_data->stat_type); ++ break; ++ default: ++ ql_log(ql_log_warn, vha, 0x0000, "Invalid action.\n"); ++ ret = -EIO; ++ break; ++ } ++ ++ kfree(req_data); ++ ++ /* Prepare response */ ++ rsp_data.status = ret; ++ bsg_job->reply_payload.payload_len = sizeof(struct ql_vnd_mng_host_stats_resp); ++ ++ bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK; ++ bsg_reply->reply_payload_rcv_len = ++ sg_copy_from_buffer(bsg_job->reply_payload.sg_list, ++ bsg_job->reply_payload.sg_cnt, ++ &rsp_data, ++ sizeof(struct ql_vnd_mng_host_stats_resp)); ++ ++ bsg_reply->result = DID_OK; ++ bsg_job_done(bsg_job, bsg_reply->result, ++ bsg_reply->reply_payload_rcv_len); ++ ++ return ret; ++} ++ ++static int ++qla2x00_get_host_stats(struct bsg_job *bsg_job) ++{ ++ scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job)); ++ struct fc_bsg_reply *bsg_reply = bsg_job->reply; ++ struct ql_vnd_stats_param *req_data; ++ struct ql_vnd_host_stats_resp rsp_data; ++ u32 req_data_len; ++ int ret = 0; ++ u64 ini_entry_count = 0; ++ u64 entry_count = 0; ++ u64 tgt_num = 0; ++ u64 tmp_stat_type = 0; ++ u64 response_len = 0; ++ void *data; ++ ++ req_data_len = bsg_job->request_payload.payload_len; ++ ++ if (req_data_len != sizeof(struct ql_vnd_stats_param)) { ++ ql_log(ql_log_warn, vha, 0x0000, "req_data_len invalid.\n"); ++ return -EIO; ++ } ++ ++ req_data = kzalloc(sizeof(*req_data), GFP_KERNEL); ++ if (!req_data) { ++ ql_log(ql_log_warn, vha, 0x0000, "req_data memory allocation failure.\n"); ++ return -ENOMEM; ++ } ++ ++ /* Copy the request buffer in req_data */ ++ sg_copy_to_buffer(bsg_job->request_payload.sg_list, ++ bsg_job->request_payload.sg_cnt, req_data, req_data_len); ++ ++ /* Copy stat type to work on it */ ++ tmp_stat_type = req_data->stat_type; ++ ++ if (tmp_stat_type & QLA2XX_TGT_SHT_LNK_DOWN) { ++ /* Num of tgts connected to this host */ ++ tgt_num = qla2x00_get_num_tgts(vha); ++ /* unset BIT_17 */ ++ tmp_stat_type &= ~(1 << 17); ++ } ++ ++ /* Total ini stats */ ++ ini_entry_count = qla2x00_count_set_bits(tmp_stat_type); ++ ++ /* Total number of entries */ ++ entry_count = ini_entry_count + tgt_num; ++ ++ response_len = sizeof(struct ql_vnd_host_stats_resp) + ++ (sizeof(struct ql_vnd_stat_entry) * entry_count); ++ ++ if (response_len > bsg_job->reply_payload.payload_len) { ++ rsp_data.status = EXT_STATUS_BUFFER_TOO_SMALL; ++ bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_BUFFER_TOO_SMALL; ++ bsg_job->reply_payload.payload_len = sizeof(struct ql_vnd_mng_host_stats_resp); ++ ++ bsg_reply->reply_payload_rcv_len = ++ sg_copy_from_buffer(bsg_job->reply_payload.sg_list, ++ bsg_job->reply_payload.sg_cnt, &rsp_data, ++ sizeof(struct ql_vnd_mng_host_stats_resp)); ++ ++ bsg_reply->result = DID_OK; ++ bsg_job_done(bsg_job, bsg_reply->result, ++ bsg_reply->reply_payload_rcv_len); ++ goto host_stat_out; ++ } ++ ++ data = kzalloc(response_len, GFP_KERNEL); ++ ++ ret = qla2xxx_get_ini_stats(fc_bsg_to_shost(bsg_job), req_data->stat_type, ++ data, response_len); ++ ++ rsp_data.status = EXT_STATUS_OK; ++ bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK; ++ ++ bsg_reply->reply_payload_rcv_len = sg_copy_from_buffer(bsg_job->reply_payload.sg_list, ++ bsg_job->reply_payload.sg_cnt, ++ data, response_len); ++ bsg_reply->result = DID_OK; ++ bsg_job_done(bsg_job, bsg_reply->result, ++ bsg_reply->reply_payload_rcv_len); ++ ++ kfree(data); ++host_stat_out: ++ kfree(req_data); ++ return ret; ++} ++ ++static struct fc_rport * ++qla2xxx_find_rport(scsi_qla_host_t *vha, uint32_t tgt_num) ++{ ++ fc_port_t *fcport = NULL; ++ ++ list_for_each_entry(fcport, &vha->vp_fcports, list) { ++ if (fcport->rport->number == tgt_num) ++ return fcport->rport; ++ } ++ return NULL; ++} ++ ++static int ++qla2x00_get_tgt_stats(struct bsg_job *bsg_job) ++{ ++ scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job)); ++ struct fc_bsg_reply *bsg_reply = bsg_job->reply; ++ struct ql_vnd_tgt_stats_param *req_data; ++ u32 req_data_len; ++ int ret = 0; ++ u64 response_len = 0; ++ struct ql_vnd_tgt_stats_resp *data = NULL; ++ struct fc_rport *rport = NULL; ++ ++ if (!vha->flags.online) { ++ ql_log(ql_log_warn, vha, 0x0000, "Host is not online.\n"); ++ return -EIO; ++ } ++ ++ req_data_len = bsg_job->request_payload.payload_len; ++ ++ if (req_data_len != sizeof(struct ql_vnd_stat_entry)) { ++ ql_log(ql_log_warn, vha, 0x0000, "req_data_len invalid.\n"); ++ return -EIO; ++ } ++ ++ req_data = kzalloc(sizeof(*req_data), GFP_KERNEL); ++ if (!req_data) { ++ ql_log(ql_log_warn, vha, 0x0000, "req_data memory allocation failure.\n"); ++ return -ENOMEM; ++ } ++ ++ /* Copy the request buffer in req_data */ ++ sg_copy_to_buffer(bsg_job->request_payload.sg_list, ++ bsg_job->request_payload.sg_cnt, ++ req_data, req_data_len); ++ ++ response_len = sizeof(struct ql_vnd_tgt_stats_resp) + ++ sizeof(struct ql_vnd_stat_entry); ++ ++ /* structure + size for one entry */ ++ data = kzalloc(response_len, GFP_KERNEL); ++ if (!data) { ++ kfree(req_data); ++ return -ENOMEM; ++ } ++ ++ if (response_len > bsg_job->reply_payload.payload_len) { ++ data->status = EXT_STATUS_BUFFER_TOO_SMALL; ++ bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_BUFFER_TOO_SMALL; ++ bsg_job->reply_payload.payload_len = sizeof(struct ql_vnd_mng_host_stats_resp); ++ ++ bsg_reply->reply_payload_rcv_len = ++ sg_copy_from_buffer(bsg_job->reply_payload.sg_list, ++ bsg_job->reply_payload.sg_cnt, &data, ++ sizeof(struct ql_vnd_tgt_stats_resp)); ++ ++ bsg_reply->result = DID_OK; ++ bsg_job_done(bsg_job, bsg_reply->result, ++ bsg_reply->reply_payload_rcv_len); ++ goto tgt_stat_out; ++ } ++ ++ rport = qla2xxx_find_rport(vha, req_data->tgt_id); ++ if (!rport) { ++ ql_log(ql_log_warn, vha, 0x0000, "target %d not found.\n", req_data->tgt_id); ++ ret = EXT_STATUS_INVALID_PARAM; ++ data->status = EXT_STATUS_INVALID_PARAM; ++ goto reply; ++ } ++ ++ ret = qla2xxx_get_tgt_stats(fc_bsg_to_shost(bsg_job), req_data->stat_type, ++ rport, (void *)data, response_len); ++ ++ bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK; ++reply: ++ bsg_reply->reply_payload_rcv_len = ++ sg_copy_from_buffer(bsg_job->reply_payload.sg_list, ++ bsg_job->reply_payload.sg_cnt, data, ++ response_len); ++ bsg_reply->result = DID_OK; ++ bsg_job_done(bsg_job, bsg_reply->result, ++ bsg_reply->reply_payload_rcv_len); ++ ++tgt_stat_out: ++ kfree(data); ++ kfree(req_data); ++ ++ return ret; ++} ++ ++static int ++qla2x00_manage_host_port(struct bsg_job *bsg_job) ++{ ++ scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job)); ++ struct fc_bsg_reply *bsg_reply = bsg_job->reply; ++ struct ql_vnd_mng_host_port_param *req_data; ++ struct ql_vnd_mng_host_port_resp rsp_data; ++ u32 req_data_len; ++ int ret = 0; ++ ++ req_data_len = bsg_job->request_payload.payload_len; ++ ++ if (req_data_len != sizeof(struct ql_vnd_mng_host_port_param)) { ++ ql_log(ql_log_warn, vha, 0x0000, "req_data_len invalid.\n"); ++ return -EIO; ++ } ++ ++ req_data = kzalloc(sizeof(*req_data), GFP_KERNEL); ++ if (!req_data) { ++ ql_log(ql_log_warn, vha, 0x0000, "req_data memory allocation failure.\n"); ++ return -ENOMEM; ++ } ++ ++ /* Copy the request buffer in req_data */ ++ sg_copy_to_buffer(bsg_job->request_payload.sg_list, ++ bsg_job->request_payload.sg_cnt, req_data, req_data_len); ++ ++ switch (req_data->action) { ++ case QLA_ENABLE: ++ ret = qla2xxx_enable_port(vha->host); ++ break; ++ case QLA_DISABLE: ++ ret = qla2xxx_disable_port(vha->host); ++ break; ++ default: ++ ql_log(ql_log_warn, vha, 0x0000, "Invalid action.\n"); ++ ret = -EIO; ++ break; ++ } ++ ++ kfree(req_data); ++ ++ /* Prepare response */ ++ rsp_data.status = ret; ++ bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK; ++ bsg_job->reply_payload.payload_len = sizeof(struct ql_vnd_mng_host_port_resp); ++ ++ bsg_reply->reply_payload_rcv_len = ++ sg_copy_from_buffer(bsg_job->reply_payload.sg_list, ++ bsg_job->reply_payload.sg_cnt, &rsp_data, ++ sizeof(struct ql_vnd_mng_host_port_resp)); ++ bsg_reply->result = DID_OK; ++ bsg_job_done(bsg_job, bsg_reply->result, ++ bsg_reply->reply_payload_rcv_len); ++ ++ return ret; ++} ++ ++static int + qla2x00_process_vendor_specific(struct bsg_job *bsg_job) + { + struct fc_bsg_request *bsg_request = bsg_job->request; +@@ -2521,6 +2839,18 @@ qla2x00_process_vendor_specific(struct b + case QL_VND_SS_GET_FLASH_IMAGE_STATUS: + return qla2x00_get_flash_image_status(bsg_job); + ++ case QL_VND_MANAGE_HOST_STATS: ++ return qla2x00_manage_host_stats(bsg_job); ++ ++ case QL_VND_GET_HOST_STATS: ++ return qla2x00_get_host_stats(bsg_job); ++ ++ case QL_VND_GET_TGT_STATS: ++ return qla2x00_get_tgt_stats(bsg_job); ++ ++ case QL_VND_MANAGE_HOST_PORT: ++ return qla2x00_manage_host_port(bsg_job); ++ + default: + return -ENOSYS; + } +@@ -2548,6 +2878,17 @@ qla24xx_bsg_request(struct bsg_job *bsg_ + vha = shost_priv(host); + } + ++ /* Disable port will bring down the chip, allow enable command */ ++ if (bsg_request->rqst_data.h_vendor.vendor_cmd[0] == QL_VND_MANAGE_HOST_PORT || ++ bsg_request->rqst_data.h_vendor.vendor_cmd[0] == QL_VND_GET_HOST_STATS) ++ goto skip_chip_chk; ++ ++ if (vha->hw->flags.port_isolated) { ++ bsg_reply->result = DID_ERROR; ++ /* operation not permitted */ ++ return -EPERM; ++ } ++ + if (qla2x00_chip_is_down(vha)) { + ql_dbg(ql_dbg_user, vha, 0x709f, + "BSG: ISP abort active/needed -- cmd=%d.\n", +@@ -2555,6 +2896,7 @@ qla24xx_bsg_request(struct bsg_job *bsg_ + return -EBUSY; + } + ++skip_chip_chk: + ql_dbg(ql_dbg_user, vha, 0x7000, + "Entered %s msgcode=0x%x.\n", __func__, bsg_request->msgcode); + +--- a/drivers/scsi/qla2xxx/qla_bsg.h ++++ b/drivers/scsi/qla2xxx/qla_bsg.h +@@ -32,6 +32,10 @@ + #define QL_VND_DPORT_DIAGNOSTICS 0x19 + #define QL_VND_GET_PRIV_STATS_EX 0x1A + #define QL_VND_SS_GET_FLASH_IMAGE_STATUS 0x1E ++#define QL_VND_MANAGE_HOST_STATS 0x23 ++#define QL_VND_GET_HOST_STATS 0x24 ++#define QL_VND_GET_TGT_STATS 0x25 ++#define QL_VND_MANAGE_HOST_PORT 0x26 + + /* BSG Vendor specific subcode returns */ + #define EXT_STATUS_OK 0 +@@ -41,6 +45,7 @@ + #define EXT_STATUS_DATA_OVERRUN 7 + #define EXT_STATUS_DATA_UNDERRUN 8 + #define EXT_STATUS_MAILBOX 11 ++#define EXT_STATUS_BUFFER_TOO_SMALL 16 + #define EXT_STATUS_NO_MEMORY 17 + #define EXT_STATUS_DEVICE_OFFLINE 22 + +--- a/drivers/scsi/qla2xxx/qla_def.h ++++ b/drivers/scsi/qla2xxx/qla_def.h +@@ -2558,6 +2558,10 @@ typedef struct fc_port { + u16 n2n_chip_reset; + + struct dentry *dfs_rport_dir; ++ ++ u64 tgt_short_link_down_cnt; ++ u64 tgt_link_down_time; ++ u64 dev_loss_tmo; + } fc_port_t; + + enum { +@@ -3923,6 +3927,7 @@ struct qla_hw_data { + uint32_t scm_enabled:1; + uint32_t max_req_queue_warned:1; + uint32_t plogi_template_valid:1; ++ uint32_t port_isolated:1; + } flags; + + uint16_t max_exchg; +@@ -4852,6 +4857,13 @@ typedef struct scsi_qla_host { + uint8_t scm_fabric_connection_flags; + + unsigned int irq_offset; ++ ++ u64 hw_err_cnt; ++ u64 interface_err_cnt; ++ u64 cmd_timeout_cnt; ++ u64 reset_cmd_err_cnt; ++ u64 link_down_time; ++ u64 short_link_down_cnt; + } scsi_qla_host_t; + + struct qla27xx_image_status { +@@ -5176,6 +5188,65 @@ struct sff_8247_a0 { + #define PRLI_PHASE(_cls) \ + ((_cls == DSC_LS_PRLI_PEND) || (_cls == DSC_LS_PRLI_COMP)) + ++enum ql_vnd_host_stat_action { ++ QLA_STOP = 0, ++ QLA_START, ++ QLA_CLEAR, ++}; ++ ++struct ql_vnd_mng_host_stats_param { ++ u32 stat_type; ++ enum ql_vnd_host_stat_action action; ++} __packed; ++ ++struct ql_vnd_mng_host_stats_resp { ++ u32 status; ++} __packed; ++ ++struct ql_vnd_stats_param { ++ u32 stat_type; ++} __packed; ++ ++struct ql_vnd_tgt_stats_param { ++ s32 tgt_id; ++ u32 stat_type; ++} __packed; ++ ++enum ql_vnd_host_port_action { ++ QLA_ENABLE = 0, ++ QLA_DISABLE, ++}; ++ ++struct ql_vnd_mng_host_port_param { ++ enum ql_vnd_host_port_action action; ++} __packed; ++ ++struct ql_vnd_mng_host_port_resp { ++ u32 status; ++} __packed; ++ ++struct ql_vnd_stat_entry { ++ u32 stat_type; /* Failure type */ ++ u32 tgt_num; /* Target Num */ ++ u64 cnt; /* Counter value */ ++} __packed; ++ ++struct ql_vnd_stats { ++ u64 entry_count; /* Num of entries */ ++ u64 rservd; ++ struct ql_vnd_stat_entry entry[0]; /* Place holder of entries */ ++} __packed; ++ ++struct ql_vnd_host_stats_resp { ++ u32 status; ++ struct ql_vnd_stats stats; ++} __packed; ++ ++struct ql_vnd_tgt_stats_resp { ++ u32 status; ++ struct ql_vnd_stats stats; ++} __packed; ++ + #include "qla_target.h" + #include "qla_gbl.h" + #include "qla_dbg.h" +--- a/drivers/scsi/qla2xxx/qla_gbl.h ++++ b/drivers/scsi/qla2xxx/qla_gbl.h +@@ -946,4 +946,27 @@ extern void qla2x00_dfs_remove_rport(scs + /* nvme.c */ + void qla_nvme_unregister_remote_port(struct fc_port *fcport); + void qla_handle_els_plogi_done(scsi_qla_host_t *vha, struct event_arg *ea); ++ ++#define QLA2XX_HW_ERROR BIT_0 ++#define QLA2XX_SHT_LNK_DWN BIT_1 ++#define QLA2XX_INT_ERR BIT_2 ++#define QLA2XX_CMD_TIMEOUT BIT_3 ++#define QLA2XX_RESET_CMD_ERR BIT_4 ++#define QLA2XX_TGT_SHT_LNK_DOWN BIT_17 ++ ++#define QLA2XX_MAX_LINK_DOWN_TIME 100 ++ ++int qla2xxx_start_stats(struct Scsi_Host *shost, u32 flags); ++int qla2xxx_stop_stats(struct Scsi_Host *shost, u32 flags); ++int qla2xxx_reset_stats(struct Scsi_Host *shost, u32 flags); ++ ++int qla2xxx_get_ini_stats(struct Scsi_Host *shost, u32 flags, void *data, u64 size); ++int qla2xxx_get_tgt_stats(struct Scsi_Host *shost, u32 flags, ++ struct fc_rport *rport, void *data, u64 size); ++int qla2xxx_disable_port(struct Scsi_Host *shost); ++int qla2xxx_enable_port(struct Scsi_Host *shost); ++ ++uint64_t qla2x00_get_num_tgts(scsi_qla_host_t *vha); ++uint64_t qla2x00_count_set_bits(u32 num); ++ + #endif /* _QLA_GBL_H */ +--- a/drivers/scsi/qla2xxx/qla_gs.c ++++ b/drivers/scsi/qla2xxx/qla_gs.c +@@ -3564,6 +3564,7 @@ void qla24xx_async_gnnft_done(scsi_qla_h + __func__, __LINE__, + fcport->port_name); + ++ fcport->tgt_link_down_time = 0; + qlt_schedule_sess_for_deletion(fcport); + continue; + } +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -4994,6 +4994,9 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vh + fcport->login_retry = vha->hw->login_retry_count; + fcport->chip_reset = vha->hw->base_qpair->chip_reset; + fcport->logout_on_delete = 1; ++ fcport->tgt_link_down_time = QLA2XX_MAX_LINK_DOWN_TIME; ++ fcport->tgt_short_link_down_cnt = 0; ++ fcport->dev_loss_tmo = 0; + + if (!fcport->ct_desc.ct_sns) { + ql_log(ql_log_warn, vha, 0xd049, +@@ -5491,6 +5494,7 @@ qla2x00_reg_remote_port(scsi_qla_host_t + spin_lock_irqsave(fcport->vha->host->host_lock, flags); + *((fc_port_t **)rport->dd_data) = fcport; + spin_unlock_irqrestore(fcport->vha->host->host_lock, flags); ++ fcport->dev_loss_tmo = rport->dev_loss_tmo; + + rport->supported_classes = fcport->supported_classes; + +@@ -5549,6 +5553,11 @@ qla2x00_update_fcport(scsi_qla_host_t *v + fcport->logout_on_delete = 1; + fcport->n2n_chip_reset = fcport->n2n_link_reset_cnt = 0; + ++ if (fcport->tgt_link_down_time < fcport->dev_loss_tmo) { ++ fcport->tgt_short_link_down_cnt++; ++ fcport->tgt_link_down_time = QLA2XX_MAX_LINK_DOWN_TIME; ++ } ++ + switch (vha->hw->current_topology) { + case ISP_CFG_N: + case ISP_CFG_NL: +@@ -6909,6 +6918,9 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) + if (vha->flags.online) { + qla2x00_abort_isp_cleanup(vha); + ++ if (vha->hw->flags.port_isolated) ++ return status; ++ + if (test_and_clear_bit(ISP_ABORT_TO_ROM, &vha->dpc_flags)) { + ha->flags.chip_reset_done = 1; + vha->flags.online = 1; +@@ -7030,6 +7042,11 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) + + } + ++ if (vha->hw->flags.port_isolated) { ++ qla2x00_abort_isp_cleanup(vha); ++ return status; ++ } ++ + if (!status) { + ql_dbg(ql_dbg_taskm, vha, 0x8022, "%s succeeded.\n", __func__); + qla2x00_configure_hba(vha); +@@ -9172,3 +9189,202 @@ int qla2xxx_delete_qpair(struct scsi_qla + fail: + return ret; + } ++ ++uint64_t ++qla2x00_count_set_bits(uint32_t num) ++{ ++ /* Brian Kernighan's Algorithm */ ++ u64 count = 0; ++ ++ while (num) { ++ num &= (num - 1); ++ count++; ++ } ++ return count; ++} ++ ++uint64_t ++qla2x00_get_num_tgts(scsi_qla_host_t *vha) ++{ ++ fc_port_t *f, *tf; ++ u64 count = 0; ++ ++ f = NULL; ++ tf = NULL; ++ ++ list_for_each_entry_safe(f, tf, &vha->vp_fcports, list) { ++ if (f->port_type != FCT_TARGET) ++ continue; ++ count++; ++ } ++ return count; ++} ++ ++int qla2xxx_reset_stats(struct Scsi_Host *host, u32 flags) ++{ ++ scsi_qla_host_t *vha = shost_priv(host); ++ fc_port_t *fcport = NULL; ++ unsigned long int_flags; ++ ++ if (flags & QLA2XX_HW_ERROR) ++ vha->hw_err_cnt = 0; ++ if (flags & QLA2XX_SHT_LNK_DWN) ++ vha->short_link_down_cnt = 0; ++ if (flags & QLA2XX_INT_ERR) ++ vha->interface_err_cnt = 0; ++ if (flags & QLA2XX_CMD_TIMEOUT) ++ vha->cmd_timeout_cnt = 0; ++ if (flags & QLA2XX_RESET_CMD_ERR) ++ vha->reset_cmd_err_cnt = 0; ++ if (flags & QLA2XX_TGT_SHT_LNK_DOWN) { ++ spin_lock_irqsave(&vha->hw->tgt.sess_lock, int_flags); ++ list_for_each_entry(fcport, &vha->vp_fcports, list) { ++ fcport->tgt_short_link_down_cnt = 0; ++ fcport->tgt_link_down_time = QLA2XX_MAX_LINK_DOWN_TIME; ++ } ++ spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, int_flags); ++ } ++ vha->link_down_time = QLA2XX_MAX_LINK_DOWN_TIME; ++ return 0; ++} ++ ++int qla2xxx_start_stats(struct Scsi_Host *host, u32 flags) ++{ ++ return qla2xxx_reset_stats(host, flags); ++} ++ ++int qla2xxx_stop_stats(struct Scsi_Host *host, u32 flags) ++{ ++ return qla2xxx_reset_stats(host, flags); ++} ++ ++int qla2xxx_get_ini_stats(struct Scsi_Host *host, u32 flags, ++ void *data, u64 size) ++{ ++ scsi_qla_host_t *vha = shost_priv(host); ++ struct ql_vnd_host_stats_resp *resp = (struct ql_vnd_host_stats_resp *)data; ++ struct ql_vnd_stats *rsp_data = &resp->stats; ++ u64 ini_entry_count = 0; ++ u64 i = 0; ++ u64 entry_count = 0; ++ u64 num_tgt = 0; ++ u32 tmp_stat_type = 0; ++ fc_port_t *fcport = NULL; ++ unsigned long int_flags; ++ ++ /* Copy stat type to work on it */ ++ tmp_stat_type = flags; ++ ++ if (tmp_stat_type & BIT_17) { ++ num_tgt = qla2x00_get_num_tgts(vha); ++ /* unset BIT_17 */ ++ tmp_stat_type &= ~(1 << 17); ++ } ++ ini_entry_count = qla2x00_count_set_bits(tmp_stat_type); ++ ++ entry_count = ini_entry_count + num_tgt; ++ ++ rsp_data->entry_count = entry_count; ++ ++ i = 0; ++ if (flags & QLA2XX_HW_ERROR) { ++ rsp_data->entry[i].stat_type = QLA2XX_HW_ERROR; ++ rsp_data->entry[i].tgt_num = 0x0; ++ rsp_data->entry[i].cnt = vha->hw_err_cnt; ++ i++; ++ } ++ ++ if (flags & QLA2XX_SHT_LNK_DWN) { ++ rsp_data->entry[i].stat_type = QLA2XX_SHT_LNK_DWN; ++ rsp_data->entry[i].tgt_num = 0x0; ++ rsp_data->entry[i].cnt = vha->short_link_down_cnt; ++ i++; ++ } ++ ++ if (flags & QLA2XX_INT_ERR) { ++ rsp_data->entry[i].stat_type = QLA2XX_INT_ERR; ++ rsp_data->entry[i].tgt_num = 0x0; ++ rsp_data->entry[i].cnt = vha->interface_err_cnt; ++ i++; ++ } ++ ++ if (flags & QLA2XX_CMD_TIMEOUT) { ++ rsp_data->entry[i].stat_type = QLA2XX_CMD_TIMEOUT; ++ rsp_data->entry[i].tgt_num = 0x0; ++ rsp_data->entry[i].cnt = vha->cmd_timeout_cnt; ++ i++; ++ } ++ ++ if (flags & QLA2XX_RESET_CMD_ERR) { ++ rsp_data->entry[i].stat_type = QLA2XX_RESET_CMD_ERR; ++ rsp_data->entry[i].tgt_num = 0x0; ++ rsp_data->entry[i].cnt = vha->reset_cmd_err_cnt; ++ i++; ++ } ++ ++ /* i will continue from previous loop, as target ++ * entries are after initiator ++ */ ++ if (flags & QLA2XX_TGT_SHT_LNK_DOWN) { ++ spin_lock_irqsave(&vha->hw->tgt.sess_lock, int_flags); ++ list_for_each_entry(fcport, &vha->vp_fcports, list) { ++ if (fcport->port_type != FCT_TARGET) ++ continue; ++ if (!fcport->rport) ++ continue; ++ rsp_data->entry[i].stat_type = QLA2XX_TGT_SHT_LNK_DOWN; ++ rsp_data->entry[i].tgt_num = fcport->rport->number; ++ rsp_data->entry[i].cnt = fcport->tgt_short_link_down_cnt; ++ i++; ++ } ++ spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, int_flags); ++ } ++ resp->status = EXT_STATUS_OK; ++ ++ return 0; ++} ++ ++int qla2xxx_get_tgt_stats(struct Scsi_Host *host, u32 flags, ++ struct fc_rport *rport, void *data, u64 size) ++{ ++ struct ql_vnd_tgt_stats_resp *tgt_data = data; ++ fc_port_t *fcport = *(fc_port_t **)rport->dd_data; ++ ++ tgt_data->status = 0; ++ tgt_data->stats.entry_count = 1; ++ tgt_data->stats.entry[0].stat_type = flags; ++ tgt_data->stats.entry[0].tgt_num = rport->number; ++ tgt_data->stats.entry[0].cnt = fcport->tgt_short_link_down_cnt; ++ ++ return 0; ++} ++ ++int qla2xxx_disable_port(struct Scsi_Host *host) ++{ ++ scsi_qla_host_t *vha = shost_priv(host); ++ ++ vha->hw->flags.port_isolated = 1; ++ ++ if (qla2x00_chip_is_down(vha)) ++ return 0; ++ ++ if (vha->flags.online) { ++ qla2x00_abort_isp_cleanup(vha); ++ qla2x00_wait_for_sess_deletion(vha); ++ } ++ ++ return 0; ++} ++ ++int qla2xxx_enable_port(struct Scsi_Host *host) ++{ ++ scsi_qla_host_t *vha = shost_priv(host); ++ ++ vha->hw->flags.port_isolated = 0; ++ /* Set the flag to 1, so that isp_abort can proceed */ ++ vha->flags.online = 1; ++ set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); ++ qla2xxx_wake_dpc(vha); ++ ++ return 0; ++} +--- a/drivers/scsi/qla2xxx/qla_isr.c ++++ b/drivers/scsi/qla2xxx/qla_isr.c +@@ -1060,6 +1060,9 @@ qla2x00_async_event(scsi_qla_host_t *vha + + case MBA_SYSTEM_ERR: /* System Error */ + mbx = 0; ++ ++ vha->hw_err_cnt++; ++ + if (IS_QLA81XX(ha) || IS_QLA83XX(ha) || + IS_QLA27XX(ha) || IS_QLA28XX(ha)) { + u16 m[4]; +@@ -1113,6 +1116,8 @@ qla2x00_async_event(scsi_qla_host_t *vha + ql_log(ql_log_warn, vha, 0x5006, + "ISP Request Transfer Error (%x).\n", mb[1]); + ++ vha->hw_err_cnt++; ++ + set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); + break; + +@@ -1120,6 +1125,8 @@ qla2x00_async_event(scsi_qla_host_t *vha + ql_log(ql_log_warn, vha, 0x5007, + "ISP Response Transfer Error (%x).\n", mb[1]); + ++ vha->hw_err_cnt++; ++ + set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); + break; + +@@ -1177,12 +1184,18 @@ qla2x00_async_event(scsi_qla_host_t *vha + vha->flags.management_server_logged_in = 0; + qla2x00_post_aen_work(vha, FCH_EVT_LINKUP, ha->link_data_rate); + ++ if (vha->link_down_time < vha->hw->port_down_retry_count) { ++ vha->short_link_down_cnt++; ++ vha->link_down_time = QLA2XX_MAX_LINK_DOWN_TIME; ++ } ++ + break; + + case MBA_LOOP_DOWN: /* Loop Down Event */ + SAVE_TOPO(ha); + ha->flags.lip_ae = 0; + ha->current_topology = 0; ++ vha->link_down_time = 0; + + mbx = (IS_QLA81XX(ha) || IS_QLA8031(ha)) + ? rd_reg_word(®24->mailbox4) : 0; +@@ -1504,6 +1517,7 @@ qla2x00_async_event(scsi_qla_host_t *vha + ql_dbg(ql_dbg_async, vha, 0x5016, + "Discard RND Frame -- %04x %04x %04x.\n", + mb[1], mb[2], mb[3]); ++ vha->interface_err_cnt++; + break; + + case MBA_TRACE_NOTIFICATION: +@@ -1593,6 +1607,7 @@ qla2x00_async_event(scsi_qla_host_t *vha + + case MBA_IDC_AEN: + if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) { ++ vha->hw_err_cnt++; + qla27xx_handle_8200_aen(vha, mb); + } else if (IS_QLA83XX(ha)) { + mb[4] = rd_reg_word(®24->mailbox4); +@@ -3102,6 +3117,8 @@ qla2x00_status_entry(scsi_qla_host_t *vh + "Dropped frame(s) detected (0x%x of 0x%x bytes).\n", + resid, scsi_bufflen(cp)); + ++ vha->interface_err_cnt++; ++ + res = DID_ERROR << 16 | lscsi_status; + goto check_scsi_status; + } +@@ -3127,6 +3144,8 @@ qla2x00_status_entry(scsi_qla_host_t *vh + "Dropped frame(s) detected (0x%x of 0x%x bytes).\n", + resid, scsi_bufflen(cp)); + ++ vha->interface_err_cnt++; ++ + res = DID_ERROR << 16 | lscsi_status; + goto check_scsi_status; + } else { +@@ -3209,6 +3228,7 @@ qla2x00_status_entry(scsi_qla_host_t *vh + + case CS_TRANSPORT: + res = DID_ERROR << 16; ++ vha->hw_err_cnt++; + + if (!IS_PI_SPLIT_DET_CAPABLE(ha)) + break; +@@ -3229,6 +3249,7 @@ qla2x00_status_entry(scsi_qla_host_t *vh + ql_dump_buffer(ql_dbg_tgt + ql_dbg_verbose, vha, 0xe0ee, + pkt, sizeof(*sts24)); + res = DID_ERROR << 16; ++ vha->hw_err_cnt++; + break; + default: + res = DID_ERROR << 16; +@@ -3840,6 +3861,7 @@ qla24xx_msix_default(int irq, void *dev_ + hccr); + + qla2xxx_check_risc_status(vha); ++ vha->hw_err_cnt++; + + ha->isp_ops->fw_dump(vha); + set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); +--- a/drivers/scsi/qla2xxx/qla_mbx.c ++++ b/drivers/scsi/qla2xxx/qla_mbx.c +@@ -181,6 +181,7 @@ qla2x00_mailbox_command(scsi_qla_host_t + ql_log(ql_log_warn, vha, 0xd035, + "Cmd access timeout, cmd=0x%x, Exiting.\n", + mcp->mb[0]); ++ vha->hw_err_cnt++; + atomic_dec(&ha->num_pend_mbx_stage1); + return QLA_FUNCTION_TIMEOUT; + } +@@ -308,6 +309,7 @@ qla2x00_mailbox_command(scsi_qla_host_t + atomic_dec(&ha->num_pend_mbx_stage2); + ql_dbg(ql_dbg_mbx, vha, 0x1012, + "Pending mailbox timeout, exiting.\n"); ++ vha->hw_err_cnt++; + rval = QLA_FUNCTION_TIMEOUT; + goto premature_exit; + } +@@ -419,6 +421,7 @@ qla2x00_mailbox_command(scsi_qla_host_t + "mb[0-3]=[0x%x 0x%x 0x%x 0x%x] mb7 0x%x host_status 0x%x hccr 0x%x\n", + command, ictrl, jiffies, mb[0], mb[1], mb[2], mb[3], + mb[7], host_status, hccr); ++ vha->hw_err_cnt++; + + } else { + mb[0] = RD_MAILBOX_REG(ha, ®->isp, 0); +@@ -426,6 +429,7 @@ qla2x00_mailbox_command(scsi_qla_host_t + ql_dbg(ql_dbg_mbx + ql_dbg_buffer, vha, 0x1119, + "MBX Command timeout for cmd %x, iocontrol=%x jiffies=%lx " + "mb[0]=0x%x\n", command, ictrl, jiffies, mb[0]); ++ vha->hw_err_cnt++; + } + ql_dump_regs(ql_dbg_mbx + ql_dbg_buffer, vha, 0x1019); + +@@ -498,6 +502,7 @@ qla2x00_mailbox_command(scsi_qla_host_t + "mb[0]=0x%x, eeh_busy=0x%x. Scheduling ISP " + "abort.\n", command, mcp->mb[0], + ha->flags.eeh_busy); ++ vha->hw_err_cnt++; + set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); + qla2xxx_wake_dpc(vha); + } +@@ -522,6 +527,7 @@ qla2x00_mailbox_command(scsi_qla_host_t + "Mailbox cmd timeout occurred, cmd=0x%x, " + "mb[0]=0x%x. Scheduling ISP abort ", + command, mcp->mb[0]); ++ vha->hw_err_cnt++; + set_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); + clear_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); + /* Allow next mbx cmd to come in. */ +@@ -626,6 +632,7 @@ qla2x00_load_ram(scsi_qla_host_t *vha, d + ql_dbg(ql_dbg_mbx, vha, 0x1023, + "Failed=%x mb[0]=%x mb[1]=%x.\n", + rval, mcp->mb[0], mcp->mb[1]); ++ vha->hw_err_cnt++; + } else { + ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1024, + "Done %s.\n", __func__); +@@ -737,6 +744,7 @@ qla2x00_execute_fw(scsi_qla_host_t *vha, + + ql_dbg(ql_dbg_mbx, vha, 0x1026, + "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); ++ vha->hw_err_cnt++; + return rval; + } + +@@ -1314,6 +1322,7 @@ qla2x00_mbx_reg_test(scsi_qla_host_t *vh + if (rval != QLA_SUCCESS) { + /*EMPTY*/ + ql_dbg(ql_dbg_mbx, vha, 0x1033, "Failed=%x.\n", rval); ++ vha->hw_err_cnt++; + } else { + /*EMPTY*/ + ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1034, +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -1275,6 +1275,8 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) + sp = scsi_cmd_priv(cmd); + qpair = sp->qpair; + ++ vha->cmd_timeout_cnt++; ++ + if ((sp->fcport && sp->fcport->deleted) || !qpair) + return SUCCESS; + +@@ -1443,6 +1445,7 @@ static int + "%s RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n", name, + reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun, + cmd); ++ vha->reset_cmd_err_cnt++; + return FAILED; + } + +@@ -3142,6 +3145,10 @@ qla2x00_probe_one(struct pci_dev *pdev, + ha->mr.fcport.supported_classes = FC_COS_UNSPECIFIED; + ha->mr.fcport.scan_state = 1; + ++ qla2xxx_reset_stats(host, QLA2XX_HW_ERROR | QLA2XX_SHT_LNK_DWN | ++ QLA2XX_INT_ERR | QLA2XX_CMD_TIMEOUT | ++ QLA2XX_RESET_CMD_ERR | QLA2XX_TGT_SHT_LNK_DOWN); ++ + /* Set the SG table size based on ISP type */ + if (!IS_FWI2_CAPABLE(ha)) { + if (IS_QLA2100(ha)) +@@ -5091,6 +5098,7 @@ void qla24xx_create_new_sess(struct scsi + fcport->d_id = e->u.new_sess.id; + fcport->flags |= FCF_FABRIC_DEVICE; + fcport->fw_login_state = DSC_LS_PLOGI_PEND; ++ fcport->tgt_short_link_down_cnt = 0; + + memcpy(fcport->port_name, e->u.new_sess.port_name, + WWN_SIZE); +@@ -7062,6 +7070,8 @@ qla2x00_timer(struct timer_list *t) + uint16_t w; + struct qla_hw_data *ha = vha->hw; + struct req_que *req; ++ unsigned long flags; ++ fc_port_t *fcport = NULL; + + if (ha->flags.eeh_busy) { + ql_dbg(ql_dbg_timer, vha, 0x6000, +@@ -7093,6 +7103,16 @@ qla2x00_timer(struct timer_list *t) + if (!vha->vp_idx && IS_QLAFX00(ha)) + qlafx00_timer_routine(vha); + ++ if (vha->link_down_time < QLA2XX_MAX_LINK_DOWN_TIME) ++ vha->link_down_time++; ++ ++ spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); ++ list_for_each_entry(fcport, &vha->vp_fcports, list) { ++ if (fcport->tgt_link_down_time < QLA2XX_MAX_LINK_DOWN_TIME) ++ fcport->tgt_link_down_time++; ++ } ++ spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); ++ + /* Loop down handler. */ + if (atomic_read(&vha->loop_down_timer) > 0 && + !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) && diff --git a/patches.suse/scsi-qla2xxx-Make-sure-that-aborted-commands-are-fre.patch b/patches.suse/scsi-qla2xxx-Make-sure-that-aborted-commands-are-fre.patch deleted file mode 100644 index 3d1efca..0000000 --- a/patches.suse/scsi-qla2xxx-Make-sure-that-aborted-commands-are-fre.patch +++ /dev/null @@ -1,104 +0,0 @@ -From: Bart Van Assche -Date: Thu, 8 Aug 2019 20:02:10 -0700 -Subject: scsi: qla2xxx: Make sure that aborted commands are freed -Patch-mainline: v5.4-rc1 -Git-commit: 0dcec41acb85da33841c2ab56dbf337ed00a3914 -References: jsc#SLE-9714 jsc#SLE-10327 jsc#SLE-10334 bnc#1151927 5.3.17 - -The LIO core requires that the target driver callback functions -.queue_data_in() and .queue_status() call target_put_sess_cmd() or -transport_generic_free_cmd(). These calls may happen synchronously or -asynchronously. Make sure that one of these LIO functions is called in case -a command has been aborted. This patch avoids that the code for removing a -session hangs due to commands that do not make progress. - -Cc: Himanshu Madhani -Fixes: 694833ee00c4 ("scsi: tcm_qla2xxx: Do not allow aborted cmd to advance.") # v4.13. -Fixes: a07100e00ac4 ("qla2xxx: Fix TMR ABORT interaction issue between qla2xxx and TCM") # v4.5. -Signed-off-by: Bart Van Assche -Tested-by: Himanshu Madhani -Reviewed-by: Himanshu Madhani -Signed-off-by: Martin K. Petersen -Acked-by: Daniel Wagner ---- - drivers/scsi/qla2xxx/qla_target.c | 13 ++++++++----- - drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 ++++ - 2 files changed, 12 insertions(+), 5 deletions(-) - ---- a/drivers/scsi/qla2xxx/qla_target.c -+++ b/drivers/scsi/qla2xxx/qla_target.c -@@ -3206,7 +3206,8 @@ int qlt_xmit_response(struct qla_tgt_cmd - if (!qpair->fw_started || (cmd->reset_count != qpair->chip_reset) || - (cmd->sess && cmd->sess->deleted)) { - cmd->state = QLA_TGT_STATE_PROCESSED; -- return 0; -+ res = 0; -+ goto free; - } - - ql_dbg_qp(ql_dbg_tgt, qpair, 0xe018, -@@ -3217,9 +3218,8 @@ int qlt_xmit_response(struct qla_tgt_cmd - - res = qlt_pre_xmit_response(cmd, &prm, xmit_type, scsi_status, - &full_req_cnt); -- if (unlikely(res != 0)) { -- return res; -- } -+ if (unlikely(res != 0)) -+ goto free; - - spin_lock_irqsave(qpair->qp_lock_ptr, flags); - -@@ -3239,7 +3239,8 @@ int qlt_xmit_response(struct qla_tgt_cmd - vha->flags.online, qla2x00_reset_active(vha), - cmd->reset_count, qpair->chip_reset); - spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); -- return 0; -+ res = 0; -+ goto free; - } - - /* Does F/W have an IOCBs for this request */ -@@ -3342,6 +3343,8 @@ out_unmap_unlock: - qlt_unmap_sg(vha, cmd); - spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); - -+free: -+ vha->hw->tgt.tgt_ops->free_cmd(cmd); - return res; - } - EXPORT_SYMBOL(qlt_xmit_response); ---- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c -+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c -@@ -620,6 +620,7 @@ static int tcm_qla2xxx_queue_data_in(str - { - struct qla_tgt_cmd *cmd = container_of(se_cmd, - struct qla_tgt_cmd, se_cmd); -+ struct scsi_qla_host *vha = cmd->vha; - - if (cmd->aborted) { - /* Cmd can loop during Q-full. tcm_qla2xxx_aborted_task -@@ -632,6 +633,7 @@ static int tcm_qla2xxx_queue_data_in(str - cmd->se_cmd.transport_state, - cmd->se_cmd.t_state, - cmd->se_cmd.se_cmd_flags); -+ vha->hw->tgt.tgt_ops->free_cmd(cmd); - return 0; - } - -@@ -659,6 +661,7 @@ static int tcm_qla2xxx_queue_status(stru - { - struct qla_tgt_cmd *cmd = container_of(se_cmd, - struct qla_tgt_cmd, se_cmd); -+ struct scsi_qla_host *vha = cmd->vha; - int xmit_type = QLA_TGT_XMIT_STATUS; - - if (cmd->aborted) { -@@ -672,6 +675,7 @@ static int tcm_qla2xxx_queue_status(stru - cmd, kref_read(&cmd->se_cmd.cmd_kref), - cmd->se_cmd.transport_state, cmd->se_cmd.t_state, - cmd->se_cmd.se_cmd_flags); -+ vha->hw->tgt.tgt_ops->free_cmd(cmd); - return 0; - } - cmd->bufflen = se_cmd->data_length; diff --git a/patches.suse/scsi-qla2xxx-Move-some-messages-from-debug-to-normal.patch b/patches.suse/scsi-qla2xxx-Move-some-messages-from-debug-to-normal.patch new file mode 100644 index 0000000..e467f0f --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Move-some-messages-from-debug-to-normal.patch @@ -0,0 +1,135 @@ +From: Saurav Kashyap +Date: Mon, 11 Jan 2021 01:31:30 -0800 +Subject: scsi: qla2xxx: Move some messages from debug to normal log level +Patch-mainline: v5.12-rc1 +Git-commit: daaecb41a278273014c11a19b4dad73c2ca8a9ca +References: bsc#1185491 + +This change will aid in debugging issues arising because of dropped frame, +DIF errors, queue full etc where debug level is not set. + +Link: https://lore.kernel.org/r/20210111093134.1206-4-njavali@marvell.com +Signed-off-by: Saurav Kashyap +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_init.c | 10 +++---- + drivers/scsi/qla2xxx/qla_isr.c | 52 +++++++++++++++++++--------------------- + 2 files changed, 30 insertions(+), 32 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -348,11 +348,11 @@ qla2x00_async_login(struct scsi_qla_host + if (NVME_TARGET(vha->hw, fcport)) + lio->u.logio.flags |= SRB_LOGIN_SKIP_PRLI; + +- ql_dbg(ql_dbg_disc, vha, 0x2072, +- "Async-login - %8phC hdl=%x, loopid=%x portid=%02x%02x%02x " +- "retries=%d.\n", fcport->port_name, sp->handle, fcport->loop_id, +- fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa, +- fcport->login_retry); ++ ql_log(ql_log_warn, vha, 0x2072, ++ "Async-login - %8phC hdl=%x, loopid=%x portid=%02x%02x%02x retries=%d.\n", ++ fcport->port_name, sp->handle, fcport->loop_id, ++ fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa, ++ fcport->login_retry); + + rval = qla2x00_start_sp(sp); + if (rval != QLA_SUCCESS) { +--- a/drivers/scsi/qla2xxx/qla_isr.c ++++ b/drivers/scsi/qla2xxx/qla_isr.c +@@ -1456,9 +1456,9 @@ qla2x00_async_event(scsi_qla_host_t *vha + if (ha->flags.npiv_supported && vha->vp_idx != (mb[3] & 0xff)) + break; + +- ql_dbg(ql_dbg_async, vha, 0x5013, +- "RSCN database changed -- %04x %04x %04x.\n", +- mb[1], mb[2], mb[3]); ++ ql_log(ql_log_warn, vha, 0x5013, ++ "RSCN database changed -- %04x %04x %04x.\n", ++ mb[1], mb[2], mb[3]); + + rscn_entry = ((mb[1] & 0xff) << 16) | mb[2]; + host_pid = (vha->d_id.b.domain << 16) | (vha->d_id.b.area << 8) +@@ -2222,12 +2222,12 @@ qla24xx_logio_entry(scsi_qla_host_t *vha + break; + } + +- ql_dbg(ql_dbg_async, sp->vha, 0x5037, +- "Async-%s failed: handle=%x pid=%06x wwpn=%8phC comp_status=%x iop0=%x iop1=%x\n", +- type, sp->handle, fcport->d_id.b24, fcport->port_name, +- le16_to_cpu(logio->comp_status), +- le32_to_cpu(logio->io_parameter[0]), +- le32_to_cpu(logio->io_parameter[1])); ++ ql_log(ql_log_warn, sp->vha, 0x5037, ++ "Async-%s failed: handle=%x pid=%06x wwpn=%8phC comp_status=%x iop0=%x iop1=%x\n", ++ type, sp->handle, fcport->d_id.b24, fcport->port_name, ++ le16_to_cpu(logio->comp_status), ++ le32_to_cpu(logio->io_parameter[0]), ++ le32_to_cpu(logio->io_parameter[1])); + + logio_done: + sp->done(sp, 0); +@@ -2390,9 +2390,9 @@ static void qla24xx_nvme_iocb_entry(scsi + + tgt_xfer_len = be32_to_cpu(rsp_iu->xfrd_len); + if (fd->transferred_length != tgt_xfer_len) { +- ql_dbg(ql_dbg_io, fcport->vha, 0x3079, +- "Dropped frame(s) detected (sent/rcvd=%u/%u).\n", +- tgt_xfer_len, fd->transferred_length); ++ ql_log(ql_log_warn, fcport->vha, 0x3079, ++ "Dropped frame(s) detected (sent/rcvd=%u/%u).\n", ++ tgt_xfer_len, fd->transferred_length); + logit = 1; + } else if (le16_to_cpu(comp_status) == CS_DATA_UNDERRUN) { + /* +@@ -3113,9 +3113,9 @@ qla2x00_status_entry(scsi_qla_host_t *vh + scsi_set_resid(cp, resid); + if (scsi_status & SS_RESIDUAL_UNDER) { + if (IS_FWI2_CAPABLE(ha) && fw_resid_len != resid_len) { +- ql_dbg(ql_dbg_io, fcport->vha, 0x301d, +- "Dropped frame(s) detected (0x%x of 0x%x bytes).\n", +- resid, scsi_bufflen(cp)); ++ ql_log(ql_log_warn, fcport->vha, 0x301d, ++ "Dropped frame(s) detected (0x%x of 0x%x bytes).\n", ++ resid, scsi_bufflen(cp)); + + vha->interface_err_cnt++; + +@@ -3140,9 +3140,9 @@ qla2x00_status_entry(scsi_qla_host_t *vh + * task not completed. + */ + +- ql_dbg(ql_dbg_io, fcport->vha, 0x301f, +- "Dropped frame(s) detected (0x%x of 0x%x bytes).\n", +- resid, scsi_bufflen(cp)); ++ ql_log(ql_log_warn, fcport->vha, 0x301f, ++ "Dropped frame(s) detected (0x%x of 0x%x bytes).\n", ++ resid, scsi_bufflen(cp)); + + vha->interface_err_cnt++; + +@@ -3258,15 +3258,13 @@ qla2x00_status_entry(scsi_qla_host_t *vh + + out: + if (logit) +- ql_dbg(ql_dbg_io, fcport->vha, 0x3022, +- "FCP command status: 0x%x-0x%x (0x%x) nexus=%ld:%d:%llu " +- "portid=%02x%02x%02x oxid=0x%x cdb=%10phN len=0x%x " +- "rsp_info=0x%x resid=0x%x fw_resid=0x%x sp=%p cp=%p.\n", +- comp_status, scsi_status, res, vha->host_no, +- cp->device->id, cp->device->lun, fcport->d_id.b.domain, +- fcport->d_id.b.area, fcport->d_id.b.al_pa, ox_id, +- cp->cmnd, scsi_bufflen(cp), rsp_info_len, +- resid_len, fw_resid_len, sp, cp); ++ ql_log(ql_log_warn, fcport->vha, 0x3022, ++ "FCP command status: 0x%x-0x%x (0x%x) nexus=%ld:%d:%llu portid=%02x%02x%02x oxid=0x%x cdb=%10phN len=0x%x rsp_info=0x%x resid=0x%x fw_resid=0x%x sp=%p cp=%p.\n", ++ comp_status, scsi_status, res, vha->host_no, ++ cp->device->id, cp->device->lun, fcport->d_id.b.domain, ++ fcport->d_id.b.area, fcport->d_id.b.al_pa, ox_id, ++ cp->cmnd, scsi_bufflen(cp), rsp_info_len, ++ resid_len, fw_resid_len, sp, cp); + + if (rsp->status_srb == NULL) + sp->done(sp, res); diff --git a/patches.suse/scsi-qla2xxx-Remove-redundant-NULL-check.patch b/patches.suse/scsi-qla2xxx-Remove-redundant-NULL-check.patch new file mode 100644 index 0000000..dae045d --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Remove-redundant-NULL-check.patch @@ -0,0 +1,81 @@ +From: Yang Li +Date: Fri, 22 Jan 2021 17:02:53 +0800 +Subject: scsi: qla2xxx: Remove redundant NULL check +Patch-mainline: v5.12-rc1 +Git-commit: 18c05faf8ab14913c8144108661efa8f17b10b5b +References: bsc#1185491 + +Fix below warnings reported by coccicheck: +./drivers/scsi/qla2xxx/qla_init.c:3371:2-7: WARNING: NULL check before +some freeing functions is not needed. +./drivers/scsi/qla2xxx/qla_init.c:7855:5-10: WARNING: NULL check before +some freeing functions is not needed. +./drivers/scsi/qla2xxx/qla_init.c:7916:2-7: WARNING: NULL check before +some freeing functions is not needed. +./drivers/scsi/qla2xxx/qla_init.c:8113:4-18: WARNING: NULL check before +some freeing functions is not needed. +./drivers/scsi/qla2xxx/qla_init.c:8174:2-7: WARNING: NULL check before +some freeing functions is not needed. + +Link: https://lore.kernel.org/r/1611306174-92627-1-git-send-email-abaci-bugfix@linux.alibaba.com +Reported-by: Abaci Robot +Reviewed-by: Himanshu Madhani +Signed-off-by: Yang Li +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_init.c | 15 +++++---------- + 1 file changed, 5 insertions(+), 10 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -3376,8 +3376,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *v + "Re-Allocated (%d KB) and save firmware dump.\n", + dump_size / 1024); + } else { +- if (ha->fw_dump) +- vfree(ha->fw_dump); ++ vfree(ha->fw_dump); + ha->fw_dump = fw_dump; + + ha->fw_dump_len = ha->fw_dump_alloc_len = +@@ -7877,8 +7876,7 @@ qla24xx_load_risc_flash(scsi_qla_host_t + templates = (risc_attr & BIT_9) ? 2 : 1; + ql_dbg(ql_dbg_init, vha, 0x0160, "-> templates = %u\n", templates); + for (j = 0; j < templates; j++, fwdt++) { +- if (fwdt->template) +- vfree(fwdt->template); ++ vfree(fwdt->template); + fwdt->template = NULL; + fwdt->length = 0; + +@@ -7938,8 +7936,7 @@ qla24xx_load_risc_flash(scsi_qla_host_t + return QLA_SUCCESS; + + failed: +- if (fwdt->template) +- vfree(fwdt->template); ++ vfree(fwdt->template); + fwdt->template = NULL; + fwdt->length = 0; + +@@ -8135,8 +8132,7 @@ qla24xx_load_risc_blob(scsi_qla_host_t * + templates = (risc_attr & BIT_9) ? 2 : 1; + ql_dbg(ql_dbg_init, vha, 0x0170, "-> templates = %u\n", templates); + for (j = 0; j < templates; j++, fwdt++) { +- if (fwdt->template) +- vfree(fwdt->template); ++ vfree(fwdt->template); + fwdt->template = NULL; + fwdt->length = 0; + +@@ -8196,8 +8192,7 @@ qla24xx_load_risc_blob(scsi_qla_host_t * + return QLA_SUCCESS; + + failed: +- if (fwdt->template) +- vfree(fwdt->template); ++ vfree(fwdt->template); + fwdt->template = NULL; + fwdt->length = 0; + diff --git a/patches.suse/scsi-qla2xxx-Remove-unnecessary-NULL-check.patch b/patches.suse/scsi-qla2xxx-Remove-unnecessary-NULL-check.patch new file mode 100644 index 0000000..4ff9c7b --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Remove-unnecessary-NULL-check.patch @@ -0,0 +1,33 @@ +From: Dan Carpenter +Date: Thu, 21 Jan 2021 09:08:41 +0300 +Subject: scsi: qla2xxx: Remove unnecessary NULL check +Patch-mainline: v5.12-rc1 +Git-commit: c750a9c9c59a85843d447910a27da21c5bcf600a +References: bsc#1185491 + +The list iterator can't be NULL so this check is not required. Removing +the check silences a Smatch warning about inconsistent NULL checking. + + drivers/scsi/qla2xxx/qla_dfs.c:371 qla_dfs_tgt_counters_show() + error: we previously assumed 'fcport' could be null (see line 372) + +Link: https://lore.kernel.org/r/YAkaaSrhn1mFqyHy@mwanda +Acked-by: Saurav Kashyap +Signed-off-by: Dan Carpenter +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_dfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_dfs.c ++++ b/drivers/scsi/qla2xxx/qla_dfs.c +@@ -370,7 +370,7 @@ qla_dfs_tgt_counters_show(struct seq_fil + seq_puts(s, "\n"); + + list_for_each_entry(fcport, &vha->vp_fcports, list) { +- if (!fcport || !fcport->rport) ++ if (!fcport->rport) + continue; + + seq_printf(s, "Target Num = %7d Link Down Count = %14lld\n", diff --git a/patches.suse/scsi-qla2xxx-Remove-unneeded-if-null-free-check.patch b/patches.suse/scsi-qla2xxx-Remove-unneeded-if-null-free-check.patch new file mode 100644 index 0000000..f0cd4aa --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Remove-unneeded-if-null-free-check.patch @@ -0,0 +1,45 @@ +From: Qiheng Lin +Date: Fri, 9 Apr 2021 20:09:25 +0800 +Subject: scsi: qla2xxx: Remove unneeded if-null-free check +Patch-mainline: v5.13-rc1 +Git-commit: efd2617100d9c6a49c8cd27160a2353b04844d78 +References: bsc#1185491 + +Eliminate the following coccicheck warning: + +drivers/scsi/qla2xxx/qla_os.c:4622:2-7: + WARNING: NULL check before some freeing functions is not needed. +drivers/scsi/qla2xxx/qla_os.c:4637:3-8: + WARNING: NULL check before some freeing functions is not needed. + +Link: https://lore.kernel.org/r/20210409120925.7122-1-linqiheng@huawei.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Qiheng Lin +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_os.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -4619,8 +4619,7 @@ qla2x00_free_fw_dump(struct qla_hw_data + dma_free_coherent(&ha->pdev->dev, + EFT_SIZE, ha->eft, ha->eft_dma); + +- if (ha->fw_dump) +- vfree(ha->fw_dump); ++ vfree(ha->fw_dump); + + ha->fce = NULL; + ha->fce_dma = 0; +@@ -4634,8 +4633,7 @@ qla2x00_free_fw_dump(struct qla_hw_data + ha->fw_dump_len = 0; + + for (j = 0; j < 2; j++, fwdt++) { +- if (fwdt->template) +- vfree(fwdt->template); ++ vfree(fwdt->template); + fwdt->template = NULL; + fwdt->length = 0; + } diff --git a/patches.suse/scsi-qla2xxx-Replace-__qla2x00_marker-s-missing-unde.patch b/patches.suse/scsi-qla2xxx-Replace-__qla2x00_marker-s-missing-unde.patch new file mode 100644 index 0000000..4e715f3 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Replace-__qla2x00_marker-s-missing-unde.patch @@ -0,0 +1,36 @@ +From: Lee Jones +Date: Wed, 3 Mar 2021 14:46:16 +0000 +Subject: scsi: qla2xxx: Replace __qla2x00_marker()'s missing underscores +Patch-mainline: v5.13-rc1 +Git-commit: 52bb80f18def787e98a9f97a7cabbe71e4879996 +References: bsc#1185491 + +Fixes the following W=1 kernel build warning(s): + + drivers/scsi/qla2xxx/qla_iocb.c:508: warning: expecting prototype for qla2x00_marker(). Prototype was for __qla2x00_marker() instead + +Link: https://lore.kernel.org/r/20210303144631.3175331-16-lee.jones@linaro.org +Cc: Nilesh Javali +Cc: GR-QLogic-Storage-Upstream@marvell.com +Cc: "James E.J. Bottomley" +Cc: "Martin K. Petersen" +Cc: linux-scsi@vger.kernel.org +Acked-by: Nilesh Javali +Signed-off-by: Lee Jones +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_iocb.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_iocb.c ++++ b/drivers/scsi/qla2xxx/qla_iocb.c +@@ -492,7 +492,7 @@ qla2x00_start_iocbs(struct scsi_qla_host + } + + /** +- * qla2x00_marker() - Send a marker IOCB to the firmware. ++ * __qla2x00_marker() - Send a marker IOCB to the firmware. + * @vha: HA context + * @qpair: queue pair pointer + * @loop_id: loop ID diff --git a/patches.suse/scsi-qla2xxx-Reserve-extra-IRQ-vectors.patch b/patches.suse/scsi-qla2xxx-Reserve-extra-IRQ-vectors.patch index 834aa11..db75fd4 100644 --- a/patches.suse/scsi-qla2xxx-Reserve-extra-IRQ-vectors.patch +++ b/patches.suse/scsi-qla2xxx-Reserve-extra-IRQ-vectors.patch @@ -1,8 +1,7 @@ From: Roman Bolshakov Date: Mon, 12 Apr 2021 19:57:40 +0300 Subject: scsi: qla2xxx: Reserve extra IRQ vectors -Patch-mainline: Queued in subsystem maintainer repository -Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: f02d4086a8f36a0e1aaebf559b54cf24a177a486 References: bsc#1184436 diff --git a/patches.suse/scsi-qla2xxx-Reuse-existing-error-handling-path.patch b/patches.suse/scsi-qla2xxx-Reuse-existing-error-handling-path.patch new file mode 100644 index 0000000..9b4d4ac --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Reuse-existing-error-handling-path.patch @@ -0,0 +1,32 @@ +From: Christophe JAILLET +Date: Sun, 11 Apr 2021 11:21:40 +0200 +Subject: scsi: qla2xxx: Reuse existing error handling path +Patch-mainline: v5.13-rc1 +Git-commit: 5dc3468888f8ba54c3a2fdd38b13288f6b8daed2 +References: bsc#1185491 + +There is no need to duplicate code, use the existing error handling path to +free resources. This is more future-proof. + +Link: https://lore.kernel.org/r/6973844a1532ec2dc8e86f3533362e79d78ed774.1618132821.git.christophe.jaillet@wanadoo.fr +Reviewed-by: Bart Van Assche +Signed-off-by: Christophe JAILLET +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_bsg.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_bsg.c ++++ b/drivers/scsi/qla2xxx/qla_bsg.c +@@ -2586,8 +2586,8 @@ qla2x00_get_host_stats(struct bsg_job *b + + data = kzalloc(response_len, GFP_KERNEL); + if (!data) { +- kfree(req_data); +- return -ENOMEM; ++ ret = -ENOMEM; ++ goto host_stat_out; + } + + ret = qla2xxx_get_ini_stats(fc_bsg_to_shost(bsg_job), req_data->stat_type, diff --git a/patches.suse/scsi-qla2xxx-Simplify-if-statement.patch b/patches.suse/scsi-qla2xxx-Simplify-if-statement.patch new file mode 100644 index 0000000..6faecd0 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Simplify-if-statement.patch @@ -0,0 +1,34 @@ +From: Jiapeng Chong +Date: Wed, 3 Feb 2021 10:26:30 +0800 +Subject: scsi: qla2xxx: Simplify if statement +Patch-mainline: v5.12-rc1 +Git-commit: 960204ecca5e71a7ef4319a2e94eed2279da1624 +References: bsc#1185491 + +Fix the following coccicheck warnings: + +./drivers/scsi/qla2xxx/qla_target.c:984:12-14: WARNING !A || A && B is +equivalent to !A || B. + +Link: https://lore.kernel.org/r/1612319190-111421-1-git-send-email-jiapeng.chong@linux.alibaba.com +Reported-by: Abaci Robot +Reviewed-by: Himanshu Madhani +Signed-off-by: Jiapeng Chong +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_target.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_target.c ++++ b/drivers/scsi/qla2xxx/qla_target.c +@@ -981,8 +981,7 @@ void qlt_free_session_done(struct work_s + int rc; + + if (!own || +- (own && +- (own->iocb.u.isp24.status_subcode == ELS_PLOGI))) { ++ (own->iocb.u.isp24.status_subcode == ELS_PLOGI)) { + rc = qla2x00_post_async_logout_work(vha, sess, + NULL); + if (rc != QLA_SUCCESS) diff --git a/patches.suse/scsi-qla2xxx-Simplify-qla8044_minidump_process_contr.patch b/patches.suse/scsi-qla2xxx-Simplify-qla8044_minidump_process_contr.patch new file mode 100644 index 0000000..d98744f --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Simplify-qla8044_minidump_process_contr.patch @@ -0,0 +1,87 @@ +From: Bart Van Assche +Date: Sat, 20 Mar 2021 16:23:57 -0700 +Subject: scsi: qla2xxx: Simplify qla8044_minidump_process_control() +Patch-mainline: v5.13-rc1 +Git-commit: a20821e3f4719458a888af634c10c286365ecd6f +References: bsc#1185491 + +This patch fixes the following Coverity complaint: + + CID 177490 (#1 of 1): Unused value (UNUSED_VALUE) + assigned_value: Assigning value from opcode & 0xffffff7fU to opcode + here, but that stored value is overwritten before it can be used. + +Link: https://lore.kernel.org/r/20210320232359.941-6-bvanassche@acm.org +Cc: Quinn Tran +Cc: Mike Christie +Reviewed-by: Daniel Wagner +Reviewed-by: Himanshu Madhani +Reviewed-by: Lee Duncan +Signed-off-by: Bart Van Assche +Signed-off-by: Martin K. Petersen +--- + drivers/scsi/qla2xxx/qla_nx2.c | 8 -------- + 1 file changed, 8 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_nx2.c ++++ b/drivers/scsi/qla2xxx/qla_nx2.c +@@ -2227,19 +2227,16 @@ qla8044_minidump_process_control(struct + if (opcode & QLA82XX_DBG_OPCODE_WR) { + qla8044_wr_reg_indirect(vha, crb_addr, + crb_entry->value_1); +- opcode &= ~QLA82XX_DBG_OPCODE_WR; + } + + if (opcode & QLA82XX_DBG_OPCODE_RW) { + qla8044_rd_reg_indirect(vha, crb_addr, &read_value); + qla8044_wr_reg_indirect(vha, crb_addr, read_value); +- opcode &= ~QLA82XX_DBG_OPCODE_RW; + } + + if (opcode & QLA82XX_DBG_OPCODE_AND) { + qla8044_rd_reg_indirect(vha, crb_addr, &read_value); + read_value &= crb_entry->value_2; +- opcode &= ~QLA82XX_DBG_OPCODE_AND; + if (opcode & QLA82XX_DBG_OPCODE_OR) { + read_value |= crb_entry->value_3; + opcode &= ~QLA82XX_DBG_OPCODE_OR; +@@ -2250,7 +2247,6 @@ qla8044_minidump_process_control(struct + qla8044_rd_reg_indirect(vha, crb_addr, &read_value); + read_value |= crb_entry->value_3; + qla8044_wr_reg_indirect(vha, crb_addr, read_value); +- opcode &= ~QLA82XX_DBG_OPCODE_OR; + } + if (opcode & QLA82XX_DBG_OPCODE_POLL) { + poll_time = crb_entry->crb_strd.poll_timeout; +@@ -2270,7 +2266,6 @@ qla8044_minidump_process_control(struct + crb_addr, &read_value); + } + } while (1); +- opcode &= ~QLA82XX_DBG_OPCODE_POLL; + } + + if (opcode & QLA82XX_DBG_OPCODE_RDSTATE) { +@@ -2284,7 +2279,6 @@ qla8044_minidump_process_control(struct + qla8044_rd_reg_indirect(vha, addr, &read_value); + index = crb_entry->crb_ctrl.state_index_v; + tmplt_hdr->saved_state_array[index] = read_value; +- opcode &= ~QLA82XX_DBG_OPCODE_RDSTATE; + } + + if (opcode & QLA82XX_DBG_OPCODE_WRSTATE) { +@@ -2304,7 +2298,6 @@ qla8044_minidump_process_control(struct + } + + qla8044_wr_reg_indirect(vha, addr, read_value); +- opcode &= ~QLA82XX_DBG_OPCODE_WRSTATE; + } + + if (opcode & QLA82XX_DBG_OPCODE_MDSTATE) { +@@ -2317,7 +2310,6 @@ qla8044_minidump_process_control(struct + read_value |= crb_entry->value_3; + read_value += crb_entry->value_1; + tmplt_hdr->saved_state_array[index] = read_value; +- opcode &= ~QLA82XX_DBG_OPCODE_MDSTATE; + } + crb_addr += crb_entry->crb_strd.addr_stride; + } diff --git a/patches.suse/scsi-qla2xxx-Simplify-the-calculation-of-variables.patch b/patches.suse/scsi-qla2xxx-Simplify-the-calculation-of-variables.patch new file mode 100644 index 0000000..5f6c00e --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Simplify-the-calculation-of-variables.patch @@ -0,0 +1,33 @@ +From: Jiapeng Zhong +Date: Tue, 26 Jan 2021 16:42:34 +0800 +Subject: scsi: qla2xxx: Simplify the calculation of variables +Patch-mainline: v5.12-rc1 +Git-commit: 99de0ea06ac04c084b42da3a15aefd4bde1c8424 +References: bsc#1185491 + +Fix the following coccicheck warnings: + +./drivers/scsi/qla2xxx/qla_nvme.c:288:24-26: WARNING !A || A && B is +equivalent to !A || B. + +Link: https://lore.kernel.org/r/1611650554-33019-1-git-send-email-abaci-bugfix@linux.alibaba.com +Reported-by: Abaci Robot +Reviewed-by: Himanshu Madhani +Signed-off-by: Jiapeng Zhong +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_nvme.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_nvme.c ++++ b/drivers/scsi/qla2xxx/qla_nvme.c +@@ -292,7 +292,7 @@ static int qla_nvme_ls_req(struct nvme_f + struct qla_hw_data *ha; + srb_t *sp; + +- if (!fcport || (fcport && fcport->deleted)) ++ if (!fcport || fcport->deleted) + return rval; + + vha = fcport->vha; diff --git a/patches.suse/scsi-qla2xxx-Suppress-Coverity-complaints-about-dseg.patch b/patches.suse/scsi-qla2xxx-Suppress-Coverity-complaints-about-dseg.patch new file mode 100644 index 0000000..a67849c --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Suppress-Coverity-complaints-about-dseg.patch @@ -0,0 +1,83 @@ +From: Bart Van Assche +Date: Sat, 20 Mar 2021 16:23:56 -0700 +Subject: scsi: qla2xxx: Suppress Coverity complaints about dseg_r* +Patch-mainline: v5.13-rc1 +Git-commit: 17603237f789cfb135fd8e01a7edca27a46a6f6e +References: bsc#1185491 + +Change dseq_rq and dseg_rsp from scalar structure members into +single-element arrays such that Coverity does not complain about the +(*cur_dsd)++ statement in append_dsd64(). + +Link: https://lore.kernel.org/r/20210320232359.941-5-bvanassche@acm.org +Cc: Quinn Tran +Cc: Mike Christie +Reviewed-by: Daniel Wagner +Reviewed-by: Himanshu Madhani +Reviewed-by: Lee Duncan +Signed-off-by: Bart Van Assche +Signed-off-by: Martin K. Petersen +--- + drivers/scsi/qla2xxx/qla_mr.c | 12 ++++++------ + drivers/scsi/qla2xxx/qla_mr.h | 8 ++++++-- + 2 files changed, 12 insertions(+), 8 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_mr.c ++++ b/drivers/scsi/qla2xxx/qla_mr.c +@@ -3267,8 +3267,8 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fx + fx_iocb.req_xfrcnt = + cpu_to_le16(fxio->u.fxiocb.req_len); + put_unaligned_le64(fxio->u.fxiocb.req_dma_handle, +- &fx_iocb.dseg_rq.address); +- fx_iocb.dseg_rq.length = ++ &fx_iocb.dseg_rq[0].address); ++ fx_iocb.dseg_rq[0].length = + cpu_to_le32(fxio->u.fxiocb.req_len); + } + +@@ -3277,8 +3277,8 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fx + fx_iocb.rsp_xfrcnt = + cpu_to_le16(fxio->u.fxiocb.rsp_len); + put_unaligned_le64(fxio->u.fxiocb.rsp_dma_handle, +- &fx_iocb.dseg_rsp.address); +- fx_iocb.dseg_rsp.length = ++ &fx_iocb.dseg_rsp[0].address); ++ fx_iocb.dseg_rsp[0].length = + cpu_to_le32(fxio->u.fxiocb.rsp_len); + } + +@@ -3315,7 +3315,7 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fx + cpu_to_le16(bsg_job->request_payload.sg_cnt); + tot_dsds = + bsg_job->request_payload.sg_cnt; +- cur_dsd = &fx_iocb.dseg_rq; ++ cur_dsd = &fx_iocb.dseg_rq[0]; + avail_dsds = 1; + for_each_sg(bsg_job->request_payload.sg_list, sg, + tot_dsds, index) { +@@ -3370,7 +3370,7 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fx + fx_iocb.rsp_dsdcnt = + cpu_to_le16(bsg_job->reply_payload.sg_cnt); + tot_dsds = bsg_job->reply_payload.sg_cnt; +- cur_dsd = &fx_iocb.dseg_rsp; ++ cur_dsd = &fx_iocb.dseg_rsp[0]; + avail_dsds = 1; + + for_each_sg(bsg_job->reply_payload.sg_list, sg, +--- a/drivers/scsi/qla2xxx/qla_mr.h ++++ b/drivers/scsi/qla2xxx/qla_mr.h +@@ -177,8 +177,12 @@ struct fxdisc_entry_fx00 { + uint8_t flags; + uint8_t reserved_1; + +- struct dsd64 dseg_rq; +- struct dsd64 dseg_rsp; ++ /* ++ * Use array size 1 below to prevent that Coverity complains about ++ * the append_dsd64() calls for the two arrays below. ++ */ ++ struct dsd64 dseg_rq[1]; ++ struct dsd64 dseg_rsp[1]; + + __le32 dataword; + __le32 adapid; diff --git a/patches.suse/scsi-qla2xxx-Update-default-AER-debug-mask.patch b/patches.suse/scsi-qla2xxx-Update-default-AER-debug-mask.patch new file mode 100644 index 0000000..4706517 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Update-default-AER-debug-mask.patch @@ -0,0 +1,31 @@ +From: Quinn Tran +Date: Mon, 29 Mar 2021 01:52:27 -0700 +Subject: scsi: qla2xxx: Update default AER debug mask +Patch-mainline: v5.13-rc1 +Git-commit: 1cbcc531d01f813e6a93cefdc7476f858ff2b301 +References: bsc#1185491 + +Use PCIe AER debug mask as default. + +Link: https://lore.kernel.org/r/20210329085229.4367-11-njavali@marvell.com +Tested-by: Laurence Oberman +Reviewed-by: Himanshu Madhani +Signed-off-by: Quinn Tran +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_dbg.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_dbg.h ++++ b/drivers/scsi/qla2xxx/qla_dbg.h +@@ -309,7 +309,7 @@ struct qla2xxx_fw_dump { + }; + + #define QL_MSGHDR "qla2xxx" +-#define QL_DBG_DEFAULT1_MASK 0x1e400000 ++#define QL_DBG_DEFAULT1_MASK 0x1e600000 + + #define ql_log_fatal 0 /* display fatal errors */ + #define ql_log_warn 1 /* display critical errors */ diff --git a/patches.suse/scsi-qla2xxx-Update-version-to-10.02.00.105-k.patch b/patches.suse/scsi-qla2xxx-Update-version-to-10.02.00.105-k.patch new file mode 100644 index 0000000..c0b262c --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Update-version-to-10.02.00.105-k.patch @@ -0,0 +1,30 @@ +From: Nilesh Javali +Date: Mon, 11 Jan 2021 01:31:34 -0800 +Subject: scsi: qla2xxx: Update version to 10.02.00.105-k +Patch-mainline: v5.12-rc1 +Git-commit: dc0d9b12b8a74f5435097ebc7aafca76ba9cda7a +References: bsc#1185491 + +Link: https://lore.kernel.org/r/20210111093134.1206-8-njavali@marvell.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_version.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_version.h ++++ b/drivers/scsi/qla2xxx/qla_version.h +@@ -7,9 +7,9 @@ + /* + * Driver version + */ +-#define QLA2XXX_VERSION "10.02.00.104-k" ++#define QLA2XXX_VERSION "10.02.00.105-k" + + #define QLA_DRIVER_MAJOR_VER 10 + #define QLA_DRIVER_MINOR_VER 2 + #define QLA_DRIVER_PATCH_VER 0 +-#define QLA_DRIVER_BETA_VER 104 ++#define QLA_DRIVER_BETA_VER 105 diff --git a/patches.suse/scsi-qla2xxx-Update-version-to-10.02.00.106-k.patch b/patches.suse/scsi-qla2xxx-Update-version-to-10.02.00.106-k.patch new file mode 100644 index 0000000..7c28499 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Update-version-to-10.02.00.106-k.patch @@ -0,0 +1,30 @@ +From: Nilesh Javali +Date: Mon, 29 Mar 2021 01:52:29 -0700 +Subject: scsi: qla2xxx: Update version to 10.02.00.106-k +Patch-mainline: v5.13-rc1 +Git-commit: 10d91a15f26e76aec9e6fed31df7e8065f40770f +References: bsc#1185491 + +Link: https://lore.kernel.org/r/20210329085229.4367-13-njavali@marvell.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_version.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_version.h ++++ b/drivers/scsi/qla2xxx/qla_version.h +@@ -7,9 +7,9 @@ + /* + * Driver version + */ +-#define QLA2XXX_VERSION "10.02.00.105-k" ++#define QLA2XXX_VERSION "10.02.00.106-k" + + #define QLA_DRIVER_MAJOR_VER 10 + #define QLA_DRIVER_MINOR_VER 2 + #define QLA_DRIVER_PATCH_VER 0 +-#define QLA_DRIVER_BETA_VER 105 ++#define QLA_DRIVER_BETA_VER 106 diff --git a/patches.suse/scsi-qla2xxx-Use-dma_pool_zalloc.patch b/patches.suse/scsi-qla2xxx-Use-dma_pool_zalloc.patch new file mode 100644 index 0000000..47649b2 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Use-dma_pool_zalloc.patch @@ -0,0 +1,33 @@ +From: Wang Qing +Date: Sat, 13 Mar 2021 10:41:15 +0800 +Subject: scsi: qla2xxx: Use dma_pool_zalloc() +Patch-mainline: v5.13-rc1 +Git-commit: 720efdd23f963612d0a8c7072293aff119c6f915 +References: bsc#1185491 + +Use dma_pool_zalloc() instead of dma_pool_alloc() and memset(). + +Link: https://lore.kernel.org/r/1615603275-14303-1-git-send-email-wangqing@vivo.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Wang Qing +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_os.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -4239,11 +4239,10 @@ qla2x00_mem_alloc(struct qla_hw_data *ha + + /* Get consistent memory allocated for Special Features-CB. */ + if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) { +- ha->sf_init_cb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, ++ ha->sf_init_cb = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, + &ha->sf_init_cb_dma); + if (!ha->sf_init_cb) + goto fail_sf_init_cb; +- memset(ha->sf_init_cb, 0, sizeof(struct init_sf_cb)); + ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0199, + "sf_init_cb=%p.\n", ha->sf_init_cb); + } diff --git a/patches.suse/scsi-qla2xxx-Wait-for-ABTS-response-on-I-O-timeouts-.patch b/patches.suse/scsi-qla2xxx-Wait-for-ABTS-response-on-I-O-timeouts-.patch new file mode 100644 index 0000000..9e3c851 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Wait-for-ABTS-response-on-I-O-timeouts-.patch @@ -0,0 +1,346 @@ +From: Bikash Hazarika +Date: Mon, 11 Jan 2021 01:31:31 -0800 +Subject: scsi: qla2xxx: Wait for ABTS response on I/O timeouts for NVMe +Patch-mainline: v5.12-rc1 +Git-commit: a04658594399e1fa25f984601b77ee840e6aaf01 +References: bsc#1185491 + +FW needs to wait for an ABTS response before completing the I/O. + +Link: https://lore.kernel.org/r/20210111093134.1206-5-njavali@marvell.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Bikash Hazarika +Signed-off-by: Saurav Kashyap +Signed-off-by: Arun Easi +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_def.h | 12 +++++ + drivers/scsi/qla2xxx/qla_fw.h | 27 ++++++++++- + drivers/scsi/qla2xxx/qla_gbl.h | 6 ++ + drivers/scsi/qla2xxx/qla_init.c | 4 + + drivers/scsi/qla2xxx/qla_iocb.c | 6 ++ + drivers/scsi/qla2xxx/qla_isr.c | 9 +++ + drivers/scsi/qla2xxx/qla_mbx.c | 6 ++ + drivers/scsi/qla2xxx/qla_nvme.c | 91 +++++++++++++++++++++++++++++++++++++++- + drivers/scsi/qla2xxx/qla_os.c | 5 ++ + 9 files changed, 160 insertions(+), 6 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_def.h ++++ b/drivers/scsi/qla2xxx/qla_def.h +@@ -2102,6 +2102,7 @@ typedef struct { + #define CS_COMPLETE_CHKCOND 0x30 /* Error? */ + #define CS_IOCB_ERROR 0x31 /* Generic error for IOCB request + failure */ ++#define CS_REJECT_RECEIVED 0x4E /* Reject received */ + #define CS_BAD_PAYLOAD 0x80 /* Driver defined */ + #define CS_UNKNOWN 0x81 /* Driver defined */ + #define CS_RETRY 0x82 /* Driver defined */ +@@ -4151,6 +4152,17 @@ struct qla_hw_data { + /* Bit 21 of fw_attributes decides the MCTP capabilities */ + #define IS_MCTP_CAPABLE(ha) (IS_QLA2031(ha) && \ + ((ha)->fw_attributes_ext[0] & BIT_0)) ++#define QLA_ABTS_FW_ENABLED(_ha) ((_ha)->fw_attributes_ext[0] & BIT_14) ++#define QLA_SRB_NVME_LS(_sp) ((_sp)->type == SRB_NVME_LS) ++#define QLA_SRB_NVME_CMD(_sp) ((_sp)->type == SRB_NVME_CMD) ++#define QLA_NVME_IOS(_sp) (QLA_SRB_NVME_CMD(_sp) || QLA_SRB_NVME_LS(_sp)) ++#define QLA_LS_ABTS_WAIT_ENABLED(_sp) \ ++ (QLA_SRB_NVME_LS(_sp) && QLA_ABTS_FW_ENABLED(_sp->fcport->vha->hw)) ++#define QLA_CMD_ABTS_WAIT_ENABLED(_sp) \ ++ (QLA_SRB_NVME_CMD(_sp) && QLA_ABTS_FW_ENABLED(_sp->fcport->vha->hw)) ++#define QLA_ABTS_WAIT_ENABLED(_sp) \ ++ (QLA_NVME_IOS(_sp) && QLA_ABTS_FW_ENABLED(_sp->fcport->vha->hw)) ++ + #define IS_PI_UNINIT_CAPABLE(ha) (IS_QLA83XX(ha) || IS_QLA27XX(ha)) + #define IS_PI_IPGUARD_CAPABLE(ha) (IS_QLA83XX(ha) || IS_QLA27XX(ha)) + #define IS_PI_DIFB_DIX0_CAPABLE(ha) (0) +--- a/drivers/scsi/qla2xxx/qla_fw.h ++++ b/drivers/scsi/qla2xxx/qla_fw.h +@@ -983,11 +983,18 @@ struct abort_entry_24xx { + + uint32_t handle; /* System handle. */ + +- __le16 nport_handle; /* N_PORT handle. */ +- /* or Completion status. */ ++ union { ++ __le16 nport_handle; /* N_PORT handle. */ ++ __le16 comp_status; /* Completion status. */ ++ }; + + __le16 options; /* Options. */ + #define AOF_NO_ABTS BIT_0 /* Do not send any ABTS. */ ++#define AOF_NO_RRQ BIT_1 /* Do not send RRQ. */ ++#define AOF_ABTS_TIMEOUT BIT_2 /* Disable logout on ABTS timeout. */ ++#define AOF_ABTS_RTY_CNT BIT_3 /* Use driver specified retry count. */ ++#define AOF_RSP_TIMEOUT BIT_4 /* Use specified response timeout. */ ++ + + uint32_t handle_to_abort; /* System handle to abort. */ + +@@ -996,8 +1003,20 @@ struct abort_entry_24xx { + + uint8_t port_id[3]; /* PortID of destination port. */ + uint8_t vp_index; +- +- uint8_t reserved_2[12]; ++ u8 reserved_2[4]; ++ union { ++ struct { ++ __le16 abts_rty_cnt; ++ __le16 rsp_timeout; ++ } drv; ++ struct { ++ u8 ba_rjt_vendorUnique; ++ u8 ba_rjt_reasonCodeExpl; ++ u8 ba_rjt_reasonCode; ++ u8 reserved_3; ++ } fw; ++ }; ++ u8 reserved_4[4]; + }; + + #define ABTS_RCV_TYPE 0x54 +--- a/drivers/scsi/qla2xxx/qla_gbl.h ++++ b/drivers/scsi/qla2xxx/qla_gbl.h +@@ -178,6 +178,7 @@ extern int ql2xexlogins; + extern int ql2xdifbundlinginternalbuffers; + extern int ql2xfulldump_on_mpifail; + extern int ql2xenforce_iocb_limit; ++extern int ql2xabts_wait_nvme; + + extern int qla2x00_loop_reset(scsi_qla_host_t *); + extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int); +@@ -942,6 +943,11 @@ int qla2x00_set_data_rate(scsi_qla_host_ + extern void qla24xx_process_purex_list(struct purex_list *); + extern void qla2x00_dfs_create_rport(scsi_qla_host_t *vha, struct fc_port *fp); + extern void qla2x00_dfs_remove_rport(scsi_qla_host_t *vha, struct fc_port *fp); ++extern void qla_wait_nvme_release_cmd_kref(srb_t *sp); ++extern void qla_nvme_abort_set_option ++ (struct abort_entry_24xx *abt, srb_t *sp); ++extern void qla_nvme_abort_process_comp_status ++ (struct abort_entry_24xx *abt, srb_t *sp); + + /* nvme.c */ + void qla_nvme_unregister_remote_port(struct fc_port *fcport); +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -137,6 +137,10 @@ static void qla24xx_abort_iocb_timeout(v + static void qla24xx_abort_sp_done(srb_t *sp, int res) + { + struct srb_iocb *abt = &sp->u.iocb_cmd; ++ srb_t *orig_sp = sp->cmd_sp; ++ ++ if (orig_sp) ++ qla_wait_nvme_release_cmd_kref(orig_sp); + + del_timer(&sp->u.iocb_cmd.timer); + if (sp->flags & SRB_WAKEUP_ON_COMP) +--- a/drivers/scsi/qla2xxx/qla_iocb.c ++++ b/drivers/scsi/qla2xxx/qla_iocb.c +@@ -3572,6 +3572,7 @@ qla24xx_abort_iocb(srb_t *sp, struct abo + struct srb_iocb *aio = &sp->u.iocb_cmd; + scsi_qla_host_t *vha = sp->vha; + struct req_que *req = sp->qpair->req; ++ srb_t *orig_sp = sp->cmd_sp; + + memset(abt_iocb, 0, sizeof(struct abort_entry_24xx)); + abt_iocb->entry_type = ABORT_IOCB_TYPE; +@@ -3588,6 +3589,11 @@ qla24xx_abort_iocb(srb_t *sp, struct abo + aio->u.abt.cmd_hndl); + abt_iocb->vp_index = vha->vp_idx; + abt_iocb->req_que_no = aio->u.abt.req_que_no; ++ ++ /* need to pass original sp */ ++ if (orig_sp) ++ qla_nvme_abort_set_option(abt_iocb, orig_sp); ++ + /* Send the command to the firmware */ + wmb(); + } +--- a/drivers/scsi/qla2xxx/qla_isr.c ++++ b/drivers/scsi/qla2xxx/qla_isr.c +@@ -6,6 +6,7 @@ + */ + #include "qla_def.h" + #include "qla_target.h" ++#include "qla_gbl.h" + + #include + #include +@@ -3432,6 +3433,7 @@ qla24xx_abort_iocb_entry(scsi_qla_host_t + { + const char func[] = "ABT_IOCB"; + srb_t *sp; ++ srb_t *orig_sp = NULL; + struct srb_iocb *abt; + + sp = qla2x00_get_sp_from_handle(vha, func, req, pkt); +@@ -3439,7 +3441,12 @@ qla24xx_abort_iocb_entry(scsi_qla_host_t + return; + + abt = &sp->u.iocb_cmd; +- abt->u.abt.comp_status = pkt->nport_handle; ++ abt->u.abt.comp_status = le16_to_cpu(pkt->comp_status); ++ orig_sp = sp->cmd_sp; ++ /* Need to pass original sp */ ++ if (orig_sp) ++ qla_nvme_abort_process_comp_status(pkt, orig_sp); ++ + sp->done(sp, 0); + } + +--- a/drivers/scsi/qla2xxx/qla_mbx.c ++++ b/drivers/scsi/qla2xxx/qla_mbx.c +@@ -3244,6 +3244,8 @@ qla24xx_abort_command(srb_t *sp) + abt->vp_index = fcport->vha->vp_idx; + + abt->req_que_no = cpu_to_le16(req->id); ++ /* Need to pass original sp */ ++ qla_nvme_abort_set_option(abt, sp); + + rval = qla2x00_issue_iocb(vha, abt, abt_dma, 0); + if (rval != QLA_SUCCESS) { +@@ -3266,6 +3268,10 @@ qla24xx_abort_command(srb_t *sp) + ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1091, + "Done %s.\n", __func__); + } ++ if (rval == QLA_SUCCESS) ++ qla_nvme_abort_process_comp_status(abt, sp); ++ ++ qla_wait_nvme_release_cmd_kref(sp); + + dma_pool_free(ha->s_dma_pool, abt, abt_dma); + +--- a/drivers/scsi/qla2xxx/qla_nvme.c ++++ b/drivers/scsi/qla2xxx/qla_nvme.c +@@ -246,6 +246,13 @@ static void qla_nvme_abort_work(struct w + __func__, (rval != QLA_SUCCESS) ? "Failed to abort" : "Aborted", + sp, sp->handle, fcport, rval); + ++ /* ++ * Returned before decreasing kref so that I/O requests ++ * are waited until ABTS complete. This kref is decreased ++ * at qla24xx_abort_sp_done function. ++ */ ++ if (ql2xabts_wait_nvme && QLA_ABTS_WAIT_ENABLED(sp)) ++ return; + out: + /* kref_get was done before work was schedule. */ + kref_put(&sp->cmd_kref, sp->put_fn); +@@ -285,7 +292,6 @@ static int qla_nvme_ls_req(struct nvme_f + struct qla_hw_data *ha; + srb_t *sp; + +- + if (!fcport || (fcport && fcport->deleted)) + return rval; + +@@ -592,6 +598,7 @@ static int qla_nvme_post_cmd(struct nvme + sp->put_fn = qla_nvme_release_fcp_cmd_kref; + sp->qpair = qpair; + sp->vha = vha; ++ sp->cmd_sp = sp; + nvme = &sp->u.iocb_cmd; + nvme->u.nvme.desc = fd; + +@@ -745,3 +752,85 @@ int qla_nvme_register_hba(struct scsi_ql + + return ret; + } ++ ++void qla_nvme_abort_set_option(struct abort_entry_24xx *abt, srb_t *orig_sp) ++{ ++ struct qla_hw_data *ha; ++ ++ if (!(ql2xabts_wait_nvme && QLA_ABTS_WAIT_ENABLED(orig_sp))) ++ return; ++ ++ ha = orig_sp->fcport->vha->hw; ++ ++ WARN_ON_ONCE(abt->options & cpu_to_le16(BIT_0)); ++ /* Use Driver Specified Retry Count */ ++ abt->options |= cpu_to_le16(AOF_ABTS_RTY_CNT); ++ abt->drv.abts_rty_cnt = cpu_to_le16(2); ++ /* Use specified response timeout */ ++ abt->options |= cpu_to_le16(AOF_RSP_TIMEOUT); ++ /* set it to 2 * r_a_tov in secs */ ++ abt->drv.rsp_timeout = cpu_to_le16(2 * (ha->r_a_tov / 10)); ++} ++ ++void qla_nvme_abort_process_comp_status(struct abort_entry_24xx *abt, srb_t *orig_sp) ++{ ++ u16 comp_status; ++ struct scsi_qla_host *vha; ++ ++ if (!(ql2xabts_wait_nvme && QLA_ABTS_WAIT_ENABLED(orig_sp))) ++ return; ++ ++ vha = orig_sp->fcport->vha; ++ ++ comp_status = le16_to_cpu(abt->comp_status); ++ switch (comp_status) { ++ case CS_RESET: /* reset event aborted */ ++ case CS_ABORTED: /* IOCB was cleaned */ ++ /* N_Port handle is not currently logged in */ ++ case CS_TIMEOUT: ++ /* N_Port handle was logged out while waiting for ABTS to complete */ ++ case CS_PORT_UNAVAILABLE: ++ /* Firmware found that the port name changed */ ++ case CS_PORT_LOGGED_OUT: ++ /* BA_RJT was received for the ABTS */ ++ case CS_PORT_CONFIG_CHG: ++ ql_dbg(ql_dbg_async + ql_dbg_mbx, vha, 0xf09d, ++ "Abort I/O IOCB completed with error, comp_status=%x\n", ++ comp_status); ++ break; ++ ++ /* BA_RJT was received for the ABTS */ ++ case CS_REJECT_RECEIVED: ++ ql_dbg(ql_dbg_async + ql_dbg_mbx, vha, 0xf09e, ++ "BA_RJT was received for the ABTS rjt_vendorUnique = %u", ++ abt->fw.ba_rjt_vendorUnique); ++ ql_dbg(ql_dbg_async + ql_dbg_mbx, vha, 0xf09e, ++ "ba_rjt_reasonCodeExpl = %u, ba_rjt_reasonCode = %u\n", ++ abt->fw.ba_rjt_reasonCodeExpl, abt->fw.ba_rjt_reasonCode); ++ break; ++ ++ case CS_COMPLETE: ++ ql_dbg(ql_dbg_async + ql_dbg_mbx, vha, 0xf09f, ++ "IOCB request is completed successfully comp_status=%x\n", ++ comp_status); ++ break; ++ ++ case CS_IOCB_ERROR: ++ ql_dbg(ql_dbg_async + ql_dbg_mbx, vha, 0xf0a0, ++ "IOCB request is failed, comp_status=%x\n", comp_status); ++ break; ++ ++ default: ++ ql_dbg(ql_dbg_async + ql_dbg_mbx, vha, 0xf0a1, ++ "Invalid Abort IO IOCB Completion Status %x\n", ++ comp_status); ++ break; ++ } ++} ++ ++inline void qla_wait_nvme_release_cmd_kref(srb_t *orig_sp) ++{ ++ if (!(ql2xabts_wait_nvme && QLA_ABTS_WAIT_ENABLED(orig_sp))) ++ return; ++ kref_put(&orig_sp->cmd_kref, orig_sp->put_fn); ++} +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -328,6 +328,11 @@ MODULE_PARM_DESC(ql2xrdpenable, + "Enables RDP responses. " + "0 - no RDP responses (default). " + "1 - provide RDP responses."); ++int ql2xabts_wait_nvme = 1; ++module_param(ql2xabts_wait_nvme, int, 0444); ++MODULE_PARM_DESC(ql2xabts_wait_nvme, ++ "To wait for ABTS response on I/O timeouts for NVMe. (default: 1)"); ++ + + static void qla2x00_clear_drv_active(struct qla_hw_data *); + static void qla2x00_free_device(scsi_qla_host_t *); diff --git a/patches.suse/scsi-qla2xxx-fc_remote_port_chkready-returns-a-SCSI-.patch b/patches.suse/scsi-qla2xxx-fc_remote_port_chkready-returns-a-SCSI-.patch new file mode 100644 index 0000000..73af3c2 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-fc_remote_port_chkready-returns-a-SCSI-.patch @@ -0,0 +1,31 @@ +From: Hannes Reinecke +Date: Wed, 13 Jan 2021 10:04:58 +0100 +Subject: scsi: qla2xxx: fc_remote_port_chkready() returns a SCSI result value +Patch-mainline: v5.12-rc1 +Git-commit: 6098c3005d5a39c39331ca6c3d9fa7525247166c +References: bsc#1185491 + +fc_remote_port_chkready() returns a SCSI result value, not the port +status. Fix the value returned when the remote port isn't set. + +Link: https://lore.kernel.org/r/20210113090500.129644-34-hare@suse.de +Reviewed-by: Christoph Hellwig +Reviewed-by: Himanshu Madhani +Signed-off-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Acked-by: Daniel Wagner +--- + drivers/scsi/qla2xxx/qla_os.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -963,7 +963,7 @@ qla2xxx_mqueuecommand(struct Scsi_Host * + srb_t *sp; + int rval; + +- rval = rport ? fc_remote_port_chkready(rport) : FC_PORTSTATE_OFFLINE; ++ rval = rport ? fc_remote_port_chkready(rport) : (DID_NO_CONNECT << 16); + if (rval) { + cmd->result = rval; + ql_dbg(ql_dbg_io + ql_dbg_verbose, vha, 0x3076, diff --git a/patches.suse/scsi-smartpqi-correct-driver-removal-with-hba-disks b/patches.suse/scsi-smartpqi-correct-driver-removal-with-hba-disks new file mode 100644 index 0000000..ce096ab --- /dev/null +++ b/patches.suse/scsi-smartpqi-correct-driver-removal-with-hba-disks @@ -0,0 +1,60 @@ +From: Don Brace +Date: Wed, 11 Nov 2020 14:24:39 -0600 +Subject: scsi: smartpqi: Correct driver removal with HBA disks +Git-commit: 1bdf6e9343877030640336d93da08321719bca43 +Patch-mainline: v5.11-rc1 +References: bsc#1178089 + +Correct rmmod hangs when using HBA disks with write cache enabled. + +Do not set controller flag "in_shutdown" during rmmod. SCSI SYNCHRONIZE +CACHE(10) and SCSI SYNCHRONIZE CACHE(16) requests were blocked with +SCSI_MLQUEUE_HOST_BUSY. + +Link: https://lore.kernel.org/r/160512627928.2359.10698615071827614781.stgit@brunhilda +Reviewed-by: Scott Benesh +Reviewed-by: Scott Teel +Signed-off-by: Don Brace +Signed-off-by: Martin K. Petersen +Acked-by: Lee Duncan +--- + drivers/scsi/smartpqi/smartpqi_init.c | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c +index 9d0229656681..531f10853f03 100644 +--- a/drivers/scsi/smartpqi/smartpqi_init.c ++++ b/drivers/scsi/smartpqi/smartpqi_init.c +@@ -345,10 +345,9 @@ static inline void pqi_device_remove_start(struct pqi_scsi_dev *device) + device->in_remove = true; + } + +-static inline bool pqi_device_in_remove(struct pqi_ctrl_info *ctrl_info, +- struct pqi_scsi_dev *device) ++static inline bool pqi_device_in_remove(struct pqi_scsi_dev *device) + { +- return device->in_remove && !ctrl_info->in_shutdown; ++ return device->in_remove; + } + + static inline void pqi_ctrl_shutdown_start(struct pqi_ctrl_info *ctrl_info) +@@ -5347,8 +5346,7 @@ static int pqi_scsi_queue_command(struct Scsi_Host *shost, + + atomic_inc(&device->scsi_cmds_outstanding); + +- if (pqi_ctrl_offline(ctrl_info) || pqi_device_in_remove(ctrl_info, +- device)) { ++ if (pqi_ctrl_offline(ctrl_info) || pqi_device_in_remove(device)) { + set_host_byte(scmd, DID_NO_CONNECT); + pqi_scsi_done(scmd); + return 0; +@@ -8031,8 +8029,6 @@ static void pqi_pci_remove(struct pci_dev *pci_dev) + if (!ctrl_info) + return; + +- ctrl_info->in_shutdown = true; +- + pqi_remove_ctrl(ctrl_info); + } + + diff --git a/patches.suse/scsi-smartpqi-correct-pqi_sas_smp_handler-busy-condition b/patches.suse/scsi-smartpqi-correct-pqi_sas_smp_handler-busy-condition new file mode 100644 index 0000000..4a76923 --- /dev/null +++ b/patches.suse/scsi-smartpqi-correct-pqi_sas_smp_handler-busy-condition @@ -0,0 +1,33 @@ +From: Don Brace +Date: Wed, 11 Nov 2020 14:24:45 -0600 +Subject: scsi: smartpqi: Correct pqi_sas_smp_handler busy condition +Git-commit: 408bdd7e5845d8f3e0dac0dcc18f358835175801 +Patch-mainline: v5.11-rc1 +References: bsc#1178089 + +Remove unbalanced call to pqi_ctrl_unbusy. + +Link: https://lore.kernel.org/r/160512628513.2359.17193493825283879603.stgit@brunhilda +Reviewed-by: Scott Benesh +Reviewed-by: Scott Teel +Reviewed-by: Kevin Barnett +Signed-off-by: Don Brace +Signed-off-by: Martin K. Petersen +Acked-by: Lee Duncan +--- + drivers/scsi/smartpqi/smartpqi_sas_transport.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/scsi/smartpqi/smartpqi_sas_transport.c b/drivers/scsi/smartpqi/smartpqi_sas_transport.c +index 999870eb9ed8..c9b00b3368d7 100644 +--- a/drivers/scsi/smartpqi/smartpqi_sas_transport.c ++++ b/drivers/scsi/smartpqi/smartpqi_sas_transport.c +@@ -549,7 +549,6 @@ void pqi_sas_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, + reslen = pqi_build_sas_smp_handler_reply(smp_buf, job, &error_info); + out: + bsg_job_done(job, rc, reslen); +- pqi_ctrl_unbusy(ctrl_info); + } + struct sas_function_template pqi_sas_transport_functions = { + .get_linkerrors = pqi_sas_get_linkerrors, + diff --git a/patches.suse/scsi-smartpqi-update-version-to-1-2-16-012 b/patches.suse/scsi-smartpqi-update-version-to-1-2-16-012 new file mode 100644 index 0000000..0e41331 --- /dev/null +++ b/patches.suse/scsi-smartpqi-update-version-to-1-2-16-012 @@ -0,0 +1,37 @@ +From: Don Brace +Date: Wed, 11 Nov 2020 14:24:50 -0600 +Subject: scsi: smartpqi: Update version to 1.2.16-012 +Git-commit: 5443bdc4cc777f3629f02e934fef418e9d921809 +Patch-mainline: v5.11-rc1 +References: bsc#1178089 + +Link: https://lore.kernel.org/r/160512629093.2359.13675060282143622110.stgit@brunhilda +Reviewed-by: Scott Benesh +Reviewed-by: Scott Teel +Reviewed-by: Gerry Morong +Signed-off-by: Don Brace +Signed-off-by: Martin K. Petersen +Acked-by: Lee Duncan +--- + drivers/scsi/smartpqi/smartpqi_init.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c +index 531f10853f03..c53f456fbd09 100644 +--- a/drivers/scsi/smartpqi/smartpqi_init.c ++++ b/drivers/scsi/smartpqi/smartpqi_init.c +@@ -33,11 +33,11 @@ + #define BUILD_TIMESTAMP + #endif + +-#define DRIVER_VERSION "1.2.16-010" ++#define DRIVER_VERSION "1.2.16-012" + #define DRIVER_MAJOR 1 + #define DRIVER_MINOR 2 + #define DRIVER_RELEASE 16 +-#define DRIVER_REVISION 10 ++#define DRIVER_REVISION 12 + + #define DRIVER_NAME "Microsemi PQI Driver (v" \ + DRIVER_VERSION BUILD_TIMESTAMP ")" + diff --git a/patches.suse/scsi_add_scsi_host_busy_iter.patch b/patches.suse/scsi_add_scsi_host_busy_iter.patch new file mode 100644 index 0000000..76438a0 --- /dev/null +++ b/patches.suse/scsi_add_scsi_host_busy_iter.patch @@ -0,0 +1,75 @@ +From dcece99e86b1191d2789fb5b5caa4c5b7fc2bfef Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Wed, 11 Mar 2020 00:25:36 +0800 +Subject: [PATCH] scsi: core: add scsi_host_busy_iter() +References: bsc#1179851 +Git-commit: dcece99e86b1191d2789fb5b5caa4c5b7fc2bfef +Patch-mainline: 5.7-rc1 + +Add an iterator scsi_host_busy_iter() to traverse all busy commands. If +locking against concurrent command completions is required, it has to be +provided by the caller. + +Link: https://lore.kernel.org/r/20200228075318.91255-11-hare@suse.de +Signed-off-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +--- + drivers/scsi/hosts.c | 34 ++++++++++++++++++++++++++++++++++ + include/scsi/scsi_host.h | 3 +++ + 2 files changed, 37 insertions(+) + +--- a/drivers/scsi/hosts.c ++++ b/drivers/scsi/hosts.c +@@ -648,3 +648,40 @@ void scsi_flush_work(struct Scsi_Host *s + flush_workqueue(shost->work_q); + } + EXPORT_SYMBOL_GPL(scsi_flush_work); ++ ++struct scsi_host_busy_iter_data { ++ bool (*fn)(struct scsi_cmnd *, void *, bool); ++ void *priv; ++}; ++ ++static bool __scsi_host_busy_iter_fn(struct request *req, void *priv, ++ bool reserved) ++{ ++ struct scsi_host_busy_iter_data *iter_data = priv; ++ struct scsi_cmnd *sc = blk_mq_rq_to_pdu(req); ++ ++ return iter_data->fn(sc, iter_data->priv, reserved); ++} ++ ++/** ++ * scsi_host_busy_iter - Iterate over all busy commands ++ * @shost: Pointer to Scsi_Host. ++ * @fn: Function to call on each busy command ++ * @priv: Data pointer passed to @fn ++ * ++ * If locking against concurrent command completions is required ++ * ithas to be provided by the caller ++ **/ ++void scsi_host_busy_iter(struct Scsi_Host *shost, ++ bool (*fn)(struct scsi_cmnd *, void *, bool), ++ void *priv) ++{ ++ struct scsi_host_busy_iter_data iter_data = { ++ .fn = fn, ++ .priv = priv, ++ }; ++ ++ blk_mq_tagset_busy_iter(&shost->tag_set, __scsi_host_busy_iter_fn, ++ &iter_data); ++} ++EXPORT_SYMBOL_GPL(scsi_host_busy_iter); +--- a/include/scsi/scsi_host.h ++++ b/include/scsi/scsi_host.h +@@ -774,6 +774,9 @@ static inline int scsi_host_scan_allowed + extern void scsi_unblock_requests(struct Scsi_Host *); + extern void scsi_block_requests(struct Scsi_Host *); + ++void scsi_host_busy_iter(struct Scsi_Host *, ++ bool (*fn)(struct scsi_cmnd *, void *, bool), void *priv); ++ + struct class_container; + + /* diff --git a/patches.suse/selftests-powerpc-Fix-L1D-flushing-tests-for-Power10.patch b/patches.suse/selftests-powerpc-Fix-L1D-flushing-tests-for-Power10.patch index 38cdbf3..5ff987d 100644 --- a/patches.suse/selftests-powerpc-Fix-L1D-flushing-tests-for-Power10.patch +++ b/patches.suse/selftests-powerpc-Fix-L1D-flushing-tests-for-Power10.patch @@ -4,8 +4,7 @@ Date: Tue, 23 Feb 2021 17:02:27 +1000 Subject: [PATCH] selftests/powerpc: Fix L1D flushing tests for Power10 References: bsc#1184934 ltc#191460 -Patch-mainline: queued -Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git +Patch-mainline: v5.13-rc1 Git-commit: 3a72c94ebfb1f171eba0715998010678a09ec796 The rfi_flush and entry_flush selftests work by using the PM_LD_MISS_L1 diff --git a/patches.suse/soc-aspeed-fix-a-ternary-sign-expansion-bug.patch b/patches.suse/soc-aspeed-fix-a-ternary-sign-expansion-bug.patch new file mode 100644 index 0000000..34b84d2 --- /dev/null +++ b/patches.suse/soc-aspeed-fix-a-ternary-sign-expansion-bug.patch @@ -0,0 +1,51 @@ +From 5ffa828534036348fa90fb3079ccc0972d202c4a Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Fri, 23 Apr 2021 09:39:19 +0930 +Subject: [PATCH] soc: aspeed: fix a ternary sign expansion bug +Git-commit: 5ffa828534036348fa90fb3079ccc0972d202c4a +Patch-mainline: v5.13-rc1 +References: git-fixes + +The intent here was to return negative error codes but it actually +returns positive values. The problem is that type promotion with +ternary operations is quite complicated. + +"ret" is an int. "copied" is a u32. And the snoop_file_read() function +returns long. What happens is that "ret" is cast to u32 and becomes +positive then it's cast to long and it's still positive. + +Fix this by removing the ternary so that "ret" is type promoted directly +to long. + +Fixes: 3772e5da4454 ("drivers/misc: Aspeed LPC snoop output using misc chardev") +Signed-off-by: Dan Carpenter +Signed-off-by: Joel Stanley +Reviewed-by: Patrick Venture +Link: https://lore.kernel.org/r/YIE90PSXsMTa2Y8n@mwanda +Link: https://lore.kernel.org/r/20210423000919.1249474-1-joel@jms.id.au' +Signed-off-by: Arnd Bergmann +Acked-by: Takashi Iwai + +--- + drivers/soc/aspeed/aspeed-lpc-snoop.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/soc/aspeed/aspeed-lpc-snoop.c b/drivers/soc/aspeed/aspeed-lpc-snoop.c +index 210455efb321..eceeaf8dfbeb 100644 +--- a/drivers/soc/aspeed/aspeed-lpc-snoop.c ++++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c +@@ -94,8 +94,10 @@ static ssize_t snoop_file_read(struct file *file, char __user *buffer, + return -EINTR; + } + ret = kfifo_to_user(&chan->fifo, buffer, count, &copied); ++ if (ret) ++ return ret; + +- return ret ? ret : copied; ++ return copied; + } + + static __poll_t snoop_file_poll(struct file *file, +-- +2.26.2 + diff --git a/patches.suse/soc-qcom-mdt_loader-Detect-truncated-read-of-segment.patch b/patches.suse/soc-qcom-mdt_loader-Detect-truncated-read-of-segment.patch new file mode 100644 index 0000000..476657b --- /dev/null +++ b/patches.suse/soc-qcom-mdt_loader-Detect-truncated-read-of-segment.patch @@ -0,0 +1,48 @@ +From 0648c55e3a21ccd816e99b6600d6199fbf39d23a Mon Sep 17 00:00:00 2001 +From: Bjorn Andersson +Date: Thu, 7 Jan 2021 15:25:26 -0800 +Subject: [PATCH] soc: qcom: mdt_loader: Detect truncated read of segments +Git-commit: 0648c55e3a21ccd816e99b6600d6199fbf39d23a +Patch-mainline: v5.13-rc1 +References: git-fixes + +Given that no validation of how much data the firmware loader read in +for a given segment truncated segment files would best case result in a +hash verification failure, without any indication of what went wrong. + +Improve this by validating that the firmware loader did return the +amount of data requested. + +Fixes: 445c2410a449 ("soc: qcom: mdt_loader: Use request_firmware_into_buf()") +Reviewed-by: Sibi Sankar +Link: https://lore.kernel.org/r/20210107232526.716989-1-bjorn.andersson@linaro.org +Signed-off-by: Bjorn Andersson +Acked-by: Takashi Iwai + +--- + drivers/soc/qcom/mdt_loader.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c +index 2ddaee5ef9cc..eba7f76f9d61 100644 +--- a/drivers/soc/qcom/mdt_loader.c ++++ b/drivers/soc/qcom/mdt_loader.c +@@ -261,6 +261,15 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, + break; + } + ++ if (seg_fw->size != phdr->p_filesz) { ++ dev_err(dev, ++ "failed to load segment %d from truncated file %s\n", ++ i, fw_name); ++ release_firmware(seg_fw); ++ ret = -EINVAL; ++ break; ++ } ++ + release_firmware(seg_fw); + } + +-- +2.26.2 + diff --git a/patches.suse/soc-qcom-mdt_loader-Validate-that-p_filesz-p_memsz.patch b/patches.suse/soc-qcom-mdt_loader-Validate-that-p_filesz-p_memsz.patch new file mode 100644 index 0000000..07f3e3d --- /dev/null +++ b/patches.suse/soc-qcom-mdt_loader-Validate-that-p_filesz-p_memsz.patch @@ -0,0 +1,45 @@ +From 84168d1b54e76a1bcb5192991adde5176abe02e3 Mon Sep 17 00:00:00 2001 +From: Bjorn Andersson +Date: Thu, 7 Jan 2021 15:31:19 -0800 +Subject: [PATCH] soc: qcom: mdt_loader: Validate that p_filesz < p_memsz +Git-commit: 84168d1b54e76a1bcb5192991adde5176abe02e3 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The code validates that segments of p_memsz bytes of a segment will fit +in the provided memory region, but does not validate that p_filesz bytes +will, which means that an incorrectly crafted ELF header might write +beyond the provided memory region. + +Fixes: 051fb70fd4ea ("remoteproc: qcom: Driver for the self-authenticating Hexagon v5") +Reviewed-by: Sibi Sankar +Link: https://lore.kernel.org/r/20210107233119.717173-1-bjorn.andersson@linaro.org +Signed-off-by: Bjorn Andersson +Acked-by: Takashi Iwai + +--- + drivers/soc/qcom/mdt_loader.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c +index 24cd193dec55..2ddaee5ef9cc 100644 +--- a/drivers/soc/qcom/mdt_loader.c ++++ b/drivers/soc/qcom/mdt_loader.c +@@ -230,6 +230,14 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, + break; + } + ++ if (phdr->p_filesz > phdr->p_memsz) { ++ dev_err(dev, ++ "refusing to load segment %d with p_filesz > p_memsz\n", ++ i); ++ ret = -EINVAL; ++ break; ++ } ++ + ptr = mem_region + offset; + + if (phdr->p_filesz && phdr->p_offset < fw->size) { +-- +2.26.2 + diff --git a/patches.suse/soundwire-bus-Fix-device-found-flag-correctly.patch b/patches.suse/soundwire-bus-Fix-device-found-flag-correctly.patch new file mode 100644 index 0000000..dbd27f7 --- /dev/null +++ b/patches.suse/soundwire-bus-Fix-device-found-flag-correctly.patch @@ -0,0 +1,49 @@ +From f03690f4f6992225d05dbd1171212e5be5a370dd Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Tue, 9 Mar 2021 10:48:16 +0000 +Subject: [PATCH] soundwire: bus: Fix device found flag correctly +Git-commit: f03690f4f6992225d05dbd1171212e5be5a370dd +Patch-mainline: v5.13-rc1 +References: git-fixes + +found flag is used to indicate SoundWire devices that are +both enumerated on the bus and available in the device list. +However this flag is not reset correctly after one iteration, +This could miss some of the devices that are enumerated on the +bus but not in device list. So reset this correctly to fix this issue! + +Fixes: d52d7a1be02c ("soundwire: Add Slave status handling helpers") +Signed-off-by: Srinivas Kandagatla +Reviewed-by: Pierre-Louis Bossart +Link: https://lore.kernel.org/r/20210309104816.20350-1-srinivas.kandagatla@linaro.org +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/soundwire/bus.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c +index 1a9e307e6a4c..9bd83c91a873 100644 +--- a/drivers/soundwire/bus.c ++++ b/drivers/soundwire/bus.c +@@ -705,7 +705,7 @@ static int sdw_program_device_num(struct sdw_bus *bus) + struct sdw_slave *slave, *_s; + struct sdw_slave_id id; + struct sdw_msg msg; +- bool found = false; ++ bool found; + int count = 0, ret; + u64 addr; + +@@ -737,6 +737,7 @@ static int sdw_program_device_num(struct sdw_bus *bus) + + sdw_extract_slave_id(bus, addr, &id); + ++ found = false; + /* Now compare with entries */ + list_for_each_entry_safe(slave, _s, &bus->slaves, node) { + if (sdw_compare_devid(slave, id) == 0) { +-- +2.26.2 + diff --git a/patches.suse/soundwire-stream-fix-memory-leak-in-stream-config-er.patch b/patches.suse/soundwire-stream-fix-memory-leak-in-stream-config-er.patch new file mode 100644 index 0000000..8592265 --- /dev/null +++ b/patches.suse/soundwire-stream-fix-memory-leak-in-stream-config-er.patch @@ -0,0 +1,52 @@ +From 48f17f96a81763c7c8bf5500460a359b9939359f Mon Sep 17 00:00:00 2001 +From: Rander Wang +Date: Wed, 31 Mar 2021 08:46:10 +0800 +Subject: [PATCH] soundwire: stream: fix memory leak in stream config error path +Git-commit: 48f17f96a81763c7c8bf5500460a359b9939359f +Patch-mainline: v5.13-rc1 +References: git-fixes + +When stream config is failed, master runtime will release all +slave runtime in the slave_rt_list, but slave runtime is not +added to the list at this time. This patch frees slave runtime +in the config error path to fix the memory leak. + +Fixes: 89e590535f32 ("soundwire: Add support for SoundWire stream management") +Signed-off-by: Rander Wang +Reviewed-by: Keyon Jie +Reviewed-by: Guennadi Liakhovetski +Reviewed-by: Pierre-Louis Bossart +Signed-off-by: Bard Liao +Link: https://lore.kernel.org/r/20210331004610.12242-1-yung-chuan.liao@linux.intel.com +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/soundwire/stream.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c +index 9c064b672745..1eaedaaba094 100644 +--- a/drivers/soundwire/stream.c ++++ b/drivers/soundwire/stream.c +@@ -1375,8 +1375,16 @@ int sdw_stream_add_slave(struct sdw_slave *slave, + } + + ret = sdw_config_stream(&slave->dev, stream, stream_config, true); +- if (ret) ++ if (ret) { ++ /* ++ * sdw_release_master_stream will release s_rt in slave_rt_list in ++ * stream_error case, but s_rt is only added to slave_rt_list ++ * when sdw_config_stream is successful, so free s_rt explicitly ++ * when sdw_config_stream is failed. ++ */ ++ kfree(s_rt); + goto stream_error; ++ } + + list_add_tail(&s_rt->m_rt_node, &m_rt->slave_rt_list); + +-- +2.26.2 + diff --git a/patches.suse/spi-Introduce-dspi_slave_abort-function-for-NXP-s-ds.patch b/patches.suse/spi-Introduce-dspi_slave_abort-function-for-NXP-s-ds.patch new file mode 100644 index 0000000..8ab21b9 --- /dev/null +++ b/patches.suse/spi-Introduce-dspi_slave_abort-function-for-NXP-s-ds.patch @@ -0,0 +1,65 @@ +From: Lukasz Majewski +Date: Tue, 24 Sep 2019 13:05:47 +0200 +Subject: spi: Introduce dspi_slave_abort() function for NXP's dspi SPI driver + +Git-commit: f4b323905d8b3e28b2a9cef9325dbec1b0f7f064 +Patch-mainline: v5.5-rc1 +References: bsc#1167260 + +This change provides the dspi_slave_abort() function, which is a callback +for slave_abort() method of SPI controller generic driver. + +As in the SPI slave mode the transmission is driven by master, any +distortion may cause the slave to enter undefined internal state. +To avoid this problem the dspi_slave_abort() terminates all pending and +ongoing DMA transactions (with sync) and clears internal FIFOs. + +Signed-off-by: Lukasz Majewski +Link: https://lore.kernel.org/r/20190924110547.14770-3-lukma@denx.de +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index bec758e978fb..2c0f211eed87 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1006,6 +1006,25 @@ static void dspi_init(struct fsl_dspi *dspi) + SPI_CTARE_FMSZE(0) | SPI_CTARE_DTCP(1)); + } + ++static int dspi_slave_abort(struct spi_master *master) ++{ ++ struct fsl_dspi *dspi = spi_master_get_devdata(master); ++ ++ /* ++ * Terminate all pending DMA transactions for the SPI working ++ * in SLAVE mode. ++ */ ++ dmaengine_terminate_sync(dspi->dma->chan_rx); ++ dmaengine_terminate_sync(dspi->dma->chan_tx); ++ ++ /* Clear the internal DSPI RX and TX FIFO buffers */ ++ regmap_update_bits(dspi->regmap, SPI_MCR, ++ SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF, ++ SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF); ++ ++ return 0; ++} ++ + static int dspi_probe(struct platform_device *pdev) + { + struct device_node *np = pdev->dev.of_node; +@@ -1030,6 +1049,7 @@ static int dspi_probe(struct platform_device *pdev) + ctlr->dev.of_node = pdev->dev.of_node; + + ctlr->cleanup = dspi_cleanup; ++ ctlr->slave_abort = dspi_slave_abort; + ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST; + + pdata = dev_get_platdata(&pdev->dev); +-- +2.26.2 + diff --git a/patches.suse/spi-fsl-dspi-fix-NULL-pointer-dereference.patch b/patches.suse/spi-fsl-dspi-fix-NULL-pointer-dereference.patch new file mode 100644 index 0000000..d1cd3bb --- /dev/null +++ b/patches.suse/spi-fsl-dspi-fix-NULL-pointer-dereference.patch @@ -0,0 +1,76 @@ +From: Michael Walle +Date: Mon, 28 Sep 2020 10:55:00 +0200 +Subject: spi: fsl-dspi: fix NULL pointer dereference + +Git-commit: 6e3837668e00fb914ac2b43158ef51b027ec385c +Patch-mainline: v5.9 +References: bsc#1167260 + +Since commit 530b5affc675 ("spi: fsl-dspi: fix use-after-free in remove +path") this driver causes a kernel oops: + +[ 1.891065] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000080 +[..] +[ 2.056973] Call trace: +[ 2.059425] dspi_setup+0xc8/0x2e0 +[ 2.062837] spi_setup+0xcc/0x248 +[ 2.066160] spi_add_device+0xb4/0x198 +[ 2.069918] of_register_spi_device+0x250/0x370 +[ 2.074462] spi_register_controller+0x4f4/0x770 +[ 2.079094] dspi_probe+0x5bc/0x7b0 +[ 2.082594] platform_drv_probe+0x5c/0xb0 +[ 2.086615] really_probe+0xec/0x3c0 +[ 2.090200] driver_probe_device+0x60/0xc0 +[ 2.094308] device_driver_attach+0x7c/0x88 +[ 2.098503] __driver_attach+0x60/0xe8 +[ 2.102263] bus_for_each_dev+0x7c/0xd0 +[ 2.106109] driver_attach+0x2c/0x38 +[ 2.109692] bus_add_driver+0x194/0x1f8 +[ 2.113538] driver_register+0x6c/0x128 +[ 2.117385] __platform_driver_register+0x50/0x60 +[ 2.122105] fsl_dspi_driver_init+0x24/0x30 +[ 2.126302] do_one_initcall+0x54/0x2d0 +[ 2.130149] kernel_init_freeable+0x1ec/0x258 +[ 2.134520] kernel_init+0x1c/0x120 +[ 2.138018] ret_from_fork+0x10/0x34 +[ 2.141606] Code: 97e0b11d aa0003f3 b4000680 f94006e0 (f9404000) +[ 2.147723] ---[ end trace 26cf63e6cbba33a8 ]--- + +This is because since this commit, the allocation of the drivers private +data is done explicitly and in this case spi_alloc_master() won't set the +correct pointer. + +Also move the platform_set_drvdata() to have both next to each other. + +Fixes: 530b5affc675 ("spi: fsl-dspi: fix use-after-free in remove path") +Signed-off-by: Michael Walle +Tested-by: Sascha Hauer +Reviewed-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20200928085500.28254-1-michael@walle.cc +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1271,6 +1271,9 @@ static int dspi_probe(struct platform_de + if (!ctlr) + return -ENOMEM; + ++ spi_controller_set_devdata(ctlr, dspi); ++ platform_set_drvdata(pdev, dspi); ++ + dspi->pdev = pdev; + dspi->ctlr = ctlr; + +@@ -1403,8 +1406,6 @@ poll_mode: + ctlr->max_speed_hz = + clk_get_rate(dspi->clk) / dspi->devtype_data->max_clock_factor; + +- platform_set_drvdata(pdev, dspi); +- + ret = spi_register_controller(ctlr); + if (ret != 0) { + dev_err(&pdev->dev, "Problem registering DSPI ctlr\n"); diff --git a/patches.suse/spi-fsl-dspi-fix-use-after-free-in-remove-path.patch b/patches.suse/spi-fsl-dspi-fix-use-after-free-in-remove-path.patch new file mode 100644 index 0000000..22555e0 --- /dev/null +++ b/patches.suse/spi-fsl-dspi-fix-use-after-free-in-remove-path.patch @@ -0,0 +1,61 @@ +From: Sascha Hauer +Date: Wed, 23 Sep 2020 15:10:26 +0200 +Subject: spi: fsl-dspi: fix use-after-free in remove path + +Git-commit: 530b5affc675ade5db4a03f04ed7cd66806c8a1a +Patch-mainline: v5.9-rc7 +References: bsc#1167260 + +spi_unregister_controller() not only unregisters the controller, but +also frees the controller. This will free the driver data with it, so +we must not access it later dspi_remove(). + +Solve this by allocating the driver data separately from the SPI +controller. + +Signed-off-by: Sascha Hauer +Link: https://lore.kernel.org/r/20200923131026.20707-1-s.hauer@pengutronix.de +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1263,11 +1263,14 @@ static int dspi_probe(struct platform_de + void __iomem *base; + bool big_endian; + +- ctlr = spi_alloc_master(&pdev->dev, sizeof(struct fsl_dspi)); ++ dspi = devm_kzalloc(&pdev->dev, sizeof(*dspi), GFP_KERNEL); ++ if (!dspi) ++ return -ENOMEM; ++ ++ ctlr = spi_alloc_master(&pdev->dev, 0); + if (!ctlr) + return -ENOMEM; + +- dspi = spi_controller_get_devdata(ctlr); + dspi->pdev = pdev; + dspi->ctlr = ctlr; + +@@ -1400,7 +1403,7 @@ poll_mode: + ctlr->max_speed_hz = + clk_get_rate(dspi->clk) / dspi->devtype_data->max_clock_factor; + +- platform_set_drvdata(pdev, ctlr); ++ platform_set_drvdata(pdev, dspi); + + ret = spi_register_controller(ctlr); + if (ret != 0) { +@@ -1423,8 +1426,7 @@ out_ctlr_put: + + static int dspi_remove(struct platform_device *pdev) + { +- struct spi_controller *ctlr = platform_get_drvdata(pdev); +- struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); ++ struct fsl_dspi *dspi = platform_get_drvdata(pdev); + + /* Disconnect from the SPI framework */ + spi_unregister_controller(dspi->ctlr); diff --git a/patches.suse/spi-fsl-dspi-fix-wrong-pointer-in-suspend-resume.patch b/patches.suse/spi-fsl-dspi-fix-wrong-pointer-in-suspend-resume.patch new file mode 100644 index 0000000..6ff5bc3 --- /dev/null +++ b/patches.suse/spi-fsl-dspi-fix-wrong-pointer-in-suspend-resume.patch @@ -0,0 +1,66 @@ +From: Zhao Qiang +Date: Tue, 3 Nov 2020 10:05:46 +0800 +Subject: spi: fsl-dspi: fix wrong pointer in suspend/resume + +Git-commit: 9bd77a9ce31dd242fece27219d14fbee5068dd85 +Patch-mainline: v5.10-rc3 +References: bsc#1167260 + +Since commit 530b5affc675 ("spi: fsl-dspi: fix use-after-free in +remove path"), this driver causes a "NULL pointer dereference" +in dspi_suspend/resume. +This is because since this commit, the drivers private data point to +"dspi" instead of "ctlr", the codes in suspend and resume func were +not modified correspondly. + +Fixes: 530b5affc675 ("spi: fsl-dspi: fix use-after-free in remove path") +Signed-off-by: Zhao Qiang +Reviewed-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20201103020546.1822-1-qiang.zhao@nxp.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 3967afa465f0..1a08c1d584ab 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1080,12 +1080,11 @@ MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids); + #ifdef CONFIG_PM_SLEEP + static int dspi_suspend(struct device *dev) + { +- struct spi_controller *ctlr = dev_get_drvdata(dev); +- struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); ++ struct fsl_dspi *dspi = dev_get_drvdata(dev); + + if (dspi->irq) + disable_irq(dspi->irq); +- spi_controller_suspend(ctlr); ++ spi_controller_suspend(dspi->ctlr); + clk_disable_unprepare(dspi->clk); + + pinctrl_pm_select_sleep_state(dev); +@@ -1095,8 +1094,7 @@ static int dspi_suspend(struct device *dev) + + static int dspi_resume(struct device *dev) + { +- struct spi_controller *ctlr = dev_get_drvdata(dev); +- struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); ++ struct fsl_dspi *dspi = dev_get_drvdata(dev); + int ret; + + pinctrl_pm_select_default_state(dev); +@@ -1104,7 +1102,7 @@ static int dspi_resume(struct device *dev) + ret = clk_prepare_enable(dspi->clk); + if (ret) + return ret; +- spi_controller_resume(ctlr); ++ spi_controller_resume(dspi->ctlr); + if (dspi->irq) + enable_irq(dspi->irq); + +-- +2.26.2 + diff --git a/patches.suse/spi-fsl-lpspi-Fix-PM-reference-leak-in-lpspi_prepare.patch b/patches.suse/spi-fsl-lpspi-Fix-PM-reference-leak-in-lpspi_prepare.patch new file mode 100644 index 0000000..f29304d --- /dev/null +++ b/patches.suse/spi-fsl-lpspi-Fix-PM-reference-leak-in-lpspi_prepare.patch @@ -0,0 +1,40 @@ +From a03675497970a93fcf25d81d9d92a59c2d7377a7 Mon Sep 17 00:00:00 2001 +From: Wang Li +Date: Fri, 9 Apr 2021 09:54:30 +0000 +Subject: [PATCH] spi: fsl-lpspi: Fix PM reference leak in lpspi_prepare_xfer_hardware() +Git-commit: a03675497970a93fcf25d81d9d92a59c2d7377a7 +Patch-mainline: v5.13-rc1 +References: git-fixes + +pm_runtime_get_sync will increment pm usage counter even it failed. +Forgetting to putting operation will result in reference leak here. +Fix it by replacing it with pm_runtime_resume_and_get to keep usage +counter balanced. + +Fixes: 944c01a889d9 ("spi: lpspi: enable runtime pm for lpspi") +Reported-by: Hulk Robot +Signed-off-by: Wang Li +Link: https://lore.kernel.org/r/20210409095430.29868-1-wangli74@huawei.com +Signed-off-by: Mark Brown +Acked-by: Takashi Iwai + +--- + drivers/spi/spi-fsl-lpspi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c +index a2886ee44e4c..5d98611dd999 100644 +--- a/drivers/spi/spi-fsl-lpspi.c ++++ b/drivers/spi/spi-fsl-lpspi.c +@@ -200,7 +200,7 @@ static int lpspi_prepare_xfer_hardware(struct spi_controller *controller) + spi_controller_get_devdata(controller); + int ret; + +- ret = pm_runtime_get_sync(fsl_lpspi->dev); ++ ret = pm_runtime_resume_and_get(fsl_lpspi->dev); + if (ret < 0) { + dev_err(fsl_lpspi->dev, "failed to enable clock\n"); + return ret; +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Accelerate-transfers-using-larger-w.patch b/patches.suse/spi-spi-fsl-dspi-Accelerate-transfers-using-larger-w.patch new file mode 100644 index 0000000..bc3f802 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Accelerate-transfers-using-larger-w.patch @@ -0,0 +1,317 @@ +From: Vladimir Oltean +Date: Thu, 5 Mar 2020 00:00:41 +0200 +Subject: spi: spi-fsl-dspi: Accelerate transfers using larger word size if + possible + +Git-commit: 6c1c26ecd9a31c24f9ea7dfb174528141dd32361 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +This patch adds logic in the driver to transmit SPI buffers that use +bits_per_word=8 with a higher bits_per_word count (multiple of 8). + +Currently the following (most common) modes are implemented: + - 8 bits_per_word on 32-bit capable controllers + - 8 bits_per_word on 16-bit capable controllers + - 16 bits_per_word on 32-bit capable controllers + +Transfers which are not accelerated are transferred with a hardware +bits_per_word value equal to the one of the SPI transfer. + +The difference from just extending bits_per_word=32 at the spi_device +driver level is that endianness is different - the SPI core wants to +treat bits_per_word=32 buffers as arrays of u32 (i.e. words in host CPU +endianness). So to preserve endianness when clumping 8x4 bits into +32-bit words, one must perform conversion between CPU and standard (big) +endianness. + +All appearances (both on the wire as well as in the buffers presented to +the peripheral driver) are preserved, just that accesses to the PUSHR +and POPR registers are now more efficient, since the same number of +reads/writes can now carry more data (2x more data on TX, 4x more data +on RX). + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20200304220044.11193-10-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 160 +++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 135 insertions(+), 25 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -227,8 +227,6 @@ struct fsl_dspi { + const void *tx; + void *rx; + u16 tx_cmd; +- u8 bits_per_word; +- u8 bytes_per_word; + const struct fsl_dspi_devtype_data *devtype_data; + + wait_queue_head_t waitq; +@@ -236,9 +234,70 @@ struct fsl_dspi { + + struct fsl_dspi_dma *dma; + ++ int oper_word_size; ++ int oper_bits_per_word; ++ + int words_in_flight; ++ ++ void (*host_to_dev)(struct fsl_dspi *dspi, u32 *txdata); ++ void (*dev_to_host)(struct fsl_dspi *dspi, u32 rxdata); + }; + ++static void dspi_native_host_to_dev(struct fsl_dspi *dspi, u32 *txdata) ++{ ++ memcpy(txdata, dspi->tx, dspi->oper_word_size); ++ dspi->tx += dspi->oper_word_size; ++} ++ ++static void dspi_native_dev_to_host(struct fsl_dspi *dspi, u32 rxdata) ++{ ++ memcpy(dspi->rx, &rxdata, dspi->oper_word_size); ++ dspi->rx += dspi->oper_word_size; ++} ++ ++static void dspi_8on32_host_to_dev(struct fsl_dspi *dspi, u32 *txdata) ++{ ++ *txdata = cpu_to_be32(*(u32 *)dspi->tx); ++ dspi->tx += sizeof(u32); ++} ++ ++static void dspi_8on32_dev_to_host(struct fsl_dspi *dspi, u32 rxdata) ++{ ++ *(u32 *)dspi->rx = be32_to_cpu(rxdata); ++ dspi->rx += sizeof(u32); ++} ++ ++static void dspi_8on16_host_to_dev(struct fsl_dspi *dspi, u32 *txdata) ++{ ++ *txdata = cpu_to_be16(*(u16 *)dspi->tx); ++ dspi->tx += sizeof(u16); ++} ++ ++static void dspi_8on16_dev_to_host(struct fsl_dspi *dspi, u32 rxdata) ++{ ++ *(u16 *)dspi->rx = be16_to_cpu(rxdata); ++ dspi->rx += sizeof(u16); ++} ++ ++static void dspi_16on32_host_to_dev(struct fsl_dspi *dspi, u32 *txdata) ++{ ++ u16 hi = *(u16 *)dspi->tx; ++ u16 lo = *(u16 *)(dspi->tx + 2); ++ ++ *txdata = (u32)hi << 16 | lo; ++ dspi->tx += sizeof(u32); ++} ++ ++static void dspi_16on32_dev_to_host(struct fsl_dspi *dspi, u32 rxdata) ++{ ++ u16 hi = rxdata & 0xffff; ++ u16 lo = rxdata >> 16; ++ ++ *(u16 *)dspi->rx = lo; ++ *(u16 *)(dspi->rx + 2) = hi; ++ dspi->rx += sizeof(u32); ++} ++ + /* + * Pop one word from the TX buffer for pushing into the + * PUSHR register (TX FIFO) +@@ -247,11 +306,9 @@ static u32 dspi_pop_tx(struct fsl_dspi * + { + u32 txdata = 0; + +- if (dspi->tx) { +- memcpy(&txdata, dspi->tx, dspi->bytes_per_word); +- dspi->tx += dspi->bytes_per_word; +- } +- dspi->len -= dspi->bytes_per_word; ++ if (dspi->tx) ++ dspi->host_to_dev(dspi, &txdata); ++ dspi->len -= dspi->oper_word_size; + return txdata; + } + +@@ -273,9 +330,7 @@ static void dspi_push_rx(struct fsl_dspi + { + if (!dspi->rx) + return; +- +- memcpy(dspi->rx, &rxdata, dspi->bytes_per_word); +- dspi->rx += dspi->bytes_per_word; ++ dspi->dev_to_host(dspi, rxdata); + } + + static void dspi_tx_dma_callback(void *arg) +@@ -392,8 +447,8 @@ static int dspi_dma_xfer(struct fsl_dspi + dspi->devtype_data->fifo_size; + while (curr_remaining_bytes) { + /* Check if current transfer fits the DMA buffer */ +- dma->curr_xfer_len = curr_remaining_bytes +- / dspi->bytes_per_word; ++ dma->curr_xfer_len = curr_remaining_bytes / ++ dspi->oper_word_size; + if (dma->curr_xfer_len > bytes_per_buffer) + dma->curr_xfer_len = bytes_per_buffer; + +@@ -403,8 +458,8 @@ static int dspi_dma_xfer(struct fsl_dspi + goto exit; + + } else { +- const int len = +- dma->curr_xfer_len * dspi->bytes_per_word; ++ const int len = dma->curr_xfer_len * ++ dspi->oper_word_size; + curr_remaining_bytes -= len; + message->actual_length += len; + if (curr_remaining_bytes < 0) +@@ -614,7 +669,7 @@ static void dspi_pushr_cmd_write(struct + * generate a new PUSHR command with the final word that will have PCS + * deasserted (not continued) here. + */ +- if (dspi->len > dspi->bytes_per_word) ++ if (dspi->len > dspi->oper_word_size) + cmd |= SPI_PUSHR_CMD_CONT; + regmap_write(dspi->regmap_pushr, PUSHR_CMD, cmd); + } +@@ -626,8 +681,9 @@ static void dspi_pushr_txdata_write(stru + + static void dspi_xspi_write(struct fsl_dspi *dspi, int cnt) + { ++ /* Update CTARE */ + regmap_write(dspi->regmap, SPI_CTARE(0), +- SPI_FRAME_EBITS(dspi->bits_per_word) | ++ SPI_FRAME_EBITS(dspi->oper_bits_per_word) | + SPI_CTARE_DTCP(cnt)); + + /* +@@ -641,7 +697,7 @@ static void dspi_xspi_write(struct fsl_d + u32 data = dspi_pop_tx(dspi); + + dspi_pushr_txdata_write(dspi, data & 0xFFFF); +- if (dspi->bits_per_word > 16) ++ if (dspi->oper_bits_per_word > 16) + dspi_pushr_txdata_write(dspi, data >> 16); + } + } +@@ -652,15 +708,20 @@ static void dspi_xspi_fifo_write(struct + int bytes_in_flight; + + /* In XSPI mode each 32-bit word occupies 2 TX FIFO entries */ +- if (dspi->bits_per_word > 16) ++ if (dspi->oper_word_size == 4) + num_fifo_entries /= 2; + +- dspi->words_in_flight = dspi->len / dspi->bytes_per_word; ++ /* ++ * Integer division intentionally trims off odd (or non-multiple of 4) ++ * numbers of bytes at the end of the buffer, which will be sent next ++ * time using a smaller oper_word_size. ++ */ ++ dspi->words_in_flight = dspi->len / dspi->oper_word_size; + + if (dspi->words_in_flight > num_fifo_entries) + dspi->words_in_flight = num_fifo_entries; + +- bytes_in_flight = dspi->words_in_flight * dspi->bytes_per_word; ++ bytes_in_flight = dspi->words_in_flight * dspi->oper_word_size; + + /* + * If the PCS needs to de-assert (i.e. we're at the end of the buffer +@@ -688,7 +749,7 @@ static void dspi_eoq_fifo_write(struct f + while (dspi->len && num_fifo_entries--) { + dspi->tx_cmd = xfer_cmd; + /* Request EOQF for last transfer in FIFO */ +- if (dspi->len == dspi->bytes_per_word || num_fifo_entries == 0) ++ if (dspi->len == dspi->oper_word_size || num_fifo_entries == 0) + dspi->tx_cmd |= SPI_PUSHR_CMD_EOQ; + /* Write combined TX FIFO and CMD FIFO entry */ + dspi_pushr_write(dspi); +@@ -710,8 +771,56 @@ static void dspi_fifo_read(struct fsl_ds + dspi_push_rx(dspi, dspi_popr_read(dspi)); + } + ++static void dspi_setup_accel(struct fsl_dspi *dspi) ++{ ++ struct spi_transfer *xfer = dspi->cur_transfer; ++ ++ /* Start off with maximum supported by hardware */ ++ if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE) ++ dspi->oper_bits_per_word = 32; ++ else ++ dspi->oper_bits_per_word = 16; ++ ++ /* And go down only if the buffer can't be sent with words this big */ ++ do { ++ if (dspi->len >= DIV_ROUND_UP(dspi->oper_bits_per_word, 8)) ++ break; ++ ++ dspi->oper_bits_per_word /= 2; ++ } while (dspi->oper_bits_per_word > 8); ++ ++ if (xfer->bits_per_word == 8 && dspi->oper_bits_per_word == 32) { ++ dspi->dev_to_host = dspi_8on32_dev_to_host; ++ dspi->host_to_dev = dspi_8on32_host_to_dev; ++ } else if (xfer->bits_per_word == 8 && dspi->oper_bits_per_word == 16) { ++ dspi->dev_to_host = dspi_8on16_dev_to_host; ++ dspi->host_to_dev = dspi_8on16_host_to_dev; ++ } else if (xfer->bits_per_word == 16 && dspi->oper_bits_per_word == 32) { ++ dspi->dev_to_host = dspi_16on32_dev_to_host; ++ dspi->host_to_dev = dspi_16on32_host_to_dev; ++ } else { ++ /* No acceleration needed (8dev_to_host = dspi_native_dev_to_host; ++ dspi->host_to_dev = dspi_native_host_to_dev; ++ dspi->oper_bits_per_word = xfer->bits_per_word; ++ } ++ ++ dspi->oper_word_size = DIV_ROUND_UP(dspi->oper_bits_per_word, 8); ++ ++ /* ++ * Update CTAR here (code is common for both EOQ and XSPI modes). ++ * We will update CTARE in the portion specific to XSPI, when we ++ * also know the preload value (DTCP). ++ */ ++ regmap_write(dspi->regmap, SPI_CTAR(0), ++ dspi->cur_chip->ctar_val | ++ SPI_FRAME_BITS(dspi->oper_bits_per_word)); ++} ++ + static void dspi_fifo_write(struct fsl_dspi *dspi) + { ++ dspi_setup_accel(dspi); ++ + if (dspi->devtype_data->trans_mode == DSPI_EOQ_MODE) + dspi_eoq_fifo_write(dspi); + else +@@ -725,7 +834,7 @@ static int dspi_rxtx(struct fsl_dspi *ds + int bytes_sent; + + /* Update total number of bytes that were transferred */ +- bytes_sent = dspi->words_in_flight * dspi->bytes_per_word; ++ bytes_sent = dspi->words_in_flight * dspi->oper_word_size; + msg->actual_length += bytes_sent; + + dspi_fifo_read(dspi); +@@ -815,13 +924,14 @@ static int dspi_transfer_one_message(str + dspi->tx = transfer->tx_buf; + dspi->rx = transfer->rx_buf; + dspi->len = transfer->len; +- /* Validated transfer specific frame size (defaults applied) */ +- dspi->bits_per_word = transfer->bits_per_word; +- dspi->bytes_per_word = DIV_ROUND_UP(dspi->bits_per_word, 8); + + regmap_update_bits(dspi->regmap, SPI_MCR, + SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF, + SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF); ++ /* ++ * Static CTAR setup for modes that don't dynamically adjust it ++ * via dspi_setup_accel (aka for DMA) ++ */ + regmap_write(dspi->regmap, SPI_CTAR(0), + dspi->cur_chip->ctar_val | + SPI_FRAME_BITS(transfer->bits_per_word)); diff --git a/patches.suse/spi-spi-fsl-dspi-Add-comments-around-dspi_pop_tx-and.patch b/patches.suse/spi-spi-fsl-dspi-Add-comments-around-dspi_pop_tx-and.patch new file mode 100644 index 0000000..3d86667 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Add-comments-around-dspi_pop_tx-and.patch @@ -0,0 +1,55 @@ +From: Vladimir Oltean +Date: Thu, 5 Mar 2020 00:00:36 +0200 +Subject: spi: spi-fsl-dspi: Add comments around dspi_pop_tx and dspi_push_rx + functions + +Git-commit: 8f8303ee05857e1b3084c467dde8bb31c58464bd +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +Their names are confusing, since dspi_pop_tx prepares a word to be +written to the PUSHR register, and dspi_push_rx gets a word from the +POPR register. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20200304220044.11193-5-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index b92c2b84a94b..a8077d4903c7 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -245,6 +245,10 @@ struct fsl_dspi { + struct fsl_dspi_dma *dma; + }; + ++/* ++ * Pop one word from the TX buffer for pushing into the ++ * PUSHR register (TX FIFO) ++ */ + static u32 dspi_pop_tx(struct fsl_dspi *dspi) + { + u32 txdata = 0; +@@ -257,6 +261,7 @@ static u32 dspi_pop_tx(struct fsl_dspi *dspi) + return txdata; + } + ++/* Prepare one TX FIFO entry (txdata plus cmd) */ + static u32 dspi_pop_tx_pushr(struct fsl_dspi *dspi) + { + u16 cmd = dspi->tx_cmd, data = dspi_pop_tx(dspi); +@@ -269,6 +274,7 @@ static u32 dspi_pop_tx_pushr(struct fsl_dspi *dspi) + return cmd << 16 | data; + } + ++/* Push one word to the RX buffer from the POPR register (RX FIFO) */ + static void dspi_push_rx(struct fsl_dspi *dspi, u32 rxdata) + { + if (!dspi->rx) +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Add-support-for-LS1028A.patch b/patches.suse/spi-spi-fsl-dspi-Add-support-for-LS1028A.patch new file mode 100644 index 0000000..84bb708 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Add-support-for-LS1028A.patch @@ -0,0 +1,69 @@ +From: Vladimir Oltean +Date: Wed, 18 Mar 2020 02:16:01 +0200 +Subject: spi: spi-fsl-dspi: Add support for LS1028A + +Git-commit: 138f56ef914b30087c560492e5997f17d494d043 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +This is similar to the DSPI instantiation on LS1028A, except that: + - The A-011218 erratum has been fixed, so DMA works + - The endianness is different, which has implications on XSPI mode + +Some benchmarking with the following command: + +spidev_test --device /dev/spidev2.0 --bpw 8 --size 256 --cpha --iter 10000000 --speed 20000000 + +shows that in DMA mode, it can achieve around 2400 kbps, and in XSPI +mode, the same command goes up to 4700 kbps. This is somewhat to be +expected, since the DMA buffer size is extremely small at 8 bytes, the +winner becomes whomever can prepare the buffers for transmission +quicker, and DMA mode has higher overhead there. So XSPI FIFO mode has +been chosen as the operating mode for this chip. + +Signed-off-by: Vladimir Oltean +Tested-by: Michael Walle +Link: https://lore.kernel.org/r/20200318001603.9650-11-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 5873752a091e..50e41f66a2d7 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -124,6 +124,7 @@ struct fsl_dspi_devtype_data { + enum { + LS1021A, + LS1012A, ++ LS1028A, + LS1043A, + LS1046A, + LS2080A, +@@ -151,6 +152,11 @@ static const struct fsl_dspi_devtype_data devtype_data[] = { + .max_clock_factor = 8, + .fifo_size = 16, + }, ++ [LS1028A] = { ++ .trans_mode = DSPI_XSPI_MODE, ++ .max_clock_factor = 8, ++ .fifo_size = 4, ++ }, + [LS1043A] = { + /* Has A-011218 DMA erratum */ + .trans_mode = DSPI_XSPI_MODE, +@@ -1050,6 +1056,9 @@ static const struct of_device_id fsl_dspi_dt_ids[] = { + }, { + .compatible = "fsl,ls1012a-dspi", + .data = &devtype_data[LS1012A], ++ }, { ++ .compatible = "fsl,ls1028a-dspi", ++ .data = &devtype_data[LS1028A], + }, { + .compatible = "fsl,ls1043a-dspi", + .data = &devtype_data[LS1043A], +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Adding-shutdown-hook.patch b/patches.suse/spi-spi-fsl-dspi-Adding-shutdown-hook.patch new file mode 100644 index 0000000..cf6da6a --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Adding-shutdown-hook.patch @@ -0,0 +1,78 @@ +From: Peng Ma +Date: Fri, 24 Apr 2020 14:12:16 +0800 +Subject: spi: spi-fsl-dspi: Adding shutdown hook + +Git-commit: dc234825997ec6ff05980ca9e2204f4ac3f8d695 +Patch-mainline: v5.8-rc1 +References: bsc#1167260 + +We need to ensure dspi controller could be stopped in order for kexec +to start the next kernel. +So add the shutdown operation support. + +Signed-off-by: Peng Ma +Link: https://lore.kernel.org/r/20200424061216.27445-1-peng.ma@nxp.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 50e41f66a2d7..685afdf9e807 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1,6 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0+ + // + // Copyright 2013 Freescale Semiconductor, Inc. ++// Copyright 2020 NXP + // + // Freescale DSPI driver + // This file contains a driver for the Freescale DSPI +@@ -26,6 +27,9 @@ + #define SPI_MCR_CLR_TXF BIT(11) + #define SPI_MCR_CLR_RXF BIT(10) + #define SPI_MCR_XSPI BIT(3) ++#define SPI_MCR_DIS_TXF BIT(13) ++#define SPI_MCR_DIS_RXF BIT(12) ++#define SPI_MCR_HALT BIT(0) + + #define SPI_TCR 0x08 + #define SPI_TCR_GET_TCNT(x) (((x) & GENMASK(31, 16)) >> 16) +@@ -1417,6 +1421,24 @@ static int dspi_remove(struct platform_device *pdev) + return 0; + } + ++static void dspi_shutdown(struct platform_device *pdev) ++{ ++ struct spi_controller *ctlr = platform_get_drvdata(pdev); ++ struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); ++ ++ /* Disable RX and TX */ ++ regmap_update_bits(dspi->regmap, SPI_MCR, ++ SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF, ++ SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF); ++ ++ /* Stop Running */ ++ regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, SPI_MCR_HALT); ++ ++ dspi_release_dma(dspi); ++ clk_disable_unprepare(dspi->clk); ++ spi_unregister_controller(dspi->ctlr); ++} ++ + static struct platform_driver fsl_dspi_driver = { + .driver.name = DRIVER_NAME, + .driver.of_match_table = fsl_dspi_dt_ids, +@@ -1424,6 +1446,7 @@ static struct platform_driver fsl_dspi_driver = { + .driver.pm = &dspi_pm, + .probe = dspi_probe, + .remove = dspi_remove, ++ .shutdown = dspi_shutdown, + }; + module_platform_driver(fsl_dspi_driver); + +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Always-use-the-TCFQ-devices-in-poll.patch b/patches.suse/spi-spi-fsl-dspi-Always-use-the-TCFQ-devices-in-poll.patch new file mode 100644 index 0000000..ed3d05a --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Always-use-the-TCFQ-devices-in-poll.patch @@ -0,0 +1,85 @@ +From: Vladimir Oltean +Date: Tue, 1 Oct 2019 23:52:16 +0300 +Subject: spi: spi-fsl-dspi: Always use the TCFQ devices in poll mode + +Git-commit: 3c0f9d8bcf47ed33f479cf9dc933d405020aefe4 +Patch-mainline: v5.5-rc1 +References: bsc#1167260 + +With this patch, the "interrupts" property from the device tree bindings +is ignored, even if present, if the driver runs in TCFQ mode. + +Switching to using the DSPI in poll mode has several distinct +benefits: + +- With interrupts, the DSPI driver in TCFQ mode raises an IRQ after each + transmitted word. There is more time wasted for the "waitq" event than + for actual I/O. And the DSPI IRQ count can easily get the largest in + /proc/interrupts on Freescale boards with attached SPI devices. + +- The SPI I/O time is both lower, and more consistently so. Attached to + some Freescale devices are either PTP switches, or SPI RTCs. For + reading time off of a SPI slave device, it is important that all SPI + transfers take a deterministic time to complete. + +- In poll mode there is much less time spent by the CPU in hardirq + context, which helps with the response latency of the system, and at + the same time there is more control over when interrupts must be + disabled (to get a precise timestamp measurement, which will come in a + future patch): win-win. + +On the LS1021A-TSN board, where the SPI device is a SJA1105 PTP switch +(with a bits_per_word=8 driver), I created a "benchmark" where I +periodically transferred a 12-byte message once per second, for 120 +seconds. I then recorded the time before putting the first byte in the +TX FIFO, and the time after reading the last byte from the RX FIFO. That +is the transfer delay in nanoseconds. + +Interrupt mode: + + delay: min 125120 max 168320 mean 150286 std dev 17675.3 + +Poll mode: + + delay: min 69440 max 119040 mean 70312.9 std dev 8065.34 + +Both the mean latency and the standard deviation are more than 50% lower +in poll mode than in interrupt mode, and the 'max' in poll mode is lower +than the 'min' in interrupt mode. This is with an 'ondemand' governor on +an otherwise idle system - therefore running mostly at 600 MHz out of a +max of 1200 MHz. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20191001205216.32115-1-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 2c0f211eed87..c61074502145 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -707,7 +707,7 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id) + regmap_read(dspi->regmap, SPI_SR, &spi_sr); + regmap_write(dspi->regmap, SPI_SR, spi_sr); + +- if (!(spi_sr & (SPI_SR_EOQF | SPI_SR_TCFQF))) ++ if (!(spi_sr & SPI_SR_EOQF)) + return IRQ_NONE; + + if (dspi_rxtx(dspi) == 0) { +@@ -1134,6 +1134,9 @@ static int dspi_probe(struct platform_device *pdev) + + dspi_init(dspi); + ++ if (dspi->devtype_data->trans_mode == DSPI_TCFQ_MODE) ++ goto poll_mode; ++ + dspi->irq = platform_get_irq(pdev, 0); + if (dspi->irq <= 0) { + dev_info(&pdev->dev, +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Avoid-NULL-pointer-in-dspi_slave_ab.patch b/patches.suse/spi-spi-fsl-dspi-Avoid-NULL-pointer-in-dspi_slave_ab.patch new file mode 100644 index 0000000..af72bc2 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Avoid-NULL-pointer-in-dspi_slave_ab.patch @@ -0,0 +1,42 @@ +From: Vladimir Oltean +Date: Wed, 18 Mar 2020 02:15:58 +0200 +Subject: spi: spi-fsl-dspi: Avoid NULL pointer in dspi_slave_abort for non-DMA + mode + +Git-commit: 3d6224e63be39ff26cf416492cb3923cd3d07dd0 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +The driver does not create the dspi->dma structure unless operating in +DSPI_DMA_MODE, so it makes sense to check for that. + +Fixes: f4b323905d8b ("spi: Introduce dspi_slave_abort() function for NXP's dspi SPI driver") +Signed-off-by: Vladimir Oltean +Tested-by: Michael Walle +Link: https://lore.kernel.org/r/20200318001603.9650-8-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index b65c21d048f9..81e22b6eadc7 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1192,8 +1192,10 @@ static int dspi_slave_abort(struct spi_master *master) + * Terminate all pending DMA transactions for the SPI working + * in SLAVE mode. + */ +- dmaengine_terminate_sync(dspi->dma->chan_rx); +- dmaengine_terminate_sync(dspi->dma->chan_tx); ++ if (dspi->devtype_data->trans_mode == DSPI_DMA_MODE) { ++ dmaengine_terminate_sync(dspi->dma->chan_rx); ++ dmaengine_terminate_sync(dspi->dma->chan_tx); ++ } + + /* Clear the internal DSPI RX and TX FIFO buffers */ + regmap_update_bits(dspi->regmap, SPI_MCR, +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Avoid-reading-more-data-than-writte.patch b/patches.suse/spi-spi-fsl-dspi-Avoid-reading-more-data-than-writte.patch new file mode 100644 index 0000000..4db76ee --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Avoid-reading-more-data-than-writte.patch @@ -0,0 +1,52 @@ +From: Vladimir Oltean +Date: Wed, 18 Mar 2020 02:15:55 +0200 +Subject: spi: spi-fsl-dspi: Avoid reading more data than written in EOQ mode + +Git-commit: c6c1e30a789b08de2e075cbd9705e81af3d2c7cc +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +If dspi->words_in_flight is populated with the hardware FIFO size, +then in dspi_fifo_read it will attempt to read more data at the end of a +buffer that is not a multiple of 16 bytes in length. It will probably +time out attempting to do so. + +So limit the num_fifo_entries variable to the actual number of FIFO +entries that is going to be used. + +Fixes: d59c90a2400f ("spi: spi-fsl-dspi: Convert TCFQ users to XSPI FIFO mode") +Signed-off-by: Vladimir Oltean +Tested-by: Michael Walle +Link: https://lore.kernel.org/r/20200318001603.9650-5-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 8f2b73cc6ed7..51224b772680 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -739,13 +739,16 @@ static void dspi_eoq_fifo_write(struct fsl_dspi *dspi) + int num_fifo_entries = dspi->devtype_data->fifo_size; + u16 xfer_cmd = dspi->tx_cmd; + ++ if (num_fifo_entries * dspi->oper_word_size > dspi->len) ++ num_fifo_entries = dspi->len / dspi->oper_word_size; ++ + dspi->words_in_flight = num_fifo_entries; + + /* Fill TX FIFO with as many transfers as possible */ +- while (dspi->len && num_fifo_entries--) { ++ while (num_fifo_entries--) { + dspi->tx_cmd = xfer_cmd; + /* Request EOQF for last transfer in FIFO */ +- if (dspi->len == dspi->oper_word_size || num_fifo_entries == 0) ++ if (num_fifo_entries == 0) + dspi->tx_cmd |= SPI_PUSHR_CMD_EOQ; + /* Write combined TX FIFO and CMD FIFO entry */ + dspi_pushr_write(dspi); +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Change-usage-pattern-of-SPI_MCR_-an.patch b/patches.suse/spi-spi-fsl-dspi-Change-usage-pattern-of-SPI_MCR_-an.patch new file mode 100644 index 0000000..47decb2 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Change-usage-pattern-of-SPI_MCR_-an.patch @@ -0,0 +1,97 @@ +From: Vladimir Oltean +Date: Sun, 18 Aug 2019 21:01:06 +0300 +Subject: spi: spi-fsl-dspi: Change usage pattern of SPI_MCR_* and SPI_CTAR_* + macros + +Git-commit: 06d5dd29976fb49f3236b1e66142680619ea259d +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +These are macros that accept 0 or 1 as argument (a boolean value). Their +use encourages the abuse of complex ternary operations inside their +argument list, which detracts from the code readability. Replace these +with simple if-else statements. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20190818180115.31114-6-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 37 +++++++++++++++++++++---------------- + 1 file changed, 21 insertions(+), 16 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 923ee414d1ae..b0c546841260 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -39,9 +39,9 @@ + + #define SPI_CTAR(x) (0x0c + (((x) & GENMASK(1, 0)) * 4)) + #define SPI_CTAR_FMSZ(x) (((x) << 27) & GENMASK(30, 27)) +-#define SPI_CTAR_CPOL(x) (((x) << 26) & GENMASK(26, 26)) +-#define SPI_CTAR_CPHA(x) (((x) << 25) & GENMASK(25, 25)) +-#define SPI_CTAR_LSBFE(x) (((x) << 24) & GENMASK(24, 24)) ++#define SPI_CTAR_CPOL BIT(26) ++#define SPI_CTAR_CPHA BIT(25) ++#define SPI_CTAR_LSBFE BIT(24) + #define SPI_CTAR_PCSSCK(x) (((x) << 22) & GENMASK(23, 22)) + #define SPI_CTAR_PASC(x) (((x) << 20) & GENMASK(21, 20)) + #define SPI_CTAR_PDT(x) (((x) << 18) & GENMASK(19, 18)) +@@ -587,7 +587,7 @@ static void dspi_tcfq_write(struct fsl_dspi *dspi) + */ + u32 data = dspi_pop_tx(dspi); + +- if (dspi->cur_chip->ctar_val & SPI_CTAR_LSBFE(1)) { ++ if (dspi->cur_chip->ctar_val & SPI_CTAR_LSBFE) { + /* LSB */ + tx_fifo_write(dspi, data & 0xFFFF); + tx_fifo_write(dspi, data >> 16); +@@ -791,18 +791,22 @@ static int dspi_setup(struct spi_device *spi) + /* Set After SCK delay scale values */ + ns_delay_scale(&pasc, &asc, sck_cs_delay, clkrate); + +- chip->ctar_val = SPI_CTAR_CPOL(spi->mode & SPI_CPOL ? 1 : 0) +- | SPI_CTAR_CPHA(spi->mode & SPI_CPHA ? 1 : 0); ++ chip->ctar_val = 0; ++ if (spi->mode & SPI_CPOL) ++ chip->ctar_val |= SPI_CTAR_CPOL; ++ if (spi->mode & SPI_CPHA) ++ chip->ctar_val |= SPI_CTAR_CPHA; + + if (!spi_controller_is_slave(dspi->master)) { +- chip->ctar_val |= SPI_CTAR_LSBFE(spi->mode & +- SPI_LSB_FIRST ? 1 : 0) +- | SPI_CTAR_PCSSCK(pcssck) +- | SPI_CTAR_CSSCK(cssck) +- | SPI_CTAR_PASC(pasc) +- | SPI_CTAR_ASC(asc) +- | SPI_CTAR_PBR(pbr) +- | SPI_CTAR_BR(br); ++ chip->ctar_val |= SPI_CTAR_PCSSCK(pcssck) | ++ SPI_CTAR_CSSCK(cssck) | ++ SPI_CTAR_PASC(pasc) | ++ SPI_CTAR_ASC(asc) | ++ SPI_CTAR_PBR(pbr) | ++ SPI_CTAR_BR(br); ++ ++ if (spi->mode & SPI_LSB_FIRST) ++ chip->ctar_val |= SPI_CTAR_LSBFE; + } + + spi_set_ctldata(spi, chip); +@@ -968,9 +972,10 @@ static const struct regmap_config dspi_xspi_regmap_config[] = { + + static void dspi_init(struct fsl_dspi *dspi) + { +- unsigned int mcr = SPI_MCR_PCSIS | +- (dspi->devtype_data->xspi_mode ? SPI_MCR_XSPI : 0); ++ unsigned int mcr = SPI_MCR_PCSIS; + ++ if (dspi->devtype_data->xspi_mode) ++ mcr |= SPI_MCR_XSPI; + if (!spi_controller_is_slave(dspi->master)) + mcr |= SPI_MCR_MASTER; + +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Convert-TCFQ-users-to-XSPI-FIFO-mod.patch b/patches.suse/spi-spi-fsl-dspi-Convert-TCFQ-users-to-XSPI-FIFO-mod.patch new file mode 100644 index 0000000..f6c5331 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Convert-TCFQ-users-to-XSPI-FIFO-mod.patch @@ -0,0 +1,435 @@ +From: Vladimir Oltean +Date: Thu, 5 Mar 2020 00:00:40 +0200 +Subject: spi: spi-fsl-dspi: Convert TCFQ users to XSPI FIFO mode + +Git-commit: d59c90a2400ffc4d7127a7653f99da1c4a8fa762 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +The Transfer Complete Flag (TCF) interrupt gets raised after each write +to the TX FIFO (PUSHR) which means that it is not possible to devise a +transfer procedure that makes full utilization of the FIFO depth (4 +entries on most controllers, 16 entries on some). + +On the other hand, XSPI mode has a feature called "command cycling", +which allows a single TX command to be run for a pre-specified number of +TX words. When the command cycle ends, the Command Transfer Complete +Flag bit asserts and raises an interrupt. The advantage in this mode is +that the TX FIFO can be better utilized (more words can be batched at +once). + +Other changes brought by this patch: + - The dspi->rx_end variable has been removed, since now the + dspi_fifo_write function sets up dspi->words_in_flight, so + dspi_fifo_read knows how much to read without overrunning the RX + buffer. + - Stop using poll mode unconditionally for TCFQ mode, since XSPI mode + is a little less efficient than that, and so, poll mode doesn't bring + as many improvements for XSPI. + - Stop relying on the hardware transfer counter (SPI_TCR_GET_TCNT) and + instead increment the message->actual_length based on the newly + introduced dspi->words_in_flight variable. + - The CTARE register is now written in the hotpath instead of just at + transfer init time, since it contains the DTCP field (transfer + preload - the counter indicating how many txdata words will follow), + which is a dynamic value. + +Due to the fact that the Chip Select toggling setting is part of the +command written to the TX FIFO, the ending word of each buffer needs to +be sent via its own TX command, so that we have a chance to emit a +1-word command with deasserted PCS. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20200304220044.11193-9-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 183 ++++++++++++++++++++++++--------------------- + 1 file changed, 98 insertions(+), 85 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -72,6 +72,7 @@ + #define SPI_RSER 0x30 + #define SPI_RSER_TCFQE BIT(31) + #define SPI_RSER_EOQFE BIT(28) ++#define SPI_RSER_CMDTCFE BIT(23) + + #define SPI_PUSHR 0x34 + #define SPI_PUSHR_CMD_CONT BIT(15) +@@ -114,14 +115,13 @@ struct chip_data { + + enum dspi_trans_mode { + DSPI_EOQ_MODE = 0, +- DSPI_TCFQ_MODE, ++ DSPI_XSPI_MODE, + DSPI_DMA_MODE, + }; + + struct fsl_dspi_devtype_data { + enum dspi_trans_mode trans_mode; + u8 max_clock_factor; +- bool xspi_mode; + int fifo_size; + int dma_bufsize; + }; +@@ -147,37 +147,32 @@ static const struct fsl_dspi_devtype_dat + }, + [LS1021A] = { + /* Has A-011218 DMA erratum */ +- .trans_mode = DSPI_TCFQ_MODE, ++ .trans_mode = DSPI_XSPI_MODE, + .max_clock_factor = 8, +- .xspi_mode = true, + .fifo_size = 4, + }, + [LS1012A] = { + /* Has A-011218 DMA erratum */ +- .trans_mode = DSPI_TCFQ_MODE, ++ .trans_mode = DSPI_XSPI_MODE, + .max_clock_factor = 8, +- .xspi_mode = true, + .fifo_size = 16, + }, + [LS1043A] = { + /* Has A-011218 DMA erratum */ +- .trans_mode = DSPI_TCFQ_MODE, ++ .trans_mode = DSPI_XSPI_MODE, + .max_clock_factor = 8, +- .xspi_mode = true, + .fifo_size = 16, + }, + [LS1046A] = { + /* Has A-011218 DMA erratum */ +- .trans_mode = DSPI_TCFQ_MODE, ++ .trans_mode = DSPI_XSPI_MODE, + .max_clock_factor = 8, +- .xspi_mode = true, + .fifo_size = 16, + }, + [LS2080A] = { + .trans_mode = DSPI_DMA_MODE, + .dma_bufsize = 8, + .max_clock_factor = 8, +- .xspi_mode = true, + .fifo_size = 4, + }, + [LS2085A] = { +@@ -190,7 +185,6 @@ static const struct fsl_dspi_devtype_dat + .trans_mode = DSPI_DMA_MODE, + .dma_bufsize = 8, + .max_clock_factor = 8, +- .xspi_mode = true, + .fifo_size = 4, + }, + [MCF5441X] = { +@@ -232,7 +226,6 @@ struct fsl_dspi { + size_t len; + const void *tx; + void *rx; +- void *rx_end; + u16 tx_cmd; + u8 bits_per_word; + u8 bytes_per_word; +@@ -242,6 +235,8 @@ struct fsl_dspi { + u32 waitflags; + + struct fsl_dspi_dma *dma; ++ ++ int words_in_flight; + }; + + /* +@@ -609,7 +604,17 @@ static void dspi_pushr_cmd_write(struct + { + u16 cmd = dspi->tx_cmd; + +- if (dspi->len > 0) ++ /* ++ * The only time when the PCS doesn't need continuation after this word ++ * is when it's last. We need to look ahead, because we actually call ++ * dspi_pop_tx (the function that decrements dspi->len) _after_ ++ * dspi_pushr_cmd_write with XSPI mode. As for how much in advance? One ++ * word is enough. If there's more to transmit than that, ++ * dspi_xspi_write will know to split the FIFO writes in 2, and ++ * generate a new PUSHR command with the final word that will have PCS ++ * deasserted (not continued) here. ++ */ ++ if (dspi->len > dspi->bytes_per_word) + cmd |= SPI_PUSHR_CMD_CONT; + regmap_write(dspi->regmap_pushr, PUSHR_CMD, cmd); + } +@@ -619,98 +624,117 @@ static void dspi_pushr_txdata_write(stru + regmap_write(dspi->regmap_pushr, PUSHR_TX, txdata); + } + +-static void dspi_tcfq_write(struct fsl_dspi *dspi) ++static void dspi_xspi_write(struct fsl_dspi *dspi, int cnt) + { +- /* Clear transfer count */ +- dspi->tx_cmd |= SPI_PUSHR_CMD_CTCNT; ++ regmap_write(dspi->regmap, SPI_CTARE(0), ++ SPI_FRAME_EBITS(dspi->bits_per_word) | ++ SPI_CTARE_DTCP(cnt)); ++ ++ /* ++ * Write the CMD FIFO entry first, and then the two ++ * corresponding TX FIFO entries (or one...). ++ */ ++ dspi_pushr_cmd_write(dspi); + +- if (dspi->devtype_data->xspi_mode && dspi->bits_per_word > 16) { +- /* Write the CMD FIFO entry first, and then the two +- * corresponding TX FIFO entries. +- */ ++ /* Fill TX FIFO with as many transfers as possible */ ++ while (cnt--) { + u32 data = dspi_pop_tx(dspi); + +- dspi_pushr_cmd_write(dspi); + dspi_pushr_txdata_write(dspi, data & 0xFFFF); +- dspi_pushr_txdata_write(dspi, data >> 16); +- } else { +- /* Write one entry to both TX FIFO and CMD FIFO +- * simultaneously. +- */ +- dspi_pushr_write(dspi); ++ if (dspi->bits_per_word > 16) ++ dspi_pushr_txdata_write(dspi, data >> 16); + } + } + +-static u32 dspi_popr_read(struct fsl_dspi *dspi) ++static void dspi_xspi_fifo_write(struct fsl_dspi *dspi) + { +- u32 rxdata = 0; ++ int num_fifo_entries = dspi->devtype_data->fifo_size; ++ int bytes_in_flight; + +- regmap_read(dspi->regmap, SPI_POPR, &rxdata); +- return rxdata; +-} ++ /* In XSPI mode each 32-bit word occupies 2 TX FIFO entries */ ++ if (dspi->bits_per_word > 16) ++ num_fifo_entries /= 2; + +-static void dspi_tcfq_read(struct fsl_dspi *dspi) +-{ +- dspi_push_rx(dspi, dspi_popr_read(dspi)); ++ dspi->words_in_flight = dspi->len / dspi->bytes_per_word; ++ ++ if (dspi->words_in_flight > num_fifo_entries) ++ dspi->words_in_flight = num_fifo_entries; ++ ++ bytes_in_flight = dspi->words_in_flight * dspi->bytes_per_word; ++ ++ /* ++ * If the PCS needs to de-assert (i.e. we're at the end of the buffer ++ * and cs_change does not want the PCS to stay on), then we need a new ++ * PUSHR command, since this one (for the body of the buffer) ++ * necessarily has the CONT bit set. ++ * So send one word less during this go, to force a split and a command ++ * with a single word next time, when CONT will be unset. ++ */ ++ if (bytes_in_flight == dspi->len && dspi->words_in_flight > 1 && ++ !(dspi->tx_cmd & SPI_PUSHR_CMD_CONT)) ++ dspi->words_in_flight--; ++ ++ dspi_xspi_write(dspi, dspi->words_in_flight); + } + +-static void dspi_eoq_write(struct fsl_dspi *dspi) ++static void dspi_eoq_fifo_write(struct fsl_dspi *dspi) + { +- int fifo_size = dspi->devtype_data->fifo_size; ++ int num_fifo_entries = dspi->devtype_data->fifo_size; + u16 xfer_cmd = dspi->tx_cmd; + ++ dspi->words_in_flight = num_fifo_entries; ++ + /* Fill TX FIFO with as many transfers as possible */ +- while (dspi->len && fifo_size--) { ++ while (dspi->len && num_fifo_entries--) { + dspi->tx_cmd = xfer_cmd; + /* Request EOQF for last transfer in FIFO */ +- if (dspi->len == dspi->bytes_per_word || fifo_size == 0) ++ if (dspi->len == dspi->bytes_per_word || num_fifo_entries == 0) + dspi->tx_cmd |= SPI_PUSHR_CMD_EOQ; +- /* Clear transfer count for first transfer in FIFO */ +- if (fifo_size == (dspi->devtype_data->fifo_size - 1)) +- dspi->tx_cmd |= SPI_PUSHR_CMD_CTCNT; + /* Write combined TX FIFO and CMD FIFO entry */ + dspi_pushr_write(dspi); + } + } + +-static void dspi_eoq_read(struct fsl_dspi *dspi) ++static u32 dspi_popr_read(struct fsl_dspi *dspi) + { +- int fifo_size = dspi->devtype_data->fifo_size; ++ u32 rxdata = 0; ++ ++ regmap_read(dspi->regmap, SPI_POPR, &rxdata); ++ return rxdata; ++} + ++static void dspi_fifo_read(struct fsl_dspi *dspi) ++{ + /* Read one FIFO entry and push to rx buffer */ +- while ((dspi->rx < dspi->rx_end) && fifo_size--) ++ while (dspi->words_in_flight--) + dspi_push_rx(dspi, dspi_popr_read(dspi)); + } + ++static void dspi_fifo_write(struct fsl_dspi *dspi) ++{ ++ if (dspi->devtype_data->trans_mode == DSPI_EOQ_MODE) ++ dspi_eoq_fifo_write(dspi); ++ else ++ dspi_xspi_fifo_write(dspi); ++} ++ + static int dspi_rxtx(struct fsl_dspi *dspi) + { ++ struct spi_transfer *xfer = dspi->cur_transfer; + struct spi_message *msg = dspi->cur_msg; +- enum dspi_trans_mode trans_mode; +- u16 spi_tcnt; +- u32 spi_tcr; ++ int bytes_sent; + +- /* Get transfer counter (in number of SPI transfers). It was +- * reset to 0 when transfer(s) were started. +- */ +- regmap_read(dspi->regmap, SPI_TCR, &spi_tcr); +- spi_tcnt = SPI_TCR_GET_TCNT(spi_tcr); + /* Update total number of bytes that were transferred */ +- msg->actual_length += spi_tcnt * dspi->bytes_per_word; ++ bytes_sent = dspi->words_in_flight * dspi->bytes_per_word; ++ msg->actual_length += bytes_sent; + +- trans_mode = dspi->devtype_data->trans_mode; +- if (trans_mode == DSPI_EOQ_MODE) +- dspi_eoq_read(dspi); +- else if (trans_mode == DSPI_TCFQ_MODE) +- dspi_tcfq_read(dspi); ++ dspi_fifo_read(dspi); + + if (!dspi->len) + /* Success! */ + return 0; + +- if (trans_mode == DSPI_EOQ_MODE) +- dspi_eoq_write(dspi); +- else if (trans_mode == DSPI_TCFQ_MODE) +- dspi_tcfq_write(dspi); ++ dspi_fifo_write(dspi); + + return -EINPROGRESS; + } +@@ -724,7 +748,7 @@ static int dspi_poll(struct fsl_dspi *ds + regmap_read(dspi->regmap, SPI_SR, &spi_sr); + regmap_write(dspi->regmap, SPI_SR, spi_sr); + +- if (spi_sr & (SPI_SR_EOQF | SPI_SR_TCFQF)) ++ if (spi_sr & (SPI_SR_EOQF | SPI_SR_CMDTCF)) + break; + } while (--tries); + +@@ -742,7 +766,7 @@ static irqreturn_t dspi_interrupt(int ir + regmap_read(dspi->regmap, SPI_SR, &spi_sr); + regmap_write(dspi->regmap, SPI_SR, spi_sr); + +- if (!(spi_sr & SPI_SR_EOQF)) ++ if (!(spi_sr & (SPI_SR_EOQF | SPI_SR_CMDTCF))) + return IRQ_NONE; + + if (dspi_rxtx(dspi) == 0) { +@@ -790,7 +814,6 @@ static int dspi_transfer_one_message(str + + dspi->tx = transfer->tx_buf; + dspi->rx = transfer->rx_buf; +- dspi->rx_end = dspi->rx + transfer->len; + dspi->len = transfer->len; + /* Validated transfer specific frame size (defaults applied) */ + dspi->bits_per_word = transfer->bits_per_word; +@@ -802,20 +825,16 @@ static int dspi_transfer_one_message(str + regmap_write(dspi->regmap, SPI_CTAR(0), + dspi->cur_chip->ctar_val | + SPI_FRAME_BITS(transfer->bits_per_word)); +- if (dspi->devtype_data->xspi_mode) +- regmap_write(dspi->regmap, SPI_CTARE(0), +- SPI_FRAME_EBITS(transfer->bits_per_word) | +- SPI_CTARE_DTCP(1)); + + trans_mode = dspi->devtype_data->trans_mode; + switch (trans_mode) { + case DSPI_EOQ_MODE: + regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_EOQFE); +- dspi_eoq_write(dspi); ++ dspi_fifo_write(dspi); + break; +- case DSPI_TCFQ_MODE: +- regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_TCFQE); +- dspi_tcfq_write(dspi); ++ case DSPI_XSPI_MODE: ++ regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_CMDTCFE); ++ dspi_fifo_write(dspi); + break; + case DSPI_DMA_MODE: + regmap_write(dspi->regmap, SPI_RSER, +@@ -1042,16 +1061,13 @@ static void dspi_init(struct fsl_dspi *d + { + unsigned int mcr = SPI_MCR_PCSIS; + +- if (dspi->devtype_data->xspi_mode) ++ if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE) + mcr |= SPI_MCR_XSPI; + if (!spi_controller_is_slave(dspi->ctlr)) + mcr |= SPI_MCR_MASTER; + + regmap_write(dspi->regmap, SPI_MCR, mcr); + regmap_write(dspi->regmap, SPI_SR, SPI_SR_CLEAR); +- if (dspi->devtype_data->xspi_mode) +- regmap_write(dspi->regmap, SPI_CTARE(0), +- SPI_CTARE_FMSZE(0) | SPI_CTARE_DTCP(1)); + } + + static int dspi_slave_abort(struct spi_master *master) +@@ -1147,7 +1163,7 @@ static int dspi_probe(struct platform_de + } + } + +- if (dspi->devtype_data->xspi_mode) ++ if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE) + ctlr->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); + else + ctlr->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16); +@@ -1159,7 +1175,7 @@ static int dspi_probe(struct platform_de + goto out_ctlr_put; + } + +- if (dspi->devtype_data->xspi_mode) ++ if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE) + regmap_config = &dspi_xspi_regmap_config[0]; + else + regmap_config = &dspi_regmap_config; +@@ -1171,7 +1187,7 @@ static int dspi_probe(struct platform_de + goto out_ctlr_put; + } + +- if (dspi->devtype_data->xspi_mode) { ++ if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE) { + dspi->regmap_pushr = devm_regmap_init_mmio( + &pdev->dev, base + SPI_PUSHR, + &dspi_xspi_regmap_config[1]); +@@ -1196,9 +1212,6 @@ static int dspi_probe(struct platform_de + + dspi_init(dspi); + +- if (dspi->devtype_data->trans_mode == DSPI_TCFQ_MODE) +- goto poll_mode; +- + dspi->irq = platform_get_irq(pdev, 0); + if (dspi->irq <= 0) { + dev_info(&pdev->dev, diff --git a/patches.suse/spi-spi-fsl-dspi-Convert-the-instantiations-that-sup.patch b/patches.suse/spi-spi-fsl-dspi-Convert-the-instantiations-that-sup.patch new file mode 100644 index 0000000..0dda88f --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Convert-the-instantiations-that-sup.patch @@ -0,0 +1,82 @@ +From: Vladimir Oltean +Date: Mon, 2 Mar 2020 02:19:58 +0200 +Subject: spi: spi-fsl-dspi: Convert the instantiations that support it to DMA + +Git-commit: 0feaf8f5afe057c397a440e76865b3d746dc9f7e +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +The A-011218 eDMA/DSPI erratum affects most of the older Layerscape SoCs +with DSPI, and its workaround is a bit intrusive. + +After this patch, there are no users of TCFQ mode that don't also +support XSPI (previously there was LS2085A). + +Signed-off-by: Vladimir Oltean +Message-Id: <20200302001958.11105-7-olteanv@gmail.com> +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index c26a42f8ecbc..c357c3247232 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -147,42 +147,49 @@ static const struct fsl_dspi_devtype_data devtype_data[] = { + .fifo_size = 4, + }, + [LS1021A] = { ++ /* Has A-011218 DMA erratum */ + .trans_mode = DSPI_TCFQ_MODE, + .max_clock_factor = 8, + .xspi_mode = true, + .fifo_size = 4, + }, + [LS1012A] = { ++ /* Has A-011218 DMA erratum */ + .trans_mode = DSPI_TCFQ_MODE, + .max_clock_factor = 8, + .xspi_mode = true, + .fifo_size = 16, + }, + [LS1043A] = { ++ /* Has A-011218 DMA erratum */ + .trans_mode = DSPI_TCFQ_MODE, + .max_clock_factor = 8, + .xspi_mode = true, + .fifo_size = 16, + }, + [LS1046A] = { ++ /* Has A-011218 DMA erratum */ + .trans_mode = DSPI_TCFQ_MODE, + .max_clock_factor = 8, + .xspi_mode = true, + .fifo_size = 16, + }, + [LS2080A] = { +- .trans_mode = DSPI_TCFQ_MODE, ++ .trans_mode = DSPI_DMA_MODE, ++ .dma_bufsize = 8, + .max_clock_factor = 8, + .xspi_mode = true, + .fifo_size = 4, + }, + [LS2085A] = { +- .trans_mode = DSPI_TCFQ_MODE, ++ .trans_mode = DSPI_DMA_MODE, ++ .dma_bufsize = 8, + .max_clock_factor = 8, + .fifo_size = 4, + }, + [LX2160A] = { +- .trans_mode = DSPI_TCFQ_MODE, ++ .trans_mode = DSPI_DMA_MODE, ++ .dma_bufsize = 8, + .max_clock_factor = 8, + .xspi_mode = true, + .fifo_size = 4, +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Demistify-magic-value-in-SPI_SR_CLE.patch b/patches.suse/spi-spi-fsl-dspi-Demistify-magic-value-in-SPI_SR_CLE.patch new file mode 100644 index 0000000..cfa4339 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Demistify-magic-value-in-SPI_SR_CLE.patch @@ -0,0 +1,48 @@ +From: Vladimir Oltean +Date: Sun, 18 Aug 2019 21:01:05 +0300 +Subject: spi: spi-fsl-dspi: Demistify magic value in SPI_SR_CLEAR + +Git-commit: 9e6f784e66cb865de25a1f5fd1706a45d9e298a7 +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +This patch adds the field definitions for the SPI_SR register. The SPI +status register is write-1-to-clear and this value is written at init +time. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20190818180115.31114-5-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 179a9818619f..923ee414d1ae 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -57,7 +57,19 @@ + #define SPI_SR 0x2c + #define SPI_SR_TCFQF BIT(31) + #define SPI_SR_EOQF BIT(28) +-#define SPI_SR_CLEAR 0x9aaf0000 ++#define SPI_SR_TFUF BIT(27) ++#define SPI_SR_TFFF BIT(25) ++#define SPI_SR_CMDTCF BIT(23) ++#define SPI_SR_SPEF BIT(21) ++#define SPI_SR_RFOF BIT(19) ++#define SPI_SR_TFIWF BIT(18) ++#define SPI_SR_RFDF BIT(17) ++#define SPI_SR_CMDFFF BIT(16) ++#define SPI_SR_CLEAR (SPI_SR_TCFQF | SPI_SR_EOQF | \ ++ SPI_SR_TFUF | SPI_SR_TFFF | \ ++ SPI_SR_CMDTCF | SPI_SR_SPEF | \ ++ SPI_SR_RFOF | SPI_SR_TFIWF | \ ++ SPI_SR_RFDF | SPI_SR_CMDFFF) + + #define SPI_RSER_TFFFE BIT(25) + #define SPI_RSER_TFFFD BIT(24) +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Don-t-access-reserved-fields-in-SPI.patch b/patches.suse/spi-spi-fsl-dspi-Don-t-access-reserved-fields-in-SPI.patch new file mode 100644 index 0000000..e5a80b0 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Don-t-access-reserved-fields-in-SPI.patch @@ -0,0 +1,54 @@ +From: Vladimir Oltean +Date: Wed, 18 Mar 2020 02:15:52 +0200 +Subject: spi: spi-fsl-dspi: Don't access reserved fields in SPI_MCR + +Git-commit: 4fcc7c2292def2fcb21a9644969583771c52724e +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +The SPI_MCR_PCSIS macro assumes that the controller has a number of chip +select signals equal to 6. That is not always the case, but actually is +described through the driver-specific "spi-num-chipselects" device tree +binding. LS1028A for example only has 4 chip selects. + +Don't write to the upper bits of the PCSIS field, which are reserved in +the reference manual. + +Fixes: 349ad66c0ab0 ("spi:Add Freescale DSPI driver for Vybrid VF610 platform") +Signed-off-by: Vladimir Oltean +Tested-by: Michael Walle +Link: https://lore.kernel.org/r/20200318001603.9650-2-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 50e3382f0c50..6ca35881881b 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -22,7 +22,7 @@ + + #define SPI_MCR 0x00 + #define SPI_MCR_MASTER BIT(31) +-#define SPI_MCR_PCSIS (0x3F << 16) ++#define SPI_MCR_PCSIS(x) ((x) << 16) + #define SPI_MCR_CLR_TXF BIT(11) + #define SPI_MCR_CLR_RXF BIT(10) + #define SPI_MCR_XSPI BIT(3) +@@ -1200,7 +1200,10 @@ static const struct regmap_config dspi_xspi_regmap_config[] = { + + static void dspi_init(struct fsl_dspi *dspi) + { +- unsigned int mcr = SPI_MCR_PCSIS; ++ unsigned int mcr; ++ ++ /* Set idle states for all chip select signals to high */ ++ mcr = SPI_MCR_PCSIS(GENMASK(dspi->ctlr->num_chipselect - 1, 0)); + + if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE) + mcr |= SPI_MCR_XSPI; +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Don-t-mask-off-undefined-bits.patch b/patches.suse/spi-spi-fsl-dspi-Don-t-mask-off-undefined-bits.patch new file mode 100644 index 0000000..7a4a4ad --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Don-t-mask-off-undefined-bits.patch @@ -0,0 +1,36 @@ +From: Vladimir Oltean +Date: Thu, 5 Mar 2020 00:00:35 +0200 +Subject: spi: spi-fsl-dspi: Don't mask off undefined bits + +Git-commit: 5542bd797190d5d77f1ad3a6df9628f26d117b31 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +This is a useless operation, and if the driver needs to do that, there's +something deeply wrong going on. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20200304220044.11193-4-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 63ec1d634d08..b92c2b84a94b 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -274,9 +274,6 @@ static void dspi_push_rx(struct fsl_dspi *dspi, u32 rxdata) + if (!dspi->rx) + return; + +- /* Mask off undefined bits */ +- rxdata &= (1 << dspi->bits_per_word) - 1; +- + memcpy(dspi->rx, &rxdata, dspi->bytes_per_word); + dspi->rx += dspi->bytes_per_word; + } +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Exit-the-ISR-with-IRQ_NONE-when-it-.patch b/patches.suse/spi-spi-fsl-dspi-Exit-the-ISR-with-IRQ_NONE-when-it-.patch index 9ad8534..492d1b1 100644 --- a/patches.suse/spi-spi-fsl-dspi-Exit-the-ISR-with-IRQ_NONE-when-it-.patch +++ b/patches.suse/spi-spi-fsl-dspi-Exit-the-ISR-with-IRQ_NONE-when-it-.patch @@ -1,9 +1,10 @@ From: Vladimir Oltean -Date: Fri, 23 Aug 2019 00:24:50 +0300 +Date: Fri, 23 Aug 2019 00:15:11 +0300 Subject: spi: spi-fsl-dspi: Exit the ISR with IRQ_NONE when it's not ours -Git-commit: d41f36a6464a85c06ad920703d878e4491d2c023 -Patch-mainline: 5.4-rc1 -References: bnc#1151927 5.3.4 + +Git-commit: 37b4100180641968056cb4e034cebc38338e8652 +Patch-mainline: v5.4-rc1 +References: bsc#1167260 The DSPI interrupt can be shared between two controllers at least on the LX2160A. In that case, the driver for one controller might misbehave and @@ -12,26 +13,26 @@ the bits in the status register have been asserted. Fixes: 13aed2392741 ("spi: spi-fsl-dspi: use IRQF_SHARED mode to request IRQ") Signed-off-by: Vladimir Oltean -Link: https://lore.kernel.org/r/20190822212450.21420-2-olteanv@gmail.com +Link: https://lore.kernel.org/r/20190822211514.19288-3-olteanv@gmail.com Signed-off-by: Mark Brown -Cc: stable@vger.kernel.org -Signed-off-by: Jiri Slaby +Signed-off-by: Mian Yousaf Kaukab --- - drivers/spi/spi-fsl-dspi.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) + drivers/spi/spi-fsl-dspi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index c90db7db4121..6ef2279a3699 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c -@@ -886,9 +886,11 @@ static irqreturn_t dspi_interrupt(int ir - trans_mode); - } - } -+ -+ return IRQ_HANDLED; - } +@@ -659,7 +659,7 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id) + regmap_write(dspi->regmap, SPI_SR, spi_sr); -- return IRQ_HANDLED; -+ return IRQ_NONE; - } + if (!(spi_sr & (SPI_SR_EOQF | SPI_SR_TCFQF))) +- return IRQ_HANDLED; ++ return IRQ_NONE; - static const struct of_device_id fsl_dspi_dt_ids[] = { + /* Get transfer counter (in number of SPI transfers). It was + * reset to 0 when transfer(s) were started. +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Fix-16-bit-word-order-in-32-bit-XSP.patch b/patches.suse/spi-spi-fsl-dspi-Fix-16-bit-word-order-in-32-bit-XSP.patch index decf6c7..8040d3e 100644 --- a/patches.suse/spi-spi-fsl-dspi-Fix-16-bit-word-order-in-32-bit-XSP.patch +++ b/patches.suse/spi-spi-fsl-dspi-Fix-16-bit-word-order-in-32-bit-XSP.patch @@ -1,10 +1,10 @@ -From ca59d5a51690d5b9340343dc36792a252e9414ae Mon Sep 17 00:00:00 2001 From: Vladimir Oltean Date: Sat, 28 Dec 2019 15:55:36 +0200 -Subject: [PATCH] spi: spi-fsl-dspi: Fix 16-bit word order in 32-bit XSPI mode +Subject: spi: spi-fsl-dspi: Fix 16-bit word order in 32-bit XSPI mode + Git-commit: ca59d5a51690d5b9340343dc36792a252e9414ae Patch-mainline: v5.5-rc6 -References: git-fixes +References: bsc#1167260 When used in Extended SPI mode on LS1021A, the DSPI controller wants to have the least significant 16-bit word written first to the TX FIFO. @@ -53,8 +53,7 @@ Signed-off-by: Vladimir Oltean Link: https://lore.kernel.org/r/20191228135536.14284-1-olteanv@gmail.com Signed-off-by: Mark Brown Cc: stable@vger.kernel.org -Acked-by: Takashi Iwai - +Signed-off-by: Mian Yousaf Kaukab --- drivers/spi/spi-fsl-dspi.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) @@ -90,5 +89,5 @@ index 9c3934efe2b1..8428b69c858b 100644 /* Write one entry to both TX FIFO and CMD FIFO * simultaneously. -- -2.16.4 +2.26.2 diff --git a/patches.suse/spi-spi-fsl-dspi-Fix-bits-per-word-acceleration-in-D.patch b/patches.suse/spi-spi-fsl-dspi-Fix-bits-per-word-acceleration-in-D.patch new file mode 100644 index 0000000..73e773a --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Fix-bits-per-word-acceleration-in-D.patch @@ -0,0 +1,263 @@ +From: Vladimir Oltean +Date: Wed, 18 Mar 2020 02:15:54 +0200 +Subject: spi: spi-fsl-dspi: Fix bits-per-word acceleration in DMA mode + +Git-commit: a957499bd437720d082d92657b7eb5cf5a62e893 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +In DMA mode, dspi_setup_accel does not get called, which results in the +dspi->oper_word_size variable (which is used by dspi_dma_xfer) to not be +initialized properly. + +Because oper_word_size is zero, a few calculations end up being +incorrect, and the DMA transfer eventually times out instead of sending +anything on the wire. + +Set up native transfers (or 8-on-16 acceleration) using dspi_setup_accel +for DMA mode too. + +Also take the opportunity and simplify the DMA buffer handling a little +bit. + +Fixes: 6c1c26ecd9a3 ("spi: spi-fsl-dspi: Accelerate transfers using larger word size if possible") +Signed-off-by: Vladimir Oltean +Tested-by: Michael Walle +Link: https://lore.kernel.org/r/20200318001603.9650-4-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 86 ++++++++++++++++----------------------------- + 1 file changed, 32 insertions(+), 54 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -119,7 +119,6 @@ struct fsl_dspi_devtype_data { + enum dspi_trans_mode trans_mode; + u8 max_clock_factor; + int fifo_size; +- int dma_bufsize; + }; + + enum { +@@ -138,7 +137,6 @@ static const struct fsl_dspi_devtype_dat + [VF610] = { + .trans_mode = DSPI_DMA_MODE, + .max_clock_factor = 2, +- .dma_bufsize = 4096, + .fifo_size = 4, + }, + [LS1021A] = { +@@ -167,19 +165,16 @@ static const struct fsl_dspi_devtype_dat + }, + [LS2080A] = { + .trans_mode = DSPI_DMA_MODE, +- .dma_bufsize = 8, + .max_clock_factor = 8, + .fifo_size = 4, + }, + [LS2085A] = { + .trans_mode = DSPI_DMA_MODE, +- .dma_bufsize = 8, + .max_clock_factor = 8, + .fifo_size = 4, + }, + [LX2160A] = { + .trans_mode = DSPI_DMA_MODE, +- .dma_bufsize = 8, + .max_clock_factor = 8, + .fifo_size = 4, + }, +@@ -191,9 +186,6 @@ static const struct fsl_dspi_devtype_dat + }; + + struct fsl_dspi_dma { +- /* Length of transfer in words of dspi->fifo_size */ +- u32 curr_xfer_len; +- + u32 *tx_dma_buf; + struct dma_chan *chan_tx; + dma_addr_t tx_dma_phys; +@@ -351,7 +343,7 @@ static void dspi_rx_dma_callback(void *a + int i; + + if (dspi->rx) { +- for (i = 0; i < dma->curr_xfer_len; i++) ++ for (i = 0; i < dspi->words_in_flight; i++) + dspi_push_rx(dspi, dspi->dma->rx_dma_buf[i]); + } + +@@ -365,12 +357,12 @@ static int dspi_next_xfer_dma_submit(str + int time_left; + int i; + +- for (i = 0; i < dma->curr_xfer_len; i++) ++ for (i = 0; i < dspi->words_in_flight; i++) + dspi->dma->tx_dma_buf[i] = dspi_pop_tx_pushr(dspi); + + dma->tx_desc = dmaengine_prep_slave_single(dma->chan_tx, + dma->tx_dma_phys, +- dma->curr_xfer_len * ++ dspi->words_in_flight * + DMA_SLAVE_BUSWIDTH_4_BYTES, + DMA_MEM_TO_DEV, + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); +@@ -388,7 +380,7 @@ static int dspi_next_xfer_dma_submit(str + + dma->rx_desc = dmaengine_prep_slave_single(dma->chan_rx, + dma->rx_dma_phys, +- dma->curr_xfer_len * ++ dspi->words_in_flight * + DMA_SLAVE_BUSWIDTH_4_BYTES, + DMA_DEV_TO_MEM, + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); +@@ -436,46 +428,42 @@ static int dspi_next_xfer_dma_submit(str + return 0; + } + ++static void dspi_setup_accel(struct fsl_dspi *dspi); ++ + static int dspi_dma_xfer(struct fsl_dspi *dspi) + { + struct spi_message *message = dspi->cur_msg; + struct device *dev = &dspi->pdev->dev; +- struct fsl_dspi_dma *dma = dspi->dma; +- int curr_remaining_bytes; +- int bytes_per_buffer; + int ret = 0; + +- curr_remaining_bytes = dspi->len; +- bytes_per_buffer = dspi->devtype_data->dma_bufsize / +- dspi->devtype_data->fifo_size; +- while (curr_remaining_bytes) { +- /* Check if current transfer fits the DMA buffer */ +- dma->curr_xfer_len = curr_remaining_bytes / +- dspi->oper_word_size; +- if (dma->curr_xfer_len > bytes_per_buffer) +- dma->curr_xfer_len = bytes_per_buffer; ++ /* ++ * dspi->len gets decremented by dspi_pop_tx_pushr in ++ * dspi_next_xfer_dma_submit ++ */ ++ while (dspi->len) { ++ /* Figure out operational bits-per-word for this chunk */ ++ dspi_setup_accel(dspi); ++ ++ dspi->words_in_flight = dspi->len / dspi->oper_word_size; ++ if (dspi->words_in_flight > dspi->devtype_data->fifo_size) ++ dspi->words_in_flight = dspi->devtype_data->fifo_size; ++ ++ message->actual_length += dspi->words_in_flight * ++ dspi->oper_word_size; + + ret = dspi_next_xfer_dma_submit(dspi); + if (ret) { + dev_err(dev, "DMA transfer failed\n"); +- goto exit; +- +- } else { +- const int len = dma->curr_xfer_len * +- dspi->oper_word_size; +- curr_remaining_bytes -= len; +- message->actual_length += len; +- if (curr_remaining_bytes < 0) +- curr_remaining_bytes = 0; ++ break; + } + } + +-exit: + return ret; + } + + static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr) + { ++ int dma_bufsize = dspi->devtype_data->fifo_size * 2; + struct device *dev = &dspi->pdev->dev; + struct dma_slave_config cfg; + struct fsl_dspi_dma *dma; +@@ -500,16 +488,16 @@ static int dspi_request_dma(struct fsl_d + } + + dma->tx_dma_buf = dma_alloc_coherent(dma->chan_tx->device->dev, +- dspi->devtype_data->dma_bufsize, +- &dma->tx_dma_phys, GFP_KERNEL); ++ dma_bufsize, &dma->tx_dma_phys, ++ GFP_KERNEL); + if (!dma->tx_dma_buf) { + ret = -ENOMEM; + goto err_tx_dma_buf; + } + + dma->rx_dma_buf = dma_alloc_coherent(dma->chan_rx->device->dev, +- dspi->devtype_data->dma_bufsize, +- &dma->rx_dma_phys, GFP_KERNEL); ++ dma_bufsize, &dma->rx_dma_phys, ++ GFP_KERNEL); + if (!dma->rx_dma_buf) { + ret = -ENOMEM; + goto err_rx_dma_buf; +@@ -546,12 +534,10 @@ static int dspi_request_dma(struct fsl_d + + err_slave_config: + dma_free_coherent(dma->chan_rx->device->dev, +- dspi->devtype_data->dma_bufsize, +- dma->rx_dma_buf, dma->rx_dma_phys); ++ dma_bufsize, dma->rx_dma_buf, dma->rx_dma_phys); + err_rx_dma_buf: + dma_free_coherent(dma->chan_tx->device->dev, +- dspi->devtype_data->dma_bufsize, +- dma->tx_dma_buf, dma->tx_dma_phys); ++ dma_bufsize, dma->tx_dma_buf, dma->tx_dma_phys); + err_tx_dma_buf: + dma_release_channel(dma->chan_tx); + err_tx_channel: +@@ -565,6 +551,7 @@ err_tx_channel: + + static void dspi_release_dma(struct fsl_dspi *dspi) + { ++ int dma_bufsize = dspi->devtype_data->fifo_size * 2; + struct fsl_dspi_dma *dma = dspi->dma; + + if (!dma) +@@ -572,15 +559,13 @@ static void dspi_release_dma(struct fsl_ + + if (dma->chan_tx) { + dma_unmap_single(dma->chan_tx->device->dev, dma->tx_dma_phys, +- dspi->devtype_data->dma_bufsize, +- DMA_TO_DEVICE); ++ dma_bufsize, DMA_TO_DEVICE); + dma_release_channel(dma->chan_tx); + } + + if (dma->chan_rx) { + dma_unmap_single(dma->chan_rx->device->dev, dma->rx_dma_phys, +- dspi->devtype_data->dma_bufsize, +- DMA_FROM_DEVICE); ++ dma_bufsize, DMA_FROM_DEVICE); + dma_release_channel(dma->chan_rx); + } + } +@@ -832,7 +817,7 @@ no_accel: + dspi->oper_word_size = DIV_ROUND_UP(dspi->oper_bits_per_word, 8); + + /* +- * Update CTAR here (code is common for both EOQ and XSPI modes). ++ * Update CTAR here (code is common for EOQ, XSPI and DMA modes). + * We will update CTARE in the portion specific to XSPI, when we + * also know the preload value (DTCP). + */ +@@ -952,13 +937,6 @@ static int dspi_transfer_one_message(str + regmap_update_bits(dspi->regmap, SPI_MCR, + SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF, + SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF); +- /* +- * Static CTAR setup for modes that don't dynamically adjust it +- * via dspi_setup_accel (aka for DMA) +- */ +- regmap_write(dspi->regmap, SPI_CTAR(0), +- dspi->cur_chip->ctar_val | +- SPI_FRAME_BITS(transfer->bits_per_word)); + + trans_mode = dspi->devtype_data->trans_mode; + switch (trans_mode) { diff --git a/patches.suse/spi-spi-fsl-dspi-Fix-code-alignment.patch b/patches.suse/spi-spi-fsl-dspi-Fix-code-alignment.patch new file mode 100644 index 0000000..eacac61 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Fix-code-alignment.patch @@ -0,0 +1,575 @@ +From: Vladimir Oltean +Date: Sun, 18 Aug 2019 21:01:02 +0300 +Subject: spi: spi-fsl-dspi: Fix code alignment + +Git-commit: 50fcd84764fcbf40b64a8798f12a3d4be5dc8777 +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +This is a cosmetic patch that changes nothing except makes sure the code +is aligned to the same column, which makes it easier to the eye. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20190818180115.31114-2-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 370 ++++++++++++++++++------------------- + 1 file changed, 185 insertions(+), 185 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 96eacbe6ae27..0adfff9cedd1 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -28,7 +28,7 @@ + #include + #include + +-#define DRIVER_NAME "fsl-dspi" ++#define DRIVER_NAME "fsl-dspi" + + #ifdef CONFIG_M5441x + #define DSPI_FIFO_SIZE 16 +@@ -37,101 +37,101 @@ + #endif + #define DSPI_DMA_BUFSIZE (DSPI_FIFO_SIZE * 1024) + +-#define SPI_MCR 0x00 +-#define SPI_MCR_MASTER (1 << 31) +-#define SPI_MCR_PCSIS (0x3F << 16) +-#define SPI_MCR_CLR_TXF (1 << 11) +-#define SPI_MCR_CLR_RXF (1 << 10) +-#define SPI_MCR_XSPI (1 << 3) +- +-#define SPI_TCR 0x08 +-#define SPI_TCR_GET_TCNT(x) (((x) & 0xffff0000) >> 16) +- +-#define SPI_CTAR(x) (0x0c + (((x) & 0x3) * 4)) +-#define SPI_CTAR_FMSZ(x) (((x) & 0x0000000f) << 27) +-#define SPI_CTAR_CPOL(x) ((x) << 26) +-#define SPI_CTAR_CPHA(x) ((x) << 25) +-#define SPI_CTAR_LSBFE(x) ((x) << 24) +-#define SPI_CTAR_PCSSCK(x) (((x) & 0x00000003) << 22) +-#define SPI_CTAR_PASC(x) (((x) & 0x00000003) << 20) +-#define SPI_CTAR_PDT(x) (((x) & 0x00000003) << 18) +-#define SPI_CTAR_PBR(x) (((x) & 0x00000003) << 16) +-#define SPI_CTAR_CSSCK(x) (((x) & 0x0000000f) << 12) +-#define SPI_CTAR_ASC(x) (((x) & 0x0000000f) << 8) +-#define SPI_CTAR_DT(x) (((x) & 0x0000000f) << 4) +-#define SPI_CTAR_BR(x) ((x) & 0x0000000f) +-#define SPI_CTAR_SCALE_BITS 0xf +- +-#define SPI_CTAR0_SLAVE 0x0c +- +-#define SPI_SR 0x2c +-#define SPI_SR_EOQF 0x10000000 +-#define SPI_SR_TCFQF 0x80000000 +-#define SPI_SR_CLEAR 0x9aaf0000 +- +-#define SPI_RSER_TFFFE BIT(25) +-#define SPI_RSER_TFFFD BIT(24) +-#define SPI_RSER_RFDFE BIT(17) +-#define SPI_RSER_RFDFD BIT(16) +- +-#define SPI_RSER 0x30 +-#define SPI_RSER_EOQFE 0x10000000 +-#define SPI_RSER_TCFQE 0x80000000 +- +-#define SPI_PUSHR 0x34 +-#define SPI_PUSHR_CMD_CONT (1 << 15) +-#define SPI_PUSHR_CONT (SPI_PUSHR_CMD_CONT << 16) +-#define SPI_PUSHR_CMD_CTAS(x) (((x) & 0x0003) << 12) +-#define SPI_PUSHR_CTAS(x) (SPI_PUSHR_CMD_CTAS(x) << 16) +-#define SPI_PUSHR_CMD_EOQ (1 << 11) +-#define SPI_PUSHR_EOQ (SPI_PUSHR_CMD_EOQ << 16) +-#define SPI_PUSHR_CMD_CTCNT (1 << 10) +-#define SPI_PUSHR_CTCNT (SPI_PUSHR_CMD_CTCNT << 16) +-#define SPI_PUSHR_CMD_PCS(x) ((1 << x) & 0x003f) +-#define SPI_PUSHR_PCS(x) (SPI_PUSHR_CMD_PCS(x) << 16) +-#define SPI_PUSHR_TXDATA(x) ((x) & 0x0000ffff) +- +-#define SPI_PUSHR_SLAVE 0x34 +- +-#define SPI_POPR 0x38 +-#define SPI_POPR_RXDATA(x) ((x) & 0x0000ffff) +- +-#define SPI_TXFR0 0x3c +-#define SPI_TXFR1 0x40 +-#define SPI_TXFR2 0x44 +-#define SPI_TXFR3 0x48 +-#define SPI_RXFR0 0x7c +-#define SPI_RXFR1 0x80 +-#define SPI_RXFR2 0x84 +-#define SPI_RXFR3 0x88 +- +-#define SPI_CTARE(x) (0x11c + (((x) & 0x3) * 4)) +-#define SPI_CTARE_FMSZE(x) (((x) & 0x1) << 16) +-#define SPI_CTARE_DTCP(x) ((x) & 0x7ff) +- +-#define SPI_SREX 0x13c +- +-#define SPI_FRAME_BITS(bits) SPI_CTAR_FMSZ((bits) - 1) +-#define SPI_FRAME_BITS_MASK SPI_CTAR_FMSZ(0xf) +-#define SPI_FRAME_BITS_16 SPI_CTAR_FMSZ(0xf) +-#define SPI_FRAME_BITS_8 SPI_CTAR_FMSZ(0x7) +- +-#define SPI_FRAME_EBITS(bits) SPI_CTARE_FMSZE(((bits) - 1) >> 4) +-#define SPI_FRAME_EBITS_MASK SPI_CTARE_FMSZE(1) ++#define SPI_MCR 0x00 ++#define SPI_MCR_MASTER (1 << 31) ++#define SPI_MCR_PCSIS (0x3F << 16) ++#define SPI_MCR_CLR_TXF (1 << 11) ++#define SPI_MCR_CLR_RXF (1 << 10) ++#define SPI_MCR_XSPI (1 << 3) ++ ++#define SPI_TCR 0x08 ++#define SPI_TCR_GET_TCNT(x) (((x) & 0xffff0000) >> 16) ++ ++#define SPI_CTAR(x) (0x0c + (((x) & 0x3) * 4)) ++#define SPI_CTAR_FMSZ(x) (((x) & 0x0000000f) << 27) ++#define SPI_CTAR_CPOL(x) ((x) << 26) ++#define SPI_CTAR_CPHA(x) ((x) << 25) ++#define SPI_CTAR_LSBFE(x) ((x) << 24) ++#define SPI_CTAR_PCSSCK(x) (((x) & 0x00000003) << 22) ++#define SPI_CTAR_PASC(x) (((x) & 0x00000003) << 20) ++#define SPI_CTAR_PDT(x) (((x) & 0x00000003) << 18) ++#define SPI_CTAR_PBR(x) (((x) & 0x00000003) << 16) ++#define SPI_CTAR_CSSCK(x) (((x) & 0x0000000f) << 12) ++#define SPI_CTAR_ASC(x) (((x) & 0x0000000f) << 8) ++#define SPI_CTAR_DT(x) (((x) & 0x0000000f) << 4) ++#define SPI_CTAR_BR(x) ((x) & 0x0000000f) ++#define SPI_CTAR_SCALE_BITS 0xf ++ ++#define SPI_CTAR0_SLAVE 0x0c ++ ++#define SPI_SR 0x2c ++#define SPI_SR_EOQF 0x10000000 ++#define SPI_SR_TCFQF 0x80000000 ++#define SPI_SR_CLEAR 0x9aaf0000 ++ ++#define SPI_RSER_TFFFE BIT(25) ++#define SPI_RSER_TFFFD BIT(24) ++#define SPI_RSER_RFDFE BIT(17) ++#define SPI_RSER_RFDFD BIT(16) ++ ++#define SPI_RSER 0x30 ++#define SPI_RSER_EOQFE 0x10000000 ++#define SPI_RSER_TCFQE 0x80000000 ++ ++#define SPI_PUSHR 0x34 ++#define SPI_PUSHR_CMD_CONT (1 << 15) ++#define SPI_PUSHR_CONT (SPI_PUSHR_CMD_CONT << 16) ++#define SPI_PUSHR_CMD_CTAS(x) (((x) & 0x0003) << 12) ++#define SPI_PUSHR_CTAS(x) (SPI_PUSHR_CMD_CTAS(x) << 16) ++#define SPI_PUSHR_CMD_EOQ (1 << 11) ++#define SPI_PUSHR_EOQ (SPI_PUSHR_CMD_EOQ << 16) ++#define SPI_PUSHR_CMD_CTCNT (1 << 10) ++#define SPI_PUSHR_CTCNT (SPI_PUSHR_CMD_CTCNT << 16) ++#define SPI_PUSHR_CMD_PCS(x) ((1 << x) & 0x003f) ++#define SPI_PUSHR_PCS(x) (SPI_PUSHR_CMD_PCS(x) << 16) ++#define SPI_PUSHR_TXDATA(x) ((x) & 0x0000ffff) ++ ++#define SPI_PUSHR_SLAVE 0x34 ++ ++#define SPI_POPR 0x38 ++#define SPI_POPR_RXDATA(x) ((x) & 0x0000ffff) ++ ++#define SPI_TXFR0 0x3c ++#define SPI_TXFR1 0x40 ++#define SPI_TXFR2 0x44 ++#define SPI_TXFR3 0x48 ++#define SPI_RXFR0 0x7c ++#define SPI_RXFR1 0x80 ++#define SPI_RXFR2 0x84 ++#define SPI_RXFR3 0x88 ++ ++#define SPI_CTARE(x) (0x11c + (((x) & 0x3) * 4)) ++#define SPI_CTARE_FMSZE(x) (((x) & 0x1) << 16) ++#define SPI_CTARE_DTCP(x) ((x) & 0x7ff) ++ ++#define SPI_SREX 0x13c ++ ++#define SPI_FRAME_BITS(bits) SPI_CTAR_FMSZ((bits) - 1) ++#define SPI_FRAME_BITS_MASK SPI_CTAR_FMSZ(0xf) ++#define SPI_FRAME_BITS_16 SPI_CTAR_FMSZ(0xf) ++#define SPI_FRAME_BITS_8 SPI_CTAR_FMSZ(0x7) ++ ++#define SPI_FRAME_EBITS(bits) SPI_CTARE_FMSZE(((bits) - 1) >> 4) ++#define SPI_FRAME_EBITS_MASK SPI_CTARE_FMSZE(1) + + /* Register offsets for regmap_pushr */ +-#define PUSHR_CMD 0x0 +-#define PUSHR_TX 0x2 ++#define PUSHR_CMD 0x0 ++#define PUSHR_TX 0x2 + +-#define SPI_CS_INIT 0x01 +-#define SPI_CS_ASSERT 0x02 +-#define SPI_CS_DROP 0x04 ++#define SPI_CS_INIT 0x01 ++#define SPI_CS_ASSERT 0x02 ++#define SPI_CS_DROP 0x04 + +-#define DMA_COMPLETION_TIMEOUT msecs_to_jiffies(3000) ++#define DMA_COMPLETION_TIMEOUT msecs_to_jiffies(3000) + + struct chip_data { +- u32 ctar_val; +- u16 void_write_data; ++ u32 ctar_val; ++ u16 void_write_data; + }; + + enum dspi_trans_mode { +@@ -141,75 +141,75 @@ enum dspi_trans_mode { + }; + + struct fsl_dspi_devtype_data { +- enum dspi_trans_mode trans_mode; +- u8 max_clock_factor; +- bool xspi_mode; ++ enum dspi_trans_mode trans_mode; ++ u8 max_clock_factor; ++ bool xspi_mode; + }; + + static const struct fsl_dspi_devtype_data vf610_data = { +- .trans_mode = DSPI_DMA_MODE, +- .max_clock_factor = 2, ++ .trans_mode = DSPI_DMA_MODE, ++ .max_clock_factor = 2, + }; + + static const struct fsl_dspi_devtype_data ls1021a_v1_data = { +- .trans_mode = DSPI_TCFQ_MODE, +- .max_clock_factor = 8, +- .xspi_mode = true, ++ .trans_mode = DSPI_TCFQ_MODE, ++ .max_clock_factor = 8, ++ .xspi_mode = true, + }; + + static const struct fsl_dspi_devtype_data ls2085a_data = { +- .trans_mode = DSPI_TCFQ_MODE, +- .max_clock_factor = 8, ++ .trans_mode = DSPI_TCFQ_MODE, ++ .max_clock_factor = 8, + }; + + static const struct fsl_dspi_devtype_data coldfire_data = { +- .trans_mode = DSPI_EOQ_MODE, +- .max_clock_factor = 8, ++ .trans_mode = DSPI_EOQ_MODE, ++ .max_clock_factor = 8, + }; + + struct fsl_dspi_dma { + /* Length of transfer in words of DSPI_FIFO_SIZE */ +- u32 curr_xfer_len; +- +- u32 *tx_dma_buf; +- struct dma_chan *chan_tx; +- dma_addr_t tx_dma_phys; +- struct completion cmd_tx_complete; +- struct dma_async_tx_descriptor *tx_desc; +- +- u32 *rx_dma_buf; +- struct dma_chan *chan_rx; +- dma_addr_t rx_dma_phys; +- struct completion cmd_rx_complete; +- struct dma_async_tx_descriptor *rx_desc; ++ u32 curr_xfer_len; ++ ++ u32 *tx_dma_buf; ++ struct dma_chan *chan_tx; ++ dma_addr_t tx_dma_phys; ++ struct completion cmd_tx_complete; ++ struct dma_async_tx_descriptor *tx_desc; ++ ++ u32 *rx_dma_buf; ++ struct dma_chan *chan_rx; ++ dma_addr_t rx_dma_phys; ++ struct completion cmd_rx_complete; ++ struct dma_async_tx_descriptor *rx_desc; + }; + + struct fsl_dspi { +- struct spi_master *master; +- struct platform_device *pdev; +- +- struct regmap *regmap; +- struct regmap *regmap_pushr; +- int irq; +- struct clk *clk; +- +- struct spi_transfer *cur_transfer; +- struct spi_message *cur_msg; +- struct chip_data *cur_chip; +- size_t len; +- const void *tx; +- void *rx; +- void *rx_end; +- u16 void_write_data; +- u16 tx_cmd; +- u8 bits_per_word; +- u8 bytes_per_word; +- const struct fsl_dspi_devtype_data *devtype_data; +- +- wait_queue_head_t waitq; +- u32 waitflags; +- +- struct fsl_dspi_dma *dma; ++ struct spi_master *master; ++ struct platform_device *pdev; ++ ++ struct regmap *regmap; ++ struct regmap *regmap_pushr; ++ int irq; ++ struct clk *clk; ++ ++ struct spi_transfer *cur_transfer; ++ struct spi_message *cur_msg; ++ struct chip_data *cur_chip; ++ size_t len; ++ const void *tx; ++ void *rx; ++ void *rx_end; ++ u16 void_write_data; ++ u16 tx_cmd; ++ u8 bits_per_word; ++ u8 bytes_per_word; ++ const struct fsl_dspi_devtype_data *devtype_data; ++ ++ wait_queue_head_t waitq; ++ u32 waitflags; ++ ++ struct fsl_dspi_dma *dma; + }; + + static u32 dspi_pop_tx(struct fsl_dspi *dspi) +@@ -338,7 +338,7 @@ static int dspi_next_xfer_dma_submit(struct fsl_dspi *dspi) + } + + time_left = wait_for_completion_timeout(&dspi->dma->cmd_tx_complete, +- DMA_COMPLETION_TIMEOUT); ++ DMA_COMPLETION_TIMEOUT); + if (time_left == 0) { + dev_err(dev, "DMA tx timeout\n"); + dmaengine_terminate_all(dma->chan_tx); +@@ -347,7 +347,7 @@ static int dspi_next_xfer_dma_submit(struct fsl_dspi *dspi) + } + + time_left = wait_for_completion_timeout(&dspi->dma->cmd_rx_complete, +- DMA_COMPLETION_TIMEOUT); ++ DMA_COMPLETION_TIMEOUT); + if (time_left == 0) { + dev_err(dev, "DMA rx timeout\n"); + dmaengine_terminate_all(dma->chan_tx); +@@ -421,14 +421,14 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr) + } + + dma->tx_dma_buf = dma_alloc_coherent(dev, DSPI_DMA_BUFSIZE, +- &dma->tx_dma_phys, GFP_KERNEL); ++ &dma->tx_dma_phys, GFP_KERNEL); + if (!dma->tx_dma_buf) { + ret = -ENOMEM; + goto err_tx_dma_buf; + } + + dma->rx_dma_buf = dma_alloc_coherent(dev, DSPI_DMA_BUFSIZE, +- &dma->rx_dma_phys, GFP_KERNEL); ++ &dma->rx_dma_phys, GFP_KERNEL); + if (!dma->rx_dma_buf) { + ret = -ENOMEM; + goto err_rx_dma_buf; +@@ -501,14 +501,14 @@ static void dspi_release_dma(struct fsl_dspi *dspi) + } + + static void hz_to_spi_baud(char *pbr, char *br, int speed_hz, +- unsigned long clkrate) ++ unsigned long clkrate) + { + /* Valid baud rate pre-scaler values */ + int pbr_tbl[4] = {2, 3, 5, 7}; + int brs[16] = { 2, 4, 6, 8, +- 16, 32, 64, 128, +- 256, 512, 1024, 2048, +- 4096, 8192, 16384, 32768 }; ++ 16, 32, 64, 128, ++ 256, 512, 1024, 2048, ++ 4096, 8192, 16384, 32768 }; + int scale_needed, scale, minscale = INT_MAX; + int i, j; + +@@ -538,7 +538,7 @@ static void hz_to_spi_baud(char *pbr, char *br, int speed_hz, + } + + static void ns_delay_scale(char *psc, char *sc, int delay_ns, +- unsigned long clkrate) ++ unsigned long clkrate) + { + int pscale_tbl[4] = {1, 3, 5, 7}; + int scale_needed, scale, minscale = INT_MAX; +@@ -546,7 +546,7 @@ static void ns_delay_scale(char *psc, char *sc, int delay_ns, + u32 remainder; + + scale_needed = div_u64_rem((u64)delay_ns * clkrate, NSEC_PER_SEC, +- &remainder); ++ &remainder); + if (remainder) + scale_needed++; + +@@ -661,7 +661,7 @@ static void dspi_eoq_read(struct fsl_dspi *dspi) + } + + static int dspi_transfer_one_message(struct spi_master *master, +- struct spi_message *message) ++ struct spi_message *message) + { + struct fsl_dspi *dspi = spi_master_get_devdata(master); + struct spi_device *spi = message->spi; +@@ -677,7 +677,7 @@ static int dspi_transfer_one_message(struct spi_master *master, + dspi->cur_chip = spi_get_ctldata(spi); + /* Prepare command word for CMD FIFO */ + dspi->tx_cmd = SPI_PUSHR_CMD_CTAS(0) | +- SPI_PUSHR_CMD_PCS(spi->chip_select); ++ SPI_PUSHR_CMD_PCS(spi->chip_select); + if (list_is_last(&dspi->cur_transfer->transfer_list, + &dspi->cur_msg->transfers)) { + /* Leave PCS activated after last transfer when +@@ -718,8 +718,8 @@ static int dspi_transfer_one_message(struct spi_master *master, + SPI_FRAME_BITS(transfer->bits_per_word)); + if (dspi->devtype_data->xspi_mode) + regmap_write(dspi->regmap, SPI_CTARE(0), +- SPI_FRAME_EBITS(transfer->bits_per_word) +- | SPI_CTARE_DTCP(1)); ++ SPI_FRAME_EBITS(transfer->bits_per_word) | ++ SPI_CTARE_DTCP(1)); + + trans_mode = dspi->devtype_data->trans_mode; + switch (trans_mode) { +@@ -733,8 +733,8 @@ static int dspi_transfer_one_message(struct spi_master *master, + break; + case DSPI_DMA_MODE: + regmap_write(dspi->regmap, SPI_RSER, +- SPI_RSER_TFFFE | SPI_RSER_TFFFD | +- SPI_RSER_RFDFE | SPI_RSER_RFDFD); ++ SPI_RSER_TFFFE | SPI_RSER_TFFFD | ++ SPI_RSER_RFDFE | SPI_RSER_RFDFD); + status = dspi_dma_xfer(dspi); + break; + default: +@@ -746,7 +746,7 @@ static int dspi_transfer_one_message(struct spi_master *master, + + if (trans_mode != DSPI_DMA_MODE) { + if (wait_event_interruptible(dspi->waitq, +- dspi->waitflags)) ++ dspi->waitflags)) + dev_err(&dspi->pdev->dev, + "wait transfer complete fail!\n"); + dspi->waitflags = 0; +@@ -785,10 +785,10 @@ static int dspi_setup(struct spi_device *spi) + + if (!pdata) { + of_property_read_u32(spi->dev.of_node, "fsl,spi-cs-sck-delay", +- &cs_sck_delay); ++ &cs_sck_delay); + + of_property_read_u32(spi->dev.of_node, "fsl,spi-sck-cs-delay", +- &sck_cs_delay); ++ &sck_cs_delay); + } else { + cs_sck_delay = pdata->cs_sck_delay; + sck_cs_delay = pdata->sck_cs_delay; +@@ -829,7 +829,7 @@ static void dspi_cleanup(struct spi_device *spi) + struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi); + + dev_dbg(&spi->dev, "spi_device %u.%u cleanup\n", +- spi->master->bus_num, spi->chip_select); ++ spi->master->bus_num, spi->chip_select); + + kfree(chip); + } +@@ -939,16 +939,16 @@ static const struct regmap_range dspi_volatile_ranges[] = { + }; + + static const struct regmap_access_table dspi_volatile_table = { +- .yes_ranges = dspi_volatile_ranges, +- .n_yes_ranges = ARRAY_SIZE(dspi_volatile_ranges), ++ .yes_ranges = dspi_volatile_ranges, ++ .n_yes_ranges = ARRAY_SIZE(dspi_volatile_ranges), + }; + + static const struct regmap_config dspi_regmap_config = { +- .reg_bits = 32, +- .val_bits = 32, +- .reg_stride = 4, +- .max_register = 0x88, +- .volatile_table = &dspi_volatile_table, ++ .reg_bits = 32, ++ .val_bits = 32, ++ .reg_stride = 4, ++ .max_register = 0x88, ++ .volatile_table = &dspi_volatile_table, + }; + + static const struct regmap_range dspi_xspi_volatile_ranges[] = { +@@ -959,24 +959,24 @@ static const struct regmap_range dspi_xspi_volatile_ranges[] = { + }; + + static const struct regmap_access_table dspi_xspi_volatile_table = { +- .yes_ranges = dspi_xspi_volatile_ranges, +- .n_yes_ranges = ARRAY_SIZE(dspi_xspi_volatile_ranges), ++ .yes_ranges = dspi_xspi_volatile_ranges, ++ .n_yes_ranges = ARRAY_SIZE(dspi_xspi_volatile_ranges), + }; + + static const struct regmap_config dspi_xspi_regmap_config[] = { + { +- .reg_bits = 32, +- .val_bits = 32, +- .reg_stride = 4, +- .max_register = 0x13c, +- .volatile_table = &dspi_xspi_volatile_table, ++ .reg_bits = 32, ++ .val_bits = 32, ++ .reg_stride = 4, ++ .max_register = 0x13c, ++ .volatile_table = &dspi_xspi_volatile_table, + }, + { +- .name = "pushr", +- .reg_bits = 16, +- .val_bits = 16, +- .reg_stride = 2, +- .max_register = 0x2, ++ .name = "pushr", ++ .reg_bits = 16, ++ .val_bits = 16, ++ .reg_stride = 2, ++ .max_register = 0x2, + }, + }; + +@@ -1160,12 +1160,12 @@ static int dspi_remove(struct platform_device *pdev) + } + + static struct platform_driver fsl_dspi_driver = { +- .driver.name = DRIVER_NAME, +- .driver.of_match_table = fsl_dspi_dt_ids, +- .driver.owner = THIS_MODULE, +- .driver.pm = &dspi_pm, +- .probe = dspi_probe, +- .remove = dspi_remove, ++ .driver.name = DRIVER_NAME, ++ .driver.of_match_table = fsl_dspi_dt_ids, ++ .driver.owner = THIS_MODULE, ++ .driver.pm = &dspi_pm, ++ .probe = dspi_probe, ++ .remove = dspi_remove, + }; + module_platform_driver(fsl_dspi_driver); + +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Fix-external-abort-on-interrupt-in-.patch b/patches.suse/spi-spi-fsl-dspi-Fix-external-abort-on-interrupt-in-.patch new file mode 100644 index 0000000..2274af4 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Fix-external-abort-on-interrupt-in-.patch @@ -0,0 +1,126 @@ +From: Krzysztof Kozlowski +Date: Mon, 22 Jun 2020 13:05:42 +0200 +Subject: spi: spi-fsl-dspi: Fix external abort on interrupt in resume or exit + paths + +Git-commit: 3d87b613d6a3c6f0980e877ab0895785a2dde581 +Patch-mainline: v5.8-rc4 +References: bsc#1167260 + +If shared interrupt comes late, during probe error path or device remove +(could be triggered with CONFIG_DEBUG_SHIRQ), the interrupt handler +dspi_interrupt() will access registers with the clock being disabled. +This leads to external abort on non-linefetch on Toradex Colibri VF50 +module (with Vybrid VF5xx): + + $ echo 4002d000.spi > /sys/devices/platform/soc/40000000.bus/4002d000.spi/driver/unbind + + Unhandled fault: external abort on non-linefetch (0x1008) at 0x8887f02c + Internal error: : 1008 [#1] ARM + Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree) + Backtrace: + (regmap_mmio_read32le) + (regmap_mmio_read) + (_regmap_bus_reg_read) + (_regmap_read) + (regmap_read) + (dspi_interrupt) + (free_irq) + (devm_irq_release) + (release_nodes) + (devres_release_all) + (device_release_driver_internal) + +The resource-managed framework should not be used for shared interrupt +handling, because the interrupt handler might be called after releasing +other resources and disabling clocks. + +Similar bug could happen during suspend - the shared interrupt handler +could be invoked after suspending the device. Each device sharing this +interrupt line should disable the IRQ during suspend so handler will be +invoked only in following cases: +1. None suspended, +2. All devices resumed. + +Fixes: 349ad66c0ab0 ("spi:Add Freescale DSPI driver for Vybrid VF610 platform") +Signed-off-by: Krzysztof Kozlowski +Tested-by: Vladimir Oltean +Reviewed-by: Vladimir Oltean +Cc: +Link: https://lore.kernel.org/r/20200622110543.5035-3-krzk@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index ec7919d9c0d9..e0b30e4b1b69 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1109,6 +1109,8 @@ static int dspi_suspend(struct device *dev) + struct spi_controller *ctlr = dev_get_drvdata(dev); + struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); + ++ if (dspi->irq) ++ disable_irq(dspi->irq); + spi_controller_suspend(ctlr); + clk_disable_unprepare(dspi->clk); + +@@ -1129,6 +1131,8 @@ static int dspi_resume(struct device *dev) + if (ret) + return ret; + spi_controller_resume(ctlr); ++ if (dspi->irq) ++ enable_irq(dspi->irq); + + return 0; + } +@@ -1385,8 +1389,8 @@ static int dspi_probe(struct platform_device *pdev) + goto poll_mode; + } + +- ret = devm_request_irq(&pdev->dev, dspi->irq, dspi_interrupt, +- IRQF_SHARED, pdev->name, dspi); ++ ret = request_threaded_irq(dspi->irq, dspi_interrupt, NULL, ++ IRQF_SHARED, pdev->name, dspi); + if (ret < 0) { + dev_err(&pdev->dev, "Unable to attach DSPI interrupt\n"); + goto out_clk_put; +@@ -1400,7 +1404,7 @@ static int dspi_probe(struct platform_device *pdev) + ret = dspi_request_dma(dspi, res->start); + if (ret < 0) { + dev_err(&pdev->dev, "can't get dma channels\n"); +- goto out_clk_put; ++ goto out_free_irq; + } + } + +@@ -1415,11 +1419,14 @@ static int dspi_probe(struct platform_device *pdev) + ret = spi_register_controller(ctlr); + if (ret != 0) { + dev_err(&pdev->dev, "Problem registering DSPI ctlr\n"); +- goto out_clk_put; ++ goto out_free_irq; + } + + return ret; + ++out_free_irq: ++ if (dspi->irq) ++ free_irq(dspi->irq, dspi); + out_clk_put: + clk_disable_unprepare(dspi->clk); + out_ctlr_put: +@@ -1445,6 +1452,8 @@ static int dspi_remove(struct platform_device *pdev) + regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, SPI_MCR_HALT); + + dspi_release_dma(dspi); ++ if (dspi->irq) ++ free_irq(dspi->irq, dspi); + clk_disable_unprepare(dspi->clk); + + return 0; +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Fix-interrupt-less-DMA-mode-taking-.patch b/patches.suse/spi-spi-fsl-dspi-Fix-interrupt-less-DMA-mode-taking-.patch new file mode 100644 index 0000000..eb15185 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Fix-interrupt-less-DMA-mode-taking-.patch @@ -0,0 +1,51 @@ +From: Vladimir Oltean +Date: Wed, 18 Mar 2020 02:15:59 +0200 +Subject: spi: spi-fsl-dspi: Fix interrupt-less DMA mode taking an XSPI code + path + +Git-commit: 826b3a6a34619b934cdc33eeb961fcb99ce92c09 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +Interrupts are not necessary for DMA functionality, since the completion +event is provided by the DMA driver. + +But if the driver fails to request the IRQ defined in the device tree, +it will call dspi_poll which would make the driver hang waiting for data +to become available in the RX FIFO. + +Fixes: c55be3059159 ("spi: spi-fsl-dspi: Use poll mode in case the platform IRQ is missing") +Signed-off-by: Vladimir Oltean +Tested-by: Michael Walle +Link: https://lore.kernel.org/r/20200318001603.9650-9-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -954,13 +954,15 @@ static int dspi_transfer_one_message(str + goto out; + } + +- if (!dspi->irq) { +- do { +- status = dspi_poll(dspi); +- } while (status == -EINPROGRESS); +- } else if (trans_mode != DSPI_DMA_MODE) { +- wait_for_completion(&dspi->xfer_done); +- reinit_completion(&dspi->xfer_done); ++ if (trans_mode != DSPI_DMA_MODE) { ++ if (dspi->irq) { ++ wait_for_completion(&dspi->xfer_done); ++ reinit_completion(&dspi->xfer_done); ++ } else { ++ do { ++ status = dspi_poll(dspi); ++ } while (status == -EINPROGRESS); ++ } + } + + if (transfer->delay_usecs) diff --git a/patches.suse/spi-spi-fsl-dspi-Fix-little-endian-access-to-PUSHR-C.patch b/patches.suse/spi-spi-fsl-dspi-Fix-little-endian-access-to-PUSHR-C.patch new file mode 100644 index 0000000..1314735 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Fix-little-endian-access-to-PUSHR-C.patch @@ -0,0 +1,115 @@ +From: Vladimir Oltean +Date: Wed, 18 Mar 2020 02:15:53 +0200 +Subject: spi: spi-fsl-dspi: Fix little endian access to PUSHR CMD and TXDATA + +Git-commit: 671ffde1752f594c60ccdfd75378defacfaf7c83 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +In XSPI mode, the 32-bit PUSHR register can be written to separately: +the higher 16 bits are for commands and the lower 16 bits are for data. + +This has nicely been hacked around, by defining a second regmap with a +width of 16 bits, and effectively splitting a 32-bit register into 2 +16-bit ones, from the perspective of this regmap_pushr. + +The problem is the assumption about the controller's endianness. If the +controller is little endian (such as anything post-LS1046A), then the +first 2 bytes, in the order imposed by memory layout, will actually hold +the TXDATA, and the last 2 bytes will hold the CMD. + +So take the controller's endianness into account when performing split +writes to PUSHR. The obvious and simple solution would have been to call +regmap_get_val_endian(), but that is an internal regmap function and we +don't want to change regmap just for this. Therefore, we just re-read +the "big-endian" device tree property. + +Fixes: 58ba07ec79e6 ("spi: spi-fsl-dspi: Add support for XSPI mode registers") +Signed-off-by: Vladimir Oltean +Tested-by: Michael Walle +Link: https://lore.kernel.org/r/20200318001603.9650-3-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 26 ++++++++++++++++++++------ + 1 file changed, 20 insertions(+), 6 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 6ca35881881b..be717776dd98 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -103,10 +103,6 @@ + #define SPI_FRAME_BITS(bits) SPI_CTAR_FMSZ((bits) - 1) + #define SPI_FRAME_EBITS(bits) SPI_CTARE_FMSZE(((bits) - 1) >> 4) + +-/* Register offsets for regmap_pushr */ +-#define PUSHR_CMD 0x0 +-#define PUSHR_TX 0x2 +- + #define DMA_COMPLETION_TIMEOUT msecs_to_jiffies(3000) + + struct chip_data { +@@ -240,6 +236,13 @@ struct fsl_dspi { + + int words_in_flight; + ++ /* ++ * Offsets for CMD and TXDATA within SPI_PUSHR when accessed ++ * individually (in XSPI mode) ++ */ ++ int pushr_cmd; ++ int pushr_tx; ++ + void (*host_to_dev)(struct fsl_dspi *dspi, u32 *txdata); + void (*dev_to_host)(struct fsl_dspi *dspi, u32 rxdata); + }; +@@ -673,12 +676,12 @@ static void dspi_pushr_cmd_write(struct fsl_dspi *dspi, u16 cmd) + */ + if (dspi->len > dspi->oper_word_size) + cmd |= SPI_PUSHR_CMD_CONT; +- regmap_write(dspi->regmap_pushr, PUSHR_CMD, cmd); ++ regmap_write(dspi->regmap_pushr, dspi->pushr_cmd, cmd); + } + + static void dspi_pushr_txdata_write(struct fsl_dspi *dspi, u16 txdata) + { +- regmap_write(dspi->regmap_pushr, PUSHR_TX, txdata); ++ regmap_write(dspi->regmap_pushr, dspi->pushr_tx, txdata); + } + + static void dspi_xspi_write(struct fsl_dspi *dspi, int cnt, bool eoq) +@@ -1259,6 +1262,7 @@ static int dspi_probe(struct platform_device *pdev) + struct fsl_dspi *dspi; + struct resource *res; + void __iomem *base; ++ bool big_endian; + + ctlr = spi_alloc_master(&pdev->dev, sizeof(struct fsl_dspi)); + if (!ctlr) +@@ -1284,6 +1288,7 @@ static int dspi_probe(struct platform_device *pdev) + + /* Only Coldfire uses platform data */ + dspi->devtype_data = &devtype_data[MCF5441X]; ++ big_endian = true; + } else { + + ret = of_property_read_u32(np, "spi-num-chipselects", &cs_num); +@@ -1305,6 +1310,15 @@ static int dspi_probe(struct platform_device *pdev) + ret = -EFAULT; + goto out_ctlr_put; + } ++ ++ big_endian = of_device_is_big_endian(np); ++ } ++ if (big_endian) { ++ dspi->pushr_cmd = 0; ++ dspi->pushr_tx = 2; ++ } else { ++ dspi->pushr_cmd = 2; ++ dspi->pushr_tx = 0; + } + + if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE) +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Fix-lockup-if-device-is-removed-dur.patch b/patches.suse/spi-spi-fsl-dspi-Fix-lockup-if-device-is-removed-dur.patch new file mode 100644 index 0000000..92557a7 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Fix-lockup-if-device-is-removed-dur.patch @@ -0,0 +1,55 @@ +From: Krzysztof Kozlowski +Date: Mon, 22 Jun 2020 13:05:40 +0200 +Subject: spi: spi-fsl-dspi: Fix lockup if device is removed during SPI + transfer + +Git-commit: 7684580d45bd3d84ed9b453a4cadf7a9a5605a3f +Patch-mainline: v5.8-rc4 +References: bsc#1167260 + +During device removal, the driver should unregister the SPI controller +and stop the hardware. Otherwise the dspi_transfer_one_message() could +wait on completion infinitely. + +Additionally, calling spi_unregister_controller() first in device +removal reverse-matches the probe function, where SPI controller is +registered at the end. + +Fixes: 05209f457069 ("spi: fsl-dspi: add missing clk_disable_unprepare() in dspi_remove()") +Reported-by: Vladimir Oltean +Signed-off-by: Krzysztof Kozlowski +Cc: +Link: https://lore.kernel.org/r/20200622110543.5035-1-krzk@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 58190c94561f..ec0fd0d366eb 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1434,9 +1434,18 @@ static int dspi_remove(struct platform_device *pdev) + struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); + + /* Disconnect from the SPI framework */ ++ spi_unregister_controller(dspi->ctlr); ++ ++ /* Disable RX and TX */ ++ regmap_update_bits(dspi->regmap, SPI_MCR, ++ SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF, ++ SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF); ++ ++ /* Stop Running */ ++ regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, SPI_MCR_HALT); ++ + dspi_release_dma(dspi); + clk_disable_unprepare(dspi->clk); +- spi_unregister_controller(dspi->ctlr); + + return 0; + } +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Fix-lockup-if-device-is-shutdown-du.patch b/patches.suse/spi-spi-fsl-dspi-Fix-lockup-if-device-is-shutdown-du.patch new file mode 100644 index 0000000..337cf14 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Fix-lockup-if-device-is-shutdown-du.patch @@ -0,0 +1,59 @@ +From: Krzysztof Kozlowski +Date: Mon, 22 Jun 2020 13:05:41 +0200 +Subject: spi: spi-fsl-dspi: Fix lockup if device is shutdown during SPI + transfer + +Git-commit: 3c525b69e8c1a9a6944e976603c7a1a713e728f9 +Patch-mainline: v5.8-rc4 +References: bsc#1167260 + +During shutdown, the driver should unregister the SPI controller +and stop the hardware. Otherwise the dspi_transfer_one_message() could +wait on completion infinitely. + +Additionally, calling spi_unregister_controller() first in device +shutdown reverse-matches the probe function, where SPI controller is +registered at the end. + +Fixes: dc234825997e ("spi: spi-fsl-dspi: Adding shutdown hook") +Reported-by: Vladimir Oltean +Signed-off-by: Krzysztof Kozlowski +Tested-by: Vladimir Oltean +Reviewed-by: Vladimir Oltean +Cc: +Link: https://lore.kernel.org/r/20200622110543.5035-2-krzk@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 15 +-------------- + 1 file changed, 1 insertion(+), 14 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index ec0fd0d366eb..ec7919d9c0d9 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1452,20 +1452,7 @@ static int dspi_remove(struct platform_device *pdev) + + static void dspi_shutdown(struct platform_device *pdev) + { +- struct spi_controller *ctlr = platform_get_drvdata(pdev); +- struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); +- +- /* Disable RX and TX */ +- regmap_update_bits(dspi->regmap, SPI_MCR, +- SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF, +- SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF); +- +- /* Stop Running */ +- regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, SPI_MCR_HALT); +- +- dspi_release_dma(dspi); +- clk_disable_unprepare(dspi->clk); +- spi_unregister_controller(dspi->ctlr); ++ dspi_remove(pdev); + } + + static struct platform_driver fsl_dspi_driver = { +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Fix-race-condition-in-TCFQ-EOQ-inte.patch b/patches.suse/spi-spi-fsl-dspi-Fix-race-condition-in-TCFQ-EOQ-inte.patch new file mode 100644 index 0000000..77788bf --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Fix-race-condition-in-TCFQ-EOQ-inte.patch @@ -0,0 +1,64 @@ +From: Vladimir Oltean +Date: Tue, 3 Sep 2019 13:57:08 +0300 +Subject: spi: spi-fsl-dspi: Fix race condition in TCFQ/EOQ interrupt + +Git-commit: e327364948492f6a4e866417d3d4d17d95fed285 +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +When the driver is working in TCFQ/EOQ mode (i.e. interacts with the SPI +controller's FIFOs directly) the following sequence of operations +happens: + +- The first byte of the tx buffer gets pushed to the TX FIFO (dspi->len + gets decremented). This triggers the train of interrupts that handle + the rest of the bytes. + +- The dspi_interrupt handles a TX confirmation event. It reads the newly + available byte from the RX FIFO, checks the dspi->len exit condition, + and if there's more to be done, it kicks off the next interrupt in the + train by writing the next byte to the TX FIFO. + +Now the problem is that the wait queue is woken up one byte too early, +because dspi->len becomes 0 as soon as the byte has been pushed into the +TX FIFO. Its interrupt has not yet been processed and the RX byte has +not been put from the FIFO into the buffer. + +Depending on the timing of the wait queue wakeup vs the handling of the +last dspi_interrupt, it can happen that the main SPI message pump thread +has already returned back into the spi_device driver. When the rx buffer +is on stack (which it can be, because in this mode, the DSPI doesn't do +DMA), the last interrupt will perform a memory write into an rx buffer +that has been freed. This manifests as stack corruption. + +The solution is to only wake up the wait queue when dspi_rxtx says so, +i.e. after it has processed the last TX confirmation interrupt and +collected the last RX byte. + +Fixes: c55be3059159 ("spi: spi-fsl-dspi: Use poll mode in case the platform IRQ is missing") +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20190903105708.32273-1-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 77db43f1290f..bec758e978fb 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -710,9 +710,7 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id) + if (!(spi_sr & (SPI_SR_EOQF | SPI_SR_TCFQF))) + return IRQ_NONE; + +- dspi_rxtx(dspi); +- +- if (!dspi->len) { ++ if (dspi_rxtx(dspi) == 0) { + dspi->waitflags = 1; + wake_up_interruptible(&dspi->waitq); + } +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Fix-typos.patch b/patches.suse/spi-spi-fsl-dspi-Fix-typos.patch new file mode 100644 index 0000000..7868d27 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Fix-typos.patch @@ -0,0 +1,44 @@ +From: Vladimir Oltean +Date: Sun, 18 Aug 2019 21:01:12 +0300 +Subject: spi: spi-fsl-dspi: Fix typos + +Git-commit: 206175306da1de0c116e8bc12db3230edb230d5a +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +mask of -> mask off +at and -> and + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20190818180115.31114-12-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index e2e71bd73b5c..6128c695d06f 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -232,7 +232,7 @@ static void dspi_push_rx(struct fsl_dspi *dspi, u32 rxdata) + if (!dspi->rx) + return; + +- /* Mask of undefined bits */ ++ /* Mask off undefined bits */ + rxdata &= (1 << dspi->bits_per_word) - 1; + + if (dspi->bytes_per_word == 1) +@@ -642,7 +642,7 @@ static void dspi_eoq_read(struct fsl_dspi *dspi) + { + int fifo_size = DSPI_FIFO_SIZE; + +- /* Read one FIFO entry at and push to rx buffer */ ++ /* Read one FIFO entry and push to rx buffer */ + while ((dspi->rx < dspi->rx_end) && fifo_size--) + dspi_push_rx(dspi, fifo_read(dspi)); + } +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Free-DMA-memory-with-matching-funct.patch b/patches.suse/spi-spi-fsl-dspi-Free-DMA-memory-with-matching-funct.patch new file mode 100644 index 0000000..e9dffcd --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Free-DMA-memory-with-matching-funct.patch @@ -0,0 +1,73 @@ +From: Krzysztof Kozlowski +Date: Wed, 10 Jun 2020 17:41:57 +0200 +Subject: spi: spi-fsl-dspi: Free DMA memory with matching function + +Git-commit: 03fe7aaf0c3d40ef7feff2bdc7180c146989586a +Patch-mainline: v5.8-rc3 +References: bsc#1167260 + +Driver allocates DMA memory with dma_alloc_coherent() but frees it with +dma_unmap_single(). + +This causes DMA warning during system shutdown (with DMA debugging) on +Toradex Colibri VF50 module: + + WARNING: CPU: 0 PID: 1 at ../kernel/dma/debug.c:1036 check_unmap+0x3fc/0xb04 + DMA-API: fsl-edma 40098000.dma-controller: device driver frees DMA memory with wrong function + [device address=0x0000000087040000] [size=8 bytes] [mapped as coherent] [unmapped as single] + Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree) + (unwind_backtrace) from [<8010bb34>] (show_stack+0x10/0x14) + (show_stack) from [<8011ced8>] (__warn+0xf0/0x108) + (__warn) from [<8011cf64>] (warn_slowpath_fmt+0x74/0xb8) + (warn_slowpath_fmt) from [<8017d170>] (check_unmap+0x3fc/0xb04) + (check_unmap) from [<8017d900>] (debug_dma_unmap_page+0x88/0x90) + (debug_dma_unmap_page) from [<80601d68>] (dspi_release_dma+0x88/0x110) + (dspi_release_dma) from [<80601e4c>] (dspi_shutdown+0x5c/0x80) + (dspi_shutdown) from [<805845f8>] (device_shutdown+0x17c/0x220) + (device_shutdown) from [<80143ef8>] (kernel_restart+0xc/0x50) + (kernel_restart) from [<801441cc>] (__do_sys_reboot+0x18c/0x210) + (__do_sys_reboot) from [<80100060>] (ret_fast_syscall+0x0/0x28) + DMA-API: Mapped at: + dma_alloc_attrs+0xa4/0x130 + dspi_probe+0x568/0x7b4 + platform_drv_probe+0x6c/0xa4 + really_probe+0x208/0x348 + driver_probe_device+0x5c/0xb4 + +Fixes: 90ba37033cb9 ("spi: spi-fsl-dspi: Add DMA support for Vybrid") +Signed-off-by: Krzysztof Kozlowski +Acked-by: Vladimir Oltean +Cc: +Link: https://lore.kernel.org/r/1591803717-11218-1-git-send-email-krzk@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index a35faced0456..58190c94561f 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -588,14 +588,14 @@ static void dspi_release_dma(struct fsl_dspi *dspi) + return; + + if (dma->chan_tx) { +- dma_unmap_single(dma->chan_tx->device->dev, dma->tx_dma_phys, +- dma_bufsize, DMA_TO_DEVICE); ++ dma_free_coherent(dma->chan_tx->device->dev, dma_bufsize, ++ dma->tx_dma_buf, dma->tx_dma_phys); + dma_release_channel(dma->chan_tx); + } + + if (dma->chan_rx) { +- dma_unmap_single(dma->chan_rx->device->dev, dma->rx_dma_phys, +- dma_bufsize, DMA_FROM_DEVICE); ++ dma_free_coherent(dma->chan_rx->device->dev, dma_bufsize, ++ dma->rx_dma_buf, dma->rx_dma_phys); + dma_release_channel(dma->chan_rx); + } + } +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Implement-.max_message_size-method-.patch b/patches.suse/spi-spi-fsl-dspi-Implement-.max_message_size-method-.patch new file mode 100644 index 0000000..1a16799 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Implement-.max_message_size-method-.patch @@ -0,0 +1,72 @@ +From: Vladimir Oltean +Date: Thu, 5 Mar 2020 00:00:38 +0200 +Subject: spi: spi-fsl-dspi: Implement .max_message_size method for EOQ mode + +Git-commit: a3185c38dc6cd664b2b576eb9d3e5d2f49101a10 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +When it gets set, End Of Queue Flag halts the DSPI controller and forces +the chip select signal to deassert. + +This operating mode is not ideal, but it is used for the DSPI +instantiations where there is no other notification from the controller +that the data in the FIFO has finished transmission. So in practice, it +means that transmitting buffers larger than the FIFO size will yield +unpredictable results. + +The only controller that operates in EOQ mode is MCF5441X (Coldfire). I +would say that the way EOQ is used (and documented in the reference +manual, too) on this chip is incorrect, and I would personally migrate +it to TCFQ, but that's notably worse in terms of performance (it can +only use 1 entry of the 16-deep FIFO) and if this limitation didn't +bother any Coldfire DSPI user so far, it's likely that we just need to +throw an error for larger buffers to make sure that callers are aware +their transfers are getting truncated/split. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20200304220044.11193-7-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index f37090ad7ad1..158cb48c0f4a 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1084,6 +1084,22 @@ static int dspi_slave_abort(struct spi_master *master) + return 0; + } + ++/* ++ * EOQ mode will inevitably deassert its PCS signal on last word in a queue ++ * (hardware limitation), so we need to inform the spi_device that larger ++ * buffers than the FIFO size are going to have the chip select randomly ++ * toggling, so it has a chance to adapt its message sizes. ++ */ ++static size_t dspi_max_message_size(struct spi_device *spi) ++{ ++ struct fsl_dspi *dspi = spi_controller_get_devdata(spi->controller); ++ ++ if (dspi->devtype_data->trans_mode == DSPI_EOQ_MODE) ++ return dspi->devtype_data->fifo_size; ++ ++ return SIZE_MAX; ++} ++ + static int dspi_probe(struct platform_device *pdev) + { + struct device_node *np = pdev->dev.of_node; +@@ -1105,6 +1121,7 @@ static int dspi_probe(struct platform_device *pdev) + + ctlr->setup = dspi_setup; + ctlr->transfer_one_message = dspi_transfer_one_message; ++ ctlr->max_message_size = dspi_max_message_size; + ctlr->dev.of_node = pdev->dev.of_node; + + ctlr->cleanup = dspi_cleanup; +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Initialize-completion-before-possib.patch b/patches.suse/spi-spi-fsl-dspi-Initialize-completion-before-possib.patch new file mode 100644 index 0000000..e6c474b --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Initialize-completion-before-possib.patch @@ -0,0 +1,39 @@ +From: Krzysztof Kozlowski +Date: Mon, 22 Jun 2020 13:05:43 +0200 +Subject: spi: spi-fsl-dspi: Initialize completion before possible interrupt + +Git-commit: f148915f91fccd8c3df1b0bff7d1c8458cad3be5 +Patch-mainline: v5.8-rc4 +References: bsc#1167260 + +The interrupt handler calls completion and is IRQ requested before the +completion is initialized. Logically it should be the other way. + +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20200622110543.5035-4-krzk@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1379,6 +1379,8 @@ static int dspi_probe(struct platform_de + goto poll_mode; + } + ++ init_completion(&dspi->xfer_done); ++ + ret = request_threaded_irq(dspi->irq, dspi_interrupt, NULL, + IRQF_SHARED, pdev->name, dspi); + if (ret < 0) { +@@ -1386,8 +1388,6 @@ static int dspi_probe(struct platform_de + goto out_clk_put; + } + +- init_completion(&dspi->xfer_done); +- + poll_mode: + if (dspi->devtype_data->trans_mode == DSPI_DMA_MODE) { + ret = dspi_request_dma(dspi, res->start); diff --git a/patches.suse/spi-spi-fsl-dspi-LS2080A-and-LX2160A-support-XSPI-mo.patch b/patches.suse/spi-spi-fsl-dspi-LS2080A-and-LX2160A-support-XSPI-mo.patch new file mode 100644 index 0000000..f3df46a --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-LS2080A-and-LX2160A-support-XSPI-mo.patch @@ -0,0 +1,39 @@ +From: Vladimir Oltean +Date: Mon, 2 Mar 2020 02:19:56 +0200 +Subject: spi: spi-fsl-dspi: LS2080A and LX2160A support XSPI mode + +Git-commit: ca5052c8bfab7a44efd2161ce2a9d67dfc126aa6 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +XSPI allows for 2 extra features: +- Command cycling (use a single TX command with more than 1 word in the + TX FIFO). +- Increased word size (from 16 bits to 32 bits) + +Signed-off-by: Vladimir Oltean +Message-Id: <20200302001958.11105-5-olteanv@gmail.com> +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -173,6 +173,7 @@ static const struct fsl_dspi_devtype_dat + [LS2080A] = { + .trans_mode = DSPI_TCFQ_MODE, + .max_clock_factor = 8, ++ .xspi_mode = true, + .fifo_size = 4, + }, + [LS2085A] = { +@@ -183,6 +184,7 @@ static const struct fsl_dspi_devtype_dat + [LX2160A] = { + .trans_mode = DSPI_TCFQ_MODE, + .max_clock_factor = 8, ++ .xspi_mode = true, + .fifo_size = 4, + }, + [MCF5441X] = { diff --git a/patches.suse/spi-spi-fsl-dspi-Make-bus-num-property-optional.patch b/patches.suse/spi-spi-fsl-dspi-Make-bus-num-property-optional.patch new file mode 100644 index 0000000..42d0dc8 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Make-bus-num-property-optional.patch @@ -0,0 +1,66 @@ +From: Sascha Hauer +Date: Thu, 5 Mar 2020 12:55:46 +0100 +Subject: spi: spi-fsl-dspi: Make bus-num property optional + +Git-commit: 29d2daf2c33ce9b1038f3fcd55e16a788c00fc86 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +The SPI bus number is completely optional to Linux, so make the +corresponding device tree property optional as well. + +Signed-off-by: Sascha Hauer +Link: https://lore.kernel.org/r/20200305115546.31814-1-s.hauer@pengutronix.de +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt | 2 +- + drivers/spi/spi-fsl-dspi.c | 8 ++------ + 2 files changed, 3 insertions(+), 7 deletions(-) + +diff --git a/Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt b/Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt +index 99b94cfe1623..30a79da9c039 100644 +--- a/Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt ++++ b/Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt +@@ -19,11 +19,11 @@ Required properties: + - pinctrl-0: pin control group to be used for this controller. + - pinctrl-names: must contain a "default" entry. + - spi-num-chipselects : the number of the chipselect signals. +-- bus-num : the slave chip chipselect signal number. + + Optional property: + - big-endian: If present the dspi device's registers are implemented + in big endian mode. ++- bus-num : the slave chip chipselect signal number. + + Optional SPI slave node properties: + - fsl,spi-cs-sck-delay: a delay in nanoseconds between activating chip +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index c357c3247232..74dc0df518fa 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1108,7 +1108,7 @@ static int dspi_probe(struct platform_device *pdev) + const struct regmap_config *regmap_config; + struct fsl_dspi_platform_data *pdata; + struct spi_controller *ctlr; +- int ret, cs_num, bus_num; ++ int ret, cs_num, bus_num = -1; + struct fsl_dspi *dspi; + struct resource *res; + void __iomem *base; +@@ -1145,11 +1145,7 @@ static int dspi_probe(struct platform_device *pdev) + } + ctlr->num_chipselect = cs_num; + +- ret = of_property_read_u32(np, "bus-num", &bus_num); +- if (ret < 0) { +- dev_err(&pdev->dev, "can't get bus-num\n"); +- goto out_ctlr_put; +- } ++ of_property_read_u32(np, "bus-num", &bus_num); + ctlr->bus_num = bus_num; + + if (of_property_read_bool(np, "spi-slave")) +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Move-dspi_interrupt-above-dspi_tran.patch b/patches.suse/spi-spi-fsl-dspi-Move-dspi_interrupt-above-dspi_tran.patch new file mode 100644 index 0000000..1d9dd3d --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Move-dspi_interrupt-above-dspi_tran.patch @@ -0,0 +1,157 @@ +From: Vladimir Oltean +Date: Sun, 18 Aug 2019 21:01:13 +0300 +Subject: spi: spi-fsl-dspi: Move dspi_interrupt above + dspi_transfer_one_message + +Git-commit: a63af99f0d0d1c0992736f1aaf9e3b42bee0e2b8 +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +The two functions are loosely coupled through dspi->waitq, but +logically, dspi_transfer_one_message depends on dspi_interrupt in order +to complete. Move its definition above it so the I/O functions are +grouped closer together. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20190818180115.31114-13-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 114 ++++++++++++++++++------------------- + 1 file changed, 57 insertions(+), 57 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 6128c695d06f..790cb02fc181 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -647,6 +647,63 @@ static void dspi_eoq_read(struct fsl_dspi *dspi) + dspi_push_rx(dspi, fifo_read(dspi)); + } + ++static irqreturn_t dspi_interrupt(int irq, void *dev_id) ++{ ++ struct fsl_dspi *dspi = (struct fsl_dspi *)dev_id; ++ struct spi_message *msg = dspi->cur_msg; ++ enum dspi_trans_mode trans_mode; ++ u32 spi_sr, spi_tcr; ++ u16 spi_tcnt; ++ ++ regmap_read(dspi->regmap, SPI_SR, &spi_sr); ++ regmap_write(dspi->regmap, SPI_SR, spi_sr); ++ ++ ++ if (spi_sr & (SPI_SR_EOQF | SPI_SR_TCFQF)) { ++ /* Get transfer counter (in number of SPI transfers). It was ++ * reset to 0 when transfer(s) were started. ++ */ ++ regmap_read(dspi->regmap, SPI_TCR, &spi_tcr); ++ spi_tcnt = SPI_TCR_GET_TCNT(spi_tcr); ++ /* Update total number of bytes that were transferred */ ++ msg->actual_length += spi_tcnt * dspi->bytes_per_word; ++ ++ trans_mode = dspi->devtype_data->trans_mode; ++ switch (trans_mode) { ++ case DSPI_EOQ_MODE: ++ dspi_eoq_read(dspi); ++ break; ++ case DSPI_TCFQ_MODE: ++ dspi_tcfq_read(dspi); ++ break; ++ default: ++ dev_err(&dspi->pdev->dev, "unsupported trans_mode %u\n", ++ trans_mode); ++ return IRQ_HANDLED; ++ } ++ ++ if (!dspi->len) { ++ dspi->waitflags = 1; ++ wake_up_interruptible(&dspi->waitq); ++ } else { ++ switch (trans_mode) { ++ case DSPI_EOQ_MODE: ++ dspi_eoq_write(dspi); ++ break; ++ case DSPI_TCFQ_MODE: ++ dspi_tcfq_write(dspi); ++ break; ++ default: ++ dev_err(&dspi->pdev->dev, ++ "unsupported trans_mode %u\n", ++ trans_mode); ++ } ++ } ++ } ++ ++ return IRQ_HANDLED; ++} ++ + static int dspi_transfer_one_message(struct spi_controller *ctlr, + struct spi_message *message) + { +@@ -825,63 +882,6 @@ static void dspi_cleanup(struct spi_device *spi) + kfree(chip); + } + +-static irqreturn_t dspi_interrupt(int irq, void *dev_id) +-{ +- struct fsl_dspi *dspi = (struct fsl_dspi *)dev_id; +- struct spi_message *msg = dspi->cur_msg; +- enum dspi_trans_mode trans_mode; +- u32 spi_sr, spi_tcr; +- u16 spi_tcnt; +- +- regmap_read(dspi->regmap, SPI_SR, &spi_sr); +- regmap_write(dspi->regmap, SPI_SR, spi_sr); +- +- +- if (spi_sr & (SPI_SR_EOQF | SPI_SR_TCFQF)) { +- /* Get transfer counter (in number of SPI transfers). It was +- * reset to 0 when transfer(s) were started. +- */ +- regmap_read(dspi->regmap, SPI_TCR, &spi_tcr); +- spi_tcnt = SPI_TCR_GET_TCNT(spi_tcr); +- /* Update total number of bytes that were transferred */ +- msg->actual_length += spi_tcnt * dspi->bytes_per_word; +- +- trans_mode = dspi->devtype_data->trans_mode; +- switch (trans_mode) { +- case DSPI_EOQ_MODE: +- dspi_eoq_read(dspi); +- break; +- case DSPI_TCFQ_MODE: +- dspi_tcfq_read(dspi); +- break; +- default: +- dev_err(&dspi->pdev->dev, "unsupported trans_mode %u\n", +- trans_mode); +- return IRQ_HANDLED; +- } +- +- if (!dspi->len) { +- dspi->waitflags = 1; +- wake_up_interruptible(&dspi->waitq); +- } else { +- switch (trans_mode) { +- case DSPI_EOQ_MODE: +- dspi_eoq_write(dspi); +- break; +- case DSPI_TCFQ_MODE: +- dspi_tcfq_write(dspi); +- break; +- default: +- dev_err(&dspi->pdev->dev, +- "unsupported trans_mode %u\n", +- trans_mode); +- } +- } +- } +- +- return IRQ_HANDLED; +-} +- + static const struct of_device_id fsl_dspi_dt_ids[] = { + { .compatible = "fsl,vf610-dspi", .data = &vf610_data, }, + { .compatible = "fsl,ls1021a-v1.0-dspi", .data = &ls1021a_v1_data, }, +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Move-invariant-configs-out-of-dspi_.patch b/patches.suse/spi-spi-fsl-dspi-Move-invariant-configs-out-of-dspi_.patch new file mode 100644 index 0000000..2f35f5a --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Move-invariant-configs-out-of-dspi_.patch @@ -0,0 +1,128 @@ +From: Vladimir Oltean +Date: Wed, 18 Mar 2020 02:16:00 +0200 +Subject: spi: spi-fsl-dspi: Move invariant configs out of + dspi_transfer_one_message + +Git-commit: 5b342c5ab7cde6c543faf46e30bb501feaa2e435 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +The operating mode (DMA, XSPI, EOQ) is not going to change across the +lifetime of the device. So it makes no sense to keep writing to SPI_RSER +on each message. Move this configuration to dspi_init instead. + +Signed-off-by: Vladimir Oltean +Tested-by: Michael Walle +Link: https://lore.kernel.org/r/20200318001603.9650-10-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 55 +++++++++++++++++++++++---------------------- + 1 file changed, 29 insertions(+), 26 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -893,7 +893,6 @@ static int dspi_transfer_one_message(str + { + struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); + struct spi_device *spi = message->spi; +- enum dspi_trans_mode trans_mode; + struct spi_transfer *transfer; + int status = 0; + +@@ -931,30 +930,11 @@ static int dspi_transfer_one_message(str + SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF, + SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF); + +- trans_mode = dspi->devtype_data->trans_mode; +- switch (trans_mode) { +- case DSPI_EOQ_MODE: +- regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_EOQFE); +- dspi_fifo_write(dspi); +- break; +- case DSPI_XSPI_MODE: +- regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_CMDTCFE); +- dspi_fifo_write(dspi); +- break; +- case DSPI_DMA_MODE: +- regmap_write(dspi->regmap, SPI_RSER, +- SPI_RSER_TFFFE | SPI_RSER_TFFFD | +- SPI_RSER_RFDFE | SPI_RSER_RFDFD); ++ if (dspi->devtype_data->trans_mode == DSPI_DMA_MODE) { + status = dspi_dma_xfer(dspi); +- break; +- default: +- dev_err(&dspi->pdev->dev, "unsupported trans_mode %u\n", +- trans_mode); +- status = -EINVAL; +- goto out; +- } ++ } else { ++ dspi_fifo_write(dspi); + +- if (trans_mode != DSPI_DMA_MODE) { + if (dspi->irq) { + wait_for_completion(&dspi->xfer_done); + reinit_completion(&dspi->xfer_done); +@@ -964,12 +944,13 @@ static int dspi_transfer_one_message(str + } while (status == -EINPROGRESS); + } + } ++ if (status) ++ break; + + if (transfer->delay_usecs) + udelay(transfer->delay_usecs); + } + +-out: + message->status = status; + spi_finalize_current_message(ctlr); + +@@ -1160,7 +1141,7 @@ static const struct regmap_config dspi_x + }, + }; + +-static void dspi_init(struct fsl_dspi *dspi) ++static int dspi_init(struct fsl_dspi *dspi) + { + unsigned int mcr; + +@@ -1174,6 +1155,26 @@ static void dspi_init(struct fsl_dspi *d + + regmap_write(dspi->regmap, SPI_MCR, mcr); + regmap_write(dspi->regmap, SPI_SR, SPI_SR_CLEAR); ++ ++ switch (dspi->devtype_data->trans_mode) { ++ case DSPI_EOQ_MODE: ++ regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_EOQFE); ++ break; ++ case DSPI_XSPI_MODE: ++ regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_CMDTCFE); ++ break; ++ case DSPI_DMA_MODE: ++ regmap_write(dspi->regmap, SPI_RSER, ++ SPI_RSER_TFFFE | SPI_RSER_TFFFD | ++ SPI_RSER_RFDFE | SPI_RSER_RFDFD); ++ break; ++ default: ++ dev_err(&dspi->pdev->dev, "unsupported trans_mode %u\n", ++ dspi->devtype_data->trans_mode); ++ return -EINVAL; ++ } ++ ++ return 0; + } + + static int dspi_slave_abort(struct spi_master *master) +@@ -1329,7 +1330,9 @@ static int dspi_probe(struct platform_de + if (ret) + goto out_ctlr_put; + +- dspi_init(dspi); ++ ret = dspi_init(dspi); ++ if (ret) ++ goto out_clk_put; + + dspi->irq = platform_get_irq(pdev, 0); + if (dspi->irq <= 0) { diff --git a/patches.suse/spi-spi-fsl-dspi-Optimize-dspi_setup_accel-for-lowes.patch b/patches.suse/spi-spi-fsl-dspi-Optimize-dspi_setup_accel-for-lowes.patch new file mode 100644 index 0000000..82e7154 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Optimize-dspi_setup_accel-for-lowes.patch @@ -0,0 +1,104 @@ +From: Vladimir Oltean +Date: Thu, 5 Mar 2020 00:00:42 +0200 +Subject: spi: spi-fsl-dspi: Optimize dspi_setup_accel for lowest interrupt + count + +Git-commit: 6365504d42d90c68555ee40cdf297a1f187cb4a3 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +Currently, a SPI transfer that is not multiple of the highest supported +word width (e.g. 4 bytes) will be transmitted as follows (assume a +30-byte buffer transmitted through a 32-bit wide FIFO that is 32 bytes +deep): + + - First 28 bytes are sent as 7 words of 32 bits each + - Last 2 bytes are sent as 1 word of 16 bits size + +But if the dspi_setup_accel function had decided to use a lower +oper_bits_per_word value (16 instead of 32), there would have been +enough space in the TX FIFO to fit the entire buffer in one go (15 words +of 16 bits each). + +What we're actually trying to avoid is mixing word sizes within the same +run with the TX FIFO, since there is an erratum surrounding this, and +invalid data might get transmitted. + +So this patch adds special cases for when the remaining length of the +buffer can be sent in one go as 8-bit or 16-bit words, otherwise it +falls back to the standard logic of sending as many bytes as possible at +the highest oper_bits_per_word value possible. + +The benefit is that there will be one less CMDFQ/EOQ interrupt to +service when the entire buffer is transmitted during a single go, and +that will improve the overall latency of the transfer. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20200304220044.11193-11-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 36 +++++++++++++++++++++++++----------- + 1 file changed, 25 insertions(+), 11 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index f5b802070d29..df4944353ed5 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -775,20 +775,34 @@ static void dspi_fifo_read(struct fsl_dspi *dspi) + static void dspi_setup_accel(struct fsl_dspi *dspi) + { + struct spi_transfer *xfer = dspi->cur_transfer; ++ bool odd = !!(dspi->len & 1); + +- /* Start off with maximum supported by hardware */ +- if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE) +- dspi->oper_bits_per_word = 32; +- else ++ /* No accel for frames not multiple of 8 bits at the moment */ ++ if (xfer->bits_per_word % 8) ++ goto no_accel; ++ ++ if (!odd && dspi->len <= dspi->devtype_data->fifo_size * 2) { + dspi->oper_bits_per_word = 16; ++ } else if (odd && dspi->len <= dspi->devtype_data->fifo_size) { ++ dspi->oper_bits_per_word = 8; ++ } else { ++ /* Start off with maximum supported by hardware */ ++ if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE) ++ dspi->oper_bits_per_word = 32; ++ else ++ dspi->oper_bits_per_word = 16; + +- /* And go down only if the buffer can't be sent with words this big */ +- do { +- if (dspi->len >= DIV_ROUND_UP(dspi->oper_bits_per_word, 8)) +- break; ++ /* ++ * And go down only if the buffer can't be sent with ++ * words this big ++ */ ++ do { ++ if (dspi->len >= DIV_ROUND_UP(dspi->oper_bits_per_word, 8)) ++ break; + +- dspi->oper_bits_per_word /= 2; +- } while (dspi->oper_bits_per_word > 8); ++ dspi->oper_bits_per_word /= 2; ++ } while (dspi->oper_bits_per_word > 8); ++ } + + if (xfer->bits_per_word == 8 && dspi->oper_bits_per_word == 32) { + dspi->dev_to_host = dspi_8on32_dev_to_host; +@@ -800,7 +814,7 @@ static void dspi_setup_accel(struct fsl_dspi *dspi) + dspi->dev_to_host = dspi_16on32_dev_to_host; + dspi->host_to_dev = dspi_16on32_host_to_dev; + } else { +- /* No acceleration needed (8dev_to_host = dspi_native_dev_to_host; + dspi->host_to_dev = dspi_native_host_to_dev; + dspi->oper_bits_per_word = xfer->bits_per_word; +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Parameterize-the-FIFO-size-and-DMA-.patch b/patches.suse/spi-spi-fsl-dspi-Parameterize-the-FIFO-size-and-DMA-.patch new file mode 100644 index 0000000..ba704e5 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Parameterize-the-FIFO-size-and-DMA-.patch @@ -0,0 +1,191 @@ +From: Vladimir Oltean +Date: Mon, 2 Mar 2020 02:19:55 +0200 +Subject: spi: spi-fsl-dspi: Parameterize the FIFO size and DMA buffer size + +Git-commit: 1d8b4c95c37ccccfc18adef7a13b79fbc3e1557e +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +Get rid of the ifdef for Coldfire and make these hardware +characteristics part of dspi->devtype_data. + +Signed-off-by: Vladimir Oltean +Message-Id: <20200302001958.11105-4-olteanv@gmail.com> +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 48 ++++++++++++++++++++++++++------------------- + 1 file changed, 28 insertions(+), 20 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -20,13 +20,6 @@ + + #define DRIVER_NAME "fsl-dspi" + +-#ifdef CONFIG_M5441x +-#define DSPI_FIFO_SIZE 16 +-#else +-#define DSPI_FIFO_SIZE 4 +-#endif +-#define DSPI_DMA_BUFSIZE (DSPI_FIFO_SIZE * 1024) +- + #define SPI_MCR 0x00 + #define SPI_MCR_MASTER BIT(31) + #define SPI_MCR_PCSIS (0x3F << 16) +@@ -130,6 +123,8 @@ struct fsl_dspi_devtype_data { + enum dspi_trans_mode trans_mode; + u8 max_clock_factor; + bool xspi_mode; ++ int fifo_size; ++ int dma_bufsize; + }; + + enum { +@@ -148,47 +143,57 @@ static const struct fsl_dspi_devtype_dat + [VF610] = { + .trans_mode = DSPI_DMA_MODE, + .max_clock_factor = 2, ++ .dma_bufsize = 4096, ++ .fifo_size = 4, + }, + [LS1021A] = { + .trans_mode = DSPI_TCFQ_MODE, + .max_clock_factor = 8, + .xspi_mode = true, ++ .fifo_size = 4, + }, + [LS1012A] = { + .trans_mode = DSPI_TCFQ_MODE, + .max_clock_factor = 8, + .xspi_mode = true, ++ .fifo_size = 16, + }, + [LS1043A] = { + .trans_mode = DSPI_TCFQ_MODE, + .max_clock_factor = 8, + .xspi_mode = true, ++ .fifo_size = 16, + }, + [LS1046A] = { + .trans_mode = DSPI_TCFQ_MODE, + .max_clock_factor = 8, + .xspi_mode = true, ++ .fifo_size = 16, + }, + [LS2080A] = { + .trans_mode = DSPI_TCFQ_MODE, + .max_clock_factor = 8, ++ .fifo_size = 4, + }, + [LS2085A] = { + .trans_mode = DSPI_TCFQ_MODE, + .max_clock_factor = 8, ++ .fifo_size = 4, + }, + [LX2160A] = { + .trans_mode = DSPI_TCFQ_MODE, + .max_clock_factor = 8, ++ .fifo_size = 4, + }, + [MCF5441X] = { + .trans_mode = DSPI_EOQ_MODE, + .max_clock_factor = 8, ++ .fifo_size = 16, + }, + }; + + struct fsl_dspi_dma { +- /* Length of transfer in words of DSPI_FIFO_SIZE */ ++ /* Length of transfer in words of dspi->fifo_size */ + u32 curr_xfer_len; + + u32 *tx_dma_buf; +@@ -388,7 +393,8 @@ static int dspi_dma_xfer(struct fsl_dspi + int ret = 0; + + curr_remaining_bytes = dspi->len; +- bytes_per_buffer = DSPI_DMA_BUFSIZE / DSPI_FIFO_SIZE; ++ bytes_per_buffer = dspi->devtype_data->dma_bufsize / ++ dspi->devtype_data->fifo_size; + while (curr_remaining_bytes) { + /* Check if current transfer fits the DMA buffer */ + dma->curr_xfer_len = curr_remaining_bytes +@@ -440,14 +446,14 @@ static int dspi_request_dma(struct fsl_d + goto err_tx_channel; + } + +- dma->tx_dma_buf = dma_alloc_coherent(dev, DSPI_DMA_BUFSIZE, ++ dma->tx_dma_buf = dma_alloc_coherent(dev, dspi->devtype_data->dma_bufsize, + &dma->tx_dma_phys, GFP_KERNEL); + if (!dma->tx_dma_buf) { + ret = -ENOMEM; + goto err_tx_dma_buf; + } + +- dma->rx_dma_buf = dma_alloc_coherent(dev, DSPI_DMA_BUFSIZE, ++ dma->rx_dma_buf = dma_alloc_coherent(dev, dspi->devtype_data->dma_bufsize, + &dma->rx_dma_phys, GFP_KERNEL); + if (!dma->rx_dma_buf) { + ret = -ENOMEM; +@@ -484,11 +490,11 @@ static int dspi_request_dma(struct fsl_d + return 0; + + err_slave_config: +- dma_free_coherent(dev, DSPI_DMA_BUFSIZE, +- dma->rx_dma_buf, dma->rx_dma_phys); ++ dma_free_coherent(dev, dspi->devtype_data->dma_bufsize, ++ dma->rx_dma_buf, dma->rx_dma_phys); + err_rx_dma_buf: +- dma_free_coherent(dev, DSPI_DMA_BUFSIZE, +- dma->tx_dma_buf, dma->tx_dma_phys); ++ dma_free_coherent(dev, dspi->devtype_data->dma_bufsize, ++ dma->tx_dma_buf, dma->tx_dma_phys); + err_tx_dma_buf: + dma_release_channel(dma->chan_tx); + err_tx_channel: +@@ -510,13 +516,15 @@ static void dspi_release_dma(struct fsl_ + + if (dma->chan_tx) { + dma_unmap_single(dev, dma->tx_dma_phys, +- DSPI_DMA_BUFSIZE, DMA_TO_DEVICE); ++ dspi->devtype_data->dma_bufsize, ++ DMA_TO_DEVICE); + dma_release_channel(dma->chan_tx); + } + + if (dma->chan_rx) { + dma_unmap_single(dev, dma->rx_dma_phys, +- DSPI_DMA_BUFSIZE, DMA_FROM_DEVICE); ++ dspi->devtype_data->dma_bufsize, ++ DMA_FROM_DEVICE); + dma_release_channel(dma->chan_rx); + } + } +@@ -648,7 +656,7 @@ static void dspi_tcfq_read(struct fsl_ds + + static void dspi_eoq_write(struct fsl_dspi *dspi) + { +- int fifo_size = DSPI_FIFO_SIZE; ++ int fifo_size = dspi->devtype_data->fifo_size; + u16 xfer_cmd = dspi->tx_cmd; + + /* Fill TX FIFO with as many transfers as possible */ +@@ -658,7 +666,7 @@ static void dspi_eoq_write(struct fsl_ds + if (dspi->len == dspi->bytes_per_word || fifo_size == 0) + dspi->tx_cmd |= SPI_PUSHR_CMD_EOQ; + /* Clear transfer count for first transfer in FIFO */ +- if (fifo_size == (DSPI_FIFO_SIZE - 1)) ++ if (fifo_size == (dspi->devtype_data->fifo_size - 1)) + dspi->tx_cmd |= SPI_PUSHR_CMD_CTCNT; + /* Write combined TX FIFO and CMD FIFO entry */ + fifo_write(dspi); +@@ -667,7 +675,7 @@ static void dspi_eoq_write(struct fsl_ds + + static void dspi_eoq_read(struct fsl_dspi *dspi) + { +- int fifo_size = DSPI_FIFO_SIZE; ++ int fifo_size = dspi->devtype_data->fifo_size; + + /* Read one FIFO entry and push to rx buffer */ + while ((dspi->rx < dspi->rx_end) && fifo_size--) diff --git a/patches.suse/spi-spi-fsl-dspi-Protect-against-races-on-dspi-words.patch b/patches.suse/spi-spi-fsl-dspi-Protect-against-races-on-dspi-words.patch new file mode 100644 index 0000000..95ffc14 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Protect-against-races-on-dspi-words.patch @@ -0,0 +1,243 @@ +From: Vladimir Oltean +Date: Wed, 18 Mar 2020 02:15:56 +0200 +Subject: spi: spi-fsl-dspi: Protect against races on dspi->words_in_flight + +Git-commit: 0dedf901078074d6c5b41c297fac12c02c6dc41f +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +dspi->words_in_flight is a variable populated in the *_write functions +and used in the dspi_fifo_read function. It is also used in +dspi_fifo_write, immediately after transmission, to update the +message->actual_length variable used by higher layers such as spi-mem +for integrity checking. + +But it may happen that the IRQ which calls dspi_fifo_read to be +triggered before the updating of message->actual_length takes place. In +that case, dspi_fifo_read will decrement dspi->words_in_flight to -1, +and that will cause an invalid modification of message->actual_length. + +For that, we make the simplest fix possible: to not decrement the actual +shared variable in dspi->words_in_flight from dspi_fifo_read, but +actually a copy of it which is on stack. + +But even if dspi_fifo_read from the next IRQ does not interfere with the +dspi_fifo_write of the current chunk, the *next* dspi_fifo_write still +can. So we must assume that everything after the last write to the TX +FIFO can be preempted by the "TX complete" IRQ, and the dspi_fifo_write +function must be safe against that. This means refactoring the 2 +flavours of FIFO writes (for EOQ and XSPI) such that the calculation of +the number of words to be written is common and happens a priori. This +way, the code for updating the message->actual_length variable works +with a copy and not with the volatile dspi->words_in_flight. + +After some interior debate, the dspi->progress variable used for +software timestamping was *not* backed up against preemption in a copy +on stack. Because if preemption does occur between +spi_take_timestamp_pre and spi_take_timestamp_post, there's really no +point in trying to save anything. The first-in-time +spi_take_timestamp_post call with a dspi->progress higher than the +requested xfer->ptp_sts_word_post will trigger xfer->timestamped = true +anyway and will close the deal. + +To understand the above a bit better, consider a transfer with +xfer->ptp_sts_word_pre = xfer->ptp_sts_word_post = 3, and +xfer->bits_per_words = 8 (so byte 3 needs to be timestamped). The DSPI +controller timestamps in chunks of 4 bytes at a time, and preemption +occurs in the middle of timestamping the first chunk: + + spi_take_timestamp_pre(0) + . + . (preemption) + . + . spi_take_timestamp_pre(4) + . + . spi_take_timestamp_post(7) + . + spi_take_timestamp_post(3) + +So the reason I'm not bothering to back up dspi->progress for that +spi_take_timestamp_post(3) is that spi_take_timestamp_post(7) is going +to (a) be more honest, (b) provide better accuracy and (c) already +render the spi_take_timestamp_post(3) into a noop by setting +xfer->timestamped = true anyway. + +Fixes: d59c90a2400f ("spi: spi-fsl-dspi: Convert TCFQ users to XSPI FIFO mode") +Reported-by: Michael Walle +Signed-off-by: Vladimir Oltean +Tested-by: Michael Walle +Link: https://lore.kernel.org/r/20200318001603.9650-6-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 109 +++++++++++++++++++++------------------------ + 1 file changed, 51 insertions(+), 58 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -668,17 +668,26 @@ static void dspi_pushr_txdata_write(stru + regmap_write(dspi->regmap_pushr, dspi->pushr_tx, txdata); + } + +-static void dspi_xspi_write(struct fsl_dspi *dspi, int cnt, bool eoq) ++static void dspi_xspi_fifo_write(struct fsl_dspi *dspi, int num_words) + { ++ int num_bytes = num_words * dspi->oper_word_size; + u16 tx_cmd = dspi->tx_cmd; + +- if (eoq) ++ /* ++ * If the PCS needs to de-assert (i.e. we're at the end of the buffer ++ * and cs_change does not want the PCS to stay on), then we need a new ++ * PUSHR command, since this one (for the body of the buffer) ++ * necessarily has the CONT bit set. ++ * So send one word less during this go, to force a split and a command ++ * with a single word next time, when CONT will be unset. ++ */ ++ if (!(dspi->tx_cmd & SPI_PUSHR_CMD_CONT) && num_bytes == dspi->len) + tx_cmd |= SPI_PUSHR_CMD_EOQ; + + /* Update CTARE */ + regmap_write(dspi->regmap, SPI_CTARE(0), + SPI_FRAME_EBITS(dspi->oper_bits_per_word) | +- SPI_CTARE_DTCP(cnt)); ++ SPI_CTARE_DTCP(num_words)); + + /* + * Write the CMD FIFO entry first, and then the two +@@ -687,7 +696,7 @@ static void dspi_xspi_write(struct fsl_d + dspi_pushr_cmd_write(dspi, tx_cmd); + + /* Fill TX FIFO with as many transfers as possible */ +- while (cnt--) { ++ while (num_words--) { + u32 data = dspi_pop_tx(dspi); + + dspi_pushr_txdata_write(dspi, data & 0xFFFF); +@@ -696,58 +705,15 @@ static void dspi_xspi_write(struct fsl_d + } + } + +-static void dspi_xspi_fifo_write(struct fsl_dspi *dspi) +-{ +- int num_fifo_entries = dspi->devtype_data->fifo_size; +- int bytes_in_flight; +- bool eoq = false; +- +- /* In XSPI mode each 32-bit word occupies 2 TX FIFO entries */ +- if (dspi->oper_word_size == 4) +- num_fifo_entries /= 2; +- +- /* +- * Integer division intentionally trims off odd (or non-multiple of 4) +- * numbers of bytes at the end of the buffer, which will be sent next +- * time using a smaller oper_word_size. +- */ +- dspi->words_in_flight = dspi->len / dspi->oper_word_size; +- +- if (dspi->words_in_flight > num_fifo_entries) +- dspi->words_in_flight = num_fifo_entries; +- +- bytes_in_flight = dspi->words_in_flight * dspi->oper_word_size; +- +- /* +- * If the PCS needs to de-assert (i.e. we're at the end of the buffer +- * and cs_change does not want the PCS to stay on), then we need a new +- * PUSHR command, since this one (for the body of the buffer) +- * necessarily has the CONT bit set. +- * So send one word less during this go, to force a split and a command +- * with a single word next time, when CONT will be unset. +- */ +- if (!(dspi->tx_cmd & SPI_PUSHR_CMD_CONT) && +- bytes_in_flight == dspi->len) +- eoq = true; +- +- dspi_xspi_write(dspi, dspi->words_in_flight, eoq); +-} +- +-static void dspi_eoq_fifo_write(struct fsl_dspi *dspi) ++static void dspi_eoq_fifo_write(struct fsl_dspi *dspi, int num_words) + { +- int num_fifo_entries = dspi->devtype_data->fifo_size; + u16 xfer_cmd = dspi->tx_cmd; + +- if (num_fifo_entries * dspi->oper_word_size > dspi->len) +- num_fifo_entries = dspi->len / dspi->oper_word_size; +- +- dspi->words_in_flight = num_fifo_entries; +- + /* Fill TX FIFO with as many transfers as possible */ +- while (num_fifo_entries--) { ++ while (num_words--) { + dspi->tx_cmd = xfer_cmd; + /* Request EOQF for last transfer in FIFO */ +- if (num_fifo_entries == 0) ++ if (num_words == 0) + dspi->tx_cmd |= SPI_PUSHR_CMD_EOQ; + /* Write combined TX FIFO and CMD FIFO entry */ + dspi_pushr_write(dspi); +@@ -764,8 +730,10 @@ static u32 dspi_popr_read(struct fsl_dsp + + static void dspi_fifo_read(struct fsl_dspi *dspi) + { ++ int num_fifo_entries = dspi->words_in_flight; ++ + /* Read one FIFO entry and push to rx buffer */ +- while (dspi->words_in_flight--) ++ while (num_fifo_entries--) + dspi_push_rx(dspi, dspi_popr_read(dspi)); + } + +@@ -831,20 +799,45 @@ no_accel: + + static void dspi_fifo_write(struct fsl_dspi *dspi) + { ++ int num_fifo_entries = dspi->devtype_data->fifo_size; + struct spi_transfer *xfer = dspi->cur_transfer; + struct spi_message *msg = dspi->cur_msg; +- int bytes_sent; ++ int num_words, num_bytes; + + dspi_setup_accel(dspi); + +- if (dspi->devtype_data->trans_mode == DSPI_EOQ_MODE) +- dspi_eoq_fifo_write(dspi); +- else +- dspi_xspi_fifo_write(dspi); ++ /* In XSPI mode each 32-bit word occupies 2 TX FIFO entries */ ++ if (dspi->oper_word_size == 4) ++ num_fifo_entries /= 2; ++ ++ /* ++ * Integer division intentionally trims off odd (or non-multiple of 4) ++ * numbers of bytes at the end of the buffer, which will be sent next ++ * time using a smaller oper_word_size. ++ */ ++ num_words = dspi->len / dspi->oper_word_size; ++ if (num_words > num_fifo_entries) ++ num_words = num_fifo_entries; + + /* Update total number of bytes that were transferred */ +- bytes_sent = dspi->words_in_flight * dspi->oper_word_size; +- msg->actual_length += bytes_sent; ++ num_bytes = num_words * dspi->oper_word_size; ++ msg->actual_length += num_bytes; ++ ++ /* ++ * Update shared variable for use in the next interrupt (both in ++ * dspi_fifo_read and in dspi_fifo_write). ++ */ ++ dspi->words_in_flight = num_words; ++ ++ if (dspi->devtype_data->trans_mode == DSPI_EOQ_MODE) ++ dspi_eoq_fifo_write(dspi, num_words); ++ else ++ dspi_xspi_fifo_write(dspi, num_words); ++ /* ++ * Everything after this point is in a potential race with the next ++ * interrupt, so we must never use dspi->words_in_flight again since it ++ * might already be modified by the next dspi_fifo_write. ++ */ + } + + static int dspi_rxtx(struct fsl_dspi *dspi) diff --git a/patches.suse/spi-spi-fsl-dspi-Reduce-indentation-in-dspi_release_.patch b/patches.suse/spi-spi-fsl-dspi-Reduce-indentation-in-dspi_release_.patch new file mode 100644 index 0000000..13d983a --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Reduce-indentation-in-dspi_release_.patch @@ -0,0 +1,57 @@ +From: Vladimir Oltean +Date: Sun, 18 Aug 2019 21:01:07 +0300 +Subject: spi: spi-fsl-dspi: Reduce indentation in dspi_release_dma() + +Git-commit: abbd0ef1f2542621e0f94a7273b7f7e458a38497 +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +There is no point in surrounding an entire function block in an if +condition. Rather, exit early if the condition is false. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20190818180115.31114-7-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 23 ++++++++++++----------- + 1 file changed, 12 insertions(+), 11 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index b0c546841260..c07525a9fd34 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -471,18 +471,19 @@ static void dspi_release_dma(struct fsl_dspi *dspi) + struct fsl_dspi_dma *dma = dspi->dma; + struct device *dev = &dspi->pdev->dev; + +- if (dma) { +- if (dma->chan_tx) { +- dma_unmap_single(dev, dma->tx_dma_phys, +- DSPI_DMA_BUFSIZE, DMA_TO_DEVICE); +- dma_release_channel(dma->chan_tx); +- } ++ if (!dma) ++ return; + +- if (dma->chan_rx) { +- dma_unmap_single(dev, dma->rx_dma_phys, +- DSPI_DMA_BUFSIZE, DMA_FROM_DEVICE); +- dma_release_channel(dma->chan_rx); +- } ++ if (dma->chan_tx) { ++ dma_unmap_single(dev, dma->tx_dma_phys, ++ DSPI_DMA_BUFSIZE, DMA_TO_DEVICE); ++ dma_release_channel(dma->chan_tx); ++ } ++ ++ if (dma->chan_rx) { ++ dma_unmap_single(dev, dma->rx_dma_phys, ++ DSPI_DMA_BUFSIZE, DMA_FROM_DEVICE); ++ dma_release_channel(dma->chan_rx); + } + } + +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Reduce-indentation-level-in-dspi_in.patch b/patches.suse/spi-spi-fsl-dspi-Reduce-indentation-level-in-dspi_in.patch new file mode 100644 index 0000000..cce127a --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Reduce-indentation-level-in-dspi_in.patch @@ -0,0 +1,116 @@ +From: Vladimir Oltean +Date: Fri, 23 Aug 2019 00:15:10 +0300 +Subject: spi: spi-fsl-dspi: Reduce indentation level in dspi_interrupt + +Git-commit: 12fb61a973935c63f2580b3b053017cc14b51f42 +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +If the entire function depends on the SPI status register having the +interrupt bits asserted, then just check it and exit early if those bits +aren't set (such as in the case of the shared IRQ being triggered for +the other peripheral). Cosmetic patch. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20190822211514.19288-2-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 79 +++++++++++++++++++------------------- + 1 file changed, 40 insertions(+), 39 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 790cb02fc181..c90db7db4121 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -658,47 +658,48 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id) + regmap_read(dspi->regmap, SPI_SR, &spi_sr); + regmap_write(dspi->regmap, SPI_SR, spi_sr); + ++ if (!(spi_sr & (SPI_SR_EOQF | SPI_SR_TCFQF))) ++ return IRQ_HANDLED; ++ ++ /* Get transfer counter (in number of SPI transfers). It was ++ * reset to 0 when transfer(s) were started. ++ */ ++ regmap_read(dspi->regmap, SPI_TCR, &spi_tcr); ++ spi_tcnt = SPI_TCR_GET_TCNT(spi_tcr); ++ /* Update total number of bytes that were transferred */ ++ msg->actual_length += spi_tcnt * dspi->bytes_per_word; ++ ++ trans_mode = dspi->devtype_data->trans_mode; ++ switch (trans_mode) { ++ case DSPI_EOQ_MODE: ++ dspi_eoq_read(dspi); ++ break; ++ case DSPI_TCFQ_MODE: ++ dspi_tcfq_read(dspi); ++ break; ++ default: ++ dev_err(&dspi->pdev->dev, "unsupported trans_mode %u\n", ++ trans_mode); ++ return IRQ_HANDLED; ++ } + +- if (spi_sr & (SPI_SR_EOQF | SPI_SR_TCFQF)) { +- /* Get transfer counter (in number of SPI transfers). It was +- * reset to 0 when transfer(s) were started. +- */ +- regmap_read(dspi->regmap, SPI_TCR, &spi_tcr); +- spi_tcnt = SPI_TCR_GET_TCNT(spi_tcr); +- /* Update total number of bytes that were transferred */ +- msg->actual_length += spi_tcnt * dspi->bytes_per_word; +- +- trans_mode = dspi->devtype_data->trans_mode; +- switch (trans_mode) { +- case DSPI_EOQ_MODE: +- dspi_eoq_read(dspi); +- break; +- case DSPI_TCFQ_MODE: +- dspi_tcfq_read(dspi); +- break; +- default: +- dev_err(&dspi->pdev->dev, "unsupported trans_mode %u\n", +- trans_mode); +- return IRQ_HANDLED; +- } ++ if (!dspi->len) { ++ dspi->waitflags = 1; ++ wake_up_interruptible(&dspi->waitq); ++ return IRQ_HANDLED; ++ } + +- if (!dspi->len) { +- dspi->waitflags = 1; +- wake_up_interruptible(&dspi->waitq); +- } else { +- switch (trans_mode) { +- case DSPI_EOQ_MODE: +- dspi_eoq_write(dspi); +- break; +- case DSPI_TCFQ_MODE: +- dspi_tcfq_write(dspi); +- break; +- default: +- dev_err(&dspi->pdev->dev, +- "unsupported trans_mode %u\n", +- trans_mode); +- } +- } ++ switch (trans_mode) { ++ case DSPI_EOQ_MODE: ++ dspi_eoq_write(dspi); ++ break; ++ case DSPI_TCFQ_MODE: ++ dspi_tcfq_write(dspi); ++ break; ++ default: ++ dev_err(&dspi->pdev->dev, ++ "unsupported trans_mode %u\n", ++ trans_mode); + } + + return IRQ_HANDLED; +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Remove-impossible-to-reach-error-ch.patch b/patches.suse/spi-spi-fsl-dspi-Remove-impossible-to-reach-error-ch.patch new file mode 100644 index 0000000..0866ea9 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Remove-impossible-to-reach-error-ch.patch @@ -0,0 +1,73 @@ +From: Vladimir Oltean +Date: Fri, 23 Aug 2019 00:15:12 +0300 +Subject: spi: spi-fsl-dspi: Remove impossible to reach error check + +Git-commit: 1eaeba70738e723be1e5787bdfd9a30f7471d730 +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +dspi->devtype_data is under the total control of the driver. Therefore, +a bad value is a driver bug and checking it at runtime (and during an +ISR, at that!) is pointless. + +The second "else if" check is only for clarity (instead of a broader +"else") in case other transfer modes are added in the future. But the +printing is dead code and can be removed. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20190822211514.19288-4-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 24 ++++-------------------- + 1 file changed, 4 insertions(+), 20 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 6ef2279a3699..6d2c7984ab0e 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -670,18 +670,10 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id) + msg->actual_length += spi_tcnt * dspi->bytes_per_word; + + trans_mode = dspi->devtype_data->trans_mode; +- switch (trans_mode) { +- case DSPI_EOQ_MODE: ++ if (trans_mode == DSPI_EOQ_MODE) + dspi_eoq_read(dspi); +- break; +- case DSPI_TCFQ_MODE: ++ else if (trans_mode == DSPI_TCFQ_MODE) + dspi_tcfq_read(dspi); +- break; +- default: +- dev_err(&dspi->pdev->dev, "unsupported trans_mode %u\n", +- trans_mode); +- return IRQ_HANDLED; +- } + + if (!dspi->len) { + dspi->waitflags = 1; +@@ -689,18 +681,10 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id) + return IRQ_HANDLED; + } + +- switch (trans_mode) { +- case DSPI_EOQ_MODE: ++ if (trans_mode == DSPI_EOQ_MODE) + dspi_eoq_write(dspi); +- break; +- case DSPI_TCFQ_MODE: ++ else if (trans_mode == DSPI_TCFQ_MODE) + dspi_tcfq_write(dspi); +- break; +- default: +- dev_err(&dspi->pdev->dev, +- "unsupported trans_mode %u\n", +- trans_mode); +- } + + return IRQ_HANDLED; + } +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Remove-pointless-assignment-of-mast.patch b/patches.suse/spi-spi-fsl-dspi-Remove-pointless-assignment-of-mast.patch new file mode 100644 index 0000000..dab69c0 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Remove-pointless-assignment-of-mast.patch @@ -0,0 +1,36 @@ +From: Vladimir Oltean +Date: Sun, 18 Aug 2019 21:01:09 +0300 +Subject: spi: spi-fsl-dspi: Remove pointless assignment of master->transfer to + NULL + +Git-commit: bee44359169ecf293a0bd2351ada186a0864a94a +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +Introduced in commit 9298bc727385 ("spi: spi-fsl-dspi: Remove +spi-bitbang") for less than obvious reasons, this assignment is +confusing and serves no purpose. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20190818180115.31114-9-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index c5d99f4d5e3d..753584c4065c 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1006,7 +1006,6 @@ static int dspi_probe(struct platform_device *pdev) + dspi->pdev = pdev; + dspi->master = master; + +- master->transfer = NULL; + master->setup = dspi_setup; + master->transfer_one_message = dspi_transfer_one_message; + master->dev.of_node = pdev->dev.of_node; +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Remove-unused-chip-void_write_data.patch b/patches.suse/spi-spi-fsl-dspi-Remove-unused-chip-void_write_data.patch new file mode 100644 index 0000000..785f1f5 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Remove-unused-chip-void_write_data.patch @@ -0,0 +1,63 @@ +From: Vladimir Oltean +Date: Thu, 5 Mar 2020 00:00:34 +0200 +Subject: spi: spi-fsl-dspi: Remove unused chip->void_write_data + +Git-commit: 6d6af5796e5d9a88ae83c9c753023bba61deb18b +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +This variable has been present since the initial submission of the +driver, and held, for some reason, the value of zero, to be sent on the +wire in the case there wasn't any TX buffer for the current transfer. + +Since quite a while now, however, it isn't doing anything at all. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20200304220044.11193-3-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 896d7a0f45b0..63ec1d634d08 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -110,7 +110,6 @@ + + struct chip_data { + u32 ctar_val; +- u16 void_write_data; + }; + + enum dspi_trans_mode { +@@ -235,7 +234,6 @@ struct fsl_dspi { + const void *tx; + void *rx; + void *rx_end; +- u16 void_write_data; + u16 tx_cmd; + u8 bits_per_word; + u8 bytes_per_word; +@@ -795,8 +793,6 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr, + dspi->tx_cmd |= SPI_PUSHR_CMD_CONT; + } + +- dspi->void_write_data = dspi->cur_chip->void_write_data; +- + dspi->tx = transfer->tx_buf; + dspi->rx = transfer->rx_buf; + dspi->rx_end = dspi->rx + transfer->len; +@@ -897,8 +893,6 @@ static int dspi_setup(struct spi_device *spi) + sck_cs_delay = pdata->sck_cs_delay; + } + +- chip->void_write_data = 0; +- + clkrate = clk_get_rate(dspi->clk); + hz_to_spi_baud(&pbr, &br, spi->max_speed_hz, clkrate); + +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Remove-unused-defines-and-includes.patch b/patches.suse/spi-spi-fsl-dspi-Remove-unused-defines-and-includes.patch new file mode 100644 index 0000000..d6a818a --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Remove-unused-defines-and-includes.patch @@ -0,0 +1,94 @@ +From: Vladimir Oltean +Date: Sun, 18 Aug 2019 21:01:03 +0300 +Subject: spi: spi-fsl-dspi: Remove unused defines and includes + +Git-commit: 5782a17fe528ce596eb5de66777a73b16f4f1549 +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +This is a cosmetic patch. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20190818180115.31114-3-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 26 -------------------------- + 1 file changed, 26 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 0adfff9cedd1..358b381839fb 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -9,24 +9,14 @@ + #include + #include + #include +-#include +-#include + #include +-#include + #include +-#include + #include +-#include + #include + #include +-#include +-#include + #include +-#include + #include + #include +-#include +-#include + + #define DRIVER_NAME "fsl-dspi" + +@@ -80,21 +70,14 @@ + + #define SPI_PUSHR 0x34 + #define SPI_PUSHR_CMD_CONT (1 << 15) +-#define SPI_PUSHR_CONT (SPI_PUSHR_CMD_CONT << 16) + #define SPI_PUSHR_CMD_CTAS(x) (((x) & 0x0003) << 12) +-#define SPI_PUSHR_CTAS(x) (SPI_PUSHR_CMD_CTAS(x) << 16) + #define SPI_PUSHR_CMD_EOQ (1 << 11) +-#define SPI_PUSHR_EOQ (SPI_PUSHR_CMD_EOQ << 16) + #define SPI_PUSHR_CMD_CTCNT (1 << 10) +-#define SPI_PUSHR_CTCNT (SPI_PUSHR_CMD_CTCNT << 16) + #define SPI_PUSHR_CMD_PCS(x) ((1 << x) & 0x003f) +-#define SPI_PUSHR_PCS(x) (SPI_PUSHR_CMD_PCS(x) << 16) +-#define SPI_PUSHR_TXDATA(x) ((x) & 0x0000ffff) + + #define SPI_PUSHR_SLAVE 0x34 + + #define SPI_POPR 0x38 +-#define SPI_POPR_RXDATA(x) ((x) & 0x0000ffff) + + #define SPI_TXFR0 0x3c + #define SPI_TXFR1 0x40 +@@ -112,21 +95,12 @@ + #define SPI_SREX 0x13c + + #define SPI_FRAME_BITS(bits) SPI_CTAR_FMSZ((bits) - 1) +-#define SPI_FRAME_BITS_MASK SPI_CTAR_FMSZ(0xf) +-#define SPI_FRAME_BITS_16 SPI_CTAR_FMSZ(0xf) +-#define SPI_FRAME_BITS_8 SPI_CTAR_FMSZ(0x7) +- + #define SPI_FRAME_EBITS(bits) SPI_CTARE_FMSZE(((bits) - 1) >> 4) +-#define SPI_FRAME_EBITS_MASK SPI_CTARE_FMSZE(1) + + /* Register offsets for regmap_pushr */ + #define PUSHR_CMD 0x0 + #define PUSHR_TX 0x2 + +-#define SPI_CS_INIT 0x01 +-#define SPI_CS_ASSERT 0x02 +-#define SPI_CS_DROP 0x04 +- + #define DMA_COMPLETION_TIMEOUT msecs_to_jiffies(3000) + + struct chip_data { +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Remove-unused-initialization-of-ret.patch b/patches.suse/spi-spi-fsl-dspi-Remove-unused-initialization-of-ret.patch new file mode 100644 index 0000000..491d6d4 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Remove-unused-initialization-of-ret.patch @@ -0,0 +1,37 @@ +From: Vladimir Oltean +Date: Sun, 18 Aug 2019 21:01:08 +0300 +Subject: spi: spi-fsl-dspi: Remove unused initialization of 'ret' in + dspi_probe + +Git-commit: 9b536d3647ee1348860657c239d247364e4374ec +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +There is no code path for reaching 'return ret;' without it first being +assigned to an error code. Therefore the initialization with 0 is +pointless. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20190818180115.31114-8-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index c07525a9fd34..c5d99f4d5e3d 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -996,7 +996,7 @@ static int dspi_probe(struct platform_device *pdev) + const struct regmap_config *regmap_config; + void __iomem *base; + struct fsl_dspi_platform_data *pdata; +- int ret = 0, cs_num, bus_num; ++ int ret, cs_num, bus_num; + + master = spi_alloc_master(&pdev->dev, sizeof(struct fsl_dspi)); + if (!master) +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Rename-fifo_-read-write-and-tx-cmd-.patch b/patches.suse/spi-spi-fsl-dspi-Rename-fifo_-read-write-and-tx-cmd-.patch new file mode 100644 index 0000000..eeaa18f --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Rename-fifo_-read-write-and-tx-cmd-.patch @@ -0,0 +1,101 @@ +From: Vladimir Oltean +Date: Thu, 5 Mar 2020 00:00:37 +0200 +Subject: spi: spi-fsl-dspi: Rename fifo_{read,write} and {tx,cmd}_fifo_write + +Git-commit: 547248fbed23f3cd2f6a5937b44fad60993640c4 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +These function names are very generic and it is easy to get confused. +Rename them after the hardware register that they are accessing. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20200304220044.11193-6-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index a8077d4903c7..f37090ad7ad1 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -601,12 +601,12 @@ static void ns_delay_scale(char *psc, char *sc, int delay_ns, + } + } + +-static void fifo_write(struct fsl_dspi *dspi) ++static void dspi_pushr_write(struct fsl_dspi *dspi) + { + regmap_write(dspi->regmap, SPI_PUSHR, dspi_pop_tx_pushr(dspi)); + } + +-static void cmd_fifo_write(struct fsl_dspi *dspi) ++static void dspi_pushr_cmd_write(struct fsl_dspi *dspi) + { + u16 cmd = dspi->tx_cmd; + +@@ -615,7 +615,7 @@ static void cmd_fifo_write(struct fsl_dspi *dspi) + regmap_write(dspi->regmap_pushr, PUSHR_CMD, cmd); + } + +-static void tx_fifo_write(struct fsl_dspi *dspi, u16 txdata) ++static void dspi_pushr_txdata_write(struct fsl_dspi *dspi, u16 txdata) + { + regmap_write(dspi->regmap_pushr, PUSHR_TX, txdata); + } +@@ -631,18 +631,18 @@ static void dspi_tcfq_write(struct fsl_dspi *dspi) + */ + u32 data = dspi_pop_tx(dspi); + +- cmd_fifo_write(dspi); +- tx_fifo_write(dspi, data & 0xFFFF); +- tx_fifo_write(dspi, data >> 16); ++ dspi_pushr_cmd_write(dspi); ++ dspi_pushr_txdata_write(dspi, data & 0xFFFF); ++ dspi_pushr_txdata_write(dspi, data >> 16); + } else { + /* Write one entry to both TX FIFO and CMD FIFO + * simultaneously. + */ +- fifo_write(dspi); ++ dspi_pushr_write(dspi); + } + } + +-static u32 fifo_read(struct fsl_dspi *dspi) ++static u32 dspi_popr_read(struct fsl_dspi *dspi) + { + u32 rxdata = 0; + +@@ -652,7 +652,7 @@ static u32 fifo_read(struct fsl_dspi *dspi) + + static void dspi_tcfq_read(struct fsl_dspi *dspi) + { +- dspi_push_rx(dspi, fifo_read(dspi)); ++ dspi_push_rx(dspi, dspi_popr_read(dspi)); + } + + static void dspi_eoq_write(struct fsl_dspi *dspi) +@@ -670,7 +670,7 @@ static void dspi_eoq_write(struct fsl_dspi *dspi) + if (fifo_size == (dspi->devtype_data->fifo_size - 1)) + dspi->tx_cmd |= SPI_PUSHR_CMD_CTCNT; + /* Write combined TX FIFO and CMD FIFO entry */ +- fifo_write(dspi); ++ dspi_pushr_write(dspi); + } + } + +@@ -680,7 +680,7 @@ static void dspi_eoq_read(struct fsl_dspi *dspi) + + /* Read one FIFO entry and push to rx buffer */ + while ((dspi->rx < dspi->rx_end) && fifo_size--) +- dspi_push_rx(dspi, fifo_read(dspi)); ++ dspi_push_rx(dspi, dspi_popr_read(dspi)); + } + + static int dspi_rxtx(struct fsl_dspi *dspi) +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Replace-interruptible-wait-queue-wi.patch b/patches.suse/spi-spi-fsl-dspi-Replace-interruptible-wait-queue-wi.patch new file mode 100644 index 0000000..023208f --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Replace-interruptible-wait-queue-wi.patch @@ -0,0 +1,171 @@ +From: Vladimir Oltean +Date: Wed, 18 Mar 2020 02:15:57 +0200 +Subject: spi: spi-fsl-dspi: Replace interruptible wait queue with a simple + completion + +Git-commit: 4f5ee75ea1718a09149460b3df993f389a67b56a +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +Currently the driver puts the process in interruptible sleep waiting for +the interrupt train to finish transfer to/from the tx_buf and rx_buf. + +But exiting the process with ctrl-c may make the kernel panic: the +wait_event_interruptible call will return -ERESTARTSYS, which a proper +driver implementation is perhaps supposed to handle, but nonetheless +this one doesn't, and aborts the transfer altogether. + +Actually when the task is interrupted, there is still a high chance that +the dspi_interrupt is still triggering. And if dspi_transfer_one_message +returns execution all the way to the spi_device driver, that can free +the spi_message and spi_transfer structures, leaving the interrupts to +access a freed tx_buf and rx_buf. + +hexdump -C /dev/mtd0 +00000000 00 75 68 75 0a ff ff ff ff ff ff ff ff ff ff ff +|.uhu............| +00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff +|................| +* +^C[ 38.495955] fsl-dspi 2120000.spi: Waiting for transfer to complete failed! +[ 38.503097] spi_master spi2: failed to transfer one message from queue +[ 38.509729] Unable to handle kernel paging request at virtual address ffff800095ab3377 +[ 38.517676] Mem abort info: +[ 38.520474] ESR = 0x96000045 +[ 38.523533] EC = 0x25: DABT (current EL), IL = 32 bits +[ 38.528861] SET = 0, FnV = 0 +[ 38.531921] EA = 0, S1PTW = 0 +[ 38.535067] Data abort info: +[ 38.537952] ISV = 0, ISS = 0x00000045 +[ 38.541797] CM = 0, WnR = 1 +[ 38.544771] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000082621000 +[ 38.551494] [ffff800095ab3377] pgd=00000020fffff003, p4d=00000020fffff003, pud=0000000000000000 +[ 38.560229] Internal error: Oops: 96000045 [#1] PREEMPT SMP +[ 38.565819] Modules linked in: +[ 38.568882] CPU: 0 PID: 2729 Comm: hexdump Not tainted 5.6.0-rc4-next-20200306-00052-gd8730cdc8a0b-dirty #193 +[ 38.578834] Hardware name: Kontron SMARC-sAL28 (Single PHY) on SMARC Eval 2.0 carrier (DT) +[ 38.587129] pstate: 20000085 (nzCv daIf -PAN -UAO) +[ 38.591941] pc : ktime_get_real_ts64+0x3c/0x110 +[ 38.596487] lr : spi_take_timestamp_pre+0x40/0x90 +[ 38.601203] sp : ffff800010003d90 +[ 38.604525] x29: ffff800010003d90 x28: ffff80001200e000 +[ 38.609854] x27: ffff800011da9000 x26: ffff002079c40400 +[ 38.615184] x25: ffff8000117fe018 x24: ffff800011daa1a0 +[ 38.620513] x23: ffff800015ab3860 x22: ffff800095ab3377 +[ 38.625841] x21: 000000000000146e x20: ffff8000120c3000 +[ 38.631170] x19: ffff0020795f6e80 x18: ffff800011da9948 +[ 38.636498] x17: 0000000000000000 x16: 0000000000000000 +[ 38.641826] x15: ffff800095ab3377 x14: 0720072007200720 +[ 38.647155] x13: 0720072007200765 x12: 0775076507750771 +[ 38.652483] x11: 0720076d076f0772 x10: 0000000000000040 +[ 38.657812] x9 : ffff8000108e2100 x8 : ffff800011dcabe8 +[ 38.663139] x7 : 0000000000000000 x6 : ffff800015ab3a60 +[ 38.668468] x5 : 0000000007200720 x4 : ffff800095ab3377 +[ 38.673796] x3 : 0000000000000000 x2 : 0000000000000ab0 +[ 38.679125] x1 : ffff800011daa000 x0 : 0000000000000026 +[ 38.684454] Call trace: +[ 38.686905] ktime_get_real_ts64+0x3c/0x110 +[ 38.691100] spi_take_timestamp_pre+0x40/0x90 +[ 38.695470] dspi_fifo_write+0x58/0x2c0 +[ 38.699315] dspi_interrupt+0xbc/0xd0 +[ 38.702987] __handle_irq_event_percpu+0x78/0x2c0 +[ 38.707706] handle_irq_event_percpu+0x3c/0x90 +[ 38.712161] handle_irq_event+0x4c/0xd0 +[ 38.716008] handle_fasteoi_irq+0xbc/0x170 +[ 38.720115] generic_handle_irq+0x2c/0x40 +[ 38.724135] __handle_domain_irq+0x68/0xc0 +[ 38.728243] gic_handle_irq+0xc8/0x160 +[ 38.732000] el1_irq+0xb8/0x180 +[ 38.735149] spi_nor_spimem_read_data+0xe0/0x140 +[ 38.739779] spi_nor_read+0xc4/0x120 +[ 38.743364] mtd_read_oob+0xa8/0xc0 +[ 38.746860] mtd_read+0x4c/0x80 +[ 38.750007] mtdchar_read+0x108/0x2a0 +[ 38.753679] __vfs_read+0x20/0x50 +[ 38.757002] vfs_read+0xa4/0x190 +[ 38.760237] ksys_read+0x6c/0xf0 +[ 38.763471] __arm64_sys_read+0x20/0x30 +[ 38.767319] el0_svc_common.constprop.3+0x90/0x160 +[ 38.772125] do_el0_svc+0x28/0x90 +[ 38.775449] el0_sync_handler+0x118/0x190 +[ 38.779468] el0_sync+0x140/0x180 +[ 38.782793] Code: 91000294 1400000f d50339bf f9405e80 (f90002c0) +[ 38.788910] ---[ end trace 55da560db4d6bef7 ]--- +[ 38.793540] Kernel panic - not syncing: Fatal exception in interrupt +[ 38.799914] SMP: stopping secondary CPUs +[ 38.803849] Kernel Offset: disabled +[ 38.807344] CPU features: 0x10002,20006008 +[ 38.811451] Memory Limit: none +[ 38.814513] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]--- + +So it is clear that the "interruptible" part isn't handled correctly. +When the process receives a signal, one could either attempt a clean +abort (which appears to be difficult with this hardware) or just keep +restarting the sleep until the wait queue really completes. But checking +in a loop for -ERESTARTSYS is a bit too complicated for this driver, so +just make the sleep uninterruptible, to avoid all that nonsense. + +The wait queue was actually restructured as a completion, after polling +other drivers for the most "popular" approach. + +Fixes: 349ad66c0ab0 ("spi:Add Freescale DSPI driver for Vybrid VF610 platform") +Reported-by: Michael Walle +Signed-off-by: Vladimir Oltean +Tested-by: Michael Walle +Link: https://lore.kernel.org/r/20200318001603.9650-7-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 19 ++++++------------- + 1 file changed, 6 insertions(+), 13 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -217,8 +217,7 @@ struct fsl_dspi { + u16 tx_cmd; + const struct fsl_dspi_devtype_data *devtype_data; + +- wait_queue_head_t waitq; +- u32 waitflags; ++ struct completion xfer_done; + + struct fsl_dspi_dma *dma; + +@@ -883,10 +882,8 @@ static irqreturn_t dspi_interrupt(int ir + if (!(spi_sr & (SPI_SR_EOQF | SPI_SR_CMDTCF))) + return IRQ_NONE; + +- if (dspi_rxtx(dspi) == 0) { +- dspi->waitflags = 1; +- wake_up_interruptible(&dspi->waitq); +- } ++ if (dspi_rxtx(dspi) == 0) ++ complete(&dspi->xfer_done); + + return IRQ_HANDLED; + } +@@ -962,13 +959,9 @@ static int dspi_transfer_one_message(str + status = dspi_poll(dspi); + } while (status == -EINPROGRESS); + } else if (trans_mode != DSPI_DMA_MODE) { +- status = wait_event_interruptible(dspi->waitq, +- dspi->waitflags); +- dspi->waitflags = 0; ++ wait_for_completion(&dspi->xfer_done); ++ reinit_completion(&dspi->xfer_done); + } +- if (status) +- dev_err(&dspi->pdev->dev, +- "Waiting for transfer to complete failed!\n"); + + if (transfer->delay_usecs) + udelay(transfer->delay_usecs); +@@ -1349,7 +1342,7 @@ static int dspi_probe(struct platform_de + goto out_clk_put; + } + +- init_waitqueue_head(&dspi->waitq); ++ init_completion(&dspi->xfer_done); + + poll_mode: + if (dspi->devtype_data->trans_mode == DSPI_DMA_MODE) { diff --git a/patches.suse/spi-spi-fsl-dspi-Replace-legacy-spi_master-names-wit.patch b/patches.suse/spi-spi-fsl-dspi-Replace-legacy-spi_master-names-wit.patch new file mode 100644 index 0000000..0b227d4 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Replace-legacy-spi_master-names-wit.patch @@ -0,0 +1,319 @@ +From: Vladimir Oltean +Date: Sun, 18 Aug 2019 21:01:10 +0300 +Subject: spi: spi-fsl-dspi: Replace legacy spi_master names with + spi_controller + +Git-commit: 3a11ea664be6ff16387759d57aed3a015f6339a1 +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +This adapts the spi-fsl-dspi driver to the API changes introduced in +commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller""). + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20190818180115.31114-10-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 100 ++++++++++++++++++------------------- + 1 file changed, 50 insertions(+), 50 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 753584c4065c..a9bcbc458172 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -171,7 +171,7 @@ struct fsl_dspi_dma { + }; + + struct fsl_dspi { +- struct spi_master *master; ++ struct spi_controller *ctlr; + struct platform_device *pdev; + + struct regmap *regmap; +@@ -219,7 +219,7 @@ static u32 dspi_pop_tx_pushr(struct fsl_dspi *dspi) + { + u16 cmd = dspi->tx_cmd, data = dspi_pop_tx(dspi); + +- if (spi_controller_is_slave(dspi->master)) ++ if (spi_controller_is_slave(dspi->ctlr)) + return data; + + if (dspi->len > 0) +@@ -318,7 +318,7 @@ static int dspi_next_xfer_dma_submit(struct fsl_dspi *dspi) + dma_async_issue_pending(dma->chan_rx); + dma_async_issue_pending(dma->chan_tx); + +- if (spi_controller_is_slave(dspi->master)) { ++ if (spi_controller_is_slave(dspi->ctlr)) { + wait_for_completion_interruptible(&dspi->dma->cmd_rx_complete); + return 0; + } +@@ -647,10 +647,10 @@ static void dspi_eoq_read(struct fsl_dspi *dspi) + dspi_push_rx(dspi, fifo_read(dspi)); + } + +-static int dspi_transfer_one_message(struct spi_master *master, ++static int dspi_transfer_one_message(struct spi_controller *ctlr, + struct spi_message *message) + { +- struct fsl_dspi *dspi = spi_master_get_devdata(master); ++ struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); + struct spi_device *spi = message->spi; + struct spi_transfer *transfer; + int status = 0; +@@ -745,7 +745,7 @@ static int dspi_transfer_one_message(struct spi_master *master, + + out: + message->status = status; +- spi_finalize_current_message(master); ++ spi_finalize_current_message(ctlr); + + return status; + } +@@ -753,7 +753,7 @@ static int dspi_transfer_one_message(struct spi_master *master, + static int dspi_setup(struct spi_device *spi) + { + struct chip_data *chip; +- struct fsl_dspi *dspi = spi_master_get_devdata(spi->master); ++ struct fsl_dspi *dspi = spi_controller_get_devdata(spi->controller); + struct fsl_dspi_platform_data *pdata; + u32 cs_sck_delay = 0, sck_cs_delay = 0; + unsigned char br = 0, pbr = 0, pcssck = 0, cssck = 0; +@@ -798,7 +798,7 @@ static int dspi_setup(struct spi_device *spi) + if (spi->mode & SPI_CPHA) + chip->ctar_val |= SPI_CTAR_CPHA; + +- if (!spi_controller_is_slave(dspi->master)) { ++ if (!spi_controller_is_slave(dspi->ctlr)) { + chip->ctar_val |= SPI_CTAR_PCSSCK(pcssck) | + SPI_CTAR_CSSCK(cssck) | + SPI_CTAR_PASC(pasc) | +@@ -820,7 +820,7 @@ static void dspi_cleanup(struct spi_device *spi) + struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi); + + dev_dbg(&spi->dev, "spi_device %u.%u cleanup\n", +- spi->master->bus_num, spi->chip_select); ++ spi->controller->bus_num, spi->chip_select); + + kfree(chip); + } +@@ -893,10 +893,10 @@ MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids); + #ifdef CONFIG_PM_SLEEP + static int dspi_suspend(struct device *dev) + { +- struct spi_master *master = dev_get_drvdata(dev); +- struct fsl_dspi *dspi = spi_master_get_devdata(master); ++ struct spi_controller *ctlr = dev_get_drvdata(dev); ++ struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); + +- spi_master_suspend(master); ++ spi_controller_suspend(ctlr); + clk_disable_unprepare(dspi->clk); + + pinctrl_pm_select_sleep_state(dev); +@@ -906,8 +906,8 @@ static int dspi_suspend(struct device *dev) + + static int dspi_resume(struct device *dev) + { +- struct spi_master *master = dev_get_drvdata(dev); +- struct fsl_dspi *dspi = spi_master_get_devdata(master); ++ struct spi_controller *ctlr = dev_get_drvdata(dev); ++ struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); + int ret; + + pinctrl_pm_select_default_state(dev); +@@ -915,7 +915,7 @@ static int dspi_resume(struct device *dev) + ret = clk_prepare_enable(dspi->clk); + if (ret) + return ret; +- spi_master_resume(master); ++ spi_controller_resume(ctlr); + + return 0; + } +@@ -977,7 +977,7 @@ static void dspi_init(struct fsl_dspi *dspi) + + if (dspi->devtype_data->xspi_mode) + mcr |= SPI_MCR_XSPI; +- if (!spi_controller_is_slave(dspi->master)) ++ if (!spi_controller_is_slave(dspi->ctlr)) + mcr |= SPI_MCR_MASTER; + + regmap_write(dspi->regmap, SPI_MCR, mcr); +@@ -990,7 +990,7 @@ static void dspi_init(struct fsl_dspi *dspi) + static int dspi_probe(struct platform_device *pdev) + { + struct device_node *np = pdev->dev.of_node; +- struct spi_master *master; ++ struct spi_controller *ctlr; + struct fsl_dspi *dspi; + struct resource *res; + const struct regmap_config *regmap_config; +@@ -998,25 +998,25 @@ static int dspi_probe(struct platform_device *pdev) + struct fsl_dspi_platform_data *pdata; + int ret, cs_num, bus_num; + +- master = spi_alloc_master(&pdev->dev, sizeof(struct fsl_dspi)); +- if (!master) ++ ctlr = spi_alloc_master(&pdev->dev, sizeof(struct fsl_dspi)); ++ if (!ctlr) + return -ENOMEM; + +- dspi = spi_master_get_devdata(master); ++ dspi = spi_controller_get_devdata(ctlr); + dspi->pdev = pdev; +- dspi->master = master; ++ dspi->ctlr = ctlr; + +- master->setup = dspi_setup; +- master->transfer_one_message = dspi_transfer_one_message; +- master->dev.of_node = pdev->dev.of_node; ++ ctlr->setup = dspi_setup; ++ ctlr->transfer_one_message = dspi_transfer_one_message; ++ ctlr->dev.of_node = pdev->dev.of_node; + +- master->cleanup = dspi_cleanup; +- master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST; ++ ctlr->cleanup = dspi_cleanup; ++ ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST; + + pdata = dev_get_platdata(&pdev->dev); + if (pdata) { +- master->num_chipselect = pdata->cs_num; +- master->bus_num = pdata->bus_num; ++ ctlr->num_chipselect = pdata->cs_num; ++ ctlr->bus_num = pdata->bus_num; + + dspi->devtype_data = &coldfire_data; + } else { +@@ -1024,38 +1024,38 @@ static int dspi_probe(struct platform_device *pdev) + ret = of_property_read_u32(np, "spi-num-chipselects", &cs_num); + if (ret < 0) { + dev_err(&pdev->dev, "can't get spi-num-chipselects\n"); +- goto out_master_put; ++ goto out_ctlr_put; + } +- master->num_chipselect = cs_num; ++ ctlr->num_chipselect = cs_num; + + ret = of_property_read_u32(np, "bus-num", &bus_num); + if (ret < 0) { + dev_err(&pdev->dev, "can't get bus-num\n"); +- goto out_master_put; ++ goto out_ctlr_put; + } +- master->bus_num = bus_num; ++ ctlr->bus_num = bus_num; + + if (of_property_read_bool(np, "spi-slave")) +- master->slave = true; ++ ctlr->slave = true; + + dspi->devtype_data = of_device_get_match_data(&pdev->dev); + if (!dspi->devtype_data) { + dev_err(&pdev->dev, "can't get devtype_data\n"); + ret = -EFAULT; +- goto out_master_put; ++ goto out_ctlr_put; + } + } + + if (dspi->devtype_data->xspi_mode) +- master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); ++ ctlr->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); + else +- master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16); ++ ctlr->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16); + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(base)) { + ret = PTR_ERR(base); +- goto out_master_put; ++ goto out_ctlr_put; + } + + if (dspi->devtype_data->xspi_mode) +@@ -1067,7 +1067,7 @@ static int dspi_probe(struct platform_device *pdev) + dev_err(&pdev->dev, "failed to init regmap: %ld\n", + PTR_ERR(dspi->regmap)); + ret = PTR_ERR(dspi->regmap); +- goto out_master_put; ++ goto out_ctlr_put; + } + + if (dspi->devtype_data->xspi_mode) { +@@ -1079,7 +1079,7 @@ static int dspi_probe(struct platform_device *pdev) + "failed to init pushr regmap: %ld\n", + PTR_ERR(dspi->regmap_pushr)); + ret = PTR_ERR(dspi->regmap_pushr); +- goto out_master_put; ++ goto out_ctlr_put; + } + } + +@@ -1087,11 +1087,11 @@ static int dspi_probe(struct platform_device *pdev) + if (IS_ERR(dspi->clk)) { + ret = PTR_ERR(dspi->clk); + dev_err(&pdev->dev, "unable to get clock\n"); +- goto out_master_put; ++ goto out_ctlr_put; + } + ret = clk_prepare_enable(dspi->clk); + if (ret) +- goto out_master_put; ++ goto out_ctlr_put; + + dspi_init(dspi); + dspi->irq = platform_get_irq(pdev, 0); +@@ -1115,15 +1115,15 @@ static int dspi_probe(struct platform_device *pdev) + } + } + +- master->max_speed_hz = ++ ctlr->max_speed_hz = + clk_get_rate(dspi->clk) / dspi->devtype_data->max_clock_factor; + + init_waitqueue_head(&dspi->waitq); +- platform_set_drvdata(pdev, master); ++ platform_set_drvdata(pdev, ctlr); + +- ret = spi_register_master(master); ++ ret = spi_register_controller(ctlr); + if (ret != 0) { +- dev_err(&pdev->dev, "Problem registering DSPI master\n"); ++ dev_err(&pdev->dev, "Problem registering DSPI ctlr\n"); + goto out_clk_put; + } + +@@ -1131,21 +1131,21 @@ static int dspi_probe(struct platform_device *pdev) + + out_clk_put: + clk_disable_unprepare(dspi->clk); +-out_master_put: +- spi_master_put(master); ++out_ctlr_put: ++ spi_controller_put(ctlr); + + return ret; + } + + static int dspi_remove(struct platform_device *pdev) + { +- struct spi_master *master = platform_get_drvdata(pdev); +- struct fsl_dspi *dspi = spi_master_get_devdata(master); ++ struct spi_controller *ctlr = platform_get_drvdata(pdev); ++ struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); + + /* Disconnect from the SPI framework */ + dspi_release_dma(dspi); + clk_disable_unprepare(dspi->clk); +- spi_unregister_master(dspi->master); ++ spi_unregister_controller(dspi->ctlr); + + return 0; + } +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Simplify-bytes_per_word-gymnastics.patch b/patches.suse/spi-spi-fsl-dspi-Simplify-bytes_per_word-gymnastics.patch new file mode 100644 index 0000000..c0a3672 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Simplify-bytes_per_word-gymnastics.patch @@ -0,0 +1,66 @@ +From: Vladimir Oltean +Date: Thu, 5 Mar 2020 00:00:33 +0200 +Subject: spi: spi-fsl-dspi: Simplify bytes_per_word gymnastics + +Git-commit: 53fadb4d90c762b560a9d0983bb5894129057ea1 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +Reduce the if-then-else-if-then-else sequence to: + - a simple division in the case of bytes_per_word calculation + - a memcpy command with a variable size. The semantics of larger-than-8 + xfer->bits_per_word is that those words are to be interpreted and + transmitted in CPU native endianness. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20200304220044.11193-2-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 21 +++------------------ + 1 file changed, 3 insertions(+), 18 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -251,12 +251,7 @@ static u32 dspi_pop_tx(struct fsl_dspi * + u32 txdata = 0; + + if (dspi->tx) { +- if (dspi->bytes_per_word == 1) +- txdata = *(u8 *)dspi->tx; +- else if (dspi->bytes_per_word == 2) +- txdata = *(u16 *)dspi->tx; +- else /* dspi->bytes_per_word == 4 */ +- txdata = *(u32 *)dspi->tx; ++ memcpy(&txdata, dspi->tx, dspi->bytes_per_word); + dspi->tx += dspi->bytes_per_word; + } + dspi->len -= dspi->bytes_per_word; +@@ -283,12 +278,7 @@ static void dspi_push_rx(struct fsl_dspi + /* Mask off undefined bits */ + rxdata &= (1 << dspi->bits_per_word) - 1; + +- if (dspi->bytes_per_word == 1) +- *(u8 *)dspi->rx = rxdata; +- else if (dspi->bytes_per_word == 2) +- *(u16 *)dspi->rx = rxdata; +- else /* dspi->bytes_per_word == 4 */ +- *(u32 *)dspi->rx = rxdata; ++ memcpy(dspi->rx, &rxdata, dspi->bytes_per_word); + dspi->rx += dspi->bytes_per_word; + } + +@@ -805,12 +795,7 @@ static int dspi_transfer_one_message(str + dspi->len = transfer->len; + /* Validated transfer specific frame size (defaults applied) */ + dspi->bits_per_word = transfer->bits_per_word; +- if (transfer->bits_per_word <= 8) +- dspi->bytes_per_word = 1; +- else if (transfer->bits_per_word <= 16) +- dspi->bytes_per_word = 2; +- else +- dspi->bytes_per_word = 4; ++ dspi->bytes_per_word = DIV_ROUND_UP(dspi->bits_per_word, 8); + + regmap_update_bits(dspi->regmap, SPI_MCR, + SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF, diff --git a/patches.suse/spi-spi-fsl-dspi-Take-software-timestamp-in-dspi_fif.patch b/patches.suse/spi-spi-fsl-dspi-Take-software-timestamp-in-dspi_fif.patch new file mode 100644 index 0000000..d27dd5e --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Take-software-timestamp-in-dspi_fif.patch @@ -0,0 +1,65 @@ +From: Vladimir Oltean +Date: Thu, 5 Mar 2020 00:00:44 +0200 +Subject: spi: spi-fsl-dspi: Take software timestamp in dspi_fifo_write + +Git-commit: e9bac90036d394b01cc7d5297a11d33b8ab92a91 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +Although the SPI system timestamps are supposed to reflect the moment +that the peripheral has received a word rather than the moment when the +CPU has enqueued that word to the FIFO, in practice it is easier to just +record the latter time than the former (with a smaller error). + +With the recent migration of TCFQ users from poll back to interrupt mode +(this time for XSPI FIFO), it's wiser to keep the interrupt latency +outside of the measurement of the PTP system timestamp itself. If there +proves to be any constant offset that requires static compensation, that +can always be added later. So far that does not appear to be the case at +least on the LS1021A-TSN board, where testing shows that the phc2sys +offset is able to remain within +/- 200 ns even after 68 hours of +testing. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20200304220044.11193-13-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -837,24 +837,24 @@ no_accel: + + static void dspi_fifo_write(struct fsl_dspi *dspi) + { ++ struct spi_transfer *xfer = dspi->cur_transfer; ++ struct spi_message *msg = dspi->cur_msg; ++ int bytes_sent; ++ + dspi_setup_accel(dspi); + + if (dspi->devtype_data->trans_mode == DSPI_EOQ_MODE) + dspi_eoq_fifo_write(dspi); + else + dspi_xspi_fifo_write(dspi); +-} +- +-static int dspi_rxtx(struct fsl_dspi *dspi) +-{ +- struct spi_transfer *xfer = dspi->cur_transfer; +- struct spi_message *msg = dspi->cur_msg; +- int bytes_sent; + + /* Update total number of bytes that were transferred */ + bytes_sent = dspi->words_in_flight * dspi->oper_word_size; + msg->actual_length += bytes_sent; +- ++} ++ ++static int dspi_rxtx(struct fsl_dspi *dspi) ++{ + dspi_fifo_read(dspi); + + if (!dspi->len) diff --git a/patches.suse/spi-spi-fsl-dspi-Use-BIT-and-GENMASK-macros.patch b/patches.suse/spi-spi-fsl-dspi-Use-BIT-and-GENMASK-macros.patch new file mode 100644 index 0000000..c3f0257 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Use-BIT-and-GENMASK-macros.patch @@ -0,0 +1,115 @@ +From: Vladimir Oltean +Date: Sun, 18 Aug 2019 21:01:04 +0300 +Subject: spi: spi-fsl-dspi: Use BIT() and GENMASK() macros + +Git-commit: b2655196cf9ce783d0b6cfec1f47ac4ecf3dcf95 +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +Switch to using more idiomatic register field definitions, which makes +it easier to look them up in the datasheet. Cosmetic patch. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20190818180115.31114-4-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 58 +++++++++++++++++++------------------- + 1 file changed, 29 insertions(+), 29 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 358b381839fb..179a9818619f 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -28,35 +28,35 @@ + #define DSPI_DMA_BUFSIZE (DSPI_FIFO_SIZE * 1024) + + #define SPI_MCR 0x00 +-#define SPI_MCR_MASTER (1 << 31) ++#define SPI_MCR_MASTER BIT(31) + #define SPI_MCR_PCSIS (0x3F << 16) +-#define SPI_MCR_CLR_TXF (1 << 11) +-#define SPI_MCR_CLR_RXF (1 << 10) +-#define SPI_MCR_XSPI (1 << 3) ++#define SPI_MCR_CLR_TXF BIT(11) ++#define SPI_MCR_CLR_RXF BIT(10) ++#define SPI_MCR_XSPI BIT(3) + + #define SPI_TCR 0x08 +-#define SPI_TCR_GET_TCNT(x) (((x) & 0xffff0000) >> 16) +- +-#define SPI_CTAR(x) (0x0c + (((x) & 0x3) * 4)) +-#define SPI_CTAR_FMSZ(x) (((x) & 0x0000000f) << 27) +-#define SPI_CTAR_CPOL(x) ((x) << 26) +-#define SPI_CTAR_CPHA(x) ((x) << 25) +-#define SPI_CTAR_LSBFE(x) ((x) << 24) +-#define SPI_CTAR_PCSSCK(x) (((x) & 0x00000003) << 22) +-#define SPI_CTAR_PASC(x) (((x) & 0x00000003) << 20) +-#define SPI_CTAR_PDT(x) (((x) & 0x00000003) << 18) +-#define SPI_CTAR_PBR(x) (((x) & 0x00000003) << 16) +-#define SPI_CTAR_CSSCK(x) (((x) & 0x0000000f) << 12) +-#define SPI_CTAR_ASC(x) (((x) & 0x0000000f) << 8) +-#define SPI_CTAR_DT(x) (((x) & 0x0000000f) << 4) +-#define SPI_CTAR_BR(x) ((x) & 0x0000000f) ++#define SPI_TCR_GET_TCNT(x) (((x) & GENMASK(31, 16)) >> 16) ++ ++#define SPI_CTAR(x) (0x0c + (((x) & GENMASK(1, 0)) * 4)) ++#define SPI_CTAR_FMSZ(x) (((x) << 27) & GENMASK(30, 27)) ++#define SPI_CTAR_CPOL(x) (((x) << 26) & GENMASK(26, 26)) ++#define SPI_CTAR_CPHA(x) (((x) << 25) & GENMASK(25, 25)) ++#define SPI_CTAR_LSBFE(x) (((x) << 24) & GENMASK(24, 24)) ++#define SPI_CTAR_PCSSCK(x) (((x) << 22) & GENMASK(23, 22)) ++#define SPI_CTAR_PASC(x) (((x) << 20) & GENMASK(21, 20)) ++#define SPI_CTAR_PDT(x) (((x) << 18) & GENMASK(19, 18)) ++#define SPI_CTAR_PBR(x) (((x) << 16) & GENMASK(17, 16)) ++#define SPI_CTAR_CSSCK(x) (((x) << 12) & GENMASK(15, 12)) ++#define SPI_CTAR_ASC(x) (((x) << 8) & GENMASK(11, 8)) ++#define SPI_CTAR_DT(x) (((x) << 4) & GENMASK(7, 4)) ++#define SPI_CTAR_BR(x) ((x) & GENMASK(3, 0)) + #define SPI_CTAR_SCALE_BITS 0xf + + #define SPI_CTAR0_SLAVE 0x0c + + #define SPI_SR 0x2c +-#define SPI_SR_EOQF 0x10000000 +-#define SPI_SR_TCFQF 0x80000000 ++#define SPI_SR_TCFQF BIT(31) ++#define SPI_SR_EOQF BIT(28) + #define SPI_SR_CLEAR 0x9aaf0000 + + #define SPI_RSER_TFFFE BIT(25) +@@ -65,15 +65,15 @@ + #define SPI_RSER_RFDFD BIT(16) + + #define SPI_RSER 0x30 +-#define SPI_RSER_EOQFE 0x10000000 +-#define SPI_RSER_TCFQE 0x80000000 ++#define SPI_RSER_TCFQE BIT(31) ++#define SPI_RSER_EOQFE BIT(28) + + #define SPI_PUSHR 0x34 +-#define SPI_PUSHR_CMD_CONT (1 << 15) +-#define SPI_PUSHR_CMD_CTAS(x) (((x) & 0x0003) << 12) +-#define SPI_PUSHR_CMD_EOQ (1 << 11) +-#define SPI_PUSHR_CMD_CTCNT (1 << 10) +-#define SPI_PUSHR_CMD_PCS(x) ((1 << x) & 0x003f) ++#define SPI_PUSHR_CMD_CONT BIT(15) ++#define SPI_PUSHR_CMD_CTAS(x) (((x) << 12 & GENMASK(14, 12))) ++#define SPI_PUSHR_CMD_EOQ BIT(11) ++#define SPI_PUSHR_CMD_CTCNT BIT(10) ++#define SPI_PUSHR_CMD_PCS(x) (BIT(x) & GENMASK(5, 0)) + + #define SPI_PUSHR_SLAVE 0x34 + +@@ -88,7 +88,7 @@ + #define SPI_RXFR2 0x84 + #define SPI_RXFR3 0x88 + +-#define SPI_CTARE(x) (0x11c + (((x) & 0x3) * 4)) ++#define SPI_CTARE(x) (0x11c + (((x) & GENMASK(1, 0)) * 4)) + #define SPI_CTARE_FMSZE(x) (((x) & 0x1) << 16) + #define SPI_CTARE_DTCP(x) ((x) & 0x7ff) + +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Use-EOQ-for-last-word-in-buffer-eve.patch b/patches.suse/spi-spi-fsl-dspi-Use-EOQ-for-last-word-in-buffer-eve.patch new file mode 100644 index 0000000..30cb641 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Use-EOQ-for-last-word-in-buffer-eve.patch @@ -0,0 +1,106 @@ +From: Vladimir Oltean +Date: Thu, 5 Mar 2020 00:00:43 +0200 +Subject: spi: spi-fsl-dspi: Use EOQ for last word in buffer even for XSPI mode + +Git-commit: ea93ed4c181bd42d27b49b612d56f4ceb23d1d6c +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +The EOQ mode has a hardware limitation in that it stops the transmission +(including the deassertion of the chip select signal) once the host CPU +requests end-of-queue for a particular word in the TX FIFO. + +And XSPI mode has a limitation in that we need a separate CMD FIFO entry +for the last byte in the buffer, where the chip select signal needs to +be deasserted. It's not a functional limitation, but it's rather clunky +and the fact that we need to halt the pipeline and write a single entry +to the TX FIFO whenever a buffer ends brings the throughput down when +transmitting small buffers. + +So the idea here is to use EOQ's limitation in our favor when using XSPI +mode. Stop special-casing that final word in the buffer, and just kill +the chip select signal by issuing an EOQ for that last word. Now it can +be mixed in with all the other words in the current TX FIFO train. + +A small trick here is that we still keep using the XSPI-specific +signaling via the CMDTCFQ interrupt in RSER, and not enabling the EOQ +interrupt, in order to avoid hardware weirdness (potential races with +separate interrupts being raised for CMDTCFQ and EOQ for what is in fact +the end of the same transmission). That is just theoretical, but it's +good to be cautious, and the EOQ interrupt isn't needed. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20200304220044.11193-12-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 22 +++++++++++++--------- + 1 file changed, 13 insertions(+), 9 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index df4944353ed5..d5983be32180 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -656,10 +656,8 @@ static void dspi_pushr_write(struct fsl_dspi *dspi) + regmap_write(dspi->regmap, SPI_PUSHR, dspi_pop_tx_pushr(dspi)); + } + +-static void dspi_pushr_cmd_write(struct fsl_dspi *dspi) ++static void dspi_pushr_cmd_write(struct fsl_dspi *dspi, u16 cmd) + { +- u16 cmd = dspi->tx_cmd; +- + /* + * The only time when the PCS doesn't need continuation after this word + * is when it's last. We need to look ahead, because we actually call +@@ -680,8 +678,13 @@ static void dspi_pushr_txdata_write(struct fsl_dspi *dspi, u16 txdata) + regmap_write(dspi->regmap_pushr, PUSHR_TX, txdata); + } + +-static void dspi_xspi_write(struct fsl_dspi *dspi, int cnt) ++static void dspi_xspi_write(struct fsl_dspi *dspi, int cnt, bool eoq) + { ++ u16 tx_cmd = dspi->tx_cmd; ++ ++ if (eoq) ++ tx_cmd |= SPI_PUSHR_CMD_EOQ; ++ + /* Update CTARE */ + regmap_write(dspi->regmap, SPI_CTARE(0), + SPI_FRAME_EBITS(dspi->oper_bits_per_word) | +@@ -691,7 +694,7 @@ static void dspi_xspi_write(struct fsl_dspi *dspi, int cnt) + * Write the CMD FIFO entry first, and then the two + * corresponding TX FIFO entries (or one...). + */ +- dspi_pushr_cmd_write(dspi); ++ dspi_pushr_cmd_write(dspi, tx_cmd); + + /* Fill TX FIFO with as many transfers as possible */ + while (cnt--) { +@@ -707,6 +710,7 @@ static void dspi_xspi_fifo_write(struct fsl_dspi *dspi) + { + int num_fifo_entries = dspi->devtype_data->fifo_size; + int bytes_in_flight; ++ bool eoq = false; + + /* In XSPI mode each 32-bit word occupies 2 TX FIFO entries */ + if (dspi->oper_word_size == 4) +@@ -732,11 +736,11 @@ static void dspi_xspi_fifo_write(struct fsl_dspi *dspi) + * So send one word less during this go, to force a split and a command + * with a single word next time, when CONT will be unset. + */ +- if (bytes_in_flight == dspi->len && dspi->words_in_flight > 1 && +- !(dspi->tx_cmd & SPI_PUSHR_CMD_CONT)) +- dspi->words_in_flight--; ++ if (!(dspi->tx_cmd & SPI_PUSHR_CMD_CONT) && ++ bytes_in_flight == dspi->len) ++ eoq = true; + +- dspi_xspi_write(dspi, dspi->words_in_flight); ++ dspi_xspi_write(dspi, dspi->words_in_flight, eoq); + } + + static void dspi_eoq_fifo_write(struct fsl_dspi *dspi) +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Use-dma_request_chan-instead-dma_re.patch b/patches.suse/spi-spi-fsl-dspi-Use-dma_request_chan-instead-dma_re.patch new file mode 100644 index 0000000..3fdff42 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Use-dma_request_chan-instead-dma_re.patch @@ -0,0 +1,54 @@ +From: Peter Ujfalusi +Date: Thu, 12 Dec 2019 15:55:48 +0200 +Subject: spi: spi-fsl-dspi: Use dma_request_chan() instead + dma_request_slave_channel() + +Git-commit: b5756b777472eceaa84bc180f458f8eaec65da9a +Patch-mainline: v5.6-rc1 +References: bsc#1167260 + +dma_request_slave_channel() is a wrapper on top of dma_request_chan() +eating up the error code. + +By using dma_request_chan() directly the driver can support deferred +probing against DMA. + +Signed-off-by: Peter Ujfalusi +Link: https://lore.kernel.org/r/20191212135550.4634-8-peter.ujfalusi@ti.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 442cff71a0d2..52ccd8397c35 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -395,17 +395,17 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr) + if (!dma) + return -ENOMEM; + +- dma->chan_rx = dma_request_slave_channel(dev, "rx"); +- if (!dma->chan_rx) { ++ dma->chan_rx = dma_request_chan(dev, "rx"); ++ if (IS_ERR(dma->chan_rx)) { + dev_err(dev, "rx dma channel not available\n"); +- ret = -ENODEV; ++ ret = PTR_ERR(dma->chan_rx); + return ret; + } + +- dma->chan_tx = dma_request_slave_channel(dev, "tx"); +- if (!dma->chan_tx) { ++ dma->chan_tx = dma_request_chan(dev, "tx"); ++ if (IS_ERR(dma->chan_tx)) { + dev_err(dev, "tx dma channel not available\n"); +- ret = -ENODEV; ++ ret = PTR_ERR(dma->chan_tx); + goto err_tx_channel; + } + +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Use-poll-mode-in-case-the-platform-.patch b/patches.suse/spi-spi-fsl-dspi-Use-poll-mode-in-case-the-platform-.patch new file mode 100644 index 0000000..e009d7b --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Use-poll-mode-in-case-the-platform-.patch @@ -0,0 +1,171 @@ +From: Vladimir Oltean +Date: Fri, 23 Aug 2019 00:15:13 +0300 +Subject: spi: spi-fsl-dspi: Use poll mode in case the platform IRQ is missing + +Git-commit: c55be305915974db160ce6472722ff74f45b8d4e +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +On platforms like LS1021A which use TCFQ mode, an interrupt needs to be +processed after each byte is TXed/RXed. I tried to make the DSPI +implementation on this SoC operate in other, more efficient modes (EOQ, +DMA) but it looks like it simply isn't possible. + +Therefore allow the driver to operate in poll mode, to ease a bit of +this absurd amount of IRQ load generated in TCFQ mode. Doing so reduces +both the net time it takes to transmit a SPI message, as well as the +inter-frame jitter that occurs while doing so. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20190822211514.19288-5-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 88 ++++++++++++++++++++++++++++++++------------- + 1 file changed, 64 insertions(+), 24 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -647,19 +647,12 @@ static void dspi_eoq_read(struct fsl_dsp + dspi_push_rx(dspi, fifo_read(dspi)); + } + +-static irqreturn_t dspi_interrupt(int irq, void *dev_id) ++static int dspi_rxtx(struct fsl_dspi *dspi) + { +- struct fsl_dspi *dspi = (struct fsl_dspi *)dev_id; + struct spi_message *msg = dspi->cur_msg; + enum dspi_trans_mode trans_mode; +- u32 spi_sr, spi_tcr; + u16 spi_tcnt; +- +- regmap_read(dspi->regmap, SPI_SR, &spi_sr); +- regmap_write(dspi->regmap, SPI_SR, spi_sr); +- +- if (!(spi_sr & (SPI_SR_EOQF | SPI_SR_TCFQF))) +- return IRQ_NONE; ++ u32 spi_tcr; + + /* Get transfer counter (in number of SPI transfers). It was + * reset to 0 when transfer(s) were started. +@@ -675,17 +668,55 @@ static irqreturn_t dspi_interrupt(int ir + else if (trans_mode == DSPI_TCFQ_MODE) + dspi_tcfq_read(dspi); + +- if (!dspi->len) { +- dspi->waitflags = 1; +- wake_up_interruptible(&dspi->waitq); +- return IRQ_HANDLED; +- } ++ if (!dspi->len) ++ /* Success! */ ++ return 0; + + if (trans_mode == DSPI_EOQ_MODE) + dspi_eoq_write(dspi); + else if (trans_mode == DSPI_TCFQ_MODE) + dspi_tcfq_write(dspi); + ++ return -EINPROGRESS; ++} ++ ++static int dspi_poll(struct fsl_dspi *dspi) ++{ ++ int tries = 1000; ++ u32 spi_sr; ++ ++ do { ++ regmap_read(dspi->regmap, SPI_SR, &spi_sr); ++ regmap_write(dspi->regmap, SPI_SR, spi_sr); ++ ++ if (spi_sr & (SPI_SR_EOQF | SPI_SR_TCFQF)) ++ break; ++ } while (--tries); ++ ++ if (!tries) ++ return -ETIMEDOUT; ++ ++ return dspi_rxtx(dspi); ++} ++ ++static irqreturn_t dspi_interrupt(int irq, void *dev_id) ++{ ++ struct fsl_dspi *dspi = (struct fsl_dspi *)dev_id; ++ u32 spi_sr; ++ ++ regmap_read(dspi->regmap, SPI_SR, &spi_sr); ++ regmap_write(dspi->regmap, SPI_SR, spi_sr); ++ ++ if (!(spi_sr & (SPI_SR_EOQF | SPI_SR_TCFQF))) ++ return IRQ_NONE; ++ ++ dspi_rxtx(dspi); ++ ++ if (!dspi->len) { ++ dspi->waitflags = 1; ++ wake_up_interruptible(&dspi->waitq); ++ } ++ + return IRQ_HANDLED; + } + +@@ -773,13 +804,18 @@ static int dspi_transfer_one_message(str + goto out; + } + +- if (trans_mode != DSPI_DMA_MODE) { +- if (wait_event_interruptible(dspi->waitq, +- dspi->waitflags)) +- dev_err(&dspi->pdev->dev, +- "wait transfer complete fail!\n"); ++ if (!dspi->irq) { ++ do { ++ status = dspi_poll(dspi); ++ } while (status == -EINPROGRESS); ++ } else if (trans_mode != DSPI_DMA_MODE) { ++ status = wait_event_interruptible(dspi->waitq, ++ dspi->waitflags); + dspi->waitflags = 0; + } ++ if (status) ++ dev_err(&dspi->pdev->dev, ++ "Waiting for transfer to complete failed!\n"); + + if (transfer->delay_usecs) + udelay(transfer->delay_usecs); +@@ -1079,11 +1115,13 @@ static int dspi_probe(struct platform_de + goto out_ctlr_put; + + dspi_init(dspi); ++ + dspi->irq = platform_get_irq(pdev, 0); +- if (dspi->irq < 0) { +- dev_err(&pdev->dev, "can't get platform irq\n"); +- ret = dspi->irq; +- goto out_clk_put; ++ if (dspi->irq <= 0) { ++ dev_info(&pdev->dev, ++ "can't get platform irq, using poll mode\n"); ++ dspi->irq = 0; ++ goto poll_mode; + } + + ret = devm_request_irq(&pdev->dev, dspi->irq, dspi_interrupt, +@@ -1093,6 +1131,9 @@ static int dspi_probe(struct platform_de + goto out_clk_put; + } + ++ init_waitqueue_head(&dspi->waitq); ++ ++poll_mode: + if (dspi->devtype_data->trans_mode == DSPI_DMA_MODE) { + ret = dspi_request_dma(dspi, res->start); + if (ret < 0) { +@@ -1104,7 +1145,6 @@ static int dspi_probe(struct platform_de + ctlr->max_speed_hz = + clk_get_rate(dspi->clk) / dspi->devtype_data->max_clock_factor; + +- init_waitqueue_head(&dspi->waitq); + platform_set_drvdata(pdev, ctlr); + + ret = spi_register_controller(ctlr); diff --git a/patches.suse/spi-spi-fsl-dspi-Use-reverse-Christmas-tree-declarat.patch b/patches.suse/spi-spi-fsl-dspi-Use-reverse-Christmas-tree-declarat.patch new file mode 100644 index 0000000..57ad6f5 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Use-reverse-Christmas-tree-declarat.patch @@ -0,0 +1,117 @@ +From: Vladimir Oltean +Date: Sun, 18 Aug 2019 21:01:11 +0300 +Subject: spi: spi-fsl-dspi: Use reverse Christmas tree declaration order + +Git-commit: d6bdfa6c203d16e7f290ecc34137c396b1602782 +Patch-mainline: v5.4-rc1 +References: bsc#1167260 + +This patch puts variable declaration in the reverse order of their +length for cosmetic purposes. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20190818180115.31114-11-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 28 ++++++++++++++-------------- + 1 file changed, 14 insertions(+), 14 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index a9bcbc458172..e2e71bd73b5c 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -268,8 +268,8 @@ static void dspi_rx_dma_callback(void *arg) + + static int dspi_next_xfer_dma_submit(struct fsl_dspi *dspi) + { +- struct fsl_dspi_dma *dma = dspi->dma; + struct device *dev = &dspi->pdev->dev; ++ struct fsl_dspi_dma *dma = dspi->dma; + int time_left; + int i; + +@@ -346,9 +346,9 @@ static int dspi_next_xfer_dma_submit(struct fsl_dspi *dspi) + + static int dspi_dma_xfer(struct fsl_dspi *dspi) + { +- struct fsl_dspi_dma *dma = dspi->dma; +- struct device *dev = &dspi->pdev->dev; + struct spi_message *message = dspi->cur_msg; ++ struct device *dev = &dspi->pdev->dev; ++ struct fsl_dspi_dma *dma = dspi->dma; + int curr_remaining_bytes; + int bytes_per_buffer; + int ret = 0; +@@ -383,9 +383,9 @@ static int dspi_dma_xfer(struct fsl_dspi *dspi) + + static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr) + { +- struct fsl_dspi_dma *dma; +- struct dma_slave_config cfg; + struct device *dev = &dspi->pdev->dev; ++ struct dma_slave_config cfg; ++ struct fsl_dspi_dma *dma; + int ret; + + dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL); +@@ -527,10 +527,10 @@ static void hz_to_spi_baud(char *pbr, char *br, int speed_hz, + static void ns_delay_scale(char *psc, char *sc, int delay_ns, + unsigned long clkrate) + { +- int pscale_tbl[4] = {1, 3, 5, 7}; + int scale_needed, scale, minscale = INT_MAX; +- int i, j; ++ int pscale_tbl[4] = {1, 3, 5, 7}; + u32 remainder; ++ int i, j; + + scale_needed = div_u64_rem((u64)delay_ns * clkrate, NSEC_PER_SEC, + &remainder); +@@ -652,9 +652,9 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr, + { + struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); + struct spi_device *spi = message->spi; ++ enum dspi_trans_mode trans_mode; + struct spi_transfer *transfer; + int status = 0; +- enum dspi_trans_mode trans_mode; + + message->actual_length = 0; + +@@ -752,12 +752,12 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr, + + static int dspi_setup(struct spi_device *spi) + { +- struct chip_data *chip; + struct fsl_dspi *dspi = spi_controller_get_devdata(spi->controller); +- struct fsl_dspi_platform_data *pdata; +- u32 cs_sck_delay = 0, sck_cs_delay = 0; + unsigned char br = 0, pbr = 0, pcssck = 0, cssck = 0; ++ u32 cs_sck_delay = 0, sck_cs_delay = 0; ++ struct fsl_dspi_platform_data *pdata; + unsigned char pasc = 0, asc = 0; ++ struct chip_data *chip; + unsigned long clkrate; + + /* Only alloc on first setup */ +@@ -990,13 +990,13 @@ static void dspi_init(struct fsl_dspi *dspi) + static int dspi_probe(struct platform_device *pdev) + { + struct device_node *np = pdev->dev.of_node; ++ const struct regmap_config *regmap_config; ++ struct fsl_dspi_platform_data *pdata; + struct spi_controller *ctlr; ++ int ret, cs_num, bus_num; + struct fsl_dspi *dspi; + struct resource *res; +- const struct regmap_config *regmap_config; + void __iomem *base; +- struct fsl_dspi_platform_data *pdata; +- int ret, cs_num, bus_num; + + ctlr = spi_alloc_master(&pdev->dev, sizeof(struct fsl_dspi)); + if (!ctlr) +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-Use-specific-compatible-strings-for.patch b/patches.suse/spi-spi-fsl-dspi-Use-specific-compatible-strings-for.patch new file mode 100644 index 0000000..2dd2471 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-Use-specific-compatible-strings-for.patch @@ -0,0 +1,175 @@ +From: Vladimir Oltean +Date: Mon, 2 Mar 2020 02:19:54 +0200 +Subject: spi: spi-fsl-dspi: Use specific compatible strings for all SoC + instantiations + +Git-commit: d35054010b571486596f9da159f798fc38628683 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +Currently, the device tree bindings submitted in mainline for Layerscape +SoCs look like this: + +LS1021A: +compatible = "fsl,ls1021a-v1.0-dspi"; + +LS1012A: +compatible = "fsl,ls1012a-dspi", "fsl,ls1021a-v1.0-dspi"; + +LS2085A: +compatible = "fsl,ls2085a-dspi"; + +LS2088A: +compatible = "fsl,ls2080a-dspi", "fsl,ls2085a-dspi"; + +LX2160A: +compatible = "fsl,lx2160a-dspi", "fsl,ls2085a-dspi"; + +LS1043A: +compatible = "fsl,ls1043a-dspi", "fsl,ls1021a-v1.0-dspi"; + +LS1046A: +compatible = "fsl,ls1021a-v1.0-dspi"; + +Due to a lack of a more specific compatible string, LS1012A, LS1043A and +LS1046A will fall under the LS1021A umbrella, and LS2088A and LX2160A +under the LS2085A umbrella. + +They do work in those modes, but there are slight differences in the +hardware instantiations, mostly related to FIFO sizes (with the more +specific compatible strings, the FIFO size can be increased properly). + +Signed-off-by: Vladimir Oltean +Message-Id: <20200302001958.11105-3-olteanv@gmail.com> +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 103 ++++++++++++++++++++++++++++++++++----------- + 1 file changed, 80 insertions(+), 23 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -132,25 +132,59 @@ struct fsl_dspi_devtype_data { + bool xspi_mode; + }; + +-static const struct fsl_dspi_devtype_data vf610_data = { +- .trans_mode = DSPI_DMA_MODE, +- .max_clock_factor = 2, +-}; +- +-static const struct fsl_dspi_devtype_data ls1021a_v1_data = { +- .trans_mode = DSPI_TCFQ_MODE, +- .max_clock_factor = 8, +- .xspi_mode = true, +-}; +- +-static const struct fsl_dspi_devtype_data ls2085a_data = { +- .trans_mode = DSPI_TCFQ_MODE, +- .max_clock_factor = 8, +-}; +- +-static const struct fsl_dspi_devtype_data coldfire_data = { +- .trans_mode = DSPI_EOQ_MODE, +- .max_clock_factor = 8, ++enum { ++ LS1021A, ++ LS1012A, ++ LS1043A, ++ LS1046A, ++ LS2080A, ++ LS2085A, ++ LX2160A, ++ MCF5441X, ++ VF610, ++}; ++ ++static const struct fsl_dspi_devtype_data devtype_data[] = { ++ [VF610] = { ++ .trans_mode = DSPI_DMA_MODE, ++ .max_clock_factor = 2, ++ }, ++ [LS1021A] = { ++ .trans_mode = DSPI_TCFQ_MODE, ++ .max_clock_factor = 8, ++ .xspi_mode = true, ++ }, ++ [LS1012A] = { ++ .trans_mode = DSPI_TCFQ_MODE, ++ .max_clock_factor = 8, ++ .xspi_mode = true, ++ }, ++ [LS1043A] = { ++ .trans_mode = DSPI_TCFQ_MODE, ++ .max_clock_factor = 8, ++ .xspi_mode = true, ++ }, ++ [LS1046A] = { ++ .trans_mode = DSPI_TCFQ_MODE, ++ .max_clock_factor = 8, ++ .xspi_mode = true, ++ }, ++ [LS2080A] = { ++ .trans_mode = DSPI_TCFQ_MODE, ++ .max_clock_factor = 8, ++ }, ++ [LS2085A] = { ++ .trans_mode = DSPI_TCFQ_MODE, ++ .max_clock_factor = 8, ++ }, ++ [LX2160A] = { ++ .trans_mode = DSPI_TCFQ_MODE, ++ .max_clock_factor = 8, ++ }, ++ [MCF5441X] = { ++ .trans_mode = DSPI_EOQ_MODE, ++ .max_clock_factor = 8, ++ }, + }; + + struct fsl_dspi_dma { +@@ -895,9 +929,31 @@ static void dspi_cleanup(struct spi_devi + } + + static const struct of_device_id fsl_dspi_dt_ids[] = { +- { .compatible = "fsl,vf610-dspi", .data = &vf610_data, }, +- { .compatible = "fsl,ls1021a-v1.0-dspi", .data = &ls1021a_v1_data, }, +- { .compatible = "fsl,ls2085a-dspi", .data = &ls2085a_data, }, ++ { ++ .compatible = "fsl,vf610-dspi", ++ .data = &devtype_data[VF610], ++ }, { ++ .compatible = "fsl,ls1021a-v1.0-dspi", ++ .data = &devtype_data[LS1021A], ++ }, { ++ .compatible = "fsl,ls1012a-dspi", ++ .data = &devtype_data[LS1012A], ++ }, { ++ .compatible = "fsl,ls1043a-dspi", ++ .data = &devtype_data[LS1043A], ++ }, { ++ .compatible = "fsl,ls1046a-dspi", ++ .data = &devtype_data[LS1046A], ++ }, { ++ .compatible = "fsl,ls2080a-dspi", ++ .data = &devtype_data[LS2080A], ++ }, { ++ .compatible = "fsl,ls2085a-dspi", ++ .data = &devtype_data[LS2085A], ++ }, { ++ .compatible = "fsl,lx2160a-dspi", ++ .data = &devtype_data[LX2160A], ++ }, + { /* sentinel */ } + }; + MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids); +@@ -1050,7 +1106,8 @@ static int dspi_probe(struct platform_de + ctlr->num_chipselect = pdata->cs_num; + ctlr->bus_num = pdata->bus_num; + +- dspi->devtype_data = &coldfire_data; ++ /* Only Coldfire uses platform data */ ++ dspi->devtype_data = &devtype_data[MCF5441X]; + } else { + + ret = of_property_read_u32(np, "spi-num-chipselects", &cs_num); diff --git a/patches.suse/spi-spi-fsl-dspi-change-usage-pattern-of-spi_mcr_-and-spi_ctar_-macros.patch b/patches.suse/spi-spi-fsl-dspi-change-usage-pattern-of-spi_mcr_-and-spi_ctar_-macros.patch deleted file mode 100644 index 696efb2..0000000 --- a/patches.suse/spi-spi-fsl-dspi-change-usage-pattern-of-spi_mcr_-and-spi_ctar_-macros.patch +++ /dev/null @@ -1,91 +0,0 @@ -From: Vladimir Oltean -Date: Sun, 18 Aug 2019 21:01:06 +0300 -Subject: spi: spi-fsl-dspi: Change usage pattern of SPI_MCR_* and SPI_CTAR_* - macros -Git-commit: 06d5dd29976fb49f3236b1e66142680619ea259d -Patch-mainline: v5.4-rc1 -References: git-fixes - -These are macros that accept 0 or 1 as argument (a boolean value). Their -use encourages the abuse of complex ternary operations inside their -argument list, which detracts from the code readability. Replace these -with simple if-else statements. - -Signed-off-by: Vladimir Oltean -Link: https://lore.kernel.org/r/20190818180115.31114-6-olteanv@gmail.com -Signed-off-by: Mark Brown -Acked-by: Nicolas Saenz Julienne ---- - drivers/spi/spi-fsl-dspi.c | 37 +++++++++++++++++++++---------------- - 1 file changed, 21 insertions(+), 16 deletions(-) - ---- a/drivers/spi/spi-fsl-dspi.c -+++ b/drivers/spi/spi-fsl-dspi.c -@@ -49,9 +49,9 @@ - - #define SPI_CTAR(x) (0x0c + (((x) & 0x3) * 4)) - #define SPI_CTAR_FMSZ(x) (((x) & 0x0000000f) << 27) --#define SPI_CTAR_CPOL(x) ((x) << 26) --#define SPI_CTAR_CPHA(x) ((x) << 25) --#define SPI_CTAR_LSBFE(x) ((x) << 24) -+#define SPI_CTAR_CPOL BIT(26) -+#define SPI_CTAR_CPHA BIT(25) -+#define SPI_CTAR_LSBFE BIT(24) - #define SPI_CTAR_PCSSCK(x) (((x) & 0x00000003) << 22) - #define SPI_CTAR_PASC(x) (((x) & 0x00000003) << 20) - #define SPI_CTAR_PDT(x) (((x) & 0x00000003) << 18) -@@ -601,7 +601,7 @@ static void dspi_tcfq_write(struct fsl_d - */ - u32 data = dspi_pop_tx(dspi); - -- if (dspi->cur_chip->ctar_val & SPI_CTAR_LSBFE(1)) { -+ if (dspi->cur_chip->ctar_val & SPI_CTAR_LSBFE) { - /* LSB */ - tx_fifo_write(dspi, data & 0xFFFF); - tx_fifo_write(dspi, data >> 16); -@@ -805,18 +805,22 @@ static int dspi_setup(struct spi_device - /* Set After SCK delay scale values */ - ns_delay_scale(&pasc, &asc, sck_cs_delay, clkrate); - -- chip->ctar_val = SPI_CTAR_CPOL(spi->mode & SPI_CPOL ? 1 : 0) -- | SPI_CTAR_CPHA(spi->mode & SPI_CPHA ? 1 : 0); -+ chip->ctar_val = 0; -+ if (spi->mode & SPI_CPOL) -+ chip->ctar_val |= SPI_CTAR_CPOL; -+ if (spi->mode & SPI_CPHA) -+ chip->ctar_val |= SPI_CTAR_CPHA; - - if (!spi_controller_is_slave(dspi->master)) { -- chip->ctar_val |= SPI_CTAR_LSBFE(spi->mode & -- SPI_LSB_FIRST ? 1 : 0) -- | SPI_CTAR_PCSSCK(pcssck) -- | SPI_CTAR_CSSCK(cssck) -- | SPI_CTAR_PASC(pasc) -- | SPI_CTAR_ASC(asc) -- | SPI_CTAR_PBR(pbr) -- | SPI_CTAR_BR(br); -+ chip->ctar_val |= SPI_CTAR_PCSSCK(pcssck) | -+ SPI_CTAR_CSSCK(cssck) | -+ SPI_CTAR_PASC(pasc) | -+ SPI_CTAR_ASC(asc) | -+ SPI_CTAR_PBR(pbr) | -+ SPI_CTAR_BR(br); -+ -+ if (spi->mode & SPI_LSB_FIRST) -+ chip->ctar_val |= SPI_CTAR_LSBFE; - } - - spi_set_ctldata(spi, chip); -@@ -984,9 +988,10 @@ static const struct regmap_config dspi_x - - static void dspi_init(struct fsl_dspi *dspi) - { -- unsigned int mcr = SPI_MCR_PCSIS | -- (dspi->devtype_data->xspi_mode ? SPI_MCR_XSPI : 0); -+ unsigned int mcr = SPI_MCR_PCSIS; - -+ if (dspi->devtype_data->xspi_mode) -+ mcr |= SPI_MCR_XSPI; - if (!spi_controller_is_slave(dspi->master)) - mcr |= SPI_MCR_MASTER; - diff --git a/patches.suse/spi-spi-fsl-dspi-delete-EOQ-transfer-mode.patch b/patches.suse/spi-spi-fsl-dspi-delete-EOQ-transfer-mode.patch new file mode 100644 index 0000000..e5de17d --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-delete-EOQ-transfer-mode.patch @@ -0,0 +1,169 @@ +From: Vladimir Oltean +Date: Mon, 24 Aug 2020 00:26:57 +0300 +Subject: spi: spi-fsl-dspi: delete EOQ transfer mode + +Git-commit: 20c05a05506361a6c355e9944d5616f5ed1e01c8 +Patch-mainline: v5.10-rc1 +References: bsc#1167260 + +After the only user of the limited EOQ mode has now been converted to +DMA as of commit b09058bbf5f0 ("spi: spi-fsl-dspi: set ColdFire to DMA +mode"), we can finally delete this code. + +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20200823212657.2400075-1-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 56 ++++----------------------------------------- + 1 file changed, 5 insertions(+), 51 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -53,7 +53,6 @@ + + #define SPI_SR 0x2c + #define SPI_SR_TCFQF BIT(31) +-#define SPI_SR_EOQF BIT(28) + #define SPI_SR_TFUF BIT(27) + #define SPI_SR_TFFF BIT(25) + #define SPI_SR_CMDTCF BIT(23) +@@ -62,7 +61,7 @@ + #define SPI_SR_TFIWF BIT(18) + #define SPI_SR_RFDF BIT(17) + #define SPI_SR_CMDFFF BIT(16) +-#define SPI_SR_CLEAR (SPI_SR_TCFQF | SPI_SR_EOQF | \ ++#define SPI_SR_CLEAR (SPI_SR_TCFQF | \ + SPI_SR_TFUF | SPI_SR_TFFF | \ + SPI_SR_CMDTCF | SPI_SR_SPEF | \ + SPI_SR_RFOF | SPI_SR_TFIWF | \ +@@ -75,7 +74,6 @@ + + #define SPI_RSER 0x30 + #define SPI_RSER_TCFQE BIT(31) +-#define SPI_RSER_EOQFE BIT(28) + #define SPI_RSER_CMDTCFE BIT(23) + + #define SPI_PUSHR 0x34 +@@ -114,7 +112,6 @@ struct chip_data { + }; + + enum dspi_trans_mode { +- DSPI_EOQ_MODE = 0, + DSPI_XSPI_MODE, + DSPI_DMA_MODE, + }; +@@ -670,11 +667,6 @@ static void ns_delay_scale(char *psc, ch + } + } + +-static void dspi_pushr_write(struct fsl_dspi *dspi) +-{ +- regmap_write(dspi->regmap, SPI_PUSHR, dspi_pop_tx_pushr(dspi)); +-} +- + static void dspi_pushr_cmd_write(struct fsl_dspi *dspi, u16 cmd) + { + /* +@@ -734,21 +726,6 @@ static void dspi_xspi_fifo_write(struct + } + } + +-static void dspi_eoq_fifo_write(struct fsl_dspi *dspi, int num_words) +-{ +- u16 xfer_cmd = dspi->tx_cmd; +- +- /* Fill TX FIFO with as many transfers as possible */ +- while (num_words--) { +- dspi->tx_cmd = xfer_cmd; +- /* Request EOQF for last transfer in FIFO */ +- if (num_words == 0) +- dspi->tx_cmd |= SPI_PUSHR_CMD_EOQ; +- /* Write combined TX FIFO and CMD FIFO entry */ +- dspi_pushr_write(dspi); +- } +-} +- + static u32 dspi_popr_read(struct fsl_dspi *dspi) + { + u32 rxdata = 0; +@@ -817,7 +794,7 @@ no_accel: + dspi->oper_word_size = DIV_ROUND_UP(dspi->oper_bits_per_word, 8); + + /* +- * Update CTAR here (code is common for EOQ, XSPI and DMA modes). ++ * Update CTAR here (code is common for XSPI and DMA modes). + * We will update CTARE in the portion specific to XSPI, when we + * also know the preload value (DTCP). + */ +@@ -858,10 +835,7 @@ static void dspi_fifo_write(struct fsl_d + */ + dspi->words_in_flight = num_words; + +- if (dspi->devtype_data->trans_mode == DSPI_EOQ_MODE) +- dspi_eoq_fifo_write(dspi, num_words); +- else +- dspi_xspi_fifo_write(dspi, num_words); ++ dspi_xspi_fifo_write(dspi, num_words); + /* + * Everything after this point is in a potential race with the next + * interrupt, so we must never use dspi->words_in_flight again since it +@@ -891,7 +865,7 @@ static int dspi_poll(struct fsl_dspi *ds + regmap_read(dspi->regmap, SPI_SR, &spi_sr); + regmap_write(dspi->regmap, SPI_SR, spi_sr); + +- if (spi_sr & (SPI_SR_EOQF | SPI_SR_CMDTCF)) ++ if (spi_sr & SPI_SR_CMDTCF) + break; + } while (--tries); + +@@ -909,7 +883,7 @@ static irqreturn_t dspi_interrupt(int ir + regmap_read(dspi->regmap, SPI_SR, &spi_sr); + regmap_write(dspi->regmap, SPI_SR, spi_sr); + +- if (!(spi_sr & (SPI_SR_EOQF | SPI_SR_CMDTCF))) ++ if (!(spi_sr & SPI_SR_CMDTCF)) + return IRQ_NONE; + + if (dspi_rxtx(dspi) == 0) +@@ -1194,9 +1168,6 @@ static int dspi_init(struct fsl_dspi *ds + regmap_write(dspi->regmap, SPI_SR, SPI_SR_CLEAR); + + switch (dspi->devtype_data->trans_mode) { +- case DSPI_EOQ_MODE: +- regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_EOQFE); +- break; + case DSPI_XSPI_MODE: + regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_CMDTCFE); + break; +@@ -1235,22 +1206,6 @@ static int dspi_slave_abort(struct spi_m + return 0; + } + +-/* +- * EOQ mode will inevitably deassert its PCS signal on last word in a queue +- * (hardware limitation), so we need to inform the spi_device that larger +- * buffers than the FIFO size are going to have the chip select randomly +- * toggling, so it has a chance to adapt its message sizes. +- */ +-static size_t dspi_max_message_size(struct spi_device *spi) +-{ +- struct fsl_dspi *dspi = spi_controller_get_devdata(spi->controller); +- +- if (dspi->devtype_data->trans_mode == DSPI_EOQ_MODE) +- return dspi->devtype_data->fifo_size; +- +- return SIZE_MAX; +-} +- + static int dspi_probe(struct platform_device *pdev) + { + struct device_node *np = pdev->dev.of_node; +@@ -1279,7 +1234,6 @@ static int dspi_probe(struct platform_de + + ctlr->setup = dspi_setup; + ctlr->transfer_one_message = dspi_transfer_one_message; +- ctlr->max_message_size = dspi_max_message_size; + ctlr->dev.of_node = pdev->dev.of_node; + + ctlr->cleanup = dspi_cleanup; diff --git a/patches.suse/spi-spi-fsl-dspi-don-t-access-reserved-fields-in-spi_mcr.patch b/patches.suse/spi-spi-fsl-dspi-don-t-access-reserved-fields-in-spi_mcr.patch deleted file mode 100644 index 31bc937..0000000 --- a/patches.suse/spi-spi-fsl-dspi-don-t-access-reserved-fields-in-spi_mcr.patch +++ /dev/null @@ -1,48 +0,0 @@ -From: Vladimir Oltean -Date: Wed, 18 Mar 2020 02:15:52 +0200 -Subject: spi: spi-fsl-dspi: Don't access reserved fields in SPI_MCR -Git-commit: 4fcc7c2292def2fcb21a9644969583771c52724e -Patch-mainline: v5.7-rc1 -References: git-fixes - -The SPI_MCR_PCSIS macro assumes that the controller has a number of chip -select signals equal to 6. That is not always the case, but actually is -described through the driver-specific "spi-num-chipselects" device tree -binding. LS1028A for example only has 4 chip selects. - -Don't write to the upper bits of the PCSIS field, which are reserved in -the reference manual. - -Fixes: 349ad66c0ab0 ("spi:Add Freescale DSPI driver for Vybrid VF610 platform") -Signed-off-by: Vladimir Oltean -Tested-by: Michael Walle -Link: https://lore.kernel.org/r/20200318001603.9650-2-olteanv@gmail.com -Signed-off-by: Mark Brown -Acked-by: Nicolas Saenz Julienne ---- - drivers/spi/spi-fsl-dspi.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - ---- a/drivers/spi/spi-fsl-dspi.c -+++ b/drivers/spi/spi-fsl-dspi.c -@@ -39,7 +39,7 @@ - - #define SPI_MCR 0x00 - #define SPI_MCR_MASTER (1 << 31) --#define SPI_MCR_PCSIS (0x3F << 16) -+#define SPI_MCR_PCSIS(x) ((x) << 16) - #define SPI_MCR_CLR_TXF (1 << 11) - #define SPI_MCR_CLR_RXF (1 << 10) - #define SPI_MCR_XSPI (1 << 3) -@@ -988,7 +988,10 @@ static const struct regmap_config dspi_x - - static void dspi_init(struct fsl_dspi *dspi) - { -- unsigned int mcr = SPI_MCR_PCSIS; -+ unsigned int mcr; -+ -+ /* Set idle states for all chip select signals to high */ -+ mcr = SPI_MCR_PCSIS(GENMASK(dspi->master->num_chipselect - 1, 0)); - - if (dspi->devtype_data->xspi_mode) - mcr |= SPI_MCR_XSPI; diff --git a/patches.suse/spi-spi-fsl-dspi-fix-DMA-mapping.patch b/patches.suse/spi-spi-fsl-dspi-fix-DMA-mapping.patch new file mode 100644 index 0000000..045e386 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-fix-DMA-mapping.patch @@ -0,0 +1,89 @@ +From: Michael Walle +Date: Tue, 10 Mar 2020 08:33:13 +0100 +Subject: spi: spi-fsl-dspi: fix DMA mapping + +Git-commit: 22ee9de1ecfb4459a9b3a959994f6ccb4a3827a4 +Patch-mainline: v5.7-rc1 +References: bsc#1167260 + +Use the correct device to request the DMA mapping. Otherwise the IOMMU +doesn't get the mapping and it will generate a page fault. + +The error messages look like: +[ 3.008452] arm-smmu 5000000.iommu: Unhandled context fault: fsr=0x402, iova=0xf9800000, fsynr=0x3f0022, cbfrsynra=0x828, cb=8 +[ 3.020123] arm-smmu 5000000.iommu: Unhandled context fault: fsr=0x402, iova=0xf9800000, fsynr=0x3f0022, cbfrsynra=0x828, cb=8 + +This was tested on a custom board with a LS1028A SoC. + +Signed-off-by: Michael Walle +Link: https://lore.kernel.org/r/20200310073313.21277-1-michael@walle.cc +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 17 ++++++++++------- + 1 file changed, 10 insertions(+), 7 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 0683a3fbd48c..50e3382f0c50 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -497,14 +497,16 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr) + goto err_tx_channel; + } + +- dma->tx_dma_buf = dma_alloc_coherent(dev, dspi->devtype_data->dma_bufsize, ++ dma->tx_dma_buf = dma_alloc_coherent(dma->chan_tx->device->dev, ++ dspi->devtype_data->dma_bufsize, + &dma->tx_dma_phys, GFP_KERNEL); + if (!dma->tx_dma_buf) { + ret = -ENOMEM; + goto err_tx_dma_buf; + } + +- dma->rx_dma_buf = dma_alloc_coherent(dev, dspi->devtype_data->dma_bufsize, ++ dma->rx_dma_buf = dma_alloc_coherent(dma->chan_rx->device->dev, ++ dspi->devtype_data->dma_bufsize, + &dma->rx_dma_phys, GFP_KERNEL); + if (!dma->rx_dma_buf) { + ret = -ENOMEM; +@@ -541,10 +543,12 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr) + return 0; + + err_slave_config: +- dma_free_coherent(dev, dspi->devtype_data->dma_bufsize, ++ dma_free_coherent(dma->chan_rx->device->dev, ++ dspi->devtype_data->dma_bufsize, + dma->rx_dma_buf, dma->rx_dma_phys); + err_rx_dma_buf: +- dma_free_coherent(dev, dspi->devtype_data->dma_bufsize, ++ dma_free_coherent(dma->chan_tx->device->dev, ++ dspi->devtype_data->dma_bufsize, + dma->tx_dma_buf, dma->tx_dma_phys); + err_tx_dma_buf: + dma_release_channel(dma->chan_tx); +@@ -560,20 +564,19 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr) + static void dspi_release_dma(struct fsl_dspi *dspi) + { + struct fsl_dspi_dma *dma = dspi->dma; +- struct device *dev = &dspi->pdev->dev; + + if (!dma) + return; + + if (dma->chan_tx) { +- dma_unmap_single(dev, dma->tx_dma_phys, ++ dma_unmap_single(dma->chan_tx->device->dev, dma->tx_dma_phys, + dspi->devtype_data->dma_bufsize, + DMA_TO_DEVICE); + dma_release_channel(dma->chan_tx); + } + + if (dma->chan_rx) { +- dma_unmap_single(dev, dma->rx_dma_phys, ++ dma_unmap_single(dma->chan_rx->device->dev, dma->rx_dma_phys, + dspi->devtype_data->dma_bufsize, + DMA_FROM_DEVICE); + dma_release_channel(dma->chan_rx); +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-fix-native-data-copy.patch b/patches.suse/spi-spi-fsl-dspi-fix-native-data-copy.patch new file mode 100644 index 0000000..7003de6 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-fix-native-data-copy.patch @@ -0,0 +1,70 @@ +From: Angelo Dureghello +Date: Fri, 29 May 2020 21:57:56 +0200 +Subject: spi: spi-fsl-dspi: fix native data copy + +Git-commit: 263b81dc6c932c8bc550d5e7bfc178d2b3fc491e +Patch-mainline: v5.8-rc1 +References: bsc#1167260 + +ColdFire is a big-endian cpu with a big-endian dspi hw module, +so, it uses native access, but memcpy breaks the endianness. + +So, if i understand properly, by native copy we would mean +be(cpu)->be(dspi) or le(cpu)->le(dspi) accesses, so my fix +shouldn't break anything, but i couldn't test it on LS family, +so every test is really appreciated. + +Fixes: 53fadb4d90c7 ("spi: spi-fsl-dspi: Simplify bytes_per_word gymnastics") +Signed-off-by: Angelo Dureghello +Tested-by: Vladimir Oltean +Reviewed-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20200529195756.184677-1-angelo.dureghello@timesys.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 24 ++++++++++++++++++++++-- + 1 file changed, 22 insertions(+), 2 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 685afdf9e807..a35faced0456 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -250,13 +250,33 @@ struct fsl_dspi { + + static void dspi_native_host_to_dev(struct fsl_dspi *dspi, u32 *txdata) + { +- memcpy(txdata, dspi->tx, dspi->oper_word_size); ++ switch (dspi->oper_word_size) { ++ case 1: ++ *txdata = *(u8 *)dspi->tx; ++ break; ++ case 2: ++ *txdata = *(u16 *)dspi->tx; ++ break; ++ case 4: ++ *txdata = *(u32 *)dspi->tx; ++ break; ++ } + dspi->tx += dspi->oper_word_size; + } + + static void dspi_native_dev_to_host(struct fsl_dspi *dspi, u32 rxdata) + { +- memcpy(dspi->rx, &rxdata, dspi->oper_word_size); ++ switch (dspi->oper_word_size) { ++ case 1: ++ *(u8 *)dspi->rx = rxdata; ++ break; ++ case 2: ++ *(u16 *)dspi->rx = rxdata; ++ break; ++ case 4: ++ *(u32 *)dspi->rx = rxdata; ++ break; ++ } + dspi->rx += dspi->oper_word_size; + } + +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-replace-interruptible-wait-queue-with-a-simple-completion.patch b/patches.suse/spi-spi-fsl-dspi-replace-interruptible-wait-queue-with-a-simple-completion.patch deleted file mode 100644 index f1e88ee..0000000 --- a/patches.suse/spi-spi-fsl-dspi-replace-interruptible-wait-queue-with-a-simple-completion.patch +++ /dev/null @@ -1,165 +0,0 @@ -From: Vladimir Oltean -Date: Wed, 18 Mar 2020 02:15:57 +0200 -Subject: spi: spi-fsl-dspi: Replace interruptible wait queue with a simple - completion -Git-commit: 4f5ee75ea1718a09149460b3df993f389a67b56a -Patch-mainline: v5.7-rc1 -References: git-fixes - -Currently the driver puts the process in interruptible sleep waiting for -the interrupt train to finish transfer to/from the tx_buf and rx_buf. - -But exiting the process with ctrl-c may make the kernel panic: the -wait_event_interruptible call will return -ERESTARTSYS, which a proper -driver implementation is perhaps supposed to handle, but nonetheless -this one doesn't, and aborts the transfer altogether. - -Actually when the task is interrupted, there is still a high chance that -the dspi_interrupt is still triggering. And if dspi_transfer_one_message -returns execution all the way to the spi_device driver, that can free -the spi_message and spi_transfer structures, leaving the interrupts to -access a freed tx_buf and rx_buf. - -hexdump -C /dev/mtd0 -00000000 00 75 68 75 0a ff ff ff ff ff ff ff ff ff ff ff -|.uhu............| -00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff -|................| -* -^C[ 38.495955] fsl-dspi 2120000.spi: Waiting for transfer to complete failed! -[ 38.503097] spi_master spi2: failed to transfer one message from queue -[ 38.509729] Unable to handle kernel paging request at virtual address ffff800095ab3377 -[ 38.517676] Mem abort info: -[ 38.520474] ESR = 0x96000045 -[ 38.523533] EC = 0x25: DABT (current EL), IL = 32 bits -[ 38.528861] SET = 0, FnV = 0 -[ 38.531921] EA = 0, S1PTW = 0 -[ 38.535067] Data abort info: -[ 38.537952] ISV = 0, ISS = 0x00000045 -[ 38.541797] CM = 0, WnR = 1 -[ 38.544771] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000082621000 -[ 38.551494] [ffff800095ab3377] pgd=00000020fffff003, p4d=00000020fffff003, pud=0000000000000000 -[ 38.560229] Internal error: Oops: 96000045 [#1] PREEMPT SMP -[ 38.565819] Modules linked in: -[ 38.568882] CPU: 0 PID: 2729 Comm: hexdump Not tainted 5.6.0-rc4-next-20200306-00052-gd8730cdc8a0b-dirty #193 -[ 38.578834] Hardware name: Kontron SMARC-sAL28 (Single PHY) on SMARC Eval 2.0 carrier (DT) -[ 38.587129] pstate: 20000085 (nzCv daIf -PAN -UAO) -[ 38.591941] pc : ktime_get_real_ts64+0x3c/0x110 -[ 38.596487] lr : spi_take_timestamp_pre+0x40/0x90 -[ 38.601203] sp : ffff800010003d90 -[ 38.604525] x29: ffff800010003d90 x28: ffff80001200e000 -[ 38.609854] x27: ffff800011da9000 x26: ffff002079c40400 -[ 38.615184] x25: ffff8000117fe018 x24: ffff800011daa1a0 -[ 38.620513] x23: ffff800015ab3860 x22: ffff800095ab3377 -[ 38.625841] x21: 000000000000146e x20: ffff8000120c3000 -[ 38.631170] x19: ffff0020795f6e80 x18: ffff800011da9948 -[ 38.636498] x17: 0000000000000000 x16: 0000000000000000 -[ 38.641826] x15: ffff800095ab3377 x14: 0720072007200720 -[ 38.647155] x13: 0720072007200765 x12: 0775076507750771 -[ 38.652483] x11: 0720076d076f0772 x10: 0000000000000040 -[ 38.657812] x9 : ffff8000108e2100 x8 : ffff800011dcabe8 -[ 38.663139] x7 : 0000000000000000 x6 : ffff800015ab3a60 -[ 38.668468] x5 : 0000000007200720 x4 : ffff800095ab3377 -[ 38.673796] x3 : 0000000000000000 x2 : 0000000000000ab0 -[ 38.679125] x1 : ffff800011daa000 x0 : 0000000000000026 -[ 38.684454] Call trace: -[ 38.686905] ktime_get_real_ts64+0x3c/0x110 -[ 38.691100] spi_take_timestamp_pre+0x40/0x90 -[ 38.695470] dspi_fifo_write+0x58/0x2c0 -[ 38.699315] dspi_interrupt+0xbc/0xd0 -[ 38.702987] __handle_irq_event_percpu+0x78/0x2c0 -[ 38.707706] handle_irq_event_percpu+0x3c/0x90 -[ 38.712161] handle_irq_event+0x4c/0xd0 -[ 38.716008] handle_fasteoi_irq+0xbc/0x170 -[ 38.720115] generic_handle_irq+0x2c/0x40 -[ 38.724135] __handle_domain_irq+0x68/0xc0 -[ 38.728243] gic_handle_irq+0xc8/0x160 -[ 38.732000] el1_irq+0xb8/0x180 -[ 38.735149] spi_nor_spimem_read_data+0xe0/0x140 -[ 38.739779] spi_nor_read+0xc4/0x120 -[ 38.743364] mtd_read_oob+0xa8/0xc0 -[ 38.746860] mtd_read+0x4c/0x80 -[ 38.750007] mtdchar_read+0x108/0x2a0 -[ 38.753679] __vfs_read+0x20/0x50 -[ 38.757002] vfs_read+0xa4/0x190 -[ 38.760237] ksys_read+0x6c/0xf0 -[ 38.763471] __arm64_sys_read+0x20/0x30 -[ 38.767319] el0_svc_common.constprop.3+0x90/0x160 -[ 38.772125] do_el0_svc+0x28/0x90 -[ 38.775449] el0_sync_handler+0x118/0x190 -[ 38.779468] el0_sync+0x140/0x180 -[ 38.782793] Code: 91000294 1400000f d50339bf f9405e80 (f90002c0) -[ 38.788910] ---[ end trace 55da560db4d6bef7 ]--- -[ 38.793540] Kernel panic - not syncing: Fatal exception in interrupt -[ 38.799914] SMP: stopping secondary CPUs -[ 38.803849] Kernel Offset: disabled -[ 38.807344] CPU features: 0x10002,20006008 -[ 38.811451] Memory Limit: none -[ 38.814513] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]--- - -So it is clear that the "interruptible" part isn't handled correctly. -When the process receives a signal, one could either attempt a clean -abort (which appears to be difficult with this hardware) or just keep -restarting the sleep until the wait queue really completes. But checking -in a loop for -ERESTARTSYS is a bit too complicated for this driver, so -just make the sleep uninterruptible, to avoid all that nonsense. - -The wait queue was actually restructured as a completion, after polling -other drivers for the most "popular" approach. - -Fixes: 349ad66c0ab0 ("spi:Add Freescale DSPI driver for Vybrid VF610 platform") -Reported-by: Michael Walle -Signed-off-by: Vladimir Oltean -Tested-by: Michael Walle -Link: https://lore.kernel.org/r/20200318001603.9650-7-olteanv@gmail.com -Signed-off-by: Mark Brown -Acked-by: Nicolas Saenz Julienne ---- - drivers/spi/spi-fsl-dspi.c | 15 +++++---------- - 1 file changed, 5 insertions(+), 10 deletions(-) - ---- a/drivers/spi/spi-fsl-dspi.c -+++ b/drivers/spi/spi-fsl-dspi.c -@@ -206,8 +206,7 @@ struct fsl_dspi { - u8 bytes_per_word; - const struct fsl_dspi_devtype_data *devtype_data; - -- wait_queue_head_t waitq; -- u32 waitflags; -+ struct completion xfer_done; - - struct fsl_dspi_dma *dma; - }; -@@ -745,11 +744,8 @@ static int dspi_transfer_one_message(str - } - - if (trans_mode != DSPI_DMA_MODE) { -- if (wait_event_interruptible(dspi->waitq, -- dspi->waitflags)) -- dev_err(&dspi->pdev->dev, -- "wait transfer complete fail!\n"); -- dspi->waitflags = 0; -+ wait_for_completion(&dspi->xfer_done); -+ reinit_completion(&dspi->xfer_done); - } - - if (transfer->delay_usecs) -@@ -874,8 +870,7 @@ static irqreturn_t dspi_interrupt(int ir - } - - if (!dspi->len) { -- dspi->waitflags = 1; -- wake_up_interruptible(&dspi->waitq); -+ complete(&dspi->xfer_done); - } else { - switch (trans_mode) { - case DSPI_EOQ_MODE: -@@ -1138,7 +1133,7 @@ static int dspi_probe(struct platform_de - master->max_speed_hz = - clk_get_rate(dspi->clk) / dspi->devtype_data->max_clock_factor; - -- init_waitqueue_head(&dspi->waitq); -+ init_completion(&dspi->xfer_done); - platform_set_drvdata(pdev, master); - - ret = spi_register_master(master); diff --git a/patches.suse/spi-spi-fsl-dspi-set-ColdFire-to-DMA-mode.patch b/patches.suse/spi-spi-fsl-dspi-set-ColdFire-to-DMA-mode.patch new file mode 100644 index 0000000..62b2eb5 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-set-ColdFire-to-DMA-mode.patch @@ -0,0 +1,38 @@ +From: Angelo Dureghello +Date: Sun, 16 Aug 2020 11:46:35 +0200 +Subject: spi: spi-fsl-dspi: set ColdFire to DMA mode + +Git-commit: b09058bbf5f083e2670186a02f5be05baf1190d7 +Patch-mainline: v5.10-rc1 +References: bsc#1167260 + +Set DMA transfer mode for ColdFire. + +After recent fixes to fsl edma engine, this mode can be used +also for ColdFire, and from some raw mtd r/w tests it definitely +improves the transfer rate, so keeping it selected. + +Signed-off-by: Angelo Dureghello +Link: https://lore.kernel.org/r/20200816094635.1830006-1-angelo.dureghello@timesys.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 91c6affe139c..5b9a285d84a7 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -189,7 +189,7 @@ static const struct fsl_dspi_devtype_data devtype_data[] = { + .fifo_size = 4, + }, + [MCF5441X] = { +- .trans_mode = DSPI_EOQ_MODE, ++ .trans_mode = DSPI_DMA_MODE, + .max_clock_factor = 8, + .fifo_size = 16, + }, +-- +2.26.2 + diff --git a/patches.suse/spi-spi-fsl-dspi-use-XSPI-mode-instead-of-DMA-for-DP.patch b/patches.suse/spi-spi-fsl-dspi-use-XSPI-mode-instead-of-DMA-for-DP.patch new file mode 100644 index 0000000..1fb8205 --- /dev/null +++ b/patches.suse/spi-spi-fsl-dspi-use-XSPI-mode-instead-of-DMA-for-DP.patch @@ -0,0 +1,59 @@ +From: Vladimir Oltean +Date: Thu, 10 Sep 2020 15:15:32 +0300 +Subject: spi: spi-fsl-dspi: use XSPI mode instead of DMA for DPAA2 SoCs + +Git-commit: 6ce898593705f540606a0f61db17c7fa198bd8f7 +Patch-mainline: v5.10-rc1 +References: bsc#1167260 + +The arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi device tree lacks DMA +channels for DSPI, so naturally, the driver fails to probe: + +[ 2.945302] fsl-dspi 2100000.spi: rx dma channel not available +[ 2.951134] fsl-dspi 2100000.spi: can't get dma channels + +In retrospect, this should have been obvious, because LS2080A, LS2085A +LS2088A and LX2160A don't appear to have an eDMA module at all. Looking +again at their datasheets, the CTARE register (which is specific to XSPI +functionality) seems to be documented, so switch them to XSPI mode +instead. + +Fixes: 0feaf8f5afe0 ("spi: spi-fsl-dspi: Convert the instantiations that support it to DMA") +Reported-by: Qiang Zhao +Tested-by: Qiang Zhao +Signed-off-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20200910121532.1138596-1-olteanv@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Mian Yousaf Kaukab +--- + drivers/spi/spi-fsl-dspi.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index c739cc7e4561..dad723d7fd70 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -171,17 +171,17 @@ static const struct fsl_dspi_devtype_data devtype_data[] = { + .fifo_size = 16, + }, + [LS2080A] = { +- .trans_mode = DSPI_DMA_MODE, ++ .trans_mode = DSPI_XSPI_MODE, + .max_clock_factor = 8, + .fifo_size = 4, + }, + [LS2085A] = { +- .trans_mode = DSPI_DMA_MODE, ++ .trans_mode = DSPI_XSPI_MODE, + .max_clock_factor = 8, + .fifo_size = 4, + }, + [LX2160A] = { +- .trans_mode = DSPI_DMA_MODE, ++ .trans_mode = DSPI_XSPI_MODE, + .max_clock_factor = 8, + .fifo_size = 4, + }, +-- +2.26.2 + diff --git a/patches.suse/spi-spi-ti-qspi-Free-DMA-resources.patch b/patches.suse/spi-spi-ti-qspi-Free-DMA-resources.patch new file mode 100644 index 0000000..43f2719 --- /dev/null +++ b/patches.suse/spi-spi-ti-qspi-Free-DMA-resources.patch @@ -0,0 +1,70 @@ +From 1d309cd688a76fb733f0089d36dc630327b32d59 Mon Sep 17 00:00:00 2001 +From: Tudor Ambarus +Date: Thu, 18 Feb 2021 15:09:50 +0200 +Subject: [PATCH] spi: spi-ti-qspi: Free DMA resources +Git-commit: 1d309cd688a76fb733f0089d36dc630327b32d59 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Release the RX channel and free the dma coherent memory when +devm_spi_register_master() fails. + +Fixes: 5720ec0a6d26 ("spi: spi-ti-qspi: Add DMA support for QSPI mmap read") +Cc: stable@vger.kernel.org +Signed-off-by: Tudor Ambarus +Link: https://lore.kernel.org/r/20210218130950.90155-1-tudor.ambarus@microchip.com +Signed-off-by: Mark Brown +Acked-by: Takashi Iwai + +--- + drivers/spi/spi-ti-qspi.c | 20 ++++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c +index 9417385c0921..e06aafe169e0 100644 +--- a/drivers/spi/spi-ti-qspi.c ++++ b/drivers/spi/spi-ti-qspi.c +@@ -733,6 +733,17 @@ static int ti_qspi_runtime_resume(struct device *dev) + return 0; + } + ++static void ti_qspi_dma_cleanup(struct ti_qspi *qspi) ++{ ++ if (qspi->rx_bb_addr) ++ dma_free_coherent(qspi->dev, QSPI_DMA_BUFFER_SIZE, ++ qspi->rx_bb_addr, ++ qspi->rx_bb_dma_addr); ++ ++ if (qspi->rx_chan) ++ dma_release_channel(qspi->rx_chan); ++} ++ + static const struct of_device_id ti_qspi_match[] = { + {.compatible = "ti,dra7xxx-qspi" }, + {.compatible = "ti,am4372-qspi" }, +@@ -886,6 +897,8 @@ static int ti_qspi_probe(struct platform_device *pdev) + if (!ret) + return 0; + ++ ti_qspi_dma_cleanup(qspi); ++ + pm_runtime_disable(&pdev->dev); + free_master: + spi_master_put(master); +@@ -904,12 +917,7 @@ static int ti_qspi_remove(struct platform_device *pdev) + pm_runtime_put_sync(&pdev->dev); + pm_runtime_disable(&pdev->dev); + +- if (qspi->rx_bb_addr) +- dma_free_coherent(qspi->dev, QSPI_DMA_BUFFER_SIZE, +- qspi->rx_bb_addr, +- qspi->rx_bb_dma_addr); +- if (qspi->rx_chan) +- dma_release_channel(qspi->rx_chan); ++ ti_qspi_dma_cleanup(qspi); + + return 0; + } +-- +2.26.2 + diff --git a/patches.suse/staging-fwserial-fix-TIOCGSERIAL-implementation.patch b/patches.suse/staging-fwserial-fix-TIOCGSERIAL-implementation.patch new file mode 100644 index 0000000..b5c128f --- /dev/null +++ b/patches.suse/staging-fwserial-fix-TIOCGSERIAL-implementation.patch @@ -0,0 +1,61 @@ +From 5e84a66f3682af4f177bb24bb2ad5135c51f764a Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 7 Apr 2021 12:23:22 +0200 +Subject: [PATCH] staging: fwserial: fix TIOCGSERIAL implementation +Git-commit: 5e84a66f3682af4f177bb24bb2ad5135c51f764a +Patch-mainline: v5.13-rc1 +References: git-fixes + +TIOCSSERIAL is a horrid, underspecified, legacy interface which for most +serial devices is only useful for setting the close_delay and +closing_wait parameters. + +The xmit_fifo_size parameter could be used to set the hardware transmit +fifo size of a legacy UART when it could not be detected, but the +interface is limited to eight bits and should be left unset when not +used. + +Fix the fwserial implementation by dropping its custom interpretation of +the unused xmit_fifo_size field, which was overflowed with the driver +FIFO size. Also leave the type and flags fields unset as these cannot be +changed. + +The close_delay and closing_wait parameters returned by TIOCGSERIAL are +specified in centiseconds. The driver does not yet support changing +closing_wait, but let's report back the default value actually used (30 +seconds). + +Fixes: 7355ba3445f2 ("staging: fwserial: Add TTY-over-Firewire serial driver") +Signed-off-by: Johan Hovold +Link: https://lore.kernel.org/r/20210407102334.32361-5-johan@kernel.org +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/staging/fwserial/fwserial.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c +index 2888b80a2c1a..0f4655d7d520 100644 +--- a/drivers/staging/fwserial/fwserial.c ++++ b/drivers/staging/fwserial/fwserial.c +@@ -1218,13 +1218,12 @@ static int get_serial_info(struct tty_struct *tty, + struct fwtty_port *port = tty->driver_data; + + mutex_lock(&port->port.mutex); +- ss->type = PORT_UNKNOWN; +- ss->line = port->port.tty->index; +- ss->flags = port->port.flags; +- ss->xmit_fifo_size = FWTTY_PORT_TXFIFO_LEN; ++ ss->line = port->index; + ss->baud_base = 400000000; + ss->close_delay = jiffies_to_msecs(port->port.close_delay) / 10; ++ ss->closing_wait = 3000; + mutex_unlock(&port->port.mutex); ++ + return 0; + } + +-- +2.26.2 + diff --git a/patches.suse/staging-fwserial-fix-TIOCSSERIAL-implementation.patch b/patches.suse/staging-fwserial-fix-TIOCSSERIAL-implementation.patch new file mode 100644 index 0000000..a8f2a31 --- /dev/null +++ b/patches.suse/staging-fwserial-fix-TIOCSSERIAL-implementation.patch @@ -0,0 +1,49 @@ +From a7eaaa9d1032e68669bb479496087ba8fc155ab6 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 7 Apr 2021 12:23:21 +0200 +Subject: [PATCH] staging: fwserial: fix TIOCSSERIAL implementation +Git-commit: a7eaaa9d1032e68669bb479496087ba8fc155ab6 +Patch-mainline: v5.13-rc1 +References: git-fixes + +TIOCSSERIAL is a horrid, underspecified, legacy interface which for most +serial devices is only useful for setting the close_delay and +closing_wait parameters. + +A non-privileged user has only ever been able to set the since long +deprecated ASYNC_SPD flags and trying to change any other *supported* +feature should result in -EPERM being returned. Setting the current +values for any supported features should return success. + +Fix the fwserial implementation which was returning -EPERM also for a +privileged user when trying to change certain unsupported parameters, +and instead return success consistently. + +Fixes: 7355ba3445f2 ("staging: fwserial: Add TTY-over-Firewire serial driver") +Signed-off-by: Johan Hovold +Link: https://lore.kernel.org/r/20210407102334.32361-4-johan@kernel.org +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/staging/fwserial/fwserial.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c +index 440d11423812..2888b80a2c1a 100644 +--- a/drivers/staging/fwserial/fwserial.c ++++ b/drivers/staging/fwserial/fwserial.c +@@ -1234,10 +1234,6 @@ static int set_serial_info(struct tty_struct *tty, + struct fwtty_port *port = tty->driver_data; + unsigned int cdelay; + +- if (ss->irq != 0 || ss->port != 0 || ss->custom_divisor != 0 || +- ss->baud_base != 400000000) +- return -EPERM; +- + cdelay = msecs_to_jiffies(ss->close_delay * 10); + + mutex_lock(&port->port.mutex); +-- +2.26.2 + diff --git a/patches.suse/staging-fwserial-fix-TIOCSSERIAL-jiffies-conversions.patch b/patches.suse/staging-fwserial-fix-TIOCSSERIAL-jiffies-conversions.patch new file mode 100644 index 0000000..adb63f7 --- /dev/null +++ b/patches.suse/staging-fwserial-fix-TIOCSSERIAL-jiffies-conversions.patch @@ -0,0 +1,51 @@ +From 7a3791afdbd5a951b09a7689bba856bd9f6c6a9f Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 7 Apr 2021 12:23:19 +0200 +Subject: [PATCH] staging: fwserial: fix TIOCSSERIAL jiffies conversions +Git-commit: 7a3791afdbd5a951b09a7689bba856bd9f6c6a9f +Patch-mainline: v5.13-rc1 +References: git-fixes + +The port close_delay parameter set by TIOCSSERIAL is specified in +jiffies, while the value returned by TIOCGSERIAL is specified in +centiseconds. + +Add the missing conversions so that TIOCGSERIAL works as expected also +when HZ is not 100. + +Fixes: 7355ba3445f2 ("staging: fwserial: Add TTY-over-Firewire serial driver") +Cc: stable@vger.kernel.org # 3.8 +Signed-off-by: Johan Hovold +Link: https://lore.kernel.org/r/20210407102334.32361-2-johan@kernel.org +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/staging/fwserial/fwserial.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c +index c368082aae1a..c963848522b1 100644 +--- a/drivers/staging/fwserial/fwserial.c ++++ b/drivers/staging/fwserial/fwserial.c +@@ -1223,7 +1223,7 @@ static int get_serial_info(struct tty_struct *tty, + ss->flags = port->port.flags; + ss->xmit_fifo_size = FWTTY_PORT_TXFIFO_LEN; + ss->baud_base = 400000000; +- ss->close_delay = port->port.close_delay; ++ ss->close_delay = jiffies_to_msecs(port->port.close_delay) / 10; + mutex_unlock(&port->port.mutex); + return 0; + } +@@ -1245,7 +1245,7 @@ static int set_serial_info(struct tty_struct *tty, + return -EPERM; + } + } +- port->port.close_delay = ss->close_delay * HZ / 100; ++ port->port.close_delay = msecs_to_jiffies(ss->close_delay * 10); + mutex_unlock(&port->port.mutex); + + return 0; +-- +2.26.2 + diff --git a/patches.suse/staging-fwserial-fix-TIOCSSERIAL-permission-check.patch b/patches.suse/staging-fwserial-fix-TIOCSSERIAL-permission-check.patch new file mode 100644 index 0000000..fcea4ba --- /dev/null +++ b/patches.suse/staging-fwserial-fix-TIOCSSERIAL-permission-check.patch @@ -0,0 +1,56 @@ +From 2104eb283df66a482b60254299acbe3c68c03412 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 7 Apr 2021 12:23:20 +0200 +Subject: [PATCH] staging: fwserial: fix TIOCSSERIAL permission check +Git-commit: 2104eb283df66a482b60254299acbe3c68c03412 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Changing the port close-delay parameter is a privileged operation so +make sure to return -EPERM if a regular user tries to change it. + +Fixes: 7355ba3445f2 ("staging: fwserial: Add TTY-over-Firewire serial driver") +Cc: stable@vger.kernel.org # 3.8 +Signed-off-by: Johan Hovold +Link: https://lore.kernel.org/r/20210407102334.32361-3-johan@kernel.org +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/staging/fwserial/fwserial.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c +index c963848522b1..440d11423812 100644 +--- a/drivers/staging/fwserial/fwserial.c ++++ b/drivers/staging/fwserial/fwserial.c +@@ -1232,20 +1232,24 @@ static int set_serial_info(struct tty_struct *tty, + struct serial_struct *ss) + { + struct fwtty_port *port = tty->driver_data; ++ unsigned int cdelay; + + if (ss->irq != 0 || ss->port != 0 || ss->custom_divisor != 0 || + ss->baud_base != 400000000) + return -EPERM; + ++ cdelay = msecs_to_jiffies(ss->close_delay * 10); ++ + mutex_lock(&port->port.mutex); + if (!capable(CAP_SYS_ADMIN)) { +- if (((ss->flags & ~ASYNC_USR_MASK) != ++ if (cdelay != port->port.close_delay || ++ ((ss->flags & ~ASYNC_USR_MASK) != + (port->port.flags & ~ASYNC_USR_MASK))) { + mutex_unlock(&port->port.mutex); + return -EPERM; + } + } +- port->port.close_delay = msecs_to_jiffies(ss->close_delay * 10); ++ port->port.close_delay = cdelay; + mutex_unlock(&port->port.mutex); + + return 0; +-- +2.26.2 + diff --git a/patches.suse/staging-rtl8192u-Fix-potential-infinite-loop.patch b/patches.suse/staging-rtl8192u-Fix-potential-infinite-loop.patch new file mode 100644 index 0000000..4ec3782 --- /dev/null +++ b/patches.suse/staging-rtl8192u-Fix-potential-infinite-loop.patch @@ -0,0 +1,41 @@ +From f9b9263a25dc3d2eaaa829e207434db6951ca7bc Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Wed, 7 Apr 2021 16:03:08 +0100 +Subject: [PATCH] staging: rtl8192u: Fix potential infinite loop +Git-commit: f9b9263a25dc3d2eaaa829e207434db6951ca7bc +Patch-mainline: v5.13-rc1 +References: git-fixes + +The for-loop iterates with a u8 loop counter i and compares this +with the loop upper limit of riv->ieee80211->LinkDetectInfo.SlotNum +that is a u16 type. There is a potential infinite loop if SlotNum +is larger than the u8 loop counter. Fix this by making the loop +counter the same type as SlotNum. + +Addresses-coverity: ("Infinite loop") +Fixes: 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging") +Signed-off-by: Colin Ian King +Link: https://lore.kernel.org/r/20210407150308.496623-1-colin.king@canonical.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/staging/rtl8192u/r8192U_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c +index f48c04281cbe..f48186a89fa1 100644 +--- a/drivers/staging/rtl8192u/r8192U_core.c ++++ b/drivers/staging/rtl8192u/r8192U_core.c +@@ -3210,7 +3210,7 @@ static void rtl819x_update_rxcounts(struct r8192_priv *priv, u32 *TotalRxBcnNum, + u32 *TotalRxDataNum) + { + u16 SlotIndex; +- u8 i; ++ u16 i; + + *TotalRxBcnNum = 0; + *TotalRxDataNum = 0; +-- +2.26.2 + diff --git a/patches.suse/usb-dwc2-Fix-hibernation-between-host-and-device-mod.patch b/patches.suse/usb-dwc2-Fix-hibernation-between-host-and-device-mod.patch new file mode 100644 index 0000000..1548e68 --- /dev/null +++ b/patches.suse/usb-dwc2-Fix-hibernation-between-host-and-device-mod.patch @@ -0,0 +1,221 @@ +From 24d209dba5a3959b2ebde7cf3ad40c8015e814cf Mon Sep 17 00:00:00 2001 +From: Artur Petrosyan +Date: Fri, 16 Apr 2021 16:47:14 +0400 +Subject: [PATCH] usb: dwc2: Fix hibernation between host and device modes. +Git-commit: 24d209dba5a3959b2ebde7cf3ad40c8015e814cf +Patch-mainline: v5.13-rc1 +References: git-fixes + +When core is in hibernation in host mode and a device cable +was connected then driver exited from device hibernation. +However, registers saved for host mode and when exited from +device hibernation register restore would be done for device +register which was wrong because there was no device registers +stored to restore. + +- Added dwc_handle_gpwrdn_disc_det() function which handles + gpwrdn disconnect detect flow and exits hibernation + without restoring the registers. +- Updated exiting from hibernation in GPWRDN_STS_CHGINT with + calling dwc_handle_gpwrdn_disc_det() function. Here no register + is restored which is the solution described above. + +Fixes: 65c9c4c6b01f ("usb: dwc2: Add dwc2_handle_gpwrdn_intr() handler") +Acked-by: Minas Harutyunyan +Signed-off-by: Artur Petrosyan +Signed-off-by: Minas Harutyunyan +Link: https://lore.kernel.org/r/20210416124715.75355A005D@mailhost.synopsys.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/dwc2/core_intr.c | 154 +++++++++++++++++++---------------- + 1 file changed, 83 insertions(+), 71 deletions(-) + +diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c +index 550c52c1a0c7..27d729fad227 100644 +--- a/drivers/usb/dwc2/core_intr.c ++++ b/drivers/usb/dwc2/core_intr.c +@@ -680,6 +680,71 @@ static u32 dwc2_read_common_intr(struct dwc2_hsotg *hsotg) + return 0; + } + ++/** ++ * dwc_handle_gpwrdn_disc_det() - Handles the gpwrdn disconnect detect. ++ * Exits hibernation without restoring registers. ++ * ++ * @hsotg: Programming view of DWC_otg controller ++ * @gpwrdn: GPWRDN register ++ */ ++static inline void dwc_handle_gpwrdn_disc_det(struct dwc2_hsotg *hsotg, ++ u32 gpwrdn) ++{ ++ u32 gpwrdn_tmp; ++ ++ /* Switch-on voltage to the core */ ++ gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); ++ gpwrdn_tmp &= ~GPWRDN_PWRDNSWTCH; ++ dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); ++ udelay(5); ++ ++ /* Reset core */ ++ gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); ++ gpwrdn_tmp &= ~GPWRDN_PWRDNRSTN; ++ dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); ++ udelay(5); ++ ++ /* Disable Power Down Clamp */ ++ gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); ++ gpwrdn_tmp &= ~GPWRDN_PWRDNCLMP; ++ dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); ++ udelay(5); ++ ++ /* Deassert reset core */ ++ gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); ++ gpwrdn_tmp |= GPWRDN_PWRDNRSTN; ++ dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); ++ udelay(5); ++ ++ /* Disable PMU interrupt */ ++ gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); ++ gpwrdn_tmp &= ~GPWRDN_PMUINTSEL; ++ dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); ++ ++ /* De-assert Wakeup Logic */ ++ gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); ++ gpwrdn_tmp &= ~GPWRDN_PMUACTV; ++ dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); ++ ++ hsotg->hibernated = 0; ++ hsotg->bus_suspended = 0; ++ ++ if (gpwrdn & GPWRDN_IDSTS) { ++ hsotg->op_state = OTG_STATE_B_PERIPHERAL; ++ dwc2_core_init(hsotg, false); ++ dwc2_enable_global_interrupts(hsotg); ++ dwc2_hsotg_core_init_disconnected(hsotg, false); ++ dwc2_hsotg_core_connect(hsotg); ++ } else { ++ hsotg->op_state = OTG_STATE_A_HOST; ++ ++ /* Initialize the Core for Host mode */ ++ dwc2_core_init(hsotg, false); ++ dwc2_enable_global_interrupts(hsotg); ++ dwc2_hcd_start(hsotg); ++ } ++} ++ + /* + * GPWRDN interrupt handler. + * +@@ -701,64 +766,14 @@ static void dwc2_handle_gpwrdn_intr(struct dwc2_hsotg *hsotg) + + if ((gpwrdn & GPWRDN_DISCONN_DET) && + (gpwrdn & GPWRDN_DISCONN_DET_MSK) && !linestate) { +- u32 gpwrdn_tmp; +- + dev_dbg(hsotg->dev, "%s: GPWRDN_DISCONN_DET\n", __func__); +- +- /* Switch-on voltage to the core */ +- gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); +- gpwrdn_tmp &= ~GPWRDN_PWRDNSWTCH; +- dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); +- udelay(10); +- +- /* Reset core */ +- gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); +- gpwrdn_tmp &= ~GPWRDN_PWRDNRSTN; +- dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); +- udelay(10); +- +- /* Disable Power Down Clamp */ +- gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); +- gpwrdn_tmp &= ~GPWRDN_PWRDNCLMP; +- dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); +- udelay(10); +- +- /* Deassert reset core */ +- gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); +- gpwrdn_tmp |= GPWRDN_PWRDNRSTN; +- dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); +- udelay(10); +- +- /* Disable PMU interrupt */ +- gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); +- gpwrdn_tmp &= ~GPWRDN_PMUINTSEL; +- dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); +- +- /* De-assert Wakeup Logic */ +- gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); +- gpwrdn_tmp &= ~GPWRDN_PMUACTV; +- dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); +- +- hsotg->hibernated = 0; +- +- if (gpwrdn & GPWRDN_IDSTS) { +- hsotg->op_state = OTG_STATE_B_PERIPHERAL; +- dwc2_core_init(hsotg, false); +- dwc2_enable_global_interrupts(hsotg); +- dwc2_hsotg_core_init_disconnected(hsotg, false); +- dwc2_hsotg_core_connect(hsotg); +- } else { +- hsotg->op_state = OTG_STATE_A_HOST; +- +- /* Initialize the Core for Host mode */ +- dwc2_core_init(hsotg, false); +- dwc2_enable_global_interrupts(hsotg); +- dwc2_hcd_start(hsotg); +- } +- } +- +- if ((gpwrdn & GPWRDN_LNSTSCHG) && +- (gpwrdn & GPWRDN_LNSTSCHG_MSK) && linestate) { ++ /* ++ * Call disconnect detect function to exit from ++ * hibernation ++ */ ++ dwc_handle_gpwrdn_disc_det(hsotg, gpwrdn); ++ } else if ((gpwrdn & GPWRDN_LNSTSCHG) && ++ (gpwrdn & GPWRDN_LNSTSCHG_MSK) && linestate) { + dev_dbg(hsotg->dev, "%s: GPWRDN_LNSTSCHG\n", __func__); + if (hsotg->hw_params.hibernation && + hsotg->hibernated) { +@@ -769,24 +784,21 @@ static void dwc2_handle_gpwrdn_intr(struct dwc2_hsotg *hsotg) + dwc2_exit_hibernation(hsotg, 1, 0, 1); + } + } +- } +- if ((gpwrdn & GPWRDN_RST_DET) && (gpwrdn & GPWRDN_RST_DET_MSK)) { ++ } else if ((gpwrdn & GPWRDN_RST_DET) && ++ (gpwrdn & GPWRDN_RST_DET_MSK)) { + dev_dbg(hsotg->dev, "%s: GPWRDN_RST_DET\n", __func__); + if (!linestate && (gpwrdn & GPWRDN_BSESSVLD)) + dwc2_exit_hibernation(hsotg, 0, 1, 0); +- } +- if ((gpwrdn & GPWRDN_STS_CHGINT) && +- (gpwrdn & GPWRDN_STS_CHGINT_MSK) && linestate) { ++ } else if ((gpwrdn & GPWRDN_STS_CHGINT) && ++ (gpwrdn & GPWRDN_STS_CHGINT_MSK)) { + dev_dbg(hsotg->dev, "%s: GPWRDN_STS_CHGINT\n", __func__); +- if (hsotg->hw_params.hibernation && +- hsotg->hibernated) { +- if (gpwrdn & GPWRDN_IDSTS) { +- dwc2_exit_hibernation(hsotg, 0, 0, 0); +- call_gadget(hsotg, resume); +- } else { +- dwc2_exit_hibernation(hsotg, 1, 0, 1); +- } +- } ++ /* ++ * As GPWRDN_STS_CHGINT exit from hibernation flow is ++ * the same as in GPWRDN_DISCONN_DET flow. Call ++ * disconnect detect helper function to exit from ++ * hibernation. ++ */ ++ dwc_handle_gpwrdn_disc_det(hsotg, gpwrdn); + } + } + +-- +2.26.2 + diff --git a/patches.suse/usb-dwc2-Fix-host-mode-hibernation-exit-with-remote-.patch b/patches.suse/usb-dwc2-Fix-host-mode-hibernation-exit-with-remote-.patch new file mode 100644 index 0000000..f3302a2 --- /dev/null +++ b/patches.suse/usb-dwc2-Fix-host-mode-hibernation-exit-with-remote-.patch @@ -0,0 +1,47 @@ +From c2db8d7b9568b10e014af83b3c15e39929e3579e Mon Sep 17 00:00:00 2001 +From: Artur Petrosyan +Date: Fri, 16 Apr 2021 16:47:06 +0400 +Subject: [PATCH] usb: dwc2: Fix host mode hibernation exit with remote wakeup flow. +Git-commit: c2db8d7b9568b10e014af83b3c15e39929e3579e +Patch-mainline: v5.13-rc1 +References: git-fixes + +Added setting "port_connect_status_change" flag to "1" in order +to re-enumerate, because after exit from hibernation port +connection status is not detected. + +Fixes: c5c403dc4336 ("usb: dwc2: Add host/device hibernation functions") +Acked-by: Minas Harutyunyan +Signed-off-by: Artur Petrosyan +Link: https://lore.kernel.org/r/20210416124707.5EEC2A005D@mailhost.synopsys.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/dwc2/hcd.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c +index cda3f931195d..ff945c40ef8a 100644 +--- a/drivers/usb/dwc2/hcd.c ++++ b/drivers/usb/dwc2/hcd.c +@@ -5650,7 +5650,15 @@ int dwc2_host_exit_hibernation(struct dwc2_hsotg *hsotg, int rem_wakeup, + return ret; + } + +- dwc2_hcd_rem_wakeup(hsotg); ++ if (rem_wakeup) { ++ dwc2_hcd_rem_wakeup(hsotg); ++ /* ++ * Change "port_connect_status_change" flag to re-enumerate, ++ * because after exit from hibernation port connection status ++ * is not detected. ++ */ ++ hsotg->flags.b.port_connect_status_change = 1; ++ } + + hsotg->hibernated = 0; + hsotg->bus_suspended = 0; +-- +2.26.2 + diff --git a/patches.suse/usb-dwc2-Fix-session-request-interrupt-handler.patch b/patches.suse/usb-dwc2-Fix-session-request-interrupt-handler.patch new file mode 100644 index 0000000..421e52e --- /dev/null +++ b/patches.suse/usb-dwc2-Fix-session-request-interrupt-handler.patch @@ -0,0 +1,53 @@ +From 42b32b164acecd850edef010915a02418345a033 Mon Sep 17 00:00:00 2001 +From: Artur Petrosyan +Date: Thu, 8 Apr 2021 13:45:49 +0400 +Subject: [PATCH] usb: dwc2: Fix session request interrupt handler +Git-commit: 42b32b164acecd850edef010915a02418345a033 +Patch-mainline: v5.13-rc1 +References: git-fixes + +According to programming guide in host mode, port +power must be turned on in session request +interrupt handlers. + +Fixes: 21795c826a45 ("usb: dwc2: exit hibernation on session request") +Cc: +Acked-by: Minas Harutyunyan +Signed-off-by: Artur Petrosyan +Link: https://lore.kernel.org/r/20210408094550.75484A0094@mailhost.synopsys.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/dwc2/core_intr.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c +index 0a7f9330907f..8c0152b514be 100644 +--- a/drivers/usb/dwc2/core_intr.c ++++ b/drivers/usb/dwc2/core_intr.c +@@ -307,6 +307,7 @@ static void dwc2_handle_conn_id_status_change_intr(struct dwc2_hsotg *hsotg) + static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg) + { + int ret; ++ u32 hprt0; + + /* Clear interrupt */ + dwc2_writel(hsotg, GINTSTS_SESSREQINT, GINTSTS); +@@ -328,6 +329,13 @@ static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg) + * established + */ + dwc2_hsotg_disconnect(hsotg); ++ } else { ++ /* Turn on the port power bit. */ ++ hprt0 = dwc2_read_hprt0(hsotg); ++ hprt0 |= HPRT0_PWR; ++ dwc2_writel(hsotg, hprt0, HPRT0); ++ /* Connect hcd after port power is set. */ ++ dwc2_hcd_connect(hsotg); + } + } + +-- +2.26.2 + diff --git a/patches.suse/usb-dwc3-gadget-Fix-START_TRANSFER-link-state-check.patch b/patches.suse/usb-dwc3-gadget-Fix-START_TRANSFER-link-state-check.patch new file mode 100644 index 0000000..4b0238f --- /dev/null +++ b/patches.suse/usb-dwc3-gadget-Fix-START_TRANSFER-link-state-check.patch @@ -0,0 +1,68 @@ +From c560e76319a94a3b9285bc426c609903408e4826 Mon Sep 17 00:00:00 2001 +From: Thinh Nguyen +Date: Mon, 19 Apr 2021 19:11:12 -0700 +Subject: [PATCH] usb: dwc3: gadget: Fix START_TRANSFER link state check +Git-commit: c560e76319a94a3b9285bc426c609903408e4826 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The START_TRANSFER command needs to be executed while in ON/U0 link +state (with an exception during register initialization). Don't use +dwc->link_state to check this since the driver only tracks the link +state when the link state change interrupt is enabled. Check the link +state from DSTS register instead. + +Note that often the host already brings the device out of low power +before it sends/requests the next transfer. So, the user won't see any +issue when the device starts transfer then. This issue is more +noticeable in cases when the device delays starting transfer, which can +happen during delayed control status after the host put the device in +low power. + +Fixes: 799e9dc82968 ("usb: dwc3: gadget: conditionally disable Link State change events") +Cc: +Acked-by: Felipe Balbi +Signed-off-by: Thinh Nguyen +Link: https://lore.kernel.org/r/bcefaa9ecbc3e1936858c0baa14de6612960e909.1618884221.git.Thinh.Nguyen@synopsys.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/dwc3/gadget.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c +index 6227641f2d31..1a632a3faf7f 100644 +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -308,13 +308,12 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned int cmd, + } + + if (DWC3_DEPCMD_CMD(cmd) == DWC3_DEPCMD_STARTTRANSFER) { +- int needs_wakeup; ++ int link_state; + +- needs_wakeup = (dwc->link_state == DWC3_LINK_STATE_U1 || +- dwc->link_state == DWC3_LINK_STATE_U2 || +- dwc->link_state == DWC3_LINK_STATE_U3); +- +- if (unlikely(needs_wakeup)) { ++ link_state = dwc3_gadget_get_link_state(dwc); ++ if (link_state == DWC3_LINK_STATE_U1 || ++ link_state == DWC3_LINK_STATE_U2 || ++ link_state == DWC3_LINK_STATE_U3) { + ret = __dwc3_gadget_wakeup(dwc); + dev_WARN_ONCE(dwc->dev, ret, "wakeup failed --> %d\n", + ret); +@@ -1989,6 +1988,8 @@ static int __dwc3_gadget_wakeup(struct dwc3 *dwc) + case DWC3_LINK_STATE_RESET: + case DWC3_LINK_STATE_RX_DET: /* in HS, means Early Suspend */ + case DWC3_LINK_STATE_U3: /* in HS, means SUSPEND */ ++ case DWC3_LINK_STATE_U2: /* in HS, means Sleep (L1) */ ++ case DWC3_LINK_STATE_U1: + case DWC3_LINK_STATE_RESUME: + break; + default: +-- +2.26.2 + diff --git a/patches.suse/usb-gadget-Fix-double-free-of-device-descriptor-poin.patch b/patches.suse/usb-gadget-Fix-double-free-of-device-descriptor-poin.patch new file mode 100644 index 0000000..c4dbf97 --- /dev/null +++ b/patches.suse/usb-gadget-Fix-double-free-of-device-descriptor-poin.patch @@ -0,0 +1,50 @@ +From 43c4cab006f55b6ca549dd1214e22f5965a8675f Mon Sep 17 00:00:00 2001 +From: Hemant Kumar +Date: Wed, 21 Apr 2021 12:47:32 -0700 +Subject: [PATCH] usb: gadget: Fix double free of device descriptor pointers +Git-commit: 43c4cab006f55b6ca549dd1214e22f5965a8675f +Patch-mainline: v5.13-rc1 +References: git-fixes + +Upon driver unbind usb_free_all_descriptors() function frees all +speed descriptor pointers without setting them to NULL. In case +gadget speed changes (i.e from super speed plus to super speed) +after driver unbind only upto super speed descriptor pointers get +populated. Super speed plus desc still holds the stale (already +freed) pointer. Fix this issue by setting all descriptor pointers +to NULL after freeing them in usb_free_all_descriptors(). + +Fixes: f5c61225cf29 ("usb: gadget: Update function for SuperSpeedPlus") +Cc: stable@vger.kernel.org +Reviewed-by: Peter Chen +Signed-off-by: Hemant Kumar +Signed-off-by: Wesley Cheng +Link: https://lore.kernel.org/r/1619034452-17334-1-git-send-email-wcheng@codeaurora.org +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/gadget/config.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/usb/gadget/config.c b/drivers/usb/gadget/config.c +index 2d115353424c..8bb25773b61e 100644 +--- a/drivers/usb/gadget/config.c ++++ b/drivers/usb/gadget/config.c +@@ -194,9 +194,13 @@ EXPORT_SYMBOL_GPL(usb_assign_descriptors); + void usb_free_all_descriptors(struct usb_function *f) + { + usb_free_descriptors(f->fs_descriptors); ++ f->fs_descriptors = NULL; + usb_free_descriptors(f->hs_descriptors); ++ f->hs_descriptors = NULL; + usb_free_descriptors(f->ss_descriptors); ++ f->ss_descriptors = NULL; + usb_free_descriptors(f->ssp_descriptors); ++ f->ssp_descriptors = NULL; + } + EXPORT_SYMBOL_GPL(usb_free_all_descriptors); + +-- +2.26.2 + diff --git a/patches.suse/usb-gadget-aspeed-fix-dma-map-failure.patch b/patches.suse/usb-gadget-aspeed-fix-dma-map-failure.patch new file mode 100644 index 0000000..9bd31c0 --- /dev/null +++ b/patches.suse/usb-gadget-aspeed-fix-dma-map-failure.patch @@ -0,0 +1,87 @@ +From bd4d607044b961cecbf8c4c2f3bb5da4fb156993 Mon Sep 17 00:00:00 2001 +From: Tao Ren +Date: Tue, 30 Mar 2021 21:58:31 -0700 +Subject: [PATCH] usb: gadget: aspeed: fix dma map failure +Git-commit: bd4d607044b961cecbf8c4c2f3bb5da4fb156993 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Currently the virtual port_dev device is passed to DMA API, and this is +wrong because the device passed to DMA API calls must be the actual +hardware device performing the DMA. + +The patch replaces usb_gadget_map_request/usb_gadget_unmap_request APIs +with usb_gadget_map_request_by_dev/usb_gadget_unmap_request_by_dev APIs +so the DMA capable platform device can be passed to the DMA APIs. + +The patch fixes below backtrace detected on Facebook AST2500 OpenBMC +Platforms: + +[<80106550>] show_stack+0x20/0x24 +[<80106868>] dump_stack+0x28/0x30 +[<80823540>] __warn+0xfc/0x110 +[<8011ac30>] warn_slowpath_fmt+0xb0/0xc0 +[<8011ad44>] dma_map_page_attrs+0x24c/0x314 +[<8016a27c>] usb_gadget_map_request_by_dev+0x100/0x1e4 +[<805cedd8>] usb_gadget_map_request+0x1c/0x20 +[<805cefbc>] ast_vhub_epn_queue+0xa0/0x1d8 +[<7f02f710>] usb_ep_queue+0x48/0xc4 +[<805cd3e8>] ecm_do_notify+0xf8/0x248 +[<7f145920>] ecm_set_alt+0xc8/0x1d0 +[<7f145c34>] composite_setup+0x680/0x1d30 +[<7f00deb8>] ast_vhub_ep0_handle_setup+0xa4/0x1bc +[<7f02ee94>] ast_vhub_dev_irq+0x58/0x84 +[<7f0309e0>] ast_vhub_irq+0xb0/0x1c8 +[<7f02e118>] __handle_irq_event_percpu+0x50/0x19c +[<8015e5bc>] handle_irq_event_percpu+0x38/0x8c +[<8015e758>] handle_irq_event+0x38/0x4c + +Fixes: 7ecca2a4080c ("usb/gadget: Add driver for Aspeed SoC virtual hub") +Reviewed-by: Joel Stanley +Signed-off-by: Tao Ren +Link: https://lore.kernel.org/r/20210331045831.28700-1-rentao.bupt@gmail.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/gadget/udc/aspeed-vhub/core.c | 3 ++- + drivers/usb/gadget/udc/aspeed-vhub/epn.c | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadget/udc/aspeed-vhub/core.c +index be7bb64e3594..d11d3d14313f 100644 +--- a/drivers/usb/gadget/udc/aspeed-vhub/core.c ++++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c +@@ -36,6 +36,7 @@ void ast_vhub_done(struct ast_vhub_ep *ep, struct ast_vhub_req *req, + int status) + { + bool internal = req->internal; ++ struct ast_vhub *vhub = ep->vhub; + + EPVDBG(ep, "completing request @%p, status %d\n", req, status); + +@@ -46,7 +47,7 @@ void ast_vhub_done(struct ast_vhub_ep *ep, struct ast_vhub_req *req, + + if (req->req.dma) { + if (!WARN_ON(!ep->dev)) +- usb_gadget_unmap_request(&ep->dev->gadget, ++ usb_gadget_unmap_request_by_dev(&vhub->pdev->dev, + &req->req, ep->epn.is_in); + req->req.dma = 0; + } +diff --git a/drivers/usb/gadget/udc/aspeed-vhub/epn.c b/drivers/usb/gadget/udc/aspeed-vhub/epn.c +index 02d8bfae58fb..cb164c615e6f 100644 +--- a/drivers/usb/gadget/udc/aspeed-vhub/epn.c ++++ b/drivers/usb/gadget/udc/aspeed-vhub/epn.c +@@ -376,7 +376,7 @@ static int ast_vhub_epn_queue(struct usb_ep* u_ep, struct usb_request *u_req, + if (ep->epn.desc_mode || + ((((unsigned long)u_req->buf & 7) == 0) && + (ep->epn.is_in || !(u_req->length & (u_ep->maxpacket - 1))))) { +- rc = usb_gadget_map_request(&ep->dev->gadget, u_req, ++ rc = usb_gadget_map_request_by_dev(&vhub->pdev->dev, u_req, + ep->epn.is_in); + if (rc) { + dev_warn(&vhub->pdev->dev, +-- +2.26.2 + diff --git a/patches.suse/usb-gadget-pch_udc-Check-for-DMA-mapping-error.patch b/patches.suse/usb-gadget-pch_udc-Check-for-DMA-mapping-error.patch new file mode 100644 index 0000000..afefefb --- /dev/null +++ b/patches.suse/usb-gadget-pch_udc-Check-for-DMA-mapping-error.patch @@ -0,0 +1,39 @@ +From 4a28d77e359009b846951b06f7c0d8eec8dce298 Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Tue, 23 Mar 2021 17:36:22 +0200 +Subject: [PATCH] usb: gadget: pch_udc: Check for DMA mapping error +Git-commit: 4a28d77e359009b846951b06f7c0d8eec8dce298 +Patch-mainline: v5.13-rc1 +References: git-fixes + +DMA mapping might fail, we have to check it with dma_mapping_error(). +Otherwise DMA-API is not happy: + + DMA-API: pch_udc 0000:02:02.4: device driver failed to check map error[device address=0x00000000027ee678] [size=64 bytes] [mapped as single] + +Fixes: abab0c67c061 ("usb: pch_udc: Fixed issue which does not work with g_serial") +Signed-off-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20210323153626.54908-3-andriy.shevchenko@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/gadget/udc/pch_udc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c +index 2e3510dd026c..455fd9cde0e6 100644 +--- a/drivers/usb/gadget/udc/pch_udc.c ++++ b/drivers/usb/gadget/udc/pch_udc.c +@@ -2946,7 +2946,7 @@ static int init_dma_pools(struct pch_udc_dev *dev) + dev->dma_addr = dma_map_single(&dev->pdev->dev, ep0out_buf, + UDC_EP0OUT_BUFF_SIZE * 4, + DMA_FROM_DEVICE); +- return 0; ++ return dma_mapping_error(&dev->pdev->dev, dev->dma_addr); + } + + static int pch_udc_start(struct usb_gadget *g, +-- +2.26.2 + diff --git a/patches.suse/usb-gadget-pch_udc-Check-if-driver-is-present-before.patch b/patches.suse/usb-gadget-pch_udc-Check-if-driver-is-present-before.patch new file mode 100644 index 0000000..d0f7136 --- /dev/null +++ b/patches.suse/usb-gadget-pch_udc-Check-if-driver-is-present-before.patch @@ -0,0 +1,98 @@ +From fbdbbe6d3ee502b3bdeb4f255196bb45003614be Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Tue, 23 Mar 2021 17:36:21 +0200 +Subject: [PATCH] usb: gadget: pch_udc: Check if driver is present before calling ->setup() +Git-commit: fbdbbe6d3ee502b3bdeb4f255196bb45003614be +Patch-mainline: v5.13-rc1 +References: git-fixes + +Since we have a separate routine for VBUS sense, the interrupt may occur +before gadget driver is present. Hence, ->setup() call may oops the kernel: + +[ 55.245843] BUG: kernel NULL pointer dereference, address: 00000010 +... +[ 55.245843] EIP: pch_udc_isr.cold+0x162/0x33f +... +[ 55.245843] +[ 55.245843] ? pch_udc_svc_data_out+0x160/0x160 + +Check if driver is present before calling ->setup(). + +Fixes: f646cf94520e ("USB device driver of Topcliff PCH") +Signed-off-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20210323153626.54908-2-andriy.shevchenko@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/gadget/udc/pch_udc.c | 28 ++++++++++++++++++---------- + 1 file changed, 18 insertions(+), 10 deletions(-) + +diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c +index c517186384bc..2e3510dd026c 100644 +--- a/drivers/usb/gadget/udc/pch_udc.c ++++ b/drivers/usb/gadget/udc/pch_udc.c +@@ -2298,6 +2298,21 @@ static void pch_udc_svc_data_out(struct pch_udc_dev *dev, int ep_num) + pch_udc_set_dma(dev, DMA_DIR_RX); + } + ++static int pch_udc_gadget_setup(struct pch_udc_dev *dev) ++ __must_hold(&dev->lock) ++{ ++ int rc; ++ ++ /* In some cases we can get an interrupt before driver gets setup */ ++ if (!dev->driver) ++ return -ESHUTDOWN; ++ ++ spin_unlock(&dev->lock); ++ rc = dev->driver->setup(&dev->gadget, &dev->setup_data); ++ spin_lock(&dev->lock); ++ return rc; ++} ++ + /** + * pch_udc_svc_control_in() - Handle Control IN endpoint interrupts + * @dev: Reference to the device structure +@@ -2369,15 +2384,12 @@ static void pch_udc_svc_control_out(struct pch_udc_dev *dev) + dev->gadget.ep0 = &dev->ep[UDC_EP0IN_IDX].ep; + else /* OUT */ + dev->gadget.ep0 = &ep->ep; +- spin_lock(&dev->lock); + /* If Mass storage Reset */ + if ((dev->setup_data.bRequestType == 0x21) && + (dev->setup_data.bRequest == 0xFF)) + dev->prot_stall = 0; + /* call gadget with setup data received */ +- setup_supported = dev->driver->setup(&dev->gadget, +- &dev->setup_data); +- spin_unlock(&dev->lock); ++ setup_supported = pch_udc_gadget_setup(dev); + + if (dev->setup_data.bRequestType & USB_DIR_IN) { + ep->td_data->status = (ep->td_data->status & +@@ -2625,9 +2637,7 @@ static void pch_udc_svc_intf_interrupt(struct pch_udc_dev *dev) + dev->ep[i].halted = 0; + } + dev->stall = 0; +- spin_unlock(&dev->lock); +- dev->driver->setup(&dev->gadget, &dev->setup_data); +- spin_lock(&dev->lock); ++ pch_udc_gadget_setup(dev); + } + + /** +@@ -2662,9 +2672,7 @@ static void pch_udc_svc_cfg_interrupt(struct pch_udc_dev *dev) + dev->stall = 0; + + /* call gadget zero with setup data received */ +- spin_unlock(&dev->lock); +- dev->driver->setup(&dev->gadget, &dev->setup_data); +- spin_lock(&dev->lock); ++ pch_udc_gadget_setup(dev); + } + + /** +-- +2.26.2 + diff --git a/patches.suse/usb-gadget-pch_udc-Move-pch_udc_init-to-satisfy-kern.patch b/patches.suse/usb-gadget-pch_udc-Move-pch_udc_init-to-satisfy-kern.patch new file mode 100644 index 0000000..9a77b2a --- /dev/null +++ b/patches.suse/usb-gadget-pch_udc-Move-pch_udc_init-to-satisfy-kern.patch @@ -0,0 +1,45 @@ +From 5af196df27c9a1173685148b368a9167b5a65d93 Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Tue, 23 Mar 2021 17:36:23 +0200 +Subject: [PATCH] usb: gadget: pch_udc: Move pch_udc_init() to satisfy kernel doc +Git-commit: 5af196df27c9a1173685148b368a9167b5a65d93 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Kernel doc and the content described by it shouldn't be torn apart. +Otherwise validator is not happy: + +.../pch_udc.c:573: warning: expecting prototype for pch_udc_reconnect(). Prototype was for pch_udc_init() instead + +Fixes: 1c575d2d2e3f ("usb: gadget: pch_udc: Fix usb/gadget/pch_udc: Fix ether gadget connect/disconnect issue") +Signed-off-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20210323153626.54908-4-andriy.shevchenko@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/gadget/udc/pch_udc.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c +index 455fd9cde0e6..a5365b524617 100644 +--- a/drivers/usb/gadget/udc/pch_udc.c ++++ b/drivers/usb/gadget/udc/pch_udc.c +@@ -563,12 +563,13 @@ static void pch_udc_clear_disconnect(struct pch_udc_dev *dev) + pch_udc_bit_clr(dev, UDC_DEVCTL_ADDR, UDC_DEVCTL_RES); + } + ++static void pch_udc_init(struct pch_udc_dev *dev); ++ + /** + * pch_udc_reconnect() - This API initializes usb device controller, + * and clear the disconnect status. + * @dev: Reference to pch_udc_regs structure + */ +-static void pch_udc_init(struct pch_udc_dev *dev); + static void pch_udc_reconnect(struct pch_udc_dev *dev) + { + pch_udc_init(dev); +-- +2.26.2 + diff --git a/patches.suse/usb-gadget-pch_udc-Replace-cpu_to_le32-by-lower_32_b.patch b/patches.suse/usb-gadget-pch_udc-Replace-cpu_to_le32-by-lower_32_b.patch new file mode 100644 index 0000000..b66fcef --- /dev/null +++ b/patches.suse/usb-gadget-pch_udc-Replace-cpu_to_le32-by-lower_32_b.patch @@ -0,0 +1,42 @@ +From 91356fed6afd1c83bf0d3df1fc336d54e38f0458 Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Tue, 23 Mar 2021 17:36:20 +0200 +Subject: [PATCH] usb: gadget: pch_udc: Replace cpu_to_le32() by lower_32_bits() +Git-commit: 91356fed6afd1c83bf0d3df1fc336d54e38f0458 +Patch-mainline: v5.13-rc1 +References: git-fixes + +Either way ~0 will be in the correct byte order, hence +replace cpu_to_le32() by lower_32_bits(). Moreover, +it makes sparse happy, otherwise it complains: + +.../pch_udc.c:1813:27: warning: incorrect type in assignment (different base types) +.../pch_udc.c:1813:27: expected unsigned int [usertype] dataptr +.../pch_udc.c:1813:27: got restricted __le32 [usertype] + +Fixes: f646cf94520e ("USB device driver of Topcliff PCH") +Signed-off-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20210323153626.54908-1-andriy.shevchenko@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/gadget/udc/pch_udc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c +index a3c1fc924268..c517186384bc 100644 +--- a/drivers/usb/gadget/udc/pch_udc.c ++++ b/drivers/usb/gadget/udc/pch_udc.c +@@ -1756,7 +1756,7 @@ static struct usb_request *pch_udc_alloc_request(struct usb_ep *usbep, + } + /* prevent from using desc. - set HOST BUSY */ + dma_desc->status |= PCH_UDC_BS_HST_BSY; +- dma_desc->dataptr = cpu_to_le32(DMA_ADDR_INVALID); ++ dma_desc->dataptr = lower_32_bits(DMA_ADDR_INVALID); + req->td_data = dma_desc; + req->td_data_last = dma_desc; + req->chain_len = 1; +-- +2.26.2 + diff --git a/patches.suse/usb-gadget-pch_udc-Revert-d3cb25a12138-completely.patch b/patches.suse/usb-gadget-pch_udc-Revert-d3cb25a12138-completely.patch new file mode 100644 index 0000000..b5409be --- /dev/null +++ b/patches.suse/usb-gadget-pch_udc-Revert-d3cb25a12138-completely.patch @@ -0,0 +1,89 @@ +From 50a318cc9b54a36f00beadf77e578a50f3620477 Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Tue, 23 Mar 2021 17:36:24 +0200 +Subject: [PATCH] usb: gadget: pch_udc: Revert d3cb25a12138 completely +Git-commit: 50a318cc9b54a36f00beadf77e578a50f3620477 +Patch-mainline: v5.13-rc1 +References: git-fixes + +The commit d3cb25a12138 ("usb: gadget: udc: fix spin_lock in pch_udc") +obviously was not thought through and had made the situation even worse +than it was before. Two changes after almost reverted it. but a few +leftovers have been left as it. With this revert d3cb25a12138 completely. + +While at it, narrow down the scope of unlocked section to prevent +potential race when prot_stall is assigned. + +Fixes: d3cb25a12138 ("usb: gadget: udc: fix spin_lock in pch_udc") +Fixes: 9903b6bedd38 ("usb: gadget: pch-udc: fix lock") +Fixes: 1d23d16a88e6 ("usb: gadget: pch_udc: reorder spin_[un]lock to avoid deadlock") +Cc: Iago Abal +Signed-off-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20210323153626.54908-5-andriy.shevchenko@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/gadget/udc/pch_udc.c | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c +index a5365b524617..58cea8d3d68f 100644 +--- a/drivers/usb/gadget/udc/pch_udc.c ++++ b/drivers/usb/gadget/udc/pch_udc.c +@@ -597,18 +597,22 @@ static void pch_udc_reconnect(struct pch_udc_dev *dev) + static inline void pch_udc_vbus_session(struct pch_udc_dev *dev, + int is_active) + { ++ unsigned long iflags; ++ ++ spin_lock_irqsave(&dev->lock, iflags); + if (is_active) { + pch_udc_reconnect(dev); + dev->vbus_session = 1; + } else { + if (dev->driver && dev->driver->disconnect) { +- spin_lock(&dev->lock); ++ spin_unlock_irqrestore(&dev->lock, iflags); + dev->driver->disconnect(&dev->gadget); +- spin_unlock(&dev->lock); ++ spin_lock_irqsave(&dev->lock, iflags); + } + pch_udc_set_disconnect(dev); + dev->vbus_session = 0; + } ++ spin_unlock_irqrestore(&dev->lock, iflags); + } + + /** +@@ -1167,20 +1171,25 @@ static int pch_udc_pcd_selfpowered(struct usb_gadget *gadget, int value) + static int pch_udc_pcd_pullup(struct usb_gadget *gadget, int is_on) + { + struct pch_udc_dev *dev; ++ unsigned long iflags; + + if (!gadget) + return -EINVAL; ++ + dev = container_of(gadget, struct pch_udc_dev, gadget); ++ ++ spin_lock_irqsave(&dev->lock, iflags); + if (is_on) { + pch_udc_reconnect(dev); + } else { + if (dev->driver && dev->driver->disconnect) { +- spin_lock(&dev->lock); ++ spin_unlock_irqrestore(&dev->lock, iflags); + dev->driver->disconnect(&dev->gadget); +- spin_unlock(&dev->lock); ++ spin_lock_irqsave(&dev->lock, iflags); + } + pch_udc_set_disconnect(dev); + } ++ spin_unlock_irqrestore(&dev->lock, iflags); + + return 0; + } +-- +2.26.2 + diff --git a/patches.suse/usb-gadget-r8a66597-Add-missing-null-check-on-return.patch b/patches.suse/usb-gadget-r8a66597-Add-missing-null-check-on-return.patch new file mode 100644 index 0000000..fd2bedf --- /dev/null +++ b/patches.suse/usb-gadget-r8a66597-Add-missing-null-check-on-return.patch @@ -0,0 +1,38 @@ +From 9c2076090c2815fe7c49676df68dde7e60a9b9fc Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Tue, 6 Apr 2021 19:45:10 +0100 +Subject: [PATCH] usb: gadget: r8a66597: Add missing null check on return from platform_get_resource +Git-commit: 9c2076090c2815fe7c49676df68dde7e60a9b9fc +Patch-mainline: v5.13-rc1 +References: git-fixes + +The call to platform_get_resource can potentially return a NULL pointer +on failure, so add this check and return -EINVAL if it fails. + +Fixes: c41442474a26 ("usb: gadget: R8A66597 peripheral controller support.") +Signed-off-by: Colin Ian King +Addresses-coverity: ("Dereference null return") +Link: https://lore.kernel.org/r/20210406184510.433497-1-colin.king@canonical.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/gadget/udc/r8a66597-udc.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c +index 896c1a016d55..65cae4883454 100644 +--- a/drivers/usb/gadget/udc/r8a66597-udc.c ++++ b/drivers/usb/gadget/udc/r8a66597-udc.c +@@ -1849,6 +1849,8 @@ static int r8a66597_probe(struct platform_device *pdev) + return PTR_ERR(reg); + + ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); ++ if (!ires) ++ return -EINVAL; + irq = ires->start; + irq_trigger = ires->flags & IRQF_TRIGGER_MASK; + +-- +2.26.2 + diff --git a/patches.suse/usb-typec-tcpci-Check-ROLE_CONTROL-while-interpretin.patch b/patches.suse/usb-typec-tcpci-Check-ROLE_CONTROL-while-interpretin.patch new file mode 100644 index 0000000..342886a --- /dev/null +++ b/patches.suse/usb-typec-tcpci-Check-ROLE_CONTROL-while-interpretin.patch @@ -0,0 +1,91 @@ +From 19c234a14eafca78e0bc14ffb8be3891096ce147 Mon Sep 17 00:00:00 2001 +From: Badhri Jagan Sridharan +Date: Wed, 3 Mar 2021 23:09:31 -0800 +Subject: [PATCH] usb: typec: tcpci: Check ROLE_CONTROL while interpreting CC_STATUS +Git-commit: 19c234a14eafca78e0bc14ffb8be3891096ce147 +Patch-mainline: v5.13-rc1 +References: git-fixes + +While interpreting CC_STATUS, ROLE_CONTROL has to be read to make +sure that CC1/CC2 is not forced presenting Rp/Rd. + +>From the TCPCI spec: + +4.4.5.2 ROLE_CONTROL (Normative): +The TCPM shall write B6 (DRP) = 0b and B3..0 (CC1/CC2) if it wishes +to control the Rp/Rd directly instead of having the TCPC perform +DRP toggling autonomously. When controlling Rp/Rd directly, the +TCPM writes to B3..0 (CC1/CC2) each time it wishes to change the +CC1/CC2 values. This control is used for TCPM-TCPC implementing +Source or Sink only as well as when a connection has been detected +via DRP toggling but the TCPM wishes to attempt Try.Src or Try.Snk. + +Table 4-22. CC_STATUS Register Definition: +If (ROLE_CONTROL.CC1 = Rd) or ConnectResult=1) +00b: SNK.Open (Below maximum vRa) +01b: SNK.Default (Above minimum vRd-Connect) +10b: SNK.Power1.5 (Above minimum vRd-Connect) Detects Rp-1.5A +11b: SNK.Power3.0 (Above minimum vRd-Connect) Detects Rp-3.0A + +If (ROLE_CONTROL.CC2=Rd) or (ConnectResult=1) +10b: SNK.Power1.5 (Above minimum vRd-Connect) Detects Rp 1.5A +11b: SNK.Power3.0 (Above minimum vRd-Connect) Detects Rp 3.0A + +Fixes: 74e656d6b0551 ("staging: typec: Type-C Port Controller Interface driver (tcpci)") +Acked-by: Heikki Krogerus +Signed-off-by: Badhri Jagan Sridharan +Link: https://lore.kernel.org/r/20210304070931.1947316-1-badhri@google.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/typec/tcpm/tcpci.c | 21 ++++++++++++++++++--- + 1 file changed, 18 insertions(+), 3 deletions(-) + +--- a/drivers/usb/typec/tcpm/tcpci.c ++++ b/drivers/usb/typec/tcpm/tcpci.c +@@ -20,6 +20,15 @@ + + #define PD_RETRY_COUNT 3 + ++#define tcpc_presenting_cc1_rd(reg) \ ++ (!(TCPC_ROLE_CTRL_DRP & (reg)) && \ ++ (((reg) & (TCPC_ROLE_CTRL_CC1_MASK << TCPC_ROLE_CTRL_CC1_SHIFT)) == \ ++ (TCPC_ROLE_CTRL_CC_RD << TCPC_ROLE_CTRL_CC1_SHIFT))) ++#define tcpc_presenting_cc2_rd(reg) \ ++ (!(TCPC_ROLE_CTRL_DRP & (reg)) && \ ++ (((reg) & (TCPC_ROLE_CTRL_CC2_MASK << TCPC_ROLE_CTRL_CC2_SHIFT)) == \ ++ (TCPC_ROLE_CTRL_CC_RD << TCPC_ROLE_CTRL_CC2_SHIFT))) ++ + struct tcpci { + struct device *dev; + +@@ -168,19 +177,25 @@ static int tcpci_get_cc(struct tcpc_dev + enum typec_cc_status *cc1, enum typec_cc_status *cc2) + { + struct tcpci *tcpci = tcpc_to_tcpci(tcpc); +- unsigned int reg; ++ unsigned int reg, role_control; + int ret; + ++ ret = regmap_read(tcpci->regmap, TCPC_ROLE_CTRL, &role_control); ++ if (ret < 0) ++ return ret; ++ + ret = regmap_read(tcpci->regmap, TCPC_CC_STATUS, ®); + if (ret < 0) + return ret; + + *cc1 = tcpci_to_typec_cc((reg >> TCPC_CC_STATUS_CC1_SHIFT) & + TCPC_CC_STATUS_CC1_MASK, +- reg & TCPC_CC_STATUS_TERM); ++ reg & TCPC_CC_STATUS_TERM || ++ tcpc_presenting_cc1_rd(role_control)); + *cc2 = tcpci_to_typec_cc((reg >> TCPC_CC_STATUS_CC2_SHIFT) & + TCPC_CC_STATUS_CC2_MASK, +- reg & TCPC_CC_STATUS_TERM); ++ reg & TCPC_CC_STATUS_TERM || ++ tcpc_presenting_cc2_rd(role_control)); + + return 0; + } diff --git a/patches.suse/usb-typec-tcpm-Address-incorrect-values-of-tcpm-psy-.patch b/patches.suse/usb-typec-tcpm-Address-incorrect-values-of-tcpm-psy-.patch new file mode 100644 index 0000000..604c972 --- /dev/null +++ b/patches.suse/usb-typec-tcpm-Address-incorrect-values-of-tcpm-psy-.patch @@ -0,0 +1,77 @@ +From f3dedafb8263ca4791a92a23f5230068f5bde008 Mon Sep 17 00:00:00 2001 +From: Badhri Jagan Sridharan +Date: Wed, 7 Apr 2021 13:07:18 -0700 +Subject: [PATCH] usb: typec: tcpm: Address incorrect values of tcpm psy for fixed supply +Git-commit: f3dedafb8263ca4791a92a23f5230068f5bde008 +Patch-mainline: v5.13-rc1 +References: git-fixes + +tcpm_pd_build_request overwrites current_limit and supply_voltage +even before port partner accepts the requests. This leaves stale +values in current_limit and supply_voltage that get exported by +"tcpm-source-psy-". Solving this problem by caching the request +values of current limit/supply voltage in req_current_limit +and req_supply_voltage. current_limit/supply_voltage gets updated +once the port partner accepts the request. + +Fixes: f2a8aa053c176 ("typec: tcpm: Represent source supply through power_supply") +Signed-off-by: Badhri Jagan Sridharan +Cc: stable +Reviewed-by: Guenter Roeck +Reviewed-by: Adam Thomson +Reviewed-by: Heikki Krogerus +Link: https://lore.kernel.org/r/20210407200723.1914388-1-badhri@google.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/typec/tcpm/tcpm.c | 17 ++++++++++------- + 1 file changed, 10 insertions(+), 7 deletions(-) + +--- a/drivers/usb/typec/tcpm/tcpm.c ++++ b/drivers/usb/typec/tcpm/tcpm.c +@@ -284,7 +284,10 @@ struct tcpm_port { + unsigned int operating_snk_mw; + bool update_sink_caps; + +- /* Requested current / voltage */ ++ /* Requested current / voltage to the port partner */ ++ u32 req_current_limit; ++ u32 req_supply_voltage; ++ /* Actual current / voltage limit of the local port */ + u32 current_limit; + u32 supply_voltage; + +@@ -1731,8 +1734,8 @@ static void tcpm_pd_ctrl_request(struct + case SNK_TRANSITION_SINK: + if (port->vbus_present) { + tcpm_set_current_limit(port, +- port->current_limit, +- port->supply_voltage); ++ port->req_current_limit, ++ port->req_supply_voltage); + port->explicit_contract = true; + tcpm_set_state(port, SNK_READY, 0); + } else { +@@ -1804,8 +1807,8 @@ static void tcpm_pd_ctrl_request(struct + break; + case SNK_NEGOTIATE_PPS_CAPABILITIES: + port->pps_data.active = true; +- port->supply_voltage = port->pps_data.out_volt; +- port->current_limit = port->pps_data.op_curr; ++ port->req_supply_voltage = port->pps_data.out_volt; ++ port->req_current_limit = port->pps_data.op_curr; + tcpm_set_state(port, SNK_TRANSITION_SINK, 0); + break; + case SOFT_RESET_SEND: +@@ -2409,8 +2412,8 @@ static int tcpm_pd_build_request(struct + flags & RDO_CAP_MISMATCH ? " [mismatch]" : ""); + } + +- port->current_limit = ma; +- port->supply_voltage = mv; ++ port->req_current_limit = ma; ++ port->req_supply_voltage = mv; + + return 0; + } diff --git a/patches.suse/usb-typec-tcpm-Honour-pSnkStdby-requirement-during-n.patch b/patches.suse/usb-typec-tcpm-Honour-pSnkStdby-requirement-during-n.patch new file mode 100644 index 0000000..65b5fde --- /dev/null +++ b/patches.suse/usb-typec-tcpm-Honour-pSnkStdby-requirement-during-n.patch @@ -0,0 +1,158 @@ +From 123086843372bc93d26f52edfb71dbf951cd2f17 Mon Sep 17 00:00:00 2001 +From: Badhri Jagan Sridharan +Date: Tue, 13 Apr 2021 19:39:58 -0700 +Subject: [PATCH] usb: typec: tcpm: Honour pSnkStdby requirement during negotiation +Git-commit: 123086843372bc93d26f52edfb71dbf951cd2f17 +Patch-mainline: v5.13-rc1 +References: git-fixes + +>From PD Spec: +The Sink Shall transition to Sink Standby before a positive or +negative voltage transition of VBUS. During Sink Standby +the Sink Shall reduce its power draw to pSnkStdby. This allows +the Source to manage the voltage transition as well as +supply sufficient operating current to the Sink to maintain PD +operation during the transition. The Sink Shall +complete this transition to Sink Standby within tSnkStdby +after evaluating the Accept Message from the Source. The +transition when returning to Sink operation from Sink Standby +Shall be completed within tSnkNewPower. The +pSnkStdby requirement Shall only apply if the Sink power draw +is higher than this level. + +The above requirement needs to be met to prevent hard resets +from port partner. + +Without the patch: (5V/3A during SNK_DISCOVERY all the way through +explicit contract) +[ 95.711984] CC1: 0 -> 0, CC2: 0 -> 5 [state TOGGLING, polarity 0, connected] +[ 95.712007] state change TOGGLING -> SNK_ATTACH_WAIT [rev3 NONE_AMS] +[ 95.712017] pending state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED @ 170 ms [rev3 NONE_AMS] +[ 95.837190] VBUS on +[ 95.882075] state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED [delayed 170 ms] +[ 95.882082] state change SNK_DEBOUNCED -> SNK_ATTACHED [rev3 NONE_AMS] +[ 95.882086] polarity 1 +[ 95.883151] set_auto_vbus_discharge_threshold mode:0 pps_active:n vbus:5000 ret:0 +[ 95.883441] enable vbus discharge ret:0 +[ 95.883445] Requesting mux state 1, usb-role 2, orientation 2 +[ 95.883776] state change SNK_ATTACHED -> SNK_STARTUP [rev3 NONE_AMS] +[ 95.883879] pending state change SNK_STARTUP -> SNK_DISCOVERY @ 500 ms [rev3 NONE_AMS] +[ 96.038960] VBUS on +[ 96.383939] state change SNK_STARTUP -> SNK_DISCOVERY [delayed 500 ms] +[ 96.383946] Setting voltage/current limit 5000 mV 3000 mA +[ 96.383961] vbus=0 charge:=1 +[ 96.386044] state change SNK_DISCOVERY -> SNK_WAIT_CAPABILITIES [rev3 NONE_AMS] +[ 96.386309] pending state change SNK_WAIT_CAPABILITIES -> HARD_RESET_SEND @ 450 ms [rev3 NONE_AMS] +[ 96.394404] PD RX, header: 0x2161 [1] +[ 96.394408] PDO 0: type 0, 5000 mV, 3000 mA [E] +[ 96.394410] PDO 1: type 0, 9000 mV, 2000 mA [] +[ 96.394412] state change SNK_WAIT_CAPABILITIES -> SNK_NEGOTIATE_CAPABILITIES [rev2 POWER_NEGOTIATION] +[ 96.394416] Setting usb_comm capable false +[ 96.395083] cc=0 cc1=0 cc2=5 vbus=0 vconn=sink polarity=1 +[ 96.395089] Requesting PDO 1: 9000 mV, 2000 mA +[ 96.395093] PD TX, header: 0x1042 +[ 96.397404] PD TX complete, status: 0 +[ 96.397424] pending state change SNK_NEGOTIATE_CAPABILITIES -> HARD_RESET_SEND @ 60 ms [rev2 POWER_NEGOTIATION] +[ 96.400826] PD RX, header: 0x363 [1] +[ 96.400829] state change SNK_NEGOTIATE_CAPABILITIES -> SNK_TRANSITION_SINK [rev2 POWER_NEGOTIATION] +[ 96.400832] pending state change SNK_TRANSITION_SINK -> HARD_RESET_SEND @ 500 ms [rev2 POWER_NEGOTIATION] +[ 96.577315] PD RX, header: 0x566 [1] +[ 96.577321] Setting voltage/current limit 9000 mV 2000 mA +[ 96.578363] set_auto_vbus_discharge_threshold mode:3 pps_active:n vbus:9000 ret:0 +[ 96.578370] state change SNK_TRANSITION_SINK -> SNK_READY [rev2 POWER_NEGOTIATION] + +With the patch: +[ 168.398573] CC1: 0 -> 0, CC2: 0 -> 5 [state TOGGLING, polarity 0, connected] +[ 168.398605] state change TOGGLING -> SNK_ATTACH_WAIT [rev3 NONE_AMS] +[ 168.398619] pending state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED @ 170 ms [rev3 NONE_AMS] +[ 168.522348] VBUS on +[ 168.568676] state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED [delayed 170 ms] +[ 168.568684] state change SNK_DEBOUNCED -> SNK_ATTACHED [rev3 NONE_AMS] +[ 168.568688] polarity 1 +[ 168.569867] set_auto_vbus_discharge_threshold mode:0 pps_active:n vbus:5000 ret:0 +[ 168.570158] enable vbus discharge ret:0 +[ 168.570161] Requesting mux state 1, usb-role 2, orientation 2 +[ 168.570504] state change SNK_ATTACHED -> SNK_STARTUP [rev3 NONE_AMS] +[ 168.570634] pending state change SNK_STARTUP -> SNK_DISCOVERY @ 500 ms [rev3 NONE_AMS] +[ 169.070689] state change SNK_STARTUP -> SNK_DISCOVERY [delayed 500 ms] +[ 169.070695] Setting voltage/current limit 5000 mV 3000 mA +[ 169.070702] vbus=0 charge:=1 +[ 169.072719] state change SNK_DISCOVERY -> SNK_WAIT_CAPABILITIES [rev3 NONE_AMS] +[ 169.073145] pending state change SNK_WAIT_CAPABILITIES -> HARD_RESET_SEND @ 450 ms [rev3 NONE_AMS] +[ 169.077162] PD RX, header: 0x2161 [1] +[ 169.077172] PDO 0: type 0, 5000 mV, 3000 mA [E] +[ 169.077178] PDO 1: type 0, 9000 mV, 2000 mA [] +[ 169.077183] state change SNK_WAIT_CAPABILITIES -> SNK_NEGOTIATE_CAPABILITIES [rev2 POWER_NEGOTIATION] +[ 169.077191] Setting usb_comm capable false +[ 169.077753] cc=0 cc1=0 cc2=5 vbus=0 vconn=sink polarity=1 +[ 169.077759] Requesting PDO 1: 9000 mV, 2000 mA +[ 169.077762] PD TX, header: 0x1042 +[ 169.079990] PD TX complete, status: 0 +[ 169.080013] pending state change SNK_NEGOTIATE_CAPABILITIES -> HARD_RESET_SEND @ 60 ms [rev2 POWER_NEGOTIATION] +[ 169.083183] VBUS on +[ 169.084195] PD RX, header: 0x363 [1] +[ 169.084200] state change SNK_NEGOTIATE_CAPABILITIES -> SNK_TRANSITION_SINK [rev2 POWER_NEGOTIATION] +[ 169.084206] Setting standby current 5000 mV @ 500 mA +[ 169.084209] Setting voltage/current limit 5000 mV 500 mA +[ 169.084220] pending state change SNK_TRANSITION_SINK -> HARD_RESET_SEND @ 500 ms [rev2 POWER_NEGOTIATION] +[ 169.260222] PD RX, header: 0x566 [1] +[ 169.260227] Setting voltage/current limit 9000 mV 2000 mA +[ 169.261315] set_auto_vbus_discharge_threshold mode:3 pps_active:n vbus:9000 ret:0 +[ 169.261321] state change SNK_TRANSITION_SINK -> SNK_READY [rev2 POWER_NEGOTIATION] +[ 169.261570] AMS POWER_NEGOTIATION finished + +Fixes: f0690a25a140b ("staging: typec: USB Type-C Port Manager (tcpm)") +Reviewed-by: Guenter Roeck +Reviewed-by: Heikki Krogerus +Signed-off-by: Badhri Jagan Sridharan +Link: https://lore.kernel.org/r/20210414024000.4175263-1-badhri@google.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/typec/tcpm/tcpm.c | 17 +++++++++++++++++ + include/linux/usb/pd.h | 2 ++ + 2 files changed, 19 insertions(+) + +diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c +index 1c32bdf62852..aedc8bb9532a 100644 +--- a/drivers/usb/typec/tcpm/tcpm.c ++++ b/drivers/usb/typec/tcpm/tcpm.c +@@ -4131,6 +4131,23 @@ static void run_state_machine(struct tcpm_port *port) + } + break; + case SNK_TRANSITION_SINK: ++ /* From the USB PD spec: ++ * "The Sink Shall transition to Sink Standby before a positive or ++ * negative voltage transition of VBUS. During Sink Standby ++ * the Sink Shall reduce its power draw to pSnkStdby." ++ * ++ * This is not applicable to PPS though as the port can continue ++ * to draw negotiated power without switching to standby. ++ */ ++ if (port->supply_voltage != port->req_supply_voltage && !port->pps_data.active && ++ port->current_limit * port->supply_voltage / 1000 > PD_P_SNK_STDBY_MW) { ++ u32 stdby_ma = PD_P_SNK_STDBY_MW * 1000 / port->supply_voltage; ++ ++ tcpm_log(port, "Setting standby current %u mV @ %u mA", ++ port->supply_voltage, stdby_ma); ++ tcpm_set_current_limit(port, stdby_ma, port->supply_voltage); ++ } ++ fallthrough; + case SNK_TRANSITION_SINK_VBUS: + tcpm_set_state(port, hard_reset_state(port), + PD_T_PS_TRANSITION); +diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h +index 70d681918d01..bf00259493e0 100644 +--- a/include/linux/usb/pd.h ++++ b/include/linux/usb/pd.h +@@ -493,4 +493,6 @@ static inline unsigned int rdo_max_power(u32 rdo) + #define PD_N_CAPS_COUNT (PD_T_NO_RESPONSE / PD_T_SEND_SOURCE_CAP) + #define PD_N_HARD_RESET_COUNT 2 + ++#define PD_P_SNK_STDBY_MW 2500 /* 2500 mW */ ++ + #endif /* __LINUX_USB_PD_H */ +-- +2.26.2 + diff --git a/patches.suse/x86-crash-fix-crash_setup_memmap_entries-out-of-bounds-access.patch b/patches.suse/x86-crash-fix-crash_setup_memmap_entries-out-of-bounds-access.patch new file mode 100644 index 0000000..d8f70e0 --- /dev/null +++ b/patches.suse/x86-crash-fix-crash_setup_memmap_entries-out-of-bounds-access.patch @@ -0,0 +1,61 @@ +From: Mike Galbraith +Date: Fri, 16 Apr 2021 14:02:07 +0200 +Subject: x86/crash: Fix crash_setup_memmap_entries() out-of-bounds access +Git-commit: 5849cdf8c120e3979c57d34be55b92d90a77a47e +Patch-mainline: v5.12 +References: bsc#1152489 + +Commit in Fixes: added support for kexec-ing a kernel on panic using a +new system call. As part of it, it does prepare a memory map for the new +kernel. + +However, while doing so, it wrongly accesses memory it has not +allocated: it accesses the first element of the cmem->ranges[] array in +memmap_exclude_ranges() but it has not allocated the memory for it in +crash_setup_memmap_entries(). As KASAN reports: + + BUG: KASAN: vmalloc-out-of-bounds in crash_setup_memmap_entries+0x17e/0x3a0 + Write of size 8 at addr ffffc90000426008 by task kexec/1187 + + (gdb) list *crash_setup_memmap_entries+0x17e + 0xffffffff8107cafe is in crash_setup_memmap_entries (arch/x86/kernel/crash.c:322). + 317 unsigned long long mend) + 318 { + 319 unsigned long start, end; + 320 + 321 cmem->ranges[0].start = mstart; + 322 cmem->ranges[0].end = mend; + 323 cmem->nr_ranges = 1; + 324 + 325 /* Exclude elf header region */ + 326 start = image->arch.elf_load_addr; + (gdb) + +Make sure the ranges array becomes a single element allocated. + + [ bp: Write a proper commit message. ] + +Fixes: dd5f726076cc ("kexec: support for kexec on panic using new system call") +Signed-off-by: Mike Galbraith +Signed-off-by: Borislav Petkov +Reviewed-by: Dave Young +Cc: +Link: https://lkml.kernel.org/r/725fa3dc1da2737f0f6188a1a9701bead257ea9d.camel@gmx.de +--- + arch/x86/kernel/crash.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c +index a8f3af257e26..b1deacbeb266 100644 +--- a/arch/x86/kernel/crash.c ++++ b/arch/x86/kernel/crash.c +@@ -337,7 +337,7 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params) + struct crash_memmap_data cmd; + struct crash_mem *cmem; + +- cmem = vzalloc(sizeof(struct crash_mem)); ++ cmem = vzalloc(struct_size(cmem, ranges, 1)); + if (!cmem) + return -ENOMEM; + + diff --git a/patches.suse/x86-microcode-check-for-offline-cpus-before-requesting-new-microcode.patch b/patches.suse/x86-microcode-check-for-offline-cpus-before-requesting-new-microcode.patch new file mode 100644 index 0000000..fe0b85b --- /dev/null +++ b/patches.suse/x86-microcode-check-for-offline-cpus-before-requesting-new-microcode.patch @@ -0,0 +1,85 @@ +From: Otavio Pontes +Date: Fri, 19 Mar 2021 09:55:15 -0700 +Subject: x86/microcode: Check for offline CPUs before requesting new microcode +Git-commit: 7189b3c11903667808029ec9766a6e96de5012a5 +Patch-mainline: v5.13-rc1 +References: bsc#1152489 + +Currently, the late microcode loading mechanism checks whether any CPUs +are offlined, and, in such a case, aborts the load attempt. + +However, this must be done before the kernel caches new microcode from +the filesystem. Otherwise, when offlined CPUs are onlined later, those +cores are going to be updated through the CPU hotplug notifier callback +with the new microcode, while CPUs previously onine will continue to run +with the older microcode. + +For example: + +Turn off one core (2 threads): + + echo 0 > /sys/devices/system/cpu/cpu3/online + echo 0 > /sys/devices/system/cpu/cpu1/online + +Install the ucode fails because a primary SMT thread is offline: + + cp intel-ucode/06-8e-09 /lib/firmware/intel-ucode/ + echo 1 > /sys/devices/system/cpu/microcode/reload + bash: echo: write error: Invalid argument + +Turn the core back on + + echo 1 > /sys/devices/system/cpu/cpu3/online + echo 1 > /sys/devices/system/cpu/cpu1/online + cat /proc/cpuinfo |grep microcode + microcode : 0x30 + microcode : 0xde + microcode : 0x30 + microcode : 0xde + +The rationale for why the update is aborted when at least one primary +thread is offline is because even if that thread is soft-offlined +and idle, it will still have to participate in broadcasted MCE's +synchronization dance or enter SMM, and in both examples it will execute +instructions so it better have the same microcode revision as the other +cores. + + [ bp: Heavily edit and extend commit message with the reasoning behind all + this. ] + +Fixes: 30ec26da9967 ("x86/microcode: Do not upload microcode if CPUs are offline") +Signed-off-by: Otavio Pontes +Signed-off-by: Borislav Petkov +Reviewed-by: Tony Luck +Acked-by: Ashok Raj +Link: https://lkml.kernel.org/r/20210319165515.9240-2-otavio.pontes@intel.com +--- + arch/x86/kernel/cpu/microcode/core.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c +index b935e1b5f115..6a6318e9590c 100644 +--- a/arch/x86/kernel/cpu/microcode/core.c ++++ b/arch/x86/kernel/cpu/microcode/core.c +@@ -629,16 +629,16 @@ static ssize_t reload_store(struct device *dev, + if (val != 1) + return size; + +- tmp_ret = microcode_ops->request_microcode_fw(bsp, µcode_pdev->dev, true); +- if (tmp_ret != UCODE_NEW) +- return size; +- + get_online_cpus(); + + ret = check_online_cpus(); + if (ret) + goto put; + ++ tmp_ret = microcode_ops->request_microcode_fw(bsp, µcode_pdev->dev, true); ++ if (tmp_ret != UCODE_NEW) ++ goto put; ++ + mutex_lock(µcode_mutex); + ret = microcode_reload_late(); + mutex_unlock(µcode_mutex); + diff --git a/patches.suse/x86-platform-uv-set-section-block-size-for-hubless-architectures.patch b/patches.suse/x86-platform-uv-set-section-block-size-for-hubless-architectures.patch new file mode 100644 index 0000000..d2e0e2d --- /dev/null +++ b/patches.suse/x86-platform-uv-set-section-block-size-for-hubless-architectures.patch @@ -0,0 +1,44 @@ +From: Mike Travis +Date: Fri, 5 Mar 2021 10:28:53 -0600 +Subject: x86/platform/uv: Set section block size for hubless architectures +Git-commit: 6840a150b9daf35e4d21ab9780d0a03b4ed74a5b +Patch-mainline: v5.13-rc1 +References: bsc#1152489 + +Commit + + bbbd2b51a2aa ("x86/platform/UV: Use new set memory block size function") + +added a call to set the block size value that is needed by the kernel +to set the boundaries in the section list. This was done for UV Hubbed +systems but missed in the UV Hubless setup. Fix that mistake by adding +that same set call for hubless systems, which support the same NVRAMs +and Intel BIOS, thus the same problem occurs. + + [ bp: Massage commit message. ] + +Fixes: bbbd2b51a2aa ("x86/platform/UV: Use new set memory block size function") +Signed-off-by: Mike Travis +Signed-off-by: Borislav Petkov +Reviewed-by: Steve Wahl +Reviewed-by: Russ Anderson +Link: https://lkml.kernel.org/r/20210305162853.299892-1-mike.travis@hpe.com +--- + arch/x86/kernel/apic/x2apic_uv_x.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c +index 52bc217ca8c3..c9ddd233e32f 100644 +--- a/arch/x86/kernel/apic/x2apic_uv_x.c ++++ b/arch/x86/kernel/apic/x2apic_uv_x.c +@@ -1671,6 +1671,9 @@ static __init int uv_system_init_hubless(void) + if (rc < 0) + return rc; + ++ /* Set section block size for current node memory */ ++ set_block_size(); ++ + /* Create user access node */ + if (rc >= 0) + uv_setup_proc_files(1); + diff --git a/rpm/constraints.in b/rpm/constraints.in index e5cb0f0..032785d 100644 --- a/rpm/constraints.in +++ b/rpm/constraints.in @@ -124,6 +124,19 @@ + + + + riscv64 +@BINARY_PACKAGES_XML@ + + + + 45 + + + + i586 diff --git a/series.conf b/series.conf index d455134..6451632 100644 --- a/series.conf +++ b/series.conf @@ -85,13 +85,28 @@ patches.suse/regulator-da9211-fix-obtaining-enable-GPIO.patch patches.suse/spi-bcm-qspi-Fix-BSPI-QUAD-and-DUAL-mode-support-whe.patch patches.suse/spi-dw-pci-Add-support-for-Intel-Elkhart-Lake-PSE-SP.patch - patches.suse/spi-spi-fsl-dspi-Exit-the-ISR-with-IRQ_NONE-when-it-.patch patches.suse/spi-dw-pci-Add-MODULE_DEVICE_TABLE.patch patches.suse/spi-bcm2835-Work-around-DONE-bit-erratum.patch patches.suse/spi-dw-mmio-Clock-should-be-shut-when-error-occurs.patch - patches.suse/spi-spi-fsl-dspi-change-usage-pattern-of-spi_mcr_-and-spi_ctar_-macros.patch + patches.suse/spi-spi-fsl-dspi-Fix-code-alignment.patch + patches.suse/spi-spi-fsl-dspi-Remove-unused-defines-and-includes.patch + patches.suse/spi-spi-fsl-dspi-Use-BIT-and-GENMASK-macros.patch + patches.suse/spi-spi-fsl-dspi-Demistify-magic-value-in-SPI_SR_CLE.patch + patches.suse/spi-spi-fsl-dspi-Change-usage-pattern-of-SPI_MCR_-an.patch + patches.suse/spi-spi-fsl-dspi-Reduce-indentation-in-dspi_release_.patch + patches.suse/spi-spi-fsl-dspi-Remove-unused-initialization-of-ret.patch + patches.suse/spi-spi-fsl-dspi-Remove-pointless-assignment-of-mast.patch + patches.suse/spi-spi-fsl-dspi-Replace-legacy-spi_master-names-wit.patch + patches.suse/spi-spi-fsl-dspi-Use-reverse-Christmas-tree-declarat.patch + patches.suse/spi-spi-fsl-dspi-Fix-typos.patch + patches.suse/spi-spi-fsl-dspi-Move-dspi_interrupt-above-dspi_tran.patch patches.suse/spi-fsl-qspi-Enhance-binding-to-extend-example-for-f.patch + patches.suse/spi-spi-fsl-dspi-Reduce-indentation-level-in-dspi_in.patch + patches.suse/spi-spi-fsl-dspi-Exit-the-ISR-with-IRQ_NONE-when-it-.patch + patches.suse/spi-spi-fsl-dspi-Remove-impossible-to-reach-error-ch.patch + patches.suse/spi-spi-fsl-dspi-Use-poll-mode-in-case-the-platform-.patch patches.suse/spi-ep93xx-Repair-SPI-CS-lookup-tables.patch + patches.suse/spi-spi-fsl-dspi-Fix-race-condition-in-TCFQ-EOQ-inte.patch patches.suse/gpio-mpc8xxx-Add-ls1028a-device-specify-function.patch patches.suse/gpio-madera-Add-support-for-Cirrus-Logic-CS47L15.patch patches.suse/gpio-madera-Add-support-for-Cirrus-Logic-CS47L92.patch @@ -3189,7 +3204,6 @@ patches.suse/scsi-qla2xxx-Make-qlt_handle_abts_completion-more-ro.patch patches.suse/scsi-qla2xxx-Modify-NVMe-include-directives.patch patches.suse/scsi-qla2xxx-Introduce-qla2xxx_get_next_handle.patch - patches.suse/scsi-qla2xxx-Make-sure-that-aborted-commands-are-fre.patch patches.suse/scsi-qla2xxx-Complain-if-sp-done-is-not-called-from-.patch patches.suse/scsi-qla2xxx-Let-the-compiler-check-the-type-of-the-.patch patches.suse/scsi-qla2xxx-Remove-superfluous-sts_entry_-casts.patch @@ -3332,6 +3346,7 @@ patches.suse/mtd-spi-nor-Fix-an-error-code-in-spi_nor_read_raw.patch patches.suse/mtd-spi-nor-fix-a-memory-leak-bug.patch patches.suse/mtd-spi-nor-Add-support-for-mt35xu02g.patch + patches.suse/mtd-spi-nor-Rename-n25q512a-to-mt25qu512a-n25q512a.patch patches.suse/mtd-cfi_cmdset_0002-Use-chip_good-to-retry-in-do_wri.patch patches.suse/ubifs-Fix-memory-leak-in-read_znode-error-path.patch patches.suse/ubifs-Fix-memory-leak-in-__ubifs_node_verify_hmac-er.patch @@ -6622,8 +6637,10 @@ patches.suse/spi-pxa2xx-Add-support-for-Intel-Comet-Lake-H.patch patches.suse/spi-sifive-disable-clk-when-probe-fails-and-remove.patch patches.suse/spi-dw-Fix-Designware-SPI-loopback.patch + patches.suse/spi-Introduce-dspi_slave_abort-function-for-NXP-s-ds.patch patches.suse/spi-spi-fsl-qspi-Introduce-variable-to-fix-different.patch patches.suse/SPI-designware-pci-Switch-over-to-MSI-interrupts.patch + patches.suse/spi-spi-fsl-dspi-Always-use-the-TCFQ-devices-in-poll.patch patches.suse/spi-atmel-Fix-CS-high-support.patch patches.suse/spi-dw-pci-Add-runtime-power-management-support.patch patches.suse/spi-dw-pci-Fix-Chip-Select-amount-on-Intel-Elkhart-L.patch @@ -7917,6 +7934,9 @@ patches.suse/apparmor-reduce-rcu_read_lock-scope-for-aa_file_perm-mediation.patch patches.suse/apparmor-make-it-so-work-buffers-can-be-allocated-from-atomic-context.patch patches.suse/rtc-pcf2127-handle-boot-enabled-watchdog-feature.patch + patches.suse/rtc-fsl-ftm-alarm-switch-to-ktime_get_real_seconds.patch + patches.suse/rtc-fsl-ftm-alarm-switch-to-rtc_time64_to_tm-rtc_tm_.patch + patches.suse/rtc-fsl-ftm-alarm-avoid-struct-rtc_time-conversions.patch patches.suse/rtc-disable-uie-before-setting-time-and-enable-after.patch patches.suse/rtc-brcmstb-waketimer-add-missed-clk_disable_unprepa.patch patches.suse/rtc-bd70528-Add-MODULE-ALIAS-to-autoload-module.patch @@ -9211,6 +9231,7 @@ patches.suse/regmap-fix-writes-to-non-incrementing-registers.patch patches.suse/spi-dw-use-smp_mb-to-avoid-sending-spi-data-error.patch patches.suse/spi-spi-fsl-qspi-Ensure-width-is-respected-in-spi-me.patch + patches.suse/spi-spi-fsl-dspi-Use-dma_request_chan-instead-dma_re.patch patches.suse/spi-fsl-lpspi-fix-only-one-cs-gpio-working.patch patches.suse/regulator-vctrl-regulator-Avoid-deadlock-getting-and.patch patches.suse/regulator-core-Fix-exported-symbols-to-the-exported-.patch @@ -10102,6 +10123,7 @@ patches.suse/ubifs-Fix-deadlock-in-concurrent-bulk-read-and-write.patch patches.suse/ubifs-Fix-ino_t-format-warnings-in-orphan_delete.patch patches.suse/ubifs-Fix-memory-leak-from-c-sup_node.patch + patches.suse/mtd-spi-nor-Split-mt25qu512a-n25q512a-entry-into-two.patch patches.suse/mtd-onenand_base-Adjust-indentation-in-onenand_read_.patch patches.suse/mtd-sharpslpart-Fix-unsigned-comparison-to-zero.patch patches.suse/kvm-nvmx-vmwrite-checks-vmcs-link-pointer-before-vmcs-field @@ -11555,9 +11577,34 @@ patches.suse/staging-rtl8188eu-Add-ASUS-USB-N10-Nano-B1-to-device.patch patches.suse/staging-wlan-ng-fix-ODEBUG-bug-in-prism2sta_disconne.patch patches.suse/staging-wlan-ng-fix-use-after-free-Read-in-hfa384x_u.patch + patches.suse/spi-spi-fsl-dspi-Use-specific-compatible-strings-for.patch + patches.suse/spi-spi-fsl-dspi-Parameterize-the-FIFO-size-and-DMA-.patch + patches.suse/spi-spi-fsl-dspi-LS2080A-and-LX2160A-support-XSPI-mo.patch + patches.suse/spi-spi-fsl-dspi-Convert-the-instantiations-that-sup.patch + patches.suse/spi-spi-fsl-dspi-Make-bus-num-property-optional.patch + patches.suse/spi-spi-fsl-dspi-Simplify-bytes_per_word-gymnastics.patch + patches.suse/spi-spi-fsl-dspi-Remove-unused-chip-void_write_data.patch + patches.suse/spi-spi-fsl-dspi-Don-t-mask-off-undefined-bits.patch + patches.suse/spi-spi-fsl-dspi-Add-comments-around-dspi_pop_tx-and.patch + patches.suse/spi-spi-fsl-dspi-Rename-fifo_-read-write-and-tx-cmd-.patch + patches.suse/spi-spi-fsl-dspi-Implement-.max_message_size-method-.patch + patches.suse/spi-spi-fsl-dspi-Convert-TCFQ-users-to-XSPI-FIFO-mod.patch + patches.suse/spi-spi-fsl-dspi-Accelerate-transfers-using-larger-w.patch + patches.suse/spi-spi-fsl-dspi-Optimize-dspi_setup_accel-for-lowes.patch + patches.suse/spi-spi-fsl-dspi-Use-EOQ-for-last-word-in-buffer-eve.patch + patches.suse/spi-spi-fsl-dspi-Take-software-timestamp-in-dspi_fif.patch + patches.suse/spi-spi-fsl-dspi-fix-DMA-mapping.patch patches.suse/spi-dt-bindings-spi-controller-Fix-address-cells-for.patch - patches.suse/spi-spi-fsl-dspi-don-t-access-reserved-fields-in-spi_mcr.patch - patches.suse/spi-spi-fsl-dspi-replace-interruptible-wait-queue-with-a-simple-completion.patch + patches.suse/spi-spi-fsl-dspi-Don-t-access-reserved-fields-in-SPI.patch + patches.suse/spi-spi-fsl-dspi-Fix-little-endian-access-to-PUSHR-C.patch + patches.suse/spi-spi-fsl-dspi-Fix-bits-per-word-acceleration-in-D.patch + patches.suse/spi-spi-fsl-dspi-Avoid-reading-more-data-than-writte.patch + patches.suse/spi-spi-fsl-dspi-Protect-against-races-on-dspi-words.patch + patches.suse/spi-spi-fsl-dspi-Replace-interruptible-wait-queue-wi.patch + patches.suse/spi-spi-fsl-dspi-Avoid-NULL-pointer-in-dspi_slave_ab.patch + patches.suse/spi-spi-fsl-dspi-Fix-interrupt-less-DMA-mode-taking-.patch + patches.suse/spi-spi-fsl-dspi-Move-invariant-configs-out-of-dspi_.patch + patches.suse/spi-spi-fsl-dspi-Add-support-for-LS1028A.patch patches.suse/cpufreq-imx6q-Fixes-unwanted-cpu-overclocking-on-i.M.patch patches.suse/cpufreq-imx6q-fix-error-handling.patch patches.suse/PM-sleep-wakeup-Skip-wakeup_source_sysfs_remove-if-d.patch @@ -11776,6 +11823,7 @@ patches.suse/selinux-sel_avc_get_stat_idx-should-increase-positio.patch patches.suse/modpost-return-error-if-module-is-missing-ns-imports.patch patches.suse/mmc-sdhci-do-not-enable-card-detect-interrupt-for-gp.patch + patches.suse/mmc-cqhci-Add-cqhci_deactivate.patch patches.suse/mmc-sdhci-introduce-sdhci_set_power_and_bus_voltage.patch patches.suse/mmc-sdhci-iproc-add-custom-set_power-callback-for-bcm2711.patch patches.suse/serial-8250_tegra-Create-Tegra-specific-8250-driver.patch @@ -12251,6 +12299,7 @@ patches.suse/scsi-qla2xxx-Handle-NVME-status-iocb-correctly.patch patches.suse/scsi-qla2xxx-Set-Nport-ID-for-N2N.patch patches.suse/scsi-qla2xxx-Update-driver-version-to-10.01.00.25-k.patch + patches.suse/scsi_add_scsi_host_busy_iter.patch patches.suse/scsi-ibmvfc-Avoid-loss-of-all-paths-during-SVC-node-.patch patches.suse/ibmvfc-Fix-NULL-return-compiler-warning.patch patches.suse/scsi-qla2xxx-add-ring-buffer-for-tracing-debug-logs.patch @@ -12351,6 +12400,8 @@ patches.suse/rtc-sa1100-fix-possible-race-condition.patch patches.suse/rtc-ds1374-fix-possible-race-condition.patch patches.suse/rtc-88pm860x-fix-possible-race-condition.patch + patches.suse/rtc-fsl-ftm-alarm-enable-acpi-support.patch + patches.suse/rtc-fsl-ftm-alarm-report-alarm-to-core.patch patches.suse/rtc-imx-sc-Align-imx-sc-msg-structs-to-4.patch patches.suse/nfsd-Fix-NFSv4-READ-on-RDMA-when-using-readv.patch patches.suse/svcrdma-Fix-double-svc_rdma_send_ctxt_put-in-an-erro.patch @@ -13350,6 +13401,7 @@ patches.suse/spi-pxa2xx-Fix-controller-unregister-order.patch patches.suse/spi-pxa2xx-Fix-runtime-PM-ref-imbalance-on-probe-err.patch patches.suse/spi-spi-mem-Fix-Dual-Quad-modes-on-Octal-capable-dev.patch + patches.suse/spi-spi-fsl-dspi-Adding-shutdown-hook.patch patches.suse/spi-pxa2xx-Apply-CS-clk-quirk-to-BXT.patch patches.suse/spi-dw-Zero-DMA-Tx-and-Rx-configurations-on-stack.patch patches.suse/spi-dw-Fix-native-CS-being-unset.patch @@ -13358,6 +13410,7 @@ patches.suse/spi-dw-Add-SPI-Tx-done-wait-method-to-DMA-based-tran.patch patches.suse/spi-dw-Add-SPI-Rx-done-wait-method-to-DMA-based-tran.patch patches.suse/spi-dw-Fix-Rx-only-DMA-transfers.patch + patches.suse/spi-spi-fsl-dspi-fix-native-data-copy.patch patches.suse/crypto-algapi-Avoid-spurious-modprobe-on-LOADED.patch patches.suse/crypto-ccp-don-t-select-CONFIG_DMADEVICES.patch patches.suse/padata-add-separate-cpuhp-node-for-CPUHP_PADATA_DEAD.patch @@ -13407,6 +13460,7 @@ patches.suse/mmc-meson-mx-sdio-trigger-a-soft-reset-after-a-timeo.patch patches.suse/mmc-uniphier-sd-call-devm_request_irq-after-tmio_mmc.patch patches.suse/mmc-fix-compilation-of-user-API.patch + patches.suse/mmc-sdhci-of-dwcmshc-implement-specific-set_uhs_sign.patch patches.suse/mmc-tmio-Further-fixup-runtime-PM-management-at-remo.patch patches.suse/mmc-mmci_sdmmc-fix-DMA-API-warning-overlapping-mappi.patch patches.suse/mmc-sdhci-esdhc-imx-fix-the-mask-for-tuning-start-po.patch @@ -14035,6 +14089,7 @@ patches.suse/rtc-pcf2127-set-regmap-max_register.patch patches.suse/rtc-mc13xxx-fix-a-double-unlock-issue.patch patches.suse/rtc-rv3028-Add-missed-check-for-devm_regmap_init_i2c.patch + patches.suse/rtc-fsl-ftm-alarm-fix-freeze-s2idle-failed-to-wake.patch patches.suse/rtc-pcf2127-watchdog-handle-nowayout-feature.patch patches.suse/pinctrl-stmfx-stmfx_pinconf_set-doesn-t-require-to-g.patch patches.suse/pinctrl-rza1-Fix-wrong-array-assignment-of-rza1l_swi.patch @@ -14280,6 +14335,7 @@ patches.suse/regmap-Fix-memory-leak-from-regmap_register_patch.patch patches.suse/regualtor-pfuze100-correct-sw1a-sw2-on-pfuze3000.patch patches.suse/spi-sprd-switch-the-sequence-of-setting-WDG_LOAD_LOW.patch + patches.suse/spi-spi-fsl-dspi-Free-DMA-memory-with-matching-funct.patch patches.suse/spi-spidev-fix-a-race-between-spidev_release-and-spi.patch patches.suse/spi-spidev-fix-a-potential-use-after-free-in-spidev_.patch patches.suse/btrfs-fix-a-block-group-ref-counter-leak-after-failu.patch @@ -14457,6 +14513,10 @@ patches.suse/thermal-drivers-imx-Fix-missing-of_node_put-at-probe.patch patches.suse/thermal-drivers-mediatek-Fix-bank-number-settings-on.patch patches.suse/thermal-drivers-rcar_gen3-Fix-undefined-temperature-.patch + patches.suse/spi-spi-fsl-dspi-Fix-lockup-if-device-is-removed-dur.patch + patches.suse/spi-spi-fsl-dspi-Fix-lockup-if-device-is-shutdown-du.patch + patches.suse/spi-spi-fsl-dspi-Fix-external-abort-on-interrupt-in-.patch + patches.suse/spi-spi-fsl-dspi-Initialize-completion-before-possib.patch patches.suse/spi-pxa2xx-Add-support-for-Intel-Tiger-Lake-PCH-H.patch patches.suse/ima-extend-boot_aggregate-with-kernel-measurements.patch patches.suse/exfat-add-missing-brelse-calls-on-error-paths.patch @@ -15064,6 +15124,7 @@ patches.suse/usb-xhci-Fix-ASMedia-ASM1142-DMA-addressing.patch patches.suse/usb-mtu3-clear-dual-mode-of-u3port-when-disable-devi.patch patches.suse/gpio-max77620-Fix-missing-release-of-interrupt.patch + patches.suse/mmc-sdhci-of-arasan-Add-missed-checks-for-devm_clk_r.patch patches.suse/mmc-sdhci-cadence-do-not-use-hardware-tuning-for-SD-.patch patches.suse/mmc-sdhci-pci-o2micro-Bug-fix-for-O2-host-controller.patch patches.suse/leds-lm355x-avoid-enum-conversion-warning.patch @@ -15328,6 +15389,7 @@ patches.suse/scsi-qla2xxx-Address-a-set-of-sparse-warnings.patch patches.suse/scsi-lpfc-Correct-some-pretty-obvious-misdocumentati.patch patches.suse/scsi-lpfc-Add-dependency-on-CPU_FREQ.patch + patches.suse/scsi-core-Only-return-started-requests-from-scsi_hos.patch patches.suse/scsi-lpfc-Remove-unused-variable-pg_addr.patch patches.suse/scsi-lpfc-Fix-up-around-120-documentation-issues.patch patches.suse/scsi-lpfc-Provide-description-for-lpfc_mem_alloc-s-a.patch @@ -15813,6 +15875,7 @@ patches.suse/x86-hotplug-Silence-APIC-only-after-all-interrupts-a.patch patches.suse/genirq-matrix-Deal-with-the-sillyness-of-for_each_cp.patch patches.suse/mmc-sdhci-acpi-Fix-HS400-tuning-for-AMDI0040.patch + patches.suse/mmc-sdhci-pci-Fix-SDHCI_RESET_ALL-for-CQHCI-for-Inte.patch patches.suse/mmc-dt-bindings-Add-resets-reset-names-for-Mediatek-.patch patches.suse/mmc-mediatek-add-optional-module-reset-property.patch patches.suse/sdhci-tegra-Remove-SDHCI_QUIRK_DATA_TIMEOUT_USES_SDC.patch @@ -16135,6 +16198,7 @@ patches.suse/drm-sun4i-mixer-Extend-regmap-max_register.patch patches.suse/regulator-axp20x-fix-LDO2-4-description.patch patches.suse/spi-fsl-espi-Only-process-interrupts-for-expected-ev.patch + patches.suse/spi-fsl-dspi-fix-use-after-free-in-remove-path.patch patches.suse/0001-mm-THP-swap-fix-allocating-cluster-for-swapfile-by-m.patch patches.suse/s390-mm-gup-fix-gup_fast-with-dynamic-page-table-folding.patch patches.suse/arch-x86-lib-usercopy_64-c-fix-_copy_user_flushcache-cache-writeback.patch @@ -16219,6 +16283,7 @@ patches.suse/macsec-avoid-use-after-free-in-macsec_handle_frame.patch patches.suse/net-usb-qmi_wwan-add-Cellient-MPL200-card.patch patches.suse/mmc-core-don-t-set-limits.discard_granularity-as-0.patch + patches.suse/spi-fsl-dspi-fix-NULL-pointer-dereference.patch patches.suse/cifs-Fix-incomplete-memory-allocation-on-setxattr-path.patch patches.suse/i2c-meson-fix-clock-setting-overwrite.patch patches.suse/i2c-meson-fixup-rate-calculation-with-filter-delay.patch @@ -16334,7 +16399,10 @@ patches.suse/media-firewire-fix-memory-leak.patch patches.suse/media-usbtv-Fix-refcounting-mixup.patch patches.suse/regulator-resolve-supply-after-creating-regulator.patch + patches.suse/spi-spi-fsl-dspi-set-ColdFire-to-DMA-mode.patch + patches.suse/spi-spi-fsl-dspi-delete-EOQ-transfer-mode.patch patches.suse/spi-sprd-Release-DMA-channel-also-on-probe-deferral.patch + patches.suse/spi-spi-fsl-dspi-use-XSPI-mode-instead-of-DMA-for-DP.patch patches.suse/spi-dw-pci-free-previously-allocated-IRQs-if-desc-se.patch patches.suse/spi-omap2-mcspi-Improve-performance-waiting-for-CHST.patch patches.suse/spi-spi-s3c64xx-swap-s3c64xx_spi_set_cs-and-s3c64xx_.patch @@ -16772,6 +16840,7 @@ patches.suse/libceph-clear-con-out_msg-on-policy-stateful_server-faults.patch patches.suse/i2c-rcar-Auto-select-RESET_CONTROLLER.patch patches.suse/i2c-imx-Fix-external-abort-on-interrupt-in-exit-path.patch + patches.suse/rtc-fsl-ftm-alarm-update-acpi-device-id.patch patches.suse/rtc-rx8010-don-t-modify-the-global-rtc-ops.patch patches.suse/rtc-pcf2127-fix-a-bug-when-not-specify-interrupts-pr.patch patches.suse/drivers-watchdog-rdc321x_wdt-Fix-race-condition-bugs.patch @@ -16892,6 +16961,9 @@ patches.suse/drm-vc4-drv-Add-error-handding-for-bind.patch patches.suse/0032-drm-vc4-hdmi-Avoid-sleeping-in-atomic-context.patch patches.suse/drm-nouveau-nouveau-fix-the-start-end-range-for-migr.patch + patches.suse/mmc-sdhci-Use-Auto-CMD-Auto-Select-only-when-v4_mode.patch + patches.suse/mmc-sdhci-of-esdhc-set-timeout-to-max-before-tuning.patch + patches.suse/mmc-sdhci-of-esdhc-make-sure-delay-chain-locked-for-.patch patches.suse/ACPI-NFIT-Fix-comparison-to-ENXIO.patch patches.suse/ACPI-dock-fix-enum-conversion-warning.patch patches.suse/KVM-arm64-ARM_SMCCC_ARCH_WORKAROUND_1-doesn-t-return.patch @@ -16927,6 +16999,7 @@ patches.suse/tty-make-FONTX-ioctl-use-the-tty-pointer-they-were-a.patch patches.suse/PM-runtime-Drop-runtime-PM-references-to-supplier-on.patch patches.suse/regulator-defer-probe-when-trying-to-get-voltage-fro.patch + patches.suse/spi-fsl-dspi-fix-wrong-pointer-in-suspend-resume.patch patches.suse/IB-srpt-Fix-memory-leak-in-srpt_add_one.patch patches.suse/RDMA-srpt-Fix-typo-in-srpt_unregister_mad_agent-docs.patch patches.suse/msft-hv-2168-hv_balloon-disable-warning-when-floor-reached.patch @@ -17741,6 +17814,9 @@ patches.suse/scsi_dh_alua-set-transitioning-state-on-unit-attenti.patch patches.suse/scsi-core-Return-BLK_STS_AGAIN-for-ALUA-transitionin.patch patches.suse/scsi-core-Fix-VPD-LUN-ID-designator-priorities.patch + patches.suse/scsi-smartpqi-correct-driver-removal-with-hba-disks + patches.suse/scsi-smartpqi-correct-pqi_sas_smp_handler-busy-condition + patches.suse/scsi-smartpqi-update-version-to-1-2-16-012 patches.suse/scsi-lpfc-Rework-remote-port-ref-counting-and-node-f.patch patches.suse/scsi-lpfc-Rework-locations-of-ndlp-reference-taking.patch patches.suse/scsi-lpfc-Fix-removal-of-SCSI-transport-device-get-a.patch @@ -18136,6 +18212,7 @@ patches.suse/platform-x86-intel-vbtn-Support-for-tablet-mode-on-D.patch patches.suse/platform-x86-ideapad-laptop-Disable-touchpad_switch-.patch patches.suse/platform-x86-intel-vbtn-Drop-HP-Stream-x360-Converti.patch + patches.suse/mmc-sdhci-of-dwcmshc-fix-rpmb-access.patch patches.suse/mmc-sdhci-xenon-fix-1.8v-regulator-stabilization.patch patches.suse/mmc-core-don-t-initialize-block-size-from-ext_csd-if.patch patches.suse/scsi-scsi_transport_srp-Don-t-block-target-in-failfa.patch @@ -18435,6 +18512,7 @@ patches.suse/ALSA-usb-Use-DIV_ROUND_UP-instead-of-open-coding-it.patch patches.suse/ALSA-usb-audio-Skip-the-clock-selector-inquiry-for-s.patch patches.suse/ALSA-usb-audio-Fix-RANGE-setting-not-yet-supported-e.patch + patches.suse/ALSA-usb-audio-Add-DJM450-to-Pioneer-format-quirk.patch patches.suse/ALSA-usb-audio-Correct-document-for-snd_usb_endpoint.patch patches.suse/ALSA-usb-audio-Fix-PCM-buffer-allocation-in-non-vmal.patch patches.suse/ALSA-usb-audio-Handle-invalid-running-state-at-relea.patch @@ -18473,6 +18551,7 @@ patches.suse/drm-amd-display-Fix-HDMI-deep-color-output-for-DCE-6.patch patches.suse/0006-drm-vc4-hdmi-Restore-cec-physical-address-on-reconne.patch patches.suse/drm-i915-Reject-446-480MHz-HDMI-clock-on-GLK.patch + patches.suse/ima-free-ima-measurement-buffer-after-kexec-syscall patches.suse/tpm_tis-Fix-check_locality-for-correct-locality-acqu.patch patches.suse/tpm_tis-Clean-up-locality-release.patch patches.suse/tpm-Remove-tpm_dev_wq_lock.patch @@ -18544,7 +18623,20 @@ patches.suse/scsi-lpfc-Implement-health-checking-when-aborting-I-.patch patches.suse/scsi-lpfc-Enhancements-to-LOG_TRACE_EVENT-for-better.patch patches.suse/scsi-lpfc-Update-lpfc-version-to-12.8.0.7.patch + patches.suse/scsi-qla2xxx-Implementation-to-get-and-manage-host-t.patch + patches.suse/scsi-qla2xxx-Add-error-counters-to-debugfs-node.patch + patches.suse/scsi-qla2xxx-Move-some-messages-from-debug-to-normal.patch + patches.suse/scsi-qla2xxx-Wait-for-ABTS-response-on-I-O-timeouts-.patch + patches.suse/scsi-qla2xxx-Fix-mailbox-Ch-erroneous-error.patch + patches.suse/scsi-qla2xxx-Enable-NVMe-CONF-BIT_7-when-enabling-SL.patch + patches.suse/scsi-qla2xxx-Update-version-to-10.02.00.105-k.patch patches.suse/scsi-lpfc-Simplify-bool-comparison.patch + patches.suse/scsi-qla2xxx-fc_remote_port_chkready-returns-a-SCSI-.patch + patches.suse/scsi-qla2xxx-Assign-boolean-values-to-a-bool-variabl.patch + patches.suse/scsi-qla2xxx-Remove-unnecessary-NULL-check.patch + patches.suse/scsi-qla2xxx-Remove-redundant-NULL-check.patch + patches.suse/scsi-qla2xxx-Fix-some-memory-corruption.patch + patches.suse/scsi-qla2xxx-Simplify-the-calculation-of-variables.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-srp-Fix-support-for-unpopulated-and-unbalanced-.patch @@ -18561,9 +18653,11 @@ 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-pmem-Include-pmem-prototypes.patch + patches.suse/KVM-PPC-Make-the-VMX-instruction-emulation-routines-.patch patches.suse/powerpc-sstep-Check-instruction-validity-against-ISA.patch patches.suse/powerpc-sstep-Fix-incorrect-return-from-analyze_inst.patch patches.suse/powerpc-prom-Fix-ibm-arch-vec-5-platform-support-sca.patch + patches.suse/powerpc-time-Enable-sched-clock-for-irqtime.patch patches.suse/powerpc-Fix-build-error-in-paravirt.h.patch patches.suse/powerpc-pseries-dlpar-handle-ibm-configure-connector.patch patches.suse/powerpc-sstep-Fix-load-store-and-update-emulation.patch @@ -18640,12 +18734,16 @@ 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/scsi-qla2xxx-Simplify-if-statement.patch + patches.suse/btrfs-fix-race-between-writes-to-swap-files-and-scru.patch + patches.suse/btrfs-fix-race-between-swap-file-activation-and-snap.patch patches.suse/btrfs-fix-stale-data-exposure-after-cloning-a-hole-w.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-Fix-Pioneer-DJM-devices-URB_CONTROL-r.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 @@ -18778,6 +18876,8 @@ patches.suse/powerpc-64s-Fix-instruction-encoding-for-lis-in-ppc_.patch patches.suse/fuse-fix-live-lock-in-fuse_iget.patch patches.suse/thermal-core-Add-NULL-pointer-check-before-using-coo.patch + patches.suse/0001-btrfs-track-qgroup-released-data-in-own-variable-in-.patch + patches.suse/0002-btrfs-fix-qgroup-data-rsv-leak-caused-by-falloc-fail.patch patches.suse/btrfs-fix-race-when-cloning-extent-buffer-during-rew.patch patches.suse/btrfs-always-pin-deleted-leaves-when-there-are-activ.patch patches.suse/ALSA-hda-generic-Fix-the-micmute-led-init-state.patch @@ -18808,6 +18908,8 @@ patches.suse/nvme-merge-nvme_keep_alive-into-nvme_keep_alive_work.patch patches.suse/nvme-allocate-the-keep-alive-request-using-BLK_MQ_RE.patch patches.suse/0001-nvme-tcp-fix-possible-hang-when-failing-to-set-io-qu.patch + patches.suse/scsi-qla2xxx-Fix-broken-endif-placement.patch + patches.suse/scsi-lpfc-Fix-some-error-codes-in-debugfs.patch patches.suse/PCI-rpadlpar-Fix-potential-drc_name-corruption-in-st.patch patches.suse/x86-introduce-ts_compat_restart-to-fix-get_nr_restart_syscall.patch patches.suse/x86-ioapic-ignore-irq2-again.patch @@ -18986,10 +19088,17 @@ patches.suse/Input-s6sy761-fix-coordinate-read-bit-shift.patch patches.suse/Input-i8042-fix-Pegatron-C15B-ID-entry.patch patches.suse/Input-nspire-keypad-enable-interrupts-only-when-open.patch + patches.suse/HID-google-add-don-USB-id.patch + patches.suse/HID-alps-fix-error-return-code-in-alps_input_configu.patch + patches.suse/HID-wacom-Assign-boolean-values-to-a-bool-variable.patch patches.suse/HID-wacom-set-EV_KEY-and-EV_ABS-only-for-non-HID_GEN.patch patches.suse/gpio-sysfs-Obey-valid_mask.patch patches.suse/libnvdimm-region-Fix-nvdimm_has_flush-to-handle-ND_R.patch + patches.suse/net-geneve-check-skb-is-large-enough-for-IPv4-IPv6-h.patch patches.suse/ibmvnic-correctly-use-dev_consume-free_skb_irq.patch + patches.suse/ibmvnic-avoid-calling-napi_disable-twice.patch + patches.suse/ibmvnic-remove-duplicate-napi_schedule-call-in-do_re.patch + patches.suse/ibmvnic-remove-duplicate-napi_schedule-call-in-open-.patch patches.suse/i40e-fix-the-panic-when-running-bpf-in-xdpdrv-mode.patch patches.suse/net-mlx5e-fix-ingress_ifindex-check-in-mlx5e_flower_.patch patches.suse/bpf-Move-off_reg-into-sanitize_ptr_alu.patch @@ -18999,9 +19108,123 @@ patches.suse/bpf-Refactor-and-streamline-bounds-check-into-helper.patch patches.suse/bpf-Move-sanitize_val_alu-out-of-op-switch.patch patches.suse/bpf-Tighten-speculative-pointer-arithmetic-mask.patch + patches.suse/gpio-omap-Save-and-restore-sysconfig.patch + patches.suse/pinctrl-lewisburg-Update-number-of-pins-in-community.patch + patches.suse/x86-crash-fix-crash_setup_memmap_entries-out-of-bounds-access.patch patches.suse/locking-qrwlock-Fix-ordering-in-queued_write_lock_sl.patch - - # jejb/scsi for-next + patches.suse/crypto-rng-fix-crypto_rng_reset-refcounting-when-CRY.patch + patches.suse/crypto-arm-curve25519-Move-.fpu-after-.arch.patch + patches.suse/x86-microcode-check-for-offline-cpus-before-requesting-new-microcode.patch + patches.suse/x86-platform-uv-set-section-block-size-for-hubless-architectures.patch + patches.suse/platform-x86-pmc_atom-Match-all-Beckhoff-Automation-.patch + patches.suse/misc-lis3lv02d-Fix-false-positive-WARN-on-various-HP.patch + patches.suse/misc-vmw_vmci-explicitly-initialize-vmci_notify_bm_s.patch + patches.suse/misc-vmw_vmci-explicitly-initialize-vmci_datagram-pa.patch + patches.suse/soundwire-bus-Fix-device-found-flag-correctly.patch + patches.suse/soundwire-stream-fix-memory-leak-in-stream-config-er.patch + patches.suse/phy-marvell-ARMADA375_USBCLUSTER_PHY-should-not-defa.patch + patches.suse/firmware-qcom-scm-Fix-QCOM_SCM-configuration.patch + patches.suse/bluetooth-eliminate-the-potential-race-condition-whe.patch + patches.suse/node-fix-device-cleanups-in-error-handling-code.patch + patches.suse/iio-accel-adis16201-Fix-wrong-axis-assignment-that-p.patch + patches.suse/staging-rtl8192u-Fix-potential-infinite-loop.patch + patches.suse/staging-fwserial-fix-TIOCSSERIAL-jiffies-conversions.patch + patches.suse/staging-fwserial-fix-TIOCSSERIAL-permission-check.patch + patches.suse/staging-fwserial-fix-TIOCSSERIAL-implementation.patch + patches.suse/staging-fwserial-fix-TIOCGSERIAL-implementation.patch + patches.suse/usb-typec-tcpci-Check-ROLE_CONTROL-while-interpretin.patch + patches.suse/usb-gadget-pch_udc-Replace-cpu_to_le32-by-lower_32_b.patch + patches.suse/usb-gadget-pch_udc-Check-if-driver-is-present-before.patch + patches.suse/usb-gadget-pch_udc-Check-for-DMA-mapping-error.patch + patches.suse/usb-gadget-pch_udc-Move-pch_udc_init-to-satisfy-kern.patch + patches.suse/usb-gadget-pch_udc-Revert-d3cb25a12138-completely.patch + patches.suse/fotg210-udc-Fix-DMA-on-EP0-for-length-max-packet-siz.patch + patches.suse/fotg210-udc-Fix-EP0-IN-requests-bigger-than-two-pack.patch + patches.suse/fotg210-udc-Remove-a-dubious-condition-leading-to-fo.patch + patches.suse/fotg210-udc-Mask-GRP2-interrupts-we-don-t-handle.patch + patches.suse/fotg210-udc-Don-t-DMA-more-than-the-buffer-can-take.patch + patches.suse/fotg210-udc-Complete-OUT-requests-on-short-packets.patch + patches.suse/usb-gadget-aspeed-fix-dma-map-failure.patch + patches.suse/USB-gadget-udc-fix-wrong-pointer-passed-to-IS_ERR-an.patch + patches.suse/usb-dwc2-Fix-session-request-interrupt-handler.patch + patches.suse/usb-typec-tcpm-Address-incorrect-values-of-tcpm-psy-.patch + patches.suse/usb-gadget-r8a66597-Add-missing-null-check-on-return.patch + patches.suse/Revert-USB-cdc-acm-fix-rounding-error-in-TIOCSSERIAL.patch + patches.suse/USB-cdc-acm-fix-unprivileged-TIOCCSERIAL.patch + patches.suse/USB-cdc-acm-fix-TIOCGSERIAL-implementation.patch + patches.suse/usb-typec-tcpm-Honour-pSnkStdby-requirement-during-n.patch + patches.suse/usb-gadget-Fix-double-free-of-device-descriptor-poin.patch + patches.suse/usb-dwc3-gadget-Fix-START_TRANSFER-link-state-check.patch + patches.suse/USB-CDC-ACM-fix-poison-unpoison-imbalance.patch + patches.suse/USB-serial-ark3116-fix-TIOCGSERIAL-implementation.patch + patches.suse/USB-serial-f81232-fix-TIOCGSERIAL-implementation.patch + patches.suse/USB-serial-f81534-fix-TIOCGSERIAL-implementation.patch + patches.suse/USB-serial-mos7720-fix-TIOCGSERIAL-implementation.patch + patches.suse/USB-serial-opticon-fix-TIOCGSERIAL-implementation.patch + patches.suse/USB-serial-quatech2-fix-TIOCGSERIAL-implementation.patch + patches.suse/USB-serial-ssu100-fix-TIOCGSERIAL-implementation.patch + patches.suse/USB-serial-usb_wwan-fix-TIOCSSERIAL-jiffies-conversi.patch + patches.suse/USB-serial-usb_wwan-fix-unprivileged-TIOCCSERIAL.patch + patches.suse/USB-serial-usb_wwan-fix-TIOCGSERIAL-implementation.patch + patches.suse/USB-serial-fix-return-value-for-unsupported-ioctls.patch + patches.suse/usb-dwc2-Fix-host-mode-hibernation-exit-with-remote-.patch + patches.suse/usb-dwc2-Fix-hibernation-between-host-and-device-mod.patch + patches.suse/bus-qcom-Put-child-node-before-return.patch + patches.suse/memory-gpmc-fix-out-of-bounds-read-and-dereference-o.patch + patches.suse/memory-pl353-fix-mask-of-ECC-page_size-config-regist.patch + patches.suse/soc-qcom-mdt_loader-Validate-that-p_filesz-p_memsz.patch + patches.suse/soc-qcom-mdt_loader-Detect-truncated-read-of-segment.patch + patches.suse/soc-aspeed-fix-a-ternary-sign-expansion-bug.patch + patches.suse/ACPI-CPPC-Replace-cppc_attr-with-kobj_attribute.patch + patches.suse/cpufreq-armada-37xx-Fix-setting-TBG-parent-for-load-.patch + patches.suse/clk-mvebu-armada-37xx-periph-remove-.set_parent-meth.patch + patches.suse/cpufreq-armada-37xx-Fix-the-AVS-value-for-load-L1.patch + patches.suse/clk-mvebu-armada-37xx-periph-Fix-switching-CPU-freq-.patch + patches.suse/clk-mvebu-armada-37xx-periph-Fix-workaround-for-swit.patch + patches.suse/cpufreq-armada-37xx-Fix-driver-cleanup-when-registra.patch + patches.suse/cpufreq-armada-37xx-Fix-determining-base-CPU-frequen.patch + patches.suse/cpufreq-Kconfig-fix-documentation-links.patch + patches.suse/PM-runtime-Add-documentation-for-pm_runtime_resume_a.patch + patches.suse/mtd-require-write-permissions-for-locking-and-badblo.patch + patches.suse/mtd-rawnand-fsmc-Fix-error-code-in-fsmc_nand_probe.patch + patches.suse/mtd-rawnand-brcmnand-fix-OOB-R-W-with-Hamming-ECC.patch + patches.suse/mtd-Handle-possible-EPROBE_DEFER-from-parse_mtd_part.patch + patches.suse/mtd-rawnand-qcom-Return-actual-error-code-instead-of.patch + patches.suse/mtd-rawnand-atmel-Update-ecc_stats.corrected-counter.patch + patches.suse/mtd-spinand-core-add-missing-MODULE_DEVICE_TABLE.patch + patches.suse/mtd-rawnand-gpmi-Fix-a-double-free-in-gpmi_nand_init.patch + patches.suse/regmap-set-debugfs_name-to-NULL-after-it-is-freed.patch + patches.suse/regulator-Avoid-a-double-of_node_get-in-regulator_of.patch + patches.suse/spi-spi-ti-qspi-Free-DMA-resources.patch + patches.suse/spi-fsl-lpspi-Fix-PM-reference-leak-in-lpspi_prepare.patch + patches.suse/media-omap4iss-return-error-code-when-omap4iss_get-f.patch + patches.suse/media-platform-sunxi-sun6i-csi-fix-error-return-code.patch + patches.suse/media-mantis-remove-orphan-mantis_core.c.patch + patches.suse/media-m88rs6000t-avoid-potential-out-of-bounds-reads.patch + patches.suse/media-dvbdev-Fix-memory-leak-in-dvb_media_device_fre.patch + patches.suse/media-staging-intel-ipu3-Fix-set_fmt-error-handling.patch + patches.suse/media-v4l2-ctrls.c-fix-race-condition-in-hdl-request.patch + patches.suse/media-staging-intel-ipu3-Fix-memory-leak-in-imu_fmt.patch + patches.suse/media-staging-intel-ipu3-Fix-race-condition-during-s.patch + patches.suse/drm-radeon-fix-copy-of-uninitialized-variable-back-t.patch + patches.suse/drm-amdkfd-fix-build-error-with-AMD_IOMMU_V2-m.patch + patches.suse/drm-omap-fix-misleading-indentation-in-pixinc.patch + patches.suse/rsxx-remove-extraneous-const-qualifier.patch + patches.suse/pata_arasan_cf-fix-IRQ-check.patch + patches.suse/pata_ipx4xx_cf-fix-IRQ-check.patch + patches.suse/sata_mv-add-IRQ-checks.patch + patches.suse/ata-libahci_platform-fix-IRQ-check.patch + patches.suse/mmc-uniphier-sd-Fix-an-error-handling-path-in-uniphi.patch + patches.suse/mmc-uniphier-sd-Fix-a-resource-leak-in-the-remove-fu.patch + patches.suse/mmc-core-Correct-descriptions-in-mmc_of_parse.patch + patches.suse/mmc-mmc_spi-Drop-unused-NO_IRQ-definition.patch + patches.suse/mfd-stm32-timers-Avoid-clearing-auto-reload-register.patch + patches.suse/mfd-lpc_sch-Partially-revert-Add-support-for-Intel-Q.patch + patches.suse/backlight-journada720-Fix-Wmisleading-indentation-wa.patch + patches.suse/clk-qcom-a53-pll-Add-missing-MODULE_DEVICE_TABLE.patch + patches.suse/clk-exynos7-Mark-aclk_fsys1_200-as-critical.patch + patches.suse/clk-zynqmp-move-zynqmp_pll_set_mode-out-of-round_rat.patch + patches.suse/clk-uniphier-Fix-potential-infinite-loop.patch patches.suse/scsi-lpfc-Fix-incorrect-dbde-assignment-when-buildin.patch patches.suse/scsi-lpfc-Fix-vport-indices-in-lpfc_find_vport_by_vp.patch patches.suse/scsi-lpfc-Fix-reftag-generation-sizing-errors.patch @@ -19024,16 +19247,151 @@ patches.suse/scsi-lpfc-Correct-function-header-comments-related-t.patch patches.suse/scsi-lpfc-Update-lpfc-version-to-12.8.0.8.patch patches.suse/scsi-lpfc-Update-copyrights-for-12.8.0.7-and-12.8.0..patch - - # powerpc/linux next + patches.suse/scsi-qla2xxx-Replace-__qla2x00_marker-s-missing-unde.patch + patches.suse/scsi-lpfc-Fix-a-bunch-of-kernel-doc-issues.patch + patches.suse/scsi-qla2xxx-Fix-some-incorrect-formatting-spelling-.patch + patches.suse/scsi-lpfc-Fix-formatting-and-misspelling-issues.patch + patches.suse/scsi-lpfc-Fix-incorrect-naming-of-__lpfc_update_fcf_.patch + patches.suse/scsi-lpfc-Fix-a-bunch-of-kernel-doc-misdemeanours.patch + patches.suse/scsi-lpfc-Fix-a-bunch-of-misnamed-functions.patch + patches.suse/scsi-qla2xxx-Fix-a-couple-of-misnamed-functions.patch + patches.suse/scsi-qla2xxx-Fix-incorrectly-named-function-qla8044_.patch + patches.suse/scsi-qla2xxx-Fix-a-couple-of-misdocumented-functions.patch + patches.suse/scsi-lpfc-Fix-incorrectly-documented-function-lpfc_d.patch + patches.suse/scsi-lpfc-Fix-a-few-incorrectly-named-functions.patch + patches.suse/scsi-lpfc-Fix-kernel-doc-formatting-issue.patch + patches.suse/scsi-qla2xxx-Use-dma_pool_zalloc.patch + patches.suse/scsi-qla2xxx-Constify-struct-qla_tgt_func_tmpl.patch + patches.suse/scsi-qla2xxx-Fix-endianness-annotations.patch + patches.suse/scsi-qla2xxx-Suppress-Coverity-complaints-about-dseg.patch + patches.suse/scsi-qla2xxx-Simplify-qla8044_minidump_process_contr.patch + patches.suse/scsi-qla2xxx-Always-check-the-return-value-of-qla24x.patch + patches.suse/scsi-qla2xxx-Check-kzalloc-return-value.patch + patches.suse/scsi-lpfc-Fix-a-typo.patch + patches.suse/scsi-lpfc-Fix-a-typo-f1891f9b.patch + patches.suse/scsi-qla2xxx-Fix-IOPS-drop-seen-in-some-adapters.patch + patches.suse/scsi-qla2xxx-Add-H-C-T-info-in-the-log-message-for-f.patch + patches.suse/scsi-qla2xxx-Fix-stuck-session.patch + patches.suse/scsi-qla2xxx-Consolidate-zio-threshold-setting-for-b.patch + patches.suse/scsi-qla2xxx-Fix-use-after-free-in-bsg.patch + patches.suse/scsi-qla2xxx-Fix-crash-in-qla2xxx_mqueuecommand.patch + patches.suse/scsi-qla2xxx-Fix-RISC-RESET-completion-polling.patch + patches.suse/scsi-qla2xxx-Fix-crash-in-PCIe-error-handling.patch + patches.suse/scsi-qla2xxx-Fix-mailbox-recovery-during-PCIe-error.patch + patches.suse/scsi-qla2xxx-Update-default-AER-debug-mask.patch + patches.suse/scsi-qla2xxx-Do-logout-even-if-fabric-scan-retries-g.patch + patches.suse/scsi-qla2xxx-Update-version-to-10.02.00.106-k.patch + patches.suse/scsi-lpfc-Fix-gcc-Wstringop-overread-warning.patch + patches.suse/scsi-qla2xxx-Remove-unneeded-if-null-free-check.patch + patches.suse/scsi-qla2xxx-Reuse-existing-error-handling-path.patch + patches.suse/scsi-lpfc-Fix-rmmod-crash-due-to-bad-ring-pointers-t.patch + patches.suse/scsi-lpfc-Fix-crash-when-a-REG_RPI-mailbox-fails-tri.patch + patches.suse/scsi-lpfc-Fix-reference-counting-errors-in-lpfc_cmpl.patch + patches.suse/scsi-lpfc-Fix-NMI-crash-during-rmmod-due-to-circular.patch + patches.suse/scsi-lpfc-Fix-lack-of-device-removal-on-port-swaps-w.patch + patches.suse/scsi-lpfc-Fix-error-handling-for-mailboxes-completed.patch + patches.suse/scsi-lpfc-Fix-use-after-free-on-unused-nodes-after-p.patch + patches.suse/scsi-lpfc-Fix-silent-memory-allocation-failure-in-lp.patch + patches.suse/scsi-lpfc-Fix-missing-FDMI-registrations-after-Mgmt-.patch + patches.suse/scsi-lpfc-Fix-lpfc_hdw_queue-attribute-being-ignored.patch + patches.suse/scsi-lpfc-Remove-unsupported-mbox-PORT_CAPABILITIES-.patch + patches.suse/scsi-lpfc-Fix-various-trivial-errors-in-comments-and.patch + patches.suse/scsi-lpfc-Standardize-discovery-object-logging-forma.patch + patches.suse/scsi-lpfc-Eliminate-use-of-LPFC_DRIVER_NAME-in-lpfc_.patch + patches.suse/scsi-lpfc-Update-lpfc-version-to-12.8.0.9.patch + patches.suse/scsi-lpfc-Copyright-updates-for-12.8.0.9-patches.patch + patches.suse/scsi-qla2xxx-Reserve-extra-IRQ-vectors.patch + patches.suse/nfc-pn533-prevent-potential-memory-corruption.patch + patches.suse/liquidio-Fix-unintented-sign-extension-of-a-left-shi.patch + patches.suse/ibmvnic-clean-up-the-remaining-debugfs-data-structur.patch + patches.suse/ibmvnic-print-reset-reason-as-a-string.patch + patches.suse/ibmvnic-print-adapter-state-as-a-string.patch + patches.suse/mt7601u-fix-always-true-expression.patch + patches.suse/ibmvnic-improve-failover-sysfs-entry.patch + patches.suse/ibmvnic-queue-reset-work-in-system_long_wq.patch + patches.suse/rtlwifi-8821ae-upgrade-PHY-and-RF-parameters.patch + patches.suse/ipw2x00-potential-buffer-overflow-in-libipw_wx_set_e.patch + patches.suse/rsi-Use-resume_noirq-for-SDIO.patch + patches.suse/rtw88-Fix-array-overrun-in-rtw_get_tx_power_params.patch + patches.suse/mac80211-bail-out-if-cipher-schemes-are-invalid.patch + patches.suse/ath9k-Fix-error-check-in-ath9k_hw_read_revisions-for.patch + patches.suse/ath10k-Fix-ath10k_wmi_tlv_op_pull_peer_stats_info-un.patch + patches.suse/net-phy-intel-xway-enable-integrated-led-functions.patch + patches.suse/net-phy-marvell-fix-m88e1011_set_downshift.patch + patches.suse/net-phy-marvell-fix-m88e1111_set_downshift.patch + patches.suse/net-geneve-modify-IP-header-check-in-geneve6_xmit_sk.patch + patches.suse/net-nfc-digital-Fix-a-double-free-in-digital_tg_recv.patch patches.suse/selftests-powerpc-Fix-L1D-flushing-tests-for-Power10.patch + patches.suse/powerpc-fadump-Mark-fadump_calculate_reserve_size-as.patch + patches.suse/powerpc-prom-Mark-identical_pvr_fixup-as-__init.patch + patches.suse/powerpc-asm-offsets-GPR14-is-not-needed-either.patch + patches.suse/powerpc-64s-Fix-pte-update-for-kernel-memory-on-radi.patch + patches.suse/powerpc-perf-Fix-PMU-constraint-check-for-EBB-events.patch patches.suse/powerpc-papr_scm-Implement-support-for-H_SCM_FLUSH-h.patch patches.suse/powerpc-mm-Add-cond_resched-while-removing-hpte-mapp.patch + patches.suse/powerpc-eeh-Fix-EEH-handling-for-hugepages-in-iorema.patch patches.suse/powerpc-papr_scm-Fix-build-error-due-to-wrong-printf.patch + patches.suse/KVM-PPC-Book3S-HV-P9-Restore-host-CTRL-SPR-after-gue.patch patches.suse/powerpc-pseries-Add-shutdown-to-vio_driver-and-vio_b.patch + patches.suse/drm-i915-gvt-Fix-error-code-in-intel_gvt_init_device.patch + patches.suse/ALSA-usb-audio-Configure-Pioneer-DJM-850-samplerate.patch + patches.suse/ALSA-hda-cirrus-Add-support-for-CS8409-HDA-bridge-an.patch + patches.suse/ALSA-hda-cirrus-Add-jack-detect-interrupt-support-fr.patch + patches.suse/ALSA-hda-cirrus-Add-Headphone-and-Headset-MIC-Volume.patch + patches.suse/ALSA-hda-cirrus-Add-error-handling-into-CS8409-I2C-f.patch + patches.suse/ALSA-hda-cirrus-Cleanup-patch_cirrus.c-code.patch + patches.suse/ALSA-hda-cirrus-Fix-CS42L42-Headset-Mic-volume-contr.patch + patches.suse/ALSA-hda-cirrus-Make-CS8409-driver-more-generic-by-u.patch + patches.suse/ALSA-core-remove-redundant-spin_lock-pair-in-snd_car.patch + patches.suse/ALSA-usb-audio-Add-error-checks-for-usb_driver_claim.patch + patches.suse/ALSA-usb-audio-Add-MIDI-quirk-for-Vox-ToneLab-EX.patch + patches.suse/ALSA-usb-audio-Explicitly-set-up-the-clock-selector.patch + patches.suse/ALSA-hda-realtek-fix-mic-boost-on-Intel-NUC-8.patch + patches.suse/ALSA-hda-realtek-GA503-use-same-quirks-as-GA401.patch + patches.suse/ALSA-usb-audio-DJM-750-ensure-format-is-set.patch + patches.suse/ALSA-hda-realtek-Headset-Mic-issue-on-HP-platform.patch + patches.suse/ALSA-usb-midi-don-t-return-ENOMEM-when-usb_urb_ep_ty.patch + patches.suse/ALSA-usb-audio-Fix-implicit-sync-clearance-at-stoppi.patch + patches.suse/ALSA-hda-realtek-fix-static-noise-on-ALC285-Lenovo-l.patch + patches.suse/ALSA-emu8000-Fix-a-use-after-free-in-snd_emu8000_cre.patch + patches.suse/ASoC-Intel-kbl_da7219_max98927-Fix-kabylake_ssp_fixu.patch + patches.suse/ASoC-samsung-tm2_wm5110-check-of-of_parse-return-val.patch + patches.suse/ASoC-ak5558-Fix-s-show-slow-typo.patch + patches.suse/ASoC-simple-card-fix-possible-uninitialized-single_c.patch + patches.suse/ASoC-ak5558-correct-reset-polarity.patch + patches.suse/ALSA-sb-Fix-two-use-after-free-in-snd_sb_qsound_buil.patch + patches.suse/ALSA-hda-cirrus-Set-Initial-DMIC-volume-for-Bullseye.patch + patches.suse/ALSA-hda-cirrus-Use-CS8409-filter-to-fix-abnormal-so.patch + patches.suse/ALSA-hda-realtek-Add-quirk-for-Intel-Clevo-PCx0Dx.patch + patches.suse/ALSA-hda-realtek-Re-order-ALC882-Acer-quirk-table-en.patch + patches.suse/ALSA-hda-realtek-Re-order-ALC882-Sony-quirk-table-en.patch + patches.suse/ALSA-hda-realtek-Re-order-ALC882-Clevo-quirk-table-e.patch + patches.suse/ALSA-hda-realtek-Re-order-ALC269-HP-quirk-table-entr.patch + patches.suse/ALSA-hda-realtek-Re-order-ALC269-Acer-quirk-table-en.patch + patches.suse/ALSA-hda-realtek-Re-order-ALC269-Dell-quirk-table-en.patch + patches.suse/ALSA-hda-realtek-Re-order-ALC269-ASUS-quirk-table-en.patch + patches.suse/ALSA-hda-realtek-Re-order-ALC269-Sony-quirk-table-en.patch + patches.suse/ALSA-hda-realtek-Re-order-ALC269-Lenovo-quirk-table-.patch + patches.suse/ALSA-hda-realtek-Re-order-remaining-ALC269-quirk-tab.patch + patches.suse/ALSA-hda-realtek-Re-order-ALC662-quirk-table-entries.patch + patches.suse/ALSA-hda-realtek-Remove-redundant-entry-for-ALC861-H.patch + patches.suse/HID-plantronics-Workaround-for-double-volume-key-pre.patch + patches.suse/i2c-img-scb-fix-reference-leak-when-pm_runtime_get_s.patch + patches.suse/i2c-imx-lpi2c-fix-reference-leak-when-pm_runtime_get.patch + patches.suse/i2c-omap-fix-reference-leak-when-pm_runtime_get_sync.patch + patches.suse/i2c-sprd-fix-reference-leak-when-pm_runtime_get_sync.patch + patches.suse/i2c-cadence-add-IRQ-check.patch + patches.suse/i2c-emev2-add-IRQ-check.patch + patches.suse/i2c-jz4780-add-IRQ-check.patch + patches.suse/i2c-sh7760-add-IRQ-check.patch + patches.suse/i2c-sh7760-fix-IRQ-error-path.patch + patches.suse/pinctrl-Ingenic-Add-missing-pins-to-the-JZ4770-MAC-M.patch + patches.suse/pinctrl-core-Fix-kernel-doc-string-for-pin_get_name.patch + patches.suse/rtc-ds1307-Fix-wday-settings-for-rx8130.patch - # mkp/scsi queue - patches.suse/scsi-qla2xxx-Reserve-extra-IRQ-vectors.patch + # mkp/scsi fixes + patches.suse/scsi-lpfc-Fix-illegal-memory-access-on-Abort-IOCBs.patch + patches.suse/scsi-lpfc-Fix-DMA-virtual-address-ptr-assignment-in-.patch ######################################################## # end of sorted patches @@ -19076,6 +19434,7 @@ patches.suse/0001-squashfs-fix-inode-lookup-sanity-checks.patch patches.suse/0002-squashfs-fix-xattr-id-and-id-lookup-sanity-checks.patch patches.suse/scsi-ibmvfc-Fix-invalid-state-machine-BUG_ON.patch + patches.suse/rtc-fsl-ftm-alarm-add-MODULE_TABLE.patch ######################################################## # kbuild/module infrastructure fixes @@ -19110,6 +19469,7 @@ # o changes to default tuning patches.suse/sched-optimize-latency-defaults-for-throughput.patch patches.suse/readahead-request-tunables.patch + patches.suse/0002-kernel-smp-make-csdlock-timeout-depend-on-boot-param.patch # o CPU frequency management patches.suse/cpufreq-ondemand-set-default-up_threshold-to-30-on-multi-core-systems.patch @@ -19331,6 +19691,18 @@ patches.suse/drm-mgag200-Implement-basic-PM-support patches.suse/0001-drm-ttm-Remove-warning-about-inconsistent-mapping-in.patch + patches.suse/drm-ast-Disable-VGA-decoding-while-driver-is-active.patch + patches.suse/drm-ast-Keep-MISC-fields-when-enabling-VGA.patch + patches.suse/drm-ast-Disable-screen-on-register-init.patch + patches.suse/drm-ast-drm-ast-Fix-boot-address-for-AST2500.patch + patches.suse/drm-ast-Fix-register-access-in-non-P2A-mode-for-DP50.patch + patches.suse/drm-ast-Fix-P2A-config-detection.patch + patches.suse/drm-ast-AST2500-fixups.patch + patches.suse/drm-ast-Correct-mode-table-for-AST2500-precatch.patch + patches.suse/drm-ast-Add-support-for-AIP200.patch + patches.suse/drm-ast-Add-support-for-1152x864-mode.patch + patches.suse/drm-ast-Add-25MHz-refclk-support.patch + ######################################################## # Storage ######################################################## @@ -19347,6 +19719,7 @@ patches.suse/ch-fixup-refcounting-imbalance-for-SCSI-devices.patch patches.suse/ch-synchronize-ch_probe-and-ch_open.patch patches.suse/ch-remove-ch_mutex.patch + patches.suse/fnic-use-blk_mq_tagset_busy_iter-to-traverse-commands.patch # NVMe patches.suse/Revert-nvme-allow-64-bit-results-in-passthru-command.patch @@ -19581,6 +19954,7 @@ patches.kabi/kABI-Fix-kABI-caused-by-fixes-for-bsc-1174426.patch patches.kabi/kABI-cover-up-change-in-struct-kvm_arch.patch patches.kabi/kABI-powerpc-pseries-Add-shutdown-to-vio_driver-and-.patch + patches.kabi/reintroduce-cqhci_suspend-for-kABI.patch ######################################################## # You'd better have a good reason for adding a patch