mirror of https://github.com/xemu-project/xemu.git
memory: Remove old_mmio accessors
Now that all the users of old_mmio MemoryRegion accessors have been converted, we can remove the core code support. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20180824170422.5783-2-peter.maydell@linaro.org> Based-on: <20180802174042.29234-1-peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
98f52cdbb5
commit
62a0db942d
|
@ -342,5 +342,3 @@ various constraints can be supplied to control how these callbacks are called:
|
||||||
- .impl.unaligned specifies that the *implementation* supports unaligned
|
- .impl.unaligned specifies that the *implementation* supports unaligned
|
||||||
accesses; if false, unaligned accesses will be emulated by two aligned
|
accesses; if false, unaligned accesses will be emulated by two aligned
|
||||||
accesses.
|
accesses.
|
||||||
- .old_mmio eases the porting of code that was formerly using
|
|
||||||
cpu_register_io_memory(). It should not be used in new code.
|
|
||||||
|
|
|
@ -201,11 +201,6 @@ struct MemoryRegionOps {
|
||||||
*/
|
*/
|
||||||
bool unaligned;
|
bool unaligned;
|
||||||
} impl;
|
} impl;
|
||||||
|
|
||||||
/* If .read and .write are not present, old_mmio may be used for
|
|
||||||
* backwards compatibility with old mmio registration
|
|
||||||
*/
|
|
||||||
const MemoryRegionMmio old_mmio;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum IOMMUMemoryRegionAttr {
|
enum IOMMUMemoryRegionAttr {
|
||||||
|
|
63
memory.c
63
memory.c
|
@ -423,32 +423,6 @@ static int get_cpu_index(void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MemTxResult memory_region_oldmmio_read_accessor(MemoryRegion *mr,
|
|
||||||
hwaddr addr,
|
|
||||||
uint64_t *value,
|
|
||||||
unsigned size,
|
|
||||||
signed shift,
|
|
||||||
uint64_t mask,
|
|
||||||
MemTxAttrs attrs)
|
|
||||||
{
|
|
||||||
uint64_t tmp;
|
|
||||||
|
|
||||||
tmp = mr->ops->old_mmio.read[ctz32(size)](mr->opaque, addr);
|
|
||||||
if (mr->subpage) {
|
|
||||||
trace_memory_region_subpage_read(get_cpu_index(), mr, addr, tmp, size);
|
|
||||||
} else if (mr == &io_mem_notdirty) {
|
|
||||||
/* Accesses to code which has previously been translated into a TB show
|
|
||||||
* up in the MMIO path, as accesses to the io_mem_notdirty
|
|
||||||
* MemoryRegion. */
|
|
||||||
trace_memory_region_tb_read(get_cpu_index(), addr, tmp, size);
|
|
||||||
} else if (TRACE_MEMORY_REGION_OPS_READ_ENABLED) {
|
|
||||||
hwaddr abs_addr = memory_region_to_absolute_addr(mr, addr);
|
|
||||||
trace_memory_region_ops_read(get_cpu_index(), mr, abs_addr, tmp, size);
|
|
||||||
}
|
|
||||||
memory_region_shift_read_access(value, shift, mask, tmp);
|
|
||||||
return MEMTX_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static MemTxResult memory_region_read_accessor(MemoryRegion *mr,
|
static MemTxResult memory_region_read_accessor(MemoryRegion *mr,
|
||||||
hwaddr addr,
|
hwaddr addr,
|
||||||
uint64_t *value,
|
uint64_t *value,
|
||||||
|
@ -502,31 +476,6 @@ static MemTxResult memory_region_read_with_attrs_accessor(MemoryRegion *mr,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MemTxResult memory_region_oldmmio_write_accessor(MemoryRegion *mr,
|
|
||||||
hwaddr addr,
|
|
||||||
uint64_t *value,
|
|
||||||
unsigned size,
|
|
||||||
signed shift,
|
|
||||||
uint64_t mask,
|
|
||||||
MemTxAttrs attrs)
|
|
||||||
{
|
|
||||||
uint64_t tmp = memory_region_shift_write_access(value, shift, mask);
|
|
||||||
|
|
||||||
if (mr->subpage) {
|
|
||||||
trace_memory_region_subpage_write(get_cpu_index(), mr, addr, tmp, size);
|
|
||||||
} else if (mr == &io_mem_notdirty) {
|
|
||||||
/* Accesses to code which has previously been translated into a TB show
|
|
||||||
* up in the MMIO path, as accesses to the io_mem_notdirty
|
|
||||||
* MemoryRegion. */
|
|
||||||
trace_memory_region_tb_write(get_cpu_index(), addr, tmp, size);
|
|
||||||
} else if (TRACE_MEMORY_REGION_OPS_WRITE_ENABLED) {
|
|
||||||
hwaddr abs_addr = memory_region_to_absolute_addr(mr, addr);
|
|
||||||
trace_memory_region_ops_write(get_cpu_index(), mr, abs_addr, tmp, size);
|
|
||||||
}
|
|
||||||
mr->ops->old_mmio.write[ctz32(size)](mr->opaque, addr, tmp);
|
|
||||||
return MEMTX_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static MemTxResult memory_region_write_accessor(MemoryRegion *mr,
|
static MemTxResult memory_region_write_accessor(MemoryRegion *mr,
|
||||||
hwaddr addr,
|
hwaddr addr,
|
||||||
uint64_t *value,
|
uint64_t *value,
|
||||||
|
@ -1418,16 +1367,12 @@ static MemTxResult memory_region_dispatch_read1(MemoryRegion *mr,
|
||||||
mr->ops->impl.max_access_size,
|
mr->ops->impl.max_access_size,
|
||||||
memory_region_read_accessor,
|
memory_region_read_accessor,
|
||||||
mr, attrs);
|
mr, attrs);
|
||||||
} else if (mr->ops->read_with_attrs) {
|
} else {
|
||||||
return access_with_adjusted_size(addr, pval, size,
|
return access_with_adjusted_size(addr, pval, size,
|
||||||
mr->ops->impl.min_access_size,
|
mr->ops->impl.min_access_size,
|
||||||
mr->ops->impl.max_access_size,
|
mr->ops->impl.max_access_size,
|
||||||
memory_region_read_with_attrs_accessor,
|
memory_region_read_with_attrs_accessor,
|
||||||
mr, attrs);
|
mr, attrs);
|
||||||
} else {
|
|
||||||
return access_with_adjusted_size(addr, pval, size, 1, 4,
|
|
||||||
memory_region_oldmmio_read_accessor,
|
|
||||||
mr, attrs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1499,17 +1444,13 @@ MemTxResult memory_region_dispatch_write(MemoryRegion *mr,
|
||||||
mr->ops->impl.max_access_size,
|
mr->ops->impl.max_access_size,
|
||||||
memory_region_write_accessor, mr,
|
memory_region_write_accessor, mr,
|
||||||
attrs);
|
attrs);
|
||||||
} else if (mr->ops->write_with_attrs) {
|
} else {
|
||||||
return
|
return
|
||||||
access_with_adjusted_size(addr, &data, size,
|
access_with_adjusted_size(addr, &data, size,
|
||||||
mr->ops->impl.min_access_size,
|
mr->ops->impl.min_access_size,
|
||||||
mr->ops->impl.max_access_size,
|
mr->ops->impl.max_access_size,
|
||||||
memory_region_write_with_attrs_accessor,
|
memory_region_write_with_attrs_accessor,
|
||||||
mr, attrs);
|
mr, attrs);
|
||||||
} else {
|
|
||||||
return access_with_adjusted_size(addr, &data, size, 1, 4,
|
|
||||||
memory_region_oldmmio_write_accessor,
|
|
||||||
mr, attrs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue