From patchwork Thu Dec 11 12:19:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 42115 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1071826666 for ; Thu, 11 Dec 2014 12:21:34 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id e53sf3618070eek.7 for ; Thu, 11 Dec 2014 04:21:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=qRZXuPVBZw9Fkk6NXYzBFWHgmrbuJN5Yn0WERyjCcjg=; b=FLLW4tnGkoVru7wvFqkPy4Hx+YnD0k6JreOawjyVmHPf1ekK8W2xqNvD7CxbVBAN03 NIwYo45it0Ao5vAOwBP0ce+Gy+MUgXG4EX8GGxs2APLUrzJSkgZJ+OdV0A9D+3PfmcYU Ljv63ktDvh4a0eWzAC3HjCllnoSEDs50brDdt/fPGH8h26z9ZGwdqH8tQ/6mx60Blj9t uqWqPxVDvMYh0ZMyUFpAL89fwpCYoA1Eq+9gCi5RjGMBHRac6A+Su2Rm1ASfIYLAeRqU vxf+siMvoqvRtzcAmuBym3Tqs+FN7JvAp8JAKNVf1COmKZyXBC3r4xb8Nmnm5UzTzY5M MddA== X-Gm-Message-State: ALoCoQlKTdDf+u/hFIdARWDFhvVP7kSVMFIbYRQrxaNEjsiNsRS5uDVQ1qEmQk9KFwnFzZbe7gUG X-Received: by 10.152.5.2 with SMTP id o2mr1641976lao.1.1418300493241; Thu, 11 Dec 2014 04:21:33 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.5 with SMTP id r5ls233368lae.47.gmail; Thu, 11 Dec 2014 04:21:32 -0800 (PST) X-Received: by 10.152.19.71 with SMTP id c7mr9487271lae.79.1418300492874; Thu, 11 Dec 2014 04:21:32 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id q7si1088674lah.99.2014.12.11.04.21.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Dec 2014 04:21:32 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id s18so4204180lam.16 for ; Thu, 11 Dec 2014 04:21:32 -0800 (PST) X-Received: by 10.152.26.201 with SMTP id n9mr2841312lag.50.1418300492796; Thu, 11 Dec 2014 04:21:32 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp503770lbb; Thu, 11 Dec 2014 04:21:32 -0800 (PST) X-Received: by 10.140.19.9 with SMTP id 9mr17922171qgg.98.1418300491254; Thu, 11 Dec 2014 04:21:31 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u93si1007110qge.73.2014.12.11.04.21.30 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 11 Dec 2014 04:21:31 -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; Received: from localhost ([::1]:50527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xz2kM-00061M-8O for patch@linaro.org; Thu, 11 Dec 2014 07:21:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xz2iy-0004rV-8c for qemu-devel@nongnu.org; Thu, 11 Dec 2014 07:20:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xz2ix-0007C5-BJ for qemu-devel@nongnu.org; Thu, 11 Dec 2014 07:20:04 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:54567) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xz2ix-0006sg-54 for qemu-devel@nongnu.org; Thu, 11 Dec 2014 07:20:03 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Xz2ir-0001BG-5O for qemu-devel@nongnu.org; Thu, 11 Dec 2014 12:19:57 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 11 Dec 2014 12:19:55 +0000 Message-Id: <1418300395-4348-34-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1418300395-4348-1-git-send-email-peter.maydell@linaro.org> References: <1418300395-4348-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 33/33] target-arm: Check error conditions on kvm_arm_reset_vcpu 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Christoffer Dall When resetting a VCPU we currently call both kvm_arm_vcpu_init() and write_kvmstate_to_list(), both of which can fail, but we never check the return value. The only choice here is to print an error an exit if the calls fail. Signed-off-by: Christoffer Dall Reviewed-by: Peter Maydell Message-id: 1418039630-11773-1-git-send-email-christoffer.dall@linaro.org Signed-off-by: Peter Maydell --- target-arm/kvm.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/target-arm/kvm.c b/target-arm/kvm.c index 191e759..4d81f3d 100644 --- a/target-arm/kvm.c +++ b/target-arm/kvm.c @@ -442,11 +442,20 @@ bool write_list_to_kvmstate(ARMCPU *cpu) void kvm_arm_reset_vcpu(ARMCPU *cpu) { + int ret; + /* Re-init VCPU so that all registers are set to * their respective reset values. */ - kvm_arm_vcpu_init(CPU(cpu)); - write_kvmstate_to_list(cpu); + ret = kvm_arm_vcpu_init(CPU(cpu)); + if (ret < 0) { + fprintf(stderr, "kvm_arm_vcpu_init failed: %s\n", strerror(-ret)); + abort(); + } + if (!write_kvmstate_to_list(cpu)) { + fprintf(stderr, "write_kvmstate_to_list failed\n"); + abort(); + } } void kvm_arch_pre_run(CPUState *cs, struct kvm_run *run)