Add Unix socket transport for QEMU testing#9
Merged
Conversation
Adds a SocketTransport class that connects to QEMU's chardev Unix sockets, enabling end-to-end protocol testing without physical hardware. The transport factory now accepts a `socket://` prefix on the port argument (e.g. `defib burn -c hi3516ev300 -p socket:///tmp/qemu.sock`). flush_input() is a no-op for sockets since, unlike serial ports, there is no stale data to drain — flushing would discard legitimate ACK responses that QEMU has already sent back. Tested against qemu-hisilicon's hisi-fastboot device: full 3-stage transfer (DDR + SPL + 236 KB U-Boot) completes in ~160 ms with CRC validation on every frame. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
widgetii
pushed a commit
to widgetii/qemu-hisilicon
that referenced
this pull request
Mar 30, 2026
Emulates the HiSilicon boot ROM UART download protocol (Protocol 1 - Standard). When QEMU starts without -kernel, the hisi-fastboot device takes over UART0, sends 0x20 handshake bytes, and accepts firmware uploads via HEAD/DATA/TAIL frames with CRC-16/CCITT validation. After all three transfers (DDR init, SPL, U-Boot) complete, the chardev is handed off to a newly-created PL011 and the CPU starts at the U-Boot entry point. The existing -kernel boot path is unchanged. Tested end-to-end with defib (OpenIPC/defib#9): 236 KB OpenIPC U-Boot transferred in ~160 ms over Unix socket. New files: qemu/hw/misc/hisi-fastboot.c - boot ROM protocol device qemu/include/hw/misc/hisi-fastboot.h - public header qemu-boot/test-fastboot-protocol.py - protocol-level test qemu-boot/test-fastboot.sh - end-to-end test with defib Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SocketTransportclass (src/defib/transport/socket.py) for connecting to QEMU chardev Unix socketscreate_transport()to detectsocket://prefix and route to the new transportUsage
Test plan
🤖 Generated with Claude Code