From patchwork Wed Nov 9 14:57:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 81525 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp248580qge; Wed, 9 Nov 2016 07:16:16 -0800 (PST) X-Received: by 10.202.245.74 with SMTP id t71mr87653oih.37.1478704576904; Wed, 09 Nov 2016 07:16:16 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id n65si39425otn.142.2016.11.09.07.16.16 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 09 Nov 2016 07:16:16 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40513 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c4Ubo-0006ua-8f for patch@linaro.org; Wed, 09 Nov 2016 10:16:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c4UKH-0000dc-Ik for qemu-devel@nongnu.org; Wed, 09 Nov 2016 09:58:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c4UKG-0002K6-QA for qemu-devel@nongnu.org; Wed, 09 Nov 2016 09:58:09 -0500 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:35291) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c4UKG-0002Jh-JA for qemu-devel@nongnu.org; Wed, 09 Nov 2016 09:58:08 -0500 Received: by mail-wm0-x232.google.com with SMTP id a197so312249891wmd.0 for ; Wed, 09 Nov 2016 06:58:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cvXqYFgDcHGADfISM/NPHouUooTZ1n7GfXlf6CYiovs=; b=aiJpWcihzMwKezSdzbaGCbku8QDWjJ/X5k4SuQ4M7pOMW3D5xVhAVmXXDocIdc5Mqj nwp0vLvTbB6y/5abOMKP5SvVCxIX/SDs+NiUZg2H9H3BQmQZEdwoaOIGtuSI5lvzXZrX Ef2H8Yz8SSPlrwwl325j10NIdRkLRQi/QlnvY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cvXqYFgDcHGADfISM/NPHouUooTZ1n7GfXlf6CYiovs=; b=ES7BbcOKLhowfrb5awgE4jcSJV0mFgHX9uGEJX7IwkTuB+7BLeQqSVV5VKC/CItkuj vBkV8RXewqOSFrcXL4C0CDBa+g9FGsuxMiBA5Xa84oqjDqWthN2UJVJYca2euR2Go/zQ CHv0xXEllLvWeMPHgr6w/LlzX711Ji+WaEwq8EQfk3zd/9A6eTEphBpeEgi324YN2Rvc 1FPJNs75w2A3qUFCItWlg7d2YuuISx3FHhuoR0yZ+la0YFZIKJsYztq8z93/kVvHkVcd su7sdMSWwtBm4wI8UXeaRp1PACfYUCJVre10ZjyUXfymeFrOiSaNRW/dvfTVnylqGxpQ gKOg== X-Gm-Message-State: ABUngveHUg2KM8W4ekSYqLGk2cZ9Z+gfX4yHZxlDyU4YiGJMdd8j0GcE4lHc36Q9lM5x73gW X-Received: by 10.28.132.202 with SMTP id g193mr710832wmd.117.1478703487278; Wed, 09 Nov 2016 06:58:07 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o143sm694152wmd.7.2016.11.09.06.58.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Nov 2016 06:58:03 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id B27FE3E0458; Wed, 9 Nov 2016 14:57:57 +0000 (GMT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: pbonzini@redhat.com Date: Wed, 9 Nov 2016 14:57:41 +0000 Message-Id: <20161109145748.27282-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161109145748.27282-1-alex.bennee@linaro.org> References: <20161109145748.27282-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::232 Subject: [Qemu-devel] [PATCH v6 12/19] cputlb: tweak qemu_ram_addr_from_host_nofail reporting 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: mttcg@listserver.greensocs.com, peter.maydell@linaro.org, claudio.fontana@huawei.com, nikunj@linux.vnet.ibm.com, Peter Crosthwaite , jan.kiszka@siemens.com, mark.burton@greensocs.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, cota@braap.org, serge.fdrv@gmail.com, bobby.prani@gmail.com, rth@twiddle.net, =?UTF-8?q?Alex=20Benn=C3=A9e?= , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This moves the helper function closer to where it is called and updates the error message to report via error_report instead of the deprecated fprintf. Signed-off-by: Alex Bennée --- cputlb.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) -- 2.10.1 Reviewed-by: Richard Henderson diff --git a/cputlb.c b/cputlb.c index d75bf8f..cd1ff71 100644 --- a/cputlb.c +++ b/cputlb.c @@ -316,18 +316,6 @@ void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry, uintptr_t start, } } -static inline ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr) -{ - ram_addr_t ram_addr; - - ram_addr = qemu_ram_addr_from_host(ptr); - if (ram_addr == RAM_ADDR_INVALID) { - fprintf(stderr, "Bad ram pointer %p\n", ptr); - abort(); - } - return ram_addr; -} - void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length) { CPUArchState *env; @@ -539,6 +527,18 @@ static void report_bad_exec(CPUState *cpu, target_ulong addr) log_cpu_state_mask(LOG_GUEST_ERROR, cpu, CPU_DUMP_FPU | CPU_DUMP_CCOP); } +static inline ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr) +{ + ram_addr_t ram_addr; + + ram_addr = qemu_ram_addr_from_host(ptr); + if (ram_addr == RAM_ADDR_INVALID) { + error_report("Bad ram pointer %p", ptr); + abort(); + } + return ram_addr; +} + /* NOTE: this function can trigger an exception */ /* NOTE2: the returned address is not exactly the physical address: it * is actually a ram_addr_t (in system mode; the user mode emulation