From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1audIZ-0006Pi-BD for qemu-devel@nongnu.org; Mon, 25 Apr 2016 05:59:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1audIW-0004FJ-Pr for qemu-devel@nongnu.org; Mon, 25 Apr 2016 05:59:23 -0400 Received: from mail-lb0-x243.google.com ([2a00:1450:4010:c04::243]:33781) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1audIV-0004FC-Nd for qemu-devel@nongnu.org; Mon, 25 Apr 2016 05:59:20 -0400 Received: by mail-lb0-x243.google.com with SMTP id qf3so1841313lbb.0 for ; Mon, 25 Apr 2016 02:59:19 -0700 (PDT) MIME-Version: 1.0 Sender: nicolas.prochazka@gmail.com In-Reply-To: <20160421151333.15059.4309.stgit@gimli.home> References: <20160421151333.15059.4309.stgit@gimli.home> Date: Mon, 25 Apr 2016 11:59:17 +0200 Message-ID: From: nicolas prochazka Content-Type: multipart/alternative; boundary=14dae9473915d76f1905314c3a7e Subject: Re: [Qemu-devel] [RFC PATCH v5 0/7] vfio IGD assignment List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Williamson Cc: qemu-devel , allen.m.kay@intel.com, Gerd Hoffmann , "kvm@vger.kernel.org" --14dae9473915d76f1905314c3a7e Content-Type: text/plain; charset=UTF-8 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 ? regards, Nicolas 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 : > 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, > > Alex > > [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(-) > > --14dae9473915d76f1905314c3a7e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
hello again,
I'm compili= ng linux kernel 4.6rc5
i'm compiling your qemu and seabios git=

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

and= start qemu with this command line ( from ssh )

=C2=A0/usr/bin= /qemu-kvm -name win -S -machine pc-i440fx-2.6,accel=3Dkvm,usb=3Doff -cpu ho= st,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=3D0x1fff -m 14257 -mem-prealloc= -mem-path /dev/hugepages/libvirt/qemu -realtime mlock=3Doff -smp 2,sockets= =3D1,cores=3D2,threads=3D1 -uuid ab829652-e53a-32bf-9a18-6722c7e7f785=C2=A0= -global PIIX4_PM.disable_s3=3D1 -global PIIX4_PM.disable_s4=3D1 -boot stri= ct=3Don -device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 -device = virtio-serial-pci,id=3Dvirtio-serial0,bus=3Dpci.0,addr=3D0x4 -drive file=3D= nbd:unix:/tmp/win.ctl,if=3Dnone,id=3Ddrive-ide0-0-0,format=3Draw -device id= e-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,bootindex=3D= 1 -drive file=3Dnbd:unix:/tmp/swap.ctl,if=3Dnone,id=3Ddrive-ide0-0-1,format= =3Draw -device ide-hd,bus=3Dide.0,unit=3D1,drive=3Ddrive-ide0-0-1,id=3Dide0= -0-1 -device vfio-pci,host=3D0000:00:02.0,bus=3Dpci.0,addr=3D02.0 -vga none=

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

what is wrong ?
regards,
=
Nicolas

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)<= br>00:14.0 USB controller [0c03]: Intel Corporation Device [8086:9d2f] (rev= 21)
00:14.2 Signal processing controller [1180]: Intel Corporation Devi= ce [8086:9d31] (rev 21)
00:16.0 Communication controller [0780]: Intel C= orporation Device [8086:9d3a] (rev 21)
00:17.0 SATA controller [0106]: I= ntel 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)<= br>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:9d7= 0] (rev 21)
00:1f.4 SMBus [0c05]: Intel Corporation Device [8086:9d23] (= rev 21)
00:1f.6 Ethernet controller [0200]: Intel Corporation Ethernet C= onnection I219-V [8086:1570] (rev 21)
01:00.0 Network controller [0280]:= Intel Corporation Wireless 8260 [8086:24f3] (rev 3a)
02:00.0 Non-Volati= le memory controller [0108]: Samsung Electronics Co Ltd Device [144d:a802] = (rev 01)


2016-04-21 17:56 GMT+02:00 Alex Williamson <= ;alex.willi= amson@redhat.com>:
This ser= ies 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].=C2=A0 Legacy mode assignment in this context means<= br> 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.=C2=A0 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=3Don option which is intended to be coupled with UPT mode to enable physically connected
displays.=C2=A0 This has the same SeaBIOS requirement as legacy mode.

What's new in v5?=C2=A0 Support for generation 8 and newer IGD, such as=
Broadwell and Skylake.=C2=A0 These GPUs support 64bit PTEs, changing the GTT sizing and layout.=C2=A0 We also now invalidate the GTT which avoids the majority of DMAR faults when assigning these devices.=C2=A0 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?=C2=A0 Obviously this is post-2.6 material, otherwise=
the remaining blocker is SeaBIOS support.=C2=A0 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?=C2=A0 The VGA ROM is a critical component of IGD
legacy mode, but IME the ROM is only a legacy ROM without UEFI
support.=C2=A0 Therefore I expect it would only be compatible with OVMF
when run with a CSM, which is not our default.=C2=A0 OpRegion support is certainly something we can investigate with OVMF for UPT+OpRegion
mode on an OVMF VM.=C2=A0 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.=C2=A0 We can't very well modify th= at
PCI device to report itself as the host LPC bridge since the feature
set of the Q35 bridge may be different.=C2=A0 Again, UPT mode is the
solution here.=C2=A0 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.=C2=A0 Thanks,

Alex

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

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


=C2=A0hw/vfio/common.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2= =A0 103 +++++++
=C2=A0hw/vfio/pci-quirks.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 617 ++= +++++++++++++++++++++++++++++++++++++++
=C2=A0hw/vfio/pci.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0|=C2=A0 145 ++++++----
=C2=A0hw/vfio/pci.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0|=C2=A0 =C2=A0 8 +
=C2=A0include/hw/vfio/vfio-common.h |=C2=A0 =C2=A0 2
=C2=A0trace-events=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 |=C2=A0 =C2=A011 +
=C2=A06 files changed, 824 insertions(+), 62 deletions(-)


--14dae9473915d76f1905314c3a7e--