OSDN Git Service

tomoyo/tomoyo-test1.git
2 years agoscsi: mac53c94: Stop using struct scsi_pointer
Finn Thain [Mon, 21 Feb 2022 23:09:42 +0000 (10:09 +1100)]
scsi: mac53c94: Stop using struct scsi_pointer

This driver doesn't use SCp.ptr to save a SCSI command data pointer which
means "scsi pointer" is a complete misnomer here. Only a few members of
struct scsi_pointer are used and the rest waste memory.  Avoid the "struct
foo { struct bar; };" silliness.

Link: https://lore.kernel.org/r/3529a59873a7de8455a27af2528341afe5069adc.1645484982.git.fthain@linux-m68k.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mesh: Stop using struct scsi_pointer
Finn Thain [Mon, 21 Feb 2022 23:09:42 +0000 (10:09 +1100)]
scsi: mesh: Stop using struct scsi_pointer

This driver doesn't use SCp.ptr to save a SCSI command data pointer which
means "scsi pointer" is a complete misnomer here. Only a few members of
struct scsi_pointer are used and the rest waste memory.  Avoid the "struct
foo { struct bar; };" silliness.

Link: https://lore.kernel.org/r/fbf930e64af5b15ca028dfe25b00fe933951f19b.1645484982.git.fthain@linux-m68k.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: core: docs: Update notes about scsi_times_out
Khazhismel Kumykov [Sat, 19 Feb 2022 00:16:01 +0000 (16:16 -0800)]
scsi: core: docs: Update notes about scsi_times_out

Most importantly: eh_timed_out() is not limited by scmd->allowed, and can
reset timer forever.

Fixes: c829c394165f ("[SCSI] FC transport : Avoid device offline cases by stalling aborts until device unblocked")
Link: https://lore.kernel.org/r/20220219001601.3534043-1-khazhy@google.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: message: fusion: Use GFP_KERNEL instead of GFP_ATOMIC in non-atomic context
Christophe JAILLET [Tue, 15 Feb 2022 06:32:34 +0000 (07:32 +0100)]
scsi: message: fusion: Use GFP_KERNEL instead of GFP_ATOMIC in non-atomic context

Just a few lines below this kzalloc() we have a mutex_lock() which can
sleep.

Moreover, the only way to call this function is when a delayed work is
schedule. And delayed work can sleep:

  INIT_DELAYED_WORK(&fw_event->work, mptsas_firmware_event_work);
    --> mptsas_firmware_event_work()
      --> mptsas_send_link_status_event()
        --> mptsas_expander_add()

So there is really no good reason to use GFP_ATOMIC here. Change it to
GFP_KERNEL to give more opportunities to the kernel.

Link: https://lore.kernel.org/r/eccb2179ce800529851ed4fabc9d3f95fbbf7d7f.1644906731.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libfc: Replace one-element arrays with flexible-array members
Gustavo A. R. Silva [Mon, 14 Feb 2022 22:39:03 +0000 (16:39 -0600)]
scsi: libfc: Replace one-element arrays with flexible-array members

Use flexible-array members in struct fc_fdmi_attr_entry and fs_fdmi_attrs
instead of one-element arrays, and refactor the code accordingly.

Also, this helps with the ongoing efforts to globally enable -Warray-bounds
and get us closer to being able to tighten the FORTIFY_SOURCE routines on
memcpy().

https://github.com/KSPP/linux/issues/79
https://github.com/ClangBuiltLinux/linux/issues/1590

Link: https://lore.kernel.org/r/20220214223903.GA859464@embeddedor
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix pm8001_info() message format
Damien Le Moal [Sun, 20 Feb 2022 03:18:10 +0000 (12:18 +0900)]
scsi: pm8001: Fix pm8001_info() message format

Make the driver messages more readable by adding a space after the message
prefix ":" and removing the extra space between function name and line
number.

Link: https://lore.kernel.org/r/20220220031810.738362-32-damien.lemoal@opensource.wdc.com
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Improve pm80XX_send_abort_all()
Damien Le Moal [Sun, 20 Feb 2022 03:18:09 +0000 (12:18 +0900)]
scsi: pm8001: Improve pm80XX_send_abort_all()

Both pm8001_send_abort_all() and pm80xx_send_abort_all() are called only
for a non null device with the NCQ_READ_LOG_FLAG set, so remove the device
check on entry of these functions. Furthermore, setting the
NCQ_ABORT_ALL_FLAG device id flag and clearing the NCQ_READ_LOG_FLAG is
always done before calling these functions. Move these operations inside
the functions.

Link: https://lore.kernel.org/r/20220220031810.738362-31-damien.lemoal@opensource.wdc.com
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Simplify pm8001_ccb_task_free()
Damien Le Moal [Sun, 20 Feb 2022 03:18:08 +0000 (12:18 +0900)]
scsi: pm8001: Simplify pm8001_ccb_task_free()

The task argument of the pm8001_ccb_task_free() function can be inferred
from the ccb argument ccb_task field. So there is no need to have this
argument. Likewise, the ccb_index argument is always equal to the ccb tag
field and is not needed either. Remove both arguments and update all call
sites. The pm8001_ccb_task_free_done() helper is also modified to match
this change.

Link: https://lore.kernel.org/r/20220220031810.738362-30-damien.lemoal@opensource.wdc.com
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Simplify pm8001_task_exec()
Damien Le Moal [Sun, 20 Feb 2022 03:18:07 +0000 (12:18 +0900)]
scsi: pm8001: Simplify pm8001_task_exec()

The main part of the pm8001_task_exec() function uses a do {} while(0) loop
that is useless and only makes the code harder to read. Remove this
loop. The unnecessary local variable t is also removed.

Additionally, avoid repeatedly declaring "struct task_status_struct *ts" to
handle error cases by declaring this variable for the entire function
scope. This allows simplifying the error cases, and together with the
addition of blank lines make the code more readable.

Finally, handling of the running_req counter is fixed to avoid decrementing
it without a corresponding incrementation in the case of an invalid task
protocol.

Link: https://lore.kernel.org/r/20220220031810.738362-29-damien.lemoal@opensource.wdc.com
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Simplify pm8001_mpi_build_cmd() interface
Damien Le Moal [Sun, 20 Feb 2022 03:18:06 +0000 (12:18 +0900)]
scsi: pm8001: Simplify pm8001_mpi_build_cmd() interface

There is no need to pass a pointer to a struct inbound_queue_table to
pm8001_mpi_build_cmd(). Passing the start index in the inbound queue table
of the adapter is enough. This change allows avoiding the declaration of a
struct inbound_queue_table pointer (circularQ variables) in many functions,
simplifying the code.

While at it, blank lines are added i(e.g. after local variable
declarations) to make the code more readable.

