Skip to contentSkip to conversation

IDE patches

GIT PULL Applied Denis V. Lunev 10 participants 25 messages Jul 30 – Aug 11

lore
Share & tools
lore
#0 lore raw

The following changes since commit e1705a25aff35635c360bbaba4c2731d019a422a:

Update version for v11.1.0-rc2 release (2026-07-29 06:16:08 -0400)

are available in the Git repository at:

https://gitlab.com/dlunev/qemu tags/pull-ide-2026-07-30

for you to fetch changes up to 89d7cc4626bec53a6653a95489972d2400623e8f:

tests/qtest/ahci: regression test for ATAPI read vs. drain (2026-07-30 09:16:45 +0200)

----------------------------------------------------------------
IDE patches

- fix a main-loop deadlock when an ATAPI PIO read spanning several sectors is in flight while a drain starts: the nested sector fetch was issued synchronously from inside the completion of the first read and queued behind the drain, which then never finished
- read the whole ATAPI elementary transfer in one asynchronous request instead, removing cd_read_sector_sync()
- extend the IDE/AHCI qtest coverage of ATAPI CD reads: parametrized read helper, multi-sector DMA, raw 2352-byte READ CD on both delivery paths, and a regression test for the deadlock above
- add myself as an IDE maintainer

CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>

----------------------------------------------------------------
Denis V. Lunev (8):
MAINTAINERS: add myself to IDE maintainers tests/qtest/ide-test: parametrize the ATAPI CD-ROM read test tests/qtest/ide-test: add a multi-sector ATAPI DMA read test tests/qtest/ide-test: cover raw (2352-byte) ATAPI CD reads tests/qtest/libqos/ahci: support raw (2352-byte) READ CD tests/qtest/ahci: cover raw (2352-byte) ATAPI CD reads hw/ide/atapi: read the whole elementary transfer asynchronously tests/qtest/ahci: regression test for ATAPI read vs. drain

 MAINTAINERS               |   1 +
 hw/ide/atapi.c            | 180 ++++++++++++++++++---------------------
 tests/qtest/ahci-test.c   | 134 +++++++++++++++++++++++++++++
 tests/qtest/ide-test.c    | 211 +++++++++++++++++++++++++++++-----------------
 tests/qtest/libqos/ahci.c |   5 ++
 tests/qtest/libqos/ahci.h |   2 +
 6 files changed, 361 insertions(+), 172 deletions(-)

--
2.53.0

#1 lore raw

[PULL 4/8] tests/qtest/ide-test: cover raw (2352-byte) ATAPI CD reads

READ CD with the field-selector set to 0xf8 returns full 2352-byte raw sectors (sync + header + 2048 data + EDC/ECC), driving the ATAPI raw read path that READ10 never touches. Add a send_scsi_cdb_read_cd() helper and a CDROM_RAW flag to cdrom_read_impl(), then exercise both PIO and DMA. The PIO case uses a byte-count limit spanning several raw sectors so the device must rebuffer mid-burst, and each sector's 2048-byte payload is verified at its in-sector offset.

CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
 tests/qtest/ide-test.c | 75 ++++++++++++++++++++++++++++++++++++++----
 1 file changed, 69 insertions(+), 6 deletions(-)
tests/qtest/ide-test.c +69 -6
index 2c674edf15..b36b0f8875 100644
@@ -48,6 +48,10 @@
 
 #define ATAPI_BLOCK_SIZE 2048
 
+/* Raw READ CD sector: 12 sync + 4 header + 2048 data + 288 EDC/ECC. */
+#define ATAPI_RAW_SIZE   2352
+#define ATAPI_RAW_DATA   16
+
 /* How many bytes to receive via ATAPI PIO at one time.
  * Must be less than 0xFFFF. */
 #define BYTE_COUNT_LIMIT 5120
@@ -982,6 +986,40 @@ static void send_scsi_cdb_read10(QPCIDevice *dev, QPCIBar ide_bar,
     }
 }
 
+typedef struct ReadCDCDB {
+    uint8_t opcode;
+    uint8_t sector_type;
+    uint32_t lba;
+    uint8_t length[3];
+    uint8_t main_channel;
+    uint8_t sub_channel;
+    uint8_t control;
+} __attribute__((__packed__)) ReadCDCDB;
+
+static void send_scsi_cdb_read_cd(QPCIDevice *dev, QPCIBar ide_bar,
+                                  uint64_t lba, int nblocks)
+{
+    ReadCDCDB pkt = { };
+    int i;
+
+    g_assert_cmpint(lba, <=, UINT32_MAX);
+    g_assert_cmpint(nblocks, >=, 0);
+    g_assert_cmpint(nblocks, <=, 0xffffff);
+
+    /* Construct SCSI CDB packet */
+    pkt.opcode = 0xbe;
+    pkt.lba = cpu_to_be32(lba);
+    pkt.length[0] = (nblocks >> 16) & 0xff;
+    pkt.length[1] = (nblocks >> 8) & 0xff;
+    pkt.length[2] = nblocks & 0xff;
+    pkt.main_channel = 0xf8; /* sync + headers + user data + EDC/ECC: 2352 */
+
+    /* Send Packet */
+    for (i = 0; i < sizeof(ReadCDCDB) / 2; i++) {
+        qpci_io_writew(dev, ide_bar, reg_data,
+                       le16_to_cpu(((uint16_t *)&pkt)[i]));
+    }
+}
 
 static void nsleep(QTestState *qts, int64_t nsecs)
 {
@@ -1037,10 +1075,12 @@ static void ide_wait_intr(QTestState *qts, int irq)
 
 #define CDROM_PIO 0
 #define CDROM_DMA (1 << 0)
+#define CDROM_RAW (1 << 1)
 
 static void cdrom_read_impl(int nblocks, unsigned flags)
 {
     bool dma = flags & CDROM_DMA;
+    bool raw = flags & CDROM_RAW;
     QTestState *qts;
     QPCIDevice *dev;
     QPCIBar bmdma_bar, ide_bar;
@@ -1048,8 +1088,11 @@ static void cdrom_read_impl(int nblocks, unsigned flags)
     int patt_blocks = MAX(16, nblocks);
     size_t patt_len = ATAPI_BLOCK_SIZE * patt_blocks;
     char *pattern = g_malloc(patt_len);
-    size_t rxsize = ATAPI_BLOCK_SIZE * nblocks;
+    unsigned xfer = raw ? ATAPI_RAW_SIZE : ATAPI_BLOCK_SIZE;
+    size_t rxsize = xfer * nblocks;
     uint16_t *rx = g_malloc0(rxsize);
+    void (*send_cdb)(QPCIDevice *, QPCIBar, uint64_t, int) =
+        raw ? send_scsi_cdb_read_cd : send_scsi_cdb_read10;
     int i, j;
     uint8_t data;
     uint16_t limit;
@@ -1076,8 +1119,7 @@ static void cdrom_read_impl(int nblocks, unsigned flags)
         prdt[0].size = cpu_to_le32(rxsize | PRDT_EOT);
 
         send_dma_request_dev(qts, dev, bmdma_bar, ide_bar, CMD_PACKET, 0,
-                             nblocks, prdt, ARRAY_SIZE(prdt),
-                             send_scsi_cdb_read10);
+                             nblocks, prdt, ARRAY_SIZE(prdt), send_cdb);
 
         qtest_memread(qts, guest_buf, rx, rxsize);
     } else {
@@ -1094,8 +1136,7 @@ static void cdrom_read_impl(int nblocks, unsigned flags)
         assert_bit_set(data, DRQ | DRDY);
         assert_bit_clear(data, ERR | DF | BSY);
 
-        /* SCSI CDB (READ10) -- read n*2048 bytes from block 0 */
-        send_scsi_cdb_read10(dev, ide_bar, 0, nblocks);
+        send_cdb(dev, ide_bar, 0, nblocks);
 
         /*
          * Read data back: occurs in bursts of 'BYTE_COUNT_LIMIT' bytes.
@@ -1135,7 +1176,17 @@ static void cdrom_read_impl(int nblocks, unsigned flags)
         assert_bit_clear(data, DRQ | ERR | DF | BSY);
     }
 
-    g_assert_cmpint(memcmp(pattern, rx, rxsize), ==, 0);
+    if (raw) {
+        /* The 2048-byte payload of each raw sector sits past its header. */
+        for (i = 0; i < nblocks; i++) {
+            uint8_t *sec = (uint8_t *)rx + i * ATAPI_RAW_SIZE + ATAPI_RAW_DATA;
+
+            g_assert_cmpint(memcmp(sec, pattern + i * ATAPI_BLOCK_SIZE,
+                                   ATAPI_BLOCK_SIZE), ==, 0);
+        }
+    } else {
+        g_assert_cmpint(memcmp(pattern, rx, rxsize), ==, 0);
+    }
 
     g_free(pattern);
     g_free(rx);
