summaryrefslogtreecommitdiff
path: root/bios
diff options
context:
space:
mode:
authorWeidong Han <weidong.han@intel.com>2009-02-19 17:24:20 +0800
committerEduardo Habkost <ehabkost@redhat.com>2009-03-05 11:49:48 -0300
commit569386365754757ca526f36634c89f1584b7586a (patch)
tree6d06aa6733828032151596ad360e1e8854ec3074 /bios
parent2c7c1728da1a293eb1022b1a6f656840f1f1c50b (diff)
kvm: bios: make MMIO address page aligned in guest
MMIO of some devices are not page aligned, such as some EHCI controllers and virtual Realtek NIC in guest. Current guest bios doesn't guarantee the start address of MMIO page aligned. This may result in failure of device assignment, because KVM only allow to register page aligned memory slots. For example, it fails to assign EHCI controller (its MMIO size is 1KB) with virtual Realtek NIC (its MMIO size is 256Bytes), because MMIO of virtual Realtek NIC in guest starts from 0xf2001000, MMIO of the EHCI controller will starts from 0xf2001400. MMIO addresses in guest are allocated in guest bios. This patch makes MMIO address page aligned in bios, then fixes the issue. Signed-off-by: Weidong Han <weidong.han@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> RH-Upstream-status: applied(kvm/master) Bugzilla: 488732 Acked-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Andrea Arcangeli <aarcange@redhat.com>
Diffstat (limited to 'bios')
-rwxr-xr-xbios/rombios32.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bios/rombios32.c b/bios/rombios32.c
index 45c86167..3bab2986 100755
--- a/bios/rombios32.c
+++ b/bios/rombios32.c
@@ -990,6 +990,9 @@ static void pci_bios_init_device(PCIDevice *d)
*paddr = (*paddr + size - 1) & ~(size - 1);
pci_set_io_region_addr(d, i, *paddr);
*paddr += size;
+ /* make memory address page aligned */
+ if (!(val & PCI_ADDRESS_SPACE_IO))
+ *paddr = (*paddr + 0xfff) & 0xfffff000;
}
}
break;