diff options
Diffstat (limited to 'drivers/iommu/amd_iommu_init.c')
| -rw-r--r-- | drivers/iommu/amd_iommu_init.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index c56790375e0f..a33612f3206f 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c | |||
| @@ -129,7 +129,7 @@ u16 amd_iommu_last_bdf; /* largest PCI device id we have | |||
| 129 | to handle */ | 129 | to handle */ |
| 130 | LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings | 130 | LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings |
| 131 | we find in ACPI */ | 131 | we find in ACPI */ |
| 132 | bool amd_iommu_unmap_flush; /* if true, flush on every unmap */ | 132 | u32 amd_iommu_unmap_flush; /* if true, flush on every unmap */ |
| 133 | 133 | ||
| 134 | LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the | 134 | LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the |
| 135 | system */ | 135 | system */ |
| @@ -1029,6 +1029,9 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h) | |||
| 1029 | if (!iommu->dev) | 1029 | if (!iommu->dev) |
| 1030 | return 1; | 1030 | return 1; |
| 1031 | 1031 | ||
| 1032 | iommu->root_pdev = pci_get_bus_and_slot(iommu->dev->bus->number, | ||
| 1033 | PCI_DEVFN(0, 0)); | ||
| 1034 | |||
| 1032 | iommu->cap_ptr = h->cap_ptr; | 1035 | iommu->cap_ptr = h->cap_ptr; |
| 1033 | iommu->pci_seg = h->pci_seg; | 1036 | iommu->pci_seg = h->pci_seg; |
| 1034 | iommu->mmio_phys = h->mmio_phys; | 1037 | iommu->mmio_phys = h->mmio_phys; |
| @@ -1323,20 +1326,16 @@ static void iommu_apply_resume_quirks(struct amd_iommu *iommu) | |||
| 1323 | { | 1326 | { |
| 1324 | int i, j; | 1327 | int i, j; |
| 1325 | u32 ioc_feature_control; | 1328 | u32 ioc_feature_control; |
| 1326 | struct pci_dev *pdev = NULL; | 1329 | struct pci_dev *pdev = iommu->root_pdev; |
| 1327 | 1330 | ||
| 1328 | /* RD890 BIOSes may not have completely reconfigured the iommu */ | 1331 | /* RD890 BIOSes may not have completely reconfigured the iommu */ |
| 1329 | if (!is_rd890_iommu(iommu->dev)) | 1332 | if (!is_rd890_iommu(iommu->dev) || !pdev) |
| 1330 | return; | 1333 | return; |
| 1331 | 1334 | ||
| 1332 | /* | 1335 | /* |
| 1333 | * First, we need to ensure that the iommu is enabled. This is | 1336 | * First, we need to ensure that the iommu is enabled. This is |
| 1334 | * controlled by a register in the northbridge | 1337 | * controlled by a register in the northbridge |
| 1335 | */ | 1338 | */ |
| 1336 | pdev = pci_get_bus_and_slot(iommu->dev->bus->number, PCI_DEVFN(0, 0)); | ||
| 1337 | |||
| 1338 | if (!pdev) | ||
| 1339 | return; | ||
| 1340 | 1339 | ||
| 1341 | /* Select Northbridge indirect register 0x75 and enable writing */ | 1340 | /* Select Northbridge indirect register 0x75 and enable writing */ |
| 1342 | pci_write_config_dword(pdev, 0x60, 0x75 | (1 << 7)); | 1341 | pci_write_config_dword(pdev, 0x60, 0x75 | (1 << 7)); |
| @@ -1346,8 +1345,6 @@ static void iommu_apply_resume_quirks(struct amd_iommu *iommu) | |||
| 1346 | if (!(ioc_feature_control & 0x1)) | 1345 | if (!(ioc_feature_control & 0x1)) |
| 1347 | pci_write_config_dword(pdev, 0x64, ioc_feature_control | 1); | 1346 | pci_write_config_dword(pdev, 0x64, ioc_feature_control | 1); |
| 1348 | 1347 | ||
| 1349 | pci_dev_put(pdev); | ||
| 1350 | |||
| 1351 | /* Restore the iommu BAR */ | 1348 | /* Restore the iommu BAR */ |
| 1352 | pci_write_config_dword(iommu->dev, iommu->cap_ptr + 4, | 1349 | pci_write_config_dword(iommu->dev, iommu->cap_ptr + 4, |
| 1353 | iommu->stored_addr_lo); | 1350 | iommu->stored_addr_lo); |
| @@ -1644,6 +1641,8 @@ static int __init amd_iommu_init(void) | |||
| 1644 | 1641 | ||
| 1645 | amd_iommu_init_api(); | 1642 | amd_iommu_init_api(); |
| 1646 | 1643 | ||
| 1644 | x86_platform.iommu_shutdown = disable_iommus; | ||
| 1645 | |||
| 1647 | if (iommu_pass_through) | 1646 | if (iommu_pass_through) |
| 1648 | goto out; | 1647 | goto out; |
| 1649 | 1648 | ||
| @@ -1652,8 +1651,6 @@ static int __init amd_iommu_init(void) | |||
| 1652 | else | 1651 | else |
| 1653 | printk(KERN_INFO "AMD-Vi: Lazy IO/TLB flushing enabled\n"); | 1652 | printk(KERN_INFO "AMD-Vi: Lazy IO/TLB flushing enabled\n"); |
| 1654 | 1653 | ||
| 1655 | x86_platform.iommu_shutdown = disable_iommus; | ||
| 1656 | |||
| 1657 | out: | 1654 | out: |
| 1658 | return ret; | 1655 | return ret; |
| 1659 | 1656 | ||
