Jump to content

VM Alias Handler Problem


Recommended Posts

Hi,ALL!

I recently tried to assign nvidia's graphics card virtualization to my virtual machine, and I've made it to the last step of assigning the virtual device to the virtual machine. But I'm having a problem with the <alias name='hostdev0'/> statement disappearing.

At first I thought that the statement did not conform to the xml syntax, until I found the following post in the forum, I didn't realize it was a bug. The owner of this post seems to have circumvented the problem of disappearing alias names by other means. But for me, I can't solve the problem the same way.

Is there any solution to this problem now?

Thanks for the support!

 

The following is my original xml for reference:

<hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='off'>
  <source>
     <address uuid='xxxxxxxxxxxxxxxxxxx'/>
  </source>
  <alias name='hostdev0'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</hostdev>

 <qemu:commandline>
   <qemu:arg value='-set'/>
   <qemu:arg value='device.hostdev0.x-pci-vendor-id=0x10DE'/>
   <qemu:arg value='-set'/>
   <qemu:arg value='device.hostdev0.x-pci-device-id=0x1c30'/>
   <qemu:arg value='-set'/>
   <qemu:arg value='device.hostdev0.x-pci-sub-vendor-id=0x10DE'/>
   <qemu:arg value='-set'/>
   <qemu:arg value='device.hostdev0.x-pci-sub-device-id=0x1c30'/>
   <qemu:arg value='-set'/>
   <qemu:arg value='device.hostdev0.driver=vfio-pci-nohotplug'/>
   <qemu:arg value='-uuid'/>
   <qemu:arg value='xxxxxxxxxxxxxxxxxxx'/>
  </qemu:commandline>

 

Link to comment

What version of unraid are you running? libvirt (xml) sintax changed from what you pasted..

If you are using the latest version of unraid (and I strongly suggest to use it) the -set argument was deprecated by libvirt and you need to use the newer sintax (qemu:override just after the devices closing tag <-- you missed it in your copy/paste?).

Just assign a custom alias (and note that user aliases must begin with ua-) and then assign properties with qemu:override

This should translate to:

 

<alias name='ua-aliasname'/>

This goes inside the hostdev block of your device

...

...

  </devices>
  <qemu:override>
    <qemu:device alias='ua-aliasname'>
      <qemu:frontend>
        <qemu:property name='x-pci-vendor-id' type='string' value='0x10DE'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-device-id' type='string' value='0x1c30'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-sub-vendor-id' type='string' value='0x10DE'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-sub-device-id' type='string' value='0x1c30'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='driver' type='string' value='vfio-pci-nohotplug'/>
      </qemu:frontend>
    </qemu:device>
  </qemu:override>
</domain>

 

As far as the vfio-pci-nohotplug I think you can assign hotplug='off' to the pcie-root-port the device is attached to, for example (this is my gpu):
 

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x10' slot='0x00' function='0x0' multifunction='on'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x06' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x10' slot='0x00' function='0x1'/>
    </hostdev>

 

Target bus is 0x10, this means it's attached to the pcie-root-port with index='10':
 

    <controller type='pci' index='10' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='10' port='0x31' hotplug='off'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>

Note the hotplug='off'

 

And as far as the uuid, why are using it as a custom qemu arg? you can set it in the xml at the top.

If for whatever reason you need that uuid arg it should still work with qemu:commandline, so:

  </devices>
  <qemu:override>
    <qemu:device alias='ua-aliasname'>
      <qemu:frontend>
        <qemu:property name='x-pci-vendor-id' type='string' value='0x10DE'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-device-id' type='string' value='0x1c30'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-sub-vendor-id' type='string' value='0x10DE'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-sub-device-id' type='string' value='0x1c30'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='driver' type='string' value='vfio-pci-nohotplug'/>
      </qemu:frontend>
    </qemu:device>
  </qemu:override>
  <qemu:commandline>
    <qemu:arg value='-uuid'/>
    <qemu:arg value='xxxxxxxxxxxxxxxxxxx'/>
  </qemu:commandline> 
</domain>

 

Edited by ghost82
Link to comment
8 hours ago, ghost82 said:

What version of unraid are you running? libvirt (xml) sintax changed from what you pasted..
你运行的是什么版本的unraid?libvirt(xml)sintax已从您粘贴的内容更改..

If you are using the latest version of unraid (and I strongly suggest to use it) the -set argument was deprecated by libvirt and you need to use the newer sintax (qemu:override just after the devices closing tag <-- you missed it in your copy/paste?).

Just assign a custom alias (and note that user aliases must begin with ua-) and then assign properties with qemu:override
只需分配一个自定义别名(注意用户别名必须以ua-开始),然后用qemu:override分配属性

This should translate to: 这应转化为:

 

<alias name='ua-aliasname'/>

This goes inside the hostdev block of your device
这将进入设备的hostdev块

...

...

  </devices>
  <qemu:override>
    <qemu:device alias='us-aliasname'>
      <qemu:frontend>
        <qemu:property name='x-pci-vendor-id' type='string' value='0x10DE'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-device-id' type='string' value='0x1c30'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-sub-vendor-id' type='string' value='0x10DE'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-sub-device-id' type='string' value='0x1c30'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='driver' type='string' value='vfio-pci-nohotplug'/>
      </qemu:frontend>
    </qemu:device>
  </qemu:override>
</domain>

 

As far as the vfio-pci-nohotplug I think you can assign hotplug='off' to the pcie-root-port the device is attached to, for example (this is my gpu): 至于vfio-pci-nohotplug,我认为你可以将hotplug ='off'分配给设备连接的pcie-root-port,例如(这是我的gpu):
 

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x10' slot='0x00' function='0x0' multifunction='on'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x06' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x10' slot='0x00' function='0x1'/>
    </hostdev>

 

Target bus is 0x10, this means it's attached to the pcie-root-port with index='10': 目标总线是0x 10,这意味着它连接到索引='10'的pcie-root-port:
 

    <controller type='pci' index='10' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='10' port='0x31' hotplug='off'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>

Note the hotplug='off' 注意hotplug='off'

 

And as far as the uuid, why are using it as a custom qemu arg? you can set it in the xml at the top.
至于uuid,为什么要将它用作自定义qemu参数?您可以在顶部的xml中设置它。

If for whatever reason you need that uuid arg it should still work with qemu:commandline, so:
无论出于何种原因,你需要uuid参数,它仍然应该与qemu:commandline一起工作,所以:

  </devices>
  <qemu:override>
    <qemu:device alias='us-aliasname'>
      <qemu:frontend>
        <qemu:property name='x-pci-vendor-id' type='string' value='0x10DE'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-device-id' type='string' value='0x1c30'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-sub-vendor-id' type='string' value='0x10DE'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-sub-device-id' type='string' value='0x1c30'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='driver' type='string' value='vfio-pci-nohotplug'/>
      </qemu:frontend>
    </qemu:device>
  </qemu:override>
  <qemu:commandline>
    <qemu:arg value='-uuid'/>
    <qemu:arg value='xxxxxxxxxxxxxxxxxxx'/>
  </qemu:commandline> 
</domain>

 

First of all thank you very much for your help. My unraid version is 6.11.5.

 

Also the code is from someone else. In fact, I don't know much about qemu, I just understand a little bit of code, so I can analyze that the subsequent code cannot refer to the device because the alias disappears.

 

I don't know why the original text needs to quote the uuid parameter. The article I refer to is written in Chinese, and I will post the link later for reference by those who need a graphics card virtualization solution.

 

The idea of this article is similar to the pve platform graphics card virtualization solution on the English platform. Both use mdevctl to define a virtual graphics card specified by nvidia, and then reference it in the virtual machine. It's just that in the last step, pve supports direct reference in the graphical interface, and unraid needs to be added in xml.

 

I'll try to fix my code today with the code you gave.

 

Thanks again for your assistance.

 

Article link:https://www.lxg2016.com/55831.html

Link to comment
19 hours ago, ghost82 said:

What version of unraid are you running? libvirt (xml) sintax changed from what you pasted..

If you are using the latest version of unraid (and I strongly suggest to use it) the -set argument was deprecated by libvirt and you need to use the newer sintax (qemu:override just after the devices closing tag <-- you missed it in your copy/paste?).

Just assign a custom alias (and note that user aliases must begin with ua-) and then assign properties with qemu:override

This should translate to:

 

<alias name='ua-aliasname'/>

This goes inside the hostdev block of your device

...

...

  </devices>
  <qemu:override>
    <qemu:device alias='us-aliasname'>
      <qemu:frontend>
        <qemu:property name='x-pci-vendor-id' type='string' value='0x10DE'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-device-id' type='string' value='0x1c30'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-sub-vendor-id' type='string' value='0x10DE'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-sub-device-id' type='string' value='0x1c30'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='driver' type='string' value='vfio-pci-nohotplug'/>
      </qemu:frontend>
    </qemu:device>
  </qemu:override>
</domain>

 

As far as the vfio-pci-nohotplug I think you can assign hotplug='off' to the pcie-root-port the device is attached to, for example (this is my gpu):
 

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x10' slot='0x00' function='0x0' multifunction='on'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x06' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x10' slot='0x00' function='0x1'/>
    </hostdev>

 

Target bus is 0x10, this means it's attached to the pcie-root-port with index='10':
 

    <controller type='pci' index='10' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='10' port='0x31' hotplug='off'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>

Note the hotplug='off'

 

And as far as the uuid, why are using it as a custom qemu arg? you can set it in the xml at the top.

If for whatever reason you need that uuid arg it should still work with qemu:commandline, so:

  </devices>
  <qemu:override>
    <qemu:device alias='us-aliasname'>
      <qemu:frontend>
        <qemu:property name='x-pci-vendor-id' type='string' value='0x10DE'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-device-id' type='string' value='0x1c30'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-sub-vendor-id' type='string' value='0x10DE'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-sub-device-id' type='string' value='0x1c30'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='driver' type='string' value='vfio-pci-nohotplug'/>
      </qemu:frontend>
    </qemu:device>
  </qemu:override>
  <qemu:commandline>
    <qemu:arg value='-uuid'/>
    <qemu:arg value='xxxxxxxxxxxxxxxxxxx'/>
  </qemu:commandline> 
</domain>

 

 

I tried the method you gave, first I added ua- to the alias, it was indeed saved, but the following <qemu:commandline> still showed that hostdev0 was undefined.

after that i try to use

  </devices>
  <qemu:override>
    <qemu:device alias='us-aliasname'>
      <qemu:frontend>
        <qemu:property name='x-pci-vendor-id' type='string' value='0x10DE'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-device-id' type='string' value='0x1c30'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-sub-vendor-id' type='string' value='0x10DE'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='x-pci-sub-device-id' type='string' value='0x1c30'/>
      </qemu:frontend>
      <qemu:frontend>
        <qemu:property name='driver' type='string' value='vfio-pci-nohotplug'/>
      </qemu:frontend>
    </qemu:device>
  </qemu:override>
  <qemu:commandline>
    <qemu:arg value='-uuid'/>
    <qemu:arg value='xxxxxxxxxxxxxxxxxxx'/>
  </qemu:commandline>
</domain>

With this code, although the virtual machine is successfully started, the virtual machine cannot be connected through vnc.

 

And I don't understand how the code posted above gets in touch with <hostdev>, I don't see the alias being referenced by <hostdev>.

In addition, how is the bus determined? Can it be specified arbitrarily?

 

I attach the initial complete xml at the end of the article, looking forward to your reply.

 

Thanks!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>Windows 10</name>
  <uuid>e625f9bd-9c40-f9f3-2c61-be464c8e742d</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="windows.png" os="windows10"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>10</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='10'/>
    <vcpupin vcpu='2' cpuset='1'/>
    <vcpupin vcpu='3' cpuset='11'/>
    <vcpupin vcpu='4' cpuset='2'/>
    <vcpupin vcpu='5' cpuset='12'/>
    <vcpupin vcpu='6' cpuset='3'/>
    <vcpupin vcpu='7' cpuset='13'/>
    <vcpupin vcpu='8' cpuset='4'/>
    <vcpupin vcpu='9' cpuset='14'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-7.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/e625f9bd-9c40-f9f3-2c61-be464c8e742d_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv mode='custom'>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
      <vendor_id state='on' value='none'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='5' threads='2'/>
    <cache mode='passthrough'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Windows 10/vdisk1.img'/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/cn_windows_10_multiple_editions_x64_dvd_6848463.iso'/>
      <target dev='hda' bus='sata'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/virtio-win-0.1.190-1.iso'/>
      <target dev='hdb' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x8'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x9'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0xa'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0x14'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0xb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
    </controller>
    <controller type='pci' index='7' model='pcie-to-pci-bridge'>
      <model name='pcie-pci-bridge'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:ab:8f:a2'/>
      <source bridge='br1'/>
      <model type='virtio-net'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0' keymap='en-us'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <audio id='1' type='none'/>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x01' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='off'>
      <source>
        <address uuid='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
      </source>
      <alias name='ua-hostdev0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </memballoon>
  </devices>
  <qemu:override>
    <qemu:device alias='ua-hostdev0'>
      <qemu:frontend>
        <qemu:property name='x-pci-vendor-id' type='string' value='0x10DE'/>
        <qemu:property name='x-pci-device-id' type='string' value='0x1c30'/>
        <qemu:property name='x-pci-sub-vendor-id' type='string' value='0x10DE'/>
        <qemu:property name='x-pci-sub-device-id' type='string' value='0x1c30'/>
        <qemu:property name='driver' type='string' value='vfio-pci-nohotplug'/>
      </qemu:frontend>
    </qemu:device>
  </qemu:override>
