aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Mujawar <sami.mujawar@arm.com>2019-01-10 14:20:41 +0000
committerWill Deacon <will.deacon@arm.com>2019-01-22 06:55:22 +0000
commit473c5b295e427a3ac4d92266193096321eb9fe2a (patch)
tree425a25b9a0d24171cabc63449217eee67bb84ab3
parent5ae841d17ba297d75843035135cee35ee6b68f0a (diff)
downloadkvmtool-473c5b295e427a3ac4d92266193096321eb9fe2a.tar.gz
rtc: Initialize the Register D for MC146818 RTC
Some software drivers check the VRT bit (BIT7) of Register D before using the MC146818 RTC. Initialized the VRT bit in rtc__init() to indicate that the RAM and time contents are valid. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Julien Thierry <julien.thierry@arm.com> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r--hw/rtc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/rtc.c b/hw/rtc.c
index 0649b5df..c1fa72f2 100644
--- a/hw/rtc.c
+++ b/hw/rtc.c
@@ -25,6 +25,11 @@
#define RTC_REG_C 0x0C
#define RTC_REG_D 0x0D
+/*
+ * Register D Bits
+ */
+#define RTC_REG_D_VRT (1 << 7)
+
struct rtc_device {
u8 cmos_idx;
u8 cmos_data[128];
@@ -140,6 +145,9 @@ int rtc__init(struct kvm *kvm)
return r;
}
+ /* Set the VRT bit in Register D to indicate valid RAM and time */
+ rtc.cmos_data[RTC_REG_D] = RTC_REG_D_VRT;
+
return r;
}
dev_init(rtc__init);