All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ranjan Kumar <ranjan.kumar@broadcom.com>
To: linux-scsi@vger.kernel.org, martin.petersen@oracle.com
Cc: sathya.prakash@broadcom.com, Ranjan Kumar <ranjan.kumar@broadcom.com>
Subject: [PATCH v1] mpt3sas: Set DMA_BIDIRECTIONAL for additional SCSI commands
Date: Mon, 21 Jul 2025 16:35:46 +0530	[thread overview]
Message-ID: <20250721110546.100355-1-ranjan.kumar@broadcom.com> (raw)

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


             reply	other threads:[~2025-07-21 11:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-21 11:05 Ranjan Kumar [this message]
2025-07-21 11:42 ` [PATCH v1] mpt3sas: Set DMA_BIDIRECTIONAL for additional SCSI commands 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

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=20250721110546.100355-1-ranjan.kumar@broadcom.com \
    --to=ranjan.kumar@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sathya.prakash@broadcom.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.