From patchwork Tue Nov 20 06:32:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pandarathil, Vijaymohan R" X-Patchwork-Id: 200235 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 7086B2C008E for ; Tue, 20 Nov 2012 17:56:02 +1100 (EST) Received: from localhost ([::1]:56954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TahPd-0004iN-HT for incoming@patchwork.ozlabs.org; Tue, 20 Nov 2012 01:34:25 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TahPR-0004Kc-F2 for qemu-devel@nongnu.org; Tue, 20 Nov 2012 01:34:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TahPQ-0007PR-Cm for qemu-devel@nongnu.org; Tue, 20 Nov 2012 01:34:13 -0500 Received: from g4t0014.houston.hp.com ([15.201.24.17]:29715) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TahPQ-0007P7-59 for qemu-devel@nongnu.org; Tue, 20 Nov 2012 01:34:12 -0500 Received: from G9W0369G.americas.hpqcorp.net (g9w0369g.houston.hp.com [16.216.193.232]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by g4t0014.houston.hp.com (Postfix) with ESMTPS id 99B8B24624; Tue, 20 Nov 2012 06:34:11 +0000 (UTC) Received: from G4W4286G.americas.hpqcorp.net (16.210.152.145) by G9W0369G.americas.hpqcorp.net (16.216.193.232) with Microsoft SMTP Server (TLS) id 14.2.283.4; Tue, 20 Nov 2012 06:32:39 +0000 Received: from G4W3208.americas.hpqcorp.net ([169.254.7.239]) by G4W4286G.americas.hpqcorp.net ([16.210.152.145]) with mapi id 14.02.0283.004; Tue, 20 Nov 2012 06:32:39 +0000 From: "Pandarathil, Vijaymohan R" To: "kvm@vger.kernel.org" , "linux-pci@vger.kernel.org" , "qemu-devel@nongnu.org" Thread-Topic: [PATCH 4/4] AER-QEMU: Bring down the guest when KVM detects a PCI device error Thread-Index: AQHNxujVrBWDP9Tva0O+0tzk61ameQ== Date: Tue, 20 Nov 2012 06:32:38 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [15.201.58.14] MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 15.201.24.17 Cc: "linux-kernel@vger.kernel.org" Subject: [Qemu-devel] [PATCH 4/4] AER-QEMU: Bring down the guest when KVM detects a PCI device error 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 - When KVM_RUN ioctl returns with an exit reason requesting a shutdown of the guest due to a PCI device error detected by AER, shutdown the guest immediately. Signed-off-by: Vijay Mohan Pandarathil --- kvm-all.c | 6 ++++++ linux-headers/linux/kvm.h | 1 + 2 files changed, 7 insertions(+) diff --git a/kvm-all.c b/kvm-all.c index b6d0483..aaff44c 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1592,6 +1592,12 @@ int kvm_cpu_exec(CPUArchState *env) qemu_system_reset_request(); ret = EXCP_INTERRUPT; break; + case KVM_EXIT_AER_SHUTDOWN: + fprintf(stderr, "KVM: PCI device assigned to guest encountered " + "an uncorrectable error. Stopping guest\n"); + qemu_system_shutdown_request(); + ret = EXCP_INTERRUPT; + break; case KVM_EXIT_UNKNOWN: fprintf(stderr, "KVM: unknown exit, hardware reason %" PRIx64 "\n", (uint64_t)run->hw.hardware_exit_reason); diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index 81d2feb..64906ef 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -167,6 +167,7 @@ struct kvm_pit_config { #define KVM_EXIT_OSI 18 #define KVM_EXIT_PAPR_HCALL 19 #define KVM_EXIT_S390_UCONTROL 20 +#define KVM_EXIT_AER_SHUTDOWN 21 /* For KVM_EXIT_INTERNAL_ERROR */ #define KVM_INTERNAL_ERROR_EMULATION 1