Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3026058pxj; Mon, 17 May 2021 15:54:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSkt22VNv803jYWRmoLjbCfuDjWvY9NXUJ3xwDXIvbG78jSGAfnsPN/8ivnjZwiTaY0MPy X-Received: by 2002:a6b:cd08:: with SMTP id d8mr1941015iog.86.1621292098635; Mon, 17 May 2021 15:54:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621292098; cv=none; d=google.com; s=arc-20160816; b=aYY2Rl+frdyNMub0AN+KRXUnWKfQhZ6w5I863hm3lfAwXCnn0LiWQa5oLnejqnR3nD xdA8h4l2eCKbiJ3GNnXDqAE9IYWVa0osu7qc9CGSayQxnn6srKhW6u0ea4X6CGMJ8z1D /od04SzxgxbpaI+LQ+tJPZZ0FTyJTQcs4d3Cwtm4LiFWThq58zGtKr8oJKAlMG10nIRV okzYz34vViPG9zKZE1rU706sSmls4xg2W+JMRRWfPVAKj4H+9gSDCHHx9UTZeQT/u4Gz aeJ5s1Zmm9amXQkiudSNpuC9D+8LviMxETiolx+Y6kmNwoLvSfBiTh+H4OJjcjY2RX0j QX7g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CVsvpUkRWU681C8j9z3n7SaDkVUFUACqtaik39PYzX4=; b=h2sAl59wXOzftqIoBXt9xWL97AfjTXKK7KJfnAF4xvd2B7clooeIXZIaDwX97U+d+5 5hMXg3FPKiLoUtHJOp97/a5sKprNzysyG0x9c9pNkvSR1Ceaz6VgLjuT7OW3HwVzeAci sUNfarDHgKTr2q6NrYjbDzqZb/M+PiIRTzbEqoORqZlTS/zwHarlrh6IWS1EpwZVLirP un9SbmkiYc1DuZZk5ZTOiRuSIgf0aHIdBUi7t62WWdzQmANGZbIAnKfgHk8zhSHlleod ECxi1p55h4CvCEJsP3B7mMklSncpARO5Xjqe9f1u8fYwC7iSUA/cMykQ0zy6rB829KBm E7Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MfPfCUM9; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v19si1211062jan.91.2021.05.17.15.54.23; Mon, 17 May 2021 15:54:58 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=MfPfCUM9; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238453AbhEQORp (ORCPT + 99 others); Mon, 17 May 2021 10:17:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:46510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239021AbhEQOOo (ORCPT ); Mon, 17 May 2021 10:14:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6ECE2613E4; Mon, 17 May 2021 14:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260539; bh=KL1Fhf4Z+trvpS3bikucTfq08Btw5xHT9eFlDcIK0BQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MfPfCUM99ygAAgQtuBDx41LMud8NUF4S4C9ArXMIf2ijfPC/iGm5DpKuumRrPXtAu qJlABQ81/TD5LWDiXzWH2IXh2Ppc4PtGdXz+abJ0NR8nxUGrhlX1dCnTND1ycwriZR xx9L5cWZbd/vh5M302GCQhDGL+QIpM2IKjotetqM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qiuxu Zhuo , Bjorn Helgaas , Sean V Kelley , Sasha Levin , Wen Jin Subject: [PATCH 5.12 127/363] PCI/RCEC: Fix RCiEP device to RCEC association Date: Mon, 17 May 2021 15:59:53 +0200 Message-Id: <20210517140306.913369740@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qiuxu Zhuo [ Upstream commit d9b7eae8e3424c3480fe9f40ebafbb0c96426e4c ] rcec_assoc_rciep() used "rciep->devfn" (a single byte encoding both the device and function number) as the device number to check whether the corresponding bit was set in the RCEC's Association Bitmap for RCiEPs. But per PCIe r5.0, sec 7.9.10.2, "Association Bitmap for RCiEPs", the 32-bit bitmap contains one bit per device. That bit applies to all functions of the device. Fix rcec_assoc_rciep() to convert the value of "rciep->devfn" to a device number to ensure that RCiEP devices are correctly associated with the RCEC. Reported-and-tested-by: Wen Jin Fixes: 507b460f8144 ("PCI/ERR: Add pcie_link_rcec() to associate RCiEPs") Link: https://lore.kernel.org/r/20210222011717.43266-1-qiuxu.zhuo@intel.com Signed-off-by: Qiuxu Zhuo Signed-off-by: Bjorn Helgaas Reviewed-by: Sean V Kelley Signed-off-by: Sasha Levin --- 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.30.2