From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8B84C433DB for ; Wed, 10 Feb 2021 02:31:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8DE3864E4B for ; Wed, 10 Feb 2021 02:31:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235121AbhBJCbv (ORCPT ); Tue, 9 Feb 2021 21:31:51 -0500 Received: from mga17.intel.com ([192.55.52.151]:55654 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234773AbhBJCIT (ORCPT ); Tue, 9 Feb 2021 21:08:19 -0500 IronPort-SDR: cX3nKQXXP2jtkstCRz/RYYSAMY2ZxnjKreYAA5NaaiF0id1Axz15nXLG3ZYobDGsIohpjzk+vX LxmQ+aP8h9ag== X-IronPort-AV: E=McAfee;i="6000,8403,9890"; a="161748060" X-IronPort-AV: E=Sophos;i="5.81,166,1610438400"; d="scan'208";a="161748060" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2021 18:07:09 -0800 IronPort-SDR: ZIYRofkClCG24wq35CWWIL37qCS+WZ7fnXiO5uUlOMBxLH38CZ0OxTDLEznqHRg67Ik/8bn1kA tAertE8fxlag== X-IronPort-AV: E=Sophos;i="5.81,166,1610438400"; d="scan'208";a="379628247" Received: from qiuxu-lab.sh.intel.com ([10.239.53.1]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2021 18:07:06 -0800 From: Qiuxu Zhuo To: Bjorn Helgaas Cc: Qiuxu Zhuo , Sean V Kelley , "Luck, Tony" , "Jin, Wen" , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/1] PCI/RCEC: Fix failure to inject errors to some RCiEP devices Date: Wed, 10 Feb 2021 10:05:16 +0800 Message-Id: <20210210020516.95292-1-qiuxu.zhuo@intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On a Sapphire Rapids server, it failed to inject correctable errors to the RCiEP device e8:02.0 which was associated with the RCEC device e8:00.4. See the following error log before applying the patch: aer-inject -s e8:02.0 examples/correctable Error: Failed to write, No such device This was because rcec_assoc_rciep() mistakenly used "rciep->devfn" as device number to check whether the corresponding bit was set in the RCiEPBitmap of the RCEC. So that the RCiEP device e8:02.0 wasn't linked to the RCEC and resulted in the above error. Fix it by using PCI_SLOT() to convert rciep->devfn to device number. Ensure that the RCiEP devices associated with the RCEC are linked to the RCEC as the RCEC is enumerated. After applying the patch, correctable errors can be injected to the RCiEP successfully. Reported-and-tested-by: Wen Jin Signed-off-by: Qiuxu Zhuo --- drivers/pci/pcie/rcec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pcie/rcec.c b/drivers/pci/pcie/rcec.c index 2c5c552994e4..d0bcd141ac9c 100644 --- a/drivers/pci/pcie/rcec.c +++ b/drivers/pci/pcie/rcec.c @@ -32,7 +32,7 @@ static bool rcec_assoc_rciep(struct pci_dev *rcec, struct pci_dev *rciep) /* Same bus, so check bitmap */ for_each_set_bit(devn, &bitmap, 32) - if (devn == rciep->devfn) + if (devn == PCI_SLOT(rciep->devfn)) return true; return false; -- 2.17.1