]> xenbits.xensource.com Git - qemu-xen-4.2-testing.git/commit
qemu-dm: fix unregister_iomem()
authorJan Beulich <JBeulich@suse.com>
Tue, 7 Feb 2012 18:42:56 +0000 (18:42 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 7 Feb 2012 18:42:56 +0000 (18:42 +0000)
commit8cc8a3651c9c5bc2d0086d12f4b870fc525b9387
tree9ccacc351d46cd788e783751837d7e387cfb0325
parentebe37b2a3f844bad02dcc30d081f39eda06118f8
qemu-dm: fix unregister_iomem()

This function (introduced quite a long time ago in
e7911109f4321e9ba0cc56a253b653600aa46bea - "disable qemu PCI
devices in HVM domains") appears to be completely broken, causing
the regression reported in
http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1805 (due to
the newly added caller of it in
56d7747a3cf811910c4cf865e1ebcb8b82502005 - "qemu: clean up
MSI-X table handling"). It's unclear how the function can ever have
fulfilled its purpose: the value returned by iomem_index() is *not* an
index into mmio[].

Additionally, fix two problems:
- unregister_iomem() must not clear mmio[].start, otherwise
  cpu_register_physical_memory() won't be able to re-use the previous
  slot, thus causing a leak
- cpu_unregister_io_memory() must not check mmio[].size, otherwise it
  won't properly clean up entries (temporarily) squashed through
  unregister_iomem()

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Yongjie Ren <yongjie.ren@intel.com>
i386-dm/exec-dm.c