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

@ -611,12 +611,13 @@ static void rtc_get_time(RTCState *s, struct tm *tm)
static void rtc_set_time(RTCState *s)
{
struct tm tm;
g_autofree const char *qom_path = object_get_canonical_path(OBJECT(s));
rtc_get_time(s, &tm);
s->base_rtc = mktimegm(&tm);
s->last_update = qemu_clock_get_ns(rtc_clock);
qapi_event_send_rtc_change(qemu_timedate_diff(&tm));
qapi_event_send_rtc_change(qemu_timedate_diff(&tm), qom_path);
}
static void rtc_set_cmos(RTCState *s, const struct tm *tm)