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.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu

Pull iommu fixes from Joerg Roedel:

- Intel VT-d Fixes:
- Allocate local memory for PRQ page
- Fix WARN_ON in iommu probe path
- Fix wrong use of pasid config

- AMD IOMMU Fixes:
- Lock inversion fix
- Log message severity fix
- Disable SNP when v2 page-tables are used

- Mediatek driver:
- Fix module autoloading

* tag 'iommu-fixes-v6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
iommu/amd: Change log message severity
iommu/vt-d: Fix WARN_ON in iommu probe path
iommu/vt-d: Allocate local memory for page request queue
iommu/vt-d: Fix wrong use of pasid config
iommu: mtk: fix module autoloading
iommu/amd: Do not enable SNP when V2 page table is enabled
iommu/amd: Fix possible irq lock inversion dependency issue

+31 -22
+13 -12
drivers/iommu/amd/init.c
··· 3232 3232 return; 3233 3233 /* 3234 3234 * The SNP support requires that IOMMU must be enabled, and is 3235 - * not configured in the passthrough mode. 3235 + * configured with V1 page table (DTE[Mode] = 0 is not supported). 3236 3236 */ 3237 3237 if (no_iommu || iommu_default_passthrough()) { 3238 - pr_err("SNP: IOMMU disabled or configured in passthrough mode, SNP cannot be supported.\n"); 3239 - cc_platform_clear(CC_ATTR_HOST_SEV_SNP); 3240 - return; 3238 + pr_warn("SNP: IOMMU disabled or configured in passthrough mode, SNP cannot be supported.\n"); 3239 + goto disable_snp; 3240 + } 3241 + 3242 + if (amd_iommu_pgtable != AMD_IOMMU_V1) { 3243 + pr_warn("SNP: IOMMU is configured with V2 page table mode, SNP cannot be supported.\n"); 3244 + goto disable_snp; 3241 3245 } 3242 3246 3243 3247 amd_iommu_snp_en = check_feature(FEATURE_SNP); 3244 3248 if (!amd_iommu_snp_en) { 3245 - pr_err("SNP: IOMMU SNP feature not enabled, SNP cannot be supported.\n"); 3246 - cc_platform_clear(CC_ATTR_HOST_SEV_SNP); 3247 - return; 3249 + pr_warn("SNP: IOMMU SNP feature not enabled, SNP cannot be supported.\n"); 3250 + goto disable_snp; 3248 3251 } 3249 3252 3250 3253 pr_info("IOMMU SNP support enabled.\n"); 3254 + return; 3251 3255 3252 - /* Enforce IOMMU v1 pagetable when SNP is enabled. */ 3253 - if (amd_iommu_pgtable != AMD_IOMMU_V1) { 3254 - pr_warn("Forcing use of AMD IOMMU v1 page table due to SNP.\n"); 3255 - amd_iommu_pgtable = AMD_IOMMU_V1; 3256 - } 3256 + disable_snp: 3257 + cc_platform_clear(CC_ATTR_HOST_SEV_SNP); 3257 3258 #endif 3258 3259 } 3259 3260
+7 -4
drivers/iommu/amd/iommu.c
··· 1692 1692 1693 1693 static u16 domain_id_alloc(void) 1694 1694 { 1695 + unsigned long flags; 1695 1696 int id; 1696 1697 1697 - spin_lock(&pd_bitmap_lock); 1698 + spin_lock_irqsave(&pd_bitmap_lock, flags); 1698 1699 id = find_first_zero_bit(amd_iommu_pd_alloc_bitmap, MAX_DOMAIN_ID); 1699 1700 BUG_ON(id == 0); 1700 1701 if (id > 0 && id < MAX_DOMAIN_ID) 1701 1702 __set_bit(id, amd_iommu_pd_alloc_bitmap); 1702 1703 else 1703 1704 id = 0; 1704 - spin_unlock(&pd_bitmap_lock); 1705 + spin_unlock_irqrestore(&pd_bitmap_lock, flags); 1705 1706 1706 1707 return id; 1707 1708 } 1708 1709 1709 1710 static void domain_id_free(int id) 1710 1711 { 1711 - spin_lock(&pd_bitmap_lock); 1712 + unsigned long flags; 1713 + 1714 + spin_lock_irqsave(&pd_bitmap_lock, flags); 1712 1715 if (id > 0 && id < MAX_DOMAIN_ID) 1713 1716 __clear_bit(id, amd_iommu_pd_alloc_bitmap); 1714 - spin_unlock(&pd_bitmap_lock); 1717 + spin_unlock_irqrestore(&pd_bitmap_lock, flags); 1715 1718 } 1716 1719 1717 1720 static void free_gcr3_tbl_level1(u64 *tbl)
+7 -4
drivers/iommu/intel/iommu.c
··· 4299 4299 } 4300 4300 4301 4301 dev_iommu_priv_set(dev, info); 4302 - ret = device_rbtree_insert(iommu, info); 4303 - if (ret) 4304 - goto free; 4302 + if (pdev && pci_ats_supported(pdev)) { 4303 + ret = device_rbtree_insert(iommu, info); 4304 + if (ret) 4305 + goto free; 4306 + } 4305 4307 4306 4308 if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev)) { 4307 4309 ret = intel_pasid_alloc_table(dev); ··· 4338 4336 struct intel_iommu *iommu = info->iommu; 4339 4337 4340 4338 mutex_lock(&iommu->iopf_lock); 4341 - device_rbtree_remove(info); 4339 + if (dev_is_pci(dev) && pci_ats_supported(to_pci_dev(dev))) 4340 + device_rbtree_remove(info); 4342 4341 mutex_unlock(&iommu->iopf_lock); 4343 4342 4344 4343 if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev) &&
+1 -1
drivers/iommu/intel/perfmon.c
··· 438 438 iommu_pmu_set_filter(domain, event->attr.config1, 439 439 IOMMU_PMU_FILTER_DOMAIN, idx, 440 440 event->attr.config1); 441 - iommu_pmu_set_filter(pasid, event->attr.config1, 441 + iommu_pmu_set_filter(pasid, event->attr.config2, 442 442 IOMMU_PMU_FILTER_PASID, idx, 443 443 event->attr.config1); 444 444 iommu_pmu_set_filter(ats, event->attr.config2,
+1 -1
drivers/iommu/intel/svm.c
··· 66 66 struct page *pages; 67 67 int irq, ret; 68 68 69 - pages = alloc_pages(GFP_KERNEL | __GFP_ZERO, PRQ_ORDER); 69 + pages = alloc_pages_node(iommu->node, GFP_KERNEL | __GFP_ZERO, PRQ_ORDER); 70 70 if (!pages) { 71 71 pr_warn("IOMMU: %s: Failed to allocate page request queue\n", 72 72 iommu->name);
+1
drivers/iommu/mtk_iommu.c
··· 1790 1790 { .compatible = "mediatek,mt8365-m4u", .data = &mt8365_data}, 1791 1791 {} 1792 1792 }; 1793 + MODULE_DEVICE_TABLE(of, mtk_iommu_of_ids); 1793 1794 1794 1795 static struct platform_driver mtk_iommu_driver = { 1795 1796 .probe = mtk_iommu_probe,
+1
drivers/iommu/mtk_iommu_v1.c
··· 600 600 { .compatible = "mediatek,mt2701-m4u", }, 601 601 {} 602 602 }; 603 + MODULE_DEVICE_TABLE(of, mtk_iommu_v1_of_ids); 603 604 604 605 static const struct component_master_ops mtk_iommu_v1_com_ops = { 605 606 .bind = mtk_iommu_v1_bind,