實作七:Xen PCI Passthrough 操作
【Step 1: 連線到遠端主機】
【Step 2: 產生一台虛擬機器】
【Step 3: 查看你的顯卡資訊】
$ lspci -vv
01:00.0 VGA compatible controller: nVidia Corporation GeForce 9800 GT (rev a2)
Subsystem: ASUSTeK Computer Inc. Device 82a0
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
Interrupt: pin A routed to IRQ 16
Region 0: Memory at fd000000 (32-bit, non-prefetchable) [size=16M]
Region 1: Memory at d0000000 (64-bit, prefetchable) [size=256M]
Region 3: Memory at fa000000 (64-bit, non-prefetchable) [size=32M]
Region 5: I/O ports at dc80 [size=128]
[virtual] Expansion ROM at fea00000 [disabled] [size=128K]
Capabilities: <access denied>
Kernel driver in use: pciback
Kernel modules: nvidia, nvidiafb
【Step 4: PCI Frontend Configuration 設定你的 DomU 】
$ sudo vim /etc/xen/nvidia.cfg [[BR]]
kernel = '/boot/vmlinuz-2.6.22.9'
ramdisk = '/boot/initrd.img-2.6.22.9'
memory = '1024'
vcpus = '4'
# 配置你的 PCIE 顯示卡
pci = ['01:00.0']
root = '/dev/sda2 ro'
disk = [
'file:/home/domains/nvidia/disk.img,sda2,w',
'file:/home/domains/nvidia/swap.img,sda1,w',
]
name = 'nvidia'
#
# Networking
#
vif = [ 'ip=140.xxx.xxx.xxx,mac=00:16:3E:AA:70:5C' ]
#
# Behaviour
#
on_poweroff = 'destroy'
on_reboot = 'restart'
on_crash = 'restart'
【Step 5: PCI Backend Configuration 設定你的 Dom0 】
$ sudo su -
- Caution: Make sure that the device is not controlled by any driver: there should be no driver symlink for nvidia.
PATH: /sys/bus/pci/devices/0000:01:00.0/
driver -> ../../../../bus/pci/drivers/nvidia ---> This symlink shouldn't exist.
【Step 6: 硬體直接存取設定】
Permissive Flag
$ sudo vim /etc/xen/xend-pci-permissive.sxp
(unconstrained_dev_ids
#('0123:4567:89AB:CDEF')
('0000:01:00.0')
)
User-space Quirks
$ sudo vim /etc/xen/xend-pci-quirks.sxp [[BR]]
(pci_ids
# Entries are formated as follows:
# <vendor>:<device>[:<subvendor>:<subdevice>]
('10de:0605' # NVIDIA 9800GT
)
)
【Step 7: 啟動並登入你的虛擬機器 DomU 】
【Step 8: 設定你的 DomU 基本環境】