Skip to contentSkip to conversation

ramfb: simple boot framebuffer

PATCH Superseded Gerd Hoffmann 5 participants 10 messages Jun 13, 2018 – Jun 15, 2018

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover ramfb: simple boot framebuffer

Hi,

So, the first ramfb bits should be ready for merge. This series includes the ramfb core support bits, the ramfb standalone device and vfio-pci-ramfb device for vgpu boot display support.

If you want play with it I recommend getting the bits from

https://www.kraxel.org/cgit/qemu/log/?h=sirius/ramfb

because they come with an updated seabios and a new vgabios rom and an experimental OVMF build. Firmware patches are here:

https://www.kraxe.org/cgit/seabios/log/?h=ramfb
https://github.com/kraxel/edk2/commits/ramfb

They should land upstream soon.

cheers,
Gerd

Gerd Hoffmann (3):
hw/display: add ramfb, a simple boot framebuffer living in guest ram hw/display: add standalone ramfb device
hw/vfio/display: add ramfb support

 include/hw/display/ramfb.h    | 12 ++++++
 include/hw/vfio/vfio-common.h |  2 +
 hw/arm/sysbus-fdt.c           |  7 ++++
 hw/arm/virt.c                 |  2 +
 hw/display/ramfb-standalone.c | 62 ++++++++++++++++++++++++++++
 hw/display/ramfb.c            | 95 +++++++++++++++++++++++++++++++++++++++++++
 hw/i386/pc_piix.c             |  2 +
 hw/i386/pc_q35.c              |  2 +
 hw/vfio/display.c             | 10 +++++
 hw/vfio/pci.c                 | 15 +++++++
 hw/display/Makefile.objs      |  3 ++
 11 files changed, 212 insertions(+)
 create mode 100644 include/hw/display/ramfb.h
 create mode 100644 hw/display/ramfb-standalone.c
 create mode 100644 hw/display/ramfb.c
Signature · 1 line
2.9.3
#1 lore raw

PATCH v4 1/3 hw/display: add ramfb, a simple boot framebuffer living in guest ram

The boot framebuffer is expected to be configured by the firmware, so it uses fw_cfg as interface. Initialization goes as follows:

(1) Check whenever etc/ramfb is present.
(2) Allocate framebuffer from RAM.
(3) Fill struct RAMFBCfg, write it to etc/ramfb.

Done. You can write stuff to the framebuffer now, and it should appear automagically on the screen.

Note that this isn't very efficient because it does a full display update on each refresh. No dirty tracking. Dirty tracking would have to be active for the whole ram slot, so that wouldn't be very efficient either. For a boot display which is active for a short time only this isn't a big deal. As permanent guest display something better should be used (if possible).

This is the ramfb core code. Some windup is needed for display devices which want have a ramfb boot display.

---
 include/hw/display/ramfb.h |  9 +++++
 hw/display/ramfb.c         | 95 ++++++++++++++++++++++++++++++++++++++++++++++
 hw/display/Makefile.objs   |  2 +
 3 files changed, 106 insertions(+)
 create mode 100644 include/hw/display/ramfb.h
 create mode 100644 hw/display/ramfb.c
include/hw/display/ramfb.h new file +9 -0
new file mode 100644
index 0000000000..a3d4c79942
@@ -0,0 +1,9 @@
+#ifndef RAMFB_H
+#define RAMFB_H
+
+/* ramfb.c */
+typedef struct RAMFBState RAMFBState;
+void ramfb_display_update(QemuConsole *con, RAMFBState *s);
+RAMFBState *ramfb_setup(Error **errp);
+
+#endif /* RAMFB_H */
hw/display/ramfb.c new file +95 -0

95 lines not on this page · raw message

hw/display/Makefile.objs +2 -0
index b5d97ab26d..0af04985d2 100644
@@ -1,3 +1,5 @@
+common-obj-y += ramfb.o
+
 common-obj-$(CONFIG_ADS7846) += ads7846.o
 common-obj-$(CONFIG_VGA_CIRRUS) += cirrus_vga.o
 common-obj-$(CONFIG_G364FB) += g364fb.o
