Using PCI Pass-Through¶
PCI pass-through assigns a physical NPU directly to a single VM. In this mode, only the driver running in the assigned VM has exclusive access to the NPU, and the NPU is not shared between VMs.
Enable IOMMU and Configure Recommended Kernel Parameters¶
First, enable the following setting in the server platform BIOS.
- IOMMU (Intel VT-d / AMD-Vi)
The BIOS menu names and configuration steps may vary depending on the system vendor.
PCI pass-through uses IOMMU to isolate DMA access from the NPU device assigned to the VM, protecting the host and other VMs' memory. PCI pass-through does not work when IOMMU is disabled.
Note
IOMMU is already enabled in the default kernels of the currently supported distributions.
The recommended kernel parameters for an NPU PCI pass-through environment are as follows. Add them to GRUB_CMDLINE_LINUX in /etc/default/grub.
Note
The example below assumes a server with an Intel processor. For AMD processors, omit intel_iommu=on; the IOMMU is active once AMD-Vi is enabled in the BIOS. Some kernel parameters may differ depending on the server and the installed cards.
Update the GRUB configuration and reboot.
After the reboot, confirm that the parameters are applied:
Using PCI Pass-Through on Linux KVM¶
You can configure NPU pass-through on Ubuntu Linux KVM using the virsh command.
The following prerequisites must be met before configuring NPU pass-through.
- Ubuntu Linux KVM must be installed (
sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils). - The VM machine type must be q35. q35 is required for NPU pass-through because it supports the PCIe native topology.
- The guest's 64-bit MMIO address space must be large enough for the cards assigned to the VM, as listed below. When you assign several cards to the same VM, scale the size with the number of cards. Also enable Above 4G Decoding in the host BIOS.
Provide 512 GB per RBLN-CR13 card.
Provide 128 GB per RBLN-CA25 card.
Configuring NPU Pass-Through to a VM with virsh¶
This procedure covers how to assign an NPU to an existing VM configured with the q35 machine type via pass-through. VM creation and basic configuration are out of scope for this document — see Ubuntu Server - Virtual Machine Manager and libvirt - PCI passthrough of host devices for those.
-
Identify the PCI device BDF (bus/device/function) of the NPU to assign to the VM in pass-through mode.
In the following example, the NPU's PCI device BDF is
1b:00.0. -
Convert the BDF identified in step 1 into the
domain,bus,slot, andfunctionformat, specify it in the XML, and assign the NPU device to the VM using that XML file.An RBLN-CR13 card is a single PCI device, so one
<hostdev>is enough.An RBLN-CA25 card is four PCI devices; attach all four to the same VM. An RBLN-CA22 card is a single PCI device, so one
<hostdev>is enough.Note
You can also configure this by editing the VM XML directly with
virsh editand adding the<hostdev>entry. -
Start the VM with the assigned NPU.
-
Connect to the VM and verify that the NPU has been assigned correctly.
Run the following commands in the guest. Verify that
Region 0has an assigned memory address and shows[size=256G]. Check the kernel log for BAR allocation errors for the device, such asno space for.
Next Steps¶
After assigning the NPU to the VM, install the RBLN driver in the guest OS as explained in the RBLN Driver Installation Guide. The host does not require the RBLN driver for the NPU assigned to the VM. The guest OS and kernel must be in the support matrix.
Once the driver is installed, rbln-smi in the guest lists the NPU assigned to the VM.