aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-07-01scsi: qla2xxx: Change in PUREX to handle FPIN ELS requestsShyam Sundar6-43/+134
SAN Congestion Management generates ELS pkts whose size can vary and be > 64 bytes. Change the PUREX handling code to support non-standard ELS pkt size. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Shyam Sundar <[email protected]> Signed-off-by: Arun Easi <[email protected]> Signed-off-by: Nilesh Javali <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-30scsi: qla2xxx: Introduce a function for computing the debug message prefixBart Van Assche1-64/+32
Instead of repeating the code for generating a debug message prefix six times, introduce a function for computing the debug message prefix. Link: https://lore.kernel.org/r/[email protected] Cc: Nilesh Javali <[email protected]> Cc: Quinn Tran <[email protected]> Cc: Himanshu Madhani <[email protected]> Cc: Martin Wilck <[email protected]> Cc: Roman Bolshakov <[email protected]> Reviewed-by: Daniel Wagner <[email protected]> Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-30scsi: qla2xxx: Make qla2x00_restart_isp() easier to readBart Van Assche1-17/+22
Instead of using complicated control flow to only have one return statement at the end of qla2x00_restart_isp(), return an error status as soon as it is known that this function will fail. Link: https://lore.kernel.org/r/[email protected] Cc: Nilesh Javali <[email protected]> Cc: Quinn Tran <[email protected]> Cc: Himanshu Madhani <[email protected]> Cc: Martin Wilck <[email protected]> Cc: Roman Bolshakov <[email protected]> Reviewed-by: Daniel Wagner <[email protected]> Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-30scsi: qla2xxx: Fix a Coverity complaint in qla2100_fw_dump()Bart Van Assche2-1/+2
'cnt' can exceed the size of the risc_ram[] array. Prevent that Coverity complains by rewriting an address calculation expression. This patch fixes the following Coverity complaint: CID 337803 (#1 of 1): Out-of-bounds read (OVERRUN) 109. overrun-local: Overrunning array of 122880 bytes at byte offset 122880 by dereferencing pointer &fw->risc_ram[cnt]. Link: https://lore.kernel.org/r/[email protected] Cc: Nilesh Javali <[email protected]> Cc: Quinn Tran <[email protected]> Cc: Himanshu Madhani <[email protected]> Cc: Martin Wilck <[email protected]> Cc: Roman Bolshakov <[email protected]> Reviewed-by: Daniel Wagner <[email protected]> Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-30scsi: qla2xxx: Make __qla2x00_alloc_iocbs() initialize 32 bits of ↵Bart Van Assche1-2/+2
request_t.handle The request_t 'handle' member is 32-bits wide, hence use wrt_reg_dword(). Change the cast in the wrt_reg_byte() call to make it clear that a regular pointer is casted to an __iomem pointer. Note: 'pkt' points to I/O memory for the qlafx00 adapter family and to coherent memory for all other adapter families. This patch fixes the following Coverity complaint: CID 358864 (#1 of 1): Reliance on integer endianness (INCOMPATIBLE_CAST) incompatible_cast: Pointer &pkt->handle points to an object whose effective type is unsigned int (32 bits, unsigned) but is dereferenced as a narrower unsigned short (16 bits, unsigned). This may lead to unexpected results depending on machine endianness. Link: https://lore.kernel.org/r/[email protected] Fixes: 8ae6d9c7eb10 ("[SCSI] qla2xxx: Enhancements to support ISPFx00.") Cc: Nilesh Javali <[email protected]> Cc: Quinn Tran <[email protected]> Cc: Himanshu Madhani <[email protected]> Cc: Martin Wilck <[email protected]> Cc: Roman Bolshakov <[email protected]> Reviewed-by: Daniel Wagner <[email protected]> Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-30scsi: qla2xxx: Remove a superfluous castBart Van Assche1-2/+1
Remove an unnecessary cast because it prevents the compiler to perform type checking. Link: https://lore.kernel.org/r/[email protected] Cc: Nilesh Javali <[email protected]> Cc: Quinn Tran <[email protected]> Cc: Himanshu Madhani <[email protected]> Cc: Martin Wilck <[email protected]> Cc: Roman Bolshakov <[email protected]> Reviewed-by: Daniel Wagner <[email protected]> Reviewed-by: Shyam Sundar <[email protected]> Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-30scsi: qla2xxx: Initialize 'n' before using itBart Van Assche1-0/+1
The following code: qla82xx_rom_fast_read(ha, 0, &n) only initializes 'n' if it succeeds. Since 'n' may be reported in a debug message even if no ROM reads succeeded, initialize 'n' to zero. This patch fixes the following sparse warning: qla_nx.c:1218: qla82xx_pinit_from_rom() error: uninitialized symbol 'n'. Link: https://lore.kernel.org/r/[email protected] Cc: Nilesh Javali <[email protected]> Cc: Quinn Tran <[email protected]> Cc: Himanshu Madhani <[email protected]> Cc: Martin Wilck <[email protected]> Cc: Roman Bolshakov <[email protected]> Reviewed-by: Daniel Wagner <[email protected]> Reviewed-by: Shyam Sundar <[email protected]> Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-30scsi: qla2xxx: Make qla82xx_flash_wait_write_finish() easier to readBart Van Assche1-12/+7
Return early instead of having a single return statement at the end of this function. This patch fixes the following sparse warning: qla_nx.c:1018: qla82xx_flash_wait_write_finish() error: uninitialized symbol 'val'. Link: https://lore.kernel.org/r/[email protected] Cc: Nilesh Javali <[email protected]> Cc: Quinn Tran <[email protected]> Cc: Himanshu Madhani <[email protected]> Cc: Martin Wilck <[email protected]> Cc: Roman Bolshakov <[email protected]> Reviewed-by: Daniel Wagner <[email protected]> Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-30scsi: qla2xxx: Remove the __packed annotation from struct fcp_hdr and fcp_hdr_leBart Van Assche1-2/+2
Remove the __packed annotation from struct fcp_hdr* because that annotation is not necessary for these data structures. Link: https://lore.kernel.org/r/[email protected] Cc: Nilesh Javali <[email protected]> Cc: Quinn Tran <[email protected]> Cc: Himanshu Madhani <[email protected]> Cc: Martin Wilck <[email protected]> Cc: Roman Bolshakov <[email protected]> Reviewed-by: Daniel Wagner <[email protected]> Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-30scsi: qla2xxx: Check the size of struct fcp_hdr at compile timeBart Van Assche1-0/+1
Since struct fcp_hdr is used to exchange data with the firmware, check its size at compile time. Link: https://lore.kernel.org/r/[email protected] Cc: Nilesh Javali <[email protected]> Cc: Quinn Tran <[email protected]> Cc: Himanshu Madhani <[email protected]> Cc: Martin Wilck <[email protected]> Cc: Roman Bolshakov <[email protected]> Reviewed-by: Daniel Wagner <[email protected]> Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-29scsi: target: tcmu: Fix crash on ARM during cmd completionBodo Stroesser1-1/+8
If tcmu_handle_completions() has to process a padding shorter than sizeof(struct tcmu_cmd_entry), the current call to tcmu_flush_dcache_range() with sizeof(struct tcmu_cmd_entry) as length param is wrong and causes crashes on e.g. ARM, because tcmu_flush_dcache_range() in this case calls flush_dcache_page(vmalloc_to_page(start)); with start being an invalid address above the end of the vmalloc'ed area. The fix is to use the minimum of remaining ring space and sizeof(struct tcmu_cmd_entry) as the length param. The patch was tested on kernel 4.19.118. See https://bugzilla.kernel.org/show_bug.cgi?id=208045#c10 Link: https://lore.kernel.org/r/[email protected] Tested-by: JiangYu <[email protected]> Acked-by: Mike Christie <[email protected]> Signed-off-by: Bodo Stroesser <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-29scsi: ufs: ufs-exynos: Remove an unnecessary NULL checkDan Carpenter1-1/+1
The "head" pointer can't be NULL because it points to an address in the middle of a ufs_hba struct. Looking at this code, probably someone would wonder if the intent was to check whether "hba" is NULL, but "hba" isn't NULL and the check can just be removed. Link: https://lore.kernel.org/r/20200626105133.GF314359@mwanda Acked-by: Alim Akhtar <[email protected]> Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-26scsi: storvsc: Fix spelling mistakeFlavio Suligoi1-1/+1
Fix typo: "trigerred" --> "triggered" Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Flavio Suligoi <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-26scsi: ufs: Disable WriteBooster capability for non-supported UFS devicesStanley Chu1-16/+19
If a UFS device is not qualified to use WriteBooster, either due to wrong UFS version or device-specific quirks, then the capability in host shall be disabled to prevent any WriteBooster operations in the future. Link: https://lore.kernel.org/r/[email protected] Fixes: 3d17b9b5ab11 ("scsi: ufs: Add write booster feature support") Tested-by: Steev Klimaszewski <[email protected]> Reviewed-by: Avri Altman <[email protected]> Reviewed-by: Bean Huo <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-26scsi: bnx2fc: Removal of unused variablesJaved Hasan1-15/+1
Removed all the unused variables. Link: https://lore.kernel.org/r/[email protected] Reported-by: kbuild test robot <[email protected]> Signed-off-by: Javed Hasan <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-26scsi: cumana_2: Fix different dev_id between request_irq() and free_irq()Christophe JAILLET1-1/+1
The dev_id used in request_irq() and free_irq() should match. Use 'info' in both cases. Link: https://lore.kernel.org/r/[email protected] Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Acked-by: Russell King <[email protected]> Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-26scsi: ufs: ufs-exynos: Fix build warningAlim Akhtar1-0/+5
While building for x86_64 allmodconfig, the following warning was reported: WARNING: modpost: missing MODULE_LICENSE() in drivers/scsi/ufs/ufs-exynos.o Add the missing license/author/description tags. Link: https://lore.kernel.org/r/[email protected] Fixes: 55f4b1f73631 ("scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCs") Reported-by: Stephen Rothwell <[email protected]> Signed-off-by: Alim Akhtar <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-24scsi: ufs: ufs-exynos: Fix return value check in exynos_ufs_init()Wei Yongjun1-6/+6
In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Link: https://lore.kernel.org/r/[email protected] Fixes: 55f4b1f73631 ("scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCs") Reported-by: Hulk Robot <[email protected]> Acked-by: Alim Akhtar <[email protected]> Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-24scsi: ufs: Allow exynos ufs driver to build as moduleAlim Akhtar1-1/+1
Allow Exynos UFS driver to build as a module. This patch fixes the followin build issue reported by kernel build robot. drivers/scsi/ufs/ufs-exynos.o: in function `exynos_ufs_probe': drivers/scsi/ufs/ufs-exynos.c:1231: undefined reference to `ufshcd_pltfrm_init' drivers/scsi/ufs/ufs-exynos.o: in function `exynos_ufs_pre_pwr_mode': drivers/scsi/ufs/ufs-exynos.c:635: undefined reference to `ufshcd_get_pwr_dev_param' drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_shutdown' drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_suspend' drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_resume' drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_runtime_suspend' drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_runtime_resume' drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_runtime_idle' Link: https://lore.kernel.org/r/[email protected] Fixes: 55f4b1f73631 ("scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCs") Reported-by: kernel test robot <[email protected]> Signed-off-by: Alim Akhtar <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-19scsi: target: tcmu: Fix crash in tcmu_flush_dcache_range on ARMBodo Stroesser1-1/+1
This patch fixes the following crash (see https://bugzilla.kernel.org/show_bug.cgi?id=208045) Process iscsi_trx (pid: 7496, stack limit = 0x0000000010dd111a) CPU: 0 PID: 7496 Comm: iscsi_trx Not tainted 4.19.118-0419118-generic #202004230533 Hardware name: Greatwall QingTian DF720/F601, BIOS 601FBE20 Sep 26 2019 pstate: 80400005 (Nzcv daif +PAN -UAO) pc : flush_dcache_page+0x18/0x40 lr : is_ring_space_avail+0x68/0x2f8 [target_core_user] sp : ffff000015123a80 x29: ffff000015123a80 x28: 0000000000000000 x27: 0000000000001000 x26: ffff000023ea5000 x25: ffffcfa25bbe08b8 x24: 0000000000000078 x23: ffff7e0000000000 x22: ffff000023ea5001 x21: ffffcfa24b79c000 x20: 0000000000000fff x19: ffff7e00008fa940 x18: 0000000000000000 x17: 0000000000000000 x16: ffff2d047e709138 x15: 0000000000000000 x14: 0000000000000000 x13: 0000000000000000 x12: ffff2d047fbd0a40 x11: 0000000000000000 x10: 0000000000000030 x9 : 0000000000000000 x8 : ffffc9a254820a00 x7 : 00000000000013b0 x6 : 000000000000003f x5 : 0000000000000040 x4 : ffffcfa25bbe08e8 x3 : 0000000000001000 x2 : 0000000000000078 x1 : ffffcfa25bbe08b8 x0 : ffff2d040bc88a18 Call trace: flush_dcache_page+0x18/0x40 is_ring_space_avail+0x68/0x2f8 [target_core_user] queue_cmd_ring+0x1f8/0x680 [target_core_user] tcmu_queue_cmd+0xe4/0x158 [target_core_user] __target_execute_cmd+0x30/0xf0 [target_core_mod] target_execute_cmd+0x294/0x390 [target_core_mod] transport_generic_new_cmd+0x1e8/0x358 [target_core_mod] transport_handle_cdb_direct+0x50/0xb0 [target_core_mod] iscsit_execute_cmd+0x2b4/0x350 [iscsi_target_mod] iscsit_sequence_cmd+0xd8/0x1d8 [iscsi_target_mod] iscsit_process_scsi_cmd+0xac/0xf8 [iscsi_target_mod] iscsit_get_rx_pdu+0x404/0xd00 [iscsi_target_mod] iscsi_target_rx_thread+0xb8/0x130 [iscsi_target_mod] kthread+0x130/0x138 ret_from_fork+0x10/0x18 Code: f9000bf3 aa0003f3 aa1e03e0 d503201f (f9400260) ---[ end trace 1e451c73f4266776 ]--- The solution is based on patch: "scsi: target: tcmu: Optimize use of flush_dcache_page" which restricts the use of tcmu_flush_dcache_range() to addresses from vmalloc'ed areas only. This patch now replaces the virt_to_page() call in tcmu_flush_dcache_range() - which is wrong for vmalloced addrs - by vmalloc_to_page(). The patch was tested on ARM with kernel 4.19.118 and 5.7.2 Link: https://lore.kernel.org/r/[email protected] Tested-by: JiangYu <[email protected]> Tested-by: Daniel Meyerholt <[email protected]> Acked-by: Mike Christie <[email protected]> Signed-off-by: Bodo Stroesser <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-19scsi: target: tcmu: Optimize use of flush_dcache_pageBodo Stroesser1-4/+7
(scatter|gather)_data_area() need to flush dcache after writing data to or before reading data from a page in uio data area. The two routines are able to handle data transfer to/from such a page in fragments and flush the cache after each fragment was copied by calling the wrapper tcmu_flush_dcache_range(). That means: 1) flush_dcache_page() can be called multiple times for the same page. 2) Calling flush_dcache_page() indirectly using the wrapper does not make sense, because each call of the wrapper is for one single page only and the calling routine already has the correct page pointer. Change (scatter|gather)_data_area() such that, instead of calling tcmu_flush_dcache_range() before/after each memcpy, it now calls flush_dcache_page() before unmapping a page (when writing is complete for that page) or after mapping a page (when starting to read the page). After this change only calls to tcmu_flush_dcache_range() for addresses in vmalloc'ed command ring are left over. The patch was tested on ARM with kernel 4.19.118 and 5.7.2 Link: https://lore.kernel.org/r/[email protected] Tested-by: JiangYu <[email protected]> Tested-by: Daniel Meyerholt <[email protected]> Acked-by: Mike Christie <[email protected]> Signed-off-by: Bodo Stroesser <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-19scsi: ufs: docs: Add WriteBooster documentationAsutosh Das1-0/+136
Adds sysfs documentation for WriteBooster entries. Link: https://lore.kernel.org/r/[email protected] Acked-by: Avri Altman <[email protected]> Signed-off-by: Asutosh Das <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-19scsi: core: Fix formatting errors in scsi_lib.cBean Huo1-22/+21
Delete trailing whitespace, multiple blank lines, and make switch/case be at the same indentation. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bean Huo <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-19scsi: core: Remove scsi_sdb_cacheBean Huo3-19/+0
After commit f664a3cc17b7 ("scsi: kill off the legacy IO path"), scsi_sdb_cache is not used anymore. Remove it. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Bean Huo <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-19scsi: target: tcmu: Remove unnecessary bit TCMU_CMD_BIT_INFLIGHTBodo Stroesser1-2/+0
Since commit 61fb24822166 ("scsi: target: tcmu: Userspace must not complete queued commands") tcmu_cmd bit TCMU_CMD_BIT_INFLIGHT is set but never checked. So we can remove it safely. [mkp: fixed Mike's email address] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bodo Stroesser <[email protected]> Acked-by: Mike Christie <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-19scsi: ufs: ufs-exynos: Fix spelling mistake "pa_granularty" -> "pa_granularity"Colin Ian King1-1/+1
There is a spelling mistake in a dev_warn message. Fix it. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Alim Akhtar <[email protected]> Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-19scsi: ufs-mediatek: Make ufs_mtk_wait_link_state staticStanley Chu1-2/+2
Fix build warning reported by kernel test robot: Warning: >> drivers/scsi/ufs/ufs-mediatek.c:181:5: warning: no previous prototype >> for 'ufs_mtk_wait_link_state' [-Wmissing-prototypes] Link: https://lore.kernel.org/r/[email protected] Reported-by: kernel test robot <[email protected]> Reviewed-by: Avri Altman <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs: Fix imprecise load calculation in devfreq windowStanley Chu2-9/+11
The UFS load calculation is based on "total_time" and "busy_time" in a devfreq window. However, the source of time is different for both parameters: "busy_time" is assigned from "jiffies" thus has different accuracy from "total_time" which is assigned from ktime_get(). In addition, the time of window boundary is not exactly the same as the starting busy time in this window if UFS is actually busy in the beginning of the window. A similar accuracy error may also happen for the end of busy time in current window. To guarantee the precision of load calculation, we need to 1. Align time accuracy of both devfreq_dev_status.total_time and devfreq_dev_status.busy_time. For example, use "ktime_get()" directly. 2. Align the following timelines: - The beginning time of devfreq windows - The beginning of busy time in a new window - The end of busy time in the current window Link: https://lore.kernel.org/r/[email protected] Fixes: a3cd5ec55f6c ("scsi: ufs: add load based scaling of UFS gear") Reviewed-by: Avri Altman <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs: Add trace event for UIC commandsStanley Chu2-0/+57
Use the ftrace infrastructure to conditionally trace UFS UIC command events. New trace event "ufshcd_uic_command" is created, which samples the following UFS UIC command data: - Device name - Optional identification string - UIC command opcode - UIC command argument1 - UIC command argument2 - UIC command argement3 Usage: echo 1 > /sys/kernel/debug/tracing/events/ufs/enable cat /sys/kernel/debug/tracing/trace_pipe Link: https://lore.kernel.org/r/[email protected] Acked-by: Avri Altman <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs: Remove unused field in struct uic_commandStanley Chu1-4/+0
Remove unused fields "cmd_active" and "result" in struct ufs_command. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Alim Akhtar <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs: Clean up device vendor name and device quirk tableStanley Chu2-10/+7
Clean up the following items: - Sort vendor names in alphabetical order - Squash quirks as compact as possible in device table to enhance performance of the lookup - Sort device quirks in alphabetical order Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Alim Akhtar <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs: Add DELAY_BEFORE_LPM quirk for Micron devicesStanley Chu2-0/+3
It is confirmed that Micron device needs DELAY_BEFORE_LPM quirk to have a delay before VCC is powered off. Sdd Micron vendor ID and this quirk for Micron devices. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bean Huo <[email protected]> Reviewed-by: Alim Akhtar <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: mpt3sas: Fix spelling mistakeFlavio Suligoi2-2/+2
Fix typo: "tigger" --> "trigger" Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Flavio Suligoi <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: Fix trivial spellingKieran Bingham4-6/+6
The word 'descriptor' is misspelled throughout the tree. Fix it up accordingly: decriptors -> descriptors Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kieran Bingham <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs: Add SPDX GPL-2.0 to replace GPL v2 boilerplateBean Huo6-157/+6
Add SPDX GPL-2.0 to UFS driver files that specified the GPL version 2 license, remove the full boilerplate text. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Tomas Winkler <[email protected]> Reviewed-by: Alim Akhtar <[email protected]> Signed-off-by: Bean Huo <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs: Add compatibility with 3.1 UFS unit descriptor lengthBean Huo2-3/+9
For UFS 3.1, the normal unit descriptor is 10 bytes larger than the RPMB unit. However, both descriptors share the same desc_idn, to cover both unit descriptors with one length, we choose the normal unit descriptor length by desc_index. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Avri Altman <[email protected]> Signed-off-by: Bean Huo <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs: Clean up ufs initialization pathBean Huo4-161/+38
At UFS initialization stage, to get the length of the descriptor, ufshcd_read_desc_length() was being called 6 times. Instead, we will capture the descriptor size the first time we'll read it. Delete unnecessary redundant code, remove ufshcd_read_desc_length(), ufshcd_init_desc_sizes(), and boost UFS initialization. Link: https://lore.kernel.org/r/[email protected] Acked-by: Avri Altman <[email protected]> Reviewed-by: Bart van Assche <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Bean Huo <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs: Fix potential NULL pointer access during memcpyBean Huo1-2/+2
If param_offset is not 0, the memcpy length shouldn't be the true descriptor length. Link: https://lore.kernel.org/r/[email protected] Acked-by: Avri Altman <[email protected]> Signed-off-by: Bean Huo <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs: Delete ufshcd_read_desc()Bean Huo1-19/+8
Delete ufshcd_read_desc(). Instead, let caller directly call ufshcd_read_desc_param(). Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Avri Altman <[email protected]> Reviewed-by: Bart van Assche <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Bean Huo <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs: Remove max_t in ufs_get_device_descBean Huo1-4/+1
For the UFS device, the maximum descriptor size is 255, max_t called on ufs_get_device_desc() is useless. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Stanley Chu <[email protected]> Acked-by: Avri Altman <[email protected]> Signed-off-by: Bart van Assche <[email protected]> Signed-off-by: Bean Huo <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs-mediatek: Allow unbound mphyStanley Chu1-0/+6
Allow unbound MPHY module since not every MediaTek UFS platform needs specific MPHY control. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Peter Wang <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs-mediatek: Fix unbalanced clock on/offStanley Chu2-23/+38
MediaTek UFS clocks are separated to two parts and controlled by different modules: ufs-mediatek and phy-ufs-mediatek. If both Auto-Hibern8 and clk-gating feature are enabled, mphy power control is not balanced thus unbalanced control also happens to the clocks probed by phy-ufs-mediatek module. Fix this issue by: - Promise usage of phy_power_on/off balanced - Remove phy_power_on/off control in suspend/resume vops since both can be handled in setup_clock vops only Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Peter Wang <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs-mediatek: Introduce low-power mode for device power supplyStanley Chu1-0/+21
Allow device power supply to enter low-power mode. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Pengshun Zhao <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs-mediatek: Do not gate clocks if auto-hibern8 is not entered yetStanley Chu1-9/+27
There is a chance that link enters hibern8 via auto-hibern8 scheme during the clock-gating flow. Clocks shall not be gated if link is still active otherwise host or device may hang. Fix this by returning error code to the caller __ufshcd_setup_clocks() to skip gating clocks there if link is not confirmed in hibern8 state yet. Also allow some waiting time for the hibern8 state transition. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Andy Teng <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs-mediatek: Fix imprecise waiting time for ref-clk controlStanley Chu2-4/+5
Currently ref-clk control timeout is implemented by jiffies. However jiffies is not accurate enough thus "false timeout" may happen. Use more accurate delay mechanism instead, i.e. ktime. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Andy Teng <[email protected]> Reviewed-by: Avri Altman <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCsAlim Akhtar5-0/+1625
This patch introduces Exynos UFS host controller driver which mainly handles vendor-specific operations including link startup, power mode change and hibernation/unhibernation. [robot: drivers/scsi/ufs/ufs-exynos.c:931:8-10: WARNING: possible condition with no effect (if == else) ] Link: https://lore.kernel.org/r/[email protected] Reported-by: kbuild test robot <[email protected]> Reported-by: Julia Lawall <[email protected]> Tested-by: Paweł Chmiel <[email protected]> Reviewed-by: Kiwoong Kim <[email protected]> Reviewed-by: Avri Altman <[email protected]> Signed-off-by: Seungwon Jeon <[email protected]> Signed-off-by: Alim Akhtar <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs: Add quirk to fix abnormal ocs fatal errorKiwoong Kim2-0/+12
Some controller like Exynos determines if FATAL ERROR (0x7) in OCS field in UTRD occurs for values other than GOOD (0x0) in STATUS field in response upiu as well as errors that a host controller can't cover. This patch is to prevent from reporting command results in those cases. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Avri Altman <[email protected]> Signed-off-by: Kiwoong Kim <[email protected]> Signed-off-by: Alim Akhtar <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs: Introduce UFSHCD_QUIRK_PRDT_BYTE_GRAN quirkAlim Akhtar2-7/+29
Some UFS host controllers like Exynos uses granularities of PRDT length and offset as bytes, whereas others use actual segment count. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Avri Altman <[email protected]> Signed-off-by: Kiwoong Kim <[email protected]> Signed-off-by: Alim Akhtar <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs: Add quirk to enable host controller without hceAlim Akhtar2-2/+80
Some host controllers don't support host controller enable via HCE. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Can Guo <[email protected]> Reviewed-by: Avri Altman <[email protected]> Signed-off-by: Seungwon Jeon <[email protected]> Signed-off-by: Alim Akhtar <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-06-15scsi: ufs: Add quirk to disallow reset of interrupt aggregationAlim Akhtar2-1/+8
Some host controllers support interrupt aggregation but don't allow resetting counter and timer in software. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Avri Altman <[email protected]> Signed-off-by: Seungwon Jeon <[email protected]> Signed-off-by: Alim Akhtar <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>