[{"id":1765370,"web_url":"http://patchwork.ozlabs.org/comment/1765370/","msgid":"<2a89bd3c-53ef-9b11-08df-df1e56fd8cba@canonical.com>","list_archive_url":null,"date":"2017-09-08T13:42:30","subject":"Re: [SRU][Zesty][PATCH 2/2] [PATCH] PCI: Disable VF decoding before\n\tpcibios_sriov_disable() updates resources","submitter":{"id":7793,"url":"http://patchwork.ozlabs.org/api/people/7793/","name":"Joseph Salisbury","email":"joseph.salisbury@canonical.com"},"content":"On 09/08/2017 09:38 AM, Joseph Salisbury wrote:\n> From: Gavin Shan <gwshan@linux.vnet.ibm.com>\n>\n> A struct resource represents the address space consumed by a device.  We\n> should not modify that resource while the device is actively using the\n> address space.  For VFs, pci_iov_update_resource() enforces this by\n> printing a warning and doing nothing if the VFE (VF Enable) and MSE (VF\n> Memory Space Enable) bits are set.\n>\n> Previously, both sriov_enable() and sriov_disable() called the\n> pcibios_sriov_disable() arch hook, which may update the struct resource,\n> while VFE and MSE were enabled.  This effectively dropped the resource\n> update pcibios_sriov_disable() intended to do.\n>\n> Disable VF memory decoding before calling pcibios_sriov_disable().\n>\n> Reported-by: Carol L Soto <clsoto@us.ibm.com>\n> Tested-by: Carol L Soto <clsoto@us.ibm.com>\n> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>\n> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>\n> [bhelgaas: changelog]\n> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>\n> Cc: shan.gavin@gmail.com\n> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>\n> Cc: Paul Mackerras <paulus@samba.org>\n> (cherry picked from linux-next commit 0fc690a7c3f7053613dcbab6a7613bb6586d8ee2)\n> Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>\n> ---\n>  drivers/pci/iov.c | 7 ++++---\n>  1 file changed, 4 insertions(+), 3 deletions(-)\n>\n> diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c\n> index 2479ae8..138830f 100644\n> --- a/drivers/pci/iov.c\n> +++ b/drivers/pci/iov.c\n> @@ -331,7 +331,6 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)\n>  \twhile (i--)\n>  \t\tpci_iov_remove_virtfn(dev, i, 0);\n>  \n> -\tpcibios_sriov_disable(dev);\n>  err_pcibios:\n>  \tiov->ctrl &= ~(PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE);\n>  \tpci_cfg_access_lock(dev);\n> @@ -339,6 +338,8 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)\n>  \tssleep(1);\n>  \tpci_cfg_access_unlock(dev);\n>  \n> +\tpcibios_sriov_disable(dev);\n> +\n>  \tif (iov->link != dev->devfn)\n>  \t\tsysfs_remove_link(&dev->dev.kobj, \"dep_link\");\n>  \n> @@ -357,14 +358,14 @@ static void sriov_disable(struct pci_dev *dev)\n>  \tfor (i = 0; i < iov->num_VFs; i++)\n>  \t\tpci_iov_remove_virtfn(dev, i, 0);\n>  \n> -\tpcibios_sriov_disable(dev);\n> -\n>  \tiov->ctrl &= ~(PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE);\n>  \tpci_cfg_access_lock(dev);\n>  \tpci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl);\n>  \tssleep(1);\n>  \tpci_cfg_access_unlock(dev);\n>  \n> +\tpcibios_sriov_disable(dev);\n> +\n>  \tif (iov->link != dev->devfn)\n>  \t\tsysfs_remove_link(&dev->dev.kobj, \"dep_link\");\n>  \n\nI forgot to add the buglink in this patch.  Just let me know if I should\nsend a v2:\n\nBugLink: http://bugs.launchpad.net/bugs/1715073","headers":{"Return-Path":"<kernel-team-bounces@lists.ubuntu.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com\n\t(client-ip=91.189.94.19; helo=huckleberry.canonical.com;\n\tenvelope-from=kernel-team-bounces@lists.ubuntu.com;\n\treceiver=<UNKNOWN>)","Received":["from huckleberry.canonical.com (huckleberry.canonical.com\n\t[91.189.94.19])\n\tby ozlabs.org (Postfix) with ESMTP id 3xpdmY38TLz9s83;\n\tFri,  8 Sep 2017 23:42:37 +1000 (AEST)","from localhost ([127.0.0.1] helo=huckleberry.canonical.com)\n\tby huckleberry.canonical.com with esmtp (Exim 4.86_2)\n\t(envelope-from <kernel-team-bounces@lists.ubuntu.com>)\n\tid 1dqJYI-0007RY-Ef; Fri, 08 Sep 2017 13:42:34 +0000","from youngberry.canonical.com ([91.189.89.112])\n\tby huckleberry.canonical.com with esmtps\n\t(TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128)\n\t(Exim 4.86_2) (envelope-from <joseph.salisbury@canonical.com>)\n\tid 1dqJYG-0007R5-Cq\n\tfor kernel-team@lists.ubuntu.com; Fri, 08 Sep 2017 13:42:32 +0000","from 1.general.jsalisbury.us.vpn ([10.172.67.212])\n\tby youngberry.canonical.com with esmtpsa\n\t(TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.76) (envelope-from <joseph.salisbury@canonical.com>)\n\tid 1dqJYG-0005Ao-2g\n\tfor kernel-team@lists.ubuntu.com; Fri, 08 Sep 2017 13:42:32 +0000"],"Subject":"Re: [SRU][Zesty][PATCH 2/2] [PATCH] PCI: Disable VF decoding before\n\tpcibios_sriov_disable() updates resources","From":"Joseph Salisbury <joseph.salisbury@canonical.com>","To":"kernel-team@lists.ubuntu.com","References":"<cover.1504636892.git.joseph.salisbury@canonical.com>\n\t<5aeca0bb01c843b4bb2335385e842403386a2fa9.1504636892.git.joseph.salisbury@canonical.com>","Message-ID":"<2a89bd3c-53ef-9b11-08df-df1e56fd8cba@canonical.com>","Date":"Fri, 8 Sep 2017 09:42:30 -0400","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<5aeca0bb01c843b4bb2335385e842403386a2fa9.1504636892.git.joseph.salisbury@canonical.com>","Content-Language":"en-US","X-BeenThere":"kernel-team@lists.ubuntu.com","X-Mailman-Version":"2.1.20","Precedence":"list","List-Id":"Kernel team discussions <kernel-team.lists.ubuntu.com>","List-Unsubscribe":"<https://lists.ubuntu.com/mailman/options/kernel-team>,\n\t<mailto:kernel-team-request@lists.ubuntu.com?subject=unsubscribe>","List-Archive":"<https://lists.ubuntu.com/archives/kernel-team>","List-Post":"<mailto:kernel-team@lists.ubuntu.com>","List-Help":"<mailto:kernel-team-request@lists.ubuntu.com?subject=help>","List-Subscribe":"<https://lists.ubuntu.com/mailman/listinfo/kernel-team>,\n\t<mailto:kernel-team-request@lists.ubuntu.com?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"kernel-team-bounces@lists.ubuntu.com","Sender":"\"kernel-team\" <kernel-team-bounces@lists.ubuntu.com>"}}]