From nobody Sun Apr 28 17:50:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15010615603951013.0343958041937; Wed, 26 Jul 2017 02:32:40 -0700 (PDT) Received: from localhost ([::1]:37001 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daIgH-0007gP-Kh for importer@patchew.org; Wed, 26 Jul 2017 05:32:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59695) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daIfV-0007Pm-5x for qemu-devel@nongnu.org; Wed, 26 Jul 2017 05:31:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1daIfS-00026Z-29 for qemu-devel@nongnu.org; Wed, 26 Jul 2017 05:31:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52948) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1daIfR-00026M-Pb for qemu-devel@nongnu.org; Wed, 26 Jul 2017 05:31:45 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BF4A783F43; Wed, 26 Jul 2017 09:31:44 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-59.ams2.redhat.com [10.36.117.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3B5D6FB61; Wed, 26 Jul 2017 09:31:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BF4A783F43 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=pbonzini@redhat.com From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 26 Jul 2017 11:31:36 +0200 Message-Id: <20170726093136.13627-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 26 Jul 2017 09:31:44 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [qemu PATCH for 2.10] i386: acpi: provide an XSDT instead of an RSDT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: phil@philjordan.eu, mst@redhat.com, seabios@seabios.org, programmingkidx@gmail.com, Kevin O'Connor , kraxel@redhat.com, lists@philjordan.eu, imammedo@redhat.com, lersek@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The tables that QEMU provides are not ACPI 1.0 compatible since commit 77af8a2b95 ("hw/i386: Use Rev3 FADT (ACPI 2.0) instead of Rev1 to improve guest OS support.", 2017-05-03). This is visible with Windows 2000, which refuses to parse the rev3 FADT and fails to boot. The recommended solution in this case is to build two FADTs, v1 being pointed to by the RSDT and v3 by the XSDT. However, we leave this task to the firmware. This patch simply switches the RSDT to the XSDT, which is valid for all ACPI 2.0-friendly operating systems and also leaves SeaBIOS the freedom to build an RSDT that points to the compatibility FADT. When running Windows 2000 with an old BIOS, Windows would simply fall back to a non-ACPI HAL; however, the plan should be to include a BIOS with the new feature in 2.10. Reported-by: Programmingkid Signed-off-by: Paolo Bonzini --- hw/acpi/aml-build.c | 27 --------------------------- hw/i386/acpi-build.c | 30 ++++++++++++++++++------------ include/hw/acpi/aml-build.h | 3 --- 3 files changed, 18 insertions(+), 42 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 36a6cc450e..ea750d54d9 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1573,33 +1573,6 @@ void acpi_build_tables_cleanup(AcpiBuildTables *tabl= es, bool mfre) g_array_free(tables->vmgenid, mfre); } =20 -/* Build rsdt table */ -void -build_rsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets, - const char *oem_id, const char *oem_table_id) -{ - int i; - unsigned rsdt_entries_offset; - AcpiRsdtDescriptorRev1 *rsdt; - const unsigned table_data_len =3D (sizeof(uint32_t) * table_offsets->l= en); - const unsigned rsdt_entry_size =3D sizeof(rsdt->table_offset_entry[0]); - const size_t rsdt_len =3D sizeof(*rsdt) + table_data_len; - - rsdt =3D acpi_data_push(table_data, rsdt_len); - rsdt_entries_offset =3D (char *)rsdt->table_offset_entry - table_data-= >data; - for (i =3D 0; i < table_offsets->len; ++i) { - uint32_t ref_tbl_offset =3D g_array_index(table_offsets, uint32_t,= i); - uint32_t rsdt_entry_offset =3D rsdt_entries_offset + rsdt_entry_si= ze * i; - - /* rsdt->table_offset_entry to be filled by Guest linker */ - bios_linker_loader_add_pointer(linker, - ACPI_BUILD_TABLE_FILE, rsdt_entry_offset, rsdt_entry_size, - ACPI_BUILD_TABLE_FILE, ref_tbl_offset); - } - build_header(linker, table_data, - (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, diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 6b7bade183..e76cad2ad7 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2557,27 +2557,33 @@ build_amd_iommu(GArray *table_data, BIOSLinker *lin= ker) } =20 static GArray * -build_rsdp(GArray *rsdp_table, BIOSLinker *linker, unsigned rsdt_tbl_offse= t) +build_rsdp(GArray *rsdp_table, BIOSLinker *linker, unsigned xsdt_tbl_offse= t) { AcpiRsdpDescriptor *rsdp =3D acpi_data_push(rsdp_table, sizeof *rsdp); - unsigned rsdt_pa_size =3D sizeof(rsdp->rsdt_physical_address); - unsigned rsdt_pa_offset =3D - (char *)&rsdp->rsdt_physical_address - rsdp_table->data; + unsigned xsdt_pa_size =3D sizeof(rsdp->xsdt_physical_address); + unsigned xsdt_pa_offset =3D + (char *)&rsdp->xsdt_physical_address - rsdp_table->data; =20 bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, rsdp_table, 16, true /* fseg memory */); =20 memcpy(&rsdp->signature, "RSD PTR ", 8); memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, 6); + rsdp->length =3D cpu_to_le32(sizeof(*rsdp)); + rsdp->revision =3D 0x02; + /* Address to be filled by Guest linker */ bios_linker_loader_add_pointer(linker, - ACPI_BUILD_RSDP_FILE, rsdt_pa_offset, rsdt_pa_size, - ACPI_BUILD_TABLE_FILE, rsdt_tbl_offset); + ACPI_BUILD_RSDP_FILE, xsdt_pa_offset, xsdt_pa_size, + ACPI_BUILD_TABLE_FILE, xsdt_tbl_offset); =20 /* Checksum to be filled by Guest linker */ bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, - (char *)rsdp - rsdp_table->data, sizeof *rsdp, + (char *)rsdp - rsdp_table->data, offsetof(AcpiRsdpDescriptor, leng= th), (char *)&rsdp->checksum - rsdp_table->data); + bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, + (char *)rsdp - rsdp_table->data, sizeof *rsdp, + (char *)&rsdp->extended_checksum - rsdp_table->data); =20 return rsdp_table; } @@ -2621,7 +2627,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState= *machine) PCMachineState *pcms =3D PC_MACHINE(machine); PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); GArray *table_offsets; - unsigned facs, dsdt, rsdt, fadt; + unsigned facs, dsdt, xsdt, fadt; AcpiPmInfo pm; AcpiMiscInfo misc; AcpiMcfgInfo mcfg; @@ -2729,13 +2735,13 @@ void acpi_build(AcpiBuildTables *tables, MachineSta= te *machine) g_array_append_vals(tables_blob, u, len); } =20 - /* RSDT is pointed to by RSDP */ - rsdt =3D tables_blob->len; - build_rsdt(tables_blob, tables->linker, table_offsets, + /* XSDT is pointed to by RSDP */ + xsdt =3D tables_blob->len; + build_xsdt(tables_blob, tables->linker, table_offsets, slic_oem.id, slic_oem.table_id); =20 /* RSDP is in FSEG memory, so allocate it separately */ - build_rsdp(tables->rsdp, tables->linker, rsdt); + build_rsdp(tables->rsdp, tables->linker, xsdt); =20 /* We'll expose it all to Guest so we want to reduce * chance of size changes. diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 88d0738d76..4bdd88ee23 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -379,9 +379,6 @@ void acpi_add_table(GArray *table_offsets, GArray *tabl= e_data); void acpi_build_tables_init(AcpiBuildTables *tables); void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre); void -build_rsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets, - const char *oem_id, const char *oem_table_id); -void build_xsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets, const char *oem_id, const char *oem_table_id); =20 --=20 2.13.3