hisi_sas: DIF/DIX support
Subsystems (2)
PATCH 3/4 scsi: hisi_sas: Make sg_tablesize consistent value
In reply to John GarryFrom: Xiang Chen <[email protected]>
Sht->sg_tablesize is set in the driver, and it will be assigned to shost->sg_tablesize in SCSI mid-layer. So it is not necessary to assign shost->sg_table one more time in the driver.
In addition to the change, change each scsi_host_template.sg_tablesize to HISI_SAS_SGE_PAGE_CNT instead of SG_ALL.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 1 - drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +-- 4 files changed, 3 insertions(+), 5 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +0 -1
@@ -2410,7 +2410,6 @@ int hisi_sas_probe(struct platform_device *pdev, shost->max_lun = ~0 ; shost->max_channel =1 ; shost->max_cmd_len =16 ; - shost->sg_tablesize =min_t (u16,SG_ALL ,HISI_SAS_SGE_PAGE_CNT );if (hisi_hba->hw->slot_index_alloc) { shost->can_queue = hisi_hba->hw->max_command_entries; shost->cmd_per_lun = hisi_hba->hw->max_command_entries;
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +1 -1
@@ -1815,7 +1815,7 @@ static int hisi_sas_v1_init(struct hisi_hba *hisi_hba) .change_queue_depth = sas_change_queue_depth, .bios_param = sas_bios_param, .this_id = -1, - .sg_tablesize = SG_ALL, + .sg_tablesize = HISI_SAS_SGE_PAGE_CNT, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler,
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +1 -1
@@ -3570,7 +3570,7 @@ struct device_attribute *host_attrs_v2_hw[] = { .change_queue_depth = sas_change_queue_depth, .bios_param = sas_bios_param, .this_id = -1, - .sg_tablesize = SG_ALL, + .sg_tablesize = HISI_SAS_SGE_PAGE_CNT, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler,
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -2
@@ -2224,7 +2224,7 @@ struct device_attribute *host_attrs_v3_hw[] = { .change_queue_depth = sas_change_queue_depth, .bios_param = sas_bios_param, .this_id = -1, - .sg_tablesize = SG_ALL, + .sg_tablesize = HISI_SAS_SGE_PAGE_CNT, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler,
@@ -2366,7 +2366,6 @@ struct device_attribute *host_attrs_v3_hw[] = { shost->max_lun = ~0 ; shost->max_channel =1 ; shost->max_cmd_len =16 ; - shost->sg_tablesize =min_t (u16,SG_ALL ,HISI_SAS_SGE_PAGE_CNT ); shost->can_queue = hisi_hba->hw->max_command_entries -HISI_SAS_RESERVED_IPTT_CNT ; shost->cmd_per_lun = hisi_hba->hw->max_command_entries -
Signature · 1 line
1.9.1
PATCH 2/4 scsi: hisi_sas: Relocate some code to reduce complexity
In reply to John GarryFrom: Xiang Chen <[email protected]>
Relocate the codes related to dma_map/unmap in hisi_sas_task_prep() to reduce complexity, with a view to add DIF/DIX support.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 146 +++++++++++++++++++++------------- 1 file changed, 90 insertions(+), 56 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +90 -56
@@ -296,6 +296,90 @@ static void hisi_sas_task_prep_abort(struct hisi_hba *hisi_hba, device_id, abort_flag, tag_to_abort); } +static void hisi_sas_dma_unmap (struct hisi_hba *hisi_hba, +struct sas_task *task,int n_elem, +int n_elem_req,int n_elem_resp) +{ +struct device *dev = hisi_hba->dev; + +if (!sas_protocol_ata (task->task_proto)) { +if (task->num_scatter) { +if (n_elem) +dma_unmap_sg (dev, task->scatter, + task->num_scatter, + task->data_dir); + }else if (task->task_proto &SAS_PROTOCOL_SMP ) { +if (n_elem_req) +dma_unmap_sg (dev, &task->smp_task.smp_req, +1 ,DMA_TO_DEVICE ); +if (n_elem_resp) +dma_unmap_sg (dev, &task->smp_task.smp_resp, +1 ,DMA_FROM_DEVICE ); + } + } +} + +static int hisi_sas_dma_map (struct hisi_hba *hisi_hba, +struct sas_task *task,int *n_elem, +int *n_elem_req,int *n_elem_resp) +{ +struct device *dev = hisi_hba->dev; +int rc; + +if (sas_protocol_ata (task->task_proto)) { + *n_elem = task->num_scatter; + }else { +unsigned int req_len, resp_len; + +if (task->num_scatter) { + *n_elem =dma_map_sg (dev, task->scatter, + task->num_scatter, task->data_dir); +if (!*n_elem) { + rc = -ENOMEM ; + goto prep_out; + } + }else if (task->task_proto &SAS_PROTOCOL_SMP ) { + *n_elem_req =dma_map_sg (dev, &task->smp_task.smp_req, +1 ,DMA_TO_DEVICE ); +if (!*n_elem_req) { + rc = -ENOMEM ; + goto prep_out; + } + req_len =sg_dma_len (&task->smp_task.smp_req); +if (req_len &0x3 ) { + rc = -EINVAL ; + goto err_out_dma_unmap; + } + *n_elem_resp =dma_map_sg (dev, &task->smp_task.smp_resp, +1 ,DMA_FROM_DEVICE ); +if (!*n_elem_resp) { + rc = -ENOMEM ; + goto err_out_dma_unmap; + } + resp_len =sg_dma_len (&task->smp_task.smp_resp); +if (resp_len &0x3 ) { + rc = -EINVAL ; + goto err_out_dma_unmap; + } + } + } + +if (*n_elem >HISI_SAS_SGE_PAGE_CNT ) { +dev_err (dev,"task prep: n_elem(%d) > HISI_SAS_SGE_PAGE_CNT" , + *n_elem); + rc = -EINVAL ; + goto err_out_dma_unmap; + } +return 0 ; + +err_out_dma_unmap: +/* It would be better to call dma_unmap_sg() here, but it's messy */ +hisi_sas_dma_unmap (hisi_hba, task, *n_elem, + *n_elem_req, *n_elem_resp); +prep_out: +return rc; +} + static int hisi_sas_task_prep(struct sas_task *task, struct hisi_sas_dq **dq_pointer, bool is_tmf, struct hisi_sas_tmf_task *tmf,
@@ -338,49 +422,10 @@ static int hisi_sas_task_prep(struct sas_task *task,return -ECOMM ; } -if (!sas_protocol_ata (task->task_proto)) { -unsigned int req_len, resp_len; - -if (task->num_scatter) { - n_elem =dma_map_sg (dev, task->scatter, - task->num_scatter, task->data_dir); -if (!n_elem) { - rc = -ENOMEM ; - goto prep_out; - } - }else if (task->task_proto &SAS_PROTOCOL_SMP ) { - n_elem_req =dma_map_sg (dev, &task->smp_task.smp_req, -1 ,DMA_TO_DEVICE ); -if (!n_elem_req) { - rc = -ENOMEM ; - goto prep_out; - } - req_len =sg_dma_len (&task->smp_task.smp_req); -if (req_len &0x3 ) { - rc = -EINVAL ; - goto err_out_dma_unmap; - } - n_elem_resp =dma_map_sg (dev, &task->smp_task.smp_resp, -1 ,DMA_FROM_DEVICE ); -if (!n_elem_resp) { - rc = -ENOMEM ; - goto err_out_dma_unmap; - } - resp_len =sg_dma_len (&task->smp_task.smp_resp); -if (resp_len &0x3 ) { - rc = -EINVAL ; - goto err_out_dma_unmap; - } - } - }else - n_elem = task->num_scatter; - -if (n_elem >HISI_SAS_SGE_PAGE_CNT ) { -dev_err (dev,"task prep: n_elem(%d) > HISI_SAS_SGE_PAGE_CNT" , - n_elem); - rc = -EINVAL ; - goto err_out_dma_unmap; - } + rc =hisi_sas_dma_map (hisi_hba, task, &n_elem, + &n_elem_req, &n_elem_resp); +if (rc <0 ) + goto prep_out;if (hisi_hba->hw->slot_index_alloc) rc = hisi_hba->hw->slot_index_alloc (hisi_hba, device);
@@ -465,19 +510,8 @@ static int hisi_sas_task_prep(struct sas_task *task, err_out_tag:hisi_sas_slot_index_free (hisi_hba, slot_idx); err_out_dma_unmap: -if (!sas_protocol_ata (task->task_proto)) { -if (task->num_scatter) { -dma_unmap_sg (dev, task->scatter, task->num_scatter, - task->data_dir); - }else if (task->task_proto &SAS_PROTOCOL_SMP ) { -if (n_elem_req) -dma_unmap_sg (dev, &task->smp_task.smp_req, -1 ,DMA_TO_DEVICE ); -if (n_elem_resp) -dma_unmap_sg (dev, &task->smp_task.smp_resp, -1 ,DMA_FROM_DEVICE ); - } - } +hisi_sas_dma_unmap (hisi_hba, task, n_elem, + n_elem_req, n_elem_resp); prep_out:dev_err (dev,"task prep: failed[%d]!\n" , rc);return rc;
Signature · 1 line
1.9.1
PATCH 4/4 scsi: hisi_sas: Add support for DIF/DIX feature for v3 hw
In reply to John GarryFrom: Xiang Chen <[email protected]>
For v3 hw, we support DIF/DIX operation for SAS, but not SATA.
In addition, DIF CRC16 is supported.
This patchset adds the SW support for the described features. The main components are as follows:
- Allocate memory for PI
- Fill PI fields
- Fill related to DIF/DIX in DQ and protection iu memories
--- drivers/scsi/hisi_sas/hisi_sas.h | 18 ++++ drivers/scsi/hisi_sas/hisi_sas_main.c | 99 ++++++++++++++--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 189 ++++++++++++++++++++++++++++++++- 3 files changed, 289 insertions(+), 17 deletions(-)
drivers/scsi/hisi_sas/hisi_sas.h +18 -0
@@ -55,6 +55,11 @@#define hisi_sas_sge_addr_mem (slot) hisi_sas_sge_addr(slot->buf)#define hisi_sas_sge_addr_dma (slot) hisi_sas_sge_addr(slot->buf_dma) +#define hisi_sas_sge_dif_addr (buf) \ + (buf + offsetof(struct hisi_sas_slot_dif_buf_table, sge_dif_page)) +#define hisi_sas_sge_dif_addr_mem (slot) hisi_sas_sge_dif_addr(slot->buf) +#define hisi_sas_sge_dif_addr_dma (slot) hisi_sas_sge_dif_addr(slot->buf_dma) +#define HISI_SAS_MAX_SSP_RESP_SZ (sizeof(struct ssp_frame_hdr) + 1024)#define HISI_SAS_MAX_SMP_RESP_SZ 1028#define HISI_SAS_MAX_STP_RESP_SZ 28
@@ -197,6 +202,7 @@ struct hisi_sas_slot {struct sas_task *task;struct hisi_sas_port *port;u64 n_elem; +u64 n_elem_dif;int dlvry_queue;int dlvry_queue_slot;int cmplt_queue;
@@ -268,6 +274,8 @@ struct hisi_hba {struct pci_dev *pci_dev;struct device *dev; +bool enable_dif_dix; +void __iomem *regs;void __iomem *sgpio_regs;struct regmap *ctrl;
@@ -422,6 +430,11 @@ struct hisi_sas_sge_page {struct hisi_sas_sge sge[HISI_SAS_SGE_PAGE_CNT ]; }__aligned(16) ; +#define HISI_SAS_SGE_DIF_PAGE_CNT SG_CHUNK_SIZE +struct hisi_sas_sge_dif_page { +struct hisi_sas_sge sge[HISI_SAS_SGE_DIF_PAGE_CNT ]; +}__aligned(16) ; +struct hisi_sas_command_table_ssp {struct ssp_frame_hdr hdr;union {
@@ -452,6 +465,11 @@ struct hisi_sas_slot_buf_table {struct hisi_sas_sge_page sge_page; }; +struct hisi_sas_slot_dif_buf_table { +struct hisi_sas_slot_buf_table slot_buf; +struct hisi_sas_sge_dif_page sge_dif_page; +}; +extern struct scsi_transport_template *hisi_sas_stt;extern void hisi_sas_stop_phys (struct hisi_hba *hisi_hba);extern int hisi_sas_alloc (struct hisi_hba *hisi_hba,struct Scsi_Host *shost);
drivers/scsi/hisi_sas/hisi_sas_main.c +87 -12
168 lines not on this page · raw message
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +184 -5
254 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 1/4 scsi: Add scsi_prot_op_normal()
In reply to John GarryIt is a common pattern to check if a Scsi command protection option is "normal", i.e. regular IO.
Add a common simple wrapper for this.
--- include/scsi/scsi_cmnd.h | 5 +++++ 1 file changed, 5 insertions(+)
include/scsi/scsi_cmnd.h +5 -0
@@ -271,6 +271,11 @@ static inline unsigned char scsi_get_prot_op(struct scsi_cmnd *scmd)return scmd->prot_op; } +static inline bool scsi_prot_op_normal (struct scsi_cmnd *scmd) +{ +return scmd->prot_op ==SCSI_PROT_NORMAL ; +} +enum scsi_prot_flags {SCSI_PROT_TRANSFER_PI =1 <<0 ,SCSI_PROT_GUARD_CHECK =1 <<1 ,
Signature · 1 line
1.9.1
cover hisi_sas: DIF/DIX support
This patchset introduces support to the driver for DIF/DIX (or PI - protection information).
We will only support PI in v3 hw at the moment, even though previous hw versions also support.
The series is broken down as follows:
- Add a generic helper for checking Scsi command normal operation
- Some tidy-up to accept PI support
- Add components for PI support for main and v3 driver
John Garry (1):
scsi: Add scsi_prot_op_normal()
Xiang Chen (3):
scsi: hisi_sas: Relocate some code to reduce complexity
scsi: hisi_sas: Make sg_tablesize consistent value
scsi: hisi_sas: Add support for DIF/DIX feature for v3 hw
drivers/scsi/hisi_sas/hisi_sas.h | 18 +++ drivers/scsi/hisi_sas/hisi_sas_main.c | 242 ++++++++++++++++++++++++--------- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 192 +++++++++++++++++++++++++- include/scsi/scsi_cmnd.h | 5 + 6 files changed, 385 insertions(+), 76 deletions(-)
Signature · 1 line
1.9.1
Re: [PATCH 1/4] scsi: Add scsi_prot_op_normal()
In reply to John Garryinclude/scsi/scsi_cmnd.h static inline unsigned char scsi_get_prot_op(struct scsi_cmnd *scmd) · line 277
Quoted 4 lines
include/scsi/scsi_cmnd.h +4
-0+static inline bool scsi_prot_op_normal (struct scsi_cmnd *scmd) +{ +return scmd->prot_op ==SCSI_PROT_NORMAL ; +}
This "wrapper" just obsfucates the check being performed, please drop it.
Re: [PATCH 1/4] scsi: Add scsi_prot_op_normal()
Quoted 10 lines · Christoph Hellwig
include/scsi/scsi_cmnd.h static inline unsigned char scsi_get_prot_op(struct scsi_cmnd *scmd) · line 277
Quoted 4 lines
include/scsi/scsi_cmnd.h +4
-0+static inline bool scsi_prot_op_normal (struct scsi_cmnd *scmd) +{ +return scmd->prot_op ==SCSI_PROT_NORMAL ; +}This "wrapper" just obsfucates the check being performed, please drop it.
.
ok, if you think so.
I just thought that was better for a more concise check, rather than this common pattern:
if ((scsi_get_prot_op(scsi_cmnd) != SCSI_PROT_NORMAL) ...
cheers,
Re: [PATCH 3/4] scsi: hisi_sas: Make sg_tablesize consistent value
In reply to John GarryQuoted 8 lines · John Garry
From: Xiang Chen <[email protected]>
Sht->sg_tablesizeis set in the driver, and it will be assigned toshost->sg_tablesizein SCSI mid-layer. So it is not necessary to assignshost->sg_tableone more time in the driver.In addition to the change, change each scsi_host_template.sg_tablesize to
HISI_SAS_SGE_PAGE_CNTinstead ofSG_ALL.
Might be completely irrelevant, so just as information: I once had problems due to changing (reducing) SHT.sg_tablesize because block queue limits of BSG devices of Scsi_Host and fc_host (not sure if you have an equivalent bsg device for your transport(s)) inherit from SHT, but don't update (automatically) on later updates of shost->sg_tablesize, which in turn affect scsi_devices allocated after the shost update. Cf. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/s390/scsi?id=5fea4291deacd80188b996d2f555fc6a1940e5d4
("[SCSI] zfcp: block queue limits with data router")
if you need more details.
Quoted 69 lines
Signed-off-by Xiang Chen <[email protected]>Signed-off-by John Garry <[email protected]>--- drivers/scsi/hisi_sas/hisi_sas_main.c | 1 - drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +-- 4 files changed, 3 insertions(+), 5 deletions(-)drivers/scsi/hisi_sas/hisi_sas_main.c +0
-1@@ -2410,7 +2410,6 @@ int hisi_sas_probe(struct platform_device *pdev, shost->max_lun = ~0 ; shost->max_channel =1 ; shost->max_cmd_len =16 ; - shost->sg_tablesize =min_t (u16,SG_ALL ,HISI_SAS_SGE_PAGE_CNT );if (hisi_hba->hw->slot_index_alloc) { shost->can_queue = hisi_hba->hw->max_command_entries; shost->cmd_per_lun = hisi_hba->hw->max_command_entries;drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +1
-1@@ -1815,7 +1815,7 @@ static int hisi_sas_v1_init(struct hisi_hba *hisi_hba) .change_queue_depth = sas_change_queue_depth, .bios_param = sas_bios_param, .this_id = -1, - .sg_tablesize = SG_ALL, + .sg_tablesize = HISI_SAS_SGE_PAGE_CNT, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler,drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +1
-1@@ -3570,7 +3570,7 @@ struct device_attribute *host_attrs_v2_hw[] = { .change_queue_depth = sas_change_queue_depth, .bios_param = sas_bios_param, .this_id = -1, - .sg_tablesize = SG_ALL, + .sg_tablesize = HISI_SAS_SGE_PAGE_CNT, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler,drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1
-2@@ -2224,7 +2224,7 @@ struct device_attribute *host_attrs_v3_hw[] = { .change_queue_depth = sas_change_queue_depth, .bios_param = sas_bios_param, .this_id = -1, - .sg_tablesize = SG_ALL, + .sg_tablesize = HISI_SAS_SGE_PAGE_CNT, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler,@@ -2366,7 +2366,6 @@ struct device_attribute *host_attrs_v3_hw[] = { shost->max_lun = ~0 ; shost->max_channel =1 ; shost->max_cmd_len =16 ; - shost->sg_tablesize =min_t (u16,SG_ALL ,HISI_SAS_SGE_PAGE_CNT ); shost->can_queue = hisi_hba->hw->max_command_entries -HISI_SAS_RESERVED_IPTT_CNT ; shost->cmd_per_lun = hisi_hba->hw->max_command_entries -
Signature · 10 lines
Mit freundlichen Gruessen / Kind regards Steffen Maier Linux on IBM Z Development IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschaeftsfuehrung: Dirk Wittkopp Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
Re: [PATCH 3/4] scsi: hisi_sas: Make sg_tablesize consistent value
Quoted 7 lines · Steffen Maier
Quoted 6 lines · John Garry
From: Xiang Chen <[email protected]>
Sht->sg_tablesizeis set in the driver, and it will be assigned toshost->sg_tablesizein SCSI mid-layer. So it is not necessary to assignshost->sg_tableone more time in the driver.
Quoted 5 lines
Quoted 2 lines
In addition to the change, change each scsi_host_template.sg_tablesize to
HISI_SAS_SGE_PAGE_CNTinstead ofSG_ALL.Might be completely irrelevant, so just as information: I once had problems due to changing (reducing) SHT.sg_tablesize because block queue limits of BSG devices of
Scsi_Hostandfc_host(not sure if you have an equivalent bsg device for your transport(s)) inherit from SHT, but don't update (automatically) on later updates ofshost->sg_tablesize, which in turn affectscsi_devicesallocated after the shost update. Cf. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/s390/scsi?id=5fea4291deacd80188b996d2f555fc6a1940e5d4
Figured, your new constant seems to have the same value so no problem.
#define SG_CHUNK_SIZE 128
#define SG_ALL SG_CHUNK_SIZE
#define HISI_SAS_SGE_PAGE_CNT SG_CHUNK_SIZE
Quoted 75 lines
("[SCSI] zfcp: block queue limits with data router") if you need more details.
Quoted 70 lines
Signed-off-by Xiang Chen <[email protected]>Signed-off-by John Garry <[email protected]>---
drivers/scsi/hisi_sas/hisi_sas_main.c | 1 -drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +-- 4 files changed, 3 insertions(+), 5 deletions(-)drivers/scsi/hisi_sas/hisi_sas_main.c +0
-1@@ -2410,7 +2410,6 @@ int hisi_sas_probe(struct platform_device *pdev, shost->max_lun = ~0; shost->max_channel = 1; shost->max_cmd_len = 16; - shost->sg_tablesize = min_t(u16, SG_ALL, HISI_SAS_SGE_PAGE_CNT); if (hisi_hba->hw->slot_index_alloc) { shost->can_queue = hisi_hba->hw->max_command_entries; shost->cmd_per_lun = hisi_hba->hw->max_command_entries;drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +1
-1@@ -1815,7 +1815,7 @@ static int hisi_sas_v1_init(struct hisi_hba *hisi_hba) .change_queue_depth = sas_change_queue_depth, .bios_param = sas_bios_param, .this_id = -1, - .sg_tablesize = SG_ALL, + .sg_tablesize = HISI_SAS_SGE_PAGE_CNT, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING,.eh_device_reset_handler =
sas_eh_device_reset_handler,drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +1
-1@@ -3570,7 +3570,7 @@ struct device_attribute *host_attrs_v2_hw[] = { .change_queue_depth = sas_change_queue_depth, .bios_param = sas_bios_param, .this_id = -1, - .sg_tablesize = SG_ALL, + .sg_tablesize = HISI_SAS_SGE_PAGE_CNT, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler,drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1
-2@@ -2224,7 +2224,7 @@ struct device_attribute *host_attrs_v3_hw[] = { .change_queue_depth = sas_change_queue_depth, .bios_param = sas_bios_param, .this_id = -1, - .sg_tablesize = SG_ALL, + .sg_tablesize = HISI_SAS_SGE_PAGE_CNT, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler,@@ -2366,7 +2366,6 @@ struct device_attribute *host_attrs_v3_hw[] = { shost->max_lun = ~0; shost->max_channel = 1; shost->max_cmd_len = 16; - shost->sg_tablesize = min_t(u16, SG_ALL, HISI_SAS_SGE_PAGE_CNT);
shost->can_queue=hisi_hba->hw->max_command_entries-HISI_SAS_RESERVED_IPTT_CNT;shost->cmd_per_lun=hisi_hba->hw->max_command_entries-
Signature · 10 lines
Mit freundlichen Gruessen / Kind regards Steffen Maier Linux on IBM Z Development IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschaeftsfuehrung: Dirk Wittkopp Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
Re: [PATCH 3/4] scsi: hisi_sas: Make sg_tablesize consistent value
Quoted 22 lines · Steffen Maier
Quoted 10 lines · Steffen Maier
Quoted 8 lines · John Garry
From: Xiang Chen <[email protected]>
Sht->sg_tablesizeis set in the driver, and it will be assigned toshost->sg_tablesizein SCSI mid-layer. So it is not necessary to assignshost->sg_tableone more time in the driver.In addition to the change, change each scsi_host_template.sg_tablesize to
HISI_SAS_SGE_PAGE_CNTinstead ofSG_ALL.Quoted 9 lines
Might be completely irrelevant, so just as information: I once had problems due to changing (reducing) SHT.sg_tablesize because block queue limits of BSG devices of
Scsi_Hostandfc_host(not sure if you have an equivalent bsg device for your transport(s)) inherit from SHT, but don't update (automatically) on later updates ofshost->sg_tablesize, which in turn affectscsi_devicesallocated after the shost update.
Cf.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/s390/scsi?id=5fea4291deacd80188b996d2f555fc6a1940e5d4
Quoted 2 lines
Figured, your new constant seems to have the same value so no problem.
Right, so previously we were doing similar to what you describe - setting the value in the SHT and then setting shost->sg_tablesize after the host is allocated.
However the values were the same, so in this patch we're just removing setting shost->sg_tablesize (again).
Thanks,
John
Quoted 85 lines
#define
SG_CHUNK_SIZE128
#defineSG_ALLSG_CHUNK_SIZE
#defineHISI_SAS_SGE_PAGE_CNTSG_CHUNK_SIZEQuoted 79 lines
("[SCSI] zfcp: block queue limits with data router") if you need more details.
Quoted 74 lines
Signed-off-by Xiang Chen <[email protected]>Signed-off-by John Garry <[email protected]>--- drivers/scsi/hisi_sas/hisi_sas_main.c | 1 - drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +-- 4 files changed, 3 insertions(+), 5 deletions(-)drivers/scsi/hisi_sas/hisi_sas_main.c +0
-1@@ -2410,7 +2410,6 @@ int hisi_sas_probe(struct platform_device *pdev, shost->max_lun = ~0 ; shost->max_channel =1 ; shost->max_cmd_len =16 ; - shost->sg_tablesize =min_t (u16,SG_ALL ,HISI_SAS_SGE_PAGE_CNT );if (hisi_hba->hw->slot_index_alloc) { shost->can_queue = hisi_hba->hw->max_command_entries; shost->cmd_per_lun = hisi_hba->hw->max_command_entries;drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +1
-1@@ -1815,7 +1815,7 @@ static int hisi_sas_v1_init(struct hisi_hba *hisi_hba) .change_queue_depth = sas_change_queue_depth, .bios_param = sas_bios_param, .this_id = -1, - .sg_tablesize = SG_ALL, + .sg_tablesize = HISI_SAS_SGE_PAGE_CNT, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING,.eh_device_reset_handler =
sas_eh_device_reset_handler,drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +1
-1@@ -3570,7 +3570,7 @@ struct device_attribute *host_attrs_v2_hw[] = { .change_queue_depth = sas_change_queue_depth, .bios_param = sas_bios_param, .this_id = -1, - .sg_tablesize = SG_ALL, + .sg_tablesize = HISI_SAS_SGE_PAGE_CNT, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler,drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1
-2@@ -2224,7 +2224,7 @@ struct device_attribute *host_attrs_v3_hw[] = { .change_queue_depth = sas_change_queue_depth, .bios_param = sas_bios_param, .this_id = -1, - .sg_tablesize = SG_ALL, + .sg_tablesize = HISI_SAS_SGE_PAGE_CNT, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler,@@ -2366,7 +2366,6 @@ struct device_attribute *host_attrs_v3_hw[] = { shost->max_lun = ~0 ; shost->max_channel =1 ; shost->max_cmd_len =16 ; - shost->sg_tablesize =min_t (u16,SG_ALL ,HISI_SAS_SGE_PAGE_CNT ); shost->can_queue = hisi_hba->hw->max_command_entries -HISI_SAS_RESERVED_IPTT_CNT ; shost->cmd_per_lun = hisi_hba->hw->max_command_entries -
kbuild test robot
build botRe: [PATCH 4/4] scsi: hisi_sas: Add support for DIF/DIX feature for v3 hw
In reply to John GarryThank you for the patch! Perhaps something to improve:
Hi Xiang,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on next-20181123]
[cannot apply to v4.20-rc3]
[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/John-Garry/hisi_sas-DIF-DIX-support/20181123-202805 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next config: x86_64-allmodconfig (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64
All warnings (new ones prefixed by >>):
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: incorrect type in argument 1 (different base types)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: expected unsigned long long [unsigned] [usertype] val
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: got restricted __le64 [usertype] sas_addr
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:24: warning: incorrect type in assignment (different base types)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:24: expected restricted __le64 [usertype] sas_addr
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:24: got unsigned long long
>> drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1165:26: warning: invalid assignment: |=
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1165:26: left side has type restricted __le32
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1165:26: right side has type int
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1166:26: warning: invalid assignment: |=
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1166:26: left side has type restricted __le32
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1166:26: right side has type int
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1759:37: warning: incorrect type in initializer (different base types)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1759:37: expected unsigned int [unsigned] [usertype] dma_rx_err_type
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1759:37: got restricted __le32 [usertype] dma_rx_err_type
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1760:40: warning: incorrect type in initializer (different base types)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1760:40: expected unsigned int [unsigned] [usertype] trans_tx_fail_type
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1760:40: got restricted __le32 [usertype] trans_tx_fail_type
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1767:40: warning: restricted __le32 degrades to integer drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1781:40: warning: restricted __le32 degrades to integer drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1840:30: warning: restricted __le32 degrades to integer drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1864:26: warning: restricted __le32 degrades to integer drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1976:37: warning: restricted __le32 degrades to integer drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2372:25: warning: symbol 'host_attrs_v3_hw' was not declared. Should it be static? drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2858:22: warning: incorrect type in assignment (different base types)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2858:22: expected unsigned int [unsigned] [usertype] device_state
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2858:22: got restricted pci_power_t
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2863:35: warning: incorrect type in argument 2 (different base types)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2863:35: expected restricted pci_power_t [usertype] state
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2863:35: got unsigned int [unsigned] [usertype] device_state
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2878:32: warning: incorrect type in initializer (different base types)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2878:32: expected unsigned int [unsigned] [usertype] device_state
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2878:32: got restricted pci_power_t [usertype] current_state
vim +1165 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
1072
1073 static void prep_ssp_v3_hw(struct hisi_hba *hisi_hba,
1074 struct hisi_sas_slot *slot)
1075 {
1076 struct sas_task *task = slot->task;
1077 struct hisi_sas_cmd_hdr *hdr = slot->cmd_hdr;
1078 struct domain_device *device = task->dev;
1079 struct hisi_sas_device *sas_dev = device->lldd_dev;
1080 struct hisi_sas_port *port = slot->port;
1081 struct sas_ssp_task *ssp_task = &task->ssp_task;
1082 struct scsi_cmnd *scsi_cmnd = ssp_task->cmd;
1083 struct hisi_sas_tmf_task *tmf = slot->tmf;
1084 int has_data = 0, priority = !!tmf;
1085 u8 *buf_cmd;
1086 u32 dw1 = 0, dw2 = 0, len = 0;
1087
1088 hdr->dw0 = cpu_to_le32((1 << CMD_HDR_RESP_REPORT_OFF) |
1089 (2 << CMD_HDR_TLR_CTRL_OFF) |
1090 (port->id << CMD_HDR_PORT_OFF) |
1091 (priority << CMD_HDR_PRIORITY_OFF) |
1092 (1 << CMD_HDR_CMD_OFF)); /* ssp */
1093
1094 dw1 = 1 << CMD_HDR_VDTL_OFF;
1095 if (tmf) {
1096 dw1 |= 2 << CMD_HDR_FRAME_TYPE_OFF;
1097 dw1 |= DIR_NO_DATA << CMD_HDR_DIR_OFF;
1098 } else {
1099 dw1 |= 1 << CMD_HDR_FRAME_TYPE_OFF;
1100 switch (scsi_cmnd->sc_data_direction) {
1101 case DMA_TO_DEVICE:
1102 has_data = 1;
1103 dw1 |= DIR_TO_DEVICE << CMD_HDR_DIR_OFF;
1104 break;
1105 case DMA_FROM_DEVICE:
1106 has_data = 1;
1107 dw1 |= DIR_TO_INI << CMD_HDR_DIR_OFF;
1108 break;
1109 default:
1110 dw1 &= ~CMD_HDR_DIR_MSK;
1111 }
1112 }
1113
1114 /* map itct entry */
1115 dw1 |= sas_dev->device_id << CMD_HDR_DEV_ID_OFF;
1116 hdr->dw1 = cpu_to_le32(dw1);
1117
1118 dw2 = (((sizeof(struct ssp_command_iu) + sizeof(struct ssp_frame_hdr)
1119 + 3) / 4) << CMD_HDR_CFL_OFF) |
1120 ((HISI_SAS_MAX_SSP_RESP_SZ / 4) << CMD_HDR_MRFL_OFF) |
1121 (2 << CMD_HDR_SG_MOD_OFF);
1122 hdr->dw2 = cpu_to_le32(dw2);
1123 hdr->transfer_tags = cpu_to_le32(slot->idx);
1124
1125 if (has_data) {
1126 prep_prd_sge_v3_hw(hisi_hba, slot, hdr, task->scatter,
1127 slot->n_elem);
1128
1129 if (scsi_prot_sg_count(scsi_cmnd))
1130 prep_prd_sge_dif_v3_hw(hisi_hba, slot, hdr,
1131 scsi_prot_sglist(scsi_cmnd),
1132 slot->n_elem_dif);
1133 }
1134
1135 hdr->cmd_table_addr = cpu_to_le64(hisi_sas_cmd_hdr_addr_dma(slot));
1136 hdr->sts_buffer_addr = cpu_to_le64(hisi_sas_status_buf_addr_dma(slot));
1137
1138 buf_cmd = hisi_sas_cmd_hdr_addr_mem(slot) +
1139 sizeof(struct ssp_frame_hdr);
1140
1141 memcpy(buf_cmd, &task->ssp_task.LUN, 8);
1142 if (!tmf) {
1143 buf_cmd[9] = ssp_task->task_attr | (ssp_task->task_prio << 3);
1144 memcpy(buf_cmd + 12, scsi_cmnd->cmnd, scsi_cmnd->cmd_len);
1145 } else {
1146 buf_cmd[10] = tmf->tmf;
1147 switch (tmf->tmf) {
1148 case TMF_ABORT_TASK:
1149 case TMF_QUERY_TASK:
1150 buf_cmd[12] =
1151 (tmf->tag_of_task_to_be_managed >> 8) & 0xff;
1152 buf_cmd[13] =
1153 tmf->tag_of_task_to_be_managed & 0xff;
1154 break;
1155 default:
1156 break;
1157 }
1158 }
1159
1160 if (has_data && !scsi_prot_op_normal(scsi_cmnd)) {
1161 struct hisi_sas_protect_iu_v3_hw prot;
1162 unsigned char prot_op = scsi_get_prot_op(scsi_cmnd);
1163 u8 *buf_cmd_prot;
1164
> 1165 hdr->dw7 |= 1 << CMD_HDR_ADDR_MODE_SEL_OFF;
1166 hdr->dw1 |= CMD_HDR_PIR_MSK;
1167 buf_cmd_prot = hisi_sas_cmd_hdr_addr_mem(slot) +
1168 sizeof(struct ssp_frame_hdr) +
1169 sizeof(struct ssp_command_iu);
1170
1171 memset(&prot, 0, sizeof(struct hisi_sas_protect_iu_v3_hw));
1172 fill_prot_v3_hw(scsi_cmnd, &prot);
1173 memcpy(buf_cmd_prot, &prot,
1174 sizeof(struct hisi_sas_protect_iu_v3_hw));
1175
1176 if ((prot_op == SCSI_PROT_READ_INSERT) ||
1177 (prot_op == SCSI_PROT_WRITE_INSERT) ||
1178 (prot_op == SCSI_PROT_WRITE_PASS) ||
1179 (prot_op == SCSI_PROT_READ_PASS)) { 1180 unsigned int interval = scsi_prot_interval(scsi_cmnd);
1181 unsigned int ilog2_interval = ilog2(interval);
1182
1183 len = (task->total_xfer_len >> ilog2_interval) * 8;
1184 }
1185 }
1186
1187 hdr->data_transfer_len = cpu_to_le32(task->total_xfer_len + len);
1188 }
1189
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH 4/4] scsi: hisi_sas: Add support for DIF/DIX feature for v3 hw
Quoted 9 lines · kbuild test robot
Hi Xiang,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on next-20181123]
[cannot apply to v4.20-rc3]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
Quoted 7 lines
url: https://github.com/0day-ci/linux/commits/John-Garry/hisi_sas-DIF-DIX-support/20181123-202805 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next config: x86_64-allmodconfig (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64
For sparse errors - which are detected, below - we need C=2 option, right?
It would be good to include that in the instructions.
Thanks,
John
Quoted 171 lines
All warnings (new ones prefixed by >>):
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: incorrect type in argument 1 (different base types) drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: expected unsigned long long [unsigned] [usertype] val drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: got restricted __le64 [usertype] sas_addr drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted __le64 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:24: warning: incorrect type in assignment (different base types) drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:24: expected restricted __le64 [usertype] sas_addr drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:24: got unsigned long longQuoted 1 line
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1165:26: warning: invalid assignment: |=
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1165:26: left side has type restricted__le32
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1165:26: right side has type int
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1166:26: warning: invalid assignment: |=
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1166:26: left side has type restricted__le32
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1166:26: right side has type int
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1759:37: warning: incorrect type in initializer (different base types)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1759:37: expected unsigned int [unsigned] [usertype]dma_rx_err_type
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1759:37: got restricted__le32[usertype]dma_rx_err_type
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1760:40: warning: incorrect type in initializer (different base types)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1760:40: expected unsigned int [unsigned] [usertype]trans_tx_fail_type
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1760:40: got restricted__le32[usertype]trans_tx_fail_type
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1767:40: warning: restricted__le32degrades to integerdrivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1781:40: warning: restricted__le32degrades to integerdrivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1840:30: warning: restricted__le32degrades to integerdrivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1864:26: warning: restricted__le32degrades to integerdrivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1976:37: warning: restricted__le32degrades to integerdrivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2372:25: warning: symbol 'host_attrs_v3_hw' was not declared. Should it be static?drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2858:22: warning: incorrect type in assignment (different base types)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2858:22: expected unsigned int [unsigned] [usertype]device_state
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2858:22: got restrictedpci_power_t
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2863:35: warning: incorrect type in argument 2 (different base types)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2863:35: expected restrictedpci_power_t[usertype] state
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2863:35: got unsigned int [unsigned] [usertype]device_state
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2878:32: warning: incorrect type in initializer (different base types)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2878:32: expected unsigned int [unsigned] [usertype]device_state
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2878:32: got restrictedpci_power_t[usertype]current_statevim +1165
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c1072
1073 static void prep_ssp_v3_hw(structhisi_hba*hisi_hba,
1074 structhisi_sas_slot*slot)
1075 {
1076 structsas_task*task =slot->task;
1077 structhisi_sas_cmd_hdr*hdr =slot->cmd_hdr;
1078 structdomain_device*device =task->dev;
1079 structhisi_sas_device*sas_dev=device->lldd_dev;
1080 structhisi_sas_port*port =slot->port;
1081 structsas_ssp_task*ssp_task=&task->ssp_task;
1082 structscsi_cmnd*scsi_cmnd=ssp_task->cmd;
1083 structhisi_sas_tmf_task*tmf =slot->tmf;
1084 inthas_data= 0, priority = !!tmf;
1085 u8*buf_cmd;
1086 u32 dw1 = 0, dw2 = 0, len = 0;
1087
1088hdr->dw0= cpu_to_le32((1 <<CMD_HDR_RESP_REPORT_OFF) |1089 (2 << CMD_HDR_TLR_CTRL_OFF) | 1090 (port->id << CMD_HDR_PORT_OFF) | 1091 (priority << CMD_HDR_PRIORITY_OFF) | 1092 (1 << CMD_HDR_CMD_OFF)); /* ssp */ 1093 1094 dw1 = 1 << CMD_HDR_VDTL_OFF; 1095 if (tmf) { 1096 dw1 |= 2 << CMD_HDR_FRAME_TYPE_OFF; 1097 dw1 |= DIR_NO_DATA << CMD_HDR_DIR_OFF; 1098 } else { 1099 dw1 |= 1 << CMD_HDR_FRAME_TYPE_OFF; 1100 switch (scsi_cmnd->sc_data_direction) { 1101 case DMA_TO_DEVICE: 1102 has_data = 1; 1103 dw1 |= DIR_TO_DEVICE << CMD_HDR_DIR_OFF; 1104 break; 1105 case DMA_FROM_DEVICE: 1106 has_data = 1; 1107 dw1 |= DIR_TO_INI << CMD_HDR_DIR_OFF; 1108 break; 1109 default: 1110 dw1 &= ~CMD_HDR_DIR_MSK; 1111 } 1112 } 1113 1114 /* map itct entry */ 1115 dw1 |= sas_dev->device_id << CMD_HDR_DEV_ID_OFF; 1116 hdr->dw1 = cpu_to_le32(dw1); 1117 1118 dw2 = (((sizeof(struct ssp_command_iu) + sizeof(struct ssp_frame_hdr) 1119 + 3) / 4) << CMD_HDR_CFL_OFF) | 1120 ((HISI_SAS_MAX_SSP_RESP_SZ / 4) << CMD_HDR_MRFL_OFF) | 1121 (2 << CMD_HDR_SG_MOD_OFF);1122
hdr->dw2=cpu_to_le32(dw2);
1123hdr->transfer_tags=cpu_to_le32(slot->idx);
1124
1125 if (has_data) {
1126 prep_prd_sge_v3_hw(hisi_hba, slot, hdr,task->scatter,
1127slot->n_elem);
1128
1129 if (scsi_prot_sg_count(scsi_cmnd))
1130 prep_prd_sge_dif_v3_hw(hisi_hba, slot, hdr,
1131scsi_prot_sglist(scsi_cmnd),
1132slot->n_elem_dif);
1133 }
1134
1135hdr->cmd_table_addr= cpu_to_le64(hisi_sas_cmd_hdr_addr_dma(slot));
1136hdr->sts_buffer_addr= cpu_to_le64(hisi_sas_status_buf_addr_dma(slot));
1137
1138buf_cmd=hisi_sas_cmd_hdr_addr_mem(slot)+
1139sizeof(struct ssp_frame_hdr);
1140
1141memcpy(buf_cmd, &task->ssp_task.LUN, 8);
1142 if (!tmf) {
1143 buf_cmd[9] =ssp_task->task_attr| (ssp_task->task_prio<< 3);
1144memcpy(buf_cmd + 12, scsi_cmnd->cmnd, scsi_cmnd->cmd_len);
1145 } else {
1146 buf_cmd[10] =tmf->tmf;
1147 switch (tmf->tmf) {
1148 caseTMF_ABORT_TASK:
1149 caseTMF_QUERY_TASK:
1150 buf_cmd[12] =
1151 (tmf->tag_of_task_to_be_managed>> 8) &0xff;
1152 buf_cmd[13] =
1153tmf->tag_of_task_to_be_managed&0xff;
1154 break;
1155 default:
1156 break;
1157 }
1158 }
1159
1160 if (has_data&& !scsi_prot_op_normal(scsi_cmnd)) {
1161 structhisi_sas_protect_iu_v3_hwprot;
1162 unsigned charprot_op=scsi_get_prot_op(scsi_cmnd);
1163 u8*buf_cmd_prot;
1164Quoted 1 line
1165
hdr->dw7|= 1 <<CMD_HDR_ADDR_MODE_SEL_OFF;1166
hdr->dw1|=CMD_HDR_PIR_MSK;
1167buf_cmd_prot=hisi_sas_cmd_hdr_addr_mem(slot)+
1168sizeof(struct ssp_frame_hdr)+
1169sizeof(struct ssp_command_iu);
1170
1171memset(&prot, 0, sizeof(struct hisi_sas_protect_iu_v3_hw));
1172fill_prot_v3_hw(scsi_cmnd, &prot);
1173 memcpy(buf_cmd_prot, &prot,
1174sizeof(struct hisi_sas_protect_iu_v3_hw));
1175
1176 if ((prot_op==SCSI_PROT_READ_INSERT) ||1177 (prot_op == SCSI_PROT_WRITE_INSERT) || 1178 (prot_op == SCSI_PROT_WRITE_PASS) || 1179 (prot_op == SCSI_PROT_READ_PASS)) {1180 unsigned int interval =
scsi_prot_interval(scsi_cmnd);
1181 unsigned intilog2_interval= ilog2(interval);
1182
1183 len = (task->total_xfer_len>>ilog2_interval) * 8;
1184 }
1185 }
1186
1187hdr->data_transfer_len=cpu_to_le32(task->total_xfer_len + len);
1188 }
1189---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
RE: [kbuild-all] [PATCH 4/4] scsi: hisi_sas: Add support for DIF/DIX feature for v3 hw
Subject: Re: [kbuild-all] [PATCH 4/4] scsi: hisi_sas: Add support for DIF/DIX
Quoted 15 lines
feature for v3 hw
Quoted 8 lines · kbuild test robot
Hi Xiang,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on next-20181123]
[cannot apply to v4.20-rc3]
[if your patch is applied to the wrong git tree, please drop us a note to helpimprove the system]
Quoted 2 lines
url: https://github.com/0day-ci/linux/commits/John-Garry/hisi_sas-DIF-DIX-
support/20181123-202805
Quoted 8 lines
Quoted 6 lines
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce:# save the attached .config to linux build tree make ARCH=x86_64For sparse errors - which are detected, below - we need C=2 option, right?
thanks John for the input, we will look into this to enhance the reproducing steps.
Quoted 246 lines
It would be good to include that in the instructions.
Thanks,
JohnQuoted 4 lines
All warnings (new ones prefixed by >>):
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted
__le64Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: incorrect type inargument 1 (different base types)
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: expected unsigned longlong [unsigned] [usertype] val
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: got restricted __le64[usertype]
sas_addrQuoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted
__le64Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted
__le64Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted
__le64Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted
__le64Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted
__le64Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted
__le64Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted
__le64Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:26: warning: cast from restricted
__le64Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:24: warning: incorrect type inassignment (different base types)
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:24: expected restricted __le64[usertype]
sas_addrQuoted 2 lines
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:694:24: got unsigned long longQuoted 1 line
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1165:26: warning: invalid assignment:|=
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1165:26: left side has type restricted
__le32Quoted 2 lines
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1165:26: right side has type int
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1166:26: warning: invalid assignment:|=
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1166:26: left side has type restricted
__le32Quoted 2 lines
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1166:26: right side has type int
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1759:37: warning: incorrect type ininitializer (different base types)
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1759:37: expected unsigned int[unsigned] [usertype]
dma_rx_err_typeQuoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1759:37: got restricted __le32[usertype]
dma_rx_err_typeQuoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1760:40: warning: incorrect type ininitializer (different base types)
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1760:40: expected unsigned int[unsigned] [usertype]
trans_tx_fail_typeQuoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1760:40: got restricted __le32[usertype]
trans_tx_fail_typeQuoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1767:40: warning: restricted __le32degrades to integer
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1781:40: warning: restricted __le32degrades to integer
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1840:30: warning: restricted __le32degrades to integer
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1864:26: warning: restricted __le32degrades to integer
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:1976:37: warning: restricted __le32degrades to integer
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2372:25: warning: symbol'
host_attrs_v3_hw' was not declared. Should it be static?Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2858:22: warning: incorrect type inassignment (different base types)
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2858:22: expected unsigned int[unsigned] [usertype]
device_stateQuoted 2 lines
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2858:22: got restricted pci_power_t drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2863:35: warning: incorrect type inargument 2 (different base types)
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2863:35: expected restricted
pci_power_t[usertype] stateQuoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2863:35: got unsigned int [unsigned][usertype]
device_stateQuoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2878:32: warning: incorrect type ininitializer (different base types)
Quoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2878:32: expected unsigned int[unsigned] [usertype]
device_stateQuoted 1 line
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2878:32: got restricted pci_power_t[usertype]
current_stateQuoted 12 lines
vim +1165
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c1072 1073 static void prep_ssp_v3_hw(struct hisi_hba *hisi_hba, 1074 struct hisi_sas_slot *slot) 1075 { 1076 struct sas_task *task = slot->task; 1077 struct hisi_sas_cmd_hdr *hdr = slot->cmd_hdr; 1078 struct domain_device *device = task->dev; 1079 struct hisi_sas_device *sas_dev = device->lldd_dev; 1080 struct hisi_sas_port *port = slot->port;Quoted 8 lines
1081 struct sas_ssp_task *ssp_task = &task->ssp_task; 1082 struct scsi_cmnd *scsi_cmnd = ssp_task->cmd; 1083 struct hisi_sas_tmf_task *tmf = slot->tmf; 1084 int has_data = 0, priority = !!tmf; 1085 u8 *buf_cmd; 1086 u32 dw1 = 0, dw2 = 0, len = 0; 1087 1088 hdr->dw0 = cpu_to_le32((1 <<
CMD_HDR_RESP_REPORT_OFF) |Quoted 2 lines
1089 (2 <<
CMD_HDR_TLR_CTRL_OFF) |
1090 (port->id<<CMD_HDR_PORT_OFF)|
Quoted 1 line
1091 (priority <<
CMD_HDR_PRIORITY_OFF) |Quoted 1 line
1092 (1 <<
CMD_HDR_CMD_OFF)); /*ssp */
Quoted 11 lines
1093 1094 dw1 = 1 << CMD_HDR_VDTL_OFF; 1095 if (tmf) { 1096 dw1 |= 2 << CMD_HDR_FRAME_TYPE_OFF; 1097 dw1 |= DIR_NO_DATA << CMD_HDR_DIR_OFF; 1098 } else { 1099 dw1 |= 1 << CMD_HDR_FRAME_TYPE_OFF; 1100 switch (scsi_cmnd->sc_data_direction) { 1101 case DMA_TO_DEVICE: 1102 has_data = 1; 1103 dw1 |= DIR_TO_DEVICE <<
CMD_HDR_DIR_OFF;Quoted 4 lines
1104 break; 1105 case DMA_FROM_DEVICE: 1106 has_data = 1; 1107 dw1 |= DIR_TO_INI <<
CMD_HDR_DIR_OFF;Quoted 11 lines
1108 break; 1109 default: 1110 dw1 &= ~CMD_HDR_DIR_MSK; 1111 } 1112 } 1113 1114 /* map itct entry */ 1115 dw1 |= sas_dev->device_id << CMD_HDR_DEV_ID_OFF; 1116 hdr->dw1 = cpu_to_le32(dw1); 1117 1118 dw2 = (((sizeof(struct ssp_command_iu) + sizeof(struct
ssp_frame_hdr)Quoted 2 lines
1119 + 3) / 4) <<
CMD_HDR_CFL_OFF) |
1120 ((HISI_SAS_MAX_SSP_RESP_SZ/ 4) <<
CMD_HDR_MRFL_OFF) |Quoted 11 lines
1121 (2 <<
CMD_HDR_SG_MOD_OFF);
1122hdr->dw2=cpu_to_le32(dw2);
1123hdr->transfer_tags=cpu_to_le32(slot->idx);
1124
1125 if (has_data) {
1126 prep_prd_sge_v3_hw(hisi_hba, slot, hdr, task-
scatter,
1127slot->n_elem);
1128
1129 if (scsi_prot_sg_count(scsi_cmnd))
1130 prep_prd_sge_dif_v3_hw(hisi_hba, slot,hdr,
Quoted 1 line
1131
scsi_prot_sglist(scsi_cmnd),Quoted 4 lines
1132
slot->n_elem_dif);
1133 }
1134
1135hdr->cmd_table_addr=cpu_to_le64(hisi_sas_cmd_hdr_addr_dma(slot));
Quoted 1 line
1136
hdr->sts_buffer_addr=cpu_to_le64(hisi_sas_status_buf_addr_dma(slot));
Quoted 9 lines
1137
1138buf_cmd=hisi_sas_cmd_hdr_addr_mem(slot)+
1139sizeof(struct ssp_frame_hdr);
1140
1141memcpy(buf_cmd, &task->ssp_task.LUN, 8);
1142 if (!tmf) {
1143 buf_cmd[9] =ssp_task->task_attr| (ssp_task-task_prio<< 3);
1144 memcpy(buf_cmd + 12,scsi_cmnd->cmnd,
scsi_cmnd->cmd_len);Quoted 10 lines
1145 } else {
1146 buf_cmd[10] =tmf->tmf;
1147 switch (tmf->tmf) {
1148 caseTMF_ABORT_TASK:
1149 caseTMF_QUERY_TASK:
1150 buf_cmd[12] =
1151 (tmf-tag_of_task_to_be_managed>> 8) &0xff;
1152 buf_cmd[13] =
1153tmf->tag_of_task_to_be_managed&
0xff;Quoted 9 lines
1154 break; 1155 default: 1156 break; 1157 } 1158 } 1159 1160 if (has_data && !scsi_prot_op_normal(scsi_cmnd)) { 1161 struct hisi_sas_protect_iu_v3_hw prot; 1162 unsigned char prot_op =
scsi_get_prot_op(scsi_cmnd);Quoted 3 lines
1163 u8
*buf_cmd_prot;
1164Quoted 1 line
1165
hdr->dw7|= 1 <<
CMD_HDR_ADDR_MODE_SEL_OFF;Quoted 2 lines
1166 hdr->dw1 |= CMD_HDR_PIR_MSK; 1167 buf_cmd_prot =
hisi_sas_cmd_hdr_addr_mem(slot)+Quoted 4 lines
1168 sizeof(struct ssp_frame_hdr) + 1169 sizeof(struct ssp_command_iu); 1170 1171 memset(&prot, 0, sizeof(struct
hisi_sas_protect_iu_v3_hw));Quoted 9 lines
1172 fill_prot_v3_hw(scsi_cmnd, &prot); 1173 memcpy(buf_cmd_prot, &prot, 1174 sizeof(struct hisi_sas_protect_iu_v3_hw)); 1175 1176 if ((prot_op == SCSI_PROT_READ_INSERT) || 1177 (prot_op == SCSI_PROT_WRITE_INSERT) || 1178 (prot_op == SCSI_PROT_WRITE_PASS) || 1179 (prot_op == SCSI_PROT_READ_PASS)) { 1180 unsigned int interval =
scsi_prot_interval(scsi_cmnd);Quoted 1 line
1181 unsigned int
ilog2_interval=ilog2(interval);
Quoted 2 lines
1182
1183 len = (task->total_xfer_len>>
ilog2_interval) * 8;Quoted 4 lines
1184 }
1185 }
1186
1187hdr->data_transfer_len= cpu_to_le32(task->total_xfer_len+ len);
Quoted 7 lines
1188 }
1189---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation_______________________________________________
kbuild-all mailing list
[email protected]
https://lists.01.org/mailman/listinfo/kbuild-all