All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: den@openvz.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
Subject: [PULL 5/8] tests/qtest/libqos/ahci: support raw (2352-byte) READ CD
Date: Thu, 30 Jul 2026 10:13:21 +0200	[thread overview]
Message-ID: <20260730081325.1816193-6-den@openvz.org> (raw)
In-Reply-To: <20260730081325.1816193-1-den@openvz.org>

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>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
 tests/qtest/libqos/ahci.c | 5 +++++
 tests/qtest/libqos/ahci.h | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/tests/qtest/libqos/ahci.c b/tests/qtest/libqos/ahci.c
index 0621a6c477..e3019a1eca 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 *);
-- 
2.53.0



  parent reply	other threads:[~2026-07-30  8:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30  8:13 [PULL 0/8] IDE patches Denis V. Lunev
2026-07-30  8:13 ` [PULL 1/8] MAINTAINERS: add myself to IDE maintainers Denis V. Lunev
2026-07-30 13:52   ` Philippe Mathieu-Daudé
2026-07-30 14:55   ` Stefan Hajnoczi
2026-07-30 15:15     ` Denis V. Lunev
2026-07-30 15:21       ` Daniel P. Berrangé
2026-07-31 13:45     ` Denis V. Lunev
2026-07-31 20:18       ` Stefan Hajnoczi
2026-07-31 21:17         ` Denis V. Lunev
2026-08-02 14:13           ` Philippe Mathieu-Daudé
2026-08-03 18:02             ` Stefan Hajnoczi
2026-08-03  4:47   ` Markus Armbruster
2026-07-30  8:13 ` [PULL 2/8] tests/qtest/ide-test: parametrize the ATAPI CD-ROM read test Denis V. Lunev
2026-07-30 15:18   ` Thomas Huth
2026-07-30  8:13 ` [PULL 3/8] tests/qtest/ide-test: add a multi-sector ATAPI DMA " Denis V. Lunev
2026-07-30  8:13 ` [PULL 4/8] tests/qtest/ide-test: cover raw (2352-byte) ATAPI CD reads Denis V. Lunev
2026-07-30  8:13 ` Denis V. Lunev [this message]
2026-07-30  8:13 ` [PULL 6/8] tests/qtest/ahci: " Denis V. Lunev
2026-07-30  8:13 ` [PULL 7/8] hw/ide/atapi: read the whole elementary transfer asynchronously Denis V. Lunev
2026-07-30  8:13 ` [PULL 8/8] tests/qtest/ahci: regression test for ATAPI read vs. drain Denis V. Lunev
2026-08-04  8:12 ` [PULL 0/8] IDE patches Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260730081325.1816193-6-den@openvz.org \
    --to=den@openvz.org \
    --cc=philmd@oss.qualcomm.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.