History log of /linux-master/drivers/scsi/mpi3mr/mpi3mr_transport.c
Revision Date Author Comments
# 5cc2da0b 23-Jan-2024 Arnd Bergmann <arnd@arndb.de>

scsi: mpi3mr: Reduce stack usage in mpi3mr_refresh_sas_ports()

Doubling the number of PHYs also doubled the stack usage of this function,
exceeding the 32-bit limit of 1024 bytes:

drivers/scsi/mpi3mr/mpi3mr_transport.c: In function 'mpi3mr_refresh_sas_ports':
drivers/scsi/mpi3mr/mpi3mr_transport.c:1818:1: error: the frame size of 1636 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

Since the sas_io_unit_pg0 structure is already allocated dynamically, use
the same method here. The size of the allocation can be smaller based on
the actual number of phys now, so use this as an upper bound.

Fixes: cb5b60894602 ("scsi: mpi3mr: Increase maximum number of PHYs to 64 from 32")
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240123130754.2011469-1-arnd@kernel.org
Tested-by: John Garry <john.g.garry@oracle.com> #build only
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# cb5b6089 23-Nov-2023 Sumit Saxena <sumit.saxena@broadcom.com>

scsi: mpi3mr: Increase maximum number of PHYs to 64 from 32

SAS5116 controllers supports maximum 48 physical PHYs. Modify driver to
accommodate up to 64 PHYs (though current need is to support 48 PHYs).

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Link: https://lore.kernel.org/r/20231123160132.4155-4-sumit.saxena@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 2a954832 19-Apr-2023 Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>

scsi: mpi3mr: Use -ENOMEM instead of -1 in mpi3mr_expander_add()

smatch warnings:

drivers/scsi/mpi3mr/mpi3mr_transport.c:1449 mpi3mr_expander_add() warn:
returning -1 instead of -ENOMEM is sloppy

No functional change.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/202303202027.ZeDQE5Ug-lkp@intel.com/
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Link: https://lore.kernel.org/r/20230419064256.2532069-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# e74f2fbd 16-Mar-2023 Ranjan Kumar <ranjan.kumar@broadcom.com>

scsi: mpi3mr: Update copyright year

Update copyright year from 2022 to 2023.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Link: https://lore.kernel.org/r/20230316110209.60145-8-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# ce756daa 02-Mar-2023 Tomas Henzl <thenzl@redhat.com>

scsi: mpi3mr: Fix expander node leak in mpi3mr_remove()

Add a missing resource clean up in .remove.

Fixes: e22bae30667a ("scsi: mpi3mr: Add expander devices to STL")
Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Link: https://lore.kernel.org/r/20230302234336.25456-7-thenzl@redhat.com
Acked-by: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 8e451839 28-Feb-2023 Ranjan Kumar <ranjan.kumar@broadcom.com>

scsi: mpi3mr: Bad drive in topology results kernel crash

When the SAS Transport Layer support is enabled and a device exposed to
the OS by the driver fails INQUIRY commands, the driver frees up the memory
allocated for an internal HBA port data structure. However, in some places,
the reference to the freed memory is not cleared. When the firmware sends
the Device Info change event for the same device again, the freed memory is
accessed and that leads to memory corruption and OS crash.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Link: https://lore.kernel.org/r/20230228140835.4075-7-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 5b06a716 28-Feb-2023 Ranjan Kumar <ranjan.kumar@broadcom.com>

scsi: mpi3mr: Driver unload crashes host when enhanced logging is enabled

Prevent driver from trying to dereference a NULL pointer in a debug print
while removing a device during driver unload.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Link: https://lore.kernel.org/r/20230228140835.4075-3-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# ae7d45f5 13-Feb-2023 Tomas Henzl <thenzl@redhat.com>

scsi: mpi3mr: Fix an issue found by KASAN

Write only correct size (32 instead of 64 bytes).

Link: https://lore.kernel.org/r/20230213193752.6859-1-thenzl@redhat.com
Fixes: 42fc9fee116f ("scsi: mpi3mr: Add helper functions to manage device's port")
Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 5ba207e5 15-Sep-2022 Dan Carpenter <dan.carpenter@oracle.com>

scsi: mpi3mr: Fix error code in mpi3mr_transport_smp_handler()

The error code from mpi3mr_post_transport_req() is supposed to be passed to
bsg_job_done(job, rc, reslen), but it isn't.

Link: https://lore.kernel.org/r/YyMISJzVDARpVwrr@kili
Fixes: 176d4aa69c6e ("scsi: mpi3mr: Support SAS transport class callbacks")
Acked-by: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# a113c02f 15-Sep-2022 Dan Carpenter <dan.carpenter@oracle.com>

