QEMU-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: BALATON Zoltan <balaton@eik.bme.hu>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Machine specific option ROMs
Date: Tue, 20 Aug 2019 01:42:59 +0200 (CEST)
Message-ID: <alpine.BSF.2.21.9999.1908200126020.56805@zero.eik.bme.hu> (raw)
In-Reply-To: <20190819061545.7qeiyonvvqe3s6up@sirius.home.kraxel.org>

On Mon, 19 Aug 2019, Gerd Hoffmann wrote:
> On Mon, Aug 19, 2019 at 02:38:09AM +0200, BALATON Zoltan wrote:
>> I know about the possibility to set the option ROM of a PCIDevice with the
>> romfile property (that we can set on command line or in a device's init
>> method) but is there a way to set it depending on the machine that uses the
>> device? If this is not currently possible what would be needed to allow
>> this?
>
> Should work with compat properties.  That is a list of device, property
> and value which a specific machine type should use.  Typically they are
> used to make versioned machine types behave simliar to older qemu
> versions (this is where the name comes from).  Using them to use
> non-default properties on ppc platform should work too.
>
> For example in qemu 1.5 the nic roms got EFI support and there is a
> compat property which switches the pc-i440fx-1.4 (and older) machine
> types to the non-efi versions.  Grep for pxe-e1000.rom to find the code.

OK thanks, looks like something like this works:

diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index c5bbcc7433..8ee937e3ce 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -569,6 +572,10 @@ static int core99_kvm_type(MachineState *machine, const char *arg)
     return 2;
 }

+static GlobalProperty compat[] = {
+    { "VGA", "romfile", NDRV_VGA_FILENAME },
+};
+
 static void core99_machine_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
@@ -587,6 +594,7 @@ static void core99_machine_class_init(ObjectClass *oc, void *data)
     mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("7400_v2.9");
 #endif
     mc->ignore_boot_device_suffixes = true;
+    compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
     fwc->get_dev_path = core99_fw_dev_path;
 }



Mark, do you think this could replace the current way of passing this 
driver via fw_cfg and would you accept patches to OpenBIOS to revert the 
ndrv patching to replace that with this solution? (The vga_config_cb 
already adds the driver from the ROM when set as above so no further hacks 
are necessary. If we want we can keep the vga-ndrv? option to control this 
adding NDRV from ROM after the current use of this setting is no longer 
needed.) I think this would allow some simplification and also avoids 
patching ati-vga with this driver without needing to add vga-ndrv?=false 
manually. (In the future this same way can also be used to pass proper 
FCode ROMs to OpenBIOS.)

Regards,
BALATON Zoltan


  reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19  0:38 BALATON Zoltan
2019-08-19  6:15 ` Gerd Hoffmann
2019-08-19 23:42   ` BALATON Zoltan [this message]
2019-08-20  6:25     ` Gerd Hoffmann
2019-08-20 10:46       ` BALATON Zoltan
2019-08-20 12:28         ` Gerd Hoffmann
2019-08-20 14:01           ` BALATON Zoltan

Reply instructions:

You may reply publically 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=alpine.BSF.2.21.9999.1908200126020.56805@zero.eik.bme.hu \
    --to=balaton@eik.bme.hu \
    --cc=kraxel@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --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

QEMU-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/qemu-devel/0 qemu-devel/git/0.git
	git clone --mirror https://lore.kernel.org/qemu-devel/1 qemu-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 qemu-devel qemu-devel/ https://lore.kernel.org/qemu-devel \
		qemu-devel@nongnu.org qemu-devel@archiver.kernel.org
	public-inbox-index qemu-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.nongnu.qemu-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox