From patchwork Tue Nov 20 06:32:11 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: 200230 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 410172C0081 for ; Tue, 20 Nov 2012 17:34:03 +1100 (EST) Received: from localhost ([::1]:53944 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TahPF-00037H-At for incoming@patchwork.ozlabs.org; Tue, 20 Nov 2012 01:34:01 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TahP0-00030g-Hy for qemu-devel@nongnu.org; Tue, 20 Nov 2012 01:33:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TahOz-0007E0-DD for qemu-devel@nongnu.org; Tue, 20 Nov 2012 01:33:46 -0500 Received: from g4t0014.houston.hp.com ([15.201.24.17]:29276) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TahOz-0007Cn-70 for qemu-devel@nongnu.org; Tue, 20 Nov 2012 01:33:45 -0500 Received: from G4W3011G.americas.hpqcorp.net (g4w3011g.houston.hp.com [16.234.25.125]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by g4t0014.houston.hp.com (Postfix) with ESMTPS id C7D7F2463F; Tue, 20 Nov 2012 06:33:38 +0000 (UTC) Received: from G4W4286G.americas.hpqcorp.net (16.210.152.145) by G4W3011G.americas.hpqcorp.net (16.234.25.125) with Microsoft SMTP Server (TLS) id 14.2.283.4; Tue, 20 Nov 2012 06:32:12 +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:12 +0000 From: "Pandarathil, Vijaymohan R" To: "kvm@vger.kernel.org" , "linux-pci@vger.kernel.org" , "qemu-devel@nongnu.org" Thread-Topic: [PATCH 2/4] AER-GHES: Add support for error notification in firmware first approach of AER Thread-Index: AQHNxujFpQ+48gO/yEWDAkIhfHojIQ== Date: Tue, 20 Nov 2012 06:32:11 +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 2/4] AER-GHES: Add support for error notification in firmware first approach of AER 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 an uncorrected recoverable error is reported via an NMI in the firmware first model of AER, invoke the callbacks registered for notifications as well as mark the device as tainted. - Add a new function ghes_mark_dev_err() leveraged from ghes_do_proc() to identify the device from the error record and mark it as tainted. Signed-off-by: Vijay Mohan Pandarathil --- drivers/acpi/apei/ghes.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 1599566..7b077a7 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -502,6 +502,45 @@ static void ghes_do_proc(const struct acpi_hest_generic_status *estatus) } } +/* + * If an uncorrected recoverable PCIe error is reported, the corresponding + * PCI device is marked as tainted. The device remains tainted until the + * claiming driver does a recovery. The PCI device is identified from the + * error record. + */ +static void ghes_mark_dev_err(const struct acpi_hest_generic_status *estatus) +{ + int sev, sec_sev; + struct acpi_hest_generic_data *gdata; + + sev = ghes_severity(estatus->error_severity); + apei_estatus_for_each_section(estatus, gdata) { + sec_sev = ghes_severity(gdata->error_severity); + if (!uuid_le_cmp(*(uuid_le *)gdata->section_type, + CPER_SEC_PCIE)) { + struct cper_sec_pcie *pcie_err; + pcie_err = (struct cper_sec_pcie *)(gdata+1); + if (sev == GHES_SEV_RECOVERABLE && + sec_sev == GHES_SEV_RECOVERABLE && + pcie_err->validation_bits & + CPER_PCIE_VALID_DEVICE_ID && + pcie_err->validation_bits & + CPER_PCIE_VALID_AER_INFO) { + unsigned int devfn; + struct pci_dev *pdev; + devfn = PCI_DEVFN(pcie_err->device_id.device, + pcie_err->device_id.function); + pdev = pci_get_domain_bus_and_slot( + pcie_err->device_id.segment, + pcie_err->device_id.bus, + devfn); + if (!pdev) + continue; + pdev->dev_flags |= PCI_DEV_FLAGS_ERR_DETECTED; + } + } + } +} static void __ghes_print_estatus(const char *pfx, const struct acpi_hest_generic *generic, const struct acpi_hest_generic_status *estatus) @@ -868,6 +907,8 @@ static int ghes_notify_nmi(unsigned int cmd, struct pt_regs *regs) estatus = GHES_ESTATUS_FROM_NODE(estatus_node); memcpy(estatus, ghes->estatus, len); llist_add(&estatus_node->llnode, &ghes_estatus_llist); + ghes_mark_dev_err(estatus); + aer_notify(0, NULL); } next: #endif