Message ID | 20220217132956.484818-16-damien.lemoal@opensource.wdc.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | libsas and pm8001 fixes | expand |
On Thu, Feb 17, 2022 at 2:30 PM Damien Le Moal <damien.lemoal@opensource.wdc.com> wrote: > > NCQ NON DATA is an NCQ command with the DMA_NONE DMA direction and so a > register-device-to-host-FIS response is expected for it. > > However, for an IO_SUCCESS case, mpi_sata_completion() expects a > set-device-bits-FIS for any ata task with an use_ncq field true, which > includes NCQ NON DATA commands. > > Fix this to correctly treat NCQ NON DATA commands as non-data by also > testing for the DMA_NONE DMA direction. > > Fixes: dbf9bfe61571 ("[SCSI] pm8001: add SAS/SATA HBA driver") > Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Reviewed-by: Jack Wang <jinpu.wang@ionos.com> thx! > --- > drivers/scsi/pm8001/pm8001_hwi.c | 3 ++- > drivers/scsi/pm8001/pm80xx_hwi.c | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c > index c0215a35a7b5..8149cc0d1ecd 100644 > --- a/drivers/scsi/pm8001/pm8001_hwi.c > +++ b/drivers/scsi/pm8001/pm8001_hwi.c > @@ -2415,7 +2415,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) > len = sizeof(struct pio_setup_fis); > pm8001_dbg(pm8001_ha, IO, > "PIO read len = %d\n", len); > - } else if (t->ata_task.use_ncq) { > + } else if (t->ata_task.use_ncq && > + t->data_dir != DMA_NONE) { > len = sizeof(struct set_dev_bits_fis); > pm8001_dbg(pm8001_ha, IO, "FPDMA len = %d\n", > len); > diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c > index 3deb89b11d2f..ac2178a13e4c 100644 > --- a/drivers/scsi/pm8001/pm80xx_hwi.c > +++ b/drivers/scsi/pm8001/pm80xx_hwi.c > @@ -2507,7 +2507,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, > len = sizeof(struct pio_setup_fis); > pm8001_dbg(pm8001_ha, IO, > "PIO read len = %d\n", len); > - } else if (t->ata_task.use_ncq) { > + } else if (t->ata_task.use_ncq && > + t->data_dir != DMA_NONE) { > len = sizeof(struct set_dev_bits_fis); > pm8001_dbg(pm8001_ha, IO, "FPDMA len = %d\n", > len); > -- > 2.34.1 >
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index c0215a35a7b5..8149cc0d1ecd 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -2415,7 +2415,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) len = sizeof(struct pio_setup_fis); pm8001_dbg(pm8001_ha, IO, "PIO read len = %d\n", len); - } else if (t->ata_task.use_ncq) { + } else if (t->ata_task.use_ncq && + t->data_dir != DMA_NONE) { len = sizeof(struct set_dev_bits_fis); pm8001_dbg(pm8001_ha, IO, "FPDMA len = %d\n", len); diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 3deb89b11d2f..ac2178a13e4c 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -2507,7 +2507,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, len = sizeof(struct pio_setup_fis); pm8001_dbg(pm8001_ha, IO, "PIO read len = %d\n", len); - } else if (t->ata_task.use_ncq) { + } else if (t->ata_task.use_ncq && + t->data_dir != DMA_NONE) { len = sizeof(struct set_dev_bits_fis); pm8001_dbg(pm8001_ha, IO, "FPDMA len = %d\n", len);
NCQ NON DATA is an NCQ command with the DMA_NONE DMA direction and so a register-device-to-host-FIS response is expected for it. However, for an IO_SUCCESS case, mpi_sata_completion() expects a set-device-bits-FIS for any ata task with an use_ncq field true, which includes NCQ NON DATA commands. Fix this to correctly treat NCQ NON DATA commands as non-data by also testing for the DMA_NONE DMA direction. Fixes: dbf9bfe61571 ("[SCSI] pm8001: add SAS/SATA HBA driver") Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> --- drivers/scsi/pm8001/pm8001_hwi.c | 3 ++- drivers/scsi/pm8001/pm80xx_hwi.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)