Signature · 1 line
2.9.3
#2 lore raw

PATCH v4 2/3 hw/display: add standalone ramfb device

In reply to Gerd Hoffmann
---
 include/hw/display/ramfb.h    |  3 +++
 hw/arm/sysbus-fdt.c           |  7 +++++
 hw/arm/virt.c                 |  2 ++
 hw/display/ramfb-standalone.c | 62 +++++++++++++++++++++++++++++++++++++++++++
 hw/i386/pc_piix.c             |  2 ++
 hw/i386/pc_q35.c              |  2 ++
 hw/display/Makefile.objs      |  1 +
 7 files changed, 79 insertions(+)
 create mode 100644 hw/display/ramfb-standalone.c
include/hw/display/ramfb.h +3 -0
index a3d4c79942..b33a2c467b 100644
@@ -6,4 +6,7 @@ typedef struct RAMFBState RAMFBState;
 void ramfb_display_update(QemuConsole *con, RAMFBState *s);
 RAMFBState *ramfb_setup(Error **errp);
 
+/* ramfb-standalone.c */
+#define TYPE_RAMFB_DEVICE "ramfb"
+
 #endif /* RAMFB_H */
hw/arm/sysbus-fdt.c +7 -0
index e4c492ea44..277ed872e7 100644
@@ -36,6 +36,7 @@
 #include "hw/vfio/vfio-platform.h"
 #include "hw/vfio/vfio-calxeda-xgmac.h"
 #include "hw/vfio/vfio-amd-xgbe.h"
+#include "hw/display/ramfb.h"
 #include "hw/arm/fdt.h"
 
 /*
@@ -406,12 +407,18 @@ static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev, void *opaque)
 
 #endif /* CONFIG_LINUX */
 
+static int no_fdt_node(SysBusDevice *sbdev, void *opaque)
+{
+    return 0;
+}
+
 /* list of supported dynamic sysbus devices */
 static const NodeCreationPair add_fdt_node_functions[] = {
 #ifdef CONFIG_LINUX
     {TYPE_VFIO_CALXEDA_XGMAC, add_calxeda_midway_xgmac_fdt_node},
     {TYPE_VFIO_AMD_XGBE, add_amd_xgbe_fdt_node},
 #endif
+    {TYPE_RAMFB_DEVICE, no_fdt_node},
     {"", NULL}, /* last element */
 };
 
hw/arm/virt.c +2 -0
index f0a4fa004c..98b99cf236 100644
@@ -36,6 +36,7 @@
 #include "hw/arm/virt.h"
 #include "hw/vfio/vfio-calxeda-xgmac.h"
 #include "hw/vfio/vfio-amd-xgbe.h"
+#include "hw/display/ramfb.h"
 #include "hw/devices.h"
 #include "net/net.h"
 #include "sysemu/device_tree.h"
@@ -1659,6 +1660,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
     mc->max_cpus = 255;
     machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_CALXEDA_XGMAC);
     machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_AMD_XGBE);
+    machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE);
     mc->block_default_type = IF_VIRTIO;
     mc->no_cdrom = 1;
     mc->pci_allow_0_address = true;
hw/display/ramfb-standalone.c new file +62 -0

62 lines not on this page · raw message

hw/i386/pc_piix.c +2 -0
index 3b87f3cedb..e9b6f064fb 100644
@@ -28,6 +28,7 @@
 #include "hw/loader.h"
 #include "hw/i386/pc.h"
 #include "hw/i386/apic.h"
+#include "hw/display/ramfb.h"
 #include "hw/smbios/smbios.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_ids.h"
@@ -423,6 +424,7 @@ static void pc_i440fx_machine_options(MachineClass *m)
     m->desc = "Standard PC (i440FX + PIIX, 1996)";
     m->default_machine_opts = "firmware=bios-256k.bin";
     m->default_display = "std";
+    machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
 }
 
 static void pc_i440fx_3_0_machine_options(MachineClass *m)
hw/i386/pc_q35.c +2 -0
index 087f2630f9..1a73e1848a 100644
@@ -45,6 +45,7 @@
 #include "hw/i386/ich9.h"
 #include "hw/i386/amd_iommu.h"
 #include "hw/i386/intel_iommu.h"
+#include "hw/display/ramfb.h"
 #include "hw/smbios/smbios.h"
 #include "hw/ide/pci.h"
 #include "hw/ide/ahci.h"
@@ -305,6 +306,7 @@ static void pc_q35_machine_options(MachineClass *m)
     m->no_floppy = 1;
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE);
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
+    machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
     m->max_cpus = 288;
 }
 
hw/display/Makefile.objs +1 -0
index 0af04985d2..fb8408c6d0 100644
@@ -1,4 +1,5 @@
 common-obj-y += ramfb.o
+common-obj-y += ramfb-standalone.o
 
 common-obj-$(CONFIG_ADS7846) += ads7846.o
 common-obj-$(CONFIG_VGA_CIRRUS) += cirrus_vga.o
Signature · 1 line
2.9.3
#3 lore raw

PATCH v4 3/3 hw/vfio/display: add ramfb support

In reply to Gerd Hoffmann

So we have a boot display when using a vgpu as primary display.

Use vfio-pci-ramfb instead of vfio-pci to enable it.

---
 include/hw/vfio/vfio-common.h |  2 ++
 hw/vfio/display.c             | 10 ++++++++++
 hw/vfio/pci.c                 | 15 +++++++++++++++
 3 files changed, 27 insertions(+)
include/hw/vfio/vfio-common.h +2 -0
index a9036929b2..a58d7e7e77 100644
@@ -26,6 +26,7 @@
 #include "qemu/queue.h"
 #include "qemu/notify.h"
 #include "ui/console.h"
+#include "hw/display/ramfb.h"
 #ifdef CONFIG_LINUX
 #include <linux/vfio.h>
 #endif
@@ -143,6 +144,7 @@ typedef struct VFIODMABuf {
 
 typedef struct VFIODisplay {
     QemuConsole *con;
+    RAMFBState *ramfb;
     struct {
         VFIORegion buffer;
         DisplaySurface *surface;
hw/vfio/display.c +10 -0
index 59c0e5d1d7..409d5a2e3a 100644
@@ -124,6 +124,9 @@ static void vfio_display_dmabuf_update(void *opaque)
 
     primary = vfio_display_get_dmabuf(vdev, DRM_PLANE_TYPE_PRIMARY);
     if (primary == NULL) {
+        if (dpy->ramfb) {
+            ramfb_display_update(dpy->con, dpy->ramfb);
+        }
         return;
     }
 
@@ -181,6 +184,8 @@ static int vfio_display_dmabuf_init(VFIOPCIDevice *vdev, Error **errp)
     vdev->dpy->con = graphic_console_init(DEVICE(vdev), 0,
                                           &vfio_display_dmabuf_ops,
                                           vdev);
+    if (strcmp(object_get_typename(OBJECT(vdev)), "vfio-pci-ramfb") == 0)
+        vdev->dpy->ramfb = ramfb_setup(errp);
     return 0;
 }
 
@@ -228,6 +233,9 @@ static void vfio_display_region_update(void *opaque)
         return;
     }
     if (!plane.drm_format || !plane.size) {
+        if (dpy->ramfb) {
+            ramfb_display_update(dpy->con, dpy->ramfb);
+        }
         return;
     }
     format = qemu_drm_format_to_pixman(plane.drm_format);
@@ -300,6 +308,8 @@ static int vfio_display_region_init(VFIOPCIDevice *vdev, Error **errp)
     vdev->dpy->con = graphic_console_init(DEVICE(vdev), 0,
                                           &vfio_display_region_ops,
                                           vdev);
+    if (strcmp(object_get_typename(OBJECT(vdev)), "vfio-pci-ramfb") == 0)
+        vdev->dpy->ramfb = ramfb_setup(errp);
     return 0;
 }
 
