Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Cannot create a mediated device with GVT-g...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
matthewmajf
n00b
n00b


Joined: 28 Jun 2024
Posts: 11

PostPosted: Tue Jul 02, 2024 5:31 pm    Post subject: Cannot create a mediated device with GVT-g... Reply with quote

As my laptop does not have two GPUs, and only one integrated graphics card, I am not able to just passthrough my integrated graphics card [to VMs], especially since I use several virtual machines in which I would normally passthrough multiple vGPU(s) created by Intel's GVT-g technology.
Intel's GVT-g technology has worked successfully with me on several distros, such as Debian, Ubuntu, Arch, etc. However, on Gentoo, [so far], I have not been able to successfully set up GVT-g.
I've even followed many tutorials, including these:
https://blog.freebsd-days.com/2021/05/windows-10-on-linux-kvm-with-intel-gvt-g/
https://wiki.gentoo.org/wiki/User:Shunlir/Intel_GVT-g
So here's how I attempted to get GVT-g working:
1. I would get the Gentoo kernel sources using portage, and then select the kernel using `eselect`.
2. I would then go to `/usr/src/linux`, run `make menuconfig`, make no changes in the menu, and save the `.config` file.
3. After that, I would edit the `.config` file manually, using GNU Nano, and set the following values:
CONFIG_VFIO_MDEV=m
CONFIG_VFIO_IOMMU_TYPE1=m
CONFIG_INTEL_IOMMU=y
CONFIG_DRM_I915_GVT=y
CONFIG_DRM_I915_GVT_KVMGT=m
4. I would then run `make`, `make modules_install`, and `make install`.
5. After that, I'd edit `/etc/default/grub`, and add these kernel parameters to `GRUB_CMDLINE_LINUX_DEFAULT`, each:
intel_iommu=on
i915.enable_gvt=1
kvm.ignore_msrs=1
i915.enable_guc=0
In the end, my `/etc/default/grub` file looked like this:
Code:

    # Copyright 1999-2020 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2
    #
    # To populate all changes in this file you need to regenerate your
    # grub configuration file afterwards:
    #     'grub-mkconfig -o /boot/grub/grub.cfg'
    #
    # See the grub info page for documentation on possible variables and
    # their associated values.

    GRUB_DISTRIBUTOR="Gentoo"

    # Default menu entry
    #GRUB_DEFAULT=0

    # Boot the default entry this many seconds after the menu is displayed
    #GRUB_TIMEOUT=5
    #GRUB_TIMEOUT_STYLE=menu

    # Append parameters to the linux kernel command line
    GRUB_CMDLINE_LINUX=""
    #
    # Examples:
    #
    # Boot with network interface renaming disabled
    # GRUB_CMDLINE_LINUX="net.ifnames=0"
    #
    # Boot with systemd instead of sysvinit (openrc)
    # GRUB_CMDLINE_LINUX="init=/usr/lib/systemd/systemd"

    # Append parameters to the linux kernel command line for non-recovery entries
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash isolcpus=1,5,2,6,3,7 intel_iommu=on i915.enable_gvt=1 kvm.ignore_msrs=1 i915.enable_guc=0"

    # Uncomment to disable graphical terminal (grub-pc only)
    #GRUB_TERMINAL=console

    # The resolution used on graphical terminal.
    # Note that you can use only modes which your graphic card supports via VBE.
    # You can see them in real GRUB with the command `vbeinfo'.
    #GRUB_GFXMODE=640x480

    # Set to 'text' to force the Linux kernel to boot in normal text
    # mode, 'keep' to preserve the graphics mode set using
    # 'GRUB_GFXMODE', 'WIDTHxHEIGHT'['xDEPTH'] to set a particular
    # graphics mode, or a sequence of these separated by commas or
    # semicolons to try several modes in sequence.
    #GRUB_GFXPAYLOAD_LINUX=

    # Path to theme spec txt file.
    # The starfield is by default provided with use truetype.
    # NOTE: when enabling custom theme, ensure you have required font/etc.
    #GRUB_THEME="/boot/grub/themes/starfield/theme.txt"

    # Background image used on graphical terminal.
    # Can be in various bitmap formats.
    #GRUB_BACKGROUND="/boot/grub/mybackground.png"

    # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
    #GRUB_DISABLE_LINUX_UUID=true

    # Comment if you don't want GRUB to pass "root=PARTUUID=xxx" parameter to kernel
    GRUB_DISABLE_LINUX_PARTUUID=false

    # Uncomment to disable generation of recovery mode menu entries
    #GRUB_DISABLE_RECOVERY=true

    # Uncomment to disable generation of the submenu and put all choices on
    # the top-level menu.
    # Besides the visual affect of no sub menu, this makes navigation of the
    # menu easier for a user who can't see the screen.
    #GRUB_DISABLE_SUBMENU=y

    # Uncomment to play a tone when the main menu is displayed.
    # This is useful, for example, to allow users who can't see the screen
    # to know when they can make a choice on the menu.
    #GRUB_INIT_TUNE="60 800 1"
   

