From patchwork Fri Mar 9 01:17:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 10269495 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B8BD26016D for ; Fri, 9 Mar 2018 01:26:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAC3829C44 for ; Fri, 9 Mar 2018 01:26:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9ED1629C46; Fri, 9 Mar 2018 01:26:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DC0929C44 for ; Fri, 9 Mar 2018 01:26:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751278AbeCIB0j (ORCPT ); Thu, 8 Mar 2018 20:26:39 -0500 Received: from ozlabs.ru ([107.173.13.209]:41462 "EHLO ozlabs.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751212AbeCIB0j (ORCPT ); Thu, 8 Mar 2018 20:26:39 -0500 X-Greylist: delayed 538 seconds by postgrey-1.27 at vger.kernel.org; Thu, 08 Mar 2018 20:26:39 EST Received: from vpl1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 39F663A60001; Thu, 8 Mar 2018 20:17:58 -0500 (EST) From: Alexey Kardashevskiy To: kvm@vger.kernel.org Cc: Alexey Kardashevskiy , Alex Williamson , Casey Leedom , Ganesh GR , "Arjun V ." , Indranil Choudhury , Nirranjan Kirubaharan Subject: [PATCH kernel] vfio: Print message about masking INTx only when it is known to be broken Date: Fri, 9 Mar 2018 12:17:36 +1100 Message-Id: <20180309011736.41300-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.11.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 2170dd04316e ("vfio-pci: Mask INTx if a device is not capabable of enabling it") is causing 'Masking broken INTx support' messages every time when a PCI without INTx support is enabled. This message is intended to appear when a device known for broken INTx is being enabled. However the message also appears on IOV virtual functions where INTx cannot possibly be enabled so saying that the "broken" support is masked is not correct. This changes the message to only appear when the device advertises INTx (via PCI_INTERRUPT_PIN != 0) but does not implement PCI 2.3 INTx masking. Fixes: 2170dd04316e ("vfio-pci: Mask INTx if a device is not capabable of enabling it") Signed-off-by: Alexey Kardashevskiy --- drivers/vfio/pci/vfio_pci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index b0f7594..7f2ec47 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -245,7 +245,13 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev) if (likely(!nointxmask)) { if (vfio_pci_nointx(pdev)) { - dev_info(&pdev->dev, "Masking broken INTx support\n"); + u8 pin = 0; + + pci_read_config_byte(vdev->pdev, PCI_INTERRUPT_PIN, + &pin); + if (pin) + dev_info(&pdev->dev, + "Masking broken INTx support\n"); vdev->nointx = true; pci_intx(pdev, 0); } else