From: Anthony Liguori <aliguori@us.ibm.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Blue Swirl <blauwirbel@gmail.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>, kvm <kvm@vger.kernel.org>,
Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 2/7] hpet: Save/restore cached RTC IRQ level
Date: Tue, 31 Jan 2012 15:02:35 -0600 [thread overview]
Message-ID: <4F2856EB.1030004@us.ibm.com> (raw)
In-Reply-To: <1e517ab259c42885b0dbb49ea13db92f2df45815.1328031687.git.jan.kiszka@siemens.com>
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<jan.kiszka@siemens.com>
> ---
> 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.
Regards,
Anthony Liguori
> static const VMStateDescription vmstate_hpet_timer = {
> .name = "hpet_timer",
> .version_id = 1,
> @@ -273,6 +291,14 @@ static const VMStateDescription vmstate_hpet = {
> VMSTATE_STRUCT_VARRAY_UINT8(timer, HPETState, num_timers, 0,
> vmstate_hpet_timer, HPETTimer),
> VMSTATE_END_OF_LIST()
> + },
> + .subsections = (VMStateSubsection[]) {
> + {
> + .vmsd =&vmstate_hpet_rtc_irq_level,
> + .needed = hpet_rtc_irq_level_needed,
> + }, {
> + /* empty */
> + }
> }
> };
>
next prev parent reply other threads:[~2012-01-31 21:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-31 17:41 [Qemu-devel] [PATCH v3 0/7] pit, hpet, pcspk: fixes & preparation for KVM Jan Kiszka
2012-01-31 17:41 ` [Qemu-devel] [PATCH v3 1/7] i8254: Do not raise IRQ level on reset Jan Kiszka
2012-01-31 17:41 ` [Qemu-devel] [PATCH v3 2/7] hpet: Save/restore cached RTC IRQ level Jan Kiszka
2012-01-31 21:02 ` Anthony Liguori [this message]
2012-01-31 22:05 ` Jan Kiszka
2012-01-31 22:38 ` Anthony Liguori
2012-01-31 22:39 ` Jan Kiszka
2012-01-31 17:41 ` [Qemu-devel] [PATCH v3 3/7] i8254: Factor out interface header Jan Kiszka
2012-01-31 17:41 ` [Qemu-devel] [PATCH v3 4/7] i8254: Pass alternative IRQ output object on initialization Jan Kiszka
2012-01-31 17:41 ` [Qemu-devel] [PATCH v3 5/7] i8254: Rework & fix interaction with HPET in legacy mode Jan Kiszka
2012-01-31 17:41 ` [Qemu-devel] [PATCH v3 6/7] pcspk: Convert to qdev Jan Kiszka
2012-01-31 20:49 ` Anthony Liguori
2012-01-31 22:00 ` Jan Kiszka
2012-01-31 22:40 ` Anthony Liguori
2012-01-31 22:48 ` Jan Kiszka
2012-01-31 23:23 ` Anthony Liguori
2012-02-01 7:29 ` Paolo Bonzini
2012-02-01 9:18 ` Jan Kiszka
2012-01-31 17:41 ` [Qemu-devel] [PATCH v3 7/7] i8254: Factor out pit_get_channel_info Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F2856EB.1030004@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).