6. So I'd then reload the GRUB bootloader by running `grub-mkconfig -o /boot/grub/grub.cfg`.

I'd then reboot, and to my surprise, when I'd go to `/sys/bus/pci/devices/0000:00:02.0/` (yes, that's also the address of my integrated graphics card), and the `mdev_supported_types` directory/file was nowhere to be found.
Yes, `CONFIG_VFIO_DEVICE` wasn't edited, because it was already nowhere to be seen in the kernel's configuration. Why is this so? Am I just no longer able to create mediated devices for use with GVT-g? My laptop only has one Mini-PCIe slot, but that's for the WiFi card, and I don't think there's any dGPU out there that can fit into such a small slot.

If anyone knows how to fix this problem, I'd greatly appreciate it!
Back to top
View user's profile Send private message
Cruslan
n00b
n00b


Joined: 06 Jan 2024
Posts: 26

PostPosted: Tue Jul 02, 2024 10:31 pm    Post subject: Reply with quote

You have to create MDEV device again every reboot. Or you may need set a OpenRC or systemd service that runs commands for you.
Back to top
View user's profile Send private message
matthewmajf
n00b
n00b


Joined: 28 Jun 2024
Posts: 11

PostPosted: Tue Jul 02, 2024 10:39 pm    Post subject: Reply with quote

Cruslan wrote:
You have to create MDEV device again every reboot. Or you may need set a OpenRC or systemd service that runs commands for you.

No, no, I understand that, but here's the thing, I am not capable of creating this MDEV device because the `mdev_supported_types` directory doesn't even exist in the iGPU's directory (`/sys/bus/pci/devices/0000:00:02.0`)!
Back to top
View user's profile Send private message
Cruslan
n00b
n00b


Joined: 06 Jan 2024
Posts: 26

PostPosted: Tue Jul 02, 2024 10:43 pm    Post subject: Reply with quote

Are you sure about your iGPU supports GVT-g technology? Small percentage of Intel iGPU's supports them. I have to ask because you didn't mentioned your platform.
Back to top
View user's profile Send private message
matthewmajf
n00b
n00b


Joined: 28 Jun 2024
Posts: 11

PostPosted: Tue Jul 02, 2024 10:56 pm    Post subject: Reply with quote

Cruslan wrote:
Are you sure about your iGPU supports GVT-g technology? Small percentage of Intel iGPU's supports them. I have to ask because you didn't mentioned your platform.

Mine in fact does. When I previously ran the same laptop on a Debian system, I was capable of creating a few vGPUs using GVT-g.
Running `neofetch` returns the following for my iGPU:
Code:

Intel WhiskeyLake-U GT2 [UHD Graphics 620]
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5118
Location: Bavaria

PostPosted: Wed Jul 03, 2024 12:04 am    Post subject: Re: Cannot create a mediated device with GVT-g... Reply with quote

matthewmajf wrote:
[...]
2. I would then go to `/usr/src/linux`, run `make menuconfig`, make no changes in the menu, and save the `.config` file.
3. After that, I would edit the `.config` file manually, using GNU Nano, and set the following values:
CONFIG_VFIO_MDEV=m
CONFIG_VFIO_IOMMU_TYPE1=m
CONFIG_INTEL_IOMMU=y
CONFIG_DRM_I915_GVT=y
CONFIG_DRM_I915_GVT_KVMGT=m
4. I would then run `make`, `make modules_install`, and `make install`.
[...]

This does not work - you will miss too many options. Please read this short chapter:
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Manual_kernel_configuration#Never_edit_.config

... and - if you want - the whole article ... and then:
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Manual_Configuring_Kernel_Version_6.6
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5118
Location: Bavaria

PostPosted: Wed Jul 03, 2024 12:21 am    Post subject: Reply with quote

P.S.: Only one example: If you enable DRM_I915_GVT_KVMGT in "make menuconfig" it will automatically enable also:
Quote:
Selects: DRM_I915_GVT [=n] && KVM_EXTERNAL_WRITE_TRACKING [=n] && VFIO_MDEV [=n]

(look into the help of DRM_I915_GVT_KVMGT)
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
kimchi_sg
Advocate
Advocate


Joined: 26 Nov 2004
Posts: 3038

PostPosted: Wed Jul 03, 2024 12:46 am    Post subject: Re: Cannot create a mediated device with GVT-g... Reply with quote

matthewmajf wrote:

2. I would then go to `/usr/src/linux`, run `make menuconfig`, make no changes in the menu, and save the `.config` file.

This alone will almost certainly make your new kernel unusable, the default config is very inadequate for most users.
Quote:

3. After that, I would edit the `.config` file manually, using GNU Nano, and set the following values:
CONFIG_VFIO_MDEV=m
CONFIG_VFIO_IOMMU_TYPE1=m
CONFIG_INTEL_IOMMU=y
CONFIG_DRM_I915_GVT=y
CONFIG_DRM_I915_GVT_KVMGT=m

As pietinger said, this makes your new kernel 200% more not bootable.
Back to top
View user's profile Send private message
matthewmajf
n00b
n00b


Joined: 28 Jun 2024
Posts: 11

PostPosted: Wed Jul 03, 2024 1:13 am    Post subject: Re: Cannot create a mediated device with GVT-g... Reply with quote

kimchi_sg wrote:
matthewmajf wrote:

2. I would then go to `/usr/src/linux`, run `make menuconfig`, make no changes in the menu, and save the `.config` file.

This alone will almost certainly make your new kernel unusable, the default config is very inadequate for most users.
Quote:

3. After that, I would edit the `.config` file manually, using GNU Nano, and set the following values:
CONFIG_VFIO_MDEV=m
CONFIG_VFIO_IOMMU_TYPE1=m
CONFIG_INTEL_IOMMU=y
CONFIG_DRM_I915_GVT=y
CONFIG_DRM_I915_GVT_KVMGT=m

As pietinger said, this makes your new kernel 200% more not bootable.

Well, I've had no problem booting with the new kernel, however of course, the mediated device feature did not work with GVT-g. I'll go and read the article, see if I can re-configure it properly, and i'll report back here with some status once I'm done!

And thanks for all of the help, by the way.
Back to top
View user's profile Send private message
matthewmajf
n00b
n00b


Joined: 28 Jun 2024
Posts: 11

PostPosted: Wed Jul 03, 2024 4:46 pm    Post subject: Reply with quote

Alright, so I have been able to clean up the whole kernel, and used `make menuconfig` to enable the flags I mentioned in the post above. However, when I boot up, it seems that the GRUB bootloader reports that it's loading the initial ramdisk, however it hangs there.
So I ran `make menuconfig` again, and enabled simple framebuffer, and EFI framebuffer, however that didn't fix up anything. I'm guessing the system does boot, but cannot manage to display anything successfully, so I tried SSH'ing to my laptop from another computer, however I was not able to connect.
What am I doing wrong here?
Here's my `.config` file (no, I have not edited it manually):
https://pastebin.com/raw/4B9L00tz
Here's my `/etc/default/grub` file:
Code:

# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
#
# To populate all changes in this file you need to regenerate your
# grub configuration file afterwards:
#     'grub-mkconfig -o /boot/grub/grub.cfg'
#
# See the grub info page for documentation on possible variables and
# their associated values.

GRUB_DISTRIBUTOR="Gentoo"

# Default menu entry
#GRUB_DEFAULT=0

# Boot the default entry this many seconds after the menu is displayed
#GRUB_TIMEOUT=5
#GRUB_TIMEOUT_STYLE=menu

# Append parameters to the linux kernel command line
GRUB_CMDLINE_LINUX=""
#
# Examples:
#
# Boot with network interface renaming disabled
# GRUB_CMDLINE_LINUX="net.ifnames=0"
#
# Boot with systemd instead of sysvinit (openrc)
# GRUB_CMDLINE_LINUX="init=/usr/lib/systemd/systemd"

# Append parameters to the linux kernel command line for non-recovery entries
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash isolcpus=1,5,2,6,3,7 intel_iommu=on i915.enable_gvt=1 kvm.ignore_msrs=1"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal.
# Note that you can use only modes which your graphic card supports via VBE.
# You can see them in real GRUB with the command `vbeinfo'.
#GRUB_GFXMODE=640x480

# Set to 'text' to force the Linux kernel to boot in normal text
# mode, 'keep' to preserve the graphics mode set using
# 'GRUB_GFXMODE', 'WIDTHxHEIGHT'['xDEPTH'] to set a particular
# graphics mode, or a sequence of these separated by commas or
# semicolons to try several modes in sequence.
#GRUB_GFXPAYLOAD_LINUX=

# Path to theme spec txt file.
# The starfield is by default provided with use truetype.
# NOTE: when enabling custom theme, ensure you have required font/etc.
#GRUB_THEME="/boot/grub/themes/starfield/theme.txt"

# Background image used on graphical terminal.
# Can be in various bitmap formats.
#GRUB_BACKGROUND="/boot/grub/mybackground.png"

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
#GRUB_DISABLE_LINUX_UUID=true

# Comment if you don't want GRUB to pass "root=PARTUUID=xxx" parameter to kernel
GRUB_DISABLE_LINUX_PARTUUID=false

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY=true

# Uncomment to disable generation of the submenu and put all choices on
# the top-level menu.
# Besides the visual affect of no sub menu, this makes navigation of the
# menu easier for a user who can't see the screen.
#GRUB_DISABLE_SUBMENU=y

# Uncomment to play a tone when the main menu is displayed.
# This is useful, for example, to allow users who can't see the screen
# to know when they can make a choice on the menu.
#GRUB_INIT_TUNE="60 800 1"

And here's the logs from running `make modules_install && make install`:
Code:

  SYMLINK /lib/modules/6.6.30-gentoo/build
  INSTALL /lib/modules/6.6.30-gentoo/modules.order
  INSTALL /lib/modules/6.6.30-gentoo/modules.builtin
  INSTALL /lib/modules/6.6.30-gentoo/modules.builtin.modinfo
  INSTALL /lib/modules/6.6.30-gentoo/kernel/fs/efivarfs/efivarfs.ko
  INSTALL /lib/modules/6.6.30-gentoo/kernel/drivers/vfio/pci/vfio-pci-core.ko
  INSTALL /lib/modules/6.6.30-gentoo/kernel/drivers/vfio/pci/vfio-pci.ko
  INSTALL /lib/modules/6.6.30-gentoo/kernel/drivers/thermal/intel/x86_pkg_temp_thermal.ko
  INSTALL /lib/modules/6.6.30-gentoo/kernel/net/netfilter/nf_log_syslog.ko
  INSTALL /lib/modules/6.6.30-gentoo/kernel/net/netfilter/xt_mark.ko
  INSTALL /lib/modules/6.6.30-gentoo/kernel/net/netfilter/xt_nat.ko
  INSTALL /lib/modules/6.6.30-gentoo/kernel/net/netfilter/xt_LOG.ko
  INSTALL /lib/modules/6.6.30-gentoo/kernel/net/netfilter/xt_MASQUERADE.ko
  INSTALL /lib/modules/6.6.30-gentoo/kernel/net/netfilter/xt_addrtype.ko
  INSTALL /lib/modules/6.6.30-gentoo/kernel/net/ipv4/netfilter/iptable_nat.ko
  DEPMOD  /lib/modules/6.6.30-gentoo

https://pastebin.com/raw/dYVxX0NX
Anyone know why this is happening?
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5118
Location: Bavaria

PostPosted: Wed Jul 03, 2024 5:31 pm    Post subject: Reply with quote

You have not configured:
Code:
# CONFIG_FRAMEBUFFER_CONSOLE is not set

# CONFIG_DRM_FBDEV_EMULATION is not set

There is a reason I named the chapter "Must have" ...
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Manual_Configuring_Kernel_Version_6.6#Part_3_-_Must_Haves

(The same result you would have with doing a "make menuconfig" and saving it without any changes ... the default config does not have everything you need.)
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
matthewmajf
n00b
n00b


Joined: 28 Jun 2024
Posts: 11

PostPosted: Thu Jul 04, 2024 3:44 pm    Post subject: Reply with quote

pietinger wrote:
You have not configured:
Code:
# CONFIG_FRAMEBUFFER_CONSOLE is not set

# CONFIG_DRM_FBDEV_EMULATION is not set

There is a reason I named the chapter "Must have" ...
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Manual_Configuring_Kernel_Version_6.6#Part_3_-_Must_Haves

(The same result you would have with doing a "make menuconfig" and saving it without any changes ... the default config does not have everything you need.)


This has seemed to fix the issue! I was able to enable framebuffer, and XFS support, getting my kernel to work.
I very much appreciate the help, thanks!
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5118
Location: Bavaria

PostPosted: Thu Jul 04, 2024 4:54 pm    Post subject: Reply with quote

matthewmajf wrote:
This has seemed to fix the issue! I was able to enable framebuffer, and XFS support, getting my kernel to work.

Happy to hear that. :D Does GVT-g also work now ?

matthewmajf wrote:
I very much appreciate the help, thanks!

You are very Welcome ! :D

Have fun with Gentoo ! 8)
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum