Skip to contentSkip to conversation

hpsa: support legacy boards

PATCH RESEND Superseded Hannes Reinecke 5 participants 30 messages Aug 8, 2017 – Aug 14, 2017

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover hpsa: support legacy boards

(Resend to include linux-scsi)

Hi all,

this patch adds support for legacy boards, ie for boards previously supported by cciss only.
With this patchset the hpsa driver should work with all Smart Array boards if the 'hpsa_allow_any' module option is set, rendering the cciss driver obsolete.

Hannes Reinecke (5):
hpsa: consolidate status variables
hpsa: add support for legacy boards
hpsa: disable volume status check for older controller
hpsa: Ignore errors for unsupported LV_DEVICE_ID VPD page
hpsa: do not print errors for unsupported report luns format

Jeff Mahoney (1):
hpsa: handle unsupported devices more gracefully

 drivers/scsi/hpsa.c | 131 ++++++++++++++++++++++++++++++++++++++++++++--------
 drivers/scsi/hpsa.h |  57 ++++++++++++++++++++---
 2 files changed, 162 insertions(+), 26 deletions(-)
Signature · 1 line
1.8.5.6
#1 lore raw

PATCH 1/6 hpsa: consolidate status variables

Consolidate several boolean variable into one field.

---
 drivers/scsi/hpsa.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/hpsa.h +6 -6
index 1c49741..bd16f38 100644
@@ -246,7 +246,6 @@ struct ctlr_info {
 	struct delayed_work monitor_ctlr_work;
 	struct delayed_work rescan_ctlr_work;
 	struct delayed_work event_monitor_work;
-	int remove_in_progress;
 	/* Address of h->q[x] is passed to intr handler to know which queue */
 	u8 q[MAX_REPLY_QUEUES];
 	char intrname[MAX_REPLY_QUEUES][16];	/* "hpsa0-msix00" names */
@@ -289,18 +288,19 @@ struct ctlr_info {
 		CTLR_STATE_CHANGE_EVENT_AIO_CONFIG_CHANGE)
 	spinlock_t offline_device_lock;
 	struct list_head offline_device_list;
-	int	acciopath_status;
-	int	drv_req_rescan;
+	unsigned int acciopath_status:1;
+	unsigned int drv_req_rescan:1;
+	unsigned int discovery_polling:1;
+	unsigned int reset_in_progress:1;
+	unsigned int needs_abort_tags_swizzled:1;
+	unsigned int remove_in_progress:1;
 	int	raid_offload_debug;
-	int     discovery_polling;
 	struct  ReportLUNdata *lastlogicals;
-	int	needs_abort_tags_swizzled;
 	struct workqueue_struct *resubmit_wq;
 	struct workqueue_struct *rescan_ctlr_wq;
 	atomic_t abort_cmds_available;
 	wait_queue_head_t event_sync_wait_queue;
 	struct mutex reset_mutex;
-	u8 reset_in_progress;
 	struct hpsa_sas_node *sas_host;
 	spinlock_t reset_lock;
 };
Signature · 1 line
1.8.5.6
#4 lore raw

PATCH 2/6 hpsa: add support for legacy boards

In reply to Hannes Reinecke

Add support for legacy boards, ensuring to enable the driver for those boards only when 'hpsa_allow_any' is set.

---
 drivers/scsi/hpsa.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++-------
 drivers/scsi/hpsa.h | 45 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 92 insertions(+), 7 deletions(-)
drivers/scsi/hpsa.c +47 -7
index 8914eab..7ca6078 100644
@@ -148,6 +148,8 @@
 	{PCI_VENDOR_ID_HP, 0x333f, 0x103c, 0x333f},
 	{PCI_VENDOR_ID_HP,     PCI_ANY_ID,	PCI_ANY_ID, PCI_ANY_ID,
 		PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0},
+	{PCI_VENDOR_ID_COMPAQ,     PCI_ANY_ID,	PCI_ANY_ID, PCI_ANY_ID,
+		PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0},
 	{0,}
 };
 
@@ -158,6 +160,26 @@
  *  access = Address of the struct of function pointers
  */
 static struct board_type products[] = {
+	{0x40700E11, "Smart Array 5300", &SA5A_access},
+	{0x40800E11, "Smart Array 5i", &SA5B_access},
+	{0x40820E11, "Smart Array 532", &SA5B_access},
+	{0x40830E11, "Smart Array 5312", &SA5B_access},
+	{0x409A0E11, "Smart Array 641", &SA5A_access},
+	{0x409B0E11, "Smart Array 642", &SA5A_access},
+	{0x409C0E11, "Smart Array 6400", &SA5A_access},
+	{0x409D0E11, "Smart Array 6400 EM", &SA5A_access},
+	{0x40910E11, "Smart Array 6i", &SA5A_access},
+	{0x3225103C, "Smart Array P600", &SA5A_access},
+	{0x3223103C, "Smart Array P800", &SA5A_access},
+	{0x3234103C, "Smart Array P400", &SA5A_access},
+	{0x3235103C, "Smart Array P400i", &SA5A_access},
+	{0x3211103C, "Smart Array E200i", &SA5A_access},
+	{0x3212103C, "Smart Array E200", &SA5A_access},
+	{0x3213103C, "Smart Array E200i", &SA5A_access},
+	{0x3214103C, "Smart Array E200i", &SA5A_access},
+	{0x3215103C, "Smart Array E200i", &SA5A_access},
+	{0x3237103C, "Smart Array E500", &SA5A_access},
+	{0x323D103C, "Smart Array P700m", &SA5A_access},
 	{0x3241103C, "Smart Array P212", &SA5_access},
 	{0x3243103C, "Smart Array P410", &SA5_access},
 	{0x3245103C, "Smart Array P410i", &SA5_access},
@@ -278,7 +300,8 @@ static int hpsa_find_cfg_addrs(struct pci_dev *pdev, void __iomem *vaddr,
 			       u64 *cfg_offset);
 static int hpsa_pci_find_memory_BAR(struct pci_dev *pdev,
 				    unsigned long *memory_bar);
-static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id);
+static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id,
+				bool *supported);
 static int wait_for_device_to_become_ready(struct ctlr_info *h,
 					   unsigned char lunaddr[],
 					   int reply_queue);
@@ -7232,7 +7255,8 @@ static int hpsa_interrupt_mode(struct ctlr_info *h)
 	return 0;
 }
 
-static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
+static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id,
+				bool *supported)
 {
 	int i;
 	u32 subsystem_vendor_id, subsystem_device_id;
@@ -7242,9 +7266,22 @@ static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
 	*board_id = ((subsystem_device_id << 16) & 0xffff0000) |
 		    subsystem_vendor_id;
 
+	if (supported)
+		*supported = true;
 	for (i = 0; i < ARRAY_SIZE(products); i++)
-		if (*board_id == products[i].board_id)
-			return i;
+		if (*board_id == products[i].board_id) {
+			if (products[i].access != &SA5A_access &&
+			    products[i].access != &SA5B_access)
+				return i;
+			if (hpsa_allow_any) {
+				dev_warn(&pdev->dev,
+					 "unsupported board ID: 0x%08x\n",
+					 *board_id);
+				if (supported)
+					*supported = false;
+				return i;
+			}
+		}
 
 	if ((subsystem_vendor_id != PCI_VENDOR_ID_HP &&
 		subsystem_vendor_id != PCI_VENDOR_ID_COMPAQ) ||
@@ -7253,6 +7290,8 @@ static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
 			"0x%08x, ignoring.\n", *board_id);
 			return -ENODEV;
 	}
+	if (supported)
+		*supported = false;
 	return ARRAY_SIZE(products) - 1; /* generic unknown smart array */
 }
 
@@ -7555,13 +7594,14 @@ static void hpsa_free_pci_init(struct ctlr_info *h)
 static int hpsa_pci_init(struct ctlr_info *h)
 {
 	int prod_index, err;
+	bool supported;
 
-	prod_index = hpsa_lookup_board_id(h->pdev, &h->board_id);
+	prod_index = hpsa_lookup_board_id(h->pdev, &h->board_id, &supported);
 	if (prod_index < 0)
 		return prod_index;
 	h->product_name = products[prod_index].product_name;
 	h->access = *(products[prod_index].access);
-
+	h->supported = supported;
 	pci_disable_link_state(h->pdev, PCIE_LINK_STATE_L0S |
 			       PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM);
 
@@ -8241,7 +8281,7 @@ static int hpsa_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (number_of_controllers == 0)
 		printk(KERN_INFO DRIVER_NAME "\n");
 
-	rc = hpsa_lookup_board_id(pdev, &board_id);
+	rc = hpsa_lookup_board_id(pdev, &board_id, NULL);
 	if (rc < 0) {
 		dev_warn(&pdev->dev, "Board ID not found\n");
 		return rc;
drivers/scsi/hpsa.h +45 -0

69 lines not on this page · raw message

Signature · 1 line
1.8.5.6
#14 lore raw

PATCH 4/6 hpsa: Ignore errors for unsupported LV_DEVICE_ID VPD page

In reply to Hannes Reinecke

Older controller do not support the LV_DEVICE_ID VPD page, so we shouldn't print out an error message here.

---
 drivers/scsi/hpsa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hpsa.c +1 -1
index 4ebf5d4..dbd5fbc 100644
@@ -3814,7 +3814,7 @@ static int hpsa_update_device_info(struct ctlr_info *h,
 	memset(this_device->device_id, 0,
 		sizeof(this_device->device_id));
 	if (hpsa_get_device_id(h, scsi3addr, this_device->device_id, 8,
-		sizeof(this_device->device_id)))
+		sizeof(this_device->device_id) < 0))
 		dev_err(&h->pdev->dev,
 			"hpsa%d: %s: can't get device id for host %d:C0:T%d:L%d\t%s\t%.16s\n",
 			h->ctlr, __func__,
Signature · 1 line
1.8.5.6
#16 lore raw

PATCH 5/6 hpsa: do not print errors for unsupported report luns format

In reply to Hannes Reinecke

Older/Unsupported controllers might not support the 'extended' report luns format, but as they are unsupported we don't need to print out an error here.

---
 drivers/scsi/hpsa.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/scsi/hpsa.c +12 -9
index dbd5fbc..790958f 100644
@@ -3588,7 +3588,7 @@ static int hpsa_scsi_do_report_luns(struct ctlr_info *h, int logical,
 	memset(scsi3addr, 0, sizeof(scsi3addr));
 	if (fill_cmd(c, logical ? HPSA_REPORT_LOG : HPSA_REPORT_PHYS, h,
 		buf, bufsize, 0, scsi3addr, TYPE_CMD)) {
-		rc = -1;
+		rc = -EAGAIN;
 		goto out;
 	}
 	if (extended_response)
@@ -3601,16 +3601,17 @@ static int hpsa_scsi_do_report_luns(struct ctlr_info *h, int logical,
 	if (ei->CommandStatus != 0 &&
 	    ei->CommandStatus != CMD_DATA_UNDERRUN) {
 		hpsa_scsi_interpret_error(h, c);
-		rc = -1;
+		rc = -EIO;
 	} else {
 		struct ReportLUNdata *rld = buf;
 
 		if (rld->extended_response_flag != extended_response) {
-			dev_err(&h->pdev->dev,
-				"report luns requested format %u, got %u\n",
-				extended_response,
-				rld->extended_response_flag);
-			rc = -1;
+			if (h->supported)
+				dev_err(&h->pdev->dev,
+					"report luns requested format %u, got %u\n",
+					extended_response,
+					rld->extended_response_flag);
+			rc = -EOPNOTSUPP;
 		}
 	}
 out:
@@ -3626,7 +3627,10 @@ static inline int hpsa_scsi_do_report_phys_luns(struct ctlr_info *h,
 
 	rc = hpsa_scsi_do_report_luns(h, 0, buf, bufsize,
 				      HPSA_REPORT_PHYS_EXTENDED);
-	if (!rc || !hpsa_allow_any)
+	if (rc == -EOPNOTSUPP) {
+		if (h->supported)
+			return rc;
+	} else if (rc < 0)
 		return rc;
 
 	/* REPORT PHYS EXTENDED is not supported */
@@ -6605,7 +6609,6 @@ static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h,
 		default:
 			dev_warn(&h->pdev->dev, "unknown command 0x%c\n", cmd);
 			BUG();
-			return -1;
 		}
 	} else if (cmd_type == TYPE_MSG) {
 		switch (cmd) {
Signature · 1 line
1.8.5.6
#10 lore raw

PATCH 3/6 hpsa: disable volume status check for older controller

In reply to Hannes Reinecke

Older Controller might not support volume status, so assume the volume is online here.

---
 drivers/scsi/hpsa.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/scsi/hpsa.c +11 -0
index 7ca6078..4ebf5d4 100644
@@ -3832,6 +3832,17 @@ static int hpsa_update_device_info(struct ctlr_info *h,
 		if (h->fw_support & MISC_FW_RAID_OFFLOAD_BASIC)
 			hpsa_get_ioaccel_status(h, scsi3addr, this_device);
 		volume_offline = hpsa_volume_offline(h, scsi3addr);
+		if (volume_offline == HPSA_VPD_LV_STATUS_UNSUPPORTED &&
+		    !h->supported) {
+			/*
+			 * Older / unsupported controllers might not support
+			 * volume status
+			 */
+			dev_info(&h->pdev->dev,
+				 "C0:T%d:L%d Volume status not available, assuming online.\n",
+				 this_device->target, this_device->lun);
+			volume_offline = 0;
+		}
 		this_device->volume_offline = volume_offline;
 		if (volume_offline == HPSA_LV_FAILED) {
 			rc = HPSA_LV_FAILED;
Signature · 1 line
1.8.5.6
#19 lore raw

PATCH 6/6 hpsa: handle unsupported devices more gracefully

In reply to Hannes Reinecke

From: Jeff Mahoney <[email protected]>

Add a warning message if an unsupported device is found and the hpsa_allow_any parameter is not set.
Also make the hpsa_allow_any parameter writeable once the hpsa driver is loaded.

---
 drivers/scsi/hpsa.c | 43 ++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 40 insertions(+), 3 deletions(-)
drivers/scsi/hpsa.c +40 -3
index 790958f..d523ec0 100644
@@ -82,10 +82,19 @@
 MODULE_VERSION(HPSA_DRIVER_VERSION);
 MODULE_LICENSE("GPL");
 
-static int hpsa_allow_any;
-module_param(hpsa_allow_any, int, S_IRUGO|S_IWUSR);
+static bool hpsa_allow_any = false;
+static bool hpsa_claimed_unsupported = false;
+static int hpsa_set_hpsa_allow_any(const char *buffer,
+				   const struct kernel_param *kp);
+static struct kernel_param_ops hpsa_allow_any_ops = {
+	.set = hpsa_set_hpsa_allow_any,
+	.get = param_get_bool,
+};
+
+module_param_cb(hpsa_allow_any, &hpsa_allow_any_ops, &hpsa_allow_any,
+		S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(hpsa_allow_any,
-		"Allow hpsa driver to access unknown HP Smart Array hardware");
+		"Allow hpsa driver to access unsupported HP Smart Array hardware");
 static int hpsa_simple_mode;
 module_param(hpsa_simple_mode, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(hpsa_simple_mode,
@@ -7302,10 +7311,12 @@ static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id,
 		!hpsa_allow_any) {
 		dev_warn(&pdev->dev, "unrecognized board ID: "
 			"0x%08x, ignoring.\n", *board_id);
+		dev_warn(&pdev->dev, "This device may be enabled by loading the hpsa module with the hpsa_allow_any=1 option or by writing \"%s\" to /sys/bus/pci/drivers/hpsa/bind while the module is loaded. Please note that the driver is untested with this device and will result in an unsupported environment.\n", dev_name(&pdev->dev));
 			return -ENODEV;
 	}
 	if (supported)
 		*supported = false;
+	hpsa_claimed_unsupported = true;
 	return ARRAY_SIZE(products) - 1; /* generic unknown smart array */
 }
 
@@ -9622,5 +9633,31 @@ static void __attribute__((unused)) verify_offsets(void)
 #undef VERIFY_OFFSET
 }
 
+static int hpsa_set_hpsa_allow_any(const char *buffer,
+				   const struct kernel_param *kp)
+{
+	int ret;
+	struct kernel_param dummy_kp = *kp;
+	bool newval;
+
+	dummy_kp.arg = &newval;
+
+	ret = param_set_bool(buffer, &dummy_kp);
+	if (ret)
+		return ret;
+
+	if (hpsa_allow_any && !newval) {
+		if (hpsa_claimed_unsupported) {
+			pr_info("hpsa: can't disable hpsa_allow_any parameter. Devices already in use.\n");
+			return -EPERM;
+		} else
+			hpsa_allow_any = false;
+	} else if (!hpsa_allow_any && newval) {
+		pr_info("hpsa: allowing unsupported devices. If devices are claimed, this will result in an unsupported environment.\n");
+		hpsa_allow_any = true;
+	}
+	return 0;
+}
+
 module_init(hpsa_init);
 module_exit(hpsa_cleanup);
Signature · 1 line
1.8.5.6
#2 lore raw

Re: [PATCH 1/6] hpsa: consolidate status variables

In reply to Hannes Reinecke

These seem to be modified from sysfs files, so you'll run into read-modify-write atomicy issues with bitfields.

That being said while plain ints are somewhat safe the right thing would be to use proper atomic bitops.

#5 lore raw

Re: [PATCH 2/6] hpsa: add support for legacy boards

In reply to Hannes Reinecke
Quoted 2 lines · Hannes Reinecke

Add support for legacy boards, ensuring to enable the driver for those boards only when 'hpsa_allow_any' is set.

Why the wildcard instead of the specific IDs from the cciss driver?

#11 lore raw

Re: [PATCH 3/6] hpsa: disable volume status check for older controller

In reply to Hannes Reinecke

Why that weird supported flag check?

(which also means I need to got back to the previous patch and understand that part..)

#8 lore raw

Re: [PATCH 2/6] hpsa: add support for legacy boards

In reply to Hannes Reinecke
Quoted 18 lines
drivers/scsi/hpsa.c +7 -3
-static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
+static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id,
+				bool *supported)
 {
 	int i;
 	u32 subsystem_vendor_id, subsystem_device_id;
@@ -7242,9 +7266,22 @@ static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
 	*board_id = ((subsystem_device_id << 16) & 0xffff0000) |
 		    subsystem_vendor_id;
 
+	if (supported)
+		*supported = true;
 	for (i = 0; i < ARRAY_SIZE(products); i++)
-		if (*board_id == products[i].board_id)
-			return i;
+		if (*board_id == products[i].board_id) {
+			if (products[i].access != &SA5A_access &&
+			    products[i].access != &SA5B_access)

drivers/scsi/hpsa.c static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id) · line 7284

Quoted 10 lines
drivers/scsi/hpsa.c +10 -0
+				return i;
+			if (hpsa_allow_any) {
+				dev_warn(&pdev->dev,
+					 "unsupported board ID: 0x%08x\n",
+					 *board_id);
+				if (supported)
+					*supported = false;
+				return i;
+			}
+		}

Can you explain the point of the supported flag?

drivers/scsi/hpsa.h static bool SA5_ioaccel_mode1_intr_pending(struct ctlr_info *h) · line 579

Quoted 3 lines
drivers/scsi/hpsa.h +3 -0
+	unsigned long register_value  =
+		readl(h->vaddr + SA5_INTR_STATUS);
+	return (register_value & SA5B_INTR_PENDING);

This should be condensed into:

	return readl(h->vaddr + SA5_INTR_STATUS) & SA5B_INTR_PENDING;
Quoted 7 lines
drivers/scsi/hpsa.h +4 -0
 	.command_completed = SA5_completed,
 };
 
+/* Duplicate entry of the above to mark unsupported boards */
+static struct access_method SA5A_access = {
+	.submit_command = SA5_submit_command,
+	.set_intr_mask = SA5_intr_mask,

drivers/scsi/hpsa.h static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q) · line 633

Quoted 10 lines
drivers/scsi/hpsa.h +10 -0
+	.intr_pending = SA5_intr_pending,
+	.command_completed = SA5_completed,
+};
+
+static struct access_method SA5B_access = {
+	.submit_command = SA5_submit_command,
+	.set_intr_mask = SA5B_intr_mask,
+	.intr_pending = SA5B_intr_pending,
+	.command_completed = SA5_completed,
+};

Please align the fields nicely, e.g.:

static struct access_method SA5A_access = {
	.submit_command 	= SA5_submit_command,
	.set_intr_mask		= SA5_intr_mask,
	...
#17 lore raw

Re: [PATCH 5/6] hpsa: do not print errors for unsupported report luns format

In reply to Hannes Reinecke

I don't like the misnamed supported flag. Either we should always ignore the errors, or key it off a specific flag for newer firmware.

#20 lore raw

Re: [PATCH 6/6] hpsa: handle unsupported devices more gracefully

In reply to Hannes Reinecke
Quoted 6 lines · Hannes Reinecke

From: Jeff Mahoney <[email protected]>

Add a warning message if an unsupported device is found and the hpsa_allow_any parameter is not set.
Also make the hpsa_allow_any parameter writeable once the hpsa driver is loaded.

This looks ok, but maybe we should also plan for just setting the flag by defauly sooner or later?

Quoted 1 line

+static struct kernel_param_ops hpsa_allow_any_ops = {

const?

drivers/scsi/hpsa.c static void __attribute__((unused)) verify_offsets(void) · line 9659

Quoted 12 lines
drivers/scsi/hpsa.c +12 -0
+
+	if (hpsa_allow_any && !newval) {
+		if (hpsa_claimed_unsupported) {
+			pr_info("hpsa: can't disable hpsa_allow_any parameter. Devices already in use.\n");
+			return -EPERM;
+		} else
+			hpsa_allow_any = false;
+	} else if (!hpsa_allow_any && newval) {
+		pr_info("hpsa: allowing unsupported devices. If devices are claimed, this will result in an unsupported environment.\n");
+		hpsa_allow_any = true;
+	}
+	return 0;

Do we really need this to start with? It's normal that module parameters only affect newly probed devices when changed at runtime, so I think we could just stick to the simple module parameter with permissions that allow runtime changes.

#9 lore raw

Re: [PATCH 2/6] hpsa: add support for legacy boards

In reply to Christoph Hellwig
Quoted 22 lines · Christoph Hellwig
Quoted 22 lines
drivers/scsi/hpsa.c +11 -3
-static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
+static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id,
+				bool *supported)
 {
 	int i;
 	u32 subsystem_vendor_id, subsystem_device_id;
@@ -7242,9 +7266,22 @@ static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
 	*board_id = ((subsystem_device_id << 16) & 0xffff0000) |
 		    subsystem_vendor_id;
 
+	if (supported)
+		*supported = true;
 	for (i = 0; i < ARRAY_SIZE(products); i++)
-		if (*board_id == products[i].board_id)
-			return i;
+		if (*board_id == products[i].board_id) {
+			if (products[i].access != &SA5A_access &&
+			    products[i].access != &SA5B_access)
+				return i;
+			if (hpsa_allow_any) {
+				dev_warn(&pdev->dev,
+					 "unsupported board ID: 0x%08x\n",
Quoted 9 lines

drivers/scsi/hpsa.c static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id) · line 7284

Quoted 6 lines
drivers/scsi/hpsa.c +6 -0
+					 *board_id);
+				if (supported)
+					*supported = false;
+				return i;
+			}
+		}

Can you explain the point of the supported flag?

'hpsa_allow_any' just enables the _driver_ to bind to older / unsupported boards, it doesn't tell us if this particular instance is an old board.
For older boards we should suppress messages from not-implemented features, whereas on 'real' boards those features should be implemented, and we should be throwing an error or a warning.
Hence the =supported" flag.

Quoted 8 lines

drivers/scsi/hpsa.h static bool SA5_ioaccel_mode1_intr_pending(struct ctlr_info *h) · line 579

Quoted 3 lines
drivers/scsi/hpsa.h +3 -0
+	unsigned long register_value  =
+		readl(h->vaddr + SA5_INTR_STATUS);
+	return (register_value & SA5B_INTR_PENDING);

This should be condensed into:

	return readl(h->vaddr + SA5_INTR_STATUS) & SA5B_INTR_PENDING;

Yeah; but this is _actually_ just copied over, so other lines will be affected here, too.
Will be adding a patch for that.

Quoted 20 lines
Quoted 7 lines
drivers/scsi/hpsa.h +4 -0
 	.command_completed = SA5_completed,
 };
 
+/* Duplicate entry of the above to mark unsupported boards */
+static struct access_method SA5A_access = {
+	.submit_command = SA5_submit_command,
+	.set_intr_mask = SA5_intr_mask,

drivers/scsi/hpsa.h static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q) · line 633

Quoted 10 lines
drivers/scsi/hpsa.h +10 -0
+	.intr_pending = SA5_intr_pending,
+	.command_completed = SA5_completed,
+};
+
+static struct access_method SA5B_access = {
+	.submit_command = SA5_submit_command,
+	.set_intr_mask = SA5B_intr_mask,
+	.intr_pending = SA5B_intr_pending,
+	.command_completed = SA5_completed,
+};

Please align the fields nicely, e.g.:

Quoted 5 lines
static struct access_method SA5A_access = {
	.submit_command 	= SA5_submit_command,
	.set_intr_mask		= SA5_intr_mask,
	...

Okay.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
#18 lore raw

Re: [PATCH 5/6] hpsa: do not print errors for unsupported report luns format

In reply to Christoph Hellwig
Quoted 3 lines · Christoph Hellwig

I don't like the misnamed supported flag. Either we should always ignore the errors, or key it off a specific flag for newer firmware.

Well, there is no such hardware flag; there are several features implemented across the board. Hence we need to store it in the driver structure, which actually is the reason for the 'supported' flag.

I can rename it to 'legacy_board' or the like if 'supported' is not an acceptable naming ...

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
#6 lore raw

Re: [PATCH 2/6] hpsa: add support for legacy boards

In reply to Christoph Hellwig
Quoted 6 lines · Christoph Hellwig
Quoted 2 lines · Hannes Reinecke

Add support for legacy boards, ensuring to enable the driver for those boards only when 'hpsa_allow_any' is set.

Why the wildcard instead of the specific IDs from the cciss driver?

Because I'm lazy? And we're catching those boards with the wildcard entry anyway? And the distinction between wildcard entry (designed to catch unsupported devices) and pci IDs from the cciss drivers (which will be unsupported, too) is meaningless?

But if you insist ...

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
#7 lore raw

Re: [PATCH 2/6] hpsa: add support for legacy boards

Quoted 11 lines · Hannes Reinecke
Quoted 6 lines · Christoph Hellwig
Quoted 2 lines · Hannes Reinecke

Add support for legacy boards, ensuring to enable the driver for those boards only when 'hpsa_allow_any' is set.

Why the wildcard instead of the specific IDs from the cciss driver?

Because I'm lazy? And we're catching those boards with the wildcard entry anyway? And the distinction between wildcard entry (designed to catch unsupported devices) and pci IDs from the cciss drivers (which will be unsupported, too) is meaningless?

So what again is unsupported?

How do we know there never was any other compaq device claiming to be raid class?

#21 lore raw
In reply to Hannes Reinecke
Quoted 34 lines

-----Original Message-----
From: Hannes Reinecke [mailto:[email protected]]
Sent: Tuesday, August 08, 2017 3:35 AM
To: Martin K. Petersen <[email protected]>
Cc: Don Brace <[email protected]>; Christoph Hellwig <[email protected]>; James Bottomley <[email protected]>; Meelis Roos <[email protected]>; [email protected]; Hannes Reinecke <[email protected]>
Subject: [PATCH RESEND 0/6] hpsa: support legacy boards

EXTERNAL EMAIL

(Resend to include linux-scsi)

Hi all,

this patch adds support for legacy boards, ie for boards previously supported by cciss only.
With this patchset the hpsa driver should work with all Smart Array boards if the 'hpsa_allow_any' module option is set, rendering the cciss driver obsolete.

Hannes Reinecke (5):
hpsa: consolidate status variables
hpsa: add support for legacy boards
hpsa: disable volume status check for older controller
hpsa: Ignore errors for unsupported LV_DEVICE_ID VPD page
hpsa: do not print errors for unsupported report luns format

Jeff Mahoney (1):
hpsa: handle unsupported devices more gracefully

Quoted 7 lines
 drivers/scsi/hpsa.c | 131
++++++++++++++++++++++++++++++++++++++++++++--------
 drivers/scsi/hpsa.h |  57 ++++++++++++++++++++---
 2 files changed, 162 insertions(+), 26 deletions(-)

--
1.8.5.6

NACK this series

We do not want to support these older controllers in the hpsa driver.

While the driver may load and manage requests under healthy conditions many features will not be supported. Customers will not have support for any issues involving these controllers.

We would need to track these changes in our OOB driver adding more confusion.

For more information please see:
http://cciss.sourceforge.net

Thanks,
Don Brace
ESC - Smart Storage
Microsemi Corporation

#22 lore raw
Quoted 44 lines · Don Brace
Quoted 34 lines

-----Original Message-----
From: Hannes Reinecke [mailto:[email protected]]
Sent: Tuesday, August 08, 2017 3:35 AM
To: Martin K. Petersen <[email protected]>
Cc: Don Brace <[email protected]>; Christoph Hellwig <[email protected]>; James Bottomley <[email protected]>; Meelis Roos <[email protected]>; [email protected]; Hannes Reinecke <[email protected]>
Subject: [PATCH RESEND 0/6] hpsa: support legacy boards

EXTERNAL EMAIL

(Resend to include linux-scsi)

Hi all,

this patch adds support for legacy boards, ie for boards previously supported by cciss only.
With this patchset the hpsa driver should work with all Smart Array boards if the 'hpsa_allow_any' module option is set, rendering the cciss driver obsolete.

Hannes Reinecke (5):
hpsa: consolidate status variables
hpsa: add support for legacy boards
hpsa: disable volume status check for older controller
hpsa: Ignore errors for unsupported LV_DEVICE_ID VPD page
hpsa: do not print errors for unsupported report luns format

Jeff Mahoney (1):
hpsa: handle unsupported devices more gracefully

Quoted 7 lines
 drivers/scsi/hpsa.c | 131
++++++++++++++++++++++++++++++++++++++++++++--------
 drivers/scsi/hpsa.h |  57 ++++++++++++++++++++---
 2 files changed, 162 insertions(+), 26 deletions(-)

--
1.8.5.6

NACK this series

Quoted 9 lines

We do not want to support these older controllers in the hpsa driver.

While the driver may load and manage requests under healthy conditions many features will not be supported. Customers will not have support for any issues involving these controllers.

We would need to track these changes in our OOB driver adding more confusion.

Weelll ... that is _precisely_ why I introduced the 'unsupported' flag to the hba structure; once this is set we have encountered an unsupported board, and things might not work as expected.

More importantly, you don't have to support that board.

We can even add a stronger wording if you like, eg printing out a big fat warning in dmesg
'This board is unsupported, some features might not work'.

So where's the bother here?

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
#23 lore raw

No device support in Linux is unsupported, sorry. I think we're getting into the corporate bullshit game a little too much here.

#24 lore raw
Quoted 3 lines · Christoph Hellwig

No device support in Linux is unsupported, sorry. I think we're getting into the corporate bullshit game a little too much here.

Well, yes and no.

My intention with the 'unsupported' flag was to differentiate legit errors / warnings from known / expected failures.

Modern (or 'supported' as Don puts it) boards have quite some features built in, and any failure to activate these features should be debugged. Older (or 'unsupported') boards might not necessarily have these features, so a failure here is actually to be expected, seeing that a firmware update for these boards is not likely to happen.

And this was precisely the meaning of the 'unsupported' flag; if that is set we'll blank out some known warnings or short-circuit feature detections which are known not to be present. Plus we have a marker (and, with the latest patch, even a dmesg warning) letting us differentiate between legit errors and unsupported/unimplemented features.

Personally I'm happy to support the legacy side of things (ie blanking out errors from unsupported controllers), if that is of any help ...

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
maintainer
#25 lore raw
In reply to Christoph Hellwig
Quoted 2 lines · Christoph Hellwig

No device support in Linux is unsupported, sorry.  I think we're getting into the corporate bullshit game a little too much here.

I think there are two different definitions of supported here.  To us, any device to which the driver attaches is "supported".  However, if it's never been tested before it may not work very well.  In the Linux way, we'll try to fix the bugs when they're reported and in that sense we support the device until nothing in the kernel attaches to its ids anymore.

In the corporate world "supported" means we'll sell you a contract giving you certain rights to report bugs and have us fix them.  There are definite reasons why corporations only support a small range of new devices, even though devices not on this list may still be attached to by the driver and thus we (Linux Community) would try to fix the bug reports for.

I think what you're basically asking for is a different name for the flag, which is fine?  how about 'legacy' instead?

James

#26 lore raw
Quoted 18 lines · James Bottomley
Quoted 2 lines · Christoph Hellwig

No device support in Linux is unsupported, sorry. I think we're getting into the corporate bullshit game a little too much here.

I think there are two different definitions of supported here. To us, any device to which the driver attaches is "supported". However, if it's never been tested before it may not work very well. In the Linux way, we'll try to fix the bugs when they're reported and in that sense we support the device until nothing in the kernel attaches to its ids anymore.

In the corporate world "supported" means we'll sell you a contract giving you certain rights to report bugs and have us fix them. There are definite reasons why corporations only support a small range of new devices, even though devices not on this list may still be attached to by the driver and thus we (Linux Community) would try to fix the bug reports for.

Quoted 3 lines

I think what you're basically asking for is a different name for the flag, which is fine? how about 'legacy' instead?

Sure, no problem with that.

Don?

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
#27 lore raw
Quoted 41 lines

-----Original Message-----
From: Hannes Reinecke [mailto:[email protected]]
Sent: Thursday, August 10, 2017 9:11 AM
To: James Bottomley <[email protected]>; Christoph Hellwig <[email protected]>
Cc: Don Brace <[email protected]>; Martin K. Petersen <[email protected]>; Meelis Roos <[email protected]>; linux- [email protected]
Subject: Re: [PATCH RESEND 0/6] hpsa: support legacy boards

EXTERNAL EMAIL

Quoted 18 lines · James Bottomley
Quoted 2 lines · Christoph Hellwig

No device support in Linux is unsupported, sorry. I think we're getting into the corporate bullshit game a little too much here.

I think there are two different definitions of supported here. To us, any device to which the driver attaches is "supported". However, if it's never been tested before it may not work very well. In the Linux way, we'll try to fix the bugs when they're reported and in that sense we support the device until nothing in the kernel attaches to its ids anymore.

In the corporate world "supported" means we'll sell you a contract giving you certain rights to report bugs and have us fix them. There are definite reasons why corporations only support a small range of new devices, even though devices not on this list may still be attached to by the driver and thus we (Linux Community) would try to fix the bug reports for.

Quoted 3 lines

I think what you're basically asking for is a different name for the flag, which is fine? how about 'legacy' instead?

Sure, no problem with that.

Don?

Cheers,

Quoted 7 lines

Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
[email protected] +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)

Ok, but to clarify...
* Will the cciss driver be removed when these patches are applied? Otherwise what will prevent the cciss driver from loading over these devices? i.e. how often will users need to be reminded to add cciss.cciss_allow_hpsa flag?

#28 lore raw
Quoted 49 lines · Don Brace
Quoted 41 lines

-----Original Message-----
From: Hannes Reinecke [mailto:[email protected]]
Sent: Thursday, August 10, 2017 9:11 AM
To: James Bottomley <[email protected]>; Christoph Hellwig <[email protected]>
Cc: Don Brace <[email protected]>; Martin K. Petersen <[email protected]>; Meelis Roos <[email protected]>; linux- [email protected]
Subject: Re: [PATCH RESEND 0/6] hpsa: support legacy boards

EXTERNAL EMAIL

Quoted 18 lines · James Bottomley
Quoted 2 lines · Christoph Hellwig

No device support in Linux is unsupported, sorry. I think we're getting into the corporate bullshit game a little too much here.

I think there are two different definitions of supported here. To us, any device to which the driver attaches is "supported". However, if it's never been tested before it may not work very well. In the Linux way, we'll try to fix the bugs when they're reported and in that sense we support the device until nothing in the kernel attaches to its ids anymore.

In the corporate world "supported" means we'll sell you a contract giving you certain rights to report bugs and have us fix them. There are definite reasons why corporations only support a small range of new devices, even though devices not on this list may still be attached to by the driver and thus we (Linux Community) would try to fix the bug reports for.

Quoted 3 lines

I think what you're basically asking for is a different name for the flag, which is fine? how about 'legacy' instead?

Sure, no problem with that.

Don?

Cheers,

Quoted 7 lines

Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
[email protected] +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)

Quoted 6 lines

Ok, but to clarify...
* Will the cciss driver be removed when these patches are applied? Otherwise what will prevent the cciss driver from loading over these devices? i.e. how often will users need to be reminded to add cciss.cciss_allow_hpsa flag?

The idea is to remove the cciss driver completely once these changes are in. Preferably with the same patchset to avoid any timing issues.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
#12 lore raw

Re: [PATCH 3/6] hpsa: disable volume status check for older controller

In reply to Hannes Reinecke
Quoted 16 lines · Hannes Reinecke

Older Controller might not support volume status, so assume the volume is online here.

---
 drivers/scsi/hpsa.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/scsi/hpsa.c +0 -0
index 7ca6078..4ebf5d4 100644
@@ -3832,6 +3832,17 @@ static int hpsa_update_device_info(struct ctlr_info *h,
 		if (h->fw_support & MISC_FW_RAID_OFFLOAD_BASIC)
 			hpsa_get_ioaccel_status(h, scsi3addr, this_device);
 		volume_offline = hpsa_volume_offline(h, scsi3addr);

drivers/scsi/hpsa.c static int hpsa_update_device_info(struct ctlr_info *h, · line 3844

Quoted 10 lines
drivers/scsi/hpsa.c +10 -0
+		if (volume_offline == HPSA_VPD_LV_STATUS_UNSUPPORTED &&
+		    !h->supported) {
+			/*
+			 * Older / unsupported controllers might not support
+			 * volume status
+			 */
+			dev_info(&h->pdev->dev,
+				 "C0:T%d:L%d Volume status not available, assuming online.\n",
+				 this_device->target, this_device->lun);
+			volume_offline = 0;

Hi,
could we have here
volume_offline = HPSA_LV_OK;
instead ?
tomash

Quoted 4 lines
drivers/scsi/hpsa.c +1 -0
+		}
 		this_device->volume_offline = volume_offline;
 		if (volume_offline == HPSA_LV_FAILED) {
 			rc = HPSA_LV_FAILED;
Acked-by
#29 lore raw
In reply to Hannes Reinecke
Quoted 11 lines

-----Original Message-----
From: Hannes Reinecke [mailto:[email protected]]
Sent: Friday, August 11, 2017 1:43 AM
To: Don Brace <[email protected]>; James Bottomley <[email protected]>; Christoph Hellwig <[email protected]>
Cc: Martin K. Petersen <[email protected]>; Meelis Roos <[email protected]>; [email protected]
Subject: Re: [PATCH RESEND 0/6] hpsa: support legacy boards

EXTERNAL EMAIL

...

Quoted 14 lines
Quoted 3 lines

Ok, but to clarify...
* Will the cciss driver be removed when these patches are applied?

Otherwise

Quoted 2 lines

what will prevent the cciss driver from loading over these devices? i.e. how often will users need to be reminded to add

cciss.cciss_allow_hpsa flag?

Quoted 2 lines

The idea is to remove the cciss driver completely once these changes are in. Preferably with the same patchset to avoid any timing issues.

Cheers,

Quoted 7 lines

Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
[email protected] +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)

OK, then I ACK the series once the reviews by others have been resolved. Thank-you and everyone else for your patches and attention to this issue. And thanks to everyone for your input.

#3 lore raw

Re: [PATCH 1/6] hpsa: consolidate status variables

In reply to Christoph Hellwig
Quoted 6 lines · Christoph Hellwig

These seem to be modified from sysfs files, so you'll run into read-modify-write atomicy issues with bitfields.

That being said while plain ints are somewhat safe the right thing would be to use proper atomic bitops.

True, but rewriting that into atomics would change the flow of the driver by quite a bit (as quite some spinlocks can be removed), so I'd rather _not_ attempt this now.

So I'll be dropping this patch.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
#13 lore raw

Re: [PATCH 3/6] hpsa: disable volume status check for older controller

In reply to Tomas Henzl
Quoted 24 lines · Tomas Henzl
Quoted 23 lines · Hannes Reinecke

Older Controller might not support volume status, so assume the volume is online here.

---
 drivers/scsi/hpsa.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/scsi/hpsa.c +7 -0
index 7ca6078..4ebf5d4 100644
@@ -3832,6 +3832,17 @@ static int hpsa_update_device_info(struct ctlr_info *h,
 		if (h->fw_support & MISC_FW_RAID_OFFLOAD_BASIC)
 			hpsa_get_ioaccel_status(h, scsi3addr, this_device);
 		volume_offline = hpsa_volume_offline(h, scsi3addr);
+		if (volume_offline == HPSA_VPD_LV_STATUS_UNSUPPORTED &&
+		    !h->supported) {
+			/*
+			 * Older / unsupported controllers might not support
+			 * volume status
+			 */
+			dev_info(&h->pdev->dev,
Quoted 8 lines

drivers/scsi/hpsa.c static int hpsa_update_device_info(struct ctlr_info *h, · line 3844

Quoted 3 lines
drivers/scsi/hpsa.c +3 -0
+				 "C0:T%d:L%d Volume status not available, assuming online.\n",
+				 this_device->target, this_device->lun);
+			volume_offline = 0;

Hi,
could we have here
volume_offline = HPSA_LV_OK;
instead ?

Hmm; rather not (for now).
At several places we're just checking for (!h->volume_offline); before changing that toe HPSA_LV_OK we'd need to change all of them to (h->volume_offline == HPSA_LV_OK) to avoid any issues here.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)