public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Make to round memory to next page
@ 2007-09-05 15:35 Anthony Liguori
       [not found] ` <118900650250-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Anthony Liguori @ 2007-09-05 15:35 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f; +Cc: Anthony Liguori, Avi Kivity

In general, the BIOS, VGA BIOS, and option ROMs are not required to be multiple
of page sizes.  This means that phys_ram_size may not be a multiple of page.
Address this at the kvm_create() level to make things simplier for future
callers.

Signed-off-by: Anthony Liguori <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/user/kvmctl.c b/user/kvmctl.c
index 846aac9..035ff43 100644
--- a/user/kvmctl.c
+++ b/user/kvmctl.c
@@ -40,6 +40,7 @@
 static int kvm_abi = EXPECTED_KVM_API_VERSION;
 
 #define PAGE_SIZE 4096ul
+#define PAGE_MASK (~(PAGE_SIZE - 1))
 
 /* FIXME: share this number with kvm */
 /* FIXME: or dynamically alloc/realloc regions */
@@ -232,11 +233,12 @@ int kvm_create_vcpu(kvm_context_t kvm, int slot)
 	return 0;
 }
 
-int kvm_create(kvm_context_t kvm, unsigned long memory, void **vm_mem)
+int kvm_create(kvm_context_t kvm, unsigned long phys_mem_bytes, void **vm_mem)
 {
 	unsigned long dosmem = 0xa0000;
 	unsigned long exmem = 0xc0000;
 	unsigned long pcimem = 0xf0000000;
+	unsigned long memory = (phys_mem_bytes + PAGE_SIZE - 1) & PAGE_MASK;
 	int fd = kvm->fd;
 	int zfd;
 	int r;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

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

end of thread, other threads:[~2007-09-09 11:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-05 15:35 [PATCH 1/3] Make to round memory to next page Anthony Liguori
     [not found] ` <118900650250-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-09-05 15:35   ` [PATCH 2/3] Fix option ROM loading Anthony Liguori
     [not found]     ` <11890065032226-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-09-05 15:35       ` [PATCH] Fix network boot with newer BIOS Anthony Liguori
     [not found]         ` <11890065031622-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-09-05 15:36           ` [PATCH 3/3] " Anthony Liguori
2007-09-09 11:32   ` [PATCH 1/3] Make to round memory to next page Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox