summaryrefslogtreecommitdiffstats
path: root/hw/kvmvapic.c
diff options
context:
space:
mode:
authorAvi Kivity2012-03-06 16:50:10 +0100
committerAnthony Liguori2012-03-14 21:30:38 +0100
commit9512e4a9edef2d9b59eb10a03184cd90a34f62d5 (patch)
treed451f0def30fb1c9546a4322845e86fd24fdd39d /hw/kvmvapic.c
parentMerge remote-tracking branch 'kiszka/queues/slirp' into staging (diff)
downloadqemu-9512e4a9edef2d9b59eb10a03184cd90a34f62d5.tar.gz
qemu-9512e4a9edef2d9b59eb10a03184cd90a34f62d5.tar.xz
qemu-9512e4a9edef2d9b59eb10a03184cd90a34f62d5.zip
kvmvapic: align start address as well as size
The kvmvapic code remaps a section of ROM as RAM to allow the guest to maintain state there. It is careful to align the section size to a page boundary, to avoid creating subpages, but neglects to do the same for the start address. These leads to an assert later on when the memory core tries to create a page which is half RAM and half ROM. Fix by aligning the start address to a page boundary. This can be triggered by running qemu-system-x86_64 -enable-kvm -vga none. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/kvmvapic.c')
-rw-r--r--hw/kvmvapic.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/kvmvapic.c b/hw/kvmvapic.c
index 36ccfbcdbd..e8bfeec3de 100644
--- a/hw/kvmvapic.c
+++ b/hw/kvmvapic.c
@@ -578,8 +578,10 @@ static void vapic_map_rom_writable(VAPICROMState *s)
rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE;
s->rom_size = rom_size;
- /* We need to round up to avoid creating subpages
+ /* We need to round to avoid creating subpages
* from which we cannot run code. */
+ rom_size += rom_paddr & ~TARGET_PAGE_MASK;
+ rom_paddr &= TARGET_PAGE_MASK;
rom_size = TARGET_PAGE_ALIGN(rom_size);
memory_region_init_alias(&s->rom, "kvmvapic-rom", section.mr, rom_paddr,