From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCHv3 14/14] Pass boot device list to firmware. Date: Wed, 10 Nov 2010 21:16:16 +0200 Message-ID: <20101110191616.GF6798@redhat.com> References: <1289409261-5418-1-git-send-email-gleb@redhat.com> <1289409261-5418-15-git-send-email-gleb@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, armbru@redhat.com, alex.williamson@redhat.com, mst@redhat.com To: Blue Swirl Return-path: Received: from mx1.redhat.com ([209.132.183.28]:59525 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755613Ab0KJTQU convert rfc822-to-8bit (ORCPT ); Wed, 10 Nov 2010 14:16:20 -0500 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Nov 10, 2010 at 07:11:54PM +0000, Blue Swirl wrote: > On Wed, Nov 10, 2010 at 5:14 PM, Gleb Natapov wrote= : > > > > Signed-off-by: Gleb Natapov > > --- > > =9Ahw/fw_cfg.h | =9A =9A1 + > > =9Ahw/pc.c =9A =9A | =9A 19 +++++++++++++++++++ > > =9Asysemu.h =9A =9A| =9A =9A1 + > > =9Avl.c =9A =9A =9A =9A| =9A 40 +++++++++++++++++++++++++++++++++++= +++++ > > =9A4 files changed, 61 insertions(+), 0 deletions(-) > > > > diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h > > index 4d13a4f..bfbf1f9 100644 > > --- a/hw/fw_cfg.h > > +++ b/hw/fw_cfg.h > > @@ -31,6 +31,7 @@ > > =9A#define FW_CFG_FILE_FIRST =9A =9A =9A 0x20 > > =9A#define FW_CFG_FILE_SLOTS =9A =9A =9A 0x10 > > =9A#define FW_CFG_MAX_ENTRY =9A =9A =9A =9A(FW_CFG_FILE_FIRST+FW_CF= G_FILE_SLOTS) > > +#define FW_CFG_BOOTINDEX =9A =9A =9A =9A(FW_CFG_MAX_ENTRY + 1) > > > > =9A#define FW_CFG_WRITE_CHANNEL =9A =9A0x4000 > > =9A#define FW_CFG_ARCH_LOCAL =9A =9A =9A 0x8000 > > diff --git a/hw/pc.c b/hw/pc.c > > index 3bf3862..e51f8ba 100644 > > --- a/hw/pc.c > > +++ b/hw/pc.c > > @@ -883,6 +883,21 @@ void pc_cpus_init(const char *cpu_model) > > =9A =9A } > > =9A} > > > > +static struct machine_ready_notify { > > + =9A =9ANotifier n; > > + =9A =9Avoid *fw_cfg; > > +} machine_ready; > > + > > + > > +static void pc_fw_register_bootindex(struct Notifier* n) > > +{ > > + =9A =9Auint32_t len; > > + =9A =9Achar *bootindex =3D get_boot_devices_list(&len); > > + > > + =9A =9Afw_cfg_add_bytes(machine_ready.fw_cfg, FW_CFG_BOOTINDEX, > > + =9A =9A =9A =9A =9A =9A =9A =9A =9A =9A (uint8_t*)bootindex, len)= ; > > +} > > + > > =9Avoid pc_memory_init(ram_addr_t ram_size, > > =9A =9A =9A =9A =9A =9A =9A =9A =9A =9A const char *kernel_filename= , > > =9A =9A =9A =9A =9A =9A =9A =9A =9A =9A const char *kernel_cmdline, > > @@ -982,6 +997,10 @@ void pc_memory_init(ram_addr_t ram_size, > > =9A =9A for (i =3D 0; i < nb_option_roms; i++) { > > =9A =9A =9A =9A rom_add_option(option_rom[i]); > > =9A =9A } > > + > > + =9A =9Amachine_ready.n.notify =3D pc_fw_register_bootindex; > > + =9A =9Amachine_ready.fw_cfg =3D fw_cfg; > > + =9A =9Aqemu_add_machine_init_done_notifier(&machine_ready.n); >=20 > Actually this and the above should be moved to generic code, like > vl.c. I doubt this would be any different for other platforms. Agree, but we do not have reference to fw_cfg in generic code. -- Gleb.