linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] iommu/amd: Disable IOMMU on Stoney Ridge systems
@ 2020-02-10  7:51 Kai-Heng Feng
  2020-02-10 15:16 ` Deucher, Alexander
  2020-02-19 10:09 ` Joerg Roedel
  0 siblings, 2 replies; 3+ messages in thread
From: Kai-Heng Feng @ 2020-02-10  7:51 UTC (permalink / raw)
  To: joro; +Cc: Kai-Heng Feng, Alex Deucher, open list:AMD IOMMU (AMD-VI), open list

Serious screen flickering when Stoney Ridge outputs to a 4K monitor.

Use identity-mapping and PCI ATS doesn't help this issue.

According to Alex Deucher, IOMMU isn't enabled on Windows, so let's do
the same here to avoid screen flickering on 4K monitor.

Cc: Alex Deucher <alexander.deucher@amd.com>
Bug: https://gitlab.freedesktop.org/drm/amd/issues/961
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
v3:
 - Update commit message to mention identity-mapping and ATS don't help.

v2:
 - Find Stoney graphics instead of host bridge.

 drivers/iommu/amd_iommu_init.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 2759a8d57b7f..6be3853a5d97 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -2523,6 +2523,7 @@ static int __init early_amd_iommu_init(void)
 	struct acpi_table_header *ivrs_base;
 	acpi_status status;
 	int i, remap_cache_sz, ret = 0;
+	u32 pci_id;
 
 	if (!amd_iommu_detected)
 		return -ENODEV;
@@ -2610,6 +2611,16 @@ static int __init early_amd_iommu_init(void)
 	if (ret)
 		goto out;
 
+	/* Disable IOMMU if there's Stoney Ridge graphics */
+	for (i = 0; i < 32; i++) {
+		pci_id = read_pci_config(0, i, 0, 0);
+		if ((pci_id & 0xffff) == 0x1002 && (pci_id >> 16) == 0x98e4) {
+			pr_info("Disable IOMMU on Stoney Ridge\n");
+			amd_iommu_disabled = true;
+			break;
+		}
+	}
+
 	/* Disable any previously enabled IOMMUs */
 	if (!is_kdump_kernel() || amd_iommu_disabled)
 		disable_iommus();
@@ -2718,7 +2729,7 @@ static int __init state_next(void)
 		ret = early_amd_iommu_init();
 		init_state = ret ? IOMMU_INIT_ERROR : IOMMU_ACPI_FINISHED;
 		if (init_state == IOMMU_ACPI_FINISHED && amd_iommu_disabled) {
-			pr_info("AMD IOMMU disabled on kernel command-line\n");
+			pr_info("AMD IOMMU disabled\n");
 			init_state = IOMMU_CMDLINE_DISABLED;
 			ret = -EINVAL;
 		}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH v3] iommu/amd: Disable IOMMU on Stoney Ridge systems
  2020-02-10  7:51 [PATCH v3] iommu/amd: Disable IOMMU on Stoney Ridge systems Kai-Heng Feng
@ 2020-02-10 15:16 ` Deucher, Alexander
  2020-02-19 10:09 ` Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Deucher, Alexander @ 2020-02-10 15:16 UTC (permalink / raw)
  To: Kai-Heng Feng, joro; +Cc: open list:AMD IOMMU (AMD-VI), open list

[AMD Public Use]

> -----Original Message-----
> From: Kai-Heng Feng <kai.heng.feng@canonical.com>
> Sent: Monday, February 10, 2020 2:51 AM
> To: joro@8bytes.org
> Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>; Deucher, Alexander
> <Alexander.Deucher@amd.com>; open list:AMD IOMMU (AMD-VI)
> <iommu@lists.linux-foundation.org>; open list <linux-
> kernel@vger.kernel.org>
> Subject: [PATCH v3] iommu/amd: Disable IOMMU on Stoney Ridge systems
> 
> Serious screen flickering when Stoney Ridge outputs to a 4K monitor.
> 
> Use identity-mapping and PCI ATS doesn't help this issue.
> 
> According to Alex Deucher, IOMMU isn't enabled on Windows, so let's do the
> same here to avoid screen flickering on 4K monitor.
> 
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Bug:
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitla
> b.freedesktop.org%2Fdrm%2Famd%2Fissues%2F961&amp;data=02%7C01%7
> Calexander.deucher%40amd.com%7C79aa213aaf2d4540064308d7adfe0749%
> 7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637169178877965485
> &amp;sdata=UeNw4%2FuQ3Rs5SwEvguDmdfuMEsizO8F138B%2B2GNleTY%
> 3D&amp;reserved=0
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>

Acked-by: Alex Deucher <alexander.deucher@amd.com>


> ---
> v3:
>  - Update commit message to mention identity-mapping and ATS don't help.
> 
> v2:
>  - Find Stoney graphics instead of host bridge.
> 
>  drivers/iommu/amd_iommu_init.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/amd_iommu_init.c
> b/drivers/iommu/amd_iommu_init.c index 2759a8d57b7f..6be3853a5d97
> 100644
> --- a/drivers/iommu/amd_iommu_init.c
> +++ b/drivers/iommu/amd_iommu_init.c
> @@ -2523,6 +2523,7 @@ static int __init early_amd_iommu_init(void)
>  	struct acpi_table_header *ivrs_base;
>  	acpi_status status;
>  	int i, remap_cache_sz, ret = 0;
> +	u32 pci_id;
> 
>  	if (!amd_iommu_detected)
>  		return -ENODEV;
> @@ -2610,6 +2611,16 @@ static int __init early_amd_iommu_init(void)
>  	if (ret)
>  		goto out;
> 
> +	/* Disable IOMMU if there's Stoney Ridge graphics */
> +	for (i = 0; i < 32; i++) {
> +		pci_id = read_pci_config(0, i, 0, 0);
> +		if ((pci_id & 0xffff) == 0x1002 && (pci_id >> 16) == 0x98e4) {
> +			pr_info("Disable IOMMU on Stoney Ridge\n");
> +			amd_iommu_disabled = true;
> +			break;
> +		}
> +	}
> +
>  	/* Disable any previously enabled IOMMUs */
>  	if (!is_kdump_kernel() || amd_iommu_disabled)
>  		disable_iommus();
> @@ -2718,7 +2729,7 @@ static int __init state_next(void)
>  		ret = early_amd_iommu_init();
>  		init_state = ret ? IOMMU_INIT_ERROR :
> IOMMU_ACPI_FINISHED;
>  		if (init_state == IOMMU_ACPI_FINISHED &&
> amd_iommu_disabled) {
> -			pr_info("AMD IOMMU disabled on kernel command-
> line\n");
> +			pr_info("AMD IOMMU disabled\n");
>  			init_state = IOMMU_CMDLINE_DISABLED;
>  			ret = -EINVAL;
>  		}
> --
> 2.17.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] iommu/amd: Disable IOMMU on Stoney Ridge systems
  2020-02-10  7:51 [PATCH v3] iommu/amd: Disable IOMMU on Stoney Ridge systems Kai-Heng Feng
  2020-02-10 15:16 ` Deucher, Alexander
@ 2020-02-19 10:09 ` Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2020-02-19 10:09 UTC (permalink / raw)
  To: Kai-Heng Feng; +Cc: Alex Deucher, open list:AMD IOMMU (AMD-VI), open list

On Mon, Feb 10, 2020 at 03:51:15PM +0800, Kai-Heng Feng wrote:
> Serious screen flickering when Stoney Ridge outputs to a 4K monitor.
> 
> Use identity-mapping and PCI ATS doesn't help this issue.
> 
> According to Alex Deucher, IOMMU isn't enabled on Windows, so let's do
> the same here to avoid screen flickering on 4K monitor.
> 
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Bug: https://gitlab.freedesktop.org/drm/amd/issues/961
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>

Applied, thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-19 10:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-10  7:51 [PATCH v3] iommu/amd: Disable IOMMU on Stoney Ridge systems Kai-Heng Feng
2020-02-10 15:16 ` Deucher, Alexander
2020-02-19 10:09 ` Joerg Roedel

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).