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 <rbradford@meta.com>
This commit is contained in:
Rob Bradford
2026-04-17 09:10:12 +01:00
parent 81ee260ac3
commit 636da215e3

View File

@@ -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<dyn AccessPlatform>) {}
/// Returns the access platform only if VIRTIO_F_ACCESS_PLATFORM was
/// negotiated with the guest.
fn access_platform(&self) -> Option<Arc<dyn AccessPlatform>> {
None
}
}
/// Trait to define address translation for devices managed by virtio-iommu