From: Gleb Natapov <gleb@redhat.com>
To: kvm@vger.kernel.org
Cc: mtosatti@redhat.com, lmr@redhat.com
Subject: [PATCH kvm-unit-test] get memory size from fwcfg
Date: Mon, 11 Feb 2013 15:10:32 +0200 [thread overview]
Message-ID: <20130211131032.GA7837@redhat.com> (raw)
Upstream test device does not implement port 0xd1.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
diff --git a/lib/x86/vm.c b/lib/x86/vm.c
index 71b70fd..2852c6c 100644
--- a/lib/x86/vm.c
+++ b/lib/x86/vm.c
@@ -1,3 +1,4 @@
+#include "fwcfg.h"
#include "vm.h"
#include "libcflat.h"
@@ -185,16 +186,9 @@ static void setup_mmu(unsigned long len)
printf("cr4 = %x\n", read_cr4());
}
-static unsigned int inl(unsigned short port)
-{
- unsigned int val;
- asm volatile("inl %w1, %0" : "=a"(val) : "Nd"(port));
- return val;
-}
-
void setup_vm()
{
- end_of_memory = inl(0xd1);
+ end_of_memory = fwcfg_get_u64(FW_CFG_RAM_SIZE);
free_memory(&edata, end_of_memory - (unsigned long)&edata);
setup_mmu(end_of_memory);
}
diff --git a/x86/rmap_chain.c b/x86/rmap_chain.c
index 9add9b8..0df1bcb 100644
--- a/x86/rmap_chain.c
+++ b/x86/rmap_chain.c
@@ -1,6 +1,7 @@
/* test long rmap chains */
#include "libcflat.h"
+#include "fwcfg.h"
#include "vm.h"
#include "smp.h"
@@ -21,7 +22,7 @@ int main (void)
setup_vm();
- nr_pages = inl(0xd1) / PAGE_SIZE;
+ nr_pages = fwcfg_get_u64(FW_CFG_RAM_SIZE) / PAGE_SIZE;
nr_pages -= 1000;
target_page = alloc_page();
--
Gleb.
next reply other threads:[~2013-02-11 13:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-11 13:10 Gleb Natapov [this message]
2013-02-11 16:13 ` [PATCH kvm-unit-test] get memory size from fwcfg Lucas Meneghel Rodrigues
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=20130211131032.GA7837@redhat.com \
--to=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lmr@redhat.com \
--cc=mtosatti@redhat.com \
/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