devices: Implement DMA for fw_cfg device

We pass a reference to the guest memory when we create the device
in DeviceManager. This allows us to access the guest memory for DMA.

Signed-off-by: Alex Orozco <alexorozco@google.com>
This commit is contained in:
Alex Orozco
2025-04-18 16:37:11 +00:00
committed by Bo Chen
parent 1f51e4525b
commit edee53ac1a
4 changed files with 257 additions and 16 deletions

View File

@@ -1477,7 +1477,9 @@ impl DeviceManager {
#[cfg(feature = "fw_cfg")]
pub fn create_fw_cfg_device(&mut self) -> Result<(), DeviceManagerError> {
let fw_cfg = Arc::new(Mutex::new(devices::legacy::FwCfg::new()));
let fw_cfg = Arc::new(Mutex::new(devices::legacy::FwCfg::new(
self.memory_manager.lock().as_ref().unwrap().guest_memory(),
)));
self.fw_cfg = Some(fw_cfg.clone());