From f29f3085ed4b3d8d83e499e7897d9949b7d98d0f Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Wed, 26 Jan 2022 11:46:14 +0100 Subject: [PATCH] virtio-queue: Remove queue addresses translation Now that the virtio-devices crate can take care of the queue addresses when placed behind a vIOMMU, we can remove the corresponding code. Signed-off-by: Sebastien Boeuf --- virtio-queue/src/queue.rs | 6 ------ virtio-queue/src/state.rs | 22 ---------------------- 2 files changed, 28 deletions(-) diff --git a/virtio-queue/src/queue.rs b/virtio-queue/src/queue.rs index a2918c50e..b7c1d8537 100644 --- a/virtio-queue/src/queue.rs +++ b/virtio-queue/src/queue.rs @@ -271,12 +271,6 @@ impl Queue { pub fn iter(&mut self) -> Result, Error> { self.state.iter(self.mem.memory()) } - - /// Set the queue to "ready", and update desc_table, avail_ring and - /// used_ring addresses based on the AccessPlatform handler. - pub fn enable(&mut self, set: bool) { - self.state.enable(set) - } } #[cfg(test)] diff --git a/virtio-queue/src/state.rs b/virtio-queue/src/state.rs index e3ab0040b..da1643a03 100644 --- a/virtio-queue/src/state.rs +++ b/virtio-queue/src/state.rs @@ -156,28 +156,6 @@ impl QueueState { .map(Wrapping) .map_err(Error::GuestMemory) } - - /// Set the queue to "ready", and update desc_table, avail_ring and - /// used_ring addresses based on the AccessPlatform handler. - pub fn enable(&mut self, set: bool) { - self.ready = set; - - if set { - // Translate address of descriptor table and vrings. - if let Some(access_platform) = &self.access_platform { - self.desc_table = - GuestAddress(access_platform.translate(self.desc_table.0, 0).unwrap()); - self.avail_ring = - GuestAddress(access_platform.translate(self.avail_ring.0, 0).unwrap()); - self.used_ring = - GuestAddress(access_platform.translate(self.used_ring.0, 0).unwrap()); - } - } else { - self.desc_table = GuestAddress(0); - self.avail_ring = GuestAddress(0); - self.used_ring = GuestAddress(0); - } - } } impl<'a> QueueStateGuard<'a> for QueueState {