Patch "iommu/amd: Do not identity map v2 capable device when snp is enabled" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    iommu/amd: Do not identity map v2 capable device when snp is enabled

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iommu-amd-do-not-identity-map-v2-capable-device-when.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 9b659b1c38392cff30cc2c4ace40b1d0044b5c88
Author: Vasant Hegde <vasant.hegde@xxxxxxx>
Date:   Tue Feb 7 09:17:52 2023 +0000

    iommu/amd: Do not identity map v2 capable device when snp is enabled
    
    [ Upstream commit 18792e99ea2fea27c72eb1ecca1879e5e6be304d ]
    
    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: fb2accadaa94 ("iommu/amd: Introduce function to check and enable SNP")
    CC: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
    Signed-off-by: Vasant Hegde <vasant.hegde@xxxxxxx>
    Link: https://lore.kernel.org/r/20230207091752.7656-1-vasant.hegde@xxxxxxx
    Signed-off-by: Joerg Roedel <jroedel@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index d3b39d0416fa3..46bf0744721dd 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -2394,12 +2394,17 @@ static int amd_iommu_def_domain_type(struct device *dev)
 		return 0;
 
 	/*
-	 * Do not identity map IOMMUv2 capable devices when memory encryption is
-	 * active, because some of those devices (AMD GPUs) don't have the
-	 * encryption bit in their DMA-mask and require remapping.
+	 * Do not identity map IOMMUv2 capable devices when:
+	 *  - memory encryption is active, because some of those devices
+	 *    (AMD GPUs) don't have the encryption bit in their DMA-mask
+	 *    and require remapping.
+	 *  - SNP is enabled, because it prohibits DTE[Mode]=0.
 	 */
-	if (!cc_platform_has(CC_ATTR_MEM_ENCRYPT) && dev_data->iommu_v2)
+	if (dev_data->iommu_v2 &&
+	    !cc_platform_has(CC_ATTR_MEM_ENCRYPT) &&
+	    !amd_iommu_snp_en) {
 		return IOMMU_DOMAIN_IDENTITY;
+	}
 
 	return 0;
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux