Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7702806pxb; Thu, 18 Feb 2021 18:26:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJx6dfbfl3ZMDiaucQ5FA1ova31CBFfyjl4u5RWgJkLcTT2lBkDGJ1ifLyk9hs72wVxdkCoH X-Received: by 2002:a17:906:30da:: with SMTP id b26mr6639209ejb.376.1613701589894; Thu, 18 Feb 2021 18:26:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613701589; cv=none; d=google.com; s=arc-20160816; b=izC0tNDw3s7uQum9LcL0rq5vTLZuC9lGL/Vqb8YAn1EP1js33M5XY9QuMbpXA/eziJ z9o1dRi7aI4ARODQ3YpBC+rBL4JmTXwbijw+U1REN8ccnRI2QAyFrLrN+jPHlIOZ0LQx Q5E1sR+VOM6McZMIND4ARxyTYdg6xV6bHiiQZLgkFNeRNWKdEZyIUTCo4XOiiYeUTs5g mkOiyMbC2/Nu0xUCevXflauwos9NjXckANA2efC1TVM9xTCFRbDM5ZdunxmGkanBwhR+ uORBbXEqGrJu76Bm+YukLYoasBWBTt3rlI3NK/Px9kV1nhJnjnTX8EK8Ux1mGygixdTg 5aSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=8H0QaUB8SUAhb9MDPUgerhZeDRjVXNHt7lGVqvRkWfo=; b=gtlGvLq9ASks9sOCXbZeGKR5VQYzmh1MuIdIB6MlZ+Y3FdhY9snnI3pr0a3iziUFrR jzcDTNfhef/rpZdbJhZfOJ2GK9B2lYoz86fV5PExsYuiivazlcWu0H3QQo/+EbN2diSi jggESMJOzFFz+baeflD512EnqClcJuFHv6Ju4SnYwhQr0L2+mEIsgxY3pzbpWGbpxH1B uzSO3QwBX+YnaHKZVQA0mBbijvRuF8uVxpOA78JY1a912kfbeDdAdd4TXkXYrTPg8a+d qPjbGbjMWPnGWXTqqS3mxy8i0FkbZqUyhzFcbhe55zvVMe6DeuRuF4dPuszk4OgiUT74 K+hA== 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 f19si4678980eds.525.2021.02.18.18.26.06; Thu, 18 Feb 2021 18:26:29 -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 S229620AbhBSCZX (ORCPT + 99 others); Thu, 18 Feb 2021 21:25:23 -0500 Received: from mga17.intel.com ([192.55.52.151]:59705 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbhBSCZX (ORCPT ); Thu, 18 Feb 2021 21:25:23 -0500 IronPort-SDR: SdkfUqqtNLkhT8HhhHceBHIRPjCcPt/J90dRISrW6P8v59V79153pAWX83RDL5VHCquX7ya4P8 lS2Iyc2R0zWQ== X-IronPort-AV: E=McAfee;i="6000,8403,9899"; a="163496464" X-IronPort-AV: E=Sophos;i="5.81,187,1610438400"; d="scan'208";a="163496464" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2021 18:24:42 -0800 IronPort-SDR: wridYpnCfqyWboBlmTMXUpYK/L+B6bq2R9zDkep7T1n9mtxU6ktvQ5/3xBnRyOXQLBbQhtrI7f bPrSmqKF1VbQ== X-IronPort-AV: E=Sophos;i="5.81,187,1610438400"; d="scan'208";a="400797364" Received: from qiuxu-lab.sh.intel.com ([10.239.53.1]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2021 18:24:40 -0800 From: Qiuxu Zhuo To: Bjorn Helgaas Cc: Qiuxu Zhuo , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Sean V Kelley , "Luck, Tony" , "Jin, Wen" , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/1] PCI/RCEC: Fix RCiEP capable devices RCEC association Date: Fri, 19 Feb 2021 10:23:59 +0800 Message-Id: <20210219022359.435-1-qiuxu.zhuo@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <57a7bbc1ba294ce39c309e519fe45842@intel.com> References: <57a7bbc1ba294ce39c309e519fe45842@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Function rcec_assoc_rciep() incorrectly used "rciep->devfn" (a single byte encoding the device and function number) as the device number to check whether the corresponding bit was set in the RCiEPBitmap of the RCEC (Root Complex Event Collector) while enumerating over each bit of the RCiEPBitmap. As per the PCI Express Base Specification, Revision 5.0, Version 1.0, Section 7.9.10.2, "Association Bitmap for RCiEPs", p. 935, only needs to use a device number to check whether the corresponding bit was set in the RCiEPBitmap. Fix rcec_assoc_rciep() using the PCI_SLOT() macro and convert the value of "rciep->devfn" to a device number to ensure that the RCiEP devices associated with the RCEC are linked when the RCEC is enumerated. [ Krzysztof: Update commit message. ] Fixes: 507b460f8144 ("PCI/ERR: Add pcie_link_rcec() to associate RCiEPs") Reported-and-tested-by: Wen Jin Reviewed-by: Sean V Kelley Signed-off-by: Qiuxu Zhuo --- v1->v2: - Update the subject and the commit message. - Add 'Reviewed-by: Sean V Kelley ' to the SoB chain. 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