Skip to content

Commit

Permalink
hw/i386: fill in the CENTURY field of the FADT (FACP) ACPI table
Browse files Browse the repository at this point in the history
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" <[email protected]> (supporter:ACPI/SMBIOS)
Cc: Igor Mammedov <[email protected]> (supporter:ACPI/SMBIOS)
Cc: Paolo Bonzini <[email protected]> (maintainer:X86)
Cc: Richard Henderson <[email protected]> (maintainer:X86)
Cc: Eduardo Habkost <[email protected]> (maintainer:X86)
Cc: Ruiyu Ni <[email protected]>
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
  • Loading branch information
lersek authored and mstsirkin committed Jan 8, 2016
1 parent 349a3b1 commit f070efa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hw/i386/acpi-build.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,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"
Expand Down Expand Up @@ -335,6 +336,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;
}


Expand Down

0 comments on commit f070efa

Please sign in to comment.