Commit Graph

2654 Commits

Author SHA1 Message Date
Gerd Hoffmann 1206efcd89 qemu: factor out qemu_cfg_detect()
Move qemu fw_cfg detection to separate function.
No functional change.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-05-15 13:29:05 +02:00
Christian Ehrhardt 8d25ca41c5 build: use -fcf-protection=none when available
Some hardened gcc v9 compilers (such as the one in Ubuntu)
default this option which for seabios leads to emulation errors
when running in KVM (does not trigger in TCG) on older intel
chips of the Penryn generation (~2006-2008).

The symptom appears as endbr32/endbr64 interpretation failures
and in KVM it looks like:
  KVM internal error. Suberror: 1
  emulation failure
  EAX=00000000 EBX=00000000 ECX=000086d4 EDX=00000000
  ESI=00000000 EDI=00000000 EBP=000086d4 ESP=00006d7c
  EIP=00007acf EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0
  ES =0000 00000000 ffffffff 00809300
  CS =f000 000f0000 ffffffff 00809b00
  SS =0000 00000000 ffffffff 00809300
  DS =0000 00000000 ffffffff 00809300
  FS =0000 00000000 ffffffff 00809300
  GS =0000 00000000 ffffffff 00809300
  LDT=0000 00000000 0000ffff 00008200
  TR =0000 00000000 0000ffff 00008b00
  GDT=     000f6200 00000037
  IDT=     00000000 000003ff
  CR0=00000010 CR2=00000000 CR3=00000000 CR4=00000000
  DR0=0000000000000000 DR1=0000000000000000
  DR2=0000000000000000 DR3=0000000000000000
  DR6=00000000ffff0ff0 DR7=0000000000000400
  EFER=0000000000000000
  Code=b8 90 d9 00 00 66 e8 6b f7 ff ff 66 b8 0a 00 00
       00 e9 61 f2 <f3> 0f 1e fb 66 57 66 56 66 53 66 53
       66 89 c7 67 66 89 14 24 66 89 ce 66 e8 15 f8 ff ff 88

URL: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1866870
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2020-05-14 21:44:13 -04:00
Stefan Berger eaaf726038 tcgbios: Add support for SHA3 type of algorithms
Add support for SHA3 type of algorithms that a TPM2 may support
some time in the future.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-04-19 11:35:34 -04:00
Stefan Berger adaf988b22 tcgbios: Fix the vendorInfoSize to be of type u8
The vendorInfoSize is a u8 rather than a u32.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-04-19 11:35:34 -04:00
Stefan Berger 80fce2c2eb tcgbios: Only write logs for PCRs that are in active PCR banks
Only write the logs for those PCRs that are in active PCR banks.
A PCR banks is assumed to be active if any of the BIOS relevant
PCRs 0 -  7 is enabled, thus pcrSelect[0] != 0.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-04-19 11:35:33 -04:00
Gerd Hoffmann 6a3b59ab9c pci: add mmconfig support
Add support for pci config space access via mmconfig bar.  Enable for
qemu q35 chipset.  Main advantage is that we need only one instead of
two io operations per config space access, which translates to one
instead of two vmexits for virtualization.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200323145911.22319-3-kraxel@redhat.com
2020-03-27 08:32:45 +01:00
Gerd Hoffmann 63a44aff7a pci: factor out ioconfig_cmd()
Add helper function to calculate PORT_PCI_CMD value from bdf + addr.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200323145911.22319-2-kraxel@redhat.com
2020-03-27 08:32:45 +01:00
Paul Menzel de88a96284 std/tcg: Replace zero-length array with flexible-array member
GCC 10 gives the warnings below:

    In file included from out/ccode32flat.o.tmp.c:54:
    ./src/tcgbios.c: In function 'tpm20_write_EfiSpecIdEventStruct':
    ./src/tcgbios.c:290:30: warning: array subscript '(<unknown>) + 4294967295' is outside the bounds of an interior zero-length array 'struct TCG_EfiSpecIdEventAlgorithmSize[0]' [-Wzero-length-bounds]
      290 |         event.hdr.digestSizes[count].algorithmId = be16_to_cpu(sel->hashAlg);
          |         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    In file included from ./src/tcgbios.c:22,
                     from out/ccode32flat.o.tmp.c:54:
    ./src/std/tcg.h:527:7: note: while referencing 'digestSizes'
      527 |     } digestSizes[0];
          |       ^~~~~~~~~~~
    In file included from out/ccode32flat.o.tmp.c:54:
    ./src/tcgbios.c:291:30: warning: array subscript '(<unknown>) + 4294967295' is outside the bounds of an interior zero-length array 'struct TCG_EfiSpecIdEventAlgorithmSize[0]' [-Wzero-length-bounds]
      291 |         event.hdr.digestSizes[count].digestSize = hsize;
          |         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    In file included from ./src/tcgbios.c:22,
                     from out/ccode32flat.o.tmp.c:54:
    ./src/std/tcg.h:527:7: note: while referencing 'digestSizes'
      527 |     } digestSizes[0];
          |       ^~~~~~~~~~~