@@ -1164,6 +1215,16 @@ static void test_cdrom_dma_large(void)
     cdrom_read_impl(BYTE_COUNT_LIMIT * 4 / ATAPI_BLOCK_SIZE, CDROM_DMA);
 }
 
+static void test_cdrom_pio_raw(void)
+{
+    cdrom_read_impl(4, CDROM_RAW);
+}
+
+static void test_cdrom_dma_raw(void)
+{
+    cdrom_read_impl(4, CDROM_DMA | CDROM_RAW);
+}
+
 int main(int argc, char **argv)
 {
     const char *base;
@@ -1224,6 +1285,8 @@ int main(int argc, char **argv)
     qtest_add_func("/ide/cdrom/pio_large", test_cdrom_pio_large);
     qtest_add_func("/ide/cdrom/dma", test_cdrom_dma);
     qtest_add_func("/ide/cdrom/dma_large", test_cdrom_dma_large);
+    qtest_add_func("/ide/cdrom/pio_raw", test_cdrom_pio_raw);
+    qtest_add_func("/ide/cdrom/dma_raw", test_cdrom_dma_raw);
 
     ret = g_test_run();
 
Signature · 1 line
2.53.0
#2 lore raw

[PULL 8/8] tests/qtest/ahci: regression test for ATAPI read vs. drain

In reply to Denis V. Lunev

Add /ahci/cdrom/drain/{pio,dma}: issue a multi-sector ATAPI read whose byte-count limit spans two sectors so the device must rebuffer in the middle of the DRQ burst, hold the backend read in flight with a blkdebug delay, and fire x-blockdev-set-iothread -- which runs bdrv_drain_all_begin() exactly like a guest reset does through virtio_blk_stop_ioeventfd().

On the unfixed PIO path the nested sector fetch is queued behind the drain and the main loop wedges, so the test hangs. The DMA variant never rebuffers and serves as a sanity twin.

CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
 tests/qtest/ahci-test.c | 66 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)
tests/qtest/ahci-test.c +66 -0
index 58bc04b3ef..71d23fe56a 100644
@@ -1754,6 +1754,70 @@ static void test_atapi_engine_restart_dma(void)
     test_atapi_engine_restart_in_flight(true);
 }
 
+/*
+ * Regression test: a multi-sector ATAPI read fetches its later sectors from
+ * inside the first read's completion; a concurrent drain (as a guest reset
+ * triggers via bdrv_drain_all_begin) must not wedge on that nested read.
+ * blkdebug keeps the read in flight across x-blockdev-set-iothread.
+ */
+static void test_atapi_drain_in_flight(bool dma)
+{
+    AHCIQState *ahci;
+    AHCICommand *cmd;
+    unsigned char *tx;
+    char *iso;
+    int fd;
+    uint8_t port;
+    uint64_t buffer;
+    uint16_t bcl = ATAPI_SECTOR_SIZE * 2;
+    uint64_t iso_size = (uint64_t)ATAPI_SECTOR_SIZE * 3;
+
+    fd = prepare_iso(iso_size, &tx, &iso);
+
+    /* 1s read delay: a wide margin so the drain starts before it completes */
+    ahci = ahci_boot_and_enable(
+        "-blockdev driver=file,node-name=file0,filename=%s,read-only=on "
+        "-blockdev driver=blkdebug,node-name=cd0,image=file0,read-only=on,"
+        "inject-error.0.event=none,inject-error.0.iotype=read,"
+        "inject-error.0.errno=0,inject-error.0.delay-ns=1000000000 "
+        "-M q35 "
+        "-device ide-cd,drive=cd0 ", iso);
+    port = ahci_port_select(ahci);
+
+    buffer = ahci_alloc(ahci, bcl);
+    qtest_memset(ahci->parent->qts, buffer, 0x00, bcl);
+
+    cmd = ahci_atapi_command_create(CMD_ATAPI_READ_10, bcl, dma);
+    ahci_command_adjust(cmd, 0, buffer, bcl, 0);
+    ahci_command_commit(ahci, cmd, port);
+    ahci_command_issue_async(ahci, cmd);
+
+    /* Drain (all nodes) while the delayed read is still in flight. */
+    qtest_qmp_assert_success(ahci->parent->qts,
+        "{ 'execute': 'x-blockdev-set-iothread',"
+        "  'arguments': { 'node-name': 'cd0', 'iothread': null,"
+        "                 'force': true } }");
+
+    /* Round-trip through the device to confirm qemu is still alive. */
+    ahci_px_rreg(ahci, port, AHCI_PX_TFD);
+
+    ahci_command_free(cmd);
+    ahci_free(ahci, buffer);
+    g_free(tx);
+    ahci_shutdown(ahci);
+    remove_iso(fd, iso);
+}
+
+static void test_atapi_drain_pio(void)
+{
+    test_atapi_drain_in_flight(false);
+}
+
+static void test_atapi_drain_dma(void)
+{
+    test_atapi_drain_in_flight(true);
+}
+
 /* Regression test: Test that a READ_CD command with a BCL of 0 but a size of 0
  * completes as a NOP instead of erroring out. */
 static void test_atapi_bcl(void)
@@ -2177,6 +2241,8 @@ int main(int argc, char **argv)
                    test_atapi_engine_restart_pio);
     qtest_add_func("/ahci/cdrom/engine_restart/dma",
                    test_atapi_engine_restart_dma);
+    qtest_add_func("/ahci/cdrom/drain/pio", test_atapi_drain_pio);
+    qtest_add_func("/ahci/cdrom/drain/dma", test_atapi_drain_dma);
 
     ret = g_test_run();
 
Signature · 1 line
2.53.0
#3 lore raw

[PULL 3/8] tests/qtest/ide-test: add a multi-sector ATAPI DMA read test

In reply to Denis V. Lunev

test_cdrom_pio_large() already exercises a multi-sector PIO read. Add the DMA counterpart through the same cdrom_read_impl() helper so the multi-block ATAPI DMA read path gets equivalent coverage.

CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
 tests/qtest/ide-test.c | 6 ++++++
 1 file changed, 6 insertions(+)
