All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] libata: add horkage for missing Identify Device log
@ 2021-11-10  8:14 Damien Le Moal
  2021-11-11  7:15 ` Christoph Hellwig
  2021-11-11 16:13 ` Martin K. Petersen
  0 siblings, 2 replies; 4+ messages in thread
From: Damien Le Moal @ 2021-11-10  8:14 UTC (permalink / raw)
  To: linux-ide

ACS-3 introduced the ATA Identify Device Data log as mandatory. A
warning message currently signals to the user if a device does not
report supporting this log page in the log directory page, regardless
of the ATA version of the device. Furthermore, this warning will appear
for all attempts at accessing this missing log page during device
revalidation.

Since it is useless to constantly access the log directory and warn
about this lack of support once we have discovered that the device
does not support this log page, introduce the horkage flag
ATA_HORKAGE_NO_ID_DEV_LOG to mark a device as lacking support for
the Identify Device Data log page. Set this flag when
ata_log_supported() returns false in ata_identify_page_supported().
The warning is printed only if the device ATA level is 10 or above
(ACS-3 or above), and only once on device scan. With this flag set, the
log directory page is not accessed again to test for Identify Device
Data log page support.

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
Changes from v1:
* Print the warning only for drives with an ATA version equal to or
  higher than 10 (ACS-3 and above).

 drivers/ata/libata-core.c | 13 ++++++++++++-
 include/linux/libata.h    |  1 +
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 3018ca84a3d8..8a0ccb190d76 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2052,8 +2052,19 @@ 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)
+		return false;
+
 	if (!ata_log_supported(dev, ATA_LOG_IDENTIFY_DEVICE)) {
-		ata_dev_warn(dev, "ATA Identify Device Log not supported\n");
+		/*
+		 * IDENTIFY DEVICE data log is defined as mandatory starting
+		 * with ACS-3 (ATA version 10). Warn about the missing log
+		 * for drives which implement this ATA level or above.
+		 */
+		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;
 		return false;
 	}
 
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 5331557316e8..2a8404b26083 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -427,6 +427,7 @@ enum {
 	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 */
 
 	 /* DMA mask for user DMA control: User visible values; DO NOT
 	    renumber */
-- 
2.31.1


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

* Re: [PATCH V2] libata: add horkage for missing Identify Device log
  2021-11-10  8:14 [PATCH V2] libata: add horkage for missing Identify Device log Damien Le Moal
@ 2021-11-11  7:15 ` Christoph Hellwig
  2021-11-11  7:32   ` Damien Le Moal
  2021-11-11 16:13 ` Martin K. Petersen
  1 sibling, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2021-11-11  7:15 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide

I'm still a little worried just sending this command could blow up on
really old devices.  But I guess we can deal with that when the problem
arises:

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH V2] libata: add horkage for missing Identify Device log
  2021-11-11  7:15 ` Christoph Hellwig
@ 2021-11-11  7:32   ` Damien Le Moal
  0 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2021-11-11  7:32 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-ide

On 2021/11/11 16:15, Christoph Hellwig wrote:
> I'm still a little worried just sending this command could blow up on
> really old devices.  But I guess we can deal with that when the problem
> arises:

Well, it has been working like this for a long while now... So I am not too
worried about problems at this point.

Note that the first access that detects support is not to the IDENTIFY DEVICE
data log directly, but to the log directory page. And the log directory page is
supported since ACS-1.


> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 


-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH V2] libata: add horkage for missing Identify Device log
  2021-11-10  8:14 [PATCH V2] libata: add horkage for missing Identify Device log Damien Le Moal
  2021-11-11  7:15 ` Christoph Hellwig
@ 2021-11-11 16:13 ` Martin K. Petersen
  1 sibling, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2021-11-11 16:13 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide


Damien,

> ACS-3 introduced the ATA Identify Device Data log as mandatory. A
> warning message currently signals to the user if a device does not
> report supporting this log page in the log directory page, regardless
> of the ATA version of the device. Furthermore, this warning will appear
> for all attempts at accessing this missing log page during device
> revalidation.

Looks fine.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-11-11 16:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10  8:14 [PATCH V2] libata: add horkage for missing Identify Device log Damien Le Moal
2021-11-11  7:15 ` Christoph Hellwig
2021-11-11  7:32   ` Damien Le Moal
2021-11-11 16:13 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.