From patchwork Tue Sep 4 23:11:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Wang X-Patchwork-Id: 1404601 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 3BDE9DF280 for ; Tue, 4 Sep 2012 23:26:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752693Ab2IDX0d (ORCPT ); Tue, 4 Sep 2012 19:26:33 -0400 Received: from eng.riverbed.com ([208.70.196.45]:29774 "EHLO smtp1.riverbed.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751154Ab2IDX0d (ORCPT ); Tue, 4 Sep 2012 19:26:33 -0400 X-Greylist: delayed 804 seconds by postgrey-1.27 at vger.kernel.org; Tue, 04 Sep 2012 19:26:33 EDT Received: from unknown (HELO tlssmtp) ([10.16.4.52]) by smtp1.riverbed.com with ESMTP; 04 Sep 2012 16:12:40 -0700 Received: from localhost.localdomain (unknown [216.200.161.146]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tlssmtp (Postfix) with ESMTP id 67AC26B957; Tue, 4 Sep 2012 16:12:40 -0700 (PDT) From: Jiang Wang To: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: clala@riverbed.com, Francis.St.Amant@riverbed.com, Jiang Wang , Jiang Wang Subject: [PATCH 1/1] pci-iov: Fix warnings when CONFIG_PCI_IOV is enabled Date: Tue, 4 Sep 2012 16:11:47 -0700 Message-Id: <1346800307-11041-1-git-send-email-Jiang.Wang@riverbed.com> X-Mailer: git-send-email 1.7.1 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org When CONFIG_PCI_IOV is enabled, the kernel will call sriov_init(). This function tries to allocate virtual resources even if the virtual function of a PCI devive is not enabled by the BIOS. This sometimes causes following warning messages during boot up: pci 0000:02:00.0: BAR 9: can't allocate mem resource [0x000000-0x3fffff] pci 0000:02:00.0: BAR 7: can't allocate mem resource [0x000000-0x03ffff] Tested on three Mitac motherboards. Signed-off-by: Jiang Wang --- drivers/pci/iov.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index 6554e1a..0ca8cb2 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c @@ -441,7 +441,8 @@ static int sriov_init(struct pci_dev *dev, int pos) if (ctrl & PCI_SRIOV_CTRL_VFE) { pci_write_config_word(dev, pos + PCI_SRIOV_CTRL, 0); ssleep(1); - } + } else + return 0; pci_read_config_word(dev, pos + PCI_SRIOV_TOTAL_VF, &total); if (!total)