kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] align vga rom to 4k boundary.
@ 2009-04-07  2:24 Glauber Costa
  2009-04-11 11:14 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Glauber Costa @ 2009-04-07  2:24 UTC (permalink / raw)
  To: kvm; +Cc: avi, aliguori

Instead of aligning to 2k boundary, as required by the bios,
align to 4k boundary, as required by kvm memory functions. Without
this patch, starting kvm with -vga std option fails with:

create_userspace_phys_mem: Invalid argument
kvm_cpu_register_physical_memory: failed

as described by: https://bugzilla.redhat.com/show_bug.cgi?id=494376

It does not fail with cirrus vga, because it is naturally aligned.
This problem does not seem to affect upstream qemu.

Signed-off-by: Glauber Costa <glommer@redhat.com>
---
 qemu/hw/pc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
index cc84772..680d4a2 100644
--- a/qemu/hw/pc.c
+++ b/qemu/hw/pc.c
@@ -919,7 +919,7 @@ vga_bios_error:
             exit(1);
         }
 	/* Round up vga bios size to the next 2k boundary */
-	vga_bios_size = (vga_bios_size + 2047) & ~2047;
+	vga_bios_size = (vga_bios_size + 4095) & ~4095;
 	option_rom_start = 0xc0000 + vga_bios_size;
 
         /* setup basic memory access */
-- 
1.5.6.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] align vga rom to 4k boundary.
  2009-04-07  2:24 [PATCH] align vga rom to 4k boundary Glauber Costa
@ 2009-04-11 11:14 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2009-04-11 11:14 UTC (permalink / raw)
  To: Glauber Costa; +Cc: kvm, aliguori

Glauber Costa wrote:
> Instead of aligning to 2k boundary, as required by the bios,
> align to 4k boundary, as required by kvm memory functions. Without
> this patch, starting kvm with -vga std option fails with:
>
> create_userspace_phys_mem: Invalid argument
> kvm_cpu_register_physical_memory: failed
>
> as described by: https://bugzilla.redhat.com/show_bug.cgi?id=494376
>
> It does not fail with cirrus vga, because it is naturally aligned.
> This problem does not seem to affect upstream qemu.
>
>              exit(1);
>          }
>  	/* Round up vga bios size to the next 2k boundary */
> -	vga_bios_size = (vga_bios_size + 2047) & ~2047;
> +	vga_bios_size = (vga_bios_size + 4095) & ~4095;
>  	option_rom_start = 0xc0000 + vga_bios_size;
>  
>          /* setup basic memory access */
>   

Comment needs updating.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-04-11 11:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-07  2:24 [PATCH] align vga rom to 4k boundary Glauber Costa
2009-04-11 11:14 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).