]> www.infradead.org Git - users/dwmw2/linux.git/commit
iommu/amd: Don't rely on external callers to enable IOMMU SNP support
authorAshish Kalra <ashish.kalra@amd.com>
Fri, 26 Jan 2024 04:11:03 +0000 (22:11 -0600)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 29 Jan 2024 16:19:28 +0000 (17:19 +0100)
commit04d65a9dbb33e20500005e151d720acead78c539
treef31e359e49f8c965742e7e585e9977a684fe398e
parentacaa4b5c4c854b5009f4d4a5395b2609ad0f4937
iommu/amd: Don't rely on external callers to enable IOMMU SNP support

Currently, the expectation is that the kernel will call
amd_iommu_snp_enable() to perform various checks and set the
amd_iommu_snp_en flag that the IOMMU uses to adjust its setup routines
to account for additional requirements on hosts where SNP is enabled.

This is somewhat fragile as it relies on this call being done prior to
IOMMU setup. It is more robust to just do this automatically as part of
IOMMU initialization, so rework the code accordingly.

There is still a need to export information about whether or not the
IOMMU is configured in a manner compatible with SNP, so relocate the
existing amd_iommu_snp_en flag so it can be used to convey that
information in place of the return code that was previously provided by
calls to amd_iommu_snp_enable().

While here, also adjust the kernel messages related to IOMMU SNP
enablement for consistency/grammar/clarity.

Suggested-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
Co-developed-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Joerg Roedel <jroedel@suse.de>
Link: https://lore.kernel.org/r/20240126041126.1927228-4-michael.roth@amd.com
arch/x86/include/asm/iommu.h
drivers/iommu/amd/amd_iommu.h
drivers/iommu/amd/init.c
include/linux/amd-iommu.h