From 01683fe97e3bebcf44fed5c3dca767ec810c1504 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Thu, 4 Oct 2018 04:43:11 -0400 Subject: [PATCH] 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. Backports commit 62a0db942dec6ebfec19aac2b604737d3c9a2d75 from qemu --- qemu/docs/memory.txt | 2 -- qemu/include/exec/memory.h | 5 ----- qemu/memory.c | 43 ++------------------------------------ 3 files changed, 2 insertions(+), 48 deletions(-) diff --git a/qemu/docs/memory.txt b/qemu/docs/memory.txt index 6a5a9ac1..3dd7d7ca 100644 --- a/qemu/docs/memory.txt +++ b/qemu/docs/memory.txt @@ -288,5 +288,3 @@ various constraints can be supplied to control how these callbacks are called: - .impl.unaligned specifies that the *implementation* supports unaligned accesses; if false, unaligned accesses will be emulated by two aligned accesses. - - .old_mmio can be used to ease porting from code using - cpu_register_io_memory(). It should not be used in new code. diff --git a/qemu/include/exec/memory.h b/qemu/include/exec/memory.h index d0f9548f..047a294f 100644 --- a/qemu/include/exec/memory.h +++ b/qemu/include/exec/memory.h @@ -144,11 +144,6 @@ struct MemoryRegionOps { */ bool unaligned; } impl; - - /* If .read and .write are not present, old_mmio may be used for - * backwards compatibility with old mmio registration - */ - const MemoryRegionMmio old_mmio; }; typedef struct MemoryRegionIOMMUOps MemoryRegionIOMMUOps; diff --git a/qemu/memory.c b/qemu/memory.c index 80dd2cc4..4e682563 100644 --- a/qemu/memory.c +++ b/qemu/memory.c @@ -469,23 +469,6 @@ static inline uint64_t memory_region_shift_write_access(uint64_t *value, return tmp; } -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); - // UNICORN: Commented out - //trace_memory_region_ops_read(mr, addr, tmp, size); - memory_region_shift_read_access(value, shift, mask, tmp); - return MEMTX_OK; -} - static MemTxResult memory_region_read_accessor(MemoryRegion *mr, hwaddr addr, uint64_t *value, @@ -527,20 +510,6 @@ static MemTxResult memory_region_read_with_attrs_accessor(MemoryRegion *mr, 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); - - mr->ops->old_mmio.write[ctz32(size)](mr->opaque, addr, tmp); - return MEMTX_OK; -} - static MemTxResult memory_region_write_accessor(MemoryRegion *mr, hwaddr addr, uint64_t *value, @@ -1319,16 +1288,12 @@ static MemTxResult memory_region_dispatch_read1(MemoryRegion *mr, mr->ops->impl.max_access_size, memory_region_read_accessor, mr, attrs); - } else if (mr->ops->read_with_attrs) { + } else { return access_with_adjusted_size(addr, pval, size, mr->ops->impl.min_access_size, mr->ops->impl.max_access_size, memory_region_read_with_attrs_accessor, mr, attrs); - } else { - return access_with_adjusted_size(addr, pval, size, 1, 4, - memory_region_oldmmio_read_accessor, - mr, attrs); } } @@ -1369,17 +1334,13 @@ MemTxResult memory_region_dispatch_write(MemoryRegion *mr, mr->ops->impl.max_access_size, memory_region_write_accessor, mr, attrs); - } else if (mr->ops->write_with_attrs) { + } else { return access_with_adjusted_size(addr, &data, size, mr->ops->impl.min_access_size, mr->ops->impl.max_access_size, memory_region_write_with_attrs_accessor, mr, attrs); - } else { - return access_with_adjusted_size(addr, &data, size, 1, 4, - memory_region_oldmmio_write_accessor, - mr, attrs); } }