All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] smartpqi updates
@ 2022-11-08 19:21 Don Brace
  2022-11-08 19:21 ` [PATCH 1/8] smartpqi: convert to host_tagset Don Brace
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Don Brace @ 2022-11-08 19:21 UTC (permalink / raw)
  To: Kevin.Barnett, scott.teel, Justin.Lindley, scott.benesh,
	gerry.morong, mahesh.rajashekhara, mike.mcgowen, murthy.bhat,
	kumar.meiyappan, jeremy.reeves, hch, jejb, joseph.szczypek,
	POSWALD
  Cc: linux-scsi

These patches are based on Martin Petersen's 6.2/scsi-queue tree
  https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
  6.2/scsi-queue

This set of changes consists of:
 * Add support for host_tagset.
   Originally proposed by Hannes Reinecke here:
   Link: https://lore.kernel.org/linux-block/20191126131009.71726-8-hare@suse
   At the time, we wanted to fully test multipath failover before
   accepting his patch. There have been a few changes in our queuing layer
   since his patch, so I'm applying it with the required updates.
   We moved the reserved command section to the end of the command pool,
   eliminating some math in the submission threads.
 * Add PCI-IDs for new storage devices.
 * Corrects maximum LUN number for multi-actuator devices. This update
   is more cosmetic. No bugs have been filed.
 * Change the sysfs "raid_level" entry to "N/A" for controller devices.
 * Correct a rare kernel Oops when removing the smartpqi driver managing
   multi-actuator devices.
 * Add in a controller cache flush during driver removal. 
 * Initialize our feature_section structures to 0. More of an alignment
   with our in-house driver.
 * Bump the driver version to 2.1.20-035

---

Don Brace (3):
      smartpqi: convert to host_tagset
      smartpqi: initialize feature section info
      smartpqi: change version to 2.1.20-035

Gilbert Wu (1):
      smartpqi: add controller cache flush during rmmod

Kevin Barnett (2):
      smartpqi: correct max lun number
      smartpqi: change sysfs raid_level attribute to N/A for controllers

Kumar Meiyappan (1):
      smartpqi: correct device removal for multiactuator devices

Mike McGowen (1):
      smartpqi: Add new controller PCI IDs


 drivers/scsi/smartpqi/smartpqi.h      |   5 +-
 drivers/scsi/smartpqi/smartpqi_init.c | 164 +++++++++++++++++++-------
 2 files changed, 125 insertions(+), 44 deletions(-)

--
Signature

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/8] smartpqi: convert to host_tagset
  2022-11-08 19:21 [PATCH 0/8] smartpqi updates Don Brace
@ 2022-11-08 19:21 ` Don Brace
  2022-11-08 19:21 ` [PATCH 2/8] smartpqi: Add new controller PCI IDs Don Brace
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Don Brace @ 2022-11-08 19:21 UTC (permalink / raw)
  To: Kevin.Barnett, scott.teel, Justin.Lindley, scott.benesh,
	gerry.morong, mahesh.rajashekhara, mike.mcgowen, murthy.bhat,
	kumar.meiyappan, jeremy.reeves, hch, jejb, joseph.szczypek,
	POSWALD
  Cc: linux-scsi

Add support for host_tagset.

Also move the reserved command slots to the end of the pool to
eliminate an addition operation for every SCSI request.

This patch was originally authored by Hannes Reinecke here:
Link: https://lore.kernel.org/linux-block/20191126131009.71726-8-hare@suse.de/

But we NAKed this patch because we wanted to fully test multipath
failover operations.

Suggested-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@microchip.com>
Reviewed-by: Mike McGowen <Mike.McGowen@microchip.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
 drivers/scsi/smartpqi/smartpqi.h      |    3 -
 drivers/scsi/smartpqi/smartpqi_init.c |   68 +++++++++++++++++++++------------
 2 files changed, 43 insertions(+), 28 deletions(-)

diff --git a/drivers/scsi/smartpqi/smartpqi.h b/drivers/scsi/smartpqi/smartpqi.h
index e550b12e525a..8cdf4d2476dd 100644
--- a/drivers/scsi/smartpqi/smartpqi.h
+++ b/drivers/scsi/smartpqi/smartpqi.h
@@ -1307,7 +1307,6 @@ struct pqi_ctrl_info {
 	dma_addr_t	error_buffer_dma_handle;
 	size_t		sg_chain_buffer_length;
 	unsigned int	num_queue_groups;
-	u16		max_hw_queue_index;
 	u16		num_elements_per_iq;
 	u16		num_elements_per_oq;
 	u16		max_inbound_iu_length_per_firmware;
@@ -1369,8 +1368,6 @@ struct pqi_ctrl_info {
 	u64		sas_address;
 
 	struct pqi_io_request *io_request_pool;
-	u16		next_io_request_slot;
-
 	struct pqi_event events[PQI_NUM_SUPPORTED_EVENTS];
 	struct work_struct event_work;
 
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index b971fbe3b3a1..651dca535b3b 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -678,23 +678,36 @@ static inline void pqi_reinit_io_request(struct pqi_io_request *io_request)
 	io_request->raid_bypass = false;
 }
 
-static struct pqi_io_request *pqi_alloc_io_request(
-	struct pqi_ctrl_info *ctrl_info)
+static inline struct pqi_io_request *pqi_alloc_io_request(struct pqi_ctrl_info *ctrl_info, struct scsi_cmnd *scmd)
 {
 	struct pqi_io_request *io_request;
-	u16 i = ctrl_info->next_io_request_slot;	/* benignly racy */
+	u16 i;
 
-	while (1) {
+	if (scmd) { /* SML I/O request */
+		u32 blk_tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd));
+
+		i = blk_mq_unique_tag_to_tag(blk_tag);
 		io_request = &ctrl_info->io_request_pool[i];
-		if (atomic_inc_return(&io_request->refcount) == 1)
-			break;
-		atomic_dec(&io_request->refcount);
-		i = (i + 1) % ctrl_info->max_io_slots;
+		if (atomic_inc_return(&io_request->refcount) > 1) {
+			atomic_dec(&io_request->refcount);
+			return NULL;
+		}
+	} else { /* IOCTL or driver internal request */
+		/*
+		 * benignly racy - may have to wait for an open slot.
+		 * command slot range is scsi_ml_can_queue -
+		 *         [scsi_ml_can_queue + (PQI_RESERVED_IO_SLOTS - 1)]
+		 */
+		i = 0;
+		while (1) {
+			io_request = &ctrl_info->io_request_pool[ctrl_info->scsi_ml_can_queue + i];
+			if (atomic_inc_return(&io_request->refcount) == 1)
+				break;
+			atomic_dec(&io_request->refcount);
+			i = (i + 1) % PQI_RESERVED_IO_SLOTS;
+		}
 	}
 
-	/* benignly racy */
-	ctrl_info->next_io_request_slot = (i + 1) % ctrl_info->max_io_slots;
-
 	pqi_reinit_io_request(io_request);
 
 	return io_request;
@@ -4586,7 +4599,7 @@ static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info,
 		goto out;
 	}
 
-	io_request = pqi_alloc_io_request(ctrl_info);
+	io_request = pqi_alloc_io_request(ctrl_info, NULL);
 
 	put_unaligned_le16(io_request->index,
 		&(((struct pqi_raid_path_request *)request)->request_id));
@@ -5233,7 +5246,6 @@ static void pqi_calculate_queue_resources(struct pqi_ctrl_info *ctrl_info)
 	}
 
 	ctrl_info->num_queue_groups = num_queue_groups;
-	ctrl_info->max_hw_queue_index = num_queue_groups - 1;
 
 	/*
 	 * Make sure that the max. inbound IU length is an even multiple
@@ -5567,7 +5579,9 @@ static inline int pqi_raid_submit_scsi_cmd(struct pqi_ctrl_info *ctrl_info,
 {
 	struct pqi_io_request *io_request;
 
-	io_request = pqi_alloc_io_request(ctrl_info);
+	io_request = pqi_alloc_io_request(ctrl_info, scmd);
+	if (!io_request)
+		return SCSI_MLQUEUE_HOST_BUSY;
 
 	return pqi_raid_submit_scsi_cmd_with_io_request(ctrl_info, io_request,
 		device, scmd, queue_group);
@@ -5671,7 +5685,9 @@ static int pqi_aio_submit_io(struct pqi_ctrl_info *ctrl_info,
 	struct pqi_scsi_dev *device;
 
 	device = scmd->device->hostdata;
-	io_request = pqi_alloc_io_request(ctrl_info);
+	io_request = pqi_alloc_io_request(ctrl_info, scmd);
+	if (!io_request)
+		return SCSI_MLQUEUE_HOST_BUSY;
 	io_request->io_complete_callback = pqi_aio_io_complete;
 	io_request->scmd = scmd;
 	io_request->raid_bypass = raid_bypass;
@@ -5743,7 +5759,10 @@ static  int pqi_aio_submit_r1_write_io(struct pqi_ctrl_info *ctrl_info,
 	struct pqi_io_request *io_request;
 	struct pqi_aio_r1_path_request *r1_request;
 
-	io_request = pqi_alloc_io_request(ctrl_info);
+	io_request = pqi_alloc_io_request(ctrl_info, scmd);
+	if (!io_request)
+		return SCSI_MLQUEUE_HOST_BUSY;
+
 	io_request->io_complete_callback = pqi_aio_io_complete;
 	io_request->scmd = scmd;
 	io_request->raid_bypass = true;
@@ -5801,7 +5820,9 @@ static int pqi_aio_submit_r56_write_io(struct pqi_ctrl_info *ctrl_info,
 	struct pqi_io_request *io_request;
 	struct pqi_aio_r56_path_request *r56_request;
 
-	io_request = pqi_alloc_io_request(ctrl_info);
+	io_request = pqi_alloc_io_request(ctrl_info, scmd);
+	if (!io_request)
+		return SCSI_MLQUEUE_HOST_BUSY;
 	io_request->io_complete_callback = pqi_aio_io_complete;
 	io_request->scmd = scmd;
 	io_request->raid_bypass = true;
@@ -5860,13 +5881,10 @@ static int pqi_aio_submit_r56_write_io(struct pqi_ctrl_info *ctrl_info,
 static inline u16 pqi_get_hw_queue(struct pqi_ctrl_info *ctrl_info,
 	struct scsi_cmnd *scmd)
 {
-	u16 hw_queue;
-
-	hw_queue = blk_mq_unique_tag_to_hwq(blk_mq_unique_tag(scsi_cmd_to_rq(scmd)));
-	if (hw_queue > ctrl_info->max_hw_queue_index)
-		hw_queue = 0;
-
-	return hw_queue;
+	/*
+	 * We are setting host_tagset = 1 during init.
+	 */
+	return blk_mq_unique_tag_to_hwq(blk_mq_unique_tag(scsi_cmd_to_rq(scmd)));
 }
 
 static inline bool pqi_is_bypass_eligible_request(struct scsi_cmnd *scmd)
@@ -6268,7 +6286,7 @@ static int pqi_lun_reset(struct pqi_ctrl_info *ctrl_info, struct scsi_cmnd *scmd
 	struct pqi_scsi_dev *device;
 
 	device = scmd->device->hostdata;
-	io_request = pqi_alloc_io_request(ctrl_info);
+	io_request = pqi_alloc_io_request(ctrl_info, NULL);
 	io_request->io_complete_callback = pqi_lun_reset_complete;
 	io_request->context = &wait;
 


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/8] smartpqi: Add new controller PCI IDs
  2022-11-08 19:21 [PATCH 0/8] smartpqi updates Don Brace
  2022-11-08 19:21 ` [PATCH 1/8] smartpqi: convert to host_tagset Don Brace
@ 2022-11-08 19:21 ` Don Brace
  2022-11-08 19:21 ` [PATCH 3/8] smartpqi: correct max lun number Don Brace
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Don Brace @ 2022-11-08 19:21 UTC (permalink / raw)
  To: Kevin.Barnett, scott.teel, Justin.Lindley, scott.benesh,
	gerry.morong, mahesh.rajashekhara, mike.mcgowen, murthy.bhat,
	kumar.meiyappan, jeremy.reeves, hch, jejb, joseph.szczypek,
	POSWALD
  Cc: linux-scsi

From: Mike McGowen <mike.mcgowen@microchip.com>

All PCI ID entries in Hex.
Add PCI IDs for ByteDance controllers:
                                            VID  / DID  / SVID / SDID
                                            ----   ----   ----   ----
    ByteHBA JGH43024-8                      9005 / 028f / 1e93 / 1000
    ByteHBA JGH43034-8                      9005 / 028f / 1e93 / 1001
    ByteHBA JGH44014-8                      9005 / 028f / 1e93 / 1002

Add PCI IDs for new Inspur controllers:
                                            VID  / DID  / SVID / SDID
                                            ----   ----   ----   ----
    INSPUR RT0800M7E                        9005 / 028f / 1bd4 / 0086
    INSPUR RT0800M7H                        9005 / 028f / 1bd4 / 0087
    INSPUR RT0804M7R                        9005 / 028f / 1bd4 / 0088
    INSPUR RT0808M7R                        9005 / 028f / 1bd4 / 0089

Add PCI IDs for new FAB A controllers:
                                            VID  / DID  / SVID / SDID
                                            ----   ----   ----   ----
    Adaptec SmartRAID 3254-16e /e           9005 / 028f / 9005 / 1475
    Adaptec HBA 1200-16e                    9005 / 028f / 9005 / 14c3
    Adaptec HBA 1200-8e                     9005 / 028f / 9005 / 14c4

Add H3C controller PCI IDs:
                                            VID  / DID  / SVID / SDID
                                            ----   ----   ----   ----
    H3C H4508-Mf-8i                         9005 / 028f / 193d / 110b

Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Signed-off-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
 drivers/scsi/smartpqi/smartpqi_init.c |   44 +++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 651dca535b3b..6cda12078130 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -9320,6 +9320,10 @@ static const struct pci_device_id pqi_pci_id_table[] = {
 		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
 			       0x193d, 0x1109)
 	},
+	{
+		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+			       0x193d, 0x110b)
+	},
 	{
 		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
 			       0x193d, 0x8460)
@@ -9420,6 +9424,22 @@ static const struct pci_device_id pqi_pci_id_table[] = {
 		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
 			       0x1bd4, 0x0072)
 	},
+	{
+		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+			       0x1bd4, 0x0086)
+	},
+	{
+		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+			       0x1bd4, 0x0087)
+	},
+	{
+		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+			       0x1bd4, 0x0088)
+	},
+	{
+		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+			       0x1bd4, 0x0089)
+	},
 	{
 		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
 			       0x19e5, 0xd227)
