From: Rahul Tanwar <rahul.tanwar@linux.intel.com>
To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
hpa@zytor.com, tony.luck@intel.com, x86@kernel.org
Cc: andriy.shevchenko@intel.com, alan@linux.intel.com,
linux-kernel@vger.kernel.org, qi-ming.wu@intel.com,
chuanhua.lei@linux.intel.com, cheol.yong.kim@intel.com,
rahul.tanwar@intel.com,
Rahul Tanwar <rahul.tanwar@linux.intel.com>
Subject: [PATCH v3 1/1] x86/init: Noop get/set wallclock when platform doesn't support RTC
Date: Tue, 3 Sep 2019 14:17:37 +0800 [thread overview]
Message-ID: <21f458d27acf9e39af8f20b7fe5f7ef17edf5e0a.1567484279.git.rahul.tanwar@linux.intel.com> (raw)
In-Reply-To: <cover.1567484279.git.rahul.tanwar@linux.intel.com>
In-Reply-To: <cover.1567484279.git.rahul.tanwar@linux.intel.com>
Use wallclock_init() op to detect platforms which does not support RTC and
noop get/set wallclock ops for such platforms.
Reported-by: kbuild test robot <lkp@intel.com>
Fixes: 1461badd03e7 ("x86/init: Noop get/set wallclock when platform doesn't support RTC")
Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Rahul Tanwar <rahul.tanwar@linux.intel.com>
---
arch/x86/kernel/x86_init.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index 1bef687faf22..50aa8257fd20 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -31,6 +31,30 @@ static int __init iommu_init_noop(void) { return 0; }
static void iommu_shutdown_noop(void) { }
bool __init bool_x86_init_noop(void) { return false; }
void x86_op_int_noop(int cpu) { }
+static int set_rtc_noop(const struct timespec64 *now) { return -EINVAL; }
+static void get_rtc_noop(struct timespec64 *now) { }
+
+static const struct of_device_id of_cmos_match[] = {
+ { .compatible = "motorola,mc146818" },
+ {}
+};
+
+static void x86_wallclock_init(void)
+{
+ struct device_node *node;
+
+ node = of_find_matching_node(NULL, of_cmos_match);
+ if (node && !of_device_is_available(node)) {
+ /*
+ * Some products do not support RTC as persistent clock source. This can be
+ * optionally indicated by having status property as disabled in the
+ * corresponding DT node. Override get/set wallclock routines to noops for
+ * such products.
+ */
+ x86_platform.get_wallclock = get_rtc_noop;
+ x86_platform.set_wallclock = set_rtc_noop;
+ }
+}
/*
* The platform setup functions are preset with the default functions
@@ -73,7 +97,7 @@ struct x86_init_ops x86_init __initdata = {
.timers = {
.setup_percpu_clockev = setup_boot_APIC_clock,
.timer_init = hpet_time_init,
- .wallclock_init = x86_init_noop,
+ .wallclock_init = x86_wallclock_init,
},
.iommu = {
--
2.11.0
next prev parent reply other threads:[~2019-09-03 6:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-03 6:17 [PATCH v3 0/1] Add option to skip using RTC Rahul Tanwar
2019-09-03 6:17 ` Rahul Tanwar [this message]
2019-10-10 9:28 [PATCH v3 0/1] x86/init: " Rahul Tanwar
2019-10-10 9:28 ` [PATCH v3 1/1] x86/init: Noop get/set wallclock when platform doesn't support RTC Rahul Tanwar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=21f458d27acf9e39af8f20b7fe5f7ef17edf5e0a.1567484279.git.rahul.tanwar@linux.intel.com \
--to=rahul.tanwar@linux.intel.com \
--cc=alan@linux.intel.com \
--cc=andriy.shevchenko@intel.com \
--cc=bp@alien8.de \
--cc=cheol.yong.kim@intel.com \
--cc=chuanhua.lei@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=qi-ming.wu@intel.com \
--cc=rahul.tanwar@intel.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).