On Thu, Sep 16, 2010 at 06:34:04PM +0200, Avi Kivity wrote:
On 09/16/2010 04:31 AM, Kevin O'Connor wrote:
Unfortunately, both qemu and kvm don't appear to have a reliable way to hard-reboot - normal reboots don't reset the 0xc0000-0xfffff memory. I've worked around this on qemu by manually resetting that memory. However, kvm doesn't keep a pristine copy of the bios at 0xffff0000. Until this is fixed, this patch series will cause a soft-reboot on kvm to result in a shutdown instead of a reboot.
Why is there a difference between qemu and kvm here? What patch did you use for qemu and why doesn't it work for kvm?
I did not patch qemu or kvm. The issue (and work around) can be seen in seabios patch 7 of the series: http://www.seabios.org/pipermail/seabios/2010-September/000917.html
Basically, SeaBIOS detects a rerun of post (soft reset) when a variable in the f-segment (HaveRunPost) is set. When that occurs, seabios triggers a reset (i8042_reboot). Unfortunately, neither qemu nor kvm reset the f-segment, so on the next boot seabios still sees HaveRunPost as set, and things get stuck in a loop.
To work around this, patch 7 does a copy from 0xffff0000 to 0xf0000 to manually clear the f-segment (qemu_prep_reset). This hack works okay for qemu. Unfortunately, it doesn't work for kvm - even after the copy HaveRunPost is still set. Normally, 0xffff0000 would have a pristine copy of the bios - changes to 0xf0000 should not also change 0xffff0000, but it looks like kvm does something different.