eb86ba78e5
- Fix stable issues found in upstream: hmp-Fix-loadvm-to-resume-the-VM-on-succe.patch hw-block-nvme-align-with-existing-style.patch hw-nvme-fix-missing-check-for-PMR-capabi.patch hw-nvme-fix-pin-based-interrupt-behavior.patch linux-user-aarch64-Enable-hwcap-for-RND-.patch qemu-config-load-modules-when-instantiat.patch qemu-config-parse-configuration-files-to.patch qemu-config-use-qemu_opts_from_qdict.patch runstate-Initialize-Error-to-NULL.patch target-i386-Exit-tb-after-wrmsr.patch tcg-Allocate-sufficient-storage-in-temp_.patch tcg-sparc-Fix-temp_allocate_frame-vs-spa.patch vhost-vdpa-don-t-initialize-backend_feat.patch vl-allow-not-specifying-size-in-m-when-u.patch vl-Fix-an-assert-failure-in-error-path.patch vl-plug-object-back-into-readconfig.patch vl-plumb-keyval-based-options-into-readc.patch x86-acpi-use-offset-instead-of-pointer-w.patch - Update qemu-supportconfig plugin - Fix an update-alternative warning when removing qemu-skiboot package bsc#1178678 OBS-URL: https://build.opensuse.org/request/show/903710 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=660
131 lines
5.8 KiB
Diff
131 lines
5.8 KiB
Diff
From: Igor Mammedov <imammedo@redhat.com>
|
|
Date: Wed, 14 Apr 2021 04:43:56 -0400
|
|
Subject: x86: acpi: use offset instead of pointer when using build_header()
|
|
|
|
Git-commit: bb9feea43179ef8aba2c0a9cc1e670cb049ba90e
|
|
|
|
Do the same as in commit
|
|
(4d027afeb3a97 Virt: ACPI: fix qemu assert due to re-assigned table data address)
|
|
for remaining tables that happen to use saved at
|
|
the beginning pointer to build header to avoid assert
|
|
when table_data is relocated due to implicit re-size.
|
|
|
|
In this case user is trying to start Windows 10 and getting assert at
|
|
hw/acpi/bios-linker-loader.c:239:
|
|
bios_linker_loader_add_checksum: Assertion `start_offset < file->blob->len' failed.
|
|
|
|
Fixes: https://bugs.launchpad.net/bugs/1923497
|
|
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
|
|
Message-Id: <20210414084356.3792113-1-imammedo@redhat.com>
|
|
Cc: mst@redhat.com, qemu-stable@nongnu.org
|
|
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Signed-off-by: Jose R. Ziviani <jziviani@suse.de>
|
|
---
|
|
hw/acpi/aml-build.c | 15 +++++++++------
|
|
hw/i386/acpi-build.c | 8 ++++++--
|
|
2 files changed, 15 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
|
|
index d33ce8954aa6b51788c443e5c6a9..f0035d2b4a183363e0b162b2e5b0 100644
|
|
--- a/hw/acpi/aml-build.c
|
|
+++ b/hw/acpi/aml-build.c
|
|
@@ -1830,6 +1830,7 @@ build_rsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets,
|
|
int i;
|
|
unsigned rsdt_entries_offset;
|
|
AcpiRsdtDescriptorRev1 *rsdt;
|
|
+ int rsdt_start = table_data->len;
|
|
const unsigned table_data_len = (sizeof(uint32_t) * table_offsets->len);
|
|
const unsigned rsdt_entry_size = sizeof(rsdt->table_offset_entry[0]);
|
|
const size_t rsdt_len = sizeof(*rsdt) + table_data_len;
|
|
@@ -1846,7 +1847,8 @@ build_rsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets,
|
|
ACPI_BUILD_TABLE_FILE, ref_tbl_offset);
|
|
}
|
|
build_header(linker, table_data,
|
|
- (void *)rsdt, "RSDT", rsdt_len, 1, oem_id, oem_table_id);
|
|
+ (void *)(table_data->data + rsdt_start),
|
|
+ "RSDT", rsdt_len, 1, oem_id, oem_table_id);
|
|
}
|
|
|
|
/* Build xsdt table */
|
|
@@ -1857,6 +1859,7 @@ build_xsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets,
|
|
int i;
|
|
unsigned xsdt_entries_offset;
|
|
AcpiXsdtDescriptorRev2 *xsdt;
|
|
+ int xsdt_start = table_data->len;
|
|
const unsigned table_data_len = (sizeof(uint64_t) * table_offsets->len);
|
|
const unsigned xsdt_entry_size = sizeof(xsdt->table_offset_entry[0]);
|
|
const size_t xsdt_len = sizeof(*xsdt) + table_data_len;
|
|
@@ -1873,7 +1876,8 @@ build_xsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets,
|
|
ACPI_BUILD_TABLE_FILE, ref_tbl_offset);
|
|
}
|
|
build_header(linker, table_data,
|
|
- (void *)xsdt, "XSDT", xsdt_len, 1, oem_id, oem_table_id);
|
|
+ (void *)(table_data->data + xsdt_start),
|
|
+ "XSDT", xsdt_len, 1, oem_id, oem_table_id);
|
|
}
|
|
|
|
void build_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base,
|
|
@@ -2053,10 +2057,9 @@ void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog,
|
|
uint64_t control_area_start_address;
|
|
TPMIf *tpmif = tpm_find();
|
|
uint32_t start_method;
|
|
- void *tpm2_ptr;
|
|
|
|
tpm2_start = table_data->len;
|
|
- tpm2_ptr = acpi_data_push(table_data, sizeof(AcpiTableHeader));
|
|
+ acpi_data_push(table_data, sizeof(AcpiTableHeader));
|
|
|
|
/* Platform Class */
|
|
build_append_int_noprefix(table_data, TPM2_ACPI_CLASS_CLIENT, 2);
|
|
@@ -2095,8 +2098,8 @@ void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog,
|
|
log_addr_offset, 8,
|
|
ACPI_BUILD_TPMLOG_FILE, 0);
|
|
build_header(linker, table_data,
|
|
- tpm2_ptr, "TPM2", table_data->len - tpm2_start, 4, oem_id,
|
|
- oem_table_id);
|
|
+ (void *)(table_data->data + tpm2_start),
|
|
+ "TPM2", table_data->len - tpm2_start, 4, oem_id, oem_table_id);
|
|
}
|
|
|
|
Aml *build_crs(PCIHostState *host, CrsRangeSet *range_set, uint32_t io_offset,
|
|
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
|
|
index de98750aeff6bdec266a85c38357..daaf8f473e99ca28f03360f4ff7a 100644
|
|
--- a/hw/i386/acpi-build.c
|
|
+++ b/hw/i386/acpi-build.c
|
|
@@ -1816,6 +1816,7 @@ build_hpet(GArray *table_data, BIOSLinker *linker, const char *oem_id,
|
|
const char *oem_table_id)
|
|
{
|
|
Acpi20Hpet *hpet;
|
|
+ int hpet_start = table_data->len;
|
|
|
|
hpet = acpi_data_push(table_data, sizeof(*hpet));
|
|
/* Note timer_block_id value must be kept in sync with value advertised by
|
|
@@ -1824,13 +1825,15 @@ build_hpet(GArray *table_data, BIOSLinker *linker, const char *oem_id,
|
|
hpet->timer_block_id = cpu_to_le32(0x8086a201);
|
|
hpet->addr.address = cpu_to_le64(HPET_BASE);
|
|
build_header(linker, table_data,
|
|
- (void *)hpet, "HPET", sizeof(*hpet), 1, oem_id, oem_table_id);
|
|
+ (void *)(table_data->data + hpet_start),
|
|
+ "HPET", sizeof(*hpet), 1, oem_id, oem_table_id);
|
|
}
|
|
|
|
static void
|
|
build_tpm_tcpa(GArray *table_data, BIOSLinker *linker, GArray *tcpalog,
|
|
const char *oem_id, const char *oem_table_id)
|
|
{
|
|
+ int tcpa_start = table_data->len;
|
|
Acpi20Tcpa *tcpa = acpi_data_push(table_data, sizeof *tcpa);
|
|
unsigned log_addr_size = sizeof(tcpa->log_area_start_address);
|
|
unsigned log_addr_offset =
|
|
@@ -1849,7 +1852,8 @@ build_tpm_tcpa(GArray *table_data, BIOSLinker *linker, GArray *tcpalog,
|
|
ACPI_BUILD_TPMLOG_FILE, 0);
|
|
|
|
build_header(linker, table_data,
|
|
- (void *)tcpa, "TCPA", sizeof(*tcpa), 2, oem_id, oem_table_id);
|
|
+ (void *)(table_data->data + tcpa_start),
|
|
+ "TCPA", sizeof(*tcpa), 2, oem_id, oem_table_id);
|
|
}
|
|
|
|
#define HOLE_640K_START (640 * KiB)
|