Skip to content

Commit

Permalink
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/jejb/scsi

Pull SCSI updates from James Bottomley:
 "This series consists of the usual driver updates (qla2xxx, pm8001,
  libsas, smartpqi, scsi_debug, lpfc, iscsi, mpi3mr) plus minor updates
  and bug fixes.

  The high blast radius core update is the removal of write same, which
  affects block and several non-SCSI devices. The other big change,
  which is more local, is the removal of the SCSI pointer"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (281 commits)
  scsi: scsi_ioctl: Drop needless assignment in sg_io()
  scsi: bsg: Drop needless assignment in scsi_bsg_sg_io_fn()
  scsi: lpfc: Copyright updates for 14.2.0.0 patches
  scsi: lpfc: Update lpfc version to 14.2.0.0
  scsi: lpfc: SLI path split: Refactor BSG paths
  scsi: lpfc: SLI path split: Refactor Abort paths
  scsi: lpfc: SLI path split: Refactor SCSI paths
  scsi: lpfc: SLI path split: Refactor CT paths
  scsi: lpfc: SLI path split: Refactor misc ELS paths
  scsi: lpfc: SLI path split: Refactor VMID paths
  scsi: lpfc: SLI path split: Refactor FDISC paths
  scsi: lpfc: SLI path split: Refactor LS_RJT paths
  scsi: lpfc: SLI path split: Refactor LS_ACC paths
  scsi: lpfc: SLI path split: Refactor the RSCN/SCR/RDF/EDC/FARPR paths
  scsi: lpfc: SLI path split: Refactor PLOGI/PRLI/ADISC/LOGO paths
  scsi: lpfc: SLI path split: Refactor base ELS paths and the FLOGI path
  scsi: lpfc: SLI path split: Introduce lpfc_prep_wqe
  scsi: lpfc: SLI path split: Refactor fast and slow paths to native SLI4
  scsi: lpfc: SLI path split: Refactor lpfc_iocbq
  scsi: lpfc: Use kcalloc()
  ...
  • Loading branch information
torvalds committed Mar 25, 2022
2 parents b1f8ccd + 66daf3e commit 6f2689a
Show file tree
Hide file tree
Showing 298 changed files with 8,536 additions and 8,334 deletions.
2 changes: 0 additions & 2 deletions Documentation/scsi/libsas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ Management Functions (TMFs) described in SAM::
/* Task Management Functions. Must be called from process context. */
int (*lldd_abort_task)(struct sas_task *);
int (*lldd_abort_task_set)(struct domain_device *, u8 *lun);
int (*lldd_clear_aca)(struct domain_device *, u8 *lun);
int (*lldd_clear_task_set)(struct domain_device *, u8 *lun);
int (*lldd_I_T_nexus_reset)(struct domain_device *);
int (*lldd_lu_reset)(struct domain_device *, u8 *lun);
Expand Down Expand Up @@ -262,7 +261,6 @@ can look like this (called last thing from probe())

my_ha->sas_ha.lldd_abort_task = my_abort_task;
my_ha->sas_ha.lldd_abort_task_set = my_abort_task_set;
my_ha->sas_ha.lldd_clear_aca = my_clear_aca;
my_ha->sas_ha.lldd_clear_task_set = my_clear_task_set;
my_ha->sas_ha.lldd_I_T_nexus_reset= NULL; (2)
my_ha->sas_ha.lldd_lu_reset = my_lu_reset;
Expand Down
15 changes: 7 additions & 8 deletions Documentation/scsi/scsi_eh.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,18 @@ function

- BLK_EH_RESET_TIMER
This indicates that more time is required to finish the
command. Timer is restarted. This action is counted as a
retry and only allowed scmd->allowed + 1(!) times. Once the
limit is reached, action for BLK_EH_DONE is taken instead.
command. Timer is restarted.

- BLK_EH_DONE
eh_timed_out() callback did not handle the command.
Step #2 is taken.

2. scsi_abort_command() is invoked to schedule an asynchrous abort.
Asynchronous abort are not invoked for commands which the
SCSI_EH_ABORT_SCHEDULED flag is set (this indicates that the command
already had been aborted once, and this is a retry which failed),
or when the EH deadline is expired. In these case Step #3 is taken.
2. scsi_abort_command() is invoked to schedule an asynchronous abort which may
issue a retry scmd->allowed + 1 times. Asynchronous aborts are not invoked
for commands for which the SCSI_EH_ABORT_SCHEDULED flag is set (this
indicates that the command already had been aborted once, and this is a
retry which failed), when retries are exceeded, or when the EH deadline is
expired. In these cases Step #3 is taken.

3. scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD) is invoked for the
command. See [1-4] for more information.
Expand Down
70 changes: 35 additions & 35 deletions Documentation/scsi/ufs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Universal Flash Storage
1. Overview
2. UFS Architecture Overview
2.1 Application Layer
2.2 UFS Transport Protocol(UTP) layer
2.3 UFS Interconnect(UIC) Layer
2.2 UFS Transport Protocol (UTP) layer
2.3 UFS Interconnect (UIC) Layer
3. UFSHCD Overview
3.1 UFS controller initialization
3.2 UTP Transfer requests
Expand All @@ -22,15 +22,15 @@ Universal Flash Storage
1. Overview
===========

Universal Flash Storage(UFS) is a storage specification for flash devices.
It is aimed to provide a universal storage interface for both
embedded and removable flash memory based storage in mobile
Universal Flash Storage (UFS) is a storage specification for flash devices.
It aims to provide a universal storage interface for both
embedded and removable flash memory-based storage in mobile
devices such as smart phones and tablet computers. The specification
is defined by JEDEC Solid State Technology Association. UFS is based
on MIPI M-PHY physical layer standard. UFS uses MIPI M-PHY as the
on the MIPI M-PHY physical layer standard. UFS uses MIPI M-PHY as the
physical layer and MIPI Unipro as the link layer.

The main goals of UFS is to provide:
The main goals of UFS are to provide:

* Optimized performance:

Expand All @@ -53,17 +53,17 @@ The main goals of UFS is to provide:
UFS has a layered communication architecture which is based on SCSI
SAM-5 architectural model.

UFS communication architecture consists of following layers,
UFS communication architecture consists of the following layers.

2.1 Application Layer
---------------------

The Application layer is composed of UFS command set layer(UCS),
The Application layer is composed of the UFS command set layer (UCS),
Task Manager and Device manager. The UFS interface is designed to be
protocol agnostic, however SCSI has been selected as a baseline
protocol for versions 1.0 and 1.1 of UFS protocol layer.
protocol for versions 1.0 and 1.1 of the UFS protocol layer.

UFS supports subset of SCSI commands defined by SPC-4 and SBC-3.
UFS supports a subset of SCSI commands defined by SPC-4 and SBC-3.

* UCS:
It handles SCSI commands supported by UFS specification.
Expand All @@ -78,30 +78,30 @@ UFS communication architecture consists of following layers,
requests which are used to modify and retrieve configuration
information of the device.

2.2 UFS Transport Protocol(UTP) layer
-------------------------------------
2.2 UFS Transport Protocol (UTP) layer
--------------------------------------

UTP layer provides services for
The UTP layer provides services for
the higher layers through Service Access Points. UTP defines 3
service access points for higher layers.

* UDM_SAP: Device manager service access point is exposed to device
manager for device level operations. These device level operations
are done through query requests.
* UTP_CMD_SAP: Command service access point is exposed to UFS command
set layer(UCS) to transport commands.
set layer (UCS) to transport commands.
* UTP_TM_SAP: Task management service access point is exposed to task
manager to transport task management functions.

UTP transports messages through UFS protocol information unit(UPIU).
UTP transports messages through UFS protocol information unit (UPIU).

2.3 UFS Interconnect(UIC) Layer
-------------------------------
2.3 UFS Interconnect (UIC) Layer
--------------------------------

