[PATCH v7 00/10] mlx5 support for VFIO self test
Alex Williamson
alex at shazbot.org
Mon Sep 28 15:28:38 PDT 2026
On Mon, 21 Sep 2026 19:35:40 -0300
Jason Gunthorpe <jgg at nvidia.com> wrote:
> Add an mlx5 driver to VFIO self test. This is largely a remix of the
> existing VFIO mlx5 driver in rdma-core. It uses an RDMA loopback QP
> to issue RDMA WRITE operations which effectively perform memory
> copies using DMA. Since mlx5 has a stable programming ABI this
> should work on devices from CX5 to current HW. The device FW must
> support the QP loopback configuration.
>
> Also support send_msi by arming completion events of the RDMA WRITE
> to trigger MSI delivery.
>
> mlx5 device startup is very complex and most of this code is just
> booting the device, with a smaller amount for operating the QP.
>
> This entire series was coded by Claude Code in about 4 days. It
> used about 4.5M output tokens, 30 individual sessions and 5600 lines
> of AI-generated .md files. I spent an annoying amount of time
> de-slopping and cleaning its work product to make it presentable.
> However, previous VFIO drivers have taken on the order of 1-2
> months to write, so getting one in a week is pretty remarkable.
>
> For those interested, the flow I used was broadly a prompt sequence
> sort of like:
>
> - Hey Claude, go look at the falcon series, VFIO self test, the
> mlx5 driver, rdma-core and some PDF documentation and make a
> plan to put mlx5 under the selftest.
> - Write an rdma-core application using the built-in VFIO provider
> that can do the required memcpy operations that vfio selftests
> wants.
> (This resulted in a 1k loc C file that compiled and ran the
> first time but had a few bugs related to device programming
> that the AI resolved.)
> - Replace the rdma-core components with open-coded versions to
> create a fully stand-alone program that does the DMA memcpy.
> - Review and audit the thing.
> [Pause and de-slop it]
> - Make it work on a PF too (this is surprisingly hard!).
> [Move to a kernel tree and copy all the .md files and .c program
> it made]
> - Hey Claude, look at all this stuff and make a broad plan to
> actually build a VFIO self test.
> - Here is my 1 sentence advice on what each patch should look
> like, make a detailed plan to make a patch for every one.
> [Pause and polish the patch plans]
> - Execute plan X then commit it [pause and de-slop each patch,
> repeat].
> [Review and final polish]
> eeb2cc76b0b4
> v7:
> - Fix some compilation problems, kvm and the igb
Applied to vfio next branch for v7.4. Topic branch published as
mlx5-vfio-selftest-v7[1] for conflict management. Thanks,
Alex
[1]https://github.com/awilliam/linux-vfio.git mlx5-vfio-selftest-v7
More information about the linux-arm-kernel
mailing list