Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

can someone please show me how to manually pass a pci card to a vm through editing the xml

Featured Replies

My successfully bound to vfio pci card after the machine restart does not show up in my Other PCI devices list when building a VM.

how can i manually add it to the xml file ??

here is the card 

 

please and thank you

   

vfio.jpg.048ccf7511f7618b5267a904646b8e20.jpg

Edited by richland007

  • richland007 changed the title to can someone please show me how to manually pass a pci card to a vm through editing the xml

Add an hostdev block, set the source address of the device you want to passthrough, set the target address of the passed through device in the vm, attach the device in the target guest to bus 0 for machine type i440fx, attach the device to bus 0 --> x for machine type q35 (bus 0 in q35 is like a "built-in device", but this is not your case; for q35, if bus is different than 0 check that you have a pcie-root-port with the index number equal to that of the target bus).

 

For a q35 machine the block will be something like this:
 

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x41' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
    </hostdev>

 

1. Your source address is 41:00.0 (bus=41, slot=0, function=0)

2. Target address is 08:00.0 (bus=8, slot=0, function=0)

3. Check that pcie-root-port with index=8 exists:

    <controller type='pci' index='8' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='8' port='0xd' hotplug='off'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x7'/>
    </controller>

-----

For i440fx the block will be something like this:

 

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x41' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </hostdev>

 

1. Your source address is 41:00.0 (bus=41, slot=0, function=0), the same obviously

2. Target address is 00:05.0 (bus=0, slot=5, function=0): i440fx has only bus 0

 

If you get errors like double address in use, or something similar, check that the target address is not already in use by something else, in this case change the bus number (for q35) or the slot number (for i440fx).

Edited by ghost82

  • Author

My man thank you so much for even taking the time to reply to me i will try it as soon as i get home and report back :) 

If you have issues just post the vm xml or better the full diagnostics.

  • Community Expert

do the two usb controll4rs show in pci options?

 

can you provide a screen print of the template options?

Edited by SimonF

  • Author
20 hours ago, ghost82 said:

If you have issues just post the vm xml or better the full diagnostics.

Here is the full VM xml

Quote

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' id='2'>
  <name>Home Assistant</name>
  <uuid>5efce766-c82d-4abb-1d51-e82f1f7c5e4f</uuid>
  <description>Linux VM</description>
  <metadata>
    <vmtemplate xmlns="unraid" name="Linux" icon="default.png" os="linux"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>4</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='8'/>
    <vcpupin vcpu='1' cpuset='28'/>
    <vcpupin vcpu='2' cpuset='9'/>
    <vcpupin vcpu='3' cpuset='29'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-6.0'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/5efce766-c82d-4abb-1d51-e82f1f7c5e4f_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='2' threads='2'/>
    <cache mode='passthrough'/>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <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='qcow2' cache='writeback'/>
      <source file='/mnt/user/domains/HassOS/haos_ova-7.1.qcow2' index='1'/>
      <backingStore/>
      <target dev='hdc' bus='sata'/>
      <boot order='1'/>
      <alias name='sata0-0-2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x10'/>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x11'/>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0x12'/>
      <alias name='pci.3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <alias name='pci.4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='usb' index='0' model='qemu-xhci' ports='15'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:a7:e7:9e'/>
      <source bridge='br0'/>
      <target dev='vnet1'/>
      <model type='virtio-net'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/1'/>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/1'>
      <source path='/dev/pts/1'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-2-Home Assistant/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='connected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'>
      <alias name='input1'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input2'/>
    </input>
    <graphics type='vnc' port='5900' autoport='yes' websocket='5700' 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'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x10d5'/>
        <product id='0x5000'/>
        <address bus='1' device='5'/>
      </source>
      <alias name='hostdev0'/>
      <address type='usb' bus='0' port='3'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x43' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev1'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </hostdev>
    <memballoon model='none'/>
  </devices>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+0:+100</label>
    <imagelabel>+0:+100</imagelabel>
  </seclabel>
</domain>

 Here is also the full diagnostics zip

 

Thank you thank you

predator-diagnostics-20221008-1115.zip

  • Author
20 hours ago, SimonF said:

do the two usb controll4rs show in pci options?

 

can you provide a screen print of the template options?

The two USB cards are passed beautifully to the VMs one for the Home Assistant VM and One for a Windows VM ...they are working just fine 

logvfio.jpg.eebc58d5ab5275e80464d458895eec62.jpg

otherpcie.jpg.f6feacac0e4ee611a89830be0ca97597.jpg

  • Author
On 10/7/2022 at 3:18 AM, ghost82 said:

Add an hostdev block, set the source address of the device you want to passthrough, set the target address of the passed through device in the vm, attach the device in the target guest to bus 0 for machine type i440fx, attach the device to bus 0 --> x for machine type q35 (bus 0 in q35 is like a "built-in device", but this is not your case; for q35, if bus is different than 0 check that you have a pcie-root-port with the index number equal to that of the target bus).

 

For a q35 machine the block will be something like this:
 

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x41' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
    </hostdev>

 

1. Your source address is 41:00.0 (bus=41, slot=0, function=0)

2. Target address is 08:00.0 (bus=8, slot=0, function=0)

3. Check that pcie-root-port with index=8 exists:

    <controller type='pci' index='8' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='8' port='0xd' hotplug='off'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x7'/>
    </controller>

-----

For i440fx the block will be something like this:

 

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x41' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </hostdev>

 

1. Your source address is 41:00.0 (bus=41, slot=0, function=0), the same obviously

2. Target address is 00:05.0 (bus=0, slot=5, function=0): i440fx has only bus 0

 

If you get errors like double address in use, or something similar, check that the target address is not already in use by something else, in this case change the bus number (for q35) or the slot number (for i440fx).

 

The VM is a Q35 Machine but i am not sure on how to  3. Check that pcie-root-port with index=8 exists:

 

Thank you

  • Author
4 minutes ago, SimonF said:

If you could attach a copy of this 

 

lspci -m -nn

 

 

I will have a look to see why it is not picking up pci device.

 

here it is i attached as a text file 

lspci.txt

  • Author
15 minutes ago, SimonF said:

Anything with type starting 08 is blacklisted hence why it doesn't show in pci devs

The server is a Dell R720xd if that matters how do we un-blacklist the type 08??....i dont even know what blacklisted PCI device means :)

  • Community Expert
28 minutes ago, richland007 said:

The server is a Dell R720xd if that matters how do we un-blacklist the type 08??....i dont even know what blacklisted PCI device means :)

Its just the way devices are excluded from the list. Any type starting with the number below are not shown.

 

$arrBlacklistClassIDregex = '/^(05|06|08|0a|0b|0c05)/'

 

i.e. 08 is system devices.  There is not a simple way to un blacklist but should be able to add via XML.

 

3f:0f.0 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Target Address/Thermal Registers [0ea8]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Target Address/Thermal Registers [0000]"
3f:0f.1 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 RAS Registers [0e71]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 RAS Registers [0000]"
3f:0f.2 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers [0eaa]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers [0000]"
3f:0f.3 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers [0eab]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers [0000]"
3f:0f.4 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers [0eac]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers [0000]"
3f:0f.5 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers [0ead]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers [0000]"
3f:10.0 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 Thermal Control 0 [0eb0]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 Thermal Control 0 [0000]"
3f:10.1 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 Thermal Control 1 [0eb1]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 Thermal Control 1 [0000]"
3f:10.2 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 ERROR Registers 0 [0eb2]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 ERROR Registers 0 [0000]"
3f:10.3 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 ERROR Registers 1 [0eb3]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 ERROR Registers 1 [0000]"
3f:10.4 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 Thermal Control 2 [0eb4]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 Thermal Control 2 [0000]"
3f:10.5 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 Thermal Control 3 [0eb5]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 Thermal Control 3 [0000]"
3f:10.7 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 ERROR Registers 3 [0eb7]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 ERROR Registers 3 [0000]"
3f:13.0 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe [0e1d]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe [0000]"
3f:13.1 "Performance counters [1101]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe [0e34]" -r04 -p00 "Dell [1028]" "Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe [0528]"
3f:13.4 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 QPI Ring Registers [0e81]" -r04 -p00 "Dell [1028]" "Xeon E7 v2/Xeon E5 v2/Core i7 QPI Ring Registers [0528]"
3f:13.5 "Performance counters [1101]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 QPI Ring Performance Ring Monitoring [0e36]" -r04 -p00 "Dell [1028]" "Xeon E7 v2/Xeon E5 v2/Core i7 QPI Ring Performance Ring Monitoring [0528]"
3f:16.0 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 System Address Decoder [0ec8]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 System Address Decoder [0000]"
3f:16.1 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Broadcast Registers [0ec9]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Broadcast Registers [0000]"
3f:16.2 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Broadcast Registers [0eca]" -r04 -p00 "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 Broadcast Registers [0000]"
40:01.0 "PCI bridge [0604]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 1a [0e02]" -r04 -p00 "Dell [1028]" "Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 1a [0528]"
40:02.0 "PCI bridge [0604]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 2a [0e04]" -r04 -p00 "Dell [1028]" "Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 2a [0528]"
40:03.0 "PCI bridge [0604]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 3a [0e08]" -r04 -p00 "Dell [1028]" "Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 3a [0528]"
40:03.2 "PCI bridge [0604]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 3c [0e0a]" -r04 -p00 "Dell [1028]" "Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 3c [0528]"
40:05.0 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 VTd/Memory Map/Misc [0e28]" -r04 -p00 "Dell [1028]" "Xeon E7 v2/Xeon E5 v2/Core i7 VTd/Memory Map/Misc [0528]"
40:05.2 "System peripheral [0880]" "Intel Corporation [8086]" "Xeon E7 v2/Xeon E5 v2/Core i7 IIO RAS [0e2a]" -r04 -p00 "Dell [1028]" "Xeon E7 v2/Xeon E5 v2/Core i7 IIO RAS [0528]"
41:00.0"System peripheral [0880]" "Global Unichip Corp. [1ac1]" "Coral Edge TPU [089a]" -pff "Global Unichip Corp. [1ac1]" "Coral Edge TPU [089a]"
42:00.0 "VGA compatible controller [0300]" "NVIDIA Corporation [10de]" "GP104GL [Quadro P4000] [1bb1]" -ra1 -p00 "Dell [1028]" "GP104GL [Quadro P4000] [11a3]"
42:00.1 "Audio device [0403]" "NVIDIA Corporation [10de]" "GP104 High Definition Audio Controller [10f0]" -ra1 -p00 "Dell [1028]" "GP104 High Definition Audio Controller [11a3]"
43:00.0 "USB controller [0c03]" "Renesas Technology Corp. [1912]" "uPD720202 USB 3.0 Host Controller [0015]" -r02 -p30 "" ""
44:00.0 "USB controller [0c03]" "Renesas Technology Corp. [1912]" "uPD720202 USB 3.0 Host Controller [0015]" -r02 -p30 "" ""

 

  • Author

