Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDmxN-0006Fm-TZ for qemu-devel@nongnu.org; Thu, 26 Nov 2009 17:36:57 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDmxK-0006EW-5H for qemu-devel@nongnu.org; Thu, 26 Nov 2009 17:36:57 -0500 Received: from [199.232.76.173] (port=56698 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDmxJ-0006EH-KF for qemu-devel@nongnu.org; Thu, 26 Nov 2009 17:36:53 -0500 Received: from mail.gmx.net ([213.165.64.20]:50524) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1NDmxI-000549-OH for qemu-devel@nongnu.org; Thu, 26 Nov 2009 17:36:53 -0500 Message-ID: <3D742E4D630E4B6C9F4BF3EDD0B7C22E@FSCPC> From: "Sebastian Herbszt" References: <20091123111137.GF2999@redhat.com> <11090DAABE9449F7B5D1415C45F8F411@FSCPC> <20091123194307.GC13854@redhat.com> <2D659FA33BF64C419243FD76049AFD33@FSCPC> <20091124062810.GZ2999@redhat.com> <20091124143812.GA27783@shareable.org> <20091124144044.GJ2999@redhat.com> <20091125060951.GA17203@shareable.org> <20091125122039.GM2999@redhat.com> <20091125225349.GA18812@morn.localdomain> In-Reply-To: <20091125225349.GA18812@morn.localdomain> Subject: Re: [Qemu-devel] Re: POST failure (loop) with isapc and seabios Date: Thu, 26 Nov 2009 23:35:52 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin O'Connor Cc: qemu-devel@nongnu.org, Gleb Natapov Kevin O'Connor wrote: > On Wed, Nov 25, 2009 at 11:04:20PM +0100, Sebastian Herbszt wrote: >>> Do different things during reset depending on CMOS values doesn't sound >>> right to me. I don't know what is implemented right now. I thought that >>> we reload BIOS on reset. >> >> Currently the BIOS seems to be only loaded once and not reloaded >> during the life time of a VM. >> I don't think there is a notion of BIOS reload on real hardware. CPU >> access to it is either directed to the rom (power-up configuration, >> all those fancy reset conditions) or to ram. > > I see a "BIOS reload" as equivalent to directing access to rom. > >> How is shadowing currently implemented in qemu? Is the only BIOS >> copy overwritten or is the rom copy separate from the ram copy? > > My understanding is that both the ram and rom are kept. (Though, on a > "BIOS reload" I don't know if the ram is preserved.) The BIOS is mapped read only in hw/pc.c bios_offset = qemu_ram_alloc(bios_size) ... cpu_register_physical_memory(0x100000 - isa_bios_size, isa_bios_size, (bios_offset + bios_size - isa_bios_size) | IO_MEM_ROM); Then it is remapped by update_pam() in hw/piix_pci.c cpu_register_physical_memory(start, end - start, start); Since the memory is only allocated once i assume when the content gets overwritten because of shadowing the original data is gone. > To summarize the discussion so far, there seems to be a potential > issue with reset: > > * If qemu doesn't reload the bios (a soft-reset) then there is a > potential issue with the bios and option roms not running properly > after a system reset invoked by Linux or other modern OSs. If a system reset (hard, power cycle) is requested and the hardware is reset to the default power up state and it does require an option rom to initialize, but the option rom is not reloaded and was shrunk and now only contains the runtime part, there will likely be a problem. Maybe the expansion rom bar can be used for pci devices like on real hardware. The bios will check it and load the rom itself instead of relying on qemu to do the job. > * If qemu does reload the bios (a hard-reset) then there is a good > chance that old DOS programs will break when they invoke a reset in > an attempt to switch from protected mode to real mode. If a soft reset is requested with the goal of a transition from protected to real mode and the bios is reloaded, it should not do any harm because the internal device states are kept and the cmos still has the correct shutdown status code for the transition. Bochs bios doesn't rely on shadowing so none of its internal state is lost either, but the created tables (smbios, mp table, etc.) will be gone. - Sebastian