pci, vmm: Extend PciDevice trait to support BAR relocation

By adding a new method id() to the PciDevice trait, we allow the caller
to retrieve a unique identifier. This is used in the context of BAR
relocation to identify the device being relocated, so that we can update
the DeviceTree resources for all PCI devices (and not only
VirtioPciDevice).

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2022-04-07 18:16:19 +02:00
parent 6175cc0977
commit 5264d545dd
6 changed files with 55 additions and 20 deletions

View File

@@ -1089,6 +1089,10 @@ impl PciDevice for VirtioPciDevice {
fn as_any(&mut self) -> &mut dyn Any {
self
}
fn id(&self) -> Option<String> {
Some(self.id.clone())
}
}
impl BusDevice for VirtioPciDevice {