On Wed, Mar 18, 2026 at 04:54:45PM +0000, Daniel P. Berrangé wrote:
> On Wed, Mar 18, 2026 at 04:29:51PM +0000, 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).
> >
> > 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.
>
> Bumping the version string changes guest ABI, so such a change should
> normally be tied to a new machine type version, not unconditionally
> changed. That would also in turn make it unsuitable for QEMU stable
> release branches which don't take changes which affect machine type
> ABI.
>
> IMHO Linux should just assume any actively maintained distro that
> cares about this problem will fix their QEMU releases and not try
> to add a version specific workaround.
Having said that, possibly the functional fix itself might need to
be tied to the machine type too, given that it is triggering a
behavioural change in the emulation and guest driver ? If that's
the case, then the version could be changed at the same time.
>
> > 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
> >
> >
>
> With regards,
> Daniel
> --
> |: https://berrange.com ~~ https://hachyderm.io/@berrange :|
> |: https://libvirt.org ~~ https://entangle-photo.org :|
> |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
>
>
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|