Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp975491pxb; Tue, 9 Feb 2021 18:34:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWIOAB0qNk6Fev34LsbYBjDRMLNNEPqP20qL0mqwOdZpJWRRblxggXbwJlaHoCevXb43lc X-Received: by 2002:a05:6402:541:: with SMTP id i1mr1127419edx.36.1612924490751; Tue, 09 Feb 2021 18:34:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612924490; cv=none; d=google.com; s=arc-20160816; b=ZiAG23Q1mdoMeV6K3cR1MN3NaIaRaEcSK+syDxDcRqpGbRD3JxE38pGJzoK3Wi9izH 3wYBTmrjqadiyJQ7eFw9cChqc9hyvJBHTad76fEPei1Qd13RPbSk2a6xTorXUyj7hCFj ldq8NdkffdZRiJYc6VfYSbcqiIkwuFEBg5BCXq0Qglqkq/UqHYG3rkluFmTCAeR8au3T 0PObeqM6Cl+U+OFcDW7s4ehqeqJDiPIPa+SPCBYQS4jo8WCWoekeOUZ4SDH/GULour+o dIWFhThKcSisLZtiabWOhFKwtB8a0iWbMkHlu7/5ixZw+aBOjgTVBvoMteyoX76lwx7Q vMBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:ironport-sdr :ironport-sdr; bh=juMZMdTeuJHt0RL+6FzSBJu1jBo9roqBkQseeRgvON0=; b=B7k+URpqWoTapwUuzZRxybnhRbV5NggIGPgvKbKcmfZPm1aecQEiyx8eecTSuOsKXJ FQKSELukTKZWfdwdUZWNAABdXa4u0td7mkGwwYoNb4cZQ71jN3S+ZN8pPI/SvD0OYo6Y yq35BUlfoNiBCiQO7O81vZRr3S5zX58cCDuoZFxTdCOTf8OOvChxgAp4nz1j+6qrUFzP C/DDuRRzbCWwljBoWVeeiKcxqTPiVnz5zmGWpAQWphoGWRYJAwL29X6ApFRX0K8Q2thP SJQlyQdSqWUa0ELrKZ7IIgHkzwm7H9E3dEB29b/79emeEVqPZEg8QZx2Xfk8X+wvoNiA e7aA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m25si425559edp.216.2021.02.09.18.34.27; Tue, 09 Feb 2021 18:34:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234767AbhBJCbp (ORCPT + 99 others); Tue, 9 Feb 2021 21:31:45 -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