This patch set aims to support unaligned access to xHCI Capability Registers.
To achieve this, we introduce the emulation of an unaligned access through multiple aligned accesses. This patch set also adds a test device and several tests using this device to verify that the emulation functions correctly. Using these changes, unaligned access to xHCI Capability Registers is now supported. During development, I required a lot of 'MemoryRegionOps' structs with its own read/write functions for tests. In the QEMU project, a large number of similar functions or structs are often written in '.inc' files. I followed this approach for the test functions but would appreciate feedback on whether this is appropriate. Tomoyuki HIROSE (5): hw/nvme/ctrl: specify the 'valid' field in MemoryRegionOps system/memory: support unaligned access hw/misc: add test device for memory access tests/qtest: add test for memory region access hw/usb/hcd-xhci: allow unaligned access to Capability Registers hw/misc/Kconfig | 4 + hw/misc/memaccess-testdev.c | 197 +++ hw/misc/meson.build | 1 + hw/nvme/ctrl.c | 5 + hw/usb/hcd-xhci.c | 4 +- include/hw/misc/memaccess-testdev.h | 42 + include/hw/misc/memaccess-testdev.h.inc | 1864 +++++++++++++++++++++++ system/memory.c | 147 +- system/physmem.c | 8 - tests/qtest/memaccess-test.c | 598 ++++++++ tests/qtest/meson.build | 9 + 11 files changed, 2842 insertions(+), 37 deletions(-) create mode 100644 hw/misc/memaccess-testdev.c create mode 100644 include/hw/misc/memaccess-testdev.h create mode 100644 include/hw/misc/memaccess-testdev.h.inc create mode 100644 tests/qtest/memaccess-test.c -- 2.43.0