From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751294AbdEBIwP (ORCPT ); Tue, 2 May 2017 04:52:15 -0400 Received: from mail1.bemta8.messagelabs.com ([216.82.243.198]:47591 "EHLO mail1.bemta8.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750767AbdEBIwL (ORCPT ); Tue, 2 May 2017 04:52:11 -0400 X-Brightmail-Tracker: H4sIAAAAAAAAA1WSWUwTURSGe2em05Ew5FJQDrUYUhRcKEiiSX0 QlwdtYogmhiBKolMd20m6kE5RfBFcg7jhCm0qaCAuqIkBjVVRFLfUBSKKQUSiAWOtbAEVTRTt dFDx7T/5/vPfc24OQ6of0hqGL3TxTjtn1dERlHlKMFV/1cjkzu6uyDDUPGtTGUpeVhOG59e9t OHg1YDK8Ku8Hhka95SghbSxp+4ZMjYc8tPG6oaPhHHgVhttLK/8ThiH66asoFcrBbvJUbhOaW ls8aL8d7iwqbOMLEbHo0rRBEaNPyBwe1eWooiQvo9gZ2BEKRUU3kfCWd81lUzcBHTUlyG58Id aRgK01E/jafDqfFAp6Vj8DsHgxSTJROIqBOUDPrIUMUwMzoPjtTbZw8Ggu52UdRq0udtVkqbw VLjx+WY4h8ULofXW67BGeBKMPLpASJrEcdDRUxXWgDHUNLSQsp4IH7tHw2MjXIog8LhZKYNE8 PZeHmtIgNaqveENAB8gYeBp5VjRTMHPrgNjUVmwva+ZlsEhBE8P1lIycMDt/oqxqHlQ0tpOya avBPjLi2kZaKGl7Fv47RisgTcv9iBZayHQKS9HhpZuP3aUlvUsOH3qE1mGUjzj9vOMs3nG2Tz hv4kGv7uHOomoWjRd5J2beKd+ztw0k1MwW1w2TrDqM2Yb0my8KHJm3sqZxLT1DlsdCh1VkUKB fGj03pomFM8QuolsSlCVq44yOTZssXCiZa2zwMqLTUjLMDpgk5YyuepoJ2/mCzcK1tBl/sHAR Opi2SUSZsV8ziYKZhk9Qnpm8Ny3AUJN2R12XhPH+iQTlkyWAvvfiD/33YoSNDEsUigU6sh83m kTXP/zIIpjkC6G3S2lRAp219+XgqEhiNAQOxLCQ7i4f0hTjJRP+Gzt4kZP0QchB2Pf8MzsgtT 8DLtXvzwn80Lyj2vJwt5V1t4H8yfHJtQn1mSaNnz1XXp/5cvy9G2j/J15ydXpUbvOTxtkH6v9 b1vuHjujPbFIlRJddMU12ne0e6gXz89bdjg+0jLjSFflkKKvYs7mvAWpW/dPGOr/svlIZlSWM lNHiRYuYybpFLnfQp+WC9oDAAA= X-Env-Sender: hehy1@lenovo.com X-Msg-Ref: server-4.tower-218.messagelabs.com!1493715116!14308708!1 X-Originating-IP: [103.30.234.44] X-StarScan-Received: X-StarScan-Version: 9.4.12; banners=-,-,- X-VirusChecked: Checked From: Ocean HY1 He To: "matt.fleming@intel.com" , "a.zummo@towertech.it" , "alexandre.belloni@free-electrons.com" , "msalter@redhat.com" CC: "rtc-linux@googlegroups.com" , "linux-kernel@vger.kernel.org" , Ocean HY1 He Subject: [PATCH] rtc: rtc-efi: Add an enable parameter and make it false for X86 by default Thread-Topic: [PATCH] rtc: rtc-efi: Add an enable parameter and make it false for X86 by default Thread-Index: AQHSwyFUwjdpT9JVe0eqtA+Tta6/qw== Date: Tue, 2 May 2017 08:51:47 +0000 Message-ID: <1493715444-79142-1-git-send-email-hehy1@lenovo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [103.244.59.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;SG2PR0301MB1240;7:f3LgeXtPPl/70C/U7VwQe+N8E7/GcfP6tCQaYXo47L4wMmK+9dsK0KedCcofMsLpe5g6QnyPrbTwuHO/gukbEzaZHKaFaHWO4CjE9bPyRb8I2q9cY8+ivfyjDDZPFEVn3667pbslEY0MZV5kRsPhnq2uC8g5nFS53zuMD+nEhp7MjDfHHUtsSpx6V09VyteM/xVb1J3KwaOhvEg4mrofknWpidcbfzMz84qQ2xxJJN/4xSlAtcpXR5Tx3g6nRCwAnij4Q1gmPPhlN/KzUY8jnSrnONjHOLj9K62vWMIEft3J9hW48KKO/zag1CCXFu7qaboaMdk2m6qp2IbMJA8ijQ== x-forefront-antispam-report: SFV:SKI;SCL:-1SFV:NSPM;SFS:(10019020)(6009001)(39840400002)(39410400002)(39450400003)(39400400002)(2906002)(50986999)(189998001)(3280700002)(3660700001)(4326008)(25786009)(54356999)(122556002)(33646002)(66066001)(8676002)(8936002)(81166006)(7736002)(478600001)(305945005)(5660300001)(86362001)(575784001)(2201001)(38730400002)(99286003)(6116002)(3846002)(102836003)(107886003)(6486002)(77096006)(6506006)(6512007)(6436002)(53936002)(36756003);DIR:OUT;SFP:1102;SCL:1;SRVR:SG2PR0301MB1240;H:SG2PR0301MB1240.apcprd03.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; x-ms-office365-filtering-correlation-id: 2252fec7-47e5-4322-2acd-08d49138777b x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(201703131423075)(201703031133081)(201702281549075);SRVR:SG2PR0301MB1240; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(3940261145250); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(6041248)(20161123562025)(20161123560025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123564025)(6072148);SRVR:SG2PR0301MB1240;BCL:0;PCL:0;RULEID:;SRVR:SG2PR0301MB1240; x-forefront-prvs: 02951C14DC spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 May 2017 08:51:47.2807 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5c7d0b28-bdf8-410c-aa93-4df372b16203 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR0301MB1240 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v428qMdk015979 The commit 7efe665903d0 ("rtc: Disable EFI rtc for x86") turns off rtc-efi option completely for x86 in rtc/Kconfig, to avoid possible crash caused by buggy implementations of the time-related EFI runtime services. In fact, there are more and more UEFI firmware has time-related EFI runtime services well done. To meet EFI rtc request for X86, here adds an enable parameter which could be explicitly set as true when load rtc-efi module. To keep consistency, make this enable parameter false for X86 by default. The test passes on Lenovo ThinkServer RD350 while the UEFI/BIOS version is VB3TS424 and processor is Intel(R) Xeon(R) CPU E5-2660 v3. #modprobe rtc_efi enable=1 #cat /sys/class/rtc/rtc1/name rtc-efi #hwclock --rtc=/dev/rtc1 -w #hwclock --rtc=/dev/rtc1 -r Signed-off-by: Ocean He --- drivers/rtc/Kconfig | 2 +- drivers/rtc/rtc-efi.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index ee1b0e9..482200a 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -1037,7 +1037,7 @@ config RTC_DRV_DA9063 config RTC_DRV_EFI tristate "EFI RTC" - depends on EFI && !X86 + depends on EFI help If you say yes here you will get support for the EFI Real Time Clock. diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c index 0130afd..5a8427f 100644 --- a/drivers/rtc/rtc-efi.c +++ b/drivers/rtc/rtc-efi.c @@ -23,6 +23,14 @@ #include #include +/* + * Disable the use of rtc-efi as a RTC for X86 by default. This setting can be + * overridden using this module's enable parameter. + */ +static bool efi_rtc_enable = !IS_ENABLED(CONFIG_X86); + +module_param_named(enable, efi_rtc_enable, bool, 0644); + #define EFI_ISDST (EFI_TIME_ADJUST_DAYLIGHT|EFI_TIME_IN_DAYLIGHT) /* @@ -262,6 +270,9 @@ static int __init efi_rtc_probe(struct platform_device *dev) efi_time_t eft; efi_time_cap_t cap; + if (!efi_rtc_enable) + return -ENODEV; + /* First check if the RTC is usable */ if (efi.get_time(&eft, &cap) != EFI_SUCCESS) return -ENODEV; -- 1.8.3.1