Create context mapping for phantom functions.
Signed-off-by: Andrew Cooks <[email protected]>
---
drivers/iommu/intel-iommu.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 554e6ac..b3c9b55 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -1673,6 +1673,32 @@ static int domain_context_mapping_one(struct dmar_domain
*domain, int segment,
}
static int
+context_map_phantoms(struct dmar_domain *domain, struct pci_dev *pdev,
+ int translation)
+{
+ unsigned fn;
+ int ret;
+
+ if (!pdev->phantoms_enabled)
+ return 0;
+
+ pr_debug("context_map_phantoms()\n");
+
+ for (fn = 1 ; fn < 8 ; fn++) {
+ ret = domain_context_mapping_one(domain,
+ pci_domain_nr(pdev->bus),
+ pdev->bus->number,
+ fn,
+ translation);
+ if (ret) {
+ pr_info("function %d phantom mapping failed.\n", fn);
+ return ret;
+ }
+ }
+ return 0;
+}
+
+static int
domain_context_mapping(struct dmar_domain *domain, struct pci_dev *pdev,
int translation)
{
@@ -1685,6 +1711,10 @@ domain_context_mapping(struct dmar_domain *domain,
struct pci_dev *pdev,
if (ret)
return ret;
+ ret = context_map_phantoms(domain, pdev, translation);
+ if (ret)
+ return ret;
+
/* dependent device mapping */
tmp = pci_find_upstream_pcie_bridge(pdev);
if (!tmp)
--
1.7.1
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu