From patchwork Wed Aug 31 21:11:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 112690 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D47E8B6F6F for ; Thu, 1 Sep 2011 07:11:36 +1000 (EST) Received: from localhost ([::1]:51966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qys4L-0004ZB-Va for incoming@patchwork.ozlabs.org; Wed, 31 Aug 2011 17:11:33 -0400 Received: from eggs.gnu.org ([140.186.70.92]:56778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qys4G-0004Z5-Ey for qemu-devel@nongnu.org; Wed, 31 Aug 2011 17:11:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qys4F-00088D-3N for qemu-devel@nongnu.org; Wed, 31 Aug 2011 17:11:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9046) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qys4E-000882-Lo for qemu-devel@nongnu.org; Wed, 31 Aug 2011 17:11:27 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7VLBPMP000525 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 31 Aug 2011 17:11:25 -0400 Received: from freedom.local.com (vpn-232-151.phx2.redhat.com [10.3.232.151]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p7VLBNPW032404; Wed, 31 Aug 2011 17:11:23 -0400 From: Lucas Meneghel Rodrigues To: kvm@vger.kernel.org Date: Wed, 31 Aug 2011 18:11:12 -0300 Message-Id: <1314825072-27967-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Lucas Meneghel Rodrigues , Marcelo Tosatti , qemu-devel@nongnu.org, Avi Kivity Subject: [Qemu-devel] [PATCH] kvm_unit_tests: vm.c - Retrieve RAM size from fwcfg X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Rather than letting the test dev do it. CC: Avi Kivity CC: Marcelo Tosatti Signed-off-by: Lucas Meneghel Rodrigues --- 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); }