| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
| |
The LBA Format Data structure is dword-sized, but struct nvme_lba_format
erroneously contains an additional member, misaligning all LBAF
descriptors after the first and causing them to be misinterpreted.
Remove it.
Signed-off-by: Florian Larysch <fl@n621.de>
Reviewed-by: Alexander Graf <graf@amazon.com>
|
|
|
|
|
|
|
|
|
| |
Commit b68f313c9139 ("nvme: Record maximum allowed request size")
introduced a use of "identify" past it being passed to free(). Latch the
value of interest into a local variable.
Reported-by: Coverity (ID 1497613)
Signed-off-by: Jan Beulich <jbeulich@suse.com>
|
|
|
|
|
|
|
|
|
|
| |
The variable rx_bytes is marked VARLOW, but there was a missing
GET_LOW() to access rx_bytes. Fix by copying rx_bytes to a local
variable and avoid the repetitive segment memory accesses.
Reported-by: Gabe Black <gabe.black@gmail.com>
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
| |
There is no need to create multiple dma bounce buffers as the BIOS
disk code isn't reentrant capable.
Also, verify that the allocation succeeds.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Reviewed-by: Alexander Graf <graf@amazon.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 01f2736cc905d ("nvme: Pass large I/O requests as PRP lists")
introduced multi-page requests using the NVMe PRP mechanism. To store the
list and "first page to write to" hints, it added fields to the NVMe
namespace struct.
Unfortunately, that struct resides in fseg which is read-only at runtime.
While KVM ignores the read-only part and allows writes, real hardware and
TCG adhere to the semantics and ignore writes to the fseg region. The net
effect of that is that reads and writes were always happening on address 0,
unless they went through the bounce buffer logic.
This patch builds the PRP maintenance data in the existing "dma bounce
buffer" and only builds it when needed.
Fixes: 01f2736cc905d ("nvme: Pass large I/O requests as PRP lists")
Reported-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Alexander Graf <graf@amazon.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Reviewed-by: Alexander Graf <graf@amazon.com>
|
|
|
|
|
|
|
|
| |
When using a prp2 parameter, build it in nvme_prpl_xfer() and pass it
directly to nvme_io_xfer().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Reviewed-by: Alexander Graf <graf@amazon.com>
|
|
|
|
|
|
|
|
| |
Rename nvme_build_prpl() to nvme_prpl_xfer() and directly invoke
nvme_io_xfer() or nvme_bounce_xfer() from that function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Reviewed-by: Alexander Graf <graf@amazon.com>
|
|
|
|
|
|
|
| |
Move bounce buffer processing to a new helper function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Reviewed-by: Alexander Graf <graf@amazon.com>
|
|
|
|
|
|
|
|
| |
Rename nvme_io_readwrite() to nvme_io_xfer() and change it so it
implements the debugging dprintf() and it returns -1 on an error.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Reviewed-by: Alexander Graf <graf@amazon.com>
|
|
|
|
|
|
|
|
| |
Add a hack to suppress spurious gcc array-bounds warning (on at least
gcc v11).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>
|
|
|
|
|
|
|
| |
It's simpler to use b"" designations around binary strings than to use
the as_bytes() function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
| |
Use a different definition for the linker script symbol to avoid a gcc
warning.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
| |
Some versions of gcc complain when VAR16 is used in both the header
and C files - use only in the C file to fix the warning.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
| |
Add all three 4k modes. Computer monitors typically use
the first one (3840x2160).
Add 16 and 32 bpp variants. 24bpp is dead these days, and
software which is so old that still uses those modes most
likely doesn't even know what 4k is.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
if driver reads data larger than VIRTIO_BLK_F_SIZE_MAX,
it will cause some issue to the DMA engine.
So when upper software wants to read data larger than
VIRTIO_BLK_F_SIZE_MAX, virtio-blk driver split one large
request into multiple smaller ones.
Signed-off-by: Andy Pei <andy.pei@intel.com>
Signed-off-by: Ding Limin <dinglimin@cmss.chinamobile.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
r/w request
abstract virtio-blk queue operation to form a function named virtio_blk_op_one_segment
Signed-off-by: Andy Pei <andy.pei@intel.com>
Signed-off-by: Ding Limin <dinglimin@cmss.chinamobile.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
|
|
|
|
|
|
| |
according to virtio spec, add feature VIRTIO_BLK_F_SIZE_MAX
and VIRTIO_BLK_F_SEG_MAX parse to virtio blk driver.
Signed-off-by: Andy Pei <andy.pei@intel.com>
Signed-off-by: Ding Limin <dinglimin@cmss.chinamobile.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With [1] patch hotplug of rtl8139 succeeds, with caveat that it
fails to initialize IO bar, which is caused by [2] that makes
firmware skip IO reservation for any PCIe device, which isn't
correct in case of pcie-pci-bridge.
Fix it by exposing hotplug type and making IO resource optional
only if PCIe hotplug is in use.
[1]
"pci: reserve resources for pcie-pci-bridge to fix regressed hotplug on q35"
[2]
Fixes: 76327b9f32a ("fw/pci: do not automatically allocate IO region for PCIe bridges")
Signed-off-by: Igor Mammedov imammedo@redhat.com
Tested-by: Laurent Vivier <lvivier@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
CC: mapfelba@redhat.com
CC: kraxel@redhat.com
CC: mst@redhat.com
CC: lvivier@redhat.com
CC: jusual@redhat.com
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If QEMU is started with unpopulated pcie-pci-bridge with ACPI PCI
hotplug enabled (default since QEMU-6.1), hotplugging a PCI device
into one of the bridge slots fails due to lack of resources.
once linux guest is booted (test used Fedora 34), hotplug NIC from
QEMU monitor:
(qemu) device_add rtl8139,bus=pcie-pci-bridge-0,addr=0x2
guest fails hotplug with:
pci 0000:01:02.0: [10ec:8139] type 00 class 0x020000
pci 0000:01:02.0: reg 0x10: [io 0x0000-0x00ff]
pci 0000:01:02.0: reg 0x14: [mem 0x00000000-0x000000ff]
pci 0000:01:02.0: reg 0x30: [mem 0x00000000-0x0003ffff pref]
pci 0000:01:02.0: BAR 6: no space for [mem size 0x00040000 pref]
pci 0000:01:02.0: BAR 6: failed to assign [mem size 0x00040000 pref]
pci 0000:01:02.0: BAR 0: no space for [io size 0x0100]
pci 0000:01:02.0: BAR 0: failed to assign [io size 0x0100]
pci 0000:01:02.0: BAR 1: no space for [mem size 0x00000100]
pci 0000:01:02.0: BAR 1: failed to assign [mem size 0x00000100]
8139cp: 8139cp: 10/100 PCI Ethernet driver v1.3 (Mar 22, 2004)
PCI Interrupt Link [GSIG] enabled at IRQ 22
8139cp 0000:01:02.0: no MMIO resource
8139cp: probe of 0000:01:02.0 failed with error -5
Reason for this is that commit [1] didn't take into account
pcie-pci-bridge, marking bridge as non hotpluggable instead of
handling it as possibly SHPC capable bridge.
Fix issue by checking if pcie-pci-bridge is SHPC capable and
if it is mark it as hotpluggable.
Fixes regression in QEMU-6.1 and later, since it was switched
to ACPI based PCI hotplug on Q35 by default at that time.
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=2001732
[1]
Fixes: 3aa31d7d637 ("hw/pci: reserve IO and mem for pci express downstream ports with no devices attached")
Signed-off-by: Igor Mammedov imammedo@redhat.com
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Laurent Vivier <lvivier@redhat.com>
CC: mapfelba@redhat.com
CC: kraxel@redhat.com
CC: mst@redhat.com
CC: lvivier@redhat.com
CC: jusual@redhat.com
|
|
|
|
|
|
| |
Support SMBIOS 3.0 entry points if exposed by QEMU in fw_cfg.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
|
| |
This will make coreboot code (scan_tables()) and xen code
(xen_biostable_setup()) copy SMBIOS 3.0 entry points if
found.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add new copy_smbios_30() function, that will be used to support
SMBIOS 3.0 entry points.
The SMBIOS 3.0 entry point will be tracked in a separate
SMBios30Addr variable, because both 2.1 and 3.0 entry points may
exist at the same time.
Adjust the smbios_get_tables(), smbios_major_version(), and
smbios_minor_version() helpers to use the SMBIOS 3.0 entry point
if available.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Make smbios_build_tables() get u64 address and u32 length
arguments, making it usable for SMBIOS 3.0. Adapt
smbios_21_setup_entry_point() to use intermediate variables when
calling smbios_build_tables().
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
| |
Make max_structure_size and number_of_structures optional,
as we don't have those fields in SMBIOS 3.0 entry points.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
|
| |
Extract the code specific for building the SMBIOS 2.1 entry point
from smbios_romfile_setup() to a new
smbios_21_setup_entry_point() function.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Instead of taking a SMBIOS 2.1 entry point as argument, make
smbios_build_tables() take pointers to the fields it actually
changes. This will allow us to reuse the function for SMBIOS 3.0
later.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move the code that builds the SMBIOS tables to a separate
smbios_build_tables() function, to keep it isolated from the code
that initializes the SMBIOS entry point.
Thew new function will still take a smbios_21_entry_point
argument to make code review easier, but this will be changed by
the next commits.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Use smbios_next() instead of smbios_21_next(), to make the code
more generic and reusable for SMBIOS 3.0 support.
Note that `qtables_len` is initialized to `ftables->size` instead
of `ep.structure_table_length` now, but both fields are
guaranteed to have exactly the same value.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
| |
The variable is now only used inside biostables.c, there's no
need to make it global.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
| |
copy_smbios_21() already checks if SMBios21Addr is NULL, there's
no need to check it before calling the function.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Instead of using the SMBios21Addr global variable, use the
smbios_get_tables() helper. This doesn't change any behavior
yet, but it will be useful when we start supporting SMBIOS 3.0
entry points.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
| |
They new helpers will be useful when we start supporting SMBIOS
3.0 entry points. Use the new helpers at display_uuid().
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
| |
Make the code more generic, and not specific for SMBIOS 2.1 entry
points.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
| |
The new function will be useful for code that just needs the
address and length of SMBIOS tables.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
| |
Extract generic code from smbios_21_next(), so it can be reused
for SMBIOS 3.0 support.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
|
| |
Rename copy_smbios(), smbios_next(), SMBIOS_SIGNATURE,
smbios_entry_point, and SMBiosAddr, to indicate they refer to
SMBIOS 2.1 entry points.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
| |
The get_smbios_entry_point() function doesn't exist, delete
unused prototype.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
|
|
|
| |
Replace the common malloc_fseg() + memcpy() code pattern
with a helper function.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
| |
In the rare case of a TPM 2 failure, disable the platform hierarchy after
disabling the endorsement and owner hierarchies.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
|
|
|
|
| |
Signed-off-by: Alex Martens <alexmgit@protonmail.com>
|
|
|
|
|
|
|
|
|
| |
Instead of just using sha1 for all PCR banks (and truncating
the value or zero-padding it) use the proper hash function for
each one of the banks. For unimplemented hashes, fill the buffer
with 0xff.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
|
|
|
|
| |
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
|
|
|
|
|
|
|
|
|
| |
Fix two details of the logs:
- Set the field 'SpecErrata' to 2 as required by specs.
- Write the separator into the log entry's event field.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In function run_thread() the function check_irqs() gets called
after the thread switch for atomic handoff reasons. In yield()
it's the other way round.
If check_irqs() is called after run_thread() and check_irqs()
is called before switch_next() in yield(), it can happen in a
constructed case that a background thread runs twice without
a check_irqs() call in between. Call check_irqs() after
switch_next() in yield() to prevent this.
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The comment above the yield() function suggests that yield()
allows interrupts for a short time. But yield() only briefly
enables interrupts if seabios was built without CONFIG_THREADS
or if yield() is called from the main thread. In order to
guarantee that the interrupts were enabled once before yield()
returns in a background thread, the main thread must call
check_irqs() before or after every thread switch. The function
run_thread() also switches threads, but the call to check_irqs()
was forgotten. Add the missing check_irqs() call.
This fixes PS/2 keyboard initialization failures.
The code in src/hw/ps2port.c relies on yield() to briefly enable
interrupts. There is a comment above the yield() function in
__ps2_command(), where the author left a remark why the call to
yield() is actually needed.
Here is one of the call sequences leading to a PS/2 keyboard
initialization failure.
ps2_keyboard_setup()
|
ret = i8042_command(I8042_CMD_CTL_TEST, param);
# This command will register an interrupt if the PS/2 device
# controller raises interrupts for replies to a controller
# command.
|
ret = ps2_kbd_command(ATKBD_CMD_RESET_BAT, param);
|
ps2_command(0, command, param);
|
ret = __ps2_command(aux, command, param);
|
// Flush any interrupts already pending.
yield();
# yield() doesn't flush interrupts if the main thread
# hasn't reached wait_threads().
|
ret = ps2_sendbyte(aux, command, 1000);
# Reset the PS/2 keyboard controller and wait for
# PS2_RET_ACK.
|
ret = ps2_recvbyte(aux, 0, 4000);
|
for (;;) {
|
status = inb(PORT_PS2_STATUS);
# I8042_STR_OBF isn't set because the keyboard self
# test reply is still on wire.
|
yield();
# After a few yield()s the keyboard interrupt fires
# and clears the I8042_STR_OBF status bit. If the
# keyboard self test reply arrives before the
# interrupt fires the keyboard reply is lost and
# ps2_recvbyte() returns after the timeout.
}
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
BUILD_MIN_BIOSTABLE reserves space in the f-segment. Some data
structures -- for example disk drives known to seabios -- must be
stored there, so the space available here limits the number of
devices seabios is able to manage.
This patch sets BUILD_MIN_BIOSTABLE to 8k for bios images being 256k or
larger in size. 32bit code is moved off in that case, so we have more
room in the f-segment then.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
|
| |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|