mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: introduce ActivationContext for device activation
Signed-off-by: Peter Oskolkov <posk@google.com>
(cherry picked from commit f77c6ef78b)
This commit is contained in:
@@ -95,15 +95,15 @@ fuzz_target!(|bytes: &[u8]| -> Corpus {
|
||||
reporting_queue_evt.write(1).unwrap();
|
||||
|
||||
balloon
|
||||
.activate(
|
||||
guest_memory,
|
||||
Arc::new(NoopVirtioInterrupt {}),
|
||||
vec![
|
||||
.activate(virtio_devices::ActivationContext {
|
||||
mem: guest_memory,
|
||||
interrupt_cb: Arc::new(NoopVirtioInterrupt {}),
|
||||
queues: vec![
|
||||
(0, inflate_q, inflate_evt),
|
||||
(1, deflate_q, deflate_evt),
|
||||
(2, reporting_q, reporting_evt),
|
||||
],
|
||||
)
|
||||
})
|
||||
.ok();
|
||||
|
||||
// Wait for the events to finish and balloon device worker thread to return
|
||||
|
||||
@@ -89,11 +89,11 @@ fuzz_target!(|bytes: &[u8]| -> Corpus {
|
||||
queue_evt.write(1).unwrap();
|
||||
|
||||
block
|
||||
.activate(
|
||||
guest_memory,
|
||||
Arc::new(NoopVirtioInterrupt {}),
|
||||
vec![(0, q, evt)],
|
||||
)
|
||||
.activate(virtio_devices::ActivationContext {
|
||||
mem: guest_memory,
|
||||
interrupt_cb: Arc::new(NoopVirtioInterrupt {}),
|
||||
queues: vec![(0, q, evt)],
|
||||
})
|
||||
.ok();
|
||||
|
||||
// Wait for the events to finish and block device worker thread to return
|
||||
|
||||
@@ -128,11 +128,11 @@ fuzz_target!(|bytes: &[u8]| -> Corpus {
|
||||
pipe_tx.write_all(console_input_bytes).unwrap(); // To use fuzzed data;
|
||||
|
||||
console
|
||||
.activate(
|
||||
guest_memory,
|
||||
Arc::new(NoopVirtioInterrupt {}),
|
||||
vec![(0, input_queue, input_evt), (1, output_queue, output_evt)],
|
||||
)
|
||||
.activate(virtio_devices::ActivationContext {
|
||||
mem: guest_memory,
|
||||
interrupt_cb: Arc::new(NoopVirtioInterrupt {}),
|
||||
queues: vec![(0, input_queue, input_evt), (1, output_queue, output_evt)],
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
// Wait for the events to finish and console device worker thread to return
|
||||
|
||||
@@ -107,14 +107,14 @@ fuzz_target!(|bytes: &[u8]| -> Corpus {
|
||||
request_queue_evt.write(1).unwrap();
|
||||
|
||||
iommu
|
||||
.activate(
|
||||
guest_memory,
|
||||
Arc::new(NoopVirtioInterrupt {}),
|
||||
vec![
|
||||
.activate(virtio_devices::ActivationContext {
|
||||
mem: guest_memory,
|
||||
interrupt_cb: Arc::new(NoopVirtioInterrupt {}),
|
||||
queues: vec![
|
||||
(0, request_queue, request_evt),
|
||||
(0, _event_queue, _event_evt),
|
||||
],
|
||||
)
|
||||
})
|
||||
.ok();
|
||||
|
||||
// Wait for the events to finish and vIOMMU device worker thread to return
|
||||
|
||||
@@ -105,11 +105,11 @@ fuzz_target!(|bytes: &[u8]| -> Corpus {
|
||||
queue_evt.write(1).unwrap();
|
||||
|
||||
virtio_mem
|
||||
.activate(
|
||||
guest_memory,
|
||||
Arc::new(NoopVirtioInterrupt {}),
|
||||
vec![(0, q, evt)],
|
||||
)
|
||||
.activate(virtio_devices::ActivationContext {
|
||||
mem: guest_memory,
|
||||
interrupt_cb: Arc::new(NoopVirtioInterrupt {}),
|
||||
queues: vec![(0, q, evt)],
|
||||
})
|
||||
.ok();
|
||||
|
||||
// Wait for the events to finish and virtio-mem device worker thread to return
|
||||
|
||||
@@ -143,11 +143,11 @@ fuzz_target!(|bytes: &[u8]| -> Corpus {
|
||||
input_queue_evt.write(1).unwrap();
|
||||
output_queue_evt.write(1).unwrap();
|
||||
|
||||
net.activate(
|
||||
guest_memory,
|
||||
Arc::new(NoopVirtioInterrupt {}),
|
||||
vec![(0, input_queue, input_evt), (1, output_queue, output_evt)],
|
||||
)
|
||||
net.activate(virtio_devices::ActivationContext {
|
||||
mem: guest_memory,
|
||||
interrupt_cb: Arc::new(NoopVirtioInterrupt {}),
|
||||
queues: vec![(0, input_queue, input_evt), (1, output_queue, output_evt)],
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
// Wait for the events to finish and net device worker thread to return
|
||||
|
||||
@@ -61,11 +61,11 @@ fuzz_target!(|bytes: &[u8]| -> Corpus {
|
||||
// Kick the 'queue' event before activate the pmem device
|
||||
queue_evt.write(1).unwrap();
|
||||
|
||||
pmem.activate(
|
||||
guest_memory,
|
||||
Arc::new(NoopVirtioInterrupt {}),
|
||||
vec![(0, q, evt)],
|
||||
)
|
||||
pmem.activate(virtio_devices::ActivationContext {
|
||||
mem: guest_memory,
|
||||
interrupt_cb: Arc::new(NoopVirtioInterrupt {}),
|
||||
queues: vec![(0, q, evt)],
|
||||
})
|
||||
.ok();
|
||||
|
||||
// Wait for the events to finish and pmem device worker thread to return
|
||||
|
||||
@@ -99,11 +99,11 @@ fuzz_target!(|bytes: &[u8]| -> Corpus {
|
||||
// Kick the 'queue' event before activate the rng device
|
||||
queue_evt.write(1).unwrap();
|
||||
|
||||
rng.activate(
|
||||
guest_memory,
|
||||
Arc::new(NoopVirtioInterrupt {}),
|
||||
vec![(0, q, evt)],
|
||||
)
|
||||
rng.activate(virtio_devices::ActivationContext {
|
||||
mem: guest_memory,
|
||||
interrupt_cb: Arc::new(NoopVirtioInterrupt {}),
|
||||
queues: vec![(0, q, evt)],
|
||||
})
|
||||
.ok();
|
||||
|
||||
// Wait for the events to finish and rng device worker thread to return
|
||||
|
||||
@@ -108,11 +108,11 @@ fuzz_target!(|bytes: &[u8]| -> Corpus {
|
||||
.unwrap();
|
||||
|
||||
vsock
|
||||
.activate(
|
||||
guest_memory,
|
||||
Arc::new(NoopVirtioInterrupt {}),
|
||||
vec![(0, q, evt)],
|
||||
)
|
||||
.activate(virtio_devices::ActivationContext {
|
||||
mem: guest_memory,
|
||||
interrupt_cb: Arc::new(NoopVirtioInterrupt {}),
|
||||
queues: vec![(0, q, evt)],
|
||||
})
|
||||
.ok();
|
||||
|
||||
// Wait for the events to finish and vsock device worker thread to return
|
||||
|
||||
@@ -64,11 +64,11 @@ fuzz_target!(|bytes: &[u8]| -> Corpus {
|
||||
queue_evt.write(1).unwrap();
|
||||
|
||||
watchdog
|
||||
.activate(
|
||||
guest_memory,
|
||||
Arc::new(NoopVirtioInterrupt {}),
|
||||
vec![(0, q, evt)],
|
||||
)
|
||||
.activate(virtio_devices::ActivationContext {
|
||||
mem: guest_memory,
|
||||
interrupt_cb: Arc::new(NoopVirtioInterrupt {}),
|
||||
queues: vec![(0, q, evt)],
|
||||
})
|
||||
.ok();
|
||||
|
||||
// Wait for the events to finish and watchdog device worker thread to return
|
||||
|
||||
Reference in New Issue
Block a user