# \*\*\*Guide\*\*\*What are the best practices for enabling IOMMU and SR-IOV in BIOS

**URL:** <https://forum.hhf.technology/t/guide-what-are-the-best-practices-for-enabling-iommu-and-sr-iov-in-bios/181>\
**Category:** Tutorials\
**Tags:** gpu, iommu, bios, sr-iov, proxmox\
**Created:** [May 28, 2024, 3:12pm UTC](https://forum.hhf.technology/t/guide-what-are-the-best-practices-for-enabling-iommu-and-sr-iov-in-bios/181 "2024-05-28T15:12:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hhf.technoloy](https://forum.hhf.technology/user_avatar/forum.hhf.technology/hhf.technoloy/32/68_2.png) [@hhf.technoloy](https://forum.hhf.technology/u/hhf.technoloy)\
**Post date:** [May 28, 2024, 3:12pm UTC](https://forum.hhf.technology/t/guide-what-are-the-best-practices-for-enabling-iommu-and-sr-iov-in-bios/181/1 "2024-05-28T15:12:00Z")

</div>

Enabling IOMMU and SR-IOV in BIOS is essential for effective GPU passthrough and virtualization.

## Best Practices for Enabling IOMMU and SR-IOV

### 1. **Access BIOS/UEFI Settings**

- Restart your computer and enter the BIOS/UEFI setup by pressing the appropriate key (often F2, DEL, or ESC) during boot.

### 2. **Enable IOMMU**

- **For Intel CPUs** : Look for options labeled as “Intel VT-d” or “IOMMU” and ensure they are enabled.
- **For AMD CPUs** : Find “AMD IOMMU” or similar settings and enable them.
- **Location** : Typically found under Advanced settings or CPU Configuration.

### 3. **Enable SR-IOV**

- Locate the SR-IOV setting within the BIOS. This may be under options like “Advanced \> Chipset Configuration” or “Network Configuration.”
- Ensure that SR-IOV support is enabled.

### 4. **Enable ACS (Access Control Services)**

- If available, enable ACS to improve device isolation, which can help with PCI device passthrough.
- This option may be found in advanced settings related to PCIe configuration.

### 5. **Save Changes and Exit**

- After making these changes, save your settings (usually by pressing F10) and exit the BIOS/UEFI.

### 6. **Update GRUB Configuration**

- After rebooting into your operating system, edit the GRUB configuration file:

```bash
nano /etc/default/grub

```

- Add the following parameters to `GRUB_CMDLINE_LINUX_DEFAULT`:
  - For Intel:

```auto
intel_iommu=on iommu=pt

```

  - For AMD:

```auto
amd_iommu=on iommu=pt

```

- Update GRUB:

```bash
update-grub

```

### 7. **Load Necessary Kernel Modules**

- Ensure that the required VFIO modules are loaded by adding them to `/etc/modules`:

```bash
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

```

- Update initramfs:

```bash
update-initramfs -u -k all

```

### 8. **Verify IOMMU Functionality**

- After rebooting, check if IOMMU is functioning correctly by running:

```bash
dmesg | grep -e DMAR -e IOMMU

```

- You should see messages confirming that IOMMU is enabled.

### 9. **Testing SR-IOV Configuration**

- To test SR-IOV functionality, set the number of Virtual Functions (VFs) for your NIC:

```bash
echo N > /sys/class/net/<name_of_your_NIC>/device/sriov_numvfs

```

- Replace `N` with the desired number of VFs and `<name_of_your_NIC>` with your network interface name.

### 10. **Troubleshooting Common Issues**

- If you encounter issues such as “Cannot allocate memory,” recheck BIOS settings or ensure that your hardware supports SR-IOV.
- Make sure no devices are busy before attempting to allocate VFs.

By following these best practices, you can effectively enable IOMMU and SR-IOV in your BIOS, paving the way for successful GPU passthrough and enhanced virtualization capabilities.