tests/qtest/ide-test.c +6 -0
index 0fcfd0688c..2c674edf15 100644
@@ -1159,6 +1159,11 @@ static void test_cdrom_dma(void)
     cdrom_read_impl(1, CDROM_DMA);
 }
 
+static void test_cdrom_dma_large(void)
+{
+    cdrom_read_impl(BYTE_COUNT_LIMIT * 4 / ATAPI_BLOCK_SIZE, CDROM_DMA);
+}
+
 int main(int argc, char **argv)
 {
     const char *base;
@@ -1218,6 +1223,7 @@ int main(int argc, char **argv)
     qtest_add_func("/ide/cdrom/pio", test_cdrom_pio);
     qtest_add_func("/ide/cdrom/pio_large", test_cdrom_pio_large);
     qtest_add_func("/ide/cdrom/dma", test_cdrom_dma);
+    qtest_add_func("/ide/cdrom/dma_large", test_cdrom_dma_large);
 
     ret = g_test_run();
 
Signature · 1 line
2.53.0
#4 lore raw

[PULL 7/8] hw/ide/atapi: read the whole elementary transfer asynchronously

In reply to Denis V. Lunev

An ATAPI PIO read whose byte-count limit spans more than one CD sector must fetch the later sectors of a DRQ burst from inside the completion of the first, asynchronous read. cd_read_sector_sync() did this with a synchronous blk_pread(), which runs blk_wait_while_drained() before issuing the request.

If a drain is in progress when that completion runs -- as happens when a guest reset reaches virtio_blk_stop_ioeventfd() -> bdrv_drain_all_begin() while an ATAPI read is in flight on the same QEMU -- the nested read is queued until the drained section ends while the outer completion still holds blk->in_flight. bdrv_drain_all_begin() then waits forever for that in_flight count to drop: the main loop is wedged in the drain with the BQL held, and every other QMP/monitor operation blocks behind it.

Read the whole elementary transfer in a single asynchronous request up front instead, so no read is ever issued in the middle of a burst. cd_read_sector() now reads all the sectors a burst spans (the raw 2352-byte case is unpacked in place on completion) and cd_read_sector_sync() is removed. The DMA path already batched its reads and is unchanged.

CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
 hw/ide/atapi.c | 180 +++++++++++++++++++++++--------------------------
 1 file changed, 84 insertions(+), 96 deletions(-)
hw/ide/atapi.c +84 -96
index a42b748521..0ea149ad8c 100644
@@ -88,46 +88,14 @@ static void cd_data_to_raw(uint8_t *buf, int lba)
     memset(buf, 0, 288);
 }
 
-static int
-cd_read_sector_sync(IDEState *s)
-{
-    int ret;
-    block_acct_start(blk_get_stats(s->blk), &s->acct,
-                     ATAPI_SECTOR_SIZE, BLOCK_ACCT_READ);
-
-    trace_cd_read_sector_sync(s->lba);
-
-    switch (s->cd_sector_size) {
-    case 2048:
-        ret = blk_pread(s->blk, (int64_t)s->lba << ATAPI_SECTOR_BITS,
-                        ATAPI_SECTOR_SIZE, s->io_buffer, 0);
-        break;
-    case 2352:
-        ret = blk_pread(s->blk, (int64_t)s->lba << ATAPI_SECTOR_BITS,
-                        ATAPI_SECTOR_SIZE, s->io_buffer + 16, 0);
-        if (ret >= 0) {
-            cd_data_to_raw(s->io_buffer, s->lba);
-        }
-        break;
-    default:
-        block_acct_invalid(blk_get_stats(s->blk), BLOCK_ACCT_READ);
-        return -EIO;
-    }
-
-    if (ret < 0) {
-        block_acct_failed(blk_get_stats(s->blk), &s->acct);
-    } else {
-        block_acct_done(blk_get_stats(s->blk), &s->acct);
-        s->lba++;
-        s->io_buffer_index = 0;
-    }
-
-    return ret;
-}
-
 static void cd_read_sector_cb(void *opaque, int ret)
 {
     IDEState *s = opaque;
+    int et = s->elementary_transfer_size;
+    int skip = s->io_buffer_index;
+    int nsec = DIV_ROUND_UP(skip + et, s->cd_sector_size);
+    uint8_t *buf;
+    int i;
 
     trace_cd_read_sector_cb(s->lba, ret);
 
@@ -140,34 +108,64 @@ static void cd_read_sector_cb(void *opaque, int ret)
     block_acct_done(blk_get_stats(s->blk), &s->acct);
 
     if (s->cd_sector_size == 2352) {
-        cd_data_to_raw(s->io_buffer, s->lba);
+        /* unpack back-to-front so a sector never clobbers an unmoved one */
+        for (i = nsec - 1; i >= 0; i--) {
+            memmove(s->io_buffer + i * 2352 + 16, s->io_buffer + i * 2048,
+                    ATAPI_SECTOR_SIZE);
+            cd_data_to_raw(s->io_buffer + i * 2352, s->lba + i);
+        }
     }
 
-    s->lba++;
-    s->io_buffer_index = 0;
     s->status &= ~BUSY_STAT;
 
-    ide_atapi_cmd_reply_end(s);
+    s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO;
+    s->lcyl = et & 0xff;
+    s->hcyl = (et >> 8) & 0xff;
+    ide_bus_set_irq(s->bus);
+
+    /* a boundary sector shared with the next burst is re-read there */
+    buf = s->io_buffer + skip;
+    s->packet_transfer_size -= et;
+    s->lba += (skip + et) / s->cd_sector_size;
+    s->io_buffer_index = (skip + et) % s->cd_sector_size;
+    s->elementary_transfer_size = 0;
+
+    if (ide_transfer_start_norecurse(s, buf, et, ide_atapi_cmd_reply_end)) {
+        ide_atapi_cmd_reply_end(s);
+    }
 }
 
+/*
+ * Read the whole elementary transfer (one DRQ burst) in a single async
+ * request. No read is issued mid-burst, so unlike the old synchronous
+ * rebuffer it cannot deadlock against a concurrent drain.
+ */
 static int cd_read_sector(IDEState *s)
 {
-    void *buf;
+    int et = s->elementary_transfer_size;
+    int skip = s->io_buffer_index;
+    int nsec = DIV_ROUND_UP(skip + et, s->cd_sector_size);
 
     if (s->cd_sector_size != 2048 && s->cd_sector_size != 2352) {
         block_acct_invalid(blk_get_stats(s->blk), BLOCK_ACCT_READ);
         return -EINVAL;
     }
 
-    buf = (s->cd_sector_size == 2352) ? s->io_buffer + 16 : s->io_buffer;
-    qemu_iovec_init_buf(&s->qiov, buf, ATAPI_SECTOR_SIZE);
+    /* a burst is bounded by the byte count limit, so it fits io_buffer */
+    assert(nsec * s->cd_sector_size <= s->io_buffer_total_len);
+
+    /*
+     * Read the payload packed at the front of io_buffer; the 2352 raw case is
+     * unpacked into place on completion.
+     */
+    qemu_iovec_init_buf(&s->qiov, s->io_buffer, nsec * ATAPI_SECTOR_SIZE);
 
     trace_cd_read_sector(s->lba);
 
     block_acct_start(blk_get_stats(s->blk), &s->acct,
-                     ATAPI_SECTOR_SIZE, BLOCK_ACCT_READ);
+                     nsec * ATAPI_SECTOR_SIZE, BLOCK_ACCT_READ);
 
-    ide_buffered_readv(s, (int64_t)s->lba << 2, &s->qiov, 4,
+    ide_buffered_readv(s, (int64_t)s->lba << 2, &s->qiov, nsec * 4,
                        cd_read_sector_cb, s);
 
     s->status |= BUSY_STAT;
@@ -222,59 +220,49 @@ static uint16_t atapi_byte_count_limit(IDEState *s)
 void ide_atapi_cmd_reply_end(IDEState *s)
 {
     int byte_count_limit, size, ret;
-    while (s->packet_transfer_size > 0) {
-        trace_ide_atapi_cmd_reply_end(s, s->packet_transfer_size,
-                                      s->elementary_transfer_size,
-                                      s->io_buffer_index);
-
-        /* see if a new sector must be read */
-        if (s->lba != -1 && s->io_buffer_index >= s->cd_sector_size) {
-            if (!s->elementary_transfer_size) {
-                ret = cd_read_sector(s);
-                if (ret < 0) {
-                    ide_atapi_io_error(s, ret);
-                }
-                return;
-            } else {
-                /* rebuffering within an elementary transfer is
-                 * only possible with a sync request because we
-                 * end up with a race condition otherwise */
-                ret = cd_read_sector_sync(s);
-                if (ret < 0) {
-                    ide_atapi_io_error(s, ret);
-                    return;
-                }
+
+    trace_ide_atapi_cmd_reply_end(s, s->packet_transfer_size,
+                                  s->elementary_transfer_size,
+                                  s->io_buffer_index);
+
+    if (s->lba != -1 && s->packet_transfer_size > 0) {
+        byte_count_limit = atapi_byte_count_limit(s);
+        trace_ide_atapi_cmd_reply_end_bcl(s, byte_count_limit);
+        size = s->packet_transfer_size;
+        if (size > byte_count_limit) {
+            /* byte count limit must be even if this case */
+            if (byte_count_limit & 1) {
+                byte_count_limit--;
             }
+            size = byte_count_limit;
         }
-        if (s->elementary_transfer_size > 0) {
-            /* there are some data left to transmit in this elementary
-               transfer */
-            size = s->cd_sector_size - s->io_buffer_index;
-            if (size > s->elementary_transfer_size)
-                size = s->elementary_transfer_size;
-        } else {
-            /* a new transfer is needed */
-            s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO;
-            ide_bus_set_irq(s->bus);
-            byte_count_limit = atapi_byte_count_limit(s);
-            trace_ide_atapi_cmd_reply_end_bcl(s, byte_count_limit);
-            size = s->packet_transfer_size;
-            if (size > byte_count_limit) {
-                /* byte count limit must be even if this case */
-                if (byte_count_limit & 1)
-                    byte_count_limit--;
-                size = byte_count_limit;
-            }
-            s->lcyl = size & 0xff;
-            s->hcyl = size >> 8;
-            s->elementary_transfer_size = size;
-            /* we cannot transmit more than one sector at a time */
-            if (s->lba != -1) {
-                if (size > (s->cd_sector_size - s->io_buffer_index))
-                    size = (s->cd_sector_size - s->io_buffer_index);
+        s->elementary_transfer_size = size;
+        ret = cd_read_sector(s);
+        if (ret < 0) {
+            ide_atapi_io_error(s, ret);
+        }
+        return;
+    }
+
+    while (s->packet_transfer_size > 0) {
+        /* a new transfer is needed */
+        s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO;
+        ide_bus_set_irq(s->bus);
+        byte_count_limit = atapi_byte_count_limit(s);
+        trace_ide_atapi_cmd_reply_end_bcl(s, byte_count_limit);
+        size = s->packet_transfer_size;
+        if (size > byte_count_limit) {
+            /* byte count limit must be even if this case */
+            if (byte_count_limit & 1) {
+                byte_count_limit--;
             }
-            trace_ide_atapi_cmd_reply_end_new(s, s->status);
+            size = byte_count_limit;
         }
+        s->lcyl = size & 0xff;
+        s->hcyl = size >> 8;
+        s->elementary_transfer_size = size;
+        trace_ide_atapi_cmd_reply_end_new(s, s->status);
+
         s->packet_transfer_size -= size;
         s->elementary_transfer_size -= size;
         s->io_buffer_index += size;
@@ -329,7 +317,7 @@ static void ide_atapi_cmd_read_pio(IDEState *s, int lba, int nb_sectors,
     s->lba = lba;
     s->packet_transfer_size = nb_sectors * sector_size;
     s->elementary_transfer_size = 0;
-    s->io_buffer_index = sector_size;
+    s->io_buffer_index = 0;
     s->cd_sector_size = sector_size;
 
     ide_atapi_cmd_reply_end(s);
Signature · 1 line
2.53.0
#5 lore raw

[PULL 5/8] tests/qtest/libqos/ahci: support raw (2352-byte) READ CD

In reply to Denis V. Lunev

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.

CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
 tests/qtest/libqos/ahci.c | 5 +++++
 tests/qtest/libqos/ahci.h | 2 ++
 2 files changed, 7 insertions(+)
tests/qtest/libqos/ahci.c +5 -0
index 0621a6c477..e3019a1eca 100644
@@ -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);
     }
tests/qtest/libqos/ahci.h +2 -0
index a0487a1557..2a48a7523d 100644
@@ -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 *);
Signature · 1 line
2.53.0
#6 lore raw

[PULL 2/8] tests/qtest/ide-test: parametrize the ATAPI CD-ROM read test

In reply to Denis V. Lunev

cdrom_pio_impl() and test_cdrom_dma() duplicate the same image setup and data-integrity check around two different transfer mechanisms. Fold them into a single cdrom_read_impl(nblocks, flags) helper, with a CDROM_PIO/CDROM_DMA flag selecting the transfer, so further read coverage can be added once for both paths.

No functional change: /ide/cdrom/pio, pio_large and dma run exactly as before.

CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
 tests/qtest/ide-test.c | 146 +++++++++++++++++++----------------------
 1 file changed, 68 insertions(+), 78 deletions(-)
tests/qtest/ide-test.c +68 -78
index 721e78170b..0fcfd0688c 100644
@@ -982,6 +982,7 @@ static void send_scsi_cdb_read10(QPCIDevice *dev, QPCIBar ide_bar,
     }
 }
 
+
 static void nsleep(QTestState *qts, int64_t nsecs)
 {
     const struct timespec val = { .tv_nsec = nsecs };
@@ -1034,8 +1035,12 @@ static void ide_wait_intr(QTestState *qts, int irq)
     g_assert_not_reached();
 }
 
-static void cdrom_pio_impl(int nblocks)
+#define CDROM_PIO 0
+#define CDROM_DMA (1 << 0)
+
+static void cdrom_read_impl(int nblocks, unsigned flags)
 {
+    bool dma = flags & CDROM_DMA;
     QTestState *qts;
     QPCIDevice *dev;
     QPCIBar bmdma_bar, ide_bar;
@@ -1063,57 +1068,75 @@ static void cdrom_pio_impl(int nblocks)
     dev = get_pci_device(qts, &bmdma_bar, &ide_bar);
     qtest_irq_intercept_in(qts, "ioapic");
 
-    /* PACKET command on device 0 */
-    qpci_io_writeb(dev, ide_bar, reg_device, 0);
-    qpci_io_writeb(dev, ide_bar, reg_lba_middle, BYTE_COUNT_LIMIT & 0xFF);
-    qpci_io_writeb(dev, ide_bar, reg_lba_high, (BYTE_COUNT_LIMIT >> 8 & 0xFF));
-    qpci_io_writeb(dev, ide_bar, reg_command, CMD_PACKET);
-    /* HP0: Check_Status_A State */
-    nsleep(qts, 400);
-    data = ide_wait_clear(qts, BSY);
-    /* HP1: Send_Packet State */
-    assert_bit_set(data, DRQ | DRDY);
-    assert_bit_clear(data, ERR | DF | BSY);
-
-    /* SCSI CDB (READ10) -- read n*2048 bytes from block 0 */
-    send_scsi_cdb_read10(dev, ide_bar, 0, nblocks);
-
-    /* Read data back: occurs in bursts of 'BYTE_COUNT_LIMIT' bytes.
-     * If BYTE_COUNT_LIMIT is odd, we transfer BYTE_COUNT_LIMIT - 1 bytes.
-     * We allow an odd limit only when the remaining transfer size is
-     * less than BYTE_COUNT_LIMIT. However, SCSI's read10 command can only
-     * request n blocks, so our request size is always even.
-     * For this reason, we assume there is never a hanging byte to fetch. */
-    g_assert(!(rxsize & 1));
-    limit = BYTE_COUNT_LIMIT & ~1;
-    for (i = 0; i < DIV_ROUND_UP(rxsize, limit); i++) {
-        size_t offset = i * (limit / 2);
-        size_t rem = (rxsize / 2) - offset;
-
-        /* HP3: INTRQ_Wait */
-        ide_wait_intr(qts, IDE_PRIMARY_IRQ);
+    if (dma) {
+        uintptr_t guest_buf = guest_alloc(&guest_malloc, rxsize);
+        PrdtEntry prdt[1];
+
+        prdt[0].addr = cpu_to_le32(guest_buf);
+        prdt[0].size = cpu_to_le32(rxsize | PRDT_EOT);
 
-        /* HP2: Check_Status_B (and clear IRQ) */
+        send_dma_request_dev(qts, dev, bmdma_bar, ide_bar, CMD_PACKET, 0,
+                             nblocks, prdt, ARRAY_SIZE(prdt),
+                             send_scsi_cdb_read10);
+
+        qtest_memread(qts, guest_buf, rx, rxsize);
+    } else {
+        /* PACKET command on device 0 */
+        qpci_io_writeb(dev, ide_bar, reg_device, 0);
+        qpci_io_writeb(dev, ide_bar, reg_lba_middle, BYTE_COUNT_LIMIT & 0xFF);
+        qpci_io_writeb(dev, ide_bar, reg_lba_high,
+                       (BYTE_COUNT_LIMIT >> 8 & 0xFF));
+        qpci_io_writeb(dev, ide_bar, reg_command, CMD_PACKET);
+        /* HP0: Check_Status_A State */
+        nsleep(qts, 400);
         data = ide_wait_clear(qts, BSY);
+        /* HP1: Send_Packet State */
         assert_bit_set(data, DRQ | DRDY);
         assert_bit_clear(data, ERR | DF | BSY);
 
-        /* HP4: Transfer_Data */
-        for (j = 0; j < MIN((limit / 2), rem); j++) {
-            rx[offset + j] = cpu_to_le16(qpci_io_readw(dev, ide_bar,
-                                                       reg_data));
+        /* SCSI CDB (READ10) -- read n*2048 bytes from block 0 */
+        send_scsi_cdb_read10(dev, ide_bar, 0, nblocks);
+
+        /*
+         * Read data back: occurs in bursts of 'BYTE_COUNT_LIMIT' bytes.
+         * If BYTE_COUNT_LIMIT is odd, we transfer BYTE_COUNT_LIMIT - 1 bytes.
+         * We allow an odd limit only when the remaining transfer size is
+         * less than BYTE_COUNT_LIMIT. However, SCSI's read10 command can only
+         * request n blocks, so our request size is always even.
+         * For this reason, we assume there is never a hanging byte to fetch.
+         */
+        g_assert(!(rxsize & 1));
+        limit = BYTE_COUNT_LIMIT & ~1;
+        for (i = 0; i < DIV_ROUND_UP(rxsize, limit); i++) {
+            size_t offset = i * (limit / 2);
+            size_t rem = (rxsize / 2) - offset;
+
+            /* HP3: INTRQ_Wait */
+            ide_wait_intr(qts, IDE_PRIMARY_IRQ);
+
+            /* HP2: Check_Status_B (and clear IRQ) */
+            data = ide_wait_clear(qts, BSY);
+            assert_bit_set(data, DRQ | DRDY);
+            assert_bit_clear(data, ERR | DF | BSY);
+
+            /* HP4: Transfer_Data */
+            for (j = 0; j < MIN((limit / 2), rem); j++) {
+                rx[offset + j] = cpu_to_le16(qpci_io_readw(dev, ide_bar,
+                                                           reg_data));
+            }
         }
-    }
 
-    /* Check for final completion IRQ */
-    ide_wait_intr(qts, IDE_PRIMARY_IRQ);
+        /* Check for final completion IRQ */
+        ide_wait_intr(qts, IDE_PRIMARY_IRQ);
 
-    /* Sanity check final state */
-    data = ide_wait_clear(qts, DRQ);
-    assert_bit_set(data, DRDY);
-    assert_bit_clear(data, DRQ | ERR | DF | BSY);
+        /* Sanity check final state */
+        data = ide_wait_clear(qts, DRQ);
+        assert_bit_set(data, DRDY);
+        assert_bit_clear(data, DRQ | ERR | DF | BSY);
+    }
 
     g_assert_cmpint(memcmp(pattern, rx, rxsize), ==, 0);
+
     g_free(pattern);
     g_free(rx);
     test_bmdma_teardown(qts);
@@ -1122,51 +1145,18 @@ static void cdrom_pio_impl(int nblocks)
 
 static void test_cdrom_pio(void)
 {
-    cdrom_pio_impl(1);
+    cdrom_read_impl(1, CDROM_PIO);
 }
 
 static void test_cdrom_pio_large(void)
 {
     /* Test a few loops of the PIO DRQ mechanism. */
-    cdrom_pio_impl(BYTE_COUNT_LIMIT * 4 / ATAPI_BLOCK_SIZE);
+    cdrom_read_impl(BYTE_COUNT_LIMIT * 4 / ATAPI_BLOCK_SIZE, CDROM_PIO);
 }
 
-
 static void test_cdrom_dma(void)
 {
-    QTestState *qts;
-    static const size_t len = ATAPI_BLOCK_SIZE;
-    size_t ret;
-    char *pattern = g_malloc(ATAPI_BLOCK_SIZE * 16);
-    char *rx = g_malloc0(len);
-    uintptr_t guest_buf;
-    PrdtEntry prdt[1];
-    FILE *fh;
-
-    qts = ide_test_start(
-            "-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 "
-            "-device ide-cd,drive=sr0,bus=ide.0", tmp_path[0]);
-    qtest_irq_intercept_in(qts, "ioapic");
-
-    guest_buf = guest_alloc(&guest_malloc, len);
-    prdt[0].addr = cpu_to_le32(guest_buf);
-    prdt[0].size = cpu_to_le32(len | PRDT_EOT);
-
-    generate_pattern(pattern, ATAPI_BLOCK_SIZE * 16, ATAPI_BLOCK_SIZE);
-    fh = fopen(tmp_path[0], "wb+");
-    ret = fwrite(pattern, ATAPI_BLOCK_SIZE, 16, fh);
-    g_assert_cmpint(ret, ==, 16);
-    fclose(fh);
-
-    send_dma_request(qts, CMD_PACKET, 0, 1, prdt, 1, send_scsi_cdb_read10);
-
-    /* Read back data from guest memory into local qtest memory */
-    qtest_memread(qts, guest_buf, rx, len);
-    g_assert_cmpint(memcmp(pattern, rx, len), ==, 0);
-
-    g_free(pattern);
-    g_free(rx);
-    test_bmdma_teardown(qts);
+    cdrom_read_impl(1, CDROM_DMA);
 }
 
 int main(int argc, char **argv)
Signature · 1 line
2.53.0
#7 lore raw

Re: [PULL 2/8] tests/qtest/ide-test: parametrize the ATAPI CD-ROM read test

Quoted 21 lines · Denis V. Lunev

cdrom_pio_impl() and test_cdrom_dma() duplicate the same image setup and data-integrity check around two different transfer mechanisms. Fold them into a single cdrom_read_impl(nblocks, flags) helper, with a CDROM_PIO/CDROM_DMA flag selecting the transfer, so further read coverage can be added once for both paths.

No functional change: /ide/cdrom/pio, pio_large and dma run exactly as before.

CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
  tests/qtest/ide-test.c | 146 +++++++++++++++++++----------------------
  1 file changed, 68 insertions(+), 78 deletions(-)
tests/qtest/ide-test.c +0 -0
index 721e78170b..0fcfd0688c 100644

tests/qtest/ide-test.c static void send_scsi_cdb_read10(QPCIDevice *dev, QPCIBar ide_bar, · line 988

Quoted 7 lines
tests/qtest/ide-test.c +1 -0
@@ -982,6 +982,7 @@ static void send_scsi_cdb_read10(QPCIDevice *dev, QPCIBar ide_bar,
      }
  }
 
+
  static void nsleep(QTestState *qts, int64_t nsecs)
  {
      const struct timespec val = { .tv_nsec = nsecs };

The above hunk introduces a white space damage. Please drop it.

Thanks,
Thomas

#8 lore raw

[PULL 6/8] tests/qtest/ahci: cover raw (2352-byte) ATAPI CD reads

In reply to Denis V. Lunev

Add /ahci/cdrom/{pio,dma}/raw: read several sectors with READ CD in raw mode (atapi_raw), so the ATAPI 2352-byte unpack path is exercised through the AHCI delivery, which IDE coverage does not reach. Each sector's 2048-byte payload is verified at its in-sector offset.

The PIO case uses a byte-count limit of one raw sector per DRQ burst:
libqos asserts a one-sector PIO transfer, and the multi-sector unpack loop is already covered by the IDE raw test.

CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
 tests/qtest/ahci-test.c | 68 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
tests/qtest/ahci-test.c +68 -0
index 44799eea15..58bc04b3ef 100644
@@ -1565,6 +1565,31 @@ static int ahci_cb_cmp_buff(AHCIQState *ahci, AHCICommand *cmd,
     return 0;
 }
 
+static int ahci_cb_cmp_raw(AHCIQState *ahci, AHCICommand *cmd,
+                           const AHCIOpts *opts)
+{
+    unsigned char *tx = opts->opaque;
+    unsigned char *rx;
+    unsigned i, nsectors;
+
+    if (!opts->size) {
+        return 0;
+    }
+
+    nsectors = opts->size / ATAPI_RAW_SECTOR_SIZE;
+    rx = g_malloc0(opts->size);
+    qtest_bufread(ahci->parent->qts, opts->buffer, rx, opts->size);
+    /* Each raw sector carries its 2048-byte payload past a 16-byte header. */
+    for (i = 0; i < nsectors; i++) {
+        g_assert_cmphex(memcmp(rx + i * ATAPI_RAW_SECTOR_SIZE + 16,
+                               tx + i * ATAPI_SECTOR_SIZE,
+                               ATAPI_SECTOR_SIZE), ==, 0);
+    }
+    g_free(rx);
+
+    return 0;
+}
+
 static void ahci_test_cdrom(int nsectors, bool dma, uint8_t cmd,
                             bool override_bcl, uint16_t bcl)
 {
@@ -1625,6 +1650,47 @@ static void test_cdrom_pio_multi(void)
     ahci_test_cdrom_read10(3, false);
 }
 
+static void ahci_test_cdrom_raw(int nsectors, bool dma)
+{
+    AHCIQState *ahci;
+    unsigned char *tx;
+    char *iso;
+    int fd;
+    AHCIOpts opts = {
+        .size = (uint64_t)ATAPI_RAW_SECTOR_SIZE * nsectors,
+        .atapi = true,
+        .atapi_dma = dma,
+        .atapi_raw = true,
+        .set_bcl = true,
+        .bcl = ATAPI_RAW_SECTOR_SIZE, /* one raw sector per DRQ burst */
+        .post_cb = ahci_cb_cmp_raw,
+    };
+    uint64_t iso_size = (uint64_t)ATAPI_SECTOR_SIZE * (nsectors + 1);
+
+    fd = prepare_iso(iso_size, &tx, &iso);
+    opts.opaque = tx;
+
+    ahci = ahci_boot_and_enable("-drive if=none,id=drive0,file=%s,format=raw "
+                                "-M q35 "
+                                "-device ide-cd,drive=drive0 ", iso);
+
+    ahci_exec(ahci, ahci_port_select(ahci), CMD_ATAPI_READ_CD, &opts);
+
+    g_free(tx);
+    ahci_shutdown(ahci);
+    remove_iso(fd, iso);
+}
+
+static void test_cdrom_dma_raw(void)
+{
+    ahci_test_cdrom_raw(3, true);
+}
+
+static void test_cdrom_pio_raw(void)
+{
+    ahci_test_cdrom_raw(3, false);
+}
+
 /*
  * Regression test: a buffered ATAPI read completing after a command
  * engine restart must not dereference the cleared cur_cmd. Cover both
@@ -2100,8 +2166,10 @@ int main(int argc, char **argv)
 
     qtest_add_func("/ahci/cdrom/dma/single", test_cdrom_dma);
     qtest_add_func("/ahci/cdrom/dma/multi", test_cdrom_dma_multi);
+    qtest_add_func("/ahci/cdrom/dma/raw", test_cdrom_dma_raw);
     qtest_add_func("/ahci/cdrom/pio/single", test_cdrom_pio);
     qtest_add_func("/ahci/cdrom/pio/multi", test_cdrom_pio_multi);
+    qtest_add_func("/ahci/cdrom/pio/raw", test_cdrom_pio_raw);
 
     qtest_add_func("/ahci/cdrom/pio/bcl", test_atapi_bcl);
     qtest_add_func("/ahci/cdrom/eject", test_atapi_tray);
Signature · 1 line
2.53.0
#9 lore raw

[PULL 1/8] MAINTAINERS: add myself to IDE maintainers

In reply to Denis V. Lunev
CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 902db77218..4628793dde 100644
@@ -2160,6 +2160,7 @@ F: docs/specs/edu.rst
 
 IDE
 M: John Snow <[email protected]>
+M: Denis V. Lunev <[email protected]>
 L: [email protected]
 S: Odd Fixes
 F: include/hw/ide/
Signature · 1 line
2.53.0
#11 lore raw

Re: [PULL 1/8] MAINTAINERS: add myself to IDE maintainers

In reply to Denis V. Lunev
Quoted 13 lines · Denis V. Lunev
CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 902db77218..4628793dde 100644

MAINTAINERS F: docs/specs/edu.rst · line 2163

Quoted 4 lines
MAINTAINERS +1 -0
@@ -2160,6 +2160,7 @@ F: docs/specs/edu.rst
 
 IDE
 M: John Snow <[email protected]>
+M: Denis V. Lunev <[email protected]>

Waiting for acknowledgement from John.

Stefan

#12 lore raw

Re: [PULL 1/8] MAINTAINERS: add myself to IDE maintainers

Quoted 14 lines · Stefan Hajnoczi
Quoted 13 lines · Denis V. Lunev
CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 902db77218..4628793dde 100644
@@ -2160,6 +2160,7 @@ F: docs/specs/edu.rst
 
Quoted 6 lines

MAINTAINERS F: docs/specs/edu.rst · line 2163

Quoted 3 lines
MAINTAINERS +1 -0
 IDE
 M: John Snow <[email protected]>
+M: Denis V. Lunev <[email protected]>

Waiting for acknowledgement from John.

Stefan

Most likely this could be a problem unfortunately. I have running with this series for couple of months without attention.

Stefan, do you have any way to internally ping him from inside?

Den

#13 lore raw

Re: [PULL 1/8] MAINTAINERS: add myself to IDE maintainers

Quoted 20 lines · Denis V. Lunev
Quoted 19 lines · Stefan Hajnoczi
Quoted 12 lines · Denis V. Lunev
CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 902db77218..4628793dde 100644

MAINTAINERS F: docs/specs/edu.rst · line 2163

Quoted 4 lines
MAINTAINERS +1 -0
@@ -2160,6 +2160,7 @@ F: docs/specs/edu.rst
 
 IDE
 M: John Snow <[email protected]>
+M: Denis V. Lunev <[email protected]>

Waiting for acknowledgement from John.

Quoted 7 lines
Quoted 1 line

Stefan

Most likely this could be a problem unfortunately. I have running with this series for couple of months without attention.

Stefan, do you have any way to internally ping him from inside?

I have pinged John.

AFAIK though, he ceased proactively doing IDE maint many years ago both upstream & downstream, and just left himself there so it wasn't left orphaned. There haven't been patches to hw/ide from John for 6 years.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#14 lore raw

Re: [PULL 1/8] MAINTAINERS: add myself to IDE maintainers

In reply to Stefan Hajnoczi
Quoted 14 lines · Stefan Hajnoczi
Quoted 13 lines · Denis V. Lunev
CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 902db77218..4628793dde 100644
@@ -2160,6 +2160,7 @@ F: docs/specs/edu.rst
 
Quoted 6 lines

MAINTAINERS F: docs/specs/edu.rst · line 2163

Quoted 3 lines
MAINTAINERS +1 -0
 IDE
 M: John Snow <[email protected]>
+M: Denis V. Lunev <[email protected]>

Waiting for acknowledgement from John.

Stefan

The situation is not changed in general from yesterday.

I can drop this patch from the submission, that is not a problem. The problem is that IDE changes are not moving, f.e. there is another stuck item for

https://gitlab.com/qemu-project/qemu/-/work_items/2399

floating in the list for month.

Den

#15 lore raw

Re: [PULL 1/8] MAINTAINERS: add myself to IDE maintainers

Quoted 24 lines · Denis V. Lunev
Quoted 14 lines · Stefan Hajnoczi
Quoted 13 lines · Denis V. Lunev
CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 902db77218..4628793dde 100644
@@ -2160,6 +2160,7 @@ F: docs/specs/edu.rst
 
Quoted 6 lines

MAINTAINERS F: docs/specs/edu.rst · line 2163

Quoted 3 lines
MAINTAINERS +1 -0
 IDE
 M: John Snow <[email protected]>
+M: Denis V. Lunev <[email protected]>

Waiting for acknowledgement from John.

Stefan

The situation is not changed in general from yesterday.

Quoted 7 lines

I can drop this patch from the submission, that is not a problem. The problem is that IDE changes are not moving, f.e. there is another stuck item for

https://gitlab.com/qemu-project/qemu/-/work_items/2399

floating in the list for month.

It would be great to have you as an active IDE maintainer, Denis. I would like to see John Snow acknowledge the MAINTAINERS change on qemu-devel before we merge it.

Please resend the pull request without the MAINTAINERS change for the time being. Feel free to include Peter Maydell's divide-by-zero fix too if you are happy with it. I'll merge the v2 pull request for v11.1.0-rc3 and we can independently allow John time officially confirm that MAINTAINERS change.

Thanks,
Stefan

#16 lore raw

Re: [PULL 1/8] MAINTAINERS: add myself to IDE maintainers

Quoted 35 lines · Stefan Hajnoczi
Quoted 23 lines · Denis V. Lunev
Quoted 14 lines · Stefan Hajnoczi
Quoted 13 lines · Denis V. Lunev
CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 902db77218..4628793dde 100644
@@ -2160,6 +2160,7 @@ F: docs/specs/edu.rst
 
Quoted 6 lines

MAINTAINERS F: docs/specs/edu.rst · line 2163

Quoted 3 lines
MAINTAINERS +1 -0
 IDE
 M: John Snow <[email protected]>
+M: Denis V. Lunev <[email protected]>

Waiting for acknowledgement from John.

Stefan

The situation is not changed in general from yesterday.

Quoted 7 lines

I can drop this patch from the submission, that is not a problem. The problem is that IDE changes are not moving, f.e. there is another stuck item for

https://gitlab.com/qemu-project/qemu/-/work_items/2399

floating in the list for month.

It would be great to have you as an active IDE maintainer, Denis. I would like to see John Snow acknowledge the MAINTAINERS change on qemu-devel before we merge it.

Quoted 8 lines

Please resend the pull request without the MAINTAINERS change for the time being. Feel free to include Peter Maydell's divide-by-zero fix too if you are happy with it. I'll merge the v2 pull request for v11.1.0-rc3 and we can independently allow John time officially confirm that MAINTAINERS change.

Thanks,
Stefan

Amazing plan.

Thanks,
    Den

#17 lore raw

Re: [PULL 1/8] MAINTAINERS: add myself to IDE maintainers

Quoted 17 lines · Denis V. Lunev
Quoted 16 lines · Stefan Hajnoczi
Quoted 15 lines · Denis V. Lunev
Quoted 14 lines · Stefan Hajnoczi
Quoted 13 lines · Denis V. Lunev
CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
  MAINTAINERS | 1 +
  1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 902db77218..4628793dde 100644
@@ -2160,6 +2160,7 @@ F: docs/specs/edu.rst
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

MAINTAINERS F: docs/specs/edu.rst · line 2163

Quoted 3 lines
MAINTAINERS +1 -0
  IDE
  M: John Snow <[email protected]>
+M: Denis V. Lunev <[email protected]>

Waiting for acknowledgement from John.

Note, Denis is not removing / replacing John, but simply stepping up to co-maintain an area unattented since quite some time. I doubt John will oppose to that precious and scarce help.

Quoted 28 lines
Quoted 15 lines
Quoted 11 lines
Quoted 2 lines

Stefan

The situation is not changed in general from yesterday.

I can drop this patch from the submission, that is not a problem. The problem is that IDE changes are not moving, f.e. there is another stuck item for

https://gitlab.com/qemu-project/qemu/-/work_items/2399

floating in the list for month.

It would be great to have you as an active IDE maintainer, Denis. I would like to see John Snow acknowledge the MAINTAINERS change on qemu-devel before we merge it.

Quoted 8 lines

Please resend the pull request without the MAINTAINERS change for the time being. Feel free to include Peter Maydell's divide-by-zero fix too if you are happy with it. I'll merge the v2 pull request for v11.1.0-rc3 and we can independently allow John time officially confirm that MAINTAINERS change.

Thanks,
Stefan

Amazing plan.

Thanks,
    Den

#18 lore raw

Re: [PULL 1/8] MAINTAINERS: add myself to IDE maintainers

Quoted 23 lines · Philippe Mathieu-Daudé
Quoted 17 lines · Denis V. Lunev
Quoted 16 lines · Stefan Hajnoczi
Quoted 15 lines · Denis V. Lunev
Quoted 14 lines · Stefan Hajnoczi
Quoted 13 lines · Denis V. Lunev
CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
  MAINTAINERS | 1 +
  1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 902db77218..4628793dde 100644
@@ -2160,6 +2160,7 @@ F: docs/specs/edu.rst
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

MAINTAINERS F: docs/specs/edu.rst · line 2163

Quoted 3 lines
MAINTAINERS +1 -0
  IDE
  M: John Snow <[email protected]>
+M: Denis V. Lunev <[email protected]>

Waiting for acknowledgement from John.

Quoted 4 lines

Note, Denis is not removing / replacing John, but simply stepping up to co-maintain an area unattented since quite some time. I doubt John will oppose to that precious and scarce help.

I don't think so either, but he should be involved in the process of adding a co-maintainer. There is no rush, let's give him a few more days rather than making the decision for him.

Stefan

#19 lore raw

Re: [PULL 1/8] MAINTAINERS: add myself to IDE maintainers

Quoted 25 lines · Stefan Hajnoczi
Quoted 23 lines · Philippe Mathieu-Daudé
Quoted 21 lines · Denis V. Lunev
Quoted 20 lines · Stefan Hajnoczi
Quoted 19 lines · Denis V. Lunev
Quoted 18 lines · Stefan Hajnoczi
Quoted 12 lines · Denis V. Lunev
CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
  MAINTAINERS | 1 +
  1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 902db77218..4628793dde 100644

MAINTAINERS F: docs/specs/edu.rst · line 2163

Quoted 4 lines
MAINTAINERS +1 -0
@@ -2160,6 +2160,7 @@ F: docs/specs/edu.rst
 
  IDE
  M: John Snow <[email protected]>
+M: Denis V. Lunev <[email protected]>

Waiting for acknowledgement from John.

Quoted 8 lines
Quoted 4 lines

Note, Denis is not removing / replacing John, but simply stepping up to co-maintain an area unattented since quite some time. I doubt John will oppose to that precious and scarce help.

I don't think so either, but he should be involved in the process of adding a co-maintainer. There is no rush, let's give him a few more days rather than making the decision for him.

My apologies, I was entertaining house guests and was not reading my email. I had intended to drop down to just "Odd Fixes" and could swear I sent a patch to do so some time ago, but apparently this never took.

Obviously, I have not paid a single drop of attention to IDE/FDC for quite some time and am elated to hand it over to someone with an active interest in fixing it up.

The reason I haven't been paying attention to IDE/FDC in general is due to the work required to verify and rewrite (often) low-effort CVE fixes. CVE hotfix patches for IDE in my experience usually just added an early return to the callback event loop to avoid a NULL dereference. These patches often didn't validate or test the register values or event loop state, and finding the "correct" error return strategy was often quite a lot of work that involved testing on quite a lot of operating systems to ensure we didn't break legacy systems, and this amount of work was in conflict with my other responsibilities, so it often got pushed by the wayside.

None of that excuses my silence and unexcused absence, and for that, I am sorry.

Please, please do go ahead and take over.

Apologies,
--js

#20 lore raw

Re: [PULL 1/8] MAINTAINERS: add myself to IDE maintainers

Quoted 1 line · John Snow

Please, please do go ahead and take over.

Hi John,
Thanks for the response! Do you want to stay listed in MAINTAINERS and review patches, or would you prefer to hand over maintainership completely?

Stefan

#21 lore raw

Re: [PULL 1/8] MAINTAINERS: add myself to IDE maintainers

In reply to John Snow
Quoted 31 lines · John Snow
Quoted 30 lines · Stefan Hajnoczi
Quoted 27 lines · Philippe Mathieu-Daudé
Quoted 17 lines · Denis V. Lunev
Quoted 16 lines · Stefan Hajnoczi
Quoted 15 lines · Denis V. Lunev
Quoted 14 lines · Stefan Hajnoczi
Quoted 13 lines · Denis V. Lunev
CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
   MAINTAINERS | 1 +
   1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 902db77218..4628793dde 100644
@@ -2160,6 +2160,7 @@ F: docs/specs/edu.rst
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

MAINTAINERS F: docs/specs/edu.rst · line 2163

Quoted 3 lines
MAINTAINERS +1 -0
   IDE
   M: John Snow <[email protected]>
+M: Denis V. Lunev <[email protected]>

Waiting for acknowledgement from John.

Note, Denis is not removing / replacing John, but simply stepping up to co-maintain an area unattented since quite some time. I doubt John will oppose to that precious and scarce help.

Quoted 6 lines
Quoted 3 lines

I don't think so either, but he should be involved in the process of adding a co-maintainer. There is no rush, let's give him a few more days rather than making the decision for him.

Please, please do go ahead and take over.

Thank you John :)

#22 lore raw

Re: [PULL 1/8] MAINTAINERS: add myself to IDE maintainers

In reply to Stefan Hajnoczi
Quoted 15 lines · Stefan Hajnoczi
Quoted 14 lines · Denis V. Lunev
CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 902db77218..4628793dde 100644
@@ -2160,6 +2160,7 @@ F: docs/specs/edu.rst
 
Quoted 8 lines

MAINTAINERS F: docs/specs/edu.rst · line 2163

Quoted 3 lines
MAINTAINERS +1 -0
 IDE
 M: John Snow <[email protected]>
+M: Denis V. Lunev <[email protected]>

Waiting for acknowledgement from John.

Stefan

Thanks, applied to my staging tree:
https://gitlab.com/stefanha/qemu/commits/staging

Stefan

#23 lore raw

Re: [PULL 1/8] MAINTAINERS: add myself to IDE maintainers

In reply to Denis V. Lunev
Quoted 12 lines · Denis V. Lunev
CC Stefan Hajnoczi <[email protected]>
CC Philippe Mathieu-Daudé <[email protected]>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 902db77218..4628793dde 100644

MAINTAINERS F: docs/specs/edu.rst · line 2166

Quoted 7 lines
MAINTAINERS +1 -0
@@ -2160,6 +2160,7 @@ F: docs/specs/edu.rst
 
 IDE
 M: John Snow <[email protected]>
+M: Denis V. Lunev <[email protected]>
 L: [email protected]
 S: Odd Fixes
 F: include/hw/ide/

Was this patch ever posted to the list? I can't find it in the archive...

#24 lore raw
In reply to Denis V. Lunev
Quoted 11 lines · Denis V. Lunev

IDE patches

- fix a main-loop deadlock when an ATAPI PIO read spanning several sectors is in flight while a drain starts: the nested sector fetch was issued synchronously from inside the completion of the first read and queued behind the drain, which then never finished
- read the whole ATAPI elementary transfer in one asynchronous request instead, removing cd_read_sector_sync()
- extend the IDE/AHCI qtest coverage of ATAPI CD reads: parametrized read helper, multi-sector DMA, raw 2352-byte READ CD on both delivery paths, and a regression test for the deadlock above

It looks like this whole pull request should be picked up for the currently active qemu stable series (both the fixes and the tests). Please let me know if something has to be left out.

Thanks,

/mjt