Commit Graph

2434 Commits

Author SHA1 Message Date
Gerd Hoffmann f9626ccb91 cbvga_set_mode: refine clear display logic
There is no need to skip text mode clearing.
Clearing the framebuffer should be safe on legacy calls too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 69ea6dabeb)
2018-07-02 16:34:21 +02:00
Gerd Hoffmann f88297a0d6 qemu: add qemu ramfb support
Add support for qemu ramfb.  This is a simple boot framebuffer device,
with normal ram being used to back the framebuffer and fw_cfg being used
to configure the device.

Use case (on x86): boot display for vgpu devices (which neither emulate
vga nor have a vgabios).

Sharing fw_cfg code with seabios turned out to be difficuilt due to
various dependencies the code has on infrastructure which only seabios
has.  So include a copy of the code here, with those dependencies
removed and also stripped down because we don't need a non-dma fallback
here.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit d9a8b867a3)
2018-07-02 16:34:21 +02:00
Gerd Hoffmann a2e4001a2c vgasrc: add allocate_pmm()
Factor out pmm allocation function from stack allocator.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit e1a9579acd)
2018-07-02 16:34:21 +02:00
Gerd Hoffmann 17b01f4236 pmm: use tmp zone on oom
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit a638acfa4c)
2018-07-02 16:34:21 +02:00
Gerd Hoffmann 44b17d02bd bochs_display_setup: return error on failure
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 7bf9ffff1a)
2018-07-02 16:34:21 +02:00
Gerd Hoffmann 4ba61fae47 cbvga_set_mode: disable clearmem in windows x86 emulator.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit ddbb6da350)
2018-07-02 16:34:21 +02:00
Gerd Hoffmann dd691891c5 cbvga_list_modes: don't list current mode twice
In case we've already added the framebuffer video mode
to the list do not add number 0x140.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 0c2b3b1d95)
2018-07-02 16:34:21 +02:00
Gerd Hoffmann 5f0e7c9f50 cbvga_setup_modes: use real mode number instead of 0x140
In case the framebuffer size matches one of the cbvga video modes
just use that mode number instead of 0x140.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 902bacb5f0)
2018-07-02 16:34:21 +02:00
Gerd Hoffmann 961f67ce1a qemu: add bochs-display support
Use coreboot text mode emulation to also support the qemu bochs-display
device.  This is a new display device supporting simple linear
framebuffers, using the bochs register interface.  No support for legacy
vga (text modes, planar modes, cga modes, 8bpp palette modes all
dropped).  The bochs interface is compatible with the qemu stdvga.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 77404b450d)
2018-07-02 16:34:21 +02:00
Gerd Hoffmann 767365e5c4 cbvga: factor out cbvga_setup_modes()
Factor out generic data structure setup code from cbvga_setup().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 4d70b24b86)
2018-07-02 16:34:21 +02:00
Gerd Hoffmann 7906460db1 optionrom: enable non-vga display devices
In case no VGA device was found look for other display devices.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit e28e0bb39b)
2018-07-02 16:34:20 +02:00
Kevin O'Connor 0551a4be2c paravirt: Only enable sercon in NOGRAPHIC mode if no other console specified
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
(cherry picked from commit 0541f2f0f2)
2018-03-19 10:10:55 +01:00
Marcel Apfelbaum a7aa43e97e pci: fix 'io hints' capability for RedHat PCI bridges
Commit ec6cb17f (pci: enable RedHat PCI bridges to reserve additional
                 resources on PCI init)
added a new vendor specific PCI capability for RedHat PCI bridges
allowing them to reserve additional buses and/or IO/MEM space.

When adding the IO hints PCI capability to the pcie-root-port
without specifying a value for bus reservation, the subordinate bus
computation is wrong and the guest kernel gets messed up.

Fix it by returning to prev code if the value for bus
reservation is not set.

Removed also a wrong debug print "PCI: invalid QEMU resource reserve
cap offset" which appears if the 'IO hints' capability is not present.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
(cherry picked from commit 14d91c353e)
2018-03-19 10:10:43 +01:00
Kevin O'Connor 0e739f2b98 shadow: Don't invoke a shutdown on reboot unless in a reboot loop
Old versions of KVM would map the same writable copy of the BIOS at
both 0x000f0000 and 0xffff0000.  As a result, a reboot on these
machines would result in a reboot loop.  So, the code attempts to
check for that situation and invoke a shutdown instead.

