On Mon, Sep 20, 2010 at 02:30:10PM +0200, Gleb Natapov wrote:
On Wed, Sep 15, 2010 at 10:31:36PM -0400, 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.
Can you check if with this patch kvm keeps pristine copy of the bios at 0xffff0000?
diff --git a/hw/piix_pci.c b/hw/piix_pci.c index 933ad86..f224ce7 100644 --- a/hw/piix_pci.c +++ b/hw/piix_pci.c @@ -99,10 +99,6 @@ static void i440fx_update_memory_mappings(PCII440FXState *d) int i, r; uint32_t smram, addr;
- if (kvm_enabled()) {
/* FIXME: Support remappings and protection changes. */
return;
- } update_pam(d, 0xf0000, 0x100000, (d->dev.config[I440FX_PAM] >> 4) & 3); for(i = 0; i < 12; i++) { r = (d->dev.config[(i >> 1) + (I440FX_PAM + 1)] >> ((i & 1) * 4)) & 3;
And check with patch below if reset works correctly without your hack of copying bios from high mem (works only with qemu for now):
diff --git a/hw/piix_pci.c b/hw/piix_pci.c index 933ad86..0bf435d 100644 --- a/hw/piix_pci.c +++ b/hw/piix_pci.c @@ -205,6 +201,20 @@ static int i440fx_pcihost_initfn(SysBusDevice *dev) return 0; }
+static void i440fx_reset(void *opaque) +{ + PCII440FXState *d = opaque; + int i; + + printf("i440fx_reset called\n"); + /* restor memory mappings */ + for (i = 0; i < I440FX_PAM_SIZE; i++) + d->dev.config[I440FX_PAM] = 0x00; + d->dev.config[I440FX_SMRAM] = 0x02; + d->smm_enabled = 0; + i440fx_update_memory_mappings(d); +} + static int i440fx_initfn(PCIDevice *dev) { PCII440FXState *d = DO_UPCAST(PCII440FXState, dev, dev); @@ -217,6 +227,7 @@ static int i440fx_initfn(PCIDevice *dev) d->dev.config[I440FX_SMRAM] = 0x02;
cpu_smm_register(&i440fx_set_smm, d); + qemu_register_reset(i440fx_reset, d); return 0; }
-- Gleb.