Commit Graph

2654 Commits

Author SHA1 Message Date
Gerd Hoffmann 0c2b3b1d95 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>
2018-06-22 07:44:07 +02:00
Gerd Hoffmann 902bacb5f0 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>
2018-06-22 07:44:07 +02:00
Gerd Hoffmann 77404b450d 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>
2018-06-22 07:44:07 +02:00
Gerd Hoffmann 4d70b24b86 cbvga: factor out cbvga_setup_modes()
Factor out generic data structure setup code from cbvga_setup().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2018-06-22 07:44:07 +02:00
Gerd Hoffmann e28e0bb39b 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>
2018-06-22 07:44:07 +02:00
Kevin O'Connor 237fd3943d docs: Update Download.md to use git clone via https
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-11 12:05:31 -04:00
Stefan Berger d1343e6863 tpm: Request access to locality 0
The CRB driver has to request access to locality 0. Our QEMU
CRB model will enforce that as well.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-04-12 15:20:36 -04:00
Stefan Berger 4922d6cb39 tpm: when CRB is active, select, lock it, and check addresses
Do not just indicate that the probing for the CRB interface was successful
if we find it active. Instead, select it, lock it, and test the addresses
for whether they can be used (must be 32 bit).

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-03-21 10:35:54 -04:00
Stefan Berger 8bd306e10f tpm: revert return values for successful/failed CRB probing
The return values for successful/failed CRB probing were reverted.
Fix it.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-03-21 10:35:54 -04:00
Stefan Berger 408630ef19 tpm: Wait for tpmRegValidSts flag on CRB interface before probing
Wait for the tpmRegValidSts flag on the TPM_LOC_STATE_x register to
be set; we expect the locAssigned flag to not be set.

Real hardware seems to set the tpmRegValidSts flag without for
example requesting access to a locality.

Tested-by: Stephen Douthit <stephend@silicom-usa.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-03-21 10:34:53 -04:00
Stephen Douthit 5adc8bdea6 tpm: Handle unimplemented TIS_REG_IFACE_ID in tis_get_tpm_version()
If a device reports 0xf in the InterfaceType field of the TPM_INTERFACE_ID,
then the rest of the fields are invalid, and the InterfaceVersion field of
the TPM_INTF_CAPABILITY register must be checked instead.

Signed-off-by: Stephen Douthit <stephend@silicom-usa.com>
Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-03-02 10:59:36 -05:00
Stephen Douthit 96060ad1c3 tpm: Wait for interface startup when probing
This is based on wait_startup() from the Linux tpm_tis driver.

Signed-off-by: Stephen Douthit <stephend@silicom-usa.com>
Tested-by: Stephen Douthit <stephend@silicom-usa.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-03-02 10:59:24 -05:00
Stephen Douthit 559b3e2ba4 tpm: Refactor duplicated wait code in tis_wait_sts() & crb_wait_reg()
Signed-off-by: Stephen Douthit <stephend@silicom-usa.com>
Tested-by: Stephen Douthit <stephend@silicom-usa.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-03-02 10:59:09 -05:00
Marc-André Lureau 9c6e73b5eb tpm: add TPM CRB device support
The CRB device was introduced with TPM 2.0 to be physical-bus agnostic
and defined in TCG PC Client Platform TPM Profile (PTP) Specification
Family “2.0” Level 00 Revision 01.03 v22

It seems to be required with Windows 10. It is also a simpler device
than FIFO/TIS.

This patch only support locality 0 since also the CRB device in QEMU
only supports this locality.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-02-27 11:29:11 -05:00
Marc-André Lureau a197e204ca tpm: use get_tpm_version() callback
As originally intended.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-02-27 11:29:11 -05:00
Marc-André Lureau c75d45a971 tpm: generalize init_timeout()
It seems both TIS & CRB devices share the same timeout. Make
initialization function generic now.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-02-27 11:29:11 -05:00
Marc-André Lureau 8694c3bc84 x86: add readq()
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-02-27 11:29:11 -05:00
Kevin O'Connor a3c93bd81d 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>
2018-02-27 11:27:59 -05:00
Kevin O'Connor 42812e062a 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>
2018-02-22 20:38:23 -05:00
Nikolay Nikolov af0daeb268 floppy: Send 4 sense interrupt commands during controller initialization
During initialization, real floppy controllers need 4 sense interrupt commands
to clear the interrupt status (this represents the transition from "not ready"
to "ready" for each of the four virtual floppy drives), instead of just one.

