Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10269133imu; Wed, 5 Dec 2018 20:21:03 -0800 (PST) X-Google-Smtp-Source: AFSGD/VXfDaSEnDObV9rQLYXxTTqIPr8uSiH15qigg8lXZmVpIie/vhhYLW+tKpt1xBxeNpEajpR X-Received: by 2002:a17:902:d70b:: with SMTP id w11mr27307531ply.294.1544070063700; Wed, 05 Dec 2018 20:21:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544070063; cv=none; d=google.com; s=arc-20160816; b=tocnKWDzos4g611CDBdxU+MZbLvoT27msQ31QurPX5mnSl8tIULuCpKiqBX6jF2m6M wpv6NWIARi4h2dVNcy8evPKDCiDDhhJOn+nWbMzvYETe27fAEK3rPiBTeBI9+jaPLR4J zbcJA0iv5Tm0l5NP/MT30vSO7GlFdXNaFouHa4PippXKSVqC+GxY5oyr3V67VY1kGjW3 WYfJZ4lPkHc0K3SlKAzrX9Ju/6v1WVlDbMp5MzoCkXB6Navuthc86iPS23Cc59S5iLCh C2L4/NESvu1aAy/Ywpo63F8RWv1Juw4j3w+gyweRkQcFB/K17PEcML8UNVQySE3riHWm FqLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=M+YMVdxi+JVL40dWysSGyue3YisADFshC+SJA/TKWbQ=; b=DEgGDyutVQ67angI6P+KYFca7QccQIt2+Yh51yWpabWA2iaHBJE6TqKtFgB7BJmzDg bpWvtWckKdD5fNf+MwJG6xJFgYdsFOmrcIMTh5oDSLhsCFN0eErogV0hcyWyt+4bHn5c jrHocas9Mnfk+J5SXCQhs9E+U2M6DLQHG1LNvyLWsRG0JoEosFx9vsJhmsFzXJ9vmmCO Yck5RQGP0jrBL6dqK3pvEjiCXjeCSGeApEz1wqhzeoPRWPXVH6MimXn5zoU6PiDFcAGG kz81mpiKgIu1wPXrqhB4k3NhDdYQI+q5XJBbD8QmC0EDgRijwyxfb+cda5eLd6WPXM9O wtJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gibson.dropbear.id.au header.s=201602 header.b=TZ96w9Mt; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k5si11520491plt.111.2018.12.05.20.20.47; Wed, 05 Dec 2018 20:21:03 -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; dkim=pass header.i=@gibson.dropbear.id.au header.s=201602 header.b=TZ96w9Mt; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728971AbeLFEUB (ORCPT + 99 others); Wed, 5 Dec 2018 23:20:01 -0500 Received: from ozlabs.org ([203.11.71.1]:43561 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727695AbeLFEUA (ORCPT ); Wed, 5 Dec 2018 23:20:00 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 439Mnn2xg6z9s7h; Thu, 6 Dec 2018 15:19:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1544069997; bh=QfCDKFem+tJn9rNn8MYnoPCP4PC1UJhmRYJ4KBb7coM=; h=From:To:Cc:Subject:Date:From; b=TZ96w9MtVoS99ghXZApZhoWNx8WuX/FMIGjPUAoBNaRVseslpSluwbzk0ZeaEaLvM WM8SteRDD3oiMugu2haF5ucU+AtLrO3SZfuYHiwBmz2rRhsIe6nE70EiJZaGj0gG9+ zqjCZhQHXJlYkEXivu/LhE4VuTrQ1+ckaXa0SfS0= From: David Gibson To: davem@davemloft.net, saeedm@mellanox.com, ogerlitz@mellanox.com, tariqt@mellanox.com, bhelgaas@google.com, leon@kernel.org Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, alex.williamson@redhat.com, linux-pci@vger.kernel.org, linux-rdma@vger.kernel.org, sbest@redhat.com, paulus@samba.org, benh@kernel.crashing.org, David Gibson Subject: [PATCH] PCI: Add no-D3 quirk for Mellanox ConnectX-[45] Date: Thu, 6 Dec 2018 15:19:51 +1100 Message-Id: <20181206041951.22413-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mellanox ConnectX-5 IB cards (MT27800) seem to cause a call trace when unbound from their regular driver and attached to vfio-pci in order to pass them through to a guest. This goes away if the disable_idle_d3 option is used, so it looks like a problem with the hardware handling D3 state. To fix that more permanently, use a device quirk to disable D3 state for these devices. We do this by renaming the existing quirk_no_ata_d3() more generally and attaching it to the ConnectX-[45] devices (0x15b3:0x1013). Signed-off-by: David Gibson --- drivers/pci/quirks.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 4700d24e5d55..add3f516ca12 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -1315,23 +1315,24 @@ static void quirk_ide_samemode(struct pci_dev *pdev) } DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_10, quirk_ide_samemode); -/* Some ATA devices break if put into D3 */ -static void quirk_no_ata_d3(struct pci_dev *pdev) +/* Some devices (including a number of ATA cards) break if put into D3 */ +static void quirk_no_d3(struct pci_dev *pdev) { pdev->dev_flags |= PCI_DEV_FLAGS_NO_D3; } + /* Quirk the legacy ATA devices only. The AHCI ones are ok */ DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_ANY_ID, - PCI_CLASS_STORAGE_IDE, 8, quirk_no_ata_d3); + PCI_CLASS_STORAGE_IDE, 8, quirk_no_d3); DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_ATI, PCI_ANY_ID, - PCI_CLASS_STORAGE_IDE, 8, quirk_no_ata_d3); + PCI_CLASS_STORAGE_IDE, 8, quirk_no_d3); /* ALi loses some register settings that we cannot then restore */ DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_AL, PCI_ANY_ID, - PCI_CLASS_STORAGE_IDE, 8, quirk_no_ata_d3); + PCI_CLASS_STORAGE_IDE, 8, quirk_no_d3); /* VIA comes back fine but we need to keep it alive or ACPI GTM failures occur when mode detecting */ DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_VIA, PCI_ANY_ID, - PCI_CLASS_STORAGE_IDE, 8, quirk_no_ata_d3); + PCI_CLASS_STORAGE_IDE, 8, quirk_no_d3); /* * This was originally an Alpha-specific thing, but it really fits here. @@ -3367,6 +3368,10 @@ static void mellanox_check_broken_intx_masking(struct pci_dev *pdev) DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_ANY_ID, mellanox_check_broken_intx_masking); +/* Mellanox MT27800 (ConnectX-5) IB card seems to break with D3 + * In particular this shows up when the device is bound to the vfio-pci driver */ +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_CONNECTX4, quirk_no_d3) + static void quirk_no_bus_reset(struct pci_dev *dev) { dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET; -- 2.19.2