mirror of
https://github.com/mii443/qemu.git
synced 2025-12-03 11:08:25 +00:00
memory: add address_space_access_valid
The old-style IOMMU lets you check whether an access is valid in a given DMAContext. There is no equivalent for AddressSpace in the memory API, implement it with a lookup of the dispatch tree. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
@@ -298,6 +298,11 @@ bool iommu_dma_memory_valid(DMAContext *dma, dma_addr_t addr, dma_addr_t len,
|
||||
plen = len;
|
||||
}
|
||||
|
||||
if (!address_space_access_valid(dma->as, paddr, len,
|
||||
dir == DMA_DIRECTION_FROM_DEVICE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
len -= plen;
|
||||
addr += plen;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user