Commit b837e68d changed the check to run prior to the first reboot.
However, this broke reboots on the QEMU isapc machine type.  Change
the reboot loop check to only be invoked after at least one reboot has
been attempted.

Reported-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
(cherry picked from commit 42812e062a)
2018-03-19 10:10:35 +01:00
Kevin O'Connor 5d9a515002 build: Use git describe --always
Add --always flag to "git describe" command to get a build identifier
even if one checks out the repo with a depth parameter that prunes out
the last tagged version.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
(cherry picked from commit a3c93bd81d)
2018-03-19 10:10:29 +01:00
Kevin O'Connor 63451fca13 docs: Note v1.11.0 release
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-11-10 11:49:19 -05:00
Gerd Hoffmann 0ca6d6277d sercon: Disable ScreenAndDebug in case both serial console and serial debug are active
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-11-03 16:02:45 -04:00
Kevin O'Connor 488e1c3fef timer: Avoid integer overflows in usec and nsec calculations
When timer_calc_usec() is used with large timeout values, such as 60s,
the integer math can overflow and produce different results than when
using timer_calc(time / 1000) for the same timeout.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-11-02 11:28:25 -04:00
Filippo Sironi cd47172a67 nvme: Use the Maximum Queue Entries Supported (MQES) to initialize I/O queues
Use the Maximum Queue Entries Supported (MQES) to initialize I/O queues
depth rather than picking a fixed number (256) which might not be
supported by some NVMe controllers (the NVMe specification says that an
NVMe controller may support any number between 2 to 4096).

