--- zzzz-none-000/linux-2.6.39.4/arch/x86/kernel/amd_iommu.c 2011-08-03 19:43:28.000000000 +0000 +++ puma6-atom-6490-729/linux-2.6.39.4/arch/x86/kernel/amd_iommu.c 2021-11-10 13:38:14.000000000 +0000 @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -154,10 +153,6 @@ pdev = pci_get_bus_and_slot(PCI_BUS(alias), alias & 0xff); if (pdev) dev_data->alias = &pdev->dev; - else { - kfree(dev_data); - return -ENOTSUPP; - } atomic_set(&dev_data->bind, 0); @@ -167,20 +162,6 @@ return 0; } -static void iommu_ignore_device(struct device *dev) -{ - u16 devid, alias; - - devid = get_device_id(dev); - alias = amd_iommu_alias_table[devid]; - - memset(&amd_iommu_dev_table[devid], 0, sizeof(struct dev_table_entry)); - memset(&amd_iommu_dev_table[alias], 0, sizeof(struct dev_table_entry)); - - amd_iommu_rlookup_table[devid] = NULL; - amd_iommu_rlookup_table[alias] = NULL; -} - static void iommu_uninit_device(struct device *dev) { kfree(dev->archdata.iommu); @@ -210,9 +191,7 @@ continue; ret = iommu_init_device(&pdev->dev); - if (ret == -ENOTSUPP) - iommu_ignore_device(&pdev->dev); - else if (ret) + if (ret) goto out_free; } @@ -2317,23 +2296,6 @@ .dma_supported = amd_iommu_dma_supported, }; -static unsigned device_dma_ops_init(void) -{ - struct pci_dev *pdev = NULL; - unsigned unhandled = 0; - - for_each_pci_dev(pdev) { - if (!check_device(&pdev->dev)) { - unhandled += 1; - continue; - } - - pdev->dev.archdata.dma_ops = &amd_iommu_dma_ops; - } - - return unhandled; -} - /* * The function which clues the AMD IOMMU driver into dma_ops. */ @@ -2346,7 +2308,7 @@ int __init amd_iommu_init_dma_ops(void) { struct amd_iommu *iommu; - int ret, unhandled; + int ret; /* * first allocate a default protection domain for every IOMMU we @@ -2372,11 +2334,7 @@ swiotlb = 0; /* Make the driver finally visible to the drivers */ - unhandled = device_dma_ops_init(); - if (unhandled && max_pfn > MAX_DMA32_PFN) { - /* There are unhandled devices - initialize swiotlb for them */ - swiotlb = 1; - } + dma_ops = &amd_iommu_dma_ops; amd_iommu_stats_init();