This is described in detail in section 7.4 - Drive Polling of the Intel 82077AA
datasheet.

Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
2018-02-15 00:18:14 -05:00
Nikolay Nikolov 2611db472c floppy: Wait for the floppy motor to reach a stable speed, after starting
When starting up the floppy motor, wait for a certain amount of time, so
that it can spin up and reach a stable speed. This delay is skipped, if the
motor was already running (which can happen, since the floppy motor is
intentionally kept spinning for 2 seconds after the previous floppy
operation completes).

Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
2018-02-15 00:18:14 -05:00
Nikolay Nikolov 81f45a62e8 floppy: Support up to 4 floppy drives when turning on the floppy motor
The previous version allowed for only two floppies.

Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
2018-02-15 00:18:14 -05:00
Nikolay Nikolov f9cc969b3e floppy: Execute a SPECIFY command after sensing the media type
The SPECIFY command sets the Step Rate Time, Head Load Time, Head Unload Time
and the DMA enable/disable bit.

Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
2018-02-15 00:18:14 -05:00
Nikolay Nikolov b00a03a49e floppy: hold the DOR reset bit low for 4 microseconds, when resetting
Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
2018-02-15 00:18:14 -05:00
Nikolay Nikolov 4a6dbcea3e floppy: Use timer_check() in floppy_wait_irq()
Use timer_check() instead of using floppy_motor_counter in BDA for the
timeout check in floppy_wait_irq().

The problem with using floppy_motor_counter was that, after it reaches
0, it immediately stops the floppy motors, which is not what is
supposed to happen on real hardware. Instead, after a timeout (like in
the end of every floppy operation, regardless of the result - success,
timeout or error), the floppy motors must be kept spinning for
additional 2 seconds (the FLOPPY_MOTOR_TICKS). So, now the
floppy_motor_counter is initialized to 255 (the max value) in the
beginning of the floppy operation. For IRQ timeouts, a different
timeout is used, specified by the new FLOPPY_IRQ_TIMEOUT constant
(currently set to 5 seconds - a fairly conservative value, but should
work reliably on most floppies).

After the floppy operation, floppy_drive_pio() resets the
floppy_motor_counter to 2 seconds (FLOPPY_MOTOR_TICKS).

This is also consistent with what other PC BIOSes do.

Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
2018-02-07 21:19:42 -05:00
Nikolay Nikolov 488ede2297 floppy: Reset the floppy motor count in floppy_drive_pio()
Reset the floppy motor count, so the motor keeps spinning 2 seconds
after a floppy operation, performed by floppy_drive_pio().

Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
2018-02-07 21:19:38 -05:00
Nikolay Nikolov 53d82f0ee8 floppy: Preserve motor and drive sel bits when resetting the floppy controller
In case of read or write errors, the floppy system is usually reset and the
operation is retried. In that case, the floppy motor state must be preserved
in order to avoid creating jitter and keep the floppy motor spinning smoothly
at a constant speed. Additionally, the drive select bits should probably also
be preserved, because some systems might need a small delay after selecting a
new drive. In that case, the operation would be retried, without changing
the currently selected drive.

In floppy_enable_controller(), the IRQ bit is now enabled first, before the
reset bit is set. I'm not completely sure whether this is necessary. It is
done just in case some hardware introduces a delay between setting this bit
and actually enabling the IRQ, which would cause us to miss the IRQ, sent by
the controller immediately after reset.

Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
2018-02-07 21:16:21 -05:00
Nikolay Nikolov 53fc631307 floppy: Introduce FLOPPY_DOR_XXX constants
Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
2018-02-07 21:16:17 -05:00
Nikolay Nikolov 5157a7882d floppy: Introduce floppy_dor_mask()
Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
2018-02-07 21:16:12 -05:00
Nikolay Nikolov 3ddb42f38f floppy: Introduce the floppy_dor_read() function
Signed-off-by: Nikolay Nikolov <nickysn@users.sourceforge.net>
2018-02-07 21:16:06 -05:00
Marcel Apfelbaum 14d91c353e 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>
2018-01-16 19:39:16 -05:00
Paul Menzel 844b86464a docs/Download: Use more secure HTTPS URLs where possible
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
2017-12-08 11:03:08 -05:00
Stefan Berger df46d10c8a tpm: Add support for TPM2 ACPI table
Add support for the TPM2 ACPI table. If we find it and its
of the appropriate size, we can get the log_area_start_address
and log_area_minimum_size from it.

The latest version of the spec can be found here:

https://trustedcomputinggroup.org/tcg-acpi-specification/

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-11-15 13:17:20 -05:00
Kevin O'Connor 0541f2f0f2 paravirt: Only enable sercon in NOGRAPHIC mode if no other console specified
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-11-10 12:20:35 -05:00
Kevin O'Connor 9ce6778f08 docs: Add sercon-port to Runtime_config.md documentation
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-11-10 12:16:36 -05: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