All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ide: Set IDENTIFY word 93 to 0 on SATA drives
@ 2026-03-18 16:29 Pedro Falcato
  2026-03-18 16:54 ` Daniel P. Berrangé
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Pedro Falcato @ 2026-03-18 16:29 UTC (permalink / raw)
  To: John Snow
  Cc: qemu-block, qemu-devel, Pedro Falcato, qemu-stable, Niklas Cassel

According to the ATA Command Set specification (and the SATA specification
too), SATA drives are supposed to set word 93 (which for PATA holds hardware
reset results) to 0. As such, clear it when ncq_queues > 0 (which is only true
for SATA drives).

Doing so fixes a quirk in Linux where it thinks the AHCI QEMU drive is PATA
over a SATA bridge, and thus limits maximum transfer sizes for individual IOs
with a:
[    1.632121] ata1.00: applying bridge limits

While at it, bump the device's firmware revision for IDENTIFY. This makes it
so Linux can avoid enabling a quirk for fixed QEMU releases.

Link: https://lore.kernel.org/linux-ide/20260303183337.1013474-1-pfalcato@suse.de/
Cc: qemu-stable@nongnu.org
Suggsted-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Pedro Falcato <pfalcato@suse.de>
---
Note: I understand the version bump is vaguely controversial (particularly
 exposing the QEMU version in the string) but I don't have a much better
 idea. Logically, bumping it to 11.0 for stable releases doesn't make much
 sense.
 
 hw/ide/core.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index b45abf067b20..89f62f301e94 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -211,7 +211,15 @@ static void ide_identify(IDEState *s)
         put_le16(p + 87, (1 << 14) | 0);
     }
     put_le16(p + 88, 0x3f | (1 << 13)); /* udma5 set and supported */
-    put_le16(p + 93, 1 | (1 << 14) | 0x2000);
+    if (s->ncq_queues) {
+        /*
+         * This is SATA, which is required by the spec to return 0 for this
+         * field.
+         */
+        put_le16(p + 93, 0);
+    } else {
+        put_le16(p + 93, 1 | (1 << 14) | 0x2000);
+    }
     /* *(p + 100) := nb_sectors       -- see ide_identify_size */
     /* *(p + 101) := nb_sectors >> 16 -- see ide_identify_size */
     /* *(p + 102) := nb_sectors >> 32 -- see ide_identify_size */
@@ -2660,7 +2668,7 @@ int ide_init_drive(IDEState *s, IDEDevice *dev, IDEDriveKind kind, Error **errp)
     if (dev->version) {
         pstrcpy(s->version, sizeof(s->version), dev->version);
     } else {
-        pstrcpy(s->version, sizeof(s->version), qemu_hw_version());
+        pstrcpy(s->version, sizeof(s->version), "11.0");
     }
 
     ide_reset(s);
-- 
2.53.0



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

end of thread, other threads:[~2026-05-13  8:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18 16:29 [PATCH] ide: Set IDENTIFY word 93 to 0 on SATA drives Pedro Falcato
2026-03-18 16:54 ` Daniel P. Berrangé
2026-03-18 16:58   ` Daniel P. Berrangé
2026-03-18 17:24     ` Pedro Falcato
2026-03-19 16:05       ` Daniel P. Berrangé
2026-03-18 20:13 ` BALATON Zoltan
2026-03-24 17:01   ` Paolo Bonzini
2026-05-13  6:30 ` Michael Tokarev
2026-05-13  8:55   ` Pedro Falcato

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.