</domain>

Link to comment

Does this work?

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>Windows 10</name>
  <uuid>e625f9bd-9c40-f9f3-2c61-be464c8e742d</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="windows.png" os="windows10"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>10</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='10'/>
    <vcpupin vcpu='2' cpuset='1'/>
    <vcpupin vcpu='3' cpuset='11'/>
    <vcpupin vcpu='4' cpuset='2'/>
    <vcpupin vcpu='5' cpuset='12'/>
    <vcpupin vcpu='6' cpuset='3'/>
    <vcpupin vcpu='7' cpuset='13'/>
    <vcpupin vcpu='8' cpuset='4'/>
    <vcpupin vcpu='9' cpuset='14'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-7.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/e625f9bd-9c40-f9f3-2c61-be464c8e742d_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv mode='custom'>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
      <vendor_id state='on' value='none'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='5' threads='2'/>
    <cache mode='passthrough'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Windows 10/vdisk1.img'/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/cn_windows_10_multiple_editions_x64_dvd_6848463.iso'/>
      <target dev='hda' bus='sata'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/virtio-win-0.1.190-1.iso'/>
      <target dev='hdb' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x8'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x9'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0xa'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0x14'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0xb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
    </controller>
    <controller type='pci' index='7' model='pcie-to-pci-bridge'>
      <model name='pcie-pci-bridge'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:ab:8f:a2'/>
      <source bridge='br1'/>
      <model type='virtio-net'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0' keymap='en-us'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <audio id='1' type='none'/>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x01' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='off'>
      <source>
        <address uuid='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
      </source>
      <alias name='ua-mdev'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </memballoon>
  </devices>
  <qemu:override>
    <qemu:device alias='ua-mdev'>
      <qemu:frontend>
        <qemu:property name='x-pci-vendor-id' type='string' value='0x10DE'/>
        <qemu:property name='x-pci-device-id' type='string' value='0x1c30'/>
        <qemu:property name='x-pci-sub-vendor-id' type='string' value='0x10DE'/>
        <qemu:property name='x-pci-sub-device-id' type='string' value='0x1c30'/>
        <qemu:property name='driver' type='string' value='vfio-pci-nohotplug'/>
      </qemu:frontend>
    </qemu:device>
  </qemu:override>
  <qemu:commandline>
    <qemu:arg value='-uuid'/>
    <qemu:arg value='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
  </qemu:commandline> 
</domain>

 

Link to comment
10 hours ago, ghost82 said:

Does this work?

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>Windows 10</name>
  <uuid>e625f9bd-9c40-f9f3-2c61-be464c8e742d</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="windows.png" os="windows10"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>10</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='10'/>
    <vcpupin vcpu='2' cpuset='1'/>
    <vcpupin vcpu='3' cpuset='11'/>
    <vcpupin vcpu='4' cpuset='2'/>
    <vcpupin vcpu='5' cpuset='12'/>
    <vcpupin vcpu='6' cpuset='3'/>
    <vcpupin vcpu='7' cpuset='13'/>
    <vcpupin vcpu='8' cpuset='4'/>
    <vcpupin vcpu='9' cpuset='14'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-7.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/e625f9bd-9c40-f9f3-2c61-be464c8e742d_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv mode='custom'>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
      <vendor_id state='on' value='none'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='5' threads='2'/>
    <cache mode='passthrough'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Windows 10/vdisk1.img'/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/cn_windows_10_multiple_editions_x64_dvd_6848463.iso'/>
      <target dev='hda' bus='sata'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/virtio-win-0.1.190-1.iso'/>
      <target dev='hdb' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x8'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x9'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0xa'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0x14'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0xb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
    </controller>
    <controller type='pci' index='7' model='pcie-to-pci-bridge'>
      <model name='pcie-pci-bridge'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:ab:8f:a2'/>
      <source bridge='br1'/>
      <model type='virtio-net'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0' keymap='en-us'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <audio id='1' type='none'/>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x01' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='off'>
      <source>
        <address uuid='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
      </source>
      <alias name='ua-mdev'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </memballoon>
  </devices>
  <qemu:override>
    <qemu:device alias='ua-mdev'>
      <qemu:frontend>
        <qemu:property name='x-pci-vendor-id' type='string' value='0x10DE'/>
        <qemu:property name='x-pci-device-id' type='string' value='0x1c30'/>
        <qemu:property name='x-pci-sub-vendor-id' type='string' value='0x10DE'/>
        <qemu:property name='x-pci-sub-device-id' type='string' value='0x1c30'/>
        <qemu:property name='driver' type='string' value='vfio-pci-nohotplug'/>
      </qemu:frontend>
    </qemu:device>
  </qemu:override>
  <qemu:commandline>
    <qemu:arg value='-uuid'/>
    <qemu:arg value='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
  </qemu:commandline> 
</domain>

 

Thank you for your reply, but it still doesn't work, and the error message is as follows.

 

I'll keep trying and get in touch with you if there's any progress.

 

Thanks again for your assistance.

 

 

internal error: qemu unexpectedly closed the monitor: qxl_send_events: spice-server bug: guest stopped, ignoring 2023-04-05T02:47:36.390997Z qemu-system-x86_64: -device {"id":"ua-mdev","sysfsdev":"/sys/bus/mdev/devices/0e007852-f5bb-42b9-8b13-9fde963cf217","display":"off","bus":"pcie.0","addr":"0x9","x-pci-vendor-id":"0x10DE","x-pci-device-id":"0x1c30","x-pci-sub-vendor-id":"0x10DE","x-pci-sub-device-id":"0x1c30","driver":"vfio-pci-nohotplug"}: Parameter 'x-pci-device-id' expects uint64

Link to comment
3 hours ago, sijicha said:

Parameter 'x-pci-device-id' expects uint64

My fault, x-pci-..... properties are expected to be unsigned integers, not strings, so this should be correct as far as the syntax:

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>Windows 10</name>
  <uuid>e625f9bd-9c40-f9f3-2c61-be464c8e742d</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="windows.png" os="windows10"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>10</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='10'/>
    <vcpupin vcpu='2' cpuset='1'/>
    <vcpupin vcpu='3' cpuset='11'/>
    <vcpupin vcpu='4' cpuset='2'/>
    <vcpupin vcpu='5' cpuset='12'/>
    <vcpupin vcpu='6' cpuset='3'/>
    <vcpupin vcpu='7' cpuset='13'/>
    <vcpupin vcpu='8' cpuset='4'/>
    <vcpupin vcpu='9' cpuset='14'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-7.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/e625f9bd-9c40-f9f3-2c61-be464c8e742d_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv mode='custom'>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
      <vendor_id state='on' value='none'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='5' threads='2'/>
    <cache mode='passthrough'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Windows 10/vdisk1.img'/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/cn_windows_10_multiple_editions_x64_dvd_6848463.iso'/>
      <target dev='hda' bus='sata'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/virtio-win-0.1.190-1.iso'/>
      <target dev='hdb' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x8'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x9'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0xa'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0x14'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0xb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
    </controller>
    <controller type='pci' index='7' model='pcie-to-pci-bridge'>
      <model name='pcie-pci-bridge'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:ab:8f:a2'/>
      <source bridge='br1'/>
      <model type='virtio-net'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0' keymap='en-us'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <audio id='1' type='none'/>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x01' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='off'>
      <source>
        <address uuid='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
      </source>
      <alias name='ua-mdev'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </memballoon>
  </devices>
  <qemu:override>
    <qemu:device alias='ua-mdev'>
      <qemu:frontend>
        <qemu:property name='x-pci-vendor-id' type='unsigned' value='4318'/>
        <qemu:property name='x-pci-device-id' type='unsigned' value='7216'/>
        <qemu:property name='x-pci-sub-vendor-id' type='unsigned' value='4318'/>
        <qemu:property name='x-pci-sub-device-id' type='unsigned' value='7216'/>
        <qemu:property name='driver' type='string' value='vfio-pci-nohotplug'/>
      </qemu:frontend>
    </qemu:device>
  </qemu:override>
  <qemu:commandline>
    <qemu:arg value='-uuid'/>
    <qemu:arg value='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
  </qemu:commandline> 
</domain>

 

4318/7216 are simply the result of a conversion from hex to decimal.

Link to comment
3 hours ago, ghost82 said:

My fault, x-pci-..... properties are expected to be unsigned integers, not strings, so this should be correct as far as the syntax:

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>Windows 10</name>
  <uuid>e625f9bd-9c40-f9f3-2c61-be464c8e742d</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="windows.png" os="windows10"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>10</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='10'/>
    <vcpupin vcpu='2' cpuset='1'/>
    <vcpupin vcpu='3' cpuset='11'/>
    <vcpupin vcpu='4' cpuset='2'/>
    <vcpupin vcpu='5' cpuset='12'/>
    <vcpupin vcpu='6' cpuset='3'/>
    <vcpupin vcpu='7' cpuset='13'/>
    <vcpupin vcpu='8' cpuset='4'/>
    <vcpupin vcpu='9' cpuset='14'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-7.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/e625f9bd-9c40-f9f3-2c61-be464c8e742d_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv mode='custom'>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
      <vendor_id state='on' value='none'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='5' threads='2'/>
    <cache mode='passthrough'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Windows 10/vdisk1.img'/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/cn_windows_10_multiple_editions_x64_dvd_6848463.iso'/>
      <target dev='hda' bus='sata'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/virtio-win-0.1.190-1.iso'/>
      <target dev='hdb' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x8'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x9'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0xa'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0x14'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0xb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
    </controller>
    <controller type='pci' index='7' model='pcie-to-pci-bridge'>
      <model name='pcie-pci-bridge'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:ab:8f:a2'/>
      <source bridge='br1'/>
      <model type='virtio-net'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0' keymap='en-us'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <audio id='1' type='none'/>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x01' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='off'>
      <source>
        <address uuid='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
      </source>
      <alias name='ua-mdev'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </memballoon>
  </devices>
  <qemu:override>
    <qemu:device alias='ua-mdev'>
      <qemu:frontend>
        <qemu:property name='x-pci-vendor-id' type='unsigned' value='4318'/>
        <qemu:property name='x-pci-device-id' type='unsigned' value='7216'/>
        <qemu:property name='x-pci-sub-vendor-id' type='unsigned' value='4318'/>
        <qemu:property name='x-pci-sub-device-id' type='unsigned' value='7216'/>
        <qemu:property name='driver' type='string' value='vfio-pci-nohotplug'/>
      </qemu:frontend>
    </qemu:device>
  </qemu:override>
  <qemu:commandline>
    <qemu:arg value='-uuid'/>
    <qemu:arg value='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
  </qemu:commandline> 
</domain>

 

4318/7216 are simply the result of a conversion from hex to decimal.

This is my virtual machine log for reference

 

text  error  warn  system  array  login  

-blockdev '{"node-name":"libvirt-2-format","read-only":true,"driver":"raw","file":"libvirt-2-storage"}' \
-device '{"driver":"ide-cd","bus":"ide.0","drive":"libvirt-2-format","id":"sata0-0-0","bootindex":2}' \
-blockdev '{"driver":"file","filename":"/mnt/user/isos/virtio-win-0.1.190-1.iso","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-1-format","read-only":true,"driver":"raw","file":"libvirt-1-storage"}' \
-device '{"driver":"ide-cd","bus":"ide.1","drive":"libvirt-1-format","id":"sata0-0-1"}' \
-netdev tap,fd=37,id=hostnet0 \
-device '{"driver":"virtio-net","netdev":"hostnet0","id":"net0","mac":"52:54:00:ab:8f:a2","bus":"pci.3","addr":"0x0"}' \
-chardev pty,id=charserial0 \
-device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
-chardev socket,id=charchannel0,fd=35,server=on,wait=off \
-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":1,"chardev":"charchannel0","id":"channel0","name":"org.qemu.guest_agent.0"}' \
-device '{"driver":"usb-tablet","id":"input0","bus":"usb.0","port":"1"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
-vnc 0.0.0.0:0,websocket=5700,audiodev=audio1 \
-k en-us \
-device '{"driver":"qxl-vga","id":"video0","max_outputs":1,"ram_size":67108864,"vram_size":67108864,"vram64_size_mb":0,"vgamem_mb":16,"bus":"pci.7","addr":"0x1"}' \
-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.5","addr":"0x0"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
char device redirected to /dev/pts/1 (label charserial0)
2023-04-05T09:08:57.926146Z qemu-system-x86_64: -device {"driver":"pcie-pci-bridge","id":"pci.7","bus":"pci.1","addr":"0x0"}: Bus 'pci.1' not found
2023-04-05 09:08:57.966+0000: shutting down, reason=failed
2023-04-05 09:09:50.716+0000: starting up libvirt version: 8.7.0, qemu version: 7.1.0, kernel: 5.19.17-Unraid, hostname: Tower
LC_ALL=C \
PATH=/bin:/sbin:/usr/bin:/usr/sbin \
HOME='/var/lib/libvirt/qemu/domain-15-Windows 10' \
XDG_DATA_HOME='/var/lib/libvirt/qemu/domain-15-Windows 10/.local/share' \
XDG_CACHE_HOME='/var/lib/libvirt/qemu/domain-15-Windows 10/.cache' \
XDG_CONFIG_HOME='/var/lib/libvirt/qemu/domain-15-Windows 10/.config' \
/usr/local/sbin/qemu \
-name 'guest=Windows 10,debug-threads=on' \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain-15-Windows 10/master-key.aes"}' \
-blockdev '{"driver":"file","filename":"/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
-blockdev '{"driver":"file","filename":"/etc/libvirt/qemu/nvram/e625f9bd-9c40-f9f3-2c61-be464c8e742d_VARS-pure-efi.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
-machine pc-q35-7.1,usb=off,dump-guest-core=off,mem-merge=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
-accel kvm \
-cpu host,migratable=on,hv-time=on,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0x1fff,hv-vendor-id=none,host-cache-info=on,l3-cache=off \
-m 8192 \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":8589934592}' \
-overcommit mem-lock=off \
-smp 10,sockets=1,dies=1,cores=5,threads=2 \
-uuid e625f9bd-9c40-f9f3-2c61-be464c8e742d \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=36,server=on,wait=off \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=localtime \
-no-hpet \
-no-shutdown \
-boot strict=on \
-device '{"driver":"pcie-root-port","port":8,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x1"}' \
-device '{"driver":"pcie-root-port","port":9,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x1.0x1"}' \
-device '{"driver":"pcie-root-port","port":10,"chassis":3,"id":"pci.3","bus":"pcie.0","addr":"0x1.0x2"}' \
-device '{"driver":"pcie-root-port","port":19,"chassis":4,"id":"pci.4","bus":"pcie.0","addr":"0x2.0x3"}' \
-device '{"driver":"pcie-root-port","port":20,"chassis":5,"id":"pci.5","bus":"pcie.0","addr":"0x2.0x4"}' \
-device '{"driver":"pcie-root-port","port":11,"chassis":6,"id":"pci.6","bus":"pcie.0","addr":"0x1.0x3"}' \
-device '{"driver":"pcie-pci-bridge","id":"pci.7","bus":"pci.1","addr":"0x0"}' \
-device '{"driver":"ich9-usb-ehci1","id":"usb","bus":"pcie.0","addr":"0x7.0x7"}' \
-device '{"driver":"ich9-usb-uhci1","masterbus":"usb.0","firstport":0,"bus":"pcie.0","multifunction":true,"addr":"0x7"}' \
-device '{"driver":"ich9-usb-uhci2","masterbus":"usb.0","firstport":2,"bus":"pcie.0","addr":"0x7.0x1"}' \
-device '{"driver":"ich9-usb-uhci3","masterbus":"usb.0","firstport":4,"bus":"pcie.0","addr":"0x7.0x2"}' \
-device '{"driver":"virtio-serial-pci","id":"virtio-serial0","bus":"pci.2","addr":"0x0"}' \
-blockdev '{"driver":"file","filename":"/mnt/user/domains/Windows 10/vdisk1.img","node-name":"libvirt-3-storage","cache":{"direct":false,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-3-format","read-only":false,"cache":{"direct":false,"no-flush":false},"driver":"raw","file":"libvirt-3-storage"}' \
-device '{"driver":"virtio-blk-pci","bus":"pci.4","addr":"0x0","drive":"libvirt-3-format","id":"virtio-disk2","bootindex":1,"write-cache":"on"}' \
-blockdev '{"driver":"file","filename":"/mnt/user/isos/cn_windows_10_multiple_editions_x64_dvd_6848463.iso","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-2-format","read-only":true,"driver":"raw","file":"libvirt-2-storage"}' \
-device '{"driver":"ide-cd","bus":"ide.0","drive":"libvirt-2-format","id":"sata0-0-0","bootindex":2}' \
-blockdev '{"driver":"file","filename":"/mnt/user/isos/virtio-win-0.1.190-1.iso","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-1-format","read-only":true,"driver":"raw","file":"libvirt-1-storage"}' \
-device '{"driver":"ide-cd","bus":"ide.1","drive":"libvirt-1-format","id":"sata0-0-1"}' \
-netdev tap,fd=37,id=hostnet0 \
-device '{"driver":"virtio-net","netdev":"hostnet0","id":"net0","mac":"52:54:00:ab:8f:a2","bus":"pci.3","addr":"0x0"}' \
-chardev pty,id=charserial0 \
-device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
-chardev socket,id=charchannel0,fd=35,server=on,wait=off \
-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":1,"chardev":"charchannel0","id":"channel0","name":"org.qemu.guest_agent.0"}' \
-device '{"driver":"usb-tablet","id":"input0","bus":"usb.0","port":"1"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
-vnc 0.0.0.0:0,websocket=5700,audiodev=audio1 \
-k en-us \
-device '{"driver":"qxl-vga","id":"video0","max_outputs":1,"ram_size":67108864,"vram_size":67108864,"vram64_size_mb":0,"vgamem_mb":16,"bus":"pci.7","addr":"0x1"}' \
-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.5","addr":"0x0"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
char device redirected to /dev/pts/1 (label charserial0)
qxl_send_events: spice-server bug: guest stopped, ignoring

Link to comment
3 hours ago, ghost82 said:

My fault, x-pci-..... properties are expected to be unsigned integers, not strings, so this should be correct as far as the syntax:

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>Windows 10</name>
  <uuid>e625f9bd-9c40-f9f3-2c61-be464c8e742d</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="windows.png" os="windows10"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>10</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='10'/>
    <vcpupin vcpu='2' cpuset='1'/>
    <vcpupin vcpu='3' cpuset='11'/>
    <vcpupin vcpu='4' cpuset='2'/>
    <vcpupin vcpu='5' cpuset='12'/>
    <vcpupin vcpu='6' cpuset='3'/>
    <vcpupin vcpu='7' cpuset='13'/>
    <vcpupin vcpu='8' cpuset='4'/>
    <vcpupin vcpu='9' cpuset='14'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-7.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/e625f9bd-9c40-f9f3-2c61-be464c8e742d_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv mode='custom'>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
      <vendor_id state='on' value='none'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='5' threads='2'/>
    <cache mode='passthrough'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Windows 10/vdisk1.img'/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/cn_windows_10_multiple_editions_x64_dvd_6848463.iso'/>
      <target dev='hda' bus='sata'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/virtio-win-0.1.190-1.iso'/>
      <target dev='hdb' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x8'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x9'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0xa'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0x14'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0xb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
    </controller>
    <controller type='pci' index='7' model='pcie-to-pci-bridge'>
      <model name='pcie-pci-bridge'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:ab:8f:a2'/>
      <source bridge='br1'/>
      <model type='virtio-net'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0' keymap='en-us'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <audio id='1' type='none'/>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x01' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='off'>
      <source>
        <address uuid='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
      </source>
      <alias name='ua-mdev'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </memballoon>
  </devices>
  <qemu:override>
    <qemu:device alias='ua-mdev'>
      <qemu:frontend>
        <qemu:property name='x-pci-vendor-id' type='unsigned' value='4318'/>
        <qemu:property name='x-pci-device-id' type='unsigned' value='7216'/>
        <qemu:property name='x-pci-sub-vendor-id' type='unsigned' value='4318'/>
        <qemu:property name='x-pci-sub-device-id' type='unsigned' value='7216'/>
        <qemu:property name='driver' type='string' value='vfio-pci-nohotplug'/>
      </qemu:frontend>
    </qemu:device>
  </qemu:override>
  <qemu:commandline>
    <qemu:arg value='-uuid'/>
    <qemu:arg value='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
  </qemu:commandline> 
</domain>

 

4318/7216 are simply the result of a conversion from hex to decimal.

I wrote the following reply before the log, but unfortunately it seems that they were lost due to network reasons, so this passage is actually before the virtual machine log😟.

 

Hi!

 

I tried your code and this time the virtual machine booted successfully but there was a problem with vnc not working (guest has not initialized the display (yet)).

 

I want to log in through windows remote desktop, but unfortunately I found that I forgot to open the remote desktop permission (in addition, I don't know the feasibility of using remote desktop without installing the driver).

 

After that, I deleted the code related to the virtual graphics card, and the problem still exists. I found this post in the forum

 

the solution is to change the bus value. But I didn't fix it because of my poor technique.

(During this process, I used text comparison software, only to realize that you changed so much code, almost refactored the code, thank you very much!🙂)

 

Next, I will try to use the initial code to open the remote desktop permission through vnc to see if I can log in to the device without using vnc.

 

Regarding my personal curiosity, I see that you have added aliases under each device, but you have not called them in other places. Is this because of any technical specifications?

 

Looking forward to your reply, best wishes!

Link to comment
On 4/5/2023 at 2:25 PM, ghost82 said:

My fault, x-pci-..... properties are expected to be unsigned integers, not strings, so this should be correct as far as the syntax:

 

4318/7216 are simply the result of a conversion from hex to decimal.

HI!

I tried connecting to the device via remote desktop, but it failed.

Although the virtual machine is running in unraid, I found that it is not online in the dhcp server. The network does not work either.

The following is the log of the virtual machine for reference.

Best wish!

-device '{"driver":"ide-cd","bus":"ide.1","drive":"libvirt-1-format","id":"sata0-0-1"}' \
-netdev tap,fd=37,id=hostnet0 \
-device '{"driver":"virtio-net","netdev":"hostnet0","id":"net0","mac":"52:54:00:e4:ef:ed","bus":"pci.1","addr":"0x0"}' \
-chardev pty,id=charserial0 \
-device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
-chardev socket,id=charchannel0,fd=35,server=on,wait=off \
-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":1,"chardev":"charchannel0","id":"channel0","name":"org.qemu.guest_agent.0"}' \
-device '{"driver":"usb-tablet","id":"input0","bus":"usb.0","port":"1"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
-vnc 0.0.0.0:0,websocket=5700,audiodev=audio1 \
-k en-us \
-device '{"driver":"qxl-vga","id":"video0","max_outputs":1,"ram_size":67108864,"vram_size":67108864,"vram64_size_mb":0,"vgamem_mb":16,"bus":"pcie.0","addr":"0x1"}' \
-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.4","addr":"0x0"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
char device redirected to /dev/pts/1 (label charserial0)
qxl_send_events: spice-server bug: guest stopped, ignoring
2023-04-06T15:34:04.593121Z qemu-system-x86_64: terminating on signal 15 from pid 7564 (/usr/sbin/libvirtd)
2023-04-06 15:34:05.595+0000: shutting down, reason=destroyed
2023-04-06 15:34:28.882+0000: starting up libvirt version: 8.7.0, qemu version: 7.1.0, kernel: 5.19.17-Unraid, hostname: Tower
LC_ALL=C \
PATH=/bin:/sbin:/usr/bin:/usr/sbin \
HOME='/var/lib/libvirt/qemu/domain-22-Windows 10' \
XDG_DATA_HOME='/var/lib/libvirt/qemu/domain-22-Windows 10/.local/share' \
XDG_CACHE_HOME='/var/lib/libvirt/qemu/domain-22-Windows 10/.cache' \
XDG_CONFIG_HOME='/var/lib/libvirt/qemu/domain-22-Windows 10/.config' \
/usr/local/sbin/qemu \
-name 'guest=Windows 10,debug-threads=on' \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain-22-Windows 10/master-key.aes"}' \
-blockdev '{"driver":"file","filename":"/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
-blockdev '{"driver":"file","filename":"/etc/libvirt/qemu/nvram/f6bf0e86-96ab-67fe-9235-34df54611e1a_VARS-pure-efi.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
-machine pc-q35-7.1,usb=off,dump-guest-core=off,mem-merge=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
-accel kvm \
-cpu host,migratable=on,hv-time=on,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0x1fff,hv-vendor-id=none,host-cache-info=on,l3-cache=off \
-m 8192 \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":8589934592}' \
-overcommit mem-lock=off \
-smp 10,sockets=1,dies=1,cores=5,threads=2 \
-uuid f6bf0e86-96ab-67fe-9235-34df54611e1a \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=36,server=on,wait=off \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=localtime \
-no-hpet \
-no-shutdown \
-boot strict=on \
-device '{"driver":"pcie-root-port","port":8,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x1"}' \
-device '{"driver":"pcie-root-port","port":9,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x1.0x1"}' \
-device '{"driver":"pcie-root-port","port":10,"chassis":3,"id":"pci.3","bus":"pcie.0","addr":"0x1.0x2"}' \
-device '{"driver":"pcie-root-port","port":19,"chassis":4,"id":"pci.4","bus":"pcie.0","addr":"0x2.0x3"}' \
-device '{"driver":"pcie-root-port","port":20,"chassis":5,"id":"pci.5","bus":"pcie.0","addr":"0x2.0x4"}' \
-device '{"driver":"pcie-root-port","port":11,"chassis":6,"id":"pci.6","bus":"pcie.0","addr":"0x1.0x3"}' \
-device '{"driver":"pcie-pci-bridge","id":"pci.7","bus":"pci.1","addr":"0x0"}' \
-device '{"driver":"ich9-usb-ehci1","id":"usb","bus":"pcie.0","addr":"0x7.0x7"}' \
-device '{"driver":"ich9-usb-uhci1","masterbus":"usb.0","firstport":0,"bus":"pcie.0","multifunction":true,"addr":"0x7"}' \
-device '{"driver":"ich9-usb-uhci2","masterbus":"usb.0","firstport":2,"bus":"pcie.0","addr":"0x7.0x1"}' \
-device '{"driver":"ich9-usb-uhci3","masterbus":"usb.0","firstport":4,"bus":"pcie.0","addr":"0x7.0x2"}' \
-device '{"driver":"virtio-serial-pci","id":"virtio-serial0","bus":"pci.2","addr":"0x0"}' \
-blockdev '{"driver":"file","filename":"/mnt/user/domains/Windows 10/vdisk1.img","node-name":"libvirt-3-storage","cache":{"direct":false,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-3-format","read-only":false,"cache":{"direct":false,"no-flush":false},"driver":"raw","file":"libvirt-3-storage"}' \
-device '{"driver":"virtio-blk-pci","bus":"pci.4","addr":"0x0","drive":"libvirt-3-format","id":"virtio-disk2","bootindex":1,"write-cache":"on"}' \
-blockdev '{"driver":"file","filename":"/mnt/user/isos/cn_windows_10_multiple_editions_x64_dvd_6848463.iso","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-2-format","read-only":true,"driver":"raw","file":"libvirt-2-storage"}' \
-device '{"driver":"ide-cd","bus":"ide.0","drive":"libvirt-2-format","id":"sata0-0-0","bootindex":2}' \
-blockdev '{"driver":"file","filename":"/mnt/user/isos/virtio-win-0.1.190-1.iso","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-1-format","read-only":true,"driver":"raw","file":"libvirt-1-storage"}' \
-device '{"driver":"ide-cd","bus":"ide.1","drive":"libvirt-1-format","id":"sata0-0-1"}' \
-netdev tap,fd=37,id=hostnet0 \
-device '{"driver":"virtio-net","netdev":"hostnet0","id":"net0","mac":"52:54:00:ab:8f:a2","bus":"pci.3","addr":"0x0"}' \
-chardev pty,id=charserial0 \
-device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
-chardev socket,id=charchannel0,fd=35,server=on,wait=off \
-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":1,"chardev":"charchannel0","id":"channel0","name":"org.qemu.guest_agent.0"}' \
-device '{"driver":"usb-tablet","id":"input0","bus":"usb.0","port":"1"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
-vnc 0.0.0.0:0,websocket=5700,audiodev=audio1 \
-k en-us \
-device '{"driver":"qxl-vga","id":"video0","max_outputs":1,"ram_size":67108864,"vram_size":67108864,"vram64_size_mb":0,"vgamem_mb":16,"bus":"pci.7","addr":"0x1"}' \
-device '{"id":"ua-mdev","sysfsdev":"/sys/bus/mdev/devices/0e007852-f5bb-42b9-8b13-9fde963cf217","display":"off","bus":"pcie.0","addr":"0x9","x-pci-vendor-id":4318,"x-pci-device-id":7216,"x-pci-sub-vendor-id":4318,"x-pci-sub-device-id":7216,"driver":"vfio-pci-nohotplug"}' \
-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.5","addr":"0x0"}' \
-uuid 0e007852-f5bb-42b9-8b13-9fde963cf217 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
char device redirected to /dev/pts/1 (label charserial0)
qxl_send_events: spice-server bug: guest stopped, ignoring
2023-04-06T15:34:29.012492Z qemu-system-x86_64: -device {"id":"ua-mdev","sysfsdev":"/sys/bus/mdev/devices/0e007852-f5bb-42b9-8b13-9fde963cf217","display":"off","bus":"pcie.0","addr":"0x9","x-pci-vendor-id":4318,"x-pci-device-id":7216,"x-pci-sub-vendor-id":4318,"x-pci-sub-device-id":7216,"driver":"vfio-pci-nohotplug"}: warning: vfio 0e007852-f5bb-42b9-8b13-9fde963cf217: Could not enable error recovery for the device

 

Link to comment

I can only speak about correct syntax in the xml, I understood what you want to achieve but I don't know how to do it.

I can suggest to change the target address of the mdev device and of the qxl video, so you could connect again with the built in vnc (delete cache in the browser).

 

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>Windows 10</name>
  <uuid>e625f9bd-9c40-f9f3-2c61-be464c8e742d</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="windows.png" os="windows10"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>10</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='10'/>
    <vcpupin vcpu='2' cpuset='1'/>
    <vcpupin vcpu='3' cpuset='11'/>
    <vcpupin vcpu='4' cpuset='2'/>
    <vcpupin vcpu='5' cpuset='12'/>
    <vcpupin vcpu='6' cpuset='3'/>
    <vcpupin vcpu='7' cpuset='13'/>
    <vcpupin vcpu='8' cpuset='4'/>
    <vcpupin vcpu='9' cpuset='14'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-7.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/e625f9bd-9c40-f9f3-2c61-be464c8e742d_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv mode='custom'>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
      <vendor_id state='on' value='none'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='5' threads='2'/>
    <cache mode='passthrough'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Windows 10/vdisk1.img'/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/cn_windows_10_multiple_editions_x64_dvd_6848463.iso'/>
      <target dev='hda' bus='sata'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/virtio-win-0.1.190-1.iso'/>
      <target dev='hdb' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x8'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x9'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0xa'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0x14'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0xb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
    </controller>
    <controller type='pci' index='7' model='pcie-to-pci-bridge'>
      <model name='pcie-pci-bridge'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:ab:8f:a2'/>
      <source bridge='br1'/>
      <model type='virtio-net'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0' keymap='en-us'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <audio id='1' type='none'/>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='off'>
      <source>
        <address uuid='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
      </source>
      <alias name='ua-mdev'/>
      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </memballoon>
  </devices>
  <qemu:override>
    <qemu:device alias='ua-mdev'>
      <qemu:frontend>
        <qemu:property name='x-pci-vendor-id' type='unsigned' value='4318'/>
        <qemu:property name='x-pci-device-id' type='unsigned' value='7216'/>
        <qemu:property name='x-pci-sub-vendor-id' type='unsigned' value='4318'/>
        <qemu:property name='x-pci-sub-device-id' type='unsigned' value='7216'/>
        <qemu:property name='driver' type='string' value='vfio-pci-nohotplug'/>
      </qemu:frontend>
    </qemu:device>
  </qemu:override>
  <qemu:commandline>
    <qemu:arg value='-uuid'/>
    <qemu:arg value='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
  </qemu:commandline> 
</domain>

 

Link to comment

With a lot of imagination, translating from chinese to my language to understand all the steps, check/confirm that:

 

1. You have a quadro P2000 gpu

2. command 'mdevctl types' returns a list of supported mdev types, including nvidia-65

