From patchwork Wed Aug 2 03:44:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 9875913 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 A80E86037D for ; Wed, 2 Aug 2017 03:45:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9669321BED for ; Wed, 2 Aug 2017 03:45:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B451286E4; Wed, 2 Aug 2017 03:45:04 +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=unavailable 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 4B82B21BED for ; Wed, 2 Aug 2017 03:45:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751743AbdHBDoU (ORCPT ); Tue, 1 Aug 2017 23:44:20 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:45540 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751696AbdHBDoT (ORCPT ); Tue, 1 Aug 2017 23:44:19 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 240B460241; Wed, 2 Aug 2017 03:44:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1501645459; bh=fa8eUxUAdO7OqlOgbcb2wl2dsqYfOUTS6qIt/O4DW3Y=; h=From:To:Cc:Subject:Date:From; b=OKfqrNaOCdBsvKGytgwFaF3RqrxE+fZABRt0eJxqWjAQwfwBsKACPNtel3E5vFd84 //4byaWxdyBqaSLsBDF97O2QipTEg/lCHhC+9OrW0CEO61UIlKIMt4Nn787wx8TcYU 0GtYKT6mGUMaXGwfGKpERSe/hHSRBKafjeGDUbHU= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id A374760241; Wed, 2 Aug 2017 03:44:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1501645458; bh=fa8eUxUAdO7OqlOgbcb2wl2dsqYfOUTS6qIt/O4DW3Y=; h=From:To:Cc:Subject:Date:From; b=XaM/xW3+nf4jr90OYIRY/lsnKJo+WS+B7P2+15WSVhNzulcrq2XXzX/ZYru7dbFFa rtg70oIKEUM6nz+rJ1k4O04urTq9PU27Sx2mw6BagtYLXTdFPg9RyFFoON6OF+Vbys 5zSS84h9zEF7ICW49GGoSMqatnD6bVFZViUu7C3k= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A374760241 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org From: Sinan Kaya To: linux-pci@vger.kernel.org, timur@codeaurora.org, alex.williamson@redhat.com Cc: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sinan Kaya , linux-kernel@vger.kernel.org Subject: [PATCH V5 1/2] PCI: limit FLR wait time to 100ms maximum Date: Tue, 1 Aug 2017 23:44:12 -0400 Message-Id: <1501645453-22842-1-git-send-email-okaya@codeaurora.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 Code is currently allowing PCIe devices to extend polling time up to 1 second. Reducing the wait time for virtual functions to 100ms maximum to satisfy spec requirement mentioned in PCIe r3.1, sec 6.6.2. Function-Level Reset (FLR). SR-IOV r1.1, sec 2.2.2 also mentions that the virtual function's presence from configuration space is not affected from FLR. There is no point in polling the command register since it should always return success. Signed-off-by: Sinan Kaya --- drivers/pci/pci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index af0cc34..2ed604a 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -3812,7 +3812,7 @@ int pci_wait_for_pending_transaction(struct pci_dev *dev) EXPORT_SYMBOL(pci_wait_for_pending_transaction); /* - * We should only need to wait 100ms after FLR, but some devices take longer. + * We should only need to wait 100ms after FLR for virtual functions. * Wait for up to 1000ms for config space to return something other than -1. * Intel IGD requires this when an LCD panel is attached. We read the 2nd * dword because VFs don't implement the 1st dword. @@ -3822,6 +3822,11 @@ static void pci_flr_wait(struct pci_dev *dev) int i = 0; u32 id; + if (dev->is_virtfn) { + msleep(100); + return; + } + do { msleep(100); pci_read_config_dword(dev, PCI_COMMAND, &id);