[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH v5 0/7] vfio IGD assignment

From: nicolas prochazka
Subject: Re: [Qemu-devel] [RFC PATCH v5 0/7] vfio IGD assignment
Date: Mon, 25 Apr 2016 11:59:17 +0200

hello again,
I'm compiling linux kernel 4.6rc5
i'm compiling your qemu and seabios git

then , I unbind my vga card :
echo "0000:00:02.0" > /sys/bus/pci/devices/0000\:00\:02.0/driver/unbind

and start qemu with this command line ( from ssh )

 /usr/bin/qemu-kvm -name win -S -machine pc-i440fx-2.6,accel=kvm,usb=off -cpu host,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1fff -m 14257 -mem-prealloc -mem-path /dev/hugepages/libvirt/qemu -realtime mlock=off -smp 2,sockets=1,cores=2,threads=1 -uuid ab829652-e53a-32bf-9a18-6722c7e7f785  -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x4 -drive file=nbd:unix:/tmp/win.ctl,if=none,id=drive-ide0-0-0,format=raw -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive file=nbd:unix:/tmp/swap.ctl,if=none,id=drive-ide0-0-1,format=raw -device ide-hd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 -device vfio-pci,host=0000:00:02.0,bus=pci.0,addr=02.0 -vga none

qemu-system-x86_64: -device vfio-pci,host=0000:00:02.0,bus=pci.0,addr=02.0: PCI: slot 2 function 0 not available for vfio-pci, in use by e1000

what is wrong ?

lspci shows us :

00:00.0 Host bridge [0600]: Intel Corporation Sky Lake Host Bridge/DRAM Registers [8086:1904] (rev 09)
00:02.0 VGA compatible controller [0300]: Intel Corporation Sky Lake Integrated Graphics [8086:1926] (rev 0a)
00:14.0 USB controller [0c03]: Intel Corporation Device [8086:9d2f] (rev 21)
00:14.2 Signal processing controller [1180]: Intel Corporation Device [8086:9d31] (rev 21)
00:16.0 Communication controller [0780]: Intel Corporation Device [8086:9d3a] (rev 21)
00:17.0 SATA controller [0106]: Intel Corporation Device [8086:9d03] (rev 21)
00:1c.0 PCI bridge [0604]: Intel Corporation Device [8086:9d14] (rev f1)
00:1d.0 PCI bridge [0604]: Intel Corporation Device [8086:9d18] (rev f1)
00:1e.0 Signal processing controller [1180]: Intel Corporation Device [8086:9d27] (rev 21)
00:1e.6 SD Host controller [0805]: Intel Corporation Device [8086:9d2d] (rev 21)
00:1f.0 ISA bridge [0601]: Intel Corporation Device [8086:9d48] (rev 21)
00:1f.2 Memory controller [0580]: Intel Corporation Device [8086:9d21] (rev 21)
00:1f.3 Audio device [0403]: Intel Corporation Device [8086:9d70] (rev 21)
00:1f.4 SMBus [0c05]: Intel Corporation Device [8086:9d23] (rev 21)
00:1f.6 Ethernet controller [0200]: Intel Corporation Ethernet Connection I219-V [8086:1570] (rev 21)
01:00.0 Network controller [0280]: Intel Corporation Wireless 8260 [8086:24f3] (rev 3a)
02:00.0 Non-Volatile memory controller [0108]: Samsung Electronics Co Ltd Device [144d:a802] (rev 01)

2016-04-21 17:56 GMT+02:00 Alex Williamson <address@hidden>:
This series enables "legacy mode" Intel graphics device assignment on
SandyBridge and newer CPUs when coupled with a v4.6 Linux host kernel
and updated SeaBIOS[1].  Legacy mode assignment in this context means
that we modify the VM to supply the features required for IGD, such as
an OpRegion, stolen memory, host bridge and ISA bridge, and VGA, as
opposed to Intel's Universal Pass-Through (UPT) mode where IGD can be
assigned as if it were a discrete PCI device, with no additional
modifications of the VM.  The benefit of legacy mode is that we can
support older hardware, primary graphics mode in the VM, and physical
display outputs.

Additionally this series adds an new x-igd-opregion=on option which is
intended to be coupled with UPT mode to enable physically connected
displays.  This has the same SeaBIOS requirement as legacy mode.

What's new in v5?  Support for generation 8 and newer IGD, such as
Broadwell and Skylake.  These GPUs support 64bit PTEs, changing the
GTT sizing and layout.  We also now invalidate the GTT which avoids
the majority of DMAR faults when assigning these devices.  OpRegion
support is no longer automatic, except in legacy mode, since it can
interfere with headless UPT setups.

Legacy mode will only be enabled when IGD is configured at VM address
00:02.0, a ROM is present, VGA is available, and the host kernel
supports vfio device specific regions providing the OpRegion, host
config space, and ISA/LPC bridge config access.

What's left to do?  Obviously this is post-2.6 material, otherwise
the remaining blocker is SeaBIOS support.  SeaBIOS would prefer an
interface that allows reserved memory regions to be assigned and
populated generically and the base address returned to QEMU without
SeaBIOS needing device specific code.

What about OVMF/Q35?  The VGA ROM is a critical component of IGD
legacy mode, but IME the ROM is only a legacy ROM without UEFI
support.  Therefore I expect it would only be compatible with OVMF
when run with a CSM, which is not our default.  OpRegion support is
certainly something we can investigate with OVMF for UPT+OpRegion
mode on an OVMF VM.  Q35 is unfortunately incompatible with legacy
mode because in most configurations it already places an LPC/ISA
bridge at address 00:1f.0 in the VM.  We can't very well modify that
PCI device to report itself as the host LPC bridge since the feature
set of the Q35 bridge may be different.  Again, UPT mode is the
solution here.  Legacy mode will not fail due to a Q35 machine type,
but will fail if address 00:1f.0 is populated with anything other
than a vfio-pci-igd-lpc-bridge device.

Note to laptop users, I generally expect that screen dimming and lid
switches are implemented in ACPI, outside of anything supported here.
Laptop displays are also more fickle with generic drivers and may not
work without native device drivers (ie. the windows basic driver may
not drive the display during an install).

Please test and review.  Thanks,


[1] http://patchwork.ozlabs.org/patch/583731

Alex Williamson (7):
      vfio: Enable sparse mmap capability
      vfio: Create device specific region info helper
      vfio/pci: Fix return of vfio_populate_vga()
      vfio/pci: Consolidate VGA setup
      vfio/pci: Setup BAR quirks after capabilities probing
      vfio/pci: Intel graphics legacy mode assignment
      vfio/pci: Add a separate option for IGD OpRegion support

 hw/vfio/common.c              |  103 +++++++
 hw/vfio/pci-quirks.c          |  617 +++++++++++++++++++++++++++++++++++++++++
 hw/vfio/pci.c                 |  145 ++++++----
 hw/vfio/pci.h                 |    8 +
 include/hw/vfio/vfio-common.h |    2
 trace-events                  |   11 +
 6 files changed, 824 insertions(+), 62 deletions(-)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]