aboutsummaryrefslogtreecommitdiff
path: root/hw/acpi
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2017-04-10 16:03:50 +0100
committerMichael S. Tsirkin <mst@redhat.com>2017-05-10 22:04:23 +0300
commitcb51ac2ffe3649eb8f5c65dccc2012f0ba2c6b12 (patch)
treeef8a06d6fc7f4c9fc4f1c3c606c3fcff4e7b18ad /hw/acpi
parent5ee8534731645551a3883210b9a8d5741bb79df2 (diff)
hw/arm/virt: generate 64-bit addressable ACPI objects
Our current ACPI table generation code limits the placement of ACPI tables to 32-bit addressable memory, in order to be able to emit the root pointer (RSDP) and root table (RSDT) using table types from the ACPI 1.0 days. Since ARM was not supported by ACPI before version 5.0, it makes sense to lift this restriction. This is not crucial for mach-virt, which is guaranteed to have some memory available below the 4 GB mark, but it is a nice to have for QEMU machines that do not have any 32-bit addressable memory, which is not uncommon for real world 64-bit ARM systems. Since we already emit a version of the RSDP root pointer that has a secondary 64-bit wide address field for the 64-bit root table (XSDT), all we need to do is replace the RSDT generation with the generation of an XSDT table, and use a different slot in the FADT table to refer to the DSDT. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Andrew Jones <drjones@redhat.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/acpi')
-rw-r--r--hw/acpi/aml-build.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index c6f2032dec..4ddfb68b24 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1599,6 +1599,33 @@ build_rsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets,
(void *)rsdt, "RSDT", rsdt_len, 1, oem_id, oem_table_id);
}
+/* Build xsdt table */
+void
+build_xsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets,
+ const char *oem_id, const char *oem_table_id)
+{
+ int i;
+ unsigned xsdt_entries_offset;
+ AcpiXsdtDescriptorRev2 *xsdt;
+ 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;
+
+ xsdt = acpi_data_push(table_data, xsdt_len);
+ xsdt_entries_offset = (char *)xsdt->table_offset_entry - table_data->data;
+ for (i = 0; i < table_offsets->len; ++i) {
+ uint64_t ref_tbl_offset = g_array_index(table_offsets, uint32_t, i);
+ uint64_t xsdt_entry_offset = xsdt_entries_offset + xsdt_entry_size * i;
+
+ /* xsdt->table_offset_entry to be filled by Guest linker */
+ bios_linker_loader_add_pointer(linker,
+ ACPI_BUILD_TABLE_FILE, xsdt_entry_offset, xsdt_entry_size,
+ ACPI_BUILD_TABLE_FILE, ref_tbl_offset);
+ }
+ build_header(linker, table_data,
+ (void *)xsdt, "XSDT", xsdt_len, 1, oem_id, oem_table_id);
+}
+
void build_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base,
uint64_t len, int node, MemoryAffinityFlags flags)
{