public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
From: Pedro Falcato <pfalcato@suse.de>
To: John Snow <jsnow@redhat.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
	Pedro Falcato <pfalcato@suse.de>,
	qemu-stable@nongnu.org, Niklas Cassel <cassel@kernel.org>
Subject: [PATCH] ide: Set IDENTIFY word 93 to 0 on SATA drives
Date: Wed, 18 Mar 2026 16:29:51 +0000	[thread overview]
Message-ID: <20260318162951.1060969-1-pfalcato@suse.de> (raw)

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



             reply	other threads:[~2026-03-18 16:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18 16:29 Pedro Falcato [this message]
2026-03-18 16:54 ` [PATCH] ide: Set IDENTIFY word 93 to 0 on SATA drives 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260318162951.1060969-1-pfalcato@suse.de \
    --to=pfalcato@suse.de \
    --cc=cassel@kernel.org \
    --cc=jsnow@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox