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

[PATCH v7 5/8] AMD/IOMMU: also insert IVMD ranges into Dom0's page tables


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 26 Aug 2021 09:24:54 +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:X-MS-Exchange-SenderADCheck; bh=C5jmK8F3zx3Iim9ZNfcc8Wx+aPZ2lWaNnZCYDGjUo2o=; b=B8S1xP5A6SsVOGPM4OSuBzZ3sDCek5awFmxxe8CzwOCI0qWkfTbCk6HhnAAi8SQF4PuG+hLa7ZrevbT+b1B2b5hiC7q7Octb1IVEqhNd5ELUOjdMWSYwJ4XfKFROpqc+kBL4hYQPnHPVmLGIhAwxcl46GnERND4qbqRRdZpY6Ic9wohOdEFvXZkjdkZVvWAtJYXsKH5pzAVzmTCMCFUHFbctHUrYn4ue1yoZoOsPT2yscRvrBV1lUfggneLls4iHlas+juyr6dBkMMnzEl04h2M3uj29GvIPdbBjaMGsYYS+wgQHpBWLKCHmKmIN8Y7vogdCpMubs+otAc49l5V3LA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mVEkcYOkL56l2cEpsgh+1wkaUi72wLpxpYWQYmYj2t5f47M4dqhxN031T6JmE35083o3gXjEp96LKmO1CLf05RGzdM5Phz6B88xYlE3ORAsJidSLzbfWLNhf+byduM7zN3AToOG6WUhJXrOV6BVmwN/Bq+Jxw3RlNmtblnuCkfvCRMfGbRSjhKXI5DgErEM+/lFUG+324AgkSmVErBmgTI4JeuiHhEPkmMyUbGwtdrA4R+LnkYcicSvpmgLajnLDjBSyOQG1nAsqKkh82YG3dRzJnLN/t2q/X8Rzaa6VtXwwJqp4hEtBVUWVgtH5r1Bzh7bCRXWcPvm7M+Z40MkCHg==
  • Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Thu, 26 Aug 2021 07:25:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

So far only one region would be taken care of, if it can be placed in
the exclusion range registers of the IOMMU. Take care of further ranges
as well. Seeing that we've been doing fine without this, make both
insertion and removal best effort only.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Paul Durrant <paul@xxxxxxx>
---
v5: New.

--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -522,6 +522,14 @@ static int amd_iommu_add_device(u8 devfn
         amd_iommu_flush_device(iommu, bdf);
     }
 
+    if ( amd_iommu_reserve_domain_unity_map(
+             pdev->domain,
+             ivrs_mappings[ivrs_mappings[bdf].dte_requestor_id].unity_map,
+             0) )
+        AMD_IOMMU_DEBUG("%pd: unity mapping failed for %04x:%02x:%02x.%u\n",
+                        pdev->domain, pdev->seg, pdev->bus, PCI_SLOT(devfn),
+                        PCI_FUNC(devfn));
+
     return amd_iommu_setup_domain_device(pdev->domain, iommu, devfn, pdev);
 }
 
@@ -547,6 +555,14 @@ static int amd_iommu_remove_device(u8 de
 
     ivrs_mappings = get_ivrs_mappings(pdev->seg);
     bdf = PCI_BDF2(pdev->bus, devfn);
+
+    if ( amd_iommu_reserve_domain_unity_unmap(
+             pdev->domain,
+             ivrs_mappings[ivrs_mappings[bdf].dte_requestor_id].unity_map) )
+        AMD_IOMMU_DEBUG("%pd: unity unmapping failed for %04x:%02x:%02x.%u\n",
+                        pdev->domain, pdev->seg, pdev->bus, PCI_SLOT(devfn),
+                        PCI_FUNC(devfn));
+
     if ( amd_iommu_perdev_intremap &&
          ivrs_mappings[bdf].dte_requestor_id == bdf &&
          ivrs_mappings[bdf].intremap_table )




 


Rackspace

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