XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Set passthrough GPU as a primary graphics card for a VM

    Scheduled Pinned Locked Moved Compute
    17 Posts 5 Posters 894 Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • TeddyAstieT Offline
      TeddyAstie Vates 🪐 XCP-ng Team Xen Guru
      last edited by

      Hello @miltador ,

      If I understand correctly, your VM has this setup :

      • a emulated Cirrus with a virtual display plugged in (this is what you see in Xen Orchestra) as primary device
      • a physical (real) Intel iGPU with (supposedly) no display plugged in (i.e no physical screen plugged on the server motherboard)

      The catch is that the physical Intel iGPU can only display on real physical screens (and thus not in Xen Orchestra).

      So the Ubuntu desktop will display on the Cirrus display (which is the one you see in Xen Orchestra) and only it as you have no other display (otherwise, Ubuntu would show you multiples screens).

      That doesn't prevent Ubuntu from using the Intel GPU, just that it's not used for display.

      Depending on what you are looking for, you can make Ubuntu use the Intel GPU by :

      • if you want to run a graphical program (and perhaps the entire desktop) with the GPU, you may need to use DRI PRIME offload to make the emulated gpu display what the Intel iGPU computes (see https://docs.mesa3d.org/envvars.html#envvar-DRI_PRIME)
      • for multimedia software such as Jellyfin, you don't need to do anything special as e.g Jellyfin supports headless setups on Ubuntu (which is what you have basically)
      M 1 Reply Last reply Reply Quote 0
      • M Offline
        miltador @TeddyAstie
        last edited by

        @Teddy-Astie hello, thank you for the reply.
        I have a physical screen plugged on the motherboard but it receives no output.
        I suppose it is because the Ubuntu desktop VM detects emulated Cirrus GPU as a primary one and uses it for video output.
        I can see Intel iGPU in Ubuntu VM but I want to use it as a video output on my connected physical display.

        1 Reply Last reply Reply Quote 0
        • M Offline
          miltador
          last edited by

          I've tried an experiment and modified slightly qemu-wrapper script to not add cirrus-vga device to the VM. THe VM starts, but I still have no signal on my HDMI output. Seems like more work needs to be done in order to use my iGPU for display on HDMI output...
          Browsing through similar topics on the forum it seems like it's not a supported use case? Are there any plans to support this use case?

          K 1 Reply Last reply Reply Quote 0
          • K Offline
            kubuntu-newbie @miltador
            last edited by

            @miltador have you ever been able to figure this out? I'm having the same problem with plasmashell trying to use virtual gpu instead of nvidia

            M 1 Reply Last reply Reply Quote 0
            • M Offline
              miltador @kubuntu-newbie
              last edited by

              @kubuntu-newbie nah, I gave up on this. I think it's generally not suited for such use cases.
              PCI passthrough works well in XCP-ng, GPU passthrough - nope unless you have special hardware 😕

              K 1 Reply Last reply Reply Quote 0
              • K Offline
                kubuntu-newbie @miltador
                last edited by

                @miltador

                I was able to get it working with kubuntu from 22.04 through 25.10, running X11 plasma session just by passing through PCI and running "nvidia-xconfig --enable-all-gpus --separate-x-screens to create xorg.conf" in the VM.

                It used to work with Wayland as well on XCP-ng 8.2 and kubuntu 22.04 without any modifications to the VM (just had to create xorg.conf so SDDM would use correct display)

                now Wayland tries to use 1234:1111 (that's how virtual GPU is showing up in the VM when vga=on ) or "Cirrus" 1013:00b8 (when vga is disabled), I'm still trying to figure out how to tell Wayland to use nvidia

                I'm using Nvidia A4000, no iGPU

                1 Reply Last reply Reply Quote 0
                • A Online
                  acebmxer
                  last edited by

                  I was able to get nvidia rtx 4070 passed through to a windows VM and Ubuntu server. Need to make sure you passing all the devices associated with the GPU, specifically the Audio controller on the GPU.

                  These were on AMD systems.

                  K 1 Reply Last reply Reply Quote 0
                  • M Offline
                    miltador
                    last edited by

                    Good to see some successes here, no luck for me with Intel N100 iGPU though 😕
                    Both Linux and Windows.

                    1 Reply Last reply Reply Quote 0
                    • K Offline
                      kubuntu-newbie @acebmxer
                      last edited by

                      @acebmxer in my case it appears to be a Wayland issue, using the wrong card. I was hoping that I could disable virtual gpu all together

                      curious though that disabling virtual GPU just changes the device id in the vm from 1234:1111 to "cirrus" - that seems to be a bug in XCP-ng

                      A 1 Reply Last reply Reply Quote 0
                      • A Online
                        acebmxer @kubuntu-newbie
                        last edited by

                        @kubuntu-newbie

                        Yeah i didnt do anything with disabling the vgpu. Just a standard Win 11 or ubuntu VM and attached the nivdia gpu.

                        1 Reply Last reply Reply Quote 0
                        • olivierlambertO Online
                          olivierlambert Vates 🪐 Co-Founder CEO
                          last edited by

                          IIRC, Intel iGPU is very different than a discrete GPU from a system perspective, that might explain your problem.

                          K 2 Replies Last reply Reply Quote 0
                          • K Offline
                            kubuntu-newbie @olivierlambert
                            last edited by

                            @olivierlambert
                            it is still not clear to me how changing vga: std to vga: cirrus in platform parameter of a vm constitute turning off vga (this is what happens when you turn off vga in Xen Orchestra)

                            manually setting vga to off in platform produces the same result as vga: cirrus, VM still sees "VGA compatible controller [0300]: Cirrus Logic GD 5446 [1013:00b8]"

                            is there a way to completely turn off creating this virtual VGA in the VM?

                            1 Reply Last reply Reply Quote 0
                            • K Offline
                              kubuntu-newbie @olivierlambert
                              last edited by

                              @olivierlambert

                              and removing key vga from platform all together has the same result as switching to cirrus, there is still a virtual vga Cirrus Logic in the VM

                              1 Reply Last reply Reply Quote 0
                              • olivierlambertO Online
                                olivierlambert Vates 🪐 Co-Founder CEO
                                last edited by

                                Because it's the default you cannot bypass. @Team-XAPI-Network could confirm

                                K 1 Reply Last reply Reply Quote 0
                                • K Offline
                                  kubuntu-newbie @olivierlambert
                                  last edited by

                                  @olivierlambert

                                  thank you! I did a little digging, but I could be looking at the wrong place, according to:

                                  https://github.com/xcp-ng/qemu-dp/blob/master/qemu-options.hx

                                  there is an option vga: none

                                  DEF("vga", HAS_ARG, QEMU_OPTION_vga,
                                  "-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|virtio|none]\n"
                                  " select video card type\n", QEMU_ARCH_ALL)
                                  SRST
                                  -vga type
                                  ...
                                  none
                                  Disable VGA card.

                                  I tried setting this manually via "xe vm-param-set platform:vga=none " and I still get Cirrus PCI device created in the VM

                                  Is there something else that needs to be done to have no virtual VGA in the VM at all?

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post