aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* virtio: finalize features before using devicerel-1.16.1Xuan Zhuo2022-11-232-9/+26
| | | | | | | | | | | | | | | | | | | Under the standard of Virtio 1.0, the initialization process of the device must first write sub-features back to device before using device, such as finding vqs. There are four places using vp_find_vq(). 1. virtio-blk.pci: put the code of finalizing features in front of using device 2. virtio-blk.mmio: put the code of finalizing features in front of using device 3. virtio-scsi.pci: is ok 4. virtio-scsi.mmio: add the code of finalizing features before vp_find_vq() Link: https://www.mail-archive.com/qemu-devel@nongnu.org/msg920776.html Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20221114035818.109511-3-xuanzhuo@linux.alibaba.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* virtio-mmio: read/write the hi 32 features for mmioXuan Zhuo2022-11-231-2/+5
| | | | | | | | | | | Under mmio, when we read the feature from the device, we should read the high 32-bit part. Similarly, when writing the feature back, we should also write back the high 32-bit feature. Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20221114035818.109511-2-xuanzhuo@linux.alibaba.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* acpi: parse Alias objectIgor Mammedov2022-11-231-0/+4
| | | | | | | | | | | | | | | | | | | Since QEMU commit 47a373faa6 (acpi: pc/q35: drop ad-hoc PCI-ISA bridge AML routines and let bus ennumeration generate AML) SeaBIOS fails to parse ISA bridge AML with: parse_termlist: parse error, skip from 92/517 ... ACPI: no PS/2 keyboard present due to Alias term in DSDT which isn't handled by SeaBIOS properly. Add dumb Alias parsing which just skips over term, so the rest of AML could be parsed successfully. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reported-by: Volker Rümelin <vr_qemu@t-online.de> Message-Id: <20221118142755.3879231-1-imammedo@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* virtio-blk: Fix incorrect type conversion in virtio_blk_op()Xiaofei Lee2022-11-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using spdk aio bdev driver, the qemu command line like this: qemu-system-x86_64 \ -chardev socket,id=char0,path=/tmp/vhost.0 \ -device vhost-user-blk-pci,id=blk0,chardev=char0 \ ... Boot failure message as below: e820 map has 7 items: 0: 0000000000000000 - 000000000009fc00 = 1 RAM 1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED 2: 00000000000f0000 - 0000000000100000 = 2 RESERVED 3: 0000000000100000 - 000000007ffdd000 = 1 RAM 4: 000000007ffdd000 - 0000000080000000 = 2 RESERVED 5: 00000000feffc000 - 00000000ff000000 = 2 RESERVED 6: 00000000fffc0000 - 0000000100000000 = 2 RESERVED enter handle_19: NULL Booting from Hard Disk... Boot failed: could not read the boot disk Fixes: a05af290bac5 ("virtio-blk: split large IO according to size_max") Acked-by: Andy Pei <andy.pei@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Paul Menzel <pmenzel@molgen.mpg.de> Signed-off-by: Xiaofei Lee <hbuxiaofei@gmail.com>
* virtio-blk: use larger default request sizeGerd Hoffmann2022-07-071-1/+1
| | | | | | | | | | | Bump default from 8 to 64 blocks. Using 8 by default leads to requests being splitted on qemu, which slows down boot. Some (temporary) debug logging added showed that almost all requests on a standard fedora install are less than 64 blocks, so that should bring us back to 1.15 performance levels. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* malloc: use large ZoneHigh when there is enough memoryGerd Hoffmann2022-04-272-6/+11
| | | | | | In case there is enough memory installed use a large ZoneHigh. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* malloc: use variable for ZoneHigh sizeGerd Hoffmann2022-04-271-7/+8
| | | | | | | | | | | Use the variable highram_size instead of the BUILD_MAX_HIGHTABLE #define for the ZoneHigh size. Initialize the new variable with the old #define, so behavior does not change. This allows to easily adjust the ZoneHigh size at runtime in a followup patch. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* reset: force standard PCI configuration accessVolker Rümelin2022-04-043-7/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | After a reset of a QEMU -machine q35 guest, the PCI Express Enhanced Configuration Mechanism is disabled and the variable mmconfig no longer matches the configuration register PCIEXBAR of the Q35 chipset. Until the variable mmconfig is reset to 0, all pci_config_*() functions no longer work. The variable mmconfig is located in one of the read-only C-F segments. To reset it the pci_config_*() functions are needed, but they do not work. Replace all pci_config_*() calls with Standard PCI Configuration Mechanism pci_ioconfig_*() calls until mmconfig is overwritten with 0 by a fresh copy of the BIOS. This fixes In resume (status=0) In 32bit resume Attempting a hard reboot Unable to unlock ram - bridge not found and a reset loop with QEMU -accel tcg. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
* pci: refactor the pci_config_*() functionsVolker Rümelin2022-04-042-13/+53
| | | | | | | | | Split out the Standard PCI Configuration Access Mechanism pci_ioconfig_*() functions from the pci_config_*() functions. The standard PCI CAM functions will be used in the next patch. Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
* docs: Note v1.16.0 releaserel-1.16.0Kevin O'Connor2022-03-011-0/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* nvme: fix LBA format data structureFlorian Larysch2022-02-031-1/+0
| | | | | | | | | | 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>
* nvme: avoid use-after-free in nvme_controller_enable()Jan Beulich via SeaBIOS2022-01-271-1/+2
| | | | | | | | | 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>
* sercon: Fix missing GET_LOW() to access rx_bytesKevin O'Connor2022-01-271-9/+11
| | | | | | | | | | 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>
* nvme: Only allocate one dma bounce buffer for all nvme drivesKevin O'Connor2022-01-272-9/+15
| | | | | | | | | | 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>
* nvme: Build the page list in the existing dma bufferKevin O'Connor2022-01-272-43/+24
| | | | | | | | | | | | | | | | | | | | | | 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>
* nvme: Pass prp1 and prp2 directly to nvme_io_xfer()Kevin O'Connor2022-01-271-21/+18
| | | | | | | | 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>
* nvme: Convert nvme_build_prpl() to nvme_prpl_xfer()Kevin O'Connor2022-01-272-27/+20
| | | | | | | | 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>
* nvme: Add nvme_bounce_xfer() helper functionKevin O'Connor2022-01-211-14/+21
| | | | | | | 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>
* nvme: Rework nvme_io_readwrite() to return -1 on errorKevin O'Connor2022-01-211-19/+18
| | | | | | | | 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>
* smm: Suppress gcc array-bounds warningsKevin O'Connor2022-01-211-6/+15
| | | | | | | | 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>
* scripts: Remove python23compat.pyKevin O'Connor2021-12-193-21/+3
| | | | | | | 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>
* readserial: Improve Python3 compatibilityKevin O'Connor2021-12-191-17/+11
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* memmap: Fix gcc out-of-bounds warningKevin O'Connor2021-12-181-1/+1
| | | | | | | Use a different definition for the linker script symbol to avoid a gcc warning. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgasrc: Don't use VAR16 in header files to fix gcc warningKevin O'Connor2021-12-181-2/+2
| | | | | | | 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>
* svgamodes: add standard 4k modesGerd Hoffmann2021-12-181-0/+8
| | | | | | | | | | | 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>
* virtio-blk: split large IO according to size_maxAndy Pei2021-12-181-1/+34
| | | | | | | | | | | | | 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>
* virtio-blk: abstract a function named virtio_blk_op_one_segment to handle ↵Andy Pei2021-12-181-20/+28
| | | | | | | | | | 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>
* virtio-blk: add feature VIRTIO_BLK_F_SIZE_MAX and VIRTIO_BLK_F_SEG_MAXAndy Pei2021-12-183-8/+48
| | | | | | | | | 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>
* 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>