aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-09-19Place setup_data at location specified by hostHEADmasterJason A. Donenfeld3-9/+9
QEMU places setup_data at a particular location, which cannot be relocated due to it containing self references in absolute address terms. For this reason, it supplies the intended location in FW_CFG_SETUP_ADDR. That is what is used in the option ROMs provided by QEMU, use this too in qboot. This also has the effect of removing the 8k limit on the copied size, since the header is copied to the right location from the beginning. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Message-Id: <20220916133603.693135-1-Jason@zx2c4.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-05-22qboot: Disable PIE for ELF binary build stepSven Eckelmann1-0/+1
The switch to meson in commit fd2aada36b98 ("Add meson build") had two major behavior changes for the ELF binary build step: * ELF binary is no longer build as x86_64 on x86_64 * ELF binary is build as position independent executable on systems with a "--enable-default-pie" gcc The latter will create a slightly larger than 64KB bios.bin which causes an error when Qemu tries to load it: qemu: could not load PC BIOS 'qboot/build/bios.bin' This behavior change was introduced because the elf linker step was changed from using ld directly to using cc. Basically something like following Makefile change: bios.bin.elf: $(obj-y) flat.lds - $(LD) -T flat.lds -o bios.bin.elf $(obj-y) + $(CC) -o bios.bin.elf $(obj-y) -Wl,--no-undefined -Wl,--as-needed -nostdlib -m32 -Wl,--build-id=none -Wl,-Tflat.lds GCC will then take care of calling ld with the appropriate arguments. And one of these arguments for the "--enable-default-pie" gcc is "-pie": $(LD) --build-id --eh-frame-hdr -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -pie -o bios.bin.elf $(obj-y) --no-undefined --as-needed --build-id=none -Tflat.lds This default behavior of gcc must be suppressed by adding -no-pie to the arguments when linking the object files. Signed-off-by: Sven Eckelmann <sven@narfation.org>
2020-04-23Fix initrd base address for PVH bootLorenz Brun1-1/+1
2020-03-13record minimum version of meson that is neededPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-18limit C headers to freestanding onesPaolo Bonzini5-5/+5
inttypes.h is not part of the subset of standard headers for freestanding environments. Replace it with stdint.h. Also include string.h with quotes, since we provide it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-14Update READMEMarc-Andre Lureau1-2/+2
Change instructions to build from sources.
2019-12-13Add meson buildMarc-André Lureau3-57/+54
That should provide same build results as the Makefile. tags targets are pending review for meson: https://github.com/mesonbuild/meson/pull/6058 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-11-18support smbioskaihuan.pkh8-10/+188
alloc buffer in fseg memory and fill it with smbios anchor and tables which read from the fw_cfg, then check type0 table and rebuild it if it's not exist. mainly inspired by the seabios, and borrowed some code from it. Reviewed-by: Ben Luo <luoben@linux.alibaba.com> Signed-off-by: kaihuan.pkh <kaihuan.pkh@alibaba-inc.com>
2019-07-25remove pflash codePaolo Bonzini4-73/+1
Also part of the cbfs support which is now obsolete. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-07-24implement mptable generationSergio Lopez5-0/+371
This is specially useful for machines lacking ACPI. Signed-off-by: Sergio Lopez <slp@redhat.com>
2019-07-24support machines without PCISergio Lopez3-6/+12
Instead of panicing when a PCI bus isn't found, continue booting without PCI nor ACPI initialization. Signed-off-by: Sergio Lopez <slp@redhat.com>
2019-07-24clean up printfPaolo Bonzini1-10/+7
printf is avoiding switch statements so that it can be used in very early startup, before jump tables can be read from the F segment. We could use -fno-jump-tables, but we can also keep the if statements and clean them up so that the indentation is fine. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-07-24do not mix tabs and spaces in a single filePaolo Bonzini8-58/+58
2019-07-24implement PCIBIOS specificationPaolo Bonzini5-5/+169
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-07-24clear CF on entry to BIOS handlersPaolo Bonzini2-7/+3
This simplifies the success case, which never has to manipulate the carry flag. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-07-24remove incorrect flat_to_off16Paolo Bonzini1-1/+1
Here we use offsetof so "start" is not a flat pointer, it is a pointer inside the e820 segment. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-07-22cleanup PAM checkPaolo Bonzini1-4/+4
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-07-22avoid out-of-bounds warnings with recent compilersPaolo Bonzini1-2/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-07-22drop cbfs experimentPaolo Bonzini5-194/+8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-07-12bug fix for setup_idt开恒1-1/+1
the setup_idt() has not configured default ISR for all interrupt. CPU lookup IVT and set 0x0:0x0 (cs:ip) as interrupt handler entry when received an unexpected interrupt which not setup ISR via set_realmode_int in setup_idt(). howerver, the 0x0:0x0 point to IVT-self and executing it caused invalid opcode exception, which the interrupt vector is 6, and the handler bios_intfake not fixing this problem, this makes CPU run into a infinite loop.
2019-01-16pvh: load initrd from fw_cfgStefano Garzarella1-6/+17
If we found initrd through fw_cfg, we can load it and use the first module of hvm_start_info to pass initrd address and size to the kernel. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
2018-12-28pvh: add benchmark exit pointLiam Merwick2-1/+8
This commit adds a PVH specific VM exit point for use in benchmarking boot times using a QEMU specific device that terminates the QEMU process and thus the VM itself when handling those VM exits. Since the VM terminates right at those exit points, generic tools like time can be used to measure the time spent between the QEMU startup and termination moments. The QEMU device used for those measurement is called isa-debug-exit for the PC and Q35 machine types. These devices take 2 arguments: iobase and iosize. iobase specifies which IO port we need to write into to have these devices eventually handle the corresponding VM exit. If for example, QEMU is started with the following argument: -device isa-debug-exit,iobase=0xf4 then any IO write to 0xf4 will terminate the QEMU process and the corresponding VM. Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
2018-12-28pvh: use x86/HVM direct boot ABILiam Merwick3-1/+83
These changes (along with corresponding QEMU and Linux kernel changes) enable a guest to be booted using the x86/HVM direct boot ABI. QEMU parses the uncompressed kernel binary passed to it via -kernel to read the ELF Note which contains the address to be loaded. QEMU then depends on qboot to populate the start_info struct needed by the direct boot ABI and configure the guest e820 tables before jumping to the loaded kernel entry. Signed-off-by: George Kennedy <George.Kennedy@oracle.com> Signed-off-by: Liam Merwick <Liam.Merwick@oracle.com>
2018-12-28pvh: Add x86/HVM direct boot ABI header fileLiam Merwick1-0/+146
The x86/HVM direct boot ABI permits a guest to be able to boot directly into the uncompressed Linux kernel binary. https://xenbits.xen.org/docs/unstable/misc/pvh.html This commit adds the header file that defines the start_info struct that needs to be populated in order to use this ABI. Signed-off-by: Maran Wilson <Maran.Wilson@oracle.com> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
2018-12-28qboot: Move inline load and store routines to memaccess.hLiam Merwick2-24/+31
Move lduw_p, ldl_p, stw_p, stl_p from linuxboot.c to include/memaccess.h so they can be reused more easily. Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
2018-12-19qboot: add cscope/ctags/TAGS Makefile targets (#16)Liam Merwick1-0/+17
Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
2018-12-11pci: improve PCI bus discoveryStefano Garzarella1-23/+40
When we discovery devices on a PCI BUS, we block bridges, and we use PCI_SECONDARY_BUS to create a linked list of bridges to recursively setup new buses. This avoids a second visit of all the addresses on the bus. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-11-30Remove --disable-uuidPaolo Bonzini1-1/+1
It was removed from QEMU. Fixes #12.
2018-10-24qboot/printf.c:141: more undefined references to `_GLOBAL_OFFSET_TABLE_' followx1-0/+1
Fix for qboot/printf.c:141: more undefined references to `_GLOBAL_OFFSET_TABLE_' follow
2018-10-24main: Add firmware start benchmarking pointSamuel Ortiz1-0/+4
We use a different IO port than the Linux boot benchmarking point. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2018-10-24benchmark: Define exit points and valuesSamuel Ortiz3-2/+17
Benchmarking IO port addresses and return values are now defined through a dedicated header. Each exit point can have its own IO port address and return value. With this we are able to discriminate between similar code paths through the QEMU process return values or between different code paths by having the QEMU debugexit device monitoring different IO port addresses. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-03-30qboot: enable mmconfigYang Zhong4-3/+46
Need to enable mmconfig in qboot and also need to reserve mmconfig space in bios. Signed-off-by: Yang Zhong <yang.zhong@intel.com> Message-Id: <1490869973-4562-1-git-send-email-yang.zhong@intel.com> [Do not affect e820 memory map on i440FX chipset. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-03-30qboot: modified the malloc for fseg and high momory.Yang Zhong3-13/+22
The fseg and high memory malloc all use the up align mode in do_alloc(),which will result in qboot hang issue.The high memory use the down align mode and fseg memory use the up align mode. With those changes,the qemu can boot up the image with qboot. Signed-off-by: Yang Zhong <yang.zhong@intel.com> Message-Id: <1490869250-4357-1-git-send-email-yang.zhong@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-09-15remove unused macrosPaolo Bonzini1-7/+0
2016-09-06update READMEPaolo Bonzini1-5/+6
2016-09-06skip PAM if unnecessaryPaolo Bonzini1-8/+19
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-09-06copy only ~11K down to low memoryPaolo Bonzini4-6/+12
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-09-06inline string functions to movsb/stosbPaolo Bonzini3-25/+11
2016-09-06use DMA to read fw_cfg file namesPaolo Bonzini2-6/+28
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-09-06use fw_cfg DMA for fw_cfg_readPaolo Bonzini2-6/+10
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-09-06use fw_cfg DMA for fw_cfg_read_entryPaolo Bonzini4-29/+93
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-09-06use fw_cfg_read_entryPaolo Bonzini4-16/+16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-07-10enable caches at startupPaolo Bonzini1-1/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-05-30apply benchmarking hack to multiboot as wellPaolo Bonzini1-0/+7
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-05-30cbfs: avoid void* arithmetic, constifyPaolo Bonzini1-4/+4
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-05-29avoid reserved identifiers for header guardsPaolo Bonzini8-19/+19
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-05-29put main at beginning of binary on older compilersPaolo Bonzini1-1/+1
Reported-by: David Halls (via github) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-05-26use = for input/output operandsPaolo Bonzini1-2/+2
The input side is already handled by the duplicate constraints, and clang rejects usage of "+". Reported-by: David Halls (via github) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-05-25README: Add a note on compiling qbootKashyap Chamarthy1-0/+14
Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com> Message-Id: <1432561354-26220-1-git-send-email-kchamart@redhat.com> ["make" is enough. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-05-25another embarrassing typoPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>