GPU passthrough in Ubuntu 18.04

1

I'm trying to set up GPU passthrough for KVM.

I edited /etc/default/grub:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash iommu=pt intel_iommu=on video=efifb:off"

then run

sudo update-grub 

and/or

sudo update-grub2

(I tried both) and rebooted.
In UEFI both VT-x and VT-d are enabled.

When booting, there are no arguments, except quiet splash.
The result of cat /proc/cmdline is:

BOOT_IMAGE=/boot/vmlinuz-5.3.0-26-generic root=UUID=9ae642a2-9374-4304-9656-0722391d2113 ro quiet splash vt.handoff=1

The result of dmesg | grep -i -e DMAR -e IOMMU is anything but

DMAR: IOMMU enabled

My system is:

  • i5-7200U
  • GeForce 940MX

The questions are:
How could this be and what am I doing wrong?

UDPATE: Here is my full grub.cfg:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
... some header options ...
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
... some theme options ...
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux_proxy ###

function gfxmode {
    set gfxpayload="${1}"
    if [ "${1}" = "keep" ]; then
        set vt_handoff=vt.handoff=1
    else
        set vt_handoff=
    fi
}
if [ "${recordfail}" != 1 ]; then
  if [ -e ${prefix}/gfxblacklist.txt ]; then
    if hwmatch ${prefix}/gfxblacklist.txt 3; then
      if [ ${match} = 0 ]; then
        set linux_gfx_mode=keep
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
  else
    set linux_gfx_mode=keep
  fi
else
  set linux_gfx_mode=text
fi
export linux_gfx_mode



### END /etc/grub.d/10_linux_proxy ###

### BEGIN /etc/grub.d/40_custom_proxy ###
menuentry "Windows 10" --class windows --class os $menuentry_id_option 'osprober-efi-60D9-7C2F' {
    insmod part_gpt
    insmod fat
    set root='hd0,gpt2'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  60D9-7C2F
    else
      search --no-floppy --fs-uuid --set=root 60D9-7C2F
    fi
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
menuentry "Ubuntu 18.04" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-9ae642a2-9374-4304-9656-0722391d2113' {
    recordfail
    load_video
    gfxmode $linux_gfx_mode
    insmod gzio
    if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    insmod part_gpt
    insmod ext2
    set root='hd0,gpt6'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6  9ae642a2-9374-4304-9656-0722391d2113
    else
      search --no-floppy --fs-uuid --set=root 9ae642a2-9374-4304-9656-0722391d2113
    fi
            linux   /boot/vmlinuz-5.3.0-26-generic root=UUID=9ae642a2-9374-4304-9656-0722391d2113 ro  quiet splash $vt_handoff
    initrd  /boot/initrd.img-5.3.0-26-generic
}
### END /etc/grub.d/40_custom_proxy ###

