All of lore.kernel.org
 help / color / mirror / Atom feed
From: Don Brace <don.brace@microchip.com>
To: <Kevin.Barnett@microchip.com>, <scott.teel@microchip.com>,
	<Justin.Lindley@microchip.com>, <scott.benesh@microchip.com>,
	<gerry.morong@microchip.com>, <mahesh.rajashekhara@microchip.com>,
	<mike.mcgowen@microchip.com>, <murthy.bhat@microchip.com>,
	<kumar.meiyappan@microchip.com>, <hch@infradead.org>,
	<jejb@linux.vnet.ibm.com>, <joseph.szczypek@hpe.com>,
	<POSWALD@suse.com>
Cc: <linux-scsi@vger.kernel.org>
Subject: [PATCH V2 04/16] smartpqi: close write read holes
Date: Fri, 8 Jul 2022 13:47:05 -0500	[thread overview]
Message-ID: <165730602555.177165.11181012469428348394.stgit@brunhilda> (raw)
In-Reply-To: <165730597930.177165.11663580730429681919.stgit@brunhilda>

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

Insert a minimum 1 millisecond delay after writing to a register before
reading from it.

SIS and PQI registers that can be both written to and read from can
return stale data if read from too soon after having been written to.

There is no read/write ordering or hazard detection on the inbound path
to the MSGU from the PCIe bus, therefore reads could pass writes.

Reviewed-by: Scott Teel <scott.teel@microchip.com>
Co-developed-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microchip.com>
Co-developed-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
 drivers/scsi/smartpqi/smartpqi_sis.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/smartpqi/smartpqi_sis.c b/drivers/scsi/smartpqi/smartpqi_sis.c
index afc27adf68e9..2b99b6e9cd71 100644
--- a/drivers/scsi/smartpqi/smartpqi_sis.c
+++ b/drivers/scsi/smartpqi/smartpqi_sis.c
@@ -194,6 +194,7 @@ static int sis_send_sync_cmd(struct pqi_ctrl_info *ctrl_info,
 
 	/* Disable doorbell interrupts by masking all interrupts. */
 	writel(~0, &registers->sis_interrupt_mask);
+	usleep_range(1000, 2000);
 
 	/*
 	 * Force the completion of the interrupt mask register write before
@@ -383,6 +384,7 @@ static int sis_wait_for_doorbell_bit_to_clear(
 static inline int sis_set_doorbell_bit(struct pqi_ctrl_info *ctrl_info, u32 bit)
 {
 	writel(bit, &ctrl_info->registers->sis_host_to_ctrl_doorbell);
+	usleep_range(1000, 2000);
 
 	return sis_wait_for_doorbell_bit_to_clear(ctrl_info, bit);
 }
@@ -423,6 +425,7 @@ int sis_reenable_sis_mode(struct pqi_ctrl_info *ctrl_info)
 void sis_write_driver_scratch(struct pqi_ctrl_info *ctrl_info, u32 value)
 {
 	writel(value, &ctrl_info->registers->sis_driver_scratch);
+	usleep_range(1000, 2000);
 }
 
 u32 sis_read_driver_scratch(struct pqi_ctrl_info *ctrl_info)


  parent reply	other threads:[~2022-07-08 18:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-08 18:46 [PATCH V2 00/16] smartpqi updates Don Brace
2022-07-08 18:46 ` [PATCH V2 01/16] smartpqi: shorten drive visibility after removal Don Brace
2022-07-08 18:46 ` [PATCH V2 02/16] smartpqi: add controller fw version to console log Don Brace
2022-07-08 18:47 ` [PATCH V2 03/16] smartpqi: add PCI-IDs for ramaxel controllers Don Brace
2022-07-08 18:47 ` Don Brace [this message]
2022-07-08 18:47 ` [PATCH V2 05/16] smartpqi: add driver support for multi-LUN devices Don Brace
2022-07-08 18:47 ` [PATCH V2 06/16] smartpqi: fix PCI control linkdown system hang Don Brace
2022-07-08 18:47 ` [PATCH V2 07/16] smartpqi: add PCI-ID for Adaptec SmartHBA 2100-8i Don Brace
2022-07-08 18:47 ` [PATCH V2 08/16] smartpqi: add PCI-IDs for Lenovo controllers Don Brace
2022-07-08 18:47 ` [PATCH V2 09/16] smartpqi: stop logging spurious PQI reset failures Don Brace
2022-07-08 18:47 ` [PATCH V2 10/16] smartpqi: fix dma direction for RAID requests Don Brace
2022-07-08 18:47 ` [PATCH V2 11/16] smartpqi: fix RAID map race condition Don Brace
2022-07-08 18:47 ` [PATCH V2 12/16] smartpqi: add module param to disable managed ints Don Brace
2022-07-08 18:47 ` [PATCH V2 13/16] smartpqi: update deleting a LUN via sysfs Don Brace
2022-07-08 18:47 ` [PATCH V2 14/16] smartpqi: add ctrl ready timeout module parameter Don Brace
2022-07-08 18:48 ` [PATCH V2 15/16] smartpqi: update copyright to current year Don Brace
2022-07-08 18:48 ` [PATCH V2 16/16] smartpqi: update version to 2.1.18-045 Don Brace
2022-07-14  3:43 ` [PATCH V2 00/16] smartpqi updates Martin K. Petersen
2022-07-19  3:08 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=165730602555.177165.11181012469428348394.stgit@brunhilda \
    --to=don.brace@microchip.com \
    --cc=Justin.Lindley@microchip.com \
    --cc=Kevin.Barnett@microchip.com \
    --cc=POSWALD@suse.com \
    --cc=gerry.morong@microchip.com \
    --cc=hch@infradead.org \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=joseph.szczypek@hpe.com \
    --cc=kumar.meiyappan@microchip.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mahesh.rajashekhara@microchip.com \
    --cc=mike.mcgowen@microchip.com \
    --cc=murthy.bhat@microchip.com \
    --cc=scott.benesh@microchip.com \
    --cc=scott.teel@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.