Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1580217ybc; Sun, 24 Nov 2019 01:46:41 -0800 (PST) X-Google-Smtp-Source: APXvYqx6hFY7xa6FUDX4T5OZB0VXvhDMDGeMdEgNBOGdb2FQfpEMHLv5aeT7c3K323Z1wh57Nddj X-Received: by 2002:aa7:cf8b:: with SMTP id z11mr11721484edx.294.1574588800963; Sun, 24 Nov 2019 01:46:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574588800; cv=none; d=google.com; s=arc-20160816; b=dF3uHLl/xP2IFA4Pm08wIUcf8EtnPH5JC9Ov9q8vbd/It8qui5PP7g9CfbbUXBZayf 88ec8WKhSlrVrOi8sTHJsDuoSBImmO9pwBLO8W3x+IhqX511i1LrpRwhDGn3hToYpNh6 KYYXBImxAPPqUMCOTsBbU0RepRVAG/iNLo/v7ZGxkA0WePgdZYbStsRX5se6W7jX3V/i L8cnT4SwzWigUv+g6Gey3Y7tRqlQbgJmA5/A+RbSjq/YWUTtk+OJdZI4AnB1zziybQlq rjDPLxD2Xt2JniHZeivS35/QyvAYHVodFCUs5ulunV1OpF8eqsLnF/CTj1ekPLeFDEdp FwkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Y90Gw3Zzmj5tMUrC1bn9jUhxnYNxqyWTn8iiC1Qr1TE=; b=RoONADXwyklmMUY8uWQfPJ26q+bmAFHZeJWrFjHz4BB13Iml6kD56pNWuDAVINF/Pq BPgbHt/aKomElGs3pDMBs4UsUDJ3lM7H9WF9y47WLSW87mSjjYxp9K8GslSCfn+ByuDi q7OST5ANwx0Qm7r3z/8eJTbYL28lGdMDCqAIKOiZO4pQxJKmW70ojJ1gg+veiZOEzwOo vZKV1KodyOmjLR3do31hrs9uTrWX+Yob8nhFkdFaNm07InTUdbtlSMVC2FbnImnlPPJE 1NLVuvAYIWBMYrEwRO6+aF5Sw4/giK/y5WTPsjck7N9uwyMs1vmj9zJXzg05dafCTxyE LNSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l47si2512365edb.111.2019.11.24.01.46.17; Sun, 24 Nov 2019 01:46:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726744AbfKXJnD (ORCPT + 99 others); Sun, 24 Nov 2019 04:43:03 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:48719 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725980AbfKXJnD (ORCPT ); Sun, 24 Nov 2019 04:43:03 -0500 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iYoPy-0003sy-Ux; Sun, 24 Nov 2019 09:42:59 +0000 From: Kai-Heng Feng To: joro@8bytes.org Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Kai-Heng Feng , Alex Deucher Subject: [PATCH] iommu/amd: Disable IOMMU on Stoney Ridge systems Date: Sun, 24 Nov 2019 17:42:53 +0800 Message-Id: <20191124094253.3433-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Bug: https://gitlab.freedesktop.org/drm/amd/issues/961 Signed-off-by: Kai-Heng Feng --- 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