Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp7156979imm; Tue, 24 Jul 2018 09:16:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcP3hM2y92D6wL4pV2usLJijv9Yi3UYMSGhqst3SxZbwKbsZ3HmEcUidl3uJ0VBOzUwRY1r X-Received: by 2002:a63:e116:: with SMTP id z22-v6mr11650096pgh.89.1532448970833; Tue, 24 Jul 2018 09:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532448970; cv=none; d=google.com; s=arc-20160816; b=T1joURFPqZtZPbDfxOFW4UwmmpCfkuFkvfy5Tkzz0mD2Xsp4FKAyL6AzV3gjvK7pMJ /WssXypqFdH+JfKSox0PowhU0j8zDF+jIadsaDsJQKaNu+Pm7N760L9gnQ2lFl3Fe2/6 Sg99iQSqUUNUuhAAKa2X/tVknF1fsMh215N1uVwqD+hbRwmwQSSs7JrS7IePOrOpiCpM O8MpiJJL6U2SHOvEmICND7zX1muHA9FEvsqLi/vpPHkSlVE8V/puGu8uq4F/eAn/X6P9 RBxDOKqmjipqpzt4vdseLTyIRUk11T26i9GGMXLkCETIPsOBAtCGwzBilQ3q7EO1F3Ne B7Iw== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:arc-authentication-results; bh=Nhm9h6CBAXtWpfCbdlw5CAQ1CjBu9FGbGZh/BkfUrx0=; b=JhelJqOo+Pb4awUR54gU1g/ijZylUN4W+6cNvnWpPFWCM9NI8mTbMiO6Qc4ZW0KtEm DXJaOCFKvRCx9p+Y/dwMXm5NdGCIzSwf9vL9pddIzUwQ/mJpjAmkd8P0mwS6ECDGEN6k 7RTLge6agViGFL04zRPL+leSpZ7VtDcPP8cfbBdVspir1Ix8svRg1ZdO85TCX1joAXSa C/3vmof6uErNgZ/VEinkG/gGzCXmeg7FVfq7nUE2TjunIRzW/BCZ7wmMbQYuDZkeYE9j LMAZOYPg2BidT2BHpp3H80b/CSJeTEu+XtVsLozZDhE2CpgArlHGcvnCtaZuHaSzNJby YZDQ== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3-v6si11180797plk.47.2018.07.24.09.15.56; Tue, 24 Jul 2018 09:16:10 -0700 (PDT) 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388632AbeGXRV7 (ORCPT + 99 others); Tue, 24 Jul 2018 13:21:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41756 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388334AbeGXRV6 (ORCPT ); Tue, 24 Jul 2018 13:21:58 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1734B308FBB3; Tue, 24 Jul 2018 16:14:47 +0000 (UTC) Received: from gimli.home (ovpn-116-105.phx2.redhat.com [10.3.116.105]) by smtp.corp.redhat.com (Postfix) with ESMTP id C83172010CC6; Tue, 24 Jul 2018 16:14:46 +0000 (UTC) Subject: [PATCH v3 3/3] PCI: Intel DC P3700 NVMe delay after FLR quirk From: Alex Williamson To: linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org Date: Tue, 24 Jul 2018 10:14:46 -0600 Message-ID: <20180724161446.2729.78211.stgit@gimli.home> In-Reply-To: <20180724160440.2729.75178.stgit@gimli.home> References: <20180724160440.2729.75178.stgit@gimli.home> User-Agent: StGit/0.18-102-gdf9f MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 24 Jul 2018 16:14:47 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a device specific reset for Intel DC P3700 NVMe device which exhibits a timeout failure in drivers waiting for the ready status to update after NVMe enable if the driver interacts with the device too quickly after FLR. As this has been observed in device assignment scenarios, resolve this with a device specific reset quirk to add an additional, heuristically determined, delay after the FLR completes. Signed-off-by: Alex Williamson --- drivers/pci/quirks.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 3899cdd2514b..08fafd804588 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -3751,6 +3751,27 @@ static int nvme_disable_and_flr(struct pci_dev *dev, int probe) return 0; } +/* + * Intel DC P3700 NVMe controller will timeout waiting for ready status + * to change after NVMe enable if the driver starts interacting with the + * device too quickly after FLR. A 250ms delay after FLR has heuristically + * proven to produce reliably working results for device assignment cases. + */ +static int delay_250ms_after_flr(struct pci_dev *dev, int probe) +{ + if (!pcie_has_flr(dev)) + return -ENOTTY; + + if (probe) + return 0; + + pcie_flr(dev); + + msleep(250); + + return 0; +} + static const struct pci_dev_reset_methods pci_dev_reset_methods[] = { { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82599_SFP_VF, reset_intel_82599_sfp_virtfn }, @@ -3759,6 +3780,7 @@ static const struct pci_dev_reset_methods pci_dev_reset_methods[] = { { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IVB_M2_VGA, reset_ivb_igd }, { PCI_VENDOR_ID_SAMSUNG, 0xa804, nvme_disable_and_flr }, + { PCI_VENDOR_ID_INTEL, 0x0953, delay_250ms_after_flr }, { PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID, reset_chelsio_generic_dev }, { 0 }