Still cap the I/O queues depth to 256 since, during my testing, SeaBIOS
was running out of memory when using something higher than 256 (4096 on
the NVMe controller that I've had a chance to try).

Signed-off-by: Filippo Sironi <sironi@amazon.de>
2017-10-14 11:10:08 -04:00
Kevin O'Connor 5c1a2c7595 xhci: Verify the device is still present in xhci_cmd_submit()
Make sure the USB device is still present before altering the xhci
"slot" for it.  It appears some controllers will hang if a request is
sent to a port no longer connected.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-10-09 20:54:13 -04:00
Julian Stecklina f703604b30 nvme: fix out of memory behavior
If the allocation of I/O queues ran out of memory, the code would fail to detect
that and happily use these queues at address zero. For me this happens for
systems with more than 7 NVMe controllers.

Fix the out of memory handling to gracefully handle this case.

Signed-off-by: Julian Stecklina <jsteckli@amazon.de>
2017-10-06 09:16:58 -04:00
Kevin O'Connor 4b48839999 xhci: Build TRBs directly in xhci_trb_queue()
Use the logic for building a 'struct xhci_trb' that was in
xhci_xfer_queue() up so that command and ring TRBs can also use that
functionality.  This eliminates the need to manually generate the
xhci_trb struct from those code paths.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-10-03 13:58:12 -04:00
Kevin O'Connor f3d2a15644 virtio: Allocate drive_s storage in low memory
Use the "low" memory segment instead of the f-segment for the drive_s
storage.  This can help avoid running out of memory in the f-segment.

Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-09-27 19:02:34 -04:00
Kevin O'Connor e5a0b61637 block: Rename disk_op_s->drive_gf to drive_fl
Now that the drive_s struct does not need to be in the f-segment,
rename references to drive_gf in the generic drive code to drive_fl.

This is just variable renames - no code changes.

Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-09-27 19:02:28 -04:00
Kevin O'Connor 04db972290 disk: Don't require the 'struct drive_s' to be in the f-segment
Allow the 'struct drive_s' drive description structure to be in either
the "low" memory segment or the f-segment.

Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-09-27 19:02:16 -04:00
Kevin O'Connor 5e9a6d5b03 boot: Rename drive_g to drive
The 'struct drive_s' pointer is a 32bit pointer (and boot.c code is
only compiled in 32bit mode), so avoid using the "_g" suffix on the
pointer.

Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-09-27 19:01:37 -04:00
Gerd Hoffmann d6728f301d add serial console support
Redirect int10 calls to serial console output.
Parse serial input and queue key events.
The serial console can work both as primary display
and in parallel to another vga display (splitmode).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-09-22 11:13:22 -04:00
Gerd Hoffmann 0ebc29f9c4 paravirt: serial console configuration.
Read QEMU_CFG_NOGRAPHIC, if set add etc/sercon-port
file to enable the serial console.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-09-22 11:13:22 -04:00
Gerd Hoffmann 1bda724cc5 romfile: add support for constant files.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-09-22 11:13:22 -04:00
Gerd Hoffmann 90fa511527 kbd: make enqueue_key public, add ascii_to_keycode
serial console wants queue key events and needs to map ascii chars to
the keycode, so make enqueue_key public and also exports a helper
function so sercon can use the scan_to_keycode mapping table.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-09-22 11:13:22 -04:00
Gerd Hoffmann 44270bc1d2 std: add cp437 to unicode map
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-09-22 11:13:22 -04:00
Aleksandr Bezzubikov ec6cb17f89 pci: enable RedHat PCI bridges to reserve additional resources on PCI init
In case of Red Hat Generic PCIE Root Port reserve additional buses
and/or IO/MEM/PREF space, which values are provided in a vendor-specific capability.

Signed-off-by: Aleksandr Bezzubikov <zuban32s@gmail.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
2017-09-14 15:49:46 -04:00
Aleksandr Bezzubikov 4c1f7272b4 pci: add QEMU-specific PCI capability structure
On PCI init PCI bridge devices may need some
extra info about bus number to reserve, IO, memory and
prefetchable memory limits. QEMU can provide this
with special vendor-specific PCI capability.

This capability is intended to be used only
for Red Hat PCI bridges, i.e. QEMU cooperation.

Signed-off-by: Aleksandr Bezzubikov <zuban32s@gmail.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
2017-09-14 15:49:45 -04:00
Aleksandr Bezzubikov 7de1f65c0c pci: refactor pci_find_capapibilty to get bdf as the first argument instead of the whole pci_device
Refactor pci_find_capability function to get bdf instead of
a whole pci_device* as the only necessary field for this function
is still bdf.

Signed-off-by: Aleksandr Bezzubikov <zuban32s@gmail.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
2017-09-14 15:49:13 -04:00
Kevin O'Connor 1ef72ab2f8 tcgbios: Fix use of unitialized variable
Review-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-09-14 15:44:35 -04:00
Kevin O'Connor 828af21d3e docs: Fix typos in Memory_Model.md
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-09-02 21:38:31 -04:00
Kevin O'Connor ef5fdc99b7 vga: Fix bug in stdvga_get_linesize()
Add required GET_GLOBAL() macro to vmode_g access.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-08-29 14:38:19 -04:00
Gerd Hoffmann b404a5f417 usb-xhci: use hub portmap
xhci controllers have two virtual ports per (usb3 capable) physical
port, one for usb2 and one for usb3 devices.  Add a hub portmap callback
to map the virtual ports to physical ports.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-07-25 13:02:11 +02:00
Gerd Hoffmann ca9dcc2edd usb: add hub portmap
Allow usb hubs to map (software) ports to physical ports via op
callback.  This is needed to make bootorder work in case there
isn't a simple linear mapping.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-07-25 13:00:50 +02:00
Jason Wang dd9bba5b9c virtio: IOMMU support
Since we don't enable IOMMU at all, we can then simply enable the
IOMMU support by claiming the support of VIRITO_F_IOMMU_PLATFORM. This
fixes booting failure when iommu_platform is set from qemu cli.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2017-07-07 10:56:12 -04:00
Zeh, Werner b3a9f27fb1 ahci: Disable Native Command Queueing
The AHCI driver currently sets the NCQ bit for every command that is
issued to the SATA drive.  This is not needed as there is always only
one command active at a time and in turn can lead to a hanging AHCI
controller (true for Marvel 88SE9170). The following patch disables
the usage of NCQ completely. With this patch the Marvel AHCI
controller works just fine without any issues.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-07-02 12:58:52 -04:00
Youness Alaoui 7759d3a5be nvme: Enable NVMe support for non-qemu hardware
NVMe support was tested on purism/librem13 laptops and SeaBIOS has
no problems in detecting and booting the drives.

This is a continuation of commit 235a8190 which was incomplete.

Signed-off-by: Youness Alaoui <youness.alaoui@puri.sm>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-12 21:10:26 -04:00
Patrick Rudolph e30d51cc58 SeaVGABios/cbvga: Advertise compatible VESA modes
Advertise compatible VESA modes, that are smaller or equal to
coreboot's active framebuffer. Only modes that have the same Bpp
are advertise and can be selected.

Allows the Windows 7 bootloader NTLDR to show up in VESA mode.
Allows to show the Windows 7 boot logo.
Allows Windows to boot in safe mode and in normal boot using
VgaSave driver with resolution up to 1600x1200.

This fixes most likely other bootloader and operating systems as well,
in case the are relying on VESA framebuffer support.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
2017-06-12 15:25:12 -04:00
Patrick Rudolph 6b69446de7 SeaVGABios/cbvga: Use active mode to clear screen
As coreboot framebuffer is immutable always use CBmodeinfo.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
2017-06-12 15:17:10 -04:00
Patrick Rudolph 4902b8a703 SeaVGABIOS/vbe: Query driver for scanline pitch v2
Query the driver for the real scanline pitch in bytes.

As cbvga doesn't change the pitch on mode change, always
return the same pitch, that might exceed width times Bytes-per-pixel.

Report the default stdvga pitch for all other drivers.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
2017-06-12 15:17:09 -04:00
Patrick Rudolph 4b42cc4b31 SeaVGABios/cbvga: Advertise correct pixel format
Accumulate the pixel format's bits instead relying on coreboot's
bits_per_pixel, which says nothing about the active pixel format.

Allows VBE to correctly advertise XRGB8 and BGRX8 framebuffer formats,
commonly used by coreboot.

Fixes at least Windows Bootloader and gfxboot.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
2017-06-12 15:10:05 -04:00
Roman Kagan 58953eb793 Revert "lsi-scsi: reset in case of a serious problem"
This reverts commit 11277846e8.

It was originally introduced to deal with the case when REPORT_LUNS
caused an error in QEMU implementation of lsi53c895a and left it in a
"confused" state making further interaction impossible.

However the remedy was worse than the disease: the reset was
controller-wide causing all luns to reset, losing all in-flight requests;
upon that all luns lit up unit_attention condition, so that any
non-informational request would fail with check_condition status.  As a
result, the lun enumeration succeeded and I saw the respective entries
in the boot menu during my testing, but the read from those luns ended
with an error and booting failed, which I didn't bother to test.

So this reverts to the original error handling behavior.  The problem
with the failing REPORT_LUNS is addressed in the preceding patch, by
making it unlikely to fail.

Reported-by: Maciej Józefczyk <maciej.jozefczyk@corp.ovh.com>
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2017-06-12 15:01:31 -04:00
Roman Kagan 6345621ded blockcmd: start REPORT_LUNS with the smallest buffer
A number of emulated SCSI devices in QEMU incorrectly return an error
to REPORT_LUNS command when the size of the data returned is smaller
than the allocation length passed in.

To work it around, start with the smallest allocation length possible:
for 1 entry.  This is a slight pessimization because it would require
another REPORT_LUNS iteration if the target has more than a single LUN,
but this appears to have negligible impact on boot times, and makes
REPORT_LUNS enumeration work for more QEMU devices (lsi53c895a,
mptsas1068).

Reported-by: Maciej Józefczyk <maciej.jozefczyk@corp.ovh.com>
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
2017-06-12 15:01:31 -04:00
Kevin O'Connor dee3c1535d stacks: There is no need to disable NMI if it is already disabled
Don't write to the cmos index port on a mode switch if NMI is already
disabled.  This reduces the number of outb() calls.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-12 14:59:38 -04:00
Kevin O'Connor 8ebb33b158 stacks: Don't update the A20 settings if they haven't changed
The A20 setting is almost always enabled - only issue an outb() if the
A20 is actually changing.  This reduces the number of outb() calls.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-05-16 12:13:32 -04:00