On Fri, Feb 13, 2026 at 2:36 PM Andrew Bailey <[email protected]> wrote:
>
> Currently, users must modprobe VFIO-PCI before running DTS when using a
> non-mellanox NIC. This patch automates the process on test run start up.
> In addition, if the SUT is expected to use a subset of a few QAT devices,
> VFIO-PCI must be loaded in a separate manner. This patch adds this
> distinction.
>
> Signed-off-by: Andrew Bailey <[email protected]>
> ---
>  dts/framework/testbed_model/linux_session.py | 24 ++++++++++++++++++++
>  dts/framework/testbed_model/os_session.py    |  4 ++++
>  2 files changed, 28 insertions(+)
>
> diff --git a/dts/framework/testbed_model/linux_session.py 
> b/dts/framework/testbed_model/linux_session.py
> index 27a5f48ecf..a761ca11fe 100644
> --- a/dts/framework/testbed_model/linux_session.py
> +++ b/dts/framework/testbed_model/linux_session.py
> @@ -224,6 +224,30 @@ def devbind_script_path(self) -> PurePath:
>          """
>          raise InternalError("Accessed devbind script path before setup.")
>
> +    def load_vfio(self, pf_port: Port) -> None:
> +        """Overrides :meth:`~os_session.OSSession,load_vfio`."""
> +        cmd_result = self.send_command(f"lspci -nn -s {pf_port.pci}")
> +        device = re.search(r":([0-9a-fA-F]{4})\]", cmd_result.stdout)
> +        if device and device.group(1) in ["37c8", "0435", "19e2"]:
> +            self.send_command(
> +                "modprobe -r vfio_iommu_type1; modprobe -r vfio_pci",
> +                privileged=True,
> +            )
> +            self.send_command(
> +                "modprobe -r vfio_virqfd; modprobe -r vfio",
> +                privileged=True,
> +            )
> +            self.send_command(
> +                "modprobe vfio-pci disable_denylist=1 enable_sriov=1", 
> privileged=True
> +            )
> +            self.send_command(
> +                "echo 1 | tee 
> /sys/module/vfio/parameters/enable_unsafe_noiommu_mode",
> +                privileged=True,
> +            )
> +        else:
> +            self.send_command("modprobe vfio-pci")
> +        self.refresh_lshw()
> +
>      def create_crypto_vfs(self, pf_port: list[Port]) -> None:
>          """Overrides :meth:`~os_session.OSSession.create_crypto_vfs`.
>
> diff --git a/dts/framework/testbed_model/os_session.py 
> b/dts/framework/testbed_model/os_session.py
> index 2eeeea6967..4a4fc1f34a 100644
> --- a/dts/framework/testbed_model/os_session.py
> +++ b/dts/framework/testbed_model/os_session.py
> @@ -615,6 +615,10 @@ def configure_port_mtu(self, mtu: int, port: Port) -> 
> None:
>              port: Port to set `mtu` on.
>          """
>
> +    @abstractmethod
> +    def load_vfio(self, pf_port: Port) -> None:
> +        """Load the vfio module according to the device type of the given 
> port."""
> +
>      @abstractmethod
>      def create_crypto_vfs(self, pf_ports: list[Port]) -> None:
>          """Creatues virtual functions for each port in 'pf_ports'.

typo

> --
> 2.50.1
>

Adding Dharmik and David since they were the ones interested in this
custom vfio-pci loading way back when I added the support to legacy
DTS a couple years ago. And also Kai Ji since he is QAT maintainer and
must be familiar with the custom vfio-pci loading requirement for QAT
8970 and other cards.

In DPDK, your individual patches need to be "non-breaking" if they are
applied in chronological order. I.e. if only patch 1 is applied
nothing breaks, if patches 1 and 2 are applied nothing breaks etc.
It's challenging but let's make a best effort to comply. In the case
of this patch, it breaks the rule since load_vfio() is called in the
2/5 patch but does not exist until this 5/5 patch. So, I think the
easiest fix would be to move this 5/5 patch to be in between the
current 1/5 and current 2/5 patch.

I think the content of the patch looks good otherwise. Let's make sure
we run the testsuites on the 8970 card to validate the correct
"custom" vfio-pci loading.

Reviewed-by: Patrick Robb <[email protected]>

Reply via email to