From patchwork Fri Jan 17 19:25:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 312183 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7B28B2C0099 for ; Sat, 18 Jan 2014 06:26:44 +1100 (EST) Received: from localhost ([::1]:39742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4F3y-0002ap-1j for incoming@patchwork.ozlabs.org; Fri, 17 Jan 2014 14:26:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4F3D-0002Lf-0I for qemu-devel@nongnu.org; Fri, 17 Jan 2014 14:26:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W4F37-0004QA-Ul for qemu-devel@nongnu.org; Fri, 17 Jan 2014 14:25:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:26113) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4F37-0004Q6-Li for qemu-devel@nongnu.org; Fri, 17 Jan 2014 14:25:49 -0500 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 s0HJPjm8024530 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 17 Jan 2014 14:25:46 -0500 Received: from bling.home ([10.3.113.17]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s0HJPiom016267; Fri, 17 Jan 2014 14:25:44 -0500 From: Alex Williamson To: aliguori@amazon.com Date: Fri, 17 Jan 2014 12:25:44 -0700 Message-ID: <20140117192544.10456.17937.stgit@bling.home> In-Reply-To: <20140117192252.10456.96113.stgit@bling.home> References: <20140117192252.10456.96113.stgit@bling.home> User-Agent: StGit/0.17-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Alexey Kardashevskiy , Paolo Bonzini , qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PULL 6/7] kvm: initialize qemu_host_page_size 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 From: Alexey Kardashevskiy There is a HOST_PAGE_ALIGN macro which makes sense for KVM accelerator but it uses qemu_host_page_size/qemu_host_page_mask which initialized for TCG only. This moves qemu_host_page_size/qemu_host_page_mask initialization from TCG's page_init() and adds a call for it from kvm_init(). Signed-off-by: Alexey Kardashevskiy Acked-by: Paolo Bonzini Signed-off-by: Alex Williamson --- include/exec/exec-all.h | 1 + kvm-all.c | 1 + translate-all.c | 14 ++++++++------ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index ea90b64..3b03cbf 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -81,6 +81,7 @@ void cpu_gen_init(void); int cpu_gen_code(CPUArchState *env, struct TranslationBlock *tb, int *gen_code_size_ptr); bool cpu_restore_state(CPUArchState *env, uintptr_t searched_pc); +void page_size_init(void); void QEMU_NORETURN cpu_resume_from_signal(CPUArchState *env1, void *puc); void QEMU_NORETURN cpu_io_recompile(CPUArchState *env, uintptr_t retaddr); diff --git a/kvm-all.c b/kvm-all.c index 0bfb060..edf2365 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1360,6 +1360,7 @@ int kvm_init(void) * page size for the system though. */ assert(TARGET_PAGE_SIZE <= getpagesize()); + page_size_init(); #ifdef KVM_CAP_SET_GUEST_DEBUG QTAILQ_INIT(&s->kvm_sw_breakpoints); diff --git a/translate-all.c b/translate-all.c index 105c25a..543e1ff 100644 --- a/translate-all.c +++ b/translate-all.c @@ -289,17 +289,15 @@ static inline void map_exec(void *addr, long size) } #endif -static void page_init(void) +void page_size_init(void) { /* NOTE: we can always suppose that qemu_host_page_size >= TARGET_PAGE_SIZE */ #ifdef _WIN32 - { - SYSTEM_INFO system_info; + SYSTEM_INFO system_info; - GetSystemInfo(&system_info); - qemu_real_host_page_size = system_info.dwPageSize; - } + GetSystemInfo(&system_info); + qemu_real_host_page_size = system_info.dwPageSize; #else qemu_real_host_page_size = getpagesize(); #endif @@ -310,7 +308,11 @@ static void page_init(void) qemu_host_page_size = TARGET_PAGE_SIZE; } qemu_host_page_mask = ~(qemu_host_page_size - 1); +} +static void page_init(void) +{ + page_size_init(); #if defined(CONFIG_BSD) && defined(CONFIG_USER_ONLY) { #ifdef HAVE_KINFO_GETVMMAP