Skip to contentSkip to conversation

bugfix: vm halt when in reset looping

PATCH Superseded hangaohuai 2 participants 2 messages Dec 16, 2016

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

hangaohuai

author
#0 lore raw

PATCH v2 1/1 bugfix: vm halt when in reset looping

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;

---
 hw/timer/mc146818rtc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
hw/timer/mc146818rtc.c +11 -0
index da209d0..302905c 100644
@@ -946,11 +946,22 @@ static Property mc146818rtc_properties[] = {
     DEFINE_PROP_END_OF_LIST(),
 };
 
+static void rtc_resetdev(DeviceState *d)
+{
+    RTCState *s = MC146818_RTC(d);
+
+    /* Reason: VM do suspend self will set 0xfe 
+     * Only handle the VM boot case */
+    if (s->cmos_data[0x0f] == 0x0a)
+        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() */
Signature · 1 line
1.8.3.1
#1 lore raw
Your series seems to have some coding style problems. See output below for more information:

Hi,

Your series seems to have some coding style problems. See output below for more information:

Type: series
Subject: [Qemu-devel] [PATCH v2] bugfix: vm halt when in reset looping
Message-id: [email protected]

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

# Useful git options
git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
25d1c2e bugfix: vm halt when in reset looping

=== OUTPUT BEGIN ===
Checking PATCH 1/1: bugfix: vm halt when in reset looping...
ERROR: trailing whitespace
#30: FILE: hw/timer/mc146818rtc.c:953:
+ /* Reason: VM do suspend self will set 0xfe $

total: 1 errors, 0 warnings, 22 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]