At present sandbox testing of virtio is fairly limited. This series expands this. It provides a small MMIO helper along with a virtio emulator that sits in front of the existing MMIO driver. Then a block-device emulator is added on top. With this in place, sandbox can exercise virtio end-to-end.
The series also includes various small clean-ups and fixes that pair naturally with the emulator work: hex blk indices, a probe-ordering fix for acknowledge, a legacy-PCI rename, log-category for the remaining drivers, and three resource-cleanup fixes on device removal that the new emulator makes easy to verify. Simon Glass (13): sandbox: Move memory-related functions to a separate file alist: Allow inclusion from OS headers sandbox: Support memory-mapped I/O blk: Use hex indices for the device name virtio: Export a few things from virtio_mmio.c virtio: Implement a proper sandbox emulator virtio: Implement a simple block-device emulator virtio: Acknowledge devices only when probed virtio: Rename a few legacy-PCI functions virtio: Set the log-category for all drivers virtio: emul_blk: Free disk data on remove virtio: Delete vqs when removing a device virtio: Free mmio base when removing sandbox virtio emul arch/Kconfig | 1 + arch/sandbox/cpu/Makefile | 2 +- arch/sandbox/cpu/cpu.c | 274 +---------------------- arch/sandbox/cpu/mem.c | 337 +++++++++++++++++++++++++++++ arch/sandbox/cpu/state.c | 2 + arch/sandbox/include/asm/io.h | 15 ++ arch/sandbox/include/asm/state.h | 67 ++++++ configs/sandbox_defconfig | 1 + configs/tools-only_defconfig | 1 + drivers/block/blk-uclass.c | 2 +- drivers/virtio/Kconfig | 8 + drivers/virtio/Makefile | 1 + drivers/virtio/emul_blk.c | 186 ++++++++++++++++ drivers/virtio/sandbox_emul.c | 328 ++++++++++++++++++++++++++++ drivers/virtio/sandbox_emul.h | 160 ++++++++++++++ drivers/virtio/virtio-uclass.c | 21 +- drivers/virtio/virtio_blk.c | 2 +- drivers/virtio/virtio_blk.h | 3 + drivers/virtio/virtio_internal.h | 19 ++ drivers/virtio/virtio_mmio.c | 9 +- drivers/virtio/virtio_net.c | 4 +- drivers/virtio/virtio_pci_legacy.c | 10 +- drivers/virtio/virtio_pci_modern.c | 2 + drivers/virtio/virtio_ring.c | 2 + drivers/virtio/virtio_rng.c | 2 +- drivers/virtio/virtio_sandbox.c | 2 + include/alist.h | 16 +- include/dm/uclass-id.h | 1 + include/virtio.h | 8 + lib/alist.c | 1 + test/dm/virtio_device.c | 2 +- 31 files changed, 1188 insertions(+), 301 deletions(-) create mode 100644 arch/sandbox/cpu/mem.c create mode 100644 drivers/virtio/emul_blk.c create mode 100644 drivers/virtio/sandbox_emul.c create mode 100644 drivers/virtio/sandbox_emul.h create mode 100644 drivers/virtio/virtio_internal.h --- base-commit: 8d5f30b52f7c800c2177188fc4d331fb7af2c46a branch: qema-us -- 2.43.0

