Received: by 10.213.65.68 with SMTP id h4csp1143758imn; Wed, 14 Mar 2018 10:51:57 -0700 (PDT) X-Google-Smtp-Source: AG47ELuyGE3S5O9WJ2oF8VFqxJL3Hz18gjCz0YwpMkyYatiQq9vMMHbwrho67H2bHQvrhwmwJuhN X-Received: by 10.101.83.65 with SMTP id w1mr4487973pgr.313.1521049917357; Wed, 14 Mar 2018 10:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521049917; cv=none; d=google.com; s=arc-20160816; b=w80s6bSU1CY3IWvMBIiA1AEgZ2+1cnuwKbxIGHmoFNMt3SOpnxJGZWEj2v/uMb1HP0 94mii8qUNQpk+huMxCLTnSAwun/pYvf7UXOcLBr3L9FMtOLXz9l3KvGzfhuGlwfPHhsP oWFPDX1C7U20Yo2Yk/rx+QHRyhrpNLT4a59df76YTDQ3DmPwwTNoAhDkjlvSGcPyQeVz oQxzuoUl4wA79xgSaJsb0ZYoOz/tgBYwStFk9NM7GoDTA4RYnIzGnrXdSV3Ho8BnTkdw z+87oXLE/2fxtuu/XOcEQk7ad1WzCRXNvuVD0zdWXmb405AjaocndOn7kcsFy68mUDmL UBQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:arc-authentication-results; bh=9mFOas4CGbIoXFQTEIyWiAZrrRWUkQTegqnPb5MHF7o=; b=huMWR33NKczucLdq+lkYlc0Nc6cNXfIfB5NFIMLjaubqExIrdgdiSspbmnXxsoyfKO RHfXsDvjklX2+mpByn+K0ewTqHMlRpG8hpQPiv6UsuV/vp+CVTa0zvMwZ0/NcU92cqnh VJMns4MhySMHdmMaKm1P7meuer3iy1lANmtndEW/3xP3scwH/Ff4qiWt5A1Ie8/NCTAS pnTZj50M+BjhUCRtlZsG6GVvGk8tdw+qlcudBm73KfQmnC+c6hOAATHDqfmpQXV6GHqx kGsZfoyQJnKonchZyA+ht/bdni96XC64hO2JN+gioJIP7lefsOIWELiwOl4IsuNNmYOt +DVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13-v6si2511589plk.153.2018.03.14.10.51.42; Wed, 14 Mar 2018 10:51:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751474AbeCNRus (ORCPT + 99 others); Wed, 14 Mar 2018 13:50:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:60776 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750950AbeCNRup (ORCPT ); Wed, 14 Mar 2018 13:50:45 -0400 Received: from localhost (unknown [69.71.5.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A582620779; Wed, 14 Mar 2018 17:50:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A582620779 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=helgaas@kernel.org Date: Wed, 14 Mar 2018 12:49:46 -0500 From: Bjorn Helgaas To: Andy Shevchenko Cc: linux-pci@vger.kernel.org, Mikael Starvik , Jesper Nilsson , Tony Luck , Fenghua Yu , David Howells , "Rafael J. Wysocki" , Cris , Linux Kernel Mailing List , linux-ia64@vger.kernel.org, linux-am33-list@redhat.com Subject: Re: [PATCH] PCI/MSI: Don't set up INTx if MSI or MSI-X is enabled Message-ID: <20180314174946.GB179719@bhelgaas-glaptop.roam.corp.google.com> References: <152097754955.241946.9551793957889760940.stgit@bhelgaas-glaptop.roam.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 14, 2018 at 06:31:38PM +0200, Andy Shevchenko wrote: > On Tue, Mar 13, 2018 at 11:45 PM, Bjorn Helgaas wrote: > > From: Bjorn Helgaas > > Agree with Christoph's comment. > > > If a device already has MSI or MSI-X enabled, there's no need to set up its > > legacy INTx interrupt. > > Just point to the actual behaviour of this. By "point to the actual behaviour", do you mean adding something to the changelog along the lines of the following? If MSI or MSI-X is enabled, the device uses that. It uses INTx only if both MSI and MSI-X are disabled (see PCIe r4.0, sec 7.7.1.2). I did add that because I think that spec reference is useful. If you have something else in mind, maybe an example would help me understand. > In some cases code in question has to distinguish between MSI and > MSI-x. So, this or similar changes has to be done with keeping > above in mind. > > (Existing example is Thunderbolt driver) Sorry, I didn't get your point here. Certainly some code needs to distinguish between MSI and MSI-X, but I don't think that's the case here. I'm not proposing to change Thunderbolt; I do see that it uses dev->msix_enabled (but not dev->msi_enabled), and it doesn't look like using pci_dev_msi_enabled() there would be appropriate. > > bba6f6fc68e7 ("[PATCH] MSI-X: fix resume crash") changed the cris, frv, > > x86, and ia64 arches to skip INTx setup when MSI is enabled. > > > > 16cf0ebc35dd ("x86/PCI: Do not use interrupt links for devices using > > MSI-X") extended that by changing x86 to also skip INTx setup when MSI-X is > > enabled. > > > > Change the remaining arches (cris, frv, and ia64) to skip INTx setup when > > either MSI or MSI-X is enabled. > > > > Also update mn10300 (which didn't exist at the time of bba6f6fc68e7) to > > follow the same pattern. > > Perhaps no need to change the architectures that are about to be > removed completely from the kernel. Yeah, I figured there was a danger of that, but I haven't kept up on exactly which are on the chopping block, so I figured it'd be trivial to drop anything that turns out to be unnecessary. > FWIW, > Reviewed-by: Andy Shevchenko > > > Signed-off-by: Bjorn Helgaas > > --- > > arch/cris/arch-v32/drivers/pci/bios.c | 2 +- > > arch/frv/mb93090-mb00/pci-vdk.c | 2 +- > > arch/ia64/pci/pci.c | 4 ++-- > > arch/mn10300/unit-asb2305/pci.c | 8 +++++--- > > 4 files changed, 9 insertions(+), 7 deletions(-) > > > > diff --git a/arch/cris/arch-v32/drivers/pci/bios.c b/arch/cris/arch-v32/drivers/pci/bios.c > > index 6b9e6cfaa29e..c2bed0cc060b 100644 > > --- a/arch/cris/arch-v32/drivers/pci/bios.c > > +++ b/arch/cris/arch-v32/drivers/pci/bios.c > > @@ -68,7 +68,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) > > if ((err = pcibios_enable_resources(dev, mask)) < 0) > > return err; > > > > - if (!dev->msi_enabled) > > + if (!pci_dev_msi_enabled(dev)) > > pcibios_enable_irq(dev); > > return 0; > > } > > diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c > > index f211839e2cae..4a55d1b82d21 100644 > > --- a/arch/frv/mb93090-mb00/pci-vdk.c > > +++ b/arch/frv/mb93090-mb00/pci-vdk.c > > @@ -413,7 +413,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) > > > > if ((err = pci_enable_resources(dev, mask)) < 0) > > return err; > > - if (!dev->msi_enabled) > > + if (!pci_dev_msi_enabled(dev)) > > pcibios_enable_irq(dev); > > return 0; > > } > > diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c > > index f5ec736100ee..7ccc64d5fe3e 100644 > > --- a/arch/ia64/pci/pci.c > > +++ b/arch/ia64/pci/pci.c > > @@ -398,7 +398,7 @@ pcibios_enable_device (struct pci_dev *dev, int mask) > > if (ret < 0) > > return ret; > > > > - if (!dev->msi_enabled) > > + if (!pci_dev_msi_enabled(dev)) > > return acpi_pci_irq_enable(dev); > > return 0; > > } > > @@ -407,7 +407,7 @@ void > > pcibios_disable_device (struct pci_dev *dev) > > { > > BUG_ON(atomic_read(&dev->enable_cnt)); > > - if (!dev->msi_enabled) > > + if (!pci_dev_msi_enabled(dev)) > > acpi_pci_irq_disable(dev); > > } > > > > diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c > > index 3dfe2d31c67b..4d36ea517679 100644 > > --- a/arch/mn10300/unit-asb2305/pci.c > > +++ b/arch/mn10300/unit-asb2305/pci.c > > @@ -399,10 +399,12 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) > > { > > int err; > > > > - err = pci_enable_resources(dev, mask); > > - if (err == 0) > > + if ((err = pci_enable_resources(dev, mask)) < 0) > > + return err; > > + > > + if (!pci_dev_msi_enabled(dev)) > > pcibios_enable_irq(dev); > > - return err; > > + return 0; > > } > > > > /* > > > > > > -- > With Best Regards, > Andy Shevchenko