Link: https://lore.kernel.org/r/20220220031810.738362-28-damien.lemoal@opensource.wdc.com
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Introduce ccb alloc/free helpers
Damien Le Moal [Sun, 20 Feb 2022 03:18:05 +0000 (12:18 +0900)]
scsi: pm8001: Introduce ccb alloc/free helpers

Introduce the pm8001_ccb_alloc() and pm8001_ccb_free() helpers to replace
the typical code patterns:

res = pm8001_tag_alloc(pm8001_ha, &ccb_tag);
if (res)
...
ccb = &pm8001_ha->ccb_info[ccb_tag];
ccb->device = pm8001_ha_dev;
ccb->ccb_tag = ccb_tag;
ccb->task = task;
ccb->n_elem = 0;

and

ccb->task = NULL;
ccb->ccb_tag = PM8001_INVALID_TAG;
pm8001_tag_free(pm8001_ha, tag);

With the simpler function calls:

ccb = pm8001_ccb_alloc(pm8001_ha, pm8001_ha_dev, task);
if (!ccb)
...

and

pm8001_ccb_free(pm8001_ha, ccb);

The pm8001_ccb_alloc() helper ensures that all fields of the ccb info
structure for the newly allocated tag are all initialized, except the
buf_prd field. The pm8001_ccb_free() helper clears the initialized fields
and the ccb tag to ensure that iteration over the adapter ccb_info array
detects ccbs that are in use.

All call site of the pm8001_tag_alloc() function that use a ccb info
associated with an allocated tag are converted to use the new helpers.

Link: https://lore.kernel.org/r/20220220031810.738362-27-damien.lemoal@opensource.wdc.com
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Simplify pm8001_get_ncq_tag()
Damien Le Moal [Sun, 20 Feb 2022 03:18:04 +0000 (12:18 +0900)]
scsi: pm8001: Simplify pm8001_get_ncq_tag()

To detect if a command is NCQ, there is no need to test all possible NCQ
command codes. Instead, use ata_is_ncq() to test the command protocol.

Link: https://lore.kernel.org/r/20220220031810.738362-26-damien.lemoal@opensource.wdc.com
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Cleanup pm8001_exec_internal_task_abort()
Damien Le Moal [Sun, 20 Feb 2022 03:18:03 +0000 (12:18 +0900)]
scsi: pm8001: Cleanup pm8001_exec_internal_task_abort()

Replace the goto statement in the for loop with "break" and remove the
ex_err label. Also fix long lines, identation and blank lines to make the
code more readable.

Link: https://lore.kernel.org/r/20220220031810.738362-25-damien.lemoal@opensource.wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Simplify sas_ata_qc_issue() detection of NCQ commands
Damien Le Moal [Sun, 20 Feb 2022 03:18:02 +0000 (12:18 +0900)]
scsi: libsas: Simplify sas_ata_qc_issue() detection of NCQ commands

To detect if a command is NCQ, there is no need to test all possible NCQ
command codes. Instead, use ata_is_ncq() to test the command protocol.

Link: https://lore.kernel.org/r/20220220031810.738362-24-damien.lemoal@opensource.wdc.com
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix memory leak in pm8001_chip_fw_flash_update_req()
Damien Le Moal [Sun, 20 Feb 2022 03:18:01 +0000 (12:18 +0900)]
scsi: pm8001: Fix memory leak in pm8001_chip_fw_flash_update_req()

In pm8001_chip_fw_flash_update_build(), if
pm8001_chip_fw_flash_update_build() fails, the struct fw_control_ex
allocated must be freed.

Link: https://lore.kernel.org/r/20220220031810.738362-23-damien.lemoal@opensource.wdc.com
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix tag leaks on error
Damien Le Moal [Sun, 20 Feb 2022 03:18:00 +0000 (12:18 +0900)]
scsi: pm8001: Fix tag leaks on error

In pm8001_chip_set_dev_state_req(), pm8001_chip_fw_flash_update_req(),
pm80xx_chip_phy_ctl_req() and pm8001_chip_reg_dev_req() add missing calls
to pm8001_tag_free() to free the allocated tag when pm8001_mpi_build_cmd()
fails.

Similarly, in pm8001_exec_internal_task_abort(), if the chip ->task_abort
method fails, the tag allocated for the abort request task must be
freed. Add the missing call to pm8001_tag_free().

Link: https://lore.kernel.org/r/20220220031810.738362-22-damien.lemoal@opensource.wdc.com
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix task leak in pm8001_send_abort_all()
Damien Le Moal [Sun, 20 Feb 2022 03:17:59 +0000 (12:17 +0900)]
scsi: pm8001: Fix task leak in pm8001_send_abort_all()

In pm8001_send_abort_all(), make sure to free the allocated sas task
if pm8001_tag_alloc() or pm8001_mpi_build_cmd() fail.

Link: https://lore.kernel.org/r/20220220031810.738362-21-damien.lemoal@opensource.wdc.com
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix tag values handling
Damien Le Moal [Sun, 20 Feb 2022 03:17:58 +0000 (12:17 +0900)]
scsi: pm8001: Fix tag values handling

The function pm8001_tag_alloc() determines free tags using the function
find_first_zero_bit() which can return 0 when the first bit of the bitmap
being inspected is 0. As such, tag 0 is a valid tag value that should not
be dismissed as invalid. Fix the functions pm8001_work_fn(),
mpi_sata_completion(), pm8001_mpi_task_abort_resp() and
pm8001_open_reject_retry() to not dismiss 0 tags as invalid.

The value 0xffffffff is used for invalid tags for unused ccb information
structures. Add the macro definition PM8001_INVALID_TAG to define this
value.

Link: https://lore.kernel.org/r/20220220031810.738362-20-damien.lemoal@opensource.wdc.com
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix pm8001_mpi_task_abort_resp()
Damien Le Moal [Sun, 20 Feb 2022 03:17:57 +0000 (12:17 +0900)]
scsi: pm8001: Fix pm8001_mpi_task_abort_resp()

The call to pm8001_ccb_task_free() at the end of
pm8001_mpi_task_abort_resp() already frees the ccb tag. So when the device
NCQ_ABORT_ALL_FLAG is set, the tag should not be freed again.  Also change
the hardcoded 0xBFFFFFFF value to ~NCQ_ABORT_ALL_FLAG as it ought to be.

Link: https://lore.kernel.org/r/20220220031810.738362-19-damien.lemoal@opensource.wdc.com
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix pm8001_tag_alloc() failures handling
Damien Le Moal [Sun, 20 Feb 2022 03:17:56 +0000 (12:17 +0900)]
scsi: pm8001: Fix pm8001_tag_alloc() failures handling