### BEGIN /etc/grub.d/42_linux_proxy ###
submenu "Advanced options for Ubuntu"{
menuentry "Ubuntu, with Linux 5.3.0-40-generic" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.0-40-generic-advanced-9ae642a2-9374-4304-9656-0722391d2113' {
        recordfail
        load_video
        gfxmode $linux_gfx_mode
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6  9ae642a2-9374-4304-9656-0722391d2113
        else
          search --no-floppy --fs-uuid --set=root 9ae642a2-9374-4304-9656-0722391d2113
        fi
        echo    'Loading Linux 5.3.0-40-generic ...'
            linux   /boot/vmlinuz-5.3.0-40-generic root=UUID=9ae642a2-9374-4304-9656-0722391d2113 ro iommu=pt intel_iommu=on video=efifb:off quiet splash $vt_handoff
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initrd.img-5.3.0-40-generic
}
menuentry "Ubuntu, with Linux 5.3.0-40-generic (recovery mode)" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.0-40-generic-recovery-9ae642a2-9374-4304-9656-0722391d2113' {
        recordfail
        load_video
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6  9ae642a2-9374-4304-9656-0722391d2113
        else
          search --no-floppy --fs-uuid --set=root 9ae642a2-9374-4304-9656-0722391d2113
        fi
        echo    'Loading Linux 5.3.0-40-generic ...'
            linux   /boot/vmlinuz-5.3.0-40-generic root=UUID=9ae642a2-9374-4304-9656-0722391d2113 ro recovery nomodeset iommu=pt intel_iommu=on video=efifb:off
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initrd.img-5.3.0-40-generic
}
menuentry "Ubuntu, with Linux 5.3.0-26-generic" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.0-26-generic-advanced-9ae642a2-9374-4304-9656-0722391d2113' {
        recordfail
        load_video
        gfxmode $linux_gfx_mode
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6  9ae642a2-9374-4304-9656-0722391d2113
        else
          search --no-floppy --fs-uuid --set=root 9ae642a2-9374-4304-9656-0722391d2113
        fi
        echo    'Loading Linux 5.3.0-26-generic ...'
            linux   /boot/vmlinuz-5.3.0-26-generic root=UUID=9ae642a2-9374-4304-9656-0722391d2113 ro iommu=pt intel_iommu=on video=efifb:off quiet splash $vt_handoff
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initrd.img-5.3.0-26-generic
}
menuentry "Ubuntu, with Linux 5.3.0-26-generic (recovery mode)" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.0-26-generic-recovery-9ae642a2-9374-4304-9656-0722391d2113' {
        recordfail
        load_video
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6  9ae642a2-9374-4304-9656-0722391d2113
        else
          search --no-floppy --fs-uuid --set=root 9ae642a2-9374-4304-9656-0722391d2113
        fi
        echo    'Loading Linux 5.3.0-26-generic ...'
            linux   /boot/vmlinuz-5.3.0-26-generic root=UUID=9ae642a2-9374-4304-9656-0722391d2113 ro recovery nomodeset iommu=pt intel_iommu=on video=efifb:off
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initrd.img-5.3.0-26-generic
}
menuentry "Ubuntu, with Linux 4.18.0-15-generic" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.18.0-15-generic-advanced-9ae642a2-9374-4304-9656-0722391d2113' {
        recordfail
        load_video
        gfxmode $linux_gfx_mode
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6  9ae642a2-9374-4304-9656-0722391d2113
        else
          search --no-floppy --fs-uuid --set=root 9ae642a2-9374-4304-9656-0722391d2113
        fi
        echo    'Loading Linux 4.18.0-15-generic ...'
            linux   /boot/vmlinuz-4.18.0-15-generic root=UUID=9ae642a2-9374-4304-9656-0722391d2113 ro iommu=pt intel_iommu=on video=efifb:off quiet splash $vt_handoff
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initrd.img-4.18.0-15-generic
}
menuentry "Ubuntu, with Linux 4.18.0-15-generic (recovery mode)" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.18.0-15-generic-recovery-9ae642a2-9374-4304-9656-0722391d2113' {
        recordfail
        load_video
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6  9ae642a2-9374-4304-9656-0722391d2113
        else
          search --no-floppy --fs-uuid --set=root 9ae642a2-9374-4304-9656-0722391d2113
        fi
        echo    'Loading Linux 4.18.0-15-generic ...'
            linux   /boot/vmlinuz-4.18.0-15-generic root=UUID=9ae642a2-9374-4304-9656-0722391d2113 ro recovery nomodeset iommu=pt intel_iommu=on video=efifb:off
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initrd.img-4.18.0-15-generic
}
}
### END /etc/grub.d/42_linux_proxy ###

### BEGIN /etc/grub.d/43_linux_xen ###

### END /etc/grub.d/43_linux_xen ###

### BEGIN /etc/grub.d/44_memtest86+ ###
### END /etc/grub.d/44_memtest86+ ###

### BEGIN /etc/grub.d/45_os-prober_proxy ###


set timeout_style=menu
if [ "${timeout}" = 0 ]; then
  set timeout=10
fi
### END /etc/grub.d/45_os-prober_proxy ###

### BEGIN /etc/grub.d/46_uefi-firmware ###
menuentry 'System setup' $menuentry_id_option 'uefi-firmware' {
    fwsetup
}
### END /etc/grub.d/46_uefi-firmware ###

### BEGIN /etc/grub.d/47_custom_proxy ###

# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.


### END /etc/grub.d/47_custom_proxy ###

### BEGIN /etc/grub.d/48_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/48_custom ###

KainWhite

Posted 2020-02-29T15:27:33.123

Reputation: 11

Check this article for using PCI passthrough with Xen and KVM hypervisors.

– harrymc – 2020-02-29T15:52:49.220

@harrymc ok, i've inspected grub.cfg and there were needed arguments for every additional ubuntu entry (advanced options for ubuntu), except the main one. Could this be a cause, that i've renamed this main entry, and now it cannot be refreshed by update-grub? – KainWhite – 2020-02-29T16:06:16.900

So, the question is how to make update-grub update the main entry as well? – KainWhite – 2020-02-29T16:12:32.300

You mean grub.conf. Please post it and indicate which entry doesn't update. – harrymc – 2020-02-29T16:32:46.007

No, it's definitely .cfg. I don't have any grub.conf file under /boot/grub. – KainWhite – 2020-02-29T16:44:51.577

Entry, that doesn't update - menuentry "Ubuntu 18.04" – KainWhite – 2020-02-29T16:45:16.930

No answers