@@ -19,6 +19,8 @@
#include "fork_fuzz.h"
#include "qos_fuzz.h"
+#include "exec/address-spaces.h"
+#include "hw/core/cpu.h"
#define QVIRTIO_NET_TIMEOUT_US (30 * 1000 * 1000)
#define QVIRTIO_RX_VQ 0
@@ -69,8 +71,8 @@ static void virtio_net_fuzz_multi(QTestState *s,
* If checking used ring, ensure that the fuzzer doesn't trigger
* trivial asserion failure on zero-zied buffer
*/
- qtest_memwrite(s, req_addr, Data, vqa.length);
-
+ address_space_write(first_cpu->as, req_addr, MEMTXATTRS_UNSPECIFIED,
+ &Data, vqa.length);
free_head = qvirtqueue_add(s, q, req_addr, vqa.length,
vqa.write, vqa.next);
@@ -23,6 +23,9 @@
#include "fork_fuzz.h"
#include "qos_fuzz.h"
+#include "exec/address-spaces.h"
+#include "hw/core/cpu.h"
+
#define PCI_SLOT 0x02
#define PCI_FN 0x00
#define QVIRTIO_SCSI_TIMEOUT_US (1 * 1000 * 1000)
@@ -108,7 +111,8 @@ static void virtio_scsi_fuzz(QTestState *s, QVirtioSCSIQueues* queues,
/* Copy the data into ram, and place it on the virtqueue */
uint64_t req_addr = guest_alloc(t_alloc, vqa.length);
- qtest_memwrite(s, req_addr, Data, vqa.length);
+ address_space_write(first_cpu->as, req_addr, MEMTXATTRS_UNSPECIFIED,
+ &Data, vqa.length);
if (vq_touched[vqa.queue] == 0) {
vq_touched[vqa.queue] = 1;
free_head[vqa.queue] = qvirtqueue_add(s, q, req_addr, vqa.length,
We don't need to serialize over QTest chardev when we can directly access the MMIO address space via the first registered CPU view. virtio-net-socket gets ~50% performance improvement. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- tests/qtest/fuzz/virtio_net_fuzz.c | 6 ++++-- tests/qtest/fuzz/virtio_scsi_fuzz.c | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-)