iommu/amd: Fix IOMMUv2 devices when SME is active
Subsystems (4)
Joerg Roedel
maintainercover iommu/amd: Fix IOMMUv2 devices when SME is active
From: Joerg Roedel <[email protected]>
Hi,
Some IOMMUv2 capable devices do not work correctly when SME is active, because their DMA mask does not include the encryption bit, so that they can not DMA to encrypted memory directly.
The IOMMU can jump in here, but the AMD IOMMU driver puts IOMMUv2 capable devices into an identity mapped domain. Fix that by not forcing an identity mapped domain on devices when SME is active and forbid using their IOMMUv2 functionality.
Please review.
Thanks,
Joerg
Joerg Roedel (2):
iommu/amd: Do not force direct mapping when SME is active iommu/amd: Do not use IOMMUv2 functionality when SME is active
drivers/iommu/amd/iommu.c | 7 ++++++- drivers/iommu/amd/iommu_v2.c | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-)
Signature · 6 lines
2.28.0 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Joerg Roedel
maintainerPATCH 1/2 iommu/amd: Do not force direct mapping when SME is active
From: Joerg Roedel <[email protected]>
Do not force devices supporting IOMMUv2 to be direct mapped when memory encryption is active. This might cause them to be unusable because their DMA mask does not include the encryption bit.
--- drivers/iommu/amd/iommu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/iommu/amd/iommu.c +6 -1
@@ -2659,7 +2659,12 @@ static int amd_iommu_def_domain_type(struct device *dev)if (!dev_data)return 0 ; -if (dev_data->iommu_v2) +/* +* 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. +*/ +if (!mem_encrypt_active () && dev_data->iommu_v2)return IOMMU_DOMAIN_IDENTITY ;return 0 ;
Signature · 6 lines
2.28.0 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Deucher, Alexander
maintainerRE: [PATCH 1/2] iommu/amd: Do not force direct mapping when SME is active
[AMD Public Use]
+ Felix, Christian
Quoted 35 lines
-----Original Message-----
From: Joerg Roedel <[email protected]>
Sent: Monday, August 24, 2020 6:54 AM
To: [email protected]
Cc: Joerg Roedel <[email protected]>; [email protected]; Lendacky, Thomas <[email protected]>; Suthikulpanit, Suravee <[email protected]>; Deucher, Alexander <[email protected]>; [email protected]
Subject: [PATCH 1/2] iommu/amd: Do not force direct mapping when SME is activeFrom: Joerg Roedel <[email protected]>
Do not force devices supporting IOMMUv2 to be direct mapped when memory encryption is active. This might cause them to be unusable because their DMA mask does not include the encryption bit.
Signed-off-by Joerg Roedel <[email protected]>--- drivers/iommu/amd/iommu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/iommu/amd/iommu.c +2
-1@@ -2659,7 +2659,12 @@ static int amd_iommu_def_domain_type(struct device *dev)if (!dev_data)return 0 ; -if (dev_data->iommu_v2) +/* +* Do not identity map IOMMUv2 capable devices when memory encryption is
drivers/iommu/amd/iommu.c static int amd_iommu_def_domain_type(struct device *dev) · line 2666
Quoted 3 lines
drivers/iommu/amd/iommu.c +3
-0+* active, because some of those devices (AMD GPUs) don't have the +* encryption bit in their DMA-mask and require remapping. +*/
I think on the integrated GPUs in APUs I'd prefer to have the identity mapping over SME, but I guess this is fine because you have to explicitly enable SME and if you do that you know what you are getting into.
Alex
Quoted 6 lines
drivers/iommu/amd/iommu.c +1
-1+if (!mem_encrypt_active () && dev_data->iommu_v2)return IOMMU_DOMAIN_IDENTITY ;return 0 ; --2.28.0
Joerg Roedel
maintainerPATCH 2/2 iommu/amd: Do not use IOMMUv2 functionality when SME is active
In reply to Joerg RoedelFrom: Joerg Roedel <[email protected]>
When memory encryption is active the device is likely not in a direct mapped domain. Forbid using IOMMUv2 functionality for now until finer grained checks for this have been implemented.
--- drivers/iommu/amd/iommu_v2.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/iommu/amd/iommu_v2.c +7 -0
@@ -737,6 +737,13 @@ int amd_iommu_init_device(struct pci_dev *pdev, int pasids)might_sleep (); +/* +* When memory encryption is active the device is likely not in a +* direct-mapped domain. Forbid using IOMMUv2 functionality for now. +*/ +if (mem_encrypt_active ()) +return -ENODEV ; +if (!amd_iommu_v2_supported ())return -ENODEV ;
Signature · 6 lines
2.28.0 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Deucher, Alexander
maintainerRE: [PATCH 2/2] iommu/amd: Do not use IOMMUv2 functionality when SME is active
[AMD Public Use]
+ Felix, Christian
Quoted 45 lines
-----Original Message-----
From: Joerg Roedel <[email protected]>
Sent: Monday, August 24, 2020 6:54 AM
To: [email protected]
Cc: Joerg Roedel <[email protected]>; [email protected]; Lendacky, Thomas <[email protected]>; Suthikulpanit, Suravee <[email protected]>; Deucher, Alexander <[email protected]>; [email protected]
Subject: [PATCH 2/2] iommu/amd: Do not use IOMMUv2 functionality when SME is activeFrom: Joerg Roedel <[email protected]>
When memory encryption is active the device is likely not in a direct mapped domain. Forbid using IOMMUv2 functionality for now until finer grained checks for this have been implemented.
Signed-off-by Joerg Roedel <[email protected]>--- drivers/iommu/amd/iommu_v2.c | 7 +++++++ 1 file changed, 7 insertions(+)(quoted diff) +0
-0
b/drivers/iommu/amd/iommu_v2.cindexc259108ab6dd..0d175aed1d92100644drivers/iommu/amd/iommu_v2.c +3
-0@@ -737,6 +737,13 @@ int amd_iommu_init_device(struct pci_dev *pdev, int pasids)might_sleep (); +/* +* When memory encryption is active the device is likely not in a +* direct-mapped domain. Forbid using IOMMUv2 functionality for now.
drivers/iommu/amd/iommu_v2.c +4
-1+*/ +if (mem_encrypt_active ()) +return -ENODEV ; +if (!amd_iommu_v2_supported ())return -ENODEV ; --2.28.0
Deucher, Alexander
maintainer[AMD Official Use Only - Internal Distribution Only]
+ Felix
________________________________
From: Joerg Roedel <[email protected]>
Sent: Monday, August 24, 2020 6:54 AM
To: [email protected] <[email protected]>
Cc: Joerg Roedel <[email protected]>; [email protected] <[email protected]>; Lendacky, Thomas <[email protected]>; Suthikulpanit, Suravee <[email protected]>; Deucher, Alexander <[email protected]>; [email protected] <[email protected]>
Subject: [PATCH 0/2] iommu/amd: Fix IOMMUv2 devices when SME is active
From: Joerg Roedel <[email protected]>
Hi,
Some IOMMUv2 capable devices do not work correctly when SME is active, because their DMA mask does not include the encryption bit, so that they can not DMA to encrypted memory directly.
The IOMMU can jump in here, but the AMD IOMMU driver puts IOMMUv2 capable devices into an identity mapped domain. Fix that by not forcing an identity mapped domain on devices when SME is active and forbid using their IOMMUv2 functionality.
Please review.
Thanks,
Joerg
Joerg Roedel (2):
iommu/amd: Do not force direct mapping when SME is active iommu/amd: Do not use IOMMUv2 functionality when SME is active
drivers/iommu/amd/iommu.c | 7 ++++++- drivers/iommu/amd/iommu_v2.c | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-)
--
2.28.0
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
[+Ray]
Thanks for the heads up. Currently KFD won't work on APUs when IOMMUv2 is disabled. But Ray is working on fallbacks that will allow KFD to work on APUs even without IOMMUv2, similar to our dGPUs. Along with changes in ROCm user mode, those fallbacks are necessary for making ROCm on APUs generally useful.
How common is SME on typical PCs or laptops that would use AMD APUs?
Alex, do you know if anyone has tested amdgpu on an APU with SME enabled? Is this considered something we support?
Thanks,
Felix
Am 2020-08-26 um 10:14 a.m. schrieb Deucher, Alexander:
Quoted 46 lines
[AMD Official Use Only - Internal Distribution Only]
+ Felix
------------------------------------------------------------------------
*From:* Joerg Roedel <[email protected]>
*Sent:* Monday, August 24, 2020 6:54 AM
*To:* [email protected] <[email protected]> *Cc:* Joerg Roedel <[email protected]>; [email protected] <[email protected]>; Lendacky, Thomas <[email protected]>; Suthikulpanit, Suravee <[email protected]>; Deucher, Alexander <[email protected]>; [email protected] <[email protected]>
*Subject:* [PATCH 0/2] iommu/amd: Fix IOMMUv2 devices when SME is active
From: Joerg Roedel <[email protected]>Hi,
Some IOMMUv2 capable devices do not work correctly when SME is active, because their DMA mask does not include the encryption bit, so that they can not DMA to encrypted memory directly.
The IOMMU can jump in here, but the AMD IOMMU driver puts IOMMUv2 capable devices into an identity mapped domain. Fix that by not forcing an identity mapped domain on devices when SME is active and forbid using their IOMMUv2 functionality.
Please review.
Thanks,
Joerg
Joerg Roedel (2):
iommu/amd: Do not force direct mapping when SME is active iommu/amd: Do not use IOMMUv2 functionality when SME is activedrivers/iommu/amd/iommu.c | 7 ++++++-
drivers/iommu/amd/iommu_v2.c | 7 +++++++2 files changed, 13 insertions(+), 1 deletion(-)Signature · 1 line
2.28.0
Deucher, Alexander
maintainer[AMD Public Use]
+ Christian
Quoted 15 lines
-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Wednesday, August 26, 2020 11:22 AM
To: Deucher, Alexander <[email protected]>; Joerg Roedel <[email protected]>; [email protected]; Huang, Ray <[email protected]>
Cc: [email protected]; Lendacky, Thomas <[email protected]>; Suthikulpanit, Suravee <[email protected]>; linux- [email protected]
Subject: Re: [PATCH 0/2] iommu/amd: Fix IOMMUv2 devices when SME is active[+Ray]
Quoted 8 lines
Thanks for the heads up. Currently KFD won't work on APUs when IOMMUv2 is disabled. But Ray is working on fallbacks that will allow KFD to work on APUs even without IOMMUv2, similar to our dGPUs. Along with changes in ROCm user mode, those fallbacks are necessary for making ROCm on APUs generally useful.
How common is SME on typical PCs or laptops that would use AMD APUs?
I think the hw supports it, but it as far as I know it's not formally productized on client parts.
Quoted 4 lines
Alex, do you know if anyone has tested amdgpu on an APU with SME enabled? Is this considered something we support?
It's not something we've tested. I'm not even sure the GPU portion of APUs will work properly without an identity mapping. SME should work properly with dGPUs however, so this is a proper fix for them. We don't use the IOMMUv2 path on dGPUs at all.
Alex
Quoted 56 lines
Thanks,
FelixAm 2020-08-26 um 10:14 a.m. schrieb Deucher, Alexander:
Quoted 49 lines
[AMD Official Use Only - Internal Distribution Only]
+ Felix
----------------------------------------------------------------------
--
*From:* Joerg Roedel <[email protected]>
*Sent:* Monday, August 24, 2020 6:54 AM
*To:* [email protected] <[email protected]>
*Cc:* Joerg Roedel <[email protected]>; [email protected] <[email protected]>; Lendacky, Thomas <[email protected]>; Suthikulpanit, Suravee <[email protected]>; Deucher, Alexander <[email protected]>; [email protected] <[email protected]>
*Subject:* [PATCH 0/2] iommu/amd: Fix IOMMUv2 devices when SME is activeFrom: Joerg Roedel <[email protected]>
Hi,
Some IOMMUv2 capable devices do not work correctly when SME is active, because their DMA mask does not include the encryption bit, so that they can not DMA to encrypted memory directly.
The IOMMU can jump in here, but the AMD IOMMU driver puts IOMMUv2 capable devices into an identity mapped domain. Fix that by not forcing an identity mapped domain on devices when SME is active and forbid using their IOMMUv2 functionality.
Please review.
Thanks,
Joerg
Joerg Roedel (2):
iommu/amd: Do not force direct mapping when SME is active iommu/amd: Do not use IOMMUv2 functionality when SME is activedrivers/iommu/amd/iommu.c | 7 ++++++-
drivers/iommu/amd/iommu_v2.c | 7 +++++++2 files changed, 13 insertions(+), 1 deletion(-)--
2.28.0
Quoted 7 lines · Alexander
Quoted 2 lines
Alex, do you know if anyone has tested amdgpu on an APU with SME enabled? Is this considered something we support?
It's not something we've tested. I'm not even sure the GPU portion of APUs will work properly without an identity mapping. SME should work properly with dGPUs however, so this is a proper fix for them. We don't use the IOMMUv2 path on dGPUs at all.
Is it possible to make the IOMMUv2 paths optional on iGPUs as well when SME is active (or better, when the GPU is not identity mapped)?
Regards,
Joerg
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Am 2020-08-28 um 9:46 a.m. schrieb [email protected]:
Quoted 9 lines · Alexander
Quoted 6 lines
Quoted 2 lines
Alex, do you know if anyone has tested amdgpu on an APU with SME enabled? Is this considered something we support?
It's not something we've tested. I'm not even sure the GPU portion of APUs will work properly without an identity mapping. SME should work properly with dGPUs however, so this is a proper fix for them. We don't use the IOMMUv2 path on dGPUs at all.
Is it possible to make the IOMMUv2 paths optional on iGPUs as well when SME is active (or better, when the GPU is not identity mapped)?
Yes, we're working on this. IOMMUv2 is only needed for KFD. It's not needed for graphics. And we're making it optional for KFD as well.
The question Alex and I raised here is more general. We may have some assumptions in the amdgpu driver that are broken when the framebuffer is not identity mapped. This would break the iGPU in a more general sense, regardless of KFD and IOMMUv2. In that case, we don't really need to worry about breaking KFD because we have a much bigger problem.
Regards,
Felix
Quoted 4 lines
Regards,
Joerg
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Deucher, Alexander
maintainer[AMD Public Use]
Quoted 23 lines
-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Friday, August 28, 2020 9:55 AM
To: [email protected]; Deucher, Alexander <[email protected]>
Cc: Joerg Roedel <[email protected]>; [email protected]; Huang, Ray <[email protected]>; Koenig, Christian <[email protected]>; Lendacky, Thomas <[email protected]>; Suthikulpanit, Suravee <[email protected]>; [email protected]
Subject: Re: [PATCH 0/2] iommu/amd: Fix IOMMUv2 devices when SME is activeAm 2020-08-28 um 9:46 a.m. schrieb [email protected]:
Quoted 9 lines · Alexander
Quoted 6 lines
Quoted 2 lines
Alex, do you know if anyone has tested amdgpu on an APU with SME enabled? Is this considered something we support?
It's not something we've tested. I'm not even sure the GPU portion of APUs will work properly without an identity mapping. SME should work properly with dGPUs however, so this is a proper fix for them. We don't use the IOMMUv2 path on dGPUs at all.
Is it possible to make the IOMMUv2 paths optional on iGPUs as well when SME is active (or better, when the GPU is not identity mapped)?
Quoted 8 lines
Yes, we're working on this. IOMMUv2 is only needed for KFD. It's not needed for graphics. And we're making it optional for KFD as well.
The question Alex and I raised here is more general. We may have some assumptions in the amdgpu driver that are broken when the framebuffer is not identity mapped. This would break the iGPU in a more general sense, regardless of KFD and IOMMUv2. In that case, we don't really need to worry about breaking KFD because we have a much bigger problem.
There are hw bugs on Raven and probably Carrizo/Stoney where they need 1:1 mapping to avoid bugs in some corner cases with the displays. Other GPUs should be fine. The VIDs is 0x1002 and the DIDs are 0x15dd and 0x15d8 for raven variants and 0x9870, 0x9874, 0x9875, 0x9876, 0x9877 and 0x98e4 for carrizo and stoney. As long as we preserve the 1:1 mapping for those asics, we should be fine.
Alex
Quoted 9 lines
Regards,
FelixQuoted 4 lines
Regards,
Joerg
Quoted 6 lines · Alexander
There are hw bugs on Raven and probably Carrizo/Stoney where they need 1:1 mapping to avoid bugs in some corner cases with the displays. Other GPUs should be fine. The VIDs is
0x1002and the DIDs are0x15ddand0x15d8for raven variants and0x9870,0x9874,0x9875,0x9876,0x9877and0x98e4for carrizo and stoney. As long as we preserve the 1:1 mapping for those asics, we should be fine.
Okay, Stoney at least has no Zen-based CPU, so no support for memory encryption anyway. How about Raven, is it paired with a Zen CPU?
Regards,
Joerg
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Deucher, Alexander
maintainer[AMD Public Use]
Quoted 20 lines
-----Original Message-----
From: [email protected] <[email protected]>
Sent: Friday, August 28, 2020 11:30 AM
To: Deucher, Alexander <[email protected]>
Cc: Kuehling, Felix <[email protected]>; Joerg Roedel <[email protected]>; [email protected]; Huang, Ray <[email protected]>; Koenig, Christian <[email protected]>; Lendacky, Thomas <[email protected]>; Suthikulpanit, Suravee <[email protected]>; [email protected]
Subject: Re: [PATCH 0/2] iommu/amd: Fix IOMMUv2 devices when SME is activeQuoted 6 lines · Alexander
There are hw bugs on Raven and probably Carrizo/Stoney where they need 1:1 mapping to avoid bugs in some corner cases with the displays. Other GPUs should be fine. The VIDs is
0x1002and the DIDs are0x15ddand0x15d8for raven variants and0x9870,0x9874,0x9875,0x9876,0x9877and0x98e4for carrizo and stoney. As long as we preserve the 1:1 mapping for those asics, we should be fine.
Quoted 2 lines
Okay, Stoney at least has no Zen-based CPU, so no support for memory encryption anyway. How about Raven, is it paired with a Zen CPU?
Ah, right, So CZ and ST are not an issue. Raven is paired with Zen based CPUs.
Thanks,
Alex
Joerg Roedel
maintainerQuoted 1 line · Alexander
Ah, right, So CZ and ST are not an issue. Raven is paired with Zen based CPUs.
Okay, so for the Raven case, can you add code to the amdgpu driver which makes it fail to initialize on Raven when SME is active? There is a global checking function for that, so that shouldn't be hard to do.
Regards,
Joerg
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Deucher, Alexander
maintainer[AMD Official Use Only - Internal Distribution Only]
Quoted 12 lines
-----Original Message-----
From: Joerg Roedel <[email protected]>
Sent: Friday, September 4, 2020 6:06 AM
To: Deucher, Alexander <[email protected]>
Cc: [email protected]; Kuehling, Felix <[email protected]>; [email protected]; Huang, Ray <[email protected]>; Koenig, Christian <[email protected]>; Lendacky, Thomas <[email protected]>; Suthikulpanit, Suravee <[email protected]>; [email protected]
Subject: Re: [PATCH 0/2] iommu/amd: Fix IOMMUv2 devices when SME is active
Quoted 8 lines
Quoted 1 line · Alexander
Ah, right, So CZ and ST are not an issue. Raven is paired with Zen based
CPUs.
Okay, so for the Raven case, can you add code to the amdgpu driver which makes it fail to initialize on Raven when SME is active? There is a global checking function for that, so that shouldn't be hard to do.
Sure. How about the attached patch?
Alex
From f479b9da353c2547c26ebac8930a5dcd9a134eb7 Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Sun, 6 Sep 2020 12:05:12 -0400
Subject: [PATCH] drm/amdgpu: Fail to load on RAVEN if SME is active
Due to hardware bugs, scatter/gather display on raven requires a 1:1 IOMMU mapping, however, SME (System Memory Encryption) requires an indirect IOMMU mapping because the encryption bit is beyond the DMA mask of the chip. As such, the two are incompatible.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +10 -0
@@ -1102,6 +1102,16 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,return -ENODEV ; } +/* Due to hardware bugs, S/G Display on raven requires a 1:1 IOMMU mapping, +* however, SME requires an indirect IOMMU mapping because the encryption +* bit is beyond the DMA mask of the chip. +*/ +if (mem_encrypt_active () && ((flags &AMD_ASIC_MASK ) ==CHIP_RAVEN )) { +dev_info (&pdev->dev, +"SME is not compatible with RAVEN\n" ); +return -ENOTSUPP ; + } +#ifdef CONFIG_DRM_AMDGPU_SI if (!amdgpu_si_support) {switch (flags &AMD_ASIC_MASK ) {
Signature · 1 line
2.25.4
Quoted 40 lines · Alexander
From
f479b9da353c2547c26ebac8930a5dcd9a134eb7Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Sun, 6 Sep 2020 12:05:12 -0400
Subject: [PATCH] drm/amdgpu: Fail to load on RAVEN if SME is activeDue to hardware bugs, scatter/gather display on raven requires a 1:1 IOMMU mapping, however, SME (System Memory Encryption) requires an indirect IOMMU mapping because the encryption bit is beyond the DMA mask of the chip. As such, the two are incompatible.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +10
-0@@ -1102,6 +1102,16 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,return -ENODEV ; } +/* Due to hardware bugs, S/G Display on raven requires a 1:1 IOMMU mapping, +* however, SME requires an indirect IOMMU mapping because the encryption +* bit is beyond the DMA mask of the chip. +*/ +if (mem_encrypt_active () && ((flags &AMD_ASIC_MASK ) ==CHIP_RAVEN )) { +dev_info (&pdev->dev, +"SME is not compatible with RAVEN\n" ); +return -ENOTSUPP ; + } +#ifdef CONFIG_DRM_AMDGPU_SI if (!amdgpu_si_support) {switch (flags &AMD_ASIC_MASK ) {Signature · 1 line
2.25.4
Looks good to me, thanks.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Am 07.09.20 um 12:44 schrieb Joerg Roedel:
Quoted 43 lines · Alexander
Quoted 40 lines
From
f479b9da353c2547c26ebac8930a5dcd9a134eb7Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Sun, 6 Sep 2020 12:05:12 -0400
Subject: [PATCH] drm/amdgpu: Fail to load on RAVEN if SME is activeDue to hardware bugs, scatter/gather display on raven requires a 1:1 IOMMU mapping, however, SME (System Memory Encryption) requires an indirect IOMMU mapping because the encryption bit is beyond the DMA mask of the chip. As such, the two are incompatible.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +10
-0@@ -1102,6 +1102,16 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,return -ENODEV ; } +/* Due to hardware bugs, S/G Display on raven requires a 1:1 IOMMU mapping, +* however, SME requires an indirect IOMMU mapping because the encryption +* bit is beyond the DMA mask of the chip. +*/ +if (mem_encrypt_active () && ((flags &AMD_ASIC_MASK ) ==CHIP_RAVEN )) { +dev_info (&pdev->dev, +"SME is not compatible with RAVEN\n" ); +return -ENOTSUPP ; + } +#ifdef CONFIG_DRM_AMDGPU_SI if (!amdgpu_si_support) {switch (flags &AMD_ASIC_MASK ) {Signature · 1 line
2.25.4Looks good to me, thanks.
Quoted 1 line
Acked-by Joerg Roedel <[email protected]>
This is really unfortunate, but I don't see any other solution either.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Felix Kuehling
Acked-byAm 2020-09-06 um 12:08 p.m. schrieb Deucher, Alexander:
Quoted 15 lines
[AMD Official Use Only - Internal Distribution Only]
Quoted 13 lines
-----Original Message-----
From: Joerg Roedel <[email protected]>
Sent: Friday, September 4, 2020 6:06 AM
To: Deucher, Alexander <[email protected]>
Cc: [email protected]; Kuehling, Felix <[email protected]>; [email protected]; Huang, Ray <[email protected]>; Koenig, Christian <[email protected]>; Lendacky, Thomas <[email protected]>; Suthikulpanit, Suravee <[email protected]>; [email protected]
Subject: Re: [PATCH 0/2] iommu/amd: Fix IOMMUv2 devices when SME is activeOn Fri, Aug 28, 2020 at 03:47:07PM +0000, Deucher, Alexander wrote:
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
Ah, right, So CZ and ST are not an issue. Raven is paired with Zen based
CPUs.
Okay, so for the Raven case, can you add code to the amdgpu driver which makes it fail to initialize on Raven when SME is active? There is a global checking function for that, so that shouldn't be hard to do.
Sure. How about the attached patch?
The patch is
Thanks,
Felix
Quoted 3 lines
Alex
Hi Felix,
Quoted 2 lines · Felix Kuehling
Yes, we're working on this. IOMMUv2 is only needed for KFD. It's not needed for graphics. And we're making it optional for KFD as well.
Okay, KFD should fail gracefully because it can't initialize the device's iommuv2 functionality.
Regards,
Joerg