On Wed, 18 Mar 2026, Pedro Falcato wrote:
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).
AHCI is not the only SATA controller emulated but the only one setting ncq_queues so that's not a good way to identify SATA in general. Maybe there should be something else that SATA controllers could set which you test for here but I don't know what would be the best way for that. It seems a drive is SATA if it's connected to a SATA controller so maybe the bus should have a field set to say it's a SATA bus?
As for ABI and behaviour change, usually if you change something that would make a Windows guest detect new hardware then that should be introduced with new machine version with compatibity kept for older machine versions. I don't know if that applies to replacing IDE drives with SATA drives but seems likely.
Regards, BALATON Zoltan
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/[email protected]/ Cc: [email protected] Suggsted-by: Niklas Cassel <[email protected]> Signed-off-by: Pedro Falcato <[email protected]> --- 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);
