From: Klaus Jensen <[email protected]>

Split DMA if the number of vector segments hits IOV_MAX.

Signed-off-by: Klaus Jensen <[email protected]>
---
 system/dma-helpers.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/system/dma-helpers.c b/system/dma-helpers.c
index 0d592f646809..feaa50ff4e1e 100644
--- a/system/dma-helpers.c
+++ b/system/dma-helpers.c
@@ -156,8 +156,11 @@ static void dma_blk_cb(void *opaque, int ret)
                 }
             }
         }
-        if (!mem)
+
+        if (!mem || dbs->iov.niov == IOV_MAX) {
             break;
+        }
+
         qemu_iovec_add(&dbs->iov, mem, cur_len);
         dbs->sg_cur_byte += cur_len;
         if (dbs->sg_cur_byte == dbs->sg->sg[dbs->sg_cur_index].len) {

-- 
2.51.0


Reply via email to