@@ -9668,6 +9688,10 @@ static const struct pci_device_id pqi_pci_id_table[] = {
 		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
 			       PCI_VENDOR_ID_ADAPTEC2, 0x1474)
 	},
+	{
+		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+			       PCI_VENDOR_ID_ADAPTEC2, 0x1475)
+	},
 	{
 		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
 			       PCI_VENDOR_ID_ADAPTEC2, 0x1480)
@@ -9724,6 +9748,14 @@ static const struct pci_device_id pqi_pci_id_table[] = {
 		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
 			       PCI_VENDOR_ID_ADAPTEC2, 0x14c2)
 	},
+	{
+		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+			       PCI_VENDOR_ID_ADAPTEC2, 0x14c3)
+	},
+	{
+		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+			       PCI_VENDOR_ID_ADAPTEC2, 0x14c4)
+	},
 	{
 		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
 			       PCI_VENDOR_ID_ADAPTEC2, 0x14d0)
@@ -9960,6 +9992,18 @@ static const struct pci_device_id pqi_pci_id_table[] = {
 		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
 			       PCI_VENDOR_ID_LENOVO, 0x0623)
 	},
+	{
+		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+				0x1e93, 0x1000)
+	},
+	{
+		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+				0x1e93, 0x1001)
+	},
+	{
+		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+				0x1e93, 0x1002)
+	},
 	{
 		PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
 			       PCI_ANY_ID, PCI_ANY_ID)


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/8] smartpqi: correct max lun number
  2022-11-08 19:21 [PATCH 0/8] smartpqi updates Don Brace
  2022-11-08 19:21 ` [PATCH 1/8] smartpqi: convert to host_tagset Don Brace
  2022-11-08 19:21 ` [PATCH 2/8] smartpqi: Add new controller PCI IDs Don Brace
@ 2022-11-08 19:21 ` Don Brace
  2022-11-08 19:21 ` [PATCH 4/8] smartpqi: change sysfs raid_level attribute to N/A for controllers Don Brace
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Don Brace @ 2022-11-08 19:21 UTC (permalink / raw)
  To: Kevin.Barnett, scott.teel, Justin.Lindley, scott.benesh,
	gerry.morong, mahesh.rajashekhara, mike.mcgowen, murthy.bhat,
	kumar.meiyappan, jeremy.reeves, hch, jejb, joseph.szczypek,
	POSWALD
  Cc: linux-scsi

From: Kevin Barnett <kevin.barnett@microchip.com>

Correct maximum LUN number for multi-actuator devices.

When multi-actuator support was added to smartpqi, the maximum
number of LUNs supported for multi-actuator devies was supposed
to be changed from unlimited to 256, but the setting was
inadvertently left at unlimited.

Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
 drivers/scsi/smartpqi/smartpqi_init.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 6cda12078130..33059355f9cd 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -7423,7 +7423,6 @@ static int pqi_register_scsi(struct pqi_ctrl_info *ctrl_info)
 	shost->max_channel = PQI_MAX_BUS;
 	shost->max_cmd_len = MAX_COMMAND_SIZE;
 	shost->max_lun = PQI_MAX_LUNS_PER_DEVICE;
-	shost->max_lun = ~0;
 	shost->max_id = ~0;
 	shost->max_sectors = ctrl_info->max_sectors;
 	shost->can_queue = ctrl_info->scsi_ml_can_queue;


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/8] smartpqi: change sysfs raid_level attribute to N/A for controllers
  2022-11-08 19:21 [PATCH 0/8] smartpqi updates Don Brace
                   ` (2 preceding siblings ...)
  2022-11-08 19:21 ` [PATCH 3/8] smartpqi: correct max lun number Don Brace
@ 2022-11-08 19:21 ` Don Brace
  2022-11-08 19:21 ` [PATCH 5/8] smartpqi: correct device removal for multiactuator devices Don Brace
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Don Brace @ 2022-11-08 19:21 UTC (permalink / raw)
  To: Kevin.Barnett, scott.teel, Justin.Lindley, scott.benesh,
	gerry.morong, mahesh.rajashekhara, mike.mcgowen, murthy.bhat,
	kumar.meiyappan, jeremy.reeves, hch, jejb, joseph.szczypek,
	POSWALD
  Cc: linux-scsi

From: Kevin Barnett <kevin.barnett@microchip.com>

Change the sysfs raid_level attribute from "RAID-0" to N/A.

Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Mike McGowan <mike.mcgowan@microchip.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
 drivers/scsi/smartpqi/smartpqi_init.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 33059355f9cd..20fc6c8044ac 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -7255,7 +7255,7 @@ static ssize_t pqi_raid_level_show(struct device *dev,
 		return -ENODEV;
 	}
 
