From patchwork Thu Oct 25 09:47:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 194094 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 11C182C00AE for ; Thu, 25 Oct 2012 20:58:22 +1100 (EST) Received: from localhost ([::1]:50262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRKCj-00035z-1U for incoming@patchwork.ozlabs.org; Thu, 25 Oct 2012 05:58:21 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRK32-00013X-Vv for qemu-devel@nongnu.org; Thu, 25 Oct 2012 05:48:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TRK2x-0006cI-7m for qemu-devel@nongnu.org; Thu, 25 Oct 2012 05:48:20 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:37568) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRK2x-0006RV-1X for qemu-devel@nongnu.org; Thu, 25 Oct 2012 05:48:15 -0400 Received: by mail-pb0-f45.google.com with SMTP id rp2so1799391pbb.4 for ; Thu, 25 Oct 2012 02:48:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:in-reply-to:references:x-gm-message-state; bh=D2ymhs1D7+8nNMbfxl1RuwAfjTHdAKsg3D3Z0Do5EI4=; b=f/wLmjy2ugkn1Jibe1Uor7GGUCVvzYmndiqmSd3GbO9P9ucpu1mhdAavf74jdqIrOW 8ysFLaAjMdjogNoMuWWqIGffu4YFdk6vuRg4nEruAAijvqGkxM0Sofr6S7bY+7n9qF7/ dEjiCjLyv795h3EIspIf1Egvw+Y1Q7+m94JhJ0MNO6A9O/E7zEc9fdv118XPJ+ojspLR 87PGBpOAEf7UvOUBYXLD/HyjdJj5mjEWGLuCUaccPe9kIHBnLG16iG9o5uflqemMgFua eASorrn6cKq68D0ZmqvtvF7SGgA6fEK6670cjNboRM4ukoOnnR/b5HlApF3OP7lUrAuX ySmA== Received: by 10.68.195.9 with SMTP id ia9mr59145349pbc.74.1351158494459; Thu, 25 Oct 2012 02:48:14 -0700 (PDT) Received: from localhost ([124.148.20.9]) by mx.google.com with ESMTPS id po4sm10964727pbb.13.2012.10.25.02.48.11 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 25 Oct 2012 02:48:13 -0700 (PDT) From: Peter Crosthwaite To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2012 19:47:19 +1000 Message-Id: X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQkTioKn4fzYtRhCwLiYBrOVijjTA4FSdAgGyokdls1diyUakvyLJK/DECQxkCI9NDQdK8x7 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: vineshp@xilinx.com, peter.maydell@linaro.org, Peter Crosthwaite , john.williams@xilinx.com, kraxel@redhat.com, edgar.iglesias@gmail.com Subject: [Qemu-devel] [PATCH v1 8/8] usb/ehci: Put RAM in undefined MMIO regions 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 Just put RAM regions in the unimplemented spaces in the MMIO region. These regions have undefined behaviour, but this at least stops QEMU from segfaulting when the guest bangs on these registers (and sucessfully fakes reading and writing the registers with no side effects). Signed-off-by: Peter Crosthwaite --- hw/usb/hcd-ehci.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 78f9dfd..b6418bc 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -396,6 +396,8 @@ struct EHCIState { MemoryRegion mem_caps; MemoryRegion mem_opreg; MemoryRegion mem_ports; + MemoryRegion mem_other_low; + MemoryRegion mem_other_high; int companion_count; /* properties */ @@ -2773,17 +2775,27 @@ static void usb_ehci_initfn(EHCIState *s, DeviceState *dev) qemu_add_vm_change_state_handler(usb_ehci_vm_state_change, s); memory_region_init(&s->mem, "ehci", MMIO_SIZE); + if (s->capabase) { + memory_region_init_ram(&s->mem_other_low, "other-low", s->capabase); + } memory_region_init_io(&s->mem_caps, &ehci_mmio_caps_ops, s, "capabilities", s->opregbase); memory_region_init_io(&s->mem_opreg, &ehci_mmio_opreg_ops, s, "operational", PORTSC_BEGIN); memory_region_init_io(&s->mem_ports, &ehci_mmio_port_ops, s, "ports", PORTSC_END - PORTSC_BEGIN); + memory_region_init_ram(&s->mem_other_high, "other-high", MMIO_SIZE - + s->opregbase - (PORTSC_END - PORTSC_BEGIN)); + if (s->capabase) { + memory_region_add_subregion(&s->mem, 0, &s->mem_other_low); + } memory_region_add_subregion(&s->mem, s->capabase, &s->mem_caps); memory_region_add_subregion(&s->mem, s->opregbase, &s->mem_opreg); memory_region_add_subregion(&s->mem, s->opregbase + PORTSC_BEGIN, &s->mem_ports); + memory_region_add_subregion(&s->mem, s->opregbase + PORTSC_END, + &s->mem_other_high); } static int usb_ehci_sysbus_initfn(SysBusDevice *dev)