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

From: Kalra, Ashish
Date: Tue Jun 21 2022 - 13:45:51 EST


[AMD Official Use Only - General]

Hello Peter,

>> +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");

> Like below could this say something like snp support is disabled because of iommu settings.

Here we may need to be more precise with the error information indicating why SNP is not enabled.
Please note that this patch may actually become part of the IOMMU + SNP patch series, where
additional checks are done, for example, not enabling SNP if IOMMU v2 page tables are enabled,
so precise error information will be useful here.

>> + 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",

> SNPSup might not be obvious to readers, what about " SNP Support is disabled ...".

Yes, that makes sense.

> Also should this have the "SEV-SNP:" prefix like the above log?

Probably, we want to be more consistent with the SNP guest patches and replace
SEV-SNP with SNP everywhere, including function names, etc.

Thanks,
Ashish