[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] kvmvapic: align start address as well as size
From: |
Jan Kiszka |
Subject: |
Re: [Qemu-devel] [PATCH] kvmvapic: align start address as well as size |
Date: |
Tue, 06 Mar 2012 17:01:42 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
On 2012-03-06 16:50, Avi Kivity wrote:
> 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 <address@hidden>
> ---
> hw/kvmvapic.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/hw/kvmvapic.c b/hw/kvmvapic.c
> index 36ccfbc..e8bfeec 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,
Reviewed-by: Jan Kiszka <address@hidden>
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux