iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Deucher, Alexander" <Alexander.Deucher@amd.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: "Lendacky, Thomas" <Thomas.Lendacky@amd.com>,
	"jroedel@suse.de" <jroedel@suse.de>,
	"Kuehling, Felix" <Felix.Kuehling@amd.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"Huang, Ray" <Ray.Huang@amd.com>,
	"Koenig, Christian" <Christian.Koenig@amd.com>
Subject: RE: [PATCH 0/2] iommu/amd: Fix IOMMUv2 devices when SME is active
Date: Sun, 6 Sep 2020 16:08:58 +0000	[thread overview]
Message-ID: <MN2PR12MB448843EC6D3D5B71613BEAAFF72B0@MN2PR12MB4488.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20200904100556.GU6714@8bytes.org>

[-- Attachment #1: Type: text/plain, Size: 1060 bytes --]

[AMD Official Use Only - Internal Distribution Only]

> -----Original Message-----
> From: Joerg Roedel <joro@8bytes.org>
> Sent: Friday, September 4, 2020 6:06 AM
> To: Deucher, Alexander <Alexander.Deucher@amd.com>
> Cc: jroedel@suse.de; Kuehling, Felix <Felix.Kuehling@amd.com>;
> iommu@lists.linux-foundation.org; Huang, Ray <Ray.Huang@amd.com>;
> Koenig, Christian <Christian.Koenig@amd.com>; Lendacky, Thomas
> <Thomas.Lendacky@amd.com>; Suthikulpanit, Suravee
> <Suravee.Suthikulpanit@amd.com>; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 0/2] iommu/amd: Fix IOMMUv2 devices when SME is
> active
>
> On Fri, Aug 28, 2020 at 03:47:07PM +0000, Deucher, Alexander wrote:
> > 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-drm-amdgpu-Fail-to-load-on-RAVEN-if-SME-is-active.patch --]
[-- Type: text/x-patch; name="0001-drm-amdgpu-Fail-to-load-on-RAVEN-if-SME-is-active.patch", Size: 1438 bytes --]

From f479b9da353c2547c26ebac8930a5dcd9a134eb7 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@amd.com>
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.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 12e16445df7c..d87d37c25329 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -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) {
-- 
2.25.4


[-- Attachment #3: Type: text/plain, Size: 156 bytes --]

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2020-09-06 16:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-24 10:54 [PATCH 0/2] iommu/amd: Fix IOMMUv2 devices when SME is active Joerg Roedel
2020-08-24 10:54 ` [PATCH 1/2] iommu/amd: Do not force direct mapping " Joerg Roedel
2020-08-26 14:23   ` Deucher, Alexander
2020-08-24 10:54 ` [PATCH 2/2] iommu/amd: Do not use IOMMUv2 functionality " Joerg Roedel
2020-08-26 14:20   ` Deucher, Alexander
2020-08-26 14:14 ` [PATCH 0/2] iommu/amd: Fix IOMMUv2 devices " Deucher, Alexander
2020-08-26 15:22   ` Felix Kuehling
2020-08-26 15:25     ` Deucher, Alexander
2020-08-28 13:46       ` jroedel
2020-08-28 13:54         ` Felix Kuehling
2020-08-28 15:11           ` Deucher, Alexander
2020-08-28 15:29             ` jroedel
2020-08-28 15:47               ` Deucher, Alexander
2020-09-04 10:05                 ` Joerg Roedel
2020-09-06 16:08                   ` Deucher, Alexander [this message]
2020-09-07 10:44                     ` Joerg Roedel
2020-09-07 11:10                       ` Christian König
2020-09-08  3:38                     ` Felix Kuehling
2020-08-28 15:27           ` jroedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MN2PR12MB448843EC6D3D5B71613BEAAFF72B0@MN2PR12MB4488.namprd12.prod.outlook.com \
    --to=alexander.deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Ray.Huang@amd.com \
    --cc=Thomas.Lendacky@amd.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=jroedel@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).