qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Marc Zyngier <marc.zyngier@arm.com>
Subject: Re: [Qemu-devel] [PATCH v2 0/7] ramfb: simple boot framebuffer, no legacy vga
Date: Wed, 25 Apr 2018 22:43:29 +0200	[thread overview]
Message-ID: <1ed94b1c-b416-eebe-9cf3-91943a0e6c5a@redhat.com> (raw)
In-Reply-To: <20180425140749.6x3w4h4i2n6uaq7o@sirius.home.kraxel.org>

On 04/25/18 16:07, Gerd Hoffmann wrote:
>   Hi,
> 
>>> We should make sure that any device model that combines ramfb with
>>> another PCI display device is not matched by the OVMF driver for that
>>> PCI display device. IOW, we should use separate PCI IDs or subsystem
>>> IDs (I don't recall the details off-hand). I'd like to avoid messing
>>> with the current device probing code in OVMF. It just wouldn't be nice
>>> if two independent drivers (e.g. VirtioGpuDxe and a supposed
>>> "RamFbDxe") bound the two interfaces at the same time.
>>
>> For example, virtio-vga is already problematic like this (it could be
>> driven by both Virtio10Dxe+VirtioGpuDxe, and QemuVideoDxe), and it had
>> to be hacked around in Virtio10Dxe. So I'm strongly in favor of a device
>> model that clearly looks like one device and one device only to the full
>> set of edk2 drivers, without cross-driver hacks.
> 
> Hmm, trying to figure what we should do here best ...
> 
> First, ramfb has absolutely no connection to the "combined" device,
> other than that the combined devices have a single device only.

I think you mean "... single back-end only">

> From
> the guests point of view there is no difference between
> 
>   (a) qemu -device virtio-ramfb, and
>   (b) qemu -device virtio-gpu-pci -device ramfb-testdev
> 
> On the host side the difference is that (a) is a single QemuConsole
> which shows virtio-gpu-pci once activated and ramfb otherwise, and
> (b) is two QemuConsoles, so you can see both virtio-gpu-pci and ramfb
> side-by-side, for debugging purposes.

Exactly this "multiple frontends, single backend" connection is the
problem. In UEFI, it is possible to establish a priority order between
drivers that are all capable of binding the same controller ("handle"),
but especially with ramfb + another (PCI) video frontend, it's the
"handles" that are different. The "priority mechanism" would have no
idea that the drivers cannot peacefully coexist, i.e. it's clueless
about the (host side only) competition.

This is a problem because you display something on the one device, and
the screen still shows the other, and users complain.

To my understanding, in Linux, special cross-driver hacks exist for
this. For example, you boot with efifb (which is not a PCI device), and
once an actual PCI display driver is configured, it is considered
superior, and it supplants efifb.

On a tangent: on the host side, we already have to entirely separate I/O
consoles: some kind of graphics + emulated keyboard, plus serial. Those
are always displayed in parallel -- not in two GUI toolkit windows, mind
you, but it's never the case that one permanently "hides" the other. You
can switch between them in virt-manager. Or, connect to the emulated
serial port from a terminal window that is separate from the main
graphics window.

If this was the case with ramfb + something else (i.e., writing to ramfb
wouldn't be possible to "read back" for the other firmware driver, from
the PCI framebuffer, and one could switch back and forth between ramfb
display and PCI display on their desktop), then it would be OK for both
firmware drivers to bind. Point is, the two back-ends need not occupy
double the screen real estate; it would suffice if one didn't hide the
other permanently, and users could switch at will.

> Second, one usecase is vgpu boot display.  When combining ramfb with a
> (mdev) vgpu qemu can't modify the pci device.  Which I think pretty much
> implies that adding a whitelist of pci devices to ramfb isn't going to
> fly.  It would also have the drawback that -device ramfb-testdev will
> not work.
> 
> So lets do it the other way around?  Blacklist devices which
> QemuVideoDxe and VirtioGpuDxe should *not* bind to?

(It's a bit worse than that, actually -- VirtioGpuDxe does not consume
EFI_PCI_IO_PROTOCOL, it consumes VIRTIO_DEVICE_PROTOCOL.
VIRTIO_DEVICE_PROTOCOL is produced by the various virtio transport
drivers we have; in this particular case, that is Virtio10Dxe. And it is
Virtio10Dxe that consumes EFI_PCI_IO_PROTOCOL. So the mutual exclusion,
for virtio-vga anyway, happens between QemuVideoDxe and Virtio10Dxe, on
the controller handle that has a PciIo interface on it.)

> One way would be to
> just use different pci (subsystem) ids.  Problem is that the guest os
> driver might not bind too then.  So something else?  Add a pci
> capability maybe?  Other ideas?

I could imagine an OvmfPkg-specific PCI capability that said, "all PCI
drivers in OvmfPkg that could otherwise drive this device, ignore it --
another (platform) driver in OvmfPkg will pick it up instead". This
would resolve the competition between ramfb and whatever PCI device;
ramfb would always win. (We should add the capability check to OvmfPkg's
PCI drivers *no later* than introducing the ramfb driver though, so
there be no "window" where both kinds bound.)

(Wrt. updating the PCI ID lists of guest OS drivers -- I guess that too
could be viable, at least for Linux. I'm not really certain.)

Thanks
Laszlo

  reply	other threads:[~2018-04-25 20:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23 12:25 [Qemu-devel] [PATCH v2 0/7] ramfb: simple boot framebuffer, no legacy vga Gerd Hoffmann
2018-03-23 12:25 ` [Qemu-devel] [PATCH v2 1/7] [testing] update bios, add vgabios-ramfb Gerd Hoffmann
2018-03-23 12:25 ` [Qemu-devel] [PATCH v2 2/7] [testing] add ovmf build with ramfb support Gerd Hoffmann
2018-03-23 12:25 ` [Qemu-devel] [PATCH v2 3/7] hw/display: add ramfb, a simple boot framebuffer living in guest ram Gerd Hoffmann
2018-03-23 12:25 ` [Qemu-devel] [PATCH v2 4/7] hw/display: add ramfb-testdev Gerd Hoffmann
2018-03-23 12:25 ` [Qemu-devel] [PATCH v2 5/7] hw/display: add virtio-ramfb Gerd Hoffmann
2018-03-23 12:25 ` [Qemu-devel] [PATCH v2 6/7] hw/vfio/display: add ramfb support Gerd Hoffmann
2018-03-23 12:25 ` [Qemu-devel] [PATCH v2 7/7] [wip] hw/display: add qxl-ramfb Gerd Hoffmann
2018-03-23 13:27 ` [Qemu-devel] [PATCH v2 0/7] ramfb: simple boot framebuffer, no legacy vga Laszlo Ersek
2018-03-23 14:51   ` Gerd Hoffmann
2018-03-23 15:12     ` Laszlo Ersek
2018-03-23 17:07       ` Gerd Hoffmann
2018-03-23 18:29         ` Laszlo Ersek
2018-03-24  3:51   ` Ard Biesheuvel
2018-04-25 14:07   ` Gerd Hoffmann
2018-04-25 20:43     ` Laszlo Ersek [this message]
2018-05-31  8:43       ` Gerd Hoffmann
2018-05-31  9:11         ` Laszlo Ersek
2018-06-05 11:06           ` Gerd Hoffmann
2018-06-05 12:07             ` Laszlo Ersek
2018-06-05 13:16               ` Gerd Hoffmann
2018-06-05 13:23                 ` Laszlo Ersek
2018-06-06  8:49                   ` Gerd Hoffmann
2018-06-06 12:43                     ` Laszlo Ersek
2018-06-06 13:21                       ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1ed94b1c-b416-eebe-9cf3-91943a0e6c5a@redhat.com \
    --to=lersek@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=kraxel@redhat.com \
    --cc=marc.zyngier@arm.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).