diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-04-11 15:40:59 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-05-29 16:27:16 +0200 |
commit | 51644ab70ba125cb9545702d64890743d75b444b (patch) | |
tree | 420c1b45d6556c81b04d532ca4a05202c069e341 /dma-helpers.c | |
parent | c353e4cc08a2fce7c505dd0d04512ef3947adff8 (diff) | |
download | qemu-51644ab70ba125cb9545702d64890743d75b444b.tar.gz qemu-51644ab70ba125cb9545702d64890743d75b444b.tar.bz2 qemu-51644ab70ba125cb9545702d64890743d75b444b.zip |
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>
Diffstat (limited to 'dma-helpers.c')
-rw-r--r-- | dma-helpers.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/dma-helpers.c b/dma-helpers.c index 272632f367..2e298b6ebb 100644 --- a/dma-helpers.c +++ b/dma-helpers.c @@ -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; } |