[PATCH] kvm_unit_tests: vm.c - Retrieve RAM size from fwcfg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rather than letting the test dev do it.

CC: Avi Kivity <avi@xxxxxxxxxx>
CC: Marcelo Tosatti <mtosatti@xxxxxxxxxx>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@xxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux