mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: iommu: Search full range for GVA conversion
Remove an erroneous optimisation that used the page size mask to reduce the range to iterate through on the set of mappings. This doesn't work as the virtio-iommu ranges are larger than a single page. This may have worked in the past when the mappings were limited to a single page. Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::mem::size_of;
|
||||
use std::ops::Bound::Included;
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Arc, Barrier, Mutex, RwLock};
|
||||
@@ -811,15 +810,7 @@ impl DmaRemapping for IommuMapping {
|
||||
return Ok(addr);
|
||||
}
|
||||
|
||||
let range_start = if VIRTIO_IOMMU_PAGE_SIZE_MASK > addr {
|
||||
0
|
||||
} else {
|
||||
addr - VIRTIO_IOMMU_PAGE_SIZE_MASK
|
||||
};
|
||||
for (&key, &value) in domain
|
||||
.mappings
|
||||
.range((Included(&range_start), Included(&addr)))
|
||||
{
|
||||
for (&key, &value) in domain.mappings.iter() {
|
||||
if addr >= key && addr < key + value.size {
|
||||
let new_addr = addr - key + value.gpa;
|
||||
debug!("Into GPA addr 0x{:x}", new_addr);
|
||||
|
||||
Reference in New Issue
Block a user