[tip:x86/sev 22/33] drivers/crypto/ccp/sev-dev.c:1672: undefined reference to `amd_iommu_snp_disable'

From: kernel test robot
Date: Mon Feb 12 2024 - 20:48:02 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/sev
head: 45ba5b3c0a02949a4da74ead6e11c43e9b88bdca
commit: f366a8dac1b8fef28a470d4e67b9843ebb8e2a1f [22/33] iommu/amd: Clean up RMP entries for IOMMU pages during SNP shutdown
config: x86_64-randconfig-072-20240212 (https://download.01.org/0day-ci/archive/20240213/202402130940.IHNXTMSN-lkp@xxxxxxxxx/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240213/202402130940.IHNXTMSN-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402130940.IHNXTMSN-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

ld: drivers/crypto/ccp/sev-dev.o: in function `__sev_snp_shutdown_locked':
>> drivers/crypto/ccp/sev-dev.c:1672: undefined reference to `amd_iommu_snp_disable'


vim +1672 drivers/crypto/ccp/sev-dev.c

1626
1627 static int __sev_snp_shutdown_locked(int *error)
1628 {
1629 struct sev_device *sev = psp_master->sev_data;
1630 struct sev_data_snp_shutdown_ex data;
1631 int ret;
1632
1633 if (!sev->snp_initialized)
1634 return 0;
1635
1636 memset(&data, 0, sizeof(data));
1637 data.len = sizeof(data);
1638 data.iommu_snp_shutdown = 1;
1639
1640 wbinvd_on_all_cpus();
1641
1642 ret = __sev_do_cmd_locked(SEV_CMD_SNP_SHUTDOWN_EX, &data, error);
1643 /* SHUTDOWN may require DF_FLUSH */
1644 if (*error == SEV_RET_DFFLUSH_REQUIRED) {
1645 ret = __sev_do_cmd_locked(SEV_CMD_SNP_DF_FLUSH, NULL, NULL);
1646 if (ret) {
1647 dev_err(sev->dev, "SEV-SNP DF_FLUSH failed\n");
1648 return ret;
1649 }
1650 /* reissue the shutdown command */
1651 ret = __sev_do_cmd_locked(SEV_CMD_SNP_SHUTDOWN_EX, &data,
1652 error);
1653 }
1654 if (ret) {
1655 dev_err(sev->dev, "SEV-SNP firmware shutdown failed\n");
1656 return ret;
1657 }
1658
1659 /*
1660 * SNP_SHUTDOWN_EX with IOMMU_SNP_SHUTDOWN set to 1 disables SNP
1661 * enforcement by the IOMMU and also transitions all pages
1662 * associated with the IOMMU to the Reclaim state.
1663 * Firmware was transitioning the IOMMU pages to Hypervisor state
1664 * before version 1.53. But, accounting for the number of assigned
1665 * 4kB pages in a 2M page was done incorrectly by not transitioning
1666 * to the Reclaim state. This resulted in RMP #PF when later accessing
1667 * the 2M page containing those pages during kexec boot. Hence, the
1668 * firmware now transitions these pages to Reclaim state and hypervisor
1669 * needs to transition these pages to shared state. SNP Firmware
1670 * version 1.53 and above are needed for kexec boot.
1671 */
> 1672 ret = amd_iommu_snp_disable();
1673 if (ret) {
1674 dev_err(sev->dev, "SNP IOMMU shutdown failed\n");
1675 return ret;
1676 }
1677
1678 sev->snp_initialized = false;
1679 dev_dbg(sev->dev, "SEV-SNP firmware shutdown\n");
1680
1681 return ret;
1682 }
1683

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki