Merge branch 'amd-iommu/2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu into x86/urgent

+26 -10
+9 -7
arch/x86/kernel/amd_iommu.c
··· 1487 1487 struct protection_domain *domain) 1488 1488 { 1489 1489 struct iommu_dev_data *dev_data, *alias_data; 1490 + int ret; 1490 1491 1491 1492 dev_data = get_dev_data(dev); 1492 1493 alias_data = get_dev_data(dev_data->alias); ··· 1499 1498 spin_lock(&domain->lock); 1500 1499 1501 1500 /* Some sanity checks */ 1501 + ret = -EBUSY; 1502 1502 if (alias_data->domain != NULL && 1503 1503 alias_data->domain != domain) 1504 - return -EBUSY; 1504 + goto out_unlock; 1505 1505 1506 1506 if (dev_data->domain != NULL && 1507 1507 dev_data->domain != domain) 1508 - return -EBUSY; 1508 + goto out_unlock; 1509 1509 1510 1510 /* Do real assignment */ 1511 1511 if (dev_data->alias != dev) { ··· 1522 1520 1523 1521 atomic_inc(&dev_data->bind); 1524 1522 1523 + ret = 0; 1524 + 1525 + out_unlock: 1526 + 1525 1527 /* ready */ 1526 1528 spin_unlock(&domain->lock); 1527 1529 1528 - return 0; 1530 + return ret; 1529 1531 } 1530 1532 1531 1533 /* ··· 2330 2324 2331 2325 iommu_detected = 1; 2332 2326 swiotlb = 0; 2333 - #ifdef CONFIG_GART_IOMMU 2334 - gart_iommu_aperture_disabled = 1; 2335 - gart_iommu_aperture = 0; 2336 - #endif 2337 2327 2338 2328 /* Make the driver finally visible to the drivers */ 2339 2329 dma_ops = &amd_iommu_dma_ops;
+17 -3
arch/x86/kernel/amd_iommu_init.c
··· 287 287 { 288 288 u8 *ret; 289 289 290 - if (!request_mem_region(address, MMIO_REGION_LENGTH, "amd_iommu")) 290 + if (!request_mem_region(address, MMIO_REGION_LENGTH, "amd_iommu")) { 291 + pr_err("AMD-Vi: Can not reserve memory region %llx for mmio\n", 292 + address); 293 + pr_err("AMD-Vi: This is a BIOS bug. Please contact your hardware vendor\n"); 291 294 return NULL; 295 + } 292 296 293 297 ret = ioremap_nocache(address, MMIO_REGION_LENGTH); 294 298 if (ret != NULL) ··· 1318 1314 ret = amd_iommu_init_dma_ops(); 1319 1315 1320 1316 if (ret) 1321 - goto free; 1317 + goto free_disable; 1322 1318 1323 1319 amd_iommu_init_api(); 1324 1320 ··· 1336 1332 out: 1337 1333 return ret; 1338 1334 1339 - free: 1335 + free_disable: 1340 1336 disable_iommus(); 1341 1337 1338 + free: 1342 1339 amd_iommu_uninit_devices(); 1343 1340 1344 1341 free_pages((unsigned long)amd_iommu_pd_alloc_bitmap, ··· 1357 1352 free_iommu_all(); 1358 1353 1359 1354 free_unity_maps(); 1355 + 1356 + #ifdef CONFIG_GART_IOMMU 1357 + /* 1358 + * We failed to initialize the AMD IOMMU - try fallback to GART 1359 + * if possible. 1360 + */ 1361 + gart_iommu_init(); 1362 + 1363 + #endif 1360 1364 1361 1365 goto out; 1362 1366 }