From patchwork Wed Aug 24 19:09:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 111412 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 5B3A4B6F00 for ; Thu, 25 Aug 2011 05:10:01 +1000 (EST) Received: from localhost ([::1]:55291 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwIpl-0005dJ-8J for incoming@patchwork.ozlabs.org; Wed, 24 Aug 2011 15:09:53 -0400 Received: from eggs.gnu.org ([140.186.70.92]:38250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwIpg-0005co-Kh for qemu-devel@nongnu.org; Wed, 24 Aug 2011 15:09:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QwIpf-0003hV-AN for qemu-devel@nongnu.org; Wed, 24 Aug 2011 15:09:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59494) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwIpf-0003hK-1T for qemu-devel@nongnu.org; Wed, 24 Aug 2011 15:09:47 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7OJ9ij6003847 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 24 Aug 2011 15:09:44 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p7OJ9hxq022961; Wed, 24 Aug 2011 15:09:44 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 09D4F250B4C; Wed, 24 Aug 2011 22:09:43 +0300 (IDT) From: Avi Kivity To: "Edgar E. Iglesias" Date: Wed, 24 Aug 2011 22:09:41 +0300 Message-Id: <1314212981-30211-1-git-send-email-avi@redhat.com> In-Reply-To: <20110824183949.GC17167@zapo> References: <20110824183949.GC17167@zapo> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Blue Swirl , Peter Maydell , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] gt64xxx: fix crash in gt64120_pci_mapping() 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 The map/unmap code was assymetric - unmap used the local MemoryRegion while map used isa_mmio_init(), which cannot handle dynamic mappings. Fix by using isa_mmio_setup() and the local MemoryRegion. Signed-off-by: Avi Kivity --- Untested. hw/gt64xxx.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/hw/gt64xxx.c b/hw/gt64xxx.c index 6af9782..1c34253 100644 --- a/hw/gt64xxx.c +++ b/hw/gt64xxx.c @@ -297,7 +297,11 @@ static void gt64120_pci_mapping(GT64120State *s) s->PCI0IO_start = s->regs[GT_PCI0IOLD] << 21; s->PCI0IO_length = ((s->regs[GT_PCI0IOHD] + 1) - (s->regs[GT_PCI0IOLD] & 0x7f)) << 21; isa_mem_base = s->PCI0IO_start; - isa_mmio_init(s->PCI0IO_start, s->PCI0IO_length); + if (s->PCI0IO_length) { + isa_mmio_setup(&s->PCI0IO_mem, s->PCI0IO_length); + memory_region_add_subregion(get_system_memory(), s->PCI0IO_start, + &s->PCI0IO_mem); + } } }