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

[PATCH 4/4] AMD/IOMMU: consider hidden devices when flushing device I/O TLBs


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 15 Sep 2021 11:13:49 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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; bh=TPv3uK8bqSIgwLCsg7oLnpJv0fedDK5iubeaeJBmDWs=; b=O3qt+/t6uVIQEydyIxxfTrz6Cc3rbvFgfDVJTbiFGxL1eKfkgsqy5bX+smjlsq4fUunGKtSoFG5M24yqZOoRPtYknB8ZJ4C6VyHza2tUcq1hVQcrrEsmT21G3ukj2VafqDIpSMVF/G3yOCPBgLDt8MNW+OnSF4QeMTgGLQZmGct8f57kyC/RW5hRdMUgx84TGnE2KNaqOjp+iIOsGGM3h3Clen0MMuHRjGL77+qFInmuScXEfKpiXqPvePA0G8DupMzqK38GASZSDUelItBwOihUZ22lZ1j70xUHrbfQ1gPSpupI7fCG3Gsvycv2DX1k8AZlE6uZ+MZoKEY+PRfdhA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bCG3KgvFWoKRGLk0vzMIsx6uAGdCo0wHOGocck3QvFHmCkhNtZ7zCYwaXl2K6J8Jw06UrtvJF0tYoAEmv7vsvy5JgUERf/2+h7hKRbXX7b05fXqSnMV+vopRi6YTADfBbKZ7haX1YMPywPLNOgXOPeJKcrr5qgHmc1ZhCqjZATXQwh2J7GNuaX8+V39w+qVNRynAA0XWePZXpZLB10lX4z79wcwlLjKQmlYoOS/founwdUk39HG4rYqbPLIfaoXV/bPtKRcZrrhas53iFtx3ZWYlKQ6yI1ZdMYdUUxMLWpmZ8FyQbP4o5AyejB0m9uc7dIIAkMJ+h3CyRXHcUlUPOg==
  • Authentication-results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com;
  • Cc: Paul Durrant <paul@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Wed, 15 Sep 2021 09:13:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hidden devices are associated with DomXEN but usable by the
hardware domain. Hence they need flushing as well when all devices are
to have flushes invoked.

While there drop a redundant ATS-enabled check and constify the first
parameter of the involved function.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/drivers/passthrough/amd/iommu_cmd.c
+++ b/xen/drivers/passthrough/amd/iommu_cmd.c
@@ -308,14 +308,11 @@ void amd_iommu_flush_iotlb(u8 devfn, con
     flush_command_buffer(iommu, iommu_dev_iotlb_timeout);
 }
 
-static void amd_iommu_flush_all_iotlbs(struct domain *d, daddr_t daddr,
+static void amd_iommu_flush_all_iotlbs(const struct domain *d, daddr_t daddr,
                                        unsigned int order)
 {
     struct pci_dev *pdev;
 
-    if ( !ats_enabled )
-        return;
-
     for_each_pdev( d, pdev )
     {
         u8 devfn = pdev->devfn;
@@ -343,7 +340,16 @@ static void _amd_iommu_flush_pages(struc
     }
 
     if ( ats_enabled )
+    {
         amd_iommu_flush_all_iotlbs(d, daddr, order);
+
+        /*
+         * Hidden devices are associated with DomXEN but usable by the
+         * hardware domain. Hence they need dealing with here as well.
+         */
+        if ( is_hardware_domain(d) )
+            amd_iommu_flush_all_iotlbs(dom_xen, daddr, order);
+    }
 }
 
 void amd_iommu_flush_all_pages(struct domain *d)




 


Rackspace

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