-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test patch fixing crash on AMD IOMMU init on some systems
Details on XenProject matrix channel.
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthrough/amd/iommu_acpi.c | ||
index 3f5508eba049..2573f59abcfd 100644 | ||
--- a/xen/drivers/passthrough/amd/iommu_acpi.c | ||
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c | ||
@@ -248,6 +248,29 @@ static int __init register_range_for_device( | ||
iommu = find_iommu_for_device(seg, bdf); | ||
if ( !iommu ) | ||
{ | ||
+ const struct pci_dev *pdev; | ||
+ | ||
+ for_each_amd_iommu(iommu) | ||
+ { | ||
+ if ( iommu->seg == seg && iommu->bdf == bdf ) | ||
+ { | ||
+ AMD_IOMMU_WARN("IVMD: IOMMU %pp not covered by IVRS\n", | ||
+ &PCI_SBDF(seg, bdf)); | ||
+ return 0; | ||
+ } | ||
+ } | ||
+ | ||
+ pcidevs_lock(); | ||
+ pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bdf)); | ||
+ /* No need to hold the lock - the device can't be removed at init. */ | ||
+ pcidevs_unlock(); | ||
+ if ( pdev && pdev->type == DEV_TYPE_PCI_HOST_BRIDGE ) | ||
+ { | ||
+ AMD_IOMMU_WARN("IVMD: PCI Host bridge %pp not covered by IVRS\n", | ||
+ &PCI_SBDF(seg, bdf)); | ||
+ return 0; | ||
+ } | ||
+ | ||
AMD_IOMMU_ERROR("IVMD: no IOMMU for Dev_Id %#x\n", bdf); | ||
return -ENODEV; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters