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 D159D1A1E75 for ; Thu, 1 Sep 2016 11:46:07 -0700 (PDT) Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 206A743A4E; Thu, 1 Sep 2016 18:46:06 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-28.phx2.redhat.com [10.3.116.28]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u81Ik41L021266; Thu, 1 Sep 2016 14:46:05 -0400 To: Jordan Justen References: <20160819124932.29711-1-lersek@redhat.com> <147267618723.12178.11385591212119668150@jljusten-ivb> <2c5b6038-a51a-9206-392b-d391c0aabf51@redhat.com> <147275300806.20661.4606850370467291385@jljusten-ivb> Cc: Ard Biesheuvel , edk2-devel-01 From: Laszlo Ersek Message-ID: <0500cc50-86f9-ab97-f22d-012ac1857ad0@redhat.com> Date: Thu, 1 Sep 2016 20:46:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <147275300806.20661.4606850370467291385@jljusten-ivb> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 01 Sep 2016 18:46:07 +0000 (UTC) Subject: Re: [PATCH 00/11] OvmfPkg, ArmVirtPkg: GOP driver for the VirtIo GPU (virtio-gpu-pci) 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: Thu, 01 Sep 2016 18:46:08 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 09/01/16 20:03, Jordan Justen wrote: > On 2016-09-01 09:29:28, Laszlo Ersek wrote: >> On 08/31/16 22:43, Jordan Justen wrote: >>> >>> If an OS can't load or find the native driver, the framebuffer also >>> provides a way to communicate with the user. >> >> I agree that exposing the framebuffer address through the GOP (at boot >> time) so that the runtime OS can directly access the framebuffer (at >> runtime) is useful. For example, in Windows 8 and Windows 10 guests, >> this is how QXL can be initially used, interactively, until the native >> QXL drivers are installed. >> >> I also agree that making a directly accessible framebuffer an *optional* > > I can't dispute that it is optional by UEFI spec, but I think it is > commonly available (and for good reason). Agree. > >> feature in the UEFI spec was the right thing to do! Graphics output >> *should* be supportable at least at boot time even if the device lacks a >> linear framebuffer (and even if the above OS fallback will therefore not >> work). >> > > Isn't there generally a window after ExitBootServices is called, and > before the OS has it's own native driver loaded? Yes, there is. > For example, often > the Linux boot loader calls EBS before starting the kernel. What if > the kernel doesn't have the virtio gpu driver? Now there's no possible > way to signal the user. Correct, there is no way to signal the user *on the graphics console*. (And, if the guest kernel does have a virtio-gpu-pci driver, then no messages can be printed to the graphics console in the window that you mention.) Put differently, the "efifb" driver in Linux has no chance of working. But this is no worse than the firmware having no virtio-gpu-pci driver at all -- in that case, you cannot even boot your guest kernel with GRUB, because you can't read anything. So, the virtio-gpu-pci device (and the VirtioGpuDxe driver) does not give you everything you could justifiedly wish for (which is the framebuffer), but it does give you what you can reasonably expect on a platform where the framebuffer is plain broken. Given that the framebuffer is plan broken (architecturally), GRUB wouldn't give you a usable menu anyway, and a guest kernel without the virtio-gpu-pci driver couldn't print readable messages to the framebuffer anyway. (You get garbage on the screen.) IOW, the argument is not that "framebuffer is wrong, boo". The argument is that "framebuffer is broken, fact of life"; virtio-gpu-pci deals with it (sidesteps it). It fills the gap, not completely, but sufficiently. It doesn't give you the exact same experience as a linear framebuffer does *on x86_64*, but for aarch64, that option does not exist, so *on aarch64*, virtio-gpu-pci is a strict improvement. > This is just the Linux example, but for various OS's there could be > any number of reasons for something similar to occur. Yes. [snip] > I think there would be value to have a non-VGA device that could still > configure a simple framebuffer. VGA does bring a fair amount of other > baggage. Ah, I see your point. You distinguish "VGA" from "non-VGA device with framebuffer". For this discussion however, this distinction makes no difference. The suggested "non-VGA device with framebuffer" would be broken exactly the same way. In other words, it's not the "other baggage" that is broken, it is the framebuffer. > But, your point is good, that this does essentially 'fill the > gap' allowing for a temporary framebuffer while also allowing virtio > gpu to be used by the native OS driver. Correction: it fills the gap allowing for a temporary, Blt()-only *GOP* (not framebuffer!), while also allowing virtio-gpu-pci to be used by the native OS driver. And, it turns out that "Blt()-only" is fully sufficient for GRUB, the UEFI shell (i.e., whatever uses Simple Text Out), huge kudos to GraphicsConsoleDxe. :) The setup utility works fine too. >> In other words, lacking a framebuffer is a *bonus* (which side-steps the >> aarch64 architectural / KVM problem). >> > > It doesn't sound like a bonus. :) It is certainly not a bonus that the framebuffer is broken on aarch64/KVM. It has been a huge headache. Given that fact however, it *is* a bonus that we have virtio-gpu-pci, which allows us to display stuff on the screen, without using the (broken) framebuffer :) > Couldn't framebuffer support be an optional capability of the virtio > gpu device? It already is, you just have to call it "virtio-vga" on the QEMU command line, rather than "virtio-gpu-pci". As seen from both the spec and the patches in this series, the guest tells apart these two device models (i.e., it checks whether we have the compat framebuffer) from the PCI device class. Please read ("5.7.7 VGA Compatibility"). Please see also the first three patches. The "qemu-system-aarch64" binary does not include the virtio-vga device (or, in your words, the "optional framebuffer capability"), because the framebuffer is architecturally broken on aarch64/KVM. aarch64 combines guest- and host-side caching attributes differently from x86_64: on the latter, the laxest attribute prevails, on aarch64, the strictest does. The PCI host bridge / root bridge driver in edk2 maps MMIO BARs as Uncached (which is where the framebuffer lives), while KVM maps the same BAR as cached (in host RAM). Therefore, on x86_64, the end-to-end access is cached (= laxests prevails), hence guest updates go through the PCPU cache, where QEMU sees them and can display them correctly. On aarch64, guest updates *avoid* the PCPU cache (they go directly do host RAM: strictest attribute prevails), but QEMU still reads through the PCPU cache, and whatever it displays from there can be stale. The stage1/stage2 caching attribute combination cannot be changed on aarch64 (it is part of the architecture spec and has been shipped in hardware), and all attempts at changing QEMU's host side read accesses / KVM's mappings to Uncached have failed. (The people who have looked into this include the kvm-arm maintainers.) Thanks, Laszlo