From: Kai-Heng Feng <kai.heng.feng@canonical.com>
To: joro@8bytes.org
Cc: Alex Deucher <alexander.deucher@amd.com>,
iommu@lists.linux-foundation.org,
Kai-Heng Feng <kai.heng.feng@canonical.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] iommu/amd: Disable IOMMU on Stoney Ridge systems
Date: Sun, 24 Nov 2019 17:42:53 +0800 [thread overview]
Message-ID: <20191124094253.3433-1-kai.heng.feng@canonical.com> (raw)
Serious screen flickering when Stoney Ridge outputs to a 4K monitor.
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>
---
drivers/iommu/amd_iommu_init.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 568c52317757..e05f1b269be6 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -2516,6 +2516,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;
@@ -2603,6 +2604,13 @@ static int __init early_amd_iommu_init(void)
if (ret)
goto out;
+ /* Get the host bridge VID/PID and disable IOMMU if it's Stoney Ridge */
+ pci_id = read_pci_config(0, 0, 0, 0);
+ if ((pci_id & 0xffff) == 0x1022 && (pci_id >> 16) == 0x1576) {
+ pr_info("Disable IOMMU on Stoney Ridge\n");
+ amd_iommu_disabled = true;
+ }
+
/* Disable any previously enabled IOMMUs */
if (!is_kdump_kernel() || amd_iommu_disabled)
disable_iommus();
@@ -2711,7 +2719,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
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next reply other threads:[~2019-11-24 9:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-24 9:42 Kai-Heng Feng [this message]
2019-11-25 19:51 ` [PATCH] iommu/amd: Disable IOMMU on Stoney Ridge systems Deucher, Alexander
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=20191124094253.3433-1-kai.heng.feng@canonical.com \
--to=kai.heng.feng@canonical.com \
--cc=alexander.deucher@amd.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--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).