hw/vfio/pci.c +15 -0
index 18c493b49e..6a2b42a595 100644
@@ -3234,9 +3234,24 @@ static const TypeInfo vfio_pci_dev_info = {
     },
 };
 
+static void vfio_pci_ramfb_dev_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->hotpluggable = false;
+}
+
+static const TypeInfo vfio_pci_ramfb_dev_info = {
+    .name = "vfio-pci-ramfb",
+    .parent = "vfio-pci",
+    .instance_size = sizeof(VFIOPCIDevice),
+    .class_init = vfio_pci_ramfb_dev_class_init,
+};
+
 static void register_vfio_pci_dev_type(void)
 {
     type_register_static(&vfio_pci_dev_info);
+    type_register_static(&vfio_pci_ramfb_dev_info);
 }
 
 type_init(register_vfio_pci_dev_type)
Signature · 1 line
2.9.3
#4 lore raw

Re: [Qemu-arm] [PATCH v4 3/3] hw/vfio/display: add ramfb support

Quoted 3 lines · On Wed, 13 Jun 2018 10:41:49 +0200 Gerd Hoffmann <[email protected]> wrote:

So we have a boot display when using a vgpu as primary display.

Use vfio-pci-ramfb instead of vfio-pci to enable it.

Using a different device here seems like it almost guarantees a very complicated path to support under libvirt. What necessitates this versus a simple ramfb=on option to vfio-pci?

I'm also not sure I understand the usage model, SeaBIOS and OVMF know how to write to this display, but it seems that the guest does not. I suppose in the UEFI case runtime services can be used to continue writing this display, but BIOS doesn't have such an option, unless we're somehow emulating VGA here. So for UEFI, I can imagine this covers us from power on through firmware boot and up to guest drivers initializing the GPU (assuming the vGPU supports a kernel mode driver, does NVIDIA?), but for BIOS it seems we likely still have a break from the bootloader to GPU driver initialization. For instance, what driver is used to draw the boot animation (or blue screen) on SeaBIOS Windows VM? I'm assuming that this display and the vGPU display are one in the same, so there's some cut from one to the other. Thanks,

Alex

Quoted 98 lines
---
 include/hw/vfio/vfio-common.h |  2 ++
 hw/vfio/display.c             | 10 ++++++++++
 hw/vfio/pci.c                 | 15 +++++++++++++++
 3 files changed, 27 insertions(+)
include/hw/vfio/vfio-common.h +2 -0
index a9036929b2..a58d7e7e77 100644
@@ -26,6 +26,7 @@
 #include "qemu/queue.h"
 #include "qemu/notify.h"
 #include "ui/console.h"
+#include "hw/display/ramfb.h"
 #ifdef CONFIG_LINUX
 #include <linux/vfio.h>
 #endif
