From patchwork Fri Apr 7 12:40:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 9669413 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2D26760364 for ; Fri, 7 Apr 2017 12:40:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BCBD2848F for ; Fri, 7 Apr 2017 12:40:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EE50285E9; Fri, 7 Apr 2017 12:40:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B45B2848F for ; Fri, 7 Apr 2017 12:40:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933451AbdDGMkg (ORCPT ); Fri, 7 Apr 2017 08:40:36 -0400 Received: from 8bytes.org ([81.169.241.247]:48559 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933443AbdDGMkf (ORCPT ); Fri, 7 Apr 2017 08:40:35 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id 72051383; Fri, 7 Apr 2017 14:40:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1491568831; bh=AeIes9SSKsSFNdWnTFnPi3+iMTac4c9Fy4wfwOee1cQ=; h=From:To:Cc:Subject:Date:From; b=Pn5e9E9R+nPlz3cBi8tXaVQPWCQokkQ4Ls8T5JzHDBM8QfOkKAb9LaSanE7zgiu/E o9MHetlKELnZjp959kZXfmi7Lm0aExLI2G06l13qCGjVUFU3S5x6Ff7ejJcs9bYKp4 73qrkorXjy4QxRIdNvG0rw2NxQfmWPb3/gx1hMzosreIeQ/64rRUIZ4j4TdUt4iWtG PG4JfMB2g01UAGRbtrAvSDO8+/LC2ABeaHAOrstjxnzGarqqQWuuu5XCqfWCTtRCBn 29wpVvrdh+BchWZ5hwB8xxLu2+HKUlcpPimk+PJ6hu5nx0vdHYmqnOca7C2H/goa/O tLanLyn/gG6rg== From: Joerg Roedel To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Drake , Alexander Deucher , Samuel Sieb , Joerg Roedel Subject: [PATCH] PCI: Add ATS-disable quirk for AMD Stoney GPUs Date: Fri, 7 Apr 2017 14:40:28 +0200 Message-Id: <1491568828-17146-1-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 1.9.1 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Joerg Roedel ATS is broken on this hardware and causes IOMMU stalls and system failure. Disable ATS on these devices to make them usable again with IOMMU enabled. Note that the commit in the Fixes-tag is not buggy, it just uncovers the problem in the hardware by increasing the ATS-flush rate. Fixes: b1516a14657a ('iommu/amd: Implement flush queue') Signed-off-by: Joerg Roedel --- drivers/pci/quirks.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 6736836..3bc9856 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -4634,3 +4634,22 @@ static void quirk_no_aersid(struct pci_dev *pdev) DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2031, quirk_no_aersid); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2032, quirk_no_aersid); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2033, quirk_no_aersid); + +/* + * Some devices have a broken ATS implementation causing IOMMU stalls. + * Don't use ATS for those devices. + */ +static void quirk_disable_ats(struct pci_dev *pdev) +{ +#ifdef CONFIG_PCI_ATS + /* + * Set pdev->ats_cap = 0 to make pci_enable_ats() bail out + * early. + */ + dev_info(&pdev->dev, "QUIRK: Disabling ATS"); + pdev->ats_cap = 0; +#endif +} + +/* AMD Stoney platform GPU */ +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x98e4, quirk_disable_ats);