UIC is the lowest layer of UFS layered architecture. It handles
connection between UFS host and UFS device. UIC consists of
UIC is the lowest layer of the UFS layered architecture. It handles
the connection between UFS host and UFS device. UIC consists of
MIPI UniPro and MIPI M-PHY. UIC provides 2 service access points
to upper layer,
to upper layer:

* UIC_SAP: To transport UPIU between UFS host and UFS device.
* UIO_SAP: To issue commands to Unipro layers.
Expand All @@ -110,45 +110,45 @@ UFS communication architecture consists of following layers,
3. UFSHCD Overview
==================

The UFS host controller driver is based on Linux SCSI Framework.
UFSHCD is a low level device driver which acts as an interface between
SCSI Midlayer and PCIe based UFS host controllers.
The UFS host controller driver is based on the Linux SCSI Framework.
UFSHCD is a low-level device driver which acts as an interface between
the SCSI Midlayer and PCIe-based UFS host controllers.

The current UFSHCD implementation supports following functionality,
The current UFSHCD implementation supports the following functionality:

3.1 UFS controller initialization
---------------------------------

The initialization module brings UFS host controller to active state
and prepares the controller to transfer commands/response between
The initialization module brings the UFS host controller to active state
and prepares the controller to transfer commands/responses between
UFSHCD and UFS device.

3.2 UTP Transfer requests
-------------------------

Transfer request handling module of UFSHCD receives SCSI commands
from SCSI Midlayer, forms UPIUs and issues the UPIUs to UFS Host
controller. Also, the module decodes, responses received from UFS
from the SCSI Midlayer, forms UPIUs and issues the UPIUs to the UFS Host
controller. Also, the module decodes responses received from the UFS
host controller in the form of UPIUs and intimates the SCSI Midlayer
of the status of the command.

3.3 UFS error handling
----------------------

Error handling module handles Host controller fatal errors,
Device fatal errors and UIC interconnect layer related errors.
Device fatal errors and UIC interconnect layer-related errors.

3.4 SCSI Error handling
-----------------------

This is done through UFSHCD SCSI error handling routines registered
with SCSI Midlayer. Examples of some of the error handling commands
issues by SCSI Midlayer are Abort task, Lun reset and host reset.
with the SCSI Midlayer. Examples of some of the error handling commands
issues by the SCSI Midlayer are Abort task, LUN reset and host reset.
UFSHCD Routines to perform these tasks are registered with
SCSI Midlayer through .eh_abort_handler, .eh_device_reset_handler and
.eh_host_reset_handler.

In this version of UFSHCD Query requests and power management
In this version of UFSHCD, Query requests and power management
functionality are not implemented.

4. BSG Support
Expand Down Expand Up @@ -182,14 +182,14 @@ If you wish to read or write a descriptor, use the appropriate xferp of
sg_io_v4.

The userspace tool that interacts with the ufs-bsg endpoint and uses its
upiu-based protocol is available at:
UPIU-based protocol is available at:

https://github.com/westerndigitalcorporation/ufs-tool

For more detailed information about the tool and its supported
features, please see the tool's README.

UFS Specifications can be found at:
UFS specifications can be found at:

