summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2026-06-19 02:29:11 +0200
committerMichael Tokarev <mjt@tls.msk.ru>2026-08-17 19:23:02 +0300
commit3512396d8a7f6b32c66a7ef2e6bb2a779d57b492 (patch)
tree5299685df0fa117735ae2e39eba888a465bcea71
parentd5472fa862701fe992afc9c4415fa0309d4ac94e (diff)
downloadqemu-3512396d8a7f6b32c66a7ef2e6bb2a779d57b492.tar.gz
qemu-3512396d8a7f6b32c66a7ef2e6bb2a779d57b492.zip
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> (cherry picked from commit de86ef3dfd337ec5a74b43d7d042ab937d0166bf) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--tests/qtest/libqos/ahci.c5
-rw-r--r--tests/qtest/libqos/ahci.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/tests/qtest/libqos/ahci.c b/tests/qtest/libqos/ahci.c
index 34a75b7f43..0677f2055d 100644
--- a/tests/qtest/libqos/ahci.c
+++ b/tests/qtest/libqos/ahci.c
@@ -707,6 +707,11 @@ void ahci_exec(AHCIQState *ahci, uint8_t port,
if (opts->atapi) {
uint16_t bcl = opts->set_bcl ? opts->bcl : ATAPI_SECTOR_SIZE;
cmd = ahci_atapi_command_create(op, bcl, opts->atapi_dma);
+ if (opts->atapi_raw) {
+ /* request full 2352-byte raw sectors; sector_size must match */
+ cmd->atapi_cmd[9] = 0xf8;
+ cmd->sector_size = ATAPI_RAW_SECTOR_SIZE;
+ }
} else {
cmd = ahci_command_create(op);
}
diff --git a/tests/qtest/libqos/ahci.h b/tests/qtest/libqos/ahci.h
index a0487a1557..2a48a7523d 100644
--- a/tests/qtest/libqos/ahci.h
+++ b/tests/qtest/libqos/ahci.h
@@ -242,6 +242,7 @@
#define AHCI_SECTOR_SIZE (512)
#define ATAPI_SECTOR_SIZE (2048)
+#define ATAPI_RAW_SECTOR_SIZE (2352)
#define AHCI_SIGNATURE_CDROM (0xeb140101)
#define AHCI_SIGNATURE_DISK (0x00000101)
@@ -485,6 +486,7 @@ typedef struct AHCIOpts {
uint64_t buffer; /* Pointer to source or destination guest buffer */
bool atapi; /* ATAPI command? */
bool atapi_dma; /* Use DMA for ATAPI? */
+ bool atapi_raw; /* READ CD returning 2352-byte raw sectors */
bool error;
int (*pre_cb)(AHCIQState*, AHCICommand*, const struct AHCIOpts *);
int (*mid_cb)(AHCIQState*, AHCICommand*, const struct AHCIOpts *);