From f7b8af8f43677d10f4797d715531f84696ef7d9f Mon Sep 17 00:00:00 2001 From: Davidlohr Bueso Date: May 04 2021 18:25:42 +0000 Subject: Merge branch 'SLE12-SP5' (1640fc29ab09) into 'SLE12-SP5-RT' - Modified -rt patches: patches.rt/0000-revert-stop_machine-Provide-stop_machine_cpuslocked.patch patches.rt/0401-Add-the-hotplug-rework-including-all-its-side-stories.patch due to conflicts with: patches.suse/stop_machine-mark-helpers-__always_inline.patch --- diff --git a/blacklist.conf b/blacklist.conf index bc298d5..fdf0478 100644 --- a/blacklist.conf +++ b/blacklist.conf @@ -523,6 +523,7 @@ b60706644282af04e4aa57da5af57470d453cd1f # vsprintf: cosmetic 36594b317c656bec8f968db93701d2cb9bc9155c # vsprintf: depends on a huge clean up; it is just nice to have check 741a76b350897604c48fb12beff1c9b77724dc96 # kthread: fixes rather rare races in CPU hotplug; there are several followup fixes on top of it to get it actually right; does not worth the risk 4ca1085c9573ea08767521dabce62456e3fc2fd0 # kthread: comment fix +0687c66b5f666b5ad433f4e94251590d9bc9d10e # kthread: Fixes debugging of the life cycle of work struct. Broken for ages. Disabled in our configuration. 4950276672fce5c241857540f8561c440663673d # kmemcheck removal; not for released products d8be75663cec0069b85f80191abd2682ce4a512f # related to kmemcheck removal; not for released products a6da0024ffc19e0d47712bb5ca4fd083f76b07df # blktrace: fix unlocked registration of tracepoints; racy for ages; found by syzcaller; not worth it @@ -1823,3 +1824,15 @@ bbda4b6c7d7c7f79da71f95c92a5d76be22c3efd # depends on 4.14 sstep.c rewrite 08685be7761d69914f08c3d6211c543a385a5b9c # no scv support b6b79dd53082db11070b4368d85dd6699ff0b063 # not really a problem on 4.12 725f41339a70b78cd10dba71ee8ec252083b40ec # documentation +163f0ec1df33cf468509ff38cbcbb5eb0d7fac60 # Only additional WARN_ONs to debug lockdep reports from syzbot +179930a62f3182eb384ae1e4d1ad47e97f6f5e90 # cleanup +7172122be6a4712d699da4d261f92aa5ab3a78b8 # this is an unnecessary patch from a group retroactively identified as wonky +c1c214adcb56d36433480c8fedf772498e7e539c # prerequisites break kABI +dece3c2a320b0a6d891da6ff774ab763969b6860 # not supported +d6834b4b58d110814aaf3469e7fd87d34ae5ae81 # cosmetic fix for logging +d09845e98a05850a8094ea8fd6dd09a8e6824fff # breaks kABI +5a35b040d0567f9dce6e801e6e3b575b9c463028 # breaks kABI +d17d9227c332b7deca59b35fa9ff08e597666c2a # cosmetic fix +6840a150b9daf35e4d21ab9780d0a03b4ed74a5b # doesn't have 2bcf26528787 ("x86/platform/uv: Setup UV functions for Hubless UV Systems") +e81bf9793b1861d74953ef041b4f6c7faecc2dbd # optimization, KABI change, bsc#1185607 +fe6bdfc8e1e131720abbe77a2eb990c94c9024cb # not applicable, refactoring bsc#1185608 diff --git a/patches.kabi/struct-usbip_device-kABI-fixup.patch b/patches.kabi/struct-usbip_device-kABI-fixup.patch new file mode 100644 index 0000000..c2bfeb4 --- /dev/null +++ b/patches.kabi/struct-usbip_device-kABI-fixup.patch @@ -0,0 +1,37 @@ +From f79995c41d93703128c00b0d1842cafc440fa47f Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Tue, 27 Apr 2021 11:11:09 +0200 +Subject: [PATCH] struct usbip_device kABI fixup +Patch-mainline: never, kABI fixup +References: git-fixes + +Just putting the new member at the end + +Signed-off-by: Oliver Neukum +--- + drivers/usb/usbip/usbip_common.h | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/usb/usbip/usbip_common.h ++++ b/drivers/usb/usbip/usbip_common.h +@@ -279,9 +279,6 @@ struct usbip_device { + /* lock for status */ + spinlock_t lock; + +- /* mutex for synchronizing sysfs store paths */ +- struct mutex sysfs_lock; +- + int sockfd; + struct socket *tcp_socket; + +@@ -296,6 +293,10 @@ struct usbip_device { + void (*reset)(struct usbip_device *); + void (*unusable)(struct usbip_device *); + } eh_ops; ++#ifndef __GENKSYMS__ ++ /* mutex for synchronizing sysfs store paths */ ++ struct mutex sysfs_lock; ++#endif + }; + + #define kthread_get_run(threadfn, data, namefmt, ...) \ diff --git a/patches.rt/0000-revert-stop_machine-Provide-stop_machine_cpuslocked.patch b/patches.rt/0000-revert-stop_machine-Provide-stop_machine_cpuslocked.patch index 439bf0b..432684d 100644 --- a/patches.rt/0000-revert-stop_machine-Provide-stop_machine_cpuslocked.patch +++ b/patches.rt/0000-revert-stop_machine-Provide-stop_machine_cpuslocked.patch @@ -8,8 +8,8 @@ Part of massive/complex/validated RT all-in-one hotplug update. Signed-off-by: Mike Galbraith --- - include/linux/stop_machine.h | 26 +++----------------------- - kernel/stop_machine.c | 11 ++++------- + include/linux/stop_machine.h | 26 +++----------------------- + kernel/stop_machine.c | 11 ++++------- 2 files changed, 7 insertions(+), 30 deletions(-) --- a/include/linux/stop_machine.h @@ -40,29 +40,29 @@ Signed-off-by: Mike Galbraith const struct cpumask *cpus); #else /* CONFIG_SMP || CONFIG_HOTPLUG_CPU */ --static inline int stop_machine_cpuslocked(cpu_stop_fn_t fn, void *data, +-static __always_inline int stop_machine_cpuslocked(cpu_stop_fn_t fn, void *data, - const struct cpumask *cpus) -+static inline int stop_machine(cpu_stop_fn_t fn, void *data, -+ const struct cpumask *cpus) ++static __always_inline int stop_machine(cpu_stop_fn_t fn, void *data, ++ const struct cpumask *cpus) { unsigned long flags; int ret; -@@ -148,12 +134,6 @@ static inline int stop_machine_cpuslocke - return ret; +@@ -149,12 +135,6 @@ static __always_inline int stop_machine_ } --static inline int stop_machine(cpu_stop_fn_t fn, void *data, -- const struct cpumask *cpus) + static __always_inline int +-stop_machine(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus) -{ - return stop_machine_cpuslocked(fn, data, cpus); -} - - static inline int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, - const struct cpumask *cpus) +-static __always_inline int + stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, + const struct cpumask *cpus) { --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c -@@ -552,8 +552,7 @@ static int __init cpu_stop_init(void) +@@ -575,8 +575,7 @@ static int __init cpu_stop_init(void) } early_initcall(cpu_stop_init); @@ -72,7 +72,7 @@ Signed-off-by: Mike Galbraith { struct multi_stop_data msdata = { .fn = fn, -@@ -562,8 +561,6 @@ int stop_machine_cpuslocked(cpu_stop_fn_ +@@ -585,8 +584,6 @@ int stop_machine_cpuslocked(cpu_stop_fn_ .active_cpus = cpus, }; @@ -81,7 +81,7 @@ Signed-off-by: Mike Galbraith if (!stop_machine_initialized) { /* * Handle the case where stop_machine() is called -@@ -593,9 +590,9 @@ int stop_machine(cpu_stop_fn_t fn, void +@@ -616,9 +613,9 @@ int stop_machine(cpu_stop_fn_t fn, void int ret; /* No CPUs can come up or down during this. */ diff --git a/patches.rt/0401-Add-the-hotplug-rework-including-all-its-side-stories.patch b/patches.rt/0401-Add-the-hotplug-rework-including-all-its-side-stories.patch index 303202a..ad29c45 100644 --- a/patches.rt/0401-Add-the-hotplug-rework-including-all-its-side-stories.patch +++ b/patches.rt/0401-Add-the-hotplug-rework-including-all-its-side-stories.patch @@ -313,7 +313,7 @@ Signed-off-by: Mike Galbraith } arch_spinlock_t; --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c -@@ -3856,7 +3856,7 @@ void kvmppc_alloc_host_rm_ops(void) +@@ -3871,7 +3871,7 @@ void kvmppc_alloc_host_rm_ops(void) return; } @@ -322,7 +322,7 @@ Signed-off-by: Mike Galbraith for (cpu = 0; cpu < nr_cpu_ids; cpu += threads_per_core) { if (!cpu_online(cpu)) -@@ -3878,17 +3878,17 @@ void kvmppc_alloc_host_rm_ops(void) +@@ -3893,17 +3893,17 @@ void kvmppc_alloc_host_rm_ops(void) l_ops = (unsigned long) ops; if (cmpxchg64((unsigned long *)&kvmppc_host_rm_ops_hv, 0, l_ops)) { @@ -405,7 +405,7 @@ Signed-off-by: Mike Galbraith --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c -@@ -636,10 +636,10 @@ static void stp_work_fn(struct work_stru +@@ -677,10 +677,10 @@ static void stp_work_fn(struct work_stru goto out_unlock; memset(&stp_sync, 0, sizeof(stp_sync)); @@ -460,7 +460,7 @@ Signed-off-by: Mike Galbraith /* Low 15 bits are "next"; high 15 bits are "current". */ --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c -@@ -2249,7 +2249,6 @@ void perf_check_microcode(void) +@@ -2302,7 +2302,6 @@ void perf_check_microcode(void) if (x86_pmu.check_microcode) x86_pmu.check_microcode(); } @@ -470,7 +470,7 @@ Signed-off-by: Mike Galbraith .pmu_enable = x86_pmu_enable, --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c -@@ -3902,12 +3902,10 @@ static void intel_snb_check_microcode(vo +@@ -3889,12 +3889,10 @@ static void intel_snb_check_microcode(vo int pebs_broken = 0; int cpu; @@ -483,7 +483,7 @@ Signed-off-by: Mike Galbraith if (pebs_broken == x86_pmu.pebs_broken) return; -@@ -3980,7 +3978,9 @@ static bool check_msr(unsigned long msr, +@@ -3967,7 +3965,9 @@ static bool check_msr(unsigned long msr, static __init void intel_sandybridge_quirk(void) { x86_pmu.check_microcode = intel_snb_check_microcode; @@ -493,7 +493,7 @@ Signed-off-by: Mike Galbraith } static const struct { int id; char *name; } intel_arch_events_map[] __initconst = { -@@ -4847,13 +4847,12 @@ static __init int fixup_ht_bug(void) +@@ -4834,13 +4834,12 @@ static __init int fixup_ht_bug(void) lockup_detector_resume(); @@ -609,7 +609,7 @@ Signed-off-by: Mike Galbraith return ret; } -@@ -2521,7 +2521,7 @@ int cpufreq_register_driver(struct cpufr +@@ -2531,7 +2531,7 @@ int cpufreq_register_driver(struct cpufr pr_debug("trying to register driver %s\n", driver_data->name); /* Protect against concurrent CPU online/offline. */ @@ -618,7 +618,7 @@ Signed-off-by: Mike Galbraith write_lock_irqsave(&cpufreq_driver_lock, flags); if (cpufreq_driver) { -@@ -2554,9 +2554,10 @@ int cpufreq_register_driver(struct cpufr +@@ -2564,9 +2564,10 @@ int cpufreq_register_driver(struct cpufr goto err_if_unreg; } @@ -632,7 +632,7 @@ Signed-off-by: Mike Galbraith if (ret < 0) goto err_if_unreg; hp_online = ret; -@@ -2574,7 +2575,7 @@ err_null_driver: +@@ -2584,7 +2585,7 @@ err_null_driver: cpufreq_driver = NULL; write_unlock_irqrestore(&cpufreq_driver_lock, flags); out: @@ -641,7 +641,7 @@ Signed-off-by: Mike Galbraith return ret; } EXPORT_SYMBOL_GPL(cpufreq_register_driver); -@@ -2597,17 +2598,17 @@ int cpufreq_unregister_driver(struct cpu +@@ -2607,17 +2608,17 @@ int cpufreq_unregister_driver(struct cpu pr_debug("unregistering driver %s\n", driver->name); /* Protect against concurrent cpu hotplug */ @@ -773,7 +773,7 @@ Signed-off-by: Mike Galbraith ret = -EINVAL; --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c -@@ -322,10 +322,19 @@ static long local_pci_probe(void *_ddi) +@@ -323,10 +323,19 @@ static long local_pci_probe(void *_ddi) return 0; } @@ -794,7 +794,7 @@ Signed-off-by: Mike Galbraith struct drv_dev_and_id ddi = { drv, dev, id }; /* -@@ -334,33 +343,27 @@ static int pci_call_probe(struct pci_dri +@@ -335,33 +344,27 @@ static int pci_call_probe(struct pci_dri * on the right node. */ node = dev_to_node(&dev->dev); @@ -845,7 +845,7 @@ Signed-off-by: Mike Galbraith --- a/include/linux/cpu.h +++ b/include/linux/cpu.h -@@ -112,12 +112,11 @@ static inline void cpu_maps_update_done( +@@ -117,12 +117,11 @@ static inline void cpu_maps_update_done( extern struct bus_type cpu_subsys; #ifdef CONFIG_HOTPLUG_CPU @@ -863,7 +863,7 @@ Signed-off-by: Mike Galbraith extern void cpu_hotplug_disable(void); extern void cpu_hotplug_enable(void); void clear_tasks_mm_cpumask(int cpu); -@@ -125,18 +124,25 @@ int cpu_down(unsigned int cpu); +@@ -130,18 +129,25 @@ int cpu_down(unsigned int cpu); extern void pin_current_cpu(void); extern void unpin_current_cpu(void); @@ -1033,7 +1033,7 @@ Signed-off-by: Mike Galbraith #define local_unlock(lvar) \ --- a/include/linux/padata.h +++ b/include/linux/padata.h -@@ -166,9 +166,6 @@ struct padata_instance { +@@ -170,9 +170,6 @@ struct padata_instance { extern struct padata_instance *padata_alloc_possible( struct workqueue_struct *wq); @@ -1055,7 +1055,7 @@ Signed-off-by: Mike Galbraith atomic_t enable_cnt; /* pci_enable_device has been called */ --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h -@@ -791,6 +791,8 @@ struct perf_cpu_context { +@@ -800,6 +800,8 @@ struct perf_cpu_context { struct list_head sched_cb_entry; int sched_cb_usage; @@ -1237,7 +1237,7 @@ Signed-off-by: Mike Galbraith # ifdef CONFIG_SCHED_DEBUG int migrate_disable_atomic; # endif -@@ -1328,6 +1329,16 @@ extern struct pid *cad_pid; +@@ -1336,6 +1337,16 @@ extern struct pid *cad_pid; #define tsk_used_math(p) ((p)->flags & PF_USED_MATH) #define used_math() tsk_used_math(current) @@ -1254,7 +1254,7 @@ Signed-off-by: Mike Galbraith /* Per-process atomic flags. */ #define PFA_NO_NEW_PRIVS 0 /* May not gain new privileges. */ #define PFA_SPREAD_PAGE 1 /* Spread page cache over cpuset */ -@@ -1386,10 +1397,6 @@ extern int task_can_attach(struct task_s +@@ -1394,10 +1405,6 @@ extern int task_can_attach(struct task_s #ifdef CONFIG_SMP extern void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask); extern int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask); @@ -1265,7 +1265,7 @@ Signed-off-by: Mike Galbraith #else static inline void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) { -@@ -1400,9 +1407,6 @@ static inline int set_cpus_allowed_ptr(s +@@ -1408,9 +1415,6 @@ static inline int set_cpus_allowed_ptr(s return -EINVAL; return 0; } @@ -1341,14 +1341,14 @@ Signed-off-by: Mike Galbraith const struct cpumask *cpus); #else /* CONFIG_SMP || CONFIG_HOTPLUG_CPU */ --static inline int stop_machine(cpu_stop_fn_t fn, void *data, -- const struct cpumask *cpus) -+static inline int stop_machine_cpuslocked(cpu_stop_fn_t fn, void *data, -+ const struct cpumask *cpus) +-static __always_inline int stop_machine(cpu_stop_fn_t fn, void *data, +- const struct cpumask *cpus) ++static __always_inline int stop_machine_cpuslocked(cpu_stop_fn_t fn, void *data, ++ const struct cpumask *cpus) { unsigned long flags; int ret; -@@ -134,6 +148,12 @@ static inline int stop_machine(cpu_stop_ +@@ -134,6 +148,12 @@ static __always_inline int stop_machine( return ret; } @@ -1358,9 +1358,9 @@ Signed-off-by: Mike Galbraith + return stop_machine_cpuslocked(fn, data, cpus); +} + - static inline int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, - const struct cpumask *cpus) - { + static __always_inline int + stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, + const struct cpumask *cpus) --- a/kernel/Kconfig.locks +++ b/kernel/Kconfig.locks @@ -248,3 +248,20 @@ config ARCH_USE_QUEUED_RWLOCKS @@ -1895,7 +1895,7 @@ Signed-off-by: Mike Galbraith __cpuhp_kick_ap_work(st); wait_for_completion(&st->done); trace_cpuhp_exit(cpu, st->state, state, st->result); -@@ -1054,27 +759,33 @@ static int take_cpu_down(void *_param) +@@ -1058,27 +763,33 @@ static int take_cpu_down(void *_param) static int takedown_cpu(unsigned int cpu) { @@ -1934,7 +1934,7 @@ Signed-off-by: Mike Galbraith /* CPU refused to die */ irq_unlock_sparse(); /* Unpark the hotplug thread so we can rollback there */ -@@ -1093,6 +804,9 @@ static int takedown_cpu(unsigned int cpu +@@ -1097,6 +808,9 @@ static int takedown_cpu(unsigned int cpu wait_for_completion(&st->done); BUG_ON(st->state != CPUHP_AP_IDLE_DEAD); @@ -1944,7 +1944,7 @@ Signed-off-by: Mike Galbraith /* Interrupts are moved away from the dying cpu, reenable alloc/free */ irq_unlock_sparse(); -@@ -1138,9 +852,6 @@ static int __ref _cpu_down(unsigned int +@@ -1142,9 +856,6 @@ static int __ref _cpu_down(unsigned int { struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu); int prev_state, ret = 0; @@ -1954,7 +1954,7 @@ Signed-off-by: Mike Galbraith if (num_online_cpus() == 1) return -EBUSY; -@@ -1148,34 +859,7 @@ static int __ref _cpu_down(unsigned int +@@ -1152,34 +863,7 @@ static int __ref _cpu_down(unsigned int if (!cpu_present(cpu)) return -EINVAL; @@ -1990,7 +1990,7 @@ Signed-off-by: Mike Galbraith cpuhp_tasks_frozen = tasks_frozen; -@@ -1213,12 +897,7 @@ static int __ref _cpu_down(unsigned int +@@ -1217,12 +901,7 @@ static int __ref _cpu_down(unsigned int } out: @@ -2004,7 +2004,7 @@ Signed-off-by: Mike Galbraith return ret; } -@@ -1289,7 +968,7 @@ static int _cpu_up(unsigned int cpu, int +@@ -1293,7 +972,7 @@ static int _cpu_up(unsigned int cpu, int struct task_struct *idle; int ret = 0; @@ -2013,7 +2013,7 @@ Signed-off-by: Mike Galbraith if (!cpu_present(cpu)) { ret = -EINVAL; -@@ -1824,18 +1503,20 @@ static void cpuhp_rollback_install(int f +@@ -1828,18 +1507,20 @@ static void cpuhp_rollback_install(int f } } @@ -2037,7 +2037,7 @@ Signed-off-by: Mike Galbraith mutex_lock(&cpuhp_state_mutex); if (!invoke || !sp->startup.multi) -@@ -1864,13 +1545,23 @@ add_node: +@@ -1868,13 +1549,23 @@ add_node: hlist_add_head(node, &sp->list); unlock: mutex_unlock(&cpuhp_state_mutex); @@ -2063,7 +2063,7 @@ Signed-off-by: Mike Galbraith * @state: The state to setup * @invoke: If true, the startup function is invoked for cpus where * cpu state >= @state -@@ -1879,25 +1570,27 @@ EXPORT_SYMBOL_GPL(__cpuhp_state_add_inst +@@ -1883,25 +1574,27 @@ EXPORT_SYMBOL_GPL(__cpuhp_state_add_inst * @multi_instance: State is set up for multiple instances which get * added afterwards. * @@ -2097,7 +2097,7 @@ Signed-off-by: Mike Galbraith mutex_lock(&cpuhp_state_mutex); ret = cpuhp_store_callbacks(state, name, startup, teardown, -@@ -1933,7 +1626,6 @@ int __cpuhp_setup_state(enum cpuhp_state +@@ -1937,7 +1630,6 @@ int __cpuhp_setup_state(enum cpuhp_state } out: mutex_unlock(&cpuhp_state_mutex); @@ -2105,7 +2105,7 @@ Signed-off-by: Mike Galbraith /* * If the requested state is CPUHP_AP_ONLINE_DYN, return the * dynamically allocated state in case of success. -@@ -1942,6 +1634,22 @@ out: +@@ -1946,6 +1638,22 @@ out: return state; return ret; } @@ -2128,7 +2128,7 @@ Signed-off-by: Mike Galbraith EXPORT_SYMBOL(__cpuhp_setup_state); int __cpuhp_state_remove_instance(enum cpuhp_state state, -@@ -1955,7 +1663,7 @@ int __cpuhp_state_remove_instance(enum c +@@ -1959,7 +1667,7 @@ int __cpuhp_state_remove_instance(enum c if (!sp->multi_instance) return -EINVAL; @@ -2137,7 +2137,7 @@ Signed-off-by: Mike Galbraith mutex_lock(&cpuhp_state_mutex); if (!invoke || !cpuhp_get_teardown_cb(state)) -@@ -1976,29 +1684,30 @@ int __cpuhp_state_remove_instance(enum c +@@ -1980,29 +1688,30 @@ int __cpuhp_state_remove_instance(enum c remove: hlist_del(node); mutex_unlock(&cpuhp_state_mutex); @@ -2172,7 +2172,7 @@ Signed-off-by: Mike Galbraith mutex_lock(&cpuhp_state_mutex); if (sp->multi_instance) { -@@ -2026,7 +1735,14 @@ void __cpuhp_remove_state(enum cpuhp_sta +@@ -2030,7 +1739,14 @@ void __cpuhp_remove_state(enum cpuhp_sta remove: cpuhp_store_callbacks(state, NULL, NULL, NULL, false); mutex_unlock(&cpuhp_state_mutex); @@ -2198,7 +2198,7 @@ Signed-off-by: Mike Galbraith /* * perf event paranoia level: -@@ -4035,14 +4036,6 @@ find_get_context(struct pmu *pmu, struct +@@ -4055,14 +4056,6 @@ find_get_context(struct pmu *pmu, struct if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN)) return ERR_PTR(-EACCES); @@ -2213,7 +2213,7 @@ Signed-off-by: Mike Galbraith cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu); ctx = &cpuctx->ctx; get_ctx(ctx); -@@ -7988,7 +7981,8 @@ static int swevent_hlist_get_cpu(int cpu +@@ -8088,7 +8081,8 @@ static int swevent_hlist_get_cpu(int cpu int err = 0; mutex_lock(&swhash->hlist_mutex); @@ -2223,7 +2223,7 @@ Signed-off-by: Mike Galbraith struct swevent_hlist *hlist; hlist = kzalloc(sizeof(*hlist), GFP_KERNEL); -@@ -8009,7 +8003,7 @@ static int swevent_hlist_get(void) +@@ -8109,7 +8103,7 @@ static int swevent_hlist_get(void) { int err, cpu, failed_cpu; @@ -2232,7 +2232,7 @@ Signed-off-by: Mike Galbraith for_each_possible_cpu(cpu) { err = swevent_hlist_get_cpu(cpu); if (err) { -@@ -8017,8 +8011,7 @@ static int swevent_hlist_get(void) +@@ -8117,8 +8111,7 @@ static int swevent_hlist_get(void) goto fail; } } @@ -2242,7 +2242,7 @@ Signed-off-by: Mike Galbraith return 0; fail: for_each_possible_cpu(cpu) { -@@ -8026,8 +8019,7 @@ fail: +@@ -8126,8 +8119,7 @@ fail: break; swevent_hlist_put_cpu(cpu); } @@ -2252,7 +2252,7 @@ Signed-off-by: Mike Galbraith return err; } -@@ -9351,7 +9343,7 @@ perf_event_mux_interval_ms_store(struct +@@ -9453,7 +9445,7 @@ perf_event_mux_interval_ms_store(struct pmu->hrtimer_interval_ms = timer; /* update all cpuctx for this PMU */ @@ -2261,7 +2261,7 @@ Signed-off-by: Mike Galbraith for_each_online_cpu(cpu) { struct perf_cpu_context *cpuctx; cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu); -@@ -9360,7 +9352,7 @@ perf_event_mux_interval_ms_store(struct +@@ -9462,7 +9454,7 @@ perf_event_mux_interval_ms_store(struct cpu_function_call(cpu, (remote_function_f)perf_mux_hrtimer_restart, cpuctx); } @@ -2270,7 +2270,7 @@ Signed-off-by: Mike Galbraith mutex_unlock(&mux_interval_mutex); return count; -@@ -9490,6 +9482,7 @@ skip_type: +@@ -9592,6 +9584,7 @@ skip_type: lockdep_set_class(&cpuctx->ctx.mutex, &cpuctx_mutex); lockdep_set_class(&cpuctx->ctx.lock, &cpuctx_lock); cpuctx->ctx.pmu = pmu; @@ -2278,7 +2278,7 @@ Signed-off-by: Mike Galbraith __perf_mux_hrtimer_init(cpuctx, cpu); } -@@ -10338,12 +10331,10 @@ SYSCALL_DEFINE5(perf_event_open, +@@ -10457,12 +10450,10 @@ SYSCALL_DEFINE5(perf_event_open, goto err_task; } @@ -2292,7 +2292,7 @@ Signed-off-by: Mike Galbraith /* * Reuse ptrace permission checks for now. -@@ -10528,6 +10519,23 @@ SYSCALL_DEFINE5(perf_event_open, +@@ -10655,6 +10646,23 @@ SYSCALL_DEFINE5(perf_event_open, goto err_locked; } @@ -2316,7 +2316,7 @@ Signed-off-by: Mike Galbraith /* * Must be under the same ctx::mutex as perf_install_in_context(), * because we need to serialize with concurrent event creation. -@@ -10615,8 +10623,6 @@ SYSCALL_DEFINE5(perf_event_open, +@@ -10739,8 +10747,6 @@ SYSCALL_DEFINE5(perf_event_open, put_task_struct(task); } @@ -2325,7 +2325,7 @@ Signed-off-by: Mike Galbraith mutex_lock(¤t->perf_event_mutex); list_add_tail(&event->owner_entry, ¤t->perf_event_list); mutex_unlock(¤t->perf_event_mutex); -@@ -10650,8 +10656,6 @@ err_alloc: +@@ -10774,8 +10780,6 @@ err_alloc: err_cred: if (task) mutex_unlock(&task->signal->cred_guard_mutex); @@ -2334,7 +2334,7 @@ Signed-off-by: Mike Galbraith err_task: if (task) put_task_struct(task); -@@ -10706,6 +10710,21 @@ perf_event_create_kernel_counter(struct +@@ -10830,6 +10834,21 @@ perf_event_create_kernel_counter(struct goto err_unlock; } @@ -2356,7 +2356,7 @@ Signed-off-by: Mike Galbraith if (!exclusive_event_installable(event, ctx)) { err = -EBUSY; goto err_unlock; -@@ -11373,6 +11392,8 @@ static void __init perf_event_init_all_c +@@ -11527,6 +11546,8 @@ static void __init perf_event_init_all_c struct swevent_htable *swhash; int cpu; @@ -2365,7 +2365,7 @@ Signed-off-by: Mike Galbraith for_each_possible_cpu(cpu) { swhash = &per_cpu(swevent_htable, cpu); mutex_init(&swhash->hlist_mutex); -@@ -11388,7 +11409,7 @@ static void __init perf_event_init_all_c +@@ -11542,7 +11563,7 @@ static void __init perf_event_init_all_c } } @@ -2374,7 +2374,7 @@ Signed-off-by: Mike Galbraith { struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu); -@@ -11401,7 +11422,6 @@ int perf_event_init_cpu(unsigned int cpu +@@ -11555,7 +11576,6 @@ int perf_event_init_cpu(unsigned int cpu rcu_assign_pointer(swhash->swevent_hlist, hlist); } mutex_unlock(&swhash->hlist_mutex); @@ -2382,7 +2382,7 @@ Signed-off-by: Mike Galbraith } #if defined CONFIG_HOTPLUG_CPU || defined CONFIG_KEXEC_CORE -@@ -11419,19 +11439,22 @@ static void __perf_event_exit_context(vo +@@ -11573,19 +11593,22 @@ static void __perf_event_exit_context(vo static void perf_event_exit_cpu_context(int cpu) { @@ -2410,7 +2410,7 @@ Signed-off-by: Mike Galbraith } #else -@@ -11439,6 +11462,29 @@ static void perf_event_exit_cpu_context( +@@ -11593,6 +11616,29 @@ static void perf_event_exit_cpu_context( #endif @@ -2999,7 +2999,7 @@ Signed-off-by: Mike Galbraith int ret; --- a/kernel/locking/rtmutex_common.h +++ b/kernel/locking/rtmutex_common.h -@@ -140,6 +140,10 @@ int __sched rt_mutex_slowlock_locked(str +@@ -139,6 +139,10 @@ int __sched rt_mutex_slowlock_locked(str enum rtmutex_chainwalk chwalk, struct ww_acquire_ctx *ww_ctx, struct rt_mutex_waiter *waiter); @@ -3415,7 +3415,7 @@ Signed-off-by: Mike Galbraith +EXPORT_SYMBOL(__rt_rwlock_init); --- a/kernel/padata.c +++ b/kernel/padata.c -@@ -934,29 +934,18 @@ static struct kobj_type padata_attr_type +@@ -966,29 +966,18 @@ static struct kobj_type padata_attr_type }; /** @@ -3450,7 +3450,7 @@ Signed-off-by: Mike Galbraith { struct padata_instance *pinst; struct parallel_data *pd = NULL; -@@ -965,7 +954,6 @@ struct padata_instance *padata_alloc(str +@@ -997,7 +986,6 @@ struct padata_instance *padata_alloc(str if (!pinst) goto err; @@ -3458,7 +3458,7 @@ Signed-off-by: Mike Galbraith if (!alloc_cpumask_var(&pinst->cpumask.pcpu, GFP_KERNEL)) goto err_free_inst; if (!alloc_cpumask_var(&pinst->cpumask.cbcpu, GFP_KERNEL)) { -@@ -989,14 +977,12 @@ struct padata_instance *padata_alloc(str +@@ -1021,14 +1009,12 @@ struct padata_instance *padata_alloc(str pinst->flags = 0; @@ -3474,7 +3474,7 @@ Signed-off-by: Mike Galbraith #endif return pinst; -@@ -1005,12 +991,27 @@ err_free_masks: +@@ -1037,12 +1023,27 @@ err_free_masks: free_cpumask_var(pinst->cpumask.cbcpu); err_free_inst: kfree(pinst); @@ -3590,7 +3590,7 @@ Signed-off-by: Mike Galbraith /* * Change a given task's CPU affinity. Migrate the thread to a * proper CPU and schedule it away if the CPU it's executing on -@@ -7665,8 +7587,6 @@ void migrate_disable(void) +@@ -7667,8 +7589,6 @@ void migrate_disable(void) return; } @@ -3599,7 +3599,7 @@ Signed-off-by: Mike Galbraith preempt_disable(); preempt_lazy_disable(); pin_current_cpu(); -@@ -7742,13 +7662,11 @@ void migrate_enable(void) +@@ -7744,13 +7664,11 @@ void migrate_enable(void) preempt_enable(); stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg); tlb_migrate_finish(p->mm); @@ -3615,7 +3615,7 @@ Signed-off-by: Mike Galbraith } --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c -@@ -554,7 +554,8 @@ static int __init cpu_stop_init(void) +@@ -577,7 +577,8 @@ static int __init cpu_stop_init(void) } early_initcall(cpu_stop_init); @@ -3625,7 +3625,7 @@ Signed-off-by: Mike Galbraith { struct multi_stop_data msdata = { .fn = fn, -@@ -563,6 +564,8 @@ static int __stop_machine(cpu_stop_fn_t +@@ -586,6 +587,8 @@ static int __stop_machine(cpu_stop_fn_t .active_cpus = cpus, }; @@ -3634,7 +3634,7 @@ Signed-off-by: Mike Galbraith if (!stop_machine_initialized) { /* * Handle the case where stop_machine() is called -@@ -592,9 +595,9 @@ int stop_machine(cpu_stop_fn_t fn, void +@@ -615,9 +618,9 @@ int stop_machine(cpu_stop_fn_t fn, void int ret; /* No CPUs can come up or down during this. */ 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..cb3d0d6 --- /dev/null +++ b/patches.suse/0001-btrfs-track-qgroup-released-data-in-own-variable-in-.patch @@ -0,0 +1,65 @@ +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 | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +--- a/fs/btrfs/inode.c ++++ b/fs/btrfs/inode.c +@@ -10467,6 +10467,7 @@ static int insert_prealloc_file_extent(s + struct btrfs_file_extent_item stack_fi; + u64 start = ins->objectid; + u64 len = ins->offset; ++ int qgroup_released; + int ret; + + memset(&stack_fi, 0, sizeof(stack_fi)); +@@ -10479,11 +10480,11 @@ static int insert_prealloc_file_extent(s + 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 ret; ++ qgroup_released = btrfs_qgroup_release_data(inode, file_offset, len); ++ if (qgroup_released < 0) ++ return qgroup_released; + return insert_reserved_file_extent(trans, inode, file_offset, +- &stack_fi, ret); ++ &stack_fi, qgroup_released); + } + static int __btrfs_prealloc_file_range(struct inode *inode, int mode, + u64 start, u64 num_bytes, u64 min_size, 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..d200855 --- /dev/null +++ b/patches.suse/0002-btrfs-fix-qgroup-data-rsv-leak-caused-by-falloc-fail.patch @@ -0,0 +1,106 @@ +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 | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +--- a/fs/btrfs/inode.c ++++ b/fs/btrfs/inode.c +@@ -10483,8 +10483,20 @@ static int insert_prealloc_file_extent(s + qgroup_released = btrfs_qgroup_release_data(inode, file_offset, len); + if (qgroup_released < 0) + return qgroup_released; +- return insert_reserved_file_extent(trans, inode, file_offset, ++ ret = insert_reserved_file_extent(trans, inode, file_offset, + &stack_fi, qgroup_released); ++ /* ++ * 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. ++ */ ++ if (ret < 0) ++ btrfs_qgroup_free_refroot(BTRFS_I(inode)->root->fs_info, ++ BTRFS_I(inode)->root->root_key.objectid, qgroup_released, ++ BTRFS_QGROUP_RSV_DATA); ++ return ret; + } + static int __btrfs_prealloc_file_range(struct inode *inode, int mode, + u64 start, u64 num_bytes, u64 min_size, 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/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..36a0d21 --- /dev/null +++ b/patches.suse/USB-CDC-ACM-fix-poison-unpoison-imbalance.patch @@ -0,0 +1,46 @@ +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 + +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 +--- + 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/blk-settings-align-max_sectors-on-logical_block_size.patch b/patches.suse/blk-settings-align-max_sectors-on-logical_block_size.patch new file mode 100644 index 0000000..754a074 --- /dev/null +++ b/patches.suse/blk-settings-align-max_sectors-on-logical_block_size.patch @@ -0,0 +1,67 @@ +From 97f433c3601a24d3513d06f575a389a2ca4e11e4 Mon Sep 17 00:00:00 2001 +From: Mikulas Patocka +Date: Tue, 23 Feb 2021 19:25:30 -0700 +Subject: [PATCH] blk-settings: align max_sectors on "logical_block_size" + boundary +Git-commit: 97f433c3601a24d3513d06f575a389a2ca4e11e4 +Patch-mainline: v5.12-rc1 +References: bsc#1185195 + +We get I/O errors when we run md-raid1 on the top of dm-integrity on the +top of ramdisk. +Device-mapper: integrity: Bio not aligned on 8 sectors: 0xff00, 0xff +Device-mapper: integrity: Bio not aligned on 8 sectors: 0xffff, 0x1 +Device-mapper: integrity: Bio not aligned on 8 sectors: 0x8048, 0xff +Device-mapper: integrity: Bio not aligned on 8 sectors: 0x8147, 0xff +Device-mapper: integrity: Bio not aligned on 8 sectors: 0x8246, 0xff +Device-mapper: integrity: Bio not aligned on 8 sectors: 0x8345, 0xbb + +The ramdisk device has logical_block_size 512 and max_sectors 255. The +dm-integrity device uses logical_block_size 4096 and it doesn't affect the +"max_sectors" value - thus, it inherits 255 from the ramdisk. So, we have +a device with max_sectors not aligned on logical_block_size. + +The md-raid device sees that the underlying leg has max_sectors 255 and it +will split the bios on 255-sector boundary, making the bios unaligned on +logical_block_size. + +In order to fix the bug, we round down max_sectors to logical_block_size. + +Cc: stable@vger.kernel.org +Reviewed-by: Ming Lei +Signed-off-by: Mikulas Patocka +Signed-off-by: Jens Axboe +Acked-by: Jan Kara + +--- + block/blk-settings.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/block/blk-settings.c ++++ b/block/blk-settings.c +@@ -524,6 +524,14 @@ void blk_queue_stack_limits(struct reque + } + EXPORT_SYMBOL(blk_queue_stack_limits); + ++static unsigned int blk_round_down_sectors(unsigned int sectors, unsigned int lbs) ++{ ++ sectors = round_down(sectors, lbs >> SECTOR_SHIFT); ++ if (sectors < PAGE_SIZE >> SECTOR_SHIFT) ++ sectors = PAGE_SIZE >> SECTOR_SHIFT; ++ return sectors; ++} ++ + /** + * blk_stack_limits - adjust queue_limits for stacked devices + * @t: the stacking driver limits (top device) +@@ -639,6 +647,10 @@ int blk_stack_limits(struct queue_limits + ret = -1; + } + ++ t->max_sectors = blk_round_down_sectors(t->max_sectors, t->logical_block_size); ++ t->max_hw_sectors = blk_round_down_sectors(t->max_hw_sectors, t->logical_block_size); ++ t->max_dev_sectors = blk_round_down_sectors(t->max_dev_sectors, t->logical_block_size); ++ + /* Discard alignment and granularity */ + if (b->discard_granularity) { + alignment = queue_limit_discard_alignment(b, start); diff --git a/patches.suse/block-recalculate-segment-count-for-multi-segment-di.patch b/patches.suse/block-recalculate-segment-count-for-multi-segment-di.patch new file mode 100644 index 0000000..90f8e3f --- /dev/null +++ b/patches.suse/block-recalculate-segment-count-for-multi-segment-di.patch @@ -0,0 +1,84 @@ +From a958937ff166fc60d1c3a721036f6ff41bfa2821 Mon Sep 17 00:00:00 2001 +From: David Jeffery +Date: Thu, 11 Feb 2021 09:38:07 -0500 +Subject: [PATCH] block: recalculate segment count for multi-segment discards + correctly +Git-commit: a958937ff166fc60d1c3a721036f6ff41bfa2821 +Patch-mainline: v5.12-rc5 +References: bsc#1184724 + +When a stacked block device inserts a request into another block device +using blk_insert_cloned_request, the request's nr_phys_segments field gets +recalculated by a call to blk_recalc_rq_segments in +blk_cloned_rq_check_limits. But blk_recalc_rq_segments does not know how to +handle multi-segment discards. For disk types which can handle +multi-segment discards like nvme, this results in discard requests which +claim a single segment when it should report several, triggering a warning +in nvme and causing nvme to fail the discard from the invalid state. + + WARNING: CPU: 5 PID: 191 at drivers/nvme/host/core.c:700 nvme_setup_discard+0x170/0x1e0 [nvme_core] + ... + nvme_setup_cmd+0x217/0x270 [nvme_core] + nvme_loop_queue_rq+0x51/0x1b0 [nvme_loop] + __blk_mq_try_issue_directly+0xe7/0x1b0 + blk_mq_request_issue_directly+0x41/0x70 + ? blk_account_io_start+0x40/0x50 + dm_mq_queue_rq+0x200/0x3e0 + blk_mq_dispatch_rq_list+0x10a/0x7d0 + ? __sbitmap_queue_get+0x25/0x90 + ? elv_rb_del+0x1f/0x30 + ? deadline_remove_request+0x55/0xb0 + ? dd_dispatch_request+0x181/0x210 + __blk_mq_do_dispatch_sched+0x144/0x290 + ? bio_attempt_discard_merge+0x134/0x1f0 + __blk_mq_sched_dispatch_requests+0x129/0x180 + blk_mq_sched_dispatch_requests+0x30/0x60 + __blk_mq_run_hw_queue+0x47/0xe0 + __blk_mq_delay_run_hw_queue+0x15b/0x170 + blk_mq_sched_insert_requests+0x68/0xe0 + blk_mq_flush_plug_list+0xf0/0x170 + blk_finish_plug+0x36/0x50 + xlog_cil_committed+0x19f/0x290 [xfs] + xlog_cil_process_committed+0x57/0x80 [xfs] + xlog_state_do_callback+0x1e0/0x2a0 [xfs] + xlog_ioend_work+0x2f/0x80 [xfs] + process_one_work+0x1b6/0x350 + worker_thread+0x53/0x3e0 + ? process_one_work+0x350/0x350 + kthread+0x11b/0x140 + ? __kthread_bind_mask+0x60/0x60 + ret_from_fork+0x22/0x30 + +This patch fixes blk_recalc_rq_segments to be aware of devices which can +have multi-segment discards. It calculates the correct discard segment +count by counting the number of bio as each discard bio is considered its +own segment. + +Fixes: 1e739730c5b9 ("block: optionally merge discontiguous discard bios into a single request") +Signed-off-by: David Jeffery +Reviewed-by: Ming Lei +Reviewed-by: Laurence Oberman +Link: https://lore.kernel.org/r/20210211143807.GA115624@redhat +Signed-off-by: Jens Axboe +Acked-by: Jan Kara + +--- + block/blk-merge.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/block/blk-merge.c ++++ b/block/blk-merge.c +@@ -305,6 +305,13 @@ static unsigned int __blk_recalc_rq_segm + switch (bio_op(bio)) { + case REQ_OP_DISCARD: + case REQ_OP_SECURE_ERASE: ++ if (queue_max_discard_segments(q) > 1) { ++ nr_phys_segs = 0; ++ for_each_bio(bio) ++ nr_phys_segs++; ++ return nr_phys_segs; ++ } ++ return 1; + case REQ_OP_WRITE_ZEROES: + return 0; + case REQ_OP_WRITE_SAME: diff --git a/patches.suse/ext4-find-old-entry-again-if-failed-to-rename-whiteo.patch b/patches.suse/ext4-find-old-entry-again-if-failed-to-rename-whiteo.patch new file mode 100644 index 0000000..4c3c5fa --- /dev/null +++ b/patches.suse/ext4-find-old-entry-again-if-failed-to-rename-whiteo.patch @@ -0,0 +1,73 @@ +From b7ff91fd030dc9d72ed91b1aab36e445a003af4f Mon Sep 17 00:00:00 2001 +From: "zhangyi (F)" +Date: Wed, 3 Mar 2021 21:17:02 +0800 +Subject: [PATCH] ext4: find old entry again if failed to rename whiteout +Git-commit: b7ff91fd030dc9d72ed91b1aab36e445a003af4f +Patch-mainline: v5.12-rc4 +References: bsc#1184742 + +If we failed to add new entry on rename whiteout, we cannot reset the +old->de entry directly, because the old->de could have moved from under +us during make indexed dir. So find the old entry again before reset is +needed, otherwise it may corrupt the filesystem as below. + + /dev/sda: Entry '00000001' in ??? (12) has deleted/unused inode 15. CLEARED. + /dev/sda: Unattached inode 75 + /dev/sda: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY. + +Fixes: 6b4b8e6b4ad ("ext4: fix bug for rename with RENAME_WHITEOUT") +Cc: stable@vger.kernel.org +Signed-off-by: zhangyi (F) +Link: https://lore.kernel.org/r/20210303131703.330415-1-yi.zhang@huawei.com +Signed-off-by: Theodore Ts'o +Acked-by: Jan Kara + +--- + fs/ext4/namei.c | 29 +++++++++++++++++++++++++++-- + 1 file changed, 27 insertions(+), 2 deletions(-) + +--- a/fs/ext4/namei.c ++++ b/fs/ext4/namei.c +@@ -3377,6 +3377,31 @@ static int ext4_setent(handle_t *handle, + return 0; + } + ++static void ext4_resetent(handle_t *handle, struct ext4_renament *ent, ++ unsigned ino, unsigned file_type) ++{ ++ struct ext4_renament old = *ent; ++ int retval = 0; ++ ++ /* ++ * old->de could have moved from under us during make indexed dir, ++ * so the old->de may no longer valid and need to find it again ++ * before reset old inode info. ++ */ ++ old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, NULL); ++ if (IS_ERR(old.bh)) ++ retval = PTR_ERR(old.bh); ++ if (!old.bh) ++ retval = -ENOENT; ++ if (retval) { ++ ext4_std_error(old.dir->i_sb, retval); ++ return; ++ } ++ ++ ext4_setent(handle, &old, ino, file_type); ++ brelse(old.bh); ++} ++ + static int ext4_find_delete_entry(handle_t *handle, struct inode *dir, + const struct qstr *d_name) + { +@@ -3686,8 +3711,8 @@ static int ext4_rename(struct inode *old + end_rename: + if (whiteout) { + if (retval) { +- ext4_setent(handle, &old, +- old.inode->i_ino, old_file_type); ++ ext4_resetent(handle, &old, ++ old.inode->i_ino, old_file_type); + drop_nlink(whiteout); + } + unlock_new_inode(whiteout); diff --git a/patches.suse/ext4-fix-potential-error-in-ext4_do_update_inode.patch b/patches.suse/ext4-fix-potential-error-in-ext4_do_update_inode.patch new file mode 100644 index 0000000..1d3c5ef --- /dev/null +++ b/patches.suse/ext4-fix-potential-error-in-ext4_do_update_inode.patch @@ -0,0 +1,52 @@ +From 7d8bd3c76da1d94b85e6c9b7007e20e980bfcfe6 Mon Sep 17 00:00:00 2001 +From: Shijie Luo +Date: Fri, 12 Mar 2021 01:50:51 -0500 +Subject: [PATCH] ext4: fix potential error in ext4_do_update_inode +Git-commit: 7d8bd3c76da1d94b85e6c9b7007e20e980bfcfe6 +Patch-mainline: v5.12-rc4 +References: bsc#1184731 + +If set_large_file = 1 and errors occur in ext4_handle_dirty_metadata(), +the error code will be overridden, go to out_brelse to avoid this +situation. + +Signed-off-by: Shijie Luo +Link: https://lore.kernel.org/r/20210312065051.36314-1-luoshijie1@huawei.com +Cc: stable@kernel.org +Reviewed-by: Jan Kara +Signed-off-by: Theodore Ts'o +Acked-by: Jan Kara + +--- + fs/ext4/inode.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c +index a79a9ea58c56..927e47db7f00 100644 +--- a/fs/ext4/inode.c ++++ b/fs/ext4/inode.c +@@ -5026,7 +5026,7 @@ static int ext4_do_update_inode(handle_t *handle, + struct ext4_inode_info *ei = EXT4_I(inode); + struct buffer_head *bh = iloc->bh; + struct super_block *sb = inode->i_sb; +- int err = 0, rc, block; ++ int err = 0, block; + int need_datasync = 0, set_large_file = 0; + uid_t i_uid; + gid_t i_gid; +@@ -5138,9 +5138,9 @@ static int ext4_do_update_inode(handle_t *handle, + bh->b_data); + + BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata"); +- rc = ext4_handle_dirty_metadata(handle, NULL, bh); +- if (!err) +- err = rc; ++ err = ext4_handle_dirty_metadata(handle, NULL, bh); ++ if (err) ++ goto out_brelse; + ext4_clear_inode_state(inode, EXT4_STATE_NEW); + if (set_large_file) { + BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get write access"); +-- +2.26.2 + diff --git a/patches.suse/fs-direct-io-fix-missing-sdio-boundary.patch b/patches.suse/fs-direct-io-fix-missing-sdio-boundary.patch new file mode 100644 index 0000000..5b982b8 --- /dev/null +++ b/patches.suse/fs-direct-io-fix-missing-sdio-boundary.patch @@ -0,0 +1,63 @@ +From df41872b68601059dd4a84858952dcae58acd331 Mon Sep 17 00:00:00 2001 +From: Jack Qiu +Date: Fri, 9 Apr 2021 13:27:35 -0700 +Subject: [PATCH] fs: direct-io: fix missing sdio->boundary +Git-commit: df41872b68601059dd4a84858952dcae58acd331 +Patch-mainline: v5.12-rc7 +References: bsc#1184736 + +I encountered a hung task issue, but not a performance one. I run DIO +on a device (need lba continuous, for example open channel ssd), maybe +hungtask in below case: + + DIO: Checkpoint: + get addr A(at boundary), merge into BIO, + no submit because boundary missing + flush dirty data(get addr A+1), wait IO(A+1) + writeback timeout, because DIO(A) didn't submit + get addr A+2 fail, because checkpoint is doing + +dio_send_cur_page() may clear sdio->boundary, so prevent it from missing +a boundary. + +Link: https://lkml.kernel.org/r/20210322042253.38312-1-jack.qiu@huawei.com +Fixes: b1058b981272 ("direct-io: submit bio after boundary buffer is added to it") +Signed-off-by: Jack Qiu +Reviewed-by: Jan Kara +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Acked-by: Jan Kara + +--- + fs/direct-io.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/fs/direct-io.c b/fs/direct-io.c +index b61491bf3166..b2e86e739d7a 100644 +--- a/fs/direct-io.c ++++ b/fs/direct-io.c +@@ -812,6 +812,7 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page, + struct buffer_head *map_bh) + { + int ret = 0; ++ int boundary = sdio->boundary; /* dio_send_cur_page may clear it */ + + if (dio->op == REQ_OP_WRITE) { + /* +@@ -850,10 +851,10 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page, + sdio->cur_page_fs_offset = sdio->block_in_file << sdio->blkbits; + out: + /* +- * If sdio->boundary then we want to schedule the IO now to ++ * If boundary then we want to schedule the IO now to + * avoid metadata seeks. + */ +- if (sdio->boundary) { ++ if (boundary) { + ret = dio_send_cur_page(dio, sdio, map_bh); + if (sdio->bio) + dio_bio_submit(dio, sdio); +-- +2.26.2 + diff --git a/patches.suse/ibmvnic-Use-skb_frag_address-instead-of-hand-coding-.patch b/patches.suse/ibmvnic-Use-skb_frag_address-instead-of-hand-coding-.patch index e6e7474..e255156 100644 --- a/patches.suse/ibmvnic-Use-skb_frag_address-instead-of-hand-coding-.patch +++ b/patches.suse/ibmvnic-Use-skb_frag_address-instead-of-hand-coding-.patch @@ -4,8 +4,7 @@ Date: Sun, 4 Apr 2021 10:54:37 +0200 Subject: [PATCH] ibmvnic: Use 'skb_frag_address()' instead of hand coding it References: bsc#1184114 ltc#192237 -Patch-mainline: queued -Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git +Patch-mainline: v5.13-rc1 Git-commit: c3105f8485775943b2ccde09c7163510c161c965 'page_address(skb_frag_page()) + skb_frag_off()' can be replaced by an 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/isofs-release-buffer-head-before-return.patch b/patches.suse/isofs-release-buffer-head-before-return.patch new file mode 100644 index 0000000..41c276c --- /dev/null +++ b/patches.suse/isofs-release-buffer-head-before-return.patch @@ -0,0 +1,49 @@ +From 0a6dc67a6aa45f19bd4ff89b4f468fc50c4b8daa Mon Sep 17 00:00:00 2001 +From: Pan Bian +Date: Mon, 18 Jan 2021 04:04:55 -0800 +Subject: [PATCH] isofs: release buffer head before return +Git-commit: 0a6dc67a6aa45f19bd4ff89b4f468fc50c4b8daa +Patch-mainline: v5.12-rc1 +References: bsc#1182613 + +Release the buffer_head before returning error code in +do_isofs_readdir() and isofs_find_entry(). + +Fixes: 2deb1acc653c ("isofs: fix access to unallocated memory when reading corrupted filesystem") +Link: https://lore.kernel.org/r/20210118120455.118955-1-bianpan2016@163.com +Signed-off-by: Pan Bian +Signed-off-by: Jan Kara +Acked-by: Jan Kara + +--- + fs/isofs/dir.c | 1 + + fs/isofs/namei.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c +index f0fe641893a5..b9e6a7ec78be 100644 +--- a/fs/isofs/dir.c ++++ b/fs/isofs/dir.c +@@ -152,6 +152,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *file, + printk(KERN_NOTICE "iso9660: Corrupted directory entry" + " in block %lu of inode %lu\n", block, + inode->i_ino); ++ brelse(bh); + return -EIO; + } + +diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c +index 402769881c32..58f80e1b3ac0 100644 +--- a/fs/isofs/namei.c ++++ b/fs/isofs/namei.c +@@ -102,6 +102,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry, + printk(KERN_NOTICE "iso9660: Corrupted directory entry" + " in block %lu of inode %lu\n", block, + dir->i_ino); ++ brelse(bh); + return 0; + } + +-- +2.26.2 + diff --git a/patches.suse/kvm-add-proper-lockdep-assertion-in-i-o-bus-unregister b/patches.suse/kvm-add-proper-lockdep-assertion-in-i-o-bus-unregister new file mode 100644 index 0000000..b4e3c3c --- /dev/null +++ b/patches.suse/kvm-add-proper-lockdep-assertion-in-i-o-bus-unregister @@ -0,0 +1,47 @@ +From: Sean Christopherson +Date: Mon, 12 Apr 2021 15:20:50 -0700 +Subject: KVM: Add proper lockdep assertion in I/O bus unregister +Git-commit: 7c896d375565a032705f64804f8c1189df1f7a89 +Patch-mainline: v5.13-rc1 +References: CVE-2020-36312 bsc#1184509 + +Convert a comment above kvm_io_bus_unregister_dev() into an actual +lockdep assertion, and opportunistically add curly braces to a multi-line +for-loop. + +Signed-off-by: Sean Christopherson +Message-Id: <20210412222050.876100-4-seanjc@google.com> +Signed-off-by: Paolo Bonzini +Acked-by: Joerg Roedel +--- + virt/kvm/kvm_main.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/virt/kvm/kvm_main.c ++++ b/virt/kvm/kvm_main.c +@@ -3705,21 +3705,23 @@ int kvm_io_bus_register_dev(struct kvm * + return 0; + } + +-/* Caller must hold slots_lock. */ + int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, + struct kvm_io_device *dev) + { + int i, j; + struct kvm_io_bus *new_bus, *bus; + ++ lockdep_assert_held(&kvm->slots_lock); ++ + bus = kvm_get_bus(kvm, bus_idx); + if (!bus) + return 0; + +- for (i = 0; i < bus->dev_count; i++) ++ for (i = 0; i < bus->dev_count; i++) { + if (bus->range[i].dev == dev) { + break; + } ++ } + + if (i == bus->dev_count) + return 0; diff --git a/patches.suse/kvm-destroy-i-o-bus-devices-on-unregister-failure-after_-sync-ing-srcu b/patches.suse/kvm-destroy-i-o-bus-devices-on-unregister-failure-after_-sync-ing-srcu new file mode 100644 index 0000000..a593e10 --- /dev/null +++ b/patches.suse/kvm-destroy-i-o-bus-devices-on-unregister-failure-after_-sync-ing-srcu @@ -0,0 +1,50 @@ +From: Sean Christopherson +Date: Mon, 12 Apr 2021 15:20:48 -0700 +Subject: KVM: Destroy I/O bus devices on unregister failure _after_ sync'ing + SRCU +Git-commit: 2ee3757424be7c1cd1d0bbfa6db29a7edd82a250 +Patch-mainline: v5.13-rc1 +References: CVE-2020-36312 bsc#1184509 + +If allocating a new instance of an I/O bus fails when unregistering a +device, wait to destroy the device until after all readers are guaranteed +to see the new null bus. Destroying devices before the bus is nullified +could lead to use-after-free since readers expect the devices on their +reference of the bus to remain valid. + +Fixes: f65886606c2d ("KVM: fix memory leak in kvm_io_bus_unregister_dev()") +Cc: stable@vger.kernel.org +Signed-off-by: Sean Christopherson +Message-Id: <20210412222050.876100-2-seanjc@google.com> +Signed-off-by: Paolo Bonzini +Acked-by: Joerg Roedel +--- + virt/kvm/kvm_main.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +--- a/virt/kvm/kvm_main.c ++++ b/virt/kvm/kvm_main.c +@@ -3731,7 +3731,13 @@ void kvm_io_bus_unregister_dev(struct kv + new_bus->dev_count--; + memcpy(new_bus->range + i, bus->range + i + 1, + (new_bus->dev_count - i) * sizeof(struct kvm_io_range)); +- } else { ++ } ++ ++ rcu_assign_pointer(kvm->buses[bus_idx], new_bus); ++ synchronize_srcu_expedited(&kvm->srcu); ++ ++ /* Destroy the old bus _after_ installing the (null) bus. */ ++ if (!new_bus) { + pr_err("kvm: failed to shrink bus, removing it completely\n"); + for (j = 0; j < bus->dev_count; j++) { + if (j == i) +@@ -3740,8 +3746,6 @@ void kvm_io_bus_unregister_dev(struct kv + } + } + +- rcu_assign_pointer(kvm->buses[bus_idx], new_bus); +- synchronize_srcu_expedited(&kvm->srcu); + kfree(bus); + return; + } diff --git a/patches.suse/kvm-stop-looking-for-coalesced-mmio-zones-if-the-bus-is-destroyed b/patches.suse/kvm-stop-looking-for-coalesced-mmio-zones-if-the-bus-is-destroyed new file mode 100644 index 0000000..927c70f --- /dev/null +++ b/patches.suse/kvm-stop-looking-for-coalesced-mmio-zones-if-the-bus-is-destroyed @@ -0,0 +1,121 @@ +From: Sean Christopherson +Date: Mon, 12 Apr 2021 15:20:49 -0700 +Subject: KVM: Stop looking for coalesced MMIO zones if the bus is destroyed +Git-commit: 5d3c4c79384af06e3c8e25b7770b6247496b4417 +Patch-mainline: v5.13-rc1 +References: CVE-2020-36312 bsc#1184509 + +Abort the walk of coalesced MMIO zones if kvm_io_bus_unregister_dev() +fails to allocate memory for the new instance of the bus. If it can't +instantiate a new bus, unregister_dev() destroys all devices _except_ the +target device. But, it doesn't tell the caller that it obliterated the +bus and invoked the destructor for all devices that were on the bus. In +the coalesced MMIO case, this can result in a deleted list entry +dereference due to attempting to continue iterating on coalesced_zones +after future entries (in the walk) have been deleted. + +Opportunistically add curly braces to the for-loop, which encompasses +many lines but sneaks by without braces due to the guts being a single +if statement. + +Fixes: f65886606c2d ("KVM: fix memory leak in kvm_io_bus_unregister_dev()") +Cc: stable@vger.kernel.org +Reported-by: Hao Sun +Signed-off-by: Sean Christopherson +Message-Id: <20210412222050.876100-3-seanjc@google.com> +Signed-off-by: Paolo Bonzini +Acked-by: Joerg Roedel +--- + include/linux/kvm_host.h | 4 ++-- + virt/kvm/coalesced_mmio.c | 19 +++++++++++++++++-- + virt/kvm/kvm_main.c | 10 +++++----- + 3 files changed, 24 insertions(+), 9 deletions(-) + +--- a/include/linux/kvm_host.h ++++ b/include/linux/kvm_host.h +@@ -174,8 +174,8 @@ int kvm_io_bus_read(struct kvm_vcpu *vcp + int len, void *val); + int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, + int len, struct kvm_io_device *dev); +-void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, +- struct kvm_io_device *dev); ++int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, ++ struct kvm_io_device *dev); + struct kvm_io_device *kvm_io_bus_get_dev(struct kvm *kvm, enum kvm_bus bus_idx, + gpa_t addr); + +--- a/virt/kvm/coalesced_mmio.c ++++ b/virt/kvm/coalesced_mmio.c +@@ -171,16 +171,31 @@ int kvm_vm_ioctl_unregister_coalesced_mm + struct kvm_coalesced_mmio_zone *zone) + { + struct kvm_coalesced_mmio_dev *dev, *tmp; ++ int r; + + mutex_lock(&kvm->slots_lock); + +- list_for_each_entry_safe(dev, tmp, &kvm->coalesced_zones, list) ++ list_for_each_entry_safe(dev, tmp, &kvm->coalesced_zones, list) { + if (coalesced_mmio_in_range(dev, zone->addr, zone->size)) { +- kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS, &dev->dev); ++ r = kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS, &dev->dev); + kvm_iodevice_destructor(&dev->dev); ++ ++ /* ++ * On failure, unregister destroys all devices on the ++ * bus _except_ the target device, i.e. coalesced_zones ++ * has been modified. No need to restart the walk as ++ * there aren't any zones left. ++ */ ++ if (r) ++ break; + } ++ } + + mutex_unlock(&kvm->slots_lock); + ++ /* ++ * Ignore the result of kvm_io_bus_unregister_dev(), from userspace's ++ * perspective, the coalesced MMIO is most definitely unregistered. ++ */ + return 0; + } +--- a/virt/kvm/kvm_main.c ++++ b/virt/kvm/kvm_main.c +@@ -3706,15 +3706,15 @@ int kvm_io_bus_register_dev(struct kvm * + } + + /* Caller must hold slots_lock. */ +-void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, +- struct kvm_io_device *dev) ++int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, ++ struct kvm_io_device *dev) + { + int i, j; + struct kvm_io_bus *new_bus, *bus; + + bus = kvm_get_bus(kvm, bus_idx); + if (!bus) +- return; ++ return 0; + + for (i = 0; i < bus->dev_count; i++) + if (bus->range[i].dev == dev) { +@@ -3722,7 +3722,7 @@ void kvm_io_bus_unregister_dev(struct kv + } + + if (i == bus->dev_count) +- return; ++ return 0; + + new_bus = kmalloc(sizeof(*bus) + ((bus->dev_count - 1) * + sizeof(struct kvm_io_range)), GFP_KERNEL); +@@ -3747,7 +3747,7 @@ void kvm_io_bus_unregister_dev(struct kv + } + + kfree(bus); +- return; ++ return new_bus ? 0 : -ENOMEM; + } + + struct kvm_io_device *kvm_io_bus_get_dev(struct kvm *kvm, enum kvm_bus bus_idx, diff --git a/patches.suse/mm-fix-memory_failure-handling-of-dax-namespace-meta.patch b/patches.suse/mm-fix-memory_failure-handling-of-dax-namespace-meta.patch new file mode 100644 index 0000000..92ed249 --- /dev/null +++ b/patches.suse/mm-fix-memory_failure-handling-of-dax-namespace-meta.patch @@ -0,0 +1,91 @@ +From 34dc45be4563f344d59ba0428416d0d265aa4f4d Mon Sep 17 00:00:00 2001 +From: Dan Williams +Date: Thu, 25 Feb 2021 17:17:08 -0800 +Subject: [PATCH] mm: fix memory_failure() handling of dax-namespace metadata +Git-commit: 34dc45be4563f344d59ba0428416d0d265aa4f4d +Patch-mainline: v5.12-rc1 +References: bsc#1185335 + +Given 'struct dev_pagemap' spans both data pages and metadata pages be +careful to consult the altmap if present to delineate metadata. In fact +the pfn_first() helper already identifies the first valid data pfn, so +export that helper for other code paths via pgmap_pfn_valid(). + +Other usage of get_dev_pagemap() are not a concern because those are +operating on known data pfns having been looked up by get_user_pages(). +I.e. metadata pfns are never user mapped. + +Link: https://lkml.kernel.org/r/161058501758.1840162.4239831989762604527.stgit@dwillia2-desk3.amr.corp.intel.com +Fixes: 6100e34b2526 ("mm, memory_failure: Teach memory_failure() about dev_pagemap pages") +Signed-off-by: Dan Williams +Reported-by: David Hildenbrand +Reviewed-by: David Hildenbrand +Reviewed-by: Naoya Horiguchi +Cc: Michal Hocko +Cc: Oscar Salvador +Cc: Qian Cai +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Acked-by: Jan Kara + +--- + include/linux/memremap.h | 6 ++++++ + kernel/memremap.c | 9 +++++++++ + mm/memory-failure.c | 6 ++++++ + 3 files changed, 21 insertions(+) + +--- a/include/linux/memremap.h ++++ b/include/linux/memremap.h +@@ -135,6 +135,7 @@ void *devm_memremap_pages(struct device + void devm_memunmap_pages(struct device *dev, struct dev_pagemap *pgmap); + struct dev_pagemap *get_dev_pagemap(unsigned long pfn, + struct dev_pagemap *pgmap); ++bool pgmap_pfn_valid(struct dev_pagemap *pgmap, unsigned long pfn); + + unsigned long vmem_altmap_offset(struct vmem_altmap *altmap); + void vmem_altmap_free(struct vmem_altmap *altmap, unsigned long nr_pfns); +@@ -162,6 +163,11 @@ static inline struct dev_pagemap *get_de + return NULL; + } + ++static inline bool pgmap_pfn_valid(struct dev_pagemap *pgmap, unsigned long pfn) ++{ ++ return false; ++} ++ + static inline unsigned long vmem_altmap_offset(struct vmem_altmap *altmap) + { + return 0; +--- a/kernel/memremap.c ++++ b/kernel/memremap.c +@@ -269,6 +269,15 @@ static unsigned long pfn_first(struct de + return pfn; + } + ++bool pgmap_pfn_valid(struct dev_pagemap *pgmap, unsigned long pfn) ++{ ++ const struct resource *res = &pgmap->res; ++ ++ if (pfn >= PHYS_PFN(res->start) && pfn <= PHYS_PFN(res->end)) ++ return pfn >= pfn_first(pgmap); ++ return false; ++} ++ + static unsigned long pfn_end(struct dev_pagemap *pgmap) + { + const struct resource *res = &pgmap->res; +--- a/mm/memory-failure.c ++++ b/mm/memory-failure.c +@@ -1177,6 +1177,12 @@ static int memory_failure_dev_pagemap(un + */ + put_page(page); + ++ /* device metadata space is not recoverable */ ++ if (!pgmap_pfn_valid(pgmap, pfn)) { ++ rc = -ENXIO; ++ goto out; ++ } ++ + /* + * Prevent the inode from being freed while we are interrogating + * the address_space, typically this would be handled by diff --git a/patches.suse/net-bcmgenet-use-hardware-padding-of-runt-frames.patch b/patches.suse/net-bcmgenet-use-hardware-padding-of-runt-frames.patch new file mode 100644 index 0000000..09a2c01 --- /dev/null +++ b/patches.suse/net-bcmgenet-use-hardware-padding-of-runt-frames.patch @@ -0,0 +1,64 @@ +From 3cae45f6c0c1bd54aec08d14ab4d9272b1f433e5 Mon Sep 17 00:00:00 2001 +From: Doug Berger +Date: Wed, 24 Jun 2020 18:14:55 -0700 +Subject: [PATCH 1/4] net: bcmgenet: use hardware padding of runt frames +Patch-mainline: v5.8-rc3 +Git-commit: 20d1f2d1b024f6be199a3bedf1578a1d21592bc5 +References: git-fixes + +When commit 474ea9cafc45 ("net: bcmgenet: correctly pad short +packets") added the call to skb_padto() it should have been +located before the nr_frags parameter was read since that value +could be changed when padding packets with lengths between 55 +and 59 bytes (inclusive). + +The use of a stale nr_frags value can cause corruption of the +pad data when tx-scatter-gather is enabled. This corruption of +the pad can cause invalid checksum computation when hardware +offload of tx-checksum is also enabled. + +Since the original reason for the padding was corrected by +commit 7dd399130efb ("net: bcmgenet: fix skb_len in +bcmgenet_xmit_single()") we can remove the software padding all +together and make use of hardware padding of short frames as +long as the hardware also always appends the FCS value to the +frame. + +Fixes: 474ea9cafc45 ("net: bcmgenet: correctly pad short packets") +Signed-off-by: Doug Berger +Acked-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/broadcom/genet/bcmgenet.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c +index db7c89c28fb0..18a0da74089d 100644 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c +@@ -2057,11 +2057,6 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) + goto out; + } + +- if (skb_padto(skb, ETH_ZLEN)) { +- ret = NETDEV_TX_OK; +- goto out; +- } +- + /* Retain how many bytes will be sent on the wire, without TSB inserted + * by transmit checksum offload + */ +@@ -2110,6 +2105,9 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) + len_stat = (size << DMA_BUFLENGTH_SHIFT) | + (priv->hw_params->qtag_mask << DMA_TX_QTAG_SHIFT); + ++ /* Note: if we ever change from DMA_TX_APPEND_CRC below we ++ * will need to restore software padding of "runt" packets ++ */ + if (!i) { + len_stat |= DMA_TX_APPEND_CRC | DMA_SOP; + if (skb->ip_summed == CHECKSUM_PARTIAL) +-- +2.16.4 + diff --git a/patches.suse/net-cxgb4-fix-return-error-value-in-t4_prep_fw.patch b/patches.suse/net-cxgb4-fix-return-error-value-in-t4_prep_fw.patch new file mode 100644 index 0000000..7d3fee4 --- /dev/null +++ b/patches.suse/net-cxgb4-fix-return-error-value-in-t4_prep_fw.patch @@ -0,0 +1,57 @@ +From 7de206b87e7df9596df981d9ef010b0449949ee2 Mon Sep 17 00:00:00 2001 +From: Li Heng +Date: Mon, 29 Jun 2020 18:49:51 +0800 +Subject: [PATCH 2/4] net: cxgb4: fix return error value in t4_prep_fw +Patch-mainline: v5.8-rc5 +Git-commit: 8a259e6b73ad8181b0b2ef338b35043433db1075 +References: git-fixes + +t4_prep_fw goto bye tag with positive return value when something +bad happened and which can not free resource in adap_init0. +so fix it to return negative value. + +Fixes: 16e47624e76b ("cxgb4: Add new scheme to update T4/T5 firmware") +Reported-by: Hulk Robot +Signed-off-by: Li Heng +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +index 3289627f03eb..270098ca17a7 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +@@ -3500,7 +3500,7 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, + drv_fw = &fw_info->fw_hdr; + + /* Read the header of the firmware on the card */ +- ret = -t4_read_flash(adap, FLASH_FW_START, ++ ret = t4_read_flash(adap, FLASH_FW_START, + sizeof(*card_fw) / sizeof(uint32_t), + (uint32_t *)card_fw, 1); + if (ret == 0) { +@@ -3529,8 +3529,8 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, + should_install_fs_fw(adap, card_fw_usable, + be32_to_cpu(fs_fw->fw_ver), + be32_to_cpu(card_fw->fw_ver))) { +- ret = -t4_fw_upgrade(adap, adap->mbox, fw_data, +- fw_size, 0); ++ ret = t4_fw_upgrade(adap, adap->mbox, fw_data, ++ fw_size, 0); + if (ret != 0) { + dev_err(adap->pdev_dev, + "failed to install firmware: %d\n", ret); +@@ -3561,7 +3561,7 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, + FW_HDR_FW_VER_MICRO_G(c), FW_HDR_FW_VER_BUILD_G(c), + FW_HDR_FW_VER_MAJOR_G(k), FW_HDR_FW_VER_MINOR_G(k), + FW_HDR_FW_VER_MICRO_G(k), FW_HDR_FW_VER_BUILD_G(k)); +- ret = EINVAL; ++ ret = -EINVAL; + goto bye; + } + +-- +2.16.4 + diff --git a/patches.suse/net-fix-race-condition-in-__inet_lookup_established.patch b/patches.suse/net-fix-race-condition-in-__inet_lookup_established.patch index d85ebb4..c758848 100644 --- a/patches.suse/net-fix-race-condition-in-__inet_lookup_established.patch +++ b/patches.suse/net-fix-race-condition-in-__inet_lookup_established.patch @@ -2,7 +2,7 @@ From: Firo Yang Date: Mon, 20 Apr 2020 17:10:01 +0200 Subject: net: fix race condition in __inet_lookup_established() Patch-mainline: Never, mainline solution (v5.5-rc3) too intrusive -References: bsc#1151794 +References: bsc#1151794 bsc#1180624 Listening and established sockets share the same slab cache which has SLAB_TYPESAFE_BY_RCU flag set but this only protects from a slab page being @@ -14,7 +14,9 @@ a listening one. Since commit 3b24d854cb35 ("tcp/dccp: do not touch listener sk_refcnt under synflood"), listener hashtable no longer uses "nulls" lists so that after such switch, sk_nulls_for_each_rcu() loop in __inet_lookup_established() -would hit NULL as end marker which it would fail to recognize. +would hit NULL as end marker which it would fail to recognize. Analogously, +__inet_lookup_listener() and inet_diag_dump_icsk() may hit an opposite +switch from a listener socket to an established one. The upstream solution, commit 8dbd76e79a16 ("tcp/dccp: fix possible race __inet_lookup_established()"), is rather intrusive and would break kABI @@ -22,21 +24,69 @@ in a way which would be impossible to work around reliably. Therefore we use a simpler patch which is safer at the expense of a minor performance penalty. +For testing purpose, add a temporary debugging message whenever a race +resulting in a switch from an established socket to a listener or vice +versa is detected. + Fixes: 3b24d854cb35 ("tcp/dccp: do not touch listener sk_refcnt under synflood") Signed-off-by: Firo Yang Signed-off-by: Michal Kubecek --- - net/ipv4/inet_hashtables.c | 2 ++ - 1 file changed, 2 insertions(+) + net/ipv4/inet_diag.c | 5 +++++ + net/ipv4/inet_hashtables.c | 21 ++++++++++++++++++--- + 2 files changed, 23 insertions(+), 3 deletions(-) +--- a/net/ipv4/inet_diag.c ++++ b/net/ipv4/inet_diag.c +@@ -884,6 +884,11 @@ void inet_diag_dump_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *skb, + sk_for_each(sk, &ilb->head) { + struct inet_sock *inet = inet_sk(sk); + ++ if (unlikely(is_a_nulls(&sk->sk_nulls_node))) { ++ pr_info("%s: bsc#1180624 race encountered\n", ++ __func__); ++ break; ++ } + if (!net_eq(sock_net(sk), net)) + continue; + --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c -@@ -283,6 +283,8 @@ struct sock *__inet_lookup_established(struct net *net, +@@ -212,12 +212,23 @@ struct sock *__inet_lookup_listener(struct net *net, + { + unsigned int hash = inet_lhashfn(net, hnum); + struct inet_listen_hashbucket *ilb = &hashinfo->listening_hash[hash]; +- int score, hiscore = 0, matches = 0, reuseport = 0; ++ int score, hiscore, matches, reuseport; + bool exact_dif = inet_exact_dif_match(net, skb); +- struct sock *sk, *result = NULL; +- u32 phash = 0; ++ struct sock *sk, *result; ++ u32 phash; ++ ++begin: ++ hiscore = 0; ++ matches = 0; ++ reuseport = 0; ++ result = NULL; ++ phash = 0; + + sk_for_each_rcu(sk, &ilb->head) { ++ if (unlikely(is_a_nulls(&sk->sk_nulls_node))) { ++ pr_info("%s: bsc#1180624 race encountered\n", __func__); ++ goto begin; ++ } + score = compute_score(sk, net, hnum, daddr, dif, exact_dif); + if (score > hiscore) { + reuseport = sk->sk_reuseport; +@@ -283,6 +294,10 @@ struct sock *__inet_lookup_established(struct net *net, begin: sk_nulls_for_each_rcu(sk, node, &head->chain) { -+ if (unlikely(!node)) ++ if (unlikely(!node)) { ++ pr_info("%s: bsc#1151794 race encountered\n", __func__); + goto begin; ++ } if (sk->sk_hash != hash) continue; if (likely(INET_MATCH(sk, net, acookie, diff --git a/patches.suse/ocfs2-fix-a-use-after-free-on-error.patch b/patches.suse/ocfs2-fix-a-use-after-free-on-error.patch new file mode 100644 index 0000000..b3464e9 --- /dev/null +++ b/patches.suse/ocfs2-fix-a-use-after-free-on-error.patch @@ -0,0 +1,60 @@ +From c57d117f2b2f2a19b570c36f2819ef8d8210af20 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 24 Feb 2021 12:00:41 -0800 +Subject: [PATCH] ocfs2: fix a use after free on error +Git-commit: c57d117f2b2f2a19b570c36f2819ef8d8210af20 +Patch-mainline: v5.12-rc1 +References: bsc#1184738 + +The error handling in this function frees "reg" but it is still on the +"o2hb_all_regions" list so it will lead to a use after freew. Joseph Qi +points out that we need to clear the bit in the "o2hb_region_bitmap" as +well + +Link: https://lkml.kernel.org/r/YBk4M6HUG8jB/jc7@mwanda +Fixes: 1cf257f51191 ("ocfs2: fix memory leak") +Signed-off-by: Dan Carpenter +Reviewed-by: Joseph Qi +Cc: Mark Fasheh +Cc: Joel Becker +Cc: Junxiao Bi +Cc: Changwei Ge +Cc: Gang He +Cc: Jun Piao +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Acked-by: Jan Kara + +--- + fs/ocfs2/cluster/heartbeat.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c +index 0179a73a3fa2..12a7590601dd 100644 +--- a/fs/ocfs2/cluster/heartbeat.c ++++ b/fs/ocfs2/cluster/heartbeat.c +@@ -2042,7 +2042,7 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g + o2hb_nego_timeout_handler, + reg, NULL, ®->hr_handler_list); + if (ret) +- goto free; ++ goto remove_item; + + ret = o2net_register_handler(O2HB_NEGO_APPROVE_MSG, reg->hr_key, + sizeof(struct o2hb_nego_msg), +@@ -2057,6 +2057,12 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g + + unregister_handler: + o2net_unregister_handler_list(®->hr_handler_list); ++remove_item: ++ spin_lock(&o2hb_live_lock); ++ list_del(®->hr_all_item); ++ if (o2hb_global_heartbeat_active()) ++ clear_bit(reg->hr_region_num, o2hb_region_bitmap); ++ spin_unlock(&o2hb_live_lock); + free: + kfree(reg); + return ERR_PTR(ret); +-- +2.26.2 + diff --git a/patches.suse/ocfs2-fix-deadlock-between-setattr-and-dio_end_io_wr.patch b/patches.suse/ocfs2-fix-deadlock-between-setattr-and-dio_end_io_wr.patch new file mode 100644 index 0000000..e79e3a8 --- /dev/null +++ b/patches.suse/ocfs2-fix-deadlock-between-setattr-and-dio_end_io_wr.patch @@ -0,0 +1,155 @@ +From 90bd070aae6c4fb5d302f9c4b9c88be60c8197ec Mon Sep 17 00:00:00 2001 +From: Wengang Wang +Date: Fri, 9 Apr 2021 13:27:29 -0700 +Subject: [PATCH] ocfs2: fix deadlock between setattr and dio_end_io_write +Git-commit: 90bd070aae6c4fb5d302f9c4b9c88be60c8197ec +Patch-mainline: v5.12-rc7 +References: bsc#1185197 + +The following deadlock is detected: + + truncate -> setattr path is waiting for pending direct IO to be done (inode->i_dio_count become zero) with inode->i_rwsem held (down_write). + + PID: 14827 TASK: ffff881686a9af80 CPU: 20 COMMAND: "ora_p005_hrltd9" + #0 __schedule at ffffffff818667cc + #1 schedule at ffffffff81866de6 + #2 inode_dio_wait at ffffffff812a2d04 + #3 ocfs2_setattr at ffffffffc05f322e [ocfs2] + #4 notify_change at ffffffff812a5a09 + #5 do_truncate at ffffffff812808f5 + #6 do_sys_ftruncate.constprop.18 at ffffffff81280cf2 + #7 sys_ftruncate at ffffffff81280d8e + #8 do_syscall_64 at ffffffff81003949 + #9 entry_SYSCALL_64_after_hwframe at ffffffff81a001ad + +dio completion path is going to complete one direct IO (decrement +inode->i_dio_count), but before that it hung at locking inode->i_rwsem: + + #0 __schedule+700 at ffffffff818667cc + #1 schedule+54 at ffffffff81866de6 + #2 rwsem_down_write_failed+536 at ffffffff8186aa28 + #3 call_rwsem_down_write_failed+23 at ffffffff8185a1b7 + #4 down_write+45 at ffffffff81869c9d + #5 ocfs2_dio_end_io_write+180 at ffffffffc05d5444 [ocfs2] + #6 ocfs2_dio_end_io+85 at ffffffffc05d5a85 [ocfs2] + #7 dio_complete+140 at ffffffff812c873c + #8 dio_aio_complete_work+25 at ffffffff812c89f9 + #9 process_one_work+361 at ffffffff810b1889 + #10 worker_thread+77 at ffffffff810b233d + #11 kthread+261 at ffffffff810b7fd5 + #12 ret_from_fork+62 at ffffffff81a0035e + +Thus above forms ABBA deadlock. The same deadlock was mentioned in +upstream commit 28f5a8a7c033 ("ocfs2: should wait dio before inode lock +in ocfs2_setattr()"). It seems that that commit only removed the +cluster lock (the victim of above dead lock) from the ABBA deadlock +party. + +End-user visible effects: Process hang in truncate -> ocfs2_setattr path +and other processes hang at ocfs2_dio_end_io_write path. + +This is to fix the deadlock itself. It removes inode_lock() call from +dio completion path to remove the deadlock and add ip_alloc_sem lock in +setattr path to synchronize the inode modifications. + +[wen.gang.wang@oracle.com: remove the "had_alloc_lock" as suggested] + Link: https://lkml.kernel.org/r/20210402171344.1605-1-wen.gang.wang@oracle.com + +Link: https://lkml.kernel.org/r/20210331203654.3911-1-wen.gang.wang@oracle.com +Signed-off-by: Wengang Wang +Reviewed-by: Joseph Qi +Cc: Mark Fasheh +Cc: Joel Becker +Cc: Junxiao Bi +Cc: Changwei Ge +Cc: Gang He +Cc: Jun Piao +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Acked-by: Jan Kara + +--- + fs/ocfs2/aops.c | 11 +---------- + fs/ocfs2/file.c | 8 ++++++-- + 2 files changed, 7 insertions(+), 12 deletions(-) + +diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c +index 3bfb4147895a..ad20403b383f 100644 +--- a/fs/ocfs2/aops.c ++++ b/fs/ocfs2/aops.c +@@ -2295,7 +2295,7 @@ static int ocfs2_dio_end_io_write(struct inode *inode, + struct ocfs2_alloc_context *meta_ac = NULL; + handle_t *handle = NULL; + loff_t end = offset + bytes; +- int ret = 0, credits = 0, locked = 0; ++ int ret = 0, credits = 0; + + ocfs2_init_dealloc_ctxt(&dealloc); + +@@ -2306,13 +2306,6 @@ static int ocfs2_dio_end_io_write(struct inode *inode, + !dwc->dw_orphaned) + goto out; + +- /* ocfs2_file_write_iter will get i_mutex, so we need not lock if we +- * are in that context. */ +- if (dwc->dw_writer_pid != task_pid_nr(current)) { +- inode_lock(inode); +- locked = 1; +- } +- + ret = ocfs2_inode_lock(inode, &di_bh, 1); + if (ret < 0) { + mlog_errno(ret); +@@ -2393,8 +2386,6 @@ static int ocfs2_dio_end_io_write(struct inode *inode, + if (meta_ac) + ocfs2_free_alloc_context(meta_ac); + ocfs2_run_deallocs(osb, &dealloc); +- if (locked) +- inode_unlock(inode); + ocfs2_dio_free_write_ctx(inode, dwc); + + return ret; +diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c +index 6611c64ca0be..5edc1d0cf115 100644 +--- a/fs/ocfs2/file.c ++++ b/fs/ocfs2/file.c +@@ -1245,22 +1245,24 @@ int ocfs2_setattr(struct user_namespace *mnt_userns, struct dentry *dentry, + goto bail_unlock; + } + } ++ down_write(&OCFS2_I(inode)->ip_alloc_sem); + handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS + + 2 * ocfs2_quota_trans_credits(sb)); + if (IS_ERR(handle)) { + status = PTR_ERR(handle); + mlog_errno(status); +- goto bail_unlock; ++ goto bail_unlock_alloc; + } + status = __dquot_transfer(inode, transfer_to); + if (status < 0) + goto bail_commit; + } else { ++ down_write(&OCFS2_I(inode)->ip_alloc_sem); + handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); + if (IS_ERR(handle)) { + status = PTR_ERR(handle); + mlog_errno(status); +- goto bail_unlock; ++ goto bail_unlock_alloc; + } + } + +@@ -1273,6 +1275,8 @@ int ocfs2_setattr(struct user_namespace *mnt_userns, struct dentry *dentry, + + bail_commit: + ocfs2_commit_trans(osb, handle); ++bail_unlock_alloc: ++ up_write(&OCFS2_I(inode)->ip_alloc_sem); + bail_unlock: + if (status && inode_locked) { + ocfs2_inode_unlock_tracker(inode, 1, &oh, had_lock); +-- +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..8822470 --- /dev/null +++ b/patches.suse/powerpc-64s-Fix-pte-update-for-kernel-memory-on-radi.patch @@ -0,0 +1,140 @@ +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 +[Don't have early_map_kernel_page on 4.12] +Acked-by: Michal Suchanek +--- + arch/powerpc/include/asm/book3s/64/radix.h | 6 ++++-- + arch/powerpc/mm/pgtable-radix.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/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c +index 8b8f1451e944..55f26c0e389e 100644 +--- a/arch/powerpc/mm/pgtable-radix.c ++++ b/arch/powerpc/mm/pgtable-radix.c +@@ -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(pa >> PAGE_SHIFT, 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-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..01d5d5b --- /dev/null +++ b/patches.suse/powerpc-fadump-Mark-fadump_calculate_reserve_size-as.patch @@ -0,0 +1,55 @@ +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 +--- 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 unsigned long fadump_calculate_reserve_size(void) ++static __init unsigned long fadump_calculate_reserve_size(void) + { + int ret; + unsigned long long base, size; +-- +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 eb8a275..9eec117 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-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-pseries-extract-host-bridge-from-pci_bus-pri.patch b/patches.suse/powerpc-pseries-extract-host-bridge-from-pci_bus-pri.patch index 46c7e53..352c058 100644 --- a/patches.suse/powerpc-pseries-extract-host-bridge-from-pci_bus-pri.patch +++ b/patches.suse/powerpc-pseries-extract-host-bridge-from-pci_bus-pri.patch @@ -5,8 +5,7 @@ Subject: [PATCH] powerpc/pseries: extract host bridge from pci_bus prior to bus removal References: bsc#1182171 ltc#190900 -Patch-mainline: queued -Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git +Patch-mainline: v5.13-rc1 Git-commit: 38d0b1c9cec71e6d0f3bddef0bbce41d05a3e796 The pci_bus->bridge reference may no longer be valid after diff --git a/patches.suse/reiserfs-update-reiserfs_xattrs_initialized-conditio.patch b/patches.suse/reiserfs-update-reiserfs_xattrs_initialized-conditio.patch new file mode 100644 index 0000000..243cbb3 --- /dev/null +++ b/patches.suse/reiserfs-update-reiserfs_xattrs_initialized-conditio.patch @@ -0,0 +1,57 @@ +From 5e46d1b78a03d52306f21f77a4e4a144b6d31486 Mon Sep 17 00:00:00 2001 +From: Tetsuo Handa +Date: Sun, 21 Mar 2021 23:37:49 +0900 +Subject: [PATCH] reiserfs: update reiserfs_xattrs_initialized() condition +Git-commit: 5e46d1b78a03d52306f21f77a4e4a144b6d31486 +Patch-mainline: v5.12-rc6 +References: bsc#1184737 + +syzbot is reporting NULL pointer dereference at reiserfs_security_init() +[1], for commit ab17c4f02156c4f7 ("reiserfs: fixup xattr_root caching") +is assuming that REISERFS_SB(s)->xattr_root != NULL in +reiserfs_xattr_jcreate_nblocks() despite that commit made +REISERFS_SB(sb)->priv_root != NULL && REISERFS_SB(s)->xattr_root == NULL +case possible. + +I guess that commit 6cb4aff0a77cc0e6 ("reiserfs: fix oops while creating +privroot with selinux enabled") wanted to check xattr_root != NULL +before reiserfs_xattr_jcreate_nblocks(), for the changelog is talking +about the xattr root. + + The issue is that while creating the privroot during mount + reiserfs_security_init calls reiserfs_xattr_jcreate_nblocks which + dereferences the xattr root. The xattr root doesn't exist, so we get + an oops. + +Therefore, update reiserfs_xattrs_initialized() to check both the +privroot and the xattr root. + +Link: https://syzkaller.appspot.com/bug?id=8abaedbdeb32c861dc5340544284167dd0e46cde # [1] +Reported-and-tested-by: syzbot +Signed-off-by: Tetsuo Handa +Fixes: 6cb4aff0a77c ("reiserfs: fix oops while creating privroot with selinux enabled") +Acked-by: Jeff Mahoney +Acked-by: Jan Kara +Signed-off-by: Linus Torvalds +Acked-by: Jan Kara + +--- + fs/reiserfs/xattr.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/reiserfs/xattr.h b/fs/reiserfs/xattr.h +index 9b3b06da568c..e47fde1182de 100644 +--- a/fs/reiserfs/xattr.h ++++ b/fs/reiserfs/xattr.h +@@ -44,7 +44,7 @@ void reiserfs_security_free(struct reiserfs_security_handle *sec); + + static inline int reiserfs_xattrs_initialized(struct super_block *sb) + { +- return REISERFS_SB(sb)->priv_root != NULL; ++ return REISERFS_SB(sb)->priv_root && REISERFS_SB(sb)->xattr_root; + } + + #define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header)) +-- +2.26.2 + diff --git a/patches.suse/scsi-ibmvfc-Fix-invalid-state-machine-BUG_ON.patch b/patches.suse/scsi-ibmvfc-Fix-invalid-state-machine-BUG_ON.patch index 0c6a91a..645c628 100644 --- a/patches.suse/scsi-ibmvfc-Fix-invalid-state-machine-BUG_ON.patch +++ b/patches.suse/scsi-ibmvfc-Fix-invalid-state-machine-BUG_ON.patch @@ -4,8 +4,7 @@ Date: Mon, 12 Apr 2021 18:10:09 -0600 Subject: [PATCH] scsi: ibmvfc: Fix invalid state machine BUG_ON() References: bsc#1184647 ltc#191231 -Patch-mainline: queued -Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git +Patch-mainline: v5.13-rc1 Git-commit: 15cfef8623a449d40d16541687afd58e78033be3 This fixes an issue hitting the BUG_ON() in ibmvfc_do_work(). When going 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..2897feb --- /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 +@@ -2275,14 +2275,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; + } + +@@ -2726,8 +2726,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; + } + +@@ -5167,8 +5167,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; +@@ -6005,8 +6005,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..40643b1 --- /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 +@@ -937,7 +937,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..465fc7d --- /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 +[dwagner: context updated] +Acked-by: Daniel Wagner +--- + drivers/scsi/lpfc/lpfc_els.c | 24 +++++++++--------------- + drivers/scsi/lpfc/lpfc_init.c | 26 ++++++++++---------------- + drivers/scsi/lpfc/lpfc_nvmet.c | 25 +++++++++++-------------- + 3 files changed, 30 insertions(+), 45 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 +@@ -1046,12 +1046,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; +@@ -1060,11 +1059,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]; +@@ -3807,12 +3807,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; +@@ -3820,8 +3818,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 */ +@@ -3836,8 +3833,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", +@@ -7391,11 +7387,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 +@@ -1212,7 +1212,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; + +@@ -1559,8 +1562,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) { +@@ -1578,10 +1580,10 @@ lpfc_sli4_nvmet_xri_aborted(struct lpfc_ + } + ctxp->flag &= ~LPFC_NVMET_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 || +@@ -1602,9 +1604,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) { + /* +@@ -1648,8 +1648,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) { +@@ -1658,8 +1657,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_NVMET_ABTS_RCV; +@@ -1679,9 +1678,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 560e787..3c2ecd9 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..5d7e2b3 --- /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 +@@ -9504,7 +9504,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. +@@ -10290,7 +10290,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 +@@ -14039,7 +14039,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 +@@ -14613,7 +14613,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. +@@ -17087,7 +17087,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. + * +@@ -18808,7 +18808,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..5a743d1 --- /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 +@@ -867,7 +867,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. +@@ -3828,7 +3828,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. + * +@@ -4014,7 +4014,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. +@@ -4470,7 +4470,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. +@@ -4874,7 +4874,7 @@ static DEVICE_ATTR(lpfc_sriov_nr_virtfn, + lpfc_sriov_nr_virtfn_show, lpfc_sriov_nr_virtfn_store); + + /** +- * 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. +@@ -5181,7 +5181,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..2bffb78 --- /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 +@@ -3585,7 +3585,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 +@@ -3874,7 +3874,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. + * @mb: Pointer to a BSG mailbox object. + * @nemb_tp: Enumerate of non-embedded mailbox command type. +@@ -4364,7 +4364,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..014ec69 --- /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 +@@ -5161,7 +5161,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) +@@ -5212,7 +5212,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) +@@ -5284,7 +5284,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 843bb45..c0b6ffe 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..038ff33 --- /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 +@@ -1892,8 +1892,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 +@@ -17943,7 +17943,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 f3d40bf..4bb21b3 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..b4bdde1 --- /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 +@@ -1688,8 +1688,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; + } +@@ -6753,15 +6752,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)); +@@ -6785,15 +6788,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; +@@ -6871,15 +6878,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)); +@@ -6889,15 +6900,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 +@@ -9657,8 +9657,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; + } +@@ -9674,8 +9673,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) +@@ -10273,8 +10271,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 +@@ -5544,12 +5544,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; + } + +@@ -5650,12 +5648,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; + } + +@@ -16951,8 +16947,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, +@@ -17049,7 +17044,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, +@@ -17246,7 +17243,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, +@@ -17359,7 +17358,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, +@@ -18710,8 +18711,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 " +@@ -19955,7 +19955,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..5356590 --- /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 +@@ -138,11 +138,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. +@@ -273,7 +273,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..9904f00 --- /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 +@@ -515,11 +515,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..8437149 --- /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 +@@ -11676,13 +11676,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 3256612..5252f92 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..972a6c5 --- /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 +@@ -1482,7 +1482,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..1319168 --- /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 +@@ -384,7 +384,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..118a81c --- /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 +@@ -1855,7 +1855,7 @@ lpfc_release_nvme_buf(struct lpfc_hba *p + + /** + * lpfc_nvme_create_localport - Create/Bind an nvme localport instance. +- * @pvport - 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..0fc943b --- /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 +@@ -5775,7 +5775,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) { +@@ -5814,7 +5816,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; +@@ -7375,7 +7382,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..fb10559 --- /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 +@@ -2254,12 +2254,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) { +@@ -2307,23 +2307,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; + } +@@ -2370,10 +2371,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 +@@ -5949,10 +5949,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 b5ff1e5..0176f41 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 df5b45a..b7da83a 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 94b7f51..c6afed2 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..f14f7f1 --- /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 +@@ -354,8 +354,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 +@@ -142,11 +142,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); + } + + /* +@@ -301,8 +298,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 +@@ -2550,12 +2550,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 +@@ -11516,7 +11516,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) { +@@ -11814,7 +11814,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. +@@ -11829,18 +11828,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) +@@ -11854,8 +11857,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..0805f8b --- /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 +@@ -2440,8 +2440,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..6816a12 --- /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 +@@ -2424,7 +2424,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') && +@@ -2433,7 +2433,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 db78046..694176a 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..346bec4 --- /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 +@@ -490,8 +490,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; + +@@ -1177,8 +1177,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; + } +@@ -5889,7 +5888,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). +@@ -5914,7 +5913,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 +@@ -3883,7 +3883,7 @@ lpfc_bsg_sli_cfg_dma_desc_setup(struct l + * @dmabuff: Pointer to a DMA buffer descriptor. + * + * This routine performs SLI_CONFIG (0x9B) read mailbox command operation with +- * non-embedded external bufffers. ++ * non-embedded external bufffer. + **/ + static int + lpfc_bsg_sli_cfg_read_cmd_ext(struct lpfc_hba *phba, struct bsg_job *job, +@@ -4071,7 +4071,7 @@ lpfc_bsg_sli_cfg_read_cmd_ext(struct lpf + * @dmabuff: Pointer to a DMA buffer descriptor. + * + * This routine performs SLI_CONFIG (0x9B) write mailbox command operation with +- * non-embedded external bufffers. ++ * non-embedded external bufffer. + **/ + static int + lpfc_bsg_sli_cfg_write_cmd_ext(struct lpfc_hba *phba, struct bsg_job *job, +@@ -4215,7 +4215,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, +@@ -4237,8 +4237,8 @@ lpfc_bsg_sli_cfg_write_cmd_ext(struct lp + * @dmabuff: 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, +@@ -4562,7 +4562,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); +@@ -4628,7 +4628,7 @@ lpfc_bsg_handle_sli_cfg_ebuf(struct lpfc + * @mb: Pointer to a BSG mailbox object. + * @dmabuff: 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 +@@ -4706,7 +4706,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 +@@ -342,7 +342,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, +@@ -351,7 +351,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 +@@ -938,7 +938,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. +@@ -960,7 +960,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. +@@ -14723,7 +14723,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 +@@ -17978,7 +17978,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 7abbd05..a56628f 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..7bc64d4 --- /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 +@@ -56,9 +56,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 +@@ -6572,8 +6572,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; +@@ -6807,32 +6805,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 +@@ -12069,78 +12041,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. +@@ -12199,7 +12099,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..c41fad6 --- /dev/null +++ b/patches.suse/scsi-lpfc-Standardize-discovery-object-logging-forma.patch @@ -0,0 +1,183 @@ +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 +[dwagner: context updated, dropped a few hunks due missing code] +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 | 12 ++++++------ + drivers/scsi/lpfc/lpfc_scsi.c | 2 +- + drivers/scsi/lpfc/lpfc_sli.c | 4 ++-- + 6 files changed, 16 insertions(+), 16 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_ct.c ++++ b/drivers/scsi/lpfc/lpfc_ct.c +@@ -778,7 +778,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 +@@ -104,20 +104,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; +@@ -170,7 +170,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)); +@@ -6164,7 +6164,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 +@@ -3555,7 +3555,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 +@@ -192,14 +192,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; + } +@@ -211,7 +211,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); + +@@ -263,7 +263,7 @@ lpfc_nvme_cmpl_gen_req(struct lpfc_hba * + ndlp = (struct lpfc_nodelist *)cmdwqe->context1; + lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC, + "6047 nvme cmpl Enter " +- "Data %px DID %x Xri: %x status %x reason x%x " ++ "Data x%px 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, + cmdwqe->sli4_xritag, status, +@@ -284,7 +284,7 @@ lpfc_nvme_cmpl_gen_req(struct lpfc_hba * + else + lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_DISC, + "6046 nvme 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) { +@@ -1692,7 +1692,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 +@@ -2659,7 +2659,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)); +@@ -2724,7 +2724,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, 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..a19e749 --- /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 +@@ -6982,28 +6982,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); + +@@ -7230,14 +7225,13 @@ qla2x00_timer(scsi_qla_host_t *vha) + 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..e8529a1 --- /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 +@@ -1631,7 +1631,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..062a6f8 --- /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 +@@ -2770,6 +2770,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 +@@ -2786,6 +2829,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); + +@@ -2874,17 +2918,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..1bf6366 --- /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 +@@ -6470,7 +6470,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 +@@ -6546,7 +6546,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..01e94a0 --- /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 +@@ -125,7 +125,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) \ +@@ -253,6 +252,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..c16289b --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Fix-crash-in-PCIe-error-handling.patch @@ -0,0 +1,815 @@ +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 +[dwagner: resolved conflict in qla2xxx_pci_resume(). Commit 62b36c3ea664 + is missing (touches too many drivers). Though we have bfcb79fca19d + so we can just drop pci_cleanup_aer_uncorrect_error_status()] +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, 264 insertions(+), 106 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 +@@ -3744,6 +3774,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) { +@@ -3961,8 +3994,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 +@@ -4001,5 +4040,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 +@@ -410,8 +410,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; +@@ -548,6 +553,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 +@@ -978,6 +978,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; +@@ -1207,35 +1214,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 + * +@@ -1269,6 +1247,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; + } + +@@ -1462,6 +1441,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; + } + +@@ -1478,6 +1458,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; + } + +@@ -1513,6 +1494,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; + } + +@@ -1590,7 +1572,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; + } + +@@ -6682,6 +6664,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; + +@@ -7397,6 +7382,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; +@@ -7406,28 +7393,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); +@@ -7464,14 +7439,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) { +@@ -7481,11 +7459,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); +@@ -7493,9 +7472,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 +@@ -7509,6 +7491,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; + +@@ -7532,10 +7518,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 +@@ -7547,9 +7534,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. +@@ -7583,16 +7571,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; + } +@@ -7604,18 +7600,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"); ++} + +- pci_cleanup_aer_uncorrect_error_status(pdev); ++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..bae200f --- /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 +@@ -1020,8 +1020,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; + } + +@@ -1033,11 +1031,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..0356459 --- /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 +@@ -1038,7 +1038,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..bb63166 --- /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 { +@@ -5175,6 +5187,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 +@@ -1281,6 +1281,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; + +@@ -1449,6 +1451,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; + } + +@@ -3148,6 +3151,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)) +@@ -5104,6 +5111,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); +@@ -7074,6 +7082,8 @@ qla2x00_timer(scsi_qla_host_t *vha) + 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, +@@ -7105,6 +7115,16 @@ qla2x00_timer(scsi_qla_host_t *vha) + 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-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..5b48d1f --- /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 +@@ -3378,8 +3378,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..5caa1be --- /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 +@@ -4632,8 +4632,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; +@@ -4647,8 +4646,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 new file mode 100644 index 0000000..7aefa8c --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Reserve-extra-IRQ-vectors.patch @@ -0,0 +1,109 @@ +From: Roman Bolshakov +Date: Mon, 12 Apr 2021 19:57:40 +0300 +Subject: scsi: qla2xxx: Reserve extra IRQ vectors +Patch-mainline: v5.13-rc1 +Git-commit: f02d4086a8f36a0e1aaebf559b54cf24a177a486 +References: bsc#1185491 + +Commit a6dcfe08487e ("scsi: qla2xxx: Limit interrupt vectors to number of +CPUs") lowers the number of allocated MSI-X vectors to the number of CPUs. + +That breaks vector allocation assumptions in qla83xx_iospace_config(), +qla24xx_enable_msix() and qla2x00_iospace_config(). Either of the functions +computes maximum number of qpairs as: + + ha->max_qpairs = ha->msix_count - 1 (MB interrupt) - 1 (default + response queue) - 1 (ATIO, in dual or pure target mode) + +max_qpairs is set to zero in case of two CPUs and initiator mode. The +number is then used to allocate ha->queue_pair_map inside +qla2x00_alloc_queues(). No allocation happens and ha->queue_pair_map is +left NULL but the driver thinks there are queue pairs available. + +qla2xxx_queuecommand() tries to find a qpair in the map and crashes: + + if (ha->mqenable) { + uint32_t tag; + uint16_t hwq; + struct qla_qpair *qpair = NULL; + + tag = blk_mq_unique_tag(cmd->request); + hwq = blk_mq_unique_tag_to_hwq(tag); + qpair = ha->queue_pair_map[hwq]; # <- HERE + + if (qpair) + return qla2xxx_mqueuecommand(host, cmd, qpair); + } + + BUG: kernel NULL pointer dereference, address: 0000000000000000 + #PF: supervisor read access in kernel mode + #PF: error_code(0x0000) - not-present page + PGD 0 P4D 0 + Oops: 0000 [#1] SMP PTI + CPU: 0 PID: 72 Comm: kworker/u4:3 Tainted: G W 5.10.0-rc1+ #25 + Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014 + Workqueue: scsi_wq_7 fc_scsi_scan_rport [scsi_transport_fc] + RIP: 0010:qla2xxx_queuecommand+0x16b/0x3f0 [qla2xxx] + Call Trace: + scsi_queue_rq+0x58c/0xa60 + blk_mq_dispatch_rq_list+0x2b7/0x6f0 + ? __sbitmap_get_word+0x2a/0x80 + __blk_mq_sched_dispatch_requests+0xb8/0x170 + blk_mq_sched_dispatch_requests+0x2b/0x50 + __blk_mq_run_hw_queue+0x49/0xb0 + __blk_mq_delay_run_hw_queue+0xfb/0x150 + blk_mq_sched_insert_request+0xbe/0x110 + blk_execute_rq+0x45/0x70 + __scsi_execute+0x10e/0x250 + scsi_probe_and_add_lun+0x228/0xda0 + __scsi_scan_target+0xf4/0x620 + ? __pm_runtime_resume+0x4f/0x70 + scsi_scan_target+0x100/0x110 + fc_scsi_scan_rport+0xa1/0xb0 [scsi_transport_fc] + process_one_work+0x1ea/0x3b0 + worker_thread+0x28/0x3b0 + ? process_one_work+0x3b0/0x3b0 + kthread+0x112/0x130 + ? kthread_park+0x80/0x80 + ret_from_fork+0x22/0x30 + +The driver should allocate enough vectors to provide every CPU it's own HW +queue and still handle reserved (MB, RSP, ATIO) interrupts. + +The change fixes the crash on dual core VM and prevents unbalanced QP +allocation where nr_hw_queues is two less than the number of CPUs. + +Link: https://lore.kernel.org/r/20210412165740.39318-1-r.bolshakov@yadro.com +Fixes: a6dcfe08487e ("scsi: qla2xxx: Limit interrupt vectors to number of CPUs") +Cc: Daniel Wagner +Cc: Himanshu Madhani +Cc: Quinn Tran +Cc: Nilesh Javali +Cc: Martin K. Petersen +Cc: stable@vger.kernel.org # 5.11+ +Reported-by: Aleksandr Volkov +Reported-by: Aleksandr Miloserdov +Reviewed-by: Daniel Wagner +Reviewed-by: Himanshu Madhani +Signed-off-by: Roman Bolshakov +Signed-off-by: Martin K. Petersen +--- + 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 +@@ -4000,11 +4000,11 @@ qla24xx_enable_msix(struct qla_hw_data * + !shost_use_blk_mq(vha->host)) { + /* user wants to control IRQ setting for target mode */ + ret = pci_alloc_irq_vectors(ha->pdev, min_vecs, +- min((u16)ha->msix_count, (u16)num_online_cpus()), ++ min((u16)ha->msix_count, (u16)(num_online_cpus() + min_vecs)), + PCI_IRQ_MSIX); + } else + ret = pci_alloc_irq_vectors_affinity(ha->pdev, min_vecs, +- min((u16)ha->msix_count, (u16)num_online_cpus()), ++ min((u16)ha->msix_count, (u16)(num_online_cpus() + min_vecs)), + PCI_IRQ_MSIX | PCI_IRQ_AFFINITY, + &desc); + 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..6894cfb --- /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 +@@ -990,8 +990,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..9420e05 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Update-version-to-10.02.00.106-k.patch @@ -0,0 +1,35 @@ +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(-) + +diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h +index 72c648442e8d..da11829fa12d 100644 +--- a/drivers/scsi/qla2xxx/qla_version.h ++++ b/drivers/scsi/qla2xxx/qla_version.h +@@ -6,9 +6,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 +-- +2.29.2 + diff --git a/patches.suse/scsi-qla2xxx-Use-dma_pool_zalloc-720efdd2.patch b/patches.suse/scsi-qla2xxx-Use-dma_pool_zalloc-720efdd2.patch new file mode 100644 index 0000000..8497773 --- /dev/null +++ b/patches.suse/scsi-qla2xxx-Use-dma_pool_zalloc-720efdd2.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 +@@ -4253,11 +4253,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..96776d5 --- /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 +@@ -3575,6 +3575,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; +@@ -3591,6 +3592,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; + +@@ -603,6 +609,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; + +@@ -757,3 +764,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..1a30e2d --- /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 +@@ -969,7 +969,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/smsc95xx-avoid-memory-leak-in-smsc95xx_bind.patch b/patches.suse/smsc95xx-avoid-memory-leak-in-smsc95xx_bind.patch new file mode 100644 index 0000000..94785e5 --- /dev/null +++ b/patches.suse/smsc95xx-avoid-memory-leak-in-smsc95xx_bind.patch @@ -0,0 +1,38 @@ +From 542124af17aa5a2aca11e8c047d55cdd682e1b66 Mon Sep 17 00:00:00 2001 +From: Andre Edich +Date: Mon, 6 Jul 2020 10:39:35 +0200 +Subject: [PATCH 4/4] smsc95xx: avoid memory leak in smsc95xx_bind +Patch-mainline: v5.8-rc5 +Git-commit: 3ed58f96a70b85ef646d5427258f677f1395b62f +References: git-fixes + +In a case where the ID_REV register read is failed, the memory for a +private data structure has to be freed before returning error from the +function smsc95xx_bind. + +Fixes: bbd9f9ee69242 ("smsc95xx: add wol support for more frame types") +Signed-off-by: Andre Edich +Signed-off-by: Parthiban Veerasooran +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/usb/smsc95xx.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index d760bdd96d94..564fbe3c8c32 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -1306,7 +1306,8 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) + /* detect device revision as different features may be available */ + ret = smsc95xx_read_reg(dev, ID_REV, &val); + if (ret < 0) +- return ret; ++ goto free_pdata; ++ + val >>= 16; + pdata->chip_id = val; + pdata->mdix_ctrl = get_mdix_status(dev->net); +-- +2.16.4 + diff --git a/patches.suse/smsc95xx-check-return-value-of-smsc95xx_reset.patch b/patches.suse/smsc95xx-check-return-value-of-smsc95xx_reset.patch new file mode 100644 index 0000000..16c4f87 --- /dev/null +++ b/patches.suse/smsc95xx-check-return-value-of-smsc95xx_reset.patch @@ -0,0 +1,47 @@ +From 25de6a64cc93294f84d1f9616bd903b5c071e139 Mon Sep 17 00:00:00 2001 +From: Andre Edich +Date: Mon, 6 Jul 2020 10:39:34 +0200 +Subject: [PATCH 3/4] smsc95xx: check return value of smsc95xx_reset +Patch-mainline: v5.8-rc5 +Git-commit: 7c8b1e855f94f88a0c569be6309fc8d5c8844cd1 +References: git-fixes + +The return value of the function smsc95xx_reset() must be checked +to avoid returning false success from the function smsc95xx_bind(). + +Fixes: 2f7ca802bdae2 ("net: Add SMSC LAN9500 USB2.0 10/100 ethernet adapter driver") +Signed-off-by: Andre Edich +Signed-off-by: Parthiban Veerasooran +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/usb/smsc95xx.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 43670e9fb03e..d760bdd96d94 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -1300,6 +1300,8 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) + + /* Init all registers */ + ret = smsc95xx_reset(dev); ++ if (ret) ++ goto free_pdata; + + /* detect device revision as different features may be available */ + ret = smsc95xx_read_reg(dev, ID_REV, &val); +@@ -1330,6 +1332,10 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) + schedule_delayed_work(&pdata->carrier_check, CARRIER_CHECK_DELAY); + + return 0; ++ ++free_pdata: ++ kfree(pdata); ++ return ret; + } + + static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf) +-- +2.16.4 + diff --git a/patches.suse/stop_machine-mark-helpers-__always_inline.patch b/patches.suse/stop_machine-mark-helpers-__always_inline.patch new file mode 100644 index 0000000..2e71149 --- /dev/null +++ b/patches.suse/stop_machine-mark-helpers-__always_inline.patch @@ -0,0 +1,83 @@ +From cbf78d85079cee662c45749ef4f744d41be85d48 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Fri, 12 Mar 2021 21:07:04 -0800 +Subject: [PATCH] stop_machine: mark helpers __always_inline + +References: bsc#1087405 git-fixes +Patch-mainline: v5.12-rc3 +Git-commit: cbf78d85079cee662c45749ef4f744d41be85d48 + +With clang-13, some functions only get partially inlined, with a +specialized version referring to a global variable. This triggers a +harmless build-time check for the intel-rng driver: + +WARNING: modpost: drivers/char/hw_random/intel-rng.o(.text+0xe): Section mismatch in reference from the function stop_machine() to the function .init.text:intel_rng_hw_init() +The function stop_machine() references +the function __init intel_rng_hw_init(). +This is often because stop_machine lacks a __init +annotation or the annotation of intel_rng_hw_init is wrong. + +In this instance, an easy workaround is to force the stop_machine() +function to be inline, along with related interfaces that did not show the +same behavior at the moment, but theoretically could. + +The combination of the two patches listed below triggers the behavior in +clang-13, but individually these commits are correct. + +Link: https://lkml.kernel.org/r/20210225130153.1956990-1-arnd@kernel.org +Fixes: fe5595c07400 ("stop_machine: Provide stop_machine_cpuslocked()") +Fixes: ee527cd3a20c ("Use stop_machine_run in the Intel RNG driver") +Signed-off-by: Arnd Bergmann +Cc: Nathan Chancellor +Cc: Nick Desaulniers +Cc: Thomas Gleixner +Cc: Sebastian Andrzej Siewior +Cc: "Paul E. McKenney" +Cc: Ingo Molnar +Cc: Prarit Bhargava +Cc: Daniel Bristot de Oliveira +Cc: Peter Zijlstra +Cc: Valentin Schneider +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Acked-by: Michal Suchanek +--- + include/linux/stop_machine.h | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h +index 30577c3aecf8..46fb3ebdd16e 100644 +--- a/include/linux/stop_machine.h ++++ b/include/linux/stop_machine.h +@@ -128,7 +128,7 @@ int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, + const struct cpumask *cpus); + #else /* CONFIG_SMP || CONFIG_HOTPLUG_CPU */ + +-static inline int stop_machine_cpuslocked(cpu_stop_fn_t fn, void *data, ++static __always_inline int stop_machine_cpuslocked(cpu_stop_fn_t fn, void *data, + const struct cpumask *cpus) + { + unsigned long flags; +@@ -139,14 +139,15 @@ static inline int stop_machine_cpuslocked(cpu_stop_fn_t fn, void *data, + return ret; + } + +-static inline int stop_machine(cpu_stop_fn_t fn, void *data, +- const struct cpumask *cpus) ++static __always_inline int ++stop_machine(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus) + { + return stop_machine_cpuslocked(fn, data, cpus); + } + +-static inline int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, +- const struct cpumask *cpus) ++static __always_inline int ++stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, ++ const struct cpumask *cpus) + { + return stop_machine(fn, data, cpus); + } +-- +2.26.2 + diff --git a/patches.suse/usbip-add-sysfs_lock-to-synchronize-sysfs-code-paths.patch b/patches.suse/usbip-add-sysfs_lock-to-synchronize-sysfs-code-paths.patch new file mode 100644 index 0000000..29461c4 --- /dev/null +++ b/patches.suse/usbip-add-sysfs_lock-to-synchronize-sysfs-code-paths.patch @@ -0,0 +1,149 @@ +From 4e9c93af7279b059faf5bb1897ee90512b258a12 Mon Sep 17 00:00:00 2001 +From: Shuah Khan +Date: Mon, 29 Mar 2021 19:36:48 -0600 +Subject: [PATCH] usbip: add sysfs_lock to synchronize sysfs code paths +Git-commit: 4e9c93af7279b059faf5bb1897ee90512b258a12 +References: git-fixe +Patch-mainline: v5.12-rc7 + +Fuzzing uncovered race condition between sysfs code paths in usbip +drivers. Device connect/disconnect code paths initiated through +sysfs interface are prone to races if disconnect happens during +connect and vice versa. + +This problem is common to all drivers while it can be reproduced easily +in vhci_hcd. Add a sysfs_lock to usbip_device struct to protect the paths. + +Use this in vhci_hcd to protect sysfs paths. For a complete fix, usip_host +and usip-vudc drivers and the event handler will have to use this lock to +protect the paths. These changes will be done in subsequent patches. + +Cc: stable@vger.kernel.org +Reported-and-tested-by: syzbot+a93fba6d384346a761e3@syzkaller.appspotmail.com +Signed-off-by: Shuah Khan +Link: https://lore.kernel.org/r/b6568f7beae702bbc236a545d3c020106ca75eac.1616807117.git.skhan@linuxfoundation.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Oliver Neukum +--- + drivers/usb/usbip/usbip_common.h | 3 +++ + drivers/usb/usbip/vhci_hcd.c | 1 + + drivers/usb/usbip/vhci_sysfs.c | 30 +++++++++++++++++++++++++----- + 3 files changed, 29 insertions(+), 5 deletions(-) + +--- a/drivers/usb/usbip/usbip_common.h ++++ b/drivers/usb/usbip/usbip_common.h +@@ -279,6 +279,9 @@ struct usbip_device { + /* lock for status */ + spinlock_t lock; + ++ /* mutex for synchronizing sysfs store paths */ ++ struct mutex sysfs_lock; ++ + int sockfd; + struct socket *tcp_socket; + +--- a/drivers/usb/usbip/vhci_hcd.c ++++ b/drivers/usb/usbip/vhci_hcd.c +@@ -902,6 +902,7 @@ static void vhci_device_init(struct vhci + vdev->ud.side = USBIP_VHCI; + vdev->ud.status = VDEV_ST_NULL; + spin_lock_init(&vdev->ud.lock); ++ mutex_init(&vdev->ud.sysfs_lock); + + INIT_LIST_HEAD(&vdev->priv_rx); + INIT_LIST_HEAD(&vdev->priv_tx); +--- a/drivers/usb/usbip/vhci_sysfs.c ++++ b/drivers/usb/usbip/vhci_sysfs.c +@@ -162,6 +162,8 @@ static int vhci_port_disconnect(struct v + + usbip_dbg_vhci_sysfs("enter\n"); + ++ mutex_lock(&vdev->ud.sysfs_lock); ++ + /* lock */ + spin_lock_irqsave(&vhci->lock, flags); + spin_lock(&vdev->ud.lock); +@@ -172,6 +174,7 @@ static int vhci_port_disconnect(struct v + /* unlock */ + spin_unlock(&vdev->ud.lock); + spin_unlock_irqrestore(&vhci->lock, flags); ++ mutex_unlock(&vdev->ud.sysfs_lock); + + return -EINVAL; + } +@@ -182,6 +185,8 @@ static int vhci_port_disconnect(struct v + + usbip_event_add(&vdev->ud, VDEV_EVENT_DOWN); + ++ mutex_unlock(&vdev->ud.sysfs_lock); ++ + return 0; + } + +@@ -310,30 +315,36 @@ static ssize_t store_attach(struct devic + vhci = hcd_to_vhci(hcd); + vdev = &vhci->vdev[rhport]; + ++ mutex_lock(&vdev->ud.sysfs_lock); ++ + /* Extract socket from fd. */ + socket = sockfd_lookup(sockfd, &err); + if (!socket) { + dev_err(dev, "failed to lookup sock"); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + if (socket->type != SOCK_STREAM) { + dev_err(dev, "Expecting SOCK_STREAM - found %d", + socket->type); + sockfd_put(socket); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + + /* create threads before locking */ + tcp_rx = kthread_create(vhci_rx_loop, &vdev->ud, "vhci_rx"); + if (IS_ERR(tcp_rx)) { + sockfd_put(socket); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + tcp_tx = kthread_create(vhci_tx_loop, &vdev->ud, "vhci_tx"); + if (IS_ERR(tcp_tx)) { + kthread_stop(tcp_rx); + sockfd_put(socket); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + + /* get task structs now */ +@@ -354,7 +365,8 @@ static ssize_t store_attach(struct devic + kthread_stop_put(tcp_tx); + + dev_err(dev, "port %d already used\n", rhport); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + + dev_info(dev, "pdev(%u) rhport(%u) sockfd(%d)\n", +@@ -379,7 +391,15 @@ static ssize_t store_attach(struct devic + + rh_port_connect(vdev, speed); + ++ dev_info(dev, "Device attached\n"); ++ ++ mutex_unlock(&vdev->ud.sysfs_lock); ++ + return count; ++ ++unlock_mutex: ++ mutex_unlock(&vdev->ud.sysfs_lock); ++ return err; + } + static DEVICE_ATTR(attach, S_IWUSR, NULL, store_attach); + diff --git a/patches.suse/usbip-stub-dev-synchronize-sysfs-code-paths.patch b/patches.suse/usbip-stub-dev-synchronize-sysfs-code-paths.patch new file mode 100644 index 0000000..e996f68 --- /dev/null +++ b/patches.suse/usbip-stub-dev-synchronize-sysfs-code-paths.patch @@ -0,0 +1,85 @@ +From 9dbf34a834563dada91366c2ac266f32ff34641a Mon Sep 17 00:00:00 2001 +From: Shuah Khan +Date: Mon, 29 Mar 2021 19:36:49 -0600 +Subject: [PATCH] usbip: stub-dev synchronize sysfs code paths +Git-commit: 9dbf34a834563dada91366c2ac266f32ff34641a +References: git-fixes +Patch-mainline: v5.12-rc7 + +Fuzzing uncovered race condition between sysfs code paths in usbip +drivers. Device connect/disconnect code paths initiated through +sysfs interface are prone to races if disconnect happens during +connect and vice versa. + +Use sysfs_lock to protect sysfs paths in stub-dev. + +Cc: stable@vger.kernel.org +Reported-and-tested-by: syzbot+a93fba6d384346a761e3@syzkaller.appspotmail.com +Signed-off-by: Shuah Khan +Link: https://lore.kernel.org/r/2b182f3561b4a065bf3bf6dce3b0e9944ba17b3f.1616807117.git.skhan@linuxfoundation.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Oliver Neukum +--- + drivers/usb/usbip/stub_dev.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +--- a/drivers/usb/usbip/stub_dev.c ++++ b/drivers/usb/usbip/stub_dev.c +@@ -77,6 +77,7 @@ static ssize_t store_sockfd(struct devic + + dev_info(dev, "stub up\n"); + ++ mutex_lock(&sdev->ud.sysfs_lock); + spin_lock_irq(&sdev->ud.lock); + + if (sdev->ud.status != SDEV_ST_AVAILABLE) { +@@ -101,13 +102,13 @@ static ssize_t store_sockfd(struct devic + tcp_rx = kthread_create(stub_rx_loop, &sdev->ud, "stub_rx"); + if (IS_ERR(tcp_rx)) { + sockfd_put(socket); +- return -EINVAL; ++ goto unlock_mutex; + } + tcp_tx = kthread_create(stub_tx_loop, &sdev->ud, "stub_tx"); + if (IS_ERR(tcp_tx)) { + kthread_stop(tcp_rx); + sockfd_put(socket); +- return -EINVAL; ++ goto unlock_mutex; + } + + /* get task structs now */ +@@ -126,6 +127,8 @@ static ssize_t store_sockfd(struct devic + wake_up_process(sdev->ud.tcp_rx); + wake_up_process(sdev->ud.tcp_tx); + ++ mutex_unlock(&sdev->ud.sysfs_lock); ++ + } else { + dev_info(dev, "stub down\n"); + +@@ -136,6 +139,7 @@ static ssize_t store_sockfd(struct devic + spin_unlock_irq(&sdev->ud.lock); + + usbip_event_add(&sdev->ud, SDEV_EVENT_DOWN); ++ mutex_unlock(&sdev->ud.sysfs_lock); + } + + return count; +@@ -144,6 +148,8 @@ sock_err: + sockfd_put(socket); + err: + spin_unlock_irq(&sdev->ud.lock); ++unlock_mutex: ++ mutex_unlock(&sdev->ud.sysfs_lock); + return -EINVAL; + } + static DEVICE_ATTR(usbip_sockfd, S_IWUSR, NULL, store_sockfd); +@@ -309,6 +315,7 @@ static struct stub_device *stub_device_a + sdev->ud.side = USBIP_STUB; + sdev->ud.status = SDEV_ST_AVAILABLE; + spin_lock_init(&sdev->ud.lock); ++ mutex_init(&sdev->ud.sysfs_lock); + sdev->ud.tcp_socket = NULL; + sdev->ud.sockfd = -1; + diff --git a/patches.suse/usbip-synchronize-event-handler-with-sysfs-code-path.patch b/patches.suse/usbip-synchronize-event-handler-with-sysfs-code-path.patch new file mode 100644 index 0000000..3f6dfea --- /dev/null +++ b/patches.suse/usbip-synchronize-event-handler-with-sysfs-code-path.patch @@ -0,0 +1,49 @@ +From 363eaa3a450abb4e63bd6e3ad79d1f7a0f717814 Mon Sep 17 00:00:00 2001 +From: Shuah Khan +Date: Mon, 29 Mar 2021 19:36:51 -0600 +Subject: [PATCH] usbip: synchronize event handler with sysfs code paths +Git-commit: 363eaa3a450abb4e63bd6e3ad79d1f7a0f717814 +References: git-fixes +Patch-mainline: v5.12-rc7 + +Fuzzing uncovered race condition between sysfs code paths in usbip +drivers. Device connect/disconnect code paths initiated through +sysfs interface are prone to races if disconnect happens during +connect and vice versa. + +Use sysfs_lock to synchronize event handler with sysfs paths +in usbip drivers. + +Cc: stable@vger.kernel.org +Reported-and-tested-by: syzbot+a93fba6d384346a761e3@syzkaller.appspotmail.com +Signed-off-by: Shuah Khan +Link: https://lore.kernel.org/r/c5c8723d3f29dfe3d759cfaafa7dd16b0dfe2918.1616807117.git.skhan@linuxfoundation.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Oliver Neukum +--- + drivers/usb/usbip/usbip_event.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/usb/usbip/usbip_event.c b/drivers/usb/usbip/usbip_event.c +index 5d88917c9631..086ca76dd053 100644 +--- a/drivers/usb/usbip/usbip_event.c ++++ b/drivers/usb/usbip/usbip_event.c +@@ -70,6 +70,7 @@ static void event_handler(struct work_struct *work) + while ((ud = get_event()) != NULL) { + usbip_dbg_eh("pending event %lx\n", ud->event); + ++ mutex_lock(&ud->sysfs_lock); + /* + * NOTE: shutdown must come first. + * Shutdown the device. +@@ -90,6 +91,7 @@ static void event_handler(struct work_struct *work) + ud->eh_ops.unusable(ud); + unset_event(ud, USBIP_EH_UNUSABLE); + } ++ mutex_unlock(&ud->sysfs_lock); + + wake_up(&ud->eh_waitq); + } +-- +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..bb1c007 --- /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#1114648 + +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..b11e3e9 --- /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.12 or v5.12-rc9 (next release) +References: bsc#1114648 + +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/series.conf b/series.conf index 9f6f55c..6e7dc72 100644 --- a/series.conf +++ b/series.conf @@ -56105,6 +56105,7 @@ patches.suse/net-Do-not-clear-the-sock-TX-queue-in-sk_set_socket.patch patches.suse/0003-net-bcmgenet-re-remove-bcmgenet_hfb_add_filter.patch patches.suse/0001-net-bcmgenet-use-__be16-for-htons-ETH_P_IP.patch + patches.suse/net-bcmgenet-use-hardware-padding-of-runt-frames.patch patches.suse/net-bridge-enfore-alignment-for-ethernet-address.patch patches.suse/tcp_cubic-fix-spurious-HYSTART_DELAY-exit-upon-drop-.patch patches.suse/sctp-Don-t-advertise-IPv4-addresses-if-ipv6only-is-s.patch @@ -56194,11 +56195,14 @@ patches.suse/IB-hfi1-Do-not-destroy-link_wq-when-the-device-is-sh.patch patches.suse/llc-make-sure-applications-use-ARPHRD_ETHER.patch patches.suse/mac80211-allow-rx-of-mesh-eapol-frames-with-default-.patch + patches.suse/net-cxgb4-fix-return-error-value-in-t4_prep_fw.patch patches.suse/tcp-md5-add-missing-memory-barriers-in-tcp_md5_do_ad.patch patches.suse/genetlink-remove-genl_bind.patch patches.suse/tcp-md5-refine-tcp_md5_do_add-tcp_md5_hash_key-barri.patch patches.suse/tcp-md5-do-not-send-silly-options-in-SYNCOOKIES.patch patches.suse/sched-consistently-handle-layer3-header-accesses-in-.patch + patches.suse/smsc95xx-check-return-value-of-smsc95xx_reset.patch + patches.suse/smsc95xx-avoid-memory-leak-in-smsc95xx_bind.patch patches.suse/net-hns3-add-a-missing-uninit-debugfs-when-unload-dr.patch patches.suse/net-hns3-fix-use-after-free-when-doing-self-test.patch patches.suse/net-usb-qmi_wwan-add-support-for-Quectel-EG95-LTE-mo.patch @@ -57929,6 +57933,9 @@ patches.suse/scsi-lpfc-lpfc_attr-Fix-up-a-bunch-of-kernel-doc-mis.patch patches.suse/scsi-lpfc-lpfc_debugfs-Fix-a-couple-of-function-docu.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 @@ -58306,10 +58313,23 @@ 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-libsas-docs-Remove-notify_ha_event.patch patches.suse/scsi-lpfc-Fix-kerneldoc-inconsistency-in-lpfc_sli4_d.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-lpfc-Fix-ancient-double-free.patch + patches.suse/scsi-qla2xxx-Simplify-the-calculation-of-variables.patch patches.suse/scsi-lpfc-Fix-physical-typos.patch patches.suse/RDMA-mlx5-Use-the-correct-obj_id-upon-DEVX-TIR-creat.patch patches.suse/IB-mlx5-Return-appropriate-error-code-instead-of-ENO.patch @@ -58318,6 +58338,7 @@ patches.suse/printk-fix-deadlock-when-kernel-panic.patch patches.suse/cifs_debug-use-pd-instead-of-messing-with-d_name.patch patches.suse/quota-Fix-memory-leak-when-handling-corrupted-quota-.patch + patches.suse/isofs-release-buffer-head-before-return.patch patches.suse/amba-Fix-resource-leak-for-drivers-without-.remove.patch patches.suse/powerpc-perf-hv-24x7-Dont-create-sysfs-event-files-f.patch patches.suse/powerpc-pseries-ras-Remove-unused-variable-status.patch @@ -58339,6 +58360,7 @@ patches.suse/misc-eeprom_93xx46-Add-quirk-to-support-Microchip-93.patch patches.suse/random-fix-the-RNDRESEEDCRNG-ioctl.patch patches.suse/phy-rockchip-emmc-emmc_phy_init-always-return-0.patch + patches.suse/ocfs2-fix-a-use-after-free-on-error.patch patches.suse/0002-video-fbdev-acornfb-remove-free_unused_pages.patch patches.suse/PCI-Align-checking-of-syscall-user-config-accessors.patch patches.suse/i40e-Add-zero-initialization-of-AQ-command-structure.patch @@ -58350,11 +58372,14 @@ patches.suse/drm-msm-a5xx-Remove-overwriting-A5XX_PC_DBG_ECO_CNTL.patch patches.suse/0005-drm-msm-dsi-Correct-io_start-for-MSM8994-20nm-PHY.patch patches.suse/pwm-rockchip-rockchip_pwm_probe-Remove-superfluous-c.patch + patches.suse/mm-fix-memory_failure-handling-of-dax-namespace-meta.patch patches.suse/cifs-New-optype-for-session-operations-.patch patches.suse/cifs-fix-nodfs-mount-option.patch patches.suse/cifs-check-all-path-components-in-resolved-dfs-target.patch patches.suse/cifs-introduce-helper-for-finding-referral-server.patch patches.suse/i2c-brcmstb-Fix-brcmstd_send_i2c_cmd-condition.patch + patches.suse/blk-settings-align-max_sectors-on-logical_block_size.patch + patches.suse/scsi-qla2xxx-Simplify-if-statement.patch patches.suse/ALSA-ctxfi-cthw20k2-fix-mask-on-conf-to-allow-4-bits.patch patches.suse/Xen-gnttab-handle-p2m-update-errors-on-a-per-slot-ba.patch patches.suse/xen-netback-respect-gnttab_map_refs-s-return-value.patch @@ -58422,13 +58447,18 @@ patches.suse/staging-comedi-pcl818-Fix-endian-problem-for-AI-comm.patch patches.suse/staging-rtl8192u-fix-ssid-overflow-in-r8192_wx_set_s.patch patches.suse/staging-rtl8188eu-prevent-ssid-overflow-in-rtw_wx_se.patch + patches.suse/stop_machine-mark-helpers-__always_inline.patch patches.suse/powerpc-64s-Fix-instruction-encoding-for-lis-in-ppc_.patch patches.suse/fuse-fix-live-lock-in-fuse_iget.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/Revert-PM-runtime-Update-device-status-before-lettin.patch patches.suse/s390-vtime-fix-increased-steal-time-accounting.patch patches.suse/nvme-tcp-fix-possible-hang-when-failing-to-set-io-qu.patch patches.suse/nvme-rdma-fix-possible-hang-when-failing-to-set-io-q.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 @@ -58440,6 +58470,8 @@ patches.suse/iio-hid-sensor-humidity-Fix-alignment-issue-of-times.patch patches.suse/iio-hid-sensor-temperature-Fix-issues-of-timestamp-c.patch patches.suse/iio-gyro-mpu3050-Fix-error-handling-in-mpu3050_trigg.patch + patches.suse/ext4-find-old-entry-again-if-failed-to-rename-whiteo.patch + patches.suse/ext4-fix-potential-error-in-ext4_do_update_inode.patch patches.suse/veth-Store-queue_mapping-independently-of-XDP-prog-p.patch patches.suse/igc-reinit_locked-should-be-called-with-rtnl_lock.patch patches.suse/igc-Fix-Pause-Frame-Advertising.patch @@ -58461,9 +58493,11 @@ patches.suse/can-peak_usb-Revert-can-peak_usb-add-forgotten-suppo.patch patches.suse/drm-msm-fix-shutdown-hook-in-case-GPU-components-fai.patch patches.suse/bus-omap_l3_noc-mark-l3-irqs-as-IRQF_NO_THREAD.patch + patches.suse/block-recalculate-segment-count-for-multi-segment-di.patch patches.suse/locking-mutex-Fix-non-debug-version-of-mutex_lock_io.patch patches.suse/x86-mem_encrypt-correct-physical-address-calculation-in-_set_clr_pte_enc.patch patches.suse/xen-blkback-don-t-leak-persistent-grants-from-xen_bl.patch + patches.suse/reiserfs-update-reiserfs_xattrs_initialized-conditio.patch patches.suse/cdc-acm-fix-BREAK-rx-code-path-adding-necessary-call.patch patches.suse/USB-cdc-acm-untangle-a-circular-dependency-between-c.patch patches.suse/USB-cdc-acm-downgrade-message-to-debug.patch @@ -58489,6 +58523,14 @@ patches.suse/net-mlx5-Fix-PBMC-register-mapping.patch patches.suse/bpf-x86-Validate-computation-of-branch-displacements.patch patches.suse/i40e-Fix-sparse-warning-missing-error-code-err.patch + patches.suse/ocfs2-fix-deadlock-between-setattr-and-dio_end_io_wr.patch + patches.suse/fs-direct-io-fix-missing-sdio-boundary.patch + patches.suse/usbip-add-sysfs_lock-to-synchronize-sysfs-code-paths.patch + patches.suse/usbip-stub-dev-synchronize-sysfs-code-paths.patch + patches.suse/usbip-synchronize-event-handler-with-sysfs-code-path.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/bpf-Move-off_reg-into-sanitize_ptr_alu.patch patches.suse/bpf-Ensure-off_reg-has-no-mixed-signed-bounds-for-al.patch patches.suse/bpf-Rework-ptr_limit-into-alu_limit-and-add-common-e.patch @@ -58496,12 +58538,10 @@ 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/x86-crash-fix-crash_setup_memmap_entries-out-of-bounds-access.patch patches.suse/locking-qrwlock-Fix-ordering-in-queued_write_lock_sl.patch - - # netdev/net-next - patches.suse/ibmvnic-Use-skb_frag_address-instead-of-hand-coding-.patch - - # jejb/scsi for-next + patches.suse/x86-microcode-check-for-offline-cpus-before-requesting-new-microcode.patch + patches.suse/USB-CDC-ACM-fix-poison-unpoison-imbalance.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 @@ -58524,11 +58564,78 @@ 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-720efdd2.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-ibmvfc-Fix-invalid-state-machine-BUG_ON.patch + patches.suse/scsi-qla2xxx-Reserve-extra-IRQ-vectors.patch + patches.suse/ibmvnic-Use-skb_frag_address-instead-of-hand-coding-.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/ibmvnic-improve-failover-sysfs-entry.patch + patches.suse/ibmvnic-queue-reset-work-in-system_long_wq.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-mm-Add-cond_resched-while-removing-hpte-mapp.patch patches.suse/powerpc-pseries-extract-host-bridge-from-pci_bus-pri.patch patches.suse/powerpc-pseries-Add-shutdown-to-vio_driver-and-vio_b.patch + patches.suse/kvm-destroy-i-o-bus-devices-on-unregister-failure-after_-sync-ing-srcu + patches.suse/kvm-stop-looking-for-coalesced-mmio-zones-if-the-bus-is-destroyed + patches.suse/kvm-add-proper-lockdep-assertion-in-i-o-bus-unregister # dhowells/linux-fs keys-uefi patches.suse/0001-KEYS-Allow-unrestricted-boot-time-addition-of-keys-t.patch @@ -58538,7 +58645,8 @@ patches.suse/0006-modsign-Use-secondary-trust-keyring-for-module-signi.patch # mkp/scsi queue - patches.suse/scsi-ibmvfc-Fix-invalid-state-machine-BUG_ON.patch + patches.suse/scsi-lpfc-Fix-illegal-memory-access-on-Abort-IOCBs.patch + patches.suse/scsi-lpfc-Fix-DMA-virtual-address-ptr-assignment-in-.patch # out-of-tree patches patches.suse/net-mvpp2-fix-condition-for-setting-up-link-interrup.patch @@ -59253,6 +59361,7 @@ patches.suse/kernel-smp-add-boot-parameter-for-controlling-CSD.patch patches.suse/kernel-smp-prepare-more-CSD-lock-debugging.patch patches.suse/kernel-smp-add-more-data-to-CSD-lock-debugging.patch + patches.suse/0002-kernel-smp-make-csdlock-timeout-depend-on-boot-param.patch ######################################################## # Kdump @@ -59427,6 +59536,7 @@ patches.kabi/mm-thp-kABI-move-the-added-flag-to-the-end-of-enum.patch patches.kabi/fix-kabi-after-call_single_data-modification.patch patches.kabi/powerpc-kABI-add-back-suspend_disable_cpu-in-machdep.patch + patches.kabi/struct-usbip_device-kABI-fixup.patch ######################################################## # You'd better have a good reason for adding a patch