From patchwork Sat Mar 25 16:18:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Semwal X-Patchwork-Id: 95988 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp532187qgd; Sat, 25 Mar 2017 09:19:29 -0700 (PDT) X-Received: by 10.98.64.129 with SMTP id f1mr15851562pfd.123.1490458769858; Sat, 25 Mar 2017 09:19:29 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3si6723034pli.62.2017.03.25.09.19.29; Sat, 25 Mar 2017 09:19:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751354AbdCYQT3 (ORCPT + 5 others); Sat, 25 Mar 2017 12:19:29 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:36617 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751309AbdCYQT3 (ORCPT ); Sat, 25 Mar 2017 12:19:29 -0400 Received: by mail-pf0-f169.google.com with SMTP id o126so7965424pfb.3 for ; Sat, 25 Mar 2017 09:19:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=N8tq9x2SmgonydooiQtRGbVuo6DG+qhER+VBJeTK2Pk=; b=NgCA2jgwqn4SGLQju8e7QLMhQCb5ej4a8XKL082Ktq9rtHh9pCi2GF8Nk5bHAyvG/O NpBuhc62V6rXnvZ3mpLkwF6mp/KjbBNliHf2+W+TNxGLpRjSY8g2k2xAfC9/RyxZ1s96 xE7Xl81DrxGpN320ptl4HQElOhHQcOoLD7jyw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=N8tq9x2SmgonydooiQtRGbVuo6DG+qhER+VBJeTK2Pk=; b=QHPTDzJgnwdd4b3iKgzcYEfw41nWSqi27n7rCf4sICwnajyFnFbIQghkDGSp0jyvKW ju2V4xvxznJwzIRbWQIb/9hKWGgdvzKWKSF1B7214HliKP8KUAHwG/KzxSGzsybB/vz/ FPjPzfU97YmXTpYBIW0UOXhpGLyV0cU1AJqeaL6CytwZEdyMBk7gpiRDPTpEQqOi2Wtr qAdJXhLSY6aDFGYWoXb43hN/FbSYNLr0dwY9fOdYSK4TDy09AVVEubttkj9CWbNhVjwb JX2+qleZ4fZFu4un4guW6qTNt3Ju4amoFTsEeLXvQnJ1n73Vbzd7FkUJRcIFr9KYahyn bMYA== X-Gm-Message-State: AFeK/H1QC1coKuyfiqv7w09yxvGQyci4caHJtvwk1AItMepgqU5HNr6cdUBVQB3liYmrFWX+ X-Received: by 10.84.217.149 with SMTP id p21mr18342173pli.18.1490458767945; Sat, 25 Mar 2017 09:19:27 -0700 (PDT) Received: from phantom.lan ([106.51.225.38]) by smtp.gmail.com with ESMTPSA id q194sm11469541pfq.43.2017.03.25.09.19.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 25 Mar 2017 09:19:26 -0700 (PDT) From: Sumit Semwal To: stable@vger.kernel.org Cc: Bjorn Helgaas , Sasha Levin , Greg Kroah-Hartman , Sumit Semwal Subject: [PATCH for-4.4 11/19] PCI: Ignore BAR updates on virtual functions Date: Sat, 25 Mar 2017 21:48:11 +0530 Message-Id: <1490458699-24484-12-git-send-email-sumit.semwal@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490458699-24484-1-git-send-email-sumit.semwal@linaro.org> References: <1490458699-24484-1-git-send-email-sumit.semwal@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Bjorn Helgaas [ Upstream commit 63880b230a4af502c56dde3d4588634c70c66006 ] 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. We already ignore these updates because of 70675e0b6a1a ("PCI: Don't try to restore VF BARs"); this merely restructures it slightly to make it easier to split updates for standard and SR-IOV BARs. Signed-off-by: Bjorn Helgaas Reviewed-by: Gavin Shan Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sumit Semwal --- drivers/pci/pci.c | 4 ---- drivers/pci/setup-res.c | 5 ++--- 2 files changed, 2 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index a01e6d5..0e53488 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -519,10 +519,6 @@ 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 032a6b1..2506296 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c @@ -34,10 +34,9 @@ static void pci_std_update_resource(struct pci_dev *dev, int resno) int reg; struct resource *res = dev->resource + resno; - if (dev->is_virtfn) { - dev_warn(&dev->dev, "can't update VF BAR%d\n", resno); + /* Per SR-IOV spec 3.4.1.11, VF BARs are RO zero */ + if (dev->is_virtfn) return; - } /* * Ignore resources for unimplemented BARs and unused resource slots