* [Qemu-devel] [PATCH] bugfix: vm halt when in reset looping
@ 2016-12-14 6:48 hangaohuai
2016-12-14 12:19 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: hangaohuai @ 2016-12-14 6:48 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, pbonzini, arei.gonglei, hangaohuai
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>
---
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() */
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] bugfix: vm halt when in reset looping
2016-12-14 6:48 [Qemu-devel] [PATCH] bugfix: vm halt when in reset looping hangaohuai
@ 2016-12-14 12:19 ` Paolo Bonzini
2016-12-14 13:04 ` Hangaohuai
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2016-12-14 12:19 UTC (permalink / raw)
To: hangaohuai, qemu-devel; +Cc: mst, arei.gonglei
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() */
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] bugfix: vm halt when in reset looping
2016-12-14 12:19 ` Paolo Bonzini
@ 2016-12-14 13:04 ` Hangaohuai
0 siblings, 0 replies; 3+ messages in thread
From: Hangaohuai @ 2016-12-14 13:04 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel@nongnu.org; +Cc: mst@redhat.com, Gonglei (Arei)
Thanks for the review and proposals .
I will think over the suspend and resume of VM.
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() */
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-12-14 13:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-14 6:48 [Qemu-devel] [PATCH] bugfix: vm halt when in reset looping hangaohuai
2016-12-14 12:19 ` Paolo Bonzini
2016-12-14 13:04 ` Hangaohuai
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).