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

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


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 17 Sep 2021 13:00:55 +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=JSbiT1d6FmCTnu1o+VNb0Zlx8dUtna4t4MbB1lCzCHBlwI6FQUAmIFPK85EIv8XL/onRm14aqpM/pd/fZifjRP82zIxs+pAfOOY/7zNXaio2+3hxMpJgQ5o7DLTaMhiBBtLZEbM+FPRmGlG2BE5h/0WTlimZp/scntxyab1RlLEboo/9JD+KXHk598ex7MT3WAEcHfWaWakgqVMapj5A+19J8Kcve5DhM7O2Lp0fDuqBWHLJ6trj023GHfgjNyQD1qfyTBaETyrpDz39wBhQTV9RvjPFBornYgEYWkjgeERdDXyfQVTl4+VPB/lDfVSmMs4KwVWTdHK3MyLZnj04YQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fUvvTFdXKYnQSW4Na6p4WYAg6rkEuje5wR8MNiExTSXDxdWPr8r6W/d+gk8D+wk8m34o2hS1m7aMcUrGlGLMdwhBnDqM2VpYDIIfSNMFJh/a8hrizPWQlNlykTMd6h7NGrry6hntOst1rYsPmrq0MZDXh/Ai9aW3XpD5QBP/j1V4uvHVdG11Dco9NGhLuL11xBlT1yO25/UHpWslUlpqb4dAH3lWO7P8EnRvjZyf+UKibpQR2cDU62avo5bczCg4JkjZDjJ89tcZ3azPTgFVLpVreQivUvGEYw7G69j6pu9CXhSj+FNdMf+vHkXvyTu3mfdOCUFvcmAl+m8pPa8O7w==
  • 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: Fri, 17 Sep 2021 11:01:03 +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®.