Score:1

How to get GPU passthrough working on WSL2 with Windows 11 as hosts , Ubuntu 22.10 as guest os and FreeBSD virtualized with qemu-kvm

in flag

After a week of hard work,I've just configured my WSL2 subsystem as I want : I have enabled the ZFS support,I can start the graphical applications directly from the Ubuntu command line ; I've installed the nvidia driver and the CUDA libraries within Ubuntu and finally I've configured qemu/kvm and virt-manager so that I can virtualize FreeBSD on top of Ubuntu. Now,the problem is : how can I "tell" to FreeBSD to run Xorg with one of the GPUs that I have on the PC. Actually I have two GPUs on the system. The GTX 1060,that I use as default,where I have attached my monitor and the RTX 2080 ti,that usually is used to be passed into another OS. When I'm using Linux as host os,I would like to virtualize Windows and I passthru the RTX 2080 ti in Windows using qemu-kvm and virt-manager ; when I use FreeBSD as host os,I want to pass thru the RTX 2080 ti to a Linux guest os using bhyve. But when I use Windows 11 as host os and Ubuntu as guest,how can I pass thru my RTX 2080 ti with qemu-kvm and virt-manager to FreeBSD for example ? Below you can see all the PCI devices that are recognized within Ubuntu 22.04 at the moment :

# lspci
0301:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
05c0:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
117a:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
242b:00:00.0 3D controller: Microsoft Corporation Basic Render Driver
4e53:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
5dc2:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
6164:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
6251:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
7c22:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
840d:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
94be:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
ad48:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
ae16:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
af96:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
baff:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
d5cc:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
d9a5:00:00.0 System peripheral: Red Hat, Inc. Virtio file system (rev 01)
de65:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio console (rev 01)
fd8d:00:00.0 3D controller: Microsoft Corporation Basic Render Driver

the only two virtual graphics adapter that can be used are the following :

 242b:00:00.0 3D controller: Microsoft Corporation Basic Render Driver
 fd8d:00:00.0 3D controller: Microsoft Corporation Basic Render Driver

I've already tried to configure Xorg in FreeBSD declaring inside the xorg.conf the one and only graphic "card" I see,the "00:01.0 VGA Compatible Controller RedHat QXL paravirtual graphic card" :

1

like this :

2

unfortunately it is not accepted as a valid graphic card :

3

What shoud I do to have a working graphic enviroment running on FreeBSD ? Maybe should I try to pass-thru one of these two graphic adapters

242b:00:00.0 3D controller: Microsoft Corporation Basic Render Driver
fd8d:00:00.0 3D controller: Microsoft Corporation Basic Render Driver

in virt-manager like they were a physical graphic cards ? I'm very doubtful that it works like this.

Anyway,these are the physical GPUs that are on my system :

4

both are recognized on Windows 11 and on Ubuntu :

# nvidia-smi

+---------------------------------------------+
| NVIDIA-SMI 536.40                 Driver Version: 536.40       CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                     TCC/WDDM  | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce GTX 1060 3GB  WDDM  | 00000000:01:00.0  On |                  N/A |
| 57%   41C    P2              25W / 120W |    710MiB /  3072MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   1  NVIDIA GeForce RTX 2080 Ti   WDDM  | 00000000:02:00.0 Off |                  N/A |
| 31%   40C    P8              21W / 250W |     74MiB / 11264MiB |      0%              |
+_________________________________________+______________________+______________________|

Some background :

Windows Version = Windows 11 PRO Version 10.0.22000.2176

WSL2 Version = 1.3.11.0

Kernel Version = 5.15.90.2-3-microsoft-standard

Distro Version = Ubuntu 22.10

Version kernel: 5.15.90.2-3

Version WSLg: 1.0.54

Version MSRDC: 1.2.4240

Version Direct3D: 1.608.2-61064218

Version DXCore: 10.0.25880.1000-230602-1350.main

Marco avatar
br flag
Have you asked Microsoft Support ?
in flag
There are 2044 opened problems on the WSL2 support.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.