public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: Anthony Liguori
	<aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>,
	Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Subject: [PATCH 1/3] Make to round memory to next page
Date: Wed,  5 Sep 2007 10:35:00 -0500	[thread overview]
Message-ID: <118900650250-git-send-email-aliguori@us.ibm.com> (raw)

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/

             reply	other threads:[~2007-09-05 15:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-05 15:35 Anthony Liguori [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=118900650250-git-send-email-aliguori@us.ibm.com \
    --to=aliguori-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox