Commit 7dbd0dd8 authored by Sumit Saxena's avatar Sumit Saxena Committed by Martin K. Petersen

scsi: mpi3mr: Add support for NVMe passthrough

Add support for management applications to send an MPI3 Encapsulated NVMe
passthru command to the NVMe devices attached to an Avenger controller.
Since the NVMe drives are exposed as SCSI devices by the controller, the
standard NVMe applications cannot be used to interact with the drives and
the command sets supported are also limited by the controller firmware.
Special handling is required for MPI3 Encapsulated NVMe passthru commands
for PRP/SGL setup in the commands.

Link: https://lore.kernel.org/r/20220429211641.642010-8-sumit.saxena@broadcom.comReviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: default avatarSumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 986d6bad
......@@ -193,6 +193,24 @@ extern atomic64_t event_counter;
*/
#define MPI3MR_MAX_APP_XFER_SECTORS (2048 + 512)
/**
* struct mpi3mr_nvme_pt_sge - Structure to store SGEs for NVMe
* Encapsulated commands.
*
* @base_addr: Physical address
* @length: SGE length
* @rsvd: Reserved
* @rsvd1: Reserved
* @sgl_type: sgl type
*/
struct mpi3mr_nvme_pt_sge {
u64 base_addr;
u32 length;
u16 rsvd;
u8 rsvd1;
u8 sgl_type;
};
/**
* struct mpi3mr_buf_map - local structure to
* track kernel and user buffers associated with an BSG
......@@ -746,6 +764,9 @@ struct scmd_priv {
* @reset_waitq: Controller reset wait queue
* @prepare_for_reset: Prepare for reset event received
* @prepare_for_reset_timeout_counter: Prepare for reset timeout
* @prp_list_virt: NVMe encapsulated PRP list virtual base
* @prp_list_dma: NVMe encapsulated PRP list DMA
* @prp_sz: NVME encapsulated PRP list size
* @diagsave_timeout: Diagnostic information save timeout
* @logging_level: Controller debug logging level
* @flush_io_count: I/O count to flush after reset
......@@ -901,6 +922,10 @@ struct mpi3mr_ioc {
u8 prepare_for_reset;
u16 prepare_for_reset_timeout_counter;
void *prp_list_virt;
dma_addr_t prp_list_dma;
u32 prp_sz;
u16 diagsave_timeout;
int logging_level;
u16 flush_io_count;
......
This diff is collapsed.
......@@ -490,6 +490,14 @@ struct mpi3_nvme_encapsulated_error_reply {
__le32 nvme_completion_entry[4];
};
#define MPI3MR_NVME_PRP_SIZE 8 /* PRP size */
#define MPI3MR_NVME_CMD_PRP1_OFFSET 24 /* PRP1 offset in NVMe cmd */
#define MPI3MR_NVME_CMD_PRP2_OFFSET 32 /* PRP2 offset in NVMe cmd */
#define MPI3MR_NVME_CMD_SGL_OFFSET 24 /* SGL offset in NVMe cmd */
#define MPI3MR_NVME_DATA_FORMAT_PRP 0
#define MPI3MR_NVME_DATA_FORMAT_SGL1 1
#define MPI3MR_NVME_DATA_FORMAT_SGL2 2
/* MPI3: task management related definitions */
struct mpi3_scsi_task_mgmt_request {
__le16 host_tag;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment