summaryrefslogtreecommitdiff
path: root/hw/core/loader.c
AgeCommit message (Collapse)AuthorFilesLines
2014-03-11pc: avoid duplicate names for ROM MRsMichael S. Tsirkin1-4/+6
Since commit 04920fc0faa4760f9c4fc0e73b992b768099be70 loader: store FW CFG ROM files in RAM RAM MRs including ROM files in FW CFGs are created and named using the file basename. This becomes problematic if these names are supplied by user, since the basename might not be unique. There are two cases we care about: - option-rom flag. - option ROM for devices. This triggers e.g. when using rombar=0. At the moment we get an assert. E.g qemu -option-rom /usr/share/ipxe/8086100e.rom -option-rom /usr/share/ipxe.efi/8086100e.rom RAMBlock "/rom@genroms/8086100e.rom" already registered, abort! This is a regression from 1.6. For now let's keep it simple and just avoid creating the MRs in case of option ROMs. when using 1.7 machine types, enable option ROMs in RAM to match that version. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-03-09loader: rename in_ram/has_mrMichael S. Tsirkin1-3/+3
we put copy of ROMs in MR for migration. but the name rom_in_ram makes one think we load it in guest RAM. Rename has_mr to make intent clearer. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-03-05elf-loader: add more return codesAlexey Kardashevskiy1-6/+24
The existing load_elf() just returns -1 if it fails to load ELF. However it could be smarter than this and tell more about the failure such as wrong endianness or incompatible platform. This adds additional return codes for wrong architecture, wrong endianness and if the image is not ELF at all. This adds a load_elf_strerror() helper to convert return codes into string messages. This fixes handling of what load_elf() returns for s390x, other callers just check the return value for <0 and this remains unchanged. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Alexander Graf <agraf@suse.de>
2014-02-11exec: Make cpu_physical_memory_write_rom input an ASEdgar E. Iglesias1-1/+2
Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
2013-12-20roms: Flush icache when writing roms to guest memoryAlexander Graf1-0/+7
We use the rom infrastructure to write firmware and/or initial kernel blobs into guest address space. So we're basically emulating the cache off phase on very early system bootup. That phase is usually responsible for clearing the instruction cache for anything it writes into cachable memory, to ensure that after reboot we don't happen to execute stale bits from the instruction cache. So we need to invalidate the icache every time we write a rom into guest address space. We do not need to do this for every DMA since the guest expects it has to flush the icache manually in that case. This fixes random reboot issues on e5500 (booke ppc) for me. Signed-off-by: Alexander Graf <agraf@suse.de>
2013-10-14loader: allow adding ROMs in done callbacksMichael S. Tsirkin1-1/+5
Don't abort if machine done callbacks add ROMs. Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Tested-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Tested-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-10-14loader: use file path size from fw_cfg.hMichael S. Tsirkin1-1/+1
Avoid a bit of code duplication, make max file path constant reusable. Suggested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Tested-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Tested-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-10-14loader: support for unmapped ROM blobsMichael S. Tsirkin1-3/+20
Support ROM blobs not mapped into guest memory: same as ROM files really but use caller's buffer. Support invoking callback on access and return memory pointer making it easier for caller to update memory if necessary. Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Tested-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Tested-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-08-21loader: store FW CFG ROM files in RAMMichael S. Tsirkin1-3/+46
ROM files that are put in FW CFG are copied to guest ram, by BIOS, but they are not backed by RAM so they don't get migrated. Each time we change two bytes in such a ROM this breaks cross-version migration: since we can migrate after BIOS has read the first byte but before it has read the second one, getting an inconsistent state. Future-proof this by creating, for each such ROM, an MR serving as the backing store. This MR is never mapped into guest memory, but it's registered as RAM so it's migrated with the guest. Naturally, this only helps for -M 1.7 and up, older machine types will still have the cross-version migration bug. Luckily the race window for the problem to trigger is very small, which is also likely why we didn't notice the cross-version migration bug in testing yet. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2013-08-07Bugfix for loading multiboot kernelsMartijn van den Broek1-4/+3
This patch fixes a bug in rom_copy introduced by commit d60fa42e8bae39440f997ebfe8fe328269a57d16. rom_copy failed to load roms with a "datasize" of 0. As a result, multiboot kernels were not loaded correctly when they contain a segment with a "file size" of 0. https://bugs.launchpad.net/qemu/+bug/1208944 Signed-off-by: Martijn van den Broek <martijn.vdbrk@gmail.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: CAG1x_oET1u3TMPu3r_zzd3ZXsTWQLiaM0zAc+RkHFCwvJjGOvg@mail.gmail.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-22hw/loader: Support ramdisk with u-boot headerSoren Brinkmann1-25/+59
Introduce 'load_ramdisk()' which can load "normal" ramdisks and ramdisks with a u-boot header. To enable this and leverage synergies 'load_uimage()' is refactored to accomodate this additional use case. Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1373323202-17083-2-git-send-email-soren.brinkmann@xilinx.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2013-07-04memory: add ref/unref callsPaolo Bonzini1-0/+1
Add ref/unref calls at the following places: - places where memory regions are stashed by a listener and used outside the BQL (including in Xen or KVM). - memory_region_find callsites - creation of aliases and containers (only the aliased/contained region gets a reference to avoid loops) - around calls to del_subregion/add_subregion, where the region could disappear after the first call Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-06-20memory: make section size a 128-bit integerPaolo Bonzini1-1/+1
So far, the size of all regions passed to listeners could fit in 64 bits, because artificial regions (containers and aliases) are eliminated by the memory core, leaving only device regions which have reasonable sizes An IOMMU however cannot be eliminated by the memory core, and may have an artificial size, hence we may need 65 bits to represent its size. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-06-02refer to FWCfgState explicitlyLaszlo Ersek1-1/+1
Currently some places use pointer-to-void even though they mean pointer-to-FWCfgState. Clean them up. Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-04-08hw: move private headers to hw/ subdirectories.Paolo Bonzini1-1/+1
Many headers are used only in a single directory. These can be kept in hw/. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-08hw: move target-independent files to subdirectoriesPaolo Bonzini1-0/+850
This patch tackles all files that are compiled once, moving them to subdirectories of hw/. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>