]> git.baikalelectronics.ru Git - kernel.git/commit
iommu/amd: Do not identity map v2 capable device when snp is enabled
authorVasant Hegde <vasant.hegde@amd.com>
Tue, 7 Feb 2023 09:17:52 +0000 (09:17 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:39 +0000 (09:33 +0100)
commitb72c847b84f654bbf6c0536325ef594cea15b9c7
tree4a1480bed53bac01b5fa1bce70d12dee8903f18f
parent9526c12281d8b7758e29783cf01378144e8311a6
iommu/amd: Do not identity map v2 capable device when snp is enabled

[ Upstream commit 287d0ac7b90683334fc39013970ea1ea0b082ff8 ]

Flow:
  - Booted system with SNP enabled, memory encryption off and
    IOMMU DMA translation mode
  - AMD driver detects v2 capable device and amd_iommu_def_domain_type()
    returns identity mode
  - amd_iommu_domain_alloc() returns NULL an SNP is enabled
  - System will fail to register device

On SNP enabled system, passthrough mode is not supported. IOMMU default
domain is set to translation mode. We need to return zero from
amd_iommu_def_domain_type() so that it allocates translation domain.

Fixes: ad377ef0c13a ("iommu/amd: Introduce function to check and enable SNP")
CC: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Link: https://lore.kernel.org/r/20230207091752.7656-1-vasant.hegde@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iommu/amd/iommu.c