From patchwork Thu Aug 27 17:27:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 7086411 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2A211BEEC1 for ; Thu, 27 Aug 2015 17:28:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 21C46209D2 for ; Thu, 27 Aug 2015 17:28:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 37B2F209B3 for ; Thu, 27 Aug 2015 17:28:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753163AbbH0R2D (ORCPT ); Thu, 27 Aug 2015 13:28:03 -0400 Received: from mail-ig0-f179.google.com ([209.85.213.179]:37486 "EHLO mail-ig0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753079AbbH0R2B (ORCPT ); Thu, 27 Aug 2015 13:28:01 -0400 Received: by igui7 with SMTP id i7so41568613igu.0 for ; Thu, 27 Aug 2015 10:28:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=7713aEHNnYmkGh7Y30FDuGoiGURDQ8KZKV/ThGUqyss=; b=GTJiaq8ZnvqhljMWN9CPu7wEfL4a2IJCld8Pq3D6cJ9TfYpi+kViVHrP1jssnX7ci6 F6wvBQvCp2AZ0OrROsCjzU1w0sUZW8yG0ZhEobUsDq41IBhLUd+wjT00aaTp0gFUgZgU TqNa/w98l2w5pNrv29/BIIuC8wiciMrKvyU8yGVYxuUkEP4CxFqXiYt74Fk6IWXGW7kL Quen58b8HOCVjJYMP+3P5oIZutq0e/a3cFgBxtwlRMvxCLbuAvNDKlDu8uNVe6U+NNaj BMgzradexH2Z9F5AM68EN/PhyxJk7UBi5GwE5yuUnfA/Rek5ZHcoAKm0sOqUfxu9YwRz sMXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=7713aEHNnYmkGh7Y30FDuGoiGURDQ8KZKV/ThGUqyss=; b=B3jM3F+VlZDK/RKLt6CXl3yywXpKEKXgYWNgY4A7J9NbBmyQl42NVqqmCUJtmLa+q6 TvML4cktpTDkVhBhyPMtpI0WbsbCO7lQCnCnrNGT83Xkbhn7aN0yS6gPz/yW9iuJff/g f9Y7LGu2MQ5xbbjvKkoxhjA2IWf5NdhKEVdyyxX7fp0T+FmYKiiMdr6aEA9j5BFvmV3s tZ+hwG1FqFh8yG3LM9kJXUPsxBimzCYHRF1TLLuY+H+1TqJyx6pj3gwvVPVxr+GQ0llZ /1EjyY8efsFxvOavf204OGgMOAVuBgTD+PEoK53VJKmVn+/QQiNXCYdfhJZEMHY+Pww0 RjaQ== X-Gm-Message-State: ALoCoQmSFzcgPlHWIxV3eUEjBNGi7rcNyvYFWQSkzxzOUEzSQqBhuq9oyOZGad0MT/CQfZvxql1P X-Received: by 10.50.49.70 with SMTP id s6mr4686272ign.2.1440696480723; Thu, 27 Aug 2015 10:28:00 -0700 (PDT) Received: from google.com (173-27-161-33.client.mchsi.com. [173.27.161.33]) by smtp.gmail.com with ESMTPSA id s12sm2067707ioe.14.2015.08.27.10.27.58 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 27 Aug 2015 10:27:59 -0700 (PDT) Date: Thu, 27 Aug 2015 12:27:53 -0500 From: Bjorn Helgaas To: Wei Yang Cc: linux-pci@vger.kernel.org, Alex Williamson Subject: Re: [PATCH v2] PCI: Don't update VF's BAR Message-ID: <20150827172753.GA27056@google.com> References: <20150714221511.GM24416@google.com> <1438159978-32285-1-git-send-email-weiyang@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1438159978-32285-1-git-send-email-weiyang@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP [+cc Alex] On Wed, Jul 29, 2015 at 04:52:58PM +0800, Wei Yang wrote: > VF BARs are RO zero, so updating VF BARs will not take any effect. > See the SR-IOV spec r1.1, sec 3.4.1.11. > > Also this patch adds a warning in pci_update_resource() in case someone > really tries to update it. > > Signed-off-by: Wei Yang I applied this with some whitespace and changelog fixes to pci-4.4/virtualization for v4.4, thanks! I will rebase this branch v4.3-rc1 or later. You mentioned the justification (avoids "error updating" messages) on the mailing list. It helps me out if you include that in the changelog, but I added it for you. Bjorn commit fa47e4466c567b43bcf8e152a4425277b6d033d9 Author: Wei Yang Date: Wed Jul 29 16:52:58 2015 +0800 PCI: Don't try to restore VF BARs VF BARs are read-only zero, so updating VF BARs will not have any effect. See the SR-IOV spec r1.1, sec 3.4.1.11. Don't update VF BARs in pci_restore_bars(). This avoids spurious "BAR %d: error updating" messages that we see when doing vfio pass-through after 6eb7018705de ("vfio-pci: Move idle devices to D3hot power state"). [bhelgaas: changelog, fix whitespace] Signed-off-by: Wei Yang Signed-off-by: Bjorn Helgaas --- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 0008c95..1a682f8 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -473,7 +473,7 @@ int pci_wait_for_pending(struct pci_dev *dev, int pos, u16 mask) } /** - * pci_restore_bars - restore a devices BAR values (e.g. after wake-up) + * pci_restore_bars - restore a device's BAR values (e.g. after wake-up) * @dev: PCI device to have its BARs restored * * Restore the BAR values for a given device, so as to make it @@ -483,6 +483,10 @@ static void pci_restore_bars(struct pci_dev *dev) { int i; + /* Per SR-IOV spec 3.4.1.11, VF BARs are RO zero */ + if (dev->is_virtfn) + return; + for (i = 0; i < PCI_BRIDGE_RESOURCES; i++) pci_update_resource(dev, i); } diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index 232f925..152de5c 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c @@ -36,6 +36,11 @@ void pci_update_resource(struct pci_dev *dev, int resno) enum pci_bar_type type; struct resource *res = dev->resource + resno; + if (dev->is_virtfn) { + dev_warn(&dev->dev, "can't update VF BAR%d\n", resno); + return; + } + /* * Ignore resources for unimplemented BARs and unused resource slots * for 64 bit BARs.