On 3/18/26 21:13, BALATON Zoltan wrote:
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?

That makes sense - the other SATA controller being hw/ide/sii3112.c, for Pedro.

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.

This is probably not an issue for a random value in IDENTIFY data, but yeah it's best to add a compatibility property. Then it should be easy to also keep the version constant like this:

    IDEBus *bus = DO_UPCAST(IDEBus, qbus, dev->qdev.parent_bus);

    if (dev->version) {
        pstrcpy(s->version, sizeof(s->version), dev->version);
    } else if (!dev->has_sata_word93 && bus->sata) {
        pstrcpy(s->version, sizeof(s->version), "11.0+");
    } else {
        pstrcpy(s->version, sizeof(s->version), QEMU_HW_VERSION);
    }

Paolo


Reply via email to