From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 94C4E1A1E14 for ; Fri, 19 Aug 2016 05:49:43 -0700 (PDT) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2DDE66331E; Fri, 19 Aug 2016 12:49:43 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-13.phx2.redhat.com [10.3.116.13]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7JCnaSh011583; Fri, 19 Aug 2016 08:49:42 -0400 From: Laszlo Ersek To: edk2-devel-01 Cc: Ard Biesheuvel , Jordan Justen Date: Fri, 19 Aug 2016 14:49:23 +0200 Message-Id: <20160819124932.29711-3-lersek@redhat.com> In-Reply-To: <20160819124932.29711-1-lersek@redhat.com> References: <20160819124932.29711-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 19 Aug 2016 12:49:43 +0000 (UTC) Subject: [PATCH 02/11] OvmfPkg/Virtio10Dxe: don't bind virtio-vga X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2016 12:49:43 -0000 Content-Transfer-Encoding: quoted-printable Commit 9399f68ae359 ("OvmfPkg: Virtio10Dxe: non-transitional driver for virtio-1.0 PCI devices") created a "competition" between Virtio10Dxe and QemuVideoDxe for virtio-vga devices. The binding order between these drivers is unspecified, and the wrong order effectively breaks commit 94210dc95e9f ("OvmfPkg: QemuVideoDxe: add virtio-vga support"). Thus, never bind virtio-vga in Virtio10Dxe; QemuVideoDxe provides better compatibility for guest OSes that insist on inheriting a linear framebuffer. Users who prefer the VirtIo GPU interface at boot time should specify virtio-gpu-pci, which is exactly virtio-vga, minus the VGA compatibility (such as the framebuffer). Cc: Ard Biesheuvel Cc: Jordan Justen Ref: https://tianocore.acgmultimedia.com/show_bug.cgi?id=3D66 Fixes: 9399f68ae359234b142c293ad1bef75f470ced30 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/Virtio10Dxe/Virtio10.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/Virtio10Dxe/Virtio10.c b/OvmfPkg/Virtio10Dxe/Virtio10.c index 06f069907753..a8a6a58c3f1d 100644 --- a/OvmfPkg/Virtio10Dxe/Virtio10.c +++ b/OvmfPkg/Virtio10Dxe/Virtio10.c @@ -819,25 +819,37 @@ Virtio10BindingSupported ( Status =3D PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, 0,=0D sizeof Pci / sizeof (UINT32), &Pci);=0D if (EFI_ERROR (Status)) {=0D goto CloseProtocol;=0D }=0D =0D + Status =3D EFI_UNSUPPORTED;=0D //=0D // Recognize non-transitional modern devices. Also, we'll have to parse = the=0D // PCI capability list, so make sure the CapabilityPtr field will be val= id.=0D //=0D if (Pci.Hdr.VendorId =3D=3D VIRTIO_VENDOR_ID &&=0D Pci.Hdr.DeviceId >=3D 0x1040 &&=0D Pci.Hdr.DeviceId <=3D 0x107F &&=0D Pci.Hdr.RevisionID >=3D 0x01 &&=0D Pci.Device.SubsystemID >=3D 0x40 &&=0D (Pci.Hdr.Status & EFI_PCI_STATUS_CAPABILITY) !=3D 0) {=0D - Status =3D EFI_SUCCESS;=0D - } else {=0D - Status =3D EFI_UNSUPPORTED;=0D + //=0D + // The virtio-vga device is special. It can be driven both as a VGA de= vice=0D + // with a linear framebuffer, and through its underlying, modern,=0D + // virtio-gpu-pci device, which has no linear framebuffer itself. For= =0D + // compatibility with guest OSes that insist on inheriting a linear=0D + // framebuffer from the firmware, we should leave virtio-vga to=0D + // QemuVideoDxe, and support only virtio-gpu-pci here.=0D + //=0D + // Both virtio-vga and virtio-gpu-pci have DeviceId 0x1050, but only t= he=0D + // former has device class PCI_CLASS_DISPLAY_VGA.=0D + //=0D + if (Pci.Hdr.DeviceId !=3D 0x1050 || !IS_PCI_VGA (&Pci)) {=0D + Status =3D EFI_SUCCESS;=0D + }=0D }=0D =0D CloseProtocol:=0D gBS->CloseProtocol (DeviceHandle, &gEfiPciIoProtocolGuid,=0D This->DriverBindingHandle, DeviceHandle);=0D =0D --=20 2.9.2