In mpi_set_phy_profile_req() and in pm8001_set_phy_profile_single(), if
pm8001_tag_alloc() fails to allocate a new tag, a warning message is issued
but the uninitialized tag variable is still used to build a command. Avoid
this by returning early in case of tag allocation failure.

Also make sure to always return the error code returned by
pm8001_tag_alloc() when this function fails instead of an arbitrary value.

Link: https://lore.kernel.org/r/20220220031810.738362-18-damien.lemoal@opensource.wdc.com
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix abort all task initialization
Damien Le Moal [Sun, 20 Feb 2022 03:17:55 +0000 (12:17 +0900)]
scsi: pm8001: Fix abort all task initialization

In pm80xx_send_abort_all(), the n_elem field of the ccb used is not
initialized to 0. This missing initialization sometimes lead to the task
completion path seeing the ccb with a non-zero n_elem resulting in the
execution of invalid dma_unmap_sg() calls in pm8001_ccb_task_free(),
causing a crash such as:

[  197.676341] RIP: 0010:iommu_dma_unmap_sg+0x6d/0x280
[  197.700204] RSP: 0018:ffff889bbcf89c88 EFLAGS: 00010012
[  197.705485] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff83d0bda0
[  197.712687] RDX: 0000000000000002 RSI: 0000000000000000 RDI: ffff88810dffc0d0
[  197.719887] RBP: 0000000000000000 R08: 0000000000000000 R09: ffff8881c790098b
[  197.727089] R10: ffffed1038f20131 R11: 0000000000000001 R12: 0000000000000000
[  197.734296] R13: ffff88810dffc0d0 R14: 0000000000000010 R15: 0000000000000000
[  197.741493] FS:  0000000000000000(0000) GS:ffff889bbcf80000(0000) knlGS:0000000000000000
[  197.749659] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  197.755459] CR2: 00007f16c1b42734 CR3: 0000000004814000 CR4: 0000000000350ee0
[  197.762656] Call Trace:
[  197.765127]  <IRQ>
[  197.767162]  pm8001_ccb_task_free+0x5f1/0x820 [pm80xx]
[  197.772364]  ? do_raw_spin_unlock+0x54/0x220
[  197.776680]  pm8001_mpi_task_abort_resp+0x2ce/0x4f0 [pm80xx]
[  197.782406]  process_oq+0xe85/0x7890 [pm80xx]
[  197.786817]  ? lock_acquire+0x194/0x490
[  197.790697]  ? handle_irq_event+0x10e/0x1b0
[  197.794920]  ? mpi_sata_completion+0x2d70/0x2d70 [pm80xx]
[  197.800378]  ? __wake_up_bit+0x100/0x100
[  197.804340]  ? lock_is_held_type+0x98/0x110
[  197.808565]  pm80xx_chip_isr+0x94/0x130 [pm80xx]
[  197.813243]  tasklet_action_common.constprop.0+0x24b/0x2f0
[  197.818785]  __do_softirq+0x1b5/0x82d
[  197.822485]  ? do_raw_spin_unlock+0x54/0x220
[  197.826799]  __irq_exit_rcu+0x17e/0x1e0
[  197.830678]  irq_exit_rcu+0xa/0x20
[  197.834114]  common_interrupt+0x78/0x90
[  197.840051]  </IRQ>
[  197.844236]  <TASK>
[  197.848397]  asm_common_interrupt+0x1e/0x40

Avoid this issue by always initializing the ccb n_elem field to 0 in
pm8001_send_abort_all(), pm8001_send_read_log() and
pm80xx_send_abort_all().

Link: https://lore.kernel.org/r/20220220031810.738362-17-damien.lemoal@opensource.wdc.com
Fixes: c6b9ef5779c3 ("[SCSI] pm80xx: NCQ error handling changes")
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix NCQ NON DATA command completion handling
Damien Le Moal [Sun, 20 Feb 2022 03:17:54 +0000 (12:17 +0900)]
scsi: pm8001: Fix NCQ NON DATA command completion handling

NCQ NON DATA is an NCQ command with the DMA_NONE DMA direction and so a
register-device-to-host-FIS response is expected for it.

However, for an IO_SUCCESS case, mpi_sata_completion() expects a
set-device-bits-FIS for any ata task with an use_ncq field true, which
includes NCQ NON DATA commands.

Fix this to correctly treat NCQ NON DATA commands as non-data by also
testing for the DMA_NONE DMA direction.

Link: https://lore.kernel.org/r/20220220031810.738362-16-damien.lemoal@opensource.wdc.com
Fixes: dbf9bfe61571 ("[SCSI] pm8001: add SAS/SATA HBA driver")
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix NCQ NON DATA command task initialization
Damien Le Moal [Sun, 20 Feb 2022 03:17:53 +0000 (12:17 +0900)]
scsi: pm8001: Fix NCQ NON DATA command task initialization

In the pm8001_chip_sata_req() and pm80xx_chip_sata_req() functions, all
tasks with a DMA direction of DMA_NONE (no data transfer) are initialized
using the ATAP value 0x04. However, NCQ NON DATA commands, while being
DMA_NONE commands are NCQ commands and need to be initialized using the
value 0x07 for ATAP, similarly to other NCQ commands.

Make sure that NCQ NON DATA command tasks are initialized similarly to
other NCQ commands by also testing the task "use_ncq" field in addition to
the DMA direction. While at it, reorganize the code into a chain of if -
else if - else to avoid useless affectations and debug messages.

Link: https://lore.kernel.org/r/20220220031810.738362-15-damien.lemoal@opensource.wdc.com
Fixes: dbf9bfe61571 ("[SCSI] pm8001: add SAS/SATA HBA driver")
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Remove local variable in pm8001_pci_resume()
Damien Le Moal [Sun, 20 Feb 2022 03:17:52 +0000 (12:17 +0900)]
scsi: pm8001: Remove local variable in pm8001_pci_resume()

In pm8001_pci_resume(), the use of the u32 type for the local variable
device_state causes a sparse warning:

warning: incorrect type in assignment (different base types)
    expected unsigned int [usertype] device_state
    got restricted pci_power_t [usertype] current_state

Since this variable is used only once in the function, remove it and use
pdev->current_state directly. While at it, also add a blank line after the
last local variable declaration.

Link: https://lore.kernel.org/r/20220220031810.738362-14-damien.lemoal@opensource.wdc.com
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix use of struct set_phy_profile_req fields
Damien Le Moal [Sun, 20 Feb 2022 03:17:51 +0000 (12:17 +0900)]
scsi: pm8001: Fix use of struct set_phy_profile_req fields

In mpi_set_phy_profile_req() and pm8001_set_phy_profile_single(), use
cpu_to_le32() to initialize the ppc_phyid field of struct
set_phy_profile_req. Furthermore, fix the definition of the reserved field
of this structure to be an array of __le32, to match the use of
cpu_to_le32() when assigning values. These changes remove several sparse
type warnings.

Link: https://lore.kernel.org/r/20220220031810.738362-13-damien.lemoal@opensource.wdc.com
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix le32 values handling in pm80xx_chip_sata_req()
Damien Le Moal [Sun, 20 Feb 2022 03:17:50 +0000 (12:17 +0900)]
scsi: pm8001: Fix le32 values handling in pm80xx_chip_sata_req()

Make sure that the __le32 fields of struct sata_cmd are manipulated after
applying the correct endian conversion. That is, use cpu_to_le32() for
assigning values and le32_to_cpu() for consulting a field value.  In
particular, make sure that the calculations for the 4G boundary check are
done using CPU endianness and *not* little endian values. With these fixes,
many sparse warnings are removed.

While at it, fix some code identation and add blank lines after variable
declarations and in some other places to make this code more readable.

Link: https://lore.kernel.org/r/20220220031810.738362-12-damien.lemoal@opensource.wdc.com
Fixes: 0ecdf00ba6e5 ("[SCSI] pm80xx: 4G boundary fix.")
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix le32 values handling in pm80xx_chip_ssp_io_req()
Damien Le Moal [Sun, 20 Feb 2022 03:17:49 +0000 (12:17 +0900)]
scsi: pm8001: Fix le32 values handling in pm80xx_chip_ssp_io_req()

Make sure that the __le32 fields of struct ssp_ini_io_start_req are
manipulated after applying the correct endian conversion. That is, use
cpu_to_le32() for assigning values and le32_to_cpu() for consulting a field
value. In particular, make sure that the calculations for the 4G boundary
check are done using CPU endianness and *not* little endian values. With
these fixes, many sparse warnings are removed.

While at it, add blank lines after variable declarations and in some other
places to make this code more readable.

Link: https://lore.kernel.org/r/20220220031810.738362-11-damien.lemoal@opensource.wdc.com
Fixes: 0ecdf00ba6e5 ("[SCSI] pm80xx: 4G boundary fix.")
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix payload initialization in pm80xx_encrypt_update()
Damien Le Moal [Sun, 20 Feb 2022 03:17:48 +0000 (12:17 +0900)]
scsi: pm8001: Fix payload initialization in pm80xx_encrypt_update()

All fields of the kek_mgmt_req structure have the type __le32. So make sure
to use cpu_to_le32() to initialize them. This suppresses the sparse
warning:

warning: incorrect type in assignment (different base types)
   expected restricted __le32 [addressable] [assigned] [usertype] new_curidx_ksop
   got int

Link: https://lore.kernel.org/r/20220220031810.738362-10-damien.lemoal@opensource.wdc.com
Fixes: f5860992db55 ("[SCSI] pm80xx: Added SPCv/ve specific hardware functionalities and relevant changes in common files")
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix le32 values handling in pm80xx_set_sas_protocol_timer_config()
Damien Le Moal [Sun, 20 Feb 2022 03:17:47 +0000 (12:17 +0900)]
scsi: pm8001: Fix le32 values handling in pm80xx_set_sas_protocol_timer_config()

All fields of the SASProtocolTimerConfig structure have the __le32 type.
As such, use cpu_to_le32() to initialize them. This change suppresses many
sparse warnings:

warning: incorrect type in assignment (different base types)
   expected restricted __le32 [addressable] [usertype] pageCode
   got int

Note that the check to limit the value of the STP_IDLE_TMO field is removed
as this field is initialized using the fixed (and small) value defined by
the STP_IDLE_TIME macro.

The pm8001_dbg() calls printing the values of the SASProtocolTimerConfig
structure fileds are changed to use le32_to_cpu() to present the values in
human readable form.

Link: https://lore.kernel.org/r/20220220031810.738362-9-damien.lemoal@opensource.wdc.com
Fixes: a6cb3d012b98 ("[SCSI] pm80xx: thermal, sas controller config and error handling update")
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix payload initialization in pm80xx_set_thermal_config()
Damien Le Moal [Sun, 20 Feb 2022 03:17:46 +0000 (12:17 +0900)]
scsi: pm8001: Fix payload initialization in pm80xx_set_thermal_config()

The fields of the set_ctrl_cfg_req structure have the __le32 type, so use
cpu_to_le32() to assign them. This removes the sparse warnings:

warning: incorrect type in assignment (different base types)
    expected restricted __le32
    got unsigned int

Link: https://lore.kernel.org/r/20220220031810.738362-8-damien.lemoal@opensource.wdc.com
Fixes: 842784e0d15b ("pm80xx: Update For Thermal Page Code")
Fixes: f5860992db55 ("[SCSI] pm80xx: Added SPCv/ve specific hardware functionalities and relevant changes in common files")
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix command initialization in pm8001_chip_ssp_tm_req()
Damien Le Moal [Sun, 20 Feb 2022 03:17:45 +0000 (12:17 +0900)]
scsi: pm8001: Fix command initialization in pm8001_chip_ssp_tm_req()

The ds_ads_m field of struct ssp_ini_tm_start_req has the type __le32.
Assigning a value to it should thus use cpu_to_le32(). This fixes the
sparse warning:

warning: incorrect type in assignment (different base types)
   expected restricted __le32 [addressable] [assigned] [usertype] ds_ads_m
   got int

Link: https://lore.kernel.org/r/20220220031810.738362-7-damien.lemoal@opensource.wdc.com
Fixes: dbf9bfe61571 ("[SCSI] pm8001: add SAS/SATA HBA driver")
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix pm80xx_pci_mem_copy() interface
Damien Le Moal [Sun, 20 Feb 2022 03:17:44 +0000 (12:17 +0900)]
scsi: pm8001: Fix pm80xx_pci_mem_copy() interface

The declaration of the local variable destination1 in pm80xx_pci_mem_copy()
as a pointer to a u32 results in the sparse warning:

warning: incorrect type in assignment (different base types)
    expected unsigned int [usertype]
    got restricted __le32 [usertype]

Furthermore, the destination" argument of pm80xx_pci_mem_copy() is wrongly
declared with the const attribute.

Fix both problems by changing the type of the "destination" argument to
"__le32 *" and use this argument directly inside the pm80xx_pci_mem_copy()
function, thus removing the need for the destination1 local variable.

Link: https://lore.kernel.org/r/20220220031810.738362-6-damien.lemoal@opensource.wdc.com
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix command initialization in pm80XX_send_read_log()
Damien Le Moal [Sun, 20 Feb 2022 03:17:43 +0000 (12:17 +0900)]
scsi: pm8001: Fix command initialization in pm80XX_send_read_log()

Since the sata_cmd struct is zeroed out before its fields are initialized,
there is no need for using "|=" to initialize the ncqtag_atap_dir_m
field. Using a standard assignment removes the sparse warning:

warning: invalid assignment: |=

Also, since the ncqtag_atap_dir_m field has type __le32, use cpu_to_le32()
to generate the assigned value.

Link: https://lore.kernel.org/r/20220220031810.738362-5-damien.lemoal@opensource.wdc.com
Fixes: c6b9ef5779c3 ("[SCSI] pm80xx: NCQ error handling changes")
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix pm8001_update_flash() local variable type
Damien Le Moal [Sun, 20 Feb 2022 03:17:42 +0000 (12:17 +0900)]
scsi: pm8001: Fix pm8001_update_flash() local variable type

Change the type of partitionSizeTmp from u32 to __be32 to suppress the
sparse warning:

warning: cast to restricted __be32

Link: https://lore.kernel.org/r/20220220031810.738362-4-damien.lemoal@opensource.wdc.com
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Fix __iomem pointer use in pm8001_phy_control()
Damien Le Moal [Sun, 20 Feb 2022 03:17:41 +0000 (12:17 +0900)]
scsi: pm8001: Fix __iomem pointer use in pm8001_phy_control()

Avoid the sparse warning "warning: cast removes address space '__iomem' of
expression" by declaring the qp pointer as "u32 __iomem *".  Accordingly,
change the accesses to the qp array to use readl().

Link: https://lore.kernel.org/r/20220220031810.738362-3-damien.lemoal@opensource.wdc.com
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Fix sas_ata_qc_issue() handling of NCQ NON DATA commands
Damien Le Moal [Sun, 20 Feb 2022 03:17:40 +0000 (12:17 +0900)]
scsi: libsas: Fix sas_ata_qc_issue() handling of NCQ NON DATA commands

To detect for the DMA_NONE (no data transfer) DMA direction,
sas_ata_qc_issue() tests if the command protocol is ATA_PROT_NODATA.  This
test does not include the ATA_CMD_NCQ_NON_DATA command as this command
protocol is defined as ATA_PROT_NCQ_NODATA (equal to ATA_PROT_FLAG_NCQ) and
not as ATA_PROT_NODATA.

To include both NCQ and non-NCQ commands when testing for the DMA_NONE DMA
direction, use "!ata_is_data()".

Link: https://lore.kernel.org/r/20220220031810.738362-2-damien.lemoal@opensource.wdc.com
Fixes: 176ddd89171d ("scsi: libsas: Reset num_scatter if libata marks qc as NODATA")
Cc: stable@vger.kernel.org
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: hisi_sas: Remove unnecessary print function dev_err()
Yang Li [Tue, 15 Feb 2022 02:05:24 +0000 (10:05 +0800)]
scsi: hisi_sas: Remove unnecessary print function dev_err()

The print function dev_err() is redundant because platform_get_irq()
already prints an error.

Eliminate the follow coccicheck warnings:
./drivers/scsi/hisi_sas/hisi_sas_v1_hw.c:1661:3-10: line 1661 is
redundant because platform_get_irq() already prints an error
./drivers/scsi/hisi_sas/hisi_sas_v1_hw.c:1642:4-11: line 1642 is
redundant because platform_get_irq() already prints an error
./drivers/scsi/hisi_sas/hisi_sas_v1_hw.c:1679:3-10: line 1679 is
redundant because platform_get_irq() already prints an error

Link: https://lore.kernel.org/r/20220215020524.44268-1-yang.lee@linux.alibaba.com
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: block: Remove REQ_OP_WRITE_SAME support
Christoph Hellwig [Wed, 9 Feb 2022 08:28:28 +0000 (09:28 +0100)]
scsi: block: Remove REQ_OP_WRITE_SAME support

No more users of REQ_OP_WRITE_SAME or drivers implementing it are left,
so remove the infrastructure.

[mkp: fold in and tweak sysfs reporting fix]

Link: https://lore.kernel.org/r/20220209082828.2629273-8-hch@lst.de
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: dm: Remove WRITE_SAME support
Christoph Hellwig [Wed, 9 Feb 2022 08:28:27 +0000 (09:28 +0100)]
scsi: dm: Remove WRITE_SAME support

There are no more end-users of REQ_OP_WRITE_SAME left, so we can start
deleting it.

Link: https://lore.kernel.org/r/20220209082828.2629273-7-hch@lst.de
Reviewed-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: md: Remove WRITE_SAME support
Christoph Hellwig [Wed, 9 Feb 2022 08:28:26 +0000 (09:28 +0100)]
scsi: md: Remove WRITE_SAME support

There are no more end-users of REQ_OP_WRITE_SAME left, so we can start
deleting it.

Link: https://lore.kernel.org/r/20220209082828.2629273-6-hch@lst.de
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: sd: Remove WRITE_SAME support
Christoph Hellwig [Wed, 9 Feb 2022 08:28:25 +0000 (09:28 +0100)]
scsi: sd: Remove WRITE_SAME support

There are no more end-users of REQ_OP_WRITE_SAME left, so we can start
deleting it.

Link: https://lore.kernel.org/r/20220209082828.2629273-5-hch@lst.de
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: rnbd: Remove WRITE_SAME support
Christoph Hellwig [Wed, 9 Feb 2022 08:28:24 +0000 (09:28 +0100)]
scsi: rnbd: Remove WRITE_SAME support

REQ_OP_WRITE_SAME was only ever submitted by the legacy Linux zeroing code,
which has switched to use REQ_OP_WRITE_ZEROES long before rnbd was even
merged.

Link: https://lore.kernel.org/r/20220209082828.2629273-4-hch@lst.de
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: drbd: Remove WRITE_SAME support
Christoph Hellwig [Wed, 9 Feb 2022 08:28:23 +0000 (09:28 +0100)]
scsi: drbd: Remove WRITE_SAME support

REQ_OP_WRITE_SAME was only ever submitted by the legacy Linux zeroing code,
which has switched to use REQ_OP_WRITE_ZEROES long ago.

Link: https://lore.kernel.org/r/20220209082828.2629273-3-hch@lst.de
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: cxlflash: Query write_zeroes limit for zeroing
Christoph Hellwig [Wed, 9 Feb 2022 08:28:22 +0000 (09:28 +0100)]
scsi: cxlflash: Query write_zeroes limit for zeroing

The write_same and write_zeroes limits for SCSI are effectively the same,
so the current code works just fine.  But we plan to remove
REQ_OP_WRITE_SAME support, so switch to querying the write zeroes limit for
a zeroing WRITE SAME operation.

Link: https://lore.kernel.org/r/20220209082828.2629273-2-hch@lst.de
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mpi3mr: Fix flushing !WQ_MEM_RECLAIM events warning
Sreekanth Reddy [Fri, 18 Feb 2022 18:05:15 +0000 (23:35 +0530)]
scsi: mpi3mr: Fix flushing !WQ_MEM_RECLAIM events warning

