When it comes to this pattern: .valid.unaligned = false and impl.unaligned = true, is effectlvely contradictory. The .valid structure indicates that unaligned access should be rejected at the access validation phase, yet .impl suggests the underlying device implementation can handle unaligned operations. As a result, the upper-layer code will never even reach the .impl logic, leading to confusion.
Signed-off-by: CJ Chen <cjc...@igel.co.jp> Tested-by: CJ Chen <cjc...@igel.co.jp> Suggested-by: Peter Xu <pet...@redhat.com> Acked-by: Tomoyuki Hirose <hrstmyk8...@gmail.com> --- system/memory.c | 1 + 1 file changed, 1 insertion(+) diff --git a/system/memory.c b/system/memory.c index d6071b4414..b536a62ce9 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1654,6 +1654,7 @@ void memory_region_init_io(MemoryRegion *mr, const char *name, uint64_t size) { + g_assert(!ops || !(ops->impl.unaligned && !ops->valid.unaligned)); memory_region_init(mr, owner, name, size); mr->ops = ops ? ops : &unassigned_mem_ops; mr->opaque = opaque; -- 2.25.1