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: 200232 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id EFFC72C0089 for ; Tue, 20 Nov 2012 17:34:31 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752018Ab2KTGeN (ORCPT ); Tue, 20 Nov 2012 01:34:13 -0500 Received: from g4t0014.houston.hp.com ([15.201.24.17]:29716 "EHLO g4t0014.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751969Ab2KTGeL convert rfc822-to-8bit (ORCPT ); Tue, 20 Nov 2012 01:34:11 -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" CC: "linux-kernel@vger.kernel.org" Subject: [PATCH 4/4] AER-QEMU: Bring down the guest when KVM detects a PCI device error 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 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.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