CV-Bowen opened a new pull request, #18226:
URL: https://github.com/apache/nuttx/pull/18226

   ## Summary
   
   This PR improves the VirtIO PCI transport layer with several enhancements:
   
   1. **INTX interrupt fallback**: When MSI/MSI-X is not supported or MSI-X IRQ 
connection fails, the driver now falls back to legacy INTX interrupt mode. This 
improves compatibility with more virtio-pci devices.
   
   2. **64-bit memory capability support**: On 64-bit platforms, PCI 
capabilities may use `PCI_RESOURCE_MEM_64` instead of `PCI_RESOURCE_MEM`. Added 
support to find both flag types in virtio-pci-modern.
   
   3. **Code cleanup**: Removed unused config change IRQ handler, improved 
debug logging consistency (using `vrtXXX()` instead of `pciXXX()`), and fixed 
minor comment typos.
   
   4. **Documentation**: Added comprehensive VirtIO framework documentation 
covering architecture overview, driver/device registration workflow, source 
code structure, and API reference.
   
   5. **qemu-armv8a board updates**: 
      - Enabled virtio-pci transport in netnsh configuration
      - Refactored bringup code to use common FDT functions for virtio and PCI 
registration
   
   ## Impact
   
   - **Stability**: Improved - INTX fallback provides better device 
compatibility
   - **Compatibility**: Improved - 64-bit memory capability support enables 
