From patchwork Tue Aug 14 11:43:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 177233 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DA90E2C0082 for ; Tue, 14 Aug 2012 21:43:27 +1000 (EST) Received: from localhost ([::1]:46483 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1FWv-0005d0-VZ for incoming@patchwork.ozlabs.org; Tue, 14 Aug 2012 07:43:25 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1FWo-0005cv-DA for qemu-devel@nongnu.org; Tue, 14 Aug 2012 07:43:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1FWm-0007Dx-AR for qemu-devel@nongnu.org; Tue, 14 Aug 2012 07:43:18 -0400 Received: from goliath.siemens.de ([192.35.17.28]:25358) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1FWm-0007Dq-0o for qemu-devel@nongnu.org; Tue, 14 Aug 2012 07:43:16 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.13.6/8.13.6) with ESMTP id q7EBhDVf018776; Tue, 14 Aug 2012 13:43:13 +0200 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id q7EBhCxX020230; Tue, 14 Aug 2012 13:43:12 +0200 Message-ID: <502A39D0.7080702@siemens.com> Date: Tue, 14 Aug 2012 13:43:12 +0200 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Avi Kivity , Marcelo Tosatti References: <502A32BB.2000607@siemens.com> <87txw5itv9.fsf@blackfin.pond.sub.org> In-Reply-To: <87txw5itv9.fsf@blackfin.pond.sub.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 192.35.17.28 Cc: Markus Armbruster , kvm , qemu-devel Subject: [Qemu-devel] [PATCH v2 uq/master] kvmvapic: Disable if there is insufficient memory 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 We need at least 1M of RAM to map the option ROM. Otherwise, we will corrupt host memory or even crash: $ qemu-system-x86_64 -nodefaults --enable-kvm -vnc :0 -m 640k Segmentation fault (core dumped) Reported-and-tested-by: Markus Armbruster Signed-off-by: Jan Kiszka --- hw/apic_common.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/hw/apic_common.c b/hw/apic_common.c index 58e63b0..371f95d 100644 --- a/hw/apic_common.c +++ b/hw/apic_common.c @@ -299,7 +299,9 @@ static int apic_init_common(SysBusDevice *dev) sysbus_init_mmio(dev, &s->io_memory); - if (!vapic && s->vapic_control & VAPIC_ENABLE_MASK) { + /* Note: We need at least 1M to map the VAPIC option ROM */ + if (!vapic && s->vapic_control & VAPIC_ENABLE_MASK && + ram_size >= 1024 * 1024) { vapic = sysbus_create_simple("kvmvapic", -1, NULL); } s->vapic = vapic;