aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/amd_iommu.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index b2c309b07427..7c3a95e54ec5 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -155,6 +155,10 @@ static int iommu_init_device(struct device *dev)
155 pdev = pci_get_bus_and_slot(PCI_BUS(alias), alias & 0xff); 155 pdev = pci_get_bus_and_slot(PCI_BUS(alias), alias & 0xff);
156 if (pdev) 156 if (pdev)
157 dev_data->alias = &pdev->dev; 157 dev_data->alias = &pdev->dev;
158 else {
159 kfree(dev_data);
160 return -ENOTSUPP;
161 }
158 162
159 atomic_set(&dev_data->bind, 0); 163 atomic_set(&dev_data->bind, 0);
160 164
@@ -164,6 +168,20 @@ static int iommu_init_device(struct device *dev)
164 return 0; 168 return 0;
165} 169}
166 170
171static void iommu_ignore_device(struct device *dev)
172{
173 u16 devid, alias;
174
175 devid = get_device_id(dev);
176 alias = amd_iommu_alias_table[devid];
177
178 memset(&amd_iommu_dev_table[devid], 0, sizeof(struct dev_table_entry));
179 memset(&amd_iommu_dev_table[alias], 0, sizeof(struct dev_table_entry));
180
181 amd_iommu_rlookup_table[devid] = NULL;
182 amd_iommu_rlookup_table[alias] = NULL;
183}
184
167static void iommu_uninit_device(struct device *dev) 185static void iommu_uninit_device(struct device *dev)
168{ 186{
169 kfree(dev->archdata.iommu); 187 kfree(dev->archdata.iommu);
@@ -193,7 +211,9 @@ int __init amd_iommu_init_devices(void)
193 continue; 211 continue;
194 212
195 ret = iommu_init_device(&pdev->dev); 213 ret = iommu_init_device(&pdev->dev);
196 if (ret) 214 if (ret == -ENOTSUPP)
215 iommu_ignore_device(&pdev->dev);
216 else if (ret)
197 goto out_free; 217 goto out_free;
198 } 218 }
199 219