History

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

Linus Torvalds committed 2 years ago

Commit c7c4e132 parents b3812ff b8246a27 files · +31 −22Browse files

Unified · Split

7 files
  1. drivers/iommu/amd/init.c +13 −12
  2. drivers/iommu/amd/iommu.c +7 −4
  3. drivers/iommu/intel/iommu.c +7 −4
  4. drivers/iommu/intel/perfmon.c +1 −1
  5. drivers/iommu/intel/svm.c +1 −1
  6. drivers/iommu/mtk_iommu.c +1 −0
  7. drivers/iommu/mtk_iommu_v1.c +1 −0
drivers/iommu/amd/init.c+13−12
@@ -3232,28 +3232,29 @@ static void iommu_snp_enable(void) · 3231 unmodified lines
3232 return;3232 return;
3233 /*3233 /*
3234 * The SNP support requires that IOMMU must be enabled, and is3234 * 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 if (no_iommu || iommu_default_passthrough()) {3237 if (no_iommu || iommu_default_passthrough()) {
3238 pr_err("SNP: IOMMU disabled or configured in passthrough mode, SNP cannot be supported.\n");3238 pr_warn("SNP: IOMMU disabled or configured in passthrough mode, SNP cannot be supported.\n");
3239 cc_platform_clear(CC_ATTR_HOST_SEV_SNP);3239 goto disable_snp;
3240 return;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 amd_iommu_snp_en = check_feature(FEATURE_SNP);3247 amd_iommu_snp_en = check_feature(FEATURE_SNP);
3244 if (!amd_iommu_snp_en) {3248 if (!amd_iommu_snp_en) {
3245 pr_err("SNP: IOMMU SNP feature not enabled, SNP cannot be supported.\n");3249 pr_warn("SNP: IOMMU SNP feature not enabled, SNP cannot be supported.\n");
3246 cc_platform_clear(CC_ATTR_HOST_SEV_SNP);3250 goto disable_snp;
3247 return;
3248 }3251 }
3249 3252
3250 pr_info("IOMMU SNP support enabled.\n");3253 pr_info("IOMMU SNP support enabled.\n");
3254 return;
3251 3255
3252 /* Enforce IOMMU v1 pagetable when SNP is enabled. */3256disable_snp:
3253 if (amd_iommu_pgtable != AMD_IOMMU_V1) {3257 cc_platform_clear(CC_ATTR_HOST_SEV_SNP);
3254 pr_warn("Forcing use of AMD IOMMU v1 page table due to SNP.\n");
3255 amd_iommu_pgtable = AMD_IOMMU_V1;
3256 }
3257#endif3258#endif
3258}3259}
3259 3260
drivers/iommu/amd/iommu.c+7−4
@@ -1692,26 +1692,29 @@ int amd_iommu_complete_ppr(struct pci_dev *pdev, u32 pasid, · 1691 unmodified lines
1692 1692
1693static u16 domain_id_alloc(void)1693static u16 domain_id_alloc(void)
1694{1694{
1695 unsigned long flags;
1695 int id;1696 int id;
1696 1697
1697 spin_lock(&pd_bitmap_lock);1698 spin_lock_irqsave(&pd_bitmap_lock, flags);
1698 id = find_first_zero_bit(amd_iommu_pd_alloc_bitmap, MAX_DOMAIN_ID);1699 id = find_first_zero_bit(amd_iommu_pd_alloc_bitmap, MAX_DOMAIN_ID);
1699 BUG_ON(id == 0);1700 BUG_ON(id == 0);
1700 if (id > 0 && id < MAX_DOMAIN_ID)1701 if (id > 0 && id < MAX_DOMAIN_ID)
1701 __set_bit(id, amd_iommu_pd_alloc_bitmap);1702 __set_bit(id, amd_iommu_pd_alloc_bitmap);
1702 else1703 else
1703 id = 0;1704 id = 0;
1704 spin_unlock(&pd_bitmap_lock);1705 spin_unlock_irqrestore(&pd_bitmap_lock, flags);
1705 1706
1706 return id;1707 return id;
1707}1708}
1708 1709
1709static void domain_id_free(int id)1710static 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 if (id > 0 && id < MAX_DOMAIN_ID)1715 if (id > 0 && id < MAX_DOMAIN_ID)
1713 __clear_bit(id, amd_iommu_pd_alloc_bitmap);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
1717static void free_gcr3_tbl_level1(u64 *tbl)1720static void free_gcr3_tbl_level1(u64 *tbl)
drivers/iommu/intel/iommu.c+7−4
@@ -4299,9 +4299,11 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev) · 4298 unmodified lines
4299 }4299 }
4300 4300
4301 dev_iommu_priv_set(dev, info);4301 dev_iommu_priv_set(dev, info);
4302 ret = device_rbtree_insert(iommu, info);4302 if (pdev && pci_ats_supported(pdev)) {
4303 if (ret)4303 ret = device_rbtree_insert(iommu, info);
4304 goto free;4304 if (ret)
4305 goto free;
4306 }
4305 4307
4306 if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev)) {4308 if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev)) {
4307 ret = intel_pasid_alloc_table(dev);4309 ret = intel_pasid_alloc_table(dev);
@@ -4336,7 +4338,8 @@ static void intel_iommu_release_device(struct device *dev) · 28 unmodified lines
4336 struct intel_iommu *iommu = info->iommu;4338 struct intel_iommu *iommu = info->iommu;
4337 4339
4338 mutex_lock(&iommu->iopf_lock);4340 mutex_lock(&iommu->iopf_lock);
4339 device_rbtree_remove(info);4341 if (dev_is_pci(dev) && pci_ats_supported(to_pci_dev(dev)))
4342 device_rbtree_remove(info);
4340 mutex_unlock(&iommu->iopf_lock);4343 mutex_unlock(&iommu->iopf_lock);
4341 4344
4342 if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev) &&4345 if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev) &&
drivers/iommu/intel/perfmon.c+1−1
@@ -438,7 +438,7 @@ static int iommu_pmu_assign_event(struct iommu_pmu *iommu_pmu, · 437 unmodified lines
438 iommu_pmu_set_filter(domain, event->attr.config1,438 iommu_pmu_set_filter(domain, event->attr.config1,
439 IOMMU_PMU_FILTER_DOMAIN, idx,439 IOMMU_PMU_FILTER_DOMAIN, idx,
440 event->attr.config1);440 event->attr.config1);
441 iommu_pmu_set_filter(pasid, event->attr.config1,441 iommu_pmu_set_filter(pasid, event->attr.config2,
442 IOMMU_PMU_FILTER_PASID, idx,442 IOMMU_PMU_FILTER_PASID, idx,
443 event->attr.config1);443 event->attr.config1);
444 iommu_pmu_set_filter(ats, event->attr.config2,444 iommu_pmu_set_filter(ats, event->attr.config2,
drivers/iommu/intel/svm.c+1−1
@@ -66,7 +66,7 @@ int intel_svm_enable_prq(struct intel_iommu *iommu) · 65 unmodified lines
66 struct page *pages;66 struct page *pages;
67 int irq, ret;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 if (!pages) {70 if (!pages) {
71 pr_warn("IOMMU: %s: Failed to allocate page request queue\n",71 pr_warn("IOMMU: %s: Failed to allocate page request queue\n",
72 iommu->name);72 iommu->name);
drivers/iommu/mtk_iommu.c+1−0
@@ -1790,6 +1790,7 @@ static const struct of_device_id mtk_iommu_of_ids[] = { · 1789 unmodified lines
1790 { .compatible = "mediatek,mt8365-m4u", .data = &mt8365_data},1790 { .compatible = "mediatek,mt8365-m4u", .data = &mt8365_data},
1791 {}1791 {}
1792};1792};
1793MODULE_DEVICE_TABLE(of, mtk_iommu_of_ids);
1793 1794
1794static struct platform_driver mtk_iommu_driver = {1795static struct platform_driver mtk_iommu_driver = {
1795 .probe = mtk_iommu_probe,1796 .probe = mtk_iommu_probe,
drivers/iommu/mtk_iommu_v1.c+1−0
@@ -600,6 +600,7 @@ static const struct of_device_id mtk_iommu_v1_of_ids[] = { · 599 unmodified lines
600 { .compatible = "mediatek,mt2701-m4u", },600 { .compatible = "mediatek,mt2701-m4u", },
601 {}601 {}
602};602};
603MODULE_DEVICE_TABLE(of, mtk_iommu_v1_of_ids);
603 604
604static const struct component_master_ops mtk_iommu_v1_com_ops = {605static const struct component_master_ops mtk_iommu_v1_com_ops = {
605 .bind = mtk_iommu_v1_bind,606 .bind = mtk_iommu_v1_bind,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t