Skip to content

Commit

Permalink
Make address_space_access_valid() take a MemTxAttrs argument
Browse files Browse the repository at this point in the history
As part of plumbing MemTxAttrs down to the IOMMU translate method,
add MemTxAttrs as an argument to address_space_access_valid().
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-6-peter.maydell@linaro.org
  • Loading branch information
pm215 committed May 31, 2018
1 parent f26404f commit fddffa4
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 8 deletions.
3 changes: 2 additions & 1 deletion exec.c
Expand Up @@ -3480,7 +3480,8 @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
}

bool address_space_access_valid(AddressSpace *as, hwaddr addr,
int len, bool is_write)
int len, bool is_write,
MemTxAttrs attrs)
{
FlatView *fv;
bool result;
Expand Down
4 changes: 3 additions & 1 deletion include/exec/memory.h
Expand Up @@ -1937,8 +1937,10 @@ static inline MemoryRegion *address_space_translate(AddressSpace *as,
* @addr: address within that address space
* @len: length of the area to be checked
* @is_write: indicates the transfer direction
* @attrs: memory attributes
*/
bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, bool is_write);
bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len,
bool is_write, MemTxAttrs attrs);

/* address_space_map: map a physical memory region into a host virtual address
*
Expand Down
3 changes: 2 additions & 1 deletion include/sysemu/dma.h
Expand Up @@ -77,7 +77,8 @@ static inline bool dma_memory_valid(AddressSpace *as,
DMADirection dir)
{
return address_space_access_valid(as, addr, len,
dir == DMA_DIRECTION_FROM_DEVICE);
dir == DMA_DIRECTION_FROM_DEVICE,
MEMTXATTRS_UNSPECIFIED);
}

static inline int dma_memory_rw_relaxed(AddressSpace *as, dma_addr_t addr,
Expand Down
6 changes: 4 additions & 2 deletions target/s390x/diag.c
Expand Up @@ -87,7 +87,8 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra)
return;
}
if (!address_space_access_valid(&address_space_memory, addr,
sizeof(IplParameterBlock), false)) {
sizeof(IplParameterBlock), false,
MEMTXATTRS_UNSPECIFIED)) {
s390_program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO, ra);
return;
}
Expand Down Expand Up @@ -116,7 +117,8 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra)
return;
}
if (!address_space_access_valid(&address_space_memory, addr,
sizeof(IplParameterBlock), true)) {
sizeof(IplParameterBlock), true,
MEMTXATTRS_UNSPECIFIED)) {
s390_program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO, ra);
return;
}
Expand Down
3 changes: 2 additions & 1 deletion target/s390x/excp_helper.c
Expand Up @@ -120,7 +120,8 @@ int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr orig_vaddr, int size,

/* check out of RAM access */
if (!address_space_access_valid(&address_space_memory, raddr,
TARGET_PAGE_SIZE, rw)) {
TARGET_PAGE_SIZE, rw,
MEMTXATTRS_UNSPECIFIED)) {
DPRINTF("%s: raddr %" PRIx64 " > ram_size %" PRIx64 "\n", __func__,
(uint64_t)raddr, (uint64_t)ram_size);
trigger_pgm_exception(env, PGM_ADDRESSING, ILEN_AUTO);
Expand Down
3 changes: 2 additions & 1 deletion target/s390x/mmu_helper.c
Expand Up @@ -461,7 +461,8 @@ static int translate_pages(S390CPU *cpu, vaddr addr, int nr_pages,
return ret;
}
if (!address_space_access_valid(&address_space_memory, pages[i],
TARGET_PAGE_SIZE, is_write)) {
TARGET_PAGE_SIZE, is_write,
MEMTXATTRS_UNSPECIFIED)) {
trigger_access_exception(env, PGM_ADDRESSING, ILEN_AUTO, 0);
return -EFAULT;
}
Expand Down
3 changes: 2 additions & 1 deletion target/s390x/sigp.c
Expand Up @@ -280,7 +280,8 @@ static void sigp_set_prefix(CPUState *cs, run_on_cpu_data arg)
cpu_synchronize_state(cs);

if (!address_space_access_valid(&address_space_memory, addr,
sizeof(struct LowCore), false)) {
sizeof(struct LowCore), false,
MEMTXATTRS_UNSPECIFIED)) {
set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER);
return;
}
Expand Down

0 comments on commit fddffa4

Please sign in to comment.