Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp640262pxf; Wed, 10 Mar 2021 14:02:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJxF1koIfCCzBj5888BiugkKqYesP3PNqRevThNJzdSpWgcNgHoXp1wqm3l9grdT1qV4rXEo X-Received: by 2002:a17:906:558:: with SMTP id k24mr19816eja.387.1615413721109; Wed, 10 Mar 2021 14:02:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615413721; cv=none; d=google.com; s=arc-20160816; b=Ds2OjEJBc1Cir9AZ507qmSmVbFCTqNwc5dU4LBgO2J9lyz5falw7/iOGRw2xRBgTJM GLqdwymjycLwivKeRLYFp36gsviiJDf4jrPwOzZy3KM02qncCEcsJtNkTrqjvZUCvjDb V9SClGVXOF9uFfrgzL6X2f41B3ZYQkNoFqmcAeHlH3QIiAWgnkSrLB9CHvE6w+2Q3Dbf qRk6ugjAukMuQ87lLZFyCkdBxM52GmMf9HWynSmt2GKPRm5wGtAsxz6dhp9J9K4tsZ9h T6Dr7QqArfkK6aHA63lkRobxloIfEJZqAFsFTZwnd/SzoZMSq3ADhZ3xGFYc+cWNFUDS xsyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=yEmJXWGQ85DVVumirufSh1Nc9toQZ/fbP3jEEvB6eFk=; b=HT7acct29CSafmwlnFo5l/8xv/E8Q3q1gR6WXOJf54uz/6EQTeDdbiVRxkaC1BIVaH RY5HbVVJWL+4WteItfhFXgFyk+FZ33ae8NASHaT5NtYvFtZnH1R4Pu8bnKShVJPqGHq4 mD+r7jFKKebL4MBFL7ugEne3DO7rf9B6qkPz2jA162vbosiUfkTcciizSyBWWDvj51bG abnt0OnnVp9RfCIiaSRZGIVnfYS6BzjBDDGLIyEGZGoQ6f4BJ87yAEuKLdLuVUD/RJFC 9JDCZH/ejl3Wd1OrbX+86rPM24i8zgJ1oKEtxNG7o0kMon1g5M3WnkjeiyridSvbYsG8 VJYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Lqsk+FRi; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o9si449739edw.190.2021.03.10.14.01.38; Wed, 10 Mar 2021 14:02:01 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Lqsk+FRi; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233308AbhCJWAi (ORCPT + 99 others); Wed, 10 Mar 2021 17:00:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:46286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231759AbhCJWAc (ORCPT ); Wed, 10 Mar 2021 17:00:32 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7296B64EF6; Wed, 10 Mar 2021 22:00:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615413631; bh=ReSp2zP54RJS1AahxWZa0ePgAMVlaJXyfLVs8JQqAT4=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Lqsk+FRi+f/exKF4sZcYF4/Z31p02Sh8HKyOz/RA7OezaDfWe4iJZqIiGtGOtYQH2 qS9V+ceFH0war3SM2erKFzXrT2D/heVQYgCiBIjnn51Mr6idLVSyHpC5X1UHDCD5oW 2jXtCMyUIjLk2MM5Gb5yuJ04dkoF4jTwt3yfxq6/EViW9O0KpBt2ftOAQkA3XUVu6l co1b35paBosdrQkZYh3uQ8qn5CQF0Ps0XOvDy5tliHBJ+/nFnxuoUpGys1GhykHcSV 2C87kq9nBLzlcPy84T6HgMrVZCRrbJJNK54Z7wIUJ+XfYvOo6IpSiyiPy2gR5reWvs pAfxPRTeU2wLg== Date: Wed, 10 Mar 2021 16:00:30 -0600 From: Bjorn Helgaas To: Qiuxu Zhuo Cc: Bjorn Helgaas , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Sean V Kelley , "Luck, Tony" , "Jin, Wen" , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/1] PCI/RCEC: Fix RCiEP capable devices RCEC association Message-ID: <20210310220030.GA2068330@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210222011717.43266-1-qiuxu.zhuo@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 22, 2021 at 09:17:17AM +0800, Qiuxu Zhuo wrote: > 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. > > 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 I think 507b460f8144 appeared in v5.11, so not something we broke in v5.12. Applied to pci/error for v5.13, thanks! If I understand correctly, we previously only got this right in one case: 0 == PCI_SLOT(00.0) # correct 1 == PCI_SLOT(00.1) # incorrect 2 == PCI_SLOT(00.2) # incorrect ... 8 == PCI_SLOT(01.0) # incorrect 9 == PCI_SLOT(01.1) # incorrect ... 31 == PCI_SLOT(03.7) # incorrect > --- > v2->v3: > Drop "[ Krzysztof: Update commit message. ]" from the commit message > > 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 >