[SRU][Cosmic][PATCH 0/5] Fixes for LP:1798208

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[SRU][Cosmic][PATCH 0/5] Fixes for LP:1798208

Joseph Salisbury-3
BugLink: https://bugs.launchpad.net/bugs/1798208

== SRU Justification ==
Microsemi is requesting these five patches to be added to 18.04.2 to bring
the driver up to date with kernel.org and to correct issues seen
particularly on ARM systems.  The 18.04.2 kernel will be 4.18 bases, so
this SRU request is for Cosmic.

All five of these commits cherry pick cleanly and are in mainline as of
v4.19-rc1.

== Fixes ==
957c5ab108c7 ("scsi: smartpqi: improve handling for sync requests")
26b390aba2a8 ("scsi: smartpqi: improve error checking for sync requests")
9f8d05fa9844 ("scsi: smartpqi: add inspur advantech ids")
dac12fbc7b0a ("scsi: smartpqi: fix critical ARM issue reading PQI index registers")
4ae5e9d159f8 ("scsi: smartpqi: bump driver version to 1.1.4-130")

== Regression Potential ==
Low.  These five patches are limited to scsi/smartpqi.

Don Brace (1):
  scsi: smartpqi: bump driver version to 1.1.4-130

Kevin Barnett (4):
  scsi: smartpqi: improve handling for sync requests
  scsi: smartpqi: improve error checking for sync requests
  scsi: smartpqi: add inspur advantech ids
  scsi: smartpqi: fix critical ARM issue reading PQI index registers

 drivers/scsi/smartpqi/smartpqi.h      |  12 +--
 drivers/scsi/smartpqi/smartpqi_init.c | 160 +++++++++++++++++++++-------------
 2 files changed, 104 insertions(+), 68 deletions(-)

--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU][Cosmic][PATCH 1/5] scsi: smartpqi: improve handling for sync requests

Joseph Salisbury-3
From: Kevin Barnett <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1798208

Decrement the active thread count after the synchronous request was
submitted to the controller but before the driver blocks to wait for the
request to complete.

Reviewed-by: Scott Benesh <[hidden email]>
Reviewed-by: Scott Teel <[hidden email]>
Signed-off-by: Kevin Barnett <[hidden email]>
Signed-off-by: Don Brace <[hidden email]>
Signed-off-by: Martin K. Petersen <[hidden email]>
(cherry picked from commit 957c5ab108c7d98369b7524daea532c0ebbcf845)
Signed-off-by: Joseph Salisbury <[hidden email]>
---
 drivers/scsi/smartpqi/smartpqi_init.c | 55 +++++++++++++++--------------------
 1 file changed, 23 insertions(+), 32 deletions(-)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index b78d20b..4036f65 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -3621,43 +3621,16 @@ static void pqi_raid_synchronous_complete(struct pqi_io_request *io_request,
  complete(waiting);
 }
 
-static int pqi_submit_raid_request_synchronous_with_io_request(
- struct pqi_ctrl_info *ctrl_info, struct pqi_io_request *io_request,
- unsigned long timeout_msecs)
-{
- int rc = 0;
- DECLARE_COMPLETION_ONSTACK(wait);
-
- io_request->io_complete_callback = pqi_raid_synchronous_complete;
- io_request->context = &wait;
-
- pqi_start_io(ctrl_info,
- &ctrl_info->queue_groups[PQI_DEFAULT_QUEUE_GROUP], RAID_PATH,
- io_request);
-
- if (timeout_msecs == NO_TIMEOUT) {
- pqi_wait_for_completion_io(ctrl_info, &wait);
- } else {
- if (!wait_for_completion_io_timeout(&wait,
- msecs_to_jiffies(timeout_msecs))) {
- dev_warn(&ctrl_info->pci_dev->dev,
- "command timed out\n");
- rc = -ETIMEDOUT;
- }
- }
-
- return rc;
-}
-
 static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info,
  struct pqi_iu_header *request, unsigned int flags,
  struct pqi_raid_error_info *error_info, unsigned long timeout_msecs)
 {
- int rc;
+ int rc = 0;
  struct pqi_io_request *io_request;
  unsigned long start_jiffies;
  unsigned long msecs_blocked;
  size_t iu_length;
+ DECLARE_COMPLETION_ONSTACK(wait);
 
  /*
  * Note that specifying PQI_SYNC_FLAGS_INTERRUPTABLE and a timeout value
@@ -3686,11 +3659,13 @@ static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info,
  pqi_ctrl_busy(ctrl_info);
  timeout_msecs = pqi_wait_if_ctrl_blocked(ctrl_info, timeout_msecs);
  if (timeout_msecs == 0) {
+ pqi_ctrl_unbusy(ctrl_info);
  rc = -ETIMEDOUT;
  goto out;
  }
 
  if (pqi_ctrl_offline(ctrl_info)) {
+ pqi_ctrl_unbusy(ctrl_info);
  rc = -ENXIO;
  goto out;
  }
@@ -3708,8 +3683,25 @@ static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info,
  PQI_REQUEST_HEADER_LENGTH;
  memcpy(io_request->iu, request, iu_length);
 
- rc = pqi_submit_raid_request_synchronous_with_io_request(ctrl_info,
- io_request, timeout_msecs);
+ io_request->io_complete_callback = pqi_raid_synchronous_complete;
+ io_request->context = &wait;
+
+ pqi_start_io(ctrl_info,
+ &ctrl_info->queue_groups[PQI_DEFAULT_QUEUE_GROUP], RAID_PATH,
+ io_request);
+
+ pqi_ctrl_unbusy(ctrl_info);
+
+ if (timeout_msecs == NO_TIMEOUT) {
+ pqi_wait_for_completion_io(ctrl_info, &wait);
+ } else {
+ if (!wait_for_completion_io_timeout(&wait,
+ msecs_to_jiffies(timeout_msecs))) {
+ dev_warn(&ctrl_info->pci_dev->dev,
+ "command timed out\n");
+ rc = -ETIMEDOUT;
+ }
+ }
 
  if (error_info) {
  if (io_request->error_info)
@@ -3736,7 +3728,6 @@ static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info,
  pqi_free_io_request(io_request);
 
 out:
- pqi_ctrl_unbusy(ctrl_info);
  up(&ctrl_info->sync_request_sem);
 
  return rc;
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU][Cosmic][PATCH 2/5] scsi: smartpqi: improve error checking for sync requests

Joseph Salisbury-3
In reply to this post by Joseph Salisbury-3
From: Kevin Barnett <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1798208

Detect rare error cases for synchronous requests down the RAID path.

Also retry INQUIRY of VPD page 0 sent to an HBA drive if the command failed
due to an abort.

Reviewed-by: Scott Benesh <[hidden email]>
Reviewed-by: Scott Teel <[hidden email]>
Signed-off-by: Kevin Barnett <[hidden email]>
Signed-off-by: Don Brace <[hidden email]>
Signed-off-by: Martin K. Petersen <[hidden email]>
(cherry picked from commit 26b390aba2a8f7b9dd5ce4e3ada9431de327da6d)
Signed-off-by: Joseph Salisbury <[hidden email]>
---
 drivers/scsi/smartpqi/smartpqi.h      |  2 ++
 drivers/scsi/smartpqi/smartpqi_init.c | 54 ++++++++++++++++++++++++-----------
 2 files changed, 40 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/smartpqi/smartpqi.h b/drivers/scsi/smartpqi/smartpqi.h
index dc3a054..a8e7c4d 100644
--- a/drivers/scsi/smartpqi/smartpqi.h
+++ b/drivers/scsi/smartpqi/smartpqi.h
@@ -483,6 +483,8 @@ struct pqi_raid_error_info {
 #define CISS_CMD_STATUS_TMF 0xd
 #define CISS_CMD_STATUS_AIO_DISABLED 0xe
 
+#define PQI_CMD_STATUS_ABORTED CISS_CMD_STATUS_ABORTED
+
 #define PQI_NUM_EVENT_QUEUE_ELEMENTS 32
 #define PQI_EVENT_OQ_ELEMENT_LENGTH sizeof(struct pqi_event_response)
 
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 4036f65..1593ee3 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -1197,20 +1197,30 @@ static void pqi_get_volume_status(struct pqi_ctrl_info *ctrl_info,
  device->volume_offline = volume_offline;
 }
 
+#define PQI_INQUIRY_PAGE0_RETRIES 3
+
 static int pqi_get_device_info(struct pqi_ctrl_info *ctrl_info,
  struct pqi_scsi_dev *device)
 {
  int rc;
  u8 *buffer;
+ unsigned int retries;
 
  buffer = kmalloc(64, GFP_KERNEL);
  if (!buffer)
  return -ENOMEM;
 
  /* Send an inquiry to the device to see what it is. */
- rc = pqi_scsi_inquiry(ctrl_info, device->scsi3addr, 0, buffer, 64);
- if (rc)
- goto out;
+ for (retries = 0;;) {
+ rc = pqi_scsi_inquiry(ctrl_info, device->scsi3addr, 0,
+ buffer, 64);
+ if (rc == 0)
+ break;
+ if (pqi_is_logical_device(device) ||
+ rc != PQI_CMD_STATUS_ABORTED ||
+ ++retries > PQI_INQUIRY_PAGE0_RETRIES)
+ goto out;
+ }
 
  scsi_sanitize_inquiry_string(&buffer[8], 8);
  scsi_sanitize_inquiry_string(&buffer[16], 16);
@@ -3621,6 +3631,29 @@ static void pqi_raid_synchronous_complete(struct pqi_io_request *io_request,
  complete(waiting);
 }
 
+static int pqi_process_raid_io_error_synchronous(struct pqi_raid_error_info
+ *error_info)
+{
+ int rc = -EIO;
+
+ switch (error_info->data_out_result) {
+ case PQI_DATA_IN_OUT_GOOD:
+ if (error_info->status == SAM_STAT_GOOD)
+ rc = 0;
+ break;
+ case PQI_DATA_IN_OUT_UNDERFLOW:
+ if (error_info->status == SAM_STAT_GOOD ||
+ error_info->status == SAM_STAT_CHECK_CONDITION)
+ rc = 0;
+ break;
+ case PQI_DATA_IN_OUT_ABORTED:
+ rc = PQI_CMD_STATUS_ABORTED;
+ break;
+ }
+
+ return rc;
+}
+
 static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info,
  struct pqi_iu_header *request, unsigned int flags,
  struct pqi_raid_error_info *error_info, unsigned long timeout_msecs)
@@ -3710,19 +3743,8 @@ static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info,
  else
  memset(error_info, 0, sizeof(*error_info));
  } else if (rc == 0 && io_request->error_info) {
- u8 scsi_status;
- struct pqi_raid_error_info *raid_error_info;
-
- raid_error_info = io_request->error_info;
- scsi_status = raid_error_info->status;
-
- if (scsi_status == SAM_STAT_CHECK_CONDITION &&
- raid_error_info->data_out_result ==
- PQI_DATA_IN_OUT_UNDERFLOW)
- scsi_status = SAM_STAT_GOOD;
-
- if (scsi_status != SAM_STAT_GOOD)
- rc = -EIO;
+ rc = pqi_process_raid_io_error_synchronous(
+ io_request->error_info);
  }
 
  pqi_free_io_request(io_request);
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU][Cosmic][PATCH 3/5] scsi: smartpqi: add inspur advantech ids

Joseph Salisbury-3
In reply to this post by Joseph Salisbury-3
From: Kevin Barnett <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1798208

Add support for these new device IDs:

  Advantech MIC-8312BridgeB
  INSPUR PM8204-2GB
  INSPUR PM8204-4GB
  INSPUR PM8222-SHBA

Reviewed-by: Scott Benesh <[hidden email]>
Signed-off-by: Kevin Barnett <[hidden email]>
Signed-off-by: Don Brace <[hidden email]>
Signed-off-by: Martin K. Petersen <[hidden email]>
(cherry picked from commit 9f8d05fa98442de78d1ab30235b0cc656ed7aff0)
Signed-off-by: Joseph Salisbury <[hidden email]>
---
 drivers/scsi/smartpqi/smartpqi_init.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 1593ee3..8b70b87 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -6839,6 +6839,18 @@ static const struct pci_device_id pqi_pci_id_table[] = {
  },
  {
  PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+       0x1bd4, 0x004a)
+ },
+ {
+ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+       0x1bd4, 0x004b)
+ },
+ {
+ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+       0x1bd4, 0x004c)
+ },
+ {
+ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
        PCI_VENDOR_ID_ADAPTEC2, 0x0110)
  },
  {
@@ -6963,6 +6975,10 @@ static const struct pci_device_id pqi_pci_id_table[] = {
  },
  {
  PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+       PCI_VENDOR_ID_ADVANTECH, 0x8312)
+ },
+ {
+ PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
        PCI_VENDOR_ID_DELL, 0x1fe0)
  },
  {
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH 4/5] scsi: smartpqi: fix critical ARM issue reading PQI index registers

Joseph Salisbury-3
In reply to this post by Joseph Salisbury-3
From: Kevin Barnett <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1798208

Use the readl() kernel function to read all index registers. For ARM
systems, this function includes a read memory barrier that eliminates ci/pi
corruption.

Reviewed-by: Scott Benesh <[hidden email]>
Reviewed-by: Scott Teel <[hidden email]>
Tested-by: Shunyong Yang <[hidden email]>
Signed-off-by: Kevin Barnett <[hidden email]>
Signed-off-by: Don Brace <[hidden email]>
Signed-off-by: Martin K. Petersen <[hidden email]>
(cherry picked from commit dac12fbc7b0a433a160b89212a56e155c94f3a80)
Signed-off-by: Joseph Salisbury <[hidden email]>
---
 drivers/scsi/smartpqi/smartpqi.h      | 10 ++++----
 drivers/scsi/smartpqi/smartpqi_init.c | 45 +++++++++++++++++++----------------
 2 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/drivers/scsi/smartpqi/smartpqi.h b/drivers/scsi/smartpqi/smartpqi.h
index a8e7c4d..e97bf26 100644
--- a/drivers/scsi/smartpqi/smartpqi.h
+++ b/drivers/scsi/smartpqi/smartpqi.h
@@ -583,8 +583,8 @@ struct pqi_admin_queues_aligned {
 struct pqi_admin_queues {
  void *iq_element_array;
  void *oq_element_array;
- volatile pqi_index_t *iq_ci;
- volatile pqi_index_t *oq_pi;
+ pqi_index_t *iq_ci;
+ pqi_index_t __iomem *oq_pi;
  dma_addr_t iq_element_array_bus_addr;
  dma_addr_t oq_element_array_bus_addr;
  dma_addr_t iq_ci_bus_addr;
@@ -608,8 +608,8 @@ struct pqi_queue_group {
  dma_addr_t oq_element_array_bus_addr;
  __le32 __iomem *iq_pi[2];
  pqi_index_t iq_pi_copy[2];
- volatile pqi_index_t *iq_ci[2];
- volatile pqi_index_t *oq_pi;
+ pqi_index_t __iomem *iq_ci[2];
+ pqi_index_t __iomem *oq_pi;
  dma_addr_t iq_ci_bus_addr[2];
  dma_addr_t oq_pi_bus_addr;
  __le32 __iomem *oq_ci;
@@ -622,7 +622,7 @@ struct pqi_event_queue {
  u16 oq_id;
  u16 int_msg_num;
  void *oq_element_array;
- volatile pqi_index_t *oq_pi;
+ pqi_index_t __iomem *oq_pi;
  dma_addr_t oq_element_array_bus_addr;
  dma_addr_t oq_pi_bus_addr;
  __le32 __iomem *oq_ci;
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 8b70b87..b4a685e 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -2703,7 +2703,7 @@ static unsigned int pqi_process_io_intr(struct pqi_ctrl_info *ctrl_info,
  oq_ci = queue_group->oq_ci_copy;
 
  while (1) {
- oq_pi = *queue_group->oq_pi;
+ oq_pi = readl(queue_group->oq_pi);
  if (oq_pi == oq_ci)
  break;
 
@@ -2794,7 +2794,7 @@ static void pqi_send_event_ack(struct pqi_ctrl_info *ctrl_info,
  spin_lock_irqsave(&queue_group->submit_lock[RAID_PATH], flags);
 
  iq_pi = queue_group->iq_pi_copy[RAID_PATH];
- iq_ci = *queue_group->iq_ci[RAID_PATH];
+ iq_ci = readl(queue_group->iq_ci[RAID_PATH]);
 
  if (pqi_num_elements_free(iq_pi, iq_ci,
  ctrl_info->num_elements_per_iq))
@@ -2953,7 +2953,7 @@ static unsigned int pqi_process_event_intr(struct pqi_ctrl_info *ctrl_info)
  oq_ci = event_queue->oq_ci_copy;
 
  while (1) {
- oq_pi = *event_queue->oq_pi;
+ oq_pi = readl(event_queue->oq_pi);
  if (oq_pi == oq_ci)
  break;
 
@@ -3177,7 +3177,7 @@ static int pqi_alloc_operational_queues(struct pqi_ctrl_info *ctrl_info)
  size_t element_array_length_per_iq;
  size_t element_array_length_per_oq;
  void *element_array;
- void *next_queue_index;
+ void __iomem *next_queue_index;
  void *aligned_pointer;
  unsigned int num_inbound_queues;
  unsigned int num_outbound_queues;
@@ -3273,7 +3273,7 @@ static int pqi_alloc_operational_queues(struct pqi_ctrl_info *ctrl_info)
  element_array += PQI_NUM_EVENT_QUEUE_ELEMENTS *
  PQI_EVENT_OQ_ELEMENT_LENGTH;
 
- next_queue_index = PTR_ALIGN(element_array,
+ next_queue_index = (void __iomem *)PTR_ALIGN(element_array,
  PQI_OPERATIONAL_INDEX_ALIGNMENT);
 
  for (i = 0; i < ctrl_info->num_queue_groups; i++) {
@@ -3281,21 +3281,24 @@ static int pqi_alloc_operational_queues(struct pqi_ctrl_info *ctrl_info)
  queue_group->iq_ci[RAID_PATH] = next_queue_index;
  queue_group->iq_ci_bus_addr[RAID_PATH] =
  ctrl_info->queue_memory_base_dma_handle +
- (next_queue_index - ctrl_info->queue_memory_base);
+ (next_queue_index -
+ (void __iomem *)ctrl_info->queue_memory_base);
  next_queue_index += sizeof(pqi_index_t);
  next_queue_index = PTR_ALIGN(next_queue_index,
  PQI_OPERATIONAL_INDEX_ALIGNMENT);
  queue_group->iq_ci[AIO_PATH] = next_queue_index;
  queue_group->iq_ci_bus_addr[AIO_PATH] =
  ctrl_info->queue_memory_base_dma_handle +
- (next_queue_index - ctrl_info->queue_memory_base);
+ (next_queue_index -
+ (void __iomem *)ctrl_info->queue_memory_base);
  next_queue_index += sizeof(pqi_index_t);
  next_queue_index = PTR_ALIGN(next_queue_index,
  PQI_OPERATIONAL_INDEX_ALIGNMENT);
  queue_group->oq_pi = next_queue_index;
  queue_group->oq_pi_bus_addr =
  ctrl_info->queue_memory_base_dma_handle +
- (next_queue_index - ctrl_info->queue_memory_base);
+ (next_queue_index -
+ (void __iomem *)ctrl_info->queue_memory_base);
  next_queue_index += sizeof(pqi_index_t);
  next_queue_index = PTR_ALIGN(next_queue_index,
  PQI_OPERATIONAL_INDEX_ALIGNMENT);
@@ -3304,7 +3307,8 @@ static int pqi_alloc_operational_queues(struct pqi_ctrl_info *ctrl_info)
  ctrl_info->event_queue.oq_pi = next_queue_index;
  ctrl_info->event_queue.oq_pi_bus_addr =
  ctrl_info->queue_memory_base_dma_handle +
- (next_queue_index - ctrl_info->queue_memory_base);
+ (next_queue_index -
+ (void __iomem *)ctrl_info->queue_memory_base);
 
  return 0;
 }
@@ -3378,7 +3382,8 @@ static int pqi_alloc_admin_queues(struct pqi_ctrl_info *ctrl_info)
  admin_queues->oq_element_array =
  &admin_queues_aligned->oq_element_array;
  admin_queues->iq_ci = &admin_queues_aligned->iq_ci;
- admin_queues->oq_pi = &admin_queues_aligned->oq_pi;
+ admin_queues->oq_pi =
+ (pqi_index_t __iomem *)&admin_queues_aligned->oq_pi;
 
  admin_queues->iq_element_array_bus_addr =
  ctrl_info->admin_queue_memory_base_dma_handle +
@@ -3394,8 +3399,8 @@ static int pqi_alloc_admin_queues(struct pqi_ctrl_info *ctrl_info)
  ctrl_info->admin_queue_memory_base);
  admin_queues->oq_pi_bus_addr =
  ctrl_info->admin_queue_memory_base_dma_handle +
- ((void *)admin_queues->oq_pi -
- ctrl_info->admin_queue_memory_base);
+ ((void __iomem *)admin_queues->oq_pi -
+ (void __iomem *)ctrl_info->admin_queue_memory_base);
 
  return 0;
 }
@@ -3496,7 +3501,7 @@ static int pqi_poll_for_admin_response(struct pqi_ctrl_info *ctrl_info,
  timeout = (PQI_ADMIN_REQUEST_TIMEOUT_SECS * HZ) + jiffies;
 
  while (1) {
- oq_pi = *admin_queues->oq_pi;
+ oq_pi = readl(admin_queues->oq_pi);
  if (oq_pi != oq_ci)
  break;
  if (time_after(jiffies, timeout)) {
@@ -3555,7 +3560,7 @@ static void pqi_start_io(struct pqi_ctrl_info *ctrl_info,
  DIV_ROUND_UP(iu_length,
  PQI_OPERATIONAL_IQ_ELEMENT_LENGTH);
 
- iq_ci = *queue_group->iq_ci[path];
+ iq_ci = readl(queue_group->iq_ci[path]);
 
  if (num_elements_needed > pqi_num_elements_free(iq_pi, iq_ci,
  ctrl_info->num_elements_per_iq))
@@ -5054,7 +5059,7 @@ static int pqi_wait_until_inbound_queues_empty(struct pqi_ctrl_info *ctrl_info)
  iq_pi = queue_group->iq_pi_copy[path];
 
  while (1) {
- iq_ci = *queue_group->iq_ci[path];
+ iq_ci = readl(queue_group->iq_ci[path]);
  if (iq_ci == iq_pi)
  break;
  pqi_check_ctrl_health(ctrl_info);
@@ -6243,20 +6248,20 @@ static void pqi_reinit_queues(struct pqi_ctrl_info *ctrl_info)
  admin_queues = &ctrl_info->admin_queues;
  admin_queues->iq_pi_copy = 0;
  admin_queues->oq_ci_copy = 0;
- *admin_queues->oq_pi = 0;
+ writel(0, admin_queues->oq_pi);
 
  for (i = 0; i < ctrl_info->num_queue_groups; i++) {
  ctrl_info->queue_groups[i].iq_pi_copy[RAID_PATH] = 0;
  ctrl_info->queue_groups[i].iq_pi_copy[AIO_PATH] = 0;
  ctrl_info->queue_groups[i].oq_ci_copy = 0;
 
- *ctrl_info->queue_groups[i].iq_ci[RAID_PATH] = 0;
- *ctrl_info->queue_groups[i].iq_ci[AIO_PATH] = 0;
- *ctrl_info->queue_groups[i].oq_pi = 0;
+ writel(0, ctrl_info->queue_groups[i].iq_ci[RAID_PATH]);
+ writel(0, ctrl_info->queue_groups[i].iq_ci[AIO_PATH]);
+ writel(0, ctrl_info->queue_groups[i].oq_pi);
  }
 
  event_queue = &ctrl_info->event_queue;
- *event_queue->oq_pi = 0;
+ writel(0, event_queue->oq_pi);
  event_queue->oq_ci_copy = 0;
 }
 
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU][Cosmic][PATCH 5/5] scsi: smartpqi: bump driver version to 1.1.4-130

Joseph Salisbury-3
In reply to this post by Joseph Salisbury-3
From: Don Brace <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1798208

Reviewed-by: Scott Benesh <[hidden email]>
Signed-off-by: Kevin Barnett <[hidden email]>
Signed-off-by: Don Brace <[hidden email]>
Signed-off-by: Martin K. Petersen <[hidden email]>
(cherry picked from commit 4ae5e9d159f83392c98c4ed88dfc63f19745be38)
Signed-off-by: Joseph Salisbury <[hidden email]>
---
 drivers/scsi/smartpqi/smartpqi_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index b4a685e..2112ea6 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -40,11 +40,11 @@
 #define BUILD_TIMESTAMP
 #endif
 
-#define DRIVER_VERSION "1.1.4-115"
+#define DRIVER_VERSION "1.1.4-130"
 #define DRIVER_MAJOR 1
 #define DRIVER_MINOR 1
 #define DRIVER_RELEASE 4
-#define DRIVER_REVISION 115
+#define DRIVER_REVISION 130
 
 #define DRIVER_NAME "Microsemi PQI Driver (v" \
  DRIVER_VERSION BUILD_TIMESTAMP ")"
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 4/5] scsi: smartpqi: fix critical ARM issue reading PQI index registers

Joseph Salisbury-3
In reply to this post by Joseph Salisbury-3
On 11/1/18 5:58 PM, Joseph Salisbury wrote:

> From: Kevin Barnett <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/bugs/1798208
>
> Use the readl() kernel function to read all index registers. For ARM
> systems, this function includes a read memory barrier that eliminates ci/pi
> corruption.
>
> Reviewed-by: Scott Benesh <[hidden email]>
> Reviewed-by: Scott Teel <[hidden email]>
> Tested-by: Shunyong Yang <[hidden email]>
> Signed-off-by: Kevin Barnett <[hidden email]>
> Signed-off-by: Don Brace <[hidden email]>
> Signed-off-by: Martin K. Petersen <[hidden email]>
> (cherry picked from commit dac12fbc7b0a433a160b89212a56e155c94f3a80)
> Signed-off-by: Joseph Salisbury <[hidden email]>
> ---
>  drivers/scsi/smartpqi/smartpqi.h      | 10 ++++----
>  drivers/scsi/smartpqi/smartpqi_init.c | 45 +++++++++++++++++++----------------
>  2 files changed, 30 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/scsi/smartpqi/smartpqi.h b/drivers/scsi/smartpqi/smartpqi.h
> index a8e7c4d..e97bf26 100644
> --- a/drivers/scsi/smartpqi/smartpqi.h
> +++ b/drivers/scsi/smartpqi/smartpqi.h
> @@ -583,8 +583,8 @@ struct pqi_admin_queues_aligned {
>  struct pqi_admin_queues {
>   void *iq_element_array;
>   void *oq_element_array;
> - volatile pqi_index_t *iq_ci;
> - volatile pqi_index_t *oq_pi;
> + pqi_index_t *iq_ci;
> + pqi_index_t __iomem *oq_pi;
>   dma_addr_t iq_element_array_bus_addr;
>   dma_addr_t oq_element_array_bus_addr;
>   dma_addr_t iq_ci_bus_addr;
> @@ -608,8 +608,8 @@ struct pqi_queue_group {
>   dma_addr_t oq_element_array_bus_addr;
>   __le32 __iomem *iq_pi[2];
>   pqi_index_t iq_pi_copy[2];
> - volatile pqi_index_t *iq_ci[2];
> - volatile pqi_index_t *oq_pi;
> + pqi_index_t __iomem *iq_ci[2];
> + pqi_index_t __iomem *oq_pi;
>   dma_addr_t iq_ci_bus_addr[2];
>   dma_addr_t oq_pi_bus_addr;
>   __le32 __iomem *oq_ci;
> @@ -622,7 +622,7 @@ struct pqi_event_queue {
>   u16 oq_id;
>   u16 int_msg_num;
>   void *oq_element_array;
> - volatile pqi_index_t *oq_pi;
> + pqi_index_t __iomem *oq_pi;
>   dma_addr_t oq_element_array_bus_addr;
>   dma_addr_t oq_pi_bus_addr;
>   __le32 __iomem *oq_ci;
> diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
> index 8b70b87..b4a685e 100644
> --- a/drivers/scsi/smartpqi/smartpqi_init.c
> +++ b/drivers/scsi/smartpqi/smartpqi_init.c
> @@ -2703,7 +2703,7 @@ static unsigned int pqi_process_io_intr(struct pqi_ctrl_info *ctrl_info,
>   oq_ci = queue_group->oq_ci_copy;
>  
>   while (1) {
> - oq_pi = *queue_group->oq_pi;
> + oq_pi = readl(queue_group->oq_pi);
>   if (oq_pi == oq_ci)
>   break;
>  
> @@ -2794,7 +2794,7 @@ static void pqi_send_event_ack(struct pqi_ctrl_info *ctrl_info,
>   spin_lock_irqsave(&queue_group->submit_lock[RAID_PATH], flags);
>  
>   iq_pi = queue_group->iq_pi_copy[RAID_PATH];
> - iq_ci = *queue_group->iq_ci[RAID_PATH];
> + iq_ci = readl(queue_group->iq_ci[RAID_PATH]);
>  
>   if (pqi_num_elements_free(iq_pi, iq_ci,
>   ctrl_info->num_elements_per_iq))
> @@ -2953,7 +2953,7 @@ static unsigned int pqi_process_event_intr(struct pqi_ctrl_info *ctrl_info)
>   oq_ci = event_queue->oq_ci_copy;
>  
>   while (1) {
> - oq_pi = *event_queue->oq_pi;
> + oq_pi = readl(event_queue->oq_pi);
>   if (oq_pi == oq_ci)
>   break;
>  
> @@ -3177,7 +3177,7 @@ static int pqi_alloc_operational_queues(struct pqi_ctrl_info *ctrl_info)
>   size_t element_array_length_per_iq;
>   size_t element_array_length_per_oq;
>   void *element_array;
> - void *next_queue_index;
> + void __iomem *next_queue_index;
>   void *aligned_pointer;
>   unsigned int num_inbound_queues;
>   unsigned int num_outbound_queues;
> @@ -3273,7 +3273,7 @@ static int pqi_alloc_operational_queues(struct pqi_ctrl_info *ctrl_info)
>   element_array += PQI_NUM_EVENT_QUEUE_ELEMENTS *
>   PQI_EVENT_OQ_ELEMENT_LENGTH;
>  
> - next_queue_index = PTR_ALIGN(element_array,
> + next_queue_index = (void __iomem *)PTR_ALIGN(element_array,
>   PQI_OPERATIONAL_INDEX_ALIGNMENT);
>  
>   for (i = 0; i < ctrl_info->num_queue_groups; i++) {
> @@ -3281,21 +3281,24 @@ static int pqi_alloc_operational_queues(struct pqi_ctrl_info *ctrl_info)
>   queue_group->iq_ci[RAID_PATH] = next_queue_index;
>   queue_group->iq_ci_bus_addr[RAID_PATH] =
>   ctrl_info->queue_memory_base_dma_handle +
> - (next_queue_index - ctrl_info->queue_memory_base);
> + (next_queue_index -
> + (void __iomem *)ctrl_info->queue_memory_base);
>   next_queue_index += sizeof(pqi_index_t);
>   next_queue_index = PTR_ALIGN(next_queue_index,
>   PQI_OPERATIONAL_INDEX_ALIGNMENT);
>   queue_group->iq_ci[AIO_PATH] = next_queue_index;
>   queue_group->iq_ci_bus_addr[AIO_PATH] =
>   ctrl_info->queue_memory_base_dma_handle +
> - (next_queue_index - ctrl_info->queue_memory_base);
> + (next_queue_index -
> + (void __iomem *)ctrl_info->queue_memory_base);
>   next_queue_index += sizeof(pqi_index_t);
>   next_queue_index = PTR_ALIGN(next_queue_index,
>   PQI_OPERATIONAL_INDEX_ALIGNMENT);
>   queue_group->oq_pi = next_queue_index;
>   queue_group->oq_pi_bus_addr =
>   ctrl_info->queue_memory_base_dma_handle +
> - (next_queue_index - ctrl_info->queue_memory_base);
> + (next_queue_index -
> + (void __iomem *)ctrl_info->queue_memory_base);
>   next_queue_index += sizeof(pqi_index_t);
>   next_queue_index = PTR_ALIGN(next_queue_index,
>   PQI_OPERATIONAL_INDEX_ALIGNMENT);
> @@ -3304,7 +3307,8 @@ static int pqi_alloc_operational_queues(struct pqi_ctrl_info *ctrl_info)
>   ctrl_info->event_queue.oq_pi = next_queue_index;
>   ctrl_info->event_queue.oq_pi_bus_addr =
>   ctrl_info->queue_memory_base_dma_handle +
> - (next_queue_index - ctrl_info->queue_memory_base);
> + (next_queue_index -
> + (void __iomem *)ctrl_info->queue_memory_base);
>  
>   return 0;
>  }
> @@ -3378,7 +3382,8 @@ static int pqi_alloc_admin_queues(struct pqi_ctrl_info *ctrl_info)
>   admin_queues->oq_element_array =
>   &admin_queues_aligned->oq_element_array;
>   admin_queues->iq_ci = &admin_queues_aligned->iq_ci;
> - admin_queues->oq_pi = &admin_queues_aligned->oq_pi;
> + admin_queues->oq_pi =
> + (pqi_index_t __iomem *)&admin_queues_aligned->oq_pi;
>  
>   admin_queues->iq_element_array_bus_addr =
>   ctrl_info->admin_queue_memory_base_dma_handle +
> @@ -3394,8 +3399,8 @@ static int pqi_alloc_admin_queues(struct pqi_ctrl_info *ctrl_info)
>   ctrl_info->admin_queue_memory_base);
>   admin_queues->oq_pi_bus_addr =
>   ctrl_info->admin_queue_memory_base_dma_handle +
> - ((void *)admin_queues->oq_pi -
> - ctrl_info->admin_queue_memory_base);
> + ((void __iomem *)admin_queues->oq_pi -
> + (void __iomem *)ctrl_info->admin_queue_memory_base);
>  
>   return 0;
>  }
> @@ -3496,7 +3501,7 @@ static int pqi_poll_for_admin_response(struct pqi_ctrl_info *ctrl_info,
>   timeout = (PQI_ADMIN_REQUEST_TIMEOUT_SECS * HZ) + jiffies;
>  
>   while (1) {
> - oq_pi = *admin_queues->oq_pi;
> + oq_pi = readl(admin_queues->oq_pi);
>   if (oq_pi != oq_ci)
>   break;
>   if (time_after(jiffies, timeout)) {
> @@ -3555,7 +3560,7 @@ static void pqi_start_io(struct pqi_ctrl_info *ctrl_info,
>   DIV_ROUND_UP(iu_length,
>   PQI_OPERATIONAL_IQ_ELEMENT_LENGTH);
>  
> - iq_ci = *queue_group->iq_ci[path];
> + iq_ci = readl(queue_group->iq_ci[path]);
>  
>   if (num_elements_needed > pqi_num_elements_free(iq_pi, iq_ci,
>   ctrl_info->num_elements_per_iq))
> @@ -5054,7 +5059,7 @@ static int pqi_wait_until_inbound_queues_empty(struct pqi_ctrl_info *ctrl_info)
>   iq_pi = queue_group->iq_pi_copy[path];
>  
>   while (1) {
> - iq_ci = *queue_group->iq_ci[path];
> + iq_ci = readl(queue_group->iq_ci[path]);
>   if (iq_ci == iq_pi)
>   break;
>   pqi_check_ctrl_health(ctrl_info);
> @@ -6243,20 +6248,20 @@ static void pqi_reinit_queues(struct pqi_ctrl_info *ctrl_info)
>   admin_queues = &ctrl_info->admin_queues;
>   admin_queues->iq_pi_copy = 0;
>   admin_queues->oq_ci_copy = 0;
> - *admin_queues->oq_pi = 0;
> + writel(0, admin_queues->oq_pi);
>  
>   for (i = 0; i < ctrl_info->num_queue_groups; i++) {
>   ctrl_info->queue_groups[i].iq_pi_copy[RAID_PATH] = 0;
>   ctrl_info->queue_groups[i].iq_pi_copy[AIO_PATH] = 0;
>   ctrl_info->queue_groups[i].oq_ci_copy = 0;
>  
> - *ctrl_info->queue_groups[i].iq_ci[RAID_PATH] = 0;
> - *ctrl_info->queue_groups[i].iq_ci[AIO_PATH] = 0;
> - *ctrl_info->queue_groups[i].oq_pi = 0;
> + writel(0, ctrl_info->queue_groups[i].iq_ci[RAID_PATH]);
> + writel(0, ctrl_info->queue_groups[i].iq_ci[AIO_PATH]);
> + writel(0, ctrl_info->queue_groups[i].oq_pi);
>   }
>  
>   event_queue = &ctrl_info->event_queue;
> - *event_queue->oq_pi = 0;
> + writel(0, event_queue->oq_pi);
>   event_queue->oq_ci_copy = 0;
>  }
>  

The subject should also contain the test [SRU][Cosmic], like the other
four patches.


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [SRU][Cosmic][PATCH 0/5] Fixes for LP:1798208

Thadeu Lima de Souza Cascardo-3
In reply to this post by Joseph Salisbury-3
All patches upstream, restricted to single driver, clean cherry-picks,
resulting matches the driver in 4.19, so okay to update the driver version as
well.

Acked-by: Thadeu Lima de Souza Cascardo <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK/Cmnt: [SRU][Cosmic][PATCH 0/5] Fixes for LP:1798208

Stefan Bader-2
In reply to this post by Joseph Salisbury-3
On 01.11.18 22:58, Joseph Salisbury wrote:

> BugLink: https://bugs.launchpad.net/bugs/1798208
>
> == SRU Justification ==
> Microsemi is requesting these five patches to be added to 18.04.2 to bring
> the driver up to date with kernel.org and to correct issues seen
> particularly on ARM systems.  The 18.04.2 kernel will be 4.18 bases, so
> this SRU request is for Cosmic.
>
> All five of these commits cherry pick cleanly and are in mainline as of
> v4.19-rc1.
>
> == Fixes ==
> 957c5ab108c7 ("scsi: smartpqi: improve handling for sync requests")
> 26b390aba2a8 ("scsi: smartpqi: improve error checking for sync requests")
> 9f8d05fa9844 ("scsi: smartpqi: add inspur advantech ids")
> dac12fbc7b0a ("scsi: smartpqi: fix critical ARM issue reading PQI index registers")
> 4ae5e9d159f8 ("scsi: smartpqi: bump driver version to 1.1.4-130")
>
> == Regression Potential ==
> Low.  These five patches are limited to scsi/smartpqi.
>
> Don Brace (1):
>   scsi: smartpqi: bump driver version to 1.1.4-130
>
> Kevin Barnett (4):
>   scsi: smartpqi: improve handling for sync requests
>   scsi: smartpqi: improve error checking for sync requests
>   scsi: smartpqi: add inspur advantech ids
>   scsi: smartpqi: fix critical ARM issue reading PQI index registers
>
>  drivers/scsi/smartpqi/smartpqi.h      |  12 +--
>  drivers/scsi/smartpqi/smartpqi_init.c | 160 +++++++++++++++++++++-------------
>  2 files changed, 104 insertions(+), 68 deletions(-)
>
From other comments about related changes in the bug report I guess this set
should be applied after upstream stable 4.18.16 (at least) has been applied.
So whoever actually pulls the set in, make sure this has happened. Thanks.

Acked-by: Stefan Bader <[hidden email]>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

APPLIED: [SRU][Cosmic][PATCH 0/5] Fixes for LP:1798208

Stefan Bader-2
In reply to this post by Joseph Salisbury-3
On 01.11.18 22:58, Joseph Salisbury wrote:

> BugLink: https://bugs.launchpad.net/bugs/1798208
>
> == SRU Justification ==
> Microsemi is requesting these five patches to be added to 18.04.2 to bring
> the driver up to date with kernel.org and to correct issues seen
> particularly on ARM systems.  The 18.04.2 kernel will be 4.18 bases, so
> this SRU request is for Cosmic.
>
> All five of these commits cherry pick cleanly and are in mainline as of
> v4.19-rc1.
>
> == Fixes ==
> 957c5ab108c7 ("scsi: smartpqi: improve handling for sync requests")
> 26b390aba2a8 ("scsi: smartpqi: improve error checking for sync requests")
> 9f8d05fa9844 ("scsi: smartpqi: add inspur advantech ids")
> dac12fbc7b0a ("scsi: smartpqi: fix critical ARM issue reading PQI index registers")
> 4ae5e9d159f8 ("scsi: smartpqi: bump driver version to 1.1.4-130")
>
> == Regression Potential ==
> Low.  These five patches are limited to scsi/smartpqi.
>
> Don Brace (1):
>   scsi: smartpqi: bump driver version to 1.1.4-130
>
> Kevin Barnett (4):
>   scsi: smartpqi: improve handling for sync requests
>   scsi: smartpqi: improve error checking for sync requests
>   scsi: smartpqi: add inspur advantech ids
>   scsi: smartpqi: fix critical ARM issue reading PQI index registers
>
>  drivers/scsi/smartpqi/smartpqi.h      |  12 +--
>  drivers/scsi/smartpqi/smartpqi_init.c | 160 +++++++++++++++++++++-------------
>  2 files changed, 104 insertions(+), 68 deletions(-)
>
Applied to cosmic/master-next. Thanks.

-Stefan


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (836 bytes) Download Attachment