From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:44877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsMLp-0003aZ-J2 for qemu-devel@nongnu.org; Tue, 31 Jan 2012 17:38:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RsMLj-0001Hv-Vd for qemu-devel@nongnu.org; Tue, 31 Jan 2012 17:38:57 -0500 Received: from e37.co.us.ibm.com ([32.97.110.158]:53449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsMLj-0001FE-LM for qemu-devel@nongnu.org; Tue, 31 Jan 2012 17:38:51 -0500 Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 31 Jan 2012 15:38:44 -0700 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id C3BC81FF0049 for ; Tue, 31 Jan 2012 15:38:26 -0700 (MST) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q0VMc5Nx113364 for ; Tue, 31 Jan 2012 15:38:08 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q0VMc4gx001907 for ; Tue, 31 Jan 2012 15:38:04 -0700 Message-ID: <4F286D4A.1010006@us.ibm.com> Date: Tue, 31 Jan 2012 16:38:02 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1e517ab259c42885b0dbb49ea13db92f2df45815.1328031687.git.jan.kiszka@siemens.com> <4F2856EB.1030004@us.ibm.com> <4F2865AD.5060200@web.de> In-Reply-To: <4F2865AD.5060200@web.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 2/7] hpet: Save/restore cached RTC IRQ level List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Blue Swirl , Marcelo Tosatti , qemu-devel , kvm , Avi Kivity On 01/31/2012 04:05 PM, Jan Kiszka wrote: > On 2012-01-31 22:02, Anthony Liguori wrote: >> On 01/31/2012 11:41 AM, Jan Kiszka wrote: >>> In legacy mode, the HPET suppresses the RTC interrupt delivery via IRQ >>> 8 but keeps track of the RTC output level and applies it when legacy >>> mode is turned off again. This value has to be preserved across save/ >>> restore as it cannot be reconstructed otherwise. >>> >>> Signed-off-by: Jan Kiszka >>> --- >>> hw/hpet.c | 26 ++++++++++++++++++++++++++ >>> 1 files changed, 26 insertions(+), 0 deletions(-) >>> >>> diff --git a/hw/hpet.c b/hw/hpet.c >>> index aba9ea9..39b291f 100644 >>> --- a/hw/hpet.c >>> +++ b/hw/hpet.c >>> @@ -240,6 +240,24 @@ static int hpet_post_load(void *opaque, int >>> version_id) >>> return 0; >>> } >>> >>> +static bool hpet_rtc_irq_level_needed(void *opaque) >>> +{ >>> + HPETState *s = opaque; >>> + >>> + return s->rtc_irq_level != 0; >>> +} >>> + >>> +static const VMStateDescription vmstate_hpet_rtc_irq_level = { >>> + .name = "hpet/rtc_irq_level", >>> + .version_id = 1, >>> + .minimum_version_id = 1, >>> + .minimum_version_id_old = 1, >>> + .fields = (VMStateField[]) { >>> + VMSTATE_UINT8(rtc_irq_level, HPETState), >>> + VMSTATE_END_OF_LIST() >>> + } >>> +}; >>> + >> >> This won't work. We don't clear rtc_irq_level on reset so rtc_irq_level >> may be high or low after reset. As such, we can't use a subsection >> here. We need to bump the savevm state. > > rtc_irq_level is updated during reset by the connected RTC device. It > clears its IRQ line. Ah, that's subtle and warrants a comment :-) Probably worth adding an s->rtc_irq_level = 0 in reset just to be extra safe. Regards, Anthony Liguori > > Jan