From patchwork Mon Apr 26 17:58:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 95117 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3QI1XHd020936 for ; Mon, 26 Apr 2010 18:01:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752709Ab0DZSAu (ORCPT ); Mon, 26 Apr 2010 14:00:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52777 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754053Ab0DZSAh (ORCPT ); Mon, 26 Apr 2010 14:00:37 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o3QI0Zib018577 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 26 Apr 2010 14:00:35 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3QI0Y9i006838; Mon, 26 Apr 2010 14:00:34 -0400 Received: from amt.cnet (vpn-8-113.rdu.redhat.com [10.11.8.113]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o3QI0Xv7006757; Mon, 26 Apr 2010 14:00:33 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 07221656067; Mon, 26 Apr 2010 15:00:03 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o3QI000x023711; Mon, 26 Apr 2010 15:00:00 -0300 From: Marcelo Tosatti To: Anthony Liguori Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Marcelo Tosatti , Avi Kivity Subject: [PATCH 03/10] kvm: handle internal error Date: Mon, 26 Apr 2010 14:58:59 -0300 Message-Id: <7c80eef899ff0feb1ab6730d4dd3bc3aee046093.1272304746.git.mtosatti@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 26 Apr 2010 18:01:41 +0000 (UTC) diff --git a/kvm-all.c b/kvm-all.c index d050115..9c8aa7d 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -730,6 +730,32 @@ static int kvm_handle_io(uint16_t port, void *data, int direction, int size, return 1; } +#ifdef KVM_CAP_INTERNAL_ERROR_DATA +static void kvm_handle_internal_error(CPUState *env, struct kvm_run *run) +{ + + if (kvm_check_extension(kvm_state, KVM_CAP_INTERNAL_ERROR_DATA)) { + int i; + + fprintf(stderr, "KVM internal error. Suberror: %d\n", + run->internal.suberror); + + for (i = 0; i < run->internal.ndata; ++i) { + fprintf(stderr, "extra data[%d]: %"PRIx64"\n", + i, (uint64_t)run->internal.data[i]); + } + } + cpu_dump_state(env, stderr, fprintf, 0); + if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION) { + fprintf(stderr, "emulation failure\n"); + } + /* FIXME: Should trigger a qmp message to let management know + * something went wrong. + */ + vm_stop(0); +} +#endif + void kvm_flush_coalesced_mmio_buffer(void) { #ifdef KVM_CAP_COALESCED_MMIO @@ -845,6 +871,11 @@ int kvm_cpu_exec(CPUState *env) case KVM_EXIT_EXCEPTION: DPRINTF("kvm_exit_exception\n"); break; +#ifdef KVM_CAP_INTERNAL_ERROR_DATA + case KVM_EXIT_INTERNAL_ERROR: + kvm_handle_internal_error(env, run); + break; +#endif case KVM_EXIT_DEBUG: DPRINTF("kvm_exit_debug\n"); #ifdef KVM_CAP_SET_GUEST_DEBUG