@SimonF So go i just add this passage to the xml ?

this is what @ghost82 wrote above for a Q35 machine:

 <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x41' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
    </hostdev>

Also is that change persistent in the xml ? or do i have to manually add it every time i restart the VM?

 

Thank you so much for all your efforts

  • Community Expert
18 minutes ago, richland007 said:

@SimonF So go i just add this passage to the xml ?

this is what @ghost82 wrote above for a Q35 machine:

 <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x41' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
    </hostdev>

Also is that change persistent in the xml ? or do i have to manually add it every time i restart the VM?

 

Thank you so much for all your efforts

That does look it should be ok. It will be persistent, but if you make a change via the GUI it may get removed. I would add, switch to GUI mode update some thing and save and see if still in the XML.

15 hours ago, richland007 said:

The VM is a Q35 Machine but i am not sure on how to  3. Check that pcie-root-port with index=8 exists:

Try this:

<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
  virsh edit 5efce766-c82d-4abb-1d51-e82f1f7c5e4f
or other application using the libvirt API.
-->

<domain type='kvm'>
  <name>Home Assistant</name>
  <uuid>5efce766-c82d-4abb-1d51-e82f1f7c5e4f</uuid>
  <description>Linux VM</description>
  <metadata>
    <vmtemplate xmlns="unraid" name="Linux" icon="default.png" os="linux"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>4</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='8'/>
    <vcpupin vcpu='1' cpuset='28'/>
    <vcpupin vcpu='2' cpuset='9'/>
    <vcpupin vcpu='3' cpuset='29'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-6.0'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/5efce766-c82d-4abb-1d51-e82f1f7c5e4f_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='2' threads='2'/>
    <cache mode='passthrough'/>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <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='qcow2' cache='writeback'/>
      <source file='/mnt/user/domains/HassOS/haos_ova-7.1.qcow2'/>
      <target dev='hdc' bus='sata'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </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='0x10'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x11'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0x12'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' 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='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='qemu-xhci' ports='15'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:a7:e7:9e'/>
      <source bridge='br0'/>
      <model type='virtio-net'/>
      <address type='pci' domain='0x0000' bus='0x01' 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='usb' managed='no'>
      <source>
        <vendor id='0x10d5'/>
        <product id='0x5000'/>
      </source>
      <address type='usb' bus='0' port='3'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x43' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x41' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </hostdev>
    <memballoon model='none'/>
  </devices>
</domain>

 

1. Bind to vfio 41:00.0 (already done)

2. Replace the whole xml

3. Start the vm

----

First available target bus different than 0 is 04:

01 in use by br0

02 in use by virtio-serial

03 in use by passed through 43:00.0

 

pcie-root-port with index=4 already in the xml: target bus 04 needs pcie-root-port with index=4

  • 8 months later...

Hello all. Honeslty I am so glad I found this discussion. I am facing the same problem and I understand it is not sustainable to for everyone to upload their xml config for developers and other members to adapt it. I tried to map all the data to build and overcome my own config but I am having issues. would it be possible to get a clear maping table for myself and the rest that will face this? Also would it be possible to whitelist these 08 devices somehow via a env variable in Syslinux configuration?

 

many thanks in advance!

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.