scsi: mpi3mr: Fix error codes in mpi3mr_report_manufacture()

There are three error paths which return success:

1) Propagate the error code from mpi3mr_post_transport_req() if it fails.

2) Return -EINVAL if "ioc_status != MPI3_IOCSTATUS_SUCCESS".

3) Return -EINVAL if "le16_to_cpu(mpi_reply.response_data_length) !=
sizeof(struct rep_manu_reply)"

Link: https://lore.kernel.org/r/YyMIJh1HU2Qz9+Rs@kili
Fixes: 2bd37e284914 ("scsi: mpi3mr: Add framework to issue MPT transport cmds")
Acked-by: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 2745ce0e 04-Aug-2022 Sreekanth Reddy <sreekanth.reddy@broadcom.com>

scsi: mpi3mr: Refresh SAS ports during soft reset

Update the host's SAS ports if there is change in port id or phys. If the
port id is changed, then the driver updates it. If some phys are
enabled/disabled during reset, then driver updates them in STL.

Check for the responding expander devices and update the device handle if
it got changed. Register the expander with STL if it got added during reset
and unregister the expander device if it got removed during reset.

[mkp: include fix for zeroday warning]

Link: https://lore.kernel.org/r/20220804131226.16653-15-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 176d4aa6 04-Aug-2022 Sreekanth Reddy <sreekanth.reddy@broadcom.com>

scsi: mpi3mr: Support SAS transport class callbacks

Add support for the following SAS transport class callbacks:

- get_linkerrors
- get_enclosure_identifier
- get_bay_identifier
- phy_reset
- phy_enable
- set_phy_speed
- smp_handler

Link: https://lore.kernel.org/r/20220804131226.16653-14-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 2bd37e28 04-Aug-2022 Sreekanth Reddy <sreekanth.reddy@broadcom.com>

scsi: mpi3mr: Add framework to issue MPT transport cmds

Add framework to issue MPT transport commands to controllers. Also issue
the MPT transport commands to get the manufacturing info of SAS expander
device.

Link: https://lore.kernel.org/r/20220804131226.16653-13-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 7f56c791 04-Aug-2022 Sreekanth Reddy <sreekanth.reddy@broadcom.com>

scsi: mpi3mr: Add SAS SATA end devices to STL

Register/unregister the SAS, SATA devices to SCSI Transport Layer(STL)
whenever the corresponding device is added/removed from topology.

Link: https://lore.kernel.org/r/20220804131226.16653-12-sreekanth.reddy@broadcom.com
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 626665e9 04-Aug-2022 Sreekanth Reddy <sreekanth.reddy@broadcom.com>

scsi: mpi3mr: Get target object based on rphy

When device is registered with the STL then get the corresponding device's
target object using the rphy in below callback functions:

- mpi3mr_target_alloc()

- mpi3mr_slave_alloc()

- mpi3mr_slave_configure()

- mpi3mr_slave_destroy()

Link: https://lore.kernel.org/r/20220804131226.16653-11-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# e22bae30 04-Aug-2022 Sreekanth Reddy <sreekanth.reddy@broadcom.com>

scsi: mpi3mr: Add expander devices to STL

Register/unregister the expander devices to SCSI Transport Layer(STL)
whenever the corresponding expander is added/removed from topology.

Link: https://lore.kernel.org/r/20220804131226.16653-10-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 42fc9fee 04-Aug-2022 Sreekanth Reddy <sreekanth.reddy@broadcom.com>

scsi: mpi3mr: Add helper functions to manage device's port

Add the following helper functions:

- Update the host phys with STL

- Remove the device's SAS port with STL

Link: https://lore.kernel.org/r/20220804131226.16653-8-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 125ad1e6 04-Aug-2022 Sreekanth Reddy <sreekanth.reddy@broadcom.com>

scsi: mpi3mr: Add helper functions to retrieve device objects

Add the following helper functions:

- Get the device's sas address by reading corresponding device's Device
page0

- Get the expander object from expander list based on expander's handle

- Get the target device object from target device list based on device's
sas address

- Get the expander device object from expander list based on expanders's
sas address

- Get hba port object from hba port table list based on port's port id

Link: https://lore.kernel.org/r/20220804131226.16653-7-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# fc7212fd 04-Aug-2022 Sreekanth Reddy <sreekanth.reddy@broadcom.com>

scsi: mpi3mr: Add framework to add phys to STL

Add framework to register and unregister the host and expander phys with
SCSI Transport Layer (STL).

Link: https://lore.kernel.org/r/20220804131226.16653-6-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>