mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
pci, virtio-devices: Restore proper BAR type
When restoring a VM, the BAR type can be found directly from the snapshot resources. It is more reliable than the previous method which was using self.use_64bit_bar from VirtioPciDevice because at the time the BARs are allocated, the VirtioDevice hasn't been restored yet, meaning the way to determine the value of use_64bit_bar is wrong for a device like vDPA. At this time, the device type is not known and relying on the stored resources is the only reliable way. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -21,6 +21,8 @@ pub enum Error {
|
||||
IoRegistrationFailed(u64, configuration::Error),
|
||||
/// Expected resource not found.
|
||||
MissingResource,
|
||||
/// Invalid resource.
|
||||
InvalidResource(Resource),
|
||||
}
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
@@ -37,6 +39,7 @@ impl Display for Error {
|
||||
write!(f, "failed to register an IO BAR, addr={} err={}", addr, e)
|
||||
}
|
||||
MissingResource => write!(f, "failed to find expected resource"),
|
||||
InvalidResource(r) => write!(f, "invalid resource {:?}", r),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user