[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 14/38] pseries: Export RTC time via QOM
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PULL 14/38] pseries: Export RTC time via QOM |
Date: |
Sun, 8 Mar 2015 09:44:33 +0100 |
From: David Gibson <address@hidden>
On x86, the guest's RTC can be read with QMP, either from the RTC device's
"date" property or via the "rtc-time" property on the machine (which is an
alias to the former). This is set up in the mc146818rtc driver, and
doesn't work on other targets.
This patch adds a similar "date" property to the pseries machine's RTAS RTC
and adds a compatible alias to the machine.
Signed-off-by: David Gibson <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
hw/ppc/spapr.c | 3 +++
hw/ppc/spapr_rtc.c | 7 +++++++
2 files changed, 10 insertions(+)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 6e8248d..b39073b 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1000,6 +1000,9 @@ static void spapr_rtc_create(sPAPREnvironment *spapr)
qdev_init_nofail(dev);
spapr->rtc = dev;
+
+ object_property_add_alias(qdev_get_machine(), "rtc-time",
+ OBJECT(spapr->rtc), "date", NULL);
}
/* Returns whether we want to use VGA or not */
diff --git a/hw/ppc/spapr_rtc.c b/hw/ppc/spapr_rtc.c
index 5ad0823..83eb7c1 100644
--- a/hw/ppc/spapr_rtc.c
+++ b/hw/ppc/spapr_rtc.c
@@ -152,6 +152,11 @@ static void rtas_set_time_of_day(PowerPCCPU *cpu,
sPAPREnvironment *spapr,
rtas_st(rets, 0, RTAS_OUT_SUCCESS);
}
+static void spapr_rtc_qom_date(Object *obj, struct tm *current_tm, Error
**errp)
+{
+ spapr_rtc_read(DEVICE(obj), current_tm, NULL);
+}
+
static void spapr_rtc_realize(DeviceState *dev, Error **errp)
{
sPAPRRTCState *rtc = SPAPR_RTC(dev);
@@ -165,6 +170,8 @@ static void spapr_rtc_realize(DeviceState *dev, Error
**errp)
host_s = mktimegm(&tm);
rtc_ns = qemu_clock_get_ns(rtc_clock);
rtc->ns_offset = host_s * NSEC_PER_SEC - rtc_ns;
+
+ object_property_add_tm(OBJECT(rtc), "date", spapr_rtc_qom_date, NULL);
}
static const VMStateDescription vmstate_spapr_rtc = {
--
1.8.1.4
- [Qemu-ppc] [PULL 2.3 00/38] ppc patch queue 2015-03-08, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 02/38] target-ppc: Use right page size with hash table lookup, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 09/38] pseries: Add more parameter validation in RTAS time of day functions, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 33/38] ppc64-softmmu: Remove duplicated OPENPIC from config, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 20/38] display cpu id dump state, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 14/38] pseries: Export RTC time via QOM,
Alexander Graf <=
- [Qemu-ppc] [PULL 24/38] target-ppc: move sdr1 value change detection logic to helper_store_sdr1(), Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 15/38] PPC: Clean up misuse of qdev_init() in kvm-openpic creation, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 06/38] Generalize QOM publishing of date and time from mc146818rtc.c, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 25/38] target-ppc: force update of msr bits in cpu_post_load, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 05/38] spapr-pci: Enable huge BARs, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 16/38] spapr: Clean up misuse of qdev_init() in xics-kvm creation, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 26/38] openpic: fix segfault on -M mac99 savevm, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 23/38] cuda.c: include adb_poll_timer in VMStateDescription, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 01/38] spapr_vio/spapr_iommu: Move VIO bypass where it belongs, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 38/38] sPAPR: Implement sPAPRPHBClass EEH callbacks, Alexander Graf, 2015/03/08