rtc: Have event RTC_CHANGE identify the RTC by QOM path

Event RTC_CHANGE is "emitted when the guest changes the RTC time" (and
the RTC supports the event).  What if there's more than one RTC?
Which one changed?  New @qom-path identifies it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <87a6ejnm80.fsf@pond.sub.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
This commit is contained in:
Markus Armbruster 2022-02-22 13:02:07 +01:00
parent 03397528d9
commit 2beb1e5f9a
4 changed files with 10 additions and 4 deletions

View file

@ -97,6 +97,7 @@ static void rtas_set_time_of_day(PowerPCCPU *cpu, SpaprMachineState *spapr,
uint32_t nret, target_ulong rets)
{
SpaprRtcState *rtc = &spapr->rtc;
g_autofree const char *qom_path = NULL;
struct tm tm;
time_t new_s;
int64_t host_ns;
@ -120,7 +121,8 @@ static void rtas_set_time_of_day(PowerPCCPU *cpu, SpaprMachineState *spapr,
}
/* Generate a monitor event for the change */
qapi_event_send_rtc_change(qemu_timedate_diff(&tm));
qom_path = object_get_canonical_path(OBJECT(rtc));
qapi_event_send_rtc_change(qemu_timedate_diff(&tm), qom_path);
host_ns = qemu_clock_get_ns(rtc_clock);