mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-21 13:15:19 +00:00
virtio-devices: Map previously attached endpoints
Ensures that any endpoints already attached to the domain are properly mapped to a new endpoint on said endpoint's attach request. This is done by search for all previous mappings in the domain and then issuing map requests for the newly attached endpoint. Signed-off-by: Andrew Carp <acarp@crusoeenergy.com>
This commit is contained in:
parent
045964deee
commit
5668f02eb6
@ -414,6 +414,19 @@ impl Request {
|
||||
.unwrap()
|
||||
.insert(endpoint, domain_id);
|
||||
|
||||
// If any other mappings exist in the domain for other containers,
|
||||
// make sure to issue these mappings for the new endpoint/container
|
||||
if let Some(domain_mappings) = &mapping.domains.read().unwrap().get(&domain_id)
|
||||
{
|
||||
if let Some(ext_map) = ext_mapping.get(&endpoint) {
|
||||
for (virt_start, addr_map) in &domain_mappings.mappings {
|
||||
ext_map
|
||||
.map(*virt_start, addr_map.gpa, addr_map.size)
|
||||
.map_err(Error::ExternalUnmapping)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add new domain with no mapping if the entry didn't exist yet
|
||||
let mut domains = mapping.domains.write().unwrap();
|
||||
let domain = Domain {
|
||||
|
Loading…
Reference in New Issue
Block a user