Fix the following warning by not allocating driver's event handling worker
queue with WQ_MEM_RECLAIM flag enabled:

workqueue: WQ_MEM_RECLAIM
mpi3mr_fwevt_worker [mpi3mr] is flushing !WQ_MEM_RECLAIM events

Link: https://lore.kernel.org/r/20220218180515.27455-1-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: target: tcmu: Make cmd_ring_size changeable via configfs
Guixin Liu [Wed, 16 Feb 2022 02:21:49 +0000 (10:21 +0800)]
scsi: target: tcmu: Make cmd_ring_size changeable via configfs

Make cmd_ring_size changeable similar to the way it is done for
max_data_area_mb. The reason is that our tcmu client will create thousands
of tcmu instances, and this will consume lots of mem with default 8Mb cmd
ring size for every backstore.

One can change the value by typing:

    echo "cmd_ring_size_mb=N" > control

The "N" is a integer between 1 to 8, if set 1, the cmd ring can hold about
6k cmds(tcmu_cmd_entry about 176 byte) at least.

The value is printed when doing:

    cat info

In addition, a new readonly attribute 'cmd_ring_size_mb' returns the value
in read.

Link: https://lore.kernel.org/r/1644978109-14885-1-git-send-email-kanie@linux.alibaba.com
Reviewed-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Reviewed-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: qla2xxx: Use named initializers for q_dev_state
Gleb Chesnokov [Tue, 15 Feb 2022 17:13:59 +0000 (17:13 +0000)]
scsi: qla2xxx: Use named initializers for q_dev_state

Make q_dev_state a little more readable and maintainable by using named
initializers.

Also convert QLA8XXX_DEV_* macros into an enum and remove
qla83xx_dev_state_to_string(), which is a duplicate of qdev_state().

Link: https://lore.kernel.org/r/AS8PR10MB495298515A7553C8D6D6E74D9D349@AS8PR10MB4952.EURPRD10.PROD.OUTLOOK.COM
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Gleb Chesnokov <Chesnokov.G@raidix.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: qla2xxx: Use named initializers for port_[d]state_str
Gleb Chesnokov [Tue, 15 Feb 2022 17:13:53 +0000 (17:13 +0000)]
scsi: qla2xxx: Use named initializers for port_[d]state_str

Make port_state_str and port_dstate_str a little more readable and
maintainable by using named initializers.

Also convert FCS_* macros into an enum.

Link: https://lore.kernel.org/r/AS8PR10MB495215841EB25C16DBC0CB409D349@AS8PR10MB4952.EURPRD10.PROD.OUTLOOK.COM
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Gleb Chesnokov <Chesnokov.G@raidix.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: ufs: core: Remove wlun_dev_to_hba()
Keoseong Park [Tue, 15 Feb 2022 11:40:02 +0000 (20:40 +0900)]
scsi: ufs: core: Remove wlun_dev_to_hba()

Commit edc0596cc04b ("scsi: ufs: core: Stop clearing UNIT ATTENTIONS")
removed all callers of wlun_dev_to_hba(). Hence also remove the macro
itself.

Link: https://lore.kernel.org/r/1891546521.01644927481711.JavaMail.epsvc@epcpadp4
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Keoseong Park <keosung.park@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: core: Remove struct scsi_pointer from struct scsi_cmnd
Bart Van Assche [Fri, 18 Feb 2022 19:51:17 +0000 (11:51 -0800)]
scsi: core: Remove struct scsi_pointer from struct scsi_cmnd

Remove struct scsi_pointer from struct scsi_cmnd since the previous patches
removed all users of that member of struct scsi_cmnd. Additionally, reorder
the members of struct scsi_cmnd such that the statement that the field
below can be modified by the SCSI LLD is again correct.

Link: https://lore.kernel.org/r/20220218195117.25689-50-bvanassche@acm.org
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: zalon: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:16 +0000 (11:51 -0800)]
scsi: zalon: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-49-bvanassche@acm.org
Cc: Helge Deller <deller@gmx.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: wd33c93: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:51:15 +0000 (11:51 -0800)]
scsi: wd33c93: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-48-bvanassche@acm.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: wd719x: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:14 +0000 (11:51 -0800)]
scsi: wd719x: Stop using the SCSI pointer

Move the DMA handle into the per-command private data instead of using the
SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the
SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-47-bvanassche@acm.org
Cc: Ondrej Zary <linux@zary.sk>
Cc: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: usb: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:13 +0000 (11:51 -0800)]
scsi: usb: Stop using the SCSI pointer

Set scsi_host_template.cmd_size instead of using the SCSI pointer for
storing driver-private data. Change the type of the argument of
uas_add_work() from struct uas_cmd_info * into struct scsi_cmnd * because
it is easier to convert a SCSI command pointer into a uas_cmd_info pointer
than the other way around.

This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-46-bvanassche@acm.org
Cc: linux-usb@vger.kernel.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: sym53c8xx_2: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:51:12 +0000 (11:51 -0800)]
scsi: sym53c8xx_2: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-45-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: smartpqi: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:11 +0000 (11:51 -0800)]
scsi: smartpqi: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-44-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: qla2xxx: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:10 +0000 (11:51 -0800)]
scsi: qla2xxx: Stop using the SCSI pointer

Instead of using the SCp.ptr field to track whether or not a command is
in flight, use the sp->type field to track this information. sp->type
must be set for proper operation of the qla2xxx driver. See e.g. the
switch (sp->type) statement in qla2x00_ct_entry().

This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-43-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: qla1280: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:51:09 +0000 (11:51 -0800)]
scsi: qla1280: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-42-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: ppa: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:51:08 +0000 (11:51 -0800)]
scsi: ppa: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-41-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: sym53c500_cs: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:51:07 +0000 (11:51 -0800)]
scsi: sym53c500_cs: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd.
This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-40-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: nsp_cs: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:51:06 +0000 (11:51 -0800)]
scsi: nsp_cs: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
in struct scsi_cmnd.
This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-39-bvanassche@acm.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: nsp32: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:05 +0000 (11:51 -0800)]
scsi: nsp32: Stop using the SCSI pointer

Move the SCSI status field to private data. Stop setting the .ptr,
.this_residual, .buffer and .buffer_residual SCSI pointer members
since no code in this driver reads these members.

This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-38-bvanassche@acm.org
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Masanori Goto <gotom@debian.or.jp>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mvumi: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:04 +0000 (11:51 -0800)]
scsi: mvumi: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-37-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mvsas: Fix a set-but-not-used warning
Bart Van Assche [Fri, 18 Feb 2022 19:51:03 +0000 (11:51 -0800)]
scsi: mvsas: Fix a set-but-not-used warning

