From patchwork Thu Nov 26 13:23:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 39520 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AA1CFB6EEC for ; Fri, 27 Nov 2009 01:02:08 +1100 (EST) Received: from localhost ([127.0.0.1]:40144 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDev7-0006XV-QV for incoming@patchwork.ozlabs.org; Thu, 26 Nov 2009 09:02:05 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDeJq-00018c-R5 for qemu-devel@nongnu.org; Thu, 26 Nov 2009 08:23:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDeJj-00012p-OJ for qemu-devel@nongnu.org; Thu, 26 Nov 2009 08:23:32 -0500 Received: from [199.232.76.173] (port=42031 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDeJj-00012F-2l for qemu-devel@nongnu.org; Thu, 26 Nov 2009 08:23:27 -0500 Received: from cantor.suse.de ([195.135.220.2]:35914 helo=mx1.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NDeJi-0007at-JZ for qemu-devel@nongnu.org; Thu, 26 Nov 2009 08:23:26 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 24EE28E8CC; Thu, 26 Nov 2009 14:23:21 +0100 (CET) From: Alexander Graf To: qemu-devel@nongnu.org Date: Thu, 26 Nov 2009 14:23:14 +0100 Message-Id: <1259241800-2810-6-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1259241800-2810-1-git-send-email-agraf@suse.de> References: <1259241800-2810-1-git-send-email-agraf@suse.de> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 Cc: Carsten Otte , Aurelien Jarno Subject: [Qemu-devel] [PATCH 05/11] Allocate physical memory in low virtual address space X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org KVM on S390x requires the virtual address space of the guest's RAM to be within the first 256GB. The general direction I'd like to see KVM on S390 move is that this requirement is losened, but for now that's what we're stuck with. So let's just hack up qemu_ram_alloc until KVM behaves nicely :-). Signed-off-by: Alexander Graf --- exec.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/exec.c b/exec.c index 076d26b..59150d0 100644 --- a/exec.c +++ b/exec.c @@ -2411,7 +2411,13 @@ ram_addr_t qemu_ram_alloc(ram_addr_t size) size = TARGET_PAGE_ALIGN(size); new_block = qemu_malloc(sizeof(*new_block)); +#if defined(TARGET_S390) && defined(CONFIG_KVM) + /* XXX S390 KVM requires the topmost vma of the RAM to be < 256GB */ + new_block->host = mmap(0x1000000, size, PROT_EXEC|PROT_READ|PROT_WRITE, + MAP_SHARED | MAP_ANONYMOUS, -1, 0); +#else new_block->host = qemu_vmalloc(size); +#endif #ifdef MADV_MERGEABLE madvise(new_block->host, size, MADV_MERGEABLE); #endif