From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WziG1-0002gz-1v for qemu-devel@nongnu.org; Wed, 25 Jun 2014 04:08:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WziFt-0002TF-I3 for qemu-devel@nongnu.org; Wed, 25 Jun 2014 04:08:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36173) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WziFt-0002T1-Aj for qemu-devel@nongnu.org; Wed, 25 Jun 2014 04:08:33 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5P88WDb030186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 25 Jun 2014 04:08:32 -0400 Date: Wed, 25 Jun 2014 11:08:58 +0300 From: "Michael S. Tsirkin" Message-ID: <20140625080857.GA32652@redhat.com> References: <20140624215511.GA6229@amt.cnet> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20140624215511.GA6229@amt.cnet> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3] mc146818rtc: add rtc-reset-reinjection QMP command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcelo Tosatti Cc: Paolo Bonzini , qemu-devel On Tue, Jun 24, 2014 at 06:55:11PM -0300, Marcelo Tosatti wrote: >=20 > It is necessary to reset RTC interrupt reinjection backlog if > guest time is synchronized via a different mechanism, such as > QGA's guest-set-time command. >=20 > Failing to do so causes both corrections to be applied (summed), > resulting in an incorrect guest time. >=20 > Signed-off-by: Marcelo Tosatti Doesn't seem to apply :( error: patch failed: hw/timer/mc146818rtc.c:26 error: hw/timer/mc146818rtc.c: patch does not apply error: patch failed: monitor.c:5475 error: monitor.c: patch does not apply error: patch failed: qapi-schema.json:3080 error: qapi-schema.json: patch does not apply error: patch failed: qmp-commands.hx:3574 error: qmp-commands.hx: patch does not apply > diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c > index 1201f90..5bd8710 100644 > --- a/hw/timer/mc146818rtc.c > +++ b/hw/timer/mc146818rtc.c > @@ -26,6 +26,7 @@ > #include "sysemu/sysemu.h" > #include "hw/timer/mc146818rtc.h" > #include "qapi/visitor.h" > +#include "qmp-commands.h" > =20 > #ifdef TARGET_I386 > #include "hw/i386/apic.h" > @@ -84,6 +85,7 @@ typedef struct RTCState { > Notifier clock_reset_notifier; > LostTickPolicy lost_tick_policy; > Notifier suspend_notifier; > + QLIST_ENTRY(RTCState) link; > } RTCState; > =20 > static void rtc_set_time(RTCState *s); > @@ -522,6 +524,20 @@ static void rtc_get_time(RTCState *s, struct tm *t= m) > rtc_from_bcd(s, s->cmos_data[RTC_CENTURY]) * 100 - 1900; > } > =20 > +static QLIST_HEAD(, RTCState) rtc_devices =3D > + QLIST_HEAD_INITIALIZER(rtc_devices); > + > +#ifdef TARGET_I386 > +void qmp_rtc_reset_reinjection(Error **errp) > +{ > + RTCState *s; > + > + QLIST_FOREACH(s, &rtc_devices, link) { > + s->irq_coalesced =3D 0; > + } > +} > +#endif > + > static void rtc_set_time(RTCState *s) > { > struct tm tm; > @@ -910,6 +926,8 @@ ISADevice *rtc_init(ISABus *bus, int base_year, qem= u_irq intercept_irq) > } else { > isa_init_irq(isadev, &s->irq, RTC_ISA_IRQ); > } > + QLIST_INSERT_HEAD(&rtc_devices, s, link); > + > return isadev; > } > =20 > diff --git a/monitor.c b/monitor.c > index 2901187..51c9a1d 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -5475,3 +5475,12 @@ QemuOptsList qemu_mon_opts =3D { > { /* end of list */ } > }, > }; > + > +#ifndef TARGET_I386 > +void qmp_rtc_reset_reinjection(Error **errp) > +{ > + error_set(errp, QERR_COMMAND_NOT_FOUND, "rtc-reset-reinjection"); Is there a way to get here on non 386? If no let's do assert. If yes, looks more like QERR_FEATURE_DISABLED to me. > + return; return not necessary. > +} > +#endif > + Adds whitespace at EOF. > diff --git a/qapi-schema.json b/qapi-schema.json > index dc2abe4..7e04d28 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -3080,3 +3080,15 @@ > 'btn' : 'InputBtnEvent', > 'rel' : 'InputMoveEvent', > 'abs' : 'InputMoveEvent' } } > + > +## > +# @rtc-reset-reinjection > +# > +# This command will reset the RTC interrupt reinjection backlog. > +# Can be used if another mechanism to synchronize guest time > +# is in effect, for example QEMU guest agent's guest-set-time > +# command. > +# > +# Since: 2.1 > +## > +{ 'command': 'rtc-reset-reinjection' } > diff --git a/qmp-commands.hx b/qmp-commands.hx > index d6bb0f4..87ce94a 100644 > --- a/qmp-commands.hx > +++ b/qmp-commands.hx > @@ -3574,3 +3574,26 @@ Example: > } }=A0] } > =20 > EQMP > + > +#if defined TARGET_I386 > + { > + .name =3D "rtc-reset-reinjection", > + .args_type =3D "", > + .mhandler.cmd_new =3D qmp_marshal_input_rtc_reset_reinjection, > + }, > +#endif > + > +SQMP > +rtc-reset-reinjection > +--------------------- > + > +Reset the RTC interrupt reinjection backlog. > + > +Arguments: None. > + > +Example: > + > +-> { "execute": "rtc-reset-reinjection" } > +<- { "return": {} } > + > +EQMP