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

[RFC PATCH v2 6/8] pci/arm: don't do iommu call for phantom functions


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Thu, 11 May 2023 15:16:52 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=GjAtPrq7Zr2LNV7JB6qbwRaGGVcDQHrRJHlX0JDBPbY=; b=mcP4s4F3g55OB3UvRSMRgfTjj1CuPGatFt3t5L5B2hSsR9cFyPoQmHp54Ngma4t3MzY1Vxt3pw9xHyhce0AVjsSNioEurVg2QoyD424VeMyRvPyb//wvaLnDWACn32HaT3/udMeFYhBYvIUgid/d470IOmFMpW9ZuN7yf2k1AGJAedL0OSa0bs6pcI1EjnPeImFHgBrchpA/XU7rK4itP3i4Y9S0A94WmPWTYr4tEqRVZuwaPMa9ia4TGp7O9Ykrwu6b7rTJIw++KJA8fLsUEjgV8x+ZGL5dKjve2WqEnSrzWlBLHH9BVHcM8PgKRjKy8KGr5shCRnkPg9zOJKb8uw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZQAw7w0st9xKb6p8aeneQt9eobiV7QsJIVBkAMup4rxrPMIehdZSrz4jKmTkHHuMw7nRfACVKXjwC7BAz4Gd3MbiI/phHO+K7tw0tbWE9h9WP7mPxpzKzmnVT0ZeTLkg8Dk1gEiqwaWw8rfv1ccgdqMZn2LcX0F/3ZM/fzZrLna5ZfbeWuiCsglANvkBTXeIdWSJCM6mEFL9eB189hwxY21+MjQZEWjqo0/C7WhKjHUGWIZzkf9C3lpqn82IIKZrpf6paQzSbPUiEgnTjC5t7HR1NYrdsjNSRXKiwkJgIQK2LMhpwAePKG1oQcc2vTMl2fBgP//mEiGgM7e7h6KFoA==
  • Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 11 May 2023 19:21:21 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

It's not necessary to add/remove/assign/deassign pci phantom functions
for the ARM SMMU drivers. All associated AXI stream IDs are added during
the iommu call for the base PCI device/function.

However, the ARM SMMU drivers can cope with the extra/unnecessary calls just
fine, so this patch is RFC as it's not strictly required.

Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
---
I'm aware the indentation is wrong. I just wanted to keep the diffstat small
while this particular patch is RFC.

v1->v2:
* new patch
---
 xen/drivers/passthrough/pci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 6dbaae682773..3823edf096eb 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -871,6 +871,7 @@ static int deassign_device(struct domain *d, uint16_t seg, 
uint8_t bus,
     else
         target = hardware_domain;
 
+    if ( !IS_ENABLED(CONFIG_HAS_DEVICE_TREE) )
     while ( pdev->phantom_stride )
     {
         devfn += pdev->phantom_stride;
@@ -1335,7 +1336,7 @@ static int iommu_add_device(struct pci_dev *pdev)
         return 0;
 
     rc = iommu_call(hd->platform_ops, add_device, devfn, pci_to_dev(pdev));
-    if ( rc || !pdev->phantom_stride )
+    if ( rc || !pdev->phantom_stride || IS_ENABLED(CONFIG_HAS_DEVICE_TREE) )
         return rc;
 
     for ( ; ; )
@@ -1379,6 +1380,7 @@ static int iommu_remove_device(struct pci_dev *pdev)
     if ( !is_iommu_enabled(pdev->domain) )
         return 0;
 
+    if ( !IS_ENABLED(CONFIG_HAS_DEVICE_TREE) )
     for ( devfn = pdev->devfn ; pdev->phantom_stride; )
     {
         int rc;
@@ -1464,6 +1466,7 @@ static int assign_device(struct domain *d, u16 seg, u8 
bus, u8 devfn, u32 flag)
                           pci_to_dev(pdev), flag)) )
         goto done;
 
+    if ( !IS_ENABLED(CONFIG_HAS_DEVICE_TREE) )
     for ( ; pdev->phantom_stride; rc = 0 )
     {
         devfn += pdev->phantom_stride;
-- 
2.40.1




 


Rackspace

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