[Description copied from Gustavo A. R. Silva <gustavo@embeddedor.com>
from his Linux kernel commits.]

The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array
member [1][2], introduced in C99:

    struct foo {
            int stuff;
            struct boo array[];
    };

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=76497732932f15e7323dc805e8ea8dc11bb587cf

Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-03-20 19:31:23 -04:00
Matt DeVillier bfdb3f86e9 ps2port: adjust init routine to fix PS/2 keyboard issues
PS/2 keyboards on Chromebooks with upstream coreboot + SeaBIOS often
fail to init properly / register keystrokes.  Modify ps2port init
to match that of TianoCore, which doesn't have said issues.

Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Message-Id: <248435f9-c169-e1db-fc3e-62185b74899c@molgen.mpg.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-03-17 15:39:26 +01:00
Matt DeVillier 29ee1fb85c Skip boot menu and timeout with only one boot device
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Message-Id: <45aa3ebe-b97c-f1af-2901-ec4e9bcd1084@molgen.mpg.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-03-17 15:39:15 +01:00
Gerd Hoffmann 066a995609 sercon: vbe modeset is int 10h function 4f02 not 4f00
Fixes console redirection for NetBSD primary bootloader.

https://bugs.launchpad.net/bugs/1743191
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Kevin O'Connor <kevin@koconnor.net>
Message-Id: <20200306090321.24811-1-kraxel@redhat.com>
2020-03-17 13:43:11 +01:00
Gerd Hoffmann b3fa857752 kvm: add support for reading tsc frequency from kvmclock
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200310102248.28412-4-kraxel@redhat.com
2020-03-16 14:29:41 +01:00
Gerd Hoffmann 34160e0525 kvm: add support for reading tsc frequency via cpuid.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200310102248.28412-3-kraxel@redhat.com
2020-03-16 14:29:41 +01:00
Gerd Hoffmann d68335174d kvm: detect unconditionally
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-16 14:29:41 +01:00
Gerd Hoffmann 67cbfedb33 timer: add tsctimer_setfreq()
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-16 14:29:41 +01:00
Matt DeVillier 24d3938ca9 hw/usb-hid: Don't abort if setting key repeat rate fails
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-06 08:27:38 -05:00
Kevin O'Connor 81ddc4c6ec usb-hid: Improve max packet size checking
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-03-06 08:24:16 -05:00
Gerd Hoffmann 76551856b2 nvme: skip initializing non-bootable devices
Check NVMe devices whenever they are bootable,
skip initialization in case they are not.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-01-14 10:20:31 +01:00
Gerd Hoffmann d6bdb85eb0 virtio-scsi: skip initializing non-bootable devices
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-14 10:18:02 +01:00
Gerd Hoffmann 8d4252254a boot: cache HALT priority
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-14 10:15:19 +01:00
Alexey Kirillov 2f4d068645 virtio: Do not init non-bootable devices
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-14 09:12:45 +01:00
Alexey Kirillov 7c40d945b9 boot: Detect strict boot order (HALT record) in function
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>
2020-01-14 09:12:45 +01:00
Kevin O'Connor f21b5a4aeb docs: Note v1.13.0 release
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-12-09 15:08:17 -05:00
Sam Eiderman c9ba5276e3 geometry: Apply LCHS values for boot devices
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-18 14:58:37 +01:00
Sam Eiderman d49496f94e geometry: Add boot_lchs_find_*() utility functions
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-18 14:58:37 +01:00
Sam Eiderman db58caa92e boot: Build ata and scsi paths in function
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-18 14:58:37 +01:00
Sam Eiderman 9383ba748b geometry: Read LCHS from fw_cfg
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-18 14:58:37 +01:00
Gerd Hoffmann 695f176d3e Revert "geometry: Read LCHS from fw_cfg"
This reverts commit 7c66a439c0.
2019-11-18 14:58:37 +01:00
Gerd Hoffmann acc70aa8d1 Revert "geometry: Add boot_lchs_find_*() utility functions"
This reverts commit ad2910949b.
2019-11-18 14:58:37 +01:00
Gerd Hoffmann 48f7843e30 Revert "config: Add toggle for bootdevice information"
This reverts commit cb56f61c10.
2019-11-18 14:58:37 +01:00
Gerd Hoffmann b6f8471534 Revert "geometry: Apply LCHS values for boot devices"
This reverts commit 9caa19be0e.
2019-11-18 14:58:37 +01:00
Stefan Berger 0594486b63 tcgbios: Check for enough bytes returned from TPM2_GetCapability
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-13 10:25:36 -05:00
Stefan Berger 0672bd3b6a tpm: Require a response to have minimum size of a valid response header
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-13 10:25:02 -05:00
Gerd Hoffmann 3bdd2b7765 ahci: zero-initialize port struct
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-13 14:59:39 +01:00
Sam Eiderman 9caa19be0e geometry: Apply LCHS values for boot devices
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-06 10:56:00 +01:00
Sam Eiderman cb56f61c10 config: Add toggle for bootdevice information
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-06 10:56:00 +01:00
Sam Eiderman ad2910949b geometry: Add boot_lchs_find_*() utility functions
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-06 10:56:00 +01:00
Sam Eiderman b3d21205b7 boot: Reorder functions in boot.c
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-06 10:56:00 +01:00
Sam Eiderman 7c66a439c0 geometry: Read LCHS from fw_cfg
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-11-06 10:56:00 +01:00
Kevin O'Connor c1ab7d7ed5 docs: Note release date for v1.12.1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-28 11:19:11 -04:00
Kevin O'Connor 00df082921 docs: Add developer-certificate-of-origin
Update the documentation to be explicit about the signed-off-by
convention.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-28 10:31:07 -04:00
Gerd Hoffmann 51eb916e12 cp437: add license to cp437.c
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-10-28 10:27:31 -04:00
Gerd Hoffmann 0c480648e3 ramfb: add copyright and license to ramfb.c
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-10-28 10:27:25 -04:00
Gerd Hoffmann edf4fe5eb0 bochsdisplay: add copyright and license to bochsdisplay.c
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-10-28 10:27:06 -04:00
Kevin O'Connor b9b923ed45 svgamodes: Add copyright notice to vgasrc/svgamodes.c
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-28 10:23:59 -04:00
Uwe Kleine-König 120996f147 Remove dos line endings introduced in the last two commits
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-21 08:49:53 +02:00
Uwe Kleine-König fc92d092ea Add additional resolutions for 16:9 displays: 1600x900 and 2560x1440
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-18 12:07:12 +02:00
Uwe Kleine-König dc5cc91aa1 cbvga: reuse svga modes definitions from svgamodes.c
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-18 12:07:12 +02:00
Denis Plotnikov 50093b4b22 virtio: extend virtio queue size to 256
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-10-18 12:07:05 +02:00
Kevin O'Connor 43f5df79da Makefile: Build with -Wno-address-of-packed-member
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-08-23 19:17:26 -04:00