aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-03-16kvm: detect unconditionallyGerd Hoffmann1-7/+1
So we detect kvm even in case there is no qemu pci hostbridge present, for example when using the new, pci-less microvm machine type. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20200310102248.28412-2-kraxel@redhat.com
2020-03-16timer: add tsctimer_setfreq()Gerd Hoffmann2-1/+26
Add function to set tsc frequency directly, without calibration. Also tweak timer setup functions a bit: skip setup in case TimerPort has not the default value any more, i.e. another timer has been setup already. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20200310102248.28412-1-kraxel@redhat.com
2020-03-06hw/usb-hid: Don't abort if setting key repeat rate failsMatt DeVillier1-1/+1
Since the USB stack doesn't handle stalled pipes, don't abort keyboard setup if the set_idle command fails, since it's a non-critical feature. Instead, log a warning. Test: build/boot Google Pixel Slate, observe keyboard functional Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de> Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
2020-03-06usb-hid: Improve max packet size checkingKevin O'Connor1-22/+33
Some USB keyboards report 9 or 10-byte max packet sizes instead of the 8-byte max specified by the USB HID spec. Increase the available size and simplify the boundary checks. Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-01-14nvme: skip initializing non-bootable devicesGerd Hoffmann1-0/+7
Check NVMe devices whenever they are bootable, skip initialization in case they are not. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-01-14virtio-scsi: skip initializing non-bootable devicesGerd Hoffmann1-1/+10
Check each disk attached to a virtio-scsi device whenever it is bootable and skip initialization in case it isn't. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-01-14boot: cache HALT priorityGerd Hoffmann1-1/+5
Call find_prio("HALT") only once, on first is_bootprio_strict() call. Store the result in a variable and reuse it on subsequent calls. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-01-14virtio: Do not init non-bootable devicesAlexey Kirillov2-2/+20
Because initializing a virtio-blk or virtio-scsi device requires a large amount of memory, you cannot create more than about 10 virtio devices. Since initialization is required for booting from media, we will not initialize those devices that are not in the boot order list. Signed-off-by: Alexey Kirillov <lekiravi@yandex-team.ru> Message-id: 20200107171917.7535-3-lekiravi@yandex-team.ru Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-01-14boot: Detect strict boot order (HALT record) in functionAlexey Kirillov2-0/+6
Introduce is_bootprio_strict(). We will reuse this function in the next commit. Signed-off-by: Alexey Kirillov <lekiravi@yandex-team.ru> Message-id: 20200107171917.7535-2-lekiravi@yandex-team.ru Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-12-09docs: Note v1.13.0 releaseKevin O'Connor1-0/+11
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-18geometry: Apply LCHS values for boot devicesSam Eiderman11-1/+39
Boot devices which use overriden LCHS values are: * ata * ahci * scsi * esp * lsi * megasas * mpt * pvscsi * virtio * virtio-blk We use these values in get_translation() and setup_translation() by introducing a new translation type: "TRANSLATION_HOST". We treat this translation as TRANSLATION_NONE in fill_ata_edd(), although this does not really matter since now the translation between physical and logical geometry does not exist. Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com> Message-Id: <20190626123816.8907-6-shmuel.eiderman@oracle.com>
2019-11-18geometry: Add boot_lchs_find_*() utility functionsSam Eiderman3-0/+82
Adding the following utility functions: * boot_lchs_find_pci_device * boot_lchs_find_scsi_device * boot_lchs_find_ata_device These will be used to apply LCHS values received through fw_cfg. Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com> Message-Id: <20190626123816.8907-5-shmuel.eiderman@oracle.com>
2019-11-18boot: Build ata and scsi paths in functionSam Eiderman1-8/+28
Introduce build_scsi_path() and build_ata_path(). We will reuse these functions in the next commit. Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com> Message-Id: <20190626123816.8907-4-shmuel.eiderman@oracle.com>
2019-11-18geometry: Read LCHS from fw_cfgSam Eiderman1-0/+74
Read bios geometry for boot devices from fw_cfg. By receiving LCHS values directly from QEMU through fw_cfg we will be able to support logical geometries which can not be inferred by SeaBIOS itself. (For instance: A 8GB virtio-blk hard drive which was originally created as an IDE and must report LCHS of */32/63 for its operating system to function will always break under SeaBIOS since a LARGE/LBA translation will be used, causing the number of reported logical heads to be > 32.) The only LCHS paravirtual interface available at the moment is for IDE disks (rtc_read() in get_translation()) and it's limited to a maximum of 4 disks (this code existed in SeaBIOS's translation function before SCSI and VirtIO were even introduced). This is why we create a new interface which allows passing LCHS information per hdd. Boot device information is serialized in the following way: * device_path lcyls lheads lsecs\n ... * device_path lcyls lheads lsecs\0 Device path is a null terminated string in the "Open Firmware" device path format, the same path as used in bootorder. Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com> Message-Id: <20190626123816.8907-2-shmuel.eiderman@oracle.com>
2019-11-18Revert "geometry: Read LCHS from fw_cfg"Gerd Hoffmann1-87/+0
This reverts commit 7c66a439c07536b525ff9d5ce230775975e9c072.
2019-11-18Revert "geometry: Add boot_lchs_find_*() utility functions"Gerd Hoffmann2-88/+0
This reverts commit ad2910949b1886deba24f574cee76cdc75e7cabe.
2019-11-18Revert "config: Add toggle for bootdevice information"Gerd Hoffmann2-16/+0
This reverts commit cb56f61c109985ad71078b1fb2e65bd4d6ed1a59.
2019-11-18Revert "geometry: Apply LCHS values for boot devices"Gerd Hoffmann11-42/+1
This reverts commit 9caa19be0e534c687081fbdfcd301406e728c98c.
2019-11-13tcgbios: Check for enough bytes returned from TPM2_GetCapabilityStefan Berger1-2/+11
When querying a TPM 2.0 for its PCRs, make sure that we get enough bytes from it in a response that did not indicate a failure. Basically we are defending against a TPM 2.0 sending responses that are not compliant to the specs. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-11-13tpm: Require a response to have minimum size of a valid response headerStefan Berger1-1/+2
Defend against a broken TPM 1.2 or TPM 2.0 that doesn't send at least a full response header in the response but less than 10 bytes. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-11-13ahci: zero-initialize port structGerd Hoffmann1-0/+1
Specifically port->drive.lchs needs clearing, otherwise seabios will try interpret whatever random crap happens to be there as disk geometry, which may or may not break boot depending on how lucky you are. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2019-11-06geometry: Apply LCHS values for boot devicesSam Eiderman11-1/+42
Boot devices which use overriden LCHS values are: * ata * ahci * scsi * esp * lsi * megasas * mpt * pvscsi * virtio * virtio-blk We use these values in get_translation() and setup_translation() by introducing a new translation type: "TRANSLATION_MACHINE". We treat this translation as TRANSLATION_NONE in fill_ata_edd(), although this does not really matter since now the translation between physical and logical geometry does not exist. Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com> Message-Id: <20190612093704.47175-6-shmuel.eiderman@oracle.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-11-06config: Add toggle for bootdevice informationSam Eiderman2-0/+16
Add the "BOOTDEVICES" toggle to remove boot device information received through fw_cfg. We will use this toggle in QEMU to reduce the size of the 128k SeaBIOS rom, which is only used in old compat versions, where this boot device information does not exist. Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com> Message-Id: <20190612093704.47175-5-shmuel.eiderman@oracle.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-11-06geometry: Add boot_lchs_find_*() utility functionsSam Eiderman2-0/+88
Adding the following utility functions: * boot_lchs_find_pci_device * boot_lchs_find_scsi_device * boot_lchs_find_ata_device These will be used to apply LCHS values received through fw_cfg. Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com> Message-Id: <20190612093704.47175-4-shmuel.eiderman@oracle.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-11-06boot: Reorder functions in boot.cSam Eiderman1-45/+49
Currently glob_prefix() and build_pci_path() are under the "Boot priority ordering" section. Move them to a new "Helper search functions" section since we will reuse them in the next commit. Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com> Message-Id: <20190612093704.47175-3-shmuel.eiderman@oracle.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-11-06geometry: Read LCHS from fw_cfgSam Eiderman1-0/+87
Read boot device information from fw_cfg. Boot device information will contain logical geometry (LCHS) values, but it is implemented in a manner which allows extension. By receiving LCHS values directly from QEMU through fw_cfg we will be able to support logical geometries which can not be inferred by SeaBIOS itself. (For instance: A 8GB virtio-blk hard drive which was originally created as an IDE and must report LCHS of */32/63 for its operating system to function will always break under SeaBIOS since a LARGE/LBA translation will be used, causing the number of reported logical heads to be > 32.) The only LCHS paravirtual interface available at the moment is for IDE disks (rtc_read() in get_translation()) and it's limited to a maximum of 4 disks (this code existed in SeaBIOS's translation function before SCSI and VirtIO were even introduced). This is why we create a new interface which allows passing LCHS information per hdd. As mentioned, this interface may be easily extended to support more information per hdd. Boot device information is serialized in the following way: * struct_size (u32) * device path (sz string) * device information (struct_size) ... * device path (sz string) * device information (struct_size) Device path is a null terminated string in the "Open Firmware" device path format, the same path as used in bootorder. Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com> Message-Id: <20190612093704.47175-2-shmuel.eiderman@oracle.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-10-28docs: Note release date for v1.12.1Kevin O'Connor1-0/+5
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-28docs: Add developer-certificate-of-originKevin O'Connor2-0/+42
Update the documentation to be explicit about the signed-off-by convention. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-28cp437: add license to cp437.cGerd Hoffmann1-0/+2
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-10-28ramfb: add copyright and license to ramfb.cGerd Hoffmann1-0/+6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-10-28bochsdisplay: add copyright and license to bochsdisplay.cGerd Hoffmann1-0/+6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-10-28svgamodes: Add copyright notice to vgasrc/svgamodes.cKevin O'Connor1-0/+8
Commit 004f5b3a moved part of vgasrc/bochsvga.c to vgasrc/svgamodes.c - copy over the copyright statements as well. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-21Remove dos line endings introduced in the last two commitsUwe Kleine-König2-17/+17
These were added somewhere between the mailing list server and Gerd's working copy (as the patch I got via the mailing list is fine). These don't disturb the compiler, but they look ugly so remove them. Reported-by: Paul Menzel <pmenzel@molgen.mpg.de> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org> Message-Id: <20191020200726.20116-1-uwe@kleine-koenig.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-10-18Add additional resolutions for 16:9 displays: 1600x900 and 2560x1440Uwe Kleine-König1-0/+8
This allows to have qemu run at the native screen resolution of my (physical) monitor. This is inspired by a patch created by Andreas Dangel that I found on https://adangel.org/2015/09/11/qemu-kvm-custom-resolutions/ . Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org> Message-Id: <20191017203353.18898-2-uwe@kleine-koenig.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-10-18cbvga: reuse svga modes definitions from svgamodes.cUwe Kleine-König1-71/+9
For cbvga only modes with MM_DIRECT are usable, so skip the other ones. This effectively adds the following modes: { 0x10D, { MM_DIRECT, 320, 200, 15, 8, 16, SEG_GRAPH } }, { 0x10E, { MM_DIRECT, 320, 200, 16, 8, 16, SEG_GRAPH } }, { 0x10F, { MM_DIRECT, 320, 200, 24, 8, 16, SEG_GRAPH } }, { 0x140, { MM_DIRECT, 320, 200, 32, 8, 16, SEG_GRAPH } }, Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org> Message-Id: <20191017203353.18898-1-uwe@kleine-koenig.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-10-18virtio: extend virtio queue size to 256Denis Plotnikov1-1/+1
The goal of the patch is to work around a performance bug in guest linux kernels. Old linux kernels has a performance flaw in virtio block device access: on some frequent disk access patterns, e.g. 1M read, the kernel produces more block requests than needed. This happens because of virtio seg_max parameter set to 126 (virtqueue_size - 2) which limits the maximum block request to 516096 (126 * 4096_PAGE_SIZE) bytes. Setting seg_max > 126 fixes the issue, however, not all linux kernels allow that without increasing virtio virtqueue size. The old kernels have a restriction: virtqueue_size >= seg_max. In case of the restriction violation the old kernels crash. The restriction is relaxed in the recent linux kernels (ver >= 4.13) with: commit 44ed8089e991a60d614abe0ee4b9057a28b364e4 Author: Richard W.M. Jones Date: Thu Aug 10 17:56:51 2017 +0100 scsi: virtio: Reduce BUG if total_sg > virtqueue size to WARN. and the recent linux kernels don't crash if total_sg > virtqueue size allowing to set seg_max to the needed value without virtqueue size increasing. To fix the performance flaw in the old linux kernels, it's needed to increse seg_max to 254, and comply the restriction by setting virtqueue_size to 256. This is achievable if seabios can support virtqueue size > 128 which this patch actually does. Windows kernels don't have virtqueue_size >= seg_max restriction and isn't affected with this kind of the performance bug. Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-08-23Makefile: Build with -Wno-address-of-packed-memberKevin O'Connor1-0/+1
Building with gcc v9 causes lots of warnings about pointers to packed variables. However, SeaBIOS is limited to x86 where unaligned reads/writes are supported by the cpu. So, disable that warning. Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2019-06-28csm: Fix boot priority translationDavid Woodhouse1-3/+20
Explicitly handle the BBS_DO_NOT_BOOT_FROM and BBS_IGNORE_ENTRY values. Also add one to the other priority values, as find_prio() does for entries from bootorder. SeaBIOS uses zero for an item explicitly selected in interactive_bootmenu(). Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2019-06-24ati-vga: add rage128 edid supportGerd Hoffmann1-0/+25
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-06-24ati-vga: try vga ddc firstGerd Hoffmann1-0/+9
Try vga ddc bus before dvi ddc bus. Return early in case we got valid data. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-06-24ati-vga: make i2c register and bits configurableGerd Hoffmann1-7/+27
Prepare to support other ati cards. Also log access mode and whenever we got a valid edid block. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-06-24ati-vga: fix ati_read()Gerd Hoffmann1-1/+1
Cut & paste bug probably. Had no bad effect so far because the code doesn't read registers larger than 0x100. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-06-24ati-vga: make less verboseGerd Hoffmann1-1/+1
Reduce loglevel for mode line removals from 1 to 3. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-06-18csm: Sanitise alignment constraint in Legacy16GetTableAddressDavid Woodhouse1-2/+12
The alignment constraint is defined in the CSM specifications as "Bit mapped. First non-zero bit from the right is the alignment." Use __fls() to sanitise the alignment given that definition, since passing a non-power-of-two alignment to _malloc() isn't going to work well. And cope with being passed zero, which was happening for the E820 table allocation from EDK2. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2019-05-23virtio-pci: Use %pP format in dprintf() callsKevin O'Connor1-6/+4
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-23pciinit: Use %pP shorthand for printing device ids in intel_igd_setup()Kevin O'Connor1-12/+9
The hardcoded device names can cause false-positives on Windows bios version checks. Use the %pP format to avoid that. Reported-by: Sam Eiderman <shmuel.eiderman@oracle.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-22optionrom: disallow int19 redirect for pnp roms.Gerd Hoffmann1-0/+24
Check whenever pnp roms attempt to redirect int19, and in case it does log a message and undo the redirect. A pnp rom should not need this, we have BEVs and BCVs for that. Nevertheless there are roms in the wild which are redirecting int19. At least some BIOS implementations for physical hardware have a config option in the setup to allow/disallow int19 redirections, so just not allowing this seems to be the way to deal with this situation. Buglink: https://bugzilla.redhat.com//show_bug.cgi?id=1642135 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Tested-by: Matt DeVillier <matt.devillier@gmail.com>
2019-05-17bootmenu: add support for more than 9 entriesGerd Hoffmann1-18/+42
10th and following entries can be selected using letters. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-05-17add get_keystroke_full() helperGerd Hoffmann2-2/+15
Switch get_raw_keystroke() to return ax instead of ah, so it returns both scan code and ascii code of the key pressed. Add get_keystroke_full() function which passes up ax to the caller. The get_keystroke() function continues to return the scancode only like it did before. It is a thin wrapper around get_keystroke_full() now though. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-05-15bochsdisplay: parse resolution from edid.Gerd Hoffmann1-8/+16
Then use the resolution for the framebuffer. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>