Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'iommu-fixes-v6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu

Pull iommu fixes from Joerg Roedel:
"Intel VT-d fixes:

- Fix a lockdep splat issue in intel_iommu_init()

- Allow NVS regions to pass RMRR check

- Domain cleanup in error path"

* tag 'iommu-fixes-v6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
iommu/vt-d: Clean up si_domain in the init_dmars() error path
iommu/vt-d: Allow NVS regions in arch_rmrr_sanity_check()
iommu/vt-d: Use rcu_lock in get_resv_regions
iommu: Add gfp parameter to iommu_alloc_resv_region

+37 -21
+3 -1
arch/x86/include/asm/iommu.h
··· 25 25 { 26 26 u64 start = rmrr->base_address; 27 27 u64 end = rmrr->end_address + 1; 28 + int entry_type; 28 29 29 - if (e820__mapped_all(start, end, E820_TYPE_RESERVED)) 30 + entry_type = e820__get_entry_type(start, end); 31 + if (entry_type == E820_TYPE_RESERVED || entry_type == E820_TYPE_NVS) 30 32 return 0; 31 33 32 34 pr_err(FW_BUG "No firmware reserved region can cover this RMRR [%#018Lx-%#018Lx], contact BIOS vendor for fixes\n",
+2 -1
drivers/acpi/arm64/iort.c
··· 1142 1142 struct iommu_resv_region *region; 1143 1143 1144 1144 region = iommu_alloc_resv_region(base + SZ_64K, SZ_64K, 1145 - prot, IOMMU_RESV_MSI); 1145 + prot, IOMMU_RESV_MSI, 1146 + GFP_KERNEL); 1146 1147 if (region) 1147 1148 list_add_tail(&region->list, head); 1148 1149 }
+4 -3
drivers/iommu/amd/iommu.c
··· 2330 2330 type = IOMMU_RESV_RESERVED; 2331 2331 2332 2332 region = iommu_alloc_resv_region(entry->address_start, 2333 - length, prot, type); 2333 + length, prot, type, 2334 + GFP_KERNEL); 2334 2335 if (!region) { 2335 2336 dev_err(dev, "Out of memory allocating dm-regions\n"); 2336 2337 return; ··· 2341 2340 2342 2341 region = iommu_alloc_resv_region(MSI_RANGE_START, 2343 2342 MSI_RANGE_END - MSI_RANGE_START + 1, 2344 - 0, IOMMU_RESV_MSI); 2343 + 0, IOMMU_RESV_MSI, GFP_KERNEL); 2345 2344 if (!region) 2346 2345 return; 2347 2346 list_add_tail(&region->list, head); 2348 2347 2349 2348 region = iommu_alloc_resv_region(HT_RANGE_START, 2350 2349 HT_RANGE_END - HT_RANGE_START + 1, 2351 - 0, IOMMU_RESV_RESERVED); 2350 + 0, IOMMU_RESV_RESERVED, GFP_KERNEL); 2352 2351 if (!region) 2353 2352 return; 2354 2353 list_add_tail(&region->list, head);
+1 -1
drivers/iommu/apple-dart.c
··· 758 758 759 759 region = iommu_alloc_resv_region(DOORBELL_ADDR, 760 760 PAGE_SIZE, prot, 761 - IOMMU_RESV_MSI); 761 + IOMMU_RESV_MSI, GFP_KERNEL); 762 762 if (!region) 763 763 return; 764 764
+1 -1
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
··· 2757 2757 int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO; 2758 2758 2759 2759 region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH, 2760 - prot, IOMMU_RESV_SW_MSI); 2760 + prot, IOMMU_RESV_SW_MSI, GFP_KERNEL); 2761 2761 if (!region) 2762 2762 return; 2763 2763
+1 -1
drivers/iommu/arm/arm-smmu/arm-smmu.c
··· 1534 1534 int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO; 1535 1535 1536 1536 region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH, 1537 - prot, IOMMU_RESV_SW_MSI); 1537 + prot, IOMMU_RESV_SW_MSI, GFP_KERNEL); 1538 1538 if (!region) 1539 1539 return; 1540 1540
+12 -5
drivers/iommu/intel/iommu.c
··· 2410 2410 2411 2411 if (md_domain_init(si_domain, DEFAULT_DOMAIN_ADDRESS_WIDTH)) { 2412 2412 domain_exit(si_domain); 2413 + si_domain = NULL; 2413 2414 return -EFAULT; 2414 2415 } 2415 2416 ··· 3052 3051 for_each_active_iommu(iommu, drhd) { 3053 3052 disable_dmar_iommu(iommu); 3054 3053 free_dmar_iommu(iommu); 3054 + } 3055 + if (si_domain) { 3056 + domain_exit(si_domain); 3057 + si_domain = NULL; 3055 3058 } 3056 3059 3057 3060 return ret; ··· 4539 4534 struct device *i_dev; 4540 4535 int i; 4541 4536 4542 - down_read(&dmar_global_lock); 4537 + rcu_read_lock(); 4543 4538 for_each_rmrr_units(rmrr) { 4544 4539 for_each_active_dev_scope(rmrr->devices, rmrr->devices_cnt, 4545 4540 i, i_dev) { ··· 4557 4552 IOMMU_RESV_DIRECT_RELAXABLE : IOMMU_RESV_DIRECT; 4558 4553 4559 4554 resv = iommu_alloc_resv_region(rmrr->base_address, 4560 - length, prot, type); 4555 + length, prot, type, 4556 + GFP_ATOMIC); 4561 4557 if (!resv) 4562 4558 break; 4563 4559 4564 4560 list_add_tail(&resv->list, head); 4565 4561 } 4566 4562 } 4567 - up_read(&dmar_global_lock); 4563 + rcu_read_unlock(); 4568 4564 4569 4565 #ifdef CONFIG_INTEL_IOMMU_FLOPPY_WA 4570 4566 if (dev_is_pci(device)) { ··· 4573 4567 4574 4568 if ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) { 4575 4569 reg = iommu_alloc_resv_region(0, 1UL << 24, prot, 4576 - IOMMU_RESV_DIRECT_RELAXABLE); 4570 + IOMMU_RESV_DIRECT_RELAXABLE, 4571 + GFP_KERNEL); 4577 4572 if (reg) 4578 4573 list_add_tail(&reg->list, head); 4579 4574 } ··· 4583 4576 4584 4577 reg = iommu_alloc_resv_region(IOAPIC_RANGE_START, 4585 4578 IOAPIC_RANGE_END - IOAPIC_RANGE_START + 1, 4586 - 0, IOMMU_RESV_MSI); 4579 + 0, IOMMU_RESV_MSI, GFP_KERNEL); 4587 4580 if (!reg) 4588 4581 return; 4589 4582 list_add_tail(&reg->list, head);
+4 -3
drivers/iommu/iommu.c
··· 504 504 LIST_HEAD(stack); 505 505 506 506 nr = iommu_alloc_resv_region(new->start, new->length, 507 - new->prot, new->type); 507 + new->prot, new->type, GFP_KERNEL); 508 508 if (!nr) 509 509 return -ENOMEM; 510 510 ··· 2579 2579 2580 2580 struct iommu_resv_region *iommu_alloc_resv_region(phys_addr_t start, 2581 2581 size_t length, int prot, 2582 - enum iommu_resv_type type) 2582 + enum iommu_resv_type type, 2583 + gfp_t gfp) 2583 2584 { 2584 2585 struct iommu_resv_region *region; 2585 2586 2586 - region = kzalloc(sizeof(*region), GFP_KERNEL); 2587 + region = kzalloc(sizeof(*region), gfp); 2587 2588 if (!region) 2588 2589 return NULL; 2589 2590
+2 -1
drivers/iommu/mtk_iommu.c
··· 917 917 continue; 918 918 919 919 region = iommu_alloc_resv_region(resv->iova_base, resv->size, 920 - prot, IOMMU_RESV_RESERVED); 920 + prot, IOMMU_RESV_RESERVED, 921 + GFP_KERNEL); 921 922 if (!region) 922 923 return; 923 924
+6 -3
drivers/iommu/virtio-iommu.c
··· 490 490 fallthrough; 491 491 case VIRTIO_IOMMU_RESV_MEM_T_RESERVED: 492 492 region = iommu_alloc_resv_region(start, size, 0, 493 - IOMMU_RESV_RESERVED); 493 + IOMMU_RESV_RESERVED, 494 + GFP_KERNEL); 494 495 break; 495 496 case VIRTIO_IOMMU_RESV_MEM_T_MSI: 496 497 region = iommu_alloc_resv_region(start, size, prot, 497 - IOMMU_RESV_MSI); 498 + IOMMU_RESV_MSI, 499 + GFP_KERNEL); 498 500 break; 499 501 } 500 502 if (!region) ··· 911 909 */ 912 910 if (!msi) { 913 911 msi = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH, 914 - prot, IOMMU_RESV_SW_MSI); 912 + prot, IOMMU_RESV_SW_MSI, 913 + GFP_KERNEL); 915 914 if (!msi) 916 915 return; 917 916
+1 -1
include/linux/iommu.h
··· 455 455 extern bool iommu_default_passthrough(void); 456 456 extern struct iommu_resv_region * 457 457 iommu_alloc_resv_region(phys_addr_t start, size_t length, int prot, 458 - enum iommu_resv_type type); 458 + enum iommu_resv_type type, gfp_t gfp); 459 459 extern int iommu_get_group_resv_regions(struct iommu_group *group, 460 460 struct list_head *head); 461 461