3. You edited and override the nvidia-65 profile (/etc/vgpu_unlock/profile_override.toml) with the correct pci_id and pci_device_id

4. You generated a unique uuid and you wrote the following lines in '/boot/config/Nvmdev' to start the mdev device:

sleep 5
mdevctl start -u HEREGOESYOURUUID -p HEREGOESYOURSOURCEADDRESS -t nvidia-65

HEREGOESYOURUUID is the uuid

HEREGOESYOURSOURCEADDRESS is the source address of the gpu, in the form 0000:xx:00.0, for example 0000:06:00.0 (source domain:bus:slot.function)

5. The uuid defined in '/boot/config/Nvmdev' is the same set at the bottom of the xml, here:

    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='off'>
      <source>
        <address uuid='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
      </source>
      <alias name='ua-mdev'/>
      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
    </hostdev>
    

 

and here:

  <qemu:commandline>
    <qemu:arg value='-uuid'/>
    <qemu:arg value='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
  </qemu:commandline> 

 

Edited by ghost82
Link to comment
4 hours ago, ghost82 said:

With a lot of imagination, translating from chinese to my language to understand all the steps, check/confirm that:

 

1. You have a quadro P2000 gpu

2. command 'mdevctl types' returns a list of supported mdev types, including nvidia-65

3. You edited and override the nvidia-65 profile (/etc/vgpu_unlock/profile_override.toml) with the correct pci_id and pci_device_id

4. You generated a unique uuid and you wrote the following lines in '/boot/config/Nvmdev' to start the mdev device:

sleep 5
mdevctl start -u HEREGOESYOURUUID -p HEREGOESYOURSOURCEADDRESS -t nvidia-65

HEREGOESYOURUUID is the uuid

HEREGOESYOURSOURCEADDRESS is the source address of the gpu, in the form 0000:xx:00.0, for example 0000:06:00.0 (source domain:bus:slot.function)

5. The uuid defined in '/boot/config/Nvmdev' is the same set at the bottom of the xml, here:

    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='off'>
      <source>
        <address uuid='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
      </source>
      <alias name='ua-mdev'/>
      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
    </hostdev>
    

 

and here:

  <qemu:commandline>
    <qemu:arg value='-uuid'/>
    <qemu:arg value='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
  </qemu:commandline> 

 

Sorry, I saw it when you first replied. But I'm still working because of the time difference, so I'm only replying now.

 

First of all, thank you for using the translation tool to fully understand my intentions.

As you stated, my original intention is the same as yours, to obtain kvm-related support, rather than delusional someone to directly help me complete the problem of graphics card virtualization.

 

I will divide it into two parts next, the first part is the error report of kvm, and the second part is the article about graphics card virtualization.

 

I think there is only one step away from success, and this problem is likely to be in the kvm module. By searching for the error "Could not enable error recovery for the device", I found a post in the pve forum, and he also When the graphics card is virtualized, an error is reported. 

 

https://forum.proxmox.com/threads/problems-with-mdev-instance-creation.86229/

 

The solution is to add a command
args: -uuid 00000000-0000-0000-0000-000000000108

The author of the post said that the problem disappeared after adding it, but this seems to involve some gui interface problems in pve, which I don't quite understand.

 

 

Also regarding your question about the article on graphics card virtualization.
1. The graphics card does not have to be quadro P2000 gpu, the author of that article uses telsa p4.
2. There are many outputs in mdevctl types, I choose nvidia-64 with 2g memory.
3. The author of that article packaged the content related to graphics card virtualization as a plug-in. His follow-up updates are directly updating the plug-in.

 

I suspect that some changes in the new version of unraid may be completed in the plug-in. But the plugin needs his own authorization so I didn't use it.

 

I refer to some articles about virtualization of pve graphics cards in the command, and I also achieved the two problems 3 and 4 you mentioned. But since unraid adding hardware is different than pve, I'm stuck at the last step - adding hardware to the virtual machine (that's why I'm posting).

To sum up, I think the problem now is still on kvm, not my graphics card virtualization configuration. But still thank you for browsing the original article to solve the problem 😀.

 

PS/ One of the reasons why I chose unraid is because it has both the functions of nas and server. I hope that unraid can launch the graphics card virtualization gui option as soon as possible, just like pve, instead of calling it only through xml now. I think this does not violate Nvidia, because Nvidia does not prohibit graphics card virtualization, but prohibits illegal authorization of graphics card virtualization. I am very happy that the virtual machine mod is developing in a simpler direction, such as the new version of the updated virtual machine graphics card option (of course, the virtual machine mod has many more important functions such as snapshots, backups, etc., this is just a fantasy of mine )

 

By the way, I found that the nvidia driver will disappear after the unraid restart and needs to be reinstalled

(but this has nothing to do with kvm, I just write it here so that other people who browse this post can understand this problem, and I may Ask this question in other forums in the community)

 

Best wish!

Link to comment
On 4/8/2023 at 3:57 PM, ghost82 said:

It would be extremely helpful if you describe in details what you did, what is your gpu, pasting also the config files you modified/created. Describe all you did from the beginning, in details.

1. I turned on iommu, and then I used the vgpu driver in this article. https://raw.githubusercontent.com/stl88083365/unraid-nvidia-vgpu/main/nvidia-vgpu-525.60.12-unraid.txz

 

2. After that, you can see the following content in mdevctl types

 

3. Use the following two commands to define the device

mdevctl start -u uuid -p 0000:01:00.0 -t nvidia-64

mdevctl define -u uuid -p 0000:01:00.0 -t nvidia-64

Write vgpu configuration information to /etc/vgpu_unlock/profile_override.toml

 

4. The next step is to insert the device into the virtual machine

 

Because it has been a long time, so there may be some omissions, probably the content is these.

 

Now there is a problem, showing repeated calls to address 0000:01:00.0. I changed function='0x0' in this code to function='0x1'

 <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='off'>
      <source>
        <address uuid='0e007852-f5bb-42b9-8b13-9fde963cf217'/>
      </source>
      <alias name='ua-mdev'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
    </hostdev>

 

After the change, the virtual machine can be started normally, but the error is still reported in the log. Refer to my previous reply.

 

 I think there is only one step away from success, and this problem is likely to be in the kvm module. By searching for the error "Could not enable error recovery for the device", I found a post in the pve forum, and he also When the graphics card is virtualized, an error is reported. 

 

https://forum.proxmox.com/threads/problems-with-mdev-instance-creation.86229/

 

The solution is to add a command
args: -uuid 00000000-0000-0000-0000-000000000108

The author of the post said that the problem disappeared after adding it, but this seems to involve some gui interface problems in pve, which I don't quite understand. 

If this problem can be solved, I think the whole problem should be solved.

 

 

 

 

Link to comment
  • 10 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...