From patchwork Mon Apr 30 19:52:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 10372531 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5BDE96053E for ; Mon, 30 Apr 2018 19:52:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BAB72873C for ; Mon, 30 Apr 2018 19:52:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EEBB2878C; Mon, 30 Apr 2018 19:52:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEC0A2873C for ; Mon, 30 Apr 2018 19:52:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755330AbeD3Twf (ORCPT ); Mon, 30 Apr 2018 15:52:35 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:41814 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932246AbeD3Twd (ORCPT ); Mon, 30 Apr 2018 15:52:33 -0400 Received: by mail-oi0-f65.google.com with SMTP id 11-v6so8452242ois.8; Mon, 30 Apr 2018 12:52:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZqdagjNc4E7EH/WGEFB37DMpL5NHHCpi5AJL7EnYbuk=; b=R7U7hd5RqzhnYjttPxD4Yx/2D0Fp5QUfTvXZLVFutRaSy97x/mBpYl9+vF0LjZKocp dCSQECV1MjdZCi/BYElk0P6b0aKKXzzSYs5BY+lnfHDjhQJztozuJSawd+0d5eM/yZZg sSssdLldY5k35OP0aHKflUoI0NN3CzD7HThGuqdhqdLvQXS7NH2RkM9PWX1BS6Ky/glP o1sEyEonvVmQaOLfM3CrT6WmpxUDL/uCURCqOedCFHpuBPz8Z3+vz/dOf+eHH49jLsmn M2FlM9Z9Mjsv60AfskV0FBQSAOyMxb5hnAlsXGhOrUxyH8Qt538UpiIc1Uy60s0qaNIE jzjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZqdagjNc4E7EH/WGEFB37DMpL5NHHCpi5AJL7EnYbuk=; b=GTyvJ9sMqUIynJ53I4jIfhnHD3LKMqVsLZbFdyIWz9FrjB0XZPk9Pkl6EhTuxQ0VYq 2XPKdGk28ZS+jNdkokcBJOwoIpeiIDh3bMhDOIsPBBcNucYafGsZmSJ8ycm6d1QaCAhF BKYsS38tPBd83XEUxgpT93G61wEVnHymRU7I3ugbDsr4Waio3lQ860QGYQUg0vDorlGJ N736BcLLhlTTMnupyokVMBs7o0HpRCTRk3d4CRJygy/R+XGGgGYWG5Ntde6NgCRzC12d VS/E+E+I41SG1+CKuiMGDGHHt8vr1XMlxhMpyiUMLFsv9DFHGtkzw/1sRApEQ8gA35n1 dTcw== X-Gm-Message-State: ALQs6tCL+Y3ZTG7k7LSJjaPSchoiS5NkXApnegn839nZ9UsyCpbedgNP iR7NEsxlV9kdW6m1+n6chpc= X-Google-Smtp-Source: AB8JxZqDHWMubI+9yUGRYtg1mBQ2ubns4mf/IHjUvVUaFe80BV3IM/lsMdqBoIcr9StM3W7QULGypg== X-Received: by 2002:aca:5086:: with SMTP id e128-v6mr8656130oib.315.1525117952656; Mon, 30 Apr 2018 12:52:32 -0700 (PDT) Received: from nuclearis2_1.lan (c-98-197-2-30.hsd1.tx.comcast.net. [98.197.2.30]) by smtp.gmail.com with ESMTPSA id t37-v6sm5453183otf.26.2018.04.30.12.52.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Apr 2018 12:52:31 -0700 (PDT) From: Alexandru Gagniuc To: bhelgaas@google.com Cc: alex_gagniuc@dellteam.com, austin_bolen@dell.com, shyam_iyer@dell.com, Alexandru Gagniuc , Frederick Lawler , Greg Kroah-Hartman , linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2] PCI/AER: Use a common function to print AER error bits Date: Mon, 30 Apr 2018 14:52:15 -0500 Message-Id: <20180430195218.27654-1-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180417170943.1767-1-mr.nuke.me@gmail.com> References: <20180417170943.1767-1-mr.nuke.me@gmail.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On errors reported from CPER, cper_print_bits() was used to log the AER bits. This resulted in hard-to-understand messages, without a prefix. Instead use __aer_print_error() for both native AER and CPER to provide a more consistent log format. Signed-off-by: Alexandru Gagniuc --- Changes since v1: - Parse aer regs for first error pointer instead of disabling it On the Dell machine where I tested this, the first error pointer is reported correctly by firmware. drivers/pci/pcie/aer/aerdrv_errprint.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c index cfc89dd57831..b5612cc51b63 100644 --- a/drivers/pci/pcie/aer/aerdrv_errprint.c +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c @@ -216,28 +216,30 @@ EXPORT_SYMBOL_GPL(cper_severity_to_aer); void cper_print_aer(struct pci_dev *dev, int aer_severity, struct aer_capability_regs *aer) { - int layer, agent, status_strs_size, tlp_header_valid = 0; + int layer, agent, tlp_header_valid = 0; u32 status, mask; - const char **status_strs; + struct aer_err_info info; if (aer_severity == AER_CORRECTABLE) { status = aer->cor_status; mask = aer->cor_mask; - status_strs = aer_correctable_error_string; - status_strs_size = ARRAY_SIZE(aer_correctable_error_string); } else { status = aer->uncor_status; mask = aer->uncor_mask; - status_strs = aer_uncorrectable_error_string; - status_strs_size = ARRAY_SIZE(aer_uncorrectable_error_string); tlp_header_valid = status & AER_LOG_TLP_MASKS; } layer = AER_GET_LAYER_ERROR(aer_severity, status); agent = AER_GET_AGENT(aer_severity, status); + memset(&info, 0, sizeof(info)); + info.severity = aer_severity; + info.status = status; + info.mask = mask; + info.first_error = PCI_ERR_CAP_FEP(aer->cap_control); + pci_err(dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n", status, mask); - cper_print_bits("", status, status_strs, status_strs_size); + __aer_print_error(dev, &info); pci_err(dev, "aer_layer=%s, aer_agent=%s\n", aer_error_layer[layer], aer_agent_string[agent]);