@@ -143,6 +144,7 @@ typedef struct VFIODMABuf {
 
 typedef struct VFIODisplay {
     QemuConsole *con;
+    RAMFBState *ramfb;
     struct {
         VFIORegion buffer;
         DisplaySurface *surface;
hw/vfio/display.c +10 -0
index 59c0e5d1d7..409d5a2e3a 100644
@@ -124,6 +124,9 @@ static void vfio_display_dmabuf_update(void *opaque)
 
     primary = vfio_display_get_dmabuf(vdev, DRM_PLANE_TYPE_PRIMARY);
     if (primary == NULL) {
+        if (dpy->ramfb) {
+            ramfb_display_update(dpy->con, dpy->ramfb);
+        }
         return;
     }
 
@@ -181,6 +184,8 @@ static int vfio_display_dmabuf_init(VFIOPCIDevice *vdev, Error **errp)
     vdev->dpy->con = graphic_console_init(DEVICE(vdev), 0,
                                           &vfio_display_dmabuf_ops,
                                           vdev);
+    if (strcmp(object_get_typename(OBJECT(vdev)), "vfio-pci-ramfb") == 0)
+        vdev->dpy->ramfb = ramfb_setup(errp);
     return 0;
 }
 
@@ -228,6 +233,9 @@ static void vfio_display_region_update(void *opaque)
         return;
     }
     if (!plane.drm_format || !plane.size) {
+        if (dpy->ramfb) {
+            ramfb_display_update(dpy->con, dpy->ramfb);
+        }
         return;
     }
     format = qemu_drm_format_to_pixman(plane.drm_format);
@@ -300,6 +308,8 @@ static int vfio_display_region_init(VFIOPCIDevice *vdev, Error **errp)
     vdev->dpy->con = graphic_console_init(DEVICE(vdev), 0,
                                           &vfio_display_region_ops,
                                           vdev);
+    if (strcmp(object_get_typename(OBJECT(vdev)), "vfio-pci-ramfb") == 0)
+        vdev->dpy->ramfb = ramfb_setup(errp);
     return 0;
 }
 
hw/vfio/pci.c +15 -0
index 18c493b49e..6a2b42a595 100644
@@ -3234,9 +3234,24 @@ static const TypeInfo vfio_pci_dev_info = {
     },
 };
 
+static void vfio_pci_ramfb_dev_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->hotpluggable = false;
+}
+
+static const TypeInfo vfio_pci_ramfb_dev_info = {
+    .name = "vfio-pci-ramfb",
+    .parent = "vfio-pci",
+    .instance_size = sizeof(VFIOPCIDevice),
+    .class_init = vfio_pci_ramfb_dev_class_init,
+};
+
 static void register_vfio_pci_dev_type(void)
 {
     type_register_static(&vfio_pci_dev_info);
+    type_register_static(&vfio_pci_ramfb_dev_info);
 }
 
 type_init(register_vfio_pci_dev_type)
#5 lore raw

Re: [Qemu-arm] [PATCH v4 3/3] hw/vfio/display: add ramfb support

Quoted 10 lines · Alex Williamson
Quoted 3 lines · On Wed, 13 Jun 2018 10:41:49 +0200 Gerd Hoffmann <[email protected]> wrote:

So we have a boot display when using a vgpu as primary display.

Use vfio-pci-ramfb instead of vfio-pci to enable it.

Using a different device here seems like it almost guarantees a very complicated path to support under libvirt. What necessitates this versus a simple ramfb=on option to vfio-pci?

Well, it's simliar to qxl vs. qxl-vga. It's not qxl,vga={on,off} and libvirt has no problems to deal with that ...

Another more technical reason is (again) hotplug. ramfb needs an fw_cfg entry for configuration, and fw_cfg entries can't be hotplugged. So hotplugging vfio-pci with ramfb=on isn't going to fly. So we need a separate device with hotplug turned off.

Quoted 2 lines

I'm also not sure I understand the usage model, SeaBIOS and OVMF know how to write to this display, but it seems that the guest does not.

Yes.

Quoted 2 lines

I suppose in the UEFI case runtime services can be used to continue writing this display,

Yes.

Quoted 2 lines

but BIOS doesn't have such an option, unless we're somehow emulating VGA here.

vgabios support is in the pipeline, including text mode emulation (at vgabios level, direct access to vga window @ 0xa0000 doesn't work).

Quoted 4 lines

So for UEFI, I can imagine this
covers us from power on through firmware boot and up to guest drivers initializing the GPU (assuming the vGPU supports a kernel mode driver, does NVIDIA?),

Yes. Shouldn't matter whenever the driver is kernel or userspace.

Quoted 2 lines

but for BIOS it seems we likely still have a break from the bootloader to GPU driver initialization.

Depends. vgacon (text mode console) doesn't work. fbcon @ vesafb works.

Quoted 3 lines

For instance, what driver
is used to draw the boot animation (or blue screen) on SeaBIOS Windows VM?

Windows depends on vgabios for that and it works fine.

Quoted 2 lines

I'm assuming that this display and the vGPU display are one in the same, so there's some cut from one to the other.

Yes. If the vfio query plane ioctl reports a valid guest video mode configuration the vgpu display will be used, ramfb otherwise.

cheers,
Gerd

#6 lore raw

Re: [Qemu-arm] [PATCH v4 3/3] hw/vfio/display: add ramfb support

Quoted 6 lines · Gerd Hoffmann
Quoted 2 lines · Alex Williamson

I suppose in the UEFI case runtime services can be used to continue writing this display,

Yes.

Small clarification for the wording -- "UEFI runtime services" do not include anything display- or graphics-related. Instead, the OS kernel may inherit the framebuffer properties (base address, size, pixel format), and continue accessing the framebuffer directly.

Thanks
Laszlo

#7 lore raw

Re: [Qemu-devel] [PATCH v4 3/3] hw/vfio/display: add ramfb support

In reply to Gerd Hoffmann
Quoted 12 lines · Gerd Hoffmann
Quoted 10 lines · Alex Williamson
Quoted 3 lines · On Wed, 13 Jun 2018 10:41:49 +0200 Gerd Hoffmann <[email protected]> wrote:

So we have a boot display when using a vgpu as primary display.

Use vfio-pci-ramfb instead of vfio-pci to enable it.

Using a different device here seems like it almost guarantees a very complicated path to support under libvirt. What necessitates this versus a simple ramfb=on option to vfio-pci?

Quoted 7 lines

Well, it's simliar to qxl vs. qxl-vga. It's not qxl,vga={on,off} and libvirt has no problems to deal with that ...

Another more technical reason is (again) hotplug. ramfb needs an fw_cfg entry for configuration, and fw_cfg entries can't be hotplugged. So hotplugging vfio-pci with ramfb=on isn't going to fly. So we need a separate device with hotplug turned off.

Well if that's not supposed to work ever, libvirt's hotplug code could format the following FWIW:
"-device vfio-pci [opts],ramfb=off"

As such, new device wouldn't be that of an issue for libvirt if vfio-pci and vfio-pci-ramfb are back to back compatible with all the device options that are available for vfio-pci (I mean in terms of using an mdev). Because in that case, what libvirt could do is to look whether we're supposed to turn on the display, if so, then we need support for this in capabilities to query and then we could prefer this new device over the "legacy" vfio-pci one. However, if we expect a case where QEMU would succeed to start with an mdev mapped to this new ramfb device but not with vfio-pci, then that's an issue. Otherwise I don't necessarily see a problem, if QEMU supports this new device and we need display, let's use that, otherwise let's use the old vfio-pci device. But I'm still curious about the ramfb=off possibility I asked above for hotplug nonetheless.

Thanks,
Erik

Quoted 44 lines
Quoted 3 lines

I'm also not sure I understand the usage model, SeaBIOS and OVMF know how to write to this display, but it seems that the guest does not.

Yes.

Quoted 2 lines

I suppose in the UEFI case runtime services can be used to continue writing this display,

Yes.

Quoted 2 lines

but BIOS doesn't have such an option, unless we're somehow emulating VGA here.

vgabios support is in the pipeline, including text mode emulation (at vgabios level, direct access to vga window @ 0xa0000 doesn't work).

Quoted 4 lines

So for UEFI, I can imagine this
covers us from power on through firmware boot and up to guest drivers initializing the GPU (assuming the vGPU supports a kernel mode driver, does NVIDIA?),

Yes. Shouldn't matter whenever the driver is kernel or userspace.

Quoted 2 lines

but for BIOS it seems we likely still have a break from the bootloader to GPU driver initialization.

Depends. vgacon (text mode console) doesn't work. fbcon @ vesafb works.

Quoted 3 lines

For instance, what driver
is used to draw the boot animation (or blue screen) on SeaBIOS Windows VM?

Windows depends on vgabios for that and it works fine.

Quoted 2 lines

I'm assuming that this display and the vGPU display are one in the same, so there's some cut from one to the other.

Yes. If the vfio query plane ioctl reports a valid guest video mode configuration the vgpu display will be used, ramfb otherwise.

cheers,
Gerd

#8 lore raw

Re: [Qemu-arm] [PATCH v4 3/3] hw/vfio/display: add ramfb support

Quoted 12 lines
Quoted 7 lines

Well, it's simliar to qxl vs. qxl-vga. It's not qxl,vga={on,off} and libvirt has no problems to deal with that ...

Another more technical reason is (again) hotplug. ramfb needs an fw_cfg entry for configuration, and fw_cfg entries can't be hotplugged. So hotplugging vfio-pci with ramfb=on isn't going to fly. So we need a separate device with hotplug turned off.

Well if that's not supposed to work ever, libvirt's hotplug code could format the following FWIW:
"-device vfio-pci [opts],ramfb=off"

Quoted 8 lines

As such, new device wouldn't be that of an issue for libvirt if vfio-pci and vfio-pci-ramfb are back to back compatible with all the device options that are available for vfio-pci (I mean in terms of using an mdev). Because in that case, what libvirt could do is to look whether we're supposed to turn on the display, if so, then we need support for this in capabilities to query and then we could prefer this new device over the "legacy" vfio-pci one. However, if we expect a case where QEMU would succeed to start with an mdev mapped to this new ramfb device but not with vfio-pci, then that's an issue.

vfio-pci and vfio-pci-ramfb are identical, except for the later having a boot display (with display=on), and vfio-pci-ramfb not being hotplugable. So, yes, all pcu/mdev devices should work with both vfio-pci variants.

Quoted 2 lines

But I'm still curious about the ramfb=off possibility I asked above for hotplug nonetheless.

Well, the problem is introspection. qemu can report via qmp whenever a specific device supports hotplug. A device which can both be hot-pluggable or not hot-pluggable depending on some condition is a problem here ...

cheers,
Gerd

#9 lore raw
In reply to Gerd Hoffmann
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH v4 0/3] ramfb: simple boot framebuffer

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu

 * [new tag]               patchew/[email protected] -> patchew/[email protected]
 t [tag update]            patchew/[email protected] -> patchew/[email protected]
 t [tag update]            patchew/[email protected] -> patchew/[email protected]
 * [new tag]               patchew/[email protected] -> patchew/[email protected]

Switched to a new branch 'test'
a3f6289703 hw/vfio/display: add ramfb support
e928364fde hw/display: add standalone ramfb device
271494a174 hw/display: add ramfb, a simple boot framebuffer living in guest ram

=== OUTPUT BEGIN ===
Checking PATCH 1/3: hw/display: add ramfb, a simple boot framebuffer living in guest ram...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #41:
new file mode 100644

total: 0 errors, 1 warnings, 109 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 2/3: hw/display: add standalone ramfb device...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #71:
new file mode 100644

total: 0 errors, 1 warnings, 141 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 3/3: hw/vfio/display: add ramfb support...
ERROR: braces {} are necessary for all arms of this statement #31: FILE: hw/vfio/display.c:187:
+ if (strcmp(object_get_typename(OBJECT(vdev)), "vfio-pci-ramfb") == 0)
[...]

ERROR: braces {} are necessary for all arms of this statement #50: FILE: hw/vfio/display.c:311:
+ if (strcmp(object_get_typename(OBJECT(vdev)), "vfio-pci-ramfb") == 0)
[...]

total: 2 errors, 0 warnings, 72 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]