Re: [PATCH Part2 v6 02/49] iommu/amd: Introduce function to check SEV-SNP support

Borislav Petkov
2022-07-01T10:43:07Z

On Mon, Jun 20, 2022 at 10:59:19PM +0000, Ashish Kalra wrote:
> +bool iommu_sev_snp_supported(void)
> +{
> + struct amd_iommu *iommu;
> +
> + /*
> + * The SEV-SNP support requires that IOMMU must be enabled, and is
> + * not configured in the passthrough mode.
> + */
> + if (no_iommu || iommu_default_passthrough()) {
> + pr_err("SEV-SNP: IOMMU is either disabled or configured in passthrough mode.\n");
> + return false;
> + }
> +
> + /*
> + * Iterate through all the IOMMUs and verify the SNPSup feature is
> + * enabled.
> + */
> + for_each_iommu(iommu) {
> + if (!iommu_feature(iommu, FEATURE_SNP)) {
> + pr_err("SNPSup is disabled (devid: %02x:%02x.%x)\n",
> + PCI_BUS_NUM(iommu->devid), PCI_SLOT(iommu->devid),
> + PCI_FUNC(iommu->devid));
> + return false;
> + }
> + }
> +
> + return true;
> +}
> +EXPORT_SYMBOL_GPL(iommu_sev_snp_supported);

Why is this function exported?

--
Regards/Gruss,
Boris.