[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3 7/7] x86/time: probe the CMOS RTC by default



Probing for the CMOS RTC registers consist in reading IO ports, and we expect
those reads to have no side effects even when the CMOS RTC is not present.  Xen
already does a similar probing (reading of IO ports) by default when searching
for possible CMOS aliased locations.

Switch the default to probe for the CMOS RTC by default when ACPI FADT contains
the ACPI_FADT_NO_CMOS_RTC flag.  At the same time introduce a new option that
can be used to turn off the probing: `wallclock=no-cmos-probe`.  Deprecate the
previous `cmos-rtc-probe` option.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Changes since v2:
 - New in this version.
---
 docs/misc/xen-command-line.pandoc | 12 ++++++++++--
 xen/arch/x86/time.c               |  9 ++++++---
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc 
b/docs/misc/xen-command-line.pandoc
index 23de922b9705..0d603b9521ae 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -326,11 +326,14 @@ Interrupts.  Specifying zero disables CMCI handling.
 ### cmos-rtc-probe (x86)
 > `= <boolean>`
 
-> Default: `false`
+> Default: `true`
 
 Flag to indicate whether to probe for a CMOS Real Time Clock irrespective of
 ACPI indicating none to be there.
 
+**WARNING: The `cmos-rtc-probe` option is deprecated and superseded by
+_wallclock=no-cmos-probe_ using both options in combination is undefined.**
+
 ### com1 (x86)
 ### com2 (x86)
 > `= 
 > <baud>[/<base-baud>][,[DPS][,[<io-base>|pci|amt][,[<irq>|msi][,[<port-bdf>][,[<bridge-bdf>]]]]]]`
@@ -2822,7 +2825,7 @@ suboptimal scheduling decisions, but only when the system 
is
 oversubscribed (i.e., in total there are more vCPUs than pCPUs).
 
 ### wallclock (x86)
-> `= auto | xen | cmos | efi`
+> `= auto | xen | cmos | no-cmos-probe | efi`
 
 > Default: `auto`
 
@@ -2836,6 +2839,11 @@ Allow forcing the usage of a specific wallclock source.
 
  * `cmos` force usage of the CMOS RTC wallclock.
 
+ * `no-cmos-probe` do not probe for the CMOS RTC presence if the ACPI FADT
+   table signals there's no CMOS RTC.  Implies using the same heuristics as
+   the `auto` option.  By default Xen will probe for the CMOS RTC presence
+   even when ACPI FADT signals no CMOS RTC available.
+
  * `efi` force usage of the EFI_GFET_TIME run-time method when booted from EFI
    firmware.
 
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 6e19c666d13f..8e6ecbe5e964 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1292,7 +1292,7 @@ static bool __get_cmos_time(struct rtc_time *rtc)
     return t1 <= SECONDS(1) && t2 < MILLISECS(3);
 }
 
-static bool __initdata cmos_rtc_probe;
+static bool __initdata cmos_rtc_probe = true;
 boolean_param("cmos-rtc-probe", cmos_rtc_probe);
 
 static bool __init cmos_probe(void)
@@ -1560,6 +1560,8 @@ static int __init cf_check parse_wallclock(const char 
*arg)
     if ( !arg )
         return -EINVAL;
 
+    cmos_rtc_probe = true;
+
     if ( !strcmp("auto", arg) )
         wallclock_source = WALLCLOCK_UNSET;
     else if ( !strcmp("xen", arg) )
@@ -1571,6 +1573,8 @@ static int __init cf_check parse_wallclock(const char 
*arg)
     }
     else if ( !strcmp("cmos", arg) )
         wallclock_source = WALLCLOCK_CMOS;
+    else if ( !strcmp("no-cmos-probe", arg) )
+        cmos_rtc_probe = false;
     else if ( !strcmp("efi", arg) )
     {
         if ( !efi_enabled(EFI_RS) )
@@ -1609,8 +1613,7 @@ static void __init probe_wallclock(void)
           !cmos_rtc_probe && !efi_enabled(EFI_RS) ? " None" : "",
           cmos_rtc_probe ? " CMOS" : "",
           efi_enabled(EFI_RS) ? " EFI" : "",
-          !cmos_rtc_probe ? "Try with command line option \"cmos-rtc-probe\"\n"
-           : !efi_enabled(EFI_RS) ? "System must be booted from EFI\n" : "");
+          !efi_enabled(EFI_RS) ? "System must be booted from EFI\n" : "");
 }
 
 static unsigned long get_wallclock_time(void)
-- 
2.46.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.