Martin K. Petersen
7fb019c46e
scsi: sd: Switch to using scsi_device VPD pages
...
Use the VPD pages already provided by the SCSI midlayer. No need to request
them individually in the SCSI disk driver.
Link: https://lore.kernel.org/r/20220302053559.32147-8-martin.petersen@oracle.com
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-05-02 16:59:11 -04:00
Martin K. Petersen
e38d9e83a3
scsi: sd: Use cached ATA Information VPD page
...
Since the ATA Information VPD is now cached at device discovery time it is
no longer necessary to request this page when we configure WRITE SAME.
Instead use the cached information to determine if this disk sits behind a
SCSI-ATA translation layer.
Link: https://lore.kernel.org/r/20220302053559.32147-7-martin.petersen@oracle.com
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-05-02 16:59:11 -04:00
Martin K. Petersen
d657700cca
scsi: core: Do not truncate INQUIRY data on modern devices
...
Low-level device drivers have had the ability to limit the size of an
INQUIRY for many years. This made sense for a wide variety of legacy
devices. However, we are unnecessarily truncating the INQUIRY response for
many modern devices. This prevents us from consulting fields beyond the
first 36 bytes.
If a device reports that it supports a larger INQUIRY response, and the
device also reports that it implements SPC-4 or newer, allow the larger
INQUIRY to proceed.
Link: https://lore.kernel.org/r/20220302053559.32147-4-martin.petersen@oracle.com
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-05-02 16:59:11 -04:00
Martin K. Petersen
e60ac0b9e4
scsi: core: Cache VPD pages b0, b1, b2
...
The SCSI disk driver consults VPD pages b0 (Block Limits), b1 (Block Device
Characteristics), and b2 (Logical Block Provisioning). Instead of having
sd.c request these pages every revalidate cycle, cache them along with the
other commonly used VPDs.
Link: https://lore.kernel.org/r/20220302053559.32147-6-martin.petersen@oracle.com
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-05-02 16:59:11 -04:00
Martin K. Petersen
e17d634030
scsi: core: Pick suitable allocation length in scsi_report_opcode()
...
Some devices hang when a buffer size larger than expected is passed in the
ALLOCATION LENGTH field. For REPORT SUPPORTED OPERATION CODES we currently
only request a single command descriptor at a time and therefore the actual
size of the command is known ahead of time. Limit the ALLOCATION LENGTH to
the header size plus the command length of the opcode we are asking about.
Link: https://lore.kernel.org/r/20220302053559.32147-5-martin.petersen@oracle.com
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-05-02 16:59:10 -04:00
Martin K. Petersen
c92a6b5d63
scsi: core: Query VPD size before getting full page
...
We currently default to 255 bytes when fetching VPD pages during discovery.
However, we have had a few devices that are known to wedge if the requested
buffer exceeds a certain size. See commit af73623f5f ("[SCSI] sd: Reduce
buffer size for vpd request") which works around one example of this
problem in the SCSI disk driver.
With commit d188b0675b ("scsi: core: Add sysfs attributes for VPD pages
0h and 89h") we now risk triggering the same issue in the generic midlayer
code.
The problem with the ATA VPD page in particular is that the SCSI portion of
the page is trailed by 512 bytes of verbatim ATA Identify Device
information. However, not all controllers actually provide the additional
512 bytes and will lock up if one asks for more than the 64 bytes
containing the SCSI protocol fields.
Instead of picking a new, somewhat arbitrary, number of bytes for the VPD
buffer size, start fetching the 4-byte header for each page. The header
contains the size of the page as far as the device is concerned. We can use
the reported size to specify the correct allocation length when
subsequently fetching the full page.
The header validation is done by a new helper function scsi_get_vpd_size()
and both scsi_get_vpd_page() and scsi_get_vpd_buf() now rely on this to
query the page size.
In addition, scsi_get_vpd_page() is simplified to mirror the logic in
scsi_get_vpd_page(). This involves removing the Supported VPD Pages lookup
prior to attempting to query a page. There does not appear any evidence,
even in the oldest SCSI specs, that this step is required. We already rely
on scsi_get_vpd_page() throughout the stack and this function never
consulted the Supported VPD Pages. Since this has not caused any problems
it should be safe to remove the precondition from scsi_get_vpd_page().
Instrumented runs also revealed that the Supported VPD Pages lookup had
little effect since the device page index often was larger than the
supplied buffer size. As a result, inquiries frequently bypassed the index
check and went through the "If we ran off the end of the buffer, give us
the benefit of the doubt" code path which assumed the page was present
despite not being listed. The revised code takes both the page size
reported by the device as well as the size of the buffer provided by the
scsi_get_vpd_page() caller into account.
Link: https://lore.kernel.org/r/20220302053559.32147-3-martin.petersen@oracle.com
Fixes: d188b0675b ("scsi: core: Add sysfs attributes for VPD pages 0h and 89h")
Reported-by: Maciej W. Rozycki <macro@orcam.me.uk >
Tested-by: Maciej W. Rozycki <macro@orcam.me.uk >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-05-02 16:59:10 -04:00
Martin K. Petersen
dc1178767c
scsi: mpt3sas: Use cached ATA Information VPD page
...
We now cache VPD page 0x89 (ATA Information) so there is no need to request
it from the hardware. Make mpt3sas use the cached page.
Link: https://lore.kernel.org/r/20220302053559.32147-2-martin.petersen@oracle.com
Cc: Sreekanth Reddy <sreekanth.reddy@broadcom.com >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-05-02 16:59:10 -04:00
James Smart
646db1a560
scsi: lpfc: Fix resource leak in lpfc_sli4_send_seq_to_ulp()
...
If no handler is found in lpfc_complete_unsol_iocb() to match the rctl of a
received frame, the frame is dropped and resources are leaked.
Fix by returning resources when discarding an unhandled frame type. Update
lpfc_fc_frame_check() handling of NOP basic link service.
Link: https://lore.kernel.org/r/20220426181419.9154-1-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-26 22:24:28 -04:00
James Smart
3d1d34ec1f
scsi: lpfc: Remove unnecessary null ndlp check in lpfc_sli_prep_wqe()
...
Smatch had the following warning:
drivers/scsi/lpfc/lpfc_sli.c:22305 lpfc_sli_prep_wqe() error: we previously assumed 'ndlp' could be null (see line 22298)
Remove the unnecessary null check.
Link: https://lore.kernel.org/r/20220426181315.8990-1-jsmart2021@gmail.com
Fixes: d51cf5bd92 ("scsi: lpfc: Fix field overload in lpfc_iocbq data structure")
Reported-by: kernel test robot <lkp@intel.com >
Reported-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-26 22:24:27 -04:00
Minghao Chi
75b8715e20
scsi: ufs: Use pm_runtime_resume_and_get() instead of pm_runtime_get_sync()
...
Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync() and
pm_runtime_put_noidle(). This change is just to simplify the code, no
actual functional changes.
Link: https://lore.kernel.org/r/20220420090353.2588804-1-chi.minghao@zte.com.cn
Reported-by: Zeal Robot <zealci@zte.com.cn >
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-26 22:24:27 -04:00
Lv Ruyi
c5acd61dbb
scsi: megaraid: Fix error check return value of register_chrdev()
...
If major equals 0, register_chrdev() returns an error code when it fails.
This function dynamically allocates a major and returns its number on
success, so we should use "< 0" to check it instead of "!".
Link: https://lore.kernel.org/r/20220418105755.2558828-1-lv.ruyi@zte.com.cn
Reported-by: Zeal Robot <zealci@zte.com.cn >
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-26 09:02:44 -04:00
Guo Zhengkui
1497e95e22
scsi: qla2xxx: edif: Remove unneeded variable
...
Fix the following coccicheck warning:
drivers/scsi/qla2xxx/qla_edif.c:660:11-15: Unneeded variable: "rval".
Return "0" on line 761.
Link: https://lore.kernel.org/r/20220426074334.9281-1-guozhengkui@vivo.com
Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-26 08:57:05 -04:00
Xiaomeng Tong
036a45aa58
scsi: dc395x: Fix a missing check on list iterator
...
The bug is here:
p->target_id, p->target_lun);
The list iterator 'p' will point to a bogus position containing HEAD if the
list is empty or no element is found. This case must be checked before any
use of the iterator, otherwise it will lead to an invalid memory access.
To fix this bug, add a check. Use a new variable 'iter' as the list
iterator, and use the original variable 'p' as a dedicated pointer to point
to the found element.
Link: https://lore.kernel.org/r/20220414040231.2662-1-xiam0nd.tong@gmail.com
Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-26 08:51:56 -04:00
Xiaomeng Tong
505420bd55
scsi: qedf: Remove an unneeded NULL check on list iterator
...
The list iterator 'fcport' is always non-NULL so it doesn't need to be
checked. Thus just remove the unnecessary NULL check. Also remove the
unnecessary initializer because the list iterator is always initialized.
And adjust the position of blank lines.
Link: https://lore.kernel.org/r/20220405004055.24312-1-xiam0nd.tong@gmail.com
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-26 08:37:35 -04:00
Wan Jiabing
8ad8edd2fb
scsi: ufs: core: Remove duplicate include in ufshcd
...
Fix following checkincludes warning:
drivers/scsi/ufs/ufshcd.c: linux/nls.h is included more than once.
The include is in line 14. Remove the duplicate.
Link: https://lore.kernel.org/r/20220426104509.621394-1-wanjiabing@vivo.com
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-26 08:31:42 -04:00
Kiwoong Kim
ef60031022
scsi: ufs: core: Exclude UECxx from SFR dump list
...
Some devices may return invalid or zeroed data during an UIC error
condition. In addition, reading these SFRs will clear them. This means the
subsequent error handling will not be able to see them and therefore no
error handling will be scheduled.
Skip reading these SFRs in ufshcd_dump_regs().
Link: https://lore.kernel.org/r/1648689845-33521-1-git-send-email-kwmad.kim@samsung.com
Fixes: d672475664 ("scsi: ufs: Use explicit access size in ufshcd_dump_regs")
Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-26 08:29:54 -04:00
John Garry
973dac8a8a
scsi: core: Refine how we set tag_set NUMA node
...
For SCSI hosts which enable host_tagset the NUMA node returned from
blk_mq_hw_queue_to_node() is NUMA_NO_NODE always. Then, since in
scsi_mq_setup_tags() the default we choose for the tag_set NUMA node is
NUMA_NO_NODE, we always evaluate the NUMA node as NUMA_NO_NODE in functions
like blk_mq_alloc_rq_map().
The reason we get NUMA_NO_NODE from blk_mq_hw_queue_to_node() is that the
hctx_idx passed is BLK_MQ_NO_HCTX_IDX - so we can't match against a (HW)
queue mapping index.
Improve this by defaulting the tag_set NUMA node to the same NUMA node of
the SCSI host DMA dev.
Link: https://lore.kernel.org/r/1648640315-21419-1-git-send-email-john.garry@huawei.com
Signed-off-by: John Garry <john.garry@huawei.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-26 08:10:35 -04:00
Changcheng Deng
a346f28ad2
scsi: lpfc: Remove unneeded variable
...
Remove unneeded variable 'rc' used to store return value.
Link: https://lore.kernel.org/r/20220419065750.2573861-1-deng.changcheng@zte.com.cn
Reported-by: Zeal Robot <zealci@zte.com.cn >
Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:43:20 -04:00
ran jianping
671a52f2ae
scsi: fnic: Remove unneeded flush_workqueue()
...
All work currently pending will be done first by calling
destroy_workqueue(). There is no need to flush it explicitly.
Link: https://lore.kernel.org/r/20220424065406.3228528-1-ran.jianping@zte.com.cn
Reported-by: Zeal Robot <zealci@zte.com.cn >
Signed-off-by: ran jianping <ran.jianping@zte.com.cn >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:41:35 -04:00
ran jianping
cf97628fe1
scsi: qla2xxx: Remove unneeded flush_workqueue()
...
All work currently pending will be done first by calling
destroy_workqueue(). There is no need to flush it explicitly.
Link: https://lore.kernel.org/r/20220424062413.3220315-1-ran.jianping@zte.com.cn
Reported-by: Zeal Robot <zealci@zte.com.cn >
Signed-off-by: ran jianping <ran.jianping@zte.com.cn >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:40:26 -04:00
ran jianping
4c0df601e1
scsi: bfa: Remove unneeded flush_workqueue()
...
All work currently pending will be done first by calling
destroy_workqueue(). There is no need to flush it explicitly.
Link: https://lore.kernel.org/r/20220424061845.3218774-1-ran.jianping@zte.com.cn
Reported-by: Zeal Robot <zealci@zte.com.cn >
Signed-off-by: ran jianping <ran.jianping@zte.com.cn >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:38:38 -04:00
Haowen Bai
21faafff6a
scsi: qedf: Remove unnecessary code
...
Buffer 'msg' is memset() but never actually used. Drop it.
Link: https://lore.kernel.org/r/1650536693-13089-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Haowen Bai <baihaowen@meizu.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:36:31 -04:00
Haowen Bai
bda57fede0
scsi: qla4xxx: Drop redundant memset()
...
The region set by the call to memset() is immediately overwritten by the
subsequent call to memcpy(). Drop redundant memset().
Link: https://lore.kernel.org/r/1650533091-28815-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Haowen Bai <baihaowen@meizu.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:33:36 -04:00
Haowen Bai
391b8dac55
scsi: ipr: Directly return instead of using local ret variable
...
Fixes coccinelle warning:
./drivers/scsi/ipr.c:10095:13-15: Unneeded variable: "rc". Return "IRQ_HANDLED" on line 10104
Link: https://lore.kernel.org/r/1648433103-24308-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Haowen Bai <baihaowen@meizu.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:29:40 -04:00
Wan Jiabing
507bd398a0
scsi: elx: efct: Remove unnecessary memset() in efct_io()
...
io->sgl is allocated by kzalloc(). The memory is set to zero.
It is unnecessary to call memset again.
Link: https://lore.kernel.org/r/20220318145230.1031-1-wanjiabing@vivo.com
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:28:25 -04:00
Alexander Vorwerk
ce781c3f05
scsi: message: fusion: Remove unused variable retval
...
The following warning showed up when compiling with W=1.
drivers/message/fusion/mptctl.c: In function ‘mptctl_hp_hostinfo’:
drivers/message/fusion/mptctl.c:2337:8: warning: variable ‘retval’ set but not used [-Wunused-but-set-variable]
int retval;
Fixing by removing the variable.
Link: https://lore.kernel.org/r/20220317030325.30526-1-alexander.vorwerk@stud.uni-goettingen.de
Signed-off-by: Alexander Vorwerk <alexander.vorwerk@stud.uni-goettingen.de >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:26:32 -04:00
Haowen Bai
8c36b054df
scsi: aha1542: Remove unneeded semicolon
...
Fixes coccicheck warning:
drivers/scsi/aha1542.c:553:2-3: Unneeded semicolon
drivers/scsi/aha1542.c:582:2-3: Unneeded semicolon
drivers/scsi/aha1542.c:605:2-3: Unneeded semicolon
drivers/scsi/aha1542.c:306:2-3: Unneeded semicolon
drivers/scsi/aha1542.c:348:3-4: Unneeded semicolon
drivers/scsi/aha1542.c:412:2-3: Unneeded semicolon
drivers/scsi/aha1542.c:640:2-3: Unneeded semicolon
drivers/scsi/aha1542.c:658:2-3: Unneeded semicolon
drivers/scsi/aha1542.c:677:2-3: Unneeded semicolon
drivers/scsi/aha1542.c:538:2-3: Unneeded semicolon
Link: https://lore.kernel.org/r/1647309865-15620-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Haowen Bai <baihaowen@meizu.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:25:11 -04:00
Haowen Bai
8e897c8466
scsi: bfa: Remove redundant NULL check
...
Fix the following warning reported by coccicheck:
drivers/scsi/bfa/bfad_debugfs.c:375:2-7: WARNING: NULL check before some freeing functions is not needed.
Link: https://lore.kernel.org/r/1647309434-13936-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Haowen Bai <baihaowen@meizu.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:05 -04:00
Haowen Bai
1dcd96c4d0
scsi: fnic: Remove redundant NULL check
...
Fix the following warning reported by coccicheck:
drivers/scsi/fnic/fnic_debugfs.c:90:2-7: WARNING: NULL check before some freeing functions is not needed.
Link: https://lore.kernel.org/r/1647309219-12772-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Haowen Bai <baihaowen@meizu.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:05 -04:00
Haowen Bai
93de8df205
scsi: mac53c94: Fix warning comparing pointer to 0
...
Fix the following coccicheck warning:
drivers/scsi/mac53c94.c:237:12-13: WARNING comparing pointer to 0
Link: https://lore.kernel.org/r/1647244711-31575-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Haowen Bai <baihaowen@meizu.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:05 -04:00
Borislav Petkov
331c6e910f
scsi: aacraid: Fix undefined behavior due to shift overflowing the constant
...
Fix:
drivers/scsi/aacraid/commsup.c: In function ‘aac_handle_sa_aif’:
drivers/scsi/aacraid/commsup.c:1983:2: error: case label does not reduce to an integer constant
case SA_AIF_BPCFG_CHANGE:
^~~~
See https://lore.kernel.org/r/YkwQ6%2BtIH8GQpuct@zn.tnic for the gory
details as to why it triggers with older gccs only.
Link: https://lore.kernel.org/r/20220405151517.29753-2-bp@alien8.de
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com >
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com >
Cc: "Martin K. Petersen" <martin.petersen@oracle.com >
Cc: linux-scsi@vger.kernel.org
Reviewed-by: Randy Dunlap <rdunlap@infradead.org >
Signed-off-by: Borislav Petkov <bp@suse.de >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:05 -04:00
Damien Le Moal
4a5fc1c6d7
scsi: scsi_debug: Add gap zone support
...
Add the 'zone_cap_mb' kernel module parameter. This parameter defines the
zone capacity. The zone capacity must be less than or equal to the zone
size.
Report that sequential write zones and gap zones are paired in the Zoned
Block Device Characteristics VPD page (page B6h).
This patch has been tested as follows:
modprobe scsi_debug delay=0 sector_size=512 dev_size_mb=128 zbc=host-managed zone_nr_conv=16 zone_size_mb=4 zone_cap_mb=3
modprobe brd rd_nr=1 rd_size=$((1<<20))
mkfs.f2fs -m /dev/ram0 -c /dev/${scsi_debug_dev}
mount /dev/ram0 /mnt
# Run a fio job that uses /mnt
Link: https://lore.kernel.org/r/20220421183023.3462291-10-bvanassche@acm.org
Cc: Douglas Gilbert <dgilbert@interlog.com >
Acked-by: Douglas Gilbert <dgilbert@interlog.com >
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
[ bvanassche: Switched to reporting a constant zone starting LBA granularity ]
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:05 -04:00
Damien Le Moal
35dbe2b9a7
scsi: scsi_debug: Rename zone type constants
...
Rename the scsi_debug zone type constants to prevent a conflict with the
ZBC_ZONE_TYPE_GAP constant from include/scsi/scsi_proto.h.
Link: https://lore.kernel.org/r/20220421183023.3462291-9-bvanassche@acm.org
Cc: Douglas Gilbert <dgilbert@interlog.com >
Acked-by: Douglas Gilbert <dgilbert@interlog.com >
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
[ bvanassche: Extracted these changes from a larger patch ]
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:05 -04:00
Bart Van Assche
897284e8a0
scsi: scsi_debug: Fix a typo
...
Change a single occurrence of "nad" into "and".
Link: https://lore.kernel.org/r/20220421183023.3462291-8-bvanassche@acm.org
Cc: Douglas Gilbert <dgilbert@interlog.com >
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com >
Acked-by: Douglas Gilbert <dgilbert@interlog.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:05 -04:00
Damien Le Moal
c976e588b3
scsi: sd: sd_zbc: Hide gap zones
...
ZBC-2 allows host-managed disks to report gap zones. This allow zoned disks
to report an offset between data zone starts that is a power of two even if
the number of logical blocks with data per zone is not a power of two.
Another new feature in ZBC-2 is support for constant zone starting LBA
offsets. For zoned disks that report a constant zone starting LBA offset,
hide the gap zones from the block layer. Report the offset between data
zone starts as zone size and report the number of logical blocks with data
per zone as the zone capacity.
Link: https://lore.kernel.org/r/20220421183023.3462291-7-bvanassche@acm.org
Acked-by: Douglas Gilbert <dgilbert@interlog.com >
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
[ bvanassche: Reworked this patch ]
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:05 -04:00
Damien Le Moal
60caf37581
scsi: sd: sd_zbc: Return early in sd_zbc_check_zoned_characteristics()
...
Return early in sd_zbc_check_zoned_characteristics() for host-aware
disks. This patch does not change any functionality but makes a later patch
easier to read.
Link: https://lore.kernel.org/r/20220421183023.3462291-6-bvanassche@acm.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com >
Acked-by: Douglas Gilbert <dgilbert@interlog.com >
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
[ bvanassche: extracted this change from a larger patch ]
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:04 -04:00
Bart Van Assche
628617be89
scsi: sd: sd_zbc: Introduce struct zoned_disk_info
...
Deriving the meaning of the nr_zones, rev_nr_zones, zone_blocks and
rev_zone_blocks member variables requires careful analysis of the source
code. Make the meaning of these member variables easier to understand by
introducing struct zoned_disk_info.
Link: https://lore.kernel.org/r/20220421183023.3462291-5-bvanassche@acm.org
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com >
Acked-by: Douglas Gilbert <dgilbert@interlog.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:04 -04:00
Damien Le Moal
43af5da09e
scsi: sd: sd_zbc: Use logical blocks as unit when querying zones
...
When querying zones, track the position in logical blocks instead of in
sectors. This change slightly simplifies sd_zbc_report_zones().
Link: https://lore.kernel.org/r/20220421183023.3462291-4-bvanassche@acm.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com >
Acked-by: Douglas Gilbert <dgilbert@interlog.com >
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
[ bvanassche: extracted this change from a larger patch ]
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:04 -04:00
Bart Van Assche
9a93b9c9d3
scsi: sd: sd_zbc: Verify that the zone size is a power of two
...
The following check in sd_zbc_cmnd_checks() can only work correctly if the
zone size is a power of two:
if (sector & (sd_zbc_zone_sectors(sdkp) - 1))
/* Unaligned request */
return BLK_STS_IOERR;
Hence this patch that verifies that the zone size is a power of two.
Link: https://lore.kernel.org/r/20220421183023.3462291-3-bvanassche@acm.org
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com >
Acked-by: Douglas Gilbert <dgilbert@interlog.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:04 -04:00
Bart Van Assche
aa96bfb4ca
scsi: sd: sd_zbc: Improve source code documentation
...
Add several kernel-doc headers. Declare input arrays const. Specify the
array size in function declarations.
Link: https://lore.kernel.org/r/20220421183023.3462291-2-bvanassche@acm.org
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com >
Acked-by: Douglas Gilbert <dgilbert@interlog.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:04 -04:00
Bart Van Assche
a8b032b5b3
scsi: ufs: Move the ufs_is_valid_unit_desc_lun() definition
...
Move the definition of this function from a public into a private header
file since it is only used inside the UFS core.
Link: https://lore.kernel.org/r/20220419225811.4127248-29-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:04 -04:00
Bart Van Assche
743b09d854
scsi: ufs: Move the struct ufs_ref_clk definition
...
Move the definition of this data structure since it is only used in a
single source file.
Link: https://lore.kernel.org/r/20220419225811.4127248-28-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:04 -04:00
Bart Van Assche
4bc26113c6
scsi: ufs: Split the ufshcd.h header file
...
Split the ufshcd.h header file into a header file that defines the
interface used by UFS drivers and another header file with declarations and
data structures only used by the UFS core.
Link: https://lore.kernel.org/r/20220419225811.4127248-27-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:04 -04:00
Bart Van Assche
3f06f7800b
scsi: ufs: Minimize #include directives
...
Follow the convention that is used elsewhere in the Linux kernel source
code and only include those headers of which the declarations are used
directly.
Link: https://lore.kernel.org/r/20220419225811.4127248-26-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:04 -04:00
Bart Van Assche
cff91daf52
scsi: ufs: Fix kernel-doc syntax in ufshcd.h
...
This patch fixes all the warnings and errors reported by the following
command:
scripts/kernel-doc -none drivers/scsi/ufs/ufshcd.h
Link: https://lore.kernel.org/r/20220419225811.4127248-25-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:04 -04:00
Bart Van Assche
c10d52d73a
scsi: ufs: Remove unnecessary ufshcd-crypto.h include directives
...
ufshcd-crypto.h declares functions that must only be called by the UFS
core. Hence remove the #include "ufshcd-crypto.h" directive from UFS
drivers.
Link: https://lore.kernel.org/r/20220419225811.4127248-24-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Eric Biggers <ebiggers@google.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:03 -04:00
Bart Van Assche
bee40dc167
scsi: ufs: qcom: Fix ufs_qcom_resume()
...
Clearing hba->is_sys_suspended if ufs_qcom_resume() succeeds is wrong. That
variable must only be cleared if all actions involved in a resume succeed.
Hence remove the statement that clears hba->is_sys_suspended from
ufs_qcom_resume().
Link: https://lore.kernel.org/r/20220419225811.4127248-23-bvanassche@acm.org
Fixes: 81c0fc51b7 ("ufs-qcom: add support for Qualcomm Technologies Inc platforms")
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:03 -04:00
Bart Van Assche
ad8a647e77
scsi: ufs: Introduce ufshcd_clkgate_delay_set()
...
Since the code to modify delay_ms while holding the host lock occurs twice,
introduce a function that performs this action.
Link: https://lore.kernel.org/r/20220419225811.4127248-22-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:03 -04:00
Bart Van Assche
3fb20fcd93
scsi: ufs: Remove locking from around single register writes
...
Single register writes are atomic and hence do not need to be surrounded by
locking. Additionally, MMIO writes are typically posted asynchronously.
Hence, there is no guarantee that these have finished by the time the
spin_unlock*() call has finished. See also the nonposted-mmio property of
the Open Firmware tree. See also pci_iomap().
Link: https://lore.kernel.org/r/20220419225811.4127248-21-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:03 -04:00
Bart Van Assche
21c2e3418d
scsi: ufs: Remove the TRUE and FALSE definitions
...
In the Linux kernel coding style document
(Documentation/process/coding-style.rst) it is recommended to use the type
'bool' and also the values 'true' and 'false'. Hence this patch that
removes the definitions and uses of TRUE and FALSE from the UFS driver.
Link: https://lore.kernel.org/r/20220419225811.4127248-20-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:03 -04:00