On 11/6/2022 4:50 PM, Damien Le Moal wrote: > Move the detection of a device FUA support from > ata_scsiop_mode_sense()/ata_dev_supports_fua() to device scan time in > ata_dev_configure(). > > The function ata_dev_config_fua() is introduced to detect if a device > supports FUA and this support is indicated using the new device flag > ATA_DFLAG_FUA. > > In order to blacklist known buggy devices, the horkage flag > ATA_HORKAGE_NO_FUA is introduced. Similarly to other horkage flags, the > libata.force= arguments "fua" and "nofua" are also introduced to allow > a user to control this horkage flag through the "force" libata > module parameter. > > The ATA_DFLAG_FUA device flag is set only and only if all the following > conditions are met: > * libata.fua module parameter is set to 1 > * The device supports the WRITE DMA FUA EXT command, > * The device is not marked with the ATA_HORKAGE_NO_FUA flag, either from > the blacklist or set by the user with libata.force=nofua > * The device supports NCQ (while this is not mandated by the standards, > this restriction is introduced to avoid problems with older non-NCQ > devices). > > Enabling or diabling libata FUA support for all devices can now also be > done using the "force=[no]fua" module parameter when libata.fua is set > to 1. > > Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx> > Reviewed-by: Hannes Reinecke <hare@xxxxxxx> > --- Reviewed-by: Chaitanya Kulkarni <kch@xxxxxxxxxx> -ck