* [Qemu-devel] [PATCH] kvm_unit_tests: vm.c - Retrieve RAM size from fwcfg
@ 2011-08-31 21:11 Lucas Meneghel Rodrigues
2011-09-01 8:05 ` Avi Kivity
0 siblings, 1 reply; 2+ messages in thread
From: Lucas Meneghel Rodrigues @ 2011-08-31 21:11 UTC (permalink / raw)
To: kvm; +Cc: Lucas Meneghel Rodrigues, Marcelo Tosatti, qemu-devel, Avi Kivity
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-01 8:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-31 21:11 [Qemu-devel] [PATCH] kvm_unit_tests: vm.c - Retrieve RAM size from fwcfg Lucas Meneghel Rodrigues
2011-09-01 8:05 ` 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).