]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/Virtio10Dxe: don't bind virtio-vga
authorLaszlo Ersek <lersek@redhat.com>
Thu, 18 Aug 2016 11:52:26 +0000 (13:52 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Thu, 1 Sep 2016 20:54:47 +0000 (22:54 +0200)
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 <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://tianocore.acgmultimedia.com/show_bug.cgi?id=66
Fixes: 9399f68ae359234b142c293ad1bef75f470ced30
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
OvmfPkg/Virtio10Dxe/Virtio10.c

index 06f0699077535f8e8f7351d2827d2604697a5fbf..a8a6a58c3f1da75b58bb98d1be6beb4b81623853 100644 (file)
@@ -822,6 +822,7 @@ Virtio10BindingSupported (
     goto CloseProtocol;\r
   }\r
 \r
     goto CloseProtocol;\r
   }\r
 \r
+  Status = EFI_UNSUPPORTED;\r
   //\r
   // Recognize non-transitional modern devices. Also, we'll have to parse the\r
   // PCI capability list, so make sure the CapabilityPtr field will be valid.\r
   //\r
   // Recognize non-transitional modern devices. Also, we'll have to parse the\r
   // PCI capability list, so make sure the CapabilityPtr field will be valid.\r
@@ -832,9 +833,20 @@ Virtio10BindingSupported (
       Pci.Hdr.RevisionID >= 0x01 &&\r
       Pci.Device.SubsystemID >= 0x40 &&\r
       (Pci.Hdr.Status & EFI_PCI_STATUS_CAPABILITY) != 0) {\r
       Pci.Hdr.RevisionID >= 0x01 &&\r
       Pci.Device.SubsystemID >= 0x40 &&\r
       (Pci.Hdr.Status & EFI_PCI_STATUS_CAPABILITY) != 0) {\r
-    Status = EFI_SUCCESS;\r
-  } else {\r
-    Status = EFI_UNSUPPORTED;\r
+    //\r
+    // The virtio-vga device is special. It can be driven both as a VGA device\r
+    // with a linear framebuffer, and through its underlying, modern,\r
+    // virtio-gpu-pci device, which has no linear framebuffer itself. For\r
+    // compatibility with guest OSes that insist on inheriting a linear\r
+    // framebuffer from the firmware, we should leave virtio-vga to\r
+    // QemuVideoDxe, and support only virtio-gpu-pci here.\r
+    //\r
+    // Both virtio-vga and virtio-gpu-pci have DeviceId 0x1050, but only the\r
+    // former has device class PCI_CLASS_DISPLAY_VGA.\r
+    //\r
+    if (Pci.Hdr.DeviceId != 0x1050 || !IS_PCI_VGA (&Pci)) {\r
+      Status = EFI_SUCCESS;\r
+    }\r
   }\r
 \r
 CloseProtocol:\r
   }\r
 \r
 CloseProtocol:\r