-	if (pqi_is_logical_device(device))
+	if (pqi_is_logical_device(device) && device->devtype == TYPE_DISK)
 		raid_level = pqi_raid_level_to_string(device->raid_level);
 	else
 		raid_level = "N/A";


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/8] smartpqi: correct device removal for multiactuator devices
  2022-11-08 19:21 [PATCH 0/8] smartpqi updates Don Brace
                   ` (3 preceding siblings ...)
  2022-11-08 19:21 ` [PATCH 4/8] smartpqi: change sysfs raid_level attribute to N/A for controllers Don Brace
@ 2022-11-08 19:21 ` Don Brace
  2022-11-08 19:22 ` [PATCH 6/8] smartpqi: add controller cache flush during rmmod Don Brace
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Don Brace @ 2022-11-08 19:21 UTC (permalink / raw)
  To: Kevin.Barnett, scott.teel, Justin.Lindley, scott.benesh,
	gerry.morong, mahesh.rajashekhara, mike.mcgowen, murthy.bhat,
	kumar.meiyappan, jeremy.reeves, hch, jejb, joseph.szczypek,
	POSWALD
  Cc: linux-scsi

From: Kumar Meiyappan <Kumar.Meiyappan@microchip.com>

Correct device count for multi-actuator drives which can cause
kernel panics.

Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Mike Mcgowan <mike.mcgowan@microchip.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Kumar Meiyappan <Kumar.Meiyappan@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
 drivers/scsi/smartpqi/smartpqi.h      |    2 +-
 drivers/scsi/smartpqi/smartpqi_init.c |   33 ++++++++++++++++++++++++---------
 2 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/smartpqi/smartpqi.h b/drivers/scsi/smartpqi/smartpqi.h
