Home > other >  How to make use of PCI Passthrough in xen DomU NIC direct distribution?
How to make use of PCI Passthrough in xen DomU NIC direct distribution?

Time:10-04

In recent study xen virtual machine problems, understand the PCI Passthrough features, can be directly to the equipment assigned to the VM, mainly discussed is the HVM here, the main problem is assigning DomU good NIC, after using the virt - manager cannot start DomU normally,
Some of the configuration:
Xen version: xen 4.1.2 -
System in Dom0: Ubuntu 12.04 (Linux - 3.5.0-23)
DomU system: in Ubuntu 12.04 (Linux - 3.5.0-23)
DomU installation by virt - manager,
Hardware support IOMMU, the BIOS has been set in the I/O virtualization,

Direct distribution steps (mainly refer to xen official documentation: http://wiki.xen.org/wiki/XenPCIpassthrough#Guest_configuration)
Through the lspci command can know the machine of NIC is 0000:00:19. 0
1. The use of the file system for dynamic allocation
# modprobe xen - pciback
2. The usual steps:
? Unbind the from the old driver.
? Create a new slot in pciback for device
? The Bind to pciback
you can use a script file. Do this: (pciback sh)
#!/bin/bash
If [$# - eq 0]; Then
Echo "the Require PCI devices in the format: & lt; Domain> : & lt; Bus> : & lt; Slot> . & lt; Function>"
Echo "Eg: $0000 (the basename $0) : 00:1 b. 0"
The exit 1
Fi
Modprobe xen - pciback
For pcidev $@ in; Do
If [- h/sys/bus/pci/devices/" $pcidev "/driver]; Then
Echo $pcidev Unbinding "from" $(the basename $(readlink/sys/bus/pci/devices/" $pcidev "/driver))
Echo -n "$pcidev & gt;"/sys/bus/pci/devices/" $pcidev "/driver/unbind
Fi
Echo "Binding $pcidev to pciback"
Echo -n "$pcidev & gt;"/sys/bus/pci/drivers/pciback/new_slot
Echo -n "$pcidev & gt;"/sys/bus/pci/drivers/pciback/bind
The done

The execution of the script file:
0000: sudo bash - x pciback. Sh 00:19. 0
0000:00:19. 0 corresponding & lt; Domain> : & lt; Bus> : & lt; Slot> . & lt; Function>


3. Verify the distribution of the success:
# xm pci - list - assignable - devices
0000-99:19.0

4. Virtual PCI slots (6 ~ 7) are reserved in HVM guest to support VTd hotplug.
Detach the device from the guest by the physical BDF. Then HVM guest will receive a virtual PCI hot removal event to Detach the physical device
0000: # xm pci - detach zbn01 00:19. 0
Attach a PCI device to the guest by the physical BDF and desired virtual slot (optional). The Following command order to insert the physical device into guest 's virtual slot 7
0000: # xm pci - attach zbn01 00:19. 0, 7

After basic according to the above operation, use of virt - manager start zbn01 virtual machine, but not normal boot, interface is turned off suddenly,
I hope you can point to the next problem, at the same time, also can provide some Suggestions and comments, big thanks!!!!!!!!!!!!!!!!!!!!!!!!


  • Related