lkml.org 
[lkml]   [2022]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH Part2 v6 02/49] iommu/amd: Introduce function to check SEV-SNP support
Date
[AMD Official Use Only - General]

Hello Boris,

>> +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?

This function is required to ensure that IOMMU supports the SEV-SNP feature before enabling the SNP feature
and calling SNP_INIT. This IOMMU support check is done in the AMD IOMMU driver with the
iommu_sev_snp_supported() function so it is exported by the IOMMU driver and called by sev module
later for SNP initialization in snp_rmptable_init().

Thanks,
Ashish

\
 
 \ /
  Last update: 2022-07-05 16:08    [W:0.209 / U:23.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site