Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iommu/amd: fix SEV-TIO support reporting

Commit eeb934137deb ("iommu/amd: Report SEV-TIO support") was confused
about the config options that expose amd_iommu_sev_tio_supported(), and
made the declaration (and alternative dummy function) conditional on the
CONFIG_AMD_IOMMU config option.

But the code is actually dependent on CONFIG_KVM_AMD_SEV, resulting in

ERROR: modpost: "amd_iommu_sev_tio_supported" [drivers/crypto/ccp/ccp.ko] undefined!
make[2]: *** [scripts/Makefile.modpost:147: Module.symvers] Error 1

if you have the AMD iommu enabled, but don't enable KVM_AMD_SEV support.

Fix it by moving the declaration into the right #ifdef section in the
header file.

Fixes: eeb934137deb ("iommu/amd: Report SEV-TIO support")
Cc: Alexey Kardashevskiy <aik@amd.com>
Cc: Joerg Roedel <joerg.roedel@amd.com>
Cc: Vasant Hegde <vasant.hegde@amd.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+2 -2
+2 -2
include/linux/amd-iommu.h
··· 18 18 struct pci_dev; 19 19 20 20 extern void amd_iommu_detect(void); 21 - extern bool amd_iommu_sev_tio_supported(void); 22 21 23 22 #else /* CONFIG_AMD_IOMMU */ 24 23 25 24 static inline void amd_iommu_detect(void) { } 26 - static inline bool amd_iommu_sev_tio_supported(void) { return false; } 27 25 28 26 #endif /* CONFIG_AMD_IOMMU */ 29 27 ··· 70 72 71 73 #ifdef CONFIG_KVM_AMD_SEV 72 74 int amd_iommu_snp_disable(void); 75 + extern bool amd_iommu_sev_tio_supported(void); 73 76 #else 74 77 static inline int amd_iommu_snp_disable(void) { return 0; } 78 + static inline bool amd_iommu_sev_tio_supported(void) { return false; } 75 79 #endif 76 80 77 81 #endif /* _ASM_X86_AMD_IOMMU_H */