From patchwork Sat Dec 5 11:44:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 40390 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 DF407B7BDF for ; Sat, 5 Dec 2009 22:55:53 +1100 (EST) Received: from localhost ([127.0.0.1]:42139 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGtEt-0000hP-6X for incoming@patchwork.ozlabs.org; Sat, 05 Dec 2009 06:55:51 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGt45-00048p-PJ for qemu-devel@nongnu.org; Sat, 05 Dec 2009 06:44:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGt42-000461-Qa for qemu-devel@nongnu.org; Sat, 05 Dec 2009 06:44:41 -0500 Received: from [199.232.76.173] (port=49821 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGt3z-000456-C6 for qemu-devel@nongnu.org; Sat, 05 Dec 2009 06:44:35 -0500 Received: from cantor.suse.de ([195.135.220.2]:59398 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 1NGt3y-0008G6-CE for qemu-devel@nongnu.org; Sat, 05 Dec 2009 06:44:34 -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 2F5A090847; Sat, 5 Dec 2009 12:44:32 +0100 (CET) From: Alexander Graf To: qemu-devel@nongnu.org Date: Sat, 5 Dec 2009 12:44:25 +0100 Message-Id: <1260013471-18691-6-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1260013471-18691-1-git-send-email-agraf@suse.de> References: <1260013471-18691-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 --- v5 -> v6: - correct typo --- exec.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/exec.c b/exec.c index eb1ee51..7b7fb5b 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_S390X) && defined(CONFIG_KVM) + /* XXX S390 KVM requires the topmost vma of the RAM to be < 256GB */ + new_block->host = mmap((void*)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