PCI/GPU Passthrough with xen

Paul O'Rorke paul at tracker-software.com
Thu Feb 6 22:20:22 UTC 2020


I know these are mostly gamers but they have a lot of experience doing 
PCI pass though: https://discord.gg/du9ecG

I have found them extremely helpful in the past doing libvirt PCI 
passthough.

*Paul O'Rorke*


On 2020-02-05 10:13 a.m., Jim Fehlig wrote:
> On 2/4/20 1:04 AM, Christoph wrote:
>> this config does not work... why?
>
> Without more details, I don't know why :-). In what way does it "not 
> work"? Does 'virsh create' fail with this config? If so, what is the 
> error? Also check /var/log/libvirt/libxl/libxl-driver.log for any 
> errors emitted during the create process.
>
>> <domain type='xen'>
>>    <name>marax.chao5.int</name>
>>    <uuid>72f8f7cf-d538-41cd-828a-9945b9157719</uuid>
>>    <memory unit='GiB'>32</memory>
>>    <currentMemory unit='GiB'>32</currentMemory>
>>    <vcpu placement='static'>16</vcpu>
>>    <os>
>>      <type arch='x86_64' machine='xenfv'>hvm</type>
>>      <loader type='rom'>/usr/lib/xen/boot/hvmloader</loader>
>>      <boot dev='hd'/>
>>    </os>
>>    <features>
>>      <acpi/>
>>      <apic/>
>>      <pae/>
>>    </features>
>>    <clock offset='localtime'/>
>>    <on_poweroff>destroy</on_poweroff>
>>    <on_reboot>restart</on_reboot>
>>    <on_crash>destroy</on_crash>
>>    <devices>
>> <emulator>/usr/lib/xen/bin/qemu-system-i386</emulator>
>>      <disk type='block' device='disk'>
>>        <driver name='phy' type='raw'/>
>>        <source dev='/dev/mapper/marax_c'/>
>>        <target dev='hda' bus='ide'/>
>>        <address type='drive' controller='0' bus='0' target='0' 
>> unit='0'/>
>>      </disk>
>>      <disk type='file' device='cdrom'>
>>        <driver type='raw'/>
>>        <target dev='hdb' bus='ide'/>
>>        <readonly/>
>>        <address type='drive' controller='0' bus='0' target='0' 
>> unit='1'/>
>>      </disk>
>>      <disk type='block' device='disk'>
>>        <driver name='phy' type='raw'/>
>>        <source dev='/dev/vg_lilith/lv_marax_d'/>
>>        <target dev='hdc' bus='ide'/>
>>        <address type='drive' controller='0' bus='1' target='0' 
>> unit='0'/>
>>      </disk>
>>      <controller type='ide' index='0'/>
>>      <interface type='bridge'>
>>        <mac address='00:16:3e:8c:97:27'/>
>>        <source bridge='xenbr5'/>
>>        <model type='e1000'/>
>>      </interface>
>>      <serial type='pty'>
>>        <target port='0'/>
>>      </serial>
>>      <console type='pty'>
>>        <target type='serial' port='0'/>
>>      </console>
>>      <input type='tablet' bus='usb'/>
>>      <input type='mouse' bus='ps2'/>
>>      <input type='keyboard' bus='ps2'/>
>>      <graphics type='vnc' port='5900' autoport='no' listen='0.0.0.0'
>> keymap='de'>
>>        <listen type='address' address='0.0.0.0'/>
>>      </graphics>
>>      <video>
>>        <model type='xen' vram='16384' heads='1' primary='yes'/>
>>      </video>
>>      <hostdev mode='subsystem' type='pci' managed='yes'>
>>        <driver name='xen'/>
>>        <source>
>>          <address domain='0x0000' bus='0x01' slot='0x00' 
>> function='0x0'/>
>>        </source>
>>      </hostdev>
>
> For debugging purposes try to passthrough only one device. Once that 
> is working you can add the other devices.
>
> Another good debugging step would be to remove libvirt entirely and 
> see if you can passthrough the device(s) using the xen tools
>
> https://wiki.xenproject.org/wiki/Xen_PCI_Passthrough
>
> Regards,
> Jim
>
>>      <hostdev mode='subsystem' type='pci' managed='yes'>
>>        <driver name='xen'/>
>>        <source>
>>          <address domain='0x0000' bus='0x01' slot='0x00' 
>> function='0x1'/>
>>        </source>
>>      </hostdev>
>>      <hostdev mode='subsystem' type='pci' managed='yes'>
>>        <driver name='xen'/>
>>        <source>
>>          <address domain='0x0000' bus='0x01' slot='0x00' 
>> function='0x2'/>
>>        </source>
>>      </hostdev>
>>      <hostdev mode='subsystem' type='pci' managed='yes'>
>>        <driver name='xen'/>
>>        <source>
>>          <address domain='0x0000' bus='0x01' slot='0x00' 
>> function='0x3'/>
>>        </source>
>>      </hostdev>
>>      <memballoon model='xen'/>
>>    </devices>
>> </domain>
>>
>>
>> ---
>> ------
>> Greetz
>>
>> Am 31.01.2020 23:07, schrieb Jim Fehlig:
>>> On 1/30/20 1:24 AM, Christoph wrote:
>>>> Hi All,
>>>>
>>>> it is possible to use pci/gpu passthrough with xen and libvirt?
>>>> If yes, how is the syntax? Can I get an example?
>>>
>>> Yes, host PCI devices can be passed to xen guests using libvirt. Below
>>> is example config of a "managed" PCI host device. For more details see
>>> https://libvirt.org/formatdomain.html#elementsHostDevSubsys
>>>
>>>     <hostdev mode='subsystem' type='pci' managed='yes'>
>>>       <driver name='xen'/>
>>>       <source>
>>>         <address domain='0x0000' bus='0x0a' slot='0x10'
>>> function='0x1'/>
>>>       </source>
>>>     </hostdev>
>>>
>>> Regards,
>>> Jim
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20200206/65b0f119/attachment.htm>


More information about the libvirt-users mailing list