- UFS - http://www.jedec.org/sites/default/files/docs/JESD220.pdf
- UFSHCI - http://www.jedec.org/sites/default/files/docs/JESD223.pdf
13 changes: 1 addition & 12 deletions block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ static const char *const blk_op_name[] = {
REQ_OP_NAME(ZONE_CLOSE),
REQ_OP_NAME(ZONE_FINISH),
REQ_OP_NAME(ZONE_APPEND),
REQ_OP_NAME(WRITE_SAME),
REQ_OP_NAME(WRITE_ZEROES),
REQ_OP_NAME(DRV_IN),
REQ_OP_NAME(DRV_OUT),
Expand Down Expand Up @@ -828,10 +827,6 @@ void submit_bio_noacct(struct bio *bio)
if (!blk_queue_secure_erase(q))
goto not_supported;
break;
case REQ_OP_WRITE_SAME:
if (!q->limits.max_write_same_sectors)
goto not_supported;
break;
case REQ_OP_ZONE_APPEND:
status = blk_check_zone_append(q, bio);
if (status != BLK_STS_OK)
Expand Down Expand Up @@ -903,13 +898,7 @@ void submit_bio(struct bio *bio)
* go through the normal accounting stuff before submission.
*/
if (bio_has_data(bio)) {
unsigned int count;

if (unlikely(bio_op(bio) == REQ_OP_WRITE_SAME))
count = queue_logical_block_size(
bdev_get_queue(bio->bi_bdev)) >> 9;
else
count = bio_sectors(bio);
unsigned int count = bio_sectors(bio);

if (op_is_write(bio_op(bio))) {
count_vm_events(PGPGOUT, count);
Expand Down
88 changes: 0 additions & 88 deletions block/blk-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,94 +132,6 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
}
EXPORT_SYMBOL(blkdev_issue_discard);

/**
* __blkdev_issue_write_same - generate number of bios with same page
* @bdev: target blockdev
* @sector: start sector
* @nr_sects: number of sectors to write
* @gfp_mask: memory allocation flags (for bio_alloc)
* @page: page containing data to write
* @biop: pointer to anchor bio
*
* Description:
* Generate and issue number of bios(REQ_OP_WRITE_SAME) with same page.
*/
static int __blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
sector_t nr_sects, gfp_t gfp_mask, struct page *page,
struct bio **biop)
{
struct request_queue *q = bdev_get_queue(bdev);
unsigned int max_write_same_sectors;
struct bio *bio = *biop;
sector_t bs_mask;

if (bdev_read_only(bdev))
return -EPERM;

bs_mask = (bdev_logical_block_size(bdev) >> 9) - 1;
if ((sector | nr_sects) & bs_mask)
return -EINVAL;

if (!bdev_write_same(bdev))
return -EOPNOTSUPP;

/* Ensure that max_write_same_sectors doesn't overflow bi_size */
max_write_same_sectors = bio_allowed_max_sectors(q);

while (nr_sects) {
bio = blk_next_bio(bio, bdev, 1, REQ_OP_WRITE_SAME, gfp_mask);
bio->bi_iter.bi_sector = sector;
bio->bi_vcnt = 1;
bio->bi_io_vec->bv_page = page;
bio->bi_io_vec->bv_offset = 0;
bio->bi_io_vec->bv_len = bdev_logical_block_size(bdev);

if (nr_sects > max_write_same_sectors) {
bio->bi_iter.bi_size = max_write_same_sectors << 9;
nr_sects -= max_write_same_sectors;
sector += max_write_same_sectors;
} else {
bio->bi_iter.bi_size = nr_sects << 9;
nr_sects = 0;
}
cond_resched();
}

*biop = bio;
return 0;
}

/**
* blkdev_issue_write_same - queue a write same operation
* @bdev: target blockdev
* @sector: start sector
* @nr_sects: number of sectors to write
* @gfp_mask: memory allocation flags (for bio_alloc)
* @page: page containing data
*
* Description:
* Issue a write same request for the sectors in question.
*/
int blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
sector_t nr_sects, gfp_t gfp_mask,
struct page *page)
{
struct bio *bio = NULL;
struct blk_plug plug;
int ret;

blk_start_plug(&plug);
ret = __blkdev_issue_write_same(bdev, sector, nr_sects, gfp_mask, page,
&bio);
if (ret == 0 && bio) {
ret = submit_bio_wait(bio);
bio_put(bio);
}
blk_finish_plug(&plug);
return ret;
}
EXPORT_SYMBOL(blkdev_issue_write_same);

static int __blkdev_issue_write_zeroes(struct block_device *bdev,
sector_t sector, sector_t nr_sects, gfp_t gfp_mask,
struct bio **biop, unsigned flags)
Expand Down
Loading

0 comments on commit 6f2689a

Please sign in to comment.