[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] pci: fix pci_get_pdev() to always account for the segment


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Thu, 18 May 2023 12:57:38 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9Z2b5omfJztJFPLzPsbCzsdAso5yPlwMiZXcEZ1CNcM=; b=NLp3DzxW6+BM+rQRLdqMeVwCvlIk6BKMwA6sZopC8SpLW/m7ECcMJq9gJelqs/EYnfe9eQYmbwezfV6v7TncEKGqvTyWGn1GYbEPOuOpMPm+2em9fgV+4Cg8F0hA5L20mfc5v5LGXYwWvJOwACXPZoXAl77YT2/3rpnIaqRElVYc3Xj2gWziwkm+iURK2yYqIzuuSzoCBCWm/obcwUz91VgI26N66ZycM6Go/9C3os/nyWN9/CgCoy/Vp+5sLGb8yp5mABo3fWG6iSQptPpaoWS20Fo2MjQN2MeqqrVO0w4zxaz0miFIazsNKNZalK4fpQBuOFlod5cgzaR8+YpS1Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UFeESLyG2xHmsQSif/RAtG5zgpFpmir2qRF+YY5jJhEC+Qw+BXqoYPlRn/110n2uCQY2UswMaDdvI2yz4LzuLmJQF3i/hUkr0jps20giWGShLPvCObOFC+xcuHihUNHh49A6ZsFIbxZY3NlnLN/2Qt4N3VzgzF+u9dnvM/iRKtkjQeMb7EmLufs7vPrIbTkv1OVoDmMK8s2ZdGc/vTIct53j6aPGRUkgjLwkGvS+KCSqL7/tRY5xwVE4GfX+i3yTcyJpev9cW2rgahuMnYeVuJvdNUctJ1OLzn/DAlK+wrT+93412+f4ds0vfuUwEUImnrI8O+MseiHyypXjCYn35A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Thu, 18 May 2023 10:58:23 +0000
  • Ironport-data: A9a23:kT5up6JUbJK1qGgYFE+R8ZQlxSXFcZb7ZxGr2PjKsXjdYENS1jdUx zEZXD3XPPbZNmv0KYx3boXk9ExTvcOGx9VnGwFlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAgk/rOHvykU7Ss1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpJrfPSwP9TlK6q4mhA4wVuPaojUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c5SHTl20 6VCLAlXSSKl2uS98LOmbeJV05FLwMnDZOvzu1lG5BSAVbMKZM6GRK/Ho9hFwD03m8ZCW+7EY NYUYiZuaxKGZABTPlAQC9Q1m+LAanvXKmUE7g7K4/dnpTGLkmSd05C0WDbRUsaNSshP2F6Ru 0rN/njjAwFcP9uaodaA2iv1376RwXOiCOr+EpXg3LlwrXiNmFAwNycREgOC4si20VKhDoc3x 0s8v3BGQbIJ3FymSJzxUgO1pFaAvwUAQJxAHusi8gaPx6HIpQGDCQAsTDRMddgnv88eXiEx2 xmCmNaBLSRmrbm9WX+bsLCOoluP1TM9KGYDYWoISFUD6ty6+IUr1EuXEJBkDbK/icDzFXfo2 TeWoSMihrIVy8kWy6G8+lOBiDWpznTUcjMICszsdjrNxmtEiESNPuRENXCzAS58Ebuk
  • Ironport-hdrordr: A9a23:19f0m64C2qo397cRugPXwN/XdLJyesId70hD6qkRc3xom6Oj/f xG8M536faWslcssRMb9uxoUZPoKRjhHPVOj7X5U43PYCDW/EWBaLx45Yz5yzf8Gyv4/us179 YCT5RD
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

When a domain parameter is provided to pci_get_pdev() the search
function would match against the bdf, without taking the segment into
account.

Fix this and also account for the passed segment.

Fixes: 8cf6e0738906 ('PCI: simplify (and thus correct) 
pci_get_pdev{,_by_domain}()')
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
There's no mention in 8cf6e0738906 that avoiding the segment check is
fine, and hence I assume it's an oversight, as it should be possible
to have devices from multiple segments assigned to the same domain.
---
 xen/drivers/passthrough/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index b42acb8d7c09..07d1986d330a 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -552,7 +552,7 @@ struct pci_dev *pci_get_pdev(const struct domain *d, 
pci_sbdf_t sbdf)
     }
     else
         list_for_each_entry ( pdev, &d->pdev_list, domain_list )
-            if ( pdev->sbdf.bdf == sbdf.bdf )
+            if ( pdev->sbdf.sbdf == sbdf.sbdf )
                 return pdev;
 
     return NULL;
-- 
2.40.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.