On Fri, Dec 13, 2019 at 09:03:34AM +0100, Sascha Hauer wrote: > ata_qc_complete_multiple() is called with a mask of the still active > tags. > > mv_sata doesn't have this information directly and instead calculates > the still active tags from the started tags (ap->qc_active) and the > finished tags as (ap->qc_active ^ done_mask) > > Since 28361c40368 the hw_tag and tag are no longer the same and the > equation is no longer valid. In ata_exec_internal_sg() ap->qc_active is > initialized as 1ULL << ATA_TAG_INTERNAL, but in hardware tag 0 is > started and this will be in done_mask on completion. ap->qc_active ^ > done_mask becomes 0x100000000 ^ 0x1 = 0x100000001 and thus tag 0 used as > the internal tag will never be reported as completed. > > This is fixed by introducing ata_qc_get_active() which returns the > active hardware tags and calling it where appropriate. > > This is tested on mv_sata, but sata_fsl and sata_nv suffer from the same > problem. There is another case in sata_nv that most likely needs fixing > as well, but this looks a little different, so I wasn't confident enough > to change that. > > Fixes: 28361c403683 ("libata: add extra internal command") > Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> > --- Ignore this, it lacks the v2 tag :-/ Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |