From patchwork Thu Nov 14 13:39:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 179429 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp11073079ilf; Thu, 14 Nov 2019 05:39:45 -0800 (PST) X-Google-Smtp-Source: APXvYqy2ZbV2ecS+/PNDQF4bXXiM+eNCr+YNYM6i/hAvLHXjmF/qDbrXcqBxnWplRhXRomcxVN86 X-Received: by 2002:a50:b4e4:: with SMTP id x33mr1304479edd.222.1573738785527; Thu, 14 Nov 2019 05:39:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573738785; cv=none; d=google.com; s=arc-20160816; b=FHNcDHKS6PhdS+wHs7QYtqqVglkFZhUcfZJcqjNYcIhjKIGDXkW7jHEB3mEiHb21cw ZsWdla4q0E24yPYOS/kZDe1FQ6+lw9+c6mSDNr4nDsJBXqTprz1G0Ced1CCN38Se4S/h RCRAMUZ30zdxg4kWukkJ5Tr1n17gA4FLTagTFZEsi5kRJBCXQzDDmQWGvNEUipiLtVaY 6Ic1IvEA3t1VJcrMNodBRKN0Ik66leChArR03TD9CPT6xJoLV1oKuvR8vb9KghJ+r+DW Y28m9ffzPOneNcywoS3MFV1QwqousNPK6IclYJSqlDDrEyIZVigAPoNW+LsZ+eE+nAXF zk8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=FvwWoTlJXJvR2fPqR3WiWE2ZlyUxY6aMUoAlhE6YrzI=; b=DllnVIO7JRi0o6AzFN8poVcNEkVn1XXfNhZOC2tbS82B8+qWpm0CGRoowbIrO5W/QZ emQPFDF1YKZjGS5MbZsQ36cz43fcBmAAHEW+wwdMl0cabTxGBYKIOU8XxqBcKSUPgi0u tQgx804NyCGZhrLKw/cBYg2bum+qOxGWyGg0MOHCqDAeiOYj8lPPi/MZv40bhPMtx4G8 3ry4ONzLKwMj4MUxFTgVDomzlRe82yO5d8g2zEVpMD8k55hgzs+D4EqKIuqD+DDTQ8we 9UYrPRTU/nreRKkh2DFC9bnV9zaIAj+I5YcY6xNXKmgzLhZ0Om+mzmR5a6Y3gcSVZmr0 EqcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o3si4648646edi.374.2019.11.14.05.39.45; Thu, 14 Nov 2019 05:39:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727020AbfKNNjo (ORCPT + 3 others); Thu, 14 Nov 2019 08:39:44 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:37860 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726912AbfKNNjo (ORCPT ); Thu, 14 Nov 2019 08:39:44 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 9EAA8BF41A44D8FE335A; Thu, 14 Nov 2019 21:39:42 +0800 (CST) Received: from lhrphicprd00229.huawei.com (10.123.41.22) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Thu, 14 Nov 2019 21:39:33 +0800 From: Jonathan Cameron To: , , , Borislav Petkov , "Mauro Carvalho Chehab" , CC: , , , , , Thanu Rangarajan , Jonathan Cameron Subject: [PATCH v5 0/6] CCIX Protocol error reporting. Date: Thu, 14 Nov 2019 21:39:13 +0800 Message-ID: <20191114133919.32290-1-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Originating-IP: [10.123.41.22] X-CFilter-Loop: Reflected Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Changes since V4: Reponses to Mauro's review. * Use explicitly sized buffers for functions using the rcd_decode_str global array. * Fix buffer overflow issue with not reducing the length as we move the start pointer in snprintf calls. * Tidy up some first snprintf calls to take advantage of known 0s. * Patch description cleanup to relect current state of the series. A few minor formatting fixups and comment clarifications of things noticed whilst making the above changes. Changes since V3: Added #if defined(CONFIG_ACPI_APEI_CCIX) build protection to the tracepoints to avoid using undefined functions. Reported-by: 0-day. Changes since V2: Dropped the legal boiler plate from the cover letter. The CCIX consortium have agreed that a simple tradmark statement is sufficient which I have put in the cper-ccix.c file and here. The CCIX® trademark and CCIX trade name are owned solely by CCIX CONSORTIUM, INC. and all rights are reserved therein. Changes since V1: Addressed comments from James Morse - Dropped kernel logging of vendor data. We just push it to the tracepoints. - Tidied up this cover letter and added information to address questions raised. Includes removing questions where James and I agreed ;) Note, this initial series attempts no 'handling' of errors. That will follow later. EFI 2.8 defines a new CPER record Appendix N for CCIX Protocol Error Records (PER). www.uefi.org These include Protocol Error Record logs which are defined in the CCIX 1.0 Base Specification www.ccixconsortium.com. A public evaluation version is now available. Handling of coherency protocol errors is complex and how Linux does this will take some time to evolve. For now, fatal errors are handled via the usual means and everything else is reported. There are 6 types of error defined, covering: * Memory errors * Cache errors * Address translation unit errors * CCIX port errors * CCIX link errors * Agent internal errors. These errors are concerned (mostly) wth things happening in the CCIX protocol layer. They are parallel to AER errors which should be only concerned with the PCIe layer (which is underneath CCIX). The ATS errors break this rule slightly. You may get an error occurring that results in problems at both layers of the protocol stack and hence have to handle AER and PER errors simultaneously. Some of these errors can 'almost' be mapped onto standard existing error types but only at the loss of information specific to CCIX such as where in the topology they occurred. The set includes tracepoints to report the errors to RAS Daemon and a patch set for RAS Daemon will follow shortly. Several design decisions that people may disagree with. 1. Reporting of vendor data. We have little choice but to do this via a dynamic array as these blocks can take arbitrary size. I had hoped no one would actually use these given the odd mismatch between a standard error structure and non standard element, but there are already designs out there that do use it. James suggested that it made sense to put these in the tracepoints, but we shouldn't spam the kernel log with them (done in V2). 2. The trade off between explicit tracepoint fields, on which we might want to filter in kernel, and the simplicity of a blob. I have gone for having the whole of the block specific to the PER error type in an opaque blob. The key elements that may be filtered on are the physical address and the source and component fields which allow you to identify faulty devices. Note that you have to know how the devices were enumerated to be able to do so. 3. Defined 6 new tracepoints rather than cramming everything into one. * They are all defined by the CCIX specification as independent error classes. * Many of them can only be generated by particular types of agent. * The handling required will vary widely depending on types. In the kernel some map cleanly onto existing handling. Keeping the whole flow separate will aide this. They vary by a similar amount in scope to the RAS errors found on an existing system which have independent tracepoints. * Separating them out allows for filtering on the tracepoints by elements that are not shared between them. * Muxing the lot into one record type can lead to ugly code both in kernel and in userspace. Rasdaemon patches posted. https://patchwork.kernel.org/cover/11116735/ Jonathan Cameron (6): efi / ras: CCIX Memory error reporting efi / ras: CCIX Cache error reporting efi / ras: CCIX Address Translation Cache error reporting efi / ras: CCIX Port error reporting efi / ras: CCIX Link error reporting efi / ras: CCIX Agent internal error reporting drivers/acpi/apei/Kconfig | 8 + drivers/acpi/apei/ghes.c | 59 ++ drivers/firmware/efi/Kconfig | 5 + drivers/firmware/efi/Makefile | 1 + drivers/firmware/efi/cper-ccix.c | 923 +++++++++++++++++++++++++++++++ drivers/firmware/efi/cper.c | 6 + include/linux/cper.h | 333 +++++++++++ include/ras/ras_event.h | 407 ++++++++++++++ 8 files changed, 1742 insertions(+) create mode 100644 drivers/firmware/efi/cper-ccix.c -- 2.20.1