[vfio-users] IGD pass through, sometimes ok, in most cases black screen
张文剑
acewind at gmail.com
Wed Aug 22 06:32:18 UTC 2018
My env is a x86-64 thin client with i3-4010U cpu,an IGD inside, which has
HDMI and VGA, two output interfaces.
My os is ubuntu 18.04, kernel version is 4.15.0, qemu version is 2.11.1.
root at test:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
root at test:~# uname -a
Linux idv 4.15.0-32-generic #35-Ubuntu SMP Fri Aug 10 17:58:07 UTC 2018
x86_64 x86_64 x86_64 GNU/Linux
root at test:~# qemu-system-x86_64 --version
QEMU emulator version 2.11.1(Debian 1:2.11+dfsg-1ubuntu7.4)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
root at test:~# dpkg -s seabios | grep Version
Version: 1.10.2-1ubuntu1
root at test:~# cat /proc/cpuinfo | grep 'model name' | head -1
model name : Intel(R) Core(TM) i3-4010U CPU @ 1.70GHz
root at test:~# lspci
00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 09)
00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated
Graphics Controller (rev 09)
00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller
(rev 09)
00:1b.0 Audio device: Intel Corporation 8 Series HD Audio Controller (rev
04)
00:1c.0 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 4 (rev
e4)
00:1d.0 USB controller: Intel Corporation 8 Series USB EHCI #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation 8 Series LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 8 Series SATA Controller 1 [AHCI
mode] (rev 04)
00:1f.3 SMBus: Intel Corporation 8 Series SMBus Controller (rev 04)
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)
According to article
http://vfio.blogspot.com/2016/07/intel-graphics-assignment.html, i915
driver and some *fb is disabled in grub and modprobe blacklist:
root at test:~# cat /etc/default/grub | grep GRUB_CMDLINE_LINUX_DEFAULT
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_iommu=on iommu=pt
rd.driver.pre=vfio-pci video=vesafb:off vga=normal nofb nomodeset
i915.modeset=0"
root at test:~# cat /etc/modprobe.d/blacklist-i915.conf
install i915 /bin/true
Here "blacklist i915" has been used, but the module still could be loaded.
When system is rebooted, the ubuntu graphic interface is always available.
Login by ssh, I check it by some commands:
root at test:~# cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-4.15.0-32-generic
root=UUID=032d875c-1398-478c-b9b8-4e8a490bcd65 ro quiet splash
intel_iommu=on iommu=pt rd.driver.pre=vfio-pci video=vesafb:off vga=normal
nofb nomodeset i915.modeset=0 vt.handoff=1
root at test:~# lsmod | grep 915
usbhid 49152 0
parport 49152 3 lp,parport_pc,ppdev
root at test:~# lsmod | grep vfio
vfio_pci 45056 1
vfio_virqfd 16384 1 vfio_pci
vfio_iommu_type1 24576 1
vfio 28672 5 vfio_iommu_type1,vfio_pci
irqbypass 16384 2 kvm,vfio_pci
root at test:~# cat /proc/iomem | grep fb
f8000000-fbffffff : PCI MMCONFIG 0000 [bus 00-3f]
f8000000-fbffffff : Reserved
f8000000-fbffffff : pnp 00:05
Now I bind IGD to vfio-pci driver by script:
https://github.com/andre-richter/vfio-pci-bind/blob/master/vfio-pci-bind.sh:
root at test:~# echo "vfio-pci" >
/sys/bus/pci/devices/0000:00:02.0/driver_override
root at test:~# ./vfio-pci-bind.sh 0000:00:02.0
root@~:test# lspci -s 00:02.0 -v
00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated
Graphics Controller (rev 09) (prog-if 00 [VGA controller])
Subsystem: Intel Corporation Haswell-ULT Integrated Graphics Controller
Flags: bus master, fast devsel, latency 0, IRQ 11
Memory at b7c00000 (64-bit, non-prefetchable) [size=4M]
Memory at c0000000 (64-bit, prefetchable) [size=128M]
I/O ports at 4000 [size=64]
[virtual] Expansion ROM at 000c0000 [disabled] [size=128K]
Capabilities: [90] MSI: Enable- Count=1/1 Maskable- 64bit-
Capabilities: [d0] Power Management version 2
Capabilities: [a4] PCI Advanced Features
Kernel driver in use: vfio-pci
Kernel modules: i915
Then I create a windows 7 instance by libvirt, and pass through hostdev IGD
to it:
root at test:~# cat win7.xml
<domain type='kvm'>
<name>win7</name>
<uuid>a6b96841-2f52-4a1d-bed2-8ec9ecc4e6a0</uuid>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<type arch='x86_64' machine='pc-i440fx-bionic'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<hyperv>
<relaxed state='on'/>
<vapic state='on'/>
<spinlocks state='on' retries='8191'/>
</hyperv>
<vmport state='off'/>
</features>
<cpu mode='custom' match='exact' check='partial'>
<model fallback='allow'>Haswell-noTSX-IBRS</model>
</cpu>
<clock offset='localtime'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
<timer name='hypervclock' present='yes'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<emulator>/usr/bin/kvm-spice</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/home/windows_7_ultimate_with_sp1_x64.qcow2'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09'
function='0x0'/>
</disk>
<controller type='usb' index='0' model='ich9-ehci1'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05'
function='0x7'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci1'>
<master startport='0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05'
function='0x0' multifunction='on'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci2'>
<master startport='2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05'
function='0x1'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci3'>
<master startport='4'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05'
function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01'
function='0x1'/>
</controller>
<controller type='virtio-serial' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06'
function='0x0'/>
</controller>
<controller type='scsi' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08'
function='0x0'/>
</controller>
<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='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<hostdev mode='subsystem' type='pci' managed='yes'>
<driver name='vfio'/>
<source>
<address domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</source>
<alias name='hostdev0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02'
function='0x0'/>
</hostdev>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07'
function='0x0'/>
</memballoon>
</devices>
</domain>
After virsh create command, the instance is running, and the VGA screen
turn to black, no output later.
I repeated these operations, sometimes windows 7 can be seen on the screen
successfully, but in most cases there’s only black screens.
What’s wrong with my operation?
Below is dmesg DMAR errors:
[ 117.334573] L1TF CPU bug present and SMT on, data leak possible. See
CVE-2018-3646 and
https://www.kernel.org/doc/html/latest/admin-guide/l1tf.html for details.
[ 117.368066] DMAR: DRHD: handling fault status reg 3
[ 117.368079] DMAR: [DMA Read] Request device [00:02.0] fault addr
afc00000 [fault reason 06] PTE Read access is not set
[ 117.368149] DMAR: DRHD: handling fault status reg 3
[ 117.368156] DMAR: [DMA Read] Request device [00:02.0] fault addr
afa80000 [fault reason 06] PTE Read access is not set
[ 117.368554] DMAR: DRHD: handling fault status reg 3
[ 117.368561] DMAR: [DMA Read] Request device [00:02.0] fault addr
afc00000 [fault reason 12] non-zero reserved fields in PTE
[ 117.368566] DMAR: DRHD: handling fault status reg 3
[ 117.368572] DMAR: [DMA Read] Request device [00:02.0] fault addr
afc01000 [fault reason 12] non-zero reserved fields in PTE
[ 117.368576] DMAR: DRHD: handling fault status reg 3
[ 117.368582] DMAR: [DMA Read] Request device [00:02.0] fault addr
afc03000 [fault reason 06] PTE Read access is not set
[ 117.368587] DMAR: DRHD: handling fault status reg 3
[ 117.368592] DMAR: [DMA Read] Request device [00:02.0] fault addr
afc04000 [fault reason 12] non-zero reserved fields in PTE
[ 117.368597] DMAR: DRHD: handling fault status reg 2
[ 117.368602] DMAR: [DMA Read] Request device [00:02.0] fault addr
afc05000 [fault reason 12] non-zero reserved fields in PTE
[ 117.368607] DMAR: DRHD: handling fault status reg 3
[ 117.368612] DMAR: [DMA Read] Request device [00:02.0] fault addr
afc07000 [fault reason 12] non-zero reserved fields in PTE
[ 117.368621] DMAR: DRHD: handling fault status reg 3
[ 117.368626] DMAR: [DMA Read] Request device [00:02.0] fault addr
afc08000 [fault reason 06] PTE Read access is not set
[ 117.368631] DMAR: DRHD: handling fault status reg 3
[ 117.368636] DMAR: [DMA Read] Request device [00:02.0] fault addr
afc09000 [fault reason 12] non-zero reserved fields in PTE
[ 117.410215] random: crng init done
[ 119.105305] vfio-pci 0000:00:02.0: ready 1123ms after FLR
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/vfio-users/attachments/20180822/f78e1e2b/attachment.htm>
More information about the vfio-users
mailing list