index 8cdf4d2476dd..af27bb0f3133 100644
--- a/drivers/scsi/smartpqi/smartpqi.h
+++ b/drivers/scsi/smartpqi/smartpqi.h
@@ -1130,7 +1130,7 @@ struct pqi_scsi_dev {
 	u8	phy_id;
 	u8	ncq_prio_enable;
 	u8	ncq_prio_support;
-	u8	multi_lun_device_lun_count;
+	u8	lun_count;
 	bool	raid_bypass_configured;	/* RAID bypass configured */
 	bool	raid_bypass_enabled;	/* RAID bypass enabled */
 	u32	next_bypass_group[RAID_MAP_MAX_DATA_DISKS_PER_ROW];
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 20fc6c8044ac..e82f4de46ea7 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -1623,9 +1623,7 @@ static int pqi_get_physical_device_info(struct pqi_ctrl_info *ctrl_info,
 		&id_phys->alternate_paths_phys_connector,
 		sizeof(device->phys_connector));
 	device->bay = id_phys->phys_bay_in_box;
-	device->multi_lun_device_lun_count = id_phys->multi_lun_device_lun_count;
-	if (!device->multi_lun_device_lun_count)
-		device->multi_lun_device_lun_count = 1;
+	device->lun_count = id_phys->multi_lun_device_lun_count;
 	if ((id_phys->even_more_flags & PQI_DEVICE_PHY_MAP_SUPPORTED) &&
 		id_phys->phy_count)
 		device->phy_id =
@@ -1759,7 +1757,7 @@ static bool pqi_keep_device_offline(struct pqi_ctrl_info *ctrl_info,
 	return offline;
 }
 
-static int pqi_get_device_info(struct pqi_ctrl_info *ctrl_info,
+static int pqi_get_device_info_phys_logical(struct pqi_ctrl_info *ctrl_info,
 	struct pqi_scsi_dev *device,
 	struct bmic_identify_physical_device *id_phys)
 {
@@ -1776,6 +1774,20 @@ static int pqi_get_device_info(struct pqi_ctrl_info *ctrl_info,
 	return rc;
 }
 
+static int pqi_get_device_info(struct pqi_ctrl_info *ctrl_info,
+	struct pqi_scsi_dev *device,
+	struct bmic_identify_physical_device *id_phys)
+{
+	int rc;
+
+	rc = pqi_get_device_info_phys_logical(ctrl_info, device, id_phys);
+
+	if (rc == 0 && device->lun_count == 0)
+		device->lun_count = 1;
+
+	return rc;
+}
+
 static void pqi_show_volume_status(struct pqi_ctrl_info *ctrl_info,
 	struct pqi_scsi_dev *device)
 {
@@ -1910,7 +1922,7 @@ static inline void pqi_remove_device(struct pqi_ctrl_info *ctrl_info, struct pqi
 	int rc;
 	int lun;
 
-	for (lun = 0; lun < device->multi_lun_device_lun_count; lun++) {
+	for (lun = 0; lun < device->lun_count; lun++) {
 		rc = pqi_device_wait_for_pending_io(ctrl_info, device, lun,
 			PQI_REMOVE_DEVICE_PENDING_IO_TIMEOUT_MSECS);
 		if (rc)
@@ -2089,6 +2101,7 @@ static void pqi_scsi_update_device(struct pqi_ctrl_info *ctrl_info,
 	existing_device->sas_address = new_device->sas_address;
 	existing_device->queue_depth = new_device->queue_depth;
 	existing_device->device_offline = false;
+	existing_device->lun_count = new_device->lun_count;
 
 	if (pqi_is_logical_device(existing_device)) {
 		existing_device->is_external_raid_device = new_device->is_external_raid_device;
@@ -2121,10 +2134,6 @@ static void pqi_scsi_update_device(struct pqi_ctrl_info *ctrl_info,
 		existing_device->phy_connected_dev_type = new_device->phy_connected_dev_type;
 		memcpy(existing_device->box, new_device->box, sizeof(existing_device->box));
 		memcpy(existing_device->phys_connector, new_device->phys_connector, sizeof(existing_device->phys_connector));
-
-		existing_device->multi_lun_device_lun_count = new_device->multi_lun_device_lun_count;
-		if (existing_device->multi_lun_device_lun_count == 0)
-			existing_device->multi_lun_device_lun_count = 1;
 	}
 }
 
@@ -6502,6 +6511,12 @@ static void pqi_slave_destroy(struct scsi_device *sdev)
 		return;
 	}
 
+	device->lun_count--;
+	if (device->lun_count > 0) {
+		mutex_unlock(&ctrl_info->scan_mutex);
+		return;
+	}
+
 	spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags);
 	list_del(&device->scsi_device_list_entry);
 	spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 6/8] smartpqi: add controller cache flush during rmmod
  2022-11-08 19:21 [PATCH 0/8] smartpqi updates Don Brace
                   ` (4 preceding siblings ...)
  2022-11-08 19:21 ` [PATCH 5/8] smartpqi: correct device removal for multiactuator devices Don Brace
@ 2022-11-08 19:22 ` Don Brace
  2022-11-08 19:22 ` [PATCH 7/8] smartpqi: initialize feature section info Don Brace
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Don Brace @ 2022-11-08 19:22 UTC (permalink / raw)
  To: Kevin.Barnett, scott.teel, Justin.Lindley, scott.benesh,
	gerry.morong, mahesh.rajashekhara, mike.mcgowen, murthy.bhat,
	kumar.meiyappan, jeremy.reeves, hch, jejb, joseph.szczypek,
	POSWALD
  Cc: linux-scsi

From: Gilbert Wu <Gilbert.Wu@microchip.com>

Add in a call to flush the controller cache during driver removal.

Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Mike Mcgowan <mike.mcgowan@microchip.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Gilbert Wu <Gilbert.Wu@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
 drivers/scsi/smartpqi/smartpqi_init.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index e82f4de46ea7..e9c924ac1bb2 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -9040,6 +9040,7 @@ static void pqi_pci_remove(struct pci_dev *pci_dev)
 {
 	struct pqi_ctrl_info *ctrl_info;
 	u16 vendor_id;
+	int rc;
 
 	ctrl_info = pci_get_drvdata(pci_dev);
 	if (!ctrl_info)
@@ -9051,6 +9052,13 @@ static void pqi_pci_remove(struct pci_dev *pci_dev)
 	else
 		ctrl_info->ctrl_removal_state = PQI_CTRL_GRACEFUL_REMOVAL;
 
+	if (ctrl_info->ctrl_removal_state == PQI_CTRL_GRACEFUL_REMOVAL) {
+		rc = pqi_flush_cache(ctrl_info, RESTART);
+		if (rc)
+			dev_err(&pci_dev->dev,
+				"unable to flush controller cache during remove\n");
+	}
+
 	pqi_remove_ctrl(ctrl_info);
 }
 


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 7/8] smartpqi: initialize feature section info
  2022-11-08 19:21 [PATCH 0/8] smartpqi updates Don Brace
                   ` (5 preceding siblings ...)
  2022-11-08 19:22 ` [PATCH 6/8] smartpqi: add controller cache flush during rmmod Don Brace
@ 2022-11-08 19:22 ` Don Brace
  2022-11-08 19:22 ` [PATCH 8/8] smartpqi: change version to 2.1.20-035 Don Brace
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Don Brace @ 2022-11-08 19:22 UTC (permalink / raw)
  To: Kevin.Barnett, scott.teel, Justin.Lindley, scott.benesh,
	gerry.morong, mahesh.rajashekhara, mike.mcgowen, murthy.bhat,
	kumar.meiyappan, jeremy.reeves, hch, jejb, joseph.szczypek,
	POSWALD
  Cc: linux-scsi

Initialize features to 0 before processing.

Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Mike Mcgowan <mike.mcgowan@microchip.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
 drivers/scsi/smartpqi/smartpqi_init.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index e9c924ac1bb2..fb4a33decde1 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -8004,7 +8004,7 @@ static int pqi_process_config_table(struct pqi_ctrl_info *ctrl_info)
 	struct pqi_config_table *config_table;
 	struct pqi_config_table_section_header *section;
 	struct pqi_config_table_section_info section_info;
-	struct pqi_config_table_section_info feature_section_info;
+	struct pqi_config_table_section_info feature_section_info = {0};
 
 	table_length = ctrl_info->config_table_length;
 	if (table_length == 0)


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 8/8] smartpqi: change version to 2.1.20-035
  2022-11-08 19:21 [PATCH 0/8] smartpqi updates Don Brace
                   ` (6 preceding siblings ...)
  2022-11-08 19:22 ` [PATCH 7/8] smartpqi: initialize feature section info Don Brace
@ 2022-11-08 19:22 ` Don Brace
  2022-11-17 18:11 ` [PATCH 0/8] smartpqi updates Martin K. Petersen
  2022-11-26  3:27 ` Martin K. Petersen
  9 siblings, 0 replies; 12+ messages in thread
From: Don Brace @ 2022-11-08 19:22 UTC (permalink / raw)
  To: Kevin.Barnett, scott.teel, Justin.Lindley, scott.benesh,
	gerry.morong, mahesh.rajashekhara, mike.mcgowen, murthy.bhat,
	kumar.meiyappan, jeremy.reeves, hch, jejb, joseph.szczypek,
	POSWALD
  Cc: linux-scsi

Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Gerry Morong <gerry.morong@microchip.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
 drivers/scsi/smartpqi/smartpqi_init.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index fb4a33decde1..d0446d4d4465 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -33,11 +33,11 @@
 #define BUILD_TIMESTAMP
 #endif
 
-#define DRIVER_VERSION		"2.1.18-045"
+#define DRIVER_VERSION		"2.1.20-035"
 #define DRIVER_MAJOR		2
 #define DRIVER_MINOR		1
-#define DRIVER_RELEASE		18
-#define DRIVER_REVISION		45
+#define DRIVER_RELEASE		20
+#define DRIVER_REVISION		35
 
 #define DRIVER_NAME		"Microchip SmartPQI Driver (v" \
 				DRIVER_VERSION BUILD_TIMESTAMP ")"


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/8] smartpqi updates
  2022-11-08 19:21 [PATCH 0/8] smartpqi updates Don Brace
                   ` (7 preceding siblings ...)
  2022-11-08 19:22 ` [PATCH 8/8] smartpqi: change version to 2.1.20-035 Don Brace
@ 2022-11-17 18:11 ` Martin K. Petersen
  2022-11-26  3:27 ` Martin K. Petersen
  9 siblings, 0 replies; 12+ messages in thread
From: Martin K. Petersen @ 2022-11-17 18:11 UTC (permalink / raw)
  To: Don Brace
  Cc: Kevin.Barnett, scott.teel, Justin.Lindley, scott.benesh,
	gerry.morong, mahesh.rajashekhara, mike.mcgowen, murthy.bhat,
	kumar.meiyappan, jeremy.reeves, hch, jejb, joseph.szczypek,
	POSWALD, linux-scsi


Don,

> These patches are based on Martin Petersen's 6.2/scsi-queue tree
>   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
>   6.2/scsi-queue

Applied to 6.2/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/8] smartpqi updates
  2022-11-08 19:21 [PATCH 0/8] smartpqi updates Don Brace
                   ` (8 preceding siblings ...)
  2022-11-17 18:11 ` [PATCH 0/8] smartpqi updates Martin K. Petersen
@ 2022-11-26  3:27 ` Martin K. Petersen
  9 siblings, 0 replies; 12+ messages in thread
From: Martin K. Petersen @ 2022-11-26  3:27 UTC (permalink / raw)
  To: hch, Kevin.Barnett, POSWALD, kumar.meiyappan, joseph.szczypek,
	mike.mcgowen, jejb, scott.benesh, jeremy.reeves, gerry.morong,
	scott.teel, Don Brace, Justin.Lindley, murthy.bhat,
	mahesh.rajashekhara
  Cc: Martin K . Petersen, linux-scsi

On Tue, 8 Nov 2022 13:21:32 -0600, Don Brace wrote:

> These patches are based on Martin Petersen's 6.2/scsi-queue tree
>   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
>   6.2/scsi-queue
> 
> This set of changes consists of:
>  * Add support for host_tagset.
>    Originally proposed by Hannes Reinecke here:
>    At the time, we wanted to fully test multipath failover before
>    accepting his patch. There have been a few changes in our queuing layer
>    since his patch, so I'm applying it with the required updates.
>    We moved the reserved command section to the end of the command pool,
>    eliminating some math in the submission threads.
>  * Add PCI-IDs for new storage devices.
>  * Corrects maximum LUN number for multi-actuator devices. This update
>    is more cosmetic. No bugs have been filed.
>  * Change the sysfs "raid_level" entry to "N/A" for controller devices.
>  * Correct a rare kernel Oops when removing the smartpqi driver managing
>    multi-actuator devices.
>  * Add in a controller cache flush during driver removal.
>  * Initialize our feature_section structures to 0. More of an alignment
>    with our in-house driver.
>  * Bump the driver version to 2.1.20-035
> 
> [...]

Applied to 6.2/scsi-queue, thanks!

[1/8] smartpqi: convert to host_tagset
      https://git.kernel.org/mkp/scsi/c/b27ac2faa2fc
[2/8] smartpqi: Add new controller PCI IDs
      https://git.kernel.org/mkp/scsi/c/0b93cf2a9097
[3/8] smartpqi: correct max lun number
      https://git.kernel.org/mkp/scsi/c/7c56850637ea
[4/8] smartpqi: change sysfs raid_level attribute to N/A for controllers
      https://git.kernel.org/mkp/scsi/c/cbe42ac15698
[5/8] smartpqi: correct device removal for multiactuator devices
      https://git.kernel.org/mkp/scsi/c/cc9befcbbb5e
[6/8] smartpqi: add controller cache flush during rmmod
      https://git.kernel.org/mkp/scsi/c/14063fb625c4
[7/8] smartpqi: initialize feature section info
      https://git.kernel.org/mkp/scsi/c/921800a1deea
[8/8] smartpqi: change version to 2.1.20-035
      https://git.kernel.org/mkp/scsi/c/2ae45329a956

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 0/8] smartpqi updates
@ 2022-11-08 19:19 Don Brace
  0 siblings, 0 replies; 12+ messages in thread
From: Don Brace @ 2022-11-08 19:19 UTC (permalink / raw)
  To: Kevin.Barnett, scott.teel, Justin.Lindley, scott.benesh,
	gerry.morong, mahesh.rajashekhara, mike.mcgowen, murthy.bhat,
	kumar.meiyappan, jeremy.reeves, hch
  Cc: linux-scsi

These patches are based on Martin Petersen's 6.2/scsi-queue tree
  https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
  6.2/scsi-queue

This set of changes consists of:
 * Add support for host_tagset.
   Originally proposed by Hannes Reinecke here:
   Link: https://lore.kernel.org/linux-block/20191126131009.71726-8-hare@suse
   At the time, we wanted to fully test multipath failover before
   accepting his patch. There have been a few changes in our queuing layer
   since his patch, so I'm applying it with the required updates.
   We moved the reserved command section to the end of the command pool,
   eliminating some math in the submission threads.
 * Add PCI-IDs for new storage devices.
 * Corrects maximum LUN number for multi-actuator devices. This update
   is more cosmetic. No bugs have been filed.
 * Change the sysfs "raid_level" entry to "N/A" for controller devices.
 * Correct a rare kernel Oops when removing the smartpqi driver managing
   multi-actuator devices.
 * Add in a controller cache flush during driver removal. 
 * Initialize our feature_section structures to 0. More of an alignment
   with our in-house driver.
 * Bump the driver version to 2.1.20-035

---

Don Brace (3):
      smartpqi: convert to host_tagset
      smartpqi: initialize feature section info
      smartpqi: change version to 2.1.20-035

Gilbert Wu (1):
      smartpqi: add controller cache flush during rmmod

Kevin Barnett (2):
      smartpqi: correct max lun number
      smartpqi: change sysfs raid_level attribute to N/A for controllers

Kumar Meiyappan (1):
      smartpqi: correct device removal for multiactuator devices

Mike McGowen (1):
      smartpqi: Add new controller PCI IDs


 drivers/scsi/smartpqi/smartpqi.h      |   5 +-
 drivers/scsi/smartpqi/smartpqi_init.c | 164 +++++++++++++++++++-------
 2 files changed, 125 insertions(+), 44 deletions(-)

--
Signature

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-11-26  3:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08 19:21 [PATCH 0/8] smartpqi updates Don Brace
2022-11-08 19:21 ` [PATCH 1/8] smartpqi: convert to host_tagset Don Brace
2022-11-08 19:21 ` [PATCH 2/8] smartpqi: Add new controller PCI IDs Don Brace
2022-11-08 19:21 ` [PATCH 3/8] smartpqi: correct max lun number Don Brace
2022-11-08 19:21 ` [PATCH 4/8] smartpqi: change sysfs raid_level attribute to N/A for controllers Don Brace
2022-11-08 19:21 ` [PATCH 5/8] smartpqi: correct device removal for multiactuator devices Don Brace
2022-11-08 19:22 ` [PATCH 6/8] smartpqi: add controller cache flush during rmmod Don Brace
2022-11-08 19:22 ` [PATCH 7/8] smartpqi: initialize feature section info Don Brace
2022-11-08 19:22 ` [PATCH 8/8] smartpqi: change version to 2.1.20-035 Don Brace
2022-11-17 18:11 ` [PATCH 0/8] smartpqi updates Martin K. Petersen
2022-11-26  3:27 ` Martin K. Petersen
  -- strict thread matches above, loose matches on Subject: below --
2022-11-08 19:19 Don Brace

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.