aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* pci: let firmware reserve IO for pcie-pci-bridgeIgor Mammedov2021-12-181-5/+14
| | | | | | | | | | | | | | | | | | | | | | 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
* pci: reserve resources for pcie-pci-bridge to fix regressed hotplug on q35Igor Mammedov2021-12-181-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* smbios: Support SMBIOS 3.0 entry point at smbios_romfile_setup()Eduardo Habkost2021-12-181-3/+30
| | | | | | Support SMBIOS 3.0 entry points if exposed by QEMU in fw_cfg. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: Support SMBIOS 3.0 entry point at copy_table()Eduardo Habkost2021-12-181-0/+1
| | | | | | | | 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>
* smbios: copy_smbios_30() functionEduardo Habkost2021-12-182-2/+47
| | | | | | | | | | | | | | | 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>
* smbios: Make smbios_build_tables() ready for 64-bit tablesEduardo Habkost2021-12-181-3/+13
| | | | | | | | | 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>
* smbios: Make some smbios_build_tables() arguments optionalEduardo Habkost2021-12-181-2/+6
| | | | | | | 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>
* smbios: smbios_21_setup_entry_point() functionEduardo Habkost2021-12-181-13/+20
| | | | | | | | 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>
* smbios: Make smbios_build_tables() more genericEduardo Habkost2021-12-181-13/+19
| | | | | | | | | 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>
* smbios: Extract SMBIOS table building code to separate functionEduardo Habkost2021-12-181-20/+34
| | | | | | | | | | | | 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>
* smbios: Use smbios_next() at smbios_romfile_setup()Eduardo Habkost2021-12-181-3/+4
| | | | | | | | | | | 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>
* smbios: Make SMBios21Addr variable staticEduardo Habkost2021-12-182-2/+1
| | | | | | | 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>
* csm: Don't check SMBios21Addr before calling copy_smbios_21()Eduardo Habkost2021-12-181-1/+1
| | | | | | | 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>
* tpm: Use smbios_get_tables()Eduardo Habkost2021-12-181-5/+5
| | | | | | | | | 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>
* smbios: smbios_major_version()/smbios_minor_version() helpersEduardo Habkost2021-12-181-3/+21
| | | | | | | 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>
* smbios: Use smbios_get_tables()/smbios_next() at display_uuid()Eduardo Habkost2021-12-181-2/+4
| | | | | | | Make the code more generic, and not specific for SMBIOS 2.1 entry points. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: smbios_get_tables() functionEduardo Habkost2021-12-182-0/+10
| | | | | | | 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>
* smbios: Generic smbios_next() functionEduardo Habkost2021-12-181-4/+12
| | | | | | | 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>
* smbios: Rename code specific for SMBIOS 2.1 entry pointsEduardo Habkost2021-12-186-33/+33
| | | | | | | | 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>
* util.h: Delete unused get_smbios_entry_point() prototypeEduardo Habkost2021-12-181-1/+0
| | | | | | | The get_smbios_entry_point() function doesn't exist, delete unused prototype. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* biostables: copy_fseg_table() functionEduardo Habkost2021-12-181-24/+16
| | | | | | | Replace the common malloc_fseg() + memcpy() code pattern with a helper function. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* docs: Note v1.15.0 releaserel-1.15.0Kevin O'Connor2021-12-021-0/+11
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tcgbios: Disable platform hierarchy in case of failureStefan Berger2021-09-231-0/+1
| | | | | | | 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>
* nvme: fix missing newline on sq full printAlex Martens via SeaBIOS2021-06-301-1/+1
| | | | Signed-off-by: Alex Martens <alexmgit@protonmail.com>
* tcgbios: Use The proper sha function for each PCR bankStefan Berger2021-06-301-15/+43
| | | | | | | | | 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>
* Add implementations for sha256, sha384, and sha512Stefan Berger2021-06-308-14/+479
| | | | Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
* tcgbios: Fix details in log entriesStefan Berger2021-06-301-2/+3
| | | | | | | | | 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>
* stacks: call check_irqs() after switch_next()Volker Rümelin2021-06-091-3/+2
| | | | | | | | | | | | | | 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>
* stacks: call check_irqs() in run_thread()Volker Rümelin2021-06-091-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Increase BUILD_MIN_BIOSTABLE for large romsGerd Hoffmann2021-06-041-0/+4
| | | | | | | | | | | | | 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>
* nvme: drive desc should not include the newlineGerd Hoffmann2021-05-311-2/+2
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* nvme: improve namespace allocationGerd Hoffmann2021-05-312-25/+16
| | | | | | | | Instead of allocating a big array upfront go probe the namespaces and only allocate an nvme_namespace struct for those namespaces which are actually active. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* vgasrc: ignore .node.gnu.property (binutils-2.36 support)Sergei Trofimovich2021-05-261-1/+8
| | | | | | | | | | | | | | | Modern binutils unconditionally tracks x86_64 ISA levels in intermediate files in .note.gnu.property. Custom liker script does not handle the section and complains about it: ld --gc-sections -T out/vgasrc/vgalayout.lds out/vgaccode16.o \ out/vgaentry.o out/vgaversion.o -o out/vgarom.o ld: section .note.gnu.property LMA [0000000000000000,0000000000000027] \ overlaps section .text LMA [0000000000000000,00000000000098af] The change ignores .note* sections. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* usb-hid: Increase MAX_KBD_EVENTStefan Ott via SeaBIOS2021-03-101-1/+1
| | | | | | | | | | Some USB keyboards use max packet sizes beyond the current maximum supported by SeaBIOS. This increases the available size to support keyboards such as the Matias Ergo Pro. Signed-off-by: Stefan Ott <stefan@ott.net>
* Support booting USB drives with a write protect switch enabledMike Banon2020-12-211-3/+7
| | | | | | | | | | At least some USB drives with a write protect switch (e.g. Netac U335) could report "MEDIUM NOT PRESENT" for a while if a write protection is enabled. Instead of stopping the initialization attempts immediately, stop only after getting this report for 3 times, to ensure the successful initialization of such a "broken hardware". Signed-off-by: Mike Banon <mikebdp2@gmail.com>
* nvme: Clean up nvme_cmd_readwrite()David Woodhouse2020-11-161-44/+33
| | | | | | | | | | | | | | This ended up with an odd mix of recursion (albeit *mostly* tail-recursion) and interation that could have been prettier. In addition, while recursing it potentially adjusted op->count which is used by callers to see the amount of I/O actually performed. Fix it by bringing nvme_build_prpl() into the normal loop using 'i' as the offset in the op. Fixes: 94f0510dc ("nvme: Split requests by maximum allowed size") Reviewed-by: Alexander Graf <graf@amazon.com> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
* nvme: Split requests by maximum allowed sizeAlexander Graf2020-10-281-0/+16
| | | | | | | | | | | | | | | | | Some NVMe controllers only support small maximum request sizes, such as the AWS EBS NVMe implementation which only supports NVMe requests of up to 32 pages (256kb) at once. BIOS callers can exceed those request sizes by defining sector counts above this threshold. Currently we fall back to the bounce buffer implementation for those. This is slow. This patch introduces splitting logic to the NVMe I/O request code so that every NVMe I/O request gets handled in a chunk size that is consumable by the NVMe adapter, while maintaining the fast path PRPL logic we just introduced. Signed-off-by: Alexander Graf <graf@amazon.com>
* nvme: Pass large I/O requests as PRP listsAlexander Graf2020-10-282-10/+82
| | | | | | | | | | | | | | | | | | | Today, we split every I/O request into at most 4kb chunks and wait for these requests to finish. We encountered issues where the backing storage is network based, so every I/O request needs to go over the network with associated latency cost. A few ms of latency when loading 100MB initrd in 4kb chunks does add up. NVMe implements a feature to allow I/O requests spanning multiple pages, called PRP lists. This patch takes larger I/O operations and checks if they can be directly passed to the NVMe backing device as PRP list. At least for grub, read operations can always be mapped directly into PRP list items. This reduces the number of I/O operations required during a typical boot path by roughly a factor of 5. Signed-off-by: Alexander Graf <graf@amazon.com>
* nvme: Allow to set PRP2Alexander Graf2020-10-281-5/+6
| | | | | | | | | | | | | When creating a PRP based I/O request, we pass in the pointer to operate on. Going forward, we will want to be able to pass additional pointers though for mappings above 4k. This patch adds a parameter to nvme_get_next_sqe() to pass in the PRP2 value of an NVMe I/O request, paving the way for a future patch to implement PRP lists. Signed-off-by: Alexander Graf <graf@amazon.com> Reviewed-by: Filippo Sironi <sironi@amazon.de>
* nvme: Record maximum allowed request sizeAlexander Graf2020-10-282-3/+18
| | | | | | | | NVMe has a limit on how many sectors it can handle at most within a single request. Remember that number, so that in a follow-up patch, we can verify that we don't exceed it. Signed-off-by: Alexander Graf <graf@amazon.com>
* usb boot: add xhci mmio exampleGerd Hoffmann2020-10-151-1/+3
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201013091019.22029-1-kraxel@redhat.com
* usb/xhci: add support for mmio host adapters (via acpi).Gerd Hoffmann2020-10-131-0/+31
| | | | | | | | | Add xhci_controller_setup_acpi() function to initialize usb host adapters declared in the DSDT table. Search the acpi devices list for xhci controllers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20200930111433.21533-4-kraxel@redhat.com
* usb/xhci: split xhci setup into generic and pci partsGerd Hoffmann2020-10-131-13/+27
| | | | | | | | | Split the pci-specific code into a separate xhci_controller_setup_pci() function, turn xhci_controller_setup() to a generic xhci setup function which only needs the mmio address if the control registers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20200930111433.21533-3-kraxel@redhat.com
* usb: add boot prio support for mmio host adaptersGerd Hoffmann2020-10-132-1/+10
| | | | | | | | Add mmio field to usb controller struct, add support for mmio-mapped usb host adapters to boot order handling. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20200930111433.21533-2-kraxel@redhat.com
* dsdt: add support for pnp ids as stringsGerd Hoffmann2020-10-131-8/+13
| | | | | | | | | | | | | | | | PNP devices can be declared using eisaid encoding ... Name (_HID, EisaId ("PNP0103")) ... or as string ... Name (_HID, "PNP0A06") .. so lets support both variants. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20200930111222.6020-3-kraxel@redhat.com
* output: add support for uppercase hex numbersGerd Hoffmann2020-10-131-22/+27
| | | | | | | | ... via "%X" format string. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20200930111222.6020-2-kraxel@redhat.com
* USB:Fix xHCI initail fail by using longer reset and CNR clear timeout valueweitaowang-oc@zhaoxin.com2020-09-301-2/+2
| | | | | | | | | | | Some xHCI controller's reset time than 100ms,such as 120ms. On the on hand, xHCI spec has not specified a timeout value. Maybe setting xHCI HCRST and CNR bit clear timeout value larger is a nice thing.As a compromise between compatibility and latency,we can take 1000ms as a timeout value. Signed-off-by: WeitaoWangoc <WeitaoWang-oc@zhaoxin.com> Message-Id: <159698294308.14.13067234241650533818@b63950293ec5>
* usb.c: Fix devices using non-primary interface descriptorMatt DeVillier2020-09-251-8/+19
| | | | | | | | | | | | | A fair number of USB devices (keyboards in particular) use an interface descriptor other than the first available, making them non-functional currently. To correct this, iterate through all available interface descriptors until one with the correct class/subclass is found, then proceed to set the configuration and setup the driver. Tested on an ultimate hacking keyboard (UHK 60) Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
* smbios: avoid integer overflow when adding SMBIOS type 0 tableDaniel P. Berrangé2020-09-081-4/+10
| | | | | | | | | SeaBIOS implements the SMBIOS 2.1 entry point which is limited to a maximum length of 0xffff. If the SMBIOS data received from QEMU is large enough, then adding the type 0 table will cause integer overflow. This results in fun behaviour such as KVM crash, or hangs in SeaBIOS. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* docs: Note v1.14.0 releaseKevin O'Connor2020-08-101-0/+13
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>