Stack Exchange
Help please with XEN PCI-device passthough
I have problem with PCI passthough in XEN.
kernel: 4.15.0-23-generic
CPU: Intel Core i7 - saw specifications on Intel website: it supports VT-d, VT-x and all other technologies!
Checking XEN is ready IOMMU / VT-d / VT-x:
xl dmesg | grep -i hvm

output:
(XEN) HVM: ASIDs enabled.
(XEN) HVM: VMX enabled
(XEN) HVM: Hardware Assisted Paging (HAP) detected
(XEN) HVM: HAP page sizes: 4kB, 2MB

check IOMMU: 
(XEN) Enabling APIC mode:  Flat.  Using 1 I/O APICs
(XEN) I/O virtualisation enabled

So, I started (Passthough a PCI USB controller, where xx:yy.z is ID of lspci):
# modprobe xen-pciback
# xl pci-assignable-add xx:yy.z

Check device is ready to be passthough:
sudo xl pci-assignable-list

It shows me: 0000:xx:yy.z so I was happy that my device is ready. Then:
sudo nano /etc/xen/ubuntu.hvm

I edit config adding this line:
pci = ['0000:xx:yy.z']

Then start:
sudo xl create /etc/xen/ubuntu.hvm

And i see ERROR:
Parsing config from /etc/xen/ubuntu.hvm
libxl: error: libxl_pci.c:1111:do_pci_add: Domain 2:xc_assign_device failed: Cannot allocate memory
libxl: error: libxl_pci.c:1306:libxl__add_pcidevs: Domain 2:libxl_device_pci_add failed: -3
libxl: error: libxl_create.c:1458:domcreate_attach_devices: Domain 2:unable to add pci devices
libxl: error: libxl_domain.c:1003:libxl__destroy_domid: Domain 2:Non-existant domain
libxl: error: libxl_domain.c:962:domain_destroy_callback: Domain 2:Unable to destroy guest
libxl: error: libxl_domain.c:889:domain_destroy_cb: Domain 2:Destruction of domain failed

Any ideas? I googled, but not found my problem! My second AMD Ryzen PC succeded passthough PCI USB without any errors.

You have to make sure that dom0 is not capturing the PCI device you are trying to pass-through at boot time.
Make sure this is specified in /etc/default/grub.d/xen.cfg 
at the line GRUB_CMDLINE_XEN="pciback.hide=(xx:yy.z)"
run update-grub
and reboot.
