Hi,
I encounter a issue related to libata and libsas. For hisi_sas driver,
it uses libsas. When disable WCE with tool sdparm (sdparm --clear=WCE
/dev/sda) for a SATA disk,
it fails with error info from hardware (the error info indicates that
the length of transfer data is conflicted with the direction of data,
the length is 0 but
the data of direction is from host to device).
I check the process: When disable WCE, it sends pasthrough IO with sg_io
, req->__data_len is not 0, and scsi_cmd->sc_data_direction = DMA_TO_DEVICE.
But for the command (MODE_SELECT), qc->tf.protocol is set 0 (not
ATA_PROT_DMA) in ->queuecommand()
->ata_sas_queuecmd()->ata_scsi_translate()->ata_scsi_mod_select_xlat()->ata_mselect_caching(),
so it doesn't dma map ata sg in function ata_qc_issue(). While in
function sas_ata_qc_issue(),it calcutes the length with the total sum of
sg_dma_len(sg), as for the
command it doesn't dma map ata sg, so the length is 0.
Do we need to dma map ata sg for the command? Or is it really we need
the data for the command MODE_SELECT?
Thanks,
Shawn