From patchwork Thu Feb 11 21:10:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 8284941 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1D0A49F38B for ; Thu, 11 Feb 2016 21:13:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4700E20364 for ; Thu, 11 Feb 2016 21:13:09 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 68B13202EC for ; Thu, 11 Feb 2016 21:13:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aTyVg-0006j8-O7; Thu, 11 Feb 2016 21:10:44 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aTyVf-0006iy-BZ for xen-devel@lists.xenproject.org; Thu, 11 Feb 2016 21:10:43 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id 9D/CA-07651-2D8FCB65; Thu, 11 Feb 2016 21:10:42 +0000 X-Env-Sender: konrad@char.us.oracle.com X-Msg-Ref: server-6.tower-31.messagelabs.com!1455225038!21857559!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 4835 invoked from network); 11 Feb 2016 21:10:39 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-6.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 11 Feb 2016 21:10:39 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u1BLAZpf027001 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Feb 2016 21:10:35 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u1BLAZIY009545 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 11 Feb 2016 21:10:35 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u1BLAYmi032742; Thu, 11 Feb 2016 21:10:34 GMT Received: from char.us.oracle.com (/10.137.176.158) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 11 Feb 2016 13:10:34 -0800 Received: by char.us.oracle.com (Postfix, from userid 1000) id 48FB56A0822; Thu, 11 Feb 2016 16:10:33 -0500 (EST) From: Konrad Rzeszutek Wilk To: Tommi Airikka , linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, david.vrabel@citrix.com, boris.ostrovsky@oracle.com Date: Thu, 11 Feb 2016 16:10:23 -0500 Message-Id: <1455225026-25792-2-git-send-email-konrad.wilk@oracle.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1455225026-25792-1-git-send-email-konrad.wilk@oracle.com> References: <1455225026-25792-1-git-send-email-konrad.wilk@oracle.com> X-Source-IP: userv0022.oracle.com [156.151.31.74] Cc: stable@vger.kernel.org, Konrad Rzeszutek Wilk Subject: [Xen-devel] [PATCH 1/4] xen/pciback: Check PF instead of VF for PCI_COMMAND_MEMORY X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 c/s 408fb0e5aa7fda0059db282ff58c3b2a4278baa0 "xen/pciback: Don't allow MSI-X ops if PCI_COMMAND_MEMORY is not set." would check the device for PCI_COMMAND_MEMORY which is great. Except that VF devices are unique - for example they have no legacy interrupts, and also any writes to PCI_COMMAND_MEMORY are silently ignored (by the hardware). CC: stable@vger.kernel.org Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: Jan Beulich --- drivers/xen/xen-pciback/pciback_ops.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c index 73dafdc..8c86a53 100644 --- a/drivers/xen/xen-pciback/pciback_ops.c +++ b/drivers/xen/xen-pciback/pciback_ops.c @@ -213,6 +213,7 @@ int xen_pcibk_enable_msix(struct xen_pcibk_device *pdev, int i, result; struct msix_entry *entries; u16 cmd; + struct pci_dev *phys_dev; if (unlikely(verbose_request)) printk(KERN_DEBUG DRV_NAME ": %s: enable MSI-X\n", @@ -227,8 +228,10 @@ int xen_pcibk_enable_msix(struct xen_pcibk_device *pdev, /* * PCI_COMMAND_MEMORY must be enabled, otherwise we may not be able * to access the BARs where the MSI-X entries reside. + * But VF devices are unique in which the PF needs to be checked. */ - pci_read_config_word(dev, PCI_COMMAND, &cmd); + phys_dev = pci_physfn(dev); + pci_read_config_word(phys_dev, PCI_COMMAND, &cmd); if (dev->msi_enabled || !(cmd & PCI_COMMAND_MEMORY)) return -ENXIO;