From patchwork Fri Jan 6 15:24:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 9501301 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 581B1606E0 for ; Fri, 6 Jan 2017 15:25:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4ACCD284D4 for ; Fri, 6 Jan 2017 15:25:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BEB6284E1; Fri, 6 Jan 2017 15:25:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AFEA9284D4 for ; Fri, 6 Jan 2017 15:25:51 +0000 (UTC) Received: from localhost ([::1]:53334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cPWOs-0000gX-QK for patchwork-qemu-devel@patchwork.kernel.org; Fri, 06 Jan 2017 10:25:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cPWND-0008IV-Tx for qemu-devel@nongnu.org; Fri, 06 Jan 2017 10:24:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cPWNC-0005YC-Q0 for qemu-devel@nongnu.org; Fri, 06 Jan 2017 10:24:07 -0500 Received: from mail-it0-x241.google.com ([2607:f8b0:4001:c0b::241]:33031) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cPWNC-0005Xq-L5 for qemu-devel@nongnu.org; Fri, 06 Jan 2017 10:24:06 -0500 Received: by mail-it0-x241.google.com with SMTP id c20so2360416itb.0 for ; Fri, 06 Jan 2017 07:24:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=kgk2SqxTPXBHizF9ObHuoEfb/O+hSzEVXG2qRONILrE=; b=lnO6ReCmUL3CV1bLx6v819G/ndrjNTJiogUq0Q5E5aZxjnUBThTNp7kHmYiSf7VjuQ 3feEnApW1y+Sg5WJj+UccFRtEAwMHY989QrD1E33CkTJz5i3945KPvsubuvRFu4RmhGi GiHU9VeuQ1cv5Au3gTZNCGsYIRCtC8ing17C3nByeQg8/Ss91PLUwkkTKzUj10DUL1/a GQbEMS1FkBgMl+0/HoT+aYxo3b3b7IkS9kLgJAKLwlsMK1jMyKvs2ohEWlKKbniNCkXu 5pPsuQv6K93NkB6FkQcGD2+/eEGTkal2R9iDq1ynvChXzjBz5WLYVcdVwqp7XxWEP1IR AZZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=kgk2SqxTPXBHizF9ObHuoEfb/O+hSzEVXG2qRONILrE=; b=HKNfnad9SP8mdw+tXvip5lOHoLZdWJXJVrNITRHN5AzwHPwhhgiy7fdojHTtInCERQ E0HrOaJbjK3vqNrqxhkLe1AzUK7ofuLvpIMeYhyV3tIATcDttkyHBU0TyOOw5mmdl9M3 LS8Ty0CZzg7G7iQQC7eHdHfcL3pRwJOSH1kkCR8og73EDiLNLtpJpD6vlZr5mhdXd1kH cffh/f+Q1H1snyRp4SUvujLI0bq83KSLjx2Lx4Rx7xrptp6c3eADp2wUFBDN6qhErpuW DqTj2qltEBeqE7HenbEPLaKe/LX6SHGNICiq1fdWtfpQIgRQLHV8qvQyWEJwjhf9DVGX Uugw== X-Gm-Message-State: AIkVDXKz/bQroiaAwYvslEepCwGY0Kp0tuGOq5WMzDtVgDgdSpAtwV1okPiEUXa46GALKUTEgkt/WZUSFSIGAQ== X-Received: by 10.36.66.76 with SMTP id i73mr2952669itb.50.1483716245887; Fri, 06 Jan 2017 07:24:05 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.151.3 with HTTP; Fri, 6 Jan 2017 07:24:05 -0800 (PST) In-Reply-To: References: <20170105225210.GA5235@octofox.metropolis> From: Max Filippov Date: Fri, 6 Jan 2017 07:24:05 -0800 Message-ID: To: Peter Maydell X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c0b::241 Subject: Re: [Qemu-devel] qemu-softmmu aborted with "Bad ram pointer" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU Developers Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Jan 6, 2017 at 2:23 AM, Peter Maydell wrote: > On 5 January 2017 at 22:52, Max Filippov wrote: >> Hello, >> >> debugging XIP kernel running directly from CFI FLASH I've got to a point >> where QEMU aborts with the message "Bad ram pointer 0xbb4". >> >> It turns out that that happens when QEMU tries to translate code from FLASH >> immediately after the kernel has written to the FLASH address range: >> writing to FLASH address range turns off romd_mode of its memory region: > > This sounds like > https://lists.nongnu.org/archive/html/qemu-devel/2016-08/msg03273.html Right. Strange that I haven't found it... > It's a bug that we fail with this unhelpful message and abort, > but the fix to the bug would only cause us to print the more > useful "can't execute from a device" instead. You can't > execute from a ROM that's not in ROMD mode, I'm afraid. Yes, aborting is my main concern. Shouldn't we do something like the following? diff --git a/exec.c b/exec.c index 8d4bb0e..d3f1818 100644 --- a/exec.c +++ b/exec.c @@ -381,7 +381,8 @@ static MemoryRegionSection *phys_page_find(PhysPageEntry lp, hwaddr addr, bool memory_region_is_unassigned(MemoryRegion *mr) { - return mr != &io_mem_rom && mr != &io_mem_notdirty && !mr->rom_device + return mr != &io_mem_rom && mr != &io_mem_notdirty + && !(mr->rom_device && mr->romd_mode) && mr != &io_mem_watch; }