virtio-devices: Introduce new function translating GPAs into GVAs

In anticipation for the vDPA need to translate a GPA back into a GVA, we
extend the existing trait DmaRemapping and AccessPlatform to perform
such operation.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2022-04-04 14:11:29 +02:00
parent 059e787cb5
commit 1cdf8b232d
3 changed files with 35 additions and 2 deletions

View File

@@ -209,6 +209,8 @@ pub trait VirtioDevice: Send {
pub trait DmaRemapping: Send + Sync {
/// Provide a way to translate GVA address ranges into GPAs.
fn translate_gva(&self, id: u32, addr: u64) -> std::result::Result<u64, std::io::Error>;
/// Provide a way to translate GPA address ranges into GVAs.
fn translate_gpa(&self, id: u32, addr: u64) -> std::result::Result<u64, std::io::Error>;
}
/// Structure to handle device state common to all devices