From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mt5D3-0006Ib-Jr for qemu-devel@nongnu.org; Wed, 30 Sep 2009 15:51:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mt5Cy-0006GO-5k for qemu-devel@nongnu.org; Wed, 30 Sep 2009 15:51:32 -0400 Received: from [199.232.76.173] (port=55476 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mt5Cy-0006GL-01 for qemu-devel@nongnu.org; Wed, 30 Sep 2009 15:51:28 -0400 Received: from mail-fx0-f214.google.com ([209.85.220.214]:60931) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mt5Cx-0004uS-Hg for qemu-devel@nongnu.org; Wed, 30 Sep 2009 15:51:27 -0400 Received: by fxm10 with SMTP id 10so2137813fxm.8 for ; Wed, 30 Sep 2009 12:51:26 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1254325401-18777-1-git-send-email-kraxel@redhat.com> References: <1254325401-18777-1-git-send-email-kraxel@redhat.com> From: Blue Swirl Date: Wed, 30 Sep 2009 22:51:06 +0300 Message-ID: Subject: Re: [Qemu-devel] [PATCH] Reorganize option rom (+linux kernel) loading. Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org On Wed, Sep 30, 2009 at 6:43 PM, Gerd Hoffmann wrote: > This patch adds infrastructure to maintain memory regions which must be > restored on reset. =C2=A0That includes roms (vga bios and option roms on = pc), > but is also used when loading linux kernels directly. =C2=A0Features: > > =C2=A0- loading files is supported. > =C2=A0- passing blobs is supported. > =C2=A0- target address range is supported (for optionrom area). > =C2=A0- fixed target memory address is supported (linux kernel). > > The final memory layout is created once all memory regions are > registered. =C2=A0The option roms get addresses assigned and the > registered regions are checked against overlaps. =C2=A0Finally all data > is copyed to the guest memory. > > Advantages: > > =C2=A0(1) Filling memory on initial boot and on reset takes the same > =C2=A0 =C2=A0 =C2=A0code path, making reset more robust. > =C2=A0(2) The need to keep track of the option rom load address is gone. > =C2=A0(3) Due to (2) option roms can be loaded outside pc_init(). =C2=A0T= his > =C2=A0 =C2=A0 =C2=A0allows to move the pxe rom loading into the nic drive= rs for > =C2=A0 =C2=A0 =C2=A0example. > > Additional bonus: =C2=A0There is a 'info roms' monitor command now. > > The patch also switches over pc.c and removes the > option_rom_setup_reset() and load_option_rom() functions. Nice idea. The implementation seems to be buggy, I only ever see one rom and for example sparc-test crashes when issuing 'info roms'. Perhaps 'info roms' could also check whether the rom has been changed? On most platforms roms are really read only memories. > + =C2=A0 =C2=A0fd =3D open(rom->path, O_RDONLY); > + =C2=A0 =C2=A0if (-1 =3D=3D fd) { Not again! > + =C2=A0 =C2=A0rom->align =C2=A0 =C2=A0=3D align; > + =C2=A0 =C2=A0rom->min =C2=A0 =C2=A0 =C2=A0=3D min; > + =C2=A0 =C2=A0rom->max =C2=A0 =C2=A0 =C2=A0=3D max; > + =C2=A0 =C2=A0rom->romsize =C2=A0=3D lseek(fd, 0, SEEK_END); > + =C2=A0 =C2=A0rom->data =C2=A0 =C2=A0 =3D qemu_mallocz(rom->romsize); There are plenty of extra spaces.