From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: kvm@vger.kernel.org
Cc: Lucas Meneghel Rodrigues <lmr@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
qemu-devel@nongnu.org, Avi Kivity <avi@redhat.com>
Subject: [Qemu-devel] [PATCH] kvm_unit_tests: vm.c - Retrieve RAM size from fwcfg
Date: Wed, 31 Aug 2011 18:11:12 -0300 [thread overview]
Message-ID: <1314825072-27967-1-git-send-email-lmr@redhat.com> (raw)
Rather than letting the test dev do it.
CC: Avi Kivity <avi@redhat.com>
CC: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
lib/x86/fwcfg.c | 5 +++++
lib/x86/fwcfg.h | 1 +
lib/x86/vm.c | 2 +-
3 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/lib/x86/fwcfg.c b/lib/x86/fwcfg.c
index e2cdd15..df8548c 100644
--- a/lib/x86/fwcfg.c
+++ b/lib/x86/fwcfg.c
@@ -43,3 +43,8 @@ unsigned fwcfg_get_nb_cpus(void)
{
return fwcfg_get_u16(FW_CFG_NB_CPUS);
}
+
+unsigned fwcfg_get_ram_size(void)
+{
+ return fwcfg_get_u64(FW_CFG_RAM_SIZE);
+}
diff --git a/lib/x86/fwcfg.h b/lib/x86/fwcfg.h
index e0836ca..96c75b8 100644
--- a/lib/x86/fwcfg.h
+++ b/lib/x86/fwcfg.h
@@ -39,6 +39,7 @@ uint32_t fwcfg_get_u32(unsigned index);
uint64_t fwcfg_get_u64(unsigned index);
unsigned fwcfg_get_nb_cpus(void);
+unsigned fwcfg_get_ram_size(void);
#endif
diff --git a/lib/x86/vm.c b/lib/x86/vm.c
index abbb0c9..5b31892 100644
--- a/lib/x86/vm.c
+++ b/lib/x86/vm.c
@@ -194,7 +194,7 @@ static unsigned int inl(unsigned short port)
void setup_vm()
{
- end_of_memory = inl(0xd1);
+ end_of_memory = fwcfg_get_ram_size();
free_memory(&edata, end_of_memory - (unsigned long)&edata);
setup_mmu(end_of_memory);
}
--
1.7.6
next reply other threads:[~2011-08-31 21:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-31 21:11 Lucas Meneghel Rodrigues [this message]
2011-09-01 8:05 ` [Qemu-devel] [PATCH] kvm_unit_tests: vm.c - Retrieve RAM size from fwcfg 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=1314825072-27967-1-git-send-email-lmr@redhat.com \
--to=lmr@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).