Re: [PATCH v1 2/2] iommu/arm-smmu-v3: Recover ATC invalidate timeouts

kernel test robot
2026-03-05T15:16:25Z

Hi Nicolin,

kernel test robot noticed the following build errors:

[auto build test ERROR on pci/next]
[also build test ERROR on pci/for-linus rafael-pm/linux-next rafael-pm/bleeding-edge soc/for-next linus/master v7.0-rc2 next-20260304]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Nicolin-Chen/iommu-Do-not-call-pci_dev_reset_iommu_done-unless-reset-succeeds/20260305-132923
base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link: https://lore.kernel.org/r/ca7ab934bf0f433b62a5c15d42241632c4cb9366.1772686998.git.nicolinc%40nvidia.com
patch subject: [PATCH v1 2/2] iommu/arm-smmu-v3: Recover ATC invalidate timeouts
config: arm64-randconfig-003-20260305 (https://download.01.org/0day-ci/archive/20260305/202603052303.jrfwR7CV-lkp@intel.com/config)
compiler: clang version 16.0.6 (https://github.com/llvm/llvm-project 7cbf1a2591520c2491aa35339f227775f4d3adf6)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260305/202603052303.jrfwR7CV-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603052303.jrfwR7CV-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:467:2: error: call to undeclared function 'pci_dev_lock'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
pci_dev_lock(pdev);
^
>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:471:2: error: call to undeclared function 'pci_dev_unlock'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
pci_dev_unlock(pdev);
^
>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:480:7: error: call to undeclared function 'pci_reset_function'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
if (!pci_reset_function(pdev)) {
^
3 errors generated.

vim +/pci_dev_lock +467 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

431
432 static void arm_smmu_atc_recovery_worker(struct work_struct *work)
433 {
434 struct arm_smmu_atc_recovery_param *param =
435 container_of(work, struct arm_smmu_atc_recovery_param, work);
436 struct pci_dev *pdev;
437
438 scoped_guard(mutex, &param->smmu->streams_mutex) {
439 struct arm_smmu_master *master;
440
441 master = arm_smmu_find_master(param->smmu, param->sid);
442 if (!master || WARN_ON(!dev_is_pci(master->dev)))
443 goto free_param;
444 pdev = to_pci_dev(master->dev);
445 pci_dev_get(pdev);
446 }
447
448 scoped_guard(spinlock_irqsave, &param->smmu->atc_recovery.lock) {
449 struct arm_smmu_atc_recovery_param *e;
450
451 list_for_each_entry(e, &param->smmu->atc_recovery.list, node) {
452 /* Device is already being recovered */
453 if (e->pdev == pdev)
454 goto put_pdev;
455 }
456 param->pdev = pdev;
457 list_add(&param->node, &param->smmu->atc_recovery.list);
458 }
459
460 /*
461 * Stop DMA (PCI) and block ATS (IOMMU) immediately, to prevent memory
462 * corruption. This must take pci_dev_lock to prevent any racy unplug.
463 *
464 * If pci_dev_reset_iommu_prepare() fails, pci_reset_function will call
465 * it again internally.
466 */
> 467 pci_dev_lock(pdev);
468 pci_clear_master(pdev);
469 if (pci_dev_reset_iommu_prepare(pdev))
470 pci_err(pdev, "failed to block ATS!\n");
> 471 pci_dev_unlock(pdev);
472
473 /*
474 * ATC timeout indicates the device has stopped responding to coherence
475 * protocol requests. The only safe recovery is a reset to flush stale
476 * cached translations. Note that pci_reset_function() internally calls
477 * pci_dev_reset_iommu_prepare/done() as well and ensures to block ATS
478 * if PCI-level reset fails.
479 */
> 480 if (!pci_reset_function(pdev)) {
481 /*
482 * If reset succeeds, set BME back. Otherwise, fence the system
483 * from a faulty device, in which case user will have to replug
484 * the device to invoke pci_set_master().
485 */
486 pci_dev_lock(pdev);
487 pci_set_master(pdev);
488 pci_dev_unlock(pdev);
489 }
490 scoped_guard(spinlock_irqsave, &param->smmu->atc_recovery.lock)
491 list_del(&param->node);
492 put_pdev:
493 pci_dev_put(pdev);
494 free_param:
495 kfree(param);
496 }
497

--
0-DAY CI Kernel Test Service