@samitouri / QOSamiQemu / commits / 60faaa8c3b

hw/ide: report ATAPI UDMA5 with a matching standard and cable

IDENTIFY PACKET DEVICE claims UDMA mode 5 in word 88 while word 80 reports support only up to ATA/ATAPI-4. UDMA5 first appears in ATA/ATAPI-6; ATA/ATAPI-5 stops at mode 4. Bits 3:1 of word 80 are obsolete in IDENTIFY PACKET DEVICE data as well, so the old 001eh claimed three standards that mean nothing for a packet device. Report 0070h, ATA/ATAPI-4 through ATA/ATAPI-6. Word 93 was left unset, so nothing reported the 80-conductor cable that UDMA5 needs. Fill it in, but only for a parallel attachment: ACS-3 7.13.6.41 gives word 93 of IDENTIFY PACKET DEVICE data the meaning of word 93 of IDENTIFY DEVICE data, where "For SATA devices, word 93 shall be set to the value 0000h". A cleared ncq_queues is how both identify paths already tell a parallel attachment from an AHCI one. The device 0 reset result is 0fh rather than the 01h ide_identify() reports: bit 3 says diagnostics passed, which they did, and bits 2:1 say the device number came from some other method, the only one of the four encodings that is not a jumper, CSEL or reserved. Raising word 80 has a second effect. Linux decides a device is SATA in ata_id_is_sata(), which wants word 93 clear and word 80 at ATA/ATAPI-5 or later. An AHCI CD-ROM satisfied neither condition before and was taken for a parallel device; now it satisfies both. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/4038 Cc: John Snow <jsnow@redhat.com> Cc: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Signed-off-by: Denis V. Lunev <den@openvz.org>

Denis V. Lunev committed Aug 17, 2026 at 23:44 UTC 60faaa8c3bd6b9b420adcb2530a9d5fbc52a0c5e
1 file changed +5 -1
hw/ide/core.c
+5 -1
@@ -292,7 +292,7 @@ static void ide_atapi_identify(IDEState *s)
292 put_le16(p + 76, (1 << 8));
293 }
294
295 - put_le16(p + 80, 0x1e); /* support up to ATA/ATAPI-4 */
295 + put_le16(p + 80, 0x70); /* support up to ATA/ATAPI-6 */
296 if (s->wwn) {
297 put_le16(p + 84, (1 << 8)); /* supports WWN for words 108-111 */
298 put_le16(p + 87, (1 << 8)); /* WWN enabled */
@@ -300,6 +300,10 @@ static void ide_atapi_identify(IDEState *s)
300
301 #ifdef USE_DMA_CDROM
302 put_le16(p + 88, 0x3f | (1 << 13)); /* udma5 set and supported */
303 + if (!s->ncq_queues) {
304 + /* word 93 is parallel ATA only, a SATA device reports zero */
305 + put_le16(p + 93, 0x600f);
306 + }
307 #endif
308
309 if (s->wwn) {