Skip to content

Commit 4f1492e

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Revert ATS timing change to fix boot failure
Commit <5518f239aff1> ("iommu/vt-d: Move scalable mode ATS enablement to probe path") changed the PCI ATS enablement logic to run earlier, specifically before the default domain attachment. On some client platforms, this change resulted in boot failures, causing the kernel to panic with the following message and call trace: Kernel panic - not syncing: DMAR hardware is malfunctioning CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.14.0-rc3+ #175 Call Trace: <TASK> dump_stack_lvl+0x6f/0xb0 dump_stack+0x10/0x16 panic+0x10a/0x2b7 iommu_enable_translation.cold+0xc/0xc intel_iommu_init+0xe39/0xec0 ? trace_hardirqs_on+0x1e/0xd0 ? __pfx_pci_iommu_init+0x10/0x10 pci_iommu_init+0xd/0x40 do_one_initcall+0x5b/0x390 kernel_init_freeable+0x26d/0x2b0 ? __pfx_kernel_init+0x10/0x10 kernel_init+0x15/0x120 ret_from_fork+0x35/0x60 ? __pfx_kernel_init+0x10/0x10 ret_from_fork_asm+0x1a/0x30 RIP: 1f0f:0x0 Code: Unable to access opcode bytes at 0xffffffffffffffd6. RSP: 0000:0000000000000000 EFLAGS: 841f0f2e66 ORIG_RAX: 1f0f2e6600000000 RAX: 0000000000000000 RBX: 1f0f2e6600000000 RCX: 2e66000000000084 RDX: 0000000000841f0f RSI: 000000841f0f2e66 RDI: 00841f0f2e660000 RBP: 00841f0f2e660000 R08: 00841f0f2e660000 R09: 000000841f0f2e66 R10: 0000000000841f0f R11: 2e66000000000084 R12: 000000841f0f2e66 R13: 0000000000841f0f R14: 2e66000000000084 R15: 1f0f2e6600000000 </TASK> ---[ end Kernel panic - not syncing: DMAR hardware is malfunctioning ]--- Fix this by reverting the timing change for ATS enablement introduced by the offending commit and restoring the previous behavior. Fixes: 5518f23 ("iommu/vt-d: Move scalable mode ATS enablement to probe path") Reported-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Closes: https://lore.kernel.org/linux-iommu/01b9c72f-460d-4f77-b696-54c6825babc9@linux.intel.com/ Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Link: https://lore.kernel.org/r/20250416073608.1799578-1-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 30a3f2f commit 4f1492e

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

drivers/iommu/intel/iommu.c

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3785,29 +3785,35 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev)
37853785

37863786
intel_iommu_debugfs_create_dev(info);
37873787

3788+
return &iommu->iommu;
3789+
free_table:
3790+
intel_pasid_free_table(dev);
3791+
clear_rbtree:
3792+
device_rbtree_remove(info);
3793+
free:
3794+
kfree(info);
3795+
3796+
return ERR_PTR(ret);
3797+
}
3798+
3799+
static void intel_iommu_probe_finalize(struct device *dev)
3800+
{
3801+
struct device_domain_info *info = dev_iommu_priv_get(dev);
3802+
struct intel_iommu *iommu = info->iommu;
3803+
37883804
/*
37893805
* The PCIe spec, in its wisdom, declares that the behaviour of the
37903806
* device is undefined if you enable PASID support after ATS support.
37913807
* So always enable PASID support on devices which have it, even if
37923808
* we can't yet know if we're ever going to use it.
37933809
*/
37943810
if (info->pasid_supported &&
3795-
!pci_enable_pasid(pdev, info->pasid_supported & ~1))
3811+
!pci_enable_pasid(to_pci_dev(dev), info->pasid_supported & ~1))
37963812
info->pasid_enabled = 1;
37973813

3798-
if (sm_supported(iommu))
3814+
if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev))
37993815
iommu_enable_pci_ats(info);
38003816
iommu_enable_pci_pri(info);
3801-
3802-
return &iommu->iommu;
3803-
free_table:
3804-
intel_pasid_free_table(dev);
3805-
clear_rbtree:
3806-
device_rbtree_remove(info);
3807-
free:
3808-
kfree(info);
3809-
3810-
return ERR_PTR(ret);
38113817
}
38123818

38133819
static void intel_iommu_release_device(struct device *dev)
@@ -4391,6 +4397,7 @@ const struct iommu_ops intel_iommu_ops = {
43914397
.domain_alloc_sva = intel_svm_domain_alloc,
43924398
.domain_alloc_nested = intel_iommu_domain_alloc_nested,
43934399
.probe_device = intel_iommu_probe_device,
4400+
.probe_finalize = intel_iommu_probe_finalize,
43944401
.release_device = intel_iommu_release_device,
43954402
.get_resv_regions = intel_iommu_get_resv_regions,
43964403
.device_group = intel_iommu_device_group,

0 commit comments

Comments
 (0)