On 12/30/25 16:45, Manjae Cho wrote:
Add network testing documentation for QEMU emulation based on actual
runtime testing with qemu-system-riscv64 and U-Boot.

Tested and verified:
- VirtIO network device detection (virtio-net-device)
- DHCP client functionality
- TFTP file loading from QEMU's built-in TFTP server

The documentation covers VirtIO devices for both MMIO-based (RISC-V)
and PCI-based (x86) machines, with practical examples of U-Boot commands
and expected output.

In the meantime I sent

[PATCH 1/1] doc: describe QEMU networking
https://lore.kernel.org/u-boot/[email protected]/

Did you have a chance to look at it?


Signed-off-by: Manjae Cho <[email protected]>
---
  doc/board/emulation/index.rst   |  1 +
  doc/board/emulation/network.rst | 58 +++++++++++++++++++++++++++++++++
  2 files changed, 59 insertions(+)
  create mode 100644 doc/board/emulation/network.rst

diff --git a/doc/board/emulation/index.rst b/doc/board/emulation/index.rst
index f8908166276..507c38825c1 100644
--- a/doc/board/emulation/index.rst
+++ b/doc/board/emulation/index.rst
@@ -8,6 +8,7 @@ Emulation
acpi
     blkdev
+   index
     qemu-arm
     qemu-mips
     qemu-ppce500
diff --git a/doc/board/emulation/network.rst b/doc/board/emulation/network.rst
new file mode 100644
index 00000000000..6a08a6611b4
--- /dev/null
+++ b/doc/board/emulation/network.rst
@@ -0,0 +1,58 @@
+.. SPDX-License-Identifier: GPL-2.0+

.. SPDX-License-Identifier: GPL-2.0-or-later

see https://spdx.org/licenses/GPL-2.0-or-later.html

+
+Emulation of network devices
+-----------------------------
+
+QEMU can emulate network devices for testing U-Boot networking functionality.
+The device type depends on the machine architecture:
+
+* VirtIO (for RISC-V and other virtio-bus machines)

RISC-V also supports PCI. For productive use the important message is that virtio-net provides the fastest emulation by hardware emulation.

+
+  .. code-block:: bash
+
+      qemu-system-riscv64 -nographic -machine virt -bios opensbi.bin \
+      -kernel u-boot.bin -m 256M \
+      -netdev user,id=net0 -device virtio-net-device,netdev=net0
+
+* VirtIO PCI (for x86 and other PCI-based machines)
+
+  .. code-block:: bash
+
+      qemu-system-x86_64 -nographic -bios u-boot.bin \
+      -netdev user,id=net0 -device virtio-net-pci,netdev=net0
+
+The 'user' networking backend provides a simple way to test DHCP and basic
+networking without host configuration. In U-Boot, you can verify the network
+device is detected:
+
+.. code-block:: none
+
+    => net list
+    eth0 : virtio-net#0 52:54:00:12:34:56 active



+
+TFTP boot
+^^^^^^^^^

TFTP boot is disabled via `setenv autoload no`. The heading seems not to match the content of the section.

The dhcp, net, and tftpboot commands should be documented in doc/usage/cmd/. But mentioning them here looks ok to me.

Best regards

Heinrich


+
+QEMU's user networking includes a built-in TFTP server. To enable it, specify
+a host directory to serve files from:
+
+.. code-block:: bash
+
+    -netdev user,id=net0,tftp=/path/to/tftp/root
+
+From U-Boot, you can load files using DHCP and TFTP:
+
+.. code-block:: none
+
+    => setenv autoload no
+    => dhcp
+    DHCP client bound to address 10.0.2.15 (1 ms)
+    => tftp ${loadaddr} test.txt
+    Using virtio-net#0 device
+    TFTP from server 10.0.2.2; our IP address is 10.0.2.15
+    Filename 'test.txt'.
+    Load address: 0x80200000
+    Loading: *
+             15.6 KiB/s
+    done
+    Bytes transferred = 16 (10 hex)

Reply via email to