All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] mpt3sas: Set DMA_BIDIRECTIONAL for additional SCSI commands
@ 2025-07-21 11:05 Ranjan Kumar
  2025-07-21 11:42 ` Johannes Thumshirn
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ranjan Kumar @ 2025-07-21 11:05 UTC (permalink / raw)
  To: linux-scsi, martin.petersen; +Cc: sathya.prakash, Ranjan Kumar

Extend DMA direction override to handle additional SCSI commands
(SECURITY_PROTOCOL_IN, SERVICE_ACTION_IN_16 with RELEASE) that
require bidirectional DMA mapping, in addition to ZBC REPORT_ZONES.
This avoids issues on platforms that perform strict DMA checks.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index bd3efa5b46c7..8aec475fc7a4 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -2686,8 +2686,22 @@ static inline int _base_scsi_dma_map(struct scsi_cmnd *cmd)
 	 * (e.g. AMD hosts). Avoid such issue by making the report zones buffer
 	 * mapping bi-directional.
 	 */
-	if (cmd->cmnd[0] == ZBC_IN && cmd->cmnd[1] == ZI_REPORT_ZONES)
-		cmd->sc_data_direction = DMA_BIDIRECTIONAL;
+
+		switch (cmd->cmnd[0]) {
+		case SECURITY_PROTOCOL_IN:
+			cmd->sc_data_direction = DMA_BIDIRECTIONAL;
+			break;
+		case ZBC_IN:
+			if  (cmd->cmnd[1] == ZI_REPORT_ZONES)
+				cmd->sc_data_direction = DMA_BIDIRECTIONAL;
+			break;
+		case SERVICE_ACTION_IN_16:
+			if (cmd->cmnd[1] == 0x17)
+				cmd->sc_data_direction = DMA_BIDIRECTIONAL;
+			break;
+		default:
+			break;
+	}
 
 	return scsi_dma_map(cmd);
 }
-- 
2.31.1


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

end of thread, other threads:[~2026-01-09 23:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-21 11:05 [PATCH v1] mpt3sas: Set DMA_BIDIRECTIONAL for additional SCSI commands Ranjan Kumar
2025-07-21 11:42 ` Johannes Thumshirn
2025-07-22  5:57 ` Christoph Hellwig
2025-07-22 15:06   ` Sathya Prakash Veerichetty
2025-07-23  6:26     ` Christoph Hellwig
2025-07-31 17:51       ` Sathya Prakash Veerichetty
2025-08-01  1:28 ` Damien Le Moal
2026-01-09 23:44   ` Sathya Prakash Veerichetty

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.