more platforms
   - **Code Quality**: Improved - Cleaner debug logging and removed dead code
   - **Breaking Changes**: None
   
   ## Testing
   
   ### Build Verification
   
   ```bash
   # Build qemu-armv8a:netnsh configuration
   cmake -B cmake_out/netnsh -DBOARD_CONFIG=qemu-armv8a:netnsh -GNinja
   cmake --build cmake_out/netnsh
   ```
   
   ### QEMU Test Environment
   
   **Host**: Linux x86_64
   **QEMU Version**: 8.x+
   **Configuration**: qemu-armv8a:netnsh
   
   ### Test Commands
   
   ```bash
   # Start QEMU with virtio-net-pci device
   qemu-system-aarch64 -cpu cortex-a53 -nographic \
     -machine virt,virtualization=on,gic-version=3 \
     -chardev stdio,id=con,mux=on -serial chardev:con \
     -netdev user,id=net0 \
     -device virtio-net-pci,netdev=net0 \
     -mon chardev=con,mode=readline \
     -kernel ./cmake_out/netnsh/nuttx
   ```
   
   ### Test Results
   ```c
   ❯ qemu-system-aarch64 -cpu cortex-a53 -nographic \
        -machine virt,virtualization=on,gic-version=3 \
        -chardev stdio,id=con,mux=on -serial chardev:con \
        -netdev 
user,id=u1,hostfwd=tcp:127.0.0.1:10023-10.0.2.15:23,hostfwd=tcp:127.0.0.1:15001-10.0.2.15:5001
 \
        -device virtio-net-pci,netdev=u1 \
        -device virtio-rng-pci \
        -drive file=./mydisk-1gb.img,if=none,format=raw,id=hd \
        -device virtio-blk-pci,drive=hd \
        -mon chardev=con,mode=readline -kernel 
./nuttx/cmake_out/v8a_netnsh/nuttx
   [    0.020000] pci_scan_bus: pci_scan_bus for bus 0
   [    0.020000] pci_scan_bus: class = 00000600, hdr_type = 00000000
   [    0.020000] pci_scan_bus: 00:00 [1b36:0008]
   [    0.020000] pci_setup_device: pbar0 set bad mask
   [    0.020000] pci_setup_device: pbar1 set bad mask
   [    0.020000] pci_setup_device: pbar2 set bad mask
   [    0.020000] pci_setup_device: pbar3 set bad mask
   [    0.020000] pci_setup_device: pbar4 set bad mask
   [    0.020000] pci_setup_device: pbar5 set bad mask
   [    0.020000] pci_scan_bus: class = 00000200, hdr_type = 00000000
   [    0.020000] pci_scan_bus: 00:08 [1af4:1000]
   [    0.020000] pci_setup_device: pbar0: mask64=fffffffe 32bytes
   [    0.020000] pci_setup_device: pbar1: mask64=fffffff0 4096bytes
   [    0.020000] pci_setup_device: pbar2 set bad mask
   [    0.020000] pci_setup_device: pbar3 set bad mask
   [    0.020000] pci_setup_device: pbar4: mask64=fffffffffffffff0 16384bytes
   [    0.020000] pci_scan_bus: class = 000000ff, hdr_type = 00000000
   [    0.020000] pci_scan_bus: 00:10 [1af4:1005]
   [    0.020000] pci_setup_device: pbar0: mask64=fffffffe 32bytes
   [    0.020000] pci_setup_device: pbar1: mask64=fffffff0 4096bytes
   [    0.020000] pci_setup_device: pbar2 set bad mask
   [    0.020000] pci_setup_device: pbar3 set bad mask
   [    0.020000] pci_setup_device: pbar4: mask64=fffffffffffffff0 16384bytes
   [    0.020000] pci_scan_bus: class = 00000100, hdr_type = 00000000
   [    0.020000] pci_scan_bus: 00:18 [1af4:1001]
   [    0.020000] pci_setup_device: pbar0: mask64=fffffffe 128bytes
   [    0.020000] pci_setup_device: pbar1: mask64=fffffff0 4096bytes
   [    0.020000] pci_setup_device: pbar2 set bad mask
   [    0.030000] pci_setup_device: pbar3 set bad mask
   [    0.030000] pci_setup_device: pbar4: mask64=fffffffffffffff0 16384bytes
   telnetd [4:100]
   
   NuttShell (NSH) NuttX-12.10.0
   nsh> 
   nsh> 
   nsh> 
   nsh> hexdump /dev/random count=128
   /dev/random at 00000000:
   0000: df 35 c0 e1 bc 65 96 31 80 73 af 8d be 7c 08 d4 .5...e.1.s...|..
   0010: 5f 73 a3 ef 1b 65 9b 5a 53 8a 69 df 29 46 a2 b2 _s...e.ZS.i.)F..
   0020: 84 29 0d 71 77 1e d5 6b 94 01 1a 3a 9c de 5d bf .).qw..k...:..].
   0030: 35 8e 2f 62 83 1b 7f 4d eb fd 8e a9 29 22 fb 1a 5./b...M....)"..
   0040: 79 da 1f 8b 7c 2a 67 2e 66 bb d0 51 b6 10 81 b6 y...|*g.f..Q....
   0050: e8 99 0d 32 16 1d 56 80 07 0b fe 65 79 df be f6 ...2..V....ey...
   0060: aa 22 02 a9 0c 0f df c2 74 d7 b0 27 8f 46 80 9d ."......t..'.F..
   0070: 91 4c 5b 87 7f 7a d7 3b c5 20 f7 49 29 63 2f e7 .L[..z.;. .I)c/.
   nsh> 
   nsh> ping 10.192.41.94
   PING 10.192.41.94 56 bytes of data
   56 bytes from 10.192.41.94: icmp_seq=0 time=30.0 ms
   56 bytes from 10.192.41.94: icmp_seq=1 time=20.0 ms
   56 bytes from 10.192.41.94: icmp_seq=2 time=10.0 ms
   56 bytes from 10.192.41.94: icmp_seq=3 time=20.0 ms
   56 bytes from 10.192.41.94: icmp_seq=4 time=10.0 ms
   56 bytes from 10.192.41.94: icmp_seq=5 time=20.0 ms
   56 bytes from 10.192.41.94: icmp_seq=6 time=10.0 ms
   56 bytes from 10.192.41.94: icmp_seq=7 time=20.0 ms
   56 bytes from 10.192.41.94: icmp_seq=8 time=10.0 ms
   56 bytes from 10.192.41.94: icmp_seq=9 time=20.0 ms
   10 packets transmitted, 10 received, 0% packet loss, time 10110 ms
   rtt min/avg/max/mdev = 10.000/17.000/30.000/6.403 ms
   nsh> iperf -s -i 1
        IP: 10.0.2.15
   
    mode=tcp-server sip=10.0.2.15:5001,dip=0.0.0.0:5001, interval=1, time=0
   accept: 10.0.2.2:46694
   
              Interval         Transfer         Bandwidth
   
      0.00-   1.01 sec    1680460 Bytes   13.31 Mbits/sec
      1.01-   2.02 sec    1679000 Bytes   13.30 Mbits/sec
      2.02-   3.03 sec    1712580 Bytes   13.56 Mbits/sec
      3.03-   4.04 sec    1679000 Bytes   13.30 Mbits/sec
      4.04-   5.05 sec    1712580 Bytes   13.56 Mbits/sec
      5.05-   6.06 sec    1679000 Bytes   13.30 Mbits/sec
      6.06-   7.07 sec    1712580 Bytes   13.56 Mbits/sec
      7.07-   8.08 sec    1679000 Bytes   13.30 Mbits/sec
      8.08-   9.09 sec    1712580 Bytes   13.56 Mbits/sec
      9.09-  10.10 sec    1679000 Bytes   13.30 Mbits/sec
     10.10-  11.11 sec    1712580 Bytes   13.56 Mbits/sec
     11.11-  12.12 sec    1679000 Bytes   13.30 Mbits/sec
     12.12-  13.13 sec    1712580 Bytes   13.56 Mbits/sec
   closed by the peer: 10.0.2.2:46694
   iperf exit
   nsh> 
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to