From nobody Wed Nov 5 00:31:17 2025 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 1500904291603455.22306785892044; Mon, 24 Jul 2017 06:51:31 -0700 (PDT) Received: from localhost ([::1]:55000 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZdlg-0000EA-4f for importer@patchew.org; Mon, 24 Jul 2017 09:51:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZdkj-0008E3-FJ for qemu-devel@nongnu.org; Mon, 24 Jul 2017 09:50:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZdkg-0004om-S0 for qemu-devel@nongnu.org; Mon, 24 Jul 2017 09:50:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51168) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dZdkg-0004o2-IN for qemu-devel@nongnu.org; Mon, 24 Jul 2017 09:50:26 -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 558B181243; Mon, 24 Jul 2017 13:50:25 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24CA187CA5; Mon, 24 Jul 2017 13:50:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 558B181243 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 558B181243 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 24 Jul 2017 15:50:20 +0200 Message-Id: <1500904220-29338-1-git-send-email-imammedo@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.25]); Mon, 24 Jul 2017 13:50:25 +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] [PATCH v2] pc: acpi: force FADT rev1 for 440fx based machine types 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: Programmingkid , "Michael S. Tsirkin" , Phil Dennis-Jordan 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" w2k used to boot on QEMU until revision of FADT has been bumped to rev3 (commit 77af8a2b hw/i386: Use Rev3 FADT (ACPI 2.0) instead of Rev1 to impro= ve guest OS support.) Keep PC machine at rev1 to remain compatible and Q35 at rev3 where w2k isn't supported anyway so OSX could run as well. Signed-off-by: Igor Mammedov Tested-By: John Arbuckle --- v2: - make pc rev1 and q35 rev3. "Michael S. Tsirkin" PS: Only compile tested. CC: Programmingkid CC: Phil Dennis-Jordan CC: "Michael S. Tsirkin" --- hw/i386/acpi-build.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 6b7bade..b9c245c 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -90,6 +90,7 @@ typedef struct AcpiMcfgInfo { } AcpiMcfgInfo; =20 typedef struct AcpiPmInfo { + bool force_rev1_fadt; bool s3_disabled; bool s4_disabled; bool pcihp_bridge_en; @@ -129,10 +130,13 @@ static void acpi_get_pm_info(AcpiPmInfo *pm) Object *obj =3D NULL; QObject *o; =20 + pm->force_rev1_fadt =3D false; pm->cpu_hp_io_base =3D 0; pm->pcihp_io_base =3D 0; pm->pcihp_io_len =3D 0; if (piix) { + /* w2k requires FADT(rev1) or it won't boot, keep PC compatible */ + pm->force_rev1_fadt =3D true; obj =3D piix; pm->cpu_hp_io_base =3D PIIX4_CPU_HOTPLUG_IO_BASE; pm->pcihp_io_base =3D @@ -304,6 +308,9 @@ static void fadt_setup(AcpiFadtDescriptorRev3 *fadt, Ac= piPmInfo *pm) fadt->flags |=3D cpu_to_le32(1 << ACPI_FADT_F_FORCE_APIC_CLUSTER_M= ODEL); } fadt->century =3D RTC_CENTURY; + if (pm->force_rev1_fadt) { + return; + } =20 fadt->flags |=3D cpu_to_le32(1 << ACPI_FADT_F_RESET_REG_SUP); fadt->reset_value =3D 0xf; @@ -342,6 +349,8 @@ build_fadt(GArray *table_data, BIOSLinker *linker, Acpi= PmInfo *pm, unsigned fw_ctrl_offset =3D (char *)&fadt->firmware_ctrl - table_data-= >data; unsigned dsdt_entry_offset =3D (char *)&fadt->dsdt - table_data->data; unsigned xdsdt_entry_offset =3D (char *)&fadt->x_dsdt - table_data->da= ta; + int fadt_size =3D sizeof(*fadt); + int rev =3D 3; =20 /* FACS address to be filled by Guest linker */ bios_linker_loader_add_pointer(linker, @@ -353,12 +362,17 @@ build_fadt(GArray *table_data, BIOSLinker *linker, Ac= piPmInfo *pm, bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, dsdt_entry_offset, sizeof(fadt->dsdt), ACPI_BUILD_TABLE_FILE, dsdt_tbl_offset); - bios_linker_loader_add_pointer(linker, - ACPI_BUILD_TABLE_FILE, xdsdt_entry_offset, sizeof(fadt->x_dsdt), - ACPI_BUILD_TABLE_FILE, dsdt_tbl_offset); + if (pm->force_rev1_fadt) { + rev =3D 1; + fadt_size =3D offsetof(typeof(*fadt), reset_register); + } else { + bios_linker_loader_add_pointer(linker, + ACPI_BUILD_TABLE_FILE, xdsdt_entry_offset, sizeof(fadt->x_dsdt= ), + ACPI_BUILD_TABLE_FILE, dsdt_tbl_offset); + } =20 build_header(linker, table_data, - (void *)fadt, "FACP", sizeof(*fadt), 3, oem_id, oem_table= _id); + (void *)fadt, "FACP", fadt_size, rev, oem_id, oem_table_i= d); } =20 void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, --=20 2.7.4