Re: [PATCH Part2 v6 02/49] iommu/amd: Introduce function to check SEV-SNP support
From: Jarkko Sakkinen <jarkko@kernel.org>
Date: 2022-08-25 01:30:47
Also in:
kvm, linux-crypto, linux-mm, lkml
On Thu, Aug 25, 2022 at 04:28:12AM +0300, jarkko@kernel.org wrote:
On Tue, Jun 21, 2022 at 11:50:59AM -0600, Peter Gonda wrote:quoted
On Tue, Jun 21, 2022 at 11:45 AM Kalra, Ashish [off-list ref] wrote:quoted
[AMD Official Use Only - General] Hello Peter,quoted
quoted
+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");quoted
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.I agree we should be more precise. I just thought we should explicitly state something like: "SEV-SNP: IOMMU is either disabled or configured in passthrough mode, SNP cannot be supported".It really should be, in order to have any practical use: if (no_iommu) { pr_err("SEV-SNP: IOMMU is disabled.\n"); return false; } if (iommu_default_passthrough()) { pr_err("SEV-SNP: IOMMU is configured in passthrough mode.\n"); return false; } The comment is *completely* redundant, it absolutely does not serve any sane purpose. It just tells what the code already clearly stating. The combo error message on the other hand leaves you to the question "which one was it", and for that reason combining the checks leaves you to a louse debugging experience.
Also, are those really *errors*? That implies that there is something wrong. Since you can have a legit configuration, IMHO they should be either warn or info. What do you think? They are definitely not errors. BR, Jarkko