qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: hangaohuai <hangaohuai@huawei.com>, qemu-devel@nongnu.org
Cc: mst@redhat.com, arei.gonglei@huawei.com
Subject: Re: [Qemu-devel] [PATCH] bugfix: vm halt when in reset looping
Date: Wed, 14 Dec 2016 13:19:34 +0100	[thread overview]
Message-ID: <4bfd3066-6c2b-c21f-b6ea-9cc156fa4389@redhat.com> (raw)
In-Reply-To: <20161214064820.12480-1-hangaohuai@huawei.com>



On 14/12/2016 07:48, hangaohuai wrote:
> reset mc146818rtc device when RESET event happens.
> 
> Fix the problem:
>   1. Guest boot the second cpu, set CMOS_RESET_CODE 0x0a to protect selfboot;
>   2. VM being reset by others, hmp_system_reset;
>   3. seabios resume check the CMOS_RESET_CODE, if 0x0a, jump to the BDA
>      resume execution by jump via 40h:0067h;
>   4. Guest halt;
> 
> Signed-off-by: hangaohuai <hangaohuai@huawei.com>

I think this would break S3 resume.

Paolo

> ---
>  hw/timer/mc146818rtc.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
> index da209d0..67d707d 100644
> --- a/hw/timer/mc146818rtc.c
> +++ b/hw/timer/mc146818rtc.c
> @@ -946,11 +946,19 @@ static Property mc146818rtc_properties[] = {
>      DEFINE_PROP_END_OF_LIST(),
>  };
>  
> +static void rtc_resetdev(DeviceState *d)
> +{
> +    RTCState *s = MC146818_RTC(d);
> +
> +    s->cmos_data[0x0f] = 0x00;
> +}
> +
>  static void rtc_class_initfn(ObjectClass *klass, void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
>  
>      dc->realize = rtc_realizefn;
> +    dc->reset = rtc_resetdev;
>      dc->vmsd = &vmstate_rtc;
>      dc->props = mc146818rtc_properties;
>      /* Reason: needs to be wired up by rtc_init() */
> 

  reply	other threads:[~2016-12-14 12:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-14  6:48 [Qemu-devel] [PATCH] bugfix: vm halt when in reset looping hangaohuai
2016-12-14 12:19 ` Paolo Bonzini [this message]
2016-12-14 13:04   ` Hangaohuai

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=4bfd3066-6c2b-c21f-b6ea-9cc156fa4389@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=hangaohuai@huawei.com \
    --cc=mst@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).