This patch fixes the following compiler warning:

drivers/scsi/mvsas/mv_init.c: In function â€˜mvs_pci_init’:
drivers/scsi/mvsas/mv_init.c:497:30: warning: variable â€˜mpi’ set but not used [-Wunused-but-set-variable]
  497 |         struct mvs_prv_info *mpi;
      |                              ^~~

Link: https://lore.kernel.org/r/20220218195117.25689-36-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mesh: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:51:02 +0000 (11:51 -0800)]
scsi: mesh: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-35-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: megasas: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:01 +0000 (11:51 -0800)]
scsi: megasas: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-34-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: megaraid: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:00 +0000 (11:51 -0800)]
scsi: megaraid: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-33-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mac53c94: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:50:59 +0000 (11:50 -0800)]
scsi: mac53c94: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-32-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mac53c94: Fix a set-but-not-used compiler warning
Bart Van Assche [Fri, 18 Feb 2022 19:50:58 +0000 (11:50 -0800)]
scsi: mac53c94: Fix a set-but-not-used compiler warning

Fix the following compiler warning:

   drivers/scsi/mac53c94.c: In function 'mac53c94_init':
   drivers/scsi/mac53c94.c:128:13: warning: variable 'x' set but not used [-Wunused-but-set-variable]
     128 |         int x;

Link: https://lore.kernel.org/r/20220218195117.25689-31-bvanassche@acm.org
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: qedf: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:57 +0000 (11:50 -0800)]
scsi: qedf: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. Remove the CMD_SCSI_STATUS() assignment because the
assigned value is not used.

This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-30-bvanassche@acm.org
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: bnx2fc: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:56 +0000 (11:50 -0800)]
scsi: bnx2fc: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. Remove the CMD_SCSI_STATUS() assignment because the
assigned value is not used.

This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-29-bvanassche@acm.org
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libfc: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:55 +0000 (11:50 -0800)]
scsi: libfc: Stop using the SCSI pointer

Move the fc_fcp_pkt pointer, the residual length and the SCSI status into
the new data structure libfc_cmd_priv. This patch prepares for removal of
the SCSI pointer from struct scsi_cmnd.

The user of the libfc data path functions have been identified as follows:
$ git grep -lw fc_queuecommand | grep -v scsi/libfc/
drivers/scsi/fcoe/fcoe.c

Link: https://lore.kernel.org/r/20220218195117.25689-28-bvanassche@acm.org
Cc: Saurav Kashyap <skashyap@marvell.com>
Cc: Javed Hasan <jhasan@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: initio: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:54 +0000 (11:50 -0800)]
scsi: initio: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-27-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: iscsi: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:53 +0000 (11:50 -0800)]
scsi: iscsi: Stop using the SCSI pointer

Instead of storing the iSCSI task pointer and the session age in the SCSI
pointer, use command-private variables. This patch prepares for removal of
the SCSI pointer from struct scsi_cmnd.

The list of iSCSI drivers has been obtained as follows:
$ git grep -lw iscsi_host_alloc
drivers/infiniband/ulp/iser/iscsi_iser.c
drivers/scsi/be2iscsi/be_main.c
drivers/scsi/bnx2i/bnx2i_iscsi.c
drivers/scsi/cxgbi/libcxgbi.c
drivers/scsi/iscsi_tcp.c
drivers/scsi/libiscsi.c
drivers/scsi/qedi/qedi_main.c
drivers/scsi/qla4xxx/ql4_os.c
include/scsi/libiscsi.h

Note: it is not clear to me how the qla4xxx driver can work without this
patch since it uses the scsi_cmnd::SCp.ptr member for two different
purposes:
- The qla4xxx driver uses this member to store a struct srb pointer.
- libiscsi uses this member to store a struct iscsi_task pointer.

Reviewed-by: Lee Duncan <lduncan@suse.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Chris Leech <cleech@redhat.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Manish Rangankar <mrangankar@marvell.com>
Cc: Karen Xie <kxie@chelsio.com>
Cc: Ketan Mukadam <ketan.mukadam@broadcom.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
iscsi

Link: https://lore.kernel.org/r/20220218195117.25689-26-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: imm: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:50:52 +0000 (11:50 -0800)]
scsi: imm: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer.
This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-25-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: hptiop: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:51 +0000 (11:50 -0800)]
scsi: hptiop: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Rename hpt_scsi_pointer into hpt_cmd_priv because that data structure is
not related to struct scsi_pointer.

Link: https://lore.kernel.org/r/20220218195117.25689-24-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: fnic: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:50 +0000 (11:50 -0800)]
scsi: fnic: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-23-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: fnic: Fix a tracing statement
Bart Van Assche [Fri, 18 Feb 2022 19:50:49 +0000 (11:50 -0800)]
scsi: fnic: Fix a tracing statement

Report both the command flags and command state instead of only the
command state.

Link: https://lore.kernel.org/r/20220218195117.25689-22-bvanassche@acm.org
Fixes: 4d7007b49d52 ("[SCSI] fnic: Fnic Trace Utility")
Cc: Hiral Patel <hiralpat@cisco.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: fdomain: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:50:48 +0000 (11:50 -0800)]
scsi: fdomain: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-21-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: esp_scsi: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:47 +0000 (11:50 -0800)]
scsi: esp_scsi: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-20-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: dc395x: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:46 +0000 (11:50 -0800)]
scsi: dc395x: Stop using the SCSI pointer

Remove the code that sets SCSI pointer members since there is no code in
this driver that reads these members.

Link: https://lore.kernel.org/r/20220218195117.25689-19-bvanassche@acm.org
Cc: Oliver Neukum <oneukum@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: csio: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:45 +0000 (11:50 -0800)]
scsi: csio: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-18-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: bfa: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:44 +0000 (11:50 -0800)]
scsi: bfa: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-17-bvanassche@acm.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: aha152x: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:50:43 +0000 (11:50 -0800)]
scsi: aha152x: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-16-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: aha1542: Remove a set-but-not-used array
Bart Van Assche [Fri, 18 Feb 2022 19:50:42 +0000 (11:50 -0800)]
scsi: aha1542: Remove a set-but-not-used array

This patch fixes the following W=1 warning:

drivers/scsi/aha1542.c:209:12: warning: variable â€˜inquiry_result’ set but not used [-Wunused-but-set-variable]
  209 |         u8 inquiry_result[4];

Link: https://lore.kernel.org/r/20220218195117.25689-15-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: advansys: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:50:41 +0000 (11:50 -0800)]
scsi: advansys: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-14-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: aacraid: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:50:40 +0000 (11:50 -0800)]
scsi: aacraid: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-13-bvanassche@acm.org
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: 53c700: Stop clearing SCSI pointer fields
Bart Van Assche [Fri, 18 Feb 2022 19:50:39 +0000 (11:50 -0800)]
scsi: 53c700: Stop clearing SCSI pointer fields

None of the 53c700 drivers uses the SCSI pointer. Hence remove the code
from 53c700.c that clears two SCSI pointer fields. The 53c700 drivers are:

$ git grep -l 'include.*53c700'
drivers/scsi/53c700.c
drivers/scsi/a4000t.c
drivers/scsi/bvme6000_scsi.c
drivers/scsi/lasi700.c
drivers/scsi/mvme16x_scsi.c
drivers/scsi/sim710.c
drivers/scsi/sni_53c710.c
drivers/scsi/zorro7xx.c

Link: https://lore.kernel.org/r/20220218195117.25689-12-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: arm: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:50:38 +0000 (11:50 -0800)]
scsi: arm: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd. The ARM SCSI drivers have been identified as follows:
$ git grep -l '#include.*arm_scsi.h'
drivers/scsi/arm/acornscsi.c
drivers/scsi/arm/cumana_2.c
drivers/scsi/arm/eesox.c
drivers/scsi/arm/fas216.c
drivers/scsi/arm/powertec.c

Link: https://lore.kernel.org/r/20220218195117.25689-11-bvanassche@acm.org
Cc: Russell King <linux@armlinux.org.uk>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: arm: Rename arm/scsi.h into arm/arm_scsi.h
Bart Van Assche [Fri, 18 Feb 2022 19:50:37 +0000 (11:50 -0800)]
scsi: arm: Rename arm/scsi.h into arm/arm_scsi.h

The new name makes the purpose of this header file more clear and also
makes it easier to find this header file with grep.

Link: https://lore.kernel.org/r/20220218195117.25689-10-bvanassche@acm.org
Cc: Russell King <linux@armlinux.org.uk>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: NCR5380: Add SCp members to struct NCR5380_cmd
Finn Thain [Fri, 18 Feb 2022 19:50:36 +0000 (11:50 -0800)]
scsi: NCR5380: Add SCp members to struct NCR5380_cmd

This is necessary for the eventual removal of SCp from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-9-bvanassche@acm.org
Cc: Michael Schmitz <schmitzmic@gmail.com>
Cc: Ondrej Zary <linux@zary.sk>
Suggested-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: NCR5380: Remove the NCR5380_CMD_SIZE macro
Bart Van Assche [Fri, 18 Feb 2022 19:50:35 +0000 (11:50 -0800)]
scsi: NCR5380: Remove the NCR5380_CMD_SIZE macro

This makes it easier to find users of the NCR5380_cmd data structure with
'grep'.

Link: https://lore.kernel.org/r/20220218195117.25689-8-bvanassche@acm.org
Cc: Finn Thain <fthain@telegraphics.com.au>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Ondrej Zary <linux@rainbow-software.org>
Cc: Michael Schmitz <schmitzmic@gmail.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Acked-by: Finn Thain <fthain@linux-m68k.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: Remove drivers/scsi/scsi.h
Bart Van Assche [Fri, 18 Feb 2022 19:50:34 +0000 (11:50 -0800)]
scsi: Remove drivers/scsi/scsi.h

The following two header files have the same file name: include/scsi/scsi.h
and drivers/scsi/scsi.h. This is confusing. Remove the latter since the
following note was added in drivers/scsi/scsi.h in 2004:

"NOTE: this file only contains compatibility glue for old drivers. All
these wrappers will be removed sooner or later. For new code please use
the interfaces declared in the headers in include/scsi/"

Link: https://lore.kernel.org/r/20220218195117.25689-7-bvanassche@acm.org
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: nsp_cs: Use true and false instead of TRUE and FALSE
Bart Van Assche [Fri, 18 Feb 2022 19:50:33 +0000 (11:50 -0800)]
scsi: nsp_cs: Use true and false instead of TRUE and FALSE

This patch prepares for removal of the drivers/scsi/scsi.h header file. That
header file defines the 'TRUE' and 'FALSE' constants.

Link: https://lore.kernel.org/r/20220218195117.25689-6-bvanassche@acm.org
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: nsp_cs: Change the return type of two functions into 'void'
Bart Van Assche [Fri, 18 Feb 2022 19:50:32 +0000 (11:50 -0800)]
scsi: nsp_cs: Change the return type of two functions into 'void'

nsp_reselected() and nsphw_init() always return TRUE. Change the return type
of these functions into 'void'.

Link: https://lore.kernel.org/r/20220218195117.25689-5-bvanassche@acm.org
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: ips: Use true and false instead of TRUE and FALSE
Bart Van Assche [Fri, 18 Feb 2022 19:50:31 +0000 (11:50 -0800)]
scsi: ips: Use true and false instead of TRUE and FALSE

This patch prepares for removal of the drivers/scsi/scsi.h header file.
That header file defines the 'TRUE' and 'FALSE' constants.

Link: https://lore.kernel.org/r/20220218195117.25689-4-bvanassche@acm.org
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: ips: Change the return type of ips_release() into 'void'
Bart Van Assche [Fri, 18 Feb 2022 19:50:30 +0000 (11:50 -0800)]
scsi: ips: Change the return type of ips_release() into 'void'

ips_release() has one caller and that caller ignores the value returned by
ips_release(). Hence change the return type of that function into 'void'.

Link: https://lore.kernel.org/r/20220218195117.25689-3-bvanassche@acm.org
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: ips: Remove an unreachable statement
Bart Van Assche [Fri, 18 Feb 2022 19:50:29 +0000 (11:50 -0800)]
scsi: ips: Remove an unreachable statement

Whether or not CONFIG_BUG is enabled, BUG() never returns. Hence, code past
a BUG() statement is unreachable. Remove one such unreachable statement.

Link: https://lore.kernel.org/r/20220218195117.25689-2-bvanassche@acm.org
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Add sas_execute_ata_cmd()
John Garry [Tue, 22 Feb 2022 12:50:59 +0000 (20:50 +0800)]
scsi: libsas: Add sas_execute_ata_cmd()

Add a function to execute an ATA command using the TMF code, and use in the
hisi_sas driver. That driver needs to be able to issue the command on a
specific phy, so add an interface for that.

With that, hisi_sas_exec_internal_tmf_task() may be deleted.

Link: https://lore.kernel.org/r/1645534259-27068-19-git-send-email-john.garry@huawei.com
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Add sas_abort_task()
John Garry [Thu, 17 Feb 2022 15:42:45 +0000 (23:42 +0800)]
scsi: libsas: Add sas_abort_task()

Add a generic implementation of abort task TMF handler, and use in LLDDs.

With that, some LLDDs custom TMF functions can now be deleted.

Link: https://lore.kernel.org/r/1645112566-115804-18-git-send-email-john.garry@huawei.com
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>