linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/4] Some cleanup, renaming and horkage improvements
@ 2024-07-26  3:19 Damien Le Moal
  2024-07-26  3:19 ` [PATCH v6 01/11] ata: libata: Change ata_dev_knobble() to return a bool Damien Le Moal
                   ` (10 more replies)
  0 siblings, 11 replies; 39+ messages in thread
From: Damien Le Moal @ 2024-07-26  3:19 UTC (permalink / raw)
  To: linux-ide, Niklas Cassel

Patch 1 cleanups the function ata_dev_knobble() and patch 2 renames the
function ata_dma_blacklisted(). Patch 3 does a larger cleanup, changing
the use of the term horkage to the more common quirk term. All 3 patches
do not introduce any functional change.

Patch 4 adds printing on device scan of the quirk flags that will be
applied to the device,. This is to help with debugging any issue with
devices.

Finally, patches 5 to 11 do some additional renaming and comment
cleanups in various drivers to remove the use of the term blacklist,
replacing it with more descriptive comments and names. Of note is that
many of the "broken" device handling in these driver should probably be
moved to libata quirk handling so that any controller seeing one of the
broken device listed can get similar quirks. But it is unclear if the
quirks handled are controller specific or not.

Changes from v5:
 - Moved patch 3 as patch 1
 - Changed patch 2 to do the horkage renaming, including renaming of
   ata_dev_blacklisted(). That is now patch 3.
 - Changed patch 4 to be compatible with the changes introduced in
   patch 3.
 - Added patch 5 to 11

Changes from v4:
 - Removed the useless !! in patch 1
 - Added Igor's review tags to patch 1 and 2
 - Added patch 3
 - In patch 4, corrected comment about __ATA_HORKAGE_MAX, added missing
   newline for the horkage warning message and corrected the commit
   message.

Changes from v3:
 - Corrected the BUILD_BUG_ON() call in patch 3
 - Corrected alignment of horkage definition comments in patch 3

Changes from v2:
 - Simplified ata_dev_print_horkage() to always print the device
   revision (patch 3)
 - Simplified ata_dev_horkage() to having 2 different calls to
   ata_dev_print_horkage() and to always print the device revision
   (patch 3)
 - Added a BUILD_BUG_ON() check in patch 3 to ensure that the horkage
   flags all fit within an unsigned int.

Changes from v1:
 - Remove unused macro definition in patch 3
 - Use unsigned int for horkage flags (patch 3)

Damien Le Moal (11):
  ata: libata: Change ata_dev_knobble() to return a bool
  ata: libata: Rename ata_dma_blacklisted()
  ata: libata: Use QUIRK instead of HORKAGE
  ata: libata: Print quirks applied to devices
  ata: pata_serverworks: Do not use the term blacklist
  ata: ahci: Rephrase comment to not use the term blacklist
  ata: sata_sil: Rename sil_blacklist to sil_quirks
  ata: ata_piix: Remove useless comment in piix_init_sidpr()
  ata: pata_cs5520: Rephrase file header comment
  ata: pata_hpt366: Rename hpt_dma_blacklisted()
  ata: pata_hpt37x: Rename hpt_dma_blacklisted()

 drivers/ata/ahci.c             |   2 +-
 drivers/ata/ata_piix.c         |   1 -
 drivers/ata/libata-core.c      | 581 ++++++++++++++++++---------------
 drivers/ata/libata-sata.c      |   2 +-
 drivers/ata/libata-scsi.c      |   9 +-
 drivers/ata/libata-sff.c       |  10 +-
 drivers/ata/libata-transport.c |   6 +-
 drivers/ata/pata_cs5520.c      |   6 +-
 drivers/ata/pata_hpt366.c      |  10 +-
 drivers/ata/pata_hpt37x.c      |  10 +-
 drivers/ata/pata_it821x.c      |   4 +-
 drivers/ata/pata_serverworks.c |  16 +-
 drivers/ata/sata_sil.c         |  14 +-
 include/linux/libata.h         | 115 ++++---
 14 files changed, 446 insertions(+), 340 deletions(-)

-- 
2.45.2


^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH v6 01/11] ata: libata: Change ata_dev_knobble() to return a bool
  2024-07-26  3:19 [PATCH v6 0/4] Some cleanup, renaming and horkage improvements Damien Le Moal
@ 2024-07-26  3:19 ` Damien Le Moal
  2024-07-26  3:19 ` [PATCH v6 02/11] ata: libata: Rename ata_dma_blacklisted() Damien Le Moal
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 39+ messages in thread
From: Damien Le Moal @ 2024-07-26  3:19 UTC (permalink / raw)
  To: linux-ide, Niklas Cassel

Change the function ata_dev_knobble() to return a boolean instead of a
u8.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
---
 drivers/ata/libata-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index c7752dc80028..c49334e13c0b 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2219,12 +2219,12 @@ static int ata_do_link_spd_horkage(struct ata_device *dev)
 	return 0;
 }
 
-static inline u8 ata_dev_knobble(struct ata_device *dev)
+static inline bool ata_dev_knobble(struct ata_device *dev)
 {
 	struct ata_port *ap = dev->link->ap;
 
 	if (ata_dev_blacklisted(dev) & ATA_HORKAGE_BRIDGE_OK)
-		return 0;
+		return false;
 
 	return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id)));
 }
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v6 02/11] ata: libata: Rename ata_dma_blacklisted()
  2024-07-26  3:19 [PATCH v6 0/4] Some cleanup, renaming and horkage improvements Damien Le Moal
  2024-07-26  3:19 ` [PATCH v6 01/11] ata: libata: Change ata_dev_knobble() to return a bool Damien Le Moal
@ 2024-07-26  3:19 ` Damien Le Moal
  2024-07-26  3:19 ` [PATCH v6 03/11] ata: libata: Use QUIRK instead of HORKAGE Damien Le Moal
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 39+ messages in thread
From: Damien Le Moal @ 2024-07-26  3:19 UTC (permalink / raw)
  To: linux-ide, Niklas Cassel

Rename the function ata_dma_blacklisted() to ata_dev_nodma() as this new
name is more neutral. The function signature is also changed to return a
boolean instead of an int.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
---
 drivers/ata/libata-core.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index c49334e13c0b..f1e5055e33fe 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4287,16 +4287,17 @@ static unsigned long ata_dev_blacklisted(const struct ata_device *dev)
 	return 0;
 }
 
-static int ata_dma_blacklisted(const struct ata_device *dev)
+static bool ata_dev_nodma(const struct ata_device *dev)
 {
-	/* We don't support polling DMA.
-	 * DMA blacklist those ATAPI devices with CDB-intr (and use PIO)
-	 * if the LLDD handles only interrupts in the HSM_ST_LAST state.
+	/*
+	 * We do not support polling DMA. Deny DMA for those ATAPI devices
+	 * with CDB-intr (and use PIO) if the LLDD handles only interrupts in
+	 * the HSM_ST_LAST state.
 	 */
 	if ((dev->link->ap->flags & ATA_FLAG_PIO_POLLING) &&
 	    (dev->flags & ATA_DFLAG_CDB_INTR))
-		return 1;
-	return (dev->horkage & ATA_HORKAGE_NODMA) ? 1 : 0;
+		return true;
+	return dev->horkage & ATA_HORKAGE_NODMA;
 }
 
 /**
@@ -4404,10 +4405,10 @@ static void ata_dev_xfermask(struct ata_device *dev)
 		xfer_mask &= ~(0x03 << (ATA_SHIFT_MWDMA + 3));
 	}
 
-	if (ata_dma_blacklisted(dev)) {
+	if (ata_dev_nodma(dev)) {
 		xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
 		ata_dev_warn(dev,
-			     "device is on DMA blacklist, disabling DMA\n");
+			     "device does not support DMA, disabling DMA\n");
 	}
 
 	if ((host->flags & ATA_HOST_SIMPLEX) &&
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v6 03/11] ata: libata: Use QUIRK instead of HORKAGE
  2024-07-26  3:19 [PATCH v6 0/4] Some cleanup, renaming and horkage improvements Damien Le Moal
  2024-07-26  3:19 ` [PATCH v6 01/11] ata: libata: Change ata_dev_knobble() to return a bool Damien Le Moal
  2024-07-26  3:19 ` [PATCH v6 02/11] ata: libata: Rename ata_dma_blacklisted() Damien Le Moal
@ 2024-07-26  3:19 ` Damien Le Moal
  2024-07-26 10:27   ` Niklas Cassel
  2024-07-29 18:41   ` Igor Pylypiv
  2024-07-26  3:19 ` [PATCH v6 04/11] ata: libata: Print quirks applied to devices Damien Le Moal
                   ` (7 subsequent siblings)
  10 siblings, 2 replies; 39+ messages in thread
From: Damien Le Moal @ 2024-07-26  3:19 UTC (permalink / raw)
  To: linux-ide, Niklas Cassel

According to Wiktionary, the verb "hork" is computing slang defined as
"To foul up; to be occupied with difficulty, tangle, or unpleasantness;
to be broken" (https://en.wiktionary.org/wiki/hork#Verb). libata uses
this with the term "horkage" to refer to broken device features. Given
that this term is not widely used and its meaning unknown to many,
rename it to the more commonly used term "quirk", similar to many other
places in the kernel.

The renaming done is:
1) Rename all ATA_HORKAGE_XXX flags to ATA_QUIRK_XXX
2) Rename struct ata_device horkage field to quirks
3) Rename struct ata_blacklist_entry to struct ata_dev_quirks_entry. The
   array of these structures defining quirks for known devices is
   renamed __ata_dev_quirks.
4) The functions ata_dev_blacklisted() and ata_force_horkage() are
   renamed to ata_dev_quirks() and ata_force_quirks() respectively.
5) All the force_horkage_xxx() macros are renamed to force_quirk_xxx()

And while at it, make sure that the type "unsigned int" is used
consistantly for quirk flags variables and data structure fields.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 drivers/ata/libata-core.c      | 490 ++++++++++++++++-----------------
 drivers/ata/libata-sata.c      |   2 +-
 drivers/ata/libata-scsi.c      |   9 +-
 drivers/ata/libata-sff.c       |  10 +-
 drivers/ata/libata-transport.c |   6 +-
 drivers/ata/pata_it821x.c      |   4 +-
 drivers/ata/sata_sil.c         |   2 +-
 include/linux/libata.h         |  71 ++---
 8 files changed, 297 insertions(+), 297 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index f1e5055e33fe..19b041bd7588 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -84,7 +84,7 @@ static unsigned int ata_dev_init_params(struct ata_device *dev,
 					u16 heads, u16 sectors);
 static unsigned int ata_dev_set_xfermode(struct ata_device *dev);
 static void ata_dev_xfermask(struct ata_device *dev);
-static unsigned long ata_dev_blacklisted(const struct ata_device *dev);
+static unsigned int ata_dev_quirks(const struct ata_device *dev);
 
 static DEFINE_IDA(ata_ida);
 
@@ -94,8 +94,8 @@ struct ata_force_param {
 	u8		cbl;
 	u8		spd_limit;
 	unsigned int	xfer_mask;
-	unsigned int	horkage_on;
-	unsigned int	horkage_off;
+	unsigned int	quirk_on;
+	unsigned int	quirk_off;
 	u16		lflags_on;
 	u16		lflags_off;
 };
@@ -457,17 +457,17 @@ static void ata_force_xfermask(struct ata_device *dev)
 }
 
 /**
- *	ata_force_horkage - force horkage according to libata.force
+ *	ata_force_quirks - force quirks according to libata.force
  *	@dev: ATA device of interest
  *
- *	Force horkage according to libata.force and whine about it.
+ *	Force quirks according to libata.force and whine about it.
  *	For consistency with link selection, device number 15 selects
  *	the first device connected to the host link.
  *
  *	LOCKING:
  *	EH context.
  */
-static void ata_force_horkage(struct ata_device *dev)
+static void ata_force_quirks(struct ata_device *dev)
 {
 	int devno = dev->link->pmp + dev->devno;
 	int alt_devno = devno;
@@ -487,21 +487,21 @@ static void ata_force_horkage(struct ata_device *dev)
 		    fe->device != alt_devno)
 			continue;
 
-		if (!(~dev->horkage & fe->param.horkage_on) &&
-		    !(dev->horkage & fe->param.horkage_off))
+		if (!(~dev->quirks & fe->param.quirk_on) &&
+		    !(dev->quirks & fe->param.quirk_off))
 			continue;
 
-		dev->horkage |= fe->param.horkage_on;
-		dev->horkage &= ~fe->param.horkage_off;
+		dev->quirks |= fe->param.quirk_on;
+		dev->quirks &= ~fe->param.quirk_off;
 
-		ata_dev_notice(dev, "FORCE: horkage modified (%s)\n",
+		ata_dev_notice(dev, "FORCE: modified (%s)\n",
 			       fe->param.name);
 	}
 }
 #else
 static inline void ata_force_link_limits(struct ata_link *link) { }
 static inline void ata_force_xfermask(struct ata_device *dev) { }
-static inline void ata_force_horkage(struct ata_device *dev) { }
+static inline void ata_force_quirks(struct ata_device *dev) { }
 #endif
 
 /**
@@ -1221,7 +1221,7 @@ static int ata_read_native_max_address(struct ata_device *dev, u64 *max_sectors)
 		*max_sectors = ata_tf_to_lba48(&tf) + 1;
 	else
 		*max_sectors = ata_tf_to_lba(&tf) + 1;
-	if (dev->horkage & ATA_HORKAGE_HPA_SIZE)
+	if (dev->quirks & ATA_QUIRK_HPA_SIZE)
 		(*max_sectors)--;
 	return 0;
 }
@@ -1306,7 +1306,7 @@ static int ata_hpa_resize(struct ata_device *dev)
 	/* do we need to do it? */
 	if ((dev->class != ATA_DEV_ATA && dev->class != ATA_DEV_ZAC) ||
 	    !ata_id_has_lba(dev->id) || !ata_id_hpa_enabled(dev->id) ||
-	    (dev->horkage & ATA_HORKAGE_BROKEN_HPA))
+	    (dev->quirks & ATA_QUIRK_BROKEN_HPA))
 		return 0;
 
 	/* read native max address */
@@ -1318,7 +1318,7 @@ static int ata_hpa_resize(struct ata_device *dev)
 		if (rc == -EACCES || !unlock_hpa) {
 			ata_dev_warn(dev,
 				     "HPA support seems broken, skipping HPA handling\n");
-			dev->horkage |= ATA_HORKAGE_BROKEN_HPA;
+			dev->quirks |= ATA_QUIRK_BROKEN_HPA;
 
 			/* we can continue if device aborted the command */
 			if (rc == -EACCES)
@@ -1355,7 +1355,7 @@ static int ata_hpa_resize(struct ata_device *dev)
 			     "device aborted resize (%llu -> %llu), skipping HPA handling\n",
 			     (unsigned long long)sectors,
 			     (unsigned long long)native_sectors);
-		dev->horkage |= ATA_HORKAGE_BROKEN_HPA;
+		dev->quirks |= ATA_QUIRK_BROKEN_HPA;
 		return 0;
 	} else if (rc)
 		return rc;
@@ -1835,7 +1835,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
 		goto err_out;
 	}
 
-	if (dev->horkage & ATA_HORKAGE_DUMP_ID) {
+	if (dev->quirks & ATA_QUIRK_DUMP_ID) {
 		ata_dev_info(dev, "dumping IDENTIFY data, "
 			    "class=%d may_fallback=%d tried_spinup=%d\n",
 			    class, may_fallback, tried_spinup);
@@ -2104,7 +2104,7 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log,
 retry:
 	ata_tf_init(dev, &tf);
 	if (ata_dma_enabled(dev) && ata_id_has_read_log_dma_ext(dev->id) &&
-	    !(dev->horkage & ATA_HORKAGE_NO_DMA_LOG)) {
+	    !(dev->quirks & ATA_QUIRK_NO_DMA_LOG)) {
 		tf.command = ATA_CMD_READ_LOG_DMA_EXT;
 		tf.protocol = ATA_PROT_DMA;
 		dma = true;
@@ -2124,7 +2124,7 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log,
 
 	if (err_mask) {
 		if (dma) {
-			dev->horkage |= ATA_HORKAGE_NO_DMA_LOG;
+			dev->quirks |= ATA_QUIRK_NO_DMA_LOG;
 			if (!ata_port_is_frozen(dev->link->ap))
 				goto retry;
 		}
@@ -2140,7 +2140,7 @@ static int ata_log_supported(struct ata_device *dev, u8 log)
 {
 	struct ata_port *ap = dev->link->ap;
 
-	if (dev->horkage & ATA_HORKAGE_NO_LOG_DIR)
+	if (dev->quirks & ATA_QUIRK_NO_LOG_DIR)
 		return 0;
 
 	if (ata_read_log_page(dev, ATA_LOG_DIRECTORY, 0, ap->sector_buf, 1))
@@ -2153,7 +2153,7 @@ static bool ata_identify_page_supported(struct ata_device *dev, u8 page)
 	struct ata_port *ap = dev->link->ap;
 	unsigned int err, i;
 
-	if (dev->horkage & ATA_HORKAGE_NO_ID_DEV_LOG)
+	if (dev->quirks & ATA_QUIRK_NO_ID_DEV_LOG)
 		return false;
 
 	if (!ata_log_supported(dev, ATA_LOG_IDENTIFY_DEVICE)) {
@@ -2165,7 +2165,7 @@ static bool ata_identify_page_supported(struct ata_device *dev, u8 page)
 		if (ata_id_major_version(dev->id) >= 10)
 			ata_dev_warn(dev,
 				"ATA Identify Device Log not supported\n");
-		dev->horkage |= ATA_HORKAGE_NO_ID_DEV_LOG;
+		dev->quirks |= ATA_QUIRK_NO_ID_DEV_LOG;
 		return false;
 	}
 
@@ -2186,7 +2186,7 @@ static bool ata_identify_page_supported(struct ata_device *dev, u8 page)
 	return false;
 }
 
-static int ata_do_link_spd_horkage(struct ata_device *dev)
+static int ata_do_link_spd_quirk(struct ata_device *dev)
 {
 	struct ata_link *plink = ata_dev_phys_link(dev);
 	u32 target, target_limit;
@@ -2194,7 +2194,7 @@ static int ata_do_link_spd_horkage(struct ata_device *dev)
 	if (!sata_scr_valid(plink))
 		return 0;
 
-	if (dev->horkage & ATA_HORKAGE_1_5_GBPS)
+	if (dev->quirks & ATA_QUIRK_1_5_GBPS)
 		target = 1;
 	else
 		return 0;
@@ -2212,7 +2212,7 @@ static int ata_do_link_spd_horkage(struct ata_device *dev)
 	 * guaranteed by setting sata_spd_limit to target_limit above.
 	 */
 	if (plink->sata_spd > target) {
-		ata_dev_info(dev, "applying link speed limit horkage to %s\n",
+		ata_dev_info(dev, "applying link speed limit quirk to %s\n",
 			     sata_spd_string(target));
 		return -EAGAIN;
 	}
@@ -2223,7 +2223,7 @@ static inline bool ata_dev_knobble(struct ata_device *dev)
 {
 	struct ata_port *ap = dev->link->ap;
 
-	if (ata_dev_blacklisted(dev) & ATA_HORKAGE_BRIDGE_OK)
+	if (ata_dev_quirks(dev) & ATA_QUIRK_BRIDGE_OK)
 		return false;
 
 	return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id)));
@@ -2246,7 +2246,7 @@ static void ata_dev_config_ncq_send_recv(struct ata_device *dev)
 		dev->flags |= ATA_DFLAG_NCQ_SEND_RECV;
 		memcpy(cmds, ap->sector_buf, ATA_LOG_NCQ_SEND_RECV_SIZE);
 
-		if (dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM) {
+		if (dev->quirks & ATA_QUIRK_NO_NCQ_TRIM) {
 			ata_dev_dbg(dev, "disabling queued TRIM support\n");
 			cmds[ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET] &=
 				~ATA_LOG_NCQ_SEND_RECV_DSM_TRIM;
@@ -2334,12 +2334,12 @@ static int ata_dev_config_ncq(struct ata_device *dev,
 	}
 	if (!IS_ENABLED(CONFIG_SATA_HOST))
 		return 0;
-	if (dev->horkage & ATA_HORKAGE_NONCQ) {
+	if (dev->quirks & ATA_QUIRK_NONCQ) {
 		snprintf(desc, desc_sz, "NCQ (not used)");
 		return 0;
 	}
 
-	if (dev->horkage & ATA_HORKAGE_NO_NCQ_ON_ATI &&
+	if (dev->quirks & ATA_QUIRK_NO_NCQ_ON_ATI &&
 	    ata_dev_check_adapter(dev, PCI_VENDOR_ID_ATI)) {
 		snprintf(desc, desc_sz, "NCQ (not used)");
 		return 0;
@@ -2350,7 +2350,7 @@ static int ata_dev_config_ncq(struct ata_device *dev,
 		dev->flags |= ATA_DFLAG_NCQ;
 	}
 
-	if (!(dev->horkage & ATA_HORKAGE_BROKEN_FPDMA_AA) &&
+	if (!(dev->quirks & ATA_QUIRK_BROKEN_FPDMA_AA) &&
 		(ap->flags & ATA_FLAG_FPDMA_AA) &&
 		ata_id_has_fpdma_aa(dev->id)) {
 		err_mask = ata_dev_set_feature(dev, SETFEATURES_SATA_ENABLE,
@@ -2360,7 +2360,7 @@ static int ata_dev_config_ncq(struct ata_device *dev,
 				    "failed to enable AA (error_mask=0x%x)\n",
 				    err_mask);
 			if (err_mask != AC_ERR_DEV) {
-				dev->horkage |= ATA_HORKAGE_BROKEN_FPDMA_AA;
+				dev->quirks |= ATA_QUIRK_BROKEN_FPDMA_AA;
 				return -EIO;
 			}
 		} else
@@ -2689,7 +2689,7 @@ static void ata_dev_config_fua(struct ata_device *dev)
 		goto nofua;
 
 	/* Ignore known bad devices and devices that lack NCQ support */
-	if (!ata_ncq_supported(dev) || (dev->horkage & ATA_HORKAGE_NO_FUA))
+	if (!ata_ncq_supported(dev) || (dev->quirks & ATA_QUIRK_NO_FUA))
 		goto nofua;
 
 	dev->flags |= ATA_DFLAG_FUA;
@@ -2829,11 +2829,11 @@ int ata_dev_configure(struct ata_device *dev)
 		return 0;
 	}
 
-	/* set horkage */
-	dev->horkage |= ata_dev_blacklisted(dev);
-	ata_force_horkage(dev);
+	/* Set quirks */
+	dev->quirks |= ata_dev_quirks(dev);
+	ata_force_quirks(dev);
 
-	if (dev->horkage & ATA_HORKAGE_DISABLE) {
+	if (dev->quirks & ATA_QUIRK_DISABLE) {
 		ata_dev_info(dev, "unsupported device, disabling\n");
 		ata_dev_disable(dev);
 		return 0;
@@ -2848,19 +2848,19 @@ int ata_dev_configure(struct ata_device *dev)
 		return 0;
 	}
 
-	rc = ata_do_link_spd_horkage(dev);
+	rc = ata_do_link_spd_quirk(dev);
 	if (rc)
 		return rc;
 
 	/* some WD SATA-1 drives have issues with LPM, turn on NOLPM for them */
-	if ((dev->horkage & ATA_HORKAGE_WD_BROKEN_LPM) &&
+	if ((dev->quirks & ATA_QUIRK_WD_BROKEN_LPM) &&
 	    (id[ATA_ID_SATA_CAPABILITY] & 0xe) == 0x2)
-		dev->horkage |= ATA_HORKAGE_NOLPM;
+		dev->quirks |= ATA_QUIRK_NOLPM;
 
 	if (ap->flags & ATA_FLAG_NO_LPM)
-		dev->horkage |= ATA_HORKAGE_NOLPM;
+		dev->quirks |= ATA_QUIRK_NOLPM;
 
-	if (dev->horkage & ATA_HORKAGE_NOLPM) {
+	if (dev->quirks & ATA_QUIRK_NOLPM) {
 		ata_dev_warn(dev, "LPM support broken, forcing max_power\n");
 		dev->link->ap->target_lpm_policy = ATA_LPM_MAX_POWER;
 	}
@@ -3006,7 +3006,8 @@ int ata_dev_configure(struct ata_device *dev)
 			cdb_intr_string = ", CDB intr";
 		}
 
-		if (atapi_dmadir || (dev->horkage & ATA_HORKAGE_ATAPI_DMADIR) || atapi_id_dmadir(dev->id)) {
+		if (atapi_dmadir || (dev->quirks & ATA_QUIRK_ATAPI_DMADIR) ||
+		    atapi_id_dmadir(dev->id)) {
 			dev->flags |= ATA_DFLAG_DMADIR;
 			dma_dir_string = ", DMADIR";
 		}
@@ -3043,24 +3044,24 @@ int ata_dev_configure(struct ata_device *dev)
 	if ((dev->class == ATA_DEV_ATAPI) &&
 	    (atapi_command_packet_set(id) == TYPE_TAPE)) {
 		dev->max_sectors = ATA_MAX_SECTORS_TAPE;
-		dev->horkage |= ATA_HORKAGE_STUCK_ERR;
+		dev->quirks |= ATA_QUIRK_STUCK_ERR;
 	}
 
-	if (dev->horkage & ATA_HORKAGE_MAX_SEC_128)
+	if (dev->quirks & ATA_QUIRK_MAX_SEC_128)
 		dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,
 					 dev->max_sectors);
 
-	if (dev->horkage & ATA_HORKAGE_MAX_SEC_1024)
+	if (dev->quirks & ATA_QUIRK_MAX_SEC_1024)
 		dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_1024,
 					 dev->max_sectors);
 
-	if (dev->horkage & ATA_HORKAGE_MAX_SEC_LBA48)
+	if (dev->quirks & ATA_QUIRK_MAX_SEC_LBA48)
 		dev->max_sectors = ATA_MAX_SECTORS_LBA48;
 
 	if (ap->ops->dev_config)
 		ap->ops->dev_config(dev);
 
-	if (dev->horkage & ATA_HORKAGE_DIAGNOSTIC) {
+	if (dev->quirks & ATA_QUIRK_DIAGNOSTIC) {
 		/* Let the user know. We don't want to disallow opens for
 		   rescue purposes, or in case the vendor is just a blithering
 		   idiot. Do this after the dev_config call as some controllers
@@ -3075,7 +3076,7 @@ int ata_dev_configure(struct ata_device *dev)
 		}
 	}
 
-	if ((dev->horkage & ATA_HORKAGE_FIRMWARE_WARN) && print_info) {
+	if ((dev->quirks & ATA_QUIRK_FIRMWARE_WARN) && print_info) {
 		ata_dev_warn(dev, "WARNING: device requires firmware update to be fully functional\n");
 		ata_dev_warn(dev, "         contact the vendor or visit http://ata.wiki.kernel.org\n");
 	}
@@ -3425,7 +3426,7 @@ static int ata_dev_set_mode(struct ata_device *dev)
 {
 	struct ata_port *ap = dev->link->ap;
 	struct ata_eh_context *ehc = &dev->link->eh_context;
-	const bool nosetxfer = dev->horkage & ATA_HORKAGE_NOSETXFER;
+	const bool nosetxfer = dev->quirks & ATA_QUIRK_NOSETXFER;
 	const char *dev_err_whine = "";
 	int ign_dev_err = 0;
 	unsigned int err_mask = 0;
@@ -3969,7 +3970,7 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
 	 */
 	if (dev->n_native_sectors == n_native_sectors &&
 	    dev->n_sectors < n_sectors && n_sectors == n_native_sectors &&
-	    !(dev->horkage & ATA_HORKAGE_BROKEN_HPA)) {
+	    !(dev->quirks & ATA_QUIRK_BROKEN_HPA)) {
 		ata_dev_warn(dev,
 			     "old n_sectors matches native, probably "
 			     "late HPA lock, will try to unlock HPA\n");
@@ -3987,223 +3988,223 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
 	return rc;
 }
 
-struct ata_blacklist_entry {
+struct ata_dev_quirks_entry {
 	const char *model_num;
 	const char *model_rev;
-	unsigned long horkage;
+	unsigned int quirks;
 };
 
-static const struct ata_blacklist_entry ata_device_blacklist [] = {
+static const struct ata_dev_quirks_entry __ata_dev_quirks[] = {
 	/* Devices with DMA related problems under Linux */
-	{ "WDC AC11000H",	NULL,		ATA_HORKAGE_NODMA },
-	{ "WDC AC22100H",	NULL,		ATA_HORKAGE_NODMA },
-	{ "WDC AC32500H",	NULL,		ATA_HORKAGE_NODMA },
-	{ "WDC AC33100H",	NULL,		ATA_HORKAGE_NODMA },
-	{ "WDC AC31600H",	NULL,		ATA_HORKAGE_NODMA },
-	{ "WDC AC32100H",	"24.09P07",	ATA_HORKAGE_NODMA },
-	{ "WDC AC23200L",	"21.10N21",	ATA_HORKAGE_NODMA },
-	{ "Compaq CRD-8241B", 	NULL,		ATA_HORKAGE_NODMA },
-	{ "CRD-8400B",		NULL, 		ATA_HORKAGE_NODMA },
-	{ "CRD-848[02]B",	NULL,		ATA_HORKAGE_NODMA },
-	{ "CRD-84",		NULL,		ATA_HORKAGE_NODMA },
-	{ "SanDisk SDP3B",	NULL,		ATA_HORKAGE_NODMA },
-	{ "SanDisk SDP3B-64",	NULL,		ATA_HORKAGE_NODMA },
-	{ "SANYO CD-ROM CRD",	NULL,		ATA_HORKAGE_NODMA },
-	{ "HITACHI CDR-8",	NULL,		ATA_HORKAGE_NODMA },
-	{ "HITACHI CDR-8[34]35",NULL,		ATA_HORKAGE_NODMA },
-	{ "Toshiba CD-ROM XM-6202B", NULL,	ATA_HORKAGE_NODMA },
-	{ "TOSHIBA CD-ROM XM-1702BC", NULL,	ATA_HORKAGE_NODMA },
-	{ "CD-532E-A", 		NULL,		ATA_HORKAGE_NODMA },
-	{ "E-IDE CD-ROM CR-840",NULL,		ATA_HORKAGE_NODMA },
-	{ "CD-ROM Drive/F5A",	NULL,		ATA_HORKAGE_NODMA },
-	{ "WPI CDD-820", 	NULL,		ATA_HORKAGE_NODMA },
-	{ "SAMSUNG CD-ROM SC-148C", NULL,	ATA_HORKAGE_NODMA },
-	{ "SAMSUNG CD-ROM SC",	NULL,		ATA_HORKAGE_NODMA },
-	{ "ATAPI CD-ROM DRIVE 40X MAXIMUM",NULL,ATA_HORKAGE_NODMA },
-	{ "_NEC DV5800A", 	NULL,		ATA_HORKAGE_NODMA },
-	{ "SAMSUNG CD-ROM SN-124", "N001",	ATA_HORKAGE_NODMA },
-	{ "Seagate STT20000A", NULL,		ATA_HORKAGE_NODMA },
-	{ " 2GB ATA Flash Disk", "ADMA428M",	ATA_HORKAGE_NODMA },
-	{ "VRFDFC22048UCHC-TE*", NULL,		ATA_HORKAGE_NODMA },
+	{ "WDC AC11000H",	NULL,		ATA_QUIRK_NODMA },
+	{ "WDC AC22100H",	NULL,		ATA_QUIRK_NODMA },
+	{ "WDC AC32500H",	NULL,		ATA_QUIRK_NODMA },
+	{ "WDC AC33100H",	NULL,		ATA_QUIRK_NODMA },
+	{ "WDC AC31600H",	NULL,		ATA_QUIRK_NODMA },
+	{ "WDC AC32100H",	"24.09P07",	ATA_QUIRK_NODMA },
+	{ "WDC AC23200L",	"21.10N21",	ATA_QUIRK_NODMA },
+	{ "Compaq CRD-8241B",	NULL,		ATA_QUIRK_NODMA },
+	{ "CRD-8400B",		NULL,		ATA_QUIRK_NODMA },
+	{ "CRD-848[02]B",	NULL,		ATA_QUIRK_NODMA },
+	{ "CRD-84",		NULL,		ATA_QUIRK_NODMA },
+	{ "SanDisk SDP3B",	NULL,		ATA_QUIRK_NODMA },
+	{ "SanDisk SDP3B-64",	NULL,		ATA_QUIRK_NODMA },
+	{ "SANYO CD-ROM CRD",	NULL,		ATA_QUIRK_NODMA },
+	{ "HITACHI CDR-8",	NULL,		ATA_QUIRK_NODMA },
+	{ "HITACHI CDR-8[34]35", NULL,		ATA_QUIRK_NODMA },
+	{ "Toshiba CD-ROM XM-6202B", NULL,	ATA_QUIRK_NODMA },
+	{ "TOSHIBA CD-ROM XM-1702BC", NULL,	ATA_QUIRK_NODMA },
+	{ "CD-532E-A",		NULL,		ATA_QUIRK_NODMA },
+	{ "E-IDE CD-ROM CR-840", NULL,		ATA_QUIRK_NODMA },
+	{ "CD-ROM Drive/F5A",	NULL,		ATA_QUIRK_NODMA },
+	{ "WPI CDD-820",	NULL,		ATA_QUIRK_NODMA },
+	{ "SAMSUNG CD-ROM SC-148C", NULL,	ATA_QUIRK_NODMA },
+	{ "SAMSUNG CD-ROM SC",	NULL,		ATA_QUIRK_NODMA },
+	{ "ATAPI CD-ROM DRIVE 40X MAXIMUM", NULL, ATA_QUIRK_NODMA },
+	{ "_NEC DV5800A",	NULL,		ATA_QUIRK_NODMA },
+	{ "SAMSUNG CD-ROM SN-124", "N001",	ATA_QUIRK_NODMA },
+	{ "Seagate STT20000A", NULL,		ATA_QUIRK_NODMA },
+	{ " 2GB ATA Flash Disk", "ADMA428M",	ATA_QUIRK_NODMA },
+	{ "VRFDFC22048UCHC-TE*", NULL,		ATA_QUIRK_NODMA },
 	/* Odd clown on sil3726/4726 PMPs */
-	{ "Config  Disk",	NULL,		ATA_HORKAGE_DISABLE },
+	{ "Config  Disk",	NULL,		ATA_QUIRK_DISABLE },
 	/* Similar story with ASMedia 1092 */
-	{ "ASMT109x- Config",	NULL,		ATA_HORKAGE_DISABLE },
+	{ "ASMT109x- Config",	NULL,		ATA_QUIRK_DISABLE },
 
 	/* Weird ATAPI devices */
-	{ "TORiSAN DVD-ROM DRD-N216", NULL,	ATA_HORKAGE_MAX_SEC_128 },
-	{ "QUANTUM DAT    DAT72-000", NULL,	ATA_HORKAGE_ATAPI_MOD16_DMA },
-	{ "Slimtype DVD A  DS8A8SH", NULL,	ATA_HORKAGE_MAX_SEC_LBA48 },
-	{ "Slimtype DVD A  DS8A9SH", NULL,	ATA_HORKAGE_MAX_SEC_LBA48 },
+	{ "TORiSAN DVD-ROM DRD-N216", NULL,	ATA_QUIRK_MAX_SEC_128 },
+	{ "QUANTUM DAT    DAT72-000", NULL,	ATA_QUIRK_ATAPI_MOD16_DMA },
+	{ "Slimtype DVD A  DS8A8SH", NULL,	ATA_QUIRK_MAX_SEC_LBA48 },
+	{ "Slimtype DVD A  DS8A9SH", NULL,	ATA_QUIRK_MAX_SEC_LBA48 },
 
 	/*
 	 * Causes silent data corruption with higher max sects.
 	 * http://lkml.kernel.org/g/x49wpy40ysk.fsf@segfault.boston.devel.redhat.com
 	 */
-	{ "ST380013AS",		"3.20",		ATA_HORKAGE_MAX_SEC_1024 },
+	{ "ST380013AS",		"3.20",		ATA_QUIRK_MAX_SEC_1024 },
 
 	/*
 	 * These devices time out with higher max sects.
 	 * https://bugzilla.kernel.org/show_bug.cgi?id=121671
 	 */
-	{ "LITEON CX1-JB*-HP",	NULL,		ATA_HORKAGE_MAX_SEC_1024 },
-	{ "LITEON EP1-*",	NULL,		ATA_HORKAGE_MAX_SEC_1024 },
+	{ "LITEON CX1-JB*-HP",	NULL,		ATA_QUIRK_MAX_SEC_1024 },
+	{ "LITEON EP1-*",	NULL,		ATA_QUIRK_MAX_SEC_1024 },
 
 	/* Devices we expect to fail diagnostics */
 
 	/* Devices where NCQ should be avoided */
 	/* NCQ is slow */
-	{ "WDC WD740ADFD-00",	NULL,		ATA_HORKAGE_NONCQ },
-	{ "WDC WD740ADFD-00NLR1", NULL,		ATA_HORKAGE_NONCQ },
+	{ "WDC WD740ADFD-00",	NULL,		ATA_QUIRK_NONCQ },
+	{ "WDC WD740ADFD-00NLR1", NULL,		ATA_QUIRK_NONCQ },
 	/* http://thread.gmane.org/gmane.linux.ide/14907 */
-	{ "FUJITSU MHT2060BH",	NULL,		ATA_HORKAGE_NONCQ },
+	{ "FUJITSU MHT2060BH",	NULL,		ATA_QUIRK_NONCQ },
 	/* NCQ is broken */
-	{ "Maxtor *",		"BANC*",	ATA_HORKAGE_NONCQ },
-	{ "Maxtor 7V300F0",	"VA111630",	ATA_HORKAGE_NONCQ },
-	{ "ST380817AS",		"3.42",		ATA_HORKAGE_NONCQ },
-	{ "ST3160023AS",	"3.42",		ATA_HORKAGE_NONCQ },
-	{ "OCZ CORE_SSD",	"02.10104",	ATA_HORKAGE_NONCQ },
+	{ "Maxtor *",		"BANC*",	ATA_QUIRK_NONCQ },
+	{ "Maxtor 7V300F0",	"VA111630",	ATA_QUIRK_NONCQ },
+	{ "ST380817AS",		"3.42",		ATA_QUIRK_NONCQ },
+	{ "ST3160023AS",	"3.42",		ATA_QUIRK_NONCQ },
+	{ "OCZ CORE_SSD",	"02.10104",	ATA_QUIRK_NONCQ },
 
 	/* Seagate NCQ + FLUSH CACHE firmware bug */
-	{ "ST31500341AS",	"SD1[5-9]",	ATA_HORKAGE_NONCQ |
-						ATA_HORKAGE_FIRMWARE_WARN },
+	{ "ST31500341AS",	"SD1[5-9]",	ATA_QUIRK_NONCQ |
+						ATA_QUIRK_FIRMWARE_WARN },
 
-	{ "ST31000333AS",	"SD1[5-9]",	ATA_HORKAGE_NONCQ |
-						ATA_HORKAGE_FIRMWARE_WARN },
+	{ "ST31000333AS",	"SD1[5-9]",	ATA_QUIRK_NONCQ |
+						ATA_QUIRK_FIRMWARE_WARN },
 
-	{ "ST3640[36]23AS",	"SD1[5-9]",	ATA_HORKAGE_NONCQ |
-						ATA_HORKAGE_FIRMWARE_WARN },
+	{ "ST3640[36]23AS",	"SD1[5-9]",	ATA_QUIRK_NONCQ |
+						ATA_QUIRK_FIRMWARE_WARN },
 
-	{ "ST3320[68]13AS",	"SD1[5-9]",	ATA_HORKAGE_NONCQ |
-						ATA_HORKAGE_FIRMWARE_WARN },
+	{ "ST3320[68]13AS",	"SD1[5-9]",	ATA_QUIRK_NONCQ |
+						ATA_QUIRK_FIRMWARE_WARN },
 
 	/* drives which fail FPDMA_AA activation (some may freeze afterwards)
 	   the ST disks also have LPM issues */
-	{ "ST1000LM024 HN-M101MBB", NULL,	ATA_HORKAGE_BROKEN_FPDMA_AA |
-						ATA_HORKAGE_NOLPM },
-	{ "VB0250EAVER",	"HPG7",		ATA_HORKAGE_BROKEN_FPDMA_AA },
+	{ "ST1000LM024 HN-M101MBB", NULL,	ATA_QUIRK_BROKEN_FPDMA_AA |
+						ATA_QUIRK_NOLPM },
+	{ "VB0250EAVER",	"HPG7",		ATA_QUIRK_BROKEN_FPDMA_AA },
 
 	/* Blacklist entries taken from Silicon Image 3124/3132
 	   Windows driver .inf file - also several Linux problem reports */
-	{ "HTS541060G9SA00",    "MB3OC60D",     ATA_HORKAGE_NONCQ },
-	{ "HTS541080G9SA00",    "MB4OC60D",     ATA_HORKAGE_NONCQ },
-	{ "HTS541010G9SA00",    "MBZOC60D",     ATA_HORKAGE_NONCQ },
+	{ "HTS541060G9SA00",    "MB3OC60D",     ATA_QUIRK_NONCQ },
+	{ "HTS541080G9SA00",    "MB4OC60D",     ATA_QUIRK_NONCQ },
+	{ "HTS541010G9SA00",    "MBZOC60D",     ATA_QUIRK_NONCQ },
 
 	/* https://bugzilla.kernel.org/show_bug.cgi?id=15573 */
-	{ "C300-CTFDDAC128MAG",	"0001",		ATA_HORKAGE_NONCQ },
+	{ "C300-CTFDDAC128MAG",	"0001",		ATA_QUIRK_NONCQ },
 
 	/* Sandisk SD7/8/9s lock up hard on large trims */
-	{ "SanDisk SD[789]*",	NULL,		ATA_HORKAGE_MAX_TRIM_128M },
+	{ "SanDisk SD[789]*",	NULL,		ATA_QUIRK_MAX_TRIM_128M },
 
 	/* devices which puke on READ_NATIVE_MAX */
-	{ "HDS724040KLSA80",	"KFAOA20N",	ATA_HORKAGE_BROKEN_HPA },
-	{ "WDC WD3200JD-00KLB0", "WD-WCAMR1130137", ATA_HORKAGE_BROKEN_HPA },
-	{ "WDC WD2500JD-00HBB0", "WD-WMAL71490727", ATA_HORKAGE_BROKEN_HPA },
-	{ "MAXTOR 6L080L4",	"A93.0500",	ATA_HORKAGE_BROKEN_HPA },
+	{ "HDS724040KLSA80",	"KFAOA20N",	ATA_QUIRK_BROKEN_HPA },
+	{ "WDC WD3200JD-00KLB0", "WD-WCAMR1130137", ATA_QUIRK_BROKEN_HPA },
+	{ "WDC WD2500JD-00HBB0", "WD-WMAL71490727", ATA_QUIRK_BROKEN_HPA },
+	{ "MAXTOR 6L080L4",	"A93.0500",	ATA_QUIRK_BROKEN_HPA },
 
 	/* this one allows HPA unlocking but fails IOs on the area */
-	{ "OCZ-VERTEX",		    "1.30",	ATA_HORKAGE_BROKEN_HPA },
+	{ "OCZ-VERTEX",		    "1.30",	ATA_QUIRK_BROKEN_HPA },
 
 	/* Devices which report 1 sector over size HPA */
-	{ "ST340823A",		NULL,		ATA_HORKAGE_HPA_SIZE },
-	{ "ST320413A",		NULL,		ATA_HORKAGE_HPA_SIZE },
-	{ "ST310211A",		NULL,		ATA_HORKAGE_HPA_SIZE },
+	{ "ST340823A",		NULL,		ATA_QUIRK_HPA_SIZE },
+	{ "ST320413A",		NULL,		ATA_QUIRK_HPA_SIZE },
+	{ "ST310211A",		NULL,		ATA_QUIRK_HPA_SIZE },
 
 	/* Devices which get the IVB wrong */
-	{ "QUANTUM FIREBALLlct10 05", "A03.0900", ATA_HORKAGE_IVB },
-	/* Maybe we should just blacklist TSSTcorp... */
-	{ "TSSTcorp CDDVDW SH-S202[HJN]", "SB0[01]",  ATA_HORKAGE_IVB },
+	{ "QUANTUM FIREBALLlct10 05", "A03.0900", ATA_QUIRK_IVB },
+	/* Maybe we should just add all TSSTcorp devices... */
+	{ "TSSTcorp CDDVDW SH-S202[HJN]", "SB0[01]",  ATA_QUIRK_IVB },
 
 	/* Devices that do not need bridging limits applied */
-	{ "MTRON MSP-SATA*",		NULL,	ATA_HORKAGE_BRIDGE_OK },
-	{ "BUFFALO HD-QSU2/R5",		NULL,	ATA_HORKAGE_BRIDGE_OK },
+	{ "MTRON MSP-SATA*",		NULL,	ATA_QUIRK_BRIDGE_OK },
+	{ "BUFFALO HD-QSU2/R5",		NULL,	ATA_QUIRK_BRIDGE_OK },
 
 	/* Devices which aren't very happy with higher link speeds */
-	{ "WD My Book",			NULL,	ATA_HORKAGE_1_5_GBPS },
-	{ "Seagate FreeAgent GoFlex",	NULL,	ATA_HORKAGE_1_5_GBPS },
+	{ "WD My Book",			NULL,	ATA_QUIRK_1_5_GBPS },
+	{ "Seagate FreeAgent GoFlex",	NULL,	ATA_QUIRK_1_5_GBPS },
 
 	/*
 	 * Devices which choke on SETXFER.  Applies only if both the
 	 * device and controller are SATA.
 	 */
-	{ "PIONEER DVD-RW  DVRTD08",	NULL,	ATA_HORKAGE_NOSETXFER },
-	{ "PIONEER DVD-RW  DVRTD08A",	NULL,	ATA_HORKAGE_NOSETXFER },
-	{ "PIONEER DVD-RW  DVR-215",	NULL,	ATA_HORKAGE_NOSETXFER },
-	{ "PIONEER DVD-RW  DVR-212D",	NULL,	ATA_HORKAGE_NOSETXFER },
-	{ "PIONEER DVD-RW  DVR-216D",	NULL,	ATA_HORKAGE_NOSETXFER },
+	{ "PIONEER DVD-RW  DVRTD08",	NULL,	ATA_QUIRK_NOSETXFER },
+	{ "PIONEER DVD-RW  DVRTD08A",	NULL,	ATA_QUIRK_NOSETXFER },
+	{ "PIONEER DVD-RW  DVR-215",	NULL,	ATA_QUIRK_NOSETXFER },
+	{ "PIONEER DVD-RW  DVR-212D",	NULL,	ATA_QUIRK_NOSETXFER },
+	{ "PIONEER DVD-RW  DVR-216D",	NULL,	ATA_QUIRK_NOSETXFER },
 
 	/* These specific Pioneer models have LPM issues */
-	{ "PIONEER BD-RW   BDR-207M",	NULL,	ATA_HORKAGE_NOLPM },
-	{ "PIONEER BD-RW   BDR-205",	NULL,	ATA_HORKAGE_NOLPM },
+	{ "PIONEER BD-RW   BDR-207M",	NULL,	ATA_QUIRK_NOLPM },
+	{ "PIONEER BD-RW   BDR-205",	NULL,	ATA_QUIRK_NOLPM },
 
 	/* Crucial devices with broken LPM support */
-	{ "CT*0BX*00SSD1",		NULL,	ATA_HORKAGE_NOLPM },
+	{ "CT*0BX*00SSD1",		NULL,	ATA_QUIRK_NOLPM },
 
 	/* 512GB MX100 with MU01 firmware has both queued TRIM and LPM issues */
-	{ "Crucial_CT512MX100*",	"MU01",	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_ZERO_AFTER_TRIM |
-						ATA_HORKAGE_NOLPM },
+	{ "Crucial_CT512MX100*",	"MU01",	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_ZERO_AFTER_TRIM |
+						ATA_QUIRK_NOLPM },
 	/* 512GB MX100 with newer firmware has only LPM issues */
-	{ "Crucial_CT512MX100*",	NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM |
-						ATA_HORKAGE_NOLPM },
+	{ "Crucial_CT512MX100*",	NULL,	ATA_QUIRK_ZERO_AFTER_TRIM |
+						ATA_QUIRK_NOLPM },
 
 	/* 480GB+ M500 SSDs have both queued TRIM and LPM issues */
-	{ "Crucial_CT480M500*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_ZERO_AFTER_TRIM |
-						ATA_HORKAGE_NOLPM },
-	{ "Crucial_CT960M500*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_ZERO_AFTER_TRIM |
-						ATA_HORKAGE_NOLPM },
+	{ "Crucial_CT480M500*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_ZERO_AFTER_TRIM |
+						ATA_QUIRK_NOLPM },
+	{ "Crucial_CT960M500*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_ZERO_AFTER_TRIM |
+						ATA_QUIRK_NOLPM },
 
 	/* AMD Radeon devices with broken LPM support */
-	{ "R3SL240G",			NULL,	ATA_HORKAGE_NOLPM },
+	{ "R3SL240G",			NULL,	ATA_QUIRK_NOLPM },
 
 	/* Apacer models with LPM issues */
-	{ "Apacer AS340*",		NULL,	ATA_HORKAGE_NOLPM },
+	{ "Apacer AS340*",		NULL,	ATA_QUIRK_NOLPM },
 
 	/* These specific Samsung models/firmware-revs do not handle LPM well */
-	{ "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM },
-	{ "SAMSUNG SSD PM830 mSATA *",  "CXM13D1Q", ATA_HORKAGE_NOLPM },
-	{ "SAMSUNG MZ7TD256HAFV-000L9", NULL,       ATA_HORKAGE_NOLPM },
-	{ "SAMSUNG MZ7TE512HMHP-000L1", "EXT06L0Q", ATA_HORKAGE_NOLPM },
+	{ "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_QUIRK_NOLPM },
+	{ "SAMSUNG SSD PM830 mSATA *",  "CXM13D1Q", ATA_QUIRK_NOLPM },
+	{ "SAMSUNG MZ7TD256HAFV-000L9", NULL,       ATA_QUIRK_NOLPM },
+	{ "SAMSUNG MZ7TE512HMHP-000L1", "EXT06L0Q", ATA_QUIRK_NOLPM },
 
 	/* devices that don't properly handle queued TRIM commands */
-	{ "Micron_M500IT_*",		"MU01",	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_ZERO_AFTER_TRIM },
-	{ "Micron_M500_*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_ZERO_AFTER_TRIM },
-	{ "Micron_M5[15]0_*",		"MU01",	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_ZERO_AFTER_TRIM },
-	{ "Micron_1100_*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_ZERO_AFTER_TRIM, },
-	{ "Crucial_CT*M500*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_ZERO_AFTER_TRIM },
-	{ "Crucial_CT*M550*",		"MU01",	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_ZERO_AFTER_TRIM },
-	{ "Crucial_CT*MX100*",		"MU01",	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_ZERO_AFTER_TRIM },
-	{ "Samsung SSD 840 EVO*",	NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_NO_DMA_LOG |
-						ATA_HORKAGE_ZERO_AFTER_TRIM },
-	{ "Samsung SSD 840*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_ZERO_AFTER_TRIM },
-	{ "Samsung SSD 850*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_ZERO_AFTER_TRIM },
-	{ "Samsung SSD 860*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_ZERO_AFTER_TRIM |
-						ATA_HORKAGE_NO_NCQ_ON_ATI },
-	{ "Samsung SSD 870*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_ZERO_AFTER_TRIM |
-						ATA_HORKAGE_NO_NCQ_ON_ATI },
-	{ "SAMSUNG*MZ7LH*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_ZERO_AFTER_TRIM |
-						ATA_HORKAGE_NO_NCQ_ON_ATI, },
-	{ "FCCT*M500*",			NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
-						ATA_HORKAGE_ZERO_AFTER_TRIM },
+	{ "Micron_M500IT_*",		"MU01",	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_ZERO_AFTER_TRIM },
+	{ "Micron_M500_*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_ZERO_AFTER_TRIM },
+	{ "Micron_M5[15]0_*",		"MU01",	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_ZERO_AFTER_TRIM },
+	{ "Micron_1100_*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_ZERO_AFTER_TRIM, },
+	{ "Crucial_CT*M500*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_ZERO_AFTER_TRIM },
+	{ "Crucial_CT*M550*",		"MU01",	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_ZERO_AFTER_TRIM },
+	{ "Crucial_CT*MX100*",		"MU01",	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_ZERO_AFTER_TRIM },
+	{ "Samsung SSD 840 EVO*",	NULL,	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_NO_DMA_LOG |
+						ATA_QUIRK_ZERO_AFTER_TRIM },
+	{ "Samsung SSD 840*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_ZERO_AFTER_TRIM },
+	{ "Samsung SSD 850*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_ZERO_AFTER_TRIM },
+	{ "Samsung SSD 860*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_ZERO_AFTER_TRIM |
+						ATA_QUIRK_NO_NCQ_ON_ATI },
+	{ "Samsung SSD 870*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_ZERO_AFTER_TRIM |
+						ATA_QUIRK_NO_NCQ_ON_ATI },
+	{ "SAMSUNG*MZ7LH*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_ZERO_AFTER_TRIM |
+						ATA_QUIRK_NO_NCQ_ON_ATI, },
+	{ "FCCT*M500*",			NULL,	ATA_QUIRK_NO_NCQ_TRIM |
+						ATA_QUIRK_ZERO_AFTER_TRIM },
 
 	/* devices that don't properly handle TRIM commands */
-	{ "SuperSSpeed S238*",		NULL,	ATA_HORKAGE_NOTRIM },
-	{ "M88V29*",			NULL,	ATA_HORKAGE_NOTRIM },
+	{ "SuperSSpeed S238*",		NULL,	ATA_QUIRK_NOTRIM },
+	{ "M88V29*",			NULL,	ATA_QUIRK_NOTRIM },
 
 	/*
 	 * As defined, the DRAT (Deterministic Read After Trim) and RZAT
@@ -4223,14 +4224,14 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
 	 */
 	{ "INTEL*SSDSC2MH*",		NULL,	0 },
 
-	{ "Micron*",			NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM },
-	{ "Crucial*",			NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM },
-	{ "INTEL*SSD*", 		NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM },
-	{ "SSD*INTEL*",			NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM },
-	{ "Samsung*SSD*",		NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM },
-	{ "SAMSUNG*SSD*",		NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM },
-	{ "SAMSUNG*MZ7KM*",		NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM },
-	{ "ST[1248][0248]0[FH]*",	NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM },
+	{ "Micron*",			NULL,	ATA_QUIRK_ZERO_AFTER_TRIM },
+	{ "Crucial*",			NULL,	ATA_QUIRK_ZERO_AFTER_TRIM },
+	{ "INTEL*SSD*",			NULL,	ATA_QUIRK_ZERO_AFTER_TRIM },
+	{ "SSD*INTEL*",			NULL,	ATA_QUIRK_ZERO_AFTER_TRIM },
+	{ "Samsung*SSD*",		NULL,	ATA_QUIRK_ZERO_AFTER_TRIM },
+	{ "SAMSUNG*SSD*",		NULL,	ATA_QUIRK_ZERO_AFTER_TRIM },
+	{ "SAMSUNG*MZ7KM*",		NULL,	ATA_QUIRK_ZERO_AFTER_TRIM },
+	{ "ST[1248][0248]0[FH]*",	NULL,	ATA_QUIRK_ZERO_AFTER_TRIM },
 
 	/*
 	 * Some WD SATA-I drives spin up and down erratically when the link
@@ -4241,36 +4242,36 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
 	 *
 	 * https://bugzilla.kernel.org/show_bug.cgi?id=57211
 	 */
-	{ "WDC WD800JD-*",		NULL,	ATA_HORKAGE_WD_BROKEN_LPM },
-	{ "WDC WD1200JD-*",		NULL,	ATA_HORKAGE_WD_BROKEN_LPM },
-	{ "WDC WD1600JD-*",		NULL,	ATA_HORKAGE_WD_BROKEN_LPM },
-	{ "WDC WD2000JD-*",		NULL,	ATA_HORKAGE_WD_BROKEN_LPM },
-	{ "WDC WD2500JD-*",		NULL,	ATA_HORKAGE_WD_BROKEN_LPM },
-	{ "WDC WD3000JD-*",		NULL,	ATA_HORKAGE_WD_BROKEN_LPM },
-	{ "WDC WD3200JD-*",		NULL,	ATA_HORKAGE_WD_BROKEN_LPM },
+	{ "WDC WD800JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
+	{ "WDC WD1200JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
+	{ "WDC WD1600JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
+	{ "WDC WD2000JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
+	{ "WDC WD2500JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
+	{ "WDC WD3000JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
+	{ "WDC WD3200JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
 
 	/*
 	 * This sata dom device goes on a walkabout when the ATA_LOG_DIRECTORY
 	 * log page is accessed. Ensure we never ask for this log page with
 	 * these devices.
 	 */
-	{ "SATADOM-ML 3ME",		NULL,	ATA_HORKAGE_NO_LOG_DIR },
+	{ "SATADOM-ML 3ME",		NULL,	ATA_QUIRK_NO_LOG_DIR },
 
 	/* Buggy FUA */
-	{ "Maxtor",		"BANC1G10",	ATA_HORKAGE_NO_FUA },
-	{ "WDC*WD2500J*",	NULL,		ATA_HORKAGE_NO_FUA },
-	{ "OCZ-VERTEX*",	NULL,		ATA_HORKAGE_NO_FUA },
-	{ "INTEL*SSDSC2CT*",	NULL,		ATA_HORKAGE_NO_FUA },
+	{ "Maxtor",		"BANC1G10",	ATA_QUIRK_NO_FUA },
+	{ "WDC*WD2500J*",	NULL,		ATA_QUIRK_NO_FUA },
+	{ "OCZ-VERTEX*",	NULL,		ATA_QUIRK_NO_FUA },
+	{ "INTEL*SSDSC2CT*",	NULL,		ATA_QUIRK_NO_FUA },
 
 	/* End Marker */
 	{ }
 };
 
-static unsigned long ata_dev_blacklisted(const struct ata_device *dev)
+static unsigned int ata_dev_quirks(const struct ata_device *dev)
 {
 	unsigned char model_num[ATA_ID_PROD_LEN + 1];
 	unsigned char model_rev[ATA_ID_FW_REV_LEN + 1];
-	const struct ata_blacklist_entry *ad = ata_device_blacklist;
+	const struct ata_dev_quirks_entry *ad = __ata_dev_quirks;
 
 	ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
 	ata_id_c_string(dev->id, model_rev, ATA_ID_FW_REV, sizeof(model_rev));
@@ -4278,9 +4279,9 @@ static unsigned long ata_dev_blacklisted(const struct ata_device *dev)
 	while (ad->model_num) {
 		if (glob_match(ad->model_num, model_num)) {
 			if (ad->model_rev == NULL)
-				return ad->horkage;
+				return ad->quirks;
 			if (glob_match(ad->model_rev, model_rev))
-				return ad->horkage;
+				return ad->quirks;
 		}
 		ad++;
 	}
@@ -4297,7 +4298,7 @@ static bool ata_dev_nodma(const struct ata_device *dev)
 	if ((dev->link->ap->flags & ATA_FLAG_PIO_POLLING) &&
 	    (dev->flags & ATA_DFLAG_CDB_INTR))
 		return true;
-	return dev->horkage & ATA_HORKAGE_NODMA;
+	return dev->quirks & ATA_QUIRK_NODMA;
 }
 
 /**
@@ -4310,7 +4311,7 @@ static bool ata_dev_nodma(const struct ata_device *dev)
 
 static int ata_is_40wire(struct ata_device *dev)
 {
-	if (dev->horkage & ATA_HORKAGE_IVB)
+	if (dev->quirks & ATA_QUIRK_IVB)
 		return ata_drive_40wire_relaxed(dev->id);
 	return ata_drive_40wire(dev->id);
 }
@@ -4372,8 +4373,7 @@ static int cable_is_40wire(struct ata_port *ap)
  *
  *	Compute supported xfermask of @dev and store it in
  *	dev->*_mask.  This function is responsible for applying all
- *	known limits including host controller limits, device
- *	blacklist, etc...
+ *	known limits including host controller limits, device quirks, etc...
  *
  *	LOCKING:
  *	None.
@@ -4589,7 +4589,7 @@ int atapi_check_dma(struct ata_queued_cmd *qc)
 	/* Don't allow DMA if it isn't multiple of 16 bytes.  Quite a
 	 * few ATAPI devices choke on such DMA requests.
 	 */
-	if (!(qc->dev->horkage & ATA_HORKAGE_ATAPI_MOD16_DMA) &&
+	if (!(qc->dev->quirks & ATA_QUIRK_ATAPI_MOD16_DMA) &&
 	    unlikely(qc->nbytes & 15))
 		return 1;
 
@@ -5369,7 +5369,7 @@ void ata_dev_init(struct ata_device *dev)
 	 */
 	spin_lock_irqsave(ap->lock, flags);
 	dev->flags &= ~ATA_DFLAG_INIT_MASK;
-	dev->horkage = 0;
+	dev->quirks = 0;
 	spin_unlock_irqrestore(ap->lock, flags);
 
 	memset((void *)dev + ATA_DEVICE_CLEAR_BEGIN, 0,
@@ -6298,12 +6298,12 @@ EXPORT_SYMBOL_GPL(ata_platform_remove_one);
 	{ "no" #name,	.lflags_on	= (flags) },	\
 	{ #name,	.lflags_off	= (flags) }
 
-#define force_horkage_on(name, flag)			\
-	{ #name,	.horkage_on	= (flag) }
+#define force_quirk_on(name, flag)			\
+	{ #name,	.quirk_on	= (flag) }
 
-#define force_horkage_onoff(name, flag)			\
-	{ "no" #name,	.horkage_on	= (flag) },	\
-	{ #name,	.horkage_off	= (flag) }
+#define force_quirk_onoff(name, flag)			\
+	{ "no" #name,	.quirk_on	= (flag) },	\
+	{ #name,	.quirk_off	= (flag) }
 
 static const struct ata_force_param force_tbl[] __initconst = {
 	force_cbl(40c,			ATA_CBL_PATA40),
@@ -6357,32 +6357,32 @@ static const struct ata_force_param force_tbl[] __initconst = {
 	force_lflag_on(rstonce,		ATA_LFLAG_RST_ONCE),
 	force_lflag_onoff(dbdelay,	ATA_LFLAG_NO_DEBOUNCE_DELAY),
 
-	force_horkage_onoff(ncq,	ATA_HORKAGE_NONCQ),
-	force_horkage_onoff(ncqtrim,	ATA_HORKAGE_NO_NCQ_TRIM),
-	force_horkage_onoff(ncqati,	ATA_HORKAGE_NO_NCQ_ON_ATI),
+	force_quirk_onoff(ncq,		ATA_QUIRK_NONCQ),
+	force_quirk_onoff(ncqtrim,	ATA_QUIRK_NO_NCQ_TRIM),
+	force_quirk_onoff(ncqati,	ATA_QUIRK_NO_NCQ_ON_ATI),
 
-	force_horkage_onoff(trim,	ATA_HORKAGE_NOTRIM),
-	force_horkage_on(trim_zero,	ATA_HORKAGE_ZERO_AFTER_TRIM),
-	force_horkage_on(max_trim_128m, ATA_HORKAGE_MAX_TRIM_128M),
+	force_quirk_onoff(trim,		ATA_QUIRK_NOTRIM),
+	force_quirk_on(trim_zero,	ATA_QUIRK_ZERO_AFTER_TRIM),
+	force_quirk_on(max_trim_128m,	ATA_QUIRK_MAX_TRIM_128M),
 
-	force_horkage_onoff(dma,	ATA_HORKAGE_NODMA),
-	force_horkage_on(atapi_dmadir,	ATA_HORKAGE_ATAPI_DMADIR),
-	force_horkage_on(atapi_mod16_dma, ATA_HORKAGE_ATAPI_MOD16_DMA),
+	force_quirk_onoff(dma,		ATA_QUIRK_NODMA),
+	force_quirk_on(atapi_dmadir,	ATA_QUIRK_ATAPI_DMADIR),
+	force_quirk_on(atapi_mod16_dma,	ATA_QUIRK_ATAPI_MOD16_DMA),
 
-	force_horkage_onoff(dmalog,	ATA_HORKAGE_NO_DMA_LOG),
-	force_horkage_onoff(iddevlog,	ATA_HORKAGE_NO_ID_DEV_LOG),
-	force_horkage_onoff(logdir,	ATA_HORKAGE_NO_LOG_DIR),
+	force_quirk_onoff(dmalog,	ATA_QUIRK_NO_DMA_LOG),
+	force_quirk_onoff(iddevlog,	ATA_QUIRK_NO_ID_DEV_LOG),
+	force_quirk_onoff(logdir,	ATA_QUIRK_NO_LOG_DIR),
 
-	force_horkage_on(max_sec_128,	ATA_HORKAGE_MAX_SEC_128),
-	force_horkage_on(max_sec_1024,	ATA_HORKAGE_MAX_SEC_1024),
-	force_horkage_on(max_sec_lba48,	ATA_HORKAGE_MAX_SEC_LBA48),
+	force_quirk_on(max_sec_128,	ATA_QUIRK_MAX_SEC_128),
+	force_quirk_on(max_sec_1024,	ATA_QUIRK_MAX_SEC_1024),
+	force_quirk_on(max_sec_lba48,	ATA_QUIRK_MAX_SEC_LBA48),
 
-	force_horkage_onoff(lpm,	ATA_HORKAGE_NOLPM),
-	force_horkage_onoff(setxfer,	ATA_HORKAGE_NOSETXFER),
-	force_horkage_on(dump_id,	ATA_HORKAGE_DUMP_ID),
-	force_horkage_onoff(fua,	ATA_HORKAGE_NO_FUA),
+	force_quirk_onoff(lpm,		ATA_QUIRK_NOLPM),
+	force_quirk_onoff(setxfer,	ATA_QUIRK_NOSETXFER),
+	force_quirk_on(dump_id,		ATA_QUIRK_DUMP_ID),
+	force_quirk_onoff(fua,		ATA_QUIRK_NO_FUA),
 
-	force_horkage_on(disable,	ATA_HORKAGE_DISABLE),
+	force_quirk_on(disable,		ATA_QUIRK_DISABLE),
 };
 
 static int __init ata_parse_force_one(char **cur,
diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
index 48660d445602..ecd37649d4d4 100644
--- a/drivers/ata/libata-sata.c
+++ b/drivers/ata/libata-sata.c
@@ -818,7 +818,7 @@ static ssize_t ata_scsi_lpm_store(struct device *device,
 
 	ata_for_each_link(link, ap, EDGE) {
 		ata_for_each_dev(dev, &ap->link, ENABLED) {
-			if (dev->horkage & ATA_HORKAGE_NOLPM) {
+			if (dev->quirks & ATA_QUIRK_NOLPM) {
 				count = -EOPNOTSUPP;
 				goto out_unlock;
 			}
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index d6f5e25e1ed8..3a442f564b0d 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2083,7 +2083,7 @@ static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf)
 	if (ata_id_has_trim(args->id)) {
 		u64 max_blocks = 65535 * ATA_MAX_TRIM_RNUM;
 
-		if (dev->horkage & ATA_HORKAGE_MAX_TRIM_128M)
+		if (dev->quirks & ATA_QUIRK_MAX_TRIM_128M)
 			max_blocks = 128 << (20 - SECTOR_SHIFT);
 
 		put_unaligned_be64(max_blocks, &rbuf[36]);
@@ -2561,11 +2561,11 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
 		rbuf[15] = lowest_aligned;
 
 		if (ata_id_has_trim(args->id) &&
-		    !(dev->horkage & ATA_HORKAGE_NOTRIM)) {
+		    !(dev->quirks & ATA_QUIRK_NOTRIM)) {
 			rbuf[14] |= 0x80; /* LBPME */
 
 			if (ata_id_has_zero_after_trim(args->id) &&
-			    dev->horkage & ATA_HORKAGE_ZERO_AFTER_TRIM) {
+			    dev->quirks & ATA_QUIRK_ZERO_AFTER_TRIM) {
 				ata_dev_info(dev, "Enabling discard_zeroes_data\n");
 				rbuf[14] |= 0x40; /* LBPRZ */
 			}
@@ -3229,8 +3229,7 @@ static unsigned int ata_scsi_write_same_xlat(struct ata_queued_cmd *qc)
 	}
 	scsi_16_lba_len(cdb, &block, &n_block);
 
-	if (!unmap ||
-	    (dev->horkage & ATA_HORKAGE_NOTRIM) ||
+	if (!unmap || (dev->quirks & ATA_QUIRK_NOTRIM) ||
 	    !ata_id_has_trim(dev->id)) {
 		fp = 1;
 		bp = 3;
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 250f7dae05fd..06868ec5b1fd 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -970,7 +970,7 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
 			 * We ignore ERR here to workaround and proceed sending
 			 * the CDB.
 			 */
-			if (!(qc->dev->horkage & ATA_HORKAGE_STUCK_ERR)) {
+			if (!(qc->dev->quirks & ATA_QUIRK_STUCK_ERR)) {
 				ata_ehi_push_desc(ehi, "ST_FIRST: "
 					"DRQ=1 with device error, "
 					"dev_stat 0x%X", status);
@@ -1045,8 +1045,8 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
 					 * IDENTIFY, it's likely a phantom
 					 * device.  Mark hint.
 					 */
-					if (qc->dev->horkage &
-					    ATA_HORKAGE_DIAGNOSTIC)
+					if (qc->dev->quirks &
+					    ATA_QUIRK_DIAGNOSTIC)
 						qc->err_mask |=
 							AC_ERR_NODEV_HINT;
 				} else {
@@ -1762,7 +1762,7 @@ unsigned int ata_sff_dev_classify(struct ata_device *dev, int present,
 	/* see if device passed diags: continue and warn later */
 	if (err == 0)
 		/* diagnostic fail : do nothing _YET_ */
-		dev->horkage |= ATA_HORKAGE_DIAGNOSTIC;
+		dev->quirks |= ATA_QUIRK_DIAGNOSTIC;
 	else if (err == 1)
 		/* do nothing */ ;
 	else if ((dev->devno == 0) && (err == 0x81))
@@ -1781,7 +1781,7 @@ unsigned int ata_sff_dev_classify(struct ata_device *dev, int present,
 		 * device signature is invalid with diagnostic
 		 * failure.
 		 */
-		if (present && (dev->horkage & ATA_HORKAGE_DIAGNOSTIC))
+		if (present && (dev->quirks & ATA_QUIRK_DIAGNOSTIC))
 			class = ATA_DEV_ATA;
 		else
 			class = ATA_DEV_NONE;
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
index 9e24c33388f9..48800cd0e75d 100644
--- a/drivers/ata/libata-transport.c
+++ b/drivers/ata/libata-transport.c
@@ -617,10 +617,10 @@ show_ata_dev_trim(struct device *dev,
 
 	if (!ata_id_has_trim(ata_dev->id))
 		mode = "unsupported";
-	else if (ata_dev->horkage & ATA_HORKAGE_NOTRIM)
+	else if (ata_dev->quirks & ATA_QUIRK_NOTRIM)
 		mode = "forced_unsupported";
-	else if (ata_dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM)
-			mode = "forced_unqueued";
+	else if (ata_dev->quirks & ATA_QUIRK_NO_NCQ_TRIM)
+		mode = "forced_unqueued";
 	else if (ata_fpdma_dsm_supported(ata_dev))
 		mode = "queued";
 	else
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 2fe3fb6102ce..042f6ad1f7c6 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -519,9 +519,9 @@ static void it821x_dev_config(struct ata_device *adev)
 	}
 	/* This is a controller firmware triggered funny, don't
 	   report the drive faulty! */
-	adev->horkage &= ~ATA_HORKAGE_DIAGNOSTIC;
+	adev->quirks &= ~ATA_QUIRK_DIAGNOSTIC;
 	/* No HPA in 'smart' mode */
-	adev->horkage |= ATA_HORKAGE_BROKEN_HPA;
+	adev->quirks |= ATA_QUIRK_BROKEN_HPA;
 }
 
 /**
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index cc77c0248284..354b68ef91bc 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -616,7 +616,7 @@ static void sil_dev_config(struct ata_device *dev)
 	unsigned char model_num[ATA_ID_PROD_LEN + 1];
 
 	/* This controller doesn't support trim */
-	dev->horkage |= ATA_HORKAGE_NOTRIM;
+	dev->quirks |= ATA_QUIRK_NOTRIM;
 
 	ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
 
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 17394098bee9..05dd7038ab30 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -362,40 +362,41 @@ enum {
 	 */
 	ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 8,
 
-	/* Horkage types. May be set by libata or controller on drives
-	   (some horkage may be drive/controller pair dependent */
-
-	ATA_HORKAGE_DIAGNOSTIC	= (1 << 0),	/* Failed boot diag */
-	ATA_HORKAGE_NODMA	= (1 << 1),	/* DMA problems */
-	ATA_HORKAGE_NONCQ	= (1 << 2),	/* Don't use NCQ */
-	ATA_HORKAGE_MAX_SEC_128	= (1 << 3),	/* Limit max sects to 128 */
-	ATA_HORKAGE_BROKEN_HPA	= (1 << 4),	/* Broken HPA */
-	ATA_HORKAGE_DISABLE	= (1 << 5),	/* Disable it */
-	ATA_HORKAGE_HPA_SIZE	= (1 << 6),	/* native size off by one */
-	ATA_HORKAGE_IVB		= (1 << 8),	/* cbl det validity bit bugs */
-	ATA_HORKAGE_STUCK_ERR	= (1 << 9),	/* stuck ERR on next PACKET */
-	ATA_HORKAGE_BRIDGE_OK	= (1 << 10),	/* no bridge limits */
-	ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands
-						    not multiple of 16 bytes */
-	ATA_HORKAGE_FIRMWARE_WARN = (1 << 12),	/* firmware update warning */
-	ATA_HORKAGE_1_5_GBPS	= (1 << 13),	/* force 1.5 Gbps */
-	ATA_HORKAGE_NOSETXFER	= (1 << 14),	/* skip SETXFER, SATA only */
-	ATA_HORKAGE_BROKEN_FPDMA_AA	= (1 << 15),	/* skip AA */
-	ATA_HORKAGE_DUMP_ID	= (1 << 16),	/* dump IDENTIFY data */
-	ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17),	/* Set max sects to 65535 */
-	ATA_HORKAGE_ATAPI_DMADIR = (1 << 18),	/* device requires dmadir */
-	ATA_HORKAGE_NO_NCQ_TRIM	= (1 << 19),	/* don't use queued TRIM */
-	ATA_HORKAGE_NOLPM	= (1 << 20),	/* don't use LPM */
-	ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21),	/* some WDs have broken LPM */
-	ATA_HORKAGE_ZERO_AFTER_TRIM = (1 << 22),/* guarantees zero after trim */
-	ATA_HORKAGE_NO_DMA_LOG	= (1 << 23),	/* don't use DMA for log read */
-	ATA_HORKAGE_NOTRIM	= (1 << 24),	/* don't use TRIM */
-	ATA_HORKAGE_MAX_SEC_1024 = (1 << 25),	/* Limit max sects to 1024 */
-	ATA_HORKAGE_MAX_TRIM_128M = (1 << 26),	/* Limit max trim size to 128M */
-	ATA_HORKAGE_NO_NCQ_ON_ATI = (1 << 27),	/* Disable NCQ on ATI chipset */
-	ATA_HORKAGE_NO_ID_DEV_LOG = (1 << 28),	/* Identify device log missing */
-	ATA_HORKAGE_NO_LOG_DIR	= (1 << 29),	/* Do not read log directory */
-	ATA_HORKAGE_NO_FUA	= (1 << 30),	/* Do not use FUA */
+	/*
+	 * Quirk flags: may be set by libata or controller drivers on drives.
+	 * Some quirks may be drive/controller pair dependent.
+	 */
+	ATA_QUIRK_DIAGNOSTIC	= (1 << 0),	/* Failed boot diag */
+	ATA_QUIRK_NODMA		= (1 << 1),	/* DMA problems */
+	ATA_QUIRK_NONCQ		= (1 << 2),	/* Do not use NCQ */
+	ATA_QUIRK_MAX_SEC_128	= (1 << 3),	/* Limit max sects to 128 */
+	ATA_QUIRK_BROKEN_HPA	= (1 << 4),	/* Broken HPA */
+	ATA_QUIRK_DISABLE	= (1 << 5),	/* Disable it */
+	ATA_QUIRK_HPA_SIZE	= (1 << 6),	/* Native size off by one */
+	ATA_QUIRK_IVB		= (1 << 8),	/* CBL det validity bit bugs */
+	ATA_QUIRK_STUCK_ERR	= (1 << 9),	/* Stuck ERR on next PACKET */
+	ATA_QUIRK_BRIDGE_OK	= (1 << 10),	/* No bridge limits */
+	ATA_QUIRK_ATAPI_MOD16_DMA = (1 << 11),	/* Use ATAPI DMA for commands */
+						/* not multiple of 16 bytes */
+	ATA_QUIRK_FIRMWARE_WARN = (1 << 12),	/* Firmware update warning */
+	ATA_QUIRK_1_5_GBPS	= (1 << 13),	/* Force 1.5 Gbps */
+	ATA_QUIRK_NOSETXFER	= (1 << 14),	/* Skip SETXFER, SATA only */
+	ATA_QUIRK_BROKEN_FPDMA_AA = (1 << 15),	/* Skip AA */
+	ATA_QUIRK_DUMP_ID	= (1 << 16),	/* Dump IDENTIFY data */
+	ATA_QUIRK_MAX_SEC_LBA48 = (1 << 17),	/* Set max sects to 65535 */
+	ATA_QUIRK_ATAPI_DMADIR	= (1 << 18),	/* Device requires dmadir */
+	ATA_QUIRK_NO_NCQ_TRIM	= (1 << 19),	/* Do not use queued TRIM */
+	ATA_QUIRK_NOLPM		= (1 << 20),	/* Do not use LPM */
+	ATA_QUIRK_WD_BROKEN_LPM = (1 << 21),	/* Some WDs have broken LPM */
+	ATA_QUIRK_ZERO_AFTER_TRIM = (1 << 22),	/* Guarantees zero after trim */
+	ATA_QUIRK_NO_DMA_LOG	= (1 << 23),	/* Do not use DMA for log read */
+	ATA_QUIRK_NOTRIM	= (1 << 24),	/* Do not use TRIM */
+	ATA_QUIRK_MAX_SEC_1024	= (1 << 25),	/* Limit max sects to 1024 */
+	ATA_QUIRK_MAX_TRIM_128M = (1 << 26),	/* Limit max trim size to 128M */
+	ATA_QUIRK_NO_NCQ_ON_ATI = (1 << 27),	/* Disable NCQ on ATI chipset */
+	ATA_QUIRK_NO_ID_DEV_LOG = (1 << 28),	/* Identify device log missing */
+	ATA_QUIRK_NO_LOG_DIR	= (1 << 29),	/* Do not read log directory */
+	ATA_QUIRK_NO_FUA	= (1 << 30),	/* Do not use FUA */
 
 	 /* DMA mask for user DMA control: User visible values; DO NOT
 	    renumber */
@@ -663,7 +664,7 @@ struct ata_cpr_log {
 struct ata_device {
 	struct ata_link		*link;
 	unsigned int		devno;		/* 0 or 1 */
-	unsigned int		horkage;	/* List of broken features */
+	unsigned int		quirks;		/* List of broken features */
 	unsigned long		flags;		/* ATA_DFLAG_xxx */
 	struct scsi_device	*sdev;		/* attached SCSI device */
 	void			*private_data;
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v6 04/11] ata: libata: Print quirks applied to devices
  2024-07-26  3:19 [PATCH v6 0/4] Some cleanup, renaming and horkage improvements Damien Le Moal
                   ` (2 preceding siblings ...)
  2024-07-26  3:19 ` [PATCH v6 03/11] ata: libata: Use QUIRK instead of HORKAGE Damien Le Moal
@ 2024-07-26  3:19 ` Damien Le Moal
  2024-07-26 10:47   ` Niklas Cassel
  2024-07-30 10:09   ` Geert Uytterhoeven
  2024-07-26  3:19 ` [PATCH v6 05/11] ata: pata_serverworks: Do not use the term blacklist Damien Le Moal
                   ` (6 subsequent siblings)
  10 siblings, 2 replies; 39+ messages in thread
From: Damien Le Moal @ 2024-07-26  3:19 UTC (permalink / raw)
  To: linux-ide, Niklas Cassel

Introduce the function ata_dev_print_quirks() to print the quirk flags
that will be applied to a scanned device. This new function is called
from ata_dev_quirks() when a match on a device model or device model
and revision is found for a device in the __ata_dev_quirks array.

To implement this function, the ATA_QUIRK_ flags are redefined using
the new enum ata_quirk which defines the bit shift for each quirk
flag. The array of strings ata_quirk_names is used to define the name
of each flag, which are printed by ata_dev_print_quirks().

Example output for a device listed in the __ata_dev_quirks array and
which has the ATA_QUIRK_DISABLE flag applied:

[10193.461270] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[10193.469190] ata1.00: Model 'ASMT109x- Config', rev '2143 5', applying quirks: disable
[10193.469195] ata1.00: unsupported device, disabling
[10193.481564] ata1.00: disable device

enum ata_quirk also defines the __ATA_QUIRK_MAX value as one plus the
last quirk flag defined. This value is used in ata_dev_quirks() to add a
build time check that all quirk flags fit within the unsigned int
(32-bits) quirks field of struct ata_device.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
---
 drivers/ata/libata-core.c |  76 +++++++++++++++++++++++++--
 include/linux/libata.h    | 106 ++++++++++++++++++++++++++------------
 2 files changed, 143 insertions(+), 39 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 19b041bd7588..fc9fcfda42b8 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3988,6 +3988,69 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
 	return rc;
 }
 
+static const char * const ata_quirk_names[] = {
+	[__ATA_QUIRK_DIAGNOSTIC]	= "diagnostic",
+	[__ATA_QUIRK_NODMA]		= "nodma",
+	[__ATA_QUIRK_NONCQ]		= "noncq",
+	[__ATA_QUIRK_MAX_SEC_128]	= "maxsec128",
+	[__ATA_QUIRK_BROKEN_HPA]	= "brokenhpa",
+	[__ATA_QUIRK_DISABLE]		= "disable",
+	[__ATA_QUIRK_HPA_SIZE]		= "hpasize",
+	[__ATA_QUIRK_IVB]		= "ivb",
+	[__ATA_QUIRK_STUCK_ERR]		= "stuckerr",
+	[__ATA_QUIRK_BRIDGE_OK]		= "bridgeok",
+	[__ATA_QUIRK_ATAPI_MOD16_DMA]	= "atapimod16dma",
+	[__ATA_QUIRK_FIRMWARE_WARN]	= "firmwarewarn",
+	[__ATA_QUIRK_1_5_GBPS]		= "1.5gbps",
+	[__ATA_QUIRK_NOSETXFER]		= "nosetxfer",
+	[__ATA_QUIRK_BROKEN_FPDMA_AA]	= "brokenfpdmaaa",
+	[__ATA_QUIRK_DUMP_ID]		= "dumpid",
+	[__ATA_QUIRK_MAX_SEC_LBA48]	= "maxseclba48",
+	[__ATA_QUIRK_ATAPI_DMADIR]	= "atapidmadir",
+	[__ATA_QUIRK_NO_NCQ_TRIM]	= "noncqtrim",
+	[__ATA_QUIRK_NOLPM]		= "nolpm",
+	[__ATA_QUIRK_WD_BROKEN_LPM]	= "wdbrokenlpm",
+	[__ATA_QUIRK_ZERO_AFTER_TRIM]	= "zeroaftertrim",
+	[__ATA_QUIRK_NO_DMA_LOG]	= "nodmalog",
+	[__ATA_QUIRK_NOTRIM]		= "notrim",
+	[__ATA_QUIRK_MAX_SEC_1024]	= "maxsec1024",
+	[__ATA_QUIRK_MAX_TRIM_128M]	= "maxtrim128m",
+	[__ATA_QUIRK_NO_NCQ_ON_ATI]	= "noncqonati",
+	[__ATA_QUIRK_NO_ID_DEV_LOG]	= "noiddevlog",
+	[__ATA_QUIRK_NO_LOG_DIR]	= "nologdir",
+	[__ATA_QUIRK_NO_FUA]		= "nofua",
+};
+
+static void ata_dev_print_quirks(const struct ata_device *dev,
+				 const char *model, const char *rev,
+				 unsigned int quirks)
+{
+	int n = 0, i;
+	size_t sz;
+	char *str;
+
+	if (!quirks)
+		return;
+
+	sz = 64 + ARRAY_SIZE(ata_quirk_names) * 16;
+	str = kmalloc(sz, GFP_KERNEL);
+	if (!str)
+		return;
+
+	n = snprintf(str, sz, "Model '%s', rev '%s', applying quirks:",
+		     model, rev);
+
+	for (i = 0; i < ARRAY_SIZE(ata_quirk_names); i++) {
+		if (quirks & (1U << i))
+			n += snprintf(str + n, sz - n,
+				      " %s", ata_quirk_names[i]);
+	}
+
+	ata_dev_warn(dev, "%s\n", str);
+
+	kfree(str);
+}
+
 struct ata_dev_quirks_entry {
 	const char *model_num;
 	const char *model_rev;
@@ -4273,15 +4336,18 @@ static unsigned int ata_dev_quirks(const struct ata_device *dev)
 	unsigned char model_rev[ATA_ID_FW_REV_LEN + 1];
 	const struct ata_dev_quirks_entry *ad = __ata_dev_quirks;
 
+	/* dev->quirks is an unsigned int. */
+	BUILD_BUG_ON(__ATA_QUIRK_MAX > 32);
+
 	ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
 	ata_id_c_string(dev->id, model_rev, ATA_ID_FW_REV, sizeof(model_rev));
 
 	while (ad->model_num) {
-		if (glob_match(ad->model_num, model_num)) {
-			if (ad->model_rev == NULL)
-				return ad->quirks;
-			if (glob_match(ad->model_rev, model_rev))
-				return ad->quirks;
+		if (glob_match(ad->model_num, model_num) &&
+		    (!ad->model_rev || glob_match(ad->model_rev, model_rev))) {
+			ata_dev_print_quirks(dev, model_num, model_rev,
+					     ad->quirks);
+			return ad->quirks;
 		}
 		ad++;
 	}
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 05dd7038ab30..d598ef690e50 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -55,6 +55,46 @@
 /* defines only for the constants which don't work well as enums */
 #define ATA_TAG_POISON		0xfafbfcfdU
 
+/*
+ * Quirk flags bits.
+ * ata_device->quirks is an unsigned int, so __ATA_QUIRK_MAX must not exceed 32.
+ */
+enum ata_quirks {
+	__ATA_QUIRK_DIAGNOSTIC,		/* Failed boot diag */
+	__ATA_QUIRK_NODMA,		/* DMA problems */
+	__ATA_QUIRK_NONCQ,		/* Don't use NCQ */
+	__ATA_QUIRK_MAX_SEC_128,	/* Limit max sects to 128 */
+	__ATA_QUIRK_BROKEN_HPA,		/* Broken HPA */
+	__ATA_QUIRK_DISABLE,		/* Disable it */
+	__ATA_QUIRK_HPA_SIZE,		/* Native size off by one */
+	__ATA_QUIRK_IVB,		/* cbl det validity bit bugs */
+	__ATA_QUIRK_STUCK_ERR,		/* Stuck ERR on next PACKET */
+	__ATA_QUIRK_BRIDGE_OK,		/* No bridge limits */
+	__ATA_QUIRK_ATAPI_MOD16_DMA,	/* Use ATAPI DMA for commands that */
+					/* are not a multiple of 16 bytes */
+	__ATA_QUIRK_FIRMWARE_WARN,	/* Firmware update warning */
+	__ATA_QUIRK_1_5_GBPS,		/* Force 1.5 Gbps */
+	__ATA_QUIRK_NOSETXFER,		/* Skip SETXFER, SATA only */
+	__ATA_QUIRK_BROKEN_FPDMA_AA,	/* Skip AA */
+	__ATA_QUIRK_DUMP_ID,		/* Dump IDENTIFY data */
+	__ATA_QUIRK_MAX_SEC_LBA48,	/* Set max sects to 65535 */
+	__ATA_QUIRK_ATAPI_DMADIR,	/* Device requires dmadir */
+	__ATA_QUIRK_NO_NCQ_TRIM,	/* Do not use queued TRIM */
+	__ATA_QUIRK_NOLPM,		/* Do not use LPM */
+	__ATA_QUIRK_WD_BROKEN_LPM,	/* Some WDs have broken LPM */
+	__ATA_QUIRK_ZERO_AFTER_TRIM,	/* Guarantees zero after trim */
+	__ATA_QUIRK_NO_DMA_LOG,		/* Do not use DMA for log read */
+	__ATA_QUIRK_NOTRIM,		/* Do not use TRIM */
+	__ATA_QUIRK_MAX_SEC_1024,	/* Limit max sects to 1024 */
+	__ATA_QUIRK_MAX_TRIM_128M,	/* Limit max trim size to 128M */
+	__ATA_QUIRK_NO_NCQ_ON_ATI,	/* Disable NCQ on ATI chipset */
+	__ATA_QUIRK_NO_ID_DEV_LOG,	/* Identify device log missing */
+	__ATA_QUIRK_NO_LOG_DIR,		/* Do not read log directory */
+	__ATA_QUIRK_NO_FUA,		/* Do not use FUA */
+
+	__ATA_QUIRK_MAX,
+};
+
 enum {
 	/* various global constants */
 	LIBATA_MAX_PRD		= ATA_MAX_PRD / 2,
@@ -366,40 +406,38 @@ enum {
 	 * Quirk flags: may be set by libata or controller drivers on drives.
 	 * Some quirks may be drive/controller pair dependent.
 	 */
-	ATA_QUIRK_DIAGNOSTIC	= (1 << 0),	/* Failed boot diag */
-	ATA_QUIRK_NODMA		= (1 << 1),	/* DMA problems */
-	ATA_QUIRK_NONCQ		= (1 << 2),	/* Do not use NCQ */
-	ATA_QUIRK_MAX_SEC_128	= (1 << 3),	/* Limit max sects to 128 */
-	ATA_QUIRK_BROKEN_HPA	= (1 << 4),	/* Broken HPA */
-	ATA_QUIRK_DISABLE	= (1 << 5),	/* Disable it */
-	ATA_QUIRK_HPA_SIZE	= (1 << 6),	/* Native size off by one */
-	ATA_QUIRK_IVB		= (1 << 8),	/* CBL det validity bit bugs */
-	ATA_QUIRK_STUCK_ERR	= (1 << 9),	/* Stuck ERR on next PACKET */
-	ATA_QUIRK_BRIDGE_OK	= (1 << 10),	/* No bridge limits */
-	ATA_QUIRK_ATAPI_MOD16_DMA = (1 << 11),	/* Use ATAPI DMA for commands */
-						/* not multiple of 16 bytes */
-	ATA_QUIRK_FIRMWARE_WARN = (1 << 12),	/* Firmware update warning */
-	ATA_QUIRK_1_5_GBPS	= (1 << 13),	/* Force 1.5 Gbps */
-	ATA_QUIRK_NOSETXFER	= (1 << 14),	/* Skip SETXFER, SATA only */
-	ATA_QUIRK_BROKEN_FPDMA_AA = (1 << 15),	/* Skip AA */
-	ATA_QUIRK_DUMP_ID	= (1 << 16),	/* Dump IDENTIFY data */
-	ATA_QUIRK_MAX_SEC_LBA48 = (1 << 17),	/* Set max sects to 65535 */
-	ATA_QUIRK_ATAPI_DMADIR	= (1 << 18),	/* Device requires dmadir */
-	ATA_QUIRK_NO_NCQ_TRIM	= (1 << 19),	/* Do not use queued TRIM */
-	ATA_QUIRK_NOLPM		= (1 << 20),	/* Do not use LPM */
-	ATA_QUIRK_WD_BROKEN_LPM = (1 << 21),	/* Some WDs have broken LPM */
-	ATA_QUIRK_ZERO_AFTER_TRIM = (1 << 22),	/* Guarantees zero after trim */
-	ATA_QUIRK_NO_DMA_LOG	= (1 << 23),	/* Do not use DMA for log read */
-	ATA_QUIRK_NOTRIM	= (1 << 24),	/* Do not use TRIM */
-	ATA_QUIRK_MAX_SEC_1024	= (1 << 25),	/* Limit max sects to 1024 */
-	ATA_QUIRK_MAX_TRIM_128M = (1 << 26),	/* Limit max trim size to 128M */
-	ATA_QUIRK_NO_NCQ_ON_ATI = (1 << 27),	/* Disable NCQ on ATI chipset */
-	ATA_QUIRK_NO_ID_DEV_LOG = (1 << 28),	/* Identify device log missing */
-	ATA_QUIRK_NO_LOG_DIR	= (1 << 29),	/* Do not read log directory */
-	ATA_QUIRK_NO_FUA	= (1 << 30),	/* Do not use FUA */
-
-	 /* DMA mask for user DMA control: User visible values; DO NOT
-	    renumber */
+	ATA_QUIRK_DIAGNOSTIC		= (1U << __ATA_QUIRK_DIAGNOSTIC),
+	ATA_QUIRK_NODMA			= (1U << __ATA_QUIRK_NODMA),
+	ATA_QUIRK_NONCQ			= (1U << __ATA_QUIRK_NONCQ),
+	ATA_QUIRK_MAX_SEC_128		= (1U << __ATA_QUIRK_MAX_SEC_128),
+	ATA_QUIRK_BROKEN_HPA		= (1U << __ATA_QUIRK_BROKEN_HPA),
+	ATA_QUIRK_DISABLE		= (1U << __ATA_QUIRK_DISABLE),
+	ATA_QUIRK_HPA_SIZE		= (1U << __ATA_QUIRK_HPA_SIZE),
+	ATA_QUIRK_IVB			= (1U << __ATA_QUIRK_IVB),
+	ATA_QUIRK_STUCK_ERR		= (1U << __ATA_QUIRK_STUCK_ERR),
+	ATA_QUIRK_BRIDGE_OK		= (1U << __ATA_QUIRK_BRIDGE_OK),
+	ATA_QUIRK_ATAPI_MOD16_DMA	= (1U << __ATA_QUIRK_ATAPI_MOD16_DMA),
+	ATA_QUIRK_FIRMWARE_WARN		= (1U << __ATA_QUIRK_FIRMWARE_WARN),
+	ATA_QUIRK_1_5_GBPS		= (1U << __ATA_QUIRK_1_5_GBPS),
+	ATA_QUIRK_NOSETXFER		= (1U << __ATA_QUIRK_NOSETXFER),
+	ATA_QUIRK_BROKEN_FPDMA_AA	= (1U << __ATA_QUIRK_BROKEN_FPDMA_AA),
+	ATA_QUIRK_DUMP_ID		= (1U << __ATA_QUIRK_DUMP_ID),
+	ATA_QUIRK_MAX_SEC_LBA48		= (1U << __ATA_QUIRK_MAX_SEC_LBA48),
+	ATA_QUIRK_ATAPI_DMADIR		= (1U << __ATA_QUIRK_ATAPI_DMADIR),
+	ATA_QUIRK_NO_NCQ_TRIM		= (1U << __ATA_QUIRK_NO_NCQ_TRIM),
+	ATA_QUIRK_NOLPM			= (1U << __ATA_QUIRK_NOLPM),
+	ATA_QUIRK_WD_BROKEN_LPM		= (1U << __ATA_QUIRK_WD_BROKEN_LPM),
+	ATA_QUIRK_ZERO_AFTER_TRIM	= (1U << __ATA_QUIRK_ZERO_AFTER_TRIM),
+	ATA_QUIRK_NO_DMA_LOG		= (1U << __ATA_QUIRK_NO_DMA_LOG),
+	ATA_QUIRK_NOTRIM		= (1U << __ATA_QUIRK_NOTRIM),
+	ATA_QUIRK_MAX_SEC_1024		= (1U << __ATA_QUIRK_MAX_SEC_1024),
+	ATA_QUIRK_MAX_TRIM_128M		= (1U << __ATA_QUIRK_MAX_TRIM_128M),
+	ATA_QUIRK_NO_NCQ_ON_ATI		= (1U << __ATA_QUIRK_NO_NCQ_ON_ATI),
+	ATA_QUIRK_NO_ID_DEV_LOG		= (1U << __ATA_QUIRK_NO_ID_DEV_LOG),
+	ATA_QUIRK_NO_LOG_DIR		= (1U << __ATA_QUIRK_NO_LOG_DIR),
+	ATA_QUIRK_NO_FUA		= (1U << __ATA_QUIRK_NO_FUA),
+
+	/* User visible DMA mask for DMA control. DO NOT renumber. */
 	ATA_DMA_MASK_ATA	= (1 << 0),	/* DMA on ATA Disk */
 	ATA_DMA_MASK_ATAPI	= (1 << 1),	/* DMA on ATAPI */
 	ATA_DMA_MASK_CFA	= (1 << 2),	/* DMA on CF Card */
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v6 05/11] ata: pata_serverworks: Do not use the term blacklist
  2024-07-26  3:19 [PATCH v6 0/4] Some cleanup, renaming and horkage improvements Damien Le Moal
                   ` (3 preceding siblings ...)
  2024-07-26  3:19 ` [PATCH v6 04/11] ata: libata: Print quirks applied to devices Damien Le Moal
@ 2024-07-26  3:19 ` Damien Le Moal
  2024-07-26 11:12   ` Niklas Cassel
  2024-07-29 18:43   ` Igor Pylypiv
  2024-07-26  3:19 ` [PATCH v6 06/11] ata: ahci: Rephrase comment to " Damien Le Moal
                   ` (5 subsequent siblings)
  10 siblings, 2 replies; 39+ messages in thread
From: Damien Le Moal @ 2024-07-26  3:19 UTC (permalink / raw)
  To: linux-ide, Niklas Cassel

Let's not use the term blacklist in the function
serverworks_osb4_filter() documentation comment and rather simply refer
to what that function looks at: the list of devices with groken UDMA5.

While at it, also constify the values of the csb_bad_ata100 array.

Of note is that all of this should probably be handled using libata
quirk mechanism but it is unclear if these UDMA5 quirks are specific
to this controller only.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 drivers/ata/pata_serverworks.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
index 549ff24a9823..4edddf6bcc15 100644
--- a/drivers/ata/pata_serverworks.c
+++ b/drivers/ata/pata_serverworks.c
@@ -46,10 +46,11 @@
 #define SVWKS_CSB5_REVISION_NEW	0x92 /* min PCI_REVISION_ID for UDMA5 (A2.0) */
 #define SVWKS_CSB6_REVISION	0xa0 /* min PCI_REVISION_ID for UDMA4 (A1.0) */
 
-/* Seagate Barracuda ATA IV Family drives in UDMA mode 5
- * can overrun their FIFOs when used with the CSB5 */
-
-static const char *csb_bad_ata100[] = {
+/*
+ * Seagate Barracuda ATA IV Family drives in UDMA mode 5
+ * can overrun their FIFOs when used with the CSB5.
+ */
+static const char * const csb_bad_ata100[] = {
 	"ST320011A",
 	"ST340016A",
 	"ST360021A",
@@ -163,10 +164,11 @@ static unsigned int serverworks_osb4_filter(struct ata_device *adev, unsigned in
  *	@adev: ATA device
  *	@mask: Mask of proposed modes
  *
- *	Check the blacklist and disable UDMA5 if matched
+ *	Check the list of devices with broken UDMA5 and
+ *	disable UDMA5 if matched.
  */
-
-static unsigned int serverworks_csb_filter(struct ata_device *adev, unsigned int mask)
+static unsigned int serverworks_csb_filter(struct ata_device *adev,
+					   unsigned int mask)
 {
 	const char *p;
 	char model_num[ATA_ID_PROD_LEN + 1];
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v6 06/11] ata: ahci: Rephrase comment to not use the term blacklist
  2024-07-26  3:19 [PATCH v6 0/4] Some cleanup, renaming and horkage improvements Damien Le Moal
                   ` (4 preceding siblings ...)
  2024-07-26  3:19 ` [PATCH v6 05/11] ata: pata_serverworks: Do not use the term blacklist Damien Le Moal
@ 2024-07-26  3:19 ` Damien Le Moal
  2024-07-26 10:57   ` Niklas Cassel
  2024-07-29 18:43   ` Igor Pylypiv
  2024-07-26  3:19 ` [PATCH v6 07/11] ata: sata_sil: Rename sil_blacklist to sil_quirks Damien Le Moal
                   ` (4 subsequent siblings)
  10 siblings, 2 replies; 39+ messages in thread
From: Damien Le Moal @ 2024-07-26  3:19 UTC (permalink / raw)
  To: linux-ide, Niklas Cassel

Rephrase the comment for the eMachines entry in the sysids array of
ahci_broken_suspend() to not use the term blacklist.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 drivers/ata/ahci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index a05c17249448..45f63b09828a 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1370,7 +1370,7 @@ static bool ahci_broken_suspend(struct pci_dev *pdev)
 		 * V1.03 is known to be broken.  V3.04 is known to
 		 * work.  Between, there are V1.06, V2.06 and V3.03
 		 * that we don't have much idea about.  For now,
-		 * blacklist anything older than V3.04.
+		 * assume that anything older than V3.04 is broken.
 		 *
 		 * http://bugzilla.kernel.org/show_bug.cgi?id=15104
 		 */
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v6 07/11] ata: sata_sil: Rename sil_blacklist to sil_quirks
  2024-07-26  3:19 [PATCH v6 0/4] Some cleanup, renaming and horkage improvements Damien Le Moal
                   ` (5 preceding siblings ...)
  2024-07-26  3:19 ` [PATCH v6 06/11] ata: ahci: Rephrase comment to " Damien Le Moal
@ 2024-07-26  3:19 ` Damien Le Moal
  2024-07-26 11:13   ` Niklas Cassel
  2024-07-29 18:44   ` Igor Pylypiv
  2024-07-26  3:19 ` [PATCH v6 08/11] ata: ata_piix: Remove useless comment in piix_init_sidpr() Damien Le Moal
                   ` (3 subsequent siblings)
  10 siblings, 2 replies; 39+ messages in thread
From: Damien Le Moal @ 2024-07-26  3:19 UTC (permalink / raw)
  To: linux-ide, Niklas Cassel

Rename the array sil_blacklist to sil_quirks as this name is more
neutral and is also consistent with how this driver define quirks with
the SIL_QUIRK_XXX flags.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 drivers/ata/sata_sil.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 354b68ef91bc..3a99f66198a9 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -128,7 +128,7 @@ static const struct pci_device_id sil_pci_tbl[] = {
 static const struct sil_drivelist {
 	const char *product;
 	unsigned int quirk;
-} sil_blacklist [] = {
+} sil_quirks[] = {
 	{ "ST320012AS",		SIL_QUIRK_MOD15WRITE },
 	{ "ST330013AS",		SIL_QUIRK_MOD15WRITE },
 	{ "ST340017AS",		SIL_QUIRK_MOD15WRITE },
@@ -600,8 +600,8 @@ static void sil_thaw(struct ata_port *ap)
  *	list, and apply the fixups to only the specific
  *	devices/hosts/firmwares that need it.
  *
- *	20040111 - Seagate drives affected by the Mod15Write bug are blacklisted
- *	The Maxtor quirk is in the blacklist, but I'm keeping the original
+ *	20040111 - Seagate drives affected by the Mod15Write bug are quirked
+ *	The Maxtor quirk is in sil_quirks, but I'm keeping the original
  *	pessimistic fix for the following reasons...
  *	- There seems to be less info on it, only one device gleaned off the
  *	Windows	driver, maybe only one is affected.  More info would be greatly
@@ -620,9 +620,9 @@ static void sil_dev_config(struct ata_device *dev)
 
 	ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
 
-	for (n = 0; sil_blacklist[n].product; n++)
-		if (!strcmp(sil_blacklist[n].product, model_num)) {
-			quirks = sil_blacklist[n].quirk;
+	for (n = 0; sil_quirks[n].product; n++)
+		if (!strcmp(sil_quirks[n].product, model_num)) {
+			quirks = sil_quirks[n].quirk;
 			break;
 		}
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v6 08/11] ata: ata_piix: Remove useless comment in piix_init_sidpr()
  2024-07-26  3:19 [PATCH v6 0/4] Some cleanup, renaming and horkage improvements Damien Le Moal
                   ` (6 preceding siblings ...)
  2024-07-26  3:19 ` [PATCH v6 07/11] ata: sata_sil: Rename sil_blacklist to sil_quirks Damien Le Moal
@ 2024-07-26  3:19 ` Damien Le Moal
  2024-07-26 11:13   ` Niklas Cassel
  2024-07-29 18:45   ` Igor Pylypiv
  2024-07-26  3:19 ` [PATCH v6 09/11] ata: pata_cs5520: Rephrase file header comment Damien Le Moal
                   ` (2 subsequent siblings)
  10 siblings, 2 replies; 39+ messages in thread
From: Damien Le Moal @ 2024-07-26  3:19 UTC (permalink / raw)
  To: linux-ide, Niklas Cassel

Remove the comment using the term "blacklist" from piix_init_sidpr().
That comment is useless given that the function piix_no_sidpr() name is
clear about what is being checked.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 drivers/ata/ata_piix.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index ec3c5bd1f813..093b940bc953 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -1446,7 +1446,6 @@ static int piix_init_sidpr(struct ata_host *host)
 		if (hpriv->map[i] == IDE)
 			return 0;
 
-	/* is it blacklisted? */
 	if (piix_no_sidpr(host))
 		return 0;
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v6 09/11] ata: pata_cs5520: Rephrase file header comment
  2024-07-26  3:19 [PATCH v6 0/4] Some cleanup, renaming and horkage improvements Damien Le Moal
                   ` (7 preceding siblings ...)
  2024-07-26  3:19 ` [PATCH v6 08/11] ata: ata_piix: Remove useless comment in piix_init_sidpr() Damien Le Moal
@ 2024-07-26  3:19 ` Damien Le Moal
  2024-07-26 11:13   ` Niklas Cassel
  2024-07-29 18:45   ` Igor Pylypiv
  2024-07-26  3:19 ` [PATCH v6 10/11] ata: pata_hpt366: Rename hpt_dma_blacklisted() Damien Le Moal
  2024-07-26  3:19 ` [PATCH v6 11/11] ata: pata_hpt37x: " Damien Le Moal
  10 siblings, 2 replies; 39+ messages in thread
From: Damien Le Moal @ 2024-07-26  3:19 UTC (permalink / raw)
  To: linux-ide, Niklas Cassel

Remove the use of the term "blacklist". What the comment using that term
refers to does not seem to exist at all anyway as the driver does not
have such list but rather only a list of compatible controllers.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 drivers/ata/pata_cs5520.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index 027cf67101ef..3163c8d9cef5 100644
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -8,9 +8,9 @@
  *	PIO mode and smarter silicon.
  *
  *	The practical upshot of this is that we must always tune the
- *	drive for the right PIO mode. We must also ignore all the blacklists
- *	and the drive bus mastering DMA information. Also to confuse matters
- *	further we can do DMA on PIO only drives.
+ *	drive for the right PIO mode and ignore the drive bus mastering DMA
+ *	information. Also to confuse matters further we can do DMA on PIO only
+ *	drives.
  *
  *	DMA on the 5510 also requires we disable_hlt() during DMA on early
  *	revisions.
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v6 10/11] ata: pata_hpt366: Rename hpt_dma_blacklisted()
  2024-07-26  3:19 [PATCH v6 0/4] Some cleanup, renaming and horkage improvements Damien Le Moal
                   ` (8 preceding siblings ...)
  2024-07-26  3:19 ` [PATCH v6 09/11] ata: pata_cs5520: Rephrase file header comment Damien Le Moal
@ 2024-07-26  3:19 ` Damien Le Moal
  2024-07-26 11:13   ` Niklas Cassel
  2024-07-29 18:46   ` Igor Pylypiv
  2024-07-26  3:19 ` [PATCH v6 11/11] ata: pata_hpt37x: " Damien Le Moal
  10 siblings, 2 replies; 39+ messages in thread
From: Damien Le Moal @ 2024-07-26  3:19 UTC (permalink / raw)
  To: linux-ide, Niklas Cassel

Rename the function hpt_dma_blacklisted() to the more neutral
hpt_dma_broken().

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 drivers/ata/pata_hpt366.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
index bdccd1ba1524..5280e9960025 100644
--- a/drivers/ata/pata_hpt366.c
+++ b/drivers/ata/pata_hpt366.c
@@ -170,8 +170,8 @@ static const char * const bad_ata66_3[] = {
 	NULL
 };
 
-static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr,
-			       const char * const list[])
+static int hpt_dma_broken(const struct ata_device *dev, char *modestr,
+			  const char * const list[])
 {
 	unsigned char model_num[ATA_ID_PROD_LEN + 1];
 	int i;
@@ -197,11 +197,11 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr,
 static unsigned int hpt366_filter(struct ata_device *adev, unsigned int mask)
 {
 	if (adev->class == ATA_DEV_ATA) {
-		if (hpt_dma_blacklisted(adev, "UDMA",  bad_ata33))
+		if (hpt_dma_broken(adev, "UDMA",  bad_ata33))
 			mask &= ~ATA_MASK_UDMA;
-		if (hpt_dma_blacklisted(adev, "UDMA3", bad_ata66_3))
+		if (hpt_dma_broken(adev, "UDMA3", bad_ata66_3))
 			mask &= ~(0xF8 << ATA_SHIFT_UDMA);
-		if (hpt_dma_blacklisted(adev, "UDMA4", bad_ata66_4))
+		if (hpt_dma_broken(adev, "UDMA4", bad_ata66_4))
 			mask &= ~(0xF0 << ATA_SHIFT_UDMA);
 	} else if (adev->class == ATA_DEV_ATAPI)
 		mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH v6 11/11] ata: pata_hpt37x: Rename hpt_dma_blacklisted()
  2024-07-26  3:19 [PATCH v6 0/4] Some cleanup, renaming and horkage improvements Damien Le Moal
                   ` (9 preceding siblings ...)
  2024-07-26  3:19 ` [PATCH v6 10/11] ata: pata_hpt366: Rename hpt_dma_blacklisted() Damien Le Moal
@ 2024-07-26  3:19 ` Damien Le Moal
  2024-07-26 11:13   ` Niklas Cassel
  2024-07-29 18:47   ` Igor Pylypiv
  10 siblings, 2 replies; 39+ messages in thread
From: Damien Le Moal @ 2024-07-26  3:19 UTC (permalink / raw)
  To: linux-ide, Niklas Cassel

Rename the function hpt_dma_blacklisted() to the more neutral
hpt_dma_broken().

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 drivers/ata/pata_hpt37x.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index c0329cf01135..4af22b819416 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -218,8 +218,8 @@ static u32 hpt37x_find_mode(struct ata_port *ap, int speed)
 	return 0xffffffffU;	/* silence compiler warning */
 }
 
-static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr,
-			       const char * const list[])
+static int hpt_dma_broken(const struct ata_device *dev, char *modestr,
+			  const char * const list[])
 {
 	unsigned char model_num[ATA_ID_PROD_LEN + 1];
 	int i;
@@ -281,9 +281,9 @@ static const char * const bad_ata100_5[] = {
 static unsigned int hpt370_filter(struct ata_device *adev, unsigned int mask)
 {
 	if (adev->class == ATA_DEV_ATA) {
-		if (hpt_dma_blacklisted(adev, "UDMA", bad_ata33))
+		if (hpt_dma_broken(adev, "UDMA", bad_ata33))
 			mask &= ~ATA_MASK_UDMA;
-		if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5))
+		if (hpt_dma_broken(adev, "UDMA100", bad_ata100_5))
 			mask &= ~(0xE0 << ATA_SHIFT_UDMA);
 	}
 	return mask;
@@ -300,7 +300,7 @@ static unsigned int hpt370_filter(struct ata_device *adev, unsigned int mask)
 static unsigned int hpt370a_filter(struct ata_device *adev, unsigned int mask)
 {
 	if (adev->class == ATA_DEV_ATA) {
-		if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5))
+		if (hpt_dma_broken(adev, "UDMA100", bad_ata100_5))
 			mask &= ~(0xE0 << ATA_SHIFT_UDMA);
 	}
 	return mask;
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 03/11] ata: libata: Use QUIRK instead of HORKAGE
  2024-07-26  3:19 ` [PATCH v6 03/11] ata: libata: Use QUIRK instead of HORKAGE Damien Le Moal
@ 2024-07-26 10:27   ` Niklas Cassel
  2024-07-29 18:41   ` Igor Pylypiv
  1 sibling, 0 replies; 39+ messages in thread
From: Niklas Cassel @ 2024-07-26 10:27 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide

On Fri, Jul 26, 2024 at 12:19:46PM +0900, Damien Le Moal wrote:
> According to Wiktionary, the verb "hork" is computing slang defined as
> "To foul up; to be occupied with difficulty, tangle, or unpleasantness;
> to be broken" (https://en.wiktionary.org/wiki/hork#Verb). libata uses
> this with the term "horkage" to refer to broken device features. Given
> that this term is not widely used and its meaning unknown to many,
> rename it to the more commonly used term "quirk", similar to many other
> places in the kernel.
> 
> The renaming done is:
> 1) Rename all ATA_HORKAGE_XXX flags to ATA_QUIRK_XXX
> 2) Rename struct ata_device horkage field to quirks
> 3) Rename struct ata_blacklist_entry to struct ata_dev_quirks_entry. The
>    array of these structures defining quirks for known devices is
>    renamed __ata_dev_quirks.
> 4) The functions ata_dev_blacklisted() and ata_force_horkage() are
>    renamed to ata_dev_quirks() and ata_force_quirks() respectively.
> 5) All the force_horkage_xxx() macros are renamed to force_quirk_xxx()
> 
> And while at it, make sure that the type "unsigned int" is used
> consistantly for quirk flags variables and data structure fields.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---

(It might have been easier to review if there was one patch that just renamed
the ATA_HORKAGE_ flags to ATA_QUIRK_, and then one patch that renamed
everything else, even if that means that the same line would be touched twice
in about half the changed lines.)

Legacy aside, I really like the fact that libata now aligns with the rest of
the kernel code base:
Reviewed-by: Niklas Cassel <cassel@kernel.org>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 04/11] ata: libata: Print quirks applied to devices
  2024-07-26  3:19 ` [PATCH v6 04/11] ata: libata: Print quirks applied to devices Damien Le Moal
@ 2024-07-26 10:47   ` Niklas Cassel
  2024-07-30 10:09   ` Geert Uytterhoeven
  1 sibling, 0 replies; 39+ messages in thread
From: Niklas Cassel @ 2024-07-26 10:47 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide

On Fri, Jul 26, 2024 at 12:19:47PM +0900, Damien Le Moal wrote:
> Introduce the function ata_dev_print_quirks() to print the quirk flags
> that will be applied to a scanned device. This new function is called
> from ata_dev_quirks() when a match on a device model or device model
> and revision is found for a device in the __ata_dev_quirks array.
> 
> To implement this function, the ATA_QUIRK_ flags are redefined using
> the new enum ata_quirk which defines the bit shift for each quirk
> flag. The array of strings ata_quirk_names is used to define the name
> of each flag, which are printed by ata_dev_print_quirks().
> 
> Example output for a device listed in the __ata_dev_quirks array and
> which has the ATA_QUIRK_DISABLE flag applied:
> 
> [10193.461270] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
> [10193.469190] ata1.00: Model 'ASMT109x- Config', rev '2143 5', applying quirks: disable
> [10193.469195] ata1.00: unsupported device, disabling
> [10193.481564] ata1.00: disable device
> 
> enum ata_quirk also defines the __ATA_QUIRK_MAX value as one plus the
> last quirk flag defined. This value is used in ata_dev_quirks() to add a
> build time check that all quirk flags fit within the unsigned int
> (32-bits) quirks field of struct ata_device.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
> ---
>  drivers/ata/libata-core.c |  76 +++++++++++++++++++++++++--
>  include/linux/libata.h    | 106 ++++++++++++++++++++++++++------------
>  2 files changed, 143 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 19b041bd7588..fc9fcfda42b8 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -3988,6 +3988,69 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
>  	return rc;
>  }
>  
> +static const char * const ata_quirk_names[] = {
> +	[__ATA_QUIRK_DIAGNOSTIC]	= "diagnostic",
> +	[__ATA_QUIRK_NODMA]		= "nodma",
> +	[__ATA_QUIRK_NONCQ]		= "noncq",
> +	[__ATA_QUIRK_MAX_SEC_128]	= "maxsec128",
> +	[__ATA_QUIRK_BROKEN_HPA]	= "brokenhpa",
> +	[__ATA_QUIRK_DISABLE]		= "disable",
> +	[__ATA_QUIRK_HPA_SIZE]		= "hpasize",
> +	[__ATA_QUIRK_IVB]		= "ivb",
> +	[__ATA_QUIRK_STUCK_ERR]		= "stuckerr",
> +	[__ATA_QUIRK_BRIDGE_OK]		= "bridgeok",
> +	[__ATA_QUIRK_ATAPI_MOD16_DMA]	= "atapimod16dma",
> +	[__ATA_QUIRK_FIRMWARE_WARN]	= "firmwarewarn",
> +	[__ATA_QUIRK_1_5_GBPS]		= "1.5gbps",
> +	[__ATA_QUIRK_NOSETXFER]		= "nosetxfer",
> +	[__ATA_QUIRK_BROKEN_FPDMA_AA]	= "brokenfpdmaaa",
> +	[__ATA_QUIRK_DUMP_ID]		= "dumpid",
> +	[__ATA_QUIRK_MAX_SEC_LBA48]	= "maxseclba48",
> +	[__ATA_QUIRK_ATAPI_DMADIR]	= "atapidmadir",
> +	[__ATA_QUIRK_NO_NCQ_TRIM]	= "noncqtrim",
> +	[__ATA_QUIRK_NOLPM]		= "nolpm",
> +	[__ATA_QUIRK_WD_BROKEN_LPM]	= "wdbrokenlpm",
> +	[__ATA_QUIRK_ZERO_AFTER_TRIM]	= "zeroaftertrim",
> +	[__ATA_QUIRK_NO_DMA_LOG]	= "nodmalog",
> +	[__ATA_QUIRK_NOTRIM]		= "notrim",
> +	[__ATA_QUIRK_MAX_SEC_1024]	= "maxsec1024",
> +	[__ATA_QUIRK_MAX_TRIM_128M]	= "maxtrim128m",
> +	[__ATA_QUIRK_NO_NCQ_ON_ATI]	= "noncqonati",
> +	[__ATA_QUIRK_NO_ID_DEV_LOG]	= "noiddevlog",
> +	[__ATA_QUIRK_NO_LOG_DIR]	= "nologdir",
> +	[__ATA_QUIRK_NO_FUA]		= "nofua",
> +};
> +
> +static void ata_dev_print_quirks(const struct ata_device *dev,
> +				 const char *model, const char *rev,
> +				 unsigned int quirks)
> +{
> +	int n = 0, i;
> +	size_t sz;
> +	char *str;
> +
> +	if (!quirks)
> +		return;
> +
> +	sz = 64 + ARRAY_SIZE(ata_quirk_names) * 16;
> +	str = kmalloc(sz, GFP_KERNEL);
> +	if (!str)
> +		return;
> +
> +	n = snprintf(str, sz, "Model '%s', rev '%s', applying quirks:",
> +		     model, rev);
> +
> +	for (i = 0; i < ARRAY_SIZE(ata_quirk_names); i++) {
> +		if (quirks & (1U << i))
> +			n += snprintf(str + n, sz - n,
> +				      " %s", ata_quirk_names[i]);
> +	}
> +
> +	ata_dev_warn(dev, "%s\n", str);
> +
> +	kfree(str);
> +}
> +
>  struct ata_dev_quirks_entry {
>  	const char *model_num;
>  	const char *model_rev;
> @@ -4273,15 +4336,18 @@ static unsigned int ata_dev_quirks(const struct ata_device *dev)
>  	unsigned char model_rev[ATA_ID_FW_REV_LEN + 1];
>  	const struct ata_dev_quirks_entry *ad = __ata_dev_quirks;
>  
> +	/* dev->quirks is an unsigned int. */
> +	BUILD_BUG_ON(__ATA_QUIRK_MAX > 32);
> +
>  	ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
>  	ata_id_c_string(dev->id, model_rev, ATA_ID_FW_REV, sizeof(model_rev));
>  
>  	while (ad->model_num) {
> -		if (glob_match(ad->model_num, model_num)) {
> -			if (ad->model_rev == NULL)
> -				return ad->quirks;
> -			if (glob_match(ad->model_rev, model_rev))
> -				return ad->quirks;
> +		if (glob_match(ad->model_num, model_num) &&
> +		    (!ad->model_rev || glob_match(ad->model_rev, model_rev))) {
> +			ata_dev_print_quirks(dev, model_num, model_rev,
> +					     ad->quirks);
> +			return ad->quirks;
>  		}
>  		ad++;
>  	}
> diff --git a/include/linux/libata.h b/include/linux/libata.h
> index 05dd7038ab30..d598ef690e50 100644
> --- a/include/linux/libata.h
> +++ b/include/linux/libata.h
> @@ -55,6 +55,46 @@
>  /* defines only for the constants which don't work well as enums */
>  #define ATA_TAG_POISON		0xfafbfcfdU
>  
> +/*
> + * Quirk flags bits.
> + * ata_device->quirks is an unsigned int, so __ATA_QUIRK_MAX must not exceed 32.
> + */
> +enum ata_quirks {
> +	__ATA_QUIRK_DIAGNOSTIC,		/* Failed boot diag */
> +	__ATA_QUIRK_NODMA,		/* DMA problems */
> +	__ATA_QUIRK_NONCQ,		/* Don't use NCQ */
> +	__ATA_QUIRK_MAX_SEC_128,	/* Limit max sects to 128 */
> +	__ATA_QUIRK_BROKEN_HPA,		/* Broken HPA */
> +	__ATA_QUIRK_DISABLE,		/* Disable it */
> +	__ATA_QUIRK_HPA_SIZE,		/* Native size off by one */
> +	__ATA_QUIRK_IVB,		/* cbl det validity bit bugs */
> +	__ATA_QUIRK_STUCK_ERR,		/* Stuck ERR on next PACKET */
> +	__ATA_QUIRK_BRIDGE_OK,		/* No bridge limits */
> +	__ATA_QUIRK_ATAPI_MOD16_DMA,	/* Use ATAPI DMA for commands that */
> +					/* are not a multiple of 16 bytes */
> +	__ATA_QUIRK_FIRMWARE_WARN,	/* Firmware update warning */
> +	__ATA_QUIRK_1_5_GBPS,		/* Force 1.5 Gbps */
> +	__ATA_QUIRK_NOSETXFER,		/* Skip SETXFER, SATA only */
> +	__ATA_QUIRK_BROKEN_FPDMA_AA,	/* Skip AA */
> +	__ATA_QUIRK_DUMP_ID,		/* Dump IDENTIFY data */
> +	__ATA_QUIRK_MAX_SEC_LBA48,	/* Set max sects to 65535 */
> +	__ATA_QUIRK_ATAPI_DMADIR,	/* Device requires dmadir */
> +	__ATA_QUIRK_NO_NCQ_TRIM,	/* Do not use queued TRIM */
> +	__ATA_QUIRK_NOLPM,		/* Do not use LPM */
> +	__ATA_QUIRK_WD_BROKEN_LPM,	/* Some WDs have broken LPM */
> +	__ATA_QUIRK_ZERO_AFTER_TRIM,	/* Guarantees zero after trim */
> +	__ATA_QUIRK_NO_DMA_LOG,		/* Do not use DMA for log read */
> +	__ATA_QUIRK_NOTRIM,		/* Do not use TRIM */
> +	__ATA_QUIRK_MAX_SEC_1024,	/* Limit max sects to 1024 */
> +	__ATA_QUIRK_MAX_TRIM_128M,	/* Limit max trim size to 128M */
> +	__ATA_QUIRK_NO_NCQ_ON_ATI,	/* Disable NCQ on ATI chipset */
> +	__ATA_QUIRK_NO_ID_DEV_LOG,	/* Identify device log missing */
> +	__ATA_QUIRK_NO_LOG_DIR,		/* Do not read log directory */
> +	__ATA_QUIRK_NO_FUA,		/* Do not use FUA */
> +
> +	__ATA_QUIRK_MAX,
> +};
> +
>  enum {
>  	/* various global constants */
>  	LIBATA_MAX_PRD		= ATA_MAX_PRD / 2,
> @@ -366,40 +406,38 @@ enum {
>  	 * Quirk flags: may be set by libata or controller drivers on drives.
>  	 * Some quirks may be drive/controller pair dependent.
>  	 */
> -	ATA_QUIRK_DIAGNOSTIC	= (1 << 0),	/* Failed boot diag */
> -	ATA_QUIRK_NODMA		= (1 << 1),	/* DMA problems */
> -	ATA_QUIRK_NONCQ		= (1 << 2),	/* Do not use NCQ */
> -	ATA_QUIRK_MAX_SEC_128	= (1 << 3),	/* Limit max sects to 128 */
> -	ATA_QUIRK_BROKEN_HPA	= (1 << 4),	/* Broken HPA */
> -	ATA_QUIRK_DISABLE	= (1 << 5),	/* Disable it */
> -	ATA_QUIRK_HPA_SIZE	= (1 << 6),	/* Native size off by one */
> -	ATA_QUIRK_IVB		= (1 << 8),	/* CBL det validity bit bugs */
> -	ATA_QUIRK_STUCK_ERR	= (1 << 9),	/* Stuck ERR on next PACKET */
> -	ATA_QUIRK_BRIDGE_OK	= (1 << 10),	/* No bridge limits */
> -	ATA_QUIRK_ATAPI_MOD16_DMA = (1 << 11),	/* Use ATAPI DMA for commands */
> -						/* not multiple of 16 bytes */
> -	ATA_QUIRK_FIRMWARE_WARN = (1 << 12),	/* Firmware update warning */
> -	ATA_QUIRK_1_5_GBPS	= (1 << 13),	/* Force 1.5 Gbps */
> -	ATA_QUIRK_NOSETXFER	= (1 << 14),	/* Skip SETXFER, SATA only */
> -	ATA_QUIRK_BROKEN_FPDMA_AA = (1 << 15),	/* Skip AA */
> -	ATA_QUIRK_DUMP_ID	= (1 << 16),	/* Dump IDENTIFY data */
> -	ATA_QUIRK_MAX_SEC_LBA48 = (1 << 17),	/* Set max sects to 65535 */
> -	ATA_QUIRK_ATAPI_DMADIR	= (1 << 18),	/* Device requires dmadir */
> -	ATA_QUIRK_NO_NCQ_TRIM	= (1 << 19),	/* Do not use queued TRIM */
> -	ATA_QUIRK_NOLPM		= (1 << 20),	/* Do not use LPM */
> -	ATA_QUIRK_WD_BROKEN_LPM = (1 << 21),	/* Some WDs have broken LPM */
> -	ATA_QUIRK_ZERO_AFTER_TRIM = (1 << 22),	/* Guarantees zero after trim */
> -	ATA_QUIRK_NO_DMA_LOG	= (1 << 23),	/* Do not use DMA for log read */
> -	ATA_QUIRK_NOTRIM	= (1 << 24),	/* Do not use TRIM */
> -	ATA_QUIRK_MAX_SEC_1024	= (1 << 25),	/* Limit max sects to 1024 */
> -	ATA_QUIRK_MAX_TRIM_128M = (1 << 26),	/* Limit max trim size to 128M */
> -	ATA_QUIRK_NO_NCQ_ON_ATI = (1 << 27),	/* Disable NCQ on ATI chipset */
> -	ATA_QUIRK_NO_ID_DEV_LOG = (1 << 28),	/* Identify device log missing */
> -	ATA_QUIRK_NO_LOG_DIR	= (1 << 29),	/* Do not read log directory */
> -	ATA_QUIRK_NO_FUA	= (1 << 30),	/* Do not use FUA */
> -
> -	 /* DMA mask for user DMA control: User visible values; DO NOT
> -	    renumber */
> +	ATA_QUIRK_DIAGNOSTIC		= (1U << __ATA_QUIRK_DIAGNOSTIC),
> +	ATA_QUIRK_NODMA			= (1U << __ATA_QUIRK_NODMA),
> +	ATA_QUIRK_NONCQ			= (1U << __ATA_QUIRK_NONCQ),
> +	ATA_QUIRK_MAX_SEC_128		= (1U << __ATA_QUIRK_MAX_SEC_128),
> +	ATA_QUIRK_BROKEN_HPA		= (1U << __ATA_QUIRK_BROKEN_HPA),
> +	ATA_QUIRK_DISABLE		= (1U << __ATA_QUIRK_DISABLE),
> +	ATA_QUIRK_HPA_SIZE		= (1U << __ATA_QUIRK_HPA_SIZE),
> +	ATA_QUIRK_IVB			= (1U << __ATA_QUIRK_IVB),
> +	ATA_QUIRK_STUCK_ERR		= (1U << __ATA_QUIRK_STUCK_ERR),
> +	ATA_QUIRK_BRIDGE_OK		= (1U << __ATA_QUIRK_BRIDGE_OK),
> +	ATA_QUIRK_ATAPI_MOD16_DMA	= (1U << __ATA_QUIRK_ATAPI_MOD16_DMA),
> +	ATA_QUIRK_FIRMWARE_WARN		= (1U << __ATA_QUIRK_FIRMWARE_WARN),
> +	ATA_QUIRK_1_5_GBPS		= (1U << __ATA_QUIRK_1_5_GBPS),
> +	ATA_QUIRK_NOSETXFER		= (1U << __ATA_QUIRK_NOSETXFER),
> +	ATA_QUIRK_BROKEN_FPDMA_AA	= (1U << __ATA_QUIRK_BROKEN_FPDMA_AA),
> +	ATA_QUIRK_DUMP_ID		= (1U << __ATA_QUIRK_DUMP_ID),
> +	ATA_QUIRK_MAX_SEC_LBA48		= (1U << __ATA_QUIRK_MAX_SEC_LBA48),
> +	ATA_QUIRK_ATAPI_DMADIR		= (1U << __ATA_QUIRK_ATAPI_DMADIR),
> +	ATA_QUIRK_NO_NCQ_TRIM		= (1U << __ATA_QUIRK_NO_NCQ_TRIM),
> +	ATA_QUIRK_NOLPM			= (1U << __ATA_QUIRK_NOLPM),
> +	ATA_QUIRK_WD_BROKEN_LPM		= (1U << __ATA_QUIRK_WD_BROKEN_LPM),
> +	ATA_QUIRK_ZERO_AFTER_TRIM	= (1U << __ATA_QUIRK_ZERO_AFTER_TRIM),
> +	ATA_QUIRK_NO_DMA_LOG		= (1U << __ATA_QUIRK_NO_DMA_LOG),
> +	ATA_QUIRK_NOTRIM		= (1U << __ATA_QUIRK_NOTRIM),
> +	ATA_QUIRK_MAX_SEC_1024		= (1U << __ATA_QUIRK_MAX_SEC_1024),
> +	ATA_QUIRK_MAX_TRIM_128M		= (1U << __ATA_QUIRK_MAX_TRIM_128M),
> +	ATA_QUIRK_NO_NCQ_ON_ATI		= (1U << __ATA_QUIRK_NO_NCQ_ON_ATI),
> +	ATA_QUIRK_NO_ID_DEV_LOG		= (1U << __ATA_QUIRK_NO_ID_DEV_LOG),
> +	ATA_QUIRK_NO_LOG_DIR		= (1U << __ATA_QUIRK_NO_LOG_DIR),
> +	ATA_QUIRK_NO_FUA		= (1U << __ATA_QUIRK_NO_FUA),

Personally, I would prefer if these used the BIT() macro.
But since BIT() does the shift with 1UL, that might require that this patch
(and the previous patch in the series) changes the quirk data type to
consistenly be "unsigned long" everywhere, instead of changing the quirk data
type to consistently be "unsigned int" everywhere.

We could still keep the:
BUILD_BUG_ON(__ATA_QUIRK_MAX > 32);

Since unsigned long is 32-bits on 32-bit platforms.

FWIW, on nvme, quirks is defined as "unsigned long" in drivers/nvme/host/nvme.h

But since this is personal preference, I would also be fine if you decide
to keep this patch as it is, thus:
Reviewed-by: Niklas Cassel <cassel@kernel.org>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 06/11] ata: ahci: Rephrase comment to not use the term blacklist
  2024-07-26  3:19 ` [PATCH v6 06/11] ata: ahci: Rephrase comment to " Damien Le Moal
@ 2024-07-26 10:57   ` Niklas Cassel
  2024-07-29 18:43   ` Igor Pylypiv
  1 sibling, 0 replies; 39+ messages in thread
From: Niklas Cassel @ 2024-07-26 10:57 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide

On Fri, Jul 26, 2024 at 12:19:49PM +0900, Damien Le Moal wrote:
> Rephrase the comment for the eMachines entry in the sysids array of
> ahci_broken_suspend() to not use the term blacklist.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>  drivers/ata/ahci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index a05c17249448..45f63b09828a 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -1370,7 +1370,7 @@ static bool ahci_broken_suspend(struct pci_dev *pdev)
>  		 * V1.03 is known to be broken.  V3.04 is known to
>  		 * work.  Between, there are V1.06, V2.06 and V3.03
>  		 * that we don't have much idea about.  For now,
> -		 * blacklist anything older than V3.04.
> +		 * assume that anything older than V3.04 is broken.
>  		 *
>  		 * http://bugzilla.kernel.org/show_bug.cgi?id=15104
>  		 */
> -- 
> 2.45.2
> 

Reviewed-by: Niklas Cassel <cassel@kernel.org>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 05/11] ata: pata_serverworks: Do not use the term blacklist
  2024-07-26  3:19 ` [PATCH v6 05/11] ata: pata_serverworks: Do not use the term blacklist Damien Le Moal
@ 2024-07-26 11:12   ` Niklas Cassel
  2024-07-29 18:43   ` Igor Pylypiv
  1 sibling, 0 replies; 39+ messages in thread
From: Niklas Cassel @ 2024-07-26 11:12 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide

On Fri, Jul 26, 2024 at 12:19:48PM +0900, Damien Le Moal wrote:
> Let's not use the term blacklist in the function
> serverworks_osb4_filter() documentation comment and rather simply refer
> to what that function looks at: the list of devices with groken UDMA5.
> 
> While at it, also constify the values of the csb_bad_ata100 array.
> 
> Of note is that all of this should probably be handled using libata
> quirk mechanism but it is unclear if these UDMA5 quirks are specific
> to this controller only.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>  drivers/ata/pata_serverworks.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
> index 549ff24a9823..4edddf6bcc15 100644
> --- a/drivers/ata/pata_serverworks.c
> +++ b/drivers/ata/pata_serverworks.c
> @@ -46,10 +46,11 @@
>  #define SVWKS_CSB5_REVISION_NEW	0x92 /* min PCI_REVISION_ID for UDMA5 (A2.0) */
>  #define SVWKS_CSB6_REVISION	0xa0 /* min PCI_REVISION_ID for UDMA4 (A1.0) */
>  
> -/* Seagate Barracuda ATA IV Family drives in UDMA mode 5
> - * can overrun their FIFOs when used with the CSB5 */
> -
> -static const char *csb_bad_ata100[] = {
> +/*
> + * Seagate Barracuda ATA IV Family drives in UDMA mode 5
> + * can overrun their FIFOs when used with the CSB5.
> + */
> +static const char * const csb_bad_ata100[] = {
>  	"ST320011A",
>  	"ST340016A",
>  	"ST360021A",
> @@ -163,10 +164,11 @@ static unsigned int serverworks_osb4_filter(struct ata_device *adev, unsigned in
>   *	@adev: ATA device
>   *	@mask: Mask of proposed modes
>   *
> - *	Check the blacklist and disable UDMA5 if matched
> + *	Check the list of devices with broken UDMA5 and
> + *	disable UDMA5 if matched.
>   */
> -
> -static unsigned int serverworks_csb_filter(struct ata_device *adev, unsigned int mask)
> +static unsigned int serverworks_csb_filter(struct ata_device *adev,
> +					   unsigned int mask)
>  {
>  	const char *p;
>  	char model_num[ATA_ID_PROD_LEN + 1];
> -- 
> 2.45.2
> 

Reviewed-by: Niklas Cassel <cassel@kernel.org>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 07/11] ata: sata_sil: Rename sil_blacklist to sil_quirks
  2024-07-26  3:19 ` [PATCH v6 07/11] ata: sata_sil: Rename sil_blacklist to sil_quirks Damien Le Moal
@ 2024-07-26 11:13   ` Niklas Cassel
  2024-07-29 18:44   ` Igor Pylypiv
  1 sibling, 0 replies; 39+ messages in thread
From: Niklas Cassel @ 2024-07-26 11:13 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide

On Fri, Jul 26, 2024 at 12:19:50PM +0900, Damien Le Moal wrote:
> Rename the array sil_blacklist to sil_quirks as this name is more
> neutral and is also consistent with how this driver define quirks with
> the SIL_QUIRK_XXX flags.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>  drivers/ata/sata_sil.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
> index 354b68ef91bc..3a99f66198a9 100644
> --- a/drivers/ata/sata_sil.c
> +++ b/drivers/ata/sata_sil.c
> @@ -128,7 +128,7 @@ static const struct pci_device_id sil_pci_tbl[] = {
>  static const struct sil_drivelist {
>  	const char *product;
>  	unsigned int quirk;
> -} sil_blacklist [] = {
> +} sil_quirks[] = {
>  	{ "ST320012AS",		SIL_QUIRK_MOD15WRITE },
>  	{ "ST330013AS",		SIL_QUIRK_MOD15WRITE },
>  	{ "ST340017AS",		SIL_QUIRK_MOD15WRITE },
> @@ -600,8 +600,8 @@ static void sil_thaw(struct ata_port *ap)
>   *	list, and apply the fixups to only the specific
>   *	devices/hosts/firmwares that need it.
>   *
> - *	20040111 - Seagate drives affected by the Mod15Write bug are blacklisted
> - *	The Maxtor quirk is in the blacklist, but I'm keeping the original
> + *	20040111 - Seagate drives affected by the Mod15Write bug are quirked
> + *	The Maxtor quirk is in sil_quirks, but I'm keeping the original
>   *	pessimistic fix for the following reasons...
>   *	- There seems to be less info on it, only one device gleaned off the
>   *	Windows	driver, maybe only one is affected.  More info would be greatly
> @@ -620,9 +620,9 @@ static void sil_dev_config(struct ata_device *dev)
>  
>  	ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
>  
> -	for (n = 0; sil_blacklist[n].product; n++)
> -		if (!strcmp(sil_blacklist[n].product, model_num)) {
> -			quirks = sil_blacklist[n].quirk;
> +	for (n = 0; sil_quirks[n].product; n++)
> +		if (!strcmp(sil_quirks[n].product, model_num)) {
> +			quirks = sil_quirks[n].quirk;
>  			break;
>  		}
>  
> -- 
> 2.45.2
> 

Reviewed-by: Niklas Cassel <cassel@kernel.org>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 08/11] ata: ata_piix: Remove useless comment in piix_init_sidpr()
  2024-07-26  3:19 ` [PATCH v6 08/11] ata: ata_piix: Remove useless comment in piix_init_sidpr() Damien Le Moal
@ 2024-07-26 11:13   ` Niklas Cassel
  2024-07-29 18:45   ` Igor Pylypiv
  1 sibling, 0 replies; 39+ messages in thread
From: Niklas Cassel @ 2024-07-26 11:13 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide

On Fri, Jul 26, 2024 at 12:19:51PM +0900, Damien Le Moal wrote:
> Remove the comment using the term "blacklist" from piix_init_sidpr().
> That comment is useless given that the function piix_no_sidpr() name is
> clear about what is being checked.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>  drivers/ata/ata_piix.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
> index ec3c5bd1f813..093b940bc953 100644
> --- a/drivers/ata/ata_piix.c
> +++ b/drivers/ata/ata_piix.c
> @@ -1446,7 +1446,6 @@ static int piix_init_sidpr(struct ata_host *host)
>  		if (hpriv->map[i] == IDE)
>  			return 0;
>  
> -	/* is it blacklisted? */
>  	if (piix_no_sidpr(host))
>  		return 0;
>  
> -- 
> 2.45.2
> 

Reviewed-by: Niklas Cassel <cassel@kernel.org>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 09/11] ata: pata_cs5520: Rephrase file header comment
  2024-07-26  3:19 ` [PATCH v6 09/11] ata: pata_cs5520: Rephrase file header comment Damien Le Moal
@ 2024-07-26 11:13   ` Niklas Cassel
  2024-07-29 18:45   ` Igor Pylypiv
  1 sibling, 0 replies; 39+ messages in thread
From: Niklas Cassel @ 2024-07-26 11:13 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide

On Fri, Jul 26, 2024 at 12:19:52PM +0900, Damien Le Moal wrote:
> Remove the use of the term "blacklist". What the comment using that term
> refers to does not seem to exist at all anyway as the driver does not
> have such list but rather only a list of compatible controllers.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>  drivers/ata/pata_cs5520.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
> index 027cf67101ef..3163c8d9cef5 100644
> --- a/drivers/ata/pata_cs5520.c
> +++ b/drivers/ata/pata_cs5520.c
> @@ -8,9 +8,9 @@
>   *	PIO mode and smarter silicon.
>   *
>   *	The practical upshot of this is that we must always tune the
> - *	drive for the right PIO mode. We must also ignore all the blacklists
> - *	and the drive bus mastering DMA information. Also to confuse matters
> - *	further we can do DMA on PIO only drives.
> + *	drive for the right PIO mode and ignore the drive bus mastering DMA
> + *	information. Also to confuse matters further we can do DMA on PIO only
> + *	drives.
>   *
>   *	DMA on the 5510 also requires we disable_hlt() during DMA on early
>   *	revisions.
> -- 
> 2.45.2
> 

Reviewed-by: Niklas Cassel <cassel@kernel.org>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 10/11] ata: pata_hpt366: Rename hpt_dma_blacklisted()
  2024-07-26  3:19 ` [PATCH v6 10/11] ata: pata_hpt366: Rename hpt_dma_blacklisted() Damien Le Moal
@ 2024-07-26 11:13   ` Niklas Cassel
  2024-07-29 18:46   ` Igor Pylypiv
  1 sibling, 0 replies; 39+ messages in thread
From: Niklas Cassel @ 2024-07-26 11:13 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide

On Fri, Jul 26, 2024 at 12:19:53PM +0900, Damien Le Moal wrote:
> Rename the function hpt_dma_blacklisted() to the more neutral
> hpt_dma_broken().
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>  drivers/ata/pata_hpt366.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
> index bdccd1ba1524..5280e9960025 100644
> --- a/drivers/ata/pata_hpt366.c
> +++ b/drivers/ata/pata_hpt366.c
> @@ -170,8 +170,8 @@ static const char * const bad_ata66_3[] = {
>  	NULL
>  };
>  
> -static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr,
> -			       const char * const list[])
> +static int hpt_dma_broken(const struct ata_device *dev, char *modestr,
> +			  const char * const list[])
>  {
>  	unsigned char model_num[ATA_ID_PROD_LEN + 1];
>  	int i;
> @@ -197,11 +197,11 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr,
>  static unsigned int hpt366_filter(struct ata_device *adev, unsigned int mask)
>  {
>  	if (adev->class == ATA_DEV_ATA) {
> -		if (hpt_dma_blacklisted(adev, "UDMA",  bad_ata33))
> +		if (hpt_dma_broken(adev, "UDMA",  bad_ata33))
>  			mask &= ~ATA_MASK_UDMA;
> -		if (hpt_dma_blacklisted(adev, "UDMA3", bad_ata66_3))
> +		if (hpt_dma_broken(adev, "UDMA3", bad_ata66_3))
>  			mask &= ~(0xF8 << ATA_SHIFT_UDMA);
> -		if (hpt_dma_blacklisted(adev, "UDMA4", bad_ata66_4))
> +		if (hpt_dma_broken(adev, "UDMA4", bad_ata66_4))
>  			mask &= ~(0xF0 << ATA_SHIFT_UDMA);
>  	} else if (adev->class == ATA_DEV_ATAPI)
>  		mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
> -- 
> 2.45.2
> 

Reviewed-by: Niklas Cassel <cassel@kernel.org>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 11/11] ata: pata_hpt37x: Rename hpt_dma_blacklisted()
  2024-07-26  3:19 ` [PATCH v6 11/11] ata: pata_hpt37x: " Damien Le Moal
@ 2024-07-26 11:13   ` Niklas Cassel
  2024-07-29 18:47   ` Igor Pylypiv
  1 sibling, 0 replies; 39+ messages in thread
From: Niklas Cassel @ 2024-07-26 11:13 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide

On Fri, Jul 26, 2024 at 12:19:54PM +0900, Damien Le Moal wrote:
> Rename the function hpt_dma_blacklisted() to the more neutral
> hpt_dma_broken().
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>  drivers/ata/pata_hpt37x.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
> index c0329cf01135..4af22b819416 100644
> --- a/drivers/ata/pata_hpt37x.c
> +++ b/drivers/ata/pata_hpt37x.c
> @@ -218,8 +218,8 @@ static u32 hpt37x_find_mode(struct ata_port *ap, int speed)
>  	return 0xffffffffU;	/* silence compiler warning */
>  }
>  
> -static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr,
> -			       const char * const list[])
> +static int hpt_dma_broken(const struct ata_device *dev, char *modestr,
> +			  const char * const list[])
>  {
>  	unsigned char model_num[ATA_ID_PROD_LEN + 1];
>  	int i;
> @@ -281,9 +281,9 @@ static const char * const bad_ata100_5[] = {
>  static unsigned int hpt370_filter(struct ata_device *adev, unsigned int mask)
>  {
>  	if (adev->class == ATA_DEV_ATA) {
> -		if (hpt_dma_blacklisted(adev, "UDMA", bad_ata33))
> +		if (hpt_dma_broken(adev, "UDMA", bad_ata33))
>  			mask &= ~ATA_MASK_UDMA;
> -		if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5))
> +		if (hpt_dma_broken(adev, "UDMA100", bad_ata100_5))
>  			mask &= ~(0xE0 << ATA_SHIFT_UDMA);
>  	}
>  	return mask;
> @@ -300,7 +300,7 @@ static unsigned int hpt370_filter(struct ata_device *adev, unsigned int mask)
>  static unsigned int hpt370a_filter(struct ata_device *adev, unsigned int mask)
>  {
>  	if (adev->class == ATA_DEV_ATA) {
> -		if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5))
> +		if (hpt_dma_broken(adev, "UDMA100", bad_ata100_5))
>  			mask &= ~(0xE0 << ATA_SHIFT_UDMA);
>  	}
>  	return mask;
> -- 
> 2.45.2
> 

Reviewed-by: Niklas Cassel <cassel@kernel.org>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 03/11] ata: libata: Use QUIRK instead of HORKAGE
  2024-07-26  3:19 ` [PATCH v6 03/11] ata: libata: Use QUIRK instead of HORKAGE Damien Le Moal
  2024-07-26 10:27   ` Niklas Cassel
@ 2024-07-29 18:41   ` Igor Pylypiv
  1 sibling, 0 replies; 39+ messages in thread
From: Igor Pylypiv @ 2024-07-29 18:41 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide, Niklas Cassel

On Fri, Jul 26, 2024 at 12:19:46PM +0900, Damien Le Moal wrote:
> According to Wiktionary, the verb "hork" is computing slang defined as
> "To foul up; to be occupied with difficulty, tangle, or unpleasantness;
> to be broken" (https://en.wiktionary.org/wiki/hork#Verb). libata uses
> this with the term "horkage" to refer to broken device features. Given
> that this term is not widely used and its meaning unknown to many,
> rename it to the more commonly used term "quirk", similar to many other
> places in the kernel.
> 
> The renaming done is:
> 1) Rename all ATA_HORKAGE_XXX flags to ATA_QUIRK_XXX
> 2) Rename struct ata_device horkage field to quirks
> 3) Rename struct ata_blacklist_entry to struct ata_dev_quirks_entry. The
>    array of these structures defining quirks for known devices is
>    renamed __ata_dev_quirks.
> 4) The functions ata_dev_blacklisted() and ata_force_horkage() are
>    renamed to ata_dev_quirks() and ata_force_quirks() respectively.
> 5) All the force_horkage_xxx() macros are renamed to force_quirk_xxx()
> 
> And while at it, make sure that the type "unsigned int" is used
> consistantly for quirk flags variables and data structure fields.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

Reviewed-by: Igor Pylypiv <ipylypiv@google.com>

Thanks,
Igor
> ---
>  drivers/ata/libata-core.c      | 490 ++++++++++++++++-----------------
>  drivers/ata/libata-sata.c      |   2 +-
>  drivers/ata/libata-scsi.c      |   9 +-
>  drivers/ata/libata-sff.c       |  10 +-
>  drivers/ata/libata-transport.c |   6 +-
>  drivers/ata/pata_it821x.c      |   4 +-
>  drivers/ata/sata_sil.c         |   2 +-
>  include/linux/libata.h         |  71 ++---
>  8 files changed, 297 insertions(+), 297 deletions(-)
> 
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index f1e5055e33fe..19b041bd7588 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -84,7 +84,7 @@ static unsigned int ata_dev_init_params(struct ata_device *dev,
>  					u16 heads, u16 sectors);
>  static unsigned int ata_dev_set_xfermode(struct ata_device *dev);
>  static void ata_dev_xfermask(struct ata_device *dev);
> -static unsigned long ata_dev_blacklisted(const struct ata_device *dev);
> +static unsigned int ata_dev_quirks(const struct ata_device *dev);
>  
>  static DEFINE_IDA(ata_ida);
>  
> @@ -94,8 +94,8 @@ struct ata_force_param {
>  	u8		cbl;
>  	u8		spd_limit;
>  	unsigned int	xfer_mask;
> -	unsigned int	horkage_on;
> -	unsigned int	horkage_off;
> +	unsigned int	quirk_on;
> +	unsigned int	quirk_off;
>  	u16		lflags_on;
>  	u16		lflags_off;
>  };
> @@ -457,17 +457,17 @@ static void ata_force_xfermask(struct ata_device *dev)
>  }
>  
>  /**
> - *	ata_force_horkage - force horkage according to libata.force
> + *	ata_force_quirks - force quirks according to libata.force
>   *	@dev: ATA device of interest
>   *
> - *	Force horkage according to libata.force and whine about it.
> + *	Force quirks according to libata.force and whine about it.
>   *	For consistency with link selection, device number 15 selects
>   *	the first device connected to the host link.
>   *
>   *	LOCKING:
>   *	EH context.
>   */
> -static void ata_force_horkage(struct ata_device *dev)
> +static void ata_force_quirks(struct ata_device *dev)
>  {
>  	int devno = dev->link->pmp + dev->devno;
>  	int alt_devno = devno;
> @@ -487,21 +487,21 @@ static void ata_force_horkage(struct ata_device *dev)
>  		    fe->device != alt_devno)
>  			continue;
>  
> -		if (!(~dev->horkage & fe->param.horkage_on) &&
> -		    !(dev->horkage & fe->param.horkage_off))
> +		if (!(~dev->quirks & fe->param.quirk_on) &&
> +		    !(dev->quirks & fe->param.quirk_off))
>  			continue;
>  
> -		dev->horkage |= fe->param.horkage_on;
> -		dev->horkage &= ~fe->param.horkage_off;
> +		dev->quirks |= fe->param.quirk_on;
> +		dev->quirks &= ~fe->param.quirk_off;
>  
> -		ata_dev_notice(dev, "FORCE: horkage modified (%s)\n",
> +		ata_dev_notice(dev, "FORCE: modified (%s)\n",
>  			       fe->param.name);
>  	}
>  }
>  #else
>  static inline void ata_force_link_limits(struct ata_link *link) { }
>  static inline void ata_force_xfermask(struct ata_device *dev) { }
> -static inline void ata_force_horkage(struct ata_device *dev) { }
> +static inline void ata_force_quirks(struct ata_device *dev) { }
>  #endif
>  
>  /**
> @@ -1221,7 +1221,7 @@ static int ata_read_native_max_address(struct ata_device *dev, u64 *max_sectors)
>  		*max_sectors = ata_tf_to_lba48(&tf) + 1;
>  	else
>  		*max_sectors = ata_tf_to_lba(&tf) + 1;
> -	if (dev->horkage & ATA_HORKAGE_HPA_SIZE)
> +	if (dev->quirks & ATA_QUIRK_HPA_SIZE)
>  		(*max_sectors)--;
>  	return 0;
>  }
> @@ -1306,7 +1306,7 @@ static int ata_hpa_resize(struct ata_device *dev)
>  	/* do we need to do it? */
>  	if ((dev->class != ATA_DEV_ATA && dev->class != ATA_DEV_ZAC) ||
>  	    !ata_id_has_lba(dev->id) || !ata_id_hpa_enabled(dev->id) ||
> -	    (dev->horkage & ATA_HORKAGE_BROKEN_HPA))
> +	    (dev->quirks & ATA_QUIRK_BROKEN_HPA))
>  		return 0;
>  
>  	/* read native max address */
> @@ -1318,7 +1318,7 @@ static int ata_hpa_resize(struct ata_device *dev)
>  		if (rc == -EACCES || !unlock_hpa) {
>  			ata_dev_warn(dev,
>  				     "HPA support seems broken, skipping HPA handling\n");
> -			dev->horkage |= ATA_HORKAGE_BROKEN_HPA;
> +			dev->quirks |= ATA_QUIRK_BROKEN_HPA;
>  
>  			/* we can continue if device aborted the command */
>  			if (rc == -EACCES)
> @@ -1355,7 +1355,7 @@ static int ata_hpa_resize(struct ata_device *dev)
>  			     "device aborted resize (%llu -> %llu), skipping HPA handling\n",
>  			     (unsigned long long)sectors,
>  			     (unsigned long long)native_sectors);
> -		dev->horkage |= ATA_HORKAGE_BROKEN_HPA;
> +		dev->quirks |= ATA_QUIRK_BROKEN_HPA;
>  		return 0;
>  	} else if (rc)
>  		return rc;
> @@ -1835,7 +1835,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
>  		goto err_out;
>  	}
>  
> -	if (dev->horkage & ATA_HORKAGE_DUMP_ID) {
> +	if (dev->quirks & ATA_QUIRK_DUMP_ID) {
>  		ata_dev_info(dev, "dumping IDENTIFY data, "
>  			    "class=%d may_fallback=%d tried_spinup=%d\n",
>  			    class, may_fallback, tried_spinup);
> @@ -2104,7 +2104,7 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log,
>  retry:
>  	ata_tf_init(dev, &tf);
>  	if (ata_dma_enabled(dev) && ata_id_has_read_log_dma_ext(dev->id) &&
> -	    !(dev->horkage & ATA_HORKAGE_NO_DMA_LOG)) {
> +	    !(dev->quirks & ATA_QUIRK_NO_DMA_LOG)) {
>  		tf.command = ATA_CMD_READ_LOG_DMA_EXT;
>  		tf.protocol = ATA_PROT_DMA;
>  		dma = true;
> @@ -2124,7 +2124,7 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log,
>  
>  	if (err_mask) {
>  		if (dma) {
> -			dev->horkage |= ATA_HORKAGE_NO_DMA_LOG;
> +			dev->quirks |= ATA_QUIRK_NO_DMA_LOG;
>  			if (!ata_port_is_frozen(dev->link->ap))
>  				goto retry;
>  		}
> @@ -2140,7 +2140,7 @@ static int ata_log_supported(struct ata_device *dev, u8 log)
>  {
>  	struct ata_port *ap = dev->link->ap;
>  
> -	if (dev->horkage & ATA_HORKAGE_NO_LOG_DIR)
> +	if (dev->quirks & ATA_QUIRK_NO_LOG_DIR)
>  		return 0;
>  
>  	if (ata_read_log_page(dev, ATA_LOG_DIRECTORY, 0, ap->sector_buf, 1))
> @@ -2153,7 +2153,7 @@ static bool ata_identify_page_supported(struct ata_device *dev, u8 page)
>  	struct ata_port *ap = dev->link->ap;
>  	unsigned int err, i;
>  
> -	if (dev->horkage & ATA_HORKAGE_NO_ID_DEV_LOG)
> +	if (dev->quirks & ATA_QUIRK_NO_ID_DEV_LOG)
>  		return false;
>  
>  	if (!ata_log_supported(dev, ATA_LOG_IDENTIFY_DEVICE)) {
> @@ -2165,7 +2165,7 @@ static bool ata_identify_page_supported(struct ata_device *dev, u8 page)
>  		if (ata_id_major_version(dev->id) >= 10)
>  			ata_dev_warn(dev,
>  				"ATA Identify Device Log not supported\n");
> -		dev->horkage |= ATA_HORKAGE_NO_ID_DEV_LOG;
> +		dev->quirks |= ATA_QUIRK_NO_ID_DEV_LOG;
>  		return false;
>  	}
>  
> @@ -2186,7 +2186,7 @@ static bool ata_identify_page_supported(struct ata_device *dev, u8 page)
>  	return false;
>  }
>  
> -static int ata_do_link_spd_horkage(struct ata_device *dev)
> +static int ata_do_link_spd_quirk(struct ata_device *dev)
>  {
>  	struct ata_link *plink = ata_dev_phys_link(dev);
>  	u32 target, target_limit;
> @@ -2194,7 +2194,7 @@ static int ata_do_link_spd_horkage(struct ata_device *dev)
>  	if (!sata_scr_valid(plink))
>  		return 0;
>  
> -	if (dev->horkage & ATA_HORKAGE_1_5_GBPS)
> +	if (dev->quirks & ATA_QUIRK_1_5_GBPS)
>  		target = 1;
>  	else
>  		return 0;
> @@ -2212,7 +2212,7 @@ static int ata_do_link_spd_horkage(struct ata_device *dev)
>  	 * guaranteed by setting sata_spd_limit to target_limit above.
>  	 */
>  	if (plink->sata_spd > target) {
> -		ata_dev_info(dev, "applying link speed limit horkage to %s\n",
> +		ata_dev_info(dev, "applying link speed limit quirk to %s\n",
>  			     sata_spd_string(target));
>  		return -EAGAIN;
>  	}
> @@ -2223,7 +2223,7 @@ static inline bool ata_dev_knobble(struct ata_device *dev)
>  {
>  	struct ata_port *ap = dev->link->ap;
>  
> -	if (ata_dev_blacklisted(dev) & ATA_HORKAGE_BRIDGE_OK)
> +	if (ata_dev_quirks(dev) & ATA_QUIRK_BRIDGE_OK)
>  		return false;
>  
>  	return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id)));
> @@ -2246,7 +2246,7 @@ static void ata_dev_config_ncq_send_recv(struct ata_device *dev)
>  		dev->flags |= ATA_DFLAG_NCQ_SEND_RECV;
>  		memcpy(cmds, ap->sector_buf, ATA_LOG_NCQ_SEND_RECV_SIZE);
>  
> -		if (dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM) {
> +		if (dev->quirks & ATA_QUIRK_NO_NCQ_TRIM) {
>  			ata_dev_dbg(dev, "disabling queued TRIM support\n");
>  			cmds[ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET] &=
>  				~ATA_LOG_NCQ_SEND_RECV_DSM_TRIM;
> @@ -2334,12 +2334,12 @@ static int ata_dev_config_ncq(struct ata_device *dev,
>  	}
>  	if (!IS_ENABLED(CONFIG_SATA_HOST))
>  		return 0;
> -	if (dev->horkage & ATA_HORKAGE_NONCQ) {
> +	if (dev->quirks & ATA_QUIRK_NONCQ) {
>  		snprintf(desc, desc_sz, "NCQ (not used)");
>  		return 0;
>  	}
>  
> -	if (dev->horkage & ATA_HORKAGE_NO_NCQ_ON_ATI &&
> +	if (dev->quirks & ATA_QUIRK_NO_NCQ_ON_ATI &&
>  	    ata_dev_check_adapter(dev, PCI_VENDOR_ID_ATI)) {
>  		snprintf(desc, desc_sz, "NCQ (not used)");
>  		return 0;
> @@ -2350,7 +2350,7 @@ static int ata_dev_config_ncq(struct ata_device *dev,
>  		dev->flags |= ATA_DFLAG_NCQ;
>  	}
>  
> -	if (!(dev->horkage & ATA_HORKAGE_BROKEN_FPDMA_AA) &&
> +	if (!(dev->quirks & ATA_QUIRK_BROKEN_FPDMA_AA) &&
>  		(ap->flags & ATA_FLAG_FPDMA_AA) &&
>  		ata_id_has_fpdma_aa(dev->id)) {
>  		err_mask = ata_dev_set_feature(dev, SETFEATURES_SATA_ENABLE,
> @@ -2360,7 +2360,7 @@ static int ata_dev_config_ncq(struct ata_device *dev,
>  				    "failed to enable AA (error_mask=0x%x)\n",
>  				    err_mask);
>  			if (err_mask != AC_ERR_DEV) {
> -				dev->horkage |= ATA_HORKAGE_BROKEN_FPDMA_AA;
> +				dev->quirks |= ATA_QUIRK_BROKEN_FPDMA_AA;
>  				return -EIO;
>  			}
>  		} else
> @@ -2689,7 +2689,7 @@ static void ata_dev_config_fua(struct ata_device *dev)
>  		goto nofua;
>  
>  	/* Ignore known bad devices and devices that lack NCQ support */
> -	if (!ata_ncq_supported(dev) || (dev->horkage & ATA_HORKAGE_NO_FUA))
> +	if (!ata_ncq_supported(dev) || (dev->quirks & ATA_QUIRK_NO_FUA))
>  		goto nofua;
>  
>  	dev->flags |= ATA_DFLAG_FUA;
> @@ -2829,11 +2829,11 @@ int ata_dev_configure(struct ata_device *dev)
>  		return 0;
>  	}
>  
> -	/* set horkage */
> -	dev->horkage |= ata_dev_blacklisted(dev);
> -	ata_force_horkage(dev);
> +	/* Set quirks */
> +	dev->quirks |= ata_dev_quirks(dev);
> +	ata_force_quirks(dev);
>  
> -	if (dev->horkage & ATA_HORKAGE_DISABLE) {
> +	if (dev->quirks & ATA_QUIRK_DISABLE) {
>  		ata_dev_info(dev, "unsupported device, disabling\n");
>  		ata_dev_disable(dev);
>  		return 0;
> @@ -2848,19 +2848,19 @@ int ata_dev_configure(struct ata_device *dev)
>  		return 0;
>  	}
>  
> -	rc = ata_do_link_spd_horkage(dev);
> +	rc = ata_do_link_spd_quirk(dev);
>  	if (rc)
>  		return rc;
>  
>  	/* some WD SATA-1 drives have issues with LPM, turn on NOLPM for them */
> -	if ((dev->horkage & ATA_HORKAGE_WD_BROKEN_LPM) &&
> +	if ((dev->quirks & ATA_QUIRK_WD_BROKEN_LPM) &&
>  	    (id[ATA_ID_SATA_CAPABILITY] & 0xe) == 0x2)
> -		dev->horkage |= ATA_HORKAGE_NOLPM;
> +		dev->quirks |= ATA_QUIRK_NOLPM;
>  
>  	if (ap->flags & ATA_FLAG_NO_LPM)
> -		dev->horkage |= ATA_HORKAGE_NOLPM;
> +		dev->quirks |= ATA_QUIRK_NOLPM;
>  
> -	if (dev->horkage & ATA_HORKAGE_NOLPM) {
> +	if (dev->quirks & ATA_QUIRK_NOLPM) {
>  		ata_dev_warn(dev, "LPM support broken, forcing max_power\n");
>  		dev->link->ap->target_lpm_policy = ATA_LPM_MAX_POWER;
>  	}
> @@ -3006,7 +3006,8 @@ int ata_dev_configure(struct ata_device *dev)
>  			cdb_intr_string = ", CDB intr";
>  		}
>  
> -		if (atapi_dmadir || (dev->horkage & ATA_HORKAGE_ATAPI_DMADIR) || atapi_id_dmadir(dev->id)) {
> +		if (atapi_dmadir || (dev->quirks & ATA_QUIRK_ATAPI_DMADIR) ||
> +		    atapi_id_dmadir(dev->id)) {
>  			dev->flags |= ATA_DFLAG_DMADIR;
>  			dma_dir_string = ", DMADIR";
>  		}
> @@ -3043,24 +3044,24 @@ int ata_dev_configure(struct ata_device *dev)
>  	if ((dev->class == ATA_DEV_ATAPI) &&
>  	    (atapi_command_packet_set(id) == TYPE_TAPE)) {
>  		dev->max_sectors = ATA_MAX_SECTORS_TAPE;
> -		dev->horkage |= ATA_HORKAGE_STUCK_ERR;
> +		dev->quirks |= ATA_QUIRK_STUCK_ERR;
>  	}
>  
> -	if (dev->horkage & ATA_HORKAGE_MAX_SEC_128)
> +	if (dev->quirks & ATA_QUIRK_MAX_SEC_128)
>  		dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,
>  					 dev->max_sectors);
>  
> -	if (dev->horkage & ATA_HORKAGE_MAX_SEC_1024)
> +	if (dev->quirks & ATA_QUIRK_MAX_SEC_1024)
>  		dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_1024,
>  					 dev->max_sectors);
>  
> -	if (dev->horkage & ATA_HORKAGE_MAX_SEC_LBA48)
> +	if (dev->quirks & ATA_QUIRK_MAX_SEC_LBA48)
>  		dev->max_sectors = ATA_MAX_SECTORS_LBA48;
>  
>  	if (ap->ops->dev_config)
>  		ap->ops->dev_config(dev);
>  
> -	if (dev->horkage & ATA_HORKAGE_DIAGNOSTIC) {
> +	if (dev->quirks & ATA_QUIRK_DIAGNOSTIC) {
>  		/* Let the user know. We don't want to disallow opens for
>  		   rescue purposes, or in case the vendor is just a blithering
>  		   idiot. Do this after the dev_config call as some controllers
> @@ -3075,7 +3076,7 @@ int ata_dev_configure(struct ata_device *dev)
>  		}
>  	}
>  
> -	if ((dev->horkage & ATA_HORKAGE_FIRMWARE_WARN) && print_info) {
> +	if ((dev->quirks & ATA_QUIRK_FIRMWARE_WARN) && print_info) {
>  		ata_dev_warn(dev, "WARNING: device requires firmware update to be fully functional\n");
>  		ata_dev_warn(dev, "         contact the vendor or visit http://ata.wiki.kernel.org\n");
>  	}
> @@ -3425,7 +3426,7 @@ static int ata_dev_set_mode(struct ata_device *dev)
>  {
>  	struct ata_port *ap = dev->link->ap;
>  	struct ata_eh_context *ehc = &dev->link->eh_context;
> -	const bool nosetxfer = dev->horkage & ATA_HORKAGE_NOSETXFER;
> +	const bool nosetxfer = dev->quirks & ATA_QUIRK_NOSETXFER;
>  	const char *dev_err_whine = "";
>  	int ign_dev_err = 0;
>  	unsigned int err_mask = 0;
> @@ -3969,7 +3970,7 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
>  	 */
>  	if (dev->n_native_sectors == n_native_sectors &&
>  	    dev->n_sectors < n_sectors && n_sectors == n_native_sectors &&
> -	    !(dev->horkage & ATA_HORKAGE_BROKEN_HPA)) {
> +	    !(dev->quirks & ATA_QUIRK_BROKEN_HPA)) {
>  		ata_dev_warn(dev,
>  			     "old n_sectors matches native, probably "
>  			     "late HPA lock, will try to unlock HPA\n");
> @@ -3987,223 +3988,223 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
>  	return rc;
>  }
>  
> -struct ata_blacklist_entry {
> +struct ata_dev_quirks_entry {
>  	const char *model_num;
>  	const char *model_rev;
> -	unsigned long horkage;
> +	unsigned int quirks;
>  };
>  
> -static const struct ata_blacklist_entry ata_device_blacklist [] = {
> +static const struct ata_dev_quirks_entry __ata_dev_quirks[] = {
>  	/* Devices with DMA related problems under Linux */
> -	{ "WDC AC11000H",	NULL,		ATA_HORKAGE_NODMA },
> -	{ "WDC AC22100H",	NULL,		ATA_HORKAGE_NODMA },
> -	{ "WDC AC32500H",	NULL,		ATA_HORKAGE_NODMA },
> -	{ "WDC AC33100H",	NULL,		ATA_HORKAGE_NODMA },
> -	{ "WDC AC31600H",	NULL,		ATA_HORKAGE_NODMA },
> -	{ "WDC AC32100H",	"24.09P07",	ATA_HORKAGE_NODMA },
> -	{ "WDC AC23200L",	"21.10N21",	ATA_HORKAGE_NODMA },
> -	{ "Compaq CRD-8241B", 	NULL,		ATA_HORKAGE_NODMA },
> -	{ "CRD-8400B",		NULL, 		ATA_HORKAGE_NODMA },
> -	{ "CRD-848[02]B",	NULL,		ATA_HORKAGE_NODMA },
> -	{ "CRD-84",		NULL,		ATA_HORKAGE_NODMA },
> -	{ "SanDisk SDP3B",	NULL,		ATA_HORKAGE_NODMA },
> -	{ "SanDisk SDP3B-64",	NULL,		ATA_HORKAGE_NODMA },
> -	{ "SANYO CD-ROM CRD",	NULL,		ATA_HORKAGE_NODMA },
> -	{ "HITACHI CDR-8",	NULL,		ATA_HORKAGE_NODMA },
> -	{ "HITACHI CDR-8[34]35",NULL,		ATA_HORKAGE_NODMA },
> -	{ "Toshiba CD-ROM XM-6202B", NULL,	ATA_HORKAGE_NODMA },
> -	{ "TOSHIBA CD-ROM XM-1702BC", NULL,	ATA_HORKAGE_NODMA },
> -	{ "CD-532E-A", 		NULL,		ATA_HORKAGE_NODMA },
> -	{ "E-IDE CD-ROM CR-840",NULL,		ATA_HORKAGE_NODMA },
> -	{ "CD-ROM Drive/F5A",	NULL,		ATA_HORKAGE_NODMA },
> -	{ "WPI CDD-820", 	NULL,		ATA_HORKAGE_NODMA },
> -	{ "SAMSUNG CD-ROM SC-148C", NULL,	ATA_HORKAGE_NODMA },
> -	{ "SAMSUNG CD-ROM SC",	NULL,		ATA_HORKAGE_NODMA },
> -	{ "ATAPI CD-ROM DRIVE 40X MAXIMUM",NULL,ATA_HORKAGE_NODMA },
> -	{ "_NEC DV5800A", 	NULL,		ATA_HORKAGE_NODMA },
> -	{ "SAMSUNG CD-ROM SN-124", "N001",	ATA_HORKAGE_NODMA },
> -	{ "Seagate STT20000A", NULL,		ATA_HORKAGE_NODMA },
> -	{ " 2GB ATA Flash Disk", "ADMA428M",	ATA_HORKAGE_NODMA },
> -	{ "VRFDFC22048UCHC-TE*", NULL,		ATA_HORKAGE_NODMA },
> +	{ "WDC AC11000H",	NULL,		ATA_QUIRK_NODMA },
> +	{ "WDC AC22100H",	NULL,		ATA_QUIRK_NODMA },
> +	{ "WDC AC32500H",	NULL,		ATA_QUIRK_NODMA },
> +	{ "WDC AC33100H",	NULL,		ATA_QUIRK_NODMA },
> +	{ "WDC AC31600H",	NULL,		ATA_QUIRK_NODMA },
> +	{ "WDC AC32100H",	"24.09P07",	ATA_QUIRK_NODMA },
> +	{ "WDC AC23200L",	"21.10N21",	ATA_QUIRK_NODMA },
> +	{ "Compaq CRD-8241B",	NULL,		ATA_QUIRK_NODMA },
> +	{ "CRD-8400B",		NULL,		ATA_QUIRK_NODMA },
> +	{ "CRD-848[02]B",	NULL,		ATA_QUIRK_NODMA },
> +	{ "CRD-84",		NULL,		ATA_QUIRK_NODMA },
> +	{ "SanDisk SDP3B",	NULL,		ATA_QUIRK_NODMA },
> +	{ "SanDisk SDP3B-64",	NULL,		ATA_QUIRK_NODMA },
> +	{ "SANYO CD-ROM CRD",	NULL,		ATA_QUIRK_NODMA },
> +	{ "HITACHI CDR-8",	NULL,		ATA_QUIRK_NODMA },
> +	{ "HITACHI CDR-8[34]35", NULL,		ATA_QUIRK_NODMA },
> +	{ "Toshiba CD-ROM XM-6202B", NULL,	ATA_QUIRK_NODMA },
> +	{ "TOSHIBA CD-ROM XM-1702BC", NULL,	ATA_QUIRK_NODMA },
> +	{ "CD-532E-A",		NULL,		ATA_QUIRK_NODMA },
> +	{ "E-IDE CD-ROM CR-840", NULL,		ATA_QUIRK_NODMA },
> +	{ "CD-ROM Drive/F5A",	NULL,		ATA_QUIRK_NODMA },
> +	{ "WPI CDD-820",	NULL,		ATA_QUIRK_NODMA },
> +	{ "SAMSUNG CD-ROM SC-148C", NULL,	ATA_QUIRK_NODMA },
> +	{ "SAMSUNG CD-ROM SC",	NULL,		ATA_QUIRK_NODMA },
> +	{ "ATAPI CD-ROM DRIVE 40X MAXIMUM", NULL, ATA_QUIRK_NODMA },
> +	{ "_NEC DV5800A",	NULL,		ATA_QUIRK_NODMA },
> +	{ "SAMSUNG CD-ROM SN-124", "N001",	ATA_QUIRK_NODMA },
> +	{ "Seagate STT20000A", NULL,		ATA_QUIRK_NODMA },
> +	{ " 2GB ATA Flash Disk", "ADMA428M",	ATA_QUIRK_NODMA },
> +	{ "VRFDFC22048UCHC-TE*", NULL,		ATA_QUIRK_NODMA },
>  	/* Odd clown on sil3726/4726 PMPs */
> -	{ "Config  Disk",	NULL,		ATA_HORKAGE_DISABLE },
> +	{ "Config  Disk",	NULL,		ATA_QUIRK_DISABLE },
>  	/* Similar story with ASMedia 1092 */
> -	{ "ASMT109x- Config",	NULL,		ATA_HORKAGE_DISABLE },
> +	{ "ASMT109x- Config",	NULL,		ATA_QUIRK_DISABLE },
>  
>  	/* Weird ATAPI devices */
> -	{ "TORiSAN DVD-ROM DRD-N216", NULL,	ATA_HORKAGE_MAX_SEC_128 },
> -	{ "QUANTUM DAT    DAT72-000", NULL,	ATA_HORKAGE_ATAPI_MOD16_DMA },
> -	{ "Slimtype DVD A  DS8A8SH", NULL,	ATA_HORKAGE_MAX_SEC_LBA48 },
> -	{ "Slimtype DVD A  DS8A9SH", NULL,	ATA_HORKAGE_MAX_SEC_LBA48 },
> +	{ "TORiSAN DVD-ROM DRD-N216", NULL,	ATA_QUIRK_MAX_SEC_128 },
> +	{ "QUANTUM DAT    DAT72-000", NULL,	ATA_QUIRK_ATAPI_MOD16_DMA },
> +	{ "Slimtype DVD A  DS8A8SH", NULL,	ATA_QUIRK_MAX_SEC_LBA48 },
> +	{ "Slimtype DVD A  DS8A9SH", NULL,	ATA_QUIRK_MAX_SEC_LBA48 },
>  
>  	/*
>  	 * Causes silent data corruption with higher max sects.
>  	 * http://lkml.kernel.org/g/x49wpy40ysk.fsf@segfault.boston.devel.redhat.com
>  	 */
> -	{ "ST380013AS",		"3.20",		ATA_HORKAGE_MAX_SEC_1024 },
> +	{ "ST380013AS",		"3.20",		ATA_QUIRK_MAX_SEC_1024 },
>  
>  	/*
>  	 * These devices time out with higher max sects.
>  	 * https://bugzilla.kernel.org/show_bug.cgi?id=121671
>  	 */
> -	{ "LITEON CX1-JB*-HP",	NULL,		ATA_HORKAGE_MAX_SEC_1024 },
> -	{ "LITEON EP1-*",	NULL,		ATA_HORKAGE_MAX_SEC_1024 },
> +	{ "LITEON CX1-JB*-HP",	NULL,		ATA_QUIRK_MAX_SEC_1024 },
> +	{ "LITEON EP1-*",	NULL,		ATA_QUIRK_MAX_SEC_1024 },
>  
>  	/* Devices we expect to fail diagnostics */
>  
>  	/* Devices where NCQ should be avoided */
>  	/* NCQ is slow */
> -	{ "WDC WD740ADFD-00",	NULL,		ATA_HORKAGE_NONCQ },
> -	{ "WDC WD740ADFD-00NLR1", NULL,		ATA_HORKAGE_NONCQ },
> +	{ "WDC WD740ADFD-00",	NULL,		ATA_QUIRK_NONCQ },
> +	{ "WDC WD740ADFD-00NLR1", NULL,		ATA_QUIRK_NONCQ },
>  	/* http://thread.gmane.org/gmane.linux.ide/14907 */
> -	{ "FUJITSU MHT2060BH",	NULL,		ATA_HORKAGE_NONCQ },
> +	{ "FUJITSU MHT2060BH",	NULL,		ATA_QUIRK_NONCQ },
>  	/* NCQ is broken */
> -	{ "Maxtor *",		"BANC*",	ATA_HORKAGE_NONCQ },
> -	{ "Maxtor 7V300F0",	"VA111630",	ATA_HORKAGE_NONCQ },
> -	{ "ST380817AS",		"3.42",		ATA_HORKAGE_NONCQ },
> -	{ "ST3160023AS",	"3.42",		ATA_HORKAGE_NONCQ },
> -	{ "OCZ CORE_SSD",	"02.10104",	ATA_HORKAGE_NONCQ },
> +	{ "Maxtor *",		"BANC*",	ATA_QUIRK_NONCQ },
> +	{ "Maxtor 7V300F0",	"VA111630",	ATA_QUIRK_NONCQ },
> +	{ "ST380817AS",		"3.42",		ATA_QUIRK_NONCQ },
> +	{ "ST3160023AS",	"3.42",		ATA_QUIRK_NONCQ },
> +	{ "OCZ CORE_SSD",	"02.10104",	ATA_QUIRK_NONCQ },
>  
>  	/* Seagate NCQ + FLUSH CACHE firmware bug */
> -	{ "ST31500341AS",	"SD1[5-9]",	ATA_HORKAGE_NONCQ |
> -						ATA_HORKAGE_FIRMWARE_WARN },
> +	{ "ST31500341AS",	"SD1[5-9]",	ATA_QUIRK_NONCQ |
> +						ATA_QUIRK_FIRMWARE_WARN },
>  
> -	{ "ST31000333AS",	"SD1[5-9]",	ATA_HORKAGE_NONCQ |
> -						ATA_HORKAGE_FIRMWARE_WARN },
> +	{ "ST31000333AS",	"SD1[5-9]",	ATA_QUIRK_NONCQ |
> +						ATA_QUIRK_FIRMWARE_WARN },
>  
> -	{ "ST3640[36]23AS",	"SD1[5-9]",	ATA_HORKAGE_NONCQ |
> -						ATA_HORKAGE_FIRMWARE_WARN },
> +	{ "ST3640[36]23AS",	"SD1[5-9]",	ATA_QUIRK_NONCQ |
> +						ATA_QUIRK_FIRMWARE_WARN },
>  
> -	{ "ST3320[68]13AS",	"SD1[5-9]",	ATA_HORKAGE_NONCQ |
> -						ATA_HORKAGE_FIRMWARE_WARN },
> +	{ "ST3320[68]13AS",	"SD1[5-9]",	ATA_QUIRK_NONCQ |
> +						ATA_QUIRK_FIRMWARE_WARN },
>  
>  	/* drives which fail FPDMA_AA activation (some may freeze afterwards)
>  	   the ST disks also have LPM issues */
> -	{ "ST1000LM024 HN-M101MBB", NULL,	ATA_HORKAGE_BROKEN_FPDMA_AA |
> -						ATA_HORKAGE_NOLPM },
> -	{ "VB0250EAVER",	"HPG7",		ATA_HORKAGE_BROKEN_FPDMA_AA },
> +	{ "ST1000LM024 HN-M101MBB", NULL,	ATA_QUIRK_BROKEN_FPDMA_AA |
> +						ATA_QUIRK_NOLPM },
> +	{ "VB0250EAVER",	"HPG7",		ATA_QUIRK_BROKEN_FPDMA_AA },
>  
>  	/* Blacklist entries taken from Silicon Image 3124/3132
>  	   Windows driver .inf file - also several Linux problem reports */
> -	{ "HTS541060G9SA00",    "MB3OC60D",     ATA_HORKAGE_NONCQ },
> -	{ "HTS541080G9SA00",    "MB4OC60D",     ATA_HORKAGE_NONCQ },
> -	{ "HTS541010G9SA00",    "MBZOC60D",     ATA_HORKAGE_NONCQ },
> +	{ "HTS541060G9SA00",    "MB3OC60D",     ATA_QUIRK_NONCQ },
> +	{ "HTS541080G9SA00",    "MB4OC60D",     ATA_QUIRK_NONCQ },
> +	{ "HTS541010G9SA00",    "MBZOC60D",     ATA_QUIRK_NONCQ },
>  
>  	/* https://bugzilla.kernel.org/show_bug.cgi?id=15573 */
> -	{ "C300-CTFDDAC128MAG",	"0001",		ATA_HORKAGE_NONCQ },
> +	{ "C300-CTFDDAC128MAG",	"0001",		ATA_QUIRK_NONCQ },
>  
>  	/* Sandisk SD7/8/9s lock up hard on large trims */
> -	{ "SanDisk SD[789]*",	NULL,		ATA_HORKAGE_MAX_TRIM_128M },
> +	{ "SanDisk SD[789]*",	NULL,		ATA_QUIRK_MAX_TRIM_128M },
>  
>  	/* devices which puke on READ_NATIVE_MAX */
> -	{ "HDS724040KLSA80",	"KFAOA20N",	ATA_HORKAGE_BROKEN_HPA },
> -	{ "WDC WD3200JD-00KLB0", "WD-WCAMR1130137", ATA_HORKAGE_BROKEN_HPA },
> -	{ "WDC WD2500JD-00HBB0", "WD-WMAL71490727", ATA_HORKAGE_BROKEN_HPA },
> -	{ "MAXTOR 6L080L4",	"A93.0500",	ATA_HORKAGE_BROKEN_HPA },
> +	{ "HDS724040KLSA80",	"KFAOA20N",	ATA_QUIRK_BROKEN_HPA },
> +	{ "WDC WD3200JD-00KLB0", "WD-WCAMR1130137", ATA_QUIRK_BROKEN_HPA },
> +	{ "WDC WD2500JD-00HBB0", "WD-WMAL71490727", ATA_QUIRK_BROKEN_HPA },
> +	{ "MAXTOR 6L080L4",	"A93.0500",	ATA_QUIRK_BROKEN_HPA },
>  
>  	/* this one allows HPA unlocking but fails IOs on the area */
> -	{ "OCZ-VERTEX",		    "1.30",	ATA_HORKAGE_BROKEN_HPA },
> +	{ "OCZ-VERTEX",		    "1.30",	ATA_QUIRK_BROKEN_HPA },
>  
>  	/* Devices which report 1 sector over size HPA */
> -	{ "ST340823A",		NULL,		ATA_HORKAGE_HPA_SIZE },
> -	{ "ST320413A",		NULL,		ATA_HORKAGE_HPA_SIZE },
> -	{ "ST310211A",		NULL,		ATA_HORKAGE_HPA_SIZE },
> +	{ "ST340823A",		NULL,		ATA_QUIRK_HPA_SIZE },
> +	{ "ST320413A",		NULL,		ATA_QUIRK_HPA_SIZE },
> +	{ "ST310211A",		NULL,		ATA_QUIRK_HPA_SIZE },
>  
>  	/* Devices which get the IVB wrong */
> -	{ "QUANTUM FIREBALLlct10 05", "A03.0900", ATA_HORKAGE_IVB },
> -	/* Maybe we should just blacklist TSSTcorp... */
> -	{ "TSSTcorp CDDVDW SH-S202[HJN]", "SB0[01]",  ATA_HORKAGE_IVB },
> +	{ "QUANTUM FIREBALLlct10 05", "A03.0900", ATA_QUIRK_IVB },
> +	/* Maybe we should just add all TSSTcorp devices... */
> +	{ "TSSTcorp CDDVDW SH-S202[HJN]", "SB0[01]",  ATA_QUIRK_IVB },
>  
>  	/* Devices that do not need bridging limits applied */
> -	{ "MTRON MSP-SATA*",		NULL,	ATA_HORKAGE_BRIDGE_OK },
> -	{ "BUFFALO HD-QSU2/R5",		NULL,	ATA_HORKAGE_BRIDGE_OK },
> +	{ "MTRON MSP-SATA*",		NULL,	ATA_QUIRK_BRIDGE_OK },
> +	{ "BUFFALO HD-QSU2/R5",		NULL,	ATA_QUIRK_BRIDGE_OK },
>  
>  	/* Devices which aren't very happy with higher link speeds */
> -	{ "WD My Book",			NULL,	ATA_HORKAGE_1_5_GBPS },
> -	{ "Seagate FreeAgent GoFlex",	NULL,	ATA_HORKAGE_1_5_GBPS },
> +	{ "WD My Book",			NULL,	ATA_QUIRK_1_5_GBPS },
> +	{ "Seagate FreeAgent GoFlex",	NULL,	ATA_QUIRK_1_5_GBPS },
>  
>  	/*
>  	 * Devices which choke on SETXFER.  Applies only if both the
>  	 * device and controller are SATA.
>  	 */
> -	{ "PIONEER DVD-RW  DVRTD08",	NULL,	ATA_HORKAGE_NOSETXFER },
> -	{ "PIONEER DVD-RW  DVRTD08A",	NULL,	ATA_HORKAGE_NOSETXFER },
> -	{ "PIONEER DVD-RW  DVR-215",	NULL,	ATA_HORKAGE_NOSETXFER },
> -	{ "PIONEER DVD-RW  DVR-212D",	NULL,	ATA_HORKAGE_NOSETXFER },
> -	{ "PIONEER DVD-RW  DVR-216D",	NULL,	ATA_HORKAGE_NOSETXFER },
> +	{ "PIONEER DVD-RW  DVRTD08",	NULL,	ATA_QUIRK_NOSETXFER },
> +	{ "PIONEER DVD-RW  DVRTD08A",	NULL,	ATA_QUIRK_NOSETXFER },
> +	{ "PIONEER DVD-RW  DVR-215",	NULL,	ATA_QUIRK_NOSETXFER },
> +	{ "PIONEER DVD-RW  DVR-212D",	NULL,	ATA_QUIRK_NOSETXFER },
> +	{ "PIONEER DVD-RW  DVR-216D",	NULL,	ATA_QUIRK_NOSETXFER },
>  
>  	/* These specific Pioneer models have LPM issues */
> -	{ "PIONEER BD-RW   BDR-207M",	NULL,	ATA_HORKAGE_NOLPM },
> -	{ "PIONEER BD-RW   BDR-205",	NULL,	ATA_HORKAGE_NOLPM },
> +	{ "PIONEER BD-RW   BDR-207M",	NULL,	ATA_QUIRK_NOLPM },
> +	{ "PIONEER BD-RW   BDR-205",	NULL,	ATA_QUIRK_NOLPM },
>  
>  	/* Crucial devices with broken LPM support */
> -	{ "CT*0BX*00SSD1",		NULL,	ATA_HORKAGE_NOLPM },
> +	{ "CT*0BX*00SSD1",		NULL,	ATA_QUIRK_NOLPM },
>  
>  	/* 512GB MX100 with MU01 firmware has both queued TRIM and LPM issues */
> -	{ "Crucial_CT512MX100*",	"MU01",	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM |
> -						ATA_HORKAGE_NOLPM },
> +	{ "Crucial_CT512MX100*",	"MU01",	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_ZERO_AFTER_TRIM |
> +						ATA_QUIRK_NOLPM },
>  	/* 512GB MX100 with newer firmware has only LPM issues */
> -	{ "Crucial_CT512MX100*",	NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM |
> -						ATA_HORKAGE_NOLPM },
> +	{ "Crucial_CT512MX100*",	NULL,	ATA_QUIRK_ZERO_AFTER_TRIM |
> +						ATA_QUIRK_NOLPM },
>  
>  	/* 480GB+ M500 SSDs have both queued TRIM and LPM issues */
> -	{ "Crucial_CT480M500*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM |
> -						ATA_HORKAGE_NOLPM },
> -	{ "Crucial_CT960M500*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM |
> -						ATA_HORKAGE_NOLPM },
> +	{ "Crucial_CT480M500*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_ZERO_AFTER_TRIM |
> +						ATA_QUIRK_NOLPM },
> +	{ "Crucial_CT960M500*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_ZERO_AFTER_TRIM |
> +						ATA_QUIRK_NOLPM },
>  
>  	/* AMD Radeon devices with broken LPM support */
> -	{ "R3SL240G",			NULL,	ATA_HORKAGE_NOLPM },
> +	{ "R3SL240G",			NULL,	ATA_QUIRK_NOLPM },
>  
>  	/* Apacer models with LPM issues */
> -	{ "Apacer AS340*",		NULL,	ATA_HORKAGE_NOLPM },
> +	{ "Apacer AS340*",		NULL,	ATA_QUIRK_NOLPM },
>  
>  	/* These specific Samsung models/firmware-revs do not handle LPM well */
> -	{ "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM },
> -	{ "SAMSUNG SSD PM830 mSATA *",  "CXM13D1Q", ATA_HORKAGE_NOLPM },
> -	{ "SAMSUNG MZ7TD256HAFV-000L9", NULL,       ATA_HORKAGE_NOLPM },
> -	{ "SAMSUNG MZ7TE512HMHP-000L1", "EXT06L0Q", ATA_HORKAGE_NOLPM },
> +	{ "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_QUIRK_NOLPM },
> +	{ "SAMSUNG SSD PM830 mSATA *",  "CXM13D1Q", ATA_QUIRK_NOLPM },
> +	{ "SAMSUNG MZ7TD256HAFV-000L9", NULL,       ATA_QUIRK_NOLPM },
> +	{ "SAMSUNG MZ7TE512HMHP-000L1", "EXT06L0Q", ATA_QUIRK_NOLPM },
>  
>  	/* devices that don't properly handle queued TRIM commands */
> -	{ "Micron_M500IT_*",		"MU01",	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM },
> -	{ "Micron_M500_*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM },
> -	{ "Micron_M5[15]0_*",		"MU01",	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM },
> -	{ "Micron_1100_*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM, },
> -	{ "Crucial_CT*M500*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM },
> -	{ "Crucial_CT*M550*",		"MU01",	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM },
> -	{ "Crucial_CT*MX100*",		"MU01",	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM },
> -	{ "Samsung SSD 840 EVO*",	NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_NO_DMA_LOG |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM },
> -	{ "Samsung SSD 840*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM },
> -	{ "Samsung SSD 850*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM },
> -	{ "Samsung SSD 860*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM |
> -						ATA_HORKAGE_NO_NCQ_ON_ATI },
> -	{ "Samsung SSD 870*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM |
> -						ATA_HORKAGE_NO_NCQ_ON_ATI },
> -	{ "SAMSUNG*MZ7LH*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM |
> -						ATA_HORKAGE_NO_NCQ_ON_ATI, },
> -	{ "FCCT*M500*",			NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
> -						ATA_HORKAGE_ZERO_AFTER_TRIM },
> +	{ "Micron_M500IT_*",		"MU01",	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_ZERO_AFTER_TRIM },
> +	{ "Micron_M500_*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_ZERO_AFTER_TRIM },
> +	{ "Micron_M5[15]0_*",		"MU01",	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_ZERO_AFTER_TRIM },
> +	{ "Micron_1100_*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_ZERO_AFTER_TRIM, },
> +	{ "Crucial_CT*M500*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_ZERO_AFTER_TRIM },
> +	{ "Crucial_CT*M550*",		"MU01",	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_ZERO_AFTER_TRIM },
> +	{ "Crucial_CT*MX100*",		"MU01",	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_ZERO_AFTER_TRIM },
> +	{ "Samsung SSD 840 EVO*",	NULL,	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_NO_DMA_LOG |
> +						ATA_QUIRK_ZERO_AFTER_TRIM },
> +	{ "Samsung SSD 840*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_ZERO_AFTER_TRIM },
> +	{ "Samsung SSD 850*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_ZERO_AFTER_TRIM },
> +	{ "Samsung SSD 860*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_ZERO_AFTER_TRIM |
> +						ATA_QUIRK_NO_NCQ_ON_ATI },
> +	{ "Samsung SSD 870*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_ZERO_AFTER_TRIM |
> +						ATA_QUIRK_NO_NCQ_ON_ATI },
> +	{ "SAMSUNG*MZ7LH*",		NULL,	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_ZERO_AFTER_TRIM |
> +						ATA_QUIRK_NO_NCQ_ON_ATI, },
> +	{ "FCCT*M500*",			NULL,	ATA_QUIRK_NO_NCQ_TRIM |
> +						ATA_QUIRK_ZERO_AFTER_TRIM },
>  
>  	/* devices that don't properly handle TRIM commands */
> -	{ "SuperSSpeed S238*",		NULL,	ATA_HORKAGE_NOTRIM },
> -	{ "M88V29*",			NULL,	ATA_HORKAGE_NOTRIM },
> +	{ "SuperSSpeed S238*",		NULL,	ATA_QUIRK_NOTRIM },
> +	{ "M88V29*",			NULL,	ATA_QUIRK_NOTRIM },
>  
>  	/*
>  	 * As defined, the DRAT (Deterministic Read After Trim) and RZAT
> @@ -4223,14 +4224,14 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
>  	 */
>  	{ "INTEL*SSDSC2MH*",		NULL,	0 },
>  
> -	{ "Micron*",			NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM },
> -	{ "Crucial*",			NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM },
> -	{ "INTEL*SSD*", 		NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM },
> -	{ "SSD*INTEL*",			NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM },
> -	{ "Samsung*SSD*",		NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM },
> -	{ "SAMSUNG*SSD*",		NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM },
> -	{ "SAMSUNG*MZ7KM*",		NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM },
> -	{ "ST[1248][0248]0[FH]*",	NULL,	ATA_HORKAGE_ZERO_AFTER_TRIM },
> +	{ "Micron*",			NULL,	ATA_QUIRK_ZERO_AFTER_TRIM },
> +	{ "Crucial*",			NULL,	ATA_QUIRK_ZERO_AFTER_TRIM },
> +	{ "INTEL*SSD*",			NULL,	ATA_QUIRK_ZERO_AFTER_TRIM },
> +	{ "SSD*INTEL*",			NULL,	ATA_QUIRK_ZERO_AFTER_TRIM },
> +	{ "Samsung*SSD*",		NULL,	ATA_QUIRK_ZERO_AFTER_TRIM },
> +	{ "SAMSUNG*SSD*",		NULL,	ATA_QUIRK_ZERO_AFTER_TRIM },
> +	{ "SAMSUNG*MZ7KM*",		NULL,	ATA_QUIRK_ZERO_AFTER_TRIM },
> +	{ "ST[1248][0248]0[FH]*",	NULL,	ATA_QUIRK_ZERO_AFTER_TRIM },
>  
>  	/*
>  	 * Some WD SATA-I drives spin up and down erratically when the link
> @@ -4241,36 +4242,36 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
>  	 *
>  	 * https://bugzilla.kernel.org/show_bug.cgi?id=57211
>  	 */
> -	{ "WDC WD800JD-*",		NULL,	ATA_HORKAGE_WD_BROKEN_LPM },
> -	{ "WDC WD1200JD-*",		NULL,	ATA_HORKAGE_WD_BROKEN_LPM },
> -	{ "WDC WD1600JD-*",		NULL,	ATA_HORKAGE_WD_BROKEN_LPM },
> -	{ "WDC WD2000JD-*",		NULL,	ATA_HORKAGE_WD_BROKEN_LPM },
> -	{ "WDC WD2500JD-*",		NULL,	ATA_HORKAGE_WD_BROKEN_LPM },
> -	{ "WDC WD3000JD-*",		NULL,	ATA_HORKAGE_WD_BROKEN_LPM },
> -	{ "WDC WD3200JD-*",		NULL,	ATA_HORKAGE_WD_BROKEN_LPM },
> +	{ "WDC WD800JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
> +	{ "WDC WD1200JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
> +	{ "WDC WD1600JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
> +	{ "WDC WD2000JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
> +	{ "WDC WD2500JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
> +	{ "WDC WD3000JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
> +	{ "WDC WD3200JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
>  
>  	/*
>  	 * This sata dom device goes on a walkabout when the ATA_LOG_DIRECTORY
>  	 * log page is accessed. Ensure we never ask for this log page with
>  	 * these devices.
>  	 */
> -	{ "SATADOM-ML 3ME",		NULL,	ATA_HORKAGE_NO_LOG_DIR },
> +	{ "SATADOM-ML 3ME",		NULL,	ATA_QUIRK_NO_LOG_DIR },
>  
>  	/* Buggy FUA */
> -	{ "Maxtor",		"BANC1G10",	ATA_HORKAGE_NO_FUA },
> -	{ "WDC*WD2500J*",	NULL,		ATA_HORKAGE_NO_FUA },
> -	{ "OCZ-VERTEX*",	NULL,		ATA_HORKAGE_NO_FUA },
> -	{ "INTEL*SSDSC2CT*",	NULL,		ATA_HORKAGE_NO_FUA },
> +	{ "Maxtor",		"BANC1G10",	ATA_QUIRK_NO_FUA },
> +	{ "WDC*WD2500J*",	NULL,		ATA_QUIRK_NO_FUA },
> +	{ "OCZ-VERTEX*",	NULL,		ATA_QUIRK_NO_FUA },
> +	{ "INTEL*SSDSC2CT*",	NULL,		ATA_QUIRK_NO_FUA },
>  
>  	/* End Marker */
>  	{ }
>  };
>  
> -static unsigned long ata_dev_blacklisted(const struct ata_device *dev)
> +static unsigned int ata_dev_quirks(const struct ata_device *dev)
>  {
>  	unsigned char model_num[ATA_ID_PROD_LEN + 1];
>  	unsigned char model_rev[ATA_ID_FW_REV_LEN + 1];
> -	const struct ata_blacklist_entry *ad = ata_device_blacklist;
> +	const struct ata_dev_quirks_entry *ad = __ata_dev_quirks;
>  
>  	ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
>  	ata_id_c_string(dev->id, model_rev, ATA_ID_FW_REV, sizeof(model_rev));
> @@ -4278,9 +4279,9 @@ static unsigned long ata_dev_blacklisted(const struct ata_device *dev)
>  	while (ad->model_num) {
>  		if (glob_match(ad->model_num, model_num)) {
>  			if (ad->model_rev == NULL)
> -				return ad->horkage;
> +				return ad->quirks;
>  			if (glob_match(ad->model_rev, model_rev))
> -				return ad->horkage;
> +				return ad->quirks;
>  		}
>  		ad++;
>  	}
> @@ -4297,7 +4298,7 @@ static bool ata_dev_nodma(const struct ata_device *dev)
>  	if ((dev->link->ap->flags & ATA_FLAG_PIO_POLLING) &&
>  	    (dev->flags & ATA_DFLAG_CDB_INTR))
>  		return true;
> -	return dev->horkage & ATA_HORKAGE_NODMA;
> +	return dev->quirks & ATA_QUIRK_NODMA;
>  }
>  
>  /**
> @@ -4310,7 +4311,7 @@ static bool ata_dev_nodma(const struct ata_device *dev)
>  
>  static int ata_is_40wire(struct ata_device *dev)
>  {
> -	if (dev->horkage & ATA_HORKAGE_IVB)
> +	if (dev->quirks & ATA_QUIRK_IVB)
>  		return ata_drive_40wire_relaxed(dev->id);
>  	return ata_drive_40wire(dev->id);
>  }
> @@ -4372,8 +4373,7 @@ static int cable_is_40wire(struct ata_port *ap)
>   *
>   *	Compute supported xfermask of @dev and store it in
>   *	dev->*_mask.  This function is responsible for applying all
> - *	known limits including host controller limits, device
> - *	blacklist, etc...
> + *	known limits including host controller limits, device quirks, etc...
>   *
>   *	LOCKING:
>   *	None.
> @@ -4589,7 +4589,7 @@ int atapi_check_dma(struct ata_queued_cmd *qc)
>  	/* Don't allow DMA if it isn't multiple of 16 bytes.  Quite a
>  	 * few ATAPI devices choke on such DMA requests.
>  	 */
> -	if (!(qc->dev->horkage & ATA_HORKAGE_ATAPI_MOD16_DMA) &&
> +	if (!(qc->dev->quirks & ATA_QUIRK_ATAPI_MOD16_DMA) &&
>  	    unlikely(qc->nbytes & 15))
>  		return 1;
>  
> @@ -5369,7 +5369,7 @@ void ata_dev_init(struct ata_device *dev)
>  	 */
>  	spin_lock_irqsave(ap->lock, flags);
>  	dev->flags &= ~ATA_DFLAG_INIT_MASK;
> -	dev->horkage = 0;
> +	dev->quirks = 0;
>  	spin_unlock_irqrestore(ap->lock, flags);
>  
>  	memset((void *)dev + ATA_DEVICE_CLEAR_BEGIN, 0,
> @@ -6298,12 +6298,12 @@ EXPORT_SYMBOL_GPL(ata_platform_remove_one);
>  	{ "no" #name,	.lflags_on	= (flags) },	\
>  	{ #name,	.lflags_off	= (flags) }
>  
> -#define force_horkage_on(name, flag)			\
> -	{ #name,	.horkage_on	= (flag) }
> +#define force_quirk_on(name, flag)			\
> +	{ #name,	.quirk_on	= (flag) }
>  
> -#define force_horkage_onoff(name, flag)			\
> -	{ "no" #name,	.horkage_on	= (flag) },	\
> -	{ #name,	.horkage_off	= (flag) }
> +#define force_quirk_onoff(name, flag)			\
> +	{ "no" #name,	.quirk_on	= (flag) },	\
> +	{ #name,	.quirk_off	= (flag) }
>  
>  static const struct ata_force_param force_tbl[] __initconst = {
>  	force_cbl(40c,			ATA_CBL_PATA40),
> @@ -6357,32 +6357,32 @@ static const struct ata_force_param force_tbl[] __initconst = {
>  	force_lflag_on(rstonce,		ATA_LFLAG_RST_ONCE),
>  	force_lflag_onoff(dbdelay,	ATA_LFLAG_NO_DEBOUNCE_DELAY),
>  
> -	force_horkage_onoff(ncq,	ATA_HORKAGE_NONCQ),
> -	force_horkage_onoff(ncqtrim,	ATA_HORKAGE_NO_NCQ_TRIM),
> -	force_horkage_onoff(ncqati,	ATA_HORKAGE_NO_NCQ_ON_ATI),
> +	force_quirk_onoff(ncq,		ATA_QUIRK_NONCQ),
> +	force_quirk_onoff(ncqtrim,	ATA_QUIRK_NO_NCQ_TRIM),
> +	force_quirk_onoff(ncqati,	ATA_QUIRK_NO_NCQ_ON_ATI),
>  
> -	force_horkage_onoff(trim,	ATA_HORKAGE_NOTRIM),
> -	force_horkage_on(trim_zero,	ATA_HORKAGE_ZERO_AFTER_TRIM),
> -	force_horkage_on(max_trim_128m, ATA_HORKAGE_MAX_TRIM_128M),
> +	force_quirk_onoff(trim,		ATA_QUIRK_NOTRIM),
> +	force_quirk_on(trim_zero,	ATA_QUIRK_ZERO_AFTER_TRIM),
> +	force_quirk_on(max_trim_128m,	ATA_QUIRK_MAX_TRIM_128M),
>  
> -	force_horkage_onoff(dma,	ATA_HORKAGE_NODMA),
> -	force_horkage_on(atapi_dmadir,	ATA_HORKAGE_ATAPI_DMADIR),
> -	force_horkage_on(atapi_mod16_dma, ATA_HORKAGE_ATAPI_MOD16_DMA),
> +	force_quirk_onoff(dma,		ATA_QUIRK_NODMA),
> +	force_quirk_on(atapi_dmadir,	ATA_QUIRK_ATAPI_DMADIR),
> +	force_quirk_on(atapi_mod16_dma,	ATA_QUIRK_ATAPI_MOD16_DMA),
>  
> -	force_horkage_onoff(dmalog,	ATA_HORKAGE_NO_DMA_LOG),
> -	force_horkage_onoff(iddevlog,	ATA_HORKAGE_NO_ID_DEV_LOG),
> -	force_horkage_onoff(logdir,	ATA_HORKAGE_NO_LOG_DIR),
> +	force_quirk_onoff(dmalog,	ATA_QUIRK_NO_DMA_LOG),
> +	force_quirk_onoff(iddevlog,	ATA_QUIRK_NO_ID_DEV_LOG),
> +	force_quirk_onoff(logdir,	ATA_QUIRK_NO_LOG_DIR),
>  
> -	force_horkage_on(max_sec_128,	ATA_HORKAGE_MAX_SEC_128),
> -	force_horkage_on(max_sec_1024,	ATA_HORKAGE_MAX_SEC_1024),
> -	force_horkage_on(max_sec_lba48,	ATA_HORKAGE_MAX_SEC_LBA48),
> +	force_quirk_on(max_sec_128,	ATA_QUIRK_MAX_SEC_128),
> +	force_quirk_on(max_sec_1024,	ATA_QUIRK_MAX_SEC_1024),
> +	force_quirk_on(max_sec_lba48,	ATA_QUIRK_MAX_SEC_LBA48),
>  
> -	force_horkage_onoff(lpm,	ATA_HORKAGE_NOLPM),
> -	force_horkage_onoff(setxfer,	ATA_HORKAGE_NOSETXFER),
> -	force_horkage_on(dump_id,	ATA_HORKAGE_DUMP_ID),
> -	force_horkage_onoff(fua,	ATA_HORKAGE_NO_FUA),
> +	force_quirk_onoff(lpm,		ATA_QUIRK_NOLPM),
> +	force_quirk_onoff(setxfer,	ATA_QUIRK_NOSETXFER),
> +	force_quirk_on(dump_id,		ATA_QUIRK_DUMP_ID),
> +	force_quirk_onoff(fua,		ATA_QUIRK_NO_FUA),
>  
> -	force_horkage_on(disable,	ATA_HORKAGE_DISABLE),
> +	force_quirk_on(disable,		ATA_QUIRK_DISABLE),
>  };
>  
>  static int __init ata_parse_force_one(char **cur,
> diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
> index 48660d445602..ecd37649d4d4 100644
> --- a/drivers/ata/libata-sata.c
> +++ b/drivers/ata/libata-sata.c
> @@ -818,7 +818,7 @@ static ssize_t ata_scsi_lpm_store(struct device *device,
>  
>  	ata_for_each_link(link, ap, EDGE) {
>  		ata_for_each_dev(dev, &ap->link, ENABLED) {
> -			if (dev->horkage & ATA_HORKAGE_NOLPM) {
> +			if (dev->quirks & ATA_QUIRK_NOLPM) {
>  				count = -EOPNOTSUPP;
>  				goto out_unlock;
>  			}
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index d6f5e25e1ed8..3a442f564b0d 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -2083,7 +2083,7 @@ static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf)
>  	if (ata_id_has_trim(args->id)) {
>  		u64 max_blocks = 65535 * ATA_MAX_TRIM_RNUM;
>  
> -		if (dev->horkage & ATA_HORKAGE_MAX_TRIM_128M)
> +		if (dev->quirks & ATA_QUIRK_MAX_TRIM_128M)
>  			max_blocks = 128 << (20 - SECTOR_SHIFT);
>  
>  		put_unaligned_be64(max_blocks, &rbuf[36]);
> @@ -2561,11 +2561,11 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
>  		rbuf[15] = lowest_aligned;
>  
>  		if (ata_id_has_trim(args->id) &&
> -		    !(dev->horkage & ATA_HORKAGE_NOTRIM)) {
> +		    !(dev->quirks & ATA_QUIRK_NOTRIM)) {
>  			rbuf[14] |= 0x80; /* LBPME */
>  
>  			if (ata_id_has_zero_after_trim(args->id) &&
> -			    dev->horkage & ATA_HORKAGE_ZERO_AFTER_TRIM) {
> +			    dev->quirks & ATA_QUIRK_ZERO_AFTER_TRIM) {
>  				ata_dev_info(dev, "Enabling discard_zeroes_data\n");
>  				rbuf[14] |= 0x40; /* LBPRZ */
>  			}
> @@ -3229,8 +3229,7 @@ static unsigned int ata_scsi_write_same_xlat(struct ata_queued_cmd *qc)
>  	}
>  	scsi_16_lba_len(cdb, &block, &n_block);
>  
> -	if (!unmap ||
> -	    (dev->horkage & ATA_HORKAGE_NOTRIM) ||
> +	if (!unmap || (dev->quirks & ATA_QUIRK_NOTRIM) ||
>  	    !ata_id_has_trim(dev->id)) {
>  		fp = 1;
>  		bp = 3;
> diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
> index 250f7dae05fd..06868ec5b1fd 100644
> --- a/drivers/ata/libata-sff.c
> +++ b/drivers/ata/libata-sff.c
> @@ -970,7 +970,7 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
>  			 * We ignore ERR here to workaround and proceed sending
>  			 * the CDB.
>  			 */
> -			if (!(qc->dev->horkage & ATA_HORKAGE_STUCK_ERR)) {
> +			if (!(qc->dev->quirks & ATA_QUIRK_STUCK_ERR)) {
>  				ata_ehi_push_desc(ehi, "ST_FIRST: "
>  					"DRQ=1 with device error, "
>  					"dev_stat 0x%X", status);
> @@ -1045,8 +1045,8 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
>  					 * IDENTIFY, it's likely a phantom
>  					 * device.  Mark hint.
>  					 */
> -					if (qc->dev->horkage &
> -					    ATA_HORKAGE_DIAGNOSTIC)
> +					if (qc->dev->quirks &
> +					    ATA_QUIRK_DIAGNOSTIC)
>  						qc->err_mask |=
>  							AC_ERR_NODEV_HINT;
>  				} else {
> @@ -1762,7 +1762,7 @@ unsigned int ata_sff_dev_classify(struct ata_device *dev, int present,
>  	/* see if device passed diags: continue and warn later */
>  	if (err == 0)
>  		/* diagnostic fail : do nothing _YET_ */
> -		dev->horkage |= ATA_HORKAGE_DIAGNOSTIC;
> +		dev->quirks |= ATA_QUIRK_DIAGNOSTIC;
>  	else if (err == 1)
>  		/* do nothing */ ;
>  	else if ((dev->devno == 0) && (err == 0x81))
> @@ -1781,7 +1781,7 @@ unsigned int ata_sff_dev_classify(struct ata_device *dev, int present,
>  		 * device signature is invalid with diagnostic
>  		 * failure.
>  		 */
> -		if (present && (dev->horkage & ATA_HORKAGE_DIAGNOSTIC))
> +		if (present && (dev->quirks & ATA_QUIRK_DIAGNOSTIC))
>  			class = ATA_DEV_ATA;
>  		else
>  			class = ATA_DEV_NONE;
> diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
> index 9e24c33388f9..48800cd0e75d 100644
> --- a/drivers/ata/libata-transport.c
> +++ b/drivers/ata/libata-transport.c
> @@ -617,10 +617,10 @@ show_ata_dev_trim(struct device *dev,
>  
>  	if (!ata_id_has_trim(ata_dev->id))
>  		mode = "unsupported";
> -	else if (ata_dev->horkage & ATA_HORKAGE_NOTRIM)
> +	else if (ata_dev->quirks & ATA_QUIRK_NOTRIM)
>  		mode = "forced_unsupported";
> -	else if (ata_dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM)
> -			mode = "forced_unqueued";
> +	else if (ata_dev->quirks & ATA_QUIRK_NO_NCQ_TRIM)
> +		mode = "forced_unqueued";
>  	else if (ata_fpdma_dsm_supported(ata_dev))
>  		mode = "queued";
>  	else
> diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
> index 2fe3fb6102ce..042f6ad1f7c6 100644
> --- a/drivers/ata/pata_it821x.c
> +++ b/drivers/ata/pata_it821x.c
> @@ -519,9 +519,9 @@ static void it821x_dev_config(struct ata_device *adev)
>  	}
>  	/* This is a controller firmware triggered funny, don't
>  	   report the drive faulty! */
> -	adev->horkage &= ~ATA_HORKAGE_DIAGNOSTIC;
> +	adev->quirks &= ~ATA_QUIRK_DIAGNOSTIC;
>  	/* No HPA in 'smart' mode */
> -	adev->horkage |= ATA_HORKAGE_BROKEN_HPA;
> +	adev->quirks |= ATA_QUIRK_BROKEN_HPA;
>  }
>  
>  /**
> diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
> index cc77c0248284..354b68ef91bc 100644
> --- a/drivers/ata/sata_sil.c
> +++ b/drivers/ata/sata_sil.c
> @@ -616,7 +616,7 @@ static void sil_dev_config(struct ata_device *dev)
>  	unsigned char model_num[ATA_ID_PROD_LEN + 1];
>  
>  	/* This controller doesn't support trim */
> -	dev->horkage |= ATA_HORKAGE_NOTRIM;
> +	dev->quirks |= ATA_QUIRK_NOTRIM;
>  
>  	ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
>  
> diff --git a/include/linux/libata.h b/include/linux/libata.h
> index 17394098bee9..05dd7038ab30 100644
> --- a/include/linux/libata.h
> +++ b/include/linux/libata.h
> @@ -362,40 +362,41 @@ enum {
>  	 */
>  	ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 8,
>  
> -	/* Horkage types. May be set by libata or controller on drives
> -	   (some horkage may be drive/controller pair dependent */
> -
> -	ATA_HORKAGE_DIAGNOSTIC	= (1 << 0),	/* Failed boot diag */
> -	ATA_HORKAGE_NODMA	= (1 << 1),	/* DMA problems */
> -	ATA_HORKAGE_NONCQ	= (1 << 2),	/* Don't use NCQ */
> -	ATA_HORKAGE_MAX_SEC_128	= (1 << 3),	/* Limit max sects to 128 */
> -	ATA_HORKAGE_BROKEN_HPA	= (1 << 4),	/* Broken HPA */
> -	ATA_HORKAGE_DISABLE	= (1 << 5),	/* Disable it */
> -	ATA_HORKAGE_HPA_SIZE	= (1 << 6),	/* native size off by one */
> -	ATA_HORKAGE_IVB		= (1 << 8),	/* cbl det validity bit bugs */
> -	ATA_HORKAGE_STUCK_ERR	= (1 << 9),	/* stuck ERR on next PACKET */
> -	ATA_HORKAGE_BRIDGE_OK	= (1 << 10),	/* no bridge limits */
> -	ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands
> -						    not multiple of 16 bytes */
> -	ATA_HORKAGE_FIRMWARE_WARN = (1 << 12),	/* firmware update warning */
> -	ATA_HORKAGE_1_5_GBPS	= (1 << 13),	/* force 1.5 Gbps */
> -	ATA_HORKAGE_NOSETXFER	= (1 << 14),	/* skip SETXFER, SATA only */
> -	ATA_HORKAGE_BROKEN_FPDMA_AA	= (1 << 15),	/* skip AA */
> -	ATA_HORKAGE_DUMP_ID	= (1 << 16),	/* dump IDENTIFY data */
> -	ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17),	/* Set max sects to 65535 */
> -	ATA_HORKAGE_ATAPI_DMADIR = (1 << 18),	/* device requires dmadir */
> -	ATA_HORKAGE_NO_NCQ_TRIM	= (1 << 19),	/* don't use queued TRIM */
> -	ATA_HORKAGE_NOLPM	= (1 << 20),	/* don't use LPM */
> -	ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21),	/* some WDs have broken LPM */
> -	ATA_HORKAGE_ZERO_AFTER_TRIM = (1 << 22),/* guarantees zero after trim */
> -	ATA_HORKAGE_NO_DMA_LOG	= (1 << 23),	/* don't use DMA for log read */
> -	ATA_HORKAGE_NOTRIM	= (1 << 24),	/* don't use TRIM */
> -	ATA_HORKAGE_MAX_SEC_1024 = (1 << 25),	/* Limit max sects to 1024 */
> -	ATA_HORKAGE_MAX_TRIM_128M = (1 << 26),	/* Limit max trim size to 128M */
> -	ATA_HORKAGE_NO_NCQ_ON_ATI = (1 << 27),	/* Disable NCQ on ATI chipset */
> -	ATA_HORKAGE_NO_ID_DEV_LOG = (1 << 28),	/* Identify device log missing */
> -	ATA_HORKAGE_NO_LOG_DIR	= (1 << 29),	/* Do not read log directory */
> -	ATA_HORKAGE_NO_FUA	= (1 << 30),	/* Do not use FUA */
> +	/*
> +	 * Quirk flags: may be set by libata or controller drivers on drives.
> +	 * Some quirks may be drive/controller pair dependent.
> +	 */
> +	ATA_QUIRK_DIAGNOSTIC	= (1 << 0),	/* Failed boot diag */
> +	ATA_QUIRK_NODMA		= (1 << 1),	/* DMA problems */
> +	ATA_QUIRK_NONCQ		= (1 << 2),	/* Do not use NCQ */
> +	ATA_QUIRK_MAX_SEC_128	= (1 << 3),	/* Limit max sects to 128 */
> +	ATA_QUIRK_BROKEN_HPA	= (1 << 4),	/* Broken HPA */
> +	ATA_QUIRK_DISABLE	= (1 << 5),	/* Disable it */
> +	ATA_QUIRK_HPA_SIZE	= (1 << 6),	/* Native size off by one */
> +	ATA_QUIRK_IVB		= (1 << 8),	/* CBL det validity bit bugs */
> +	ATA_QUIRK_STUCK_ERR	= (1 << 9),	/* Stuck ERR on next PACKET */
> +	ATA_QUIRK_BRIDGE_OK	= (1 << 10),	/* No bridge limits */
> +	ATA_QUIRK_ATAPI_MOD16_DMA = (1 << 11),	/* Use ATAPI DMA for commands */
> +						/* not multiple of 16 bytes */
> +	ATA_QUIRK_FIRMWARE_WARN = (1 << 12),	/* Firmware update warning */
> +	ATA_QUIRK_1_5_GBPS	= (1 << 13),	/* Force 1.5 Gbps */
> +	ATA_QUIRK_NOSETXFER	= (1 << 14),	/* Skip SETXFER, SATA only */
> +	ATA_QUIRK_BROKEN_FPDMA_AA = (1 << 15),	/* Skip AA */
> +	ATA_QUIRK_DUMP_ID	= (1 << 16),	/* Dump IDENTIFY data */
> +	ATA_QUIRK_MAX_SEC_LBA48 = (1 << 17),	/* Set max sects to 65535 */
> +	ATA_QUIRK_ATAPI_DMADIR	= (1 << 18),	/* Device requires dmadir */
> +	ATA_QUIRK_NO_NCQ_TRIM	= (1 << 19),	/* Do not use queued TRIM */
> +	ATA_QUIRK_NOLPM		= (1 << 20),	/* Do not use LPM */
> +	ATA_QUIRK_WD_BROKEN_LPM = (1 << 21),	/* Some WDs have broken LPM */
> +	ATA_QUIRK_ZERO_AFTER_TRIM = (1 << 22),	/* Guarantees zero after trim */
> +	ATA_QUIRK_NO_DMA_LOG	= (1 << 23),	/* Do not use DMA for log read */
> +	ATA_QUIRK_NOTRIM	= (1 << 24),	/* Do not use TRIM */
> +	ATA_QUIRK_MAX_SEC_1024	= (1 << 25),	/* Limit max sects to 1024 */
> +	ATA_QUIRK_MAX_TRIM_128M = (1 << 26),	/* Limit max trim size to 128M */
> +	ATA_QUIRK_NO_NCQ_ON_ATI = (1 << 27),	/* Disable NCQ on ATI chipset */
> +	ATA_QUIRK_NO_ID_DEV_LOG = (1 << 28),	/* Identify device log missing */
> +	ATA_QUIRK_NO_LOG_DIR	= (1 << 29),	/* Do not read log directory */
> +	ATA_QUIRK_NO_FUA	= (1 << 30),	/* Do not use FUA */
>  
>  	 /* DMA mask for user DMA control: User visible values; DO NOT
>  	    renumber */
> @@ -663,7 +664,7 @@ struct ata_cpr_log {
>  struct ata_device {
>  	struct ata_link		*link;
>  	unsigned int		devno;		/* 0 or 1 */
> -	unsigned int		horkage;	/* List of broken features */
> +	unsigned int		quirks;		/* List of broken features */
>  	unsigned long		flags;		/* ATA_DFLAG_xxx */
>  	struct scsi_device	*sdev;		/* attached SCSI device */
>  	void			*private_data;
> -- 
> 2.45.2
> 
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 05/11] ata: pata_serverworks: Do not use the term blacklist
  2024-07-26  3:19 ` [PATCH v6 05/11] ata: pata_serverworks: Do not use the term blacklist Damien Le Moal
  2024-07-26 11:12   ` Niklas Cassel
@ 2024-07-29 18:43   ` Igor Pylypiv
  1 sibling, 0 replies; 39+ messages in thread
From: Igor Pylypiv @ 2024-07-29 18:43 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide, Niklas Cassel

On Fri, Jul 26, 2024 at 12:19:48PM +0900, Damien Le Moal wrote:
> Let's not use the term blacklist in the function
> serverworks_osb4_filter() documentation comment and rather simply refer
> to what that function looks at: the list of devices with groken UDMA5.
> 
> While at it, also constify the values of the csb_bad_ata100 array.
> 
> Of note is that all of this should probably be handled using libata
> quirk mechanism but it is unclear if these UDMA5 quirks are specific
> to this controller only.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

Reviewed-by: Igor Pylypiv <ipylypiv@google.com>

Thanks,
Igor
>
> ---
>  drivers/ata/pata_serverworks.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
> index 549ff24a9823..4edddf6bcc15 100644
> --- a/drivers/ata/pata_serverworks.c
> +++ b/drivers/ata/pata_serverworks.c
> @@ -46,10 +46,11 @@
>  #define SVWKS_CSB5_REVISION_NEW	0x92 /* min PCI_REVISION_ID for UDMA5 (A2.0) */
>  #define SVWKS_CSB6_REVISION	0xa0 /* min PCI_REVISION_ID for UDMA4 (A1.0) */
>  
> -/* Seagate Barracuda ATA IV Family drives in UDMA mode 5
> - * can overrun their FIFOs when used with the CSB5 */
> -
> -static const char *csb_bad_ata100[] = {
> +/*
> + * Seagate Barracuda ATA IV Family drives in UDMA mode 5
> + * can overrun their FIFOs when used with the CSB5.
> + */
> +static const char * const csb_bad_ata100[] = {
>  	"ST320011A",
>  	"ST340016A",
>  	"ST360021A",
> @@ -163,10 +164,11 @@ static unsigned int serverworks_osb4_filter(struct ata_device *adev, unsigned in
>   *	@adev: ATA device
>   *	@mask: Mask of proposed modes
>   *
> - *	Check the blacklist and disable UDMA5 if matched
> + *	Check the list of devices with broken UDMA5 and
> + *	disable UDMA5 if matched.
>   */
> -
> -static unsigned int serverworks_csb_filter(struct ata_device *adev, unsigned int mask)
> +static unsigned int serverworks_csb_filter(struct ata_device *adev,
> +					   unsigned int mask)
>  {
>  	const char *p;
>  	char model_num[ATA_ID_PROD_LEN + 1];
> -- 
> 2.45.2
> 
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 06/11] ata: ahci: Rephrase comment to not use the term blacklist
  2024-07-26  3:19 ` [PATCH v6 06/11] ata: ahci: Rephrase comment to " Damien Le Moal
  2024-07-26 10:57   ` Niklas Cassel
@ 2024-07-29 18:43   ` Igor Pylypiv
  1 sibling, 0 replies; 39+ messages in thread
From: Igor Pylypiv @ 2024-07-29 18:43 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide, Niklas Cassel

On Fri, Jul 26, 2024 at 12:19:49PM +0900, Damien Le Moal wrote:
> Rephrase the comment for the eMachines entry in the sysids array of
> ahci_broken_suspend() to not use the term blacklist.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

Reviewed-by: Igor Pylypiv <ipylypiv@google.com>

Thanks,
Igor

> ---
>  drivers/ata/ahci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index a05c17249448..45f63b09828a 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -1370,7 +1370,7 @@ static bool ahci_broken_suspend(struct pci_dev *pdev)
>  		 * V1.03 is known to be broken.  V3.04 is known to
>  		 * work.  Between, there are V1.06, V2.06 and V3.03
>  		 * that we don't have much idea about.  For now,
> -		 * blacklist anything older than V3.04.
> +		 * assume that anything older than V3.04 is broken.
>  		 *
>  		 * http://bugzilla.kernel.org/show_bug.cgi?id=15104
>  		 */
> -- 
> 2.45.2
> 
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 07/11] ata: sata_sil: Rename sil_blacklist to sil_quirks
  2024-07-26  3:19 ` [PATCH v6 07/11] ata: sata_sil: Rename sil_blacklist to sil_quirks Damien Le Moal
  2024-07-26 11:13   ` Niklas Cassel
@ 2024-07-29 18:44   ` Igor Pylypiv
  1 sibling, 0 replies; 39+ messages in thread
From: Igor Pylypiv @ 2024-07-29 18:44 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide, Niklas Cassel

On Fri, Jul 26, 2024 at 12:19:50PM +0900, Damien Le Moal wrote:
> Rename the array sil_blacklist to sil_quirks as this name is more
> neutral and is also consistent with how this driver define quirks with
> the SIL_QUIRK_XXX flags.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

Reviewed-by: Igor Pylypiv <ipylypiv@google.com>

Thanks,
Igor

> ---
>  drivers/ata/sata_sil.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
> index 354b68ef91bc..3a99f66198a9 100644
> --- a/drivers/ata/sata_sil.c
> +++ b/drivers/ata/sata_sil.c
> @@ -128,7 +128,7 @@ static const struct pci_device_id sil_pci_tbl[] = {
>  static const struct sil_drivelist {
>  	const char *product;
>  	unsigned int quirk;
> -} sil_blacklist [] = {
> +} sil_quirks[] = {
>  	{ "ST320012AS",		SIL_QUIRK_MOD15WRITE },
>  	{ "ST330013AS",		SIL_QUIRK_MOD15WRITE },
>  	{ "ST340017AS",		SIL_QUIRK_MOD15WRITE },
> @@ -600,8 +600,8 @@ static void sil_thaw(struct ata_port *ap)
>   *	list, and apply the fixups to only the specific
>   *	devices/hosts/firmwares that need it.
>   *
> - *	20040111 - Seagate drives affected by the Mod15Write bug are blacklisted
> - *	The Maxtor quirk is in the blacklist, but I'm keeping the original
> + *	20040111 - Seagate drives affected by the Mod15Write bug are quirked
> + *	The Maxtor quirk is in sil_quirks, but I'm keeping the original
>   *	pessimistic fix for the following reasons...
>   *	- There seems to be less info on it, only one device gleaned off the
>   *	Windows	driver, maybe only one is affected.  More info would be greatly
> @@ -620,9 +620,9 @@ static void sil_dev_config(struct ata_device *dev)
>  
>  	ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
>  
> -	for (n = 0; sil_blacklist[n].product; n++)
> -		if (!strcmp(sil_blacklist[n].product, model_num)) {
> -			quirks = sil_blacklist[n].quirk;
> +	for (n = 0; sil_quirks[n].product; n++)
> +		if (!strcmp(sil_quirks[n].product, model_num)) {
> +			quirks = sil_quirks[n].quirk;
>  			break;
>  		}
>  
> -- 
> 2.45.2
> 
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 08/11] ata: ata_piix: Remove useless comment in piix_init_sidpr()
  2024-07-26  3:19 ` [PATCH v6 08/11] ata: ata_piix: Remove useless comment in piix_init_sidpr() Damien Le Moal
  2024-07-26 11:13   ` Niklas Cassel
@ 2024-07-29 18:45   ` Igor Pylypiv
  1 sibling, 0 replies; 39+ messages in thread
From: Igor Pylypiv @ 2024-07-29 18:45 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide, Niklas Cassel

On Fri, Jul 26, 2024 at 12:19:51PM +0900, Damien Le Moal wrote:
> Remove the comment using the term "blacklist" from piix_init_sidpr().
> That comment is useless given that the function piix_no_sidpr() name is
> clear about what is being checked.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

Reviewed-by: Igor Pylypiv <ipylypiv@google.com>

Thanks,
Igor

> ---
>  drivers/ata/ata_piix.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
> index ec3c5bd1f813..093b940bc953 100644
> --- a/drivers/ata/ata_piix.c
> +++ b/drivers/ata/ata_piix.c
> @@ -1446,7 +1446,6 @@ static int piix_init_sidpr(struct ata_host *host)
>  		if (hpriv->map[i] == IDE)
>  			return 0;
>  
> -	/* is it blacklisted? */
>  	if (piix_no_sidpr(host))
>  		return 0;
>  
> -- 
> 2.45.2
> 
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 09/11] ata: pata_cs5520: Rephrase file header comment
  2024-07-26  3:19 ` [PATCH v6 09/11] ata: pata_cs5520: Rephrase file header comment Damien Le Moal
  2024-07-26 11:13   ` Niklas Cassel
@ 2024-07-29 18:45   ` Igor Pylypiv
  1 sibling, 0 replies; 39+ messages in thread
From: Igor Pylypiv @ 2024-07-29 18:45 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide, Niklas Cassel

On Fri, Jul 26, 2024 at 12:19:52PM +0900, Damien Le Moal wrote:
> Remove the use of the term "blacklist". What the comment using that term
> refers to does not seem to exist at all anyway as the driver does not
> have such list but rather only a list of compatible controllers.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

Reviewed-by: Igor Pylypiv <ipylypiv@google.com>

Thanks,
Igor

> ---
>  drivers/ata/pata_cs5520.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
> index 027cf67101ef..3163c8d9cef5 100644
> --- a/drivers/ata/pata_cs5520.c
> +++ b/drivers/ata/pata_cs5520.c
> @@ -8,9 +8,9 @@
>   *	PIO mode and smarter silicon.
>   *
>   *	The practical upshot of this is that we must always tune the
> - *	drive for the right PIO mode. We must also ignore all the blacklists
> - *	and the drive bus mastering DMA information. Also to confuse matters
> - *	further we can do DMA on PIO only drives.
> + *	drive for the right PIO mode and ignore the drive bus mastering DMA
> + *	information. Also to confuse matters further we can do DMA on PIO only
> + *	drives.
>   *
>   *	DMA on the 5510 also requires we disable_hlt() during DMA on early
>   *	revisions.
> -- 
> 2.45.2
> 
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 10/11] ata: pata_hpt366: Rename hpt_dma_blacklisted()
  2024-07-26  3:19 ` [PATCH v6 10/11] ata: pata_hpt366: Rename hpt_dma_blacklisted() Damien Le Moal
  2024-07-26 11:13   ` Niklas Cassel
@ 2024-07-29 18:46   ` Igor Pylypiv
  1 sibling, 0 replies; 39+ messages in thread
From: Igor Pylypiv @ 2024-07-29 18:46 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide, Niklas Cassel

On Fri, Jul 26, 2024 at 12:19:53PM +0900, Damien Le Moal wrote:
> Rename the function hpt_dma_blacklisted() to the more neutral
> hpt_dma_broken().
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

Reviewed-by: Igor Pylypiv <ipylypiv@google.com>

Thanks,
Igor

> ---
>  drivers/ata/pata_hpt366.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
> index bdccd1ba1524..5280e9960025 100644
> --- a/drivers/ata/pata_hpt366.c
> +++ b/drivers/ata/pata_hpt366.c
> @@ -170,8 +170,8 @@ static const char * const bad_ata66_3[] = {
>  	NULL
>  };
>  
> -static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr,
> -			       const char * const list[])
> +static int hpt_dma_broken(const struct ata_device *dev, char *modestr,
> +			  const char * const list[])
>  {
>  	unsigned char model_num[ATA_ID_PROD_LEN + 1];
>  	int i;
> @@ -197,11 +197,11 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr,
>  static unsigned int hpt366_filter(struct ata_device *adev, unsigned int mask)
>  {
>  	if (adev->class == ATA_DEV_ATA) {
> -		if (hpt_dma_blacklisted(adev, "UDMA",  bad_ata33))
> +		if (hpt_dma_broken(adev, "UDMA",  bad_ata33))
>  			mask &= ~ATA_MASK_UDMA;
> -		if (hpt_dma_blacklisted(adev, "UDMA3", bad_ata66_3))
> +		if (hpt_dma_broken(adev, "UDMA3", bad_ata66_3))
>  			mask &= ~(0xF8 << ATA_SHIFT_UDMA);
> -		if (hpt_dma_blacklisted(adev, "UDMA4", bad_ata66_4))
> +		if (hpt_dma_broken(adev, "UDMA4", bad_ata66_4))
>  			mask &= ~(0xF0 << ATA_SHIFT_UDMA);
>  	} else if (adev->class == ATA_DEV_ATAPI)
>  		mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
> -- 
> 2.45.2
> 
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 11/11] ata: pata_hpt37x: Rename hpt_dma_blacklisted()
  2024-07-26  3:19 ` [PATCH v6 11/11] ata: pata_hpt37x: " Damien Le Moal
  2024-07-26 11:13   ` Niklas Cassel
@ 2024-07-29 18:47   ` Igor Pylypiv
  1 sibling, 0 replies; 39+ messages in thread
From: Igor Pylypiv @ 2024-07-29 18:47 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide, Niklas Cassel

On Fri, Jul 26, 2024 at 12:19:54PM +0900, Damien Le Moal wrote:
> Rename the function hpt_dma_blacklisted() to the more neutral
> hpt_dma_broken().
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

Reviewed-by: Igor Pylypiv <ipylypiv@google.com>

Thanks,
Igor

> ---
>  drivers/ata/pata_hpt37x.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
> index c0329cf01135..4af22b819416 100644
> --- a/drivers/ata/pata_hpt37x.c
> +++ b/drivers/ata/pata_hpt37x.c
> @@ -218,8 +218,8 @@ static u32 hpt37x_find_mode(struct ata_port *ap, int speed)
>  	return 0xffffffffU;	/* silence compiler warning */
>  }
>  
> -static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr,
> -			       const char * const list[])
> +static int hpt_dma_broken(const struct ata_device *dev, char *modestr,
> +			  const char * const list[])
>  {
>  	unsigned char model_num[ATA_ID_PROD_LEN + 1];
>  	int i;
> @@ -281,9 +281,9 @@ static const char * const bad_ata100_5[] = {
>  static unsigned int hpt370_filter(struct ata_device *adev, unsigned int mask)
>  {
>  	if (adev->class == ATA_DEV_ATA) {
> -		if (hpt_dma_blacklisted(adev, "UDMA", bad_ata33))
> +		if (hpt_dma_broken(adev, "UDMA", bad_ata33))
>  			mask &= ~ATA_MASK_UDMA;
> -		if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5))
> +		if (hpt_dma_broken(adev, "UDMA100", bad_ata100_5))
>  			mask &= ~(0xE0 << ATA_SHIFT_UDMA);
>  	}
>  	return mask;
> @@ -300,7 +300,7 @@ static unsigned int hpt370_filter(struct ata_device *adev, unsigned int mask)
>  static unsigned int hpt370a_filter(struct ata_device *adev, unsigned int mask)
>  {
>  	if (adev->class == ATA_DEV_ATA) {
> -		if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5))
> +		if (hpt_dma_broken(adev, "UDMA100", bad_ata100_5))
>  			mask &= ~(0xE0 << ATA_SHIFT_UDMA);
>  	}
>  	return mask;
> -- 
> 2.45.2
> 
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 04/11] ata: libata: Print quirks applied to devices
  2024-07-26  3:19 ` [PATCH v6 04/11] ata: libata: Print quirks applied to devices Damien Le Moal
  2024-07-26 10:47   ` Niklas Cassel
@ 2024-07-30 10:09   ` Geert Uytterhoeven
  2024-07-30 23:39     ` Damien Le Moal
  1 sibling, 1 reply; 39+ messages in thread
From: Geert Uytterhoeven @ 2024-07-30 10:09 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide, linux-renesas-soc, Niklas Cassel

 	Hi Damien,

On Fri, 26 Jul 2024, Damien Le Moal wrote:
> Introduce the function ata_dev_print_quirks() to print the quirk flags
> that will be applied to a scanned device. This new function is called
> from ata_dev_quirks() when a match on a device model or device model
> and revision is found for a device in the __ata_dev_quirks array.
>
> To implement this function, the ATA_QUIRK_ flags are redefined using
> the new enum ata_quirk which defines the bit shift for each quirk
> flag. The array of strings ata_quirk_names is used to define the name
> of each flag, which are printed by ata_dev_print_quirks().
>
> Example output for a device listed in the __ata_dev_quirks array and
> which has the ATA_QUIRK_DISABLE flag applied:
>
> [10193.461270] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
> [10193.469190] ata1.00: Model 'ASMT109x- Config', rev '2143 5', applying quirks: disable
> [10193.469195] ata1.00: unsupported device, disabling
> [10193.481564] ata1.00: disable device
>
> enum ata_quirk also defines the __ATA_QUIRK_MAX value as one plus the
> last quirk flag defined. This value is used in ata_dev_quirks() to add a
> build time check that all quirk flags fit within the unsigned int
> (32-bits) quirks field of struct ata_device.
>
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> Reviewed-by: Igor Pylypiv <ipylypiv@google.com>

Thanks for your patch, which is now commit 58157d607aecb4e0 ("ata:
libata: Print quirks applied to devices") in libata/for-next.

> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -4273,15 +4336,18 @@ static unsigned int ata_dev_quirks(const struct ata_device *dev)
> 	unsigned char model_rev[ATA_ID_FW_REV_LEN + 1];
> 	const struct ata_dev_quirks_entry *ad = __ata_dev_quirks;
>
> +	/* dev->quirks is an unsigned int. */
> +	BUILD_BUG_ON(__ATA_QUIRK_MAX > 32);
> +
> 	ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
> 	ata_id_c_string(dev->id, model_rev, ATA_ID_FW_REV, sizeof(model_rev));
>
> 	while (ad->model_num) {
> -		if (glob_match(ad->model_num, model_num)) {
> -			if (ad->model_rev == NULL)
> -				return ad->quirks;
> -			if (glob_match(ad->model_rev, model_rev))
> -				return ad->quirks;
> +		if (glob_match(ad->model_num, model_num) &&
> +		    (!ad->model_rev || glob_match(ad->model_rev, model_rev))) {
> +			ata_dev_print_quirks(dev, model_num, model_rev,
> +					     ad->quirks);
> +			return ad->quirks;
> 		}
> 		ad++;
> 	}

During boot-up on Salvator-XS (using rcar-sata), the quirk info is
printed not once, but four times.  Is that intentional?

     ata1: link resume succeeded after 1 retries
    +rcar-du feb00000.display: [drm] fb0: rcar-dudrmfb frame buffer device
     input: keys as /devices/platform/keys/input/input0
     ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
    +ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
     ata1.00: ATA-7: Maxtor 6L160M0, BANC1G10, max UDMA/133
     ata1.00: 320173056 sectors, multi 0: LBA48 NCQ (not used)
    +ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
    +ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
    +ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
     ata1.00: configured for UDMA/133
     scsi 0:0:0:0: Direct-Access     ATA      Maxtor 6L160M0   1G10 PQ: 0 ANSI: 5
     sd 0:0:0:0: [sda] 320173056 512-byte logical blocks: (164 GB/153 GiB)
     sd 0:0:0:0: [sda] Write Protect is off
     sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
     sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
     sd 0:0:0:0: [sda] Preferred minimum I/O size 512 bytes
      sda: sda1
     sd 0:0:0:0: [sda] Attached SCSI disk

During resume from s2idle or s2ram, the same info is printed again,
fourfold:

     ata1: link resume succeeded after 1 retries
     ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
    +ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
    +ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
    +ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
    +ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
     ata1.00: configured for UDMA/133
     ata1.00: Entering active power mode

Thanks!

Gr{oetje,eeting}s,

 						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
 							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 04/11] ata: libata: Print quirks applied to devices
  2024-07-30 10:09   ` Geert Uytterhoeven
@ 2024-07-30 23:39     ` Damien Le Moal
  2024-07-31  7:27       ` Geert Uytterhoeven
  0 siblings, 1 reply; 39+ messages in thread
From: Damien Le Moal @ 2024-07-30 23:39 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-ide, linux-renesas-soc, Niklas Cassel

On 7/30/24 19:09, Geert Uytterhoeven wrote:
>  	Hi Damien,
> 
> On Fri, 26 Jul 2024, Damien Le Moal wrote:
>> Introduce the function ata_dev_print_quirks() to print the quirk flags
>> that will be applied to a scanned device. This new function is called
>> from ata_dev_quirks() when a match on a device model or device model
>> and revision is found for a device in the __ata_dev_quirks array.
>>
>> To implement this function, the ATA_QUIRK_ flags are redefined using
>> the new enum ata_quirk which defines the bit shift for each quirk
>> flag. The array of strings ata_quirk_names is used to define the name
>> of each flag, which are printed by ata_dev_print_quirks().
>>
>> Example output for a device listed in the __ata_dev_quirks array and
>> which has the ATA_QUIRK_DISABLE flag applied:
>>
>> [10193.461270] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
>> [10193.469190] ata1.00: Model 'ASMT109x- Config', rev '2143 5', applying quirks: disable
>> [10193.469195] ata1.00: unsupported device, disabling
>> [10193.481564] ata1.00: disable device
>>
>> enum ata_quirk also defines the __ATA_QUIRK_MAX value as one plus the
>> last quirk flag defined. This value is used in ata_dev_quirks() to add a
>> build time check that all quirk flags fit within the unsigned int
>> (32-bits) quirks field of struct ata_device.
>>
>> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
>> Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
> 
> Thanks for your patch, which is now commit 58157d607aecb4e0 ("ata:
> libata: Print quirks applied to devices") in libata/for-next.
> 
>> --- a/drivers/ata/libata-core.c
>> +++ b/drivers/ata/libata-core.c
>> @@ -4273,15 +4336,18 @@ static unsigned int ata_dev_quirks(const struct ata_device *dev)
>> 	unsigned char model_rev[ATA_ID_FW_REV_LEN + 1];
>> 	const struct ata_dev_quirks_entry *ad = __ata_dev_quirks;
>>
>> +	/* dev->quirks is an unsigned int. */
>> +	BUILD_BUG_ON(__ATA_QUIRK_MAX > 32);
>> +
>> 	ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
>> 	ata_id_c_string(dev->id, model_rev, ATA_ID_FW_REV, sizeof(model_rev));
>>
>> 	while (ad->model_num) {
>> -		if (glob_match(ad->model_num, model_num)) {
>> -			if (ad->model_rev == NULL)
>> -				return ad->quirks;
>> -			if (glob_match(ad->model_rev, model_rev))
>> -				return ad->quirks;
>> +		if (glob_match(ad->model_num, model_num) &&
>> +		    (!ad->model_rev || glob_match(ad->model_rev, model_rev))) {
>> +			ata_dev_print_quirks(dev, model_num, model_rev,
>> +					     ad->quirks);
>> +			return ad->quirks;
>> 		}
>> 		ad++;
>> 	}
> 
> During boot-up on Salvator-XS (using rcar-sata), the quirk info is
> printed not once, but four times.  Is that intentional?

Not at all. I tested on x86 with AHCI and see this message only once. So it
could be that different drivers may need some tweaks to avoid this spamming.
Though it is strange that the initialization or resume path takes this path 4
times, meaning that the quirks are applied 4 times. Need to look into that.
What is the driver for rcar-sata ? Compatible string for it would be fine.

> 
>      ata1: link resume succeeded after 1 retries
>     +rcar-du feb00000.display: [drm] fb0: rcar-dudrmfb frame buffer device
>      input: keys as /devices/platform/keys/input/input0
>      ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
>     +ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
>      ata1.00: ATA-7: Maxtor 6L160M0, BANC1G10, max UDMA/133
>      ata1.00: 320173056 sectors, multi 0: LBA48 NCQ (not used)
>     +ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
>     +ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
>     +ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
>      ata1.00: configured for UDMA/133
>      scsi 0:0:0:0: Direct-Access     ATA      Maxtor 6L160M0   1G10 PQ: 0 ANSI: 5
>      sd 0:0:0:0: [sda] 320173056 512-byte logical blocks: (164 GB/153 GiB)
>      sd 0:0:0:0: [sda] Write Protect is off
>      sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
>      sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
>      sd 0:0:0:0: [sda] Preferred minimum I/O size 512 bytes
>       sda: sda1
>      sd 0:0:0:0: [sda] Attached SCSI disk
> 
> During resume from s2idle or s2ram, the same info is printed again,
> fourfold:
> 
>      ata1: link resume succeeded after 1 retries
>      ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
>     +ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
>     +ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
>     +ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
>     +ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
>      ata1.00: configured for UDMA/133
>      ata1.00: Entering active power mode
> 
> Thanks!
> 
> Gr{oetje,eeting}s,
> 
>  						Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>  							    -- Linus Torvalds

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 04/11] ata: libata: Print quirks applied to devices
  2024-07-30 23:39     ` Damien Le Moal
@ 2024-07-31  7:27       ` Geert Uytterhoeven
  2024-07-31  9:08         ` Damien Le Moal
  0 siblings, 1 reply; 39+ messages in thread
From: Geert Uytterhoeven @ 2024-07-31  7:27 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide, linux-renesas-soc, Niklas Cassel

Hi Damien,

On Wed, Jul 31, 2024 at 1:39 AM Damien Le Moal <dlemoal@kernel.org> wrote:
> On 7/30/24 19:09, Geert Uytterhoeven wrote:
> > On Fri, 26 Jul 2024, Damien Le Moal wrote:
> >> Introduce the function ata_dev_print_quirks() to print the quirk flags
> >> that will be applied to a scanned device. This new function is called
> >> from ata_dev_quirks() when a match on a device model or device model
> >> and revision is found for a device in the __ata_dev_quirks array.
> >>
> >> To implement this function, the ATA_QUIRK_ flags are redefined using
> >> the new enum ata_quirk which defines the bit shift for each quirk
> >> flag. The array of strings ata_quirk_names is used to define the name
> >> of each flag, which are printed by ata_dev_print_quirks().
> >>
> >> Example output for a device listed in the __ata_dev_quirks array and
> >> which has the ATA_QUIRK_DISABLE flag applied:
> >>
> >> [10193.461270] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
> >> [10193.469190] ata1.00: Model 'ASMT109x- Config', rev '2143 5', applying quirks: disable
> >> [10193.469195] ata1.00: unsupported device, disabling
> >> [10193.481564] ata1.00: disable device
> >>
> >> enum ata_quirk also defines the __ATA_QUIRK_MAX value as one plus the
> >> last quirk flag defined. This value is used in ata_dev_quirks() to add a
> >> build time check that all quirk flags fit within the unsigned int
> >> (32-bits) quirks field of struct ata_device.
> >>
> >> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> >> Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
> >
> > Thanks for your patch, which is now commit 58157d607aecb4e0 ("ata:
> > libata: Print quirks applied to devices") in libata/for-next.
> >
> > During boot-up on Salvator-XS (using rcar-sata), the quirk info is
> > printed not once, but four times.  Is that intentional?
>
> Not at all. I tested on x86 with AHCI and see this message only once. So it
> could be that different drivers may need some tweaks to avoid this spamming.
> Though it is strange that the initialization or resume path takes this path 4
> times, meaning that the quirks are applied 4 times. Need to look into that.
> What is the driver for rcar-sata ? Compatible string for it would be fine.

drivers/ata/sata_rcar.c, using renesas,rcar-gen3-sata.

I added a WARN() to ata_dev_quirks() to show backtraces:

Call trace:
 ata_dev_quirks+0x98/0x19c
 ata_dev_configure+0x74/0x12d8
 ata_eh_recover+0x8d8/0xd08
 ata_do_eh+0x50/0xa8
 ata_sff_error_handler+0xd0/0xec
 ata_bmdma_error_handler+0x7c/0x12c
 ata_scsi_port_error_handler+0xc8/0x5f8
 ata_scsi_error+0x90/0xcc
 scsi_error_handler+0x148/0x308
 kthread+0xe4/0xf4
 ret_from_fork+0x10/0x20

Call trace:
 ata_dev_quirks+0x98/0x19c
 ata_dev_configure+0xf34/0x12d8
 ata_eh_recover+0x8d8/0xd08
 ata_do_eh+0x50/0xa8
 ata_sff_error_handler+0xd0/0xec
 ata_bmdma_error_handler+0x7c/0x12c
 ata_scsi_port_error_handler+0xc8/0x5f8
 ata_scsi_error+0x90/0xcc
 scsi_error_handler+0x148/0x308
 kthread+0xe4/0xf4
 ret_from_fork+0x10/0x20

Call trace:
 ata_dev_quirks+0x98/0x19c
 ata_dev_configure+0x74/0x12d8
 ata_dev_revalidate+0xb4/0x1b8
 ata_do_set_mode+0x534/0x6bc
 ata_set_mode+0xc8/0x128
 ata_eh_recover+0x944/0xd08
 ata_do_eh+0x50/0xa8
 ata_sff_error_handler+0xd0/0xec
 ata_bmdma_error_handler+0x7c/0x12c
 ata_scsi_port_error_handler+0xc8/0x5f8
 ata_scsi_error+0x90/0xcc
 scsi_error_handler+0x148/0x308
 kthread+0xe4/0xf4
 ret_from_fork+0x10/0x20

Call trace:
 ata_dev_quirks+0x98/0x19c
 ata_dev_configure+0xf34/0x12d8
 ata_dev_revalidate+0xb4/0x1b8
 ata_do_set_mode+0x534/0x6bc
 ata_set_mode+0xc8/0x128
 ata_eh_recover+0x944/0xd08
 ata_do_eh+0x50/0xa8
 ata_sff_error_handler+0xd0/0xec
 ata_bmdma_error_handler+0x7c/0x12c
 ata_scsi_port_error_handler+0xc8/0x5f8
 ata_scsi_error+0x90/0xcc
 scsi_error_handler+0x148/0x308
 kthread+0xe4/0xf4
 ret_from_fork+0x10/0x20

The backtraces seen during s2idle are slightly different:

Call trace:
 ata_dev_quirks+0x98/0x19c
 ata_dev_configure+0x74/0x12d8
 ata_dev_revalidate+0xb4/0x1b8
 ata_eh_recover+0x7b4/0xd08
 ata_do_eh+0x50/0xa8
 ata_sff_error_handler+0xd0/0xec
 ata_bmdma_error_handler+0x7c/0x12c
 ata_scsi_port_error_handler+0xc8/0x5f8
 ata_scsi_error+0x90/0xcc
 scsi_error_handler+0x148/0x308
 kthread+0xe4/0xf4
 ret_from_fork+0x10/0x20

Call trace:
 ata_dev_quirks+0x98/0x19c
 ata_dev_configure+0xf34/0x12d8
 ata_dev_revalidate+0xb4/0x1b8
 ata_eh_recover+0x7b4/0xd08
 ata_do_eh+0x50/0xa8
 ata_sff_error_handler+0xd0/0xec
 ata_bmdma_error_handler+0x7c/0x12c
 ata_scsi_port_error_handler+0xc8/0x5f8
 ata_scsi_error+0x90/0xcc
 scsi_error_handler+0x148/0x308
 kthread+0xe4/0xf4
 ret_from_fork+0x10/0x20

Call trace:
 ata_dev_quirks+0x98/0x19c
 ata_dev_configure+0x74/0x12d8
 ata_dev_revalidate+0xb4/0x1b8
 ata_do_set_mode+0x534/0x6bc
 ata_set_mode+0xc8/0x128
 ata_eh_recover+0x944/0xd08
 ata_do_eh+0x50/0xa8
 ata_sff_error_handler+0xd0/0xec
 ata_bmdma_error_handler+0x7c/0x12c
 ata_scsi_port_error_handler+0xc8/0x5f8
 ata_scsi_error+0x90/0xcc
 scsi_error_handler+0x148/0x308
 kthread+0xe4/0xf4
 ret_from_fork+0x10/0x20

Call trace:
 ata_dev_quirks+0x98/0x19c
 ata_dev_configure+0xf34/0x12d8
 ata_dev_revalidate+0xb4/0x1b8
 ata_do_set_mode+0x534/0x6bc
 ata_set_mode+0xc8/0x128
 ata_eh_recover+0x944/0xd08
 ata_do_eh+0x50/0xa8
 ata_sff_error_handler+0xd0/0xec
 ata_bmdma_error_handler+0x7c/0x12c
 ata_scsi_port_error_handler+0xc8/0x5f8
 ata_scsi_error+0x90/0xcc
 scsi_error_handler+0x148/0x308
 kthread+0xe4/0xf4
 ret_from_fork+0x10/0x20

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 04/11] ata: libata: Print quirks applied to devices
  2024-07-31  7:27       ` Geert Uytterhoeven
@ 2024-07-31  9:08         ` Damien Le Moal
  2024-08-01  9:07           ` Geert Uytterhoeven
  0 siblings, 1 reply; 39+ messages in thread
From: Damien Le Moal @ 2024-07-31  9:08 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-ide, linux-renesas-soc, Niklas Cassel

On 7/31/24 16:27, Geert Uytterhoeven wrote:
> Hi Damien,
> 
> On Wed, Jul 31, 2024 at 1:39 AM Damien Le Moal <dlemoal@kernel.org> wrote:
>> On 7/30/24 19:09, Geert Uytterhoeven wrote:
>>> On Fri, 26 Jul 2024, Damien Le Moal wrote:
>>>> Introduce the function ata_dev_print_quirks() to print the quirk flags
>>>> that will be applied to a scanned device. This new function is called
>>>> from ata_dev_quirks() when a match on a device model or device model
>>>> and revision is found for a device in the __ata_dev_quirks array.
>>>>
>>>> To implement this function, the ATA_QUIRK_ flags are redefined using
>>>> the new enum ata_quirk which defines the bit shift for each quirk
>>>> flag. The array of strings ata_quirk_names is used to define the name
>>>> of each flag, which are printed by ata_dev_print_quirks().
>>>>
>>>> Example output for a device listed in the __ata_dev_quirks array and
>>>> which has the ATA_QUIRK_DISABLE flag applied:
>>>>
>>>> [10193.461270] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
>>>> [10193.469190] ata1.00: Model 'ASMT109x- Config', rev '2143 5', applying quirks: disable
>>>> [10193.469195] ata1.00: unsupported device, disabling
>>>> [10193.481564] ata1.00: disable device
>>>>
>>>> enum ata_quirk also defines the __ATA_QUIRK_MAX value as one plus the
>>>> last quirk flag defined. This value is used in ata_dev_quirks() to add a
>>>> build time check that all quirk flags fit within the unsigned int
>>>> (32-bits) quirks field of struct ata_device.
>>>>
>>>> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
>>>> Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
>>>
>>> Thanks for your patch, which is now commit 58157d607aecb4e0 ("ata:
>>> libata: Print quirks applied to devices") in libata/for-next.
>>>
>>> During boot-up on Salvator-XS (using rcar-sata), the quirk info is
>>> printed not once, but four times.  Is that intentional?
>>
>> Not at all. I tested on x86 with AHCI and see this message only once. So it
>> could be that different drivers may need some tweaks to avoid this spamming.
>> Though it is strange that the initialization or resume path takes this path 4
>> times, meaning that the quirks are applied 4 times. Need to look into that.
>> What is the driver for rcar-sata ? Compatible string for it would be fine.
> 
> drivers/ata/sata_rcar.c, using renesas,rcar-gen3-sata.
> 
> I added a WARN() to ata_dev_quirks() to show backtraces:
> 
> Call trace:
>  ata_dev_quirks+0x98/0x19c
>  ata_dev_configure+0x74/0x12d8
>  ata_eh_recover+0x8d8/0xd08
>  ata_do_eh+0x50/0xa8
>  ata_sff_error_handler+0xd0/0xec
>  ata_bmdma_error_handler+0x7c/0x12c
>  ata_scsi_port_error_handler+0xc8/0x5f8
>  ata_scsi_error+0x90/0xcc
>  scsi_error_handler+0x148/0x308
>  kthread+0xe4/0xf4
>  ret_from_fork+0x10/0x20

OK. So it is ata_dev_configure() being called many times from EH. Weird.
But I have not a lot of experience with the bmdma drivers.
Need to look into that.

In the meantime, can you try this ?

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 10d61c7523f0..24344de57428 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -76,7 +76,7 @@ static unsigned int ata_dev_init_params(struct ata_device *dev,
                                        u16 heads, u16 sectors);
 static unsigned int ata_dev_set_xfermode(struct ata_device *dev);
 static void ata_dev_xfermask(struct ata_device *dev);
-static unsigned int ata_dev_quirks(const struct ata_device *dev);
+static unsigned int ata_dev_quirks(struct ata_device *dev);
 
 static DEFINE_IDA(ata_ida);
 
@@ -4079,7 +4079,7 @@ static const char * const ata_quirk_names[] = {
        [__ATA_QUIRK_NO_FUA]            = "nofua",
 };
 
-static void ata_dev_print_quirks(const struct ata_device *dev,
+static void ata_dev_print_quirks(struct ata_device *dev,
                                 const char *model, const char *rev,
                                 unsigned int quirks)
 {
@@ -4087,7 +4087,7 @@ static void ata_dev_print_quirks(const struct ata_device *dev,
        size_t sz;
        char *str;
 
-       if (!quirks)
+       if (!ata_dev_print_info(dev) || !quirks)
                return;
 
        sz = 64 + ARRAY_SIZE(ata_quirk_names) * 16;
@@ -4388,7 +4388,7 @@ static const struct ata_dev_quirks_entry __ata_dev_quirks[] = {
        { }
 };
 
-static unsigned int ata_dev_quirks(const struct ata_device *dev)
+static unsigned int ata_dev_quirks(struct ata_device *dev)
 {
        unsigned char model_num[ATA_ID_PROD_LEN + 1];
        unsigned char model_rev[ATA_ID_FW_REV_LEN + 1];

That should remove the multiple prints.

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 04/11] ata: libata: Print quirks applied to devices
  2024-07-31  9:08         ` Damien Le Moal
@ 2024-08-01  9:07           ` Geert Uytterhoeven
  2024-08-01  9:25             ` Damien Le Moal
  0 siblings, 1 reply; 39+ messages in thread
From: Geert Uytterhoeven @ 2024-08-01  9:07 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide, linux-renesas-soc, Niklas Cassel

Hi Damien,

On Wed, Jul 31, 2024 at 11:08 AM Damien Le Moal <dlemoal@kernel.org> wrote:
> On 7/31/24 16:27, Geert Uytterhoeven wrote:
> > On Wed, Jul 31, 2024 at 1:39 AM Damien Le Moal <dlemoal@kernel.org> wrote:
> >> On 7/30/24 19:09, Geert Uytterhoeven wrote:
> >>> On Fri, 26 Jul 2024, Damien Le Moal wrote:
> >>>> Introduce the function ata_dev_print_quirks() to print the quirk flags
> >>>> that will be applied to a scanned device. This new function is called
> >>>> from ata_dev_quirks() when a match on a device model or device model
> >>>> and revision is found for a device in the __ata_dev_quirks array.
> >>>>
> >>>> To implement this function, the ATA_QUIRK_ flags are redefined using
> >>>> the new enum ata_quirk which defines the bit shift for each quirk
> >>>> flag. The array of strings ata_quirk_names is used to define the name
> >>>> of each flag, which are printed by ata_dev_print_quirks().
> >>>>
> >>>> Example output for a device listed in the __ata_dev_quirks array and
> >>>> which has the ATA_QUIRK_DISABLE flag applied:
> >>>>
> >>>> [10193.461270] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
> >>>> [10193.469190] ata1.00: Model 'ASMT109x- Config', rev '2143 5', applying quirks: disable
> >>>> [10193.469195] ata1.00: unsupported device, disabling
> >>>> [10193.481564] ata1.00: disable device
> >>>>
> >>>> enum ata_quirk also defines the __ATA_QUIRK_MAX value as one plus the
> >>>> last quirk flag defined. This value is used in ata_dev_quirks() to add a
> >>>> build time check that all quirk flags fit within the unsigned int
> >>>> (32-bits) quirks field of struct ata_device.
> >>>>
> >>>> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> >>>> Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
> >>>
> >>> Thanks for your patch, which is now commit 58157d607aecb4e0 ("ata:
> >>> libata: Print quirks applied to devices") in libata/for-next.
> >>>
> >>> During boot-up on Salvator-XS (using rcar-sata), the quirk info is
> >>> printed not once, but four times.  Is that intentional?
> >>
> >> Not at all. I tested on x86 with AHCI and see this message only once. So it
> >> could be that different drivers may need some tweaks to avoid this spamming.
> >> Though it is strange that the initialization or resume path takes this path 4
> >> times, meaning that the quirks are applied 4 times. Need to look into that.
> >> What is the driver for rcar-sata ? Compatible string for it would be fine.
> >
> > drivers/ata/sata_rcar.c, using renesas,rcar-gen3-sata.
> >
> > I added a WARN() to ata_dev_quirks() to show backtraces:
> >
> > Call trace:
> >  ata_dev_quirks+0x98/0x19c
> >  ata_dev_configure+0x74/0x12d8
> >  ata_eh_recover+0x8d8/0xd08
> >  ata_do_eh+0x50/0xa8
> >  ata_sff_error_handler+0xd0/0xec
> >  ata_bmdma_error_handler+0x7c/0x12c
> >  ata_scsi_port_error_handler+0xc8/0x5f8
> >  ata_scsi_error+0x90/0xcc
> >  scsi_error_handler+0x148/0x308
> >  kthread+0xe4/0xf4
> >  ret_from_fork+0x10/0x20
>
> OK. So it is ata_dev_configure() being called many times from EH. Weird.
> But I have not a lot of experience with the bmdma drivers.
> Need to look into that.
>
> In the meantime, can you try this ?
>
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c

> @@ -4087,7 +4087,7 @@ static void ata_dev_print_quirks(const struct ata_device *dev,
>         size_t sz;
>         char *str;
>
> -       if (!quirks)
> +       if (!ata_dev_print_info(dev) || !quirks)
>                 return;
>
>         sz = 64 + ARRAY_SIZE(ata_quirk_names) * 16;

Thanks, that reduces the number of quirk prints from 4 to 2 during
boot-up, and from 4 to 0 when resuming from s2idle/s2ram.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 04/11] ata: libata: Print quirks applied to devices
  2024-08-01  9:07           ` Geert Uytterhoeven
@ 2024-08-01  9:25             ` Damien Le Moal
  2024-08-01 10:05               ` Geert Uytterhoeven
  0 siblings, 1 reply; 39+ messages in thread
From: Damien Le Moal @ 2024-08-01  9:25 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-ide, linux-renesas-soc, Niklas Cassel

On 8/1/24 6:07 PM, Geert Uytterhoeven wrote:
> Hi Damien,
> 
> On Wed, Jul 31, 2024 at 11:08 AM Damien Le Moal <dlemoal@kernel.org> wrote:
>> On 7/31/24 16:27, Geert Uytterhoeven wrote:
>>> On Wed, Jul 31, 2024 at 1:39 AM Damien Le Moal <dlemoal@kernel.org> wrote:
>>>> On 7/30/24 19:09, Geert Uytterhoeven wrote:
>>>>> On Fri, 26 Jul 2024, Damien Le Moal wrote:
>>>>>> Introduce the function ata_dev_print_quirks() to print the quirk flags
>>>>>> that will be applied to a scanned device. This new function is called
>>>>>> from ata_dev_quirks() when a match on a device model or device model
>>>>>> and revision is found for a device in the __ata_dev_quirks array.
>>>>>>
>>>>>> To implement this function, the ATA_QUIRK_ flags are redefined using
>>>>>> the new enum ata_quirk which defines the bit shift for each quirk
>>>>>> flag. The array of strings ata_quirk_names is used to define the name
>>>>>> of each flag, which are printed by ata_dev_print_quirks().
>>>>>>
>>>>>> Example output for a device listed in the __ata_dev_quirks array and
>>>>>> which has the ATA_QUIRK_DISABLE flag applied:
>>>>>>
>>>>>> [10193.461270] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
>>>>>> [10193.469190] ata1.00: Model 'ASMT109x- Config', rev '2143 5', applying quirks: disable
>>>>>> [10193.469195] ata1.00: unsupported device, disabling
>>>>>> [10193.481564] ata1.00: disable device
>>>>>>
>>>>>> enum ata_quirk also defines the __ATA_QUIRK_MAX value as one plus the
>>>>>> last quirk flag defined. This value is used in ata_dev_quirks() to add a
>>>>>> build time check that all quirk flags fit within the unsigned int
>>>>>> (32-bits) quirks field of struct ata_device.
>>>>>>
>>>>>> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
>>>>>> Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
>>>>>
>>>>> Thanks for your patch, which is now commit 58157d607aecb4e0 ("ata:
>>>>> libata: Print quirks applied to devices") in libata/for-next.
>>>>>
>>>>> During boot-up on Salvator-XS (using rcar-sata), the quirk info is
>>>>> printed not once, but four times.  Is that intentional?
>>>>
>>>> Not at all. I tested on x86 with AHCI and see this message only once. So it
>>>> could be that different drivers may need some tweaks to avoid this spamming.
>>>> Though it is strange that the initialization or resume path takes this path 4
>>>> times, meaning that the quirks are applied 4 times. Need to look into that.
>>>> What is the driver for rcar-sata ? Compatible string for it would be fine.
>>>
>>> drivers/ata/sata_rcar.c, using renesas,rcar-gen3-sata.
>>>
>>> I added a WARN() to ata_dev_quirks() to show backtraces:
>>>
>>> Call trace:
>>>  ata_dev_quirks+0x98/0x19c
>>>  ata_dev_configure+0x74/0x12d8
>>>  ata_eh_recover+0x8d8/0xd08
>>>  ata_do_eh+0x50/0xa8
>>>  ata_sff_error_handler+0xd0/0xec
>>>  ata_bmdma_error_handler+0x7c/0x12c
>>>  ata_scsi_port_error_handler+0xc8/0x5f8
>>>  ata_scsi_error+0x90/0xcc
>>>  scsi_error_handler+0x148/0x308
>>>  kthread+0xe4/0xf4
>>>  ret_from_fork+0x10/0x20
>>
>> OK. So it is ata_dev_configure() being called many times from EH. Weird.
>> But I have not a lot of experience with the bmdma drivers.
>> Need to look into that.
>>
>> In the meantime, can you try this ?
>>
>> --- a/drivers/ata/libata-core.c
>> +++ b/drivers/ata/libata-core.c
> 
>> @@ -4087,7 +4087,7 @@ static void ata_dev_print_quirks(const struct ata_device *dev,
>>         size_t sz;
>>         char *str;
>>
>> -       if (!quirks)
>> +       if (!ata_dev_print_info(dev) || !quirks)
>>                 return;
>>
>>         sz = 64 + ARRAY_SIZE(ata_quirk_names) * 16;
> 
> Thanks, that reduces the number of quirk prints from 4 to 2 during
> boot-up, and from 4 to 0 when resuming from s2idle/s2ram.

2 times on boot... Hmm.. So that means that you are seeing all the probe
messages twice (and not just the quirk message), right ?

Note that I prepared a better patch for this:

commit bc021024de6034a31a818103e4a9845390ba0c47
Author: Damien Le Moal <dlemoal@kernel.org>
Date:   Thu Aug 1 18:04:22 2024 +0900

    ata: libata: Print device quirks only once

    In ata_dev_print_quirks(), return early if ata_dev_print_info() returns
    false to avoid printing a device quirks multiple times (that is, each
    time ata_dev_revalidate() is called).

    Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Fixes: 58157d607aec ("ata: libata: Print quirks applied to devices")
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index b4fdb78579c8..3fc9a68d4f45 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -160,7 +160,7 @@ MODULE_DESCRIPTION("Library module for ATA devices");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);

-static inline bool ata_dev_print_info(struct ata_device *dev)
+static inline bool ata_dev_print_info(const struct ata_device *dev)
 {
        struct ata_eh_context *ehc = &dev->link->eh_context;

@@ -4029,7 +4029,7 @@ static void ata_dev_print_quirks(const struct ata_device
*dev,
        size_t sz;
        char *str;

-       if (!quirks)
+       if (!ata_dev_print_info(dev) || !quirks)
                return;

        sz = 64 + ARRAY_SIZE(ata_quirk_names) * 16;

But if you prefer to see the quirk message only once, then I will need to
change this and use a flag to remember that quirk info has been printed
already. But in your case, I suspect you see all probe messages twice, no ?


-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 04/11] ata: libata: Print quirks applied to devices
  2024-08-01  9:25             ` Damien Le Moal
@ 2024-08-01 10:05               ` Geert Uytterhoeven
  2024-08-01 10:08                 ` Damien Le Moal
  2024-08-01 10:42                 ` Damien Le Moal
  0 siblings, 2 replies; 39+ messages in thread
From: Geert Uytterhoeven @ 2024-08-01 10:05 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide, linux-renesas-soc, Niklas Cassel

Hi Damien,

On Thu, Aug 1, 2024 at 11:25 AM Damien Le Moal <dlemoal@kernel.org> wrote:
> On 8/1/24 6:07 PM, Geert Uytterhoeven wrote:
> > On Wed, Jul 31, 2024 at 11:08 AM Damien Le Moal <dlemoal@kernel.org> wrote:
> >> On 7/31/24 16:27, Geert Uytterhoeven wrote:
> >>> On Wed, Jul 31, 2024 at 1:39 AM Damien Le Moal <dlemoal@kernel.org> wrote:
> >>>> On 7/30/24 19:09, Geert Uytterhoeven wrote:
> >>>>> On Fri, 26 Jul 2024, Damien Le Moal wrote:
> >>>>>> Introduce the function ata_dev_print_quirks() to print the quirk flags
> >>>>>> that will be applied to a scanned device. This new function is called
> >>>>>> from ata_dev_quirks() when a match on a device model or device model
> >>>>>> and revision is found for a device in the __ata_dev_quirks array.
> >>>>>>
> >>>>>> To implement this function, the ATA_QUIRK_ flags are redefined using
> >>>>>> the new enum ata_quirk which defines the bit shift for each quirk
> >>>>>> flag. The array of strings ata_quirk_names is used to define the name
> >>>>>> of each flag, which are printed by ata_dev_print_quirks().
> >>>>>>
> >>>>>> Example output for a device listed in the __ata_dev_quirks array and
> >>>>>> which has the ATA_QUIRK_DISABLE flag applied:
> >>>>>>
> >>>>>> [10193.461270] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
> >>>>>> [10193.469190] ata1.00: Model 'ASMT109x- Config', rev '2143 5', applying quirks: disable
> >>>>>> [10193.469195] ata1.00: unsupported device, disabling
> >>>>>> [10193.481564] ata1.00: disable device
> >>>>>>
> >>>>>> enum ata_quirk also defines the __ATA_QUIRK_MAX value as one plus the
> >>>>>> last quirk flag defined. This value is used in ata_dev_quirks() to add a
> >>>>>> build time check that all quirk flags fit within the unsigned int
> >>>>>> (32-bits) quirks field of struct ata_device.
> >>>>>>
> >>>>>> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> >>>>>> Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
> >>>>>
> >>>>> Thanks for your patch, which is now commit 58157d607aecb4e0 ("ata:
> >>>>> libata: Print quirks applied to devices") in libata/for-next.
> >>>>>
> >>>>> During boot-up on Salvator-XS (using rcar-sata), the quirk info is
> >>>>> printed not once, but four times.  Is that intentional?
> >>>>
> >>>> Not at all. I tested on x86 with AHCI and see this message only once. So it
> >>>> could be that different drivers may need some tweaks to avoid this spamming.
> >>>> Though it is strange that the initialization or resume path takes this path 4
> >>>> times, meaning that the quirks are applied 4 times. Need to look into that.
> >>>> What is the driver for rcar-sata ? Compatible string for it would be fine.
> >>>
> >>> drivers/ata/sata_rcar.c, using renesas,rcar-gen3-sata.
> >>>
> >>> I added a WARN() to ata_dev_quirks() to show backtraces:
> >>>
> >>> Call trace:
> >>>  ata_dev_quirks+0x98/0x19c
> >>>  ata_dev_configure+0x74/0x12d8
> >>>  ata_eh_recover+0x8d8/0xd08
> >>>  ata_do_eh+0x50/0xa8
> >>>  ata_sff_error_handler+0xd0/0xec
> >>>  ata_bmdma_error_handler+0x7c/0x12c
> >>>  ata_scsi_port_error_handler+0xc8/0x5f8
> >>>  ata_scsi_error+0x90/0xcc
> >>>  scsi_error_handler+0x148/0x308
> >>>  kthread+0xe4/0xf4
> >>>  ret_from_fork+0x10/0x20
> >>
> >> OK. So it is ata_dev_configure() being called many times from EH. Weird.
> >> But I have not a lot of experience with the bmdma drivers.
> >> Need to look into that.
> >>
> >> In the meantime, can you try this ?
> >>
> >> --- a/drivers/ata/libata-core.c
> >> +++ b/drivers/ata/libata-core.c
> >
> >> @@ -4087,7 +4087,7 @@ static void ata_dev_print_quirks(const struct ata_device *dev,
> >>         size_t sz;
> >>         char *str;
> >>
> >> -       if (!quirks)
> >> +       if (!ata_dev_print_info(dev) || !quirks)
> >>                 return;
> >>
> >>         sz = 64 + ARRAY_SIZE(ata_quirk_names) * 16;
> >
> > Thanks, that reduces the number of quirk prints from 4 to 2 during
> > boot-up, and from 4 to 0 when resuming from s2idle/s2ram.
>
> 2 times on boot... Hmm.. So that means that you are seeing all the probe
> messages twice (and not just the quirk message), right ?

No, I do not see all probe messages twice.

$ grep ^ata dmesg:

ata1: SATA max UDMA/133 irq 128 lpm-pol 0
ata1: link resume succeeded after 1 retries
ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
ata1.00: ATA-7: Maxtor 6L160M0, BANC1G10, max UDMA/133
ata1.00: 320173056 sectors, multi 0: LBA48 NCQ (not used)
ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
ata1.00: configured for UDMA/133

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 04/11] ata: libata: Print quirks applied to devices
  2024-08-01 10:05               ` Geert Uytterhoeven
@ 2024-08-01 10:08                 ` Damien Le Moal
  2024-08-01 10:42                 ` Damien Le Moal
  1 sibling, 0 replies; 39+ messages in thread
From: Damien Le Moal @ 2024-08-01 10:08 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-ide, linux-renesas-soc, Niklas Cassel

On 8/1/24 7:05 PM, Geert Uytterhoeven wrote:
> Hi Damien,
> 
> On Thu, Aug 1, 2024 at 11:25 AM Damien Le Moal <dlemoal@kernel.org> wrote:
>> On 8/1/24 6:07 PM, Geert Uytterhoeven wrote:
>>> On Wed, Jul 31, 2024 at 11:08 AM Damien Le Moal <dlemoal@kernel.org> wrote:
>>>> On 7/31/24 16:27, Geert Uytterhoeven wrote:
>>>>> On Wed, Jul 31, 2024 at 1:39 AM Damien Le Moal <dlemoal@kernel.org> wrote:
>>>>>> On 7/30/24 19:09, Geert Uytterhoeven wrote:
>>>>>>> On Fri, 26 Jul 2024, Damien Le Moal wrote:
>>>>>>>> Introduce the function ata_dev_print_quirks() to print the quirk flags
>>>>>>>> that will be applied to a scanned device. This new function is called
>>>>>>>> from ata_dev_quirks() when a match on a device model or device model
>>>>>>>> and revision is found for a device in the __ata_dev_quirks array.
>>>>>>>>
>>>>>>>> To implement this function, the ATA_QUIRK_ flags are redefined using
>>>>>>>> the new enum ata_quirk which defines the bit shift for each quirk
>>>>>>>> flag. The array of strings ata_quirk_names is used to define the name
>>>>>>>> of each flag, which are printed by ata_dev_print_quirks().
>>>>>>>>
>>>>>>>> Example output for a device listed in the __ata_dev_quirks array and
>>>>>>>> which has the ATA_QUIRK_DISABLE flag applied:
>>>>>>>>
>>>>>>>> [10193.461270] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
>>>>>>>> [10193.469190] ata1.00: Model 'ASMT109x- Config', rev '2143 5', applying quirks: disable
>>>>>>>> [10193.469195] ata1.00: unsupported device, disabling
>>>>>>>> [10193.481564] ata1.00: disable device
>>>>>>>>
>>>>>>>> enum ata_quirk also defines the __ATA_QUIRK_MAX value as one plus the
>>>>>>>> last quirk flag defined. This value is used in ata_dev_quirks() to add a
>>>>>>>> build time check that all quirk flags fit within the unsigned int
>>>>>>>> (32-bits) quirks field of struct ata_device.
>>>>>>>>
>>>>>>>> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
>>>>>>>> Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
>>>>>>>
>>>>>>> Thanks for your patch, which is now commit 58157d607aecb4e0 ("ata:
>>>>>>> libata: Print quirks applied to devices") in libata/for-next.
>>>>>>>
>>>>>>> During boot-up on Salvator-XS (using rcar-sata), the quirk info is
>>>>>>> printed not once, but four times.  Is that intentional?
>>>>>>
>>>>>> Not at all. I tested on x86 with AHCI and see this message only once. So it
>>>>>> could be that different drivers may need some tweaks to avoid this spamming.
>>>>>> Though it is strange that the initialization or resume path takes this path 4
>>>>>> times, meaning that the quirks are applied 4 times. Need to look into that.
>>>>>> What is the driver for rcar-sata ? Compatible string for it would be fine.
>>>>>
>>>>> drivers/ata/sata_rcar.c, using renesas,rcar-gen3-sata.
>>>>>
>>>>> I added a WARN() to ata_dev_quirks() to show backtraces:
>>>>>
>>>>> Call trace:
>>>>>  ata_dev_quirks+0x98/0x19c
>>>>>  ata_dev_configure+0x74/0x12d8
>>>>>  ata_eh_recover+0x8d8/0xd08
>>>>>  ata_do_eh+0x50/0xa8
>>>>>  ata_sff_error_handler+0xd0/0xec
>>>>>  ata_bmdma_error_handler+0x7c/0x12c
>>>>>  ata_scsi_port_error_handler+0xc8/0x5f8
>>>>>  ata_scsi_error+0x90/0xcc
>>>>>  scsi_error_handler+0x148/0x308
>>>>>  kthread+0xe4/0xf4
>>>>>  ret_from_fork+0x10/0x20
>>>>
>>>> OK. So it is ata_dev_configure() being called many times from EH. Weird.
>>>> But I have not a lot of experience with the bmdma drivers.
>>>> Need to look into that.
>>>>
>>>> In the meantime, can you try this ?
>>>>
>>>> --- a/drivers/ata/libata-core.c
>>>> +++ b/drivers/ata/libata-core.c
>>>
>>>> @@ -4087,7 +4087,7 @@ static void ata_dev_print_quirks(const struct ata_device *dev,
>>>>         size_t sz;
>>>>         char *str;
>>>>
>>>> -       if (!quirks)
>>>> +       if (!ata_dev_print_info(dev) || !quirks)
>>>>                 return;
>>>>
>>>>         sz = 64 + ARRAY_SIZE(ata_quirk_names) * 16;
>>>
>>> Thanks, that reduces the number of quirk prints from 4 to 2 during
>>> boot-up, and from 4 to 0 when resuming from s2idle/s2ram.
>>
>> 2 times on boot... Hmm.. So that means that you are seeing all the probe
>> messages twice (and not just the quirk message), right ?
> 
> No, I do not see all probe messages twice.
> 
> $ grep ^ata dmesg:
> 
> ata1: SATA max UDMA/133 irq 128 lpm-pol 0
> ata1: link resume succeeded after 1 retries
> ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
> ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
> ata1.00: ATA-7: Maxtor 6L160M0, BANC1G10, max UDMA/133
> ata1.00: 320173056 sectors, multi 0: LBA48 NCQ (not used)
> ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
> ata1.00: configured for UDMA/133

Odd. I am missing something... Let me dig into that.

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 04/11] ata: libata: Print quirks applied to devices
  2024-08-01 10:05               ` Geert Uytterhoeven
  2024-08-01 10:08                 ` Damien Le Moal
@ 2024-08-01 10:42                 ` Damien Le Moal
  2024-08-01 15:04                   ` Geert Uytterhoeven
  1 sibling, 1 reply; 39+ messages in thread
From: Damien Le Moal @ 2024-08-01 10:42 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-ide, linux-renesas-soc, Niklas Cassel

On 8/1/24 7:05 PM, Geert Uytterhoeven wrote:
> Hi Damien,
> 
> On Thu, Aug 1, 2024 at 11:25 AM Damien Le Moal <dlemoal@kernel.org> wrote:
>> On 8/1/24 6:07 PM, Geert Uytterhoeven wrote:
>>> On Wed, Jul 31, 2024 at 11:08 AM Damien Le Moal <dlemoal@kernel.org> wrote:
>>>> On 7/31/24 16:27, Geert Uytterhoeven wrote:
>>>>> On Wed, Jul 31, 2024 at 1:39 AM Damien Le Moal <dlemoal@kernel.org> wrote:
>>>>>> On 7/30/24 19:09, Geert Uytterhoeven wrote:
>>>>>>> On Fri, 26 Jul 2024, Damien Le Moal wrote:
>>>>>>>> Introduce the function ata_dev_print_quirks() to print the quirk flags
>>>>>>>> that will be applied to a scanned device. This new function is called
>>>>>>>> from ata_dev_quirks() when a match on a device model or device model
>>>>>>>> and revision is found for a device in the __ata_dev_quirks array.
>>>>>>>>
>>>>>>>> To implement this function, the ATA_QUIRK_ flags are redefined using
>>>>>>>> the new enum ata_quirk which defines the bit shift for each quirk
>>>>>>>> flag. The array of strings ata_quirk_names is used to define the name
>>>>>>>> of each flag, which are printed by ata_dev_print_quirks().
>>>>>>>>
>>>>>>>> Example output for a device listed in the __ata_dev_quirks array and
>>>>>>>> which has the ATA_QUIRK_DISABLE flag applied:
>>>>>>>>
>>>>>>>> [10193.461270] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
>>>>>>>> [10193.469190] ata1.00: Model 'ASMT109x- Config', rev '2143 5', applying quirks: disable
>>>>>>>> [10193.469195] ata1.00: unsupported device, disabling
>>>>>>>> [10193.481564] ata1.00: disable device
>>>>>>>>
>>>>>>>> enum ata_quirk also defines the __ATA_QUIRK_MAX value as one plus the
>>>>>>>> last quirk flag defined. This value is used in ata_dev_quirks() to add a
>>>>>>>> build time check that all quirk flags fit within the unsigned int
>>>>>>>> (32-bits) quirks field of struct ata_device.
>>>>>>>>
>>>>>>>> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
>>>>>>>> Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
>>>>>>>
>>>>>>> Thanks for your patch, which is now commit 58157d607aecb4e0 ("ata:
>>>>>>> libata: Print quirks applied to devices") in libata/for-next.
>>>>>>>
>>>>>>> During boot-up on Salvator-XS (using rcar-sata), the quirk info is
>>>>>>> printed not once, but four times.  Is that intentional?
>>>>>>
>>>>>> Not at all. I tested on x86 with AHCI and see this message only once. So it
>>>>>> could be that different drivers may need some tweaks to avoid this spamming.
>>>>>> Though it is strange that the initialization or resume path takes this path 4
>>>>>> times, meaning that the quirks are applied 4 times. Need to look into that.
>>>>>> What is the driver for rcar-sata ? Compatible string for it would be fine.
>>>>>
>>>>> drivers/ata/sata_rcar.c, using renesas,rcar-gen3-sata.
>>>>>
>>>>> I added a WARN() to ata_dev_quirks() to show backtraces:
>>>>>
>>>>> Call trace:
>>>>>  ata_dev_quirks+0x98/0x19c
>>>>>  ata_dev_configure+0x74/0x12d8
>>>>>  ata_eh_recover+0x8d8/0xd08
>>>>>  ata_do_eh+0x50/0xa8
>>>>>  ata_sff_error_handler+0xd0/0xec
>>>>>  ata_bmdma_error_handler+0x7c/0x12c
>>>>>  ata_scsi_port_error_handler+0xc8/0x5f8
>>>>>  ata_scsi_error+0x90/0xcc
>>>>>  scsi_error_handler+0x148/0x308
>>>>>  kthread+0xe4/0xf4
>>>>>  ret_from_fork+0x10/0x20
>>>>
>>>> OK. So it is ata_dev_configure() being called many times from EH. Weird.
>>>> But I have not a lot of experience with the bmdma drivers.
>>>> Need to look into that.
>>>>
>>>> In the meantime, can you try this ?
>>>>
>>>> --- a/drivers/ata/libata-core.c
>>>> +++ b/drivers/ata/libata-core.c
>>>
>>>> @@ -4087,7 +4087,7 @@ static void ata_dev_print_quirks(const struct ata_device *dev,
>>>>         size_t sz;
>>>>         char *str;
>>>>
>>>> -       if (!quirks)
>>>> +       if (!ata_dev_print_info(dev) || !quirks)
>>>>                 return;
>>>>
>>>>         sz = 64 + ARRAY_SIZE(ata_quirk_names) * 16;
>>>
>>> Thanks, that reduces the number of quirk prints from 4 to 2 during
>>> boot-up, and from 4 to 0 when resuming from s2idle/s2ram.
>>
>> 2 times on boot... Hmm.. So that means that you are seeing all the probe
>> messages twice (and not just the quirk message), right ?
> 
> No, I do not see all probe messages twice.
> 
> $ grep ^ata dmesg:
> 
> ata1: SATA max UDMA/133 irq 128 lpm-pol 0
> ata1: link resume succeeded after 1 retries
> ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
> ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
> ata1.00: ATA-7: Maxtor 6L160M0, BANC1G10, max UDMA/133
> ata1.00: 320173056 sectors, multi 0: LBA48 NCQ (not used)
> ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
> ata1.00: configured for UDMA/133

OK. This path should get rid of the useless extra print:

commit 3c65fcbf942c26ece6d1efef7ad1405c0163575f
Author: Damien Le Moal <dlemoal@kernel.org>
Date:   Thu Aug 1 18:04:22 2024 +0900

    ata: libata: Print device quirks only once
    
    In ata_dev_print_quirks(), return early if ata_dev_print_info() returns
    false or if we already printed quirk information. This is to avoid
    printing a device quirks multiple times (that is, each time
    ata_dev_revalidate() is called).
    
    To remember if ata_dev_print_quirks() was already executed, define the
    EH context flag ATA_EHI_DID_QUIRK_PRINT and set this flag in
    ata_dev_print_quirks().
    
    Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Fixes: 58157d607aec ("ata: libata: Print quirks applied to devices")
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index b4fdb78579c8..2309927b7c23 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -160,7 +160,7 @@ MODULE_DESCRIPTION("Library module for ATA devices");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
 
-static inline bool ata_dev_print_info(struct ata_device *dev)
+static inline bool ata_dev_print_info(const struct ata_device *dev)
 {
        struct ata_eh_context *ehc = &dev->link->eh_context;
 
@@ -4025,10 +4025,16 @@ static void ata_dev_print_quirks(const struct ata_device *dev,
                                 const char *model, const char *rev,
                                 unsigned int quirks)
 {
+       struct ata_eh_context *ehc = &dev->link->eh_context;
        int n = 0, i;
        size_t sz;
        char *str;
 
+       if (!ata_dev_print_info(dev) || ehc->i.flags & ATA_EHI_DID_QUIRK_PRINT)
+               return;
+
+       ehc->i.flags |= ATA_EHI_DID_QUIRK_PRINT;
+
        if (!quirks)
                return;
 
diff --git a/include/linux/libata.h b/include/linux/libata.h
index d5446e18d9df..f8fb9bc7c743 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -378,6 +378,7 @@ enum {
        ATA_EHI_PRINTINFO       = (1 << 18), /* print configuration info */
        ATA_EHI_SETMODE         = (1 << 19), /* configure transfer mode */
        ATA_EHI_POST_SETMODE    = (1 << 20), /* revalidating after setmode */
+       ATA_EHI_DID_QUIRK_PRINT = (1 << 21), /* already printed quirk info */
 
        ATA_EHI_DID_RESET       = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET,

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* Re: [PATCH v6 04/11] ata: libata: Print quirks applied to devices
  2024-08-01 10:42                 ` Damien Le Moal
@ 2024-08-01 15:04                   ` Geert Uytterhoeven
  0 siblings, 0 replies; 39+ messages in thread
From: Geert Uytterhoeven @ 2024-08-01 15:04 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide, linux-renesas-soc, Niklas Cassel

Hi Damien,

On Thu, Aug 1, 2024 at 12:42 PM Damien Le Moal <dlemoal@kernel.org> wrote:
> On 8/1/24 7:05 PM, Geert Uytterhoeven wrote:
> > On Thu, Aug 1, 2024 at 11:25 AM Damien Le Moal <dlemoal@kernel.org> wrote:
> >> On 8/1/24 6:07 PM, Geert Uytterhoeven wrote:
> >>> On Wed, Jul 31, 2024 at 11:08 AM Damien Le Moal <dlemoal@kernel.org> wrote:
> >>>> On 7/31/24 16:27, Geert Uytterhoeven wrote:
> >>>>> On Wed, Jul 31, 2024 at 1:39 AM Damien Le Moal <dlemoal@kernel.org> wrote:
> >>>>>> On 7/30/24 19:09, Geert Uytterhoeven wrote:
> >>>>>>> On Fri, 26 Jul 2024, Damien Le Moal wrote:
> >>>>>>>> Introduce the function ata_dev_print_quirks() to print the quirk flags
> >>>>>>>> that will be applied to a scanned device. This new function is called
> >>>>>>>> from ata_dev_quirks() when a match on a device model or device model
> >>>>>>>> and revision is found for a device in the __ata_dev_quirks array.
> >>>>>>>>
> >>>>>>>> To implement this function, the ATA_QUIRK_ flags are redefined using
> >>>>>>>> the new enum ata_quirk which defines the bit shift for each quirk
> >>>>>>>> flag. The array of strings ata_quirk_names is used to define the name
> >>>>>>>> of each flag, which are printed by ata_dev_print_quirks().
> >>>>>>>>
> >>>>>>>> Example output for a device listed in the __ata_dev_quirks array and
> >>>>>>>> which has the ATA_QUIRK_DISABLE flag applied:
> >>>>>>>>
> >>>>>>>> [10193.461270] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
> >>>>>>>> [10193.469190] ata1.00: Model 'ASMT109x- Config', rev '2143 5', applying quirks: disable
> >>>>>>>> [10193.469195] ata1.00: unsupported device, disabling
> >>>>>>>> [10193.481564] ata1.00: disable device
> >>>>>>>>
> >>>>>>>> enum ata_quirk also defines the __ATA_QUIRK_MAX value as one plus the
> >>>>>>>> last quirk flag defined. This value is used in ata_dev_quirks() to add a
> >>>>>>>> build time check that all quirk flags fit within the unsigned int
> >>>>>>>> (32-bits) quirks field of struct ata_device.
> >>>>>>>>
> >>>>>>>> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> >>>>>>>> Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
> >>>>>>>
> >>>>>>> Thanks for your patch, which is now commit 58157d607aecb4e0 ("ata:
> >>>>>>> libata: Print quirks applied to devices") in libata/for-next.
> >>>>>>>
> >>>>>>> During boot-up on Salvator-XS (using rcar-sata), the quirk info is
> >>>>>>> printed not once, but four times.  Is that intentional?
> >>>>>>
> >>>>>> Not at all. I tested on x86 with AHCI and see this message only once. So it
> >>>>>> could be that different drivers may need some tweaks to avoid this spamming.
> >>>>>> Though it is strange that the initialization or resume path takes this path 4
> >>>>>> times, meaning that the quirks are applied 4 times. Need to look into that.
> >>>>>> What is the driver for rcar-sata ? Compatible string for it would be fine.
> >>>>>
> >>>>> drivers/ata/sata_rcar.c, using renesas,rcar-gen3-sata.
> >>>>>
> >>>>> I added a WARN() to ata_dev_quirks() to show backtraces:
> >>>>>
> >>>>> Call trace:
> >>>>>  ata_dev_quirks+0x98/0x19c
> >>>>>  ata_dev_configure+0x74/0x12d8
> >>>>>  ata_eh_recover+0x8d8/0xd08
> >>>>>  ata_do_eh+0x50/0xa8
> >>>>>  ata_sff_error_handler+0xd0/0xec
> >>>>>  ata_bmdma_error_handler+0x7c/0x12c
> >>>>>  ata_scsi_port_error_handler+0xc8/0x5f8
> >>>>>  ata_scsi_error+0x90/0xcc
> >>>>>  scsi_error_handler+0x148/0x308
> >>>>>  kthread+0xe4/0xf4
> >>>>>  ret_from_fork+0x10/0x20
> >>>>
> >>>> OK. So it is ata_dev_configure() being called many times from EH. Weird.
> >>>> But I have not a lot of experience with the bmdma drivers.
> >>>> Need to look into that.
> >>>>
> >>>> In the meantime, can you try this ?
> >>>>
> >>>> --- a/drivers/ata/libata-core.c
> >>>> +++ b/drivers/ata/libata-core.c
> >>>
> >>>> @@ -4087,7 +4087,7 @@ static void ata_dev_print_quirks(const struct ata_device *dev,
> >>>>         size_t sz;
> >>>>         char *str;
> >>>>
> >>>> -       if (!quirks)
> >>>> +       if (!ata_dev_print_info(dev) || !quirks)
> >>>>                 return;
> >>>>
> >>>>         sz = 64 + ARRAY_SIZE(ata_quirk_names) * 16;
> >>>
> >>> Thanks, that reduces the number of quirk prints from 4 to 2 during
> >>> boot-up, and from 4 to 0 when resuming from s2idle/s2ram.
> >>
> >> 2 times on boot... Hmm.. So that means that you are seeing all the probe
> >> messages twice (and not just the quirk message), right ?
> >
> > No, I do not see all probe messages twice.
> >
> > $ grep ^ata dmesg:
> >
> > ata1: SATA max UDMA/133 irq 128 lpm-pol 0
> > ata1: link resume succeeded after 1 retries
> > ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
> > ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
> > ata1.00: ATA-7: Maxtor 6L160M0, BANC1G10, max UDMA/133
> > ata1.00: 320173056 sectors, multi 0: LBA48 NCQ (not used)
> > ata1.00: Model 'Maxtor 6L160M0', rev 'BANC1G10', applying quirks: noncq
> > ata1.00: configured for UDMA/133
>
> OK. This path should get rid of the useless extra print:

Unsurprisingly, it does ;-)

>
> commit 3c65fcbf942c26ece6d1efef7ad1405c0163575f
> Author: Damien Le Moal <dlemoal@kernel.org>
> Date:   Thu Aug 1 18:04:22 2024 +0900
>
>     ata: libata: Print device quirks only once
>
>     In ata_dev_print_quirks(), return early if ata_dev_print_info() returns
>     false or if we already printed quirk information. This is to avoid
>     printing a device quirks multiple times (that is, each time
>     ata_dev_revalidate() is called).
>
>     To remember if ata_dev_print_quirks() was already executed, define the
>     EH context flag ATA_EHI_DID_QUIRK_PRINT and set this flag in
>     ata_dev_print_quirks().
>
>     Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
>     Fixes: 58157d607aec ("ata: libata: Print quirks applied to devices")
>     Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

    Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2024-08-01 15:04 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-26  3:19 [PATCH v6 0/4] Some cleanup, renaming and horkage improvements Damien Le Moal
2024-07-26  3:19 ` [PATCH v6 01/11] ata: libata: Change ata_dev_knobble() to return a bool Damien Le Moal
2024-07-26  3:19 ` [PATCH v6 02/11] ata: libata: Rename ata_dma_blacklisted() Damien Le Moal
2024-07-26  3:19 ` [PATCH v6 03/11] ata: libata: Use QUIRK instead of HORKAGE Damien Le Moal
2024-07-26 10:27   ` Niklas Cassel
2024-07-29 18:41   ` Igor Pylypiv
2024-07-26  3:19 ` [PATCH v6 04/11] ata: libata: Print quirks applied to devices Damien Le Moal
2024-07-26 10:47   ` Niklas Cassel
2024-07-30 10:09   ` Geert Uytterhoeven
2024-07-30 23:39     ` Damien Le Moal
2024-07-31  7:27       ` Geert Uytterhoeven
2024-07-31  9:08         ` Damien Le Moal
2024-08-01  9:07           ` Geert Uytterhoeven
2024-08-01  9:25             ` Damien Le Moal
2024-08-01 10:05               ` Geert Uytterhoeven
2024-08-01 10:08                 ` Damien Le Moal
2024-08-01 10:42                 ` Damien Le Moal
2024-08-01 15:04                   ` Geert Uytterhoeven
2024-07-26  3:19 ` [PATCH v6 05/11] ata: pata_serverworks: Do not use the term blacklist Damien Le Moal
2024-07-26 11:12   ` Niklas Cassel
2024-07-29 18:43   ` Igor Pylypiv
2024-07-26  3:19 ` [PATCH v6 06/11] ata: ahci: Rephrase comment to " Damien Le Moal
2024-07-26 10:57   ` Niklas Cassel
2024-07-29 18:43   ` Igor Pylypiv
2024-07-26  3:19 ` [PATCH v6 07/11] ata: sata_sil: Rename sil_blacklist to sil_quirks Damien Le Moal
2024-07-26 11:13   ` Niklas Cassel
2024-07-29 18:44   ` Igor Pylypiv
2024-07-26  3:19 ` [PATCH v6 08/11] ata: ata_piix: Remove useless comment in piix_init_sidpr() Damien Le Moal
2024-07-26 11:13   ` Niklas Cassel
2024-07-29 18:45   ` Igor Pylypiv
2024-07-26  3:19 ` [PATCH v6 09/11] ata: pata_cs5520: Rephrase file header comment Damien Le Moal
2024-07-26 11:13   ` Niklas Cassel
2024-07-29 18:45   ` Igor Pylypiv
2024-07-26  3:19 ` [PATCH v6 10/11] ata: pata_hpt366: Rename hpt_dma_blacklisted() Damien Le Moal
2024-07-26 11:13   ` Niklas Cassel
2024-07-29 18:46   ` Igor Pylypiv
2024-07-26  3:19 ` [PATCH v6 11/11] ata: pata_hpt37x: " Damien Le Moal
2024-07-26 11:13   ` Niklas Cassel
2024-07-29 18:47   ` Igor Pylypiv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).