virtio-devices: iommu: Error out if couldn't translate address

It doesn't matter if we're trying to translate a GVA or a GPA address,
but in both cases we must error out if the address couldn't be
translated.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2022-04-04 14:43:36 +02:00
parent 76b1a009e4
commit 26006974e8

View File

@ -702,8 +702,10 @@ impl DmaRemapping for IommuMapping {
}
}
debug!("Into same addr...");
Ok(addr)
Err(io::Error::new(
io::ErrorKind::Other,
format!("failed to translate GVA addr 0x{:x}", addr),
))
}
fn translate_gpa(&self, id: u32, addr: u64) -> std::result::Result<u64, std::io::Error> {
@ -720,8 +722,10 @@ impl DmaRemapping for IommuMapping {
}
}
debug!("Into same addr...");
Ok(addr)
Err(io::Error::new(
io::ErrorKind::Other,
format!("failed to translate GPA addr 0x{:x}", addr),
))
}
}