* [PATCH 0/6] mpt3sas: Adding MPI Endpoint device support.
@ 2018-01-19 12:37 ` Suganath Prabu S
0 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu S @ 2018-01-19 12:37 UTC (permalink / raw)
To: linux-scsi, linux-nvme
Cc: Sathya.Prakash, sreekanth.reddy, chaitra.basappa, Suganath Prabu S
Andromeda is a PCIe switch, and it has a dedicated management
CPU (mCPU), nonvolatile flash memory, RAM etc... and
Linux kernel runs on mCPU. MPI Endpoint driver is the
management driver for Andromeda.
The Plx Manager driver running on mCPU synthesizes a
virtual/Synthetic MPI End point to host.
Synthetic MPI End point is emulated IT firmware running on
Linux operating system, which interfaces with PLX management
driver.
PLX Management driver integrates IOCFW in same driver binary.
At the end of Plx_Mgr driver load, it initializes IOC FW as well.
Current implementation is single instance
of IOC FW (as it supports only one host).
PLX management driver will provide required resources
and infrastructure for Synthetic MPI End point.
Existing PLXManagement driver will reserve virtual slot for
MPI end point. currently, Virtual slot number 29 is reserved
for MPI end point.
Synthetic device in management driver will be marked as
new type “PLX_DEV_TYPE_SYNTH_MPI_EP”. PLXmanagement driver
will interface with Synthetic MPI Endpoint for any
communication happening on PLX_DEV_TYPE_SYNTH_MPI_EP device
type from host.
Link between host and PLX C2 is in below diagram.
_______________
_______________ | |
| | | |
| PLX C2 |===============| HOST |
| PCI - |===============| MACHINE |
| SWITCH | | |
|_______________| | |
|| |_______________|
||
||
_______||______
| |
| MCPU |
| |
|_______________|
After MPI end point implementation -
(Host will see dedicated Virtual SLOT as MPI End point.)
In Below single line is logical channel for MPI Endpoint
_______________
_______________ | |
| | | |
| PLX C2 |===============| HOST |
| PCI - |===============| MACHINE |
| SWITCH | | |
| | | ----------- |
|_______________|---------------| | IT DRIVER | |
|| | | ----------- |
|| | |_______________|
|| |
|| |
_______||__|___________
| || | |
| MCPU | |
| ___|____ |
| | PLX MGR| |
| | DRIVER | |
| |________| |
| | |
| ___|_____ |
| | | |
| |IOC FW | |
| |_________| |
|_______________________|
PLXmanagement driver will create MPI end point based on
device table definition. PLXManagement driver will also
populate Synthetic device tree based on Device Table
for each host.
>From host it will be seen as IT HBA (Simplified version of SAS2/MPI2)
(PCI Device, in which emulated IT FW running on mCPU behind Synthetic
endpoint of PCISWITCH). For host it is considered as actual
Physical Device.
PLX Management driver provide interface to do DMA from mCPU to Host
using “MCPU Response Data Buffer“ method. DMA from Host to mCPU using
“MCPU Response Data Buffer” is not possible.
Why DMA from host to mCPU is not possible using Responsebuffer ?
MCPU Response buffer is not really for reading from host
(reading will work, but answer TLP will not come back to the CSR FIFO,
but will go to the MCPU root complex - which could be an
unexpected read completion!
Existing host driver (mpt2sas) will not work
for MPI end point. As the interface to DMA from host to mCPU is
not present for Mcpu/MPI Endpoint device, To overcome this
Driver should do double copy of those buffer directly to the
mCPU memory region via BAR-0 region.
The host BAR0 region is divided into different group to serve Host
assisted DMA.
0 - 255 System register(Doorbell, Host Interrupt etc)
256 - 4352 MPI Frame. (This is based on maxCredit 32)
4352 - 4864 Reply_free pool (512 byte is reserved considering
maxCredit 32. Reply needsextra room, for mCPU case
kept four times of maxCredit)
4864 -17152 SGE chain element.
(32 command * 3 chain of 128 byte size = 12288)
17152 -x Host buffer mapped with smid.
(Each smid can have 64K Max IO.)
BAR0+Last 1K MSIX Addr and DataTotalsize in use 2113664 bytes
of 4MB BAR0 MPI end point module of PLX management
driver must be aware of regions above.
SGE and Host buffer details will be available in MPI frame.
Each PCI packets coming from host on MPI end point will end up in
mCPU PLXmanagement driver. We can consider this as front end for IOC FW.
PLXManagementdriver will call IOC front end API which will be the entry
point in IOC FW module. Once PLX management calls relevant callbackfrom
IOC FW, rest of the processing will behandled within IOC FW.
IOC FW should release TLP packet as soon as possible to avoid any
TLP timeout.
Suganath Prabu S (6):
mpt3sas: Add PCI device ID for Andromeda.
mpt3sas: Configure reply post queue depth, DMA and sgl tablesize.
mpt3sas: Introduce API's to get BAR0 mapped buffer address.
mpt3sas: Introduce Base function for cloning.
mpt3sas: Introduce function to clone mpi request.
mpt3sas: Introduce function to clone mpi reply.
drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h | 1 +
drivers/scsi/mpt3sas/mpt3sas_base.c | 513 ++++++++++++++++++++++++++++++++--
drivers/scsi/mpt3sas/mpt3sas_base.h | 6 +
drivers/scsi/mpt3sas/mpt3sas_config.c | 1 +
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 54 ++--
5 files changed, 532 insertions(+), 43 deletions(-)
Thanks,
Suganath Prabu S
--
2.5.5
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 0/6] mpt3sas: Adding MPI Endpoint device support.
@ 2018-01-19 12:37 ` Suganath Prabu S
0 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu S @ 2018-01-19 12:37 UTC (permalink / raw)
Andromeda is a PCIe switch, and it has a dedicated management
CPU (mCPU), nonvolatile flash memory, RAM etc... and
Linux kernel runs on mCPU. MPI Endpoint driver is the
management driver for Andromeda.
The Plx Manager driver running on mCPU synthesizes a
virtual/Synthetic MPI End point to host.
Synthetic MPI End point is emulated IT firmware running on
Linux operating system, which interfaces with PLX management
driver.
PLX Management driver integrates IOCFW in same driver binary.
At the end of Plx_Mgr driver load, it initializes IOC FW as well.
Current implementation is single instance
of IOC FW (as it supports only one host).
PLX management driver will provide required resources
and infrastructure for Synthetic MPI End point.
Existing PLXManagement driver will reserve virtual slot for
MPI end point. currently, Virtual slot number 29 is reserved
for MPI end point.
Synthetic device in management driver will be marked as
new type ?PLX_DEV_TYPE_SYNTH_MPI_EP?. PLXmanagement driver
will interface with Synthetic MPI Endpoint for any
communication happening on PLX_DEV_TYPE_SYNTH_MPI_EP device
type from host.
Link between host and PLX C2 is in below diagram.
_______________
_______________ | |
| | | |
| PLX C2 |===============| HOST |
| PCI - |===============| MACHINE |
| SWITCH | | |
|_______________| | |
|| |_______________|
||
||
_______||______
| |
| MCPU |
| |
|_______________|
After MPI end point implementation -
(Host will see dedicated Virtual SLOT as MPI End point.)
In Below single line is logical channel for MPI Endpoint
_______________
_______________ | |
| | | |
| PLX C2 |===============| HOST |
| PCI - |===============| MACHINE |
| SWITCH | | |
| | | ----------- |
|_______________|---------------| | IT DRIVER | |
|| | | ----------- |
|| | |_______________|
|| |
|| |
_______||__|___________
| || | |
| MCPU | |
| ___|____ |
| | PLX MGR| |
| | DRIVER | |
| |________| |
| | |
| ___|_____ |
| | | |
| |IOC FW | |
| |_________| |
|_______________________|
PLXmanagement driver will create MPI end point based on
device table definition. PLXManagement driver will also
populate Synthetic device tree based on Device Table
for each host.
>From host it will be seen as IT HBA (Simplified version of SAS2/MPI2)
(PCI Device, in which emulated IT FW running on mCPU behind Synthetic
endpoint of PCISWITCH). For host it is considered as actual
Physical Device.
PLX Management driver provide interface to do DMA from mCPU to Host
using ?MCPU Response Data Buffer? method. DMA from Host to mCPU using
?MCPU Response Data Buffer? is not possible.
Why DMA from host to mCPU is not possible using Responsebuffer ?
MCPU Response buffer is not really for reading from host
(reading will work, but answer TLP will not come back to the CSR FIFO,
but will go to the MCPU root complex - which could be an
unexpected read completion!
Existing host driver (mpt2sas) will not work
for MPI end point. As the interface to DMA from host to mCPU is
not present for Mcpu/MPI Endpoint device, To overcome this
Driver should do double copy of those buffer directly to the
mCPU memory region via BAR-0 region.
The host BAR0 region is divided into different group to serve Host
assisted DMA.
0 - 255 System register(Doorbell, Host Interrupt etc)
256 - 4352 MPI Frame. (This is based on maxCredit 32)
4352 - 4864 Reply_free pool (512 byte is reserved considering
maxCredit 32. Reply needsextra room, for mCPU case
kept four times of maxCredit)
4864 -17152 SGE chain element.
(32 command * 3 chain of 128 byte size = 12288)
17152 -x Host buffer mapped with smid.
(Each smid can have 64K Max IO.)
BAR0+Last 1K MSIX Addr and DataTotalsize in use 2113664 bytes
of 4MB BAR0 MPI end point module of PLX management
driver must be aware of regions above.
SGE and Host buffer details will be available in MPI frame.
Each PCI packets coming from host on MPI end point will end up in
mCPU PLXmanagement driver. We can consider this as front end for IOC FW.
PLXManagementdriver will call IOC front end API which will be the entry
point in IOC FW module. Once PLX management calls relevant callbackfrom
IOC FW, rest of the processing will behandled within IOC FW.
IOC FW should release TLP packet as soon as possible to avoid any
TLP timeout.
Suganath Prabu S (6):
mpt3sas: Add PCI device ID for Andromeda.
mpt3sas: Configure reply post queue depth, DMA and sgl tablesize.
mpt3sas: Introduce API's to get BAR0 mapped buffer address.
mpt3sas: Introduce Base function for cloning.
mpt3sas: Introduce function to clone mpi request.
mpt3sas: Introduce function to clone mpi reply.
drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h | 1 +
drivers/scsi/mpt3sas/mpt3sas_base.c | 513 ++++++++++++++++++++++++++++++++--
drivers/scsi/mpt3sas/mpt3sas_base.h | 6 +
drivers/scsi/mpt3sas/mpt3sas_config.c | 1 +
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 54 ++--
5 files changed, 532 insertions(+), 43 deletions(-)
Thanks,
Suganath Prabu S
--
2.5.5
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 1/6] mpt3sas: Add PCI device ID for Andromeda.
2018-01-19 12:37 ` Suganath Prabu S
@ 2018-01-19 12:37 ` Suganath Prabu S
-1 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu S @ 2018-01-19 12:37 UTC (permalink / raw)
To: linux-scsi, linux-nvme
Cc: Sathya.Prakash, sreekanth.reddy, chaitra.basappa, Suganath Prabu S
Add device ID and flag for Andromeda/MPI Emdpont.
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
---
drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h | 1 +
drivers/scsi/mpt3sas/mpt3sas_base.h | 1 +
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 14 ++++++++++++--
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h
index ee11710..0ad88de 100644
--- a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h
+++ b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h
@@ -524,6 +524,7 @@ typedef struct _MPI2_CONFIG_REPLY {
#define MPI2_MFGPAGE_DEVID_SAS2308_1 (0x0086)
#define MPI2_MFGPAGE_DEVID_SAS2308_2 (0x0087)
#define MPI2_MFGPAGE_DEVID_SAS2308_3 (0x006E)
+#define MPI2_MFGPAGE_DEVID_SAS2308_MPI_EP (0x02B0)
/*MPI v2.5 SAS products */
#define MPI25_MFGPAGE_DEVID_SAS3004 (0x0096)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 789bc42..897394d 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -1336,6 +1336,7 @@ struct MPT3SAS_ADAPTER {
u32 ring_buffer_offset;
u32 ring_buffer_sz;
u8 is_warpdrive;
+ u8 is_mcpu_endpoint;
u8 hide_ir_msg;
u8 mfg_pg10_hide_flag;
u8 hide_drives;
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 74fca18..bde3c6f 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -10335,6 +10335,7 @@ _scsih_determine_hba_mpi_version(struct pci_dev *pdev)
case MPI2_MFGPAGE_DEVID_SAS2308_1:
case MPI2_MFGPAGE_DEVID_SAS2308_2:
case MPI2_MFGPAGE_DEVID_SAS2308_3:
+ case MPI2_MFGPAGE_DEVID_SAS2308_MPI_EP:
return MPI2_VERSION;
case MPI25_MFGPAGE_DEVID_SAS3004:
case MPI25_MFGPAGE_DEVID_SAS3008:
@@ -10412,11 +10413,18 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
ioc->hba_mpi_version_belonged = hba_mpi_version;
ioc->id = mpt2_ids++;
sprintf(ioc->driver_name, "%s", MPT2SAS_DRIVER_NAME);
- if (pdev->device == MPI2_MFGPAGE_DEVID_SSS6200) {
+ switch (pdev->device) {
+ case MPI2_MFGPAGE_DEVID_SSS6200:
ioc->is_warpdrive = 1;
ioc->hide_ir_msg = 1;
- } else
+ break;
+ case MPI2_MFGPAGE_DEVID_SAS2308_MPI_EP:
+ ioc->is_mcpu_endpoint = 1;
+ break;
+ default:
ioc->mfg_pg10_hide_flag = MFG_PAGE10_EXPOSE_ALL_DISKS;
+ break;
+ }
break;
case MPI25_VERSION:
case MPI26_VERSION:
@@ -10845,6 +10853,8 @@ static const struct pci_device_id mpt3sas_pci_table[] = {
PCI_ANY_ID, PCI_ANY_ID },
{ MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2308_3,
PCI_ANY_ID, PCI_ANY_ID },
+ { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2308_MPI_EP,
+ PCI_ANY_ID, PCI_ANY_ID },
/* SSS6200 */
{ MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SSS6200,
PCI_ANY_ID, PCI_ANY_ID },
--
2.5.5
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 1/6] mpt3sas: Add PCI device ID for Andromeda.
@ 2018-01-19 12:37 ` Suganath Prabu S
0 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu S @ 2018-01-19 12:37 UTC (permalink / raw)
Add device ID and flag for Andromeda/MPI Emdpont.
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani at broadcom.com>
---
drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h | 1 +
drivers/scsi/mpt3sas/mpt3sas_base.h | 1 +
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 14 ++++++++++++--
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h
index ee11710..0ad88de 100644
--- a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h
+++ b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h
@@ -524,6 +524,7 @@ typedef struct _MPI2_CONFIG_REPLY {
#define MPI2_MFGPAGE_DEVID_SAS2308_1 (0x0086)
#define MPI2_MFGPAGE_DEVID_SAS2308_2 (0x0087)
#define MPI2_MFGPAGE_DEVID_SAS2308_3 (0x006E)
+#define MPI2_MFGPAGE_DEVID_SAS2308_MPI_EP (0x02B0)
/*MPI v2.5 SAS products */
#define MPI25_MFGPAGE_DEVID_SAS3004 (0x0096)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 789bc42..897394d 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -1336,6 +1336,7 @@ struct MPT3SAS_ADAPTER {
u32 ring_buffer_offset;
u32 ring_buffer_sz;
u8 is_warpdrive;
+ u8 is_mcpu_endpoint;
u8 hide_ir_msg;
u8 mfg_pg10_hide_flag;
u8 hide_drives;
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 74fca18..bde3c6f 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -10335,6 +10335,7 @@ _scsih_determine_hba_mpi_version(struct pci_dev *pdev)
case MPI2_MFGPAGE_DEVID_SAS2308_1:
case MPI2_MFGPAGE_DEVID_SAS2308_2:
case MPI2_MFGPAGE_DEVID_SAS2308_3:
+ case MPI2_MFGPAGE_DEVID_SAS2308_MPI_EP:
return MPI2_VERSION;
case MPI25_MFGPAGE_DEVID_SAS3004:
case MPI25_MFGPAGE_DEVID_SAS3008:
@@ -10412,11 +10413,18 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
ioc->hba_mpi_version_belonged = hba_mpi_version;
ioc->id = mpt2_ids++;
sprintf(ioc->driver_name, "%s", MPT2SAS_DRIVER_NAME);
- if (pdev->device == MPI2_MFGPAGE_DEVID_SSS6200) {
+ switch (pdev->device) {
+ case MPI2_MFGPAGE_DEVID_SSS6200:
ioc->is_warpdrive = 1;
ioc->hide_ir_msg = 1;
- } else
+ break;
+ case MPI2_MFGPAGE_DEVID_SAS2308_MPI_EP:
+ ioc->is_mcpu_endpoint = 1;
+ break;
+ default:
ioc->mfg_pg10_hide_flag = MFG_PAGE10_EXPOSE_ALL_DISKS;
+ break;
+ }
break;
case MPI25_VERSION:
case MPI26_VERSION:
@@ -10845,6 +10853,8 @@ static const struct pci_device_id mpt3sas_pci_table[] = {
PCI_ANY_ID, PCI_ANY_ID },
{ MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2308_3,
PCI_ANY_ID, PCI_ANY_ID },
+ { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2308_MPI_EP,
+ PCI_ANY_ID, PCI_ANY_ID },
/* SSS6200 */
{ MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SSS6200,
PCI_ANY_ID, PCI_ANY_ID },
--
2.5.5
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 2/6] mpt3sas: Configure reply post queue depth, DMA and sgl tablesize.
2018-01-19 12:37 ` Suganath Prabu S
@ 2018-01-19 12:37 ` Suganath Prabu S
-1 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu S @ 2018-01-19 12:37 UTC (permalink / raw)
To: linux-scsi, linux-nvme
Cc: Sathya.Prakash, sreekanth.reddy, chaitra.basappa, Suganath Prabu S
This configures shost max sector to 128, single reply descriptor
post queue, sgl table size to 16 and 32 bit DMA for MPI Endpoint
and it supports 64K as max IO.
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 47 +++++++++++++++++++++++-------------
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 40 ++++++++++++++++++------------
2 files changed, 54 insertions(+), 33 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index a44b9be..c0a1c0f 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -2214,6 +2214,9 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)
struct sysinfo s;
u64 consistent_dma_mask;
+ if (ioc->is_mcpu_endpoint)
+ goto try_32bit;
+
if (ioc->dma_mask)
consistent_dma_mask = DMA_BIT_MASK(64);
else
@@ -2232,6 +2235,7 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)
}
}
+ try_32bit:
if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
&& !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
ioc->base_add_sg_single = &_base_add_sg_single_32;
@@ -3887,17 +3891,21 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
sg_tablesize = min_t(unsigned short, sg_tablesize,
MPT_KDUMP_MIN_PHYS_SEGMENTS);
- if (sg_tablesize < MPT_MIN_PHYS_SEGMENTS)
- sg_tablesize = MPT_MIN_PHYS_SEGMENTS;
- else if (sg_tablesize > MPT_MAX_PHYS_SEGMENTS) {
- sg_tablesize = min_t(unsigned short, sg_tablesize,
- SG_MAX_SEGMENTS);
- pr_warn(MPT3SAS_FMT
- "sg_tablesize(%u) is bigger than kernel"
- " defined SG_CHUNK_SIZE(%u)\n", ioc->name,
- sg_tablesize, MPT_MAX_PHYS_SEGMENTS);
+ if (ioc->is_mcpu_endpoint)
+ ioc->shost->sg_tablesize = MPT_MIN_PHYS_SEGMENTS;
+ else {
+ if (sg_tablesize < MPT_MIN_PHYS_SEGMENTS)
+ sg_tablesize = MPT_MIN_PHYS_SEGMENTS;
+ else if (sg_tablesize > MPT_MAX_PHYS_SEGMENTS) {
+ sg_tablesize = min_t(unsigned short, sg_tablesize,
+ SG_MAX_SEGMENTS);
+ pr_warn(MPT3SAS_FMT
+ "sg_tablesize(%u) is bigger than kernel "
+ "defined SG_CHUNK_SIZE(%u)\n", ioc->name,
+ sg_tablesize, MPT_MAX_PHYS_SEGMENTS);
+ }
+ ioc->shost->sg_tablesize = sg_tablesize;
}
- ioc->shost->sg_tablesize = sg_tablesize;
ioc->internal_depth = min_t(int, (facts->HighPriorityCredit + (5)),
(facts->RequestCredit / 4));
@@ -3982,13 +3990,18 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
/* reply free queue sizing - taking into account for 64 FW events */
ioc->reply_free_queue_depth = ioc->hba_queue_depth + 64;
- /* calculate reply descriptor post queue depth */
- ioc->reply_post_queue_depth = ioc->hba_queue_depth +
- ioc->reply_free_queue_depth + 1 ;
- /* align the reply post queue on the next 16 count boundary */
- if (ioc->reply_post_queue_depth % 16)
- ioc->reply_post_queue_depth += 16 -
- (ioc->reply_post_queue_depth % 16);
+ /* mCPU manage single counters for simplicity */
+ if (ioc->is_mcpu_endpoint)
+ ioc->reply_post_queue_depth = ioc->reply_free_queue_depth;
+ else {
+ /* calculate reply descriptor post queue depth */
+ ioc->reply_post_queue_depth = ioc->hba_queue_depth +
+ ioc->reply_free_queue_depth + 1;
+ /* align the reply post queue on the next 16 count boundary */
+ if (ioc->reply_post_queue_depth % 16)
+ ioc->reply_post_queue_depth += 16 -
+ (ioc->reply_post_queue_depth % 16);
+ }
if (ioc->reply_post_queue_depth >
facts->MaxReplyDescriptorPostQueueDepth) {
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index bde3c6f..5e52679 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -10521,26 +10521,34 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
shost->transportt = mpt3sas_transport_template;
shost->unique_id = ioc->id;
- if (max_sectors != 0xFFFF) {
- if (max_sectors < 64) {
- shost->max_sectors = 64;
- pr_warn(MPT3SAS_FMT "Invalid value %d passed " \
- "for max_sectors, range is 64 to 32767. Assigning "
- "value of 64.\n", ioc->name, max_sectors);
- } else if (max_sectors > 32767) {
- shost->max_sectors = 32767;
- pr_warn(MPT3SAS_FMT "Invalid value %d passed " \
- "for max_sectors, range is 64 to 32767. Assigning "
- "default value of 32767.\n", ioc->name,
- max_sectors);
- } else {
- shost->max_sectors = max_sectors & 0xFFFE;
- pr_info(MPT3SAS_FMT
+ if (ioc->is_mcpu_endpoint) {
+ /* mCPU MPI support 64K max IO */
+ shost->max_sectors = 128;
+ pr_info(MPT3SAS_FMT
"The max_sectors value is set to %d\n",
ioc->name, shost->max_sectors);
+ } else {
+ if (max_sectors != 0xFFFF) {
+ if (max_sectors < 64) {
+ shost->max_sectors = 64;
+ pr_warn(MPT3SAS_FMT "Invalid value %d passed " \
+ "for max_sectors, range is 64 to 32767. " \
+ "Assigning value of 64.\n", \
+ ioc->name, max_sectors);
+ } else if (max_sectors > 32767) {
+ shost->max_sectors = 32767;
+ pr_warn(MPT3SAS_FMT "Invalid value %d passed " \
+ "for max_sectors, range is 64 to 32767." \
+ "Assigning default value of 32767.\n", \
+ ioc->name, max_sectors);
+ } else {
+ shost->max_sectors = max_sectors & 0xFFFE;
+ pr_info(MPT3SAS_FMT
+ "The max_sectors value is set to %d\n",
+ ioc->name, shost->max_sectors);
+ }
}
}
-
/* register EEDP capabilities with SCSI layer */
if (prot_mask > 0)
scsi_host_set_prot(shost, prot_mask);
--
2.5.5
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 2/6] mpt3sas: Configure reply post queue depth, DMA and sgl tablesize.
@ 2018-01-19 12:37 ` Suganath Prabu S
0 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu S @ 2018-01-19 12:37 UTC (permalink / raw)
This configures shost max sector to 128, single reply descriptor
post queue, sgl table size to 16 and 32 bit DMA for MPI Endpoint
and it supports 64K as max IO.
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani at broadcom.com>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 47 +++++++++++++++++++++++-------------
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 40 ++++++++++++++++++------------
2 files changed, 54 insertions(+), 33 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index a44b9be..c0a1c0f 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -2214,6 +2214,9 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)
struct sysinfo s;
u64 consistent_dma_mask;
+ if (ioc->is_mcpu_endpoint)
+ goto try_32bit;
+
if (ioc->dma_mask)
consistent_dma_mask = DMA_BIT_MASK(64);
else
@@ -2232,6 +2235,7 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)
}
}
+ try_32bit:
if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
&& !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
ioc->base_add_sg_single = &_base_add_sg_single_32;
@@ -3887,17 +3891,21 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
sg_tablesize = min_t(unsigned short, sg_tablesize,
MPT_KDUMP_MIN_PHYS_SEGMENTS);
- if (sg_tablesize < MPT_MIN_PHYS_SEGMENTS)
- sg_tablesize = MPT_MIN_PHYS_SEGMENTS;
- else if (sg_tablesize > MPT_MAX_PHYS_SEGMENTS) {
- sg_tablesize = min_t(unsigned short, sg_tablesize,
- SG_MAX_SEGMENTS);
- pr_warn(MPT3SAS_FMT
- "sg_tablesize(%u) is bigger than kernel"
- " defined SG_CHUNK_SIZE(%u)\n", ioc->name,
- sg_tablesize, MPT_MAX_PHYS_SEGMENTS);
+ if (ioc->is_mcpu_endpoint)
+ ioc->shost->sg_tablesize = MPT_MIN_PHYS_SEGMENTS;
+ else {
+ if (sg_tablesize < MPT_MIN_PHYS_SEGMENTS)
+ sg_tablesize = MPT_MIN_PHYS_SEGMENTS;
+ else if (sg_tablesize > MPT_MAX_PHYS_SEGMENTS) {
+ sg_tablesize = min_t(unsigned short, sg_tablesize,
+ SG_MAX_SEGMENTS);
+ pr_warn(MPT3SAS_FMT
+ "sg_tablesize(%u) is bigger than kernel "
+ "defined SG_CHUNK_SIZE(%u)\n", ioc->name,
+ sg_tablesize, MPT_MAX_PHYS_SEGMENTS);
+ }
+ ioc->shost->sg_tablesize = sg_tablesize;
}
- ioc->shost->sg_tablesize = sg_tablesize;
ioc->internal_depth = min_t(int, (facts->HighPriorityCredit + (5)),
(facts->RequestCredit / 4));
@@ -3982,13 +3990,18 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
/* reply free queue sizing - taking into account for 64 FW events */
ioc->reply_free_queue_depth = ioc->hba_queue_depth + 64;
- /* calculate reply descriptor post queue depth */
- ioc->reply_post_queue_depth = ioc->hba_queue_depth +
- ioc->reply_free_queue_depth + 1 ;
- /* align the reply post queue on the next 16 count boundary */
- if (ioc->reply_post_queue_depth % 16)
- ioc->reply_post_queue_depth += 16 -
- (ioc->reply_post_queue_depth % 16);
+ /* mCPU manage single counters for simplicity */
+ if (ioc->is_mcpu_endpoint)
+ ioc->reply_post_queue_depth = ioc->reply_free_queue_depth;
+ else {
+ /* calculate reply descriptor post queue depth */
+ ioc->reply_post_queue_depth = ioc->hba_queue_depth +
+ ioc->reply_free_queue_depth + 1;
+ /* align the reply post queue on the next 16 count boundary */
+ if (ioc->reply_post_queue_depth % 16)
+ ioc->reply_post_queue_depth += 16 -
+ (ioc->reply_post_queue_depth % 16);
+ }
if (ioc->reply_post_queue_depth >
facts->MaxReplyDescriptorPostQueueDepth) {
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index bde3c6f..5e52679 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -10521,26 +10521,34 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
shost->transportt = mpt3sas_transport_template;
shost->unique_id = ioc->id;
- if (max_sectors != 0xFFFF) {
- if (max_sectors < 64) {
- shost->max_sectors = 64;
- pr_warn(MPT3SAS_FMT "Invalid value %d passed " \
- "for max_sectors, range is 64 to 32767. Assigning "
- "value of 64.\n", ioc->name, max_sectors);
- } else if (max_sectors > 32767) {
- shost->max_sectors = 32767;
- pr_warn(MPT3SAS_FMT "Invalid value %d passed " \
- "for max_sectors, range is 64 to 32767. Assigning "
- "default value of 32767.\n", ioc->name,
- max_sectors);
- } else {
- shost->max_sectors = max_sectors & 0xFFFE;
- pr_info(MPT3SAS_FMT
+ if (ioc->is_mcpu_endpoint) {
+ /* mCPU MPI support 64K max IO */
+ shost->max_sectors = 128;
+ pr_info(MPT3SAS_FMT
"The max_sectors value is set to %d\n",
ioc->name, shost->max_sectors);
+ } else {
+ if (max_sectors != 0xFFFF) {
+ if (max_sectors < 64) {
+ shost->max_sectors = 64;
+ pr_warn(MPT3SAS_FMT "Invalid value %d passed " \
+ "for max_sectors, range is 64 to 32767. " \
+ "Assigning value of 64.\n", \
+ ioc->name, max_sectors);
+ } else if (max_sectors > 32767) {
+ shost->max_sectors = 32767;
+ pr_warn(MPT3SAS_FMT "Invalid value %d passed " \
+ "for max_sectors, range is 64 to 32767." \
+ "Assigning default value of 32767.\n", \
+ ioc->name, max_sectors);
+ } else {
+ shost->max_sectors = max_sectors & 0xFFFE;
+ pr_info(MPT3SAS_FMT
+ "The max_sectors value is set to %d\n",
+ ioc->name, shost->max_sectors);
+ }
}
}
-
/* register EEDP capabilities with SCSI layer */
if (prot_mask > 0)
scsi_host_set_prot(shost, prot_mask);
--
2.5.5
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 3/6] mpt3sas: Introduce API's to get BAR0 mapped buffer address.
2018-01-19 12:37 ` Suganath Prabu S
@ 2018-01-19 12:37 ` Suganath Prabu S
-1 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu S @ 2018-01-19 12:37 UTC (permalink / raw)
To: linux-scsi, linux-nvme
Cc: Sathya.Prakash, sreekanth.reddy, chaitra.basappa, Suganath Prabu S
For MPI Endpoint/Mcpu, Driver should double buffer data buffer/sgl's.
This is normally copied from host to internal memory of IOC by
DMA engine of PCI Device. Since the interface to DMA from host
to mCPU is not present for Mcpu/MPI Endpoint device,
Driver does double copy of those buffer directly to the mCPU
memory region via BAR-0 region.
Introduced API's to calculate and return BAR0 mapped
host buffer's physical and virtual address for the provided smid.
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 93 +++++++++++++++++++++++++++++++++++++
drivers/scsi/mpt3sas/mpt3sas_base.h | 2 +
2 files changed, 95 insertions(+)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index c0a1c0f..dc289c0 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -126,6 +126,99 @@ module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug,
param_get_int, &mpt3sas_fwfault_debug, 0644);
/**
+ * _base_get_chain - Calculates and Returns virtual chain address
+ * for the provided smid in BAR0 space.
+ *
+ * @ioc: per adapter object
+ * @smid: system request message index
+ * @sge_chain_count: Scatter gather chain count.
+ *
+ * @Return: chain address.
+ */
+static inline void *
+_base_get_chain(struct MPT3SAS_ADAPTER *ioc, u16 smid,
+ u8 sge_chain_count)
+{
+ void *base_chain, *chain_virt;
+ u16 cmd_credit = ioc->facts.RequestCredit + 1;
+
+ base_chain = (void *)ioc->chip + MPI_FRAME_START_OFFSET +
+ (cmd_credit * ioc->request_sz) +
+ REPLY_FREE_POOL_SIZE;
+ chain_virt = base_chain + (smid * ioc->facts.MaxChainDepth *
+ ioc->request_sz) + (sge_chain_count * ioc->request_sz);
+ return chain_virt;
+}
+
+/**
+ * _base_get_chain_phys - Calculates and Returns physical address
+ * in BAR0 for scatter gather chains, for
+ * the provided smid.
+ *
+ * @ioc: per adapter object
+ * @smid: system request message index
+ * @sge_chain_count: Scatter gather chain count.
+ *
+ * @Return - Physical chain address.
+ */
+static inline void *
+_base_get_chain_phys(struct MPT3SAS_ADAPTER *ioc, u16 smid,
+ u8 sge_chain_count)
+{
+ void *base_chain_phys, *chain_phys;
+ u16 cmd_credit = ioc->facts.RequestCredit + 1;
+
+ base_chain_phys = (void *)ioc->chip_phys + MPI_FRAME_START_OFFSET +
+ (cmd_credit * ioc->request_sz) +
+ REPLY_FREE_POOL_SIZE;
+ chain_phys = base_chain_phys + (smid * ioc->facts.MaxChainDepth *
+ ioc->request_sz) + (sge_chain_count * ioc->request_sz);
+ return chain_phys;
+}
+
+/**
+ * _base_get_buffer_bar0 - Calculates and Returns BAR0 mapped Host
+ * buffer address for the provided smid.
+ * (Each smid can have 64K starts from 17024)
+ *
+ * @ioc: per adapter object
+ * @smid: system request message index
+ *
+ * @Returns - Pointer to buffer location in BAR0.
+ */
+
+static void *
+_base_get_buffer_bar0(struct MPT3SAS_ADAPTER *ioc, u16 smid)
+{
+ u16 cmd_credit = ioc->facts.RequestCredit + 1;
+ // Added extra 1 to reach end of chain.
+ void *chain_end = _base_get_chain(ioc,
+ cmd_credit + 1,
+ ioc->facts.MaxChainDepth);
+ return chain_end + (smid * 64 * 1024);
+}
+
+/**
+ * _base_get_buffer_phys_bar0 - Calculates and Returns BAR0 mapped
+ * Host buffer Physical address for the provided smid.
+ * (Each smid can have 64K starts from 17024)
+ *
+ * @ioc: per adapter object
+ * @smid: system request message index
+ *
+ * @Returns - Pointer to buffer location in BAR0.
+ */
+static void *
+_base_get_buffer_phys_bar0(struct MPT3SAS_ADAPTER *ioc, u16 smid)
+{
+ u16 cmd_credit = ioc->facts.RequestCredit + 1;
+ void *chain_end_phys = _base_get_chain_phys(ioc,
+ cmd_credit + 1,
+ ioc->facts.MaxChainDepth);
+ return chain_end_phys + (smid * 64 * 1024);
+}
+
+/**
* mpt3sas_remove_dead_ioc_func - kthread context to remove dead ioc
* @arg: input argument, used to derive ioc
*
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 897394d..2529d25 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -120,6 +120,8 @@
#define MPT3SAS_NVME_QUEUE_DEPTH 128
#define MPT_NAME_LENGTH 32 /* generic length of strings */
#define MPT_STRING_LENGTH 64
+#define MPI_FRAME_START_OFFSET 256
+#define REPLY_FREE_POOL_SIZE 512 /*(32 maxcredix *4)*(4 times)*/
#define MPT_MAX_CALLBACKS 32
--
2.5.5
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 3/6] mpt3sas: Introduce API's to get BAR0 mapped buffer address.
@ 2018-01-19 12:37 ` Suganath Prabu S
0 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu S @ 2018-01-19 12:37 UTC (permalink / raw)
For MPI Endpoint/Mcpu, Driver should double buffer data buffer/sgl's.
This is normally copied from host to internal memory of IOC by
DMA engine of PCI Device. Since the interface to DMA from host
to mCPU is not present for Mcpu/MPI Endpoint device,
Driver does double copy of those buffer directly to the mCPU
memory region via BAR-0 region.
Introduced API's to calculate and return BAR0 mapped
host buffer's physical and virtual address for the provided smid.
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani at broadcom.com>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 93 +++++++++++++++++++++++++++++++++++++
drivers/scsi/mpt3sas/mpt3sas_base.h | 2 +
2 files changed, 95 insertions(+)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index c0a1c0f..dc289c0 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -126,6 +126,99 @@ module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug,
param_get_int, &mpt3sas_fwfault_debug, 0644);
/**
+ * _base_get_chain - Calculates and Returns virtual chain address
+ * for the provided smid in BAR0 space.
+ *
+ * @ioc: per adapter object
+ * @smid: system request message index
+ * @sge_chain_count: Scatter gather chain count.
+ *
+ * @Return: chain address.
+ */
+static inline void *
+_base_get_chain(struct MPT3SAS_ADAPTER *ioc, u16 smid,
+ u8 sge_chain_count)
+{
+ void *base_chain, *chain_virt;
+ u16 cmd_credit = ioc->facts.RequestCredit + 1;
+
+ base_chain = (void *)ioc->chip + MPI_FRAME_START_OFFSET +
+ (cmd_credit * ioc->request_sz) +
+ REPLY_FREE_POOL_SIZE;
+ chain_virt = base_chain + (smid * ioc->facts.MaxChainDepth *
+ ioc->request_sz) + (sge_chain_count * ioc->request_sz);
+ return chain_virt;
+}
+
+/**
+ * _base_get_chain_phys - Calculates and Returns physical address
+ * in BAR0 for scatter gather chains, for
+ * the provided smid.
+ *
+ * @ioc: per adapter object
+ * @smid: system request message index
+ * @sge_chain_count: Scatter gather chain count.
+ *
+ * @Return - Physical chain address.
+ */
+static inline void *
+_base_get_chain_phys(struct MPT3SAS_ADAPTER *ioc, u16 smid,
+ u8 sge_chain_count)
+{
+ void *base_chain_phys, *chain_phys;
+ u16 cmd_credit = ioc->facts.RequestCredit + 1;
+
+ base_chain_phys = (void *)ioc->chip_phys + MPI_FRAME_START_OFFSET +
+ (cmd_credit * ioc->request_sz) +
+ REPLY_FREE_POOL_SIZE;
+ chain_phys = base_chain_phys + (smid * ioc->facts.MaxChainDepth *
+ ioc->request_sz) + (sge_chain_count * ioc->request_sz);
+ return chain_phys;
+}
+
+/**
+ * _base_get_buffer_bar0 - Calculates and Returns BAR0 mapped Host
+ * buffer address for the provided smid.
+ * (Each smid can have 64K starts from 17024)
+ *
+ * @ioc: per adapter object
+ * @smid: system request message index
+ *
+ * @Returns - Pointer to buffer location in BAR0.
+ */
+
+static void *
+_base_get_buffer_bar0(struct MPT3SAS_ADAPTER *ioc, u16 smid)
+{
+ u16 cmd_credit = ioc->facts.RequestCredit + 1;
+ // Added extra 1 to reach end of chain.
+ void *chain_end = _base_get_chain(ioc,
+ cmd_credit + 1,
+ ioc->facts.MaxChainDepth);
+ return chain_end + (smid * 64 * 1024);
+}
+
+/**
+ * _base_get_buffer_phys_bar0 - Calculates and Returns BAR0 mapped
+ * Host buffer Physical address for the provided smid.
+ * (Each smid can have 64K starts from 17024)
+ *
+ * @ioc: per adapter object
+ * @smid: system request message index
+ *
+ * @Returns - Pointer to buffer location in BAR0.
+ */
+static void *
+_base_get_buffer_phys_bar0(struct MPT3SAS_ADAPTER *ioc, u16 smid)
+{
+ u16 cmd_credit = ioc->facts.RequestCredit + 1;
+ void *chain_end_phys = _base_get_chain_phys(ioc,
+ cmd_credit + 1,
+ ioc->facts.MaxChainDepth);
+ return chain_end_phys + (smid * 64 * 1024);
+}
+
+/**
* mpt3sas_remove_dead_ioc_func - kthread context to remove dead ioc
* @arg: input argument, used to derive ioc
*
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 897394d..2529d25 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -120,6 +120,8 @@
#define MPT3SAS_NVME_QUEUE_DEPTH 128
#define MPT_NAME_LENGTH 32 /* generic length of strings */
#define MPT_STRING_LENGTH 64
+#define MPI_FRAME_START_OFFSET 256
+#define REPLY_FREE_POOL_SIZE 512 /*(32 maxcredix *4)*(4 times)*/
#define MPT_MAX_CALLBACKS 32
--
2.5.5
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 4/6] mpt3sas: Introduce Base function for cloning.
2018-01-19 12:37 ` Suganath Prabu S
@ 2018-01-19 12:37 ` Suganath Prabu S
-1 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu S @ 2018-01-19 12:37 UTC (permalink / raw)
To: linux-scsi, linux-nvme
Cc: Sathya.Prakash, sreekanth.reddy, chaitra.basappa, Suganath Prabu S
All scsi IO's and config requests data buffer and
sgl are cloned to system memory in _clone_sg_entries
before submitting it to Firmware.
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 212 +++++++++++++++++++++++++++++++++-
drivers/scsi/mpt3sas/mpt3sas_base.h | 3 +
drivers/scsi/mpt3sas/mpt3sas_config.c | 1 +
3 files changed, 215 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index dc289c0..40a1806 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -126,6 +126,23 @@ module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug,
param_get_int, &mpt3sas_fwfault_debug, 0644);
/**
+ * _base_clone_to_sys_mem - Writes/copies data to system/BAR0 region
+ *
+ * @dst_iomem: Pointer to the destinaltion location in BAR0 space.
+ * @src: Pointer to the Source data.
+ * @size: Size of data to be copied.
+ */
+static void
+_base_clone_to_sys_mem(void *dst_iomem, void *src, u32 size)
+{
+ int i;
+ __le32 *src_virt_mem = (__le32 *)(src);
+
+ for (i = 0; i < size/4; i++)
+ writel(cpu_to_le32(src_virt_mem[i]), dst_iomem + (i * 4));
+}
+
+/**
* _base_get_chain - Calculates and Returns virtual chain address
* for the provided smid in BAR0 space.
*
@@ -219,6 +236,199 @@ _base_get_buffer_phys_bar0(struct MPT3SAS_ADAPTER *ioc, u16 smid)
}
/**
+ * _base_get_chain_buffer_dma_to_chain_buffer - Iterates chain
+ * lookup list and Provides chain_buffer
+ * address for the matching dma address.
+ * (Each smid can have 64K starts from 17024)
+ *
+ * @ioc: per adapter object
+ * @chain_buffer_dma: Chain buffer dma address.
+ *
+ * @Returns - Pointer to chain buffer. Or Null on Failure.
+ */
+static void *
+_base_get_chain_buffer_dma_to_chain_buffer(struct MPT3SAS_ADAPTER *ioc,
+ dma_addr_t chain_buffer_dma)
+{
+ u16 index;
+
+ for (index = 0; index < ioc->chain_depth; index++) {
+ if (ioc->chain_lookup[index].chain_buffer_dma ==
+ chain_buffer_dma)
+ return ioc->chain_lookup[index].chain_buffer;
+ }
+ pr_info(MPT3SAS_FMT
+ "Provided chain_buffer_dma address is not in the lookup list\n",
+ ioc->name);
+ return NULL;
+}
+
+/**
+ * _clone_sg_entries - MPI EP's scsiio and config requests
+ * are handled here. Base function for
+ * double buffering, before submitting
+ * the requests.
+ *
+ * @ioc: per adapter object.
+ * @mpi_request: mf request pointer.
+ * @smid: system request message index.
+ *
+ * @Returns: Nothing.
+ */
+static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,
+ void *mpi_request, u16 smid)
+{
+ Mpi2SGESimple32_t *sgel, *sgel_next;
+ u32 sgl_flags, sge_chain_count = 0;
+ bool is_write = 0;
+ u16 i = 0;
+ void *buffer_iomem, *buffer_iomem_phys;
+ void *buff_ptr, *buff_ptr_phys;
+ void *dst_chain_addr[MCPU_MAX_CHAINS_PER_IO];
+ void *src_chain_addr[MCPU_MAX_CHAINS_PER_IO], *dst_addr_phys;
+ MPI2RequestHeader_t *request_hdr;
+ struct scsi_cmnd *scmd;
+ struct scatterlist *sg_scmd = NULL;
+ int is_scsiio_req = 0;
+
+ request_hdr = (MPI2RequestHeader_t *) mpi_request;
+
+ if (request_hdr->Function == MPI2_FUNCTION_SCSI_IO_REQUEST) {
+ Mpi25SCSIIORequest_t *scsiio_request =
+ (Mpi25SCSIIORequest_t *)mpi_request;
+ sgel = (Mpi2SGESimple32_t *) &scsiio_request->SGL;
+ is_scsiio_req = 1;
+ } else if (request_hdr->Function == MPI2_FUNCTION_CONFIG) {
+ Mpi2ConfigRequest_t *config_req =
+ (Mpi2ConfigRequest_t *)mpi_request;
+ sgel = (Mpi2SGESimple32_t *) &config_req->PageBufferSGE;
+ } else
+ return;
+
+ /* From smid we can get scsi_cmd, once we have sg_scmd,
+ * we just need to get sg_virt and sg_next to get virual
+ * address associated with sgel->Address.
+ */
+
+ if (is_scsiio_req) {
+ /* Get scsi_cmd using smid */
+ scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
+ if (scmd == NULL) {
+ pr_err(MPT3SAS_FMT "scmd is NULL\n", ioc->name);
+ return;
+ }
+
+ /* Get sg_scmd from scmd provided */
+ sg_scmd = scsi_sglist(scmd);
+ }
+
+ /*
+ * 0 - 255 System register
+ * 256 - 4352 MPI Frame. (This is based on maxCredit 32)
+ * 4352 - 4864 Reply_free pool (512 byte is reserved
+ * considering maxCredit 32. Reply need extra
+ * room, for mCPU case kept four times of
+ * maxCredit).
+ * 4864 - 17152 SGE chain element. (32cmd * 3 chain of
+ * 128 byte size = 12288)
+ * 17152 - x Host buffer mapped with smid.
+ * (Each smid can have 64K Max IO.)
+ * BAR0+Last 1K MSIX Addr and Data
+ * Total size in use 2113664 bytes of 4MB BAR0
+ */
+
+ buffer_iomem = _base_get_buffer_bar0(ioc, smid);
+ buffer_iomem_phys = _base_get_buffer_phys_bar0(ioc, smid);
+
+ buff_ptr = buffer_iomem;
+ buff_ptr_phys = buffer_iomem_phys;
+
+ if (sgel->FlagsLength &
+ (MPI2_SGE_FLAGS_HOST_TO_IOC << MPI2_SGE_FLAGS_SHIFT))
+ is_write = 1;
+
+ for (i = 0; i < MPT_MIN_PHYS_SEGMENTS + ioc->facts.MaxChainDepth; i++) {
+
+ sgl_flags = (sgel->FlagsLength >> MPI2_SGE_FLAGS_SHIFT);
+
+ switch (sgl_flags & MPI2_SGE_FLAGS_ELEMENT_MASK) {
+ case MPI2_SGE_FLAGS_CHAIN_ELEMENT:
+ /*
+ * Helper function which on passing
+ * chain_buffer_dma returns chain_buffer. Get
+ * the virtual address for sgel->Address
+ */
+ sgel_next =
+ _base_get_chain_buffer_dma_to_chain_buffer(ioc,
+ sgel->Address);
+ if (sgel_next == NULL)
+ return;
+ /*
+ * This is coping 128 byte chain
+ * frame (not a host buffer)
+ */
+ dst_chain_addr[sge_chain_count] =
+ _base_get_chain(ioc,
+ smid, sge_chain_count);
+ src_chain_addr[sge_chain_count] =
+ (void *) sgel_next;
+ dst_addr_phys =
+ _base_get_chain_phys(ioc,
+ smid, sge_chain_count);
+ sgel->Address = (dma_addr_t)dst_addr_phys;
+ sgel = sgel_next;
+ sge_chain_count++;
+ break;
+ case MPI2_SGE_FLAGS_SIMPLE_ELEMENT:
+ if (is_write) {
+ if (is_scsiio_req) {
+ _base_clone_to_sys_mem(buff_ptr,
+ sg_virt(sg_scmd),
+ (sgel->FlagsLength & 0x00ffffff));
+ sgel->Address =
+ (dma_addr_t)buff_ptr_phys;
+ } else {
+ _base_clone_to_sys_mem(buff_ptr,
+ ioc->config_vaddr,
+ (sgel->FlagsLength & 0x00ffffff));
+ sgel->Address =
+ (dma_addr_t)buff_ptr_phys;
+ }
+ }
+ buff_ptr += (sgel->FlagsLength & 0x00ffffff);
+ buff_ptr_phys += (sgel->FlagsLength & 0x00ffffff);
+ if ((sgel->FlagsLength &
+ (MPI2_SGE_FLAGS_END_OF_BUFFER
+ << MPI2_SGE_FLAGS_SHIFT)))
+ goto eob_clone_chain;
+ else {
+ /*
+ * Every single element in MPT will have
+ * associated sg_next. Better to sanity that
+ * sg_next is not NULL, but it will be a bug
+ * if it is null.
+ */
+ if (is_scsiio_req) {
+ sg_scmd = sg_next(sg_scmd);
+ if (sg_scmd)
+ sgel++;
+ else
+ goto eob_clone_chain;
+ }
+ }
+ break;
+ }
+ }
+
+eob_clone_chain:
+ for (i = 0; i < sge_chain_count; i++) {
+ if (is_scsiio_req)
+ _base_clone_to_sys_mem(dst_chain_addr[i],
+ src_chain_addr[i], ioc->request_sz);
+ }
+}
+
+/**
* mpt3sas_remove_dead_ioc_func - kthread context to remove dead ioc
* @arg: input argument, used to derive ioc
*
@@ -3295,7 +3505,7 @@ _base_put_smid_nvme_encap_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid)
/**
* _base_put_smid_default - Default, primarily used for config pages
- * use Atomic Request Descriptor
+ * use Atomic Request Descriptor
* @ioc: per adapter object
* @smid: system request message index
*
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 2529d25..4fd582b 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -95,6 +95,8 @@
#define MPT_MIN_PHYS_SEGMENTS 16
#define MPT_KDUMP_MIN_PHYS_SEGMENTS 32
+#define MCPU_MAX_CHAINS_PER_IO 3
+
#ifdef CONFIG_SCSI_MPT3SAS_MAX_SGE
#define MPT3SAS_SG_DEPTH CONFIG_SCSI_MPT3SAS_MAX_SGE
#else
@@ -1238,6 +1240,7 @@ struct MPT3SAS_ADAPTER {
u16 config_page_sz;
void *config_page;
dma_addr_t config_page_dma;
+ void *config_vaddr;
/* scsiio request */
u16 hba_queue_depth;
diff --git a/drivers/scsi/mpt3sas/mpt3sas_config.c b/drivers/scsi/mpt3sas/mpt3sas_config.c
index 1c747cf..0dba3c4 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_config.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_config.c
@@ -219,6 +219,7 @@ _config_alloc_config_dma_memory(struct MPT3SAS_ADAPTER *ioc,
mem->page = ioc->config_page;
mem->page_dma = ioc->config_page_dma;
}
+ ioc->config_vaddr = mem->page;
return r;
}
--
2.5.5
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 4/6] mpt3sas: Introduce Base function for cloning.
@ 2018-01-19 12:37 ` Suganath Prabu S
0 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu S @ 2018-01-19 12:37 UTC (permalink / raw)
All scsi IO's and config requests data buffer and
sgl are cloned to system memory in _clone_sg_entries
before submitting it to Firmware.
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani at broadcom.com>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 212 +++++++++++++++++++++++++++++++++-
drivers/scsi/mpt3sas/mpt3sas_base.h | 3 +
drivers/scsi/mpt3sas/mpt3sas_config.c | 1 +
3 files changed, 215 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index dc289c0..40a1806 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -126,6 +126,23 @@ module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug,
param_get_int, &mpt3sas_fwfault_debug, 0644);
/**
+ * _base_clone_to_sys_mem - Writes/copies data to system/BAR0 region
+ *
+ * @dst_iomem: Pointer to the destinaltion location in BAR0 space.
+ * @src: Pointer to the Source data.
+ * @size: Size of data to be copied.
+ */
+static void
+_base_clone_to_sys_mem(void *dst_iomem, void *src, u32 size)
+{
+ int i;
+ __le32 *src_virt_mem = (__le32 *)(src);
+
+ for (i = 0; i < size/4; i++)
+ writel(cpu_to_le32(src_virt_mem[i]), dst_iomem + (i * 4));
+}
+
+/**
* _base_get_chain - Calculates and Returns virtual chain address
* for the provided smid in BAR0 space.
*
@@ -219,6 +236,199 @@ _base_get_buffer_phys_bar0(struct MPT3SAS_ADAPTER *ioc, u16 smid)
}
/**
+ * _base_get_chain_buffer_dma_to_chain_buffer - Iterates chain
+ * lookup list and Provides chain_buffer
+ * address for the matching dma address.
+ * (Each smid can have 64K starts from 17024)
+ *
+ * @ioc: per adapter object
+ * @chain_buffer_dma: Chain buffer dma address.
+ *
+ * @Returns - Pointer to chain buffer. Or Null on Failure.
+ */
+static void *
+_base_get_chain_buffer_dma_to_chain_buffer(struct MPT3SAS_ADAPTER *ioc,
+ dma_addr_t chain_buffer_dma)
+{
+ u16 index;
+
+ for (index = 0; index < ioc->chain_depth; index++) {
+ if (ioc->chain_lookup[index].chain_buffer_dma ==
+ chain_buffer_dma)
+ return ioc->chain_lookup[index].chain_buffer;
+ }
+ pr_info(MPT3SAS_FMT
+ "Provided chain_buffer_dma address is not in the lookup list\n",
+ ioc->name);
+ return NULL;
+}
+
+/**
+ * _clone_sg_entries - MPI EP's scsiio and config requests
+ * are handled here. Base function for
+ * double buffering, before submitting
+ * the requests.
+ *
+ * @ioc: per adapter object.
+ * @mpi_request: mf request pointer.
+ * @smid: system request message index.
+ *
+ * @Returns: Nothing.
+ */
+static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,
+ void *mpi_request, u16 smid)
+{
+ Mpi2SGESimple32_t *sgel, *sgel_next;
+ u32 sgl_flags, sge_chain_count = 0;
+ bool is_write = 0;
+ u16 i = 0;
+ void *buffer_iomem, *buffer_iomem_phys;
+ void *buff_ptr, *buff_ptr_phys;
+ void *dst_chain_addr[MCPU_MAX_CHAINS_PER_IO];
+ void *src_chain_addr[MCPU_MAX_CHAINS_PER_IO], *dst_addr_phys;
+ MPI2RequestHeader_t *request_hdr;
+ struct scsi_cmnd *scmd;
+ struct scatterlist *sg_scmd = NULL;
+ int is_scsiio_req = 0;
+
+ request_hdr = (MPI2RequestHeader_t *) mpi_request;
+
+ if (request_hdr->Function == MPI2_FUNCTION_SCSI_IO_REQUEST) {
+ Mpi25SCSIIORequest_t *scsiio_request =
+ (Mpi25SCSIIORequest_t *)mpi_request;
+ sgel = (Mpi2SGESimple32_t *) &scsiio_request->SGL;
+ is_scsiio_req = 1;
+ } else if (request_hdr->Function == MPI2_FUNCTION_CONFIG) {
+ Mpi2ConfigRequest_t *config_req =
+ (Mpi2ConfigRequest_t *)mpi_request;
+ sgel = (Mpi2SGESimple32_t *) &config_req->PageBufferSGE;
+ } else
+ return;
+
+ /* From smid we can get scsi_cmd, once we have sg_scmd,
+ * we just need to get sg_virt and sg_next to get virual
+ * address associated with sgel->Address.
+ */
+
+ if (is_scsiio_req) {
+ /* Get scsi_cmd using smid */
+ scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
+ if (scmd == NULL) {
+ pr_err(MPT3SAS_FMT "scmd is NULL\n", ioc->name);
+ return;
+ }
+
+ /* Get sg_scmd from scmd provided */
+ sg_scmd = scsi_sglist(scmd);
+ }
+
+ /*
+ * 0 - 255 System register
+ * 256 - 4352 MPI Frame. (This is based on maxCredit 32)
+ * 4352 - 4864 Reply_free pool (512 byte is reserved
+ * considering maxCredit 32. Reply need extra
+ * room, for mCPU case kept four times of
+ * maxCredit).
+ * 4864 - 17152 SGE chain element. (32cmd * 3 chain of
+ * 128 byte size = 12288)
+ * 17152 - x Host buffer mapped with smid.
+ * (Each smid can have 64K Max IO.)
+ * BAR0+Last 1K MSIX Addr and Data
+ * Total size in use 2113664 bytes of 4MB BAR0
+ */
+
+ buffer_iomem = _base_get_buffer_bar0(ioc, smid);
+ buffer_iomem_phys = _base_get_buffer_phys_bar0(ioc, smid);
+
+ buff_ptr = buffer_iomem;
+ buff_ptr_phys = buffer_iomem_phys;
+
+ if (sgel->FlagsLength &
+ (MPI2_SGE_FLAGS_HOST_TO_IOC << MPI2_SGE_FLAGS_SHIFT))
+ is_write = 1;
+
+ for (i = 0; i < MPT_MIN_PHYS_SEGMENTS + ioc->facts.MaxChainDepth; i++) {
+
+ sgl_flags = (sgel->FlagsLength >> MPI2_SGE_FLAGS_SHIFT);
+
+ switch (sgl_flags & MPI2_SGE_FLAGS_ELEMENT_MASK) {
+ case MPI2_SGE_FLAGS_CHAIN_ELEMENT:
+ /*
+ * Helper function which on passing
+ * chain_buffer_dma returns chain_buffer. Get
+ * the virtual address for sgel->Address
+ */
+ sgel_next =
+ _base_get_chain_buffer_dma_to_chain_buffer(ioc,
+ sgel->Address);
+ if (sgel_next == NULL)
+ return;
+ /*
+ * This is coping 128 byte chain
+ * frame (not a host buffer)
+ */
+ dst_chain_addr[sge_chain_count] =
+ _base_get_chain(ioc,
+ smid, sge_chain_count);
+ src_chain_addr[sge_chain_count] =
+ (void *) sgel_next;
+ dst_addr_phys =
+ _base_get_chain_phys(ioc,
+ smid, sge_chain_count);
+ sgel->Address = (dma_addr_t)dst_addr_phys;
+ sgel = sgel_next;
+ sge_chain_count++;
+ break;
+ case MPI2_SGE_FLAGS_SIMPLE_ELEMENT:
+ if (is_write) {
+ if (is_scsiio_req) {
+ _base_clone_to_sys_mem(buff_ptr,
+ sg_virt(sg_scmd),
+ (sgel->FlagsLength & 0x00ffffff));
+ sgel->Address =
+ (dma_addr_t)buff_ptr_phys;
+ } else {
+ _base_clone_to_sys_mem(buff_ptr,
+ ioc->config_vaddr,
+ (sgel->FlagsLength & 0x00ffffff));
+ sgel->Address =
+ (dma_addr_t)buff_ptr_phys;
+ }
+ }
+ buff_ptr += (sgel->FlagsLength & 0x00ffffff);
+ buff_ptr_phys += (sgel->FlagsLength & 0x00ffffff);
+ if ((sgel->FlagsLength &
+ (MPI2_SGE_FLAGS_END_OF_BUFFER
+ << MPI2_SGE_FLAGS_SHIFT)))
+ goto eob_clone_chain;
+ else {
+ /*
+ * Every single element in MPT will have
+ * associated sg_next. Better to sanity that
+ * sg_next is not NULL, but it will be a bug
+ * if it is null.
+ */
+ if (is_scsiio_req) {
+ sg_scmd = sg_next(sg_scmd);
+ if (sg_scmd)
+ sgel++;
+ else
+ goto eob_clone_chain;
+ }
+ }
+ break;
+ }
+ }
+
+eob_clone_chain:
+ for (i = 0; i < sge_chain_count; i++) {
+ if (is_scsiio_req)
+ _base_clone_to_sys_mem(dst_chain_addr[i],
+ src_chain_addr[i], ioc->request_sz);
+ }
+}
+
+/**
* mpt3sas_remove_dead_ioc_func - kthread context to remove dead ioc
* @arg: input argument, used to derive ioc
*
@@ -3295,7 +3505,7 @@ _base_put_smid_nvme_encap_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid)
/**
* _base_put_smid_default - Default, primarily used for config pages
- * use Atomic Request Descriptor
+ * use Atomic Request Descriptor
* @ioc: per adapter object
* @smid: system request message index
*
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 2529d25..4fd582b 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -95,6 +95,8 @@
#define MPT_MIN_PHYS_SEGMENTS 16
#define MPT_KDUMP_MIN_PHYS_SEGMENTS 32
+#define MCPU_MAX_CHAINS_PER_IO 3
+
#ifdef CONFIG_SCSI_MPT3SAS_MAX_SGE
#define MPT3SAS_SG_DEPTH CONFIG_SCSI_MPT3SAS_MAX_SGE
#else
@@ -1238,6 +1240,7 @@ struct MPT3SAS_ADAPTER {
u16 config_page_sz;
void *config_page;
dma_addr_t config_page_dma;
+ void *config_vaddr;
/* scsiio request */
u16 hba_queue_depth;
diff --git a/drivers/scsi/mpt3sas/mpt3sas_config.c b/drivers/scsi/mpt3sas/mpt3sas_config.c
index 1c747cf..0dba3c4 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_config.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_config.c
@@ -219,6 +219,7 @@ _config_alloc_config_dma_memory(struct MPT3SAS_ADAPTER *ioc,
mem->page = ioc->config_page;
mem->page_dma = ioc->config_page_dma;
}
+ ioc->config_vaddr = mem->page;
return r;
}
--
2.5.5
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 5/6] mpt3sas: Introduce function to clone mpi request.
2018-01-19 12:37 ` Suganath Prabu S
@ 2018-01-19 12:37 ` Suganath Prabu S
-1 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu S @ 2018-01-19 12:37 UTC (permalink / raw)
To: linux-scsi, linux-nvme
Cc: Sathya.Prakash, sreekanth.reddy, chaitra.basappa, Suganath Prabu S
1) Added function _base_clone_mpi_to_sys_mem to clone
MPI request into system BAR0 mapped region.
2) Seperate out MPI Endpoint IO submissions to function
_base_put_smid_mpi_ep_scsi_io.
3) MPI EP requests are submitted in two 32 bit MMIO writes.
from _base_mpi_ep_writeq.
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 131 +++++++++++++++++++++++++++++++++---
1 file changed, 123 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 40a1806..0248058 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -126,6 +126,24 @@ module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug,
param_get_int, &mpt3sas_fwfault_debug, 0644);
/**
+ * _base_clone_mpi_to_sys_mem - Writes/copies MPI frames
+ * to system/BAR0 region.
+ *
+ * @dst_iomem: Pointer to the destinaltion location in BAR0 space.
+ * @src: Pointer to the Source data.
+ * @size: Size of data to be copied.
+ */
+static void
+_base_clone_mpi_to_sys_mem(void *dst_iomem, void *src, u32 size)
+{
+ int i;
+ __le32 *src_virt_mem = (__le32 *)src;
+
+ for (i = 0; i < size/4; i++)
+ writel(cpu_to_le32(src_virt_mem[i]), dst_iomem + (i * 4));
+}
+
+/**
* _base_clone_to_sys_mem - Writes/copies data to system/BAR0 region
*
* @dst_iomem: Pointer to the destinaltion location in BAR0 space.
@@ -3265,6 +3283,29 @@ mpt3sas_base_free_smid(struct MPT3SAS_ADAPTER *ioc, u16 smid)
}
/**
+ * _base_mpi_ep_writeq - 32 bit write to MMIO
+ * @b: data payload
+ * @addr: address in MMIO space
+ * @writeq_lock: spin lock
+ *
+ * This special handling for MPI EP to take care of 32 bit
+ * environment where its not quarenteed to send the entire word
+ * in one transfer.
+ */
+static inline void
+_base_mpi_ep_writeq(__u64 b, volatile void __iomem *addr,
+ spinlock_t *writeq_lock)
+{
+ unsigned long flags;
+ __u64 data_out = cpu_to_le64(b);
+
+ spin_lock_irqsave(writeq_lock, flags);
+ writel((u32)(data_out), addr);
+ writel((u32)(data_out >> 32), (addr + 4));
+ spin_unlock_irqrestore(writeq_lock, flags);
+}
+
+/**
* _base_writeq - 64 bit write to MMIO
* @ioc: per adapter object
* @b: data payload
@@ -3296,6 +3337,36 @@ _base_writeq(__u64 b, volatile void __iomem *addr, spinlock_t *writeq_lock)
#endif
/**
+ * _base_put_smid_mpi_ep_scsi_io - send SCSI_IO request to firmware
+ * @ioc: per adapter object
+ * @smid: system request message index
+ * @handle: device handle
+ *
+ * Return nothing.
+ */
+static void
+_base_put_smid_mpi_ep_scsi_io(struct MPT3SAS_ADAPTER *ioc, u16 smid, u16 handle)
+{
+ Mpi2RequestDescriptorUnion_t descriptor;
+ u64 *request = (u64 *)&descriptor;
+ void *mpi_req_iomem;
+ __le32 *mfp = (__le32 *)mpt3sas_base_get_msg_frame(ioc, smid);
+
+ _clone_sg_entries(ioc, (void *) mfp, smid);
+ mpi_req_iomem = (void *)ioc->chip +
+ MPI_FRAME_START_OFFSET + (smid * ioc->request_sz);
+ _base_clone_mpi_to_sys_mem(mpi_req_iomem, (void *)mfp,
+ ioc->request_sz);
+ descriptor.SCSIIO.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO;
+ descriptor.SCSIIO.MSIxIndex = _base_get_msix_index(ioc);
+ descriptor.SCSIIO.SMID = cpu_to_le16(smid);
+ descriptor.SCSIIO.DevHandle = cpu_to_le16(handle);
+ descriptor.SCSIIO.LMID = 0;
+ _base_mpi_ep_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
+ &ioc->scsi_lookup_lock);
+}
+
+/**
* _base_put_smid_scsi_io - send SCSI_IO request to firmware
* @ioc: per adapter object
* @smid: system request message index
@@ -3356,7 +3427,23 @@ _base_put_smid_hi_priority(struct MPT3SAS_ADAPTER *ioc, u16 smid,
u16 msix_task)
{
Mpi2RequestDescriptorUnion_t descriptor;
- u64 *request = (u64 *)&descriptor;
+ void *mpi_req_iomem;
+ u64 *request;
+
+ if (ioc->is_mcpu_endpoint) {
+ MPI2RequestHeader_t *request_hdr;
+
+ __le32 *mfp = (__le32 *)mpt3sas_base_get_msg_frame(ioc, smid);
+
+ request_hdr = (MPI2RequestHeader_t *)mfp;
+ /* TBD 256 is offset within sys register. */
+ mpi_req_iomem = (void *)ioc->chip + MPI_FRAME_START_OFFSET
+ + (smid * ioc->request_sz);
+ _base_clone_mpi_to_sys_mem(mpi_req_iomem, (void *)mfp,
+ ioc->request_sz);
+ }
+
+ request = (u64 *)&descriptor;
descriptor.HighPriority.RequestFlags =
MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY;
@@ -3364,8 +3451,13 @@ _base_put_smid_hi_priority(struct MPT3SAS_ADAPTER *ioc, u16 smid,
descriptor.HighPriority.SMID = cpu_to_le16(smid);
descriptor.HighPriority.LMID = 0;
descriptor.HighPriority.Reserved1 = 0;
- _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
- &ioc->scsi_lookup_lock);
+ if (ioc->is_mcpu_endpoint)
+ _base_mpi_ep_writeq(*request,
+ &ioc->chip->RequestDescriptorPostLow,
+ &ioc->scsi_lookup_lock);
+ else
+ _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
+ &ioc->scsi_lookup_lock);
}
/**
@@ -3403,15 +3495,35 @@ static void
_base_put_smid_default(struct MPT3SAS_ADAPTER *ioc, u16 smid)
{
Mpi2RequestDescriptorUnion_t descriptor;
- u64 *request = (u64 *)&descriptor;
+ void *mpi_req_iomem;
+ u64 *request;
+ MPI2RequestHeader_t *request_hdr;
+ if (ioc->is_mcpu_endpoint) {
+ __le32 *mfp = (__le32 *)mpt3sas_base_get_msg_frame(ioc, smid);
+
+ request_hdr = (MPI2RequestHeader_t *)mfp;
+
+ _clone_sg_entries(ioc, (void *) mfp, smid);
+ /* TBD 256 is offset within sys register */
+ mpi_req_iomem = (void *)ioc->chip +
+ MPI_FRAME_START_OFFSET + (smid * ioc->request_sz);
+ _base_clone_mpi_to_sys_mem(mpi_req_iomem, (void *)mfp,
+ ioc->request_sz);
+ }
+ request = (u64 *)&descriptor;
descriptor.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
descriptor.Default.MSIxIndex = _base_get_msix_index(ioc);
descriptor.Default.SMID = cpu_to_le16(smid);
descriptor.Default.LMID = 0;
descriptor.Default.DescriptorTypeDependent = 0;
- _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
- &ioc->scsi_lookup_lock);
+ if (ioc->is_mcpu_endpoint)
+ _base_mpi_ep_writeq(*request,
+ &ioc->chip->RequestDescriptorPostLow,
+ &ioc->scsi_lookup_lock);
+ else
+ _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
+ &ioc->scsi_lookup_lock);
}
/**
@@ -3505,7 +3617,7 @@ _base_put_smid_nvme_encap_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid)
/**
* _base_put_smid_default - Default, primarily used for config pages
- * use Atomic Request Descriptor
+ * use Atomic Request Descriptor
* @ioc: per adapter object
* @smid: system request message index
*
@@ -6330,7 +6442,10 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
ioc->put_smid_nvme_encap = &_base_put_smid_nvme_encap_atomic;
} else {
ioc->put_smid_default = &_base_put_smid_default;
- ioc->put_smid_scsi_io = &_base_put_smid_scsi_io;
+ if (ioc->is_mcpu_endpoint)
+ ioc->put_smid_scsi_io = &_base_put_smid_mpi_ep_scsi_io;
+ else
+ ioc->put_smid_scsi_io = &_base_put_smid_scsi_io;
ioc->put_smid_fast_path = &_base_put_smid_fast_path;
ioc->put_smid_hi_priority = &_base_put_smid_hi_priority;
ioc->put_smid_nvme_encap = &_base_put_smid_nvme_encap;
--
2.5.5
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 5/6] mpt3sas: Introduce function to clone mpi request.
@ 2018-01-19 12:37 ` Suganath Prabu S
0 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu S @ 2018-01-19 12:37 UTC (permalink / raw)
1) Added function _base_clone_mpi_to_sys_mem to clone
MPI request into system BAR0 mapped region.
2) Seperate out MPI Endpoint IO submissions to function
_base_put_smid_mpi_ep_scsi_io.
3) MPI EP requests are submitted in two 32 bit MMIO writes.
from _base_mpi_ep_writeq.
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani at broadcom.com>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 131 +++++++++++++++++++++++++++++++++---
1 file changed, 123 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 40a1806..0248058 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -126,6 +126,24 @@ module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug,
param_get_int, &mpt3sas_fwfault_debug, 0644);
/**
+ * _base_clone_mpi_to_sys_mem - Writes/copies MPI frames
+ * to system/BAR0 region.
+ *
+ * @dst_iomem: Pointer to the destinaltion location in BAR0 space.
+ * @src: Pointer to the Source data.
+ * @size: Size of data to be copied.
+ */
+static void
+_base_clone_mpi_to_sys_mem(void *dst_iomem, void *src, u32 size)
+{
+ int i;
+ __le32 *src_virt_mem = (__le32 *)src;
+
+ for (i = 0; i < size/4; i++)
+ writel(cpu_to_le32(src_virt_mem[i]), dst_iomem + (i * 4));
+}
+
+/**
* _base_clone_to_sys_mem - Writes/copies data to system/BAR0 region
*
* @dst_iomem: Pointer to the destinaltion location in BAR0 space.
@@ -3265,6 +3283,29 @@ mpt3sas_base_free_smid(struct MPT3SAS_ADAPTER *ioc, u16 smid)
}
/**
+ * _base_mpi_ep_writeq - 32 bit write to MMIO
+ * @b: data payload
+ * @addr: address in MMIO space
+ * @writeq_lock: spin lock
+ *
+ * This special handling for MPI EP to take care of 32 bit
+ * environment where its not quarenteed to send the entire word
+ * in one transfer.
+ */
+static inline void
+_base_mpi_ep_writeq(__u64 b, volatile void __iomem *addr,
+ spinlock_t *writeq_lock)
+{
+ unsigned long flags;
+ __u64 data_out = cpu_to_le64(b);
+
+ spin_lock_irqsave(writeq_lock, flags);
+ writel((u32)(data_out), addr);
+ writel((u32)(data_out >> 32), (addr + 4));
+ spin_unlock_irqrestore(writeq_lock, flags);
+}
+
+/**
* _base_writeq - 64 bit write to MMIO
* @ioc: per adapter object
* @b: data payload
@@ -3296,6 +3337,36 @@ _base_writeq(__u64 b, volatile void __iomem *addr, spinlock_t *writeq_lock)
#endif
/**
+ * _base_put_smid_mpi_ep_scsi_io - send SCSI_IO request to firmware
+ * @ioc: per adapter object
+ * @smid: system request message index
+ * @handle: device handle
+ *
+ * Return nothing.
+ */
+static void
+_base_put_smid_mpi_ep_scsi_io(struct MPT3SAS_ADAPTER *ioc, u16 smid, u16 handle)
+{
+ Mpi2RequestDescriptorUnion_t descriptor;
+ u64 *request = (u64 *)&descriptor;
+ void *mpi_req_iomem;
+ __le32 *mfp = (__le32 *)mpt3sas_base_get_msg_frame(ioc, smid);
+
+ _clone_sg_entries(ioc, (void *) mfp, smid);
+ mpi_req_iomem = (void *)ioc->chip +
+ MPI_FRAME_START_OFFSET + (smid * ioc->request_sz);
+ _base_clone_mpi_to_sys_mem(mpi_req_iomem, (void *)mfp,
+ ioc->request_sz);
+ descriptor.SCSIIO.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO;
+ descriptor.SCSIIO.MSIxIndex = _base_get_msix_index(ioc);
+ descriptor.SCSIIO.SMID = cpu_to_le16(smid);
+ descriptor.SCSIIO.DevHandle = cpu_to_le16(handle);
+ descriptor.SCSIIO.LMID = 0;
+ _base_mpi_ep_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
+ &ioc->scsi_lookup_lock);
+}
+
+/**
* _base_put_smid_scsi_io - send SCSI_IO request to firmware
* @ioc: per adapter object
* @smid: system request message index
@@ -3356,7 +3427,23 @@ _base_put_smid_hi_priority(struct MPT3SAS_ADAPTER *ioc, u16 smid,
u16 msix_task)
{
Mpi2RequestDescriptorUnion_t descriptor;
- u64 *request = (u64 *)&descriptor;
+ void *mpi_req_iomem;
+ u64 *request;
+
+ if (ioc->is_mcpu_endpoint) {
+ MPI2RequestHeader_t *request_hdr;
+
+ __le32 *mfp = (__le32 *)mpt3sas_base_get_msg_frame(ioc, smid);
+
+ request_hdr = (MPI2RequestHeader_t *)mfp;
+ /* TBD 256 is offset within sys register. */
+ mpi_req_iomem = (void *)ioc->chip + MPI_FRAME_START_OFFSET
+ + (smid * ioc->request_sz);
+ _base_clone_mpi_to_sys_mem(mpi_req_iomem, (void *)mfp,
+ ioc->request_sz);
+ }
+
+ request = (u64 *)&descriptor;
descriptor.HighPriority.RequestFlags =
MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY;
@@ -3364,8 +3451,13 @@ _base_put_smid_hi_priority(struct MPT3SAS_ADAPTER *ioc, u16 smid,
descriptor.HighPriority.SMID = cpu_to_le16(smid);
descriptor.HighPriority.LMID = 0;
descriptor.HighPriority.Reserved1 = 0;
- _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
- &ioc->scsi_lookup_lock);
+ if (ioc->is_mcpu_endpoint)
+ _base_mpi_ep_writeq(*request,
+ &ioc->chip->RequestDescriptorPostLow,
+ &ioc->scsi_lookup_lock);
+ else
+ _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
+ &ioc->scsi_lookup_lock);
}
/**
@@ -3403,15 +3495,35 @@ static void
_base_put_smid_default(struct MPT3SAS_ADAPTER *ioc, u16 smid)
{
Mpi2RequestDescriptorUnion_t descriptor;
- u64 *request = (u64 *)&descriptor;
+ void *mpi_req_iomem;
+ u64 *request;
+ MPI2RequestHeader_t *request_hdr;
+ if (ioc->is_mcpu_endpoint) {
+ __le32 *mfp = (__le32 *)mpt3sas_base_get_msg_frame(ioc, smid);
+
+ request_hdr = (MPI2RequestHeader_t *)mfp;
+
+ _clone_sg_entries(ioc, (void *) mfp, smid);
+ /* TBD 256 is offset within sys register */
+ mpi_req_iomem = (void *)ioc->chip +
+ MPI_FRAME_START_OFFSET + (smid * ioc->request_sz);
+ _base_clone_mpi_to_sys_mem(mpi_req_iomem, (void *)mfp,
+ ioc->request_sz);
+ }
+ request = (u64 *)&descriptor;
descriptor.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
descriptor.Default.MSIxIndex = _base_get_msix_index(ioc);
descriptor.Default.SMID = cpu_to_le16(smid);
descriptor.Default.LMID = 0;
descriptor.Default.DescriptorTypeDependent = 0;
- _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
- &ioc->scsi_lookup_lock);
+ if (ioc->is_mcpu_endpoint)
+ _base_mpi_ep_writeq(*request,
+ &ioc->chip->RequestDescriptorPostLow,
+ &ioc->scsi_lookup_lock);
+ else
+ _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
+ &ioc->scsi_lookup_lock);
}
/**
@@ -3505,7 +3617,7 @@ _base_put_smid_nvme_encap_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid)
/**
* _base_put_smid_default - Default, primarily used for config pages
- * use Atomic Request Descriptor
+ * use Atomic Request Descriptor
* @ioc: per adapter object
* @smid: system request message index
*
@@ -6330,7 +6442,10 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
ioc->put_smid_nvme_encap = &_base_put_smid_nvme_encap_atomic;
} else {
ioc->put_smid_default = &_base_put_smid_default;
- ioc->put_smid_scsi_io = &_base_put_smid_scsi_io;
+ if (ioc->is_mcpu_endpoint)
+ ioc->put_smid_scsi_io = &_base_put_smid_mpi_ep_scsi_io;
+ else
+ ioc->put_smid_scsi_io = &_base_put_smid_scsi_io;
ioc->put_smid_fast_path = &_base_put_smid_fast_path;
ioc->put_smid_hi_priority = &_base_put_smid_hi_priority;
ioc->put_smid_nvme_encap = &_base_put_smid_nvme_encap;
--
2.5.5
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 6/6] mpt3sas: Introduce function to clone mpi reply.
2018-01-19 12:37 ` Suganath Prabu S
@ 2018-01-19 12:37 ` Suganath Prabu S
-1 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu S @ 2018-01-19 12:37 UTC (permalink / raw)
To: linux-scsi, linux-nvme
Cc: Sathya.Prakash, sreekanth.reddy, chaitra.basappa, Suganath Prabu S
If the posted request has an error of any type, the IOC writes
a Reply message into a host-based system reply message frame.
This functions clone it in the BAR0 mapped region.
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 0248058..fa13916 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -126,6 +126,32 @@ module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug,
param_get_int, &mpt3sas_fwfault_debug, 0644);
/**
+ * _base_clone_reply_to_sys_mem - copies reply to reply free iomem
+ * in BAR0 space.
+ *
+ * @ioc: per adapter object
+ * @reply: reply message frame(lower 32bit addr)
+ * @index: System request message index.
+ *
+ * @Returns - Nothing
+ */
+static void
+_base_clone_reply_to_sys_mem(struct MPT3SAS_ADAPTER *ioc, U32 reply,
+ u32 index)
+{
+ /*
+ * 256 is offset within sys register.
+ * 256 offset MPI frame starts. Max MPI frame supported is 32.
+ * 32 * 128 = 4K. From here, Clone of reply free for mcpu starts
+ */
+ u16 cmd_credit = ioc->facts.RequestCredit + 1;
+ void *reply_free_iomem = (void *)ioc->chip + MPI_FRAME_START_OFFSET +
+ (cmd_credit * ioc->request_sz) + (index * sizeof(u32));
+
+ writel(cpu_to_le32(reply), reply_free_iomem);
+}
+
+/**
* _base_clone_mpi_to_sys_mem - Writes/copies MPI frames
* to system/BAR0 region.
*
@@ -1396,6 +1422,9 @@ _base_interrupt(int irq, void *bus_id)
0 : ioc->reply_free_host_index + 1;
ioc->reply_free[ioc->reply_free_host_index] =
cpu_to_le32(reply);
+ if (ioc->is_mcpu_endpoint)
+ _base_clone_reply_to_sys_mem(ioc, reply,
+ ioc->reply_free_host_index);
writel(ioc->reply_free_host_index,
&ioc->chip->ReplyFreeHostIndex);
}
@@ -6244,8 +6273,11 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc)
/* initialize Reply Free Queue */
for (i = 0, reply_address = (u32)ioc->reply_dma ;
i < ioc->reply_free_queue_depth ; i++, reply_address +=
- ioc->reply_sz)
+ ioc->reply_sz) {
ioc->reply_free[i] = cpu_to_le32(reply_address);
+ if (ioc->is_mcpu_endpoint)
+ _base_clone_reply_to_sys_mem(ioc, reply_address, i);
+ }
/* initialize reply queues */
if (ioc->is_driver_loading)
--
2.5.5
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 6/6] mpt3sas: Introduce function to clone mpi reply.
@ 2018-01-19 12:37 ` Suganath Prabu S
0 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu S @ 2018-01-19 12:37 UTC (permalink / raw)
If the posted request has an error of any type, the IOC writes
a Reply message into a host-based system reply message frame.
This functions clone it in the BAR0 mapped region.
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani at broadcom.com>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 0248058..fa13916 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -126,6 +126,32 @@ module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug,
param_get_int, &mpt3sas_fwfault_debug, 0644);
/**
+ * _base_clone_reply_to_sys_mem - copies reply to reply free iomem
+ * in BAR0 space.
+ *
+ * @ioc: per adapter object
+ * @reply: reply message frame(lower 32bit addr)
+ * @index: System request message index.
+ *
+ * @Returns - Nothing
+ */
+static void
+_base_clone_reply_to_sys_mem(struct MPT3SAS_ADAPTER *ioc, U32 reply,
+ u32 index)
+{
+ /*
+ * 256 is offset within sys register.
+ * 256 offset MPI frame starts. Max MPI frame supported is 32.
+ * 32 * 128 = 4K. From here, Clone of reply free for mcpu starts
+ */
+ u16 cmd_credit = ioc->facts.RequestCredit + 1;
+ void *reply_free_iomem = (void *)ioc->chip + MPI_FRAME_START_OFFSET +
+ (cmd_credit * ioc->request_sz) + (index * sizeof(u32));
+
+ writel(cpu_to_le32(reply), reply_free_iomem);
+}
+
+/**
* _base_clone_mpi_to_sys_mem - Writes/copies MPI frames
* to system/BAR0 region.
*
@@ -1396,6 +1422,9 @@ _base_interrupt(int irq, void *bus_id)
0 : ioc->reply_free_host_index + 1;
ioc->reply_free[ioc->reply_free_host_index] =
cpu_to_le32(reply);
+ if (ioc->is_mcpu_endpoint)
+ _base_clone_reply_to_sys_mem(ioc, reply,
+ ioc->reply_free_host_index);
writel(ioc->reply_free_host_index,
&ioc->chip->ReplyFreeHostIndex);
}
@@ -6244,8 +6273,11 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc)
/* initialize Reply Free Queue */
for (i = 0, reply_address = (u32)ioc->reply_dma ;
i < ioc->reply_free_queue_depth ; i++, reply_address +=
- ioc->reply_sz)
+ ioc->reply_sz) {
ioc->reply_free[i] = cpu_to_le32(reply_address);
+ if (ioc->is_mcpu_endpoint)
+ _base_clone_reply_to_sys_mem(ioc, reply_address, i);
+ }
/* initialize reply queues */
if (ioc->is_driver_loading)
--
2.5.5
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH 3/6] mpt3sas: Introduce API's to get BAR0 mapped buffer address.
2018-01-19 12:37 ` Suganath Prabu S
@ 2018-01-20 17:24 ` kbuild test robot
-1 siblings, 0 replies; 29+ messages in thread
From: kbuild test robot @ 2018-01-20 17:24 UTC (permalink / raw)
Cc: kbuild-all, linux-scsi, linux-nvme, Sathya.Prakash,
sreekanth.reddy, chaitra.basappa, Suganath Prabu S
[-- Attachment #1: Type: text/plain, Size: 2626 bytes --]
Hi Suganath,
I love your patch! Perhaps something to improve:
[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.15-rc8 next-20180119]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: i386-randconfig-x017-201803 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_get_chain_phys':
>> drivers/scsi/mpt3sas/mpt3sas_base.c:171:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
base_chain_phys = (void *)ioc->chip_phys + MPI_FRAME_START_OFFSET +
^
At top level:
drivers/scsi/mpt3sas/mpt3sas_base.c:212:1: warning: '_base_get_buffer_phys_bar0' defined but not used [-Wunused-function]
_base_get_buffer_phys_bar0(struct MPT3SAS_ADAPTER *ioc, u16 smid)
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_base.c:191:1: warning: '_base_get_buffer_bar0' defined but not used [-Wunused-function]
_base_get_buffer_bar0(struct MPT3SAS_ADAPTER *ioc, u16 smid)
^~~~~~~~~~~~~~~~~~~~~
vim +171 drivers/scsi/mpt3sas/mpt3sas_base.c
152
153 /**
154 * _base_get_chain_phys - Calculates and Returns physical address
155 * in BAR0 for scatter gather chains, for
156 * the provided smid.
157 *
158 * @ioc: per adapter object
159 * @smid: system request message index
160 * @sge_chain_count: Scatter gather chain count.
161 *
162 * @Return - Physical chain address.
163 */
164 static inline void *
165 _base_get_chain_phys(struct MPT3SAS_ADAPTER *ioc, u16 smid,
166 u8 sge_chain_count)
167 {
168 void *base_chain_phys, *chain_phys;
169 u16 cmd_credit = ioc->facts.RequestCredit + 1;
170
> 171 base_chain_phys = (void *)ioc->chip_phys + MPI_FRAME_START_OFFSET +
172 (cmd_credit * ioc->request_sz) +
173 REPLY_FREE_POOL_SIZE;
174 chain_phys = base_chain_phys + (smid * ioc->facts.MaxChainDepth *
175 ioc->request_sz) + (sge_chain_count * ioc->request_sz);
176 return chain_phys;
177 }
178
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29932 bytes --]
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 3/6] mpt3sas: Introduce API's to get BAR0 mapped buffer address.
@ 2018-01-20 17:24 ` kbuild test robot
0 siblings, 0 replies; 29+ messages in thread
From: kbuild test robot @ 2018-01-20 17:24 UTC (permalink / raw)
Hi Suganath,
I love your patch! Perhaps something to improve:
[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.15-rc8 next-20180119]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: i386-randconfig-x017-201803 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_get_chain_phys':
>> drivers/scsi/mpt3sas/mpt3sas_base.c:171:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
base_chain_phys = (void *)ioc->chip_phys + MPI_FRAME_START_OFFSET +
^
At top level:
drivers/scsi/mpt3sas/mpt3sas_base.c:212:1: warning: '_base_get_buffer_phys_bar0' defined but not used [-Wunused-function]
_base_get_buffer_phys_bar0(struct MPT3SAS_ADAPTER *ioc, u16 smid)
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_base.c:191:1: warning: '_base_get_buffer_bar0' defined but not used [-Wunused-function]
_base_get_buffer_bar0(struct MPT3SAS_ADAPTER *ioc, u16 smid)
^~~~~~~~~~~~~~~~~~~~~
vim +171 drivers/scsi/mpt3sas/mpt3sas_base.c
152
153 /**
154 * _base_get_chain_phys - Calculates and Returns physical address
155 * in BAR0 for scatter gather chains, for
156 * the provided smid.
157 *
158 * @ioc: per adapter object
159 * @smid: system request message index
160 * @sge_chain_count: Scatter gather chain count.
161 *
162 * @Return - Physical chain address.
163 */
164 static inline void *
165 _base_get_chain_phys(struct MPT3SAS_ADAPTER *ioc, u16 smid,
166 u8 sge_chain_count)
167 {
168 void *base_chain_phys, *chain_phys;
169 u16 cmd_credit = ioc->facts.RequestCredit + 1;
170
> 171 base_chain_phys = (void *)ioc->chip_phys + MPI_FRAME_START_OFFSET +
172 (cmd_credit * ioc->request_sz) +
173 REPLY_FREE_POOL_SIZE;
174 chain_phys = base_chain_phys + (smid * ioc->facts.MaxChainDepth *
175 ioc->request_sz) + (sge_chain_count * ioc->request_sz);
176 return chain_phys;
177 }
178
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 29932 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-nvme/attachments/20180121/26642ac9/attachment-0001.gz>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 4/6] mpt3sas: Introduce Base function for cloning.
2018-01-19 12:37 ` Suganath Prabu S
@ 2018-01-20 17:57 ` kbuild test robot
-1 siblings, 0 replies; 29+ messages in thread
From: kbuild test robot @ 2018-01-20 17:57 UTC (permalink / raw)
Cc: kbuild-all, linux-scsi, linux-nvme, Sathya.Prakash,
sreekanth.reddy, chaitra.basappa, Suganath Prabu S
[-- Attachment #1: Type: text/plain, Size: 8424 bytes --]
Hi Suganath,
I love your patch! Perhaps something to improve:
[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.15-rc8 next-20180119]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: i386-randconfig-i1-201802 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_get_chain_phys':
drivers/scsi/mpt3sas/mpt3sas_base.c:188:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
base_chain_phys = (void *)ioc->chip_phys + MPI_FRAME_START_OFFSET +
^
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean 'mpt3sas_scsih_issue_locked_tm'? [-Werror=implicit-function-declaration]
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mpt3sas_scsih_issue_locked_tm
drivers/scsi/mpt3sas/mpt3sas_base.c:315:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^
>> drivers/scsi/mpt3sas/mpt3sas_base.c:378:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
sgel->Address = (dma_addr_t)dst_addr_phys;
^
drivers/scsi/mpt3sas/mpt3sas_base.c:389:7: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
(dma_addr_t)buff_ptr_phys;
^
drivers/scsi/mpt3sas/mpt3sas_base.c:395:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
(dma_addr_t)buff_ptr_phys;
^
At top level:
drivers/scsi/mpt3sas/mpt3sas_base.c:278:13: warning: '_clone_sg_entries' defined but not used [-Wunused-function]
static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,
^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +378 drivers/scsi/mpt3sas/mpt3sas_base.c
265
266 /**
267 * _clone_sg_entries - MPI EP's scsiio and config requests
268 * are handled here. Base function for
269 * double buffering, before submitting
270 * the requests.
271 *
272 * @ioc: per adapter object.
273 * @mpi_request: mf request pointer.
274 * @smid: system request message index.
275 *
276 * @Returns: Nothing.
277 */
278 static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,
279 void *mpi_request, u16 smid)
280 {
281 Mpi2SGESimple32_t *sgel, *sgel_next;
282 u32 sgl_flags, sge_chain_count = 0;
283 bool is_write = 0;
284 u16 i = 0;
285 void *buffer_iomem, *buffer_iomem_phys;
286 void *buff_ptr, *buff_ptr_phys;
287 void *dst_chain_addr[MCPU_MAX_CHAINS_PER_IO];
288 void *src_chain_addr[MCPU_MAX_CHAINS_PER_IO], *dst_addr_phys;
289 MPI2RequestHeader_t *request_hdr;
290 struct scsi_cmnd *scmd;
291 struct scatterlist *sg_scmd = NULL;
292 int is_scsiio_req = 0;
293
294 request_hdr = (MPI2RequestHeader_t *) mpi_request;
295
296 if (request_hdr->Function == MPI2_FUNCTION_SCSI_IO_REQUEST) {
297 Mpi25SCSIIORequest_t *scsiio_request =
298 (Mpi25SCSIIORequest_t *)mpi_request;
299 sgel = (Mpi2SGESimple32_t *) &scsiio_request->SGL;
300 is_scsiio_req = 1;
301 } else if (request_hdr->Function == MPI2_FUNCTION_CONFIG) {
302 Mpi2ConfigRequest_t *config_req =
303 (Mpi2ConfigRequest_t *)mpi_request;
304 sgel = (Mpi2SGESimple32_t *) &config_req->PageBufferSGE;
305 } else
306 return;
307
308 /* From smid we can get scsi_cmd, once we have sg_scmd,
309 * we just need to get sg_virt and sg_next to get virual
310 * address associated with sgel->Address.
311 */
312
313 if (is_scsiio_req) {
314 /* Get scsi_cmd using smid */
> 315 scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
316 if (scmd == NULL) {
317 pr_err(MPT3SAS_FMT "scmd is NULL\n", ioc->name);
318 return;
319 }
320
321 /* Get sg_scmd from scmd provided */
322 sg_scmd = scsi_sglist(scmd);
323 }
324
325 /*
326 * 0 - 255 System register
327 * 256 - 4352 MPI Frame. (This is based on maxCredit 32)
328 * 4352 - 4864 Reply_free pool (512 byte is reserved
329 * considering maxCredit 32. Reply need extra
330 * room, for mCPU case kept four times of
331 * maxCredit).
332 * 4864 - 17152 SGE chain element. (32cmd * 3 chain of
333 * 128 byte size = 12288)
334 * 17152 - x Host buffer mapped with smid.
335 * (Each smid can have 64K Max IO.)
336 * BAR0+Last 1K MSIX Addr and Data
337 * Total size in use 2113664 bytes of 4MB BAR0
338 */
339
340 buffer_iomem = _base_get_buffer_bar0(ioc, smid);
341 buffer_iomem_phys = _base_get_buffer_phys_bar0(ioc, smid);
342
343 buff_ptr = buffer_iomem;
344 buff_ptr_phys = buffer_iomem_phys;
345
346 if (sgel->FlagsLength &
347 (MPI2_SGE_FLAGS_HOST_TO_IOC << MPI2_SGE_FLAGS_SHIFT))
348 is_write = 1;
349
350 for (i = 0; i < MPT_MIN_PHYS_SEGMENTS + ioc->facts.MaxChainDepth; i++) {
351
352 sgl_flags = (sgel->FlagsLength >> MPI2_SGE_FLAGS_SHIFT);
353
354 switch (sgl_flags & MPI2_SGE_FLAGS_ELEMENT_MASK) {
355 case MPI2_SGE_FLAGS_CHAIN_ELEMENT:
356 /*
357 * Helper function which on passing
358 * chain_buffer_dma returns chain_buffer. Get
359 * the virtual address for sgel->Address
360 */
361 sgel_next =
362 _base_get_chain_buffer_dma_to_chain_buffer(ioc,
363 sgel->Address);
364 if (sgel_next == NULL)
365 return;
366 /*
367 * This is coping 128 byte chain
368 * frame (not a host buffer)
369 */
370 dst_chain_addr[sge_chain_count] =
371 _base_get_chain(ioc,
372 smid, sge_chain_count);
373 src_chain_addr[sge_chain_count] =
374 (void *) sgel_next;
375 dst_addr_phys =
376 _base_get_chain_phys(ioc,
377 smid, sge_chain_count);
> 378 sgel->Address = (dma_addr_t)dst_addr_phys;
379 sgel = sgel_next;
380 sge_chain_count++;
381 break;
382 case MPI2_SGE_FLAGS_SIMPLE_ELEMENT:
383 if (is_write) {
384 if (is_scsiio_req) {
385 _base_clone_to_sys_mem(buff_ptr,
386 sg_virt(sg_scmd),
387 (sgel->FlagsLength & 0x00ffffff));
388 sgel->Address =
389 (dma_addr_t)buff_ptr_phys;
390 } else {
391 _base_clone_to_sys_mem(buff_ptr,
392 ioc->config_vaddr,
393 (sgel->FlagsLength & 0x00ffffff));
394 sgel->Address =
395 (dma_addr_t)buff_ptr_phys;
396 }
397 }
398 buff_ptr += (sgel->FlagsLength & 0x00ffffff);
399 buff_ptr_phys += (sgel->FlagsLength & 0x00ffffff);
400 if ((sgel->FlagsLength &
401 (MPI2_SGE_FLAGS_END_OF_BUFFER
402 << MPI2_SGE_FLAGS_SHIFT)))
403 goto eob_clone_chain;
404 else {
405 /*
406 * Every single element in MPT will have
407 * associated sg_next. Better to sanity that
408 * sg_next is not NULL, but it will be a bug
409 * if it is null.
410 */
411 if (is_scsiio_req) {
412 sg_scmd = sg_next(sg_scmd);
413 if (sg_scmd)
414 sgel++;
415 else
416 goto eob_clone_chain;
417 }
418 }
419 break;
420 }
421 }
422
423 eob_clone_chain:
424 for (i = 0; i < sge_chain_count; i++) {
425 if (is_scsiio_req)
426 _base_clone_to_sys_mem(dst_chain_addr[i],
427 src_chain_addr[i], ioc->request_sz);
428 }
429 }
430
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29458 bytes --]
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 4/6] mpt3sas: Introduce Base function for cloning.
@ 2018-01-20 17:57 ` kbuild test robot
0 siblings, 0 replies; 29+ messages in thread
From: kbuild test robot @ 2018-01-20 17:57 UTC (permalink / raw)
Hi Suganath,
I love your patch! Perhaps something to improve:
[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.15-rc8 next-20180119]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: i386-randconfig-i1-201802 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_get_chain_phys':
drivers/scsi/mpt3sas/mpt3sas_base.c:188:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
base_chain_phys = (void *)ioc->chip_phys + MPI_FRAME_START_OFFSET +
^
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean 'mpt3sas_scsih_issue_locked_tm'? [-Werror=implicit-function-declaration]
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mpt3sas_scsih_issue_locked_tm
drivers/scsi/mpt3sas/mpt3sas_base.c:315:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^
>> drivers/scsi/mpt3sas/mpt3sas_base.c:378:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
sgel->Address = (dma_addr_t)dst_addr_phys;
^
drivers/scsi/mpt3sas/mpt3sas_base.c:389:7: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
(dma_addr_t)buff_ptr_phys;
^
drivers/scsi/mpt3sas/mpt3sas_base.c:395:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
(dma_addr_t)buff_ptr_phys;
^
At top level:
drivers/scsi/mpt3sas/mpt3sas_base.c:278:13: warning: '_clone_sg_entries' defined but not used [-Wunused-function]
static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,
^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +378 drivers/scsi/mpt3sas/mpt3sas_base.c
265
266 /**
267 * _clone_sg_entries - MPI EP's scsiio and config requests
268 * are handled here. Base function for
269 * double buffering, before submitting
270 * the requests.
271 *
272 * @ioc: per adapter object.
273 * @mpi_request: mf request pointer.
274 * @smid: system request message index.
275 *
276 * @Returns: Nothing.
277 */
278 static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,
279 void *mpi_request, u16 smid)
280 {
281 Mpi2SGESimple32_t *sgel, *sgel_next;
282 u32 sgl_flags, sge_chain_count = 0;
283 bool is_write = 0;
284 u16 i = 0;
285 void *buffer_iomem, *buffer_iomem_phys;
286 void *buff_ptr, *buff_ptr_phys;
287 void *dst_chain_addr[MCPU_MAX_CHAINS_PER_IO];
288 void *src_chain_addr[MCPU_MAX_CHAINS_PER_IO], *dst_addr_phys;
289 MPI2RequestHeader_t *request_hdr;
290 struct scsi_cmnd *scmd;
291 struct scatterlist *sg_scmd = NULL;
292 int is_scsiio_req = 0;
293
294 request_hdr = (MPI2RequestHeader_t *) mpi_request;
295
296 if (request_hdr->Function == MPI2_FUNCTION_SCSI_IO_REQUEST) {
297 Mpi25SCSIIORequest_t *scsiio_request =
298 (Mpi25SCSIIORequest_t *)mpi_request;
299 sgel = (Mpi2SGESimple32_t *) &scsiio_request->SGL;
300 is_scsiio_req = 1;
301 } else if (request_hdr->Function == MPI2_FUNCTION_CONFIG) {
302 Mpi2ConfigRequest_t *config_req =
303 (Mpi2ConfigRequest_t *)mpi_request;
304 sgel = (Mpi2SGESimple32_t *) &config_req->PageBufferSGE;
305 } else
306 return;
307
308 /* From smid we can get scsi_cmd, once we have sg_scmd,
309 * we just need to get sg_virt and sg_next to get virual
310 * address associated with sgel->Address.
311 */
312
313 if (is_scsiio_req) {
314 /* Get scsi_cmd using smid */
> 315 scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
316 if (scmd == NULL) {
317 pr_err(MPT3SAS_FMT "scmd is NULL\n", ioc->name);
318 return;
319 }
320
321 /* Get sg_scmd from scmd provided */
322 sg_scmd = scsi_sglist(scmd);
323 }
324
325 /*
326 * 0 - 255 System register
327 * 256 - 4352 MPI Frame. (This is based on maxCredit 32)
328 * 4352 - 4864 Reply_free pool (512 byte is reserved
329 * considering maxCredit 32. Reply need extra
330 * room, for mCPU case kept four times of
331 * maxCredit).
332 * 4864 - 17152 SGE chain element. (32cmd * 3 chain of
333 * 128 byte size = 12288)
334 * 17152 - x Host buffer mapped with smid.
335 * (Each smid can have 64K Max IO.)
336 * BAR0+Last 1K MSIX Addr and Data
337 * Total size in use 2113664 bytes of 4MB BAR0
338 */
339
340 buffer_iomem = _base_get_buffer_bar0(ioc, smid);
341 buffer_iomem_phys = _base_get_buffer_phys_bar0(ioc, smid);
342
343 buff_ptr = buffer_iomem;
344 buff_ptr_phys = buffer_iomem_phys;
345
346 if (sgel->FlagsLength &
347 (MPI2_SGE_FLAGS_HOST_TO_IOC << MPI2_SGE_FLAGS_SHIFT))
348 is_write = 1;
349
350 for (i = 0; i < MPT_MIN_PHYS_SEGMENTS + ioc->facts.MaxChainDepth; i++) {
351
352 sgl_flags = (sgel->FlagsLength >> MPI2_SGE_FLAGS_SHIFT);
353
354 switch (sgl_flags & MPI2_SGE_FLAGS_ELEMENT_MASK) {
355 case MPI2_SGE_FLAGS_CHAIN_ELEMENT:
356 /*
357 * Helper function which on passing
358 * chain_buffer_dma returns chain_buffer. Get
359 * the virtual address for sgel->Address
360 */
361 sgel_next =
362 _base_get_chain_buffer_dma_to_chain_buffer(ioc,
363 sgel->Address);
364 if (sgel_next == NULL)
365 return;
366 /*
367 * This is coping 128 byte chain
368 * frame (not a host buffer)
369 */
370 dst_chain_addr[sge_chain_count] =
371 _base_get_chain(ioc,
372 smid, sge_chain_count);
373 src_chain_addr[sge_chain_count] =
374 (void *) sgel_next;
375 dst_addr_phys =
376 _base_get_chain_phys(ioc,
377 smid, sge_chain_count);
> 378 sgel->Address = (dma_addr_t)dst_addr_phys;
379 sgel = sgel_next;
380 sge_chain_count++;
381 break;
382 case MPI2_SGE_FLAGS_SIMPLE_ELEMENT:
383 if (is_write) {
384 if (is_scsiio_req) {
385 _base_clone_to_sys_mem(buff_ptr,
386 sg_virt(sg_scmd),
387 (sgel->FlagsLength & 0x00ffffff));
388 sgel->Address =
389 (dma_addr_t)buff_ptr_phys;
390 } else {
391 _base_clone_to_sys_mem(buff_ptr,
392 ioc->config_vaddr,
393 (sgel->FlagsLength & 0x00ffffff));
394 sgel->Address =
395 (dma_addr_t)buff_ptr_phys;
396 }
397 }
398 buff_ptr += (sgel->FlagsLength & 0x00ffffff);
399 buff_ptr_phys += (sgel->FlagsLength & 0x00ffffff);
400 if ((sgel->FlagsLength &
401 (MPI2_SGE_FLAGS_END_OF_BUFFER
402 << MPI2_SGE_FLAGS_SHIFT)))
403 goto eob_clone_chain;
404 else {
405 /*
406 * Every single element in MPT will have
407 * associated sg_next. Better to sanity that
408 * sg_next is not NULL, but it will be a bug
409 * if it is null.
410 */
411 if (is_scsiio_req) {
412 sg_scmd = sg_next(sg_scmd);
413 if (sg_scmd)
414 sgel++;
415 else
416 goto eob_clone_chain;
417 }
418 }
419 break;
420 }
421 }
422
423 eob_clone_chain:
424 for (i = 0; i < sge_chain_count; i++) {
425 if (is_scsiio_req)
426 _base_clone_to_sys_mem(dst_chain_addr[i],
427 src_chain_addr[i], ioc->request_sz);
428 }
429 }
430
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 29458 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-nvme/attachments/20180121/fc96af54/attachment-0001.gz>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 4/6] mpt3sas: Introduce Base function for cloning.
2018-01-19 12:37 ` Suganath Prabu S
@ 2018-01-20 18:07 ` kbuild test robot
-1 siblings, 0 replies; 29+ messages in thread
From: kbuild test robot @ 2018-01-20 18:07 UTC (permalink / raw)
Cc: kbuild-all, linux-scsi, linux-nvme, Sathya.Prakash,
sreekanth.reddy, chaitra.basappa, Suganath Prabu S
Hi Suganath,
I love your patch! Perhaps something to improve:
[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.15-rc8 next-20180119]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
>> drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: sparse: cast from restricted __le32
drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: expected unsigned int val
drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: got restricted __le32 <noident>
>> drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@
drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: expected void volatile
drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: got void COPYING CREDITS Documentation Kbuild Kconfig MAINTAINERS Makefile README arch block certs crypto drivers firmware fs include init ipc kernel lib mm net samples scripts security sound tools usr virt
drivers/scsi/mpt3sas/mpt3sas_base.c:162:24: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:315:24: sparse: undefined identifier 'mpt3sas_scsih_scsi_lookup_get'
drivers/scsi/mpt3sas/mpt3sas_base.c:1164:42: sparse: incorrect type in assignment (different base types) @@ expected unsigned short Event @@ got short Event @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1165:49: sparse: incorrect type in assignment (different base types) @@ expected unsigned int EventContext @@ got ed int EventContext @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1383:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1432:52: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:2964:32: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3411:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3433:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3456:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3477:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3498:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:4950:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:4971:20: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:4980:20: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:4994:36: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:6175:55: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:315:53: sparse: call with no type!
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mpt3sas_scsih_issue_locked_tm
drivers/scsi/mpt3sas/mpt3sas_base.c:315:8: warning: assignment makes pointer from integer without a cast
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^
At top level:
drivers/scsi/mpt3sas/mpt3sas_base.c:278:13: warning: '_clone_sg_entries' defined but not used
static void _clone_sg_entries(struct MPT3SAS_ADAPTER
^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +142 drivers/scsi/mpt3sas/mpt3sas_base.c
103
104 /**
105 * _scsih_set_fwfault_debug - global setting of ioc->fwfault_debug.
106 *
107 */
108 static int
109 _scsih_set_fwfault_debug(const char *val, const struct kernel_param *kp)
110 {
111 int ret = param_set_int(val, kp);
112 struct MPT3SAS_ADAPTER *ioc;
113
114 if (ret)
115 return ret;
116
117 /* global ioc spinlock to protect controller list on list operations */
118 pr_info("setting fwfault_debug(%d)\n", mpt3sas_fwfault_debug);
119 spin_lock(&gioc_lock);
120 list_for_each_entry(ioc, &mpt3sas_ioc_list, list)
121 ioc->fwfault_debug = mpt3sas_fwfault_debug;
122 spin_unlock(&gioc_lock);
123 return 0;
124 }
125 module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug,
126 param_get_int, &mpt3sas_fwfault_debug, 0644);
127
128 /**
129 * _base_clone_to_sys_mem - Writes/copies data to system/BAR0 region
130 *
131 * @dst_iomem: Pointer to the destinaltion location in BAR0 space.
132 * @src: Pointer to the Source data.
133 * @size: Size of data to be copied.
134 */
135 static void
136 _base_clone_to_sys_mem(void *dst_iomem, void *src, u32 size)
137 {
138 int i;
139 __le32 *src_virt_mem = (__le32 *)(src);
140
141 for (i = 0; i < size/4; i++)
> 142 writel(cpu_to_le32(src_virt_mem[i]), dst_iomem + (i * 4));
143 }
144
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 4/6] mpt3sas: Introduce Base function for cloning.
@ 2018-01-20 18:07 ` kbuild test robot
0 siblings, 0 replies; 29+ messages in thread
From: kbuild test robot @ 2018-01-20 18:07 UTC (permalink / raw)
Hi Suganath,
I love your patch! Perhaps something to improve:
[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.15-rc8 next-20180119]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
>> drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: sparse: cast from restricted __le32
drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: expected unsigned int val
drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: got restricted __le32 <noident>
>> drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@
drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: expected void volatile
drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: got void COPYING CREDITS Documentation Kbuild Kconfig MAINTAINERS Makefile README arch block certs crypto drivers firmware fs include init ipc kernel lib mm net samples scripts security sound tools usr virt
drivers/scsi/mpt3sas/mpt3sas_base.c:162:24: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:315:24: sparse: undefined identifier 'mpt3sas_scsih_scsi_lookup_get'
drivers/scsi/mpt3sas/mpt3sas_base.c:1164:42: sparse: incorrect type in assignment (different base types) @@ expected unsigned short Event @@ got short Event @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1165:49: sparse: incorrect type in assignment (different base types) @@ expected unsigned int EventContext @@ got ed int EventContext @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1383:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1432:52: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:2964:32: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3411:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3433:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3456:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3477:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3498:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:4950:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:4971:20: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:4980:20: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:4994:36: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:6175:55: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:315:53: sparse: call with no type!
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mpt3sas_scsih_issue_locked_tm
drivers/scsi/mpt3sas/mpt3sas_base.c:315:8: warning: assignment makes pointer from integer without a cast
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^
At top level:
drivers/scsi/mpt3sas/mpt3sas_base.c:278:13: warning: '_clone_sg_entries' defined but not used
static void _clone_sg_entries(struct MPT3SAS_ADAPTER
^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +142 drivers/scsi/mpt3sas/mpt3sas_base.c
103
104 /**
105 * _scsih_set_fwfault_debug - global setting of ioc->fwfault_debug.
106 *
107 */
108 static int
109 _scsih_set_fwfault_debug(const char *val, const struct kernel_param *kp)
110 {
111 int ret = param_set_int(val, kp);
112 struct MPT3SAS_ADAPTER *ioc;
113
114 if (ret)
115 return ret;
116
117 /* global ioc spinlock to protect controller list on list operations */
118 pr_info("setting fwfault_debug(%d)\n", mpt3sas_fwfault_debug);
119 spin_lock(&gioc_lock);
120 list_for_each_entry(ioc, &mpt3sas_ioc_list, list)
121 ioc->fwfault_debug = mpt3sas_fwfault_debug;
122 spin_unlock(&gioc_lock);
123 return 0;
124 }
125 module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug,
126 param_get_int, &mpt3sas_fwfault_debug, 0644);
127
128 /**
129 * _base_clone_to_sys_mem - Writes/copies data to system/BAR0 region
130 *
131 * @dst_iomem: Pointer to the destinaltion location in BAR0 space.
132 * @src: Pointer to the Source data.
133 * @size: Size of data to be copied.
134 */
135 static void
136 _base_clone_to_sys_mem(void *dst_iomem, void *src, u32 size)
137 {
138 int i;
139 __le32 *src_virt_mem = (__le32 *)(src);
140
141 for (i = 0; i < size/4; i++)
> 142 writel(cpu_to_le32(src_virt_mem[i]), dst_iomem + (i * 4));
143 }
144
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 5/6] mpt3sas: Introduce function to clone mpi request.
2018-01-19 12:37 ` Suganath Prabu S
@ 2018-01-20 18:38 ` kbuild test robot
-1 siblings, 0 replies; 29+ messages in thread
From: kbuild test robot @ 2018-01-20 18:38 UTC (permalink / raw)
Cc: kbuild-all, linux-scsi, linux-nvme, Sathya.Prakash,
sreekanth.reddy, chaitra.basappa, Suganath Prabu S
Hi Suganath,
I love your patch! Perhaps something to improve:
[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.15-rc8 next-20180119]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
drivers/scsi/mpt3sas/mpt3sas_base.c:143:24: sparse: cast from restricted __le32
drivers/scsi/mpt3sas/mpt3sas_base.c:143:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:143:24: expected unsigned int val
drivers/scsi/mpt3sas/mpt3sas_base.c:143:24: got restricted __le32 <noident>
drivers/scsi/mpt3sas/mpt3sas_base.c:143:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@
drivers/scsi/mpt3sas/mpt3sas_base.c:143:64: expected void volatile
drivers/scsi/mpt3sas/mpt3sas_base.c:143:64: got void COPYING CREDITS Documentation Kbuild Kconfig MAINTAINERS Makefile README arch block certs crypto drivers firmware fs include init ipc kernel lib mm net samples scripts security sound tools usr virt
drivers/scsi/mpt3sas/mpt3sas_base.c:160:24: sparse: cast from restricted __le32
drivers/scsi/mpt3sas/mpt3sas_base.c:160:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:160:24: expected unsigned int val
drivers/scsi/mpt3sas/mpt3sas_base.c:160:24: got restricted __le32 <noident>
drivers/scsi/mpt3sas/mpt3sas_base.c:160:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@
drivers/scsi/mpt3sas/mpt3sas_base.c:160:64: expected void volatile
drivers/scsi/mpt3sas/mpt3sas_base.c:160:64: got void COPYING CREDITS Documentation Kbuild Kconfig MAINTAINERS Makefile README arch block certs crypto drivers firmware fs include init ipc kernel lib mm net samples scripts security sound tools usr virt
drivers/scsi/mpt3sas/mpt3sas_base.c:180:24: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:333:24: sparse: undefined identifier 'mpt3sas_scsih_scsi_lookup_get'
drivers/scsi/mpt3sas/mpt3sas_base.c:1182:42: sparse: incorrect type in assignment (different base types) @@ expected unsigned short Event @@ got short Event @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1183:49: sparse: incorrect type in assignment (different base types) @@ expected unsigned int EventContext @@ got ed int EventContext @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1401:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1450:52: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:2982:32: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:3330:26: sparse: cast removes address space of expression
>> drivers/scsi/mpt3sas/mpt3sas_base.c:3274:26: sparse: incorrect type in initializer (different base types) @@ expected unsigned long long data_out @@ got g long data_out @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3297:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3297:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3414:34: sparse: cast removes address space of expression
>> drivers/scsi/mpt3sas/mpt3sas_base.c:3274:26: sparse: incorrect type in initializer (different base types) @@ expected unsigned long long data_out @@ got g long data_out @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3297:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3297:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3483:34: sparse: cast removes address space of expression
>> drivers/scsi/mpt3sas/mpt3sas_base.c:3274:26: sparse: incorrect type in initializer (different base types) @@ expected unsigned long long data_out @@ got g long data_out @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3297:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3523:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3545:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3568:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3589:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3610:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:5062:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:5083:20: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:5092:20: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:5106:36: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:6287:55: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:333:53: sparse: call with no type!
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
drivers/scsi/mpt3sas/mpt3sas_base.c:333:10: error: implicit declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mpt3sas_scsih_issue_locked_tm
drivers/scsi/mpt3sas/mpt3sas_base.c:333:8: warning: assignment makes pointer from integer without a cast
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^
cc1: some warnings being treated as errors
vim +3274 drivers/scsi/mpt3sas/mpt3sas_base.c
3258
3259 /**
3260 * _base_mpi_ep_writeq - 32 bit write to MMIO
3261 * @b: data payload
3262 * @addr: address in MMIO space
3263 * @writeq_lock: spin lock
3264 *
3265 * This special handling for MPI EP to take care of 32 bit
3266 * environment where its not quarenteed to send the entire word
3267 * in one transfer.
3268 */
3269 static inline void
3270 _base_mpi_ep_writeq(__u64 b, volatile void __iomem *addr,
3271 spinlock_t *writeq_lock)
3272 {
3273 unsigned long flags;
> 3274 __u64 data_out = cpu_to_le64(b);
3275
3276 spin_lock_irqsave(writeq_lock, flags);
3277 writel((u32)(data_out), addr);
3278 writel((u32)(data_out >> 32), (addr + 4));
3279 spin_unlock_irqrestore(writeq_lock, flags);
3280 }
3281
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 5/6] mpt3sas: Introduce function to clone mpi request.
@ 2018-01-20 18:38 ` kbuild test robot
0 siblings, 0 replies; 29+ messages in thread
From: kbuild test robot @ 2018-01-20 18:38 UTC (permalink / raw)
Hi Suganath,
I love your patch! Perhaps something to improve:
[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.15-rc8 next-20180119]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
drivers/scsi/mpt3sas/mpt3sas_base.c:143:24: sparse: cast from restricted __le32
drivers/scsi/mpt3sas/mpt3sas_base.c:143:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:143:24: expected unsigned int val
drivers/scsi/mpt3sas/mpt3sas_base.c:143:24: got restricted __le32 <noident>
drivers/scsi/mpt3sas/mpt3sas_base.c:143:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@
drivers/scsi/mpt3sas/mpt3sas_base.c:143:64: expected void volatile
drivers/scsi/mpt3sas/mpt3sas_base.c:143:64: got void COPYING CREDITS Documentation Kbuild Kconfig MAINTAINERS Makefile README arch block certs crypto drivers firmware fs include init ipc kernel lib mm net samples scripts security sound tools usr virt
drivers/scsi/mpt3sas/mpt3sas_base.c:160:24: sparse: cast from restricted __le32
drivers/scsi/mpt3sas/mpt3sas_base.c:160:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:160:24: expected unsigned int val
drivers/scsi/mpt3sas/mpt3sas_base.c:160:24: got restricted __le32 <noident>
drivers/scsi/mpt3sas/mpt3sas_base.c:160:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@
drivers/scsi/mpt3sas/mpt3sas_base.c:160:64: expected void volatile
drivers/scsi/mpt3sas/mpt3sas_base.c:160:64: got void COPYING CREDITS Documentation Kbuild Kconfig MAINTAINERS Makefile README arch block certs crypto drivers firmware fs include init ipc kernel lib mm net samples scripts security sound tools usr virt
drivers/scsi/mpt3sas/mpt3sas_base.c:180:24: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:333:24: sparse: undefined identifier 'mpt3sas_scsih_scsi_lookup_get'
drivers/scsi/mpt3sas/mpt3sas_base.c:1182:42: sparse: incorrect type in assignment (different base types) @@ expected unsigned short Event @@ got short Event @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1183:49: sparse: incorrect type in assignment (different base types) @@ expected unsigned int EventContext @@ got ed int EventContext @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1401:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1450:52: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:2982:32: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:3330:26: sparse: cast removes address space of expression
>> drivers/scsi/mpt3sas/mpt3sas_base.c:3274:26: sparse: incorrect type in initializer (different base types) @@ expected unsigned long long data_out @@ got g long data_out @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3297:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3297:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3414:34: sparse: cast removes address space of expression
>> drivers/scsi/mpt3sas/mpt3sas_base.c:3274:26: sparse: incorrect type in initializer (different base types) @@ expected unsigned long long data_out @@ got g long data_out @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3297:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3297:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3483:34: sparse: cast removes address space of expression
>> drivers/scsi/mpt3sas/mpt3sas_base.c:3274:26: sparse: incorrect type in initializer (different base types) @@ expected unsigned long long data_out @@ got g long data_out @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3297:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3523:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3545:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3568:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3589:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3610:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:5062:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:5083:20: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:5092:20: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:5106:36: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:6287:55: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:333:53: sparse: call with no type!
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
drivers/scsi/mpt3sas/mpt3sas_base.c:333:10: error: implicit declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mpt3sas_scsih_issue_locked_tm
drivers/scsi/mpt3sas/mpt3sas_base.c:333:8: warning: assignment makes pointer from integer without a cast
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^
cc1: some warnings being treated as errors
vim +3274 drivers/scsi/mpt3sas/mpt3sas_base.c
3258
3259 /**
3260 * _base_mpi_ep_writeq - 32 bit write to MMIO
3261 * @b: data payload
3262 * @addr: address in MMIO space
3263 * @writeq_lock: spin lock
3264 *
3265 * This special handling for MPI EP to take care of 32 bit
3266 * environment where its not quarenteed to send the entire word
3267 * in one transfer.
3268 */
3269 static inline void
3270 _base_mpi_ep_writeq(__u64 b, volatile void __iomem *addr,
3271 spinlock_t *writeq_lock)
3272 {
3273 unsigned long flags;
> 3274 __u64 data_out = cpu_to_le64(b);
3275
3276 spin_lock_irqsave(writeq_lock, flags);
3277 writel((u32)(data_out), addr);
3278 writel((u32)(data_out >> 32), (addr + 4));
3279 spin_unlock_irqrestore(writeq_lock, flags);
3280 }
3281
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 6/6] mpt3sas: Introduce function to clone mpi reply.
2018-01-19 12:37 ` Suganath Prabu S
@ 2018-01-20 19:01 ` kbuild test robot
-1 siblings, 0 replies; 29+ messages in thread
From: kbuild test robot @ 2018-01-20 19:01 UTC (permalink / raw)
Cc: kbuild-all, linux-scsi, linux-nvme, Sathya.Prakash,
sreekanth.reddy, chaitra.basappa, Suganath Prabu S
Hi Suganath,
I love your patch! Perhaps something to improve:
[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.15-rc8 next-20180119]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
drivers/scsi/mpt3sas/mpt3sas_base.c:148:35: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:151:16: sparse: cast from restricted __le32
drivers/scsi/mpt3sas/mpt3sas_base.c:151:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:151:16: expected unsigned int val
drivers/scsi/mpt3sas/mpt3sas_base.c:151:16: got restricted __le32 <noident>
drivers/scsi/mpt3sas/mpt3sas_base.c:151:36: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@
drivers/scsi/mpt3sas/mpt3sas_base.c:151:36: expected void volatile
drivers/scsi/mpt3sas/mpt3sas_base.c:151:36: got void
drivers/scsi/mpt3sas/mpt3sas_base.c:169:24: sparse: cast from restricted __le32
drivers/scsi/mpt3sas/mpt3sas_base.c:169:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:169:24: expected unsigned int val
drivers/scsi/mpt3sas/mpt3sas_base.c:169:24: got restricted __le32 <noident>
drivers/scsi/mpt3sas/mpt3sas_base.c:169:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@
drivers/scsi/mpt3sas/mpt3sas_base.c:169:64: expected void volatile
drivers/scsi/mpt3sas/mpt3sas_base.c:169:64: got void COPYING CREDITS Documentation Kbuild Kconfig MAINTAINERS Makefile README arch block certs crypto drivers firmware fs include init ipc kernel lib mm net samples scripts security sound tools usr virt
drivers/scsi/mpt3sas/mpt3sas_base.c:186:24: sparse: cast from restricted __le32
drivers/scsi/mpt3sas/mpt3sas_base.c:186:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:186:24: expected unsigned int val
drivers/scsi/mpt3sas/mpt3sas_base.c:186:24: got restricted __le32 <noident>
drivers/scsi/mpt3sas/mpt3sas_base.c:186:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@
drivers/scsi/mpt3sas/mpt3sas_base.c:186:64: expected void volatile
drivers/scsi/mpt3sas/mpt3sas_base.c:186:64: got void COPYING CREDITS Documentation Kbuild Kconfig MAINTAINERS Makefile README arch block certs crypto drivers firmware fs include init ipc kernel lib mm net samples scripts security sound tools usr virt
drivers/scsi/mpt3sas/mpt3sas_base.c:206:24: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:359:24: sparse: undefined identifier 'mpt3sas_scsih_scsi_lookup_get'
drivers/scsi/mpt3sas/mpt3sas_base.c:1208:42: sparse: incorrect type in assignment (different base types) @@ expected unsigned short Event @@ got short Event @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1209:49: sparse: incorrect type in assignment (different base types) @@ expected unsigned int EventContext @@ got ed int EventContext @@
>> drivers/scsi/mpt3sas/mpt3sas_base.c:1404:75: sparse: incorrect type in argument 2 (different base types) @@ expected restricted __le32 reply @@ got unsigned int [unsrestricted __le32 reply @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1430:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1479:52: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3011:32: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:3359:26: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:3303:26: sparse: incorrect type in initializer (different base types) @@ expected unsigned long long data_out @@ got g long data_out @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3326:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3326:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3443:34: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:3303:26: sparse: incorrect type in initializer (different base types) @@ expected unsigned long long data_out @@ got g long data_out @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3326:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3326:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3512:34: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:3303:26: sparse: incorrect type in initializer (different base types) @@ expected unsigned long long data_out @@ got g long data_out @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3326:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3552:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3574:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3597:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3618:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3639:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:5091:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:5112:20: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:5121:20: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:5135:36: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:6274:59: sparse: incorrect type in argument 2 (different base types) @@ expected restricted __le32 reply @@ got unsigned int [unsrestricted __le32 reply @@
drivers/scsi/mpt3sas/mpt3sas_base.c:6319:55: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:359:53: sparse: call with no type!
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
drivers/scsi/mpt3sas/mpt3sas_base.c:359:10: error: implicit declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mpt3sas_scsih_issue_locked_tm
drivers/scsi/mpt3sas/mpt3sas_base.c:359:8: warning: assignment makes pointer from integer without a cast
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^
cc1: some warnings being treated as errors
vim +1404 drivers/scsi/mpt3sas/mpt3sas_base.c
1311
1312 /**
1313 * _base_interrupt - MPT adapter (IOC) specific interrupt handler.
1314 * @irq: irq number (not used)
1315 * @bus_id: bus identifier cookie == pointer to MPT_ADAPTER structure
1316 * @r: pt_regs pointer (not used)
1317 *
1318 * Return IRQ_HANDLE if processed, else IRQ_NONE.
1319 */
1320 static irqreturn_t
1321 _base_interrupt(int irq, void *bus_id)
1322 {
1323 struct adapter_reply_queue *reply_q = bus_id;
1324 union reply_descriptor rd;
1325 u32 completed_cmds;
1326 u8 request_desript_type;
1327 u16 smid;
1328 u8 cb_idx;
1329 u32 reply;
1330 u8 msix_index = reply_q->msix_index;
1331 struct MPT3SAS_ADAPTER *ioc = reply_q->ioc;
1332 Mpi2ReplyDescriptorsUnion_t *rpf;
1333 u8 rc;
1334
1335 if (ioc->mask_interrupts)
1336 return IRQ_NONE;
1337
1338 if (!atomic_add_unless(&reply_q->busy, 1, 1))
1339 return IRQ_NONE;
1340
1341 rpf = &reply_q->reply_post_free[reply_q->reply_post_host_index];
1342 request_desript_type = rpf->Default.ReplyFlags
1343 & MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK;
1344 if (request_desript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED) {
1345 atomic_dec(&reply_q->busy);
1346 return IRQ_NONE;
1347 }
1348
1349 completed_cmds = 0;
1350 cb_idx = 0xFF;
1351 do {
1352 rd.word = le64_to_cpu(rpf->Words);
1353 if (rd.u.low == UINT_MAX || rd.u.high == UINT_MAX)
1354 goto out;
1355 reply = 0;
1356 smid = le16_to_cpu(rpf->Default.DescriptorTypeDependent1);
1357 if (request_desript_type ==
1358 MPI25_RPY_DESCRIPT_FLAGS_FAST_PATH_SCSI_IO_SUCCESS ||
1359 request_desript_type ==
1360 MPI2_RPY_DESCRIPT_FLAGS_SCSI_IO_SUCCESS ||
1361 request_desript_type ==
1362 MPI26_RPY_DESCRIPT_FLAGS_PCIE_ENCAPSULATED_SUCCESS) {
1363 cb_idx = _base_get_cb_idx(ioc, smid);
1364 if ((likely(cb_idx < MPT_MAX_CALLBACKS)) &&
1365 (likely(mpt_callbacks[cb_idx] != NULL))) {
1366 rc = mpt_callbacks[cb_idx](ioc, smid,
1367 msix_index, 0);
1368 if (rc)
1369 mpt3sas_base_free_smid(ioc, smid);
1370 }
1371 } else if (request_desript_type ==
1372 MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY) {
1373 reply = le32_to_cpu(
1374 rpf->AddressReply.ReplyFrameAddress);
1375 if (reply > ioc->reply_dma_max_address ||
1376 reply < ioc->reply_dma_min_address)
1377 reply = 0;
1378 if (smid) {
1379 cb_idx = _base_get_cb_idx(ioc, smid);
1380 if ((likely(cb_idx < MPT_MAX_CALLBACKS)) &&
1381 (likely(mpt_callbacks[cb_idx] != NULL))) {
1382 rc = mpt_callbacks[cb_idx](ioc, smid,
1383 msix_index, reply);
1384 if (reply)
1385 _base_display_reply_info(ioc,
1386 smid, msix_index, reply);
1387 if (rc)
1388 mpt3sas_base_free_smid(ioc,
1389 smid);
1390 }
1391 } else {
1392 _base_async_event(ioc, msix_index, reply);
1393 }
1394
1395 /* reply free queue handling */
1396 if (reply) {
1397 ioc->reply_free_host_index =
1398 (ioc->reply_free_host_index ==
1399 (ioc->reply_free_queue_depth - 1)) ?
1400 0 : ioc->reply_free_host_index + 1;
1401 ioc->reply_free[ioc->reply_free_host_index] =
1402 cpu_to_le32(reply);
1403 if (ioc->is_mcpu_endpoint)
> 1404 _base_clone_reply_to_sys_mem(ioc, reply,
1405 ioc->reply_free_host_index);
1406 writel(ioc->reply_free_host_index,
1407 &ioc->chip->ReplyFreeHostIndex);
1408 }
1409 }
1410
1411 rpf->Words = cpu_to_le64(ULLONG_MAX);
1412 reply_q->reply_post_host_index =
1413 (reply_q->reply_post_host_index ==
1414 (ioc->reply_post_queue_depth - 1)) ? 0 :
1415 reply_q->reply_post_host_index + 1;
1416 request_desript_type =
1417 reply_q->reply_post_free[reply_q->reply_post_host_index].
1418 Default.ReplyFlags & MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK;
1419 completed_cmds++;
1420 /* Update the reply post host index after continuously
1421 * processing the threshold number of Reply Descriptors.
1422 * So that FW can find enough entries to post the Reply
1423 * Descriptors in the reply descriptor post queue.
1424 */
1425 if (completed_cmds > ioc->hba_queue_depth/3) {
1426 if (ioc->combined_reply_queue) {
1427 writel(reply_q->reply_post_host_index |
1428 ((msix_index & 7) <<
1429 MPI2_RPHI_MSIX_INDEX_SHIFT),
1430 ioc->replyPostRegisterIndex[msix_index/8]);
1431 } else {
1432 writel(reply_q->reply_post_host_index |
1433 (msix_index <<
1434 MPI2_RPHI_MSIX_INDEX_SHIFT),
1435 &ioc->chip->ReplyPostHostIndex);
1436 }
1437 completed_cmds = 1;
1438 }
1439 if (request_desript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED)
1440 goto out;
1441 if (!reply_q->reply_post_host_index)
1442 rpf = reply_q->reply_post_free;
1443 else
1444 rpf++;
1445 } while (1);
1446
1447 out:
1448
1449 if (!completed_cmds) {
1450 atomic_dec(&reply_q->busy);
1451 return IRQ_NONE;
1452 }
1453
1454 if (ioc->is_warpdrive) {
1455 writel(reply_q->reply_post_host_index,
1456 ioc->reply_post_host_index[msix_index]);
1457 atomic_dec(&reply_q->busy);
1458 return IRQ_HANDLED;
1459 }
1460
1461 /* Update Reply Post Host Index.
1462 * For those HBA's which support combined reply queue feature
1463 * 1. Get the correct Supplemental Reply Post Host Index Register.
1464 * i.e. (msix_index / 8)th entry from Supplemental Reply Post Host
1465 * Index Register address bank i.e replyPostRegisterIndex[],
1466 * 2. Then update this register with new reply host index value
1467 * in ReplyPostIndex field and the MSIxIndex field with
1468 * msix_index value reduced to a value between 0 and 7,
1469 * using a modulo 8 operation. Since each Supplemental Reply Post
1470 * Host Index Register supports 8 MSI-X vectors.
1471 *
1472 * For other HBA's just update the Reply Post Host Index register with
1473 * new reply host index value in ReplyPostIndex Field and msix_index
1474 * value in MSIxIndex field.
1475 */
1476 if (ioc->combined_reply_queue)
1477 writel(reply_q->reply_post_host_index | ((msix_index & 7) <<
1478 MPI2_RPHI_MSIX_INDEX_SHIFT),
1479 ioc->replyPostRegisterIndex[msix_index/8]);
1480 else
1481 writel(reply_q->reply_post_host_index | (msix_index <<
1482 MPI2_RPHI_MSIX_INDEX_SHIFT),
1483 &ioc->chip->ReplyPostHostIndex);
1484 atomic_dec(&reply_q->busy);
1485 return IRQ_HANDLED;
1486 }
1487
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 6/6] mpt3sas: Introduce function to clone mpi reply.
@ 2018-01-20 19:01 ` kbuild test robot
0 siblings, 0 replies; 29+ messages in thread
From: kbuild test robot @ 2018-01-20 19:01 UTC (permalink / raw)
Hi Suganath,
I love your patch! Perhaps something to improve:
[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.15-rc8 next-20180119]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
drivers/scsi/mpt3sas/mpt3sas_base.c:148:35: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:151:16: sparse: cast from restricted __le32
drivers/scsi/mpt3sas/mpt3sas_base.c:151:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:151:16: expected unsigned int val
drivers/scsi/mpt3sas/mpt3sas_base.c:151:16: got restricted __le32 <noident>
drivers/scsi/mpt3sas/mpt3sas_base.c:151:36: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@
drivers/scsi/mpt3sas/mpt3sas_base.c:151:36: expected void volatile
drivers/scsi/mpt3sas/mpt3sas_base.c:151:36: got void
drivers/scsi/mpt3sas/mpt3sas_base.c:169:24: sparse: cast from restricted __le32
drivers/scsi/mpt3sas/mpt3sas_base.c:169:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:169:24: expected unsigned int val
drivers/scsi/mpt3sas/mpt3sas_base.c:169:24: got restricted __le32 <noident>
drivers/scsi/mpt3sas/mpt3sas_base.c:169:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@
drivers/scsi/mpt3sas/mpt3sas_base.c:169:64: expected void volatile
drivers/scsi/mpt3sas/mpt3sas_base.c:169:64: got void COPYING CREDITS Documentation Kbuild Kconfig MAINTAINERS Makefile README arch block certs crypto drivers firmware fs include init ipc kernel lib mm net samples scripts security sound tools usr virt
drivers/scsi/mpt3sas/mpt3sas_base.c:186:24: sparse: cast from restricted __le32
drivers/scsi/mpt3sas/mpt3sas_base.c:186:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:186:24: expected unsigned int val
drivers/scsi/mpt3sas/mpt3sas_base.c:186:24: got restricted __le32 <noident>
drivers/scsi/mpt3sas/mpt3sas_base.c:186:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@
drivers/scsi/mpt3sas/mpt3sas_base.c:186:64: expected void volatile
drivers/scsi/mpt3sas/mpt3sas_base.c:186:64: got void COPYING CREDITS Documentation Kbuild Kconfig MAINTAINERS Makefile README arch block certs crypto drivers firmware fs include init ipc kernel lib mm net samples scripts security sound tools usr virt
drivers/scsi/mpt3sas/mpt3sas_base.c:206:24: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:359:24: sparse: undefined identifier 'mpt3sas_scsih_scsi_lookup_get'
drivers/scsi/mpt3sas/mpt3sas_base.c:1208:42: sparse: incorrect type in assignment (different base types) @@ expected unsigned short Event @@ got short Event @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1209:49: sparse: incorrect type in assignment (different base types) @@ expected unsigned int EventContext @@ got ed int EventContext @@
>> drivers/scsi/mpt3sas/mpt3sas_base.c:1404:75: sparse: incorrect type in argument 2 (different base types) @@ expected restricted __le32 reply @@ got unsigned int [unsrestricted __le32 reply @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1430:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:1479:52: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3011:32: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:3359:26: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:3303:26: sparse: incorrect type in initializer (different base types) @@ expected unsigned long long data_out @@ got g long data_out @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3326:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3326:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3443:34: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:3303:26: sparse: incorrect type in initializer (different base types) @@ expected unsigned long long data_out @@ got g long data_out @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3326:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3326:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3512:34: sparse: cast removes address space of expression
drivers/scsi/mpt3sas/mpt3sas_base.c:3303:26: sparse: incorrect type in initializer (different base types) @@ expected unsigned long long data_out @@ got g long data_out @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3326:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3552:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3574:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3597:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3618:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:3639:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:5091:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
drivers/scsi/mpt3sas/mpt3sas_base.c:5112:20: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:5121:20: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:5135:36: sparse: cast to restricted __le16
drivers/scsi/mpt3sas/mpt3sas_base.c:6274:59: sparse: incorrect type in argument 2 (different base types) @@ expected restricted __le32 reply @@ got unsigned int [unsrestricted __le32 reply @@
drivers/scsi/mpt3sas/mpt3sas_base.c:6319:55: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
drivers/scsi/mpt3sas/mpt3sas_base.c:359:53: sparse: call with no type!
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
drivers/scsi/mpt3sas/mpt3sas_base.c:359:10: error: implicit declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mpt3sas_scsih_issue_locked_tm
drivers/scsi/mpt3sas/mpt3sas_base.c:359:8: warning: assignment makes pointer from integer without a cast
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^
cc1: some warnings being treated as errors
vim +1404 drivers/scsi/mpt3sas/mpt3sas_base.c
1311
1312 /**
1313 * _base_interrupt - MPT adapter (IOC) specific interrupt handler.
1314 * @irq: irq number (not used)
1315 * @bus_id: bus identifier cookie == pointer to MPT_ADAPTER structure
1316 * @r: pt_regs pointer (not used)
1317 *
1318 * Return IRQ_HANDLE if processed, else IRQ_NONE.
1319 */
1320 static irqreturn_t
1321 _base_interrupt(int irq, void *bus_id)
1322 {
1323 struct adapter_reply_queue *reply_q = bus_id;
1324 union reply_descriptor rd;
1325 u32 completed_cmds;
1326 u8 request_desript_type;
1327 u16 smid;
1328 u8 cb_idx;
1329 u32 reply;
1330 u8 msix_index = reply_q->msix_index;
1331 struct MPT3SAS_ADAPTER *ioc = reply_q->ioc;
1332 Mpi2ReplyDescriptorsUnion_t *rpf;
1333 u8 rc;
1334
1335 if (ioc->mask_interrupts)
1336 return IRQ_NONE;
1337
1338 if (!atomic_add_unless(&reply_q->busy, 1, 1))
1339 return IRQ_NONE;
1340
1341 rpf = &reply_q->reply_post_free[reply_q->reply_post_host_index];
1342 request_desript_type = rpf->Default.ReplyFlags
1343 & MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK;
1344 if (request_desript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED) {
1345 atomic_dec(&reply_q->busy);
1346 return IRQ_NONE;
1347 }
1348
1349 completed_cmds = 0;
1350 cb_idx = 0xFF;
1351 do {
1352 rd.word = le64_to_cpu(rpf->Words);
1353 if (rd.u.low == UINT_MAX || rd.u.high == UINT_MAX)
1354 goto out;
1355 reply = 0;
1356 smid = le16_to_cpu(rpf->Default.DescriptorTypeDependent1);
1357 if (request_desript_type ==
1358 MPI25_RPY_DESCRIPT_FLAGS_FAST_PATH_SCSI_IO_SUCCESS ||
1359 request_desript_type ==
1360 MPI2_RPY_DESCRIPT_FLAGS_SCSI_IO_SUCCESS ||
1361 request_desript_type ==
1362 MPI26_RPY_DESCRIPT_FLAGS_PCIE_ENCAPSULATED_SUCCESS) {
1363 cb_idx = _base_get_cb_idx(ioc, smid);
1364 if ((likely(cb_idx < MPT_MAX_CALLBACKS)) &&
1365 (likely(mpt_callbacks[cb_idx] != NULL))) {
1366 rc = mpt_callbacks[cb_idx](ioc, smid,
1367 msix_index, 0);
1368 if (rc)
1369 mpt3sas_base_free_smid(ioc, smid);
1370 }
1371 } else if (request_desript_type ==
1372 MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY) {
1373 reply = le32_to_cpu(
1374 rpf->AddressReply.ReplyFrameAddress);
1375 if (reply > ioc->reply_dma_max_address ||
1376 reply < ioc->reply_dma_min_address)
1377 reply = 0;
1378 if (smid) {
1379 cb_idx = _base_get_cb_idx(ioc, smid);
1380 if ((likely(cb_idx < MPT_MAX_CALLBACKS)) &&
1381 (likely(mpt_callbacks[cb_idx] != NULL))) {
1382 rc = mpt_callbacks[cb_idx](ioc, smid,
1383 msix_index, reply);
1384 if (reply)
1385 _base_display_reply_info(ioc,
1386 smid, msix_index, reply);
1387 if (rc)
1388 mpt3sas_base_free_smid(ioc,
1389 smid);
1390 }
1391 } else {
1392 _base_async_event(ioc, msix_index, reply);
1393 }
1394
1395 /* reply free queue handling */
1396 if (reply) {
1397 ioc->reply_free_host_index =
1398 (ioc->reply_free_host_index ==
1399 (ioc->reply_free_queue_depth - 1)) ?
1400 0 : ioc->reply_free_host_index + 1;
1401 ioc->reply_free[ioc->reply_free_host_index] =
1402 cpu_to_le32(reply);
1403 if (ioc->is_mcpu_endpoint)
> 1404 _base_clone_reply_to_sys_mem(ioc, reply,
1405 ioc->reply_free_host_index);
1406 writel(ioc->reply_free_host_index,
1407 &ioc->chip->ReplyFreeHostIndex);
1408 }
1409 }
1410
1411 rpf->Words = cpu_to_le64(ULLONG_MAX);
1412 reply_q->reply_post_host_index =
1413 (reply_q->reply_post_host_index ==
1414 (ioc->reply_post_queue_depth - 1)) ? 0 :
1415 reply_q->reply_post_host_index + 1;
1416 request_desript_type =
1417 reply_q->reply_post_free[reply_q->reply_post_host_index].
1418 Default.ReplyFlags & MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK;
1419 completed_cmds++;
1420 /* Update the reply post host index after continuously
1421 * processing the threshold number of Reply Descriptors.
1422 * So that FW can find enough entries to post the Reply
1423 * Descriptors in the reply descriptor post queue.
1424 */
1425 if (completed_cmds > ioc->hba_queue_depth/3) {
1426 if (ioc->combined_reply_queue) {
1427 writel(reply_q->reply_post_host_index |
1428 ((msix_index & 7) <<
1429 MPI2_RPHI_MSIX_INDEX_SHIFT),
1430 ioc->replyPostRegisterIndex[msix_index/8]);
1431 } else {
1432 writel(reply_q->reply_post_host_index |
1433 (msix_index <<
1434 MPI2_RPHI_MSIX_INDEX_SHIFT),
1435 &ioc->chip->ReplyPostHostIndex);
1436 }
1437 completed_cmds = 1;
1438 }
1439 if (request_desript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED)
1440 goto out;
1441 if (!reply_q->reply_post_host_index)
1442 rpf = reply_q->reply_post_free;
1443 else
1444 rpf++;
1445 } while (1);
1446
1447 out:
1448
1449 if (!completed_cmds) {
1450 atomic_dec(&reply_q->busy);
1451 return IRQ_NONE;
1452 }
1453
1454 if (ioc->is_warpdrive) {
1455 writel(reply_q->reply_post_host_index,
1456 ioc->reply_post_host_index[msix_index]);
1457 atomic_dec(&reply_q->busy);
1458 return IRQ_HANDLED;
1459 }
1460
1461 /* Update Reply Post Host Index.
1462 * For those HBA's which support combined reply queue feature
1463 * 1. Get the correct Supplemental Reply Post Host Index Register.
1464 * i.e. (msix_index / 8)th entry from Supplemental Reply Post Host
1465 * Index Register address bank i.e replyPostRegisterIndex[],
1466 * 2. Then update this register with new reply host index value
1467 * in ReplyPostIndex field and the MSIxIndex field with
1468 * msix_index value reduced to a value between 0 and 7,
1469 * using a modulo 8 operation. Since each Supplemental Reply Post
1470 * Host Index Register supports 8 MSI-X vectors.
1471 *
1472 * For other HBA's just update the Reply Post Host Index register with
1473 * new reply host index value in ReplyPostIndex Field and msix_index
1474 * value in MSIxIndex field.
1475 */
1476 if (ioc->combined_reply_queue)
1477 writel(reply_q->reply_post_host_index | ((msix_index & 7) <<
1478 MPI2_RPHI_MSIX_INDEX_SHIFT),
1479 ioc->replyPostRegisterIndex[msix_index/8]);
1480 else
1481 writel(reply_q->reply_post_host_index | (msix_index <<
1482 MPI2_RPHI_MSIX_INDEX_SHIFT),
1483 &ioc->chip->ReplyPostHostIndex);
1484 atomic_dec(&reply_q->busy);
1485 return IRQ_HANDLED;
1486 }
1487
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 5/6] mpt3sas: Introduce function to clone mpi request.
2018-01-19 12:37 ` Suganath Prabu S
@ 2018-01-22 14:38 ` Tomas Henzl
-1 siblings, 0 replies; 29+ messages in thread
From: Tomas Henzl @ 2018-01-22 14:38 UTC (permalink / raw)
To: Suganath Prabu S, linux-scsi, linux-nvme
Cc: Sathya.Prakash, sreekanth.reddy, chaitra.basappa
On 01/19/2018 01:37 PM, Suganath Prabu S wrote:
> 1) Added function _base_clone_mpi_to_sys_mem to clone
> MPI request into system BAR0 mapped region.
>
> 2) Seperate out MPI Endpoint IO submissions to function
> _base_put_smid_mpi_ep_scsi_io.
>
> 3) MPI EP requests are submitted in two 32 bit MMIO writes.
> from _base_mpi_ep_writeq.
>
> Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
> ---
> drivers/scsi/mpt3sas/mpt3sas_base.c | 131 +++++++++++++++++++++++++++++++++---
> 1 file changed, 123 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
> index 40a1806..0248058 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
> @@ -126,6 +126,24 @@ module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug,
> param_get_int, &mpt3sas_fwfault_debug, 0644);
>
> /**
> + * _base_clone_mpi_to_sys_mem - Writes/copies MPI frames
> + * to system/BAR0 region.
> + *
> + * @dst_iomem: Pointer to the destinaltion location in BAR0 space.
> + * @src: Pointer to the Source data.
> + * @size: Size of data to be copied.
> + */
> +static void
> +_base_clone_mpi_to_sys_mem(void *dst_iomem, void *src, u32 size)
> +{
> + int i;
> + __le32 *src_virt_mem = (__le32 *)src;
> +
> + for (i = 0; i < size/4; i++)
> + writel(cpu_to_le32(src_virt_mem[i]), dst_iomem + (i * 4));
> +}
> +
> +/**
> * _base_clone_to_sys_mem - Writes/copies data to system/BAR0 region
> *
> * @dst_iomem: Pointer to the destinaltion location in BAR0 space.
> @@ -3265,6 +3283,29 @@ mpt3sas_base_free_smid(struct MPT3SAS_ADAPTER *ioc, u16 smid)
> }
>
> /**
> + * _base_mpi_ep_writeq - 32 bit write to MMIO
> + * @b: data payload
> + * @addr: address in MMIO space
> + * @writeq_lock: spin lock
> + *
> + * This special handling for MPI EP to take care of 32 bit
> + * environment where its not quarenteed to send the entire word
> + * in one transfer.
Hi Suganath,
so is a single writeq possible ? There already is a _base_writeq function
which seems to be identical to _base_mpi_ep_writeq.
Also you may want to add a mmiowb() call.
tomash
> + */
> +static inline void
> +_base_mpi_ep_writeq(__u64 b, volatile void __iomem *addr,
> + spinlock_t *writeq_lock)
> +{
> + unsigned long flags;
> + __u64 data_out = cpu_to_le64(b);
> +
> + spin_lock_irqsave(writeq_lock, flags);
> + writel((u32)(data_out), addr);
> + writel((u32)(data_out >> 32), (addr + 4));
> + spin_unlock_irqrestore(writeq_lock, flags);
> +}
> +
> +/**
> * _base_writeq - 64 bit write to MMIO
> * @ioc: per adapter object
> * @b: data payload
> @@ -3296,6 +3337,36 @@ _base_writeq(__u64 b, volatile void __iomem *addr, spinlock_t *writeq_lock)
> #endif
>
> /**
> + * _base_put_smid_mpi_ep_scsi_io - send SCSI_IO request to firmware
> + * @ioc: per adapter object
> + * @smid: system request message index
> + * @handle: device handle
> + *
> + * Return nothing.
> + */
> +static void
> +_base_put_smid_mpi_ep_scsi_io(struct MPT3SAS_ADAPTER *ioc, u16 smid, u16 handle)
> +{
> + Mpi2RequestDescriptorUnion_t descriptor;
> + u64 *request = (u64 *)&descriptor;
> + void *mpi_req_iomem;
> + __le32 *mfp = (__le32 *)mpt3sas_base_get_msg_frame(ioc, smid);
> +
> + _clone_sg_entries(ioc, (void *) mfp, smid);
> + mpi_req_iomem = (void *)ioc->chip +
> + MPI_FRAME_START_OFFSET + (smid * ioc->request_sz);
> + _base_clone_mpi_to_sys_mem(mpi_req_iomem, (void *)mfp,
> + ioc->request_sz);
> + descriptor.SCSIIO.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO;
> + descriptor.SCSIIO.MSIxIndex = _base_get_msix_index(ioc);
> + descriptor.SCSIIO.SMID = cpu_to_le16(smid);
> + descriptor.SCSIIO.DevHandle = cpu_to_le16(handle);
> + descriptor.SCSIIO.LMID = 0;
> + _base_mpi_ep_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
> + &ioc->scsi_lookup_lock);
> +}
> +
> +/**
> * _base_put_smid_scsi_io - send SCSI_IO request to firmware
> * @ioc: per adapter object
> * @smid: system request message index
> @@ -3356,7 +3427,23 @@ _base_put_smid_hi_priority(struct MPT3SAS_ADAPTER *ioc, u16 smid,
> u16 msix_task)
> {
> Mpi2RequestDescriptorUnion_t descriptor;
> - u64 *request = (u64 *)&descriptor;
> + void *mpi_req_iomem;
> + u64 *request;
> +
> + if (ioc->is_mcpu_endpoint) {
> + MPI2RequestHeader_t *request_hdr;
> +
> + __le32 *mfp = (__le32 *)mpt3sas_base_get_msg_frame(ioc, smid);
> +
> + request_hdr = (MPI2RequestHeader_t *)mfp;
> + /* TBD 256 is offset within sys register. */
> + mpi_req_iomem = (void *)ioc->chip + MPI_FRAME_START_OFFSET
> + + (smid * ioc->request_sz);
> + _base_clone_mpi_to_sys_mem(mpi_req_iomem, (void *)mfp,
> + ioc->request_sz);
> + }
> +
> + request = (u64 *)&descriptor;
>
> descriptor.HighPriority.RequestFlags =
> MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY;
> @@ -3364,8 +3451,13 @@ _base_put_smid_hi_priority(struct MPT3SAS_ADAPTER *ioc, u16 smid,
> descriptor.HighPriority.SMID = cpu_to_le16(smid);
> descriptor.HighPriority.LMID = 0;
> descriptor.HighPriority.Reserved1 = 0;
> - _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
> - &ioc->scsi_lookup_lock);
> + if (ioc->is_mcpu_endpoint)
> + _base_mpi_ep_writeq(*request,
> + &ioc->chip->RequestDescriptorPostLow,
> + &ioc->scsi_lookup_lock);
> + else
> + _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
> + &ioc->scsi_lookup_lock);
> }
>
> /**
> @@ -3403,15 +3495,35 @@ static void
> _base_put_smid_default(struct MPT3SAS_ADAPTER *ioc, u16 smid)
> {
> Mpi2RequestDescriptorUnion_t descriptor;
> - u64 *request = (u64 *)&descriptor;
> + void *mpi_req_iomem;
> + u64 *request;
> + MPI2RequestHeader_t *request_hdr;
>
> + if (ioc->is_mcpu_endpoint) {
> + __le32 *mfp = (__le32 *)mpt3sas_base_get_msg_frame(ioc, smid);
> +
> + request_hdr = (MPI2RequestHeader_t *)mfp;
> +
> + _clone_sg_entries(ioc, (void *) mfp, smid);
> + /* TBD 256 is offset within sys register */
> + mpi_req_iomem = (void *)ioc->chip +
> + MPI_FRAME_START_OFFSET + (smid * ioc->request_sz);
> + _base_clone_mpi_to_sys_mem(mpi_req_iomem, (void *)mfp,
> + ioc->request_sz);
> + }
> + request = (u64 *)&descriptor;
> descriptor.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
> descriptor.Default.MSIxIndex = _base_get_msix_index(ioc);
> descriptor.Default.SMID = cpu_to_le16(smid);
> descriptor.Default.LMID = 0;
> descriptor.Default.DescriptorTypeDependent = 0;
> - _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
> - &ioc->scsi_lookup_lock);
> + if (ioc->is_mcpu_endpoint)
> + _base_mpi_ep_writeq(*request,
> + &ioc->chip->RequestDescriptorPostLow,
> + &ioc->scsi_lookup_lock);
> + else
> + _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
> + &ioc->scsi_lookup_lock);
> }
>
> /**
> @@ -3505,7 +3617,7 @@ _base_put_smid_nvme_encap_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid)
>
> /**
> * _base_put_smid_default - Default, primarily used for config pages
> - * use Atomic Request Descriptor
> + * use Atomic Request Descriptor
> * @ioc: per adapter object
> * @smid: system request message index
> *
> @@ -6330,7 +6442,10 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
> ioc->put_smid_nvme_encap = &_base_put_smid_nvme_encap_atomic;
> } else {
> ioc->put_smid_default = &_base_put_smid_default;
> - ioc->put_smid_scsi_io = &_base_put_smid_scsi_io;
> + if (ioc->is_mcpu_endpoint)
> + ioc->put_smid_scsi_io = &_base_put_smid_mpi_ep_scsi_io;
> + else
> + ioc->put_smid_scsi_io = &_base_put_smid_scsi_io;
> ioc->put_smid_fast_path = &_base_put_smid_fast_path;
> ioc->put_smid_hi_priority = &_base_put_smid_hi_priority;
> ioc->put_smid_nvme_encap = &_base_put_smid_nvme_encap;
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 5/6] mpt3sas: Introduce function to clone mpi request.
@ 2018-01-22 14:38 ` Tomas Henzl
0 siblings, 0 replies; 29+ messages in thread
From: Tomas Henzl @ 2018-01-22 14:38 UTC (permalink / raw)
On 01/19/2018 01:37 PM, Suganath Prabu S wrote:
> 1) Added function _base_clone_mpi_to_sys_mem to clone
> MPI request into system BAR0 mapped region.
>
> 2) Seperate out MPI Endpoint IO submissions to function
> _base_put_smid_mpi_ep_scsi_io.
>
> 3) MPI EP requests are submitted in two 32 bit MMIO writes.
> from _base_mpi_ep_writeq.
>
> Signed-off-by: Suganath Prabu S <suganath-prabu.subramani at broadcom.com>
> ---
> drivers/scsi/mpt3sas/mpt3sas_base.c | 131 +++++++++++++++++++++++++++++++++---
> 1 file changed, 123 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
> index 40a1806..0248058 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
> @@ -126,6 +126,24 @@ module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug,
> param_get_int, &mpt3sas_fwfault_debug, 0644);
>
> /**
> + * _base_clone_mpi_to_sys_mem - Writes/copies MPI frames
> + * to system/BAR0 region.
> + *
> + * @dst_iomem: Pointer to the destinaltion location in BAR0 space.
> + * @src: Pointer to the Source data.
> + * @size: Size of data to be copied.
> + */
> +static void
> +_base_clone_mpi_to_sys_mem(void *dst_iomem, void *src, u32 size)
> +{
> + int i;
> + __le32 *src_virt_mem = (__le32 *)src;
> +
> + for (i = 0; i < size/4; i++)
> + writel(cpu_to_le32(src_virt_mem[i]), dst_iomem + (i * 4));
> +}
> +
> +/**
> * _base_clone_to_sys_mem - Writes/copies data to system/BAR0 region
> *
> * @dst_iomem: Pointer to the destinaltion location in BAR0 space.
> @@ -3265,6 +3283,29 @@ mpt3sas_base_free_smid(struct MPT3SAS_ADAPTER *ioc, u16 smid)
> }
>
> /**
> + * _base_mpi_ep_writeq - 32 bit write to MMIO
> + * @b: data payload
> + * @addr: address in MMIO space
> + * @writeq_lock: spin lock
> + *
> + * This special handling for MPI EP to take care of 32 bit
> + * environment where its not quarenteed to send the entire word
> + * in one transfer.
Hi Suganath,
so is a single writeq possible ? There already is a _base_writeq function
which seems to be identical to _base_mpi_ep_writeq.
Also you may want to add a mmiowb() call.
tomash
> + */
> +static inline void
> +_base_mpi_ep_writeq(__u64 b, volatile void __iomem *addr,
> + spinlock_t *writeq_lock)
> +{
> + unsigned long flags;
> + __u64 data_out = cpu_to_le64(b);
> +
> + spin_lock_irqsave(writeq_lock, flags);
> + writel((u32)(data_out), addr);
> + writel((u32)(data_out >> 32), (addr + 4));
> + spin_unlock_irqrestore(writeq_lock, flags);
> +}
> +
> +/**
> * _base_writeq - 64 bit write to MMIO
> * @ioc: per adapter object
> * @b: data payload
> @@ -3296,6 +3337,36 @@ _base_writeq(__u64 b, volatile void __iomem *addr, spinlock_t *writeq_lock)
> #endif
>
> /**
> + * _base_put_smid_mpi_ep_scsi_io - send SCSI_IO request to firmware
> + * @ioc: per adapter object
> + * @smid: system request message index
> + * @handle: device handle
> + *
> + * Return nothing.
> + */
> +static void
> +_base_put_smid_mpi_ep_scsi_io(struct MPT3SAS_ADAPTER *ioc, u16 smid, u16 handle)
> +{
> + Mpi2RequestDescriptorUnion_t descriptor;
> + u64 *request = (u64 *)&descriptor;
> + void *mpi_req_iomem;
> + __le32 *mfp = (__le32 *)mpt3sas_base_get_msg_frame(ioc, smid);
> +
> + _clone_sg_entries(ioc, (void *) mfp, smid);
> + mpi_req_iomem = (void *)ioc->chip +
> + MPI_FRAME_START_OFFSET + (smid * ioc->request_sz);
> + _base_clone_mpi_to_sys_mem(mpi_req_iomem, (void *)mfp,
> + ioc->request_sz);
> + descriptor.SCSIIO.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO;
> + descriptor.SCSIIO.MSIxIndex = _base_get_msix_index(ioc);
> + descriptor.SCSIIO.SMID = cpu_to_le16(smid);
> + descriptor.SCSIIO.DevHandle = cpu_to_le16(handle);
> + descriptor.SCSIIO.LMID = 0;
> + _base_mpi_ep_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
> + &ioc->scsi_lookup_lock);
> +}
> +
> +/**
> * _base_put_smid_scsi_io - send SCSI_IO request to firmware
> * @ioc: per adapter object
> * @smid: system request message index
> @@ -3356,7 +3427,23 @@ _base_put_smid_hi_priority(struct MPT3SAS_ADAPTER *ioc, u16 smid,
> u16 msix_task)
> {
> Mpi2RequestDescriptorUnion_t descriptor;
> - u64 *request = (u64 *)&descriptor;
> + void *mpi_req_iomem;
> + u64 *request;
> +
> + if (ioc->is_mcpu_endpoint) {
> + MPI2RequestHeader_t *request_hdr;
> +
> + __le32 *mfp = (__le32 *)mpt3sas_base_get_msg_frame(ioc, smid);
> +
> + request_hdr = (MPI2RequestHeader_t *)mfp;
> + /* TBD 256 is offset within sys register. */
> + mpi_req_iomem = (void *)ioc->chip + MPI_FRAME_START_OFFSET
> + + (smid * ioc->request_sz);
> + _base_clone_mpi_to_sys_mem(mpi_req_iomem, (void *)mfp,
> + ioc->request_sz);
> + }
> +
> + request = (u64 *)&descriptor;
>
> descriptor.HighPriority.RequestFlags =
> MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY;
> @@ -3364,8 +3451,13 @@ _base_put_smid_hi_priority(struct MPT3SAS_ADAPTER *ioc, u16 smid,
> descriptor.HighPriority.SMID = cpu_to_le16(smid);
> descriptor.HighPriority.LMID = 0;
> descriptor.HighPriority.Reserved1 = 0;
> - _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
> - &ioc->scsi_lookup_lock);
> + if (ioc->is_mcpu_endpoint)
> + _base_mpi_ep_writeq(*request,
> + &ioc->chip->RequestDescriptorPostLow,
> + &ioc->scsi_lookup_lock);
> + else
> + _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
> + &ioc->scsi_lookup_lock);
> }
>
> /**
> @@ -3403,15 +3495,35 @@ static void
> _base_put_smid_default(struct MPT3SAS_ADAPTER *ioc, u16 smid)
> {
> Mpi2RequestDescriptorUnion_t descriptor;
> - u64 *request = (u64 *)&descriptor;
> + void *mpi_req_iomem;
> + u64 *request;
> + MPI2RequestHeader_t *request_hdr;
>
> + if (ioc->is_mcpu_endpoint) {
> + __le32 *mfp = (__le32 *)mpt3sas_base_get_msg_frame(ioc, smid);
> +
> + request_hdr = (MPI2RequestHeader_t *)mfp;
> +
> + _clone_sg_entries(ioc, (void *) mfp, smid);
> + /* TBD 256 is offset within sys register */
> + mpi_req_iomem = (void *)ioc->chip +
> + MPI_FRAME_START_OFFSET + (smid * ioc->request_sz);
> + _base_clone_mpi_to_sys_mem(mpi_req_iomem, (void *)mfp,
> + ioc->request_sz);
> + }
> + request = (u64 *)&descriptor;
> descriptor.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
> descriptor.Default.MSIxIndex = _base_get_msix_index(ioc);
> descriptor.Default.SMID = cpu_to_le16(smid);
> descriptor.Default.LMID = 0;
> descriptor.Default.DescriptorTypeDependent = 0;
> - _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
> - &ioc->scsi_lookup_lock);
> + if (ioc->is_mcpu_endpoint)
> + _base_mpi_ep_writeq(*request,
> + &ioc->chip->RequestDescriptorPostLow,
> + &ioc->scsi_lookup_lock);
> + else
> + _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
> + &ioc->scsi_lookup_lock);
> }
>
> /**
> @@ -3505,7 +3617,7 @@ _base_put_smid_nvme_encap_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid)
>
> /**
> * _base_put_smid_default - Default, primarily used for config pages
> - * use Atomic Request Descriptor
> + * use Atomic Request Descriptor
> * @ioc: per adapter object
> * @smid: system request message index
> *
> @@ -6330,7 +6442,10 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
> ioc->put_smid_nvme_encap = &_base_put_smid_nvme_encap_atomic;
> } else {
> ioc->put_smid_default = &_base_put_smid_default;
> - ioc->put_smid_scsi_io = &_base_put_smid_scsi_io;
> + if (ioc->is_mcpu_endpoint)
> + ioc->put_smid_scsi_io = &_base_put_smid_mpi_ep_scsi_io;
> + else
> + ioc->put_smid_scsi_io = &_base_put_smid_scsi_io;
> ioc->put_smid_fast_path = &_base_put_smid_fast_path;
> ioc->put_smid_hi_priority = &_base_put_smid_hi_priority;
> ioc->put_smid_nvme_encap = &_base_put_smid_nvme_encap;
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 4/6] mpt3sas: Introduce Base function for cloning.
2018-01-20 18:07 ` kbuild test robot
@ 2018-01-24 5:44 ` Suganath Prabu Subramani
-1 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu Subramani @ 2018-01-24 5:44 UTC (permalink / raw)
To: kbuild-all
Cc: linux-scsi, linux-nvme, Sathya Prakash, Sreekanth Reddy, Chaitra Basappa
Hi All,
We tried to reproduce below error
"drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit
declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);"
with base code and Make file flags (sparse) as mentioned under
reproduce in auto build test log.
We are not seeing this error. We have reviewed the code and it seems
to be fine. Let us know if we miss something here.
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit
declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mpt3sas_scsih_issue_locked_tm
drivers/scsi/mpt3sas/mpt3sas_base.c:315:8: warning: assignment
makes pointer from integer without a cast
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^
At top level:
drivers/scsi/mpt3sas/mpt3sas_base.c:278:13: warning:
'_clone_sg_entries' defined but not used
static void _clone_sg_entries(struct MPT3SAS_ADAPTER
^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
Thanks,
Suganath Prabu S
On Sat, Jan 20, 2018 at 11:37 PM, kbuild test robot <lkp@intel.com> wrote:
> Hi Suganath,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on scsi/for-next]
> [also build test WARNING on v4.15-rc8 next-20180119]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454
> base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
> reproduce:
> # apt-get install sparse
> make ARCH=x86_64 allmodconfig
> make C=1 CF=-D__CHECK_ENDIAN__
>
>
> sparse warnings: (new ones prefixed by >>)
>
>>> drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: sparse: cast from restricted __le32
> drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: expected unsigned int val
> drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: got restricted __le32 <noident>
>>> drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: expected void volatile
> drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: got void COPYING CREDITS Documentation Kbuild Kconfig MAINTAINERS Makefile README arch block certs crypto drivers firmware fs include init ipc kernel lib mm net samples scripts security sound tools usr virt
> drivers/scsi/mpt3sas/mpt3sas_base.c:162:24: sparse: cast removes address space of expression
> drivers/scsi/mpt3sas/mpt3sas_base.c:315:24: sparse: undefined identifier 'mpt3sas_scsih_scsi_lookup_get'
> drivers/scsi/mpt3sas/mpt3sas_base.c:1164:42: sparse: incorrect type in assignment (different base types) @@ expected unsigned short Event @@ got short Event @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:1165:49: sparse: incorrect type in assignment (different base types) @@ expected unsigned int EventContext @@ got ed int EventContext @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:1383:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:1432:52: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:2964:32: sparse: cast removes address space of expression
> drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3411:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3433:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3456:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3477:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3498:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:4950:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:4971:20: sparse: cast to restricted __le16
> drivers/scsi/mpt3sas/mpt3sas_base.c:4980:20: sparse: cast to restricted __le16
> drivers/scsi/mpt3sas/mpt3sas_base.c:4994:36: sparse: cast to restricted __le16
> drivers/scsi/mpt3sas/mpt3sas_base.c:6175:55: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:315:53: sparse: call with no type!
> drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
> drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean
> scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> mpt3sas_scsih_issue_locked_tm
> drivers/scsi/mpt3sas/mpt3sas_base.c:315:8: warning: assignment makes pointer from integer without a cast
> scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
> ^
> At top level:
> drivers/scsi/mpt3sas/mpt3sas_base.c:278:13: warning: '_clone_sg_entries' defined but not used
> static void _clone_sg_entries(struct MPT3SAS_ADAPTER
> ^~~~~~~~~~~~~~~~~
> cc1: some warnings being treated as errors
>
> vim +142 drivers/scsi/mpt3sas/mpt3sas_base.c
>
> 103
> 104 /**
> 105 * _scsih_set_fwfault_debug - global setting of ioc->fwfault_debug.
> 106 *
> 107 */
> 108 static int
> 109 _scsih_set_fwfault_debug(const char *val, const struct kernel_param *kp)
> 110 {
> 111 int ret = param_set_int(val, kp);
> 112 struct MPT3SAS_ADAPTER *ioc;
> 113
> 114 if (ret)
> 115 return ret;
> 116
> 117 /* global ioc spinlock to protect controller list on list operations */
> 118 pr_info("setting fwfault_debug(%d)\n", mpt3sas_fwfault_debug);
> 119 spin_lock(&gioc_lock);
> 120 list_for_each_entry(ioc, &mpt3sas_ioc_list, list)
> 121 ioc->fwfault_debug = mpt3sas_fwfault_debug;
> 122 spin_unlock(&gioc_lock);
> 123 return 0;
> 124 }
> 125 module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug,
> 126 param_get_int, &mpt3sas_fwfault_debug, 0644);
> 127
> 128 /**
> 129 * _base_clone_to_sys_mem - Writes/copies data to system/BAR0 region
> 130 *
> 131 * @dst_iomem: Pointer to the destinaltion location in BAR0 space.
> 132 * @src: Pointer to the Source data.
> 133 * @size: Size of data to be copied.
> 134 */
> 135 static void
> 136 _base_clone_to_sys_mem(void *dst_iomem, void *src, u32 size)
> 137 {
> 138 int i;
> 139 __le32 *src_virt_mem = (__le32 *)(src);
> 140
> 141 for (i = 0; i < size/4; i++)
> > 142 writel(cpu_to_le32(src_virt_mem[i]), dst_iomem + (i * 4));
> 143 }
> 144
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 4/6] mpt3sas: Introduce Base function for cloning.
@ 2018-01-24 5:44 ` Suganath Prabu Subramani
0 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu Subramani @ 2018-01-24 5:44 UTC (permalink / raw)
Hi All,
We tried to reproduce below error
"drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit
declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);"
with base code and Make file flags (sparse) as mentioned under
reproduce in auto build test log.
We are not seeing this error. We have reviewed the code and it seems
to be fine. Let us know if we miss something here.
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit
declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mpt3sas_scsih_issue_locked_tm
drivers/scsi/mpt3sas/mpt3sas_base.c:315:8: warning: assignment
makes pointer from integer without a cast
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^
At top level:
drivers/scsi/mpt3sas/mpt3sas_base.c:278:13: warning:
'_clone_sg_entries' defined but not used
static void _clone_sg_entries(struct MPT3SAS_ADAPTER
^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
Thanks,
Suganath Prabu S
On Sat, Jan 20, 2018@11:37 PM, kbuild test robot <lkp@intel.com> wrote:
> Hi Suganath,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on scsi/for-next]
> [also build test WARNING on v4.15-rc8 next-20180119]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454
> base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
> reproduce:
> # apt-get install sparse
> make ARCH=x86_64 allmodconfig
> make C=1 CF=-D__CHECK_ENDIAN__
>
>
> sparse warnings: (new ones prefixed by >>)
>
>>> drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: sparse: cast from restricted __le32
> drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: expected unsigned int val
> drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: got restricted __le32 <noident>
>>> drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: expected void volatile
> drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: got void COPYING CREDITS Documentation Kbuild Kconfig MAINTAINERS Makefile README arch block certs crypto drivers firmware fs include init ipc kernel lib mm net samples scripts security sound tools usr virt
> drivers/scsi/mpt3sas/mpt3sas_base.c:162:24: sparse: cast removes address space of expression
> drivers/scsi/mpt3sas/mpt3sas_base.c:315:24: sparse: undefined identifier 'mpt3sas_scsih_scsi_lookup_get'
> drivers/scsi/mpt3sas/mpt3sas_base.c:1164:42: sparse: incorrect type in assignment (different base types) @@ expected unsigned short Event @@ got short Event @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:1165:49: sparse: incorrect type in assignment (different base types) @@ expected unsigned int EventContext @@ got ed int EventContext @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:1383:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:1432:52: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:2964:32: sparse: cast removes address space of expression
> drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3411:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3433:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3456:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3477:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:3498:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:4950:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:4971:20: sparse: cast to restricted __le16
> drivers/scsi/mpt3sas/mpt3sas_base.c:4980:20: sparse: cast to restricted __le16
> drivers/scsi/mpt3sas/mpt3sas_base.c:4994:36: sparse: cast to restricted __le16
> drivers/scsi/mpt3sas/mpt3sas_base.c:6175:55: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@
> drivers/scsi/mpt3sas/mpt3sas_base.c:315:53: sparse: call with no type!
> drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
> drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean
> scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> mpt3sas_scsih_issue_locked_tm
> drivers/scsi/mpt3sas/mpt3sas_base.c:315:8: warning: assignment makes pointer from integer without a cast
> scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
> ^
> At top level:
> drivers/scsi/mpt3sas/mpt3sas_base.c:278:13: warning: '_clone_sg_entries' defined but not used
> static void _clone_sg_entries(struct MPT3SAS_ADAPTER
> ^~~~~~~~~~~~~~~~~
> cc1: some warnings being treated as errors
>
> vim +142 drivers/scsi/mpt3sas/mpt3sas_base.c
>
> 103
> 104 /**
> 105 * _scsih_set_fwfault_debug - global setting of ioc->fwfault_debug.
> 106 *
> 107 */
> 108 static int
> 109 _scsih_set_fwfault_debug(const char *val, const struct kernel_param *kp)
> 110 {
> 111 int ret = param_set_int(val, kp);
> 112 struct MPT3SAS_ADAPTER *ioc;
> 113
> 114 if (ret)
> 115 return ret;
> 116
> 117 /* global ioc spinlock to protect controller list on list operations */
> 118 pr_info("setting fwfault_debug(%d)\n", mpt3sas_fwfault_debug);
> 119 spin_lock(&gioc_lock);
> 120 list_for_each_entry(ioc, &mpt3sas_ioc_list, list)
> 121 ioc->fwfault_debug = mpt3sas_fwfault_debug;
> 122 spin_unlock(&gioc_lock);
> 123 return 0;
> 124 }
> 125 module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug,
> 126 param_get_int, &mpt3sas_fwfault_debug, 0644);
> 127
> 128 /**
> 129 * _base_clone_to_sys_mem - Writes/copies data to system/BAR0 region
> 130 *
> 131 * @dst_iomem: Pointer to the destinaltion location in BAR0 space.
> 132 * @src: Pointer to the Source data.
> 133 * @size: Size of data to be copied.
> 134 */
> 135 static void
> 136 _base_clone_to_sys_mem(void *dst_iomem, void *src, u32 size)
> 137 {
> 138 int i;
> 139 __le32 *src_virt_mem = (__le32 *)(src);
> 140
> 141 for (i = 0; i < size/4; i++)
> > 142 writel(cpu_to_le32(src_virt_mem[i]), dst_iomem + (i * 4));
> 143 }
> 144
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 5/6] mpt3sas: Introduce function to clone mpi request.
2018-01-22 14:38 ` Tomas Henzl
(?)
@ 2018-02-23 10:15 ` Suganath Prabu Subramani
-1 siblings, 0 replies; 29+ messages in thread
From: Suganath Prabu Subramani @ 2018-02-23 10:15 UTC (permalink / raw)
Hi tomas,
We have sent V1 version of patches on 7th of Feb. Please review.
Thanks,
Suganath Prabu S
On Mon, Jan 22, 2018@8:08 PM, Tomas Henzl <thenzl@redhat.com> wrote:
> On 01/19/2018 01:37 PM, Suganath Prabu S wrote:
>> 1) Added function _base_clone_mpi_to_sys_mem to clone
>> MPI request into system BAR0 mapped region.
>>
>> 2) Seperate out MPI Endpoint IO submissions to function
>> _base_put_smid_mpi_ep_scsi_io.
>>
>> 3) MPI EP requests are submitted in two 32 bit MMIO writes.
>> from _base_mpi_ep_writeq.
>>
>> Signed-off-by: Suganath Prabu S <suganath-prabu.subramani at broadcom.com>
>> ---
>> drivers/scsi/mpt3sas/mpt3sas_base.c | 131 +++++++++++++++++++++++++++++++++---
>> 1 file changed, 123 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
>> index 40a1806..0248058 100644
>> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
>> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
>> @@ -126,6 +126,24 @@ module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug,
>> param_get_int, &mpt3sas_fwfault_debug, 0644);
>>
>> /**
>> + * _base_clone_mpi_to_sys_mem - Writes/copies MPI frames
>> + * to system/BAR0 region.
>> + *
>> + * @dst_iomem: Pointer to the destinaltion location in BAR0 space.
>> + * @src: Pointer to the Source data.
>> + * @size: Size of data to be copied.
>> + */
>> +static void
>> +_base_clone_mpi_to_sys_mem(void *dst_iomem, void *src, u32 size)
>> +{
>> + int i;
>> + __le32 *src_virt_mem = (__le32 *)src;
>> +
>> + for (i = 0; i < size/4; i++)
>> + writel(cpu_to_le32(src_virt_mem[i]), dst_iomem + (i * 4));
>> +}
>> +
>> +/**
>> * _base_clone_to_sys_mem - Writes/copies data to system/BAR0 region
>> *
>> * @dst_iomem: Pointer to the destinaltion location in BAR0 space.
>> @@ -3265,6 +3283,29 @@ mpt3sas_base_free_smid(struct MPT3SAS_ADAPTER *ioc, u16 smid)
>> }
>>
>> /**
>> + * _base_mpi_ep_writeq - 32 bit write to MMIO
>> + * @b: data payload
>> + * @addr: address in MMIO space
>> + * @writeq_lock: spin lock
>> + *
>> + * This special handling for MPI EP to take care of 32 bit
>> + * environment where its not quarenteed to send the entire word
>> + * in one transfer.
>
> Hi Suganath,
> so is a single writeq possible ? There already is a _base_writeq function
> which seems to be identical to _base_mpi_ep_writeq.
> Also you may want to add a mmiowb() call.
> tomash
>
>> + */
>> +static inline void
>> +_base_mpi_ep_writeq(__u64 b, volatile void __iomem *addr,
>> + spinlock_t *writeq_lock)
>> +{
>> + unsigned long flags;
>> + __u64 data_out = cpu_to_le64(b);
>> +
>> + spin_lock_irqsave(writeq_lock, flags);
>> + writel((u32)(data_out), addr);
>> + writel((u32)(data_out >> 32), (addr + 4));
>> + spin_unlock_irqrestore(writeq_lock, flags);
>> +}
>> +
>> +/**
>> * _base_writeq - 64 bit write to MMIO
>> * @ioc: per adapter object
>> * @b: data payload
>> @@ -3296,6 +3337,36 @@ _base_writeq(__u64 b, volatile void __iomem *addr, spinlock_t *writeq_lock)
>> #endif
>>
>> /**
>> + * _base_put_smid_mpi_ep_scsi_io - send SCSI_IO request to firmware
>> + * @ioc: per adapter object
>> + * @smid: system request message index
>> + * @handle: device handle
>> + *
>> + * Return nothing.
>> + */
>> +static void
>> +_base_put_smid_mpi_ep_scsi_io(struct MPT3SAS_ADAPTER *ioc, u16 smid, u16 handle)
>> +{
>> + Mpi2RequestDescriptorUnion_t descriptor;
>> + u64 *request = (u64 *)&descriptor;
>> + void *mpi_req_iomem;
>> + __le32 *mfp = (__le32 *)mpt3sas_base_get_msg_frame(ioc, smid);
>> +
>> + _clone_sg_entries(ioc, (void *) mfp, smid);
>> + mpi_req_iomem = (void *)ioc->chip +
>> + MPI_FRAME_START_OFFSET + (smid * ioc->request_sz);
>> + _base_clone_mpi_to_sys_mem(mpi_req_iomem, (void *)mfp,
>> + ioc->request_sz);
>> + descriptor.SCSIIO.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO;
>> + descriptor.SCSIIO.MSIxIndex = _base_get_msix_index(ioc);
>> + descriptor.SCSIIO.SMID = cpu_to_le16(smid);
>> + descriptor.SCSIIO.DevHandle = cpu_to_le16(handle);
>> + descriptor.SCSIIO.LMID = 0;
>> + _base_mpi_ep_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
>> + &ioc->scsi_lookup_lock);
>> +}
>> +
>> +/**
>> * _base_put_smid_scsi_io - send SCSI_IO request to firmware
>> * @ioc: per adapter object
>> * @smid: system request message index
>> @@ -3356,7 +3427,23 @@ _base_put_smid_hi_priority(struct MPT3SAS_ADAPTER *ioc, u16 smid,
>> u16 msix_task)
>> {
>> Mpi2RequestDescriptorUnion_t descriptor;
>> - u64 *request = (u64 *)&descriptor;
>> + void *mpi_req_iomem;
>> + u64 *request;
>> +
>> + if (ioc->is_mcpu_endpoint) {
>> + MPI2RequestHeader_t *request_hdr;
>> +
>> + __le32 *mfp = (__le32 *)mpt3sas_base_get_msg_frame(ioc, smid);
>> +
>> + request_hdr = (MPI2RequestHeader_t *)mfp;
>> + /* TBD 256 is offset within sys register. */
>> + mpi_req_iomem = (void *)ioc->chip + MPI_FRAME_START_OFFSET
>> + + (smid * ioc->request_sz);
>> + _base_clone_mpi_to_sys_mem(mpi_req_iomem, (void *)mfp,
>> + ioc->request_sz);
>> + }
>> +
>> + request = (u64 *)&descriptor;
>>
>> descriptor.HighPriority.RequestFlags =
>> MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY;
>> @@ -3364,8 +3451,13 @@ _base_put_smid_hi_priority(struct MPT3SAS_ADAPTER *ioc, u16 smid,
>> descriptor.HighPriority.SMID = cpu_to_le16(smid);
>> descriptor.HighPriority.LMID = 0;
>> descriptor.HighPriority.Reserved1 = 0;
>> - _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
>> - &ioc->scsi_lookup_lock);
>> + if (ioc->is_mcpu_endpoint)
>> + _base_mpi_ep_writeq(*request,
>> + &ioc->chip->RequestDescriptorPostLow,
>> + &ioc->scsi_lookup_lock);
>> + else
>> + _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
>> + &ioc->scsi_lookup_lock);
>> }
>>
>> /**
>> @@ -3403,15 +3495,35 @@ static void
>> _base_put_smid_default(struct MPT3SAS_ADAPTER *ioc, u16 smid)
>> {
>> Mpi2RequestDescriptorUnion_t descriptor;
>> - u64 *request = (u64 *)&descriptor;
>> + void *mpi_req_iomem;
>> + u64 *request;
>> + MPI2RequestHeader_t *request_hdr;
>>
>> + if (ioc->is_mcpu_endpoint) {
>> + __le32 *mfp = (__le32 *)mpt3sas_base_get_msg_frame(ioc, smid);
>> +
>> + request_hdr = (MPI2RequestHeader_t *)mfp;
>> +
>> + _clone_sg_entries(ioc, (void *) mfp, smid);
>> + /* TBD 256 is offset within sys register */
>> + mpi_req_iomem = (void *)ioc->chip +
>> + MPI_FRAME_START_OFFSET + (smid * ioc->request_sz);
>> + _base_clone_mpi_to_sys_mem(mpi_req_iomem, (void *)mfp,
>> + ioc->request_sz);
>> + }
>> + request = (u64 *)&descriptor;
>> descriptor.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
>> descriptor.Default.MSIxIndex = _base_get_msix_index(ioc);
>> descriptor.Default.SMID = cpu_to_le16(smid);
>> descriptor.Default.LMID = 0;
>> descriptor.Default.DescriptorTypeDependent = 0;
>> - _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
>> - &ioc->scsi_lookup_lock);
>> + if (ioc->is_mcpu_endpoint)
>> + _base_mpi_ep_writeq(*request,
>> + &ioc->chip->RequestDescriptorPostLow,
>> + &ioc->scsi_lookup_lock);
>> + else
>> + _base_writeq(*request, &ioc->chip->RequestDescriptorPostLow,
>> + &ioc->scsi_lookup_lock);
>> }
>>
>> /**
>> @@ -3505,7 +3617,7 @@ _base_put_smid_nvme_encap_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid)
>>
>> /**
>> * _base_put_smid_default - Default, primarily used for config pages
>> - * use Atomic Request Descriptor
>> + * use Atomic Request Descriptor
>> * @ioc: per adapter object
>> * @smid: system request message index
>> *
>> @@ -6330,7 +6442,10 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
>> ioc->put_smid_nvme_encap = &_base_put_smid_nvme_encap_atomic;
>> } else {
>> ioc->put_smid_default = &_base_put_smid_default;
>> - ioc->put_smid_scsi_io = &_base_put_smid_scsi_io;
>> + if (ioc->is_mcpu_endpoint)
>> + ioc->put_smid_scsi_io = &_base_put_smid_mpi_ep_scsi_io;
>> + else
>> + ioc->put_smid_scsi_io = &_base_put_smid_scsi_io;
>> ioc->put_smid_fast_path = &_base_put_smid_fast_path;
>> ioc->put_smid_hi_priority = &_base_put_smid_hi_priority;
>> ioc->put_smid_nvme_encap = &_base_put_smid_nvme_encap;
>
>
^ permalink raw reply [flat|nested] 29+ messages in thread
end of thread, other threads:[~2018-02-23 10:15 UTC | newest]
Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-19 12:37 [PATCH 0/6] mpt3sas: Adding MPI Endpoint device support Suganath Prabu S
2018-01-19 12:37 ` Suganath Prabu S
2018-01-19 12:37 ` [PATCH 1/6] mpt3sas: Add PCI device ID for Andromeda Suganath Prabu S
2018-01-19 12:37 ` Suganath Prabu S
2018-01-19 12:37 ` [PATCH 2/6] mpt3sas: Configure reply post queue depth, DMA and sgl tablesize Suganath Prabu S
2018-01-19 12:37 ` Suganath Prabu S
2018-01-19 12:37 ` [PATCH 3/6] mpt3sas: Introduce API's to get BAR0 mapped buffer address Suganath Prabu S
2018-01-19 12:37 ` Suganath Prabu S
2018-01-20 17:24 ` kbuild test robot
2018-01-20 17:24 ` kbuild test robot
2018-01-19 12:37 ` [PATCH 4/6] mpt3sas: Introduce Base function for cloning Suganath Prabu S
2018-01-19 12:37 ` Suganath Prabu S
2018-01-20 17:57 ` kbuild test robot
2018-01-20 17:57 ` kbuild test robot
2018-01-20 18:07 ` kbuild test robot
2018-01-20 18:07 ` kbuild test robot
2018-01-24 5:44 ` Suganath Prabu Subramani
2018-01-24 5:44 ` Suganath Prabu Subramani
2018-01-19 12:37 ` [PATCH 5/6] mpt3sas: Introduce function to clone mpi request Suganath Prabu S
2018-01-19 12:37 ` Suganath Prabu S
2018-01-20 18:38 ` kbuild test robot
2018-01-20 18:38 ` kbuild test robot
2018-01-22 14:38 ` Tomas Henzl
2018-01-22 14:38 ` Tomas Henzl
2018-02-23 10:15 ` Suganath Prabu Subramani
2018-01-19 12:37 ` [PATCH 6/6] mpt3sas: Introduce function to clone mpi reply Suganath Prabu S
2018-01-19 12:37 ` Suganath Prabu S
2018-01-20 19:01 ` kbuild test robot
2018-01-20 19:01 ` kbuild test robot
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.