* [PATCH v9 0/2] ramfb: Add property to control if load the romfile
@ 2025-07-04 3:03 Shaoqin Huang
2025-07-04 3:03 ` [PATCH v9 1/2] " Shaoqin Huang
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Shaoqin Huang @ 2025-07-04 3:03 UTC (permalink / raw)
To: qemu-arm, Daniel P. Berrangé, Peter Maydell, Gerd Hoffmann,
Eric Auger, Paolo Bonzini
Cc: Zhao Liu, Shaoqin Huang, Alex Williamson, Cédric Le Goater,
Eduardo Habkost, Marcel Apfelbaum, Michael S. Tsirkin,
Philippe Mathieu-Daudé, qemu-devel, Richard Henderson,
Sergio Lopez, Yanan Wang
Currently the ramfb device loads the vgabios-ramfb.bin unconditionally, but only
the x86 need the vgabios-ramfb.bin, this can cause that when use the
release package on arm64 it can't find the vgabios-ramfb.bin.
Because only seabios will use the vgabios-ramfb.bin, load the rom logic
is x86-specific. For other !x86 platforms, the edk2 ships an EFI driver
for ramfb, so they don't need to load the romfile.
So add a new property use-legacy-x86-rom in both ramfb and vfio_pci
device, because the vfio display also use the ramfb_setup() to load
the vgabios-ramfb.bin file.
After have this property, the machine type can set the compatibility to
not load the vgabios-ramfb.bin if the arch doesn't need it.
Then I set the use_legacy_x86_rom property to false by default, and only set it
to true on x86 since only x86 will need it.
At the same time, set the "use-legacy-x86-rom" property to true on those
historical versioned machine types in order to avoid the memory layout
being changed.
Changelog:
---------
v8 -> v9:
- Improve the commit message.
v7 -> v8:
- Set the property in microvm machine type.
v6 -> v7:
- Set the property into hw_compat_10_0 instead of hw_compat_9_2.
v5 -> v6:
- Set the property to true on those historical versioned machine types.
v4 -> v5:
- Fix some typo error.
- Set the property in piix machine type.
v3 -> v4:
- Set the new property to false by default, only set it to true on x86.
v2 -> v3:
- Fix the underscore error.
- Add a new patch to set the property in arm compatibility.
v1 -> v2:
- Change the property name.
v7: https://lore.kernel.org/all/20250702085616.2172722-1-shahuang@redhat.com/
v6: https://lore.kernel.org/all/20250701030549.2153331-1-shahuang@redhat.com/
v5: https://lore.kernel.org/all/20250626034526.2136585-1-shahuang@redhat.com/
v4: https://lore.kernel.org/all/20250617030521.2109305-1-shahuang@redhat.com/
v3: https://lore.kernel.org/all/20250609073408.2083831-1-shahuang@redhat.com/
v2: https://lore.kernel.org/all/20250606070234.2063451-1-shahuang@redhat.com/
v1: https://lore.kernel.org/all/20250605030351.2056571-1-shahuang@redhat.com/
Shaoqin Huang (2):
ramfb: Add property to control if load the romfile
hw/i386: Add the ramfb romfile compatibility
hw/core/machine.c | 2 ++
hw/display/ramfb-standalone.c | 4 +++-
hw/display/ramfb-stubs.c | 2 +-
hw/display/ramfb.c | 6 ++++--
hw/i386/microvm.c | 3 +++
hw/i386/pc_piix.c | 10 ++++++++++
hw/i386/pc_q35.c | 3 +++
hw/vfio/display.c | 4 ++--
hw/vfio/pci.c | 1 +
hw/vfio/pci.h | 1 +
include/hw/display/ramfb.h | 2 +-
11 files changed, 31 insertions(+), 7 deletions(-)
--
2.40.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v9 1/2] ramfb: Add property to control if load the romfile
2025-07-04 3:03 [PATCH v9 0/2] ramfb: Add property to control if load the romfile Shaoqin Huang
@ 2025-07-04 3:03 ` Shaoqin Huang
2025-07-10 9:11 ` Zhao Liu
2025-07-04 3:03 ` [PATCH v9 2/2] hw/i386: Add the ramfb romfile compatibility Shaoqin Huang
2025-07-09 2:18 ` [PATCH v9 0/2] ramfb: Add property to control if load the romfile Shaoqin Huang
2 siblings, 1 reply; 7+ messages in thread
From: Shaoqin Huang @ 2025-07-04 3:03 UTC (permalink / raw)
To: qemu-arm, Daniel P. Berrangé, Peter Maydell, Gerd Hoffmann,
Eric Auger, Paolo Bonzini
Cc: Zhao Liu, Shaoqin Huang, Eric Auger, Alex Williamson,
Cédric Le Goater, qemu-devel
Currently the ramfb device loads the vgabios-ramfb.bin unconditionally,
but only the x86 need the vgabios-ramfb.bin, this can cause that when
use the release package on arm64 it can't find the vgabios-ramfb.bin.
Because only seabios will use the vgabios-ramfb.bin, load the rom logic
is x86-specific. For other !x86 platforms, the edk2 ships an EFI driver
for ramfb, so they don't need to load the romfile.
So add a new property use-legacy-x86-rom in both ramfb and vfio_pci
device, because the vfio display also use the ramfb_setup() to load
the vgabios-ramfb.bin file.
After have this property, the machine type can set the compatibility to
not load the vgabios-ramfb.bin if the arch doesn't need it.
For now the default value is true but it will be turned off by default
in subsequent patch when compats get properly handled.
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Shaoqin Huang <shahuang@redhat.com>
---
hw/display/ramfb-standalone.c | 4 +++-
hw/display/ramfb-stubs.c | 2 +-
hw/display/ramfb.c | 6 ++++--
hw/vfio/display.c | 4 ++--
hw/vfio/pci.c | 1 +
hw/vfio/pci.h | 1 +
include/hw/display/ramfb.h | 2 +-
7 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/hw/display/ramfb-standalone.c b/hw/display/ramfb-standalone.c
index 08f2d5db4e..725aef9896 100644
--- a/hw/display/ramfb-standalone.c
+++ b/hw/display/ramfb-standalone.c
@@ -17,6 +17,7 @@ struct RAMFBStandaloneState {
QemuConsole *con;
RAMFBState *state;
bool migrate;
+ bool use_legacy_x86_rom;
};
static void display_update_wrapper(void *dev)
@@ -39,7 +40,7 @@ static void ramfb_realizefn(DeviceState *dev, Error **errp)
RAMFBStandaloneState *ramfb = RAMFB(dev);
ramfb->con = graphic_console_init(dev, 0, &wrapper_ops, dev);
- ramfb->state = ramfb_setup(errp);
+ ramfb->state = ramfb_setup(ramfb->use_legacy_x86_rom, errp);
}
static bool migrate_needed(void *opaque)
@@ -62,6 +63,7 @@ static const VMStateDescription ramfb_dev_vmstate = {
static const Property ramfb_properties[] = {
DEFINE_PROP_BOOL("x-migrate", RAMFBStandaloneState, migrate, true),
+ DEFINE_PROP_BOOL("use-legacy-x86-rom", RAMFBStandaloneState, use_legacy_x86_rom, true),
};
static void ramfb_class_initfn(ObjectClass *klass, const void *data)
diff --git a/hw/display/ramfb-stubs.c b/hw/display/ramfb-stubs.c
index cf64733b10..b83551357b 100644
--- a/hw/display/ramfb-stubs.c
+++ b/hw/display/ramfb-stubs.c
@@ -8,7 +8,7 @@ void ramfb_display_update(QemuConsole *con, RAMFBState *s)
{
}
-RAMFBState *ramfb_setup(Error **errp)
+RAMFBState *ramfb_setup(bool romfile, Error **errp)
{
error_setg(errp, "ramfb support not available");
return NULL;
diff --git a/hw/display/ramfb.c b/hw/display/ramfb.c
index 8c0f907673..9a17d97d07 100644
--- a/hw/display/ramfb.c
+++ b/hw/display/ramfb.c
@@ -135,7 +135,7 @@ const VMStateDescription ramfb_vmstate = {
}
};
-RAMFBState *ramfb_setup(Error **errp)
+RAMFBState *ramfb_setup(bool romfile, Error **errp)
{
FWCfgState *fw_cfg = fw_cfg_find();
RAMFBState *s;
@@ -147,7 +147,9 @@ RAMFBState *ramfb_setup(Error **errp)
s = g_new0(RAMFBState, 1);
- rom_add_vga("vgabios-ramfb.bin");
+ if (romfile) {
+ rom_add_vga("vgabios-ramfb.bin");
+ }
fw_cfg_add_file_callback(fw_cfg, "etc/ramfb",
NULL, ramfb_fw_cfg_write, s,
&s->cfg, sizeof(s->cfg), false);
diff --git a/hw/vfio/display.c b/hw/vfio/display.c
index 9c6f5aa265..faacd9019a 100644
--- a/hw/vfio/display.c
+++ b/hw/vfio/display.c
@@ -365,7 +365,7 @@ static bool vfio_display_dmabuf_init(VFIOPCIDevice *vdev, Error **errp)
&vfio_display_dmabuf_ops,
vdev);
if (vdev->enable_ramfb) {
- vdev->dpy->ramfb = ramfb_setup(errp);
+ vdev->dpy->ramfb = ramfb_setup(vdev->use_legacy_x86_rom, errp);
if (!vdev->dpy->ramfb) {
return false;
}
@@ -494,7 +494,7 @@ static bool vfio_display_region_init(VFIOPCIDevice *vdev, Error **errp)
&vfio_display_region_ops,
vdev);
if (vdev->enable_ramfb) {
- vdev->dpy->ramfb = ramfb_setup(errp);
+ vdev->dpy->ramfb = ramfb_setup(vdev->use_legacy_x86_rom, errp);
if (!vdev->dpy->ramfb) {
return false;
}
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index fa25bded25..f4fa8a5610 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -3710,6 +3710,7 @@ static const TypeInfo vfio_pci_dev_info = {
static const Property vfio_pci_dev_nohotplug_properties[] = {
DEFINE_PROP_BOOL("ramfb", VFIOPCIDevice, enable_ramfb, false),
+ DEFINE_PROP_BOOL("use-legacy-x86-rom", VFIOPCIDevice, use_legacy_x86_rom, true),
DEFINE_PROP_ON_OFF_AUTO("x-ramfb-migrate", VFIOPCIDevice, ramfb_migrate,
ON_OFF_AUTO_AUTO),
};
diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
index 5ba7330b27..97319670b2 100644
--- a/hw/vfio/pci.h
+++ b/hw/vfio/pci.h
@@ -188,6 +188,7 @@ struct VFIOPCIDevice {
bool no_kvm_ioeventfd;
bool no_vfio_ioeventfd;
bool enable_ramfb;
+ bool use_legacy_x86_rom;
OnOffAuto ramfb_migrate;
bool defer_kvm_irq_routing;
bool clear_parent_atomics_on_exit;
diff --git a/include/hw/display/ramfb.h b/include/hw/display/ramfb.h
index a7e0019144..172aa6dc89 100644
--- a/include/hw/display/ramfb.h
+++ b/include/hw/display/ramfb.h
@@ -6,7 +6,7 @@
/* ramfb.c */
typedef struct RAMFBState RAMFBState;
void ramfb_display_update(QemuConsole *con, RAMFBState *s);
-RAMFBState *ramfb_setup(Error **errp);
+RAMFBState *ramfb_setup(bool romfile, Error **errp);
extern const VMStateDescription ramfb_vmstate;
--
2.40.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v9 2/2] hw/i386: Add the ramfb romfile compatibility
2025-07-04 3:03 [PATCH v9 0/2] ramfb: Add property to control if load the romfile Shaoqin Huang
2025-07-04 3:03 ` [PATCH v9 1/2] " Shaoqin Huang
@ 2025-07-04 3:03 ` Shaoqin Huang
2025-07-10 10:07 ` Zhao Liu
2025-07-13 21:02 ` Michael S. Tsirkin
2025-07-09 2:18 ` [PATCH v9 0/2] ramfb: Add property to control if load the romfile Shaoqin Huang
2 siblings, 2 replies; 7+ messages in thread
From: Shaoqin Huang @ 2025-07-04 3:03 UTC (permalink / raw)
To: qemu-arm, Daniel P. Berrangé, Peter Maydell, Gerd Hoffmann,
Eric Auger, Paolo Bonzini
Cc: Zhao Liu, Shaoqin Huang, Eric Auger, Eduardo Habkost,
Marcel Apfelbaum, Philippe Mathieu-Daudé, Yanan Wang,
Sergio Lopez, Richard Henderson, Michael S. Tsirkin,
Alex Williamson, Cédric Le Goater, qemu-devel
ramfb is a sysbus device so it can only used for machine types where it
is explicitly enabled:
# git grep machine_class_allow_dynamic_sysbus_dev.*TYPE_RAMFB_DEVICE
hw/arm/virt.c: machine_class_allow_dynamic_sysbus_dev(mc,
TYPE_RAMFB_DEVICE);
hw/i386/microvm.c: machine_class_allow_dynamic_sysbus_dev(mc,
TYPE_RAMFB_DEVICE);
hw/i386/pc_piix.c: machine_class_allow_dynamic_sysbus_dev(m,
TYPE_RAMFB_DEVICE);
hw/i386/pc_q35.c: machine_class_allow_dynamic_sysbus_dev(m,
TYPE_RAMFB_DEVICE);
hw/loongarch/virt.c: machine_class_allow_dynamic_sysbus_dev(mc,
TYPE_RAMFB_DEVICE);
hw/riscv/virt.c: machine_class_allow_dynamic_sysbus_dev(mc,
TYPE_RAMFB_DEVICE);
So these six are the only machine types we have to worry about.
The three x86 machine types (pc, q35, microvm) will actually use the rom
(when booting with seabios).
For arm/riscv/loongarch virt we want to disable the rom.
This patch sets ramfb romfile option to false by default, except for x86
machines types (pc, q35, microvm) which need the rom file when booting
with seabios and machine types <= 10.0 (handling the case of arm virt,
for compat reasons).
At the same time, set the "use-legacy-x86-rom" property to true on those
historical versioned machine types in order to avoid the memory layout
being changed.
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Shaoqin Huang <shahuang@redhat.com>
---
hw/core/machine.c | 2 ++
hw/display/ramfb-standalone.c | 2 +-
hw/i386/microvm.c | 3 +++
hw/i386/pc_piix.c | 10 ++++++++++
hw/i386/pc_q35.c | 3 +++
hw/vfio/pci.c | 2 +-
6 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index e869821b22..a7043e2a34 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -39,6 +39,8 @@
GlobalProperty hw_compat_10_0[] = {
{ "scsi-hd", "dpofua", "off" },
+ { "ramfb", "use-legacy-x86-rom", "true"},
+ { "vfio-pci", "use-legacy-x86-rom", "true" },
};
const size_t hw_compat_10_0_len = G_N_ELEMENTS(hw_compat_10_0);
diff --git a/hw/display/ramfb-standalone.c b/hw/display/ramfb-standalone.c
index 725aef9896..b20a7c57b3 100644
--- a/hw/display/ramfb-standalone.c
+++ b/hw/display/ramfb-standalone.c
@@ -63,7 +63,7 @@ static const VMStateDescription ramfb_dev_vmstate = {
static const Property ramfb_properties[] = {
DEFINE_PROP_BOOL("x-migrate", RAMFBStandaloneState, migrate, true),
- DEFINE_PROP_BOOL("use-legacy-x86-rom", RAMFBStandaloneState, use_legacy_x86_rom, true),
+ DEFINE_PROP_BOOL("use-legacy-x86-rom", RAMFBStandaloneState, use_legacy_x86_rom, false),
};
static void ramfb_class_initfn(ObjectClass *klass, const void *data)
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index e0daf0d4fc..6666db9e4f 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -49,6 +49,7 @@
#include "hw/acpi/generic_event_device.h"
#include "hw/pci-host/gpex.h"
#include "hw/usb/xhci.h"
+#include "hw/vfio/pci.h"
#include "elf.h"
#include "kvm/kvm_i386.h"
@@ -633,6 +634,8 @@ GlobalProperty microvm_properties[] = {
* so reserving io space is not going to work. Turn it off.
*/
{ "pcie-root-port", "io-reserve", "0" },
+ { TYPE_RAMFB_DEVICE, "use-legacy-x86-rom", "true" },
+ { TYPE_VFIO_PCI, "use-legacy-x86-rom", "true" },
};
static void microvm_class_init(ObjectClass *oc, const void *data)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index ea7572e783..8ec8d8ae6d 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -49,6 +49,7 @@
#include "hw/i2c/smbus_eeprom.h"
#include "system/memory.h"
#include "hw/acpi/acpi.h"
+#include "hw/vfio/pci.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "system/xen.h"
@@ -77,6 +78,13 @@ static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
#endif
+static GlobalProperty pc_piix_compat_defaults[] = {
+ { TYPE_RAMFB_DEVICE, "use-legacy-x86-rom", "true" },
+ { TYPE_VFIO_PCI, "use-legacy-x86-rom", "true" },
+};
+static const size_t pc_piix_compat_defaults_len =
+ G_N_ELEMENTS(pc_piix_compat_defaults);
+
/*
* Return the global irq number corresponding to a given device irq
* pin. We could also use the bus number to have a more precise mapping.
@@ -482,6 +490,8 @@ static void pc_i440fx_machine_options(MachineClass *m)
pc_set_south_bridge);
object_class_property_set_description(oc, "x-south-bridge",
"Use a different south bridge than PIIX3");
+ compat_props_add(m->compat_props,
+ pc_piix_compat_defaults, pc_piix_compat_defaults_len);
}
static void pc_i440fx_machine_10_1_options(MachineClass *m)
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 33211b1876..0096eef6f4 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -45,6 +45,7 @@
#include "hw/i386/pc.h"
#include "hw/i386/amd_iommu.h"
#include "hw/i386/intel_iommu.h"
+#include "hw/vfio/pci.h"
#include "hw/virtio/virtio-iommu.h"
#include "hw/display/ramfb.h"
#include "hw/ide/pci.h"
@@ -67,6 +68,8 @@
static GlobalProperty pc_q35_compat_defaults[] = {
{ TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "39" },
+ { TYPE_RAMFB_DEVICE, "use-legacy-x86-rom", "true" },
+ { TYPE_VFIO_PCI, "use-legacy-x86-rom", "true" },
};
static const size_t pc_q35_compat_defaults_len =
G_N_ELEMENTS(pc_q35_compat_defaults);
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index f4fa8a5610..604b337389 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -3710,7 +3710,7 @@ static const TypeInfo vfio_pci_dev_info = {
static const Property vfio_pci_dev_nohotplug_properties[] = {
DEFINE_PROP_BOOL("ramfb", VFIOPCIDevice, enable_ramfb, false),
- DEFINE_PROP_BOOL("use-legacy-x86-rom", VFIOPCIDevice, use_legacy_x86_rom, true),
+ DEFINE_PROP_BOOL("use-legacy-x86-rom", VFIOPCIDevice, use_legacy_x86_rom, false),
DEFINE_PROP_ON_OFF_AUTO("x-ramfb-migrate", VFIOPCIDevice, ramfb_migrate,
ON_OFF_AUTO_AUTO),
};
--
2.40.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v9 0/2] ramfb: Add property to control if load the romfile
2025-07-04 3:03 [PATCH v9 0/2] ramfb: Add property to control if load the romfile Shaoqin Huang
2025-07-04 3:03 ` [PATCH v9 1/2] " Shaoqin Huang
2025-07-04 3:03 ` [PATCH v9 2/2] hw/i386: Add the ramfb romfile compatibility Shaoqin Huang
@ 2025-07-09 2:18 ` Shaoqin Huang
2 siblings, 0 replies; 7+ messages in thread
From: Shaoqin Huang @ 2025-07-09 2:18 UTC (permalink / raw)
To: qemu-arm, Daniel P. Berrangé, Peter Maydell, Gerd Hoffmann,
Eric Auger, Eduardo Habkost, Paolo Bonzini, Marcel Apfelbaum,
Michael S. Tsirkin
Cc: Zhao Liu, Alex Williamson, Cédric Le Goater,
Philippe Mathieu-Daudé, qemu-devel, Richard Henderson,
Sergio Lopez, Yanan Wang
Hi maintainers,
This is a kindly ping, could you help to review this patch series?
Thanks,
Shaoqin
On 7/4/25 11:03 AM, Shaoqin Huang wrote:
> Currently the ramfb device loads the vgabios-ramfb.bin unconditionally, but only
> the x86 need the vgabios-ramfb.bin, this can cause that when use the
> release package on arm64 it can't find the vgabios-ramfb.bin.
>
> Because only seabios will use the vgabios-ramfb.bin, load the rom logic
> is x86-specific. For other !x86 platforms, the edk2 ships an EFI driver
> for ramfb, so they don't need to load the romfile.
>
> So add a new property use-legacy-x86-rom in both ramfb and vfio_pci
> device, because the vfio display also use the ramfb_setup() to load
> the vgabios-ramfb.bin file.
>
> After have this property, the machine type can set the compatibility to
> not load the vgabios-ramfb.bin if the arch doesn't need it.
>
> Then I set the use_legacy_x86_rom property to false by default, and only set it
> to true on x86 since only x86 will need it.
>
> At the same time, set the "use-legacy-x86-rom" property to true on those
> historical versioned machine types in order to avoid the memory layout
> being changed.
>
> Changelog:
> ---------
> v8 -> v9:
> - Improve the commit message.
> v7 -> v8:
> - Set the property in microvm machine type.
> v6 -> v7:
> - Set the property into hw_compat_10_0 instead of hw_compat_9_2.
> v5 -> v6:
> - Set the property to true on those historical versioned machine types.
> v4 -> v5:
> - Fix some typo error.
> - Set the property in piix machine type.
> v3 -> v4:
> - Set the new property to false by default, only set it to true on x86.
> v2 -> v3:
> - Fix the underscore error.
> - Add a new patch to set the property in arm compatibility.
> v1 -> v2:
> - Change the property name.
>
> v7: https://lore.kernel.org/all/20250702085616.2172722-1-shahuang@redhat.com/
> v6: https://lore.kernel.org/all/20250701030549.2153331-1-shahuang@redhat.com/
> v5: https://lore.kernel.org/all/20250626034526.2136585-1-shahuang@redhat.com/
> v4: https://lore.kernel.org/all/20250617030521.2109305-1-shahuang@redhat.com/
> v3: https://lore.kernel.org/all/20250609073408.2083831-1-shahuang@redhat.com/
> v2: https://lore.kernel.org/all/20250606070234.2063451-1-shahuang@redhat.com/
> v1: https://lore.kernel.org/all/20250605030351.2056571-1-shahuang@redhat.com/
>
> Shaoqin Huang (2):
> ramfb: Add property to control if load the romfile
> hw/i386: Add the ramfb romfile compatibility
>
> hw/core/machine.c | 2 ++
> hw/display/ramfb-standalone.c | 4 +++-
> hw/display/ramfb-stubs.c | 2 +-
> hw/display/ramfb.c | 6 ++++--
> hw/i386/microvm.c | 3 +++
> hw/i386/pc_piix.c | 10 ++++++++++
> hw/i386/pc_q35.c | 3 +++
> hw/vfio/display.c | 4 ++--
> hw/vfio/pci.c | 1 +
> hw/vfio/pci.h | 1 +
> include/hw/display/ramfb.h | 2 +-
> 11 files changed, 31 insertions(+), 7 deletions(-)
>
--
Shaoqin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v9 1/2] ramfb: Add property to control if load the romfile
2025-07-04 3:03 ` [PATCH v9 1/2] " Shaoqin Huang
@ 2025-07-10 9:11 ` Zhao Liu
0 siblings, 0 replies; 7+ messages in thread
From: Zhao Liu @ 2025-07-10 9:11 UTC (permalink / raw)
To: Shaoqin Huang
Cc: qemu-arm, Daniel P. Berrangé, Peter Maydell, Gerd Hoffmann,
Eric Auger, Paolo Bonzini, Eric Auger, Alex Williamson,
Cédric Le Goater, qemu-devel
On Thu, Jul 03, 2025 at 11:03:14PM -0400, Shaoqin Huang wrote:
> Date: Thu, 3 Jul 2025 23:03:14 -0400
> From: Shaoqin Huang <shahuang@redhat.com>
> Subject: [PATCH v9 1/2] ramfb: Add property to control if load the romfile
>
> Currently the ramfb device loads the vgabios-ramfb.bin unconditionally,
> but only the x86 need the vgabios-ramfb.bin, this can cause that when
> use the release package on arm64 it can't find the vgabios-ramfb.bin.
>
> Because only seabios will use the vgabios-ramfb.bin, load the rom logic
> is x86-specific. For other !x86 platforms, the edk2 ships an EFI driver
> for ramfb, so they don't need to load the romfile.
>
> So add a new property use-legacy-x86-rom in both ramfb and vfio_pci
> device, because the vfio display also use the ramfb_setup() to load
> the vgabios-ramfb.bin file.
>
> After have this property, the machine type can set the compatibility to
> not load the vgabios-ramfb.bin if the arch doesn't need it.
>
> For now the default value is true but it will be turned off by default
> in subsequent patch when compats get properly handled.
>
> Reviewed-by: Eric Auger <eric.auger@redhat.com>
> Signed-off-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> hw/display/ramfb-standalone.c | 4 +++-
> hw/display/ramfb-stubs.c | 2 +-
> hw/display/ramfb.c | 6 ++++--
> hw/vfio/display.c | 4 ++--
> hw/vfio/pci.c | 1 +
> hw/vfio/pci.h | 1 +
> include/hw/display/ramfb.h | 2 +-
> 7 files changed, 13 insertions(+), 7 deletions(-)
LGTM,
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v9 2/2] hw/i386: Add the ramfb romfile compatibility
2025-07-04 3:03 ` [PATCH v9 2/2] hw/i386: Add the ramfb romfile compatibility Shaoqin Huang
@ 2025-07-10 10:07 ` Zhao Liu
2025-07-13 21:02 ` Michael S. Tsirkin
1 sibling, 0 replies; 7+ messages in thread
From: Zhao Liu @ 2025-07-10 10:07 UTC (permalink / raw)
To: Shaoqin Huang
Cc: qemu-arm, Daniel P. Berrangé, Peter Maydell, Gerd Hoffmann,
Eric Auger, Paolo Bonzini, Eric Auger, Eduardo Habkost,
Marcel Apfelbaum, Philippe Mathieu-Daudé, Yanan Wang,
Sergio Lopez, Richard Henderson, Michael S. Tsirkin,
Alex Williamson, Cédric Le Goater, qemu-devel
On Thu, Jul 03, 2025 at 11:03:15PM -0400, Shaoqin Huang wrote:
> Date: Thu, 3 Jul 2025 23:03:15 -0400
> From: Shaoqin Huang <shahuang@redhat.com>
> Subject: [PATCH v9 2/2] hw/i386: Add the ramfb romfile compatibility
>
> ramfb is a sysbus device so it can only used for machine types where it
> is explicitly enabled:
>
> # git grep machine_class_allow_dynamic_sysbus_dev.*TYPE_RAMFB_DEVICE
> hw/arm/virt.c: machine_class_allow_dynamic_sysbus_dev(mc,
> TYPE_RAMFB_DEVICE);
> hw/i386/microvm.c: machine_class_allow_dynamic_sysbus_dev(mc,
> TYPE_RAMFB_DEVICE);
> hw/i386/pc_piix.c: machine_class_allow_dynamic_sysbus_dev(m,
> TYPE_RAMFB_DEVICE);
> hw/i386/pc_q35.c: machine_class_allow_dynamic_sysbus_dev(m,
> TYPE_RAMFB_DEVICE);
> hw/loongarch/virt.c: machine_class_allow_dynamic_sysbus_dev(mc,
> TYPE_RAMFB_DEVICE);
> hw/riscv/virt.c: machine_class_allow_dynamic_sysbus_dev(mc,
> TYPE_RAMFB_DEVICE);
>
> So these six are the only machine types we have to worry about.
>
> The three x86 machine types (pc, q35, microvm) will actually use the rom
> (when booting with seabios).
>
> For arm/riscv/loongarch virt we want to disable the rom.
>
> This patch sets ramfb romfile option to false by default, except for x86
> machines types (pc, q35, microvm) which need the rom file when booting
> with seabios and machine types <= 10.0 (handling the case of arm virt,
> for compat reasons).
>
> At the same time, set the "use-legacy-x86-rom" property to true on those
> historical versioned machine types in order to avoid the memory layout
> being changed.
>
> Reviewed-by: Eric Auger <eric.auger@redhat.com>
> Signed-off-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> hw/core/machine.c | 2 ++
> hw/display/ramfb-standalone.c | 2 +-
> hw/i386/microvm.c | 3 +++
> hw/i386/pc_piix.c | 10 ++++++++++
> hw/i386/pc_q35.c | 3 +++
> hw/vfio/pci.c | 2 +-
> 6 files changed, 20 insertions(+), 2 deletions(-)
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v9 2/2] hw/i386: Add the ramfb romfile compatibility
2025-07-04 3:03 ` [PATCH v9 2/2] hw/i386: Add the ramfb romfile compatibility Shaoqin Huang
2025-07-10 10:07 ` Zhao Liu
@ 2025-07-13 21:02 ` Michael S. Tsirkin
1 sibling, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2025-07-13 21:02 UTC (permalink / raw)
To: Shaoqin Huang
Cc: qemu-arm, Daniel P. Berrangé, Peter Maydell, Gerd Hoffmann,
Eric Auger, Paolo Bonzini, Zhao Liu, Eric Auger, Eduardo Habkost,
Marcel Apfelbaum, Philippe Mathieu-Daudé, Yanan Wang,
Sergio Lopez, Richard Henderson, Alex Williamson,
Cédric Le Goater, qemu-devel
On Thu, Jul 03, 2025 at 11:03:15PM -0400, Shaoqin Huang wrote:
> ramfb is a sysbus device so it can only used for machine types where it
> is explicitly enabled:
>
> # git grep machine_class_allow_dynamic_sysbus_dev.*TYPE_RAMFB_DEVICE
> hw/arm/virt.c: machine_class_allow_dynamic_sysbus_dev(mc,
> TYPE_RAMFB_DEVICE);
> hw/i386/microvm.c: machine_class_allow_dynamic_sysbus_dev(mc,
> TYPE_RAMFB_DEVICE);
> hw/i386/pc_piix.c: machine_class_allow_dynamic_sysbus_dev(m,
> TYPE_RAMFB_DEVICE);
> hw/i386/pc_q35.c: machine_class_allow_dynamic_sysbus_dev(m,
> TYPE_RAMFB_DEVICE);
> hw/loongarch/virt.c: machine_class_allow_dynamic_sysbus_dev(mc,
> TYPE_RAMFB_DEVICE);
> hw/riscv/virt.c: machine_class_allow_dynamic_sysbus_dev(mc,
> TYPE_RAMFB_DEVICE);
>
> So these six are the only machine types we have to worry about.
>
> The three x86 machine types (pc, q35, microvm) will actually use the rom
> (when booting with seabios).
>
> For arm/riscv/loongarch virt we want to disable the rom.
>
> This patch sets ramfb romfile option to false by default, except for x86
> machines types (pc, q35, microvm) which need the rom file when booting
> with seabios and machine types <= 10.0 (handling the case of arm virt,
> for compat reasons).
>
> At the same time, set the "use-legacy-x86-rom" property to true on those
> historical versioned machine types in order to avoid the memory layout
> being changed.
>
> Reviewed-by: Eric Auger <eric.auger@redhat.com>
> Signed-off-by: Shaoqin Huang <shahuang@redhat.com>
i386 things look fine.
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> hw/core/machine.c | 2 ++
> hw/display/ramfb-standalone.c | 2 +-
> hw/i386/microvm.c | 3 +++
> hw/i386/pc_piix.c | 10 ++++++++++
> hw/i386/pc_q35.c | 3 +++
> hw/vfio/pci.c | 2 +-
> 6 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index e869821b22..a7043e2a34 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -39,6 +39,8 @@
>
> GlobalProperty hw_compat_10_0[] = {
> { "scsi-hd", "dpofua", "off" },
> + { "ramfb", "use-legacy-x86-rom", "true"},
> + { "vfio-pci", "use-legacy-x86-rom", "true" },
> };
> const size_t hw_compat_10_0_len = G_N_ELEMENTS(hw_compat_10_0);
>
> diff --git a/hw/display/ramfb-standalone.c b/hw/display/ramfb-standalone.c
> index 725aef9896..b20a7c57b3 100644
> --- a/hw/display/ramfb-standalone.c
> +++ b/hw/display/ramfb-standalone.c
> @@ -63,7 +63,7 @@ static const VMStateDescription ramfb_dev_vmstate = {
>
> static const Property ramfb_properties[] = {
> DEFINE_PROP_BOOL("x-migrate", RAMFBStandaloneState, migrate, true),
> - DEFINE_PROP_BOOL("use-legacy-x86-rom", RAMFBStandaloneState, use_legacy_x86_rom, true),
> + DEFINE_PROP_BOOL("use-legacy-x86-rom", RAMFBStandaloneState, use_legacy_x86_rom, false),
> };
>
> static void ramfb_class_initfn(ObjectClass *klass, const void *data)
> diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
> index e0daf0d4fc..6666db9e4f 100644
> --- a/hw/i386/microvm.c
> +++ b/hw/i386/microvm.c
> @@ -49,6 +49,7 @@
> #include "hw/acpi/generic_event_device.h"
> #include "hw/pci-host/gpex.h"
> #include "hw/usb/xhci.h"
> +#include "hw/vfio/pci.h"
>
> #include "elf.h"
> #include "kvm/kvm_i386.h"
> @@ -633,6 +634,8 @@ GlobalProperty microvm_properties[] = {
> * so reserving io space is not going to work. Turn it off.
> */
> { "pcie-root-port", "io-reserve", "0" },
> + { TYPE_RAMFB_DEVICE, "use-legacy-x86-rom", "true" },
> + { TYPE_VFIO_PCI, "use-legacy-x86-rom", "true" },
> };
>
> static void microvm_class_init(ObjectClass *oc, const void *data)
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index ea7572e783..8ec8d8ae6d 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -49,6 +49,7 @@
> #include "hw/i2c/smbus_eeprom.h"
> #include "system/memory.h"
> #include "hw/acpi/acpi.h"
> +#include "hw/vfio/pci.h"
> #include "qapi/error.h"
> #include "qemu/error-report.h"
> #include "system/xen.h"
> @@ -77,6 +78,13 @@ static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
> static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
> #endif
>
> +static GlobalProperty pc_piix_compat_defaults[] = {
> + { TYPE_RAMFB_DEVICE, "use-legacy-x86-rom", "true" },
> + { TYPE_VFIO_PCI, "use-legacy-x86-rom", "true" },
> +};
> +static const size_t pc_piix_compat_defaults_len =
> + G_N_ELEMENTS(pc_piix_compat_defaults);
> +
> /*
> * Return the global irq number corresponding to a given device irq
> * pin. We could also use the bus number to have a more precise mapping.
> @@ -482,6 +490,8 @@ static void pc_i440fx_machine_options(MachineClass *m)
> pc_set_south_bridge);
> object_class_property_set_description(oc, "x-south-bridge",
> "Use a different south bridge than PIIX3");
> + compat_props_add(m->compat_props,
> + pc_piix_compat_defaults, pc_piix_compat_defaults_len);
> }
>
> static void pc_i440fx_machine_10_1_options(MachineClass *m)
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 33211b1876..0096eef6f4 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -45,6 +45,7 @@
> #include "hw/i386/pc.h"
> #include "hw/i386/amd_iommu.h"
> #include "hw/i386/intel_iommu.h"
> +#include "hw/vfio/pci.h"
> #include "hw/virtio/virtio-iommu.h"
> #include "hw/display/ramfb.h"
> #include "hw/ide/pci.h"
> @@ -67,6 +68,8 @@
>
> static GlobalProperty pc_q35_compat_defaults[] = {
> { TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "39" },
> + { TYPE_RAMFB_DEVICE, "use-legacy-x86-rom", "true" },
> + { TYPE_VFIO_PCI, "use-legacy-x86-rom", "true" },
> };
> static const size_t pc_q35_compat_defaults_len =
> G_N_ELEMENTS(pc_q35_compat_defaults);
> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
> index f4fa8a5610..604b337389 100644
> --- a/hw/vfio/pci.c
> +++ b/hw/vfio/pci.c
> @@ -3710,7 +3710,7 @@ static const TypeInfo vfio_pci_dev_info = {
>
> static const Property vfio_pci_dev_nohotplug_properties[] = {
> DEFINE_PROP_BOOL("ramfb", VFIOPCIDevice, enable_ramfb, false),
> - DEFINE_PROP_BOOL("use-legacy-x86-rom", VFIOPCIDevice, use_legacy_x86_rom, true),
> + DEFINE_PROP_BOOL("use-legacy-x86-rom", VFIOPCIDevice, use_legacy_x86_rom, false),
> DEFINE_PROP_ON_OFF_AUTO("x-ramfb-migrate", VFIOPCIDevice, ramfb_migrate,
> ON_OFF_AUTO_AUTO),
> };
> --
> 2.40.1
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-07-13 21:03 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-04 3:03 [PATCH v9 0/2] ramfb: Add property to control if load the romfile Shaoqin Huang
2025-07-04 3:03 ` [PATCH v9 1/2] " Shaoqin Huang
2025-07-10 9:11 ` Zhao Liu
2025-07-04 3:03 ` [PATCH v9 2/2] hw/i386: Add the ramfb romfile compatibility Shaoqin Huang
2025-07-10 10:07 ` Zhao Liu
2025-07-13 21:02 ` Michael S. Tsirkin
2025-07-09 2:18 ` [PATCH v9 0/2] ramfb: Add property to control if load the romfile Shaoqin Huang
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).