From 636da215e3b594f452c670ceeeb5d89fc6cad8f4 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Fri, 17 Apr 2026 09:10:12 +0100 Subject: [PATCH] virtio-devices: Add VirtioDevice::access_platform() Adding this method to the trait will allow the virtio PCI code to access a feature conditional version of the access platform and simplify the logic. Signed-off-by: Rob Bradford --- virtio-devices/src/device.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/virtio-devices/src/device.rs b/virtio-devices/src/device.rs index ca2e5834e..89e1ee2ea 100644 --- a/virtio-devices/src/device.rs +++ b/virtio-devices/src/device.rs @@ -188,6 +188,12 @@ pub trait VirtioDevice: Send { /// Set the access platform trait to let the device perform address /// translations if needed. fn set_access_platform(&mut self, _access_platform: Arc) {} + + /// Returns the access platform only if VIRTIO_F_ACCESS_PLATFORM was + /// negotiated with the guest. + fn access_platform(&self) -> Option> { + None + } } /// Trait to define address translation for devices managed by virtio-iommu