tests/qtest/libqos/ahci: support raw (2352-byte) READ CD
ahci_exec() always builds ATAPI commands with a 2048-byte logical sector size, so it cannot drive a READ CD that returns full 2352-byte raw sectors. Add an atapi_raw option that sets the READ CD field-selector to 0xf8 and the command's sector size to 2352 before the transfer is sized, so the derived block count stays correct while the buffer and byte counts cover the raw sectors. Signed-off-by: Denis V. Lunev <den@openvz.org>
Denis V. Lunev committed
Jun 19, 2026 at 02:29 UTC
de86ef3dfd337ec5a74b43d7d042ab937d0166bf
2 files changed
+7
tests/qtest/libqos/ahci.c
+5
@@ -707,6 +707,11 @@ void ahci_exec(AHCIQState *ahci, uint8_t port,
707
if (opts->atapi) {
708
uint16_t bcl = opts->set_bcl ? opts->bcl : ATAPI_SECTOR_SIZE;
709
cmd = ahci_atapi_command_create(op, bcl, opts->atapi_dma);
710
+ if (opts->atapi_raw) {
711
+ /* request full 2352-byte raw sectors; sector_size must match */
712
+ cmd->atapi_cmd[9] = 0xf8;
713
+ cmd->sector_size = ATAPI_RAW_SECTOR_SIZE;
714
+ }
715
} else {
716
cmd = ahci_command_create(op);
717
}
tests/qtest/libqos/ahci.h
+2
@@ -242,6 +242,7 @@
242
243
#define AHCI_SECTOR_SIZE (512)
244
#define ATAPI_SECTOR_SIZE (2048)
245
+#define ATAPI_RAW_SECTOR_SIZE (2352)
246
247
#define AHCI_SIGNATURE_CDROM (0xeb140101)
248
#define AHCI_SIGNATURE_DISK (0x00000101)
@@ -485,6 +486,7 @@ typedef struct AHCIOpts {
486
uint64_t buffer; /* Pointer to source or destination guest buffer */
487
bool atapi; /* ATAPI command? */
488
bool atapi_dma; /* Use DMA for ATAPI? */
489
+ bool atapi_raw; /* READ CD returning 2352-byte raw sectors */
490
bool error;
491
int (*pre_cb)(AHCIQState*, AHCICommand*, const struct AHCIOpts *);
492
int (*mid_cb)(AHCIQState*, AHCICommand*, const struct AHCIOpts *);