Make address_space_map() take a MemTxAttrs argument

As part of plumbing MemTxAttrs down to the IOMMU translate method,
add MemTxAttrs as an argument to address_space_map().
Its callers either have an attrs value to hand, or don't care
and can use MEMTXATTRS_UNSPECIFIED.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180521140402.23318-5-peter.maydell@linaro.org
This commit is contained in:
Peter Maydell 2018-05-31 14:50:52 +01:00
parent bc6b1cec84
commit f26404fbee
4 changed files with 10 additions and 5 deletions

6
exec.c
View File

@ -3529,7 +3529,8 @@ flatview_extend_translation(FlatView *fv, hwaddr addr,
void *address_space_map(AddressSpace *as, void *address_space_map(AddressSpace *as,
hwaddr addr, hwaddr addr,
hwaddr *plen, hwaddr *plen,
bool is_write) bool is_write,
MemTxAttrs attrs)
{ {
hwaddr len = *plen; hwaddr len = *plen;
hwaddr l, xlat; hwaddr l, xlat;
@ -3616,7 +3617,8 @@ void *cpu_physical_memory_map(hwaddr addr,
hwaddr *plen, hwaddr *plen,
int is_write) int is_write)
{ {
return address_space_map(&address_space_memory, addr, plen, is_write); return address_space_map(&address_space_memory, addr, plen, is_write,
MEMTXATTRS_UNSPECIFIED);
} }
void cpu_physical_memory_unmap(void *buffer, hwaddr len, void cpu_physical_memory_unmap(void *buffer, hwaddr len,

View File

@ -1952,9 +1952,10 @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, bool is_
* @addr: address within that address space * @addr: address within that address space
* @plen: pointer to length of buffer; updated on return * @plen: pointer to length of buffer; updated on return
* @is_write: indicates the transfer direction * @is_write: indicates the transfer direction
* @attrs: memory attributes
*/ */
void *address_space_map(AddressSpace *as, hwaddr addr, void *address_space_map(AddressSpace *as, hwaddr addr,
hwaddr *plen, bool is_write); hwaddr *plen, bool is_write, MemTxAttrs attrs);
/* address_space_unmap: Unmaps a memory region previously mapped by address_space_map() /* address_space_unmap: Unmaps a memory region previously mapped by address_space_map()
* *

View File

@ -132,7 +132,8 @@ static inline void *dma_memory_map(AddressSpace *as,
hwaddr xlen = *len; hwaddr xlen = *len;
void *p; void *p;
p = address_space_map(as, addr, &xlen, dir == DMA_DIRECTION_FROM_DEVICE); p = address_space_map(as, addr, &xlen, dir == DMA_DIRECTION_FROM_DEVICE,
MEMTXATTRS_UNSPECIFIED);
*len = xlen; *len = xlen;
return p; return p;
} }

View File

@ -431,7 +431,8 @@ const ppc_hash_pte64_t *ppc_hash64_map_hptes(PowerPCCPU *cpu,
return NULL; return NULL;
} }
hptes = address_space_map(CPU(cpu)->as, base + pte_offset, &plen, false); hptes = address_space_map(CPU(cpu)->as, base + pte_offset, &plen, false,
MEMTXATTRS_UNSPECIFIED);
if (plen < (n * HASH_PTE_SIZE_64)) { if (plen < (n * HASH_PTE_SIZE_64)) {
hw_error("%s: Unable to map all requested HPTEs\n", __func__); hw_error("%s: Unable to map all requested HPTEs\n", __func__);
} }