virtio-devices: Removing all mappings found in an unmap request

According to the virtio iommu spec (section 5.13.6.6), all mappings
within the entire range from virt_start to virt_end in an unmap
request must be removed. This change adds this functionality,
iterating through all mappings that fall within an unmap request
for that domain and removing them.

Signed-off-by: Andrew Carp <acarp@crusoeenergy.com>
This commit is contained in:
Andrew Carp 2024-03-21 12:21:34 -07:00 committed by Bo Chen
parent 6bee8ac702
commit fbdc5d4487

View File

@ -563,7 +563,7 @@ impl Request {
}
}
// Remove mapping associated with the domain
// Remove all mappings associated with the domain within the requested range
mapping
.domains
.write()
@ -571,7 +571,7 @@ impl Request {
.get_mut(&domain_id)
.unwrap()
.mappings
.remove(&virt_start);
.retain(|&x, _| (x < req.virt_start || x > req.virt_end));
}
VIRTIO_IOMMU_T_PROBE => {
if desc_size_left != size_of::<VirtioIommuReqProbe>() {