From patchwork Wed Dec 6 22:42:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 174758 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4422496vqy; Wed, 6 Dec 2023 14:42:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFSCjxEjnOwSypMzHdZVxeTb1KXmwEL34xhGRXiDfzajPd+wsY5UjlSxr9rYSmE/fSUFK+ X-Received: by 2002:a05:6a21:99aa:b0:18f:97c:b9f1 with SMTP id ve42-20020a056a2199aa00b0018f097cb9f1mr1589000pzb.75.1701902576992; Wed, 06 Dec 2023 14:42:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701902576; cv=none; d=google.com; s=arc-20160816; b=SCsoB5v2anURm5hYF8J07opkq+OLRR+SKJMXOIs4z8C1ziGCrD90WtIYWns2th0jCD tZ8GKFrFP+B1PK84YJHs4WA3W+8O+/Z/YVvApw8g0sqA4htcN/wVQl1C5TOCPwxD4p2t 3ruWrwb6rpLBtnHfGla1W8RsdenYtzW9zkxWA+lT1Pr16i91o6SwflwvW6dL84BKJ0gS lbUwF2tnAzNs0kFWLwnqKrEfcnwDpBN9K5d+cbj++m0PxWt/8pzJuisrq/Pb/ftpoYC2 DB8nFySx7BAr8CgOmg4XwUjSjUvibbWowvNJLLbZGWdvLq9Cs7zuHb3nbKgFLBX0PDA6 fjGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lv2hhxeNts7fHvZDAXpcNUD3iQ20AHX8Ek3pTSk7Z3A=; fh=N5OmSpWPccR8ckj8Qkdo529mqM7WPU2gJpcsQRMo0yY=; b=qS9NVJHilTlTqD46KZQ9SX/qqNWqX63A82j6UrfYYJo+15QxUzQTH2fkPc+YQKvZEl FRGWVLLjbcrJFOktxqGqY3qDs+MAckA5lko6VZ5PpUdE6DijsbyMh3LCth27xXrePPZd iOW/aRigyA1BpmQD9zWe1WwFcLQdVM7q5p5ihSwkg7VdyhyxgKSLOX4Thezr4zOb5oIu 2MtPAnL4AHeu1UJVcK6iUrZnYY0EN+hrc0j0o8zF8VJeYa1XEaDdnuCkvN7E1yDD9QE2 YcSfb21bSxQYxd/i1KiOh+WC0EFTyYac0bxWxX6W5v+X877sx19PDd3GGHTSe2Jtjzsp nx0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Sr6tDrjV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id u15-20020a170903124f00b001d06e8a15desi486357plh.322.2023.12.06.14.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 14:42:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Sr6tDrjV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 5A14380278C3; Wed, 6 Dec 2023 14:42:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377716AbjLFWmi (ORCPT + 99 others); Wed, 6 Dec 2023 17:42:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377664AbjLFWmg (ORCPT ); Wed, 6 Dec 2023 17:42:36 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3A25D5B for ; Wed, 6 Dec 2023 14:42:42 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33D98C433C8; Wed, 6 Dec 2023 22:42:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701902562; bh=C/z2J4QPXebp5y/KZX3b+//X9l7x7jrXFPy9z32q6dI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sr6tDrjVNEGXBrIduHYruCE+26Os5jBYxrBIYnZAcYvDRtFDMObUCXJJLzMUiCw7N xChDFP4dnQByUNM2/9AyMINDb1Vomrc7EhfOeGD2bM4wqUrc+hhuYlwKunZE96eJkg G+g2dZ/la0NQ90ncYg3505KmeqhbhUQ/Si+BzUaflfPMPdSZO/raSwCsdtAVQ30vrl zRlsZmwaCZva4DJ9GndQ1gNnQm55/qaRW60CcvTD+BxbS/ZpmExY0DNPWSKO7cNl/6 86Z5jo9swQunULx2h2jUinrNNC1rLTrUPa3Vci2CxSo+rTAtgIUph4s/Y9dyPHI3SN wCN/Tr12lMFjQ== From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: Mahesh J Salgaonkar , Oliver O'Halloran , Robert Richter , Terry Bowman , Kai-Heng Feng , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 2/3] PCI/AER: Decode Requester ID when no error info found Date: Wed, 6 Dec 2023 16:42:30 -0600 Message-Id: <20231206224231.732765-3-helgaas@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231206224231.732765-1-helgaas@kernel.org> References: <20231206224231.732765-1-helgaas@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 06 Dec 2023 14:42:54 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784574196416906456 X-GMAIL-MSGID: 1784574196416906456 From: Bjorn Helgaas When a device with AER detects an error, it logs error information in its own AER Error Status registers. It may send an Error Message to the Root Port (RCEC in the case of an RCiEP), which logs the fact that an Error Message was received (Root Error Status) and the Requester ID of the message source (Error Source Identification). aer_print_port_info() prints the Requester ID from the Root Port Error Source in the usual Linux "bb:dd.f" format, but when find_source_device() finds no error details in the hierarchy below the Root Port, it printed the raw Requester ID without decoding it. Decode the Requester ID in the usual Linux format so it matches other messages. Sample message changes: - pcieport 0000:00:1c.5: AER: Correctable error received: 0000:00:1c.5 - pcieport 0000:00:1c.5: AER: can't find device of ID00e5 + pcieport 0000:00:1c.5: AER: Correctable error message received from 0000:00:1c.5 + pcieport 0000:00:1c.5: AER: found no error details for 0000:00:1c.5 Signed-off-by: Bjorn Helgaas Reviewed-by: Kuppuswamy Sathyanarayanan --- drivers/pci/pcie/aer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 20db80018b5d..2ff6bac9979f 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -740,7 +740,7 @@ static void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info) u8 bus = info->id >> 8; u8 devfn = info->id & 0xff; - pci_info(dev, "%s%s error received: %04x:%02x:%02x.%d\n", + pci_info(dev, "%s%s error message received from %04x:%02x:%02x.%d\n", info->multi_error_valid ? "Multiple " : "", aer_error_severity_string[info->severity], pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn), @@ -929,7 +929,12 @@ static bool find_source_device(struct pci_dev *parent, pci_walk_bus(parent->subordinate, find_device_iter, e_info); if (!e_info->error_dev_num) { - pci_info(parent, "can't find device of ID%04x\n", e_info->id); + u8 bus = e_info->id >> 8; + u8 devfn = e_info->id & 0xff; + + pci_info(parent, "found no error details for %04x:%02x:%02x.%d\n", + pci_domain_nr(parent->bus), bus, PCI_SLOT(devfn), + PCI_FUNC(devfn)); return false; } return true;