From patchwork Thu Dec 10 17:25:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 555223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0B23A140281 for ; Fri, 11 Dec 2015 04:26:28 +1100 (AEDT) Received: from localhost ([::1]:43358 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a74z3-0003zS-NO for incoming@patchwork.ozlabs.org; Thu, 10 Dec 2015 12:26:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a74yR-00036S-Jp for qemu-devel@nongnu.org; Thu, 10 Dec 2015 12:25:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a74yM-00017I-NB for qemu-devel@nongnu.org; Thu, 10 Dec 2015 12:25:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49923) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a74yM-000177-Dz for qemu-devel@nongnu.org; Thu, 10 Dec 2015 12:25:42 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 18278A10A4; Thu, 10 Dec 2015 17:25:42 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-33.phx2.redhat.com [10.3.113.33]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBAHPdxm009623; Thu, 10 Dec 2015 12:25:40 -0500 From: Laszlo Ersek To: qemu-devel@nongnu.org Date: Thu, 10 Dec 2015 18:25:34 +0100 Message-Id: <1449768334-12782-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Ruiyu Ni , Eduardo Habkost , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Richard Henderson Subject: [Qemu-devel] [PATCH] hw/i386: fill in the CENTURY field of the FADT (FACP) ACPI table X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The ACPI specification (minimally versions 1.0b through 6.0) define the FADT.CENTURY field as: The RTC CMOS RAM index to the century of data value (hundred and thousand year decimals). If this field contains a zero, then the RTC centenary feature is not supported. If this field has a non-zero value, then this field contains an index into RTC RAM space that OSPM can use to program the centenary field. The x86 targets generate ACPI payload, emulate an RTC (CONFIG_MC146818RTC), and that RTC supports the "centenary feature" (see occurrences of RTC_CENTURY in cmos_ioport_write() and cmos_ioport_read() in "hw/timer/mc146818rtc.c".) However, FADT.CENTURY is left at zero currently: [06Ch 0108 1] RTC Century Index : 00 which -- according to analysis done by Ruiyu Ni at Intel -- should cause Linux and Windows 8+ to think the RTC centenary feature is unavailable, and cause Windows 7 to (incorrectly) assume that the offset to use is constant 0x32. (0x32 happens to be the right value on QEMU, but Windows 7 is wrong to assume anything at all). Exposing the right nonzero offset in FADT.CENTURY informs Linux and Windows 8+ about the right capabilities of the hardware, plus it retrofits our FADT to Windows 7's behavior. Regression tested with the following guests (all UEFI installs): - i386 Q35: Fedora 21 ("Fedlet" edition) - x86_64: - i440fx: - Fedora 21 - RHEL 6 and 7 - Windows 7 and 10 - Windows Server 2008 R2 and 2012 R2 - Q35: - Fedora 22 - Windows 8.1 Cc: "Michael S. Tsirkin" (supporter:ACPI/SMBIOS) Cc: Igor Mammedov (supporter:ACPI/SMBIOS) Cc: Paolo Bonzini (maintainer:X86) Cc: Richard Henderson (maintainer:X86) Cc: Eduardo Habkost (maintainer:X86) Cc: Ruiyu Ni Signed-off-by: Laszlo Ersek Reviewed-by: Igor Mammedov Reviewed-by: Paolo Bonzini --- hw/i386/acpi-build.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 95e0c65..c5e6c4b 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -42,6 +42,7 @@ #include "sysemu/tpm.h" #include "hw/acpi/tpm.h" #include "sysemu/tpm_backend.h" +#include "hw/timer/mc146818rtc_regs.h" /* Supported chipsets: */ #include "hw/acpi/piix4.h" @@ -334,6 +335,7 @@ static void fadt_setup(AcpiFadtDescriptorRev1 *fadt, AcpiPmInfo *pm) if (max_cpus > 8) { fadt->flags |= cpu_to_le32(1 << ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL); } + fadt->century = RTC_CENTURY; }