Skip to content

Commit ef5d681

Browse files
Merge patch series "Returning FIS on success for CDL"
Igor Pylypiv <[email protected]> says: This patch series plumbs libata's request for a result taskfile (ATA_QCFLAG_RESULT_TF) through libsas to pm80xx LLDD. Other libsas LLDDs can start using the newly added return_fis_on_success as well, if needed. For Command Duration Limits policy 0xD (command completes without an error) libata needs FIS in order to detect the ATA_SENSE bit and read the Sense Data for Successful NCQ Commands log (0Fh). pm80xx HBAs do not return FIS on success by default, hence, the driver is updated to set the RETFIS bit (Return FIS on good completion) when requested by libsas. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2 parents 84c073f + 5454329 commit ef5d681

File tree

6 files changed

+23
-18
lines changed

6 files changed

+23
-18
lines changed

drivers/scsi/libsas/sas_ata.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
207207
task->ata_task.use_ncq = ata_is_ncq(qc->tf.protocol);
208208
task->ata_task.dma_xfer = ata_is_dma(qc->tf.protocol);
209209

210+
if (qc->flags & ATA_QCFLAG_RESULT_TF)
211+
task->ata_task.return_fis_on_success = 1;
212+
210213
if (qc->scsicmd)
211214
ASSIGN_SAS_TASK(qc->scsicmd, task);
212215

drivers/scsi/pm8001/pm8001_hwi.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4095,7 +4095,7 @@ static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
40954095
u32 hdr_tag, ncg_tag = 0;
40964096
u64 phys_addr;
40974097
u32 ATAP = 0x0;
4098-
u32 dir;
4098+
u32 dir, retfis = 0;
40994099
u32 opc = OPC_INB_SATA_HOST_OPSTART;
41004100

41014101
memset(&sata_cmd, 0, sizeof(sata_cmd));
@@ -4124,8 +4124,11 @@ static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
41244124
sata_cmd.tag = cpu_to_le32(tag);
41254125
sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id);
41264126
sata_cmd.data_len = cpu_to_le32(task->total_xfer_len);
4127-
sata_cmd.ncqtag_atap_dir_m =
4128-
cpu_to_le32(((ncg_tag & 0xff)<<16)|((ATAP & 0x3f) << 10) | dir);
4127+
if (task->ata_task.return_fis_on_success)
4128+
retfis = 1;
4129+
sata_cmd.retfis_ncqtag_atap_dir_m =
4130+
cpu_to_le32((retfis << 24) | ((ncg_tag & 0xff) << 16) |
4131+
((ATAP & 0x3f) << 10) | dir);
41294132
sata_cmd.sata_fis = task->ata_task.fis;
41304133
if (likely(!task->ata_task.device_control_reg_update))
41314134
sata_cmd.sata_fis.flags |= 0x80;/* C=1: update ATA cmd reg */

drivers/scsi/pm8001/pm8001_hwi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ struct sata_start_req {
515515
__le32 tag;
516516
__le32 device_id;
517517
__le32 data_len;
518-
__le32 ncqtag_atap_dir_m;
518+
__le32 retfis_ncqtag_atap_dir_m;
519519
struct host_to_dev_fis sata_fis;
520520
u32 reserved1;
521521
u32 reserved2;

drivers/scsi/pm8001/pm80xx_hwi.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4457,7 +4457,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
44574457
u64 phys_addr, end_addr;
44584458
u32 end_addr_high, end_addr_low;
44594459
u32 ATAP = 0x0;
4460-
u32 dir;
4460+
u32 dir, retfis = 0;
44614461
u32 opc = OPC_INB_SATA_HOST_OPSTART;
44624462
memset(&sata_cmd, 0, sizeof(sata_cmd));
44634463

@@ -4487,7 +4487,8 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
44874487
sata_cmd.tag = cpu_to_le32(tag);
44884488
sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id);
44894489
sata_cmd.data_len = cpu_to_le32(task->total_xfer_len);
4490-
4490+
if (task->ata_task.return_fis_on_success)
4491+
retfis = 1;
44914492
sata_cmd.sata_fis = task->ata_task.fis;
44924493
if (likely(!task->ata_task.device_control_reg_update))
44934494
sata_cmd.sata_fis.flags |= 0x80;/* C=1: update ATA cmd reg */
@@ -4500,12 +4501,10 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
45004501
"Encryption enabled.Sending Encrypt SATA cmd 0x%x\n",
45014502
sata_cmd.sata_fis.command);
45024503
opc = OPC_INB_SATA_DIF_ENC_IO;
4503-
4504-
/* set encryption bit */
4505-
sata_cmd.ncqtag_atap_dir_m_dad =
4506-
cpu_to_le32(((ncg_tag & 0xff)<<16)|
4507-
((ATAP & 0x3f) << 10) | 0x20 | dir);
4508-
/* dad (bit 0-1) is 0 */
4504+
/* set encryption bit; dad (bits 0-1) is 0 */
4505+
sata_cmd.retfis_ncqtag_atap_dir_m_dad =
4506+
cpu_to_le32((retfis << 24) | ((ncg_tag & 0xff) << 16) |
4507+
((ATAP & 0x3f) << 10) | 0x20 | dir);
45094508
/* fill in PRD (scatter/gather) table, if any */
45104509
if (task->num_scatter > 1) {
45114510
pm8001_chip_make_sg(task->scatter,
@@ -4568,11 +4567,10 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
45684567
pm8001_dbg(pm8001_ha, IO,
45694568
"Sending Normal SATA command 0x%x inb %x\n",
45704569
sata_cmd.sata_fis.command, q_index);
4571-
/* dad (bit 0-1) is 0 */
4572-
sata_cmd.ncqtag_atap_dir_m_dad =
4573-
cpu_to_le32(((ncg_tag & 0xff)<<16) |
4574-
((ATAP & 0x3f) << 10) | dir);
4575-
4570+
/* dad (bits 0-1) is 0 */
4571+
sata_cmd.retfis_ncqtag_atap_dir_m_dad =
4572+
cpu_to_le32((retfis << 24) | ((ncg_tag & 0xff) << 16) |
4573+
((ATAP & 0x3f) << 10) | dir);
45764574
/* fill in PRD (scatter/gather) table, if any */
45774575
if (task->num_scatter > 1) {
45784576
pm8001_chip_make_sg(task->scatter,

drivers/scsi/pm8001/pm80xx_hwi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ struct sata_start_req {
731731
__le32 tag;
732732
__le32 device_id;
733733
__le32 data_len;
734-
__le32 ncqtag_atap_dir_m_dad;
734+
__le32 retfis_ncqtag_atap_dir_m_dad;
735735
struct host_to_dev_fis sata_fis;
736736
u32 reserved1;
737737
u32 reserved2; /* dword 11. rsvd for normal I/O. */

include/scsi/libsas.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ struct sas_ata_task {
550550
u8 use_ncq:1;
551551
u8 set_affil_pol:1;
552552
u8 stp_affil_pol:1;
553+
u8 return_fis_on_success:1;
553554

554555
u8 device_control_reg_update:1;
555556

0 commit comments

Comments
 (0)